From fcd5957083eecb5b4638f2e912f56e3fce619258 Mon Sep 17 00:00:00 2001 From: Ralph Pillichshammer Date: Mon, 6 Nov 2017 11:59:44 +0100 Subject: [PATCH 1/3] add missing flow comment --- src/constants/defaultOptions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/constants/defaultOptions.js b/src/constants/defaultOptions.js index 81d77c60..2355f567 100644 --- a/src/constants/defaultOptions.js +++ b/src/constants/defaultOptions.js @@ -1,3 +1,5 @@ +// @flow + import type { Options } from './../../flow-typed/' const defaultOptions: Options = { From d981714c125d4f1998c73421767895784679f831 Mon Sep 17 00:00:00 2001 From: Ralph Pillichshammer Date: Mon, 6 Nov 2017 12:00:56 +0100 Subject: [PATCH 2/3] fix merging of sets when a file glob pattern is used --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 98375bf5..e23e1137 100644 --- a/src/index.js +++ b/src/index.js @@ -113,7 +113,7 @@ class Purgecss { for (let file of filesnames) { const content = fs.readFileSync(file, 'utf8') const extractor = this.getFileExtractor(file, extractors) - selectors = new Set(...selectors, this.extractSelectors(content, extractor)) + selectors = new Set([...selectors, ...this.extractSelectors(content, extractor)]) } } From 3b3b51cae71a75bd049e617b42c528ad75525e9f Mon Sep 17 00:00:00 2001 From: Ralph Pillichshammer Date: Mon, 6 Nov 2017 12:17:49 +0100 Subject: [PATCH 3/3] update built assets --- lib/purgecss.es.js | 2 +- lib/purgecss.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/purgecss.es.js b/lib/purgecss.es.js index 0b5160fc..f94ab6ca 100644 --- a/lib/purgecss.es.js +++ b/lib/purgecss.es.js @@ -1 +1 @@ -function normalizeArray(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function resolve(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(t=n+"/"+t,e="/"===n.charAt(0))}return t=normalizeArray(filter(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."}function normalize(t){var e=isAbsolute(t),r="/"===substr(t,-1);return(t=normalizeArray(filter(t.split("/"),function(t){return!!t}),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t}function isAbsolute(t){return"/"===t.charAt(0)}function join(){return normalize(filter(Array.prototype.slice.call(arguments,0),function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))}function relative(t,e){function r(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=resolve(t).substr(1),e=resolve(e).substr(1);for(var n=r(t.split("/")),i=r(e.split("/")),o=Math.min(n.length,i.length),s=o,a=0;a=0&&u>0){for(n=[],o=r.length;f>=0&&!a;)f==c?(n.push(f),c=r.indexOf(t,f+1)):1==n.length?a=[n.pop(),u]:((i=n.pop())=0?c:u;n.length&&(a=[o,s])}return a}function numeric(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function escapeBraces(t){return t.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod)}function unescapeBraces(t){return t.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".")}function parseCommaParts(t){if(!t)return[""];var e=[],r=balancedMatch("{","}",t);if(!r)return t.split(",");var n=r.pre,i=r.body,o=r.post,s=n.split(",");s[s.length-1]+="{"+i+"}";var a=parseCommaParts(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function expandTop(t){return t?("{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2)),expand(escapeBraces(t),!0).map(unescapeBraces)):[]}function embrace(t){return"{"+t+"}"}function isPadded(t){return/^-?0\d/.test(t)}function lte(t,e){return t<=e}function gte(t,e){return t>=e}function expand(t,e){var r=[],n=balancedMatch("{","}",t);if(!n||/\$$/.test(n.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),s=i||o,a=n.body.indexOf(",")>=0;if(!s&&!a)return n.post.match(/,.*\}/)?(t=n.pre+"{"+n.body+escClose+n.post,expand(t)):[t];var c;if(s)c=n.body.split(/\.\./);else if(1===(c=parseCommaParts(n.body)).length&&1===(c=expand(c[0],!1).map(embrace)).length)return(l=n.post.length?expand(n.post,!1):[""]).map(function(t){return n.pre+c[0]+t});var u,f=n.pre,l=n.post.length?expand(n.post,!1):[""];if(s){var h=numeric(c[0]),p=numeric(c[1]),d=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(numeric(c[2])):1,g=lte;p0){var w=new Array(E+1).join("0");b=v<0?"-"+w+b.slice(1):w+b}}u.push(b)}}else u=concatMap(c,function(t){return expand(t,!1)});for(var _=0;_65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===t)return GLOBSTAR;if(""===t)return"";for(var i,o,s="",a=!!n.nocase,c=!1,u=[],f=[],l=!1,h=-1,p=-1,d="."===t.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",m=this,g=0,y=t.length;g-1;A--){var T=f[A],$=s.slice(0,T.reStart),k=s.slice(T.reStart,T.reEnd-8),O=s.slice(T.reEnd-8,T.reEnd),R=s.slice(T.reEnd);O+=R;var x=$.split("(").length-1,B=R;for(g=0;g=0&&!(i=t[o]);o--);for(o=0;o1)for(var r=1;r=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),s=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),isBoolean(e)?r.showHidden=e:e&&_extend(r,e),isUndefined(r.showHidden)&&(r.showHidden=!1),isUndefined(r.depth)&&(r.depth=2),isUndefined(r.colors)&&(r.colors=!1),isUndefined(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=stylizeWithColor),formatValue(r,t,r.depth)}function stylizeWithColor(t,e){var r=inspect.styles[e];return r?"["+inspect.colors[r][0]+"m"+t+"["+inspect.colors[r][1]+"m":t}function stylizeNoColor(t,e){return t}function arrayToHash(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function formatValue(t,e,r){if(t.customInspect&&e&&isFunction(e.inspect)&&e.inspect!==inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return isString(n)||(n=formatValue(t,n,r)),n}var i=formatPrimitive(t,e);if(i)return i;var o=Object.keys(e),s=arrayToHash(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),isError(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(e);if(0===o.length){if(isFunction(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(isRegExp(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(isDate(e))return t.stylize(Date.prototype.toString.call(e),"date");if(isError(e))return formatError(e)}var c="",u=!1,f=["{","}"];if(isArray$1(e)&&(u=!0,f=["[","]"]),isFunction(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),isRegExp(e)&&(c=" "+RegExp.prototype.toString.call(e)),isDate(e)&&(c=" "+Date.prototype.toUTCString.call(e)),isError(e)&&(c=" "+formatError(e)),0===o.length&&(!u||0==e.length))return f[0]+c+f[1];if(r<0)return isRegExp(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var l;return l=u?formatArray(t,e,r,s,o):o.map(function(n){return formatProperty(t,e,r,s,n,u)}),t.seen.pop(),reduceToSingleString(l,c,f)}function formatPrimitive(t,e){if(isUndefined(e))return t.stylize("undefined","undefined");if(isString(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return isNumber(e)?t.stylize(""+e,"number"):isBoolean(e)?t.stylize(""+e,"boolean"):isNull(e)?t.stylize("null","null"):void 0}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatArray(t,e,r,n,i){for(var o=[],s=0,a=e.length;s-1&&(a=o?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n")):a=t.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function reduceToSingleString(t,e,r){var n=0;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function isArray$1(t){return Array.isArray(t)}function isBoolean(t){return"boolean"==typeof t}function isNull(t){return null===t}function isNullOrUndefined(t){return null==t}function isNumber(t){return"number"==typeof t}function isString(t){return"string"==typeof t}function isSymbol(t){return"symbol"===(void 0===t?"undefined":_typeof(t))}function isUndefined(t){return void 0===t}function isRegExp(t){return isObject(t)&&"[object RegExp]"===objectToString(t)}function isObject(t){return"object"===(void 0===t?"undefined":_typeof(t))&&null!==t}function isDate(t){return isObject(t)&&"[object Date]"===objectToString(t)}function isError(t){return isObject(t)&&("[object Error]"===objectToString(t)||t instanceof Error)}function isFunction(t){return"function"==typeof t}function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===(void 0===t?"undefined":_typeof(t))||void 0===t}function isBuffer(t){return Buffer.isBuffer(t)}function objectToString(t){return Object.prototype.toString.call(t)}function pad(t){return t<10?"0"+t.toString(10):t.toString(10)}function timestamp(){var t=new Date,e=[pad(t.getHours()),pad(t.getMinutes()),pad(t.getSeconds())].join(":");return[t.getDate(),months[t.getMonth()],e].join(" ")}function log(){console.log("%s - %s",timestamp(),format.apply(null,arguments))}function _extend(t,e){if(!e||!isObject(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function hasOwnProperty(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function EventHandlers(){}function EventEmitter(){EventEmitter.init.call(this)}function $getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function emitNone(t,e,r){if(e)t.call(r);else for(var n=t.length,i=arrayClone(t,n),o=0;o0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,emitWarning(a)}}else s=o[e]=r,++t._eventsCount;return t}function emitWarning(t){"function"==typeof console.warn?console.warn(t):console.log(t)}function _onceWrap(t,e,r){function n(){t.removeListener(e,n),i||(i=!0,r.apply(t,arguments))}var i=!1;return n.listener=r,n}function listenerCount(t){var e=this._events;if(e){var r=e[t];if("function"==typeof r)return 1;if(r)return r.length}return 0}function spliceOne(t,e){for(var r=e,n=r+1,i=t.length;n0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new Arr(3*a/4-o),n=o>0?a-4:a;var c=0;for(e=0,r=0;e>16&255,s[c++]=i>>8&255,s[c++]=255&i;return 2===o?(i=revLookup[t.charCodeAt(e)]<<2|revLookup[t.charCodeAt(e+1)]>>4,s[c++]=255&i):1===o&&(i=revLookup[t.charCodeAt(e)]<<10|revLookup[t.charCodeAt(e+1)]<<4|revLookup[t.charCodeAt(e+2)]>>2,s[c++]=i>>8&255,s[c++]=255&i),s}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[63&t]}function encodeChunk(t,e,r){for(var n,i=[],o=e;oa?a:s+16383));return 1===n?(e=t[r-1],i+=lookup[e>>2],i+=lookup[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=lookup[e>>10],i+=lookup[e>>4&63],i+=lookup[e<<2&63],i+="="),o.push(i),o.join("")}function read(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,f=-7,l=r?i-1:0,h=r?-1:1,p=t[e+l];for(l+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+t[e+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+t[e+l],l+=h,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=u}return(p?-1:1)*s*Math.pow(2,o-n)}function write(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,f=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=d,s/=256,u-=8);t[r+p-d]|=128*m}function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,e){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function internalIsBuffer(t){return!(null==t||!t._isBuffer)}function byteLength(t,e){if(internalIsBuffer(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 n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(t).length;default:if(n)return utf8ToBytes(t).length;e=(""+e).toLowerCase(),n=!0}}function slowToString(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 hexSlice(this,e,r);case"utf8":case"utf-8":return utf8Slice(this,e,r);case"ascii":return asciiSlice(this,e,r);case"latin1":case"binary":return latin1Slice(this,e,r);case"base64":return base64Slice(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function swap(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function bidirectionalIndexOf(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=Buffer$1.from(e,n)),internalIsBuffer(e))return 0===e.length?-1:arrayIndexOf(t,e,r,n,i);if("number"==typeof e)return e&=255,Buffer$1.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):arrayIndexOf(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=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;s=2,a/=2,c/=2,r/=2}var u;if(i){var f=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var l=!0,h=0;hi&&(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 s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var c,u,f,l;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(c=t[i+1]))&&(l=(31&o)<<6|63&c)>127&&(s=l);break;case 3:c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&(l=(15&o)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:c=t[i+1],u=t[i+2],f=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&f)&&(l=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&f)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return decodeCodePointsArray(n)}function decodeCodePointsArray(t){var e=t.length;if(e<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,e,r,n,i,o){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function objectWriteUInt32(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function checkIEEE754(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 writeFloat(t,e,r,n,i){return i||checkIEEE754(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),write(t,e,r,n,23,4),r+4}function writeDouble(t,e,r,n,i){return i||checkIEEE754(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),write(t,e,r,n,52,8),r+8}function base64clean(t){if((t=stringtrim(t).replace(INVALID_BASE64_RE,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+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 asciiToBytes(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function base64ToBytes(t){return toByteArray(base64clean(t))}function blitBuffer(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function isnan(t){return t!==t}function isBuffer$1(t){return null!=t&&(!!t._isBuffer||isFastBuffer(t)||isSlowBuffer(t))}function isFastBuffer(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function isSlowBuffer(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&isFastBuffer(t.slice(0,0))}function compare(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}}function truncate(t,e){return"string"==typeof t?t.length=0;a--)if(c[a]!==u[a])return!1;for(a=c.length-1;a>=0;a--)if(s=c[a],!_deepEqual(t[s],e[s],r,n))return!1;return!0}function notDeepEqual(t,e,r){_deepEqual(t,e,!1)&&fail(t,e,r,"notDeepEqual",notDeepEqual)}function notDeepStrictEqual(t,e,r){_deepEqual(t,e,!0)&&fail(t,e,r,"notDeepStrictEqual",notDeepStrictEqual)}function strictEqual(t,e,r){t!==e&&fail(t,e,r,"===",strictEqual)}function notStrictEqual(t,e,r){t===e&&fail(t,e,r,"!==",notStrictEqual)}function expectedException(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function _tryBlock(t){var e;try{t()}catch(t){e=t}return e}function _throws(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=_tryBlock(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&fail(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&isError(i),a=!t&&i&&!r;if((s&&o&&expectedException(i,r)||a)&&fail(i,r,"Got unwanted exception"+n),t&&i&&r&&!expectedException(i,r)||!t&&i)throw i}function throws(t,e,r){_throws(!0,t,e,r)}function doesNotThrow(t,e,r){_throws(!1,t,e,r)}function ifError(t){if(t)throw t}function posix(t){return"/"===t.charAt(0)}function win32(t){var e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),r=e[1]||"",n=Boolean(r&&":"!==r.charAt(1));return Boolean(e[2]||n)}function ownProp$2(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function alphasorti$2(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())}function alphasort$2(t,e){return t.localeCompare(e)}function setupIgnores(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(ignoreMap))}function ignoreMap(t){var e=null;if("/**"===t.slice(-3)){var r=t.replace(/(\/\*\*)+$/,"");e=new Minimatch$3(r,{dot:!0})}return{matcher:new Minimatch$3(t,{dot:!0}),gmatcher:e}}function setopts$2(t,e,r){if(r||(r={}),r.matchBase&&-1===e.indexOf("/")){if(r.noglobstar)throw new Error("base matching requires globstar");e="**/"+e}t.silent=!!r.silent,t.pattern=e,t.strict=!1!==r.strict,t.realpath=!!r.realpath,t.realpathCache=r.realpathCache||Object.create(null),t.follow=!!r.follow,t.dot=!!r.dot,t.mark=!!r.mark,t.nodir=!!r.nodir,t.nodir&&(t.mark=!0),t.sync=!!r.sync,t.nounique=!!r.nounique,t.nonull=!!r.nonull,t.nosort=!!r.nosort,t.nocase=!!r.nocase,t.stat=!!r.stat,t.noprocess=!!r.noprocess,t.absolute=!!r.absolute,t.maxLength=r.maxLength||1/0,t.cache=r.cache||Object.create(null),t.statCache=r.statCache||Object.create(null),t.symlinks=r.symlinks||Object.create(null),setupIgnores(t,r),t.changedCwd=!1;var n=process.cwd();ownProp$2(r,"cwd")?(t.cwd=path$2.resolve(r.cwd),t.changedCwd=t.cwd!==n):t.cwd=n,t.root=r.root||path$2.resolve(t.cwd,"/"),t.root=path$2.resolve(t.root),"win32"===process.platform&&(t.root=t.root.replace(/\\/g,"/")),t.cwdAbs=pathIsAbsolute(t.cwd)?t.cwd:makeAbs(t,t.cwd),"win32"===process.platform&&(t.cwdAbs=t.cwdAbs.replace(/\\/g,"/")),t.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,t.minimatch=new Minimatch$3(e,r),t.options=t.minimatch.options}function finish(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,i=t.matches.length;nn?(r.splice(0,n),process.nextTick(function(){e.apply(null,i)})):delete reqs[t]}})}function slice(t){for(var e=t.length,r=[],n=0;n=t.length)return e&&(e[h]=t),r(null,t);nextPartRe.lastIndex=c;var n=nextPartRe.exec(t);return l=u,u+=n[0],f=l+n[1],c=nextPartRe.lastIndex,d[f]||e&&e[f]===f?process.nextTick(i):e&&Object.prototype.hasOwnProperty.call(e,f)?a(e[f]):fs.lstat(f,o)}function o(t,n){if(t)return r(t);if(!n.isSymbolicLink())return d[f]=!0,e&&(e[f]=f),process.nextTick(i);if(!isWindows){var o=n.dev.toString(32)+":"+n.ino.toString(32);if(p.hasOwnProperty(o))return s(null,p[o],f)}fs.stat(f,function(t){if(t)return r(t);fs.readlink(f,function(t,e){isWindows||(p[o]=e),s(t,e)})})}function s(t,n,i){if(t)return r(t);var o=path$2.resolve(l,n);e&&(e[i]=o),a(o)}function a(e){t=path$2.resolve(e,t.slice(c)),n()}if("function"!=typeof r&&(r=maybeCallback(e),e=null),t=path$2.resolve(t),e&&Object.prototype.hasOwnProperty.call(e,t))return process.nextTick(r.bind(null,null,e[t]));var c,u,f,l,h=t,p={},d={};n()},old={realpathSync:realpathSync$1,realpath:realpath$1},fs_realpath=realpath;realpath.realpath=realpath,realpath.sync=realpathSync,realpath.realpathSync=realpathSync,realpath.monkeypatch=monkeypatch,realpath.unmonkeypatch=unmonkeypatch;var origRealpath=fs.realpath,origRealpathSync=fs.realpathSync,version=process.version,ok=/^v[0-5]\./.test(version),concatMap=function(t,e){for(var r=[],n=0;n>> no match, partial?",t,f,e,l),f!==s))}var p;if("string"==typeof c?(p=n.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,p)):(p=u.match(c),this.debug("pattern match",c,u,p)),!p)return!1}if(i===s&&o===a)return!0;if(i===s)return r;if(o===a)return i===s-1&&""===t[i];throw new Error("wtf?")};var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;"function"==typeof global.setTimeout&&(cachedSetTimeout=setTimeout),"function"==typeof global.clearTimeout&&(cachedClearTimeout=clearTimeout);var queue=[],draining=!1,currentQueue,queueIndex=-1;Item.prototype.run=function(){this.fun.apply(null,this.array)};var title="browser",platform="browser",browser=!0,env={},argv=[],version$1="",versions={},release={},config={},on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop,performance=global.performance||{},performanceNow=performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()},startTime=new Date,process$1={nextTick:nextTick,title:title,browser:browser,env:env,argv:argv,version:version$1,versions:versions,on:on,addListener:addListener,once:once,off:off,removeListener:removeListener,removeAllListeners:removeAllListeners,emit:emit,binding:binding,cwd:cwd,chdir:chdir,umask:umask,hrtime:hrtime,platform:platform,release:release,config:config,uptime:uptime},inherits$2,inherits$3=inherits$2="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},asyncGenerator=function(){function t(t){this.value=t}function e(e){function r(i,o){try{var s=e[i](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):n(s.done?"return":"normal",s.value)}catch(t){n("throw",t)}}function n(t,e){switch(t){case"return":i.resolve({value:e,done:!0});break;case"throw":i.reject(e);break;default:i.resolve({value:e,done:!1})}(i=i.next)?r(i.key,i.arg):o=null}var i,o;this._invoke=function(t,e){return new Promise(function(n,s){var a={key:t,arg:e,resolve:n,reject:s,next:null};o?o=o.next=a:(i=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)},{wrap:function(t){return function(){return new e(t.apply(this,arguments))}},await:function(e){return new t(e)}}}(),classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},createClass=function(){function t(t,e){for(var r=0;r0;)if(r[o]===e||r[o].listener&&r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new EventHandlers,this;delete n[t]}else spliceOne(r,i);n.removeListener&&this.emit("removeListener",t,s||e)}return this},EventEmitter.prototype.removeAllListeners=function(t){var e,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new EventHandlers,this._eventsCount=0):r[t]&&(0==--this._eventsCount?this._events=new EventHandlers:delete r[t]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o0?Reflect.ownKeys(this._events):[]};var events=Object.freeze({default:EventEmitter,EventEmitter:EventEmitter}),lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,inited=!1,toString={}.toString,isArray$2=Array.isArray||function(t){return"[object Array]"==toString.call(t)},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var _kMaxLength=kMaxLength();Buffer$1.poolSize=8192,Buffer$1._augment=function(t){return t.__proto__=Buffer$1.prototype,t},Buffer$1.from=function(t,e,r){return from(null,t,e,r)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array),Buffer$1.alloc=function(t,e,r){return alloc(null,t,e,r)},Buffer$1.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer$1.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer$1.isBuffer=isBuffer$1,Buffer$1.compare=function(t,e){if(!internalIsBuffer(t)||!internalIsBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},Buffer$1.prototype.compare=function(t,e,r,n,i){if(!internalIsBuffer(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===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,a=Math.min(o,s),c=this.slice(n,i),u=t.slice(e,r),f=0;fi)&&(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 hexWrite(this,t,e,r);case"utf8":case"utf-8":return utf8Write(this,t,e,r);case"ascii":return asciiWrite(this,t,e,r);case"latin1":case"binary":return latin1Write(this,t,e,r);case"base64":return base64Write(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Buffer$1.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer$1.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),e0&&(i*=256);)n+=this[t+--e]*i;return n},Buffer$1.prototype.readUInt8=function(t,e){return e||checkOffset(t,1,this.length),this[t]},Buffer$1.prototype.readUInt16LE=function(t,e){return e||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer$1.prototype.readUInt16BE=function(t,e){return e||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer$1.prototype.readUInt32LE=function(t,e){return e||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer$1.prototype.readUInt32BE=function(t,e){return e||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer$1.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},Buffer$1.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||checkOffset(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},Buffer$1.prototype.readInt8=function(t,e){return e||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer$1.prototype.readInt16LE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Buffer$1.prototype.readInt16BE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Buffer$1.prototype.readInt32LE=function(t,e){return e||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer$1.prototype.readInt32BE=function(t,e){return e||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer$1.prototype.readFloatLE=function(t,e){return e||checkOffset(t,4,this.length),read(this,t,!0,23,4)},Buffer$1.prototype.readFloatBE=function(t,e){return e||checkOffset(t,4,this.length),read(this,t,!1,23,4)},Buffer$1.prototype.readDoubleLE=function(t,e){return e||checkOffset(t,8,this.length),read(this,t,!0,52,8)},Buffer$1.prototype.readDoubleBE=function(t,e){return e||checkOffset(t,8,this.length),read(this,t,!1,52,8)},Buffer$1.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||checkInt(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},Buffer$1.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Buffer$1.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer$1.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer$1.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):objectWriteUInt32(this,t,e,!0),e+4},Buffer$1.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer$1.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);checkInt(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},Buffer$1.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);checkInt(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},Buffer$1.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Buffer$1.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer$1.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer$1.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):objectWriteUInt32(this,t,e,!0),e+4},Buffer$1.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer$1.prototype.writeFloatLE=function(t,e,r){return writeFloat(this,t,e,!0,r)},Buffer$1.prototype.writeFloatBE=function(t,e,r){return writeFloat(this,t,e,!1,r)},Buffer$1.prototype.writeDoubleLE=function(t,e,r){return writeDouble(this,t,e,!0,r)},Buffer$1.prototype.writeDoubleBE=function(t,e,r){return writeDouble(this,t,e,!1,r)},Buffer$1.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;othis.maxLength)return!1;if(!this.stat&&ownProp$1(this.cache,e)){o=this.cache[e];if(Array.isArray(o)&&(o="DIR"),!r||"DIR"===o)return o;if(r&&"FILE"===o)return!1}var n=this.statCache[e];if(!n){var i;try{i=fs.lstatSync(e)}catch(t){if(t&&("ENOENT"===t.code||"ENOTDIR"===t.code))return this.statCache[e]=!1,!1}if(i&&i.isSymbolicLink())try{n=fs.statSync(e)}catch(t){n=i}else n=i}this.statCache[e]=n;var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||o,(!r||"FILE"!==o)&&o},GlobSync$1.prototype._mark=function(t){return common.mark(this,t)},GlobSync$1.prototype._makeAbs=function(t){return common.makeAbs(this,t)};var wrappy_1=wrappy,once_1=wrappy_1(once$1),strict=wrappy_1(onceStrict);once$1.proto=once$1(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once$1(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})}),once_1.strict=strict;var reqs=Object.create(null),inflight_1=wrappy_1(inflight),require$$0$2=events&&EventEmitter||events,glob_1=glob,EE=require$$0$2.EventEmitter,setopts=common.setopts,ownProp=common.ownProp,childrenIgnored=common.childrenIgnored,isIgnored=common.isIgnored;glob.sync=sync;var GlobSync=glob.GlobSync=sync.GlobSync;glob.glob=glob,glob.hasMagic=function(t,e){var r=extend({},e);r.noprocess=!0;var n=new Glob(t,r).minimatch.set;if(!t)return!1;if(n.length>1)return!0;for(var i=0;ithis.maxLength)return e();if(!this.stat&&ownProp(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||"DIR"===i)return e(null,i);if(n&&"FILE"===i)return e()}var o=this.statCache[r];if(void 0!==o){if(!1===o)return e(null,o);var s=o.isDirectory()?"DIR":"FILE";return n&&"FILE"===s?e():e(null,s,o)}var a=this,c=inflight_1("stat\0"+r,function(n,i){if(i&&i.isSymbolicLink())return fs.stat(r,function(n,o){n?a._stat2(t,r,null,i,e):a._stat2(t,r,n,o,e)});a._stat2(t,r,n,i,e)});c&&fs.lstat(r,c)},Glob.prototype._stat2=function(t,e,r,n,i){if(r&&("ENOENT"===r.code||"ENOTDIR"===r.code))return this.statCache[e]=!1,i();var o="/"===t.slice(-1);if(this.statCache[e]=n,"/"===e.slice(-1)&&n&&!n.isDirectory())return i(null,!1,n);var s=!0;return n&&(s=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||s,o&&"FILE"===s?i():i(null,s,n)};var defaultOptions={css:[],content:[],extractors:[],whitelist:[],output:void 0,stdout:!1,info:!1,rejected:!1},IGNORE_ANNOTATION="purgecss ignore",CONFIG_FILENAME="purgecss.config.js",ERROR_CONFIG_FILE_LOADING="Error loading the config file",ERROR_MISSING_CONTENT="No content provided.",ERROR_MISSING_CSS="No css provided.",ERROR_EXTRACTER_FAILED="The extractor has failed to extract the selectors.",ERROR_OPTIONS_TYPE="Error Type Options: expected an object",ERROR_OUTPUT_TYPE="Error Type option output: expected a string",ERROR_EXTRACTERS_TYPE="Error Type option extractors: expected an array",ERROR_WHITELIST_TYPE="Error Type option whitelist: expected an array",ERROR_WHITELIST_PATTERNS_TYPE="Error Type option whitelistPatterns: expected an array",ERROR_STDOUT_TYPE="Error Type option stdout: expected a boolean",ERROR_INFO_TYPE="Error Type option info: expected a boolean",ERROR_REJECTED_TYPE="Error Type option rejected: expected a boolean",CSS_WHITELIST=["*","::-webkit-scrollbar","::selection",":root","::before","::after"],SELECTOR_STANDARD_TYPES=["class","tag","id","universal","pseudo"],DefaultExtractor=function(){function t(){classCallCheck(this,t)}return createClass(t,null,[{key:"extract",value:function(t){return t.match(/[A-z0-9-]+/g)}}]),t}(),LegacyExtractor=function(){function t(){classCallCheck(this,t)}return createClass(t,null,[{key:"extract",value:function(t){return t.split(/[^a-z]/g)}}]),t}(),Purgecss=function(){function t(e){classCallCheck(this,t),"string"!=typeof e&&void 0!==e||(e=this.loadConfigFile(e)),this.checkOptions(e),this.options=Object.assign(defaultOptions,e)}return createClass(t,[{key:"loadConfigFile",value:function(t){var e=void 0===t?CONFIG_FILENAME:t,r=void 0;try{var n=path.resolve(process.cwd(),e);r=require(n)}catch(t){throw new Error(ERROR_CONFIG_FILE_LOADING+t.message)}return r}},{key:"checkOptions",value:function(t){if("object"!==(void 0===t?"undefined":_typeof(t)))throw new TypeError(ERROR_OPTIONS_TYPE);if(!t.content||!t.content.length)throw new Error(ERROR_MISSING_CONTENT);if(!t.css||!t.css.length)throw new Error(ERROR_MISSING_CSS);if(t.output&&"string"!=typeof t.output)throw new TypeError(ERROR_OUTPUT_TYPE);if(t.extractors&&!Array.isArray(t.extractors))throw new TypeError(ERROR_EXTRACTERS_TYPE);if(t.whitelist&&!Array.isArray(t.whitelist))throw new TypeError(ERROR_WHITELIST_TYPE);if(t.stdout&&"boolean"!=typeof t.stdout)throw new TypeError(ERROR_STDOUT_TYPE);if(t.info&&"boolean"!=typeof t.info)throw new TypeError(ERROR_INFO_TYPE);if(t.rejected&&"boolean"!=typeof t.rejected)throw new TypeError(ERROR_REJECTED_TYPE);if(t.whitelistPatterns&&!Array.isArray(t.whitelistPatterns))throw new TypeError(ERROR_WHITELIST_PATTERNS_TYPE)}},{key:"purge",value:function(){var t=this.extractFileSelector(this.options.content,this.options.extractors),e=[],r=!0,n=!1,i=void 0;try{for(var o,s=this.options.css[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var a=o.value,c=this.options.stdin?a:fs.readFileSync(a,"utf8");e.push({file:a,css:this.getSelectorsCss(c,t)})}}catch(t){n=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return e}},{key:"extractFileSelector",value:function(t,e){var r=new Set,n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var c=s.value,u=[];fs.existsSync(c)?u.push(c):u=glob_1.sync(c);var f=!0,l=!1,h=void 0;try{for(var p,d=u[Symbol.iterator]();!(f=(p=d.next()).done);f=!0){var m=p.value,g=fs.readFileSync(m,"utf8"),y=this.getFileExtractor(m,e);r=new(Function.prototype.bind.apply(Set,[null].concat(toConsumableArray(r),[this.extractSelectors(g,y)])))}}catch(t){l=!0,h=t}finally{try{!f&&d.return&&d.return()}finally{if(l)throw h}}}}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}},{key:"getFileExtractor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length?e.find(function(e){return e.extensions.find(function(e){return t.endsWith(e)})}).extractor:!0===this.options.legacy?LegacyExtractor:DefaultExtractor}},{key:"extractSelectors",value:function(t,e){var r=new Set,n=e.extract(t);if(null===n)throw new Error(ERROR_EXTRACTER_FAILED);return n.forEach(function(t){r.add(t)}),r.delete(""),r}},{key:"getSelectorsCss",value:function(t,e){var r=this,n=postcss.parse(t);return n.walkRules(function(t){var n=t.prev();if(!r.isIgnoreAnnotation(n)){t.selector=selectorParser(function(t){t.walk(function(t){var n=[];if("selector"===t.type){var i=!0,o=!1,s=void 0;try{for(var a,c=t.nodes[Symbol.iterator]();!(i=(a=c.next()).done);i=!0){var u=a.value,f=u.type,l=u.value;SELECTOR_STANDARD_TYPES.includes(f)&&void 0!==l?n.push(l):"attribute"===f&&void 0!==u.raws.unquoted&&n.push(u.raws.unquoted)}}catch(t){o=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(o)throw s}}r.shouldKeepSelector(e,n)||t.remove()}})}).processSync(t.selector);var i=t.parent;t.selector||t.remove(),r.isRuleEmpty(i)&&i.remove()}}),n.toString()}},{key:"isIgnoreAnnotation",value:function(t){return!(!t||"comment"!==t.type)&&t.text.includes(IGNORE_ANNOTATION)}},{key:"isRuleEmpty",value:function(t){return!!("decl"===t.type&&!t.value||"rule"===t.type&&!t.selector||t.nodes&&!t.nodes.length||"atrule"===t.type&&(!t.nodes&&!t.params||!t.params&&!t.nodes.length))}},{key:"shouldKeepSelector",value:function(t,e){var r=!0,n=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var a=o.value;if(this.options.legacy){var c=a.split(/[^a-z]/g),u=!1,f=!0,l=!1,h=void 0;try{for(var p,d=c[Symbol.iterator]();!(f=(p=d.next()).done);f=!0){var m=p.value;if(m){if(!t.has(m))break;u=!0}}}catch(t){l=!0,h=t}finally{try{!f&&d.return&&d.return()}finally{if(l)throw h}}if(u)return!0;if(t.has(a)||CSS_WHITELIST.includes(a)||this.isSelectorWhitelisted(a))return!0}else{if(a.startsWith(":"))continue;if(!(t.has(a)||CSS_WHITELIST.includes(a)||this.isSelectorWhitelisted(a)))return!1}}}catch(t){n=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return!this.options.legacy}},{key:"isSelectorWhitelisted",value:function(t){return!!(CSS_WHITELIST.includes(t)||this.options.whitelist&&this.options.whitelist.some(function(e){return e===t})||this.options.whitelistPatterns&&this.options.whitelistPatterns.some(function(e){return e.test(t)}))}}]),t}();export default Purgecss; +function normalizeArray(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function resolve(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(t=n+"/"+t,e="/"===n.charAt(0))}return t=normalizeArray(filter(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."}function normalize(t){var e=isAbsolute(t),r="/"===substr(t,-1);return(t=normalizeArray(filter(t.split("/"),function(t){return!!t}),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t}function isAbsolute(t){return"/"===t.charAt(0)}function join(){return normalize(filter(Array.prototype.slice.call(arguments,0),function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))}function relative(t,e){function r(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=resolve(t).substr(1),e=resolve(e).substr(1);for(var n=r(t.split("/")),i=r(e.split("/")),o=Math.min(n.length,i.length),s=o,a=0;a=0&&u>0){for(n=[],o=r.length;f>=0&&!a;)f==c?(n.push(f),c=r.indexOf(t,f+1)):1==n.length?a=[n.pop(),u]:((i=n.pop())=0?c:u;n.length&&(a=[o,s])}return a}function numeric(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function escapeBraces(t){return t.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod)}function unescapeBraces(t){return t.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".")}function parseCommaParts(t){if(!t)return[""];var e=[],r=balancedMatch("{","}",t);if(!r)return t.split(",");var n=r.pre,i=r.body,o=r.post,s=n.split(",");s[s.length-1]+="{"+i+"}";var a=parseCommaParts(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function expandTop(t){return t?("{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2)),expand(escapeBraces(t),!0).map(unescapeBraces)):[]}function embrace(t){return"{"+t+"}"}function isPadded(t){return/^-?0\d/.test(t)}function lte(t,e){return t<=e}function gte(t,e){return t>=e}function expand(t,e){var r=[],n=balancedMatch("{","}",t);if(!n||/\$$/.test(n.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),s=i||o,a=n.body.indexOf(",")>=0;if(!s&&!a)return n.post.match(/,.*\}/)?(t=n.pre+"{"+n.body+escClose+n.post,expand(t)):[t];var c;if(s)c=n.body.split(/\.\./);else if(1===(c=parseCommaParts(n.body)).length&&1===(c=expand(c[0],!1).map(embrace)).length)return(l=n.post.length?expand(n.post,!1):[""]).map(function(t){return n.pre+c[0]+t});var u,f=n.pre,l=n.post.length?expand(n.post,!1):[""];if(s){var h=numeric(c[0]),p=numeric(c[1]),d=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(numeric(c[2])):1,g=lte;p0){var w=new Array(E+1).join("0");b=v<0?"-"+w+b.slice(1):w+b}}u.push(b)}}else u=concatMap(c,function(t){return expand(t,!1)});for(var _=0;_65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===t)return GLOBSTAR;if(""===t)return"";for(var i,o,s="",a=!!n.nocase,c=!1,u=[],f=[],l=!1,h=-1,p=-1,d="."===t.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",m=this,g=0,y=t.length;g-1;A--){var T=f[A],$=s.slice(0,T.reStart),k=s.slice(T.reStart,T.reEnd-8),O=s.slice(T.reEnd-8,T.reEnd),R=s.slice(T.reEnd);O+=R;var x=$.split("(").length-1,B=R;for(g=0;g=0&&!(i=t[o]);o--);for(o=0;o1)for(var r=1;r=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),s=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),isBoolean(e)?r.showHidden=e:e&&_extend(r,e),isUndefined(r.showHidden)&&(r.showHidden=!1),isUndefined(r.depth)&&(r.depth=2),isUndefined(r.colors)&&(r.colors=!1),isUndefined(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=stylizeWithColor),formatValue(r,t,r.depth)}function stylizeWithColor(t,e){var r=inspect.styles[e];return r?"["+inspect.colors[r][0]+"m"+t+"["+inspect.colors[r][1]+"m":t}function stylizeNoColor(t,e){return t}function arrayToHash(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function formatValue(t,e,r){if(t.customInspect&&e&&isFunction(e.inspect)&&e.inspect!==inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return isString(n)||(n=formatValue(t,n,r)),n}var i=formatPrimitive(t,e);if(i)return i;var o=Object.keys(e),s=arrayToHash(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),isError(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(e);if(0===o.length){if(isFunction(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(isRegExp(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(isDate(e))return t.stylize(Date.prototype.toString.call(e),"date");if(isError(e))return formatError(e)}var c="",u=!1,f=["{","}"];if(isArray$1(e)&&(u=!0,f=["[","]"]),isFunction(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),isRegExp(e)&&(c=" "+RegExp.prototype.toString.call(e)),isDate(e)&&(c=" "+Date.prototype.toUTCString.call(e)),isError(e)&&(c=" "+formatError(e)),0===o.length&&(!u||0==e.length))return f[0]+c+f[1];if(r<0)return isRegExp(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var l;return l=u?formatArray(t,e,r,s,o):o.map(function(n){return formatProperty(t,e,r,s,n,u)}),t.seen.pop(),reduceToSingleString(l,c,f)}function formatPrimitive(t,e){if(isUndefined(e))return t.stylize("undefined","undefined");if(isString(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return isNumber(e)?t.stylize(""+e,"number"):isBoolean(e)?t.stylize(""+e,"boolean"):isNull(e)?t.stylize("null","null"):void 0}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatArray(t,e,r,n,i){for(var o=[],s=0,a=e.length;s-1&&(a=o?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n")):a=t.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function reduceToSingleString(t,e,r){var n=0;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function isArray$1(t){return Array.isArray(t)}function isBoolean(t){return"boolean"==typeof t}function isNull(t){return null===t}function isNullOrUndefined(t){return null==t}function isNumber(t){return"number"==typeof t}function isString(t){return"string"==typeof t}function isSymbol(t){return"symbol"===(void 0===t?"undefined":_typeof(t))}function isUndefined(t){return void 0===t}function isRegExp(t){return isObject(t)&&"[object RegExp]"===objectToString(t)}function isObject(t){return"object"===(void 0===t?"undefined":_typeof(t))&&null!==t}function isDate(t){return isObject(t)&&"[object Date]"===objectToString(t)}function isError(t){return isObject(t)&&("[object Error]"===objectToString(t)||t instanceof Error)}function isFunction(t){return"function"==typeof t}function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===(void 0===t?"undefined":_typeof(t))||void 0===t}function isBuffer(t){return Buffer.isBuffer(t)}function objectToString(t){return Object.prototype.toString.call(t)}function pad(t){return t<10?"0"+t.toString(10):t.toString(10)}function timestamp(){var t=new Date,e=[pad(t.getHours()),pad(t.getMinutes()),pad(t.getSeconds())].join(":");return[t.getDate(),months[t.getMonth()],e].join(" ")}function log(){console.log("%s - %s",timestamp(),format.apply(null,arguments))}function _extend(t,e){if(!e||!isObject(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function hasOwnProperty(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function EventHandlers(){}function EventEmitter(){EventEmitter.init.call(this)}function $getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function emitNone(t,e,r){if(e)t.call(r);else for(var n=t.length,i=arrayClone(t,n),o=0;o0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,emitWarning(a)}}else s=o[e]=r,++t._eventsCount;return t}function emitWarning(t){"function"==typeof console.warn?console.warn(t):console.log(t)}function _onceWrap(t,e,r){function n(){t.removeListener(e,n),i||(i=!0,r.apply(t,arguments))}var i=!1;return n.listener=r,n}function listenerCount(t){var e=this._events;if(e){var r=e[t];if("function"==typeof r)return 1;if(r)return r.length}return 0}function spliceOne(t,e){for(var r=e,n=r+1,i=t.length;n0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new Arr(3*a/4-o),n=o>0?a-4:a;var c=0;for(e=0,r=0;e>16&255,s[c++]=i>>8&255,s[c++]=255&i;return 2===o?(i=revLookup[t.charCodeAt(e)]<<2|revLookup[t.charCodeAt(e+1)]>>4,s[c++]=255&i):1===o&&(i=revLookup[t.charCodeAt(e)]<<10|revLookup[t.charCodeAt(e+1)]<<4|revLookup[t.charCodeAt(e+2)]>>2,s[c++]=i>>8&255,s[c++]=255&i),s}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[63&t]}function encodeChunk(t,e,r){for(var n,i=[],o=e;oa?a:s+16383));return 1===n?(e=t[r-1],i+=lookup[e>>2],i+=lookup[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=lookup[e>>10],i+=lookup[e>>4&63],i+=lookup[e<<2&63],i+="="),o.push(i),o.join("")}function read(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,f=-7,l=r?i-1:0,h=r?-1:1,p=t[e+l];for(l+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+t[e+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+t[e+l],l+=h,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=u}return(p?-1:1)*s*Math.pow(2,o-n)}function write(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,f=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=d,s/=256,u-=8);t[r+p-d]|=128*m}function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,e){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function internalIsBuffer(t){return!(null==t||!t._isBuffer)}function byteLength(t,e){if(internalIsBuffer(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 n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(t).length;default:if(n)return utf8ToBytes(t).length;e=(""+e).toLowerCase(),n=!0}}function slowToString(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 hexSlice(this,e,r);case"utf8":case"utf-8":return utf8Slice(this,e,r);case"ascii":return asciiSlice(this,e,r);case"latin1":case"binary":return latin1Slice(this,e,r);case"base64":return base64Slice(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function swap(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function bidirectionalIndexOf(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=Buffer$1.from(e,n)),internalIsBuffer(e))return 0===e.length?-1:arrayIndexOf(t,e,r,n,i);if("number"==typeof e)return e&=255,Buffer$1.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):arrayIndexOf(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=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;s=2,a/=2,c/=2,r/=2}var u;if(i){var f=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var l=!0,h=0;hi&&(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 s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var c,u,f,l;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(c=t[i+1]))&&(l=(31&o)<<6|63&c)>127&&(s=l);break;case 3:c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&(l=(15&o)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:c=t[i+1],u=t[i+2],f=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&f)&&(l=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&f)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return decodeCodePointsArray(n)}function decodeCodePointsArray(t){var e=t.length;if(e<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,e,r,n,i,o){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function objectWriteUInt32(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function checkIEEE754(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 writeFloat(t,e,r,n,i){return i||checkIEEE754(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),write(t,e,r,n,23,4),r+4}function writeDouble(t,e,r,n,i){return i||checkIEEE754(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),write(t,e,r,n,52,8),r+8}function base64clean(t){if((t=stringtrim(t).replace(INVALID_BASE64_RE,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+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 asciiToBytes(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function base64ToBytes(t){return toByteArray(base64clean(t))}function blitBuffer(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function isnan(t){return t!=t}function isBuffer$1(t){return null!=t&&(!!t._isBuffer||isFastBuffer(t)||isSlowBuffer(t))}function isFastBuffer(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function isSlowBuffer(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&isFastBuffer(t.slice(0,0))}function compare(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}}function truncate(t,e){return"string"==typeof t?t.length=0;a--)if(c[a]!==u[a])return!1;for(a=c.length-1;a>=0;a--)if(s=c[a],!_deepEqual(t[s],e[s],r,n))return!1;return!0}function notDeepEqual(t,e,r){_deepEqual(t,e,!1)&&fail(t,e,r,"notDeepEqual",notDeepEqual)}function notDeepStrictEqual(t,e,r){_deepEqual(t,e,!0)&&fail(t,e,r,"notDeepStrictEqual",notDeepStrictEqual)}function strictEqual(t,e,r){t!==e&&fail(t,e,r,"===",strictEqual)}function notStrictEqual(t,e,r){t===e&&fail(t,e,r,"!==",notStrictEqual)}function expectedException(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function _tryBlock(t){var e;try{t()}catch(t){e=t}return e}function _throws(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=_tryBlock(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&fail(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&isError(i),a=!t&&i&&!r;if((s&&o&&expectedException(i,r)||a)&&fail(i,r,"Got unwanted exception"+n),t&&i&&r&&!expectedException(i,r)||!t&&i)throw i}function throws(t,e,r){_throws(!0,t,e,r)}function doesNotThrow(t,e,r){_throws(!1,t,e,r)}function ifError(t){if(t)throw t}function posix(t){return"/"===t.charAt(0)}function win32(t){var e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),r=e[1]||"",n=Boolean(r&&":"!==r.charAt(1));return Boolean(e[2]||n)}function ownProp$2(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function alphasorti$2(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())}function alphasort$2(t,e){return t.localeCompare(e)}function setupIgnores(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(ignoreMap))}function ignoreMap(t){var e=null;if("/**"===t.slice(-3)){var r=t.replace(/(\/\*\*)+$/,"");e=new Minimatch$3(r,{dot:!0})}return{matcher:new Minimatch$3(t,{dot:!0}),gmatcher:e}}function setopts$2(t,e,r){if(r||(r={}),r.matchBase&&-1===e.indexOf("/")){if(r.noglobstar)throw new Error("base matching requires globstar");e="**/"+e}t.silent=!!r.silent,t.pattern=e,t.strict=!1!==r.strict,t.realpath=!!r.realpath,t.realpathCache=r.realpathCache||Object.create(null),t.follow=!!r.follow,t.dot=!!r.dot,t.mark=!!r.mark,t.nodir=!!r.nodir,t.nodir&&(t.mark=!0),t.sync=!!r.sync,t.nounique=!!r.nounique,t.nonull=!!r.nonull,t.nosort=!!r.nosort,t.nocase=!!r.nocase,t.stat=!!r.stat,t.noprocess=!!r.noprocess,t.absolute=!!r.absolute,t.maxLength=r.maxLength||1/0,t.cache=r.cache||Object.create(null),t.statCache=r.statCache||Object.create(null),t.symlinks=r.symlinks||Object.create(null),setupIgnores(t,r),t.changedCwd=!1;var n=process.cwd();ownProp$2(r,"cwd")?(t.cwd=path$2.resolve(r.cwd),t.changedCwd=t.cwd!==n):t.cwd=n,t.root=r.root||path$2.resolve(t.cwd,"/"),t.root=path$2.resolve(t.root),"win32"===process.platform&&(t.root=t.root.replace(/\\/g,"/")),t.cwdAbs=pathIsAbsolute(t.cwd)?t.cwd:makeAbs(t,t.cwd),"win32"===process.platform&&(t.cwdAbs=t.cwdAbs.replace(/\\/g,"/")),t.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,t.minimatch=new Minimatch$3(e,r),t.options=t.minimatch.options}function finish(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,i=t.matches.length;nn?(r.splice(0,n),process.nextTick(function(){e.apply(null,i)})):delete reqs[t]}})}function slice(t){for(var e=t.length,r=[],n=0;n=t.length)return e&&(e[l]=t),r(null,t);nextPartRe.lastIndex=a;var n=nextPartRe.exec(t);return f=c,c+=n[0],u=f+n[1],a=nextPartRe.lastIndex,p[u]||e&&e[u]===u?process.nextTick(i):e&&Object.prototype.hasOwnProperty.call(e,u)?s(e[u]):fs.lstat(u,function(t,n){if(t)return r(t);if(!n.isSymbolicLink())return p[u]=!0,e&&(e[u]=u),process.nextTick(i);if(!isWindows){var s=n.dev.toString(32)+":"+n.ino.toString(32);if(h.hasOwnProperty(s))return o(null,h[s],u)}fs.stat(u,function(t){if(t)return r(t);fs.readlink(u,function(t,e){isWindows||(h[s]=e),o(t,e)})})})}function o(t,n,i){if(t)return r(t);var o=path$2.resolve(f,n);e&&(e[i]=o),s(o)}function s(e){t=path$2.resolve(e,t.slice(a)),n()}if("function"!=typeof r&&(r=maybeCallback(e),e=null),t=path$2.resolve(t),e&&Object.prototype.hasOwnProperty.call(e,t))return process.nextTick(r.bind(null,null,e[t]));var a,c,u,f,l=t,h={},p={};n()},old={realpathSync:realpathSync$1,realpath:realpath$1},fs_realpath=realpath;realpath.realpath=realpath,realpath.sync=realpathSync,realpath.realpathSync=realpathSync,realpath.monkeypatch=monkeypatch,realpath.unmonkeypatch=unmonkeypatch;var origRealpath=fs.realpath,origRealpathSync=fs.realpathSync,version=process.version,ok=/^v[0-5]\./.test(version),concatMap=function(t,e){for(var r=[],n=0;n>> no match, partial?",t,f,e,l),f!==s))}var p;if("string"==typeof c?(p=n.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,p)):(p=u.match(c),this.debug("pattern match",c,u,p)),!p)return!1}if(i===s&&o===a)return!0;if(i===s)return r;if(o===a)return i===s-1&&""===t[i];throw new Error("wtf?")};var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;"function"==typeof global.setTimeout&&(cachedSetTimeout=setTimeout),"function"==typeof global.clearTimeout&&(cachedClearTimeout=clearTimeout);var currentQueue,queue=[],draining=!1,queueIndex=-1;Item.prototype.run=function(){this.fun.apply(null,this.array)};var inherits$2,debugEnviron,title="browser",platform="browser",browser=!0,env={},argv=[],version$1="",versions={},release={},config={},on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop,performance=global.performance||{},performanceNow=performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()},startTime=new Date,process$1={nextTick:nextTick,title:title,browser:browser,env:env,argv:argv,version:version$1,versions:versions,on:on,addListener:addListener,once:once,off:off,removeListener:removeListener,removeAllListeners:removeAllListeners,emit:emit,binding:binding,cwd:cwd,chdir:chdir,umask:umask,hrtime:hrtime,platform:platform,release:release,config:config,uptime:uptime},inherits$3=inherits$2="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},asyncGenerator=function(){function t(t){this.value=t}function e(e){function r(i,o){try{var s=e[i](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):n(s.done?"return":"normal",s.value)}catch(t){n("throw",t)}}function n(t,e){switch(t){case"return":i.resolve({value:e,done:!0});break;case"throw":i.reject(e);break;default:i.resolve({value:e,done:!1})}(i=i.next)?r(i.key,i.arg):o=null}var i,o;this._invoke=function(t,e){return new Promise(function(n,s){var a={key:t,arg:e,resolve:n,reject:s,next:null};o?o=o.next=a:(i=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)},{wrap:function(t){return function(){return new e(t.apply(this,arguments))}},await:function(e){return new t(e)}}}(),classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},createClass=function(){function t(t,e){for(var r=0;r0;)if(r[o]===e||r[o].listener&&r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new EventHandlers,this;delete n[t]}else spliceOne(r,i);n.removeListener&&this.emit("removeListener",t,s||e)}return this},EventEmitter.prototype.removeAllListeners=function(t){var e,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new EventHandlers,this._eventsCount=0):r[t]&&(0==--this._eventsCount?this._events=new EventHandlers:delete r[t]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o0?Reflect.ownKeys(this._events):[]};var events=Object.freeze({default:EventEmitter,EventEmitter:EventEmitter}),lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,inited=!1,toString={}.toString,isArray$2=Array.isArray||function(t){return"[object Array]"==toString.call(t)},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var _kMaxLength=kMaxLength();Buffer$1.poolSize=8192,Buffer$1._augment=function(t){return t.__proto__=Buffer$1.prototype,t},Buffer$1.from=function(t,e,r){return from(null,t,e,r)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array),Buffer$1.alloc=function(t,e,r){return alloc(null,t,e,r)},Buffer$1.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer$1.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer$1.isBuffer=isBuffer$1,Buffer$1.compare=function(t,e){if(!internalIsBuffer(t)||!internalIsBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},Buffer$1.prototype.compare=function(t,e,r,n,i){if(!internalIsBuffer(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===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,a=Math.min(o,s),c=this.slice(n,i),u=t.slice(e,r),f=0;fi)&&(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 hexWrite(this,t,e,r);case"utf8":case"utf-8":return utf8Write(this,t,e,r);case"ascii":return asciiWrite(this,t,e,r);case"latin1":case"binary":return latin1Write(this,t,e,r);case"base64":return base64Write(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Buffer$1.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer$1.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),e0&&(i*=256);)n+=this[t+--e]*i;return n},Buffer$1.prototype.readUInt8=function(t,e){return e||checkOffset(t,1,this.length),this[t]},Buffer$1.prototype.readUInt16LE=function(t,e){return e||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer$1.prototype.readUInt16BE=function(t,e){return e||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer$1.prototype.readUInt32LE=function(t,e){return e||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer$1.prototype.readUInt32BE=function(t,e){return e||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer$1.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},Buffer$1.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||checkOffset(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},Buffer$1.prototype.readInt8=function(t,e){return e||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer$1.prototype.readInt16LE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Buffer$1.prototype.readInt16BE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Buffer$1.prototype.readInt32LE=function(t,e){return e||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer$1.prototype.readInt32BE=function(t,e){return e||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer$1.prototype.readFloatLE=function(t,e){return e||checkOffset(t,4,this.length),read(this,t,!0,23,4)},Buffer$1.prototype.readFloatBE=function(t,e){return e||checkOffset(t,4,this.length),read(this,t,!1,23,4)},Buffer$1.prototype.readDoubleLE=function(t,e){return e||checkOffset(t,8,this.length),read(this,t,!0,52,8)},Buffer$1.prototype.readDoubleBE=function(t,e){return e||checkOffset(t,8,this.length),read(this,t,!1,52,8)},Buffer$1.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||checkInt(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},Buffer$1.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Buffer$1.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer$1.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer$1.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):objectWriteUInt32(this,t,e,!0),e+4},Buffer$1.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer$1.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);checkInt(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},Buffer$1.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);checkInt(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},Buffer$1.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Buffer$1.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer$1.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer$1.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):objectWriteUInt32(this,t,e,!0),e+4},Buffer$1.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer$1.prototype.writeFloatLE=function(t,e,r){return writeFloat(this,t,e,!0,r)},Buffer$1.prototype.writeFloatBE=function(t,e,r){return writeFloat(this,t,e,!1,r)},Buffer$1.prototype.writeDoubleLE=function(t,e,r){return writeDouble(this,t,e,!0,r)},Buffer$1.prototype.writeDoubleBE=function(t,e,r){return writeDouble(this,t,e,!1,r)},Buffer$1.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;othis.maxLength)return!1;if(!this.stat&&ownProp$1(this.cache,e)){o=this.cache[e];if(Array.isArray(o)&&(o="DIR"),!r||"DIR"===o)return o;if(r&&"FILE"===o)return!1}var n=this.statCache[e];if(!n){var i;try{i=fs.lstatSync(e)}catch(t){if(t&&("ENOENT"===t.code||"ENOTDIR"===t.code))return this.statCache[e]=!1,!1}if(i&&i.isSymbolicLink())try{n=fs.statSync(e)}catch(t){n=i}else n=i}this.statCache[e]=n;var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||o,(!r||"FILE"!==o)&&o},GlobSync$1.prototype._mark=function(t){return common.mark(this,t)},GlobSync$1.prototype._makeAbs=function(t){return common.makeAbs(this,t)};var wrappy_1=wrappy,once_1=wrappy_1(once$1),strict=wrappy_1(onceStrict);once$1.proto=once$1(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once$1(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})}),once_1.strict=strict;var reqs=Object.create(null),inflight_1=wrappy_1(inflight),require$$0$2=events&&EventEmitter||events,glob_1=glob,EE=require$$0$2.EventEmitter,setopts=common.setopts,ownProp=common.ownProp,childrenIgnored=common.childrenIgnored,isIgnored=common.isIgnored;glob.sync=sync;var GlobSync=glob.GlobSync=sync.GlobSync;glob.glob=glob,glob.hasMagic=function(t,e){var r=extend({},e);r.noprocess=!0;var n=new Glob(t,r).minimatch.set;if(!t)return!1;if(n.length>1)return!0;for(var i=0;ithis.maxLength)return e();if(!this.stat&&ownProp(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||"DIR"===i)return e(null,i);if(n&&"FILE"===i)return e()}var o=this.statCache[r];if(void 0!==o){if(!1===o)return e(null,o);var s=o.isDirectory()?"DIR":"FILE";return n&&"FILE"===s?e():e(null,s,o)}var a=this,c=inflight_1("stat\0"+r,function(n,i){if(i&&i.isSymbolicLink())return fs.stat(r,function(n,o){n?a._stat2(t,r,null,i,e):a._stat2(t,r,n,o,e)});a._stat2(t,r,n,i,e)});c&&fs.lstat(r,c)},Glob.prototype._stat2=function(t,e,r,n,i){if(r&&("ENOENT"===r.code||"ENOTDIR"===r.code))return this.statCache[e]=!1,i();var o="/"===t.slice(-1);if(this.statCache[e]=n,"/"===e.slice(-1)&&n&&!n.isDirectory())return i(null,!1,n);var s=!0;return n&&(s=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||s,o&&"FILE"===s?i():i(null,s,n)};var defaultOptions={css:[],content:[],extractors:[],whitelist:[],output:void 0,stdout:!1,info:!1,rejected:!1},IGNORE_ANNOTATION="purgecss ignore",CONFIG_FILENAME="purgecss.config.js",ERROR_CONFIG_FILE_LOADING="Error loading the config file",ERROR_MISSING_CONTENT="No content provided.",ERROR_MISSING_CSS="No css provided.",ERROR_EXTRACTER_FAILED="The extractor has failed to extract the selectors.",ERROR_OPTIONS_TYPE="Error Type Options: expected an object",ERROR_OUTPUT_TYPE="Error Type option output: expected a string",ERROR_EXTRACTERS_TYPE="Error Type option extractors: expected an array",ERROR_WHITELIST_TYPE="Error Type option whitelist: expected an array",ERROR_WHITELIST_PATTERNS_TYPE="Error Type option whitelistPatterns: expected an array",ERROR_STDOUT_TYPE="Error Type option stdout: expected a boolean",ERROR_INFO_TYPE="Error Type option info: expected a boolean",ERROR_REJECTED_TYPE="Error Type option rejected: expected a boolean",CSS_WHITELIST=["*","::-webkit-scrollbar","::selection",":root","::before","::after"],SELECTOR_STANDARD_TYPES=["class","tag","id","universal","pseudo"],DefaultExtractor=function(){function t(){classCallCheck(this,t)}return createClass(t,null,[{key:"extract",value:function(t){return t.match(/[A-z0-9-]+/g)}}]),t}(),LegacyExtractor=function(){function t(){classCallCheck(this,t)}return createClass(t,null,[{key:"extract",value:function(t){return t.split(/[^a-z]/g)}}]),t}(),Purgecss=function(){function t(e){classCallCheck(this,t),"string"!=typeof e&&void 0!==e||(e=this.loadConfigFile(e)),this.checkOptions(e),this.options=Object.assign(defaultOptions,e)}return createClass(t,[{key:"loadConfigFile",value:function(t){var e=void 0===t?CONFIG_FILENAME:t,r=void 0;try{var n=path.resolve(process.cwd(),e);r=require(n)}catch(t){throw new Error(ERROR_CONFIG_FILE_LOADING+t.message)}return r}},{key:"checkOptions",value:function(t){if("object"!==(void 0===t?"undefined":_typeof(t)))throw new TypeError(ERROR_OPTIONS_TYPE);if(!t.content||!t.content.length)throw new Error(ERROR_MISSING_CONTENT);if(!t.css||!t.css.length)throw new Error(ERROR_MISSING_CSS);if(t.output&&"string"!=typeof t.output)throw new TypeError(ERROR_OUTPUT_TYPE);if(t.extractors&&!Array.isArray(t.extractors))throw new TypeError(ERROR_EXTRACTERS_TYPE);if(t.whitelist&&!Array.isArray(t.whitelist))throw new TypeError(ERROR_WHITELIST_TYPE);if(t.stdout&&"boolean"!=typeof t.stdout)throw new TypeError(ERROR_STDOUT_TYPE);if(t.info&&"boolean"!=typeof t.info)throw new TypeError(ERROR_INFO_TYPE);if(t.rejected&&"boolean"!=typeof t.rejected)throw new TypeError(ERROR_REJECTED_TYPE);if(t.whitelistPatterns&&!Array.isArray(t.whitelistPatterns))throw new TypeError(ERROR_WHITELIST_PATTERNS_TYPE)}},{key:"purge",value:function(){var t=this.extractFileSelector(this.options.content,this.options.extractors),e=[],r=!0,n=!1,i=void 0;try{for(var o,s=this.options.css[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var a=o.value,c=this.options.stdin?a:fs.readFileSync(a,"utf8");e.push({file:a,css:this.getSelectorsCss(c,t)})}}catch(t){n=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return e}},{key:"extractFileSelector",value:function(t,e){var r=new Set,n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var c=s.value,u=[];fs.existsSync(c)?u.push(c):u=glob_1.sync(c);var f=!0,l=!1,h=void 0;try{for(var p,d=u[Symbol.iterator]();!(f=(p=d.next()).done);f=!0){var m=p.value,g=fs.readFileSync(m,"utf8"),y=this.getFileExtractor(m,e);r=new Set([].concat(toConsumableArray(r),toConsumableArray(this.extractSelectors(g,y))))}}catch(t){l=!0,h=t}finally{try{!f&&d.return&&d.return()}finally{if(l)throw h}}}}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}},{key:"getFileExtractor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length?e.find(function(e){return e.extensions.find(function(e){return t.endsWith(e)})}).extractor:!0===this.options.legacy?LegacyExtractor:DefaultExtractor}},{key:"extractSelectors",value:function(t,e){var r=new Set,n=e.extract(t);if(null===n)throw new Error(ERROR_EXTRACTER_FAILED);return n.forEach(function(t){r.add(t)}),r.delete(""),r}},{key:"getSelectorsCss",value:function(t,e){var r=this,n=postcss.parse(t);return n.walkRules(function(t){var n=t.prev();if(!r.isIgnoreAnnotation(n)){t.selector=selectorParser(function(t){t.walk(function(t){var n=[];if("selector"===t.type){var i=!0,o=!1,s=void 0;try{for(var a,c=t.nodes[Symbol.iterator]();!(i=(a=c.next()).done);i=!0){var u=a.value,f=u.type,l=u.value;SELECTOR_STANDARD_TYPES.includes(f)&&void 0!==l?n.push(l):"attribute"===f&&void 0!==u.raws.unquoted&&n.push(u.raws.unquoted)}}catch(t){o=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(o)throw s}}r.shouldKeepSelector(e,n)||t.remove()}})}).processSync(t.selector);var i=t.parent;t.selector||t.remove(),r.isRuleEmpty(i)&&i.remove()}}),n.toString()}},{key:"isIgnoreAnnotation",value:function(t){return!(!t||"comment"!==t.type)&&t.text.includes(IGNORE_ANNOTATION)}},{key:"isRuleEmpty",value:function(t){return!!("decl"===t.type&&!t.value||"rule"===t.type&&!t.selector||t.nodes&&!t.nodes.length||"atrule"===t.type&&(!t.nodes&&!t.params||!t.params&&!t.nodes.length))}},{key:"shouldKeepSelector",value:function(t,e){var r=!0,n=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var a=o.value;if(this.options.legacy){var c=a.split(/[^a-z]/g),u=!1,f=!0,l=!1,h=void 0;try{for(var p,d=c[Symbol.iterator]();!(f=(p=d.next()).done);f=!0){var m=p.value;if(m){if(!t.has(m))break;u=!0}}}catch(t){l=!0,h=t}finally{try{!f&&d.return&&d.return()}finally{if(l)throw h}}if(u)return!0;if(t.has(a)||CSS_WHITELIST.includes(a)||this.isSelectorWhitelisted(a))return!0}else{if(a.startsWith(":"))continue;if(!(t.has(a)||CSS_WHITELIST.includes(a)||this.isSelectorWhitelisted(a)))return!1}}}catch(t){n=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return!this.options.legacy}},{key:"isSelectorWhitelisted",value:function(t){return!!(CSS_WHITELIST.includes(t)||this.options.whitelist&&this.options.whitelist.some(function(e){return e===t})||this.options.whitelistPatterns&&this.options.whitelistPatterns.some(function(e){return e.test(t)}))}}]),t}();export default Purgecss; diff --git a/lib/purgecss.js b/lib/purgecss.js index c72a0aa5..3fe877dc 100644 --- a/lib/purgecss.js +++ b/lib/purgecss.js @@ -1 +1 @@ -"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function normalizeArray(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function resolve(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(t=n+"/"+t,e="/"===n.charAt(0))}return t=normalizeArray(filter(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."}function normalize(t){var e=isAbsolute(t),r="/"===substr(t,-1);return(t=normalizeArray(filter(t.split("/"),function(t){return!!t}),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t}function isAbsolute(t){return"/"===t.charAt(0)}function join(){return normalize(filter(Array.prototype.slice.call(arguments,0),function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))}function relative(t,e){function r(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=resolve(t).substr(1),e=resolve(e).substr(1);for(var n=r(t.split("/")),i=r(e.split("/")),o=Math.min(n.length,i.length),s=o,a=0;a=0&&u>0){for(n=[],o=r.length;f>=0&&!a;)f==c?(n.push(f),c=r.indexOf(t,f+1)):1==n.length?a=[n.pop(),u]:((i=n.pop())=0?c:u;n.length&&(a=[o,s])}return a}function numeric(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function escapeBraces(t){return t.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod)}function unescapeBraces(t){return t.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".")}function parseCommaParts(t){if(!t)return[""];var e=[],r=balancedMatch("{","}",t);if(!r)return t.split(",");var n=r.pre,i=r.body,o=r.post,s=n.split(",");s[s.length-1]+="{"+i+"}";var a=parseCommaParts(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function expandTop(t){return t?("{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2)),expand(escapeBraces(t),!0).map(unescapeBraces)):[]}function embrace(t){return"{"+t+"}"}function isPadded(t){return/^-?0\d/.test(t)}function lte(t,e){return t<=e}function gte(t,e){return t>=e}function expand(t,e){var r=[],n=balancedMatch("{","}",t);if(!n||/\$$/.test(n.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),s=i||o,a=n.body.indexOf(",")>=0;if(!s&&!a)return n.post.match(/,.*\}/)?(t=n.pre+"{"+n.body+escClose+n.post,expand(t)):[t];var c;if(s)c=n.body.split(/\.\./);else if(1===(c=parseCommaParts(n.body)).length&&1===(c=expand(c[0],!1).map(embrace)).length)return(l=n.post.length?expand(n.post,!1):[""]).map(function(t){return n.pre+c[0]+t});var u,f=n.pre,l=n.post.length?expand(n.post,!1):[""];if(s){var h=numeric(c[0]),p=numeric(c[1]),d=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(numeric(c[2])):1,g=lte;p0){var w=new Array(E+1).join("0");b=v<0?"-"+w+b.slice(1):w+b}}u.push(b)}}else u=concatMap(c,function(t){return expand(t,!1)});for(var _=0;_65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===t)return GLOBSTAR;if(""===t)return"";for(var i,o,s="",a=!!n.nocase,c=!1,u=[],f=[],l=!1,h=-1,p=-1,d="."===t.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",m=this,g=0,y=t.length;g-1;A--){var T=f[A],$=s.slice(0,T.reStart),k=s.slice(T.reStart,T.reEnd-8),O=s.slice(T.reEnd-8,T.reEnd),R=s.slice(T.reEnd);O+=R;var x=$.split("(").length-1,B=R;for(g=0;g=0&&!(i=t[o]);o--);for(o=0;o1)for(var r=1;r=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),s=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),isBoolean(e)?r.showHidden=e:e&&_extend(r,e),isUndefined(r.showHidden)&&(r.showHidden=!1),isUndefined(r.depth)&&(r.depth=2),isUndefined(r.colors)&&(r.colors=!1),isUndefined(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=stylizeWithColor),formatValue(r,t,r.depth)}function stylizeWithColor(t,e){var r=inspect.styles[e];return r?"["+inspect.colors[r][0]+"m"+t+"["+inspect.colors[r][1]+"m":t}function stylizeNoColor(t,e){return t}function arrayToHash(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function formatValue(t,e,r){if(t.customInspect&&e&&isFunction(e.inspect)&&e.inspect!==inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return isString(n)||(n=formatValue(t,n,r)),n}var i=formatPrimitive(t,e);if(i)return i;var o=Object.keys(e),s=arrayToHash(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),isError(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(e);if(0===o.length){if(isFunction(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(isRegExp(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(isDate(e))return t.stylize(Date.prototype.toString.call(e),"date");if(isError(e))return formatError(e)}var c="",u=!1,f=["{","}"];if(isArray$1(e)&&(u=!0,f=["[","]"]),isFunction(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),isRegExp(e)&&(c=" "+RegExp.prototype.toString.call(e)),isDate(e)&&(c=" "+Date.prototype.toUTCString.call(e)),isError(e)&&(c=" "+formatError(e)),0===o.length&&(!u||0==e.length))return f[0]+c+f[1];if(r<0)return isRegExp(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var l;return l=u?formatArray(t,e,r,s,o):o.map(function(n){return formatProperty(t,e,r,s,n,u)}),t.seen.pop(),reduceToSingleString(l,c,f)}function formatPrimitive(t,e){if(isUndefined(e))return t.stylize("undefined","undefined");if(isString(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return isNumber(e)?t.stylize(""+e,"number"):isBoolean(e)?t.stylize(""+e,"boolean"):isNull(e)?t.stylize("null","null"):void 0}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatArray(t,e,r,n,i){for(var o=[],s=0,a=e.length;s-1&&(a=o?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n")):a=t.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function reduceToSingleString(t,e,r){var n=0;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function isArray$1(t){return Array.isArray(t)}function isBoolean(t){return"boolean"==typeof t}function isNull(t){return null===t}function isNullOrUndefined(t){return null==t}function isNumber(t){return"number"==typeof t}function isString(t){return"string"==typeof t}function isSymbol(t){return"symbol"===(void 0===t?"undefined":_typeof(t))}function isUndefined(t){return void 0===t}function isRegExp(t){return isObject(t)&&"[object RegExp]"===objectToString(t)}function isObject(t){return"object"===(void 0===t?"undefined":_typeof(t))&&null!==t}function isDate(t){return isObject(t)&&"[object Date]"===objectToString(t)}function isError(t){return isObject(t)&&("[object Error]"===objectToString(t)||t instanceof Error)}function isFunction(t){return"function"==typeof t}function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===(void 0===t?"undefined":_typeof(t))||void 0===t}function isBuffer(t){return Buffer.isBuffer(t)}function objectToString(t){return Object.prototype.toString.call(t)}function pad(t){return t<10?"0"+t.toString(10):t.toString(10)}function timestamp(){var t=new Date,e=[pad(t.getHours()),pad(t.getMinutes()),pad(t.getSeconds())].join(":");return[t.getDate(),months[t.getMonth()],e].join(" ")}function log(){console.log("%s - %s",timestamp(),format.apply(null,arguments))}function _extend(t,e){if(!e||!isObject(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function hasOwnProperty(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function EventHandlers(){}function EventEmitter(){EventEmitter.init.call(this)}function $getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function emitNone(t,e,r){if(e)t.call(r);else for(var n=t.length,i=arrayClone(t,n),o=0;o0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,emitWarning(a)}}else s=o[e]=r,++t._eventsCount;return t}function emitWarning(t){"function"==typeof console.warn?console.warn(t):console.log(t)}function _onceWrap(t,e,r){function n(){t.removeListener(e,n),i||(i=!0,r.apply(t,arguments))}var i=!1;return n.listener=r,n}function listenerCount(t){var e=this._events;if(e){var r=e[t];if("function"==typeof r)return 1;if(r)return r.length}return 0}function spliceOne(t,e){for(var r=e,n=r+1,i=t.length;n0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new Arr(3*a/4-o),n=o>0?a-4:a;var c=0;for(e=0,r=0;e>16&255,s[c++]=i>>8&255,s[c++]=255&i;return 2===o?(i=revLookup[t.charCodeAt(e)]<<2|revLookup[t.charCodeAt(e+1)]>>4,s[c++]=255&i):1===o&&(i=revLookup[t.charCodeAt(e)]<<10|revLookup[t.charCodeAt(e+1)]<<4|revLookup[t.charCodeAt(e+2)]>>2,s[c++]=i>>8&255,s[c++]=255&i),s}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[63&t]}function encodeChunk(t,e,r){for(var n,i=[],o=e;oa?a:s+16383));return 1===n?(e=t[r-1],i+=lookup[e>>2],i+=lookup[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=lookup[e>>10],i+=lookup[e>>4&63],i+=lookup[e<<2&63],i+="="),o.push(i),o.join("")}function read(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,f=-7,l=r?i-1:0,h=r?-1:1,p=t[e+l];for(l+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+t[e+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+t[e+l],l+=h,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=u}return(p?-1:1)*s*Math.pow(2,o-n)}function write(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,f=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=d,s/=256,u-=8);t[r+p-d]|=128*m}function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,e){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function internalIsBuffer(t){return!(null==t||!t._isBuffer)}function byteLength(t,e){if(internalIsBuffer(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 n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(t).length;default:if(n)return utf8ToBytes(t).length;e=(""+e).toLowerCase(),n=!0}}function slowToString(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 hexSlice(this,e,r);case"utf8":case"utf-8":return utf8Slice(this,e,r);case"ascii":return asciiSlice(this,e,r);case"latin1":case"binary":return latin1Slice(this,e,r);case"base64":return base64Slice(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function swap(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function bidirectionalIndexOf(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=Buffer$1.from(e,n)),internalIsBuffer(e))return 0===e.length?-1:arrayIndexOf(t,e,r,n,i);if("number"==typeof e)return e&=255,Buffer$1.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):arrayIndexOf(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=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;s=2,a/=2,c/=2,r/=2}var u;if(i){var f=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var l=!0,h=0;hi&&(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 s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var c,u,f,l;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(c=t[i+1]))&&(l=(31&o)<<6|63&c)>127&&(s=l);break;case 3:c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&(l=(15&o)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:c=t[i+1],u=t[i+2],f=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&f)&&(l=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&f)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return decodeCodePointsArray(n)}function decodeCodePointsArray(t){var e=t.length;if(e<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,e,r,n,i,o){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function objectWriteUInt32(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function checkIEEE754(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 writeFloat(t,e,r,n,i){return i||checkIEEE754(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),write(t,e,r,n,23,4),r+4}function writeDouble(t,e,r,n,i){return i||checkIEEE754(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),write(t,e,r,n,52,8),r+8}function base64clean(t){if((t=stringtrim(t).replace(INVALID_BASE64_RE,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+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 asciiToBytes(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function base64ToBytes(t){return toByteArray(base64clean(t))}function blitBuffer(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function isnan(t){return t!==t}function isBuffer$1(t){return null!=t&&(!!t._isBuffer||isFastBuffer(t)||isSlowBuffer(t))}function isFastBuffer(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function isSlowBuffer(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&isFastBuffer(t.slice(0,0))}function compare(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}}function truncate(t,e){return"string"==typeof t?t.length=0;a--)if(c[a]!==u[a])return!1;for(a=c.length-1;a>=0;a--)if(s=c[a],!_deepEqual(t[s],e[s],r,n))return!1;return!0}function notDeepEqual(t,e,r){_deepEqual(t,e,!1)&&fail(t,e,r,"notDeepEqual",notDeepEqual)}function notDeepStrictEqual(t,e,r){_deepEqual(t,e,!0)&&fail(t,e,r,"notDeepStrictEqual",notDeepStrictEqual)}function strictEqual(t,e,r){t!==e&&fail(t,e,r,"===",strictEqual)}function notStrictEqual(t,e,r){t===e&&fail(t,e,r,"!==",notStrictEqual)}function expectedException(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function _tryBlock(t){var e;try{t()}catch(t){e=t}return e}function _throws(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=_tryBlock(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&fail(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&isError(i),a=!t&&i&&!r;if((s&&o&&expectedException(i,r)||a)&&fail(i,r,"Got unwanted exception"+n),t&&i&&r&&!expectedException(i,r)||!t&&i)throw i}function throws(t,e,r){_throws(!0,t,e,r)}function doesNotThrow(t,e,r){_throws(!1,t,e,r)}function ifError(t){if(t)throw t}function posix(t){return"/"===t.charAt(0)}function win32(t){var e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),r=e[1]||"",n=Boolean(r&&":"!==r.charAt(1));return Boolean(e[2]||n)}function ownProp$2(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function alphasorti$2(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())}function alphasort$2(t,e){return t.localeCompare(e)}function setupIgnores(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(ignoreMap))}function ignoreMap(t){var e=null;if("/**"===t.slice(-3)){var r=t.replace(/(\/\*\*)+$/,"");e=new Minimatch$3(r,{dot:!0})}return{matcher:new Minimatch$3(t,{dot:!0}),gmatcher:e}}function setopts$2(t,e,r){if(r||(r={}),r.matchBase&&-1===e.indexOf("/")){if(r.noglobstar)throw new Error("base matching requires globstar");e="**/"+e}t.silent=!!r.silent,t.pattern=e,t.strict=!1!==r.strict,t.realpath=!!r.realpath,t.realpathCache=r.realpathCache||Object.create(null),t.follow=!!r.follow,t.dot=!!r.dot,t.mark=!!r.mark,t.nodir=!!r.nodir,t.nodir&&(t.mark=!0),t.sync=!!r.sync,t.nounique=!!r.nounique,t.nonull=!!r.nonull,t.nosort=!!r.nosort,t.nocase=!!r.nocase,t.stat=!!r.stat,t.noprocess=!!r.noprocess,t.absolute=!!r.absolute,t.maxLength=r.maxLength||1/0,t.cache=r.cache||Object.create(null),t.statCache=r.statCache||Object.create(null),t.symlinks=r.symlinks||Object.create(null),setupIgnores(t,r),t.changedCwd=!1;var n=process.cwd();ownProp$2(r,"cwd")?(t.cwd=path$2.resolve(r.cwd),t.changedCwd=t.cwd!==n):t.cwd=n,t.root=r.root||path$2.resolve(t.cwd,"/"),t.root=path$2.resolve(t.root),"win32"===process.platform&&(t.root=t.root.replace(/\\/g,"/")),t.cwdAbs=pathIsAbsolute(t.cwd)?t.cwd:makeAbs(t,t.cwd),"win32"===process.platform&&(t.cwdAbs=t.cwdAbs.replace(/\\/g,"/")),t.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,t.minimatch=new Minimatch$3(e,r),t.options=t.minimatch.options}function finish(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,i=t.matches.length;nn?(r.splice(0,n),process.nextTick(function(){e.apply(null,i)})):delete reqs[t]}})}function slice(t){for(var e=t.length,r=[],n=0;n=t.length)return e&&(e[h]=t),r(null,t);nextPartRe.lastIndex=c;var n=nextPartRe.exec(t);return l=u,u+=n[0],f=l+n[1],c=nextPartRe.lastIndex,d[f]||e&&e[f]===f?process.nextTick(i):e&&Object.prototype.hasOwnProperty.call(e,f)?a(e[f]):fs.lstat(f,o)}function o(t,n){if(t)return r(t);if(!n.isSymbolicLink())return d[f]=!0,e&&(e[f]=f),process.nextTick(i);if(!isWindows){var o=n.dev.toString(32)+":"+n.ino.toString(32);if(p.hasOwnProperty(o))return s(null,p[o],f)}fs.stat(f,function(t){if(t)return r(t);fs.readlink(f,function(t,e){isWindows||(p[o]=e),s(t,e)})})}function s(t,n,i){if(t)return r(t);var o=path$2.resolve(l,n);e&&(e[i]=o),a(o)}function a(e){t=path$2.resolve(e,t.slice(c)),n()}if("function"!=typeof r&&(r=maybeCallback(e),e=null),t=path$2.resolve(t),e&&Object.prototype.hasOwnProperty.call(e,t))return process.nextTick(r.bind(null,null,e[t]));var c,u,f,l,h=t,p={},d={};n()},old={realpathSync:realpathSync$1,realpath:realpath$1},fs_realpath=realpath;realpath.realpath=realpath,realpath.sync=realpathSync,realpath.realpathSync=realpathSync,realpath.monkeypatch=monkeypatch,realpath.unmonkeypatch=unmonkeypatch;var origRealpath=fs.realpath,origRealpathSync=fs.realpathSync,version=process.version,ok=/^v[0-5]\./.test(version),concatMap=function(t,e){for(var r=[],n=0;n>> no match, partial?",t,f,e,l),f!==s))}var p;if("string"==typeof c?(p=n.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,p)):(p=u.match(c),this.debug("pattern match",c,u,p)),!p)return!1}if(i===s&&o===a)return!0;if(i===s)return r;if(o===a)return i===s-1&&""===t[i];throw new Error("wtf?")};var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;"function"==typeof global.setTimeout&&(cachedSetTimeout=setTimeout),"function"==typeof global.clearTimeout&&(cachedClearTimeout=clearTimeout);var queue=[],draining=!1,currentQueue,queueIndex=-1;Item.prototype.run=function(){this.fun.apply(null,this.array)};var title="browser",platform="browser",browser=!0,env={},argv=[],version$1="",versions={},release={},config={},on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop,performance=global.performance||{},performanceNow=performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()},startTime=new Date,process$1={nextTick:nextTick,title:title,browser:browser,env:env,argv:argv,version:version$1,versions:versions,on:on,addListener:addListener,once:once,off:off,removeListener:removeListener,removeAllListeners:removeAllListeners,emit:emit,binding:binding,cwd:cwd,chdir:chdir,umask:umask,hrtime:hrtime,platform:platform,release:release,config:config,uptime:uptime},inherits$2,inherits$3=inherits$2="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},asyncGenerator=function(){function t(t){this.value=t}function e(e){function r(i,o){try{var s=e[i](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):n(s.done?"return":"normal",s.value)}catch(t){n("throw",t)}}function n(t,e){switch(t){case"return":i.resolve({value:e,done:!0});break;case"throw":i.reject(e);break;default:i.resolve({value:e,done:!1})}(i=i.next)?r(i.key,i.arg):o=null}var i,o;this._invoke=function(t,e){return new Promise(function(n,s){var a={key:t,arg:e,resolve:n,reject:s,next:null};o?o=o.next=a:(i=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)},{wrap:function(t){return function(){return new e(t.apply(this,arguments))}},await:function(e){return new t(e)}}}(),classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},createClass=function(){function t(t,e){for(var r=0;r0;)if(r[o]===e||r[o].listener&&r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new EventHandlers,this;delete n[t]}else spliceOne(r,i);n.removeListener&&this.emit("removeListener",t,s||e)}return this},EventEmitter.prototype.removeAllListeners=function(t){var e,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new EventHandlers,this._eventsCount=0):r[t]&&(0==--this._eventsCount?this._events=new EventHandlers:delete r[t]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o0?Reflect.ownKeys(this._events):[]};var events=Object.freeze({default:EventEmitter,EventEmitter:EventEmitter}),lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,inited=!1,toString={}.toString,isArray$2=Array.isArray||function(t){return"[object Array]"==toString.call(t)},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var _kMaxLength=kMaxLength();Buffer$1.poolSize=8192,Buffer$1._augment=function(t){return t.__proto__=Buffer$1.prototype,t},Buffer$1.from=function(t,e,r){return from(null,t,e,r)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array),Buffer$1.alloc=function(t,e,r){return alloc(null,t,e,r)},Buffer$1.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer$1.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer$1.isBuffer=isBuffer$1,Buffer$1.compare=function(t,e){if(!internalIsBuffer(t)||!internalIsBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},Buffer$1.prototype.compare=function(t,e,r,n,i){if(!internalIsBuffer(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===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,a=Math.min(o,s),c=this.slice(n,i),u=t.slice(e,r),f=0;fi)&&(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 hexWrite(this,t,e,r);case"utf8":case"utf-8":return utf8Write(this,t,e,r);case"ascii":return asciiWrite(this,t,e,r);case"latin1":case"binary":return latin1Write(this,t,e,r);case"base64":return base64Write(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Buffer$1.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer$1.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),e0&&(i*=256);)n+=this[t+--e]*i;return n},Buffer$1.prototype.readUInt8=function(t,e){return e||checkOffset(t,1,this.length),this[t]},Buffer$1.prototype.readUInt16LE=function(t,e){return e||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer$1.prototype.readUInt16BE=function(t,e){return e||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer$1.prototype.readUInt32LE=function(t,e){return e||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer$1.prototype.readUInt32BE=function(t,e){return e||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer$1.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},Buffer$1.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||checkOffset(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},Buffer$1.prototype.readInt8=function(t,e){return e||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer$1.prototype.readInt16LE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Buffer$1.prototype.readInt16BE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Buffer$1.prototype.readInt32LE=function(t,e){return e||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer$1.prototype.readInt32BE=function(t,e){return e||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer$1.prototype.readFloatLE=function(t,e){return e||checkOffset(t,4,this.length),read(this,t,!0,23,4)},Buffer$1.prototype.readFloatBE=function(t,e){return e||checkOffset(t,4,this.length),read(this,t,!1,23,4)},Buffer$1.prototype.readDoubleLE=function(t,e){return e||checkOffset(t,8,this.length),read(this,t,!0,52,8)},Buffer$1.prototype.readDoubleBE=function(t,e){return e||checkOffset(t,8,this.length),read(this,t,!1,52,8)},Buffer$1.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||checkInt(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},Buffer$1.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Buffer$1.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer$1.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer$1.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):objectWriteUInt32(this,t,e,!0),e+4},Buffer$1.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer$1.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);checkInt(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},Buffer$1.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);checkInt(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},Buffer$1.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Buffer$1.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer$1.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer$1.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):objectWriteUInt32(this,t,e,!0),e+4},Buffer$1.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer$1.prototype.writeFloatLE=function(t,e,r){return writeFloat(this,t,e,!0,r)},Buffer$1.prototype.writeFloatBE=function(t,e,r){return writeFloat(this,t,e,!1,r)},Buffer$1.prototype.writeDoubleLE=function(t,e,r){return writeDouble(this,t,e,!0,r)},Buffer$1.prototype.writeDoubleBE=function(t,e,r){return writeDouble(this,t,e,!1,r)},Buffer$1.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;othis.maxLength)return!1;if(!this.stat&&ownProp$1(this.cache,e)){o=this.cache[e];if(Array.isArray(o)&&(o="DIR"),!r||"DIR"===o)return o;if(r&&"FILE"===o)return!1}var n=this.statCache[e];if(!n){var i;try{i=fs.lstatSync(e)}catch(t){if(t&&("ENOENT"===t.code||"ENOTDIR"===t.code))return this.statCache[e]=!1,!1}if(i&&i.isSymbolicLink())try{n=fs.statSync(e)}catch(t){n=i}else n=i}this.statCache[e]=n;var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||o,(!r||"FILE"!==o)&&o},GlobSync$1.prototype._mark=function(t){return common.mark(this,t)},GlobSync$1.prototype._makeAbs=function(t){return common.makeAbs(this,t)};var wrappy_1=wrappy,once_1=wrappy_1(once$1),strict=wrappy_1(onceStrict);once$1.proto=once$1(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once$1(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})}),once_1.strict=strict;var reqs=Object.create(null),inflight_1=wrappy_1(inflight),require$$0$2=events&&EventEmitter||events,glob_1=glob,EE=require$$0$2.EventEmitter,setopts=common.setopts,ownProp=common.ownProp,childrenIgnored=common.childrenIgnored,isIgnored=common.isIgnored;glob.sync=sync;var GlobSync=glob.GlobSync=sync.GlobSync;glob.glob=glob,glob.hasMagic=function(t,e){var r=extend({},e);r.noprocess=!0;var n=new Glob(t,r).minimatch.set;if(!t)return!1;if(n.length>1)return!0;for(var i=0;ithis.maxLength)return e();if(!this.stat&&ownProp(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||"DIR"===i)return e(null,i);if(n&&"FILE"===i)return e()}var o=this.statCache[r];if(void 0!==o){if(!1===o)return e(null,o);var s=o.isDirectory()?"DIR":"FILE";return n&&"FILE"===s?e():e(null,s,o)}var a=this,c=inflight_1("stat\0"+r,function(n,i){if(i&&i.isSymbolicLink())return fs.stat(r,function(n,o){n?a._stat2(t,r,null,i,e):a._stat2(t,r,n,o,e)});a._stat2(t,r,n,i,e)});c&&fs.lstat(r,c)},Glob.prototype._stat2=function(t,e,r,n,i){if(r&&("ENOENT"===r.code||"ENOTDIR"===r.code))return this.statCache[e]=!1,i();var o="/"===t.slice(-1);if(this.statCache[e]=n,"/"===e.slice(-1)&&n&&!n.isDirectory())return i(null,!1,n);var s=!0;return n&&(s=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||s,o&&"FILE"===s?i():i(null,s,n)};var defaultOptions={css:[],content:[],extractors:[],whitelist:[],output:void 0,stdout:!1,info:!1,rejected:!1},IGNORE_ANNOTATION="purgecss ignore",CONFIG_FILENAME="purgecss.config.js",ERROR_CONFIG_FILE_LOADING="Error loading the config file",ERROR_MISSING_CONTENT="No content provided.",ERROR_MISSING_CSS="No css provided.",ERROR_EXTRACTER_FAILED="The extractor has failed to extract the selectors.",ERROR_OPTIONS_TYPE="Error Type Options: expected an object",ERROR_OUTPUT_TYPE="Error Type option output: expected a string",ERROR_EXTRACTERS_TYPE="Error Type option extractors: expected an array",ERROR_WHITELIST_TYPE="Error Type option whitelist: expected an array",ERROR_WHITELIST_PATTERNS_TYPE="Error Type option whitelistPatterns: expected an array",ERROR_STDOUT_TYPE="Error Type option stdout: expected a boolean",ERROR_INFO_TYPE="Error Type option info: expected a boolean",ERROR_REJECTED_TYPE="Error Type option rejected: expected a boolean",CSS_WHITELIST=["*","::-webkit-scrollbar","::selection",":root","::before","::after"],SELECTOR_STANDARD_TYPES=["class","tag","id","universal","pseudo"],DefaultExtractor=function(){function t(){classCallCheck(this,t)}return createClass(t,null,[{key:"extract",value:function(t){return t.match(/[A-z0-9-]+/g)}}]),t}(),LegacyExtractor=function(){function t(){classCallCheck(this,t)}return createClass(t,null,[{key:"extract",value:function(t){return t.split(/[^a-z]/g)}}]),t}(),Purgecss=function(){function t(e){classCallCheck(this,t),"string"!=typeof e&&void 0!==e||(e=this.loadConfigFile(e)),this.checkOptions(e),this.options=Object.assign(defaultOptions,e)}return createClass(t,[{key:"loadConfigFile",value:function(t){var e=void 0===t?CONFIG_FILENAME:t,r=void 0;try{var n=path.resolve(process.cwd(),e);r=require(n)}catch(t){throw new Error(ERROR_CONFIG_FILE_LOADING+t.message)}return r}},{key:"checkOptions",value:function(t){if("object"!==(void 0===t?"undefined":_typeof(t)))throw new TypeError(ERROR_OPTIONS_TYPE);if(!t.content||!t.content.length)throw new Error(ERROR_MISSING_CONTENT);if(!t.css||!t.css.length)throw new Error(ERROR_MISSING_CSS);if(t.output&&"string"!=typeof t.output)throw new TypeError(ERROR_OUTPUT_TYPE);if(t.extractors&&!Array.isArray(t.extractors))throw new TypeError(ERROR_EXTRACTERS_TYPE);if(t.whitelist&&!Array.isArray(t.whitelist))throw new TypeError(ERROR_WHITELIST_TYPE);if(t.stdout&&"boolean"!=typeof t.stdout)throw new TypeError(ERROR_STDOUT_TYPE);if(t.info&&"boolean"!=typeof t.info)throw new TypeError(ERROR_INFO_TYPE);if(t.rejected&&"boolean"!=typeof t.rejected)throw new TypeError(ERROR_REJECTED_TYPE);if(t.whitelistPatterns&&!Array.isArray(t.whitelistPatterns))throw new TypeError(ERROR_WHITELIST_PATTERNS_TYPE)}},{key:"purge",value:function(){var t=this.extractFileSelector(this.options.content,this.options.extractors),e=[],r=!0,n=!1,i=void 0;try{for(var o,s=this.options.css[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var a=o.value,c=this.options.stdin?a:fs.readFileSync(a,"utf8");e.push({file:a,css:this.getSelectorsCss(c,t)})}}catch(t){n=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return e}},{key:"extractFileSelector",value:function(t,e){var r=new Set,n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var c=s.value,u=[];fs.existsSync(c)?u.push(c):u=glob_1.sync(c);var f=!0,l=!1,h=void 0;try{for(var p,d=u[Symbol.iterator]();!(f=(p=d.next()).done);f=!0){var m=p.value,g=fs.readFileSync(m,"utf8"),y=this.getFileExtractor(m,e);r=new(Function.prototype.bind.apply(Set,[null].concat(toConsumableArray(r),[this.extractSelectors(g,y)])))}}catch(t){l=!0,h=t}finally{try{!f&&d.return&&d.return()}finally{if(l)throw h}}}}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}},{key:"getFileExtractor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length?e.find(function(e){return e.extensions.find(function(e){return t.endsWith(e)})}).extractor:!0===this.options.legacy?LegacyExtractor:DefaultExtractor}},{key:"extractSelectors",value:function(t,e){var r=new Set,n=e.extract(t);if(null===n)throw new Error(ERROR_EXTRACTER_FAILED);return n.forEach(function(t){r.add(t)}),r.delete(""),r}},{key:"getSelectorsCss",value:function(t,e){var r=this,n=postcss.parse(t);return n.walkRules(function(t){var n=t.prev();if(!r.isIgnoreAnnotation(n)){t.selector=selectorParser(function(t){t.walk(function(t){var n=[];if("selector"===t.type){var i=!0,o=!1,s=void 0;try{for(var a,c=t.nodes[Symbol.iterator]();!(i=(a=c.next()).done);i=!0){var u=a.value,f=u.type,l=u.value;SELECTOR_STANDARD_TYPES.includes(f)&&void 0!==l?n.push(l):"attribute"===f&&void 0!==u.raws.unquoted&&n.push(u.raws.unquoted)}}catch(t){o=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(o)throw s}}r.shouldKeepSelector(e,n)||t.remove()}})}).processSync(t.selector);var i=t.parent;t.selector||t.remove(),r.isRuleEmpty(i)&&i.remove()}}),n.toString()}},{key:"isIgnoreAnnotation",value:function(t){return!(!t||"comment"!==t.type)&&t.text.includes(IGNORE_ANNOTATION)}},{key:"isRuleEmpty",value:function(t){return!!("decl"===t.type&&!t.value||"rule"===t.type&&!t.selector||t.nodes&&!t.nodes.length||"atrule"===t.type&&(!t.nodes&&!t.params||!t.params&&!t.nodes.length))}},{key:"shouldKeepSelector",value:function(t,e){var r=!0,n=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var a=o.value;if(this.options.legacy){var c=a.split(/[^a-z]/g),u=!1,f=!0,l=!1,h=void 0;try{for(var p,d=c[Symbol.iterator]();!(f=(p=d.next()).done);f=!0){var m=p.value;if(m){if(!t.has(m))break;u=!0}}}catch(t){l=!0,h=t}finally{try{!f&&d.return&&d.return()}finally{if(l)throw h}}if(u)return!0;if(t.has(a)||CSS_WHITELIST.includes(a)||this.isSelectorWhitelisted(a))return!0}else{if(a.startsWith(":"))continue;if(!(t.has(a)||CSS_WHITELIST.includes(a)||this.isSelectorWhitelisted(a)))return!1}}}catch(t){n=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return!this.options.legacy}},{key:"isSelectorWhitelisted",value:function(t){return!!(CSS_WHITELIST.includes(t)||this.options.whitelist&&this.options.whitelist.some(function(e){return e===t})||this.options.whitelistPatterns&&this.options.whitelistPatterns.some(function(e){return e.test(t)}))}}]),t}();module.exports=Purgecss; +"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function normalizeArray(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}function resolve(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(t=n+"/"+t,e="/"===n.charAt(0))}return t=normalizeArray(filter(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."}function normalize(t){var e=isAbsolute(t),r="/"===substr(t,-1);return(t=normalizeArray(filter(t.split("/"),function(t){return!!t}),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t}function isAbsolute(t){return"/"===t.charAt(0)}function join(){return normalize(filter(Array.prototype.slice.call(arguments,0),function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))}function relative(t,e){function r(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=resolve(t).substr(1),e=resolve(e).substr(1);for(var n=r(t.split("/")),i=r(e.split("/")),o=Math.min(n.length,i.length),s=o,a=0;a=0&&u>0){for(n=[],o=r.length;f>=0&&!a;)f==c?(n.push(f),c=r.indexOf(t,f+1)):1==n.length?a=[n.pop(),u]:((i=n.pop())=0?c:u;n.length&&(a=[o,s])}return a}function numeric(t){return parseInt(t,10)==t?parseInt(t,10):t.charCodeAt(0)}function escapeBraces(t){return t.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod)}function unescapeBraces(t){return t.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".")}function parseCommaParts(t){if(!t)return[""];var e=[],r=balancedMatch("{","}",t);if(!r)return t.split(",");var n=r.pre,i=r.body,o=r.post,s=n.split(",");s[s.length-1]+="{"+i+"}";var a=parseCommaParts(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function expandTop(t){return t?("{}"===t.substr(0,2)&&(t="\\{\\}"+t.substr(2)),expand(escapeBraces(t),!0).map(unescapeBraces)):[]}function embrace(t){return"{"+t+"}"}function isPadded(t){return/^-?0\d/.test(t)}function lte(t,e){return t<=e}function gte(t,e){return t>=e}function expand(t,e){var r=[],n=balancedMatch("{","}",t);if(!n||/\$$/.test(n.pre))return[t];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),s=i||o,a=n.body.indexOf(",")>=0;if(!s&&!a)return n.post.match(/,.*\}/)?(t=n.pre+"{"+n.body+escClose+n.post,expand(t)):[t];var c;if(s)c=n.body.split(/\.\./);else if(1===(c=parseCommaParts(n.body)).length&&1===(c=expand(c[0],!1).map(embrace)).length)return(l=n.post.length?expand(n.post,!1):[""]).map(function(t){return n.pre+c[0]+t});var u,f=n.pre,l=n.post.length?expand(n.post,!1):[""];if(s){var h=numeric(c[0]),p=numeric(c[1]),d=Math.max(c[0].length,c[1].length),m=3==c.length?Math.abs(numeric(c[2])):1,g=lte;p0){var w=new Array(E+1).join("0");b=v<0?"-"+w+b.slice(1):w+b}}u.push(b)}}else u=concatMap(c,function(t){return expand(t,!1)});for(var _=0;_65536)throw new TypeError("pattern is too long");var n=this.options;if(!n.noglobstar&&"**"===t)return GLOBSTAR;if(""===t)return"";for(var i,o,s="",a=!!n.nocase,c=!1,u=[],f=[],l=!1,h=-1,p=-1,d="."===t.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",m=this,g=0,y=t.length;g-1;A--){var T=f[A],$=s.slice(0,T.reStart),k=s.slice(T.reStart,T.reEnd-8),O=s.slice(T.reEnd-8,T.reEnd),R=s.slice(T.reEnd);O+=R;var x=$.split("(").length-1,B=R;for(g=0;g=0&&!(i=t[o]);o--);for(o=0;o1)for(var r=1;r=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),s=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),isBoolean(e)?r.showHidden=e:e&&_extend(r,e),isUndefined(r.showHidden)&&(r.showHidden=!1),isUndefined(r.depth)&&(r.depth=2),isUndefined(r.colors)&&(r.colors=!1),isUndefined(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=stylizeWithColor),formatValue(r,t,r.depth)}function stylizeWithColor(t,e){var r=inspect.styles[e];return r?"["+inspect.colors[r][0]+"m"+t+"["+inspect.colors[r][1]+"m":t}function stylizeNoColor(t,e){return t}function arrayToHash(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function formatValue(t,e,r){if(t.customInspect&&e&&isFunction(e.inspect)&&e.inspect!==inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return isString(n)||(n=formatValue(t,n,r)),n}var i=formatPrimitive(t,e);if(i)return i;var o=Object.keys(e),s=arrayToHash(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),isError(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(e);if(0===o.length){if(isFunction(e)){var a=e.name?": "+e.name:"";return t.stylize("[Function"+a+"]","special")}if(isRegExp(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(isDate(e))return t.stylize(Date.prototype.toString.call(e),"date");if(isError(e))return formatError(e)}var c="",u=!1,f=["{","}"];if(isArray$1(e)&&(u=!0,f=["[","]"]),isFunction(e)&&(c=" [Function"+(e.name?": "+e.name:"")+"]"),isRegExp(e)&&(c=" "+RegExp.prototype.toString.call(e)),isDate(e)&&(c=" "+Date.prototype.toUTCString.call(e)),isError(e)&&(c=" "+formatError(e)),0===o.length&&(!u||0==e.length))return f[0]+c+f[1];if(r<0)return isRegExp(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var l;return l=u?formatArray(t,e,r,s,o):o.map(function(n){return formatProperty(t,e,r,s,n,u)}),t.seen.pop(),reduceToSingleString(l,c,f)}function formatPrimitive(t,e){if(isUndefined(e))return t.stylize("undefined","undefined");if(isString(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return isNumber(e)?t.stylize(""+e,"number"):isBoolean(e)?t.stylize(""+e,"boolean"):isNull(e)?t.stylize("null","null"):void 0}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatArray(t,e,r,n,i){for(var o=[],s=0,a=e.length;s-1&&(a=o?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n")):a=t.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function reduceToSingleString(t,e,r){var n=0;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function isArray$1(t){return Array.isArray(t)}function isBoolean(t){return"boolean"==typeof t}function isNull(t){return null===t}function isNullOrUndefined(t){return null==t}function isNumber(t){return"number"==typeof t}function isString(t){return"string"==typeof t}function isSymbol(t){return"symbol"===(void 0===t?"undefined":_typeof(t))}function isUndefined(t){return void 0===t}function isRegExp(t){return isObject(t)&&"[object RegExp]"===objectToString(t)}function isObject(t){return"object"===(void 0===t?"undefined":_typeof(t))&&null!==t}function isDate(t){return isObject(t)&&"[object Date]"===objectToString(t)}function isError(t){return isObject(t)&&("[object Error]"===objectToString(t)||t instanceof Error)}function isFunction(t){return"function"==typeof t}function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===(void 0===t?"undefined":_typeof(t))||void 0===t}function isBuffer(t){return Buffer.isBuffer(t)}function objectToString(t){return Object.prototype.toString.call(t)}function pad(t){return t<10?"0"+t.toString(10):t.toString(10)}function timestamp(){var t=new Date,e=[pad(t.getHours()),pad(t.getMinutes()),pad(t.getSeconds())].join(":");return[t.getDate(),months[t.getMonth()],e].join(" ")}function log(){console.log("%s - %s",timestamp(),format.apply(null,arguments))}function _extend(t,e){if(!e||!isObject(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}function hasOwnProperty(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function EventHandlers(){}function EventEmitter(){EventEmitter.init.call(this)}function $getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function emitNone(t,e,r){if(e)t.call(r);else for(var n=t.length,i=arrayClone(t,n),o=0;o0&&s.length>i){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,emitWarning(a)}}else s=o[e]=r,++t._eventsCount;return t}function emitWarning(t){"function"==typeof console.warn?console.warn(t):console.log(t)}function _onceWrap(t,e,r){function n(){t.removeListener(e,n),i||(i=!0,r.apply(t,arguments))}var i=!1;return n.listener=r,n}function listenerCount(t){var e=this._events;if(e){var r=e[t];if("function"==typeof r)return 1;if(r)return r.length}return 0}function spliceOne(t,e){for(var r=e,n=r+1,i=t.length;n0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[a-2]?2:"="===t[a-1]?1:0,s=new Arr(3*a/4-o),n=o>0?a-4:a;var c=0;for(e=0,r=0;e>16&255,s[c++]=i>>8&255,s[c++]=255&i;return 2===o?(i=revLookup[t.charCodeAt(e)]<<2|revLookup[t.charCodeAt(e+1)]>>4,s[c++]=255&i):1===o&&(i=revLookup[t.charCodeAt(e)]<<10|revLookup[t.charCodeAt(e+1)]<<4|revLookup[t.charCodeAt(e+2)]>>2,s[c++]=i>>8&255,s[c++]=255&i),s}function tripletToBase64(t){return lookup[t>>18&63]+lookup[t>>12&63]+lookup[t>>6&63]+lookup[63&t]}function encodeChunk(t,e,r){for(var n,i=[],o=e;oa?a:s+16383));return 1===n?(e=t[r-1],i+=lookup[e>>2],i+=lookup[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=lookup[e>>10],i+=lookup[e>>4&63],i+=lookup[e<<2&63],i+="="),o.push(i),o.join("")}function read(t,e,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,f=-7,l=r?i-1:0,h=r?-1:1,p=t[e+l];for(l+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+t[e+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+t[e+l],l+=h,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=u}return(p?-1:1)*s*Math.pow(2,o-n)}function write(t,e,r,n,i,o){var s,a,c,u=8*o-i-1,f=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<0;t[r+p]=255&s,p+=d,s/=256,u-=8);t[r+p-d]|=128*m}function kMaxLength(){return Buffer$1.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,e){if(kMaxLength()=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function internalIsBuffer(t){return!(null==t||!t._isBuffer)}function byteLength(t,e){if(internalIsBuffer(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 n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(t).length;default:if(n)return utf8ToBytes(t).length;e=(""+e).toLowerCase(),n=!0}}function slowToString(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 hexSlice(this,e,r);case"utf8":case"utf-8":return utf8Slice(this,e,r);case"ascii":return asciiSlice(this,e,r);case"latin1":case"binary":return latin1Slice(this,e,r);case"base64":return base64Slice(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function swap(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function bidirectionalIndexOf(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=Buffer$1.from(e,n)),internalIsBuffer(e))return 0===e.length?-1:arrayIndexOf(t,e,r,n,i);if("number"==typeof e)return e&=255,Buffer$1.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):arrayIndexOf(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,e,r,n,i){function o(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}var s=1,a=t.length,c=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;s=2,a/=2,c/=2,r/=2}var u;if(i){var f=-1;for(u=r;ua&&(r=a-c),u=r;u>=0;u--){for(var l=!0,h=0;hi&&(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 s=0;s239?4:o>223?3:o>191?2:1;if(i+a<=r){var c,u,f,l;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(c=t[i+1]))&&(l=(31&o)<<6|63&c)>127&&(s=l);break;case 3:c=t[i+1],u=t[i+2],128==(192&c)&&128==(192&u)&&(l=(15&o)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:c=t[i+1],u=t[i+2],f=t[i+3],128==(192&c)&&128==(192&u)&&128==(192&f)&&(l=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&f)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return decodeCodePointsArray(n)}function decodeCodePointsArray(t){var e=t.length;if(e<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,e,r,n,i,o){if(!internalIsBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function objectWriteUInt32(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function checkIEEE754(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 writeFloat(t,e,r,n,i){return i||checkIEEE754(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),write(t,e,r,n,23,4),r+4}function writeDouble(t,e,r,n,i){return i||checkIEEE754(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),write(t,e,r,n,52,8),r+8}function base64clean(t){if((t=stringtrim(t).replace(INVALID_BASE64_RE,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],s=0;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+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 asciiToBytes(t){for(var e=[],r=0;r>8,i=r%256,o.push(i),o.push(n);return o}function base64ToBytes(t){return toByteArray(base64clean(t))}function blitBuffer(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function isnan(t){return t!=t}function isBuffer$1(t){return null!=t&&(!!t._isBuffer||isFastBuffer(t)||isSlowBuffer(t))}function isFastBuffer(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function isSlowBuffer(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&isFastBuffer(t.slice(0,0))}function compare(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i=0){var s=n.indexOf("\n",o+1);n=n.substring(s+1)}this.stack=n}}}function truncate(t,e){return"string"==typeof t?t.length=0;a--)if(c[a]!==u[a])return!1;for(a=c.length-1;a>=0;a--)if(s=c[a],!_deepEqual(t[s],e[s],r,n))return!1;return!0}function notDeepEqual(t,e,r){_deepEqual(t,e,!1)&&fail(t,e,r,"notDeepEqual",notDeepEqual)}function notDeepStrictEqual(t,e,r){_deepEqual(t,e,!0)&&fail(t,e,r,"notDeepStrictEqual",notDeepStrictEqual)}function strictEqual(t,e,r){t!==e&&fail(t,e,r,"===",strictEqual)}function notStrictEqual(t,e,r){t===e&&fail(t,e,r,"!==",notStrictEqual)}function expectedException(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function _tryBlock(t){var e;try{t()}catch(t){e=t}return e}function _throws(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=_tryBlock(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&fail(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&isError(i),a=!t&&i&&!r;if((s&&o&&expectedException(i,r)||a)&&fail(i,r,"Got unwanted exception"+n),t&&i&&r&&!expectedException(i,r)||!t&&i)throw i}function throws(t,e,r){_throws(!0,t,e,r)}function doesNotThrow(t,e,r){_throws(!1,t,e,r)}function ifError(t){if(t)throw t}function posix(t){return"/"===t.charAt(0)}function win32(t){var e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),r=e[1]||"",n=Boolean(r&&":"!==r.charAt(1));return Boolean(e[2]||n)}function ownProp$2(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function alphasorti$2(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())}function alphasort$2(t,e){return t.localeCompare(e)}function setupIgnores(t,e){t.ignore=e.ignore||[],Array.isArray(t.ignore)||(t.ignore=[t.ignore]),t.ignore.length&&(t.ignore=t.ignore.map(ignoreMap))}function ignoreMap(t){var e=null;if("/**"===t.slice(-3)){var r=t.replace(/(\/\*\*)+$/,"");e=new Minimatch$3(r,{dot:!0})}return{matcher:new Minimatch$3(t,{dot:!0}),gmatcher:e}}function setopts$2(t,e,r){if(r||(r={}),r.matchBase&&-1===e.indexOf("/")){if(r.noglobstar)throw new Error("base matching requires globstar");e="**/"+e}t.silent=!!r.silent,t.pattern=e,t.strict=!1!==r.strict,t.realpath=!!r.realpath,t.realpathCache=r.realpathCache||Object.create(null),t.follow=!!r.follow,t.dot=!!r.dot,t.mark=!!r.mark,t.nodir=!!r.nodir,t.nodir&&(t.mark=!0),t.sync=!!r.sync,t.nounique=!!r.nounique,t.nonull=!!r.nonull,t.nosort=!!r.nosort,t.nocase=!!r.nocase,t.stat=!!r.stat,t.noprocess=!!r.noprocess,t.absolute=!!r.absolute,t.maxLength=r.maxLength||1/0,t.cache=r.cache||Object.create(null),t.statCache=r.statCache||Object.create(null),t.symlinks=r.symlinks||Object.create(null),setupIgnores(t,r),t.changedCwd=!1;var n=process.cwd();ownProp$2(r,"cwd")?(t.cwd=path$2.resolve(r.cwd),t.changedCwd=t.cwd!==n):t.cwd=n,t.root=r.root||path$2.resolve(t.cwd,"/"),t.root=path$2.resolve(t.root),"win32"===process.platform&&(t.root=t.root.replace(/\\/g,"/")),t.cwdAbs=pathIsAbsolute(t.cwd)?t.cwd:makeAbs(t,t.cwd),"win32"===process.platform&&(t.cwdAbs=t.cwdAbs.replace(/\\/g,"/")),t.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,t.minimatch=new Minimatch$3(e,r),t.options=t.minimatch.options}function finish(t){for(var e=t.nounique,r=e?[]:Object.create(null),n=0,i=t.matches.length;nn?(r.splice(0,n),process.nextTick(function(){e.apply(null,i)})):delete reqs[t]}})}function slice(t){for(var e=t.length,r=[],n=0;n=t.length)return e&&(e[l]=t),r(null,t);nextPartRe.lastIndex=a;var n=nextPartRe.exec(t);return f=c,c+=n[0],u=f+n[1],a=nextPartRe.lastIndex,p[u]||e&&e[u]===u?process.nextTick(i):e&&Object.prototype.hasOwnProperty.call(e,u)?s(e[u]):fs.lstat(u,function(t,n){if(t)return r(t);if(!n.isSymbolicLink())return p[u]=!0,e&&(e[u]=u),process.nextTick(i);if(!isWindows){var s=n.dev.toString(32)+":"+n.ino.toString(32);if(h.hasOwnProperty(s))return o(null,h[s],u)}fs.stat(u,function(t){if(t)return r(t);fs.readlink(u,function(t,e){isWindows||(h[s]=e),o(t,e)})})})}function o(t,n,i){if(t)return r(t);var o=path$2.resolve(f,n);e&&(e[i]=o),s(o)}function s(e){t=path$2.resolve(e,t.slice(a)),n()}if("function"!=typeof r&&(r=maybeCallback(e),e=null),t=path$2.resolve(t),e&&Object.prototype.hasOwnProperty.call(e,t))return process.nextTick(r.bind(null,null,e[t]));var a,c,u,f,l=t,h={},p={};n()},old={realpathSync:realpathSync$1,realpath:realpath$1},fs_realpath=realpath;realpath.realpath=realpath,realpath.sync=realpathSync,realpath.realpathSync=realpathSync,realpath.monkeypatch=monkeypatch,realpath.unmonkeypatch=unmonkeypatch;var origRealpath=fs.realpath,origRealpathSync=fs.realpathSync,version=process.version,ok=/^v[0-5]\./.test(version),concatMap=function(t,e){for(var r=[],n=0;n>> no match, partial?",t,f,e,l),f!==s))}var p;if("string"==typeof c?(p=n.nocase?u.toLowerCase()===c.toLowerCase():u===c,this.debug("string match",c,u,p)):(p=u.match(c),this.debug("pattern match",c,u,p)),!p)return!1}if(i===s&&o===a)return!0;if(i===s)return r;if(o===a)return i===s-1&&""===t[i];throw new Error("wtf?")};var cachedSetTimeout=defaultSetTimout,cachedClearTimeout=defaultClearTimeout;"function"==typeof global.setTimeout&&(cachedSetTimeout=setTimeout),"function"==typeof global.clearTimeout&&(cachedClearTimeout=clearTimeout);var currentQueue,queue=[],draining=!1,queueIndex=-1;Item.prototype.run=function(){this.fun.apply(null,this.array)};var inherits$2,debugEnviron,title="browser",platform="browser",browser=!0,env={},argv=[],version$1="",versions={},release={},config={},on=noop,addListener=noop,once=noop,off=noop,removeListener=noop,removeAllListeners=noop,emit=noop,performance=global.performance||{},performanceNow=performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow||function(){return(new Date).getTime()},startTime=new Date,process$1={nextTick:nextTick,title:title,browser:browser,env:env,argv:argv,version:version$1,versions:versions,on:on,addListener:addListener,once:once,off:off,removeListener:removeListener,removeAllListeners:removeAllListeners,emit:emit,binding:binding,cwd:cwd,chdir:chdir,umask:umask,hrtime:hrtime,platform:platform,release:release,config:config,uptime:uptime},inherits$3=inherits$2="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},asyncGenerator=function(){function t(t){this.value=t}function e(e){function r(i,o){try{var s=e[i](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):n(s.done?"return":"normal",s.value)}catch(t){n("throw",t)}}function n(t,e){switch(t){case"return":i.resolve({value:e,done:!0});break;case"throw":i.reject(e);break;default:i.resolve({value:e,done:!1})}(i=i.next)?r(i.key,i.arg):o=null}var i,o;this._invoke=function(t,e){return new Promise(function(n,s){var a={key:t,arg:e,resolve:n,reject:s,next:null};o?o=o.next=a:(i=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)},{wrap:function(t){return function(){return new e(t.apply(this,arguments))}},await:function(e){return new t(e)}}}(),classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},createClass=function(){function t(t,e){for(var r=0;r0;)if(r[o]===e||r[o].listener&&r[o].listener===e){s=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new EventHandlers,this;delete n[t]}else spliceOne(r,i);n.removeListener&&this.emit("removeListener",t,s||e)}return this},EventEmitter.prototype.removeAllListeners=function(t){var e,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new EventHandlers,this._eventsCount=0):r[t]&&(0==--this._eventsCount?this._events=new EventHandlers:delete r[t]),this;if(0===arguments.length){for(var n,i=Object.keys(r),o=0;o0?Reflect.ownKeys(this._events):[]};var events=Object.freeze({default:EventEmitter,EventEmitter:EventEmitter}),lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,inited=!1,toString={}.toString,isArray$2=Array.isArray||function(t){return"[object Array]"==toString.call(t)},INSPECT_MAX_BYTES=50;Buffer$1.TYPED_ARRAY_SUPPORT=void 0===global.TYPED_ARRAY_SUPPORT||global.TYPED_ARRAY_SUPPORT;var _kMaxLength=kMaxLength();Buffer$1.poolSize=8192,Buffer$1._augment=function(t){return t.__proto__=Buffer$1.prototype,t},Buffer$1.from=function(t,e,r){return from(null,t,e,r)},Buffer$1.TYPED_ARRAY_SUPPORT&&(Buffer$1.prototype.__proto__=Uint8Array.prototype,Buffer$1.__proto__=Uint8Array),Buffer$1.alloc=function(t,e,r){return alloc(null,t,e,r)},Buffer$1.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer$1.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer$1.isBuffer=isBuffer$1,Buffer$1.compare=function(t,e){if(!internalIsBuffer(t)||!internalIsBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},Buffer$1.prototype.compare=function(t,e,r,n,i){if(!internalIsBuffer(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===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,a=Math.min(o,s),c=this.slice(n,i),u=t.slice(e,r),f=0;fi)&&(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 hexWrite(this,t,e,r);case"utf8":case"utf-8":return utf8Write(this,t,e,r);case"ascii":return asciiWrite(this,t,e,r);case"latin1":case"binary":return latin1Write(this,t,e,r);case"base64":return base64Write(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},Buffer$1.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer$1.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),e0&&(i*=256);)n+=this[t+--e]*i;return n},Buffer$1.prototype.readUInt8=function(t,e){return e||checkOffset(t,1,this.length),this[t]},Buffer$1.prototype.readUInt16LE=function(t,e){return e||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer$1.prototype.readUInt16BE=function(t,e){return e||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer$1.prototype.readUInt32LE=function(t,e){return e||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer$1.prototype.readUInt32BE=function(t,e){return e||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer$1.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||checkOffset(t,e,this.length);for(var n=this[t],i=1,o=0;++o=i&&(n-=Math.pow(2,8*e)),n},Buffer$1.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||checkOffset(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},Buffer$1.prototype.readInt8=function(t,e){return e||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer$1.prototype.readInt16LE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Buffer$1.prototype.readInt16BE=function(t,e){e||checkOffset(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Buffer$1.prototype.readInt32LE=function(t,e){return e||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer$1.prototype.readInt32BE=function(t,e){return e||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer$1.prototype.readFloatLE=function(t,e){return e||checkOffset(t,4,this.length),read(this,t,!0,23,4)},Buffer$1.prototype.readFloatBE=function(t,e){return e||checkOffset(t,4,this.length),read(this,t,!1,23,4)},Buffer$1.prototype.readDoubleLE=function(t,e){return e||checkOffset(t,8,this.length),read(this,t,!0,52,8)},Buffer$1.prototype.readDoubleBE=function(t,e){return e||checkOffset(t,8,this.length),read(this,t,!1,52,8)},Buffer$1.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||checkInt(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+r},Buffer$1.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,255,0),Buffer$1.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Buffer$1.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer$1.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,65535,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer$1.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):objectWriteUInt32(this,t,e,!0),e+4},Buffer$1.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,4294967295,0),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer$1.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);checkInt(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},Buffer$1.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);checkInt(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},Buffer$1.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,1,127,-128),Buffer$1.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Buffer$1.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):objectWriteUInt16(this,t,e,!0),e+2},Buffer$1.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,2,32767,-32768),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):objectWriteUInt16(this,t,e,!1),e+2},Buffer$1.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):objectWriteUInt32(this,t,e,!0),e+4},Buffer$1.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||checkInt(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer$1.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):objectWriteUInt32(this,t,e,!1),e+4},Buffer$1.prototype.writeFloatLE=function(t,e,r){return writeFloat(this,t,e,!0,r)},Buffer$1.prototype.writeFloatBE=function(t,e,r){return writeFloat(this,t,e,!1,r)},Buffer$1.prototype.writeDoubleLE=function(t,e,r){return writeDouble(this,t,e,!0,r)},Buffer$1.prototype.writeDoubleBE=function(t,e,r){return writeDouble(this,t,e,!1,r)},Buffer$1.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3||!Buffer$1.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;othis.maxLength)return!1;if(!this.stat&&ownProp$1(this.cache,e)){o=this.cache[e];if(Array.isArray(o)&&(o="DIR"),!r||"DIR"===o)return o;if(r&&"FILE"===o)return!1}var n=this.statCache[e];if(!n){var i;try{i=fs.lstatSync(e)}catch(t){if(t&&("ENOENT"===t.code||"ENOTDIR"===t.code))return this.statCache[e]=!1,!1}if(i&&i.isSymbolicLink())try{n=fs.statSync(e)}catch(t){n=i}else n=i}this.statCache[e]=n;var o=!0;return n&&(o=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||o,(!r||"FILE"!==o)&&o},GlobSync$1.prototype._mark=function(t){return common.mark(this,t)},GlobSync$1.prototype._makeAbs=function(t){return common.makeAbs(this,t)};var wrappy_1=wrappy,once_1=wrappy_1(once$1),strict=wrappy_1(onceStrict);once$1.proto=once$1(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once$1(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})}),once_1.strict=strict;var reqs=Object.create(null),inflight_1=wrappy_1(inflight),require$$0$2=events&&EventEmitter||events,glob_1=glob,EE=require$$0$2.EventEmitter,setopts=common.setopts,ownProp=common.ownProp,childrenIgnored=common.childrenIgnored,isIgnored=common.isIgnored;glob.sync=sync;var GlobSync=glob.GlobSync=sync.GlobSync;glob.glob=glob,glob.hasMagic=function(t,e){var r=extend({},e);r.noprocess=!0;var n=new Glob(t,r).minimatch.set;if(!t)return!1;if(n.length>1)return!0;for(var i=0;ithis.maxLength)return e();if(!this.stat&&ownProp(this.cache,r)){var i=this.cache[r];if(Array.isArray(i)&&(i="DIR"),!n||"DIR"===i)return e(null,i);if(n&&"FILE"===i)return e()}var o=this.statCache[r];if(void 0!==o){if(!1===o)return e(null,o);var s=o.isDirectory()?"DIR":"FILE";return n&&"FILE"===s?e():e(null,s,o)}var a=this,c=inflight_1("stat\0"+r,function(n,i){if(i&&i.isSymbolicLink())return fs.stat(r,function(n,o){n?a._stat2(t,r,null,i,e):a._stat2(t,r,n,o,e)});a._stat2(t,r,n,i,e)});c&&fs.lstat(r,c)},Glob.prototype._stat2=function(t,e,r,n,i){if(r&&("ENOENT"===r.code||"ENOTDIR"===r.code))return this.statCache[e]=!1,i();var o="/"===t.slice(-1);if(this.statCache[e]=n,"/"===e.slice(-1)&&n&&!n.isDirectory())return i(null,!1,n);var s=!0;return n&&(s=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||s,o&&"FILE"===s?i():i(null,s,n)};var defaultOptions={css:[],content:[],extractors:[],whitelist:[],output:void 0,stdout:!1,info:!1,rejected:!1},IGNORE_ANNOTATION="purgecss ignore",CONFIG_FILENAME="purgecss.config.js",ERROR_CONFIG_FILE_LOADING="Error loading the config file",ERROR_MISSING_CONTENT="No content provided.",ERROR_MISSING_CSS="No css provided.",ERROR_EXTRACTER_FAILED="The extractor has failed to extract the selectors.",ERROR_OPTIONS_TYPE="Error Type Options: expected an object",ERROR_OUTPUT_TYPE="Error Type option output: expected a string",ERROR_EXTRACTERS_TYPE="Error Type option extractors: expected an array",ERROR_WHITELIST_TYPE="Error Type option whitelist: expected an array",ERROR_WHITELIST_PATTERNS_TYPE="Error Type option whitelistPatterns: expected an array",ERROR_STDOUT_TYPE="Error Type option stdout: expected a boolean",ERROR_INFO_TYPE="Error Type option info: expected a boolean",ERROR_REJECTED_TYPE="Error Type option rejected: expected a boolean",CSS_WHITELIST=["*","::-webkit-scrollbar","::selection",":root","::before","::after"],SELECTOR_STANDARD_TYPES=["class","tag","id","universal","pseudo"],DefaultExtractor=function(){function t(){classCallCheck(this,t)}return createClass(t,null,[{key:"extract",value:function(t){return t.match(/[A-z0-9-]+/g)}}]),t}(),LegacyExtractor=function(){function t(){classCallCheck(this,t)}return createClass(t,null,[{key:"extract",value:function(t){return t.split(/[^a-z]/g)}}]),t}(),Purgecss=function(){function t(e){classCallCheck(this,t),"string"!=typeof e&&void 0!==e||(e=this.loadConfigFile(e)),this.checkOptions(e),this.options=Object.assign(defaultOptions,e)}return createClass(t,[{key:"loadConfigFile",value:function(t){var e=void 0===t?CONFIG_FILENAME:t,r=void 0;try{var n=path.resolve(process.cwd(),e);r=require(n)}catch(t){throw new Error(ERROR_CONFIG_FILE_LOADING+t.message)}return r}},{key:"checkOptions",value:function(t){if("object"!==(void 0===t?"undefined":_typeof(t)))throw new TypeError(ERROR_OPTIONS_TYPE);if(!t.content||!t.content.length)throw new Error(ERROR_MISSING_CONTENT);if(!t.css||!t.css.length)throw new Error(ERROR_MISSING_CSS);if(t.output&&"string"!=typeof t.output)throw new TypeError(ERROR_OUTPUT_TYPE);if(t.extractors&&!Array.isArray(t.extractors))throw new TypeError(ERROR_EXTRACTERS_TYPE);if(t.whitelist&&!Array.isArray(t.whitelist))throw new TypeError(ERROR_WHITELIST_TYPE);if(t.stdout&&"boolean"!=typeof t.stdout)throw new TypeError(ERROR_STDOUT_TYPE);if(t.info&&"boolean"!=typeof t.info)throw new TypeError(ERROR_INFO_TYPE);if(t.rejected&&"boolean"!=typeof t.rejected)throw new TypeError(ERROR_REJECTED_TYPE);if(t.whitelistPatterns&&!Array.isArray(t.whitelistPatterns))throw new TypeError(ERROR_WHITELIST_PATTERNS_TYPE)}},{key:"purge",value:function(){var t=this.extractFileSelector(this.options.content,this.options.extractors),e=[],r=!0,n=!1,i=void 0;try{for(var o,s=this.options.css[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var a=o.value,c=this.options.stdin?a:fs.readFileSync(a,"utf8");e.push({file:a,css:this.getSelectorsCss(c,t)})}}catch(t){n=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return e}},{key:"extractFileSelector",value:function(t,e){var r=new Set,n=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var c=s.value,u=[];fs.existsSync(c)?u.push(c):u=glob_1.sync(c);var f=!0,l=!1,h=void 0;try{for(var p,d=u[Symbol.iterator]();!(f=(p=d.next()).done);f=!0){var m=p.value,g=fs.readFileSync(m,"utf8"),y=this.getFileExtractor(m,e);r=new Set([].concat(toConsumableArray(r),toConsumableArray(this.extractSelectors(g,y))))}}catch(t){l=!0,h=t}finally{try{!f&&d.return&&d.return()}finally{if(l)throw h}}}}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}return r}},{key:"getFileExtractor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length?e.find(function(e){return e.extensions.find(function(e){return t.endsWith(e)})}).extractor:!0===this.options.legacy?LegacyExtractor:DefaultExtractor}},{key:"extractSelectors",value:function(t,e){var r=new Set,n=e.extract(t);if(null===n)throw new Error(ERROR_EXTRACTER_FAILED);return n.forEach(function(t){r.add(t)}),r.delete(""),r}},{key:"getSelectorsCss",value:function(t,e){var r=this,n=postcss.parse(t);return n.walkRules(function(t){var n=t.prev();if(!r.isIgnoreAnnotation(n)){t.selector=selectorParser(function(t){t.walk(function(t){var n=[];if("selector"===t.type){var i=!0,o=!1,s=void 0;try{for(var a,c=t.nodes[Symbol.iterator]();!(i=(a=c.next()).done);i=!0){var u=a.value,f=u.type,l=u.value;SELECTOR_STANDARD_TYPES.includes(f)&&void 0!==l?n.push(l):"attribute"===f&&void 0!==u.raws.unquoted&&n.push(u.raws.unquoted)}}catch(t){o=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(o)throw s}}r.shouldKeepSelector(e,n)||t.remove()}})}).processSync(t.selector);var i=t.parent;t.selector||t.remove(),r.isRuleEmpty(i)&&i.remove()}}),n.toString()}},{key:"isIgnoreAnnotation",value:function(t){return!(!t||"comment"!==t.type)&&t.text.includes(IGNORE_ANNOTATION)}},{key:"isRuleEmpty",value:function(t){return!!("decl"===t.type&&!t.value||"rule"===t.type&&!t.selector||t.nodes&&!t.nodes.length||"atrule"===t.type&&(!t.nodes&&!t.params||!t.params&&!t.nodes.length))}},{key:"shouldKeepSelector",value:function(t,e){var r=!0,n=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var a=o.value;if(this.options.legacy){var c=a.split(/[^a-z]/g),u=!1,f=!0,l=!1,h=void 0;try{for(var p,d=c[Symbol.iterator]();!(f=(p=d.next()).done);f=!0){var m=p.value;if(m){if(!t.has(m))break;u=!0}}}catch(t){l=!0,h=t}finally{try{!f&&d.return&&d.return()}finally{if(l)throw h}}if(u)return!0;if(t.has(a)||CSS_WHITELIST.includes(a)||this.isSelectorWhitelisted(a))return!0}else{if(a.startsWith(":"))continue;if(!(t.has(a)||CSS_WHITELIST.includes(a)||this.isSelectorWhitelisted(a)))return!1}}}catch(t){n=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return!this.options.legacy}},{key:"isSelectorWhitelisted",value:function(t){return!!(CSS_WHITELIST.includes(t)||this.options.whitelist&&this.options.whitelist.some(function(e){return e===t})||this.options.whitelistPatterns&&this.options.whitelistPatterns.some(function(e){return e.test(t)}))}}]),t}();module.exports=Purgecss;