var e,r;e=this,r=function(e){"use strict";var r,t,n,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,r){for(var t=0;t=0;o--)if(void 0===r[n[o]]&&!h(r,n[o]))return!0;return n.length!==Object.keys(r).length}function E(e){var r=e.draft;if(r.length!==e.base.length)return!0;var t=Object.getOwnPropertyDescriptor(r,r.length-1);return!(!t||t.get)}var x=Object.freeze({scopes:g,currentScope:m,willFinalize:function(e,r,t){var n=m();n.forEach(function(e){return e.finalizing=!0}),void 0!==e&&e!==r||(t&&function e(r){if(r&&"object"===(void 0===r?"undefined":o(r))){var t=r[u];if(t){var n=t.base,i=t.draft,a=t.assigned;if(Array.isArray(r)){if(E(t)){if(P(t),a.length=!0,i.length=0;r--){var t=e[r];!1===t.modified&&(Array.isArray(t.base)?E(t)&&P(t):k(t)&&P(t))}}(n))},createDraft:w}),S=[],D=function(){return S[S.length-1]};function F(e,r){var t={scope:r?r.scope:D(),modified:!1,finalized:!1,assigned:{},parent:r,base:e,draft:null,drafts:{},copy:null,revoke:null},n=Array.isArray(e)?Proxy.revocable([t],I):Proxy.revocable(t,_),o=n.revoke,i=n.proxy;return t.draft=i,t.revoke=o,t.scope.push(t),i}var _={get:function(e,r){if(r===u)return e;var t=e.drafts;if(!e.modified&&h(t,r))return t[r];var n=N(e)[r];if(e.finalized||!c(n))return n;if(e.modified){if(n!==e.base[r])return n;t=e.copy}return t[r]=F(n,e)},has:function(e,r){return r in N(e)},ownKeys:function(e){return Reflect.ownKeys(N(e))},set:function(e,r,t){if(!e.modified){var n=t?y(e.base[r],t)||t===e.drafts[r]:y(e.base[r],t)&&r in e.base;if(n)return!0;C(e)}return e.assigned[r]=!0,e.copy[r]=t,!0},deleteProperty:function(e,r){(void 0!==e.base[r]||r in e.base)&&(e.assigned[r]=!1,C(e));e.copy&&delete e.copy[r];return!0},getOwnPropertyDescriptor:function(e,r){var t=e.modified?e.copy:h(e.drafts,r)?e.drafts:e.base,n=Reflect.getOwnPropertyDescriptor(t,r);!n||Array.isArray(t)&&"length"===r||(n.configurable=!0);return n},defineProperty:function(){throw new Error("Immer does not support defining properties on draft objects.")},setPrototypeOf:function(){throw new Error("Immer does not support `setPrototypeOf()`.")}},I={};function N(e){return e.copy||e.base}function C(e){e.modified||(e.modified=!0,e.copy=l(p(e.base),e.drafts),e.drafts=null,e.parent&&C(e.parent))}d(_,function(e,r){I[e]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),I.deleteProperty=function(e,r){if(isNaN(parseInt(r)))throw new Error("Immer does not support deleting properties from arrays: "+r);return _.deleteProperty.call(this,e[0],r)},I.set=function(e,r,t){if("length"!==r&&isNaN(parseInt(r)))throw new Error("Immer does not support setting non-numeric properties on arrays: "+r);return _.set.call(this,e[0],r,t)};var U=Object.freeze({scopes:S,currentScope:D,willFinalize:function(){},createDraft:F});var T={useProxies:"undefined"!=typeof Proxy&&"undefined"!=typeof Reflect,autoFreeze:"undefined"!=typeof process?"production"!==process.env.NODE_ENV:"verifyMinified"===function(){}.name,onAssign:null,onDelete:null,onCopy:null},M=function(){function e(r){i(this,e),l(this,T,r),this.setUseProxies(this.useProxies),this.produce=this.produce.bind(this)}return a(e,[{key:"produce",value:function(e,r,t){var n=this;if("function"==typeof e&&"function"!=typeof r){var o=r;return r=e,function(){for(var e=arguments.length,t=Array(e>1?e-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:o;return n.produce(a,function(e){var n;return(n=r).call.apply(n,[e,e].concat(t))})}}if("function"!=typeof r)throw new Error("if first argument is not a function, the second argument to produce should be a function");if(void 0!==t&&"function"!=typeof t)throw new Error("the third argument of a producer should not be set or a function");var i=void 0;if(c(e))if(s(e)){if(void 0===(i=r.call(e,e)))return e}else{this.scopes.push([]);var a=this.createDraft(e);try{i=r.call(a,a),this.willFinalize(i,a,!!t);var l=t&&[],p=t&&[];if(void 0===i||i===a)i=this.finalize(a,[],l,p);else{if(a[u].modified)throw new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.");c(i)&&(i=this.finalize(i)),t&&(l.push({op:"replace",path:[],value:i}),p.push({op:"replace",path:[],value:e}))}}finally{this.currentScope().forEach(function(e){return e.revoke()}),this.scopes.pop()}t&&t(l,p)}else if(void 0===(i=r(e)))return e;return i===f?void 0:i}},{key:"setAutoFreeze",value:function(e){this.autoFreeze=e}},{key:"setUseProxies",value:function(e){this.useProxies=e,l(this,e?U:x)}},{key:"finalize",value:function(e,r,t,n){var o=e[u];if(!o)return Object.isFrozen(e)?e:this.finalizeTree(e);if(o.scope!==this.currentScope())return e;if(!o.modified)return o.base;if(!o.finalized){if(o.finalized=!0,this.finalizeTree(o.draft,r,t,n),this.onDelete){var i=o.assigned;for(var a in i)i[a]||this.onDelete(o,a)}this.onCopy&&this.onCopy(o),this.autoFreeze&&1===this.scopes.length&&Object.freeze(o.copy),t&&v(o,r,t,n)}return o.copy}},{key:"finalizeTree",value:function(e,r,t,n){var o=this,i=e[u];i&&(e=this.useProxies?i.copy:i.copy=p(i.draft));var a=this.onAssign;return d(e,function f(u,l,p){var h=!!i&&p===e;if(s(l)){if(p[u]=l=t&&h&&!i.assigned[u]?o.finalize(l,r.concat(u),t,n):o.finalize(l),h&&l===i.base[u])return}else{if(h&&y(l,i.base[u]))return;c(l)&&!Object.isFrozen(l)&&d(l,f)}h&&a&&a(i,u,l)}),e}}]),e}(),R=new M,K=R.produce,J=K(function(e,r){for(var t=0;t