-
Notifications
You must be signed in to change notification settings - Fork 0
/
riot+compiler.min.js
2 lines (2 loc) · 30.9 KB
/
riot+compiler.min.js
1
2
/* Riot v2.6.5, @license MIT */
!function(e,t){"use strict";function n(e,t,n){var r={};return r[e.key]=t,e.pos&&(r[e.pos]=n),r}function r(e,t){for(var n,r=t.length,o=e.length;r>o;)n=t[--r],t.splice(r,1),n.unmount()}function o(e,t){Object.keys(e.tags).forEach(function(n){var r=e.tags[n];R(r)?g(r,function(e){E(e,n,t)}):E(r,n,t)})}function i(e,t,n){var r,o=e._root;for(e._virts=[];o;)r=o.nextSibling,n?t.insertBefore(o,n._root):t.appendChild(o),e._virts.push(o),o=r}function a(e,t,n,r){for(var o,i=e._root,a=0;a<r;a++)o=i.nextSibling,t.insertBefore(i,n._root),i=o}function u(e,t,u){b(e,"each");var s,c=typeof _(e,"no-reorder")!==ne||b(e,"no-reorder"),l=M(e),p=X[l]||{tmpl:h(e)},d=se.test(l),g=e.parentNode,m=document.createTextNode(""),v=O(e),x="option"===l.toLowerCase(),y=[],w=[],C="VIRTUAL"==e.tagName;u=ge.loopKeys(u),g.insertBefore(m,e),t.one("before-mount",function(){e.parentNode.removeChild(e),g.stub&&(g=t.root)}).on("update",function(){var h=ge(u.val,t),b=document.createDocumentFragment();R(h)||(s=h||!1,h=s?Object.keys(h).map(function(e){return n(u,e,h[e])}):[]);for(var _=0,O=h.length;_<O;_++){var S=h[_],E=c&&typeof S==re&&!s,N=w.indexOf(S),j=~N&&E?N:_,M=y[j];S=!s&&u.key?n(u,S,_):S,!E&&!M||E&&!~N||!M?(M=new f(p,{parent:t,isLoop:!0,hasImpl:!!X[l],root:d?g:e.cloneNode(),item:S},e.innerHTML),M.mount(),C&&(M._root=M.root.firstChild),_!=y.length&&y[_]?(C?i(M,g,y[_]):g.insertBefore(M.root,y[_].root),w.splice(_,0,S)):C?i(M,b):b.appendChild(M.root),y.splice(_,0,M),j=_):M.update(S,!0),j!==_&&E&&y[_]&&(A(h,w[_])&&(C?a(M,g,y[_],e.childNodes.length):y[_].root.parentNode&&g.insertBefore(M.root,y[_].root)),u.pos&&(M[u.pos]=_),y.splice(_,0,y.splice(j,1)[0]),w.splice(_,0,w.splice(j,1)[0]),!v&&M.tags&&o(M,_)),M._item=S,L(M,"_parent",t)}if(r(h,y),g.insertBefore(b,m),x&&pe&&!g.multiple)for(var T=0;T<g.length;T++)if(g[T].__riot1374){g.selectedIndex=T,delete g[T].__riot1374;break}v&&(t.tags[l]=y),w=h.slice()})}function s(e,t,n,r){k(e,function(e){if(1==e.nodeType){if(e.isLoop=e.isLoop||e.parentNode&&e.parentNode.isLoop||_(e,"each")?1:0,n){var o=O(e);o&&!e.isLoop&&n.push(N(o,{root:e,parent:t},e.innerHTML,t))}e.isLoop&&!r||K(e,t,[])}})}function c(e,t,n){function r(e,t,r){ge.hasExpr(t)&&n.push(T({dom:e,expr:t},r))}k(e,function(e){var n,o=e.nodeType;if(3==o&&"STYLE"!=e.parentNode.tagName&&r(e,e.nodeValue),1==o)return(n=_(e,"each"))?(u(e,t,n),!1):(g(e.attributes,function(t){var n=t.name,o=n.split("__")[1];if(r(e,t.value,{attr:o||n,bool:o}),o)return b(e,n),!1}),!O(e)&&void 0)})}function f(e,n,r){function o(){var e=_&&x?p:v||p;g(N.attributes,function(t){var n=t.value;h[w(t.name)]=ge.hasExpr(n)?ge(n,e):n}),g(Object.keys(k),function(t){h[w(t)]=ge(k[t],e)})}function i(e){for(var t in O)typeof p[t]!==oe&&I(p,t)&&(p[t]=e[t])}function a(e){g(Object.keys(e),function(t){var n=!ce.test(t)&&A(H,t);(typeof p[t]===oe||n)&&(n||H.push(t),p[t]=e[t])})}function u(e){p.update(e,!0)}function f(e){if(g(E,function(t){t[e?"mount":"unmount"]()}),v){var t=e?"on":"off";x?v[t]("unmount",p.unmount):v[t]("update",u)[t]("unmount",p.unmount)}}var l,p=V.observable(this),h=q(n.opts)||{},v=n.parent,x=n.isLoop,_=n.hasImpl,O=$(n.item),S=[],E=[],N=n.root,M=N.tagName.toLowerCase(),k={},H=[];e.name&&N._tag&&N._tag.unmount(!0),this.isMounted=!1,N.isLoop=x,N._tag=this,L(this,"_riot_id",++Q),T(this,{parent:v,root:N,opts:h},O),L(this,"tags",{}),g(N.attributes,function(e){var t=e.value;ge.hasExpr(t)&&(k[e.name]=t)}),l=me(e.tmpl,r),L(this,"update",function(e,t){return e=$(e),x&&a(p.parent),e&&y(O)&&(i(e),O=e),T(p,e),o(),p.trigger("update",e),d(S,p),t&&p.parent?p.parent.one("updated",function(){p.trigger("updated")}):ve(function(){p.trigger("updated")}),this}),L(this,"mixin",function(){return g(arguments,function(e){var t,n,r=[];e=typeof e===ne?V.mixin(e):e,t=m(e)?new e:e;var o=Object.getPrototypeOf(t);do r=r.concat(Object.getOwnPropertyNames(n||t));while(n=Object.getPrototypeOf(n||t));g(r,function(e){if("init"!=e){var n=Object.getOwnPropertyDescriptor(t,e)||Object.getOwnPropertyDescriptor(o,e),r=n&&(n.get||n.set);!p.hasOwnProperty(e)&&r?Object.defineProperty(p,e,n):p[e]=m(t[e])?t[e].bind(p):t[e]}}),t.init&&t.init.bind(p)()}),this}),L(this,"mount",function(){o();var t=V.mixin(J);if(t)for(var n in t)t.hasOwnProperty(n)&&p.mixin(t[n]);if(p._parent&&p._parent.root.isLoop&&a(p._parent),e.fn&&e.fn.call(p,h),c(l,p,S),f(!0),e.attrs&&F(e.attrs,function(e,t){C(N,e,t)}),(e.attrs||_)&&c(p.root,p,S),p.parent&&!x||p.update(O),p.trigger("before-mount"),x&&!_)N=l.firstChild;else{for(;l.firstChild;)N.appendChild(l.firstChild);N.stub&&(N=v.root)}L(p,"root",N),x&&s(p.root,p.parent,null,!0),!p.parent||p.parent.isMounted?(p.isMounted=!0,p.trigger("mount")):p.parent.one("mount",function(){P(p.root)||(p.parent.isMounted=p.isMounted=!0,p.trigger("mount"))})}),L(this,"unmount",function(e){var n,r=N,o=r.parentNode,i=W.indexOf(p);if(p.trigger("before-unmount"),~i&&W.splice(i,1),o){if(v)n=j(v),R(n.tags[M])?g(n.tags[M],function(e,t){e._riot_id==p._riot_id&&n.tags[M].splice(t,1)}):n.tags[M]=t;else for(;r.firstChild;)r.removeChild(r.firstChild);e?(b(o,te),b(o,ee)):o.removeChild(r)}this._virts&&g(this._virts,function(e){e.parentNode&&e.parentNode.removeChild(e)}),p.trigger("unmount"),f(),p.off("*"),p.isMounted=!1,delete N._tag}),s(l,this,E)}function l(t,n,r,o){r[t]=function(t){var i,a=o._parent,u=o._item;if(!u)for(;a&&!u;)u=a._item,a=a._parent;t=t||e.event,I(t,"currentTarget")&&(t.currentTarget=r),I(t,"target")&&(t.target=t.srcElement),I(t,"which")&&(t.which=t.charCode||t.keyCode),t.item=u,n.call(o,t)===!0||/radio|check/.test(r.type)||(t.preventDefault&&t.preventDefault(),t.returnValue=!1),t.preventUpdate||(i=u?j(a):o,i.update())}}function p(e,t,n){e&&(e.insertBefore(n,t),e.removeChild(t))}function d(e,t){g(e,function(e,n){var r=e.dom,o=e.attr,i=ge(e.expr,t),a=e.parent||e.dom.parentNode;if(e.bool?i=!!i:null==i&&(i=""),e.value!==i){if(e.value=i,!o)return i+="",void(a&&(e.parent=a,"TEXTAREA"===a.tagName?(a.value=i,le||(r.nodeValue=i)):r.nodeValue=i));if("value"===o)return void(r.value!==i&&(r.value=i,C(r,o,i)));if(b(r,o),m(i))l(o,i,r,t);else if("if"==o){var u=e.stub,s=function(){p(u.parentNode,u,r)},c=function(){p(r.parentNode,r,u)};i?u&&(s(),r.inStub=!1,P(r)||k(r,function(e){e._tag&&!e._tag.isMounted&&(e._tag.isMounted=!!e._tag.trigger("mount"))})):(u=e.stub=u||document.createTextNode(""),r.parentNode?c():(t.parent||t).one("updated",c),r.inStub=!0)}else"show"===o?r.style.display=i?"":"none":"hide"===o?r.style.display=i?"none":"":e.bool?(r[o]=i,i&&C(r,o,o),pe&&"selected"===o&&"OPTION"===r.tagName&&(r.__riot1374=i)):(0===i||i&&typeof i!==re)&&(Z(o,Y)&&o!=ee&&(o=o.slice(Y.length)),C(r,o,i))}})}function g(e,t){for(var n,r=e?e.length:0,o=0;o<r;o++)n=e[o],null!=n&&t(n,o)===!1&&o--;return e}function m(e){return typeof e===ie||!1}function h(e){if(e.outerHTML)return e.outerHTML;var t=H("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML}function v(e,t){if(typeof e.innerHTML!=oe)e.innerHTML=t;else{var n=(new DOMParser).parseFromString(t,"application/xml");e.appendChild(e.ownerDocument.importNode(n.documentElement,!0))}}function x(e){return~fe.indexOf(e)}function y(e){return e&&typeof e===re}function b(e,t){e.removeAttribute(t)}function w(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function _(e,t){return e.getAttribute(t)}function C(e,t,n){var r=ue.exec(t);r&&r[1]?e.setAttributeNS(ae,r[1],n):e.setAttribute(t,n)}function O(e){return e.tagName&&X[_(e,te)||_(e,ee)||e.tagName.toLowerCase()]}function S(e,t,n){var r=n.tags[t];r?(R(r)||r!==e&&(n.tags[t]=[r]),A(n.tags[t],e)||n.tags[t].push(e)):n.tags[t]=e}function E(e,t,n){var r,o=e.parent;o&&(r=o.tags[t],R(r)?r.splice(n,0,r.splice(r.indexOf(e),1)[0]):S(e,t,o))}function N(e,t,n,r){var o=new f(e,t,n),i=M(t.root),a=j(r);return o.parent=a,o._parent=r,S(o,i,a),a!==r&&S(o,i,r),t.root.innerHTML="",o}function j(e){for(var t=e;!O(t.root)&&t.parent;)t=t.parent;return t}function L(e,t,n,r){return Object.defineProperty(e,t,T({value:n,enumerable:!1,writable:!1,configurable:!0},r)),e}function M(e){var t=O(e),n=_(e,"name"),r=n&&!ge.hasExpr(n)?n:t?t.name:e.tagName.toLowerCase();return r}function T(e){for(var t,n=arguments,r=1;r<n.length;++r)if(t=n[r])for(var o in t)I(e,o)&&(e[o]=t[o]);return e}function A(e,t){return~e.indexOf(t)}function R(e){return Array.isArray(e)||e instanceof Array}function I(e,t){var n=Object.getOwnPropertyDescriptor(e,t);return typeof e[t]===oe||n&&n.writable}function $(e){if(!(e instanceof f||e&&typeof e.trigger==ie))return e;var t={};for(var n in e)ce.test(n)||(t[n]=e[n]);return t}function k(e,t){if(e){if(t(e)===!1)return;for(e=e.firstChild;e;)k(e,t),e=e.nextSibling}}function F(e,t){for(var n,r=/([-\w]+) ?= ?(?:"([^"]*)|'([^']*)|({[^}]*}))/g;n=r.exec(e);)t(n[1].toLowerCase(),n[2]||n[3]||n[4])}function P(e){for(;e;){if(e.inStub)return!0;e=e.parentNode}return!1}function H(e,t){return t?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(e)}function B(e,t){return(t||document).querySelectorAll(e)}function D(e,t){return(t||document).querySelector(e)}function q(e){return Object.create(e||null)}function z(e){return _(e,"id")||_(e,"name")}function K(e,t,n){var r,o=z(e),i=function(i){A(n,o)||(r=R(i),i?(!r||r&&!A(i,e))&&(r?i.push(e):t[o]=[i,e]):t[o]=e)};o&&(ge.hasExpr(o)?t.one("mount",function(){o=z(e),i(t[o])}):i(t[o]))}function Z(e,t){return e.slice(0,t.length)===t}function G(e,t,n){var r=X[t],o=e._innerHTML=e._innerHTML||e.innerHTML;return e.innerHTML="",r&&e&&(r=new f(r,{root:e,opts:n},o)),r&&r.mount&&(r.mount(),A(W,r)||W.push(r)),r}function U(e){var t=e.source,n=e.global?"g":"";e.ignoreCase&&(n+="i"),e.multiline&&(n+="m");for(var r=1;r<arguments.length;r++)t=t.replace("@","\\"+arguments[r]);return new RegExp(t,n)}var V={version:"v2.6.5",settings:{}},Q=0,W=[],X={},J="__global_mixin",Y="riot-",ee=Y+"tag",te="data-is",ne="string",re="object",oe="undefined",ie="function",ae="http://www.w3.org/1999/xlink",ue=/^xlink:(\w+)/,se=/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?|opt(?:ion|group))$/,ce=/^(?:_(?:item|id|parent)|update|root|(?:un)?mount|mixin|is(?:Mounted|Loop)|tags|parent|opts|trigger|o(?:n|ff|ne))$/,fe=["altGlyph","animate","animateColor","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","filter","font","foreignObject","g","glyph","glyphRef","image","line","linearGradient","marker","mask","missing-glyph","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tref","tspan","use"],le=0|(e&&e.document||{}).documentMode,pe=e&&!!e.InstallTrigger;V.observable=function(e){function t(e,t){for(var n=e.split(" "),r=n.length,o=0;o<r;o++){var i=n[o];i&&t(i,o)}}e=e||{};var n={},r=Array.prototype.slice;return Object.defineProperties(e,{on:{value:function(r,o){return"function"!=typeof o?e:(t(r,function(e,t){(n[e]=n[e]||[]).push(o),o.typed=t>0}),e)},enumerable:!1,writable:!1,configurable:!1},off:{value:function(r,o){return"*"!=r||o?t(r,function(e,t){if(o)for(var r,i=n[e],a=0;r=i&&i[a];++a)r==o&&i.splice(a--,1);else delete n[e]}):n={},e},enumerable:!1,writable:!1,configurable:!1},one:{value:function(t,n){function r(){e.off(t,r),n.apply(e,arguments)}return e.on(t,r)},enumerable:!1,writable:!1,configurable:!1},trigger:{value:function(o){for(var i,a=arguments.length-1,u=new Array(a),s=0;s<a;s++)u[s]=arguments[s+1];return t(o,function(t,o){i=r.call(n[t]||[],0);for(var a,s=0;a=i[s];++s)a.busy||(a.busy=1,a.apply(e,a.typed?[t].concat(u):u),i[s]!==a&&s--,a.busy=0);n["*"]&&"*"!=t&&e.trigger.apply(e,["*",t].concat(u))}),e},enumerable:!1,writable:!1,configurable:!1}}),e},function(t){function n(e){return e.split(/[\/?#]/)}function r(e,t){var n=new RegExp("^"+t[O](/\*/g,"([^/?#]+?)")[O](/\.\./,".*")+"$"),r=e.match(n);if(r)return r.slice(1)}function o(e,t){var n;return function(){clearTimeout(n),n=setTimeout(e,t)}}function i(e){g=o(l,1),L[_](S,g),L[_](E,g),M[_](I,p),e&&l(!0)}function a(){this.$=[],t.observable(this),k.on("stop",this.s.bind(this)),k.on("emit",this.e.bind(this))}function u(e){return e[O](/^\/|\/$/,"")}function s(e){return"string"==typeof e}function c(e){return(e||A.href)[O](y,"")}function f(e){return"#"==m[0]?(e||A.href||"").split(m)[1]||"":(A?c(e):e||"")[O](m,"")}function l(e){var t,n=0==H;if(!(j<=H)&&(H++,P.push(function(){var t=f();(e||t!=h)&&(k[N]("emit",t),h=t)}),n)){for(;t=P.shift();)t();H=0}}function p(e){if(!(1!=e.which||e.metaKey||e.ctrlKey||e.shiftKey||e.defaultPrevented)){for(var t=e.target;t&&"A"!=t.nodeName;)t=t.parentNode;!t||"A"!=t.nodeName||t[C]("download")||!t[C]("href")||t.target&&"_self"!=t.target||t.href.indexOf(A.href.match(y)[0])==-1||t.href!=A.href&&(t.href.split("#")[0]==A.href.split("#")[0]||"#"!=m[0]&&0!==c(t.href).indexOf(m)||"#"==m[0]&&t.href.split(m)[0]!=A.href.split(m)[0]||!d(f(t.href),t.title||M.title))||e.preventDefault()}}function d(e,t,n){return T?(e=m+u(e),t=t||M.title,n?T.replaceState(null,t,e):T.pushState(null,t,e),M.title=t,F=!1,l(),F):k[N]("emit",f(e))}var g,m,h,v,x,y=/^.+?\/\/+[^\/]+/,b="EventListener",w="remove"+b,_="add"+b,C="hasAttribute",O="replace",S="popstate",E="hashchange",N="trigger",j=3,L="undefined"!=typeof e&&e,M="undefined"!=typeof document&&document,T=L&&history,A=L&&(T.location||L.location),R=a.prototype,I=M&&M.ontouchstart?"touchstart":"click",$=!1,k=t.observable(),F=!1,P=[],H=0;R.m=function(e,t,n){!s(e)||t&&!s(t)?t?this.r(e,t):this.r("@",e):d(e,t,n||!1)},R.s=function(){this.off("*"),this.$=[]},R.e=function(e){this.$.concat("@").some(function(t){var n=("@"==t?v:x)(u(e),u(t));if("undefined"!=typeof n)return this[N].apply(null,[t].concat(n)),F=!0},this)},R.r=function(e,t){"@"!=e&&(e="/"+u(e),this.$.push(e)),this.on(e,t)};var B=new a,D=B.m.bind(B);D.create=function(){var e=new a,t=e.m.bind(e);return t.stop=e.s.bind(e),t},D.base=function(e){m=e||"#",h=f()},D.exec=function(){l(!0)},D.parser=function(e,t){e||t||(v=n,x=r),e&&(v=e),t&&(x=t)},D.query=function(){var e={},t=A.href||h;return t[O](/[?&](.+?)=([^&]*)/g,function(t,n,r){e[n]=r}),e},D.stop=function(){$&&(L&&(L[w](S,g),L[w](E,g),M[w](I,p)),k[N]("stop"),$=!1)},D.start=function(e){$||(L&&("complete"==document.readyState?i(e):L[_]("load",function(){setTimeout(function(){i(e)},1)})),$=!0)},D.base(),D.parser(),t.route=D}(V);var de=function(e){function t(e){return e}function n(e,t){return t||(t=y),new RegExp(e.source.replace(/{/g,t[2]).replace(/}/g,t[3]),e.global?c:"")}function r(e){if(e===h)return v;var t=e.split(" ");if(2!==t.length||d.test(e))throw new Error('Unsupported brackets "'+e+'"');return t=t.concat(e.replace(g,"\\").split(" ")),t[4]=n(t[1].length>1?/{[\S\s]*?}/:v[4],t),t[5]=n(e.length>3?/\\({|})/g:v[5],t),t[6]=n(v[6],t),t[7]=RegExp("\\\\("+t[3]+")|([[({])|("+t[3]+")|"+p,c),t[8]=e,t}function o(e){return e instanceof RegExp?u(e):y[e]}function i(e){(e||(e=h))!==y[8]&&(y=r(e),u=e===h?t:n,y[9]=u(v[9])),x=e}function a(e){var t;e=e||{},t=e.brackets,Object.defineProperty(e,"brackets",{set:i,get:function(){return x},enumerable:!0}),s=e,i(t)}var u,s,c="g",f=/\/\*[^*]*\*+(?:[^*\/][^*]*\*+)*\//g,l=/"[^"\\]*(?:\\[\S\s][^"\\]*)*"|'[^'\\]*(?:\\[\S\s][^'\\]*)*'/g,p=l.source+"|"+/(?:\breturn\s+|(?:[$\w\)\]]|\+\+|--)\s*(\/)(?![*\/]))/.source+"|"+/\/(?=[^*\/])[^[\/\\]*(?:(?:\[(?:\\.|[^\]\\]*)*\]|\\.)[^[\/\\]*)*?(\/)[gim]*/.source,d=RegExp("[\\x00-\\x1F<>a-zA-Z0-9'\",;\\\\]"),g=/(?=[[\]()*+?.^$|])/g,m={"(":RegExp("([()])|"+p,c),"[":RegExp("([[\\]])|"+p,c),"{":RegExp("([{}])|"+p,c)},h="{ }",v=["{","}","{","}",/{[^}]*}/,/\\([{}])/g,/\\({)|{/g,RegExp("\\\\(})|([[({])|(})|"+p,c),h,/^\s*{\^?\s*([$\w]+)(?:\s*,\s*(\S+))?\s+in\s+(\S.*)\s*}/,/(^|[^\\]){=[\S\s]*?}/],x=e,y=[];return o.split=function(e,t,n){function r(e){t||a?c.push(e&&e.replace(n[5],"$1")):c.push(e)}function o(e,t,n){var r,o=m[t];for(o.lastIndex=n,n=1;(r=o.exec(e))&&(!r[1]||(r[1]===t?++n:--n)););return n?e.length:o.lastIndex}n||(n=y);var i,a,u,s,c=[],f=n[6];for(a=u=f.lastIndex=0;i=f.exec(e);){if(s=i.index,a){if(i[2]){f.lastIndex=o(e,i[2],f.lastIndex);continue}if(!i[3])continue}i[1]||(r(e.slice(u,s)),u=f.lastIndex,f=n[6+(a^=1)],f.lastIndex=u)}return e&&u<e.length&&r(e.slice(u)),c},o.hasExpr=function(e){return y[4].test(e)},o.loopKeys=function(e){var t=e.match(y[9]);return t?{key:t[1],pos:t[2],val:y[0]+t[3].trim()+y[1]}:{val:e.trim()}},o.array=function(e){return e?r(e):y},Object.defineProperty(o,"settings",{set:a,get:function(){return s}}),o.settings="undefined"!=typeof V&&V.settings||{},o.set=i,o.R_STRINGS=l,o.R_MLCOMMS=f,o.S_QBLOCKS=p,o}(),ge=function(){function t(e,t){return e?(u[e]||(u[e]=r(e))).call(t,n):e}function n(e,n){t.errorHandler&&(e.riotData={tagName:n&&n.root&&n.root.tagName,_riot_id:n&&n._riot_id},t.errorHandler(e))}function r(e){var t=o(e);return"try{return "!==t.slice(0,11)&&(t="return "+t),new Function("E",t+";")}function o(e){var t,n=[],r=de.split(e.replace(l,'"'),1);if(r.length>2||r[0]){var o,a,u=[];for(o=a=0;o<r.length;++o)t=r[o],t&&(t=1&o?i(t,1,n):'"'+t.replace(/\\/g,"\\\\").replace(/\r\n?|\n/g,"\\n").replace(/"/g,'\\"')+'"')&&(u[a++]=t);t=a<2?u[0]:"["+u.join(",")+'].join("")'}else t=i(r[1],0,n);return n[0]&&(t=t.replace(p,function(e,t){return n[t].replace(/\r/g,"\\r").replace(/\n/g,"\\n")})),t}function i(e,t,n){function r(t,n){var r,o=1,i=d[t];for(i.lastIndex=n.lastIndex;r=i.exec(e);)if(r[0]===t)++o;else if(!--o)break;n.lastIndex=o?e.length:i.lastIndex}if(e=e.replace(f,function(e,t){return e.length>2&&!t?s+(n.push(e)-1)+"~":e}).replace(/\s+/g," ").trim().replace(/\ ?([[\({},?\.:])\ ?/g,"$1")){for(var o,i=[],u=0;e&&(o=e.match(c))&&!o.index;){var l,p,g=/,|([[{(])|$/g;for(e=RegExp.rightContext,l=o[2]?n[o[2]].slice(1,-1).trim().replace(/\s+/g," "):o[1];p=(o=g.exec(e))[1];)r(p,g);p=e.slice(0,o.index),e=RegExp.rightContext,i[u++]=a(p,1,l)}e=u?u>1?"["+i.join(",")+'].join(" ").trim()':i[0]:a(e,t)}return e}function a(e,t,n){var r;return e=e.replace(m,function(e,t,n,o,i){return n&&(o=r?0:o+e.length,"this"!==n&&"global"!==n&&"window"!==n?(e=t+'("'+n+g+n,o&&(r="."===(i=i[o])||"("===i||"["===i)):o&&(r=!h.test(i.slice(o)))),e}),r&&(e="try{return "+e+"}catch(e){E(e,this)}"),n?e=(r?"function(){"+e+"}.call(this)":"("+e+")")+'?"'+n+'":""':t&&(e="function(v){"+(r?e.replace("return ","v="):"v=("+e+")")+';return v||v===0?v:""}.call(this)'),e}var u={};t.haveRaw=de.hasRaw,t.hasExpr=de.hasExpr,t.loopKeys=de.loopKeys,t.clearCache=function(){u={}},t.errorHandler=null;var s=String.fromCharCode(8279),c=/^(?:(-?[_A-Za-z\xA0-\xFF][-\w\xA0-\xFF]*)|\u2057(\d+)~):/,f=RegExp(de.S_QBLOCKS,"g"),l=/\u2057/g,p=/\u2057(\d+)~/g,d={"(":/[()]/g,"[":/[[\]]/g,"{":/[{}]/g},g='"in this?this:'+("object"!=typeof e?"global":"window")+").",m=/[,{][\$\w]+(?=:)|(^ *|[^$\w\.{])(?!(?:typeof|true|false|null|undefined|in|instanceof|is(?:Finite|NaN)|void|NaN|new|Date|RegExp|Math)(?![$\w]))([$_A-Za-z][$\w]*)/g,h=/^(?=(\.[$\w]+))\1(?:[^.[(]|$)/;return t.version=de.version="v2.4.2",t}(),me=function e(){function e(e,r){var o=e&&e.match(/^\s*<([-\w]+)/),i=o&&o[1].toLowerCase(),a=H("div",x(i));return e=n(e,r),s.test(i)?a=t(a,e,i):v(a,e),a.stub=!0,a}function t(e,t,n){var r="o"===n[0],o=r?"select>":"table>";if(e.innerHTML="<"+o+t.trim()+"</"+o,o=e.firstChild,r)o.selectedIndex=-1;else{var i=u[n];i&&1===o.childElementCount&&(o=D(i,o))}return o}function n(e,t){if(!r.test(e))return e;var n={};return t=t&&t.replace(i,function(e,t,r){return n[t]=n[t]||r,""}).trim(),e.replace(a,function(e,t,r){return n[t]||r||""}).replace(o,function(e,n){return t||n||""})}var r=/<yield\b/i,o=/<yield\s*(?:\/>|>([\S\s]*?)<\/yield\s*>|>)/gi,i=/<yield\s+to=['"]([^'">]*)['"]\s*>([\S\s]*?)<\/yield\s*>/gi,a=/<yield\s+from=['"]?([-\w]+)['"]?\s*(?:\/>|>([\S\s]*?)<\/yield\s*>)/gi,u={tr:"tbody",th:"tr",td:"tr",col:"colgroup"},s=le&&le<10?se:/^(?:t(?:body|head|foot|[rhd])|caption|col(?:group)?)$/;return e}(),he=function(t){if(!e)return{add:function(){},inject:function(){}};var n=function(){var e=H("style");C(e,"type","text/css");var t=D("style[type=riot]");return t?(t.id&&(e.id=t.id),t.parentNode.replaceChild(e,t)):document.getElementsByTagName("head")[0].appendChild(e),e}(),r=n.styleSheet,o="";return Object.defineProperty(t,"styleNode",{value:n,writable:!0}),{add:function(e){o+=e},inject:function(){o&&(r?r.cssText+=o:n.innerHTML+=o,o="")}}}(V),ve=function(e){var t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame;if(!t||/iP(ad|hone|od).*OS 6/.test(e.navigator.userAgent)){var n=0;t=function(e){var t=Date.now(),r=Math.max(16-(t-n),0);setTimeout(function(){e(n=t+r)},r)}}return t}(e||{});V.util={brackets:de,tmpl:ge},V.mixin=function(){var e={},t=e[J]={},n=0;return function(r,o,i){if(y(r))return void V.mixin("__unnamed_"+n++,r,!0);var a=i?t:e;if(!o){if(typeof a[r]===oe)throw new Error("Unregistered mixin: "+r);return a[r]}m(o)?(T(o.prototype,a[r]||{}),a[r]=o):a[r]=T(a[r]||{},o)}}(),V.tag=function(e,t,n,r,o){return m(r)&&(o=r,/^[\w\-]+\s?=/.test(n)?(r=n,n=""):r=""),n&&(m(n)?o=n:he.add(n)),e=e.toLowerCase(),X[e]={name:e,tmpl:t,attrs:r,fn:o},e},V.tag2=function(e,t,n,r,o){return n&&he.add(n),X[e]={name:e,tmpl:t,attrs:r,fn:o},e},V.mount=function(e,t,n){function r(e){var t="";return g(e,function(e){/[^-\w]/.test(e)||(e=e.trim().toLowerCase(),t+=",["+te+'="'+e+'"],['+ee+'="'+e+'"]')}),t}function o(){var e=Object.keys(X);return e+r(e)}function i(e){if(e.tagName){var r=_(e,te)||_(e,ee);t&&r!==t&&(r=t,C(e,te,t),C(e,ee,t));var o=G(e,r||e.tagName.toLowerCase(),n);o&&s.push(o)}else e.length&&g(e,i)}var a,u,s=[];if(he.inject(),y(t)&&(n=t,t=0),typeof e===ne?("*"===e?e=u=o():e+=r(e.split(/, */)),a=e?B(e):[]):a=e,"*"===t){if(t=u||o(),a.tagName)a=B(t,a);else{var c=[];g(a,function(e){c.push(B(t,e))}),a=c}t=0}return i(a),s},V.update=function(){return g(W,function(e){e.update()})},V.vdom=W,V.Tag=f;var xe=function(e){function t(t){var n=e[t];if(n)return n;throw new Error('Parser "'+t+'" not loaded.')}function n(e){var t=e.split(".");if(2!==t.length)throw new Error("Bad format for parsers._req");var n=i[t[0]][t[1]];if(n)return n;throw new Error('Parser "'+e+'" not found.')}function r(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function o(e,n,o,i){return o=r({pretty:!0,filename:i,doctype:"html"},o),t(e).render(n,o)}var i={};return i.html={jade:function(e,t,n){return console.log('DEPRECATION WARNING: jade was renamed "pug" - The jade parser will be removed in [email protected]!'),o("jade",e,t,n)},pug:function(e,t,n){return o("pug",e,t,n)}},i.css={less:function(e,n,o,i){var a;return o=r({sync:!0,syncImport:!0,filename:i},o),t("less").render(n,o,function(e,t){if(e)throw e;a=t.css}),a}},i.js={es6:function(e,n){return n=r({blacklist:["useStrict","strict","react"],sourceMaps:!1,comments:!1},n),t("babel").transform(e,n).code},babel:function(e,n,o){return t("babel").transform(e,r({filename:o},n)).code},buble:function(e,n,o){return n=r({source:o,modules:!1},n),t("buble").transform(e,n).code},coffee:function(e,n){return t("CoffeeScript").compile(e,r({bare:!0},n))},livescript:function(e,n){return t("livescript").compile(e,r({bare:!0,header:!1},n))},typescript:function(e,n){return t("typescript")(e,n)},none:function(e){return e}},i.js.javascript=i.js.none,i.js.coffeescript=i.js.coffee,i._req=n,i.utils={extend:r},i}(e||global);V.parsers=xe;var ye=function(){function e(e){var t,n=N;for(~e.indexOf("\r")&&(e=e.replace(/\r\n?/g,"\n")),n.lastIndex=0;t=n.exec(e);)"<"===t[0][0]&&(e=RegExp.leftContext+RegExp.rightContext,n.lastIndex=t[3]+1);return e}function t(e,t){var n,r,o,i=[];for(E.lastIndex=0,e=e.replace(/\s+/g," ");n=E.exec(e);){var a=n[1].toLowerCase(),u=n[2];u?(u[0]!==D&&(u=D+(u[0]===q?u.slice(1,-1):u)+D),"type"===a&&I.test(u)?r=u:(F.test(u)&&("value"===a?o=1:M.test(a)?a="__"+a:~T.indexOf(a)&&(a="riot-"+a)),i.push(a+"="+u))):i.push(a)}return r&&(o&&(r=D+t._bp[0]+q+r.slice(1,-1)+q+t._bp[1]+D),i.push("type="+r)),i.join(" ")}function n(e,t,n){var r=n._bp;if(e&&r[4].test(e)){for(var o,i=t.expr&&(t.parser||t.type)?u:0,a=de.split(e,0,r),s=1;s<a.length;s+=2)o=a[s],"^"===o[0]?o=o.slice(1):i&&(o=i(o,t).trim(),";"===o.slice(-1)&&(o=o.slice(0,-1))),a[s]=H+(n.push(o)-1)+r[1];e=a.join("")}return e}function r(e,t){return t.length&&(e=e.replace(P,function(e,n){return t._bp[0]+t[n].trim().replace(/[\r\n]+/g," ").replace(/"/g,B)})),e}function o(e,o,i){if(!/\S/.test(e))return"";if(e=n(e,o,i).replace(j,function(e,n,r,o){return n=n.toLowerCase(),o=o&&!A.test(n)?"></"+n:"",r&&(n+=" "+t(r,i)),"<"+n+o+">"}),!o.whitespace){var a=[];/<pre[\s>]/.test(e)&&(e=e.replace(R,function(e){return a.push(e),""})),e=e.trim().replace(/\s+/g," "),a.length&&(e=e.replace(/\u0002/g,function(){return a.shift()}))}return o.compact&&(e=e.replace(L,"><$1")),r(e,i).replace(k,"")}function i(t,n,r){return Array.isArray(n)?(r=n,n={}):(r||(r=[]),n||(n={})),r._bp=de.array(n.brackets),o(e(t),n,r)}function a(e){function t(e,t,n){for(t.lastIndex=0;n=t.exec(e);)"/"!==n[0][0]||n[1]||n[2]||(e=s.leftContext+" "+s.rightContext,t.lastIndex=n[3]+1);return e}function n(e,t){var n,r=1;for(t.lastIndex=0;r&&(n=t.exec(e));)"{"===n[0]?++r:"}"===n[0]&&--r;return r?e.length:t.lastIndex}var r,o,i,a,u=[],s=RegExp;for(~e.indexOf("/")&&(e=t(e,Z));r=e.match(z);)u.push(s.leftContext),e=s.rightContext,i=n(e,K),a=r[1],o=!/^(?:if|while|for|switch|catch|function)$/.test(a),a=o?r[0].replace(a,"this."+a+" = function"):r[0],u.push(a,e.slice(0,i)),e=e.slice(i),o&&!/^\s*.\s*bind\b/.test(e)&&u.push(".bind(this)");return u.length?u.join("")+e:e}function u(e,t,n,r,o){if(!/\S/.test(e))return"";n||(n=t.type);var i=t.parser||n&&xe._req("js."+n,!0)||a;return i(e,r,o).replace(/\r\n?/g,"\n").replace(k,"")}function s(e,t,n,r){return"string"==typeof t&&(r=n,n=t,t={}),n&&"object"==typeof n&&(r=n,n=""),r||(r={}),u(e,t||{},n,r.parserOptions,r.url)}function c(e,t){var n=":scope";return t.replace(G,function(t,r,o){return o?(o=o.replace(/[^,]+/g,function(t){var r=t.trim();return r&&"from"!==r&&"to"!==r&&"%"!==r.slice(-1)?r=r.indexOf(n)<0?e+" "+r+',[riot-tag="'+e+'"] '+r+',[data-is="'+e+'"] '+r:r.replace(n,e)+","+r.replace(n,'[riot-tag="'+e+'"]')+","+r.replace(n,'[data-is="'+e+'"]'):t}),r?r+" "+o:o):t})}function f(e,t,n,r){var o=(r||(r={})).scoped;if(n)if("scoped-css"===n)o=!0;else if("css"!==n){var i=xe._req("css."+n,!0);e=i(t,e,r.parserOpts||{},r.url)}if(e=e.replace(de.R_MLCOMMS,"").replace(/\s+/g," ").trim(),o){if(!t)throw new Error("Can not parse scoped CSS without a tagName");e=c(t,e)}return e}function l(e,t,n){return t&&"object"==typeof t?(n=t,t=""):n||(n={}),f(e,n.tagName,t,n)}function p(e,t){return e?(e=q+e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+q,t&&~e.indexOf("\n")?e.replace(/\n/g,"\\n"):e):"''"}function d(e,t,n,r,o,i,a){var u=a.debug?",\n ":", ",s="});";return o&&"\n"!==o.slice(-1)&&(s="\n"+s),i+"riot.tag2('"+e+q+u+p(t,1)+u+p(n)+u+p(r)+", function(opts) {\n"+o+s}function g(e){if(/<[-\w]/.test(e))for(var t,n=e.lastIndexOf("<"),r=e.length;~n;){if(t=e.slice(n,r).match(X))return n+=t.index+t[0].length,t=e.slice(0,n),"<-/>\n"===t.slice(-5)&&(t=t.slice(0,-5)),[t,e.slice(n)];r=n,n=e.lastIndexOf("<",n-1)}return["",e]}function m(e){if(e){var t=e.match(Q);if(t=t&&(t[2]||t[3]))return t.replace("text/","")}return""}function h(e,t){if(e){var n=e.match(RegExp("\\s"+t+W,"i"));if(n=n&&n[1])return/^['"]/.test(n)?n.slice(1,-1):n}return""}function v(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function x(e){var t=v(h(e,"options"));return t?JSON.parse(t):null}function y(e,t,n,r){var o=m(n),i=h(n,"src"),a=C({},t.parserOptions.js);return!i&&u(e,t,o,C(a,x(n)),r)}function b(e,t,n,r,o){var i=C({},t.parserOptions.style),a={parserOpts:C(i,x(n)),scoped:n&&/\sscoped(\s|=|$)/i.test(n),url:r};return f(e,o,m(n)||t.style,a)}function w(e,t,n,r){var o=xe._req("html."+n,!0);return o(e,r,t)}function _(i,a,s){var c,f=[],l={template:{},js:{},style:{}};a||(a={}),a.parserOptions=C(l,a.parserOptions||{}),c=a.exclude?function(e){return a.exclude.indexOf(e)<0}:function(){return 1},s||(s="");var p=de.array(a.brackets);return a.template&&(i=w(i,s,a.template,a.parserOptions.template)),i=e(i).replace(J,function(e,i,l,m,h,v){var x="",w="",_="",C="",O=[];if(O._bp=p,l=l.toLowerCase(),m=m&&c("attribs")?r(t(n(m,a,O),O),O):"",(h||(h=v))&&/\S/.test(h))if(v)c("html")&&(_=o(v,a,O));else{h=h.replace(RegExp("^"+i,"gm"),""),h=h.replace(ee,function(e,t,n){return c("css")&&(w+=(w?" ":"")+b(n,a,t,s,l)),""}),h=h.replace(Y,function(e,t,n){if(c("js")){var r=y(n,a,t,s);r&&(x+=(x?"\n":"")+r)}return""});var S=g(h.replace(k,""));c("html")&&(_=o(S[0],a,O)),c("js")&&(h=u(S[1],a,null,null,s),h&&(x+=(x?"\n":"")+h),x=x.replace($,function(e){return C+=e.trim()+"\n",""}))}return x=/\S/.test(x)?x.replace(/\n{3,}/g,"\n\n"):"",a.entities?(f.push({tagName:l,html:_,css:w,attribs:m,js:x,imports:C}),""):d(l,_,w,m,x,C,a)}),a.entities?f:i}var C=xe.utils.extend,O=/"[^"\n\\]*(?:\\[\S\s][^"\n\\]*)*"|'[^'\n\\]*(?:\\[\S\s][^'\n\\]*)*'/.source,S=de.R_STRINGS.source,E=/ *([-\w:\xA0-\xFF]+) ?(?:= ?('[^']*'|"[^"]*"|\S+))?/g,N=RegExp(/<!--(?!>)[\S\s]*?-->/.source+"|"+O,"g"),j=/<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^"'\/>]*(?:(?:"[^"]*"|'[^']*'|\/[^>])[^'"\/>]*)*)|\s*)(\/?)>/g,L=/>[ \t]+<(-?[A-Za-z]|\/[-A-Za-z])/g,M=RegExp("^(?:disabled|checked|readonly|required|allowfullscreen|auto(?:focus|play)|compact|controls|default|formnovalidate|hidden|ismap|itemscope|loop|multiple|muted|no(?:resize|shade|validate|wrap)?|open|reversed|seamless|selected|sortable|truespeed|typemustmatch)$"),T=["style","src","d"],A=/^(?:input|img|br|wbr|hr|area|base|col|embed|keygen|link|meta|param|source|track)$/,R=/<pre(?:\s+(?:[^">]*|"[^"]*")*)?>([\S\s]+?)<\/pre\s*>/gi,I=/^"(?:number|date(?:time)?|time|month|email|color)\b/i,$=/^\s*import(?:\s*[*{]|\s+[$_a-zA-Z'"]).*\n?/gm,k=/[ \t]+$/gm,F=U(/@#\d/,"x01"),P=U(/@#(\d+)/g,"x01"),H="#",B="⁗",D='"',q="'",z=/^[ \t]*([$_A-Za-z][$\w]*)\s*\([^()]*\)\s*{/m,K=RegExp("[{}]|"+de.S_QBLOCKS,"g"),Z=RegExp(de.R_MLCOMMS.source+"|//[^\r\n]*|"+de.S_QBLOCKS,"g"),G=RegExp("([{}]|^)[ ;]*([^@ ;{}][^{}]*)(?={)|"+O,"g"),Q=/\stype\s*=\s*(?:(['"])(.+?)\1|(\S+))/i,W="\\s*=\\s*("+S+"|{[^}]+}|\\S+)",X=/\/>\n|^<(?:\/?-?[A-Za-z][-\w\xA0-\xFF]*\s*|-?[A-Za-z][-\w\xA0-\xFF]*\s+[-\w:\xA0-\xFF][\S\s]*?)>\n/,J=RegExp(/^([ \t]*)<(-?[A-Za-z][-\w\xA0-\xFF]*)(?:\s+([^'"\/>]+(?:(?:@|\/[^>])[^'"\/>]*)*)|\s*)?(?:\/>|>[ \t]*\n?([\S\s]*)^\1<\/\2\s*>|>(.*)<\/\2\s*>)/.source.replace("@",S),"gim"),Y=/<script(\s+[^>]*)?>\n?([\S\s]*?)<\/script\s*>/gi,ee=/<style(\s+[^>]*)?>\n?([\S\s]*?)<\/style\s*>/gi;return V.util.compiler={compile:_,html:i,css:l,js:s,version:"v2.5.5"},_}();V.compile=function(){function e(e,t,n){var r=new XMLHttpRequest;r.onreadystatechange=function(){4===r.readyState&&(200===r.status||!r.status&&r.responseText.length)&&t(r.responseText,n,e)},r.open("GET",e,!0),r.send("")}function n(e,t){if(typeof e===ne){var n=H("script"),r=document.documentElement;t&&(e+="\n//# sourceURL="+t+".js"),n.text=e,r.appendChild(n),r.removeChild(n)}}function r(t,r){function a(){o.trigger("ready"),i=!0,t&&t()}function u(e,t,r){var o=ye(e,t,r);n(o,r),--c||a()}var s=B('script[type="riot/tag"]'),c=s.length;if(c)for(var f=0;f<s.length;++f){var l=s[f],p=T({template:_(l,"template")},r),d=_(l,"src");d?e(d,u,p):u(l.innerHTML,p)}else a()}var o,i;return function(a,u,s){if(typeof a===ne){if(y(u)&&(s=u,u=!1),/^\s*</m.test(a)){var c=ye(a,s);return u!==!0&&n(c),m(u)&&u(c,a,s),c}e(a,function(e,t,r){var o=ye(e,t,r);n(o,r),u&&u(o,e,t)},s)}else{if(m(a)?(s=u,u=a):(s=a,u=t),i)return u&&u();o?u&&o.on("ready",u):(o=V.observable(),r(u,s))}}}();var be=V.mount;V.mount=function(){var e,t=arguments;return V.compile(function(){e=be.apply(V,t)}),e},typeof exports===re?module.exports=V:typeof define===ie&&typeof define.amd!==oe?define(function(){return V}):e.riot=V}("undefined"!=typeof window?window:void 0);