From 574c0457bc1b57f4bb28de9fc53caa2cb85ea917 Mon Sep 17 00:00:00 2001 From: jordangarcia Date: Thu, 5 Nov 2015 09:37:49 -0800 Subject: [PATCH] 1.2.1 Release --- CHANGELOG.md | 4 ++++ bower.json | 2 +- dist/nuclear.js | 8 +++++++- dist/nuclear.min.js | 2 +- package.json | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad0ecd8..120c1dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.2.1 (November 5, 2015) + +- **[FIXED]** Observers of the entire app state not triggering on actions from a late registered store + ## 1.2.0 (November 1, 2015) - **[NEW]** Exposed new API methods: `batchStart` and `batchStop`. diff --git a/bower.json b/bower.json index aae43c0..b0b4959 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "nuclear-js", - "version": "1.2.0", + "version": "1.2.1", "homepage": "https://github.com/optimizely/nuclear-js", "authors": [ "Jordan Garcia" diff --git a/dist/nuclear.js b/dist/nuclear.js index d8e1839..51721c2 100644 --- a/dist/nuclear.js +++ b/dist/nuclear.js @@ -6291,7 +6291,13 @@ return /******/ (function(modules) { // webpackBootstrap return false; } - return entry.get('storeStates').every(function (stateId, storeId) { + var storeStates = entry.get('storeStates'); + if (storeStates.size === 0) { + // if there are no store states for this entry then it was never cached before + return false; + } + + return storeStates.every(function (stateId, storeId) { return reactorState.getIn(['storeStates', storeId]) === stateId; }); } diff --git a/dist/nuclear.min.js b/dist/nuclear.min.js index 48d8bb8..ff511e9 100644 --- a/dist/nuclear.min.js +++ b/dist/nuclear.min.js @@ -1,3 +1,3 @@ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Nuclear=e():t.Nuclear=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),r(1);var i=r(2),o=n(i),u=r(6),a=n(u),s=r(3),c=n(s),f=r(5),h=r(11),p=r(10),l=r(7),_=n(l);e["default"]={Reactor:a["default"],Store:o["default"],Immutable:c["default"],isKeyPath:h.isKeyPath,isGetter:p.isGetter,toJS:f.toJS,toImmutable:f.toImmutable,isImmutable:f.isImmutable,createReactMixin:_["default"]},t.exports=e["default"]},function(t,e){"use strict";try{window.console&&console.log||(console={log:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){}})}catch(r){}},function(t,e,r){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){return t instanceof c}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var r=0;ri;i++)n[i]=t[i+e];return n}function o(t){return void 0===t.size&&(t.size=t.__iterate(a)),t.size}function u(t,e){if("number"!=typeof e){var r=+e;if(""+r!==e)return NaN;e=r}return 0>e?o(t)+e:e}function a(){return!0}function s(t,e,r){return(0===t||void 0!==r&&-r>=t)&&(void 0===e||void 0!==r&&e>=r)}function c(t,e){return h(t,e,0)}function f(t,e){return h(t,e,e)}function h(t,e,r){return void 0===t?r:0>t?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function p(t){return d(t)?t:x(t)}function l(t){return y(t)?t:q(t)}function _(t){return g(t)?t:k(t)}function v(t){return d(t)&&!m(t)?t:A(t)}function d(t){return!(!t||!t[_r])}function y(t){return!(!t||!t[vr])}function g(t){return!(!t||!t[dr])}function m(t){return y(t)||g(t)}function w(t){return!(!t||!t[yr])}function S(t){this.next=t}function b(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function I(){return{value:void 0,done:!0}}function z(t){return!!E(t)}function M(t){return t&&"function"==typeof t.next}function D(t){var e=E(t);return e&&e.call(t)}function E(t){var e=t&&(Sr&&t[Sr]||t[br]);return"function"==typeof e?e:void 0}function O(t){return t&&"number"==typeof t.length}function x(t){return null===t||void 0===t?L():d(t)?t.toSeq():J(t)}function q(t){return null===t||void 0===t?L().toKeyedSeq():d(t)?y(t)?t.toSeq():t.fromEntrySeq():T(t)}function k(t){return null===t||void 0===t?L():d(t)?y(t)?t.entrySeq():t.toIndexedSeq():B(t)}function A(t){return(null===t||void 0===t?L():d(t)?y(t)?t.entrySeq():t:B(t)).toSetSeq()}function j(t){this._array=t,this.size=t.length}function R(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function K(t){this._iterable=t,this.size=t.length||t.size}function P(t){this._iterator=t,this._iteratorCache=[]}function U(t){return!(!t||!t[zr])}function L(){return Mr||(Mr=new j([]))}function T(t){var e=Array.isArray(t)?new j(t).fromEntrySeq():M(t)?new P(t).fromEntrySeq():z(t)?new K(t).fromEntrySeq():"object"==typeof t?new R(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function B(t){var e=W(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function J(t){var e=W(t)||"object"==typeof t&&new R(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function W(t){return O(t)?new j(t):M(t)?new P(t):z(t)?new K(t):void 0}function C(t,e,r,n){var i=t._cache;if(i){for(var o=i.length-1,u=0;o>=u;u++){var a=i[r?o-u:u];if(e(a[1],n?a[0]:u,t)===!1)return u+1}return u}return t.__iterateUncached(e,r)}function F(t,e,r,n){var i=t._cache;if(i){var o=i.length-1,u=0;return new S(function(){var t=i[r?o-u:u];return u++>o?I():b(e,n?t[0]:u-1,t[1])})}return t.__iteratorUncached(e,r)}function N(){throw TypeError("Abstract")}function G(){}function H(){}function V(){}function X(t,e){if(t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if(t=t.valueOf(),e=e.valueOf(),t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return"function"==typeof t.equals&&"function"==typeof e.equals&&t.equals(e)?!0:!1}function Y(t,e){return e?Q(e,t,"",{"":t}):Z(t)}function Q(t,e,r,n){return Array.isArray(e)?t.call(n,r,k(e).map(function(r,n){return Q(t,r,n,e)})):$(e)?t.call(n,r,q(e).map(function(r,n){return Q(t,r,n,e)})):e}function Z(t){return Array.isArray(t)?k(t).map(Z).toList():$(t)?q(t).map(Z).toMap():t}function $(t){return t&&(t.constructor===Object||void 0===t.constructor)}function tt(t){return t>>>1&1073741824|3221225471&t}function et(t){if(t===!1||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(t=t.valueOf(),t===!1||null===t||void 0===t))return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){var r=0|t;for(r!==t&&(r^=4294967295*t);t>4294967295;)t/=4294967295,r^=t;return tt(r)}return"string"===e?t.length>jr?rt(t):nt(t):"function"==typeof t.hashCode?t.hashCode():it(t)}function rt(t){var e=Pr[t];return void 0===e&&(e=nt(t),Kr===Rr&&(Kr=0,Pr={}),Kr++,Pr[t]=e),e}function nt(t){for(var e=0,r=0;r0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function ut(t,e){if(!t)throw new Error(e)}function at(t){ut(t!==1/0,"Cannot perform this action with an infinite size.")}function st(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function ct(t){this._iter=t,this.size=t.size}function ft(t){this._iter=t,this.size=t.size}function ht(t){this._iter=t,this.size=t.size}function pt(t){var e=jt(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=Rt,e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e.__iteratorUncached=function(e,r){if(e===wr){var n=t.__iterator(e,r);return new S(function(){var t=n.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(e===mr?gr:mr,r)},e}function lt(t,e,r){var n=jt(t);return n.size=t.size,n.has=function(e){return t.has(e)},n.get=function(n,i){var o=t.get(n,hr);return o===hr?i:e.call(r,o,n,t)},n.__iterateUncached=function(n,i){var o=this;return t.__iterate(function(t,i,u){return n(e.call(r,t,i,u),i,o)!==!1},i)},n.__iteratorUncached=function(n,i){var o=t.__iterator(wr,i);return new S(function(){var i=o.next();if(i.done)return i;var u=i.value,a=u[0];return b(n,a,e.call(r,u[1],a,t),i)})},n}function _t(t,e){var r=jt(t);return r._iter=t,r.size=t.size,r.reverse=function(){return t},t.flip&&(r.flip=function(){var e=pt(t);return e.reverse=function(){return t.flip()},e}),r.get=function(r,n){return t.get(e?r:-1-r,n)},r.has=function(r){return t.has(e?r:-1-r)},r.includes=function(e){return t.includes(e)},r.cacheResult=Rt,r.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},r.__iterator=function(e,r){return t.__iterator(e,!r)},r}function vt(t,e,r,n){var i=jt(t);return n&&(i.has=function(n){var i=t.get(n,hr);return i!==hr&&!!e.call(r,i,n,t)},i.get=function(n,i){var o=t.get(n,hr);return o!==hr&&e.call(r,o,n,t)?o:i}),i.__iterateUncached=function(i,o){var u=this,a=0;return t.__iterate(function(t,o,s){return e.call(r,t,o,s)?(a++,i(t,n?o:a-1,u)):void 0},o),a},i.__iteratorUncached=function(i,o){var u=t.__iterator(wr,o),a=0;return new S(function(){for(;;){var o=u.next();if(o.done)return o;var s=o.value,c=s[0],f=s[1];if(e.call(r,f,c,t))return b(i,n?c:a++,f,o)}})},i}function dt(t,e,r){var n=Ut().asMutable();return t.__iterate(function(i,o){n.update(e.call(r,i,o,t),0,function(t){return t+1})}),n.asImmutable()}function yt(t,e,r){var n=y(t),i=(w(t)?Ie():Ut()).asMutable();t.__iterate(function(o,u){i.update(e.call(r,o,u,t),function(t){return t=t||[],t.push(n?[u,o]:o),t})});var o=At(t);return i.map(function(e){return xt(t,o(e))})}function gt(t,e,r,n){var i=t.size;if(void 0!==e&&(e=0|e),void 0!==r&&(r=0|r),s(e,r,i))return t;var o=c(e,i),a=f(r,i);if(o!==o||a!==a)return gt(t.toSeq().cacheResult(),e,r,n);var h,p=a-o;p===p&&(h=0>p?0:p);var l=jt(t);return l.size=0===h?h:t.size&&h||void 0,!n&&U(t)&&h>=0&&(l.get=function(e,r){return e=u(this,e),e>=0&&h>e?t.get(e+o,r):r}),l.__iterateUncached=function(e,r){var i=this;if(0===h)return 0;if(r)return this.cacheResult().__iterate(e,r);var u=0,a=!0,s=0;return t.__iterate(function(t,r){return a&&(a=u++h)return I();var t=i.next();return n||e===mr?t:e===gr?b(e,a-1,void 0,t):b(e,a-1,t.value[1],t)})},l}function mt(t,e,r){var n=jt(t);return n.__iterateUncached=function(n,i){var o=this;if(i)return this.cacheResult().__iterate(n,i);var u=0;return t.__iterate(function(t,i,a){return e.call(r,t,i,a)&&++u&&n(t,i,o)}),u},n.__iteratorUncached=function(n,i){var o=this;if(i)return this.cacheResult().__iterator(n,i);var u=t.__iterator(wr,i),a=!0;return new S(function(){if(!a)return I();var t=u.next();if(t.done)return t;var i=t.value,s=i[0],c=i[1];return e.call(r,c,s,o)?n===wr?t:b(n,s,c,t):(a=!1,I())})},n}function wt(t,e,r,n){var i=jt(t);return i.__iterateUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterate(i,o);var a=!0,s=0;return t.__iterate(function(t,o,c){return a&&(a=e.call(r,t,o,c))?void 0:(s++,i(t,n?o:s-1,u))}),s},i.__iteratorUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterator(i,o);var a=t.__iterator(wr,o),s=!0,c=0;return new S(function(){var t,o,f;do{if(t=a.next(),t.done)return n||i===mr?t:i===gr?b(i,c++,void 0,t):b(i,c++,t.value[1],t);var h=t.value;o=h[0],f=h[1],s&&(s=e.call(r,f,o,u))}while(s);return i===wr?t:b(i,o,f,t)})},i}function St(t,e){var r=y(t),n=[t].concat(e).map(function(t){return d(t)?r&&(t=l(t)):t=r?T(t):B(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===n.length)return t;if(1===n.length){var i=n[0];if(i===t||r&&y(i)||g(t)&&g(i))return i}var o=new j(n);return r?o=o.toKeyedSeq():g(t)||(o=o.toSetSeq()),o=o.flatten(!0),o.size=n.reduce(function(t,e){if(void 0!==t){var r=e.size;if(void 0!==r)return t+r}},0),o}function bt(t,e,r){var n=jt(t);return n.__iterateUncached=function(n,i){function o(t,s){var c=this;t.__iterate(function(t,i){return(!e||e>s)&&d(t)?o(t,s+1):n(t,r?i:u++,c)===!1&&(a=!0),!a},i)}var u=0,a=!1;return o(t,0),u},n.__iteratorUncached=function(n,i){var o=t.__iterator(n,i),u=[],a=0;return new S(function(){for(;o;){var t=o.next();if(t.done===!1){var s=t.value;if(n===wr&&(s=s[1]),e&&!(u.length0}function Ot(t,e,r){var n=jt(t);return n.size=new j(r).map(function(t){return t.size}).min(),n.__iterate=function(t,e){for(var r,n=this.__iterator(mr,e),i=0;!(r=n.next()).done&&t(r.value,i++,this)!==!1;);return i},n.__iteratorUncached=function(t,n){var i=r.map(function(t){return t=p(t),D(n?t.reverse():t)}),o=0,u=!1;return new S(function(){var r;return u||(r=i.map(function(t){return t.next()}),u=r.some(function(t){return t.done})),u?I():b(t,o++,e.apply(null,r.map(function(t){return t.value})))})},n}function xt(t,e){return U(t)?e:t.constructor(e)}function qt(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function kt(t){return at(t.size),o(t)}function At(t){return y(t)?l:g(t)?_:v}function jt(t){return Object.create((y(t)?q:g(t)?k:A).prototype)}function Rt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):x.prototype.cacheResult.call(this)}function Kt(t,e){return t>e?1:e>t?-1:0}function Pt(t){var e=D(t);if(!e){if(!O(t))throw new TypeError("Expected iterable or array-like: "+t);e=D(p(t))}return e}function Ut(t){return null===t||void 0===t?Vt():Lt(t)&&!w(t)?t:Vt().withMutations(function(e){var r=l(t);at(r.size),r.forEach(function(t,r){return e.set(r,t)})})}function Lt(t){return!(!t||!t[Ur])}function Tt(t,e){this.ownerID=t,this.entries=e}function Bt(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r}function Jt(t,e,r){this.ownerID=t,this.count=e,this.nodes=r}function Wt(t,e,r){this.ownerID=t,this.keyHash=e,this.entries=r}function Ct(t,e,r){this.ownerID=t,this.keyHash=e,this.entry=r}function Ft(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&Gt(t._root)}function Nt(t,e){return b(t,e[0],e[1])}function Gt(t,e){return{node:t,index:0,__prev:e}}function Ht(t,e,r,n){var i=Object.create(Lr);return i.size=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Vt(){return Tr||(Tr=Ht(0))}function Xt(t,r,n){var i,o;if(t._root){var u=e(pr),a=e(lr);if(i=Yt(t._root,t.__ownerID,0,void 0,r,n,u,a),!a.value)return t;o=t.size+(u.value?n===hr?-1:1:0)}else{if(n===hr)return t;o=1,i=new Tt(t.__ownerID,[[r,n]])}return t.__ownerID?(t.size=o,t._root=i,t.__hash=void 0,t.__altered=!0,t):i?Ht(o,i):Vt()}function Yt(t,e,n,i,o,u,a,s){return t?t.update(e,n,i,o,u,a,s):u===hr?t:(r(s),r(a),new Ct(e,i,[o,u]))}function Qt(t){return t.constructor===Ct||t.constructor===Wt}function Zt(t,e,r,n,i){if(t.keyHash===n)return new Wt(e,n,[t.entry,i]);var o,u=(0===r?t.keyHash:t.keyHash>>>r)&fr,a=(0===r?n:n>>>r)&fr,s=u===a?[Zt(t,e,r+sr,n,i)]:(o=new Ct(e,n,i),a>u?[t,o]:[o,t]);return new Bt(e,1<a;a++,s<<=1){var f=e[a];void 0!==f&&a!==n&&(i|=s,u[o++]=f)}return new Bt(t,i,u)}function ee(t,e,r,n,i){for(var o=0,u=new Array(cr),a=0;0!==r;a++,r>>>=1)u[a]=1&r?e[o++]:void 0;return u[n]=i,new Jt(t,o+1,u)}function re(t,e,r){for(var n=[],i=0;i>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function ae(t,e,r,n){var o=n?t:i(t);return o[e]=r,o}function se(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var o=new Array(i),u=0,a=0;i>a;a++)a===e?(o[a]=r,u=-1):o[a]=t[a+u];return o}function ce(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=new Array(n),o=0,u=0;n>u;u++)u===e&&(o=1),i[u]=t[u+o];return i}function fe(t){var e=ve();if(null===t||void 0===t)return e;if(he(t))return t;var r=_(t),n=r.size;return 0===n?e:(at(n),n>0&&cr>n?_e(0,n,sr,null,new pe(r.toArray())):e.withMutations(function(t){t.setSize(n),r.forEach(function(e,r){return t.set(r,e)})}))}function he(t){return!(!t||!t[Cr])}function pe(t,e){this.array=t,this.ownerID=e}function le(t,e){function r(t,e,r){return 0===e?n(t,r):i(t,e,r)}function n(t,r){var n=r===a?s&&s.array:t&&t.array,i=r>o?0:o-r,c=u-r;return c>cr&&(c=cr),function(){if(i===c)return Gr;var t=e?--c:i++;return n&&n[t]}}function i(t,n,i){var a,s=t&&t.array,c=i>o?0:o-i>>n,f=(u-i>>n)+1;return f>cr&&(f=cr),function(){for(;;){if(a){var t=a();if(t!==Gr)return t;a=null}if(c===f)return Gr;var o=e?--f:c++;a=r(s&&s[o],n-sr,i+(o<=t.size||0>r)return t.withMutations(function(t){0>r?we(t,r).set(0,n):we(t,0,r+1).set(r,n)});r+=t._origin;var i=t._tail,o=t._root,a=e(lr);return r>=be(t._capacity)?i=ye(i,t.__ownerID,0,r,n,a):o=ye(o,t.__ownerID,t._level,r,n,a),a.value?t.__ownerID?(t._root=o,t._tail=i,t.__hash=void 0,t.__altered=!0,t):_e(t._origin,t._capacity,t._level,o,i):t}function ye(t,e,n,i,o,u){var a=i>>>n&fr,s=t&&a0){var f=t&&t.array[a],h=ye(f,e,n-sr,i,o,u);return h===f?t:(c=ge(t,e),c.array[a]=h,c)}return s&&t.array[a]===o?t:(r(u),c=ge(t,e),void 0===o&&a===c.array.length-1?c.array.pop():c.array[a]=o,c)}function ge(t,e){return e&&t&&e===t.ownerID?t:new pe(t?t.array.slice():[],e)}function me(t,e){if(e>=be(t._capacity))return t._tail;if(e<1<0;)r=r.array[e>>>n&fr],n-=sr;return r}}function we(t,e,r){void 0!==e&&(e=0|e),void 0!==r&&(r=0|r);var i=t.__ownerID||new n,o=t._origin,u=t._capacity,a=o+e,s=void 0===r?u:0>r?u+r:o+r;if(a===o&&s===u)return t;if(a>=s)return t.clear();for(var c=t._level,f=t._root,h=0;0>a+h;)f=new pe(f&&f.array.length?[void 0,f]:[],i),c+=sr,h+=1<=1<l?me(t,s-1):l>p?new pe([],i):_;if(_&&l>p&&u>a&&_.array.length){f=ge(f,i);for(var d=f,y=c;y>sr;y-=sr){var g=p>>>y&fr;d=d.array[g]=ge(d.array[g],i)}d.array[p>>>sr&fr]=_}if(u>s&&(v=v&&v.removeAfter(i,0,s)),a>=l)a-=l,s-=l,c=sr,f=null,v=v&&v.removeBefore(i,0,a);else if(a>o||p>l){for(h=0;f;){var m=a>>>c&fr;if(m!==l>>>c&fr)break;m&&(h+=(1<o&&(f=f.removeBefore(i,c,a-h)),f&&p>l&&(f=f.removeAfter(i,c,l-h)),h&&(a-=h,s-=h)}return t.__ownerID?(t.size=s-a,t._origin=a,t._capacity=s,t._level=c,t._root=f,t._tail=v,t.__hash=void 0,t.__altered=!0,t):_e(a,s,c,f,v)}function Se(t,e,r){for(var n=[],i=0,o=0;oi&&(i=a.size),d(u)||(a=a.map(function(t){return Y(t)})),n.push(a)}return i>t.size&&(t=t.setSize(i)),ie(t,e,n)}function be(t){return cr>t?0:t-1>>>sr<=cr&&u.size>=2*o.size?(i=u.filter(function(t,e){return void 0!==t&&a!==e}),n=i.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(n.__ownerID=i.__ownerID=t.__ownerID)):(n=o.remove(e),i=a===u.size-1?u.pop():u.set(a,void 0))}else if(s){if(r===u.get(a)[1])return t;n=o,i=u.set(a,[e,r])}else n=o.set(e,u.size),i=u.set(u.size,[e,r]);return t.__ownerID?(t.size=n.size,t._map=n,t._list=i,t.__hash=void 0,t):Me(n,i)}function Oe(t){return null===t||void 0===t?ke():xe(t)?t:ke().unshiftAll(t)}function xe(t){return!(!t||!t[Vr])}function qe(t,e,r,n){var i=Object.create(Xr);return i.size=t,i._head=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function ke(){return Yr||(Yr=qe(0))}function Ae(t){return null===t||void 0===t?Pe():je(t)&&!w(t)?t:Pe().withMutations(function(e){var r=v(t);at(r.size),r.forEach(function(t){return e.add(t)})})}function je(t){return!(!t||!t[Qr])}function Re(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function Ke(t,e){var r=Object.create(Zr);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function Pe(){return $r||($r=Ke(Vt()))}function Ue(t){return null===t||void 0===t?Be():Le(t)?t:Be().withMutations(function(e){var r=v(t);at(r.size),r.forEach(function(t){return e.add(t)})})}function Le(t){return je(t)&&w(t)}function Te(t,e){var r=Object.create(tn);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function Be(){return en||(en=Te(De()))}function Je(t,e){var r,n=function(o){if(o instanceof n)return o;if(!(this instanceof n))return new n(o);if(!r){r=!0;var u=Object.keys(t);Fe(i,u),i.size=u.length,i._name=e,i._keys=u,i._defaultValues=t}this._map=Ut(o)},i=n.prototype=Object.create(rn);return i.constructor=n,n}function We(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function Ce(t){return t._name||t.constructor.name||"Record"}function Fe(t,e){try{e.forEach(Ne.bind(void 0,t))}catch(r){}}function Ne(t,e){Object.defineProperty(t,e,{get:function(){return this.get(e)},set:function(t){ut(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}function Ge(t,e){if(t===e)return!0;if(!d(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||y(t)!==y(e)||g(t)!==g(e)||w(t)!==w(e))return!1;if(0===t.size&&0===e.size)return!0;var r=!m(t);if(w(t)){var n=t.entries();return e.every(function(t,e){var i=n.next().value;return i&&X(i[1],t)&&(r||X(i[0],e))})&&n.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var o=t;t=e,e=o}var u=!0,a=e.__iterate(function(e,n){return(r?t.has(e):i?X(e,t.get(n,hr)):X(t.get(n,hr),e))?void 0:(u=!1,!1)});return u&&t.size===a}function He(t,e,r){if(!(this instanceof He))return new He(t,e,r);if(ut(0!==r,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),r=void 0===r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,this.size=Math.max(0,Math.ceil((e-t)/r-1)+1),0===this.size){if(nn)return nn;nn=this}}function Ve(t,e){if(!(this instanceof Ve))return new Ve(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(on)return on;on=this}}function Xe(t,e){var r=function(r){t.prototype[r]=e[r]};return Object.keys(e).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(r),t}function Ye(t,e){return e}function Qe(t,e){return[e,t]}function Ze(t){return function(){return!t.apply(this,arguments)}}function $e(t){return function(){return-t.apply(this,arguments)}}function tr(t){return"string"==typeof t?JSON.stringify(t):t}function er(){return i(arguments)}function rr(t,e){return e>t?1:t>e?-1:0}function nr(t){if(t.size===1/0)return 0;var e=w(t),r=y(t),n=e?1:0,i=t.__iterate(r?e?function(t,e){n=31*n+or(et(t),et(e))|0}:function(t,e){n=n+or(et(t),et(e))|0}:e?function(t){n=31*n+et(t)|0}:function(t){n=n+et(t)|0});return ir(i,n)}function ir(t,e){return e=Er(e,3432918353),e=Er(e<<15|e>>>-15,461845907),e=Er(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=Er(e^e>>>16,2246822507),e=Er(e^e>>>13,3266489909),e=tt(e^e>>>16)}function or(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var ur=Array.prototype.slice,ar="delete",sr=5,cr=1<=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},j.prototype.__iterator=function(t,e){var r=this._array,n=r.length-1,i=0;return new S(function(){return i>n?I():b(t,i,r[e?n-i++:i++])})},t(R,q),R.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},R.prototype.has=function(t){return this._object.hasOwnProperty(t)},R.prototype.__iterate=function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,o=0;i>=o;o++){var u=n[e?i-o:o];if(t(r[u],u,this)===!1)return o+1}return o},R.prototype.__iterator=function(t,e){var r=this._object,n=this._keys,i=n.length-1,o=0;return new S(function(){var u=n[e?i-o:o];return o++>i?I():b(t,u,r[u])})},R.prototype[yr]=!0,t(K,k),K.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=D(r),i=0;if(M(n))for(var o;!(o=n.next()).done&&t(o.value,i++,this)!==!1;);return i},K.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=D(r);if(!M(n))return new S(I);var i=0;return new S(function(){var e=n.next();return e.done?e:b(t,i++,e.value)})},t(P,k),P.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;i=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return b(t,i,n[i++])})};var Mr;t(N,p),t(G,N),t(H,N),t(V,N),N.Keyed=G,N.Indexed=H,N.Set=V;var Dr,Er="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){t=0|t,e=0|e;var r=65535&t,n=65535&e;return r*n+((t>>>16)*n+r*(e>>>16)<<16>>>0)|0},Or=Object.isExtensible,xr=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}(),qr="function"==typeof WeakMap;qr&&(Dr=new WeakMap);var kr=0,Ar="__immutablehash__";"function"==typeof Symbol&&(Ar=Symbol(Ar));var jr=16,Rr=255,Kr=0,Pr={};t(st,q),st.prototype.get=function(t,e){return this._iter.get(t,e)},st.prototype.has=function(t){return this._iter.has(t)},st.prototype.valueSeq=function(){return this._iter.valueSeq()},st.prototype.reverse=function(){var t=this,e=_t(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},st.prototype.map=function(t,e){var r=this,n=lt(this,t,e);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(t,e)}),n},st.prototype.__iterate=function(t,e){var r,n=this;return this._iter.__iterate(this._useKeys?function(e,r){return t(e,r,n)}:(r=e?kt(this):0,function(i){return t(i,e?--r:r++,n)}),e)},st.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var r=this._iter.__iterator(mr,e),n=e?kt(this):0;return new S(function(){var i=r.next();return i.done?i:b(t,e?--n:n++,i.value,i)})},st.prototype[yr]=!0,t(ct,k),ct.prototype.includes=function(t){return this._iter.includes(t)},ct.prototype.__iterate=function(t,e){var r=this,n=0;return this._iter.__iterate(function(e){return t(e,n++,r)},e)},ct.prototype.__iterator=function(t,e){var r=this._iter.__iterator(mr,e),n=0;return new S(function(){var e=r.next();return e.done?e:b(t,n++,e.value,e)})},t(ft,A),ft.prototype.has=function(t){return this._iter.includes(t)},ft.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){return t(e,e,r)},e)},ft.prototype.__iterator=function(t,e){var r=this._iter.__iterator(mr,e);return new S(function(){var e=r.next();return e.done?e:b(t,e.value,e.value,e)})},t(ht,q),ht.prototype.entrySeq=function(){return this._iter.toSeq()},ht.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){if(e){qt(e);var n=d(e);return t(n?e.get(1):e[1],n?e.get(0):e[0],r)}},e)},ht.prototype.__iterator=function(t,e){var r=this._iter.__iterator(mr,e);return new S(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value; if(n){qt(n);var i=d(n);return b(t,i?n.get(0):n[0],i?n.get(1):n[1],e)}}})},ct.prototype.cacheResult=st.prototype.cacheResult=ft.prototype.cacheResult=ht.prototype.cacheResult=Rt,t(Ut,G),Ut.prototype.toString=function(){return this.__toString("Map {","}")},Ut.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},Ut.prototype.set=function(t,e){return Xt(this,t,e)},Ut.prototype.setIn=function(t,e){return this.updateIn(t,hr,function(){return e})},Ut.prototype.remove=function(t){return Xt(this,t,hr)},Ut.prototype.deleteIn=function(t){return this.updateIn(t,function(){return hr})},Ut.prototype.update=function(t,e,r){return 1===arguments.length?t(this):this.updateIn([t],e,r)},Ut.prototype.updateIn=function(t,e,r){r||(r=e,e=void 0);var n=oe(this,Pt(t),e,r);return n===hr?void 0:n},Ut.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Vt()},Ut.prototype.merge=function(){return re(this,void 0,arguments)},Ut.prototype.mergeWith=function(t){var e=ur.call(arguments,1);return re(this,t,e)},Ut.prototype.mergeIn=function(t){var e=ur.call(arguments,1);return this.updateIn(t,Vt(),function(t){return"function"==typeof t.merge?t.merge.apply(t,e):e[e.length-1]})},Ut.prototype.mergeDeep=function(){return re(this,ne(void 0),arguments)},Ut.prototype.mergeDeepWith=function(t){var e=ur.call(arguments,1);return re(this,ne(t),e)},Ut.prototype.mergeDeepIn=function(t){var e=ur.call(arguments,1);return this.updateIn(t,Vt(),function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,e):e[e.length-1]})},Ut.prototype.sort=function(t){return Ie(Mt(this,t))},Ut.prototype.sortBy=function(t,e){return Ie(Mt(this,e,t))},Ut.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},Ut.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new n)},Ut.prototype.asImmutable=function(){return this.__ensureOwner()},Ut.prototype.wasAltered=function(){return this.__altered},Ut.prototype.__iterator=function(t,e){return new Ft(this,t,e)},Ut.prototype.__iterate=function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},Ut.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Ht(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Ut.isMap=Lt;var Ur="@@__IMMUTABLE_MAP__@@",Lr=Ut.prototype;Lr[Ur]=!0,Lr[ar]=Lr.remove,Lr.removeIn=Lr.deleteIn,Tt.prototype.get=function(t,e,r,n){for(var i=this.entries,o=0,u=i.length;u>o;o++)if(X(r,i[o][0]))return i[o][1];return n},Tt.prototype.update=function(t,e,n,o,u,a,s){for(var c=u===hr,f=this.entries,h=0,p=f.length;p>h&&!X(o,f[h][0]);h++);var l=p>h;if(l?f[h][1]===u:c)return this;if(r(s),(c||!l)&&r(a),!c||1!==f.length){if(!l&&!c&&f.length>=Br)return $t(t,f,o,u);var _=t&&t===this.ownerID,v=_?f:i(f);return l?c?h===p-1?v.pop():v[h]=v.pop():v[h]=[o,u]:v.push([o,u]),_?(this.entries=v,this):new Tt(t,v)}},Bt.prototype.get=function(t,e,r,n){void 0===e&&(e=et(r));var i=1<<((0===t?e:e>>>t)&fr),o=this.bitmap;return 0===(o&i)?n:this.nodes[ue(o&i-1)].get(t+sr,e,r,n)},Bt.prototype.update=function(t,e,r,n,i,o,u){void 0===r&&(r=et(n));var a=(0===e?r:r>>>e)&fr,s=1<=Jr)return ee(t,p,c,a,_);if(f&&!_&&2===p.length&&Qt(p[1^h]))return p[1^h];if(f&&_&&1===p.length&&Qt(_))return _;var v=t&&t===this.ownerID,d=f?_?c:c^s:c|s,y=f?_?ae(p,h,_,v):ce(p,h,v):se(p,h,_,v);return v?(this.bitmap=d,this.nodes=y,this):new Bt(t,d,y)},Jt.prototype.get=function(t,e,r,n){void 0===e&&(e=et(r));var i=(0===t?e:e>>>t)&fr,o=this.nodes[i];return o?o.get(t+sr,e,r,n):n},Jt.prototype.update=function(t,e,r,n,i,o,u){void 0===r&&(r=et(n));var a=(0===e?r:r>>>e)&fr,s=i===hr,c=this.nodes,f=c[a];if(s&&!f)return this;var h=Yt(f,t,e+sr,r,n,i,o,u);if(h===f)return this;var p=this.count;if(f){if(!h&&(p--,Wr>p))return te(t,c,p,a)}else p++;var l=t&&t===this.ownerID,_=ae(c,a,h,l);return l?(this.count=p,this.nodes=_,this):new Jt(t,p,_)},Wt.prototype.get=function(t,e,r,n){for(var i=this.entries,o=0,u=i.length;u>o;o++)if(X(r,i[o][0]))return i[o][1];return n},Wt.prototype.update=function(t,e,n,o,u,a,s){void 0===n&&(n=et(o));var c=u===hr;if(n!==this.keyHash)return c?this:(r(s),r(a),Zt(this,t,e,n,[o,u]));for(var f=this.entries,h=0,p=f.length;p>h&&!X(o,f[h][0]);h++);var l=p>h;if(l?f[h][1]===u:c)return this;if(r(s),(c||!l)&&r(a),c&&2===p)return new Ct(t,this.keyHash,f[1^h]);var _=t&&t===this.ownerID,v=_?f:i(f);return l?c?h===p-1?v.pop():v[h]=v.pop():v[h]=[o,u]:v.push([o,u]),_?(this.entries=v,this):new Wt(t,this.keyHash,v)},Ct.prototype.get=function(t,e,r,n){return X(r,this.entry[0])?this.entry[1]:n},Ct.prototype.update=function(t,e,n,i,o,u,a){var s=o===hr,c=X(i,this.entry[0]);return(c?o===this.entry[1]:s)?this:(r(a),s?void r(u):c?t&&t===this.ownerID?(this.entry[1]=o,this):new Ct(t,this.keyHash,[i,o]):(r(u),Zt(this,t,e,et(i),[i,o])))},Tt.prototype.iterate=Wt.prototype.iterate=function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1},Bt.prototype.iterate=Jt.prototype.iterate=function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var o=r[e?i-n:n];if(o&&o.iterate(t,e)===!1)return!1}},Ct.prototype.iterate=function(t,e){return t(this.entry)},t(Ft,S),Ft.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return Nt(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return Nt(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var o=n.nodes[this._reverse?r-i:i];if(o){if(o.entry)return Nt(t,o.entry);e=this._stack=Gt(o,e)}continue}e=this._stack=this._stack.__prev}return I()};var Tr,Br=cr/4,Jr=cr/2,Wr=cr/4;t(fe,H),fe.of=function(){return this(arguments)},fe.prototype.toString=function(){return this.__toString("List [","]")},fe.prototype.get=function(t,e){if(t=u(this,t),t>=0&&t>>e&fr;if(n>=this.array.length)return new pe([],t);var i,o=0===n;if(e>0){var u=this.array[n];if(i=u&&u.removeBefore(t,e-sr,r),i===u&&o)return this}if(o&&!i)return this;var a=ge(this,t);if(!o)for(var s=0;n>s;s++)a.array[s]=void 0;return i&&(a.array[n]=i),a},pe.prototype.removeAfter=function(t,e,r){if(r===(e?1<>>e&fr;if(n>=this.array.length)return this;var i;if(e>0){var o=this.array[n];if(i=o&&o.removeAfter(t,e-sr,r),i===o&&n===this.array.length-1)return this}var u=ge(this,t);return u.array.splice(n+1),i&&(u.array[n]=i),u};var Nr,Gr={};t(Ie,Ut),Ie.of=function(){return this(arguments)},Ie.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ie.prototype.get=function(t,e){var r=this._map.get(t);return void 0!==r?this._list.get(r)[1]:e},Ie.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):De()},Ie.prototype.set=function(t,e){return Ee(this,t,e)},Ie.prototype.remove=function(t){return Ee(this,t,hr)},Ie.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ie.prototype.__iterate=function(t,e){var r=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},Ie.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Ie.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._list.__ensureOwner(t);return t?Me(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=r,this)},Ie.isOrderedMap=ze,Ie.prototype[yr]=!0,Ie.prototype[ar]=Ie.prototype.remove;var Hr;t(Oe,H),Oe.of=function(){return this(arguments)},Oe.prototype.toString=function(){return this.__toString("Stack [","]")},Oe.prototype.get=function(t,e){var r=this._head;for(t=u(this,t);r&&t--;)r=r.next;return r?r.value:e},Oe.prototype.peek=function(){return this._head&&this._head.value},Oe.prototype.push=function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,r=arguments.length-1;r>=0;r--)e={value:arguments[r],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):qe(t,e)},Oe.prototype.pushAll=function(t){if(t=_(t),0===t.size)return this;at(t.size);var e=this.size,r=this._head;return t.reverse().forEach(function(t){e++,r={value:t,next:r}}),this.__ownerID?(this.size=e,this._head=r,this.__hash=void 0,this.__altered=!0,this):qe(e,r)},Oe.prototype.pop=function(){return this.slice(1)},Oe.prototype.unshift=function(){return this.push.apply(this,arguments)},Oe.prototype.unshiftAll=function(t){return this.pushAll(t)},Oe.prototype.shift=function(){return this.pop.apply(this,arguments)},Oe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):ke()},Oe.prototype.slice=function(t,e){if(s(t,e,this.size))return this;var r=c(t,this.size),n=f(e,this.size);if(n!==this.size)return H.prototype.slice.call(this,t,e);for(var i=this.size-r,o=this._head;r--;)o=o.next;return this.__ownerID?(this.size=i,this._head=o,this.__hash=void 0,this.__altered=!0,this):qe(i,o)},Oe.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?qe(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Oe.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var r=0,n=this._head;n&&t(n.value,r++,this)!==!1;)n=n.next;return r},Oe.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var r=0,n=this._head;return new S(function(){if(n){var e=n.value;return n=n.next,b(t,r++,e)}return I()})},Oe.isStack=xe;var Vr="@@__IMMUTABLE_STACK__@@",Xr=Oe.prototype;Xr[Vr]=!0,Xr.withMutations=Lr.withMutations,Xr.asMutable=Lr.asMutable,Xr.asImmutable=Lr.asImmutable,Xr.wasAltered=Lr.wasAltered;var Yr;t(Ae,V),Ae.of=function(){return this(arguments)},Ae.fromKeys=function(t){return this(l(t).keySeq())},Ae.prototype.toString=function(){return this.__toString("Set {","}")},Ae.prototype.has=function(t){return this._map.has(t)},Ae.prototype.add=function(t){return Re(this,this._map.set(t,!0))},Ae.prototype.remove=function(t){return Re(this,this._map.remove(t))},Ae.prototype.clear=function(){return Re(this,this._map.clear())},Ae.prototype.union=function(){var t=ur.call(arguments,0);return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(e){for(var r=0;r1?" by "+this._step:"")+" ]"},He.prototype.get=function(t,e){return this.has(t)?this._start+u(this,t)*this._step:e},He.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e=e?new He(0,0):new He(this.get(t,this._end),this.get(e,this._end),this._step))},He.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&r=o;o++){if(t(i,o,this)===!1)return o+1;i+=e?-n:n}return o},He.prototype.__iterator=function(t,e){var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,o=0;return new S(function(){var u=i;return i+=e?-n:n,o>r?I():b(t,o++,u)})},He.prototype.equals=function(t){return t instanceof He?this._start===t._start&&this._end===t._end&&this._step===t._step:Ge(this,t)};var nn;t(Ve,k),Ve.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},Ve.prototype.get=function(t,e){return this.has(t)?this._value:e},Ve.prototype.includes=function(t){return X(this._value,t)},Ve.prototype.slice=function(t,e){var r=this.size;return s(t,e,r)?this:new Ve(this._value,f(e,r)-c(t,r))},Ve.prototype.reverse=function(){return this},Ve.prototype.indexOf=function(t){return X(this._value,t)?0:-1},Ve.prototype.lastIndexOf=function(t){return X(this._value,t)?this.size:-1},Ve.prototype.__iterate=function(t,e){for(var r=0;rt?this.count():this.size);var n=this.slice(0,t);return xt(this,1===r?n:n.concat(i(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var r=this.toKeyedSeq().findLastKey(t,e);return void 0===r?-1:r},first:function(){return this.get(0)},flatten:function(t){return xt(this,bt(this,t,!1))},get:function(t,e){return t=u(this,t),0>t||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,r){return r===t},void 0,e)},has:function(t){return t=u(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t-1&&t%1===0&&t<=Number.MAX_VALUE}var i=Function.prototype.bind;e.isString=function(t){return"string"==typeof t||"[object String]"===r(t)},e.isArray=Array.isArray||function(t){return"[object Array]"===r(t)},"function"!=typeof/./&&"object"!=typeof Int8Array?e.isFunction=function(t){return"function"==typeof t||!1}:e.isFunction=function(t){return"[object Function]"===toString.call(t)},e.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},e.extend=function(t){var e=arguments.length;if(!t||2>e)return t||{};for(var r=1;e>r;r++)for(var n=arguments[r],i=Object.keys(n),o=i.length,u=0;o>u;u++){var a=i[u];t[a]=n[a]}return t},e.clone=function(t){return e.isObject(t)?e.isArray(t)?t.slice():e.extend({},t):t},e.each=function(t,e,r){var i,o,u=t?t.length:0,a=-1;if(r&&(o=e,e=function(t,e,n){return o.call(r,t,e,n)}),n(u))for(;++an;n++)r[n]=arguments[n];return new(i.apply(t,[null].concat(r)))};return e.__proto__=t,e.prototype=t.prototype,e}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return c["default"].Iterable.isIterable(t)}function o(t){return i(t)||!f.isObject(t)}function u(t){return i(t)?t.toJS():t}function a(t){return i(t)?t:c["default"].fromJS(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.isImmutable=i,e.isImmutableValue=o,e.toJS=u,e.toImmutable=a;var s=r(3),c=n(s),f=r(4)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var r=0;r0)){var e=this.reactorState.get("dirtyStores");if(0!==e.size){var r=s["default"].Set().withMutations(function(r){r.union(t.observerState.get("any")),e.forEach(function(e){var n=t.observerState.getIn(["stores",e]);n&&r.union(n)})});r.forEach(function(e){var r=t.observerState.getIn(["observersMap",e]);if(r){var n=r.get("getter"),i=r.get("handler"),o=p["default"].evaluate(t.prevReactorState,n),u=p["default"].evaluate(t.reactorState,n);t.prevReactorState=o.reactorState,t.reactorState=u.reactorState;var a=o.result,c=u.result;s["default"].is(a,c)||i.call(null,c)}});var n=p["default"].resetDirtyStores(this.reactorState);this.prevReactorState=n,this.reactorState=n}}}},{key:"batchStart",value:function(){this.__batchDepth++; -}},{key:"batchEnd",value:function(){if(this.__batchDepth--,this.__batchDepth<=0){this.__isDispatching=!0;try{this.__notify()}catch(t){throw this.__isDispatching=!1,t}this.__isDispatching=!1}}}]),t}();e["default"]=d.toFactory(g),t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r={};return o.each(e,function(e,n){r[n]=t.evaluate(e)}),r}Object.defineProperty(e,"__esModule",{value:!0});var o=r(4);e["default"]=function(t){return{getInitialState:function(){return i(t,this.getDataBindings())},componentDidMount:function(){var e=this;this.__unwatchFns=[],o.each(this.getDataBindings(),function(r,i){var o=t.observe(r,function(t){e.setState(n({},i,t))});e.__unwatchFns.push(o)})},componentWillUnmount:function(){for(;this.__unwatchFns.length;)this.__unwatchFns.shift()()}}},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return new w({result:t,reactorState:e})}function o(t){return t}function u(t,e){var r=o(e);return t.getIn(["cache",r])}function a(t,e){var r=u(t,e);return r?r.get("storeStates").every(function(e,r){return t.getIn(["storeStates",r])===e}):!1}function s(t,e,r){var n=o(e),i=t.get("dispatchId"),u=y.getStoreDeps(e),a=d.toImmutable({}).withMutations(function(e){u.forEach(function(r){var n=t.getIn(["storeStates",r]);e.set(r,n)})});return t.setIn(["cache",n],l["default"].Map({value:r,storeStates:a,dispatchId:i}))}function c(t,e){var r=o(e);return t.getIn(["cache",r,"value"])}function f(t){return t.update("dispatchId",function(t){return t+1})}function h(t,e){return t.withMutations(function(t){e.forEach(function(e){var r=t.has(e)?t.get(e)+1:1;t.set(e,r)})})}var p=r(3),l=n(p),_=r(9),v=n(_),d=r(5),y=r(10),g=r(11),m=r(4),w=l["default"].Record({result:null,reactorState:null});e.registerStores=function(t,e){var r=t.get("debug");return t.withMutations(function(t){m.each(e,function(e,n){t.getIn(["stores",n])&&console.warn("Store already defined for id = "+n);var i=e.getInitialState();if(r&&!d.isImmutableValue(i))throw new Error("Store getInitialState() must return an immutable value, did you forget to call toImmutable");t.update("stores",function(t){return t.set(n,e)}).update("state",function(t){return t.set(n,i)}).update("dirtyStores",function(t){return t.add(n)}).update("storeStates",function(t){return h(t,[n])})}),f(t)})},e.dispatch=function(t,e,r){var n=t.get("state"),i=t.get("debug"),o=t.get("dirtyStores"),u=n.withMutations(function(n){i&&v["default"].dispatchStart(e,r),t.get("stores").forEach(function(t,u){var a=n.get(u),s=void 0;try{s=t.handle(a,e,r)}catch(c){throw v["default"].dispatchError(c.message),c}if(i&&void 0===s){var f="Store handler must return a value, did you forget a return statement";throw v["default"].dispatchError(f),new Error(f)}n.set(u,s),a!==s&&(o=o.add(u)),i&&v["default"].storeHandled(u,a,s)}),i&&v["default"].dispatchEnd(n)}),a=t.set("state",u).set("dirtyStores",o).update("storeStates",function(t){return h(t,o)});return f(a)},e.loadState=function(t,e){var r=[],n=d.toImmutable({}).withMutations(function(n){m.each(e,function(e,i){var o=t.getIn(["stores",i]);if(o){var u=o.deserialize(e);void 0!==u&&(n.set(i,u),r.push(i))}})}),i=l["default"].Set(r);return t.update("state",function(t){return t.merge(n)}).update("dirtyStores",function(t){return t.union(i)}).update("storeStates",function(t){return h(t,r)})},e.addObserver=function(t,e,r){var n=e;g.isKeyPath(e)&&(e=y.fromKeyPath(e));var i=t.get("nextId"),o=y.getStoreDeps(e),u=l["default"].Map({id:i,storeDeps:o,getterKey:n,getter:e,handler:r}),a=void 0;return a=0===o.size?t.update("any",function(t){return t.add(i)}):t.withMutations(function(t){o.forEach(function(e){var r=["stores",e];t.hasIn(r)||t.setIn(r,l["default"].Set([])),t.updateIn(["stores",e],function(t){return t.add(i)})})}),a=a.set("nextId",i+1).setIn(["observersMap",i],u),{observerState:a,entry:u}},e.removeObserver=function(t,r,n){var i=t.get("observersMap").filter(function(t){var e=t.get("getterKey"),i=!n||t.get("handler")===n;return i?g.isKeyPath(r)&&g.isKeyPath(e)?g.isEqual(r,e):r===e:!1});return t.withMutations(function(t){i.forEach(function(r){return e.removeObserverByEntry(t,r)})})},e.removeObserverByEntry=function(t,e){return t.withMutations(function(t){var r=e.get("id"),n=e.get("storeDeps");0===n.size?t.update("any",function(t){return t.remove(r)}):n.forEach(function(e){t.updateIn(["stores",e],function(t){return t?t.remove(r):t})}),t.removeIn(["observersMap",r])})},e.reset=function(t){var r=t.get("debug"),n=t.get("state");return t.withMutations(function(t){var i=t.get("stores"),o=i.keySeq().toJS();i.forEach(function(e,i){var o=n.get(i),u=e.handleReset(o);if(r&&void 0===u)throw new Error("Store handleReset() must return a value, did you forget a return statement");if(r&&!d.isImmutableValue(u))throw new Error("Store reset state must be an immutable value, did you forget to call toImmutable");t.setIn(["state",i],u)}),t.update("storeStates",function(t){return h(t,o)}),e.resetDirtyStores(t)})},e.evaluate=function S(t,e){var r=t.get("state");if(g.isKeyPath(e))return i(r.getIn(e),t);if(!y.isGetter(e))throw new Error("evaluate must be passed a keyPath or Getter");if(a(t,e))return i(c(t,e),t);var n=y.getDeps(e).map(function(e){return S(t,e).result}),o=y.getComputeFn(e).apply(null,n);return i(o,s(t,e,o))},e.serialize=function(t){var e={};return t.get("stores").forEach(function(r,n){var i=t.getIn(["state",n]),o=r.serialize(i);void 0!==o&&(e[n]=o)}),e},e.resetDirtyStores=function(t){return t.set("dirtyStores",l["default"].Set())}},function(t,e){"use strict";e.dispatchStart=function(t,e){console.group&&(console.groupCollapsed("Dispatch: %s",t),console.group("payload"),console.debug(e),console.groupEnd())},e.dispatchError=function(t){console.group&&(console.debug("Dispatch error: "+t),console.groupEnd())},e.storeHandled=function(t,e,r){console.group&&e!==r&&console.debug("Store "+t+" handled action")},e.dispatchEnd=function(t){console.group&&(console.debug("Dispatch done, new state: ",t.toJS()),console.groupEnd())}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return p.isArray(t)&&p.isFunction(t[t.length-1])}function o(t){return t[t.length-1]}function u(t){return t.slice(0,t.length-1)}function a(t,e){e||(e=h["default"].Set());var r=h["default"].Set().withMutations(function(e){if(!i(t))throw new Error("getFlattenedDeps must be passed a Getter");u(t).forEach(function(t){if(l.isKeyPath(t))e.add(f.List(t));else{if(!i(t))throw new Error("Invalid getter, each dependency must be a KeyPath or Getter");e.union(a(t))}})});return e.union(r)}function s(t){if(!l.isKeyPath(t))throw new Error("Cannot create Getter from KeyPath: "+t);return[t,_]}function c(t){if(t.hasOwnProperty("__storeDeps"))return t.__storeDeps;var e=a(t).map(function(t){return t.first()}).filter(function(t){return!!t});return Object.defineProperty(t,"__storeDeps",{enumerable:!1,configurable:!1,writable:!1,value:e}),e}Object.defineProperty(e,"__esModule",{value:!0});var f=r(3),h=n(f),p=r(4),l=r(11),_=function(t){return t};e["default"]={isGetter:i,getComputeFn:o,getFlattenedDeps:a,getStoreDeps:c,getDeps:u,fromKeyPath:s},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return s.isArray(t)&&!s.isFunction(t[t.length-1])}function o(t,e){var r=a["default"].List(t),n=a["default"].List(e);return a["default"].is(r,n)}Object.defineProperty(e,"__esModule",{value:!0}),e.isKeyPath=i,e.isEqual=o;var u=r(3),a=n(u),s=r(4)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(3),o=n(i),u=o["default"].Record({dispatchId:0,state:o["default"].Map(),stores:o["default"].Map(),cache:o["default"].Map(),storeStates:o["default"].Map(),dirtyStores:o["default"].Set(),debug:!1}),a=o["default"].Record({any:o["default"].Set([]),stores:o["default"].Map({}),observersMap:o["default"].Map({}),nextId:1});e["default"]={ReactorState:u,ObserverState:a},t.exports=e["default"]}])}); \ No newline at end of file +}},{key:"batchEnd",value:function(){if(this.__batchDepth--,this.__batchDepth<=0){this.__isDispatching=!0;try{this.__notify()}catch(t){throw this.__isDispatching=!1,t}this.__isDispatching=!1}}}]),t}();e["default"]=d.toFactory(g),t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r={};return o.each(e,function(e,n){r[n]=t.evaluate(e)}),r}Object.defineProperty(e,"__esModule",{value:!0});var o=r(4);e["default"]=function(t){return{getInitialState:function(){return i(t,this.getDataBindings())},componentDidMount:function(){var e=this;this.__unwatchFns=[],o.each(this.getDataBindings(),function(r,i){var o=t.observe(r,function(t){e.setState(n({},i,t))});e.__unwatchFns.push(o)})},componentWillUnmount:function(){for(;this.__unwatchFns.length;)this.__unwatchFns.shift()()}}},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){return new w({result:t,reactorState:e})}function o(t){return t}function u(t,e){var r=o(e);return t.getIn(["cache",r])}function a(t,e){var r=u(t,e);if(!r)return!1;var n=r.get("storeStates");return 0===n.size?!1:n.every(function(e,r){return t.getIn(["storeStates",r])===e})}function s(t,e,r){var n=o(e),i=t.get("dispatchId"),u=y.getStoreDeps(e),a=d.toImmutable({}).withMutations(function(e){u.forEach(function(r){var n=t.getIn(["storeStates",r]);e.set(r,n)})});return t.setIn(["cache",n],l["default"].Map({value:r,storeStates:a,dispatchId:i}))}function c(t,e){var r=o(e);return t.getIn(["cache",r,"value"])}function f(t){return t.update("dispatchId",function(t){return t+1})}function h(t,e){return t.withMutations(function(t){e.forEach(function(e){var r=t.has(e)?t.get(e)+1:1;t.set(e,r)})})}var p=r(3),l=n(p),_=r(9),v=n(_),d=r(5),y=r(10),g=r(11),m=r(4),w=l["default"].Record({result:null,reactorState:null});e.registerStores=function(t,e){var r=t.get("debug");return t.withMutations(function(t){m.each(e,function(e,n){t.getIn(["stores",n])&&console.warn("Store already defined for id = "+n);var i=e.getInitialState();if(r&&!d.isImmutableValue(i))throw new Error("Store getInitialState() must return an immutable value, did you forget to call toImmutable");t.update("stores",function(t){return t.set(n,e)}).update("state",function(t){return t.set(n,i)}).update("dirtyStores",function(t){return t.add(n)}).update("storeStates",function(t){return h(t,[n])})}),f(t)})},e.dispatch=function(t,e,r){var n=t.get("state"),i=t.get("debug"),o=t.get("dirtyStores"),u=n.withMutations(function(n){i&&v["default"].dispatchStart(e,r),t.get("stores").forEach(function(t,u){var a=n.get(u),s=void 0;try{s=t.handle(a,e,r)}catch(c){throw v["default"].dispatchError(c.message),c}if(i&&void 0===s){var f="Store handler must return a value, did you forget a return statement";throw v["default"].dispatchError(f),new Error(f)}n.set(u,s),a!==s&&(o=o.add(u)),i&&v["default"].storeHandled(u,a,s)}),i&&v["default"].dispatchEnd(n)}),a=t.set("state",u).set("dirtyStores",o).update("storeStates",function(t){return h(t,o)});return f(a)},e.loadState=function(t,e){var r=[],n=d.toImmutable({}).withMutations(function(n){m.each(e,function(e,i){var o=t.getIn(["stores",i]);if(o){var u=o.deserialize(e);void 0!==u&&(n.set(i,u),r.push(i))}})}),i=l["default"].Set(r);return t.update("state",function(t){return t.merge(n)}).update("dirtyStores",function(t){return t.union(i)}).update("storeStates",function(t){return h(t,r)})},e.addObserver=function(t,e,r){var n=e;g.isKeyPath(e)&&(e=y.fromKeyPath(e));var i=t.get("nextId"),o=y.getStoreDeps(e),u=l["default"].Map({id:i,storeDeps:o,getterKey:n,getter:e,handler:r}),a=void 0;return a=0===o.size?t.update("any",function(t){return t.add(i)}):t.withMutations(function(t){o.forEach(function(e){var r=["stores",e];t.hasIn(r)||t.setIn(r,l["default"].Set([])),t.updateIn(["stores",e],function(t){return t.add(i)})})}),a=a.set("nextId",i+1).setIn(["observersMap",i],u),{observerState:a,entry:u}},e.removeObserver=function(t,r,n){var i=t.get("observersMap").filter(function(t){var e=t.get("getterKey"),i=!n||t.get("handler")===n;return i?g.isKeyPath(r)&&g.isKeyPath(e)?g.isEqual(r,e):r===e:!1});return t.withMutations(function(t){i.forEach(function(r){return e.removeObserverByEntry(t,r)})})},e.removeObserverByEntry=function(t,e){return t.withMutations(function(t){var r=e.get("id"),n=e.get("storeDeps");0===n.size?t.update("any",function(t){return t.remove(r)}):n.forEach(function(e){t.updateIn(["stores",e],function(t){return t?t.remove(r):t})}),t.removeIn(["observersMap",r])})},e.reset=function(t){var r=t.get("debug"),n=t.get("state");return t.withMutations(function(t){var i=t.get("stores"),o=i.keySeq().toJS();i.forEach(function(e,i){var o=n.get(i),u=e.handleReset(o);if(r&&void 0===u)throw new Error("Store handleReset() must return a value, did you forget a return statement");if(r&&!d.isImmutableValue(u))throw new Error("Store reset state must be an immutable value, did you forget to call toImmutable");t.setIn(["state",i],u)}),t.update("storeStates",function(t){return h(t,o)}),e.resetDirtyStores(t)})},e.evaluate=function S(t,e){var r=t.get("state");if(g.isKeyPath(e))return i(r.getIn(e),t);if(!y.isGetter(e))throw new Error("evaluate must be passed a keyPath or Getter");if(a(t,e))return i(c(t,e),t);var n=y.getDeps(e).map(function(e){return S(t,e).result}),o=y.getComputeFn(e).apply(null,n);return i(o,s(t,e,o))},e.serialize=function(t){var e={};return t.get("stores").forEach(function(r,n){var i=t.getIn(["state",n]),o=r.serialize(i);void 0!==o&&(e[n]=o)}),e},e.resetDirtyStores=function(t){return t.set("dirtyStores",l["default"].Set())}},function(t,e){"use strict";e.dispatchStart=function(t,e){console.group&&(console.groupCollapsed("Dispatch: %s",t),console.group("payload"),console.debug(e),console.groupEnd())},e.dispatchError=function(t){console.group&&(console.debug("Dispatch error: "+t),console.groupEnd())},e.storeHandled=function(t,e,r){console.group&&e!==r&&console.debug("Store "+t+" handled action")},e.dispatchEnd=function(t){console.group&&(console.debug("Dispatch done, new state: ",t.toJS()),console.groupEnd())}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return p.isArray(t)&&p.isFunction(t[t.length-1])}function o(t){return t[t.length-1]}function u(t){return t.slice(0,t.length-1)}function a(t,e){e||(e=h["default"].Set());var r=h["default"].Set().withMutations(function(e){if(!i(t))throw new Error("getFlattenedDeps must be passed a Getter");u(t).forEach(function(t){if(l.isKeyPath(t))e.add(f.List(t));else{if(!i(t))throw new Error("Invalid getter, each dependency must be a KeyPath or Getter");e.union(a(t))}})});return e.union(r)}function s(t){if(!l.isKeyPath(t))throw new Error("Cannot create Getter from KeyPath: "+t);return[t,_]}function c(t){if(t.hasOwnProperty("__storeDeps"))return t.__storeDeps;var e=a(t).map(function(t){return t.first()}).filter(function(t){return!!t});return Object.defineProperty(t,"__storeDeps",{enumerable:!1,configurable:!1,writable:!1,value:e}),e}Object.defineProperty(e,"__esModule",{value:!0});var f=r(3),h=n(f),p=r(4),l=r(11),_=function(t){return t};e["default"]={isGetter:i,getComputeFn:o,getFlattenedDeps:a,getStoreDeps:c,getDeps:u,fromKeyPath:s},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t){return s.isArray(t)&&!s.isFunction(t[t.length-1])}function o(t,e){var r=a["default"].List(t),n=a["default"].List(e);return a["default"].is(r,n)}Object.defineProperty(e,"__esModule",{value:!0}),e.isKeyPath=i,e.isEqual=o;var u=r(3),a=n(u),s=r(4)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=r(3),o=n(i),u=o["default"].Record({dispatchId:0,state:o["default"].Map(),stores:o["default"].Map(),cache:o["default"].Map(),storeStates:o["default"].Map(),dirtyStores:o["default"].Set(),debug:!1}),a=o["default"].Record({any:o["default"].Set([]),stores:o["default"].Map({}),observersMap:o["default"].Map({}),nextId:1});e["default"]={ReactorState:u,ObserverState:a},t.exports=e["default"]}])}); \ No newline at end of file diff --git a/package.json b/package.json index 031c9a8..827f266 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuclear-js", - "version": "1.2.0", + "version": "1.2.1", "description": "Immutable, reactive Flux architecture. UI Agnostic.", "main": "dist/nuclear.js", "scripts": {