fission
Version:
The Reactjs Toolkit
2 lines • 407 kB
JavaScript
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.fission=e()}}(function(){var e;return function n(e,t,o){function r(a,i){if(!t[a]){if(!e[a]){var u="function"==typeof require&&require;if(!i&&u)return u(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=t[a]={exports:{}};e[a][0].call(c.exports,function(n){var t=e[a][1][n];return r(t?t:n)},c,c.exports,n,e,t,o)}return t[a].exports}for(var s="function"==typeof require&&require,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(e,n){(function(){"use strict";function t(e){return this instanceof t?void(this.options=e?o(e):{}):new t(e)}var o=e("lodash.clone"),r=e("react");t.prototype.router=e("./lib/router"),t.prototype.model=e("./lib/model"),t.prototype.view=e("./lib/view"),t.prototype.modelView=e("./lib/modelView"),t.prototype.collectionView=e("./lib/collectionView"),t.prototype.createCollection=e("./lib/createCollection"),t.prototype.getSync=e("./lib/getSync"),t.prototype.alias=e("./lib/alias"),t.prototype.middleware={auth:e("./lib/middleware/auth"),clearFB:e("./lib/middleware/clearFB"),log:e("./lib/middleware/log")},t.prototype.mixins={Listener:e("./lib/ListenerMixin")},t.prototype.React=r,t.prototype.DOM=r.DOM,t.prototype.createFactory=r.createFactory,t.prototype.PropTypes=r.PropTypes,n.exports=t}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/index.js","/")},{"./lib/ListenerMixin":2,"./lib/alias":3,"./lib/collectionView":4,"./lib/createCollection":5,"./lib/getSync":6,"./lib/middleware/auth":7,"./lib/middleware/clearFB":8,"./lib/middleware/log":9,"./lib/model":10,"./lib/modelView":11,"./lib/router":12,"./lib/view":13,_process:59,buffer:56,"lodash.clone":62,react:256}],2:[function(e,n){(function(){"use strict";n.exports={listenTo:function(e,n,t){return e.on(n,function(){t()}),this},removeListener:function(e,n,t){return"function"==typeof e.off?e.off(n,t):"function"==typeof e.removeListener&&e.removeListener(n,t),this},componentWillMount:function(){this.listeners=[]},componentWillUnmount:function(){this.listeners.forEach(function(e){this.removeListener(e.ee,e.event,e.listener)})}}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/ListenerMixin.js","/lib")},{_process:59,buffer:56}],3:[function(e,n){(function(){"use strict";var e={init:"getInitialState",mounting:"componentWillMount",mounted:"componentDidMount",unmounting:"componentWillUnmount"},t=Object.keys(e);n.exports=function(n){return t.forEach(function(t){var o=e[t];null!=n[t]&&null==n[o]&&(n[o]=n[t])}),null==n.mixins&&(n.mixins=[]),n}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/alias.js","/lib")},{_process:59,buffer:56}],4:[function(e,n){(function(){"use strict";var t=e("./ListenerMixin"),o=e("ampersand-collection"),r=e("react");n.exports=function(e){if(null==e)throw new Error("config parameter is required");if(null==e.model)throw new Error("model attribute is required");if(null==e.itemView)throw new Error("itemView attribute is required");var n=this.getSync(e.model),s=this.createCollection(e.model),a={mixins:[t],propTypes:{collection:r.PropTypes.instanceOf(o)},getDefaultProps:function(){return{collection:e.collection}},renderItems:function(){this.items=this.collection.map(function(e){return this.itemView({model:e,key:e.cid})},this),this.isMounted()&&this.forceUpdate()},componentWillMount:function(){null==this.items&&(this.items=[]),null!=this.props.collection?(this.collection=this.props.collection,this.renderItems()):(this.collection=new s,this.collection.sync=n,null!=this.props.id&&(this.collection.url+="?id="+this.props.id),this.collection.fetch({success:this.renderItems,error:function(e){console.log("fetch error",e)}})),this.listenTo(this.collection,"add change remove",this.renderItems)}};return this.view(e,[a])}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/collectionView.js","/lib")},{"./ListenerMixin":2,_process:59,"ampersand-collection":17,buffer:56,react:256}],5:[function(e,n){(function(){"use strict";var t=e("ampersand-collection"),o=e("ampersand-collection-underscore-mixin"),r=e("ampersand-sync-adapter");n.exports=function(e){if(e.isCollection)return t.extend(e);var n=new e,s={model:e,url:n.url()};return t.extend(o,r,s)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/createCollection.js","/lib")},{_process:59,"ampersand-collection":17,"ampersand-collection-underscore-mixin":15,"ampersand-sync-adapter":41,buffer:56}],6:[function(e,n){(function(){"use strict";var t=e("ampersand-sync");n.exports=function(e){if(e.sync)return e.sync;if(null==this.options.sync)return t;if("function"==typeof this.options.sync)return this.options.sync;if(null!=this.options.sync.plugin)return this.options.sync.plugin;throw new Error("Invalid sync option")}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/getSync.js","/lib")},{_process:59,"ampersand-sync":42,buffer:56}],7:[function(e,n){(function(){"use strict";n.exports=function(e){return function(n,t){return null!=e?t():"/login"===window.location.pathname?t():(window.location="/login",t())}}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/middleware/auth.js","/lib/middleware")},{_process:59,buffer:56}],8:[function(e,n){(function(){"use strict";n.exports=function(e,n){var t;return window.location.hash&&"#_=_"===window.location.hash&&(window.history&&window.history.replaceState?window.history.replaceState(null,null,window.location.href.split("#")[0]):(t={top:document.body.scrollTop,left:document.body.scrollLeft},window.location.hash="",document.body.scrollTop=t.top,document.body.scrollLeft=t.left)),n()}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/middleware/clearFB.js","/lib/middleware")},{_process:59,buffer:56}],9:[function(e,n){(function(){"use strict";n.exports=function(e,n){return console.log("Routing called",e),n()}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/middleware/log.js","/lib/middleware")},{_process:59,buffer:56}],10:[function(e,n){(function(){"use strict";var t=e("ampersand-model"),o=e("lodash.clone");n.exports=function(e){var n=o(e);return null==n.url&&(n.url="/"),n.urlRoot=n.url,delete n.url,n.sync=this.getSync(n),t.extend(n)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/model.js","/lib")},{_process:59,"ampersand-model":20,buffer:56,"lodash.clone":62}],11:[function(e,n){(function(){"use strict";var t=e("./ListenerMixin"),o=e("ampersand-model"),r=e("react");n.exports=function(e){if(null==e)throw new Error("config parameter is required");var n={mixins:[t],propTypes:{model:r.PropTypes.instanceOf(o)},componentWillMount:function(){if(null!=this.props.model?this.model=this.props.model:this.props.params&&null!=this.props.params.id&&(this.model=new e.model,this.model.id=this.props.params.id,void 0!==this.model.idAttribute&&(this.model[this.model.idAttribute]=this.props.params.id),this.model.fetch()),!this.model)throw new Error("modelView never got a model");var n=function(){this.isMounted()&&this.forceUpdate()}.bind(this);return this.listenTo(this.model,"change",n),this.model}};return this.view(e,[n])}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/modelView.js","/lib")},{"./ListenerMixin":2,_process:59,"ampersand-model":20,buffer:56,react:256}],12:[function(e,n){(function(){"use strict";var t=e("page"),o=e("react"),r=e("lodash.clone"),s={},a=function(e,n){return e=e?r(e):{},"function"==typeof e.view?(e.view=e.view(e.args),a(e,n)):(o.renderComponent(e.view,e.el),void n())};s.createRouteHandler=function(n){return"string"==typeof n?function(t,o){e([n],function(e){e(t,o)})}:"function"==typeof n?function(e,t){n(e,t)}:s.createRenderHandler(n)},s.createRenderHandler=function(e){e=e?r(e):{},null==e.continue&&(e.continue=!1),"string"==typeof e.el&&(e.el=document.getElementById(e.el));var n=function(n,t){var o={el:e.el,view:e.view,args:n};a(o,function(){null!=e.title&&(document.title=e.title),e.continue&&t()})};return n},s.route=function(){var e=Array.prototype.slice.call(arguments),n=e.shift(),o=e.map(s.createRouteHandler);return t.apply(null,[n].concat(o)),s},s.router=t,s.use=s.route.bind(null,"*"),s.start=t.start,s.show=t.show,n.exports=s}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/router.js","/lib")},{_process:59,buffer:56,"lodash.clone":62,page:108,react:256}],13:[function(e,n){(function(){"use strict";var t=e("react"),o=e("lodash.clone"),r=e("./alias");n.exports=function(e,n){var s=r(o(e));return Array.isArray(n)&&(s.mixins=s.mixins.concat(n)),t.createClass(s)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/view.js","/lib")},{"./alias":3,_process:59,buffer:56,"lodash.clone":62,react:256}],14:[function(e,n){(function(){var t=e("extend-object"),o=function(e){var n,o=this,r=[].slice.call(arguments);n=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return o.apply(this,arguments)},t(n,o);var s=function(){this.constructor=n};return s.prototype=o.prototype,n.prototype=new s,e&&(r.unshift(n.prototype),t.apply(null,r)),n.__super__=o.prototype,n};n.exports=o}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-class-extend/ampersand-class-extend.js","/node_modules/ampersand-class-extend")},{_process:59,buffer:56,"extend-object":60}],15:[function(e,n){(function(){"undefined"!=typeof window&&(window.ampersand=window.ampersand||{},window.ampersand["ampersand-collection-underscore-mixin"]=window.ampersand["ampersand-collection-underscore-mixin"]||[],window.ampersand["ampersand-collection-underscore-mixin"].push("1.0.3"));var t=e("underscore"),o=[].slice,r={},s=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain","sample","partition"];t.each(s,function(e){t[e]&&(r[e]=function(){var n=o.call(arguments);return n.unshift(this.models),t[e].apply(t,n)})});var a=["groupBy","countBy","sortBy","indexBy"];t.each(a,function(e){t[e]&&(r[e]=function(n,o){var r=t.isFunction(n)?n:function(e){return e.get?e.get(n):e[n]};return t[e](this.models,r,o)})}),r.where=function(e,n){return t.isEmpty(e)?n?void 0:[]:this[n?"find":"filter"](function(n){var t;for(var o in e)if(t=n.get?n.get(o):n[o],e[o]!==t)return!1;return!0})},r.findWhere=function(e){return this.where(e,!0)},r.pluck=function(e){return t.invoke(this.models,"get",e)},n.exports=r}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection-underscore-mixin/ampersand-collection-underscore-mixin.js","/node_modules/ampersand-collection-underscore-mixin")},{_process:59,buffer:56,underscore:16}],16:[function(n,t,o){(function(){(function(){var n=this,r=n._,s=Array.prototype,a=Object.prototype,i=Function.prototype,u=s.push,l=s.slice,c=s.concat,d=a.toString,f=a.hasOwnProperty,p=Array.isArray,m=Object.keys,h=i.bind,g=function(e){return e instanceof g?e:this instanceof g?void(this._wrapped=e):new g(e)};"undefined"!=typeof o?("undefined"!=typeof t&&t.exports&&(o=t.exports=g),o._=g):n._=g,g.VERSION="1.7.0";var y=function(e,n,t){if(void 0===n)return e;switch(null==t?3:t){case 1:return function(t){return e.call(n,t)};case 2:return function(t,o){return e.call(n,t,o)};case 3:return function(t,o,r){return e.call(n,t,o,r)};case 4:return function(t,o,r,s){return e.call(n,t,o,r,s)}}return function(){return e.apply(n,arguments)}};g.iteratee=function(e,n,t){return null==e?g.identity:g.isFunction(e)?y(e,n,t):g.isObject(e)?g.matches(e):g.property(e)},g.each=g.forEach=function(e,n,t){if(null==e)return e;n=y(n,t);var o,r=e.length;if(r===+r)for(o=0;r>o;o++)n(e[o],o,e);else{var s=g.keys(e);for(o=0,r=s.length;r>o;o++)n(e[s[o]],s[o],e)}return e},g.map=g.collect=function(e,n,t){if(null==e)return[];n=g.iteratee(n,t);for(var o,r=e.length!==+e.length&&g.keys(e),s=(r||e).length,a=Array(s),i=0;s>i;i++)o=r?r[i]:i,a[i]=n(e[o],o,e);return a};var b="Reduce of empty array with no initial value";g.reduce=g.foldl=g.inject=function(e,n,t,o){null==e&&(e=[]),n=y(n,o,4);var r,s=e.length!==+e.length&&g.keys(e),a=(s||e).length,i=0;if(arguments.length<3){if(!a)throw new TypeError(b);t=e[s?s[i++]:i++]}for(;a>i;i++)r=s?s[i]:i,t=n(t,e[r],r,e);return t},g.reduceRight=g.foldr=function(e,n,t,o){null==e&&(e=[]),n=y(n,o,4);var r,s=e.length!==+e.length&&g.keys(e),a=(s||e).length;if(arguments.length<3){if(!a)throw new TypeError(b);t=e[s?s[--a]:--a]}for(;a--;)r=s?s[a]:a,t=n(t,e[r],r,e);return t},g.find=g.detect=function(e,n,t){var o;return n=g.iteratee(n,t),g.some(e,function(e,t,r){return n(e,t,r)?(o=e,!0):void 0}),o},g.filter=g.select=function(e,n,t){var o=[];return null==e?o:(n=g.iteratee(n,t),g.each(e,function(e,t,r){n(e,t,r)&&o.push(e)}),o)},g.reject=function(e,n,t){return g.filter(e,g.negate(g.iteratee(n)),t)},g.every=g.all=function(e,n,t){if(null==e)return!0;n=g.iteratee(n,t);var o,r,s=e.length!==+e.length&&g.keys(e),a=(s||e).length;for(o=0;a>o;o++)if(r=s?s[o]:o,!n(e[r],r,e))return!1;return!0},g.some=g.any=function(e,n,t){if(null==e)return!1;n=g.iteratee(n,t);var o,r,s=e.length!==+e.length&&g.keys(e),a=(s||e).length;for(o=0;a>o;o++)if(r=s?s[o]:o,n(e[r],r,e))return!0;return!1},g.contains=g.include=function(e,n){return null==e?!1:(e.length!==+e.length&&(e=g.values(e)),g.indexOf(e,n)>=0)},g.invoke=function(e,n){var t=l.call(arguments,2),o=g.isFunction(n);return g.map(e,function(e){return(o?n:e[n]).apply(e,t)})},g.pluck=function(e,n){return g.map(e,g.property(n))},g.where=function(e,n){return g.filter(e,g.matches(n))},g.findWhere=function(e,n){return g.find(e,g.matches(n))},g.max=function(e,n,t){var o,r,s=-1/0,a=-1/0;if(null==n&&null!=e){e=e.length===+e.length?e:g.values(e);for(var i=0,u=e.length;u>i;i++)o=e[i],o>s&&(s=o)}else n=g.iteratee(n,t),g.each(e,function(e,t,o){r=n(e,t,o),(r>a||r===-1/0&&s===-1/0)&&(s=e,a=r)});return s},g.min=function(e,n,t){var o,r,s=1/0,a=1/0;if(null==n&&null!=e){e=e.length===+e.length?e:g.values(e);for(var i=0,u=e.length;u>i;i++)o=e[i],s>o&&(s=o)}else n=g.iteratee(n,t),g.each(e,function(e,t,o){r=n(e,t,o),(a>r||1/0===r&&1/0===s)&&(s=e,a=r)});return s},g.shuffle=function(e){for(var n,t=e&&e.length===+e.length?e:g.values(e),o=t.length,r=Array(o),s=0;o>s;s++)n=g.random(0,s),n!==s&&(r[s]=r[n]),r[n]=t[s];return r},g.sample=function(e,n,t){return null==n||t?(e.length!==+e.length&&(e=g.values(e)),e[g.random(e.length-1)]):g.shuffle(e).slice(0,Math.max(0,n))},g.sortBy=function(e,n,t){return n=g.iteratee(n,t),g.pluck(g.map(e,function(e,t,o){return{value:e,index:t,criteria:n(e,t,o)}}).sort(function(e,n){var t=e.criteria,o=n.criteria;if(t!==o){if(t>o||void 0===t)return 1;if(o>t||void 0===o)return-1}return e.index-n.index}),"value")};var v=function(e){return function(n,t,o){var r={};return t=g.iteratee(t,o),g.each(n,function(o,s){var a=t(o,s,n);e(r,o,a)}),r}};g.groupBy=v(function(e,n,t){g.has(e,t)?e[t].push(n):e[t]=[n]}),g.indexBy=v(function(e,n,t){e[t]=n}),g.countBy=v(function(e,n,t){g.has(e,t)?e[t]++:e[t]=1}),g.sortedIndex=function(e,n,t,o){t=g.iteratee(t,o,1);for(var r=t(n),s=0,a=e.length;a>s;){var i=s+a>>>1;t(e[i])<r?s=i+1:a=i}return s},g.toArray=function(e){return e?g.isArray(e)?l.call(e):e.length===+e.length?g.map(e,g.identity):g.values(e):[]},g.size=function(e){return null==e?0:e.length===+e.length?e.length:g.keys(e).length},g.partition=function(e,n,t){n=g.iteratee(n,t);var o=[],r=[];return g.each(e,function(e,t,s){(n(e,t,s)?o:r).push(e)}),[o,r]},g.first=g.head=g.take=function(e,n,t){return null==e?void 0:null==n||t?e[0]:0>n?[]:l.call(e,0,n)},g.initial=function(e,n,t){return l.call(e,0,Math.max(0,e.length-(null==n||t?1:n)))},g.last=function(e,n,t){return null==e?void 0:null==n||t?e[e.length-1]:l.call(e,Math.max(e.length-n,0))},g.rest=g.tail=g.drop=function(e,n,t){return l.call(e,null==n||t?1:n)},g.compact=function(e){return g.filter(e,g.identity)};var _=function(e,n,t,o){if(n&&g.every(e,g.isArray))return c.apply(o,e);for(var r=0,s=e.length;s>r;r++){var a=e[r];g.isArray(a)||g.isArguments(a)?n?u.apply(o,a):_(a,n,t,o):t||o.push(a)}return o};g.flatten=function(e,n){return _(e,n,!1,[])},g.without=function(e){return g.difference(e,l.call(arguments,1))},g.uniq=g.unique=function(e,n,t,o){if(null==e)return[];g.isBoolean(n)||(o=t,t=n,n=!1),null!=t&&(t=g.iteratee(t,o));for(var r=[],s=[],a=0,i=e.length;i>a;a++){var u=e[a];if(n)a&&s===u||r.push(u),s=u;else if(t){var l=t(u,a,e);g.indexOf(s,l)<0&&(s.push(l),r.push(u))}else g.indexOf(r,u)<0&&r.push(u)}return r},g.union=function(){return g.uniq(_(arguments,!0,!0,[]))},g.intersection=function(e){if(null==e)return[];for(var n=[],t=arguments.length,o=0,r=e.length;r>o;o++){var s=e[o];if(!g.contains(n,s)){for(var a=1;t>a&&g.contains(arguments[a],s);a++);a===t&&n.push(s)}}return n},g.difference=function(e){var n=_(l.call(arguments,1),!0,!0,[]);return g.filter(e,function(e){return!g.contains(n,e)})},g.zip=function(e){if(null==e)return[];for(var n=g.max(arguments,"length").length,t=Array(n),o=0;n>o;o++)t[o]=g.pluck(arguments,o);return t},g.object=function(e,n){if(null==e)return{};for(var t={},o=0,r=e.length;r>o;o++)n?t[e[o]]=n[o]:t[e[o][0]]=e[o][1];return t},g.indexOf=function(e,n,t){if(null==e)return-1;var o=0,r=e.length;if(t){if("number"!=typeof t)return o=g.sortedIndex(e,n),e[o]===n?o:-1;o=0>t?Math.max(0,r+t):t}for(;r>o;o++)if(e[o]===n)return o;return-1},g.lastIndexOf=function(e,n,t){if(null==e)return-1;var o=e.length;for("number"==typeof t&&(o=0>t?o+t+1:Math.min(o,t+1));--o>=0;)if(e[o]===n)return o;return-1},g.range=function(e,n,t){arguments.length<=1&&(n=e||0,e=0),t=t||1;for(var o=Math.max(Math.ceil((n-e)/t),0),r=Array(o),s=0;o>s;s++,e+=t)r[s]=e;return r};var w=function(){};g.bind=function(e,n){var t,o;if(h&&e.bind===h)return h.apply(e,l.call(arguments,1));if(!g.isFunction(e))throw new TypeError("Bind must be called on a function");return t=l.call(arguments,2),o=function(){if(!(this instanceof o))return e.apply(n,t.concat(l.call(arguments)));w.prototype=e.prototype;var r=new w;w.prototype=null;var s=e.apply(r,t.concat(l.call(arguments)));return g.isObject(s)?s:r}},g.partial=function(e){var n=l.call(arguments,1);return function(){for(var t=0,o=n.slice(),r=0,s=o.length;s>r;r++)o[r]===g&&(o[r]=arguments[t++]);for(;t<arguments.length;)o.push(arguments[t++]);return e.apply(this,o)}},g.bindAll=function(e){var n,t,o=arguments.length;if(1>=o)throw new Error("bindAll must be passed function names");for(n=1;o>n;n++)t=arguments[n],e[t]=g.bind(e[t],e);return e},g.memoize=function(e,n){var t=function(o){var r=t.cache,s=n?n.apply(this,arguments):o;return g.has(r,s)||(r[s]=e.apply(this,arguments)),r[s]};return t.cache={},t},g.delay=function(e,n){var t=l.call(arguments,2);return setTimeout(function(){return e.apply(null,t)},n)},g.defer=function(e){return g.delay.apply(g,[e,1].concat(l.call(arguments,1)))},g.throttle=function(e,n,t){var o,r,s,a=null,i=0;t||(t={});var u=function(){i=t.leading===!1?0:g.now(),a=null,s=e.apply(o,r),a||(o=r=null)};return function(){var l=g.now();i||t.leading!==!1||(i=l);var c=n-(l-i);return o=this,r=arguments,0>=c||c>n?(clearTimeout(a),a=null,i=l,s=e.apply(o,r),a||(o=r=null)):a||t.trailing===!1||(a=setTimeout(u,c)),s}},g.debounce=function(e,n,t){var o,r,s,a,i,u=function(){var l=g.now()-a;n>l&&l>0?o=setTimeout(u,n-l):(o=null,t||(i=e.apply(s,r),o||(s=r=null)))};return function(){s=this,r=arguments,a=g.now();var l=t&&!o;return o||(o=setTimeout(u,n)),l&&(i=e.apply(s,r),s=r=null),i}},g.wrap=function(e,n){return g.partial(n,e)},g.negate=function(e){return function(){return!e.apply(this,arguments)}},g.compose=function(){var e=arguments,n=e.length-1;return function(){for(var t=n,o=e[n].apply(this,arguments);t--;)o=e[t].call(this,o);return o}},g.after=function(e,n){return function(){return--e<1?n.apply(this,arguments):void 0}},g.before=function(e,n){var t;return function(){return--e>0?t=n.apply(this,arguments):n=null,t}},g.once=g.partial(g.before,2),g.keys=function(e){if(!g.isObject(e))return[];if(m)return m(e);var n=[];for(var t in e)g.has(e,t)&&n.push(t);return n},g.values=function(e){for(var n=g.keys(e),t=n.length,o=Array(t),r=0;t>r;r++)o[r]=e[n[r]];return o},g.pairs=function(e){for(var n=g.keys(e),t=n.length,o=Array(t),r=0;t>r;r++)o[r]=[n[r],e[n[r]]];return o},g.invert=function(e){for(var n={},t=g.keys(e),o=0,r=t.length;r>o;o++)n[e[t[o]]]=t[o];return n},g.functions=g.methods=function(e){var n=[];for(var t in e)g.isFunction(e[t])&&n.push(t);return n.sort()},g.extend=function(e){if(!g.isObject(e))return e;for(var n,t,o=1,r=arguments.length;r>o;o++){n=arguments[o];for(t in n)f.call(n,t)&&(e[t]=n[t])}return e},g.pick=function(e,n,t){var o,r={};if(null==e)return r;if(g.isFunction(n)){n=y(n,t);for(o in e){var s=e[o];n(s,o,e)&&(r[o]=s)}}else{var a=c.apply([],l.call(arguments,1));e=new Object(e);for(var i=0,u=a.length;u>i;i++)o=a[i],o in e&&(r[o]=e[o])}return r},g.omit=function(e,n,t){if(g.isFunction(n))n=g.negate(n);else{var o=g.map(c.apply([],l.call(arguments,1)),String);n=function(e,n){return!g.contains(o,n)}}return g.pick(e,n,t)},g.defaults=function(e){if(!g.isObject(e))return e;for(var n=1,t=arguments.length;t>n;n++){var o=arguments[n];for(var r in o)void 0===e[r]&&(e[r]=o[r])}return e},g.clone=function(e){return g.isObject(e)?g.isArray(e)?e.slice():g.extend({},e):e},g.tap=function(e,n){return n(e),e};var E=function(e,n,t,o){if(e===n)return 0!==e||1/e===1/n;if(null==e||null==n)return e===n;e instanceof g&&(e=e._wrapped),n instanceof g&&(n=n._wrapped);var r=d.call(e);if(r!==d.call(n))return!1;switch(r){case"[object RegExp]":case"[object String]":return""+e==""+n;case"[object Number]":return+e!==+e?+n!==+n:0===+e?1/+e===1/n:+e===+n;case"[object Date]":case"[object Boolean]":return+e===+n}if("object"!=typeof e||"object"!=typeof n)return!1;for(var s=t.length;s--;)if(t[s]===e)return o[s]===n;var a=e.constructor,i=n.constructor;if(a!==i&&"constructor"in e&&"constructor"in n&&!(g.isFunction(a)&&a instanceof a&&g.isFunction(i)&&i instanceof i))return!1;t.push(e),o.push(n);var u,l;if("[object Array]"===r){if(u=e.length,l=u===n.length)for(;u--&&(l=E(e[u],n[u],t,o)););}else{var c,f=g.keys(e);if(u=f.length,l=g.keys(n).length===u)for(;u--&&(c=f[u],l=g.has(n,c)&&E(e[c],n[c],t,o)););}return t.pop(),o.pop(),l};g.isEqual=function(e,n){return E(e,n,[],[])},g.isEmpty=function(e){if(null==e)return!0;if(g.isArray(e)||g.isString(e)||g.isArguments(e))return 0===e.length;for(var n in e)if(g.has(e,n))return!1;return!0},g.isElement=function(e){return!(!e||1!==e.nodeType)},g.isArray=p||function(e){return"[object Array]"===d.call(e)},g.isObject=function(e){var n=typeof e;return"function"===n||"object"===n&&!!e},g.each(["Arguments","Function","String","Number","Date","RegExp"],function(e){g["is"+e]=function(n){return d.call(n)==="[object "+e+"]"}}),g.isArguments(arguments)||(g.isArguments=function(e){return g.has(e,"callee")}),"function"!=typeof/./&&(g.isFunction=function(e){return"function"==typeof e||!1}),g.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},g.isNaN=function(e){return g.isNumber(e)&&e!==+e},g.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===d.call(e)},g.isNull=function(e){return null===e},g.isUndefined=function(e){return void 0===e},g.has=function(e,n){return null!=e&&f.call(e,n)},g.noConflict=function(){return n._=r,this},g.identity=function(e){return e},g.constant=function(e){return function(){return e}},g.noop=function(){},g.property=function(e){return function(n){return n[e]}},g.matches=function(e){var n=g.pairs(e),t=n.length;return function(e){if(null==e)return!t;e=new Object(e);for(var o=0;t>o;o++){var r=n[o],s=r[0];if(r[1]!==e[s]||!(s in e))return!1}return!0}},g.times=function(e,n,t){var o=Array(Math.max(0,e));n=y(n,t,1);for(var r=0;e>r;r++)o[r]=n(r);return o},g.random=function(e,n){return null==n&&(n=e,e=0),e+Math.floor(Math.random()*(n-e+1))},g.now=Date.now||function(){return(new Date).getTime()};var x={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},C=g.invert(x),O=function(e){var n=function(n){return e[n]},t="(?:"+g.keys(e).join("|")+")",o=RegExp(t),r=RegExp(t,"g");return function(e){return e=null==e?"":""+e,o.test(e)?e.replace(r,n):e}};g.escape=O(x),g.unescape=O(C),g.result=function(e,n){if(null==e)return void 0;var t=e[n];return g.isFunction(t)?e[n]():t};var R=0;g.uniqueId=function(e){var n=++R+"";return e?e+n:n},g.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var N=/(.)^/,D={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},M=/\\|'|\r|\n|\u2028|\u2029/g,j=function(e){return"\\"+D[e]};g.template=function(e,n,t){!n&&t&&(n=t),n=g.defaults({},n,g.templateSettings);var o=RegExp([(n.escape||N).source,(n.interpolate||N).source,(n.evaluate||N).source].join("|")+"|$","g"),r=0,s="__p+='";e.replace(o,function(n,t,o,a,i){return s+=e.slice(r,i).replace(M,j),r=i+n.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":o?s+="'+\n((__t=("+o+"))==null?'':__t)+\n'":a&&(s+="';\n"+a+"\n__p+='"),n}),s+="';\n",n.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var a=new Function(n.variable||"obj","_",s)}catch(i){throw i.source=s,i}var u=function(e){return a.call(this,e,g)},l=n.variable||"obj";return u.source="function("+l+"){\n"+s+"}",u},g.chain=function(e){var n=g(e);return n._chain=!0,n};var T=function(e){return this._chain?g(e).chain():e};g.mixin=function(e){g.each(g.functions(e),function(n){var t=g[n]=e[n];g.prototype[n]=function(){var e=[this._wrapped];return u.apply(e,arguments),T.call(this,t.apply(g,e))}})},g.mixin(g),g.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var n=s[e];g.prototype[e]=function(){var t=this._wrapped;return n.apply(t,arguments),"shift"!==e&&"splice"!==e||0!==t.length||delete t[0],T.call(this,t)}}),g.each(["concat","join","slice"],function(e){var n=s[e];g.prototype[e]=function(){return T.call(this,n.apply(this._wrapped,arguments))}}),g.prototype.value=function(){return this._wrapped},"function"==typeof e&&e.amd&&e("underscore",[],function(){return g})}).call(this)}).call(this,n("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection-underscore-mixin/node_modules/underscore/underscore.js","/node_modules/ampersand-collection-underscore-mixin/node_modules/underscore")},{_process:59,buffer:56}],17:[function(e,n){(function(){function t(e,n){if(n||(n={}),n.model&&(this.model=n.model),n.comparator&&(this.comparator=n.comparator),n.parent&&(this.parent=n.parent),!this.mainIndex){var t=this.model&&this.model.prototype&&this.model.prototype.idAttribute;this.mainIndex=t||"id"}this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,a({silent:!0},n))}var o=e("backbone-events-standalone"),r=e("ampersand-class-extend"),s=e("is-array"),a=e("extend-object"),i=[].slice;a(t.prototype,o,{initialize:function(){},indexes:[],isModel:function(e){return this.model&&e instanceof this.model},add:function(e,n){return this.set(e,a({merge:!1,add:!0,remove:!1},n))},parse:function(e){return e},serialize:function(){return this.map(function(e){if(e.serialize)return e.serialize();var n={};return a(n,e),delete n.collection,n})},toJSON:function(){return this.serialize()},set:function(e,n){n=a({add:!0,remove:!0,merge:!0},n),n.parse&&(e=this.parse(e,n));var t=!s(e);e=t?e?[e]:[]:e.slice();var o,r,i,u,l,c,d,f=n.at,p=this.comparator&&null==f&&n.sort!==!1,m="string"==typeof this.comparator?this.comparator:null,h=[],g=[],y={},b=n.add,v=n.merge,_=n.remove,w=!p&&b&&_?[]:!1,E=this.model&&this.model.prototype||Object.prototype;for(c=0,d=e.length;d>c;c++){if(i=e[c]||{},o=this.isModel(i)?r=i:E.generateId?E.generateId(i):i[E.idAttribute||this.mainIndex],u=this.get(o))_&&(y[u.cid||u[this.mainIndex]]=!0),v&&(i=i===r?r.attributes:i,n.parse&&(i=u.parse(i,n)),u.set?(u.set(i,n),p&&!l&&u.hasChanged(m)&&(l=!0)):a(u,i)),e[c]=u;else if(b){if(r=e[c]=this._prepareModel(i,n),!r)continue;h.push(r),this._addReference(r,n)}r=u||r,r&&(w&&(r.isNew&&r.isNew()||!r[this.mainIndex]||!y[r.cid||r[this.mainIndex]])&&w.push(r),y[r[this.mainIndex]]=!0)}if(_){for(c=0,d=this.length;d>c;c++)r=this.models[c],y[r.cid||r[this.mainIndex]]||g.push(r);g.length&&this.remove(g,n)}if(h.length||w&&w.length)if(p&&(l=!0),null!=f)for(c=0,d=h.length;d>c;c++)this.models.splice(f+c,0,h[c]);else{var x=w||h;for(c=0,d=x.length;d>c;c++)this.models.push(x[c])}if(l&&this.sort({silent:!0}),!n.silent){for(c=0,d=h.length;d>c;c++)r=h[c],r.trigger?r.trigger("add",r,this,n):this.trigger("add",r,this,n);(l||w&&w.length)&&this.trigger("sort",this,n)}return t?e[0]:e},get:function(e,n){if(e){var t=this._indexes[n||this.mainIndex];return t[e]||t[e[this.mainIndex]]||this._indexes.cid[e.cid]}},at:function(e){return this.models[e]},remove:function(e,n){var t,o,r,a,u=!s(e);for(e=u?[e]:i.call(e),n||(n={}),t=0,o=e.length;o>t;t++)r=e[t]=this.get(e[t]),r&&(this._deIndex(r),a=this.models.indexOf(r),this.models.splice(a,1),n.silent||(n.index=a,r.trigger?r.trigger("remove",r,this,n):this.trigger("remove",r,this,n)),this._removeReference(r,n));return u?e[0]:e},reset:function(e,n){n||(n={});for(var t=0,o=this.models.length;o>t;t++)this._removeReference(this.models[t],n);return n.previousModels=this.models,this._reset(),e=this.add(e,a({silent:!0},n)),n.silent||this.trigger("reset",this,n),e},sort:function(e){var n=this;if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),this.models.sort("string"==typeof this.comparator?function(e,t){return e.get?(e=e.get(n.comparator),t=t.get(n.comparator)):(e=e[n.comparator],t=t[n.comparator]),e>t||void 0===e?1:t>e||void 0===t?-1:0
}:1===this.comparator.length?function(e,t){return e=n.comparator(e),t=n.comparator(t),e>t||void 0===e?1:t>e||void 0===t?-1:0}:this.comparator.bind(this)),e.silent||this.trigger("sort",this,e),this},_reset:function(){var e=this.indexes||[],n=0;e.push(this.mainIndex),e.push("cid");var t=e.length;for(this.models=[],this._indexes={};t>n;n++)this._indexes[e[n]]={}},_prepareModel:function(e,n){if(!this.model)return e;if(this.isModel(e))return e.collection||(e.collection=this),e;n=n?a({},n):{},n.collection=this;var t=new this.model(e,n);return t.validationError?(this.trigger("invalid",this,t.validationError,n),!1):t},_deIndex:function(e){for(var n in this._indexes)delete this._indexes[n][e[n]||e.get&&e.get(n)]},_index:function(e){for(var n in this._indexes){var t=e[n]||e.get&&e.get(n);t&&(this._indexes[n][t]=e)}},_addReference:function(e){this._index(e),e.collection||(e.collection=this),e.on&&e.on("all",this._onModelEvent,this)},_removeReference:function(e){this===e.collection&&delete e.collection,this._deIndex(e),e.off&&e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,n,t,o){("add"!==e&&"remove"!==e||t===this)&&("destroy"===e&&this.remove(n,o),n&&e==="change:"+this.mainIndex&&(this._deIndex(n),this._index(n)),this.trigger.apply(this,arguments))}}),Object.defineProperties(t.prototype,{length:{get:function(){return this.models.length}},isCollection:{value:!0}});var u=["indexOf","lastIndexOf","every","some","forEach","map","filter","reduce","reduceRight"];u.forEach(function(e){t.prototype[e]=function(){return this.models[e].apply(this.models,arguments)}}),t.prototype.each=t.prototype.forEach,t.extend=r,n.exports=t}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection/ampersand-collection.js","/node_modules/ampersand-collection")},{_process:59,"ampersand-class-extend":14,"backbone-events-standalone":19,buffer:56,"extend-object":60,"is-array":61}],18:[function(n,t,o){(function(){!function(){function n(){return{keys:Object.keys,uniqueId:function(e){var n=++c+"";return e?e+n:n},has:function(e,n){return u.call(e,n)},each:function(e,n,t){if(null!=e)if(i&&e.forEach===i)e.forEach(n,t);else if(e.length===+e.length){for(var o=0,r=e.length;r>o;o++)if(n.call(t,e[o],o,e)===a)return}else for(var s in e)if(this.has(e,s)&&n.call(t,e[s],s,e)===a)return},once:function(e){var n,t=!1;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}}}}var r,s=this,a={},i=Array.prototype.forEach,u=Object.prototype.hasOwnProperty,l=Array.prototype.slice,c=0,d=n();r={on:function(e,n,t){if(!p(this,"on",e,[n,t])||!n)return this;this._events||(this._events={});var o=this._events[e]||(this._events[e]=[]);return o.push({callback:n,context:t,ctx:t||this}),this},once:function(e,n,t){if(!p(this,"once",e,[n,t])||!n)return this;var o=this,r=d.once(function(){o.off(e,r),n.apply(this,arguments)});return r._callback=n,this.on(e,r,t)},off:function(e,n,t){var o,r,s,a,i,u,l,c;if(!this._events||!p(this,"off",e,[n,t]))return this;if(!e&&!n&&!t)return this._events={},this;for(a=e?[e]:d.keys(this._events),i=0,u=a.length;u>i;i++)if(e=a[i],s=this._events[e]){if(this._events[e]=o=[],n||t)for(l=0,c=s.length;c>l;l++)r=s[l],(n&&n!==r.callback&&n!==r.callback._callback||t&&t!==r.context)&&o.push(r);o.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var n=l.call(arguments,1);if(!p(this,"trigger",e,n))return this;var t=this._events[e],o=this._events.all;return t&&m(t,n),o&&m(o,arguments),this},stopListening:function(e,n,t){var o=this._listeners;if(!o)return this;var r=!n&&!t;"object"==typeof n&&(t=this),e&&((o={})[e._listenerId]=e);for(var s in o)o[s].off(n,t,this),r&&delete this._listeners[s];return this}};var f=/\s+/,p=function(e,n,t,o){if(!t)return!0;if("object"==typeof t){for(var r in t)e[n].apply(e,[r,t[r]].concat(o));return!1}if(f.test(t)){for(var s=t.split(f),a=0,i=s.length;i>a;a++)e[n].apply(e,[s[a]].concat(o));return!1}return!0},m=function(e,n){var t,o=-1,r=e.length,s=n[0],a=n[1],i=n[2];switch(n.length){case 0:for(;++o<r;)(t=e[o]).callback.call(t.ctx);return;case 1:for(;++o<r;)(t=e[o]).callback.call(t.ctx,s);return;case 2:for(;++o<r;)(t=e[o]).callback.call(t.ctx,s,a);return;case 3:for(;++o<r;)(t=e[o]).callback.call(t.ctx,s,a,i);return;default:for(;++o<r;)(t=e[o]).callback.apply(t.ctx,n)}},h={listenTo:"on",listenToOnce:"once"};d.each(h,function(e,n){r[n]=function(n,t,o){var r=this._listeners||(this._listeners={}),s=n._listenerId||(n._listenerId=d.uniqueId("l"));return r[s]=n,"object"==typeof t&&(o=this),n[e](t,o,this),this}}),r.bind=r.on,r.unbind=r.off,r.mixin=function(e){var n=["on","once","off","trigger","stopListening","listenTo","listenToOnce","bind","unbind"];return d.each(n,function(n){e[n]=this[n]},this),e},"function"==typeof e?e(function(){return r}):"undefined"!=typeof o?("undefined"!=typeof t&&t.exports&&(o=t.exports=r),o.BackboneEvents=r):s.BackboneEvents=r}(this)}).call(this,n("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},n("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection/node_modules/backbone-events-standalone/backbone-events-standalone.js","/node_modules/ampersand-collection/node_modules/backbone-events-standalone")},{_process:59,buffer:56}],19:[function(e,n){(function(){n.exports=e("./backbone-events-standalone")}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection/node_modules/backbone-events-standalone/index.js","/node_modules/ampersand-collection/node_modules/backbone-events-standalone")},{"./backbone-events-standalone":18,_process:59,buffer:56}],20:[function(e,n){(function(){"undefined"!=typeof window&&(window.ampersand=window.ampersand||{},window.ampersand["ampersand-model"]=window.ampersand["ampersand-model"]||[],window.ampersand["ampersand-model"].push("4.0.3"));var t=e("ampersand-state"),o=e("underscore"),r=e("ampersand-sync"),s=t.extend({save:function(e,n,t){{var r,s,a;this.attributes}if(null==e||"object"==typeof e?(r=e,t=n):(r={})[e]=n,t=o.extend({validate:!0},t),r&&!t.wait){if(!this.set(r,t))return!1}else if(!this._validate(r,t))return!1;void 0===t.parse&&(t.parse=!0);var u=this,l=t.success;return t.success=function(e){var n=u.parse(e,t);return t.wait&&(n=o.extend(r||{},n)),o.isObject(n)&&!u.set(n,t)?!1:(l&&l(u,e,t),void u.trigger("sync",u,e,t))},i(this,t),s=this.isNew()?"create":t.patch?"patch":"update","patch"===s&&(t.attrs=r),t.wait&&(t.attrs=o.extend(u.serialize(),r)),a=this.sync(s,this,t)},fetch:function(e){e=e?o.clone(e):{},void 0===e.parse&&(e.parse=!0);var n=this,t=e.success;return e.success=function(o){return n.set(n.parse(o,e),e)?(t&&t(n,o,e),void n.trigger("sync",n,o,e)):!1},i(this,e),this.sync("read",this,e)},destroy:function(e){e=e?o.clone(e):{};var n=this,t=e.success,r=function(){n.trigger("destroy",n,n.collection,e)};if(e.success=function(o){(e.wait||n.isNew())&&r(),t&&t(n,o,e),n.isNew()||n.trigger("sync",n,o,e)},this.isNew())return e.success(),!1;i(this,e);var s=this.sync("delete",this,e);return e.wait||r(),s},sync:function(){return r.apply(this,arguments)},url:function(){var e=o.result(this,"urlRoot")||o.result(this.collection,"url")||a();return this.isNew()?e:e+("/"===e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.getId())}}),a=function(){throw new Error('A "url" property or function must be specified')},i=function(e,n){var t=n.error;n.error=function(o){t&&t(e,o,n),e.trigger("error",e,o,n)}};n.exports=s}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-model/ampersand-model.js","/node_modules/ampersand-model")},{_process:59,"ampersand-state":21,"ampersand-sync":26,buffer:56,underscore:40}],21:[function(e,n){(function(){function t(e,n){n||(n={}),this.cid||(this.cid=a.uniqueId("state")),this._events={},this._values={},this._definition=Object.create(this._definition),n.parse&&(e=this.parse(e,n)),this.parent=n.parent,this.collection=n.collection,this._keyTree=new u,this._initCollections(),this._initChildren(),this._cache={},this._previousAttributes={},e&&this.set(e,a.extend({silent:!0,initial:!0},n)),this._changed={},this._derived&&this._initDerived(),n.init!==!1&&this.initialize.apply(this,arguments)}function o(e,n,t,o){var r,s,i=e._definition[n]={};if(a.isString(t))r=e._ensureValidType(t),r&&(i.type=r);else{if(a.isArray(t)&&(s=t,t={type:s[0],required:s[1],"default":s[2]}),r=e._ensureValidType(t.type),r&&(i.type=r),t.required&&(i.required=!0),t.default&&"object"==typeof t.default)throw new TypeError("The default value for "+n+" cannot be an object/array, must be a value or a function which returns a value/object/array");i.default=t.default,i.allowNull=t.allowNull?t.allowNull:!1,t.setOnce&&(i.setOnce=!0),i.required&&a.isUndefined(i.default)&&!i.setOnce&&(i.default=e._getDefaultForType(r)),i.test=t.test,i.values=t.values}return o&&(i.session=!0),Object.defineProperty(e,n,{set:function(e){this.set(n,e)},get:function(){var e=this._values[n],t=this._dataTypes[i.type];return"undefined"!=typeof e?(t&&t.get&&(e=t.get(e)),e):(e=a.result(i,"default"),this._values[n]=e,e)}}),i}function r(e,n,t){var o=e._derived[n]={fn:a.isFunction(t)?t:t.fn,cache:t.cache!==!1,depList:t.deps||[]};a.each(o.depList,function(t){e._deps[t]=a(e._deps[t]||[]).union([n])}),Object.defineProperty(e,n,{get:function(){return this._getDerivedProperty(n)},set:function(){throw new TypeError('"'+n+"\" is a derived property, it can't be set directly.")}})}function s(e){var n,t=this,s=[].slice.call(arguments);n=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return t.apply(this,arguments)},a.extend(n,t);var i=function(){this.constructor=n};i.prototype=t.prototype,n.prototype=new i,n.prototype._derived=a.extend({},t.prototype._derived),n.prototype._deps=a.extend({},t.prototype._deps),n.prototype._definition=a.extend({},t.prototype._definition),n.prototype._collections=a.extend({},t.prototype._collections),n.prototype._children=a.extend({},t.prototype._children),n.prototype._dataTypes=a.extend({},t.prototype._dataTypes||d),e&&s.forEach(function(e){var t=["dataTypes","props","session","derived","collections","children"];e.dataTypes&&a.each(e.dataTypes,function(e,t){n.prototype._dataTypes[t]=e}),e.props&&a.each(e.props,function(e,t){o(n.prototype,t,e)}),e.session&&a.each(e.session,function(e,t){o(n.prototype,t,e,!0)}),e.derived&&a.each(e.derived,function(e,t){r(n.prototype,t,e)}),e.collections&&a.each(e.collections,function(e,t){n.prototype._collections[t]=e}),e.children&&a.each(e.children,function(e,t){n.prototype._children[t]=e}),a.extend(n.prototype,a.omit(e,t))});Object.prototype.toString;return n.__super__=t.prototype,n}"undefined"!=typeof window&&(window.ampersand=window.ampersand||{},window.ampersand["ampersand-state"]=window.ampersand["ampersand-state"]||[],window.ampersand["ampersand-state"].push("4.4.4"));var a=e("underscore"),i=e("backbone-events-standalone"),u=e("key-tree-store"),l=e("array-next"),c=/^change:/;a.extend(t.prototype,i,{extraProperties:"ignore",idAttribute:"id",namespaceAttribute:"namespace",typeAttribute:"modelType",initialize:function(){return this},getId:function(){return this[this.idAttribute]},getNamespace:function(){return this[this.namespaceAttribute]},getType:function(){return this[this.typeAttribute]},isNew:function(){return null==this.getId()},escape:function(e){return a.escape(this.get(e))},isValid:function(e){return this._validate({},a.extend(e||{},{validate:!0}))},parse:function(e){return e},serialize:function(){var e=this.getAttributes({props:!0},!0);return a.each(this._children,function(n,t){e[t]=this[t].serialize()},this),a.each(this._collections,function(n,t){e[t]=this[t].serialize()},this),e},set:function(e,n,t){var o,r,s,i,u,l,c,d,f,p,m,h,g,y,b,v,_=this,w=this.extraProperties;if(a.isObject(e)||null===e?(f=e,t=n):(f={},f[e]=n),t=t||{},!this._validate(f,t))return!1;h=t.unset,m=t.silent,y=t.initial,r=[],o=this._changing,this._changing=!0,o||(this._previousAttributes=this.attributes,this._changed={});for(d in f){if(i=f[d],s=typeof i,g=this._values[d],u=this._definition[d],!u){if(this._children[d]||this._collections[d]){this[d].set(i,t);continue}if("ignore"===w)continue;if("reject"===w)throw new TypeError('No "'+d+'" property defined on '+(this.type||"this")+' model and extraProperties not set to "ignore" or "allow"');if("allow"===w)u=this._createPropertyDefinition(d,"any");else if(w)throw new TypeError('Invalid value for extraProperties: "'+w+'"')}if(v=this._getCompareForType(u.type),p=this._dataTypes[u.type],p&&p.set&&(l=p.set(i),i=l.val,s=l.type),u.test&&(c=u.test.call(this,i,s)))throw new TypeError("Property '"+d+"' failed validation with error: "+c);if(a.isUndefined(i)&&u.required)throw new TypeError("Required property '"+d+"' must be of type "+u.type+". Tried to set "+i);if(a.isNull(i)&&u.required&&!u.allowNull)throw new TypeError("Property '"+d+"' must be of type "+u.type+" (cannot be null). Tried to set "+i);if(u.type&&"any"!==u.type&&u.type!==s&&!a.isNull(i)&&!a.isUndefined(i))throw new TypeError("Property '"+d+"' must be of type "+u.type+". Tried to set "+i);if(u.values&&!a.contains(u.values,i))throw new TypeError("Property '"+d+"' must be one of values: "+u.values.join(", ")+". Tried to set "+i);if(b=!v(g,i,d),u.setOnce&&void 0!==g&&b&&!y)throw new TypeError("Property '"+d+"' can only be set once.");b?(r.push({prev:g,val:i,key:d}),_._changed[d]=i):delete _._changed[d]}if(a.each(r,function(e){_._previousAttributes[e.key]=e.prev,h?delete _._values[e.key]:_._values[e.key]=e.val}),!m&&r.length&&(_._pending=!0),m||a.each(r,function(e){_.trigger("change:"+e.key,_,e.val,t)}),o)return this;if(!m)for(;this._pending;)this._pending=!1,this.trigger("change",this,t);return this._pending=!1,this._changing=!1,this},get:function(e){return this[e]},toggle:function(e){var n=this._definition[e];if("boolean"===n.type)this[e]=!this[e];else{if(!n||!n.values)throw new TypeError("Can only toggle properties that are type `boolean` or have `values` array.");this[e]=l(n.values,this[e])}return this},previousAttributes:function(){return a.clone(this._previousAttributes)},hasChanged:function(e){return null==e?!a.isEmpty(this._changed):a.has(this._changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?a.clone(this._changed):!1;var n,t,o,r=!1,s=this._changing?this._previousAttributes:this.attributes;for(var i in e)t=this._definition[i],t&&(o=this._getCompareForType(t.type),o(s[i],n=e[i])||((r||(r={}))[i]=n));return r},toJSON:function(){return this.serialize()},unset:function(e,n){{var t,o=this._definition[e];o.type}return o.required?(t=a.result(o,"default"),this.set(e,t,n)):this.set(e,t,a.extend({},n,{unset:!0}))},clear:function(e){var n=this;return a.each(a.keys(this.attributes),function(t){n.unset(t,e)}),this},previous:function(e){return null!=e&&Object.keys(this._previousAttributes).length?this._previousAttributes[e]:null},_getDefaultForType:function(e){var n=this._dataTypes[e];return n&&n.default},_getCompareForType:function(e){var n=this._dataTypes[e];return n&&n.compare?a.bind(n.compare,this):a.isEqual},_validate:function(e,n){if(!n.validate||!this.validate)return!0;e=a.extend({},this.attributes,e);var t=this.validationError=this.validate(e,n)||null;return t?(this.trigger("invalid",this,t,a.extend(n||{},{validationError:t})),!1):!0},_createPropertyDefinition:function(e,n,t){return o(this,e,n,t)},_ensureValidType:function(e){return a.contains(["string","number","boolean","array","object","date","any"].concat(a.keys(this._dataTypes)),e)?e:void 0},getAttributes:function(e,n){e||(e={}),a.defaults(e,{session:!1,props:!1,derived:!1});var t,o,r,s={};for(o in this._definition)r=this._definition[o],(e.session&&r.session||e.props&&!r.session)&&(t=n?this._values[o]:this[o],"undefined"==typeof t&&(t=a.result(r,"default")),"undefined"!=typeof t&&(s[o]=t));if(e.derived)for(o in this._derived)s[o]=this[o];return s},_initDerived:function(){var e=this;a.each(this._derived,function(n,t){var o=e._derived[t];o.deps=o.depList;var r=function(n){n=n||{};var r=o.fn.call(e);e._cache[t]===r&&o.cache||(o.cache&&(e._previousAttributes[t]=e._cache[t]),e._cache[t]=r,e.trigger("change:"+t,e,e._cache[t]))};o.deps.forEach(function(n){e._keyTree.add(n,r)})}),this.on("all",function(n){c.test(n)&&e._keyTree.get(n.split(":")[1]).forEach(function(e){e()})},this)},_getDerivedProperty:function(e,n){return this._derived[e].cache?((n||!this._cache.hasOwnProperty(e))&&(this._cache[e]=this._derived[e].fn.apply(this)),this._cache[e]):this._derived[e].fn.apply(this)},_initCollections:function(){var e;if(this._collections)for(e in this._collections)this[e]=new this._collections[e](null,{parent:this})},_initChildren:function(){var e;if(this._children)for(e in this._children)this[e]=new this._children[e]({},{parent:this}),this.listenTo(this[e],"all",this._getEventBubblingHandler(e))},_getEventBubblingHandler:function(e){return a.bind(function(n,t,o){c.test(n)?this.trigger("change:"+e+"."+n.split(":")[1],t,o):"change"===n&&this.trigger("change",this)},this)},_verifyRequired:function(){var e=this.attributes;for(var n in this._definition)if(this._definition[n].required&&"undefined"==typeof e[n])return!1;return!0}}),Object.defineProperties(t.prototype,{attributes:{get:function(){return this.getAttributes({props:!0,session:!0})}},all:{get:function(){return this.getAttributes({session:!0,props:!0,derived:!0})}},isState:{get:function(){return!0},set:function(){}}});var d={s