@thecb/components 8.4.12-beta.1 → 8.4.12

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.cjs.js CHANGED
@@ -38562,44 +38562,52 @@ var TableHeading_styled = styled__default.th.withConfig({
38562
38562
  return extraStyles;
38563
38563
  });
38564
38564
 
38565
- const validatorToPredicate = (validatorFn, emptyCase) => (
38566
- value,
38567
- ...rest
38568
- ) => (value === "" ? emptyCase : validatorFn(value, ...rest));
38565
+ const validatorToPredicate =
38566
+ (validatorFn, emptyCase) =>
38567
+ (value, ...rest) =>
38568
+ value === '' ? emptyCase : validatorFn(value, ...rest);
38569
38569
 
38570
38570
  var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
38571
38571
 
38572
+ function getDefaultExportFromCjs (x) {
38573
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
38574
+ }
38575
+
38572
38576
  var dayjs_min = {exports: {}};
38573
38577
 
38574
38578
  (function (module, exports) {
38575
- !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}));
38576
- }(dayjs_min));
38579
+ !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}));
38580
+ } (dayjs_min));
38577
38581
 
38578
- var dayjs = dayjs_min.exports;
38582
+ var dayjs_minExports = dayjs_min.exports;
38583
+ var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
38579
38584
 
38580
38585
  var customParseFormat$1 = {exports: {}};
38581
38586
 
38582
38587
  (function (module, exports) {
38583
- !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);};}}));
38584
- }(customParseFormat$1));
38588
+ !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);};}}));
38589
+ } (customParseFormat$1));
38585
38590
 
38586
- var customParseFormat = customParseFormat$1.exports;
38591
+ var customParseFormatExports = customParseFormat$1.exports;
38592
+ var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
38587
38593
 
38588
38594
  var isSameOrBefore$1 = {exports: {}};
38589
38595
 
38590
38596
  (function (module, exports) {
38591
- !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)};}}));
38592
- }(isSameOrBefore$1));
38597
+ !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)};}}));
38598
+ } (isSameOrBefore$1));
38593
38599
 
38594
- var isSameOrBefore = isSameOrBefore$1.exports;
38600
+ var isSameOrBeforeExports = isSameOrBefore$1.exports;
38601
+ var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
38595
38602
 
38596
38603
  var isSameOrAfter$1 = {exports: {}};
38597
38604
 
38598
38605
  (function (module, exports) {
38599
- !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)};}}));
38600
- }(isSameOrAfter$1));
38606
+ !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)};}}));
38607
+ } (isSameOrAfter$1));
38601
38608
 
38602
- var isSameOrAfter = isSameOrAfter$1.exports;
38609
+ var isSameOrAfterExports = isSameOrAfter$1.exports;
38610
+ var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
38603
38611
 
38604
38612
  /* eslint-disable no-unused-vars */
38605
38613
 
@@ -38615,24 +38623,24 @@ dayjs.extend(isSameOrAfter);
38615
38623
 
38616
38624
  let validatorFns = {};
38617
38625
 
38618
- const INCLUDED_IN = "validator/INCLUDED_IN";
38619
- const INCLUDED_IN_ERROR = "error/INCLUDED_IN";
38626
+ const INCLUDED_IN = 'validator/INCLUDED_IN';
38627
+ const INCLUDED_IN_ERROR = 'error/INCLUDED_IN';
38620
38628
  const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
38621
38629
  validatorFns[INCLUDED_IN] = (value, args, form) =>
38622
38630
  Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
38623
38631
 
38624
- const REQUIRED = "validator/REQUIRED";
38625
- const REQUIRED_ERROR = "error/REQUIRED";
38632
+ const REQUIRED = 'validator/REQUIRED';
38633
+ const REQUIRED_ERROR = 'error/REQUIRED';
38626
38634
  const required = createValidator(REQUIRED, REQUIRED_ERROR);
38627
- validatorFns[REQUIRED] = (value, args, form) => value !== "";
38635
+ validatorFns[REQUIRED] = (value, args, form) => value !== '';
38628
38636
 
38629
- const ONLY_INTEGERS = "validator/ONLY_INTEGERS";
38630
- const ONLY_INTEGERS_ERROR = "error/ONLY_INTEGERS";
38637
+ const ONLY_INTEGERS = 'validator/ONLY_INTEGERS';
38638
+ const ONLY_INTEGERS_ERROR = 'error/ONLY_INTEGERS';
38631
38639
  const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
38632
38640
  validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
38633
38641
 
38634
- const ONLY_NATURALS = "validator/ONLY_NATURALS";
38635
- const ONLY_NATURALS_ERROR = "error/ONLY_NATURALS";
38642
+ const ONLY_NATURALS = 'validator/ONLY_NATURALS';
38643
+ const ONLY_NATURALS_ERROR = 'error/ONLY_NATURALS';
38636
38644
  const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
38637
38645
  validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
38638
38646
 
@@ -38645,8 +38653,8 @@ not tested as validation function
38645
38653
  to validate exp date instead use combo of:
38646
38654
  required(), hasLength(), isValidMonth(), dateAfterToday()
38647
38655
  */
