sodajs
Version:
Light weight but powerful template engine for JavaScript.
1 lines • 62.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.soda=t():e.soda=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=17)}([function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(6),u=function(e){function t(){r(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.ELEMENT_NODE=1,e.ATTRIBUTE_NODE=2,e.TEXT_NODE=3,e.CDATA_SECTION_NODE=4,e.ENTITY_REFERENCE_NODE=5,e.ENTITY_NODE=6,e.PROCESSING_INSTRUCTION_NODE=7,e.COMMENT_NODE=8,e.DOCUMENT_NODE=9,e.DOCUMENT_TYPE_NODE=10,e.DOCUMENT_FRAGMENT_NODE=11,e.NOTATION_NODE=12,e.childNodes=[],e.nodeValue="",e.ownerDocument=null,e.parentNode=null,e.textContent="",e}return i(t,e),s(t,[{key:"appendChild",value:function(e){return this.insertBefore(e)}},{key:"cloneNode",value:function(e){if(this.nodeType===this.TEXT_NODE){var t=this.ownerDocument.createTextNode(this.nodeValue);return t}if(this.nodeType===this.COMMENT_NODE){var t=this.ownerDocument.createComment(this.nodeValue);return t}var t=this.ownerDocument.createDocumentFragment(),n=this.tagName&&this.tagName.toLowerCase();return t.innerHTML=e?"<"+n+" "+this._getAttributeString()+">"+this.innerHTML+"</"+n+">":"<"+n+" "+this._getAttributeString()+"></"+n+">",t.childNodes[0]}},{key:"getRootNode",value:function(){return function e(t){return t.parentNode?e(t.parentNode):t}(this)}},{key:"contains",value:function(e){if(e===this)return!0;for(var t=!1,n=0;n<this.childNodes.length;n++){if(this.childNodes[n].contains(e)){t=!0;break}}return t}},{key:"compareDocumentPosition",value:function(e){}},{key:"hasChildNodes",value:function(){return this.childNodes.length}},{key:"removeChild",value:function(e){for(var t=0;t<this.childNodes.length;t++)if(this.childNodes[t]===e){this.childNodes.splice(t,1),e.parentNode=null;break}}},{key:"insertBefore",value:function(e,t){for(var n=0;n<this.childNodes.length&&this.childNodes[n]!==t;n++);if("fragment"===(e.tagName||"").toLowerCase()){Array.prototype.splice.apply(this.childNodes,[n,0].concat(e.childNodes));for(var n=0;n<e.childNodes.length;n++)e.childNodes[n].parentNode=this;e.childNodes=[]}else e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes.splice(n,0,e);return e}},{key:"parentNodeElement",get:function(){return this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null}},{key:"previousSibling",get:function(){}},{key:"firstChild",get:function(){return this.childNodes[0]}},{key:"lastChild",get:function(){return this.childNodes[this.childNodes.length-1]}},{key:"nextSibling",get:function(){}},{key:"nodeName",get:function(){return this.tagName}}]),t}(a);e.exports=u},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),u=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.nodeType=n.TEXT_NODE,n.nodeValue=e||"",n}return i(t,e),s(t,[{key:"_getEnscapeValue",value:function(e){return e.replace(/</g,"<").replace(/>/g,">")}}]),t}(a);e.exports=u},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(3),s=function(){function e(t){r(this,e),this.document=new i(this),this.setGlobalVars()}return o(e,[{key:"setGlobalVars",value:function(){this.setTimeout=setTimeout,this.clearTimeout=clearTimeout,this.setInterval=setInterval,this.clearInterval=clearInterval,this.parseInt=parseInt,this.parseFloat=parseFloat,this.console={log:function(e){console.log(e)},info:function(){},debug:function(){},dir:function(){}}}}]),e}();e.exports=s},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(4),u=n(0),c=n(1),l=n(10),f={canvas:"HTMLCanvasElement"},h=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.__defaultView=e,n}return i(t,e),s(t,[{key:"createElement",value:function(e){var t;if(e=(e||"").toUpperCase(),f[e]){t=new(n(34)("./"+f[e].toLowerCase()))(e)}else t=new a(e);return t.ownerDocument=this,t}},{key:"createDocumentFragment",value:function(){return this.createElement("fragment")}},{key:"createTextNode",value:function(e){return new c(e)}},{key:"createComment",value:function(e){return new l(e)}},{key:"getElementById",value:function(e){var t;return function n(r){if(!t)for(var o=0;o<r.childNodes.length;o++){var i=r.childNodes[o],s=i.id;if(s==e){t=r.childNodes[o];break}i.childNodes&&i.childNodes.length&&n(i)}}(this),t}},{key:"getElementsByClassName",value:function(e){return this.documentElement.getElementsByClassName(e)}},{key:"getElementsByTagName",value:function(e){return this.documentElement.getElementsByTagName(e)}},{key:"defaultView",get:function(){return this.__defaultView}}]),t}(u);e.exports=h},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(5),u=n(9),c=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.style=new u,n}return i(t,e),s(t,[{key:"blur",value:function(){console.warn("blur is not realised")}},{key:"unblur",value:function(){}},{key:"click",value:function(){}},{key:"focus",value:function(){}},{key:"forceSpellCheck",value:function(){}}]),t}(a);e.exports=c},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),u=n(7),c=n(8),l=function(e){return null!==e&&void 0!==e&&""!==e&&void 0!==e},f=function(e,t){t&&(t=t.split(";"),t.map(function(t,n){if(t){var r=t.split(":"),o=r[0],i=r[1]||"";e[o]=i}}))},h=function(e){return e.replace(/</g,"<").replace(/>/g,">")},p=/script|pre|code/,d=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.tagName=e,n.nodeType=n.ELEMENT_NODE,n.attributes=new u(n),n.classList=new c(n),n}return i(t,e),s(t,[{key:"_getAttributeString",value:function(){for(var e=[],t=0;t<this.attributes.length;t++)if(this.attributes[t].nodeType&&this.attributes[t].nodeType===this.ATTRIBUTE_NODE){var n=this.attributes[t].name;if("className"===n&&(n="class"),"style"===n)continue;e.push(n+'="'+(l(this.attributes[t].value)?this.attributes[t].value:"")+'"')}var r=[];for(var t in this.style)this.style[t]&&r.push(t+":"+this.style[t]);r.length&&e.push('style="'+r.join(";")+'"');var o=e.join(" ");return o&&(o=" "+o),o}},{key:"getAttribute",value:function(e){var t=this.attributes.getNamedItem(e);return t?t.value:null}},{key:"setAttribute",value:function(e,t){"style"===e&&f(this.style,t),this.attributes.setNamedItem(e,t)}},{key:"removeAttribute",value:function(e){this.attributes.removeNamedItem(e)}},{key:"getElementsByClassName",value:function(e){var t=[];if(this.childNodes.length)for(var n=0;n<this.childNodes.length;n++){var r=this.childNodes[n];r.nodeType===r.ELEMENT_NODE&&(r.classList&&r.classList.contains(e)&&t.push(r),t=t.concat(r.getElementsByClassName(e)))}return t}},{key:"getElementsByTagName",value:function(e){if("string"!=typeof e)throw new Error("getElementsByTagName first argument to be string!");var t=[];if(e=e.toLowerCase(),this.childNodes.length)for(var n=0;n<this.childNodes.length;n++){var r=this.childNodes[n];if(r.nodeType===r.ELEMENT_NODE){var o=(r.tagName||"").toLowerCase();o!==e&&"*"!==e||t.push(r),t=t.concat(r.getElementsByTagName(e))}}return t}},{key:"className",get:function(){return this.getAttribute("className")},set:function(e){this.setAttribute("className",e)}},{key:"clientWidth",get:function(){}},{key:"clientHeight",get:function(){}},{key:"clientLeft",get:function(){}},{key:"clientTop",get:function(){}},{key:"computedName",get:function(){}},{key:"computedRole",get:function(){}},{key:"id",get:function(){return this.getAttribute("id")},set:function(e){this.setAttribute(id)}},{key:"innerHTML",get:function(){var e=(this.tagName||"").toLowerCase(),t="";if(this.childNodes&&this.childNodes.length)for(var n=0;n<this.childNodes.length;n++){var r=this.childNodes[n];r.nodeType===this.TEXT_NODE?p.test(e)?t+=r.nodeValue:t+=h(r.nodeValue):t+=r.outerHTML}return t},set:function(e){var t=n(12),r=this.ownerDocument,o=r.defaultView||{},i=(new t).parseHTMLFragment(e,o),s=i.docTree;this.childNodes=s._tree.childNodes;for(var a=0;a<this.childNodes.length;a++)this.childNodes[a].parentNode=this}},{key:"localName",get:function(){return this.tagName||""}},{key:"outerHTML",set:function(e){var t=this.ownerDocument,n=t.createElement("div");if(n.innerHTML=e,this.parentNode){for(;n.childNodes[0];)this.parentNode.insertBefore(n.childNodes[0],this);this.parentNode.removeChild(this)}},get:function(){var e=(this.tagName||"").toLowerCase(),t=/br|hr|img|link|meta/,n=t.test(e);if(this.nodeType===this.TEXT_NODE||!e)return this.nodeValue||"";var r,o=this._getAttributeString();if(n)r="<"+e+o+" />";else{if(r="<"+e+o+">",this.childNodes)for(var i=0;i<this.childNodes.length;i++){var s=this.childNodes[i];s.nodeType===this.TEXT_NODE?p.test(e)?r+=s.nodeValue:r+=h(s.nodeValue):r+=s.outerHTML}r+="</"+e+">"}return r}},{key:"scrollTop",get:function(){return this.__scrollTop||0},set:function(e){this.__scrollTop=e}}]),t}(a);e.exports=d},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(20),s=function(){function e(){r(this,e),this.listeners={},this._emitter=new i}return o(e,[{key:"addEventListener",value:function(e,t,n){this._emitter.addListener(e,t.handleEvent||t,n)}},{key:"removeEventListener",value:function(e,t){}},{key:"dispatchEvent",value:function(e){var t={preventDefault:function(){},stopPropagation:function(){},target:this,srcElement:this};this._emitter&&this._emitter.emit(e.type,t)}}]),e}();e.exports=s},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=(n(1),function(){function e(t){r(this,e),this.length=0,this.ownerElment=t}return o(e,[{key:"removeNamedItem",value:function(e){var t=-1;for(var n in this)if(this.hasOwnProperty(n)){var r=this[n];if(r.name==e){t=Number(n);break}}if(!isNaN(t)&&t>-1){delete this[t],this.length--;for(var n=t;n<this.length;n++)this[n]=this[n+1];delete this[e]}}},{key:"setNamedItem",value:function(e,t){var n=this.getNamedItem(e),r=this;n?(n.name=e,n.nodeValue=t,n.value=t,n.firstChild.value=t,n.firstChild.nodeValue=t):(this[this.length++]={name:e,value:t,ownerElment:this.ownerElment,nodeType:this.ownerElment.ATTRIBUTE_NODE,nodeValue:t,childNodes:function(){return[r.ownerElment.ownerDocument.createTextNode()]}(),get lastChild(){return this.childNodes[this.childNodes.length-1]},get firstChild(){return this.childNodes[0]}},this[e]=this[this.length-1])}},{key:"getNamedItem",value:function(e){for(var t in this)if(this.hasOwnProperty(t)){var n=this[t];if(n.name==e)return n}}}]),e}());e.exports=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){r(this,e),this.ownElement=t}return o(e,[{key:"item",value:function(e){return this.__class[e]}},{key:"contains",value:function(e){return this.__class.indexOf(e)>-1}},{key:"add",value:function(e){if(this.contains(e));else{var t=this.__class;t.push(e),this.ownElement.className=t.join(" ")}}},{key:"remove",value:function(e){var t=this.__class,n=t.indexOf(e);n>-1&&(t.splice(n,1),this.ownElement.className=t.join(" "))}},{key:"toggle",value:function(e){this.contains(e)?this.remove(e):this.add(e)}},{key:"keys",value:function(){return this.__class.keys()}},{key:"values",value:function(){return this.__class[Symbol.iterator]()}},{key:"toString",value:function(){return this.value}},{key:"__class",get:function(){if((this.ownElement.className||"").trim())return(this.ownElement.className||"").trim().split(/ +/);return[]}},{key:"length",get:function(){return this.__class.length}},{key:"value",get:function(){return this.__class.join(" ")}}]),e}();e.exports=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(e,t){t&&(t=t.split(";"),t.map(function(t,n){if(t){var r=t.split(":"),o=r[0],i=r[1]||"";e[o]=i}}))},s=function(){function e(){r(this,e)}return o(e,[{key:"cssText",set:function(e){i(this,e)}}]),e}();e.exports=s},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),u=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.nodeType=n.COMMENT_NODE,n.nodeValue=e||"",n.tagName="#comment",n}return i(t,e),s(t,[{key:"outerHTML",get:function(){return"\x3c!--"+(this.nodeValue||"")+"--\x3e"}},{key:"innerHTML",get:function(){return this.nodeValue||""}}]),t}(a);e.exports=u},function(e,t,n){"use strict";e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(21),s=n(22),a={},u=function(){function e(){r(this,e)}return o(e,[{key:"parse",value:function(e,t){return this.parseHTML(e,t)}},{key:"parseHTMLFragment",value:function(e,t){var n,r,o=t.document,u=new i;a[e]||(a[e]=this.preParse(e)),r=a[e];for(var c,l,f,h=0;h<r.length;h++){var p=r[h],d=p.tagType,v=p.tagName;if("startTag"===d){var y=o.createElement(v);"head"===v&&(c=y),"body"===v&&(l=y),"html"===v&&(f=y),n=y,u.push(y)}else if("attrs"===d){var m=p.match;if(">"===m)n.getAttribute("type")&&"text/javascript"!==(n.getAttribute("type")+"").toLowerCase()||n.getAttribute("src")&&n.tagName,p.goNext&&u.goNext();else if("/>"===m);else{var b=p.attrName,g=p.attrValue;n.setAttribute(b,g)}}else if("textTag"===d){var _=p.nodeValue,y=o.createTextNode(_);if(u.push(y),n=y,p.checkParentScript&&"script"===y.parentNode.tagName)if(y.parentNode.getAttribute("type")&&"text/javascript"!==(y.parentNode.getAttribute("type")+"").toLowerCase());else try{s.runCode(_,t)}catch(e){}p.backUp&&u.backUp()}else if("commentTag"===d){var _=p.nodeValue,y=o.createComment(_);u.push(y),n=y,p.backUp&&u.backUp()}else if("endTag"===d){var y=o.createElement();u.push(y),n=y,p.backUp&&u.backUp()}}return{headNode:c,bodyNode:l,htmlNode:f,docTree:u}}},{key:"parseHTMLDocument",value:function(e,t){var n,r,o=t.document,s=this.parseHTMLFragment(e,t),a=s.docTree,u=s.headNode||o.createElement("head");if(s.bodyNode)n=s.bodyNode;else{var n=o.createElement("body");n.childNodes=a._tree.childNodes,n.childNodes.map(function(e){e.parentNode=n})}s.htmlNode?r=s.htmlNode:(r=o.createElement("html"),r.childNodes.push(u),r.childNodes.push(n));var c=new i;return c.push(o),c.goNext(),c.push(r),o.documentElement=r,o.head=u,o.body=n,o}},{key:"preParse",value:function(e){var t,n,r,o=[],i=/<\!\-\-|<([^\s\/>]+)|<(\/)([^\s>]+)>|([^<]+)/g,s=/>|\/>|([^\s=]+)=(?:"([^"]*)"|'([^']*)'|([^\s"']+))/g,a=/br|hr|img|link|meta/,u=/script|code|pre/,c=0,l=i;l.lastIndex=0;for(var f,h=function(e){c=l.lastIndex,l=e,l.lastIndex=c};n=l.exec(e);){var p,d=n[1]||n[3];if(l===i?p="\x3c!--"===n[0]?"commentTag":n[1]?"startTag":"/"===n[2]?"endTag":"textTag":l===s?p="attrs":"mixableTagCloseReg"===l.type?p="mixableTagCloseReg":"commentEndTag"===l.type&&(p="commentEndTag"),"startTag"===p)t={tagType:"startTag",tagName:d},f=t,{},o.push(t),h(s);else if("attrs"===p)if(">"===n[0])t={tagType:"attrs",match:">"},h(i),a.test(f.tagName)||(t.goNext=1),u.test(f.tagName)&&h(function(e){var t=new RegExp("</("+e+")>","g");return t.type="mixableTagCloseReg",t}(f.tagName)),o.push(t);else if("/>"===n[0])h(i),o.push({tagType:"attrs",match:"/>"});else{var v=(n[1]+"").trim(),y=n[2]||n[3]||n[4];"class"===v&&(v="className"),o.push({tagType:"attrs",attrName:v,attrValue:y})}else if("textTag"===p){var r=n[4];o.push({tagType:"textTag",nodeValue:r||""}),f=void 0}else if("endTag"===p)t={tagType:"endTag"},a.test(d)||(t.backUp=1),o.push(t);else if("commentTag"===p){var m=/\-\->/g;m.type="commentEndTag",h(m)}else if("commentEndTag"===p){var b=c,g=l.lastIndex-n[0].length-b,r=e.substr(b,g);t={tagType:"commentTag",checkParentScript:!1,nodeValue:r,backUp:0},f=t,h(i),o.push(t)}else if("mixableTagCloseReg"===p){var b=c,g=l.lastIndex-n[0].length-b,r=e.substr(b,g);t={tagType:"textTag",checkParentScript:1,nodeValue:r,backUp:1},f=t,h(i),o.push(t)}}return o}}]),e}();e.exports=u},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,n){"use strict"},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){r(this,e),this._eventType=t,this._type=null,this._bubbles=null,this._cancelable=null,this._target=null,this._currentTarget=null,this._eventPhase=0,this._timeStamp=null,this._preventDefault=!1,this._stopPropagation=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3}return o(e,[{key:"initEvent",value:function(e,t,n){this._type=e,this._bubbles=t,this._cancelable=n}},{key:"preventDefault",value:function(){this._cancelable&&(this._preventDefault=!0)}},{key:"stopPropagation",value:function(){this._stopPropagation=!0}},{key:"eventType",get:function(){return this._eventType}},{key:"type",get:function(){return this._type}},{key:"bubbles",get:function(){return this._bubbles}},{key:"cancelable",get:function(){return this._cancelable}},{key:"target",get:function(){return this._target}},{key:"currentTarget",get:function(){return this._currentTarget}},{key:"eventPhase",get:function(){return this._eventPhase}},{key:"timeStamp",get:function(){return this._timeStamp}}]),e}();e.exports=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){r(this,e)}return o(e,[{key:"clear",value:function(){}},{key:"setItem",value:function(){}},{key:"getItem",value:function(){}},{key:"removeItem",value:function(){}}]),e}();e.exports=i},function(e,t,n){"use strict";var r=n(18);if(void 0===a){var o=n(19),i=new o,s=i.runHTML("",{},{}),a=s.document;r.setDocument(a)}e.exports=r},function(e,t,n){"use strict";(function(e){var n,r,o,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(s,a){"object"===i(t)&&"object"===i(e)?e.exports=a():(r=[],n=a,void 0!==(o="function"==typeof n?n.apply(t,r):n)&&(e.exports=o))}(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"===i(Symbol.iterator)?function(e){return void 0===e?"undefined":i(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":i(e)},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(1),u=n(2),c="undefined"!=typeof document?document:{},l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"soda-";r(this,e),this._prefix=t}return s(e,[{key:"setDocument",value:function(e){c=e}},{key:"run",value:function(e,t){var n=this,r=c.createElement("div");c.documentMode<9&&(r.style.display="none",c.body.appendChild(r)),r.innerHTML=e,(0,u.nodes2Arr)(r.childNodes).map(function(e){n.compileNode(e,t)});var o=r.innerHTML;return c.documentMode<9&&c.body.removeChild(r),o}},{key:"prefix",value:function(e){this._prefix=e}},{key:"_getPrefixReg",value:function(){return new RegExp("^"+this._prefix)}},{key:"_getPrefixedDirectiveMap",value:function(){var t=this,n={};return e.sodaDirectives.map(function(e){var r=t._prefix+e.name;n[r]=e}),n}},{key:"_removeSodaMark",value:function(e,t){e.removeAttribute(t)}},{key:"compileNode",value:function(t,n){var r=this,i=this._getPrefixReg(),s=e.sodaDirectives,l=this._getPrefixedDirectiveMap();!function e(t,n){t.nodeType===(t.TEXT_NODE||3)&&(t.nodeValue=t.nodeValue.replace(a.VALUE_OUT_REG,function(e,t){var i=r.parseSodaExpression(t,n);return"object"===(void 0===i?"undefined":o(i))&&(i=JSON.stringify(i,null,2)),i})),t.attributes&&t.attributes.length&&(s.map(function(e){var o=e.name,i=e.opt,s=r._prefix+o;if((0,u.exist)(t.getAttribute(s))){var a=t.getAttribute(s);i.link.bind(r)({expression:a,scope:n,el:t,parseSodaExpression:r.parseSodaExpression.bind(r),getValue:r.getValue.bind(r),compileNode:r.compileNode.bind(r),document:c}),r._removeSodaMark(t,s)}}),(0,u.nodes2Arr)(t.attributes).filter(function(e){return!l[e.name]}).map(function(e){if(i.test(e.name)){var o=e.name.replace(i,"");if(o&&(0,u.exist)(e.value)){var s=r.parseComplexExpression(e.value,n);!1!==s&&(0,u.exist)(s)&&t.setAttribute(o,s),r._removeSodaMark(t,e.name)}}else(0,u.exist)(e.value)&&(e.value=r.parseComplexExpression(e.value,n))})),(0,u.nodes2Arr)(t.childNodes).map(function(t){e(t,n)})}(t,n)}},{key:"getEvalFunc",value:function(t){return new Function("getValue","sodaFilterMap","return function sodaExp(scope){ return "+t+"}")(this.getValue,e.sodaFilterMap)}},{key:"getValue",value:function(e,t){a.CONST_REGG.lastIndex=0;t.replace(a.CONST_REGG,function(t){return void 0===e[t]?t:e[t]});if("true"===t)return!0;if("false"===t)return!1;return function t(n,r){var o=r.indexOf(".");if(o>-1){var i=r.substr(0,o);if(r=r.substr(o+1),void 0!==e[i]&&a.CONST_REG.test(i)&&(i=e[i]),void 0!==n[i]&&null!==n[i])return t(n[i],r);return""}r=r.trim(),void 0!==e[r]&&a.CONST_REG.test(r)&&(r=e[r]);var s;if(void 0!==n[r])s=n[r];else{s=""}return s}(e,t)}},{key:"parseComplexExpression",value:function(e,t){var n=this,r=a.ONLY_VALUE_OUT_REG.exec(e);if(r){var o=r[1];return this.parseSodaExpression(o,t)}return e.replace(a.VALUE_OUT_REG,function(e,r){return n.parseSodaExpression(r,t)})}},{key:"parseSodaExpression",value:function(e,t){var n=this;e=e.replace(a.STRING_REG,function(e,n,r){var o=(0,u.getRandom)();return t[o]=n||r,o}),e=e.replace(a.OR_REG,a.OR_REPLACE).split("|");for(var r=0;r<e.length;r++)e[r]=(e[r].replace(new RegExp(a.OR_REPLACE,"g"),"||")||"").trim();for(var o=e[0]||"",i=e.slice(1);a.ATTR_REG_NG.test(o);)a.ATTR_REG.lastIndex=0,o=o.replace(a.ATTR_REG,function(e,r){var o=(0,u.getAttrVarKey)(),i=n.parseSodaExpression(r,t);return t[o]=i,"."+o});return o=o.replace(a.OBJECT_REG,function(e){return"getValue(scope,'"+e.trim()+"')"}),o=this.parseFilter(i,o),this.getEvalFunc(o)(t)}},{key:"parseFilter",value:function(t,n){var r=e.sodaFilterMap;return function e(){var o=t.shift();if(o){for(var o=o.split(":"),i=o.slice(1)||[],s=(o[0]||"").trim(),u=0;u<i.length;u++)a.OBJECT_REG_NG.test(i[u])&&(i[u]="getValue(scope,'"+i[u]+"')");r[s]&&(i.unshift(n),i=i.join(","),n="sodaFilterMap['"+s+"']("+i+")"),e()}}(),n}}],[{key:"filter",value:function(e,t){this.sodaFilterMap[e]=t}},{key:"getFilter",value:function(e){return this.sodaFilterMap[e]}},{key:"directive",value:function(e,t){var n=t.priority,r=void 0===n?0:n,o=void 0;for(o=0;o<this.sodaDirectives.length;o++){var i=this.sodaDirectives[o],s=i.opt.priority,a=void 0===s?0:s;if(r<a);else if(r>=a)break}this.sodaDirectives.splice(o,0,{name:e,opt:t})}},{key:"discribe",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{compile:!0};this.template[e]={funcOrStr:t,option:n}}},{key:"getTmpl",value:function(e,t){var n=this.template[e],r=n.funcOrStr,o=n.option,i=void 0===o?{}:o,s=void 0;return s="function"==typeof r?r.apply(null,t):r,{template:s,option:i}}}]),e}();l.sodaDirectives=[],l.sodaFilterMap={},l.template={},t.default=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});t.IDENTOR_REG=/[a-zA-Z_\$]+[\w\$]*/g,t.STRING_REG=/"([^"]*)"|'([^']*)'/g,t.NUMBER_REG=/\d+|\d*\.\d+/g,t.OBJECT_REG=/[a-zA-Z_\$]+[\w\$]*(?:\s*\.\s*(?:[a-zA-Z_\$]+[\w\$]*|\d+))*/g,t.OBJECT_REG_NG=/[a-zA-Z_\$]+[\w\$]*(?:\s*\.\s*(?:[a-zA-Z_\$]+[\w\$]*|\d+))*/,t.ATTR_REG=/\[([^\[\]]*)\]/g,t.ATTR_REG_NG=/\[([^\[\]]*)\]/,t.ATTR_REG_DOT=/\.([a-zA-Z_\$]+[\w\$]*)/g,t.NOT_ATTR_REG=/[^\.|]([a-zA-Z_\$]+[\w\$]*)/g,t.OR_REG=/\|\|/g,t.OR_REPLACE="OR_OPERATOR",t.CONST_PRIFIX="_$C$_",t.CONST_REG=/^_\$C\$_/,t.CONST_REGG=/_\$C\$_[^\.]+/g,t.VALUE_OUT_REG=/\{\{([^\}]*)\}\}/g,t.ONLY_VALUE_OUT_REG=/^\{\{([^\}]*)\}\}$/},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.assign=t.nodes2Arr=t.exist=t.getRandom=t.getAttrVarKey=void 0;var r=n(1),o=(t.getAttrVarKey=function(){return r.CONST_PRIFIX+~~(1e6*Math.random())},t.getRandom=function(){return"$$"+~~(1e6*Math.random())},t.exist=function(e){return null!==e&&void 0!==e&&""!==e&&void 0!==e},t.nodes2Arr=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t},Object.getOwnPropertySymbols),i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,a=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)};t.assign=Object.assign||function(e,t){for(var n,r,u=a(e),c=1;c<arguments.length;c++){n=Object(arguments[c]);for(var l in n)i.call(n,l)&&(u[l]=n[l]);if(o){r=o(n);for(var f=0;f<r.length;f++)s.call(n,r[f])&&(u[r[f]]=n[r[f]])}}return u}},function(e,t,n){var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(r),i=n(2);n(4),n(5),n(6),n(7),n(8),n(9),n(10);var s=new o.default,a=function(e,t){return s.run(e,t)},u={prefix:function(e){s.prefix(e)},filter:function(e,t){o.default.filter(e,t)},directive:function(e,t){o.default.directive(e,t)},setDocument:function(e){s.setDocument(e)},discribe:function(e,t,n){o.default.discribe(e,t,n)},Soda:o.default},c=(0,i.assign)(a,u);e.exports=c},function(e,t,n){var r=n(0);(function(e){return e&&e.__esModule?e:{default:e}})(r).default.directive("repeat",{priority:10,link:function(e){var t,n,r,o=this,i=e.scope,s=e.el,a=e.expression,u=e.getValue,c=(e.parseSodaExpression,e.compileNode),l=/\s+by\s+([^\s]+)$/,f=a.replace(l,function(e,t){return t&&(r=(t||"").trim()),""}),h=/([^\s]+)\s+in\s+([^\s]+)|\(([^,]+)\s*,\s*([^)]+)\)\s+in\s+([^\s]+)/,p=h.exec(f);if(p){if(p[1]&&p[2]){if(t=(p[1]||"").trim(),n=(p[2]||"").trim(),!t||!n)return}else p[3]&&p[4]&&p[5]&&(r=(p[3]||"").trim(),t=(p[4]||"").trim(),n=(p[5]||"").trim());r=r||"$index";var d=u(i,n)||[],v=function(e){var n=s.cloneNode(!0),a=Object.create(i);a[r]=e,a[t]=d[e],n.removeAttribute(o._prefix+"repeat"),s.parentNode.insertBefore(n,s),c(n,a)};if("length"in d)for(var y=0;y<d.length;y++)v(y);else for(var y in d)d.hasOwnProperty(y)&&v(y);s.parentNode.removeChild(s),s.childNodes&&s.childNodes.length&&(s.innerHTML="")}}})},function(e,t,n){var r=n(0);(function(e){return e&&e.__esModule?e:{default:e}})(r).default.directive("if",{priority:9,link:function(e){var t=e.expression,n=e.parseSodaExpression,r=e.scope,o=e.el;n(t,r)||(o.parentNode&&o.parentNode.removeChild(o),o.innerHTML="")}})},function(e,t,n){var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(r),i=function(e){return new RegExp("(^|\\s+)"+e+"(\\s+|$)","g")},s=function(e,t){if(!e.className)return void(e.className=t);e.className.match(i(t))||(e.className+=" "+t)};o.default.directive("class",{link:function(e){var t=e.scope,n=e.el,r=e.expression,o=e.parseSodaExpression,i=o(r,t);i&&s(n,i)}})},function(e,t,n){var r=n(0);(function(e){return e&&e.__esModule?e:{default:e}})(r).default.directive("html",{link:function(e){var t=e.expression,n=e.scope,r=e.el,o=e.parseSodaExpression,i=o(t,n);i&&(r.innerHTML=i)}})},function(e,t,n){var r=n(0);(function(e){return e&&e.__esModule?e:{default:e}})(r).default.directive("replace",{link:function(e){var t=e.scope,n=e.el,r=e.expression,o=e.parseSodaExpression,i=e.document,s=o(r,t);if(s){var a=i.createElement("div");if(a.innerHTML=s,n.parentNode)for(;a.childNodes[0];)n.parentNode.insertBefore(a.childNodes[0],n)}n.parentNode&&n.parentNode.removeChild(n)}})},function(e,t,n){var r=n(0);(function(e){return e&&e.__esModule?e:{default:e}})(r).default.directive("style",{link:function(e){var t=e.scope,n=e.el,r=e.expression,o=e.parseSodaExpression,i=o(r,t);if(i){var s=[];for(var a in i)if(i.hasOwnProperty(a)){var u=function(e,t){return/opacity|z-index/.test(e)?parseFloat(t):isNaN(t)?t:t+"px"}(a,i[a]);s.push([a,u].join(":"))}for(var c=n.style,a=0;a<c.length;a++){var l=c[a];i[l]||s.push([l,c[l]].join(":"))}var f=s.join(";");n.setAttribute("style",f)}}})},function(e,t,n){var r=n(0),o=function(e){return e&&e.__esModule?e:{default:e}}(r);o.default.directive("include",{priority:8,link:function(e){var t=e.scope,n=e.el,r=e.parseSodaExpression,i=e.expression,s=/\{\{([^\}]*)\}\}/g,a=i.replace(s,function(e,n){return r(n,t)});a=a.split(":");var u=a[0],c=a.slice(1),l=o.default.getTmpl(u,c),f=l.template,h=l.option,p=void 0===h?{}:h;f&&(p.compile?n.outerHTML=this.run(f,t):n.outerHTML=f)}})}])})}).call(t,n(11)(e))},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(2),s=n(12),a={},u=function(){function e(){r(this,e)}return o(e,[{key:"run",value:function(e,t,r){if(a[e]);else{var o=n(35).readFileSync(e,{encoding:"utf-8"});a[e]=o}var u=new i(t);return new s(u).parse(void 0),u}},{key:"runHTML",value:function(e,t,n){var r=new i(t);return new s(r).parseHTMLDocument(e,r),r}}]),e}();e.exports=u},function(e,t,n){"use strict";function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function o(e){return"function"==typeof e}function i(e){return"number"==typeof e}function s(e){return"object"===(void 0===e?"undefined":u(e))&&null!==e}function a(e){return void 0===e}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,i,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(n=this._events[e],a(n))return!1;if(o(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),n.apply(this,i)}else if(s(n))for(i=Array.prototype.slice.call(arguments,1),c=n.slice(),r=c.length,u=0;u<r;u++)c[u].apply(this,i);return!0},r.prototype.addListener=function(e,t){var n;if(!o(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,o(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(n=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,i,a;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,r=-1,n===t||o(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(a=i;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){r=a;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],o(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(o(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){r(this,e),this._tree={name:"ROOT",childNodes:[]},this._idMap={},this._allNode=[],this._currParentNode=this._tree}return o(e,[{key:"goNext",value:function(){var e=this._currParentNode,t=e.childNodes[e.childNodes.length-1];if(!t)throw new Error("tree goNext has no child");this._currParentNode=t}},{key:"push",value:function(e){e.parentNode=this._currParentNode,this._currParentNode.childNodes.push(e)}},{key:"backUp",value:function(){this._currParentNode=this._currParentNode.parentNode}},{key:"getNodeById",value:function(e){return this._idMap[e]||null}},{key:"getAllNodes",value:function(){return this._allNode||[]}}]),e}();e.exports=i},function(e,t,n){"use strict";var r=n(23);n(25),n(32);e.exports={runCode:function(e,t){return r.runInNewContext(e,t)}}},function(module,exports,__webpack_require__){"use strict";function Context(){}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},indexOf=__webpack_require__(24),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var n in e)t.push(n);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n,e)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(e,t,n){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:n})}}catch(e){return function(e,t,n){e[t]=n}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];Context.prototype={};var Script=exports.Script=function(e){if(!(this instanceof Script))return new Script(e);this.code=e};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var n=t.contentWindow,r=n.eval,o=n.execScript;!r&&o&&(o.call(n,"null"),r=n.eval),forEach(Object_keys(e),function(t){n[t]=e[t]}),forEach(globals,function(t){e[t]&&(n[t]=e[t])});var i=Object_keys(n),s=r.call(n,this.code);return forEach(Object_keys(n),function(t){(t in e||-1===indexOf(i,t))&&(e[t]=n[t])}),forEach(globals,function(t){t in e||defineProp(e,t,n[t])}),document.body.removeChild(t),s},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),n=this.runInContext(t);return forEach(Object_keys(t),function(n){e[n]=t[n]}),n},forEach(Object_keys(Script.prototype),function(e){exports[e]=Script[e]=function(t){var n=Script(t);return n[e].apply(n,[].slice.call(arguments,1))}}),exports.createScript=function(e){return exports.Script(e)},exports.createContext=Script.createContext=function(e){var t=new Context;return"object"===(void 0===e?"undefined":_typeof(e))&&forEach(Object_keys(e),function(n){t[n]=e[n]}),t}},function(e,t,n){"use strict";var r=[].indexOf;e.exports=function(e,t){if(r)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}},function(e,t,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(e,t,n){if(e&&l.isObject(e)&&e instanceof r)return e;var o=new r;return o.parse(e,t,n),o}function i(e){return l.isString(e)&&(e=o(e)),e instanceof r?e.format():r.prototype.format.call(e)}function s(e,t){return o(e,!1,!0).resolve(t)}function a(e,t){return e?o(e,!1,!0).resolveObject(t):t}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=n(26),l=n(28);t.parse=o,t.resolve=s,t.resolveObject=a,t.format=i,t.Url=r;var f=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],v=["{","}","|","\\","^","`"].concat(d),y=["'"].concat(v),m=["%","/","?",";","#"].concat(y),b=["/","?","#"],g=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,N={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},T={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},w=n(29);r.prototype.parse=function(e,t,n){if(!l.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+(void 0===e?"undefined":u(e)));var r=e.indexOf("?"),o=-1!==r&&r<e.indexOf("#")?"?":"#",i=e.split(o),s=/\\/g;i[0]=i[0].replace(s,"/"),e=i.join(o);var a=e;if(a=a.trim(),!n&&1===e.split("#").length){var h=p.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],this.query=t?w.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var d=f.exec(a);if(d){d=d[0];var v=d.toLowerCase();this.protocol=v,a=a.substr(d.length)}if(n||d||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var x="//"===a.substr(0,2);!x||d&&E[d]||(a=a.substr(2),this.slashes=!0)}if(!E[d]&&(x||d&&!T[d])){for(var O=-1,k=0;k<b.length;k++){var j=a.indexOf(b[k]);-1!==j&&(-1===O||j<O)&&(O=j)}var C,S;S=-1===O?a.lastIndexOf("@"):a.lastIndexOf("@",O),-1!==S&&(C=a.slice(0,S),a=a.slice(S+1),this.auth=decodeURIComponent(C)),O=-1;for(var k=0;k<m.length;k++){var j=a.indexOf(m[k]);-1!==j&&(-1===O||j<O)&&(O=j)}-1===O&&(O=a.length),this.host=a.slice(0,O),a=a.slice(O),this.parseHost(),this.hostname=this.hostname||"";var A="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!A)for(var R=this.hostname.split(/\./),k=0,P=R.length;k<P;k++){var L=R[k];if(L&&!L.match(g)){for(var M="",I=0,D=L.length;I<D;I++)L.charCodeAt(I)>127?M+="x":M+=L[I];if(!M.match(g)){var U=R.slice(0,k),V=R.slice(k+1),G=L.match(_);G&&(U.push(G[1]),V.unshift(G[2])),V.length&&(a="/"+V.join(".")+a),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=c.toASCII(this.hostname));var F=this.port?":"+this.port:"",H=this.hostname||"";this.host=H+F,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!N[v])for(var k=0,P=y.length;k<P;k++){var $=y[k];if(-1!==a.indexOf($)){var B=encodeURIComponent($);B===$&&(B=escape($)),a=a.split($).join(B)}}var q=a.indexOf("#");-1!==q&&(this.hash=a.substr(q),a=a.slice(0,q));var z=a.indexOf("?");if(-1!==z?(this.search=a.substr(z),this.query=a.substr(z+1),t&&(this.query=w.parse(this.query)),a=a.slice(0,z)):t&&(this.search="",this.query={}),a&&(this.pathname=a),T[v]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var F=this.pathname||"",X=this.search||"";this.path=F+X}return this.href=this.format(),this},r.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,i="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&l.isObject(this.query)&&Object.keys(this.query).length&&(i=w.stringify(this.query));var s=this.search||i&&"?"+i||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||T[t])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),s&&"?"!==s.charAt(0)&&(s="?"+s),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),s=s.replace("#","%23"),t+o+n+s+r},r.prototype.resolve=function(e){return this.resolveObject(o(e,!1,!0)).format()},r.prototype.resolveObject=function(e){if(l.isString(e)){var t=new r;t.parse(e,!1,!0),e=t}for(var n=new r,o=Object.keys(this),i=0;i<o.length;i++){var s=o[i];n[s]=this[s]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var a=Object.keys(e),u=0;u<a.length;u++){var c=a[u];"protocol"!==c&&(n[c]=e[c])}return T[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!T[e.protocol]){for(var f=Object.keys(e),h=0;h<f.length;h++){var p=f[h];n[p]=e[p]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||E[e.protocol])n.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<