inky
Version:
Convert a simple HTML syntax into tables compatible with Foundation for Emails.
2 lines • 293 kB
JavaScript
!function(){function t(e,r,n){function i(a,s){if(!r[a]){if(!e[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=r[a]={exports:{}};e[a][0].call(l.exports,function(t){return i(e[a][1][t]||t)},l,l.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}return t}()({1:[function(t,e,r){var n,i=(t("cheerio"),t("../lib/inky"));if(window.setupInky=function(t,e){function r(e,r){r(null,n.releaseTheKraken(e,t.cheerio))}t=t||{},t.cheerio=i.mergeCheerioOpts(t.cheerio),void 0===n&&(n=new i(t)),e(r)},"undefined"!=typeof window){window.runInky=function(t,e){void 0===e&&(e=t,t={}),window.setupInky(t,function(t){t(e.outerHTML,function(t,r){null===t?e.outerHTML=r:console.log(t)})})};for(var o=document.body.getElementsByTagName("container"),a=0;a<o.length;a++)window.runInky(o[a])}},{"../lib/inky":3,cheerio:10}],2:[function(t,e,r){var n=t("util").format,i=t("cheerio"),o=t("./util/getAttrs");e.exports=function(t){var e=t.html(),r=o(t);switch(t[0].name){case this.components.hLine:var a=["h-line"];return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),n('<table class="%s"><tr><th> </th></tr></table>',a.join(" "));case this.components.columns:return this.makeColumn(t,"columns");case this.components.row:var a=["row"];return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),n('<table %s class="%s"><tbody><tr>%s</tr></tbody></table>‍',r,a.join(" "),e);case this.components.button:var s="",u="";t.attr("target")&&(u=" target="+t.attr("target")),t.attr("href")&&(e=n('<a %s href="%s"%s>%s</a>',r,t.attr("href"),u,e)),(t.hasClass("expand")||t.hasClass("expanded"))&&(e=n("<center>%s</center>",e),s='\n<td class="expander"></td>');var a=["button"];return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),n('<table class="%s"><tbody><tr><td><table><tbody><tr><td>%s</td></tr></tbody></table></td>%s</tr></tbody></table>',a.join(" "),e,s);case this.components.container:var a=["container"];return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),n('<table %s align="center" class="%s"><tbody><tr><td>%s</td></tr></tbody></table>',r,a.join(" "),e);case this.components.inky:return'<tr><td><img src="https://raw.githubusercontent.com/arvida/emoji-cheat-sheet.com/master/public/graphics/emojis/octopus.png" /></tr></td>';case this.components.blockGrid:var a=["block-grid","up-"+t.attr("up")];return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),n('<table class="%s"><tbody><tr>%s</tr></tbody></table>',a.join(" "),e);case this.components.menu:var a=["menu"];return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),n('<table %s class="%s"><tbody><tr><td><table><tbody><tr>%s</tr></tbody></table></td></tr></tbody></table>',r,a.join(" "),e);case this.components.menuItem:var u="";t.attr("target")&&(u=" target="+t.attr("target"));var a=["menu-item"];return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),n('<th %s class="%s"><a href="%s"%s>%s</a></th>',r,a.join(" "),t.attr("href"),u,e);case this.components.center:return t.children().length>0&&(t.children().each(function(){i(this).attr("align","center"),i(this).addClass("float-center")}),t.find("item, .menu-item").addClass("float-center")),t.attr("data-parsed",""),n("%s",i.html(t,this.cheerioOpts));case this.components.callout:var a=["callout-inner"];return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),n('<table %s class="callout"><tbody><tr><th class="%s">%s</th><th class="expander"></th></tr></tbody></table>',r,a.join(" "),e);case this.components.spacer:var c,a=["spacer"],l="";return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),t.attr("size-sm")||t.attr("size-lg")?(t.attr("size-sm")&&(c=t.attr("size-sm"),l+=n('<table %s class="%s hide-for-large"><tbody><tr><td height="'+c+'" style="font-size:'+c+"px;line-height:"+c+'px;"> </td></tr></tbody></table>',r)),t.attr("size-lg")&&(c=t.attr("size-lg"),l+=n('<table %s class="%s show-for-large"><tbody><tr><td height="'+c+'" style="font-size:'+c+"px;line-height:"+c+'px;"> </td></tr></tbody></table>',r))):(c=t.attr("size")||16,l+=n('<table %s class="%s"><tbody><tr><td height="'+c+'" style="font-size:'+c+"px;line-height:"+c+'px;"> </td></tr></tbody></table>',r)),t.attr("size-sm")&&t.attr("size-lg")?n(l,a.join(" "),a.join(" "),e):n(l,a.join(" "),e);case this.components.wrapper:var a=["wrapper"];return t.attr("class")&&(a=a.concat(t.attr("class").split(" "))),n('<table %s class="%s" align="center"><tbody><tr><td class="wrapper-inner">%s</td></tr></tbody></table>',r,a.join(" "),e);default:return n("<tr><td>%s</td></tr>",i.html(t,this.cheerioOpts))}}},{"./util/getAttrs":5,cheerio:10,util:106}],3:[function(t,e,r){function n(t){t=t||{},this.cheerioOpts=t.cheerio,this.components=i({button:"button",row:"row",columns:"columns",container:"container",callout:"callout",inky:"inky",blockGrid:"block-grid",menu:"menu",menuItem:"item",center:"center",spacer:"spacer",wrapper:"wrapper",hLine:"h-line"},t.components||{}),this.columnCount=t.columnCount||12,this.componentTags=o(this.components)}var i=t("util")._extend,o=t("object-values"),a=t("cheerio");e.exports=n,n.prototype.releaseTheKraken=function(t,e){"string"!=typeof t&&(t=t.html());for(var r=n.extractRaws(t),i=r[0],o=r[1],s=a.load(o,n.mergeCheerioOpts(e)),u=this.componentTags.map(function(t){return"center"==t?t+":not([data-parsed])":t}).join(", ");s(u).length>0;){var c=s(u).eq(0),l=this.componentFactory(c);c.replaceWith(l)}return s("[data-parsed]").removeAttr("data-parsed"),o=s.html(),n.reInjectRaws(o,i)},n.mergeCheerioOpts=function(t){return t=t||{},void 0===t.decodeEntities&&(t.decodeEntities=!1),t},n.extractRaws=function(t){for(var e,r=[],n=0,i=t,o=/\< *raw *\>(.*?)\<\/ *raw *\>/i;e=i.match(o);)r[n]=e[1],i=i.replace(o,"###RAW"+n+"###"),n+=1;return[r,i]},n.reInjectRaws=function(t,e){var r=t;for(var n in e)r=r.replace("###RAW"+n+"###",e[n]);return r},n.prototype.componentFactory=t("./componentFactory"),n.prototype.makeColumn=t("./makeColumn")},{"./componentFactory":2,"./makeColumn":4,cheerio:10,"object-values":83,util:106}],4:[function(t,e,r){var n=t("util").format,i=t("cheerio"),o=t("./util/getAttrs");e.exports=function(t){var e="",r=i(t).html(),a=[],s="",u=o(t),c=i(t).siblings().length+1;i(t).attr("class")&&(a=a.concat(i(t).attr("class").split(" ")));var l=i(t).attr("small")||this.columnCount,f=i(t).attr("large")||i(t).attr("small")||Math.floor(this.columnCount/c),h=i(t).attr("no-expander");return a.push(n("small-%s",l)),a.push(n("large-%s",f)),a.push("columns"),i(t).prev(this.components.columns).length||a.push("first"),i(t).next(this.components.columns).length||a.push("last"),f!=this.columnCount||0!==t.find(".row, row").length||void 0!=h&&"false"!=h||(s='\n<th class="expander"></th>'),e='<th class="%s" %s><table><tbody><tr><th>%s</th>%s</tr></tbody></table></th>',n(e,a.join(" "),u,r,s)}},{"./util/getAttrs":5,cheerio:10,util:106}],5:[function(t,e,r){e.exports=function(t){var e=t.attr(),r=["class","id","href","size","size-sm","size-lg","large","no-expander","small","target"],n="";for(var i in e)-1==r.indexOf(i)&&(n+=" "+i+'="'+e[i]+'"');return n}},{}],6:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function i(t){var e=n(t),r=e[0],i=e[1];return 3*(r+i)/4-i}function o(t,e,r){return 3*(e+r)/4-r}function a(t){var e,r,i=n(t),a=i[0],s=i[1],u=new h(o(t,a,s)),c=0,l=s>0?a-4:a;for(r=0;r<l;r+=4)e=f[t.charCodeAt(r)]<<18|f[t.charCodeAt(r+1)]<<12|f[t.charCodeAt(r+2)]<<6|f[t.charCodeAt(r+3)],u[c++]=e>>16&255,u[c++]=e>>8&255,u[c++]=255&e;return 2===s&&(e=f[t.charCodeAt(r)]<<2|f[t.charCodeAt(r+1)]>>4,u[c++]=255&e),1===s&&(e=f[t.charCodeAt(r)]<<10|f[t.charCodeAt(r+1)]<<4|f[t.charCodeAt(r+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e),u}function s(t){return l[t>>18&63]+l[t>>12&63]+l[t>>6&63]+l[63&t]}function u(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(s(n));return i.join("")}function c(t){for(var e,r=t.length,n=r%3,i=[],o=0,a=r-n;o<a;o+=16383)i.push(u(t,o,o+16383>a?a:o+16383));return 1===n?(e=t[r-1],i.push(l[e>>2]+l[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(l[e>>10]+l[e>>4&63]+l[e<<2&63]+"=")),i.join("")}r.byteLength=i,r.toByteArray=a,r.fromByteArray=c;for(var l=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,g=p.length;d<g;++d)l[d]=p[d],f[p.charCodeAt(d)]=d;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},{}],7:[function(t,e,r){e.exports={trueFunc:function(){return!0},falseFunc:function(){return!1}}},{}],8:[function(t,e,r){},{}],9:[function(t,e,r){(function(e,n){"use strict";function i(){return n.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(i()<e)throw new RangeError("Invalid typed array length");return n.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=n.prototype):(null===t&&(t=new n(e)),t.length=e),t}function n(t,e,r){if(!(n.TYPED_ARRAY_SUPPORT||this instanceof n))return new n(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return a(this,t,e,r)}function a(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?h(t,e,r,n):"string"==typeof e?l(t,e,r):p(t,e)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function u(t,e,r,n){return s(e),e<=0?o(t,e):void 0!==r?"string"==typeof n?o(t,e).fill(r,n):o(t,e).fill(r):o(t,e)}function c(t,e){if(s(e),t=o(t,e<0?0:0|d(e)),!n.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!n.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var i=0|m(e,r);t=o(t,i);var a=t.write(e,r);return a!==i&&(t=t.slice(0,a)),t}function f(t,e){var r=e.length<0?0:0|d(e.length);t=o(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function h(t,e,r,i){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,r):new Uint8Array(e,r,i),n.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=n.prototype):t=f(t,e),t}function p(t,e){if(n.isBuffer(e)){var r=0|d(e.length);return t=o(t,r),0===t.length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||X(e.length)?o(t,0):f(t,e);if("Buffer"===e.type&&K(e.data))return f(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function d(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),n.alloc(+t)}function m(t,e){if(n.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(i)return V(t).length;e=(""+e).toLowerCase(),i=!0}}function b(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return D(this,e,r);case"utf8":case"utf-8":return q(this,e,r);case"ascii":return j(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function _(t,e,r,i,o){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=n.from(e,i)),n.isBuffer(e))return 0===e.length?-1:y(t,e,r,i,o);if("number"==typeof e)return e&=255,n.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,i,o);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){function o(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}var c;if(i){var l=-1;for(c=r;c<s;c++)if(o(t,c)===o(e,-1===l?0:c-l)){if(-1===l&&(l=c),c-l+1===u)return l*a}else-1!==l&&(c-=c-l),l=-1}else for(r+u>s&&(r=s-u),c=r;c>=0;c--){for(var f=!0,h=0;h<u;h++)if(o(t,c+h)!==o(e,h)){f=!1;break}if(f)return c}return-1}function w(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a<n;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[r+a]=s}return a}function x(t,e,r,n){return $(V(e,t.length-r),t,r,n)}function S(t,e,r,n){return $(G(e),t,r,n)}function E(t,e,r,n){return S(t,e,r,n)}function A(t,e,r,n){return $(Y(e),t,r,n)}function k(t,e,r,n){return $(W(e,t.length-r),t,r,n)}function T(t,e,r){return 0===e&&r===t.length?Z.fromByteArray(t):Z.fromByteArray(t.slice(e,r))}function q(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o=t[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s<=r){var u,c,l,f;switch(s){case 1:o<128&&(a=o);break;case 2:u=t[i+1],128==(192&u)&&(f=(31&o)<<6|63&u)>127&&(a=f);break;case 3:u=t[i+1],c=t[i+2],128==(192&u)&&128==(192&c)&&(f=(15&o)<<12|(63&u)<<6|63&c)>2047&&(f<55296||f>57343)&&(a=f);break;case 4:u=t[i+1],c=t[i+2],l=t[i+3],128==(192&u)&&128==(192&c)&&128==(192&l)&&(f=(15&o)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&f<1114112&&(a=f)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=s}return L(n)}function L(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Q));return r}function j(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function C(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function D(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=F(t[o]);return i}function R(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function O(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,i,o,a){if(!n.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<a)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}function B(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function M(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function I(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(t,e,r,n,i){return i||I(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(t,e,r,n,23,4),r+4}function P(t,e,r,n,i){return i||I(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(t,e,r,n,52,8),r+8}function z(t){if(t=H(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function H(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;a<n;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function W(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function Y(t){return Z.toByteArray(z(t))}function $(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function X(t){return t!==t}var Z=t("base64-js"),J=t("ieee754"),K=t("isarray");r.Buffer=n,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,n.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=i(),n.poolSize=8192,n._augment=function(t){return t.__proto__=n.prototype,t},n.from=function(t,e,r){return a(null,t,e,r)},n.TYPED_ARRAY_SUPPORT&&(n.prototype.__proto__=Uint8Array.prototype,n.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&n[Symbol.species]===n&&Object.defineProperty(n,Symbol.species,{value:null,configurable:!0})),n.alloc=function(t,e,r){return u(null,t,e,r)},n.allocUnsafe=function(t){return c(null,t)},n.allocUnsafeSlow=function(t){return c(null,t)},n.isBuffer=function(t){return!(null==t||!t._isBuffer)},n.compare=function(t,e){if(!n.isBuffer(t)||!n.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,a=Math.min(r,i);o<a;++o)if(t[o]!==e[o]){r=t[o],i=e[o];break}return r<i?-1:i<r?1:0},n.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},n.concat=function(t,e){if(!K(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return n.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var i=n.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var a=t[r];if(!n.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(i,o),o+=a.length}return i},n.byteLength=m,n.prototype._isBuffer=!0,n.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},n.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},n.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},n.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?q(this,0,t):b.apply(this,arguments)},n.prototype.equals=function(t){if(!n.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===n.compare(this,t)},n.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},n.prototype.compare=function(t,e,r,i,o){if(!n.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),e<0||r>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=r)return 0;if(i>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var a=o-i,s=r-e,u=Math.min(a,s),c=this.slice(i,o),l=t.slice(e,r),f=0;f<u;++f)if(c[f]!==l[f]){a=c[f],s=l[f];break}return a<s?-1:s<a?1:0},n.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},n.prototype.indexOf=function(t,e,r){return _(this,t,e,r,!0)},n.prototype.lastIndexOf=function(t,e,r){return _(this,t,e,r,!1)},n.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return x(this,t,e,r);case"ascii":return S(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;n.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var i;if(n.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=n.prototype;else{var o=e-t;i=new n(o,void 0);for(var a=0;a<o;++a)i[a]=this[a+t]}return i},n.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},n.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},n.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},n.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},n.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},n.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},n.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},n.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},n.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},n.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},n.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},n.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},n.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),J.read(this,t,!0,23,4)},n.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),J.read(this,t,!1,23,4)},n.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),J.read(this,t,!0,52,8)},n.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),J.read(this,t,!1,52,8)},n.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},n.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e|=0,r|=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},n.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),n.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},n.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},n.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},n.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):M(this,t,e,!0),e+4},n.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},n.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<r&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},n.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);N(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},n.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),n.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},n.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},n.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},n.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),n.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):M(this,t,e,!0),e+4},n.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),n.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},n.prototype.writeFloatLE=function(t,e,r){return U(this,t,e,!0,r)},n.prototype.writeFloatBE=function(t,e,r){return U(this,t,e,!1,r)},n.prototype.writeDoubleLE=function(t,e,r){return P(this,t,e,!0,r)},n.prototype.writeDoubleBE=function(t,e,r){return P(this,t,e,!1,r)},n.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o,a=i-r;if(this===t&&r<e&&e<i)for(o=a-1;o>=0;--o)t[o+e]=this[o+r];else if(a<1e3||!n.TYPED_ARRAY_SUPPORT)for(o=0;o<a;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),e);return a},n.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!n.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a<r;++a)this[a]=t;else{var s=n.isBuffer(t)?t:V(new n(t,i).toString()),u=s.length;for(a=0;a<r-e;++a)this[a+e]=s[a%u]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"base64-js":6,buffer:9,ieee754:75,isarray:78}],10:[function(t,e,r){r=e.exports=t("./lib/cheerio"),r.version=t("./package").version},{"./lib/cheerio":16,"./package":20}],11:[function(t,e,r){var n=t("lodash"),i=t("../static"),o=t("../utils"),a=o.isTag,s=o.domEach,u=Object.prototype.hasOwnProperty,c=o.camelCase,l=o.cssCase,f=/\s+/,h={null:null,true:!0,false:!1},p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,d=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,g=function(t,e){if(t&&a(t))return t.attribs||(t.attribs={}),e?u.call(t.attribs,e)?p.test(e)?e:t.attribs[e]:"option"===t.name&&"value"===e?i.text(t.children):void 0:t.attribs},m=function(t,e,r){null===r?w(t,e):t.attribs[e]=r+""};r.attr=function(t,e){return"object"==typeof t||void 0!==e?"function"==typeof e?s(this,function(r,n){m(n,t,e.call(n,r,n.attribs[t]))}):s(this,function(r,i){a(i)&&("object"==typeof t?n.each(t,function(t,e){m(i,e,t)}):m(i,t,e))}):g(this[0],t)};var b=function(t,e){return t.hasOwnProperty(e)?t[e]:p.test(e)?void 0!==g(t,e):g(t,e)},v=function(t,e,r){t[e]=p.test(e)?!!r:r};r.prop=function(t,e){var r,i=0;if("string"==typeof t&&void 0===e){switch(t){case"style":r=this.css(),n.each(r,function(t,e){r[i++]=e}),r.length=i;break;case"tagName":case"nodeName":r=this[0].name.toUpperCase();break;default:r=b(this[0],t)}return r}if("object"==typeof t||void 0!==e)return"function"==typeof e?s(this,function(r,n){v(n,t,e.call(n,r,b(n,t)))}):s(this,function(r,i){a(i)&&("object"==typeof t?n.each(t,function(t,e){v(i,e,t)}):v(i,t,e))})};var _=function(t,e,r){if(t.data||(t.data={}),"object"==typeof e)return n.extend(t.data,e);"string"==typeof e&&void 0!==r?t.data[e]=r:"object"==typeof e&&n.exend(t.data,e)},y=function(t,e){var r,n,i,o,a,s,f,p=1===arguments.length;for(p?(r=Object.keys(t.attribs).filter(function(t){return"data-"===t.slice(0,"data-".length)}),i=r.map(function(t){return c(t.slice("data-".length))})):(r=["data-"+l(e)],i=[e]),s=0,f=r.length;s<f;++s)if(n=r[s],o=i[s],u.call(t.attribs,n)){if(a=t.attribs[n],u.call(h,a))a=h[a];else if(a===String(Number(a)))a=Number(a);else if(d.test(a))try{a=JSON.parse(a)}catch(t){}t.data[o]=a}return p?t.data:a};r.data=function(t,e){var r=this[0];if(r&&a(r))return r.data||(r.data={}),t?"object"==typeof t||void 0!==e?(s(this,function(r,n){_(n,t,e)}),this):u.call(r.data,t)?r.data[t]:y(r,t):y(r)},r.val=function(t){var e=0===arguments.length,r=this[0];if(r)switch(r.name){case"textarea":return this.text(t);case"input":switch(this.attr("type")){case"radio":return e?this.attr("value"):(this.attr("value",t),this);default:return this.attr("value",t)}return;case"select":var n,i=this.find("option:selected");if(void 0===i)return;if(!e){if(!this.attr().hasOwnProperty("multiple")&&"object"==typeof t)return this;"object"!=typeof t&&(t=[t]),this.find("option").removeAttr("selected");for(var o=0;o<t.length;o++)this.find('option[value="'+t[o]+'"]').attr("selected","");return this}return n=i.attr("value"),this.attr().hasOwnProperty("multiple")&&(n=[],s(i,function(t,e){n.push(g(e,"value"))})),n;case"option":return e?this.attr("value"):(this.attr("value",t),this)}};var w=function(t,e){
t.attribs&&u.call(t.attribs,e)&&delete t.attribs[e]};r.removeAttr=function(t){return s(this,function(e,r){w(r,t)}),this},r.hasClass=function(t){return n.some(this,function(e){var r,n=e.attribs,i=n&&n.class,o=-1;if(i)for(;(o=i.indexOf(t,o+1))>-1;)if(r=o+t.length,(0===o||f.test(i[o-1]))&&(r===i.length||f.test(i[r])))return!0})},r.addClass=function(t){if("function"==typeof t)return s(this,function(e,n){var i=n.attribs.class||"";r.addClass.call([n],t.call(n,e,i))});if(!t||"string"!=typeof t)return this;for(var e=t.split(f),n=this.length,i=0;i<n;i++)if(a(this[i])){var o,u,c=g(this[i],"class");if(c){u=" "+c+" ",o=e.length;for(var l=0;l<o;l++){var h=e[l]+" ";u.indexOf(" "+h)<0&&(u+=h)}m(this[i],"class",u.trim())}else m(this[i],"class",e.join(" ").trim())}return this};var x=function(t){return t?t.trim().split(f):[]};r.removeClass=function(t){var e,n,i;return"function"==typeof t?s(this,function(e,n){r.removeClass.call([n],t.call(n,e,n.attribs.class||""))}):(e=x(t),n=e.length,i=0===arguments.length,s(this,function(t,r){if(a(r))if(i)r.attribs.class="";else{for(var o,s,u=x(r.attribs.class),c=0;c<n;c++)(o=u.indexOf(e[c]))>=0&&(u.splice(o,1),s=!0,c--);s&&(r.attribs.class=u.join(" "))}}))},r.toggleClass=function(t,e){if("function"==typeof t)return s(this,function(n,i){r.toggleClass.call([i],t.call(i,n,i.attribs.class||"",e),e)});if(!t||"string"!=typeof t)return this;for(var n,i,o=t.split(f),u=o.length,c="boolean"==typeof e?e?1:-1:0,l=this.length,h=0;h<l;h++)if(a(this[h])){n=x(this[h].attribs.class);for(var p=0;p<u;p++)i=n.indexOf(o[p]),c>=0&&i<0?n.push(o[p]):c<=0&&i>=0&&n.splice(i,1);this[h].attribs.class=n.join(" ")}return this},r.is=function(t){return!!t&&this.filter(t).length>0}},{"../static":18,"../utils":19,lodash:79}],12:[function(t,e,r){function n(t,e,r,a){if("string"==typeof e){var s=i(t);"function"==typeof r&&(r=r.call(t,a,s[e])),""===r?delete s[e]:null!=r&&(s[e]=r),t.attribs.style=o(s)}else"object"==typeof e&&Object.keys(e).forEach(function(r){n(t,r,e[r])})}function i(t,e){var r=a(t.attribs.style);return"string"==typeof e?r[e]:Array.isArray(e)?s.pick(r,e):r}function o(t){return Object.keys(t||{}).reduce(function(e,r){return e+=(e?" ":"")+r+": "+t[r]+";"},"")}function a(t){return t=(t||"").trim(),t?t.split(";").reduce(function(t,e){var r=e.indexOf(":");return r<1||r===e.length-1?t:(t[e.slice(0,r).trim()]=e.slice(r+1).trim(),t)},{}):{}}var s=t("lodash"),u=t("../utils").domEach,c=Object.prototype.toString;r.css=function(t,e){return 2===arguments.length||"[object Object]"===c.call(t)?u(this,function(r,i){n(i,t,e,r)}):i(this[0],t)}},{"../utils":19,lodash:79}],13:[function(t,e,r){var n=t("lodash"),i=/\r?\n/g;r.serializeArray=function(){var t=this.constructor;return this.map(function(){var e=this,r=t(e);return"form"===e.name?r.find("input,select,textarea,keygen").toArray():r.filter("input,select,textarea,keygen").toArray()}).filter('[name!=""]:not(:disabled):not(:submit, :button, :image, :reset, :file):matches([checked], :not(:checkbox, :radio))').map(function(e,r){var o=t(r),a=o.attr("name"),s=o.val();return null==s?null:Array.isArray(s)?n.map(s,function(t){return{name:a,value:t.replace(i,"\r\n")}}):{name:a,value:s.replace(i,"\r\n")}}).get()}},{lodash:79}],14:[function(t,e,r){var n=t("lodash"),i=t("../parse"),o=t("../static"),a=i.update,s=i.evaluate,u=t("../utils"),c=u.domEach,l=u.cloneDom,f=u.isHtml,h=Array.prototype.slice;r._makeDomArray=function(t,e){return null==t?[]:t.cheerio?e?l(t.get(),t.options):t.get():Array.isArray(t)?n.flatten(t.map(function(t){return this._makeDomArray(t,e)},this)):"string"==typeof t?s(t,this.options):e?l([t]):[t]};var p=function(t){return function(){var e=h.call(arguments),r=this.length-1;return c(this,function(n,i){var a,s;s="function"==typeof e[0]?e[0].call(i,n,o.html(i.children)):e,a=this._makeDomArray(s,n<r),t(a,i.children,i)})}},d=function(t,e,r,n,i){var o,a,s,u,c,l=[e,r].concat(n),f=t[e-1]||null,h=t[e]||null;for(o=0,a=n.length;o<a;++o)u=n[o],c=u.parent||u.root,s=c&&c.children.indexOf(n[o]),c&&s>-1&&(c.children.splice(s,1),i===c&&e>s&&l[0]--),u.root=null,u.parent=i,u.prev&&(u.prev.next=u.next||null),u.next&&(u.next.prev=u.prev||null),u.prev=n[o-1]||f,u.next=n[o+1]||h;return f&&(f.next=n[0]),h&&(h.prev=n[n.length-1]),t.splice.apply(t,l)};r.appendTo=function(t){return t.cheerio||(t=this.constructor.call(this.constructor,t,null,this._originalRoot)),t.append(this),this},r.prependTo=function(t){return t.cheerio||(t=this.constructor.call(this.constructor,t,null,this._originalRoot)),t.prepend(this),this},r.append=p(function(t,e,r){d(e,e.length,0,t,r)}),r.prepend=p(function(t,e,r){d(e,0,0,t,r)}),r.wrap=function(t){var e="function"==typeof t&&t,r=this.length-1;return n.forEach(this,n.bind(function(n,i){var o,s,u=n.parent||n.root,c=u.children;u&&(e&&(t=e.call(n,i)),"string"!=typeof t||f(t)||(t=this.parents().last().find(t).clone()),o=this._makeDomArray(t,i<r).slice(0,1),s=c.indexOf(n),a([n],o[0]),d(c,s,0,o,u))},this)),this},r.after=function(){var t=h.call(arguments),e=this.length-1;return c(this,function(r,n){var i=n.parent||n.root;if(i){var a,s,u=i.children,c=u.indexOf(n);c<0||(a="function"==typeof t[0]?t[0].call(n,r,o.html(n.children)):t,s=this._makeDomArray(a,r<e),d(u,c+1,0,s,i))}}),this},r.insertAfter=function(t){var e=[],r=this;return"string"==typeof t&&(t=this.constructor.call(this.constructor,t,null,this._originalRoot)),t=this._makeDomArray(t),r.remove(),c(t,function(t,n){var i=r._makeDomArray(r.clone()),o=n.parent||n.root;if(o){var a=o.children,s=a.indexOf(n);s<0||(d(a,s+1,0,i,o),e.push(i))}}),this.constructor.call(this.constructor,this._makeDomArray(e))},r.before=function(){var t=h.call(arguments),e=this.length-1;return c(this,function(r,n){var i=n.parent||n.root;if(i){var a,s,u=i.children,c=u.indexOf(n);c<0||(a="function"==typeof t[0]?t[0].call(n,r,o.html(n.children)):t,s=this._makeDomArray(a,r<e),d(u,c,0,s,i))}}),this},r.insertBefore=function(t){var e=[],r=this;return"string"==typeof t&&(t=this.constructor.call(this.constructor,t,null,this._originalRoot)),t=this._makeDomArray(t),r.remove(),c(t,function(t,n){var i=r._makeDomArray(r.clone()),o=n.parent||n.root;if(o){var a=o.children,s=a.indexOf(n);s<0||(d(a,s,0,i,o),e.push(i))}}),this.constructor.call(this.constructor,this._makeDomArray(e))},r.remove=function(t){var e=this;return t&&(e=e.filter(t)),c(e,function(t,e){var r=e.parent||e.root;if(r){var n=r.children,i=n.indexOf(e);i<0||(n.splice(i,1),e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e.prev=e.next=e.parent=e.root=null)}}),this},r.replaceWith=function(t){var e=this;return c(this,function(r,n){var i=n.parent||n.root;if(i){var o,s=i.children,u=e._makeDomArray("function"==typeof t?t.call(n,r,n):t);a(u,null),o=s.indexOf(n),d(s,o,1,u,i),n.parent=n.prev=n.next=n.root=null}}),this},r.empty=function(){return c(this,function(t,e){n.each(e.children,function(t){t.next=t.prev=t.parent=null}),e.children.length=0}),this},r.html=function(t){if(void 0===t)return this[0]&&this[0].children?o.html(this[0].children,this.options):null;var e=this.options;return c(this,function(r,i){n.each(i.children,function(t){t.next=t.prev=t.parent=null});var o=t.cheerio?t.clone().get():s(""+t,e);a(o,i)}),this},r.toString=function(){return o.html(this,this.options)},r.text=function(t){return void 0===t?o.text(this):"function"==typeof t?c(this,function(e,n){var i=[n];return r.text.call(i,t.call(n,e,o.text(i)))}):(c(this,function(e,r){n.each(r.children,function(t){t.next=t.prev=t.parent=null}),a({data:""+t,type:"text",parent:r,prev:null,next:null,children:[]},r)}),this)},r.clone=function(){return this._make(l(this.get(),this.options))}},{"../parse":17,"../static":18,"../utils":19,lodash:79}],15:[function(t,e,r){function n(t,e,n,i){for(var o=[];e&&o.length<i;)n&&!r.filter.call([e],n,t).length||o.push(e),e=e.parent;return o}var i=t("lodash"),o=t("css-select"),a=t("../utils"),s=a.domEach,u=t("htmlparser2").DomUtils.uniqueSort,c=a.isTag;r.find=function(t){var e,r=i.reduce(this,function(t,e){return t.concat(i.filter(e.children,c))},[]),n=this.constructor.contains;if(t&&"string"!=typeof t)return e=t.cheerio?t.get():[t],this._make(e.filter(function(t){var e,r;for(e=0,r=this.length;e<r;++e)if(n(this[e],t))return!0},this));var a={__proto__:this.options,context:this.toArray()};return this._make(o(t,r,a))},r.parent=function(t){var e=[];return s(this,function(t,r){var n=r.parent;n&&e.indexOf(n)<0&&e.push(n)}),arguments.length&&(e=r.filter.call(e,t,this)),this._make(e)},r.parents=function(t){var e=[];return this.get().reverse().forEach(function(r){n(this,r.parent,t,1/0).forEach(function(t){-1===e.indexOf(t)&&e.push(t)})},this),this._make(e)},r.parentsUntil=function(t,e){var r,n,i=[];return"string"==typeof t?r=o(t,this.parents().toArray(),this.options)[0]:t&&t.cheerio?n=t.toArray():t&&(r=t),this.toArray().reverse().forEach(function(t){for(;(t=t.parent)&&(r&&t!==r||n&&-1===n.indexOf(t)||!r&&!n);)c(t)&&-1===i.indexOf(t)&&i.push(t)},this),this._make(e?o(e,i,this.options):i)},r.closest=function(t){var e=[];return t?(s(this,function(r,i){var o=n(this,i,t,1)[0];o&&e.indexOf(o)<0&&e.push(o)}.bind(this)),this._make(e)):this._make(e)},r.next=function(t){if(!this[0])return this;var e=[];return i.forEach(this,function(t){for(;t=t.next;)if(c(t))return void e.push(t)}),t?r.filter.call(e,t,this):this._make(e)},r.nextAll=function(t){if(!this[0])return this;var e=[];return i.forEach(this,function(t){for(;t=t.next;)c(t)&&-1===e.indexOf(t)&&e.push(t)}),t?r.filter.call(e,t,this):this._make(e)},r.nextUntil=function(t,e){if(!this[0])return this;var n,a,s=[];return"string"==typeof t?n=o(t,this.nextAll().get(),this.options)[0]:t&&t.cheerio?a=t.get():t&&(n=t),i.forEach(this,function(t){for(;(t=t.next)&&(n&&t!==n||a&&-1===a.indexOf(t)||!n&&!a);)c(t)&&-1===s.indexOf(t)&&s.push(t)}),e?r.filter.call(s,e,this):this._make(s)},r.prev=function(t){if(!this[0])return this;var e=[];return i.forEach(this,function(t){for(;t=t.prev;)if(c(t))return void e.push(t)}),t?r.filter.call(e,t,this):this._make(e)},r.prevAll=function(t){if(!this[0])return this;var e=[];return i.forEach(this,function(t){for(;t=t.prev;)c(t)&&-1===e.indexOf(t)&&e.push(t)}),t?r.filter.call(e,t,this):this._make(e)},r.prevUntil=function(t,e){if(!this[0])return this;var n,a,s=[];return"string"==typeof t?n=o(t,this.prevAll().get(),this.options)[0]:t&&t.cheerio?a=t.get():t&&(n=t),i.forEach(this,function(t){for(;(t=t.prev)&&(n&&t!==n||a&&-1===a.indexOf(t)||!n&&!a);)c(t)&&-1===s.indexOf(t)&&s.push(t)}),e?r.filter.call(s,e,this):this._make(s)},r.siblings=function(t){var e=this.parent(),n=i.filter(e?e.children():this.siblingsAndMe(),i.bind(function(t){return c(t)&&!this.is(t)},this));return void 0!==t?r.filter.call(n,t,this):this._make(n)},r.children=function(t){var e=i.reduce(this,function(t,e){return t.concat(i.filter(e.children,c))},[]);return void 0===t?this._make(e):r.filter.call(e,t,this)},r.contents=function(){return this._make(i.reduce(this,function(t,e){return t.push.apply(t,e.children),t},[]))},r.each=function(t){for(var e=0,r=this.length;e<r&&!1!==t.call(this[e],e,this[e]);)++e;return this},r.map=function(t){return this._make(i.reduce(this,function(e,r,n){var i=t.call(r,n,r);return null==i?e:e.concat(i)},[]))};var l=function(t){return function(e,r){var n;return r=r||this,n="string"==typeof e?o.compile(e,r.options):"function"==typeof e?function(t,r){return e.call(t,r,t)}:e.cheerio?e.is.bind(e):function(t){return e===t},r._make(t(this,n))}};r.filter=l(i.filter),r.not=l(i.reject),r.has=function(t){var e=this;return r.filter.call(this,function(){return e._make(this).find(t).length>0})},r.first=function(){return this.length>1?this._make(this[0]):this},r.last=function(){return this.length>1?this._make(this[this.length-1]):this},r.eq=function(t){return 0===(t=+t)&&this.length<=1?this:(t<0&&(t=this.length+t),this[t]?this._make(this[t]):this._make([]))},r.get=function(t){return null==t?Array.prototype.slice.call(this):this[t<0?this.length+t:t]},r.index=function(t){var e,r;return 0===arguments.length?(e=this.parent().children(),r=this[0]):"string"==typeof t?(e=this._make(t),r=this[0]):(e=this,r=t.cheerio?t[0]:t),e.get().indexOf(r)},r.slice=function(){return this._make([].slice.apply(this,arguments))},r.end=function(){return this.prevObject||this._make([])},r.add=function(t,e){for(var r=this._make(t,e),n=u(r.get().concat(this.get())),i=0;i<n.length;++i)r[i]=n[i];return r.length=n.length,r},r.addBack=function(t){return this.add(arguments.length?this.prevObject.filter(t):this.prevObject)}},{"../utils":19,"css-select":22,htmlparser2:69,lodash:79}],16:[function(t,e,r){var n=t("./parse"),i=t("./utils").isHtml,o=t("lodash"),a=[t("./api/attributes"),t("./api/traversing"),t("./api/manipulation"),t("./api/css"),t("./api/forms")],s=e.exports=function(t,e,r,a){return this instanceof s?(this.options=o.defaults(a||{},this.options),t?(r&&("string"==typeof r&&(r=n(r,this.options)),this._root=s.call(this,r)),t.cheerio?t:(u(t)&&(t=[t]),Array.isArray(t)?(o.forEach(t,o.bind(function(t,e){this[e]=t},this)),this.length=t.length,this):"string"==typeof t&&i(t)?s.call(this,n(t,this.options).children):(e?"string"==typeof e?i(e)?(e=n(e,this.options),e=s.call(this,e)):(t=[e,t].join(" "),e=this._root):e.cheerio||(e=s.call(this,e)):e=this._root,e?e.find(t):this))):this):new s(t,e,r,a)};o.extend(s,t("./static")),s.prototype.cheerio="[cheerio object]",s.prototype.options={withDomLvl1:!0,normalizeWhitespace:!1,xmlMode:!1,decodeEntities:!0},s.prototype.length=0,s.prototype.splice=Array.prototype.splice,s.prototype._make=function(t,e){var r=new this.constructor(t,e,this._root,this.options);return r.prevObject=this,r},s.prototype.toArray=function(){return this.get()},a.forEach(function(t){o.extend(s.prototype,t)});var u=function(t){return t.name||"text"===t.type||"comment"===t.type}},{"./api/attributes":11,"./api/css":12,"./api/forms":13,"./api/manipulation":14,"./api/traversing":15,"./parse":17,"./static":18,"./utils":19,lodash:79}],17:[function(t,e,r){(function(n){var i=t("htmlparser2");r=e.exports=function(t,e){var n=r.evaluate(t,e),i=r.evaluate("<root></root>",e)[0];return i.type="root",r.update(n,i),i},r.evaluate=function(t,e){return"string"==typeof t||n.isBuffer(t)?i.parseDOM(t,e):t},r.update=function(t,e){Array.isArray(t)||(t=[t]),e?e.children=t:e=null;for(var r=0;r<t.length;r++){var n=t[r],i=n.parent||n.root,o=i&&i.children;o&&o!==t&&(o.splice(o.indexOf(n),1),n.prev&&(n.prev.next=n.next),n.next&&(n.next.prev=n.prev)),e?(n.prev=t[r-1]||null,n.next=t[r+1]||null):n.prev=n.next=null,e&&"root"===e.type?(n.root=e,n.parent=null):(n.root=null,n.parent=e)}return e}}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":77,htmlparser2:69}],18:[function(t,e,r){function n(t,e,r){if(e)"string"==typeof e&&(e=i(e,t._root,r));else{if(!t._root||!t._root.children)return"";e=t._root.children}return a(e,r)}var i=t("css-select"),o=t("./parse"),a=t("dom-serializer"),s=t("lodash");r.load=function(e,n){var i=t("./cheerio");n=s.defaults(n||{},i.prototype.options);var a=o(e,n),u=function(t,e,r,o){return this instanceof u?(o=s.defaults(o||{},n),i.call(this,t,e,r||a,o)):new u(t,e,r,o)};return u.prototype=Object.create(i.prototype),u.prototype.constructor=u,u.fn=u.prototype,u.prototype._originalRoot=a,s.merge(u,r),u._root=a,u._options=n,u},r.html=function(e,r){var i=t("./cheerio");return"[object Object]"!==Object.prototype.toString.call(e)||r||"length"in e||"type"in e||(r=e,e=void 0),r=s.defaults(r||{},this._options,i.prototype.options),n(this,e,r)},r.xml=function(t){return n(this,t,s.defaults({xmlMode:!0},this._options))},r.text=function(t){if(!t)return"";for(var e,n="",i=t.length,o=0;o<i;o++)e=t[o],"text"===e.type?n+=e.data:e.children&&"comment"!==e.type&&(n+=r.text(e.children));return n},r.parseHTML=function(t,e,r){var n;return t&&"string"==typeof t?("boolean"==typeof e&&(r=e),n=this.load(t),r||n("script").remove(),n.root()[0].children.slice()):null},r.root=function(){return this(this._root)},r.contains=function(t,e){if(e===t)return!1;for(;e&&e!==e.parent;)if((e=e.parent)===t)return!0;return!1}},{"./cheerio":16,"./parse":17,"css-select":22,"dom-serializer":30,lodash:79}],19:[function(t,e,r){var n=t("./parse"),i=t("dom-serializer"),o={tag:!0,script:!0,style:!0};r.isTag=function(t){return t.type&&(t=t.type),o[t]||!1},r.camelCase=function(t){return t.replace(/[_.-](\w|$)/g,function(t,e){return e.toUpperCase()})},r.cssCase=function(t){return t.replace(/[A-Z]/g,"-$&").toLowerCase()},r.domEach=function(t,e){for(var r=0,n=t.length;r<n&&!1!==e.call(t,r,t[r]);)++r;return t},r.cloneDom=function(t,e){return n(i(t,e),e).children};var a=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/;r.isHtml=function(t){if("<"===t.charAt(0)&&">"===t.charAt(t.length-1)&&t.length>=3)return!0;var e=a.exec(t);return!(!e||!e[1])}},{"./parse":17,"dom-serializer":30}],20:[function(t,e,r){e.exports={name:"cheerio",version:"0.20.0",description:"Tiny, fast, and elegant implementation of core jQuery designed specifically for the server",author:"Matt Mueller <mattmuelle@gmail.com> (mat.io)",license:"MIT",keywords:["htmlparser","jquery","selector","scraper","parser","html"],repository:{type:"git",url:"git://github.com/cheeriojs/cheerio.git"},main:"./index.js",files:["index.js","lib"],engines:{node:">= 0.6"},dependencies:{"css-select":"~1.2.0",entities:"~1.1.1",htmlparser2:"~3.8.1","dom-serializer":"~0.1.0",lodash:"^4.1.0"},devDependencies:{benchmark:"~1.0.0",coveralls:"~2.10","expect.js":"~0.3.1",istanbul:"~0.2",jshint:"~2.5.1",mocha:"*",xyz:"~0.5.0"},scripts:{test:"make test"},optionalDependencies:{jsdom:"^7.0.2"}}},{}],21:[function(t,e,r){(function(t){function e(t){return Array.isArray?Array.isArray(t):"[object Array]"===m(t)}function n(t){return"boolean"==typeof t}function i(t){return null===t}function o(t){return null==t}function a(t){return"number"==typeof t}function s(t){return"string"==typeof t}function u(t){return"symbol"==typeof t}function c(t){return void 0===t}function l(t){return"[object RegExp]"===m(t)}function f(t){return"object"==typeof t&&null!==t}function h(t){return"[object Date]"===m(t)}function p(t){retur