Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

final-form

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

final-form - npm Package Compare versions

Comparing version 4.20.1 to 4.20.2

59

dist/final-form.cjs.js

@@ -343,3 +343,3 @@ 'use strict';

var version = "4.20.1";
var version = "4.20.2";

@@ -466,2 +466,3 @@ var configOptions = ['debug', 'initialValues', 'keepDirtyOnReinitialize', 'mutators', 'onSubmit', 'validate', 'validateOnBlur'];

submitSucceeded: false,
resetWhileSubmitting: false,
valid: true,

@@ -476,2 +477,3 @@ validating: 0,

var validationBlocked = false;
var preventNotificationWhileValidationPaused = false;
var nextAsyncValidationKey = 0;

@@ -592,5 +594,5 @@ var asyncValidationPromises = {};

var runFieldLevelValidation = function runFieldLevelValidation(field, setError) {
var runFieldLevelValidation = function runFieldLevelValidation(name, setError) {
var promises = [];
var validators = getValidators(field);
var validators = getValidators(state.fields[name]);

@@ -600,8 +602,8 @@ if (validators.length) {

validators.forEach(function (validator) {
var errorOrPromise = validator(getIn(state.formState.values, field.name), state.formState.values, validator.length === 0 || validator.length === 3 ? publishFieldState(state.formState, state.fields[field.name]) : undefined);
var errorOrPromise = validator(getIn(state.formState.values, name), state.formState.values, validator.length === 0 || validator.length === 3 ? publishFieldState(state.formState, state.fields[name]) : undefined);
if (errorOrPromise && isPromise(errorOrPromise)) {
field.validating = true;
state.fields[name].validating = true;
var promise = errorOrPromise.then(function (error) {
field.validating = false;
state.fields[name].validating = false;
setError(error);

@@ -664,3 +666,3 @@ }); // errors must be resolved, not rejected

}), fieldKeys.reduce(function (result, name) {
return result.concat(runFieldLevelValidation(fields[name], function (error) {
return result.concat(runFieldLevelValidation(name, function (error) {
fieldLevelErrors[name] = error;

@@ -858,3 +860,3 @@ }));

if (!inBatch && !validationPaused) {
if (!inBatch && !(validationPaused && preventNotificationWhileValidationPaused)) {
var lastFormState = state.lastFormState;

@@ -1037,4 +1039,9 @@ var nextFormState = calculateNextFormState();

},
pauseValidation: function pauseValidation() {
pauseValidation: function pauseValidation(preventNotification) {
if (preventNotification === void 0) {
preventNotification = true;
}
validationPaused = true;
preventNotificationWhileValidationPaused = preventNotification;
},

@@ -1110,3 +1117,5 @@ registerField: function registerField(name, subscriber, subscription, fieldConfig) {

if (fieldConfig.initialValue !== undefined && getIn(state.formState.values, name) === undefined // only initialize if we don't yet have any value for this field
var noValueInFormState = getIn(state.formState.values, name) === undefined;
if (fieldConfig.initialValue !== undefined && noValueInFormState && (getIn(state.formState.values, name) === undefined || getIn(state.formState.values, name) === getIn(state.formState.initialValues, name)) // only initialize if we don't yet have any value for this field
) {

@@ -1116,5 +1125,6 @@ state.formState.initialValues = setIn(state.formState.initialValues || {}, name, fieldConfig.initialValue);

runValidation(undefined, notify);
}
} // only use defaultValue if we don't yet have any value for this field
if (fieldConfig.defaultValue !== undefined && fieldConfig.initialValue === undefined && getIn(state.formState.initialValues, name) === undefined) {
if (fieldConfig.defaultValue !== undefined && fieldConfig.initialValue === undefined && getIn(state.formState.initialValues, name) === undefined && noValueInFormState) {
state.formState.values = setIn(state.formState.values, name, fieldConfig.defaultValue);

@@ -1139,5 +1149,11 @@ }

delete state.fieldSubscribers[name].entries[index];
var lastOne = !Object.keys(state.fieldSubscribers[name].entries).length;
var hasFieldSubscribers = !!state.fieldSubscribers[name];
if (hasFieldSubscribers) {
// state.fieldSubscribers[name] may have been removed by a mutator
delete state.fieldSubscribers[name].entries[index];
}
var lastOne = hasFieldSubscribers && !Object.keys(state.fieldSubscribers[name].entries).length;
if (lastOne) {

@@ -1175,3 +1191,3 @@ delete state.fieldSubscribers[name];

if (state.formState.submitting) {
throw Error('Cannot reset() in onSubmit(), use setTimeout(form.reset)');
state.formState.resetWhileSubmitting = true;
}

@@ -1236,2 +1252,3 @@

validationPaused = false;
preventNotificationWhileValidationPaused = false;

@@ -1346,3 +1363,8 @@ if (validationBlocked) {

formState.submitting = false;
var resetWhileSubmitting = formState.resetWhileSubmitting;
if (resetWhileSubmitting) {
formState.resetWhileSubmitting = false;
}
if (errors && hasAnyError(errors)) {

@@ -1355,4 +1377,7 @@ formState.submitFailed = true;

} else {
formState.submitFailed = false;
formState.submitSucceeded = true;
if (!resetWhileSubmitting) {
formState.submitFailed = false;
formState.submitSucceeded = true;
}
afterSubmit();

@@ -1359,0 +1384,0 @@ }

@@ -337,3 +337,3 @@ import _extends from '@babel/runtime/helpers/esm/extends';

var version = "4.20.1";
var version = "4.20.2";

@@ -460,2 +460,3 @@ var configOptions = ['debug', 'initialValues', 'keepDirtyOnReinitialize', 'mutators', 'onSubmit', 'validate', 'validateOnBlur'];

submitSucceeded: false,
resetWhileSubmitting: false,
valid: true,

@@ -470,2 +471,3 @@ validating: 0,

var validationBlocked = false;
var preventNotificationWhileValidationPaused = false;
var nextAsyncValidationKey = 0;

@@ -586,5 +588,5 @@ var asyncValidationPromises = {};

var runFieldLevelValidation = function runFieldLevelValidation(field, setError) {
var runFieldLevelValidation = function runFieldLevelValidation(name, setError) {
var promises = [];
var validators = getValidators(field);
var validators = getValidators(state.fields[name]);

@@ -594,8 +596,8 @@ if (validators.length) {

validators.forEach(function (validator) {
var errorOrPromise = validator(getIn(state.formState.values, field.name), state.formState.values, validator.length === 0 || validator.length === 3 ? publishFieldState(state.formState, state.fields[field.name]) : undefined);
var errorOrPromise = validator(getIn(state.formState.values, name), state.formState.values, validator.length === 0 || validator.length === 3 ? publishFieldState(state.formState, state.fields[name]) : undefined);
if (errorOrPromise && isPromise(errorOrPromise)) {
field.validating = true;
state.fields[name].validating = true;
var promise = errorOrPromise.then(function (error) {
field.validating = false;
state.fields[name].validating = false;
setError(error);

@@ -658,3 +660,3 @@ }); // errors must be resolved, not rejected

}), fieldKeys.reduce(function (result, name) {
return result.concat(runFieldLevelValidation(fields[name], function (error) {
return result.concat(runFieldLevelValidation(name, function (error) {
fieldLevelErrors[name] = error;

@@ -852,3 +854,3 @@ }));

if (!inBatch && !validationPaused) {
if (!inBatch && !(validationPaused && preventNotificationWhileValidationPaused)) {
var lastFormState = state.lastFormState;

@@ -1031,4 +1033,9 @@ var nextFormState = calculateNextFormState();

},
pauseValidation: function pauseValidation() {
pauseValidation: function pauseValidation(preventNotification) {
if (preventNotification === void 0) {
preventNotification = true;
}
validationPaused = true;
preventNotificationWhileValidationPaused = preventNotification;
},

@@ -1104,3 +1111,5 @@ registerField: function registerField(name, subscriber, subscription, fieldConfig) {

if (fieldConfig.initialValue !== undefined && getIn(state.formState.values, name) === undefined // only initialize if we don't yet have any value for this field
var noValueInFormState = getIn(state.formState.values, name) === undefined;
if (fieldConfig.initialValue !== undefined && noValueInFormState && (getIn(state.formState.values, name) === undefined || getIn(state.formState.values, name) === getIn(state.formState.initialValues, name)) // only initialize if we don't yet have any value for this field
) {

@@ -1110,5 +1119,6 @@ state.formState.initialValues = setIn(state.formState.initialValues || {}, name, fieldConfig.initialValue);

runValidation(undefined, notify);
}
} // only use defaultValue if we don't yet have any value for this field
if (fieldConfig.defaultValue !== undefined && fieldConfig.initialValue === undefined && getIn(state.formState.initialValues, name) === undefined) {
if (fieldConfig.defaultValue !== undefined && fieldConfig.initialValue === undefined && getIn(state.formState.initialValues, name) === undefined && noValueInFormState) {
state.formState.values = setIn(state.formState.values, name, fieldConfig.defaultValue);

@@ -1133,5 +1143,11 @@ }

delete state.fieldSubscribers[name].entries[index];
var lastOne = !Object.keys(state.fieldSubscribers[name].entries).length;
var hasFieldSubscribers = !!state.fieldSubscribers[name];
if (hasFieldSubscribers) {
// state.fieldSubscribers[name] may have been removed by a mutator
delete state.fieldSubscribers[name].entries[index];
}
var lastOne = hasFieldSubscribers && !Object.keys(state.fieldSubscribers[name].entries).length;
if (lastOne) {

@@ -1169,3 +1185,3 @@ delete state.fieldSubscribers[name];

if (state.formState.submitting) {
throw Error('Cannot reset() in onSubmit(), use setTimeout(form.reset)');
state.formState.resetWhileSubmitting = true;
}

@@ -1230,2 +1246,3 @@

validationPaused = false;
preventNotificationWhileValidationPaused = false;

@@ -1340,3 +1357,8 @@ if (validationBlocked) {

formState.submitting = false;
var resetWhileSubmitting = formState.resetWhileSubmitting;
if (resetWhileSubmitting) {
formState.resetWhileSubmitting = false;
}
if (errors && hasAnyError(errors)) {

@@ -1349,4 +1371,7 @@ formState.submitFailed = true;

} else {
formState.submitFailed = false;
formState.submitSucceeded = true;
if (!resetWhileSubmitting) {
formState.submitFailed = false;
formState.submitSucceeded = true;
}
afterSubmit();

@@ -1353,0 +1378,0 @@ }

@@ -373,3 +373,3 @@ (function (global, factory) {

var version = "4.20.1";
var version = "4.20.2";

@@ -496,2 +496,3 @@ var configOptions = ['debug', 'initialValues', 'keepDirtyOnReinitialize', 'mutators', 'onSubmit', 'validate', 'validateOnBlur'];

submitSucceeded: false,
resetWhileSubmitting: false,
valid: true,

@@ -506,2 +507,3 @@ validating: 0,

var validationBlocked = false;
var preventNotificationWhileValidationPaused = false;
var nextAsyncValidationKey = 0;

@@ -622,5 +624,5 @@ var asyncValidationPromises = {};

var runFieldLevelValidation = function runFieldLevelValidation(field, setError) {
var runFieldLevelValidation = function runFieldLevelValidation(name, setError) {
var promises = [];
var validators = getValidators(field);
var validators = getValidators(state.fields[name]);

@@ -630,8 +632,8 @@ if (validators.length) {

validators.forEach(function (validator) {
var errorOrPromise = validator(getIn(state.formState.values, field.name), state.formState.values, validator.length === 0 || validator.length === 3 ? publishFieldState(state.formState, state.fields[field.name]) : undefined);
var errorOrPromise = validator(getIn(state.formState.values, name), state.formState.values, validator.length === 0 || validator.length === 3 ? publishFieldState(state.formState, state.fields[name]) : undefined);
if (errorOrPromise && isPromise(errorOrPromise)) {
field.validating = true;
state.fields[name].validating = true;
var promise = errorOrPromise.then(function (error) {
field.validating = false;
state.fields[name].validating = false;
setError(error);

@@ -694,3 +696,3 @@ }); // errors must be resolved, not rejected

}), fieldKeys.reduce(function (result, name) {
return result.concat(runFieldLevelValidation(fields[name], function (error) {
return result.concat(runFieldLevelValidation(name, function (error) {
fieldLevelErrors[name] = error;

@@ -888,3 +890,3 @@ }));

if (!inBatch && !validationPaused) {
if (!inBatch && !(validationPaused && preventNotificationWhileValidationPaused)) {
var lastFormState = state.lastFormState;

@@ -1067,4 +1069,9 @@ var nextFormState = calculateNextFormState();

},
pauseValidation: function pauseValidation() {
pauseValidation: function pauseValidation(preventNotification) {
if (preventNotification === void 0) {
preventNotification = true;
}
validationPaused = true;
preventNotificationWhileValidationPaused = preventNotification;
},

@@ -1140,3 +1147,5 @@ registerField: function registerField(name, subscriber, subscription, fieldConfig) {

if (fieldConfig.initialValue !== undefined && getIn(state.formState.values, name) === undefined // only initialize if we don't yet have any value for this field
var noValueInFormState = getIn(state.formState.values, name) === undefined;
if (fieldConfig.initialValue !== undefined && noValueInFormState && (getIn(state.formState.values, name) === undefined || getIn(state.formState.values, name) === getIn(state.formState.initialValues, name)) // only initialize if we don't yet have any value for this field
) {

@@ -1146,5 +1155,6 @@ state.formState.initialValues = setIn(state.formState.initialValues || {}, name, fieldConfig.initialValue);

runValidation(undefined, notify);
}
} // only use defaultValue if we don't yet have any value for this field
if (fieldConfig.defaultValue !== undefined && fieldConfig.initialValue === undefined && getIn(state.formState.initialValues, name) === undefined) {
if (fieldConfig.defaultValue !== undefined && fieldConfig.initialValue === undefined && getIn(state.formState.initialValues, name) === undefined && noValueInFormState) {
state.formState.values = setIn(state.formState.values, name, fieldConfig.defaultValue);

@@ -1169,5 +1179,11 @@ }

delete state.fieldSubscribers[name].entries[index];
var lastOne = !Object.keys(state.fieldSubscribers[name].entries).length;
var hasFieldSubscribers = !!state.fieldSubscribers[name];
if (hasFieldSubscribers) {
// state.fieldSubscribers[name] may have been removed by a mutator
delete state.fieldSubscribers[name].entries[index];
}
var lastOne = hasFieldSubscribers && !Object.keys(state.fieldSubscribers[name].entries).length;
if (lastOne) {

@@ -1205,3 +1221,3 @@ delete state.fieldSubscribers[name];

if (state.formState.submitting) {
throw Error('Cannot reset() in onSubmit(), use setTimeout(form.reset)');
state.formState.resetWhileSubmitting = true;
}

@@ -1266,2 +1282,3 @@

validationPaused = false;
preventNotificationWhileValidationPaused = false;

@@ -1376,3 +1393,8 @@ if (validationBlocked) {

formState.submitting = false;
var resetWhileSubmitting = formState.resetWhileSubmitting;
if (resetWhileSubmitting) {
formState.resetWhileSubmitting = false;
}
if (errors && hasAnyError(errors)) {

@@ -1385,4 +1407,7 @@ formState.submitFailed = true;

} else {
formState.submitFailed = false;
formState.submitSucceeded = true;
if (!resetWhileSubmitting) {
formState.submitFailed = false;
formState.submitSucceeded = true;
}
afterSubmit();

@@ -1389,0 +1414,0 @@ }

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["final-form"]={})}(this,function(e){"use strict";function R(){return(R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(this,arguments)}function o(e){if(null==e||!e.length)return[];if("string"!=typeof e)throw new Error("toPath() expects a string");return null==t[e]&&(t[e]=e.split(i).filter(Boolean)),t[e]}var t={},i=/[.[\]]+/,A=function(e,t){for(var i=o(t),r=e,n=0;n<i.length;n++){var a=i[n];if(null==r||"object"!=typeof r||Array.isArray(r)&&isNaN(a))return;r=r[a]}return r};function S(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof t?t:String(t)}function h(e,t,i,r,n){if(t>=i.length)return r;var a,o=i[t];if(isNaN(o)){if(null==e){var u,s=h(void 0,t+1,i,r,n);return void 0===s?void 0:((u={})[o]=s,u)}if(Array.isArray(e))throw new Error("Cannot set a non-numeric property on an array");var d=h(e[o],t+1,i,r,n);if(void 0!==d)return R({},e,((a={})[o]=d,a));var l=Object.keys(e).length;if(void 0===e[o]&&0===l)return;if(void 0!==e[o]&&l<=1)return isNaN(i[t-1])||n?void 0:{};e[o];return function(e,t){if(null==e)return{};for(var i,r={},n=Object.keys(e),a=0;a<n.length;a++)i=n[a],0<=t.indexOf(i)||(r[i]=e[i]);return r}(e,[o].map(S))}var f=Number(o);if(null==e){var c=h(void 0,t+1,i,r,n);if(void 0===c)return;var v=[];return v[f]=c,v}if(!Array.isArray(e))throw new Error("Cannot set a numeric property on an object");var m=h(e[f],t+1,i,r,n),b=[].concat(e);if(n&&void 0===m){if(b.splice(f,1),0===b.length)return}else b[f]=m;return b}function w(e,t,i,r){if(void 0===r&&(r=!1),null==e)throw new Error("Cannot call setIn() with "+String(e)+" state");if(null==t)throw new Error("Cannot call setIn() with "+String(t)+" key");return h(e,0,o(t),i,r)}var L="FINAL_FORM/form-error",x="FINAL_FORM/array-error";function I(e,t){var i=e.errors,r=e.initialValues,n=e.lastSubmittedValues,a=e.submitErrors,o=e.submitFailed,u=e.submitSucceeded,s=e.submitting,d=e.values,l=t.active,f=t.blur,c=t.change,v=t.data,m=t.focus,b=t.modified,S=t.modifiedSinceLastSubmit,h=t.name,g=t.touched,y=t.validating,p=t.visited,E=A(d,h),F=A(i,h);F&&F[x]&&(F=F[x]);var O=a&&A(a,h),V=r&&A(r,h),j=t.isEqual(V,E),k=!F&&!O;return{active:l,blur:f,change:c,data:v,dirty:!j,dirtySinceLastSubmit:!(!n||t.isEqual(A(n,h),E)),error:F,focus:m,initial:V,invalid:!k,length:Array.isArray(E)?E.length:void 0,modified:b,modifiedSinceLastSubmit:S,name:h,pristine:j,submitError:O,submitFailed:o,submitSucceeded:u,submitting:s,touched:g,valid:k,value:E,visited:p,validating:y}}var a=["active","data","dirty","dirtySinceLastSubmit","error","initial","invalid","length","modified","modifiedSinceLastSubmit","pristine","submitError","submitFailed","submitSucceeded","submitting","touched","valid","value","visited","validating"],P=function(e,t){if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(var n=Object.prototype.hasOwnProperty.bind(t),a=0;a<i.length;a++){var o=i[a];if(!n(o)||e[o]!==t[o])return!1}return!0};function u(t,i,r,n,e,a){var o=!1;return e.forEach(function(e){n[e]&&(t[e]=i[e],r&&(~a.indexOf(e)?P(i[e],r[e]):i[e]===r[e])||(o=!0))}),o}function p(e,t,i,r){var n={blur:e.blur,change:e.change,focus:e.focus,name:e.name};return u(n,e,t,i,a,s)||!t||r?n:void 0}var s=["data"],d=["active","dirty","dirtyFields","dirtyFieldsSinceLastSubmit","dirtySinceLastSubmit","error","errors","hasSubmitErrors","hasValidationErrors","initialValues","invalid","modified","modifiedSinceLastSubmit","pristine","submitting","submitError","submitErrors","submitFailed","submitSucceeded","touched","valid","validating","values","visited"],l=["touched","visited"];function q(e,t,i,r){var n={};return u(n,e,t,i,d,l)||!t||r?n:void 0}function z(r){var n,a;return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n&&t.length===n.length&&!t.some(function(e,t){return!P(n[t],e)})||(n=t,a=r.apply(void 0,t)),a}}function C(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function _(e,t){return e===t}var U=function i(r){return Object.keys(r).some(function(e){var t=r[e];return!t||"object"!=typeof t||t instanceof Error?void 0!==t:i(t)})};function B(e,t,i,r,n,a){var o=n(i,r,t,a);return o&&(e(o),1)}function M(e,a,o,u,s){var d=e.entries;Object.keys(d).forEach(function(e){var t,i,r,n=d[Number(e)];n&&(t=n.subscription,i=n.subscriber,r=n.notified,B(i,t,a,o,u,s||!r)&&(n.notified=!0))})}e.ARRAY_ERROR=x,e.FORM_ERROR=L,e.configOptions=["debug","initialValues","keepDirtyOnReinitialize","mutators","onSubmit","validate","validateOnBlur"],e.createForm=function(e){if(!e)throw new Error("No config specified");e.debug;var s=e.destroyOnUnregister,o=e.keepDirtyOnReinitialize,t=e.initialValues,u=e.mutators,d=e.onSubmit,E=e.validate,a=e.validateOnBlur;if(!d)throw new Error("No onSubmit function specified");function l(e,t,i){var r=i(A(e.formState.values,t));e.formState.values=w(e.formState.values,t,r)||{}}function f(e,t,i){var r,n,a;e.fields[t]&&(e.fields=R({},e.fields,((r={})[i]=R({},e.fields[t],{name:i,blur:function(){return y.blur(i)},change:function(e){return y.change(i,e)},focus:function(){return y.focus(i)},lastFieldState:void 0}),r)),delete e.fields[t],e.fieldSubscribers=R({},e.fieldSubscribers,((n={})[i]=e.fieldSubscribers[t],n)),delete e.fieldSubscribers[t],a=A(e.formState.values,t),e.formState.values=w(e.formState.values,t,void 0)||{},e.formState.values=w(e.formState.values,i,a),delete e.lastFormState)}function i(a){return function(){if(u){for(var e={formState:N.formState,fields:N.fields,fieldSubscribers:N.fieldSubscribers,lastFormState:N.lastFormState},t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];var n=u[a](i,e,{changeValue:l,getIn:A,renameField:f,resetFieldState:y.resetFieldState,setIn:w,shallowEqual:P});return N.formState=e.formState,N.fields=e.fields,N.fieldSubscribers=e.fieldSubscribers,N.lastFormState=e.lastFormState,m(void 0,function(){b(),g()}),n}}}function F(r){return Object.keys(r.validators).reduce(function(e,t){var i=r.validators[Number(t)]();return i&&e.push(i),e},[])}function c(){Object.keys(N.fields).forEach(function(e){N.fields[e].touched=!0})}function v(){var e=N.fields,r=N.formState,t=N.lastFormState,n=R({},e),i=Object.keys(n),a=!1,o=i.reduce(function(e,t){return!n[t].isEqual(A(r.values,t),A(r.initialValues||{},t))&&(a=!0,e[t]=!0),e},{}),u=i.reduce(function(e,t){var i=r.lastSubmittedValues||{};return n[t].isEqual(A(r.values,t),A(i,t))||(e[t]=!0),e},{});r.pristine=!a,r.dirtySinceLastSubmit=!(!r.lastSubmittedValues||!Object.values(u).some(function(e){return e})),r.modifiedSinceLastSubmit=!(!r.lastSubmittedValues||!Object.keys(n).some(function(e){return n[e].modifiedSinceLastSubmit})),r.valid=!(r.error||r.submitError||U(r.errors)||r.submitErrors&&U(r.submitErrors));var s,d,l,f,c,v,m,b,S,h,g,y,p,E,F,O,V=(d=(s=r).active,l=s.dirtySinceLastSubmit,f=s.modifiedSinceLastSubmit,c=s.error,v=s.errors,m=s.initialValues,b=s.pristine,S=s.submitting,h=s.submitFailed,g=s.submitSucceeded,y=s.submitError,p=s.submitErrors,E=s.valid,F=s.validating,O=s.values,{active:d,dirty:!b,dirtySinceLastSubmit:l,modifiedSinceLastSubmit:f,error:c,errors:v,hasSubmitErrors:!!(y||p&&U(p)),hasValidationErrors:!(!c&&!U(v)),invalid:!E,initialValues:m,pristine:b,submitting:S,submitFailed:h,submitSucceeded:g,submitError:y,submitErrors:p,valid:E,validating:0<F,values:O}),j=i.reduce(function(e,t){return e.modified[t]=n[t].modified,e.touched[t]=n[t].touched,e.visited[t]=n[t].visited,e},{modified:{},touched:{},visited:{}}),k=j.modified,w=j.touched,L=j.visited;return V.dirtyFields=t&&P(t.dirtyFields,o)?t.dirtyFields:o,V.dirtyFieldsSinceLastSubmit=t&&P(t.dirtyFieldsSinceLastSubmit,u)?t.dirtyFieldsSinceLastSubmit:u,V.modified=t&&P(t.modified,k)?t.modified:k,V.touched=t&&P(t.touched,w)?t.touched:w,V.visited=t&&P(t.visited,L)?t.visited:L,t&&P(t,V)?t:V}var N={subscribers:{index:0,entries:{}},fieldSubscribers:{},fields:{},formState:{dirtySinceLastSubmit:!1,modifiedSinceLastSubmit:!1,errors:{},initialValues:t&&R({},t),invalid:!1,pristine:!0,submitting:!1,submitFailed:!1,submitSucceeded:!1,valid:!0,validating:0,values:t?R({},t):{}},lastFormState:void 0},r=0,O=!1,V=!1,j=0,k={},n=u?Object.keys(u).reduce(function(e,t){return e[t]=i(t),e},{}):{},m=function(e,t){if(O)return V=!0,void t();var u,i,r,s,d,n,a,o,l,f,c,v,m,b,S,h=N.fields,g=N.formState,y=R({},h),p=Object.keys(y);E||p.some(function(e){return F(y[e]).length})?(u=!1,e&&(!(i=y[e])||(r=i.validateFields)&&(u=!0,p=r.length?r.concat(e):[e])),s={},d={},f=0<(n=[].concat((a=function(e){s=e||{}},l=[],E&&(o=E(R({},N.formState.values)),C(o)?l.push(o.then(a)):a(o)),l),p.reduce(function(e,t){return e.concat((r=h[t],n=function(e){d[t]=e},o=[],(i=F(r)).length&&(i.forEach(function(e){var t,i=e(A(N.formState.values,r.name),N.formState.values,0===e.length||3===e.length?I(N.formState,N.fields[r.name]):void 0);i&&C(i)?(r.validating=!0,t=i.then(function(e){r.validating=!1,n(e)}),o.push(t)):a=a||i}),n(a)),o));var r,n,a,o,i},[]))).length,c=++j,v=Promise.all(n).then((m=c,function(e){return delete k[m],e})),f&&(k[c]=v),(b=function(){function e(a){p.forEach(function(e){var t,i,r,n;h[e]&&(t=A(s,e),i=A(o,e),r=F(y[e]).length,n=d[e],a(e,r&&n||E&&t||(t||u?void 0:i)))})}var o=R({},u?g.errors:{},s);e(function(e,t){o=w(o,e,t)||{}}),e(function(e,t){var i,r;t&&t[x]&&(i=A(o,e),(r=[].concat(i))[x]=t[x],o=w(o,e,r))}),P(g.errors,o)||(g.errors=o),g.error=s[L]})(),t(),f&&(N.formState.validating++,t(),S=function(){N.formState.validating--,t()},v.then(function(){c<j||b()}).then(S,S))):t()},b=function(e){var t,a,o,u,i;r||(t=N.fields,a=N.fieldSubscribers,o=N.formState,u=R({},t),i=function(e){var t=u[e],i=I(o,t),r=t.lastFieldState;t.lastFieldState=i;var n=a[e];n&&M(n,i,r,p,void 0===r)},e?i(e):Object.keys(u).forEach(i))},S=!1,h=!1,g=function e(){var t,i;S?h=!0:(S=!0,r||O||(t=N.lastFormState,(i=v())!==t&&(N.lastFormState=i,M(N.subscribers,i,t,q))),S=!1,h&&(h=!1,e()))};m(void 0,function(){g()});var y={batch:function(e){r++,e(),r--,b(),g()},blur:function(e){var t=N.fields,i=N.formState,r=t[e];r&&(delete i.active,t[e]=R({},r,{active:!1,touched:!0}),a?m(e,function(){b(),g()}):(b(),g()))},change:function(e,t){var i,r=N.fields,n=N.formState;A(n.values,e)!==t&&(l(N,e,function(){return t}),(i=r[e])&&(r[e]=R({},i,{modified:!0,modifiedSinceLastSubmit:!!n.lastSubmittedValues})),a?(b(),g()):m(e,function(){b(),g()}))},get destroyOnUnregister(){return!!s},set destroyOnUnregister(e){s=e},focus:function(e){var t=N.fields[e];t&&!t.active&&(N.formState.active=e,t.active=!0,t.visited=!0,b(),g())},mutators:n,getFieldState:function(e){var t=N.fields[e];return t&&t.lastFieldState},getRegisteredFields:function(){return Object.keys(N.fields)},getState:v,initialize:function(e){var t=N.fields,i=N.formState,r=R({},t),n="function"==typeof e?e(i.values):e;o||(i.values=n);var a=o?Object.keys(r).reduce(function(e,t){return r[t].isEqual(A(i.values,t),A(i.initialValues||{},t))||(e[t]=A(i.values,t)),e},{}):{};i.initialValues=n,i.values=n,Object.keys(a).forEach(function(e){i.values=w(i.values,e,a[e])}),m(void 0,function(){b(),g()})},isValidationPaused:function(){return O},pauseValidation:function(){O=!0},registerField:function(i,e,t,r){void 0===t&&(t={}),N.fieldSubscribers[i]||(N.fieldSubscribers[i]={index:0,entries:{}});var n=N.fieldSubscribers[i].index++;N.fieldSubscribers[i].entries[n]={subscriber:z(e),subscription:t,notified:!1},N.fields[i]||(N.fields[i]={active:!1,afterSubmit:r&&r.afterSubmit,beforeSubmit:r&&r.beforeSubmit,blur:function(){return y.blur(i)},change:function(e){return y.change(i,e)},data:r&&r.data||{},focus:function(){return y.focus(i)},isEqual:r&&r.isEqual||_,lastFieldState:void 0,modified:!1,modifiedSinceLastSubmit:!1,name:i,touched:!1,valid:!0,validateFields:r&&r.validateFields,validators:{},validating:!1,visited:!1});function a(){u?b(i):(g(),b())}var o=!1,u=r&&r.silent;return r&&(o=!(!r.getValidator||!r.getValidator()),r.getValidator&&(N.fields[i].validators[n]=r.getValidator),void 0!==r.initialValue&&void 0===A(N.formState.values,i)&&(N.formState.initialValues=w(N.formState.initialValues||{},i,r.initialValue),N.formState.values=w(N.formState.values,i,r.initialValue),m(void 0,a)),void 0!==r.defaultValue&&void 0===r.initialValue&&void 0===A(N.formState.initialValues,i)&&(N.formState.values=w(N.formState.values,i,r.defaultValue))),o?m(void 0,a):a(),function(){var e=!1;N.fields[i]&&(e=!(!N.fields[i].validators[n]||!N.fields[i].validators[n]()),delete N.fields[i].validators[n]),delete N.fieldSubscribers[i].entries[n];var t=!Object.keys(N.fieldSubscribers[i].entries).length;t&&(delete N.fieldSubscribers[i],delete N.fields[i],e&&(N.formState.errors=w(N.formState.errors,i,void 0)||{}),s&&(N.formState.values=w(N.formState.values,i,void 0,!0)||{})),u||(e?m(void 0,function(){g(),b()}):t&&g())}},reset:function(e){if(void 0===e&&(e=N.formState.initialValues),N.formState.submitting)throw Error("Cannot reset() in onSubmit(), use setTimeout(form.reset)");N.formState.submitFailed=!1,N.formState.submitSucceeded=!1,delete N.formState.submitError,delete N.formState.submitErrors,delete N.formState.lastSubmittedValues,y.initialize(e||{})},resetFieldState:function(e){N.fields[e]=R({},N.fields[e],{active:!1,lastFieldState:void 0,modified:!1,touched:!1,valid:!0,validating:!1,visited:!1}),m(void 0,function(){b(),g()})},restart:function(t){void 0===t&&(t=N.formState.initialValues),y.batch(function(){for(var e in N.fields)y.resetFieldState(e),N.fields[e]=R({},N.fields[e],{active:!1,lastFieldState:void 0,modified:!1,modifiedSinceLastSubmit:!1,touched:!1,valid:!0,validating:!1,visited:!1});y.reset(t)})},resumeValidation:function(){O=!1,V&&m(void 0,function(){b(),g()}),V=!1},setConfig:function(e,t){switch(e){case"debug":0;break;case"destroyOnUnregister":s=t;break;case"initialValues":y.initialize(t);break;case"keepDirtyOnReinitialize":o=t;break;case"mutators":(u=t)?(Object.keys(n).forEach(function(e){e in t||delete n[e]}),Object.keys(t).forEach(function(e){n[e]=i(e)})):Object.keys(n).forEach(function(e){delete n[e]});break;case"onSubmit":d=t;break;case"validate":E=t,m(void 0,function(){b(),g()});break;case"validateOnBlur":a=t;break;default:throw new Error("Unrecognised option "+e)}},submit:function(){var t=N.formState;if(!t.submitting){if(delete t.submitErrors,delete t.submitError,t.lastSubmittedValues=R({},t.values),N.formState.error||U(N.formState.errors))return c(),N.formState.submitFailed=!0,g(),void b();var e=Object.keys(k);if(e.length)Promise.all(e.map(function(e){return k[Number(e)]})).then(y.submit,console.error);else if(!Object.keys(N.fields).some(function(e){return N.fields[e].beforeSubmit&&!1===N.fields[e].beforeSubmit()})){var i,r=!1,n=function(e){return t.submitting=!1,e&&U(e)?(t.submitFailed=!0,t.submitSucceeded=!1,t.submitErrors=e,t.submitError=e[L],c()):(t.submitFailed=!1,t.submitSucceeded=!0,Object.keys(N.fields).forEach(function(e){return N.fields[e].afterSubmit&&N.fields[e].afterSubmit()})),g(),b(),r=!0,i&&i(e),e};t.submitting=!0,t.submitFailed=!1,t.submitSucceeded=!1,t.lastSubmittedValues=R({},t.values),Object.keys(N.fields).forEach(function(e){return N.fields[e].modifiedSinceLastSubmit=!1});var a=d(t.values,y,n);if(!r){if(a&&C(a))return g(),b(),a.then(n,function(e){throw n(),e});if(3<=d.length)return g(),b(),new Promise(function(e){i=e});n(a)}}}},subscribe:function(e,t){if(!e)throw new Error("No callback given.");if(!t)throw new Error("No subscription provided. What values do you want to listen to?");var i=z(e),r=N.subscribers,n=r.index++;r.entries[n]={subscriber:i,subscription:t,notified:!1};var a=v();return B(i,t,a,a,q,!0),function(){delete r.entries[n]}}};return y},e.fieldSubscriptionItems=a,e.formSubscriptionItems=d,e.getIn=A,e.setIn=w,e.version="4.20.1",Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["final-form"]={})}(this,function(e){"use strict";function R(){return(R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(this,arguments)}function u(e){if(null==e||!e.length)return[];if("string"!=typeof e)throw new Error("toPath() expects a string");return null==t[e]&&(t[e]=e.split(i).filter(Boolean)),t[e]}var t={},i=/[.[\]]+/,A=function(e,t){for(var i=u(t),r=e,n=0;n<i.length;n++){var a=i[n];if(null==r||"object"!=typeof r||Array.isArray(r)&&isNaN(a))return;r=r[a]}return r};function S(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof t?t:String(t)}function h(e,t,i,r,n){if(t>=i.length)return r;var a=i[t];if(isNaN(a)){var u;if(null==e){var o,s=h(void 0,t+1,i,r,n);return void 0===s?void 0:((o={})[a]=s,o)}if(Array.isArray(e))throw new Error("Cannot set a non-numeric property on an array");var d=h(e[a],t+1,i,r,n);if(void 0!==d)return R({},e,((u={})[a]=d,u));var l=Object.keys(e).length;if(void 0===e[a]&&0===l)return;if(void 0!==e[a]&&l<=1)return isNaN(i[t-1])||n?void 0:{};e[a];return function(e,t){if(null==e)return{};var i,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)i=a[r],0<=t.indexOf(i)||(n[i]=e[i]);return n}(e,[a].map(S))}var f=Number(a);if(null==e){var c=h(void 0,t+1,i,r,n);if(void 0===c)return;var v=[];return v[f]=c,v}if(!Array.isArray(e))throw new Error("Cannot set a numeric property on an object");var m=h(e[f],t+1,i,r,n),b=[].concat(e);if(n&&void 0===m){if(b.splice(f,1),0===b.length)return}else b[f]=m;return b}function w(e,t,i,r){if(void 0===r&&(r=!1),null==e)throw new Error("Cannot call setIn() with "+String(e)+" state");if(null==t)throw new Error("Cannot call setIn() with "+String(t)+" key");return h(e,0,u(t),i,r)}var L="FINAL_FORM/form-error",x="FINAL_FORM/array-error";function I(e,t){var i=e.errors,r=e.initialValues,n=e.lastSubmittedValues,a=e.submitErrors,u=e.submitFailed,o=e.submitSucceeded,s=e.submitting,d=e.values,l=t.active,f=t.blur,c=t.change,v=t.data,m=t.focus,b=t.modified,S=t.modifiedSinceLastSubmit,h=t.name,g=t.touched,y=t.validating,p=t.visited,E=A(d,h),F=A(i,h);F&&F[x]&&(F=F[x]);var O=a&&A(a,h),V=r&&A(r,h),j=t.isEqual(V,E),k=!F&&!O;return{active:l,blur:f,change:c,data:v,dirty:!j,dirtySinceLastSubmit:!(!n||t.isEqual(A(n,h),E)),error:F,focus:m,initial:V,invalid:!k,length:Array.isArray(E)?E.length:void 0,modified:b,modifiedSinceLastSubmit:S,name:h,pristine:j,submitError:O,submitFailed:u,submitSucceeded:o,submitting:s,touched:g,valid:k,value:E,visited:p,validating:y}}var a=["active","data","dirty","dirtySinceLastSubmit","error","initial","invalid","length","modified","modifiedSinceLastSubmit","pristine","submitError","submitFailed","submitSucceeded","submitting","touched","valid","value","visited","validating"],P=function(e,t){if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(var n=Object.prototype.hasOwnProperty.bind(t),a=0;a<i.length;a++){var u=i[a];if(!n(u)||e[u]!==t[u])return!1}return!0};function o(t,i,r,n,e,a){var u=!1;return e.forEach(function(e){n[e]&&(t[e]=i[e],r&&(~a.indexOf(e)?P(i[e],r[e]):i[e]===r[e])||(u=!0))}),u}function q(e,t,i,r){var n={blur:e.blur,change:e.change,focus:e.focus,name:e.name};return o(n,e,t,i,a,s)||!t||r?n:void 0}var s=["data"],d=["active","dirty","dirtyFields","dirtyFieldsSinceLastSubmit","dirtySinceLastSubmit","error","errors","hasSubmitErrors","hasValidationErrors","initialValues","invalid","modified","modifiedSinceLastSubmit","pristine","submitting","submitError","submitErrors","submitFailed","submitSucceeded","touched","valid","validating","values","visited"],l=["touched","visited"];function z(e,t,i,r){var n={};return o(n,e,t,i,d,l)||!t||r?n:void 0}function _(r){var n,a;return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n&&t.length===n.length&&!t.some(function(e,t){return!P(n[t],e)})||(n=t,a=r.apply(void 0,t)),a}}function C(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function U(e,t){return e===t}var W=function i(r){return Object.keys(r).some(function(e){var t=r[e];return!t||"object"!=typeof t||t instanceof Error?void 0!==t:i(t)})};function B(e,t,i,r,n,a){var u=n(i,r,t,a);return u&&(e(u),1)}function M(e,a,u,o,s){var d=e.entries;Object.keys(d).forEach(function(e){var t=d[Number(e)];if(t){var i=t.subscription,r=t.subscriber,n=t.notified;B(r,i,a,u,o,s||!n)&&(t.notified=!0)}})}e.ARRAY_ERROR=x,e.FORM_ERROR=L,e.configOptions=["debug","initialValues","keepDirtyOnReinitialize","mutators","onSubmit","validate","validateOnBlur"],e.createForm=function(e){if(!e)throw new Error("No config specified");e.debug;var d=e.destroyOnUnregister,u=e.keepDirtyOnReinitialize,t=e.initialValues,o=e.mutators,s=e.onSubmit,g=e.validate,a=e.validateOnBlur;if(!s)throw new Error("No onSubmit function specified");function l(e,t,i){var r=i(A(e.formState.values,t));e.formState.values=w(e.formState.values,t,r)||{}}function f(e,t,i){if(e.fields[t]){var r,n;e.fields=R({},e.fields,((r={})[i]=R({},e.fields[t],{name:i,blur:function(){return k.blur(i)},change:function(e){return k.change(i,e)},focus:function(){return k.focus(i)},lastFieldState:void 0}),r)),delete e.fields[t],e.fieldSubscribers=R({},e.fieldSubscribers,((n={})[i]=e.fieldSubscribers[t],n)),delete e.fieldSubscribers[t];var a=A(e.formState.values,t);e.formState.values=w(e.formState.values,t,void 0)||{},e.formState.values=w(e.formState.values,i,a),delete e.lastFormState}}function i(a){return function(){if(o){for(var e={formState:N.formState,fields:N.fields,fieldSubscribers:N.fieldSubscribers,lastFormState:N.lastFormState},t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];var n=o[a](i,e,{changeValue:l,getIn:A,renameField:f,resetFieldState:k.resetFieldState,setIn:w,shallowEqual:P});return N.formState=e.formState,N.fields=e.fields,N.fieldSubscribers=e.fieldSubscribers,N.lastFormState=e.lastFormState,b(void 0,function(){S(),j()}),n}}}function y(r){return Object.keys(r.validators).reduce(function(e,t){var i=r.validators[Number(t)]();return i&&e.push(i),e},[])}function c(){Object.keys(N.fields).forEach(function(e){N.fields[e].touched=!0})}function v(){var e=N.fields,r=N.formState,t=N.lastFormState,n=R({},e),i=Object.keys(n),a=!1,u=i.reduce(function(e,t){return!n[t].isEqual(A(r.values,t),A(r.initialValues||{},t))&&(a=!0,e[t]=!0),e},{}),o=i.reduce(function(e,t){var i=r.lastSubmittedValues||{};return n[t].isEqual(A(r.values,t),A(i,t))||(e[t]=!0),e},{});r.pristine=!a,r.dirtySinceLastSubmit=!(!r.lastSubmittedValues||!Object.values(o).some(function(e){return e})),r.modifiedSinceLastSubmit=!(!r.lastSubmittedValues||!Object.keys(n).some(function(e){return n[e].modifiedSinceLastSubmit})),r.valid=!(r.error||r.submitError||W(r.errors)||r.submitErrors&&W(r.submitErrors));var s,d,l,f,c,v,m,b,S,h,g,y,p,E,F,O,V=(d=(s=r).active,l=s.dirtySinceLastSubmit,f=s.modifiedSinceLastSubmit,c=s.error,v=s.errors,m=s.initialValues,b=s.pristine,S=s.submitting,h=s.submitFailed,g=s.submitSucceeded,y=s.submitError,p=s.submitErrors,E=s.valid,F=s.validating,O=s.values,{active:d,dirty:!b,dirtySinceLastSubmit:l,modifiedSinceLastSubmit:f,error:c,errors:v,hasSubmitErrors:!!(y||p&&W(p)),hasValidationErrors:!(!c&&!W(v)),invalid:!E,initialValues:m,pristine:b,submitting:S,submitFailed:h,submitSucceeded:g,submitError:y,submitErrors:p,valid:E,validating:0<F,values:O}),j=i.reduce(function(e,t){return e.modified[t]=n[t].modified,e.touched[t]=n[t].touched,e.visited[t]=n[t].visited,e},{modified:{},touched:{},visited:{}}),k=j.modified,w=j.touched,L=j.visited;return V.dirtyFields=t&&P(t.dirtyFields,u)?t.dirtyFields:u,V.dirtyFieldsSinceLastSubmit=t&&P(t.dirtyFieldsSinceLastSubmit,o)?t.dirtyFieldsSinceLastSubmit:o,V.modified=t&&P(t.modified,k)?t.modified:k,V.touched=t&&P(t.touched,w)?t.touched:w,V.visited=t&&P(t.visited,L)?t.visited:L,t&&P(t,V)?t:V}var N={subscribers:{index:0,entries:{}},fieldSubscribers:{},fields:{},formState:{dirtySinceLastSubmit:!1,modifiedSinceLastSubmit:!1,errors:{},initialValues:t&&R({},t),invalid:!1,pristine:!0,submitting:!1,submitFailed:!1,submitSucceeded:!1,resetWhileSubmitting:!1,valid:!0,validating:0,values:t?R({},t):{}},lastFormState:void 0},r=0,p=!1,E=!1,n=!1,F=0,O={},m=o?Object.keys(o).reduce(function(e,t){return e[t]=i(t),e},{}):{},b=function(e,t){if(p)return E=!0,void t();var o=N.fields,i=N.formState,s=R({},o),r=Object.keys(s);if(g||r.some(function(e){return y(s[e]).length})){var d=!1;if(e){var n=s[e];if(n){var a=n.validateFields;a&&(d=!0,r=a.length?a.concat(e):[e])}}var u,l={},f={},c=[].concat(function(e){var t=[];if(g){var i=g(R({},N.formState.values));C(i)?t.push(i.then(e)):e(i)}return t}(function(e){l=e||{}}),r.reduce(function(e,t){return e.concat(function(r,n){var a,u=[],e=y(N.fields[r]);e.length&&(e.forEach(function(e){var t=e(A(N.formState.values,r),N.formState.values,0===e.length||3===e.length?I(N.formState,N.fields[r]):void 0);if(t&&C(t)){N.fields[r].validating=!0;var i=t.then(function(e){N.fields[r].validating=!1,n(e)});u.push(i)}else a=a||t}),n(a));return u}(t,function(e){f[t]=e}))},[])),v=0<c.length,m=++F,b=Promise.all(c).then((u=m,function(e){return delete O[u],e}));v&&(O[m]=b);var S=function(){function e(a){r.forEach(function(e){if(o[e]){var t=A(l,e),i=A(u,e),r=y(s[e]).length,n=f[e];a(e,r&&n||g&&t||(t||d?void 0:i))}})}var u=R({},d?i.errors:{},l);e(function(e,t){u=w(u,e,t)||{}}),e(function(e,t){if(t&&t[x]){var i=A(u,e),r=[].concat(i);r[x]=t[x],u=w(u,e,r)}}),P(i.errors,u)||(i.errors=u),i.error=l[L]};if(S(),t(),v){N.formState.validating++,t();var h=function(){N.formState.validating--,t()};b.then(function(){m<F||S()}).then(h,h)}}else t()},S=function(e){if(!r){var t=N.fields,a=N.fieldSubscribers,u=N.formState,o=R({},t),i=function(e){var t=o[e],i=I(u,t),r=t.lastFieldState;t.lastFieldState=i;var n=a[e];n&&M(n,i,r,q,void 0===r)};e?i(e):Object.keys(o).forEach(i)}},h=!1,V=!1,j=function e(){if(h)V=!0;else{if(h=!0,!(r||p&&n)){var t=N.lastFormState,i=v();i!==t&&(N.lastFormState=i,M(N.subscribers,i,t,z))}h=!1,V&&(V=!1,e())}};b(void 0,function(){j()});var k={batch:function(e){r++,e(),r--,S(),j()},blur:function(e){var t=N.fields,i=N.formState,r=t[e];r&&(delete i.active,t[e]=R({},r,{active:!1,touched:!0}),a?b(e,function(){S(),j()}):(S(),j()))},change:function(e,t){var i=N.fields,r=N.formState;if(A(r.values,e)!==t){l(N,e,function(){return t});var n=i[e];n&&(i[e]=R({},n,{modified:!0,modifiedSinceLastSubmit:!!r.lastSubmittedValues})),a?(S(),j()):b(e,function(){S(),j()})}},get destroyOnUnregister(){return!!d},set destroyOnUnregister(e){d=e},focus:function(e){var t=N.fields[e];t&&!t.active&&(N.formState.active=e,t.active=!0,t.visited=!0,S(),j())},mutators:m,getFieldState:function(e){var t=N.fields[e];return t&&t.lastFieldState},getRegisteredFields:function(){return Object.keys(N.fields)},getState:function(){return v()},initialize:function(e){var t=N.fields,i=N.formState,r=R({},t),n="function"==typeof e?e(i.values):e;u||(i.values=n);var a=u?Object.keys(r).reduce(function(e,t){return r[t].isEqual(A(i.values,t),A(i.initialValues||{},t))||(e[t]=A(i.values,t)),e},{}):{};i.initialValues=n,i.values=n,Object.keys(a).forEach(function(e){i.values=w(i.values,e,a[e])}),b(void 0,function(){S(),j()})},isValidationPaused:function(){return p},pauseValidation:function(e){void 0===e&&(e=!0),p=!0,n=e},registerField:function(r,e,t,i){void 0===t&&(t={}),N.fieldSubscribers[r]||(N.fieldSubscribers[r]={index:0,entries:{}});var n=N.fieldSubscribers[r].index++;N.fieldSubscribers[r].entries[n]={subscriber:_(e),subscription:t,notified:!1},N.fields[r]||(N.fields[r]={active:!1,afterSubmit:i&&i.afterSubmit,beforeSubmit:i&&i.beforeSubmit,blur:function(){return k.blur(r)},change:function(e){return k.change(r,e)},data:i&&i.data||{},focus:function(){return k.focus(r)},isEqual:i&&i.isEqual||U,lastFieldState:void 0,modified:!1,modifiedSinceLastSubmit:!1,name:r,touched:!1,valid:!0,validateFields:i&&i.validateFields,validators:{},validating:!1,visited:!1});function a(){o?S(r):(j(),S())}var u=!1,o=i&&i.silent;if(i){u=!(!i.getValidator||!i.getValidator()),i.getValidator&&(N.fields[r].validators[n]=i.getValidator);var s=void 0===A(N.formState.values,r);void 0===i.initialValue||!s||void 0!==A(N.formState.values,r)&&A(N.formState.values,r)!==A(N.formState.initialValues,r)||(N.formState.initialValues=w(N.formState.initialValues||{},r,i.initialValue),N.formState.values=w(N.formState.values,r,i.initialValue),b(void 0,a)),void 0!==i.defaultValue&&void 0===i.initialValue&&void 0===A(N.formState.initialValues,r)&&s&&(N.formState.values=w(N.formState.values,r,i.defaultValue))}return u?b(void 0,a):a(),function(){var e=!1;N.fields[r]&&(e=!(!N.fields[r].validators[n]||!N.fields[r].validators[n]()),delete N.fields[r].validators[n]);var t=!!N.fieldSubscribers[r];t&&delete N.fieldSubscribers[r].entries[n];var i=t&&!Object.keys(N.fieldSubscribers[r].entries).length;i&&(delete N.fieldSubscribers[r],delete N.fields[r],e&&(N.formState.errors=w(N.formState.errors,r,void 0)||{}),d&&(N.formState.values=w(N.formState.values,r,void 0,!0)||{})),o||(e?b(void 0,function(){j(),S()}):i&&j())}},reset:function(e){void 0===e&&(e=N.formState.initialValues),N.formState.submitting&&(N.formState.resetWhileSubmitting=!0),N.formState.submitFailed=!1,N.formState.submitSucceeded=!1,delete N.formState.submitError,delete N.formState.submitErrors,delete N.formState.lastSubmittedValues,k.initialize(e||{})},resetFieldState:function(e){N.fields[e]=R({},N.fields[e],{active:!1,lastFieldState:void 0,modified:!1,touched:!1,valid:!0,validating:!1,visited:!1}),b(void 0,function(){S(),j()})},restart:function(t){void 0===t&&(t=N.formState.initialValues),k.batch(function(){for(var e in N.fields)k.resetFieldState(e),N.fields[e]=R({},N.fields[e],{active:!1,lastFieldState:void 0,modified:!1,modifiedSinceLastSubmit:!1,touched:!1,valid:!0,validating:!1,visited:!1});k.reset(t)})},resumeValidation:function(){n=p=!1,E&&b(void 0,function(){S(),j()}),E=!1},setConfig:function(e,t){switch(e){case"debug":0;break;case"destroyOnUnregister":d=t;break;case"initialValues":k.initialize(t);break;case"keepDirtyOnReinitialize":u=t;break;case"mutators":(o=t)?(Object.keys(m).forEach(function(e){e in t||delete m[e]}),Object.keys(t).forEach(function(e){m[e]=i(e)})):Object.keys(m).forEach(function(e){delete m[e]});break;case"onSubmit":s=t;break;case"validate":g=t,b(void 0,function(){S(),j()});break;case"validateOnBlur":a=t;break;default:throw new Error("Unrecognised option "+e)}},submit:function(){var i=N.formState;if(!i.submitting){if(delete i.submitErrors,delete i.submitError,i.lastSubmittedValues=R({},i.values),N.formState.error||W(N.formState.errors))return c(),N.formState.submitFailed=!0,j(),void S();var e=Object.keys(O);if(e.length)Promise.all(e.map(function(e){return O[Number(e)]})).then(k.submit,console.error);else if(!Object.keys(N.fields).some(function(e){return N.fields[e].beforeSubmit&&!1===N.fields[e].beforeSubmit()})){var r,n=!1,t=function(e){i.submitting=!1;var t=i.resetWhileSubmitting;return t&&(i.resetWhileSubmitting=!1),e&&W(e)?(i.submitFailed=!0,i.submitSucceeded=!1,i.submitErrors=e,i.submitError=e[L],c()):(t||(i.submitFailed=!1,i.submitSucceeded=!0),Object.keys(N.fields).forEach(function(e){return N.fields[e].afterSubmit&&N.fields[e].afterSubmit()})),j(),S(),n=!0,r&&r(e),e};i.submitting=!0,i.submitFailed=!1,i.submitSucceeded=!1,i.lastSubmittedValues=R({},i.values),Object.keys(N.fields).forEach(function(e){return N.fields[e].modifiedSinceLastSubmit=!1});var a=s(i.values,k,t);if(!n){if(a&&C(a))return j(),S(),a.then(t,function(e){throw t(),e});if(3<=s.length)return j(),S(),new Promise(function(e){r=e});t(a)}}}},subscribe:function(e,t){if(!e)throw new Error("No callback given.");if(!t)throw new Error("No subscription provided. What values do you want to listen to?");var i=_(e),r=N.subscribers,n=r.index++;r.entries[n]={subscriber:i,subscription:t,notified:!1};var a=v();return B(i,t,a,a,z,!0),function(){delete r.entries[n]}}};return k},e.fieldSubscriptionItems=a,e.formSubscriptionItems=d,e.getIn=A,e.setIn=w,e.version="4.20.2",Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=final-form.umd.min.js.map

@@ -7,4 +7,4 @@ export type Subscription = { [key: string]: boolean }

}
export interface ValidationErrors extends AnyObject {}
export interface SubmissionErrors extends AnyObject {}
export type ValidationErrors = AnyObject | undefined
export type SubmissionErrors = AnyObject | undefined

@@ -191,2 +191,3 @@ export interface FormSubscription {

pristine: boolean
resetWhileSubmitting: boolean
submitError?: any

@@ -220,4 +221,5 @@ submitErrors?: object

registerField: RegisterField<FormValues>
reset: (initialValues?: FormValues) => void
reset: (initialValues?: InitialFormValues) => void
resetFieldState: (name: keyof FormValues) => void
restart: (initialValues?: FormValues) => void
resumeValidation: () => void

@@ -288,8 +290,7 @@ setConfig: <K extends ConfigKey>(

| SubmissionErrors
| Promise<SubmissionErrors | undefined>
| undefined
| Promise<SubmissionErrors>
| void
validate?: (
values: FormValues
) => ValidationErrors | Promise<ValidationErrors> | undefined
) => ValidationErrors | Promise<ValidationErrors>
validateOnBlur?: boolean

@@ -296,0 +297,0 @@ }

{
"name": "final-form",
"version": "4.20.1",
"version": "4.20.2",
"description": "🏁 Framework agnostic, high performance, subscription-based form state management",

@@ -100,7 +100,7 @@ "main": "dist/final-form.cjs.js",

"path": "dist/final-form.es.js",
"maxSize": "9.2kB"
"maxSize": "9.3kB"
},
{
"path": "dist/final-form.cjs.js",
"maxSize": "9.4kB"
"maxSize": "9.5kB"
}

@@ -107,0 +107,0 @@ ],

@@ -58,1 +58,3 @@ [<img src="form-nerd-logo.png" align="left"/>](https://formnerd.co/final-form-readme) **You build great forms, but do you know HOW users use your forms? [Find out with Form Nerd!](https://formnerd.co/final-form-readme) Professional analytics from the creator of Final Form.**

## [Who's using Final Form?](https://final-form.org/users)
<img src="https://static.scarf.sh/a.png?x-pxid=40db3a4c-1187-4b9e-b363-c059774fe5e1" />

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc