var Absurd=function(){var b={api:{},helpers:{},plugins:{},processors:{css:{plugins:{}},html:{plugins:{},helpers:{}},component:{plugins:{}}}},d=function(a){return a.indexOf("css/CSS.js")>0||"/../CSS.js"==a?b.processors.css.CSS:a.indexOf("html/HTML.js")>0?b.processors.html.HTML:a.indexOf("component/Component.js")>0?b.processors.component.Component:"js-beautify"==a?{html:function(a){return a}}:"./helpers/PropAnalyzer"==a?b.processors.html.helpers.PropAnalyzer:"../../helpers/TransformUppercase"==a?b.helpers.TransformUppercase:"./helpers/TemplateEngine"==a?b.processors.html.helpers.TemplateEngine:"../helpers/Extend"==a?b.helpers.Extend:"../helpers/Clone"==a?b.helpers.Clone:"../helpers/Prefixes"==a||"/../../../helpers/Prefixes"==a?b.helpers.Prefixes:function(){}},e="",f=function(a,b){!function c(){a.length>0&&a.shift().apply(b||{},[c].concat(Array.prototype.slice.call(arguments,0)))}()},g=function(a,b){var c;try{c=(b||document).querySelectorAll(a)}catch(d){c=document.querySelectorAll(a)}return c},h=function(a){var b={option:[1,""],legend:[1,"
"],area:[1,""],param:[1,""],thead:[1,""],tr:[2,""],col:[2,""],td:[3,""],_default:[1,"","
"]};b.optgroup=b.option,b.tbody=b.tfoot=b.colgroup=b.caption=b.thead,b.th=b.td;var c=document.createElement("div"),d=/<\s*\w.*?>/g.exec(a);if(null!=d){var c,e=d[0].replace(//g,""),f=b[e]||b._default;a=f[1]+a+f[2],c.innerHTML=a;for(var g=f[0]+1;g--;)c=c.lastChild}else c.innerHTML=a,c=c.lastChild;return c},i=function(a,b,c){return a.addEventListener?(a.addEventListener(b,c,!1),!0):a.attachEvent?a.attachEvent("on"+b,c):void 0},j=function(a){for(var b,c=a.childNodes,d=c.length,e=0,f=/^\s*$/;d>e;e++)b=c[e],3==b.nodeType&&f.test(b.nodeValue)&&(a.removeChild(b),e--,d--);return a},k=function(b,c,d){for(var e=document.createElement(b),f=0;f=b.childNodes.length)for(var h=0;h0&&(this.el=e[0],q={"":this.el.outerHTML.replace(/</g,"<").replace(/>/g,">")})}d()}else"object"==typeof this.html?(q=m({},this.html),d()):a();else a();return this};var r=!1;l.__append=function(a){return!r&&this.el&&this.get("parent")&&(r=!0,this.get("parent").appendChild(this.el)),a(),this};var s={events:{}};l.__handleEvents=function(a){if(this.el){var b=this,c=function(a){var c=a.getAttribute("data-absurd-event");if(c=c.split(":"),c.length>=2){var d=c[0],e=c[1];c.splice(0,2);var f=c;(!s.events[d]||s.events[d].indexOf(a)<0)&&(s.events[d]||(s.events[d]=[]),s.events[d].push(a),i(a,d,function(a){if("function"==typeof b[e]){var c=b[e];c.apply(b,[a].concat(f))}}))}};this.el.hasAttribute&&this.el.hasAttribute("data-absurd-event")&&c(this.el);for(var d=this.el.querySelectorAll?this.el.querySelectorAll("[data-absurd-event]"):[],e=0;e'},l.child=function(){var a=Array.prototype.slice.call(arguments,0),b=this.get("children"),c=b&&b[a.shift()],d="_"+t.index++;return t.funcs[d]={args:a,func:function(a){c.populate({callback:function(b){a(b.html.element)}})}},''},l.wire=function(a){return c.components.events.on(a,this[a]||function(){},this),this},l.populate=function(a){return f([l.__handleCSS,l.__handleHTML,l.__append,l.__handleEvents,l.__handleAsyncFunctions,function(){t={funcs:{},index:0};var b={css:p,html:{element:this.el}};this.dispatch("populated",b),a&&"function"==typeof a.callback&&a.callback(b)}],this),this},l.str2DOMElement=h,l.addEventListener=i,l.queue=f,l.compileHTML=function(a,b,d){c.flush().morph("html").add(a).compile(b,d)},l.compileCSS=function(a,b,d){c.flush().add(a).compile(b,d)},l.qs=function(a,b){return b=b===!1?document:b||this.el||document,b.querySelector(a)},l.qsa=function(a,b){return b=b===!1?document:b||this.el||document,b.querySelectorAll(a)},l.getStyle=function(a,b){return b=b||this.el,b&&b.currentStyle?b.currentStyle[a]:window.getComputedStyle?document.defaultView.getComputedStyle(b,null).getPropertyValue(a):null},l.addClass=function(a,b){if(b=b||this.el,b.classList)b.classList.add(a);else{var c=b.className;c.indexOf(a)<0&&(""==c?b.className=a:b.className+=" "+a)}return l},l.removeClass=function(a,b){if(b=b||this.el,b.classList)b.classList.remove(a);else{for(var c=b.className.split(" "),d=[],e=0;e=0?c.splice(d,1):c.push(a),b.className=c.join(" ")}return l},l},m=function(){return function(a){var d=function(a,b){for(var c in b)hasOwnProperty.call(b,c)&&(a[c]=b[c]);return a},e={defaultProcessor:b.processors.css.CSS()},f={},g={},h={},i={};e.getRules=function(a){return"undefined"==typeof a?f:("undefined"==typeof f[a]&&(f[a]=[]),f[a])},e.getPlugins=function(){return h},e.getStorage=function(){return g},e.flush=function(){return f={},g=[],i={},e.defaultProcessor=b.processors.css.CSS(),e},e.import=function(){return e.callHooks("import",arguments)?e:e},e.addHook=function(a,b){i[a]||(i[a]=[]);for(var d=!1,e=0;c=i[a][e];e++)c===b&&(d=!0);d===!1?i[a].push(b):null},e.callHooks=function(a,b){if(i[a])for(var d=0;c=i[a][d];d++)if(c.apply(e,b)===!0)return!0;return!1},e.numOfAddedRules=0,e.components=function(a){var c=b.helpers.Extend,d=b.helpers.Clone,e={},f=[],g=c({},l()),h={};return function(a){document.addEventListener?document.addEventListener("DOMContentLoaded",a):document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&a()})}(function(){h.broadcast("ready")}),h={events:g,register:function(b,h){return e[b]=function(){var e=c({},l(b,a,g,d(h)));return a.di.resolveObject(e),f.push(e),"function"==typeof e.constructor&&e.constructor.apply(e,Array.prototype.slice.call(arguments,0)),e}},get:function(a){if(e[a])return e[a];throw new Error("There is no component with name '"+a+"'.")},remove:function(a){return e[a]?(delete e[a],!0):!1},list:function(){var a=[];for(var b in e)a.push(b);return a},flush:function(){return e={},f=[],this},broadcast:function(a,b){for(var c=0;c=0?g(p.replace(/&/g,a),n[q],h,i):g(p,n[q],h,"undefined"!=typeof i?i+" "+a:a);else g(q.replace(/&/g,a),n[q],h,i);else 0===q.indexOf("@media")||0===q.indexOf("@supports")?g(a,n[q],q,i):0===a.indexOf("@media")||0===q.indexOf("@supports")?g(q,n[q],a,i):0===a.indexOf("^")?g(a.substr(1,a.length-1)+("undefined"!=typeof i?" "+i:"")+" "+q,n[q],h):f(a,q,n[q],h,i)===!1&&g(q,n[q],h,(i?i+" ":"")+a);for(var q in o){var s={};s[q]=o[q](),g(a,s,h,i)}}}else for(var k=0;k"===o.toString().charAt(0)?m&&m[n]?m[n]+" "+o.substr(1,o.length-1):o.substr(1,o.length-1):o:o)}l[i]=m}return a};return h};var n=d("../helpers/Extend");b.api.compile=function(a){return function(){for(var b=null,c=null,d=null,e=0;ed;d++)c=parseInt(a.substr(2*d,2),16),c=Math.round(Math.min(Math.max(0,c+c*b),255)).toString(16),e+=("00"+c).substr(c.length);return e};b.api.darken=function(){return function(a,b){return q(a,-(b/100))}},b.api.define=function(a){return function(b,c){return a.getStorage().__defined||(a.getStorage().__defined={}),a.getStorage().__defined[b]=c,a}},b.api.hook=function(a){return function(b,c){return a.addHook(b,c),a}};var q=function(a,b){a=String(a).replace(/[^0-9a-f]/gi,""),a.length<6&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),b=b||0;var c,d,e="#";for(d=0;3>d;d++)c=parseInt(a.substr(2*d,2),16),c=Math.round(Math.min(Math.max(0,c+c*b),255)).toString(16),e+=("00"+c).substr(c.length);return e};b.api.lighten=function(){return function(a,b){return q(a,b/100)}};var r={html:function(a){a.defaultProcessor=d(e+"/../processors/html/HTML.js")(),a.hook("add",function(b,c){return a.getRules(c||"mainstream").push(b),!0})},component:function(a){a.defaultProcessor=d(e+"/../processors/component/Component.js")(),a.hook("add",function(b){b instanceof Array||(b=[b]);for(var d=0;de;e++)d=c[e],b(d);return a}},b.api.register=function(a){return function(b,c){return a[b]=c,a}},b.api.storage=function(a){var b=a.getStorage(),c=function(d,e){if("undefined"!=typeof e)b[d]=e;else{if("object"!=typeof d){if(b[d])return b[d];throw new Error("There is no data in the storage associated with '"+d+"'")}for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&c(f,d[f])}return a};return c},b.helpers.Clone=function M(a){if(!a)return a;var b,c=[Number,String,Boolean];if(c.forEach(function(c){a instanceof c&&(b=c(a))}),"undefined"==typeof b)if("[object Array]"===Object.prototype.toString.call(a))b=[],a.forEach(function(a,c){b[c]=M(a)});else if("object"==typeof a)if(a.nodeType&&"function"==typeof a.cloneNode)var b=a.cloneNode(!0);else if(a.prototype)b=a;else if(a instanceof Date)b=new Date(a);else{b={};for(var d in a)b[d]=M(a[d])}else b=a;return b},b.helpers.ColorLuminance=function(a,b){a=String(a).replace(/[^0-9a-f]/gi,""),a.length<6&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]),b=b||0;var c,d,e="#";for(d=0;3>d;d++)c=parseInt(a.substr(2*d,2),16),c=Math.round(Math.min(Math.max(0,c+c*b),255)).toString(16),e+=("00"+c).substr(c.length);return e},b.helpers.Extend=function(){for(var a=function(a,b){for(var c in b)hasOwnProperty.call(b,c)&&(a[c]=b[c]);return a},b=arguments[0],c=1;c=0)&&(b["-webkit-"+d.prop]=e),(""===d.prefix||d.prefix.indexOf("m")>=0)&&(b["-moz-"+d.prop]=e),(""===d.prefix||d.prefix.indexOf("s")>=0)&&(b["-ms-"+d.prop]=e),(""===d.prefix||d.prefix.indexOf("o")>=0)&&(b["-o-"+d.prop]=e))},nonPrefixProp:function(a){var b=t(a);return b.prefix!==!1&&(b.prefix=""==b.prefix?"-":"-"+b.prefix+"-"),b}},b.helpers.RequireUncached=function(a){return delete d.cache[d.resolve(a)],d(a)},b.helpers.TransformUppercase=function(a){for(var b="",d=0;c=a.charAt(d);d++)b+=c===c.toUpperCase()&&c.toLowerCase()!==c.toUpperCase()?"-"+c.toLowerCase():c;return b};var u=function(a,b,f){var g="",h="",i=[],j=f.api;cssPreprocessor=d(e+"/../css/CSS.js")(),htmlPreprocessor=d(e+"/../html/HTML.js")();for(var k=function(a){for(var b=0;ba.length-1)return b(d),void 0;var g=a[c];"function"==typeof g&&(g=g()),j.morph("html").add(g.html?g.html:{}),htmlPreprocessor(j.getRules(),function(a,b){h+=b,c+=1,d=a,e()},f)};e()},m=function(a){for(var b in a)if("_include"===b)if(a[b]instanceof Array)for(var d=0;d","g");a="function"!=typeof c[d]?a.replace(e,c[d]):a.replace(e,c[d]())}}return a};b.processors.css.CSS=function(){var a=function(a,b,c){c=c||x;var d="";for(var e in a){var f=a[e];f=c.combineSelectors?A(f):f,d+="mainstream"===e?z(f,c):e+" {"+w+z(f,c)+"}"+w}return d=C(d,c),c.minify?(d=B(d),b&&b(null,d)):b&&b(null,d),d};return a.type="css",a},b.processors.css.plugins.charset=function(){return function(a,b){"string"==typeof b?a.raw('@charset: "'+b+'";'):"object"==typeof b&&(b=b.charset.replace(/:/g,"").replace(/'/g,"").replace(/"/g,"").replace(/ /g,""),a.raw('@charset: "'+b+'";'))}},b.processors.css.plugins.document=function(){return function(a,b){if("object"==typeof b){var c="";if(c+="@"+b.vendor+"document",c+=" "+b.document,b.rules&&b.rules.length)for(var d=0;rule=b.rules[d];d++)a.handlecssrule(rule,c);else"undefined"!=typeof b.styles&&a.add(b.styles,c)}}},b.processors.css.plugins.keyframes=function(){return function(a,b){var c=d(e+"/../CSS.js")(),f=d(e+"/../../../helpers/Prefixes");if("object"==typeof b)if("undefined"!=typeof b.frames){for(var g in b.frames)for(var h in b.frames[g])f.addPrefixes(h,b.frames[g]);var i="@keyframes "+b.name+" {\n";i+=c({mainstream:b.frames}),i+="}",a.raw(i+"\n"+i.replace("@keyframes","@-webkit-keyframes"))}else if("undefined"!=typeof b.keyframes){for(var i="@keyframes "+b.name+" {\n",j={},k=0;rule=b.keyframes[k];k++)if("keyframe"===rule.type)for(var l=j[rule.values]={},m=0;declaration=rule.declarations[m];m++)"declaration"===declaration.type&&(l[declaration.property]=declaration.value);i+=c({mainstream:j}),i+="}",a.raw(i+"\n"+i.replace("@keyframes","@-webkit-keyframes"))}}},b.processors.css.plugins.media=function(){return function(a,b){var c=d(e+"/../CSS.js")();if("object"==typeof b){for(var f="@media "+b.media+" {\n",g={},h=0;rule=b.rules[h];h++){var i=g[rule.selectors.toString()]={};if("rule"===rule.type)for(var j=0;declaration=rule.declarations[j];j++)"declaration"===declaration.type&&(i[declaration.property]=declaration.value)}f+=c({mainstream:g}),f+="}",a.raw(f)}}},b.processors.css.plugins.namespace=function(){return function(a,b){"string"==typeof b?a.raw('@namespace: "'+b+'";'):"object"==typeof b&&(b=b.namespace.replace(/: /g,"").replace(/'/g,"").replace(/"/g,"").replace(/ /g,"").replace(/:h/g,"h"),a.raw('@namespace: "'+b+'";'))}},b.processors.css.plugins.page=function(){return function(a,b){if("object"==typeof b){var c="";c+=b.selectors.length>0?"@page "+b.selectors.join(", ")+" {\n":"@page {\n";for(var d=0;declaration=b.declarations[d];d++)"declaration"==declaration.type&&(c+=" "+declaration.property+": "+declaration.value+";\n");c+="}",a.raw(c)}}},b.processors.css.plugins.supports=function(){return function(a,b){var c=d(e+"/../CSS.js")();if("object"==typeof b){for(var f="@supports "+b.supports+" {\n",g={},h=0;rule=b.rules[h];h++){var i=g[rule.selectors.toString()]={};if("rule"===rule.type)for(var j=0;declaration=rule.declarations[j];j++)"declaration"===declaration.type&&(i[declaration.property]=declaration.value)}f+=c({mainstream:g}),f+="}",a.raw(f)}}};var D=null,w="\n",x={},E=d("js-beautify").html,F=d("../../helpers/TransformUppercase"),G={},H=function(a){var b="";for(var c in D)if(c==a)for(var d=D[c].length,e=0;d>e;e++)b+=J("",D[c][e]);return b},I=function(a,b){return b&&b.keepCamelCase===!0?a:F(a,b)},J=function(a,b){var c="",e="",f="",g=d("./helpers/PropAnalyzer")(a);if(a=g.tag,""!=g.attrs&&(e+=" "+g.attrs),"string"==typeof b)return K(a,e,b);var h=function(a){""!=f&&(f+=w),f+=a};for(var i in b){var j=b[i];switch(i){case"_attrs":for(var k in j)e+="function"==typeof j[k]?" "+I(k,G)+'="'+j[k]()+'"':" "+I(k,G)+'="'+j[k]+'"';break;case"_":h(j);break;case"_tpl":if("string"==typeof j)h(H(j));else if(j instanceof Array){for(var l="",m=0;tpl=j[m];m++)l+=H(tpl),m0){for(var l="",m=0;v=j[m];m++)l+=J("","function"==typeof v?v():v),m"+w+c+w+""+I(a,G)+">":"<"+I(a,G)+b+"/>")},L=function(a){return a=d("./helpers/TemplateEngine")(a.replace(/[\r\t\n]/g,""),G),G.minify?a:E(a,{indent_size:G.indentSize||4})};return b.processors.html.HTML=function(){var a=function(a,b,c){D=a,b=b||function(){},c=G=c||x;var d=L(H("mainstream"));return b(null,d),d};return a.type="html",a},b.processors.html.helpers.PropAnalyzer=function(a){var b={tag:"",attrs:""},d=(a.length,""),e=!1,f=[],g="",h=!1,i="",j=!1;if(/(#|\.|\[|\])/gi.test(a)===!1)return{tag:a,attrs:""};for(var k=0;k/g,e=/(^( )?(var|if|for|else|switch|case|break|{|}|;))(.*)?/g,f="var r=[];\n",g=0,h=function(a,b){return f+=b?a.match(e)?a+"\n":"r.push("+a+");\n":""!=a?'r.push("'+a.replace(/"/g,'\\"')+'");\n':"",h};match=d.exec(a);)h(a.slice(g,match.index))(match[1],!0),g=match.index+match[0].length;h(a.substr(g,a.length-g)),f=(f+'return r.join("");').replace(/[\r\t\n]/g,"");try{c=new Function(f).apply(b)}catch(i){console.error("'"+i.message+"'"," in \n\nCode:\n",f,"\n")}return c},m()}(window);