label-studio_beta
Version:
Data Labeling Tool that is backend agnostic and can be embedded into your applications
2 lines • 2.08 MB
JavaScript
/*! For license information please see main.js.LICENSE.txt */
!function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports.LabelStudio=t():e.LabelStudio=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=275)}([function(e,t,n){"use strict";e.exports=n(276)},function(e,t,n){"use strict";n.r(t),function(e,r){n.d(t,"addDisposer",(function(){return q})),n.d(t,"addMiddleware",(function(){return Te})),n.d(t,"applyAction",(function(){return be})),n.d(t,"applyPatch",(function(){return O})),n.d(t,"applySnapshot",(function(){return S})),n.d(t,"cast",(function(){return Z})),n.d(t,"castFlowReturn",(function(){return Mt})),n.d(t,"castToReferenceSnapshot",(function(){return te})),n.d(t,"castToSnapshot",(function(){return ee})),n.d(t,"clone",(function(){return W})),n.d(t,"createActionTrackingMiddleware",(function(){return ve})),n.d(t,"createActionTrackingMiddleware2",(function(){return ge})),n.d(t,"decorate",(function(){return Pe})),n.d(t,"destroy",(function(){return G})),n.d(t,"detach",(function(){return K})),n.d(t,"escapeJsonPath",(function(){return Lt})),n.d(t,"flow",(function(){return Nt})),n.d(t,"getChildType",(function(){return b})),n.d(t,"getEnv",(function(){return X})),n.d(t,"getIdentifier",(function(){return z})),n.d(t,"getLivelinessChecking",(function(){return l})),n.d(t,"getMembers",(function(){return J})),n.d(t,"getNodeId",(function(){return ne})),n.d(t,"getParent",(function(){return P})),n.d(t,"getParentOfType",(function(){return M})),n.d(t,"getPath",(function(){return A})),n.d(t,"getPathParts",(function(){return I})),n.d(t,"getPropertyMembers",(function(){return Q})),n.d(t,"getRelativePath",(function(){return H})),n.d(t,"getRoot",(function(){return R})),n.d(t,"getRunningActionContext",(function(){return Me})),n.d(t,"getSnapshot",(function(){return j})),n.d(t,"getType",(function(){return y})),n.d(t,"hasParent",(function(){return T})),n.d(t,"hasParentOfType",(function(){return N})),n.d(t,"isActionContextChildOf",(function(){return Ae})),n.d(t,"isActionContextThisOrChildOf",(function(){return Ie})),n.d(t,"isAlive",(function(){return Y})),n.d(t,"isArrayType",(function(){return Qt})),n.d(t,"isFrozenType",(function(){return Rn})),n.d(t,"isIdentifierType",(function(){return Gn})),n.d(t,"isLateType",(function(){return Pn})),n.d(t,"isLiteralType",(function(){return mn})),n.d(t,"isMapType",(function(){return Gt})),n.d(t,"isModelType",(function(){return nn})),n.d(t,"isOptionalType",(function(){return _n})),n.d(t,"isPrimitiveType",(function(){return pn})),n.d(t,"isProtected",(function(){return k})),n.d(t,"isReferenceType",(function(){return Vn})),n.d(t,"isRefinementType",(function(){return yn})),n.d(t,"isRoot",(function(){return D})),n.d(t,"isStateTreeNode",(function(){return $e})),n.d(t,"isType",(function(){return de})),n.d(t,"isUnionType",(function(){return xn})),n.d(t,"isValidReference",(function(){return B})),n.d(t,"joinJsonPath",(function(){return zt})),n.d(t,"onAction",(function(){return xe})),n.d(t,"onPatch",(function(){return w})),n.d(t,"onSnapshot",(function(){return x})),n.d(t,"process",(function(){return at})),n.d(t,"protect",(function(){return C})),n.d(t,"recordActions",(function(){return we})),n.d(t,"recordPatches",(function(){return E})),n.d(t,"resolveIdentifier",(function(){return F})),n.d(t,"resolvePath",(function(){return L})),n.d(t,"setLivelinessChecking",(function(){return s})),n.d(t,"setLivelynessChecking",(function(){return c})),n.d(t,"splitJsonPath",(function(){return Vt})),n.d(t,"toGenerator",(function(){return At})),n.d(t,"toGeneratorFunction",(function(){return Rt})),n.d(t,"tryReference",(function(){return V})),n.d(t,"tryResolve",(function(){return U})),n.d(t,"typecheck",(function(){return He})),n.d(t,"types",(function(){return $n})),n.d(t,"unescapeJsonPath",(function(){return Ft})),n.d(t,"unprotect",(function(){return _})),n.d(t,"walk",(function(){return $}));var o,i=n(11),a="warn";function s(e){a=e}function l(){return a}function c(e){s(e)}!function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"}(o||(o={}));var u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function f(e,t){function n(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var d=function(){return(d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function p(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function h(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(s){i=[6,s],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function v(e){var t="function"===typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"===typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(m(arguments[t]));return e}function y(e){return Qe(e,1),Je(e).type}function b(e,t){return Qe(e,1),Je(e).getChildType(t)}function w(e,t){return Qe(e,1),St(t,2),Je(e).onPatch(t)}function x(e,t){return Qe(e,1),St(t,2),Je(e).onSnapshot(t)}function O(e,t){Qe(e,1),kt(t,(function(e){return"object"===typeof e}),"object or array",2),Je(e).applyPatches(ht(t))}function E(e,t){Qe(e,1);var n,r={patches:[],reversedInversePatches:[]},o={},i={get recording(){return!!n},get patches(){return o.patches||(o.patches=r.patches.slice()),o.patches},get reversedInversePatches(){return o.reversedInversePatches||(o.reversedInversePatches=r.reversedInversePatches.slice()),o.reversedInversePatches},get inversePatches(){return o.inversePatches||(o.inversePatches=r.reversedInversePatches.slice().reverse()),o.inversePatches},stop:function(){n&&(n(),n=void 0)},resume:function(){n||(n=w(e,(function(e,n){t&&!t(e,n,Me())||(r.patches.push(e),r.reversedInversePatches.unshift(n),o.patches=void 0,o.inversePatches=void 0,o.reversedInversePatches=void 0)})))},replay:function(t){O(t||e,r.patches)},undo:function(t){O(t||e,r.reversedInversePatches)}};return i.resume(),i}function C(e){Qe(e,1);var t=Je(e);if(!t.isRoot)throw ut("`protect` can only be invoked on root nodes");t.isProtectionEnabled=!0}function _(e){Qe(e,1);var t=Je(e);if(!t.isRoot)throw ut("`unprotect` can only be invoked on root nodes");t.isProtectionEnabled=!1}function k(e){return Je(e).isProtected}function S(e,t){return Qe(e,1),Je(e).applySnapshot(t)}function j(e,t){void 0===t&&(t=!0),Qe(e,1);var n=Je(e);return t?n.snapshot:yt(n.type.getSnapshot(n,!1))}function T(e,t){void 0===t&&(t=1),Qe(e,1),jt(t,2,0);for(var n=Je(e).parent;n;){if(0===--t)return!0;n=n.parent}return!1}function P(e,t){void 0===t&&(t=1),Qe(e,1),jt(t,2,0);for(var n=t,r=Je(e).parent;r;){if(0===--n)return r.storedValue;r=r.parent}throw ut("Failed to find the parent of "+Je(e)+" at depth "+t)}function N(e,t){Qe(e,1),pe(t,2);for(var n=Je(e).parent;n;){if(t.is(n.storedValue))return!0;n=n.parent}return!1}function M(e,t){Qe(e,1),pe(t,2);for(var n=Je(e).parent;n;){if(t.is(n.storedValue))return n.storedValue;n=n.parent}throw ut("Failed to find the parent of "+Je(e)+" of a given type")}function R(e){return Qe(e,1),Je(e).root.storedValue}function A(e){return Qe(e,1),Je(e).path}function I(e){return Qe(e,1),Vt(Je(e).path)}function D(e){return Qe(e,1),Je(e).isRoot}function L(e,t){Qe(e,1),Tt(t,2);var n=rt(Je(e),t);return n?n.value:void 0}function F(e,t,n){pe(e,1),Qe(t,2),kt(n,qn,"string or number (identifier)",3);var r=Je(t).root.identifierCache.resolve(e,Yn(n));return r?r.value:void 0}function z(e){return Qe(e,1),Je(e).identifier}function V(e,t){void 0===t&&(t=!0);try{var n=e();if(void 0===n||null===n)return;if($e(n))return t?Y(n)?n:void 0:n;throw ut("The reference to be checked is not one of node, null or undefined")}catch(r){if(r instanceof In)return;throw r}}function B(e,t){void 0===t&&(t=!0);try{var n=e();if(void 0===n||null===n)return!1;if($e(n))return!t||Y(n);throw ut("The reference to be checked is not one of node, null or undefined")}catch(r){if(r instanceof In)return!1;throw r}}function U(e,t){Qe(e,1),Tt(t,2);var n=rt(Je(e),t,!1);if(void 0!==n)try{return n.value}catch(r){return}}function H(e,t){return Qe(e,1),Qe(t,2),nt(Je(e),Je(t))}function W(e,t){void 0===t&&(t=!0),Qe(e,1);var n=Je(e);return n.type.create(n.snapshot,!0===t?n.root.environment:!1===t?void 0:t)}function K(e){return Qe(e,1),Je(e).detach(),e}function G(e){Qe(e,1);var t=Je(e);t.isRoot?t.die():t.parent.removeChild(t.subpath)}function Y(e){return Qe(e,1),Je(e).observableIsAlive}function q(e,t){return Qe(e,1),St(t,2),Je(e).addDisposer(t),t}function X(e){Qe(e,1);var t=Je(e).root.environment;return t||lt}function $(e,t){Qe(e,1),St(t,2);var n=Je(e);n.getChildren().forEach((function(e){$e(e.storedValue)&&$(e.storedValue,t)})),t(n.storedValue)}function Q(e){var t;return kt(t=$e(e)?y(e):e,(function(e){return nn(e)}),"model type or model instance",1),{name:t.name,properties:d({},t.properties)}}function J(e){var t=Je(e).type,n=d(d({},Q(t)),{actions:[],volatile:[],views:[]});return Object.getOwnPropertyNames(e).forEach((function(t){if(!(t in n.properties)){var r=Object.getOwnPropertyDescriptor(e,t);r.get?Object(i.r)(e,t)?n.views.push(t):n.volatile.push(t):!0===r.value._isMSTAction?n.actions.push(t):Object(i.v)(e,t)?n.volatile.push(t):n.views.push(t)}})),n}function Z(e){return e}function ee(e){return e}function te(e){return e}function ne(e){return Qe(e,1),Je(e).nodeId}var re,oe=function(){function e(e,t,n,r){this.type=e,this.environment=r,this._state=We.INITIALIZING,this.environment=r,this.baseSetParent(t,n)}return Object.defineProperty(e.prototype,"subpath",{get:function(){return this._subpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subpathUponDeath",{get:function(){return this._subpathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pathUponDeath",{get:function(){return this._pathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},set:function(e){var t=this.isAlive;this._state=e;var n=this.isAlive;this.aliveAtom&&t!==n&&this.aliveAtom.reportChanged()},enumerable:!1,configurable:!0}),e.prototype.fireInternalHook=function(e){this._hookSubscribers&&this._hookSubscribers.emit(e,this,e)},e.prototype.registerHook=function(e,t){return this._hookSubscribers||(this._hookSubscribers=new xt),this._hookSubscribers.register(e,t)},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),e.prototype.baseSetParent=function(e,t){this._parent=e,this._subpath=t,this._escapedSubpath=void 0,this.pathAtom&&this.pathAtom.reportChanged()},Object.defineProperty(e.prototype,"path",{get:function(){return this.getEscapedPath(!0)},enumerable:!1,configurable:!0}),e.prototype.getEscapedPath=function(e){return e&&(this.pathAtom||(this.pathAtom=Object(i.m)("path")),this.pathAtom.reportObserved()),this.parent?(void 0===this._escapedSubpath&&(this._escapedSubpath=this._subpath?Lt(this._subpath):""),this.parent.getEscapedPath(e)+"/"+this._escapedSubpath):""},Object.defineProperty(e.prototype,"isRoot",{get:function(){return null===this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAlive",{get:function(){return this.state!==We.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDetaching",{get:function(){return this.state===We.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||(this.aliveAtom=Object(i.m)("alive")),this.aliveAtom.reportObserved(),this.isAlive},enumerable:!1,configurable:!0}),e.prototype.baseFinalizeCreation=function(e){if(this.state===We.CREATED){if(this.parent){if(this.parent.state!==We.FINALIZED)return;this.fireHook(o.afterAttach)}this.state=We.FINALIZED,e&&e()}},e.prototype.baseFinalizeDeath=function(){this._hookSubscribers&&this._hookSubscribers.clearAll(),this._subpathUponDeath=this._subpath,this._pathUponDeath=this.getEscapedPath(!1),this.baseSetParent(null,""),this.state=We.DEAD},e.prototype.baseAboutToDie=function(){this.fireHook(o.beforeDestroy)},e}(),ie=function(e){function t(t,n,r,o,i){var a=e.call(this,t,n,r,o)||this;try{a.storedValue=t.createNewInstance(i)}catch(s){throw a.state=We.DEAD,s}return a.state=We.CREATED,a.finalizeCreation(),a}return f(t,e),Object.defineProperty(t.prototype,"root",{get:function(){if(!this.parent)throw ut("This scalar node is not part of a tree");return this.parent.root},enumerable:!1,configurable:!0}),t.prototype.setParent=function(e,t){var n=this.parent!==e,r=this.subpath!==t;(n||r)&&(this.environment=void 0,this.baseSetParent(this.parent,t))},Object.defineProperty(t.prototype,"snapshot",{get:function(){return yt(this.getSnapshot())},enumerable:!1,configurable:!0}),t.prototype.getSnapshot=function(){return this.type.getSnapshot(this)},t.prototype.toString=function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"<root>";return this.type.name+"@"+e+(this.isAlive?"":" [dead]")},t.prototype.die=function(){this.isAlive&&this.state!==We.DETACHING&&(this.aboutToDie(),this.finalizeDeath())},t.prototype.finalizeCreation=function(){this.baseFinalizeCreation()},t.prototype.aboutToDie=function(){this.baseAboutToDie()},t.prototype.finalizeDeath=function(){this.baseFinalizeDeath()},t.prototype.fireHook=function(e){this.fireInternalHook(e)},p([i.j],t.prototype,"die",null),t}(oe),ae=1,se={onError:function(e){throw e}},le=function(e){function t(t,n,r,o,i){var a=e.call(this,t,n,r,o)||this;if(a.nodeId=++ae,a.isProtectionEnabled=!0,a._autoUnbox=!0,a._isRunningAction=!1,a._hasSnapshotReaction=!1,a._observableInstanceState=0,a._cachedInitialSnapshotCreated=!1,a.unbox=a.unbox.bind(a),a._initialSnapshot=yt(i),a.identifierAttribute=t.identifierAttribute,n||(a.identifierCache=new Ge),a._childNodes=t.initializeChildNodes(a,a._initialSnapshot),a.identifier=null,a.unnormalizedIdentifier=null,a.identifierAttribute&&a._initialSnapshot){var s=a._initialSnapshot[a.identifierAttribute];if(void 0===s){var l=a._childNodes[a.identifierAttribute];l&&(s=l.value)}if("string"!==typeof s&&"number"!==typeof s)throw ut("Instance identifier '"+a.identifierAttribute+"' for type '"+a.type.name+"' must be a string or a number");a.identifier=Yn(s),a.unnormalizedIdentifier=s}return n?n.root.identifierCache.addNodeToCache(a):a.identifierCache.addNodeToCache(a),a}return f(t,e),t.prototype.applyPatches=function(e){this.createObservableInstanceIfNeeded(),this._applyPatches(e)},t.prototype.applySnapshot=function(e){this.createObservableInstanceIfNeeded(),this._applySnapshot(e)},t.prototype.createObservableInstanceIfNeeded=function(){0===this._observableInstanceState&&this.createObservableInstance()},t.prototype.createObservableInstance=function(){var e,t;this._observableInstanceState=1;for(var n=[],r=this.parent;r&&0===r._observableInstanceState;)n.unshift(r),r=r.parent;try{for(var a=v(n),s=a.next();!s.done;s=a.next()){s.value.createObservableInstanceIfNeeded()}}catch(f){e={error:f}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}var l,c,u=this.type;try{this.storedValue=u.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,u.finalizeNewInstance(this,this.storedValue)}catch(d){throw this.state=We.DEAD,d}finally{this._isRunningAction=!1}this._observableInstanceState=2,l=this,c="snapshot",Object(i.o)(l,c).trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=lt,this.state=We.CREATED,this.fireHook(o.afterCreate),this.finalizeCreation()},Object.defineProperty(t.prototype,"root",{get:function(){var e=this.parent;return e?e.root:this},enumerable:!1,configurable:!0}),t.prototype.clearParent=function(){if(this.parent){this.fireHook(o.beforeDetach);var e=this.state;this.state=We.DETACHING;var t=this.root,n=t.environment,r=t.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=n,this.identifierCache=r}finally{this.state=e}}},t.prototype.setParent=function(e,t){var n=e!==this.parent,r=t!==this.subpath;(n||r)&&(n?(this.environment=void 0,e.root.identifierCache.mergeCache(this),this.baseSetParent(e,t),this.fireHook(o.afterAttach)):r&&this.baseSetParent(this.parent,t))},t.prototype.fireHook=function(e){var t=this;this.fireInternalHook(e);var n=this.storedValue&&"object"===typeof this.storedValue&&this.storedValue[e];"function"===typeof n&&(i.e?Object(i.e)((function(){n.apply(t.storedValue)})):n.apply(this.storedValue))},Object.defineProperty(t.prototype,"snapshot",{get:function(){return yt(this.getSnapshot())},enumerable:!1,configurable:!0}),t.prototype.getSnapshot=function(){return this.isAlive?2===this._observableInstanceState?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath},t.prototype._getActualSnapshot=function(){return this.type.getSnapshot(this)},t.prototype._getCachedInitialSnapshot=function(){if(!this._cachedInitialSnapshotCreated){var e=this.type,t=this._childNodes,n=this._initialSnapshot;this._cachedInitialSnapshot=e.processInitialSnapshot(t,n),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot},t.prototype.isRunningAction=function(){return!!this._isRunningAction||!this.isRoot&&this.parent.isRunningAction()},t.prototype.assertAlive=function(e){var t=l();if(!this.isAlive&&"ignore"!==t){var n=this._getAssertAliveError(e);switch(t){case"error":throw ut(n);case"warn":_t(n)}}},t.prototype._getAssertAliveError=function(e){var t=this.getEscapedPath(!1)||this.pathUponDeath||"",n=e.subpath&&Lt(e.subpath)||"",r=e.actionContext||Ce();r&&"action"!==r.type&&r.parentActionEvent&&(r=r.parentActionEvent);var o="";r&&null!=r.name&&(o=(r&&r.context&&A(r.context)||t)+"."+r.name+"()");return"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '"+this.type.name+"', Path upon death: '"+t+"', Subpath: '"+n+"', Action: '"+o+"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree."},t.prototype.getChildNode=function(e){this.assertAlive({subpath:e}),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildNode(this,e):this._childNodes[e]}finally{this._autoUnbox=!0}},t.prototype.getChildren=function(){this.assertAlive(lt),this._autoUnbox=!1;try{return 2===this._observableInstanceState?this.type.getChildren(this):it(this._childNodes)}finally{this._autoUnbox=!0}},t.prototype.getChildType=function(e){return this.type.getChildType(e)},Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),t.prototype.assertWritable=function(e){if(this.assertAlive(e),!this.isRunningAction()&&this.isProtected)throw ut("Cannot modify '"+this+"', the object is protected and can only be modified by using an action.")},t.prototype.removeChild=function(e){this.type.removeChild(this,e)},t.prototype.unbox=function(e){return e?(this.assertAlive({subpath:e.subpath||e.subpathUponDeath}),this._autoUnbox?e.value:e):e},t.prototype.toString=function(){var e=(this.isAlive?this.path:this.pathUponDeath)||"<root>",t=this.identifier?"(id: "+this.identifier+")":"";return this.type.name+"@"+e+t+(this.isAlive?"":" [dead]")},t.prototype.finalizeCreation=function(){var e=this;this.baseFinalizeCreation((function(){var t,n;try{for(var r=v(e.getChildren()),i=r.next();!i.done;i=r.next()){i.value.finalizeCreation()}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e.fireInternalHook(o.afterCreationFinalization)}))},t.prototype.detach=function(){if(!this.isAlive)throw ut("Error while detaching, node is not alive.");this.clearParent()},t.prototype.preboot=function(){var e=this;this._applyPatches=je(this.storedValue,"@APPLY_PATCHES",(function(t){t.forEach((function(t){var n=Vt(t.path);ot(e,n.slice(0,-1)).applyPatchLocally(n[n.length-1],t)}))})),this._applySnapshot=je(this.storedValue,"@APPLY_SNAPSHOT",(function(t){if(t!==e.snapshot)return e.type.applySnapshot(e,t)})),bt(this.storedValue,"$treenode",this),bt(this.storedValue,"toJSON",et)},t.prototype.die=function(){this.isAlive&&this.state!==We.DETACHING&&(this.aboutToDie(),this.finalizeDeath())},t.prototype.aboutToDie=function(){0!==this._observableInstanceState&&(this.getChildren().forEach((function(e){e.aboutToDie()})),this.baseAboutToDie(),this._internalEventsEmit("dispose"),this._internalEventsClear("dispose"))},t.prototype.finalizeDeath=function(){this.getChildren().forEach((function(e){e.finalizeDeath()})),this.root.identifierCache.notifyDied(this);var e=this.snapshot;this._snapshotUponDeath=e,this._internalEventsClearAll(),this.baseFinalizeDeath()},t.prototype.onSnapshot=function(e){return this._addSnapshotReaction(),this._internalEventsRegister("snapshot",e)},t.prototype.emitSnapshot=function(e){this._internalEventsEmit("snapshot",e)},t.prototype.onPatch=function(e){return this._internalEventsRegister("patch",e)},t.prototype.emitPatch=function(e,t){if(this._internalEventsHasSubscribers("patch")){var n=m(function(e){if(!("oldValue"in e))throw ut("Patches without `oldValue` field cannot be inversed");return[It(e),Dt(e)]}(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++){var o=t[r];for(var i in o)e[i]=o[i]}return e}({},e,{path:t.path.substr(this.path.length)+"/"+e.path})),2),r=n[0],o=n[1];this._internalEventsEmit("patch",r,o)}this.parent&&this.parent.emitPatch(e,t)},t.prototype.hasDisposer=function(e){return this._internalEventsHas("dispose",e)},t.prototype.addDisposer=function(e){if(this.hasDisposer(e))throw ut("cannot add a disposer when it is already registered for execution");this._internalEventsRegister("dispose",e,!0)},t.prototype.removeDisposer=function(e){if(!this._internalEventsHas("dispose",e))throw ut("cannot remove a disposer which was never registered for execution");this._internalEventsUnregister("dispose",e)},t.prototype.removeMiddleware=function(e){if(this.middlewares){var t=this.middlewares.indexOf(e);t>=0&&this.middlewares.splice(t,1)}},t.prototype.addMiddleWare=function(e,t){var n=this;void 0===t&&(t=!0);var r={handler:e,includeHooks:t};return this.middlewares?this.middlewares.push(r):this.middlewares=[r],function(){n.removeMiddleware(r)}},t.prototype.applyPatchLocally=function(e,t){this.assertWritable({subpath:e}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,e,t)},t.prototype._addSnapshotReaction=function(){var e=this;if(!this._hasSnapshotReaction){var t=Object(i.y)((function(){return e.snapshot}),(function(t){return e.emitSnapshot(t)}),se);this.addDisposer(t),this._hasSnapshotReaction=!0}},t.prototype._internalEventsHasSubscribers=function(e){return!!this._internalEvents&&this._internalEvents.hasSubscribers(e)},t.prototype._internalEventsRegister=function(e,t,n){return void 0===n&&(n=!1),this._internalEvents||(this._internalEvents=new xt),this._internalEvents.register(e,t,n)},t.prototype._internalEventsHas=function(e,t){return!!this._internalEvents&&this._internalEvents.has(e,t)},t.prototype._internalEventsUnregister=function(e,t){this._internalEvents&&this._internalEvents.unregister(e,t)},t.prototype._internalEventsEmit=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this._internalEvents&&(t=this._internalEvents).emit.apply(t,g([e],n))},t.prototype._internalEventsClear=function(e){this._internalEvents&&this._internalEvents.clear(e)},t.prototype._internalEventsClearAll=function(){this._internalEvents&&this._internalEvents.clearAll()},p([i.j],t.prototype,"createObservableInstance",null),p([i.k],t.prototype,"snapshot",null),p([i.j],t.prototype,"detach",null),p([i.j],t.prototype,"die",null),t}(oe);!function(e){e[e.String=1]="String",e[e.Number=2]="Number",e[e.Boolean=4]="Boolean",e[e.Date=8]="Date",e[e.Literal=16]="Literal",e[e.Array=32]="Array",e[e.Map=64]="Map",e[e.Object=128]="Object",e[e.Frozen=256]="Frozen",e[e.Optional=512]="Optional",e[e.Reference=1024]="Reference",e[e.Identifier=2048]="Identifier",e[e.Late=4096]="Late",e[e.Refinement=8192]="Refinement",e[e.Union=16384]="Union",e[e.Null=32768]="Null",e[e.Undefined=65536]="Undefined",e[e.Integer=131072]="Integer",e[e.Custom=262144]="Custom",e[e.SnapshotProcessor=524288]="SnapshotProcessor"}(re||(re={}));var ce=function(){function e(e){this.isType=!0,this.name=e}return e.prototype.create=function(e,t){return Ue(this,e),this.instantiate(null,"",t,e).value},e.prototype.getSnapshot=function(e,t){throw ut("unimplemented method")},e.prototype.isAssignableFrom=function(e){return e===this},e.prototype.validate=function(e,t){if(Ze(e)){var n=y(e);return this.isAssignableFrom(n)?ze():Ve(t,e)}return this.isValidSnapshot(e,t)},e.prototype.is=function(e){return 0===this.validate(e,[{path:"",type:this}]).length},Object.defineProperty(e.prototype,"Type",{get:function(){throw ut("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:!1,configurable:!0}),Object.defineProperty(e.prototype,"TypeWithoutSTN",{get:function(){throw ut("Factory.TypeWithoutSTN should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.TypeWithoutSTN`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"SnapshotType",{get:function(){throw ut("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:!1,configurable:!0}),Object.defineProperty(e.prototype,"CreationType",{get:function(){throw ut("Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`")},enumerable:!1,configurable:!0}),p([i.j],e.prototype,"create",null),e}(),ue=function(e){function t(t){return e.call(this,t)||this}return f(t,e),t.prototype.create=function(t,n){return void 0===t&&(t=this.getDefaultSnapshot()),e.prototype.create.call(this,t,n)},t.prototype.getValue=function(e){return e.createObservableInstanceIfNeeded(),e.storedValue},t.prototype.tryToReconcileNode=function(e,t){return!e.isDetaching&&(e.snapshot===t||(!(!$e(t)||Je(t)!==e)||!(e.type!==this||!mt(t)||$e(t)||e.identifierAttribute&&e.identifier!==Yn(t[e.identifierAttribute]))&&(e.applySnapshot(t),!0)))},t.prototype.reconcile=function(e,t,n,r){if(this.tryToReconcileNode(e,t))return e.setParent(n,r),e;if(e.die(),$e(t)&&this.isAssignableFrom(y(t))){var o=Je(t);return o.setParent(n,r),o}return this.instantiate(n,r,void 0,t)},t.prototype.getSubTypes=function(){return null},p([i.j],t.prototype,"create",null),t}(ce),fe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.prototype.createNewInstance=function(e){return e},t.prototype.getValue=function(e){return e.storedValue},t.prototype.getSnapshot=function(e){return e.storedValue},t.prototype.reconcile=function(e,t,n,r){if(!e.isDetaching&&e.type===this&&e.storedValue===t)return e;var o=this.instantiate(n,r,void 0,t);return e.die(),o},t.prototype.getSubTypes=function(){return null},t}(ce);function de(e){return"object"===typeof e&&e&&!0===e.isType}function pe(e,t){kt(e,de,"mobx-state-tree type",t)}var he=new Map;function ve(e){return function(t,n,r){switch(t.type){case"action":if(e.filter&&!0!==e.filter(t))return n(t);var o=e.onStart(t);e.onResume(t,o),he.set(t.id,{call:t,context:o,async:!1});try{var i=n(t);return e.onSuspend(t,o),!1===he.get(t.id).async&&(he.delete(t.id),e.onSuccess(t,o,i)),i}catch(s){throw he.delete(t.id),e.onFail(t,o,s),s}case"flow_spawn":return(a=he.get(t.rootId)).async=!0,n(t);case"flow_resume":case"flow_resume_error":var a=he.get(t.rootId);e.onResume(t,a.context);try{return n(t)}finally{e.onSuspend(t,a.context)}case"flow_throw":a=he.get(t.rootId);return he.delete(t.rootId),e.onFail(t,a.context,t.args[0]),n(t);case"flow_return":a=he.get(t.rootId);return he.delete(t.rootId),e.onSuccess(t,a.context,t.args[0]),n(t)}}}var me=function(){function e(e,t){this.hooks=e,this.call=t,this.flowsPending=0,this.running=!0,e&&e.onStart(t)}return e.prototype.finish=function(e){this.running&&(this.running=!1,this.hooks&&this.hooks.onFinish(this.call,e))},e.prototype.incFlowsPending=function(){this.flowsPending++},e.prototype.decFlowsPending=function(){this.flowsPending--},Object.defineProperty(e.prototype,"hasFlowsPending",{get:function(){return this.flowsPending>0},enumerable:!1,configurable:!0}),e}();function ge(e){var t=new WeakMap;return function(n,r){var o=n.parentActionEvent?t.get(n.parentActionEvent):void 0;if("action"===n.type){var i=d(d({},n),{env:o&&o.call.env,parentCall:o&&o.call}),a=!e.filter||e.filter(i),s=new me(a?e:void 0,i);t.set(n,s);var l=void 0;try{l=r(n)}catch(u){throw s.finish(u),u}return s.hasFlowsPending||s.finish(),l}if(!o)return r(n);switch(n.type){case"flow_spawn":return o.incFlowsPending(),r(n);case"flow_resume":case"flow_resume_error":return r(n);case"flow_throw":var c=n.args[0];try{return r(n)}finally{o.decFlowsPending(),o.hasFlowsPending||o.finish(c)}case"flow_return":try{return r(n)}finally{o.decFlowsPending(),o.hasFlowsPending||o.finish()}}}}function ye(e){return{$MST_UNSERIALIZABLE:!0,type:e}}function be(e,t){Qe(e,1),kt(t,(function(e){return"object"===typeof e}),"object or array",2),Object(i.z)((function(){ht(t).forEach((function(t){return function(e,t){var n=U(e,t.path||"");if(!n)throw ut("Invalid action path: "+(t.path||""));var r=Je(n);if("@APPLY_PATCHES"===t.name)return O.call(null,n,t.args[0]);if("@APPLY_SNAPSHOT"===t.name)return S.call(null,n,t.args[0]);if("function"!==typeof n[t.name])throw ut("Action '"+t.name+"' does not exist in '"+r.path+"'");return n[t.name].apply(n,t.args?t.args.map((function(e){return function(e,t){return t&&"object"===typeof t&&"$MST_DATE"in t?new Date(t.$MST_DATE):t}(0,e)})):[])}(e,t)}))}))}function we(e,t){Qe(e,1);var n,r=[],o=function(e){(!t||t(e,Me()))&&r.push(e)},i={actions:r,get recording(){return!!n},stop:function(){n&&(n(),n=void 0)},resume:function(){n||(n=xe(e,o))},replay:function(e){be(e,r)}};return i.resume(),i}function xe(e,t,n){return void 0===n&&(n=!1),Qe(e,1),Te(e,(function(r,o){if("action"===r.type&&r.id===r.rootId){var i=Je(r.context),a={name:r.name,path:nt(Je(e),i),args:r.args.map((function(e,t){return function(e,t,n,r){if(r instanceof Date)return{$MST_DATE:r.getTime()};if(gt(r))return r;if($e(r))return ye("[MSTNode: "+y(r).name+"]");if("function"===typeof r)return ye("[function]");if("object"===typeof r&&!vt(r)&&!pt(r))return ye("[object "+(r&&r.constructor&&r.constructor.name||"Complex Object")+"]");try{return JSON.stringify(r),r}catch(o){return ye(""+o)}}(0,r.name,0,e)}))};if(n){var s=o(r);return t(a),s}return t(a),o(r)}return o(r)}))}var Oe,Ee=1;function Ce(){return Oe}function _e(){return Ee++}function ke(e,t){var n=Je(e.context);"action"===e.type&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var a=Oe;Oe=e;try{return function(e,t,n){var r=new Ne(e,n);if(r.isEmpty)return Object(i.j)(n).apply(null,t.args);var a=null;return function e(t){var s=r.getNextMiddleware(),l=s&&s.handler;return l?!s.includeHooks&&o[t.name]?e(t):(l(t,(function(t,n){!0,a=e(t),n&&(a=n(a))}),(function(e){!0,a=e})),a):Object(i.j)(n).apply(null,t.args)}(t)}(n,e,t)}finally{Oe=a,n._isRunningAction=r}}function Se(e){if(e)return"action"===e.type?e:e.parentActionEvent}function je(e,t,n){var r=function(){var r=_e(),o=Oe,i=Se(o);return ke({type:"action",name:t,id:r,args:Ot(arguments),context:e,tree:R(e),rootId:o?o.rootId:r,parentId:o?o.id:0,allParentIds:o?g(o.allParentIds,[o.id]):[],parentEvent:o,parentActionEvent:i},n)};return r._isMSTAction=!0,r}function Te(e,t,n){void 0===n&&(n=!0);var r=Je(e);return r.addMiddleWare(t,n)}function Pe(e,t,n){void 0===n&&(n=!0);var r={handler:e,includeHooks:n};return t.$mst_middleware=t.$mst_middleware||[],t.$mst_middleware.push(r),t}var Ne=function(){function e(e,t){this.arrayIndex=0,this.inArrayIndex=0,this.middlewares=[],t.$mst_middleware&&this.middlewares.push(t.$mst_middleware);for(var n=e;n;)n.middlewares&&this.middlewares.push(n.middlewares),n=n.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),e.prototype.getNextMiddleware=function(){var e=this.middlewares[this.arrayIndex];if(e){var t=e[this.inArrayIndex++];return t||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}},e}();function Me(){for(var e=Ce();e&&"action"!==e.type;)e=e.parentActionEvent;return e}function Re(e,t,n){for(var r="number"===typeof t?t:t.id,o=n?e:e.parentActionEvent;o;){if(o.id===r)return!0;o=o.parentActionEvent}return!1}function Ae(e,t){return Re(e,t,!1)}function Ie(e,t){return Re(e,t,!0)}function De(e){return"function"===typeof e?"<function"+(e.name?" "+e.name:"")+">":$e(e)?"<"+e+">":"`"+function(e){try{return JSON.stringify(e)}catch(t){return"<Unserializable: "+t+">"}}(e)+"`"}function Le(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map((function(e){return e.path})).filter((function(e){return e.length>0})).join("/"),o=r.length>0?'at path "/'+r+'" ':"",i=$e(t)?"value of type "+Je(t).type.name+":":gt(t)?"value":"snapshot",a=n&&$e(t)&&n.is(Je(t).snapshot);return""+o+i+" "+De(t)+" is not assignable "+(n?"to type: `"+n.name+"`":"")+(e.message?" ("+e.message+")":"")+(n?pn(n)||gt(t)?".":", 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 Fe(e,t,n){return e.concat([{path:t,type:n}])}function ze(){return st}function Ve(e,t,n){return[{context:e,value:t,message:n}]}function Be(e){return e.reduce((function(e,t){return e.concat(t)}),[])}function Ue(t,n){"undefined"!==typeof e&&Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0})&&"true"===Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0}).ENABLE_TYPE_CHECK&&He(t,n)}function He(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw ut(function(e,t,n){if(0===n.length)return;return"Error while converting "+(r=De(t),(r.length<280?r:r.substring(0,272)+"......"+r.substring(r.length-8))+" to `")+e.name+"`:\n\n "+n.map(Le).join("\n ");var r}(e,t,n))}var We,Ke=0,Ge=function(){function e(){this.cacheId=Ke++,this.cache=i.w.map(),this.lastCacheModificationPerId=i.w.map()}return e.prototype.updateLastCacheModificationPerId=function(e){var t=this.lastCacheModificationPerId.get(e);this.lastCacheModificationPerId.set(e,void 0===t?1:t+1)},e.prototype.getLastCacheModificationPerId=function(e){var t=this.lastCacheModificationPerId.get(e)||0;return this.cacheId+"-"+t},e.prototype.addNodeToCache=function(e,t){if(void 0===t&&(t=!0),e.identifierAttribute){var n=e.identifier;this.cache.has(n)||this.cache.set(n,i.w.array([],ct));var r=this.cache.get(n);if(-1!==r.indexOf(e))throw ut("Already registered");r.push(e),t&&this.updateLastCacheModificationPerId(n)}},e.prototype.mergeCache=function(e){var t=this;Object(i.E)(e.identifierCache.cache).forEach((function(e){return e.forEach((function(e){t.addNodeToCache(e)}))}))},e.prototype.notifyDied=function(e){if(e.identifierAttribute){var t=e.identifier,n=this.cache.get(t);n&&(n.remove(e),n.length||this.cache.delete(t),this.updateLastCacheModificationPerId(e.identifier))}},e.prototype.splitCache=function(t){var n=this,r=new e,o=t.path;return Object(i.n)(this.cache).forEach((function(e){for(var t=m(e,2),i=t[0],a=t[1],s=!1,l=a.length-1;l>=0;l--)0===a[l].path.indexOf(o)&&(r.addNodeToCache(a[l],!1),a.splice(l,1),s=!0);s&&n.updateLastCacheModificationPerId(i)})),r},e.prototype.has=function(e,t){var n=this.cache.get(t);return!!n&&n.some((function(t){return e.isAssignableFrom(t.type)}))},e.prototype.resolve=function(e,t){var n=this.cache.get(t);if(!n)return null;var r=n.filter((function(t){return e.isAssignableFrom(t.type)}));switch(r.length){case 0:return null;case 1:return r[0];default:throw ut("Cannot resolve a reference to type '"+e.name+"' with id: '"+t+"' unambigously, there are multiple candidates: "+r.map((function(e){return e.path})).join(", "))}},e}();function Ye(e,t,n,r,o){var i=Ze(o);if(i){if(i.parent)throw ut("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 '"+(t?t.path:"")+"/"+n+"', but it lives already at '"+i.path+"'");return t&&i.setParent(t,n),i}return new le(e,t,n,r,o)}function qe(e,t,n,r,o){return new ie(e,t,n,r,o)}function Xe(e){return e instanceof ie||e instanceof le}function $e(e){return!(!e||!e.$treenode)}function Qe(e,t){kt(e,$e,"mobx-state-tree node",t)}function Je(e){if(!$e(e))throw ut("Value "+e+" is no MST Node");return e.$treenode}function Ze(e){return e&&e.$treenode||null}function et(){return Je(this).snapshot}!function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"}(We||(We={}));var tt=function(e){return".."};function nt(e,t){if(e.root!==t.root)throw ut("Cannot calculate relative path: objects '"+e+"' and '"+t+"' are not part of the same object tree");for(var n=Vt(e.path),r=Vt(t.path),o=0;o<n.length&&n[o]===r[o];o++);return n.slice(o).map(tt).join("/")+zt(r.slice(o))}function rt(e,t,n){return void 0===n&&(n=!0),ot(e,Vt(t),n)}function ot(e,t,n){void 0===n&&(n=!0);for(var r=e,o=0;o<t.length;o++){var i=t[o];if(".."===i){if(r=r.parent)continue}else{if("."===i)continue;if(r){if(r instanceof ie)try{var a=r.value;$e(a)&&(r=Je(a))}catch(s){if(!n)return;throw s}if(r instanceof le)if(r.getChildType(i)&&(r=r.getChildNode(i)))continue}}if(n)throw ut("Could not resolve '"+i+"' in path '"+(zt(t.slice(0,o))||"/")+"' while resolving '"+zt(t)+"'");return}return r}function it(e){if(!e)return st;var t=Object.keys(e);if(!t.length)return st;var n=new Array(t.length);return t.forEach((function(t,r){n[r]=e[t]})),n}function at(e){return Ct("process","`process()` has been renamed to `flow()`. See https://github.com/mobxjs/mobx-state-tree/issues/399 for more information. Note that the middleware event types starting with `process` now start with `flow`."),Nt(e)}var st=Object.freeze([]),lt=Object.freeze({}),ct="string"===typeof i.a?{deep:!1}:{deep:!1,proxy:!1};function ut(e){return void 0===e&&(e="Illegal state"),new Error("[mobx-state-tree] "+e)}function ft(e){return e}Object.freeze(ct);var dt=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e};function pt(e){return Array.isArray(e)||Object(i.s)(e)}function ht(e){return e?pt(e)?e:[e]:st}function vt(e){if(null===e||"object"!==typeof e)return!1;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function mt(e){return null!==e&&"object"===typeof e&&!(e instanceof Date)&&!(e instanceof RegExp)}function gt(e,t){return void 0===t&&(t=!0),null===e||void 0===e||!!("string"===typeof e||"number"===typeof e||"boolean"===typeof e||t&&e instanceof Date)}function yt(e){return e}function bt(e,t,n){Object.defineProperty(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}var wt=function(){function e(){this.handlers=[]}return Object.defineProperty(e.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!1,configurable:!0}),e.prototype.register=function(e,t){var n=this;return void 0===t&&(t=!1),t?this.handlers.unshift(e):this.handlers.push(e),function(){n.unregister(e)}},e.prototype.has=function(e){return this.handlers.indexOf(e)>=0},e.prototype.unregister=function(e){var t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)},e.prototype.clear=function(){this.handlers.length=0},e.prototype.emit=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this.handlers.slice();n.forEach((function(t){return t.apply(void 0,g(e))}))},e}(),xt=function(){function e(){}return e.prototype.hasSubscribers=function(e){var t=this.eventHandlers&&this.eventHandlers[e];return!!t&&t.hasSubscribers},e.prototype.register=function(e,t,n){void 0===n&&(n=!1),this.eventHandlers||(this.eventHandlers={});var r=this.eventHandlers[e];return r||(r=this.eventHandlers[e]=new wt),r.register(t,n)},e.prototype.has=function(e,t){var n=this.eventHandlers&&this.eventHandlers[e];return!!n&&n.has(t)},e.prototype.unregister=function(e,t){var n=this.eventHandlers&&this.eventHandlers[e];n&&n.unregister(t)},e.prototype.clear=function(e){this.eventHandlers&&delete this.eventHandlers[e]},e.prototype.clearAll=function(){this.eventHandlers=void 0},e.prototype.emit=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=this.eventHandlers&&this.eventHandlers[e];o&&(t=o).emit.apply(t,g(n))},e}();function Ot(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function Et(e,t){return 0===e.indexOf(t)}var Ct=function(e,t){};function _t(e){console.warn(new Error("[mobx-state-tree] "+e))}function kt(e,t,n,r){0}function St(e,t){kt()}function jt(e,t,n,r){kt(),void 0!==n&&kt(),void 0!==r&&kt()}function Tt(e,t,n){void 0===n&&(n=!0),kt(),n||kt()}function Pt(e){"function"===typeof queueMicrotask?queueMicrotask(e):"function"===typeof r?r(e):setTimeout(e,1)}function Nt(e){return function(e,t){var n=function(){var r=_e(),o=Ce();if(!o)throw ut("a mst flow must always have a parent context");var i=Se(o);if(!i)throw ut("a mst flow must always have a parent action context");var a={name:e,id:r,tree:o.tree,context:o.context,parentId:o.id,allParentIds:g(o.allParentIds,[o.id]),rootId:o.rootId,parentEvent:o,parentActionEvent:i},s=arguments;function l(e,t,r){e.$mst_middleware=n.$mst_middleware,ke(d(d({},a),{type:t,args:[r]}),e)}return new Promise((function(e,r){var o,i=function(){o=t.apply(null,arguments),c(void 0)};function c(e){var t;try{l((function(e){t=o.next(e)}),"flow_resume",e)}catch(n){return void Pt((function(){l((function(e){r(n)}),"flow_throw",n)}))}f(t)}function u(e){var t;try{l((function(e){t=o.throw(e)}),"flow_resume_error",e)}catch(n){return void Pt((function(){l((function(e){r(n)}),"flow_throw",n)}))}f(t)}function f(t){if(!t.done){if(!t.value||"function"!==typeof t.value.then)throw ut("Only promises can be yielded to `async`, got: "+t);return t.value.then(c,u)}Pt((function(){l((function(t){e(t)}),"flow_return",t.value)}))}i.$mst_middleware=n.$mst_middleware,ke(d(d({},a),{type:"flow_spawn",args:Ot(s)}),i)}))};return n}(e.name,e)}function Mt(e){return e}function Rt(e){return function(){var t,n=[];for(t=0;t<arguments.length;t++)n[t]=arguments[t];return h(this,(function(t){switch(t.label){case 0:return[4,e.apply(void 0,g(n))];case 1:return[2,t.sent()]}}))}}function At(e){return h(this,(function(t){switch(t.label){case 0:return[4,e];case 1:return[2,t.sent()]}}))}function It(e){switch(e.op){case"add":return{op:"add",path:e.path,value:e.value};case"remove":return{op:"remove",path:e.path};case"replace":return{op:"replace",path:e.path,value:e.value}}}function Dt(e){switch(e.op){case"add":return{op:"remove",path:e.path};case"remove":return{op:"add",path:e.path,value:e.oldValue};case"replace":return{op:"replace",path:e.path,value:e.oldValue}}}function Lt(e){return!0===("number"===typeof e)?""+e:-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ft(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function zt(e){if(0===e.length)return"";var t=function(e){return e.map(Lt).join("/")};return"."===e[0]||".."===e[0]?t(e):"/"+t(e)}function Vt(e){var t=e.split("/").map(Ft);if(!(""===e||"."===e||".."===e||Et(e,"/")||Et(e,"./")||Et(e,"../")))throw ut("a json path must be either rooted, empty or relative, but got '"+e+"'");return""===t[0]&&t.shift(),t}Ct.ids={};var Bt=function(e){function t(t,n,r){var o=e.call(this,r||t.name)||this;return o._subtype=t,o._processors=n,o}return f(t,e),Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|re.SnapshotProcessor},enumerable:!1,configurable:!0}),t.prototype.describe=function(){return"snapshotProcessor("+this._subtype.describe()+")"},t.prototype.preProcessSnapshot=function(e){return this._processors.preProcessor?this._processors.preProcessor.call(null,e):e},t.prototype.postProcessSnapshot=function(e){return this._processors.postProcessor?this._processors.postProcessor.call(null,e):e},t.prototype._fixNode=function(e){var t=this;!function(e,t){for(var n,r,o=[],i=2;i<arguments.length;i++)o[i-2]=arguments[i];try{for(var a=v(o),s=a.next();!s.done;s=a.next()){var l=s.value;e[l]=t[l].bind(t)}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}(e.type,this,"isAssignableFrom","create");var n=e.getSnapshot;e.getSnapshot=function(){return t.postProcessSnapshot(n.call(e))}},t.prototype.instantiate=function(e,t,n,r){var o=$e(r)?r:this.preProcessSnapshot(r),i=this._subtype.instantiate(e,t,n,o);return this._fixNode(i),i},t.prototype.reconcile=function(e,t,n,r){var o=this._subtype.reconcile(e,$e(t)?t:this.preProcessSnapshot(t),n,r);return o!==e&&this._fixNode(o),o},t.prototype.getSnapshot=function(e,t){void 0===t&&(t=!0);var n=this._subtype.getSnapshot(e);return t?this.postProcessSnapshot(n):n},t.prototype.isValidSnapshot=function(e,t){var n=this.preProcessSnapshot(e);return this._subtype.validate(n,t)},t.prototype.getSubTypes=function(){return this._subtype},t.prototype.is=function(e){var t=de(e)?this._subtype:$e(e)?j(e,!1):this.preProcessSnapshot(e);return 0===this._subtype.validate(t,[{path:"",type:this._subtype}]).length},t}(ce);var Ut,Ht="Map.put can only be used to store complex values that have an identifier type attribute";!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"}(Ut||(Ut={}));var Wt=function(e){function t(t){return e.call(this,t,i.w.ref.enhancer)||this}return f(t,e),t.prototype.get=function(t){return e.prototype.get.call(this,""+t)},t.prototype.has=function(t){return e.prototype.has.call(this,""+t)},t.prototype.delete=function(t){return e.prototype.delete.call(this,""+t)},t.prototype.set=function(t,n){return e.prototype.set.call(this,""+t,n)},t.prototype.put=function(e){if(!e)throw ut("Map.put cannot be used to set empty values");if($e(e)){var t=Je(e);if(null===t.identifier)throw ut(Ht);return this.set(t.identifier,e),e}if(mt(e)){var n=Je(this),r=n.type;if(r.identifierMode!==Ut.YES)throw ut(Ht);var o=e[r.mapIdentifierAttribute];if(!qn(o)){var i=this.put(r.getChildType().create(e,n.environment));return this.put(j(i))}var a=Yn(o);return this.set(a,e),this.get(a)}throw ut("Map.put can only be used to store complex values")},t}(i.b),Kt=function(e){function t(t,n,r){void 0===r&&(r=[]);var o=e.call(this,t)||this;return o._subType=n,o.identifierMode=Ut.UNKNOWN,o.mapIdentifierAttribute=void 0,o.flags=re.Map,o.hookInitializers=[],o._determineIdentifierMode(),o.hookInitializers=r,o}return f(t,e),t.prototype.hooks=function(e){var n=this.hookInitializers.length>0?this.hookInitializers.concat(e):[e];return new t(this.name,this._subType,n)},t.prototype.instantiate=function(e,t,n,r){return this._determineIdentif