-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxsdomparser.js
1 lines (1 loc) · 27.8 KB
/
xsdomparser.js
1
!function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return i(n||e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){(function(n){"use strict";var r=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}}();var i=e("./src/dom-parse.js"),o="moderate",a=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}return r(t,[{key:"parseFromString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text/html";return i.parse(e,t,o)}}],[{key:"NodeFilter",get:function(){return e("./src/tree-walker").NodeFilter}},{key:"mode",get:function(){return o},set:function(e){o=e}}]),t}();n.window?n.window.DOMParser?n.window.XSDOMParser=a:(n.window.DOMParser=a,n.window.NodeFilter=a.NodeFilter):t.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./src/dom-parse.js":6,"./src/tree-walker":10}],2:[function(e,t,n){"use strict";var r=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}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=/^([\w\-:]+)\s*?(?:(\*|~|\||\^|\$|)=\s*(?:'|"|)([\w\W]+?)(?:'|"|)(?:\s([iI])|)|)$/;t.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return function e(){i(this,e)}}();return function(t){!function(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)}(n,e);function n(){return i(this,n),function(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}(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return r(n,[{key:"parseAttributeExpression",value:function(e){e=e.replace(/^\s+/,"").replace(/\s+$/,"");var t=o.exec(e),n=t[1],r=t[2],i=t[3],a=t[4];return this.buildMatchToken(n,r,i,a)}},{key:"buildMatchToken",value:function(e,t,n,r){switch(n=function(e){if(void 0!==e)return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}(n),t){case"*":t=new RegExp(""+n,r);break;case"~":t=new RegExp("(?:\\s|^)"+n+"(?:\\s|$)",r);break;case"|":t=new RegExp("^"+n+"(?:\\-|$)",r);break;case"^":t=new RegExp("^"+n,r);break;case"$":t=new RegExp(n+"$",r);break;default:void 0==n&&(n="[\\w\\W]*?"),t=new RegExp("^"+n+"$",r)}return{name:e,value:t}}}]),n}()}},{}],3:[function(e,t,n){"use strict";var r=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}}();var i=e("./cutom-array-shim.js");t.exports=function(e){!function(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)}(t,i);function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=function(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}(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return o.onChange=null,o}return r(t,[{key:"__triggerChange",value:function(){"function"==typeof this.onChange&&this.onChange(this)}},{key:"contains",value:function(e){return-1!==this.indexOf(e)}},{key:"add",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(t){-1==e.indexOf(t)&&e.push(t)}),n.length>0&&this.__triggerChange()}},{key:"remove",value:function(){for(var e=this,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];n.forEach(function(t){-1!==e.indexOf(t)&&e.splice(e.indexOf(t),1)}),n.length>0&&this.__triggerChange()}},{key:"item",value:function(e){return this[e]}},{key:"toggle",value:function(e){(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])&&(this.contains(e)?(this.remove(e),this.__triggerChange()):(this.add(e),this.__triggerChange()))}},{key:"replace",value:function(e,t){-1!==this.indexOf(e)&&(this.splice(this.indexOf(e),1,t),this.__triggerChange())}}]),t}()},{"./cutom-array-shim.js":4}],4:[function(e,t,n){"use strict";function r(){Array.call(this),Array.prototype.slice.call(arguments,0).forEach(function(e){this.push(e)}.bind(this))}r.prototype=Array.prototype,r.prototype.constructor=r,t.exports=r},{}],5:[function(e,t,n){"use strict";var r=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}}();var i=e("./element.js"),o=e("./tree-walker.js").TreeWalker;t.exports=function(e){!function(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)}(t,i);function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(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}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"#document",9));return r.contentType=e,r.doctype=n,delete r.classList,delete r.attributes,r}return r(t,[{key:"appendChild",value:function(e){if(this.childNodes.length>0)throw new Error("Only one child node is allowed on document.");(function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;if(void 0!==a)return a.call(r)})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"appendChild",this).call(this,e)}},{key:"createElement",value:function(e){return new i(e,1)}},{key:"createTextNode",value:function(e){var t=new i("#text",3);return t.textContent=e,t}},{key:"createCDATASection",value:function(e){var t=new i("cdata-section",4);return t.textContent=e,t}},{key:"createComment",value:function(e){var t=new i("#comment",8);return t.textContent=e,t}},{key:"createTreeWalker",value:function(e,t,n){return new o(e,t,n)}},{key:"innerHTML",get:function(){},set:function(e){}},{key:"outerHTML",get:function(){},set:function(e){}},{key:"documentElement",get:function(){return this.children[0]||null}}]),t}()},{"./element.js":7,"./tree-walker.js":10}],6:[function(e,t,n){"use strict";var r=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}}();var i=e("./element.js"),o=e("./document.js"),a=e("./void-elements.js"),s=["script","style"],u=new RegExp("(?:"+["<([\\w\\-:]+)([\\w\\W]*?)(\\/|)>","<[\\s]*?/[\\s]*?([\\w\\-:]+)[\\s]*?>","(^[^<]+)","\x3c!--([\\w\\W]*?)--\x3e","<\\!\\[CDATA\\[([\\w\\W]*?)\\]\\]>"].join("|")+")","i"),c=/(?:([\w\-:]+)=(?:"|')([\w\W]*?)(?:"|')|([\w\-:]+))/g;t.exports=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text/html",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"moderate";for(!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.domString=t,this.contentType=n,this.mode=r,this.document=this.createDocumentNode(),this.tagSequence=[],this.parseIterator=0;this.parseIterator<this.domString.length;)this.parseIteration()}return r(e,[{key:"createDocumentNode",value:function(){var e="";if("text/html"==this.contentType)e="<!DOCTYPE html>",this.domString=this.domString.replace(/<!DOCTYPE[\w\W]*?>/i,function(t){return e=t,""});else{if("text/xml"!=this.contentType)throw new Error("Unsupported content type.");e='<?xml version="1.0"?>',this.domString=this.domString.replace(/<\?xml[\w\W]*?\?>/i,function(t){return e=t,""})}this.domString=this.domString.replace(/^\s+/,"").replace(/\s+$/,"");return new o(this.contentType,e)}},{key:"parseAttrString",value:function(e){for(var t={},n=void 0;n=c.exec(e);){var r=n[1]||n[3],i=n[2];t[r]=i}return t}},{key:"contentTypeCompatible",value:function(e,t){if("text/html"==this.contentType&&void 0!==t)switch(e){case"tagName":return t.toLowerCase();case"attributes":var n={};for(var r in t)n[r.toLowerCase()]=t[r];return n;default:return t}return t}},{key:"parseIteration",value:function(){var e=this.domString.slice(this.parseIterator),t=u.exec(e);if(!t){var n=this.parseIterator-10,r=this.parseIterator+10;throw new Error("Unable to parse dom string near `"+this.domString.slice(n>0?n:0,r<=this.domString.length?r:this.domString.length-1)+"`")}if(0!==t.index){var o=new Error("Cannot parse `"+e.slice(0,t.index).replace(/^\s+/,"").replace(/\s+$/,"")+"`.");switch(this.mode){case"strict":throw o;case"moderate":console.warn(o)}}this.parseIterator+=t.index+t[0].length;var c=this.contentTypeCompatible("tagName",t[1]),l=this.contentTypeCompatible("attributes",this.parseAttrString(t[2])),h=Boolean(t[3]),f=this.contentTypeCompatible("tagName",t[4]),p=t[5],d=t[6],y=t[7],v=this.tagSequence[this.tagSequence.length-1]||this.document;if(p){var _=new i("#text",3);_.textContent=p,v.appendChild(_)}else if(c){var g=new i(c,1,l);if(-1!=s.indexOf(c.toLowerCase())){var w=new RegExp("([\\w\\W]*?)<\\/"+c+">"),b=this.domString.slice(this.parseIterator),m=w.exec(b);m&&(g.textContent=m[1],this.parseIterator+=m.index+m[0].length)}v.appendChild(g),h||-1!=a.indexOf(c.toLowerCase())||-1!=s.indexOf(c.toLowerCase())||this.tagSequence.push(g)}else if(f){var k=this.tagSequence.pop();if("strict"!==this.mode)return;if(!k)throw new Error("`"+f+"` has no open tag definition.");if(f!=k.tagName)throw new Error("`"+k.tagName+"` is not properly closed.")}else if(void 0!==d){var x=new i("#comment",8);x.textContent=d,v.appendChild(x)}else if(void 0!==y){var O=new i("cdata-section",4);O.textContent=y,v.appendChild(O)}}}],[{key:"parse",value:function(e){return new this(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text/html",arguments.length>2&&void 0!==arguments[2]?arguments[2]:"moderate").document}}]),e}()},{"./document.js":5,"./element.js":7,"./void-elements.js":11}],7:[function(e,t,n){"use strict";var r=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}}();var i=e("./class-list.js"),o=e("./query-selectable.js"),a=e("./void-elements.js"),s=function(){return e("./dom-parse")};t.exports=function(t){!function(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)}(n,o);function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n);var o=function(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}(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));return o.nodeType=t||1,o.nodeName=o.tagName=e,o.attributes=r,o.childNodes=[],o.parentNode=null,o.classList=new i,o.__populateClassList(),o.classList.onChange=o.__updateClassAttr.bind(o),o}return r(n,[{key:"__populateClassList",value:function(){var e=this;if(this.classList.splice(0),Boolean(this.attributes.class)){this.attributes.class.split(/\s/).forEach(function(t){e.classList.add(t)})}}},{key:"__updateClassAttr",value:function(e){this.attributes.class=e.join(" ")}},{key:"getAttribute",value:function(e){return this.attributes[e]}},{key:"removeAttribute",value:function(e){delete this.attributes[e],"class"==e&&this.__populateClassList()}},{key:"setAttribute",value:function(e,t){this.attributes[e]=t,"class"==e&&this.__populateClassList()}},{key:"hasAttribute",value:function(e){return e in this.attributes}},{key:"__getTextNodes",value:function(e){var t=this,n=[];return e.childNodes.forEach(function(e){3==e.nodeType?n.push(e):n=n.concat(t.__getTextNodes(e))}),n}},{key:"__searchDom",value:function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=[],o=e.children.length,a=0;a<o;a++){var s=e.children[a];if(t(s)&&(i.push(s),n))break;if(!r&&s.children.length>0&&(i=i.concat(this.__searchDom(s,t,n)),n&&i.length>0))break}return i}},{key:"getElementById",value:function(e){var t=null,n=this.__searchDom(this,function(t){return t.attributes.id==e},!0);return n.length>0&&(t=n[0]),t}},{key:"getElementsByClassName",value:function(e){return this.__searchDom(this,function(t){return t.hasAttribute("class")&&t.classList.contains(e)})}},{key:"getElementsByTagName",value:function(e){return this.__searchDom(this,function(t){return t.tagName==e})}},{key:"__detachNodeIfAttached",value:function(e){e.parentNode&&e.parentNode.removeChild(e)}},{key:"appendChild",value:function(e){return this.__detachNodeIfAttached(e),this.childNodes.push(e),e.parentNode=this,e}},{key:"insertBefore",value:function(e,t){return this.__detachNodeIfAttached(e),this.childNodes.splice(this.childNodes.indexOf(t),0,e),e.parentNode=this,e}},{key:"insertAfter",value:function(e,t){return this.__detachNodeIfAttached(e),this.childNodes.splice(this.childNodes.indexOf(t)+1,0,e),e.parentNode=this,e}},{key:"removeChild",value:function(e){if(-1===this.childNodes.indexOf(e))throw Error("Node is not a child of this node");return this.childNodes.splice(this.childNodes.indexOf(e),1),e.parentNode=null,e}},{key:"parentElement",get:function(){return this.parentNode}},{key:"ownerDocument",get:function(){var t=this;do{if(t instanceof e("./document.js"))return t}while(t=t.parentNode);return null}},{key:"children",get:function(){return this.childNodes.filter(function(e){return 1===e.nodeType})}},{key:"outerHTML",get:function(){var e="";if(3==this.nodeType)e+=this.textContent;else if(8==this.nodeType)e+="\x3c!--"+this.textContent+"--\x3e";else if(4==this.nodeType)e+="<![CDATA["+this.textContent+"]]>";else{e+="<"+this.tagName+" ";for(var t in this.attributes)this.attributes.hasOwnProperty(t)&&(e+=t,this.attributes[t]&&(e+='="'+this.attributes[t]+'"'),e+=" ");e=e.replace(/\s+$/,""),-1==a.indexOf(this.tagName)?e+=">"+this.innerHTML+"</"+this.tagName+">":e+=" />"}return e},set:function(e){var t=this;if(this.parentNode){var n,r=s().parse("<root>"+e+"</root>").documentElement.childNodes;(n=this.parentNode.childNodes).splice.apply(n,[this.parentNode.childNodes.indexOf(this),1].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(r))),r.forEach(function(e){r.parentNode=t.parentNode})}}},{key:"textContent",set:function(e){if(3==this.nodeType||8==this.nodeType||4==this.nodeType)this._textContent=e;else{var t=new n("#text",3);t.textContent=e,this.childNodes=[t]}},get:function(){if(3==this.nodeType||8==this.nodeType||4==this.nodeType)return this._textContent||"";var e="";return this.__getTextNodes(this).forEach(function(t){e+=t.textContent}),e}},{key:"innerHTML",get:function(){var e="";return this.childNodes.forEach(function(t){e+=t.outerHTML}),e},set:function(e){var t=this,n=s().parse("<root>"+e+"</root>");this.childNodes=[],n.documentElement.childNodes.forEach(function(e){t.appendChild(e)})}},{key:"previousElementSibling",get:function(){var e=this.parentElement;return e?e.children[e.children.indexOf(this)-1]||null:null}},{key:"previousSibling",get:function(){var e=this.parentElement;return e?e.childNodes[e.childNodes.indexOf(this)-1]||null:null}},{key:"nextElementSibling",get:function(){var e=this.parentElement;return e?e.children[e.children.indexOf(this)+1]||null:null}},{key:"nextSibling",get:function(){var e=this.parentElement;return e?e.childNodes[e.childNodes.indexOf(this)+1]||null:null}},{key:"firstChild",get:function(){return this.childNodes[0]||null}},{key:"firstElementChild",get:function(){return this.children[0]||null}},{key:"lastChild",get:function(){var e=this.childNodes;return e[e.length-1]}},{key:"lastElementChild",get:function(){var e=this.children;return e[e.length-1]}}]),n}()},{"./class-list.js":3,"./document.js":5,"./dom-parse":6,"./query-selectable.js":9,"./void-elements.js":11}],8:[function(e,t,n){"use strict";var r=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}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=/([\w-]+)(?:\(([\w\W]+)\)|)/,a={"first-child":function(e){return 0==e.parentNode.children.indexOf(e)},"last-child":function(e){var t=e.parentNode.children;return t.indexOf(e)==t.length-1},"nth-child":function(e,t){t=parseInt(t);return e.parentNode.children.indexOf(e)==t-1},not:function(e,t){return!e.matches(t)},empty:function(e){return 0==e.childNodes.length}};t.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return function e(){i(this,e)}}();return function(t){!function(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)}(n,e);function n(){return i(this,n),function(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}(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return r(n,[{key:"parsePseudoSelectorExression",value:function(e){var t=o.exec(e);if(!t)throw new SyntaxError("Unable to parse pseudoSelector '"+e+"'.");var n=t[1],r=t[2];if(!(n in a))throw SyntaxError("Unsupported pseudo selector '"+n+"'");return function(e){return a[n](e,r)}}}]),n}()}},{}],9:[function(e,t,n){"use strict";var r=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}}();var i=e("./class-list.js"),o=e("./attribute-selector-mixin.js"),a=e("./pseudo-selector-mixin.js"),s=0,u=1,c=2,l=3,h=/^[\\#\.,\$\^\|\w\-:=\s>\*~\+\[\]\(\)'"]+$/;t.exports=function(e){!function(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)}(t,o(a()));function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(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}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return r(t,[{key:"__searchDom",value:function(){throw new TypeError("Method `__searchDom` is not implemented.")}},{key:"__parseQuerySelectorString",value:function(e){h.test(e)||this.__throwInvalidQuerySelector();var t=[];e=e.replace(/\s+/g," ").replace(/\s*(>|\+|~|,)\s*/g,"$1").replace(/^\s+/,"").replace(/\s+$/,"");for(var n=new RegExp("(?:"+["(\\s|>|\\+|~)","(?:\\s|>|\\+|~|^)([\\w-]+(?:[\\w-]*(?:\\\\.)*[\\w-]*)*|\\*)","#([\\w-]+(?:[\\w-]*(?:\\\\.)*[\\w-]*)*)","\\.([\\w-]+(?:[\\w-]*(?:\\\\.)*[\\w-]*)*)","\\[([\\w\\W]+?(?:=(?:\"|')[\\w\\W]*?(?:\"|')|))\\]",":([\\w-]+(?:\\([\\w\\W]+?\\)|))"].join("|")+")");e;){var r=n.exec(e);e=e.slice(r.index+r[0].length);for(var i=1;i<r.length;i++)if(void 0!==r[i]){var o=r[i];6!==i&&(o=o.replace(/\\/g,"")),t.push({type:i,keyword:o})}}return t}},{key:"__qsaSearchType",value:function(e){switch(e){case">":return u;case"+":return c;case"~":return l;default:return s}}},{key:"__buildQsaCriterias",value:function(e){var t=this,n=[],r={};return e.forEach(function(e){switch(e.type){case 1:n.push(r),n.push({searchType:t.__qsaSearchType(e.keyword)}),r={};break;case 2:"*"!=e.keyword&&(r.tagName=e.keyword);break;case 3:r.attributes=r.attributes||{},r.attributes.id=e.keyword;break;case 4:r.classList=r.classList||[],r.classList.push(e.keyword);break;case 5:r.attributes=r.attributes||{};var i=t.parseAttributeExpression(e.keyword);r.attributes[i.name]=i.value;break;case 6:r.pseudoSelectors=r.pseudoSelectors||[];var o=t.parsePseudoSelectorExression(e.keyword);r.pseudoSelectors.push(o)}}),n.push(r),n}},{key:"__qsaSearchByType",value:function(e,t,n,r){return r==s||r==u?this.__qsaSearchTree(e,t,n,r):this.__qsaSearchSiblings(e,t,n,r)}},{key:"__qsaCompareNode",value:function(e,t){var n=this,r=!0;return Object.keys(e).forEach(function(o,a){e[o]instanceof RegExp||!(e[o]instanceof Object)||"pseudoSelectors"==o?t instanceof i?r=r&&t.contains(e[o]):e[o]instanceof RegExp?r=r&&void 0!==t[o]&&e[o].test(t[o]):"pseudoSelectors"==o?e[o].forEach(function(e){r=r&&e(t)}):r=r&&t[o]==e[o]:r=r&&n.__qsaCompareNode(e[o],t[o])}),r}},{key:"__qsaSearchSiblings",value:function(e,t,n,r){for(var i=[],o=0;o<e.length;o++){var a=e[o],s=a.parentNode,u=s.children.indexOf(a);if(-1!==u){for(var l=s.children.splice(u+1),h=0;h<l.length;h++){var f=l[h];if(this.__qsaCompareNode(t,f)&&(i.push(f),n))break;if(r==c)break}if(n&&i.length>0)break}}return i}},{key:"__qsaSearchTree",value:function(e,t,n,r){var i=this,o=[];return e.forEach(function(e){o=o.concat(i.__searchDom(e,function(e){return i.__qsaCompareNode(t,e)},n,r==u))}),o}},{key:"__qsaSearch",value:function(e,t,n){n=n||!1;for(var r=[],i=0;i<t.length;i++){var o=t[i],a=s;if("searchType"in o&&(a=o.searchType,o=t[i+=1]),0==(e=r=(r=this.__qsaSearchByType(e,o,n&&i==t.length-1,a)).filter(function(e,t,n){return n.indexOf(e)===t})).length)break}return r}},{key:"__throwInvalidQuerySelector",value:function(e){if(e instanceof SyntaxError)throw e;throw new SyntaxError("invalid query selector")}},{key:"__qsaSort",value:function(e){var t=[this].reduce(function e(t,n){return t.push(n),n.childNodes.reduce(e,t),t},[]);return e.sort(function(e,n){var r=t.indexOf(e),i=t.indexOf(n);return r>i?1:r<i?-1:0})}},{key:"__execQsa",value:function(e,t){for(var n=[],r=e.split(","),i=0;i<r.length;i++){var o=r[i],a=this.__parseQuerySelectorString(o),s=this.__buildQsaCriterias(a);this.__qsaSearch([this],s,t).forEach(function(e){-1==n.indexOf(e)&&n.push(e)})}return r.length>1?this.__qsaSort(n):n}},{key:"matches",value:function(e){for(var t=this.ownerDocument.querySelectorAll(e),n=t.length;--n>=0&&t[n]!==this;);return n>-1}},{key:"querySelector",value:function(e){try{return this.__execQsa(e)[0]||null}catch(e){this.__throwInvalidQuerySelector(e)}}},{key:"querySelectorAll",value:function(e){try{return this.__execQsa(e)}catch(e){this.__throwInvalidQuerySelector(e)}}}]),t}()},{"./attribute-selector-mixin.js":2,"./class-list.js":3,"./pseudo-selector-mixin.js":8}],10:[function(e,t,n){"use strict";var r=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}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(){i(this,e)}return r(e,null,[{key:"FILTER_ACCEPT",get:function(){return 1}},{key:"FILTER_REJECT",get:function(){return 2}},{key:"FILTER_SKIP",get:function(){return 3}},{key:"SHOW_ALL",get:function(){return 4294967295}},{key:"SHOW_ELEMENT",get:function(){return 1}},{key:"SHOW_ATTRIBUTE",get:function(){return 2}},{key:"SHOW_TEXT",get:function(){return 4}},{key:"SHOW_CDATA_SECTION",get:function(){return 8}},{key:"SHOW_ENTITY_REFERENCE",get:function(){return 16}},{key:"SHOW_ENTITY",get:function(){return 32}},{key:"SHOW_PROCESSING_INSTRUCTION",get:function(){return 64}},{key:"SHOW_COMMENT",get:function(){return 128}},{key:"SHOW_DOCUMENT",get:function(){return 256}},{key:"SHOW_DOCUMENT_TYPE",get:function(){return 512}},{key:"SHOW_DOCUMENT_FRAGMENT",get:function(){return 1024}},{key:"SHOW_NOTATION",get:function(){return 2048}}]),e}(),a=function(){function e(t,n,r){i(this,e),this._={},this._filter=r,this._root=t,this._whatToShow=n,this._flatTree=[],this._iterator=-1,this._reducer()}return r(e,[{key:"_listFilter",value:function(e){return this._filter&&this._filter.acceptNode(e)!=o.FILTER_ACCEPT?this._filter.acceptNode(e)==o.FILTER_SKIP?1:this._filter.acceptNode(e)==o.FILTER_REJECT?-1:void 0:0}},{key:"_shouldShowItem",value:function(e){return 0==this._listFilter(e)}},{key:"_reducer",value:function(){var e=this;this._flatTree=[this._root].reduce(function t(n,r){var i=e._listFilter(r);return 0===i&&(e._whatToShow==o.SHOW_ALL?n.push(r):e._whatToShow==o.SHOW_ELEMENT&&1==r.nodeType?n.push(r):e._whatToShow==o.SHOW_TEXT&&3==r.nodeType?n.push(r):e._whatToShow==o.SHOW_CDATA_SECTION&&4==r.nodeType?n.push(r):e._whatToShow==o.SHOW_COMMENT&&8==r.nodeType&&n.push(r)),-1!==i&&r.childNodes.reduce(t,n),n},[])}},{key:"parentNode",value:function(){var e=this.currentNode.parentNode,t=this._flatTree.indexOf(e);return-1!==t?(this._iterator=t,e):null}},{key:"firstChild",value:function(){for(var e=this.currentNode,t=0;t<e.childNodes.length;t++){var n=this._flatTree.indexOf(e.childNodes[t]);if(-1!==n)return this._iterator=n,e.childNodes[t]}return null}},{key:"lastChild",value:function(){for(var e=this.currentNode,t=e.childNodes.length-1;t>=0;t--){var n=this._flatTree.indexOf(e.childNodes[t]);if(-1!==n)return this._iterator=n,e.childNodes[t]}return null}},{key:"previousSibling",value:function(){for(var e=this.currentNode;e=e.previousSibling;){var t=this._flatTree.indexOf(e);if(-1!==t)return this._iterator=t,e}return null}},{key:"nextSibling",value:function(){for(var e=this.currentNode;e=e.nextSibling;){var t=this._flatTree.indexOf(e);if(-1!==t)return this._iterator=t,e}return null}},{key:"nextNode",value:function(){return this._iterator==this._flatTree.length?null:(this._iterator++,this.currentNode)}},{key:"previousNode",value:function(){return-1==this._iterator?null:(this._iterator--,this.currentNode)}},{key:"filter",get:function(){return this._filter}},{key:"root",get:function(){return this._root}},{key:"whatToShow",get:function(){return this._whatToShow}},{key:"currentNode",get:function(){return this._flatTree[this._iterator]||null}}]),e}();t.exports={TreeWalker:a,NodeFilter:o}},{}],11:[function(e,t,n){"use strict";t.exports=["area","base","br","col","command","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]},{}]},{},[1]);