mobx-state-tree
Advanced tools
Comparing version 0.6.1 to 0.6.2
@@ -0,1 +1,5 @@ | ||
# 0.6.2 | ||
Fixed issue where arrays where not properly serialized as action argument | ||
# 0.6.1 | ||
@@ -2,0 +6,0 @@ |
@@ -75,3 +75,3 @@ "use strict"; | ||
throw new Error("Argument " + index + " that was passed to action '" + actionName + "' should be a primitive, model object or plain object, received a function"); | ||
if (typeof arg === "object" && !utils_1.isPlainObject(arg)) | ||
if (typeof arg === "object" && !utils_1.isPlainObject(arg) && !Array.isArray(arg)) | ||
throw new Error("Argument " + index + " that was passed to action '" + actionName + "' should be a primitive, model object or plain object, received a " + ((arg && arg.constructor) ? arg.constructor.name : "Complex Object")); | ||
@@ -78,0 +78,0 @@ if (mobx_1.isObservable(arg)) |
@@ -36,2 +36,19 @@ import { IObservableArray } from "mobx"; | ||
<SA, SB, TA, TB>(A: IType<SA, TA>, B: IType<SB, TB>): IType<SA | SB, TA | TB>; | ||
<SA, SB, SC, TA, TB, TC>(dispatch: (snapshot: any) => IType<any, any>, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>): IType<SA | SB | SC, TA | TB | TC>; | ||
<SA, SB, SC, TA, TB, TC>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>): IType<SA | SB | SC, TA | TB | TC>; | ||
<SA, SB, SC, SD, TA, TB, TC, TD>(dispatch: (snapshot: any) => IType<any, any>, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>): IType<SA | SB | SC | SD, TA | TB | TC | TD>; | ||
<SA, SB, SC, SD, TA, TB, TC, TD>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>): IType<SA | SB | SC | SD, TA | TB | TC | TD>; | ||
<SA, SB, SC, SD, SE, TA, TB, TC, TD, TE>(dispatch: (snapshot: any) => IType<any, any>, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>): IType<SA | SB | SC | SD | SE, TA | TB | TC | TD | TE>; | ||
<SA, SB, SC, SD, SE, TA, TB, TC, TD, TE>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>): IType<SA | SB | SC | SD | SE, TA | TB | TC | TD | TE>; | ||
<SA, SB, SC, SD, SE, SF, TA, TB, TC, TD, TE, TF>(dispatch: (snapshot: any) => IType<any, any>, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>): IType<SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF>; | ||
<SA, SB, SC, SD, SE, SF, TA, TB, TC, TD, TE, TF>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>): IType<SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF>; | ||
<SA, SB, SC, SD, SE, SF, SG, TA, TB, TC, TD, TE, TF, TG>(dispatch: (snapshot: any) => IType<any, any>, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>): IType<SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG>; | ||
<SA, SB, SC, SD, SE, SF, SG, TA, TB, TC, TD, TE, TF, TG>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>): IType<SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG>; | ||
<SA, SB, SC, SD, SE, SF, SG, SH, TA, TB, TC, TD, TE, TF, TG, TH>(dispatch: (snapshot: any) => IType<any, any>, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>): IType<SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH>; | ||
<SA, SB, SC, SD, SE, SF, SG, SH, TA, TB, TC, TD, TE, TF, TG, TH>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>): IType<SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH>; | ||
<SA, SB, SC, SD, SE, SF, SG, SH, SI, TA, TB, TC, TD, TE, TF, TG, TH, TI>(dispatch: (snapshot: any) => IType<any, any>, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>, I: IType<SI, TI>): IType<SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI>; | ||
<SA, SB, SC, SD, SE, SF, SG, SH, SI, TA, TB, TC, TD, TE, TF, TG, TH, TI>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>, I: IType<SI, TI>): IType<SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI>; | ||
<SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, TA, TB, TC, TD, TE, TF, TG, TH, TI, TJ>(dispatch: (snapshot: any) => IType<any, any>, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>, I: IType<SI, TI>, J: IType<SJ, TJ>): IType<SA | SB | SC | SD | SE | SF | SG | SH | SI | SJ, TA | TB | TC | TD | TE | TF | TG | TH | TI | TJ>; | ||
<SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, TA, TB, TC, TD, TE, TF, TG, TH, TI, TJ>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>, I: IType<SI, TI>, J: IType<SJ, TJ>): IType<SA | SB | SC | SD | SE | SF | SG | SH | SI | SJ, TA | TB | TC | TD | TE | TF | TG | TH | TI | TJ>; | ||
(dispatchOrType: IType<any, any> | ((snapshot: any) => IType<any, any>), ...otherTypes: IType<any, any>[]): IType<any, any>; | ||
}; | ||
@@ -38,0 +55,0 @@ optional: { |
@@ -15,1 +15,18 @@ import { IType, Type } from "../type"; | ||
export declare function union<SA, SB, TA, TB>(A: IType<SA, TA>, B: IType<SB, TB>): IType<SA | SB, TA | TB>; | ||
export declare function union<SA, SB, SC, TA, TB, TC>(dispatch: ITypeDispatcher, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>): IType<SA | SB | SC, TA | TB | TC>; | ||
export declare function union<SA, SB, SC, TA, TB, TC>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>): IType<SA | SB | SC, TA | TB | TC>; | ||
export declare function union<SA, SB, SC, SD, TA, TB, TC, TD>(dispatch: ITypeDispatcher, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>): IType<SA | SB | SC | SD, TA | TB | TC | TD>; | ||
export declare function union<SA, SB, SC, SD, TA, TB, TC, TD>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>): IType<SA | SB | SC | SD, TA | TB | TC | TD>; | ||
export declare function union<SA, SB, SC, SD, SE, TA, TB, TC, TD, TE>(dispatch: ITypeDispatcher, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>): IType<SA | SB | SC | SD | SE, TA | TB | TC | TD | TE>; | ||
export declare function union<SA, SB, SC, SD, SE, TA, TB, TC, TD, TE>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>): IType<SA | SB | SC | SD | SE, TA | TB | TC | TD | TE>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, TA, TB, TC, TD, TE, TF>(dispatch: ITypeDispatcher, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>): IType<SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, TA, TB, TC, TD, TE, TF>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>): IType<SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, SG, TA, TB, TC, TD, TE, TF, TG>(dispatch: ITypeDispatcher, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>): IType<SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, SG, TA, TB, TC, TD, TE, TF, TG>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>): IType<SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, SG, SH, TA, TB, TC, TD, TE, TF, TG, TH>(dispatch: ITypeDispatcher, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>): IType<SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, SG, SH, TA, TB, TC, TD, TE, TF, TG, TH>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>): IType<SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, SG, SH, SI, TA, TB, TC, TD, TE, TF, TG, TH, TI>(dispatch: ITypeDispatcher, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>, I: IType<SI, TI>): IType<SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, SG, SH, SI, TA, TB, TC, TD, TE, TF, TG, TH, TI>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>, I: IType<SI, TI>): IType<SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, TA, TB, TC, TD, TE, TF, TG, TH, TI, TJ>(dispatch: ITypeDispatcher, A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>, I: IType<SI, TI>, J: IType<SJ, TJ>): IType<SA | SB | SC | SD | SE | SF | SG | SH | SI | SJ, TA | TB | TC | TD | TE | TF | TG | TH | TI | TJ>; | ||
export declare function union<SA, SB, SC, SD, SE, SF, SG, SH, SI, SJ, TA, TB, TC, TD, TE, TF, TG, TH, TI, TJ>(A: IType<SA, TA>, B: IType<SB, TB>, C: IType<SC, TC>, D: IType<SD, TD>, E: IType<SE, TE>, F: IType<SF, TF>, G: IType<SG, TG>, H: IType<SH, TH>, I: IType<SI, TI>, J: IType<SJ, TJ>): IType<SA | SB | SC | SD | SE | SF | SG | SH | SI | SJ, TA | TB | TC | TD | TE | TF | TG | TH | TI | TJ>; | ||
export declare function union(dispatchOrType: ITypeDispatcher | IType<any, any>, ...otherTypes: IType<any, any>[]): IType<any, any>; |
@@ -29,3 +29,3 @@ "use strict"; | ||
Union.prototype.create = function (value) { | ||
utils_1.invariant(this.is(value), "Value " + JSON.stringify(value) + " is not assignable to union " + this.name); | ||
type_checker_1.typecheck(this, value); | ||
// try the dispatcher, if defined | ||
@@ -42,6 +42,15 @@ if (this.dispatcher !== null) { | ||
Union.prototype.validate = function (value, context) { | ||
if (this.types.some(function (type) { return type.is(value); })) { | ||
return type_checker_1.typeCheckSuccess(); | ||
if (this.dispatcher !== null) { | ||
return this.dispatcher(value).validate(value, context); | ||
} | ||
return type_checker_1.typeCheckFailure(context, value); | ||
var errors = this.types.map(function (type) { return type.validate(value, context); }); | ||
var applicableTypes = errors.filter(function (errorArray) { return errorArray.length === 0; }); | ||
if (applicableTypes.length > 1) { | ||
return type_checker_1.typeCheckFailure(context, value, "Multiple types are applicable and no dispatch method is defined for the union"); | ||
} | ||
else if (applicableTypes.length < 1) { | ||
return type_checker_1.typeCheckFailure(context, value, "No type is applicable and no dispatch method is defined for the union") | ||
.concat(type_checker_1.flattenTypeErrors(errors)); | ||
} | ||
return type_checker_1.typeCheckSuccess(); | ||
}; | ||
@@ -48,0 +57,0 @@ Object.defineProperty(Union.prototype, "identifierAttribute", { |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("mobx")):"function"==typeof define&&define.amd?define(["mobx"],e):"object"==typeof exports?exports.mobxStateTree=e(require("mobx")):t.mobxStateTree=e(t.mobx)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),n(3),n(10);var i=n(25);e.types=i.types,r(n(7)),r(n(9));var o=n(5);e.isMST=o.isMST,e.getType=o.getType,e.getChildType=o.getChildType,e.onAction=o.onAction,e.applyAction=o.applyAction;var a=n(22);e.asReduxStore=a.asReduxStore,e.connectReduxDevtools=a.connectReduxDevtools},function(t,e){"use strict";function n(t){throw void 0===t&&(t="Illegal state"),r(!1,t),"!"}function r(t,e){if(void 0===e&&(e="Illegal state"),!t)throw new Error("[mobx-state-tree] "+e)}function i(t){return t}function o(){return null}function a(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r++){var i=e[r];for(var o in i)t[o]=i[o]}return t}function s(t){if(null===t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function u(t){return!(null===t||"object"!=typeof t||t instanceof Date||t instanceof RegExp)}function c(t){return null===t||void 0===t||"string"==typeof t||"number"==typeof t||"boolean"==typeof t||t instanceof Date}function p(t){return"function"!=typeof t}function f(t,e,n){Object.defineProperty(t,e,{enumerable:!1,writable:!1,configurable:!0,value:n})}function l(t,e,n){Object.defineProperty(t,e,{enumerable:!1,writable:!0,configurable:!0,value:n})}function h(t,e,n){Object.defineProperty(t,e,{enumerable:!0,writable:!1,configurable:!0,value:n})}function d(t,e){return t.push(e),function(){var n=t.indexOf(e);n!==-1&&t.splice(n,1)}}function y(t,e){return m.call(t,e)}function v(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=t[n];return e}function b(t,e){return new Function("f","return function "+t+"() { return f.apply(this, arguments)}")(e)}function g(t){return"string"==typeof t&&/^[a-z0-9_-]+$/i.test(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.EMPTY_ARRAY=Object.freeze([]),e.fail=n,e.invariant=r,e.identity=i,e.nothing=o,e.extend=a,e.isPlainObject=s,e.isMutable=u,e.isPrimitive=c,e.isSerializable=p,e.addHiddenFinalProp=f,e.addHiddenWritableProp=l,e.addReadOnlyProp=h,e.registerEventHandler=d;var m=Object.prototype.hasOwnProperty;e.hasOwnProperty=y,e.argsToArray=v,e.createNamedFunction=b,e.isValidIdentifier=g},function(t,e,n){"use strict";function r(t){var e=t.value,n=t.context[t.context.length-1].type,r=t.context.map(function(t){var e=t.path;return e}).filter(function(t){return t.length>0}).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=f.maybeMST(e,function(t){return"value of type "+t.type.name+":"},function(){return p.isPrimitive(e)?"value":"snapshot"}),a=n&&f.isMST(e)&&n.is(f.getMSTAdministration(e).snapshot);return""+i+o+" "+d(e)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(t.message?" ("+t.message+")":"")+(n?l.isPrimitiveType(n)||n instanceof h.OptionalValue&&l.isPrimitiveType(n.type)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function i(t){return[{type:t,path:""}]}function o(t,e,n){return t.concat([{path:e,type:n}])}function a(){return p.EMPTY_ARRAY}function s(t,e,n){return[{context:t,value:e,message:n}]}function u(t){return t.reduce(function(t,e){return t.concat(e)},[])}function c(t,e){var n=t.validate(e,[{path:"",type:t}]);n.length>0&&p.fail("Error while converting "+d(e)+" to `"+t.name+"`:\n"+n.map(r).join("\n"))}Object.defineProperty(e,"__esModule",{value:!0});var p=n(1),f=n(6),l=n(12),h=n(13),d=function(t){return f.isMST(t)?"<"+t+">":"`"+JSON.stringify(t)+"`"};e.getDefaultContext=i,e.getContextForPath=o,e.typeCheckSuccess=a,e.typeCheckFailure=s,e.flattenTypeErrors=u,e.typecheck=c},function(t,e,n){"use strict";function r(t){return"object"==typeof t&&t&&t.isType===!0}Object.defineProperty(e,"__esModule",{value:!0}),e.isType=r;var i=function(){function t(t){this.isType=!0,this.name=t}return t.prototype.is=function(t){return 0===this.validate(t,[{path:"",type:this}]).length},Object.defineProperty(t.prototype,"Type",{get:function(){return o.fail("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"SnapshotType",{get:function(){return o.fail("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!0,configurable:!0}),t}();e.Type=i;var o=n(1)},function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),r(n(6)),r(n(15)),r(n(14)),r(n(9)),r(n(7))},function(t,e,n){"use strict";function r(t){return a(t).type}function i(t,e){return a(t).getChildType(e)}function o(t){return t&&t.$treenode}function a(t){return o(t)?t.$treenode:f.fail("element has no Node")}function s(t,e,n){if(f.isMutable(t)&&o(t)){var r=a(t);return e(r,r.target)}return n?n(t):t}function u(t){return t instanceof Date?{$treetype:"Date",time:t.toJSON()}:o(t)?a(t).snapshot:f.isSerializable(t)?t:void f.fail("Unable to convert value to snapshot.")}function c(t,e){f.invariant(t.root===e.root,"Cannot calculate relative path: objects '"+t+"' and '"+e+"' are not part of the same object tree");for(var n=p.splitJsonPath(t.path),r=p.splitJsonPath(e.path),i=0;i<n.length&&n[i]===r[i];i++);return n.slice(i).map(function(t){return".."}).join("/")+p.joinJsonPath(r.slice(i))}Object.defineProperty(e,"__esModule",{value:!0});var p=n(9);e.getType=r,e.getChildType=i,e.isMST=o,e.getMSTAdministration=a,e.maybeMST=s,e.valueToSnapshot=u,e.getRelativePathForNodes=c;var f=n(1)},function(t,e,n){"use strict";function r(t,e){var n=z.getMSTAdministration(t);return n.isProtectionEnabled||console.warn("It is recommended to protect the state tree before attaching action middleware, as otherwise it cannot be guaranteed that all changes are passed through middleware. See `protect`"),n.addMiddleWare(e)}function i(t,e){return z.getMSTAdministration(t).onPatch(e)}function o(t,e){return z.getMSTAdministration(t).onSnapshot(e)}function a(t,e){return z.getMSTAdministration(t).applyPatch(e)}function s(t,e){var n=z.getMSTAdministration(t);I.runInAction(function(){e.forEach(function(t){return n.applyPatch(t)})})}function u(t){var e={patches:[],stop:function(){return n()},replay:function(t){s(t,e.patches)}},n=i(t,function(t){e.patches.push(t)});return e}function c(t,e){I.runInAction(function(){e.forEach(function(e){return R.applyAction(t,e)})})}function p(t){var e={actions:[],stop:function(){return n()},replay:function(t){c(t,e.actions)}},n=R.onAction(t,e.actions.push.bind(e.actions));return e}function f(t){z.getMSTAdministration(t).isProtectionEnabled=!0}function l(t){z.getMSTAdministration(t).isProtectionEnabled=!1}function h(t){return z.getMSTAdministration(t).isProtectionEnabled}function d(t,e){return z.getMSTAdministration(t).applySnapshot(e)}function y(t){return z.getMSTAdministration(t).snapshot}function v(t,e){void 0===e&&(e=1),E.invariant(e>=0,"Invalid depth: "+e+", should be >= 1");for(var n=z.getMSTAdministration(t).parent;n;){if(0===--e)return!0;n=n.parent}return!1}function b(t,e){void 0===e&&(e=1),E.invariant(e>=0,"Invalid depth: "+e+", should be >= 1");for(var n=e,r=z.getMSTAdministration(t).parent;r;){if(0===--n)return r.target;r=r.parent}return E.fail("Failed to find the parent of "+z.getMSTAdministration(t)+" at depth "+e)}function g(t){return z.getMSTAdministration(t).root.target}function m(t){return z.getMSTAdministration(t).path}function _(t){return V.splitJsonPath(z.getMSTAdministration(t).path)}function P(t){return z.getMSTAdministration(t).isRoot}function T(t,e){var n=z.getMSTAdministration(t).resolve(e);return n?n.target:void 0}function A(t,e){var n=z.getMSTAdministration(t).resolve(e,!1);if(void 0!==n)return n?n.target:void 0}function j(t,e){return z.getRelativePathForNodes(z.getMSTAdministration(t),z.getMSTAdministration(e))}function S(t,e){void 0===e&&(e=!0);var n=z.getMSTAdministration(t);return n.type.create(n.snapshot,e===!0?n.root._environment:e===!1?void 0:e)}function O(t){return z.getMSTAdministration(t).detach(),t}function w(t){var e=z.getMSTAdministration(t);e.isRoot?e.die():e.parent.removeChild(e.subpath)}function M(t){return z.getMSTAdministration(t).isAlive}function C(t,e){z.getMSTAdministration(t).addDisposer(e)}function x(t){var e=z.getMSTAdministration(t),n=e.root._environment;return E.invariant(!!n,"Node '"+e+"' is not part of state tree that was initialized with an environment. Environment can be passed as second argumentt to .create()"),n}function k(t,e){var n=z.getMSTAdministration(t);n.getChildMSTs().forEach(function(t){var n=(t[0],t[1]);k(n.target,e)}),e(n.target)}function F(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=t.create(e);return c(i,n),y(i)}Object.defineProperty(e,"__esModule",{value:!0});var R=n(14),I=n(4),z=n(6),V=n(9),E=n(1);e.addMiddleware=r,e.onPatch=i,e.onSnapshot=o,e.applyPatch=a,e.applyPatches=s,e.recordPatches=u,e.applyActions=c,e.recordActions=p,e.protect=f,e.unprotect=l,e.isProtected=h,e.applySnapshot=d,e.getSnapshot=y,e.hasParent=v,e.getParent=b,e.getRoot=g,e.getPath=m,e.getPathParts=_,e.isRoot=P,e.resolve=T,e.tryResolve=A,e.getRelativePath=j,e.clone=S,e.detach=O,e.destroy=w,e.isAlive=M,e.addDisposer=C,e.getEnv=x,e.walk=k,e.testActions=F},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){this.name=t}return t.prototype.initializePrototype=function(t){},t.prototype.initialize=function(t,e){},t.prototype.willChange=function(t){return null},t.prototype.didChange=function(t){},t.prototype.serialize=function(t,e){},t.prototype.deserialize=function(t,e){},t}();e.Property=n},function(t,e){"use strict";function n(t){return t.replace(/~/g,"~1").replace(/\//g,"~0")}function r(t){return t.replace(/~0/g,"\\").replace(/~1/g,"~")}function i(t){return 0===t.length?"":"/"+t.map(n).join("/")}function o(t){var e=t.split("/").map(r);return""===e[0]?e.slice(1):e}Object.defineProperty(e,"__esModule",{value:!0}),e.escapeJsonPath=n,e.unescapeJsonPath=r,e.joinJsonPath=i,e.splitJsonPath=o},function(t,e,n){"use strict";function r(){return p.getMSTAdministration(this).snapshot}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),a=n(3),s=n(1),u=n(2),c=function(t){function e(e){var n=t.call(this,e)||this;return n.create=o.action(n.name,n.create),n}return i(e,t),e.prototype.create=function(t,e,n,i){var o=this;void 0===t&&(t=this.getDefaultSnapshot()),void 0===e&&(e=void 0),void 0===n&&(n=null),void 0===i&&(i=""),u.typecheck(this,t);var a=this.createNewInstance(),c=new f.MSTAdministration(n,i,a,this,e),p=!0;try{return c.pseudoAction(function(){o.finalizeNewInstance(a,t)}),s.addReadOnlyProp(a,"toJSON",r),c.fireHook("afterCreate"),n&&c.fireHook("afterAttach"),p=!1,a}finally{p&&(c._isAlive=!1)}},e.prototype.validate=function(t,e){return t&&"object"==typeof t?p.isMST(t)?p.getType(t)===this?u.typeCheckSuccess():u.typeCheckFailure(e,t):this.isValidSnapshot(t,e):u.typeCheckFailure(e,t)},e}(a.Type);e.ComplexType=c;var p=n(6),f=n(15)},function(t,e,n){"use strict";function r(){return h.getMSTAdministration(this).toString()}function i(t,e,n){var r="string"==typeof t?t:"AnonymousModel",i="string"==typeof t?e:t,o="string"==typeof t?n:e;return new M(r,i,o||{})}function o(t){var e=d.isType(t)?t:h.getType(t);return s(e)?e.baseModel:{}}function a(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];console.warn("[mobx-state-tree] `extend` is an experimental feature and it's behavior will probably change in the future");var n="string"==typeof t[0]?t.slice(1):t,r="string"==typeof t[0]?t[0]:n.map(function(t){return t.name}).join("_");return i(r,l.extend.apply(null,[{}].concat(n.map(o))))}function s(t){return d.isType(t)&&t.isObjectFactory===!0}function u(t){return t instanceof M?t.identifierAttribute:t instanceof P.Late?t.definition().identifierAttribute:null}var c=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),p=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var f=n(4),l=n(1),h=n(5),d=n(3),y=n(2),v=n(10),b=n(12),g=n(13),m=n(19),_=n(16),P=n(17),T=n(28),A=n(29),j=n(27),S=n(30),O=n(26),w=n(31),M=function(t){function e(e,n,i){var o=t.call(this,e)||this;return o.isObjectFactory=!0,o.props={},o.identifierAttribute=null,o.didChange=function(t){o.props[t.name].didChange(t)},Object.freeze(n),Object.freeze(i),o.baseModel=n,o.baseActions=i,l.invariant(/^\w[\w\d_]*$/.test(e),"Typename should be a valid identifier: "+e),o.modelConstructor=new Function("return function "+e+" (){}")(),o.modelConstructor.prototype.toString=r,o.parseModelProps(),o.forAllProps(function(t){return t.initializePrototype(o.modelConstructor.prototype)}),o}return c(e,t),e.prototype.createNewInstance=function(){var t=new this.modelConstructor;return f.extendShallowObservable(t,{}),t},e.prototype.finalizeNewInstance=function(t,e){var n=this;f.intercept(t,function(t){return n.willChange(t)}),f.observe(t,this.didChange),this.forAllProps(function(n){return n.initialize(t,e)})},e.prototype.willChange=function(t){var e=h.getMSTAdministration(t.object);return e.assertWritable(),this.props[t.name].willChange(t)},e.prototype.parseModelProps=function(){var t=this,e=t.baseModel,n=t.baseActions;for(var r in e)if(l.hasOwnProperty(e,r)){var i=Object.getOwnPropertyDescriptor(e,r);if("get"in i){this.props[r]=new j.ComputedProperty(r,i.get,i.set);continue}var o=i.value;if(null===o)l.fail("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");else if(_.isIdentifierFactory(o))l.invariant(!this.identifierAttribute,"Cannot define property '"+r+"' as object identifier, property '"+this.identifierAttribute+"' is already defined as identifier property"),this.identifierAttribute=r,this.props[r]=new T.IdentifierProperty(r,o.primitiveType);else if(l.isPrimitive(o)){var a=b.getPrimitiveFactoryFromValue(o);this.props[r]=new S.ValueProperty(r,g.optional(a,o))}else d.isType(o)?this.props[r]=new S.ValueProperty(r,o):m.isReferenceFactory(o)?this.props[r]=new A.ReferenceProperty(r,o.targetType,o.basePath):"function"==typeof o?this.props[r]=new w.ViewProperty(r,o):"object"==typeof o?l.fail("In property '"+r+"': base model's should not contain complex values: '"+o+"'"):l.fail("Unexpected value for property '"+r+"'")}for(var r in n)if(l.hasOwnProperty(n,r)){var o=n[r];r in this.baseModel&&l.fail("Property '"+r+"' was also defined as action. Actions and properties should not collide"),"function"==typeof o?this.props[r]=new O.ActionProperty(r,o):l.fail("Unexpected value for action '"+r+"'. Expected function, got "+typeof o)}},e.prototype.getChildMSTs=function(t){var e=[];return this.forAllProps(function(n){n instanceof S.ValueProperty&&h.maybeMST(t.target[n.name],function(t){return e.push([n.name,t])})}),e},e.prototype.getChildMST=function(t,e){return h.maybeMST(t.target[e],l.identity,l.nothing)},e.prototype.serialize=function(t){var e={};return this.forAllProps(function(n){return n.serialize(t.target,e)}),e},e.prototype.applyPatchLocally=function(t,e,n){l.invariant("replace"===n.op||"add"===n.op),t.target[e]=n.value},e.prototype.applySnapshot=function(t,e){var n=this;t.pseudoAction(function(){for(var r in n.props)n.props[r].deserialize(t.target,e)})},e.prototype.getChildType=function(t){return this.props[t].type},e.prototype.isValidSnapshot=function(t,e){var n=this;return l.isPlainObject(t)?y.flattenTypeErrors(Object.keys(this.props).map(function(r){return n.props[r].validate(t,e)})):y.typeCheckFailure(e,t)},e.prototype.forAllProps=function(t){var e=this;Object.keys(this.props).forEach(function(n){return t(e.props[n])})},e.prototype.describe=function(){var t=this;return"{ "+Object.keys(this.props).map(function(e){var n=t.props[e];return n instanceof S.ValueProperty?e+": "+n.type.describe():n instanceof T.IdentifierProperty?e+": identifier":""}).filter(Boolean).join("; ")+" }"},e.prototype.getDefaultSnapshot=function(){return{}},e.prototype.removeChild=function(t,e){t.target[e]=null},e}(v.ComplexType);p([f.action],M.prototype,"applySnapshot",null),e.ObjectType=M,e.model=i,e.extend=a,e.isObjectFactory=s,e.getIdentifierAttribute=u},function(t,e,n){"use strict";function r(t){switch(typeof t){case"string":return e.string;case"number":return e.number;case"boolean":return e.boolean;case"object":if(t instanceof Date)return e.DatePrimitive}return u.fail("Cannot determine primtive type from value "+t)}function i(t){return t instanceof c}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),s=n(2),u=n(1),c=function(t){function e(e,n){var r=t.call(this,e)||this;return r.checker=n,r}return o(e,t),e.prototype.describe=function(){return this.name},e.prototype.create=function(t){return u.invariant(u.isPrimitive(t),"Not a primitive: '"+t+"'"),u.invariant(this.checker(t),"Value is not assignable to '"+this.name+"'"),t},e.prototype.validate=function(t,e){return u.isPrimitive(t)&&this.checker(t)?s.typeCheckSuccess():s.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(a.Type);e.CoreType=c,e.string=new c("string",function(t){return"string"==typeof t}),e.number=new c("number",function(t){return"number"==typeof t}),e.boolean=new c("boolean",function(t){return"boolean"==typeof t}),e.DatePrimitive=new c("Date",function(t){return t instanceof Date}),e.getPrimitiveFactoryFromValue=r,e.isPrimitiveType=i},function(t,e,n){"use strict";function r(t,e){var n="function"==typeof e?e():e,r=u.isMST(n)?u.getMSTAdministration(n).snapshot:n;return a.typecheck(t,r),new s(t,e)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(2),s=function(t){function e(e,n){var r=t.call(this,e.name)||this;return r.type=e,r.defaultValue=n,r}return i(e,t),e.prototype.describe=function(){return this.type.describe()+"?"},e.prototype.create=function(t){if("undefined"==typeof t){var e="function"==typeof this.defaultValue?this.defaultValue():this.defaultValue,n=u.isMST(e)?u.getMSTAdministration(e).snapshot:e;return this.type.create(n)}return this.type.create(t)},e.prototype.validate=function(t,e){return void 0===t||this.type.is(t)?a.typeCheckSuccess():a.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return this.type.identifierAttribute},enumerable:!0,configurable:!0}),e}(o.Type);e.OptionalValue=s,e.optional=r;var u=n(6)},function(t,e,n){"use strict";function r(t){return t.object[t.name].apply(t.object,t.args)}function i(t){for(var e=t.middlewares.slice(),n=t;n.parent;)n=n.parent,e=e.concat(n.middlewares);return e}function o(t,e){function n(t){var e=o.shift();return e?e(t,n):r(t)}var o=i(t);return o.length?n(e):r(e)}function a(t,e){var n=f.action(t,e),r=function(){var e=l.getMSTAdministration(this);if(e.assertAlive(),e.isRunningAction())return n.apply(this,arguments);var r={name:t,object:e.target,args:d.argsToArray(arguments)},i=e.root;i._isRunningAction=!0;try{return o(e,r)}finally{i._isRunningAction=!1}};return d.createNamedFunction(t,r)}function s(t,e,n,r){if(d.isPrimitive(r))return r;if(l.isMST(r)){var i=l.getMSTAdministration(r);if(t.root!==i.root)throw new Error("Argument "+n+" that was passed to action '"+e+"' is a model that is not part of the same state tree. Consider passing a snapshot or some representative ID instead");return{$ref:l.getRelativePathForNodes(t,l.getMSTAdministration(r))}}if("function"==typeof r)throw new Error("Argument "+n+" that was passed to action '"+e+"' should be a primitive, model object or plain object, received a function");if("object"==typeof r&&!d.isPlainObject(r))throw new Error("Argument "+n+" that was passed to action '"+e+"' should be a primitive, model object or plain object, received a "+(r&&r.constructor?r.constructor.name:"Complex Object"));if(f.isObservable(r))throw new Error("Argument "+n+" that was passed to action '"+e+"' should be a primitive, model object or plain object, received an mobx observable.");try{return JSON.stringify(r),r}catch(t){throw new Error("Argument "+n+" that was passed to action '"+e+"' is not serializable.")}}function u(t,e){if("object"==typeof e){var n=Object.keys(e);if(1===n.length&&"$ref"===n[0])return h.resolve(t.target,e.$ref)}return e}function c(t,e){var n=h.tryResolve(t,e.path||"");if(!n)return d.fail("Invalid action path: "+(e.path||""));var r=l.getMSTAdministration(n);return d.invariant("function"==typeof n[e.name],"Action '"+e.name+"' does not exist in '"+r.path+"'"),n[e.name].apply(n,e.args?e.args.map(function(t){return u(r,t)}):[])}function p(t,e){return h.addMiddleware(t,function(n,r){var i=l.getMSTAdministration(n.object);return e({name:n.name,path:l.getRelativePathForNodes(l.getMSTAdministration(t),i),args:n.args.map(function(t,e){return s(i,n.name,e,t)})}),r(n)})}Object.defineProperty(e,"__esModule",{value:!0});var f=n(4);e.createActionInvoker=a,e.applyAction=c,e.onAction=p;var l=n(6),h=n(7),d=n(1)},function(t,e,n){"use strict";var r=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),o=n(2),a=n(6),s=n(1),u=n(9),c=n(11),p=n(10),f=1,l=function(){function t(t,e,n,r,o){var a=this;this.nodeId=++f,this._parent=null,this.subpath="",this.isProtectionEnabled=!0,this._environment=void 0,this._isRunningAction=!1,this._isAlive=!0,this._isDetaching=!1,this.middlewares=[],this.snapshotSubscribers=[],this.patchSubscribers=[],this.disposers=[],s.invariant(r instanceof p.ComplexType,"Uh oh"),s.addHiddenFinalProp(n,"$treenode",this),this._parent=t,this.subpath=e,this.type=r,this.target=n,this._environment=o;var u=i.reaction(function(){return a.snapshot},function(t){a.snapshotSubscribers.forEach(function(e){return e(t)})});u.onError(function(t){throw t}),this.addDisposer(u)}return Object.defineProperty(t.prototype,"path",{get:function(){return this.parent?this.parent.path+"/"+u.escapeJsonPath(this.subpath):""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRoot",{get:function(){return null===this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){for(var t,e=this;t=e.parent;)e=t;return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAlive",{get:function(){return this._isAlive},enumerable:!0,configurable:!0}),t.prototype.die=function(){this._isDetaching||(h.walk(this.target,function(t){return a.getMSTAdministration(t).aboutToDie()}),h.walk(this.target,function(t){return a.getMSTAdministration(t).finalizeDeath()}))},t.prototype.aboutToDie=function(){this.disposers.splice(0).forEach(function(t){return t()}),this.fireHook("beforeDestroy")},t.prototype.finalizeDeath=function(){var t=this,e=this.path;s.addReadOnlyProp(this,"snapshot",this.snapshot),this.patchSubscribers.splice(0),this.snapshotSubscribers.splice(0),this.patchSubscribers.splice(0),this._isAlive=!1,this._parent=null,this.subpath="",Object.defineProperty(this.target,"$mobx",{get:function(){s.fail("This object has died and is no longer part of a state tree. It cannot be used anymore. The object (of type '"+t.type.name+"') used to live at '"+e+"'. It is possible to access the last snapshot of this object using 'getSnapshot', or to create a fresh copy using 'clone'. If you want to remove an object from the tree without killing it, use 'detach' instead.")}})},t.prototype.assertAlive=function(){this._isAlive||s.fail(this+" cannot be used anymore as it has died; it has been removed from a state tree. If you want to remove an element from a tree and let it live on, use 'detach' or 'clone' the value")},Object.defineProperty(t.prototype,"snapshot",{get:function(){if(this._isAlive)return Object.freeze(this.type.serialize(this))},enumerable:!0,configurable:!0}),t.prototype.onSnapshot=function(t){return s.registerEventHandler(this.snapshotSubscribers,t)},t.prototype.applySnapshot=function(t){return o.typecheck(this.type,t),this.type.applySnapshot(this,t)},t.prototype.applyPatch=function(t){var e=u.splitJsonPath(t.path),n=this.resolvePath(e.slice(0,-1));n.pseudoAction(function(){n.applyPatchLocally(e[e.length-1],t)})},t.prototype.applyPatchLocally=function(t,e){this.assertWritable(),this.type.applyPatchLocally(this,t,e)},t.prototype.onPatch=function(t){return s.registerEventHandler(this.patchSubscribers,t)},t.prototype.emitPatch=function(t,e){if(this.patchSubscribers.length){var n=s.extend({},t,{path:e.path.substr(this.path.length)+"/"+t.path});this.patchSubscribers.forEach(function(t){return t(n)})}this.parent&&this.parent.emitPatch(t,e)},t.prototype.setParent=function(t,e){void 0===e&&(e=null),this.parent===t&&this.subpath===e||(this._parent&&t&&t!==this._parent&&s.fail("A node cannot exists twice in the state tree. Failed to add "+this+" to path '"+t.path+"/"+e+"'."),!this._parent&&t&&t.root===this&&s.fail("A state tree is not allowed to contain itself. Cannot assign "+this+" to path '"+t.path+"/"+e+"'"),!this._parent&&this._environment&&s.fail("A state tree that has been initialized with an environment cannot be made part of another state tree."),this.parent&&!t?this.die():(this._parent=t,this.subpath=e||"",this.fireHook("afterAttach")))},t.prototype.addDisposer=function(t){this.disposers.unshift(t)},t.prototype.reconcileChildren=function(t,e,n,r){var i=this,u=new Array(n.length),p={},f={},l=c.getIdentifierAttribute(t);e.forEach(function(t){if(t){if(l){var e=t[l];e&&(f[e]=t)}a.isMST(t)&&(p[a.getMSTAdministration(t).nodeId]=t)}}),n.forEach(function(e,n){var c=""+r[n];if(a.isMST(e)){var h=a.getMSTAdministration(e);if(h.assertAlive(),h.parent&&(h.parent!==i||!p[h.nodeId]))return s.fail("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+i.path+"/"+c+"', but it lives already at '"+h.path+"'");p[h.nodeId]=void 0,h.setParent(i,c),u[n]=e}else if(l&&s.isMutable(e)){o.typecheck(t,e);var d=e[l],y=f[d],h=y&&a.getMSTAdministration(y);y&&h.type.is(e)?(p[h.nodeId]=void 0,h.setParent(i,c),h.applySnapshot(e),u[n]=y):u[n]=t.create(e,void 0,i,c)}else o.typecheck(t,e),u[n]=t.create(e,void 0,i,c)});for(var h in p)p[h]&&a.getMSTAdministration(p[h]).die();return u},t.prototype.resolve=function(t,e){return void 0===e&&(e=!0),this.resolvePath(u.splitJsonPath(t),e)},t.prototype.resolvePath=function(t,e){void 0===e&&(e=!0),this.assertAlive();for(var n=this,r=0;r<t.length;r++){if(""===t[r])n=n.root;else if(".."===t[r])n=n.parent;else{if("."===t[r]||""===t[r])continue;n=n.getChildMST(t[r])}if(null===n)return e?s.fail("Could not resolve '"+t[r]+"' in '"+u.joinJsonPath(t.slice(0,r-1))+"', path of the patch does not resolve"):void 0}return n},t.prototype.isRunningAction=function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()},t.prototype.addMiddleWare=function(t){return s.registerEventHandler(this.middlewares,t)},t.prototype.getChildMST=function(t){return this.assertAlive(),this.type.getChildMST(this,t)},t.prototype.getChildMSTs=function(){return this.type.getChildMSTs(this)},t.prototype.getChildType=function(t){return this.type.getChildType(t)},Object.defineProperty(t.prototype,"isProtected",{get:function(){for(var t=this;t;){if(t.isProtectionEnabled===!1)return!1;t=t.parent}return!0},enumerable:!0,configurable:!0}),t.prototype.pseudoAction=function(t){var e=this._isRunningAction;this._isRunningAction=!0,t(),this._isRunningAction=e},t.prototype.assertWritable=function(){this.assertAlive(),!this.isRunningAction()&&this.isProtected&&s.fail("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")},t.prototype.removeChild=function(t){this.type.removeChild(this,t)},t.prototype.detach=function(){s.invariant(this._isAlive),this.isRoot||(this.fireHook("beforeDetach"),this._environment=this.root._environment,this._isDetaching=!0,this.parent.removeChild(this.subpath),this._parent=null,this.subpath="",this._isDetaching=!1)},t.prototype.fireHook=function(t){var e=this.target[t];"function"==typeof e&&e.apply(this.target)},t.prototype.toString=function(){var t=c.getIdentifierAttribute(this.type),e=t?"("+t+": "+this.target[t]+")":"";return this.type.name+"@"+(this.path||"<root>")+e+(this.isAlive?"":"[dead]")},t}();r([i.observable],l.prototype,"_parent",void 0),r([i.observable],l.prototype,"subpath",void 0),r([i.computed],l.prototype,"path",null),r([i.computed],l.prototype,"snapshot",null),r([i.action],l.prototype,"applyPatch",null),e.MSTAdministration=l;var h=n(7)},function(t,e,n){"use strict";function r(t){return void 0===t&&(t=o.string),t!==o.string&&t!==o.number&&a.fail("Only 'types.number' and 'types.string' are acceptable as type specification for identifiers"),{isIdentifier:!0,primitiveType:t}}function i(t){return"object"==typeof t&&t&&t.isIdentifier===!0}Object.defineProperty(e,"__esModule",{value:!0});var o=n(12),a=n(1);e.identifier=r,e.isIdentifierFactory=i},function(t,e,n){"use strict";function r(t,e){var n="string"==typeof t?t:"<late>",r="string"==typeof t?e:t;return new u(n,r)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),a=n(3),s=n(2),u=function(t){function e(e,n){ | ||
var r=t.call(this,e)||this;return r._subType=null,o.invariant("function"==typeof n&&0===n.length,"Invalid late type, expected a function with zero arguments that returns a type, got: "+n),r.definition=n,r}return i(e,t),Object.defineProperty(e.prototype,"subType",{get:function(){return null===this._subType&&(this._subType=this.definition()),this._subType},enumerable:!0,configurable:!0}),e.prototype.create=function(t,e){return this.subType.create(t,e)},e.prototype.describe=function(){return this.subType.name},e.prototype.validate=function(t,e){return this.subType.is(t)?s.typeCheckSuccess():s.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return this.subType.identifierAttribute},enumerable:!0,configurable:!0}),e}(a.Type);e.Late=u,e.late=r},function(t,e,n){"use strict";function r(t){return a.invariant(a.isPrimitive(t),"Literal types can be built only on top of primitives"),new u(t)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(1),s=n(2),u=function(t){function e(e){var n=t.call(this,""+e)||this;return n.value=e,n}return i(e,t),e.prototype.create=function(t){return s.typecheck(this,t),this.value},e.prototype.describe=function(){return JSON.stringify(this.value)},e.prototype.validate=function(t,e){return a.isPrimitive(t)&&t===this.value?s.typeCheckSuccess():s.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(o.Type);e.Literal=u,e.literal=r},function(t,e){"use strict";function n(t,e){return void 0===e&&(e=""),{targetType:t,basePath:e,isReference:!0}}function r(t){return t.isReference===!0}Object.defineProperty(e,"__esModule",{value:!0}),e.reference=n,e.isReferenceFactory=r},function(t,e,n){"use strict";function r(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=o.isType(t)?null:t,i=o.isType(t)?e.concat(t):e,a=i.map(function(t){return t.name}).join(" | ");return new u(a,i,r)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(2),s=n(1),u=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.dispatcher=null,i.dispatcher=r,i.types=n,i}return i(e,t),e.prototype.describe=function(){return"("+this.types.map(function(t){return t.describe()}).join(" | ")+")"},e.prototype.create=function(t){if(s.invariant(this.is(t),"Value "+JSON.stringify(t)+" is not assignable to union "+this.name),null!==this.dispatcher)return this.dispatcher(t).create(t);var e=this.types.filter(function(e){return e.is(t)});return e.length>1?s.fail("Ambiguos snapshot "+JSON.stringify(t)+" for union "+this.name+". Please provide a dispatch in the union declaration."):e[0].create(t)},e.prototype.validate=function(t,e){return this.types.some(function(e){return e.is(t)})?a.typeCheckSuccess():a.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){var t=this.types[0].identifierAttribute;return t&&this.types.every(function(e){return e.identifierAttribute===t})?t:null},enumerable:!0,configurable:!0}),e}(o.Type);e.Union=u,e.union=r},function(t,e,n){"use strict";var r=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),o=n(6),a=n(1),s=n(11),u=n(2),c=n(7),p=function(){function t(t,e,n,r){return this.owner=t,this.type=e,this.basePath=n,this.identifier=null,n&&(this.targetIdAttribute=s.getIdentifierAttribute(e)||"",!this.targetIdAttribute)?a.fail("Cannot create reference to path '"+n+"'; the targeted type, "+e.describe()+", does not specify an identifier property"):void this.setNewValue(r)}return Object.defineProperty(t.prototype,"get",{get:function(){var t=this,e=t.targetIdAttribute,n=t.identifier;if(null===n)return null;if(this.basePath){var r=c.resolve(this.owner,this.basePath);if(i.isObservableArray(r))return r.find(function(t){return t&&t[e]===n});if(i.isObservableMap(r)){var o=r.get(n);return a.invariant(!o||o[e]===n,"Inconsistent collection, the map entry under key '"+n+"' should have property '"+e+"' set to value '"+n),o}return a.fail("References with base paths should point to either an `array` or `map` collection")}return c.resolve(this.owner,n)},enumerable:!0,configurable:!0}),t.prototype.setNewValue=function(t){if(t)if(o.isMST(t)){u.typecheck(this.type,t);var e=o.getMSTAdministration(this.owner),n=o.getMSTAdministration(t);this.targetIdAttribute?this.identifier=t[this.targetIdAttribute]:(a.invariant(e.root===n.root,"Failed to assign a value to a reference; the value should already be part of the same model tree"),this.identifier=o.getRelativePathForNodes(e,n))}else this.targetIdAttribute?(a.invariant("string"==typeof t,"Expected an identifier, got: "+t),this.identifier=t):(a.invariant("object"==typeof t&&"string"==typeof t.$ref,"Expected a reference in the format `{ $ref: ... }`, got: "+t),this.identifier=t.$ref);else this.identifier=null},t.prototype.serialize=function(){return this.basePath?this.identifier:this.identifier?{$ref:this.identifier}:null},t}();r([i.observable],p.prototype,"identifier",void 0),r([i.computed],p.prototype,"get",null),e.Reference=p},function(t,e,n){"use strict";function r(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];p.invariant(s.isMST(t),"Expected model object");var r={getState:function(){return u.getSnapshot(t)},dispatch:function(e){o(e,a.slice(),function(e){return c.applyAction(t,i(e))})},subscribe:function(e){return u.onSnapshot(t,e)}},a=e.map(function(t){return t(r)});return r}function i(t){var e=p.extend({},t);return delete e.type,{name:t.type,args:[e]}}function o(t,e,n){function r(t){var i=e.shift();i?i(r)(t):n(t)}r(t)}function a(t,e){var n=t.connectViaExtension(),r=!1;n.subscribe(function(n){var i=t.extractState(n);i&&(r=!0,u.applySnapshot(e,i),r=!1)}),c.onAction(e,function(t){if(!r){var i={};i.type=t.name,t.args&&t.args.forEach(function(t,e){return i[e]=t}),n.send(i,u.getSnapshot(e))}})}Object.defineProperty(e,"__esModule",{value:!0});var s=n(5),u=n(7),c=n(14),p=n(1);e.asReduxStore=r,e.connectReduxDevtools=a},function(t,e,n){"use strict";function r(){return c.getMSTAdministration(this)+"("+this.length+" items)"}function i(t){return new d(t.name+"[]",t)}function o(t){return f.isType(t)&&t.isArrayFactory===!0}var a=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),s=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var u=n(4),c=n(5),p=n(1),f=n(3),l=n(2),h=n(10);e.arrayToString=r;var d=function(t){function e(e,n){var r=t.call(this,e)||this;return r.isArrayFactory=!0,r.subType=n,r}return a(e,t),e.prototype.describe=function(){return this.subType.describe()+"[]"},e.prototype.createNewInstance=function(){var t=u.observable.shallowArray();return p.addHiddenFinalProp(t,"toString",r),t},e.prototype.finalizeNewInstance=function(t,e){var n=this;u.intercept(t,function(t){return n.willChange(t)}),u.observe(t,this.didChange),c.getMSTAdministration(t).applySnapshot(e)},e.prototype.getChildMSTs=function(t){var e=t.target,n=[];return e.forEach(function(t,e){c.maybeMST(t,function(t){n.push([""+e,t])})}),n},e.prototype.getChildMST=function(t,e){var n=t.target,r=parseInt(e,10);return r<n.length?c.maybeMST(n[r],p.identity,p.nothing):null},e.prototype.willChange=function(t){var e=c.getMSTAdministration(t.object);switch(e.assertWritable(),t.type){case"update":if(t.newValue===t.object[t.index])return null;t.newValue=e.reconcileChildren(this.subType,[t.object[t.index]],[t.newValue],[t.index])[0];break;case"splice":var n=t.index,r=t.removedCount,i=t.added,o=t.object;t.added=e.reconcileChildren(this.subType,o.slice(n,n+r),i,i.map(function(t,e){return n+e}));for(var a=function(t){c.maybeMST(o[t],function(n){n.setParent(e,""+(t+i.length-r))})},s=n+r;s<o.length;s++)a(s)}return t},e.prototype.serialize=function(t){var e=t.target;return e.map(c.valueToSnapshot)},e.prototype.didChange=function(t){var e=c.getMSTAdministration(t.object);switch(t.type){case"update":return void e.emitPatch({op:"replace",path:""+t.index,value:c.valueToSnapshot(t.newValue)},e);case"splice":for(var n=t.index+t.removedCount-1;n>=t.index;n--)e.emitPatch({op:"remove",path:""+n},e);for(var n=0;n<t.addedCount;n++)e.emitPatch({op:"add",path:""+(t.index+n),value:c.valueToSnapshot(t.added[n])},e);return}},e.prototype.applyPatchLocally=function(t,e,n){var r=t.target,i="-"===e?r.length:parseInt(e);switch(n.op){case"replace":r[i]=n.value;break;case"add":r.splice(i,0,n.value);break;case"remove":r.splice(i,1)}},e.prototype.applySnapshot=function(t,e){t.pseudoAction(function(){var n=t.target;n.replace(e)})},e.prototype.getChildType=function(t){return this.subType},e.prototype.isValidSnapshot=function(t,e){var n=this;return Array.isArray(t)?l.flattenTypeErrors(t.map(function(t,r){return n.subType.validate(t,l.getContextForPath(e,""+r,n.subType))})):l.typeCheckFailure(e,t)},e.prototype.getDefaultSnapshot=function(){return[]},e.prototype.removeChild=function(t,e){t.target.splice(parseInt(e,10),1)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(h.ComplexType);s([u.action],d.prototype,"applySnapshot",null),e.ArrayType=d,e.array=i,e.isArrayFactory=o},function(t,e,n){"use strict";function r(){return f.getMSTAdministration(this)+"("+this.size+" items)"}function i(t){var e=c.getIdentifierAttribute(f.getMSTAdministration(this).type.subType);return l.invariant(!!e,"Map.put is only supported if the subtype has an idenfier attribute"),l.invariant(!!t,"Map.put cannot be used to set empty values"),this.set(t[e],t),this}function o(t){return new v("map<string, "+t.name+">",t)}function a(t){return h.isType(t)&&t.isMapFactory===!0}var s=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),u=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var c=n(11),p=n(4),f=n(5),l=n(1),h=n(3),d=n(2),y=n(10);e.mapToString=r;var v=function(t){function e(e,n){var r=t.call(this,e)||this;return r.isMapFactory=!0,r.subType=n,r}return s(e,t),e.prototype.describe=function(){return"Map<string, "+this.subType.describe()+">"},e.prototype.createNewInstance=function(){var t=p.observable.shallowMap();return l.addHiddenFinalProp(t,"put",i),l.addHiddenFinalProp(t,"toString",r),t},e.prototype.finalizeNewInstance=function(t,e){var n=this;p.intercept(t,function(t){return n.willChange(t)}),p.observe(t,this.didChange),f.getMSTAdministration(t).applySnapshot(e)},e.prototype.getChildMSTs=function(t){var e=[];return t.target.forEach(function(t,n){f.maybeMST(t,function(t){e.push([n,t])})}),e},e.prototype.getChildMST=function(t,e){var n=t.target;return n.has(e)?f.maybeMST(n.get(e),l.identity,l.nothing):null},e.prototype.willChange=function(t){var e=f.getMSTAdministration(t.object);e.assertWritable();var n=c.getIdentifierAttribute(e.type);switch(n&&t.newValue&&"object"==typeof t.newValue&&t.newValue[n]!==t.name&&l.fail("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+t.name+"', but expected: '"+t.newValue[n]+"'"),t.type){case"update":var r=t.newValue,i=t.object.get(t.name);if(r===i)return null;t.newValue=e.reconcileChildren(this.subType,[i],[r],[t.name])[0];break;case"add":var r=t.newValue;t.newValue=e.reconcileChildren(this.subType,[],[r],[t.name])[0];break;case"delete":var i=t.object.get(t.name);e.reconcileChildren(this.subType,[i],[],[])}return t},e.prototype.serialize=function(t){var e=t.target,n={};return e.forEach(function(t,e){n[e]=f.valueToSnapshot(t)}),n},e.prototype.didChange=function(t){var e=f.getMSTAdministration(t.object);switch(t.type){case"update":case"add":return void e.emitPatch({op:"add"===t.type?"add":"replace",path:f.escapeJsonPath(t.name),value:f.valueToSnapshot(t.newValue)},e);case"delete":return void e.emitPatch({op:"remove",path:f.escapeJsonPath(t.name)},e)}},e.prototype.applyPatchLocally=function(t,e,n){var r=t.target;switch(n.op){case"add":case"replace":r.set(e,n.value);break;case"remove":r.delete(e)}},e.prototype.applySnapshot=function(t,e){var n=this;t.pseudoAction(function(){var r=t.target,i=c.getIdentifierAttribute(n.subType),o={};r.keys().forEach(function(t){o[t]=!1}),Object.keys(e).forEach(function(t){var n=e[t];i&&n&&"object"==typeof n&&t!==n[i]&&l.fail("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+t+"', but expected: '"+n[i]+"'"),t in o&&!l.isPrimitive(n)?(o[t]=!0,f.maybeMST(r.get(t),function(t){t.applySnapshot(n)},function(){r.set(t,n)})):r.set(t,n)}),Object.keys(o).forEach(function(t){o[t]===!1&&r.delete(t)})})},e.prototype.getChildType=function(t){return this.subType},e.prototype.isValidSnapshot=function(t,e){var n=this;return l.isPlainObject(t)?d.flattenTypeErrors(Object.keys(t).map(function(r){return n.subType.validate(t[r],d.getContextForPath(e,r,n.subType))})):d.typeCheckFailure(e,t)},e.prototype.getDefaultSnapshot=function(){return{}},e.prototype.removeChild=function(t,e){t.target.delete(e)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(y.ComplexType);u([p.action],v.prototype,"applySnapshot",null),e.MapType=v,e.map=o,e.isMapFactory=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(24),i=n(23),o=n(16),a=n(11),s=n(19),u=n(20),c=n(13),p=n(18),f=n(33),l=n(34),h=n(32),d=n(12),y=n(17);e.types={model:a.model,extend:a.extend,reference:s.reference,union:u.union,optional:c.optional,literal:p.literal,maybe:f.maybe,refinement:l.refinement,string:d.string,boolean:d.boolean,number:d.number,Date:d.DatePrimitive,map:r.map,array:i.array,frozen:h.frozen,identifier:o.identifier,late:y.late}},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=n(5),a=n(8),s=n(2),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.invokeAction=o.createActionInvoker(e,n),r}return r(e,t),e.prototype.initialize=function(t){i.addHiddenFinalProp(t,this.name,this.invokeAction.bind(t))},e.prototype.validate=function(t,e){return this.name in t?s.typeCheckFailure(s.getContextForPath(e,this.name),t[this.name],"Action properties should not be provided in the snapshot"):s.typeCheckSuccess()},e}(a.Property);e.ActionProperty=u},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),o=n(8),a=n(2),s=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.getter=n,i.setter=r,i}return r(e,t),e.prototype.initializePrototype=function(t){Object.defineProperty(t,this.name,i.computed(t,this.name,{get:this.getter,set:this.setter,configurable:!0,enumerable:!1}))},e.prototype.validate=function(t,e){return this.name in t?a.typeCheckFailure(a.getContextForPath(e,this.name),t[this.name],"Computed properties should not be provided in the snapshot"):a.typeCheckSuccess()},e}(o.Property);e.ComputedProperty=s},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(5),o=n(4),a=n(8),s=n(1),u=n(2),c=function(t){function e(e,n){var r=t.call(this,e)||this;return r.subtype=n,r}return r(e,t),e.prototype.initialize=function(t,e){o.extendObservable(t,(n={},n[this.name]=o.observable.ref(e[this.name]),n));var n},e.prototype.willChange=function(t){var e=t.newValue;"number"==typeof e||s.isValidIdentifier(e)||s.fail("Not a valid identifier: '"+e),u.typecheck(this.subtype,e);var n=i.getMSTAdministration(t.object);n.assertWritable();var r=t.object[this.name];return void 0!==r&&r!==e&&s.fail("It is not allowed to change the identifier of an object, got: '"+e+"' but expected: '"+r+"'"),t},e.prototype.serialize=function(t,e){var n=t[this.name];this.isValidIdentifier(n)||s.fail("Object does not have a valid identifier yet: '"+n+"'"),e[this.name]=n},e.prototype.deserialize=function(t,e){t[this.name]=e[this.name]},e.prototype.validate=function(t,e){return this.isValidIdentifier(t[this.name])?u.typeCheckSuccess():u.typeCheckFailure(u.getContextForPath(e,this.name,this.subtype),t[this.name],"The provided identifier is not valid")},e.prototype.isValidIdentifier=function(t){return!("number"!=typeof t&&!s.isValidIdentifier(t))&&this.subtype.is(t)},e}(a.Property);e.IdentifierProperty=c},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(8),o=n(1),a=n(5),s=n(21),u=n(2),c=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.type=n,i.basePath=r,i}return r(e,t),e.prototype.initialize=function(t,e){var n=new s.Reference(t,this.type,this.basePath,e[this.name]);o.addHiddenFinalProp(t,this.name+"$value",n);var r=this;Object.defineProperty(t,this.name,{get:function(){return a.getMSTAdministration(this).assertAlive(),n.get},set:function(t){var e=a.getMSTAdministration(this);e.assertWritable();var i=n.identifier;n.setNewValue(t),n.identifier!==i&&e.emitPatch({op:"replace",path:a.escapeJsonPath(r.name),value:n.serialize},e)}}),t[this.name]=e[this.name]},e.prototype.serialize=function(t,e){e[this.name]=t[this.name+"$value"].serialize()},e.prototype.deserialize=function(t,e){t[this.name+"$value"].setNewValue(e[this.name])},e.prototype.validate=function(t,e){return this.name in t?u.typeCheckSuccess():u.typeCheckFailure(u.getContextForPath(e,this.name,this.type),void 0,"Reference is required.")},e}(i.Property);e.ReferenceProperty=c},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),o=n(8),a=n(5),s=n(2),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.type=n,r}return r(e,t),e.prototype.initializePrototype=function(t){i.observable.ref(t,this.name,{value:void 0})},e.prototype.initialize=function(t,e){t[this.name]=this.type.create(e[this.name])},e.prototype.willChange=function(t){var e=a.getMSTAdministration(t.object);return t.newValue=e.reconcileChildren(this.type,[t.object[t.name]],[t.newValue],[t.name])[0],t},e.prototype.didChange=function(t){var e=a.getMSTAdministration(t.object);e.emitPatch({op:"replace",path:a.escapeJsonPath(this.name),value:a.valueToSnapshot(t.newValue)},e)},e.prototype.serialize=function(t,e){e[this.name]=a.valueToSnapshot(t[this.name])},e.prototype.deserialize=function(t,e){var n=this;a.maybeMST(t[this.name],function(t){t.applySnapshot(e[n.name])},function(){t[n.name]=e[n.name]})},e.prototype.validate=function(t,e){return this.type.validate(t[this.name],s.getContextForPath(e,this.name,this.type))},e}(o.Property);e.ValueProperty=u},function(t,e,n){"use strict";function r(t,e){var n=function(){var t=this,n=arguments,r=s.getMSTAdministration(this);return r.assertAlive(),o.extras.allowStateChanges(!1,function(){return e.apply(t,n)})};return a.createNamedFunction(t,n)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),a=n(1),s=n(5),u=n(8),c=n(2),p=function(t){function e(e,n){var i=t.call(this,e)||this;return i.invokeView=r(e,n),i}return i(e,t),e.prototype.initialize=function(t){a.addHiddenFinalProp(t,this.name,this.invokeView.bind(t))},e.prototype.validate=function(t,e){return this.name in t?c.typeCheckFailure(c.getContextForPath(e,this.name),t[this.name],"View properties should not be provided in the snapshot"):c.typeCheckSuccess()},e}(u.Property);e.ViewProperty=p,e.createViewInvoker=r},function(t,e,n){"use strict";function r(t){return Object.freeze(t),s.isPlainObject(t)&&Object.keys(t).forEach(function(e){Object.isFrozen(t[e])||r(t[e])}),t}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(2),s=n(1),u=function(t){function e(){return t.call(this,"frozen")||this}return i(e,t),e.prototype.describe=function(){return"<any immutable value>"},e.prototype.create=function(t){return s.invariant(s.isSerializable(t),"Given value should be serializable"),s.isMutable(t)?r(t):t},e.prototype.validate=function(t,e){return s.isSerializable(t)?a.typeCheckSuccess():a.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(o.Type);e.Frozen=u,e.frozen=new u},function(t,e,n){"use strict";function r(t){return i.union(s,t)}Object.defineProperty(e,"__esModule",{value:!0});var i=n(20),o=n(18),a=n(13),s=a.optional(o.literal(null),null);e.maybe=r},function(t,e,n){"use strict";function r(t,e,n){var r=e.create();return a.invariant(n(s.isMST(r)?s.getMSTAdministration(r).snapshot:r),"Default value for refinement type "+t+" does not pass the predicate."),new c(t,e,n)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(1),s=n(5),u=n(2),c=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.type=n,i.predicate=r,i}return i(e,t),e.prototype.describe=function(){return this.name},e.prototype.create=function(t){var e=this.type.create(t),n=s.isMST(e)?s.getMSTAdministration(e).snapshot:e;return a.invariant(this.is(n),"Value "+JSON.stringify(n)+" is not assignable to type "+this.name),e},e.prototype.validate=function(t,e){return this.type.is(t)&&this.predicate(t)?u.typeCheckSuccess():u.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return this.type.identifierAttribute},enumerable:!0,configurable:!0}),e}(o.Type);e.Refinement=c,e.refinement=r}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("mobx")):"function"==typeof define&&define.amd?define(["mobx"],e):"object"==typeof exports?exports.mobxStateTree=e(require("mobx")):t.mobxStateTree=e(t.mobx)}(this,function(t){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),n(3),n(10);var i=n(25);e.types=i.types,r(n(7)),r(n(9));var o=n(5);e.isMST=o.isMST,e.getType=o.getType,e.getChildType=o.getChildType,e.onAction=o.onAction,e.applyAction=o.applyAction;var a=n(22);e.asReduxStore=a.asReduxStore,e.connectReduxDevtools=a.connectReduxDevtools},function(t,e){"use strict";function n(t){throw void 0===t&&(t="Illegal state"),r(!1,t),"!"}function r(t,e){if(void 0===e&&(e="Illegal state"),!t)throw new Error("[mobx-state-tree] "+e)}function i(t){return t}function o(){return null}function a(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r++){var i=e[r];for(var o in i)t[o]=i[o]}return t}function s(t){if(null===t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function u(t){return!(null===t||"object"!=typeof t||t instanceof Date||t instanceof RegExp)}function c(t){return null===t||void 0===t||"string"==typeof t||"number"==typeof t||"boolean"==typeof t||t instanceof Date}function p(t){return"function"!=typeof t}function f(t,e,n){Object.defineProperty(t,e,{enumerable:!1,writable:!1,configurable:!0,value:n})}function l(t,e,n){Object.defineProperty(t,e,{enumerable:!1,writable:!0,configurable:!0,value:n})}function h(t,e,n){Object.defineProperty(t,e,{enumerable:!0,writable:!1,configurable:!0,value:n})}function d(t,e){return t.push(e),function(){var n=t.indexOf(e);n!==-1&&t.splice(n,1)}}function y(t,e){return m.call(t,e)}function v(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=t[n];return e}function b(t,e){return new Function("f","return function "+t+"() { return f.apply(this, arguments)}")(e)}function g(t){return"string"==typeof t&&/^[a-z0-9_-]+$/i.test(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.EMPTY_ARRAY=Object.freeze([]),e.fail=n,e.invariant=r,e.identity=i,e.nothing=o,e.extend=a,e.isPlainObject=s,e.isMutable=u,e.isPrimitive=c,e.isSerializable=p,e.addHiddenFinalProp=f,e.addHiddenWritableProp=l,e.addReadOnlyProp=h,e.registerEventHandler=d;var m=Object.prototype.hasOwnProperty;e.hasOwnProperty=y,e.argsToArray=v,e.createNamedFunction=b,e.isValidIdentifier=g},function(t,e,n){"use strict";function r(t){var e=t.value,n=t.context[t.context.length-1].type,r=t.context.map(function(t){var e=t.path;return e}).filter(function(t){return t.length>0}).join("/"),i=r.length>0?'at path "/'+r+'" ':"",o=f.maybeMST(e,function(t){return"value of type "+t.type.name+":"},function(){return p.isPrimitive(e)?"value":"snapshot"}),a=n&&f.isMST(e)&&n.is(f.getMSTAdministration(e).snapshot);return""+i+o+" "+d(e)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(t.message?" ("+t.message+")":"")+(n?l.isPrimitiveType(n)||n instanceof h.OptionalValue&&l.isPrimitiveType(n.type)?".":", expected an instance of `"+n.name+"` or a snapshot like `"+n.describe()+"` instead."+(a?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function i(t){return[{type:t,path:""}]}function o(t,e,n){return t.concat([{path:e,type:n}])}function a(){return p.EMPTY_ARRAY}function s(t,e,n){return[{context:t,value:e,message:n}]}function u(t){return t.reduce(function(t,e){return t.concat(e)},[])}function c(t,e){var n=t.validate(e,[{path:"",type:t}]);n.length>0&&p.fail("Error while converting "+d(e)+" to `"+t.name+"`:\n"+n.map(r).join("\n"))}Object.defineProperty(e,"__esModule",{value:!0});var p=n(1),f=n(6),l=n(12),h=n(13),d=function(t){return f.isMST(t)?"<"+t+">":"`"+JSON.stringify(t)+"`"};e.getDefaultContext=i,e.getContextForPath=o,e.typeCheckSuccess=a,e.typeCheckFailure=s,e.flattenTypeErrors=u,e.typecheck=c},function(t,e,n){"use strict";function r(t){return"object"==typeof t&&t&&t.isType===!0}Object.defineProperty(e,"__esModule",{value:!0}),e.isType=r;var i=function(){function t(t){this.isType=!0,this.name=t}return t.prototype.is=function(t){return 0===this.validate(t,[{path:"",type:this}]).length},Object.defineProperty(t.prototype,"Type",{get:function(){return o.fail("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"SnapshotType",{get:function(){return o.fail("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!0,configurable:!0}),t}();e.Type=i;var o=n(1)},function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),r(n(6)),r(n(15)),r(n(14)),r(n(9)),r(n(7))},function(t,e,n){"use strict";function r(t){return a(t).type}function i(t,e){return a(t).getChildType(e)}function o(t){return t&&t.$treenode}function a(t){return o(t)?t.$treenode:f.fail("element has no Node")}function s(t,e,n){if(f.isMutable(t)&&o(t)){var r=a(t);return e(r,r.target)}return n?n(t):t}function u(t){return t instanceof Date?{$treetype:"Date",time:t.toJSON()}:o(t)?a(t).snapshot:f.isSerializable(t)?t:void f.fail("Unable to convert value to snapshot.")}function c(t,e){f.invariant(t.root===e.root,"Cannot calculate relative path: objects '"+t+"' and '"+e+"' are not part of the same object tree");for(var n=p.splitJsonPath(t.path),r=p.splitJsonPath(e.path),i=0;i<n.length&&n[i]===r[i];i++);return n.slice(i).map(function(t){return".."}).join("/")+p.joinJsonPath(r.slice(i))}Object.defineProperty(e,"__esModule",{value:!0});var p=n(9);e.getType=r,e.getChildType=i,e.isMST=o,e.getMSTAdministration=a,e.maybeMST=s,e.valueToSnapshot=u,e.getRelativePathForNodes=c;var f=n(1)},function(t,e,n){"use strict";function r(t,e){var n=z.getMSTAdministration(t);return n.isProtectionEnabled||console.warn("It is recommended to protect the state tree before attaching action middleware, as otherwise it cannot be guaranteed that all changes are passed through middleware. See `protect`"),n.addMiddleWare(e)}function i(t,e){return z.getMSTAdministration(t).onPatch(e)}function o(t,e){return z.getMSTAdministration(t).onSnapshot(e)}function a(t,e){return z.getMSTAdministration(t).applyPatch(e)}function s(t,e){var n=z.getMSTAdministration(t);I.runInAction(function(){e.forEach(function(t){return n.applyPatch(t)})})}function u(t){var e={patches:[],stop:function(){return n()},replay:function(t){s(t,e.patches)}},n=i(t,function(t){e.patches.push(t)});return e}function c(t,e){I.runInAction(function(){e.forEach(function(e){return R.applyAction(t,e)})})}function p(t){var e={actions:[],stop:function(){return n()},replay:function(t){c(t,e.actions)}},n=R.onAction(t,e.actions.push.bind(e.actions));return e}function f(t){z.getMSTAdministration(t).isProtectionEnabled=!0}function l(t){z.getMSTAdministration(t).isProtectionEnabled=!1}function h(t){return z.getMSTAdministration(t).isProtectionEnabled}function d(t,e){return z.getMSTAdministration(t).applySnapshot(e)}function y(t){return z.getMSTAdministration(t).snapshot}function v(t,e){void 0===e&&(e=1),E.invariant(e>=0,"Invalid depth: "+e+", should be >= 1");for(var n=z.getMSTAdministration(t).parent;n;){if(0===--e)return!0;n=n.parent}return!1}function b(t,e){void 0===e&&(e=1),E.invariant(e>=0,"Invalid depth: "+e+", should be >= 1");for(var n=e,r=z.getMSTAdministration(t).parent;r;){if(0===--n)return r.target;r=r.parent}return E.fail("Failed to find the parent of "+z.getMSTAdministration(t)+" at depth "+e)}function g(t){return z.getMSTAdministration(t).root.target}function m(t){return z.getMSTAdministration(t).path}function _(t){return V.splitJsonPath(z.getMSTAdministration(t).path)}function P(t){return z.getMSTAdministration(t).isRoot}function T(t,e){var n=z.getMSTAdministration(t).resolve(e);return n?n.target:void 0}function A(t,e){var n=z.getMSTAdministration(t).resolve(e,!1);if(void 0!==n)return n?n.target:void 0}function j(t,e){return z.getRelativePathForNodes(z.getMSTAdministration(t),z.getMSTAdministration(e))}function S(t,e){void 0===e&&(e=!0);var n=z.getMSTAdministration(t);return n.type.create(n.snapshot,e===!0?n.root._environment:e===!1?void 0:e)}function O(t){return z.getMSTAdministration(t).detach(),t}function w(t){var e=z.getMSTAdministration(t);e.isRoot?e.die():e.parent.removeChild(e.subpath)}function M(t){return z.getMSTAdministration(t).isAlive}function C(t,e){z.getMSTAdministration(t).addDisposer(e)}function x(t){var e=z.getMSTAdministration(t),n=e.root._environment;return E.invariant(!!n,"Node '"+e+"' is not part of state tree that was initialized with an environment. Environment can be passed as second argumentt to .create()"),n}function k(t,e){var n=z.getMSTAdministration(t);n.getChildMSTs().forEach(function(t){var n=(t[0],t[1]);k(n.target,e)}),e(n.target)}function F(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=t.create(e);return c(i,n),y(i)}Object.defineProperty(e,"__esModule",{value:!0});var R=n(14),I=n(4),z=n(6),V=n(9),E=n(1);e.addMiddleware=r,e.onPatch=i,e.onSnapshot=o,e.applyPatch=a,e.applyPatches=s,e.recordPatches=u,e.applyActions=c,e.recordActions=p,e.protect=f,e.unprotect=l,e.isProtected=h,e.applySnapshot=d,e.getSnapshot=y,e.hasParent=v,e.getParent=b,e.getRoot=g,e.getPath=m,e.getPathParts=_,e.isRoot=P,e.resolve=T,e.tryResolve=A,e.getRelativePath=j,e.clone=S,e.detach=O,e.destroy=w,e.isAlive=M,e.addDisposer=C,e.getEnv=x,e.walk=k,e.testActions=F},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){this.name=t}return t.prototype.initializePrototype=function(t){},t.prototype.initialize=function(t,e){},t.prototype.willChange=function(t){return null},t.prototype.didChange=function(t){},t.prototype.serialize=function(t,e){},t.prototype.deserialize=function(t,e){},t}();e.Property=n},function(t,e){"use strict";function n(t){return t.replace(/~/g,"~1").replace(/\//g,"~0")}function r(t){return t.replace(/~0/g,"\\").replace(/~1/g,"~")}function i(t){return 0===t.length?"":"/"+t.map(n).join("/")}function o(t){var e=t.split("/").map(r);return""===e[0]?e.slice(1):e}Object.defineProperty(e,"__esModule",{value:!0}),e.escapeJsonPath=n,e.unescapeJsonPath=r,e.joinJsonPath=i,e.splitJsonPath=o},function(t,e,n){"use strict";function r(){return p.getMSTAdministration(this).snapshot}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),a=n(3),s=n(1),u=n(2),c=function(t){function e(e){var n=t.call(this,e)||this;return n.create=o.action(n.name,n.create),n}return i(e,t),e.prototype.create=function(t,e,n,i){var o=this;void 0===t&&(t=this.getDefaultSnapshot()),void 0===e&&(e=void 0),void 0===n&&(n=null),void 0===i&&(i=""),u.typecheck(this,t);var a=this.createNewInstance(),c=new f.MSTAdministration(n,i,a,this,e),p=!0;try{return c.pseudoAction(function(){o.finalizeNewInstance(a,t)}),s.addReadOnlyProp(a,"toJSON",r),c.fireHook("afterCreate"),n&&c.fireHook("afterAttach"),p=!1,a}finally{p&&(c._isAlive=!1)}},e.prototype.validate=function(t,e){return t&&"object"==typeof t?p.isMST(t)?p.getType(t)===this?u.typeCheckSuccess():u.typeCheckFailure(e,t):this.isValidSnapshot(t,e):u.typeCheckFailure(e,t)},e}(a.Type);e.ComplexType=c;var p=n(6),f=n(15)},function(t,e,n){"use strict";function r(){return h.getMSTAdministration(this).toString()}function i(t,e,n){var r="string"==typeof t?t:"AnonymousModel",i="string"==typeof t?e:t,o="string"==typeof t?n:e;return new M(r,i,o||{})}function o(t){var e=d.isType(t)?t:h.getType(t);return s(e)?e.baseModel:{}}function a(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];console.warn("[mobx-state-tree] `extend` is an experimental feature and it's behavior will probably change in the future");var n="string"==typeof t[0]?t.slice(1):t,r="string"==typeof t[0]?t[0]:n.map(function(t){return t.name}).join("_");return i(r,l.extend.apply(null,[{}].concat(n.map(o))))}function s(t){return d.isType(t)&&t.isObjectFactory===!0}function u(t){return t instanceof M?t.identifierAttribute:t instanceof P.Late?t.definition().identifierAttribute:null}var c=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),p=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var f=n(4),l=n(1),h=n(5),d=n(3),y=n(2),v=n(10),b=n(12),g=n(13),m=n(19),_=n(16),P=n(17),T=n(28),A=n(29),j=n(27),S=n(30),O=n(26),w=n(31),M=function(t){function e(e,n,i){var o=t.call(this,e)||this;return o.isObjectFactory=!0,o.props={},o.identifierAttribute=null,o.didChange=function(t){o.props[t.name].didChange(t)},Object.freeze(n),Object.freeze(i),o.baseModel=n,o.baseActions=i,l.invariant(/^\w[\w\d_]*$/.test(e),"Typename should be a valid identifier: "+e),o.modelConstructor=new Function("return function "+e+" (){}")(),o.modelConstructor.prototype.toString=r,o.parseModelProps(),o.forAllProps(function(t){return t.initializePrototype(o.modelConstructor.prototype)}),o}return c(e,t),e.prototype.createNewInstance=function(){var t=new this.modelConstructor;return f.extendShallowObservable(t,{}),t},e.prototype.finalizeNewInstance=function(t,e){var n=this;f.intercept(t,function(t){return n.willChange(t)}),f.observe(t,this.didChange),this.forAllProps(function(n){return n.initialize(t,e)})},e.prototype.willChange=function(t){var e=h.getMSTAdministration(t.object);return e.assertWritable(),this.props[t.name].willChange(t)},e.prototype.parseModelProps=function(){var t=this,e=t.baseModel,n=t.baseActions;for(var r in e)if(l.hasOwnProperty(e,r)){var i=Object.getOwnPropertyDescriptor(e,r);if("get"in i){this.props[r]=new j.ComputedProperty(r,i.get,i.set);continue}var o=i.value;if(null===o)l.fail("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");else if(_.isIdentifierFactory(o))l.invariant(!this.identifierAttribute,"Cannot define property '"+r+"' as object identifier, property '"+this.identifierAttribute+"' is already defined as identifier property"),this.identifierAttribute=r,this.props[r]=new T.IdentifierProperty(r,o.primitiveType);else if(l.isPrimitive(o)){var a=b.getPrimitiveFactoryFromValue(o);this.props[r]=new S.ValueProperty(r,g.optional(a,o))}else d.isType(o)?this.props[r]=new S.ValueProperty(r,o):m.isReferenceFactory(o)?this.props[r]=new A.ReferenceProperty(r,o.targetType,o.basePath):"function"==typeof o?this.props[r]=new w.ViewProperty(r,o):"object"==typeof o?l.fail("In property '"+r+"': base model's should not contain complex values: '"+o+"'"):l.fail("Unexpected value for property '"+r+"'")}for(var r in n)if(l.hasOwnProperty(n,r)){var o=n[r];r in this.baseModel&&l.fail("Property '"+r+"' was also defined as action. Actions and properties should not collide"),"function"==typeof o?this.props[r]=new O.ActionProperty(r,o):l.fail("Unexpected value for action '"+r+"'. Expected function, got "+typeof o)}},e.prototype.getChildMSTs=function(t){var e=[];return this.forAllProps(function(n){n instanceof S.ValueProperty&&h.maybeMST(t.target[n.name],function(t){return e.push([n.name,t])})}),e},e.prototype.getChildMST=function(t,e){return h.maybeMST(t.target[e],l.identity,l.nothing)},e.prototype.serialize=function(t){var e={};return this.forAllProps(function(n){return n.serialize(t.target,e)}),e},e.prototype.applyPatchLocally=function(t,e,n){l.invariant("replace"===n.op||"add"===n.op),t.target[e]=n.value},e.prototype.applySnapshot=function(t,e){var n=this;t.pseudoAction(function(){for(var r in n.props)n.props[r].deserialize(t.target,e)})},e.prototype.getChildType=function(t){return this.props[t].type},e.prototype.isValidSnapshot=function(t,e){var n=this;return l.isPlainObject(t)?y.flattenTypeErrors(Object.keys(this.props).map(function(r){return n.props[r].validate(t,e)})):y.typeCheckFailure(e,t)},e.prototype.forAllProps=function(t){var e=this;Object.keys(this.props).forEach(function(n){return t(e.props[n])})},e.prototype.describe=function(){var t=this;return"{ "+Object.keys(this.props).map(function(e){var n=t.props[e];return n instanceof S.ValueProperty?e+": "+n.type.describe():n instanceof T.IdentifierProperty?e+": identifier":""}).filter(Boolean).join("; ")+" }"},e.prototype.getDefaultSnapshot=function(){return{}},e.prototype.removeChild=function(t,e){t.target[e]=null},e}(v.ComplexType);p([f.action],M.prototype,"applySnapshot",null),e.ObjectType=M,e.model=i,e.extend=a,e.isObjectFactory=s,e.getIdentifierAttribute=u},function(t,e,n){"use strict";function r(t){switch(typeof t){case"string":return e.string;case"number":return e.number;case"boolean":return e.boolean;case"object":if(t instanceof Date)return e.DatePrimitive}return u.fail("Cannot determine primtive type from value "+t)}function i(t){return t instanceof c}var o=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var a=n(3),s=n(2),u=n(1),c=function(t){function e(e,n){var r=t.call(this,e)||this;return r.checker=n,r}return o(e,t),e.prototype.describe=function(){return this.name},e.prototype.create=function(t){return u.invariant(u.isPrimitive(t),"Not a primitive: '"+t+"'"),u.invariant(this.checker(t),"Value is not assignable to '"+this.name+"'"),t},e.prototype.validate=function(t,e){return u.isPrimitive(t)&&this.checker(t)?s.typeCheckSuccess():s.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(a.Type);e.CoreType=c,e.string=new c("string",function(t){return"string"==typeof t}),e.number=new c("number",function(t){return"number"==typeof t}),e.boolean=new c("boolean",function(t){return"boolean"==typeof t}),e.DatePrimitive=new c("Date",function(t){return t instanceof Date}),e.getPrimitiveFactoryFromValue=r,e.isPrimitiveType=i},function(t,e,n){"use strict";function r(t,e){var n="function"==typeof e?e():e,r=u.isMST(n)?u.getMSTAdministration(n).snapshot:n;return a.typecheck(t,r),new s(t,e)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(2),s=function(t){function e(e,n){var r=t.call(this,e.name)||this;return r.type=e,r.defaultValue=n,r}return i(e,t),e.prototype.describe=function(){return this.type.describe()+"?"},e.prototype.create=function(t){if("undefined"==typeof t){var e="function"==typeof this.defaultValue?this.defaultValue():this.defaultValue,n=u.isMST(e)?u.getMSTAdministration(e).snapshot:e;return this.type.create(n)}return this.type.create(t)},e.prototype.validate=function(t,e){return void 0===t||this.type.is(t)?a.typeCheckSuccess():a.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return this.type.identifierAttribute},enumerable:!0,configurable:!0}),e}(o.Type);e.OptionalValue=s,e.optional=r;var u=n(6)},function(t,e,n){"use strict";function r(t){return t.object[t.name].apply(t.object,t.args)}function i(t){for(var e=t.middlewares.slice(),n=t;n.parent;)n=n.parent,e=e.concat(n.middlewares);return e}function o(t,e){function n(t){var e=o.shift();return e?e(t,n):r(t)}var o=i(t);return o.length?n(e):r(e)}function a(t,e){var n=f.action(t,e),r=function(){var e=l.getMSTAdministration(this);if(e.assertAlive(),e.isRunningAction())return n.apply(this,arguments);var r={name:t,object:e.target,args:d.argsToArray(arguments)},i=e.root;i._isRunningAction=!0;try{return o(e,r)}finally{i._isRunningAction=!1}};return d.createNamedFunction(t,r)}function s(t,e,n,r){if(d.isPrimitive(r))return r;if(l.isMST(r)){var i=l.getMSTAdministration(r);if(t.root!==i.root)throw new Error("Argument "+n+" that was passed to action '"+e+"' is a model that is not part of the same state tree. Consider passing a snapshot or some representative ID instead");return{$ref:l.getRelativePathForNodes(t,l.getMSTAdministration(r))}}if("function"==typeof r)throw new Error("Argument "+n+" that was passed to action '"+e+"' should be a primitive, model object or plain object, received a function");if("object"==typeof r&&!d.isPlainObject(r)&&!Array.isArray(r))throw new Error("Argument "+n+" that was passed to action '"+e+"' should be a primitive, model object or plain object, received a "+(r&&r.constructor?r.constructor.name:"Complex Object"));if(f.isObservable(r))throw new Error("Argument "+n+" that was passed to action '"+e+"' should be a primitive, model object or plain object, received an mobx observable.");try{return JSON.stringify(r),r}catch(t){throw new Error("Argument "+n+" that was passed to action '"+e+"' is not serializable.")}}function u(t,e){if("object"==typeof e){var n=Object.keys(e);if(1===n.length&&"$ref"===n[0])return h.resolve(t.target,e.$ref)}return e}function c(t,e){var n=h.tryResolve(t,e.path||"");if(!n)return d.fail("Invalid action path: "+(e.path||""));var r=l.getMSTAdministration(n);return d.invariant("function"==typeof n[e.name],"Action '"+e.name+"' does not exist in '"+r.path+"'"),n[e.name].apply(n,e.args?e.args.map(function(t){return u(r,t)}):[])}function p(t,e){return h.addMiddleware(t,function(n,r){var i=l.getMSTAdministration(n.object);return e({name:n.name,path:l.getRelativePathForNodes(l.getMSTAdministration(t),i),args:n.args.map(function(t,e){return s(i,n.name,e,t)})}),r(n)})}Object.defineProperty(e,"__esModule",{value:!0});var f=n(4);e.createActionInvoker=a,e.applyAction=c,e.onAction=p;var l=n(6),h=n(7),d=n(1)},function(t,e,n){"use strict";var r=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),o=n(2),a=n(6),s=n(1),u=n(9),c=n(11),p=n(10),f=1,l=function(){function t(t,e,n,r,o){var a=this;this.nodeId=++f,this._parent=null,this.subpath="",this.isProtectionEnabled=!0,this._environment=void 0,this._isRunningAction=!1,this._isAlive=!0,this._isDetaching=!1,this.middlewares=[],this.snapshotSubscribers=[],this.patchSubscribers=[],this.disposers=[],s.invariant(r instanceof p.ComplexType,"Uh oh"),s.addHiddenFinalProp(n,"$treenode",this),this._parent=t,this.subpath=e,this.type=r,this.target=n,this._environment=o;var u=i.reaction(function(){return a.snapshot},function(t){a.snapshotSubscribers.forEach(function(e){return e(t)})});u.onError(function(t){throw t}),this.addDisposer(u)}return Object.defineProperty(t.prototype,"path",{get:function(){return this.parent?this.parent.path+"/"+u.escapeJsonPath(this.subpath):""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRoot",{get:function(){return null===this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){for(var t,e=this;t=e.parent;)e=t;return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAlive",{get:function(){return this._isAlive},enumerable:!0,configurable:!0}),t.prototype.die=function(){this._isDetaching||(h.walk(this.target,function(t){return a.getMSTAdministration(t).aboutToDie()}),h.walk(this.target,function(t){return a.getMSTAdministration(t).finalizeDeath()}))},t.prototype.aboutToDie=function(){this.disposers.splice(0).forEach(function(t){return t()}),this.fireHook("beforeDestroy")},t.prototype.finalizeDeath=function(){var t=this,e=this.path;s.addReadOnlyProp(this,"snapshot",this.snapshot),this.patchSubscribers.splice(0),this.snapshotSubscribers.splice(0),this.patchSubscribers.splice(0),this._isAlive=!1,this._parent=null,this.subpath="",Object.defineProperty(this.target,"$mobx",{get:function(){s.fail("This object has died and is no longer part of a state tree. It cannot be used anymore. The object (of type '"+t.type.name+"') used to live at '"+e+"'. It is possible to access the last snapshot of this object using 'getSnapshot', or to create a fresh copy using 'clone'. If you want to remove an object from the tree without killing it, use 'detach' instead.")}})},t.prototype.assertAlive=function(){this._isAlive||s.fail(this+" cannot be used anymore as it has died; it has been removed from a state tree. If you want to remove an element from a tree and let it live on, use 'detach' or 'clone' the value")},Object.defineProperty(t.prototype,"snapshot",{get:function(){if(this._isAlive)return Object.freeze(this.type.serialize(this))},enumerable:!0,configurable:!0}),t.prototype.onSnapshot=function(t){return s.registerEventHandler(this.snapshotSubscribers,t)},t.prototype.applySnapshot=function(t){return o.typecheck(this.type,t),this.type.applySnapshot(this,t)},t.prototype.applyPatch=function(t){var e=u.splitJsonPath(t.path),n=this.resolvePath(e.slice(0,-1));n.pseudoAction(function(){n.applyPatchLocally(e[e.length-1],t)})},t.prototype.applyPatchLocally=function(t,e){this.assertWritable(),this.type.applyPatchLocally(this,t,e)},t.prototype.onPatch=function(t){return s.registerEventHandler(this.patchSubscribers,t)},t.prototype.emitPatch=function(t,e){if(this.patchSubscribers.length){var n=s.extend({},t,{path:e.path.substr(this.path.length)+"/"+t.path});this.patchSubscribers.forEach(function(t){return t(n)})}this.parent&&this.parent.emitPatch(t,e)},t.prototype.setParent=function(t,e){void 0===e&&(e=null),this.parent===t&&this.subpath===e||(this._parent&&t&&t!==this._parent&&s.fail("A node cannot exists twice in the state tree. Failed to add "+this+" to path '"+t.path+"/"+e+"'."),!this._parent&&t&&t.root===this&&s.fail("A state tree is not allowed to contain itself. Cannot assign "+this+" to path '"+t.path+"/"+e+"'"),!this._parent&&this._environment&&s.fail("A state tree that has been initialized with an environment cannot be made part of another state tree."),this.parent&&!t?this.die():(this._parent=t,this.subpath=e||"",this.fireHook("afterAttach")))},t.prototype.addDisposer=function(t){this.disposers.unshift(t)},t.prototype.reconcileChildren=function(t,e,n,r){var i=this,u=new Array(n.length),p={},f={},l=c.getIdentifierAttribute(t);e.forEach(function(t){if(t){if(l){var e=t[l];e&&(f[e]=t)}a.isMST(t)&&(p[a.getMSTAdministration(t).nodeId]=t)}}),n.forEach(function(e,n){var c=""+r[n];if(a.isMST(e)){var h=a.getMSTAdministration(e);if(h.assertAlive(),h.parent&&(h.parent!==i||!p[h.nodeId]))return s.fail("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '"+i.path+"/"+c+"', but it lives already at '"+h.path+"'");p[h.nodeId]=void 0,h.setParent(i,c),u[n]=e}else if(l&&s.isMutable(e)){o.typecheck(t,e);var d=e[l],y=f[d],h=y&&a.getMSTAdministration(y);y&&h.type.is(e)?(p[h.nodeId]=void 0,h.setParent(i,c),h.applySnapshot(e),u[n]=y):u[n]=t.create(e,void 0,i,c)}else o.typecheck(t,e),u[n]=t.create(e,void 0,i,c)});for(var h in p)p[h]&&a.getMSTAdministration(p[h]).die();return u},t.prototype.resolve=function(t,e){return void 0===e&&(e=!0),this.resolvePath(u.splitJsonPath(t),e)},t.prototype.resolvePath=function(t,e){void 0===e&&(e=!0),this.assertAlive();for(var n=this,r=0;r<t.length;r++){if(""===t[r])n=n.root;else if(".."===t[r])n=n.parent;else{if("."===t[r]||""===t[r])continue;n=n.getChildMST(t[r])}if(null===n)return e?s.fail("Could not resolve '"+t[r]+"' in '"+u.joinJsonPath(t.slice(0,r-1))+"', path of the patch does not resolve"):void 0}return n},t.prototype.isRunningAction=function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()},t.prototype.addMiddleWare=function(t){return s.registerEventHandler(this.middlewares,t)},t.prototype.getChildMST=function(t){return this.assertAlive(),this.type.getChildMST(this,t)},t.prototype.getChildMSTs=function(){return this.type.getChildMSTs(this)},t.prototype.getChildType=function(t){return this.type.getChildType(t)},Object.defineProperty(t.prototype,"isProtected",{get:function(){for(var t=this;t;){if(t.isProtectionEnabled===!1)return!1;t=t.parent}return!0},enumerable:!0,configurable:!0}),t.prototype.pseudoAction=function(t){var e=this._isRunningAction;this._isRunningAction=!0,t(),this._isRunningAction=e},t.prototype.assertWritable=function(){this.assertAlive(),!this.isRunningAction()&&this.isProtected&&s.fail("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")},t.prototype.removeChild=function(t){this.type.removeChild(this,t)},t.prototype.detach=function(){s.invariant(this._isAlive),this.isRoot||(this.fireHook("beforeDetach"),this._environment=this.root._environment,this._isDetaching=!0,this.parent.removeChild(this.subpath),this._parent=null,this.subpath="",this._isDetaching=!1)},t.prototype.fireHook=function(t){var e=this.target[t];"function"==typeof e&&e.apply(this.target)},t.prototype.toString=function(){var t=c.getIdentifierAttribute(this.type),e=t?"("+t+": "+this.target[t]+")":"";return this.type.name+"@"+(this.path||"<root>")+e+(this.isAlive?"":"[dead]")},t}();r([i.observable],l.prototype,"_parent",void 0),r([i.observable],l.prototype,"subpath",void 0),r([i.computed],l.prototype,"path",null),r([i.computed],l.prototype,"snapshot",null),r([i.action],l.prototype,"applyPatch",null),e.MSTAdministration=l;var h=n(7)},function(t,e,n){"use strict";function r(t){return void 0===t&&(t=o.string),t!==o.string&&t!==o.number&&a.fail("Only 'types.number' and 'types.string' are acceptable as type specification for identifiers"),{isIdentifier:!0,primitiveType:t}}function i(t){return"object"==typeof t&&t&&t.isIdentifier===!0}Object.defineProperty(e,"__esModule",{value:!0});var o=n(12),a=n(1);e.identifier=r,e.isIdentifierFactory=i},function(t,e,n){"use strict";function r(t,e){var n="string"==typeof t?t:"<late>",r="string"==typeof t?e:t;return new u(n,r)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),a=n(3),s=n(2),u=function(t){ | ||
function e(e,n){var r=t.call(this,e)||this;return r._subType=null,o.invariant("function"==typeof n&&0===n.length,"Invalid late type, expected a function with zero arguments that returns a type, got: "+n),r.definition=n,r}return i(e,t),Object.defineProperty(e.prototype,"subType",{get:function(){return null===this._subType&&(this._subType=this.definition()),this._subType},enumerable:!0,configurable:!0}),e.prototype.create=function(t,e){return this.subType.create(t,e)},e.prototype.describe=function(){return this.subType.name},e.prototype.validate=function(t,e){return this.subType.is(t)?s.typeCheckSuccess():s.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return this.subType.identifierAttribute},enumerable:!0,configurable:!0}),e}(a.Type);e.Late=u,e.late=r},function(t,e,n){"use strict";function r(t){return a.invariant(a.isPrimitive(t),"Literal types can be built only on top of primitives"),new u(t)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(1),s=n(2),u=function(t){function e(e){var n=t.call(this,""+e)||this;return n.value=e,n}return i(e,t),e.prototype.create=function(t){return s.typecheck(this,t),this.value},e.prototype.describe=function(){return JSON.stringify(this.value)},e.prototype.validate=function(t,e){return a.isPrimitive(t)&&t===this.value?s.typeCheckSuccess():s.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(o.Type);e.Literal=u,e.literal=r},function(t,e){"use strict";function n(t,e){return void 0===e&&(e=""),{targetType:t,basePath:e,isReference:!0}}function r(t){return t.isReference===!0}Object.defineProperty(e,"__esModule",{value:!0}),e.reference=n,e.isReferenceFactory=r},function(t,e,n){"use strict";function r(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=o.isType(t)?null:t,i=o.isType(t)?e.concat(t):e,a=i.map(function(t){return t.name}).join(" | ");return new u(a,i,r)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(2),s=n(1),u=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.dispatcher=null,i.dispatcher=r,i.types=n,i}return i(e,t),e.prototype.describe=function(){return"("+this.types.map(function(t){return t.describe()}).join(" | ")+")"},e.prototype.create=function(t){if(a.typecheck(this,t),null!==this.dispatcher)return this.dispatcher(t).create(t);var e=this.types.filter(function(e){return e.is(t)});return e.length>1?s.fail("Ambiguos snapshot "+JSON.stringify(t)+" for union "+this.name+". Please provide a dispatch in the union declaration."):e[0].create(t)},e.prototype.validate=function(t,e){if(null!==this.dispatcher)return this.dispatcher(t).validate(t,e);var n=this.types.map(function(n){return n.validate(t,e)}),r=n.filter(function(t){return 0===t.length});return r.length>1?a.typeCheckFailure(e,t,"Multiple types are applicable and no dispatch method is defined for the union"):r.length<1?a.typeCheckFailure(e,t,"No type is applicable and no dispatch method is defined for the union").concat(a.flattenTypeErrors(n)):a.typeCheckSuccess()},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){var t=this.types[0].identifierAttribute;return t&&this.types.every(function(e){return e.identifierAttribute===t})?t:null},enumerable:!0,configurable:!0}),e}(o.Type);e.Union=u,e.union=r},function(t,e,n){"use strict";var r=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),o=n(6),a=n(1),s=n(11),u=n(2),c=n(7),p=function(){function t(t,e,n,r){return this.owner=t,this.type=e,this.basePath=n,this.identifier=null,n&&(this.targetIdAttribute=s.getIdentifierAttribute(e)||"",!this.targetIdAttribute)?a.fail("Cannot create reference to path '"+n+"'; the targeted type, "+e.describe()+", does not specify an identifier property"):void this.setNewValue(r)}return Object.defineProperty(t.prototype,"get",{get:function(){var t=this,e=t.targetIdAttribute,n=t.identifier;if(null===n)return null;if(this.basePath){var r=c.resolve(this.owner,this.basePath);if(i.isObservableArray(r))return r.find(function(t){return t&&t[e]===n});if(i.isObservableMap(r)){var o=r.get(n);return a.invariant(!o||o[e]===n,"Inconsistent collection, the map entry under key '"+n+"' should have property '"+e+"' set to value '"+n),o}return a.fail("References with base paths should point to either an `array` or `map` collection")}return c.resolve(this.owner,n)},enumerable:!0,configurable:!0}),t.prototype.setNewValue=function(t){if(t)if(o.isMST(t)){u.typecheck(this.type,t);var e=o.getMSTAdministration(this.owner),n=o.getMSTAdministration(t);this.targetIdAttribute?this.identifier=t[this.targetIdAttribute]:(a.invariant(e.root===n.root,"Failed to assign a value to a reference; the value should already be part of the same model tree"),this.identifier=o.getRelativePathForNodes(e,n))}else this.targetIdAttribute?(a.invariant("string"==typeof t,"Expected an identifier, got: "+t),this.identifier=t):(a.invariant("object"==typeof t&&"string"==typeof t.$ref,"Expected a reference in the format `{ $ref: ... }`, got: "+t),this.identifier=t.$ref);else this.identifier=null},t.prototype.serialize=function(){return this.basePath?this.identifier:this.identifier?{$ref:this.identifier}:null},t}();r([i.observable],p.prototype,"identifier",void 0),r([i.computed],p.prototype,"get",null),e.Reference=p},function(t,e,n){"use strict";function r(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];p.invariant(s.isMST(t),"Expected model object");var r={getState:function(){return u.getSnapshot(t)},dispatch:function(e){o(e,a.slice(),function(e){return c.applyAction(t,i(e))})},subscribe:function(e){return u.onSnapshot(t,e)}},a=e.map(function(t){return t(r)});return r}function i(t){var e=p.extend({},t);return delete e.type,{name:t.type,args:[e]}}function o(t,e,n){function r(t){var i=e.shift();i?i(r)(t):n(t)}r(t)}function a(t,e){var n=t.connectViaExtension(),r=!1;n.subscribe(function(n){var i=t.extractState(n);i&&(r=!0,u.applySnapshot(e,i),r=!1)}),c.onAction(e,function(t){if(!r){var i={};i.type=t.name,t.args&&t.args.forEach(function(t,e){return i[e]=t}),n.send(i,u.getSnapshot(e))}})}Object.defineProperty(e,"__esModule",{value:!0});var s=n(5),u=n(7),c=n(14),p=n(1);e.asReduxStore=r,e.connectReduxDevtools=a},function(t,e,n){"use strict";function r(){return c.getMSTAdministration(this)+"("+this.length+" items)"}function i(t){return new d(t.name+"[]",t)}function o(t){return f.isType(t)&&t.isArrayFactory===!0}var a=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),s=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var u=n(4),c=n(5),p=n(1),f=n(3),l=n(2),h=n(10);e.arrayToString=r;var d=function(t){function e(e,n){var r=t.call(this,e)||this;return r.isArrayFactory=!0,r.subType=n,r}return a(e,t),e.prototype.describe=function(){return this.subType.describe()+"[]"},e.prototype.createNewInstance=function(){var t=u.observable.shallowArray();return p.addHiddenFinalProp(t,"toString",r),t},e.prototype.finalizeNewInstance=function(t,e){var n=this;u.intercept(t,function(t){return n.willChange(t)}),u.observe(t,this.didChange),c.getMSTAdministration(t).applySnapshot(e)},e.prototype.getChildMSTs=function(t){var e=t.target,n=[];return e.forEach(function(t,e){c.maybeMST(t,function(t){n.push([""+e,t])})}),n},e.prototype.getChildMST=function(t,e){var n=t.target,r=parseInt(e,10);return r<n.length?c.maybeMST(n[r],p.identity,p.nothing):null},e.prototype.willChange=function(t){var e=c.getMSTAdministration(t.object);switch(e.assertWritable(),t.type){case"update":if(t.newValue===t.object[t.index])return null;t.newValue=e.reconcileChildren(this.subType,[t.object[t.index]],[t.newValue],[t.index])[0];break;case"splice":var n=t.index,r=t.removedCount,i=t.added,o=t.object;t.added=e.reconcileChildren(this.subType,o.slice(n,n+r),i,i.map(function(t,e){return n+e}));for(var a=function(t){c.maybeMST(o[t],function(n){n.setParent(e,""+(t+i.length-r))})},s=n+r;s<o.length;s++)a(s)}return t},e.prototype.serialize=function(t){var e=t.target;return e.map(c.valueToSnapshot)},e.prototype.didChange=function(t){var e=c.getMSTAdministration(t.object);switch(t.type){case"update":return void e.emitPatch({op:"replace",path:""+t.index,value:c.valueToSnapshot(t.newValue)},e);case"splice":for(var n=t.index+t.removedCount-1;n>=t.index;n--)e.emitPatch({op:"remove",path:""+n},e);for(var n=0;n<t.addedCount;n++)e.emitPatch({op:"add",path:""+(t.index+n),value:c.valueToSnapshot(t.added[n])},e);return}},e.prototype.applyPatchLocally=function(t,e,n){var r=t.target,i="-"===e?r.length:parseInt(e);switch(n.op){case"replace":r[i]=n.value;break;case"add":r.splice(i,0,n.value);break;case"remove":r.splice(i,1)}},e.prototype.applySnapshot=function(t,e){t.pseudoAction(function(){var n=t.target;n.replace(e)})},e.prototype.getChildType=function(t){return this.subType},e.prototype.isValidSnapshot=function(t,e){var n=this;return Array.isArray(t)?l.flattenTypeErrors(t.map(function(t,r){return n.subType.validate(t,l.getContextForPath(e,""+r,n.subType))})):l.typeCheckFailure(e,t)},e.prototype.getDefaultSnapshot=function(){return[]},e.prototype.removeChild=function(t,e){t.target.splice(parseInt(e,10),1)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(h.ComplexType);s([u.action],d.prototype,"applySnapshot",null),e.ArrayType=d,e.array=i,e.isArrayFactory=o},function(t,e,n){"use strict";function r(){return f.getMSTAdministration(this)+"("+this.size+" items)"}function i(t){var e=c.getIdentifierAttribute(f.getMSTAdministration(this).type.subType);return l.invariant(!!e,"Map.put is only supported if the subtype has an idenfier attribute"),l.invariant(!!t,"Map.put cannot be used to set empty values"),this.set(t[e],t),this}function o(t){return new v("map<string, "+t.name+">",t)}function a(t){return h.isType(t)&&t.isMapFactory===!0}var s=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),u=this&&this.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};Object.defineProperty(e,"__esModule",{value:!0});var c=n(11),p=n(4),f=n(5),l=n(1),h=n(3),d=n(2),y=n(10);e.mapToString=r;var v=function(t){function e(e,n){var r=t.call(this,e)||this;return r.isMapFactory=!0,r.subType=n,r}return s(e,t),e.prototype.describe=function(){return"Map<string, "+this.subType.describe()+">"},e.prototype.createNewInstance=function(){var t=p.observable.shallowMap();return l.addHiddenFinalProp(t,"put",i),l.addHiddenFinalProp(t,"toString",r),t},e.prototype.finalizeNewInstance=function(t,e){var n=this;p.intercept(t,function(t){return n.willChange(t)}),p.observe(t,this.didChange),f.getMSTAdministration(t).applySnapshot(e)},e.prototype.getChildMSTs=function(t){var e=[];return t.target.forEach(function(t,n){f.maybeMST(t,function(t){e.push([n,t])})}),e},e.prototype.getChildMST=function(t,e){var n=t.target;return n.has(e)?f.maybeMST(n.get(e),l.identity,l.nothing):null},e.prototype.willChange=function(t){var e=f.getMSTAdministration(t.object);e.assertWritable();var n=c.getIdentifierAttribute(e.type);switch(n&&t.newValue&&"object"==typeof t.newValue&&t.newValue[n]!==t.name&&l.fail("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+t.name+"', but expected: '"+t.newValue[n]+"'"),t.type){case"update":var r=t.newValue,i=t.object.get(t.name);if(r===i)return null;t.newValue=e.reconcileChildren(this.subType,[i],[r],[t.name])[0];break;case"add":var r=t.newValue;t.newValue=e.reconcileChildren(this.subType,[],[r],[t.name])[0];break;case"delete":var i=t.object.get(t.name);e.reconcileChildren(this.subType,[i],[],[])}return t},e.prototype.serialize=function(t){var e=t.target,n={};return e.forEach(function(t,e){n[e]=f.valueToSnapshot(t)}),n},e.prototype.didChange=function(t){var e=f.getMSTAdministration(t.object);switch(t.type){case"update":case"add":return void e.emitPatch({op:"add"===t.type?"add":"replace",path:f.escapeJsonPath(t.name),value:f.valueToSnapshot(t.newValue)},e);case"delete":return void e.emitPatch({op:"remove",path:f.escapeJsonPath(t.name)},e)}},e.prototype.applyPatchLocally=function(t,e,n){var r=t.target;switch(n.op){case"add":case"replace":r.set(e,n.value);break;case"remove":r.delete(e)}},e.prototype.applySnapshot=function(t,e){var n=this;t.pseudoAction(function(){var r=t.target,i=c.getIdentifierAttribute(n.subType),o={};r.keys().forEach(function(t){o[t]=!1}),Object.keys(e).forEach(function(t){var n=e[t];i&&n&&"object"==typeof n&&t!==n[i]&&l.fail("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '"+t+"', but expected: '"+n[i]+"'"),t in o&&!l.isPrimitive(n)?(o[t]=!0,f.maybeMST(r.get(t),function(t){t.applySnapshot(n)},function(){r.set(t,n)})):r.set(t,n)}),Object.keys(o).forEach(function(t){o[t]===!1&&r.delete(t)})})},e.prototype.getChildType=function(t){return this.subType},e.prototype.isValidSnapshot=function(t,e){var n=this;return l.isPlainObject(t)?d.flattenTypeErrors(Object.keys(t).map(function(r){return n.subType.validate(t[r],d.getContextForPath(e,r,n.subType))})):d.typeCheckFailure(e,t)},e.prototype.getDefaultSnapshot=function(){return{}},e.prototype.removeChild=function(t,e){t.target.delete(e)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(y.ComplexType);u([p.action],v.prototype,"applySnapshot",null),e.MapType=v,e.map=o,e.isMapFactory=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(24),i=n(23),o=n(16),a=n(11),s=n(19),u=n(20),c=n(13),p=n(18),f=n(33),l=n(34),h=n(32),d=n(12),y=n(17);e.types={model:a.model,extend:a.extend,reference:s.reference,union:u.union,optional:c.optional,literal:p.literal,maybe:f.maybe,refinement:l.refinement,string:d.string,boolean:d.boolean,number:d.number,Date:d.DatePrimitive,map:r.map,array:i.array,frozen:h.frozen,identifier:o.identifier,late:y.late}},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),o=n(5),a=n(8),s=n(2),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.invokeAction=o.createActionInvoker(e,n),r}return r(e,t),e.prototype.initialize=function(t){i.addHiddenFinalProp(t,this.name,this.invokeAction.bind(t))},e.prototype.validate=function(t,e){return this.name in t?s.typeCheckFailure(s.getContextForPath(e,this.name),t[this.name],"Action properties should not be provided in the snapshot"):s.typeCheckSuccess()},e}(a.Property);e.ActionProperty=u},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),o=n(8),a=n(2),s=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.getter=n,i.setter=r,i}return r(e,t),e.prototype.initializePrototype=function(t){Object.defineProperty(t,this.name,i.computed(t,this.name,{get:this.getter,set:this.setter,configurable:!0,enumerable:!1}))},e.prototype.validate=function(t,e){return this.name in t?a.typeCheckFailure(a.getContextForPath(e,this.name),t[this.name],"Computed properties should not be provided in the snapshot"):a.typeCheckSuccess()},e}(o.Property);e.ComputedProperty=s},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(5),o=n(4),a=n(8),s=n(1),u=n(2),c=function(t){function e(e,n){var r=t.call(this,e)||this;return r.subtype=n,r}return r(e,t),e.prototype.initialize=function(t,e){o.extendObservable(t,(n={},n[this.name]=o.observable.ref(e[this.name]),n));var n},e.prototype.willChange=function(t){var e=t.newValue;"number"==typeof e||s.isValidIdentifier(e)||s.fail("Not a valid identifier: '"+e),u.typecheck(this.subtype,e);var n=i.getMSTAdministration(t.object);n.assertWritable();var r=t.object[this.name];return void 0!==r&&r!==e&&s.fail("It is not allowed to change the identifier of an object, got: '"+e+"' but expected: '"+r+"'"),t},e.prototype.serialize=function(t,e){var n=t[this.name];this.isValidIdentifier(n)||s.fail("Object does not have a valid identifier yet: '"+n+"'"),e[this.name]=n},e.prototype.deserialize=function(t,e){t[this.name]=e[this.name]},e.prototype.validate=function(t,e){return this.isValidIdentifier(t[this.name])?u.typeCheckSuccess():u.typeCheckFailure(u.getContextForPath(e,this.name,this.subtype),t[this.name],"The provided identifier is not valid")},e.prototype.isValidIdentifier=function(t){return!("number"!=typeof t&&!s.isValidIdentifier(t))&&this.subtype.is(t)},e}(a.Property);e.IdentifierProperty=c},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(8),o=n(1),a=n(5),s=n(21),u=n(2),c=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.type=n,i.basePath=r,i}return r(e,t),e.prototype.initialize=function(t,e){var n=new s.Reference(t,this.type,this.basePath,e[this.name]);o.addHiddenFinalProp(t,this.name+"$value",n);var r=this;Object.defineProperty(t,this.name,{get:function(){return a.getMSTAdministration(this).assertAlive(),n.get},set:function(t){var e=a.getMSTAdministration(this);e.assertWritable();var i=n.identifier;n.setNewValue(t),n.identifier!==i&&e.emitPatch({op:"replace",path:a.escapeJsonPath(r.name),value:n.serialize},e)}}),t[this.name]=e[this.name]},e.prototype.serialize=function(t,e){e[this.name]=t[this.name+"$value"].serialize()},e.prototype.deserialize=function(t,e){t[this.name+"$value"].setNewValue(e[this.name])},e.prototype.validate=function(t,e){return this.name in t?u.typeCheckSuccess():u.typeCheckFailure(u.getContextForPath(e,this.name,this.type),void 0,"Reference is required.")},e}(i.Property);e.ReferenceProperty=c},function(t,e,n){"use strict";var r=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),o=n(8),a=n(5),s=n(2),u=function(t){function e(e,n){var r=t.call(this,e)||this;return r.type=n,r}return r(e,t),e.prototype.initializePrototype=function(t){i.observable.ref(t,this.name,{value:void 0})},e.prototype.initialize=function(t,e){t[this.name]=this.type.create(e[this.name])},e.prototype.willChange=function(t){var e=a.getMSTAdministration(t.object);return t.newValue=e.reconcileChildren(this.type,[t.object[t.name]],[t.newValue],[t.name])[0],t},e.prototype.didChange=function(t){var e=a.getMSTAdministration(t.object);e.emitPatch({op:"replace",path:a.escapeJsonPath(this.name),value:a.valueToSnapshot(t.newValue)},e)},e.prototype.serialize=function(t,e){e[this.name]=a.valueToSnapshot(t[this.name])},e.prototype.deserialize=function(t,e){var n=this;a.maybeMST(t[this.name],function(t){t.applySnapshot(e[n.name])},function(){t[n.name]=e[n.name]})},e.prototype.validate=function(t,e){return this.type.validate(t[this.name],s.getContextForPath(e,this.name,this.type))},e}(o.Property);e.ValueProperty=u},function(t,e,n){"use strict";function r(t,e){var n=function(){var t=this,n=arguments,r=s.getMSTAdministration(this);return r.assertAlive(),o.extras.allowStateChanges(!1,function(){return e.apply(t,n)})};return a.createNamedFunction(t,n)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(4),a=n(1),s=n(5),u=n(8),c=n(2),p=function(t){function e(e,n){var i=t.call(this,e)||this;return i.invokeView=r(e,n),i}return i(e,t),e.prototype.initialize=function(t){a.addHiddenFinalProp(t,this.name,this.invokeView.bind(t))},e.prototype.validate=function(t,e){return this.name in t?c.typeCheckFailure(c.getContextForPath(e,this.name),t[this.name],"View properties should not be provided in the snapshot"):c.typeCheckSuccess()},e}(u.Property);e.ViewProperty=p,e.createViewInvoker=r},function(t,e,n){"use strict";function r(t){return Object.freeze(t),s.isPlainObject(t)&&Object.keys(t).forEach(function(e){Object.isFrozen(t[e])||r(t[e])}),t}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(2),s=n(1),u=function(t){function e(){return t.call(this,"frozen")||this}return i(e,t),e.prototype.describe=function(){return"<any immutable value>"},e.prototype.create=function(t){return s.invariant(s.isSerializable(t),"Given value should be serializable"),s.isMutable(t)?r(t):t},e.prototype.validate=function(t,e){return s.isSerializable(t)?a.typeCheckSuccess():a.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return null},enumerable:!0,configurable:!0}),e}(o.Type);e.Frozen=u,e.frozen=new u},function(t,e,n){"use strict";function r(t){return i.union(s,t)}Object.defineProperty(e,"__esModule",{value:!0});var i=n(20),o=n(18),a=n(13),s=a.optional(o.literal(null),null);e.maybe=r},function(t,e,n){"use strict";function r(t,e,n){var r=e.create();return a.invariant(n(s.isMST(r)?s.getMSTAdministration(r).snapshot:r),"Default value for refinement type "+t+" does not pass the predicate."),new c(t,e,n)}var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),a=n(1),s=n(5),u=n(2),c=function(t){function e(e,n,r){var i=t.call(this,e)||this;return i.type=n,i.predicate=r,i}return i(e,t),e.prototype.describe=function(){return this.name},e.prototype.create=function(t){var e=this.type.create(t),n=s.isMST(e)?s.getMSTAdministration(e).snapshot:e;return a.invariant(this.is(n),"Value "+JSON.stringify(n)+" is not assignable to type "+this.name),e},e.prototype.validate=function(t,e){return this.type.is(t)&&this.predicate(t)?u.typeCheckSuccess():u.typeCheckFailure(e,t)},Object.defineProperty(e.prototype,"identifierAttribute",{get:function(){return this.type.identifierAttribute},enumerable:!0,configurable:!0}),e}(o.Type);e.Refinement=c,e.refinement=r}])}); |
{ | ||
"name": "mobx-state-tree", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"description": "Opinionated, transactional, MobX powered state container", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
354000
4011