var entityMap={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},nameStartChar=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,nameChar=new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),tagNamePattern=new RegExp("^"+nameStartChar.source+nameChar.source+"*(?::"+nameStartChar.source+nameChar.source+"*)?$"),S_TAG=0,S_ATTR=1,S_ATTR_SPACE=2,S_EQ=3,S_ATTR_NOQUOT_VALUE=4,S_ATTR_END=5,S_TAG_SPACE=6,S_TAG_CLOSE=7;function XMLReader(){}function parse(e,n,r,i,o){function entityReplacer(e){var n=e.slice(1,-1);return n in r?r[n]:"#"===n.charAt(0)?function(e){if(e>65535){var n=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(n,r)}return String.fromCharCode(e)}(parseInt(n.substr(1).replace("x","0x"))):(o.error("entity not found:"+e),e)}function appendText(n){if(n>p){var r=e.substring(p,n).replace(/&#?\w+;/g,entityReplacer);u&&position(p),i.characters(r,0,n-p),p=n}}function position(n,r){for(;n>=s&&(r=c.exec(e));)a=r.index,s=a+r[0].length,u.lineNumber++;u.columnNumber=n-a+1}for(var a=0,s=0,c=/.*(?:\r\n?|\n)|.*$/g,u=i.locator,l=[{currentNSMap:n}],d={},p=0;;){try{var m=e.indexOf("<",p);if(m<0){if(!e.substr(p).match(/^\s*$/)){var N=i.doc,E=N.createTextNode(e.substr(p));N.appendChild(E),i.currentElement=E}return}switch(m>p&&appendText(m),e.charAt(m+1)){case"/":var h=e.indexOf(">",m+3),f=e.substring(m+2,h),_=l.pop();h<0?(f=e.substring(m+2).replace(/[\s<].*/,""),o.error("end tag name: "+f+" is not complete:"+_.tagName),h=m+1+f.length):f.match(/\s</)&&(f=f.replace(/[\s<].*/,""),o.error("end tag name: "+f+" maybe not complete"),h=m+1+f.length);var T=_.localNSMap,g=_.tagName==f;if(g||_.tagName&&_.tagName.toLowerCase()==f.toLowerCase()){if(i.endElement(_.uri,_.localName,f),T)for(var D in T)i.endPrefixMapping(D);g||o.fatalError("end tag name: "+f+" is not match the current start tagName:"+_.tagName)}else l.push(_);h++;break;case"?":u&&position(m),h=parseInstruction(e,m,i);break;case"!":u&&position(m),h=parseDCC(e,m,i,o);break;default:u&&position(m);var S=new ElementAttributes,A=l[l.length-1].currentNSMap,v=(h=parseElementStartPart(e,m,S,A,entityReplacer,o),S.length);if(!S.closed&&fixSelfClosed(e,h,S.tagName,d)&&(S.closed=!0,r.nbsp||o.warning("unclosed xml attribute")),u&&v){for(var C=copyLocator(u,{}),O=0;O<v;O++){var x=S[O];position(x.offset),x.locator=copyLocator(u,{})}i.locator=C,SaxO.appendElement(S,i,A)&&l.push(S),i.locator=u}else SaxO.appendElement(S,i,A)&&l.push(S);"http://www.w3.org/1999/xhtml"!==S.uri||S.closed?h++:h=parseHtmlSpecialContent(e,h,S.tagName,entityReplacer,i)}}catch(e){o.error("element parse error: "+e),h=-1}h>p?p=h:appendText(Math.max(m,p)+1)}}function copyLocator(e,n){return n.lineNumber=e.lineNumber,n.columnNumber=e.columnNumber,n}function parseElementStartPart(e,n,r,i,o,a){for(var s,c=++n,u=S_TAG;;){var l=e.charAt(c);switch(l){case"=":if(u===S_ATTR)s=e.slice(n,c),u=S_EQ;else{if(u!==S_ATTR_SPACE)throw new Error("attribute equal must after attrName");u=S_EQ}break;case"'":case'"':if(u===S_EQ||u===S_ATTR){if(u===S_ATTR&&(a.warning('attribute value must after "="'),s=e.slice(n,c)),n=c+1,!((c=e.indexOf(l,n))>0))throw new Error("attribute value no end '"+l+"' match");d=e.slice(n,c).replace(/&#?\w+;/g,o),r.add(s,d,n-1),u=S_ATTR_END}else{if(u!=S_ATTR_NOQUOT_VALUE)throw new Error('attribute value must after "="');d=e.slice(n,c).replace(/&#?\w+;/g,o),r.add(s,d,n),a.warning('attribute "'+s+'" missed start quot('+l+")!!"),n=c+1,u=S_ATTR_END}break;case"/":switch(u){case S_TAG:r.setTagName(e.slice(n,c));case S_ATTR_END:case S_TAG_SPACE:case S_TAG_CLOSE:u=S_TAG_CLOSE,r.closed=!0;case S_ATTR_NOQUOT_VALUE:case S_ATTR:case S_ATTR_SPACE:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),u==S_TAG&&r.setTagName(e.slice(n,c)),c;case">":switch(u){case S_TAG:r.setTagName(e.slice(n,c));case S_ATTR_END:case S_TAG_SPACE:case S_TAG_CLOSE:break;case S_ATTR_NOQUOT_VALUE:case S_ATTR:"/"===(d=e.slice(n,c)).slice(-1)&&(r.closed=!0,d=d.slice(0,-1));case S_ATTR_SPACE:u===S_ATTR_SPACE&&(d=s),u==S_ATTR_NOQUOT_VALUE?(a.warning('attribute "'+d+'" missed quot(")!!'),r.add(s,d.replace(/&#?\w+;/g,o),n)):("http://www.w3.org/1999/xhtml"===i[""]&&d.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),r.add(d,d,n));break;case S_EQ:throw new Error("attribute value missed!!")}return c;case"":l=" ";default:if(l<=" ")switch(u){case S_TAG:r.setTagName(e.slice(n,c)),u=S_TAG_SPACE;break;case S_ATTR:s=e.slice(n,c),u=S_ATTR_SPACE;break;case S_ATTR_NOQUOT_VALUE:var d=e.slice(n,c).replace(/&#?\w+;/g,o);a.warning('attribute "'+d+'" missed quot(")!!'),r.add(s,d,n);case S_ATTR_END:u=S_TAG_SPACE}else switch(u){case S_ATTR_SPACE:r.tagName;"http://www.w3.org/1999/xhtml"===i[""]&&s.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+s+'" missed value!! "'+s+'" instead2!!'),r.add(s,s,n),n=c,u=S_ATTR;break;case S_ATTR_END:a.warning('attribute space is required"'+s+'"!!');case S_TAG_SPACE:u=S_ATTR,n=c;break;case S_EQ:u=S_ATTR_NOQUOT_VALUE,n=c;break;case S_TAG_CLOSE:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function parseHtmlSpecialContent(e,n,r,i,o){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",n),s=e.substring(n+1,a);if(/[&<]/.test(s))return/^script$/i.test(r)?(o.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,i),o.characters(s,0,s.length),a)}return n+1}function fixSelfClosed(e,n,r,i){var o=i[r];return null==o&&((o=e.lastIndexOf("</"+r+">"))<n&&(o=e.lastIndexOf("</"+r)),i[r]=o),o<n}function _copy(e,n){for(var r in e)n[r]=e[r]}function parseDCC(e,n,r,i){switch(e.charAt(n+2)){case"-":return"-"===e.charAt(n+3)?(o=e.indexOf("--\x3e",n+4))>n?(r.comment(e,n+4,o-n-4),o+3):(i.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(n+3,6)){var o=e.indexOf("]]>",n+9);return r.startCDATA(),r.characters(e,n+9,o-n-9),r.endCDATA(),o+3}var a=split(e,n),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var c=a[1][0],u=s>3&&/^public$/i.test(a[2][0])&&a[3][0],l=s>4&&a[4][0],d=a[s-1];return r.startDTD(c,u&&u.replace(/^(['"])(.*?)\1$/,"$2"),l&&l.replace(/^(['"])(.*?)\1$/,"$2")),r.endDTD(),d.index+d[0].length}}return-1}function parseInstruction(e,n,r){var i=e.indexOf("?>",n);if(i){var o=e.substring(n,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){o[0].length;return r.processingInstruction(o[1],o[2]),i+2}return-1}return-1}function ElementAttributes(e){}function split(e,n){var r,i=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(o.lastIndex=n,o.exec(e);r=o.exec(e);)if(i.push(r),r[1])return i}function copy(e,n){for(var r in e)n[r]=e[r]}function _extends(e,n){var r=e.prototype;if(!(r instanceof n)){function t(){}t.prototype=n.prototype,copy(r,t=new t),e.prototype=r=t}r.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),r.constructor=e)}SaxO={},XMLReader.prototype={parse:function(e,n,r){var i=this.domBuilder;i.startDocument(),_copy(n,n={}),parse(e,n,r,i,this.errorHandler),i.endDocument()}},SaxO.appendElement=function(e,n,r){for(var i=e.tagName,o=null,a=e.length;a--;){var s=e[a],c=s.qName,u=s.value;if((m=c.indexOf(":"))>0)var l=s.prefix=c.slice(0,m),d=c.slice(m+1),p="xmlns"===l&&d;else d=c,l=null,p="xmlns"===c&&"";s.localName=d,!1!==p&&(null==o&&(o={},_copy(r,r={})),r[p]=o[p]=u,s.uri="http://www.w3.org/2000/xmlns/",n.startPrefixMapping(p,u))}for(a=e.length;a--;){(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==l&&(s.uri=r[l||""]))}var m;(m=i.indexOf(":"))>0?(l=e.prefix=i.slice(0,m),d=e.localName=i.slice(m+1)):(l=null,d=e.localName=i);var N=e.uri=r[l||""];if(n.startElement(N,d,i,e),!e.closed)return e.currentNSMap=r,e.localNSMap=o,!0;if(n.endElement(N,d,i),o)for(l in o)n.endPrefixMapping(l)},ElementAttributes.prototype={setTagName:function(e){if(!tagNamePattern.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,n,r){if(!tagNamePattern.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:n,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},"function"==typeof require&&(exports.XMLReader=XMLReader);var htmlns="http://www.w3.org/1999/xhtml",NodeType={},ELEMENT_NODE=NodeType.ELEMENT_NODE=1,ATTRIBUTE_NODE=NodeType.ATTRIBUTE_NODE=2,TEXT_NODE=NodeType.TEXT_NODE=3,CDATA_SECTION_NODE=NodeType.CDATA_SECTION_NODE=4,ENTITY_REFERENCE_NODE=NodeType.ENTITY_REFERENCE_NODE=5,ENTITY_NODE=NodeType.ENTITY_NODE=6,PROCESSING_INSTRUCTION_NODE=NodeType.PROCESSING_INSTRUCTION_NODE=7,COMMENT_NODE=NodeType.COMMENT_NODE=8,DOCUMENT_NODE=NodeType.DOCUMENT_NODE=9,DOCUMENT_TYPE_NODE=NodeType.DOCUMENT_TYPE_NODE=10,DOCUMENT_FRAGMENT_NODE=NodeType.DOCUMENT_FRAGMENT_NODE=11,NOTATION_NODE=NodeType.NOTATION_NODE=12,ExceptionCode={},ExceptionMessage={},INDEX_SIZE_ERR=ExceptionCode.INDEX_SIZE_ERR=(ExceptionMessage[1]="Index size error",1),DOMSTRING_SIZE_ERR=ExceptionCode.DOMSTRING_SIZE_ERR=(ExceptionMessage[2]="DOMString size error",2),HIERARCHY_REQUEST_ERR=ExceptionCode.HIERARCHY_REQUEST_ERR=(ExceptionMessage[3]="Hierarchy request error",3),WRONG_DOCUMENT_ERR=ExceptionCode.WRONG_DOCUMENT_ERR=(ExceptionMessage[4]="Wrong document",4),INVALID_CHARACTER_ERR=ExceptionCode.INVALID_CHARACTER_ERR=(ExceptionMessage[5]="Invalid character",5),NO_DATA_ALLOWED_ERR=ExceptionCode.NO_DATA_ALLOWED_ERR=(ExceptionMessage[6]="No data allowed",6),NO_MODIFICATION_ALLOWED_ERR=ExceptionCode.NO_MODIFICATION_ALLOWED_ERR=(ExceptionMessage[7]="No modification allowed",7),NOT_FOUND_ERR=ExceptionCode.NOT_FOUND_ERR=(ExceptionMessage[8]="Not found",8),NOT_SUPPORTED_ERR=ExceptionCode.NOT_SUPPORTED_ERR=(ExceptionMessage[9]="Not supported",9),INUSE_ATTRIBUTE_ERR=ExceptionCode.INUSE_ATTRIBUTE_ERR=(ExceptionMessage[10]="Attribute in use",10),INVALID_STATE_ERR=ExceptionCode.INVALID_STATE_ERR=(ExceptionMessage[11]="Invalid state",11),SYNTAX_ERR=ExceptionCode.SYNTAX_ERR=(ExceptionMessage[12]="Syntax error",12),INVALID_MODIFICATION_ERR=ExceptionCode.INVALID_MODIFICATION_ERR=(ExceptionMessage[13]="Invalid modification",13),NAMESPACE_ERR=ExceptionCode.NAMESPACE_ERR=(ExceptionMessage[14]="Invalid namespace",14),INVALID_ACCESS_ERR=ExceptionCode.INVALID_ACCESS_ERR=(ExceptionMessage[15]="Invalid access",15);function DOMException(e,n){if(n instanceof Error)var r=n;else r=this,Error.call(this,ExceptionMessage[e]),this.message=ExceptionMessage[e],Error.captureStackTrace&&Error.captureStackTrace(this,DOMException);return r.code=e,n&&(this.message=this.message+": "+n),r}function NodeList(){}function LiveNodeList(e,n){this._node=e,this._refresh=n,_updateLiveList(this)}function _updateLiveList(e){var n=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=n){var r=e._refresh(e._node);__set__(e,"length",r.length),copy(r,e),e._inc=n}}function NamedNodeMap(){}function _findNodeIndex(e,n){for(var r=e.length;r--;)if(e[r]===n)return r}function _addNamedNode(e,n,r,i){if(i?n[_findNodeIndex(n,i)]=r:n[n.length++]=r,e){r.ownerElement=e;var o=e.ownerDocument;o&&(i&&_onRemoveAttribute(o,e,i),_onAddAttribute(o,e,r))}}function _removeNamedNode(e,n,r){var i=_findNodeIndex(n,r);if(!(i>=0))throw DOMException(NOT_FOUND_ERR,new Error(e.tagName+"@"+r));for(var o=n.length-1;i<o;)n[i]=n[++i];if(n.length=o,e){var a=e.ownerDocument;a&&(_onRemoveAttribute(a,e,r),r.ownerElement=null)}}function DOMImplementation(e){if(this._features={},e)for(var n in e)this._features=e[n]}function Node(){}function _xmlEncoder(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function _visitNode(e,n){if(n(e))return!0;if(e=e.firstChild)do{if(_visitNode(e,n))return!0}while(e=e.nextSibling)}function Document(){}function _onAddAttribute(e,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==r.namespaceURI&&(n._nsMap[r.prefix?r.localName:""]=r.value)}function _onRemoveAttribute(e,n,r,i){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==r.namespaceURI&&delete n._nsMap[r.prefix?r.localName:""]}function _onUpdateChild(e,n,r){if(e&&e._inc){e._inc++;var i=n.childNodes;if(r)i[i.length++]=r;else{for(var o=n.firstChild,a=0;o;)i[a++]=o,o=o.nextSibling;i.length=a}}}function _removeChild(e,n){var r=n.previousSibling,i=n.nextSibling;return r?r.nextSibling=i:e.firstChild=i,i?i.previousSibling=r:e.lastChild=r,_onUpdateChild(e.ownerDocument,e),n}function _insertBefore(e,n,r){var i=n.parentNode;if(i&&i.removeChild(n),n.nodeType===DOCUMENT_FRAGMENT_NODE){var o=n.firstChild;if(null==o)return n;var a=n.lastChild}else o=a=n;var s=r?r.previousSibling:e.lastChild;o.previousSibling=s,a.nextSibling=r,s?s.nextSibling=o:e.firstChild=o,null==r?e.lastChild=a:r.previousSibling=a;do{o.parentNode=e}while(o!==a&&(o=o.nextSibling));return _onUpdateChild(e.ownerDocument||e,e),n.nodeType==DOCUMENT_FRAGMENT_NODE&&(n.firstChild=n.lastChild=null),n}function _appendSingleChild(e,n){var r=n.parentNode;if(r){var i=e.lastChild;r.removeChild(n);i=e.lastChild}i=e.lastChild;return n.parentNode=e,n.previousSibling=i,n.nextSibling=null,i?i.nextSibling=n:e.firstChild=n,e.lastChild=n,_onUpdateChild(e.ownerDocument,e,n),n}function Element(){this._nsMap={}}function Attr(){}function CharacterData(){}function Text(){}function Comment(){}function CDATASection(){}function DocumentType(){}function Notation(){}function Entity(){}function EntityReference(){}function DocumentFragment(){}function ProcessingInstruction(){}function XMLSerializer(){}function nodeSerializeToString(e,n){var r=[],i=9==this.nodeType&&this.documentElement||this,o=i.prefix,a=i.namespaceURI;if(a&&null==o&&null==(o=i.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return serializeToString(this,r,e,n,s),r.join("")}function needNamespaceDefine(e,n,r){var i=e.prefix||"",o=e.namespaceURI;if(!i&&!o)return!1;if("xml"===i&&"http://www.w3.org/XML/1998/namespace"===o||"http://www.w3.org/2000/xmlns/"==o)return!1;for(var a=r.length;a--;){var s=r[a];if(s.prefix==i)return s.namespace!=o}return!0}function serializeToString(e,n,r,i,o){if(i){if(!(e=i(e)))return;if("string"==typeof e)return void n.push(e)}switch(e.nodeType){case ELEMENT_NODE:o||(o=[]);o.length;var a=e.attributes,s=a.length,c=e.firstChild,u=e.tagName;r=htmlns===e.namespaceURI||r,n.push("<",u);for(var l=0;l<s;l++){"xmlns"==(d=a.item(l)).prefix?o.push({prefix:d.localName,namespace:d.value}):"xmlns"==d.nodeName&&o.push({prefix:"",namespace:d.value})}for(l=0;l<s;l++){var d;if(needNamespaceDefine(d=a.item(l),r,o)){var p=d.prefix||"",m=d.namespaceURI,N=p?" xmlns:"+p:" xmlns";n.push(N,'="',m,'"'),o.push({prefix:p,namespace:m})}serializeToString(d,n,r,i,o)}if(needNamespaceDefine(e,r,o)){p=e.prefix||"",m=e.namespaceURI,N=p?" xmlns:"+p:" xmlns";n.push(N,'="',m,'"'),o.push({prefix:p,namespace:m})}if(c||r&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(n.push(">"),r&&/^script$/i.test(u))for(;c;)c.data?n.push(c.data):serializeToString(c,n,r,i,o),c=c.nextSibling;else for(;c;)serializeToString(c,n,r,i,o),c=c.nextSibling;n.push("</",u,">")}else n.push("/>");return;case DOCUMENT_NODE:case DOCUMENT_FRAGMENT_NODE:for(c=e.firstChild;c;)serializeToString(c,n,r,i,o),c=c.nextSibling;return;case ATTRIBUTE_NODE:return n.push(" ",e.name,'="',e.value.replace(/[<&"]/g,_xmlEncoder),'"');case TEXT_NODE:return n.push(e.data.replace(/[<&]/g,_xmlEncoder));case CDATA_SECTION_NODE:return n.push("<![CDATA[",e.data,"]]>");case COMMENT_NODE:return n.push("\x3c!--",e.data,"--\x3e");case DOCUMENT_TYPE_NODE:var E=e.publicId,h=e.systemId;if(n.push("<!DOCTYPE ",e.name),E)n.push(' PUBLIC "',E),h&&"."!=h&&n.push('" "',h),n.push('">');else if(h&&"."!=h)n.push(' SYSTEM "',h,'">');else{var f=e.internalSubset;f&&n.push(" [",f,"]"),n.push(">")}return;case PROCESSING_INSTRUCTION_NODE:return n.push("<?",e.target," ",e.data,"?>");case ENTITY_REFERENCE_NODE:return n.push("&",e.nodeName,";");default:n.push("??",e.nodeName)}}function importNode(e,n,r){var i;switch(n.nodeType){case ELEMENT_NODE:(i=n.cloneNode(!1)).ownerDocument=e;case DOCUMENT_FRAGMENT_NODE:break;case ATTRIBUTE_NODE:r=!0}if(i||(i=n.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,r)for(var o=n.firstChild;o;)i.appendChild(importNode(e,o,r)),o=o.nextSibling;return i}function cloneNode(e,n,r){var i=new n.constructor;for(var o in n){var a=n[o];"object"!=typeof a&&a!=i[o]&&(i[o]=a)}switch(n.childNodes&&(i.childNodes=new NodeList),i.ownerDocument=e,i.nodeType){case ELEMENT_NODE:var s=n.attributes,c=i.attributes=new NamedNodeMap,u=s.length;c._ownerElement=i;for(var l=0;l<u;l++)i.setAttributeNode(cloneNode(e,s.item(l),!0));break;case ATTRIBUTE_NODE:r=!0}if(r)for(var d=n.firstChild;d;)i.appendChild(cloneNode(e,d,r)),d=d.nextSibling;return i}function __set__(e,n,r){e[n]=r}DOMException.prototype=Error.prototype,copy(ExceptionCode,DOMException),NodeList.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,n){for(var r=[],i=0;i<this.length;i++)serializeToString(this[i],r,e,n);return r.join("")}},LiveNodeList.prototype.item=function(e){return _updateLiveList(this),this[e]},_extends(LiveNodeList,NodeList),NamedNodeMap.prototype={length:0,item:NodeList.prototype.item,getNamedItem:function(e){for(var n=this.length;n--;){var r=this[n];if(r.nodeName==e)return r}},setNamedItem:function(e){var n=e.ownerElement;if(n&&n!=this._ownerElement)throw new DOMException(INUSE_ATTRIBUTE_ERR);var r=this.getNamedItem(e.nodeName);return _addNamedNode(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var n,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new DOMException(INUSE_ATTRIBUTE_ERR);return n=this.getNamedItemNS(e.namespaceURI,e.localName),_addNamedNode(this._ownerElement,this,e,n),n},removeNamedItem:function(e){var n=this.getNamedItem(e);return _removeNamedNode(this._ownerElement,this,n),n},removeNamedItemNS:function(e,n){var r=this.getNamedItemNS(e,n);return _removeNamedNode(this._ownerElement,this,r),r},getNamedItemNS:function(e,n){for(var r=this.length;r--;){var i=this[r];if(i.localName==n&&i.namespaceURI==e)return i}return null}},DOMImplementation.prototype={hasFeature:function(e,n){var r=this._features[e.toLowerCase()];return!(!r||n&&!(n in r))},createDocument:function(e,n,r){var i=new Document;if(i.implementation=this,i.childNodes=new NodeList,i.doctype=r,r&&i.appendChild(r),n){var o=i.createElementNS(e,n);i.appendChild(o)}return i},createDocumentType:function(e,n,r){var i=new DocumentType;return i.name=e,i.nodeName=e,i.publicId=n,i.systemId=r,i}},Node.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,n){return _insertBefore(this,e,n)},replaceChild:function(e,n){this.insertBefore(e,n),n&&this.removeChild(n)},removeChild:function(e){return _removeChild(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return cloneNode(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var n=e.nextSibling;n&&n.nodeType==TEXT_NODE&&e.nodeType==TEXT_NODE?(this.removeChild(n),e.appendData(n.data)):(e.normalize(),e=n)}},isSupported:function(e,n){return this.ownerDocument.implementation.hasFeature(e,n)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var n=this;n;){var r=n._nsMap;if(r)for(var i in r)if(r[i]==e)return i;n=n.nodeType==ATTRIBUTE_NODE?n.ownerDocument:n.parentNode}return null},lookupNamespaceURI:function(e){for(var n=this;n;){var r=n._nsMap;if(r&&e in r)return r[e];n=n.nodeType==ATTRIBUTE_NODE?n.ownerDocument:n.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},copy(NodeType,Node),copy(NodeType,Node.prototype),Document.prototype={nodeName:"#document",nodeType:DOCUMENT_NODE,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,n){if(e.nodeType==DOCUMENT_FRAGMENT_NODE){for(var r=e.firstChild;r;){var i=r.nextSibling;this.insertBefore(r,n),r=i}return e}return null==this.documentElement&&e.nodeType==ELEMENT_NODE&&(this.documentElement=e),_insertBefore(this,e,n),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),_removeChild(this,e)},importNode:function(e,n){return importNode(this,e,n)},getElementById:function(e){var n=null;return _visitNode(this.documentElement,(function(r){if(r.nodeType==ELEMENT_NODE&&r.getAttribute("id")==e)return n=r,!0})),n},createElement:function(e){var n=new Element;return n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.childNodes=new NodeList,(n.attributes=new NamedNodeMap)._ownerElement=n,n},createDocumentFragment:function(){var e=new DocumentFragment;return e.ownerDocument=this,e.childNodes=new NodeList,e},createTextNode:function(e){var n=new Text;return n.ownerDocument=this,n.appendData(e),n},createComment:function(e){var n=new Comment;return n.ownerDocument=this,n.appendData(e),n},createCDATASection:function(e){var n=new CDATASection;return n.ownerDocument=this,n.appendData(e),n},createProcessingInstruction:function(e,n){var r=new ProcessingInstruction;return r.ownerDocument=this,r.tagName=r.target=e,r.nodeValue=r.data=n,r},createAttribute:function(e){var n=new Attr;return n.ownerDocument=this,n.name=e,n.nodeName=e,n.localName=e,n.specified=!0,n},createEntityReference:function(e){var n=new EntityReference;return n.ownerDocument=this,n.nodeName=e,n},createElementNS:function(e,n){var r=new Element,i=n.split(":"),o=r.attributes=new NamedNodeMap;return r.childNodes=new NodeList,r.ownerDocument=this,r.nodeName=n,r.tagName=n,r.namespaceURI=e,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=n,o._ownerElement=r,r},createAttributeNS:function(e,n){var r=new Attr,i=n.split(":");return r.ownerDocument=this,r.nodeName=n,r.name=n,r.namespaceURI=e,r.specified=!0,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=n,r}},_extends(Document,Node),Element.prototype={nodeType:ELEMENT_NODE,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var n=this.getAttributeNode(e);return n&&n.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,n){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},removeAttribute:function(e){var n=this.getAttributeNode(e);n&&this.removeAttributeNode(n)},appendChild:function(e){return e.nodeType===DOCUMENT_FRAGMENT_NODE?this.insertBefore(e,null):_appendSingleChild(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,n){var r=this.getAttributeNodeNS(e,n);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,n){return null!=this.getAttributeNodeNS(e,n)},getAttributeNS:function(e,n){var r=this.getAttributeNodeNS(e,n);return r&&r.value||""},setAttributeNS:function(e,n,r){var i=this.ownerDocument.createAttributeNS(e,n);i.value=i.nodeValue=""+r,this.setAttributeNode(i)},getAttributeNodeNS:function(e,n){return this.attributes.getNamedItemNS(e,n)},getElementsByTagName:function(e){return new LiveNodeList(this,(function(n){var r=[];return _visitNode(n,(function(i){i===n||i.nodeType!=ELEMENT_NODE||"*"!==e&&i.tagName!=e||r.push(i)})),r}))},getElementsByTagNameNS:function(e,n){return new LiveNodeList(this,(function(r){var i=[];return _visitNode(r,(function(o){o===r||o.nodeType!==ELEMENT_NODE||"*"!==e&&o.namespaceURI!==e||"*"!==n&&o.localName!=n||i.push(o)})),i}))}},Document.prototype.getElementsByTagName=Element.prototype.getElementsByTagName,Document.prototype.getElementsByTagNameNS=Element.prototype.getElementsByTagNameNS,_extends(Element,Node),Attr.prototype.nodeType=ATTRIBUTE_NODE,_extends(Attr,Node),CharacterData.prototype={data:"",substringData:function(e,n){return this.data.substring(e,e+n)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,n){this.replaceData(e,0,n)},appendChild:function(e){throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])},deleteData:function(e,n){this.replaceData(e,n,"")},replaceData:function(e,n,r){r=this.data.substring(0,e)+r+this.data.substring(e+n),this.nodeValue=this.data=r,this.length=r.length}},_extends(CharacterData,Node),Text.prototype={nodeName:"#text",nodeType:TEXT_NODE,splitText:function(e){var n=this.data,r=n.substring(e);n=n.substring(0,e),this.data=this.nodeValue=n,this.length=n.length;var i=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},_extends(Text,CharacterData),Comment.prototype={nodeName:"#comment",nodeType:COMMENT_NODE},_extends(Comment,CharacterData),CDATASection.prototype={nodeName:"#cdata-section",nodeType:CDATA_SECTION_NODE},_extends(CDATASection,CharacterData),DocumentType.prototype.nodeType=DOCUMENT_TYPE_NODE,_extends(DocumentType,Node),Notation.prototype.nodeType=NOTATION_NODE,_extends(Notation,Node),Entity.prototype.nodeType=ENTITY_NODE,_extends(Entity,Node),EntityReference.prototype.nodeType=ENTITY_REFERENCE_NODE,_extends(EntityReference,Node),DocumentFragment.prototype.nodeName="#document-fragment",DocumentFragment.prototype.nodeType=DOCUMENT_FRAGMENT_NODE,_extends(DocumentFragment,Node),ProcessingInstruction.prototype.nodeType=PROCESSING_INSTRUCTION_NODE,_extends(ProcessingInstruction,Node),XMLSerializer.prototype.serializeToString=function(e,n,r){return nodeSerializeToString.call(e,n,r)},Node.prototype.toString=nodeSerializeToString;try{if(Object.defineProperty){function getTextContent(e){switch(e.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:var n=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&n.push(getTextContent(e)),e=e.nextSibling;return n.join("");default:return e.nodeValue}}Object.defineProperty(LiveNodeList.prototype,"length",{get:function(){return _updateLiveList(this),this.$$length}}),Object.defineProperty(Node.prototype,"textContent",{get:function(){return getTextContent(this)},set:function(e){switch(this.nodeType){case ELEMENT_NODE:case DOCUMENT_FRAGMENT_NODE:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),__set__=function(e,n,r){e["$$"+n]=r}}}catch(e){}function DOMParser(e){this.options=e||{locator:{}}}function buildErrorHandler(e,n,r){if(!e){if(n instanceof DOMHandler)return n;e=n}var i={},o=e instanceof Function;function build(n){var a=e[n];!a&&o&&(a=2==e.length?function(r){e(n,r)}:e),i[n]=a&&function(e){a("[xmldom "+n+"]\t"+e+_locator(r))}||function(){}}return r=r||{},build("warning"),build("error"),build("fatalError"),i}function DOMHandler(){this.cdata=!1}function position(e,n){n.lineNumber=e.lineNumber,n.columnNumber=e.columnNumber}function _locator(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function _toString(e,n,r){return"string"==typeof e?e.substr(n,r):e.length>=n+r||n?new java.lang.String(e,n,r)+"":e}function appendElement(e,n){e.currentElement?e.currentElement.appendChild(n):e.doc.appendChild(n)}"function"==typeof require&&(exports.DOMImplementation=DOMImplementation,exports.XMLSerializer=XMLSerializer),DOMParser.prototype.parseFromString=function(e,n){var r=this.options,i=new XMLReader,o=r.domBuilder||new DOMHandler,a=r.errorHandler,s=r.locator,c=r.xmlns||{},u=/\/x?html?$/.test(n),l=u?htmlEntity.entityMap:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return s&&o.setDocumentLocator(s),i.errorHandler=buildErrorHandler(a,o,s),i.domBuilder=r.domBuilder||o,u&&(c[""]="http://www.w3.org/1999/xhtml"),c.xml=c.xml||"http://www.w3.org/XML/1998/namespace",e?i.parse(e,c,l):i.errorHandler.error("invalid doc source"),o.doc},DOMHandler.prototype={startDocument:function(){this.doc=(new DOMImplementation).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,n,r,i){var o=this.doc,a=o.createElementNS(e,r||n),s=i.length;appendElement(this,a),this.currentElement=a,this.locator&&position(this.locator,a);for(var c=0;c<s;c++){e=i.getURI(c);var u=i.getValue(c),l=(r=i.getQName(c),o.createAttributeNS(e,r));this.locator&&position(i.getLocator(c),l),l.value=l.nodeValue=u,a.setAttributeNode(l)}},endElement:function(e,n,r){var i=this.currentElement;i.tagName;this.currentElement=i.parentNode},startPrefixMapping:function(e,n){},endPrefixMapping:function(e){},processingInstruction:function(e,n){var r=this.doc.createProcessingInstruction(e,n);this.locator&&position(this.locator,r),appendElement(this,r)},ignorableWhitespace:function(e,n,r){},characters:function(e,n,r){if(e=_toString.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&position(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,n,r){e=_toString.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&position(this.locator,i),appendElement(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,n,r){var i=this.doc.implementation;if(i&&i.createDocumentType){var o=i.createDocumentType(e,n,r);this.locator&&position(this.locator,o),appendElement(this,o)}},warning:function(e){console.warn("[xmldom warning]\t"+e,_locator(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,_locator(this.locator))},fatalError:function(e){throw console.error("[xmldom fatalError]\t"+e,_locator(this.locator)),e}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){DOMHandler.prototype[e]=function(){return null}})),htmlEntity={},htmlEntity.entityMap=entityMap,window.Parser={DOMParser:DOMParser};