/*! rasterizeHTML.js - v1.3.0 - 2018-03-18
* http://www.github.com/cburgmer/rasterizeHTML.js
* Copyright (c) 2018 Christoph Burgmer; Licensed MIT */
/* Integrated dependencies:
 * url (MIT License),
 * xmlserializer (MIT License),
 * sane-domparser-error (BSD License),
 * css-font-face-src (BSD License),
 * inlineresources (MIT License) */

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).rasterizeHTML=e()}}(function(){return function a(s,i,u){function c(r,e){if(!i[r]){if(!s[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var o=i[r]={exports:{}};s[r][0].call(o.exports,function(e){var t=s[r][1][e];return c(t||e)},o,o.exports,a,s,i,u)}return i[r].exports}for(var l="function"==typeof require&&require,e=0;e<u.length;e++)c(u[e]);return c}({1:[function(e,t,r){var n,o;o=function(e,t,r,n){var o=function(r){"use strict";var o={},t=[];o.joinUrl=function(e,t){return e?r.resolve(e,t):t},o.getConstantUniqueIdFor=function(e){return t.indexOf(e)<0&&t.push(e),t.indexOf(e)},o.clone=function(e){var t,r={};for(t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r};return o.parseOptionalParameters=function(e){var t,r,n={canvas:null,options:{}};return null==e[0]||(t=e[0],"object"==typeof(r=t)&&null!==r&&Object.prototype.toString.apply(t).match(/\[object (Canvas|HTMLCanvasElement)\]/i))?(n.canvas=e[0]||null,n.options=o.clone(e[1])):n.options=o.clone(e[0]),n},o}(e),a=function(s){"use strict";var e={},i=function(e,t,r){var n=e[t];return e[t]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(this,[e,n])},n};return e.baseUrlRespectingXhr=function(t,a){return function(){var e=new t;return i(e,"open",function(e,t){var r=e.shift(),n=e.shift(),o=s.joinUrl(a,n);return t.apply(this,[r,o].concat(e))}),e}},e.finishNotifyingXhr=function(t){var r,n=0,o=0,a=!1,e=new Promise(function(e){r=function(){n-o<=0&&a&&e({totalCount:n})}}),s=function(){var e=new t;return i(e,"send",function(e,t){return n+=1,t.apply(this,arguments)}),e.addEventListener("load",function(){o+=1,r()}),e};return s.waitForRequestsToFinish=function(){return a=!0,r(),e},s},e}(o),s=function(s){"use strict";var e={},o=function(e){return Array.prototype.slice.call(e)},i={active:!0,hover:!0,focus:!1,target:!1};return e.fakeUserAction=function(e,t,r){var n=e.querySelector(t),o=":"+r,a="rasterizehtml"+r;n&&(i[r]?s.addClassNameRecursively(n,a):s.addClassName(n,a),s.rewriteCssSelectorWith(e,o,"."+a))},e.persistInputValues=function(e){var t=e.querySelectorAll("input"),r=e.querySelectorAll("textarea"),n=function(e){return"checkbox"===e.type||"radio"===e.type};o(t).filter(n).forEach(function(e){e.checked?e.setAttribute("checked",""):e.removeAttribute("checked")}),o(t).filter(function(e){return!n(e)}).forEach(function(e){e.setAttribute("value",e.value)}),o(r).forEach(function(e){e.textContent=e.value})},e.rewriteTagNameSelectorsToLowerCase=function(e){s.lowercaseCssTypeSelectors(e,s.findHtmlOnlyNodeNames(e))},e}(function(){"use strict";var r={},i=function(e){return Array.prototype.slice.call(e)};r.addClassName=function(e,t){e.className+=" "+t},r.addClassNameRecursively=function(e,t){r.addClassName(e,t),e.parentNode!==e.ownerDocument&&r.addClassNameRecursively(e.parentNode,t)};var u=function(e,t){var r,n,o,a,s=e.cssText.replace(/^[^\{]+/,"");n=t+" "+s,o=(r=e).parentStyleSheet,a=i(o.cssRules).indexOf(r),o.insertRule(n,a+1),o.deleteRule(a)},c=function(e){var t;e.textContent=(t=e.sheet.cssRules,i(t).reduce(function(e,t){return e+t.cssText},""))},n=function(e,t,a){var s="((?:^|[^.#:\\w])|(?=\\W))("+t.join("|")+")(?=\\W|$)";i(e.querySelectorAll("style")).forEach(function(e){var t,r,n;void 0===e.sheet&&(t=e,r=document.implementation.createHTMLDocument(""),(n=document.createElement("style")).textContent=t.textContent,r.body.appendChild(n),t.sheet=n.sheet);var o=i(e.sheet.cssRules).filter(function(e){return e.selectorText&&new RegExp(s,"i").test(e.selectorText)});o.length&&(o.forEach(function(e){var t=e.selectorText.replace(new RegExp(s,"gi"),function(e,t,r){return t+a(r)});t!==e.selectorText&&u(e,t)}),c(e))})};return r.rewriteCssSelectorWith=function(e,t,r){n(e,[t],function(){return r})},r.lowercaseCssTypeSelectors=function(e,t){n(e,t,function(e){return e.toLowerCase()})},r.findHtmlOnlyNodeNames=function(e){for(var t,r=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),n={},o={};t=r.currentNode.tagName.toLowerCase(),"http://www.w3.org/1999/xhtml"===r.currentNode.namespaceURI?n[t]=!0:o[t]=!0,r.nextNode(););return Object.keys(n).filter(function(e){return!o[e]})},r}()),i=function(l,g,t,y){"use strict";var e={};e.executeJavascript=function(m,d){return new Promise(function(t){var e,r,n,o,a,s=(e=y.document,r="iframe",n=d.width,o=d.height,(a=e.createElement(r)).style.visibility="hidden",a.style.width=n+"px",a.style.height=o+"px",a.style.position="absolute",a.style.top=-1e4-o+"px",a.style.left=-1e4-n+"px",e.getElementsByTagName("body")[0].appendChild(a),a),i=m.outerHTML,u=[],c=d.executeJsTimeout||0,l=function(){var e=s.contentDocument;y.document.getElementsByTagName("body")[0].removeChild(s),t({document:e,errors:u})},h=s.contentWindow.XMLHttpRequest,f=g.finishNotifyingXhr(h),p=g.baseUrlRespectingXhr(f,d.baseUrl);s.onload=function(){var t;(t=c,0<t?new Promise(function(e){setTimeout(e,t)}):Promise.resolve()).then(f.waitForRequestsToFinish).then(l)},s.contentDocument.open(),s.contentWindow.XMLHttpRequest=p,s.contentWindow.onerror=function(e){u.push({resourceType:"scriptExecution",msg:e})},s.contentDocument.write("<!DOCTYPE html>"),s.contentDocument.write(i),s.contentDocument.close()})};var v=function(e,t,r,n,o){var a,s,i,u,c,l,h,f,p,m,d,g=Math.max(e.scrollWidth,e.clientWidth),v=Math.max(e.scrollHeight,e.clientHeight);return t?(a=(l=function(e,t){var r=e.querySelector(t);if(r)return r;if(e.ownerDocument.querySelector(t)===e)return e;throw{message:"Clipping selector not found"}}(e,t).getBoundingClientRect()).top,s=l.left,i=l.width,u=l.height):(s=a=0,i=g,u=v),f={width:i,height:u},p=r,m=n,d=o,h={width:Math.max(f.width*d,p),height:Math.max(f.height*d,m)},c=y.getComputedStyle(e.ownerDocument.documentElement).fontSize,{left:s,top:a,width:h.width,height:h.height,viewportWidth:g,viewportHeight:v,rootFontSize:c}};e.calculateDocumentContentSize=function(d,g){return new Promise(function(o,a){var s,e,t,r,n,i,u,c,l,h,f,p,m=g.zoom||1;e=g.width,t=g.height,r=m,l=Math.floor(e/r),h=Math.floor(t/r),n=y.document,i=l,u=h,(c=n.createElement("iframe")).style.width=i+"px",c.style.height=u+"px",c.style.visibility="hidden",c.style.position="absolute",c.style.top=-1e4-u+"px",c.style.left=-1e4-i+"px",c.style.borderWidth=0,c.sandbox="allow-same-origin",c.scrolling="no",s=c,y.document.getElementsByTagName("body")[0].appendChild(s),s.onload=function(){var e,t,r,n=s.contentDocument;try{e=v((t=n,r=d.tagName,t.querySelector(r)),g.clip,g.width,g.height,m),o(e)}catch(e){a(e)}finally{y.document.getElementsByTagName("body")[0].removeChild(s)}},s.contentDocument.open(),s.contentDocument.write("<!DOCTYPE html>"),s.contentDocument.write("html"===(p=(f=d).tagName.toLowerCase())||"body"===p?f.outerHTML:'<body style="margin: 0;">'+f.outerHTML+"</body>"),s.contentDocument.close()})},e.parseHtmlFragment=function(e){var t=y.document.implementation.createHTMLDocument("");t.documentElement.innerHTML=e;var r=t.querySelector("body").firstChild;if(!r)throw"Invalid source";return r};e.parseHTML=function(e){var t=y.document.implementation.createHTMLDocument("");return t.documentElement.innerHTML=e,function(e,t){var r,n,o,a,s=/<html((?:\s+[^>]*)?)>/im.exec(t),i=y.document.implementation.createHTMLDocument("");if(s)for(r="<div"+s[1]+"></div>",i.documentElement.innerHTML=r,o=i.querySelector("div"),n=0;n<o.attributes.length;n++)a=o.attributes[n],e.documentElement.setAttribute(a.name,a.value)}(t,e),t};var r=function(e){try{return t.failOnParseError(e)}catch(e){throw{message:"Invalid source",originalError:e}}};e.validateXHTML=function(e){var t=(new DOMParser).parseFromString(e,"application/xml");r(t)};var h=null,n=function(u,c){return new Promise(function(e,t){var r,n,o=new window.XMLHttpRequest,a=l.joinUrl(c.baseUrl,u),s=(r=a,"none"===(n=c.cache)||"repeated"===n?(null!==h&&"repeated"===n||(h=Date.now()),r+"?_="+h):r),i=function(e){t({message:"Unable to load page",originalError:e})};o.addEventListener("load",function(){200===o.status||0===o.status?e(o.responseXML):i(o.statusText)},!1),o.addEventListener("error",function(e){i(e)},!1);try{o.open("GET",s,!0),o.responseType="document",o.send(null)}catch(e){i(e)}})};return e.loadDocument=function(e,t){return n(e,t).then(function(e){return r(e)})},e}(o,a,r,window),u=function(n){"use strict";var e,t={},o=function(e,t){return t?URL.createObjectURL(new Blob([e],{type:"image/svg+xml"})):"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e)},s=function(e){e instanceof Blob&&URL.revokeObjectURL(e)},a='<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"><foreignObject></foreignObject></svg>',i=function(o){return new Promise(function(t,e){var r=document.createElement("canvas"),n=new Image;n.onload=function(){var e=r.getContext("2d");try{e.drawImage(n,0,0),r.toDataURL("image/png"),t(!0)}catch(e){t(!1)}},n.onerror=e,n.src=o})},r=function(){return new Promise(function(t,e){var r;(function(){if(n.Blob)try{return new Blob(["<b></b>"],{type:"text/xml"}),!0}catch(e){}return!1})()&&n.URL?(r=o(a,!0),i(r).then(function(e){return s(r),!e&&i(o(a,!1)).then(function(e){return e})},function(){return!1})).then(function(e){t(!e)},function(){e()}):t(!1)})},u=function(t){return(void 0===e&&(e=r()),e).then(function(e){return o(t,e)})};return t.renderSvg=function(a){return new Promise(function(e,t){var r,n,o=function(){r&&s(r)};(n=new Image).onload=function(){n.onload=null,n.onerror=null,o(),e(n)},n.onerror=function(){o(),t()},u(a).then(function(e){r=e,n.src=r},t)})},t}(window);return function(h,i,f){"use strict";var u={};u.drawDocument=function(){var e,t,r,n,o,a,s,i=arguments[0],u=Array.prototype.slice.call(arguments,1),c=h.parseOptionalParameters(u),l=i.documentElement?i.documentElement:i;return f.rasterize(l,c.canvas,(r=(e=c).canvas,n=e.options,o=r?r.width:300,a=r?r.height:200,s={width:void 0!==n.width?n.width:o,height:void 0!==n.height?n.height:a},(t=h.clone(e.options)).width=s.width,t.height=s.height,t))};u.drawHTML=function(){var e,t,r,n,o=arguments[0],a=Array.prototype.slice.call(arguments,1),s=h.parseOptionalParameters(a);return e=o,t=s.canvas,r=s.options,n=i.parseHTML(e),u.drawDocument(n,t,r)};var n=function(r,n,o){return i.loadDocument(r,o).then(function(e){var t=function(e,t,r){var n=document.implementation.createHTMLDocument("");n.replaceChild(e.documentElement,n.documentElement);var o=r?h.clone(r):{};return r.baseUrl||(o.baseUrl=t),{document:n,options:o}}(e,r,o);return u.drawDocument(t.document,n,t.options)})};return u.drawURL=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),r=h.parseOptionalParameters(t);return n(e,r.canvas,r.options)},u}(o,i,function(r,a,s,n,e,i){"use strict";var t={},o=function(e){return{message:"Error rendering page",originalError:e}},u=function(t){return e.renderSvg(t).then(function(e){return{image:e,svg:t}},function(e){throw o(e)})},c=function(e,t,r){return n.drawDocumentAsSvg(e,r).then(u).then(function(e){return t&&function(e,t){try{t.getContext("2d").drawImage(e,0,0)}catch(e){throw o(e)}}(e.image,t),e})};return t.rasterize=function(n,e,o){var t;return(t=r.clone(o)).inlineScripts=!0===o.executeJs,i.inlineReferences(n,t).then(function(t){return o.executeJs?(e=n,r=o,a.executeJavascript(e,r).then(function(e){var t=e.document;return s.persistInputValues(t),{document:t,errors:e.errors}})).then(function(e){return{element:e.document.documentElement,errors:t.concat(e.errors)}}):{element:n,errors:t};var e,r}).then(function(t){return c(t.element,e,o).then(function(e){return{image:e.image,svg:e.svg,errors:t.errors}})})},t}(o,i,s,function(e,p,n,m){"use strict";var o={},d=function(t){var e=Object.keys(t);return e.length?" "+e.map(function(e){return e+'="'+t[e]+'"'}).join(" "):""},a=function(e,t,r){var n=m.serializeToString(e);p.validateXHTML(n);var o,a,s,i,u,c,l,h,f=(o=t,a=Math.round(o.viewportWidth),s=Math.round(o.viewportHeight),{x:-o.left,y:-o.top,width:a,height:s});return u=(i=f).style||"",i.style=u+"float: left;",f.externalResourcesRequired=!0,'<svg xmlns="http://www.w3.org/2000/svg"'+d((l=r||1,h={width:(c=t).width,height:c.height,"font-size":c.rootFontSize},1!==l&&(h.style="transform:scale("+l+"); transform-origin: 0 0;"),h))+'><style scoped="">html::-webkit-scrollbar { display: none; }</style><foreignObject'+d(f)+">"+n+"</foreignObject></svg>"};return o.getSvgForDocument=function(e,t,r){return n.rewriteTagNameSelectorsToLowerCase(e),a(e,t,r)},o.drawDocumentAsSvg=function(t,r){return["hover","active","focus","target"].forEach(function(e){r[e]&&n.fakeUserAction(t,r[e],e)}),p.calculateDocumentContentSize(t,r).then(function(e){return o.getSvgForDocument(t,e,r.zoom)})},o}(0,i,s,t),u,n))},void 0===(n=this)&&void 0!==window&&(n=window),"object"==typeof t&&t.exports?t.exports=o(e("url"),e("xmlserializer"),e("sane-domparser-error"),e("inlineresources")):n.rasterizeHTML=o(n.url,n.xmlserializer,n.sanedomparsererror,n.inlineresources)},{inlineresources:5,"sane-domparser-error":14,url:15,xmlserializer:17}],2:[function(h,r,n){(function(t){!function(e){"object"==typeof n&&void 0!==r?r.exports=e():("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:this).cssFontFaceSrc=e()}(function(){return function a(s,i,u){function c(r,e){if(!i[r]){if(!s[r]){var t="function"==typeof h&&h;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var o=i[r]={exports:{}};s[r][0].call(o.exports,function(e){var t=s[r][1][e];return c(t||e)},o,o.exports,a,s,i,u)}return i[r].exports}for(var l="function"==typeof h&&h,e=0;e<u.length;e++)c(u[e]);return c}({1:[function(_,e,t){"use strict";function X(e,t,r,n){this.message=e,this.expected=t,this.found=r,this.location=n,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,X)}!function(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}(X,Error),X.buildMessage=function(e,t){var r,a={literal:function(e){return'"'+o(e.text)+'"'},class:function(e){var t,r="";for(t=0;t<e.parts.length;t++)r+=e.parts[t]instanceof Array?s(e.parts[t][0])+"-"+s(e.parts[t][1]):s(e.parts[t]);return"["+(e.inverted?"^":"")+r+"]"},any:function(e){return"any character"},end:function(e){return"end of input"},other:function(e){return e.description}};function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function o(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+n(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+n(e)})}function s(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(e){return"\\x0"+n(e)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(e){return"\\x"+n(e)})}return"Expected "+function(e){var t,r,n,o=new Array(e.length);for(t=0;t<e.length;t++)o[t]=(n=e[t],a[n.type](n));if(o.sort(),0<o.length){for(r=t=1;t<o.length;t++)o[t-1]!==o[t]&&(o[r]=o[t],r++);o.length=r}switch(o.length){case 1:return o[0];case 2:return o[0]+" or "+o[1];default:return o.slice(0,-1).join(", ")+", or "+o[o.length-1]}}(e)+" but "+((r=t)?'"'+o(r)+'"':"end of input")+" found."},e.exports={SyntaxError:X,parse:function(u,e){e=void 0!==e?e:{};var t,c={},r={start:H},n=H,o="",a=function(){return[]},i=",",l=L(",",!1),h=function(e,t){return[e].concat(t)},f=function(e){return[e]},p=function(e,t){return{url:e,format:t}},m=function(e){return{url:e}},s="url(",d=L("url(",!1),g=")",v=L(")",!1),y=function(e){return e},w="format(",x=L("format(",!1),b="local(",C=L("local(",!1),E=function(e){return{local:e}},R=/^[^)]/,A=P([")"],!0,!1),U=function(e){return W.extractValue(e.join(""))},S=/^[ \t\r\n\f]/,T=P([" ","\t","\r","\n","\f"],!1,!1),N=0,j=[{line:1,column:1}],O=0,I=[],D=0;if("startRule"in e){if(!(e.startRule in r))throw new Error("Can't start parsing from rule \""+e.startRule+'".');n=r[e.startRule]}function L(e,t){return{type:"literal",text:e,ignoreCase:t}}function P(e,t,r){return{type:"class",parts:e,inverted:t,ignoreCase:r}}function F(e){var t,r=j[e];if(r)return r;for(t=e-1;!j[t];)t--;for(r={line:(r=j[t]).line,column:r.column};t<e;)10===u.charCodeAt(t)?(r.line++,r.column=1):r.column++,t++;return j[e]=r}function k(e,t){var r=F(e),n=F(t);return{start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:n.line,column:n.column}}}function q(e){N<O||(O<N&&(O=N,I=[]),I.push(e))}function M(e,t,r){return new X(X.buildMessage(e,t),e,t,r)}function H(){var e,t;return(e=function e(){var t,r,n,o,a,s;if(t=N,(r=z())!==c){for(n=[],o=$();o!==c;)n.push(o),o=$();if(n!==c)if(44===u.charCodeAt(N)?(o=i,N++):(o=c,0===D&&q(l)),o!==c){for(a=[],s=$();s!==c;)a.push(s),s=$();a!==c&&(s=e())!==c?(r=h(r,s),t=r):(N=t,t=c)}else N=t,t=c;else N=t,t=c}else N=t,t=c;return t===c&&(t=N,(r=z())!==c&&(r=f(r)),t=r),t}())===c&&(e=N,(t=o)!==c&&(t=a()),e=t),e}function z(){var e,t,r,n,o;return(e=function(){var e,t,r,n,o,a,s,i;if(e=N,(t=V())!==c){if(r=[],(n=$())!==c)for(;n!==c;)r.push(n),n=$();else r=c;r!==c&&(o=N,u.substr(N,7)===w?(a=w,N+=7):(a=c,0===D&&q(x)),a!==c&&(s=B())!==c?(41===u.charCodeAt(N)?(i=g,N++):(i=c,0===D&&q(v)),i!==c?(a=y(s),o=a):(N=o,o=c)):(N=o,o=c),(n=o)!==c)?(t=p(t,n),e=t):(N=e,e=c)}else N=e,e=c;return e===c&&(e=N,(t=V())!==c&&(t=m(t)),e=t),e}())===c&&(t=N,u.substr(N,6)===b?(r=b,N+=6):(r=c,0===D&&q(C)),r!==c&&(n=B())!==c?(41===u.charCodeAt(N)?(o=g,N++):(o=c,0===D&&q(v)),o!==c?(r=E(n),t=r):(N=t,t=c)):(N=t,t=c),e=t),e}function V(){var e,t,r,n;return e=N,u.substr(N,4)===s?(t=s,N+=4):(t=c,0===D&&q(d)),t!==c&&(r=B())!==c?(41===u.charCodeAt(N)?(n=g,N++):(n=c,0===D&&q(v)),n!==c?e=t=y(r):(N=e,e=c)):(N=e,e=c),e}function B(){var e,t;if(N,e=[],R.test(u.charAt(N))?(t=u.charAt(N),N++):(t=c,0===D&&q(A)),t!==c)for(;t!==c;)e.push(t),R.test(u.charAt(N))?(t=u.charAt(N),N++):(t=c,0===D&&q(A));else e=c;return e!==c&&(e=U(e)),e}function $(){var e;return S.test(u.charAt(N))?(e=u.charAt(N),N++):(e=c,0===D&&q(T)),e}var W=_("../util");if((t=n())!==c&&N===u.length)return t;throw t!==c&&N<u.length&&q({type:"end"}),M(I,O<u.length?u.charAt(O):null,O<u.length?k(O,O+1):k(O,O))}}},{"../util":3}],2:[function(e,t,r){var n=e("./grammar");r.SyntaxError=function(e,t){this.message=e,this.offset=t},r.parse=function(e){try{return n.parse(e)}catch(e){throw new r.SyntaxError(e.message,e.offset)}},r.serialize=function(e){return e.map(function(e){var t;return e.url?(t='url("'+e.url+'")',e.format&&(t+=' format("'+e.format+'")')):t='local("'+e.local+'")',t}).join(", ")}},{"./grammar":1}],3:[function(e,t,r){r.extractValue=function(e){return t=e.replace(/^[\t\r\f\n ]*(.+?)[\t\r\f\n ]*$/,"$1"),n=/^'(.*)'$/,(r=/^"(.*)"$/).test(t)?t.replace(r,"$1"):n.test(t)?t.replace(n,"$1"):t;var t,r,n}},{}]},{},[2])(2)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,t,r){"use strict";var n=e("./cssSupport");r.extractCssUrl=function(e){var t,r=/^url\(("[^"]+"|'[^']+'|[^\)]+)\)/;if(!r.test(e))throw new Error("Invalid url");return t=r.exec(e)[1],n.unquoteString(t.replace(/^[\t\r\f\n ]*(.+?)[\t\r\f\n ]*$/,"$1"))};r.parse=function(e){return function(e){var t,o="(url\\(\\s*(?:\"[^\"]*\"|'[^']*'|[^\\(]+)\\s*\\)|[^,\\s]+)",r="(?:\\s*"+o+")+",n=new RegExp(r,"g"),a=[],s=function(e){var t,r=new RegExp(o,"g"),n=[];for(t=r.exec(e);t;)n.push(t[1]),t=r.exec(e);return n};if(e.match(new RegExp("^\\s*((?:\\s*(url\\(\\s*(?:\"[^\"]*\"|'[^']*'|[^\\(]+)\\s*\\)|[^,\\s]+))+)(?:\\s*,\\s*((?:\\s*(url\\(\\s*(?:\"[^\"]*\"|'[^']*'|[^\\(]+)\\s*\\)|[^,\\s]+))+))*\\s*$"))){for(t=n.exec(e);t;)a.push(s(t[0])),t=n.exec(e);return a}return[]}(e).map(function(e){var t=function(e){var t;for(t=0;t<e.length;t++)try{return{url:r.extractCssUrl(e[t]),idx:t}}catch(e){}}(e);return t?{preUrl:e.slice(0,t.idx),url:t.url,postUrl:e.slice(t.idx+1)}:{preUrl:e}})},r.serialize=function(e){return e.map(function(e){var t=[].concat(e.preUrl);return e.url&&t.push('url("'+e.url+'")'),e.postUrl&&(t=t.concat(e.postUrl)),t.join(" ")}).join(", ")}},{"./cssSupport":4}],4:[function(e,t,o){"use strict";o.unquoteString=function(e){var t=/^"(.*)"$/,r=/^'(.*)'$/;return t.test(e)?e.replace(t,"$1"):r.test(e)?e.replace(r,"$1"):e},o.rulesForCssText=function(e){var t,r=document.implementation.createHTMLDocument(""),n=document.createElement("style");return n.textContent=e,r.body.appendChild(n),t=n.sheet.cssRules,Array.prototype.slice.call(t)},o.cssRulesToText=function(e){return e.reduce(function(e,t){return e+t.cssText},"")},o.exchangeRule=function(e,t,r){e[e.indexOf(t)]=o.rulesForCssText(r)[0]},o.changeFontFaceRuleSrc=function(e,t,r){var n="@font-face { font-family: "+t.style.getPropertyValue("font-family")+"; ";t.style.getPropertyValue("font-style")&&(n+="font-style: "+t.style.getPropertyValue("font-style")+"; "),t.style.getPropertyValue("font-weight")&&(n+="font-weight: "+t.style.getPropertyValue("font-weight")+"; "),n+="src: "+r+"}",o.exchangeRule(e,t,n)}},{}],5:[function(e,t,o){"use strict";var u=e("./util"),r=e("./inlineImage"),n=e("./inlineScript"),s=e("./inlineCss"),i=e("./cssSupport"),a=function(n){return n.map(function(e,t){var r;return t===n.length-1&&(e={baseUrl:(r=e.baseUrl,u.joinUrl(r,"."))}),JSON.stringify(e)})},c=function(e,t){return!1!==t.cache&&"none"!==t.cache&&t.cacheBucket?u.memoize(e,a,t.cacheBucket):e},l=function(o,e,t){var a=i.rulesForCssText(o);return s.loadCSSImportsForRules(a,e,t).then(function(n){return s.loadAndInlineCSSResourcesForRules(a,t).then(function(e){var t=n.errors.concat(e.errors),r=n.hasChanges||e.hasChanges;return r&&(o=i.cssRulesToText(a)),{hasChanges:r,content:o,errors:t}})})};o.loadAndInlineStyles=function(e,t){var a,r,n=(r=e.getElementsByTagName("style"),Array.prototype.filter.call(r,function(e){return!e.attributes.type||"text/css"===e.attributes.type.value})),s=[],i=[];return(a=u.clone(t)).baseUrl=a.baseUrl||u.getDocumentBaseUrl(e),Promise.all(n.map(function(e){return(t=e,r=a,n=i,o=t.textContent,c(l,r)(o,n,r).then(function(e){return e.hasChanges&&(t.childNodes[0].nodeValue=e.content),u.cloneArray(e.errors)})).then(function(e){s=s.concat(e)});var t,r,n,o})).then(function(){return s})};var h=function(r,e){return u.ajax(r,e).then(function(e){return{content:e,cssRules:i.rulesForCssText(e)}}).then(function(e){var t=s.adjustPathsOfCssResources(r,e.cssRules);return{content:e.content,cssRules:e.cssRules,hasChanges:t}}).then(function(t){return s.loadCSSImportsForRules(t.cssRules,[],e).then(function(e){return{content:t.content,cssRules:t.cssRules,hasChanges:t.hasChanges||e.hasChanges,errors:e.errors}})}).then(function(t){return s.loadAndInlineCSSResourcesForRules(t.cssRules,e).then(function(e){return{content:t.content,cssRules:t.cssRules,hasChanges:t.hasChanges||e.hasChanges,errors:t.errors.concat(e.errors)}})}).then(function(e){var t=e.content;return e.hasChanges&&(t=i.cssRulesToText(e.cssRules)),{content:t,errors:e.errors}})};o.loadAndInlineCssLinks=function(e,s){var t,r=(t=e.getElementsByTagName("link"),Array.prototype.filter.call(t,function(e){return e.attributes.rel&&"stylesheet"===e.attributes.rel.value&&(!e.attributes.type||"text/css"===e.attributes.type.value)})),i=[];return Promise.all(r.map(function(a){return(e=a,t=s,r=e.attributes.href.value,n=u.getDocumentBaseUrl(e.ownerDocument),o=u.clone(t),!o.baseUrl&&n&&(o.baseUrl=n),c(h,t)(r,o).then(function(e){return{content:e.content,errors:u.cloneArray(e.errors)}})).then(function(e){var t,r,n,o;t=a,r=e.content+"\n",o=t.parentNode,(r=r.trim())&&((n=t.ownerDocument.createElement("style")).type="text/css",n.appendChild(t.ownerDocument.createTextNode(r)),o.insertBefore(n,t)),o.removeChild(t),i=i.concat(e.errors)},function(e){i.push({resourceType:"stylesheet",url:e.url,msg:"Unable to load stylesheet "+e.url})});var e,t,r,n,o})).then(function(){return i})},o.loadAndInlineImages=r.inline,o.loadAndInlineScript=n.inline,o.inlineReferences=function(t,r){var n=[],e=[o.loadAndInlineImages,o.loadAndInlineStyles,o.loadAndInlineCssLinks];return!1!==r.inlineScripts&&e.push(o.loadAndInlineScript),Promise.all(e.map(function(e){return e(t,r).then(function(e){n=n.concat(e)})})).then(function(){return n})}},{"./cssSupport":4,"./inlineCss":6,"./inlineImage":7,"./inlineScript":8,"./util":9}],6:[function(e,t,f){"use strict";var p=e("./util"),m=e("./cssSupport"),c=e("./backgroundValueParser"),i=e("css-font-face-src"),l=function(e,t,r){e.style.setProperty(t,r,e.style.getPropertyPriority(t))},n=function(e){return e.filter(function(e){return e.type===window.CSSRule.STYLE_RULE&&(e.style.getPropertyValue("background-image")||e.style.getPropertyValue("background"))})},h=function(e){var t=[];return e.forEach(function(e){e.style.getPropertyValue("background-image")?t.push({property:"background-image",value:e.style.getPropertyValue("background-image"),rule:e}):e.style.getPropertyValue("background")&&t.push({property:"background",value:e.style.getPropertyValue("background"),rule:e})}),t},u=function(e){return e.filter(function(e){return e.type===window.CSSRule.FONT_FACE_RULE&&e.style.getPropertyValue("src")})},r=function(e){return e.filter(function(e){return e.type===window.CSSRule.IMPORT_RULE&&e.href})},d=function(e){var r=[];return e.forEach(function(e,t){e.url&&!p.isDataUri(e.url)&&r.push(t)}),r},g=function(e){var r=[];return e.forEach(function(e,t){e.url&&!p.isDataUri(e.url)&&r.push(t)}),r};f.adjustPathsOfCssResources=function(o,a){var e=n(a),t=h(e),s=!1;return t.forEach(function(e){var t,n=c.parse(e.value),r=d(n);0<r.length&&(r.forEach(function(e){var t=n[e].url,r=p.joinUrl(o,t);n[e].url=r}),t=c.serialize(n),l(e.rule,e.property,t),s=!0)}),u(a).forEach(function(e){var n,t,r=e.style.getPropertyValue("src");try{n=i.parse(r)}catch(e){return}0<(t=g(n)).length&&(t.forEach(function(e){var t=n[e].url,r=p.joinUrl(o,t);n[e].url=r}),m.changeFontFaceRuleSrc(a,e,i.serialize(n)),s=!0)}),r(a).forEach(function(e){var t=e.href,r=p.joinUrl(o,t);m.exchangeRule(a,e,"@import url("+r+");"),s=!0}),s};var v=function(r,e,t){var n=r.indexOf(e);r.splice(n,1),t.forEach(function(e,t){r.splice(n+t,0,e)})};f.loadCSSImportsForRules=function(i,u,c){var e=r(i),l=[],h=!1;return Promise.all(e.map(function(e){return(r=i,n=e,o=u,a=c,s=n.href,s=m.unquoteString(s),t=p.joinUrl(a.baseUrl,s),0<=o.indexOf(t)?(v(r,n,[]),Promise.resolve([])):(o.push(t),p.ajax(s,a).then(function(e){var t=m.rulesForCssText(e);return f.loadCSSImportsForRules(t,o,a).then(function(e){return f.adjustPathsOfCssResources(s,t),v(r,n,t),e.errors})},function(e){throw{resourceType:"stylesheet",url:e.url,msg:"Unable to load stylesheet "+e.url}}))).then(function(e){l=l.concat(e),h=!0},function(e){l.push(e)});var r,n,o,a,t,s})).then(function(){return{hasChanges:h,errors:l}})};var a=function(e,s){var t=n(e),r=h(t),i=[],u=!1;return Promise.all(r.map(function(t){return(e=t.value,r=s,n=c.parse(e),o=d(n),a=!1,p.collectAndReportErrors(o.map(function(t){var e=n[t].url;return p.getDataURIForImageURL(e,r).then(function(e){n[t].url=e,a=!0},function(e){throw{resourceType:"backgroundImage",url:e.url,msg:"Unable to load background-image "+e.url}})})).then(function(e){return{backgroundValue:c.serialize(n),hasChanges:a,errors:e}})).then(function(e){e.hasChanges&&(l(t.rule,t.property,e.backgroundValue),u=!0),i=i.concat(e.errors)});var e,r,n,o,a})).then(function(){return{hasChanges:u,errors:i}})},s=function(r,e){var t=u(r),n=[],o=!1;return Promise.all(t.map(function(t){return function(e,t){var o,r,a=!1;try{o=i.parse(e)}catch(e){o=[]}return r=g(o),p.collectAndReportErrors(r.map(function(e){var r=o[e],n=r.format||"woff";return p.binaryAjax(r.url,t).then(function(e){var t=btoa(e);r.url="data:font/"+n+";base64,"+t,a=!0},function(e){throw{resourceType:"fontFace",url:e.url,msg:"Unable to load font-face "+e.url}})})).then(function(e){return{srcDeclarationValue:i.serialize(o),hasChanges:a,errors:e}})}(t.style.getPropertyValue("src"),e).then(function(e){e.hasChanges&&(m.changeFontFaceRuleSrc(r,t,e.srcDeclarationValue),o=!0),n=n.concat(e.errors)})})).then(function(){return{hasChanges:o,errors:n}})};f.loadAndInlineCSSResourcesForRules=function(t,r){var n=!1,o=[];return Promise.all([a,s].map(function(e){return e(t,r).then(function(e){n=n||e.hasChanges,o=o.concat(e.errors)})})).then(function(){return{hasChanges:n,errors:o}})}},{"./backgroundValueParser":3,"./cssSupport":4,"./util":9,"css-font-face-src":2}],7:[function(e,t,r){"use strict";var i=e("./util"),u=function(e){return Array.prototype.slice.call(e)};r.inline=function(e,r){var t,n=u(e.getElementsByTagName("img")),o=u(e.getElementsByTagName("image")),a=(t=e.getElementsByTagName("input"),Array.prototype.filter.call(t,function(e){return"image"===e.type}));n=(n=n.concat(o)).concat(a);var s=n.filter(function(e){var t=null;return e.hasAttribute("src")?t=e.getAttribute("src"):e.hasAttributeNS("http://www.w3.org/1999/xlink","href")?t=e.getAttributeNS("http://www.w3.org/1999/xlink","href"):e.hasAttribute("href")&&(t=e.getAttribute("href")),null!==t&&!i.isDataUri(t)});return i.collectAndReportErrors(s.map(function(t){return function(e,t){var r=null;e.hasAttribute("src")?r=e.getAttribute("src"):e.hasAttributeNS("http://www.w3.org/1999/xlink","href")?r=e.getAttributeNS("http://www.w3.org/1999/xlink","href"):e.hasAttribute("href")&&(r=e.getAttribute("href"));var n=i.getDocumentBaseUrl(e.ownerDocument),o=i.clone(t);return!o.baseUrl&&n&&(o.baseUrl=n),i.getDataURIForImageURL(r,o).then(function(e){return e},function(e){throw{resourceType:"image",url:e.url,msg:"Unable to load image "+e.url}})}(t,r).then(function(e){t.attributes.src?t.attributes.src.value=e:t.attributes["xlink:href"]?t.attributes["xlink:href"].value=e:t.attributes.href&&(t.attributes.href.value=e)})}))}},{"./util":9}],8:[function(e,t,r){"use strict";var i=e("./util");r.inline=function(e,s){var t,r=(t=e.getElementsByTagName("script"),Array.prototype.filter.call(t,function(e){return!!e.attributes.src}));return i.collectAndReportErrors(r.map(function(n){return(e=n,t=s,r=e.attributes.src.value,o=i.getDocumentBaseUrl(e.ownerDocument),a=i.clone(t),!a.baseUrl&&o&&(a.baseUrl=o),i.ajax(r,a).catch(function(e){throw{resourceType:"script",url:e.url,msg:"Unable to load script "+e.url}})).then(function(e){var t,r;r=e,(t=n).attributes.removeNamedItem("src"),t.textContent=r.replace(/<\//g,"<\\/")});var e,t,r,o,a}))}},{"./util":9}],9:[function(e,t,l){"use strict";var r=e("url");l.getDocumentBaseUrl=function(e){return"about:blank"!==e.baseURI?e.baseURI:null},l.clone=function(e){var t,r={};for(t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r},l.cloneArray=function(e){return Array.prototype.slice.apply(e,[0])},l.joinUrl=function(e,t){return e?r.resolve(e,t):t},l.isDataUri=function(e){return/^data:/.test(e)},l.collectAndReportErrors=function(e){var t=[];return Promise.all(e.map(function(e){return e.catch(function(e){t.push(e)})})).then(function(){return t})};var h=null;l.ajax=function(u,c){return new Promise(function(e,t){var r,n,o,a=new window.XMLHttpRequest,s=l.joinUrl(c.baseUrl,u),i=function(){t({msg:"Unable to load url",url:s})};n=s,r=!1===(o=c.cache)||"none"===o||"repeated"===o?(null!==h&&"repeated"===o||(h=Date.now()),n+"?_="+h):n,a.addEventListener("load",function(){200===a.status||0===a.status?e(a.response):i()},!1),a.addEventListener("error",i,!1);try{a.open("GET",r,!0),a.overrideMimeType(c.mimeType),a.send(null)}catch(e){i()}})},l.binaryAjax=function(e,t){var r=l.clone(t);return r.mimeType="text/plain; charset=x-user-defined",l.ajax(e,r).then(function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(255&e.charCodeAt(r));return t})};l.getDataURIForImageURL=function(e,t){return l.binaryAjax(e,t).then(function(e){var t,r,n=btoa(e);return"data:"+((r=function(e,t){return e.substring(0,t.length)===t})(t=e,"<?xml")||r(t,"<svg")?"image/svg+xml":"image/png")+";base64,"+n})};var u=[];l.memoize=function(a,s,i){if("object"!=typeof i)throw new Error("cacheBucket is not an object");return function(){var e,t,r=Array.prototype.slice.call(arguments),n=s(r),o=(t=a,u.indexOf(t)<0&&u.push(t),u.indexOf(t));return i[o]&&i[o][n]?i[o][n]:(e=a.apply(null,r),i[o]=i[o]||{},i[o][n]=e)}}},{url:15}],10:[function(e,I,D){(function(O){!function(e){var t="object"==typeof D&&D&&!D.nodeType&&D,r="object"==typeof I&&I&&!I.nodeType&&I,n="object"==typeof O&&O;n.global!==n&&n.window!==n&&n.self!==n||(e=n);var o,a,v=2147483647,y=36,w=1,x=26,s=38,i=700,b=72,C=128,E="-",u=/^xn--/,c=/[^\x20-\x7E]/,l=/[\x2E\u3002\uFF0E\uFF61]/g,h={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=y-w,R=Math.floor,A=String.fromCharCode;function U(e){throw RangeError(h[e])}function p(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function m(e,t){var r=e.split("@"),n="";return 1<r.length&&(n=r[0]+"@",e=r[1]),n+p((e=e.replace(l,".")).split("."),t).join(".")}function S(e){for(var t,r,n=[],o=0,a=e.length;o<a;)55296<=(t=e.charCodeAt(o++))&&t<=56319&&o<a?56320==(64512&(r=e.charCodeAt(o++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),o--):n.push(t);return n}function T(e){return p(e,function(e){var t="";return 65535<e&&(t+=A((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=A(e)}).join("")}function N(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function j(e,t,r){var n=0;for(e=r?R(e/i):e>>1,e+=R(e/t);f*x>>1<e;n+=y)e=R(e/f);return R(n+(f+1)*e/(e+s))}function d(e){var t,r,n,o,a,s,i,u,c,l,h,f=[],p=e.length,m=0,d=C,g=b;for((r=e.lastIndexOf(E))<0&&(r=0),n=0;n<r;++n)128<=e.charCodeAt(n)&&U("not-basic"),f.push(e.charCodeAt(n));for(o=0<r?r+1:0;o<p;){for(a=m,s=1,i=y;p<=o&&U("invalid-input"),h=e.charCodeAt(o++),(y<=(u=h-48<10?h-22:h-65<26?h-65:h-97<26?h-97:y)||u>R((v-m)/s))&&U("overflow"),m+=u*s,!(u<(c=i<=g?w:g+x<=i?x:i-g));i+=y)s>R(v/(l=y-c))&&U("overflow"),s*=l;g=j(m-a,t=f.length+1,0==a),R(m/t)>v-d&&U("overflow"),d+=R(m/t),m%=t,f.splice(m++,0,d)}return T(f)}function g(e){var t,r,n,o,a,s,i,u,c,l,h,f,p,m,d,g=[];for(f=(e=S(e)).length,t=C,a=b,s=r=0;s<f;++s)(h=e[s])<128&&g.push(A(h));for(n=o=g.length,o&&g.push(E);n<f;){for(i=v,s=0;s<f;++s)t<=(h=e[s])&&h<i&&(i=h);for(i-t>R((v-r)/(p=n+1))&&U("overflow"),r+=(i-t)*p,t=i,s=0;s<f;++s)if((h=e[s])<t&&++r>v&&U("overflow"),h==t){for(u=r,c=y;!(u<(l=c<=a?w:a+x<=c?x:c-a));c+=y)d=u-l,m=y-l,g.push(A(N(l+d%m,0))),u=R(d/m);g.push(A(N(u,0))),a=j(r,p,n==o),r=0,++n}++r,++t}return g.join("")}if(o={version:"1.3.2",ucs2:{decode:S,encode:T},decode:d,encode:g,toASCII:function(e){return m(e,function(e){return c.test(e)?"xn--"+g(e):e})},toUnicode:function(e){return m(e,function(e){return u.test(e)?d(e.slice(4).toLowerCase()):e})}},t&&r)if(I.exports==t)r.exports=o;else for(a in o)o.hasOwnProperty(a)&&(t[a]=o[a]);else e.punycode=o}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var i,u,c=e.length;0<s&&s<c&&(c=s);for(var l=0;l<c;++l){var h,f,p,m,d=e[l].replace(a,"%20"),g=d.indexOf(r);0<=g?(h=d.substr(0,g),f=d.substr(g+1)):(h=d,f=""),p=decodeURIComponent(h),m=decodeURIComponent(f),i=o,u=p,Object.prototype.hasOwnProperty.call(i,u)?v(o[p])?o[p].push(m):o[p]=[o[p],m]:o[p]=m}return o};var v=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],12:[function(e,t,r){"use strict";var a=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(r,n,o,e){return n=n||"&",o=o||"=",null===r&&(r=void 0),"object"==typeof r?i(u(r),function(e){var t=encodeURIComponent(a(e))+o;return s(r[e])?i(r[e],function(e){return t+encodeURIComponent(a(e))}).join(n):t+encodeURIComponent(a(r[e]))}).join(n):e?encodeURIComponent(a(e))+o+encodeURIComponent(a(r)):""};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var u=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},{}],13:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode"),r.encode=r.stringify=e("./encode")},{"./decode":11,"./encode":12}],14:[function(e,t,r){"use strict";var s=[new RegExp("^<h3[^>]*>This page contains the following errors:</h3><div[^>]*>(.+?)\n?</div>"),new RegExp("^(.+)\n")],o=function(e){var t,r,n,o,a=(t=e,r=new XMLSerializer,Array.prototype.map.call(t.childNodes,function(e){return r.serializeToString(e)}).join(""));for(n=0;n<s.length;n++)if(o=s[n].exec(a))return o[1]};r.failOnParseError=function(e){return function(e){var t;if(null===e)throw new Error("Parse error");var r,n="parsererror"===(r=e).documentElement.tagName&&"http://www.mozilla.org/newlayout/xml/parsererror.xml"===r.documentElement.namespaceURI?r.documentElement:("xml"===r.documentElement.tagName||"html"===r.documentElement.tagName)&&r.documentElement.childNodes&&0<r.documentElement.childNodes.length&&"parsererror"===r.documentElement.childNodes[0].nodeName?r.documentElement.childNodes[0]:"html"===r.documentElement.tagName&&r.documentElement.childNodes&&0<r.documentElement.childNodes.length&&"body"===r.documentElement.childNodes[0].nodeName&&r.documentElement.childNodes[0].childNodes&&r.documentElement.childNodes[0].childNodes.length&&"parsererror"===r.documentElement.childNodes[0].childNodes[0].nodeName?r.documentElement.childNodes[0].childNodes[0]:void 0;if(void 0!==n)throw t=o(n)||"Parse error",new Error(t)}(e),e}},{}],15:[function(e,t,r){"use strict";var D=e("punycode"),L=e("./util");function S(){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}r.parse=a,r.resolve=function(e,t){return a(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?a(e,!1,!0).resolveObject(t):t},r.format=function(e){L.isString(e)&&(e=a(e));return e instanceof S?e.format():S.prototype.format.call(e)},r.Url=S;var P=/^([a-z0-9.+-]+:)/i,n=/:[0-9]*$/,F=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,o=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),k=["'"].concat(o),q=["%","/","?",";","#"].concat(k),M=["/","?","#"],H=/^[+a-z0-9A-Z_-]{0,63}$/,z=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,V={javascript:!0,"javascript:":!0},B={javascript:!0,"javascript:":!0},$={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},W=e("querystring");function a(e,t,r){if(e&&L.isObject(e)&&e instanceof S)return e;var n=new S;return n.parse(e,t,r),n}S.prototype.parse=function(e,t,r){if(!L.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),o=-1!==n&&n<e.indexOf("#")?"?":"#",a=e.split(o);a[0]=a[0].replace(/\\/g,"/");var s=e=a.join(o);if(s=s.trim(),!r&&1===e.split("#").length){var i=F.exec(s);if(i)return this.path=s,this.href=s,this.pathname=i[1],i[2]?(this.search=i[2],this.query=t?W.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var u=P.exec(s);if(u){var c=(u=u[0]).toLowerCase();this.protocol=c,s=s.substr(u.length)}if(r||u||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var l="//"===s.substr(0,2);!l||u&&B[u]||(s=s.substr(2),this.slashes=!0)}if(!B[u]&&(l||u&&!$[u])){for(var h,f,p=-1,m=0;m<M.length;m++){-1!==(d=s.indexOf(M[m]))&&(-1===p||d<p)&&(p=d)}-1!==(f=-1===p?s.lastIndexOf("@"):s.lastIndexOf("@",p))&&(h=s.slice(0,f),s=s.slice(f+1),this.auth=decodeURIComponent(h)),p=-1;for(m=0;m<q.length;m++){var d;-1!==(d=s.indexOf(q[m]))&&(-1===p||d<p)&&(p=d)}-1===p&&(p=s.length),this.host=s.slice(0,p),s=s.slice(p),this.parseHost(),this.hostname=this.hostname||"";var g="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!g)for(var v=this.hostname.split(/\./),y=(m=0,v.length);m<y;m++){var w=v[m];if(w&&!w.match(H)){for(var x="",b=0,C=w.length;b<C;b++)127<w.charCodeAt(b)?x+="x":x+=w[b];if(!x.match(H)){var E=v.slice(0,m),R=v.slice(m+1),A=w.match(z);A&&(E.push(A[1]),R.unshift(A[2])),R.length&&(s="/"+R.join(".")+s),this.hostname=E.join(".");break}}}255<this.hostname.length?this.hostname="":this.hostname=this.hostname.toLowerCase(),g||(this.hostname=D.toASCII(this.hostname));var U=this.port?":"+this.port:"",S=this.hostname||"";this.host=S+U,this.href+=this.host,g&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!V[c])for(m=0,y=k.length;m<y;m++){var T=k[m];if(-1!==s.indexOf(T)){var N=encodeURIComponent(T);N===T&&(N=escape(T)),s=s.split(T).join(N)}}var j=s.indexOf("#");-1!==j&&(this.hash=s.substr(j),s=s.slice(0,j));var O=s.indexOf("?");if(-1!==O?(this.search=s.substr(O),this.query=s.substr(O+1),t&&(this.query=W.parse(this.query)),s=s.slice(0,O)):t&&(this.search="",this.query={}),s&&(this.pathname=s),$[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){U=this.pathname||"";var I=this.search||"";this.path=U+I}return this.href=this.format(),this},S.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,a="";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&&(a=W.stringify(this.query));var s=this.search||a&&"?"+a||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||$[t])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),t+o+(r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)}))+(s=s.replace("#","%23"))+n},S.prototype.resolve=function(e){return this.resolveObject(a(e,!1,!0)).format()},S.prototype.resolveObject=function(e){if(L.isString(e)){var t=new S;t.parse(e,!1,!0),e=t}for(var r=new S,n=Object.keys(this),o=0;o<n.length;o++){var a=n[o];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),i=0;i<s.length;i++){var u=s[i];"protocol"!==u&&(r[u]=e[u])}return $[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!$[e.protocol]){for(var c=Object.keys(e),l=0;l<c.length;l++){var h=c[l];r[h]=e[h]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||B[e.protocol])r.pathname=e.pathname;else{for(var f=(e.pathname||"").split("/");f.length&&!(e.host=f.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==f[0]&&f.unshift(""),f.length<2&&f.unshift(""),r.pathname=f.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var p=r.pathname||"",m=r.search||"";r.path=p+m}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var d=r.pathname&&"/"===r.pathname.charAt(0),g=e.host||e.pathname&&"/"===e.pathname.charAt(0),v=g||d||r.host&&e.pathname,y=v,w=r.pathname&&r.pathname.split("/")||[],x=(f=e.pathname&&e.pathname.split("/")||[],r.protocol&&!$[r.protocol]);if(x&&(r.hostname="",r.port=null,r.host&&(""===w[0]?w[0]=r.host:w.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===f[0]?f[0]=e.host:f.unshift(e.host)),e.host=null),v=v&&(""===f[0]||""===w[0])),g)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,w=f;else if(f.length)w||(w=[]),w.pop(),w=w.concat(f),r.search=e.search,r.query=e.query;else if(!L.isNullOrUndefined(e.search)){if(x)r.hostname=r.host=w.shift(),(A=!!(r.host&&0<r.host.indexOf("@"))&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift());return r.search=e.search,r.query=e.query,L.isNull(r.pathname)&&L.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!w.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var b=w.slice(-1)[0],C=(r.host||e.host||1<w.length)&&("."===b||".."===b)||""===b,E=0,R=w.length;0<=R;R--)"."===(b=w[R])?w.splice(R,1):".."===b?(w.splice(R,1),E++):E&&(w.splice(R,1),E--);if(!v&&!y)for(;E--;E)w.unshift("..");!v||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),C&&"/"!==w.join("/").substr(-1)&&w.push("");var A,U=""===w[0]||w[0]&&"/"===w[0].charAt(0);x&&(r.hostname=r.host=U?"":w.length?w.shift():"",(A=!!(r.host&&0<r.host.indexOf("@"))&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift()));return(v=v||r.host&&w.length)&&!U&&w.unshift(""),w.length?r.pathname=w.join("/"):(r.pathname=null,r.path=null),L.isNull(r.pathname)&&L.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},S.prototype.parseHost=function(){var e=this.host,t=n.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":16,punycode:10,querystring:13}],16:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],17:[function(e,t,r){var n,o;n=this,o=function(){var a=function(e){var t=e.tagName;return"http://www.w3.org/1999/xhtml"===e.namespaceURI&&(t=t.toLowerCase()),t},s=function(e){return Array.prototype.map.call(e.childNodes,function(e){return t(e)}).join("")},o=function(e,t){var r,n,o="<"+a(e);return o+=(r=e,n=t,0<=Array.prototype.map.call(r.attributes||r.attrs,function(e){return e.name}).indexOf("xmlns")||!n&&r.namespaceURI===r.parentNode.namespaceURI?"":' xmlns="'+r.namespaceURI+'"'),Array.prototype.forEach.call(e.attributes||e.attrs,function(e){var t,r;o+=(r=(t=e).value," "+t.name+'="'+r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")+'"')}),0<e.childNodes.length?(o+=">",o+=s(e),o+="</"+a(e)+">"):o+="/>",o},t=function(e,t){var r,n=t&&t.rootNode;return"#document"===e.nodeName||"#document-fragment"===e.nodeName?s(e):e.tagName?o(e,n):"#text"===e.nodeName?((r=e).nodeValue||r.value||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"#comment"===e.nodeName?"\x3c!--"+e.data.replace(/-/g,"&#45;")+"--\x3e":"#cdata-section"===e.nodeName?"<![CDATA["+e.nodeValue+"]]>":void 0};return{serializeToString:function(e){return t(e,{rootNode:!0}).replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"")}}},"object"==typeof t&&t.exports?t.exports=o():n.xmlserializer=o()},{}]},{},[1])(1)});