!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?t(exports,require("mobx"),require("inferno"),require("hoist-non-inferno-statics")):"function"===typeof define&&define.amd?define(["exports","mobx","inferno","hoist-non-inferno-statics"],t):t(((e="undefined"!==typeof globalThis?globalThis:e||self).Inferno=e.Inferno||{},e.Inferno.Mobx={}),e.mobx,e.Inferno,e.hoistNonReactStatics)}(this,(function(e,t,n,o){"use strict";function r(e){return e&&"object"===typeof e&&"default"in e?e:{default:e}}var i=r(o),s=function(){this.listeners=[]};function a(e){console.error(e)}s.prototype.on=function(e){var t=this;return this.listeners.push(e),function(){var n=t.listeners.indexOf(e);-1!==n&&t.listeners.splice(n,1)}},s.prototype.emit=function(e){for(var t=this.listeners,n=0,o=t.length;n<o;++n)t[n](e)};var c=!1,p=!1,u=!1,f=new s;function l(e){var t=e.$LI.dom;f.emit({component:e,event:"render",node:t,renderTime:e.__$mobRenderEnd-e.__$mobRenderStart,totalTime:Date.now()-e.__$mobRenderStart})}var d=new s;function m(e,t,n){var o=e[t],r=v[t],i=o?!0===n?function(){r.apply(this,arguments),o.apply(this,arguments)}:function(){o.apply(this,arguments),r.apply(this,arguments)}:r;e[t]=i}function h(e,t){if(null==e||null==t||"object"!==typeof e||"object"!==typeof t)return e!==t;var n,o=Object.keys(e);if(o.length!==Object.keys(t).length)return!0;for(var r=o.length-1;r>=0;r--)if(t[n=o[r]]!==e[n])return!0;return!1}var v={componentWillMount:function(){var e=this;if(!0===p)return;var n=this.displayName||this.name||this.constructor&&(this.constructor.displayName||this.constructor.name)||"<component>",o=!1;function r(e){var n=this[e],r=t.createAtom("reactive "+e);Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:function(){return r.reportObserved(),n},set:function(e){h(n,e)?(n=e,o=!0,r.reportChanged(),o=!1):n=e}})}r.call(this,"props"),r.call(this,"state");var i=this,s=this.render.bind(this),a=function(){return s(i.props,i.state,i.context)},u=null,f=!1,l=function(){var n;f=!1;var o=null;if(u.track((function(){c&&(e.__$mobRenderStart=Date.now());try{o=t._allowStateChanges(!1,a)}catch(e){n=e}c&&(e.__$mobRenderEnd=Date.now())})),n)throw d.emit(n),n;return o};this.render=function(){return(u=new t.Reaction(n+".render()",(function(){f||(f=!0,"function"===typeof e.componentWillReact&&e.componentWillReact(),o||e.forceUpdate())}))).reactComponent=e,l.$mobx=u,e.render=l,l()}},componentWillUnmount:function(){if(!0===p)return;if(this.render.$mobx&&this.render.$mobx.dispose(),c){var e=this.$LI.dom;f.emit({component:this,event:"destroy",node:e})}},componentDidMount:function(){c&&l(this)},componentDidUpdate:function(){c&&l(this)},shouldComponentUpdate:function(e,t){if(p&&a("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."),this.state!==t)return!0;return h(this.props,e)}};function y(e,t){var o;if("string"===typeof e)throw new Error("Store names should be provided as array");if(Array.isArray(e))return u||(u=!0,a('Mobx observer: Using observer to inject stores is deprecated since 4.0. Use `@inject("store1", "store2") @observer ComponentClass` or `inject("store1", "store2")(observer(componentClass))` instead of `@observer(["store1", "store2"]) ComponentClass`')),t?_.apply(null,e)(y(t)):function(t){return y(e,t)};var r,i=e;if(!0===i.isMobxInjector&&a("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),"function"===typeof i&&(!i.prototype||!i.prototype.render))return y(((o=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(e,t,n){return i(e,n)},t}(n.Component)).displayName=i.displayName||i.name,o.defaultProps=i.defaultProps,o));if(!i)throw new Error("Please pass a valid component to 'observer'");return m(r=i.prototype||i,"componentWillMount",!0),m(r,"componentDidMount",!1),m(r,"componentWillUnmount",!1),m(r,"componentDidUpdate",!1),r.shouldComponentUpdate||(r.shouldComponentUpdate=v.shouldComponentUpdate),i.isMobXReactObserver=!0,i}var b=y((function(e){return(0,e.children)()}));b.displayName="Observer";var g={isMobxInjector:{configurable:!0,enumerable:!0,value:!0,writable:!0}};function x(e,t,o){var r="inject-"+(t.displayName||t.name||t.constructor&&t.constructor.name||"Unknown");o&&(r+="-with-"+o);var s=function(o){function r(e,t){o.call(this,e,t),this.storeRef=this.storeRef.bind(this)}return o&&(r.__proto__=o),r.prototype=Object.create(o&&o.prototype),r.prototype.constructor=r,r.prototype.storeRef=function(e){this.wrappedInstance=e},r.prototype.render=function(o,r,i){var s,a={};for(s in o)a[s]=o[s];var c=e(i.mobxStores||{},a,i)||{};for(s in c)a[s]=c[s];return n.createComponentVNode(2,t,a,null,function(e){return!(e.prototype&&e.prototype.render)}(t)?null:this.storeRef)},r}(n.Component);return s.displayName=r,s.isMobxInjector=!1,i.default(s,t),s.wrappedComponent=t,Object.defineProperties(s,g),s}function j(e){return function(t,n){for(var o=0,r=e.length;o<r;++o){var i=e[o];i in n||(n[i]=t[i])}return n}}function _(){var e,t=arguments;if("function"===typeof arguments[0])return e=arguments[0],function(t){var n=x(e,t);return n.isMobxInjector=!1,(n=y(n)).isMobxInjector=!0,n};for(var n=[],o=0;o<arguments.length;++o)n.push(t[o]);return e=j(n),function(t){return x(e,t,n.join("-"))}}var C={children:!0,key:!0,ref:!0},w=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.render=function(e){return e.children},t.prototype.getChildContext=function(){var e={},t=this.props,n=this.context.mobxStores;if(n)for(var o in n)e[o]=n[o];for(var r in t)void 0===C[r]&&"suppressChangedStoreWarning"!==r&&(e[r]=t[r]);return{mobxStores:e}},t}(n.Component);e.EventEmitter=s,e.Observer=b,e.Provider=w,e.errorsReporter=d,e.inject=_,e.observer=y,e.onError=function(e){return d.on(e)},e.renderReporter=f,e.trackComponents=function(){c?(c=!1,f.listeners.length=0):(c=!0,a("Do not turn trackComponents on in production, its expensive. For tracking dom nodes you need inferno-compat."))},e.useStaticRendering=function(e){p=e},Object.defineProperty(e,"__esModule",{value:!0})}));
