text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","react","final-form"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["react-final-form"]={},e.React,e.FinalForm)}(this,function(e,E,h){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=t(E);function w(){return(w=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function O(e,t){if(null==e)return{};for(var n,r={},i=Object.keys(e),u=0;u<i.length;u++)n=i[u],0<=t.indexOf(n)||(r[n]=e[n]);return r}function F(e,t,n){var r=e.render,i=e.children,u=e.component,e=O(e,["render","children","component"]);if(u)return E.createElement(u,Object.assign(t,e,{children:i,render:r}));if(r)return r(void 0===i?Object.assign(t,e):Object.assign(t,e,{children:i}));if("function"!=typeof i)throw new Error("Must specify either a render prop, a render function as children, or a component prop to "+n);return i(Object.assign(t,e))}function V(e,t,n){void 0===n&&(n=function(e,t){return e===t});var r=S.default.useRef(e);S.default.useEffect(function(){n(e,r.current)||(t(),r.current=e)})}var C=function(e,t){if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var i=Object.prototype.hasOwnProperty.bind(t),u=0;u<n.length;u++){var a=n[u];if(!i(a)||e[a]!==t[a])return!1}return!0},j=function(e){return!(!e||"function"!=typeof e.stopPropagation)},k=E.createContext();function x(e){var t=S.default.useRef(e);return S.default.useEffect(function(){t.current=e}),t}function R(t,n,e){e.forEach(function(e){Object.defineProperty(t,e,{get:function(){return n[e]},enumerable:!0})})}var n="6.5.2",B=function(e,t){return R(e,t,["active","dirty","dirtyFields","dirtySinceLastSubmit","dirtyFieldsSinceLastSubmit","error","errors","hasSubmitErrors","hasValidationErrors","initialValues","invalid","modified","modifiedSinceLastSubmit","pristine","submitError","submitErrors","submitFailed","submitSucceeded","submitting","touched","valid","validating","values","visited"])},q={"final-form":h.version,"react-final-form":n},P=h.formSubscriptionItems.reduce(function(e,t){return e[t]=!0,e},{});function r(e){var t=e.debug,n=e.decorators,r=e.destroyOnUnregister,i=e.form,u=e.initialValues,a=e.initialValuesEqual,o=e.keepDirtyOnReinitialize,c=e.mutators,l=e.onSubmit,f=e.subscription,s=void 0===f?P:f,d=e.validate,v=e.validateOnBlur,m=O(e,["debug","decorators","destroyOnUnregister","form","initialValues","initialValuesEqual","keepDirtyOnReinitialize","mutators","onSubmit","subscription","validate","validateOnBlur"]),p={debug:t,destroyOnUnregister:r,initialValues:u,keepDirtyOnReinitialize:o,mutators:c,onSubmit:l,validate:d,validateOnBlur:v},b=(f=function(){var e=i||h.createForm(p);return e.pauseValidation(),e},(e=S.default.useRef()).current||(e.current=f()),e.current),f=E.useState(function(){var t={};return b.subscribe(function(e){t=e},s)(),t}),e=f[0],g=f[1],y=x(e);E.useEffect(function(){b.isValidationPaused()&&b.resumeValidation();var e=[b.subscribe(function(e){C(e,y.current)||g(e)},s)].concat(n?n.map(function(e){return e(b)}):[]);return function(){b.pauseValidation(),e.reverse().forEach(function(e){return e()})}},[n]),V(t,function(){b.setConfig("debug",t)}),V(r,function(){b.destroyOnUnregister=!!r}),V(o,function(){b.setConfig("keepDirtyOnReinitialize",o)}),V(u,function(){b.setConfig("initialValues",u)},a||C),V(c,function(){b.setConfig("mutators",c)}),V(l,function(){b.setConfig("onSubmit",l)}),V(d,function(){b.setConfig("validate",d)}),V(v,function(){b.setConfig("validateOnBlur",v)});a={form:w({},b,{reset:function(e){j(e)?b.reset():b.reset(e)}}),handleSubmit:function(e){return e&&("function"==typeof e.preventDefault&&e.preventDefault(),"function"==typeof e.stopPropagation&&e.stopPropagation()),b.submit()}};return B(a,e),E.createElement(k.Provider,{value:b},F(w({},m,{__versions:q}),a,"ReactFinalForm"))}function U(e){var t=E.useContext(k);if(!t)throw new Error((e||"useForm")+" must be used inside of a <Form> component");return t}function i(e){var t=void 0===e?{}:e,n=t.onChange,e=t.subscription,r=void 0===e?P:e,i=U("useFormState"),u=E.useRef(!0),a=E.useRef(n);a.current=n;var t=E.useState(function(){var t={};return i.subscribe(function(e){t=e},r)(),n&&n(t),t}),e=t[0],o=t[1];E.useEffect(function(){return i.subscribe(function(e){u.current?u.current=!1:(o(e),a.current&&a.current(e))},r)},[]);t={};return B(t,e),t}function u(e){var t=e.onChange,n=e.subscription,e=O(e,["onChange","subscription"]),r=U("FormSpy"),n=i({onChange:t,subscription:n});if(t)return null;t={form:w({},r,{reset:function(e){j(e)?r.reset():r.reset(e)}})};return F(w({},e,t),n,"FormSpy")}function A(e){return void 0===e?"":e}function D(e){return""===e?void 0:e}var L="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,N=h.fieldSubscriptionItems.reduce(function(e,t){return e[t]=!0,e},{});function z(r,e){void 0===e&&(e={});function n(e,t){return y.registerField(r,e,m,{afterSubmit:i,beforeSubmit:function(){var e=h.current,t=e.beforeSubmit,n=e.formatOnBlur,e=e.format;return!n||(e=(void 0===e?A:e)(n=y.getFieldState(r).value,r))!==n&&y.change(r,e),t&&t()},data:a,defaultValue:o,getValidator:function(){return h.current.validate},initialValue:s,isEqual:function(e,t){return(h.current.isEqual||function(e,t){return e===t})(e,t)},silent:t,validateFields:b})}var i=e.afterSubmit,t=e.allowNull,u=e.component,a=e.data,o=e.defaultValue,c=e.format,l=void 0===c?A:c,f=e.formatOnBlur,s=e.initialValue,d=e.multiple,c=e.parse,v=void 0===c?D:c,c=e.subscription,m=void 0===c?N:c,p=e.type,b=e.validateFields,g=e.value,y=U("useField"),h=x(e),S=E.useRef(!0),c=E.useState(function(){var t={},e=y.destroyOnUnregister;return y.destroyOnUnregister=!1,n(function(e){t=e},!0)(),y.destroyOnUnregister=e,t}),O=c[0],F=c[1];E.useEffect(function(){return n(function(e){S.current?S.current=!1:F(e)},!1)},[r,a,o,s]);e={onBlur:E.useCallback(function(e){var t;O.blur(),f&&(t=y.getFieldState(O.name),O.change(l(t.value,O.name)))},[O.blur,O.name,l,f]),onChange:E.useCallback(function(e){e=e&&e.target?function(e,t,n,r){if(!r&&e.nativeEvent&&void 0!==e.nativeEvent.text)return e.nativeEvent.text;if(r&&e.nativeEvent)return e.nativeEvent.text;var i=e.target,u=i.type,r=i.value,i=i.checked;switch(u){case"checkbox":if(void 0===n)return!!i;if(i)return Array.isArray(t)?t.concat(n):[n];if(!Array.isArray(t))return t;n=t.indexOf(n);return n<0?t:t.slice(0,n).concat(t.slice(n+1));case"select-multiple":return function(e){var t=[];if(e)for(var n=0;n<e.length;n++){var r=e[n];r.selected&&t.push(r.value)}return t}(e.target.options);default:return r}}(e,O.value,g,L):e;O.change(v(e,r))},[g,r,v,O.change,O.value,p]),onFocus:E.useCallback(function(e){O.focus()},[O.focus])},c={};R(c,O,["active","data","dirty","dirtySinceLastSubmit","error","initial","invalid","length","modified","modifiedSinceLastSubmit","pristine","submitError","submitFailed","submitSucceeded","submitting","touched","valid","validating","visited"]);e=w({name:r,get value(){var e=O.value;return f?"input"===u&&(e=A(e)):e=l(e,r),null!==e||t||(e=""),"checkbox"===p||"radio"===p?g:"select"===u&&d?e||[]:e},get checked(){var e=O.value;return"checkbox"===p?(e=l(e,r),void 0===g?!!e:!(!Array.isArray(e)||!~e.indexOf(g))):"radio"===p?l(e,r)===g:void 0}},e);return d&&(e.multiple=d),void 0!==p&&(e.type=p),{input:e,meta:c}}var a=E.forwardRef(function(e,t){var n=e.afterSubmit,r=e.allowNull,i=e.beforeSubmit,u=e.children,a=e.component,o=e.data,c=e.defaultValue,l=e.format,f=e.formatOnBlur,s=e.initialValue,d=e.isEqual,v=e.multiple,m=e.name,p=e.parse,b=e.subscription,g=e.type,y=e.validate,h=e.validateFields,S=e.value,e=O(e,["afterSubmit","allowNull","beforeSubmit","children","component","data","defaultValue","format","formatOnBlur","initialValue","isEqual","multiple","name","parse","subscription","type","validate","validateFields","value"]),S=z(m,{afterSubmit:n,allowNull:r,beforeSubmit:i,children:u,component:a,data:o,defaultValue:c,format:l,formatOnBlur:f,initialValue:s,isEqual:d,multiple:v,parse:p,subscription:b,type:g,validate:y,validateFields:h,value:S});if("function"==typeof u)return u(w({},S,e));if("string"==typeof a)return E.createElement(a,w({},S.input,{children:u,ref:t},e));if(!m)throw new Error("prop name cannot be undefined in <Field> component");return F(w({children:u,component:a,ref:t},e),S,"Field("+m+")")});e.Field=a,e.Form=r,e.FormSpy=u,e.useField=z,e.useForm=U,e.useFormState=i,e.version=n,e.withTypes=function(){return{Form:r,FormSpy:u}},Object.defineProperty(e,"__esModule",{value:!0})});
  //# sourceMappingURL=react-final-form.umd.min.js.map
  