/*! tmpl 0.12.1 https://github.com/mastermatt/tmpljs */
!function(a){"use strict";var b,c,d,e,f,g="0.12.1",h=["input","textarea"],i=/^(\s*)(([\w.-]*)\((.*)\)|[\w-]*)(.*)$/,j=/\[([\w-]+)=?([^\]]*)\]/g,k=/([.#$])([\w-]+)/g,l=/\{([!&]?)\s*([^\s\}]*)\s*\}/g,m=/[&<>"'`\/]/g,n={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","/":"&#x2F;"},o=function(a){return n[a]},p=function(a,b){for(var c=a.split("."),d=0,e=c.length;e>d;)b=b[c[d++]];return b},q=function(g,n,q){if(!a.isArray(g))throw"template must be array";n=n||{},q=q||n;for(var r=a(),s=0,t=g.length,u=0,v={},w=function(b,c,d){if("!"===c)return"{"+b.slice(2);var e=p(d,n);return a.isFunction(e)&&(e=e.call(n)),e||0===e||(e=""),"&"===c?e:e.replace(m,o)};t>s;){var x=i.exec(g[s++]),y=x[2],z=x[3],A=x[5],B=!1,C=!1,D=[],E=(x[1].length+1)/4|0;if(y||A){if(z){if(B=p(z,q).apply(q,a.map(x[4].split(","),a.trim)),!B)continue;B instanceof a&&(C=B,B=B[0])}if(B&&1===B.nodeType||(B=document.createElement(y||"div")),E&&c){for(E>u&&(c=b);E<u--;)c=c.parentNode;c.appendChild(B)}else r.push(c=B);if(u=E,b=B,A){for(A=A.replace(j,function(a,b,c){return B.setAttribute(b,c||""),""}),d=A.indexOf(" "),-1!==d&&(e=A.substr(d+1).replace(l,w),A=A.substr(0,d),a.inArray(B.tagName.toLowerCase(),h)<0?B.innerHTML=e:B.value=e);x=k.exec(A);)switch(f=x[2],x[1]){case".":D.push(f);break;case"#":B.id=f;break;case"$":v[f]=C||a(B)}B.className&&D.push(B.className),D.length&&(B.className=D.join(" "))}}}return r.c=r.cache=v,r};q.version=g,a.tmpl=q,a.fn.tmpl=function(b,c,d){var e,f,g=this,h=g.c=g.cache=g.c||{};return g.each(function(){e=q(b,c,d),a(this).append(e);for(f in e.c)h[f]?h[f].push(e.c[f][0]):h[f]=e.c[f]})}}(jQuery);