!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("v",[],t):"object"==typeof exports?exports.v=t():e.v=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(3)},function(e,t,n){(function(e,o){function r(e,t){this._id=e,this._clearFn=t}var i=n(2).nextTick,s=Function.prototype.apply,u=Array.prototype.slice,l={},a=0;t.setTimeout=function(){return new r(s.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new r(s.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},t.setImmediate="function"==typeof e?e:function(e){var n=a++,o=!(arguments.length<2)&&u.call(arguments,1);return l[n]=!0,i(function(){l[n]&&(o?e.apply(null,o):e.call(null),t.clearImmediate(n))}),n},t.clearImmediate="function"==typeof o?o:function(e){delete l[e]}}).call(t,n(1).setImmediate,n(1).clearImmediate)},function(e,t){function n(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}function r(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(h===clearTimeout)return clearTimeout(e);if((h===o||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}function s(){p&&d&&(p=!1,d.length?m=d.concat(m):v=-1,m.length&&u())}function u(){if(!p){var e=r(s);p=!0;for(var t=m.length;t;){for(d=m,m=[];++v1)for(var n=1;n1&&void 0!==arguments[1]?arguments[1]:{methodHistory:[],selectorHistory:[]};if(o(this,e),!(this instanceof e))return new e(t);if(t instanceof e)return t;t&&t.nodeName&&(t=[t],this.selector||(this.selector=t)),this.version="5.0.1",this.methodHistory=r.methodHistory,0===r.selectorHistory.length?(this.selectorHistory=[],this.selectorHistory.push(t)):this.selectorHistory=r.selectorHistory,this.error=function(e,t,n,o){var r=function(e){console.error("vQuery: "+e+"\nAcceptable parameters: v("+t+")."+n+"("+o+")")};r("undefinedNode"===e?"Selector is not a valid node.":"notType"===e?"Parameter passed to the "+n+" method is not of the type '"+o+"'.":e)},this.isElement=function(e){return e instanceof Element||e[0]instanceof Element},this.queryElement=function(e){return n.isElement(e)?e:n.query(document,e)[0]},this.queryParameter=function(e,t){return t&&n.nodes?n.nodes:n.nonElement?n.nonElement:e},this.assignNodes=function(e){n.nodes=n.slice(e),n.node=n.nodes.length>0?n.nodes[0]:null},this.handler=function(o,r){var i=o?o:n.selector?n.selector:t;return n.selectorHistory.push(i),n.methodHistory.push(r.method),new e(i,{selectorHistory:n.selectorHistory,methodHistory:n.methodHistory})},this.slice=function(e){return Array.prototype.slice.call(e)};var i=null;if(t){if("string"===this.typeOf(t)){try{i=t.match(/<(.|\n)*?>/g)[0]}catch(e){}if(i)this.nonElement=t,this.assignNodes(this.parseHTML(t));else try{this.assignNodes(this.query(document,t))}catch(e){this.nonElement=t}this.node||(this.nonElement=t)}else i?(this.nonElement=t,this.assignNodes(this.parseHTML(t))):this.isElement(t)?this.assignNodes(t):(this.nodes=t,this.node=this.nodes[0]);this.length=this.nodes?this.nodes.length:this.nonElement?this.nonElement.length:0}}return s(e,[{key:"for",value:function(e,t){if(void 0!==e)for(var n=0,o=e.length;n-1}},{key:"typeOf",value:function(e){return Object.prototype.toString.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase()}},{key:"move",value:function(e,t){try{return this.nodes=this.nodes.splice(t,0,this.nodes.splice(e,1)[0]),this.handler(null,{method:"move"})}catch(e){this.error("notType","","move","array")}}},{key:"uniq",value:function e(t){var n=t?t:this.nonElement?this.nonElement:this.nodes?this.nodes:null,e=Array.from(new Set(n));return t?e:(this.selector=e,this.handler(null,{method:"uniq"}))}},{key:"query",value:function(e,t){return e.querySelectorAll(t)}},{key:"parseHTML",value:function(e){var t=document.implementation.createHTMLDocument();return t.body.innerHTML=this.nonElement?this.nonElement:e,t.body.children}},{key:"mixin",value:function(t){for(var n in t)return t.hasOwnProperty(n)&&(e.prototype[n]=t[n]),e.prototype[n].apply(this,[this.nodes,arguments])}},{key:"ajax",value:function(e,t,o){var r=this,i=n(4),s=n(5);return i._setImmediateFn(s),new i(function(n,i){var s=function(e){var t=o&&o.chain?r.handler(e,{method:"ajax"}):e;void 0!==t&&t&&n(t)},u=new XMLHttpRequest;u.open(e,t,!0);var l=void 0;if("post"===e.toLowerCase()){try{o.data=JSON.stringify(o.data),u.setRequestHeader("Content-Type","application/json; charset=UTF-8")}catch(e){u.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8")}u.send(o.data)}u.onload=function(){if(u.status>=200&&u.status<400){try{l=JSON.parse(u.responseText)}catch(e){l=u.responseText}s(l)}else i()},"get"===e.toLowerCase()&&u.send(),u.onerror=function(e){i(e)}})}},{key:"get",value:function(e){return this.selector=this.nodes[e],this.handler(null,{method:"get"})}},{key:"ready",value:function(e){e&&void 0!==e&&"function"==typeof e?document.addEventListener("DOMContentLoaded",e):this.error("notType","","ready","function")}},{key:"load",value:function(e){e&&void 0!==e&&"function"==typeof e?document.addEventListener("load",e):this.error("notType","","load","function")}},{key:"on",value:function(e,t){return this.for(this.nodes,function(n){n.addEventListener(e,t)}),this.handler(null,{method:"on"})}},{key:"off",value:function(e,t){return this.for(this.nodes,function(n){n.removeEventListener(e,t)}),this.handler(null,{method:"off"})}},{key:"trigger",value:function(e){if(this.node.fireEvent)this.node.fireEvent("on"+e);else{var t=document.createEvent("Events");t.initEvent(e,!0,!1),this.node.dispatchEvent(t)}return this.handler(null,{method:"trigger"})}},{key:"click",value:function(e){var t=this;return this.for(this.nodes,function(n){e?t.on("click",e):t.trigger("click")}),this.handler(null,{method:"click"})}},{key:"filter",value:function(e){return Array.prototype.filter.call(this.nodes,e),this.handler(null,{method:"filter"})}},{key:"each",value:function(e){return Array.prototype.forEach.call(this.nodes,e),this.handler(null,{method:"each"})}},{key:"map",value:function(e){return Array.prototype.map.call(this.nodes,e),this.handler(null,{method:"map"})}},{key:"find",value:function(e){var t=this;return this.isElement(e)?this.selector=e:this.includes(e,",")?!function(){var n=e.split(","),o=[],r=[];t.for(n,function(e){r=t.query(t.node,e),t.for(r,function(e){o.push(e)})}),t.selector=o}():this.selector=this.query(this.node,e),this.handler(null,{method:"find"})}},{key:"end",value:function(){return this.selector=this.selectorHistory[0],this.handler(null,{method:"end"})}},{key:"hide",value:function(){return this.for(this.nodes,function(e){e.style.display="none"}),this.handler(null,{method:"hide"})}},{key:"show",value:function(){return this.for(this.nodes,function(e){e.style.display="block"}),this.handler(null,{method:"show"})}},{key:"remove",value:function(){return this.for(this.nodes,function(e){e.parentNode.removeChild(e)}),this.handler(null,{method:"remove"})}},{key:"empty",value:function(){return this.for(this.nodes,function(e){e.innerHTML=""}),this.handler(null,{method:"empty"})}},{key:"clone",value:function e(){var e=this.node.cloneNode(!0);return this.selector=e,this.handler(null,{method:"clone"})}},{key:"wrap",value:function(e){return this.for(this.nodes,function(t){t.outerHTML=""+e.match(/<(.|\n)*?>/g)[0]+t.outerHTML}),this.handler(null,{method:"wrap"})}},{key:"parent",value:function(){return this.selector=this.node.parentNode,this.handler(null,{method:"parent"})}},{key:"parents",value:function(e){for(var t=this,n=this.node.parentNode,o=[];n;)o.unshift(n),n=n.parentNode;return e?!function(){var n=[],r=[];t.for(o,function(o){n=t.slice(t.query(o,e)),t.for(n,function(e){r.push(e)})}),t.selector=t.uniq(r)}():this.selector=o,this.handler(null,{method:"parents"})}},{key:"children",value:function e(t){var n=this,e=this.slice(this.nodes[0].children);return t?!function(){var o=[],r=[];n.for(e,function(e){o=n.slice(n.query(e,t)),n.for(o,function(e){r.push(o[e])})}),n.selector=r}():this.selector=e,this.handler(null,{method:"children"})}},{key:"allChildren",value:function(e){var t=this,n=e?this.slice(this.query(this.node,e))[0]:this.node,o=[],r=function e(n){o.push(n),n.childNodes.length>0&&t.forIn(n.childNodes,function(t){1==n.childNodes[t].nodeType&&e(n.childNodes[t])})};return r(n),this.selector=o,this.handler(null,{method:"allChildren"})}},{key:"isEmpty",value:function(){return!this.node.hasChildNodes()}},{key:"siblings",value:function(){var e=this;return this.nodes=this.node.parentNode.children,this.filter(function(t){return t!==e.node})}},{key:"next",value:function(){return this.selector=this.node.nextElementSibling,this.handler(null,{method:"next"})}},{key:"prev",value:function(){return this.selector=this.node.previousElementSibling,this.handler(null,{method:"prev"})}},{key:"addClass",value:function(e){var t=this,n=e.split(" ");return this.for(this.nodes,function(e){t.for(n,function(t){e.classList.add(t)})}),this.handler(null,{method:"addClass"})}},{key:"removeClass",value:function(e){var t=this,n=e.split(" ");return this.for(this.nodes,function(e){t.for(n,function(t){e.classList.remove(t)})}),this.handler(null,{method:"removeClass"})}},{key:"toggleClass",value:function(e){var t=this,n=e.split(" ");return this.for(this.nodes,function(e){t.for(n,function(t){e.classList.toggle(t)})}),this.handler(null,{method:"toggleClass"})}},{key:"hasClass",value:function(e){var t=this.node.classList.contains(e);return t}},{key:"removeAttr",value:function(e){return this.for(this.nodes,function(t){t.removeAttribute(e)}),this.handler(null,{method:"removeAttr"})}},{key:"attr",value:function(e,t){var n=this,o=null;return this.for(this.nodes,function(r){if(e)t&&"string"===n.typeOf(t)?(r.setAttribute(n.decamelize(e),t),o=n.handler(null,{method:"attr"})):n.forIn(e,function(t){"string"===n.typeOf(e)?o=r.attributes[e].value:(r.setAttribute(n.decamelize(t),e[t]),o=n.handler(null,{method:"attr"}))});else{var i={},s=null,u=null;n.for(r.attributes,function(e){s=n.camelize(e.name),u=e.value,i[s]=u}),o=i}}),o}},{key:"css",value:function(e){var t=this;return e?(this.for(this.nodes,function(n){t.forIn(e,function(t){n.style[t]=e[t]})}),this.handler(null,{method:"css"})):this.isElement(this.node)?getComputedStyle(this.node):{}}},{key:"val",value:function(e){return e?(this.for(this.nodes,function(t){t.value=e}),this.handler(null,{method:"val"})):this.node.value}},{key:"rect",value:function(){return this.node.getBoundingClientRect()}},{key:"offset",value:function e(){var t=this.rect(),e={top:t.top+document.body.scrollTop,left:t.left+document.body.scrollLeft};return e}},{key:"offsetParent",value:function(){return this.node.offsetParent||this.node}},{key:"height",value:function e(t){var e=this.node.offsetHeight;if(t){var n=this.css();e+=parseInt(n.marginTop)+parseInt(n.marginBottom)}return e}},{key:"width",value:function e(t){var e=this.node.offsetWidth;if(t){var n=this.css();e+=parseInt(n.marginTop)+parseInt(n.marginBottom)}return e}},{key:"position",value:function(e){return void 0!==this.node?{left:this.node.offsetLeft,top:this.node.offsetTop}:void this.error("undefinedNode","node","position","withMargin")}},{key:"html",value:function(e){var t=[];return this.for(this.nodes,function(n){e?n.innerHTML=e:t.push(n.outerHTML)}),e?this.handler(null,{method:"html"}):t}},{key:"json",value:function(e){var t=this.nodes?this.nodes:this.nonElement?this.nonElement:e;try{return JSON.stringify(t)}catch(e){this.error(e,"","json","serializable input")}}},{key:"parseJSON",value:function(e){e=this.nonElement?this.nonElement:e;try{var t=JSON.parse(e);return t}catch(e){this.error(e,"","parseJSON","valid JSON")}}},{key:"type",value:function(e){return e=this.queryParameter(e,!0),this.nodes&&this.isElement(this.nodes)?"node":this.typeOf(e)}},{key:"replaceWith",value:function(e){var t=this;this.for(this.nodes,function(n){return e&&"string"==typeof e?(n.outerHTML=e,t.handler(null,{method:"replaceWith"})):void t.error("notType","","replaceWith","string")})}},{key:"text",value:function(e){var t=[];return this.for(this.nodes,function(n){e?n.textContent=e:t.push(n.textContent)}),e?this.handler(null,{method:"text"}):t}},{key:"insertBefore",value:function(e){var t=this.queryElement(e);return this.for(this.nodes,function(e){t.parentNode.insertBefore(e,t.parentNode.firstChild)}),this.handler(null,{method:"insertBefore"})}},{key:"insertAfter",value:function(e){var t=this.queryElement(e);return this.for(this.nodes,function(e){t.parentNode.insertBefore(e,t.parentNode.nextSibling)}),this.handler(null,{method:"insertAfter"})}},{key:"prepend",value:function(e){var t=this.queryElement(e);return this.for(this.nodes,function(e){e.insertBefore(t,e.firstChild)}),this.handler(null,{method:"prepend"})}},{key:"append",value:function(e){var t=this.queryElement(e);return this.for(this.nodes,function(e){e.appendChild(t)}),this.handler(null,{method:"append"})}},{key:"after",value:function(e){return this.for(this.nodes,function(t){t.insertAdjacentHTML("afterend",e)}),this.handler(null,{method:"after"})}},{key:"before",value:function(e){return this.for(this.nodes,function(t){t.insertAdjacentHTML("beforebegin",e)}),this.handler(null,{method:"before"})}},{key:"contains",value:function(e){var t=null;t=this.nonElement?this.nonElement:this.node.textContent;var n=this.includes(this.node.textContent,e);return n}},{key:"is",value:function(e){var t=this.queryElement(e);return this.node===t}},{key:"inViewport",value:function(){var e=this.rect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}},{key:"inIframe",value:function(){try{return window.self!==window.top}catch(e){return!0}}},{key:"trim",value:function(e){return e=this.queryParameter(e,!0),e.trim()}},{key:"camelize",value:function(e){return e=this.queryParameter(e,!1),e.replace(/(?:^\w|[A-Z]|\b\w)/g,function(e,t){return 0===t?e.toLowerCase():e.toUpperCase()}).replace(/\s+/g,"").replace(/[-_]+/g,"")}},{key:"decamelize",value:function(e){return e=this.queryParameter(e,!1),e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\b([A-Z]+)([A-Z])([a-z])/,"$1-$2$3").replace(/^./,function(e){return e.toLowerCase()})}},{key:"noConflict",value:function(){var e=l;return window.v=window.oldV,e}},{key:"n",get:function(){return this.node}},{key:"ns",get:function(){return this.nodes}},{key:"ne",get:function(){return this.nonElement}}]),e}(),l=function(e){return new u(e)};window.v=l,void 0!==e&&void 0!==e.exports?e.exports=l:(r=[],i=function(){return l}.apply(t,r),!(void 0!==i&&(e.exports=i)))},function(e,t,n){(function(t){!function(n){function o(){}function r(e,t){return function(){e.apply(t,arguments)}}function i(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(e,this)}function s(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):(e._handled=!0,void i._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._state?u:l)(t.promise,e._value);var o;try{o=n(e._value)}catch(e){return void l(t.promise,e)}u(t.promise,o)}))}function u(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof i)return e._state=3,e._value=t,void a(e);if("function"==typeof n)return void h(r(n,t),e)}e._state=1,e._value=t,a(e)}catch(t){l(e,t)}}function l(e,t){e._state=2,e._value=t,a(e)}function a(e){2===e._state&&0===e._deferreds.length&&i._immediateFn(function(){e._handled||i._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t