UNPKG

ngrx-etc

Version:
3 lines (2 loc) 32.6 kB
import{createAction as t,on as r,createReducer as e}from"@ngrx/store";import{isDevMode as n}from"@angular/core";function o(){return(o=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(this,arguments)}function i(...r){return u(t(...r))}function u(t){const r=function(...r){return o({},t(...r),{__correlationId:Date.now().toString()})};return function(t,r){Object.defineProperty(r,"type",{value:t,writable:!1})}(t.type,r),r}var c=function(t,r){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function s(t,r){function e(){this.constructor=t}c(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}function a(t){return"function"==typeof t}var f=!1,p={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){f=t},get useDeprecatedSynchronousErrorHandling(){return f}};function l(t){setTimeout(function(){throw t},0)}var h={closed:!0,next:function(t){},error:function(t){if(p.useDeprecatedSynchronousErrorHandling)throw t;l(t)},complete:function(){}},d=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}();function y(t){return null!==t&&"object"==typeof t}var b=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(t,r){return r+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),v=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var r;if(!this.closed){var e=this._parentOrParents,n=this._ctorUnsubscribe,o=this._unsubscribe,i=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,e instanceof t)e.remove(this);else if(null!==e)for(var u=0;u<e.length;++u)e[u].remove(this);if(a(o)){n&&(this._unsubscribe=void 0);try{o.call(this)}catch(t){r=t instanceof b?m(t.errors):[t]}}if(d(i)){u=-1;for(var c=i.length;++u<c;){var s=i[u];if(y(s))try{s.unsubscribe()}catch(t){r=r||[],t instanceof b?r=r.concat(m(t.errors)):r.push(t)}}}if(r)throw new b(r)}},t.prototype.add=function(r){var e=r;if(!r)return t.EMPTY;switch(typeof r){case"function":e=new t(r);case"object":if(e===this||e.closed||"function"!=typeof e.unsubscribe)return e;if(this.closed)return e.unsubscribe(),e;if(!(e instanceof t)){var n=e;(e=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+r+" added to Subscription.")}var o=e._parentOrParents;if(null===o)e._parentOrParents=this;else if(o instanceof t){if(o===this)return e;e._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return e;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[e]:i.push(e),e},t.prototype.remove=function(t){var r=this._subscriptions;if(r){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function m(t){return t.reduce(function(t,r){return t.concat(r instanceof b?r.errors:r)},[])}var g=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),_=function(t){function r(e,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=h;break;case 1:if(!e){i.destination=h;break}if("object"==typeof e){e instanceof r?(i.syncErrorThrowable=e.syncErrorThrowable,i.destination=e,e.add(i)):(i.syncErrorThrowable=!0,i.destination=new w(i,e));break}default:i.syncErrorThrowable=!0,i.destination=new w(i,e,n,o)}return i}return s(r,t),r.prototype[g]=function(){return this},r.create=function(t,e,n){var o=new r(t,e,n);return o.syncErrorThrowable=!1,o},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},r.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},r.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},r}(v),w=function(t){function r(r,e,n,o){var i,u=t.call(this)||this;u._parentSubscriber=r;var c=u;return a(e)?i=e:e&&(i=e.next,n=e.error,o=e.complete,e!==h&&(a((c=Object.create(e)).unsubscribe)&&u.add(c.unsubscribe.bind(c)),c.unsubscribe=u.unsubscribe.bind(u))),u._context=c,u._next=i,u._error=n,u._complete=o,u}return s(r,t),r.prototype.next=function(t){if(!this.isStopped&&this._next){var r=this._parentSubscriber;p.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable?this.__tryOrSetError(r,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},r.prototype.error=function(t){if(!this.isStopped){var r=this._parentSubscriber,e=p.useDeprecatedSynchronousErrorHandling;if(this._error)e&&r.syncErrorThrowable?(this.__tryOrSetError(r,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(r.syncErrorThrowable)e?(r.syncErrorValue=t,r.syncErrorThrown=!0):l(t),this.unsubscribe();else{if(this.unsubscribe(),e)throw t;l(t)}}},r.prototype.complete=function(){var t=this;if(!this.isStopped){var r=this._parentSubscriber;if(this._complete){var e=function(){return t._complete.call(t._context)};p.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable?(this.__tryOrSetError(r,e),this.unsubscribe()):(this.__tryOrUnsub(e),this.unsubscribe())}else this.unsubscribe()}},r.prototype.__tryOrUnsub=function(t,r){try{t.call(this._context,r)}catch(t){if(this.unsubscribe(),p.useDeprecatedSynchronousErrorHandling)throw t;l(t)}},r.prototype.__tryOrSetError=function(t,r,e){if(!p.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{r.call(this._context,e)}catch(r){return p.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=r,t.syncErrorThrown=!0,!0):(l(r),!0)}return!1},r.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},r}(_),O=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function P(t){return t}function E(t){return 0===t.length?P:1===t.length?t[0]:function(r){return t.reduce(function(t,r){return r(t)},r)}}var S=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(r){var e=new t;return e.source=this,e.operator=r,e},t.prototype.subscribe=function(t,r,e){var n=this.operator,o=function(t,r,e){if(t){if(t instanceof _)return t;if(t[g])return t[g]()}return t||r||e?new _(t,r,e):new _(h)}(t,r,e);if(o.add(n?n.call(o,this.source):this.source||p.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),p.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){p.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=r),function(t){for(;t;){var r=t.destination;if(t.closed||t.isStopped)return!1;t=r&&r instanceof _?r:null}return!0}(t)?t.error(r):console.warn(r)}},t.prototype.forEach=function(t,r){var e=this;return new(r=j(r))(function(r,n){var o;o=e.subscribe(function(r){try{t(r)}catch(t){n(t),o&&o.unsubscribe()}},n,r)})},t.prototype._subscribe=function(t){var r=this.source;return r&&r.subscribe(t)},t.prototype[O]=function(){return this},t.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 0===t.length?this:E(t)(this)},t.prototype.toPromise=function(t){var r=this;return new(t=j(t))(function(t,e){var n;r.subscribe(function(t){return n=t},function(t){return e(t)},function(){return t(n)})})},t.create=function(r){return new t(r)},t}();function j(t){if(t||(t=Promise),!t)throw new Error("no Promise impl found");return t}function x(t){return t&&"function"==typeof t.schedule}var A=function(t){return function(r){for(var e=0,n=t.length;e<n&&!r.closed;e++)r.next(t[e]);r.complete()}};function D(t,r){return new S(function(e){var n=new v,o=0;return n.add(r.schedule(function(){o!==t.length?(e.next(t[o++]),e.closed||n.add(this.schedule())):e.complete()})),n})}function I(t,r){return r?D(t,r):new S(A(t))}function N(t,r){return function(e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return e.lift(new T(t,r))}}var T=function(){function t(t,r){this.project=t,this.thisArg=r}return t.prototype.call=function(t,r){return r.subscribe(new k(t,this.project,this.thisArg))},t}(),k=function(t){function r(r,e,n){var o=t.call(this,r)||this;return o.project=e,o.count=0,o.thisArg=n||o,o}return s(r,t),r.prototype._next=function(t){var r;try{r=this.project.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}this.destination.next(r)},r}(_);function M(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var F=M(),z=function(t){if(t&&"function"==typeof t[O])return n=t,function(t){var r=n[O]();if("function"!=typeof r.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return r.subscribe(t)};if(function(t){return t&&"number"==typeof t.length&&"function"!=typeof t}(t))return A(t);if(function(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}(t))return e=t,function(t){return e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,l),t};if(t&&"function"==typeof t[F])return r=t,function(t){for(var e=r[F]();;){var n=void 0;try{n=e.next()}catch(r){return t.error(r),t}if(n.done){t.complete();break}if(t.next(n.value),t.closed)break}return"function"==typeof e.return&&t.add(function(){e.return&&e.return()}),t};var r,e,n,o=y(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+o+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")},C=function(t){function r(r){var e=t.call(this)||this;return e.parent=r,e}return s(r,t),r.prototype._next=function(t){this.parent.notifyNext(t)},r.prototype._error=function(t){this.parent.notifyError(t),this.unsubscribe()},r.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},r}(_),V=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return s(r,t),r.prototype.notifyNext=function(t){this.destination.next(t)},r.prototype.notifyError=function(t){this.destination.error(t)},r.prototype.notifyComplete=function(){this.destination.complete()},r}(_),H=function(){function t(t,r){void 0===r&&(r=Number.POSITIVE_INFINITY),this.project=t,this.concurrent=r}return t.prototype.call=function(t,r){return r.subscribe(new R(t,this.project,this.concurrent))},t}(),R=function(t){function r(r,e,n){void 0===n&&(n=Number.POSITIVE_INFINITY);var o=t.call(this,r)||this;return o.project=e,o.concurrent=n,o.hasCompleted=!1,o.buffer=[],o.active=0,o.index=0,o}return s(r,t),r.prototype._next=function(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)},r.prototype._tryNext=function(t){var r,e=this.index++;try{r=this.project(t,e)}catch(t){return void this.destination.error(t)}this.active++,this._innerSub(r)},r.prototype._innerSub=function(t){var r=new C(this),e=this.destination;e.add(r);var n=function(t,r){if(!r.closed){if(t instanceof S)return t.subscribe(r);var e;try{e=z(t)(r)}catch(t){r.error(t)}return e}}(t,r);n!==r&&e.add(n)},r.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},r.prototype.notifyNext=function(t){this.destination.next(t)},r.prototype.notifyComplete=function(){var t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},r}(V),U=function(){function t(t,r){this.predicate=t,this.thisArg=r}return t.prototype.call=function(t,r){return r.subscribe(new K(t,this.predicate,this.thisArg))},t}(),K=function(t){function r(r,e,n){var o=t.call(this,r)||this;return o.predicate=e,o.thisArg=n,o.count=0,o}return s(r,t),r.prototype._next=function(t){var r;try{r=this.predicate.call(this.thisArg,t,this.count++)}catch(t){return void this.destination.error(t)}r&&this.destination.next(t)},r}(_);function Y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function J(t,r,e){return t(e={path:r,exports:{},require:function(t,r){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},e.exports),e.exports}var W=J(function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.identity=function(t){return t}}),$=Y(J(function(t,r){function e(t){return 0===t.length?W.identity:1===t.length?t[0]:function(r){return t.reduce(function(t,r){return r(t)},r)}}Object.defineProperty(r,"__esModule",{value:!0}),r.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e(t)},r.pipeFromArray=e}));function q(...t){if(0===t.length)throw new TypeError("Expected operators, received nothing");return function(r){return r.pipe(function t(r,e,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof e?function(o){return o.pipe(t(function(t,n){return(o=r(t,n),o instanceof S?o:new S(z(o))).pipe(N(function(r,o){return e(t,r,n,o)}));var o},n))}:("number"==typeof e&&(n=e),function(t){return t.lift(new H(r,n))})}(r=>function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var e=t[t.length-1];return x(e)?(t.pop(),D(t,e)):I(t)}(r).pipe($.pipeFromArray(t),N(t=>{if(!(e=r)||!("__correlationId"in e))return t;var e;const i=o({},t,{__correlationId:r.__correlationId});return function(t,r){if(n()){const e=window._actionCorrelations||{};e[t.__correlationId]=(e[t.__correlationId]||[t]).concat(r),window._actionCorrelations=e}}(r,i),i}))))}}function G(t){return r=r=>r.__correlationId===t.__correlationId,function(t){return t.lift(new U(r,void 0))};var r}function X(t){for(var r=arguments.length,e=Array(r>1?r-1:0),n=1;n<r;n++)e[n-1]=arguments[n];if("production"!==process.env.NODE_ENV){var o=Jt[t],i=o?"function"==typeof o?o.apply(null,e):o:"unknown error nr: "+t;throw Error("[Immer] "+i)}throw Error("[Immer] minified error nr: "+t+(e.length?" "+e.map(function(t){return"'"+t+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function B(t){return!!t&&!!t[Kt]}function L(t){return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var r=Object.getPrototypeOf(t);if(null===r)return!0;var e=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return e===Object||"function"==typeof e&&Function.toString.call(e)===Wt}(t)||Array.isArray(t)||!!t[Ut]||!!t.constructor[Ut]||ot(t)||it(t))}function Q(t,r,e){void 0===e&&(e=!1),0===Z(t)?(e?Object.keys:$t)(t).forEach(function(n){e&&"symbol"==typeof n||r(n,t[n],t)}):t.forEach(function(e,n){return r(n,e,t)})}function Z(t){var r=t[Kt];return r?r.i>3?r.i-4:r.i:Array.isArray(t)?1:ot(t)?2:it(t)?3:0}function tt(t,r){return 2===Z(t)?t.has(r):Object.prototype.hasOwnProperty.call(t,r)}function rt(t,r){return 2===Z(t)?t.get(r):t[r]}function et(t,r,e){var n=Z(t);2===n?t.set(r,e):3===n?(t.delete(r),t.add(e)):t[r]=e}function nt(t,r){return t===r?0!==t||1/t==1/r:t!=t&&r!=r}function ot(t){return Ct&&t instanceof Map}function it(t){return Vt&&t instanceof Set}function ut(t){return t.o||t.t}function ct(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var r=qt(t);delete r[Kt];for(var e=$t(r),n=0;n<e.length;n++){var o=e[n],i=r[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(r[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:t[o]})}return Object.create(Object.getPrototypeOf(t),r)}function st(t,r){return void 0===r&&(r=!1),ft(t)||B(t)||!L(t)||(Z(t)>1&&(t.set=t.add=t.clear=t.delete=at),Object.freeze(t),r&&Q(t,function(t,r){return st(r,!0)},!0)),t}function at(){X(2)}function ft(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function pt(t){var r=Gt[t];return r||X(18,t),r}function lt(t,r){Gt[t]||(Gt[t]=r)}function ht(){return"production"===process.env.NODE_ENV||Ft||X(0),Ft}function dt(t,r){r&&(pt("Patches"),t.u=[],t.s=[],t.v=r)}function yt(t){bt(t),t.p.forEach(mt),t.p=null}function bt(t){t===Ft&&(Ft=t.l)}function vt(t){return Ft={p:[],l:Ft,h:t,m:!0,_:0}}function mt(t){var r=t[Kt];0===r.i||1===r.i?r.j():r.O=!0}function gt(t,r){r._=r.p.length;var e=r.p[0],n=void 0!==t&&t!==e;return r.h.g||pt("ES5").S(r,t,n),n?(e[Kt].P&&(yt(r),X(4)),L(t)&&(t=_t(r,t),r.l||Ot(r,t)),r.u&&pt("Patches").M(e[Kt],t,r.u,r.s)):t=_t(r,e,[]),yt(r),r.u&&r.v(r.u,r.s),t!==Rt?t:void 0}function _t(t,r,e){if(ft(r))return r;var n=r[Kt];if(!n)return Q(r,function(o,i){return wt(t,n,r,o,i,e)},!0),r;if(n.A!==t)return r;if(!n.P)return Ot(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var o=4===n.i||5===n.i?n.o=ct(n.k):n.o;Q(3===n.i?new Set(o):o,function(r,i){return wt(t,n,o,r,i,e)}),Ot(t,o,!1),e&&t.u&&pt("Patches").R(n,e,t.u,t.s)}return n.o}function wt(t,r,e,n,o,i){if("production"!==process.env.NODE_ENV&&o===e&&X(5),B(o)){var u=_t(t,o,i&&r&&3!==r.i&&!tt(r.D,n)?i.concat(n):void 0);if(et(e,n,u),!B(u))return;t.m=!1}if(L(o)&&!ft(o)){if(!t.h.F&&t._<1)return;_t(t,o),r&&r.A.l||Ot(t,o)}}function Ot(t,r,e){void 0===e&&(e=!1),t.h.F&&t.m&&st(r,e)}function Pt(t,r){var e=t[Kt];return(e?ut(e):t)[r]}function Et(t,r){if(r in t)for(var e=Object.getPrototypeOf(t);e;){var n=Object.getOwnPropertyDescriptor(e,r);if(n)return n;e=Object.getPrototypeOf(e)}}function St(t){t.P||(t.P=!0,t.l&&St(t.l))}function jt(t){t.o||(t.o=ct(t.t))}function xt(t,r,e){var n=ot(r)?pt("MapSet").N(r,e):it(r)?pt("MapSet").T(r,e):t.g?function(t,r){var e=Array.isArray(t),n={i:e?1:0,A:r?r.A:ht(),P:!1,I:!1,D:{},l:r,t,k:null,o:null,j:null,C:!1},o=n,i=Xt;e&&(o=[n],i=Bt);var u=Proxy.revocable(o,i),c=u.revoke,s=u.proxy;return n.k=s,n.j=c,s}(r,e):pt("ES5").J(r,e);return(e?e.A:ht()).p.push(n),n}function At(t){return B(t)||X(22,t),function t(r){if(!L(r))return r;var e,n=r[Kt],o=Z(r);if(n){if(!n.P&&(n.i<4||!pt("ES5").K(n)))return n.t;n.I=!0,e=Dt(r,o),n.I=!1}else e=Dt(r,o);return Q(e,function(r,o){n&&rt(n.t,r)===o||et(e,r,t(o))}),3===o?new Set(e):e}(t)}function Dt(t,r){switch(r){case 2:return new Map(t);case 3:return Array.from(t)}return ct(t)}function It(){function t(t,r){var e=i[t];return e?e.enumerable=r:i[t]=e={configurable:!0,enumerable:r,get:function(){var r=this[Kt];return"production"!==process.env.NODE_ENV&&o(r),Xt.get(r,t)},set:function(r){var e=this[Kt];"production"!==process.env.NODE_ENV&&o(e),Xt.set(e,t,r)}},e}function r(t){for(var r=t.length-1;r>=0;r--){var o=t[r][Kt];if(!o.P)switch(o.i){case 5:n(o)&&St(o);break;case 4:e(o)&&St(o)}}}function e(t){for(var r=t.t,e=t.k,n=$t(e),o=n.length-1;o>=0;o--){var i=n[o];if(i!==Kt){var u=r[i];if(void 0===u&&!tt(r,i))return!0;var c=e[i],s=c&&c[Kt];if(s?s.t!==u:!nt(c,u))return!0}}var a=!!r[Kt];return n.length!==$t(r).length+(a?0:1)}function n(t){var r=t.k;if(r.length!==t.t.length)return!0;var e=Object.getOwnPropertyDescriptor(r,r.length-1);return!(!e||e.get)}function o(t){t.O&&X(3,JSON.stringify(ut(t)))}var i={};lt("ES5",{J:function(r,e){var n=Array.isArray(r),o=function(r,e){if(r){for(var n=Array(e.length),o=0;o<e.length;o++)Object.defineProperty(n,""+o,t(o,!0));return n}var i=qt(e);delete i[Kt];for(var u=$t(i),c=0;c<u.length;c++){var s=u[c];i[s]=t(s,r||!!i[s].enumerable)}return Object.create(Object.getPrototypeOf(e),i)}(n,r),i={i:n?5:4,A:e?e.A:ht(),P:!1,I:!1,D:{},l:e,t:r,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,Kt,{value:i,writable:!0}),o},S:function(t,e,o){o?B(e)&&e[Kt].A===t&&r(t.p):(t.u&&function t(r){if(r&&"object"==typeof r){var e=r[Kt];if(e){var o=e.t,i=e.k,u=e.D,c=e.i;if(4===c)Q(i,function(r){r!==Kt&&(void 0!==o[r]||tt(o,r)?u[r]||t(i[r]):(u[r]=!0,St(e)))}),Q(o,function(t){void 0!==i[t]||tt(i,t)||(u[t]=!1,St(e))});else if(5===c){if(n(e)&&(St(e),u.length=!0),i.length<o.length)for(var s=i.length;s<o.length;s++)u[s]=!1;else for(var a=o.length;a<i.length;a++)u[a]=!0;for(var f=Math.min(i.length,o.length),p=0;p<f;p++)void 0===u[p]&&t(i[p])}}}}(t.p[0]),r(t.p))},K:function(t){return 4===t.i?e(t):n(t)}})}function Nt(){function t(r){if(!L(r))return r;if(Array.isArray(r))return r.map(t);if(ot(r))return new Map(Array.from(r.entries()).map(function(r){return[r[0],t(r[1])]}));if(it(r))return new Set(Array.from(r).map(t));var e=Object.create(Object.getPrototypeOf(r));for(var n in r)e[n]=t(r[n]);return tt(r,Ut)&&(e[Ut]=r[Ut]),e}function r(r){return B(r)?t(r):r}var e="add";lt("Patches",{$:function(r,n){return n.forEach(function(n){for(var o=n.path,i=n.op,u=r,c=0;c<o.length-1;c++){var s=Z(u),a=""+o[c];0!==s&&1!==s||"__proto__"!==a&&"constructor"!==a||X(24),"function"==typeof u&&"prototype"===a&&X(24),"object"!=typeof(u=rt(u,a))&&X(15,o.join("/"))}var f=Z(u),p=t(n.value),l=o[o.length-1];switch(i){case"replace":switch(f){case 2:return u.set(l,p);case 3:X(16);default:return u[l]=p}case e:switch(f){case 1:return u.splice(l,0,p);case 2:return u.set(l,p);case 3:return u.add(p);default:return u[l]=p}case"remove":switch(f){case 1:return u.splice(l,1);case 2:return u.delete(l);case 3:return u.delete(n.value);default:return delete u[l]}default:X(17,i)}}),r},R:function(t,n,o,i){switch(t.i){case 0:case 4:case 2:return function(t,n,o,i){var u=t.t,c=t.o;Q(t.D,function(t,s){var a=rt(u,t),f=rt(c,t),p=s?tt(u,t)?"replace":e:"remove";if(a!==f||"replace"!==p){var l=n.concat(t);o.push("remove"===p?{op:p,path:l}:{op:p,path:l,value:f}),i.push(p===e?{op:"remove",path:l}:"remove"===p?{op:e,path:l,value:r(a)}:{op:"replace",path:l,value:r(a)})}})}(t,n,o,i);case 5:case 1:return function(t,n,o,i){var u=t.t,c=t.D,s=t.o;if(s.length<u.length){var a=[s,u];u=a[0],s=a[1];var f=[i,o];o=f[0],i=f[1]}for(var p=0;p<u.length;p++)if(c[p]&&s[p]!==u[p]){var l=n.concat([p]);o.push({op:"replace",path:l,value:r(s[p])}),i.push({op:"replace",path:l,value:r(u[p])})}for(var h=u.length;h<s.length;h++){var d=n.concat([h]);o.push({op:e,path:d,value:r(s[h])})}u.length<s.length&&i.push({op:"replace",path:n.concat(["length"]),value:u.length})}(t,n,o,i);case 3:return function(t,r,n,o){var i=t.t,u=t.o,c=0;i.forEach(function(t){if(!u.has(t)){var i=r.concat([c]);n.push({op:"remove",path:i,value:t}),o.unshift({op:e,path:i,value:t})}c++}),c=0,u.forEach(function(t){if(!i.has(t)){var u=r.concat([c]);n.push({op:e,path:u,value:t}),o.unshift({op:"remove",path:u,value:t})}c++})}(t,n,o,i)}},M:function(t,r,e,n){e.push({op:"replace",path:[],value:r===Rt?void 0:r}),n.push({op:"replace",path:[],value:t.t})}})}function Tt(){function t(t,r){function e(){this.constructor=t}o(t,r),t.prototype=(e.prototype=r.prototype,new e)}function r(t){t.o||(t.D=new Map,t.o=new Map(t.t))}function e(t){t.o||(t.o=new Set,t.t.forEach(function(r){if(L(r)){var e=xt(t.A.h,r,t);t.p.set(r,e),t.o.add(e)}else t.o.add(r)}))}function n(t){t.O&&X(3,JSON.stringify(ut(t)))}var o=function(t,r){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)},i=function(){function e(t,r){return this[Kt]={i:2,l:r,A:r?r.A:ht(),P:!1,I:!1,o:void 0,D:void 0,t,k:this,C:!1,O:!1},this}t(e,Map);var o=e.prototype;return Object.defineProperty(o,"size",{get:function(){return ut(this[Kt]).size}}),o.has=function(t){return ut(this[Kt]).has(t)},o.set=function(t,e){var o=this[Kt];return n(o),ut(o).has(t)&&ut(o).get(t)===e||(r(o),St(o),o.D.set(t,!0),o.o.set(t,e),o.D.set(t,!0)),this},o.delete=function(t){if(!this.has(t))return!1;var e=this[Kt];return n(e),r(e),St(e),e.D.set(t,!1),e.o.delete(t),!0},o.clear=function(){var t=this[Kt];n(t),ut(t).size&&(r(t),St(t),t.D=new Map,Q(t.t,function(r){t.D.set(r,!1)}),t.o.clear())},o.forEach=function(t,r){var e=this;ut(this[Kt]).forEach(function(n,o){t.call(r,e.get(o),o,e)})},o.get=function(t){var e=this[Kt];n(e);var o=ut(e).get(t);if(e.I||!L(o))return o;if(o!==e.t.get(t))return o;var i=xt(e.A.h,o,e);return r(e),e.o.set(t,i),i},o.keys=function(){return ut(this[Kt]).keys()},o.values=function(){var t,r=this,e=this.keys();return(t={})[Yt]=function(){return r.values()},t.next=function(){var t=e.next();return t.done?t:{done:!1,value:r.get(t.value)}},t},o.entries=function(){var t,r=this,e=this.keys();return(t={})[Yt]=function(){return r.entries()},t.next=function(){var t=e.next();if(t.done)return t;var n=r.get(t.value);return{done:!1,value:[t.value,n]}},t},o[Yt]=function(){return this.entries()},e}(),u=function(){function r(t,r){return this[Kt]={i:3,l:r,A:r?r.A:ht(),P:!1,I:!1,o:void 0,t,k:this,p:new Map,O:!1,C:!1},this}t(r,Set);var o=r.prototype;return Object.defineProperty(o,"size",{get:function(){return ut(this[Kt]).size}}),o.has=function(t){var r=this[Kt];return n(r),r.o?!!r.o.has(t)||!(!r.p.has(t)||!r.o.has(r.p.get(t))):r.t.has(t)},o.add=function(t){var r=this[Kt];return n(r),this.has(t)||(e(r),St(r),r.o.add(t)),this},o.delete=function(t){if(!this.has(t))return!1;var r=this[Kt];return n(r),e(r),St(r),r.o.delete(t)||!!r.p.has(t)&&r.o.delete(r.p.get(t))},o.clear=function(){var t=this[Kt];n(t),ut(t).size&&(e(t),St(t),t.o.clear())},o.values=function(){var t=this[Kt];return n(t),e(t),t.o.values()},o.entries=function(){var t=this[Kt];return n(t),e(t),t.o.entries()},o.keys=function(){return this.values()},o[Yt]=function(){return this.values()},o.forEach=function(t,r){for(var e=this.values(),n=e.next();!n.done;)t.call(r,n.value,n.value,this),n=e.next()},r}();lt("MapSet",{N:function(t,r){return new i(t,r)},T:function(t,r){return new u(t,r)}})}function kt(){It(),Tt(),Nt()}var Mt,Ft,zt="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Ct="undefined"!=typeof Map,Vt="undefined"!=typeof Set,Ht="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Rt=zt?Symbol.for("immer-nothing"):((Mt={})["immer-nothing"]=!0,Mt),Ut=zt?Symbol.for("immer-draftable"):"__$immer_draftable",Kt=zt?Symbol.for("immer-state"):"__$immer_state",Yt="undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator",Jt={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},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(t){return"Cannot apply patch, path doesn't resolve: "+t},16:'Sets cannot have "replace" patches.',17:function(t){return"Unsupported patch operation: "+t},18:function(t){return"The plugin for '"+t+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+t+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(t){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 '"+t+"'"},22:function(t){return"'current' expects a draft, got: "+t},23:function(t){return"'original' expects a draft, got: "+t},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Wt=""+Object.prototype.constructor,$t="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,qt=Object.getOwnPropertyDescriptors||function(t){var r={};return $t(t).forEach(function(e){r[e]=Object.getOwnPropertyDescriptor(t,e)}),r},Gt={},Xt={get:function(t,r){if(r===Kt)return t;var e=ut(t);if(!tt(e,r))return function(t,r,e){var n,o=Et(r,e);return o?"value"in o?o.value:null===(n=o.get)||void 0===n?void 0:n.call(t.k):void 0}(t,e,r);var n=e[r];return t.I||!L(n)?n:n===Pt(t.t,r)?(jt(t),t.o[r]=xt(t.A.h,n,t)):n},has:function(t,r){return r in ut(t)},ownKeys:function(t){return Reflect.ownKeys(ut(t))},set:function(t,r,e){var n=Et(ut(t),r);if(null==n?void 0:n.set)return n.set.call(t.k,e),!0;if(!t.P){var o=Pt(ut(t),r),i=null==o?void 0:o[Kt];if(i&&i.t===e)return t.o[r]=e,t.D[r]=!1,!0;if(nt(e,o)&&(void 0!==e||tt(t.t,r)))return!0;jt(t),St(t)}return t.o[r]===e&&"number"!=typeof e&&(void 0!==e||r in t.o)||(t.o[r]=e,t.D[r]=!0,!0)},deleteProperty:function(t,r){return void 0!==Pt(t.t,r)||r in t.t?(t.D[r]=!1,jt(t),St(t)):delete t.D[r],t.o&&delete t.o[r],!0},getOwnPropertyDescriptor:function(t,r){var e=ut(t),n=Reflect.getOwnPropertyDescriptor(e,r);return n?{writable:!0,configurable:1!==t.i||"length"!==r,enumerable:n.enumerable,value:e[r]}:n},defineProperty:function(){X(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){X(12)}},Bt={};Q(Xt,function(t,r){Bt[t]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}}),Bt.deleteProperty=function(t,r){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(r))&&X(13),Xt.deleteProperty.call(this,t[0],r)},Bt.set=function(t,r,e){return"production"!==process.env.NODE_ENV&&"length"!==r&&isNaN(parseInt(r))&&X(14),Xt.set.call(this,t[0],r,e,t[0])};var Lt=new(function(){function t(t){var r=this;this.g=Ht,this.F=!0,this.produce=function(t,e,n){if("function"==typeof t&&"function"!=typeof e){var o=e;e=t;var i=r;return function(t){var r=this;void 0===t&&(t=o);for(var n=arguments.length,u=Array(n>1?n-1:0),c=1;c<n;c++)u[c-1]=arguments[c];return i.produce(t,function(t){var n;return(n=e).call.apply(n,[r,t].concat(u))})}}var u;if("function"!=typeof e&&X(6),void 0!==n&&"function"!=typeof n&&X(7),L(t)){var c=vt(r),s=xt(r,t,void 0),a=!0;try{u=e(s),a=!1}finally{a?yt(c):bt(c)}return"undefined"!=typeof Promise&&u instanceof Promise?u.then(function(t){return dt(c,n),gt(t,c)},function(t){throw yt(c),t}):(dt(c,n),gt(u,c))}if(!t||"object"!=typeof t){if((u=e(t))===Rt)return;return void 0===u&&(u=t),r.F&&st(u,!0),u}X(21,t)},this.produceWithPatches=function(t,e){return"function"==typeof t?function(e){for(var n=arguments.length,o=Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return r.produceWithPatches(e,function(r){return t.apply(void 0,[r].concat(o))})}:[r.produce(t,e,function(t,r){n=t,o=r}),n,o];var n,o},"boolean"==typeof(null==t?void 0:t.useProxies)&&this.setUseProxies(t.useProxies),"boolean"==typeof(null==t?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze)}var r=t.prototype;return r.createDraft=function(t){L(t)||X(8),B(t)&&(t=At(t));var r=vt(this),e=xt(this,t,void 0);return e[Kt].C=!0,bt(r),e},r.finishDraft=function(t,r){var e=t&&t[Kt];"production"!==process.env.NODE_ENV&&(e&&e.C||X(9),e.I&&X(10));var n=e.A;return dt(n,r),gt(void 0,n)},r.setAutoFreeze=function(t){this.F=t},r.setUseProxies=function(t){t&&!Ht&&X(20),this.g=t},r.applyPatches=function(t,r){var e;for(e=r.length-1;e>=0;e--){var n=r[e];if(0===n.path.length&&"replace"===n.op){t=n.value;break}}var o=pt("Patches").$;return B(t)?o(t,r):this.produce(t,function(t){return o(t,r.slice(e+1))})},t}()),Qt=Lt.produce;function Zt(t){return(r,e)=>Qt(r,r=>t(r,e))}function tr(...t){const e=t.pop();return r(...t,Zt(e))}function rr(t,...r){const n=e(t,...r);return function(r=t,e){return Zt(n)(r,e)}}Lt.produceWithPatches.bind(Lt),Lt.setAutoFreeze.bind(Lt),Lt.setUseProxies.bind(Lt),Lt.applyPatches.bind(Lt),Lt.createDraft.bind(Lt),Lt.finishDraft.bind(Lt);export{q as correlate,u as correlateAction,i as createActionWithCorrelation,rr as createMutableReducer,kt as enableAllPlugins,It as enableES5,Tt as enableMapSet,Nt as enablePatches,tr as mutableOn,G as withSameCorrelationAs}; //# sourceMappingURL=ngrx-etc.modern.js.map