;(function(require,define,global,self,_,Backbone,ActiveXObject,require){ActiveXObject=window.ActiveXObject;;!function e(t,n,i){function o(r,s){if(!n[r]){if(!t[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(a)return a(r,!0);throw new Error("Cannot find module '"+r+"'")}var _=n[r]={exports:{}};t[r][0].call(_.exports,function(e){var n=t[r][1][e];return o(n?n:e)},_,_.exports,e,t,n,i)}return n[r].exports}for(var a="function"==typeof require&&require,r=0;rs;s++)if(e=r[s],a=this._events[e]){if(this._events[e]=i=[],t||n)for(c=0,u=a.length;u>c;c++)o=a[c],(t&&t!==o.callback&&t!==o.callback._callback||n&&n!==o.context)&&i.push(o);i.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=s.call(arguments,1);if(!h(this,"trigger",e,t))return this;var n=this._events[e],i=this._events.all;return n&&d(n,t),i&&d(i,arguments),this},stopListening:function(e,t,n){var i=this._listeners;if(!i)return this;var o=!t&&!n;"object"==typeof t&&(n=this),e&&((i={})[e._listenerId]=e);for(var a in i)i[a].off(t,n,this),o&&delete this._listeners[a];return this}},u=/\s+/,h=function(e,t,n,i){if(!n)return!0;if("object"==typeof n){for(var o in n)e[t].apply(e,[o,n[o]].concat(i));return!1}if(u.test(n)){for(var a=n.split(u),r=0,s=a.length;s>r;r++)e[t].apply(e,[a[r]].concat(i));return!1}return!0},d=function(e,t){var n,i=-1,o=e.length,a=t[0],r=t[1],s=t[2];switch(t.length){case 0:for(;++ih;h++)this.trigger("change:"+r[h],this,u[r[h]],n)}if(l)return this;if(!s)for(;this._pending;)this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,_.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,_.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!_.isEmpty(this.changed):_.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?_.clone(this.changed):!1;var t,n=!1,i=this._changing?this._previousAttributes:this.attributes;for(var o in e)_.isEqual(i[o],t=e[o])||((n||(n={}))[o]=t);return n},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return _.clone(this._previousAttributes)},fetch:function(e){e=e?_.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,n=e.success;return e.success=function(i){return t.set(t.parse(i,e),e)?(n&&n(t,i,e),void t.trigger("sync",t,i,e)):!1},R(this,e),this.sync("read",this,e)},save:function(e,t,n){var i,o,a,r=this.attributes;if(null==e||"object"==typeof e?(i=e,n=t):(i={})[e]=t,!(!i||n&&n.wait||this.set(i,n)))return!1;if(n=_.extend({validate:!0},n),!this._validate(i,n))return!1;i&&n.wait&&(this.attributes=_.extend({},r,i)),void 0===n.parse&&(n.parse=!0);var s=this,l=n.success;return n.success=function(e){s.attributes=r;var t=s.parse(e,n);return n.wait&&(t=_.extend(i||{},t)),_.isObject(t)&&!s.set(t,n)?!1:(l&&l(s,e,n),void s.trigger("sync",s,e,n))},R(this,n),o=this.isNew()?"create":n.patch?"patch":"update","patch"===o&&(n.attrs=i),a=this.sync(o,this,n),i&&n.wait&&(this.attributes=r),a},destroy:function(e){e=e?_.clone(e):{};var t=this,n=e.success,i=function(){t.trigger("destroy",t,t.collection,e)};if(e.success=function(o){(e.wait||t.isNew())&&i(),n&&n(t,o,e),t.isNew()||t.trigger("sync",t,o,e)},this.isNew())return e.success(),!1;R(this,e);var o=this.sync("delete",this,e);return e.wait||i(),o},url:function(){var e=_.result(this,"urlRoot")||_.result(this.collection,"url")||j();return this.isNew()?e:e+("/"===e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(e){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(e){return this._validate({},_.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=_.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return n?(this.trigger("invalid",this,n,_.extend(t||{},{validationError:n})),!1):!0}});var m=["keys","values","pairs","invert","pick","omit"];_.each(m,function(e){f.prototype[e]=function(){var t=s.call(arguments);return t.unshift(this.attributes),_[e].apply(_,t)}});var v=t.Collection=function(e,t){t||(t={}),t.url&&(this.url=t.url),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,_.extend({silent:!0},t))},b={add:!0,remove:!0,merge:!0},y={add:!0,merge:!1,remove:!1};_.extend(v.prototype,c,{model:f,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,_.defaults(t||{},y))},remove:function(e,t){e=_.isArray(e)?e.slice():[e],t||(t={});var n,i,o,a;for(n=0,i=e.length;i>n;n++)a=this.get(e[n]),a&&(delete this._byId[a.id],delete this._byId[a.cid],o=this.indexOf(a),this.models.splice(o,1),this.length--,t.silent||(t.index=o,a.trigger("remove",a,this,t)),this._removeReference(a));return this},set:function(e,t){t=_.defaults(t||{},b),t.parse&&(e=this.parse(e,t)),_.isArray(e)||(e=e?[e]:[]);var n,i,o,a,s,c=t.at,u=this.comparator&&null==c&&t.sort!==!1,h=_.isString(this.comparator)?this.comparator:null,d=[],p=[],f={};for(n=0,i=e.length;i>n;n++)(o=this._prepareModel(e[n],t))&&((a=this.get(o))?(t.remove&&(f[a.cid]=!0),t.merge&&(a.set(o.attributes,t),u&&!s&&a.hasChanged(h)&&(s=!0))):t.add&&(d.push(o),o.on("all",this._onModelEvent,this),this._byId[o.cid]=o,null!=o.id&&(this._byId[o.id]=o)));if(t.remove){for(n=0,i=this.length;i>n;++n)f[(o=this.models[n]).cid]||p.push(o);p.length&&this.remove(p,t)}if(d.length&&(u&&(s=!0),this.length+=d.length,null!=c?l.apply(this.models,[c,0].concat(d)):r.apply(this.models,d)),s&&this.sort({silent:!0}),t.silent)return this;for(n=0,i=d.length;i>n;n++)(o=d[n]).trigger("add",o,this,t);return s&&this.trigger("sort",this,t),this},reset:function(e,t){t||(t={});for(var n=0,i=this.models.length;i>n;n++)this._removeReference(this.models[n]);return t.previousModels=this.models,this._reset(),this.add(e,_.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,_.extend({at:this.length},t)),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,_.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(e,t){return this.models.slice(e,t)},get:function(e){return null==e?void 0:this._byId[null!=e.id?e.id:e.cid||e]},at:function(e){return this.models[e]},where:function(e,t){return _.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),_.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(_.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},sortedIndex:function(e,t,n){t||(t=this.comparator);var i=_.isFunction(t)?t:function(e){return e.get(t)};return _.sortedIndex(this.models,e,i,n)},pluck:function(e){return _.invoke(this.models,"get",e)},fetch:function(e){e=e?_.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=e.success,n=this;return e.success=function(i){var o=e.reset?"reset":"set";n[o](i,e),t&&t(n,i,e),n.trigger("sync",n,i,e)},R(this,e),this.sync("read",this,e)},create:function(e,t){if(t=t?_.clone(t):{},!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var n=this,i=t.success;return t.success=function(o){t.wait&&n.add(e,t),i&&i(e,o,t)},e.save(null,t),e},parse:function(e){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof f)return e.collection||(e.collection=this),e;t||(t={}),t.collection=this;var n=new this.model(e,t);return n._validate(e,t)?n:(this.trigger("invalid",this,e,t),!1)},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,i){("add"!==e&&"remove"!==e||n===this)&&("destroy"===e&&this.remove(t,i),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],null!=t.id&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments))}});var w=["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","indexOf","shuffle","lastIndexOf","isEmpty","chain"];_.each(w,function(e){v.prototype[e]=function(){var t=s.call(arguments);return t.unshift(this.models),_[e].apply(_,t)}});var k=["groupBy","countBy","sortBy"];_.each(k,function(e){v.prototype[e]=function(t,n){var i=_.isFunction(t)?t:function(e){return e.get(t)};return _[e](this.models,i,n)}});var x=t.View=function(e){this.cid=_.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},S=/^(\S+)\s*(.*)$/,C=["model","collection","el","id","attributes","className","tagName","events"];_.extend(x.prototype,c,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,n){return this.$el&&this.undelegateEvents(),this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0],n!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=_.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var n=e[t];if(_.isFunction(n)||(n=this[e[t]]),n){var i=t.match(S),o=i[1],a=i[2];n=_.bind(n,this),o+=".delegateEvents"+this.cid,""===a?this.$el.on(o,n):this.$el.on(o,a,n)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_configure:function(e){this.options&&(e=_.extend({},_.result(this,"options"),e)),_.extend(this,_.pick(e,C)),this.options=e},_ensureElement:function(){if(this.el)this.setElement(_.result(this,"el"),!1);else{var e=_.extend({},_.result(this,"attributes"));this.id&&(e.id=_.result(this,"id")),this.className&&(e["class"]=_.result(this,"className"));var n=t.$("<"+_.result(this,"tagName")+">").attr(e);this.setElement(n,!1)}}}),t.sync=function(e,n,i){var o=I[e];_.defaults(i||(i={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var a={type:o,dataType:"json"};if(i.url||(a.url=_.result(n,"url")||j()),null!=i.data||!n||"create"!==e&&"update"!==e&&"patch"!==e||(a.contentType="application/json",a.data=JSON.stringify(i.attrs||n.toJSON(i))),i.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),i.emulateHTTP&&("PUT"===o||"DELETE"===o||"PATCH"===o)){a.type="POST",i.emulateJSON&&(a.data._method=o);var r=i.beforeSend;i.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",o),r?r.apply(this,arguments):void 0}}"GET"===a.type||i.emulateJSON||(a.processData=!1),"PATCH"!==a.type||!window.ActiveXObject||window.external&&window.external.msActiveXFilteringEnabled||(a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var s=i.xhr=t.ajax(_.extend(a,i));return n.trigger("request",n,s,i),s};var I={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var T=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},E=/\((.*?)\)/g,O=/(\(\?)?:\w+/g,P=/\*\w+/g,A=/[\-{}\[\]+?.,\\\^$|#\s]/g;_.extend(T.prototype,c,{initialize:function(){},route:function(e,n,i){_.isRegExp(e)||(e=this._routeToRegExp(e)),_.isFunction(n)&&(i=n,n=""),i||(i=this[n]);var o=this;return t.history.route(e,function(a){var r=o._extractParameters(e,a);i&&i.apply(o,r),o.trigger.apply(o,["route:"+n].concat(r)),o.trigger("route",n,r),t.history.trigger("route",o,n,r)}),this},navigate:function(e,n){return t.history.navigate(e,n),this},_bindRoutes:function(){if(this.routes){this.routes=_.result(this,"routes");for(var e,t=_.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(A,"\\$&").replace(E,"(?:$1)?").replace(O,function(e,t){return t?e:"([^/]+)"}).replace(P,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return _.map(n,function(e){return e?decodeURIComponent(e):null})}});var N=t.History=function(){this.handlers=[],_.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},M=/^[#\/]|\s+$/g,L=/^\/+|\/+$/g,F=/msie [\w.]+/,B=/\/$/;N.started=!1,_.extend(N.prototype,c,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(null==e)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(B,"");e.indexOf(n)||(e=e.substr(n.length))}else e=this.getHash();return e.replace(M,"")},start:function(e){if(N.started)throw new Error("Backbone.history has already been started");N.started=!0,this.options=_.extend({},{root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var n=this.getFragment(),i=document.documentMode,o=F.exec(navigator.userAgent.toLowerCase())&&(!i||7>=i);this.root=("/"+this.root+"/").replace(L,"/"),o&&this._wantsHashChange&&(this.iframe=t.$('