mobx 3.4.1 → 3.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/README.md +80 -19
- package/lib/api/autorun.d.ts +1 -1
- package/lib/api/whyrun.d.ts +3 -0
- package/lib/core/computedvalue.d.ts +5 -4
- package/lib/core/derivation.d.ts +6 -0
- package/lib/core/reaction.d.ts +4 -1
- package/lib/mobx.d.ts +103 -135
- package/lib/mobx.js +350 -215
- package/lib/mobx.js.flow +2 -2
- package/lib/mobx.min.js +2 -2
- package/lib/mobx.min.js.map +1 -1
- package/lib/mobx.module.js +350 -216
- package/lib/mobx.umd.js +350 -215
- package/lib/mobx.umd.min.js +2 -2
- package/lib/mobx.umd.min.js.map +1 -1
- package/lib/types/observablearray.d.ts +1 -1
- package/lib/utils/eq.d.ts +1 -0
- package/lib/utils/utils.d.ts +2 -7
- package/package.json +39 -25
package/lib/mobx.js.flow
CHANGED
|
@@ -236,7 +236,7 @@ export interface IValueWillChange<T> {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
export interface IValueDidChange<T> extends IValueWillChange<T> {
|
|
239
|
-
oldValue: T
|
|
239
|
+
oldValue: ?T
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
export interface IObservableValue<T> {
|
|
@@ -270,7 +270,7 @@ export interface IObservableFactory {
|
|
|
270
270
|
(value: null | void): IObservableValue<any>,
|
|
271
271
|
(): IObservableValue<any>,
|
|
272
272
|
<T>(value: IMap<string | number | boolean, T>): ObservableMap<T>,
|
|
273
|
-
<T>(IModifierDescriptor<T>): T,
|
|
273
|
+
<T>(value: IModifierDescriptor<T>): T,
|
|
274
274
|
<T: Object>(value: T): T,
|
|
275
275
|
<T>(value: T): IObservableValue<T>,
|
|
276
276
|
<T>(): IObservableValue<T>,
|
package/lib/mobx.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** MobX - (c) Michel Weststrate 2015, 2016 - MIT Licensed */
|
|
2
|
-
"use strict";function e(e,t){function n(){this.constructor=e}Jt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function t(e){return e.interceptors&&e.interceptors.length>0}function n(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),_e(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function r(e,t){var n=ht();try{var r=e.interceptors;if(r)for(var o=0,i=r.length;o<i&&(t=r[o](t),xe(!t||t.type,"Intercept handlers should return nothing or a change object"),t);o++);return t}finally{dt(n)}}function o(e){return e.changeListeners&&e.changeListeners.length>0}function i(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),_e(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function a(e,t){var n=ht(),r=e.changeListeners;if(r){r=r.slice();for(var o=0,i=r.length;o<i;o++)r[o](t);dt(n)}}function s(){return!!$n.spyListeners.length}function u(e){if($n.spyListeners.length)for(var t=$n.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function c(e){u(je({},e,{spyReportStart:!0}))}function l(e){u(e?je({},e,Xt):Xt)}function p(e){return $n.spyListeners.push(e),_e(function(){var t=$n.spyListeners.indexOf(e);-1!==t&&$n.spyListeners.splice(t,1)})}function f(){return"function"==typeof Symbol&&Symbol.iterator||"@@iterator"}function h(e){xe(!0!==e[Qt],"Illegal state: cannot recycle array as iterator"),Ee(e,Qt,!0);var t=-1;return Ee(e,"next",function(){return t++,{done:t>=this.length,value:t<this.length?this[t]:void 0}}),e}function d(e,t){Ee(e,f(),t)}function v(e,t){void 0!==Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):void 0!==e.prototype.__proto__?e.prototype.__proto__=t:e.prototype=t}function b(e){return{enumerable:!1,configurable:!1,get:function(){return this.get(e)},set:function(t){this.set(e,t)}}}function m(e){Object.defineProperty(on.prototype,""+e,b(e))}function y(e){for(var t=tn;t<e;t++)m(t);tn=e}function g(e){return Ae(e)&&sn(e.$mobx)}function x(e){return pn[e]}function w(e,t){xe("function"==typeof t,x("m026")),xe("string"==typeof e&&e.length>0,"actions should have valid names, got: '"+e+"'");var n=function(){return _(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function _(e,t,n,r){var o=S(e,t,n,r);try{return t.apply(n,r)}finally{O(o)}}function S(e,t,n,r){var o=s()&&!!e,i=0;if(o){i=Date.now();var a=r&&r.length||0,u=new Array(a);if(a>0)for(var l=0;l<a;l++)u[l]=r[l];c({type:"action",name:e,fn:t,object:n,arguments:u})}var p=ht();return Ze(),{prevDerivation:p,prevAllowStateChanges:D(!0),notifySpy:o,startTime:i}}function O(e){k(e.prevAllowStateChanges),et(),dt(e.prevDerivation),e.notifySpy&&l({time:Date.now()-e.startTime})}function A(e){xe(null===$n.trackingDerivation,x("m028")),$n.strictMode=e,$n.allowStateChanges=!e}function I(){return $n.strictMode}function j(e,t){var n,r=D(e);try{n=t()}finally{k(r)}return n}function D(e){var t=$n.allowStateChanges;return $n.allowStateChanges=e,t}function k(e){$n.allowStateChanges=e}function T(e,t,n,r,o){function i(i,a,s,u,c){if(void 0===c&&(c=0),xe(o||R(arguments),"This function is a decorator, but it wasn't invoked like a decorator"),s){De(i,"__mobxLazyInitializers")||Te(i,"__mobxLazyInitializers",i.__mobxLazyInitializers&&i.__mobxLazyInitializers.slice()||[]);var l=s.value,p=s.initializer;return i.__mobxLazyInitializers.push(function(t){e(t,a,p?p.call(t):l,u,s)}),{enumerable:r,configurable:!0,get:function(){return!0!==this.__mobxDidRunLazyInitializers&&V(this),t.call(this,a)},set:function(e){!0!==this.__mobxDidRunLazyInitializers&&V(this),n.call(this,a,e)}}}var f={enumerable:r,configurable:!0,get:function(){return this.__mobxInitializedProps&&!0===this.__mobxInitializedProps[a]||E(this,a,void 0,e,u,s),t.call(this,a)},set:function(t){this.__mobxInitializedProps&&!0===this.__mobxInitializedProps[a]?n.call(this,a,t):E(this,a,t,e,u,s)}};return(arguments.length<3||5===arguments.length&&c<3)&&Object.defineProperty(i,a,f),f}return o?function(){if(R(arguments))return i.apply(null,arguments);var e=arguments,t=arguments.length;return function(n,r,o){return i(n,r,o,e,t)}}:i}function E(e,t,n,r,o,i){De(e,"__mobxInitializedProps")||Te(e,"__mobxInitializedProps",{}),e.__mobxInitializedProps[t]=!0,r(e,t,n,o,i)}function V(e){!0!==e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers&&(Te(e,"__mobxDidRunLazyInitializers",!0),e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers.forEach(function(t){return t(e)}))}function R(e){return(2===e.length||3===e.length)&&"string"==typeof e[1]}function L(e){return function(t,n,r){if(r&&"function"==typeof r.value)return r.value=w(e,r.value),r.enumerable=!1,r.configurable=!0,r;if(void 0!==r&&void 0!==r.get)throw new Error("[mobx] action is not expected to be used with getters");return fn(e).apply(this,arguments)}}function P(e,t,n){var r="string"==typeof e?e:e.name||"<unnamed action>",o="function"==typeof e?e:t,i="function"==typeof e?t:n;return xe("function"==typeof o,x("m002")),xe(0===o.length,x("m003")),xe("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),_(r,o,i,void 0)}function C(e){return"function"==typeof e&&!0===e.isMobxAction}function M(e,t,n){var r=function(){return _(t,n,e,arguments)};r.isMobxAction=!0,Te(e,t,r)}function $(e,t){return e===t}function B(e,t){return Pe(e,t)}function U(e,t){return Me(e,t)||$(e,t)}function N(e,t,n){function r(){i(s)}var o,i,a;"string"==typeof e?(o=e,i=t,a=n):(o=e.name||"Autorun@"+ye(),i=e,a=t),xe("function"==typeof i,x("m004")),xe(!1===C(i),x("m005")),a&&(i=i.bind(a));var s=new Hn(o,function(){this.track(r)});return s.schedule(),s.getDisposer()}function z(e,t,n,r){var o,i,a,s;return"string"==typeof e?(o=e,i=t,a=n,s=r):(o="When@"+ye(),i=e,a=t,s=n),N(o,function(e){if(i.call(s)){e.dispose();var t=ht();a.call(s),dt(t)}})}function G(e,t,n,r){function o(){a(l)}var i,a,s,u;"string"==typeof e?(i=e,a=t,s=n,u=r):(i=e.name||"AutorunAsync@"+ye(),a=e,s=t,u=n),xe(!1===C(a),x("m006")),void 0===s&&(s=1),u&&(a=a.bind(u));var c=!1,l=new Hn(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(o)},s))});return l.schedule(),l.getDisposer()}function H(e,t,n){function r(){if(!c.isDisposed){var n=!1;c.track(function(){var t=e(c);n=a||!u(i,t),i=t}),a&&o.fireImmediately&&t(i,c),a||!0!==n||t(i,c),a&&(a=!1)}}arguments.length>3&&ge(x("m007")),ue(e)&&ge(x("m008"));var o;o="object"==typeof n?n:{},o.name=o.name||e.name||t.name||"Reaction@"+ye(),o.fireImmediately=!0===n||!0===o.fireImmediately,o.delay=o.delay||0,o.compareStructural=o.compareStructural||o.struct||!1,t=dn(o.name,o.context?t.bind(o.context):t),o.context&&(e=e.bind(o.context));var i,a=!0,s=!1,u=o.equals?o.equals:o.compareStructural||o.struct?vn.structural:vn.default,c=new Hn(o.name,function(){a||o.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},o.delay))});return c.schedule(),c.getDisposer()}function K(e,t){if(ee(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;xe(Object.isExtensible(e),x("m035")),Ie(e)||(t=(e.constructor.name||"ObservableObject")+"@"+ye()),t||(t="ObservableObject@"+ye());var n=new yn(e,t);return Ee(e,"$mobx",n),n}function W(e,t,n,r){if(e.values[t]&&!mn(e.values[t]))return xe("value"in n,"The property "+t+" in "+e.name+" is already observable, cannot redefine it as computed property"),void(e.target[t]=n.value);if("value"in n)if(ue(n.value)){var o=n.value;J(e,t,o.initialValue,o.enhancer)}else C(n.value)&&!0===n.value.autoBind?M(e.target,t,n.value.originalFn):mn(n.value)?Y(e,t,n.value):J(e,t,n.value,r);else q(e,t,n.get,n.set,vn.default,!0)}function J(e,n,o,i){if(Re(e.target,n),t(e)){var a=r(e,{object:e.target,name:n,type:"add",newValue:o});if(!a)return;o=a.newValue}o=(e.values[n]=new cn(o,i,e.name+"."+n,!1)).value,Object.defineProperty(e.target,n,F(n)),Z(e,e.target,n,o)}function q(e,t,n,r,o,i){i&&Re(e.target,t),e.values[t]=new bn(n,e.target,o,e.name+"."+t,r),i&&Object.defineProperty(e.target,t,X(t))}function Y(e,t,n){var r=e.name+"."+t;n.name=r,n.scope||(n.scope=e.target),e.values[t]=n,Object.defineProperty(e.target,t,X(t))}function F(e){return gn[e]||(gn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){Q(this,e,t)}})}function X(e){return xn[e]||(xn[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function Q(e,n,i){var u=e.$mobx,p=u.values[n];if(t(u)){var f=r(u,{type:"update",object:e,name:n,newValue:i});if(!f)return;i=f.newValue}if((i=p.prepareNewValue(i))!==un){var h=o(u),d=s(),f=h||d?{type:"update",object:e,oldValue:p.value,name:n,newValue:i}:null;d&&c(f),p.setNewValue(i),h&&a(u,f),d&&l()}}function Z(e,t,n,r){var i=o(e),u=s(),p=i||u?{type:"add",object:t,name:n,newValue:r}:null;u&&c(p),i&&a(e,p),u&&l()}function ee(e){return!!Ae(e)&&(V(e),wn(e.$mobx))}function te(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(g(e)||En(e))throw new Error(x("m019"));if(ee(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return ee(e)||!!e.$mobx||Ft(e)||Jn(e)||mn(e)}function ne(e){return xe(!!e,":("),T(function(t,n,r,o,i){Re(t,n),xe(!i||!i.get,x("m022")),J(K(t,void 0),n,r,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){Q(this,e,t)},!0,!1)}function re(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return ie(e,le,t)}function oe(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return ie(e,fe,t)}function ie(e,t,n){xe(arguments.length>=2,x("m014")),xe("object"==typeof e,x("m015")),xe(!En(e),x("m016")),n.forEach(function(e){xe("object"==typeof e,x("m017")),xe(!te(e),x("m018"))});for(var r=K(e),o={},i=n.length-1;i>=0;i--){var a=n[i];for(var s in a)if(!0!==o[s]&&De(a,s)){if(o[s]=!0,e===a&&!Ve(e,s))continue;var u=Object.getOwnPropertyDescriptor(a,s);W(r,s,u,t)}}return e}function ae(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return _n.apply(null,arguments);if(xe(arguments.length<=1,x("m021")),xe(!ue(e),x("m020")),te(e))return e;var t=le(e,void 0,void 0);return t!==e?t:Dn.box(e)}function se(e){ge("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function ue(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function ce(e,t){return xe(!ue(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function le(e,t,n){return ue(e)&&ge("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),te(e)?e:Array.isArray(e)?Dn.array(e,n):Ie(e)?Dn.object(e,n):Ue(e)?Dn.map(e,n):e}function pe(e,t,n){return ue(e)&&ge("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),void 0===e||null===e?e:ee(e)||g(e)||En(e)?e:Array.isArray(e)?Dn.shallowArray(e,n):Ie(e)?Dn.shallowObject(e,n):Ue(e)?Dn.shallowMap(e,n):ge("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function fe(e){return e}function he(e,t,n){if(Pe(e,t))return t;if(te(e))return e;if(Array.isArray(e))return new on(e,he,n);if(Ue(e))return new Tn(e,he,n);if(Ie(e)){var r={};return K(r,n),ie(r,he,[e]),r}return e}function de(e,t,n){return Pe(e,t)?t:e}function ve(e,t){void 0===t&&(t=void 0),Ze();try{return e.apply(t)}finally{et()}}function be(e){return we("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),Dn.map(e)}function me(){return"undefined"!=typeof window?window:global}function ye(){return++$n.mobxGuid}function ge(e,t){throw xe(!1,e,t),"X"}function xe(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function we(e){return-1===Rn.indexOf(e)&&(Rn.push(e),console.error("[mobx] Deprecated: "+e),!0)}function _e(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function Se(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function Oe(e,t,n){return void 0===t&&(t=100),void 0===n&&(n=" - "),e?e.slice(0,t).join(n)+(e.length>t?" (... and "+(e.length-t)+"more)":""):""}function Ae(e){return null!==e&&"object"==typeof e}function Ie(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function je(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++){var r=arguments[t];for(var o in r)De(r,o)&&(e[o]=r[o])}return e}function De(e,t){return Pn.call(e,t)}function ke(e,t){for(var n=0;n<t.length;n++)Te(e,t[n],e[t[n]])}function Te(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Ee(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Ve(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!n||!1!==n.configurable&&!1!==n.writable}function Re(e,t){xe(Ve(e,t),"Cannot make property '"+t+"' observable, it is not configurable and writable in the target object")}function Le(e){var t=[];for(var n in e)t.push(n);return t}function Pe(e,t){if(null===e&&null===t)return!0;if(void 0===e&&void 0===t)return!0;if(Me(e,t))return!0;if("object"!=typeof e)return e===t;var n=$e(e),r=Be(e);if(n!==$e(t))return!1;if(r!==Be(t))return!1;if(n){if(e.length!==t.length)return!1;for(var o=e.length-1;o>=0;o--)if(!Pe(e[o],t[o]))return!1;return!0}if(r){if(e.size!==t.size)return!1;var i=!0;return e.forEach(function(e,n){i=i&&Pe(t.get(n),e)}),i}if("object"==typeof e&&"object"==typeof t){if(null===e||null===t)return!1;if(Be(e)&&Be(t))return e.size===t.size&&Pe(Dn.shallowMap(e).entries(),Dn.shallowMap(t).entries());if(Le(e).length!==Le(t).length)return!1;for(var a in e){if(!(a in t))return!1;if(!Pe(e[a],t[a]))return!1}return!0}return!1}function Ce(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return Ae(e)&&!0===e[n]}}function Me(e,t){return"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}function $e(e){return Array.isArray(e)||g(e)}function Be(e){return Ue(e)||En(e)}function Ue(e){return void 0!==me().Map&&e instanceof me().Map}function Ne(e){var t;return Ie(e)?t=Object.keys(e):Array.isArray(e)?t=e.map(function(e){return e[0]}):Be(e)?t=Array.from(e.keys()):ge("Cannot get keys from "+e),t}function ze(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function Ge(e){return null===e?null:"object"==typeof e?""+e:e}function He(){Un=!0,me().__mobxInstanceCount--}function Ke(){we("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."),Bn=!0;var e=me(),t=$n;if(e.__mobservableTrackingStack||e.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(e.__mobxGlobal&&e.__mobxGlobal.version!==t.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");e.__mobxGlobal?$n=e.__mobxGlobal:e.__mobxGlobal=t}function We(){return $n}function Je(){$n.resetId++;var e=new Mn;for(var t in e)-1===Cn.indexOf(t)&&($n[t]=e[t]);$n.allowStateChanges=!$n.strictMode}function qe(e){return e.observers&&e.observers.length>0}function Ye(e){return e.observers}function Fe(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function Xe(e,t){if(1===e.observers.length)e.observers.length=0,Qe(e);else{var n=e.observers,r=e.observersIndexes,o=n.pop();if(o!==t){var i=r[t.__mapid]||0;i?r[o.__mapid]=i:delete r[o.__mapid],n[i]=o}delete r[t.__mapid]}}function Qe(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,$n.pendingUnobservations.push(e))}function Ze(){$n.inBatch++}function et(){if(0==--$n.inBatch){yt();for(var e=$n.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers.length&&n.onBecomeUnobserved()}$n.pendingUnobservations=[]}}function tt(e){var t=$n.trackingDerivation;null!==t?t.runId!==e.lastAccessedBy&&(e.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=e):0===e.observers.length&&Qe(e)}function nt(e){if(e.lowestObserverState!==exports.IDerivationState.STALE){e.lowestObserverState=exports.IDerivationState.STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===exports.IDerivationState.UP_TO_DATE&&r.onBecomeStale(),r.dependenciesState=exports.IDerivationState.STALE}}}function rt(e){if(e.lowestObserverState!==exports.IDerivationState.STALE){e.lowestObserverState=exports.IDerivationState.STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===exports.IDerivationState.POSSIBLY_STALE?r.dependenciesState=exports.IDerivationState.STALE:r.dependenciesState===exports.IDerivationState.UP_TO_DATE&&(e.lowestObserverState=exports.IDerivationState.UP_TO_DATE)}}}function ot(e){if(e.lowestObserverState===exports.IDerivationState.UP_TO_DATE){e.lowestObserverState=exports.IDerivationState.POSSIBLY_STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===exports.IDerivationState.UP_TO_DATE&&(r.dependenciesState=exports.IDerivationState.POSSIBLY_STALE,r.onBecomeStale())}}}function it(e){return e instanceof Gn}function at(e){switch(e.dependenciesState){case exports.IDerivationState.UP_TO_DATE:return!1;case exports.IDerivationState.NOT_TRACKING:case exports.IDerivationState.STALE:return!0;case exports.IDerivationState.POSSIBLY_STALE:for(var t=ht(),n=e.observing,r=n.length,o=0;o<r;o++){var i=n[o];if(mn(i)){try{i.get()}catch(e){return dt(t),!0}if(e.dependenciesState===exports.IDerivationState.STALE)return dt(t),!0}}return vt(e),dt(t),!1}}function st(){return null!==$n.trackingDerivation}function ut(e){var t=e.observers.length>0;$n.computationDepth>0&&t&&ge(x("m031")+e.name),!$n.allowStateChanges&&t&&ge(x($n.strictMode?"m030a":"m030b")+e.name)}function ct(e,t,n){vt(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++$n.runId;var r=$n.trackingDerivation;$n.trackingDerivation=e;var o;try{o=t.call(n)}catch(e){o=new Gn(e)}return $n.trackingDerivation=r,lt(e),o}function lt(e){for(var t=e.observing,n=e.observing=e.newObserving,r=exports.IDerivationState.UP_TO_DATE,o=0,i=e.unboundDepsCount,a=0;a<i;a++){var s=n[a];0===s.diffValue&&(s.diffValue=1,o!==a&&(n[o]=s),o++),s.dependenciesState>r&&(r=s.dependenciesState)}for(n.length=o,e.newObserving=null,i=t.length;i--;){var s=t[i];0===s.diffValue&&Xe(s,e),s.diffValue=0}for(;o--;){var s=n[o];1===s.diffValue&&(s.diffValue=0,Fe(s,e))}r!==exports.IDerivationState.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}function pt(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)Xe(t[n],e);e.dependenciesState=exports.IDerivationState.NOT_TRACKING}function ft(e){var t=ht(),n=e();return dt(t),n}function ht(){var e=$n.trackingDerivation;return $n.trackingDerivation=null,e}function dt(e){$n.trackingDerivation=e}function vt(e){if(e.dependenciesState!==exports.IDerivationState.UP_TO_DATE){e.dependenciesState=exports.IDerivationState.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=exports.IDerivationState.UP_TO_DATE}}function bt(e){xe(this&&this.$mobx&&Jn(this.$mobx),"Invalid `this`"),xe(!this.$mobx.errorHandler,"Only one onErrorHandler can be registered"),this.$mobx.errorHandler=e}function mt(e){return $n.globalReactionErrorHandlers.push(e),function(){var t=$n.globalReactionErrorHandlers.indexOf(e);t>=0&&$n.globalReactionErrorHandlers.splice(t,1)}}function yt(){$n.inBatch>0||$n.isRunningReactions||Wn(gt)}function gt(){$n.isRunningReactions=!0;for(var e=$n.pendingReactions,t=0;e.length>0;){++t===Kn&&(console.error("Reaction doesn't converge to a stable state after "+Kn+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,o=n.length;r<o;r++)n[r].runReaction()}$n.isRunningReactions=!1}function xt(e){var t=Wn;Wn=function(n){return e(function(){return t(n)})}}function wt(e){return we("asReference is deprecated, use observable.ref instead"),Dn.ref(e)}function _t(e){return we("asStructure is deprecated. Use observable.struct, computed.struct or reaction options instead."),Dn.struct(e)}function St(e){return we("asFlat is deprecated, use observable.shallow instead"),Dn.shallow(e)}function Ot(e){return we("asMap is deprecated, use observable.map or observable.shallowMap instead"),Dn.map(e||{})}function At(e){return T(function(t,n,r,o,i){xe(void 0!==i,x("m009")),xe("function"==typeof i.get,x("m010")),q(K(t,""),n,i.get,i.set,e,!1)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){this.$mobx.values[e].set(t)},!1,!1)}function It(e,t){if("object"==typeof e&&null!==e){if(g(e))return xe(void 0===t,x("m036")),e.$mobx.atom;if(En(e)){var n=e;if(void 0===t)return It(n._keys);var r=n._data[t]||n._hasMap[t];return xe(!!r,"the entry '"+t+"' does not exist in the observable map '"+Dt(e)+"'"),r}if(V(e),t&&!e.$mobx&&e[t],ee(e)){if(!t)return ge("please specify a property");var r=e.$mobx.values[t];return xe(!!r,"no observable property '"+t+"' found on the observable object '"+Dt(e)+"'"),r}if(Ft(e)||mn(e)||Jn(e))return e}else if("function"==typeof e&&Jn(e.$mobx))return e.$mobx;return ge("Cannot obtain atom from "+e)}function jt(e,t){return xe(e,"Expecting some object"),void 0!==t?jt(It(e,t)):Ft(e)||mn(e)||Jn(e)?e:En(e)?e:(V(e),e.$mobx?e.$mobx:void xe(!1,"Cannot obtain administration from "+e))}function Dt(e,t){var n;return n=void 0!==t?It(e,t):ee(e)||En(e)?jt(e):It(e),n.name}function kt(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(!1===ee(e))return!1;if(!e.$mobx.values[t])return!1;var n=It(e,t);return mn(n)}return mn(e)}function Tt(e,t,n,r){return"function"==typeof n?Vt(e,t,n,r):Et(e,t,n)}function Et(e,t,n){return jt(e).observe(t,n)}function Vt(e,t,n,r){return jt(e,t).observe(n,r)}function Rt(e,t,n){return"function"==typeof n?Pt(e,t,n):Lt(e,t)}function Lt(e,t){return jt(e).intercept(t)}function Pt(e,t,n){return jt(e,t).intercept(n)}function Ct(e,t){return st()||console.warn(x("m013")),Fn(e,{context:t}).get()}function Mt(e,t,n){function r(r){return t&&n.push([e,r]),r}if(void 0===t&&(t=!0),void 0===n&&(n=[]),te(e)){if(t&&null===n&&(n=[]),t&&null!==e&&"object"==typeof e)for(var o=0,i=n.length;o<i;o++)if(n[o][0]===e)return n[o][1];if(g(e)){var a=r([]),s=e.map(function(e){return Mt(e,t,n)});a.length=s.length;for(var o=0,i=s.length;o<i;o++)a[o]=s[o];return a}if(ee(e)){var a=r({});for(var u in e)a[u]=Mt(e[u],t,n);return a}if(En(e)){var c=r({});return e.forEach(function(e,r){return c[r]=Mt(e,t,n)}),c}if(ln(e))return Mt(e.get(),t,n)}return e}function $t(t,n){xe("function"==typeof t&&t.length<2,"createTransformer expects a function that accepts one argument");var r={},o=$n.resetId,i=function(o){function i(e,n){var r=o.call(this,function(){return t(n)},void 0,vn.default,"Transformer-"+t.name+"-"+e,void 0)||this;return r.sourceIdentifier=e,r.sourceObject=n,r}return e(i,o),i.prototype.onBecomeUnobserved=function(){var e=this.value;o.prototype.onBecomeUnobserved.call(this),delete r[this.sourceIdentifier],n&&n(e,this.sourceObject)},i}(bn);return function(e){o!==$n.resetId&&(r={},o=$n.resetId);var t=Bt(e),n=r[t];return n?n.get():(n=r[t]=new i(t,e),n.get())}}function Bt(e){if("string"==typeof e||"number"==typeof e)return e;if(null===e||"object"!=typeof e)throw new Error("[mobx] transform expected some kind of object or primitive value, got: "+e);var t=e.$transformId;return void 0===t&&(t=ye(),Te(e,"$transformId",t)),t}function Ut(e){return console.log(e),e}function Nt(e,t){switch(arguments.length){case 0:if(!(e=$n.trackingDerivation))return Ut(x("m024"));break;case 2:e=It(e,t)}return e=It(e),mn(e)?Ut(e.whyRun()):Jn(e)?Ut(e.whyRun()):ge(x("m025"))}function zt(e,t){return Gt(It(e,t))}function Gt(e){var t={name:e.name};return e.observing&&e.observing.length>0&&(t.dependencies=Se(e.observing).map(Gt)),t}function Ht(e,t){return Kt(It(e,t))}function Kt(e){var t={name:e.name};return qe(e)&&(t.observers=Ye(e).map(Kt)),t}function Wt(e,t,n){var r;if(En(e)||g(e)||ln(e))r=jt(e);else{if(!ee(e))return ge("Expected observable map, object or array as first array");if("string"!=typeof t)return ge("InterceptReads can only be used with a specific property, not with an object in general");r=jt(e,t)}return void 0!==r.dehancer?ge("An intercept reader was already established"):(r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0})}Object.defineProperty(exports,"__esModule",{value:!0});var Jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},qt=function(){function e(e){void 0===e&&(e="Atom@"+ye()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=exports.IDerivationState.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){tt(this)},e.prototype.reportChanged=function(){Ze(),nt(this),et()},e.prototype.toString=function(){return this.name},e}(),Yt=function(t){function n(e,n,r){void 0===e&&(e="Atom@"+ye()),void 0===n&&(n=Ln),void 0===r&&(r=Ln);var o=t.call(this,e)||this;return o.name=e,o.onBecomeObservedHandler=n,o.onBecomeUnobservedHandler=r,o.isPendingUnobservation=!1,o.isBeingTracked=!1,o}return e(n,t),n.prototype.reportObserved=function(){return Ze(),t.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),et(),!!$n.trackingDerivation},n.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},n}(qt),Ft=Ce("Atom",qt),Xt={spyReportEnd:!0},Qt="__$$iterating",Zt=1e4,en=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),tn=0,nn=function(){function e(){}return e}();v(nn,Array.prototype),Object.isFrozen(Array)&&["constructor","push","shift","concat","pop","unshift","replace","find","findIndex","splice","reverse","sort"].forEach(function(e){Object.defineProperty(nn.prototype,e,{configurable:!0,writable:!0,value:Array.prototype[e]})});var rn=function(){function e(e,t,n,r){this.array=n,this.owned=r,this.values=[],this.lastKnownLength=0,this.interceptors=null,this.changeListeners=null,this.atom=new qt(e||"ObservableArray@"+ye()),this.enhancer=function(n,r){return t(n,r,e+"[..]")}}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.dehanceValues=function(e){return void 0!==this.dehancer?e.map(this.dehancer):e},e.prototype.intercept=function(e){return n(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),i(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r<e-t;r++)n[r]=void 0;this.spliceWithArray(t,0,n)}else this.spliceWithArray(e,t-e)},e.prototype.updateArrayLength=function(e,t){if(e!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?");this.lastKnownLength+=t,t>0&&e+t+1>tn&&y(e+t+1)},e.prototype.spliceWithArray=function(e,n,o){var i=this;ut(this.atom);var a=this.values.length;if(void 0===e?e=0:e>a?e=a:e<0&&(e=Math.max(0,a+e)),n=1===arguments.length?a-e:void 0===n||null===n?0:Math.max(0,Math.min(n,a-e)),void 0===o&&(o=[]),t(this)){var s=r(this,{object:this.array,type:"splice",index:e,removedCount:n,added:o});if(!s)return Vn;n=s.removedCount,o=s.added}o=o.map(function(e){return i.enhancer(e,void 0)});var u=o.length-n;this.updateArrayLength(a,u);var c=this.spliceItemsIntoValues(e,n,o);return 0===n&&0===o.length||this.notifyArraySplice(e,o,c),this.dehanceValues(c)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<Zt)return(o=this.values).splice.apply(o,[e,t].concat(n));var r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r;var o},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&s(),i=o(this),u=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&c(u),this.atom.reportChanged(),i&&a(this,u),r&&l()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&s(),i=o(this),u=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&c(u),this.atom.reportChanged(),i&&a(this,u),r&&l()},e}(),on=function(n){function o(e,t,r,o){void 0===r&&(r="ObservableArray@"+ye()),void 0===o&&(o=!1);var i=n.call(this)||this,a=new rn(r,t,i,o);return Ee(i,"$mobx",a),e&&e.length&&i.spliceWithArray(0,0,e),en&&Object.defineProperty(a.array,"0",an),i}return e(o,n),o.prototype.intercept=function(e){return this.$mobx.intercept(e)},o.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},o.prototype.clear=function(){return this.splice(0)},o.prototype.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.$mobx.atom.reportObserved(),Array.prototype.concat.apply(this.peek(),e.map(function(e){return g(e)?e.peek():e}))},o.prototype.replace=function(e){return this.$mobx.spliceWithArray(0,this.$mobx.values.length,e)},o.prototype.toJS=function(){return this.slice()},o.prototype.toJSON=function(){return this.toJS()},o.prototype.peek=function(){return this.$mobx.atom.reportObserved(),this.$mobx.dehanceValues(this.$mobx.values)},o.prototype.find=function(e,t,n){void 0===n&&(n=0);var r=this.findIndex.apply(this,arguments);return-1===r?void 0:this.get(r)},o.prototype.findIndex=function(e,t,n){void 0===n&&(n=0);for(var r=this.peek(),o=r.length,i=n;i<o;i++)if(e.call(t,r[i],i,this))return i;return-1},o.prototype.splice=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];switch(arguments.length){case 0:return[];case 1:return this.$mobx.spliceWithArray(e);case 2:return this.$mobx.spliceWithArray(e,t)}return this.$mobx.spliceWithArray(e,t,n)},o.prototype.spliceWithArray=function(e,t,n){return this.$mobx.spliceWithArray(e,t,n)},o.prototype.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.$mobx;return n.spliceWithArray(n.values.length,0,e),n.values.length},o.prototype.pop=function(){return this.splice(Math.max(this.$mobx.values.length-1,0),1)[0]},o.prototype.shift=function(){return this.splice(0,1)[0]},o.prototype.unshift=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.$mobx;return n.spliceWithArray(0,0,e),n.values.length},o.prototype.reverse=function(){var e=this.slice();return e.reverse.apply(e,arguments)},o.prototype.sort=function(e){var t=this.slice();return t.sort.apply(t,arguments)},o.prototype.remove=function(e){var t=this.$mobx.dehanceValues(this.$mobx.values).indexOf(e);return t>-1&&(this.splice(t,1),!0)},o.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,o=this.$mobx.values;r=e<t?o.slice(0,e).concat(o.slice(e+1,t+1),[o[e]],o.slice(t+1)):o.slice(0,t).concat([o[e]],o.slice(t,e),o.slice(e+1)),this.replace(r)}},o.prototype.get=function(e){var t=this.$mobx;if(t){if(e<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[e]);console.warn("[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+t.values.length+"). Please check length first. Out of bound indices will not be tracked by MobX")}},o.prototype.set=function(e,n){var o=this.$mobx,i=o.values;if(e<i.length){ut(o.atom);var a=i[e];if(t(o)){var s=r(o,{type:"update",object:this,index:e,newValue:n});if(!s)return;n=s.newValue}n=o.enhancer(n,a);n!==a&&(i[e]=n,o.notifyArrayChildUpdate(e,n,a))}else{
|
|
3
|
-
if(e!==i.length)throw new Error("[mobx.array] Index out of bounds, "+e+" is larger than "+i.length);o.spliceWithArray(e,0,[n])}},o}(nn);d(on.prototype,function(){return h(this.slice())}),Object.defineProperty(on.prototype,"length",{enumerable:!1,configurable:!0,get:function(){return this.$mobx.getArrayLength()},set:function(e){this.$mobx.setArrayLength(e)}}),["every","filter","forEach","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some","toString","toLocaleString"].forEach(function(e){var t=Array.prototype[e];xe("function"==typeof t,"Base function not defined on Array prototype: '"+e+"'"),Te(on.prototype,e,function(){return t.apply(this.peek(),arguments)})}),ke(on.prototype,["constructor","intercept","observe","clear","concat","get","replace","toJS","toJSON","peek","find","findIndex","splice","spliceWithArray","push","pop","set","shift","unshift","reverse","sort","remove","move","toString","toLocaleString"]);var an=b(0);y(1e3);var sn=Ce("ObservableArrayAdministration",rn),un={},cn=function(p){function f(e,t,n,r){void 0===n&&(n="ObservableValue@"+ye()),void 0===r&&(r=!0);var o=p.call(this,n)||this;return o.enhancer=t,o.hasUnreportedChange=!1,o.dehancer=void 0,o.value=t(e,void 0,n),r&&s()&&u({type:"create",object:o,newValue:o.value}),o}return e(f,p),f.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},f.prototype.set=function(e){var t=this.value;if((e=this.prepareNewValue(e))!==un){var n=s();n&&c({type:"update",object:this,newValue:e,oldValue:t}),this.setNewValue(e),n&&l()}},f.prototype.prepareNewValue=function(e){if(ut(this),t(this)){var n=r(this,{object:this,type:"update",newValue:e});if(!n)return un;e=n.newValue}return e=this.enhancer(e,this.value,this.name),this.value!==e?e:un},f.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),o(this)&&a(this,{type:"update",object:this,newValue:e,oldValue:t})},f.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},f.prototype.intercept=function(e){return n(this,e)},f.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),i(this,e)},f.prototype.toJSON=function(){return this.get()},f.prototype.toString=function(){return this.name+"["+this.value+"]"},f.prototype.valueOf=function(){return Ge(this.get())},f}(qt);cn.prototype[ze()]=cn.prototype.valueOf;var ln=Ce("ObservableValue",cn),pn={m001:"It is not allowed to assign new values to @action fields",m002:"`runInAction` expects a function",m003:"`runInAction` expects a function without arguments",m004:"autorun expects a function",m005:"Warning: attempted to pass an action to autorun. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.",m006:"Warning: attempted to pass an action to autorunAsync. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.",m007:"reaction only accepts 2 or 3 arguments. If migrating from MobX 2, please provide an options object",m008:"wrapping reaction expression in `asReference` is no longer supported, use options object instead",m009:"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'. It looks like it was used on a property.",m010:"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'",m011:"First argument to `computed` should be an expression. If using computed as decorator, don't pass it arguments",m012:"computed takes one or two arguments if used as function",m013:"[mobx.expr] 'expr' should only be used inside other reactive functions.",m014:"extendObservable expected 2 or more arguments",m015:"extendObservable expects an object as first argument",m016:"extendObservable should not be used on maps, use map.merge instead",m017:"all arguments of extendObservable should be objects",m018:"extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540",m019:"[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.",m020:"modifiers can only be used for individual object properties",m021:"observable expects zero or one arguments",m022:"@observable can not be used on getters, use @computed instead",m024:"whyRun() can only be used if a derivation is active, or by passing an computed value / reaction explicitly. If you invoked whyRun from inside a computation; the computation is currently suspended but re-evaluating because somebody requested its value.",m025:"whyRun can only be used on reactions and computed values",m026:"`action` can only be invoked on functions",m028:"It is not allowed to set `useStrict` when a derivation is running",m029:"INTERNAL ERROR only onBecomeUnobserved shouldn't be called twice in a row",m030a:"Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: ",m030b:"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ",m031:"Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: ",m032:"* This computation is suspended (not in use by any reaction) and won't run automatically.\n\tDidn't expect this computation to be suspended at this point?\n\t 1. Make sure this computation is used by a reaction (reaction, autorun, observer).\n\t 2. Check whether you are using this computation synchronously (in the same stack as they reaction that needs it).",m033:"`observe` doesn't support the fire immediately property for observable maps.",m034:"`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead",m035:"Cannot make the designated object observable; it is not extensible",m036:"It is not possible to get index atoms from arrays",m037:'Hi there! I\'m sorry you have just run into an exception.\nIf your debugger ends up here, know that some reaction (like the render() of an observer component, autorun or reaction)\nthrew an exception and that mobx caught it, to avoid that it brings the rest of your application down.\nThe original cause of the exception (the code that caused this reaction to run (again)), is still in the stack.\n\nHowever, more interesting is the actual stack trace of the error itself.\nHopefully the error is an instanceof Error, because in that case you can inspect the original stack of the error from where it was thrown.\nSee `error.stack` property, or press the very subtle "(...)" link you see near the console.error message that probably brought you here.\nThat stack is more interesting than the stack of this console.error itself.\n\nIf the exception you see is an exception you created yourself, make sure to use `throw new Error("Oops")` instead of `throw "Oops"`,\nbecause the javascript environment will only preserve the original stack trace in the first form.\n\nYou can also make sure the debugger pauses the next time this very same exception is thrown by enabling "Pause on caught exception".\n(Note that it might pause on many other, unrelated exception as well).\n\nIf that all doesn\'t help you out, feel free to open an issue https://github.com/mobxjs/mobx/issues!\n',m038:"Missing items in this list?\n 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n"},fn=T(function(e,t,n,r,o){var i=r&&1===r.length?r[0]:n.name||t||"<unnamed action>";Te(e,t,dn(i,n))},function(e){return this[e]},function(){xe(!1,x("m001"))},!1,!0),hn=T(function(e,t,n){M(e,t,n)},function(e){return this[e]},function(){xe(!1,x("m001"))},!1,!1),dn=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?w(e.name||"<unnamed action>",e):2===arguments.length&&"function"==typeof t?w(e,t):1===arguments.length&&"string"==typeof e?L(e):L(t).apply(null,arguments)};dn.bound=function(e,t,n){if("function"==typeof e){var r=w("<not yet bound action>",e);return r.autoBind=!0,r}return hn.apply(null,arguments)};var vn={identity:$,structural:B,default:U},bn=function(){function e(e,t,n,r,o){this.derivation=e,this.scope=t,this.equals=n,this.dependenciesState=exports.IDerivationState.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=exports.IDerivationState.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+ye(),this.value=new Gn(null),this.isComputing=!1,this.isRunningSetter=!1,this.name=r||"ComputedValue@"+ye(),o&&(this.setter=w(r+"-setter",o))}return e.prototype.onBecomeStale=function(){ot(this)},e.prototype.onBecomeUnobserved=function(){pt(this),this.value=void 0},e.prototype.get=function(){xe(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===$n.inBatch?(Ze(),at(this)&&(this.value=this.computeValue(!1)),et()):(tt(this),at(this)&&this.trackAndCompute()&&rt(this));var e=this.value;if(it(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(it(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){xe(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else xe(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){s()&&u({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===exports.IDerivationState.NOT_TRACKING,n=this.value=this.computeValue(!0);return t||it(e)||it(n)||!this.equals(e,n)},e.prototype.computeValue=function(e){this.isComputing=!0,$n.computationDepth++;var t;if(e)t=ct(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Gn(e)}return $n.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,r=!0,o=void 0;return N(function(){var i=n.get();if(!r||t){var a=ht();e({type:"update",object:n,newValue:i,oldValue:o}),dt(a)}r=!1,o=i})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return Ge(this.get())},e.prototype.whyRun=function(){var e=Boolean($n.trackingDerivation),t=Se(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=Se(Ye(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===exports.IDerivationState.NOT_TRACKING?x("m032"):" * This computation will re-run if any of the following observables changes:\n "+Oe(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n "+x("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+Oe(n)+"\n")},e}();bn.prototype[ze()]=bn.prototype.valueOf;var mn=Ce("ComputedValue",bn),yn=function(){function e(e,t){this.target=e,this.name=t,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return xe(!0!==t,"`observe` doesn't support the fire immediately property for observable objects."),i(this,e)},e.prototype.intercept=function(e){return n(this,e)},e}(),gn={},xn={},wn=Ce("ObservableObjectAdministration",yn),_n=ne(le),Sn=ne(pe),On=ne(fe),An=ne(he),In=ne(de),jn={box:function(e,t){return arguments.length>2&&se("box"),new cn(e,le,t)},shallowBox:function(e,t){return arguments.length>2&&se("shallowBox"),new cn(e,fe,t)},array:function(e,t){return arguments.length>2&&se("array"),new on(e,le,t)},shallowArray:function(e,t){return arguments.length>2&&se("shallowArray"),new on(e,fe,t)},map:function(e,t){return arguments.length>2&&se("map"),new Tn(e,le,t)},shallowMap:function(e,t){return arguments.length>2&&se("shallowMap"),new Tn(e,fe,t)},object:function(e,t){arguments.length>2&&se("object");var n={};return K(n,t),re(n,e),n},shallowObject:function(e,t){arguments.length>2&&se("shallowObject");var n={};return K(n,t),oe(n,e),n},ref:function(){return arguments.length<2?ce(fe,arguments[0]):On.apply(null,arguments)},shallow:function(){return arguments.length<2?ce(pe,arguments[0]):Sn.apply(null,arguments)},deep:function(){return arguments.length<2?ce(le,arguments[0]):_n.apply(null,arguments)},struct:function(){return arguments.length<2?ce(he,arguments[0]):An.apply(null,arguments)}},Dn=ae;Object.keys(jn).forEach(function(e){return Dn[e]=jn[e]}),Dn.deep.struct=Dn.struct,Dn.ref.struct=function(){return arguments.length<2?ce(de,arguments[0]):In.apply(null,arguments)};var kn={},Tn=function(){function e(e,t,n){void 0===t&&(t=le),void 0===n&&(n="ObservableMap@"+ye()),this.enhancer=t,this.name=n,this.$mobx=kn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new on(void 0,fe,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(e)}return e.prototype._has=function(e){return void 0!==this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,n){this.assertValidKey(e),e=""+e;var o=this._has(e);if(t(this)){var i=r(this,{type:o?"update":"add",object:this,newValue:n,name:e});if(!i)return this;n=i.newValue}return o?this._updateValue(e,n):this._addValue(e,n),this},e.prototype.delete=function(e){var n=this;if(this.assertValidKey(e),e=""+e,t(this)){var i=r(this,{type:"delete",object:this,name:e});if(!i)return!1}if(this._has(e)){var u=s(),p=o(this),i=p||u?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return u&&c(i),ve(function(){n._keys.remove(e),n._updateHasMapEntry(e,!1),n._data[e].setNewValue(void 0),n._data[e]=void 0}),p&&a(this,i),u&&l(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new cn(t,fe,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==un){var r=s(),i=o(this),u=i||r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;r&&c(u),n.setNewValue(t),i&&a(this,u),r&&l()}},e.prototype._addValue=function(e,t){var n=this;ve(function(){var r=n._data[e]=new cn(t,n.enhancer,n.name+"."+e,!1);t=r.value,n._updateHasMapEntry(e,!0),n._keys.push(e)});var r=s(),i=o(this),u=i||r?{type:"add",object:this,name:e,newValue:t}:null;r&&c(u),i&&a(this,u),r&&l()},e.prototype.get=function(e){return e=""+e,this.has(e)?this.dehanceValue(this._data[e].get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return h(this._keys.slice())},e.prototype.values=function(){return h(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return h(this._keys.map(function(t){return[t,e.get(t)]}))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach(function(r){return e.call(t,n.get(r),r,n)})},e.prototype.merge=function(e){var t=this;return En(e)&&(e=e.toJS()),ve(function(){Ie(e)?Object.keys(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],r=e[1];return t.set(n,r)}):Ue(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&ge("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;ve(function(){ft(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return ve(function(){var n=Ne(e);t.keys().filter(function(e){return-1===n.indexOf(e)}).forEach(function(e){return t.delete(e)}),t.merge(e)}),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach(function(n){return t[n]=e.get(n)}),t},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!==e&&void 0!==e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"', only strings, numbers and booleans are accepted as key in observable maps.")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map(function(t){return t+": "+e.get(t)}).join(", ")+" }]"},e.prototype.observe=function(e,t){return xe(!0!==t,x("m033")),i(this,e)},e.prototype.intercept=function(e){return n(this,e)},e}();d(Tn.prototype,function(){return this.entries()});var En=Ce("ObservableMap",Tn),Vn=[];Object.freeze(Vn);var Rn=[],Ln=function(){},Pn=Object.prototype.hasOwnProperty,Cn=["mobxGuid","resetId","spyListeners","strictMode","runId"],Mn=function(){function e(){this.version=5,this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[],this.globalReactionErrorHandlers=[]}return e}(),$n=new Mn,Bn=!1,Un=!1,Nn=!1,zn=me();zn.__mobxInstanceCount?(zn.__mobxInstanceCount++,setTimeout(function(){Bn||Un||Nn||(Nn=!0,console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."))})):zn.__mobxInstanceCount=1,function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(exports.IDerivationState||(exports.IDerivationState={}));var Gn=function(){function e(e){this.cause=e}return e}(),Hn=function(){function e(e,t){void 0===e&&(e="Reaction@"+ye()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=exports.IDerivationState.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+ye(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,$n.pendingReactions.push(this),yt())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(Ze(),this._isScheduled=!1,at(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&s()&&u({object:this,type:"scheduled-reaction"})),et())},e.prototype.track=function(e){Ze();var t,n=s();n&&(t=Date.now(),c({object:this,type:"reaction",fn:e})),this._isRunning=!0;var r=ct(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&pt(this),it(r)&&this.reportExceptionInDerivation(r.cause),n&&l({time:Date.now()-t}),et()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)return void this.errorHandler(e,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,r=x("m037");console.error(n||r,e),s()&&u({type:"error",message:n,error:e,object:this}),$n.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(Ze(),pt(this),et()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=bt,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=Se(this._isRunning?this.newObserving:this.observing).map(function(e){return e.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+Oe(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+x("m038")+"\n"},e}(),Kn=100,Wn=function(e){return e()},Jn=Ce("Reaction",Hn),qn=At(vn.default),Yn=At(vn.structural),Fn=function(e,t,n){if("string"==typeof t)return qn.apply(null,arguments);xe("function"==typeof e,x("m011")),xe(arguments.length<3,x("m012"));var r="object"==typeof t?t:{};r.setter="function"==typeof t?t:r.setter;var o=r.equals?r.equals:r.compareStructural||r.struct?vn.structural:vn.default;return new bn(e,r.context,o,r.name||e.name||"",r.setter)};Fn.struct=Yn,Fn.equals=At;var Xn={allowStateChanges:j,deepEqual:Pe,getAtom:It,getDebugName:Dt,getDependencyTree:zt,getAdministration:jt,getGlobalState:We,getObserverTree:Ht,interceptReads:Wt,isComputingDerivation:st,isSpyEnabled:s,onReactionError:mt,reserveArrayBuffer:y,resetGlobalState:Je,isolateGlobalState:He,shareGlobalState:Ke,spyReport:u,spyReportEnd:l,spyReportStart:c,setReactionScheduler:xt},Qn={Reaction:Hn,untracked:ft,Atom:Yt,BaseAtom:qt,useStrict:A,isStrictModeEnabled:I,spy:p,comparer:vn,asReference:wt,asFlat:St,asStructure:_t,asMap:Ot,isModifierDescriptor:ue,isObservableObject:ee,isBoxedObservable:ln,isObservableArray:g,ObservableMap:Tn,isObservableMap:En,map:be,transaction:ve,observable:Dn,computed:Fn,isObservable:te,isComputed:kt,extendObservable:re,extendShallowObservable:oe,observe:Tt,intercept:Rt,autorun:N,autorunAsync:G,when:z,reaction:H,action:dn,isAction:C,runInAction:P,expr:Ct,toJS:Mt,createTransformer:$t,whyRun:Nt,isArrayLike:$e,extras:Xn},Zn=!1,er=function(e){var t=Qn[e];Object.defineProperty(Qn,e,{get:function(){return Zn||(Zn=!0,console.warn("Using default export (`import mobx from 'mobx'`) is deprecated and won’t work in mobx@4.0.0\nUse `import * as mobx from 'mobx'` instead")),t}})};for(var tr in Qn)er(tr);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:p,extras:Xn}),exports.extras=Xn,exports.default=Qn,exports.Reaction=Hn,exports.untracked=ft,exports.Atom=Yt,exports.BaseAtom=qt,exports.useStrict=A,exports.isStrictModeEnabled=I,exports.spy=p,exports.comparer=vn,exports.asReference=wt,exports.asFlat=St,exports.asStructure=_t,exports.asMap=Ot,exports.isModifierDescriptor=ue,exports.isObservableObject=ee,exports.isBoxedObservable=ln,exports.isObservableArray=g,exports.ObservableMap=Tn,exports.isObservableMap=En,exports.map=be,exports.transaction=ve,exports.observable=Dn,exports.computed=Fn,exports.isObservable=te,exports.isComputed=kt,exports.extendObservable=re,exports.extendShallowObservable=oe,exports.observe=Tt,exports.intercept=Rt,exports.autorun=N,exports.autorunAsync=G,exports.when=z,exports.reaction=H,exports.action=dn,exports.isAction=C,exports.runInAction=P,exports.expr=Ct,exports.toJS=Mt,exports.createTransformer=$t,exports.whyRun=Nt,exports.isArrayLike=$e;
|
|
2
|
+
"use strict";function e(e,t){function n(){this.constructor=e}en(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function t(e){return e.interceptors&&e.interceptors.length>0}function n(e,t){var n=e.interceptors||(e.interceptors=[]);return n.push(t),je(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function r(e,t){var n=At();try{var r=e.interceptors;if(r)for(var o=0,i=r.length;o<i&&(t=r[o](t),Ae(!t||t.type,"Intercept handlers should return nothing or a change object"),t);o++);return t}finally{It(n)}}function o(e){return e.changeListeners&&e.changeListeners.length>0}function i(e,t){var n=e.changeListeners||(e.changeListeners=[]);return n.push(t),je(function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)})}function a(e,t){var n=At(),r=e.changeListeners;if(r){r=r.slice();for(var o=0,i=r.length;o<i;o++)r[o](t);It(n)}}function s(){return!!Wn.spyListeners.length}function u(e){if(Wn.spyListeners.length)for(var t=Wn.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function c(e){u(Re({},e,{spyReportStart:!0}))}function l(e){u(e?Re({},e,on):on)}function p(e){return Wn.spyListeners.push(e),je(function(){var t=Wn.spyListeners.indexOf(e);-1!==t&&Wn.spyListeners.splice(t,1)})}function f(){return"function"==typeof Symbol&&Symbol.iterator||"@@iterator"}function h(e){Ae(!0!==e[an],"Illegal state: cannot recycle array as iterator"),Ce(e,an,!0);var t=-1;return Ce(e,"next",function(){return t++,{done:t>=this.length,value:t<this.length?this[t]:void 0}}),e}function d(e,t){Ce(e,f(),t)}function v(e,t){void 0!==Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):void 0!==e.prototype.__proto__?e.prototype.__proto__=t:e.prototype=t}function b(e){return{enumerable:!1,configurable:!1,get:function(){return this.get(e)},set:function(t){this.set(e,t)}}}function m(e){Object.defineProperty(fn.prototype,""+e,b(e))}function y(e){for(var t=cn;t<e;t++)m(t);cn=e}function g(e){return Te(e)&&dn(e.$mobx)}function x(e){return yn[e]}function w(e,t){Ae("function"==typeof t,x("m026")),Ae("string"==typeof e&&e.length>0,"actions should have valid names, got: '"+e+"'");var n=function(){return _(e,t,this,arguments)};return n.originalFn=t,n.isMobxAction=!0,n}function _(e,t,n,r){var o=O(e,t,n,r);try{return t.apply(n,r)}finally{S(o)}}function O(e,t,n,r){var o=s()&&!!e,i=0;if(o){i=Date.now();var a=r&&r.length||0,u=new Array(a);if(a>0)for(var l=0;l<a;l++)u[l]=r[l];c({type:"action",name:e,fn:t,object:n,arguments:u})}var p=At();return ct(),{prevDerivation:p,prevAllowStateChanges:k(!0),notifySpy:o,startTime:i}}function S(e){D(e.prevAllowStateChanges),lt(),It(e.prevDerivation),e.notifySpy&&l({time:Date.now()-e.startTime})}function A(e){Ae(null===Wn.trackingDerivation,x("m028")),Wn.strictMode=e,Wn.allowStateChanges=!e}function I(){return Wn.strictMode}function j(e,t){var n,r=k(e);try{n=t()}finally{D(r)}return n}function k(e){var t=Wn.allowStateChanges;return Wn.allowStateChanges=e,t}function D(e){Wn.allowStateChanges=e}function T(e,t,n,r,o){function i(i,a,s,u,c){if(void 0===c&&(c=0),Ae(o||V(arguments),"This function is a decorator, but it wasn't invoked like a decorator"),s){Ve(i,"__mobxLazyInitializers")||Pe(i,"__mobxLazyInitializers",i.__mobxLazyInitializers&&i.__mobxLazyInitializers.slice()||[]);var l=s.value,p=s.initializer;return i.__mobxLazyInitializers.push(function(t){e(t,a,p?p.call(t):l,u,s)}),{enumerable:r,configurable:!0,get:function(){return!0!==this.__mobxDidRunLazyInitializers&&R(this),t.call(this,a)},set:function(e){!0!==this.__mobxDidRunLazyInitializers&&R(this),n.call(this,a,e)}}}var f={enumerable:r,configurable:!0,get:function(){return this.__mobxInitializedProps&&!0===this.__mobxInitializedProps[a]||E(this,a,void 0,e,u,s),t.call(this,a)},set:function(t){this.__mobxInitializedProps&&!0===this.__mobxInitializedProps[a]?n.call(this,a,t):E(this,a,t,e,u,s)}};return(arguments.length<3||5===arguments.length&&c<3)&&Object.defineProperty(i,a,f),f}return o?function(){if(V(arguments))return i.apply(null,arguments);var e=arguments,t=arguments.length;return function(n,r,o){return i(n,r,o,e,t)}}:i}function E(e,t,n,r,o,i){Ve(e,"__mobxInitializedProps")||Pe(e,"__mobxInitializedProps",{}),e.__mobxInitializedProps[t]=!0,r(e,t,n,o,i)}function R(e){!0!==e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers&&(Pe(e,"__mobxDidRunLazyInitializers",!0),e.__mobxDidRunLazyInitializers&&e.__mobxLazyInitializers.forEach(function(t){return t(e)}))}function V(e){return(2===e.length||3===e.length)&&"string"==typeof e[1]}function L(e){return function(t,n,r){if(r&&"function"==typeof r.value)return r.value=w(e,r.value),r.enumerable=!1,r.configurable=!0,r;if(void 0!==r&&void 0!==r.get)throw new Error("[mobx] action is not expected to be used with getters");return gn(e).apply(this,arguments)}}function P(e,t,n){var r="string"==typeof e?e:e.name||"<unnamed action>",o="function"==typeof e?e:t,i="function"==typeof e?t:n;return Ae("function"==typeof o,x("m002")),Ae(0===o.length,x("m003")),Ae("string"==typeof r&&r.length>0,"actions should have valid names, got: '"+r+"'"),_(r,o,i,void 0)}function C(e){return"function"==typeof e&&!0===e.isMobxAction}function M(e,t,n){var r=function(){return _(t,n,e,arguments)};r.isMobxAction=!0,Pe(e,t,r)}function N(e,t){return $(e,t)}function $(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return!1;if(e!==e)return t!==t;var o=typeof e;return("function"===o||"object"===o||"object"==typeof t)&&B(e,t,n,r)}function B(e,t,n,r){e=U(e),t=U(t);var o=_n.call(e);if(o!==_n.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return"undefined"!=typeof Symbol&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t)}var i="[object Array]"===o;if(!i){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!("function"==typeof a&&a instanceof a&&"function"==typeof s&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],r=r||[];for(var u=n.length;u--;)if(n[u]===e)return r[u]===t;if(n.push(e),r.push(t),i){if((u=e.length)!==t.length)return!1;for(;u--;)if(!$(e[u],t[u],n,r))return!1}else{var c,l=Object.keys(e);if(u=l.length,Object.keys(t).length!==u)return!1;for(;u--;)if(c=l[u],!z(t,c)||!$(e[c],t[c],n,r))return!1}return n.pop(),r.pop(),!0}function U(e){return g(e)?e.peek():$n(e)?e.entries():ze(e)?Ke(e.entries()):e}function z(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function G(e,t){return e===t}function K(e,t){return N(e,t)}function H(e,t){return Be(e,t)||G(e,t)}function W(e,t,n){function r(){i(s)}var o,i,a;"string"==typeof e?(o=e,i=t,a=n):(o=e.name||"Autorun@"+Oe(),i=e,a=t),Ae("function"==typeof i,x("m004")),Ae(!1===C(i),x("m005")),a&&(i=i.bind(a));var s=new Zn(o,function(){this.track(r)});return s.schedule(),s.getDisposer()}function J(e,t,n,r){var o,i,a,s;return"string"==typeof e?(o=e,i=t,a=n,s=r):(o="When@"+Oe(),i=e,a=t,s=n),W(o,function(e){if(i.call(s)){e.dispose();var t=At();a.call(s),It(t)}})}function q(e,t,n,r){function o(){a(l)}var i,a,s,u;"string"==typeof e?(i=e,a=t,s=n,u=r):(i=e.name||"AutorunAsync@"+Oe(),a=e,s=t,u=n),Ae(!1===C(a),x("m006")),void 0===s&&(s=1),u&&(a=a.bind(u));var c=!1,l=new Zn(i,function(){c||(c=!0,setTimeout(function(){c=!1,l.isDisposed||l.track(o)},s))});return l.schedule(),l.getDisposer()}function Y(e,t,n){function r(){if(!c.isDisposed){var n=!1;c.track(function(){var t=e(c);n=a||!u(i,t),i=t}),a&&o.fireImmediately&&t(i,c),a||!0!==n||t(i,c),a&&(a=!1)}}arguments.length>3&&Se(x("m007")),he(e)&&Se(x("m008"));var o;o="object"==typeof n?n:{},o.name=o.name||e.name||t.name||"Reaction@"+Oe(),o.fireImmediately=!0===n||!0===o.fireImmediately,o.delay=o.delay||0,o.compareStructural=o.compareStructural||o.struct||!1,t=wn(o.name,o.context?t.bind(o.context):t),o.context&&(e=e.bind(o.context));var i,a=!0,s=!1,u=o.equals?o.equals:o.compareStructural||o.struct?On.structural:On.default,c=new Zn(o.name,function(){a||o.delay<1?r():s||(s=!0,setTimeout(function(){s=!1,r()},o.delay))});return c.schedule(),c.getDisposer()}function F(e,t){if(ie(e)&&e.hasOwnProperty("$mobx"))return e.$mobx;Ae(Object.isExtensible(e),x("m035")),Ee(e)||(t=(e.constructor.name||"ObservableObject")+"@"+Oe()),t||(t="ObservableObject@"+Oe());var n=new In(e,t);return Ce(e,"$mobx",n),n}function X(e,t,n,r){if(e.values[t]&&!An(e.values[t]))return Ae("value"in n,"The property "+t+" in "+e.name+" is already observable, cannot redefine it as computed property"),void(e.target[t]=n.value);if("value"in n)if(he(n.value)){var o=n.value;Q(e,t,o.initialValue,o.enhancer)}else C(n.value)&&!0===n.value.autoBind?M(e.target,t,n.value.originalFn):An(n.value)?ee(e,t,n.value):Q(e,t,n.value,r);else Z(e,t,n.get,n.set,On.default,!0)}function Q(e,n,o,i){if(Ne(e.target,n),t(e)){var a=r(e,{object:e.target,name:n,type:"add",newValue:o});if(!a)return;o=a.newValue}o=(e.values[n]=new bn(o,i,e.name+"."+n,!1)).value,Object.defineProperty(e.target,n,te(n)),oe(e,e.target,n,o)}function Z(e,t,n,r,o,i){i&&Ne(e.target,t),e.values[t]=new Sn(n,e.target,o,e.name+"."+t,r),i&&Object.defineProperty(e.target,t,ne(t))}function ee(e,t,n){var r=e.name+"."+t;n.name=r,n.scope||(n.scope=e.target),e.values[t]=n,Object.defineProperty(e.target,t,ne(t))}function te(e){return jn[e]||(jn[e]={configurable:!0,enumerable:!0,get:function(){return this.$mobx.values[e].get()},set:function(t){re(this,e,t)}})}function ne(e){return kn[e]||(kn[e]={configurable:!0,enumerable:!1,get:function(){return this.$mobx.values[e].get()},set:function(t){return this.$mobx.values[e].set(t)}})}function re(e,n,i){var u=e.$mobx,p=u.values[n];if(t(u)){var f=r(u,{type:"update",object:e,name:n,newValue:i});if(!f)return;i=f.newValue}if((i=p.prepareNewValue(i))!==vn){var h=o(u),d=s(),f=h||d?{type:"update",object:e,oldValue:p.value,name:n,newValue:i}:null;d&&c(f),p.setNewValue(i),h&&a(u,f),d&&l()}}function oe(e,t,n,r){var i=o(e),u=s(),p=i||u?{type:"add",object:t,name:n,newValue:r}:null;u&&c(p),i&&a(e,p),u&&l()}function ie(e){return!!Te(e)&&(R(e),Dn(e.$mobx))}function ae(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(g(e)||$n(e))throw new Error(x("m019"));if(ie(e)){var n=e.$mobx;return n.values&&!!n.values[t]}return!1}return ie(e)||!!e.$mobx||rn(e)||nr(e)||An(e)}function se(e){return Ae(!!e,":("),T(function(t,n,r,o,i){Ne(t,n),Ae(!i||!i.get,x("m022")),Q(F(t,void 0),n,r,e)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){re(this,e,t)},!0,!1)}function ue(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return le(e,ve,t)}function ce(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return le(e,me,t)}function le(e,t,n){Ae(arguments.length>=2,x("m014")),Ae("object"==typeof e,x("m015")),Ae(!$n(e),x("m016")),n.forEach(function(e){Ae("object"==typeof e,x("m017")),Ae(!ae(e),x("m018"))});for(var r=F(e),o={},i=n.length-1;i>=0;i--){var a=n[i];for(var s in a)if(!0!==o[s]&&Ve(a,s)){if(o[s]=!0,e===a&&!Me(e,s))continue;var u=Object.getOwnPropertyDescriptor(a,s);X(r,s,u,t)}}return e}function pe(e){if(void 0===e&&(e=void 0),"string"==typeof arguments[1])return Tn.apply(null,arguments);if(Ae(arguments.length<=1,x("m021")),Ae(!he(e),x("m020")),ae(e))return e;var t=ve(e,void 0,void 0);return t!==e?t:Cn.box(e)}function fe(e){Se("Expected one or two arguments to observable."+e+". Did you accidentally try to use observable."+e+" as decorator?")}function he(e){return"object"==typeof e&&null!==e&&!0===e.isMobxModifierDescriptor}function de(e,t){return Ae(!he(t),"Modifiers cannot be nested"),{isMobxModifierDescriptor:!0,initialValue:t,enhancer:e}}function ve(e,t,n){return he(e)&&Se("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),ae(e)?e:Array.isArray(e)?Cn.array(e,n):Ee(e)?Cn.object(e,n):ze(e)?Cn.map(e,n):e}function be(e,t,n){return he(e)&&Se("You tried to assign a modifier wrapped value to a collection, please define modifiers when creating the collection, not when modifying it"),void 0===e||null===e?e:ie(e)||g(e)||$n(e)?e:Array.isArray(e)?Cn.shallowArray(e,n):Ee(e)?Cn.shallowObject(e,n):ze(e)?Cn.shallowMap(e,n):Se("The shallow modifier / decorator can only used in combination with arrays, objects and maps")}function me(e){return e}function ye(e,t,n){if(N(e,t))return t;if(ae(e))return e;if(Array.isArray(e))return new fn(e,ye,n);if(ze(e))return new Nn(e,ye,n);if(Ee(e)){var r={};return F(r,n),le(r,ye,[e]),r}return e}function ge(e,t,n){return N(e,t)?t:e}function xe(e,t){void 0===t&&(t=void 0),ct();try{return e.apply(t)}finally{lt()}}function we(e){return Ie("`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead"),Cn.map(e)}function _e(){return"undefined"!=typeof window?window:global}function Oe(){return++Wn.mobxGuid}function Se(e,t){throw Ae(!1,e,t),"X"}function Ae(e,t,n){if(!e)throw new Error("[mobx] Invariant failed: "+t+(n?" in '"+n+"'":""))}function Ie(e){return-1===Un.indexOf(e)&&(Un.push(e),console.error("[mobx] Deprecated: "+e),!0)}function je(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function ke(e){var t=[];return e.forEach(function(e){-1===t.indexOf(e)&&t.push(e)}),t}function De(e,t,n){return void 0===t&&(t=100),void 0===n&&(n=" - "),e?e.slice(0,t).join(n)+(e.length>t?" (... and "+(e.length-t)+"more)":""):""}function Te(e){return null!==e&&"object"==typeof e}function Ee(e){if(null===e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Re(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++){var r=arguments[t];for(var o in r)Ve(r,o)&&(e[o]=r[o])}return e}function Ve(e,t){return Gn.call(e,t)}function Le(e,t){for(var n=0;n<t.length;n++)Pe(e,t[n],e[t[n]])}function Pe(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Ce(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Me(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return!n||!1!==n.configurable&&!1!==n.writable}function Ne(e,t){Ae(Me(e,t),"Cannot make property '"+t+"' observable, it is not configurable and writable in the target object")}function $e(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(e){return Te(e)&&!0===e[n]}}function Be(e,t){return"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}function Ue(e){return Array.isArray(e)||g(e)}function ze(e){return void 0!==_e().Map&&e instanceof _e().Map}function Ge(e){return Ee(e)?Object.keys(e):Array.isArray(e)?e.map(function(e){return e[0]}):ze(e)?Array.from(e.keys()):$n(e)?e.keys():Se("Cannot get keys from "+e)}function Ke(e){for(var t=[];;){var n=e.next();if(n.done)break;t.push(n.value)}return t}function He(){return"function"==typeof Symbol&&Symbol.toPrimitive||"@@toPrimitive"}function We(e){return null===e?null:"object"==typeof e?""+e:e}function Je(){qn=!0,_e().__mobxInstanceCount--}function qe(){Ie("Using `shareGlobalState` is not recommended, use peer dependencies instead. See https://github.com/mobxjs/mobx/issues/1082 for details."),Jn=!0;var e=_e(),t=Wn;if(e.__mobservableTrackingStack||e.__mobservableViewStack)throw new Error("[mobx] An incompatible version of mobservable is already loaded.");if(e.__mobxGlobal&&e.__mobxGlobal.version!==t.version)throw new Error("[mobx] An incompatible version of mobx is already loaded.");e.__mobxGlobal?Wn=e.__mobxGlobal:e.__mobxGlobal=t}function Ye(){return Wn}function Fe(){Wn.resetId++;var e=new Hn;for(var t in e)-1===Kn.indexOf(t)&&(Wn[t]=e[t]);Wn.allowStateChanges=!Wn.strictMode}function Xe(e,t){if("object"==typeof e&&null!==e){if(g(e))return Ae(void 0===t,x("m036")),e.$mobx.atom;if($n(e)){var n=e;if(void 0===t)return Xe(n._keys);var r=n._data[t]||n._hasMap[t];return Ae(!!r,"the entry '"+t+"' does not exist in the observable map '"+Ze(e)+"'"),r}if(R(e),t&&!e.$mobx&&e[t],ie(e)){if(!t)return Se("please specify a property");var r=e.$mobx.values[t];return Ae(!!r,"no observable property '"+t+"' found on the observable object '"+Ze(e)+"'"),r}if(rn(e)||An(e)||nr(e))return e}else if("function"==typeof e&&nr(e.$mobx))return e.$mobx;return Se("Cannot obtain atom from "+e)}function Qe(e,t){return Ae(e,"Expecting some object"),void 0!==t?Qe(Xe(e,t)):rn(e)||An(e)||nr(e)?e:$n(e)?e:(R(e),e.$mobx?e.$mobx:void Ae(!1,"Cannot obtain administration from "+e))}function Ze(e,t){var n;return n=void 0!==t?Xe(e,t):ie(e)||$n(e)?Qe(e):Xe(e),n.name}function et(e,t){return tt(Xe(e,t))}function tt(e){var t={name:e.name};return e.observing&&e.observing.length>0&&(t.dependencies=ke(e.observing).map(tt)),t}function nt(e,t){return rt(Xe(e,t))}function rt(e){var t={name:e.name};return ot(e)&&(t.observers=it(e).map(rt)),t}function ot(e){return e.observers&&e.observers.length>0}function it(e){return e.observers}function at(e,t){var n=e.observers.length;n&&(e.observersIndexes[t.__mapid]=n),e.observers[n]=t,e.lowestObserverState>t.dependenciesState&&(e.lowestObserverState=t.dependenciesState)}function st(e,t){if(1===e.observers.length)e.observers.length=0,ut(e);else{var n=e.observers,r=e.observersIndexes,o=n.pop();if(o!==t){var i=r[t.__mapid]||0;i?r[o.__mapid]=i:delete r[o.__mapid],n[i]=o}delete r[t.__mapid]}}function ut(e){e.isPendingUnobservation||(e.isPendingUnobservation=!0,Wn.pendingUnobservations.push(e))}function ct(){Wn.inBatch++}function lt(){if(0==--Wn.inBatch){Lt();for(var e=Wn.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,0===n.observers.length&&n.onBecomeUnobserved()}Wn.pendingUnobservations=[]}}function pt(e){var t=Wn.trackingDerivation;null!==t?t.runId!==e.lastAccessedBy&&(e.lastAccessedBy=t.runId,t.newObserving[t.unboundDepsCount++]=e):0===e.observers.length&&ut(e)}function ft(e){if(e.lowestObserverState!==exports.IDerivationState.STALE){e.lowestObserverState=exports.IDerivationState.STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===exports.IDerivationState.UP_TO_DATE&&(r.isTracing!==Xn.NONE&&vt(r,e),r.onBecomeStale()),r.dependenciesState=exports.IDerivationState.STALE}}}function ht(e){if(e.lowestObserverState!==exports.IDerivationState.STALE){e.lowestObserverState=exports.IDerivationState.STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===exports.IDerivationState.POSSIBLY_STALE?r.dependenciesState=exports.IDerivationState.STALE:r.dependenciesState===exports.IDerivationState.UP_TO_DATE&&(e.lowestObserverState=exports.IDerivationState.UP_TO_DATE)}}}function dt(e){if(e.lowestObserverState===exports.IDerivationState.UP_TO_DATE){e.lowestObserverState=exports.IDerivationState.POSSIBLY_STALE;for(var t=e.observers,n=t.length;n--;){var r=t[n];r.dependenciesState===exports.IDerivationState.UP_TO_DATE&&(r.dependenciesState=exports.IDerivationState.POSSIBLY_STALE,r.isTracing!==Xn.NONE&&vt(r,e),r.onBecomeStale())}}}function vt(e,t){if(console.log("[mobx.trace] '"+e.name+"' is invalidated due to a change in: '"+t.name+"'"),e.isTracing===Xn.BREAK){var n=[];bt(et(e),n,1),new Function("debugger;\n/*\nTracing '"+e.name+"'\n\nYou are entering this break point because derivation '"+e.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(e instanceof Sn?e.derivation.toString():"")+"\n\nThe dependencies for this derivation are:\n\n"+n.join("\n")+"\n*/\n ")()}}function bt(e,t,n){if(t.length>=1e3)return void t.push("(and many more)");t.push(""+new Array(n).join("\t")+e.name),e.dependencies&&e.dependencies.forEach(function(e){return bt(e,t,n+1)})}function mt(e){return e instanceof Qn}function yt(e){switch(e.dependenciesState){case exports.IDerivationState.UP_TO_DATE:return!1;case exports.IDerivationState.NOT_TRACKING:case exports.IDerivationState.STALE:return!0;case exports.IDerivationState.POSSIBLY_STALE:for(var t=At(),n=e.observing,r=n.length,o=0;o<r;o++){var i=n[o];if(An(i)){try{i.get()}catch(e){return It(t),!0}if(e.dependenciesState===exports.IDerivationState.STALE)return It(t),!0}}return jt(e),It(t),!1}}function gt(){return null!==Wn.trackingDerivation}function xt(e){var t=e.observers.length>0;Wn.computationDepth>0&&t&&Se(x("m031")+e.name),!Wn.allowStateChanges&&t&&Se(x(Wn.strictMode?"m030a":"m030b")+e.name)}function wt(e,t,n){jt(e),e.newObserving=new Array(e.observing.length+100),e.unboundDepsCount=0,e.runId=++Wn.runId;var r=Wn.trackingDerivation;Wn.trackingDerivation=e;var o;try{o=t.call(n)}catch(e){o=new Qn(e)}return Wn.trackingDerivation=r,_t(e),o}function _t(e){for(var t=e.observing,n=e.observing=e.newObserving,r=exports.IDerivationState.UP_TO_DATE,o=0,i=e.unboundDepsCount,a=0;a<i;a++){var s=n[a];0===s.diffValue&&(s.diffValue=1,o!==a&&(n[o]=s),o++),s.dependenciesState>r&&(r=s.dependenciesState)}for(n.length=o,e.newObserving=null,i=t.length;i--;){var s=t[i];0===s.diffValue&&st(s,e),s.diffValue=0}for(;o--;){var s=n[o];1===s.diffValue&&(s.diffValue=0,at(s,e))}r!==exports.IDerivationState.UP_TO_DATE&&(e.dependenciesState=r,e.onBecomeStale())}function Ot(e){var t=e.observing;e.observing=[];for(var n=t.length;n--;)st(t[n],e);e.dependenciesState=exports.IDerivationState.NOT_TRACKING}function St(e){var t=At(),n=e();return It(t),n}function At(){var e=Wn.trackingDerivation;return Wn.trackingDerivation=null,e}function It(e){Wn.trackingDerivation=e}function jt(e){if(e.dependenciesState!==exports.IDerivationState.UP_TO_DATE){e.dependenciesState=exports.IDerivationState.UP_TO_DATE;for(var t=e.observing,n=t.length;n--;)t[n].lowestObserverState=exports.IDerivationState.UP_TO_DATE}}function kt(e){return console.log(e),e}function Dt(e,t){return Ie("`whyRun` is deprecated in favor of `trace`"),e=Et(arguments),e?An(e)||nr(e)?kt(e.whyRun()):Se(x("m025")):kt(x("m024"))}function Tt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=!1;"boolean"==typeof e[e.length-1]&&(n=e.pop());var r=Et(e);if(!r)return Se("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");r.isTracing===Xn.NONE&&console.log("[mobx.trace] '"+r.name+"' tracing enabled"),r.isTracing=n?Xn.BREAK:Xn.LOG}function Et(e){switch(e.length){case 0:return Wn.trackingDerivation;case 1:return Xe(e[0]);case 2:return Xe(e[0],e[1])}}function Rt(e){Ae(this&&this.$mobx&&nr(this.$mobx),"Invalid `this`"),Ae(!this.$mobx.errorHandler,"Only one onErrorHandler can be registered"),this.$mobx.errorHandler=e}function Vt(e){return Wn.globalReactionErrorHandlers.push(e),function(){var t=Wn.globalReactionErrorHandlers.indexOf(e);t>=0&&Wn.globalReactionErrorHandlers.splice(t,1)}}function Lt(){Wn.inBatch>0||Wn.isRunningReactions||tr(Pt)}function Pt(){Wn.isRunningReactions=!0;for(var e=Wn.pendingReactions,t=0;e.length>0;){++t===er&&(console.error("Reaction doesn't converge to a stable state after "+er+" iterations. Probably there is a cycle in the reactive function: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,o=n.length;r<o;r++)n[r].runReaction()}Wn.isRunningReactions=!1}function Ct(e){var t=tr;tr=function(n){return e(function(){return t(n)})}}function Mt(e){return Ie("asReference is deprecated, use observable.ref instead"),Cn.ref(e)}function Nt(e){return Ie("asStructure is deprecated. Use observable.struct, computed.struct or reaction options instead."),Cn.struct(e)}function $t(e){return Ie("asFlat is deprecated, use observable.shallow instead"),Cn.shallow(e)}function Bt(e){return Ie("asMap is deprecated, use observable.map or observable.shallowMap instead"),Cn.map(e||{})}function Ut(e){return T(function(t,n,r,o,i){Ae(void 0!==i,x("m009")),Ae("function"==typeof i.get,x("m010")),Z(F(t,""),n,i.get,i.set,e,!1)},function(e){var t=this.$mobx.values[e];if(void 0!==t)return t.get()},function(e,t){this.$mobx.values[e].set(t)},!1,!1)}function zt(e,t){if(null===e||void 0===e)return!1;if(void 0!==t){if(!1===ie(e))return!1;if(!e.$mobx.values[t])return!1;var n=Xe(e,t);return An(n)}return An(e)}function Gt(e,t,n,r){return"function"==typeof n?Ht(e,t,n,r):Kt(e,t,n)}function Kt(e,t,n){return Qe(e).observe(t,n)}function Ht(e,t,n,r){return Qe(e,t).observe(n,r)}function Wt(e,t,n){return"function"==typeof n?qt(e,t,n):Jt(e,t)}function Jt(e,t){return Qe(e).intercept(t)}function qt(e,t,n){return Qe(e,t).intercept(n)}function Yt(e,t){return gt()||console.warn(x("m013")),ir(e,{context:t}).get()}function Ft(e,t,n){function r(r){return t&&n.push([e,r]),r}if(void 0===t&&(t=!0),void 0===n&&(n=[]),ae(e)){if(t&&null===n&&(n=[]),t&&null!==e&&"object"==typeof e)for(var o=0,i=n.length;o<i;o++)if(n[o][0]===e)return n[o][1];if(g(e)){var a=r([]),s=e.map(function(e){return Ft(e,t,n)});a.length=s.length;for(var o=0,i=s.length;o<i;o++)a[o]=s[o];return a}if(ie(e)){var a=r({});for(var u in e)a[u]=Ft(e[u],t,n);return a}if($n(e)){var c=r({});return e.forEach(function(e,r){return c[r]=Ft(e,t,n)}),c}if(mn(e))return Ft(e.get(),t,n)}return e}function Xt(t,n){Ae("function"==typeof t&&t.length<2,"createTransformer expects a function that accepts one argument");var r={},o=Wn.resetId,i=function(o){function i(e,n){var r=o.call(this,function(){return t(n)},void 0,On.default,"Transformer-"+t.name+"-"+e,void 0)||this;return r.sourceIdentifier=e,r.sourceObject=n,r}return e(i,o),i.prototype.onBecomeUnobserved=function(){var e=this.value;o.prototype.onBecomeUnobserved.call(this),delete r[this.sourceIdentifier],n&&n(e,this.sourceObject)},i}(Sn);return function(e){o!==Wn.resetId&&(r={},o=Wn.resetId);var t=Qt(e),n=r[t];return n?n.get():(n=r[t]=new i(t,e),n.get())}}function Qt(e){if("string"==typeof e||"number"==typeof e)return e;if(null===e||"object"!=typeof e)throw new Error("[mobx] transform expected some kind of object or primitive value, got: "+e);var t=e.$transformId;return void 0===t&&(t=Oe(),Pe(e,"$transformId",t)),t}function Zt(e,t,n){var r;if($n(e)||g(e)||mn(e))r=Qe(e);else{if(!ie(e))return Se("Expected observable map, object or array as first array");if("string"!=typeof t)return Se("InterceptReads can only be used with a specific property, not with an object in general");r=Qe(e,t)}return void 0!==r.dehancer?Se("An intercept reader was already established"):(r.dehancer="function"==typeof t?t:n,function(){r.dehancer=void 0})}Object.defineProperty(exports,"__esModule",{value:!0});var en=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},tn=function(){function e(e){void 0===e&&(e="Atom@"+Oe()),this.name=e,this.isPendingUnobservation=!0,this.observers=[],this.observersIndexes={},this.diffValue=0,this.lastAccessedBy=0,this.lowestObserverState=exports.IDerivationState.NOT_TRACKING}return e.prototype.onBecomeUnobserved=function(){},e.prototype.reportObserved=function(){pt(this)},e.prototype.reportChanged=function(){ct(),ft(this),lt()},e.prototype.toString=function(){return this.name},e}(),nn=function(t){function n(e,n,r){void 0===e&&(e="Atom@"+Oe()),void 0===n&&(n=zn),void 0===r&&(r=zn);var o=t.call(this,e)||this;return o.name=e,o.onBecomeObservedHandler=n,o.onBecomeUnobservedHandler=r,o.isPendingUnobservation=!1,o.isBeingTracked=!1,o}return e(n,t),n.prototype.reportObserved=function(){return ct(),t.prototype.reportObserved.call(this),this.isBeingTracked||(this.isBeingTracked=!0,this.onBecomeObservedHandler()),lt(),!!Wn.trackingDerivation},n.prototype.onBecomeUnobserved=function(){this.isBeingTracked=!1,this.onBecomeUnobservedHandler()},n}(tn),rn=$e("Atom",tn),on={spyReportEnd:!0},an="__$$iterating",sn=1e4,un=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),cn=0,ln=function(){function e(){}return e}();v(ln,Array.prototype),Object.isFrozen(Array)&&["constructor","push","shift","concat","pop","unshift","replace","find","findIndex","splice","reverse","sort"].forEach(function(e){Object.defineProperty(ln.prototype,e,{configurable:!0,writable:!0,value:Array.prototype[e]})});var pn=function(){function e(e,t,n,r){this.array=n,this.owned=r,this.values=[],this.lastKnownLength=0,this.interceptors=null,this.changeListeners=null,this.atom=new tn(e||"ObservableArray@"+Oe()),this.enhancer=function(n,r){return t(n,r,e+"[..]")}}return e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.dehanceValues=function(e){return void 0!==this.dehancer?e.map(this.dehancer):e},e.prototype.intercept=function(e){return n(this,e)},e.prototype.observe=function(e,t){return void 0===t&&(t=!1),t&&e({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0}),i(this,e)},e.prototype.getArrayLength=function(){return this.atom.reportObserved(),this.values.length},e.prototype.setArrayLength=function(e){if("number"!=typeof e||e<0)throw new Error("[mobx.array] Out of range: "+e);var t=this.values.length;if(e!==t)if(e>t){for(var n=new Array(e-t),r=0;r<e-t;r++)n[r]=void 0;this.spliceWithArray(t,0,n)}else this.spliceWithArray(e,t-e)},e.prototype.updateArrayLength=function(e,t){if(e!==this.lastKnownLength)throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed. Did you use peek() to change it?");this.lastKnownLength+=t,t>0&&e+t+1>cn&&y(e+t+1)},e.prototype.spliceWithArray=function(e,n,o){var i=this;xt(this.atom);var a=this.values.length;if(void 0===e?e=0:e>a?e=a:e<0&&(e=Math.max(0,a+e)),n=1===arguments.length?a-e:void 0===n||null===n?0:Math.max(0,Math.min(n,a-e)),void 0===o&&(o=[]),t(this)){var s=r(this,{object:this.array,type:"splice",index:e,removedCount:n,added:o});if(!s)return Bn;n=s.removedCount,o=s.added}o=o.map(function(e){return i.enhancer(e,void 0)});var u=o.length-n;this.updateArrayLength(a,u);var c=this.spliceItemsIntoValues(e,n,o);return 0===n&&0===o.length||this.notifyArraySplice(e,o,c),this.dehanceValues(c)},e.prototype.spliceItemsIntoValues=function(e,t,n){if(n.length<sn)return(o=this.values).splice.apply(o,[e,t].concat(n));var r=this.values.slice(e,e+t);return this.values=this.values.slice(0,e).concat(n,this.values.slice(e+t)),r;var o},e.prototype.notifyArrayChildUpdate=function(e,t,n){var r=!this.owned&&s(),i=o(this),u=i||r?{object:this.array,type:"update",index:e,newValue:t,oldValue:n}:null;r&&c(u),this.atom.reportChanged(),i&&a(this,u),r&&l()},e.prototype.notifyArraySplice=function(e,t,n){var r=!this.owned&&s(),i=o(this),u=i||r?{object:this.array,type:"splice",index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&c(u),this.atom.reportChanged(),i&&a(this,u),r&&l()},e}(),fn=function(n){function o(e,t,r,o){void 0===r&&(r="ObservableArray@"+Oe()),void 0===o&&(o=!1);var i=n.call(this)||this,a=new pn(r,t,i,o);return Ce(i,"$mobx",a),e&&e.length&&i.spliceWithArray(0,0,e),un&&Object.defineProperty(a.array,"0",hn),i}return e(o,n),o.prototype.intercept=function(e){return this.$mobx.intercept(e)},o.prototype.observe=function(e,t){return void 0===t&&(t=!1),this.$mobx.observe(e,t)},o.prototype.clear=function(){return this.splice(0)},o.prototype.concat=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.$mobx.atom.reportObserved(),Array.prototype.concat.apply(this.peek(),e.map(function(e){return g(e)?e.peek():e}))},o.prototype.replace=function(e){return this.$mobx.spliceWithArray(0,this.$mobx.values.length,e)},o.prototype.toJS=function(){return this.slice()},o.prototype.toJSON=function(){return this.toJS()},o.prototype.peek=function(){return this.$mobx.atom.reportObserved(),this.$mobx.dehanceValues(this.$mobx.values)},o.prototype.find=function(e,t,n){void 0===n&&(n=0);var r=this.findIndex.apply(this,arguments);return-1===r?void 0:this.get(r)},o.prototype.findIndex=function(e,t,n){void 0===n&&(n=0);for(var r=this.peek(),o=r.length,i=n;i<o;i++)if(e.call(t,r[i],i,this))return i;return-1},o.prototype.splice=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];switch(arguments.length){case 0:return[]
|
|
3
|
+
;case 1:return this.$mobx.spliceWithArray(e);case 2:return this.$mobx.spliceWithArray(e,t)}return this.$mobx.spliceWithArray(e,t,n)},o.prototype.spliceWithArray=function(e,t,n){return this.$mobx.spliceWithArray(e,t,n)},o.prototype.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.$mobx;return n.spliceWithArray(n.values.length,0,e),n.values.length},o.prototype.pop=function(){return this.splice(Math.max(this.$mobx.values.length-1,0),1)[0]},o.prototype.shift=function(){return this.splice(0,1)[0]},o.prototype.unshift=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.$mobx;return n.spliceWithArray(0,0,e),n.values.length},o.prototype.reverse=function(){var e=this.slice();return e.reverse.apply(e,arguments)},o.prototype.sort=function(e){var t=this.slice();return t.sort.apply(t,arguments)},o.prototype.remove=function(e){var t=this.$mobx.dehanceValues(this.$mobx.values).indexOf(e);return t>-1&&(this.splice(t,1),!0)},o.prototype.move=function(e,t){function n(e){if(e<0)throw new Error("[mobx.array] Index out of bounds: "+e+" is negative");var t=this.$mobx.values.length;if(e>=t)throw new Error("[mobx.array] Index out of bounds: "+e+" is not smaller than "+t)}if(n.call(this,e),n.call(this,t),e!==t){var r,o=this.$mobx.values;r=e<t?o.slice(0,e).concat(o.slice(e+1,t+1),[o[e]],o.slice(t+1)):o.slice(0,t).concat([o[e]],o.slice(t,e),o.slice(e+1)),this.replace(r)}},o.prototype.get=function(e){var t=this.$mobx;if(t){if(e<t.values.length)return t.atom.reportObserved(),t.dehanceValue(t.values[e]);console.warn("[mobx.array] Attempt to read an array index ("+e+") that is out of bounds ("+t.values.length+"). Please check length first. Out of bound indices will not be tracked by MobX")}},o.prototype.set=function(e,n){var o=this.$mobx,i=o.values;if(e<i.length){xt(o.atom);var a=i[e];if(t(o)){var s=r(o,{type:"update",object:this,index:e,newValue:n});if(!s)return;n=s.newValue}n=o.enhancer(n,a);n!==a&&(i[e]=n,o.notifyArrayChildUpdate(e,n,a))}else{if(e!==i.length)throw new Error("[mobx.array] Index out of bounds, "+e+" is larger than "+i.length);o.spliceWithArray(e,0,[n])}},o}(ln);d(fn.prototype,function(){return h(this.slice())}),Object.defineProperty(fn.prototype,"length",{enumerable:!1,configurable:!0,get:function(){return this.$mobx.getArrayLength()},set:function(e){this.$mobx.setArrayLength(e)}}),["every","filter","forEach","indexOf","join","lastIndexOf","map","reduce","reduceRight","slice","some","toString","toLocaleString"].forEach(function(e){var t=Array.prototype[e];Ae("function"==typeof t,"Base function not defined on Array prototype: '"+e+"'"),Pe(fn.prototype,e,function(){return t.apply(this.peek(),arguments)})}),Le(fn.prototype,["constructor","intercept","observe","clear","concat","get","replace","toJS","toJSON","peek","find","findIndex","splice","spliceWithArray","push","pop","set","shift","unshift","reverse","sort","remove","move","toString","toLocaleString"]);var hn=b(0);y(1e3);var dn=$e("ObservableArrayAdministration",pn),vn={},bn=function(p){function f(e,t,n,r){void 0===n&&(n="ObservableValue@"+Oe()),void 0===r&&(r=!0);var o=p.call(this,n)||this;return o.enhancer=t,o.hasUnreportedChange=!1,o.dehancer=void 0,o.value=t(e,void 0,n),r&&s()&&u({type:"create",object:o,newValue:o.value}),o}return e(f,p),f.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},f.prototype.set=function(e){var t=this.value;if((e=this.prepareNewValue(e))!==vn){var n=s();n&&c({type:"update",object:this,newValue:e,oldValue:t}),this.setNewValue(e),n&&l()}},f.prototype.prepareNewValue=function(e){if(xt(this),t(this)){var n=r(this,{object:this,type:"update",newValue:e});if(!n)return vn;e=n.newValue}return e=this.enhancer(e,this.value,this.name),this.value!==e?e:vn},f.prototype.setNewValue=function(e){var t=this.value;this.value=e,this.reportChanged(),o(this)&&a(this,{type:"update",object:this,newValue:e,oldValue:t})},f.prototype.get=function(){return this.reportObserved(),this.dehanceValue(this.value)},f.prototype.intercept=function(e){return n(this,e)},f.prototype.observe=function(e,t){return t&&e({object:this,type:"update",newValue:this.value,oldValue:void 0}),i(this,e)},f.prototype.toJSON=function(){return this.get()},f.prototype.toString=function(){return this.name+"["+this.value+"]"},f.prototype.valueOf=function(){return We(this.get())},f}(tn);bn.prototype[He()]=bn.prototype.valueOf;var mn=$e("ObservableValue",bn),yn={m001:"It is not allowed to assign new values to @action fields",m002:"`runInAction` expects a function",m003:"`runInAction` expects a function without arguments",m004:"autorun expects a function",m005:"Warning: attempted to pass an action to autorun. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.",m006:"Warning: attempted to pass an action to autorunAsync. Actions are untracked and will not trigger on state changes. Use `reaction` or wrap only your state modification code in an action.",m007:"reaction only accepts 2 or 3 arguments. If migrating from MobX 2, please provide an options object",m008:"wrapping reaction expression in `asReference` is no longer supported, use options object instead",m009:"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'. It looks like it was used on a property.",m010:"@computed can only be used on getter functions, like: '@computed get myProps() { return ...; }'",m011:"First argument to `computed` should be an expression. If using computed as decorator, don't pass it arguments",m012:"computed takes one or two arguments if used as function",m013:"[mobx.expr] 'expr' should only be used inside other reactive functions.",m014:"extendObservable expected 2 or more arguments",m015:"extendObservable expects an object as first argument",m016:"extendObservable should not be used on maps, use map.merge instead",m017:"all arguments of extendObservable should be objects",m018:"extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540",m019:"[mobx.isObservable] isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.",m020:"modifiers can only be used for individual object properties",m021:"observable expects zero or one arguments",m022:"@observable can not be used on getters, use @computed instead",m024:"whyRun() can only be used if a derivation is active, or by passing an computed value / reaction explicitly. If you invoked whyRun from inside a computation; the computation is currently suspended but re-evaluating because somebody requested its value.",m025:"whyRun can only be used on reactions and computed values",m026:"`action` can only be invoked on functions",m028:"It is not allowed to set `useStrict` when a derivation is running",m029:"INTERNAL ERROR only onBecomeUnobserved shouldn't be called twice in a row",m030a:"Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: ",m030b:"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ",m031:"Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: ",m032:"* This computation is suspended (not in use by any reaction) and won't run automatically.\n\tDidn't expect this computation to be suspended at this point?\n\t 1. Make sure this computation is used by a reaction (reaction, autorun, observer).\n\t 2. Check whether you are using this computation synchronously (in the same stack as they reaction that needs it).",m033:"`observe` doesn't support the fire immediately property for observable maps.",m034:"`mobx.map` is deprecated, use `new ObservableMap` or `mobx.observable.map` instead",m035:"Cannot make the designated object observable; it is not extensible",m036:"It is not possible to get index atoms from arrays",m037:'Hi there! I\'m sorry you have just run into an exception.\nIf your debugger ends up here, know that some reaction (like the render() of an observer component, autorun or reaction)\nthrew an exception and that mobx caught it, to avoid that it brings the rest of your application down.\nThe original cause of the exception (the code that caused this reaction to run (again)), is still in the stack.\n\nHowever, more interesting is the actual stack trace of the error itself.\nHopefully the error is an instanceof Error, because in that case you can inspect the original stack of the error from where it was thrown.\nSee `error.stack` property, or press the very subtle "(...)" link you see near the console.error message that probably brought you here.\nThat stack is more interesting than the stack of this console.error itself.\n\nIf the exception you see is an exception you created yourself, make sure to use `throw new Error("Oops")` instead of `throw "Oops"`,\nbecause the javascript environment will only preserve the original stack trace in the first form.\n\nYou can also make sure the debugger pauses the next time this very same exception is thrown by enabling "Pause on caught exception".\n(Note that it might pause on many other, unrelated exception as well).\n\nIf that all doesn\'t help you out, feel free to open an issue https://github.com/mobxjs/mobx/issues!\n',m038:"Missing items in this list?\n 1. Check whether all used values are properly marked as observable (use isObservable to verify)\n 2. Make sure you didn't dereference values too early. MobX observes props, not primitives. E.g: use 'person.name' instead of 'name' in your computation.\n"},gn=T(function(e,t,n,r,o){var i=r&&1===r.length?r[0]:n.name||t||"<unnamed action>";Pe(e,t,wn(i,n))},function(e){return this[e]},function(){Ae(!1,x("m001"))},!1,!0),xn=T(function(e,t,n){M(e,t,n)},function(e){return this[e]},function(){Ae(!1,x("m001"))},!1,!1),wn=function(e,t,n,r){return 1===arguments.length&&"function"==typeof e?w(e.name||"<unnamed action>",e):2===arguments.length&&"function"==typeof t?w(e,t):1===arguments.length&&"string"==typeof e?L(e):L(t).apply(null,arguments)};wn.bound=function(e,t,n){if("function"==typeof e){var r=w("<not yet bound action>",e);return r.autoBind=!0,r}return xn.apply(null,arguments)};var _n=Object.prototype.toString,On={identity:G,structural:K,default:H},Sn=function(){function e(e,t,n,r,o){this.derivation=e,this.scope=t,this.equals=n,this.dependenciesState=exports.IDerivationState.NOT_TRACKING,this.observing=[],this.newObserving=null,this.isPendingUnobservation=!1,this.observers=[],this.observersIndexes={},this.diffValue=0,this.runId=0,this.lastAccessedBy=0,this.lowestObserverState=exports.IDerivationState.UP_TO_DATE,this.unboundDepsCount=0,this.__mapid="#"+Oe(),this.value=new Qn(null),this.isComputing=!1,this.isRunningSetter=!1,this.isTracing=Xn.NONE,this.name=r||"ComputedValue@"+Oe(),o&&(this.setter=w(r+"-setter",o))}return e.prototype.onBecomeStale=function(){dt(this)},e.prototype.onBecomeUnobserved=function(){Ot(this),this.value=void 0},e.prototype.get=function(){Ae(!this.isComputing,"Cycle detected in computation "+this.name,this.derivation),0===Wn.inBatch?(ct(),yt(this)&&(this.isTracing!==Xn.NONE&&console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context and doing a full recompute"),this.value=this.computeValue(!1)),lt()):(pt(this),yt(this)&&this.trackAndCompute()&&ht(this));var e=this.value;if(mt(e))throw e.cause;return e},e.prototype.peek=function(){var e=this.computeValue(!1);if(mt(e))throw e.cause;return e},e.prototype.set=function(e){if(this.setter){Ae(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"),this.isRunningSetter=!0;try{this.setter.call(this.scope,e)}finally{this.isRunningSetter=!1}}else Ae(!1,"[ComputedValue '"+this.name+"'] It is not possible to assign a new value to a computed value.")},e.prototype.trackAndCompute=function(){s()&&u({object:this.scope,type:"compute",fn:this.derivation});var e=this.value,t=this.dependenciesState===exports.IDerivationState.NOT_TRACKING,n=this.value=this.computeValue(!0);return t||mt(e)||mt(n)||!this.equals(e,n)},e.prototype.computeValue=function(e){this.isComputing=!0,Wn.computationDepth++;var t;if(e)t=wt(this,this.derivation,this.scope);else try{t=this.derivation.call(this.scope)}catch(e){t=new Qn(e)}return Wn.computationDepth--,this.isComputing=!1,t},e.prototype.observe=function(e,t){var n=this,r=!0,o=void 0;return W(function(){var i=n.get();if(!r||t){var a=At();e({type:"update",object:n,newValue:i,oldValue:o}),It(a)}r=!1,o=i})},e.prototype.toJSON=function(){return this.get()},e.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]"},e.prototype.valueOf=function(){return We(this.get())},e.prototype.whyRun=function(){var e=Boolean(Wn.trackingDerivation),t=ke(this.isComputing?this.newObserving:this.observing).map(function(e){return e.name}),n=ke(it(this).map(function(e){return e.name}));return"\nWhyRun? computation '"+this.name+"':\n * Running because: "+(e?"[active] the value of this computation is needed by a reaction":this.isComputing?"[get] The value of this computed was requested outside a reaction":"[idle] not running at the moment")+"\n"+(this.dependenciesState===exports.IDerivationState.NOT_TRACKING?x("m032"):" * This computation will re-run if any of the following observables changes:\n "+De(t)+"\n "+(this.isComputing&&e?" (... or any observable accessed during the remainder of the current run)":"")+"\n "+x("m038")+"\n\n * If the outcome of this computation changes, the following observers will be re-run:\n "+De(n)+"\n")},e}();Sn.prototype[He()]=Sn.prototype.valueOf;var An=$e("ComputedValue",Sn),In=function(){function e(e,t){this.target=e,this.name=t,this.values={},this.changeListeners=null,this.interceptors=null}return e.prototype.observe=function(e,t){return Ae(!0!==t,"`observe` doesn't support the fire immediately property for observable objects."),i(this,e)},e.prototype.intercept=function(e){return n(this,e)},e}(),jn={},kn={},Dn=$e("ObservableObjectAdministration",In),Tn=se(ve),En=se(be),Rn=se(me),Vn=se(ye),Ln=se(ge),Pn={box:function(e,t){return arguments.length>2&&fe("box"),new bn(e,ve,t)},shallowBox:function(e,t){return arguments.length>2&&fe("shallowBox"),new bn(e,me,t)},array:function(e,t){return arguments.length>2&&fe("array"),new fn(e,ve,t)},shallowArray:function(e,t){return arguments.length>2&&fe("shallowArray"),new fn(e,me,t)},map:function(e,t){return arguments.length>2&&fe("map"),new Nn(e,ve,t)},shallowMap:function(e,t){return arguments.length>2&&fe("shallowMap"),new Nn(e,me,t)},object:function(e,t){arguments.length>2&&fe("object");var n={};return F(n,t),ue(n,e),n},shallowObject:function(e,t){arguments.length>2&&fe("shallowObject");var n={};return F(n,t),ce(n,e),n},ref:function(){return arguments.length<2?de(me,arguments[0]):Rn.apply(null,arguments)},shallow:function(){return arguments.length<2?de(be,arguments[0]):En.apply(null,arguments)},deep:function(){return arguments.length<2?de(ve,arguments[0]):Tn.apply(null,arguments)},struct:function(){return arguments.length<2?de(ye,arguments[0]):Vn.apply(null,arguments)}},Cn=pe;Object.keys(Pn).forEach(function(e){return Cn[e]=Pn[e]}),Cn.deep.struct=Cn.struct,Cn.ref.struct=function(){return arguments.length<2?de(ge,arguments[0]):Ln.apply(null,arguments)};var Mn={},Nn=function(){function e(e,t,n){void 0===t&&(t=ve),void 0===n&&(n="ObservableMap@"+Oe()),this.enhancer=t,this.name=n,this.$mobx=Mn,this._data=Object.create(null),this._hasMap=Object.create(null),this._keys=new fn(void 0,me,this.name+".keys()",!0),this.interceptors=null,this.changeListeners=null,this.dehancer=void 0,this.merge(e)}return e.prototype._has=function(e){return void 0!==this._data[e]},e.prototype.has=function(e){return!!this.isValidKey(e)&&(e=""+e,this._hasMap[e]?this._hasMap[e].get():this._updateHasMapEntry(e,!1).get())},e.prototype.set=function(e,n){this.assertValidKey(e),e=""+e;var o=this._has(e);if(t(this)){var i=r(this,{type:o?"update":"add",object:this,newValue:n,name:e});if(!i)return this;n=i.newValue}return o?this._updateValue(e,n):this._addValue(e,n),this},e.prototype.delete=function(e){var n=this;if(this.assertValidKey(e),e=""+e,t(this)){var i=r(this,{type:"delete",object:this,name:e});if(!i)return!1}if(this._has(e)){var u=s(),p=o(this),i=p||u?{type:"delete",object:this,oldValue:this._data[e].value,name:e}:null;return u&&c(i),xe(function(){n._keys.remove(e),n._updateHasMapEntry(e,!1),n._data[e].setNewValue(void 0),n._data[e]=void 0}),p&&a(this,i),u&&l(),!0}return!1},e.prototype._updateHasMapEntry=function(e,t){var n=this._hasMap[e];return n?n.setNewValue(t):n=this._hasMap[e]=new bn(t,me,this.name+"."+e+"?",!1),n},e.prototype._updateValue=function(e,t){var n=this._data[e];if((t=n.prepareNewValue(t))!==vn){var r=s(),i=o(this),u=i||r?{type:"update",object:this,oldValue:n.value,name:e,newValue:t}:null;r&&c(u),n.setNewValue(t),i&&a(this,u),r&&l()}},e.prototype._addValue=function(e,t){var n=this;xe(function(){var r=n._data[e]=new bn(t,n.enhancer,n.name+"."+e,!1);t=r.value,n._updateHasMapEntry(e,!0),n._keys.push(e)});var r=s(),i=o(this),u=i||r?{type:"add",object:this,name:e,newValue:t}:null;r&&c(u),i&&a(this,u),r&&l()},e.prototype.get=function(e){return e=""+e,this.has(e)?this.dehanceValue(this._data[e].get()):this.dehanceValue(void 0)},e.prototype.dehanceValue=function(e){return void 0!==this.dehancer?this.dehancer(e):e},e.prototype.keys=function(){return h(this._keys.slice())},e.prototype.values=function(){return h(this._keys.map(this.get,this))},e.prototype.entries=function(){var e=this;return h(this._keys.map(function(t){return[t,e.get(t)]}))},e.prototype.forEach=function(e,t){var n=this;this.keys().forEach(function(r){return e.call(t,n.get(r),r,n)})},e.prototype.merge=function(e){var t=this;return $n(e)&&(e=e.toJS()),xe(function(){Ee(e)?Object.keys(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],r=e[1];return t.set(n,r)}):ze(e)?e.forEach(function(e,n){return t.set(n,e)}):null!==e&&void 0!==e&&Se("Cannot initialize map from "+e)}),this},e.prototype.clear=function(){var e=this;xe(function(){St(function(){e.keys().forEach(e.delete,e)})})},e.prototype.replace=function(e){var t=this;return xe(function(){var n=Ge(e);t.keys().filter(function(e){return-1===n.indexOf(e)}).forEach(function(e){return t.delete(e)}),t.merge(e)}),this},Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.toJS=function(){var e=this,t={};return this.keys().forEach(function(n){return t[n]=e.get(n)}),t},e.prototype.toJSON=function(){return this.toJS()},e.prototype.isValidKey=function(e){return null!==e&&void 0!==e&&("string"==typeof e||"number"==typeof e||"boolean"==typeof e)},e.prototype.assertValidKey=function(e){if(!this.isValidKey(e))throw new Error("[mobx.map] Invalid key: '"+e+"', only strings, numbers and booleans are accepted as key in observable maps.")},e.prototype.toString=function(){var e=this;return this.name+"[{ "+this.keys().map(function(t){return t+": "+e.get(t)}).join(", ")+" }]"},e.prototype.observe=function(e,t){return Ae(!0!==t,x("m033")),i(this,e)},e.prototype.intercept=function(e){return n(this,e)},e}();d(Nn.prototype,function(){return this.entries()});var $n=$e("ObservableMap",Nn),Bn=[];Object.freeze(Bn);var Un=[],zn=function(){},Gn=Object.prototype.hasOwnProperty,Kn=["mobxGuid","resetId","spyListeners","strictMode","runId"],Hn=function(){function e(){this.version=5,this.trackingDerivation=null,this.computationDepth=0,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!0,this.strictMode=!1,this.resetId=0,this.spyListeners=[],this.globalReactionErrorHandlers=[]}return e}(),Wn=new Hn,Jn=!1,qn=!1,Yn=!1,Fn=_e();Fn.__mobxInstanceCount?(Fn.__mobxInstanceCount++,setTimeout(function(){Jn||qn||Yn||(Yn=!0,console.warn("[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details."))},1)):Fn.__mobxInstanceCount=1,function(e){e[e.NOT_TRACKING=-1]="NOT_TRACKING",e[e.UP_TO_DATE=0]="UP_TO_DATE",e[e.POSSIBLY_STALE=1]="POSSIBLY_STALE",e[e.STALE=2]="STALE"}(exports.IDerivationState||(exports.IDerivationState={}));var Xn;!function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"}(Xn||(Xn={}));var Qn=function(){function e(e){this.cause=e}return e}(),Zn=function(){function e(e,t){void 0===e&&(e="Reaction@"+Oe()),this.name=e,this.onInvalidate=t,this.observing=[],this.newObserving=[],this.dependenciesState=exports.IDerivationState.NOT_TRACKING,this.diffValue=0,this.runId=0,this.unboundDepsCount=0,this.__mapid="#"+Oe(),this.isDisposed=!1,this._isScheduled=!1,this._isTrackPending=!1,this._isRunning=!1,this.isTracing=Xn.NONE}return e.prototype.onBecomeStale=function(){this.schedule()},e.prototype.schedule=function(){this._isScheduled||(this._isScheduled=!0,Wn.pendingReactions.push(this),Lt())},e.prototype.isScheduled=function(){return this._isScheduled},e.prototype.runReaction=function(){this.isDisposed||(ct(),this._isScheduled=!1,yt(this)&&(this._isTrackPending=!0,this.onInvalidate(),this._isTrackPending&&s()&&u({object:this,type:"scheduled-reaction"})),lt())},e.prototype.track=function(e){ct();var t,n=s();n&&(t=Date.now(),c({object:this,type:"reaction",fn:e})),this._isRunning=!0;var r=wt(this,e,void 0);this._isRunning=!1,this._isTrackPending=!1,this.isDisposed&&Ot(this),mt(r)&&this.reportExceptionInDerivation(r.cause),n&&l({time:Date.now()-t}),lt()},e.prototype.reportExceptionInDerivation=function(e){var t=this;if(this.errorHandler)return void this.errorHandler(e,this);var n="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this,r=x("m037");console.error(n||r,e),s()&&u({type:"error",message:n,error:e,object:this}),Wn.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._isRunning||(ct(),Ot(this),lt()))},e.prototype.getDisposer=function(){var e=this.dispose.bind(this);return e.$mobx=this,e.onError=Rt,e},e.prototype.toString=function(){return"Reaction["+this.name+"]"},e.prototype.whyRun=function(){var e=ke(this._isRunning?this.newObserving:this.observing).map(function(e){return e.name});return"\nWhyRun? reaction '"+this.name+"':\n * Status: ["+(this.isDisposed?"stopped":this._isRunning?"running":this.isScheduled()?"scheduled":"idle")+"]\n * This reaction will re-run if any of the following observables changes:\n "+De(e)+"\n "+(this._isRunning?" (... or any observable accessed during the remainder of the current run)":"")+"\n\t"+x("m038")+"\n"},e.prototype.trace=function(e){void 0===e&&(e=!1),Tt(this,e)},e}(),er=100,tr=function(e){return e()},nr=$e("Reaction",Zn),rr=Ut(On.default),or=Ut(On.structural),ir=function(e,t,n){if("string"==typeof t)return rr.apply(null,arguments);Ae("function"==typeof e,x("m011")),Ae(arguments.length<3,x("m012"));var r="object"==typeof t?t:{};r.setter="function"==typeof t?t:r.setter;var o=r.equals?r.equals:r.compareStructural||r.struct?On.structural:On.default;return new Sn(e,r.context,o,r.name||e.name||"",r.setter)};ir.struct=or,ir.equals=Ut;var ar={allowStateChanges:j,deepEqual:N,getAtom:Xe,getDebugName:Ze,getDependencyTree:et,getAdministration:Qe,getGlobalState:Ye,getObserverTree:nt,interceptReads:Zt,isComputingDerivation:gt,isSpyEnabled:s,onReactionError:Vt,reserveArrayBuffer:y,resetGlobalState:Fe,isolateGlobalState:Je,shareGlobalState:qe,spyReport:u,spyReportEnd:l,spyReportStart:c,setReactionScheduler:Ct},sr={Reaction:Zn,untracked:St,Atom:nn,BaseAtom:tn,useStrict:A,isStrictModeEnabled:I,spy:p,comparer:On,asReference:Mt,asFlat:$t,asStructure:Nt,asMap:Bt,isModifierDescriptor:he,isObservableObject:ie,isBoxedObservable:mn,isObservableArray:g,ObservableMap:Nn,isObservableMap:$n,map:we,transaction:xe,observable:Cn,computed:ir,isObservable:ae,isComputed:zt,extendObservable:ue,extendShallowObservable:ce,observe:Gt,intercept:Wt,autorun:W,autorunAsync:q,when:J,reaction:Y,action:wn,isAction:C,runInAction:P,expr:Yt,toJS:Ft,createTransformer:Xt,whyRun:Dt,isArrayLike:Ue,extras:ar},ur=!1,cr=function(e){var t=sr[e];Object.defineProperty(sr,e,{get:function(){return ur||(ur=!0,console.warn("Using default export (`import mobx from 'mobx'`) is deprecated and won’t work in mobx@4.0.0\nUse `import * as mobx from 'mobx'` instead")),t}})};for(var lr in sr)cr(lr);"object"==typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:p,extras:ar}),exports.extras=ar,exports.default=sr,exports.Reaction=Zn,exports.untracked=St,exports.Atom=nn,exports.BaseAtom=tn,exports.useStrict=A,exports.isStrictModeEnabled=I,exports.spy=p,exports.comparer=On,exports.asReference=Mt,exports.asFlat=$t,exports.asStructure=Nt,exports.asMap=Bt,exports.isModifierDescriptor=he,exports.isObservableObject=ie,exports.isBoxedObservable=mn,exports.isObservableArray=g,exports.ObservableMap=Nn,exports.isObservableMap=$n,exports.map=we,exports.transaction=xe,exports.observable=Cn,exports.computed=ir,exports.isObservable=ae,exports.isComputed=zt,exports.extendObservable=ue,exports.extendShallowObservable=ce,exports.observe=Gt,exports.intercept=Wt,exports.autorun=W,exports.autorunAsync=q,exports.when=J,exports.reaction=Y,exports.action=wn,exports.isAction=C,exports.runInAction=P,exports.expr=Yt,exports.toJS=Ft,exports.createTransformer=Xt,exports.whyRun=Dt,exports.trace=Tt,exports.isArrayLike=Ue;
|
|
4
4
|
//# sourceMappingURL=lib/mobx.min.js.map
|