UNPKG

ractive

Version:

Next-generation DOM manipulation

2 lines 71.5 kB
(function(t){"use strict";var e,n,i,r,o,s,a,h,u,l,c,p,f,d,g,v,m,y,w,x,b,_,k,N,F,E,S,M,A,O,T,L,R,C,P,j,q,D,I,z,U,B,V,J,Y,H,$,G,Z,X,W,K,Q,te,ee,ne,ie,re,oe,se,ae,he,ue,le=t.document||null,ce={},pe={},fe={},de={},ge=function(){},ve={},me=/^\s+/,ye=/\s+$/,we="Missing Ractive.parse - cannot parse template. Either preparse or use the version that includes the parser",xe=1,be=2,_e=3,ke=4,Ne=5,Fe=6,Ee=7,Se=8,Me=9,Ae=10,Oe=11,Te=12,Le=20,Re=21,Ce=22,Pe=23,je=24,qe=26,De=30,Ie=31,ze=32,Ue=33,Be=34,Ve=35,Je=36,Ye=40,He={unset:!0},$e={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};try{Object.defineProperty({},"test",{value:0}),Object.defineProperties({},{test:{value:0}}),O=Object.defineProperty,T=Object.defineProperties}catch(Ge){O=function(t,e,n){t[e]=n.value},T=function(t,e){var n;for(n in e)e.hasOwnProperty(n)&&O(t,n,e[n])}}try{Object.create(null),L=Object.create,R=function(){return Object.create(null)}}catch(Ge){L=function(){var t=function(){};return function(e,n){var i;return t.prototype=e,i=new t,n&&Object.defineProperties(i,n),i}}(),R=function(){return{}}}var Ze,Xe,We,Ke=function(t){return t.replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase()})};(function(){var t;le&&(t=le.createElement("div"),void 0!==t.style.transition?(Xe="transition",We="transitionend",Ze=!0):void 0!==t.style.webkitTransition?(Xe="webkitTransition",We="webkitTransitionEnd",Ze=!0):Ze=!1)})(),F=function(t,n,i,r,o){var s,a,h,u,l;"string"==typeof t?s=t:(s=t.n,t.a?a=t.a:t.d&&(h=new TextFragment({descriptor:t.d,root:n,owner:i,contextStack:parentFragment.contextStack}),a=h.toJson(),h.teardown())),l=n.transitions[s]||e.transitions[s],l&&(u=n._transitionManager,u.push(),l.call(n,i.node,u.pop,a,u.info,o))},k=function(t,e){var n,i=[];for(n=le.createElement("div"),n.innerHTML=t;n.firstChild;)i[i.length]=n.firstChild,e.appendChild(n.firstChild);return i},X=function(t,e){var n,i,r;r=t.parentFragment=e.parentFragment,t.root=r.root,t.contextStack=r.contextStack,t.descriptor=e.descriptor,t.index=e.index||0,t.priority=e.descriptor.p||0,r.parentNode&&(t.parentNode=r.parentNode),t.type=e.descriptor.t,e.descriptor.r&&(r.indexRefs&&void 0!==r.indexRefs[e.descriptor.r]?(i=r.indexRefs[e.descriptor.r],t.indexRef=e.descriptor.r,t.value=i,t.render(t.value)):(n=d(t.root,e.descriptor.r,t.contextStack),n?t.resolve(n):(t.ref=e.descriptor.r,t.root._pendingResolution[t.root._pendingResolution.length]=t,t.descriptor.n&&t.render(!1)))),e.descriptor.x&&(t.expressionResolver=new H(t))},W=function(){var t;t=this.root.get(this.keypath,!0),b(t,this.value)||(this.render(t),this.value=t)},K=function(t){this.keypath=t,u(this),this.update(),this.expressionResolver&&(this.expressionResolver=null)},function(){var t,e,n;N=function(e,n,i,r,o){var s,a,h,u,l,c,p;for(h=n.descriptor.i,s=i;r>s;s+=1)a=n.fragments[s],u=s-o,l=s,c=n.keypath+"."+(s-o),p=n.keypath+"."+s,a.index+=o,t(a,h,u,l,o,c,p);g(e)},t=function(i,r,o,s,a,h,u){var l,c,p;for(i.indexRefs&&void 0!==i.indexRefs[r]&&(i.indexRefs[r]=s),l=i.contextStack.length;l--;)p=i.contextStack[l],p.substr(0,h.length)===h&&(i.contextStack[l]=p.replace(h,u));for(l=i.items.length;l--;)switch(c=i.items[l],c.type){case Ee:e(c,r,o,s,a,h,u);break;case Se:t(c.fragment,r,o,s,a,h,u);break;case ke:case be:case _e:n(c,r,o,s,a,h,u)}},e=function(e,n,i,r,o,s,a){var h,u;for(h=e.attributes.length;h--;)u=e.attributes[h],u.fragment&&(t(u.fragment,n,i,r,o,s,a),u.twoway&&u.updateBindings());if(e.proxyFrags)for(h=e.proxyFrags.length;h--;)t(e.proxyFrags[h],n,i,r,o,s,a);e.node._ractive&&(e.node._ractive.keypath.substr(0,s.length)===s&&(e.node._ractive.keypath=e.node._ractive.keypath.replace(s,a)),e.node._ractive.index[n]=r),e.fragment&&t(e.fragment,n,i,r,o,s,a)},n=function(e,n,i,r,o,s,a){var h;if(e.descriptor.x&&(e.keypath&&l(e),e.expressionResolver&&e.expressionResolver.teardown(),e.expressionResolver=new H(e)),e.keypath?e.keypath.substr(0,s.length)===s&&(l(e),e.keypath=e.keypath.replace(s,a),u(e)):e.indexRef===n&&(e.value=r,e.render(r)),e.fragments)for(h=e.fragments.length;h--;)t(e.fragments[h],n,i,r,o,s,a)}}(),function(t){var e,n;$=function(t,i,r,o,s){var a,h;for(this.root=t,this.keypath=i,this.fn=n(r,o.length),this.values=[],this.refs=[],a=o.length;a--;)h=o[a],h[0]?this.values[a]=h[1]:this.refs[this.refs.length]=new e(t,h[1],this,a,s);this.selfUpdating=1>=this.refs.length,this.update()},$.prototype={bubble:function(){this.selfUpdating?this.update():this.deferred||(this.root._defEvals[this.root._defEvals.length]=this,this.deferred=!0)},update:function(){var t;try{t=this.fn.apply(null,this.values)}catch(e){if(this.root.debug)throw e;t=void 0}return b(t,this.value)||(h(this.root,this.keypath),this.root._cache[this.keypath]=t,c(this.root,this.keypath),this.value=t),this},teardown:function(){for(;this.refs.length;)this.refs.pop().teardown();h(this.root,this.keypath),this.root._evaluators[this.keypath]=null},refresh:function(){this.selfUpdating||(this.deferred=!0);for(var t=this.refs.length;t--;)this.refs[t].update();this.deferred&&(this.update(),this.deferred=!1)}},e=function(t,e,n,i,r){this.evaluator=n,this.keypath=e,this.root=t,this.argNum=i,this.type=De,this.priority=r,this.value=n.values[i]=t.get(e),u(this)},e.prototype={update:function(){var t=this.root.get(this.keypath);b(t,this.value)||(this.evaluator.values[this.argNum]=t,this.evaluator.bubble(),this.value=t)},teardown:function(){l(this)}},n=function(e,n){var i,r;if(e=e.replace(/❖/g,"_"),t[e])return t[e];for(r=[];n--;)r[n]="_"+n;return i=Function(r.join(","),"return("+e+")"),t[e]=i,i}}({}),function(){var t,e;H=function(e){var n,i,r,o,s;for(this.root=e.root,this.mustache=e,this.args=[],this.scouts=[],n=e.descriptor.x,s=e.parentFragment.indexRefs,this.str=n.s,r=this.unresolved=n.r?n.r.length:0,r||this.init(),i=0;r>i;i+=1)o=n.r[i],s&&void 0!==s[o]?this.resolveRef(i,!0,s[o]):this.scouts[this.scouts.length]=new t(this,o,e.contextStack,i)},H.prototype={init:function(){this.keypath=e(this.str,this.args),this.createEvaluator(),this.mustache.resolve(this.keypath)},teardown:function(){for(;this.scouts.length;)this.scouts.pop().teardown()},resolveRef:function(t,e,n){this.args[t]=[e,n],--this.unresolved||this.init()},createEvaluator:function(){this.root._evaluators[this.keypath]?this.root._evaluators[this.keypath].refresh():this.root._evaluators[this.keypath]=new $(this.root,this.keypath,this.str,this.args,this.mustache.priority)}},t=function(t,e,n,i){var r,o;o=this.root=t.root,r=d(o,e,n),r?t.resolveRef(i,!1,r):(this.ref=e,this.argNum=i,this.resolver=t,this.contextStack=n,o._pendingResolution[o._pendingResolution.length]=this)},t.prototype={resolve:function(t){this.keypath=t,this.resolver.resolveRef(this.argNum,!1,t)},teardown:function(){this.keypath||a(this)}},e=function(t,e){var n;return n=t.replace(/❖([0-9]+)/g,function(t,n){return e[n][1]}),"("+n.replace(/[\.\[\]]/g,"-")+")"}}(),function(){var t,n;E=function(i,r){var o,s;if(s=t(i,r))return s;if(s=t(e,r))return s;if(le&&(o=le.getElementById(r),o&&"SCRIPT"===o.tagName)){if(!e.parse)throw Error(we);e.partials[r]=e.parse(o.innerHTML)}return s=e.partials[r],s?n(s):(i.debug&&console&&console.warn&&console.warn('Could not find descriptor for partial "'+r+'"'),[])},t=function(t,i){if(t.partials[i]){if("string"==typeof t.partials[i]){if(!e.parse)throw Error(we);t.partials[i]=e.parse(t.partials[i])}return n(t.partials[i])}},n=function(t){return 1===t.length&&"string"==typeof t[0]?t[0]:t}}(),Q=function(t,e){var n,i,r,o,s;if(t.owner=e.owner,t.root=e.root,t.parentNode=e.parentNode,t.contextStack=e.contextStack||[],t.owner.type===ke&&(t.index=e.index),t.owner.parentFragment&&(o=t.owner.parentFragment.indexRefs)){t.indexRefs=R();for(s in o)t.indexRefs[s]=o[s]}for(e.indexRef&&(t.indexRefs||(t.indexRefs={}),t.indexRefs[e.indexRef]=e.index),t.items=[],r={parentFragment:t},n=e.descriptor?e.descriptor.length:0,i=0;n>i;i+=1)r.descriptor=e.descriptor[i],r.index=i,t.items[t.items.length]=t.createItem(r)},function(){var t,e,n;te=function(i,r){var o;return o={descriptor:i.descriptor.f,root:i.root,parentNode:i.parentNode,owner:i},i.descriptor.n?(n(i,r,!0,o),void 0):(y(r)?t(i,r,o):w(r)?e(i,o):n(i,r,!1,o),void 0)},t=function(t,e,n){var i,r;if(e.length<t.length)for(r=t.fragments.splice(e.length,t.length-e.length);r.length;)r.pop().teardown(!0);else if(e.length>t.length)for(i=t.length;e.length>i;i+=1)n.contextStack=t.contextStack.concat(t.keypath+"."+i),n.index=i,t.descriptor.i&&(n.indexRef=t.descriptor.i),t.fragments[i]=t.createFragment(n);t.length=e.length},e=function(t,e){t.length||(e.contextStack=t.contextStack.concat(t.keypath),e.index=0,t.fragments[0]=t.createFragment(e),t.length=1)},n=function(t,e,n,i){var r,o,s;if(o=y(e)&&0===e.length,r=n?o||!e:e&&!o){if(t.length||(i.contextStack=t.contextStack,i.index=0,t.fragments[0]=t.createFragment(i),t.length=1),t.length>1)for(s=t.fragments.splice(1);s.length;)s.pop().teardown(!0)}else t.length&&(t.teardownFragments(!0),t.length=0)}}(),ae=function(t){var e,n,i,r;for(e=0;t.length>e;e+=1)n=t[e],i=t[e-1],r=t[e+1],(n.mustacheType===Me||n.mustacheType===Ae)&&(t.splice(e,1),i&&r&&i.type===xe&&r.type===xe&&(i.value+=r.value,t.splice(e,1)),e-=1);return t},he=function(t){var e,n,i;for(i="";t.length;){if(e=t.indexOf("<!--"),n=t.indexOf("-->"),-1===e&&-1===n){i+=t;break}if(-1!==e&&-1===n)throw"Illegal HTML - expected closing comment sequence ('-->')";if(-1!==n&&-1===e||e>n)throw"Illegal HTML - unexpected closing comment sequence ('-->')";i+=t.substr(0,e),t=t.substring(n+3)}return i},ue=function(t){var e,n,i,r,o,s;for(o=/^\s*\r?\n/,s=/\r?\n\s*$/,e=2;t.length>e;e+=1)n=t[e],i=t[e-1],r=t[e-2],n.type===xe&&i.type===Oe&&r.type===xe&&s.test(r.value)&&o.test(n.value)&&(i.mustacheType!==be&&i.mustacheType!==_e&&(r.value=r.value.replace(s,"\n")),n.value=n.value.replace(o,""),""===n.value&&t.splice(e--,1));return t},function(t){var e=function(t,e,n){var i;if("string"==typeof e&&x(n)){if(i=t.get(e),void 0===i&&(i=0),x(i))t.set(e,i+n);else if(t.debug)throw Error("Cannot add to a non-numeric value")}else if(t.debug)throw Error("Bad arguments")};t.add=function(t,n){e(this,t,void 0===n?1:n)},t.subtract=function(t,n){e(this,t,void 0===n?-1:-n)},t.toggle=function(t){var e;if("string"==typeof t)e=this.get(t),this.set(t,!e);else if(this.debug)throw Error("Bad arguments")}}(ce),function(t){var n,i;t.animate=function(t,e,i){var r,o,s;if("object"==typeof t){i=e||{},s=[];for(r in t)t.hasOwnProperty(r)&&(s[s.length]=n(this,r,t[r],i));return{stop:function(){for(;s.length;)s.pop().stop()}}}return i=i||{},o=n(this,t,e,i),{stop:function(){o.stop()}}},i={stop:ge},n=function(t,n,r,o){var s,a,h,u,l;if(l=t.get(n),b(l,r))return i;for(u=ee.animations.length;u--;)ee.animations[u].keypath===n&&ee.animations[u].stop();return o.easing&&(s="function"==typeof o.easing?o.easing:t.easing&&t.easing[o.easing]?t.easing[o.easing]:e.easing[o.easing],"function"!=typeof s&&(s=null)),a=void 0===o.duration?400:o.duration,h=new G({keypath:n,from:l,to:r,root:t,duration:a,easing:s,step:o.step,complete:o.complete}),ee.push(h),t._animations[t._animations.length]=h,h}}(ce),ce.bind=function(t){var e=this._bound;-1===e.indexOf(t)&&(e[e.length]=t,t.init(this))},ce.cancelFullscreen=function(){e.cancelFullscreen(this.el)},ce.fire=function(t){var e,n,i,r=this._subs[t];if(r)for(e=Array.prototype.slice.call(arguments,1),n=0,i=r.length;i>n;n+=1)r[n].apply(this,e)},ce.get=function(t){var e,n,i,r,o,s,a,h,u;if(!t)return this.data;if(e=this._cache,y(t)){if(!t.length)return this.data;i=t.slice(),r=i.join("."),u=!0}else{if(e.hasOwnProperty(t)&&e[t]!==He)return e[t];i=v(t),r=i.join(".")}return!e.hasOwnProperty(r)||e[r]===He||void 0===e[r]&&u?this._evaluators[r]?(h=this._evaluators[r].value,e[r]=h,h):(o=i.pop(),s=i.join("."),a=i.length?this.get(i):this.data,null!==a&&"object"==typeof a&&a!==He?((n=this._cacheMap[s])?-1===n.indexOf(r)&&(n[n.length]=r):this._cacheMap[s]=[r],h=a[o],this.modifyArrays&&("("===r.charAt(0)||!y(h)||h._ractive&&h._ractive.setting||ne(h,r,this)),e[r]=h,h):void 0):e[r]},h=function(t,e){var n,i;if(t.modifyArrays&&"("!==e.charAt(0)&&(n=t._cache[e],y(n)&&!n._ractive.setting&&ie(n,e,t)),t._cache[e]=He,i=t._cacheMap[e])for(;i.length;)h(t,i.pop())},c=function(t,e,n){var i;for(i=0;t._deps.length>i;i+=1)f(t,e,i,n)},f=function(t,e,n,i){var r,o,s,a;if(r=t._deps[n]){if(o=r[e])for(s=o.length;s--;)o[s].update();if(!i&&(a=t._depsMap[e]))for(s=a.length;s--;)f(t,a[s],n)}},p=function(t,e,n){var i,r,o;for(o=e.length,i=0;t._deps.length>i;i+=1)if(t._deps[i])for(r=o;r--;)f(t,e[r],i,n)},g=function(t){for(var e,n;t._defEvals.length;)e=t._defEvals.pop(),e.update().deferred=!1;for(;t._defAttrs.length;)n=t._defAttrs.pop(),n.update().deferred=!1},u=function(t){var e,n,i,r,o,s,a,h;for(s=t.root,a=t.keypath,h=t.priority,e=s._deps[h]||(s._deps[h]={}),n=e[a]||(e[a]=[]),n[n.length]=t,i=v(a);i.length;)i.pop(),r=i.join("."),o=s._depsMap[r]||(s._depsMap[r]=[]),void 0===o[a]&&(o[a]=0,o[o.length]=a),o[a]+=1,a=r},Z=function(t,e){var n,i;n=e.el?_(e.el):t.el,n&&!e.append&&(n.innerHTML=""),t._transitionManager=i=S(t,e.complete),t.fragment=new C({descriptor:t.template,root:t,owner:t,parentNode:n}),n&&n.appendChild(t.fragment.docFrag),t.ready=!0,t._transitionManager=null,i.ready=!0,i.active||i.complete()},d=function(t,e,n){var i,r,o,s,a,h;if("."===e)return n[n.length-1];if("."===e.charAt(0))return n[n.length-1]+e;for(i=v(e),r=i.pop(),n=n.concat();n.length;)if(o=n.pop(),s=v(o),a=t.get(s.concat(i)),"object"==typeof a&&null!==a&&a.hasOwnProperty(r)){h=o+"."+e;break}return h||void 0===t.get(e)||(h=e),h},a=function(t){if(t.keypath)l(t);else{var e=t.root._pendingResolution.indexOf(t);-1!==e&&t.root._pendingResolution.splice(e,1)}},l=function(t){var e,n,i,r,o,s,a;for(o=t.root,s=t.keypath,a=t.priority,e=o._deps[a][s],e.splice(e.indexOf(t),1),n=v(s);n.length;)n.pop(),i=n.join("."),r=o._depsMap[i],r[s]-=1,r[s]||(r.splice(r.indexOf(s),1),r[s]=void 0),s=i},ce.link=function(t){var e=this;return function(n){e.set(t,n)}},function(t){var e,n;t.observe=function(t,n,i){var r,o=[];if("object"==typeof t){i=n;for(r in t)t.hasOwnProperty(r)&&(n=t[r],o[o.length]=e(this,r,n,i));return{cancel:function(){for(;o.length;)o.pop().cancel()}}}return e(this,t,n,i)},e=function(t,e,i,r){var o;return o=new n(t,e,i,r),r&&r.init===!1||o.update(),u(o),{cancel:function(){l(o)}}},n=function(t,e,n,i){this.root=t,this.keypath=e,this.callback=n,this.priority=0,this.context=i&&i.context?i.context:t},n.prototype={update:function(){var t;if(t=this.root.get(this.keypath,!0),!b(t,this.value)){try{this.callback.call(this.context,t,this.value)}catch(e){if(this.root.debug)throw e}this.value=t}}}}(ce),ce.off=function(t,e){var n,i;e||(t?this._subs[t]=[]:this._subs={}),n=this._subs[t],n&&(i=n.indexOf(e),-1!==i&&n.splice(i,1))},ce.on=function(t,e){var n,i,r=this;if("object"==typeof t){n=[];for(i in t)t.hasOwnProperty(i)&&(n[n.length]=this.on(i,t[i]));return{cancel:function(){for(;n.length;)n.pop().cancel()}}}return this._subs[t]?this._subs[t].push(e):this._subs[t]=[e],{cancel:function(){r.off(t,e)}}},ce.renderHTML=function(){return console.log(this.fragment),""+this.fragment},ce.requestFullscreen=function(){e.requestFullscreen(this.el)},function(t){var e,n;t.set=function(t,i,r){var o,s,a,h,u,l,c;if(s=[""],o=[],w(t)&&(r=i),l=this._transitionManager,this._transitionManager=c=S(this,r),w(t))for(a in t)t.hasOwnProperty(a)&&(u=v(a),h=u.join("."),i=t[a],e(this,h,u,i,o,s));else u=v(t),h=u.join("."),e(this,h,u,i,o,s);return o.length&&this._pendingResolution.length&&n(this),s.length&&p(this,s,!0),o.length&&p(this,o),g(this),this._transitionManager=l,c.ready=!0,c.active||c.complete(),this.setting||(this.setting=!0,"object"==typeof t?this.fire("set",t):this.fire("set",t,i),this.setting=!1),this},e=function(t,e,n,i,r,o){var s,a,u,l,c,p;if(l=n.slice(),c=[],s=t.get(e),s!==i){for(u=t.data;n.length>1;)a=c[c.length]=n.shift(),u[a]||(p||(p=c.join(".")),u[a]=/^\s*[0-9]+\s*$/.test(n[0])?[]:{}),u=u[a];a=n[0],u[a]=i}else if("object"!=typeof i)return;for(h(t,p||e),r[r.length]=e;l.length>1;)l.pop(),e=l.join("."),-1===o.indexOf(e)&&(o[o.length]=e)},n=function(t){var e,n,i;for(e=t._pendingResolution.length;e--;)n=t._pendingResolution.splice(e,1)[0],(i=d(t,n.ref,n.contextStack))?n.resolve(i):t._pendingResolution[t._pendingResolution.length]=n}}(ce),ce.teardown=function(t){var e,n,i;for(this.fire("teardown"),i=this._transitionManager,this._transitionManager=n=S(this,t),this.fragment.teardown(!0);this._animations[0];)this._animations[0].stop();for(e in this._cache)h(this,e);for(;this._bound.length;)this.unbind(this._bound.pop());this._transitionManager=i,n.ready=!0,n.active||n.complete()},ce.toggleFullscreen=function(){e.isFullscreen(this.el)?this.cancelFullscreen():this.requestFullscreen()},ce.unbind=function(t){var e,n=this._bound;e=n.indexOf(t),-1!==e&&(n.splice(e,1),t.teardown(this))},ce.update=function(t,e){var n,i;return"function"==typeof t&&(e=t),i=this._transitionManager,this._transitionManager=n=S(this,e),h(this,t||""),c(this,t||""),g(this),this._transitionManager=i,n.ready=!0,n.active||n.complete(),"string"==typeof t?this.fire("update",t):this.fire("update"),this},pe.backbone=function(t,e){var n,i,r,o,s,a,h;return e&&(e+=".",s=RegExp("^"+e.replace(/\./g,"\\.")),a=e.length),{init:function(u){e?(h=function(t){var n,i;i={};for(n in t)t.hasOwnProperty(n)&&(i[e+n]=t[n]);return i},o=function(t){n||(i=!0,u.set(h(t.changed)),i=!1)},r=function(e,r){i||s.test(e)&&(n=!0,t.set(e.substring(a),r),n=!1)}):(o=function(t){n||(i=!0,u.set(t.changed),i=!1)},r=function(e,r){i||(n=!0,t.set(e,r),n=!1)}),t.on("change",o),u.on("set",r),u.set(e?h(t.attributes):t.attributes)},teardown:function(e){t.off("change",o),e.off("set",r)}}},pe.statesman=function(t,e){var n,i,r,o,s,a,h;return e&&(e+=".",s=RegExp("^"+e.replace(/\./g,"\\.")),a=e.length,h=function(t){var n,i;if(t){i={};for(n in t)t.hasOwnProperty(n)&&(i[e+n]=t[n]);return i}}),{init:function(u){var l;e?(o=function(t){n||(i=!0,t=h(t),u.set(t),i=!1)},u.twoway&&(r=function(e,r){i||s.test(e)&&(n=!0,t.set(e.substring(a),r),n=!1)})):(o=function(t){n||(i=!0,u.set(t),i=!1)},u.twoway&&(r=function(e,r){i||(n=!0,t.set(e,r),n=!1)})),t.on("change",o),u.twoway&&u.on("set",r),l=e?h(t.get()):t.get(),l&&u.set(e?h(t.get()):t.get())},teardown:function(e){t.off("change",o),e.off("set",r)}}},n={linear:function(t){return t},easeIn:function(t){return Math.pow(t,3)},easeOut:function(t){return Math.pow(t-1,3)+1},easeInOut:function(t){return 1>(t/=.5)?.5*Math.pow(t,3):.5*(Math.pow(t-2,3)+2)}},fe.tap=function(t,e){var n,i,r,o;return r=5,o=400,n=function(t){var n,i,s,a,h,u;i=t.clientX,s=t.clientY,n=this,a=function(t){e({node:n,original:t}),u()},h=function(t){(Math.abs(t.clientX-i)>=r||Math.abs(t.clientY-s)>=r)&&u()},u=function(){window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",a)},window.addEventListener("mousemove",h),window.addEventListener("mouseup",a),setTimeout(u,o)},t.addEventListener("mousedown",n),i=function(t){var n,i,s,a,h,u,l,c;1===t.touches.length&&(a=t.touches[0],i=a.clientX,s=a.clientY,n=this,h=a.identifier,l=function(t){var i;i=t.changedTouches[0],i.identifier!==h&&c(),t.preventDefault(),e({node:n,original:t}),c()},u=function(t){var e;(1!==t.touches.length||t.touches[0].identifier!==h)&&c(),e=t.touches[0],(Math.abs(e.clientX-i)>=r||Math.abs(e.clientY-s)>=r)&&c()},c=function(){window.removeEventListener("touchmove",u),window.removeEventListener("touchend",l),window.removeEventListener("touchcancel",c)},window.addEventListener("touchmove",u),window.addEventListener("touchend",l),window.addEventListener("touchcancel",c),setTimeout(c,o))},t.addEventListener("touchstart",i),{teardown:function(){t.removeEventListener("mousedown",n),t.removeEventListener("touchstart",i)}}},function(){var t,n,r,o,s,a,h,u,l,c,p,f,d;i=function(t){var n,i;return n=this,i=function(t){c(this,i,t||{})},i.prototype=L(n.prototype),n!==e&&o(i,n),a(i,t),h(i),u(i,t),l(i),i.extend=n.extend,i},p=["data","partials","transitions","eventDefinitions"],f=["el","template","complete","modifyArrays","twoway","lazy","append","preserveWhitespace","sanitize"],d=p.concat(f),o=function(t,e){p.forEach(function(i){e[i]&&(t[i]=n(e[i]))}),f.forEach(function(n){void 0!==e[n]&&(t[n]=e[n])})},s=function(t,e){return/_super/.test(t)?function(){var n=this._super;this._super=e,t.apply(this,arguments),this._super=n}:t},a=function(t,e){var n,i;p.forEach(function(n){var i=e[n];i&&(t[n]?r(t[n],i):t[n]=i)}),f.forEach(function(n){void 0!==e[n]&&(t[n]=e[n])});for(n in e)e.hasOwnProperty(n)&&!t.prototype.hasOwnProperty(n)&&-1===d.indexOf(n)&&(i=e[n],t.prototype[n]="function"==typeof i&&"function"==typeof t.prototype[n]?s(i,t.prototype[n]):i)},h=function(t){var n;if("string"==typeof t.template){if(!e.parse)throw Error(we);if("#"===t.template.charAt(0)&&le){if(n=le.getElementById(t.template.substring(1)),!n||"SCRIPT"!==n.tagName)throw Error("Could not find template element ("+t.template+")");t.template=e.parse(n.innerHTML,t)}else t.template=e.parse(t.template,t)}},u=function(t,e){w(t.template)&&(t.partials||(t.partials={}),r(t.partials,t.template.partials),e.partials&&r(t.partials,e.partials),t.template=t.template.template)},l=function(t){var n,i;if(t.partials)for(n in t.partials)if(t.partials.hasOwnProperty(n)){if("string"==typeof t.partials[n]){if(!e.parse)throw Error(we);i=e.parse(t.partials[n],t)}else i=t.partials[n];t.partials[n]=i}},c=function(i,r,o){!o.template&&r.template&&(o.template=r.template),p.forEach(function(e){o[e]?t(o[e],r[e]):r[e]&&(o[e]=n(r[e]))}),f.forEach(function(t){void 0===o[t]&&void 0!==r[t]&&(o[t]=r[t])}),e.call(i,o),i.init&&i.init.call(i,o)},t=function(t,e){var n;for(n in e)e.hasOwnProperty(n)&&!t.hasOwnProperty(n)&&(t[n]=e[n])},n=function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n},r=function(t,e){var n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}}(),o=function(t,n){return x(t)&&x(n)?e.interpolators.number(+t,+n):y(t)&&y(n)?e.interpolators.array(t,n):w(t)&&w(n)?e.interpolators.object(t,n):function(){return n}},s={number:function(t,e){var n=e-t;return n?function(e){return t+e*n}:function(){return t}},array:function(t,n){var i,r,o,s;for(i=[],r=[],s=o=Math.min(t.length,n.length);s--;)r[s]=e.interpolate(t[s],n[s]);for(s=o;t.length>s;s+=1)i[s]=t[s];for(s=o;n.length>s;s+=1)i[s]=n[s];return function(t){for(var e=o;e--;)i[e]=r[e](t);return i}},object:function(t,n){var i,r,o,s,a=[];o={},r={};for(s in t)t.hasOwnProperty(s)&&(n.hasOwnProperty(s)?(a[a.length]=s,r[s]=e.interpolate(t[s],n[s])):o[s]=t[s]);for(s in n)n.hasOwnProperty(s)&&!t.hasOwnProperty(s)&&(o[s]=n[s]);return i=a.length,function(t){for(var e,n=i;n--;)e=a[n],o[e]=r[e](t);return o}}};var Qe=R();T(Qe,{preserveWhitespace:{enumerable:!0,value:!1},append:{enumerable:!0,value:!1},twoway:{enumerable:!0,value:!0},modifyArrays:{enumerable:!0,value:!0},data:{enumerable:!0,value:{}},lazy:{enumerable:!0,value:!1},debug:{enumerable:!0,value:!1},transitions:{enumerable:!0,value:{}},eventDefinitions:{enumerable:!0,value:{}}}),e=function(t){var n,i,r,o,s,a;for(n in Qe)t.hasOwnProperty(n)||(t[n]="object"==typeof Qe[n]?{}:Qe[n]);if(T(this,{_guid:{value:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e,n;return e=0|16*Math.random(),n="x"==t?e:8|3&e,n.toString(16)})},_subs:{value:R()},_cache:{value:{}},_cacheMap:{value:R()},_deps:{value:[]},_depsMap:{value:R()},_pendingResolution:{value:[]},_defAttrs:{value:[]},_defEvals:{value:[]},_proxies:{value:R()},_customProxies:{value:R()},_evaluators:{value:R()},_bound:{value:[]},_transitionManager:{value:null,writable:!0},_animations:{value:[]},nodes:{value:{}}}),this.modifyArrays=t.modifyArrays,this.twoway=t.twoway,this.lazy=t.lazy,this.debug=t.debug,t.el&&(this.el=_(t.el),!this.el&&this.debug))throw Error("Could not find container element");if(this.data=t.data||{},this.partials={},this.transitions=t.transitions,this.eventDefinitions=t.eventDefinitions,t.bindings)if(y(t.bindings))for(r=0;t.bindings.length>r;r+=1)this.bind(t.bindings[r]);else this.bind(t.bindings);if(o=t.template,"string"==typeof o){if(!e.parse)throw Error(we);if("#"===o.charAt(0)&&le){if(s=le.getElementById(o.substring(1)),!s)throw Error("Could not find template element ("+o+")");a=e.parse(s.innerHTML,t)}else a=e.parse(o,t)}else a=o;if(w(a)&&(this.partials=a.partials,a=a.template),a&&1===a.length&&"string"==typeof a[0]&&(a=a[0]),this.template=a,t.partials)for(n in t.partials)if(t.partials.hasOwnProperty(n)){if(i=t.partials[n],"string"==typeof i){if(!e.parse)throw Error(we);i=e.parse(i,t)}this.partials[n]=i}for(n in this.partials)this.partials.hasOwnProperty(n)&&1===this.partials[n].length&&"string"==typeof this.partials[n][0]&&(this.partials[n]=this.partials[n][0]);Z(this,{el:this.el,append:t.append,complete:t.complete})},function(){var t,e,i,r;le&&(t=function(t,e){var n,i={};for(n=e.length;n--;)i[e[n]]=t[e[n]];return i},e=function(t,e,n,i){for(var r,o=e.length;o--;)r=e[o],t.style[r]=n&&n[r]?"function"==typeof n[r]?n[r](i):n[r]:0},i=function(t,e){var n;if(!e)return t;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},r=function(r,o,s,a){return"string"==typeof r&&(r=[r]),function(h,u,l,c,p){var f,d,g,v,m,y,w,x,b,_,k;l=tn(l),y=l.duration||o.duration,n=Ke(l.easing||o.easing),w=(l.delay||o.delay||0)+(l.stagger||o.stagger||0)*c.i,x=p?s:a,b=p?a:s,d=window.getComputedStyle(h),m=h.getAttribute("style"),p?(_=h.style.position,k=h.style.visibility,h.style.position="absolute",h.style.visibility="hidden",setTimeout(function(){g=t(d,r),x=s,b=i(g,a),h.style.position=_,h.style.visibility=k,e(h,r,x,l),setTimeout(v,0)},w)):setTimeout(function(){g=t(d,r),x=i(g,a),b=s,e(h,r,x,l),setTimeout(v,0)},w),v=function(){h.style[Xe+"Duration"]=y/1e3+"s",h.style[Xe+"Properties"]=r.map(Ke).join(","),h.style[Xe+"TimingFunction"]=n,f=function(){h.removeEventListener(We,f),p&&h.setAttribute("style",m||""),u()},h.addEventListener(We,f),e(h,r,b,l)}}},de.slide=r(["height","borderTopWidth","borderBottomWidth","paddingTop","paddingBottom","overflowY"],{duration:400,easing:"easeInOut"},{overflowY:"hidden"},{overflowY:"hidden"}),de.fade=r("opacity",{duration:300,easing:"linear"}),de.fly=r(["opacity","left","position"],{duration:400,easing:"easeOut"},{position:"relative",left:"-500px"},{position:"relative",left:0}))}();var tn=function(t){return"fast"===t?{duration:200}:"slow"===t?{duration:600}:x(t)?{duration:+t}:t||{}};(function(t){var e,n,i;le&&(n=function(t,e,r){var o,s;return 3===t.nodeType?(i(t,e,r),void 0):(o=Array.prototype.slice.call(t.childNodes),s=function(){return o.length?(n(o.shift(),s,r),void 0):(e(),void 0)},s(),void 0)},i=function(t,e,n){var i,r,o,s;return i=t._hiddenData,(r=i.length)?(s=0,o=setInterval(function(){var n,a,h,u,l;n=i.substr(0,s),a=i.substring(s),h=/^\w+/.exec(a),u=h?h[0].length:0,l=Array(u+1).join(" "),t.data=n+l,s===r&&(clearInterval(o),delete t._hiddenData,e()),s+=1},n),void 0):(e(),void 0)},e=function(t,e,i){var r,o,s,a;i=tn(i),r=i.interval||(i.speed?1e3/i.speed:i.duration?t.textContent.length/i.duration:4),o=t.getAttribute("style"),s=window.getComputedStyle(t),t.style.visibility="hidden",setTimeout(function(){var h,u,l;u=s.width,h=s.height,l=s.visibility,a(t),setTimeout(function(){t.style.width=u,t.style.height=h,t.style.visibility="visible",n(t,function(){t.setAttribute("style",o||""),e()},r)},i.delay||0)}),a=function(t){var e,n;if(3===t.nodeType)return t._hiddenData=""+t.data,t.data="",void 0;for(e=Array.prototype.slice.call(t.childNodes),n=e.length;n--;)a(e[n])}},t.typewriter=e)})(de),function(t){var e,n,i,r;if(le){if(t.fullscreenEnabled=le.fullscreenEnabled||le.mozFullScreenEnabled||le.webkitFullscreenEnabled,!t.fullscreenEnabled)return t.requestFullscreen=t.cancelFullscreen=ge,void 0;r=le.createElement("div"),r.requestFullscreen?e="requestFullscreen":r.mozRequestFullScreen?e="mozRequestFullScreen":r.webkitRequestFullscreen&&(e="webkitRequestFullscreen"),t.requestFullscreen=function(t){t[e]&&t[e]()},le.cancelFullscreen?n="cancelFullscreen":le.mozCancelFullScreen?n="mozCancelFullScreen":le.webkitCancelFullScreen&&(n="webkitCancelFullScreen"),t.cancelFullscreen=function(){le[n]()},void 0!==le.fullscreenElement?i="fullscreenElement":void 0!==le.mozFullScreenElement?i="mozFullScreenElement":void 0!==le.webkitFullscreenElement&&(i="webkitFullscreenElement"),t.isFullscreen=function(t){return t===le[i]}}}(e),G=function(t){var n;this.startTime=Date.now();for(n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);this.interpolator=e.interpolate(this.from,this.to),this.running=!0},G.prototype={tick:function(){var t,e,n,i,r;return this.running?(i=Date.now(),t=i-this.startTime,t>=this.duration?(this.root.set(this.keypath,this.to),this.step&&this.step(1,this.to),this.complete&&this.complete(1,this.to),r=this.root._animations.indexOf(this),-1===r&&console&&console.warn&&console.warn("Animation was not found"),this.root._animations.splice(r,1),this.running=!1,!1):(e=this.easing?this.easing(t/this.duration):t/this.duration,n=this.interpolator(e),this.root.set(this.keypath,n),this.step&&this.step(e,n),!0)):!1},stop:function(){var t;this.running=!1,t=this.root._animations.indexOf(this),-1===t&&console&&console.warn&&console.warn("Animation was not found"),this.root._animations.splice(t,1)}},ee={animations:[],tick:function(){var e,n;for(e=0;this.animations.length>e;e+=1)n=this.animations[e],n.tick()||this.animations.splice(e--,1);this.animations.length?t.requestAnimationFrame(this.boundTick):this.running=!1},boundTick:function(){ee.tick()},push:function(t){this.animations[this.animations.length]=t,this.running||(this.running=!0,this.tick())}},function(t,e,n){var i;if(n.requestAnimationFrame)return M=n.requestAnimationFrame,A=n.cancelAnimationFrame,void 0;for(i=0;t.length>i&&!M;++i)M=n[t[i]+"RequestAnimationFrame"],A=n[t[i]+"CancelAnimationFrame"]||n[t[i]+"CancelRequestAnimationFrame"];M||(M=function(t){var i,r,o;return i=Date.now(),r=Math.max(0,16-(i-e)),o=n.setTimeout(function(){t(i+r)},r),e=i+r,o}),A||(A=function(t){n.clearTimeout(t)})}(["ms","moz","webkit","o"],0,t),function(){var t,e,n,i,r,o;ne=function(t,n,i){var r,o,s;t._ractive?(r=t._ractive.roots,o=t._ractive.keypathsByGuid,o[i._guid]||(r[r.length]=i,o[i._guid]=[]),s=o[i._guid],-1===s.indexOf(n)&&(s[s.length]=n)):(O(t,"_ractive",{value:{roots:[i],keypathsByGuid:{}},configurable:!0}),t._ractive.keypathsByGuid[i._guid]=[n],e(t))},ie=function(t,e,i){var r,o,s,a;if(!t._ractive)throw Error("Attempted to remove keypath from non-wrapped array. This error is unexpected - please send a bug report to @rich_harris");if(r=t._ractive.roots,o=t._ractive.keypathsByGuid,!o[i._guid])throw Error("Ractive instance was not listed as a dependent of this array. This error is unexpected - please send a bug report to @rich_harris");if(s=o[i._guid],a=s.indexOf(e),-1===a)throw Error("Attempted to unlink non-linked keypath from array. This error is unexpected - please send a bug report to @rich_harris");s.splice(a,1),s.length||(r.splice(r.indexOf(i),1),o[i._guid]=null),r.length||n(t)},t=function(t,e,n){var i,r,o,s,a,u;u=t._ractive.keypathsByGuid,i=function(t){for(var e=t.length;e--;)r(t[e])},r=function(t){var e=t._transitionManager;t._transitionManager=S(t,ge),o(t,u[t._guid]),t._transitionManager=e},o=function(t,e){for(var n=e.length;n--;)s(t,e[n])},s=function(t,i){var r,o,s,u,l,c,f;for(h(t,i),l=[],c=[],f=0;t._deps.length>f;f+=1)if(r=t._deps[f],r&&(o=r[i])){for(a(t,i,o,l,c),g(t);l.length;)l.pop().smartUpdate(e,n);for(;c.length;)c.pop().update()}for(g(t),u=[],s=v(i);s.length;)s.pop(),u[u.length]=s.join(".");u[u.length]=i+".length",p(t,u,!0)},a=function(t,e,n,i,r){var o,s;for(o=n.length;o--;)s=n[o],s.type===De?s.update():s.keypath===e&&s.type===ke?i[i.length]=s:r[r.length]=s},i(t._ractive.roots)},i=[],o=["pop","push","reverse","shift","sort","splice","unshift"],o.forEach(function(e){var n=function(){var n=Array.prototype[e].apply(this,arguments);return this._ractive.setting=!0,t(this,e,arguments),this._ractive.setting=!1,n};O(i,e,{value:n})}),r={},r.__proto__?(e=function(t){t.__proto__=i},n=function(t){delete t._ractive,t.__proto__=Array.prototype }):(e=function(t){var e,n;for(e=o.length;e--;)n=o[e],O(t,n,{value:i[n]})},n=function(t){var e;for(e=o.length;e--;)delete t[o[e]];delete t._ractive})}(),function(){var t;t={"accept-charset":"acceptCharset",accesskey:"accessKey",bgcolor:"bgColor","class":"className",codebase:"codeBase",colspan:"colSpan",contenteditable:"contentEditable",datetime:"dateTime",dirname:"dirName","for":"htmlFor","http-equiv":"httpEquiv",ismap:"isMap",maxlength:"maxLength",novalidate:"noValidate",pubdate:"pubDate",readonly:"readOnly",rowspan:"rowSpan",tabindex:"tabIndex",usemap:"useMap"},j=function(e){var n,i,r,o,s,a,h,u,l,c,p;if(n=e.name,i=e.value,r=n.indexOf(":"),-1!==r&&(o=n.substr(0,r),"xmlns"!==o&&(n=n.substring(r+1),this.namespace=$e[o],!this.namespace)))throw'Unknown namespace ("'+o+'")';if(null===i||"string"==typeof i)return e.parentNode&&(this.namespace?e.parentNode.setAttributeNS(this.namespace,n,i):e.parentNode.setAttribute(n,i),"id"===n.toLowerCase()&&(e.root.nodes[i]=e.parentNode)),this.name=n,this.value=i,void 0;if(this.root=e.root,this.element=e.element,this.parentNode=e.parentNode,this.name=n,this.lcName=n.toLowerCase(),this.parentFragment=this.element.parentFragment,this.fragment=new B({descriptor:i,root:this.root,owner:this,contextStack:e.contextStack}),this.parentNode){for(this.parentNode&&!this.namespace&&e.parentNode.namespaceURI===$e.html&&(h=this.lcName,u=t[h]||h,void 0!==e.parentNode[u]&&(this.propertyName=u),("boolean"==typeof e.parentNode[u]||"value"===u)&&(this.useProperty=!0)),this.selfUpdating=!0,l=this.fragment.items.length;l--;)if(c=this.fragment.items[l],c.type!==xe){if(c.type!==be){this.selfUpdating=!1;break}if(p){this.selfUpdating=!1;break}p=!0}this.root.twoway&&(s=this.element.descriptor.e.toLowerCase(),a=!("name"!==u&&"value"!==u&&"checked"!==u||"input"!==s&&"textarea"!==s&&"select"!==s)),a&&(this.isBindable=!0,"name"===u&&(this.isTwowayNameAttr=!0)),this.ready=!0}},j.prototype={bind:function(t){var e,n,i,r,o=this,s=this.parentNode;if(!this.fragment)return!1;if(1!==this.fragment.items.length||this.fragment.items[0].type!==be||!this.fragment.items[0].keypath&&!this.fragment.items[0].ref)return this.root.debug&&console&&console.warn&&console.warn("Not a valid two-way data binding candidate - must be a single interpolator:",this.fragment.items),!1;if(this.interpolator=this.fragment.items[0],this.keypath=this.interpolator.keypath||this.interpolator.descriptor.r,"SELECT"===s.tagName&&"value"===this.propertyName)for(e=s.getElementsByTagName("option"),r=e.length,i=0;r>i;i+=1)if(n=e[i],n.hasAttribute("selected")){this.root.set(this.keypath,n.value);break}"checkbox"===s.type||"radio"===s.type?"name"===this.propertyName?(s.name="{{"+this.keypath+"}}",this.updateViewModel=function(){s.checked&&o.root.set(o.keypath,s.value)}):"checked"===this.propertyName&&(this.updateViewModel=function(){o.root.set(o.keypath,s.checked)}):this.updateViewModel=function(){var t;t=s.value,"0"===t?t=0:""!==t&&(t=+t||t),o.root.set(o.keypath,t)},this.updateViewModel&&(this.twoway=!0,s.addEventListener("change",this.updateViewModel),s.addEventListener("click",this.updateViewModel),s.addEventListener("blur",this.updateViewModel),t||(s.addEventListener("keyup",this.updateViewModel),s.addEventListener("keydown",this.updateViewModel),s.addEventListener("keypress",this.updateViewModel),s.addEventListener("input",this.updateViewModel)))},updateBindings:function(){this.keypath=this.interpolator.keypath||this.interpolator.r,"name"===this.propertyName&&(this.parentNode.name="{{"+this.keypath+"}}")},teardown:function(){this.updateViewModel&&(this.parentNode.removeEventListener("change",this.updateViewModel),this.parentNode.removeEventListener("click",this.updateViewModel),this.parentNode.removeEventListener("blur",this.updateViewModel),this.parentNode.removeEventListener("keyup",this.updateViewModel),this.parentNode.removeEventListener("keydown",this.updateViewModel),this.parentNode.removeEventListener("keypress",this.updateViewModel),this.parentNode.removeEventListener("input",this.updateViewModel)),this.fragment&&this.fragment.teardown()},bubble:function(){this.selfUpdating?this.update():!this.deferred&&this.ready&&(this.root._defAttrs[this.root._defAttrs.length]=this,this.deferred=!0)},update:function(){var t,e;if(!this.ready)return this;if(this.twoway){if(e=this.lcName,t=this.interpolator.value,"name"===e&&("checkbox"===this.parentNode.type||"radio"===this.parentNode.type))return this.parentNode.checked=t===this.parentNode.value?!0:!1,this;if(le.activeElement===this.parentNode)return this}if(t=this.fragment.getValue(),void 0===t&&(t=""),t!==this.value){if(this.useProperty)return this.parentNode[this.propertyName]=t,this;if(this.namespace)return this.parentNode.setAttributeNS(this.namespace,this.name,t),this;"id"===this.lcName&&(void 0!==this.value&&(this.root.nodes[this.value]=void 0),this.root.nodes[t]=this.parentNode),this.parentNode.setAttribute(this.name,t),this.value=t}return this},toString:function(){var t;return null===this.value?this.name:this.fragment?(t=""+this.fragment,this.name+"="+JSON.stringify(t)):this.name+"="+JSON.stringify(this.value)}}}(),P=function(t,e){var n,i,r,o,s,a,h,u,l,c,p,f;if(this.type=Ee,n=this.parentFragment=t.parentFragment,i=this.descriptor=t.descriptor,this.root=f=n.root,this.parentNode=n.parentNode,this.index=t.index,this.eventListeners=[],this.customEventListeners=[],this.parentNode){if(i.a&&i.a.xmlns){if(r=i.a.xmlns,"string"!=typeof r)throw Error("Namespace attribute cannot contain mustaches")}else r="svg"===i.e.toLowerCase()?$e.svg:this.parentNode.namespaceURI;this.node=le.createElementNS(r,i.e)}if(i.f&&("string"!=typeof i.f||this.node&&this.node.namespaceURI!==$e.html?(this.fragment=new C({descriptor:i.f,root:f,parentNode:this.node,contextStack:n.contextStack,owner:this}),e&&this.node.appendChild(this.fragment.docFrag)):(this.html=i.f,e&&(this.node.innerHTML=this.html))),e&&i.v)for(o in i.v)if(i.v.hasOwnProperty(o))for(s=o.split("-"),a=s.length;a--;)this.addEventProxy(s[a],i.v[o],n.contextStack);this.attributes=[],c=[];for(u in i.a)i.a.hasOwnProperty(u)&&(l=i.a[u],h=new j({element:this,name:u,value:void 0===l?null:l,root:f,parentNode:this.node,contextStack:n.contextStack}),this.attributes[this.attributes.length]=h,h.isBindable&&c.push(h),h.isTwowayNameAttr?p=h:h.update());if(e){for(;c.length;)c.pop().bind(this.root.lazy);p&&(p.updateViewModel(),p.update()),e.appendChild(this.node),i.t1&&F(i.t1,f,this,n.contextStack,!0)}},P.prototype={addEventProxy:function(t,n,i){var r,o,s,a,h,u,l,c=this.root;if(this.node._ractive||O(this.node,"_ractive",{value:{keypath:i.length?i[i.length-1]:"",index:this.parentFragment.indexRefs}}),r="string"==typeof n?n:n.n,l=t+"="+r,n.a?o=n.a:n.d&&(s=!0,o=new B({descriptor:n.d,root:this.root,owner:this,contextStack:i}),this.proxyFrags||(this.proxyFrags=[]),this.proxyFrags[this.proxyFrags.length]=o),void 0!==o){if(this.node._ractive[l])throw Error("You cannot have two proxy events with the same trigger event ("+l+")");this.node._ractive[l]={dynamic:s,payload:o}}return(a=c.eventDefinitions[t]||e.eventDefinitions[t])?(c._customProxies[l]||(c._customProxies[l]=function(t){var e,n;if(!t.node)throw Error("Proxy event definitions must fire events with a `node` property");t.keypath=t.node._ractive.keypath,t.context=c.get(t.keypath),t.index=t.node._ractive.index,t.node._ractive[l]&&(e=t.node._ractive[l],n=e.dynamic?e.payload.toJson():e.payload),c.fire(r,t,n)}),u=c._customProxies[l],h=a(this.node,u),this.customEventListeners[this.customEventListeners.length]=h,void 0):(void 0!==this.node["on"+t]&&c.debug&&console&&console.warn&&console.warn("Invalid event handler ("+t+")"),c._proxies[l]||(c._proxies[l]=function(t){var e,n,i={node:this,original:t,keypath:this._ractive.keypath,context:c.get(this._ractive.keypath),index:this._ractive.index};this._ractive&&this._ractive[l]&&(e=this._ractive[l],n=e.dynamic?e.payload.toJson():e.payload),c.fire(r,i,n)}),u=c._proxies[l],this.eventListeners[this.eventListeners.length]={n:t,h:u},this.node.addEventListener(t,u),void 0)},teardown:function(t){var e,n=this;for(n.fragment&&n.fragment.teardown(!1);n.attributes.length;)n.attributes.pop().teardown();for(;n.eventListeners.length;)e=n.eventListeners.pop(),n.node.removeEventListener(e.n,e.h);for(;n.customEventListeners.length;)n.customEventListeners.pop().teardown();if(this.proxyFrags)for(;this.proxyFrags.length;)this.proxyFrags.pop().teardown();this.descriptor.t2&&F(this.descriptor.t2,this.root,this,this.parentFragment.contextStack,!1),t&&this.root._transitionManager.nodesToDetach.push(this.node)},firstNode:function(){return this.node},findNextNode:function(){return null},bubble:function(){},toString:function(){var t,e,n;for(t="<"+this.descriptor.e,n=this.attributes.length,e=0;n>e;e+=1)t+=" "+(""+this.attributes[e]);return t+=">",this.html?t+=this.html:this.fragment&&(t+=""+this.fragment),t+="</"+this.descriptor.e+">"}},C=function(t){return t.parentNode&&(this.docFrag=le.createDocumentFragment()),"string"==typeof t.descriptor?(this.html=t.descriptor,this.docFrag&&(this.nodes=k(t.descriptor,this.docFrag)),void 0):(Q(this,t),void 0)},C.prototype={createItem:function(t){if("string"==typeof t.descriptor)return new U(t,this.docFrag);switch(t.descriptor.t){case be:return new D(t,this.docFrag);case ke:return new z(t,this.docFrag);case _e:return new I(t,this.docFrag);case Ee:return new P(t,this.docFrag);case Se:return new q(t,this.docFrag);default:throw"WTF? not sure what happened here..."}},teardown:function(t){var e;if(t&&this.nodes)for(;this.nodes.length;)e=this.nodes.pop(),e.parentNode.removeChild(e);else if(this.items)for(;this.items.length;)this.items.pop().teardown(t)},firstNode:function(){return this.items&&this.items[0]?this.items[0].firstNode():this.nodes?this.nodes[0]||null:null},findNextNode:function(t){var e=t.index;return this.items[e+1]?this.items[e+1].firstNode():this.owner===this.root?null:this.owner.findNextNode(this)},toString:function(){var t,e,n,i;if(this.html)return this.html;if(t="",!this.items)return t;for(n=this.items.length,e=0;n>e;e+=1)i=this.items[e],t+=""+i;return t}},D=function(t,e){this.type=be,e&&(this.node=le.createTextNode(""),e.appendChild(this.node)),X(this,t)},D.prototype={update:W,resolve:K,teardown:function(t){a(this),t&&this.parentNode.removeChild(this.node)},render:function(t){this.node&&(this.node.data=void 0===t?"":t)},firstNode:function(){return this.node},toString:function(){var t=void 0!==this.value?""+this.value:"";return t.replace("<","&lt;").replace(">","&gt;")}},q=function(t,e){var n,i=this.parentFragment=t.parentFragment;this.type=Se,this.name=t.descriptor.r,n=E(i.root,t.descriptor.r),this.fragment=new C({descriptor:n,root:i.root,parentNode:i.parentNode,contextStack:i.contextStack,owner:this}),e&&e.appendChild(this.fragment.docFrag)},q.prototype={findNextNode:function(){return this.parentFragment.findNextNode(this)},teardown:function(t){this.fragment.teardown(t)},toString:function(){return""+this.fragment}},z=function(t,e){this.type=ke,this.fragments=[],this.length=0,e&&(this.docFrag=le.createDocumentFragment()),this.initialising=!0,X(this,t),e&&e.appendChild(this.docFrag),this.initialising=!1},z.prototype={update:W,resolve:K,smartUpdate:function(t,e){var n;("push"===t||"unshift"===t||"splice"===t)&&(n={descriptor:this.descriptor.f,root:this.root,parentNode:this.parentNode,owner:this},this.descriptor.i&&(n.indexRef=this.descriptor.i)),this[t]&&this[t](n,e)},pop:function(){this.length&&(this.fragments.pop().teardown(!0),this.length-=1)},push:function(t,e){var n,i,r;for(n=this.length,i=n+e.length,r=n;i>r;r+=1)t.contextStack=this.contextStack.concat(this.keypath+"."+r),t.index=r,this.fragments[r]=this.createFragment(t);this.length+=e.length,this.parentNode.insertBefore(this.docFrag,this.parentFragment.findNextNode(this))},shift:function(){this.splice(null,[0,1])},unshift:function(t,e){this.splice(t,[0,0].concat(Array(e.length)))},splice:function(t,e){var n,i,r,o,s,a,h,u,l;if(e.length&&(a=+(0>e[0]?this.length+e[0]:e[0]),i=Math.max(0,e.length-2),r=void 0!==e[1]?e[1]:this.length-a,o=i-r)){if(0>o){for(h=a-o,s=a;h>s;s+=1)this.fragments[s].teardown(!0);this.fragments.splice(a,-o)}else{for(h=a+o,n=this.fragments[a]?this.fragments[a].firstNode():this.parentFragment.findNextNode(this),u=[a,0].concat(Array(o)),this.fragments.splice.apply(this.fragments,u),s=a;h>s;s+=1)t.contextStack=this.contextStack.concat(this.keypath+"."+s),t.index=s,this.fragments[s]=this.createFragment(t);this.parentNode.insertBefore(this.docFrag,n)}this.length+=o,l=a+i,reassignAffectedFragments(this.root,this,l,this.length,o)}},teardown:function(t){this.teardownFragments(t),a(this)},firstNode:function(){return this.fragments[0]?this.fragments[0].firstNode():this.parentFragment.findNextNode(this)},findNextNode:function(t){return this.fragments[t.index+1]?this.fragments[t.index+1].firstNode():this.parentFragment.findNextNode(this)},teardownFragments:function(t){for(;this.fragments.length;)this.fragments.shift().teardown(t)},render:function(t){te(this,t),this.initialising||this.parentNode.insertBefore(this.docFrag,this.parentFragment.findNextNode(this))},createFragment:function(t){var e=new C(t);return this.docFrag&&this.docFrag.appendChild(e.docFrag),e},toString:function(){var t,e,n;for(t="",e=0,n=this.length,e=0;n>e;e+=1)t+=""+this.fragments[e];return t}},U=function(t,e){this.type=xe,this.descriptor=t.descriptor,e&&(this.node=le.createTextNode(t.descriptor),this.parentNode=t.parentFragment.parentNode,e.appendChild(this.node))},U.prototype={teardown:function(t){t&&this.parentNode.removeChild(this.node)},firstNode:function(){return this.node},toString:function(){return(""+this.descriptor).replace("<","&lt;").replace(">","&gt;")}},I=function(t,e){this.type=_e,e&&(this.nodes=[],this.docFrag=le.createDocumentFragment()),this.initialising=!0,X(this,t),e&&e.appendChild(this.docFrag),this.initialising=!1},I.prototype={update:W,resolve:K,teardown:function(t){if(t)for(;this.nodes.length;)this.parentNode.removeChild(this.nodes.pop());a(this)},firstNode:function(){return this.nodes[0]?this.nodes[0]:this.parentFragment.findNextNode(this)},render:function(t){for(;this.nodes.length;)this.parentNode.removeChild(this.nodes.pop());return void 0===t?(this.nodes=[],void 0):(this.nodes=k(t,this.docFrag),this.initialising||this.parentNode.insertBefore(this.docFrag,this.parentFragment.findNextNode(this)),void 0)},toString:function(){return void 0!==this.value?this.value:""}},B=function(t){Q(this,t)},B.prototype={createItem:function(t){if("string"==typeof t.descriptor)return new Y(t.descriptor);switch(t.descriptor.t){case be:return new V(t);case _e:return new V(t);case ke:return new J(t);default:throw"Something went wrong in a rather interesting way"}},bubble:function(){this.owner.bubble()},teardown:function(){var t,e;for(t=this.items.length,e=0;t>e;e+=1)this.items[e].teardown()},getValue:function(){var t;return 1===this.items.length&&this.items[0].type===be&&(t=this.items[0].value,void 0!==t)?t:""+this},toString:function(){return this.items.join("")},toJson:function(){var t,e;t=""+this;try{e=JSON.parse(t)}catch(n){e=t}return e}},V=function(t){this.type=be,X(this,t)},V.prototype={update:W,resolve:K,render:function(t){this.value=t,this.parentFragment.bubble()},teardown:function(){a(this)},toString:function(){return void 0===this.value?"":this.value}},J=function(t){this.type=ke,this.fragments=[],this.length=0,X(this,t)},J.prototype={update:W,resolve:K,teardown:function(){this.teardownFragments(),a(this)},teardownFragments:function(){for(;this.fragments.length;)this.fragments.shift().teardown();this.length=0},bubble:function(){this.value=this.fragments.join(""),this.parentFragment.bubble()},render:function(t){te(this,t),this.parentFragment.bubble()},createFragment:function(t){return new B(t)},toString:function(){return this.fragments.join("")}},Y=function(t){this.type=xe,this.text=t},Y.prototype={toString:function(){return this.text},teardown:function(){}},_=function(t){var e;return"undefined"!=typeof window&&le&&t?t.nodeType?t:"string"==typeof t&&(e=le.getElementById(t),!e&&le.querySelector&&(e=le.querySelector(t)),e.nodeType)?e:t[0]&&t[0].nodeType?t[0]:null:null},m=Object.prototype.toString,y=function(t){return"[object Array]"===m.call(t)},b=function(t,e){return null===t&&null===e?!0:"object"==typeof t||"object"==typeof e?!1:t===e},x=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},w=function(t){return"[object Object]"===m.call(t)&&"function"!=typeof t},S=function(t,e){var n;return n={active:0,info:{i:0},push:function(){n.active+=1,n.info.i+=1},pop:function(){n.active-=1,!n.active&&n.ready&&n.complete()},complete:function(){var i,r;for(i=n.nodesToDetach.length;i--;)r=n.nodesToDetach.pop(),r.parentNode.removeChild(r);e&&e.call(t)},nodesToDetach:[]}},v=function(t){var e,n,i,r,o;if(ve[t])return ve[t].concat();for(i=[],r=t,n=0;r.length;){if(e=r.indexOf(".",n),-1===e)o=r,r="";else{if("\\"===r.charAt(e-1)&&"\\"!==r.charAt(e-2)){n=e+1;continue}o=r.substr(0,e),n=0}/\[/.test(o)?i=i.concat(o.replace(/\[\s*([0-9]+)\s*\]/g,".$1").split(".")):i[i.length]=o,r=r.substring(e+1)}return ve[t]=i,i.concat()},function(){var t,e,n,i,r,o,s,a,h,u,l,c;re=function(t,e,n,i){var o,s;return o={pos:0,tokens:t||[],next:function(){return o.tokens[o.pos]},options:n},s=new r(o,e,i)},t=function(t,r,o){return t.next()?e(t,o)||n(t,r,o)||i(t,r,o):null},e=function(t,e){var n=t.next();return n.type===xe?(t.pos+=1,new o(n,e)):null},n=function(t,e,n){var i=t.next();return i.type===Oe||i.type===_e?i.mustacheType===ke||i.mustacheType===Ne?new a(i,t,e,n):new s(i,t,e):null},i=function(t,e,n){var i,r=t.next();return r.type===Te?(i=new h(r,t,e,n),t.options.sanitize&&t.options.sanitize.elements&&-1!==t.options.sanitize.elements.indexOf(i.lcTag)?null:i):null},l=function(t){var e,n,i,r="";if(!t)return"";for(n=0,i=t.length;i>n;n+=1){if(e=""+t[n],e===!1)return!1;r+=e}return r},c=function(t,e){var n,i;return e||(n=l(t),n===!1)?i=t.map(function(t){return t.toJson(e)}):n},r=function(e,n,i){var r,o;for(r=this.items=[