Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80508 views
1
var Flummox=function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return t[i].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function i(t){return t.prototype.constructor.name}function s(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(t[n]);return e}var r=function(t){return t&&t.__esModule?t["default"]:t},o=Function.prototype.bind,a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},c=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)};e.__esModule=!0;var h=n(1),p=r(h),u=n(2),f=r(u),l=n(3),d=n(5),_=r(d),y=n(4),v=r(y),g=function(t){function e(){a(this,e),t.call(this),this.dispatcher=new l.Dispatcher,this._stores={},this._actions={}}return c(e,t),e.prototype.createStore=function(t,e){for(var n=arguments.length,s=Array(n>2?n-2:0),r=2;n>r;r++)s[r-2]=arguments[r];if(!(e.prototype instanceof p)){var a=i(e);throw new Error("You've attempted to create a store from the class "+a+", which does not have the base Store class in its prototype chain. Make sure "+("you're using the `extends` keyword: `class "+a+" extends ")+"Store { ... }`")}if(this._stores.hasOwnProperty(t)&&this._stores[t])throw new Error("You've attempted to create multiple stores with key "+t+". Keys must be unique.");var c=new(o.apply(e,[null].concat(s))),h=this.dispatcher.register(c.handler.bind(c));return c._waitFor=this.waitFor.bind(this),c._token=h,c._getAllActionIds=this.getAllActionIds.bind(this),this._stores[t]=c,c},e.prototype.getStore=function(t){return this._stores.hasOwnProperty(t)?this._stores[t]:void 0},e.prototype.removeStore=function(t){if(!this._stores.hasOwnProperty(t))throw new Error("You've attempted to remove store with key "+t+" which does not exist.");this._stores[t].removeAllListeners(),this.dispatcher.unregister(this._stores[t]._token),delete this._stores[t]},e.prototype.createActions=function(t,e){for(var n=arguments.length,s=Array(n>2?n-2:0),r=2;n>r;r++)s[r-2]=arguments[r];if(!(e.prototype instanceof f)&&e!==f){if("function"==typeof e){var h=i(e);throw new Error("You've attempted to create actions from the class "+h+", which does not have the base Actions class in its prototype chain. Make "+("sure you're using the `extends` keyword: `class "+h+" ")+"extends Actions { ... }`")}var p=e;e=function(t){var e=function(){a(this,e),null!=t&&t.apply(this,arguments)};return c(e,t),e}(f),v(e.prototype,p)}if(this._actions.hasOwnProperty(t)&&this._actions[t])throw new Error("You've attempted to create multiple actions with key "+t+". Keys must be unique.");var u=new(o.apply(e,[null].concat(s)));return u.dispatch=this.dispatch.bind(this),u.dispatchAsync=this.dispatchAsync.bind(this),this._actions[t]=u,u},e.prototype.getActions=function(t){return this._actions.hasOwnProperty(t)?this._actions[t]:void 0},e.prototype.getActionIds=function(t){var e=this.getActions(t);if(e)return e.getConstants()},e.prototype.removeActions=function(t){if(!this._actions.hasOwnProperty(t))throw new Error("You've attempted to remove actions with key "+t+" which does not exist.");delete this._actions[t]},e.prototype.getAllActionIds=function(){var t=[];for(var e in this._actions)if(this._actions.hasOwnProperty(e)){var n=this._actions[e].getConstants();t=t.concat(s(n))}return t},e.prototype.dispatch=function(t,e){this._dispatch({actionId:t,body:e})},e.prototype.dispatchAsync=function(t,e,n){var i=this,s={actionId:t,async:"begin"};return n&&(s.actionArgs=n),this._dispatch(s),e.then(function(e){return i._dispatch({actionId:t,body:e,async:"success"}),e},function(e){i._dispatch({actionId:t,error:e,async:"failure"})})["catch"](function(t){throw i.emit("error",t),t})},e.prototype._dispatch=function(t){this.dispatcher.dispatch(t),this.emit("dispatch",t)},e.prototype.waitFor=function(t){Array.isArray(t)||(t=[t]);var e=function(t){return t instanceof p?t._token:t},n=t.map(e);this.dispatcher.waitFor(n)},e.prototype.removeAllStoreListeners=function(t){for(var e in this._stores)if(this._stores.hasOwnProperty(e)){var n=this._stores[e];n.removeAllListeners(t)}},e.prototype.serialize=function n(){var t={};for(var e in this._stores)if(this._stores.hasOwnProperty(e)){var i=this._stores[e],n=i.constructor.serialize;if("function"==typeof n){var s=n(i.state);if("string"!=typeof s){i.constructor.name}if(t[e]=s,"function"!=typeof i.constructor.deserialize){i.constructor.name}}}return JSON.stringify(t)},e.prototype.deserialize=function r(t){var e=void 0;try{e=JSON.parse(t)}catch(n){{this.constructor.name}}for(var i in this._stores)if(this._stores.hasOwnProperty(i)){var s=this._stores[i],r=s.constructor.deserialize;if("function"==typeof r){var o=e[i],a=r(o);if(s.replaceState(a),"function"!=typeof s.constructor.serialize){s.constructor.name}}}},e}(_);e["default"]=g,g.prototype.getConstants=g.prototype.getActionIds,g.prototype.getAllConstants=g.prototype.getAllActionIds,g.prototype.dehydrate=g.prototype.serialize,g.prototype.hydrate=g.prototype.deserialize;var m=g;e.Flux=g,e.Flummox=m,e.Store=p,e.Actions=f},function(t,e,n){"use strict";function i(t){return"function"==typeof t?t._id:t}var s=function(t){return t&&t.__esModule?t["default"]:t},r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},a=n(5),c=s(a),h=n(4),p=s(h),u=function(t){function e(){r(this,e),t.call(this),this.state=null,this._handlers={},this._asyncHandlers={},this._catchAllHandlers=[],this._catchAllAsyncHandlers={begin:[],success:[],failure:[]}}return o(e,t),e.prototype.setState=function(t){if("function"==typeof t){var e=this._isHandlingDispatch?this._pendingState:this.state;t=t(e)}this._isHandlingDispatch?(this._pendingState=this._assignState(this._pendingState,t),this._emitChangeAfterHandlingDispatch=!0):(this.state=this._assignState(this.state,t),this.emit("change"))},e.prototype.replaceState=function(t){this._isHandlingDispatch?(this._pendingState=this._assignState(void 0,t),this._emitChangeAfterHandlingDispatch=!0):(this.state=this._assignState(void 0,t),this.emit("change"))},e.prototype.getStateAsObject=function(){return this.state},e.assignState=function(t,e){return p({},t,e)},e.prototype._assignState=function(){for(var t=arguments.length,n=Array(t),i=0;t>i;i++)n[i]=arguments[i];return(this.constructor.assignState||e.assignState).apply(void 0,n)},e.prototype.forceUpdate=function(){this._isHandlingDispatch?this._emitChangeAfterHandlingDispatch=!0:this.emit("change")},e.prototype.register=function(t,e){t=i(t),"function"==typeof e&&(this._handlers[t]=e.bind(this))},e.prototype.registerAsync=function(t,e,n,s){t=i(t);var r=this._bindAsyncHandlers({begin:e,success:n,failure:s});this._asyncHandlers[t]=r},e.prototype.registerAll=function(t){"function"==typeof t&&this._catchAllHandlers.push(t.bind(this))},e.prototype.registerAllAsync=function(t,e,n){var i=this,s=this._bindAsyncHandlers({begin:t,success:e,failure:n});Object.keys(s).forEach(function(t){i._catchAllAsyncHandlers[t].push(s[t])})},e.prototype._bindAsyncHandlers=function(t){for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];"function"==typeof n?t[e]=n.bind(this):delete t[e]}return t},e.prototype.waitFor=function(t){this._waitFor(t)},e.prototype.handler=function(t){var e=t.body,n=t.actionId,i=t.async,s=t.actionArgs,r=t.error,o=this._catchAllHandlers,a=this._handlers[n],c=this._catchAllAsyncHandlers[i],h=this._asyncHandlers[n]&&this._asyncHandlers[n][i];if(i){var p=c.concat([h]);switch(i){case"begin":return void this._performHandler(p,s);case"failure":return void this._performHandler(p,[r]);case"success":return void this._performHandler(c.concat([h||a].concat(h&&[]||o)),[e]);default:return}}this._performHandler(o.concat([a]),[e])},e.prototype._performHandler=function(t,e){this._isHandlingDispatch=!0,this._pendingState=this._assignState(void 0,this.state),this._emitChangeAfterHandlingDispatch=!1;try{this._performHandlers(t,e)}finally{this._emitChangeAfterHandlingDispatch&&(this.state=this._pendingState,this.emit("change")),this._isHandlingDispatch=!1,this._pendingState=void 0,this._emitChangeAfterHandlingDispatch=!1}},e.prototype._performHandlers=function(t,e){var n=this;t.forEach(function(t){return"function"==typeof t&&t.apply(n,e)})},e}(c);t.exports=u},function(t,e,n){"use strict";function i(t){return t&&"function"==typeof t.then}var s=function(t){return t&&t.__esModule?t["default"]:t},r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},o=n(7),a=s(o),c=function(){function t(){r(this,t),this._baseId=a();for(var e=this._getActionMethodNames(),n=0;n<e.length;n++){var i=e[n];this._wrapAction(i)}this.getConstants=this.getActionIds}return t.prototype.getActionIds=function(){var t=this;return this._getActionMethodNames().reduce(function(e,n){return e[n]=t[n]._id,e},{})},t.prototype._getActionMethodNames=function(t){var e=this;return Object.getOwnPropertyNames(this.constructor.prototype).filter(function(t){return"constructor"!==t&&"function"==typeof e[t]})},t.prototype._wrapAction=function(t){var e=this,n=this[t],s=this._createActionId(t),r=function(){for(var r=arguments.length,o=Array(r),a=0;r>a;a++)o[a]=arguments[a];var c=n.apply(e,o);if(i(c)){var h=c;e._dispatchAsync(s,h,o,t)}else e._dispatch(s,c,o,t);return c};r._id=s,this[t]=r},t.prototype._createActionId=function(t){return""+this._baseId+"-"+t},t.prototype._dispatch=function(t,e,n,i){return"function"==typeof this.dispatch&&"undefined"!=typeof e&&this.dispatch(t,e,n),e},t.prototype._dispatchAsync=function(t,e,n,i){"function"==typeof this.dispatchAsync&&this.dispatchAsync(t,e,n)},t}();t.exports=c},function(t,e,n){t.exports.Dispatcher=n(6)},function(t,e,n){"use strict";function i(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}t.exports=Object.assign||function(t,e){for(var n,s,r=i(t),o=1;o<arguments.length;o++){n=arguments[o],s=Object.keys(Object(n));for(var a=0;a<s.length;a++)r[s[a]]=n[s[a]]}return r}},function(t,e,n){"use strict";function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function s(){}s.prototype._events=void 0,s.prototype.listeners=function(t){if(!this._events||!this._events[t])return[];if(this._events[t].fn)return[this._events[t].fn];for(var e=0,n=this._events[t].length,i=new Array(n);n>e;e++)i[e]=this._events[t][e].fn;return i},s.prototype.emit=function(t,e,n,i,s,r){if(!this._events||!this._events[t])return!1;var o,a,c=this._events[t],h=arguments.length;if("function"==typeof c.fn){switch(c.once&&this.removeListener(t,c.fn,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,i),!0;case 5:return c.fn.call(c.context,e,n,i,s),!0;case 6:return c.fn.call(c.context,e,n,i,s,r),!0}for(a=1,o=new Array(h-1);h>a;a++)o[a-1]=arguments[a];c.fn.apply(c.context,o)}else{var p,u=c.length;for(a=0;u>a;a++)switch(c[a].once&&this.removeListener(t,c[a].fn,!0),h){case 1:c[a].fn.call(c[a].context);break;case 2:c[a].fn.call(c[a].context,e);break;case 3:c[a].fn.call(c[a].context,e,n);break;default:if(!o)for(p=1,o=new Array(h-1);h>p;p++)o[p-1]=arguments[p];c[a].fn.apply(c[a].context,o)}}return!0},s.prototype.on=function(t,e,n){var s=new i(e,n||this);return this._events||(this._events={}),this._events[t]?this._events[t].fn?this._events[t]=[this._events[t],s]:this._events[t].push(s):this._events[t]=s,this},s.prototype.once=function(t,e,n){var s=new i(e,n||this,!0);return this._events||(this._events={}),this._events[t]?this._events[t].fn?this._events[t]=[this._events[t],s]:this._events[t].push(s):this._events[t]=s,this},s.prototype.removeListener=function(t,e,n){if(!this._events||!this._events[t])return this;var i=this._events[t],s=[];if(e&&(i.fn&&(i.fn!==e||n&&!i.once)&&s.push(i),!i.fn))for(var r=0,o=i.length;o>r;r++)(i[r].fn!==e||n&&!i[r].once)&&s.push(i[r]);return s.length?this._events[t]=1===s.length?s[0]:s:delete this._events[t],this},s.prototype.removeAllListeners=function(t){return this._events?(t?delete this._events[t]:this._events={},this):this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prototype.setMaxListeners=function(){return this},s.EventEmitter=s,s.EventEmitter2=s,s.EventEmitter3=s,t.exports=s},function(t,e,n){"use strict";function i(){this.$Dispatcher_callbacks={},this.$Dispatcher_isPending={},this.$Dispatcher_isHandled={},this.$Dispatcher_isDispatching=!1,this.$Dispatcher_pendingPayload=null}var s=n(8),r=1,o="ID_";i.prototype.register=function(t){var e=o+r++;return this.$Dispatcher_callbacks[e]=t,e},i.prototype.unregister=function(t){s(this.$Dispatcher_callbacks[t],"Dispatcher.unregister(...): `%s` does not map to a registered callback.",t),delete this.$Dispatcher_callbacks[t]},i.prototype.waitFor=function(t){s(this.$Dispatcher_isDispatching,"Dispatcher.waitFor(...): Must be invoked while dispatching.");for(var e=0;e<t.length;e++){var n=t[e];this.$Dispatcher_isPending[n]?s(this.$Dispatcher_isHandled[n],"Dispatcher.waitFor(...): Circular dependency detected while waiting for `%s`.",n):(s(this.$Dispatcher_callbacks[n],"Dispatcher.waitFor(...): `%s` does not map to a registered callback.",n),this.$Dispatcher_invokeCallback(n))}},i.prototype.dispatch=function(t){s(!this.$Dispatcher_isDispatching,"Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch."),this.$Dispatcher_startDispatching(t);try{for(var e in this.$Dispatcher_callbacks)this.$Dispatcher_isPending[e]||this.$Dispatcher_invokeCallback(e)}finally{this.$Dispatcher_stopDispatching()}},i.prototype.isDispatching=function(){return this.$Dispatcher_isDispatching},i.prototype.$Dispatcher_invokeCallback=function(t){this.$Dispatcher_isPending[t]=!0,this.$Dispatcher_callbacks[t](this.$Dispatcher_pendingPayload),this.$Dispatcher_isHandled[t]=!0},i.prototype.$Dispatcher_startDispatching=function(t){for(var e in this.$Dispatcher_callbacks)this.$Dispatcher_isPending[e]=!1,this.$Dispatcher_isHandled[e]=!1;this.$Dispatcher_pendingPayload=t,this.$Dispatcher_isDispatching=!0},i.prototype.$Dispatcher_stopDispatching=function(){this.$Dispatcher_pendingPayload=null,this.$Dispatcher_isDispatching=!1},t.exports=i},function(t,e,n){"use strict";var i=0,s=t.exports=function(t){t=t||{};var e=t.prefix,n=t.suffix,s=++i*(t.multiplier||1);return null==e&&(e=""),null==n&&(n=""),String(e)+s+String(n)};s.reset=function(){return i=0}},function(t,e,n){"use strict";var i=function(t,e,n,i,s,r,o,a){if(!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var h=[n,i,s,r,o,a],p=0;c=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return h[p++]}))}throw c.framesToPop=1,c}};t.exports=i}]);
2