@thecb/components 9.0.5 → 9.0.6-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -38608,52 +38608,44 @@ var TableHeading_styled = styled.th.withConfig({
38608
38608
  return extraStyles;
38609
38609
  });
38610
38610
 
38611
- const validatorToPredicate =
38612
- (validatorFn, emptyCase) =>
38613
- (value, ...rest) =>
38614
- value === '' ? emptyCase : validatorFn(value, ...rest);
38611
+ const validatorToPredicate = (validatorFn, emptyCase) => (
38612
+ value,
38613
+ ...rest
38614
+ ) => (value === "" ? emptyCase : validatorFn(value, ...rest));
38615
38615
 
38616
38616
  var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
38617
38617
 
38618
- function getDefaultExportFromCjs (x) {
38619
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
38620
- }
38621
-
38622
38618
  var dayjs_min = {exports: {}};
38623
38619
 
38624
38620
  (function (module, exports) {
38625
- !function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
38626
- } (dayjs_min));
38621
+ !function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else {var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
38622
+ }(dayjs_min));
38627
38623
 
38628
- var dayjs_minExports = dayjs_min.exports;
38629
- var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
38624
+ var dayjs = dayjs_min.exports;
38630
38625
 
38631
38626
  var customParseFormat$1 = {exports: {}};
38632
38627
 
