diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index a4eede0..bd0d772 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -44,4 +44,6 @@ When developing in LESS, be aware that [LESS Hat](http://lesshat.madebysource.co ##Tests -Tests run via Mocha and [Blanket](http://blanketjs.org/) for coverage. You can use [proxyquire](https://github.com/thlorenz/proxyquire) to override requires, but results in incorrect test coverage when used with Blanket. \ No newline at end of file +Tests run via Mocha and [Blanket](http://blanketjs.org/) for coverage. You can use [proxyquire](https://github.com/thlorenz/proxyquire) to override requires, but results in incorrect test coverage when used with Blanket. + +The `test/fixtures` folder contains example responses from GitHub. \ No newline at end of file diff --git a/public/js/app.bundle.min.js b/public/js/app.bundle.min.js index cdeebf9..96e62d2 100644 --- a/public/js/app.bundle.min.js +++ b/public/js/app.bundle.min.js @@ -15,4 +15,4 @@ var t;if(k.t===a.PARTIAL&&n&&(t=c.readExpression())&&(k={contextPartialExpressio return f}}(ve),xe=function(a,b,c,d){function e(a,b){var c=b?"svg":"div";return i.innerHTML="<"+c+" "+a+">",d(i.childNodes[0].attributes)}function f(a,b){for(var c=a.length;c--;)if(a[c].name===b.name)return!1;return!0}var g,h,i;"undefined"!=typeof document&&(i=c("div")),a.push(function(){h=a.Fragment});var j=function(a,b){this.element=a,this.root=a.root,this.parentFragment=a.parentFragment,this.attributes=[],this.fragment=new h({root:a.root,owner:this,template:[b]})};return j.prototype={bubble:function(){this.node&&this.update(),this.element.bubble()},rebind:function(a,b,c,d){this.fragment.rebind(a,b,c,d)},render:function(a){this.node=a,this.isSvg=a.namespaceURI===b.svg,this.update()},unbind:function(){this.fragment.unbind()},update:function(){var a,b,c=this;a=this.fragment.toString(),b=e(a,this.isSvg),this.attributes.filter(function(a){return f(b,a)}).forEach(function(a){c.node.removeAttribute(a.name)}),b.forEach(function(a){c.node.setAttribute(a.name,a.value)}),this.attributes=b},toString:function(){return this.fragment.toString()}},g=j}(f,C,D,Hd),ye=function(a){return function(b,c){return c?c.map(function(c){return new a(b,c)}):[]}}(xe),ze=function(a){for(var b,c,d=Array.prototype.slice,e=d.call(arguments,1);c=e.shift();)for(b in c)c.hasOwnProperty(b)&&(a[b]=c[b]);return a},Ae=function(a,b,c,d,e){var f=function(a){var c,d,e;return this.element=a,this.root=a.root,this.attribute=a.attributes[this.name||"value"],c=this.attribute.interpolator,c.twowayBinding=this,c.keypath&&"${"===c.keypath.substr(0,2)?(b("Two-way binding does not work with expressions (`"+c.keypath.slice(2,-1)+"`)"),!1):(c.keypath||c.resolver.forceResolution(),this.keypath=d=c.keypath,void(void 0===this.root.viewmodel.get(d)&&this.getInitialValue&&(e=this.getInitialValue(),void 0!==e&&this.root.viewmodel.set(d,e))))};return f.prototype={handleChange:function(){var b=this;a.start(this.root),this.attribute.locked=!0,this.root.viewmodel.set(this.keypath,this.getValue()),a.scheduleTask(function(){return b.attribute.locked=!1}),a.end()},rebound:function(){var a,b,c;b=this.keypath,c=this.attribute.interpolator.keypath,b!==c&&(e(this.root._twowayBindings[b],this),this.keypath=c,a=this.root._twowayBindings[c]||(this.root._twowayBindings[c]=[]),a.push(this))},unbind:function(){}},f.extend=function(a){var b,e=this;return b=function(a){f.call(this,a),this.init&&this.init()},b.prototype=c(e.prototype),d(b.prototype,a),b.extend=f.extend,b},f}(y,m,T,ze,q),Be=function(){this._ractive.binding.handleChange()},Ce=function(a,b){var c=a.extend({getInitialValue:function(){return this.element.fragment?this.element.fragment.toString():""},render:function(){var a=this.element.node;a.addEventListener("change",b,!1),this.root.lazy||(a.addEventListener("input",b,!1),a.attachEvent&&a.addEventListener("keyup",b,!1))},unrender:function(){var a=this.element.node;a.removeEventListener("change",b,!1),a.removeEventListener("input",b,!1),a.removeEventListener("keyup",b,!1)},getValue:function(){return this.element.node.innerHTML}});return c}(Ae,Be),De=function(){var a={};return function(b,c,d){var e=b+c+d;return a[e]||(a[e]=[])}}(),Ee=function(a,b,c,d,e){var f=c.extend({name:"checked",init:function(){this.siblings=d(this.root._guid,"radio",this.element.getAttribute("name")),this.siblings.push(this)},render:function(){var a=this.element.node;a.addEventListener("change",e,!1),a.attachEvent&&a.addEventListener("click",e,!1)},unrender:function(){var a=this.element.node;a.removeEventListener("change",e,!1),a.removeEventListener("click",e,!1)},handleChange:function(){a.start(this.root),this.siblings.forEach(function(a){a.root.viewmodel.set(a.keypath,a.getValue())}),a.end()},getValue:function(){return this.element.node.checked},unbind:function(){b(this.siblings,this)}});return f}(y,q,Ae,De,Be),Fe=function(a,b,c,d){var e=b.extend({name:"name",init:function(){this.siblings=d(this.root._guid,"radioname",this.keypath),this.siblings.push(this),this.radioName=!0,this.attribute.twoway=!0},getInitialValue:function(){return this.element.getAttribute("checked")?this.element.getAttribute("value"):void 0},render:function(){var a=this.element.node;a.name="{{"+this.keypath+"}}",a.checked=this.root.viewmodel.get(this.keypath)==this.element.getAttribute("value"),a.addEventListener("change",c,!1),a.attachEvent&&a.addEventListener("click",c,!1)},unrender:function(){var a=this.element.node;a.removeEventListener("change",c,!1),a.removeEventListener("click",c,!1)},getValue:function(){var a=this.element.node;return a._ractive?a._ractive.value:a.value},handleChange:function(){this.element.node.checked&&b.prototype.handleChange.call(this)},rebound:function(a,c,d,e){var f;b.prototype.rebound.call(this,a,c,d,e),(f=this.element.node)&&(f.name="{{"+this.keypath+"}}")},unbind:function(){a(this.siblings,this)}});return e}(q,Ae,Be,De),Ge=function(a,b,c,d,e,f){function g(a){return a.isChecked}function h(a){return a.element.getAttribute("value")}var i=d.extend({name:"name",getInitialValue:function(){return this.noInitialValue=!0,[]},init:function(){var a,b;this.checkboxName=!0,this.attribute.twoway=!0,this.siblings=e(this.root._guid,"checkboxes",this.keypath),this.siblings.push(this),this.noInitialValue&&(this.siblings.noInitialValue=!0),this.siblings.noInitialValue&&this.element.getAttribute("checked")&&(a=this.root.viewmodel.get(this.keypath),b=this.element.getAttribute("value"),a.push(b))},unbind:function(){c(this.siblings,this)},render:function(){var c,d,e=this.element.node;c=this.root.viewmodel.get(this.keypath),d=this.element.getAttribute("value"),this.isChecked=a(c)?b(c,d):c==d,e.name="{{"+this.keypath+"}}",e.checked=this.isChecked,e.addEventListener("change",f,!1),e.attachEvent&&e.addEventListener("click",f,!1)},unrender:function(){var a=this.element.node;a.removeEventListener("change",f,!1),a.removeEventListener("click",f,!1)},changed:function(){var a=!!this.isChecked;return this.isChecked=this.element.node.checked,this.isChecked===a},handleChange:function(){this.isChecked=this.element.node.checked,d.prototype.handleChange.call(this)},getValue:function(){return this.siblings.filter(g).map(h)}});return i}(h,ie,q,Ae,De,Be),He=function(a,b){var c=a.extend({name:"checked",render:function(){var a=this.element.node;a.addEventListener("change",b,!1),a.attachEvent&&a.addEventListener("click",b,!1)},unrender:function(){var a=this.element.node;a.removeEventListener("change",b,!1),a.removeEventListener("click",b,!1)},getValue:function(){return this.element.node.checked}});return c}(Ae,Be),Ie=function(a,b,c){var d=b.extend({getInitialValue:function(){var a,b,c,d,e=this.element.options;if(void 0===this.element.getAttribute("value")&&(b=a=e.length,a)){for(;b--;)if(e[b].getAttribute("selected")){c=e[b].getAttribute("value"),d=!0;break}if(!d)for(;++bb;b+=1)if(d=a[b],a[b].selected)return e=d._ractive?d._ractive.value:d.value},forceUpdate:function(){var b=this,c=this.getValue();void 0!==c&&(this.attribute.locked=!0,a.addViewmodel(this.root.viewmodel),a.scheduleTask(function(){return b.attribute.locked=!1}),this.root.viewmodel.set(this.keypath,c))}});return d}(y,Ae,Be),Je=function(a){return function(b,c){var d;if(!a(b)||!a(c))return!1;if(b.length!==c.length)return!1;for(d=b.length;d--;)if(b[d]!==c[d])return!1;return!0}}(h),Ke=function(a,b,c,d){var e=c.extend({getInitialValue:function(){return this.element.options.filter(function(a){return a.getAttribute("selected")}).map(function(a){return a.getAttribute("value")})},render:function(){var a;this.element.node.addEventListener("change",d,!1),a=this.root.viewmodel.get(this.keypath),void 0===a&&this.handleChange()},unrender:function(){this.element.node.removeEventListener("change",d,!1)},setValue:function(){throw new Error("TODO not implemented yet")},getValue:function(){var a,b,c,d,e,f;for(a=[],b=this.element.node.options,d=b.length,c=0;d>c;c+=1)e=b[c],e.selected&&(f=e._ractive?e._ractive.value:e.value,a.push(f));return a},handleChange:function(){var a,d,e;return a=this.attribute,d=a.value,e=this.getValue(),void 0!==d&&b(e,d)||c.prototype.handleChange.call(this),this},forceUpdate:function(){var b=this,c=this.getValue();void 0!==c&&(this.attribute.locked=!0,a.addViewmodel(this.root.viewmodel),a.scheduleTask(function(){return b.attribute.locked=!1}),this.root.viewmodel.set(this.keypath,c))},updateModel:function(){void 0!==this.attribute.value&&this.attribute.value.length||this.root.viewmodel.set(this.keypath,this.initialValue)}});return e}(y,Je,Ie,Be),Le=function(a,b){var c=a.extend({render:function(){this.element.node.addEventListener("change",b,!1)},unrender:function(){this.element.node.removeEventListener("change",b,!1)},getValue:function(){return this.element.node.files}});return c}(Ae,Be),Me=function(a,b){function c(){var a;b.call(this),a=this._ractive.root.viewmodel.get(this._ractive.binding.keypath,f),this.value=void 0==a?"":a}var d,e,f;return f={evaluateWrapped:!0},e=a.extend({getInitialValue:function(){return""},getValue:function(){return this.element.node.value},render:function(){var a=this.element.node;a.addEventListener("change",b,!1),this.root.lazy||(a.addEventListener("input",b,!1),a.attachEvent&&a.addEventListener("keyup",b,!1)),a.addEventListener("blur",c,!1)},unrender:function(){var a=this.element.node;a.removeEventListener("change",b,!1),a.removeEventListener("input",b,!1),a.removeEventListener("keyup",b,!1),a.removeEventListener("blur",c,!1)}}),d=e}(Ae,Be),Ne=function(a){return a.extend({getInitialValue:function(){return void 0},getValue:function(){var a=parseFloat(this.element.node.value);return isNaN(a)?void 0:a}})}(Me),Oe=function(a,b,c,d,e,f,g,h,i,j,k){function l(a){return a&&a.isBindable}var m;return m=function(m){var n,o,p,q,r=m.attributes;return m.binding&&(m.binding.teardown(),m.binding=null),(m.getAttribute("contenteditable")||r.contenteditable&&l(r.contenteditable))&&l(r.value)?o=b:"input"===m.name?(n=m.getAttribute("type"),"radio"===n||"checkbox"===n?(p=l(r.name),q=l(r.checked),p&&q&&a.error({message:"badRadioInputBinding"}),p?o="radio"===n?d:e:q&&(o="radio"===n?c:f)):"file"===n&&l(r.value)?o=i:l(r.value)&&(o="number"===n||"range"===n?j:k)):"select"===m.name&&l(r.value)?o=m.getAttribute("multiple")?h:g:"textarea"===m.name&&l(r.value)&&(o=k),o?new o(m):void 0}}(o,Ce,Ee,Fe,Ge,He,Ie,Ke,Le,Ne,Me),Pe=function(){var a=this.getAction();a&&!this.hasListener?this.listen():!a&&this.hasListener&&this.unrender()},Qe=function(a){return function(b){a(this.root,this.getAction(),{event:b})}}(mc),Re=function(){return this.action.toString().trim()},Se=function(a,b,c,d,e){function f(a){var b,c,d;if(b=this.root,"function"!=typeof b[this.method])throw new Error('Attempted to call a non-existent method ("'+this.method+'")');c=this.keypaths.map(function(c){var d,e,f;if(void 0===c)return void 0;if(c.eventObject){if(d=a,e=c.refinements.length)for(f=0;e>f;f+=1)d=d[c.refinements[f]]}else d=b.viewmodel.get(c);return d}),b.event=a,d=this.fn.apply(null,c),b[this.method].apply(b,d),delete b.event}function g(a){d(this.root,this.getAction(),{event:a,args:this.params})}function h(a){var b=this.dynamicParams.getValue(k);"string"==typeof b&&(b=b.substr(1,b.length-2)),d(this.root,this.getAction(),{event:a,args:b})}var i,j,k={args:!0},l=/^event(?:\.(.+))?/;return c.push(function(){j=c.Fragment}),i=function(c,d,i){var k,m,n,o=this;o.element=c,o.root=c.root,o.name=d,-1!==d.indexOf("*")&&(e.error({debug:this.root.debug,message:"noElementProxyEventWildcards",args:{element:c.tagName,event:d}}),this.invalid=!0),i.m?(m=i.a.r,o.method=i.m,o.keypaths=[],o.fn=a(i.a.s,m.length),o.parentFragment=c.parentFragment,n=o.root,o.refResolvers=m.map(function(a,c){var d;return(d=l.exec(a))?(o.keypaths[c]={eventObject:!0,refinements:d[1]?d[1].split("."):[]},null):b(o,a,function(a){o.resolve(c,a)})}),this.fire=f):(k=i.n||i,"string"!=typeof k&&(k=new j({template:k,root:this.root,owner:this})),this.action=k,i.d?(this.dynamicParams=new j({template:i.d,root:this.root,owner:this.element}),this.fire=h):i.a&&(this.params=i.a,this.fire=g))}}(cd,bd,f,mc,o),Te=function(a){var b,c;b=this._ractive,c=b.events[a.type],c.fire({node:this,original:a,index:b.index,keypath:b.keypath,context:b.root.get(b.keypath)})},Ue=function(a,b,c){function d(a){return f[a]||(f[a]=function(b){var c=b.node._ractive;b.index=c.index,b.keypath=c.keypath,b.context=c.root.get(c.keypath),c.events[a].fire(b)}),f[a]}var e,f={},g={touchstart:!0,touchmove:!0,touchend:!0,touchcancel:!0,touchleave:!0};return e=function(){var e,f=this.name;if(!this.invalid){if(e=a.registries.events.find(this.root,f))this.custom=e(this.node,d(f));else{if(!("on"+f in this.node||window&&"on"+f in window))return void(g[f]||c.error({debug:this.root.debug,message:"missingPlugin",args:{plugin:"event",name:f}}));this.node.addEventListener(f,b,!1)}this.hasListener=!0}}}(Vb,Te,o),Ve=function(a,b,c,d){function e(e){e&&e.rebind(a,b,c,d)}var f;return this.method?(f=this.element.parentFragment,void this.refResolvers.forEach(e)):("string"!=typeof this.action&&e(this.action),void(this.dynamicParams&&e(this.dynamicParams)))},We=function(){this.node=this.element.node,this.node._ractive.events[this.name]=this,(this.method||this.getAction())&&this.listen()},Xe=function(a,b){this.keypaths[a]=b},Ye=function(){function a(a){a.unbind()}var b;return b=function(){return this.method?void this.refResolvers.forEach(a):("string"!=typeof this.action&&this.action.unbind(),void(this.dynamicParams&&this.dynamicParams.unbind()))}}(),Ze=function(a){return function(){this.custom?this.custom.teardown():this.node.removeEventListener(this.name,a,!1),this.hasListener=!1}}(Te),$e=function(a,b,c,d,e,f,g,h,i,j){var k=function(a,b,c){this.init(a,b,c)};return k.prototype={bubble:a,fire:b,getAction:c,init:d,listen:e,rebind:f,render:g,resolve:h,unbind:i,unrender:j},k}(Pe,Qe,Re,Se,Ue,Ve,We,Xe,Ye,Ze),_e=function(a){return function(b,c){var d,e,f,g,h=[];for(e in c)if(c.hasOwnProperty(e))for(f=e.split("-"),d=f.length;d--;)g=new a(b,f[d],c[e]),h.push(g);return h}}($e),af=function(a,b,c){var d,e,f;return b.push(function(){d=b.Fragment}),e={args:!0},f=function(b,f){var g,h,i,j=this;j.element=b,j.root=g=b.root,h=f.n||f,"string"!=typeof h&&(i=new d({template:h,root:g,owner:b}),h=i.toString(),i.unbind()),f.a?j.params=f.a:f.d&&(j.fragment=new d({template:f.d,root:g,owner:b}),j.params=j.fragment.getValue(e),j.fragment.bubble=function(){this.dirtyArgs=this.dirtyValue=!0,j.params=this.getValue(e),j.ready&&j.update()}),j.fn=c.registries.decorators.find(g,h),j.fn||a.error({debug:g.debug,message:"missingPlugin",args:{plugin:"decorator",name:h}})},f.prototype={init:function(){var a,b,c,d=this;if(a=d.element.node,d.params?(c=[a].concat(d.params),b=d.fn.apply(d.root,c)):b=d.fn.call(d.root,a),!b||!b.teardown)throw new Error("Decorator definition must return an object with a teardown method");d.actual=b,d.ready=!0},update:function(){this.actual.update?this.actual.update.apply(this.root,this.params):(this.actual.teardown(!0),this.init())},rebind:function(a,b,c,d){this.fragment&&this.fragment.rebind(a,b,c,d)},teardown:function(a){this.actual.teardown(),!a&&this.fragment&&this.fragment.unbind()}},f}(o,f,Vb),bf=function(a){function b(a,b){for(var c=a.length;c--;)if(a[c]==b)return!0}var c;return c=function(c){var d,e,f,g,h;d=c.node,d&&(g=a(d.options),e=c.getAttribute("value"),f=c.getAttribute("multiple"),void 0!==e?(g.forEach(function(a){var c,d;c=a._ractive?a._ractive.value:a.value,d=f?b(e,c):e==c,d&&(h=!0),a.selected=d}),h||(g[0]&&(g[0].selected=!0),c.binding&&c.binding.forceUpdate())):c.binding&&c.binding.forceUpdate())}}(Hd),cf=function(a,b){return function(){var c=this;this.dirty||(this.dirty=!0,a.scheduleTask(function(){b(c),c.dirty=!1})),this.parentFragment.bubble()}}(y,bf),df=function(a){do if("select"===a.name)return a;while(a=a.parent)},ef=function(a){return function(b,c){b.select=a(b.parent),b.select&&(b.select.options.push(b),c.a||(c.a={}),void 0!==c.a.value||c.a.hasOwnProperty("disabled")||(c.a.value=c.f),"selected"in c.a&&void 0!==b.select.getAttribute("value")&&delete c.a.selected)}}(df),ff=function(a,b,c,d,e,f,g,h,i,j){var k;return j.push(function(){k=j.Fragment}),function(j){var l,m,n,o,p;this.type=a.ELEMENT,l=this.parentFragment=j.parentFragment,m=this.template=j.template,this.parent=j.pElement||l.pElement,this.root=n=l.root,this.index=j.index,this.name=b(m.e),"option"===this.name&&i(this,m),"select"===this.name&&(this.options=[],this.bubble=h),this.attributes=c(this,m.a),this.conditionalAttributes=d(this,m.m),m.f&&(this.fragment=new k({template:m.f,root:n,owner:this,pElement:this})),n.twoway&&(o=e(this,m.a))&&(this.binding=o,p=this.root._twowayBindings[o.keypath]||(this.root._twowayBindings[o.keypath]=[]),p.push(o)),m.v&&(this.eventHandlers=f(this,m.v)),m.o&&(this.decorator=new g(this,m.o)),this.intro=m.t0||m.t1,this.outro=m.t0||m.t2}}(S,Yd,we,ye,Oe,_e,af,cf,ef,f),gf=function(a){return function(b,c){return b===c||a(b,c)}}(Yc),hf=function(a,b){return function(c,d,e,f){var g=c[d];g&&!a(g,f)&&a(g,e)&&(c[d]=b(g,e,f))}}(gf,Zc),jf=function(a){return function(b,c,d,e){function f(a){a.rebind(b,c,d,e)}var g,h,i,j;if(this.attributes&&this.attributes.forEach(f),this.conditionalAttributes&&this.conditionalAttributes.forEach(f),this.eventHandlers&&this.eventHandlers.forEach(f),this.decorator&&f(this.decorator),this.fragment&&f(this.fragment),i=this.liveQueries)for(j=this.root,g=i.length;g--;)i[g]._makeDirty();this.node&&(h=this.node._ractive)&&(a(h,"keypath",d,e),void 0!=b&&(h.index[b]=c))}}(hf),kf=function(a){var b;(a.attributes.width||a.attributes.height)&&a.node.addEventListener("load",b=function(){var c=a.getAttribute("width"),d=a.getAttribute("height");void 0!==c&&a.node.setAttribute("width",c),void 0!==d&&a.node.setAttribute("height",d),a.node.removeEventListener("load",b,!1)},!1)},lf=function(a,b,c){var d,e={};return c.push(function(){d=c.Fragment}),function(c,f,g){var h,i,j,k=this;return k.element=c,k.root=h=c.root,k.isIntro=g,i=f.n||f,"string"!=typeof i&&(j=new d({template:i,root:h,owner:c}),i=j.toString(),j.unbind()),k.name=i,f.a?k.params=f.a:f.d&&(j=new d({template:f.d,root:h,owner:c}),k.params=j.getValue(e),j.unbind()),k._fn=b.registries.transitions.find(h,i),k._fn?void 0:void a.error({debug:h.debug,message:"missingPlugin",args:{plugin:"transition",name:i}})}}(o,Vb,f),mf=function(a){return a.replace(/-([a-zA-Z])/g,function(a,b){return b.toUpperCase()})},nf=function(a,b,c,d){var e,f,g;return a?(f={},g=c("div").style,e=function(a){var c,e,h;if(a=d(a),!f[a])if(void 0!==g[a])f[a]=a;else for(h=a.charAt(0).toUpperCase()+a.substring(1),c=b.length;c--;)if(e=b[c],void 0!==g[e+h]){f[a]=e+h;break}return f[a]}):e=null,e}(E,K,D,mf),of=function(a,b,c,d){var e,f;return b?(f=window.getComputedStyle||a.getComputedStyle,e=function(a){var b,e,g,h,i;if(b=f(this.node),"string"==typeof a)return i=b[d(a)],"0px"===i&&(i=0),i;if(!c(a))throw new Error("Transition$getStyle must be passed a string, or an array of strings representing CSS properties");for(e={},g=a.length;g--;)h=a[g],i=b[d(h)],"0px"===i&&(i=0),e[h]=i;return e}):e=null,e}(vb,E,h,nf),pf=function(a){return function(b,c){var d;if("string"==typeof b)this.node.style[a(b)]=c;else for(d in b)b.hasOwnProperty(d)&&(this.node.style[a(d)]=b[d]);return this}}(nf),qf=function(a,b,c){function d(a){return a}var e,f=function(e){var f;this.duration=e.duration,this.step=e.step,this.complete=e.complete,"string"==typeof e.easing?(f=e.root.easing[e.easing],f||(a('Missing easing function ("'+e.easing+'"). You may need to download a plugin from [TODO]'),f=d)):f="function"==typeof e.easing?e.easing:d,this.easing=f,this.start=b(),this.end=this.start+this.duration,this.running=!0,c.add(this)};return f.prototype={tick:function(a){var b,c;return this.running?a>this.end?(this.step&&this.step(1),this.complete&&this.complete(1),!1):(b=a-this.start,c=this.easing(b/this.duration),this.step&&this.step(c),!0):!1},stop:function(){this.abort&&this.abort(),this.running=!1}},e=f}(m,M,N),rf=function(a){var b=new RegExp("^-(?:"+a.join("|")+")-");return function(a){return a.replace(b,"")}}(K),sf=function(a){var b=new RegExp("^(?:"+a.join("|")+")([A-Z])");return function(a){var c;return a?(b.test(a)&&(a="-"+a),c=a.replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()})):""}}(K),tf=function(a,b,c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r={},s={};return a?(k=c("div").style,function(){void 0!==k.transition?(l="transition",m="transitionend",n=!0):void 0!==k.webkitTransition?(l="webkitTransition",m="webkitTransitionEnd",n=!0):n=!1}(),l&&(o=l+"Duration",p=l+"Property",q=l+"TimingFunction"),j=function(a,c,j,k,l){setTimeout(function(){var t,u,v,w,x;w=function(){u&&v&&(a.root.fire(a.name+":end",a.node,a.isIntro),l())},t=(a.node.namespaceURI||"")+a.node.tagName,a.node.style[p]=k.map(g).map(i).join(","),a.node.style[q]=i(j.easing||"linear"),a.node.style[o]=j.duration/1e3+"s",x=function(b){var c;c=k.indexOf(d(h(b.propertyName))),-1!==c&&k.splice(c,1),k.length||(a.node.removeEventListener(m,x,!1),v=!0,w())},a.node.addEventListener(m,x,!1),setTimeout(function(){for(var h,i,l,o,p,q=k.length,y=[];q--;)o=k[q],h=t+o,n&&!s[h]&&(a.node.style[g(o)]=c[o],r[h]||(i=a.getStyle(o),r[h]=a.getStyle(o)!=c[o],s[h]=!r[h],s[h]&&(a.node.style[g(o)]=i))),(!n||s[h])&&(void 0===i&&(i=a.getStyle(o)),l=k.indexOf(o),-1===l?b("Something very strange happened with transitions. If you see this message, please let @RactiveJS know. Thanks!"):k.splice(l,1),p=/[^\d]*$/.exec(c[o])[0],y.push({name:g(o),interpolator:e(parseFloat(i),parseFloat(c[o])),suffix:p}));y.length?new f({root:a.root,duration:j.duration,easing:d(j.easing||""),step:function(b){var c,d;for(d=y.length;d--;)c=y[d],a.node.style[c.name]=c.interpolator(b)+c.suffix},complete:function(){u=!0,w()}}):u=!0,k.length||(a.node.removeEventListener(m,x,!1),v=!0,w())},0)},j.delay||0)}):j=null,j}(E,m,D,mf,Wb,qf,nf,rf,sf),uf=function(a){function b(){i.hidden=document[e]}function c(){i.hidden=!0}function d(){i.hidden=!1}var e,f,g,h,i;if("undefined"!=typeof document){if(e="hidden",i={},e in document)g="";else for(h=a.length;h--;)f=a[h],e=f+"Hidden",e in document&&(g=f);void 0!==g?(document.addEventListener(g+"visibilitychange",b),b()):("onfocusout"in document?(document.addEventListener("focusout",c),document.addEventListener("focusin",d)):(window.addEventListener("pagehide",c),window.addEventListener("blur",c),window.addEventListener("pageshow",d),window.addEventListener("focus",d)),i.hidden=!1)}return i}(K),vf=function(a,b,c,d,e,f,g){var h,i,j;return b?(i=window.getComputedStyle||a.getComputedStyle,h=function(a,b,h,k){var l,m=this;if(g.hidden)return this.setStyle(a,b),j||(j=d.resolve());"string"==typeof a?(l={},l[a]=b):(l=a,k=h,h=b),h||(c('The "'+m.name+'" transition does not supply an options object to `t.animateStyle()`. This will break in a future version of Ractive. For more info see https://github.com/RactiveJS/Ractive/issues/340'),h=m,k=m.complete);var n=new d(function(a){var b,c,d,g,j,k,n;if(!h.duration)return m.setStyle(l),void a();for(b=Object.keys(l),c=[],d=i(m.node),j={},k=b.length;k--;)n=b[k],g=d[e(n)],"0px"===g&&(g=0),g!=l[n]&&(c.push(n),m.node.style[e(n)]=g);return c.length?void f(m,l,h,c,a):void a()});return k&&(c("t.animateStyle returns a Promise as of 0.4.0. Transition authors should do t.animateStyle(...).then(callback)"),n.then(k)),n}):h=null,h}(vb,E,m,r,nf,tf,uf),wf=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);return c.forEach(function(b){for(var c in b)!b.hasOwnProperty(c)||c in a||(a[c]=b[c])}),a},xf=function(a){return function(b,c){return"number"==typeof b?b={duration:b}:"string"==typeof b?b="slow"===b?{duration:600}:"fast"===b?{duration:200}:{duration:400}:b||(b={}),a({},b,c)}}(wf),yf=function(){function a(a,b){b?a.setAttribute("style",b):(a.getAttribute("style"),a.removeAttribute("style"))}var b;return b=function(){var b,c,d,e=this;return b=e.node=e.element.node,c=b.getAttribute("style"),e.complete=function(f){d||(!f&&e.isIntro&&a(b,c),b._ractive.transition=null,e._manager.remove(e),d=!0)},e._fn?void e._fn.apply(e.root,[e].concat(e.params)):void e.complete()}}(),zf=function(a,b,c,d,e,f,g){var h,i;return g.push(function(){h=g.Fragment}),i=function(a,b,c){this.init(a,b,c)},i.prototype={init:a,start:f,getStyle:b,setStyle:c,animateStyle:d,processParams:e},i}(lf,of,pf,vf,xf,yf,f),Af=function(a,b,c,d,e,f,g,h,i,j,k){function l(b){var c,d,e;return c=(d=b.getAttribute("xmlns"))?d:"svg"===b.name?a.svg:(e=b.parent)?"foreignObject"===e.name?a.html:e.node.namespaceURI:b.root.el.namespaceURI}function m(a){var c,d,e;if(a.select&&(d=a.select.getAttribute("value"),void 0!==d))if(c=a.getAttribute("value"),a.select.node.multiple&&b(d)){for(e=d.length;e--;)if(c==d[e]){a.node.selected=!0;break}}else a.node.selected=c==d}function n(a){var b,c,d,e,f;b=a.root;do for(c=b._liveQueries,d=c.length;d--;)e=c[d],f=c["_"+e],f._test(a)&&(a.liveQueries||(a.liveQueries=[])).push(f);while(b=b._parent)}var o,p,q;return p=function(){var a=this.node,b=this.fragment.toString(!1);if(window&&window.appearsToBeIELessEqual8&&(a.type="text/css"),a.styleSheet)a.styleSheet.cssText=b;else{for(;a.hasChildNodes();)a.removeChild(a.firstChild);a.appendChild(document.createTextNode(b))}},q=function(){this.node.type&&"text/javascript"!==this.node.type||c("Script tag was updated. This does not cause the code to be re-evaluated!"),this.node.text=this.fragment.toString(!1)},o=function(){var a,b,c=this,o=this.root;if(a=l(this),b=this.node=e(this.name,a),o.constructor.css&&this.parentFragment.getNode()===o.el&&this.node.setAttribute("data-rvcguid",o.constructor._guid),f(this.node,"_ractive",{value:{proxy:this,keypath:i(this.parentFragment),index:this.parentFragment.indexRefs,events:d(null),root:o}}),this.attributes.forEach(function(a){return a.render(b)}),this.conditionalAttributes.forEach(function(a){return a.render(b)}),this.fragment&&("script"===this.name?(this.bubble=q,this.node.text=this.fragment.toString(!1),this.fragment.unrender=g):"style"===this.name?(this.bubble=p,this.bubble(),this.fragment.unrender=g):this.binding&&this.getAttribute("contenteditable")?this.fragment.unrender=g:this.node.appendChild(this.fragment.render())),this.eventHandlers&&this.eventHandlers.forEach(function(a){return a.render()}),this.binding&&(this.binding.render(),this.node._ractive.binding=this.binding),"img"===this.name&&j(this),this.decorator&&this.decorator.fn&&h.scheduleTask(function(){return c.decorator.init()},!0),o.transitionsEnabled&&this.intro){var r=new k(this,this.intro,!0);h.registerTransition(r),h.scheduleTask(function(){return r.start()},!0),this.transition=r}return"option"===this.name&&m(this),this.node.autofocus&&h.scheduleTask(function(){return c.node.focus()},!0),n(this),this.node}}(C,h,m,T,D,F,Sb,y,t,kf,zf),Bf=function(a,b,c){function d(a){var c,d,e;if(c=a.getAttribute("value"),void 0===c||!a.select)return!1;if(d=a.select.getAttribute("value"),d==c)return!0;if(a.select.getAttribute("multiple")&&b(d))for(e=d.length;e--;)if(d[e]==c)return!0}function e(a){var b,c,d,e;return b=a.attributes,c=b.type,d=b.value,e=b.name,c&&"radio"===c.value&&d&&e.interpolator&&d.value===e.interpolator.value?!0:void 0}function f(a){var b=a.toString();return b?" "+b:""}var g;return g=function(){var b,g;return b="<"+(this.template.y?"!DOCTYPE":this.template.e),b+=this.attributes.map(f).join("")+this.conditionalAttributes.map(f).join(""),"option"===this.name&&d(this)&&(b+=" selected"),"input"===this.name&&e(this)&&(b+=" checked"),b+=">","textarea"===this.name&&void 0!==this.getAttribute("value")?b+=c(this.getAttribute("value")):void 0!==this.getAttribute("contenteditable")&&(b+=this.getAttribute("value")),this.fragment&&(g="script"!==this.name&&"style"!==this.name,b+=this.fragment.toString(g)),a.test(this.template.e)||(b+=""),b}}(zb,h,Sc),Cf=function(a){return function(b){b.select&&a(b.select.options,b)}}(q),Df=function(a){function b(a){a.unbind()}var c;return c=function(){this.fragment&&this.fragment.unbind(),this.binding&&this.binding.unbind(),this.eventHandlers&&this.eventHandlers.forEach(b),"option"===this.name&&a(this),this.attributes.forEach(b),this.conditionalAttributes.forEach(b)}}(Cf),Ef=function(a,b){function c(a){var b,c,d;for(d=a.liveQueries.length;d--;)b=a.liveQueries[d],c=b.selector,b._remove(a.node)}var d;return d=function(d){var e,f;if(this.transition&&this.transition.complete(),"option"===this.name?this.detach():d&&a.detachWhenReady(this),this.fragment&&this.fragment.unrender(!1),(e=this.binding)&&(this.binding.unrender(),this.node._ractive.binding=null,f=this.root._twowayBindings[e.keypath],f.splice(f.indexOf(e),1)),this.eventHandlers&&this.eventHandlers.forEach(function(a){return a.unrender()}),this.decorator&&this.decorator.teardown(),this.root.transitionsEnabled&&this.outro){var g=new b(this,this.outro,!1);a.registerTransition(g),a.scheduleTask(function(){return g.start()})}this.liveQueries&&c(this)}}(y,zf),Ff=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var p=function(a){this.init(a)};return p.prototype={bubble:a,detach:b,find:c,findAll:d,findAllComponents:e,findComponent:f,findNextNode:g,firstNode:h,getAttribute:i,init:j,rebind:k,render:l,toString:m,unbind:n,unrender:o},p}(Pd,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,ff,jf,Af,Bf,Df,Ef),Gf=function(){function a(a,b){var c=d.exec(b)[0];return null===a||c.length"},unrender:function(a){a&&this.node.parentNode.removeChild(this.node)}},c}(S,Uc),fg=function(a,b,c){var d;c.push(function(){d=c.Fragment});var e=function(b){var c,e;c=b.parentFragment.root,this.component=e=c.component,this.surrogateParent=b.parentFragment,this.parentFragment=e.parentFragment,this.fragment=new d({owner:this,root:c.yield.instance,template:c.yield.template,pElement:this.surrogateParent.pElement}),e.yielders.push(this),a.scheduleTask(function(){if(e.yielders.length>1)throw new Error("A component template can only have one {{yield}} declaration at a time")})};return e.prototype={detach:function(){return this.fragment.detach()},find:function(a){return this.fragment.find(a)},findAll:function(a,b){return this.fragment.findAll(a,b)},findComponent:function(a){return this.fragment.findComponent(a)},findAllComponents:function(a,b){return this.fragment.findAllComponents(a,b)},findNextNode:function(){return this.surrogateParent.findNextNode(this)},firstNode:function(){return this.fragment.firstNode()},getValue:function(a){return this.fragment.getValue(a)},render:function(){return this.fragment.render()},unbind:function(){this.fragment.unbind()},unrender:function(a){this.fragment.unrender(a),b(this.component.yielders,this)},rebind:function(a,b,c,d){this.fragment.rebind(a,b,c,d)},toString:function(){return this.fragment.toString()}},e}(y,q,f),gg=function(a,b,c,d,e,f,g,h,i,j,k){return function(l){if("string"==typeof l.template)return new b(l);switch(l.template.t){case a.INTERPOLATOR:return"yield"===l.template.r?new k(l):new c(l);case a.SECTION:return new d(l);case a.TRIPLE:return new e(l);case a.ELEMENT:var m;return(m=h(l.parentFragment.root,l.template.e))?new i(l,m):new f(l);case a.PARTIAL:return new g(l);case a.COMMENT:return new j(l);default:throw new Error("Something very strange happened. Please file an issue at https://github.com/ractivejs/ractive/issues. Thanks!")}}}(S,Vc,kd,Bd,Od,Ff,Jf,Kf,dg,eg,fg),hg=function(a,b,c){return function(d){var e,f,g,h=this;if(this.owner=d.owner,e=this.parent=this.owner.parentFragment,this.root=d.root,this.pElement=d.pElement,this.context=d.context,this.owner.type===a.SECTION&&(this.index=d.index),e&&(f=e.indexRefs)){this.indexRefs=b(null);for(g in f)this.indexRefs[g]=f[g]}d.indexRef&&(this.indexRefs||(this.indexRefs={}),this.indexRefs[d.indexRef]=d.index),"string"==typeof d.template?d.template=[d.template]:d.template||(d.template=[]),this.items=d.template.map(function(a,b){return c({parentFragment:h,pElement:d.pElement,template:a,index:b})}),this.value=this.argsList=null,this.dirtyArgs=this.dirtyValue=!0,this.bound=!0}}(S,T,gg),ig=function(a){return function(b,c,d,e){this.index=c,a(this,"context",d,e),this.indexRefs&&void 0!==this.indexRefs[b]&&(this.indexRefs[b]=c),this.items.forEach(function(a){a.rebind&&a.rebind(b,c,d,e)})}}(hf),jg=function(){var a;return 1===this.items.length?a=this.items[0].render():(a=document.createDocumentFragment(),this.items.forEach(function(b){a.appendChild(b.render())})),this.rendered=!0,a},kg=function(a){return this.items?this.items.map(function(b){return b.toString(a)}).join(""):""},lg=function(){function a(a){a.unbind&&a.unbind()}var b;return b=function(){this.bound&&(this.items.forEach(a),this.bound=!1)}}(),mg=function(a){if(!this.rendered)throw new Error("Attempted to unrender a fragment that was not rendered");this.items.forEach(function(b){return b.unrender(a)}),this.rendered=!1},ng=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){var r=function(a){this.init(a)};return r.prototype={bubble:a,detach:b,find:c,findAll:d,findAllComponents:e,findComponent:f,findNextNode:g,firstNode:h,getNode:i,getValue:j,init:k,rebind:l,render:m,toString:n,unbind:o,unrender:p},q.Fragment=r,r}(Ic,Jc,Kc,Lc,Mc,Nc,Oc,Pc,Qc,Rc,hg,ig,jg,kg,lg,mg,f),og=function(a,b,c,d){var e=["template","partials","components","decorators","events"],f=new a("reset");return function(a,g){var h,i,j,k,l;if("function"!=typeof a||g?a=a||{}:(g=a,a={}),"object"!=typeof a)throw new Error("The reset method takes either no arguments, or an object containing new data");for((i=this.viewmodel.wrapped[""])&&i.reset?i.reset(a)===!1&&(this.data=a):this.data=a,j=d.reset(this),k=j.length;k--;)if(e.indexOf(j[k])>-1){l=!0;break}if(l){var m;this.viewmodel.mark(""),(m=this.component)&&(m.shouldDestroy=!0),this.unrender(),m&&(m.shouldDestroy=!1),this.fragment.template!==this.template&&(this.fragment.unbind(),this.fragment=new c({template:this.template,root:this,owner:this})),h=this.render(this.el,this.anchor)}else h=b.start(this,!0),this.viewmodel.mark(""),b.end();return f.fire(this,a),g&&h.then(g),h}}(p,y,ng,Vb),pg=function(a,b){return function(c){var d,e;a.template.init(null,this,{template:c}),d=this.transitionsEnabled,this.transitionsEnabled=!1,(e=this.component)&&(e.shouldDestroy=!0),this.unrender(),e&&(e.shouldDestroy=!1),this.fragment.unbind(),this.fragment=new b({template:this.template,root:this,owner:this}),this.render(this.el,this.anchor),this.transitionsEnabled=d}}(Vb,ng),qg=function(a){return a("reverse")}(Dc),rg=function(a,b,c,d){var e=/\*/;return function(f,g,h){var i,j,k=this;if(j=a.start(this,!0),b(f)){i=f,h=g;for(f in i)i.hasOwnProperty(f)&&(g=i[f],f=c(f),this.viewmodel.set(f,g))}else f=c(f),e.test(f)?d(this,f).forEach(function(a){k.viewmodel.set(a,g)}):this.viewmodel.set(f,g);return a.end(),h&&j.then(h.bind(this)),j}}(y,i,J,tc),sg=function(a){return a("shift")}(Dc),tg=function(a){return a("sort")}(Dc),ug=function(a){return a("splice")}(Dc),vg=function(a){return function(b,c){return a(this,b,void 0===c?-1:-c)}}(H),wg=function(a,b,c){var d=new a("teardown");return function(a){var e;return this.fragment.unbind(),this.viewmodel.teardown(),this.fragment.rendered&&this.el.__ractive_instances__&&c(this.el.__ractive_instances__,this),this.shouldDestroy=!0,e=this.fragment.rendered?this.unrender():b.resolve(),d.fire(this),a&&e.then(a.bind(this)),e}}(p,r,q),xg=function(a){return function(b,c){var d;return"string"!=typeof b&&a.errorOnly({debug:this.debug,messsage:"badArguments",arg:{arguments:b}}),d=this.get(b),this.set(b,!d,c)}}(o),yg=function(){return this.fragment.toString(!0)},zg=function(a,b,c,d,e,f){var g=new b("unrender");return function(){var b,h,i=this;if(!this.fragment.rendered)return c.warn({debug:this.debug,message:"ractive.unrender() was called on a Ractive instance that was not rendered"}),d.resolve();for(b=f.start(this,!0),h=!this.component||this.component.shouldDestroy||this.shouldDestroy,this.constructor.css&&b.then(function(){a.remove(i.constructor)});this._animations[0];)this._animations[0].stop();return this.fragment.unrender(h),e(this.el.__ractive_instances__,this),g.fire(this),f.end(),b}}(Gc,p,o,r,q,y),Ag=function(a){return a("unshift")}(Dc),Bg=function(a,b){var c=new a("update");return function(a,d){var e;return"function"==typeof a?(d=a,a=""):a=a||"",e=b.start(this,!0),this.viewmodel.mark(a),b.end(),c.fire(this,a),d&&e.then(d.bind(this)),e}}(p,y),Cg=function(a,b){function c(d,e,f,g){var h,i,j,k,l,m,n=[];if(h=d._twowayBindings[e],h&&(j=h.length))for(;j--;)k=h[j],(!k.radioName||k.element.node.checked)&&(k.checkboxName?n[k.keypath]||k.changed()||(n.push(k.keypath),n[k.keypath]=k):(l=k.attribute.value,m=k.getValue(),a(l,m)||b(l,m)||(f[e]=m)));if(n.length&&n.forEach(function(b){var c,d,e;c=n[b],d=c.attribute.value,e=c.getValue(),a(d,e)||(f[b]=e)}),g&&(i=d.viewmodel.depsMap["default"][e]))for(j=i.length;j--;)c(d,i[j],f,g)}var d;return d=function(a,b){var d;return"string"!=typeof a&&(a="",b=!0),c(this,a,d={},b),this.set(d)}}(Je,u),Dg=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F){return{add:a,animate:b,detach:c,find:d,findAll:e,findAllComponents:f,findComponent:g,fire:h,get:i,insert:j,merge:k,observe:l,off:m,on:n,pop:o,push:p,render:q,reset:r,resetTemplate:s,reverse:t,set:u,shift:v,sort:w,splice:x,subtract:y,teardown:z,toggle:A,toHTML:B,unrender:C,unshift:D,update:E,updateModel:F}}(I,Yb,Zb,$b,ic,jc,kc,nc,oc,qc,rc,xc,Ac,Bc,Ec,Fc,Hc,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg),Eg=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b,c;return b=16*Math.random()|0,c="x"==a?b:3&b|8,c.toString(16)})},Fg=function(){var a=0;return function(){return"r-"+a++}}(),Gg=function(a){function b(b){this.hook=new a(b),this.inProcess={},this.queue={}}function c(a,b){return a[b._guid]||(a[b._guid]=[])}function d(a,b){var e=c(a.queue,b);for(a.hook.fire(b);e.length;)d(a,e.shift());delete a.queue[b._guid]}return b.prototype={constructor:b,begin:function(a){this.inProcess[a._guid]=!0},end:function(a){var b=a._parent;b&&this.inProcess[b._guid]?c(this.queue,b).push(a):d(this,a),delete this.inProcess[a._guid]}},b}(p),Hg=function(a,b,c,d){var e=a.root,f=a.keypath;return"sort"===c||"reverse"===c?void e.viewmodel.set(f,b):void e.viewmodel.smartUpdate(f,b,d)},Ig=function(a,b,c,d){var e,f,g,h=[],i=["pop","push","reverse","shift","sort","splice","unshift"];return i.forEach(function(e){var f=function(){var b,f,g,h,i=Array.prototype.slice,j=i.call(arguments,0);for(b=c(this,e,j),f=Array.prototype[e].apply(this,arguments),a.start(),this._ractive.setting=!0,h=this._ractive.wrappers.length;h--;)g=this._ractive.wrappers[h],a.addViewmodel(g.root.viewmodel),d(g,this,e,b);return a.end(),this._ractive.setting=!1,f};b(h,e,{value:f})}),e={},e.__proto__?(f=function(a){a.__proto__=h},g=function(a){a.__proto__=Array.prototype}):(f=function(a){var c,d;for(c=i.length;c--;)d=i[c],b(a,d,{value:h[d],configurable:!0})},g=function(a){var b;for(b=i.length;b--;)delete a[i[b]]}),f.unpatch=g,f}(y,F,Cc,Hg),Jg=function(a,b,c){var d,e,f;return d={filter:function(a){return b(a)&&(!a._ractive||!a._ractive.setting)},wrap:function(a,b,c){return new e(a,b,c)}},e=function(b,d,e){this.root=b,this.value=d,this.keypath=e,d._ractive||(a(d,"_ractive",{value:{wrappers:[],instances:[],setting:!1},configurable:!0}),c(d)),d._ractive.instances[b._guid]||(d._ractive.instances[b._guid]=0,d._ractive.instances.push(b)),d._ractive.instances[b._guid]+=1,d._ractive.wrappers.push(this)},e.prototype={get:function(){return this.value},teardown:function(){var a,b,d,e,g;if(a=this.value,b=a._ractive,d=b.wrappers,e=b.instances,b.setting)return!1;if(g=d.indexOf(this),-1===g)throw new Error(f);if(d.splice(g,1),d.length){if(e[this.root._guid]-=1,!e[this.root._guid]){if(g=e.indexOf(this.root),-1===g)throw new Error(f);e.splice(g,1)}}else delete a._ractive,c.unpatch(this.value)}},f="Something went wrong in a rather interesting way",d}(F,h,Ig),Kg=function(a,b){var c,d;return a&&(c={filter:function(c,d,e){return a.filter(c,d,e)&&b.filter(c)},wrap:function(a,b,c){return new d(a,b,c)}},d=function(c,d,e){this.value=d,this.magic=!0,this.magicWrapper=a.wrap(c,d,e),this.arrayWrapper=b.wrap(c,d,e)},d.prototype={get:function(){return this.value},teardown:function(){this.arrayWrapper.teardown(),this.magicWrapper.teardown()},reset:function(a){return this.magicWrapper.reset(a)}}),c}(A,Jg),Lg=function(a,b,c,d,e){function f(a,b){var c,d={};if(!b)return a;b+=".";for(c in a)a.hasOwnProperty(c)&&(d[b+c]=a[c]);return d}function g(a){var b;return i[a]||(b=a?a+".":"",i[a]=function(c,d){var e;return"string"==typeof c?(e={},e[b+c]=d,e):"object"==typeof c?b?f(c,a):c:void 0}),i[a]}var h,i={};return h=function(f,h){var i,j,k,l,m=this.ractive;for(i=m.adapt.length,j=0;i>j;j+=1){if(k=m.adapt[j],"string"==typeof k){var n=a.registries.adaptors.find(m,k);if(!n)return c.critical({debug:m.debug,message:"missingPlugin",args:{plugin:"adaptor",name:k}});k=m.adapt[j]=n}if(k.filter(h,f,m))return l=this.wrapped[f]=k.wrap(m,h,f,g(f)),l.value=h,h}return m.magic?e.filter(h,f,m)?this.wrapped[f]=e.wrap(m,h,f):d.filter(h,f,m)&&(this.wrapped[f]=d.wrap(m,h,f)):m.modifyArrays&&b.filter(h,f,m)&&(this.wrapped[f]=b.wrap(m,h,f)),h}}(Vb,Jg,o,A,Kg),Mg=function(a){var b,c,d,e,f=[""];for(b=a.length;b--;)for(c=a[b],d=c.split(".");d.length>1;)d.pop(),e=d.join("."),-1===f.indexOf(e)&&f.push(e);return f},Ng=function(){function a(a){var b,d,e,f,g,h="";if(!c[a]){for(e=[];h.length=g;g+=1){for(d=g.toString(2);d.lengthe;){var h=c[e];if(h===b.keypath){d=!0;break}h.slice(0,b.keypath.length)===b.keypath&&g.push(h),e++}d&&b.setValue(a.get(b.keypath)),g.length&&b.refineValue(g)})}function g(a,b,c){function d(a){a.forEach(e),a.forEach(f)}function e(b){var d=h(a,b,c);d&&i.push({keypath:b,deps:d})}function f(b){var e;(e=a.depsMap[c][b])&&d(e)}function g(b){var c=a.get(b.keypath);b.deps.forEach(function(a){return a.setValue(c)})}var i=[];d(b),i.forEach(g)}function h(a,b,c){var d=a.deps[c];return d?d[b]:null}var i;return i=function(){function h(a){var b,e,f;m.noCascade.hasOwnProperty(a)||((e=m.deps.computed[a])&&(e.forEach(c),f=e.map(d),f.forEach(i),f.forEach(h)),(b=m.depsMap.computed[a])&&b.forEach(h))}function i(a){m.mark(a)}var j,k,l=this,m=this,n={};if(j=this.changes,j.length){if(j.forEach(h),k=a(j),k.forEach(function(a){var b,e;(b=m.deps.computed[a])&&(b.forEach(c),e=b.map(d),e.forEach(i),e.forEach(h))}),this.changes=[],this.patternObservers.length&&(k.forEach(function(a){return b(l,a,!0)}),j.forEach(function(a){return b(l,a)})),this.deps.observers&&(k.forEach(function(a){return e(l,null,a,"observers")}),g(this,j,"observers")),this.deps["default"]){var o=[];k.forEach(function(a){return e(l,o,a,"default")}),o.length&&f(this,o,j),g(this,j,"default")}return j.forEach(function(a){n[a]=l.get(a)}),this.implicitChanges={},this.noCascade={},n}}}(Mg,Og),Qg=function(){this.captureGroups.push([])},Rg=function(a,b){var c,d;if(b||(d=this.wrapped[a])&&d.teardown()!==!1&&(this.wrapped[a]=null),this.cache[a]=void 0,c=this.cacheMap[a])for(;c.length;)this.clearCache(c.pop())},Sg=function(){function a(a){var b="var __ractive=this;return("+a.replace(c,function(a,b){return'__ractive.get("'+b+'")'})+")";return new Function(b)}var b,c=/\$\{([^\}]+)\}/g;return b=function(b){return"function"==typeof b?{get:b}:"string"==typeof b?{get:a(b)}:("object"==typeof b&&"string"==typeof b.get&&(b={get:a(b.get),set:b.set}),b)}}(),Tg=function(a,b){var c=function(a,b,c){var d=this;this.ractive=a,this.viewmodel=a.viewmodel,this.key=b,this.getter=c.get,this.setter=c.set,this.hardDeps=c.deps||[],this.softDeps=[],this.depValues={},this.hardDeps&&this.hardDeps.forEach(function(b){return a.viewmodel.register(b,d,"computed")}),this._dirty=this._firstRun=!0};return c.prototype={constructor:c,init:function(){var a;this.bypass=!0,a=this.ractive.viewmodel.get(this.key),this.ractive.viewmodel.clearCache(this.key),this.bypass=!1,this.setter&&void 0!==a&&this.set(a)},invalidate:function(){this._dirty=!0},get:function(){var c,d,e,f=this,g=!1;if(!this.getting){if(this.getting=!0,this._dirty){if(c=this.ractive,this._firstRun||!this.hardDeps.length&&!this.softDeps.length?g=!0:[this.hardDeps,this.softDeps].forEach(function(a){var d,e,h;if(!g)for(h=a.length;h--;)if(d=a[h],e=c.viewmodel.get(d),!b(e,f.depValues[d]))return f.depValues[d]=e,void(g=!0)}),g){c.viewmodel.capture();try{this.value=this.getter.call(c)}catch(h){a.warn({debug:c.debug,message:"failedComputation",args:{key:this.key,err:h.message||h}}),this.value=void 0}d=c.viewmodel.release(),e=this.updateDependencies(d),e&&[this.hardDeps,this.softDeps].forEach(function(a){a.forEach(function(a){f.depValues[a]=c.viewmodel.get(a)})})}this._dirty=!1}return this.getting=this._firstRun=!1,this.value}},set:function(a){if(this.setting)return void(this.value=a);if(!this.setter)throw new Error("Computed properties without setters are read-only. (This may change in a future version of Ractive!)");this.setter.call(this.ractive,a)},updateDependencies:function(a){var b,c,d,e;for(c=this.softDeps,b=c.length;b--;)d=c[b],-1===a.indexOf(d)&&(e=!0,this.viewmodel.unregister(d,this,"computed"));for(b=a.length;b--;)d=a[b],-1!==c.indexOf(d)||this.hardDeps&&-1!==this.hardDeps.indexOf(d)||(e=!0,this.viewmodel.register(d,this,"computed"));return e&&(this.softDeps=a.slice()),e}},c}(o,u),Ug=function(a,b){return function(c,d){return d=a(d),this.computations[c]=new b(this.ractive,c,d)}}(Sg,Tg),Vg={FAILED_LOOKUP:!0},Wg=function(a,b){var c={},d=function(a,d){this.viewmodel=a,this.root=a.ractive,this.ref=d,this.parentFragment=c,a.unresolvedImplicitDependencies[d]=!0,a.unresolvedImplicitDependencies.push(this),b.addUnresolved(this)};return d.prototype={resolve:function(){this.viewmodel.mark(this.ref),this.viewmodel.unresolvedImplicitDependencies[this.ref]=!1,a(this.viewmodel.unresolvedImplicitDependencies,this)},teardown:function(){b.removeUnresolved(this)}},d}(q,y),Xg=function(a,b,c){function d(a,c){var d,e,f,g,h,i,j;return d=c.split("."),e=d.pop(),f=d.join("."),g=a.get(f),(j=a.wrapped[f])&&(g=j.get()),null!==g&&void 0!==g?((h=a.cacheMap[f])?-1===h.indexOf(c)&&h.push(c):a.cacheMap[f]=[c],"object"!=typeof g||e in g?(i=g[e],a.adapt(c,i,!1),a.cache[c]=i,i):a.cache[c]=b):void 0}var e,f={};return e=function(e){var g=arguments[1];void 0===g&&(g=f);var h,i,j,k,l=this.ractive,m=this.cache;return"@"===e[0]?(h=e.slice(1),a(h)?+h:h):(void 0===m[e]?((i=this.computations[e])&&!i.bypass?(h=i.get(),this.adapt(e,h)):(j=this.wrapped[e])?h=j.value:e?h=d(this,e):(this.adapt("",l.data),h=l.data),m[e]=h):h=m[e],g.evaluateWrapped&&(j=this.wrapped[e])&&(h=j.get()),g.capture&&(k=this.captureGroups[this.captureGroups.length-1])&&(~k.indexOf(e)||(k.push(e),h===b&&this.unresolvedImplicitDependencies[e]!==!0&&new c(this,e))),h===b?void 0:h)}}(j,Vg,Wg),Yg=function(){function a(a){a.init()}var b;return b=function(){var b,c,d=[];for(b in this.ractive.computed)c=this.compute(b,this.ractive.computed[b]),d.push(c);d.forEach(a)}}(),Zg=function(a,b){var c;b&&(b.implicit&&(this.implicitChanges[a]=!0),b.noCascade&&(this.noCascade[a]=!0)),(c=this.computations[a])&&c.invalidate(),-1===this.changes.indexOf(a)&&this.changes.push(a),this.clearCache(a)},$g=function(a,b){var c,d,e,f;return c={},d=0,e=a.map(function(a,e){var g,h,i;h=d,i=b.length;do{if(g=b.indexOf(a,h),-1===g)return f=!0,-1;h=g+1}while(c[g]&&i>h);return g===d&&(d+=1),g!==e&&(f=!0),c[g]=!0,g})},_g=function(a,b){function c(a){return JSON.stringify(a)}function d(a){if(a===!0)return c;if("string"==typeof a)return f[a]||(f[a]=function(b){return b[a]}),f[a];if("function"==typeof a)return a;throw new Error("The `compare` option must be a function, or a string representing an identifying field (or `true` to use JSON.stringify)")}var e,f={};return e=function(c,e,f,g){var h,i,j,k;if(this.mark(c),g&&g.compare){j=d(g.compare);try{h=e.map(j),i=f.map(j)}catch(l){if(this.debug)throw l;a("Merge operation: comparison failed. Falling back to identity checking"),h=e,i=f}}else h=e,i=f;k=b(h,i),this.smartUpdate(c,f,k,e.length!==f.length)}}(m,$g),ah=function(){function a(a,b,c){var d,e,f,g;for(d=b.split(".");d.length;)d.pop(),e=d.join("."),f=a.depsMap[c]||(a.depsMap[c]={}),g=f[e]||(f[e]=[]),void 0===g[b]&&(g[b]=0,g.push(b)),g[b]+=1,b=e}var b;return b=function(b,c){var d=arguments[2];void 0===d&&(d="default");var e,f;c.isStatic||(e=this.deps[d]||(this.deps[d]={}),f=e[b]||(e[b]=[]),f.push(c),b&&a(this,b,d))}}(),bh=function(){return this.captureGroups.pop()},ch=function(a,b){function c(a,c,d){var e,f,g,h,i,j,k;j=function(){h.set?h.set(f,d):(i=h.get(),k())},k=function(){i||(i=b(f),a.set(g,i,!0)),i[f]=d},e=c.split("."),f=e.pop(),g=e.join("."),h=a.wrapped[g],h?j():(i=a.get(g),(h=a.wrapped[g])?j():k())}var d;return d=function(b,d,e){var f,g,h;if(f=this.computations[b]){if(f.setting)return;f.set(d),d=f.get()}a(this.cache[b],d)||(g=this.wrapped[b],g&&g.reset&&(h=g.reset(d)!==!1,h&&(d=g.get())),f||h||c(this,b,d),e?this.clearCache(b):this.mark(b))}}(u,z),dh=function(){function a(a){return"function"==typeof a.shuffle}var b,c={implicit:!0},d={noCascade:!0};return b=function(b,e,f){var g,h,i=this;if(h=f.length,f.forEach(function(a,c){-1===a&&i.mark(b+"."+c,d)}),this.set(b,e,!0),(g=this.deps["default"][b])&&g.filter(a).forEach(function(a){return a.shuffle(f,e)}),h!==e.length){this.mark(b+".length",c);for(var j=h;jk;k+=1)this.mark(b+"."+k,d)}}}(),eh=function(){var a,b=this;for(Object.keys(this.cache).forEach(function(a){return b.clearCache(a)});a=this.unresolvedImplicitDependencies.pop();)a.teardown()},fh=function(){function a(a,b,c){var d,e,f,g;for(d=b.split(".");d.length;)d.pop(),e=d.join("."),f=a.depsMap[c],g=f[e],g[b]-=1,g[b]||(g.splice(g.indexOf(b),1),g[b]=void 0),b=e}var b;return b=function(b,c){var d=arguments[2];void 0===d&&(d="default");var e,f;if(!c.isStatic){if(e=this.deps[d][b],f=e.indexOf(c),-1===f)throw new Error("Attempted to remove a dependant that was no longer registered! This should not happen. If you are seeing this bug in development please raise an issue at https://github.com/RactiveJS/Ractive/issues - thanks");e.splice(f,1),b&&a(this,b,d)}}}(),gh=function(){function a(a){return"string"==typeof a&&(a=[a]),a}var b={lookup:function(a,b){var c,d=a.adapt;if(!d||!d.length)return d;if(b&&Object.keys(b).length&&(c=d.length))for(;c--;){var e=d[c];"string"==typeof e&&(d[c]=b[e]||e)}return d},combine:function(b,c){return b=a(b),c=a(c),b&&b.length?c&&c.length?(b.forEach(function(a){-1===c.indexOf(a)&&c.push(a)}),c):b.slice():c}};return b}(),hh=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){var r;try{Object.defineProperty({},"test",{value:0})}catch(s){r=!0}var t=function(b){this.ractive=b,t.extend(b.constructor,b),this.cache={},this.cacheMap=a(null),this.deps={computed:{},"default":{}},this.depsMap={computed:{},"default":{}},this.patternObservers=[],this.wrapped=a(null),this.computations=a(null),this.captureGroups=[],this.unresolvedImplicitDependencies=[],this.changes=[],this.implicitChanges={},this.noCascade={}};return t.extend=function(a,b){if(b.magic&&r)throw new Error("Getters and setters (magic mode) are not supported in this browser");b.adapt=q.combine(a.prototype.adapt,b.adapt)||[],b.adapt=q.lookup(b,b.adaptors)},t.prototype={adapt:b,applyChanges:c,capture:d,clearCache:e,compute:f,get:g,init:h,mark:i,merge:j,register:k,release:l,set:m,smartUpdate:n,teardown:o,unregister:p},t}(T,Lg,Pg,Qg,Rg,Ug,Xg,Yg,Zg,_g,ah,bh,ch,dh,eh,fh,gh),ih=function(a,b,c,d,e,f,g,h){function i(a,c){a._guid=e(),a._subs=b(null),a._config={},a._twowayBindings=b(null),a._animations=[],a.nodes={},a._liveQueries=[],a._liveComponentQueries=[],c._parent&&c._component&&(a._parent=c._parent,a.component=c._component,c._component.instance=a)}var j,k=new f("construct"),l=new f("config"),m=new g("init");return j=function(b){var e=arguments[1];void 0===e&&(e={});var f;if(i(b,e),k.fire(a.getConstructTarget(b,e),e),a.init(b.constructor,b,e),l.fire(b),(f=d(b.el))&&!b.append){if(f.__ractive_instances__)try{f.__ractive_instances__.splice(0,f.__ractive_instances__.length).forEach(function(a){return a.teardown()})}catch(g){}f.innerHTML=""}m.begin(b),b.viewmodel=new h(b),b.viewmodel.init(),b.template&&(b.fragment=new c({template:b.template,root:b,owner:b})),m.end(b),f&&b.render(f,b.append)}}(Vb,T,ng,pc,Fg,p,Gg,hh),jh=function(a,b,c){function d(a,b,c){var d,e=Object.keys(a[c]);e.length&&((d=b[c])||(d=b[c]={}),e.filter(function(a){return!(a in d)}).forEach(function(b){return d[b]=a[c][b]}))}var e,f;return c.push(function(){f=c.Ractive}),e=function(c){if(!(c.prototype instanceof f))return c;for(var e={};c;)b.registries.forEach(function(a){d(a.useDefaults?c.prototype:c,e,a.name)}),Object.keys(c.prototype).forEach(function(b){if("computed"!==b){var d=c.prototype[b];if(b in e){if("function"==typeof e[b]&&"function"==typeof d&&e[b]._method){var f,g=d._method;g&&(d=d._method),f=a(e[b]._method,d),g&&(f._method=f),e[b]=f}}else e[b]=d._method?d._method:d}}),c=c._parent!==f?c._parent:!1;return e}}(Q,Vb,f),kh=function(a,b,c,d,e,f,g){return function h(){var i=arguments[0];void 0===i&&(i={});var j,k,l,m=this;return i=g(i),j=function(a){e(this,a)},k=a(m.prototype),k.constructor=j,l={_guid:{value:c()},defaults:{value:k},extend:{value:h,writable:!0,configurable:!0},_parent:{value:m}},b(j,l),d.extend(m,k,i),f.extend(m,k),j.prototype=k,j}}(T,G,Eg,Vb,ih,hh,jh),lh=function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n,o; for(n=function(a){l(this,a)},o={extend:{value:j},parse:{value:k},Promise:{value:h},svg:{value:d},magic:{value:e},VERSION:{value:"0.6.1"},adaptors:{writable:!0,value:{}},components:{writable:!0,value:{}},decorators:{writable:!0,value:{}},easing:{writable:!0,value:b},events:{writable:!0,value:{}},interpolators:{writable:!0,value:c},partials:{writable:!0,value:{}},transitions:{writable:!0,value:{}}},f(n,o),n.prototype=i(g,a),n.prototype.constructor=n,n.defaults=n.prototype,m.Ractive=n;m.length;)m.pop()();var p="function";if(typeof Date.now!==p||typeof String.prototype.trim!==p||typeof Object.keys!==p||typeof Array.prototype.indexOf!==p||typeof Array.prototype.forEach!==p||typeof Array.prototype.map!==p||typeof Array.prototype.filter!==p||"undefined"!=typeof window&&typeof window.addEventListener!==p)throw new Error("It looks like you're attempting to use Ractive.js in an older browser. You'll need to use one of the 'legacy builds' in order to continue - see http://docs.ractivejs.org/latest/legacy-builds for more information.");return n}(d,e,k,l,B,G,Dg,r,ze,kh,Lb,ih,f);"undefined"!=typeof b&&b.exports?b.exports=lh:"function"==typeof define&&define.amd&&define(function(){return lh}),a.Ractive=lh,lh.noConflict=function(){return a.Ractive=c,lh}}("undefined"!=typeof window?window:this)},{}],14:[function(a,b,c){!function(a){function c(a,b){var c=b?P[eb]:P[bb];return c.test(a)?new f(a,b):null}function d(a,b){var d=c(a,b);return d?d.version:null}function e(a,b){var d=c(a.trim().replace(/^[=v]+/,""),b);return d?d.version:null}function f(a,b){if(a instanceof f){if(a.loose===b)return a;a=a.version}else if("string"!=typeof a)throw new TypeError("Invalid Version: "+a);if(!(this instanceof f))return new f(a,b);this.loose=b;var c=a.trim().match(b?P[eb]:P[bb]);if(!c)throw new TypeError("Invalid Version: "+a);this.raw=a,this.major=+c[1],this.minor=+c[2],this.patch=+c[3],this.prerelease=c[4]?c[4].split(".").map(function(a){return/^[0-9]+$/.test(a)?+a:a}):[],this.build=c[5]?c[5].split("."):[],this.format()}function g(a,b,c,d){"string"==typeof c&&(d=c,c=void 0);try{return new f(a,c).inc(b,d).version}catch(e){return null}}function h(a,b){var c=Eb.test(a),d=Eb.test(b);return c&&d&&(a=+a,b=+b),c&&!d?-1:d&&!c?1:b>a?-1:a>b?1:0}function i(a,b){return h(b,a)}function j(a,b,c){return new f(a,c).compare(b)}function k(a,b){return j(a,b,!0)}function l(a,b,c){return j(b,a,c)}function m(b,c){return b.sort(function(b,d){return a.compare(b,d,c)})}function n(b,c){return b.sort(function(b,d){return a.rcompare(b,d,c)})}function o(a,b,c){return j(a,b,c)>0}function p(a,b,c){return j(a,b,c)<0}function q(a,b,c){return 0===j(a,b,c)}function r(a,b,c){return 0!==j(a,b,c)}function s(a,b,c){return j(a,b,c)>=0}function t(a,b,c){return j(a,b,c)<=0}function u(a,b,c,d){var e;switch(b){case"===":"object"==typeof a&&(a=a.version),"object"==typeof c&&(c=c.version),e=a===c;break;case"!==":"object"==typeof a&&(a=a.version),"object"==typeof c&&(c=c.version),e=a!==c;break;case"":case"=":case"==":e=q(a,c,d);break;case"!=":e=r(a,c,d);break;case">":e=o(a,c,d);break;case">=":e=s(a,c,d);break;case"<":e=p(a,c,d);break;case"<=":e=t(a,c,d);break;default:throw new TypeError("Invalid operator: "+b)}return e}function v(a,b){if(a instanceof v){if(a.loose===b)return a;a=a.value}return this instanceof v?(this.loose=b,this.parse(a),void(this.value=this.semver===Fb?"":this.operator+this.semver.version)):new v(a,b)}function w(a,b){if(a instanceof w&&a.loose===b)return a;if(!(this instanceof w))return new w(a,b);if(this.loose=b,this.raw=a,this.set=a.split(/\s*\|\|\s*/).map(function(a){return this.parseRange(a.trim())},this).filter(function(a){return a.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+a);this.format()}function x(a,b){return new w(a,b).set.map(function(a){return a.map(function(a){return a.value}).join(" ").trim().split(" ")})}function y(a,b){return a=C(a,b),a=A(a,b),a=E(a,b),a=G(a,b)}function z(a){return!a||"x"===a.toLowerCase()||"*"===a}function A(a,b){return a.trim().split(/\s+/).map(function(a){return B(a,b)}).join(" ")}function B(a,b){var c=b?P[qb]:P[pb];return a.replace(c,function(a,b,c,d,e){var f;return z(b)?f="":z(c)?f=">="+b+".0.0 <"+(+b+1)+".0.0":z(d)?f=">="+b+"."+c+".0 <"+b+"."+(+c+1)+".0":e?("-"!==e.charAt(0)&&(e="-"+e),f=">="+b+"."+c+"."+d+e+" <"+b+"."+(+c+1)+".0"):f=">="+b+"."+c+"."+d+" <"+b+"."+(+c+1)+".0",f})}function C(a,b){return a.trim().split(/\s+/).map(function(a){return D(a,b)}).join(" ")}function D(a,b){var c=b?P[vb]:P[ub];return a.replace(c,function(a,b,c,d,e){var f;return z(b)?f="":z(c)?f=">="+b+".0.0 <"+(+b+1)+".0.0":z(d)?f="0"===b?">="+b+"."+c+".0 <"+b+"."+(+c+1)+".0":">="+b+"."+c+".0 <"+(+b+1)+".0.0":e?("-"!==e.charAt(0)&&(e="-"+e),f="0"===b?"0"===c?">="+b+"."+c+"."+d+e+" <"+b+"."+c+"."+(+d+1):">="+b+"."+c+"."+d+e+" <"+b+"."+(+c+1)+".0":">="+b+"."+c+"."+d+e+" <"+(+b+1)+".0.0"):f="0"===b?"0"===c?">="+b+"."+c+"."+d+" <"+b+"."+c+"."+(+d+1):">="+b+"."+c+"."+d+" <"+b+"."+(+c+1)+".0":">="+b+"."+c+"."+d+" <"+(+b+1)+".0.0",f})}function E(a,b){return a.split(/\s+/).map(function(a){return F(a,b)}).join(" ")}function F(a,b){a=a.trim();var c=b?P[lb]:P[kb];return a.replace(c,function(a,b,c,d,e){var f=z(c),g=f||z(d),h=g||z(e),i=h;return"="===b&&i&&(b=""),f?a=">"===b||"<"===b?"<0.0.0":"*":b&&i?(g&&(d=0),h&&(e=0),">"===b?(b=">=",g?(c=+c+1,d=0,e=0):h&&(d=+d+1,e=0)):"<="===b&&(b="<",g?c=+c+1:d=+d+1),a=b+c+"."+d+"."+e):g?a=">="+c+".0.0 <"+(+c+1)+".0.0":h&&(a=">="+c+"."+d+".0 <"+c+"."+(+d+1)+".0"),a})}function G(a){return a.trim().replace(P[Cb],"")}function H(a,b,c,d,e,f,g,h,i,j,k,l){return b=z(c)?"":z(d)?">="+c+".0.0":z(e)?">="+c+"."+d+".0":">="+b,h=z(i)?"":z(j)?"<"+(+i+1)+".0.0":z(k)?"<"+i+"."+(+j+1)+".0":l?"<="+i+"."+j+"."+k+"-"+l:"<="+h,(b+" "+h).trim()}function I(a,b){for(var c=0;c0){var d=a[c].semver;if(d.major===b.major&&d.minor===b.minor&&d.patch===b.patch)return!0}}return!1}return!0}function J(a,b,c){try{b=new w(b,c)}catch(d){return!1}return b.test(a)}function K(a,b,c){return a.filter(function(a){return J(a,b,c)}).sort(function(a,b){return l(a,b,c)})[0]||null}function L(a,b){try{return new w(a,b).range||"*"}catch(c){return null}}function M(a,b,c){return O(a,b,"<",c)}function N(a,b,c){return O(a,b,">",c)}function O(a,b,c,d){a=new f(a,d),b=new w(b,d);var e,g,h,i,j;switch(c){case">":e=o,g=t,h=p,i=">",j=">=";break;case"<":e=p,g=s,h=o,i="<",j="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(J(a,b,d))return!1;for(var k=0;k)?=?)";var gb=R++;Q[gb]=Q[T]+"|x|X|\\*";var hb=R++;Q[hb]=Q[S]+"|x|X|\\*";var ib=R++;Q[ib]="[v=\\s]*("+Q[hb]+")(?:\\.("+Q[hb]+")(?:\\.("+Q[hb]+")(?:"+Q[Z]+")?"+Q[ab]+"?)?)?";var jb=R++;Q[jb]="[v=\\s]*("+Q[gb]+")(?:\\.("+Q[gb]+")(?:\\.("+Q[gb]+")(?:"+Q[$]+")?"+Q[ab]+"?)?)?";var kb=R++;Q[kb]="^"+Q[fb]+"\\s*"+Q[ib]+"$";var lb=R++;Q[lb]="^"+Q[fb]+"\\s*"+Q[jb]+"$";var mb=R++;Q[mb]="(?:~>?)";var nb=R++;Q[nb]="(\\s*)"+Q[mb]+"\\s+",P[nb]=new RegExp(Q[nb],"g");var ob="$1~",pb=R++;Q[pb]="^"+Q[mb]+Q[ib]+"$";var qb=R++;Q[qb]="^"+Q[mb]+Q[jb]+"$";var rb=R++;Q[rb]="(?:\\^)";var sb=R++;Q[sb]="(\\s*)"+Q[rb]+"\\s+",P[sb]=new RegExp(Q[sb],"g");var tb="$1^",ub=R++;Q[ub]="^"+Q[rb]+Q[ib]+"$";var vb=R++;Q[vb]="^"+Q[rb]+Q[jb]+"$";var wb=R++;Q[wb]="^"+Q[fb]+"\\s*("+db+")$|^$";var xb=R++;Q[xb]="^"+Q[fb]+"\\s*("+cb+")$|^$";var yb=R++;Q[yb]="(\\s*)"+Q[fb]+"\\s*("+db+"|"+Q[ib]+")",P[yb]=new RegExp(Q[yb],"g");var zb="$1$2$3",Ab=R++;Q[Ab]="^\\s*("+Q[ib]+")\\s+-\\s+("+Q[ib]+")\\s*$";var Bb=R++;Q[Bb]="^\\s*("+Q[jb]+")\\s+-\\s+("+Q[jb]+")\\s*$";var Cb=R++;Q[Cb]="(<|>)?=?\\s*\\*";for(var Db=0;R>Db;Db++)P[Db]||(P[Db]=new RegExp(Q[Db]));a.parse=c,a.valid=d,a.clean=e,a.SemVer=f,f.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},f.prototype.inspect=function(){return''},f.prototype.toString=function(){return this.version},f.prototype.compare=function(a){return a instanceof f||(a=new f(a,this.loose)),this.compareMain(a)||this.comparePre(a)},f.prototype.compareMain=function(a){return a instanceof f||(a=new f(a,this.loose)),h(this.major,a.major)||h(this.minor,a.minor)||h(this.patch,a.patch)},f.prototype.comparePre=function(a){if(a instanceof f||(a=new f(a,this.loose)),this.prerelease.length&&!a.prerelease.length)return-1;if(!this.prerelease.length&&a.prerelease.length)return 1;if(!this.prerelease.length&&!a.prerelease.length)return 0;var b=0;do{var c=this.prerelease[b],d=a.prerelease[b];if(void 0===c&&void 0===d)return 0;if(void 0===d)return 1;if(void 0===c)return-1;if(c!==d)return h(c,d)}while(++b)},f.prototype.inc=function(a,b){switch(a){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",b);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",b);break;case"prepatch":this.prerelease.length=0,this.inc("patch",b),this.inc("pre",b);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",b),this.inc("pre",b);break;case"major":(0!==this.minor||0!==this.patch||0===this.prerelease.length)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(0!==this.patch||0===this.prerelease.length)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var c=this.prerelease.length;--c>=0;)"number"==typeof this.prerelease[c]&&(this.prerelease[c]++,c=-2);-1===c&&this.prerelease.push(0)}b&&(this.prerelease[0]===b?isNaN(this.prerelease[1])&&(this.prerelease=[b,0]):this.prerelease=[b,0]);break;default:throw new Error("invalid increment argument: "+a)}return this.format(),this},a.inc=g,a.compareIdentifiers=h;var Eb=/^[0-9]+$/;a.rcompareIdentifiers=i,a.compare=j,a.compareLoose=k,a.rcompare=l,a.sort=m,a.rsort=n,a.gt=o,a.lt=p,a.eq=q,a.neq=r,a.gte=s,a.lte=t,a.cmp=u,a.Comparator=v;var Fb={};v.prototype.parse=function(a){var b=this.loose?P[wb]:P[xb],c=a.match(b);if(!c)throw new TypeError("Invalid comparator: "+a);this.operator=c[1],"="===this.operator&&(this.operator=""),this.semver=c[2]?new f(c[2],this.loose):Fb},v.prototype.inspect=function(){return''},v.prototype.toString=function(){return this.value},v.prototype.test=function(a){return this.semver===Fb?!0:("string"==typeof a&&(a=new f(a,this.loose)),u(a,this.operator,this.semver,this.loose))},a.Range=w,w.prototype.inspect=function(){return''},w.prototype.format=function(){return this.range=this.set.map(function(a){return a.join(" ").trim()}).join("||").trim(),this.range},w.prototype.toString=function(){return this.range},w.prototype.parseRange=function(a){var b=this.loose;a=a.trim();var c=b?P[Bb]:P[Ab];a=a.replace(c,H),a=a.replace(P[yb],zb),a=a.replace(P[nb],ob),a=a.replace(P[sb],tb),a=a.split(/\s+/).join(" ");var d=b?P[wb]:P[xb],e=a.split(" ").map(function(a){return y(a,b)}).join(" ").split(/\s+/);return this.loose&&(e=e.filter(function(a){return!!a.match(d)})),e=e.map(function(a){return new v(a,b)})},a.toComparators=x,w.prototype.test=function(a){if(!a)return!1;"string"==typeof a&&(a=new f(a,this.loose));for(var b=0;bd;){var f=d+e>>>1;c(a[f],b)>0?d=f+1:e=f}return d}"function"==typeof define&&define.amd?define("sortedindex-compare",[],function(){return d}):"undefined"!=typeof c?("undefined"!=typeof b&&b.exports&&(c=b.exports=d),c.sortedIndex=d):a.sortedIndex=d}(this)},{}],16:[function(a,b){function c(){}function d(a){var b={}.toString.call(a);switch(b){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function e(){if(q.XMLHttpRequest&&("file:"!=q.location.protocol||!q.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){}return!1}function f(a){return a===Object(a)}function g(a){if(!f(a))return a;var b=[];for(var c in a)null!=a[c]&&b.push(encodeURIComponent(c)+"="+encodeURIComponent(a[c]));return b.join("&")}function h(a){for(var b,c,d={},e=a.split("&"),f=0,g=e.length;g>f;++f)c=e[f],b=c.split("="),d[decodeURIComponent(b[0])]=decodeURIComponent(b[1]);return d}function i(a){var b,c,d,e,f=a.split(/\r?\n/),g={};f.pop();for(var h=0,i=f.length;i>h;++h)c=f[h],b=c.indexOf(":"),d=c.slice(0,b).toLowerCase(),e=r(c.slice(b+1)),g[d]=e;return g}function j(a){return a.split(/ *; */).shift()}function k(a){return p(a.split(/ *; */),function(a,b){var c=b.split(/ *= */),d=c.shift(),e=c.shift();return d&&e&&(a[d]=e),a},{})}function l(a,b){b=b||{},this.req=a,this.xhr=this.req.xhr,this.text=this.xhr.responseText,this.setStatusProperties(this.xhr.status),this.header=this.headers=i(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text):null}function m(a,b){var c=this;o.call(this),this._query=this._query||[],this.method=a,this.url=b,this.header={},this._header={},this.on("end",function(){try{var b=new l(c);"HEAD"==a&&(b.text=null),c.callback(null,b)}catch(d){var e=new Error("Parser is unable to parse the response");e.parse=!0,e.original=d,c.callback(e)}})}function n(a,b){return"function"==typeof b?new m("GET",a).end(b):1==arguments.length?new m("GET",a):new m(a,b)}var o=a("emitter"),p=a("reduce"),q="undefined"==typeof window?this:window,r="".trim?function(a){return a.trim()}:function(a){return a.replace(/(^\s*|\s*$)/g,"")};n.serializeObject=g,n.parseString=h,n.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},n.serialize={"application/x-www-form-urlencoded":g,"application/json":JSON.stringify},n.parse={"application/x-www-form-urlencoded":h,"application/json":JSON.parse},l.prototype.get=function(a){return this.header[a.toLowerCase()]},l.prototype.setHeaderProperties=function(){var a=this.header["content-type"]||"";this.type=j(a);var b=k(a);for(var c in b)this[c]=b[c]},l.prototype.parseBody=function(a){var b=n.parse[this.type];return b&&a&&a.length?b(a):null},l.prototype.setStatusProperties=function(a){var b=a/100|0;this.status=a,this.statusType=b,this.info=1==b,this.ok=2==b,this.clientError=4==b,this.serverError=5==b,this.error=4==b||5==b?this.toError():!1,this.accepted=202==a,this.noContent=204==a||1223==a,this.badRequest=400==a,this.unauthorized=401==a,this.notAcceptable=406==a,this.notFound=404==a,this.forbidden=403==a},l.prototype.toError=function(){var a=this.req,b=a.method,c=a.url,d="cannot "+b+" "+c+" ("+this.status+")",e=new Error(d);return e.status=this.status,e.method=b,e.url=c,e},n.Response=l,o(m.prototype),m.prototype.use=function(a){return a(this),this},m.prototype.timeout=function(a){return this._timeout=a,this},m.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},m.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},m.prototype.set=function(a,b){if(f(a)){for(var c in a)this.set(c,a[c]);return this}return this._header[a.toLowerCase()]=b,this.header[a]=b,this},m.prototype.unset=function(a){return delete this._header[a.toLowerCase()],delete this.header[a],this},m.prototype.getHeader=function(a){return this._header[a.toLowerCase()]},m.prototype.type=function(a){return this.set("Content-Type",n.types[a]||a),this},m.prototype.accept=function(a){return this.set("Accept",n.types[a]||a),this},m.prototype.auth=function(a,b){var c=btoa(a+":"+b);return this.set("Authorization","Basic "+c),this},m.prototype.query=function(a){return"string"!=typeof a&&(a=g(a)),a&&this._query.push(a),this},m.prototype.field=function(a,b){return this._formData||(this._formData=new FormData),this._formData.append(a,b),this},m.prototype.attach=function(a,b,c){return this._formData||(this._formData=new FormData),this._formData.append(a,b,c),this},m.prototype.send=function(a){var b=f(a),c=this.getHeader("Content-Type");if(b&&f(this._data))for(var d in a)this._data[d]=a[d];else"string"==typeof a?(c||this.type("form"),c=this.getHeader("Content-Type"),this._data="application/x-www-form-urlencoded"==c?this._data?this._data+"&"+a:a:(this._data||"")+a):this._data=a;return b?(c||this.type("json"),this):this},m.prototype.callback=function(a,b){var c=this._callback;return 2==c.length?c(a,b):a?this.emit("error",a):void c(b)},m.prototype.crossDomainError=function(){var a=new Error("Origin is not allowed by Access-Control-Allow-Origin");a.crossDomain=!0,this.callback(a)},m.prototype.timeoutError=function(){var a=this._timeout,b=new Error("timeout of "+a+"ms exceeded");b.timeout=a,this.callback(b)},m.prototype.withCredentials=function(){return this._withCredentials=!0,this},m.prototype.end=function(a){var b=this,f=this.xhr=e(),g=this._query.join("&"),h=this._timeout,i=this._formData||this._data;if(this._callback=a||c,f.onreadystatechange=function(){return 4==f.readyState?0==f.status?b.aborted?b.timeoutError():b.crossDomainError():void b.emit("end"):void 0},f.upload&&(f.upload.onprogress=function(a){a.percent=a.loaded/a.total*100,b.emit("progress",a)}),h&&!this._timer&&(this._timer=setTimeout(function(){b.abort()},h)),g&&(g=n.serializeObject(g),this.url+=~this.url.indexOf("?")?"&"+g:"?"+g),f.open(this.method,this.url,!0),this._withCredentials&&(f.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof i&&!d(i)){var j=n.serialize[this.getHeader("Content-Type")];j&&(i=j(i))}for(var k in this.header)null!=this.header[k]&&f.setRequestHeader(k,this.header[k]);return this.emit("request",this),f.send(i),this},n.Request=m,n.get=function(a,b,c){var d=n("GET",a);return"function"==typeof b&&(c=b,b=null),b&&d.query(b),c&&d.end(c),d},n.head=function(a,b,c){var d=n("HEAD",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},n.del=function(a,b){var c=n("DELETE",a);return b&&c.end(b),c},n.patch=function(a,b,c){var d=n("PATCH",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},n.post=function(a,b,c){var d=n("POST",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},n.put=function(a,b,c){var d=n("PUT",a);return"function"==typeof b&&(c=b,b=null),b&&d.send(b),c&&d.end(c),d},b.exports=n},{emitter:17,reduce:18}],17:[function(a,b){function c(a){return a?d(a):void 0}function d(a){for(var b in c.prototype)a[b]=c.prototype[b];return a}b.exports=c,c.prototype.on=c.prototype.addEventListener=function(a,b){return this._callbacks=this._callbacks||{},(this._callbacks[a]=this._callbacks[a]||[]).push(b),this},c.prototype.once=function(a,b){function c(){d.off(a,c),b.apply(this,arguments)}var d=this;return this._callbacks=this._callbacks||{},c.fn=b,this.on(a,c),this},c.prototype.off=c.prototype.removeListener=c.prototype.removeAllListeners=c.prototype.removeEventListener=function(a,b){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var c=this._callbacks[a];if(!c)return this;if(1==arguments.length)return delete this._callbacks[a],this;for(var d,e=0;ed;++d)c[d].apply(this,b)}return this},c.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks[a]||[]},c.prototype.hasListeners=function(a){return!!this.listeners(a).length}},{}],18:[function(a,b){b.exports=function(a,b,c){for(var d=0,e=a.length,f=3==arguments.length?c:a[d++];e>d;)f=b.call(null,f,a[d],++d,a);return f}},{}],19:[function(a){var b,c,d,e,f;e=a("ractive"),a("ractive-transitions-fade"),a("ractive-ractive"),a("./models/projects.coffee"),b=a("./views/header.coffee"),d=a("./views/notify.coffee"),c=a("./views/icons.coffee"),f=a("./modules/router.coffee"),new e({template:a("./templates/app.html"),el:"body",components:{Header:b,Notify:d,Icons:c},onrender:function(){return f.init("/")}})},{"./models/projects.coffee":22,"./modules/router.coffee":31,"./templates/app.html":33,"./views/header.coffee":51,"./views/icons.coffee":53,"./views/notify.coffee":54,ractive:13,"ractive-ractive":11,"ractive-transitions-fade":12}],20:[function(a,b){var c;c=a("../utils/ractive/model.coffee"),b.exports=new c({name:"models/config",data:{firebase:"burnchart",provider:"github",fields:{milestone:["closed_issues","created_at","description","due_on","number","open_issues","title","updated_at"]},chart:{off_days:[],size_label:/^size (\d+)$/,points:"ONE_SIZE"},request:{timeout:5e3}}})},{"../utils/ractive/model.coffee":49}],21:[function(a,b){var c,d,e,f;c=a("firebase"),d=a("../utils/ractive/model.coffee"),f=a("./user.coffee"),e=a("./config.coffee"),b.exports=new d({name:"models/firebase",login:function(a){return this.data.client||a("Not ready yet"),this.data.client.authWithOAuthPopup("github",function(a){return function(b,c){return b?a.publish("!app/notify",{text:b.toString(),type:"alert",system:!0}):a.onAuth(c)}}(this),{rememberMe:!0,scope:"private_repo"})},onAuth:function(a){return f.set(a),f.set("ready",!0)},logout:function(){throw"Implement"},onrender:function(){var a;return this.set("client",a=new c("https://"+e.data.firebase+".firebaseio.com")),a.onAuth(this.onAuth)}})},{"../utils/ractive/model.coffee":49,"./config.coffee":20,"./user.coffee":24,firebase:6}],22:[function(a,b){var c,d,e,f,g,h,i,j,k=[].slice;j=a("lodash"),e=a("lscache"),g=a("sortedindex-compare"),f=a("semver"),c=a("../utils/ractive/model.coffee"),d=a("../models/config.coffee"),h=a("../modules/stats.coffee"),i=a("./user.coffee"),b.exports=new c({name:"models/projects",data:{sortBy:"priority",sortFns:["progress","priority","name"]},comparator:function(){var a,b,c,d,e;switch(e=this.data,c=e.list,d=e.sortBy,a=function(a){return function(b){return function(){var d,e,f,g;return g=arguments[0],f=2<=arguments.length?k.call(arguments,1):[],d=g[0],e=g[1],b.apply(a,[[c[d],c[d].milestones[e]]].concat(f))}}}(this),b=function(a,b){var c,d,e,f,g,h,i,j,k,l;for(l=[],j=0,k=a.length;k>j;j++)d=a[j],l.push(function(){var a;a=[];for(e in b)i=b[e],h=d,a.push(function(){var a,b,d,j;for(d=f=e.split("."),j=[],c=a=0,b=d.length;b>a;c=++a)g=d[c],j.push(c===f.length-1?null!=h[g]?h[g]:h[g]=i:h=null!=h[g]?h[g]:h[g]={});return j}());return a}());return l},d){case"progress":return a(function(a,c){var d,e,f,g;return e=a[0],d=a[1],g=c[0],f=c[1],b([d,f],{"stats.progress.points":0}),d.stats.progress.points-f.stats.progress.points});case"priority":return a(function(a,c){var d,e,f,g,h,i,k;return g=a[0],f=a[1],i=c[0],h=c[1],b([f,h],{"stats.progress.time":0,"stats.days":1e3}),k=j.map([f,h],function(a){var b;return b=a.stats,(b.progress.points-b.progress.time)*b.days}),d=k[0],e=k[1],e-d});case"name":return a(function(a,b){var c,d,e,g,h,i;return d=a[0],c=a[1],g=b[0],e=b[1],(i=g.owner.localeCompare(d.owner))?i:(h=g.name.localeCompare(d.name))?h:f.valid(e.title)&&f.valid(c.title)?f.gt(e.title,c.title):e.title.localeCompare(c.title)});default:return function(){return 0}}},find:function(a){return j.find(this.data.list,a)},exists:function(){return!!this.find.apply(this,arguments)},add:function(a){return this.exists(a)?void 0:this.push("list",a)},findIndex:function(a){var b,c;return c=a.owner,b=a.name,j.findIndex(this.data.list,{owner:c,name:b})},addMilestone:function(a,b){var c,d;if(j.extend(b,{stats:h(b)}),(c=this.findIndex(a))<0)throw 500;return null!=a.milestones?(this.push("list."+c+".milestones",b),d=this.data.list[c].milestones.length-1):(this.set("list."+c+".milestones",[b]),d=0),this.sort([c,d],[a,b])},saveError:function(a,b){var c;if((c=this.findIndex(a))>-1)return null!=a.errors?this.push("list."+c+".errors",b):this.set("list."+c+".errors",[b]);throw 500},demo:function(){return this.set({list:[{owner:"mbostock",name:"d3"},{owner:"medic",name:"medic-webapp"},{owner:"ractivejs",name:"ractive"},{owner:"radekstepan",name:"disposable"},{owner:"rails",name:"rails"},{owner:"rails",name:"spring"}],index:[]})},clear:function(){return this.set({list:[],index:[]})},sort:function(a,b){var c,d,e,f,h,i,j,k,l,m,n,o;if(e=this.data.index||[],a)d=g(e,b,this.comparator()),e.splice(d,0,a);else for(n=this.data.list,c=j=0,l=n.length;l>j;c=++j)if(i=n[c],null!=i.milestones)for(o=i.milestones,f=k=0,m=o.length;m>k;f=++k)h=o[f],d=g(e,[i,h],this.comparator()),e.splice(d,0,[c,f]);return this.set("index",e)},onconstruct:function(){return this.subscribe("!projects/add",this.add,this),this.subscribe("!projects/demo",this.demo,this)},onrender:function(){return this.set("list",e.get("projects")||[]),this.observe("list",function(a){return e.set("projects",j.pluckMany(a,["owner","name"]))},{init:!1}),this.observe("sortBy",function(){return this.set("index",null),this.sort()},{init:!1})}})},{"../models/config.coffee":20,"../modules/stats.coffee":32,"../utils/ractive/model.coffee":49,"./user.coffee":24,lodash:7,lscache:8,semver:14,"sortedindex-compare":15}],23:[function(a,b){var c,d,e,f;c=a("../utils/ractive/model.coffee"),f=new c({name:"models/system",data:{loading:!1}}),e=0,d=function(){return e+=1,f.set("loading",!0),function(){return e-=1,f.set("loading",+e)}},b.exports={system:f,async:d}},{"../utils/ractive/model.coffee":49}],24:[function(a,b){var c;c=a("../utils/ractive/model.coffee"),b.exports=new c({name:"models/user"})},{"../utils/ractive/model.coffee":49}],25:[function(a,b){var c;c=a("d3"),b.exports={horizontal:function(a,b){return c.svg.axis().scale(b).orient("bottom").tickSize(-a).tickFormat(function(a){return a.getDate()}).tickPadding(10)},vertical:function(a,b){return c.svg.axis().scale(b).orient("left").tickSize(-a).ticks(5).tickPadding(10)}}},{d3:4}],26:[function(a,b){var c,d,e,f,g=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};f=a("lodash"),d=a("d3"),e=a("moment"),c=a("../../models/config.coffee"),b.exports={actual:function(a,b,c){var g,h,i,j,k;return g=[{date:e(b).toJSON(),points:c}],i=+1/0,h=-1/0,k=f.map(a,function(a){var b,d;return d=a.size,b=a.closed_at,i>d&&(i=d),d>h&&(h=d),a.date=e(b).toJSON(),a.points=c-=d,a}),j=d.scale.linear().domain([i,h]).range([5,8]),k=f.map(k,function(a){return a.radius=j(a.size),a}),[].concat(g,k)},ideal:function(a,b,d){var h,i,j,k,l,m;return a>b&&(m=[a,b],b=m[0],a=m[1]),a=e(a),b=null!=b?e(b):e.utc(),h=[],i=0,(k=function(d){var e,f;return e=a.add(1,"days"),(f=e.weekday())||(f=7),g.call(c.data.chart.off_days,f)>=0?h.push({date:e.toJSON(),off_day:!0}):(i+=1,h.push({date:e.toJSON()})),e>b?void 0:k(d+1)})(0),l=d/(i-1),h=f.map(h,function(a,b){return a.points=d,h[b]&&!h[b].off_day&&(d-=l),a}),(j=e.utc())>b&&h.push({date:j.toJSON(),points:0}),h},trend:function(a,b,c){var d,g,h,i,j,k,l,m,n,o,p,q,r,s;return a.length?(k=a[0],o=a[a.length-1],r=e(k.date),s=f.map(a,function(a){var b,c;return b=a.date,c=a.points,[e(b).diff(r),c]}),p=e.utc(),s.push([p.diff(r),o.points]),h=0,j=0,i=0,d=(n=s.length)*f.reduce(s,function(a,b){var c,d;return c=b[0],d=b[1],h+=c,j+=d,i+=Math.pow(c,2),a+c*d},0),q=(d-h*j)/(n*i-Math.pow(h,2)),m=(j-q*h)/n,l=function(a){return q*a+m},b=e(b),c?(c=e(c),p>c&&(c=p)):c=p,d=b.diff(r),g=c.diff(r),[{date:b.toJSON(),points:l(d)},{date:c.toJSON(),points:l(g)}]):[]}}},{"../../models/config.coffee":20,d3:4,lodash:7,moment:10}],27:[function(a,b){var c,d,e,f,g,h;h=a("lodash"),c=a("async"),e=a("../../models/config.coffee"),g=a("./request.coffee"),b.exports={fetchAll:function(a,b){return c.parallel([h.partial(f,a,"open"),h.partial(f,a,"closed")],function(a,c){var d,e;return e=c[0],d=c[1],b(a,{open:e,closed:d})})}},d=function(a){var b,c,d,f;switch(e.data.chart.points){case"ONE_SIZE":for(c=a.length,d=0,f=a.length;f>d;d++)b=a[d],b.size=1;break;case"LABELS":c=0,a=h.filter(a,function(a){var b;return(b=a.labels)?(a.size=h.reduce(b,function(a,b){var c;return(c=b.name.match(e.data.chart.size_label))?a+=parseInt(c[1]):a},0),c+=a.size,!!a.size):!1});break;default:throw 500}return{list:a,size:c}},f=function(a,b,c){var e,f,i;return i=[],e=function(a){return a?c(a):c(null,d(h.sortBy(i,"closed_at")))},(f=function(c){return g.allIssues(a,{state:b,page:c},function(a,b){return a?e(a):b.length?(i=i.concat(b),b.length<100?e(null,i):f(c+1)):e(null,i)})})(1)}},{"../../models/config.coffee":20,"./request.coffee":29,async:1,lodash:7}],28:[function(a,b){var c;c=a("./request.coffee"),b.exports={fetch:c.oneMilestone,fetchAll:c.allMilestones}},{"./request.coffee":29}],29:[function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;o=a("lodash"),m=a("superagent"),a("../../utils/mixins.coffee"),c=a("../../models/config.coffee"),n=a("../../models/user.coffee"),m.parse={"application/json":function(a){var b;try{return JSON.parse(a)}catch(c){return b=c,{}}}},d={github:{host:"api.github.com",protocol:"https"}},b.exports={repo:function(a,b){var c,e;return e=a.owner,c=a.name,h({owner:e,name:c})?i(function(){var a;return a=o.defaults({path:"/repos/"+e+"/"+c,headers:f(n.data.accessToken)},d.github),j(a,b)}):b("Request is malformed")},allMilestones:function(a,b){var c,e;return e=a.owner,c=a.name,h({owner:e,name:c})?i(function(){var a;return a=o.defaults({path:"/repos/"+e+"/"+c+"/milestones",query:{state:"open",sort:"due_date",direction:"asc"},headers:f(n.data.accessToken)},d.github),j(a,b)}):b("Request is malformed")},oneMilestone:function(a,b){var c,e,g;return g=a.owner,e=a.name,c=a.milestone,h({owner:g,name:e,milestone:c})?i(function(){var a;return a=o.defaults({path:"/repos/"+g+"/"+e+"/milestones/"+c,query:{state:"open",sort:"due_date",direction:"asc"},headers:f(n.data.accessToken)},d.github),j(a,b)}):b("Request is malformed")},allIssues:function(a,b,c){var e,g,k;return k=a.owner,g=a.name,e=a.milestone,h({owner:k,name:g,milestone:e})?i(function(){var a;return a=o.defaults({path:"/repos/"+k+"/"+g+"/issues",query:o.extend(b,{milestone:e,per_page:"100"}),headers:f(n.data.accessToken)},d.github),j(a,c)}):c("Request is malformed")}},j=function(a,b){var d,e,f,g,h,i,j,l,n,o,p;i=a.protocol,f=a.host,h=a.path,l=a.query,e=a.headers,d=!1,j=l?"?"+function(){var a;a=[];for(g in l)p=l[g],a.push(""+g+"="+p);return a}().join("&"):"",n=m.get(""+i+"://"+f+h+j);for(g in e)p=e[g],n.set(g,p);return o=setTimeout(function(){return d=!0,b("Request has timed out")},c.data.request.timeout),n.end(function(a,c){return d?void 0:(d=!0,clearTimeout(o),k(a,c,b)) -})},k=function(a,b,c){var d;return a?c(e(a)):2!==b.statusType?c(null!=(null!=b&&null!=(d=b.body)?d.message:void 0)?b.body.message:b.error.message):c(null,b.body)},f=function(a){var b;return b={"Content-Type":"application/json",Accept:"application/vnd.github.v3"},null!=a&&(b.Authorization="token "+a),b},h=function(a){var b,c,d;c={owner:function(a){return null!=a},name:function(a){return null!=a},milestone:function(a){return o.isInt(a)}};for(b in a)if(d=a[b],b in c&&!c[b](d))return!1;return!0},g=n.data.ready,l=[],i=function(a){return g?a():l.push(a)},n.observe("ready",function(a){var b;if(g=a,a){for(b=[];l.length;)b.push(l.shift()());return b}}),e=function(a){var b;switch(!1){case!o.isString(a):b=a;break;case!o.isArray(a):b=a[1];break;case!(o.isObject(a)&&o.isString(a.message)):b=a.message}if(!b)try{b=JSON.stringify(a)}catch(c){b=a.toString()}return b}},{"../../models/config.coffee":20,"../../models/user.coffee":24,"../../utils/mixins.coffee":47,lodash:7,superagent:16}],30:[function(a,b){var c,d;d=a("ractive"),c=d.extend({}),b.exports=new c},{ractive:13}],31:[function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=[].slice;m=a("lodash"),e=a("director"),g=a("./mediator.coffee"),k=a("../models/system.coffee"),f="#page",h={index:a("../views/pages/index.coffee"),milestone:a("../views/pages/milestone.coffee"),"new":a("../views/pages/new.coffee"),project:a("../views/pages/project.coffee")},c=function(a,b,c){return g.fire("!projects/add",{owner:b,name:c})},d=function(a,b){var c,d,e,f;for(null==b&&(b=[]),f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(m.partial(c,a));return f},l=null,i=function(){var a,b,c;return c=arguments[0],b=2<=arguments.length?n.call(arguments,1):[],null!=l&&l.teardown(),g.fire("!app/notify/hide"),a=h[c],l=new a({el:f,data:{route:b}})},j={"/":d("index",[i]),"/new/project":d("new",[i]),"/:owner/:name":d("project",[c,i]),"/:owner/:name/:milestone":d("milestone",[c,i]),"/demo":function(){return g.fire("!projects/demo"),window.location.hash="#"}},b.exports=e.Router(j).configure({strict:!1,notfound:function(){throw 404}})},{"../models/system.coffee":23,"../views/pages/index.coffee":55,"../views/pages/milestone.coffee":56,"../views/pages/new.coffee":57,"../views/pages/project.coffee":58,"./mediator.coffee":30,director:5,lodash:7}],32:[function(a,b){var c,d;c=a("moment"),d=function(a,b){return a+b===0?0:100*(a/(b+a))},b.exports=function(a){var b,e,f,g,h,i,j,k,l,m;return null!=a.stats?a.stats:(h=!1,j=!0,k=!1,i=!0,l=0,b=a.issues.closed.size,e=a.issues.open.size,b+e>0&&(i=!1,l=d(b,e),100===l&&(h=!0)),null==a.due_on?{isOverdue:k,isOnTime:j,isDone:h,isEmpty:i,progress:{points:l}}:(b=+new Date(a.created_at),e=+new Date,f=+new Date(a.due_on),e>f&&(k=!0),m=d(e-b,f-e),g=c(e).diff(c(b),"days")/100,j=l>m,{isDone:h,days:g,isOnTime:j,isOverdue:k,progress:{points:l,time:m}}))}},{moment:10}],33:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"app"},f:[{t:7,e:"Notify"}," ",{t:7,e:"Header"}," ",{t:7,e:"div",a:{id:"page"},f:[]}," ",{t:7,e:"div",a:{id:"footer"},f:[{t:7,e:"div",a:{"class":"wrap"},f:["© 2012-2014 ",{t:7,e:"a",a:{href:"https://assembly.com/burnchart"},f:["Made with ",{t:7,e:"Icons",a:{icon:"heart"}}," on Assembly"]}]}]}]}]}},{}],34:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"chart"}}]}},{}],35:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"head"},f:[{t:4,n:53,r:"user",f:[{t:4,r:"ready",f:[{t:7,e:"div",a:{"class":"right"},t1:"fade",f:[{t:4,r:"uid",f:[{t:2,r:"github.displayName"}," logged in"]},{t:4,n:51,f:[{t:7,e:"a",a:{"class":"github"},v:{click:"!login"},f:[{t:7,e:"Icons",a:{icon:"github"}}," Sign In"]}],r:"uid"}]}]}]}," ",{t:7,e:"a",a:{id:"icon",href:"#"},f:[{t:7,e:"Icons",a:{icon:[{t:2,r:"icon"}]}}]}," ",{t:7,e:"ul",f:[{t:7,e:"li",f:[{t:7,e:"a",a:{href:"#new/project","class":"add"},f:[{t:7,e:"Icons",a:{icon:"plus"}}," Add a Project"]}]}," ",{t:7,e:"li",f:[{t:7,e:"a",a:{href:"#demo"},f:[{t:7,e:"Icons",a:{icon:"computer"}}," See Examples"]}]}," ",{t:7,e:"li",f:[{t:7,e:"a",a:{href:"mailto:your-account@helpful.io","data-helpful":"burnchart","data-helpful-modal":"on"},f:[{t:7,e:"Icons",a:{icon:"help"}}," Contact"]}]}]}]}]}},{}],36:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"hero"},f:[{t:7,e:"div",a:{"class":"content"},f:[{t:7,e:"Icons",a:{icon:"direction"}}," ",{t:7,e:"h2",f:["See your project progress"]}," ",{t:7,e:"p",f:["Serious about a project deadline? Add your GitHub project and we'll tell you if it is running on time or not."]}," ",{t:7,e:"div",a:{"class":"cta"},f:[{t:7,e:"a",a:{href:"#new/project","class":"primary"},f:[{t:7,e:"Icons",a:{icon:"plus"}}," Add a Project"]}," ",{t:7,e:"a",a:{href:"#demo","class":"secondary"},f:[{t:7,e:"Icons",a:{icon:"computer"}}," See Examples"]}]}]}]}]}},{}],37:[function(a,b){b.exports={v:1,t:[{t:4,r:"code",f:[{t:7,e:"span",a:{"class":["icon ",{t:2,r:"icon"}]},f:[{t:3,x:{r:["code"],s:'"&#"+_0+";"'}}]}]}]}},{}],38:[function(a,b){b.exports={v:1,t:[{t:4,r:"text",f:[{t:4,r:"system",f:[{t:7,e:"div",a:{id:"notify","class":[{t:2,r:"type"}," system"],style:["top:",{t:2,r:"top"},"%"]},f:[{t:7,e:"Icons",a:{icon:[{t:2,r:"icon"}]}}," ",{t:7,e:"p",f:[{t:2,r:"text"}]}]}]},{t:4,n:51,f:[{t:7,e:"div",a:{id:"notify","class":[{t:2,r:"type"}],style:["top:",{t:2,x:{r:["top"],s:"-_0"}},"px"]},f:[{t:7,e:"span",a:{"class":"close"},v:{click:"close"}}," ",{t:7,e:"Icons",a:{icon:[{t:2,r:"icon"}]}}," ",{t:7,e:"p",f:[{t:2,r:"text"}]}]}],r:"system"}]}]}},{}],39:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"content","class":"wrap"},f:[{t:4,n:50,r:"projects.list",f:[{t:4,r:"ready",f:[{t:7,e:"div",t1:"fade",f:[{t:7,e:"Projects",a:{projects:[{t:2,r:"projects"}]}}]}]}]},{t:4,n:51,f:[{t:7,e:"Hero"}],r:"projects.list"}]}]}},{}],40:[function(a,b){b.exports={v:1,t:[{t:4,r:"ready",f:[{t:7,e:"div",t1:"fade",f:[{t:7,e:"div",a:{id:"title"},f:[{t:7,e:"div",a:{"class":"wrap"},f:[{t:7,e:"h2",a:{"class":"title"},f:[{t:2,x:{r:["format","milestone.title"],s:"_0.title(_1)"}}]}," ",{t:7,e:"span",a:{"class":"sub"},f:[{t:3,x:{r:["format","milestone.due_on"],s:"_0.due(_1)"}}]}," ",{t:7,e:"div",a:{"class":"description"},f:[{t:3,x:{r:["format","milestone.description"],s:"_0.markdown(_1)"}}]}]}]}," ",{t:7,e:"div",a:{id:"content","class":"wrap"},f:[{t:7,e:"Chart",a:{milestone:[{t:2,r:"milestone"}]}}]}]}]}]}},{}],41:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"content","class":"wrap"},f:[{t:7,e:"div",a:{id:"add"},f:[{t:7,e:"div",a:{"class":"header"},f:[{t:7,e:"h2",f:["Add a Project"]}," ",{t:7,e:"p",f:["Type the name of a GitHub repository that has some milestones with issues. ",{t:4,n:53,r:"user",f:[{t:4,r:"ready",f:[{t:4,r:"uid",f:["If you'd like to add a private GitHub repo, ",{t:7,e:"a",v:{click:"!login"},f:["Sign In"]}," first."],n:51}]}]}]}]}," ",{t:7,e:"div",a:{"class":"form"},f:[{t:7,e:"table",f:[{t:7,e:"tr",f:[{t:7,e:"td",f:[{t:7,e:"input",a:{type:"text",placeholder:"user/repo",autocomplete:"off",value:[{t:2,r:"value"}]},v:{keyup:{n:"submit",d:[{t:2,r:"value"}]}}}]}," ",{t:7,e:"td",f:[{t:7,e:"a",v:{click:{n:"submit",d:[{t:2,r:"value"}]}},f:["Add"]}]}]}]}]}," ",{t:7,e:"div",a:{"class":"protip"},f:[{t:7,e:"Icons",a:{icon:"rocket"}}," Protip: To see if a milestone is on track or not, make sure it has a due date assigned to it."]}]}]}]}},{}],42:[function(a,b){b.exports={v:1,t:[{t:4,r:"ready",f:[{t:7,e:"div",t1:"fade",f:[{t:7,e:"div",a:{id:"title"},f:[{t:7,e:"div",a:{"class":"wrap"},f:[{t:7,e:"h2",a:{"class":"title"},f:[{t:2,x:{r:["route"],s:'_0.join("/")'}}]}]}]}," ",{t:7,e:"div",a:{id:"content","class":"wrap"},f:[{t:7,e:"Milestones",a:{project:[{t:2,r:"project"}]}}]}]}]}]}},{}],43:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"projects"},f:[{t:7,e:"div",a:{"class":"header"},f:[{t:7,e:"a",a:{"class":"sort"},v:{click:"sortBy"},f:[{t:7,e:"Icons",a:{icon:"sort"}}," Sorted by ",{t:2,r:"projects.sortBy"}]}," ",{t:7,e:"h2",f:["Milestones"]}]}," ",{t:7,e:"table",f:[{t:4,r:"projects.index",f:[{t:4,x:{r:["."],s:"{index:_0}"},f:[{t:4,x:{r:["index.0","projects.list"],s:"{p:_1[_0]}"},f:[{t:4,n:50,x:{r:["p.owner","project.owner","p.name","project.name"],s:"_0==_1&&_2==_3"},f:[{t:4,x:{r:["index.1","project.milestones"],s:"{milestone:_1[_0]}"},f:[{t:7,e:"tr",a:{"class":[{t:4,n:50,r:"milestone.stats.isDone",f:["done"]}]},f:[{t:7,e:"td",f:[{t:7,e:"a",a:{"class":"milestone",href:["#",{t:2,r:"project.owner"},"/",{t:2,r:"project.name"},"/",{t:2,r:"milestone.number"}]},f:[{t:2,r:"milestone.title"}]}]}," ",{t:7,e:"td",a:{style:"width:1%"},f:[{t:7,e:"div",a:{"class":"progress"},f:[{t:7,e:"span",a:{"class":"percent"},f:[{t:2,x:{r:["milestone.stats.progress.points"],s:"Math.floor(_0)"}},"%"]}," ",{t:7,e:"span",a:{"class":["due ",{t:4,n:50,r:"milestone.stats.isOverdue",f:["red"]}]},f:[{t:3,x:{r:["format","milestone.due_on"],s:"_0.due(_1)"}}]}," ",{t:7,e:"div",a:{"class":"outer bar"},f:[{t:7,e:"div",a:{"class":["inner bar ",{t:2,x:{r:["milestone.stats.isOnTime"],s:'(_0)?"green":"red"'}}],style:["width:",{t:2,r:"milestone.stats.progress.points"},"%"]}}]}]}]}]}]}]}]}]}]}]}," ",{t:7,e:"div",a:{"class":"footer"},f:[]}]}]}},{}],44:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"projects"},f:[{t:7,e:"div",a:{"class":"header"},f:[{t:7,e:"a",a:{"class":"sort"},v:{click:"sortBy"},f:[{t:7,e:"Icons",a:{icon:"sort"}}," Sorted by ",{t:2,r:"projects.sortBy"}]}," ",{t:7,e:"h2",f:["Projects"]}]}," ",{t:7,e:"table",f:[{t:4,r:"projects.list",f:[{t:4,n:50,r:"errors",f:[{t:7,e:"tr",f:[{t:7,e:"td",a:{colspan:"3","class":"repo"},f:[{t:7,e:"div",a:{"class":"project"},f:[{t:2,r:"owner"},"/",{t:2,r:"name"}," ",{t:7,e:"span",a:{"class":"error",title:[{t:2,x:{r:["errors"],s:'_0.join("\\n")'}}]},f:[{t:7,e:"Icons",a:{icon:"warning"}}]}]}]}]}]}]}," ",{t:4,r:"projects.index",f:[{t:4,x:{r:["."],s:"{index:_0}"},f:[{t:4,x:{r:["index.0","projects.list"],s:"{project:_1[_0]}"},f:[{t:4,n:53,r:"project",f:[{t:4,x:{r:["index.1","project.milestones"],s:"{milestone:_1[_0]}"},f:[{t:7,e:"tr",a:{"class":[{t:4,n:50,r:"milestone.stats.isDone",f:["done"]}]},f:[{t:7,e:"td",a:{"class":"repo"},f:[{t:7,e:"a",a:{"class":"project",href:["#",{t:2,r:"owner"},"/",{t:2,r:"name"}]},f:[{t:2,r:"owner"},"/",{t:2,r:"name"}]}]}," ",{t:7,e:"td",f:[{t:7,e:"a",a:{"class":"milestone",href:["#",{t:2,r:"owner"},"/",{t:2,r:"name"},"/",{t:2,r:"milestone.number"}]},f:[{t:2,r:"milestone.title"}]}]}," ",{t:7,e:"td",a:{style:"width:1%"},f:[{t:7,e:"div",a:{"class":"progress"},f:[{t:7,e:"span",a:{"class":"percent"},f:[{t:2,x:{r:["milestone.stats.progress.points"],s:"Math.floor(_0)"}},"%"]}," ",{t:7,e:"span",a:{"class":["due ",{t:4,n:50,r:"milestone.stats.isOverdue",f:["red"]}]},f:[{t:3,x:{r:["format","milestone.due_on"],s:"_0.due(_1)"}}]}," ",{t:7,e:"div",a:{"class":"outer bar"},f:[{t:7,e:"div",a:{"class":["inner bar ",{t:2,x:{r:["milestone.stats.isOnTime"],s:'(_0)?"green":"red"'}}],style:["width:",{t:2,r:"milestone.stats.progress.points"},"%"]}}]}]}]}]}]}]}]}]}]}]}," ",{t:7,e:"div",a:{"class":"footer"},f:[]}]}]}},{}],45:[function(a,b){var c,d,e;e=a("lodash"),d=a("moment"),c=a("marked"),b.exports={fromNow:e.memoize(function(a){return d(new Date(a)).fromNow()}),due:function(a){return a?["due",this.fromNow(a)].join(" "):" "},markdown:function(a){return c(a)},title:function(a){return a.toLowerCase().indexOf("milestone")>-1?a:["Milestone",a].join(" ")},hexToDec:function(a){return parseInt(a,16)}}},{lodash:7,marked:9,moment:10}],46:[function(a,b){b.exports={is:function(a){var b;return"keyup"===(b=a.original.type)||"keydown"===b},isEnter:function(a){return 13===a.original.which}}},{}],47:[function(a){var b;b=a("lodash"),b.mixin({pluckMany:function(a,c){if(!b.isArray(c))throw"`keys` needs to be an Array";return b.map(a,function(a){var d;return d={},b.each(c,function(b){return d[b]=a[b]}),d})},isInt:function(a){return!isNaN(a)&&parseInt(Number(a))===a&&!isNaN(parseInt(a,10))}})},{lodash:7}],48:[function(a,b){var c,d,e;e=a("lodash"),c=a("ractive"),d=a("../../modules/mediator.coffee"),b.exports=c.extend({subscribe:function(a,b,c){return null==c&&(c=this),e.isArray(this._subs)||(this._subs=[]),e.isFunction(b)?this._subs.push(d.on(a,e.bind(b,c))):console.log("Warning: `cb` is not a function")},publish:function(){return d.fire.apply(d,arguments)},onteardown:function(){var a,b,c,d,f;if(e.isArray(this._subs)){for(d=this._subs,f=[],b=0,c=d.length;c>b;b++)a=d[b],f.push(e.isFunction(a.cancel)?a.cancel():console.log("Warning: `sub.cancel` is not a function"));return f}}})},{"../../modules/mediator.coffee":30,lodash:7,ractive:13}],49:[function(a,b){var c;c=a("./eventful.coffee"),b.exports=function(a){var b,d;return b=c.extend(a),d=new b,d.render(),d}},{"./eventful.coffee":48}],50:[function(a,b){var c,d,e,f;c=a("ractive"),e=a("d3"),a("d3-tip")(e),f=a("../modules/chart/lines.coffee"),d=a("../modules/chart/axes.coffee"),b.exports=c.extend({name:"views/chart",template:a("../templates/chart.html"),oncomplete:function(){var a,b,c,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;return o=this.data.milestone,i=o.issues,r=i.open.size+i.closed.size,c=i.closed.list[0].closed_at,i.length&&o.created_at>c&&(o.created_at=c),a=f.actual(i.closed.list,o.created_at,r),h=f.ideal(o.created_at,o.due_on,r),s=f.trend(a,o.created_at,o.due_on),y=this.el.getBoundingClientRect(),g=y.height,t=y.width,n={top:30,right:30,bottom:40,left:50},t-=n.left+n.right,g-=n.top+n.bottom,u=e.time.scale().range([0,t]),w=e.scale.linear().range([g,0]),v=d.horizontal(g,u),x=d.vertical(t,w),k=e.svg.line().interpolate("linear").x(function(a){return u(new Date(a.date))}).y(function(a){return w(a.points)}),b=h[0],j=h[h.length-1],u.domain([new Date(b.date),new Date(j.date)]),w.domain([0,b.points]).nice(),p=e.select(this.el.querySelector("#chart")).append("svg").attr("width",t+n.left+n.right).attr("height",g+n.top+n.bottom).append("g").attr("transform","translate("+n.left+","+n.top+")"),p.append("g").attr("class","x axis day").attr("transform","translate(0,"+g+")").call(v),l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],m=v.orient("top").tickSize(g).tickFormat(function(a){return l[a.getMonth()]}).ticks(2),p.append("g").attr("class","x axis month").attr("transform","translate(0,"+g+")").call(m),p.append("g").attr("class","y axis").call(x),p.append("svg:line").attr("class","today").attr("x1",u(new Date)).attr("y1",0).attr("x2",u(new Date)).attr("y2",g),p.append("path").attr("class","ideal line").attr("d",k.interpolate("linear")(h)),p.append("path").attr("class","trendline line").attr("d",k.interpolate("linear")(s)),p.append("path").attr("class","actual line").attr("d",k.interpolate("linear").y(function(a){return w(a.points)})(a)),q=e.tip().attr("class","d3-tip").html(function(a){var b,c;return b=a.number,c=a.title,"#"+b+": "+c}),p.call(q),p.selectAll("a.issue").data(a.slice(1)).enter().append("svg:a").attr("xlink:href",function(a){var b;return b=a.html_url}).attr("xlink:show","new").append("svg:circle").attr("cx",function(a){var b;return b=a.date,u(new Date(b))}).attr("cy",function(a){var b;return b=a.points,w(b)}).attr("r",function(a){var b;return b=a.radius,5}).on("mouseover",q.show).on("mouseout",q.hide)}})},{"../modules/chart/axes.coffee":25,"../modules/chart/lines.coffee":26,"../templates/chart.html":34,d3:4,"d3-tip":3,ractive:13}],51:[function(a,b){var c,d,e,f,g;d=a("ractive"),f=a("../models/system.coffee").system,e=a("../models/firebase.coffee"),g=a("../models/user.coffee"),c=a("./icons.coffee"),b.exports=d.extend({name:"views/header",template:a("../templates/header.html"),data:{user:g,icon:"fire"},components:{Icons:c},adapt:[d.adaptors.Ractive],onconstruct:function(){return this.on("!login",function(){return e.login()})},onrender:function(){return f.observe("loading",function(a){return function(b){return a.set("icon",b?"spinner":"fire")}}(this))}})},{"../models/firebase.coffee":21,"../models/system.coffee":23,"../models/user.coffee":24,"../templates/header.html":35,"./icons.coffee":53,ractive:13}],52:[function(a,b){var c,d;d=a("ractive"),c=a("./icons.coffee"),b.exports=d.extend({name:"views/hero",template:a("../templates/hero.html"),components:{Icons:c},adapt:[d.adaptors.Ractive]})},{"../templates/hero.html":36,"./icons.coffee":53,ractive:13}],53:[function(a,b){var c,d,e;c=a("ractive"),e=a("../utils/format.coffee"),d={spyglass:"e801",plus:"e804",settings:"e800",rocket:"e80a",computer:"e807",help:"e80f",github:"e802",warning:"e80c",direction:"e803",megaphone:"e808",heart:"e80e",sort:"e806",spinner:"e80b",fire:"e805"},b.exports=c.extend({name:"views/icons",template:a("../templates/icons.html"),isolated:!0,onrender:function(){return this.observe("icon",function(a){var b;return a&&(b=d[a])?this.set("code",e.hexToDec(b)):this.set("code",null)})}})},{"../templates/icons.html":37,"../utils/format.coffee":45,ractive:13}],54:[function(a,b){var c,d,e,f,g,h;h=a("lodash"),f=a("ractive"),g=a("d3"),c=a("../utils/ractive/eventful.coffee"),e=a("./icons.coffee"),d=68,b.exports=c.extend({name:"views/notify",template:a("../templates/notify.html"),data:{top:d,hidden:!0,defaults:{text:"",type:"",system:!1,icon:"megaphone",ttl:5e3}},components:{Icons:e},adapt:[f.adaptors.Ractive],show:function(a){var b;return this.set("hidden",!1),this.set(a=h.defaults(a,this.data.defaults)),b=[0,50][+a.system],this.animate("top",b,{easing:g.ease("bounce"),duration:800}),a.ttl?h.delay(h.bind(this.hide,this),a.ttl):void 0},hide:function(){return this.data.hidden?void 0:(this.set("hidden",!0),this.animate("top",d,{easing:g.ease("back"),complete:function(a){return function(){return a.set("text",null)}}(this)}))},onconstruct:function(){return this.subscribe("!app/notify",this.show,this),this.subscribe("!app/notify/hide",this.hide,this),this.on("close",this.hide)}})},{"../templates/notify.html":38,"../utils/ractive/eventful.coffee":48,"./icons.coffee":53,d3:4,lodash:7,ractive:13}],55:[function(a,b){var c,d,e,f,g,h,i,j,k;k=a("lodash"),e=a("ractive"),f=a("async"),c=a("../hero.coffee"),d=a("../tables/projects.coffee"),i=a("../../models/projects.coffee"),j=a("../../models/system.coffee"),h=a("../../modules/github/milestones.coffee"),g=a("../../modules/github/issues.coffee"),b.exports=e.extend({name:"views/pages/index",template:a("../../templates/pages/index.html"),components:{Hero:c,Projects:d},data:{projects:i,ready:!1},adapt:[e.adaptors.Ractive],cb:function(){return this.set("ready",!0)},onrender:function(){var a;return document.title="Burnchart: GitHub Burndown Chart as a Service",i.list.length?(a=j.async(),f.map(i.data.list,function(a,b){return h.fetchAll(a,function(c,d){return c?(i.saveError(a,c),b()):f.each(d,function(b,c){return k.find(a.milestones,function(a){var c;return c=a.number,b.number===c})?c(null):g.fetchAll({owner:a.owner,name:a.name,milestone:b.number},function(d,e){return d?(i.saveError(a,d),c()):(k.extend(b,{issues:e}),i.addMilestone(a,b),c())})},b)})},function(b){return function(){return a(),b.cb()}}(this))):this.cb()}})},{"../../models/projects.coffee":22,"../../models/system.coffee":23,"../../modules/github/issues.coffee":27,"../../modules/github/milestones.coffee":28,"../../templates/pages/index.html":39,"../hero.coffee":52,"../tables/projects.coffee":60,async:1,lodash:7,ractive:13}],56:[function(a,b){var c,d,e,f,g,h,i,j,k;k=a("lodash"),e=a("async"),c=a("../chart.coffee"),d=a("../../utils/ractive/eventful.coffee"),i=a("../../models/projects.coffee"),j=a("../../models/system.coffee"),h=a("../../modules/github/milestones.coffee"),g=a("../../modules/github/issues.coffee"),f=a("../../utils/format.coffee"),b.exports=d.extend({name:"views/pages/chart",template:a("../../templates/pages/milestone.html"),components:{Chart:c},data:{format:f,ready:!1},cb:function(a,b){return a?this.publish("!app/notify",{text:a.toString(),type:"alert",system:!0,ttl:null}):b.stats.isEmpty?this.publish("!app/notify",{text:"This milestone has no issues",type:"warn",system:!0,ttl:null}):(b.stats.isDone&&this.publish("!app/notify",{text:"This milestone is complete",type:"success"}),b.stats.isOverdue&&this.publish("!app/notify",{text:"This milestone is overdue",type:"warn"}),this.set({milestone:b,ready:!0}))},onrender:function(){var a,b,c,d,f,l,m,n,o;return o=this.get("route"),m=o[0],l=o[1],f=o[2],f=parseInt(f),document.title=""+m+"/"+l+"/"+f,(n=i.find({owner:m,name:l}))?(a=k.find(n.milestones,{number:f}),null!=a?this.cb(null,a):(b=j.async(),d=function(a){return h.fetch({owner:m,name:l,milestone:f},a)},c=function(a,b){return g.fetchAll({owner:m,name:l,milestone:f},function(c,d){return b(c,k.extend(a,{issues:d}))})},e.waterfall([d,c],function(a){return function(c,d){return b(),c||i.addMilestone(n,d),a.cb.apply(a,arguments)}}(this)))):this.cb("Project not found")}})},{"../../models/projects.coffee":22,"../../models/system.coffee":23,"../../modules/github/issues.coffee":27,"../../modules/github/milestones.coffee":28,"../../templates/pages/milestone.html":40,"../../utils/format.coffee":45,"../../utils/ractive/eventful.coffee":48,"../chart.coffee":50,async:1,lodash:7}],57:[function(a,b){var c,d,e,f,g,h,i,j;j=a("lodash"),e=a("ractive"),c=a("../../utils/ractive/eventful.coffee"),f=a("../../models/firebase.coffee"),h=a("../../models/system.coffee"),i=a("../../models/user.coffee"),g=a("../../utils/key.coffee"),d=a("../icons.coffee"),b.exports=c.extend({name:"views/pages/new",template:a("../../templates/pages/new.html"),data:{value:"radekstepan/disposable",user:i},components:{Icons:d},adapt:[e.adaptors.Ractive],submit:function(a,b){var c,d,e;if(!g.is(a)||g.isEnter(a))return e=b.split("/"),d=e[0],c=e[1],this.publish("!projects/add",{owner:d,name:c}),window.location.hash="#"},onconstruct:function(){return this.on("!login",function(){return f.login()})},onrender:function(){var a;return document.title="Add a project",a=function(){},this.observe("value",j.debounce(a,200),{init:!1}),this.el.querySelector("input").focus(),this.on("submit",this.submit)}})},{"../../models/firebase.coffee":21,"../../models/system.coffee":23,"../../models/user.coffee":24,"../../templates/pages/new.html":41,"../../utils/key.coffee":46,"../../utils/ractive/eventful.coffee":48,"../icons.coffee":53,lodash:7,ractive:13}],58:[function(a,b){var c,d,e,f,g,h,i,j;j=a("lodash"),e=a("async"),d=a("../tables/milestones.coffee"),c=a("../../utils/ractive/eventful.coffee"),h=a("../../models/projects.coffee"),i=a("../../models/system.coffee"),g=a("../../modules/github/milestones.coffee"),f=a("../../modules/github/issues.coffee"),b.exports=c.extend({name:"views/pages/project",template:a("../../templates/pages/project.html"),components:{Milestones:d},data:{projects:h,ready:!1},cb:function(a){return a?this.publish("!app/notify",{text:a.toString(),type:"alert",system:!0,ttl:null}):this.set("ready",!0)},onrender:function(){var a,b,c,d,k,l,m,n;return n=this.get("route"),l=n[0],k=n[1],document.title=""+l+"/"+k,this.set("project",m=h.find({owner:l,name:k})),m?(a=i.async(),d=function(a){return j.find(m.milestones||[],{number:a})},c=function(a){return g.fetchAll(m,a)},b=function(a,b){return a.length?e.each(a,function(a,b){return d(a.number)?b(null):f.fetchAll({owner:l,name:k,milestone:a.number},function(c,d){return c?b(c):(h.addMilestone(m,j.extend(a,{issues:d})),b())})},b):b("This project has no milestones")},e.waterfall([c,b],function(b){return function(){return a(),b.cb.apply(b,arguments)}}(this))):this.cb("Project not found")}})},{"../../models/projects.coffee":22,"../../models/system.coffee":23,"../../modules/github/issues.coffee":27,"../../modules/github/milestones.coffee":28,"../../templates/pages/project.html":42,"../../utils/ractive/eventful.coffee":48,"../tables/milestones.coffee":59,async:1,lodash:7}],59:[function(a,b){var c;c=a("./table.coffee"),b.exports=c.extend({name:"views/milestones",template:a("../../templates/tables/milestones.html")})},{"../../templates/tables/milestones.html":43,"./table.coffee":61}],60:[function(a,b){var c;c=a("./table.coffee"),b.exports=c.extend({name:"views/projects",template:a("../../templates/tables/projects.html")})},{"../../templates/tables/projects.html":44,"./table.coffee":61}],61:[function(a,b){var c,d,e,f;d=a("ractive"),e=a("../../utils/format.coffee"),c=a("../icons.coffee"),f=a("../../models/projects.coffee"),b.exports=d.extend({name:"views/table",data:{format:e},components:{Icons:c},adapt:[d.adaptors.Ractive],onconstruct:function(){return this.on("sortBy",function(){var a,b;return a=f.data.sortFns,b=1+a.indexOf(f.data.sortBy),b===a.length&&(b=0),f.set("sortBy",a[b])})}})},{"../../models/projects.coffee":22,"../../utils/format.coffee":45,"../icons.coffee":53,ractive:13}]},{},[19]); \ No newline at end of file +})},k=function(a,b,c){var d;return a?c(e(a)):2!==b.statusType?c(null!=(null!=b&&null!=(d=b.body)?d.message:void 0)?b.body.message:b.error.message):c(null,b.body)},f=function(a){var b;return b={"Content-Type":"application/json",Accept:"application/vnd.github.v3"},null!=a&&(b.Authorization="token "+a),b},h=function(a){var b,c,d;c={owner:function(a){return null!=a},name:function(a){return null!=a},milestone:function(a){return o.isInt(a)}};for(b in a)if(d=a[b],b in c&&!c[b](d))return!1;return!0},g=n.data.ready,l=[],i=function(a){return g?a():l.push(a)},n.observe("ready",function(a){var b;if(g=a,a){for(b=[];l.length;)b.push(l.shift()());return b}}),e=function(a){var b;switch(!1){case!o.isString(a):b=a;break;case!o.isArray(a):b=a[1];break;case!(o.isObject(a)&&o.isString(a.message)):b=a.message}if(!b)try{b=JSON.stringify(a)}catch(c){b=a.toString()}return b}},{"../../models/config.coffee":20,"../../models/user.coffee":24,"../../utils/mixins.coffee":47,lodash:7,superagent:16}],30:[function(a,b){var c,d;d=a("ractive"),c=d.extend({}),b.exports=new c},{ractive:13}],31:[function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=[].slice;m=a("lodash"),e=a("director"),g=a("./mediator.coffee"),k=a("../models/system.coffee"),f="#page",h={index:a("../views/pages/index.coffee"),milestone:a("../views/pages/milestone.coffee"),"new":a("../views/pages/new.coffee"),project:a("../views/pages/project.coffee")},c=function(a,b,c){return g.fire("!projects/add",{owner:b,name:c})},d=function(a,b){var c,d,e,f;for(null==b&&(b=[]),f=[],d=0,e=b.length;e>d;d++)c=b[d],f.push(m.partial(c,a));return f},l=null,i=function(){var a,b,c;return c=arguments[0],b=2<=arguments.length?n.call(arguments,1):[],null!=l&&l.teardown(),g.fire("!app/notify/hide"),a=h[c],l=new a({el:f,data:{route:b}})},j={"/":d("index",[i]),"/new/project":d("new",[i]),"/:owner/:name":d("project",[c,i]),"/:owner/:name/:milestone":d("milestone",[c,i]),"/demo":function(){return g.fire("!projects/demo"),window.location.hash="#"}},b.exports=e.Router(j).configure({strict:!1,notfound:function(){throw 404}})},{"../models/system.coffee":23,"../views/pages/index.coffee":55,"../views/pages/milestone.coffee":56,"../views/pages/new.coffee":57,"../views/pages/project.coffee":58,"./mediator.coffee":30,director:5,lodash:7}],32:[function(a,b){var c,d;c=a("moment"),d=function(a,b){return a+b===0?0:100*(a/(b+a))},b.exports=function(a){var b,e,f,g,h,i,j,k,l,m;return null!=a.stats?a.stats:(h=!1,j=!0,k=!1,i=!0,l=0,b=a.issues.closed.size,e=a.issues.open.size,b+e>0&&(i=!1,l=d(b,e),100===l&&(h=!0)),null==a.due_on?{isOverdue:k,isOnTime:j,isDone:h,isEmpty:i,progress:{points:l}}:(b=c(a.created_at),e=c.utc(),f=c(a.due_on),e.isAfter(f)&&(k=!0),m=d(e.diff(b),f.diff(e)),g=e.diff(b,"days")/100,j=l>m,{isDone:h,days:g,isOnTime:j,isOverdue:k,progress:{points:l,time:m}}))}},{moment:10}],33:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"app"},f:[{t:7,e:"Notify"}," ",{t:7,e:"Header"}," ",{t:7,e:"div",a:{id:"page"},f:[]}," ",{t:7,e:"div",a:{id:"footer"},f:[{t:7,e:"div",a:{"class":"wrap"},f:["© 2012-2014 ",{t:7,e:"a",a:{href:"https://assembly.com/burnchart"},f:["Made with ",{t:7,e:"Icons",a:{icon:"heart"}}," on Assembly"]}]}]}]}]}},{}],34:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"chart"}}]}},{}],35:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"head"},f:[{t:4,n:53,r:"user",f:[{t:4,r:"ready",f:[{t:7,e:"div",a:{"class":"right"},t1:"fade",f:[{t:4,r:"uid",f:[{t:2,r:"github.displayName"}," logged in"]},{t:4,n:51,f:[{t:7,e:"a",a:{"class":"github"},v:{click:"!login"},f:[{t:7,e:"Icons",a:{icon:"github"}}," Sign In"]}],r:"uid"}]}]}]}," ",{t:7,e:"a",a:{id:"icon",href:"#"},f:[{t:7,e:"Icons",a:{icon:[{t:2,r:"icon"}]}}]}," ",{t:7,e:"ul",f:[{t:7,e:"li",f:[{t:7,e:"a",a:{href:"#new/project","class":"add"},f:[{t:7,e:"Icons",a:{icon:"plus"}}," Add a Project"]}]}," ",{t:7,e:"li",f:[{t:7,e:"a",a:{href:"#demo"},f:[{t:7,e:"Icons",a:{icon:"computer"}}," See Examples"]}]}," ",{t:7,e:"li",f:[{t:7,e:"a",a:{href:"mailto:your-account@helpful.io","data-helpful":"burnchart","data-helpful-modal":"on"},f:[{t:7,e:"Icons",a:{icon:"help"}}," Contact"]}]}]}]}]}},{}],36:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"hero"},f:[{t:7,e:"div",a:{"class":"content"},f:[{t:7,e:"Icons",a:{icon:"direction"}}," ",{t:7,e:"h2",f:["See your project progress"]}," ",{t:7,e:"p",f:["Serious about a project deadline? Add your GitHub project and we'll tell you if it is running on time or not."]}," ",{t:7,e:"div",a:{"class":"cta"},f:[{t:7,e:"a",a:{href:"#new/project","class":"primary"},f:[{t:7,e:"Icons",a:{icon:"plus"}}," Add a Project"]}," ",{t:7,e:"a",a:{href:"#demo","class":"secondary"},f:[{t:7,e:"Icons",a:{icon:"computer"}}," See Examples"]}]}]}]}]}},{}],37:[function(a,b){b.exports={v:1,t:[{t:4,r:"code",f:[{t:7,e:"span",a:{"class":["icon ",{t:2,r:"icon"}]},f:[{t:3,x:{r:["code"],s:'"&#"+_0+";"'}}]}]}]}},{}],38:[function(a,b){b.exports={v:1,t:[{t:4,r:"text",f:[{t:4,r:"system",f:[{t:7,e:"div",a:{id:"notify","class":[{t:2,r:"type"}," system"],style:["top:",{t:2,r:"top"},"%"]},f:[{t:7,e:"Icons",a:{icon:[{t:2,r:"icon"}]}}," ",{t:7,e:"p",f:[{t:2,r:"text"}]}]}]},{t:4,n:51,f:[{t:7,e:"div",a:{id:"notify","class":[{t:2,r:"type"}],style:["top:",{t:2,x:{r:["top"],s:"-_0"}},"px"]},f:[{t:7,e:"span",a:{"class":"close"},v:{click:"close"}}," ",{t:7,e:"Icons",a:{icon:[{t:2,r:"icon"}]}}," ",{t:7,e:"p",f:[{t:2,r:"text"}]}]}],r:"system"}]}]}},{}],39:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"content","class":"wrap"},f:[{t:4,n:50,r:"projects.list",f:[{t:4,r:"ready",f:[{t:7,e:"div",t1:"fade",f:[{t:7,e:"Projects",a:{projects:[{t:2,r:"projects"}]}}]}]}]},{t:4,n:51,f:[{t:7,e:"Hero"}],r:"projects.list"}]}]}},{}],40:[function(a,b){b.exports={v:1,t:[{t:4,r:"ready",f:[{t:7,e:"div",t1:"fade",f:[{t:7,e:"div",a:{id:"title"},f:[{t:7,e:"div",a:{"class":"wrap"},f:[{t:7,e:"h2",a:{"class":"title"},f:[{t:2,x:{r:["format","milestone.title"],s:"_0.title(_1)"}}]}," ",{t:7,e:"span",a:{"class":"sub"},f:[{t:3,x:{r:["format","milestone.due_on"],s:"_0.due(_1)"}}]}," ",{t:7,e:"div",a:{"class":"description"},f:[{t:3,x:{r:["format","milestone.description"],s:"_0.markdown(_1)"}}]}]}]}," ",{t:7,e:"div",a:{id:"content","class":"wrap"},f:[{t:7,e:"Chart",a:{milestone:[{t:2,r:"milestone"}]}}]}]}]}]}},{}],41:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"content","class":"wrap"},f:[{t:7,e:"div",a:{id:"add"},f:[{t:7,e:"div",a:{"class":"header"},f:[{t:7,e:"h2",f:["Add a Project"]}," ",{t:7,e:"p",f:["Type the name of a GitHub repository that has some milestones with issues. ",{t:4,n:53,r:"user",f:[{t:4,r:"ready",f:[{t:4,r:"uid",f:["If you'd like to add a private GitHub repo, ",{t:7,e:"a",v:{click:"!login"},f:["Sign In"]}," first."],n:51}]}]}]}]}," ",{t:7,e:"div",a:{"class":"form"},f:[{t:7,e:"table",f:[{t:7,e:"tr",f:[{t:7,e:"td",f:[{t:7,e:"input",a:{type:"text",placeholder:"user/repo",autocomplete:"off",value:[{t:2,r:"value"}]},v:{keyup:{n:"submit",d:[{t:2,r:"value"}]}}}]}," ",{t:7,e:"td",f:[{t:7,e:"a",v:{click:{n:"submit",d:[{t:2,r:"value"}]}},f:["Add"]}]}]}]}]}," ",{t:7,e:"div",a:{"class":"protip"},f:[{t:7,e:"Icons",a:{icon:"rocket"}}," Protip: To see if a milestone is on track or not, make sure it has a due date assigned to it."]}]}]}]}},{}],42:[function(a,b){b.exports={v:1,t:[{t:4,r:"ready",f:[{t:7,e:"div",t1:"fade",f:[{t:7,e:"div",a:{id:"title"},f:[{t:7,e:"div",a:{"class":"wrap"},f:[{t:7,e:"h2",a:{"class":"title"},f:[{t:2,x:{r:["route"],s:'_0.join("/")'}}]}]}]}," ",{t:7,e:"div",a:{id:"content","class":"wrap"},f:[{t:7,e:"Milestones",a:{project:[{t:2,r:"project"}]}}]}]}]}]}},{}],43:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"projects"},f:[{t:7,e:"div",a:{"class":"header"},f:[{t:7,e:"a",a:{"class":"sort"},v:{click:"sortBy"},f:[{t:7,e:"Icons",a:{icon:"sort"}}," Sorted by ",{t:2,r:"projects.sortBy"}]}," ",{t:7,e:"h2",f:["Milestones"]}]}," ",{t:7,e:"table",f:[{t:4,r:"projects.index",f:[{t:4,x:{r:["."],s:"{index:_0}"},f:[{t:4,x:{r:["index.0","projects.list"],s:"{p:_1[_0]}"},f:[{t:4,n:50,x:{r:["p.owner","project.owner","p.name","project.name"],s:"_0==_1&&_2==_3"},f:[{t:4,x:{r:["index.1","project.milestones"],s:"{milestone:_1[_0]}"},f:[{t:7,e:"tr",a:{"class":[{t:4,n:50,r:"milestone.stats.isDone",f:["done"]}]},f:[{t:7,e:"td",f:[{t:7,e:"a",a:{"class":"milestone",href:["#",{t:2,r:"project.owner"},"/",{t:2,r:"project.name"},"/",{t:2,r:"milestone.number"}]},f:[{t:2,r:"milestone.title"}]}]}," ",{t:7,e:"td",a:{style:"width:1%"},f:[{t:7,e:"div",a:{"class":"progress"},f:[{t:7,e:"span",a:{"class":"percent"},f:[{t:2,x:{r:["milestone.stats.progress.points"],s:"Math.floor(_0)"}},"%"]}," ",{t:7,e:"span",a:{"class":["due ",{t:4,n:50,r:"milestone.stats.isOverdue",f:["red"]}]},f:[{t:3,x:{r:["format","milestone.due_on"],s:"_0.due(_1)"}}]}," ",{t:7,e:"div",a:{"class":"outer bar"},f:[{t:7,e:"div",a:{"class":["inner bar ",{t:2,x:{r:["milestone.stats.isOnTime"],s:'(_0)?"green":"red"'}}],style:["width:",{t:2,r:"milestone.stats.progress.points"},"%"]}}]}]}]}]}]}]}]}]}]}]}," ",{t:7,e:"div",a:{"class":"footer"},f:[]}]}]}},{}],44:[function(a,b){b.exports={v:1,t:[{t:7,e:"div",a:{id:"projects"},f:[{t:7,e:"div",a:{"class":"header"},f:[{t:7,e:"a",a:{"class":"sort"},v:{click:"sortBy"},f:[{t:7,e:"Icons",a:{icon:"sort"}}," Sorted by ",{t:2,r:"projects.sortBy"}]}," ",{t:7,e:"h2",f:["Projects"]}]}," ",{t:7,e:"table",f:[{t:4,r:"projects.list",f:[{t:4,n:50,r:"errors",f:[{t:7,e:"tr",f:[{t:7,e:"td",a:{colspan:"3","class":"repo"},f:[{t:7,e:"div",a:{"class":"project"},f:[{t:2,r:"owner"},"/",{t:2,r:"name"}," ",{t:7,e:"span",a:{"class":"error",title:[{t:2,x:{r:["errors"],s:'_0.join("\\n")'}}]},f:[{t:7,e:"Icons",a:{icon:"warning"}}]}]}]}]}]}]}," ",{t:4,r:"projects.index",f:[{t:4,x:{r:["."],s:"{index:_0}"},f:[{t:4,x:{r:["index.0","projects.list"],s:"{project:_1[_0]}"},f:[{t:4,n:53,r:"project",f:[{t:4,x:{r:["index.1","project.milestones"],s:"{milestone:_1[_0]}"},f:[{t:7,e:"tr",a:{"class":[{t:4,n:50,r:"milestone.stats.isDone",f:["done"]}]},f:[{t:7,e:"td",a:{"class":"repo"},f:[{t:7,e:"a",a:{"class":"project",href:["#",{t:2,r:"owner"},"/",{t:2,r:"name"}]},f:[{t:2,r:"owner"},"/",{t:2,r:"name"}]}]}," ",{t:7,e:"td",f:[{t:7,e:"a",a:{"class":"milestone",href:["#",{t:2,r:"owner"},"/",{t:2,r:"name"},"/",{t:2,r:"milestone.number"}]},f:[{t:2,r:"milestone.title"}]}]}," ",{t:7,e:"td",a:{style:"width:1%"},f:[{t:7,e:"div",a:{"class":"progress"},f:[{t:7,e:"span",a:{"class":"percent"},f:[{t:2,x:{r:["milestone.stats.progress.points"],s:"Math.floor(_0)"}},"%"]}," ",{t:7,e:"span",a:{"class":["due ",{t:4,n:50,r:"milestone.stats.isOverdue",f:["red"]}]},f:[{t:3,x:{r:["format","milestone.due_on"],s:"_0.due(_1)"}}]}," ",{t:7,e:"div",a:{"class":"outer bar"},f:[{t:7,e:"div",a:{"class":["inner bar ",{t:2,x:{r:["milestone.stats.isOnTime"],s:'(_0)?"green":"red"'}}],style:["width:",{t:2,r:"milestone.stats.progress.points"},"%"]}}]}]}]}]}]}]}]}]}]}]}," ",{t:7,e:"div",a:{"class":"footer"},f:[]}]}]}},{}],45:[function(a,b){var c,d,e;e=a("lodash"),d=a("moment"),c=a("marked"),b.exports={fromNow:e.memoize(function(a){return d(a).fromNow()}),due:function(a){return a?["due",this.fromNow(a)].join(" "):" "},markdown:function(a){return c(a)},title:function(a){return a.toLowerCase().indexOf("milestone")>-1?a:["Milestone",a].join(" ")},hexToDec:function(a){return parseInt(a,16)}}},{lodash:7,marked:9,moment:10}],46:[function(a,b){b.exports={is:function(a){var b;return"keyup"===(b=a.original.type)||"keydown"===b},isEnter:function(a){return 13===a.original.which}}},{}],47:[function(a){var b;b=a("lodash"),b.mixin({pluckMany:function(a,c){if(!b.isArray(c))throw"`keys` needs to be an Array";return b.map(a,function(a){var d;return d={},b.each(c,function(b){return d[b]=a[b]}),d})},isInt:function(a){return!isNaN(a)&&parseInt(Number(a))===a&&!isNaN(parseInt(a,10))}})},{lodash:7}],48:[function(a,b){var c,d,e;e=a("lodash"),c=a("ractive"),d=a("../../modules/mediator.coffee"),b.exports=c.extend({subscribe:function(a,b,c){return null==c&&(c=this),e.isArray(this._subs)||(this._subs=[]),e.isFunction(b)?this._subs.push(d.on(a,e.bind(b,c))):console.log("Warning: `cb` is not a function")},publish:function(){return d.fire.apply(d,arguments)},onteardown:function(){var a,b,c,d,f;if(e.isArray(this._subs)){for(d=this._subs,f=[],b=0,c=d.length;c>b;b++)a=d[b],f.push(e.isFunction(a.cancel)?a.cancel():console.log("Warning: `sub.cancel` is not a function"));return f}}})},{"../../modules/mediator.coffee":30,lodash:7,ractive:13}],49:[function(a,b){var c;c=a("./eventful.coffee"),b.exports=function(a){var b,d;return b=c.extend(a),d=new b,d.render(),d}},{"./eventful.coffee":48}],50:[function(a,b){var c,d,e,f;c=a("ractive"),e=a("d3"),a("d3-tip")(e),f=a("../modules/chart/lines.coffee"),d=a("../modules/chart/axes.coffee"),b.exports=c.extend({name:"views/chart",template:a("../templates/chart.html"),oncomplete:function(){var a,b,c,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;return o=this.data.milestone,i=o.issues,r=i.open.size+i.closed.size,c=i.closed.list[0].closed_at,i.length&&o.created_at>c&&(o.created_at=c),a=f.actual(i.closed.list,o.created_at,r),h=f.ideal(o.created_at,o.due_on,r),s=f.trend(a,o.created_at,o.due_on),y=this.el.getBoundingClientRect(),g=y.height,t=y.width,n={top:30,right:30,bottom:40,left:50},t-=n.left+n.right,g-=n.top+n.bottom,u=e.time.scale().range([0,t]),w=e.scale.linear().range([g,0]),v=d.horizontal(g,u),x=d.vertical(t,w),k=e.svg.line().interpolate("linear").x(function(a){return u(new Date(a.date))}).y(function(a){return w(a.points)}),b=h[0],j=h[h.length-1],u.domain([new Date(b.date),new Date(j.date)]),w.domain([0,b.points]).nice(),p=e.select(this.el.querySelector("#chart")).append("svg").attr("width",t+n.left+n.right).attr("height",g+n.top+n.bottom).append("g").attr("transform","translate("+n.left+","+n.top+")"),p.append("g").attr("class","x axis day").attr("transform","translate(0,"+g+")").call(v),l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],m=v.orient("top").tickSize(g).tickFormat(function(a){return l[a.getMonth()]}).ticks(2),p.append("g").attr("class","x axis month").attr("transform","translate(0,"+g+")").call(m),p.append("g").attr("class","y axis").call(x),p.append("svg:line").attr("class","today").attr("x1",u(new Date)).attr("y1",0).attr("x2",u(new Date)).attr("y2",g),p.append("path").attr("class","ideal line").attr("d",k.interpolate("linear")(h)),p.append("path").attr("class","trendline line").attr("d",k.interpolate("linear")(s)),p.append("path").attr("class","actual line").attr("d",k.interpolate("linear").y(function(a){return w(a.points)})(a)),q=e.tip().attr("class","d3-tip").html(function(a){var b,c;return b=a.number,c=a.title,"#"+b+": "+c}),p.call(q),p.selectAll("a.issue").data(a.slice(1)).enter().append("svg:a").attr("xlink:href",function(a){var b;return b=a.html_url}).attr("xlink:show","new").append("svg:circle").attr("cx",function(a){var b;return b=a.date,u(new Date(b))}).attr("cy",function(a){var b;return b=a.points,w(b)}).attr("r",function(a){var b;return b=a.radius,5}).on("mouseover",q.show).on("mouseout",q.hide)}})},{"../modules/chart/axes.coffee":25,"../modules/chart/lines.coffee":26,"../templates/chart.html":34,d3:4,"d3-tip":3,ractive:13}],51:[function(a,b){var c,d,e,f,g;d=a("ractive"),f=a("../models/system.coffee").system,e=a("../models/firebase.coffee"),g=a("../models/user.coffee"),c=a("./icons.coffee"),b.exports=d.extend({name:"views/header",template:a("../templates/header.html"),data:{user:g,icon:"fire"},components:{Icons:c},adapt:[d.adaptors.Ractive],onconstruct:function(){return this.on("!login",function(){return e.login()})},onrender:function(){return f.observe("loading",function(a){return function(b){return a.set("icon",b?"spinner":"fire")}}(this))}})},{"../models/firebase.coffee":21,"../models/system.coffee":23,"../models/user.coffee":24,"../templates/header.html":35,"./icons.coffee":53,ractive:13}],52:[function(a,b){var c,d;d=a("ractive"),c=a("./icons.coffee"),b.exports=d.extend({name:"views/hero",template:a("../templates/hero.html"),components:{Icons:c},adapt:[d.adaptors.Ractive]})},{"../templates/hero.html":36,"./icons.coffee":53,ractive:13}],53:[function(a,b){var c,d,e;c=a("ractive"),e=a("../utils/format.coffee"),d={spyglass:"e801",plus:"e804",settings:"e800",rocket:"e80a",computer:"e807",help:"e80f",github:"e802",warning:"e80c",direction:"e803",megaphone:"e808",heart:"e80e",sort:"e806",spinner:"e80b",fire:"e805"},b.exports=c.extend({name:"views/icons",template:a("../templates/icons.html"),isolated:!0,onrender:function(){return this.observe("icon",function(a){var b;return a&&(b=d[a])?this.set("code",e.hexToDec(b)):this.set("code",null)})}})},{"../templates/icons.html":37,"../utils/format.coffee":45,ractive:13}],54:[function(a,b){var c,d,e,f,g,h;h=a("lodash"),f=a("ractive"),g=a("d3"),c=a("../utils/ractive/eventful.coffee"),e=a("./icons.coffee"),d=68,b.exports=c.extend({name:"views/notify",template:a("../templates/notify.html"),data:{top:d,hidden:!0,defaults:{text:"",type:"",system:!1,icon:"megaphone",ttl:5e3}},components:{Icons:e},adapt:[f.adaptors.Ractive],show:function(a){var b;return this.set("hidden",!1),this.set(a=h.defaults(a,this.data.defaults)),b=[0,50][+a.system],this.animate("top",b,{easing:g.ease("bounce"),duration:800}),a.ttl?h.delay(h.bind(this.hide,this),a.ttl):void 0},hide:function(){return this.data.hidden?void 0:(this.set("hidden",!0),this.animate("top",d,{easing:g.ease("back"),complete:function(a){return function(){return a.set("text",null)}}(this)}))},onconstruct:function(){return this.subscribe("!app/notify",this.show,this),this.subscribe("!app/notify/hide",this.hide,this),this.on("close",this.hide)}})},{"../templates/notify.html":38,"../utils/ractive/eventful.coffee":48,"./icons.coffee":53,d3:4,lodash:7,ractive:13}],55:[function(a,b){var c,d,e,f,g,h,i,j,k;k=a("lodash"),e=a("ractive"),f=a("async"),c=a("../hero.coffee"),d=a("../tables/projects.coffee"),i=a("../../models/projects.coffee"),j=a("../../models/system.coffee"),h=a("../../modules/github/milestones.coffee"),g=a("../../modules/github/issues.coffee"),b.exports=e.extend({name:"views/pages/index",template:a("../../templates/pages/index.html"),components:{Hero:c,Projects:d},data:{projects:i,ready:!1},adapt:[e.adaptors.Ractive],cb:function(){return this.set("ready",!0)},onrender:function(){var a;return document.title="Burnchart: GitHub Burndown Chart as a Service",i.list.length?(a=j.async(),f.map(i.data.list,function(a,b){return h.fetchAll(a,function(c,d){return c?(i.saveError(a,c),b()):f.each(d,function(b,c){return k.find(a.milestones,function(a){var c;return c=a.number,b.number===c})?c(null):g.fetchAll({owner:a.owner,name:a.name,milestone:b.number},function(d,e){return d?(i.saveError(a,d),c()):(k.extend(b,{issues:e}),i.addMilestone(a,b),c())})},b)})},function(b){return function(){return a(),b.cb()}}(this))):this.cb()}})},{"../../models/projects.coffee":22,"../../models/system.coffee":23,"../../modules/github/issues.coffee":27,"../../modules/github/milestones.coffee":28,"../../templates/pages/index.html":39,"../hero.coffee":52,"../tables/projects.coffee":60,async:1,lodash:7,ractive:13}],56:[function(a,b){var c,d,e,f,g,h,i,j,k;k=a("lodash"),e=a("async"),c=a("../chart.coffee"),d=a("../../utils/ractive/eventful.coffee"),i=a("../../models/projects.coffee"),j=a("../../models/system.coffee"),h=a("../../modules/github/milestones.coffee"),g=a("../../modules/github/issues.coffee"),f=a("../../utils/format.coffee"),b.exports=d.extend({name:"views/pages/chart",template:a("../../templates/pages/milestone.html"),components:{Chart:c},data:{format:f,ready:!1},cb:function(a,b){return a?this.publish("!app/notify",{text:a.toString(),type:"alert",system:!0,ttl:null}):b.stats.isEmpty?this.publish("!app/notify",{text:"This milestone has no issues",type:"warn",system:!0,ttl:null}):(b.stats.isDone&&this.publish("!app/notify",{text:"This milestone is complete",type:"success"}),b.stats.isOverdue&&this.publish("!app/notify",{text:"This milestone is overdue",type:"warn"}),this.set({milestone:b,ready:!0}))},onrender:function(){var a,b,c,d,f,l,m,n,o;return o=this.get("route"),m=o[0],l=o[1],f=o[2],f=parseInt(f),document.title=""+m+"/"+l+"/"+f,(n=i.find({owner:m,name:l}))?(a=k.find(n.milestones,{number:f}),null!=a?this.cb(null,a):(b=j.async(),d=function(a){return h.fetch({owner:m,name:l,milestone:f},a)},c=function(a,b){return g.fetchAll({owner:m,name:l,milestone:f},function(c,d){return b(c,k.extend(a,{issues:d}))})},e.waterfall([d,c],function(a){return function(c,d){return b(),c||i.addMilestone(n,d),a.cb.apply(a,arguments)}}(this)))):this.cb("Project not found")}})},{"../../models/projects.coffee":22,"../../models/system.coffee":23,"../../modules/github/issues.coffee":27,"../../modules/github/milestones.coffee":28,"../../templates/pages/milestone.html":40,"../../utils/format.coffee":45,"../../utils/ractive/eventful.coffee":48,"../chart.coffee":50,async:1,lodash:7}],57:[function(a,b){var c,d,e,f,g,h,i,j;j=a("lodash"),e=a("ractive"),c=a("../../utils/ractive/eventful.coffee"),f=a("../../models/firebase.coffee"),h=a("../../models/system.coffee"),i=a("../../models/user.coffee"),g=a("../../utils/key.coffee"),d=a("../icons.coffee"),b.exports=c.extend({name:"views/pages/new",template:a("../../templates/pages/new.html"),data:{value:"radekstepan/disposable",user:i},components:{Icons:d},adapt:[e.adaptors.Ractive],submit:function(a,b){var c,d,e;if(!g.is(a)||g.isEnter(a))return e=b.split("/"),d=e[0],c=e[1],this.publish("!projects/add",{owner:d,name:c}),window.location.hash="#"},onconstruct:function(){return this.on("!login",function(){return f.login()})},onrender:function(){var a;return document.title="Add a project",a=function(){},this.observe("value",j.debounce(a,200),{init:!1}),this.el.querySelector("input").focus(),this.on("submit",this.submit)}})},{"../../models/firebase.coffee":21,"../../models/system.coffee":23,"../../models/user.coffee":24,"../../templates/pages/new.html":41,"../../utils/key.coffee":46,"../../utils/ractive/eventful.coffee":48,"../icons.coffee":53,lodash:7,ractive:13}],58:[function(a,b){var c,d,e,f,g,h,i,j;j=a("lodash"),e=a("async"),d=a("../tables/milestones.coffee"),c=a("../../utils/ractive/eventful.coffee"),h=a("../../models/projects.coffee"),i=a("../../models/system.coffee"),g=a("../../modules/github/milestones.coffee"),f=a("../../modules/github/issues.coffee"),b.exports=c.extend({name:"views/pages/project",template:a("../../templates/pages/project.html"),components:{Milestones:d},data:{projects:h,ready:!1},cb:function(a){return a?this.publish("!app/notify",{text:a.toString(),type:"alert",system:!0,ttl:null}):this.set("ready",!0)},onrender:function(){var a,b,c,d,k,l,m,n;return n=this.get("route"),l=n[0],k=n[1],document.title=""+l+"/"+k,this.set("project",m=h.find({owner:l,name:k})),m?(a=i.async(),d=function(a){return j.find(m.milestones||[],{number:a})},c=function(a){return g.fetchAll(m,a)},b=function(a,b){return a.length?e.each(a,function(a,b){return d(a.number)?b(null):f.fetchAll({owner:l,name:k,milestone:a.number},function(c,d){return c?b(c):(h.addMilestone(m,j.extend(a,{issues:d})),b())})},b):b("This project has no milestones")},e.waterfall([c,b],function(b){return function(){return a(),b.cb.apply(b,arguments)}}(this))):this.cb("Project not found")}})},{"../../models/projects.coffee":22,"../../models/system.coffee":23,"../../modules/github/issues.coffee":27,"../../modules/github/milestones.coffee":28,"../../templates/pages/project.html":42,"../../utils/ractive/eventful.coffee":48,"../tables/milestones.coffee":59,async:1,lodash:7}],59:[function(a,b){var c;c=a("./table.coffee"),b.exports=c.extend({name:"views/milestones",template:a("../../templates/tables/milestones.html")})},{"../../templates/tables/milestones.html":43,"./table.coffee":61}],60:[function(a,b){var c;c=a("./table.coffee"),b.exports=c.extend({name:"views/projects",template:a("../../templates/tables/projects.html")})},{"../../templates/tables/projects.html":44,"./table.coffee":61}],61:[function(a,b){var c,d,e,f;d=a("ractive"),e=a("../../utils/format.coffee"),c=a("../icons.coffee"),f=a("../../models/projects.coffee"),b.exports=d.extend({name:"views/table",data:{format:e},components:{Icons:c},adapt:[d.adaptors.Ractive],onconstruct:function(){return this.on("sortBy",function(){var a,b;return a=f.data.sortFns,b=1+a.indexOf(f.data.sortBy),b===a.length&&(b=0),f.set("sortBy",a[b])})}})},{"../../models/projects.coffee":22,"../../utils/format.coffee":45,"../icons.coffee":53,ractive:13}]},{},[19]); \ No newline at end of file diff --git a/src/modules/stats.coffee b/src/modules/stats.coffee index 4e082bb..52ffdb8 100644 --- a/src/modules/stats.coffee +++ b/src/modules/stats.coffee @@ -23,18 +23,18 @@ module.exports = (milestone) -> # Milestones with no due date are always on track. return { isOverdue, isOnTime, isDone, isEmpty, 'progress': { points } } unless milestone.due_on? - a = +new Date milestone.created_at - b = +new Date - c = +new Date milestone.due_on + a = moment milestone.created_at + b = do moment.utc + c = moment milestone.due_on # Overdue? - isOverdue = yes if b > c + isOverdue = yes if b.isAfter c # Progress in time. - time = progress b - a, c - b + time = progress b.diff(a), c.diff(b) # How many days is 1% of the time? - days = (moment(b).diff(moment(a), 'days')) / 100 + days = (b.diff(a, 'days')) / 100 # Are we on time? isOnTime = points > time diff --git a/src/utils/format.coffee b/src/utils/format.coffee index c8c2719..e3a9ec8 100644 --- a/src/utils/format.coffee +++ b/src/utils/format.coffee @@ -6,7 +6,7 @@ module.exports = # Time from now. fromNow: _.memoize (jsonDate) -> - moment(new Date(jsonDate)).fromNow() + do moment(jsonDate).fromNow # When is a milestone due? due: (jsonDate) -> diff --git a/test/fixtures/issues.json b/test/fixtures/issues.json new file mode 100644 index 0000000..f64dc76 --- /dev/null +++ b/test/fixtures/issues.json @@ -0,0 +1,96 @@ +[ + { + "url": "https://api.github.com/repos/octocat/Hello-World/issues/1347", + "html_url": "https://github.com/octocat/Hello-World/issues/1347", + "number": 1347, + "state": "open", + "title": "Found a bug", + "body": "I'm having a problem with this.", + "user": { + "login": "octocat", + "id": 1, + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + { + "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug", + "name": "bug", + "color": "f29513" + } + ], + "assignee": { + "login": "octocat", + "id": 1, + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "milestone": { + "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1", + "number": 1, + "state": "open", + "title": "v1.0", + "description": "", + "creator": { + "login": "octocat", + "id": 1, + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 4, + "closed_issues": 8, + "created_at": "2011-04-10T20:09:31Z", + "updated_at": "2014-03-03T18:58:10Z", + "due_on": null + }, + "comments": 0, + "pull_request": { + "url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347", + "html_url": "https://github.com/octocat/Hello-World/pull/1347", + "diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff", + "patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch" + }, + "closed_at": null, + "created_at": "2011-04-22T13:33:48Z", + "updated_at": "2011-04-22T13:33:48Z" + } +] \ No newline at end of file diff --git a/test/fixtures/milestone.json b/test/fixtures/milestone.json new file mode 100644 index 0000000..8f5a762 --- /dev/null +++ b/test/fixtures/milestone.json @@ -0,0 +1,31 @@ +{ + "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1", + "number": 1, + "state": "open", + "title": "v1.0", + "description": "", + "creator": { + "login": "octocat", + "id": 1, + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 4, + "closed_issues": 8, + "created_at": "2011-04-10T20:09:31Z", + "updated_at": "2014-03-03T18:58:10Z", + "due_on": null +} \ No newline at end of file diff --git a/test/fixtures/milestones.json b/test/fixtures/milestones.json new file mode 100644 index 0000000..de0cc0b --- /dev/null +++ b/test/fixtures/milestones.json @@ -0,0 +1,33 @@ +[ + { + "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1", + "number": 1, + "state": "open", + "title": "v1.0", + "description": "", + "creator": { + "login": "octocat", + "id": 1, + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "open_issues": 4, + "closed_issues": 8, + "created_at": "2011-04-10T20:09:31Z", + "updated_at": "2014-03-03T18:58:10Z", + "due_on": null + } +] \ No newline at end of file diff --git a/test/fixtures/repositories.json b/test/fixtures/repositories.json new file mode 100644 index 0000000..b24b4a3 --- /dev/null +++ b/test/fixtures/repositories.json @@ -0,0 +1,56 @@ +[ + { + "id": 1296269, + "owner": { + "login": "octocat", + "id": 1, + "avatar_url": "https://github.com/images/error/octocat_happy.gif", + "gravatar_id": "", + "url": "https://api.github.com/users/octocat", + "html_url": "https://github.com/octocat", + "followers_url": "https://api.github.com/users/octocat/followers", + "following_url": "https://api.github.com/users/octocat/following{/other_user}", + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", + "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", + "organizations_url": "https://api.github.com/users/octocat/orgs", + "repos_url": "https://api.github.com/users/octocat/repos", + "events_url": "https://api.github.com/users/octocat/events{/privacy}", + "received_events_url": "https://api.github.com/users/octocat/received_events", + "type": "User", + "site_admin": false + }, + "name": "Hello-World", + "full_name": "octocat/Hello-World", + "description": "This your first repo!", + "private": false, + "fork": false, + "url": "https://api.github.com/repos/octocat/Hello-World", + "html_url": "https://github.com/octocat/Hello-World", + "clone_url": "https://github.com/octocat/Hello-World.git", + "git_url": "git://github.com/octocat/Hello-World.git", + "ssh_url": "git@github.com:octocat/Hello-World.git", + "svn_url": "https://svn.github.com/octocat/Hello-World", + "mirror_url": "git://git.example.com/octocat/Hello-World", + "homepage": "https://github.com", + "language": null, + "forks_count": 9, + "stargazers_count": 80, + "watchers_count": 80, + "size": 108, + "default_branch": "master", + "open_issues_count": 0, + "has_issues": true, + "has_wiki": true, + "has_pages": false, + "has_downloads": true, + "pushed_at": "2011-01-26T19:06:43Z", + "created_at": "2011-01-26T19:01:12Z", + "updated_at": "2011-01-26T19:14:43Z", + "permissions": { + "admin": false, + "push": false, + "pull": true + } + } +] \ No newline at end of file diff --git a/test/issues.coffee b/test/issues.coffee index 637506a..fd32d6c 100644 --- a/test/issues.coffee +++ b/test/issues.coffee @@ -1,4 +1,5 @@ assert = require 'assert' +moment = require 'moment' request = require '../src/modules/github/request.coffee' issues = require '../src/modules/github/issues.coffee' @@ -8,6 +9,15 @@ repo = { 'owner': 'asm-products', 'name': 'burnchart', 'milestone': 1 } module.exports = + 'issues - time format': (done) -> + json = require './fixtures/issues.json' + + # ISO 8601 dates are in UTC timezone. + utc = do moment(json[0].created_at).toDate().toUTCString + assert.equal utc, 'Fri, 22 Apr 2011 13:33:48 GMT' + + do done + 'issues - all empty': (done) -> called = 0 request.allIssues = (repo, opts, cb) -> diff --git a/test/milestones.coffee b/test/milestones.coffee new file mode 100644 index 0000000..2579db2 --- /dev/null +++ b/test/milestones.coffee @@ -0,0 +1,13 @@ +assert = require 'assert' +moment = require 'moment' + +module.exports = + + 'milestones - time format': (done) -> + json = require './fixtures/milestones.json' + + # ISO 8601 dates are in UTC timezone. + utc = do moment(json[0].created_at).toDate().toUTCString + assert.equal utc, 'Sun, 10 Apr 2011 20:09:31 GMT' + + do done \ No newline at end of file