Socket
Socket
Sign inDemoInstall

formik

Package Overview
Dependencies
13
Maintainers
1
Versions
212
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.9 to 2.0.10

19

dist/Field.d.ts
import * as React from 'react';
import { FormikProps, GenericFieldHTMLAttributes, FieldMetaProps, FieldInputProps, FieldValidator } from './types';
export interface FieldProps<V = any> {
export interface FieldProps<V = any, FormValues = any> {
field: FieldInputProps<V>;
form: FormikProps<V>;
form: FormikProps<FormValues>;
meta: FieldMetaProps<V>;
}
export interface FieldConfig {
export interface FieldConfig<V = any> {
/**
* Field component to render. Can either be a string like 'select' or a component.
*/
component?: keyof JSX.IntrinsicElements | React.ComponentType<FieldProps<any>> | React.ComponentType;
component?: keyof JSX.IntrinsicElements | React.ComponentType<FieldProps<V>> | React.ComponentType;
/**
* Component to render. Can either be a string e.g. 'select', 'input', or 'textarea', or a component.
*/
as?: React.ComponentType<FieldProps<any>['field']> | keyof JSX.IntrinsicElements | React.ComponentType;
as?: React.ComponentType<FieldProps<V>['field']> | keyof JSX.IntrinsicElements | React.ComponentType;
/**

@@ -21,7 +21,7 @@ * Render prop (works like React router's <Route render={props =>} />)

*/
render?: (props: FieldProps<any>) => React.ReactNode;
render?: (props: FieldProps<V>) => React.ReactNode;
/**
* Children render function <Field name>{props => ...}</Field>)
*/
children?: ((props: FieldProps<any>) => React.ReactNode) | React.ReactNode;
children?: ((props: FieldProps<V>) => React.ReactNode) | React.ReactNode;
/**

@@ -42,7 +42,8 @@ * Validate a single field value independently

}
export declare type FieldAttributes<T> = GenericFieldHTMLAttributes & FieldConfig & T & {
export declare type FieldAttributes<T> = GenericFieldHTMLAttributes & FieldConfig<T> & T & {
name: string;
};
export declare function useField<Val = any>(propsOrFieldName: string | FieldAttributes<Val>): [FieldInputProps<Val>, FieldMetaProps<Val>];
export declare type FieldHookConfig<T> = GenericFieldHTMLAttributes & FieldConfig<T>;
export declare function useField<Val = any>(propsOrFieldName: string | FieldHookConfig<Val>): [FieldInputProps<Val>, FieldMetaProps<Val>];
export declare function Field({ validate, name, render, children, as: is, // `as` is reserved in typescript lol
component, ...props }: FieldAttributes<any>): any;

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var r=require("react"),t=e(require("react-fast-compare")),n=e(require("deepmerge")),i=e(require("lodash/isPlainObject")),a=e(require("lodash/clone")),o=e(require("lodash/toPath")),u=e(require("tiny-warning")),s=require("scheduler"),l=e(require("hoist-non-react-statics")),c=e(require("lodash/cloneDeep"));function p(){return(p=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function d(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}function f(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(i[t]=e[t]);return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var v=function(e){return Array.isArray(e)&&0===e.length},m=function(e){return"function"==typeof e},y=function(e){return null!==e&&"object"==typeof e},E=function(e){return String(Math.floor(Number(e)))===e},S=function(e){return"[object String]"===Object.prototype.toString.call(e)},T=function(e){return 0===r.Children.count(e)},g=function(e){return y(e)&&m(e.then)};function b(e,r,t,n){void 0===n&&(n=0);for(var i=o(r);e&&n<i.length;)e=e[i[n++]];return void 0===e?t:e}function F(e,r,t){for(var n=a(e),i=n,u=0,s=o(r);u<s.length-1;u++){var l=s[u],c=b(e,s.slice(0,u+1));if(c&&(y(c)||Array.isArray(c)))i=i[l]=a(c);else{var p=s[u+1];i=i[l]=E(p)&&Number(p)>=0?[]:{}}}return(0===u?e:i)[s[u]]===t?e:(void 0===t||v(t)?delete i[s[u]]:i[s[u]]=t,(0===u&&void 0===t||v(t))&&delete n[s[u]],n)}function k(e,r,t,n){void 0===t&&(t=new WeakMap),void 0===n&&(n={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],u=e[o];y(u)?t.get(u)||(t.set(u,!0),n[o]=Array.isArray(u)?[]:{},k(u,r,t,n[o])):n[o]=r}return n}var O=r.createContext(void 0),R=O.Provider,C=O.Consumer;function _(){var e=r.useContext(O);return e||u(!1),e}function A(e,r){switch(r.type){case"SET_VALUES":return p({},e,{values:r.payload});case"SET_TOUCHED":return p({},e,{touched:r.payload});case"SET_ERRORS":return t(e.errors,r.payload)?e:p({},e,{errors:r.payload});case"SET_STATUS":return p({},e,{status:r.payload});case"SET_ISSUBMITTING":return p({},e,{isSubmitting:r.payload});case"SET_ISVALIDATING":return p({},e,{isValidating:r.payload});case"SET_FIELD_VALUE":return p({},e,{values:F(e.values,r.payload.field,r.payload.value)});case"SET_FIELD_TOUCHED":return p({},e,{touched:F(e.touched,r.payload.field,r.payload.value)});case"SET_FIELD_ERROR":return p({},e,{errors:F(e.errors,r.payload.field,r.payload.value)});case"RESET_FORM":return p({},e,{},r.payload);case"SET_FORMIK_STATE":return r.payload(e);case"SUBMIT_ATTEMPT":return p({},e,{touched:k(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return p({},e,{isSubmitting:!1});default:return e}}var I={},P={};function x(e){var i=e.validateOnChange,a=void 0===i||i,o=e.validateOnBlur,u=void 0===o||o,l=e.validateOnMount,c=void 0!==l&&l,d=e.isInitialValid,h=e.enableReinitialize,v=void 0!==h&&h,E=e.onSubmit,T=f(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),k=p({validateOnChange:a,validateOnBlur:u,validateOnMount:c,onSubmit:E},T),O=r.useRef(k.initialValues),R=r.useRef(k.initialErrors||I),C=r.useRef(k.initialTouched||P),_=r.useRef(k.initialStatus),x=r.useRef(!1),U=r.useRef({});r.useEffect(function(){},[]),r.useEffect(function(){return x.current=!0,function(){x.current=!1}},[]);var M=r.useReducer(A,{values:k.initialValues,errors:k.initialErrors||I,touched:k.initialTouched||P,status:k.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),L=M[0],N=M[1],B=r.useCallback(function(e,r){return new Promise(function(t,n){var i=k.validate(e,r);null==i?t(I):g(i)?i.then(function(e){t(e||I)},function(e){n(e)}):t(i)})},[k.validate]),q=r.useCallback(function(e,r){var t=k.validationSchema,n=m(t)?t(r):t,i=r&&n.validateAt?n.validateAt(r,e):D(e,n);return new Promise(function(e,r){i.then(function(){e(I)},function(t){"ValidationError"===t.name?e(V(t)):r(t)})})},[k.validationSchema]),W=r.useCallback(function(e,r){return new Promise(function(t){return t(U.current[e].validate(r))})},[]),G=r.useCallback(function(e){var r=Object.keys(U.current).filter(function(e){return m(U.current[e].validate)}),t=r.length>0?r.map(function(r){return W(r,b(e,r))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(t).then(function(e){return e.reduce(function(e,t,n){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===t?e:(t&&(e=F(e,r[n],t)),e)},{})})},[W]),H=r.useCallback(function(e){return Promise.all([G(e),k.validationSchema?q(e):{},k.validate?B(e):{}]).then(function(e){return n.all([e[0],e[1],e[2]],{arrayMerge:w})})},[k.validate,k.validationSchema,G,B,q]),K=j(function(e){return void 0===e&&(e=L.values),s.unstable_runWithPriority(s.LowPriority,function(){return H(e).then(function(e){return x.current&&N({type:"SET_ERRORS",payload:e}),e}).catch(function(e){})})}),Y=j(function(e){return void 0===e&&(e=L.values),N({type:"SET_ISVALIDATING",payload:!0}),H(e).then(function(e){return x.current&&(N({type:"SET_ISVALIDATING",payload:!1}),t(L.errors,e)||N({type:"SET_ERRORS",payload:e})),e})});r.useEffect(function(){c&&!0===x.current&&K(k.initialValues)},[k.initialValues,c,K]);var z=r.useCallback(function(e){var r=e&&e.values?e.values:O.current,t=e&&e.errors?e.errors:R.current?R.current:k.initialErrors||{},n=e&&e.touched?e.touched:C.current?C.current:k.initialTouched||{},i=e&&e.status?e.status:_.current?_.current:k.initialStatus;O.current=r,R.current=t,C.current=n,_.current=i,N({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:t,touched:n,status:i,values:r,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[k.initialErrors,k.initialStatus,k.initialTouched]);r.useEffect(function(){v&&!0===x.current&&!t(O.current,k.initialValues)&&(O.current=k.initialValues,z())},[v,k.initialValues,z]),r.useEffect(function(){v&&!0===x.current&&!t(R.current,k.initialErrors)&&(R.current=k.initialErrors||I,N({type:"SET_ERRORS",payload:k.initialErrors||I}))},[v,k.initialErrors]),r.useEffect(function(){v&&!0===x.current&&!t(C.current,k.initialTouched)&&(C.current=k.initialTouched||P,N({type:"SET_TOUCHED",payload:k.initialTouched||P}))},[v,k.initialTouched]),r.useEffect(function(){v&&!0===x.current&&!t(_.current,k.initialStatus)&&(_.current=k.initialStatus,N({type:"SET_STATUS",payload:k.initialStatus}))},[v,k.initialStatus,k.initialTouched]);var J=j(function(e){if(m(U.current[e].validate)){var r=b(L.values,e),t=U.current[e].validate(r);return g(t)?(N({type:"SET_ISVALIDATING",payload:!0}),t.then(function(e){return e}).then(function(r){N({type:"SET_FIELD_ERROR",payload:{field:e,value:r}}),N({type:"SET_ISVALIDATING",payload:!1})})):(N({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),Promise.resolve(t))}return Promise.resolve()}),Q=r.useCallback(function(e,r){U.current[e]={validate:r.validate}},[]),X=r.useCallback(function(e){delete U.current[e]},[]),Z=j(function(e,r){return N({type:"SET_TOUCHED",payload:e}),(void 0===r?u:r)?K(L.values):Promise.resolve()}),$=r.useCallback(function(e){N({type:"SET_ERRORS",payload:e})},[]),ee=j(function(e,r){return N({type:"SET_VALUES",payload:e}),(void 0===r?a:r)?K(e):Promise.resolve()}),re=r.useCallback(function(e,r){N({type:"SET_FIELD_ERROR",payload:{field:e,value:r}})},[]),te=j(function(e,r,t){return N({type:"SET_FIELD_VALUE",payload:{field:e,value:r}}),(void 0===t?a:t)?K(F(L.values,e,r)):Promise.resolve()}),ne=r.useCallback(function(e,r){var t,n=r,i=e;if(!S(e)){e.persist&&e.persist();var a=e.target?e.target:e.currentTarget,o=a.type,u=a.value,s=a.checked,l=a.options,c=a.multiple;n=r||a.name||a.id,i=/number|range/.test(o)?(t=parseFloat(u),isNaN(t)?"":t):/checkbox/.test(o)?function(e,r,t){if("true"==t||"false"==t)return!!r;if(r&&t)return Array.isArray(e)?e.concat(t):[t];if(!Array.isArray(e))return!e;var n=e.indexOf(t);return n<0?e:e.slice(0,n).concat(e.slice(n+1))}(b(L.values,n),s,u):c?function(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}(l):u}n&&te(n,i)},[te,L.values]),ie=r.useCallback(function(e){if(S(e))return function(r){return ne(r,e)};ne(e)},[ne]),ae=j(function(e,r,t){return void 0===r&&(r=!0),N({type:"SET_FIELD_TOUCHED",payload:{field:e,value:r}}),(void 0===t?u:t)?K(L.values):Promise.resolve()}),oe=r.useCallback(function(e,r){e.persist&&e.persist();var t=e.target;ae(r||t.name||t.id,!0)},[ae]),ue=r.useCallback(function(e){if(S(e))return function(r){return oe(r,e)};oe(e)},[oe]),se=r.useCallback(function(e){m(e)?N({type:"SET_FORMIK_STATE",payload:e}):N({type:"SET_FORMIK_STATE",payload:function(){return e}})},[]),le=r.useCallback(function(e){N({type:"SET_STATUS",payload:e})},[]),ce=r.useCallback(function(e){N({type:"SET_ISSUBMITTING",payload:e})},[]),pe={resetForm:z,validateForm:Y,validateField:J,setErrors:$,setFieldError:re,setFieldTouched:ae,setFieldValue:te,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,setFormikState:se},de=j(function(){return E(L.values,pe)}),fe=j(function(){return N({type:"SUBMIT_ATTEMPT"}),Y().then(function(e){var r=e instanceof Error;if(!r&&0===Object.keys(e).length){var t;try{if(void 0===(t=de()))return}catch(e){throw e}return Promise.resolve(t).then(function(){x.current&&N({type:"SUBMIT_SUCCESS"})}).catch(function(e){if(x.current)throw N({type:"SUBMIT_FAILURE"}),e})}if(x.current&&(N({type:"SUBMIT_FAILURE"}),r))throw e})}),he=j(function(e){e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),fe().catch(function(e){console.warn("Warning: An unhandled error was caught from submitForm()",e)})}),ve=j(function(e){if(e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),k.onReset){var r=k.onReset(L.values,pe);g(r)?r.then(z):z()}else z()}),me=r.useCallback(function(e){return{value:b(L.values,e),error:b(L.errors,e),touched:!!b(L.touched,e),initialValue:b(O.current,e),initialTouched:!!b(C.current,e),initialError:b(R.current,e)}},[L.errors,L.touched,L.values]),ye=r.useCallback(function(e){var r=y(e),t=r?e.name:e,n=b(L.values,t),i={name:t,value:n,onChange:ie,onBlur:ue};if(r){var a=e.type,o=e.value,u=e.as,s=e.multiple;"checkbox"===a?void 0===o?i.checked=!!n:(i.checked=!(!Array.isArray(n)||!~n.indexOf(o)),i.value=o):"radio"===a?(i.checked=n===o,i.value=o):"select"===u&&s&&(i.value=i.value||[],i.multiple=!0)}return i},[ue,ie,L.values]),Ee=r.useMemo(function(){return!t(O.current,L.values)},[O.current,L.values]),Se=r.useMemo(function(){return void 0!==d?Ee?L.errors&&0===Object.keys(L.errors).length:!1!==d&&m(d)?d(k):d:L.errors&&0===Object.keys(L.errors).length},[d,Ee,L.errors,k]);return p({},L,{initialValues:O.current,initialErrors:R.current,initialTouched:C.current,initialStatus:_.current,handleBlur:ue,handleChange:ie,handleReset:ve,handleSubmit:he,resetForm:z,setErrors:$,setFormikState:se,setFieldTouched:ae,setFieldValue:te,setFieldError:re,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,submitForm:fe,validateForm:Y,validateField:J,isValid:Se,dirty:Ee,unregisterField:X,registerField:Q,getFieldProps:ye,getFieldMeta:me,validateOnBlur:u,validateOnChange:a,validateOnMount:c})}function U(e){var t=x(e),n=e.component,i=e.children,a=e.render;return r.useEffect(function(){},[]),r.createElement(R,{value:t},n?r.createElement(n,t):a?a(t):i?m(i)?i(t):T(i)?null:r.Children.only(i):null)}function V(e){var r={};if(e.inner){if(0===e.inner.length)return F(r,e.path,e.message);var t=e.inner,n=Array.isArray(t),i=0;for(t=n?t:t[Symbol.iterator]();;){var a;if(n){if(i>=t.length)break;a=t[i++]}else{if((i=t.next()).done)break;a=i.value}var o=a;b(r,o.path)||(r=F(r,o.path,o.message))}}return r}function D(e,r,t,n){void 0===t&&(t=!1),void 0===n&&(n={});var i=M(e);return r[t?"validateSync":"validate"](i,{abortEarly:!1,context:n})}function M(e){var r={};for(var t in e)if(e.hasOwnProperty(t)){var n=String(t);r[n]=!0===Array.isArray(e[n])?e[n].map(function(e){return!0===Array.isArray(e)||i(e)?M(e):""!==e?e:void 0}):i(e[n])?M(e[n]):""!==e[n]?e[n]:void 0}return r}function w(e,r,t){var i=e.slice();return r.forEach(function(r,a){if(void 0===i[a]){var o=!1!==t.clone&&t.isMergeableObject(r);i[a]=o?n(Array.isArray(r)?[]:{},r,t):r}else t.isMergeableObject(r)?i[a]=n(e[a],r,t):-1===e.indexOf(r)&&i.push(r)}),i}var L="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?r.useLayoutEffect:r.useEffect;function j(e){var t=r.useRef(e);return L(function(){t.current=e}),r.useCallback(function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.current.apply(void 0,r)},[])}var N=r.forwardRef(function(e,t){var n=e.action,i=f(e,["action"]),a=n||"#",o=_();return r.createElement("form",Object.assign({onSubmit:o.handleSubmit,ref:t,onReset:o.handleReset,action:a},i))});function B(e){var t=function(t){return r.createElement(C,null,function(n){return n||u(!1),r.createElement(e,Object.assign({},t,{formik:n}))})},n=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return t.WrappedComponent=e,t.displayName="FormikConnect("+n+")",l(t,e)}N.displayName="Form";var q=function(e,r,t){var n=K(e),i=n[r];return n.splice(r,1),n.splice(t,0,i),n},W=function(e,r,t){var n=K(e),i=n[r];return n[r]=n[t],n[t]=i,n},G=function(e,r,t){var n=K(e);return n.splice(r,0,t),n},H=function(e,r,t){var n=K(e);return n[r]=t,n},K=function(e){if(e){if(Array.isArray(e))return[].concat(e);var r=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,r){return r>e?r:e},0);return Array.from(p({},e,{length:r+1}))}return[]},Y=function(e){function n(r){var t;return(t=e.call(this,r)||this).updateArrayField=function(e,r,n){var i=t.props,a=i.name;(0,i.formik.setFormikState)(function(t){var i="function"==typeof n?n:e,o="function"==typeof r?r:e;return p({},t,{values:F(t.values,a,e(b(t.values,a))),errors:n?F(t.errors,a,i(b(t.errors,a))):t.errors,touched:r?F(t.touched,a,o(b(t.touched,a))):t.touched})})},t.push=function(e){return t.updateArrayField(function(r){return[].concat(K(r),[c(e)])},!1,!1)},t.handlePush=function(e){return function(){return t.push(e)}},t.swap=function(e,r){return t.updateArrayField(function(t){return W(t,e,r)},!0,!0)},t.handleSwap=function(e,r){return function(){return t.swap(e,r)}},t.move=function(e,r){return t.updateArrayField(function(t){return q(t,e,r)},!0,!0)},t.handleMove=function(e,r){return function(){return t.move(e,r)}},t.insert=function(e,r){return t.updateArrayField(function(t){return G(t,e,r)},function(r){return G(r,e,null)},function(r){return G(r,e,null)})},t.handleInsert=function(e,r){return function(){return t.insert(e,r)}},t.replace=function(e,r){return t.updateArrayField(function(t){return H(t,e,r)},!1,!1)},t.handleReplace=function(e,r){return function(){return t.replace(e,r)}},t.unshift=function(e){var r=-1;return t.updateArrayField(function(t){var n=t?[e].concat(t):[e];return r<0&&(r=n.length),n},function(e){var t=e?[null].concat(e):[null];return r<0&&(r=t.length),t},function(e){var t=e?[null].concat(e):[null];return r<0&&(r=t.length),t}),r},t.handleUnshift=function(e){return function(){return t.unshift(e)}},t.handleRemove=function(e){return function(){return t.remove(e)}},t.handlePop=function(){return function(){return t.pop()}},t.remove=t.remove.bind(h(t)),t.pop=t.pop.bind(h(t)),t}d(n,e);var i=n.prototype;return i.componentDidUpdate=function(e){!t(b(e.formik.values,e.name),b(this.props.formik.values,this.props.name))&&this.props.formik.validateOnChange&&this.props.formik.validateForm()},i.remove=function(e){var r;return this.updateArrayField(function(t){var n=t?K(t):[];return r||(r=n[e]),m(n.splice)&&n.splice(e,1),n},!0,!0),r},i.pop=function(){var e;return this.updateArrayField(function(r){var t=r;return e||(e=t&&t.pop&&t.pop()),t},!0,!0),e},i.render=function(){var e=this.props,t=e.component,n=e.render,i=e.children,a=e.name,o=p({},{push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},{form:f(e.formik,["validate","validationSchema"]),name:a});return t?r.createElement(t,o):n?n(o):i?"function"==typeof i?i(o):T(i)?null:r.Children.only(i):null},n}(r.Component);Y.defaultProps={validateOnChange:!0};var z=B(Y),J=B(function(e){function t(){return e.apply(this,arguments)||this}d(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return b(this.props.formik.errors,this.props.name)!==b(e.formik.errors,this.props.name)||b(this.props.formik.touched,this.props.name)!==b(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},n.render=function(){var e=this.props,t=e.component,n=e.formik,i=e.render,a=e.children,o=e.name,u=f(e,["component","formik","render","children","name"]),s=b(n.touched,o),l=b(n.errors,o);return s&&l?i?m(i)?i(l):null:a?m(a)?a(l):null:t?r.createElement(t,u,l):l:null},t}(r.Component)),Q=B(function(e){function t(r){var t;t=e.call(this,r)||this;var n=r.render,i=r.children,a=r.component,o=r.as;return n&&u(!1),a&&n&&u(!1),o&&i&&m(i)&&u(!1),a&&i&&m(i)&&u(!1),n&&i&&!T(i)&&u(!1),t}d(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return this.props.shouldUpdate?this.props.shouldUpdate(e,this.props):e.name!==this.props.name||b(e.formik.values,this.props.name)!==b(this.props.formik.values,this.props.name)||b(e.formik.errors,this.props.name)!==b(this.props.formik.errors,this.props.name)||b(e.formik.touched,this.props.name)!==b(this.props.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length||e.formik.isSubmitting!==this.props.formik.isSubmitting},n.componentDidMount=function(){this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentDidUpdate=function(e){this.props.name!==e.name&&(this.props.formik.unregisterField(e.name),this.props.formik.registerField(this.props.name,{validate:this.props.validate})),this.props.validate!==e.validate&&this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentWillUnmount=function(){this.props.formik.unregisterField(this.props.name)},n.render=function(){var e=this.props,t=e.name,n=e.render,i=e.as,a=e.children,o=e.component,u=e.formik,s=f(e,["validate","name","render","as","children","component","shouldUpdate","formik"]),l=f(u,["validate","validationSchema"]),c={value:"radio"===s.type||"checkbox"===s.type?s.value:b(u.values,t),name:t,onChange:u.handleChange,onBlur:u.handleBlur},d={field:c,meta:{value:b(u.values,t),error:b(u.errors,t),touched:!!b(u.touched,t),initialValue:b(u.initialValues,t),initialTouched:!!b(u.initialTouched,t),initialError:b(u.initialErrors,t)},form:l};if(n)return n(d);if(m(a))return a(d);if(o){if("string"==typeof o){var h=s.innerRef,v=f(s,["innerRef"]);return r.createElement(o,p({ref:h},c,{},v),a)}return r.createElement(o,p({field:c,form:u},s),a)}var y=i||"input";if("string"==typeof y){var E=s.innerRef,S=f(s,["innerRef"]);return r.createElement(y,p({ref:E},c,{},S),a)}return r.createElement(y,p({},c,{},s),a)},t}(r.Component));exports.ErrorMessage=J,exports.FastField=Q,exports.Field=function(e){var t=e.validate,n=e.name,i=e.render,a=e.children,o=e.as,u=e.component,s=f(e,["validate","name","render","children","as","component"]),l=f(_(),["validate","validationSchema"]);r.useEffect(function(){},[]);var c=l.registerField,d=l.unregisterField;r.useEffect(function(){return c(n,{validate:t}),function(){d(n)}},[c,d,n,t]);var h=l.getFieldProps(p({name:n},s)),v=l.getFieldMeta(n),y={field:h,form:l};if(i)return i(p({},y,{meta:v}));if(m(a))return a(p({},y,{meta:v}));if(u){if("string"==typeof u){var E=s.innerRef,S=f(s,["innerRef"]);return r.createElement(u,p({ref:E},h,{},S),a)}return r.createElement(u,p({field:h,form:l},s),a)}var T=o||"input";if("string"==typeof T){var g=s.innerRef,b=f(s,["innerRef"]);return r.createElement(T,p({ref:g},h,{},b),a)}return r.createElement(T,p({},h,{},s),a)},exports.FieldArray=z,exports.Form=N,exports.Formik=U,exports.FormikConsumer=C,exports.FormikContext=O,exports.FormikProvider=R,exports.connect=B,exports.getActiveElement=function(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(r){return e.body}},exports.getIn=b,exports.insert=G,exports.isEmptyArray=v,exports.isEmptyChildren=T,exports.isFunction=m,exports.isInputEvent=function(e){return e&&y(e)&&y(e.target)},exports.isInteger=E,exports.isNaN=function(e){return e!=e},exports.isObject=y,exports.isPromise=g,exports.isString=S,exports.move=q,exports.prepareDataForValidation=M,exports.replace=H,exports.setIn=F,exports.setNestedObjectValues=k,exports.swap=W,exports.useField=function(e){var t=_(),n=t.getFieldProps,i=t.getFieldMeta,a=t.registerField,o=t.unregisterField,s=y(e),l=s?e.name:e,c=s?e.validate:void 0;return r.useEffect(function(){return l&&a(l,{validate:c}),function(){l&&o(l)}},[a,o,l,c]),y(e)?(e.name||u(!1),[n(e),i(e.name)]):[n({name:e}),i(e)]},exports.useFormik=x,exports.useFormikContext=_,exports.validateYupSchema=D,exports.withFormik=function(e){var t=e.mapPropsToValues,n=void 0===t?function(e){var r={};for(var t in e)e.hasOwnProperty(t)&&"function"!=typeof e[t]&&(r[t]=e[t]);return r}:t,i=f(e,["mapPropsToValues"]);return function(e){var t=e.displayName||e.name||e.constructor&&e.constructor.name||"Component",a=function(t){function a(){var n;return(n=t.apply(this,arguments)||this).validate=function(e){return i.validate(e,n.props)},n.validationSchema=function(){return m(i.validationSchema)?i.validationSchema(n.props):i.validationSchema},n.handleSubmit=function(e,r){return i.handleSubmit(e,p({},r,{props:n.props}))},n.renderFormComponent=function(t){return r.createElement(e,Object.assign({},n.props,t))},n}return d(a,t),a.prototype.render=function(){var e=f(this.props,["children"]);return r.createElement(U,Object.assign({},e,i,{validate:i.validate&&this.validate,validationSchema:i.validationSchema&&this.validationSchema,initialValues:n(this.props),initialStatus:i.mapPropsToStatus&&i.mapPropsToStatus(this.props),initialErrors:i.mapPropsToErrors&&i.mapPropsToErrors(this.props),initialTouched:i.mapPropsToTouched&&i.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,children:this.renderFormComponent}))},a}(r.Component);return a.displayName="WithFormik("+t+")",l(a,e)}},exports.yupToFormErrors=V;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var r=require("react"),t=e(require("react-fast-compare")),n=e(require("deepmerge")),i=e(require("lodash/isPlainObject")),a=e(require("lodash/clone")),o=e(require("lodash/toPath")),u=e(require("tiny-warning")),s=require("scheduler"),l=e(require("hoist-non-react-statics")),c=e(require("lodash/cloneDeep"));function p(){return(p=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function d(e,r){e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r}function f(e,r){if(null==e)return{};var t,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(i[t]=e[t]);return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var v=function(e){return Array.isArray(e)&&0===e.length},m=function(e){return"function"==typeof e},y=function(e){return null!==e&&"object"==typeof e},E=function(e){return String(Math.floor(Number(e)))===e},S=function(e){return"[object String]"===Object.prototype.toString.call(e)},T=function(e){return 0===r.Children.count(e)},g=function(e){return y(e)&&m(e.then)};function b(e,r,t,n){void 0===n&&(n=0);for(var i=o(r);e&&n<i.length;)e=e[i[n++]];return void 0===e?t:e}function F(e,r,t){for(var n=a(e),i=n,u=0,s=o(r);u<s.length-1;u++){var l=s[u],c=b(e,s.slice(0,u+1));if(c&&(y(c)||Array.isArray(c)))i=i[l]=a(c);else{var p=s[u+1];i=i[l]=E(p)&&Number(p)>=0?[]:{}}}return(0===u?e:i)[s[u]]===t?e:(void 0===t||v(t)?delete i[s[u]]:i[s[u]]=t,(0===u&&void 0===t||v(t))&&delete n[s[u]],n)}function k(e,r,t,n){void 0===t&&(t=new WeakMap),void 0===n&&(n={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],u=e[o];y(u)?t.get(u)||(t.set(u,!0),n[o]=Array.isArray(u)?[]:{},k(u,r,t,n[o])):n[o]=r}return n}var O=r.createContext(void 0),R=O.Provider,C=O.Consumer;function _(){var e=r.useContext(O);return e||u(!1),e}function A(e,r){switch(r.type){case"SET_VALUES":return p({},e,{values:r.payload});case"SET_TOUCHED":return p({},e,{touched:r.payload});case"SET_ERRORS":return t(e.errors,r.payload)?e:p({},e,{errors:r.payload});case"SET_STATUS":return p({},e,{status:r.payload});case"SET_ISSUBMITTING":return p({},e,{isSubmitting:r.payload});case"SET_ISVALIDATING":return p({},e,{isValidating:r.payload});case"SET_FIELD_VALUE":return p({},e,{values:F(e.values,r.payload.field,r.payload.value)});case"SET_FIELD_TOUCHED":return p({},e,{touched:F(e.touched,r.payload.field,r.payload.value)});case"SET_FIELD_ERROR":return p({},e,{errors:F(e.errors,r.payload.field,r.payload.value)});case"RESET_FORM":return p({},e,{},r.payload);case"SET_FORMIK_STATE":return r.payload(e);case"SUBMIT_ATTEMPT":return p({},e,{touched:k(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return p({},e,{isSubmitting:!1});default:return e}}var I={},P={};function x(e){var i=e.validateOnChange,a=void 0===i||i,o=e.validateOnBlur,u=void 0===o||o,l=e.validateOnMount,c=void 0!==l&&l,d=e.isInitialValid,h=e.enableReinitialize,v=void 0!==h&&h,E=e.onSubmit,T=f(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),k=p({validateOnChange:a,validateOnBlur:u,validateOnMount:c,onSubmit:E},T),O=r.useRef(k.initialValues),R=r.useRef(k.initialErrors||I),C=r.useRef(k.initialTouched||P),_=r.useRef(k.initialStatus),x=r.useRef(!1),U=r.useRef({});r.useEffect(function(){},[]),r.useEffect(function(){return x.current=!0,function(){x.current=!1}},[]);var M=r.useReducer(A,{values:k.initialValues,errors:k.initialErrors||I,touched:k.initialTouched||P,status:k.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),L=M[0],N=M[1],B=r.useCallback(function(e,r){return new Promise(function(t,n){var i=k.validate(e,r);null==i?t(I):g(i)?i.then(function(e){t(e||I)},function(e){n(e)}):t(i)})},[k.validate]),q=r.useCallback(function(e,r){var t=k.validationSchema,n=m(t)?t(r):t,i=r&&n.validateAt?n.validateAt(r,e):D(e,n);return new Promise(function(e,r){i.then(function(){e(I)},function(t){"ValidationError"===t.name?e(V(t)):r(t)})})},[k.validationSchema]),W=r.useCallback(function(e,r){return new Promise(function(t){return t(U.current[e].validate(r))})},[]),G=r.useCallback(function(e){var r=Object.keys(U.current).filter(function(e){return m(U.current[e].validate)}),t=r.length>0?r.map(function(r){return W(r,b(e,r))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(t).then(function(e){return e.reduce(function(e,t,n){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===t?e:(t&&(e=F(e,r[n],t)),e)},{})})},[W]),H=r.useCallback(function(e){return Promise.all([G(e),k.validationSchema?q(e):{},k.validate?B(e):{}]).then(function(e){return n.all([e[0],e[1],e[2]],{arrayMerge:w})})},[k.validate,k.validationSchema,G,B,q]),K=j(function(e){return void 0===e&&(e=L.values),s.unstable_runWithPriority(s.LowPriority,function(){return H(e).then(function(e){return x.current&&N({type:"SET_ERRORS",payload:e}),e}).catch(function(e){})})}),Y=j(function(e){return void 0===e&&(e=L.values),N({type:"SET_ISVALIDATING",payload:!0}),H(e).then(function(e){return x.current&&(N({type:"SET_ISVALIDATING",payload:!1}),t(L.errors,e)||N({type:"SET_ERRORS",payload:e})),e})});r.useEffect(function(){c&&!0===x.current&&K(k.initialValues)},[k.initialValues,c,K]);var z=r.useCallback(function(e){var r=e&&e.values?e.values:O.current,t=e&&e.errors?e.errors:R.current?R.current:k.initialErrors||{},n=e&&e.touched?e.touched:C.current?C.current:k.initialTouched||{},i=e&&e.status?e.status:_.current?_.current:k.initialStatus;O.current=r,R.current=t,C.current=n,_.current=i,N({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:t,touched:n,status:i,values:r,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[k.initialErrors,k.initialStatus,k.initialTouched]);r.useEffect(function(){v&&!0===x.current&&!t(O.current,k.initialValues)&&(O.current=k.initialValues,z())},[v,k.initialValues,z]),r.useEffect(function(){v&&!0===x.current&&!t(R.current,k.initialErrors)&&(R.current=k.initialErrors||I,N({type:"SET_ERRORS",payload:k.initialErrors||I}))},[v,k.initialErrors]),r.useEffect(function(){v&&!0===x.current&&!t(C.current,k.initialTouched)&&(C.current=k.initialTouched||P,N({type:"SET_TOUCHED",payload:k.initialTouched||P}))},[v,k.initialTouched]),r.useEffect(function(){v&&!0===x.current&&!t(_.current,k.initialStatus)&&(_.current=k.initialStatus,N({type:"SET_STATUS",payload:k.initialStatus}))},[v,k.initialStatus,k.initialTouched]);var J=j(function(e){if(m(U.current[e].validate)){var r=b(L.values,e),t=U.current[e].validate(r);return g(t)?(N({type:"SET_ISVALIDATING",payload:!0}),t.then(function(e){return e}).then(function(r){N({type:"SET_FIELD_ERROR",payload:{field:e,value:r}}),N({type:"SET_ISVALIDATING",payload:!1})})):(N({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),Promise.resolve(t))}return Promise.resolve()}),Q=r.useCallback(function(e,r){U.current[e]={validate:r.validate}},[]),X=r.useCallback(function(e){delete U.current[e]},[]),Z=j(function(e,r){return N({type:"SET_TOUCHED",payload:e}),(void 0===r?u:r)?K(L.values):Promise.resolve()}),$=r.useCallback(function(e){N({type:"SET_ERRORS",payload:e})},[]),ee=j(function(e,r){return N({type:"SET_VALUES",payload:e}),(void 0===r?a:r)?K(e):Promise.resolve()}),re=r.useCallback(function(e,r){N({type:"SET_FIELD_ERROR",payload:{field:e,value:r}})},[]),te=j(function(e,r,t){return N({type:"SET_FIELD_VALUE",payload:{field:e,value:r}}),(void 0===t?a:t)?K(F(L.values,e,r)):Promise.resolve()}),ne=r.useCallback(function(e,r){var t,n=r,i=e;if(!S(e)){e.persist&&e.persist();var a=e.target?e.target:e.currentTarget,o=a.type,u=a.value,s=a.checked,l=a.options,c=a.multiple;n=r||a.name||a.id,i=/number|range/.test(o)?(t=parseFloat(u),isNaN(t)?"":t):/checkbox/.test(o)?function(e,r,t){if("true"==t||"false"==t)return!!r;if(r&&t)return Array.isArray(e)?e.concat(t):[t];if(!Array.isArray(e))return!e;var n=e.indexOf(t);return n<0?e:e.slice(0,n).concat(e.slice(n+1))}(b(L.values,n),s,u):c?function(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}(l):u}n&&te(n,i)},[te,L.values]),ie=r.useCallback(function(e){if(S(e))return function(r){return ne(r,e)};ne(e)},[ne]),ae=j(function(e,r,t){return void 0===r&&(r=!0),N({type:"SET_FIELD_TOUCHED",payload:{field:e,value:r}}),(void 0===t?u:t)?K(L.values):Promise.resolve()}),oe=r.useCallback(function(e,r){e.persist&&e.persist();var t=e.target;ae(r||t.name||t.id,!0)},[ae]),ue=r.useCallback(function(e){if(S(e))return function(r){return oe(r,e)};oe(e)},[oe]),se=r.useCallback(function(e){m(e)?N({type:"SET_FORMIK_STATE",payload:e}):N({type:"SET_FORMIK_STATE",payload:function(){return e}})},[]),le=r.useCallback(function(e){N({type:"SET_STATUS",payload:e})},[]),ce=r.useCallback(function(e){N({type:"SET_ISSUBMITTING",payload:e})},[]),pe={resetForm:z,validateForm:Y,validateField:J,setErrors:$,setFieldError:re,setFieldTouched:ae,setFieldValue:te,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,setFormikState:se},de=j(function(){return E(L.values,pe)}),fe=j(function(){return N({type:"SUBMIT_ATTEMPT"}),Y().then(function(e){var r=e instanceof Error;if(!r&&0===Object.keys(e).length){var t;try{if(void 0===(t=de()))return}catch(e){throw e}return Promise.resolve(t).then(function(){x.current&&N({type:"SUBMIT_SUCCESS"})}).catch(function(e){if(x.current)throw N({type:"SUBMIT_FAILURE"}),e})}if(x.current&&(N({type:"SUBMIT_FAILURE"}),r))throw e})}),he=j(function(e){e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),fe().catch(function(e){console.warn("Warning: An unhandled error was caught from submitForm()",e)})}),ve=j(function(e){if(e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),k.onReset){var r=k.onReset(L.values,pe);g(r)?r.then(z):z()}else z()}),me=r.useCallback(function(e){return{value:b(L.values,e),error:b(L.errors,e),touched:!!b(L.touched,e),initialValue:b(O.current,e),initialTouched:!!b(C.current,e),initialError:b(R.current,e)}},[L.errors,L.touched,L.values]),ye=r.useCallback(function(e){var r=y(e),t=r?e.name:e,n=b(L.values,t),i={name:t,value:n,onChange:ie,onBlur:ue};if(r){var a=e.type,o=e.value,u=e.as,s=e.multiple;"checkbox"===a?void 0===o?i.checked=!!n:(i.checked=!(!Array.isArray(n)||!~n.indexOf(o)),i.value=o):"radio"===a?(i.checked=n===o,i.value=o):"select"===u&&s&&(i.value=i.value||[],i.multiple=!0)}return i},[ue,ie,L.values]),Ee=r.useMemo(function(){return!t(O.current,L.values)},[O.current,L.values]),Se=r.useMemo(function(){return void 0!==d?Ee?L.errors&&0===Object.keys(L.errors).length:!1!==d&&m(d)?d(k):d:L.errors&&0===Object.keys(L.errors).length},[d,Ee,L.errors,k]);return p({},L,{initialValues:O.current,initialErrors:R.current,initialTouched:C.current,initialStatus:_.current,handleBlur:ue,handleChange:ie,handleReset:ve,handleSubmit:he,resetForm:z,setErrors:$,setFormikState:se,setFieldTouched:ae,setFieldValue:te,setFieldError:re,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,submitForm:fe,validateForm:Y,validateField:J,isValid:Se,dirty:Ee,unregisterField:X,registerField:Q,getFieldProps:ye,getFieldMeta:me,validateOnBlur:u,validateOnChange:a,validateOnMount:c})}function U(e){var t=x(e),n=e.component,i=e.children,a=e.render;return r.useEffect(function(){},[]),r.createElement(R,{value:t},n?r.createElement(n,t):a?a(t):i?m(i)?i(t):T(i)?null:r.Children.only(i):null)}function V(e){var r={};if(e.inner){if(0===e.inner.length)return F(r,e.path,e.message);var t=e.inner,n=Array.isArray(t),i=0;for(t=n?t:t[Symbol.iterator]();;){var a;if(n){if(i>=t.length)break;a=t[i++]}else{if((i=t.next()).done)break;a=i.value}var o=a;b(r,o.path)||(r=F(r,o.path,o.message))}}return r}function D(e,r,t,n){void 0===t&&(t=!1),void 0===n&&(n={});var i=M(e);return r[t?"validateSync":"validate"](i,{abortEarly:!1,context:n})}function M(e){var r={};for(var t in e)if(e.hasOwnProperty(t)){var n=String(t);r[n]=!0===Array.isArray(e[n])?e[n].map(function(e){return!0===Array.isArray(e)||i(e)?M(e):""!==e?e:void 0}):i(e[n])?M(e[n]):""!==e[n]?e[n]:void 0}return r}function w(e,r,t){var i=e.slice();return r.forEach(function(r,a){if(void 0===i[a]){var o=!1!==t.clone&&t.isMergeableObject(r);i[a]=o?n(Array.isArray(r)?[]:{},r,t):r}else t.isMergeableObject(r)?i[a]=n(e[a],r,t):-1===e.indexOf(r)&&i.push(r)}),i}var L="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?r.useLayoutEffect:r.useEffect;function j(e){var t=r.useRef(e);return L(function(){t.current=e}),r.useCallback(function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.current.apply(void 0,r)},[])}var N=r.forwardRef(function(e,t){var n=e.action,i=f(e,["action"]),a=n||"#",o=_();return r.createElement("form",Object.assign({onSubmit:o.handleSubmit,ref:t,onReset:o.handleReset,action:a},i))});function B(e){var t=function(t){return r.createElement(C,null,function(n){return n||u(!1),r.createElement(e,Object.assign({},t,{formik:n}))})},n=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return t.WrappedComponent=e,t.displayName="FormikConnect("+n+")",l(t,e)}N.displayName="Form";var q=function(e,r,t){var n=K(e),i=n[r];return n.splice(r,1),n.splice(t,0,i),n},W=function(e,r,t){var n=K(e),i=n[r];return n[r]=n[t],n[t]=i,n},G=function(e,r,t){var n=K(e);return n.splice(r,0,t),n},H=function(e,r,t){var n=K(e);return n[r]=t,n},K=function(e){if(e){if(Array.isArray(e))return[].concat(e);var r=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,r){return r>e?r:e},0);return Array.from(p({},e,{length:r+1}))}return[]},Y=function(e){function n(r){var t;return(t=e.call(this,r)||this).updateArrayField=function(e,r,n){var i=t.props,a=i.name;(0,i.formik.setFormikState)(function(t){var i="function"==typeof n?n:e,o="function"==typeof r?r:e;return p({},t,{values:F(t.values,a,e(b(t.values,a))),errors:n?F(t.errors,a,i(b(t.errors,a))):t.errors,touched:r?F(t.touched,a,o(b(t.touched,a))):t.touched})})},t.push=function(e){return t.updateArrayField(function(r){return[].concat(K(r),[c(e)])},!1,!1)},t.handlePush=function(e){return function(){return t.push(e)}},t.swap=function(e,r){return t.updateArrayField(function(t){return W(t,e,r)},!0,!0)},t.handleSwap=function(e,r){return function(){return t.swap(e,r)}},t.move=function(e,r){return t.updateArrayField(function(t){return q(t,e,r)},!0,!0)},t.handleMove=function(e,r){return function(){return t.move(e,r)}},t.insert=function(e,r){return t.updateArrayField(function(t){return G(t,e,r)},function(r){return G(r,e,null)},function(r){return G(r,e,null)})},t.handleInsert=function(e,r){return function(){return t.insert(e,r)}},t.replace=function(e,r){return t.updateArrayField(function(t){return H(t,e,r)},!1,!1)},t.handleReplace=function(e,r){return function(){return t.replace(e,r)}},t.unshift=function(e){var r=-1;return t.updateArrayField(function(t){var n=t?[e].concat(t):[e];return r<0&&(r=n.length),n},function(e){var t=e?[null].concat(e):[null];return r<0&&(r=t.length),t},function(e){var t=e?[null].concat(e):[null];return r<0&&(r=t.length),t}),r},t.handleUnshift=function(e){return function(){return t.unshift(e)}},t.handleRemove=function(e){return function(){return t.remove(e)}},t.handlePop=function(){return function(){return t.pop()}},t.remove=t.remove.bind(h(t)),t.pop=t.pop.bind(h(t)),t}d(n,e);var i=n.prototype;return i.componentDidUpdate=function(e){!t(b(e.formik.values,e.name),b(this.props.formik.values,this.props.name))&&this.props.formik.validateOnChange&&this.props.formik.validateForm()},i.remove=function(e){var r;return this.updateArrayField(function(t){var n=t?K(t):[];return r||(r=n[e]),m(n.splice)&&n.splice(e,1),n},!0,!0),r},i.pop=function(){var e;return this.updateArrayField(function(r){var t=r;return e||(e=t&&t.pop&&t.pop()),t},!0,!0),e},i.render=function(){var e=this.props,t=e.component,n=e.render,i=e.children,a=e.name,o=p({},{push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},{form:f(e.formik,["validate","validationSchema"]),name:a});return t?r.createElement(t,o):n?n(o):i?"function"==typeof i?i(o):T(i)?null:r.Children.only(i):null},n}(r.Component);Y.defaultProps={validateOnChange:!0};var z=B(Y),J=B(function(e){function t(){return e.apply(this,arguments)||this}d(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return b(this.props.formik.errors,this.props.name)!==b(e.formik.errors,this.props.name)||b(this.props.formik.touched,this.props.name)!==b(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},n.render=function(){var e=this.props,t=e.component,n=e.formik,i=e.render,a=e.children,o=e.name,u=f(e,["component","formik","render","children","name"]),s=b(n.touched,o),l=b(n.errors,o);return s&&l?i?m(i)?i(l):null:a?m(a)?a(l):null:t?r.createElement(t,u,l):l:null},t}(r.Component)),Q=B(function(e){function t(r){var t;t=e.call(this,r)||this;var n=r.render,i=r.children,a=r.component,o=r.as;return n&&u(!1),a&&n&&u(!1),o&&i&&m(i)&&u(!1),a&&i&&m(i)&&u(!1),n&&i&&!T(i)&&u(!1),t}d(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return this.props.shouldUpdate?this.props.shouldUpdate(e,this.props):e.name!==this.props.name||b(e.formik.values,this.props.name)!==b(this.props.formik.values,this.props.name)||b(e.formik.errors,this.props.name)!==b(this.props.formik.errors,this.props.name)||b(e.formik.touched,this.props.name)!==b(this.props.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length||e.formik.isSubmitting!==this.props.formik.isSubmitting},n.componentDidMount=function(){this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentDidUpdate=function(e){this.props.name!==e.name&&(this.props.formik.unregisterField(e.name),this.props.formik.registerField(this.props.name,{validate:this.props.validate})),this.props.validate!==e.validate&&this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentWillUnmount=function(){this.props.formik.unregisterField(this.props.name)},n.render=function(){var e=this.props,t=e.name,n=e.render,i=e.as,a=e.children,o=e.component,u=e.formik,s=f(e,["validate","name","render","as","children","component","shouldUpdate","formik"]),l=f(u,["validate","validationSchema"]),c={value:"radio"===s.type||"checkbox"===s.type?s.value:b(u.values,t),name:t,onChange:u.handleChange,onBlur:u.handleBlur},d={field:c,meta:{value:b(u.values,t),error:b(u.errors,t),touched:!!b(u.touched,t),initialValue:b(u.initialValues,t),initialTouched:!!b(u.initialTouched,t),initialError:b(u.initialErrors,t)},form:l};if(n)return n(d);if(m(a))return a(d);if(o){if("string"==typeof o){var h=s.innerRef,v=f(s,["innerRef"]);return r.createElement(o,p({ref:h},c,{},v),a)}return r.createElement(o,p({field:c,form:u},s),a)}var y=i||"input";if("string"==typeof y){var E=s.innerRef,S=f(s,["innerRef"]);return r.createElement(y,p({ref:E},c,{},S),a)}return r.createElement(y,p({},c,{},s),a)},t}(r.Component));exports.ErrorMessage=J,exports.FastField=Q,exports.Field=function(e){var t=e.validate,n=e.name,i=e.render,a=e.children,o=e.as,u=e.component,s=f(e,["validate","name","render","children","as","component"]),l=f(_(),["validate","validationSchema"]);r.useEffect(function(){},[]);var c=l.registerField,d=l.unregisterField;r.useEffect(function(){return c(n,{validate:t}),function(){d(n)}},[c,d,n,t]);var h=l.getFieldProps(p({name:n},s)),v=l.getFieldMeta(n),y={field:h,form:l};if(i)return i(p({},y,{meta:v}));if(m(a))return a(p({},y,{meta:v}));if(u){if("string"==typeof u){var E=s.innerRef,S=f(s,["innerRef"]);return r.createElement(u,p({ref:E},h,{},S),a)}return r.createElement(u,p({field:h,form:l},s),a)}var T=o||"input";if("string"==typeof T){var g=s.innerRef,b=f(s,["innerRef"]);return r.createElement(T,p({ref:g},h,{},b),a)}return r.createElement(T,p({},h,{},s),a)},exports.FieldArray=z,exports.Form=N,exports.Formik=U,exports.FormikConsumer=C,exports.FormikContext=O,exports.FormikProvider=R,exports.connect=B,exports.getActiveElement=function(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(r){return e.body}},exports.getIn=b,exports.insert=G,exports.isEmptyArray=v,exports.isEmptyChildren=T,exports.isFunction=m,exports.isInputEvent=function(e){return e&&y(e)&&y(e.target)},exports.isInteger=E,exports.isNaN=function(e){return e!=e},exports.isObject=y,exports.isPromise=g,exports.isString=S,exports.move=q,exports.prepareDataForValidation=M,exports.replace=H,exports.setIn=F,exports.setNestedObjectValues=k,exports.swap=W,exports.useField=function(e){var t=_(),n=t.getFieldProps,i=t.getFieldMeta,a=t.registerField,o=t.unregisterField,s=y(e)?e:{name:e},l=s.name,c=s.validate;return r.useEffect(function(){return l&&a(l,{validate:c}),function(){l&&o(l)}},[a,o,l,c]),l||u(!1),[n(s),i(l)]},exports.useFormik=x,exports.useFormikContext=_,exports.validateYupSchema=D,exports.withFormik=function(e){var t=e.mapPropsToValues,n=void 0===t?function(e){var r={};for(var t in e)e.hasOwnProperty(t)&&"function"!=typeof e[t]&&(r[t]=e[t]);return r}:t,i=f(e,["mapPropsToValues"]);return function(e){var t=e.displayName||e.name||e.constructor&&e.constructor.name||"Component",a=function(t){function a(){var n;return(n=t.apply(this,arguments)||this).validate=function(e){return i.validate(e,n.props)},n.validationSchema=function(){return m(i.validationSchema)?i.validationSchema(n.props):i.validationSchema},n.handleSubmit=function(e,r){return i.handleSubmit(e,p({},r,{props:n.props}))},n.renderFormComponent=function(t){return r.createElement(e,Object.assign({},n.props,t))},n}return d(a,t),a.prototype.render=function(){var e=f(this.props,["children"]);return r.createElement(U,Object.assign({},e,i,{validate:i.validate&&this.validate,validationSchema:i.validationSchema&&this.validationSchema,initialValues:n(this.props),initialStatus:i.mapPropsToStatus&&i.mapPropsToStatus(this.props),initialErrors:i.mapPropsToErrors&&i.mapPropsToErrors(this.props),initialTouched:i.mapPropsToTouched&&i.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,children:this.renderFormComponent}))},a}(r.Component);return a.displayName="WithFormik("+t+")",l(a,e)}},exports.yupToFormErrors=V;
//# sourceMappingURL=formik.cjs.production.min.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-fast-compare"),require("deepmerge"),require("lodash-es/isPlainObject"),require("lodash-es/clone"),require("lodash-es/toPath"),require("tiny-warning"),require("scheduler"),require("hoist-non-react-statics"),require("lodash-es/cloneDeep")):"function"==typeof define&&define.amd?define(["exports","react","react-fast-compare","deepmerge","lodash-es/isPlainObject","lodash-es/clone","lodash-es/toPath","tiny-warning","scheduler","hoist-non-react-statics","lodash-es/cloneDeep"],t):t((e=e||self).formik={},e.React,e.isEqual,e.deepmerge,e.isPlainObject,e.clone,e.toPath,e.invariant,e.scheduler,e.hoistNonReactStatics,e.cloneDeep)}(this,function(e,t,r,n,i,a,o,u,s,l,c){"use strict";function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function p(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(i[r]=e[r]);return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}r=r&&r.hasOwnProperty("default")?r.default:r,n=n&&n.hasOwnProperty("default")?n.default:n,i=i&&i.hasOwnProperty("default")?i.default:i,a=a&&a.hasOwnProperty("default")?a.default:a,o=o&&o.hasOwnProperty("default")?o.default:o,u=u&&u.hasOwnProperty("default")?u.default:u,l=l&&l.hasOwnProperty("default")?l.default:l,c=c&&c.hasOwnProperty("default")?c.default:c;var v=function(e){return Array.isArray(e)&&0===e.length},m=function(e){return"function"==typeof e},y=function(e){return null!==e&&"object"==typeof e},E=function(e){return String(Math.floor(Number(e)))===e},S=function(e){return"[object String]"===Object.prototype.toString.call(e)},T=function(e){return 0===t.Children.count(e)},g=function(e){return y(e)&&m(e.then)};function b(e,t,r,n){void 0===n&&(n=0);for(var i=o(t);e&&n<i.length;)e=e[i[n++]];return void 0===e?r:e}function F(e,t,r){for(var n=a(e),i=n,u=0,s=o(t);u<s.length-1;u++){var l=s[u],c=b(e,s.slice(0,u+1));if(c&&(y(c)||Array.isArray(c)))i=i[l]=a(c);else{var d=s[u+1];i=i[l]=E(d)&&Number(d)>=0?[]:{}}}return(0===u?e:i)[s[u]]===r?e:(void 0===r||v(r)?delete i[s[u]]:i[s[u]]=r,(0===u&&void 0===r||v(r))&&delete n[s[u]],n)}function k(e,t,r,n){void 0===r&&(r=new WeakMap),void 0===n&&(n={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],u=e[o];y(u)?r.get(u)||(r.set(u,!0),n[o]=Array.isArray(u)?[]:{},k(u,t,r,n[o])):n[o]=t}return n}var O=t.createContext(void 0),R=O.Provider,C=O.Consumer;function _(){var e=t.useContext(O);return e||u(!1),e}function A(e,t){switch(t.type){case"SET_VALUES":return d({},e,{values:t.payload});case"SET_TOUCHED":return d({},e,{touched:t.payload});case"SET_ERRORS":return r(e.errors,t.payload)?e:d({},e,{errors:t.payload});case"SET_STATUS":return d({},e,{status:t.payload});case"SET_ISSUBMITTING":return d({},e,{isSubmitting:t.payload});case"SET_ISVALIDATING":return d({},e,{isValidating:t.payload});case"SET_FIELD_VALUE":return d({},e,{values:F(e.values,t.payload.field,t.payload.value)});case"SET_FIELD_TOUCHED":return d({},e,{touched:F(e.touched,t.payload.field,t.payload.value)});case"SET_FIELD_ERROR":return d({},e,{errors:F(e.errors,t.payload.field,t.payload.value)});case"RESET_FORM":return d({},e,{},t.payload);case"SET_FORMIK_STATE":return t.payload(e);case"SUBMIT_ATTEMPT":return d({},e,{touched:k(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return d({},e,{isSubmitting:!1});default:return e}}var P={},I={};function w(e){var i=e.validateOnChange,a=void 0===i||i,o=e.validateOnBlur,u=void 0===o||o,l=e.validateOnMount,c=void 0!==l&&l,f=e.isInitialValid,h=e.enableReinitialize,v=void 0!==h&&h,E=e.onSubmit,T=p(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),k=d({validateOnChange:a,validateOnBlur:u,validateOnMount:c,onSubmit:E},T),O=t.useRef(k.initialValues),R=t.useRef(k.initialErrors||P),C=t.useRef(k.initialTouched||I),_=t.useRef(k.initialStatus),w=t.useRef(!1),U=t.useRef({});t.useEffect(function(){},[]),t.useEffect(function(){return w.current=!0,function(){w.current=!1}},[]);var M=t.useReducer(A,{values:k.initialValues,errors:k.initialErrors||P,touched:k.initialTouched||I,status:k.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),L=M[0],B=M[1],x=t.useCallback(function(e,t){return new Promise(function(r,n){var i=k.validate(e,t);null==i?r(P):g(i)?i.then(function(e){r(e||P)},function(e){n(e)}):r(i)})},[k.validate]),q=t.useCallback(function(e,t){var r=k.validationSchema,n=m(r)?r(t):r,i=t&&n.validateAt?n.validateAt(t,e):V(e,n);return new Promise(function(e,t){i.then(function(){e(P)},function(r){"ValidationError"===r.name?e(D(r)):t(r)})})},[k.validationSchema]),W=t.useCallback(function(e,t){return new Promise(function(r){return r(U.current[e].validate(t))})},[]),G=t.useCallback(function(e){var t=Object.keys(U.current).filter(function(e){return m(U.current[e].validate)}),r=t.length>0?t.map(function(t){return W(t,b(e,t))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(r).then(function(e){return e.reduce(function(e,r,n){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===r?e:(r&&(e=F(e,t[n],r)),e)},{})})},[W]),H=t.useCallback(function(e){return Promise.all([G(e),k.validationSchema?q(e):{},k.validate?x(e):{}]).then(function(e){return n.all([e[0],e[1],e[2]],{arrayMerge:j})})},[k.validate,k.validationSchema,G,x,q]),K=N(function(e){return void 0===e&&(e=L.values),s.unstable_runWithPriority(s.LowPriority,function(){return H(e).then(function(e){return w.current&&B({type:"SET_ERRORS",payload:e}),e}).catch(function(e){})})}),Y=N(function(e){return void 0===e&&(e=L.values),B({type:"SET_ISVALIDATING",payload:!0}),H(e).then(function(e){return w.current&&(B({type:"SET_ISVALIDATING",payload:!1}),r(L.errors,e)||B({type:"SET_ERRORS",payload:e})),e})});t.useEffect(function(){c&&!0===w.current&&K(k.initialValues)},[k.initialValues,c,K]);var z=t.useCallback(function(e){var t=e&&e.values?e.values:O.current,r=e&&e.errors?e.errors:R.current?R.current:k.initialErrors||{},n=e&&e.touched?e.touched:C.current?C.current:k.initialTouched||{},i=e&&e.status?e.status:_.current?_.current:k.initialStatus;O.current=t,R.current=r,C.current=n,_.current=i,B({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:r,touched:n,status:i,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[k.initialErrors,k.initialStatus,k.initialTouched]);t.useEffect(function(){v&&!0===w.current&&!r(O.current,k.initialValues)&&(O.current=k.initialValues,z())},[v,k.initialValues,z]),t.useEffect(function(){v&&!0===w.current&&!r(R.current,k.initialErrors)&&(R.current=k.initialErrors||P,B({type:"SET_ERRORS",payload:k.initialErrors||P}))},[v,k.initialErrors]),t.useEffect(function(){v&&!0===w.current&&!r(C.current,k.initialTouched)&&(C.current=k.initialTouched||I,B({type:"SET_TOUCHED",payload:k.initialTouched||I}))},[v,k.initialTouched]),t.useEffect(function(){v&&!0===w.current&&!r(_.current,k.initialStatus)&&(_.current=k.initialStatus,B({type:"SET_STATUS",payload:k.initialStatus}))},[v,k.initialStatus,k.initialTouched]);var J=N(function(e){if(m(U.current[e].validate)){var t=b(L.values,e),r=U.current[e].validate(t);return g(r)?(B({type:"SET_ISVALIDATING",payload:!0}),r.then(function(e){return e}).then(function(t){B({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),B({type:"SET_ISVALIDATING",payload:!1})})):(B({type:"SET_FIELD_ERROR",payload:{field:e,value:r}}),Promise.resolve(r))}return Promise.resolve()}),Q=t.useCallback(function(e,t){U.current[e]={validate:t.validate}},[]),X=t.useCallback(function(e){delete U.current[e]},[]),Z=N(function(e,t){return B({type:"SET_TOUCHED",payload:e}),(void 0===t?u:t)?K(L.values):Promise.resolve()}),$=t.useCallback(function(e){B({type:"SET_ERRORS",payload:e})},[]),ee=N(function(e,t){return B({type:"SET_VALUES",payload:e}),(void 0===t?a:t)?K(e):Promise.resolve()}),te=t.useCallback(function(e,t){B({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})},[]),re=N(function(e,t,r){return B({type:"SET_FIELD_VALUE",payload:{field:e,value:t}}),(void 0===r?a:r)?K(F(L.values,e,t)):Promise.resolve()}),ne=t.useCallback(function(e,t){var r,n=t,i=e;if(!S(e)){e.persist&&e.persist();var a=e.target?e.target:e.currentTarget,o=a.type,u=a.value,s=a.checked,l=a.options,c=a.multiple;n=t||a.name||a.id,i=/number|range/.test(o)?(r=parseFloat(u),isNaN(r)?"":r):/checkbox/.test(o)?function(e,t,r){if("true"==r||"false"==r)return!!t;if(t&&r)return Array.isArray(e)?e.concat(r):[r];if(!Array.isArray(e))return!e;var n=e.indexOf(r);return n<0?e:e.slice(0,n).concat(e.slice(n+1))}(b(L.values,n),s,u):c?function(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}(l):u}n&&re(n,i)},[re,L.values]),ie=t.useCallback(function(e){if(S(e))return function(t){return ne(t,e)};ne(e)},[ne]),ae=N(function(e,t,r){return void 0===t&&(t=!0),B({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}}),(void 0===r?u:r)?K(L.values):Promise.resolve()}),oe=t.useCallback(function(e,t){e.persist&&e.persist();var r=e.target;ae(t||r.name||r.id,!0)},[ae]),ue=t.useCallback(function(e){if(S(e))return function(t){return oe(t,e)};oe(e)},[oe]),se=t.useCallback(function(e){m(e)?B({type:"SET_FORMIK_STATE",payload:e}):B({type:"SET_FORMIK_STATE",payload:function(){return e}})},[]),le=t.useCallback(function(e){B({type:"SET_STATUS",payload:e})},[]),ce=t.useCallback(function(e){B({type:"SET_ISSUBMITTING",payload:e})},[]),de={resetForm:z,validateForm:Y,validateField:J,setErrors:$,setFieldError:te,setFieldTouched:ae,setFieldValue:re,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,setFormikState:se},fe=N(function(){return E(L.values,de)}),pe=N(function(){return B({type:"SUBMIT_ATTEMPT"}),Y().then(function(e){var t=e instanceof Error;if(!t&&0===Object.keys(e).length){var r;try{if(void 0===(r=fe()))return}catch(e){throw e}return Promise.resolve(r).then(function(){w.current&&B({type:"SUBMIT_SUCCESS"})}).catch(function(e){if(w.current)throw B({type:"SUBMIT_FAILURE"}),e})}if(w.current&&(B({type:"SUBMIT_FAILURE"}),t))throw e})}),he=N(function(e){e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),pe().catch(function(e){console.warn("Warning: An unhandled error was caught from submitForm()",e)})}),ve=N(function(e){if(e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),k.onReset){var t=k.onReset(L.values,de);g(t)?t.then(z):z()}else z()}),me=t.useCallback(function(e){return{value:b(L.values,e),error:b(L.errors,e),touched:!!b(L.touched,e),initialValue:b(O.current,e),initialTouched:!!b(C.current,e),initialError:b(R.current,e)}},[L.errors,L.touched,L.values]),ye=t.useCallback(function(e){var t=y(e),r=t?e.name:e,n=b(L.values,r),i={name:r,value:n,onChange:ie,onBlur:ue};if(t){var a=e.type,o=e.value,u=e.as,s=e.multiple;"checkbox"===a?void 0===o?i.checked=!!n:(i.checked=!(!Array.isArray(n)||!~n.indexOf(o)),i.value=o):"radio"===a?(i.checked=n===o,i.value=o):"select"===u&&s&&(i.value=i.value||[],i.multiple=!0)}return i},[ue,ie,L.values]),Ee=t.useMemo(function(){return!r(O.current,L.values)},[O.current,L.values]),Se=t.useMemo(function(){return void 0!==f?Ee?L.errors&&0===Object.keys(L.errors).length:!1!==f&&m(f)?f(k):f:L.errors&&0===Object.keys(L.errors).length},[f,Ee,L.errors,k]);return d({},L,{initialValues:O.current,initialErrors:R.current,initialTouched:C.current,initialStatus:_.current,handleBlur:ue,handleChange:ie,handleReset:ve,handleSubmit:he,resetForm:z,setErrors:$,setFormikState:se,setFieldTouched:ae,setFieldValue:re,setFieldError:te,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,submitForm:pe,validateForm:Y,validateField:J,isValid:Se,dirty:Ee,unregisterField:X,registerField:Q,getFieldProps:ye,getFieldMeta:me,validateOnBlur:u,validateOnChange:a,validateOnMount:c})}function U(e){var r=w(e),n=e.component,i=e.children,a=e.render;return t.useEffect(function(){},[]),t.createElement(R,{value:r},n?t.createElement(n,r):a?a(r):i?m(i)?i(r):T(i)?null:t.Children.only(i):null)}function D(e){var t={};if(e.inner){if(0===e.inner.length)return F(t,e.path,e.message);var r=e.inner,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var a;if(n){if(i>=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}var o=a;b(t,o.path)||(t=F(t,o.path,o.message))}}return t}function V(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n={});var i=M(e);return t[r?"validateSync":"validate"](i,{abortEarly:!1,context:n})}function M(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=String(r);t[n]=!0===Array.isArray(e[n])?e[n].map(function(e){return!0===Array.isArray(e)||i(e)?M(e):""!==e?e:void 0}):i(e[n])?M(e[n]):""!==e[n]?e[n]:void 0}return t}function j(e,t,r){var i=e.slice();return t.forEach(function(t,a){if(void 0===i[a]){var o=!1!==r.clone&&r.isMergeableObject(t);i[a]=o?n(Array.isArray(t)?[]:{},t,r):t}else r.isMergeableObject(t)?i[a]=n(e[a],t,r):-1===e.indexOf(t)&&i.push(t)}),i}var L="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function N(e){var r=t.useRef(e);return L(function(){r.current=e}),t.useCallback(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.current.apply(void 0,t)},[])}var B=t.forwardRef(function(e,r){var n=e.action,i=p(e,["action"]),a=n||"#",o=_();return t.createElement("form",Object.assign({onSubmit:o.handleSubmit,ref:r,onReset:o.handleReset,action:a},i))});function x(e){var r=function(r){return t.createElement(C,null,function(n){return n||u(!1),t.createElement(e,Object.assign({},r,{formik:n}))})},n=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return r.WrappedComponent=e,r.displayName="FormikConnect("+n+")",l(r,e)}B.displayName="Form";var q=function(e,t,r){var n=K(e),i=n[t];return n.splice(t,1),n.splice(r,0,i),n},W=function(e,t,r){var n=K(e),i=n[t];return n[t]=n[r],n[r]=i,n},G=function(e,t,r){var n=K(e);return n.splice(t,0,r),n},H=function(e,t,r){var n=K(e);return n[t]=r,n},K=function(e){if(e){if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,t){return t>e?t:e},0);return Array.from(d({},e,{length:t+1}))}return[]},Y=function(e){function n(t){var r;return(r=e.call(this,t)||this).updateArrayField=function(e,t,n){var i=r.props,a=i.name;(0,i.formik.setFormikState)(function(r){var i="function"==typeof n?n:e,o="function"==typeof t?t:e;return d({},r,{values:F(r.values,a,e(b(r.values,a))),errors:n?F(r.errors,a,i(b(r.errors,a))):r.errors,touched:t?F(r.touched,a,o(b(r.touched,a))):r.touched})})},r.push=function(e){return r.updateArrayField(function(t){return[].concat(K(t),[c(e)])},!1,!1)},r.handlePush=function(e){return function(){return r.push(e)}},r.swap=function(e,t){return r.updateArrayField(function(r){return W(r,e,t)},!0,!0)},r.handleSwap=function(e,t){return function(){return r.swap(e,t)}},r.move=function(e,t){return r.updateArrayField(function(r){return q(r,e,t)},!0,!0)},r.handleMove=function(e,t){return function(){return r.move(e,t)}},r.insert=function(e,t){return r.updateArrayField(function(r){return G(r,e,t)},function(t){return G(t,e,null)},function(t){return G(t,e,null)})},r.handleInsert=function(e,t){return function(){return r.insert(e,t)}},r.replace=function(e,t){return r.updateArrayField(function(r){return H(r,e,t)},!1,!1)},r.handleReplace=function(e,t){return function(){return r.replace(e,t)}},r.unshift=function(e){var t=-1;return r.updateArrayField(function(r){var n=r?[e].concat(r):[e];return t<0&&(t=n.length),n},function(e){var r=e?[null].concat(e):[null];return t<0&&(t=r.length),r},function(e){var r=e?[null].concat(e):[null];return t<0&&(t=r.length),r}),t},r.handleUnshift=function(e){return function(){return r.unshift(e)}},r.handleRemove=function(e){return function(){return r.remove(e)}},r.handlePop=function(){return function(){return r.pop()}},r.remove=r.remove.bind(h(r)),r.pop=r.pop.bind(h(r)),r}f(n,e);var i=n.prototype;return i.componentDidUpdate=function(e){!r(b(e.formik.values,e.name),b(this.props.formik.values,this.props.name))&&this.props.formik.validateOnChange&&this.props.formik.validateForm()},i.remove=function(e){var t;return this.updateArrayField(function(r){var n=r?K(r):[];return t||(t=n[e]),m(n.splice)&&n.splice(e,1),n},!0,!0),t},i.pop=function(){var e;return this.updateArrayField(function(t){var r=t;return e||(e=r&&r.pop&&r.pop()),r},!0,!0),e},i.render=function(){var e=this.props,r=e.component,n=e.render,i=e.children,a=e.name,o=d({},{push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},{form:p(e.formik,["validate","validationSchema"]),name:a});return r?t.createElement(r,o):n?n(o):i?"function"==typeof i?i(o):T(i)?null:t.Children.only(i):null},n}(t.Component);Y.defaultProps={validateOnChange:!0};var z=x(Y),J=x(function(e){function r(){return e.apply(this,arguments)||this}f(r,e);var n=r.prototype;return n.shouldComponentUpdate=function(e){return b(this.props.formik.errors,this.props.name)!==b(e.formik.errors,this.props.name)||b(this.props.formik.touched,this.props.name)!==b(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},n.render=function(){var e=this.props,r=e.component,n=e.formik,i=e.render,a=e.children,o=e.name,u=p(e,["component","formik","render","children","name"]),s=b(n.touched,o),l=b(n.errors,o);return s&&l?i?m(i)?i(l):null:a?m(a)?a(l):null:r?t.createElement(r,u,l):l:null},r}(t.Component)),Q=x(function(e){function r(t){var r;r=e.call(this,t)||this;var n=t.render,i=t.children,a=t.component,o=t.as;return n&&u(!1),a&&n&&u(!1),o&&i&&m(i)&&u(!1),a&&i&&m(i)&&u(!1),n&&i&&!T(i)&&u(!1),r}f(r,e);var n=r.prototype;return n.shouldComponentUpdate=function(e){return this.props.shouldUpdate?this.props.shouldUpdate(e,this.props):e.name!==this.props.name||b(e.formik.values,this.props.name)!==b(this.props.formik.values,this.props.name)||b(e.formik.errors,this.props.name)!==b(this.props.formik.errors,this.props.name)||b(e.formik.touched,this.props.name)!==b(this.props.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length||e.formik.isSubmitting!==this.props.formik.isSubmitting},n.componentDidMount=function(){this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentDidUpdate=function(e){this.props.name!==e.name&&(this.props.formik.unregisterField(e.name),this.props.formik.registerField(this.props.name,{validate:this.props.validate})),this.props.validate!==e.validate&&this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentWillUnmount=function(){this.props.formik.unregisterField(this.props.name)},n.render=function(){var e=this.props,r=e.name,n=e.render,i=e.as,a=e.children,o=e.component,u=e.formik,s=p(e,["validate","name","render","as","children","component","shouldUpdate","formik"]),l=p(u,["validate","validationSchema"]),c={value:"radio"===s.type||"checkbox"===s.type?s.value:b(u.values,r),name:r,onChange:u.handleChange,onBlur:u.handleBlur},f={field:c,meta:{value:b(u.values,r),error:b(u.errors,r),touched:!!b(u.touched,r),initialValue:b(u.initialValues,r),initialTouched:!!b(u.initialTouched,r),initialError:b(u.initialErrors,r)},form:l};if(n)return n(f);if(m(a))return a(f);if(o){if("string"==typeof o){var h=s.innerRef,v=p(s,["innerRef"]);return t.createElement(o,d({ref:h},c,{},v),a)}return t.createElement(o,d({field:c,form:u},s),a)}var y=i||"input";if("string"==typeof y){var E=s.innerRef,S=p(s,["innerRef"]);return t.createElement(y,d({ref:E},c,{},S),a)}return t.createElement(y,d({},c,{},s),a)},r}(t.Component));e.ErrorMessage=J,e.FastField=Q,e.Field=function(e){var r=e.validate,n=e.name,i=e.render,a=e.children,o=e.as,u=e.component,s=p(e,["validate","name","render","children","as","component"]),l=p(_(),["validate","validationSchema"]);t.useEffect(function(){},[]);var c=l.registerField,f=l.unregisterField;t.useEffect(function(){return c(n,{validate:r}),function(){f(n)}},[c,f,n,r]);var h=l.getFieldProps(d({name:n},s)),v=l.getFieldMeta(n),y={field:h,form:l};if(i)return i(d({},y,{meta:v}));if(m(a))return a(d({},y,{meta:v}));if(u){if("string"==typeof u){var E=s.innerRef,S=p(s,["innerRef"]);return t.createElement(u,d({ref:E},h,{},S),a)}return t.createElement(u,d({field:h,form:l},s),a)}var T=o||"input";if("string"==typeof T){var g=s.innerRef,b=p(s,["innerRef"]);return t.createElement(T,d({ref:g},h,{},b),a)}return t.createElement(T,d({},h,{},s),a)},e.FieldArray=z,e.Form=B,e.Formik=U,e.FormikConsumer=C,e.FormikContext=O,e.FormikProvider=R,e.connect=x,e.getActiveElement=function(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}},e.getIn=b,e.insert=G,e.isEmptyArray=v,e.isEmptyChildren=T,e.isFunction=m,e.isInputEvent=function(e){return e&&y(e)&&y(e.target)},e.isInteger=E,e.isNaN=function(e){return e!=e},e.isObject=y,e.isPromise=g,e.isString=S,e.move=q,e.prepareDataForValidation=M,e.replace=H,e.setIn=F,e.setNestedObjectValues=k,e.swap=W,e.useField=function(e){var r=_(),n=r.getFieldProps,i=r.getFieldMeta,a=r.registerField,o=r.unregisterField,s=y(e),l=s?e.name:e,c=s?e.validate:void 0;return t.useEffect(function(){return l&&a(l,{validate:c}),function(){l&&o(l)}},[a,o,l,c]),y(e)?(e.name||u(!1),[n(e),i(e.name)]):[n({name:e}),i(e)]},e.useFormik=w,e.useFormikContext=_,e.validateYupSchema=V,e.withFormik=function(e){var r=e.mapPropsToValues,n=void 0===r?function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&"function"!=typeof e[r]&&(t[r]=e[r]);return t}:r,i=p(e,["mapPropsToValues"]);return function(e){var r=e.displayName||e.name||e.constructor&&e.constructor.name||"Component",a=function(r){function a(){var n;return(n=r.apply(this,arguments)||this).validate=function(e){return i.validate(e,n.props)},n.validationSchema=function(){return m(i.validationSchema)?i.validationSchema(n.props):i.validationSchema},n.handleSubmit=function(e,t){return i.handleSubmit(e,d({},t,{props:n.props}))},n.renderFormComponent=function(r){return t.createElement(e,Object.assign({},n.props,r))},n}return f(a,r),a.prototype.render=function(){var e=p(this.props,["children"]);return t.createElement(U,Object.assign({},e,i,{validate:i.validate&&this.validate,validationSchema:i.validationSchema&&this.validationSchema,initialValues:n(this.props),initialStatus:i.mapPropsToStatus&&i.mapPropsToStatus(this.props),initialErrors:i.mapPropsToErrors&&i.mapPropsToErrors(this.props),initialTouched:i.mapPropsToTouched&&i.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,children:this.renderFormComponent}))},a}(t.Component);return a.displayName="WithFormik("+r+")",l(a,e)}},e.yupToFormErrors=D});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-fast-compare"),require("deepmerge"),require("lodash-es/isPlainObject"),require("lodash-es/clone"),require("lodash-es/toPath"),require("tiny-warning"),require("scheduler"),require("hoist-non-react-statics"),require("lodash-es/cloneDeep")):"function"==typeof define&&define.amd?define(["exports","react","react-fast-compare","deepmerge","lodash-es/isPlainObject","lodash-es/clone","lodash-es/toPath","tiny-warning","scheduler","hoist-non-react-statics","lodash-es/cloneDeep"],t):t((e=e||self).formik={},e.React,e.isEqual,e.deepmerge,e.isPlainObject,e.clone,e.toPath,e.invariant,e.scheduler,e.hoistNonReactStatics,e.cloneDeep)}(this,function(e,t,r,n,i,a,o,u,s,l,c){"use strict";function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function f(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function p(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)t.indexOf(r=a[n])>=0||(i[r]=e[r]);return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}r=r&&r.hasOwnProperty("default")?r.default:r,n=n&&n.hasOwnProperty("default")?n.default:n,i=i&&i.hasOwnProperty("default")?i.default:i,a=a&&a.hasOwnProperty("default")?a.default:a,o=o&&o.hasOwnProperty("default")?o.default:o,u=u&&u.hasOwnProperty("default")?u.default:u,l=l&&l.hasOwnProperty("default")?l.default:l,c=c&&c.hasOwnProperty("default")?c.default:c;var v=function(e){return Array.isArray(e)&&0===e.length},m=function(e){return"function"==typeof e},y=function(e){return null!==e&&"object"==typeof e},E=function(e){return String(Math.floor(Number(e)))===e},S=function(e){return"[object String]"===Object.prototype.toString.call(e)},T=function(e){return 0===t.Children.count(e)},g=function(e){return y(e)&&m(e.then)};function b(e,t,r,n){void 0===n&&(n=0);for(var i=o(t);e&&n<i.length;)e=e[i[n++]];return void 0===e?r:e}function F(e,t,r){for(var n=a(e),i=n,u=0,s=o(t);u<s.length-1;u++){var l=s[u],c=b(e,s.slice(0,u+1));if(c&&(y(c)||Array.isArray(c)))i=i[l]=a(c);else{var d=s[u+1];i=i[l]=E(d)&&Number(d)>=0?[]:{}}}return(0===u?e:i)[s[u]]===r?e:(void 0===r||v(r)?delete i[s[u]]:i[s[u]]=r,(0===u&&void 0===r||v(r))&&delete n[s[u]],n)}function k(e,t,r,n){void 0===r&&(r=new WeakMap),void 0===n&&(n={});for(var i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],u=e[o];y(u)?r.get(u)||(r.set(u,!0),n[o]=Array.isArray(u)?[]:{},k(u,t,r,n[o])):n[o]=t}return n}var O=t.createContext(void 0),R=O.Provider,C=O.Consumer;function _(){var e=t.useContext(O);return e||u(!1),e}function A(e,t){switch(t.type){case"SET_VALUES":return d({},e,{values:t.payload});case"SET_TOUCHED":return d({},e,{touched:t.payload});case"SET_ERRORS":return r(e.errors,t.payload)?e:d({},e,{errors:t.payload});case"SET_STATUS":return d({},e,{status:t.payload});case"SET_ISSUBMITTING":return d({},e,{isSubmitting:t.payload});case"SET_ISVALIDATING":return d({},e,{isValidating:t.payload});case"SET_FIELD_VALUE":return d({},e,{values:F(e.values,t.payload.field,t.payload.value)});case"SET_FIELD_TOUCHED":return d({},e,{touched:F(e.touched,t.payload.field,t.payload.value)});case"SET_FIELD_ERROR":return d({},e,{errors:F(e.errors,t.payload.field,t.payload.value)});case"RESET_FORM":return d({},e,{},t.payload);case"SET_FORMIK_STATE":return t.payload(e);case"SUBMIT_ATTEMPT":return d({},e,{touched:k(e.values,!0),isSubmitting:!0,submitCount:e.submitCount+1});case"SUBMIT_FAILURE":case"SUBMIT_SUCCESS":return d({},e,{isSubmitting:!1});default:return e}}var P={},I={};function w(e){var i=e.validateOnChange,a=void 0===i||i,o=e.validateOnBlur,u=void 0===o||o,l=e.validateOnMount,c=void 0!==l&&l,f=e.isInitialValid,h=e.enableReinitialize,v=void 0!==h&&h,E=e.onSubmit,T=p(e,["validateOnChange","validateOnBlur","validateOnMount","isInitialValid","enableReinitialize","onSubmit"]),k=d({validateOnChange:a,validateOnBlur:u,validateOnMount:c,onSubmit:E},T),O=t.useRef(k.initialValues),R=t.useRef(k.initialErrors||P),C=t.useRef(k.initialTouched||I),_=t.useRef(k.initialStatus),w=t.useRef(!1),U=t.useRef({});t.useEffect(function(){},[]),t.useEffect(function(){return w.current=!0,function(){w.current=!1}},[]);var M=t.useReducer(A,{values:k.initialValues,errors:k.initialErrors||P,touched:k.initialTouched||I,status:k.initialStatus,isSubmitting:!1,isValidating:!1,submitCount:0}),L=M[0],B=M[1],x=t.useCallback(function(e,t){return new Promise(function(r,n){var i=k.validate(e,t);null==i?r(P):g(i)?i.then(function(e){r(e||P)},function(e){n(e)}):r(i)})},[k.validate]),q=t.useCallback(function(e,t){var r=k.validationSchema,n=m(r)?r(t):r,i=t&&n.validateAt?n.validateAt(t,e):V(e,n);return new Promise(function(e,t){i.then(function(){e(P)},function(r){"ValidationError"===r.name?e(D(r)):t(r)})})},[k.validationSchema]),W=t.useCallback(function(e,t){return new Promise(function(r){return r(U.current[e].validate(t))})},[]),G=t.useCallback(function(e){var t=Object.keys(U.current).filter(function(e){return m(U.current[e].validate)}),r=t.length>0?t.map(function(t){return W(t,b(e,t))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(r).then(function(e){return e.reduce(function(e,r,n){return"DO_NOT_DELETE_YOU_WILL_BE_FIRED"===r?e:(r&&(e=F(e,t[n],r)),e)},{})})},[W]),H=t.useCallback(function(e){return Promise.all([G(e),k.validationSchema?q(e):{},k.validate?x(e):{}]).then(function(e){return n.all([e[0],e[1],e[2]],{arrayMerge:j})})},[k.validate,k.validationSchema,G,x,q]),K=N(function(e){return void 0===e&&(e=L.values),s.unstable_runWithPriority(s.LowPriority,function(){return H(e).then(function(e){return w.current&&B({type:"SET_ERRORS",payload:e}),e}).catch(function(e){})})}),Y=N(function(e){return void 0===e&&(e=L.values),B({type:"SET_ISVALIDATING",payload:!0}),H(e).then(function(e){return w.current&&(B({type:"SET_ISVALIDATING",payload:!1}),r(L.errors,e)||B({type:"SET_ERRORS",payload:e})),e})});t.useEffect(function(){c&&!0===w.current&&K(k.initialValues)},[k.initialValues,c,K]);var z=t.useCallback(function(e){var t=e&&e.values?e.values:O.current,r=e&&e.errors?e.errors:R.current?R.current:k.initialErrors||{},n=e&&e.touched?e.touched:C.current?C.current:k.initialTouched||{},i=e&&e.status?e.status:_.current?_.current:k.initialStatus;O.current=t,R.current=r,C.current=n,_.current=i,B({type:"RESET_FORM",payload:{isSubmitting:!!e&&!!e.isSubmitting,errors:r,touched:n,status:i,values:t,isValidating:!!e&&!!e.isValidating,submitCount:e&&e.submitCount&&"number"==typeof e.submitCount?e.submitCount:0}})},[k.initialErrors,k.initialStatus,k.initialTouched]);t.useEffect(function(){v&&!0===w.current&&!r(O.current,k.initialValues)&&(O.current=k.initialValues,z())},[v,k.initialValues,z]),t.useEffect(function(){v&&!0===w.current&&!r(R.current,k.initialErrors)&&(R.current=k.initialErrors||P,B({type:"SET_ERRORS",payload:k.initialErrors||P}))},[v,k.initialErrors]),t.useEffect(function(){v&&!0===w.current&&!r(C.current,k.initialTouched)&&(C.current=k.initialTouched||I,B({type:"SET_TOUCHED",payload:k.initialTouched||I}))},[v,k.initialTouched]),t.useEffect(function(){v&&!0===w.current&&!r(_.current,k.initialStatus)&&(_.current=k.initialStatus,B({type:"SET_STATUS",payload:k.initialStatus}))},[v,k.initialStatus,k.initialTouched]);var J=N(function(e){if(m(U.current[e].validate)){var t=b(L.values,e),r=U.current[e].validate(t);return g(r)?(B({type:"SET_ISVALIDATING",payload:!0}),r.then(function(e){return e}).then(function(t){B({type:"SET_FIELD_ERROR",payload:{field:e,value:t}}),B({type:"SET_ISVALIDATING",payload:!1})})):(B({type:"SET_FIELD_ERROR",payload:{field:e,value:r}}),Promise.resolve(r))}return Promise.resolve()}),Q=t.useCallback(function(e,t){U.current[e]={validate:t.validate}},[]),X=t.useCallback(function(e){delete U.current[e]},[]),Z=N(function(e,t){return B({type:"SET_TOUCHED",payload:e}),(void 0===t?u:t)?K(L.values):Promise.resolve()}),$=t.useCallback(function(e){B({type:"SET_ERRORS",payload:e})},[]),ee=N(function(e,t){return B({type:"SET_VALUES",payload:e}),(void 0===t?a:t)?K(e):Promise.resolve()}),te=t.useCallback(function(e,t){B({type:"SET_FIELD_ERROR",payload:{field:e,value:t}})},[]),re=N(function(e,t,r){return B({type:"SET_FIELD_VALUE",payload:{field:e,value:t}}),(void 0===r?a:r)?K(F(L.values,e,t)):Promise.resolve()}),ne=t.useCallback(function(e,t){var r,n=t,i=e;if(!S(e)){e.persist&&e.persist();var a=e.target?e.target:e.currentTarget,o=a.type,u=a.value,s=a.checked,l=a.options,c=a.multiple;n=t||a.name||a.id,i=/number|range/.test(o)?(r=parseFloat(u),isNaN(r)?"":r):/checkbox/.test(o)?function(e,t,r){if("true"==r||"false"==r)return!!t;if(t&&r)return Array.isArray(e)?e.concat(r):[r];if(!Array.isArray(e))return!e;var n=e.indexOf(r);return n<0?e:e.slice(0,n).concat(e.slice(n+1))}(b(L.values,n),s,u):c?function(e){return Array.from(e).filter(function(e){return e.selected}).map(function(e){return e.value})}(l):u}n&&re(n,i)},[re,L.values]),ie=t.useCallback(function(e){if(S(e))return function(t){return ne(t,e)};ne(e)},[ne]),ae=N(function(e,t,r){return void 0===t&&(t=!0),B({type:"SET_FIELD_TOUCHED",payload:{field:e,value:t}}),(void 0===r?u:r)?K(L.values):Promise.resolve()}),oe=t.useCallback(function(e,t){e.persist&&e.persist();var r=e.target;ae(t||r.name||r.id,!0)},[ae]),ue=t.useCallback(function(e){if(S(e))return function(t){return oe(t,e)};oe(e)},[oe]),se=t.useCallback(function(e){m(e)?B({type:"SET_FORMIK_STATE",payload:e}):B({type:"SET_FORMIK_STATE",payload:function(){return e}})},[]),le=t.useCallback(function(e){B({type:"SET_STATUS",payload:e})},[]),ce=t.useCallback(function(e){B({type:"SET_ISSUBMITTING",payload:e})},[]),de={resetForm:z,validateForm:Y,validateField:J,setErrors:$,setFieldError:te,setFieldTouched:ae,setFieldValue:re,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,setFormikState:se},fe=N(function(){return E(L.values,de)}),pe=N(function(){return B({type:"SUBMIT_ATTEMPT"}),Y().then(function(e){var t=e instanceof Error;if(!t&&0===Object.keys(e).length){var r;try{if(void 0===(r=fe()))return}catch(e){throw e}return Promise.resolve(r).then(function(){w.current&&B({type:"SUBMIT_SUCCESS"})}).catch(function(e){if(w.current)throw B({type:"SUBMIT_FAILURE"}),e})}if(w.current&&(B({type:"SUBMIT_FAILURE"}),t))throw e})}),he=N(function(e){e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),pe().catch(function(e){console.warn("Warning: An unhandled error was caught from submitForm()",e)})}),ve=N(function(e){if(e&&e.preventDefault&&m(e.preventDefault)&&e.preventDefault(),e&&e.stopPropagation&&m(e.stopPropagation)&&e.stopPropagation(),k.onReset){var t=k.onReset(L.values,de);g(t)?t.then(z):z()}else z()}),me=t.useCallback(function(e){return{value:b(L.values,e),error:b(L.errors,e),touched:!!b(L.touched,e),initialValue:b(O.current,e),initialTouched:!!b(C.current,e),initialError:b(R.current,e)}},[L.errors,L.touched,L.values]),ye=t.useCallback(function(e){var t=y(e),r=t?e.name:e,n=b(L.values,r),i={name:r,value:n,onChange:ie,onBlur:ue};if(t){var a=e.type,o=e.value,u=e.as,s=e.multiple;"checkbox"===a?void 0===o?i.checked=!!n:(i.checked=!(!Array.isArray(n)||!~n.indexOf(o)),i.value=o):"radio"===a?(i.checked=n===o,i.value=o):"select"===u&&s&&(i.value=i.value||[],i.multiple=!0)}return i},[ue,ie,L.values]),Ee=t.useMemo(function(){return!r(O.current,L.values)},[O.current,L.values]),Se=t.useMemo(function(){return void 0!==f?Ee?L.errors&&0===Object.keys(L.errors).length:!1!==f&&m(f)?f(k):f:L.errors&&0===Object.keys(L.errors).length},[f,Ee,L.errors,k]);return d({},L,{initialValues:O.current,initialErrors:R.current,initialTouched:C.current,initialStatus:_.current,handleBlur:ue,handleChange:ie,handleReset:ve,handleSubmit:he,resetForm:z,setErrors:$,setFormikState:se,setFieldTouched:ae,setFieldValue:re,setFieldError:te,setStatus:le,setSubmitting:ce,setTouched:Z,setValues:ee,submitForm:pe,validateForm:Y,validateField:J,isValid:Se,dirty:Ee,unregisterField:X,registerField:Q,getFieldProps:ye,getFieldMeta:me,validateOnBlur:u,validateOnChange:a,validateOnMount:c})}function U(e){var r=w(e),n=e.component,i=e.children,a=e.render;return t.useEffect(function(){},[]),t.createElement(R,{value:r},n?t.createElement(n,r):a?a(r):i?m(i)?i(r):T(i)?null:t.Children.only(i):null)}function D(e){var t={};if(e.inner){if(0===e.inner.length)return F(t,e.path,e.message);var r=e.inner,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var a;if(n){if(i>=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}var o=a;b(t,o.path)||(t=F(t,o.path,o.message))}}return t}function V(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n={});var i=M(e);return t[r?"validateSync":"validate"](i,{abortEarly:!1,context:n})}function M(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=String(r);t[n]=!0===Array.isArray(e[n])?e[n].map(function(e){return!0===Array.isArray(e)||i(e)?M(e):""!==e?e:void 0}):i(e[n])?M(e[n]):""!==e[n]?e[n]:void 0}return t}function j(e,t,r){var i=e.slice();return t.forEach(function(t,a){if(void 0===i[a]){var o=!1!==r.clone&&r.isMergeableObject(t);i[a]=o?n(Array.isArray(t)?[]:{},t,r):t}else r.isMergeableObject(t)?i[a]=n(e[a],t,r):-1===e.indexOf(t)&&i.push(t)}),i}var L="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function N(e){var r=t.useRef(e);return L(function(){r.current=e}),t.useCallback(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.current.apply(void 0,t)},[])}var B=t.forwardRef(function(e,r){var n=e.action,i=p(e,["action"]),a=n||"#",o=_();return t.createElement("form",Object.assign({onSubmit:o.handleSubmit,ref:r,onReset:o.handleReset,action:a},i))});function x(e){var r=function(r){return t.createElement(C,null,function(n){return n||u(!1),t.createElement(e,Object.assign({},r,{formik:n}))})},n=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return r.WrappedComponent=e,r.displayName="FormikConnect("+n+")",l(r,e)}B.displayName="Form";var q=function(e,t,r){var n=K(e),i=n[t];return n.splice(t,1),n.splice(r,0,i),n},W=function(e,t,r){var n=K(e),i=n[t];return n[t]=n[r],n[r]=i,n},G=function(e,t,r){var n=K(e);return n.splice(t,0,r),n},H=function(e,t,r){var n=K(e);return n[t]=r,n},K=function(e){if(e){if(Array.isArray(e))return[].concat(e);var t=Object.keys(e).map(function(e){return parseInt(e)}).reduce(function(e,t){return t>e?t:e},0);return Array.from(d({},e,{length:t+1}))}return[]},Y=function(e){function n(t){var r;return(r=e.call(this,t)||this).updateArrayField=function(e,t,n){var i=r.props,a=i.name;(0,i.formik.setFormikState)(function(r){var i="function"==typeof n?n:e,o="function"==typeof t?t:e;return d({},r,{values:F(r.values,a,e(b(r.values,a))),errors:n?F(r.errors,a,i(b(r.errors,a))):r.errors,touched:t?F(r.touched,a,o(b(r.touched,a))):r.touched})})},r.push=function(e){return r.updateArrayField(function(t){return[].concat(K(t),[c(e)])},!1,!1)},r.handlePush=function(e){return function(){return r.push(e)}},r.swap=function(e,t){return r.updateArrayField(function(r){return W(r,e,t)},!0,!0)},r.handleSwap=function(e,t){return function(){return r.swap(e,t)}},r.move=function(e,t){return r.updateArrayField(function(r){return q(r,e,t)},!0,!0)},r.handleMove=function(e,t){return function(){return r.move(e,t)}},r.insert=function(e,t){return r.updateArrayField(function(r){return G(r,e,t)},function(t){return G(t,e,null)},function(t){return G(t,e,null)})},r.handleInsert=function(e,t){return function(){return r.insert(e,t)}},r.replace=function(e,t){return r.updateArrayField(function(r){return H(r,e,t)},!1,!1)},r.handleReplace=function(e,t){return function(){return r.replace(e,t)}},r.unshift=function(e){var t=-1;return r.updateArrayField(function(r){var n=r?[e].concat(r):[e];return t<0&&(t=n.length),n},function(e){var r=e?[null].concat(e):[null];return t<0&&(t=r.length),r},function(e){var r=e?[null].concat(e):[null];return t<0&&(t=r.length),r}),t},r.handleUnshift=function(e){return function(){return r.unshift(e)}},r.handleRemove=function(e){return function(){return r.remove(e)}},r.handlePop=function(){return function(){return r.pop()}},r.remove=r.remove.bind(h(r)),r.pop=r.pop.bind(h(r)),r}f(n,e);var i=n.prototype;return i.componentDidUpdate=function(e){!r(b(e.formik.values,e.name),b(this.props.formik.values,this.props.name))&&this.props.formik.validateOnChange&&this.props.formik.validateForm()},i.remove=function(e){var t;return this.updateArrayField(function(r){var n=r?K(r):[];return t||(t=n[e]),m(n.splice)&&n.splice(e,1),n},!0,!0),t},i.pop=function(){var e;return this.updateArrayField(function(t){var r=t;return e||(e=r&&r.pop&&r.pop()),r},!0,!0),e},i.render=function(){var e=this.props,r=e.component,n=e.render,i=e.children,a=e.name,o=d({},{push:this.push,pop:this.pop,swap:this.swap,move:this.move,insert:this.insert,replace:this.replace,unshift:this.unshift,remove:this.remove,handlePush:this.handlePush,handlePop:this.handlePop,handleSwap:this.handleSwap,handleMove:this.handleMove,handleInsert:this.handleInsert,handleReplace:this.handleReplace,handleUnshift:this.handleUnshift,handleRemove:this.handleRemove},{form:p(e.formik,["validate","validationSchema"]),name:a});return r?t.createElement(r,o):n?n(o):i?"function"==typeof i?i(o):T(i)?null:t.Children.only(i):null},n}(t.Component);Y.defaultProps={validateOnChange:!0};var z=x(Y),J=x(function(e){function r(){return e.apply(this,arguments)||this}f(r,e);var n=r.prototype;return n.shouldComponentUpdate=function(e){return b(this.props.formik.errors,this.props.name)!==b(e.formik.errors,this.props.name)||b(this.props.formik.touched,this.props.name)!==b(e.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length},n.render=function(){var e=this.props,r=e.component,n=e.formik,i=e.render,a=e.children,o=e.name,u=p(e,["component","formik","render","children","name"]),s=b(n.touched,o),l=b(n.errors,o);return s&&l?i?m(i)?i(l):null:a?m(a)?a(l):null:r?t.createElement(r,u,l):l:null},r}(t.Component)),Q=x(function(e){function r(t){var r;r=e.call(this,t)||this;var n=t.render,i=t.children,a=t.component,o=t.as;return n&&u(!1),a&&n&&u(!1),o&&i&&m(i)&&u(!1),a&&i&&m(i)&&u(!1),n&&i&&!T(i)&&u(!1),r}f(r,e);var n=r.prototype;return n.shouldComponentUpdate=function(e){return this.props.shouldUpdate?this.props.shouldUpdate(e,this.props):e.name!==this.props.name||b(e.formik.values,this.props.name)!==b(this.props.formik.values,this.props.name)||b(e.formik.errors,this.props.name)!==b(this.props.formik.errors,this.props.name)||b(e.formik.touched,this.props.name)!==b(this.props.formik.touched,this.props.name)||Object.keys(this.props).length!==Object.keys(e).length||e.formik.isSubmitting!==this.props.formik.isSubmitting},n.componentDidMount=function(){this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentDidUpdate=function(e){this.props.name!==e.name&&(this.props.formik.unregisterField(e.name),this.props.formik.registerField(this.props.name,{validate:this.props.validate})),this.props.validate!==e.validate&&this.props.formik.registerField(this.props.name,{validate:this.props.validate})},n.componentWillUnmount=function(){this.props.formik.unregisterField(this.props.name)},n.render=function(){var e=this.props,r=e.name,n=e.render,i=e.as,a=e.children,o=e.component,u=e.formik,s=p(e,["validate","name","render","as","children","component","shouldUpdate","formik"]),l=p(u,["validate","validationSchema"]),c={value:"radio"===s.type||"checkbox"===s.type?s.value:b(u.values,r),name:r,onChange:u.handleChange,onBlur:u.handleBlur},f={field:c,meta:{value:b(u.values,r),error:b(u.errors,r),touched:!!b(u.touched,r),initialValue:b(u.initialValues,r),initialTouched:!!b(u.initialTouched,r),initialError:b(u.initialErrors,r)},form:l};if(n)return n(f);if(m(a))return a(f);if(o){if("string"==typeof o){var h=s.innerRef,v=p(s,["innerRef"]);return t.createElement(o,d({ref:h},c,{},v),a)}return t.createElement(o,d({field:c,form:u},s),a)}var y=i||"input";if("string"==typeof y){var E=s.innerRef,S=p(s,["innerRef"]);return t.createElement(y,d({ref:E},c,{},S),a)}return t.createElement(y,d({},c,{},s),a)},r}(t.Component));e.ErrorMessage=J,e.FastField=Q,e.Field=function(e){var r=e.validate,n=e.name,i=e.render,a=e.children,o=e.as,u=e.component,s=p(e,["validate","name","render","children","as","component"]),l=p(_(),["validate","validationSchema"]);t.useEffect(function(){},[]);var c=l.registerField,f=l.unregisterField;t.useEffect(function(){return c(n,{validate:r}),function(){f(n)}},[c,f,n,r]);var h=l.getFieldProps(d({name:n},s)),v=l.getFieldMeta(n),y={field:h,form:l};if(i)return i(d({},y,{meta:v}));if(m(a))return a(d({},y,{meta:v}));if(u){if("string"==typeof u){var E=s.innerRef,S=p(s,["innerRef"]);return t.createElement(u,d({ref:E},h,{},S),a)}return t.createElement(u,d({field:h,form:l},s),a)}var T=o||"input";if("string"==typeof T){var g=s.innerRef,b=p(s,["innerRef"]);return t.createElement(T,d({ref:g},h,{},b),a)}return t.createElement(T,d({},h,{},s),a)},e.FieldArray=z,e.Form=B,e.Formik=U,e.FormikConsumer=C,e.FormikContext=O,e.FormikProvider=R,e.connect=x,e.getActiveElement=function(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}},e.getIn=b,e.insert=G,e.isEmptyArray=v,e.isEmptyChildren=T,e.isFunction=m,e.isInputEvent=function(e){return e&&y(e)&&y(e.target)},e.isInteger=E,e.isNaN=function(e){return e!=e},e.isObject=y,e.isPromise=g,e.isString=S,e.move=q,e.prepareDataForValidation=M,e.replace=H,e.setIn=F,e.setNestedObjectValues=k,e.swap=W,e.useField=function(e){var r=_(),n=r.getFieldProps,i=r.getFieldMeta,a=r.registerField,o=r.unregisterField,s=y(e)?e:{name:e},l=s.name,c=s.validate;return t.useEffect(function(){return l&&a(l,{validate:c}),function(){l&&o(l)}},[a,o,l,c]),l||u(!1),[n(s),i(l)]},e.useFormik=w,e.useFormikContext=_,e.validateYupSchema=V,e.withFormik=function(e){var r=e.mapPropsToValues,n=void 0===r?function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&"function"!=typeof e[r]&&(t[r]=e[r]);return t}:r,i=p(e,["mapPropsToValues"]);return function(e){var r=e.displayName||e.name||e.constructor&&e.constructor.name||"Component",a=function(r){function a(){var n;return(n=r.apply(this,arguments)||this).validate=function(e){return i.validate(e,n.props)},n.validationSchema=function(){return m(i.validationSchema)?i.validationSchema(n.props):i.validationSchema},n.handleSubmit=function(e,t){return i.handleSubmit(e,d({},t,{props:n.props}))},n.renderFormComponent=function(r){return t.createElement(e,Object.assign({},n.props,r))},n}return f(a,r),a.prototype.render=function(){var e=p(this.props,["children"]);return t.createElement(U,Object.assign({},e,i,{validate:i.validate&&this.validate,validationSchema:i.validationSchema&&this.validationSchema,initialValues:n(this.props),initialStatus:i.mapPropsToStatus&&i.mapPropsToStatus(this.props),initialErrors:i.mapPropsToErrors&&i.mapPropsToErrors(this.props),initialTouched:i.mapPropsToTouched&&i.mapPropsToTouched(this.props),onSubmit:this.handleSubmit,children:this.renderFormComponent}))},a}(t.Component);return a.displayName="WithFormik("+r+")",l(a,e)}},e.yupToFormErrors=D});
//# sourceMappingURL=formik.umd.production.min.js.map
{
"name": "formik",
"description": "Forms in React, without tears",
"version": "2.0.9",
"version": "2.0.10",
"license": "MIT",

@@ -137,3 +137,3 @@ "author": "Jared Palmer <jared@palmer.net>",

],
"gitHead": "e8dd093dc0d64299a3d4b26a076055c310a7cff5"
"gitHead": "770417a6aca45a34d9ffb64890b6e6540d93f9d0"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc