microbejs
Version:
microbe.js - A modular JS library for DOM manipulation, and more
2 lines • 30.8 kB
JavaScript
/*! Microbe v0.5.2 | (c) 2014-2016 Sociomantic Labs | http://m.icro.be/license */
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.µ=t()}}(function(){return function t(e,n,r){function o(u,c){if(!n[u]){if(!e[u]){var s="function"==typeof require&&require;if(!c&&s)return s(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var f=n[u]={exports:{}};e[u][0].call(f.exports,function(t){var n=e[u][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(t,e,n){"use strict";var r="[object Microbe]",o=t("./version"),i=function(t,e,n){return new i.core.__init__(t,e,n)};t("./selectorEngine/init")(i,r,o),t("./modules/tools")(i),t("./modules/pageStyles")(i),t("./modules/dom")(i),t("./modules/elements")(i),t("./modules/http")(i),t("./modules/data")(i),t("./modules/events")(i),e.exports=i.core.constructor=i},{"./modules/data":9,"./modules/dom":10,"./modules/elements":11,"./modules/events":12,"./modules/http":13,"./modules/pageStyles":14,"./modules/tools":15,"./selectorEngine/init":19,"./version":22}],2:[function(t,e,n){(function(t){function n(){for(;o.next;){o=o.next;var t=o.task;o.task=void 0;var e=o.domain;e&&(o.domain=void 0,e.enter());try{t()}catch(r){if(s)throw e&&e.exit(),setTimeout(n,0),e&&e.enter(),r;setTimeout(function(){throw r},0)}e&&e.exit()}u=!1}function r(e){i=i.next={task:e,domain:s&&t.domain,next:null},u||(u=!0,c())}var o={task:void 0,next:null},i=o,u=!1,c=void 0,s=!1;if("undefined"!=typeof t&&t.nextTick)s=!0,c=function(){t.nextTick(n)};else if("function"==typeof setImmediate)c="undefined"!=typeof window?setImmediate.bind(window,n):function(){setImmediate(n)};else if("undefined"!=typeof MessageChannel){var a=new MessageChannel;a.port1.onmessage=n,c=function(){a.port2.postMessage(0)}}else c=function(){setTimeout(n,0)};e.exports=r}).call(this,t("_process"))},{_process:3}],3:[function(t,e,n){function r(){}var o=e.exports={};o.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),o.title="browser",o.browser=!0,o.env={},o.argv=[],o.on=r,o.addListener=r,o.once=r,o.off=r,o.removeListener=r,o.removeAllListeners=r,o.emit=r,o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")}},{}],4:[function(t,e,n){"use strict";e.exports=t("./lib/core.js"),t("./lib/done.js"),t("./lib/es6-extensions.js"),t("./lib/node-extensions.js")},{"./lib/core.js":5,"./lib/done.js":6,"./lib/es6-extensions.js":7,"./lib/node-extensions.js":8}],5:[function(t,e,n){"use strict";function r(t){function e(t){return null===s?void f.push(t):void u(function(){var e=s?t.onFulfilled:t.onRejected;if(null===e)return void(s?t.resolve:t.reject)(a);var n;try{n=e(a)}catch(r){return void t.reject(r)}t.resolve(n)})}function n(t){try{if(t===l)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var e=t.then;if("function"==typeof e)return void i(e.bind(t),n,r)}s=!0,a=t,c()}catch(o){r(o)}}function r(t){s=!1,a=t,c()}function c(){for(var t=0,n=f.length;n>t;t++)e(f[t]);f=null}if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");var s=null,a=null,f=[],l=this;this.then=function(t,n){return new l.constructor(function(r,i){e(new o(t,n,r,i))})},i(t,n,r)}function o(t,e,n,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.resolve=n,this.reject=r}function i(t,e,n){var r=!1;try{t(function(t){r||(r=!0,e(t))},function(t){r||(r=!0,n(t))})}catch(o){if(r)return;r=!0,n(o)}}var u=t("asap");e.exports=r},{asap:2}],6:[function(t,e,n){"use strict";var r=t("./core.js"),o=t("asap");e.exports=r,r.prototype.done=function(t,e){var n=arguments.length?this.then.apply(this,arguments):this;n.then(null,function(t){o(function(){throw t})})}},{"./core.js":5,asap:2}],7:[function(t,e,n){"use strict";function r(t){this.then=function(e){return"function"!=typeof e?this:new o(function(n,r){i(function(){try{n(e(t))}catch(o){r(o)}})})}}var o=t("./core.js"),i=t("asap");e.exports=o,r.prototype=o.prototype;var u=new r(!0),c=new r(!1),s=new r(null),a=new r(void 0),f=new r(0),l=new r("");o.resolve=function(t){if(t instanceof o)return t;if(null===t)return s;if(void 0===t)return a;if(t===!0)return u;if(t===!1)return c;if(0===t)return f;if(""===t)return l;if("object"==typeof t||"function"==typeof t)try{var e=t.then;if("function"==typeof e)return new o(e.bind(t))}catch(n){return new o(function(t,e){e(n)})}return new r(t)},o.all=function(t){var e=Array.prototype.slice.call(t);return new o(function(t,n){function r(i,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var c=u.then;if("function"==typeof c)return void c.call(u,function(t){r(i,t)},n)}e[i]=u,0===--o&&t(e)}catch(s){n(s)}}if(0===e.length)return t([]);for(var o=e.length,i=0;i<e.length;i++)r(i,e[i])})},o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,n){t.forEach(function(t){o.resolve(t).then(e,n)})})},o.prototype["catch"]=function(t){return this.then(null,t)}},{"./core.js":5,asap:2}],8:[function(t,e,n){"use strict";var r=t("./core.js"),o=t("asap");e.exports=r,r.denodeify=function(t,e){return e=e||1/0,function(){var n=this,o=Array.prototype.slice.call(arguments);return new r(function(r,i){for(;o.length&&o.length>e;)o.pop();o.push(function(t,e){t?i(t):r(e)});var u=t.apply(n,o);!u||"object"!=typeof u&&"function"!=typeof u||"function"!=typeof u.then||r(u)})}},r.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),n="function"==typeof e[e.length-1]?e.pop():null,i=this;try{return t.apply(this,arguments).nodeify(n,i)}catch(u){if(null===n||"undefined"==typeof n)return new r(function(t,e){e(u)});o(function(){n.call(i,u)})}}},r.prototype.nodeify=function(t,e){return"function"!=typeof t?this:void this.then(function(n){o(function(){t.call(e,null,n)})},function(n){o(function(){t.call(e,n)})})}},{"./core.js":5,asap:2}],9:[function(t,e,n){e.exports=function(t){"use strict";t.core.get=function(t){var e=function(e){return t?e.data&&e.data[t]?e.data[t]:!1:e.data};return this.map(e)},t.core.set=function(e,n){var r=function(r){r.data=r.data||{},t.isArray(n)?n=t.extend([],n):t.isObject(n)&&(n=t.extend({},n)),r.data[e]=n};return this.each(r),this}}},{}],10:[function(t,e,n){e.exports=function(t){"use strict";t.core.append=function(){var e=function(t,e){for(var n,r=0,o=this.length;o>r;r++)n=this[r],e?n.innerHTML=t+n.innerHTML:n.innerHTML+=t;return this},n=function(t,e){t.appendChild(e)},r=function(e){return"string"==typeof e?new t(e):e.length?e:[e]},o=function(t,e){var n=t.firstElementChild;t.insertBefore(e,n)};return function(t,i,u){var c,s=i?o:n,a=[];t=r(t);var f=u?t:this;return t=u?this:t,-1!==t.indexOf("/")?e.call(f,t,i):(f.forEach(function(e,n){t.forEach(function(t,e){c=0===n?t:t.cloneNode(!0),a.push(c),s(f[n],c)})}),this.constructor(a))}}(),t.core.appendTo=function(t){return this.append(t,!1,!0)},t.core.insertAfter=function(e){var n=[],r=function(t,r){for(var o,i=Array.prototype.slice.call(t.parentNode.children),u=i.indexOf(t)+1,c=t.parentNode.children[u],s=0,a=e.length;a>s;s++)o=0===r?e[s]:e[s].cloneNode(!0),n.push(o),c?c.parentNode.insertBefore(o,c):t.parentNode.appendChild(o)};"string"==typeof e?e=new t(e):e.length||(e=[e]);var o,i;for(o=0,i=this.length;i>o;o++)r(this[o],o);return this.constructor(n)},t.core.prepend=function(t){return this.append(t,!0)},t.core.prependTo=function(t){return this.append(t,!0,!0)},t.ready=function(t,e){return"complete"===document.readyState?t.apply(this,e):void(window.addEventListener?window.addEventListener("load",t,!1):window.attachEvent?window.attachEvent("onload",t):window.onload=t)},t.core.remove=function(){return this.off&&this.off(),this.forEach(function(t){t.remove()}),this},"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentElement.removeChild(this)})}},{}],11:[function(t,e,n){e.exports=function(t){"use strict";var e=t.type;t.core.addClass=function(t){var e=function(e){for(var n=0,r=t.length;r>n;n++)for(var o=t[n].split(" "),i=0,u=o.length;u>i;i++)""!==o[i]&&e.classList.add(o[i])};return"string"==typeof t&&(t=[t]),this.each(e),this},t.core.attr=function(e,n){var r=!!t.isObject(e),o=function(t){var o=function(e,n){t.getAttribute?t.setAttribute(e,n):t[e]=n};if(null===n)u(t);else{var i;if(r)for(i in e)n=e[i],o(i,n);else o(e,n)}},i=function(t){return t.getAttribute(e)},u=function(t){null===t.getAttribute(e)?delete t[e]:t.removeAttribute(e)};return void 0!==n||r?(this.each(o),this):this.map(i)},t.core.css=function(e,n){var r=t.isObject(e),o=function(t){t.style[e]=n},i=function(t){return window.getComputedStyle(t).getPropertyValue(e)};if(n||null===n||""===n||r){if(r){for(var u in e)this.css(u,e[u]);return this}return n=null===n?"":n,this.each(o),this}return this.map(i)},t.core.getParentIndex=function(){var t=function(t){return Array.prototype.indexOf.call(t.parentNode.children,t)};return this.map(t)},t.core.hasClass=function(t){var e=function(e){return e.classList.contains(t)};return this.map(e)},t.core.height=function(t){return t?this.css("height",t):this.css("height")},t.core.html=function(t){var n;t&&t.type===e&&(n=t,t="");var r=function(t){return t.innerHTML};if(t&&1===t.nodeType)return r(t);if(t||""===t||0===t){var o=function(e){e.innerHTML=t};return this.each(o),n?this.append(n):this}return this.map(r)},t.core.offset=function(){var t=this.length,e=Array(t),n=Array(t),r=function(t,r){var o=e[r]=t.offsetTop,i=n[r]=t.offsetLeft;return{top:o,left:i}},o=this.map(r);return o.top=e,o.left=n,o},t.core.position=function(){var t=this.length,e=Array(t),n=Array(t),r=function(t,r){for(var o=0,i=0;t;)o+=t.offsetTop,i+=t.offsetLeft,t=t.offsetParent;return e[r]=o,n[r]=i,{top:o,left:i}},o=this.map(r);return o.top=e,o.left=n,o},t.core.removeClass=function(t){var e=function(e){for(var n=0,r=t.length;r>n;n++)for(var o=t[n].split(" "),i=0,u=o.length;u>i;i++)""!==o[i]&&e.classList.remove(o[i])};return"string"==typeof t&&(t=[t]),this.each(e),this},t.core.scroll=function(){var t=this.length,e=Array(t),n=Array(t),r=function(t,r){var o=e[r]=t.scrollTop,i=n[r]=t.scrollLeft;return{top:o,left:i}},o=this.map(r);return o.top=e,o.left=n,o},t.core.text=function(t){var e=function(e){document.all?e.innerText=t:e.textContent=t},n=function(t){return document.all?t.innerText:t.textContent};return t||""===t||0===t?(this.each(e),this):this.map(n)},t.core.toggleClass=function(t){var e;Array.isArray(t)||(t=[t]);for(var n=function(t){t.classList.contains(e)?t.classList.remove(e):t.classList.add(e)},r=0,o=t.length;o>r;r++)e=t[r],this.each(n);return this},t.core.value=function(t){var e=function(e){return t||""===t?(e.value=t,e):e.value},n=this.map(e);return n},t.core.width=function(t){return t?this.css("width",t):this.css("width")}}},{}],12:[function(t,e,n){e.exports=function(t){"use strict";t.core.emit=function(t,e,n,r){n=n||!1,r=r||!1;var o=function(o){var i=new CustomEvent(t,{detail:e,cancelable:r,bubbles:n});o.dispatchEvent(i)};return this.each(o),this},t.core.off=function(e,n){var r=function(t){return t},o=function(e,o){var i=n,u="_"+o+"-bound-function";if(!i&&e.data&&e.data[u])i=e.data[u];else if(!e.data||!e.data[u])return null;if(i){t.isArray(i)||(i=[i]);for(var c,s,a=0,f=i.length;f>a;a++)s=e.data[u],c=s.indexOf(i[a]),-1!==c&&(e.removeEventListener(o,i[a]),s[c]=null);e.data[u]=e.data[u].filter(r)}},i=function(n){!e&&n.data&&n.data.__boundEvents&&n.data.__boundEvents?e=n.data.__boundEvents:(n.data=n.data||{},n.data.__boundEvents=n.data.__boundEvents||{}),t.isArray(e)||(e=[e]);for(var i=0,u=e.length;u>i;i++)o(n,e[i]);n.data.__boundEvents=e.filter(r)};return this.each(i),this},t.core.on=function(t,e){var n=function(n){var r="_"+t+"-bound-function";n.data=n.data||{},n.data[r]=n.data[r]||[],n.data.__boundEvents=n.data.__boundEvents||[],n.addEventListener(t,e),n.data[r].push(e),n.data.__boundEvents.push(t)};return this.each(n),this},"function"!=typeof CustomEvent&&!function(){function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}t.prototype=window.Event.prototype,window.CustomEvent=t}()}},{}],13:[function(t,e,n){e.exports=function(e){"use strict";var n=t("promise");e.http=function(t){var e,r,o,i,u,c,s,a;if(!t)return new Error("No parameters given");if("string"==typeof t&&(t={url:t}),e=new XMLHttpRequest,r=t.method||"GET",o=t.url,i=JSON.stringify(t.data)||null,u=t.user||"",c=t.password||"",s=t.headers||null,a="boolean"==typeof t.async?t.async:!0,e.onreadystatechange=function(){return 4===e.readyState?e:void 0},e.open(r,o,a,u,c),"POST"===r&&e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s)for(var f in s)e.setRequestHeader(f,s[f]);if(a)return new n(function(t,n){e.onerror=function(){n(new Error("Network error!"))},e.send(i),e.onload=function(){200===e.status?t(e.response):n(new Error(e.status))}});var l=function(t){var e={then:function(n){return 200===t.status&&n(t.responseText),e},"catch":function(n){return 200!==t.status&&n({status:t.status,statusText:t.statusText}),e}};return e};return e.send(i),e.onloadend=function(){return e.onreadystatechange(),l(e)},e.onloadend()},e.http.get=function(t){return this({url:t,method:"GET"})},e.http.post=function(t,e){return this({url:t,data:e,method:"POST"})}}},{promise:4}],14:[function(t,e,n){e.exports=function(t){"use strict";t.insertStyle=function(e,n,r){var o=e.replace(/ /g,"-"),i=r?o+r.replace(/[\s:\/\[\]\(\)]+/g,"-"):o;r=r||"none";var u,c,s=function(){var t=document.createElement("style");return t.className="microbe--inserted--style__"+i,r&&"none"!==r&&t.setAttribute("media",r),document.head.appendChild(t),t},a=t.__customCSSRules[o];if(a&&a[r]){u=a[r].el;var f=a[r].obj;for(c in n)f[c]=n[c];n=f}else u=s();var l=e+"{";for(c in n)l+=c+" : "+n[c]+";";return l+="}",u.innerHTML=l,t.__customCSSRules[o]=t.__customCSSRules[o]||{},t.__customCSSRules[o][r]={el:u,obj:n},u},t.__customCSSRules={},t.removeStyle=function(e,n,r){r||"string"!=typeof n||"all"===n||(r=n,n=null),r=r||"none";var o=function(n,r){n.parentNode.removeChild(n),delete t.__customCSSRules[e][r]},i=t.__customCSSRules[e];if(!i)return!1;if("all"===n)for(var u in i)o(i[u].el,u);else{if(i=i[r],!i)return!1;if(t.isArray(n)&&!t.isEmpty(n)){for(var c=0,s=n.length;s>c;c++)i.obj[n[c]]&&delete i.obj[n[c]];t.isEmpty(i.obj)?o(i.el,r):t.insertStyle(e,i.obj,r)}else o(i.el,r)}return!0},t.removeStyles=function(e){return t.removeStyle(e,"all")}}},{}],15:[function(t,e,n){e.exports=function(e){"use strict";window.Promise=window.Promise||t("promise");var n=t("./types");e.capitalize=function(t){var n=e.isArray(t);t=n?t:[t];for(var r,o=[],i=0,u=t.length;u>i;i++){r=t[i].split(" ");for(var c=0,s=r.length;s>c;c++)r[c]=r[c][0].toUpperCase()+r[c].slice(1);o.push(r.join(" "))}return n?o:o[0]},e.capitalise=e.capitalize,e.debounce=function(t,e,n){var r;return function(){var o=this,i=arguments,u=function(){r=null,n||t.apply(o,i)},c=n&&!r;clearTimeout(r),r=setTimeout(u,e),c&&t.apply(o,i)}},e.extend=function(){var t=e.isObject,n=e.isArray,r=arguments[0]||{},o=1,i=arguments.length,u=!1;"boolean"==typeof r&&(u=r,r=arguments[o]||{},o++),"object"==typeof r||e.isFunction(r)||(r={}),o===i&&(r=this,o--);for(var c,s,a,f,l,d;i>o;o++)if(c=arguments[o],null!==c&&void 0!==c)for(s in c)a=r[s],f=c[s],r!==f&&(u&&f&&(t(f)||(l=n(f)))?(l?(l=!1,d=a&&n(a)?a:[]):d=a&&t(a)?a:{},r[s]=e.extend(u,d,f)):void 0!==f&&(r[s]=f));return r},e.core.extend=e.extend,e.identity=function(t){return t},e.isArray=Array.isArray,e.isEmpty=function(t){var e;for(e in t)return!1;return!0},e.isFunction=function(t){return"function"===e.type(t)},e.isObject=function(t){return"object"===e.type(t)&&!t.nodeType&&!e.isWindow(t)},e.isUndefined=function(t,e){return e&&"object"!=typeof e?!0:e?!(t in e):void 0===t},e.isWindow=function(t){return null!==t&&t===t.window},e.merge=function(t,e,n){"boolean"==typeof e&&(n=e,e=null),e||(e=t,t=this);var r=t.length;if("number"==typeof r){for(var o=0,i=e.length;i>o;o++)n&&-1!==t.indexOf(e[o])||(t[r++]=e[o]);t.length=r}return t},e.core.merge=e.merge,e.noop=function(){},e.once=function(t,e){var n;return function(){return t&&(n=t.apply(e||this,arguments),t=null),n}},e.poll=function(t,e,n,r,o){var i=Number(new Date)+(r||2e3);o=o||100,function u(){if(t())try{e()}catch(r){throw"No argument given for success function"}else if(Number(new Date)<i)setTimeout(u,o);else try{n(new Error("timed out for "+t+": "+arguments))}catch(r){throw"No argument given for error function."}}()},e.toArray=function(t){return Array.prototype.slice.call(t||this)},e.core.toArray=e.toArray,e.type=function(t){if(null===t)return t+"";var e=n[Object.prototype.toString.call(t)];return e=e?e:n[t.toString()],e=e||typeof t,"object"===e&&t instanceof Promise&&(e="promise"),e},e.xyzzy=e.noop}},{"./types":16,promise:4}],16:[function(t,e,n){"use strict";e.exports={"[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Error]":"error","[object Promise]":"promise","[object Microbe]":"microbe"}},{}],17:[function(t,e,n){"use strict";var r=function(){var t=arguments[0],e=arguments[1]>>0,n=Object(this),r=this.length>>0;if(0===r)return!1;for(e=e>=0?e:e+r,e=0>e?0:e;r>e;){if(t===n[e]||n[e]!==n[e]&&t!==t)return!0;e++}return!1};e.exports=function(t){t.core.every=Array.prototype.every,t.core.findIndex=Array.prototype.findIndex,t.core.each=Array.prototype.forEach,t.core.forEach=Array.prototype.forEach,t.core.includes=Array.prototype.includes?Array.prototype.includes:r,t.core.indexOf=Array.prototype.indexOf,t.core.lastIndexOf=Array.prototype.lastIndexOf,t.core.map=Array.prototype.map,t.core.pop=Array.prototype.pop,t.core.push=Array.prototype.push,t.core.reverse=Array.prototype.reverse,t.core.shift=Array.prototype.shift,t.core.slice=Array.prototype.slice,t.core.some=Array.prototype.some,t.core.sort=Array.prototype.sort,t.core.unshift=Array.prototype.unshift,t.core.splice=function(t,e){return this.constructor(Array.prototype.splice.call(this,t,e))}}},{}],18:[function(t,e,n){var r=function(t){return!!t};e.exports=function(t){"use strict";t.core.children=function(t){var e=this.constructor,n=function(n){return n=e(n.children),"string"==typeof t?n.filter(t):n};return this.map(n)},t.core.childrenFlat=function(t){var e=0,n=[],r=function(t){for(var r=t.children,o=r.length,i=0;o>i;i++)n[e]=r[i],e++};this.each(r);var o=this.constructor(n);return"string"==typeof t?o.filter(t):o},t.core.filter=function(e){var n,o,i,u=this;if(0===this.length)return this;if("function"==typeof e){for(var c=[],s=0,a=this.length;a>s;s++)c[s]=e.call(this[s],s)?this[s]:null;return c=c.filter(r),this.constructor(c)}var f=function(e,n,o){if(t.pseudo[e[0]])return t.pseudo[e[0]](n,e[1]);var u,c=[];if(u=0===o?e[0]:":"+e[0],""!==u){""!==e[1]&&(u+="("+e[1]+")");for(var s=0,a=n.length;a>s;s++)i=n[s],c[s]=t.matches(i,u)===!0?i:null;c=c.filter(r)}return new t(c)};if(e&&-1!==e.indexOf(":")){n=e.split(":"),o=[[n.splice(0,1).toString(),""]];for(var l,d=0,p=n.length;p>d;d++)l=n[d],-1!==l.indexOf("(")?(l=l.split("("),l[1]=l[1].replace(")","")):l=[l,""],o.push(l)}else{if(!e)return this;o=[[e,""]]}for(var h=0,v=o.length;v>h;h++){if(0===u.length)return u;""!==o[h][0]&&(u=f(o[h],u,h))}return u},t.core.find=function(e){var n=e[0];if(" "===n&&(e=e.trim(),n=e[0]),">"===n)return e=e.slice(1).trim(),this.childrenFlat().filter(e);if("~"===n)return e=e.slice(1).trim(),this.siblingsFlat().filter(e);if("!"===n)return this.parent();if("+"===n){e=e.slice(1).trim();for(var o,i=[],u=this.children(),c=0,s=u.length;s>c;c++)o=u[c][0],i[c]=o?o:null;return i.filter(r),new t(i).filter(e)}if(-1!==e.indexOf(":"))return this.constructor(e,this);for(var a=new t(e),f=[],l=0,d=0,p=this.length;p>d;d++)for(var h=0,v=a.length;v>h;h++)t.contains(a[h],this[d])&&(f[l]=a[h],l++);return this.constructor(f)},t.core.first=function(){return 0!==this.length?this.constructor(this[0]):this.constructor([])},t.core.last=function(){var t=this.length;return 1===t?this:0!==t?this.constructor(this[t-1]):this.constructor([])},t.core.parent=function(){var t,e,n=function(t){return t.parentNode},r=new Array(this.length);for(t=0,e=this.length;e>t;t++)r[t]=n(this[t]);return this.constructor(r)},t.core.siblings=function(t){var e=this.constructor,n=function(n){for(var r=[],o=0,i=n.parentNode.firstElementChild;i;)if(i!==n&&(r[o]=i,o++),i=i.nextElementSibling,!i)return r=e(r),"string"==typeof t?r.filter(t):r};return this.map(n)},t.core.siblingsFlat=function(t){var e=0,n=[],r="+"===t||"~"===t,o=function(o){var i=o;for(i=r?o.nextElementSibling:o.parentNode.firstElementChild;i&&(i!==o&&-1===n.indexOf(i)&&(n[e]=i,e++),i=i.nextElementSibling,i&&"+"!==t););};this.each(o);var i=this.constructor(n);return"string"!=typeof t||r?i:i.filter(t)},t.core.toString=function(){return this.type}}},{}],19:[function(t,e,n){var r=Array.prototype.slice;e.exports=function(e,n,o){"use strict";function i(t,e){for(var n=0,r=t.length;r>n;n++)e[n]=t[n];return e.length=n,e}function u(t,e){for(var n=t.match(d),r="",o="",u="",c=0,s=n.length;s>c;c++){var a=n[c][0];switch(a){case"#":r+=n[c];break;case".":u+=n[c];break;default:o+=n[c]}}if("string"==typeof o&&(t=document.createElement(o),r&&(t.id=r.slice(1)),u))for(u=u.split("."),c=1,s=u.length;s>c;c++)t.classList.add(u[c]);return i([t],e)}function c(t,e){var n=document.createElement("div");n.innerHTML=t,t=r.call(n.children);for(var o=0,u=t.length;u>o;o++)n.removeChild(t[o]);return i(t,e)}function s(t){return-1!==t.indexOf(">>")&&(t=t.replace(/>>/g," ")),-1!==t.indexOf("!")&&(t=t.replace(/!/g,":parent")),t}function a(t,n){if("string"==typeof t&&-1===t.indexOf(":")&&-1===t.indexOf("!")&&-1===t.indexOf(" "))switch(t[0]){case"#":if(-1===t.indexOf(".")){var o=document.getElementById(t.slice(1));return null===o?i([],n):i([o],n)}break;case".":if(-1===t.indexOf("#")){var u=t.slice(1);if(-1===u.indexOf("."))return i(document.getElementsByClassName(u),n);u=u.split(".");for(var c,s,a=document.getElementsByClassName(u[0]),f=1,l=u.length;l>f;f++){c=r.call(document.getElementsByClassName(u[f]));for(var d=0,p=a.length;p>d;d++)s=a[d],-1===c.indexOf(s)&&(a[d]=null)}return i(a,n).filter(function(t){return null!==t})}break;default:if(t&&-1===t.indexOf("[")&&-1===t.indexOf("<")&&-1===t.indexOf("#")&&-1===t.indexOf("."))return i(document.getElementsByTagName(t),n)}else"function"==typeof t&&e&&"function"==typeof e.ready&&e.ready(t);return!1}e.core={get type(){return n},get isMicrobe(){return!0},get version(){return o}},Object.defineProperty(e,"version",{get:function(){return o}});var f,l,d=e.prototype.__selectorRegex=/(?:[\s]*\.([\w-_\.]+)|#([\w-_]+)|([^#\.:<][\w-_]*)|(<[\w-_#\.]+>)|:([^#\.<][\w-()_]*))/g,p=e.core.__init__=function(t,e,r){var o;if(!e&&(o=a(t,this)))return o;if("string"==typeof t&&(t=s(t)),"string"==typeof e&&(e=s(e)),t=t||"",e&&e.type===n){o=i([],this);for(var v,y=0,m=e.length;m>y;y++){v=new p(t,e[y]);for(var g=0,w=v.length;w>g;g++)-1===Array.prototype.indexOf.call(o,v[g])&&(o[o.length]=v[g],o.length++)}return o}var b,x;if(1===t.nodeType||(b=Array.isArray(t)||t.jquery)||t===window||t===document||(x="[object HTMLCollection]"===t.toString()))return b||x||(t=[t]),i(t,this);if(e=void 0===e?document:e,e!==document&&"string"==typeof e&&"string"==typeof t)return this.constructor(e).find(t);var E=e.nodeType;if(!t||"string"!=typeof t||1!==E&&9!==E)return i([],this);var A=t.match(d);if(A&&1===A.length&&":"!==A[0][0])switch(f=A[0][0],l=t.slice(1),f){case".":var _=(t||"").slice(1).split(".").length;if(1===_)return i(e.getElementsByClassName(l),this);break;case"#":var j=document.getElementById(l);return e.ownerDocument&&this.contains(j,e)?i([j],this):i([],this);case"<":return u(t.substring(1,t.length-1),this);default:return i(e.getElementsByTagName(t),this)}return this instanceof p?-1!==t.indexOf(":")&&h?h(this,t,e,i):-1!==t.indexOf("/")?c(t,this):i(e.querySelectorAll(t),this):new p(t,e,r)};e.core.__init__.prototype=e.core,t("./core")(e),t("./root")(e),t("./pseudo")(e),t("./array")(e);var h=e.pseudo}},{"./array":17,"./core":18,"./pseudo":20,"./root":21}],20:[function(t,e,n){e.exports=function(t){"use strict";function e(t,e,n){for(var r,o=[],i=0,u=0,c=t.length;c>u;u++)r=e(t[u],o,u),r&&(o[i]=r,i++);return n?o:t.constructor(o)}var n=function(e,n,r){if("odd"===n?n="2n":"even"===n&&(n="2n1"),-1===n.indexOf("n")){switch(r){case!0:case"last":return new t(e[e.length-parseInt(n)])}return new t(e[parseInt(n)-1])}n=n.split("n");var o,i=parseInt(n[0])||1,u=parseInt(n[1]);r!==!0&&"last"!==r||(o=e.length-parseInt(n[1]),u=o%i);for(var c,s=[],a=u||0,f=o||e.length;f>a;)c=e[a],c&&s.push(c),a+=i;return new t(s)},r=function(e,n,o,i){function u(t){for(var n,u=[],c=0,s=t.length;s>c;c++)if(0===c)u=r(e,t[c],o,i);else{n=r(e,t[c],o,i);for(var a=0,f=n.length;f>a;a++)-1===Array.prototype.indexOf.call(u,n[a])&&(u[u.length]=n[a],u.length++)}return u}function c(){var r=a(f),u=i(o.querySelectorAll(r[0]),e);r=r[1];for(var c,s,l=0,d=r.length;d>l;l++)c=r[l].split("("),s=c[1],s&&(s=s.slice(0,s.length-1)),c=c[0],t.pseudo[c]&&(u=t.pseudo[c](u,s,n));return u}function s(n){for(var r,u=t.pseudo(e,n[0],o,i),c=!1,s=1,a=n.length;a>s;s++)if(r=n[s].trim(),"~"===r[0]?(u=u.siblingsFlat("~"),c=!0):"+"===r[0]?(u=u.siblingsFlat("+"),c=!0):c?(u=u.filter(r),c=!1):(u=u.find(r),c=!1),0===u.length)return u;return u}function a(e){var n,r=e.split(":");e=r[0],r.splice(0,1);for(var o=0,i=r.length;i>o;o++)n=r[o].split("("),t.pseudo[n[0]]||(e+=":"+r[o],r.splice(o,1));return[e,r]}if(-1!==n.indexOf(",")){if(n=n.split(/,(?![a-zA-Z0-9-#.,\s]+\))/g),n.length>1)return u(n);n=n[0]}var f=n;if(":"===f[0]&&(f="*"+f),-1!==f.trim().indexOf(" ")){var l=function(t){return" "===t?!1:t},d=f.split(/((?:[A-Za-z0-9.#*\-_]+)?(?:\:[A-Za-z\-]+(?:\([\s\S]+\))?)?)?( )?/);if(d=d.filter(l),d.length>1)return s(d);f=d[0]}return c()};r["any-link"]=function(t){return t.filter("a")},r.blank=function(t){var n=function(t,e){var n=t.textContent;return-1===e.indexOf(t)&&/^\s*$/.test(n||t.value)?t:void 0};return e(t,n)},r.column=function(t,e){return t.filter("col").filter(e)},r.contains=function(t,n){n=n.toLowerCase();var r=function(t){var e=function(t){return document.all?t.innerText:t.textContent},r=e(t);return-1!==r.toLowerCase().indexOf(n)?t:void 0};return e(t,r)},r["default"]=function(t){t=t.filter("input, option");var n=function(t){return t.defaultChecked===!0?t:void 0};return e(t,n)},r.dir=function(t,n){var r=function(t){return getComputedStyle(t).direction===n?t:void 0};return e(t,r)},r.drop=function(t,e){if(t=t.filter("[dropzone]"),!e)return t;switch(e){case"active":return t.filter(":active");case"invalid":return t.filter();case"valid":return t.filter()}},r.even=function(t){var n=function(t,e,n){return(n+1)%2===0?t:void 0};return e(t,n)},r.first=function(t){return t.first()},r.gt=function(t,e){return t.splice(e,t.length)},r.has=function(t,n){var r=function(t){return t.querySelector(n)?t:void 0};return e(t,r)},r["in-range"]=function(t){t=t.filter("[max],[min]");var n=function(t){var e=t.getAttribute("min"),n=t.getAttribute("max"),r=parseInt(t.value);if(r)if(e&&n){if(r>e&&n>r)return t}else if(e&&r>e||n&&n>r)return t};return e(t,n)},r.lang=function(t,n){if(n){t=t.filter("[lang]"),n=n.replace("*","");var r=function(t){return-1!==t.getAttribute("lang").indexOf(n)?t:void 0};return e(t,r)}return t.constructor([])},r.last=function(t){return t.last()},r["local-link"]=function(t,n){t=t.filter("a");var r=document.location,o=function(t){var e=t.href,o=e.replace(r.protocol+"//","").replace(r.host,"");o="/"===o[0]?o.slice(1):o;var i=o.split("/").length-1;return/^https?:\/\//.test(o)||n&&parseInt(n)!==i?void 0:t};return e(t,o)},r.lt=function(t,e){return t.splice(0,e)},r.matches=function(t,e,n){var r=t.constructor,o=":matches("+e+")";e=e.split(","),n=n.replace(o,""),n="*"===n?"":n;for(var i=r(n+e[0].trim()),u=1,c=e.length;c>u;u++)i.merge(r(n+e[u].trim()),!0);return i},r.not=function(n,r,o,i){if(-1!==r.indexOf(",")){var u=n.constructor;r=r.split(",");for(var c=0,s=r.length;s>c;c++)n=this.not(n,r[c].trim(),o,!0);return u(n)}var a=function(e){return t.matches(e,r)?void 0:e};return e(n,a,i)},r["nth-column"]=function(t,e){return t=t.filter("col"),n(t,e)},r["nth-last-column"]=function(t,e){return t=t.filter("col"),n(t,e,!0)},r["nth-last-match"]=function(t,e){return n(t,e,!0)},r["nth-match"]=function(t,e){return n(t,e)},r.odd=function(t){var n=function(t,e,n){return(n+1)%2!==0?t:void 0};return e(t,n)},r.optional=function(t){return t.filter("input:not([required=required]), textfield:not([required=required]), [required=optional], [optional]")},r["out-of-range"]=function(t){t=t.filter("[max],[min]");var n=function(t){var e=t.getAttribute("min"),n=t.getAttribute("max"),r=parseInt(t.value);if(r)if(e&&n){if(e>r||r>n)return t}else if(e&&e>r||n&&r>n)return t};return e(t,n)},r.parent=function(t){t=t.parent();var n=function(t,e,n){return-1===e.indexOf(t)?t:void 0};return e(t,n)},r["read-only"]=function(t){return t.filter(":not(input,textfield,[contenteditable=false])")},r["read-write"]=function(t){return t.filter("input,textfield,[contenteditable=true]")},r.required=function(t){return t.filter("[required=required]")},r.root=function(t){return t.constructor(document.body.parentNode)},t.pseudo=r}},{}],21:[function(t,e,n){e.exports=function(t){"use strict";t.contains=function(t,e){for(var n=t.parentNode;n!==document&&n!==e;)n=n.parentNode||e.parentNode;return n!==document},t.matches=function(t,e){var n=this.matches.__matchesMethod,r="string"!=typeof t&&!!t.length&&"[object HTMLFormElement]"!==t.toString(),o=!(!Array.isArray(t)&&!r);o||r||(t=[t]),!n&&t[0]&&(t[0].matches?n=this.matches.__matchesMethod="matches":t[0].msMatchesSelector?n=this.matches.__matchesMethod="msMatchesSelector":t[0].mozMatchesSelector?n=this.matches.__matchesMethod="mozMatchesSelector":t[0].webkitMatchesSelector&&(n=this.matches.__matchesMethod="webkitMatchesSelector"));for(var i=[],u=0,c=t.length;c>u;u++)i.push(t[u][n](e));return o?i:i[0]}}},{}],22:[function(t,e,n){e.exports="0.5.2"},{}]},{},[1])(1)});