38648
- const ONLY_EXPIRATION_DATE = "validator/ONLY_EXPIRATION_DATE";
38649
- const ONLY_EXPIRATION_DATE_ERROR = "error/ONLY_EXPIRATION_DATE";
38656
+ const ONLY_EXPIRATION_DATE = 'validator/ONLY_EXPIRATION_DATE';
38657
+ const ONLY_EXPIRATION_DATE_ERROR = 'error/ONLY_EXPIRATION_DATE';
38650
38658
  const onlyExpirationDate = createValidator(
38651
38659
  ONLY_EXPIRATION_DATE,
38652
38660
  ONLY_EXPIRATION_DATE_ERROR
@@ -38654,64 +38662,63 @@ const onlyExpirationDate = createValidator(
38654
38662
  validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
38655
38663
  /^(\d?\d?\/?\d?\d?)?$/.test(value);
38656
38664
 
38657
- const NUMBER_LESS_THAN = "validator/NUMBER_LESS_THAN";
38658
- const NUMBER_LESS_THAN_ERROR = "error/NUMBER_LESS_THAN";
38665
+ const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
38666
+ const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
38659
38667
  const numberLessThan = createValidator(
38660
38668
  NUMBER_LESS_THAN,
38661
38669
  NUMBER_LESS_THAN_ERROR
38662
38670
  );
38663
38671
  validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
38664
- if (value === "") {
38672
+ if (value === '') {
38665
38673
  return true;
38666
38674
  }
38667
38675
  return Number(value) < args[0];
38668
38676
  };
38669
38677
 
38670
- const NUMBER_LESS_THAN_OR_EQUAL_TO =
38671
- "validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
38678
+ const NUMBER_LESS_THAN_OR_EQUAL_TO = 'validator/NUMBER_LESS_THAN_OR_EQUAL_TO';
38672
38679
  const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
38673
- "error/NUMBER_LESS_THAN_OR_EQUAL_TO";
38680
+ 'error/NUMBER_LESS_THAN_OR_EQUAL_TO';
38674
38681
  const numberLessThanOrEqualTo = createValidator(
38675
38682
  NUMBER_LESS_THAN_OR_EQUAL_TO,
38676
38683
  NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
38677
38684
  );
38678
38685
  validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
38679
- if (value === "") {
38686
+ if (value === '') {
38680
38687
  return true;
38681
38688
  }
38682
38689
  return Number(value) <= args[0];
38683
38690
  };
38684
38691
 
38685
- const NUMBER_GREATER_THAN = "validator/NUMBER_GREATER_THAN";
38686
- const NUMBER_GREATER_THAN_ERROR = "error/NUMBER_GREATER_THAN";
38692
+ const NUMBER_GREATER_THAN = 'validator/NUMBER_GREATER_THAN';
38693
+ const NUMBER_GREATER_THAN_ERROR = 'error/NUMBER_GREATER_THAN';
38687
38694
  const numberGreaterThan = createValidator(
38688
38695
  NUMBER_GREATER_THAN,
38689
38696
  NUMBER_GREATER_THAN_ERROR
38690
38697
  );
38691
38698
  validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
38692
- if (value === "") {
38699
+ if (value === '') {
38693
38700
  return true;
38694
38701
  }
38695
38702
  return Number(value) > args[0];
38696
38703
  };
38697
38704
 
38698
38705
  const NUMBER_GREATER_THAN_OR_EQUAL_TO =
38699
- "validator/NUMBER_GREATER_THAN_OR_EQUAL_TO";
38706
+ 'validator/NUMBER_GREATER_THAN_OR_EQUAL_TO';
38700
38707
  const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
38701
- "error/NUMBER_GREATER_THAN_OR_EQUAL_TO";
38708
+ 'error/NUMBER_GREATER_THAN_OR_EQUAL_TO';
38702
38709
  const numberGreaterThanOrEqualTo = createValidator(
38703
38710
  NUMBER_GREATER_THAN_OR_EQUAL_TO,
38704
38711
  NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
38705
38712
  );
38706
38713
  validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
38707
- if (value === "") {
38714
+ if (value === '') {
38708
38715
  return true;
38709
38716
  }
38710
38717
  return Number(value) >= args[0];
38711
38718
  };
38712
38719
 
38713
- const MATCHES_FIELD = "validator/MATCHES_FIELD";
38714
- const MATCHES_FIELD_ERROR$1 = "error/MATCHES_FIELD";
38720
+ const MATCHES_FIELD = 'validator/MATCHES_FIELD';
38721
+ const MATCHES_FIELD_ERROR$1 = 'error/MATCHES_FIELD';
38715
38722
  const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
38716
38723
  validatorFns[MATCHES_FIELD] = (value, args, form) => {
38717
38724
  const dependentField = form[args[0]];
@@ -38724,7 +38731,7 @@ validatorFns[MATCHES_FIELD] = (value, args, form) => {
38724
38731
  return value === dependentFieldValue;
38725
38732
  };
38726
38733
 
38727
- const validateWhenErrorMessage = type =>
38734
+ const validateWhenErrorMessage = (type) =>
38728
38735
  `${type} was passed to validateWhen, but that validator type does not exist.
38729
38736
  Please check that you are only calling validator creator functions exported from
38730
38737
  redux-freeform in your form config and that you didn't forget to
@@ -38732,25 +38739,21 @@ const validateWhenErrorMessage = type =>
38732
38739
  createFormState). Also make sure you aren't passing validateWhen() to validateWhen
38733
38740
  as the primary validator.`;
38734
38741
 
38735
- const VALIDATE_WHEN = "validator/VALIDATE_WHEN";
38736
- const VALIDATE_WHEN_ERROR = "error/VALIDATE_WHEN";
38737
- const validateWhen = (
38738
- dependentValidator,
38739
- primaryValidator,
38740
- optionalFieldName
38741
- ) => ({
38742
+ const VALIDATE_WHEN = 'validator/VALIDATE_WHEN';
38743
+ const VALIDATE_WHEN_ERROR = 'error/VALIDATE_WHEN';
38744
+ const validateWhen = (dependentValidator, primaryValidator, optionalFieldName) => ({
38742
38745
  type: VALIDATE_WHEN,
38743
38746
  args: [dependentValidator, primaryValidator, optionalFieldName],
38744
- error: dependentValidator.error
38747
+ error: dependentValidator.error,
38745
38748
  });
38746
38749
  validateWhen.error = VALIDATE_WHEN_ERROR;
38747
38750
  validatorFns[VALIDATE_WHEN] = (value, args, form) => {
38748
38751
  const [dependentValidator, primaryValidator, optionalFieldName] = args;
38749
- const dependsOnOtherField = typeof optionalFieldName === "string";
38752
+ const dependsOnOtherField = typeof optionalFieldName === 'string';
38750
38753
 
38751
38754
  if (
38752
38755
  primaryValidator.type === undefined ||
38753
- typeof validatorFns[primaryValidator.type] !== "function"
38756
+ typeof validatorFns[primaryValidator.type] !== 'function'
38754
38757
  ) {
38755
38758
  throw new Error(validateWhenErrorMessage(primaryValidator.type));
38756
38759
  }
@@ -38774,26 +38777,22 @@ validatorFns[VALIDATE_WHEN] = (value, args, form) => {
38774
38777
  );
38775
38778
 
38776
38779
  return primaryPredicatePassed
38777
- ? validatorFns[dependentValidator.type](
38778
- value,
38779
- dependentValidator.args,
38780
- form
38781
- )
38780
+ ? validatorFns[dependentValidator.type](value, dependentValidator.args, form)
38782
38781
  : true;
38783
38782
  };
38784
38783
 
38785
- const validateSumErrorMessage = type =>
38784
+ const validateSumErrorMessage = (type) =>
38786
38785
  `${type} was passed to validateSum, but that validator type does not exist.
38787
38786
  Please check that you are only calling validator creator functions exported from
38788
38787
  redux-freeform in your form config and that you didn't forget to
38789
38788
  invoke the validator creator (you cannot pass the functions themselves to
38790
38789
  createFormState).`;
38791
- const VALIDATE_SUM = "validator/VALIDATE_SUM";
38792
- const VALIDATE_SUM_ERROR = "error/VALIDATE_SUM";
38790
+ const VALIDATE_SUM = 'validator/VALIDATE_SUM';
38791
+ const VALIDATE_SUM_ERROR = 'error/VALIDATE_SUM';
38793
38792
  const validateSum = (validator, fieldNamesArray) => ({
38794
38793
  type: VALIDATE_SUM,
38795
38794
  args: [validator, fieldNamesArray],
38796
- error: validator.error
38795
+ error: validator.error,
38797
38796
  });
38798
38797
  validateSum.error = VALIDATE_SUM_ERROR;
38799
38798
  validatorFns[VALIDATE_SUM] = (value, args, form) => {
@@ -38801,7 +38800,7 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
38801
38800
 
38802
38801
  if (
38803
38802
  validator.type === undefined ||
38804
- typeof validatorFns[validator.type] !== "function"
38803
+ typeof validatorFns[validator.type] !== 'function'
38805
38804
  ) {
38806
38805
  throw new Error(validateSumErrorMessage(validator.type));
38807
38806
  }
@@ -38822,37 +38821,35 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
38822
38821
  return validatorFns[validator.type](sum, validator.args, form);
38823
38822
  };
38824
38823
 
38825
- const HAS_LENGTH = "validator/HAS_LENGTH";
38826
- const HAS_LENGTH_ERROR = "error/HAS_LENGTH";
38824
+ const HAS_LENGTH = 'validator/HAS_LENGTH';
38825
+ const HAS_LENGTH_ERROR = 'error/HAS_LENGTH';
38827
38826
  const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
38828
38827
  validatorFns[HAS_LENGTH] = (value, args, form) => {
38829
- if (value === "") {
38828
+ if (value === '') {
38830
38829
  return true;
38831
38830
  }
38832
38831
  const min = args[0];
38833
38832
  const max = args[1];
38834
38833
  if (max == undefined || min == undefined) {
38835
38834
  throw new Error(
38836
- "Max and min need to be defined for hasLength, both or one of them is undefined"
38835
+ 'Max and min need to be defined for hasLength, both or one of them is undefined'
38837
38836
  );
38838
38837
  }
38839
38838
  if (max < min) {
38840
- throw new Error(
38841
- "hasLength validator was passed a min greater than the max"
38842
- );
38839
+ throw new Error('hasLength validator was passed a min greater than the max');
38843
38840
  }
38844
38841
  const valueLength = value.length;
38845
38842
  return max >= valueLength && valueLength >= min;
38846
38843
  };
38847
38844
 
38848
- const DATE_BEFORE_TODAY = "validator/DATE_BEFORE_TODAY";
38849
- const DATE_BEFORE_TODAY_ERROR = "error/DATE_BEFORE_TODAY";
38845
+ const DATE_BEFORE_TODAY = 'validator/DATE_BEFORE_TODAY';
38846
+ const DATE_BEFORE_TODAY_ERROR = 'error/DATE_BEFORE_TODAY';
38850
38847
  const dateBeforeToday = createValidator(
38851
38848
  DATE_BEFORE_TODAY,
38852
38849
  DATE_BEFORE_TODAY_ERROR
38853
38850
  );
38854
38851
  validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38855
- if (value === "") {
38852
+ if (value === '') {
38856
38853
  return true;
38857
38854
  }
38858
38855
  const dateFormat = args[0];
@@ -38861,7 +38858,7 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38861
38858
 
38862
38859
  if (dateFormat == undefined || unit == undefined) {
38863
38860
  throw new Error(
38864
- "Date format and unit need to be defined for dateBeforeToday, one or both are undefined"
38861
+ 'Date format and unit need to be defined for dateBeforeToday, one or both are undefined'
38865
38862
  );
38866
38863
  }
38867
38864
  const now = dayjs();
@@ -38873,14 +38870,14 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
38873
38870
  return dateValue.isBefore(now, unit);
38874
38871
  };
38875
38872
 
38876
- const DATE_AFTER_TODAY = "validator/DATE_AFTER_TODAY";
38877
- const DATE_AFTER_TODAY_ERROR = "error/DATE_AFTER_TODAY";
38873
+ const DATE_AFTER_TODAY = 'validator/DATE_AFTER_TODAY';
38874
+ const DATE_AFTER_TODAY_ERROR = 'error/DATE_AFTER_TODAY';
38878
38875
  const dateAfterToday = createValidator(
38879
38876
  DATE_AFTER_TODAY,
38880
38877
  DATE_AFTER_TODAY_ERROR
38881
38878
  );
38882
38879
  validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38883
- if (value === "") {
38880
+ if (value === '') {
38884
38881
  return true;
38885
38882
  }
38886
38883
  const dateFormat = args[0];
@@ -38889,7 +38886,7 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38889
38886
 
38890
38887
  if (dateFormat == undefined || unit == undefined) {
38891
38888
  throw new Error(
38892
- "Date format and unit need to be defined for dateAfterToday, one or both are undefined"
38889
+ 'Date format and unit need to be defined for dateAfterToday, one or both are undefined'
38893
38890
  );
38894
38891
  }
38895
38892
  const now = dayjs();
@@ -38901,14 +38898,11 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
38901
38898
  return dateValue.isAfter(now, unit);
38902
38899
  };
38903
38900
 
38904
- const IS_VALID_MONTH = "validator/IS_VALID_MONTH";
38905
- const IS_VALID_MONTH_ERROR = "error/IS_VALID_MONTH";
38906
- const isValidMonth = createValidator(
38907
- IS_VALID_MONTH,
38908
- IS_VALID_MONTH_ERROR
38909
- );
38901
+ const IS_VALID_MONTH = 'validator/IS_VALID_MONTH';
38902
+ const IS_VALID_MONTH_ERROR = 'error/IS_VALID_MONTH';
38903
+ const isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
38910
38904
  validatorFns[IS_VALID_MONTH] = (value, args, form) => {
38911
- if (value === "") {
38905
+ if (value === '') {
38912
38906
  return true;
38913
38907
  }
38914
38908
  // Function takes one argument representing the character position
@@ -38918,43 +38912,43 @@ validatorFns[IS_VALID_MONTH] = (value, args, form) => {
38918
38912
  // Only works with two digit months (01, 02, 03, etc)
38919
38913
  const monthStartPosition = parseInt(args[0]);
38920
38914
  const monthEndPosition = monthStartPosition + 2;
38921
- if (monthStartPosition === NaN) {
38922
- throw new Error("Month start position has to be a valid integer string");
38915
+ if (isNaN(monthStartPosition)) {
38916
+ throw new Error('Month start position has to be a valid integer string');
38923
38917
  }
38924
38918
  const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
38925
- if (month === NaN) {
38919
+ if (isNaN(month)) {
38926
38920
  return false;
38927
38921
  }
38928
38922
  return month >= 1 && month <= 12;
38929
38923
  };
38930
38924
 
38931
- const MATCHES_REGEX = "validator/MATCHES_REGEX";
38932
- const MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
38925
+ const MATCHES_REGEX = 'validator/MATCHES_REGEX';
38926
+ const MATCHES_REGEX_ERROR = 'error/MATCHES_REGEX';
38933
38927
  const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
38934
38928
  validatorFns[MATCHES_REGEX] = (value, args, form) => {
38935
- if (value === "") {
38929
+ if (value === '') {
38936
38930
  return true;
38937
38931
  }
38938
38932
  return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
38939
38933
  };
38940
38934
 
38941
38935
  // based on http://www.brainjar.com/js/validation/
38942
- const IS_ROUTING_NUMBER = "validator/IS_ROUTING_NUMBER";
38943
- const IS_ROUTING_NUMBER_ERROR = "error/IS_ROUTING_NUMBER";
38936
+ const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
38937
+ const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
38944
38938
  const isRoutingNumber = createValidator(
38945
38939
  IS_ROUTING_NUMBER,
38946
38940
  IS_ROUTING_NUMBER_ERROR
38947
38941
  );
38948
38942
  validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
38949
- if (value === "") {
38943
+ if (value === '') {
38950
38944
  return true;
38951
38945
  }
38952
38946
  if (value.length != 9) {
38953
38947
  return false;
38954
38948
  }
38955
38949
  const sum = value
38956
- .split("")
38957
- .map(ch => parseInt(ch))
38950
+ .split('')
38951
+ .map((ch) => parseInt(ch))
38958
38952
  .reduce((acc, cur, idx) => {
38959
38953
  switch (idx % 3) {
38960
38954
  case 0:
@@ -38968,69 +38962,69 @@ validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
38968
38962
  return sum != 0 && sum % 10 == 0;
38969
38963
  };
38970
38964
 
38971
- const HAS_NUMBER = "validator/HAS_NUMBER";
38972
- const HAS_NUMBER_ERROR$1 = "error/HAS_NUMBER";
38965
+ const HAS_NUMBER = 'validator/HAS_NUMBER';
38966
+ const HAS_NUMBER_ERROR$1 = 'error/HAS_NUMBER';
38973
38967
  const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
38974
38968
  validatorFns[HAS_NUMBER] = (value, args, form) => {
38975
- if (value === "") {
38969
+ if (value === '') {
38976
38970
  return true;
38977
38971
  }
38978
38972
  return new RegExp(/[0-9]/).test(value);
38979
38973
  };
38980
38974
 
38981
- const HAS_LOWERCASE_LETTER = "validator/HAS_LOWERCASE_LETTER";
38982
- const HAS_LOWERCASE_LETTER_ERROR$1 = "error/HAS_LOWERCASE_LETTER";
38975
+ const HAS_LOWERCASE_LETTER = 'validator/HAS_LOWERCASE_LETTER';
38976
+ const HAS_LOWERCASE_LETTER_ERROR$1 = 'error/HAS_LOWERCASE_LETTER';
38983
38977
  const hasLowercaseLetter = createValidator(
38984
38978
  HAS_LOWERCASE_LETTER,
38985
38979
  HAS_LOWERCASE_LETTER_ERROR$1
38986
38980
  );
38987
38981
  validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
38988
- if (value === "") {
38982
+ if (value === '') {
38989
38983
  return true;
38990
38984
  }
38991
38985
  return new RegExp(/[a-z]/).test(value);
38992
38986
  };
38993
38987
 
38994
- const HAS_UPPERCASE_LETTER = "validator/HAS_UPPERCASE_LETTER";
38995
- const HAS_UPPERCASE_LETTER_ERROR$1 = "error/HAS_UPPERCASE_LETTER";
38988
+ const HAS_UPPERCASE_LETTER = 'validator/HAS_UPPERCASE_LETTER';
38989
+ const HAS_UPPERCASE_LETTER_ERROR$1 = 'error/HAS_UPPERCASE_LETTER';
38996
38990
  const hasUppercaseLetter = createValidator(
38997
38991
  HAS_UPPERCASE_LETTER,
38998
38992
  HAS_UPPERCASE_LETTER_ERROR$1
38999
38993
  );
39000
38994
  validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
39001
- if (value === "") {
38995
+ if (value === '') {
39002
38996
  return true;
39003
38997
  }
39004
38998
  return new RegExp(/[A-Z]/).test(value);
39005
38999
  };
39006
39000
 
39007
- const HAS_SPECIAL_CHARACTER = "validator/HAS_SPECIAL_CHARACTER";
39008
- const HAS_SPECIAL_CHARACTER_ERROR$1 = "error/HAS_SPECIAL_CHARACTER";
39001
+ const HAS_SPECIAL_CHARACTER = 'validator/HAS_SPECIAL_CHARACTER';
39002
+ const HAS_SPECIAL_CHARACTER_ERROR$1 = 'error/HAS_SPECIAL_CHARACTER';
39009
39003
  const hasSpecialCharacter = createValidator(
39010
39004
  HAS_SPECIAL_CHARACTER,
39011
39005
  HAS_SPECIAL_CHARACTER_ERROR$1
39012
39006
  );
39013
39007
  validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
39014
- if (value === "") {
39008
+ if (value === '') {
39015
39009
  return true;
39016
39010
  }
39017
39011
  return new RegExp(/[!@#$%^&*.?]/).test(value);
39018
39012
  };
39019
39013
 
39020
- const IS_PROBABLY_EMAIL = "validator/IS_PROBABLY_EMAIL";
39021
- const IS_PROBABLY_EMAIL_ERROR = "error/IS_PROBABLY_EMAIL";
39014
+ const IS_PROBABLY_EMAIL = 'validator/IS_PROBABLY_EMAIL';
39015
+ const IS_PROBABLY_EMAIL_ERROR = 'error/IS_PROBABLY_EMAIL';
39022
39016
  const isProbablyEmail = createValidator(
39023
39017
  IS_PROBABLY_EMAIL,
39024
39018
  IS_PROBABLY_EMAIL_ERROR
39025
39019
  );
39026
39020
  validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
39027
- if (value === "") {
39021
+ if (value === '') {
39028
39022
  return true;
39029
39023
  }
39030
39024
  return new RegExp(/^\S+@\S+\.\S+$/).test(value);
39031
39025
  };
39032
39026
 
39033
- const runValidatorErrorMessage = type =>
39027
+ const runValidatorErrorMessage = (type) =>
39034
39028
  `${type} was passed to runValidator, but that validator type does not exist.
39035
39029
  Please check that you are only calling validator creator functions exported from
39036
39030
  redux-freeform in your form config and that you didn't forget to
@@ -39045,1165 +39039,53 @@ const runValidator = (validator, value, form) => {
39045
39039
  return validatorFn(value, validator.args, form) ? null : validator.error;
39046
39040
  };
39047
39041
 
39048
- const _computeErrors = (fieldName, form, validators) => {
39042
+ const runFormValidators = (fieldName, form, validators) => {
39049
39043
  return validators
39050
- .map(v => runValidator(v, form[fieldName].rawValue, form))
39051
- .filter(x => x !== null);
39044
+ .map((v) => runValidator(v, form[fieldName].rawValue, form))
39045
+ .filter((x) => x !== null);
39052
39046
  };
39053
39047
 
39054
39048
  const computeConstraints = (fieldName, form) => {
39055
39049
  const constraints = form[fieldName].constraints;
39056
- return _computeErrors(fieldName, form, constraints);
39050
+ return runFormValidators(fieldName, form, constraints);
39057
39051
  };
39058
39052
 
39059
39053
  const computeErrors = (fieldName, form) => {
39060
39054
  const validators = form[fieldName].validators;
39061
- return _computeErrors(fieldName, form, validators);
39055
+ return runFormValidators(fieldName, form, validators);
39062
39056
  };
39063
39057
 
39064
- var obj;
39065
- var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
39066
- var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
39067
- var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
39068
- function isDraft(value) {
39069
- return !!value && !!value[DRAFT_STATE];
39070
- }
39071
- function isDraftable(value) {
39072
- if (!value) { return false; }
39073
- return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
39074
- }
39075
- function isPlainObject(value) {
39076
- if (!value || typeof value !== "object") { return false; }
39077
- if (Array.isArray(value)) { return true; }
39078
- var proto = Object.getPrototypeOf(value);
39079
- return !proto || proto === Object.prototype;
39080
- }
39081
- var assign = Object.assign || function assign(target, value) {
39082
- for (var key in value) {
39083
- if (has$1(value, key)) {
39084
- target[key] = value[key];
39085
- }
39058
+ const computeErrorEntries = (formState) => {
39059
+ const fields = Object.entries(formState);
39060
+ for (let entry of fields) {
39061
+ let fieldName = entry[0];
39062
+ let errors = computeErrors(fieldName, formState);
39063
+ formState[fieldName].errors = errors;
39064
+ formState[fieldName].hasErrors = errors.length > 0;
39086
39065
  }
39087
-
39088
- return target;
39089
39066
  };
39090
- 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;
39091
- function shallowCopy(base, invokeGetters) {
39092
- if ( invokeGetters === void 0 ) invokeGetters = false;
39093
-
39094
- if (Array.isArray(base)) { return base.slice(); }
39095
- var clone = Object.create(Object.getPrototypeOf(base));
39096
- ownKeys$2(base).forEach(function (key) {
39097
- if (key === DRAFT_STATE) {
39098
- return; // Never copy over draft state.
39099
- }
39100
-
39101
- var desc = Object.getOwnPropertyDescriptor(base, key);
39102
- var value = desc.value;
39103
-
39104
- if (desc.get) {
39105
- if (!invokeGetters) {
39106
- throw new Error("Immer drafts cannot have computed properties");
39107
- }
39108
39067
 
39109
- value = desc.get.call(base);
39110
- }
39111
-
39112
- if (desc.enumerable) {
39113
- clone[key] = value;
39114
- } else {
39115
- Object.defineProperty(clone, key, {
39116
- value: value,
39117
- writable: true,
39118
- configurable: true
39119
- });
39120
- }
39121
- });
39122
- return clone;
39123
- }
39124
- function each(value, cb) {
39125
- if (Array.isArray(value)) {
39126
- for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
39127
- } else {
39128
- ownKeys$2(value).forEach(function (key) { return cb(key, value[key], value); });
39129
- }
39130
- }
39131
- function isEnumerable(base, prop) {
39132
- var desc = Object.getOwnPropertyDescriptor(base, prop);
39133
- return !!desc && desc.enumerable;
39134
- }
39135
- function has$1(thing, prop) {
39136
- return Object.prototype.hasOwnProperty.call(thing, prop);
39137
- }
39138
- function is(x, y) {
39139
- // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
39140
- if (x === y) {
39141
- return x !== 0 || 1 / x === 1 / y;
39142
- } else {
39143
- return x !== x && y !== y;
39068
+ const computeDirtyEntries = (formState, changedFieldName) => {
39069
+ const fields = Object.entries(formState);
39070
+ for (let entry of fields) {
39071
+ let fieldName = entry[0];
39072
+ let field = entry[1];
39073
+ let dirty = fieldName === changedFieldName ? true : field.dirty;
39074
+ formState[fieldName].dirty = dirty;
39144
39075
  }
39145
- }
39146
- function clone(obj) {
39147
- if (!isDraftable(obj)) { return obj; }
39148
- if (Array.isArray(obj)) { return obj.map(clone); }
39149
- var cloned = Object.create(Object.getPrototypeOf(obj));
39150
-
39151
- for (var key in obj) { cloned[key] = clone(obj[key]); }
39152
-
39153
- return cloned;
39154
- }
39155
-
39156
- /** Each scope represents a `produce` call. */
39157
-
39158
- var ImmerScope = function ImmerScope(parent) {
39159
- this.drafts = [];
39160
- this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
39161
- // need to prevent auto-freezing so the unowned draft can be finalized.
39162
-
39163
- this.canAutoFreeze = true; // To avoid prototype lookups:
39164
-
39165
- this.patches = null;
39166
- };
39167
-
39168
- ImmerScope.prototype.usePatches = function usePatches (patchListener) {
39169
- if (patchListener) {
39170
- this.patches = [];
39171
- this.inversePatches = [];
39172
- this.patchListener = patchListener;
39173
- }
39174
- };
39175
-
39176
- ImmerScope.prototype.revoke = function revoke$1 () {
39177
- this.leave();
39178
- this.drafts.forEach(revoke);
39179
- this.drafts = null; // Make draft-related methods throw.
39180
- };
39181
-
39182
- ImmerScope.prototype.leave = function leave () {
39183
- if (this === ImmerScope.current) {
39184
- ImmerScope.current = this.parent;
39185
- }
39186
- };
39187
- ImmerScope.current = null;
39188
-
39189
- ImmerScope.enter = function () {
39190
- return this.current = new ImmerScope(this.current);
39191
39076
  };
39192
39077
 
39193
- function revoke(draft) {
39194
- draft[DRAFT_STATE].revoke();
39195
- }
39196
-
39197
- // but share them all instead
39198
-
39199
- var descriptors$1 = {};
39200
- function willFinalize(scope, result, isReplaced) {
39201
- scope.drafts.forEach(function (draft) {
39202
- draft[DRAFT_STATE].finalizing = true;
39203
- });
39204
-
39205
- if (!isReplaced) {
39206
- if (scope.patches) {
39207
- markChangesRecursively(scope.drafts[0]);
39208
- } // This is faster when we don't care about which attributes changed.
39078
+ 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;
39209
39079
 
39210
-
39211
- markChangesSweep(scope.drafts);
39212
- } // When a child draft is returned, look for changes.
39213
- else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {
39214
- markChangesSweep(scope.drafts);
39215
- }
39216
- }
39217
- function createProxy(base, parent) {
39218
- var isArray = Array.isArray(base);
39219
- var draft = clonePotentialDraft(base);
39220
- each(draft, function (prop) {
39221
- proxyProperty(draft, prop, isArray || isEnumerable(base, prop));
39222
- }); // See "proxy.js" for property documentation.
39223
-
39224
- var scope = parent ? parent.scope : ImmerScope.current;
39225
- var state = {
39226
- scope: scope,
39227
- modified: false,
39228
- finalizing: false,
39229
- // es5 only
39230
- finalized: false,
39231
- assigned: {},
39232
- parent: parent,
39233
- base: base,
39234
- draft: draft,
39235
- copy: null,
39236
- revoke: revoke$1,
39237
- revoked: false // es5 only
39238
-
39239
- };
39240
- createHiddenProperty(draft, DRAFT_STATE, state);
39241
- scope.drafts.push(draft);
39242
- return draft;
39243
- }
39244
-
39245
- function revoke$1() {
39246
- this.revoked = true;
39247
- }
39248
-
39249
- function source(state) {
39250
- return state.copy || state.base;
39251
- } // Access a property without creating an Immer draft.
39252
-
39253
-
39254
- function peek(draft, prop) {
39255
- var state = draft[DRAFT_STATE];
39256
-
39257
- if (state && !state.finalizing) {
39258
- state.finalizing = true;
39259
- var value = draft[prop];
39260
- state.finalizing = false;
39261
- return value;
39262
- }
39263
-
39264
- return draft[prop];
39265
- }
39266
-
39267
- function get$1(state, prop) {
39268
- assertUnrevoked(state);
39269
- var value = peek(source(state), prop);
39270
- if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
39271
-
39272
- if (value === peek(state.base, prop) && isDraftable(value)) {
39273
- prepareCopy(state);
39274
- return state.copy[prop] = createProxy(value, state);
39275
- }
39276
-
39277
- return value;
39278
- }
39279
-
39280
- function set$1(state, prop, value) {
39281
- assertUnrevoked(state);
39282
- state.assigned[prop] = true;
39283
-
39284
- if (!state.modified) {
39285
- if (is(value, peek(source(state), prop))) { return; }
39286
- markChanged(state);
39287
- prepareCopy(state);
39288
- }
39289
-
39290
- state.copy[prop] = value;
39291
- }
39292
-
39293
- function markChanged(state) {
39294
- if (!state.modified) {
39295
- state.modified = true;
39296
- if (state.parent) { markChanged(state.parent); }
39297
- }
39298
- }
39299
-
39300
- function prepareCopy(state) {
39301
- if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
39302
- }
39303
-
39304
- function clonePotentialDraft(base) {
39305
- var state = base && base[DRAFT_STATE];
39306
-
39307
- if (state) {
39308
- state.finalizing = true;
39309
- var draft = shallowCopy(state.draft, true);
39310
- state.finalizing = false;
39311
- return draft;
39312
- }
39313
-
39314
- return shallowCopy(base);
39315
- }
39316
-
39317
- function proxyProperty(draft, prop, enumerable) {
39318
- var desc = descriptors$1[prop];
39319
-
39320
- if (desc) {
39321
- desc.enumerable = enumerable;
39322
- } else {
39323
- descriptors$1[prop] = desc = {
39324
- configurable: true,
39325
- enumerable: enumerable,
39326
-
39327
- get: function get$1$1() {
39328
- return get$1(this[DRAFT_STATE], prop);
39329
- },
39330
-
39331
- set: function set$1$1(value) {
39332
- set$1(this[DRAFT_STATE], prop, value);
39333
- }
39334
-
39335
- };
39336
- }
39337
-
39338
- Object.defineProperty(draft, prop, desc);
39339
- }
39340
-
39341
- function assertUnrevoked(state) {
39342
- 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))); }
39343
- } // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
39344
-
39345
-
39346
- function markChangesSweep(drafts) {
39347
- // The natural order of drafts in the `scope` array is based on when they
39348
- // were accessed. By processing drafts in reverse natural order, we have a
39349
- // better chance of processing leaf nodes first. When a leaf node is known to
39350
- // have changed, we can avoid any traversal of its ancestor nodes.
39351
- for (var i = drafts.length - 1; i >= 0; i--) {
39352
- var state = drafts[i][DRAFT_STATE];
39353
-
39354
- if (!state.modified) {
39355
- if (Array.isArray(state.base)) {
39356
- if (hasArrayChanges(state)) { markChanged(state); }
39357
- } else if (hasObjectChanges(state)) { markChanged(state); }
39358
- }
39359
- }
39360
- }
39361
-
39362
- function markChangesRecursively(object) {
39363
- if (!object || typeof object !== "object") { return; }
39364
- var state = object[DRAFT_STATE];
39365
- if (!state) { return; }
39366
- var base = state.base;
39367
- var draft = state.draft;
39368
- var assigned = state.assigned;
39369
-
39370
- if (!Array.isArray(object)) {
39371
- // Look for added keys.
39372
- Object.keys(draft).forEach(function (key) {
39373
- // The `undefined` check is a fast path for pre-existing keys.
39374
- if (base[key] === undefined && !has$1(base, key)) {
39375
- assigned[key] = true;
39376
- markChanged(state);
39377
- } else if (!assigned[key]) {
39378
- // Only untouched properties trigger recursion.
39379
- markChangesRecursively(draft[key]);
39380
- }
39381
- }); // Look for removed keys.
39382
-
39383
- Object.keys(base).forEach(function (key) {
39384
- // The `undefined` check is a fast path for pre-existing keys.
39385
- if (draft[key] === undefined && !has$1(draft, key)) {
39386
- assigned[key] = false;
39387
- markChanged(state);
39388
- }
39389
- });
39390
- } else if (hasArrayChanges(state)) {
39391
- markChanged(state);
39392
- assigned.length = true;
39393
-
39394
- if (draft.length < base.length) {
39395
- for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
39396
- } else {
39397
- for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
39398
- }
39399
-
39400
- for (var i$2 = 0; i$2 < draft.length; i$2++) {
39401
- // Only untouched indices trigger recursion.
39402
- if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
39403
- }
39404
- }
39405
- }
39406
-
39407
- function hasObjectChanges(state) {
39408
- var base = state.base;
39409
- var draft = state.draft; // Search for added keys and changed keys. Start at the back, because
39410
- // non-numeric keys are ordered by time of definition on the object.
39411
-
39412
- var keys = Object.keys(draft);
39413
-
39414
- for (var i = keys.length - 1; i >= 0; i--) {
39415
- var key = keys[i];
39416
- var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.
39417
-
39418
- if (baseValue === undefined && !has$1(base, key)) {
39419
- return true;
39420
- } // Once a base key is deleted, future changes go undetected, because its
39421
- // descriptor is erased. This branch detects any missed changes.
39422
- else {
39423
- var value = draft[key];
39424
- var state$1 = value && value[DRAFT_STATE];
39425
-
39426
- if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {
39427
- return true;
39428
- }
39429
- }
39430
- } // At this point, no keys were added or changed.
39431
- // Compare key count to determine if keys were deleted.
39432
-
39433
-
39434
- return keys.length !== Object.keys(base).length;
39435
- }
39436
-
39437
- function hasArrayChanges(state) {
39438
- var draft = state.draft;
39439
- if (draft.length !== state.base.length) { return true; } // See #116
39440
- // If we first shorten the length, our array interceptors will be removed.
39441
- // If after that new items are added, result in the same original length,
39442
- // those last items will have no intercepting property.
39443
- // So if there is no own descriptor on the last position, we know that items were removed and added
39444
- // N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
39445
- // the last one
39446
-
39447
- var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
39448
-
39449
- 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
39450
-
39451
- return false;
39452
- }
39453
-
39454
- function createHiddenProperty(target, prop, value) {
39455
- Object.defineProperty(target, prop, {
39456
- value: value,
39457
- enumerable: false,
39458
- writable: true
39459
- });
39460
- }
39461
-
39462
- var legacyProxy = /*#__PURE__*/Object.freeze({
39463
- willFinalize: willFinalize,
39464
- createProxy: createProxy
39465
- });
39466
-
39467
- function willFinalize$1() {}
39468
- function createProxy$1(base, parent) {
39469
- var scope = parent ? parent.scope : ImmerScope.current;
39470
- var state = {
39471
- // Track which produce call this is associated with.
39472
- scope: scope,
39473
- // True for both shallow and deep changes.
39474
- modified: false,
39475
- // Used during finalization.
39476
- finalized: false,
39477
- // Track which properties have been assigned (true) or deleted (false).
39478
- assigned: {},
39479
- // The parent draft state.
39480
- parent: parent,
39481
- // The base state.
39482
- base: base,
39483
- // The base proxy.
39484
- draft: null,
39485
- // Any property proxies.
39486
- drafts: {},
39487
- // The base copy with any updated values.
39488
- copy: null,
39489
- // Called by the `produce` function.
39490
- revoke: null
39491
- };
39492
- var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,
39493
- // although state itself is an object
39494
- Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
39495
- var revoke = ref.revoke;
39496
- var proxy = ref.proxy;
39497
- state.draft = proxy;
39498
- state.revoke = revoke;
39499
- scope.drafts.push(proxy);
39500
- return proxy;
39501
- }
39502
- var objectTraps = {
39503
- get: get$1$1,
39504
-
39505
- has: function has(target, prop) {
39506
- return prop in source$1(target);
39507
- },
39508
-
39509
- ownKeys: function ownKeys(target) {
39510
- return Reflect.ownKeys(source$1(target));
39511
- },
39512
-
39513
- set: set$1$1,
39514
- deleteProperty: deleteProperty,
39515
- getOwnPropertyDescriptor: getOwnPropertyDescriptor$2,
39516
-
39517
- defineProperty: function defineProperty() {
39518
- throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
39519
- },
39520
-
39521
- getPrototypeOf: function getPrototypeOf(target) {
39522
- return Object.getPrototypeOf(target.base);
39523
- },
39524
-
39525
- setPrototypeOf: function setPrototypeOf() {
39526
- throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
39527
- }
39528
-
39529
- };
39530
- var arrayTraps = {};
39531
- each(objectTraps, function (key, fn) {
39532
- arrayTraps[key] = function () {
39533
- arguments[0] = arguments[0][0];
39534
- return fn.apply(this, arguments);
39535
- };
39536
- });
39537
-
39538
- arrayTraps.deleteProperty = function (state, prop) {
39539
- if (isNaN(parseInt(prop))) {
39540
- throw new Error("Immer only supports deleting array indices"); // prettier-ignore
39541
- }
39542
-
39543
- return objectTraps.deleteProperty.call(this, state[0], prop);
39544
- };
39545
-
39546
- arrayTraps.set = function (state, prop, value) {
39547
- if (prop !== "length" && isNaN(parseInt(prop))) {
39548
- throw new Error("Immer only supports setting array indices and the 'length' property"); // prettier-ignore
39549
- }
39550
-
39551
- return objectTraps.set.call(this, state[0], prop, value);
39552
- }; // returns the object we should be reading the current value from, which is base, until some change has been made
39553
-
39554
-
39555
- function source$1(state) {
39556
- return state.copy || state.base;
39557
- } // Access a property without creating an Immer draft.
39558
-
39559
-
39560
- function peek$1(draft, prop) {
39561
- var state = draft[DRAFT_STATE];
39562
- var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);
39563
- return desc && desc.value;
39564
- }
39565
-
39566
- function get$1$1(state, prop) {
39567
- if (prop === DRAFT_STATE) { return state; }
39568
- var drafts = state.drafts; // Check for existing draft in unmodified state.
39569
-
39570
- if (!state.modified && has$1(drafts, prop)) {
39571
- return drafts[prop];
39572
- }
39573
-
39574
- var value = source$1(state)[prop];
39575
-
39576
- if (state.finalized || !isDraftable(value)) {
39577
- return value;
39578
- } // Check for existing draft in modified state.
39579
-
39580
-
39581
- if (state.modified) {
39582
- // Assigned values are never drafted. This catches any drafts we created, too.
39583
- if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
39584
-
39585
- drafts = state.copy;
39586
- }
39587
-
39588
- return drafts[prop] = createProxy$1(value, state);
39589
- }
39590
-
39591
- function set$1$1(state, prop, value) {
39592
- if (!state.modified) {
39593
- var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
39594
- // never be undefined, so we can avoid the `in` operator. Lastly, truthy
39595
- // values may be drafts, but falsy values are never drafts.
39596
-
39597
- var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
39598
- if (isUnchanged) { return true; }
39599
- markChanged$1(state);
39600
- }
39601
-
39602
- state.assigned[prop] = true;
39603
- state.copy[prop] = value;
39604
- return true;
39605
- }
39606
-
39607
- function deleteProperty(state, prop) {
39608
- // The `undefined` check is a fast path for pre-existing keys.
39609
- if (peek$1(state.base, prop) !== undefined || prop in state.base) {
39610
- state.assigned[prop] = false;
39611
- markChanged$1(state);
39612
- } else if (state.assigned[prop]) {
39613
- // if an originally not assigned property was deleted
39614
- delete state.assigned[prop];
39615
- }
39616
-
39617
- if (state.copy) { delete state.copy[prop]; }
39618
- return true;
39619
- } // Note: We never coerce `desc.value` into an Immer draft, because we can't make
39620
- // the same guarantee in ES5 mode.
39621
-
39622
-
39623
- function getOwnPropertyDescriptor$2(state, prop) {
39624
- var owner = source$1(state);
39625
- var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
39626
-
39627
- if (desc) {
39628
- desc.writable = true;
39629
- desc.configurable = !Array.isArray(owner) || prop !== "length";
39630
- }
39631
-
39632
- return desc;
39633
- }
39634
-
39635
- function markChanged$1(state) {
39636
- if (!state.modified) {
39637
- state.modified = true;
39638
- state.copy = assign(shallowCopy(state.base), state.drafts);
39639
- state.drafts = null;
39640
- if (state.parent) { markChanged$1(state.parent); }
39641
- }
39642
- }
39643
-
39644
- var modernProxy = /*#__PURE__*/Object.freeze({
39645
- willFinalize: willFinalize$1,
39646
- createProxy: createProxy$1
39647
- });
39648
-
39649
- function generatePatches(state, basePath, patches, inversePatches) {
39650
- Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);
39651
- }
39652
-
39653
- function generateArrayPatches(state, basePath, patches, inversePatches) {
39654
- var assign, assign$1;
39655
-
39656
- var base = state.base;
39657
- var copy = state.copy;
39658
- var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
39659
-
39660
- if (copy.length < base.length) {
39661
- (assign = [copy, base], base = assign[0], copy = assign[1]);
39662
- (assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
39663
- }
39664
-
39665
- var delta = copy.length - base.length; // Find the first replaced index.
39666
-
39667
- var start = 0;
39668
-
39669
- while (base[start] === copy[start] && start < base.length) {
39670
- ++start;
39671
- } // Find the last replaced index. Search from the end to optimize splice patches.
39672
-
39673
-
39674
- var end = base.length;
39675
-
39676
- while (end > start && base[end - 1] === copy[end + delta - 1]) {
39677
- --end;
39678
- } // Process replaced indices.
39679
-
39680
-
39681
- for (var i = start; i < end; ++i) {
39682
- if (assigned[i] && copy[i] !== base[i]) {
39683
- var path = basePath.concat([i]);
39684
- patches.push({
39685
- op: "replace",
39686
- path: path,
39687
- value: copy[i]
39688
- });
39689
- inversePatches.push({
39690
- op: "replace",
39691
- path: path,
39692
- value: base[i]
39693
- });
39694
- }
39695
- }
39696
-
39697
- var replaceCount = patches.length; // Process added indices.
39698
-
39699
- for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
39700
- var path$1 = basePath.concat([i$1]);
39701
- patches[replaceCount + i$1 - end] = {
39702
- op: "add",
39703
- path: path$1,
39704
- value: copy[i$1]
39705
- };
39706
- inversePatches.push({
39707
- op: "remove",
39708
- path: path$1
39709
- });
39710
- }
39711
- }
39712
-
39713
- function generateObjectPatches(state, basePath, patches, inversePatches) {
39714
- var base = state.base;
39715
- var copy = state.copy;
39716
- each(state.assigned, function (key, assignedValue) {
39717
- var origValue = base[key];
39718
- var value = copy[key];
39719
- var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
39720
- if (origValue === value && op === "replace") { return; }
39721
- var path = basePath.concat(key);
39722
- patches.push(op === "remove" ? {
39723
- op: op,
39724
- path: path
39725
- } : {
39726
- op: op,
39727
- path: path,
39728
- value: value
39729
- });
39730
- inversePatches.push(op === "add" ? {
39731
- op: "remove",
39732
- path: path
39733
- } : op === "remove" ? {
39734
- op: "add",
39735
- path: path,
39736
- value: origValue
39737
- } : {
39738
- op: "replace",
39739
- path: path,
39740
- value: origValue
39741
- });
39742
- });
39743
- }
39744
-
39745
- var applyPatches = function (draft, patches) {
39746
- for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
39747
- var patch = list[i$1];
39748
-
39749
- var path = patch.path;
39750
- var op = patch.op;
39751
- var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
39752
-
39753
- if (!path.length) { throw new Error("Illegal state"); }
39754
- var base = draft;
39755
-
39756
- for (var i = 0; i < path.length - 1; i++) {
39757
- base = base[path[i]];
39758
- if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
39759
- }
39760
-
39761
- var key = path[path.length - 1];
39762
-
39763
- switch (op) {
39764
- case "replace":
39765
- // if value is an object, then it's assigned by reference
39766
- // in the following add or remove ops, the value field inside the patch will also be modifyed
39767
- // so we use value from the cloned patch
39768
- base[key] = value;
39769
- break;
39770
-
39771
- case "add":
39772
- if (Array.isArray(base)) {
39773
- // TODO: support "foo/-" paths for appending to an array
39774
- base.splice(key, 0, value);
39775
- } else {
39776
- base[key] = value;
39777
- }
39778
-
39779
- break;
39780
-
39781
- case "remove":
39782
- if (Array.isArray(base)) {
39783
- base.splice(key, 1);
39784
- } else {
39785
- delete base[key];
39786
- }
39787
-
39788
- break;
39789
-
39790
- default:
39791
- throw new Error("Unsupported patch operation: " + op);
39792
- }
39793
- }
39794
-
39795
- return draft;
39796
- };
39797
-
39798
- function verifyMinified() {}
39799
-
39800
- var configDefaults = {
39801
- useProxies: typeof Proxy !== "undefined" && typeof Reflect !== "undefined",
39802
- autoFreeze: typeof process !== "undefined" ? process.env.NODE_ENV !== "production" : verifyMinified.name === "verifyMinified",
39803
- onAssign: null,
39804
- onDelete: null,
39805
- onCopy: null
39806
- };
39807
- var Immer = function Immer(config) {
39808
- assign(this, configDefaults, config);
39809
- this.setUseProxies(this.useProxies);
39810
- this.produce = this.produce.bind(this);
39811
- };
39812
-
39813
- Immer.prototype.produce = function produce (base, recipe, patchListener) {
39814
- var this$1$1 = this;
39815
-
39816
- // curried invocation
39817
- if (typeof base === "function" && typeof recipe !== "function") {
39818
- var defaultBase = recipe;
39819
- recipe = base;
39820
- var self = this;
39821
- return function curriedProduce(base) {
39822
- var this$1$1 = this;
39823
- if ( base === void 0 ) base = defaultBase;
39824
- var args = [], len = arguments.length - 1;
39825
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
39826
-
39827
- return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
39828
- };
39829
- } // prettier-ignore
39830
-
39831
-
39832
- {
39833
- if (typeof recipe !== "function") {
39834
- throw new Error("The first or second argument to `produce` must be a function");
39835
- }
39836
-
39837
- if (patchListener !== undefined && typeof patchListener !== "function") {
39838
- throw new Error("The third argument to `produce` must be a function or undefined");
39839
- }
39840
- }
39841
- var result; // Only plain objects, arrays, and "immerable classes" are drafted.
39842
-
39843
- if (isDraftable(base)) {
39844
- var scope = ImmerScope.enter();
39845
- var proxy = this.createProxy(base);
39846
- var hasError = true;
39847
-
39848
- try {
39849
- result = recipe(proxy);
39850
- hasError = false;
39851
- } finally {
39852
- // finally instead of catch + rethrow better preserves original stack
39853
- if (hasError) { scope.revoke(); }else { scope.leave(); }
39854
- }
39855
-
39856
- if (result instanceof Promise) {
39857
- return result.then(function (result) {
39858
- scope.usePatches(patchListener);
39859
- return this$1$1.processResult(result, scope);
39860
- }, function (error) {
39861
- scope.revoke();
39862
- throw error;
39863
- });
39864
- }
39865
-
39866
- scope.usePatches(patchListener);
39867
- return this.processResult(result, scope);
39868
- } else {
39869
- result = recipe(base);
39870
- if (result === undefined) { return base; }
39871
- return result !== NOTHING ? result : undefined;
39872
- }
39873
- };
39874
-
39875
- Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
39876
- var this$1$1 = this;
39877
-
39878
- if (typeof arg1 === "function") {
39879
- return function (state) {
39880
- var args = [], len = arguments.length - 1;
39881
- while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
39882
-
39883
- return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
39884
- };
39885
- } // non-curried form
39886
-
39887
-
39888
- if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
39889
- var patches, inversePatches;
39890
- var nextState = this.produce(arg1, arg2, function (p, ip) {
39891
- patches = p;
39892
- inversePatches = ip;
39893
- });
39894
- return [nextState, patches, inversePatches];
39895
- };
39896
-
39897
- Immer.prototype.createDraft = function createDraft (base) {
39898
- if (!isDraftable(base)) {
39899
- throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
39900
- }
39901
-
39902
- var scope = ImmerScope.enter();
39903
- var proxy = this.createProxy(base);
39904
- proxy[DRAFT_STATE].isManual = true;
39905
- scope.leave();
39906
- return proxy;
39907
- };
39908
-
39909
- Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
39910
- var state = draft && draft[DRAFT_STATE];
39911
-
39912
- if (!state || !state.isManual) {
39913
- throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`"); // prettier-ignore
39914
- }
39915
-
39916
- if (state.finalized) {
39917
- throw new Error("The given draft is already finalized"); // prettier-ignore
39918
- }
39919
-
39920
- var scope = state.scope;
39921
- scope.usePatches(patchListener);
39922
- return this.processResult(undefined, scope);
39923
- };
39924
-
39925
- Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
39926
- this.autoFreeze = value;
39927
- };
39928
-
39929
- Immer.prototype.setUseProxies = function setUseProxies (value) {
39930
- this.useProxies = value;
39931
- assign(this, value ? modernProxy : legacyProxy);
39932
- };
39933
-
39934
- Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
39935
- // If a patch replaces the entire state, take that replacement as base
39936
- // before applying patches
39937
- var i;
39938
-
39939
- for (i = patches.length - 1; i >= 0; i--) {
39940
- var patch = patches[i];
39941
-
39942
- if (patch.path.length === 0 && patch.op === "replace") {
39943
- base = patch.value;
39944
- break;
39945
- }
39946
- }
39947
-
39948
- if (isDraft(base)) {
39949
- // N.B: never hits if some patch a replacement, patches are never drafts
39950
- return applyPatches(base, patches);
39951
- } // Otherwise, produce a copy of the base state.
39952
-
39953
-
39954
- return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
39955
- };
39956
- /** @internal */
39957
-
39958
-
39959
- Immer.prototype.processResult = function processResult (result, scope) {
39960
- var baseDraft = scope.drafts[0];
39961
- var isReplaced = result !== undefined && result !== baseDraft;
39962
- this.willFinalize(scope, result, isReplaced);
39963
-
39964
- if (isReplaced) {
39965
- if (baseDraft[DRAFT_STATE].modified) {
39966
- scope.revoke();
39967
- 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
39968
- }
39969
-
39970
- if (isDraftable(result)) {
39971
- // Finalize the result in case it contains (or is) a subset of the draft.
39972
- result = this.finalize(result, null, scope);
39973
- }
39974
-
39975
- if (scope.patches) {
39976
- scope.patches.push({
39977
- op: "replace",
39978
- path: [],
39979
- value: result
39980
- });
39981
- scope.inversePatches.push({
39982
- op: "replace",
39983
- path: [],
39984
- value: baseDraft[DRAFT_STATE].base
39985
- });
39986
- }
39987
- } else {
39988
- // Finalize the base draft.
39989
- result = this.finalize(baseDraft, [], scope);
39990
- }
39991
-
39992
- scope.revoke();
39993
-
39994
- if (scope.patches) {
39995
- scope.patchListener(scope.patches, scope.inversePatches);
39996
- }
39997
-
39998
- return result !== NOTHING ? result : undefined;
39999
- };
40000
- /**
40001
- * @internal
40002
- * Finalize a draft, returning either the unmodified base state or a modified
40003
- * copy of the base state.
40004
- */
40005
-
40006
-
40007
- Immer.prototype.finalize = function finalize (draft, path, scope) {
40008
- var this$1$1 = this;
40009
-
40010
- var state = draft[DRAFT_STATE];
40011
-
40012
- if (!state) {
40013
- if (Object.isFrozen(draft)) { return draft; }
40014
- return this.finalizeTree(draft, null, scope);
40015
- } // Never finalize drafts owned by another scope.
40016
-
40017
-
40018
- if (state.scope !== scope) {
40019
- return draft;
40020
- }
40021
-
40022
- if (!state.modified) {
40023
- return state.base;
40024
- }
40025
-
40026
- if (!state.finalized) {
40027
- state.finalized = true;
40028
- this.finalizeTree(state.draft, path, scope);
40029
-
40030
- if (this.onDelete) {
40031
- // The `assigned` object is unreliable with ES5 drafts.
40032
- if (this.useProxies) {
40033
- var assigned = state.assigned;
40034
-
40035
- for (var prop in assigned) {
40036
- if (!assigned[prop]) { this.onDelete(state, prop); }
40037
- }
40038
- } else {
40039
- var base = state.base;
40040
- var copy = state.copy;
40041
- each(base, function (prop) {
40042
- if (!has$1(copy, prop)) { this$1$1.onDelete(state, prop); }
40043
- });
40044
- }
40045
- }
40046
-
40047
- if (this.onCopy) {
40048
- this.onCopy(state);
40049
- } // At this point, all descendants of `state.copy` have been finalized,
40050
- // so we can be sure that `scope.canAutoFreeze` is accurate.
40051
-
40052
-
40053
- if (this.autoFreeze && scope.canAutoFreeze) {
40054
- Object.freeze(state.copy);
40055
- }
40056
-
40057
- if (path && scope.patches) {
40058
- generatePatches(state, path, scope.patches, scope.inversePatches);
40059
- }
40060
- }
40061
-
40062
- return state.copy;
40063
- };
40064
- /**
40065
- * @internal
40066
- * Finalize all drafts in the given state tree.
40067
- */
40068
-
40069
-
40070
- Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
40071
- var this$1$1 = this;
40072
-
40073
- var state = root[DRAFT_STATE];
40074
-
40075
- if (state) {
40076
- if (!this.useProxies) {
40077
- // Create the final copy, with added keys and without deleted keys.
40078
- state.copy = shallowCopy(state.draft, true);
40079
- }
40080
-
40081
- root = state.copy;
40082
- }
40083
-
40084
- var needPatches = !!rootPath && !!scope.patches;
40085
-
40086
- var finalizeProperty = function (prop, value, parent) {
40087
- if (value === parent) {
40088
- throw Error("Immer forbids circular references");
40089
- } // In the `finalizeTree` method, only the `root` object may be a draft.
40090
-
40091
-
40092
- var isDraftProp = !!state && parent === root;
40093
-
40094
- if (isDraft(value)) {
40095
- var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
40096
-
40097
- value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
40098
-
40099
- if (isDraft(value)) {
40100
- scope.canAutoFreeze = false;
40101
- } // Preserve non-enumerable properties.
40102
-
40103
-
40104
- if (Array.isArray(parent) || isEnumerable(parent, prop)) {
40105
- parent[prop] = value;
40106
- } else {
40107
- Object.defineProperty(parent, prop, {
40108
- value: value
40109
- });
40110
- } // Unchanged drafts are never passed to the `onAssign` hook.
40111
-
40112
-
40113
- if (isDraftProp && value === state.base[prop]) { return; }
40114
- } // Unchanged draft properties are ignored.
40115
- else if (isDraftProp && is(value, state.base[prop])) {
40116
- return;
40117
- } // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
40118
- else if (isDraftable(value) && !Object.isFrozen(value)) {
40119
- each(value, finalizeProperty);
40120
- }
40121
-
40122
- if (isDraftProp && this$1$1.onAssign) {
40123
- this$1$1.onAssign(state, prop, value);
40124
- }
40125
- };
40126
-
40127
- each(root, finalizeProperty);
40128
- return root;
40129
- };
40130
-
40131
- var immer = new Immer();
40132
- /**
40133
- * The `produce` function takes a value and a "recipe function" (whose
40134
- * return value often depends on the base state). The recipe function is
40135
- * free to mutate its first argument however it wants. All mutations are
40136
- * only ever applied to a __copy__ of the base state.
40137
- *
40138
- * Pass only a function to create a "curried producer" which relieves you
40139
- * from passing the recipe function every time.
40140
- *
40141
- * Only plain objects and arrays are made mutable. All other objects are
40142
- * considered uncopyable.
40143
- *
40144
- * Note: This function is __bound__ to its `Immer` instance.
40145
- *
40146
- * @param {any} base - the initial state
40147
- * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
40148
- * @param {Function} patchListener - optional function that will be called with all the patches produced here
40149
- * @returns {any} a new state, or the initial state if nothing was modified
40150
- */
40151
-
40152
- var produce = immer.produce;
40153
- /**
40154
- * Like `produce`, but `produceWithPatches` always returns a tuple
40155
- * [nextState, patches, inversePatches] (instead of just the next state)
40156
- */
40157
-
40158
- immer.produceWithPatches.bind(immer);
40159
- /**
40160
- * Pass true to automatically freeze all copies created by Immer.
40161
- *
40162
- * By default, auto-freezing is disabled in production.
40163
- */
40164
-
40165
- immer.setAutoFreeze.bind(immer);
40166
- /**
40167
- * Pass true to use the ES2015 `Proxy` class when creating drafts, which is
40168
- * always faster than using ES5 proxies.
40169
- *
40170
- * By default, feature detection is used, so calling this is rarely necessary.
40171
- */
40172
-
40173
- immer.setUseProxies.bind(immer);
40174
- /**
40175
- * Apply an array of Immer patches to the first argument.
40176
- *
40177
- * This function is a producer, which means copy-on-write is in effect.
40178
- */
40179
-
40180
- immer.applyPatches.bind(immer);
40181
- /**
40182
- * Create an Immer draft from the given base state, which may be a draft itself.
40183
- * The draft can be modified until you finalize it with the `finishDraft` function.
40184
- */
40185
-
40186
- immer.createDraft.bind(immer);
40187
- /**
40188
- * Finalize an Immer draft from a `createDraft` call, returning the base state
40189
- * (if no changes were made) or a modified copy. The draft must *not* be
40190
- * mutated afterwards.
40191
- *
40192
- * Pass a function as the 2nd argument to generate Immer patches based on the
40193
- * changes that were made.
40194
- */
40195
-
40196
- immer.finishDraft.bind(immer);
40197
-
40198
- const createInitialState = formConfig => {
39080
+ const createInitialState = (formConfig) => {
40199
39081
  let initialForm = {};
40200
39082
  const formConfigKeys = Object.keys(formConfig);
40201
39083
  for (let formKey of formConfigKeys) {
40202
39084
  initialForm[formKey] = {
40203
39085
  dirty: false,
40204
- rawValue: formConfig[formKey].defaultValue || "",
39086
+ rawValue: formConfig[formKey].defaultValue || '',
40205
39087
  validators: formConfig[formKey].validators || [],
40206
- constraints: formConfig[formKey].constraints || []
39088
+ constraints: formConfig[formKey].constraints || [],
40207
39089
  };
40208
39090
  }
40209
39091
  // Because validators require the entire form we have to do a
@@ -40214,82 +39096,99 @@ const createInitialState = formConfig => {
40214
39096
  initialForm[formKey].errors = errors;
40215
39097
  initialForm[formKey].hasErrors = errors.length > 0;
40216
39098
  }
39099
+
40217
39100
  return initialForm;
40218
39101
  };
40219
39102
 
40220
- const SET = "field/SET";
40221
- const set$2 = fieldName => value => ({
39103
+ const SET = 'field/SET';
39104
+ const set$1 = (fieldName) => (value) => ({
40222
39105
  type: SET,
40223
- payload: { fieldName, value }
39106
+ payload: { fieldName, value },
40224
39107
  });
40225
39108
 
40226
- const CLEAR = "form/CLEAR";
39109
+ const CLEAR = 'form/CLEAR';
40227
39110
  const clear = () => ({ type: CLEAR });
40228
39111
 
40229
- const ADD_VALIDATOR = "field/ADD_VALIDATOR";
40230
- const addValidator = fieldName => validator => ({
39112
+ const ADD_VALIDATOR = 'field/ADD_VALIDATOR';
39113
+ const addValidator = (fieldName) => (validator) => ({
40231
39114
  type: ADD_VALIDATOR,
40232
- payload: { fieldName, validator }
39115
+ payload: { fieldName, validator },
40233
39116
  });
40234
39117
 
40235
- const createFormReducer = formConfig => (
40236
- state = createInitialState(formConfig),
40237
- action
40238
- ) => {
40239
- switch (action.type) {
40240
- case SET:
40241
- const changedFieldName = action.payload.fieldName;
40242
- const newRawValue = action.payload.value;
40243
-
40244
- return produce(state, draftState => {
40245
- let originalValue = draftState[changedFieldName].rawValue;
40246
- draftState[changedFieldName].rawValue = newRawValue;
40247
- if (computeConstraints(changedFieldName, draftState).length > 0) {
40248
- // If the change violates constraints, revert the change
40249
- draftState[changedFieldName].rawValue = originalValue;
40250
- return draftState;
40251
- }
39118
+ const REMOVE_VALIDATOR = 'field/REMOVE_VALIDATOR';
39119
+ const removeValidator = (fieldName) => (validator) => ({
39120
+ type: REMOVE_VALIDATOR,
39121
+ payload: { fieldName, validator },
39122
+ });
40252
39123
 
40253
- const fields = Object.entries(draftState);
40254
- for (let entry of fields) {
40255
- let fieldName = entry[0];
40256
- let field = entry[1];
40257
- let errors = computeErrors(fieldName, draftState);
40258
- let dirty = fieldName === changedFieldName ? true : field.dirty;
40259
- draftState[fieldName].errors = errors;
40260
- draftState[fieldName].dirty = dirty;
40261
- draftState[fieldName].hasErrors = errors.length > 0;
40262
- }
40263
- });
40264
- case CLEAR:
40265
- return createInitialState(formConfig);
40266
- case ADD_VALIDATOR:
40267
- const fieldWithOverride = action.payload.fieldName;
40268
- const newValidator = action.payload.validator;
40269
-
40270
- return produce(state, draftState => {
40271
- draftState[fieldWithOverride].validators.push(newValidator);
40272
- const fields = Object.entries(draftState);
40273
- for (let entry of fields) {
40274
- let fieldName = entry[0];
40275
- let field = entry[1];
40276
- let errors = computeErrors(fieldName, draftState);
40277
- let dirty = field.dirty;
40278
- draftState[fieldName].errors = errors;
40279
- draftState[fieldName].dirty = dirty;
40280
- draftState[fieldName].hasErrors = errors.length > 0;
40281
- }
40282
- });
40283
- default:
40284
- return state;
40285
- }
40286
- };
39124
+ const CLEAR_FIELD_VALIDATORS = 'field/CLEAR_FIELD_VALIDATORS';
39125
+ const clearFieldValidators = (fieldName) => () => ({
39126
+ type: CLEAR_FIELD_VALIDATORS,
39127
+ payload: { fieldName },
39128
+ });
39129
+
39130
+ const createFormReducer =
39131
+ (formConfig) =>
39132
+ (state = createInitialState(formConfig), action) => {
39133
+ switch (action.type) {
39134
+ case SET: {
39135
+ const changedFieldName = action.payload.fieldName;
39136
+ const newRawValue = action.payload.value;
39137
+
39138
+ return produce(state, (draftState) => {
39139
+ let originalValue = draftState[changedFieldName].rawValue;
39140
+ draftState[changedFieldName].rawValue = newRawValue;
39141
+ if (computeConstraints(changedFieldName, draftState).length > 0) {
39142
+ // If the change violates constraints, revert the change
39143
+ draftState[changedFieldName].rawValue = originalValue;
39144
+ return draftState;
39145
+ }
39146
+
39147
+ computeDirtyEntries(draftState, changedFieldName);
39148
+ computeErrorEntries(draftState);
39149
+ });
39150
+ }
39151
+ case CLEAR:
39152
+ return createInitialState(formConfig);
39153
+ case ADD_VALIDATOR: {
39154
+ const fieldWithOverride = action.payload.fieldName;
39155
+ const newValidator = action.payload.validator;
39156
+
39157
+ return produce(state, (draftState) => {
39158
+ draftState[fieldWithOverride].validators.push(newValidator);
39159
+ computeErrorEntries(draftState);
39160
+ });
39161
+ }
39162
+ case REMOVE_VALIDATOR: {
39163
+ const fieldToOverride = action.payload.fieldName;
39164
+ const targetValidator = action.payload.validator;
39165
+
39166
+ return produce(state, (draftState) => {
39167
+ let fieldValidators = draftState[fieldToOverride].validators;
39168
+ draftState[fieldToOverride].validators = fieldValidators.filter(
39169
+ (validator) => validator.type !== targetValidator.type
39170
+ );
39171
+ computeErrorEntries(draftState);
39172
+ });
39173
+ }
39174
+ case CLEAR_FIELD_VALIDATORS: {
39175
+ const fieldToClear = action.payload.fieldName;
39176
+
39177
+ return produce(state, (draftState) => {
39178
+ draftState[fieldToClear].validators = [];
39179
+ computeErrorEntries(draftState);
39180
+ });
39181
+ }
39182
+ default:
39183
+ return state;
39184
+ }
39185
+ };
40287
39186
 
40288
- const createMapDispatchToProps = formConfig => {
39187
+ const createMapDispatchToProps = (formConfig) => {
40289
39188
  // Do memo-ization
40290
39189
  let cachedDispatch;
40291
39190
  let cacheValue;
40292
- return dispatch => {
39191
+ return (dispatch) => {
40293
39192
  if (dispatch == cachedDispatch) {
40294
39193
  return cacheValue;
40295
39194
  }
@@ -40298,8 +39197,11 @@ const createMapDispatchToProps = formConfig => {
40298
39197
  const keys = Object.keys(formConfig);
40299
39198
  for (let fieldName of keys) {
40300
39199
  dispatchObj.fields[fieldName] = {
40301
- set: value => dispatch(set$2(fieldName)(value)),
40302
- addValidator: validator => dispatch(addValidator(fieldName)(validator))
39200
+ set: (value) => dispatch(set$1(fieldName)(value)),
39201
+ addValidator: (validator) => dispatch(addValidator(fieldName)(validator)),
39202
+ removeValidator: (validator) =>
39203
+ dispatch(removeValidator(fieldName)(validator)),
39204
+ clear: () => dispatch(clearFieldValidators(fieldName)()),
40303
39205
  };
40304
39206
  }
40305
39207
  dispatchObj.form = { clear: () => dispatch(clear()) };
@@ -40309,12 +39211,12 @@ const createMapDispatchToProps = formConfig => {
40309
39211
  };
40310
39212
  };
40311
39213
 
40312
- const mapStateToProps = state => ({ fields: state });
39214
+ const mapStateToProps = (state) => ({ fields: state });
40313
39215
 
40314
- const createFormState = formConfig => ({
39216
+ const createFormState = (formConfig) => ({
40315
39217
  reducer: createFormReducer(formConfig),
40316
39218
  mapDispatchToProps: createMapDispatchToProps(formConfig),
40317
- mapStateToProps: mapStateToProps
39219
+ mapStateToProps: mapStateToProps,
40318
39220
  });
40319
39221
 
40320
39222
  var AddressForm = function AddressForm(_ref) {
@@ -43168,12 +42070,12 @@ LoginForm.mapDispatchToProps = mapDispatchToProps$5;
43168
42070
  * This source code is licensed under the MIT license found in the
43169
42071
  * LICENSE file in the root directory of this source tree.
43170
42072
  */
43171
- 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?
43172
- 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;
43173
- 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;
43174
- 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};
43175
- 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};
43176
- 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;
42073
+ 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?
42074
+ 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;
42075
+ 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;
42076
+ 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};
42077
+ 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};
42078
+ 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;
43177
42079
 
43178
42080
  var reactIs_production_min = {
43179
42081
  AsyncMode: AsyncMode,
@@ -43544,14 +42446,14 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
43544
42446
 
43545
42447
  var ReactPropTypesSecret_1 = ReactPropTypesSecret;
43546
42448
 
43547
- var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
42449
+ var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
43548
42450
 
43549
42451
  var printWarning = function() {};
43550
42452
 
43551
42453
  if (process.env.NODE_ENV !== 'production') {
43552
42454
  var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
43553
42455
  var loggedTypeFailures = {};
43554
- var has$3 = has$2;
42456
+ var has$2 = has$1;
43555
42457
 
43556
42458
  printWarning = function(text) {
43557
42459
  var message = 'Warning: ' + text;
@@ -43581,7 +42483,7 @@ if (process.env.NODE_ENV !== 'production') {
43581
42483
  function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
43582
42484
  if (process.env.NODE_ENV !== 'production') {
43583
42485
  for (var typeSpecName in typeSpecs) {
43584
- if (has$3(typeSpecs, typeSpecName)) {
42486
+ if (has$2(typeSpecs, typeSpecName)) {
43585
42487
  var error;
43586
42488
  // Prop type validation may throw. In case they do, we don't want to
43587
42489
  // fail the render phase where it didn't fail before. So we log it.
@@ -43980,7 +42882,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
43980
42882
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
43981
42883
  }
43982
42884
  for (var key in propValue) {
43983
- if (has$2(propValue, key)) {
42885
+ if (has$1(propValue, key)) {
43984
42886
  var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
43985
42887
  if (error instanceof Error) {
43986
42888
  return error;
@@ -44017,7 +42919,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
44017
42919
  if (checkerResult == null) {
44018
42920
  return null;
44019
42921
  }
44020
- if (checkerResult.data && has$2(checkerResult.data, 'expectedType')) {
42922
+ if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
44021
42923
  expectedTypes.push(checkerResult.data.expectedType);
44022
42924
  }
44023
42925
  }
@@ -44077,7 +42979,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
44077
42979
  var allKeys = objectAssign({}, props[propName], shapeTypes);
44078
42980
  for (var key in allKeys) {
44079
42981
  var checker = shapeTypes[key];
44080
- if (has$2(shapeTypes, key) && typeof checker !== 'function') {
42982
+ if (has$1(shapeTypes, key) && typeof checker !== 'function') {
44081
42983
  return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
44082
42984
  }
44083
42985
  if (!checker) {
@@ -44815,7 +43717,7 @@ var index_esm = /*#__PURE__*/Object.freeze({
44815
43717
  * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
44816
43718
  */
44817
43719
 
44818
- function ownKeys$3(object, enumerableOnly) {
43720
+ function ownKeys$2(object, enumerableOnly) {
44819
43721
  var keys = Object.keys(object);
44820
43722
 
44821
43723
  if (Object.getOwnPropertySymbols) {
@@ -44831,9 +43733,9 @@ function ownKeys$3(object, enumerableOnly) {
44831
43733
  function _objectSpread2$1(target) {
44832
43734
  for (var i = 1; i < arguments.length; i++) {
44833
43735
  var source = null != arguments[i] ? arguments[i] : {};
44834
- i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
43736
+ i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
44835
43737
  _defineProperty$1(target, key, source[key]);
44836
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
43738
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
44837
43739
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
44838
43740
  });
44839
43741
  }
@@ -48221,22 +47123,57 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
48221
47123
  var LoadingDetails = function LoadingDetails() {
48222
47124
  return /*#__PURE__*/React__default.createElement(Box, {
48223
47125
  padding: "0",
48224
- background: GRECIAN_GREY,
48225
- borderRadius: "4px",
48226
47126
  minHeight: "196px"
48227
- }, /*#__PURE__*/React__default.createElement(Cover, {
48228
- minHeight: "196px",
48229
- singleChild: true,
48230
- fillCenter: true
48231
- }, /*#__PURE__*/React__default.createElement(Center, {
48232
- intrinsic: true
48233
47127
  }, /*#__PURE__*/React__default.createElement(Box, {
48234
47128
  padding: "0",
48235
- extraStyles: "flex-grow: 1; display: flex; justify-content: center; align-items: center;"
47129
+ extraStyles: "position: absolute;\n height: 200px;\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;"
48236
47130
  }, /*#__PURE__*/React__default.createElement(Spinner$2, {
48237
47131
  size: "100",
48238
47132
  centerSpinner: true
48239
- })))));
47133
+ })), /*#__PURE__*/React__default.createElement(Stack, {
47134
+ childGap: "16px"
47135
+ }, /*#__PURE__*/React__default.createElement(Cluster, {
47136
+ nowrap: true,
47137
+ justify: "space-between",
47138
+ align: "start"
47139
+ }, /*#__PURE__*/React__default.createElement(LoadingLine, {
47140
+ exactWidth: "110",
47141
+ height: "27px"
47142
+ }), /*#__PURE__*/React__default.createElement(LoadingLine, {
47143
+ exactWidth: "60",
47144
+ height: "27px"
47145
+ })), /*#__PURE__*/React__default.createElement(SolidDivider$1, null), /*#__PURE__*/React__default.createElement(Box, {
47146
+ padding: "0.5rem 0"
47147
+ }, /*#__PURE__*/React__default.createElement(Cluster, {
47148
+ justify: "space-between",
47149
+ align: "start"
47150
+ }, /*#__PURE__*/React__default.createElement(LoadingLine, {
47151
+ exactWidth: "80",
47152
+ height: "27px"
47153
+ }), /*#__PURE__*/React__default.createElement(LoadingLine, {
47154
+ exactWidth: "60",
47155
+ height: "27px"
47156
+ })), /*#__PURE__*/React__default.createElement(Box, {
47157
+ padding: "4px 0"
47158
+ }), /*#__PURE__*/React__default.createElement(Cluster, {
47159
+ justify: "space-between",
47160
+ align: "start"
47161
+ }, /*#__PURE__*/React__default.createElement(LoadingLine, {
47162
+ exactWidth: "100",
47163
+ height: "27px"
47164
+ }), /*#__PURE__*/React__default.createElement(LoadingLine, {
47165
+ exactWidth: "50",
47166
+ height: "27px"
47167
+ }))), /*#__PURE__*/React__default.createElement(SolidDivider$1, null), /*#__PURE__*/React__default.createElement(Stack, {
47168
+ justify: "space-between",
47169
+ direction: "row"
47170
+ }, /*#__PURE__*/React__default.createElement(LoadingLine, {
47171
+ exactWidth: "55",
47172
+ height: "30px"
47173
+ }), /*#__PURE__*/React__default.createElement(LoadingLine, {
47174
+ exactWidth: "70",
47175
+ height: "30px"
47176
+ }))));
48240
47177
  };
48241
47178
 
48242
47179
  var ErrorDetails = function ErrorDetails() {