@thecb/components 9.1.0-beta.5 → 9.1.0-beta.7

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
@@ -38626,44 +38626,52 @@ var TableHeading_styled = styled.th.withConfig({
38626
38626
  return extraStyles;
38627
38627
  });
38628
38628
 
38629
- const validatorToPredicate = (validatorFn, emptyCase) => (
38630
- value,
38631
- ...rest
38632
- ) => (value === "" ? emptyCase : validatorFn(value, ...rest));
38629
+ const validatorToPredicate =
38630
+ (validatorFn, emptyCase) =>
38631
+ (value, ...rest) =>
38632
+ value === '' ? emptyCase : validatorFn(value, ...rest);
38633
38633
 
38634
38634
  var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
38635
38635
 
38636
+ function getDefaultExportFromCjs (x) {
38637
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
38638
+ }
38639
+
38636
38640
  var dayjs_min = {exports: {}};
38637
38641
 
38638
38642
  (function (module, exports) {
38639
- !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}));
38640
- }(dayjs_min));
38643
+ !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}));
38644
+ } (dayjs_min));
38641
38645
 
38642
- var dayjs = dayjs_min.exports;
38646
+ var dayjs_minExports = dayjs_min.exports;
38647
+ var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
38643
38648
 
38644
38649
  var customParseFormat$1 = {exports: {}};
38645
38650
 
38646
38651
  (function (module, exports) {
38647
- !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);};}}));
38648
- }(customParseFormat$1));
38652
+ !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);};}}));
38653
+ } (customParseFormat$1));
38649
38654
 
38650
- var customParseFormat = customParseFormat$1.exports;
38655
+ var customParseFormatExports = customParseFormat$1.exports;
38656
+ var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
38651
38657
 
38652
38658
  var isSameOrBefore$1 = {exports: {}};
38653
38659
 
38654
38660
  (function (module, exports) {
38655
- !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)};}}));
38656
- }(isSameOrBefore$1));
38661
+ !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)};}}));
38662
+ } (isSameOrBefore$1));
38657
38663
 
38658
- var isSameOrBefore = isSameOrBefore$1.exports;
38664
+ var isSameOrBeforeExports = isSameOrBefore$1.exports;
38665
+ var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
38659
38666
 
38660
38667
  var isSameOrAfter$1 = {exports: {}};
38661
38668
 
38662
38669
  (function (module, exports) {
38663
- !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)};}}));
38664
- }(isSameOrAfter$1));
38670
+ !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)};}}));
38671
+ } (isSameOrAfter$1));
38665
38672
 
38666
- var isSameOrAfter = isSameOrAfter$1.exports;
38673
+ var isSameOrAfterExports = isSameOrAfter$1.exports;
38674
+ var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
38667
38675
 
38668
38676
  /* eslint-disable no-unused-vars */
38669
38677
 
@@ -38679,24 +38687,24 @@ dayjs.extend(isSameOrAfter);
38679
38687
 
38680
38688
  let validatorFns = {};
38681
38689
 
38682
- const INCLUDED_IN = "validator/INCLUDED_IN";
38683
- const INCLUDED_IN_ERROR = "error/INCLUDED_IN";
38690
+ const INCLUDED_IN = 'validator/INCLUDED_IN';
38691
+ const INCLUDED_IN_ERROR = 'error/INCLUDED_IN';
38684
38692
  const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
38685
38693
  validatorFns[INCLUDED_IN] = (value, args, form) =>
38686
38694
  Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
38687
38695
 
38688
- const REQUIRED = "validator/REQUIRED";
38689
- const REQUIRED_ERROR = "error/REQUIRED";
38696
+ const REQUIRED = 'validator/REQUIRED';
38697
+ const REQUIRED_ERROR = 'error/REQUIRED';
38690
38698
  const required = createValidator(REQUIRED, REQUIRED_ERROR);
38691
- validatorFns[REQUIRED] = (value, args, form) => value !== "";
38699
+ validatorFns[REQUIRED] = (value, args, form) => value !== '';
38692
38700
 
38693
- const ONLY_INTEGERS = "validator/ONLY_INTEGERS";
38694
- const ONLY_INTEGERS_ERROR = "error/ONLY_INTEGERS";
38701
+ const ONLY_INTEGERS = 'validator/ONLY_INTEGERS';
38702
+ const ONLY_INTEGERS_ERROR = 'error/ONLY_INTEGERS';
38695
38703
  const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
38696
38704
  validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
38697
38705
 
38698
- const ONLY_NATURALS = "validator/ONLY_NATURALS";
38699
- const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
38706
+ const ONLY_NATURALS = 'validator/ONLY_NATURALS';
38707
+ const ONLY_NATURALS_ERROR = 'error/ONLY_NATURALS';
38700
38708
  const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
38701
38709
  validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
38702
38710
 
@@ -38709,8 +38717,8 @@ not tested as validation function
38709
38717
  to validate exp date instead use combo of:
38710
38718
  required(), hasLength(), isValidMonth(), dateAfterToday()
38711
38719
  */
38712
- const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
38713
- const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
38720
+ const ONLY_EXPIRATION_DATE = 'validator/ONLY_EXPIRATION_DATE';
38721
+ const ONLY_EXPIRATION_DATE_ERROR = 'error/ONLY_EXPIRATION_DATE';
38714
38722
  const onlyExpirationDate = createValidator(
38715
38723
  ONLY_EXPIRATION_DATE,
38716
38724
  ONLY_EXPIRATION_DATE_ERROR
@@ -38718,64 +38726,63 @@ const onlyExpirationDate = createValidator(
38718
38726
  validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
38719
38727
  /^(\d?\d?\/?\d?\d?)?$/.test(value);
38720
38728
 
38721
- const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
38722
- const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
38729
+ const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
38730
+ const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
38723
38731
  const numberLessThan = createValidator(
38724
38732
  NUMBER_LESS_THAN,
38725
38733
  NUMBER_LESS_THAN_ERROR
38726
38734
  );
38727
38735
  validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
38728
- if (value === "") {
38736
+ if (value === '') {
38729
38737
  return true;
38730
38738
  }
38731
38739
  return Number(value) < args[0];
38732
38740
  };
38733
38741
 
38734
- const NUMBER_LESS_THAN_OR_EQUAL_TO =
38735
- "validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
38742
+ const NUMBER_LESS_THAN_OR_EQUAL_TO = 'validator/NUMBER_LESS_THAN_OR_EQUAL_TO';
38736
38743
  const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
38737
- "error/NUMBER_LESS_THAN_OR_EQUAL_TO";
38744
+ 'error/NUMBER_LESS_THAN_OR_EQUAL_TO';
38738
38745
  const numberLessThanOrEqualTo = createValidator(
38739
38746
  NUMBER_LESS_THAN_OR_EQUAL_TO,
38740
38747
  NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
38741
38748
  );
38742
38749
  validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
38743
- if (value === "") {
38750
+ if (value === '') {
38744
38751
  return true;
38745
38752
  }
38746
38753
  return Number(value) <= args[0];
38747
38754
  };
38748
38755
 
38749
- const NUMBER_GREATER_THAN = "validator/NUMBER_GREATER_THAN";
38750
- const NUMBER_GREATER_THAN_ERROR = "error/NUMBER_GREATER_THAN";
38756
+ const NUMBER_GREATER_THAN = 'validator/NUMBER_GREATER_THAN';
38757
+ const NUMBER_GREATER_THAN_ERROR = 'error/NUMBER_GREATER_THAN';
38751
38758
  const numberGreaterThan = createValidator(
38752
38759
  NUMBER_GREATER_THAN,
38753
38760
  NUMBER_GREATER_THAN_ERROR
38754
38761
  );
38755
38762
  validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
38756
- if (value === "") {
38763
+ if (value === '') {
38757
38764
  return true;
38758
38765
  }
38759
38766
  return Number(value) > args[0];
38760
38767
  };
38761
38768
 
38762
38769
  const NUMBER_GREATER_THAN_OR_EQUAL_TO =
38763
- "validator/NUMBER_GREATER_THAN_OR_EQUAL_TO";
38770
+ 'validator/NUMBER_GREATER_THAN_OR_EQUAL_TO';
38764
38771
  const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
38765
- "error/NUMBER_GREATER_THAN_OR_EQUAL_TO";
38772
+ 'error/NUMBER_GREATER_THAN_OR_EQUAL_TO';
38766
38773
  const numberGreaterThanOrEqualTo = createValidator(
38767
38774
  NUMBER_GREATER_THAN_OR_EQUAL_TO,
38768
38775
  NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
38769
38776
  );
38770
38777
  validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
38771
- if (value === "") {
38778
+ if (value === '') {
38772
38779
  return true;
38773
38780
  }
38774
38781
  return Number(value) >= args[0];
38775
38782
  };
38776
38783
 
38777
- const MATCHES_FIELD = "validator/MATCHES_FIELD";
38778
- const MATCHES_FIELD_ERROR$1 = "error/MATCHES_FIELD";
38784
+ const MATCHES_FIELD = 'validator/MATCHES_FIELD';
38785
+ const MATCHES_FIELD_ERROR$1 = 'error/MATCHES_FIELD';
38779
38786
  const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
38780
38787
  validatorFns[MATCHES_FIELD] = (value, args, form) => {
38781
38788
  const dependentField = form[args[0]];
@@ -38788,7 +38795,7 @@ validatorFns[MATCHES_FIELD] = (value, args, form) => {
38788
38795
  return value === dependentFieldValue;
38789
38796
  };
38790
38797
 
38791
- const validateWhenErrorMessage = type =>
38798
+ const validateWhenErrorMessage = (type) =>
38792
38799
  `${type} was passed to validateWhen, but that validator type does not exist.
38793
38800
  Please check that you are only calling validator creator functions exported from
38794
38801
  redux-freeform in your form config and that you didn't forget to
@@ -38796,25 +38803,21 @@ const validateWhenErrorMessage = type =>
38796
38803
  createFormState). Also make sure you aren't passing validateWhen() to validateWhen
38797
38804
  as the primary validator.`;
38798
38805
 
38799
- const VALIDATE_WHEN = "validator/VALIDATE_WHEN";
38800
- const VALIDATE_WHEN_ERROR = "error/VALIDATE_WHEN";
38801
- const validateWhen = (
38802
- dependentValidator,
38803
- primaryValidator,
38804
- optionalFieldName
38805
- ) => ({
38806
+ const VALIDATE_WHEN = 'validator/VALIDATE_WHEN';
38807
+ const VALIDATE_WHEN_ERROR = 'error/VALIDATE_WHEN';
38808
+ const validateWhen = (dependentValidator, primaryValidator, optionalFieldName) => ({
38806
38809
  type: VALIDATE_WHEN,
38807
38810
  args: [dependentValidator, primaryValidator, optionalFieldName],
38808
- error: dependentValidator.error
38811
+ error: dependentValidator.error,
38809
38812
  });
38810
38813
  validateWhen.error = VALIDATE_WHEN_ERROR;
38811
38814
  validatorFns[VALIDATE_WHEN] = (value, args, form) => {
38812
38815
  const [dependentValidator, primaryValidator, optionalFieldName] = args;
38813
- const dependsOnOtherField = typeof optionalFieldName === "string";
38816
+ const dependsOnOtherField = typeof optionalFieldName === 'string';
38814
38817
 
38815
38818
  if (
38816
38819
  primaryValidator.type === undefined ||
38817
- typeof validatorFns[primaryValidator.type] !== "function"
38820
+ typeof validatorFns[primaryValidator.type] !== 'function'
38818
38821
  ) {
38819
38822
  throw new Error(validateWhenErrorMessage(primaryValidator.type));
38820
38823
  }
@@ -38838,26 +38841,22 @@ validatorFns[VALIDATE_WHEN] = (value, args, form) => {
38838
38841
  );
38839
38842
 
38840
38843
  return primaryPredicatePassed
38841
- ? validatorFns[dependentValidator.type](
38842
- value,
38843
- dependentValidator.args,
38844
- form
38845
- )
38844
+ ? validatorFns[dependentValidator.type](value, dependentValidator.args, form)
38846
38845
  : true;
38847
38846
  };
38848
38847
 
38849
- const validateSumErrorMessage = type =>
38848
+ const validateSumErrorMessage = (type) =>
38850
38849
  `${type} was passed to validateSum, but that validator type does not exist.
38851
38850
  Please check that you are only calling validator creator functions exported from
38852
38851
  redux-freeform in your form config and that you didn't forget to
38853
38852
  invoke the validator creator (you cannot pass the functions themselves to
38854
38853
  createFormState).`;
38855
- const VALIDATE_SUM = "validator/VALIDATE_SUM";
38856
- const VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
38854
+ const VALIDATE_SUM = 'validator/VALIDATE_SUM';
38855
+ const VALIDATE_SUM_ERROR = 'error/VALIDATE_SUM';
38857
38856
  const validateSum = (validator, fieldNamesArray) => ({
38858
38857
  type: VALIDATE_SUM,
38859
38858
  args: [validator, fieldNamesArray],
38860
- error: validator.error
38859
+ error: validator.error,
38861
38860
  });
38862
38861
  validateSum.error = VALIDATE_SUM_ERROR;
38863
38862
  validatorFns[VALIDATE_SUM] = (value, args, form) => {
@@ -38865,7 +38864,7 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
38865
38864
 
38866
38865
  if (
38867
38866
  validator.type === undefined ||
38868
- typeof validatorFns[validator.type] !== "function"
38867
+ typeof validatorFns[validator.type] !== 'function'
38869
38868
  ) {
38870
38869
  throw new Error(validateSumErrorMessage(validator.type));
38871
38870
  }
@@ -38886,37 +38885,35 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
38886
38885
  return validatorFns[validator.type](sum, validator.args, form);
38887
38886
  };
38888
38887
 
38889
- const HAS_LENGTH = "validator/HAS_LENGTH";
38890
- const HAS_LENGTH_ERROR = "error/HAS_LENGTH";
38888
+ const HAS_LENGTH = 'validator/HAS_LENGTH';
38889
+ const HAS_LENGTH_ERROR = 'error/HAS_LENGTH';
38891
38890
  const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
38892
38891
  validatorFns[HAS_LENGTH] = (value, args, form) => {
38893
- if (value === "") {
38892
+ if (value === '') {
38894
38893
  return true;
38895
38894
  }
38896
38895
  const min = args[0];
38897
38896
  const max = args[1];
38898
38897
  if (max == undefined || min == undefined) {
38899
38898
  throw new Error(
38900
- "Max and min need to be defined for hasLength, both or one of them is undefined"
38899
+ 'Max and min need to be defined for hasLength, both or one of them is undefined'
38901
38900
  );
38902
38901
  }
38903
38902
  if (max < min) {
38904
- throw new Error(
38905
- "hasLength validator was passed a min greater than the max"
38906
- );
38903
+ throw new Error('hasLength validator was passed a min greater than the max');
38907
38904
  }
38908
38905
  const valueLength = value.length;
38909
38906
  return max >= valueLength && valueLength >= min;
38910
38907
  };
38911
38908
 
38912
- const DATE_BEFORE_TODAY = "validator/DATE_BEFORE_TODAY";
38913
- const DATE_BEFORE_TODAY_ERROR = "error/DATE_BEFORE_TODAY";
38909
+ const DATE_BEFORE_TODAY = 'validator/DATE_BEFORE_TODAY';
38910
+ const DATE_BEFORE_TODAY_ERROR = 'error/DATE_BEFORE_TODAY';
38914
38911
  const dateBeforeToday = createValidator(
38915
38912
  DATE_BEFORE_TODAY,
38916
38913
  DATE_BEFORE_TODAY_ERROR
38917
38914
  );
38918
38915
  validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38919
- if (value === "") {
38916
+ if (value === '') {
38920
38917
  return true;
38921
38918
  }
38922
38919
  const dateFormat = args[0];
@@ -38925,7 +38922,7 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38925
38922
 
38926
38923
  if (dateFormat == undefined || unit == undefined) {
38927
38924
  throw new Error(
38928
- "Date format and unit need to be defined for dateBeforeToday, one or both are undefined"
38925
+ 'Date format and unit need to be defined for dateBeforeToday, one or both are undefined'
38929
38926
  );
38930
38927
  }
38931
38928
  const now = dayjs();
@@ -38937,14 +38934,14 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38937
38934
  return dateValue.isBefore(now, unit);
38938
38935
  };
38939
38936
 
38940
- const DATE_AFTER_TODAY = "validator/DATE_AFTER_TODAY";
38941
- const DATE_AFTER_TODAY_ERROR = "error/DATE_AFTER_TODAY";
38937
+ const DATE_AFTER_TODAY = 'validator/DATE_AFTER_TODAY';
38938
+ const DATE_AFTER_TODAY_ERROR = 'error/DATE_AFTER_TODAY';
38942
38939
  const dateAfterToday = createValidator(
38943
38940
  DATE_AFTER_TODAY,
38944
38941
  DATE_AFTER_TODAY_ERROR
38945
38942
  );
38946
38943
  validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38947
- if (value === "") {
38944
+ if (value === '') {
38948
38945
  return true;
38949
38946
  }
38950
38947
  const dateFormat = args[0];
@@ -38953,7 +38950,7 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38953
38950
 
38954
38951
  if (dateFormat == undefined || unit == undefined) {
38955
38952
  throw new Error(
38956
- "Date format and unit need to be defined for dateAfterToday, one or both are undefined"
38953
+ 'Date format and unit need to be defined for dateAfterToday, one or both are undefined'
38957
38954
  );
38958
38955
  }
38959
38956
  const now = dayjs();
@@ -38965,14 +38962,11 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38965
38962
  return dateValue.isAfter(now, unit);
38966
38963
  };
38967
38964
 
38968
- const IS_VALID_MONTH = "validator/IS_VALID_MONTH";
38969
- const IS_VALID_MONTH_ERROR = "error/IS_VALID_MONTH";
38970
- const isValidMonth = createValidator(
38971
- IS_VALID_MONTH,
38972
- IS_VALID_MONTH_ERROR
38973
- );
38965
+ const IS_VALID_MONTH = 'validator/IS_VALID_MONTH';
38966
+ const IS_VALID_MONTH_ERROR = 'error/IS_VALID_MONTH';
38967
+ const isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
38974
38968
  validatorFns[IS_VALID_MONTH] = (value, args, form) => {
38975
- if (value === "") {
38969
+ if (value === '') {
38976
38970
  return true;
38977
38971
  }
38978
38972
  // Function takes one argument representing the character position
@@ -38982,43 +38976,43 @@ validatorFns[IS_VALID_MONTH] = (value, args, form) => {
38982
38976
  // Only works with two digit months (01, 02, 03, etc)
38983
38977
  const monthStartPosition = parseInt(args[0]);
38984
38978
  const monthEndPosition = monthStartPosition + 2;
38985
- if (monthStartPosition === NaN) {
38986
- throw new Error("Month start position has to be a valid integer string");
38979
+ if (isNaN(monthStartPosition)) {
38980
+ throw new Error('Month start position has to be a valid integer string');
38987
38981
  }
38988
38982
  const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
38989
- if (month === NaN) {
38983
+ if (isNaN(month)) {
38990
38984
  return false;
38991
38985
  }
38992
38986
  return month >= 1 && month <= 12;
38993
38987
  };
38994
38988
 
38995
- const MATCHES_REGEX = "validator/MATCHES_REGEX";
38996
- const MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
38989
+ const MATCHES_REGEX = 'validator/MATCHES_REGEX';
38990
+ const MATCHES_REGEX_ERROR = 'error/MATCHES_REGEX';
38997
38991
  const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
38998
38992
  validatorFns[MATCHES_REGEX] = (value, args, form) => {
38999
- if (value === "") {
38993
+ if (value === '') {
39000
38994
  return true;
39001
38995
  }
39002
38996
  return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
39003
38997
  };
39004
38998
 
39005
38999
  // based on http://www.brainjar.com/js/validation/
39006
- const IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
39007
- const IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
39000
+ const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
39001
+ const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
39008
39002
  const isRoutingNumber = createValidator(
39009
39003
  IS_ROUTING_NUMBER,
39010
39004
  IS_ROUTING_NUMBER_ERROR
39011
39005
  );
39012
39006
  validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
39013
- if (value === "") {
39007
+ if (value === '') {
39014
39008
  return true;
39015
39009
  }
39016
39010
  if (value.length != 9) {
39017
39011
  return false;
39018
39012
  }
39019
39013
  const sum = value
39020
- .split("")
39021
- .map(ch => parseInt(ch))
39014
+ .split('')
39015
+ .map((ch) => parseInt(ch))
39022
39016
  .reduce((acc, cur, idx) => {
39023
39017
  switch (idx % 3) {
39024
39018
  case 0:
@@ -39032,69 +39026,69 @@ validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
39032
39026
  return sum != 0 && sum % 10 == 0;
39033
39027
  };
39034
39028
 
39035
- const HAS_NUMBER = "validator/HAS_NUMBER";
39036
- const HAS_NUMBER_ERROR$1 = "error/HAS_NUMBER";
39029
+ const HAS_NUMBER = 'validator/HAS_NUMBER';
39030
+ const HAS_NUMBER_ERROR$1 = 'error/HAS_NUMBER';
39037
39031
  const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
39038
39032
  validatorFns[HAS_NUMBER] = (value, args, form) => {
39039
- if (value === "") {
39033
+ if (value === '') {
39040
39034
  return true;
39041
39035
  }
39042
39036
  return new RegExp(/[0-9]/).test(value);
39043
39037
  };
39044
39038
 
39045
- const HAS_LOWERCASE_LETTER = "validator/HAS_LOWERCASE_LETTER";
39046
- const HAS_LOWERCASE_LETTER_ERROR$1 = "error/HAS_LOWERCASE_LETTER";
39039
+ const HAS_LOWERCASE_LETTER = 'validator/HAS_LOWERCASE_LETTER';
39040
+ const HAS_LOWERCASE_LETTER_ERROR$1 = 'error/HAS_LOWERCASE_LETTER';
39047
39041
  const hasLowercaseLetter = createValidator(
39048
39042
  HAS_LOWERCASE_LETTER,
39049
39043
  HAS_LOWERCASE_LETTER_ERROR$1
39050
39044
  );
39051
39045
  validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
39052
- if (value === "") {
39046
+ if (value === '') {
39053
39047
  return true;
39054
39048
  }
39055
39049
  return new RegExp(/[a-z]/).test(value);
39056
39050
  };
39057
39051
 
39058
- const HAS_UPPERCASE_LETTER = "validator/HAS_UPPERCASE_LETTER";
39059
- const HAS_UPPERCASE_LETTER_ERROR$1 = "error/HAS_UPPERCASE_LETTER";
39052
+ const HAS_UPPERCASE_LETTER = 'validator/HAS_UPPERCASE_LETTER';
39053
+ const HAS_UPPERCASE_LETTER_ERROR$1 = 'error/HAS_UPPERCASE_LETTER';
39060
39054
  const hasUppercaseLetter = createValidator(
39061
39055
  HAS_UPPERCASE_LETTER,
39062
39056
  HAS_UPPERCASE_LETTER_ERROR$1
39063
39057
  );
39064
39058
  validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
39065
- if (value === "") {
39059
+ if (value === '') {
39066
39060
  return true;
39067
39061
  }
39068
39062
  return new RegExp(/[A-Z]/).test(value);
39069
39063
  };
39070
39064
 
39071
- const HAS_SPECIAL_CHARACTER = "validator/HAS_SPECIAL_CHARACTER";
39072
- const HAS_SPECIAL_CHARACTER_ERROR$1 = "error/HAS_SPECIAL_CHARACTER";
39065
+ const HAS_SPECIAL_CHARACTER = 'validator/HAS_SPECIAL_CHARACTER';
39066
+ const HAS_SPECIAL_CHARACTER_ERROR$1 = 'error/HAS_SPECIAL_CHARACTER';
39073
39067
  const hasSpecialCharacter = createValidator(
39074
39068
  HAS_SPECIAL_CHARACTER,
39075
39069
  HAS_SPECIAL_CHARACTER_ERROR$1
39076
39070
  );
39077
39071
  validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
39078
- if (value === "") {
39072
+ if (value === '') {
39079
39073
  return true;
39080
39074
  }
39081
39075
  return new RegExp(/[!@#$%^&*.?]/).test(value);
39082
39076
  };
39083
39077
 
39084
- const IS_PROBABLY_EMAIL = "validator/IS_PROBABLY_EMAIL";
39085
- const IS_PROBABLY_EMAIL_ERROR = "error/IS_PROBABLY_EMAIL";
39078
+ const IS_PROBABLY_EMAIL = 'validator/IS_PROBABLY_EMAIL';
39079
+ const IS_PROBABLY_EMAIL_ERROR = 'error/IS_PROBABLY_EMAIL';
39086
39080
  const isProbablyEmail = createValidator(
39087
39081
  IS_PROBABLY_EMAIL,
39088
39082
  IS_PROBABLY_EMAIL_ERROR
39089
39083
  );
39090
39084
  validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
39091
- if (value === "") {
39085
+ if (value === '') {
39092
39086
  return true;
39093
39087
  }
39094
39088
  return new RegExp(/^\S+@\S+\.\S+$/).test(value);
39095
39089
  };
39096
39090
 
39097
- const runValidatorErrorMessage = type =>
39091
+ const runValidatorErrorMessage = (type) =>
39098
39092
  `${type} was passed to runValidator, but that validator type does not exist.
39099
39093
  Please check that you are only calling validator creator functions exported from
39100
39094
  redux-freeform in your form config and that you didn't forget to
@@ -39109,1165 +39103,53 @@ const runValidator = (validator, value, form) => {
39109
39103
  return validatorFn(value, validator.args, form) ? null : validator.error;
39110
39104
  };
39111
39105
 
39112
- const _computeErrors = (fieldName, form, validators) => {
39106
+ const runFormValidators = (fieldName, form, validators) => {
39113
39107
  return validators
39114
- .map(v => runValidator(v, form[fieldName].rawValue, form))
39115
- .filter(x => x !== null);
39108
+ .map((v) => runValidator(v, form[fieldName].rawValue, form))
39109
+ .filter((x) => x !== null);
39116
39110
  };
39117
39111
 
39118
39112
  const computeConstraints = (fieldName, form) => {
39119
39113
  const constraints = form[fieldName].constraints;
39120
- return _computeErrors(fieldName, form, constraints);
39114
+ return runFormValidators(fieldName, form, constraints);
39121
39115
  };
39122
39116
 
39123
39117
  const computeErrors = (fieldName, form) => {
39124
39118
  const validators = form[fieldName].validators;
39125
- return _computeErrors(fieldName, form, validators);
39126
- };
39127
-
39128
- var obj;
39129
- var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
39130
- var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
39131
- var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
39132
- function isDraft(value) {
39133
- return !!value && !!value[DRAFT_STATE];
39134
- }
39135
- function isDraftable(value) {
39136
- if (!value) { return false; }
39137
- return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
39138
- }
39139
- function isPlainObject(value) {
39140
- if (!value || typeof value !== "object") { return false; }
39141
- if (Array.isArray(value)) { return true; }
39142
- var proto = Object.getPrototypeOf(value);
39143
- return !proto || proto === Object.prototype;
39144
- }
39145
- var assign = Object.assign || function assign(target, value) {
39146
- for (var key in value) {
39147
- if (has$1(value, key)) {
39148
- target[key] = value[key];
39149
- }
39150
- }
39151
-
39152
- return target;
39153
- };
39154
- 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;
39155
- function shallowCopy(base, invokeGetters) {
39156
- if ( invokeGetters === void 0 ) invokeGetters = false;
39157
-
39158
- if (Array.isArray(base)) { return base.slice(); }
39159
- var clone = Object.create(Object.getPrototypeOf(base));
39160
- ownKeys$2(base).forEach(function (key) {
39161
- if (key === DRAFT_STATE) {
39162
- return; // Never copy over draft state.
39163
- }
39164
-
39165
- var desc = Object.getOwnPropertyDescriptor(base, key);
39166
- var value = desc.value;
39167
-
39168
- if (desc.get) {
39169
- if (!invokeGetters) {
39170
- throw new Error("Immer drafts cannot have computed properties");
39171
- }
39172
-
39173
- value = desc.get.call(base);
39174
- }
39175
-
39176
- if (desc.enumerable) {
39177
- clone[key] = value;
39178
- } else {
39179
- Object.defineProperty(clone, key, {
39180
- value: value,
39181
- writable: true,
39182
- configurable: true
39183
- });
39184
- }
39185
- });
39186
- return clone;
39187
- }
39188
- function each(value, cb) {
39189
- if (Array.isArray(value)) {
39190
- for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
39191
- } else {
39192
- ownKeys$2(value).forEach(function (key) { return cb(key, value[key], value); });
39193
- }
39194
- }
39195
- function isEnumerable(base, prop) {
39196
- var desc = Object.getOwnPropertyDescriptor(base, prop);
39197
- return !!desc && desc.enumerable;
39198
- }
39199
- function has$1(thing, prop) {
39200
- return Object.prototype.hasOwnProperty.call(thing, prop);
39201
- }
39202
- function is(x, y) {
39203
- // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
39204
- if (x === y) {
39205
- return x !== 0 || 1 / x === 1 / y;
39206
- } else {
39207
- return x !== x && y !== y;
39208
- }
39209
- }
39210
- function clone(obj) {
39211
- if (!isDraftable(obj)) { return obj; }
39212
- if (Array.isArray(obj)) { return obj.map(clone); }
39213
- var cloned = Object.create(Object.getPrototypeOf(obj));
39214
-
39215
- for (var key in obj) { cloned[key] = clone(obj[key]); }
39216
-
39217
- return cloned;
39218
- }
39219
-
39220
- /** Each scope represents a `produce` call. */
39221
-
39222
- var ImmerScope = function ImmerScope(parent) {
39223
- this.drafts = [];
39224
- this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
39225
- // need to prevent auto-freezing so the unowned draft can be finalized.
39226
-
39227
- this.canAutoFreeze = true; // To avoid prototype lookups:
39228
-
39229
- this.patches = null;
39230
- };
39231
-
39232
- ImmerScope.prototype.usePatches = function usePatches (patchListener) {
39233
- if (patchListener) {
39234
- this.patches = [];
39235
- this.inversePatches = [];
39236
- this.patchListener = patchListener;
39237
- }
39238
- };
39239
-
39240
- ImmerScope.prototype.revoke = function revoke$1 () {
39241
- this.leave();
39242
- this.drafts.forEach(revoke);
39243
- this.drafts = null; // Make draft-related methods throw.
39244
- };
39245
-
39246
- ImmerScope.prototype.leave = function leave () {
39247
- if (this === ImmerScope.current) {
39248
- ImmerScope.current = this.parent;
39249
- }
39250
- };
39251
- ImmerScope.current = null;
39252
-
39253
- ImmerScope.enter = function () {
39254
- return this.current = new ImmerScope(this.current);
39255
- };
39256
-
39257
- function revoke(draft) {
39258
- draft[DRAFT_STATE].revoke();
39259
- }
39260
-
39261
- // but share them all instead
39262
-
39263
- var descriptors$1 = {};
39264
- function willFinalize(scope, result, isReplaced) {
39265
- scope.drafts.forEach(function (draft) {
39266
- draft[DRAFT_STATE].finalizing = true;
39267
- });
39268
-
39269
- if (!isReplaced) {
39270
- if (scope.patches) {
39271
- markChangesRecursively(scope.drafts[0]);
39272
- } // This is faster when we don't care about which attributes changed.
39273
-
39274
-
39275
- markChangesSweep(scope.drafts);
39276
- } // When a child draft is returned, look for changes.
39277
- else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {
39278
- markChangesSweep(scope.drafts);
39279
- }
39280
- }
39281
- function createProxy(base, parent) {
39282
- var isArray = Array.isArray(base);
39283
- var draft = clonePotentialDraft(base);
39284
- each(draft, function (prop) {
39285
- proxyProperty(draft, prop, isArray || isEnumerable(base, prop));
39286
- }); // See "proxy.js" for property documentation.
39287
-
39288
- var scope = parent ? parent.scope : ImmerScope.current;
39289
- var state = {
39290
- scope: scope,
39291
- modified: false,
39292
- finalizing: false,
39293
- // es5 only
39294
- finalized: false,
39295
- assigned: {},
39296
- parent: parent,
39297
- base: base,
39298
- draft: draft,
39299
- copy: null,
39300
- revoke: revoke$1,
39301
- revoked: false // es5 only
39302
-
39303
- };
39304
- createHiddenProperty(draft, DRAFT_STATE, state);
39305
- scope.drafts.push(draft);
39306
- return draft;
39307
- }
39308
-
39309
- function revoke$1() {
39310
- this.revoked = true;
39311
- }
39312
-
39313
- function source(state) {
39314
- return state.copy || state.base;
39315
- } // Access a property without creating an Immer draft.
39316
-
39317
-
39318
- function peek(draft, prop) {
39319
- var state = draft[DRAFT_STATE];
39320
-
39321
- if (state && !state.finalizing) {
39322
- state.finalizing = true;
39323
- var value = draft[prop];
39324
- state.finalizing = false;
39325
- return value;
39326
- }
39327
-
39328
- return draft[prop];
39329
- }
39330
-
39331
- function get$1(state, prop) {
39332
- assertUnrevoked(state);
39333
- var value = peek(source(state), prop);
39334
- if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
39335
-
39336
- if (value === peek(state.base, prop) && isDraftable(value)) {
39337
- prepareCopy(state);
39338
- return state.copy[prop] = createProxy(value, state);
39339
- }
39340
-
39341
- return value;
39342
- }
39343
-
39344
- function set$1(state, prop, value) {
39345
- assertUnrevoked(state);
39346
- state.assigned[prop] = true;
39347
-
39348
- if (!state.modified) {
39349
- if (is(value, peek(source(state), prop))) { return; }
39350
- markChanged(state);
39351
- prepareCopy(state);
39352
- }
39353
-
39354
- state.copy[prop] = value;
39355
- }
39356
-
39357
- function markChanged(state) {
39358
- if (!state.modified) {
39359
- state.modified = true;
39360
- if (state.parent) { markChanged(state.parent); }
39361
- }
39362
- }
39363
-
39364
- function prepareCopy(state) {
39365
- if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
39366
- }
39367
-
39368
- function clonePotentialDraft(base) {
39369
- var state = base && base[DRAFT_STATE];
39370
-
39371
- if (state) {
39372
- state.finalizing = true;
39373
- var draft = shallowCopy(state.draft, true);
39374
- state.finalizing = false;
39375
- return draft;
39376
- }
39377
-
39378
- return shallowCopy(base);
39379
- }
39380
-
39381
- function proxyProperty(draft, prop, enumerable) {
39382
- var desc = descriptors$1[prop];
39383
-
39384
- if (desc) {
39385
- desc.enumerable = enumerable;
39386
- } else {
39387
- descriptors$1[prop] = desc = {
39388
- configurable: true,
39389
- enumerable: enumerable,
39390
-
39391
- get: function get$1$1() {
39392
- return get$1(this[DRAFT_STATE], prop);
39393
- },
39394
-
39395
- set: function set$1$1(value) {
39396
- set$1(this[DRAFT_STATE], prop, value);
39397
- }
39398
-
39399
- };
39400
- }
39401
-
39402
- Object.defineProperty(draft, prop, desc);
39403
- }
39404
-
39405
- function assertUnrevoked(state) {
39406
- 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))); }
39407
- } // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
39408
-
39409
-
39410
- function markChangesSweep(drafts) {
39411
- // The natural order of drafts in the `scope` array is based on when they
39412
- // were accessed. By processing drafts in reverse natural order, we have a
39413
- // better chance of processing leaf nodes first. When a leaf node is known to
39414
- // have changed, we can avoid any traversal of its ancestor nodes.
39415
- for (var i = drafts.length - 1; i >= 0; i--) {
39416
- var state = drafts[i][DRAFT_STATE];
39417
-
39418
- if (!state.modified) {
39419
- if (Array.isArray(state.base)) {
39420
- if (hasArrayChanges(state)) { markChanged(state); }
39421
- } else if (hasObjectChanges(state)) { markChanged(state); }
39422
- }
39423
- }
39424
- }
39425
-
39426
- function markChangesRecursively(object) {
39427
- if (!object || typeof object !== "object") { return; }
39428
- var state = object[DRAFT_STATE];
39429
- if (!state) { return; }
39430
- var base = state.base;
39431
- var draft = state.draft;
39432
- var assigned = state.assigned;
39433
-
39434
- if (!Array.isArray(object)) {
39435
- // Look for added keys.
39436
- Object.keys(draft).forEach(function (key) {
39437
- // The `undefined` check is a fast path for pre-existing keys.
39438
- if (base[key] === undefined && !has$1(base, key)) {
39439
- assigned[key] = true;
39440
- markChanged(state);
39441
- } else if (!assigned[key]) {
39442
- // Only untouched properties trigger recursion.
39443
- markChangesRecursively(draft[key]);
39444
- }
39445
- }); // Look for removed keys.
39446
-
39447
- Object.keys(base).forEach(function (key) {
39448
- // The `undefined` check is a fast path for pre-existing keys.
39449
- if (draft[key] === undefined && !has$1(draft, key)) {
39450
- assigned[key] = false;
39451
- markChanged(state);
39452
- }
39453
- });
39454
- } else if (hasArrayChanges(state)) {
39455
- markChanged(state);
39456
- assigned.length = true;
39457
-
39458
- if (draft.length < base.length) {
39459
- for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
39460
- } else {
39461
- for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
39462
- }
39463
-
39464
- for (var i$2 = 0; i$2 < draft.length; i$2++) {
39465
- // Only untouched indices trigger recursion.
39466
- if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
39467
- }
39468
- }
39469
- }
39470
-
39471
- function hasObjectChanges(state) {
39472
- var base = state.base;
39473
- var draft = state.draft; // Search for added keys and changed keys. Start at the back, because
39474
- // non-numeric keys are ordered by time of definition on the object.
39475
-
39476
- var keys = Object.keys(draft);
39477
-
39478
- for (var i = keys.length - 1; i >= 0; i--) {
39479
- var key = keys[i];
39480
- var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.
39481
-
39482
- if (baseValue === undefined && !has$1(base, key)) {
39483
- return true;
39484
- } // Once a base key is deleted, future changes go undetected, because its
39485
- // descriptor is erased. This branch detects any missed changes.
39486
- else {
39487
- var value = draft[key];
39488
- var state$1 = value && value[DRAFT_STATE];
39489
-
39490
- if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {
39491
- return true;
39492
- }
39493
- }
39494
- } // At this point, no keys were added or changed.
39495
- // Compare key count to determine if keys were deleted.
39496
-
39497
-
39498
- return keys.length !== Object.keys(base).length;
39499
- }
39500
-
39501
- function hasArrayChanges(state) {
39502
- var draft = state.draft;
39503
- if (draft.length !== state.base.length) { return true; } // See #116
39504
- // If we first shorten the length, our array interceptors will be removed.
39505
- // If after that new items are added, result in the same original length,
39506
- // those last items will have no intercepting property.
39507
- // So if there is no own descriptor on the last position, we know that items were removed and added
39508
- // N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
39509
- // the last one
39510
-
39511
- var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
39512
-
39513
- 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
39514
-
39515
- return false;
39516
- }
39517
-
39518
- function createHiddenProperty(target, prop, value) {
39519
- Object.defineProperty(target, prop, {
39520
- value: value,
39521
- enumerable: false,
39522
- writable: true
39523
- });
39524
- }
39525
-
39526
- var legacyProxy = /*#__PURE__*/Object.freeze({
39527
- willFinalize: willFinalize,
39528
- createProxy: createProxy
39529
- });
39530
-
39531
- function willFinalize$1() {}
39532
- function createProxy$1(base, parent) {
39533
- var scope = parent ? parent.scope : ImmerScope.current;
39534
- var state = {
39535
- // Track which produce call this is associated with.
39536
- scope: scope,
39537
- // True for both shallow and deep changes.
39538
- modified: false,
39539
- // Used during finalization.
39540
- finalized: false,
39541
- // Track which properties have been assigned (true) or deleted (false).
39542
- assigned: {},
39543
- // The parent draft state.
39544
- parent: parent,
39545
- // The base state.
39546
- base: base,
39547
- // The base proxy.
39548
- draft: null,
39549
- // Any property proxies.
39550
- drafts: {},
39551
- // The base copy with any updated values.
39552
- copy: null,
39553
- // Called by the `produce` function.
39554
- revoke: null
39555
- };
39556
- var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,
39557
- // although state itself is an object
39558
- Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
39559
- var revoke = ref.revoke;
39560
- var proxy = ref.proxy;
39561
- state.draft = proxy;
39562
- state.revoke = revoke;
39563
- scope.drafts.push(proxy);
39564
- return proxy;
39565
- }
39566
- var objectTraps = {
39567
- get: get$1$1,
39568
-
39569
- has: function has(target, prop) {
39570
- return prop in source$1(target);
39571
- },
39572
-
39573
- ownKeys: function ownKeys(target) {
39574
- return Reflect.ownKeys(source$1(target));
39575
- },
39576
-
39577
- set: set$1$1,
39578
- deleteProperty: deleteProperty,
39579
- getOwnPropertyDescriptor: getOwnPropertyDescriptor$2,
39580
-
39581
- defineProperty: function defineProperty() {
39582
- throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
39583
- },
39584
-
39585
- getPrototypeOf: function getPrototypeOf(target) {
39586
- return Object.getPrototypeOf(target.base);
39587
- },
39588
-
39589
- setPrototypeOf: function setPrototypeOf() {
39590
- throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
39591
- }
39592
-
39593
- };
39594
- var arrayTraps = {};
39595
- each(objectTraps, function (key, fn) {
39596
- arrayTraps[key] = function () {
39597
- arguments[0] = arguments[0][0];
39598
- return fn.apply(this, arguments);
39599
- };
39600
- });
39601
-
39602
- arrayTraps.deleteProperty = function (state, prop) {
39603
- if (isNaN(parseInt(prop))) {
39604
- throw new Error("Immer only supports deleting array indices"); // prettier-ignore
39605
- }
39606
-
39607
- return objectTraps.deleteProperty.call(this, state[0], prop);
39608
- };
39609
-
39610
- arrayTraps.set = function (state, prop, value) {
39611
- if (prop !== "length" && isNaN(parseInt(prop))) {
39612
- throw new Error("Immer only supports setting array indices and the 'length' property"); // prettier-ignore
39613
- }
39614
-
39615
- return objectTraps.set.call(this, state[0], prop, value);
39616
- }; // returns the object we should be reading the current value from, which is base, until some change has been made
39617
-
39618
-
39619
- function source$1(state) {
39620
- return state.copy || state.base;
39621
- } // Access a property without creating an Immer draft.
39622
-
39623
-
39624
- function peek$1(draft, prop) {
39625
- var state = draft[DRAFT_STATE];
39626
- var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);
39627
- return desc && desc.value;
39628
- }
39629
-
39630
- function get$1$1(state, prop) {
39631
- if (prop === DRAFT_STATE) { return state; }
39632
- var drafts = state.drafts; // Check for existing draft in unmodified state.
39633
-
39634
- if (!state.modified && has$1(drafts, prop)) {
39635
- return drafts[prop];
39636
- }
39637
-
39638
- var value = source$1(state)[prop];
39639
-
39640
- if (state.finalized || !isDraftable(value)) {
39641
- return value;
39642
- } // Check for existing draft in modified state.
39643
-
39644
-
39645
- if (state.modified) {
39646
- // Assigned values are never drafted. This catches any drafts we created, too.
39647
- if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
39648
-
39649
- drafts = state.copy;
39650
- }
39651
-
39652
- return drafts[prop] = createProxy$1(value, state);
39653
- }
39654
-
39655
- function set$1$1(state, prop, value) {
39656
- if (!state.modified) {
39657
- var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
39658
- // never be undefined, so we can avoid the `in` operator. Lastly, truthy
39659
- // values may be drafts, but falsy values are never drafts.
39660
-
39661
- var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
39662
- if (isUnchanged) { return true; }
39663
- markChanged$1(state);
39664
- }
39665
-
39666
- state.assigned[prop] = true;
39667
- state.copy[prop] = value;
39668
- return true;
39669
- }
39670
-
39671
- function deleteProperty(state, prop) {
39672
- // The `undefined` check is a fast path for pre-existing keys.
39673
- if (peek$1(state.base, prop) !== undefined || prop in state.base) {
39674
- state.assigned[prop] = false;
39675
- markChanged$1(state);
39676
- } else if (state.assigned[prop]) {
39677
- // if an originally not assigned property was deleted
39678
- delete state.assigned[prop];
39679
- }
39680
-
39681
- if (state.copy) { delete state.copy[prop]; }
39682
- return true;
39683
- } // Note: We never coerce `desc.value` into an Immer draft, because we can't make
39684
- // the same guarantee in ES5 mode.
39685
-
39686
-
39687
- function getOwnPropertyDescriptor$2(state, prop) {
39688
- var owner = source$1(state);
39689
- var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
39690
-
39691
- if (desc) {
39692
- desc.writable = true;
39693
- desc.configurable = !Array.isArray(owner) || prop !== "length";
39694
- }
39695
-
39696
- return desc;
39697
- }
39698
-
39699
- function markChanged$1(state) {
39700
- if (!state.modified) {
39701
- state.modified = true;
39702
- state.copy = assign(shallowCopy(state.base), state.drafts);
39703
- state.drafts = null;
39704
- if (state.parent) { markChanged$1(state.parent); }
39705
- }
39706
- }
39707
-
39708
- var modernProxy = /*#__PURE__*/Object.freeze({
39709
- willFinalize: willFinalize$1,
39710
- createProxy: createProxy$1
39711
- });
39712
-
39713
- function generatePatches(state, basePath, patches, inversePatches) {
39714
- Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);
39715
- }
39716
-
39717
- function generateArrayPatches(state, basePath, patches, inversePatches) {
39718
- var assign, assign$1;
39719
-
39720
- var base = state.base;
39721
- var copy = state.copy;
39722
- var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
39723
-
39724
- if (copy.length < base.length) {
39725
- (assign = [copy, base], base = assign[0], copy = assign[1]);
39726
- (assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
39727
- }
39728
-
39729
- var delta = copy.length - base.length; // Find the first replaced index.
39730
-
39731
- var start = 0;
39732
-
39733
- while (base[start] === copy[start] && start < base.length) {
39734
- ++start;
39735
- } // Find the last replaced index. Search from the end to optimize splice patches.
39736
-
39737
-
39738
- var end = base.length;
39739
-
39740
- while (end > start && base[end - 1] === copy[end + delta - 1]) {
39741
- --end;
39742
- } // Process replaced indices.
39743
-
39744
-
39745
- for (var i = start; i < end; ++i) {
39746
- if (assigned[i] && copy[i] !== base[i]) {
39747
- var path = basePath.concat([i]);
39748
- patches.push({
39749
- op: "replace",
39750
- path: path,
39751
- value: copy[i]
39752
- });
39753
- inversePatches.push({
39754
- op: "replace",
39755
- path: path,
39756
- value: base[i]
39757
- });
39758
- }
39759
- }
39760
-
39761
- var replaceCount = patches.length; // Process added indices.
39762
-
39763
- for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
39764
- var path$1 = basePath.concat([i$1]);
39765
- patches[replaceCount + i$1 - end] = {
39766
- op: "add",
39767
- path: path$1,
39768
- value: copy[i$1]
39769
- };
39770
- inversePatches.push({
39771
- op: "remove",
39772
- path: path$1
39773
- });
39774
- }
39775
- }
39776
-
39777
- function generateObjectPatches(state, basePath, patches, inversePatches) {
39778
- var base = state.base;
39779
- var copy = state.copy;
39780
- each(state.assigned, function (key, assignedValue) {
39781
- var origValue = base[key];
39782
- var value = copy[key];
39783
- var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
39784
- if (origValue === value && op === "replace") { return; }
39785
- var path = basePath.concat(key);
39786
- patches.push(op === "remove" ? {
39787
- op: op,
39788
- path: path
39789
- } : {
39790
- op: op,
39791
- path: path,
39792
- value: value
39793
- });
39794
- inversePatches.push(op === "add" ? {
39795
- op: "remove",
39796
- path: path
39797
- } : op === "remove" ? {
39798
- op: "add",
39799
- path: path,
39800
- value: origValue
39801
- } : {
39802
- op: "replace",
39803
- path: path,
39804
- value: origValue
39805
- });
39806
- });
39807
- }
39808
-
39809
- var applyPatches = function (draft, patches) {
39810
- for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
39811
- var patch = list[i$1];
39812
-
39813
- var path = patch.path;
39814
- var op = patch.op;
39815
- var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
39816
-
39817
- if (!path.length) { throw new Error("Illegal state"); }
39818
- var base = draft;
39819
-
39820
- for (var i = 0; i < path.length - 1; i++) {
39821
- base = base[path[i]];
39822
- if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
39823
- }
39824
-
39825
- var key = path[path.length - 1];
39826
-
39827
- switch (op) {
39828
- case "replace":
39829
- // if value is an object, then it's assigned by reference
39830
- // in the following add or remove ops, the value field inside the patch will also be modifyed
39831
- // so we use value from the cloned patch
39832
- base[key] = value;
39833
- break;
39834
-
39835
- case "add":
39836
- if (Array.isArray(base)) {
39837
- // TODO: support "foo/-" paths for appending to an array
39838
- base.splice(key, 0, value);
39839
- } else {
39840
- base[key] = value;
39841
- }
39842
-
39843
- break;
39844
-
39845
- case "remove":
39846
- if (Array.isArray(base)) {
39847
- base.splice(key, 1);
39848
- } else {
39849
- delete base[key];
39850
- }
39851
-
39852
- break;
39853
-
39854
- default:
39855
- throw new Error("Unsupported patch operation: " + op);
39856
- }
39857
- }
39858
-
39859
- return draft;
39119
+ return runFormValidators(fieldName, form, validators);
39860
39120
  };
39861
39121
 
39862
- function verifyMinified() {}
39863
-
39864
- var configDefaults = {
39865
- useProxies: typeof Proxy !== "undefined" && typeof Reflect !== "undefined",
39866
- autoFreeze: typeof process !== "undefined" ? process.env.NODE_ENV !== "production" : verifyMinified.name === "verifyMinified",
39867
- onAssign: null,
39868
- onDelete: null,
39869
- onCopy: null
39870
- };
39871
- var Immer = function Immer(config) {
39872
- assign(this, configDefaults, config);
39873
- this.setUseProxies(this.useProxies);
39874
- this.produce = this.produce.bind(this);
39875
- };
39876
-
39877
- Immer.prototype.produce = function produce (base, recipe, patchListener) {
39878
- var this$1$1 = this;
39879
-
39880
- // curried invocation
39881
- if (typeof base === "function" && typeof recipe !== "function") {
39882
- var defaultBase = recipe;
39883
- recipe = base;
39884
- var self = this;
39885
- return function curriedProduce(base) {
39886
- var this$1$1 = this;
39887
- if ( base === void 0 ) base = defaultBase;
39888
- var args = [], len = arguments.length - 1;
39889
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
39890
-
39891
- return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
39892
- };
39893
- } // prettier-ignore
39894
-
39895
-
39896
- {
39897
- if (typeof recipe !== "function") {
39898
- throw new Error("The first or second argument to `produce` must be a function");
39899
- }
39900
-
39901
- if (patchListener !== undefined && typeof patchListener !== "function") {
39902
- throw new Error("The third argument to `produce` must be a function or undefined");
39903
- }
39904
- }
39905
- var result; // Only plain objects, arrays, and "immerable classes" are drafted.
39906
-
39907
- if (isDraftable(base)) {
39908
- var scope = ImmerScope.enter();
39909
- var proxy = this.createProxy(base);
39910
- var hasError = true;
39911
-
39912
- try {
39913
- result = recipe(proxy);
39914
- hasError = false;
39915
- } finally {
39916
- // finally instead of catch + rethrow better preserves original stack
39917
- if (hasError) { scope.revoke(); }else { scope.leave(); }
39918
- }
39919
-
39920
- if (result instanceof Promise) {
39921
- return result.then(function (result) {
39922
- scope.usePatches(patchListener);
39923
- return this$1$1.processResult(result, scope);
39924
- }, function (error) {
39925
- scope.revoke();
39926
- throw error;
39927
- });
39928
- }
39929
-
39930
- scope.usePatches(patchListener);
39931
- return this.processResult(result, scope);
39932
- } else {
39933
- result = recipe(base);
39934
- if (result === undefined) { return base; }
39935
- return result !== NOTHING ? result : undefined;
39122
+ const computeErrorEntries = (formState) => {
39123
+ const fields = Object.entries(formState);
39124
+ for (let entry of fields) {
39125
+ let fieldName = entry[0];
39126
+ let errors = computeErrors(fieldName, formState);
39127
+ formState[fieldName].errors = errors;
39128
+ formState[fieldName].hasErrors = errors.length > 0;
39936
39129
  }
39937
39130
  };
39938
39131
 
39939
- Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
39940
- var this$1$1 = this;
39941
-
39942
- if (typeof arg1 === "function") {
39943
- return function (state) {
39944
- var args = [], len = arguments.length - 1;
39945
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
39946
-
39947
- return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
39948
- };
39949
- } // non-curried form
39950
-
39951
-
39952
- if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
39953
- var patches, inversePatches;
39954
- var nextState = this.produce(arg1, arg2, function (p, ip) {
39955
- patches = p;
39956
- inversePatches = ip;
39957
- });
39958
- return [nextState, patches, inversePatches];
39959
- };
39960
-
39961
- Immer.prototype.createDraft = function createDraft (base) {
39962
- if (!isDraftable(base)) {
39963
- throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
39964
- }
39965
-
39966
- var scope = ImmerScope.enter();
39967
- var proxy = this.createProxy(base);
39968
- proxy[DRAFT_STATE].isManual = true;
39969
- scope.leave();
39970
- return proxy;
39971
- };
39972
-
39973
- Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
39974
- var state = draft && draft[DRAFT_STATE];
39975
-
39976
- if (!state || !state.isManual) {
39977
- throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`"); // prettier-ignore
39978
- }
39979
-
39980
- if (state.finalized) {
39981
- throw new Error("The given draft is already finalized"); // prettier-ignore
39132
+ const computeDirtyEntries = (formState, changedFieldName) => {
39133
+ const fields = Object.entries(formState);
39134
+ for (let entry of fields) {
39135
+ let fieldName = entry[0];
39136
+ let field = entry[1];
39137
+ let dirty = fieldName === changedFieldName ? true : field.dirty;
39138
+ formState[fieldName].dirty = dirty;
39982
39139
  }
39983
-
39984
- var scope = state.scope;
39985
- scope.usePatches(patchListener);
39986
- return this.processResult(undefined, scope);
39987
39140
  };
39988
39141
 
39989
- Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
39990
- this.autoFreeze = value;
39991
- };
39142
+ 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;
39992
39143
 
39993
- Immer.prototype.setUseProxies = function setUseProxies (value) {
39994
- this.useProxies = value;
39995
- assign(this, value ? modernProxy : legacyProxy);
39996
- };
39997
-
39998
- Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
39999
- // If a patch replaces the entire state, take that replacement as base
40000
- // before applying patches
40001
- var i;
40002
-
40003
- for (i = patches.length - 1; i >= 0; i--) {
40004
- var patch = patches[i];
40005
-
40006
- if (patch.path.length === 0 && patch.op === "replace") {
40007
- base = patch.value;
40008
- break;
40009
- }
40010
- }
40011
-
40012
- if (isDraft(base)) {
40013
- // N.B: never hits if some patch a replacement, patches are never drafts
40014
- return applyPatches(base, patches);
40015
- } // Otherwise, produce a copy of the base state.
40016
-
40017
-
40018
- return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
40019
- };
40020
- /** @internal */
40021
-
40022
-
40023
- Immer.prototype.processResult = function processResult (result, scope) {
40024
- var baseDraft = scope.drafts[0];
40025
- var isReplaced = result !== undefined && result !== baseDraft;
40026
- this.willFinalize(scope, result, isReplaced);
40027
-
40028
- if (isReplaced) {
40029
- if (baseDraft[DRAFT_STATE].modified) {
40030
- scope.revoke();
40031
- 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
40032
- }
40033
-
40034
- if (isDraftable(result)) {
40035
- // Finalize the result in case it contains (or is) a subset of the draft.
40036
- result = this.finalize(result, null, scope);
40037
- }
40038
-
40039
- if (scope.patches) {
40040
- scope.patches.push({
40041
- op: "replace",
40042
- path: [],
40043
- value: result
40044
- });
40045
- scope.inversePatches.push({
40046
- op: "replace",
40047
- path: [],
40048
- value: baseDraft[DRAFT_STATE].base
40049
- });
40050
- }
40051
- } else {
40052
- // Finalize the base draft.
40053
- result = this.finalize(baseDraft, [], scope);
40054
- }
40055
-
40056
- scope.revoke();
40057
-
40058
- if (scope.patches) {
40059
- scope.patchListener(scope.patches, scope.inversePatches);
40060
- }
40061
-
40062
- return result !== NOTHING ? result : undefined;
40063
- };
40064
- /**
40065
- * @internal
40066
- * Finalize a draft, returning either the unmodified base state or a modified
40067
- * copy of the base state.
40068
- */
40069
-
40070
-
40071
- Immer.prototype.finalize = function finalize (draft, path, scope) {
40072
- var this$1$1 = this;
40073
-
40074
- var state = draft[DRAFT_STATE];
40075
-
40076
- if (!state) {
40077
- if (Object.isFrozen(draft)) { return draft; }
40078
- return this.finalizeTree(draft, null, scope);
40079
- } // Never finalize drafts owned by another scope.
40080
-
40081
-
40082
- if (state.scope !== scope) {
40083
- return draft;
40084
- }
40085
-
40086
- if (!state.modified) {
40087
- return state.base;
40088
- }
40089
-
40090
- if (!state.finalized) {
40091
- state.finalized = true;
40092
- this.finalizeTree(state.draft, path, scope);
40093
-
40094
- if (this.onDelete) {
40095
- // The `assigned` object is unreliable with ES5 drafts.
40096
- if (this.useProxies) {
40097
- var assigned = state.assigned;
40098
-
40099
- for (var prop in assigned) {
40100
- if (!assigned[prop]) { this.onDelete(state, prop); }
40101
- }
40102
- } else {
40103
- var base = state.base;
40104
- var copy = state.copy;
40105
- each(base, function (prop) {
40106
- if (!has$1(copy, prop)) { this$1$1.onDelete(state, prop); }
40107
- });
40108
- }
40109
- }
40110
-
40111
- if (this.onCopy) {
40112
- this.onCopy(state);
40113
- } // At this point, all descendants of `state.copy` have been finalized,
40114
- // so we can be sure that `scope.canAutoFreeze` is accurate.
40115
-
40116
-
40117
- if (this.autoFreeze && scope.canAutoFreeze) {
40118
- Object.freeze(state.copy);
40119
- }
40120
-
40121
- if (path && scope.patches) {
40122
- generatePatches(state, path, scope.patches, scope.inversePatches);
40123
- }
40124
- }
40125
-
40126
- return state.copy;
40127
- };
40128
- /**
40129
- * @internal
40130
- * Finalize all drafts in the given state tree.
40131
- */
40132
-
40133
-
40134
- Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
40135
- var this$1$1 = this;
40136
-
40137
- var state = root[DRAFT_STATE];
40138
-
40139
- if (state) {
40140
- if (!this.useProxies) {
40141
- // Create the final copy, with added keys and without deleted keys.
40142
- state.copy = shallowCopy(state.draft, true);
40143
- }
40144
-
40145
- root = state.copy;
40146
- }
40147
-
40148
- var needPatches = !!rootPath && !!scope.patches;
40149
-
40150
- var finalizeProperty = function (prop, value, parent) {
40151
- if (value === parent) {
40152
- throw Error("Immer forbids circular references");
40153
- } // In the `finalizeTree` method, only the `root` object may be a draft.
40154
-
40155
-
40156
- var isDraftProp = !!state && parent === root;
40157
-
40158
- if (isDraft(value)) {
40159
- var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
40160
-
40161
- value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
40162
-
40163
- if (isDraft(value)) {
40164
- scope.canAutoFreeze = false;
40165
- } // Preserve non-enumerable properties.
40166
-
40167
-
40168
- if (Array.isArray(parent) || isEnumerable(parent, prop)) {
40169
- parent[prop] = value;
40170
- } else {
40171
- Object.defineProperty(parent, prop, {
40172
- value: value
40173
- });
40174
- } // Unchanged drafts are never passed to the `onAssign` hook.
40175
-
40176
-
40177
- if (isDraftProp && value === state.base[prop]) { return; }
40178
- } // Unchanged draft properties are ignored.
40179
- else if (isDraftProp && is(value, state.base[prop])) {
40180
- return;
40181
- } // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
40182
- else if (isDraftable(value) && !Object.isFrozen(value)) {
40183
- each(value, finalizeProperty);
40184
- }
40185
-
40186
- if (isDraftProp && this$1$1.onAssign) {
40187
- this$1$1.onAssign(state, prop, value);
40188
- }
40189
- };
40190
-
40191
- each(root, finalizeProperty);
40192
- return root;
40193
- };
40194
-
40195
- var immer = new Immer();
40196
- /**
40197
- * The `produce` function takes a value and a "recipe function" (whose
40198
- * return value often depends on the base state). The recipe function is
40199
- * free to mutate its first argument however it wants. All mutations are
40200
- * only ever applied to a __copy__ of the base state.
40201
- *
40202
- * Pass only a function to create a "curried producer" which relieves you
40203
- * from passing the recipe function every time.
40204
- *
40205
- * Only plain objects and arrays are made mutable. All other objects are
40206
- * considered uncopyable.
40207
- *
40208
- * Note: This function is __bound__ to its `Immer` instance.
40209
- *
40210
- * @param {any} base - the initial state
40211
- * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
40212
- * @param {Function} patchListener - optional function that will be called with all the patches produced here
40213
- * @returns {any} a new state, or the initial state if nothing was modified
40214
- */
40215
-
40216
- var produce = immer.produce;
40217
- /**
40218
- * Like `produce`, but `produceWithPatches` always returns a tuple
40219
- * [nextState, patches, inversePatches] (instead of just the next state)
40220
- */
40221
-
40222
- immer.produceWithPatches.bind(immer);
40223
- /**
40224
- * Pass true to automatically freeze all copies created by Immer.
40225
- *
40226
- * By default, auto-freezing is disabled in production.
40227
- */
40228
-
40229
- immer.setAutoFreeze.bind(immer);
40230
- /**
40231
- * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
40232
- * always faster than using ES5 proxies.
40233
- *
40234
- * By default, feature detection is used, so calling this is rarely necessary.
40235
- */
40236
-
40237
- immer.setUseProxies.bind(immer);
40238
- /**
40239
- * Apply an array of Immer patches to the first argument.
40240
- *
40241
- * This function is a producer, which means copy-on-write is in effect.
40242
- */
40243
-
40244
- immer.applyPatches.bind(immer);
40245
- /**
40246
- * Create an Immer draft from the given base state, which may be a draft itself.
40247
- * The draft can be modified until you finalize it with the `finishDraft` function.
40248
- */
40249
-
40250
- immer.createDraft.bind(immer);
40251
- /**
40252
- * Finalize an Immer draft from a `createDraft` call, returning the base state
40253
- * (if no changes were made) or a modified copy. The draft must *not* be
40254
- * mutated afterwards.
40255
- *
40256
- * Pass a function as the 2nd argument to generate Immer patches based on the
40257
- * changes that were made.
40258
- */
40259
-
40260
- immer.finishDraft.bind(immer);
40261
-
40262
- const createInitialState = formConfig => {
39144
+ const createInitialState = (formConfig) => {
40263
39145
  let initialForm = {};
40264
39146
  const formConfigKeys = Object.keys(formConfig);
40265
39147
  for (let formKey of formConfigKeys) {
40266
39148
  initialForm[formKey] = {
40267
39149
  dirty: false,
40268
- rawValue: formConfig[formKey].defaultValue || "",
39150
+ rawValue: formConfig[formKey].defaultValue || '',
40269
39151
  validators: formConfig[formKey].validators || [],
40270
- constraints: formConfig[formKey].constraints || []
39152
+ constraints: formConfig[formKey].constraints || [],
40271
39153
  };
40272
39154
  }
40273
39155
  // Because validators require the entire form we have to do a
@@ -40278,82 +39160,99 @@ const createInitialState = formConfig => {
40278
39160
  initialForm[formKey].errors = errors;
40279
39161
  initialForm[formKey].hasErrors = errors.length > 0;
40280
39162
  }
39163
+
40281
39164
  return initialForm;
40282
39165
  };
40283
39166
 
40284
- const SET = "field/SET";
40285
- const set$2 = fieldName => value => ({
39167
+ const SET = 'field/SET';
39168
+ const set$1 = (fieldName) => (value) => ({
40286
39169
  type: SET,
40287
- payload: { fieldName, value }
39170
+ payload: { fieldName, value },
40288
39171
  });
40289
39172
 
40290
- const CLEAR = "form/CLEAR";
39173
+ const CLEAR = 'form/CLEAR';
40291
39174
  const clear = () => ({ type: CLEAR });
40292
39175
 
40293
- const ADD_VALIDATOR = "field/ADD_VALIDATOR";
40294
- const addValidator = fieldName => validator => ({
39176
+ const ADD_VALIDATOR = 'field/ADD_VALIDATOR';
39177
+ const addValidator = (fieldName) => (validator) => ({
40295
39178
  type: ADD_VALIDATOR,
40296
- payload: { fieldName, validator }
39179
+ payload: { fieldName, validator },
40297
39180
  });
40298
39181
 
40299
- const createFormReducer = formConfig => (
40300
- state = createInitialState(formConfig),
40301
- action
40302
- ) => {
40303
- switch (action.type) {
40304
- case SET:
40305
- const changedFieldName = action.payload.fieldName;
40306
- const newRawValue = action.payload.value;
40307
-
40308
- return produce(state, draftState => {
40309
- let originalValue = draftState[changedFieldName].rawValue;
40310
- draftState[changedFieldName].rawValue = newRawValue;
40311
- if (computeConstraints(changedFieldName, draftState).length > 0) {
40312
- // If the change violates constraints, revert the change
40313
- draftState[changedFieldName].rawValue = originalValue;
40314
- return draftState;
40315
- }
39182
+ const REMOVE_VALIDATOR = 'field/REMOVE_VALIDATOR';
39183
+ const removeValidator = (fieldName) => (validator) => ({
39184
+ type: REMOVE_VALIDATOR,
39185
+ payload: { fieldName, validator },
39186
+ });
40316
39187
 
40317
- const fields = Object.entries(draftState);
40318
- for (let entry of fields) {
40319
- let fieldName = entry[0];
40320
- let field = entry[1];
40321
- let errors = computeErrors(fieldName, draftState);
40322
- let dirty = fieldName === changedFieldName ? true : field.dirty;
40323
- draftState[fieldName].errors = errors;
40324
- draftState[fieldName].dirty = dirty;
40325
- draftState[fieldName].hasErrors = errors.length > 0;
40326
- }
40327
- });
40328
- case CLEAR:
40329
- return createInitialState(formConfig);
40330
- case ADD_VALIDATOR:
40331
- const fieldWithOverride = action.payload.fieldName;
40332
- const newValidator = action.payload.validator;
40333
-
40334
- return produce(state, draftState => {
40335
- draftState[fieldWithOverride].validators.push(newValidator);
40336
- const fields = Object.entries(draftState);
40337
- for (let entry of fields) {
40338
- let fieldName = entry[0];
40339
- let field = entry[1];
40340
- let errors = computeErrors(fieldName, draftState);
40341
- let dirty = field.dirty;
40342
- draftState[fieldName].errors = errors;
40343
- draftState[fieldName].dirty = dirty;
40344
- draftState[fieldName].hasErrors = errors.length > 0;
40345
- }
40346
- });
40347
- default:
40348
- return state;
40349
- }
40350
- };
39188
+ const CLEAR_FIELD_VALIDATORS = 'field/CLEAR_FIELD_VALIDATORS';
39189
+ const clearFieldValidators = (fieldName) => () => ({
39190
+ type: CLEAR_FIELD_VALIDATORS,
39191
+ payload: { fieldName },
39192
+ });
39193
+
39194
+ const createFormReducer =
39195
+ (formConfig) =>
39196
+ (state = createInitialState(formConfig), action) => {
39197
+ switch (action.type) {
39198
+ case SET: {
39199
+ const changedFieldName = action.payload.fieldName;
39200
+ const newRawValue = action.payload.value;
39201
+
39202
+ return produce(state, (draftState) => {
39203
+ let originalValue = draftState[changedFieldName].rawValue;
39204
+ draftState[changedFieldName].rawValue = newRawValue;
39205
+ if (computeConstraints(changedFieldName, draftState).length > 0) {
39206
+ // If the change violates constraints, revert the change
39207
+ draftState[changedFieldName].rawValue = originalValue;
39208
+ return draftState;
39209
+ }
39210
+
39211
+ computeDirtyEntries(draftState, changedFieldName);
39212
+ computeErrorEntries(draftState);
39213
+ });
39214
+ }
39215
+ case CLEAR:
39216
+ return createInitialState(formConfig);
39217
+ case ADD_VALIDATOR: {
39218
+ const fieldWithOverride = action.payload.fieldName;
39219
+ const newValidator = action.payload.validator;
39220
+
39221
+ return produce(state, (draftState) => {
39222
+ draftState[fieldWithOverride].validators.push(newValidator);
39223
+ computeErrorEntries(draftState);
39224
+ });
39225
+ }
39226
+ case REMOVE_VALIDATOR: {
39227
+ const fieldToOverride = action.payload.fieldName;
39228
+ const targetValidator = action.payload.validator;
39229
+
39230
+ return produce(state, (draftState) => {
39231
+ let fieldValidators = draftState[fieldToOverride].validators;
39232
+ draftState[fieldToOverride].validators = fieldValidators.filter(
39233
+ (validator) => validator.type !== targetValidator.type
39234
+ );
39235
+ computeErrorEntries(draftState);
39236
+ });
39237
+ }
39238
+ case CLEAR_FIELD_VALIDATORS: {
39239
+ const fieldToClear = action.payload.fieldName;
39240
+
39241
+ return produce(state, (draftState) => {
39242
+ draftState[fieldToClear].validators = [];
39243
+ computeErrorEntries(draftState);
39244
+ });
39245
+ }
39246
+ default:
39247
+ return state;
39248
+ }
39249
+ };
40351
39250
 
40352
- const createMapDispatchToProps = formConfig => {
39251
+ const createMapDispatchToProps = (formConfig) => {
40353
39252
  // Do memo-ization
40354
39253
  let cachedDispatch;
40355
39254
  let cacheValue;
40356
- return dispatch => {
39255
+ return (dispatch) => {
40357
39256
  if (dispatch == cachedDispatch) {
40358
39257
  return cacheValue;
40359
39258
  }
@@ -40362,8 +39261,11 @@ const createMapDispatchToProps = formConfig => {
40362
39261
  const keys = Object.keys(formConfig);
40363
39262
  for (let fieldName of keys) {
40364
39263
  dispatchObj.fields[fieldName] = {
40365
- set: value => dispatch(set$2(fieldName)(value)),
40366
- addValidator: validator => dispatch(addValidator(fieldName)(validator))
39264
+ set: (value) => dispatch(set$1(fieldName)(value)),
39265
+ addValidator: (validator) => dispatch(addValidator(fieldName)(validator)),
39266
+ removeValidator: (validator) =>
39267
+ dispatch(removeValidator(fieldName)(validator)),
39268
+ clear: () => dispatch(clearFieldValidators(fieldName)()),
40367
39269
  };
40368
39270
  }
40369
39271
  dispatchObj.form = { clear: () => dispatch(clear()) };
@@ -40373,12 +39275,12 @@ const createMapDispatchToProps = formConfig => {
40373
39275
  };
40374
39276
  };
40375
39277
 
40376
- const mapStateToProps = state => ({ fields: state });
39278
+ const mapStateToProps = (state) => ({ fields: state });
40377
39279
 
40378
- const createFormState = formConfig => ({
39280
+ const createFormState = (formConfig) => ({
40379
39281
  reducer: createFormReducer(formConfig),
40380
39282
  mapDispatchToProps: createMapDispatchToProps(formConfig),
40381
- mapStateToProps: mapStateToProps
39283
+ mapStateToProps: mapStateToProps,
40382
39284
  });
40383
39285
 
40384
39286
  var AddressForm = function AddressForm(_ref) {
@@ -43244,12 +42146,12 @@ LoginForm.mapDispatchToProps = mapDispatchToProps$5;
43244
42146
  * This source code is licensed under the MIT license found in the
43245
42147
  * LICENSE file in the root directory of this source tree.
43246
42148
  */
43247
- 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?
43248
- 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;
43249
- 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;
43250
- 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};
43251
- 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};
43252
- 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;
42149
+ 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?
42150
+ 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;
42151
+ 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;
42152
+ 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};
42153
+ 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};
42154
+ 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;
43253
42155
 
43254
42156
  var reactIs_production_min = {
43255
42157
  AsyncMode: AsyncMode,
@@ -43620,14 +42522,14 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
43620
42522
 
43621
42523
  var ReactPropTypesSecret_1 = ReactPropTypesSecret;
43622
42524
 
43623
- var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
42525
+ var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
43624
42526
 
43625
42527
  var printWarning = function() {};
43626
42528
 
43627
42529
  if (process.env.NODE_ENV !== 'production') {
43628
42530
  var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
43629
42531
  var loggedTypeFailures = {};
43630
- var has$3 = has$2;
42532
+ var has$2 = has$1;
43631
42533
 
43632
42534
  printWarning = function(text) {
43633
42535
  var message = 'Warning: ' + text;
@@ -43657,7 +42559,7 @@ if (process.env.NODE_ENV !== 'production') {
43657
42559
  function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
43658
42560
  if (process.env.NODE_ENV !== 'production') {
43659
42561
  for (var typeSpecName in typeSpecs) {
43660
- if (has$3(typeSpecs, typeSpecName)) {
42562
+ if (has$2(typeSpecs, typeSpecName)) {
43661
42563
  var error;
43662
42564
  // Prop type validation may throw. In case they do, we don't want to
43663
42565
  // fail the render phase where it didn't fail before. So we log it.
@@ -44056,7 +42958,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
44056
42958
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
44057
42959
  }
44058
42960
  for (var key in propValue) {
44059
- if (has$2(propValue, key)) {
42961
+ if (has$1(propValue, key)) {
44060
42962
  var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
44061
42963
  if (error instanceof Error) {
44062
42964
  return error;
@@ -44093,7 +42995,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
44093
42995
  if (checkerResult == null) {
44094
42996
  return null;
44095
42997
  }
44096
- if (checkerResult.data && has$2(checkerResult.data, 'expectedType')) {
42998
+ if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
44097
42999
  expectedTypes.push(checkerResult.data.expectedType);
44098
43000
  }
44099
43001
  }
@@ -44153,7 +43055,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
44153
43055
  var allKeys = objectAssign({}, props[propName], shapeTypes);
44154
43056
  for (var key in allKeys) {
44155
43057
  var checker = shapeTypes[key];
44156
- if (has$2(shapeTypes, key) && typeof checker !== 'function') {
43058
+ if (has$1(shapeTypes, key) && typeof checker !== 'function') {
44157
43059
  return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
44158
43060
  }
44159
43061
  if (!checker) {
@@ -44891,7 +43793,7 @@ var index_esm = /*#__PURE__*/Object.freeze({
44891
43793
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
44892
43794
  */
44893
43795
 
44894
- function ownKeys$3(object, enumerableOnly) {
43796
+ function ownKeys$2(object, enumerableOnly) {
44895
43797
  var keys = Object.keys(object);
44896
43798
 
44897
43799
  if (Object.getOwnPropertySymbols) {
@@ -44907,9 +43809,9 @@ function ownKeys$3(object, enumerableOnly) {
44907
43809
  function _objectSpread2$1(target) {
44908
43810
  for (var i = 1; i < arguments.length; i++) {
44909
43811
  var source = null != arguments[i] ? arguments[i] : {};
44910
- i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
43812
+ i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
44911
43813
  _defineProperty$1(target, key, source[key]);
44912
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
43814
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
44913
43815
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
44914
43816
  });
44915
43817
  }
@@ -47881,21 +46783,18 @@ var createPartialAmountFormState = function createPartialAmountFormState(lineIte
47881
46783
  var blockPartialPaymentOverpay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
47882
46784
  var formConfig = lineItems.reduce(function (acc, item) {
47883
46785
  var validators = createPartialAmountFormValidators(item, lineItems, maximum, minimum, blockPartialPaymentOverpay);
47884
- console.log("item and validators", item, validators);
47885
46786
  return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, item.id, {
47886
46787
  validators: validators,
47887
46788
  constraints: [onlyNaturals()],
47888
46789
  defaultValue: String(item.amount)
47889
46790
  }));
47890
46791
  }, {});
47891
- console.log("form config is", formConfig);
47892
46792
 
47893
46793
  var _createFormState = createFormState(formConfig),
47894
46794
  reducer = _createFormState.reducer,
47895
46795
  mapStateToProps = _createFormState.mapStateToProps,
47896
46796
  mapDispatchToProps = _createFormState.mapDispatchToProps;
47897
46797
 
47898
- console.log("partial amount form reducer etc is", reducer, mapStateToProps, mapDispatchToProps);
47899
46798
  return {
47900
46799
  partialAmountFormReducer: reducer,
47901
46800
  partialAmountFormMapStateToProps: mapStateToProps,