38633
38628
  (function (module, exports) {
38634
- !function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return (e=+e)+(e>68?1900:2e3)};var a=function(e){return function(t){this[e]=+t;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],h=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},d={A:[i,function(e){this.afternoon=u(e,!1);}],a:[i,function(e){this.afternoon=u(e,!0);}],S:[/\d/,function(e){this.milliseconds=100*+e;}],SS:[n,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(e){var t=h("months"),n=(h("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(e){var t=h("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(e){this.year=s(e);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=s.length,f=0;f<a;f+=1){var h=s[f],u=d[h],c=u&&u[0],l=u&&u[1];s[f]=l?{regex:c,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,h=e.slice(r),u=o.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,s=e.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],h=!0===s[3],u=f||h,d=s[2];h&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(e,t,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var r=c(t)(e),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,h=r.seconds,u=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=h||0,g=u||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(e){return new Date("")}}(t,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,e);};}}));
38635
- } (customParseFormat$1));
38629
+ !function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^\s\d-_:/()]+/,o={},s=function(t){return (t=+t)+(t>68?1900:2e3)};var a=function(t){return function(e){this[t]=+e;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t);}],u=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},h=function(t,e){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(t.indexOf(r(i,0,e))>-1){n=i>12;break}}else n=t===(e?"pm":"PM");return n},d={A:[i,function(t){this.afternoon=h(t,!1);}],a:[i,function(t){this.afternoon=h(t,!0);}],S:[/\d/,function(t){this.milliseconds=100*+t;}],SS:[n,function(t){this.milliseconds=10*+t;}],SSS:[/\d{3}/,function(t){this.milliseconds=+t;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,"")===t&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(t){var e=u("months"),n=(u("monthsShort")||e.map((function(t){return t.substr(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(t){var e=u("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(t){this.year=s(t);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||i[r]||t[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),a=s.length,f=0;f<a;f+=1){var u=s[f],h=d[u],c=h&&h[0],l=h&&h[1];s[f]=l?{regex:c,parser:l}:u.replace(/^\[|\]$/g,"");}return function(t){for(var e={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,u=t.substr(r),h=o.exec(u)[0];f.call(e,h),t=t.replace(h,"");}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon;}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,i=r.parse;r.parse=function(t){var e=t.date,r=t.utc,s=t.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],u=!0===s[3],h=f||u,d=s[2];u&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(t,e,n){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=c(e)(t),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,u=r.seconds,h=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=u||0,g=h||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(t){return new Date("")}}(e,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),h&&e!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,t);};}}));
38630
+ }(customParseFormat$1));
38636
38631
 
38637
- var customParseFormatExports = customParseFormat$1.exports;
38638
- var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
38632
+ var customParseFormat = customParseFormat$1.exports;
38639
38633
 
38640
38634
  var isSameOrBefore$1 = {exports: {}};
38641
38635
 
38642
38636
  (function (module, exports) {
38643
- !function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
38644
- } (isSameOrBefore$1));
38637
+ !function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
38638
+ }(isSameOrBefore$1));
38645
38639
 
38646
- var isSameOrBeforeExports = isSameOrBefore$1.exports;
38647
- var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
38640
+ var isSameOrBefore = isSameOrBefore$1.exports;
38648
38641
 
38649
38642
  var isSameOrAfter$1 = {exports: {}};
38650
38643
 
38651
38644
  (function (module, exports) {
38652
- !function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
38653
- } (isSameOrAfter$1));
38645
+ !function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
38646
+ }(isSameOrAfter$1));
38654
38647
 
38655
- var isSameOrAfterExports = isSameOrAfter$1.exports;
38656
- var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
38648
+ var isSameOrAfter = isSameOrAfter$1.exports;
38657
38649
 
38658
38650
  /* eslint-disable no-unused-vars */
38659
38651
 
@@ -38669,24 +38661,24 @@ dayjs.extend(isSameOrAfter);
38669
38661
 
38670
38662
  let validatorFns = {};
38671
38663
 
38672
- const INCLUDED_IN = 'validator/INCLUDED_IN';
38673
- const INCLUDED_IN_ERROR = 'error/INCLUDED_IN';
38664
+ const INCLUDED_IN = "validator/INCLUDED_IN";
38665
+ const INCLUDED_IN_ERROR = "error/INCLUDED_IN";
38674
38666
  const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
38675
38667
  validatorFns[INCLUDED_IN] = (value, args, form) =>
38676
38668
  Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
38677
38669
 
38678
- const REQUIRED = 'validator/REQUIRED';
38679
- const REQUIRED_ERROR = 'error/REQUIRED';
38670
+ const REQUIRED = "validator/REQUIRED";
38671
+ const REQUIRED_ERROR = "error/REQUIRED";
38680
38672
  const required = createValidator(REQUIRED, REQUIRED_ERROR);
38681
- validatorFns[REQUIRED] = (value, args, form) => value !== '';
38673
+ validatorFns[REQUIRED] = (value, args, form) => value !== "";
38682
38674
 
38683
- const ONLY_INTEGERS = 'validator/ONLY_INTEGERS';
38684
- const ONLY_INTEGERS_ERROR = 'error/ONLY_INTEGERS';
38675
+ const ONLY_INTEGERS = "validator/ONLY_INTEGERS";
38676
+ const ONLY_INTEGERS_ERROR = "error/ONLY_INTEGERS";
38685
38677
  const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
38686
38678
  validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
38687
38679
 
38688
- const ONLY_NATURALS = 'validator/ONLY_NATURALS';
38689
- const ONLY_NATURALS_ERROR = 'error/ONLY_NATURALS';
38680
+ const ONLY_NATURALS = "validator/ONLY_NATURALS";
38681
+ const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
38690
38682
  const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
38691
38683
  validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
38692
38684
 
@@ -38699,8 +38691,8 @@ not tested as validation function
38699
38691
  to validate exp date instead use combo of:
38700
38692
  required(), hasLength(), isValidMonth(), dateAfterToday()
38701
38693
  */
38702
- const ONLY_EXPIRATION_DATE = 'validator/ONLY_EXPIRATION_DATE';
38703
- const ONLY_EXPIRATION_DATE_ERROR = 'error/ONLY_EXPIRATION_DATE';
38694
+ const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
38695
+ const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
38704
38696
  const onlyExpirationDate = createValidator(
38705
38697
  ONLY_EXPIRATION_DATE,
38706
38698
  ONLY_EXPIRATION_DATE_ERROR
@@ -38708,63 +38700,64 @@ const onlyExpirationDate = createValidator(
38708
38700
  validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
38709
38701
  /^(\d?\d?\/?\d?\d?)?$/.test(value);
38710
38702
 
38711
- const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
38712
- const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
38703
+ const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
38704
+ const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
38713
38705
  const numberLessThan = createValidator(
38714
38706
  NUMBER_LESS_THAN,
38715
38707
  NUMBER_LESS_THAN_ERROR
38716
38708
  );
38717
38709
  validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
38718
- if (value === '') {
38710
+ if (value === "") {
38719
38711
  return true;
38720
38712
  }
38721
38713
  return Number(value) < args[0];
38722
38714
  };
38723
38715
 
38724
- const NUMBER_LESS_THAN_OR_EQUAL_TO = 'validator/NUMBER_LESS_THAN_OR_EQUAL_TO';
38716
+ const NUMBER_LESS_THAN_OR_EQUAL_TO =
38717
+ "validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
38725
38718
  const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
38726
- 'error/NUMBER_LESS_THAN_OR_EQUAL_TO';
38719
+ "error/NUMBER_LESS_THAN_OR_EQUAL_TO";
38727
38720
  const numberLessThanOrEqualTo = createValidator(
38728
38721
  NUMBER_LESS_THAN_OR_EQUAL_TO,
38729
38722
  NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
38730
38723
  );
38731
38724
  validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
38732
- if (value === '') {
38725
+ if (value === "") {
38733
38726
  return true;
38734
38727
  }
38735
38728
  return Number(value) <= args[0];
38736
38729
  };
38737
38730
 
38738
- const NUMBER_GREATER_THAN = 'validator/NUMBER_GREATER_THAN';
38739
- const NUMBER_GREATER_THAN_ERROR = 'error/NUMBER_GREATER_THAN';
38731
+ const NUMBER_GREATER_THAN = "validator/NUMBER_GREATER_THAN";
38732
+ const NUMBER_GREATER_THAN_ERROR = "error/NUMBER_GREATER_THAN";
38740
38733
  const numberGreaterThan = createValidator(
38741
38734
  NUMBER_GREATER_THAN,
38742
38735
  NUMBER_GREATER_THAN_ERROR
38743
38736
  );
38744
38737
  validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
38745
- if (value === '') {
38738
+ if (value === "") {
38746
38739
  return true;
38747
38740
  }
38748
38741
  return Number(value) > args[0];
38749
38742
  };
38750
38743
 
38751
38744
  const NUMBER_GREATER_THAN_OR_EQUAL_TO =
38752
- 'validator/NUMBER_GREATER_THAN_OR_EQUAL_TO';
38745
+ "validator/NUMBER_GREATER_THAN_OR_EQUAL_TO";
38753
38746
  const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
38754
- 'error/NUMBER_GREATER_THAN_OR_EQUAL_TO';
38747
+ "error/NUMBER_GREATER_THAN_OR_EQUAL_TO";
38755
38748
  const numberGreaterThanOrEqualTo = createValidator(
38756
38749
  NUMBER_GREATER_THAN_OR_EQUAL_TO,
38757
38750
  NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
38758
38751
  );
38759
38752
  validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
38760
- if (value === '') {
38753
+ if (value === "") {
38761
38754
  return true;
38762
38755
  }
38763
38756
  return Number(value) >= args[0];
38764
38757
  };
38765
38758
 
38766
- const MATCHES_FIELD = 'validator/MATCHES_FIELD';
38767
- const MATCHES_FIELD_ERROR$1 = 'error/MATCHES_FIELD';
38759
+ const MATCHES_FIELD = "validator/MATCHES_FIELD";
38760
+ const MATCHES_FIELD_ERROR$1 = "error/MATCHES_FIELD";
38768
38761
  const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
38769
38762
  validatorFns[MATCHES_FIELD] = (value, args, form) => {
38770
38763
  const dependentField = form[args[0]];
@@ -38777,7 +38770,7 @@ validatorFns[MATCHES_FIELD] = (value, args, form) => {
38777
38770
  return value === dependentFieldValue;
38778
38771
  };
38779
38772
 
38780
- const validateWhenErrorMessage = (type) =>
38773
+ const validateWhenErrorMessage = type =>
38781
38774
  `${type} was passed to validateWhen, but that validator type does not exist.
38782
38775
  Please check that you are only calling validator creator functions exported from
38783
38776
  redux-freeform in your form config and that you didn't forget to
@@ -38785,21 +38778,25 @@ const validateWhenErrorMessage = (type) =>
38785
38778
  createFormState). Also make sure you aren't passing validateWhen() to validateWhen
38786
38779
  as the primary validator.`;
38787
38780
 
38788
- const VALIDATE_WHEN = 'validator/VALIDATE_WHEN';
38789
- const VALIDATE_WHEN_ERROR = 'error/VALIDATE_WHEN';
38790
- const validateWhen = (dependentValidator, primaryValidator, optionalFieldName) => ({
38781
+ const VALIDATE_WHEN = "validator/VALIDATE_WHEN";
38782
+ const VALIDATE_WHEN_ERROR = "error/VALIDATE_WHEN";
38783
+ const validateWhen = (
38784
+ dependentValidator,
38785
+ primaryValidator,
38786
+ optionalFieldName
38787
+ ) => ({
38791
38788
  type: VALIDATE_WHEN,
38792
38789
  args: [dependentValidator, primaryValidator, optionalFieldName],
38793
- error: dependentValidator.error,
38790
+ error: dependentValidator.error
38794
38791
  });
38795
38792
  validateWhen.error = VALIDATE_WHEN_ERROR;
38796
38793
  validatorFns[VALIDATE_WHEN] = (value, args, form) => {
38797
38794
  const [dependentValidator, primaryValidator, optionalFieldName] = args;
38798
- const dependsOnOtherField = typeof optionalFieldName === 'string';
38795
+ const dependsOnOtherField = typeof optionalFieldName === "string";
38799
38796
 
38800
38797
  if (
38801
38798
  primaryValidator.type === undefined ||
38802
- typeof validatorFns[primaryValidator.type] !== 'function'
38799
+ typeof validatorFns[primaryValidator.type] !== "function"
38803
38800
  ) {
38804
38801
  throw new Error(validateWhenErrorMessage(primaryValidator.type));
38805
38802
  }
@@ -38823,22 +38820,26 @@ validatorFns[VALIDATE_WHEN] = (value, args, form) => {
38823
38820
  );
38824
38821
 
38825
38822
  return primaryPredicatePassed
38826
- ? validatorFns[dependentValidator.type](value, dependentValidator.args, form)
38823
+ ? validatorFns[dependentValidator.type](
38824
+ value,
38825
+ dependentValidator.args,
38826
+ form
38827
+ )
38827
38828
  : true;
38828
38829
  };
38829
38830
 
38830
- const validateSumErrorMessage = (type) =>
38831
+ const validateSumErrorMessage = type =>
38831
38832
  `${type} was passed to validateSum, but that validator type does not exist.
38832
38833
  Please check that you are only calling validator creator functions exported from
38833
38834
  redux-freeform in your form config and that you didn't forget to
38834
38835
  invoke the validator creator (you cannot pass the functions themselves to
38835
38836
  createFormState).`;
38836
- const VALIDATE_SUM = 'validator/VALIDATE_SUM';
38837
- const VALIDATE_SUM_ERROR = 'error/VALIDATE_SUM';
38837
+ const VALIDATE_SUM = "validator/VALIDATE_SUM";
38838
+ const VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
38838
38839
  const validateSum = (validator, fieldNamesArray) => ({
38839
38840
  type: VALIDATE_SUM,
38840
38841
  args: [validator, fieldNamesArray],
38841
- error: validator.error,
38842
+ error: validator.error
38842
38843
  });
38843
38844
  validateSum.error = VALIDATE_SUM_ERROR;
38844
38845
  validatorFns[VALIDATE_SUM] = (value, args, form) => {
@@ -38846,7 +38847,7 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
38846
38847
 
38847
38848
  if (
38848
38849
  validator.type === undefined ||
38849
- typeof validatorFns[validator.type] !== 'function'
38850
+ typeof validatorFns[validator.type] !== "function"
38850
38851
  ) {
38851
38852
  throw new Error(validateSumErrorMessage(validator.type));
38852
38853
  }
@@ -38867,35 +38868,37 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
38867
38868
  return validatorFns[validator.type](sum, validator.args, form);
38868
38869
  };
38869
38870
 
38870
- const HAS_LENGTH = 'validator/HAS_LENGTH';
38871
- const HAS_LENGTH_ERROR = 'error/HAS_LENGTH';
38871
+ const HAS_LENGTH = "validator/HAS_LENGTH";
38872
+ const HAS_LENGTH_ERROR = "error/HAS_LENGTH";
38872
38873
  const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
38873
38874
  validatorFns[HAS_LENGTH] = (value, args, form) => {
38874
- if (value === '') {
38875
+ if (value === "") {
38875
38876
  return true;
38876
38877
  }
38877
38878
  const min = args[0];
38878
38879
  const max = args[1];
38879
38880
  if (max == undefined || min == undefined) {
38880
38881
  throw new Error(
38881
- 'Max and min need to be defined for hasLength, both or one of them is undefined'
38882
+ "Max and min need to be defined for hasLength, both or one of them is undefined"
38882
38883
  );
38883
38884
  }
38884
38885
  if (max < min) {
38885
- throw new Error('hasLength validator was passed a min greater than the max');
38886
+ throw new Error(
38887
+ "hasLength validator was passed a min greater than the max"
38888
+ );
38886
38889
  }
38887
38890
  const valueLength = value.length;
38888
38891
  return max >= valueLength && valueLength >= min;
38889
38892
  };
38890
38893
 
38891
- const DATE_BEFORE_TODAY = 'validator/DATE_BEFORE_TODAY';
38892
- const DATE_BEFORE_TODAY_ERROR = 'error/DATE_BEFORE_TODAY';
38894
+ const DATE_BEFORE_TODAY = "validator/DATE_BEFORE_TODAY";
38895
+ const DATE_BEFORE_TODAY_ERROR = "error/DATE_BEFORE_TODAY";
38893
38896
  const dateBeforeToday = createValidator(
38894
38897
  DATE_BEFORE_TODAY,
38895
38898
  DATE_BEFORE_TODAY_ERROR
38896
38899
  );
38897
38900
  validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38898
- if (value === '') {
38901
+ if (value === "") {
38899
38902
  return true;
38900
38903
  }
38901
38904
  const dateFormat = args[0];
@@ -38904,7 +38907,7 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38904
38907
 
38905
38908
  if (dateFormat == undefined || unit == undefined) {
38906
38909
  throw new Error(
38907
- 'Date format and unit need to be defined for dateBeforeToday, one or both are undefined'
38910
+ "Date format and unit need to be defined for dateBeforeToday, one or both are undefined"
38908
38911
  );
38909
38912
  }
38910
38913
  const now = dayjs();
@@ -38916,14 +38919,14 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38916
38919
  return dateValue.isBefore(now, unit);
38917
38920
  };
38918
38921
 
38919
- const DATE_AFTER_TODAY = 'validator/DATE_AFTER_TODAY';
38920
- const DATE_AFTER_TODAY_ERROR = 'error/DATE_AFTER_TODAY';
38922
+ const DATE_AFTER_TODAY = "validator/DATE_AFTER_TODAY";
38923
+ const DATE_AFTER_TODAY_ERROR = "error/DATE_AFTER_TODAY";
38921
38924
  const dateAfterToday = createValidator(
38922
38925
  DATE_AFTER_TODAY,
38923
38926
  DATE_AFTER_TODAY_ERROR
38924
38927
  );
38925
38928
  validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38926
- if (value === '') {
38929
+ if (value === "") {
38927
38930
  return true;
38928
38931
  }
38929
38932
  const dateFormat = args[0];
@@ -38932,7 +38935,7 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38932
38935
 
38933
38936
  if (dateFormat == undefined || unit == undefined) {
38934
38937
  throw new Error(
38935
- 'Date format and unit need to be defined for dateAfterToday, one or both are undefined'
38938
+ "Date format and unit need to be defined for dateAfterToday, one or both are undefined"
38936
38939
  );
38937
38940
  }
38938
38941
  const now = dayjs();
@@ -38944,11 +38947,14 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38944
38947
  return dateValue.isAfter(now, unit);
38945
38948
  };
38946
38949
 
38947
- const IS_VALID_MONTH = 'validator/IS_VALID_MONTH';
38948
- const IS_VALID_MONTH_ERROR = 'error/IS_VALID_MONTH';
38949
- const isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
38950
+ const IS_VALID_MONTH = "validator/IS_VALID_MONTH";
38951
+ const IS_VALID_MONTH_ERROR = "error/IS_VALID_MONTH";
38952
+ const isValidMonth = createValidator(
38953
+ IS_VALID_MONTH,
38954
+ IS_VALID_MONTH_ERROR
38955
+ );
38950
38956
  validatorFns[IS_VALID_MONTH] = (value, args, form) => {
38951
- if (value === '') {
38957
+ if (value === "") {
38952
38958
  return true;
38953
38959
  }
38954
38960
  // Function takes one argument representing the character position
@@ -38958,43 +38964,43 @@ validatorFns[IS_VALID_MONTH] = (value, args, form) => {
38958
38964
  // Only works with two digit months (01, 02, 03, etc)
38959
38965
  const monthStartPosition = parseInt(args[0]);
38960
38966
  const monthEndPosition = monthStartPosition + 2;
38961
- if (isNaN(monthStartPosition)) {
38962
- throw new Error('Month start position has to be a valid integer string');
38967
+ if (monthStartPosition === NaN) {
38968
+ throw new Error("Month start position has to be a valid integer string");
38963
38969
  }
38964
38970
  const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
38965
- if (isNaN(month)) {
38971
+ if (month === NaN) {
38966
38972
  return false;
38967
38973
  }
38968
38974
  return month >= 1 && month <= 12;
38969
38975
  };
38970
38976
 
38971
- const MATCHES_REGEX = 'validator/MATCHES_REGEX';
38972
- const MATCHES_REGEX_ERROR = 'error/MATCHES_REGEX';
38977
+ const MATCHES_REGEX = "validator/MATCHES_REGEX";
38978
+ const MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
38973
38979
  const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
38974
38980
  validatorFns[MATCHES_REGEX] = (value, args, form) => {
38975
- if (value === '') {
38981
+ if (value === "") {
38976
38982
  return true;
38977
38983
  }
38978
38984
  return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
38979
38985
  };
38980
38986
 
38981
38987
  // based on http://www.brainjar.com/js/validation/
38982
- const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
38983
- const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
38988
+ const IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
38989
+ const IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
38984
38990
  const isRoutingNumber = createValidator(
38985
38991
  IS_ROUTING_NUMBER,
38986
38992
  IS_ROUTING_NUMBER_ERROR
38987
38993
  );
38988
38994
  validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
38989
- if (value === '') {
38995
+ if (value === "") {
38990
38996
  return true;
38991
38997
  }
38992
38998
  if (value.length != 9) {
38993
38999
  return false;
38994
39000
  }
38995
39001
  const sum = value
38996
- .split('')
38997
- .map((ch) => parseInt(ch))
39002
+ .split("")
39003
+ .map(ch => parseInt(ch))
38998
39004
  .reduce((acc, cur, idx) => {
38999
39005
  switch (idx % 3) {
39000
39006
  case 0:
@@ -39008,69 +39014,69 @@ validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
39008
39014
  return sum != 0 && sum % 10 == 0;
39009
39015
  };
39010
39016
 
39011
- const HAS_NUMBER = 'validator/HAS_NUMBER';
39012
- const HAS_NUMBER_ERROR$1 = 'error/HAS_NUMBER';
39017
+ const HAS_NUMBER = "validator/HAS_NUMBER";
39018
+ const HAS_NUMBER_ERROR$1 = "error/HAS_NUMBER";
39013
39019
  const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
39014
39020
  validatorFns[HAS_NUMBER] = (value, args, form) => {
39015
- if (value === '') {
39021
+ if (value === "") {
39016
39022
  return true;
39017
39023
  }
39018
39024
  return new RegExp(/[0-9]/).test(value);
39019
39025
  };
39020
39026
 
39021
- const HAS_LOWERCASE_LETTER = 'validator/HAS_LOWERCASE_LETTER';
39022
- const HAS_LOWERCASE_LETTER_ERROR$1 = 'error/HAS_LOWERCASE_LETTER';
39027
+ const HAS_LOWERCASE_LETTER = "validator/HAS_LOWERCASE_LETTER";
39028
+ const HAS_LOWERCASE_LETTER_ERROR$1 = "error/HAS_LOWERCASE_LETTER";
39023
39029
  const hasLowercaseLetter = createValidator(
39024
39030
  HAS_LOWERCASE_LETTER,
39025
39031
  HAS_LOWERCASE_LETTER_ERROR$1
39026
39032
  );
39027
39033
  validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
39028
- if (value === '') {
39034
+ if (value === "") {
39029
39035
  return true;
39030
39036
  }
39031
39037
  return new RegExp(/[a-z]/).test(value);
39032
39038
  };
39033
39039
 
39034
- const HAS_UPPERCASE_LETTER = 'validator/HAS_UPPERCASE_LETTER';
39035
- const HAS_UPPERCASE_LETTER_ERROR$1 = 'error/HAS_UPPERCASE_LETTER';
39040
+ const HAS_UPPERCASE_LETTER = "validator/HAS_UPPERCASE_LETTER";
39041
+ const HAS_UPPERCASE_LETTER_ERROR$1 = "error/HAS_UPPERCASE_LETTER";
39036
39042
  const hasUppercaseLetter = createValidator(
39037
39043
  HAS_UPPERCASE_LETTER,
39038
39044
  HAS_UPPERCASE_LETTER_ERROR$1
39039
39045
  );
39040
39046
  validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
39041
- if (value === '') {
39047
+ if (value === "") {
39042
39048
  return true;
39043
39049
  }
39044
39050
  return new RegExp(/[A-Z]/).test(value);
39045
39051
  };
39046
39052
 
39047
- const HAS_SPECIAL_CHARACTER = 'validator/HAS_SPECIAL_CHARACTER';
39048
- const HAS_SPECIAL_CHARACTER_ERROR$1 = 'error/HAS_SPECIAL_CHARACTER';
39053
+ const HAS_SPECIAL_CHARACTER = "validator/HAS_SPECIAL_CHARACTER";
39054
+ const HAS_SPECIAL_CHARACTER_ERROR$1 = "error/HAS_SPECIAL_CHARACTER";
39049
39055
  const hasSpecialCharacter = createValidator(
39050
39056
  HAS_SPECIAL_CHARACTER,
39051
39057
  HAS_SPECIAL_CHARACTER_ERROR$1
39052
39058
  );
39053
39059
  validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
39054
- if (value === '') {
39060
+ if (value === "") {
39055
39061
  return true;
39056
39062
  }
39057
39063
  return new RegExp(/[!@#$%^&*.?]/).test(value);
39058
39064
  };
39059
39065
 
39060
- const IS_PROBABLY_EMAIL = 'validator/IS_PROBABLY_EMAIL';
39061
- const IS_PROBABLY_EMAIL_ERROR = 'error/IS_PROBABLY_EMAIL';
39066
+ const IS_PROBABLY_EMAIL = "validator/IS_PROBABLY_EMAIL";
39067
+ const IS_PROBABLY_EMAIL_ERROR = "error/IS_PROBABLY_EMAIL";
39062
39068
  const isProbablyEmail = createValidator(
39063
39069
  IS_PROBABLY_EMAIL,
39064
39070
  IS_PROBABLY_EMAIL_ERROR
39065
39071
  );
39066
39072
  validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
39067
- if (value === '') {
39073
+ if (value === "") {
39068
39074
  return true;
39069
39075
  }
39070
39076
  return new RegExp(/^\S+@\S+\.\S+$/).test(value);
39071
39077
  };
39072
39078
 
39073
- const runValidatorErrorMessage = (type) =>
39079
+ const runValidatorErrorMessage = type =>
39074
39080
  `${type} was passed to runValidator, but that validator type does not exist.
39075
39081
  Please check that you are only calling validator creator functions exported from
39076
39082
  redux-freeform in your form config and that you didn't forget to
@@ -39085,53 +39091,1165 @@ const runValidator = (validator, value, form) => {
39085
39091
  return validatorFn(value, validator.args, form) ? null : validator.error;
39086
39092
  };
39087
39093
 
39088
- const runFormValidators = (fieldName, form, validators) => {
39094
+ const _computeErrors = (fieldName, form, validators) => {
39089
39095
  return validators
39090
- .map((v) => runValidator(v, form[fieldName].rawValue, form))
39091
- .filter((x) => x !== null);
39096
+ .map(v => runValidator(v, form[fieldName].rawValue, form))
39097
+ .filter(x => x !== null);
39092
39098
  };
39093
39099
 
39094
39100
  const computeConstraints = (fieldName, form) => {
39095
39101
  const constraints = form[fieldName].constraints;
39096
- return runFormValidators(fieldName, form, constraints);
39102
+ return _computeErrors(fieldName, form, constraints);
39097
39103
  };
39098
39104
 
39099
39105
  const computeErrors = (fieldName, form) => {
39100
39106
  const validators = form[fieldName].validators;
39101
- return runFormValidators(fieldName, form, validators);
39107
+ return _computeErrors(fieldName, form, validators);
39108
+ };
39109
+
39110
+ var obj;
39111
+ var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
39112
+ var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
39113
+ var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
39114
+ function isDraft(value) {
39115
+ return !!value && !!value[DRAFT_STATE];
39116
+ }
39117
+ function isDraftable(value) {
39118
+ if (!value) { return false; }
39119
+ return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
39120
+ }
39121
+ function isPlainObject(value) {
39122
+ if (!value || typeof value !== "object") { return false; }
39123
+ if (Array.isArray(value)) { return true; }
39124
+ var proto = Object.getPrototypeOf(value);
39125
+ return !proto || proto === Object.prototype;
39126
+ }
39127
+ var assign = Object.assign || function assign(target, value) {
39128
+ for (var key in value) {
39129
+ if (has$1(value, key)) {
39130
+ target[key] = value[key];
39131
+ }
39132
+ }
39133
+
39134
+ return target;
39135
+ };
39136
+ var ownKeys$2 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) { return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj)); } : Object.getOwnPropertyNames;
39137
+ function shallowCopy(base, invokeGetters) {
39138
+ if ( invokeGetters === void 0 ) invokeGetters = false;
39139
+
39140
+ if (Array.isArray(base)) { return base.slice(); }
39141
+ var clone = Object.create(Object.getPrototypeOf(base));
39142
+ ownKeys$2(base).forEach(function (key) {
39143
+ if (key === DRAFT_STATE) {
39144
+ return; // Never copy over draft state.
39145
+ }
39146
+
39147
+ var desc = Object.getOwnPropertyDescriptor(base, key);
39148
+ var value = desc.value;
39149
+
39150
+ if (desc.get) {
39151
+ if (!invokeGetters) {
39152
+ throw new Error("Immer drafts cannot have computed properties");
39153
+ }
39154
+
39155
+ value = desc.get.call(base);
39156
+ }
39157
+
39158
+ if (desc.enumerable) {
39159
+ clone[key] = value;
39160
+ } else {
39161
+ Object.defineProperty(clone, key, {
39162
+ value: value,
39163
+ writable: true,
39164
+ configurable: true
39165
+ });
39166
+ }
39167
+ });
39168
+ return clone;
39169
+ }
39170
+ function each(value, cb) {
39171
+ if (Array.isArray(value)) {
39172
+ for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
39173
+ } else {
39174
+ ownKeys$2(value).forEach(function (key) { return cb(key, value[key], value); });
39175
+ }
39176
+ }
39177
+ function isEnumerable(base, prop) {
39178
+ var desc = Object.getOwnPropertyDescriptor(base, prop);
39179
+ return !!desc && desc.enumerable;
39180
+ }
39181
+ function has$1(thing, prop) {
39182
+ return Object.prototype.hasOwnProperty.call(thing, prop);
39183
+ }
39184
+ function is(x, y) {
39185
+ // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
39186
+ if (x === y) {
39187
+ return x !== 0 || 1 / x === 1 / y;
39188
+ } else {
39189
+ return x !== x && y !== y;
39190
+ }
39191
+ }
39192
+ function clone(obj) {
39193
+ if (!isDraftable(obj)) { return obj; }
39194
+ if (Array.isArray(obj)) { return obj.map(clone); }
39195
+ var cloned = Object.create(Object.getPrototypeOf(obj));
39196
+
39197
+ for (var key in obj) { cloned[key] = clone(obj[key]); }
39198
+
39199
+ return cloned;
39200
+ }
39201
+
39202
+ /** Each scope represents a `produce` call. */
39203
+
39204
+ var ImmerScope = function ImmerScope(parent) {
39205
+ this.drafts = [];
39206
+ this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
39207
+ // need to prevent auto-freezing so the unowned draft can be finalized.
39208
+
39209
+ this.canAutoFreeze = true; // To avoid prototype lookups:
39210
+
39211
+ this.patches = null;
39212
+ };
39213
+
39214
+ ImmerScope.prototype.usePatches = function usePatches (patchListener) {
39215
+ if (patchListener) {
39216
+ this.patches = [];
39217
+ this.inversePatches = [];
39218
+ this.patchListener = patchListener;
39219
+ }
39220
+ };
39221
+
39222
+ ImmerScope.prototype.revoke = function revoke$1 () {
39223
+ this.leave();
39224
+ this.drafts.forEach(revoke);
39225
+ this.drafts = null; // Make draft-related methods throw.
39226
+ };
39227
+
39228
+ ImmerScope.prototype.leave = function leave () {
39229
+ if (this === ImmerScope.current) {
39230
+ ImmerScope.current = this.parent;
39231
+ }
39232
+ };
39233
+ ImmerScope.current = null;
39234
+
39235
+ ImmerScope.enter = function () {
39236
+ return this.current = new ImmerScope(this.current);
39237
+ };
39238
+
39239
+ function revoke(draft) {
39240
+ draft[DRAFT_STATE].revoke();
39241
+ }
39242
+
39243
+ // but share them all instead
39244
+
39245
+ var descriptors$1 = {};
39246
+ function willFinalize(scope, result, isReplaced) {
39247
+ scope.drafts.forEach(function (draft) {
39248
+ draft[DRAFT_STATE].finalizing = true;
39249
+ });
39250
+
39251
+ if (!isReplaced) {
39252
+ if (scope.patches) {
39253
+ markChangesRecursively(scope.drafts[0]);
39254
+ } // This is faster when we don't care about which attributes changed.
39255
+
39256
+
39257
+ markChangesSweep(scope.drafts);
39258
+ } // When a child draft is returned, look for changes.
39259
+ else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {
39260
+ markChangesSweep(scope.drafts);
39261
+ }
39262
+ }
39263
+ function createProxy(base, parent) {
39264
+ var isArray = Array.isArray(base);
39265
+ var draft = clonePotentialDraft(base);
39266
+ each(draft, function (prop) {
39267
+ proxyProperty(draft, prop, isArray || isEnumerable(base, prop));
39268
+ }); // See "proxy.js" for property documentation.
39269
+
39270
+ var scope = parent ? parent.scope : ImmerScope.current;
39271
+ var state = {
39272
+ scope: scope,
39273
+ modified: false,
39274
+ finalizing: false,
39275
+ // es5 only
39276
+ finalized: false,
39277
+ assigned: {},
39278
+ parent: parent,
39279
+ base: base,
39280
+ draft: draft,
39281
+ copy: null,
39282
+ revoke: revoke$1,
39283
+ revoked: false // es5 only
39284
+
39285
+ };
39286
+ createHiddenProperty(draft, DRAFT_STATE, state);
39287
+ scope.drafts.push(draft);
39288
+ return draft;
39289
+ }
39290
+
39291
+ function revoke$1() {
39292
+ this.revoked = true;
39293
+ }
39294
+
39295
+ function source(state) {
39296
+ return state.copy || state.base;
39297
+ } // Access a property without creating an Immer draft.
39298
+
39299
+
39300
+ function peek(draft, prop) {
39301
+ var state = draft[DRAFT_STATE];
39302
+
39303
+ if (state && !state.finalizing) {
39304
+ state.finalizing = true;
39305
+ var value = draft[prop];
39306
+ state.finalizing = false;
39307
+ return value;
39308
+ }
39309
+
39310
+ return draft[prop];
39311
+ }
39312
+
39313
+ function get$1(state, prop) {
39314
+ assertUnrevoked(state);
39315
+ var value = peek(source(state), prop);
39316
+ if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
39317
+
39318
+ if (value === peek(state.base, prop) && isDraftable(value)) {
39319
+ prepareCopy(state);
39320
+ return state.copy[prop] = createProxy(value, state);
39321
+ }
39322
+
39323
+ return value;
39324
+ }
39325
+
39326
+ function set$1(state, prop, value) {
39327
+ assertUnrevoked(state);
39328
+ state.assigned[prop] = true;
39329
+
39330
+ if (!state.modified) {
39331
+ if (is(value, peek(source(state), prop))) { return; }
39332
+ markChanged(state);
39333
+ prepareCopy(state);
39334
+ }
39335
+
39336
+ state.copy[prop] = value;
39337
+ }
39338
+
39339
+ function markChanged(state) {
39340
+ if (!state.modified) {
39341
+ state.modified = true;
39342
+ if (state.parent) { markChanged(state.parent); }
39343
+ }
39344
+ }
39345
+
39346
+ function prepareCopy(state) {
39347
+ if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
39348
+ }
39349
+
39350
+ function clonePotentialDraft(base) {
39351
+ var state = base && base[DRAFT_STATE];
39352
+
39353
+ if (state) {
39354
+ state.finalizing = true;
39355
+ var draft = shallowCopy(state.draft, true);
39356
+ state.finalizing = false;
39357
+ return draft;
39358
+ }
39359
+
39360
+ return shallowCopy(base);
39361
+ }
39362
+
39363
+ function proxyProperty(draft, prop, enumerable) {
39364
+ var desc = descriptors$1[prop];
39365
+
39366
+ if (desc) {
39367
+ desc.enumerable = enumerable;
39368
+ } else {
39369
+ descriptors$1[prop] = desc = {
39370
+ configurable: true,
39371
+ enumerable: enumerable,
39372
+
39373
+ get: function get$1$1() {
39374
+ return get$1(this[DRAFT_STATE], prop);
39375
+ },
39376
+
39377
+ set: function set$1$1(value) {
39378
+ set$1(this[DRAFT_STATE], prop, value);
39379
+ }
39380
+
39381
+ };
39382
+ }
39383
+
39384
+ Object.defineProperty(draft, prop, desc);
39385
+ }
39386
+
39387
+ function assertUnrevoked(state) {
39388
+ if (state.revoked === true) { throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + JSON.stringify(source(state))); }
39389
+ } // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
39390
+
39391
+
39392
+ function markChangesSweep(drafts) {
39393
+ // The natural order of drafts in the `scope` array is based on when they
39394
+ // were accessed. By processing drafts in reverse natural order, we have a
39395
+ // better chance of processing leaf nodes first. When a leaf node is known to
39396
+ // have changed, we can avoid any traversal of its ancestor nodes.
39397
+ for (var i = drafts.length - 1; i >= 0; i--) {
39398
+ var state = drafts[i][DRAFT_STATE];
39399
+
39400
+ if (!state.modified) {
39401
+ if (Array.isArray(state.base)) {
39402
+ if (hasArrayChanges(state)) { markChanged(state); }
39403
+ } else if (hasObjectChanges(state)) { markChanged(state); }
39404
+ }
39405
+ }
39406
+ }
39407
+
39408
+ function markChangesRecursively(object) {
39409
+ if (!object || typeof object !== "object") { return; }
39410
+ var state = object[DRAFT_STATE];
39411
+ if (!state) { return; }
39412
+ var base = state.base;
39413
+ var draft = state.draft;
39414
+ var assigned = state.assigned;
39415
+
39416
+ if (!Array.isArray(object)) {
39417
+ // Look for added keys.
39418
+ Object.keys(draft).forEach(function (key) {
39419
+ // The `undefined` check is a fast path for pre-existing keys.
39420
+ if (base[key] === undefined && !has$1(base, key)) {
39421
+ assigned[key] = true;
39422
+ markChanged(state);
39423
+ } else if (!assigned[key]) {
39424
+ // Only untouched properties trigger recursion.
39425
+ markChangesRecursively(draft[key]);
39426
+ }
39427
+ }); // Look for removed keys.
39428
+
39429
+ Object.keys(base).forEach(function (key) {
39430
+ // The `undefined` check is a fast path for pre-existing keys.
39431
+ if (draft[key] === undefined && !has$1(draft, key)) {
39432
+ assigned[key] = false;
39433
+ markChanged(state);
39434
+ }
39435
+ });
39436
+ } else if (hasArrayChanges(state)) {
39437
+ markChanged(state);
39438
+ assigned.length = true;
39439
+
39440
+ if (draft.length < base.length) {
39441
+ for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
39442
+ } else {
39443
+ for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
39444
+ }
39445
+
39446
+ for (var i$2 = 0; i$2 < draft.length; i$2++) {
39447
+ // Only untouched indices trigger recursion.
39448
+ if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
39449
+ }
39450
+ }
39451
+ }
39452
+
39453
+ function hasObjectChanges(state) {
39454
+ var base = state.base;
39455
+ var draft = state.draft; // Search for added keys and changed keys. Start at the back, because
39456
+ // non-numeric keys are ordered by time of definition on the object.
39457
+
39458
+ var keys = Object.keys(draft);
39459
+
39460
+ for (var i = keys.length - 1; i >= 0; i--) {
39461
+ var key = keys[i];
39462
+ var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.
39463
+
39464
+ if (baseValue === undefined && !has$1(base, key)) {
39465
+ return true;
39466
+ } // Once a base key is deleted, future changes go undetected, because its
39467
+ // descriptor is erased. This branch detects any missed changes.
39468
+ else {
39469
+ var value = draft[key];
39470
+ var state$1 = value && value[DRAFT_STATE];
39471
+
39472
+ if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {
39473
+ return true;
39474
+ }
39475
+ }
39476
+ } // At this point, no keys were added or changed.
39477
+ // Compare key count to determine if keys were deleted.
39478
+
39479
+
39480
+ return keys.length !== Object.keys(base).length;
39481
+ }
39482
+
39483
+ function hasArrayChanges(state) {
39484
+ var draft = state.draft;
39485
+ if (draft.length !== state.base.length) { return true; } // See #116
39486
+ // If we first shorten the length, our array interceptors will be removed.
39487
+ // If after that new items are added, result in the same original length,
39488
+ // those last items will have no intercepting property.
39489
+ // So if there is no own descriptor on the last position, we know that items were removed and added
39490
+ // N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
39491
+ // the last one
39492
+
39493
+ var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
39494
+
39495
+ if (descriptor && !descriptor.get) { return true; } // For all other cases, we don't have to compare, as they would have been picked up by the index setters
39496
+
39497
+ return false;
39498
+ }
39499
+
39500
+ function createHiddenProperty(target, prop, value) {
39501
+ Object.defineProperty(target, prop, {
39502
+ value: value,
39503
+ enumerable: false,
39504
+ writable: true
39505
+ });
39506
+ }
39507
+
39508
+ var legacyProxy = /*#__PURE__*/Object.freeze({
39509
+ willFinalize: willFinalize,
39510
+ createProxy: createProxy
39511
+ });
39512
+
39513
+ function willFinalize$1() {}
39514
+ function createProxy$1(base, parent) {
39515
+ var scope = parent ? parent.scope : ImmerScope.current;
39516
+ var state = {
39517
+ // Track which produce call this is associated with.
39518
+ scope: scope,
39519
+ // True for both shallow and deep changes.
39520
+ modified: false,
39521
+ // Used during finalization.
39522
+ finalized: false,
39523
+ // Track which properties have been assigned (true) or deleted (false).
39524
+ assigned: {},
39525
+ // The parent draft state.
39526
+ parent: parent,
39527
+ // The base state.
39528
+ base: base,
39529
+ // The base proxy.
39530
+ draft: null,
39531
+ // Any property proxies.
39532
+ drafts: {},
39533
+ // The base copy with any updated values.
39534
+ copy: null,
39535
+ // Called by the `produce` function.
39536
+ revoke: null
39537
+ };
39538
+ var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,
39539
+ // although state itself is an object
39540
+ Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
39541
+ var revoke = ref.revoke;
39542
+ var proxy = ref.proxy;
39543
+ state.draft = proxy;
39544
+ state.revoke = revoke;
39545
+ scope.drafts.push(proxy);
39546
+ return proxy;
39547
+ }
39548
+ var objectTraps = {
39549
+ get: get$1$1,
39550
+
39551
+ has: function has(target, prop) {
39552
+ return prop in source$1(target);
39553
+ },
39554
+
39555
+ ownKeys: function ownKeys(target) {
39556
+ return Reflect.ownKeys(source$1(target));
39557
+ },
39558
+
39559
+ set: set$1$1,
39560
+ deleteProperty: deleteProperty,
39561
+ getOwnPropertyDescriptor: getOwnPropertyDescriptor$2,
39562
+
39563
+ defineProperty: function defineProperty() {
39564
+ throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
39565
+ },
39566
+
39567
+ getPrototypeOf: function getPrototypeOf(target) {
39568
+ return Object.getPrototypeOf(target.base);
39569
+ },
39570
+
39571
+ setPrototypeOf: function setPrototypeOf() {
39572
+ throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
39573
+ }
39574
+
39575
+ };
39576
+ var arrayTraps = {};
39577
+ each(objectTraps, function (key, fn) {
39578
+ arrayTraps[key] = function () {
39579
+ arguments[0] = arguments[0][0];
39580
+ return fn.apply(this, arguments);
39581
+ };
39582
+ });
39583
+
39584
+ arrayTraps.deleteProperty = function (state, prop) {
39585
+ if (isNaN(parseInt(prop))) {
39586
+ throw new Error("Immer only supports deleting array indices"); // prettier-ignore
39587
+ }
39588
+
39589
+ return objectTraps.deleteProperty.call(this, state[0], prop);
39590
+ };
39591
+
39592
+ arrayTraps.set = function (state, prop, value) {
39593
+ if (prop !== "length" && isNaN(parseInt(prop))) {
39594
+ throw new Error("Immer only supports setting array indices and the 'length' property"); // prettier-ignore
39595
+ }
39596
+
39597
+ return objectTraps.set.call(this, state[0], prop, value);
39598
+ }; // returns the object we should be reading the current value from, which is base, until some change has been made
39599
+
39600
+
39601
+ function source$1(state) {
39602
+ return state.copy || state.base;
39603
+ } // Access a property without creating an Immer draft.
39604
+
39605
+
39606
+ function peek$1(draft, prop) {
39607
+ var state = draft[DRAFT_STATE];
39608
+ var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);
39609
+ return desc && desc.value;
39610
+ }
39611
+
39612
+ function get$1$1(state, prop) {
39613
+ if (prop === DRAFT_STATE) { return state; }
39614
+ var drafts = state.drafts; // Check for existing draft in unmodified state.
39615
+
39616
+ if (!state.modified && has$1(drafts, prop)) {
39617
+ return drafts[prop];
39618
+ }
39619
+
39620
+ var value = source$1(state)[prop];
39621
+
39622
+ if (state.finalized || !isDraftable(value)) {
39623
+ return value;
39624
+ } // Check for existing draft in modified state.
39625
+
39626
+
39627
+ if (state.modified) {
39628
+ // Assigned values are never drafted. This catches any drafts we created, too.
39629
+ if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
39630
+
39631
+ drafts = state.copy;
39632
+ }
39633
+
39634
+ return drafts[prop] = createProxy$1(value, state);
39635
+ }
39636
+
39637
+ function set$1$1(state, prop, value) {
39638
+ if (!state.modified) {
39639
+ var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
39640
+ // never be undefined, so we can avoid the `in` operator. Lastly, truthy
39641
+ // values may be drafts, but falsy values are never drafts.
39642
+
39643
+ var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
39644
+ if (isUnchanged) { return true; }
39645
+ markChanged$1(state);
39646
+ }
39647
+
39648
+ state.assigned[prop] = true;
39649
+ state.copy[prop] = value;
39650
+ return true;
39651
+ }
39652
+
39653
+ function deleteProperty(state, prop) {
39654
+ // The `undefined` check is a fast path for pre-existing keys.
39655
+ if (peek$1(state.base, prop) !== undefined || prop in state.base) {
39656
+ state.assigned[prop] = false;
39657
+ markChanged$1(state);
39658
+ } else if (state.assigned[prop]) {
39659
+ // if an originally not assigned property was deleted
39660
+ delete state.assigned[prop];
39661
+ }
39662
+
39663
+ if (state.copy) { delete state.copy[prop]; }
39664
+ return true;
39665
+ } // Note: We never coerce `desc.value` into an Immer draft, because we can't make
39666
+ // the same guarantee in ES5 mode.
39667
+
39668
+
39669
+ function getOwnPropertyDescriptor$2(state, prop) {
39670
+ var owner = source$1(state);
39671
+ var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
39672
+
39673
+ if (desc) {
39674
+ desc.writable = true;
39675
+ desc.configurable = !Array.isArray(owner) || prop !== "length";
39676
+ }
39677
+
39678
+ return desc;
39679
+ }
39680
+
39681
+ function markChanged$1(state) {
39682
+ if (!state.modified) {
39683
+ state.modified = true;
39684
+ state.copy = assign(shallowCopy(state.base), state.drafts);
39685
+ state.drafts = null;
39686
+ if (state.parent) { markChanged$1(state.parent); }
39687
+ }
39688
+ }
39689
+
39690
+ var modernProxy = /*#__PURE__*/Object.freeze({
39691
+ willFinalize: willFinalize$1,
39692
+ createProxy: createProxy$1
39693
+ });
39694
+
39695
+ function generatePatches(state, basePath, patches, inversePatches) {
39696
+ Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);
39697
+ }
39698
+
39699
+ function generateArrayPatches(state, basePath, patches, inversePatches) {
39700
+ var assign, assign$1;
39701
+
39702
+ var base = state.base;
39703
+ var copy = state.copy;
39704
+ var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
39705
+
39706
+ if (copy.length < base.length) {
39707
+ (assign = [copy, base], base = assign[0], copy = assign[1]);
39708
+ (assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
39709
+ }
39710
+
39711
+ var delta = copy.length - base.length; // Find the first replaced index.
39712
+
39713
+ var start = 0;
39714
+
39715
+ while (base[start] === copy[start] && start < base.length) {
39716
+ ++start;
39717
+ } // Find the last replaced index. Search from the end to optimize splice patches.
39718
+
39719
+
39720
+ var end = base.length;
39721
+
39722
+ while (end > start && base[end - 1] === copy[end + delta - 1]) {
39723
+ --end;
39724
+ } // Process replaced indices.
39725
+
39726
+
39727
+ for (var i = start; i < end; ++i) {
39728
+ if (assigned[i] && copy[i] !== base[i]) {
39729
+ var path = basePath.concat([i]);
39730
+ patches.push({
39731
+ op: "replace",
39732
+ path: path,
39733
+ value: copy[i]
39734
+ });
39735
+ inversePatches.push({
39736
+ op: "replace",
39737
+ path: path,
39738
+ value: base[i]
39739
+ });
39740
+ }
39741
+ }
39742
+
39743
+ var replaceCount = patches.length; // Process added indices.
39744
+
39745
+ for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
39746
+ var path$1 = basePath.concat([i$1]);
39747
+ patches[replaceCount + i$1 - end] = {
39748
+ op: "add",
39749
+ path: path$1,
39750
+ value: copy[i$1]
39751
+ };
39752
+ inversePatches.push({
39753
+ op: "remove",
39754
+ path: path$1
39755
+ });
39756
+ }
39757
+ }
39758
+
39759
+ function generateObjectPatches(state, basePath, patches, inversePatches) {
39760
+ var base = state.base;
39761
+ var copy = state.copy;
39762
+ each(state.assigned, function (key, assignedValue) {
39763
+ var origValue = base[key];
39764
+ var value = copy[key];
39765
+ var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
39766
+ if (origValue === value && op === "replace") { return; }
39767
+ var path = basePath.concat(key);
39768
+ patches.push(op === "remove" ? {
39769
+ op: op,
39770
+ path: path
39771
+ } : {
39772
+ op: op,
39773
+ path: path,
39774
+ value: value
39775
+ });
39776
+ inversePatches.push(op === "add" ? {
39777
+ op: "remove",
39778
+ path: path
39779
+ } : op === "remove" ? {
39780
+ op: "add",
39781
+ path: path,
39782
+ value: origValue
39783
+ } : {
39784
+ op: "replace",
39785
+ path: path,
39786
+ value: origValue
39787
+ });
39788
+ });
39789
+ }
39790
+
39791
+ var applyPatches = function (draft, patches) {
39792
+ for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
39793
+ var patch = list[i$1];
39794
+
39795
+ var path = patch.path;
39796
+ var op = patch.op;
39797
+ var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
39798
+
39799
+ if (!path.length) { throw new Error("Illegal state"); }
39800
+ var base = draft;
39801
+
39802
+ for (var i = 0; i < path.length - 1; i++) {
39803
+ base = base[path[i]];
39804
+ if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
39805
+ }
39806
+
39807
+ var key = path[path.length - 1];
39808
+
39809
+ switch (op) {
39810
+ case "replace":
39811
+ // if value is an object, then it's assigned by reference
39812
+ // in the following add or remove ops, the value field inside the patch will also be modifyed
39813
+ // so we use value from the cloned patch
39814
+ base[key] = value;
39815
+ break;
39816
+
39817
+ case "add":
39818
+ if (Array.isArray(base)) {
39819
+ // TODO: support "foo/-" paths for appending to an array
39820
+ base.splice(key, 0, value);
39821
+ } else {
39822
+ base[key] = value;
39823
+ }
39824
+
39825
+ break;
39826
+
39827
+ case "remove":
39828
+ if (Array.isArray(base)) {
39829
+ base.splice(key, 1);
39830
+ } else {
39831
+ delete base[key];
39832
+ }
39833
+
39834
+ break;
39835
+
39836
+ default:
39837
+ throw new Error("Unsupported patch operation: " + op);
39838
+ }
39839
+ }
39840
+
39841
+ return draft;
39102
39842
  };
39103
39843
 
39104
- const computeErrorEntries = (formState) => {
39105
- const fields = Object.entries(formState);
39106
- for (let entry of fields) {
39107
- let fieldName = entry[0];
39108
- let errors = computeErrors(fieldName, formState);
39109
- formState[fieldName].errors = errors;
39110
- formState[fieldName].hasErrors = errors.length > 0;
39844
+ function verifyMinified() {}
39845
+
39846
+ var configDefaults = {
39847
+ useProxies: typeof Proxy !== "undefined" && typeof Reflect !== "undefined",
39848
+ autoFreeze: typeof process !== "undefined" ? process.env.NODE_ENV !== "production" : verifyMinified.name === "verifyMinified",
39849
+ onAssign: null,
39850
+ onDelete: null,
39851
+ onCopy: null
39852
+ };
39853
+ var Immer = function Immer(config) {
39854
+ assign(this, configDefaults, config);
39855
+ this.setUseProxies(this.useProxies);
39856
+ this.produce = this.produce.bind(this);
39857
+ };
39858
+
39859
+ Immer.prototype.produce = function produce (base, recipe, patchListener) {
39860
+ var this$1$1 = this;
39861
+
39862
+ // curried invocation
39863
+ if (typeof base === "function" && typeof recipe !== "function") {
39864
+ var defaultBase = recipe;
39865
+ recipe = base;
39866
+ var self = this;
39867
+ return function curriedProduce(base) {
39868
+ var this$1$1 = this;
39869
+ if ( base === void 0 ) base = defaultBase;
39870
+ var args = [], len = arguments.length - 1;
39871
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
39872
+
39873
+ return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
39874
+ };
39875
+ } // prettier-ignore
39876
+
39877
+
39878
+ {
39879
+ if (typeof recipe !== "function") {
39880
+ throw new Error("The first or second argument to `produce` must be a function");
39881
+ }
39882
+
39883
+ if (patchListener !== undefined && typeof patchListener !== "function") {
39884
+ throw new Error("The third argument to `produce` must be a function or undefined");
39885
+ }
39886
+ }
39887
+ var result; // Only plain objects, arrays, and "immerable classes" are drafted.
39888
+
39889
+ if (isDraftable(base)) {
39890
+ var scope = ImmerScope.enter();
39891
+ var proxy = this.createProxy(base);
39892
+ var hasError = true;
39893
+
39894
+ try {
39895
+ result = recipe(proxy);
39896
+ hasError = false;
39897
+ } finally {
39898
+ // finally instead of catch + rethrow better preserves original stack
39899
+ if (hasError) { scope.revoke(); }else { scope.leave(); }
39900
+ }
39901
+
39902
+ if (result instanceof Promise) {
39903
+ return result.then(function (result) {
39904
+ scope.usePatches(patchListener);
39905
+ return this$1$1.processResult(result, scope);
39906
+ }, function (error) {
39907
+ scope.revoke();
39908
+ throw error;
39909
+ });
39910
+ }
39911
+
39912
+ scope.usePatches(patchListener);
39913
+ return this.processResult(result, scope);
39914
+ } else {
39915
+ result = recipe(base);
39916
+ if (result === undefined) { return base; }
39917
+ return result !== NOTHING ? result : undefined;
39111
39918
  }
39112
39919
  };
39113
39920
 
39114
- const computeDirtyEntries = (formState, changedFieldName) => {
39115
- const fields = Object.entries(formState);
39116
- for (let entry of fields) {
39117
- let fieldName = entry[0];
39118
- let field = entry[1];
39119
- let dirty = fieldName === changedFieldName ? true : field.dirty;
39120
- formState[fieldName].dirty = dirty;
39921
+ Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
39922
+ var this$1$1 = this;
39923
+
39924
+ if (typeof arg1 === "function") {
39925
+ return function (state) {
39926
+ var args = [], len = arguments.length - 1;
39927
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
39928
+
39929
+ return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
39930
+ };
39931
+ } // non-curried form
39932
+
39933
+
39934
+ if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
39935
+ var patches, inversePatches;
39936
+ var nextState = this.produce(arg1, arg2, function (p, ip) {
39937
+ patches = p;
39938
+ inversePatches = ip;
39939
+ });
39940
+ return [nextState, patches, inversePatches];
39941
+ };
39942
+
39943
+ Immer.prototype.createDraft = function createDraft (base) {
39944
+ if (!isDraftable(base)) {
39945
+ throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
39946
+ }
39947
+
39948
+ var scope = ImmerScope.enter();
39949
+ var proxy = this.createProxy(base);
39950
+ proxy[DRAFT_STATE].isManual = true;
39951
+ scope.leave();
39952
+ return proxy;
39953
+ };
39954
+
39955
+ Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
39956
+ var state = draft && draft[DRAFT_STATE];
39957
+
39958
+ if (!state || !state.isManual) {
39959
+ throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`"); // prettier-ignore
39960
+ }
39961
+
39962
+ if (state.finalized) {
39963
+ throw new Error("The given draft is already finalized"); // prettier-ignore
39121
39964
  }
39965
+
39966
+ var scope = state.scope;
39967
+ scope.usePatches(patchListener);
39968
+ return this.processResult(undefined, scope);
39122
39969
  };
39123
39970
 
39124
- function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a$1(n,r){return 2===o(n)?n.get(r):n[r]}function f$6(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c$1(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0)),n}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b$1(r){var t=tn[r];return t||n(18,r),t}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b$1("Patches"),n.u=[],n.s=[],n.v=r);}function g(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b$1("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b$1("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,!1),t&&n.u&&b$1("Patches").N(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f$6(o,a,p),!r(p))return;e.m=!1;}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function N(n,r,t){var e=s(r)?b$1("MapSet").F(r,t):v(r)?b$1("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b$1("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b$1("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1;}else e=D(r,c);return i(e,(function(r,t){u&&a$1(u.t,r)===t||f$6(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c$1(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?g(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,!0),o){var p=[],l=[];b$1("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b$1("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var produce = fn;
39971
+ Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
39972
+ this.autoFreeze = value;
39973
+ };
39125
39974
 
39126
- const createInitialState = (formConfig) => {
39975
+ Immer.prototype.setUseProxies = function setUseProxies (value) {
39976
+ this.useProxies = value;
39977
+ assign(this, value ? modernProxy : legacyProxy);
39978
+ };
39979
+
39980
+ Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
39981
+ // If a patch replaces the entire state, take that replacement as base
39982
+ // before applying patches
39983
+ var i;
39984
+
39985
+ for (i = patches.length - 1; i >= 0; i--) {
39986
+ var patch = patches[i];
39987
+
39988
+ if (patch.path.length === 0 && patch.op === "replace") {
39989
+ base = patch.value;
39990
+ break;
39991
+ }
39992
+ }
39993
+
39994
+ if (isDraft(base)) {
39995
+ // N.B: never hits if some patch a replacement, patches are never drafts
39996
+ return applyPatches(base, patches);
39997
+ } // Otherwise, produce a copy of the base state.
39998
+
39999
+
40000
+ return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
40001
+ };
40002
+ /** @internal */
40003
+
40004
+
40005
+ Immer.prototype.processResult = function processResult (result, scope) {
40006
+ var baseDraft = scope.drafts[0];
40007
+ var isReplaced = result !== undefined && result !== baseDraft;
40008
+ this.willFinalize(scope, result, isReplaced);
40009
+
40010
+ if (isReplaced) {
40011
+ if (baseDraft[DRAFT_STATE].modified) {
40012
+ scope.revoke();
40013
+ throw new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft."); // prettier-ignore
40014
+ }
40015
+
40016
+ if (isDraftable(result)) {
40017
+ // Finalize the result in case it contains (or is) a subset of the draft.
40018
+ result = this.finalize(result, null, scope);
40019
+ }
40020
+
40021
+ if (scope.patches) {
40022
+ scope.patches.push({
40023
+ op: "replace",
40024
+ path: [],
40025
+ value: result
40026
+ });
40027
+ scope.inversePatches.push({
40028
+ op: "replace",
40029
+ path: [],
40030
+ value: baseDraft[DRAFT_STATE].base
40031
+ });
40032
+ }
40033
+ } else {
40034
+ // Finalize the base draft.
40035
+ result = this.finalize(baseDraft, [], scope);
40036
+ }
40037
+
40038
+ scope.revoke();
40039
+
40040
+ if (scope.patches) {
40041
+ scope.patchListener(scope.patches, scope.inversePatches);
40042
+ }
40043
+
40044
+ return result !== NOTHING ? result : undefined;
40045
+ };
40046
+ /**
40047
+ * @internal
40048
+ * Finalize a draft, returning either the unmodified base state or a modified
40049
+ * copy of the base state.
40050
+ */
40051
+
40052
+
40053
+ Immer.prototype.finalize = function finalize (draft, path, scope) {
40054
+ var this$1$1 = this;
40055
+
40056
+ var state = draft[DRAFT_STATE];
40057
+
40058
+ if (!state) {
40059
+ if (Object.isFrozen(draft)) { return draft; }
40060
+ return this.finalizeTree(draft, null, scope);
40061
+ } // Never finalize drafts owned by another scope.
40062
+
40063
+
40064
+ if (state.scope !== scope) {
40065
+ return draft;
40066
+ }
40067
+
40068
+ if (!state.modified) {
40069
+ return state.base;
40070
+ }
40071
+
40072
+ if (!state.finalized) {
40073
+ state.finalized = true;
40074
+ this.finalizeTree(state.draft, path, scope);
40075
+
40076
+ if (this.onDelete) {
40077
+ // The `assigned` object is unreliable with ES5 drafts.
40078
+ if (this.useProxies) {
40079
+ var assigned = state.assigned;
40080
+
40081
+ for (var prop in assigned) {
40082
+ if (!assigned[prop]) { this.onDelete(state, prop); }
40083
+ }
40084
+ } else {
40085
+ var base = state.base;
40086
+ var copy = state.copy;
40087
+ each(base, function (prop) {
40088
+ if (!has$1(copy, prop)) { this$1$1.onDelete(state, prop); }
40089
+ });
40090
+ }
40091
+ }
40092
+
40093
+ if (this.onCopy) {
40094
+ this.onCopy(state);
40095
+ } // At this point, all descendants of `state.copy` have been finalized,
40096
+ // so we can be sure that `scope.canAutoFreeze` is accurate.
40097
+
40098
+
40099
+ if (this.autoFreeze && scope.canAutoFreeze) {
40100
+ Object.freeze(state.copy);
40101
+ }
40102
+
40103
+ if (path && scope.patches) {
40104
+ generatePatches(state, path, scope.patches, scope.inversePatches);
40105
+ }
40106
+ }
40107
+
40108
+ return state.copy;
40109
+ };
40110
+ /**
40111
+ * @internal
40112
+ * Finalize all drafts in the given state tree.
40113
+ */
40114
+
40115
+
40116
+ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
40117
+ var this$1$1 = this;
40118
+
40119
+ var state = root[DRAFT_STATE];
40120
+
40121
+ if (state) {
40122
+ if (!this.useProxies) {
40123
+ // Create the final copy, with added keys and without deleted keys.
40124
+ state.copy = shallowCopy(state.draft, true);
40125
+ }
40126
+
40127
+ root = state.copy;
40128
+ }
40129
+
40130
+ var needPatches = !!rootPath && !!scope.patches;
40131
+
40132
+ var finalizeProperty = function (prop, value, parent) {
40133
+ if (value === parent) {
40134
+ throw Error("Immer forbids circular references");
40135
+ } // In the `finalizeTree` method, only the `root` object may be a draft.
40136
+
40137
+
40138
+ var isDraftProp = !!state && parent === root;
40139
+
40140
+ if (isDraft(value)) {
40141
+ var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
40142
+
40143
+ value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
40144
+
40145
+ if (isDraft(value)) {
40146
+ scope.canAutoFreeze = false;
40147
+ } // Preserve non-enumerable properties.
40148
+
40149
+
40150
+ if (Array.isArray(parent) || isEnumerable(parent, prop)) {
40151
+ parent[prop] = value;
40152
+ } else {
40153
+ Object.defineProperty(parent, prop, {
40154
+ value: value
40155
+ });
40156
+ } // Unchanged drafts are never passed to the `onAssign` hook.
40157
+
40158
+
40159
+ if (isDraftProp && value === state.base[prop]) { return; }
40160
+ } // Unchanged draft properties are ignored.
40161
+ else if (isDraftProp && is(value, state.base[prop])) {
40162
+ return;
40163
+ } // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
40164
+ else if (isDraftable(value) && !Object.isFrozen(value)) {
40165
+ each(value, finalizeProperty);
40166
+ }
40167
+
40168
+ if (isDraftProp && this$1$1.onAssign) {
40169
+ this$1$1.onAssign(state, prop, value);
40170
+ }
40171
+ };
40172
+
40173
+ each(root, finalizeProperty);
40174
+ return root;
40175
+ };
40176
+
40177
+ var immer = new Immer();
40178
+ /**
40179
+ * The `produce` function takes a value and a "recipe function" (whose
40180
+ * return value often depends on the base state). The recipe function is
40181
+ * free to mutate its first argument however it wants. All mutations are
40182
+ * only ever applied to a __copy__ of the base state.
40183
+ *
40184
+ * Pass only a function to create a "curried producer" which relieves you
40185
+ * from passing the recipe function every time.
40186
+ *
40187
+ * Only plain objects and arrays are made mutable. All other objects are
40188
+ * considered uncopyable.
40189
+ *
40190
+ * Note: This function is __bound__ to its `Immer` instance.
40191
+ *
40192
+ * @param {any} base - the initial state
40193
+ * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
40194
+ * @param {Function} patchListener - optional function that will be called with all the patches produced here
40195
+ * @returns {any} a new state, or the initial state if nothing was modified
40196
+ */
40197
+
40198
+ var produce = immer.produce;
40199
+ /**
40200
+ * Like `produce`, but `produceWithPatches` always returns a tuple
40201
+ * [nextState, patches, inversePatches] (instead of just the next state)
40202
+ */
40203
+
40204
+ immer.produceWithPatches.bind(immer);
40205
+ /**
40206
+ * Pass true to automatically freeze all copies created by Immer.
40207
+ *
40208
+ * By default, auto-freezing is disabled in production.
40209
+ */
40210
+
40211
+ immer.setAutoFreeze.bind(immer);
40212
+ /**
40213
+ * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
40214
+ * always faster than using ES5 proxies.
40215
+ *
40216
+ * By default, feature detection is used, so calling this is rarely necessary.
40217
+ */
40218
+
40219
+ immer.setUseProxies.bind(immer);
40220
+ /**
40221
+ * Apply an array of Immer patches to the first argument.
40222
+ *
40223
+ * This function is a producer, which means copy-on-write is in effect.
40224
+ */
40225
+
40226
+ immer.applyPatches.bind(immer);
40227
+ /**
40228
+ * Create an Immer draft from the given base state, which may be a draft itself.
40229
+ * The draft can be modified until you finalize it with the `finishDraft` function.
40230
+ */
40231
+
40232
+ immer.createDraft.bind(immer);
40233
+ /**
40234
+ * Finalize an Immer draft from a `createDraft` call, returning the base state
40235
+ * (if no changes were made) or a modified copy. The draft must *not* be
40236
+ * mutated afterwards.
40237
+ *
40238
+ * Pass a function as the 2nd argument to generate Immer patches based on the
40239
+ * changes that were made.
40240
+ */
40241
+
40242
+ immer.finishDraft.bind(immer);
40243
+
40244
+ const createInitialState = formConfig => {
39127
40245
  let initialForm = {};
39128
40246
  const formConfigKeys = Object.keys(formConfig);
39129
40247
  for (let formKey of formConfigKeys) {
39130
40248
  initialForm[formKey] = {
39131
40249
  dirty: false,
39132
- rawValue: formConfig[formKey].defaultValue || '',
40250
+ rawValue: formConfig[formKey].defaultValue || "",
39133
40251
  validators: formConfig[formKey].validators || [],
39134
- constraints: formConfig[formKey].constraints || [],
40252
+ constraints: formConfig[formKey].constraints || []
39135
40253
  };
39136
40254
  }
39137
40255
  // Because validators require the entire form we have to do a
@@ -39142,99 +40260,82 @@ const createInitialState = (formConfig) => {
39142
40260
  initialForm[formKey].errors = errors;
39143
40261
  initialForm[formKey].hasErrors = errors.length > 0;
39144
40262
  }
39145
-
39146
40263
  return initialForm;
39147
40264
  };
39148
40265
 
39149
- const SET = 'field/SET';
39150
- const set$1 = (fieldName) => (value) => ({
40266
+ const SET = "field/SET";
40267
+ const set$2 = fieldName => value => ({
39151
40268
  type: SET,
39152
- payload: { fieldName, value },
40269
+ payload: { fieldName, value }
39153
40270
  });
39154
40271
 
39155
- const CLEAR = 'form/CLEAR';
40272
+ const CLEAR = "form/CLEAR";
39156
40273
  const clear = () => ({ type: CLEAR });
39157
40274
 
39158
- const ADD_VALIDATOR = 'field/ADD_VALIDATOR';
39159
- const addValidator = (fieldName) => (validator) => ({
40275
+ const ADD_VALIDATOR = "field/ADD_VALIDATOR";
40276
+ const addValidator = fieldName => validator => ({
39160
40277
  type: ADD_VALIDATOR,
39161
- payload: { fieldName, validator },
39162
- });
39163
-
39164
- const REMOVE_VALIDATOR = 'field/REMOVE_VALIDATOR';
39165
- const removeValidator = (fieldName) => (validator) => ({
39166
- type: REMOVE_VALIDATOR,
39167
- payload: { fieldName, validator },
40278
+ payload: { fieldName, validator }
39168
40279
  });
39169
40280
 
39170
- const CLEAR_FIELD_VALIDATORS = 'field/CLEAR_FIELD_VALIDATORS';
39171
- const clearFieldValidators = (fieldName) => () => ({
39172
- type: CLEAR_FIELD_VALIDATORS,
39173
- payload: { fieldName },
39174
- });
39175
-
39176
- const createFormReducer =
39177
- (formConfig) =>
39178
- (state = createInitialState(formConfig), action) => {
39179
- switch (action.type) {
39180
- case SET: {
39181
- const changedFieldName = action.payload.fieldName;
39182
- const newRawValue = action.payload.value;
39183
-
39184
- return produce(state, (draftState) => {
39185
- let originalValue = draftState[changedFieldName].rawValue;
39186
- draftState[changedFieldName].rawValue = newRawValue;
39187
- if (computeConstraints(changedFieldName, draftState).length > 0) {
39188
- // If the change violates constraints, revert the change
39189
- draftState[changedFieldName].rawValue = originalValue;
39190
- return draftState;
39191
- }
39192
-
39193
- computeDirtyEntries(draftState, changedFieldName);
39194
- computeErrorEntries(draftState);
39195
- });
39196
- }
39197
- case CLEAR:
39198
- return createInitialState(formConfig);
39199
- case ADD_VALIDATOR: {
39200
- const fieldWithOverride = action.payload.fieldName;
39201
- const newValidator = action.payload.validator;
39202
-
39203
- return produce(state, (draftState) => {
39204
- draftState[fieldWithOverride].validators.push(newValidator);
39205
- computeErrorEntries(draftState);
39206
- });
39207
- }
39208
- case REMOVE_VALIDATOR: {
39209
- const fieldToOverride = action.payload.fieldName;
39210
- const targetValidator = action.payload.validator;
39211
-
39212
- return produce(state, (draftState) => {
39213
- let fieldValidators = draftState[fieldToOverride].validators;
39214
- draftState[fieldToOverride].validators = fieldValidators.filter(
39215
- (validator) => validator.type !== targetValidator.type
39216
- );
39217
- computeErrorEntries(draftState);
39218
- });
39219
- }
39220
- case CLEAR_FIELD_VALIDATORS: {
39221
- const fieldToClear = action.payload.fieldName;
40281
+ const createFormReducer = formConfig => (
40282
+ state = createInitialState(formConfig),
40283
+ action
40284
+ ) => {
40285
+ switch (action.type) {
40286
+ case SET:
40287
+ const changedFieldName = action.payload.fieldName;
40288
+ const newRawValue = action.payload.value;
40289
+
40290
+ return produce(state, draftState => {
40291
+ let originalValue = draftState[changedFieldName].rawValue;
40292
+ draftState[changedFieldName].rawValue = newRawValue;
40293
+ if (computeConstraints(changedFieldName, draftState).length > 0) {
40294
+ // If the change violates constraints, revert the change
40295
+ draftState[changedFieldName].rawValue = originalValue;
40296
+ return draftState;
40297
+ }
39222
40298
 
39223
- return produce(state, (draftState) => {
39224
- draftState[fieldToClear].validators = [];
39225
- computeErrorEntries(draftState);
39226
- });
39227
- }
39228
- default:
39229
- return state;
39230
- }
39231
- };
40299
+ const fields = Object.entries(draftState);
40300
+ for (let entry of fields) {
40301
+ let fieldName = entry[0];
40302
+ let field = entry[1];
40303
+ let errors = computeErrors(fieldName, draftState);
40304
+ let dirty = fieldName === changedFieldName ? true : field.dirty;
40305
+ draftState[fieldName].errors = errors;
40306
+ draftState[fieldName].dirty = dirty;
40307
+ draftState[fieldName].hasErrors = errors.length > 0;
40308
+ }
40309
+ });
40310
+ case CLEAR:
40311
+ return createInitialState(formConfig);
40312
+ case ADD_VALIDATOR:
40313
+ const fieldWithOverride = action.payload.fieldName;
40314
+ const newValidator = action.payload.validator;
40315
+
40316
+ return produce(state, draftState => {
40317
+ draftState[fieldWithOverride].validators.push(newValidator);
40318
+ const fields = Object.entries(draftState);
40319
+ for (let entry of fields) {
40320
+ let fieldName = entry[0];
40321
+ let field = entry[1];
40322
+ let errors = computeErrors(fieldName, draftState);
40323
+ let dirty = field.dirty;
40324
+ draftState[fieldName].errors = errors;
40325
+ draftState[fieldName].dirty = dirty;
40326
+ draftState[fieldName].hasErrors = errors.length > 0;
40327
+ }
40328
+ });
40329
+ default:
40330
+ return state;
40331
+ }
40332
+ };
39232
40333
 
39233
- const createMapDispatchToProps = (formConfig) => {
40334
+ const createMapDispatchToProps = formConfig => {
39234
40335
  // Do memo-ization
39235
40336
  let cachedDispatch;
39236
40337
  let cacheValue;
39237
- return (dispatch) => {
40338
+ return dispatch => {
39238
40339
  if (dispatch == cachedDispatch) {
39239
40340
  return cacheValue;
39240
40341
  }
@@ -39243,11 +40344,8 @@ const createMapDispatchToProps = (formConfig) => {
39243
40344
  const keys = Object.keys(formConfig);
39244
40345
  for (let fieldName of keys) {
39245
40346
  dispatchObj.fields[fieldName] = {
39246
- set: (value) => dispatch(set$1(fieldName)(value)),
39247
- addValidator: (validator) => dispatch(addValidator(fieldName)(validator)),
39248
- removeValidator: (validator) =>
39249
- dispatch(removeValidator(fieldName)(validator)),
39250
- clear: () => dispatch(clearFieldValidators(fieldName)()),
40347
+ set: value => dispatch(set$2(fieldName)(value)),
40348
+ addValidator: validator => dispatch(addValidator(fieldName)(validator))
39251
40349
  };
39252
40350
  }
39253
40351
  dispatchObj.form = { clear: () => dispatch(clear()) };
@@ -39257,12 +40355,12 @@ const createMapDispatchToProps = (formConfig) => {
39257
40355
  };
39258
40356
  };
39259
40357
 
39260
- const mapStateToProps = (state) => ({ fields: state });
40358
+ const mapStateToProps = state => ({ fields: state });
39261
40359
 
39262
- const createFormState = (formConfig) => ({
40360
+ const createFormState = formConfig => ({
39263
40361
  reducer: createFormReducer(formConfig),
39264
40362
  mapDispatchToProps: createMapDispatchToProps(formConfig),
39265
- mapStateToProps: mapStateToProps,
40363
+ mapStateToProps: mapStateToProps
39266
40364
  });
39267
40365
 
39268
40366
  var AddressForm = function AddressForm(_ref) {
@@ -42128,12 +43226,12 @@ LoginForm.mapDispatchToProps = mapDispatchToProps$5;
42128
43226
  * This source code is licensed under the MIT license found in the
42129
43227
  * LICENSE file in the root directory of this source tree.
42130
43228
  */
42131
- var b$2="function"===typeof Symbol&&Symbol.for,c$2=b$2?Symbol.for("react.element"):60103,d$1=b$2?Symbol.for("react.portal"):60106,e=b$2?Symbol.for("react.fragment"):60107,f$7=b$2?Symbol.for("react.strict_mode"):60108,g$1=b$2?Symbol.for("react.profiler"):60114,h$1=b$2?Symbol.for("react.provider"):60109,k$1=b$2?Symbol.for("react.context"):60110,l$1=b$2?Symbol.for("react.async_mode"):60111,m=b$2?Symbol.for("react.concurrent_mode"):60111,n$1=b$2?Symbol.for("react.forward_ref"):60112,p$1=b$2?Symbol.for("react.suspense"):60113,q$1=b$2?
42132
- Symbol.for("react.suspense_list"):60120,r$1=b$2?Symbol.for("react.memo"):60115,t$1=b$2?Symbol.for("react.lazy"):60116,v$1=b$2?Symbol.for("react.block"):60121,w$1=b$2?Symbol.for("react.fundamental"):60117,x$1=b$2?Symbol.for("react.responder"):60118,y$1=b$2?Symbol.for("react.scope"):60119;
42133
- function z$1(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$2:switch(a=a.type,a){case l$1:case m:case e:case g$1:case f$7:case p$1:return a;default:switch(a=a&&a.$$typeof,a){case k$1:case n$1:case t$1:case r$1:case h$1:return a;default:return u}}case d$1:return u}}}function A$1(a){return z$1(a)===m}var AsyncMode=l$1;var ConcurrentMode=m;var ContextConsumer=k$1;var ContextProvider=h$1;var Element$1=c$2;var ForwardRef=n$1;var Fragment=e;var Lazy=t$1;var Memo=r$1;var Portal=d$1;
42134
- var Profiler=g$1;var StrictMode=f$7;var Suspense=p$1;var isAsyncMode=function(a){return A$1(a)||z$1(a)===l$1};var isConcurrentMode=A$1;var isContextConsumer=function(a){return z$1(a)===k$1};var isContextProvider=function(a){return z$1(a)===h$1};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$2};var isForwardRef=function(a){return z$1(a)===n$1};var isFragment=function(a){return z$1(a)===e};var isLazy=function(a){return z$1(a)===t$1};
42135
- var isMemo=function(a){return z$1(a)===r$1};var isPortal=function(a){return z$1(a)===d$1};var isProfiler=function(a){return z$1(a)===g$1};var isStrictMode=function(a){return z$1(a)===f$7};var isSuspense=function(a){return z$1(a)===p$1};
42136
- var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g$1||a===f$7||a===p$1||a===q$1||"object"===typeof a&&null!==a&&(a.$$typeof===t$1||a.$$typeof===r$1||a.$$typeof===h$1||a.$$typeof===k$1||a.$$typeof===n$1||a.$$typeof===w$1||a.$$typeof===x$1||a.$$typeof===y$1||a.$$typeof===v$1)};var typeOf=z$1;
43229
+ var b$1="function"===typeof Symbol&&Symbol.for,c$1=b$1?Symbol.for("react.element"):60103,d=b$1?Symbol.for("react.portal"):60106,e=b$1?Symbol.for("react.fragment"):60107,f$6=b$1?Symbol.for("react.strict_mode"):60108,g=b$1?Symbol.for("react.profiler"):60114,h=b$1?Symbol.for("react.provider"):60109,k=b$1?Symbol.for("react.context"):60110,l=b$1?Symbol.for("react.async_mode"):60111,m=b$1?Symbol.for("react.concurrent_mode"):60111,n=b$1?Symbol.for("react.forward_ref"):60112,p=b$1?Symbol.for("react.suspense"):60113,q=b$1?
43230
+ Symbol.for("react.suspense_list"):60120,r=b$1?Symbol.for("react.memo"):60115,t=b$1?Symbol.for("react.lazy"):60116,v=b$1?Symbol.for("react.block"):60121,w=b$1?Symbol.for("react.fundamental"):60117,x=b$1?Symbol.for("react.responder"):60118,y=b$1?Symbol.for("react.scope"):60119;
43231
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$1:switch(a=a.type,a){case l:case m:case e:case g:case f$6:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element$1=c$1;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
43232
+ var Profiler=g;var StrictMode=f$6;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$1};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
43233
+ var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f$6};var isSuspense=function(a){return z(a)===p};
43234
+ var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f$6||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
42137
43235
 
42138
43236
  var reactIs_production_min = {
42139
43237
  AsyncMode: AsyncMode,
@@ -42504,14 +43602,14 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
42504
43602
 
42505
43603
  var ReactPropTypesSecret_1 = ReactPropTypesSecret;
42506
43604
 
42507
- var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
43605
+ var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
42508
43606
 
42509
43607
  var printWarning = function() {};
42510
43608
 
42511
43609
  if (process.env.NODE_ENV !== 'production') {
42512
43610
  var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
42513
43611
  var loggedTypeFailures = {};
42514
- var has$2 = has$1;
43612
+ var has$3 = has$2;
42515
43613
 
42516
43614
  printWarning = function(text) {
42517
43615
  var message = 'Warning: ' + text;
@@ -42541,7 +43639,7 @@ if (process.env.NODE_ENV !== 'production') {
42541
43639
  function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
42542
43640
  if (process.env.NODE_ENV !== 'production') {
42543
43641
  for (var typeSpecName in typeSpecs) {
42544
- if (has$2(typeSpecs, typeSpecName)) {
43642
+ if (has$3(typeSpecs, typeSpecName)) {
42545
43643
  var error;
42546
43644
  // Prop type validation may throw. In case they do, we don't want to
42547
43645
  // fail the render phase where it didn't fail before. So we log it.
@@ -42940,7 +44038,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
42940
44038
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
42941
44039
  }
42942
44040
  for (var key in propValue) {
42943
- if (has$1(propValue, key)) {
44041
+ if (has$2(propValue, key)) {
42944
44042
  var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
42945
44043
  if (error instanceof Error) {
42946
44044
  return error;
@@ -42977,7 +44075,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
42977
44075
  if (checkerResult == null) {
42978
44076
  return null;
42979
44077
  }
42980
- if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
44078
+ if (checkerResult.data && has$2(checkerResult.data, 'expectedType')) {
42981
44079
  expectedTypes.push(checkerResult.data.expectedType);
42982
44080
  }
42983
44081
  }
@@ -43037,7 +44135,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
43037
44135
  var allKeys = objectAssign({}, props[propName], shapeTypes);
43038
44136
  for (var key in allKeys) {
43039
44137
  var checker = shapeTypes[key];
43040
- if (has$1(shapeTypes, key) && typeof checker !== 'function') {
44138
+ if (has$2(shapeTypes, key) && typeof checker !== 'function') {
43041
44139
  return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
43042
44140
  }
43043
44141
  if (!checker) {
@@ -43775,7 +44873,7 @@ var index_esm = /*#__PURE__*/Object.freeze({
43775
44873
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
43776
44874
  */
43777
44875
 
43778
- function ownKeys$2(object, enumerableOnly) {
44876
+ function ownKeys$3(object, enumerableOnly) {
43779
44877
  var keys = Object.keys(object);
43780
44878
 
43781
44879
  if (Object.getOwnPropertySymbols) {
@@ -43791,9 +44889,9 @@ function ownKeys$2(object, enumerableOnly) {
43791
44889
  function _objectSpread2$1(target) {
43792
44890
  for (var i = 1; i < arguments.length; i++) {
43793
44891
  var source = null != arguments[i] ? arguments[i] : {};
43794
- i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
44892
+ i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
43795
44893
  _defineProperty$1(target, key, source[key]);
43796
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
44894
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
43797
44895
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
43798
44896
  });
43799
44897
  }