Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

formik

Package Overview
Dependencies
15
Maintainers
1
Versions
212
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.5 to 2.4.6

2

dist/formik.cjs.production.min.js

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

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

@@ -10,0 +10,0 @@ "repository": "jaredpalmer/formik",

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc