UNPKG

react-redux-provide

Version:

Build your UI with React. Manage application state with Redux providers. Persist and share application state with replication. Use pure functions everywhere.

2 lines 35.6 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("redux"),require("redux-replicate")):"function"==typeof define&&define.amd?define(["react","redux","redux-replicate"],t):"object"==typeof exports?exports.ReactReduxProvide=t(require("react"),require("redux"),require("redux-replicate")):e.ReactReduxProvide=t(e.React,e.Redux,e.ReduxReplicate)}(this,function(e,t,r){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.unshiftClear=t.pushClear=t.unshiftWait=t.pushWait=t.unshiftReplicator=t.pushReplicator=t.unshiftReplication=t.pushReplication=t.unshiftOnReady=t.pushOnReady=t.unshiftOnInstantiated=t.pushOnInstantiated=t.unshiftEnhancer=t.pushEnhancer=t.unshiftMiddleware=t.pushMiddleware=t.handleQueries=t.getMergedResult=t.getQueryHandlers=t.getQueriesOptions=t.getQueryOptions=t.getQuery=t.getQueries=t.getFunctionOrObject=t.getQueryResults=t.getActiveQueries=t.getProviderInstances=t.getProviders=t.getFromContextOrProps=t.instantiateProvider=t.shallowEqual=t.createKeyConcat=t.getInitialState=t.getClientState=t.createProviderStore=t.reloadProviders=t.reloadFunctions=t.provide=void 0;var i=r(7),o=n(i),a=r(3),u=n(a),s=r(2),c=n(s),f=r(1),l=n(f),d=r(5),p=n(d),y=r(6);t.default=o.default,t.provide=o.default,t.reloadFunctions=i.reloadFunctions,t.reloadProviders=i.reloadProviders,t.createProviderStore=u.default,t.getClientState=a.getClientState,t.getInitialState=a.getInitialState,t.createKeyConcat=c.default,t.shallowEqual=l.default,t.instantiateProvider=p.default,t.getFromContextOrProps=d.getFromContextOrProps,t.getProviders=d.getProviders,t.getProviderInstances=d.getProviderInstances,t.getActiveQueries=d.getActiveQueries,t.getQueryResults=d.getQueryResults,t.getFunctionOrObject=d.getFunctionOrObject,t.getQueries=d.getQueries,t.getQuery=d.getQuery,t.getQueryOptions=d.getQueryOptions,t.getQueriesOptions=d.getQueriesOptions,t.getQueryHandlers=d.getQueryHandlers,t.getMergedResult=d.getMergedResult,t.handleQueries=d.handleQueries,t.pushMiddleware=y.pushMiddleware,t.unshiftMiddleware=y.unshiftMiddleware,t.pushEnhancer=y.pushEnhancer,t.unshiftEnhancer=y.unshiftEnhancer,t.pushOnInstantiated=y.pushOnInstantiated,t.unshiftOnInstantiated=y.unshiftOnInstantiated,t.pushOnReady=y.pushOnReady,t.unshiftOnReady=y.unshiftOnReady,t.pushReplication=y.pushReplication,t.unshiftReplication=y.unshiftReplication,t.pushReplicator=y.pushReplicator,t.unshiftReplicator=y.unshiftReplicator,t.pushWait=y.pushWait,t.unshiftWait=y.unshiftWait,t.pushClear=y.pushClear,t.unshiftClear=y.unshiftClear},function(e,t){"use strict";function r(e,t){if(e===t)return!0;if(!e||"object"!==("undefined"==typeof e?"undefined":n(e))||!t||"object"!==("undefined"==typeof t?"undefined":n(t)))return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var o=Object.prototype.hasOwnProperty,a=0;a<r.length;a++)if(!o.call(t,r[a])||e[r[a]]!==t[r[a]])return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=r},function(e,t){"use strict";function r(e,t){var r=e,n=function(e){return e};return Array.isArray(e)&&(e=[].concat(e),r=e.pop(),n=function(t){return e.reduce(function(e,t){return e[t]},t)}),function(e,i){for(var o in e){var a=n(e[o]);a&&(a[r]?Array.isArray(a[r])||(a[r]=[a[r]]):a[r]=[],t?a[r]=[].concat(i).concat(a[r]):a[r]=a[r].concat(i))}}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function o(e){var t=e.providerKey;if("undefined"!=typeof window&&window.clientStates){var r=window.clientStates[t];if("undefined"!=typeof r)return r}return null}function a(e){var t=e.providerKey,r=e.state,n=o({providerKey:t,state:r});return n?(delete window.clientStates[t],r?s({},r,n):n):r||{}}function u(e,t,r,n,u){function f(i){var a=i.key,s=i.reducerKeys,c=i.queryable,f=i.baseQuery,d=i.replicator;if(d){if(f){if(Array.isArray(s))for(var p in f)s.indexOf(p)<0&&s.push(p);if(Array.isArray(c))for(var y in f)c.indexOf(y)<0&&c.push(y)}b.unshift((0,l.default)({key:"undefined"==typeof a?t:a,reducerKeys:s,queryable:c,replicator:d,create:n||Boolean(r),clientState:o(e),creatorStore:u}))}}var d=e.reducers,p=e.middleware,y=e.enhancer,h=e.replication,v={},g={},b=[],m=void 0,w=void 0,O=void 0,S=void 0,x=void 0;if("undefined"==typeof t&&(t=e.providerKey),p&&b.push(c.applyMiddleware.apply(null,[].concat(p))),y&&(b=b.concat(y)),h)if(Array.isArray(h)){var P=!0,R=!1,I=void 0;try{for(var k,A=h[Symbol.iterator]();!(P=(k=A.next()).done);P=!0){var Q=k.value,j=Q.key;if("undefined"!=typeof j){t=j;break}}}catch(e){R=!0,I=e}finally{try{!P&&A.return&&A.return()}finally{if(R)throw I}}h.forEach(f)}else f(h);m=b.length?c.compose.apply(void 0,i(b))(c.createStore):c.createStore;var C={},E=s({},r||a(e));return Object.keys(d).forEach(function(e){"undefined"!=typeof E[e]&&(C[e]=E[e]),v[e]=function(t,r){var n=void 0;return n=S&&"undefined"!=typeof S[e]?S[e]:d[e](t,r),g[e]&&t!==n&&g[e].forEach(function(e){return e(n)}),n}}),x=(0,c.combineReducers)(v),w=m(x,C),w.watch=function(e,t){return g[e]||(g[e]=new Set),g[e].add(t),function(){return g[e].delete(t)}},O=w.setState,w.setState=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t[0],i=w.getState();if(O){var o=function(e){var t=i[e],r=n[e];g[e]&&t!==r&&g[e].forEach(function(e){return e(r)})};for(var a in n)o(a);O.apply(void 0,t)}else S=n,w.replaceReducer(x),S=null},w}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.getClientState=o,t.getInitialState=a,t.default=u;var c=r(16),f=r(17),l=n(f)},function(e,t){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=[];if("object"===("undefined"==typeof t?"undefined":n(t)))for(var i in t)i in e&&r.push(i);return r}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=r},function(e,t,r){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function o(e,t,r,n,i,a,s){function l(){if(Array.isArray(y.onReady)?y.onReady.forEach(function(e){return e(y)}):y.onReady&&y.onReady(y),t.clear){var e=q!==y.store.getState();t.clear.forEach(function(t){return t(e)})}}1===arguments.length&&(e=arguments[0].fauxInstance,t=arguments[0].provider,r=arguments[0].providerKey,n=arguments[0].readyCallback,i=arguments[0].createState,a=arguments[0].getReducerKeys,s=arguments[0].useCreator,e||(t=arguments[0],e={})),e.props||(e.props={}),"undefined"==typeof r&&(r=t.key),t.actions||(t.actions={}),t.reducers||(t.reducers={}),a===!0&&(a=t.reducers);var d=c(e),p=f(e),y=void 0,h="function"!=typeof r,v=void 0,g=void 0;if("string"==typeof t.key?d[t.key]||(d[t.key]=t):t.defaultKey?d[t.defaultKey]||(d[t.defaultKey]=t):t.key&&t.key.toString?d[t.key.toString()]||(d[t.key.toString()]=t):console.warn("Missing or invalid provider key!"),h||(r=r(e),h=r===t.key),null===r&&(v=null,r=t.defaultKey,h=!0),y=t.isGlobal?M[r]:p&&p[r],e.relevantProviders&&(e.relevantProviders[r]=!0),i&&"object"===("undefined"==typeof i?"undefined":I(i))&&t.state&&"object"===I(t.state)&&(i=R({},t.state,i)),y){if(!i)return p[r]=y,n&&(y.ready?n(y):(0,T.pushOnReady)({providerInstance:y},n)),y;if(!s)return p[r]=y,y.store.setState(i,!1,!0),n&&(y.ready?n(y):(0,T.pushOnReady)({providerInstance:y},n)),y;g=y}if(!t.hasThunk){var b=function(e){if((0,j.default)(t.reducers,e).length)return t;for(var r in d)if((0,j.default)(d[r].reducers,e).length)return d[r];return t},m=function(t,r){function n(){0===--a&&r(i)}var i=[],a=t&&t.length;return a?void t.forEach(function(t,r){i[r]=null,o({fauxInstance:u(e,t),provider:b(t),readyCallback:function(e){i[r]=e,n()}})}):(a=1,void n())},w=function(t,r,n,i){var a=void 0,s=void 0;return"string"==typeof t?(p[t]&&(s=t),a=d[t]||p[t],t={}):a=b(t),o({fauxInstance:u(e,t),provider:a,providerKey:s,readyCallback:r,createState:n?t:null,useCreator:i})},O=function(e,t,r,n){var i=[],o=e.length,a=function(){0===--o&&t&&t(i)};return e.forEach(function(e,t){w(e,function(e){i[t]=e,a()},r)}),i},x=function(e,t,r){return w(e,t,!0,r)},P=function(e,t,r){return O(e,t,!0,r)},k=function(e){var t=[],r=[],n=null;_||(window.clientStates||(window.clientStates={}),n=window.clientStates);var i=function(i){var o=e[i],a=p[i];a?a.store.setState&&r.push(function(){return a.store.setState(o)}):(n&&(n[i]=o),t.push(o))};for(var o in e)i(o);for(;t.length;)w(t.shift());for(;r.length;)r.shift()()},A=function(t,r,n){2===arguments.length&&(n=r,r=!1),S(u(e,t),function(){function e(){0===--u&&n(o)}if(!r)return void n(t.query?t.result:t.results);if(t.query)return void m(t.result,n);var i=t.results,o={},a=i&&Object.keys(i),u=a&&a.length;u||(u=1,e()),a.forEach(function(t){o[t]=[],m(i[t],function(r){o[t]=r,e()})})})};t.hasThunk=!0,t.wait&&!Array.isArray(t.wait)&&(t.wait=[t.wait]),t.clear&&!Array.isArray(t.clear)&&(t.clear=[t.clear]);var Q={getInstance:w,getInstances:O,createInstance:x,createInstances:P,setStates:k,find:A};(0,T.unshiftMiddleware)({provider:t},function(e){var r=e.dispatch,n=e.getState;return function(e){return function(i){return"function"!=typeof i?e(i):(t.wait&&t.wait.forEach(function(e){return e()}),i(function(e){var n=C.getState(),i=!1;r(e),t.clear&&(i=n!==C.getState(),t.clear.forEach(function(e){return e(i)}))},n,Q))}}})}t.wait&&t.wait.forEach(function(e){return e()}),y=Object.create(t),y.providerKey=r,y.isStatic=h;var C=(0,E.default)(y,v,i,i?function(r){var n=y,i=n.onReady;y=o({fauxInstance:u(e,r),provider:t,readyCallback:function(e){Array.isArray(i)?i.forEach(function(t){return t(e)}):i&&i(e)}})}:null,g&&g.store),q=C.getState(),K=y,F=K.actions,U={},N=C.setKey;N&&(C.setKey=function(e,r){t.wait&&t.wait.forEach(function(e){return e()}),N(e,function(){Array.isArray(y.onReady)?y.onReady.forEach(function(e){return e(y)}):y.onReady&&y.onReady(y),r&&r(),t.clear&&t.clear.forEach(function(e){return e(!0)})})});var W=function(e){U[e]=function(){return C.dispatch(F[e].apply(this,arguments))}};for(var D in F)W(D);return y.store=C,y.actionCreators=U,i||(t.isGlobal&&(M[r]=y),p&&(p[r]=y),t.instances||(t.instances=[]),t.instances.push(y)),t.subscribers&&Object.keys(t.subscribers).forEach(function(e){var r=t.subscribers[e],n=d[e],i=t.defaultKey||("function"==typeof t.key?t.key({}):String(t.key)),o=function(){var e=n&&n.instances;e&&e.forEach(function(e){r(y,e)})};n&&(n.subscribeTo||(n.subscribeTo={}),n.subscribeTo[i]||(n.subscribeTo[i]=r)),y.store.subscribe(o),o()}),t.subscribeTo&&Object.keys(t.subscribeTo).forEach(function(e){var r=t.subscribeTo[e],n=d[e],i=t.defaultKey||("function"==typeof t.key?t.key({}):String(t.key));n&&(n.subscribers||(n.subscribers={}),n.subscribers[i]||(n.subscribers[i]=r,n.instances&&n.instances.forEach(function(e){e.store.subscribe(function(){t.instances.forEach(function(t){r(e,t)})})})),n.instances&&n.instances.forEach(function(e){r(e,y)}))}),i||(Array.isArray(y.onInstantiated)?y.onInstantiated.forEach(function(e){return e(y)}):y.onInstantiated&&y.onInstantiated(y)),(0,T.unshiftOnReady)({providerInstance:y},function(){y.ready=!0}),n&&(0,T.pushOnReady)({providerInstance:y},n),t.replication&&C.onReady&&!C.initializedReplication?C.onReady(l):l(),y}function a(e){return e.context||(e.context={}),e.context}function u(e,t){return{props:t,context:a(e),providers:c(e),providerInstances:f(e),activeQueries:l(e),queryResults:d(e),partialStates:p(e)}}function s(e,t,r){if("undefined"==typeof e[t]){var n=e.props,i=a(e);"undefined"!=typeof n[t]?e[t]=n[t]:"undefined"!=typeof i[t]?e[t]=i[t]:e[t]=r}return e[t]}function c(e){return s(e,"providers",{})}function f(e){return s(e,"providerInstances",{})}function l(e){return s(e,"activeQueries",{})}function d(e){return s(e,"queryResults",{})}function p(e){return s(e,"partialStates",{})}function y(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("undefined"!=typeof e[t])return e[t];var n=e.props[t];return"function"==typeof n&&(n=n(e)),e[t]=n||r,e[t]}function h(e){if(h.disabled)return!1;if("undefined"!=typeof e.queries)return e.queries;var t=e.props,r=(e.relevantProviders,c(e)),n=v(e),i=y(e,"queries"),a=!1;if(n){i?"function"!=typeof t.queries&&(i=R({},i)):i={};for(var u in r){var s=r[u],f=(0,j.default)(s.reducers,n);if(f.length){i[u]||(i[u]={});var l=!0,d=!1,p=void 0;try{for(var g,b=f[Symbol.iterator]();!(l=(g=b.next()).done);l=!0){var m=g.value;i[u][m]=n[m]}}catch(e){d=!0,p=e}finally{try{!l&&b.return&&b.return()}finally{if(d)throw p}}}}}for(var w in i){var O=i[w];"function"==typeof O&&(i[w]=O(e)),o(e,r[w]),a=!0}return a||(i=null,t.query&&(t.result=null),t.queries&&(t.results={})),e.queries=i,i}function v(e){return y(e,"query")}function g(e){return y(e,"queryOptions")}function b(e){return y(e,"queriesOptions",{})}function m(e){var t=[],r=e.replication;if(r){Array.isArray(r)||(r=[r]);var n=!0,i=!1,o=void 0;try{for(var a,u=r[Symbol.iterator]();!(n=(a=u.next()).done);n=!0){var s=a.value,c=s.replicator,f=s.reducerKeys,l=s.baseQuery,d=s.baseQueryOptions;if(c){Array.isArray(c)||(c=[c]);var p=!0,y=!1,h=void 0;try{for(var v,g=c[Symbol.iterator]();!(p=(v=g.next()).done);p=!0){var b=v.value,m=b.handleQuery;m&&t.push({handleQuery:m,reducerKeys:f||Object.keys(e.reducers),baseQuery:l,baseQueryOptions:d})}}catch(e){y=!0,h=e}finally{try{!p&&g.return&&g.return()}finally{if(y)throw h}}}}}catch(e){i=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}}return t}function w(e,t){return Array.isArray(t)?[].concat(i(e||[]),i(t)):t&&"object"===("undefined"==typeof t?"undefined":I(t))&&t.constructor===Object?R({},e||{},t):"undefined"!=typeof t?t:e}function O(e,t){if(e===t)return!0;if(("undefined"==typeof e?"undefined":I(e))!==("undefined"==typeof t?"undefined":I(t)))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;var r=0,n=e.length;if(n!==t.length)return!1;for(;r<n;){if(!(0,A.default)(e[r],t[r]))return!1;r++}}else if(Array.isArray(t))return!1;return(0,A.default)(e,t)}function S(e,t,r){var n=!1,i=h(e);if(!i)return t&&t(n),!1;var o=e.props,u=a(e),s=o.result,y=o.results,S=!1;r||(r=R({},o.results));var P=(v(e),g(e)),I=b(e),k=l(e),A=d(e),Q=p(e),j=c(e),C=f(e),E=function(e,t){if(t&&"function"==typeof t.map&&_){var r=!0,n=!1,i=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done);r=!0){var s=o.value,c=e.key;"function"==typeof c&&(c=c({props:s,context:u})),null===c||C[c]||(Q[c]=s)}}catch(e){n=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}}},T=Object.keys(i).length,M=function(){0===--T&&t&&t(n)},K=function(e){o.query&&(o.result=w(o.result,e))};return o.query&&(o.result=null),o.results={},Object.keys(i).forEach(function(a){var u=j[a],s=m(u),c=s.length;if(!c)return void M();S=!0,Array.isArray(u.wait)?u.wait.forEach(function(e){return e()}):u.wait&&u.wait();var f=i[a],l=P||I[a]||{},d=JSON.stringify({query:f,options:l}),p=A[d],y="undefined"!=typeof p;x(a,u,e,d,f,t);var h=function e(t){if(!k[d])return void console.warn("setResult was called but the following query is no longer active:",{query:f,options:l});var i=k[d].values().next().value,s=e===i,h=y?p:r[a],v=e.asyncReset;n||O(t,h)||(n=!0),v&&(e.asyncReset=!1,o.results={},o.query&&(o.result=null)),o.results[a]=t,r[a]=t,A[d]=t,K(t),s&&k[d]&&k[d].forEach(function(r){r!==e&&r(t)}),0===--c&&(k[d].delete(e),k[d].size||(delete k[d],E(u,t)),Array.isArray(u.clear)?u.clear.forEach(function(e){return e(n)}):u.clear&&u.clear(n),M(),_&&!q||delete A[d])},v=function(e){console.error(e)};return k[d]?void k[d].add(h):(k[d]=new Set,k[d].add(h),y?(c=1,void h(p)):void s.forEach(function(e){var t=e.handleQuery,r=e.reducerKeys,n=e.baseQuery,i=e.baseQueryOptions,o=c,a=R({},n,f),s=R({},i,l);if("undefined"==typeof s.select?s.select=r===!0?Object.keys(u.reducers):r:Array.isArray(s.select)||(s.select=[s.select]),Array.isArray(s.select))for(var p in a)s.select.indexOf(p)<0&&s.select.push(p);t({query:a,options:s,setResult:h,setError:v}),c===o&&k[d].forEach(function(e){e.asyncReset=e.asyncReset!==!1})}))}),S||(o.result=s,o.results=y),S}function x(e,t,r,n,i,o){if(!_&&r.props.__wrapper){if(r.requeryCallback=o,t.subscribedFauxInstances||(t.subscribedFauxInstances={}),t.subscribedFauxInstances[n])return void t.subscribedFauxInstances[n].add(r);var a=new Set;t.subscribedFauxInstances[n]=a,a.add(r);var u=void 0,s=function(e){clearTimeout(u),u=setTimeout(function(){var e=!0,t=!1,r=void 0;try{for(var n,i=a[Symbol.iterator]();!(e=(n=i.next()).done);e=!0){var o=n.value;o.props.__wrapper.unmounted?a.delete(o):S(o,o.requeryCallback)}}catch(e){t=!0,r=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw r}}})};(0,T.pushOnReady)({provider:t},s),t.subscriber||(t.subscriber={});var c=t.subscriber[e];t.subscriber[e]=function(e,t){c&&c(e,t),P(e,i)&&s(e)},t.instances&&t.instances.forEach(function(e){e.store.subscribe(function(){P(e,i)&&s(e)})})}}function P(e,t){var r=e.store.getState(),n=e.lastQueriedState;if(e.lastQueriedState=r,!n)return!0;if(r!==n){if("object"!==("undefined"==typeof t?"undefined":I(t)))return!0;for(var i in t)if(r[i]!==n[i])return!0}return!1}Object.defineProperty(t,"__esModule",{value:!0});var R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=o,t.getTempFauxInstance=u,t.getFromContextOrProps=s,t.getProviders=c,t.getProviderInstances=f,t.getActiveQueries=l,t.getQueryResults=d,t.getPartialStates=p,t.getFunctionOrObject=y,t.getQueries=h,t.getQuery=v,t.getQueryOptions=g,t.getQueriesOptions=b,t.getQueryHandlers=m,t.getMergedResult=w,t.resultsEqual=O,t.handleQueries=S;var k=r(1),A=n(k),Q=r(4),j=n(Q),C=r(3),E=n(C),T=r(6),_="undefined"==typeof window,q="undefined"!=typeof e&&e.env&&!1,M={}}).call(t,r(11))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.unshiftClear=t.pushClear=t.unshiftWait=t.pushWait=t.unshiftReplicator=t.pushReplicator=t.unshiftReplication=t.pushReplication=t.unshiftOnReady=t.pushOnReady=t.unshiftOnInstantiated=t.pushOnInstantiated=t.unshiftEnhancer=t.pushEnhancer=t.unshiftMiddleware=t.pushMiddleware=void 0;var i=r(2),o=n(i),a="middleware",u=(t.pushMiddleware=(0,o.default)(a),t.unshiftMiddleware=(0,o.default)(a,!0),"enhancer"),s=(t.pushEnhancer=(0,o.default)(u),t.unshiftEnhancer=(0,o.default)(u,!0),"onInstantiated"),c=(t.pushOnInstantiated=(0,o.default)(s),t.unshiftOnInstantiated=(0,o.default)(s,!0),"onReady"),f=(t.pushOnReady=(0,o.default)(c),t.unshiftOnReady=(0,o.default)(c,!0),"replication"),l=(t.pushReplication=(0,o.default)(f),t.unshiftReplication=(0,o.default)(f,!0),[f,"replicator"]),d=(t.pushReplicator=(0,o.default)(l),t.unshiftReplicator=(0,o.default)(l,!0),"wait"),p=(t.pushWait=(0,o.default)(d),t.unshiftWait=(0,o.default)(d,!0),"clear");t.pushClear=(0,o.default)(p),t.unshiftClear=(0,o.default)(p,!0)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"Provide"+s+"("+Object.keys(e).join(",")+")"}var r,n;if(e.ComponentClass)return e;var s=e.displayName||e.name,c=(n=r=function(r){function n(e,t){o(this,n);var r=a(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e));return r.render=R?function(){var e=r.getWrappedInstance();return r.deinitialize(),e}:function(){return r.getWrappedInstance()},R||t.providers||(window.rootInstance=r,r.initializeClientStates(e,t)),r.renders=0,r.componentName=s,r.unmounted=!0,r.initialize(e,t),r}return u(n,r),d(n,[{key:"getChildContext",value:function(){return{providers:this.getProviders(),providerInstances:this.getProviderInstances(),activeQueries:this.getActiveQueries(),queryResults:this.getQueryResults(),partialStates:this.getPartialStates(),forceDeepUpdate:this.forceDeepUpdate}}},{key:"getProviders",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.context;return this.providers=this.providers||e.providers||t.providers||{},this.providers}},{key:"getProviderInstances",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.context;return this.providerInstances=this.providerInstances||e.providerInstances||t.providerInstances||{},this.providerInstances}},{key:"getActiveQueries",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.context;return this.activeQueries=this.activeQueries||e.activeQueries||t.activeQueries||{},this.activeQueries}},{key:"getQueryResults",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.context;return this.queryResults=this.queryResults||e.queryResults||t.queryResults||{},this.queryResults}},{key:"getPartialStates",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.context;return this.partialStates=this.partialStates||e.partialStates||t.partialStates||{},this.partialStates}}]),d(n,[{key:"componentDidMount",value:function(){this.unmounted=R}},{key:"componentWillUnmount",value:function(){this.unmounted=!0,this.deinitialize()}},{key:"componentWillReceiveProps",value:function(e){(0,w.default)(e,this.props)||(this.deinitialize(),this.initialize(e,this.context),this.receivedNewProps=!0)}},{key:"shouldComponentUpdate",value:function(){return!(!this.forceDeepUpdate&&!this.context.forceDeepUpdate)||!!this.receivedNewProps&&(this.receivedNewProps=!1,!0)}},{key:"update",value:function(){this.unmounted||this.forceUpdate()}},{key:"initializeClientStates",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.context,r=window,n=r.clientStates,i=this.getFauxInstance(e,t),o=this.getProviders(e,t),a=function(e){for(var t in o){var r=o[t];if((0,S.default)(r.reducers,e).length)return"undefined"==typeof r.defaultKey&&(r.defaultKey=t),"undefined"==typeof r.key&&(r.key=r.defaultKey),r}};if(n)for(var u in n){var s=n[u],c=a(s);c&&(0,P.default)((0,x.getTempFauxInstance)(i,s),c)}}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.context,r=this.getProviders(e,t);this.relevantProviders={};for(var n in r){var i=r[n],o=!1;"undefined"==typeof i.defaultKey&&(i.defaultKey=n),"undefined"==typeof i.key&&(i.key=i.defaultKey),this.assignActionCreators(e,t,i),this.assignReducers(e,t,i)&&(o=!0),this.assignMergers(e,t,i)&&(o=!0),o&&this.subscribeToProvider(e,t,i)}this.handleQueries(e,t),this.setDisplayName(e,t),this.doUpdate&&this.update()}},{key:"deinitialize",value:function(){this.unsubscribe(),delete this.relevantProviders,delete this.componentProps,delete this.fauxInstance,delete this.subbedAll,delete this.query,delete this.queryOptions,delete this.queries,delete this.queriesOptions,delete this.subscriptions,delete this.mergers,delete this.wrappedInstance}},{key:"unsubscribe",value:function e(){for(var t=this.getSubscriptions();t.length;){var e=t.shift();e()}}},{key:"setDisplayName",value:function(e,r){n.displayName=t(this.relevantProviders)}},{key:"getComponentProps",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props;arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.context;return this.componentProps||(this.componentProps=l({},e.defaultProps,t,{__wrapper:this}),!this.componentProps.ref&&e.prototype.render&&(this.componentProps.ref="wrappedInstance")),this.componentProps}},{key:"getFauxInstance",value:function(e,t){var r=this;if(!this.fauxInstance){var n=this.getComponentProps(e,t);this.getProviders(e,t),this.getProviderInstances(e,t),this.getActiveQueries(e,t),this.getQueryResults(e,t),this.getPartialStates(e,t),this.getSubscriptions(e,t),this.fauxInstance=l({},Object.getOwnPropertyNames(this).reduce(function(e,t){return l({},e,i({},t,r[t]))},{}),{props:n})}return this.fauxInstance.context=t,this.fauxInstance}},{key:"getSubscriptions",value:function(){return this.subscriptions||(this.subscriptions=[]),this.subscriptions}},{key:"getMergers",value:function(){return this.mergers||(this.mergers={}),this.mergers}},{key:"getWrappedInstance",value:function(){return this.context.forceDeepUpdate&&(this.doUpdate=!0),this.wrappedInstance&&!this.doUpdate||(this.renders++,this.doUpdate=!1,this.wrappedInstance=y.default.createElement(e,this.getComponentProps())),this.wrappedInstance}},{key:"getProviderInstance",value:function(e,t,r,n){return(0,P.default)({fauxInstance:this.getFauxInstance(e,t),provider:r,getReducerKeys:n})}},{key:"assignActionCreators",value:function(t,r,n){var i=(0,S.default)(n.actions,e.propTypes);if(!i.length)return!1;var o=this.getComponentProps(t,r),a=this.getProviderInstance(t,r,n,!0),u=a.actionCreators,s=!0,c=!1,f=void 0;try{for(var l,d=i[Symbol.iterator]();!(s=(l=d.next()).done);s=!0){var p=l.value;t[p]||(o[p]=u[p])}}catch(e){c=!0,f=e}finally{try{!s&&d.return&&d.return()}finally{if(c)throw f}}return!0}},{key:"assignReducers",value:function(t,r,n){var i=this,o=(0,S.default)(n.reducers,e.propTypes);if(!o.length)return!1;var a={},u=!1,s=!0,c=!1,f=void 0;try{for(var l,d=o[Symbol.iterator]();!(s=(l=d.next()).done);s=!0){var p=l.value;"undefined"==typeof t[p]&&(a[p]=!0,u=!0)}}catch(e){c=!0,f=e}finally{try{!s&&d.return&&d.return()}finally{if(c)throw f}}if(!u)return!1;var y=this.getSubscriptions(),h=this.getComponentProps(t,r),v=this.getProviderInstance(t,r,n,a),g=v.store,b=g.getState(),m=function(e){h[e]=b[e],y.push(g.watch(e,function(t){h[e]=t,i.doUpdate=!0}))};for(var p in a)m(p);return!0}},{key:"assignMergers",value:function(t,r,n){var i=this,o=n.merge,a=(0,S.default)(o,e.propTypes);if(!a.length)return!1;var u={},s=!1,c=!0,f=!1,l=void 0;try{for(var d,p=a[Symbol.iterator]();!(c=(d=p.next()).done);c=!0){var y=d.value;if("undefined"==typeof t[y]){var h=o[y],v=!0,g=!1,b=void 0;try{for(var m,w=h.keys[Symbol.iterator]();!(v=(m=w.next()).done);v=!0){var O=m.value;u[O]=!0,s=!0}}catch(e){g=!0,b=e}finally{try{!v&&w.return&&w.return()}finally{if(g)throw b}}}}}catch(e){f=!0,l=e}finally{try{!c&&p.return&&p.return()}finally{if(f)throw l}}if(!s)return!1;var x=this.getMergers(),P=this.getSubscriptions(),R=this.getComponentProps(t,r),I=this.getProviderInstance(t,r,n,u),k=I.store,A=k.getState(),Q=!0,j=!1,C=void 0;try{for(var E,T=function(){var e=E.value;t[e]||!function(){var t=o[e];R[e]=t.get(A,R,r);var n=!0,a=!1,u=void 0;try{for(var s,c=t.keys[Symbol.iterator]();!(n=(s=c.next()).done);n=!0){var f=s.value;P.push(k.watch(f,function(r){x[e]=t,i.doMerge=!0}))}}catch(e){a=!0,u=e}finally{try{!n&&c.return&&c.return()}finally{if(a)throw u}}}()},_=a[Symbol.iterator]();!(Q=(E=_.next()).done);Q=!0)T()}catch(e){j=!0,C=e}finally{try{!Q&&_.return&&_.return()}finally{if(j)throw C}}return!0}},{key:"subscribeToProvider",value:function(e,t,r){var n=this,i=this.getSubscriptions(),o=this.getProviderInstance(e,t,r),a=o.store;i.push(a.subscribe(function(){if(n.doMerge){var r=n.getMergers(),i=n.getComponentProps(e,t),o=a.getState();for(var u in r){var s=r[u].get,c=s(o,i,t);i[u]!==c&&(i[u]=c,n.doUpdate=!0),delete r[u]}n.doMerge=!1}n.doUpdate&&(n.handleQueries(e,t),n.setDisplayName(e,t),n.update())}))}},{key:"handleQueries",value:function(e,t){var r=this,n=this.getFauxInstance(e,t);return(0,x.handleQueries)(n,function(e){e&&(r.doUpdate=!0,r.update())})}}]),n}(p.Component),r.ComponentClass=e,r.displayName=t(),r.propTypes=k,r.contextTypes=k,r.childContextTypes=k,r.defaultProps=e.defaultProps,n);return(0,b.default)(c,e)}function c(e,t){for(var r in t){var n=t[r],i=e[r];if("function"==typeof n&&n.propTypes&&!n.Provide&&i&&i.Provide){n.Provide=s(n),i.setComponentClass(n),n.setComponentClass=i.setComponentClass;var o=!0,a=!1,u=void 0;try{for(var c,f=i.__componentInstances[Symbol.iterator]();!(o=(c=f.next()).done);o=!0){var l=c.value,d=l.props,p=l.context;l.forceDeepUpdate=!0,l.reinitialize(d,p,n),l.forceDeepUpdate=!1}}catch(e){a=!0,u=e}finally{try{!o&&f.return&&f.return()}finally{if(a)throw u}}}}console.warn("You should only use `reloadInstances` in development!")}function f(e,t){var r=window,n=r.rootInstance,i=r.clientStates,o=n.providers,a=n.providerInstances;for(var u in e){var s=e[u],c=o[u];!e.replication&&c&&c.replication&&(s.replication=c.replication)}for(var f in a){var l=a[f];i&&(i[f]=l.store.getState()),delete a[f]}n.providers=e,n.providerInstances=t||a,n.reinitialize(n.props,n.context);var d=!0,p=!1,y=void 0;try{for(var h,v=I[Symbol.iterator]();!(d=(h=v.next()).done);d=!0){var g=h.value,b=!0,m=!1,w=void 0;try{for(var O,S=g[Symbol.iterator]();!(b=(O=S.next()).done);b=!0){var x=O.value,P=x.props,R=x.context;x!==n&&(R.providers=n.providers,R.providerInstances=n.providerInstances,x.providers=n.providers,x.providerInstances=n.providerInstances,x.reinitialize(P,R))}}catch(e){m=!0,w=e}finally{try{!b&&S.return&&S.return()}finally{if(m)throw w}}}}catch(e){p=!0,y=e}finally{try{!d&&v.return&&v.return()}finally{if(p)throw y}}console.warn("You should only use `reloadProviders` in development!")}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},d=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.default=s,t.reloadFunctions=c,t.reloadProviders=f;var p=r(15),y=n(p),h=r(13),v=n(h),g=r(10),b=n(g),m=r(1),w=n(m),O=r(4),S=n(O),x=r(5),P=n(x),R="undefined"==typeof window,I=[],k={providers:v.default.object,providerInstances:v.default.object,activeQueries:v.default.object,queryResults:v.default.object,partialStates:v.default.object,forceDeepUpdate:v.default.bool}},function(e,t){ "use strict";function r(e){return function(){return e}}var n=function(){};n.thatReturns=r,n.thatReturnsFalse=r(!1),n.thatReturnsTrue=r(!0),n.thatReturnsNull=r(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},function(e,t,r){"use strict";function n(e,t,r,n,o,a,u,s){if(i(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[r,n,o,a,u,s],l=0;c=new Error(t.replace(/%s/g,function(){return f[l++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var i=function(e){};e.exports=n},function(e,t){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},i="function"==typeof Object.getOwnPropertySymbols;e.exports=function(e,t,o){if("string"!=typeof t){var a=Object.getOwnPropertyNames(t);i&&(a=a.concat(Object.getOwnPropertySymbols(t)));for(var u=0;u<a.length;++u)if(!(r[a[u]]||n[a[u]]||o&&o[a[u]]))try{e[a[u]]=t[a[u]]}catch(e){}}return e}},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function o(e){if(l===clearTimeout)return clearTimeout(e);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function a(){h&&p&&(h=!1,p.length?y=p.concat(y):v=-1,y.length&&u())}function u(){if(!h){var e=i(a);h=!0;for(var t=y.length;t;){for(p=y,y=[];++v<t;)p&&p[v].run();v=-1,t=y.length}p=null,h=!1,o(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var f,l,d=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:r}catch(e){f=r}try{l="function"==typeof clearTimeout?clearTimeout:n}catch(e){l=n}}();var p,y=[],h=!1,v=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];y.push(new s(e,t)),1!==y.length||h||i(u)},s.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,r){"use strict";var n=r(8),i=r(9),o=r(14);e.exports=function(){function e(e,t,r,n,a,u){u!==o&&i(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r,r}},function(e,t,r){e.exports=r(12)()},function(e,t){"use strict";var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=r},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r}])});