diff --git a/dist/scripts/client.js b/dist/scripts/client.js index c26cc0e..69b4537 100644 --- a/dist/scripts/client.js +++ b/dist/scripts/client.js @@ -1,13 +1,9244 @@ -!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=40)}([function(t,e,n){"use strict";n.r(e),n.d(e,"f",(function(){return r}));var r={type:"Type",name:"Name",sku:"SKU",pic:"PIC",cat:"tax:product_cat",tag:"tax:product_tag",desc:"Description",short_desc:"Short Description",visibility:"Visibility in catalog",package:"Package",title:"Title",attr:"Attributes",model:"Model",skus:"SKUs",prod_info:"Product Info",image:"Image",indent:"Indention",warrantyList:"Warranty List",warrantyBody:"Warranty Body",orderInfo:"Ordering Information",feats:"Product Features",related:"Related Products",indict:"Indications",downs:"Downloads",main_model:"Main Model",pnf:"In Part Number Finder",searchWeight:"Search Weight",region:"Region Lock"}},function(t,e,n){"use strict";n.r(e),n.d(e,"findSpecBounds",(function(){return u})),n.d(e,"findSpecIcons",(function(){return f})),n.d(e,"computeChecksum",(function(){return c})),n.d(e,"filterExisting",(function(){return l})),n.d(e,"compareHashesForPayload",(function(){return h})),n.d(e,"keyByPIC",(function(){return d})),n.d(e,"linkVariations",(function(){return g})),n.d(e,"linkPackages",(function(){return m})),n.d(e,"verifyFields",(function(){return y})),n.d(e,"verifyFiles",(function(){return v})),n.d(e,"buildSpec",(function(){return b})),n.d(e,"variationSlice",(function(){return w}));var r=n(0),i=n(14),o=n.n(i);function s(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&void 0!==arguments[2]&&arguments[2];if(!e)return[[],Object.keys(t)];var r=[],i=[],o=[],s=Object.keys(t),a=0;return s.forEach((function(r){e[r]?n||e[r].checksum!==t[r].checksum?(e[r].pic=r,o.push(e[r])):a++:i.push(r)})),console.log("Creating : ".concat(i.length)),console.log("Updating : ".concat(o.length)),console.log("Ignoring: ".concat(a)),[r,i,o]}function d(t){var e={};return t.map((function(t){return!!t&&(e[t[r.f.pic]]||(e[t[r.f.pic]]=[]),e[t[r.f.pic]]=t,t)})),e}function p(t){if(!t)return[];var e=t.split(",").map((function(t){return t.trim()}));return""!==e[0]&&e}function g(t,e){return Object.values(t).map((function(e){t[e[r.f.pic]].variations=[],"simple"===e[r.f.type]&&t[e[r.f.pic]].variations.push({name:e[r.f.name],sku:e[r.f.sku],specs:e.specs})})),e.map((function(e){if(void 0===t[e[r.f.pic]])return!1;var n=t[e[r.f.pic]].variations.push({name:e[r.f.name],sku:e[r.f.sku],specs:e.specs});e[r.f.image]&&(t[e[r.f.pic]].variations[n-1].image=e[r.f.image],console.log("has image")),e[r.f.indent]&&(t[e[r.f.pic]].variations[n-1].indent=e[r.f.indent]),e[r.f.package]&&(t[e[r.f.pic]].variations[n-1].package=e[r.f.package])})),t}function m(t,e){var n,i,o;return i={},o=(n=e)[0].splice(1),n.splice(1).map((function(t){var e=t[0];void 0!==i[e]&&window.alert("Conflicting package ID's found: ".concat(e)),i[e]={},t.splice(1).map((function(t,n){i[e][o[n]]=t})),i[e][r.f.attr]=p(i[e][r.f.attr]),i[e][r.f.skus]=p(i[e][r.f.skus])})),e=i,Object.values(t).map((function(n){var i={};i.drop={label:"", -//! This should pull from PIC by controller -pic:n[r.f.pic],model:"B",skus:[],specs:[],product_info:["name","description","image"]},n.variations&&n.variations.map((function(t){void 0!==t.package?(i[t.package]||(i[t.package]={label:t.package,pic:n[r.f.pic],model:"B",skus:[],specs:[],product_info:[]},"list"===t.package&&(i[t.package].model="A",i[t.package].label="",//! PIC's name if on another product -i[t.package].product_info=["name","description","image"])),t.image&&(i[t.package].model="C"),console.log(n[r.f.name],t.package),i[t.package].skus.push(t.sku)):t.image?(i.varyImage||(i.varyImage={label:"",pic:n[r.f.pic],skus:[],specs:[],model:"C",product_info:["name","description","image"]}),i.varyImage.skus.push(t.sku)):i.drop.skus.push(t.sku)})),0===i.drop.skus.length&&delete i.drop,n[r.f.package]&&n[r.f.package].split(",").map((function(t){var n;(t=t.trim(),e[t][r.f.title]&i[e[t][r.f.title]]?(i["custom"+t]=i[e[t][r.f.title]],delete i[e[t][r.f.title]]):i["custom"+t]={label:"",pic:"",skus:[],model:"B",specs:[],product_info:[]},e[t][r.f.image]&&(i["custom"+t].model="D",i["custom"+t].image=e[t][r.f.image]),e[t][r.f.pic]&&(i["custom"+t].pic=e[t][r.f.pic]),e[t][r.f.skus])&&(n=i["custom"+t].skus).push.apply(n,s(e[t][r.f.skus]));e[t][r.f.attr]&&(i["custom"+t].specs=e[t][r.f.attr]),e[t][r.f.title]?i["custom"+t].label=e[t][r.f.title]:i["custom"+t].product_info=["name","description","image"],e[t][r.f.prod_info]&&(i["custom"+t].product_info=e[t][r.f.prod_info].split(",").map((function(t){return t.trim()}))),e[t][r.f.model]&&(i["custom"+t].model=e[t][r.f.model])})),t[n[r.f.pic]].packages=i})),t}function y(t){return t}function v(t,e,n){return void 0===t?(window.alert("Specify a parent product file first"),!1):void 0===e?(window.alert("Specify a variations file first"),!1):void 0!==n||(window.alert("Specify a package file first"),!1)}function b(t,e,n,r,i){if(t 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk( + uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) + )) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} + + +/***/ }), + +/***/ "./node_modules/buffer/index.js": +/*!**************************************!*\ + !*** ./node_modules/buffer/index.js ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var r=n(25),i=n(26),o=n(15);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(r)return F(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return O(this,e,n);case"latin1":case"binary":return k(this,e,n);case"base64":return x(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){var o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var c=-1;for(o=n;oa&&(n=a-u),o=n;o>=0;o--){for(var l=!0,h=0;hi&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function x(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:f>223?3:f>191?2:1;if(i+l<=n)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(c=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},u.prototype.compare=function(t,e,n,r,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),f=this.slice(r,i),c=t.slice(e,n),l=0;li)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":return _(this,t,e,n);case"latin1":case"binary":return S(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function O(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function R(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i>>8*(r?i:1-i)}function B(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i>>8*(r?i:3-i)&255}function N(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,r,o){return o||N(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function M(t,e,n,r,o){return o||N(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUInt8=function(t,e){return e||C(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||C(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||C(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||C(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||C(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||C(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){e||C(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||C(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||C(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||C(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||C(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||L(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);L(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);L(this,t,e,n,i-1,-i)}var o=n-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+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return M(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return M(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--i)t[i+e]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Y(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(3))},function(t,e,n){(function(t){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,n(5).Buffer)},function(t,e,n){"use strict";n.r(e),n.d(e,"fetcher",(function(){return a})),n.d(e,"readFilePromise",(function(){return u})),n.d(e,"testCall",(function(){return c})),n.d(e,"incrementProgress",(function(){return l}));var r=n(22),i=n.n(r);function o(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var s=t.apply(e,n);function a(t){o(s,r,i,a,u,"next",t)}function u(t){o(s,r,i,a,u,"throw",t)}a(void 0)}))}}function a(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return fetch(t,e).then((function(r){if(500===r.status){if(n)return console.error("Trying one more time"),a(t,e,!1);console.error("Second attempt failed as well")}else n||console.log("Second attempt success!");return r.json()})).catch((function(t){return console.error(t,e)}))}function u(t){return f.apply(this,arguments)}function f(){return(f=s(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=new FileReader).readAsText(e),t.abrupt("return",new Promise((function(t,e){n.onerror=function(){n.abort(),e(new DOMException("Problem parsing input file."))},n.onload=function(){i()(n.result,{},(function(e,n){e?console.error("CSV parser failed: ",e):t(n)}))}})));case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function c(t){t.preventDefault(),fetch("".concat(wpApiSettings.root,"wp/v2"),{method:"get",headers:{"X-WP-Nonce":wpApiSettings.nonce,"Content-Type":"application/json"}}).then((function(t){return t.json().then(console.log)})).catch(console.log)}function l(t){return t}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,f=[],c=!1,l=-1;function h(){c&&u&&(c=!1,u.length?f=u.concat(f):l=-1,f.length&&d())}function d(){if(!c){var t=a(h);c=!0;for(var e=f.length;e;){for(u=f,f=[];++l1)for(var n=1;n0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var f=u.length,c=m(u,f);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){(e=t.exports=n(17)).Stream=e,e.Readable=e,e.Writable=n(13),e.Duplex=n(2),e.Transform=n(21),e.PassThrough=n(34)},function(t,e,n){var r=n(5),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){"use strict";(function(e,r,i){var o=n(9);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=v;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:o.nextTick;v.WritableState=y;var f=Object.create(n(6));f.inherits=n(4);var c={deprecate:n(32)},l=n(18),h=n(12).Buffer,d=i.Uint8Array||function(){};var p,g=n(19);function m(){}function y(t,e){a=a||n(2),t=t||{};var r=e instanceof a;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,f=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(f||0===f)?f:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?(o.nextTick(i,r),o.nextTick(I,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(i(r),t._writableState.errorEmitted=!0,t.emit("error",r),I(t,e))}(t,n,r,e,i);else{var s=S(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||_(t,n),r?u(w,t,n,s,i):w(t,n,s,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function v(t){if(a=a||n(2),!(p.call(v,this)||this instanceof a))return new v(t);this._writableState=new y(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),l.call(this)}function b(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function w(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),I(t,e)}function _(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,b(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;n;){var f=n.chunk,c=n.encoding,l=n.callback;if(b(t,e,!1,e.objectMode?1:f.length,f,c,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function S(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function E(t,e){t._final((function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),I(t,e)}))}function I(t,e){var n=S(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(E,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}f.inherits(v,l),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===v&&(t&&t._writableState instanceof y)}})):p=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,n){var r,i=this._writableState,s=!1,a=!i.objectMode&&(r=t,h.isBuffer(r)||r instanceof d);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=m),i.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),o.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var i=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),o.nextTick(r,s),i=!1),i}(this,i,t,n))&&(i.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n));return e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,I(t,e),n&&(e.finished?o.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=g.destroy,v.prototype._undestroy=g.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(8),n(16).setImmediate,n(3))},function(t,e,n){t.exports=function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){if(o)return o(s,!0);throw new Error("Cannot find module '"+s+"'")}var u=n[s]={exports:{}};e[s][0].call(u.exports,(function(t){return i(e[s][1][t]||t)}),u,u.exports,t,e,n,r)}return n[s].exports}for(var o=!1,s=0;s>16),c((65280&i)>>8),c(255&i);return 2==o?c(255&(i=f(t.charAt(n))<<2|f(t.charAt(n+1))>>4)):1==o&&(c((i=f(t.charAt(n))<<10|f(t.charAt(n+1))<<4|f(t.charAt(n+2))>>2)>>8&255),c(255&i)),s},t.fromByteArray=function(t){var e,n,r,i,o=t.length%3,s="";function a(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}for(e=0,r=t.length-o;e>18&63)+a(i>>12&63)+a(i>>6&63)+a(63&i);switch(o){case 1:s+=a((n=t[t.length-1])>>2),s+=a(n<<4&63),s+="==";break;case 2:s+=a((n=(t[t.length-2]<<8)+t[t.length-1])>>10),s+=a(n>>4&63),s+=a(n<<2&63),s+="="}return s}}(void 0===n?this.base64js={}:n)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(t,e,n){(function(e,r,i,o,s,a,u,f,c){var l=t("base64-js"),h=t("ieee754");function i(t,e,n){if(!(this instanceof i))return new i(t,e,n);var r,o,s,a,u,f=typeof t;if("base64"===e&&"string"==f)for(t=(r=t).trim?r.trim():r.replace(/^\s+|\s+$/g,"");t.length%4!=0;)t+="=";if("number"==f)o=T(t);else if("string"==f)o=i.byteLength(t,e);else{if("object"!=f)throw new Error("First argument needs to be a number, array or string.");o=T(t.length)}if(i._useTypedArrays?s=i._augment(new Uint8Array(o)):((s=this).length=o,s._isBuffer=!0),i._useTypedArrays&&"number"==typeof t.byteLength)s._set(t);else if(j(u=t)||i.isBuffer(u)||u&&"object"==typeof u&&"number"==typeof u.length)for(a=0;a>>0)):(e+1>>0),i}function y(t,e,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=e,"missing offset"),D(e+1>>8*(r?s:1-s)}function S(t,e,n,r,i){i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3>>8*(r?s:3-s)&255}function E(t,e,n,r,i){i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1>8,r=e%256,i.push(r),i.push(n);return i}(e),t,n,r)}(this,t,e,n);break;default:throw new Error("Unknown encoding")}return s},i.prototype.toString=function(t,e,n){var r,i,o,s,a=this;if(t=String(t||"utf8").toLowerCase(),e=Number(e)||0,(n=void 0!==n?Number(n):n=a.length)===e)return"";switch(t){case"hex":r=function(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||rthis.length&&(r=this.length),t.length-e=this.length))return this[t]},i.prototype.readUInt16LE=function(t,e){return g(this,t,!0,e)},i.prototype.readUInt16BE=function(t,e){return g(this,t,!1,e)},i.prototype.readUInt32LE=function(t,e){return m(this,t,!0,e)},i.prototype.readUInt32BE=function(t,e){return m(this,t,!1,e)},i.prototype.readInt8=function(t,e){if(e||(D(null!=t,"missing offset"),D(t=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){return y(this,t,!0,e)},i.prototype.readInt16BE=function(t,e){return y(this,t,!1,e)},i.prototype.readInt32LE=function(t,e){return v(this,t,!0,e)},i.prototype.readInt32BE=function(t,e){return v(this,t,!1,e)},i.prototype.readFloatLE=function(t,e){return b(this,t,!0,e)},i.prototype.readFloatBE=function(t,e){return b(this,t,!1,e)},i.prototype.readDoubleLE=function(t,e){return w(this,t,!0,e)},i.prototype.readDoubleBE=function(t,e){return w(this,t,!1,e)},i.prototype.writeUInt8=function(t,e,n){n||(D(null!=t,"missing value"),D(null!=e,"missing offset"),D(e=this.length||(this[e]=t)},i.prototype.writeUInt16LE=function(t,e,n){_(this,t,e,!0,n)},i.prototype.writeUInt16BE=function(t,e,n){_(this,t,e,!1,n)},i.prototype.writeUInt32LE=function(t,e,n){S(this,t,e,!0,n)},i.prototype.writeUInt32BE=function(t,e,n){S(this,t,e,!1,n)},i.prototype.writeInt8=function(t,e,n){n||(D(null!=t,"missing value"),D(null!=e,"missing offset"),D(e=this.length||(0<=t?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n))},i.prototype.writeInt16LE=function(t,e,n){E(this,t,e,!0,n)},i.prototype.writeInt16BE=function(t,e,n){E(this,t,e,!1,n)},i.prototype.writeInt32LE=function(t,e,n){I(this,t,e,!0,n)},i.prototype.writeInt32BE=function(t,e,n){I(this,t,e,!1,n)},i.prototype.writeFloatLE=function(t,e,n){x(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){x(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){A(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){A(this,t,e,!1,n)},i.prototype.fill=function(t,e,n){if(t=t||0,e=e||0,n=n||this.length,"string"==typeof t&&(t=t.charCodeAt(0)),D("number"==typeof t&&!isNaN(t),"value is not a number"),D(e<=n,"end < start"),n!==e&&0!==this.length){D(0<=e&&e"},i.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(i._useTypedArrays)return new i(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;e=e.length||i>=t.length);i++)e[i+n]=t[i];return i}function N(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}function P(t,e){D("number"==typeof t,"cannot write a non-number as a number"),D(0<=t,"specified a negative value for writing an unsigned value"),D(t<=e,"value is larger than maximum value for type"),D(Math.floor(t)===t,"value has a fractional component")}function M(t,e,n){D("number"==typeof t,"cannot write a non-number as a number"),D(t<=e,"value larger than maximum allowed value"),D(n<=t,"value smaller than minimum allowed value"),D(Math.floor(t)===t,"value has a fractional component")}function U(t,e,n){D("number"==typeof t,"cannot write a non-number as a number"),D(t<=e,"value larger than maximum allowed value"),D(n<=t,"value smaller than minimum allowed value")}function D(t,e){if(!t)throw new Error(e||"Failed assertion")}i._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=O.get,t.set=O.set,t.write=O.write,t.toString=O.toString,t.toLocaleString=O.toString,t.toJSON=O.toJSON,t.copy=O.copy,t.slice=O.slice,t.readUInt8=O.readUInt8,t.readUInt16LE=O.readUInt16LE,t.readUInt16BE=O.readUInt16BE,t.readUInt32LE=O.readUInt32LE,t.readUInt32BE=O.readUInt32BE,t.readInt8=O.readInt8,t.readInt16LE=O.readInt16LE,t.readInt16BE=O.readInt16BE,t.readInt32LE=O.readInt32LE,t.readInt32BE=O.readInt32BE,t.readFloatLE=O.readFloatLE,t.readFloatBE=O.readFloatBE,t.readDoubleLE=O.readDoubleLE,t.readDoubleBE=O.readDoubleBE,t.writeUInt8=O.writeUInt8,t.writeUInt16LE=O.writeUInt16LE,t.writeUInt16BE=O.writeUInt16BE,t.writeUInt32LE=O.writeUInt32LE,t.writeUInt32BE=O.writeUInt32BE,t.writeInt8=O.writeInt8,t.writeInt16LE=O.writeInt16LE,t.writeInt16BE=O.writeInt16BE,t.writeInt32LE=O.writeInt32LE,t.writeInt32BE=O.writeInt32BE,t.writeFloatLE=O.writeFloatLE,t.writeFloatBE=O.writeFloatBE,t.writeDoubleLE=O.writeDoubleLE,t.writeDoubleBE=O.writeDoubleBE,t.fill=O.fill,t.inspect=O.inspect,t.toArrayBuffer=O.toArrayBuffer,t}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(t,e,n){(function(n,r,i,o,s,a,u,f,c){var l=new(i=t("buffer").Buffer)(4);l.fill(0),e.exports={hash:function(t,e,n,r){return i.isBuffer(t)||(t=new i(t)),function(t,e,n){for(var r=new i(e),o=n?r.writeInt32BE:r.writeInt32LE,s=0;sg?e=t(e):e.length>5]|=128<>>9<<4)]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,s=0;s>>32-a,n);var s,a}function p(t,e,n,r,i,o,s){return d(e&n|~e&r,t,e,i,o,s)}function g(t,e,n,r,i,o,s){return d(e&r|n&~r,t,e,i,o,s)}function m(t,e,n,r,i,o,s){return d(e^n^r,t,e,i,o,s)}function y(t,e,n,r,i,o,s){return d(n^(e|~r),t,e,i,o,s)}function v(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}e.exports=function(t){return l.hash(t,h,16)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(t,e,n){(function(t,n,r,i,o,s,a,u,f){var c;c=function(t){for(var e,n=new Array(t),r=0;r>>((3&r)<<3)&255;return n},e.exports=c}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(t,e,n){(function(n,r,i,o,s,a,u,f,c){var l=t("./helpers");function h(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var n,r=Array(80),i=1732584193,o=-271733879,s=-1732584194,a=271733878,u=-1009589776,f=0;f>16)+(e>>16)+(n>>16)<<16|65535&n}function g(t,e){return t<>>32-e}e.exports=function(t){return l.hash(t,h,20,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(t,e,n){(function(n,r,i,o,s,a,u,f,c){function l(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function h(t,e){return t>>>e|t<<32-e}function d(t,e){return t>>>e}function p(t,e){var n,r,i,o,s,a,u,f,c,p,g,m,y,v,b,w,_,S,E=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),I=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),x=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var A=0;A>1,c=-7,l=n?i-1:0,h=n?-1:1,d=t[e+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=a;0>=-c,c+=r;0>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=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=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),2<=(e+=1<=s+l?h/u:h*Math.pow(2,1-l))*u&&(s++,u/=2),c<=s+l?(a=0,s=c):1<=s+l?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));8<=i;t[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(27),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(3))},function(t,e,n){"use strict";(function(e,r){var i=n(9);t.exports=b;var o,s=n(15);b.ReadableState=v;n(10).EventEmitter;var a=function(t,e){return t.listeners(e).length},u=n(18),f=n(12).Buffer,c=e.Uint8Array||function(){};var l=Object.create(n(6));l.inherits=n(4);var h=n(29),d=void 0;d=h&&h.debuglog?h.debuglog("stream"):function(){};var p,g=n(30),m=n(19);l.inherits(b,u);var y=["error","close","destroy","pause","resume"];function v(t,e){t=t||{};var r=e instanceof(o=o||n(2));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=n(20).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function b(t){if(o=o||n(2),!(this instanceof b))return new b(t);this._readableState=new v(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function w(t,e,n,r,i){var o,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,E(t)}(t,s)):(i||(o=function(t,e){var n;r=e,f.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===f.prototype||(e=function(t){return f.from(t)}(e)),r?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?_(t,s,e,!1):x(t,s)):_(t,s,e,!1))):r||(s.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(I,t):I(t))}function I(t){d("emit readable"),t.emit("readable"),T(t)}function x(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(A,t,e))}function A(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=f.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,s),0===(t-=s)){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function C(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(L,e,t))}function L(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function R(t,e){for(var n=0,r=t.length;n=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):E(this),null;if(0===(t=S(t,e))&&e.ended)return 0===e.length&&C(this),null;var r,i=e.needReadable;return d("need readable",i),(0===e.length||e.length-t0?j(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&C(this)),null!==r&&this.emit("data",r),r},b.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:b;function f(e,r){d("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),t.removeListener("close",y),t.removeListener("finish",v),t.removeListener("drain",l),t.removeListener("error",m),t.removeListener("unpipe",f),n.removeListener("end",c),n.removeListener("end",b),n.removeListener("data",g),h=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function c(){d("onend"),t.end()}o.endEmitted?i.nextTick(u):n.once("end",u),t.on("unpipe",f);var l=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,T(t))}}(n);t.on("drain",l);var h=!1;var p=!1;function g(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==R(o.pipes,t))&&!h&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function m(e){d("onerror",e),b(),t.removeListener("error",m),0===a(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",v),b()}function v(){d("onfinish"),t.removeListener("close",y),b()}function b(){d("unpipe"),n.unpipe(t)}return n.on("data",g),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",m),t.once("close",y),t.once("finish",v),t.emit("pipe",n),o.flowing||(d("pipe resume"),n.resume()),t},b.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function c(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(t.lastNeed=i-1),i;if(--r=0)return i>0&&(t.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";t.exports=s;var r=n(2),i=Object.create(n(6));function o(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=0);else{if("string"!=typeof n.max_record_size||!/\d+/.test(n.max_record_size))throw new Error("Invalid Option: max_record_size must be a positive integer, got "+JSON.stringify(n.max_record_size));n.max_record_size=parseInt(n.max_record_size)}if(void 0===n.objname||null===n.objname||!1===n.objname)n.objname=void 0;else if(e.isBuffer(n.objname)){if(0===n.objname.length)throw new Error("Invalid Option: objname must be a non empty buffer");n.objname=n.objname.toString()}else{if("string"!=typeof n.objname)throw new Error("Invalid Option: objname must be a string or a buffer, got "+n.objname);if(0===n.objname.length)throw new Error("Invalid Option: objname must be a non empty string")}if(void 0===n.on_record||null===n.on_record)n.on_record=void 0;else if("function"!=typeof n.on_record)throw new f("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,","got "+JSON.stringify(n.on_record)]);if(null===n.quote||!1===n.quote||""===n.quote)n.quote=null;else{if(void 0===n.quote||!0===n.quote?n.quote=e.from('"'):"string"==typeof n.quote&&(n.quote=e.from(n.quote)),!e.isBuffer(n.quote))throw new Error("Invalid Option: quote must be a buffer or a string, got "+JSON.stringify(n.quote));if(1!==n.quote.length)throw new Error("Invalid Option Length: quote must be one character, got "+n.quote.length);n.quote=n.quote[0]}if(void 0===n.raw||null===n.raw||!1===n.raw)n.raw=!1;else if(!0!==n.raw)throw new Error("Invalid Option: raw must be true, got "+JSON.stringify(n.raw));if(n.record_delimiter?Array.isArray(n.record_delimiter)||(n.record_delimiter=[n.record_delimiter]):n.record_delimiter=[],n.record_delimiter=n.record_delimiter.map((function(t){return"string"==typeof t&&(t=e.from(t)),t})),"boolean"==typeof n.relax);else{if(void 0!==n.relax&&null!==n.relax)throw new Error("Invalid Option: relax must be a boolean, got "+JSON.stringify(n.relax));n.relax=!1}if("boolean"==typeof n.relax_column_count);else{if(void 0!==n.relax_column_count&&null!==n.relax_column_count)throw new Error("Invalid Option: relax_column_count must be a boolean, got "+JSON.stringify(n.relax_column_count));n.relax_column_count=!1}if("boolean"==typeof n.relax_column_count_less);else{if(void 0!==n.relax_column_count_less&&null!==n.relax_column_count_less)throw new Error("Invalid Option: relax_column_count_less must be a boolean, got "+JSON.stringify(n.relax_column_count_less));n.relax_column_count_less=!1}if("boolean"==typeof n.relax_column_count_more);else{if(void 0!==n.relax_column_count_more&&null!==n.relax_column_count_more)throw new Error("Invalid Option: relax_column_count_more must be a boolean, got "+JSON.stringify(n.relax_column_count_more));n.relax_column_count_more=!1}if("boolean"==typeof n.skip_empty_lines);else{if(void 0!==n.skip_empty_lines&&null!==n.skip_empty_lines)throw new Error("Invalid Option: skip_empty_lines must be a boolean, got "+JSON.stringify(n.skip_empty_lines));n.skip_empty_lines=!1}if("boolean"==typeof n.skip_lines_with_empty_values);else{if(void 0!==n.skip_lines_with_empty_values&&null!==n.skip_lines_with_empty_values)throw new Error("Invalid Option: skip_lines_with_empty_values must be a boolean, got "+JSON.stringify(n.skip_lines_with_empty_values));n.skip_lines_with_empty_values=!1}if("boolean"==typeof n.skip_lines_with_error);else{if(void 0!==n.skip_lines_with_error&&null!==n.skip_lines_with_error)throw new Error("Invalid Option: skip_lines_with_error must be a boolean, got "+JSON.stringify(n.skip_lines_with_error));n.skip_lines_with_error=!1}if(void 0===n.rtrim||null===n.rtrim||!1===n.rtrim)n.rtrim=!1;else if(!0!==n.rtrim)throw new Error("Invalid Option: rtrim must be a boolean, got "+JSON.stringify(n.rtrim));if(void 0===n.ltrim||null===n.ltrim||!1===n.ltrim)n.ltrim=!1;else if(!0!==n.ltrim)throw new Error("Invalid Option: ltrim must be a boolean, got "+JSON.stringify(n.ltrim));if(void 0===n.trim||null===n.trim||!1===n.trim)n.trim=!1;else if(!0!==n.trim)throw new Error("Invalid Option: trim must be a boolean, got "+JSON.stringify(n.trim));if(!0===n.trim&&!1!==t.ltrim?n.ltrim=!0:!0!==n.ltrim&&(n.ltrim=!1),!0===n.trim&&!1!==t.rtrim?n.rtrim=!0:!0!==n.rtrim&&(n.rtrim=!1),void 0===n.to||null===n.to)n.to=-1;else{if("string"==typeof n.to&&/\d+/.test(n.to)&&(n.to=parseInt(n.to)),!Number.isInteger(n.to))throw new Error("Invalid Option: to must be an integer, got "+JSON.stringify(t.to));if(n.to<=0)throw new Error("Invalid Option: to must be a positive integer greater than 0, got "+JSON.stringify(t.to))}if(void 0===n.to_line||null===n.to_line)n.to_line=-1;else{if("string"==typeof n.to_line&&/\d+/.test(n.to_line)&&(n.to_line=parseInt(n.to_line)),!Number.isInteger(n.to_line))throw new Error("Invalid Option: to_line must be an integer, got "+JSON.stringify(t.to_line));if(n.to_line<=0)throw new Error("Invalid Option: to_line must be a positive integer greater than 0, got "+JSON.stringify(t.to_line))}this.info={comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},this.options=n,this.state={bomSkipped:!1,castField:r,commenting:!1,enabled:1===n.from_line,escaping:!1,escapeIsQuote:n.escape===n.quote,expectedRecordLength:null===n.columns?0:n.columns.length,field:new o(20),firstLineToHeaders:i,info:Object.assign({},this.info),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new o(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:0===n.record_delimiter.length?2:Math.max(...n.record_delimiter.map(t=>t.length)),trimChars:[e.from(" ")[0],e.from("\t")[0]],wasQuoting:!1,wasRowDelimiter:!1}}_transform(t,e,n){if(!0===this.state.stop)return;const r=this.__parse(t,!1);void 0!==r&&(this.state.stop=!0),n(r)}_flush(t){if(!0===this.state.stop)return;t(this.__parse(void 0,!0))}__parse(t,n){const{bom:r,comment:i,escape:o,from_line:a,info:u,ltrim:c,max_record_size:l,quote:h,raw:d,relax:p,rtrim:g,skip_empty_lines:m,to:y,to_line:v}=this.options;let{record_delimiter:b}=this.options;const{bomSkipped:w,previousBuf:_,rawBuffer:S,escapeIsQuote:E}=this.state;let I;if(void 0===_){if(void 0===t)return void this.push(null);I=t}else I=void 0!==_&&void 0===t?_:e.concat([_,t]);if(!1===w)if(!1===r)this.state.bomSkipped=!0;else if(I.length<3){if(!1===n)return void(this.state.previousBuf=I)}else 0===s.compare(I,0,3)&&(I=I.slice(3)),this.state.bomSkipped=!0;const x=I.length;let A;for(A=0;Av)return this.state.stop=!0,void this.push(null);if(!1===this.state.quoting&&0===b.length){this.__autoDiscoverRowDelimiter(I,A)&&(b=this.options.record_delimiter)}const t=I[A];if(!0===d&&S.append(t),13!==t&&10!==t||!1!==this.state.wasRowDelimiter||(this.state.wasRowDelimiter=!0),!0===this.state.escaping)this.state.escaping=!1;else{if(null!==o&&!0===this.state.quoting&&t===o&&A+1=a){this.state.enabled=!0,this.__resetField(),this.__resetRow(),A+=e-1;continue}{const t=this.__onField();if(void 0!==t)return t;const e=this.__onRow();if(void 0!==e)return e}if(-1!==y&&this.info.records>=y)return this.state.stop=!0,void this.push(null)}this.state.commenting=!1,A+=e-1;continue}if(this.state.commenting)continue;if(0!==(null===i?0:this.__compareBytes(i,I,A,t))){this.state.commenting=!0;continue}let n=this.__isDelimiter(t,I,A);if(0!==n){const t=this.__onField();if(void 0!==t)return t;A+=n-1;continue}}}if(!1===this.state.commenting&&0!==l&&this.state.record_length+this.state.field.length>l){const t=this.__error(new f("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes","of "+l,"at line "+this.info.lines],this.__context()));if(void 0!==t)return t}const e=!1===c||!0===this.state.quoting||0!==this.state.field.length||!this.__isCharTrimable(t),n=!1===g||!1===this.state.wasQuoting;if(!0===e&&!0===n)this.state.field.append(t);else if(!0===g&&!this.__isCharTrimable(t)){const t=this.__error(new f("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote","at line "+this.info.lines],this.__context()));if(void 0!==t)return t}}if(!0===n)if(!0===this.state.quoting){const t=this.__error(new f("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:","the parsing is finished with an opening quote at line "+this.info.lines],this.__context()));if(void 0!==t)return t}else if(!0===this.state.wasQuoting||0!==this.state.record.length||0!==this.state.field.length){const t=this.__onField();if(void 0!==t)return t;const e=this.__onRow();if(void 0!==e)return e}else!0===this.state.wasRowDelimiter?this.info.empty_lines++:!0===this.state.commenting&&this.info.comment_lines++;else this.state.previousBuf=I.slice(A);!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1)}__isCharTrimable(t){return 32===t||9===t||13===t||10===t||12===t}__onRow(){const{columns:t,columns_duplicates_to_array:e,info:n,from:r,relax_column_count:i,relax_column_count_less:o,relax_column_count_more:s,raw:a,skip_lines_with_empty_values:u}=this.options,{enabled:c,record:l}=this.state;if(!1===c)return this.__resetRow();const d=l.length;if(!0===t)return h(l)?void this.__resetRow():this.__firstLineToColumns(l);if(!1===t&&0===this.info.records&&(this.state.expectedRecordLength=d),d!==this.state.expectedRecordLength)if(!0===i||!0===o&&dthis.state.expectedRecordLength)this.info.invalid_field_length++;else if(!1===t){const t=this.__error(new f("CSV_INCONSISTENT_RECORD_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${d} on line ${this.info.lines}`],this.__context(),{record:l}));if(void 0!==t)return t}else{const e=this.__error(new f("CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH",["Invalid Record Length:",`columns length is ${t.length},`,`got ${d} on line ${this.info.lines}`],this.__context(),{record:l}));if(void 0!==e)return e}if(!0===u&&h(l))this.__resetRow();else{if(!0===this.state.recordHasError)return this.__resetRow(),void(this.state.recordHasError=!1);if(this.info.records++,1===r||this.info.records>=r)if(!1!==t){const r={};for(let n=0,i=l.length;n=0}__compareBytes(t,e,n,r){if(t[0]!==r)return 0;const i=t.length;for(let r=1;rthis.state.record.length?t[this.state.record.length].name:null:this.state.record.length,empty_lines:this.info.empty_lines,header:!0===t,index:this.state.record.length,invalid_field_length:this.info.invalid_field_length,quoting:this.state.wasQuoting,lines:this.info.lines,records:this.info.records}}}const u=function(){let t,n,i;for(let r in arguments){const o=arguments[r],s=typeof o;if(void 0!==t||"string"!=typeof o&&!e.isBuffer(o))if(void 0===n&&l(o))n=o;else{if(void 0!==i||"function"!==s)throw new f("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(o)} at index ${r}`]);i=o}else t=o}const o=new a(n);if(i){const t=void 0===n||void 0===n.objname?[]:{};o.on("readable",(function(){let e;for(;null!==(e=this.read());)void 0===n||void 0===n.objname?t.push(e):t[e[0]]=e[1]})),o.on("error",(function(t){i(t,void 0,o.info)})),o.on("end",(function(){i(void 0,t,o.info)}))}return void 0!==t&&("function"==typeof r?r((function(){o.write(t),o.end()})):(o.write(t),o.end())),o};class f extends Error{constructor(t,n,...r){Array.isArray(n)&&(n=n.join(" ")),super(n),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,f),this.code=t;for(const t of r)for(const n in t){const r=t[n];this[n]=e.isBuffer(r)?r.toString():null==r?r:JSON.parse(JSON.stringify(r))}}}u.Parser=a,u.CsvError=f,t.exports=u;const c=function(t){return t.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()}))},l=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)},h=function(t){return t.every(t=>null==t||t.toString&&""===t.toString().trim())},d=function(t){const e=[];for(let n=0,r=t.length;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]&&arguments[1];return new Promise((function(n,r){t||r(t),fetch("".concat(wpApiSettings.root,"wp/v2/product/").concat(t,"?force=true"),{method:"delete",headers:{"X-WP-Nonce":wpApiSettings.nonce,"Content-Type":"application/json"}}).then((function(t){n(t),e&&console.log(t)})).catch(console.error)}))}function d(t,e){return p.apply(this,arguments)}function p(){return(p=f(regeneratorRuntime.mark((function t(e,n){var r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=[];case 1:if(!(01&&void 0!==u[1]&&u[1],s={title:e[o.f.name],content:e[o.f.desc],excerpt:e[o.f.short_desc],status:e[o.f.visibility],terms:e.terms,meta:{SKU:e[o.f.sku],PIC:e[o.f.pic],ordering_info:e[o.f.orderInfo],product_type:e[o.f.type],product_hash:e.checksum,main_model:e[o.f.main_model],part_number_finder:e[o.f.pnf],search_weight:e[o.f.searchWeight]},specs:e.specs,gallery:e.gallery,variations:e.variations?Object(r.variationSlice)(e.variations,0):[],packages:Object.values(e.packages?e.packages:{}),warranty:e.warranty,features:e.features,indications:e.indications,downloads:e.downloads,related:e.related,region:e[o.f.region]},a="".concat(wpApiSettings.root,"wp/v2/product"),n&&(a="".concat(wpApiSettings.root,"wp/v2/product/").concat(n)),t.abrupt("return",Object(i.fetcher)(a,{method:"post",headers:{"X-WP-Nonce":wpApiSettings.nonce,"Content-Type":"application/json"},body:JSON.stringify(s)}).then((function(t){if(console.log(t),void 0!==t&&e.variations&&12&&void 0!==a[2]?a[2]:1,console.log("Posting more variations at a depth of ".concat(o)),s=JSON.stringify({variations:Object(r.variationSlice)(n,o)}),t.abrupt("return",Object(i.fetcher)("".concat(wpApiSettings.root,"wp/v2/product/").concat(e),{method:"post",headers:{"X-WP-Nonce":wpApiSettings.nonce,"Content-Type":"application/json"},body:s}).then((function(t){if(t&&o+1!==n.varies.length&&16>o)return y(e,n,o+1)})));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function b(t,e,n,r){return w.apply(this,arguments)}function w(){return(w=f(regeneratorRuntime.mark((function t(e,n,r,i){var o,s,a,u,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=n.length+r.length,f=0,i.textContent="Uploading products: 0 of ".concat(o," received"),console.log("POSTing...",n,r);case 4:if(!(0t.length)&&(e=t.length);for(var n=0,r=new Array(e);ne.length)return!1;e.forEach((function(e,r){var i=e.substr(1,e.length-2);delete n.specs[t+e],0===r?(n.specs[t.trim()]=o[t][e],n.specs[t.trim()].val+=" ".concat(i)):n.specs[t.trim()].val+=" (".concat(o[t][e].val," ").concat(i,")")}))})),n.specs),void 0!==f&&f[i.f.name]&&f[i.f.pic]?f:void 0)})).filter((function(t){return void 0!==t}))}function u(t){return Object.keys(t).forEach((function(e){var n,r,s,a;t[e]=(n=t[e],r={},s=["Minimum","Maximum","Min","Max","min","max"],void 0===n.variations[0]&&console.log("Has no variations?",n),Object.keys(n.variations[0].specs).forEach((function(t,e,n){var i=o(function(t,e){var n=!1,r="";return e.forEach((function(e){t.includes(e)&&!n&&(n=e,r=t.replace(n,"").trim())})),[n,r]}(t,s),2),a=i[0],u=i[1];a&&(r[u]||(r[u]=[]),r[u].push(t))})),n.variations.forEach((function(t,e){t=t.specs,Object.keys(r).forEach((function(i){if(2===r[i].length&&t[r[i][0]]){var o={featured:!1,icon:"",val:"".concat(t[r[i][0]].val," - ").concat(t[r[i][1]].val)};t[r[i][0]].val="",t[r[i][1]].val="",t[i]=o,n.variations[e].specs=t}}))})),n),t[e]=function(t){if(void 0===t.variations)return t;var e=[];t.variations=t.variations.map((function(t){var n={};return Object.keys(t.specs).forEach((function(r){var i=e.indexOf(r);i=-1===i?e.push(r)-1:i,n[i]=t.specs[r].val})),t.specs=n,t}));for(var n=[];00?s-4:s;for(n=0;n>16&255,u[c++]=e>>8&255,u[c++]=255&e;2===a&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,u[c++]=255&e);1===a&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e);return u},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=0,a=n-i;sa?a:s+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,n){for(var i,o,s=[],a=e;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,c=-7,l=n?i-1:0,h=n?-1:1,d=t[e+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=256*o+t[e+l],l+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+t[e+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=f}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=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=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;t[n+d]=255&s,d+=p,s/=256,f-=8);t[n+d-p]|=128*g}},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,s,a,u=1,f={},c=!1,l=t.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(t);h=h&&h.setTimeout?h:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},r=function(t){o.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(i=l.documentElement,r=function(t){var e=l.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),r=function(e){t.postMessage(s+e,"*")}),h.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e,n,i,o=r.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,n=o,i=a,e.copy(n,i),a+=s.data.length,s=s.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(3))},function(t,e,n){ +/* eslint-disable no-proto */ + + + +var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js") +var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js") +var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js") + +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * Due to various browser bugs, sometimes the Object implementation will be used even + * when the browser supports typed arrays. + * + * Note: + * + * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. + * + * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. + * + * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of + * incorrect length in some situations. + + * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they + * get the Object implementation, which is slower but behaves correctly. + */ +Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined + ? global.TYPED_ARRAY_SUPPORT + : typedArraySupport() + +/* + * Export kMaxLength after typed array support is determined. + */ +exports.kMaxLength = kMaxLength() + +function typedArraySupport () { + try { + var arr = new Uint8Array(1) + arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} + return arr.foo() === 42 && // typed array instances can be augmented + typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` + arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` + } catch (e) { + return false + } +} + +function kMaxLength () { + return Buffer.TYPED_ARRAY_SUPPORT + ? 0x7fffffff + : 0x3fffffff +} + +function createBuffer (that, length) { + if (kMaxLength() < length) { + throw new RangeError('Invalid typed array length') + } + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = new Uint8Array(length) + that.__proto__ = Buffer.prototype + } else { + // Fallback: Return an object instance of the Buffer class + if (that === null) { + that = new Buffer(length) + } + that.length = length + } + + return that +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + +function Buffer (arg, encodingOrOffset, length) { + if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { + return new Buffer(arg, encodingOrOffset, length) + } + + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new Error( + 'If encoding is specified then the first argument must be a string' + ) + } + return allocUnsafe(this, arg) + } + return from(this, arg, encodingOrOffset, length) +} + +Buffer.poolSize = 8192 // not used by this implementation + +// TODO: Legacy, not needed anymore. Remove in next major version. +Buffer._augment = function (arr) { + arr.__proto__ = Buffer.prototype + return arr +} + +function from (that, value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number') + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, encodingOrOffset, length) + } + + if (typeof value === 'string') { + return fromString(that, value, encodingOrOffset) + } + + return fromObject(that, value) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(null, value, encodingOrOffset, length) +} + +if (Buffer.TYPED_ARRAY_SUPPORT) { + Buffer.prototype.__proto__ = Uint8Array.prototype + Buffer.__proto__ = Uint8Array + if (typeof Symbol !== 'undefined' && Symbol.species && + Buffer[Symbol.species] === Buffer) { + // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true + }) + } +} + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number') + } else if (size < 0) { + throw new RangeError('"size" argument must not be negative') + } +} + +function alloc (that, size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(that, size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' + ? createBuffer(that, size).fill(fill, encoding) + : createBuffer(that, size).fill(fill) + } + return createBuffer(that, size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(null, size, fill, encoding) +} + +function allocUnsafe (that, size) { + assertSize(size) + that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) + if (!Buffer.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + that[i] = 0 + } + } + return that +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(null, size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(null, size) +} + +function fromString (that, string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding') + } + + var length = byteLength(string, encoding) | 0 + that = createBuffer(that, length) + + var actual = that.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + that = that.slice(0, actual) + } + + return that +} + +function fromArrayLike (that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0 + that = createBuffer(that, length) + for (var i = 0; i < length; i += 1) { + that[i] = array[i] & 255 + } + return that +} + +function fromArrayBuffer (that, array, byteOffset, length) { + array.byteLength // this throws if `array` is not a valid ArrayBuffer + + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('\'offset\' is out of bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('\'length\' is out of bounds') + } + + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array) + } else if (length === undefined) { + array = new Uint8Array(array, byteOffset) + } else { + array = new Uint8Array(array, byteOffset, length) + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = array + that.__proto__ = Buffer.prototype + } else { + // Fallback: Return an object instance of the Buffer class + that = fromArrayLike(that, array) + } + return that +} + +function fromObject (that, obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0 + that = createBuffer(that, len) + + if (that.length === 0) { + return that + } + + obj.copy(that, 0, 0, len) + return that + } + + if (obj) { + if ((typeof ArrayBuffer !== 'undefined' && + obj.buffer instanceof ArrayBuffer) || 'length' in obj) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0) + } + return fromArrayLike(that, obj) + } + + if (obj.type === 'Buffer' && isArray(obj.data)) { + return fromArrayLike(that, obj.data) + } + } + + throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') +} + +function checked (length) { + // Note: cannot use `length < kMaxLength()` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= kMaxLength()) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + kMaxLength().toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return !!(b != null && b._isBuffer) +} + +Buffer.compare = function compare (a, b) { + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError('Arguments must be Buffers') + } + + if (a === b) return 0 + + var x = a.length + var y = b.length + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + var i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos) + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && + (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + string = '' + string + } + + var len = string.length + if (len === 0) return 0 + + // Use a for loop to avoid recursion + var loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + case undefined: + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) return utf8ToBytes(string).length // assume utf8 + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + var loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect +// Buffer instances. +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + var len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + var len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + var len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + var length = this.length | 0 + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + if (this.length > 0) { + str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') + if (this.length > max) str += ' ... ' + } + return '' +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (!Buffer.isBuffer(target)) { + throw new TypeError('Argument must be a Buffer') + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) + + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (isNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (Buffer.TYPED_ARRAY_SUPPORT && + typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + var i + if (dir) { + var foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + var found = true + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + var remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + // must be an even number of digits + var strLen = string.length + if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') + + if (length > strLen / 2) { + length = strLen / 2 + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16) + if (isNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset | 0 + if (isFinite(length)) { + length = length | 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + // legacy write(string, encoding, offset, length) - remove in v0.13 + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + var loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + return asciiWrite(this, string, offset, length) + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + var res = [] + + var i = start + while (i < end) { + var firstByte = buf[i] + var codePoint = null + var bytesPerSequence = (firstByte > 0xEF) ? 4 + : (firstByte > 0xDF) ? 3 + : (firstByte > 0xBF) ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +var MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + var len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = '' + var i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + var len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + var out = '' + for (var i = start; i < end; ++i) { + out += toHex(buf[i]) + } + return out +} + +function utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end) + var res = '' + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + var len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + var newBuf + if (Buffer.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end) + newBuf.__proto__ = Buffer.prototype + } else { + var sliceLen = end - start + newBuf = new Buffer(sliceLen, undefined) + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start] + } + } + + return newBuf +} + +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var i = byteLength + var mul = 1 + var val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) + this[offset] = (value & 0xff) + return offset + 1 +} + +function objectWriteUInt16 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffff + value + 1 + for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { + buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> + (littleEndian ? i : 1 - i) * 8 + } +} + +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + } else { + objectWriteUInt16(this, value, offset, true) + } + return offset + 2 +} + +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + } else { + objectWriteUInt16(this, value, offset, false) + } + return offset + 2 +} + +function objectWriteUInt32 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffffffff + value + 1 + for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { + buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff + } +} + +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, true) + } + return offset + 4 +} + +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, false) + } + return offset + 4 +} + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = 0 + var mul = 1 + var sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = byteLength - 1 + var mul = 1 + var sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + } else { + objectWriteUInt16(this, value, offset, true) + } + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + } else { + objectWriteUInt16(this, value, offset, false) + } + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + } else { + objectWriteUInt32(this, value, offset, true) + } + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, false) + } + return offset + 4 +} + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + var len = end - start + var i + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } + } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start] + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, start + len), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if (code < 256) { + val = code + } + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + } else if (typeof val === 'number') { + val = val & 255 + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + var i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : utf8ToBytes(new Buffer(val, encoding).toString()) + var len = bytes.length + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// HELPER FUNCTIONS +// ================ + +var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = stringtrim(str).replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function stringtrim (str) { + if (str.trim) return str.trim() + return str.replace(/^\s+|\s+$/g, '') +} + +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) +} + +function utf8ToBytes (string, units) { + units = units || Infinity + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +function isnan (val) { + return val !== val // eslint-disable-line no-self-compare +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/core-util-is/lib/util.js": +/*!***********************************************!*\ + !*** ./node_modules/core-util-is/lib/util.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer)) + +/***/ }), + +/***/ "./node_modules/csv-parse/lib/ResizeableBuffer.js": +/*!********************************************************!*\ + !*** ./node_modules/csv-parse/lib/ResizeableBuffer.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) { + +class ResizeableBuffer{ + constructor(size=100){ + this.size = size + this.length = 0 + this.buf = Buffer.alloc(size) + } + prepend(val){ + const length = this.length++ + if(length === this.size){ + this.resize() + } + const buf = this.clone() + this.buf[0] = val + buf.copy(this.buf,1, 0, length) + } + append(val){ + const length = this.length++ + if(length === this.size){ + this.resize() + } + this.buf[length] = val + } + clone(){ + return Buffer.from(this.buf.slice(0, this.length)) + } + resize(){ + const length = this.length + this.size = this.size * 2 + const buf = Buffer.alloc(this.size) + this.buf.copy(buf,0, 0, length) + this.buf = buf + } + toString(){ + return this.buf.slice(0, this.length).toString() + } + toJSON(){ + return this.toString() + } + reset(){ + this.length = 0 + } +} + +module.exports = ResizeableBuffer + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer)) + +/***/ }), + +/***/ "./node_modules/csv-parse/lib/index.js": +/*!*********************************************!*\ + !*** ./node_modules/csv-parse/lib/index.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer, setImmediate) { +/* +CSV Parse + +Please look at the [project documentation](https://csv.js.org/parse/) for +additional information. +*/ + +const { Transform } = __webpack_require__(/*! stream */ "./node_modules/stream-browserify/index.js") +const ResizeableBuffer = __webpack_require__(/*! ./ResizeableBuffer */ "./node_modules/csv-parse/lib/ResizeableBuffer.js") + +const tab = 9 +const nl = 10 +const np = 12 +const cr = 13 +const space = 32 +const bom_utf8 = Buffer.from([239, 187, 191]) + +class Parser extends Transform { + constructor(opts = {}){ + super({...{readableObjectMode: true}, ...opts}) + const options = {} + // Merge with user options + for(let opt in opts){ + options[underscore(opt)] = opts[opt] + } + // Normalize option `bom` + if(options.bom === undefined || options.bom === null || options.bom === false){ + options.bom = false + }else if(options.bom !== true){ + throw new CsvError('CSV_INVALID_OPTION_BOM', [ + 'Invalid option bom:', 'bom must be true,', + `got ${JSON.stringify(options.bom)}` + ]) + } + // Normalize option `cast` + let fnCastField = null + if(options.cast === undefined || options.cast === null || options.cast === false || options.cast === ''){ + options.cast = undefined + }else if(typeof options.cast === 'function'){ + fnCastField = options.cast + options.cast = true + }else if(options.cast !== true){ + throw new CsvError('CSV_INVALID_OPTION_CAST', [ + 'Invalid option cast:', 'cast must be true or a function,', + `got ${JSON.stringify(options.cast)}` + ]) + } + // Normalize option `cast_date` + if(options.cast_date === undefined || options.cast_date === null || options.cast_date === false || options.cast_date === ''){ + options.cast_date = false + }else if(options.cast_date === true){ + options.cast_date = function(value){ + const date = Date.parse(value) + return !isNaN(date) ? new Date(date) : value + } + }else if(typeof options.cast_date !== 'function'){ + throw new CsvError('CSV_INVALID_OPTION_CAST_DATE', [ + 'Invalid option cast_date:', 'cast_date must be true or a function,', + `got ${JSON.stringify(options.cast_date)}` + ]) + } + // Normalize option `columns` + let fnFirstLineToHeaders = null + if(options.columns === true){ + // Fields in the first line are converted as-is to columns + fnFirstLineToHeaders = undefined + }else if(typeof options.columns === 'function'){ + fnFirstLineToHeaders = options.columns + options.columns = true + }else if(Array.isArray(options.columns)){ + options.columns = normalizeColumnsArray(options.columns) + }else if(options.columns === undefined || options.columns === null || options.columns === false){ + options.columns = false + }else{ + throw new CsvError('CSV_INVALID_OPTION_COLUMNS', [ + 'Invalid option columns:', + 'expect an object, a function or true,', + `got ${JSON.stringify(options.columns)}` + ]) + } + // Normalize option `columns_duplicates_to_array` + if(options.columns_duplicates_to_array === undefined || options.columns_duplicates_to_array === null || options.columns_duplicates_to_array === false){ + options.columns_duplicates_to_array = false + }else if(options.columns_duplicates_to_array !== true){ + throw new CsvError('CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY', [ + 'Invalid option columns_duplicates_to_array:', + 'expect an boolean,', + `got ${JSON.stringify(options.columns_duplicates_to_array)}` + ]) + } + // Normalize option `comment` + if(options.comment === undefined || options.comment === null || options.comment === false || options.comment === ''){ + options.comment = null + }else{ + if(typeof options.comment === 'string'){ + options.comment = Buffer.from(options.comment) + } + if(!Buffer.isBuffer(options.comment)){ + throw new CsvError('CSV_INVALID_OPTION_COMMENT', [ + 'Invalid option comment:', + 'comment must be a buffer or a string,', + `got ${JSON.stringify(options.comment)}` + ]) + } + } + // Normalize option `delimiter` + const delimiter_json = JSON.stringify(options.delimiter) + if(!Array.isArray(options.delimiter)) options.delimiter = [options.delimiter] + if(options.delimiter.length === 0){ + throw new CsvError('CSV_INVALID_OPTION_DELIMITER', [ + 'Invalid option delimiter:', + 'delimiter must be a non empty string or buffer or array of string|buffer,', + `got ${delimiter_json}` + ]) + } + options.delimiter = options.delimiter.map(function(delimiter){ + if(delimiter === undefined || delimiter === null || delimiter === false){ + return Buffer.from(',') + } + if(typeof delimiter === 'string'){ + delimiter = Buffer.from(delimiter) + } + if( !Buffer.isBuffer(delimiter) || delimiter.length === 0){ + throw new CsvError('CSV_INVALID_OPTION_DELIMITER', [ + 'Invalid option delimiter:', + 'delimiter must be a non empty string or buffer or array of string|buffer,', + `got ${delimiter_json}` + ]) + } + return delimiter + }) + // Normalize option `escape` + if(options.escape === undefined || options.escape === true){ + options.escape = Buffer.from('"') + }else if(typeof options.escape === 'string'){ + options.escape = Buffer.from(options.escape) + }else if (options.escape === null || options.escape === false){ + options.escape = null + } + if(options.escape !== null){ + if(!Buffer.isBuffer(options.escape)){ + throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(options.escape)}`) + }else if(options.escape.length !== 1){ + throw new Error(`Invalid Option Length: escape must be one character, got ${options.escape.length}`) + }else{ + options.escape = options.escape[0] + } + } + // Normalize option `from` + if(options.from === undefined || options.from === null){ + options.from = 1 + }else{ + if(typeof options.from === 'string' && /\d+/.test(options.from)){ + options.from = parseInt(options.from) + } + if(Number.isInteger(options.from)){ + if(options.from < 0){ + throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`) + } + }else{ + throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`) + } + } + // Normalize option `from_line` + if(options.from_line === undefined || options.from_line === null){ + options.from_line = 1 + }else{ + if(typeof options.from_line === 'string' && /\d+/.test(options.from_line)){ + options.from_line = parseInt(options.from_line) + } + if(Number.isInteger(options.from_line)){ + if(options.from_line <= 0){ + throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`) + } + }else{ + throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`) + } + } + // Normalize option `info` + if(options.info === undefined || options.info === null || options.info === false){ + options.info = false + }else if(options.info !== true){ + throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`) + } + // Normalize option `max_record_size` + if(options.max_record_size === undefined || options.max_record_size === null || options.max_record_size === false){ + options.max_record_size = 0 + }else if(Number.isInteger(options.max_record_size) && options.max_record_size >= 0){ + // Great, nothing to do + }else if(typeof options.max_record_size === 'string' && /\d+/.test(options.max_record_size)){ + options.max_record_size = parseInt(options.max_record_size) + }else{ + throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`) + } + // Normalize option `objname` + if(options.objname === undefined || options.objname === null || options.objname === false){ + options.objname = undefined + }else if(Buffer.isBuffer(options.objname)){ + if(options.objname.length === 0){ + throw new Error(`Invalid Option: objname must be a non empty buffer`) + } + options.objname = options.objname.toString() + }else if(typeof options.objname === 'string'){ + if(options.objname.length === 0){ + throw new Error(`Invalid Option: objname must be a non empty string`) + } + // Great, nothing to do + }else{ + throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`) + } + // Normalize option `on_record` + if(options.on_record === undefined || options.on_record === null){ + options.on_record = undefined + }else if(typeof options.on_record !== 'function'){ + throw new CsvError('CSV_INVALID_OPTION_ON_RECORD', [ + 'Invalid option `on_record`:', + 'expect a function,', + `got ${JSON.stringify(options.on_record)}` + ]) + } + // Normalize option `quote` + if(options.quote === null || options.quote === false || options.quote === ''){ + options.quote = null + }else{ + if(options.quote === undefined || options.quote === true){ + options.quote = Buffer.from('"') + }else if(typeof options.quote === 'string'){ + options.quote = Buffer.from(options.quote) + } + if(!Buffer.isBuffer(options.quote)){ + throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`) + }else if(options.quote.length !== 1){ + throw new Error(`Invalid Option Length: quote must be one character, got ${options.quote.length}`) + }else{ + options.quote = options.quote[0] + } + } + // Normalize option `raw` + if(options.raw === undefined || options.raw === null || options.raw === false){ + options.raw = false + }else if(options.raw !== true){ + throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`) + } + // Normalize option `record_delimiter` + if(!options.record_delimiter){ + options.record_delimiter = [] + }else if(!Array.isArray(options.record_delimiter)){ + options.record_delimiter = [options.record_delimiter] + } + options.record_delimiter = options.record_delimiter.map( function(rd){ + if(typeof rd === 'string'){ + rd = Buffer.from(rd) + } + return rd + }) + // Normalize option `relax` + if(typeof options.relax === 'boolean'){ + // Great, nothing to do + }else if(options.relax === undefined || options.relax === null){ + options.relax = false + }else{ + throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(options.relax)}`) + } + // Normalize option `relax_column_count` + if(typeof options.relax_column_count === 'boolean'){ + // Great, nothing to do + }else if(options.relax_column_count === undefined || options.relax_column_count === null){ + options.relax_column_count = false + }else{ + throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`) + } + if(typeof options.relax_column_count_less === 'boolean'){ + // Great, nothing to do + }else if(options.relax_column_count_less === undefined || options.relax_column_count_less === null){ + options.relax_column_count_less = false + }else{ + throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(options.relax_column_count_less)}`) + } + if(typeof options.relax_column_count_more === 'boolean'){ + // Great, nothing to do + }else if(options.relax_column_count_more === undefined || options.relax_column_count_more === null){ + options.relax_column_count_more = false + }else{ + throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(options.relax_column_count_more)}`) + } + // Normalize option `skip_empty_lines` + if(typeof options.skip_empty_lines === 'boolean'){ + // Great, nothing to do + }else if(options.skip_empty_lines === undefined || options.skip_empty_lines === null){ + options.skip_empty_lines = false + }else{ + throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`) + } + // Normalize option `skip_lines_with_empty_values` + if(typeof options.skip_lines_with_empty_values === 'boolean'){ + // Great, nothing to do + }else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){ + options.skip_lines_with_empty_values = false + }else{ + throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`) + } + // Normalize option `skip_lines_with_error` + if(typeof options.skip_lines_with_error === 'boolean'){ + // Great, nothing to do + }else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){ + options.skip_lines_with_error = false + }else{ + throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`) + } + // Normalize option `rtrim` + if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){ + options.rtrim = false + }else if(options.rtrim !== true){ + throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`) + } + // Normalize option `ltrim` + if(options.ltrim === undefined || options.ltrim === null || options.ltrim === false){ + options.ltrim = false + }else if(options.ltrim !== true){ + throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`) + } + // Normalize option `trim` + if(options.trim === undefined || options.trim === null || options.trim === false){ + options.trim = false + }else if(options.trim !== true){ + throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`) + } + // Normalize options `trim`, `ltrim` and `rtrim` + if(options.trim === true && opts.ltrim !== false){ + options.ltrim = true + }else if(options.ltrim !== true){ + options.ltrim = false + } + if(options.trim === true && opts.rtrim !== false){ + options.rtrim = true + }else if(options.rtrim !== true){ + options.rtrim = false + } + // Normalize option `to` + if(options.to === undefined || options.to === null){ + options.to = -1 + }else{ + if(typeof options.to === 'string' && /\d+/.test(options.to)){ + options.to = parseInt(options.to) + } + if(Number.isInteger(options.to)){ + if(options.to <= 0){ + throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`) + } + }else{ + throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`) + } + } + // Normalize option `to_line` + if(options.to_line === undefined || options.to_line === null){ + options.to_line = -1 + }else{ + if(typeof options.to_line === 'string' && /\d+/.test(options.to_line)){ + options.to_line = parseInt(options.to_line) + } + if(Number.isInteger(options.to_line)){ + if(options.to_line <= 0){ + throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`) + } + }else{ + throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`) + } + } + this.info = { + comment_lines: 0, + empty_lines: 0, + invalid_field_length: 0, + lines: 1, + records: 0 + } + this.options = options + this.state = { + bomSkipped: false, + castField: fnCastField, + commenting: false, + enabled: options.from_line === 1, + escaping: false, + escapeIsQuote: options.escape === options.quote, + expectedRecordLength: options.columns === null ? 0 : options.columns.length, + field: new ResizeableBuffer(20), + firstLineToHeaders: fnFirstLineToHeaders, + info: Object.assign({}, this.info), + previousBuf: undefined, + quoting: false, + stop: false, + rawBuffer: new ResizeableBuffer(100), + record: [], + recordHasError: false, + record_length: 0, + recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map( (v) => v.length)), + trimChars: [Buffer.from(' ')[0], Buffer.from('\t')[0]], + wasQuoting: false, + wasRowDelimiter: false + } + } + // Implementation of `Transform._transform` + _transform(buf, encoding, callback){ + if(this.state.stop === true){ + return + } + const err = this.__parse(buf, false) + if(err !== undefined){ + this.state.stop = true + } + callback(err) + } + // Implementation of `Transform._flush` + _flush(callback){ + if(this.state.stop === true){ + return + } + const err = this.__parse(undefined, true) + callback(err) + } + // Central parser implementation + __parse(nextBuf, end){ + const {bom, comment, escape, from_line, info, ltrim, max_record_size, quote, raw, relax, rtrim, skip_empty_lines, to, to_line} = this.options + let {record_delimiter} = this.options + const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state + let buf + if(previousBuf === undefined){ + if(nextBuf === undefined){ + // Handle empty string + this.push(null) + return + }else{ + buf = nextBuf + } + }else if(previousBuf !== undefined && nextBuf === undefined){ + buf = previousBuf + }else{ + buf = Buffer.concat([previousBuf, nextBuf]) + } + // Handle UTF BOM + if(bomSkipped === false){ + if(bom === false){ + this.state.bomSkipped = true + }else if(buf.length < 3){ + // No enough data + if(end === false){ + // Wait for more data + this.state.previousBuf = buf + return + } + // skip BOM detect because data length < 3 + }else{ + if(bom_utf8.compare(buf, 0, 3) === 0){ + // Skip BOM + buf = buf.slice(3) + } + this.state.bomSkipped = true + } + } + const bufLen = buf.length + let pos + for(pos = 0; pos < bufLen; pos++){ + // Ensure we get enough space to look ahead + // There should be a way to move this out of the loop + if(this.__needMoreData(pos, bufLen, end)){ + break + } + if(this.state.wasRowDelimiter === true){ + this.info.lines++ + if(info === true && this.state.record.length === 0 && this.state.field.length === 0 && this.state.wasQuoting === false){ + this.state.info = Object.assign({}, this.info) + } + this.state.wasRowDelimiter = false + } + if(to_line !== -1 && this.info.lines > to_line){ + this.state.stop = true + this.push(null) + return + } + // Auto discovery of record_delimiter, unix, mac and windows supported + if(this.state.quoting === false && record_delimiter.length === 0){ + const record_delimiterCount = this.__autoDiscoverRowDelimiter(buf, pos) + if(record_delimiterCount){ + record_delimiter = this.options.record_delimiter + } + } + const chr = buf[pos] + if(raw === true){ + rawBuffer.append(chr) + } + if((chr === cr || chr === nl) && this.state.wasRowDelimiter === false ){ + this.state.wasRowDelimiter = true + } + // Previous char was a valid escape char + // treat the current char as a regular char + if(this.state.escaping === true){ + this.state.escaping = false + }else{ + // Escape is only active inside quoted fields + // We are quoting, the char is an escape chr and there is a chr to escape + if(escape !== null && this.state.quoting === true && chr === escape && pos + 1 < bufLen){ + if(escapeIsQuote){ + if(buf[pos+1] === quote){ + this.state.escaping = true + continue + } + }else{ + this.state.escaping = true + continue + } + } + // Not currently escaping and chr is a quote + // TODO: need to compare bytes instead of single char + if(this.state.commenting === false && chr === quote){ + if(this.state.quoting === true){ + const nextChr = buf[pos+1] + const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr) + // const isNextChrComment = nextChr === comment + const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+1, nextChr) + const isNextChrDelimiter = this.__isDelimiter(nextChr, buf, pos+1) + const isNextChrRowDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRowDelimiter(buf, pos+1) : this.__isRecordDelimiter(nextChr, buf, pos+1) + // Escape a quote + // Treat next char as a regular character + // TODO: need to compare bytes instead of single char + if(escape !== null && chr === escape && nextChr === quote){ + pos++ + }else if(!nextChr || isNextChrDelimiter || isNextChrRowDelimiter || isNextChrComment || isNextChrTrimable){ + this.state.quoting = false + this.state.wasQuoting = true + continue + }else if(relax === false){ + const err = this.__error( + new CsvError('CSV_INVALID_CLOSING_QUOTE', [ + 'Invalid Closing Quote:', + `got "${String.fromCharCode(nextChr)}"`, + `at line ${this.info.lines}`, + 'instead of delimiter, row delimiter, trimable character', + '(if activated) or comment', + ], this.__context()) + ) + if(err !== undefined) return err + }else{ + this.state.quoting = false + this.state.wasQuoting = true + // continue + this.state.field.prepend(quote) + } + }else{ + if(this.state.field.length !== 0){ + // In relax mode, treat opening quote preceded by chrs as regular + if( relax === false ){ + const err = this.__error( + new CsvError('INVALID_OPENING_QUOTE', [ + 'Invalid Opening Quote:', + `a quote is found inside a field at line ${this.info.lines}`, + ], this.__context(), { + field: this.state.field, + }) + ) + if(err !== undefined) return err + } + }else{ + this.state.quoting = true + continue + } + } + } + if(this.state.quoting === false){ + let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos) + if(recordDelimiterLength !== 0){ + // Do not emit comments which take a full line + const skipCommentLine = this.state.commenting && (this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0) + if(skipCommentLine){ + this.info.comment_lines++ + // Skip full comment line + }else{ + // Skip if line is empty and skip_empty_lines activated + if(skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0){ + this.info.empty_lines++ + pos += recordDelimiterLength - 1 + continue + } + // Activate records emition if above from_line + if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0 ) >= from_line){ + this.state.enabled = true + this.__resetField() + this.__resetRow() + pos += recordDelimiterLength - 1 + continue + }else{ + const errField = this.__onField() + if(errField !== undefined) return errField + const errRecord = this.__onRow() + if(errRecord !== undefined) return errRecord + } + if(to !== -1 && this.info.records >= to){ + this.state.stop = true + this.push(null) + return + } + } + this.state.commenting = false + pos += recordDelimiterLength - 1 + continue + } + if(this.state.commenting){ + continue + } + const commentCount = comment === null ? 0 : this.__compareBytes(comment, buf, pos, chr) + if(commentCount !== 0){ + this.state.commenting = true + continue + } + let delimiterLength = this.__isDelimiter(chr, buf, pos) + if(delimiterLength !== 0){ + const errField = this.__onField() + if(errField !== undefined) return errField + pos += delimiterLength - 1 + continue + } + } + } + if(this.state.commenting === false){ + if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){ + const err = this.__error( + new CsvError('CSV_MAX_RECORD_SIZE', [ + 'Max Record Size:', + 'record exceed the maximum number of tolerated bytes', + `of ${max_record_size}`, + `at line ${this.info.lines}`, + ], this.__context()) + ) + if(err !== undefined) return err + } + } + + const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr) + // rtrim in non quoting is handle in __onField + const rappend = rtrim === false || this.state.wasQuoting === false + if( lappend === true && rappend === true ){ + this.state.field.append(chr) + }else if(rtrim === true && !this.__isCharTrimable(chr)){ + const err = this.__error( + new CsvError('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE', [ + 'Invalid Closing Quote:', + 'found non trimable byte after quote', + `at line ${this.info.lines}`, + ], this.__context()) + ) + if(err !== undefined) return err + } + } + if(end === true){ + // Ensure we are not ending in a quoting state + if(this.state.quoting === true){ + const err = this.__error( + new CsvError('CSV_QUOTE_NOT_CLOSED', [ + 'Quote Not Closed:', + `the parsing is finished with an opening quote at line ${this.info.lines}`, + ], this.__context()) + ) + if(err !== undefined) return err + }else{ + // Skip last line if it has no characters + if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){ + const errField = this.__onField() + if(errField !== undefined) return errField + const errRecord = this.__onRow() + if(errRecord !== undefined) return errRecord + }else if(this.state.wasRowDelimiter === true){ + this.info.empty_lines++ + }else if(this.state.commenting === true){ + this.info.comment_lines++ + } + } + }else{ + this.state.previousBuf = buf.slice(pos) + } + if(this.state.wasRowDelimiter === true){ + this.info.lines++ + this.state.wasRowDelimiter = false + } + } + // Helper to test if a character is a space or a line delimiter + __isCharTrimable(chr){ + return chr === space || chr === tab || chr === cr || chr === nl || chr === np + } + __onRow(){ + const {columns, columns_duplicates_to_array, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options + const {enabled, record} = this.state + if(enabled === false){ + return this.__resetRow() + } + // Convert the first line into column names + const recordLength = record.length + if(columns === true){ + if(isRecordEmpty(record)){ + this.__resetRow() + return + } + return this.__firstLineToColumns(record) + } + if(columns === false && this.info.records === 0){ + this.state.expectedRecordLength = recordLength + } + if(recordLength !== this.state.expectedRecordLength){ + if(relax_column_count === true || + (relax_column_count_less === true && recordLength < this.state.expectedRecordLength) || + (relax_column_count_more === true && recordLength > this.state.expectedRecordLength) ){ + this.info.invalid_field_length++ + }else{ + if(columns === false){ + const err = this.__error( + new CsvError('CSV_INCONSISTENT_RECORD_LENGTH', [ + 'Invalid Record Length:', + `expect ${this.state.expectedRecordLength},`, + `got ${recordLength} on line ${this.info.lines}`, + ], this.__context(), { + record: record, + }) + ) + if(err !== undefined) return err + }else{ + const err = this.__error( + // CSV_INVALID_RECORD_LENGTH_DONT_MATCH_COLUMNS + new CsvError('CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH', [ + 'Invalid Record Length:', + `columns length is ${columns.length},`, // rename columns + `got ${recordLength} on line ${this.info.lines}`, + ], this.__context(), { + record: record, + }) + ) + if(err !== undefined) return err + } + } + } + if(skip_lines_with_empty_values === true){ + if(isRecordEmpty(record)){ + this.__resetRow() + return + } + } + if(this.state.recordHasError === true){ + this.__resetRow() + this.state.recordHasError = false + return + } + this.info.records++ + if(from === 1 || this.info.records >= from){ + if(columns !== false){ + const obj = {} + // Transform record array to an object + for(let i = 0, l = record.length; i < l; i++){ + if(columns[i] === undefined || columns[i].disabled) continue + // obj[columns[i].name] = record[i] + // Turn duplicate columns into an array + if (columns_duplicates_to_array === true && obj[columns[i].name]) { + if (Array.isArray(obj[columns[i].name])) { + obj[columns[i].name] = obj[columns[i].name].concat(record[i]) + } else { + obj[columns[i].name] = [obj[columns[i].name], record[i]] + } + } else { + obj[columns[i].name] = record[i] + } + } + const {objname} = this.options + if(objname === undefined){ + if(raw === true || info === true){ + const err = this.__push(Object.assign( + {record: obj}, + (raw === true ? {raw: this.state.rawBuffer.toString()}: {}), + (info === true ? {info: this.state.info}: {}) + )) + if(err){ + return err + } + }else{ + const err = this.__push(obj) + if(err){ + return err + } + } + }else{ + if(raw === true || info === true){ + const err = this.__push(Object.assign( + {record: [obj[objname], obj]}, + raw === true ? {raw: this.state.rawBuffer.toString()}: {}, + info === true ? {info: this.state.info}: {} + )) + if(err){ + return err + } + }else{ + const err = this.__push([obj[objname], obj]) + if(err){ + return err + } + } + } + }else{ + if(raw === true || info === true){ + const err = this.__push(Object.assign( + {record: record}, + raw === true ? {raw: this.state.rawBuffer.toString()}: {}, + info === true ? {info: this.state.info}: {} + )) + if(err){ + return err + } + }else{ + const err = this.__push(record) + if(err){ + return err + } + } + } + } + this.__resetRow() + } + __firstLineToColumns(record){ + const {firstLineToHeaders} = this.state + try{ + const headers = firstLineToHeaders === undefined ? record : firstLineToHeaders.call(null, record) + if(!Array.isArray(headers)){ + return this.__error( + new CsvError('CSV_INVALID_COLUMN_MAPPING', [ + 'Invalid Column Mapping:', + 'expect an array from column function,', + `got ${JSON.stringify(headers)}` + ], this.__context(), { + headers: headers, + }) + ) + } + const normalizedHeaders = normalizeColumnsArray(headers) + this.state.expectedRecordLength = normalizedHeaders.length + this.options.columns = normalizedHeaders + this.__resetRow() + return + }catch(err){ + return err + } + } + __resetRow(){ + if(this.options.raw === true){ + this.state.rawBuffer.reset() + } + this.state.record = [] + this.state.record_length = 0 + } + __onField(){ + const {cast, rtrim, max_record_size} = this.options + const {enabled, wasQuoting} = this.state + // Short circuit for the from_line options + if(enabled === false){ /* this.options.columns !== true && */ + return this.__resetField() + } + let field = this.state.field.toString() + if(rtrim === true && wasQuoting === false){ + field = field.trimRight() + } + if(cast === true){ + const [err, f] = this.__cast(field) + if(err !== undefined) return err + field = f + } + this.state.record.push(field) + // Increment record length if record size must not exceed a limit + if(max_record_size !== 0 && typeof field === 'string'){ + this.state.record_length += field.length + } + this.__resetField() + } + __resetField(){ + this.state.field.reset() + this.state.wasQuoting = false + } + __push(record){ + const {on_record} = this.options + if(on_record !== undefined){ + const context = this.__context() + try{ + record = on_record.call(null, record, context) + }catch(err){ + return err + } + if(record === undefined || record === null){ return } + } + this.push(record) + } + // Return a tuple with the error and the casted value + __cast(field){ + const {columns, relax_column_count} = this.options + const isColumns = Array.isArray(columns) + // Dont loose time calling cast + // because the final record is an object + // and this field can't be associated to a key present in columns + if( isColumns === true && relax_column_count && this.options.columns.length <= this.state.record.length ){ + return [undefined, undefined] + } + const context = this.__context() + if(this.state.castField !== null){ + try{ + return [undefined, this.state.castField.call(null, field, context)] + }catch(err){ + return [err] + } + } + if(this.__isFloat(field)){ + return [undefined, parseFloat(field)] + }else if(this.options.cast_date !== false){ + return [undefined, this.options.cast_date.call(null, field, context)] + } + return [undefined, field] + } + // Keep it in case we implement the `cast_int` option + // __isInt(value){ + // // return Number.isInteger(parseInt(value)) + // // return !isNaN( parseInt( obj ) ); + // return /^(\-|\+)?[1-9][0-9]*$/.test(value) + // } + __isFloat(value){ + return (value - parseFloat( value ) + 1) >= 0 // Borrowed from jquery + } + __compareBytes(sourceBuf, targetBuf, pos, firtByte){ + if(sourceBuf[0] !== firtByte) return 0 + const sourceLength = sourceBuf.length + for(let i = 1; i < sourceLength; i++){ + if(sourceBuf[i] !== targetBuf[pos+i]) return 0 + } + return sourceLength + } + __needMoreData(i, bufLen, end){ + if(end){ + return false + } + const {comment, delimiter} = this.options + const {quoting, recordDelimiterMaxLength} = this.state + const numOfCharLeft = bufLen - i - 1 + const requiredLength = Math.max( + // Skip if the remaining buffer smaller than comment + comment ? comment.length : 0, + // Skip if the remaining buffer smaller than row delimiter + recordDelimiterMaxLength, + // Skip if the remaining buffer can be row delimiter following the closing quote + // 1 is for quote.length + quoting ? (1 + recordDelimiterMaxLength) : 0, + // Skip if the remaining buffer can be delimiter + delimiter.length, + // Skip if the remaining buffer can be escape sequence + // 1 is for escape.length + 1 + ) + return numOfCharLeft < requiredLength + } + __isDelimiter(chr, buf, pos){ + const {delimiter} = this.options + loop1: for(let i = 0; i < delimiter.length; i++){ + const del = delimiter[i] + if(del[0] === chr){ + for(let j = 1; j < del.length; j++){ + if(del[j] !== buf[pos+j]) continue loop1 + } + return del.length + } + } + return 0 + } + __isRecordDelimiter(chr, buf, pos){ + const {record_delimiter} = this.options + const recordDelimiterLength = record_delimiter.length + loop1: for(let i = 0; i < recordDelimiterLength; i++){ + const rd = record_delimiter[i] + const rdLength = rd.length + if(rd[0] !== chr){ + continue + } + for(let j = 1; j < rdLength; j++){ + if(rd[j] !== buf[pos+j]){ + continue loop1 + } + } + return rd.length + } + return 0 + } + __autoDiscoverRowDelimiter(buf, pos){ + const chr = buf[pos] + if(chr === cr){ + if(buf[pos+1] === nl){ + this.options.record_delimiter.push(Buffer.from('\r\n')) + this.state.recordDelimiterMaxLength = 2 + return 2 + }else{ + this.options.record_delimiter.push(Buffer.from('\r')) + this.state.recordDelimiterMaxLength = 1 + return 1 + } + }else if(chr === nl){ + this.options.record_delimiter.push(Buffer.from('\n')) + this.state.recordDelimiterMaxLength = 1 + return 1 + } + return 0 + } + __error(msg){ + const {skip_lines_with_error} = this.options + const err = typeof msg === 'string' ? new Error(msg) : msg + if(skip_lines_with_error){ + this.state.recordHasError = true + this.emit('skip', err) + return undefined + }else{ + return err + } + } + __context(){ + const {columns} = this.options + const isColumns = Array.isArray(columns) + return { + column: isColumns === true ? + ( columns.length > this.state.record.length ? + columns[this.state.record.length].name : + null + ) : + this.state.record.length, + empty_lines: this.info.empty_lines, + header: columns === true, + index: this.state.record.length, + invalid_field_length: this.info.invalid_field_length, + quoting: this.state.wasQuoting, + lines: this.info.lines, + records: this.info.records + } + } +} + +const parse = function(){ + let data, options, callback + for(let i in arguments){ + const argument = arguments[i] + const type = typeof argument + if(data === undefined && (typeof argument === 'string' || Buffer.isBuffer(argument))){ + data = argument + }else if(options === undefined && isObject(argument)){ + options = argument + }else if(callback === undefined && type === 'function'){ + callback = argument + }else{ + throw new CsvError('CSV_INVALID_ARGUMENT', [ + 'Invalid argument:', + `got ${JSON.stringify(argument)} at index ${i}` + ]) + } + } + const parser = new Parser(options) + if(callback){ + const records = options === undefined || options.objname === undefined ? [] : {} + parser.on('readable', function(){ + let record + while((record = this.read()) !== null){ + if(options === undefined || options.objname === undefined){ + records.push(record) + }else{ + records[record[0]] = record[1] + } + } + }) + parser.on('error', function(err){ + callback(err, undefined, parser.info) + }) + parser.on('end', function(){ + callback(undefined, records, parser.info) + }) + } + if(data !== undefined){ + // Give a chance for events to be registered later + if(typeof setImmediate === 'function'){ + setImmediate(function(){ + parser.write(data) + parser.end() + }) + }else{ + parser.write(data) + parser.end() + } + } + return parser +} + +class CsvError extends Error { + constructor(code, message, ...contexts) { + if(Array.isArray(message)) message = message.join(' ') + super(message) + if(Error.captureStackTrace !== undefined){ + Error.captureStackTrace(this, CsvError) + } + this.code = code + for(const context of contexts){ + for(const key in context){ + const value = context[key] + this[key] = Buffer.isBuffer(value) ? value.toString() : value == null ? value : JSON.parse(JSON.stringify(value)) + } + } + } +} + +parse.Parser = Parser + +parse.CsvError = CsvError + +module.exports = parse + +const underscore = function(str){ + return str.replace(/([A-Z])/g, function(_, match){ + return '_' + match.toLowerCase() + }) +} + +const isObject = function(obj){ + return (typeof obj === 'object' && obj !== null && !Array.isArray(obj)) +} + +const isRecordEmpty = function(record){ + return record.every( (field) => field == null || field.toString && field.toString().trim() === '' ) +} + +const normalizeColumnsArray = function(columns){ + const normalizedColumns = []; + for(let i = 0, l = columns.length; i < l; i++){ + const column = columns[i] + if(column === undefined || column === null || column === false){ + normalizedColumns[i] = { disabled: true } + }else if(typeof column === 'string'){ + normalizedColumns[i] = { name: column } + }else if(isObject(column)){ + if(typeof column.name !== 'string'){ + throw new CsvError('CSV_OPTION_COLUMNS_MISSING_NAME', [ + 'Option columns missing name:', + `property "name" is required at position ${i}`, + 'when column is an object literal' + ]) + } + normalizedColumns[i] = column + }else{ + throw new CsvError('CSV_INVALID_COLUMN_DEFINITION', [ + 'Invalid column definition:', + 'expect a string or a literal object,', + `got ${JSON.stringify(column)} at position ${i}` + ]) + } + } + return normalizedColumns; +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer, __webpack_require__(/*! ./../../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate)) + +/***/ }), + +/***/ "./node_modules/events/events.js": +/*!***************************************!*\ + !*** ./node_modules/events/events.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} +module.exports = EventEmitter; +module.exports.once = once; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); +} + + +/***/ }), + +/***/ "./node_modules/ieee754/index.js": +/*!***************************************!*\ + !*** ./node_modules/ieee754/index.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + + i += d + + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} + + +/***/ }), + +/***/ "./node_modules/inherits/inherits_browser.js": +/*!***************************************************!*\ + !*** ./node_modules/inherits/inherits_browser.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ "./node_modules/isarray/index.js": +/*!***************************************!*\ + !*** ./node_modules/isarray/index.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + + +/***/ }), + +/***/ "./node_modules/object-hash/dist/object_hash.js": +/*!******************************************************!*\ + !*** ./node_modules/object-hash/dist/object_hash.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var require;var require;!function(e){if(true)module.exports=e();else { var t; }}(function(){return function o(i,u,a){function s(n,e){if(!u[n]){if(!i[n]){var t="function"==typeof require&&require;if(!e&&t)return require(n,!0);if(f)return f(n,!0);throw new Error("Cannot find module '"+n+"'")}var r=u[n]={exports:{}};i[n][0].call(r.exports,function(e){var t=i[n][1][e];return s(t||e)},r,r.exports,o,i,u,a)}return u[n].exports}for(var f="function"==typeof require&&require,e=0;e>16),s((65280&r)>>8),s(255&r);return 2==o?s(255&(r=c(e.charAt(t))<<2|c(e.charAt(t+1))>>4)):1==o&&(s((r=c(e.charAt(t))<<10|c(e.charAt(t+1))<<4|c(e.charAt(t+2))>>2)>>8&255),s(255&r)),i},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function a(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t>18&63)+a(o>>12&63)+a(o>>6&63)+a(63&o);switch(i){case 1:u+=a((n=e[e.length-1])>>2),u+=a(n<<4&63),u+="==";break;case 2:u+=a((n=(e[e.length-2]<<8)+e[e.length-1])>>10),u+=a(n>>4&63),u+=a(n<<2&63),u+="="}return u}}(void 0===f?this.base64js={}:f)}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(O,e,H){(function(e,t,h,n,r,o,i,u,a){var s=O("base64-js"),f=O("ieee754");function h(e,t,n){if(!(this instanceof h))return new h(e,t,n);var r,o,i,u,a,s=typeof e;if("base64"===t&&"string"==s)for(e=(r=e).trim?r.trim():r.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==s)o=x(e);else if("string"==s)o=h.byteLength(e,t);else{if("object"!=s)throw new Error("First argument needs to be a number, array or string.");o=x(e.length)}if(h._useTypedArrays?i=h._augment(new Uint8Array(o)):((i=this).length=o,i._isBuffer=!0),h._useTypedArrays&&"number"==typeof e.byteLength)i._set(e);else if(S(a=e)||h.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length)for(u=0;u>8,r=t%256,o.push(r),o.push(n);return o}(t),e,n,r)}function c(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o>>0)):(t+1>>0),o}function y(e,t,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=t,"missing offset"),D(t+1>>8*(r?u:1-u)}function _(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3>>8*(r?u:3-u)&255}function E(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1this.length&&(r=this.length),e.length-t=this.length))return this[e]},h.prototype.readUInt16LE=function(e,t){return l(this,e,!0,t)},h.prototype.readUInt16BE=function(e,t){return l(this,e,!1,t)},h.prototype.readUInt32LE=function(e,t){return d(this,e,!0,t)},h.prototype.readUInt32BE=function(e,t){return d(this,e,!1,t)},h.prototype.readInt8=function(e,t){if(t||(D(null!=e,"missing offset"),D(e=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){return y(this,e,!0,t)},h.prototype.readInt16BE=function(e,t){return y(this,e,!1,t)},h.prototype.readInt32LE=function(e,t){return w(this,e,!0,t)},h.prototype.readInt32BE=function(e,t){return w(this,e,!1,t)},h.prototype.readFloatLE=function(e,t){return b(this,e,!0,t)},h.prototype.readFloatBE=function(e,t){return b(this,e,!1,t)},h.prototype.readDoubleLE=function(e,t){return m(this,e,!0,t)},h.prototype.readDoubleBE=function(e,t){return m(this,e,!1,t)},h.prototype.writeUInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(this[t]=e)},h.prototype.writeUInt16LE=function(e,t,n){v(this,e,t,!0,n)},h.prototype.writeUInt16BE=function(e,t,n){v(this,e,t,!1,n)},h.prototype.writeUInt32LE=function(e,t,n){_(this,e,t,!0,n)},h.prototype.writeUInt32BE=function(e,t,n){_(this,e,t,!1,n)},h.prototype.writeInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},h.prototype.writeInt16LE=function(e,t,n){E(this,e,t,!0,n)},h.prototype.writeInt16BE=function(e,t,n){E(this,e,t,!1,n)},h.prototype.writeInt32LE=function(e,t,n){I(this,e,t,!0,n)},h.prototype.writeInt32BE=function(e,t,n){I(this,e,t,!1,n)},h.prototype.writeFloatLE=function(e,t,n){A(this,e,t,!0,n)},h.prototype.writeFloatBE=function(e,t,n){A(this,e,t,!1,n)},h.prototype.writeDoubleLE=function(e,t,n){B(this,e,t,!0,n)},h.prototype.writeDoubleBE=function(e,t,n){B(this,e,t,!1,n)},h.prototype.fill=function(e,t,n){if(e=e||0,t=t||0,n=n||this.length,"string"==typeof e&&(e=e.charCodeAt(0)),D("number"==typeof e&&!isNaN(e),"value is not a number"),D(t<=n,"end < start"),n!==t&&0!==this.length){D(0<=t&&t"},h.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(h._useTypedArrays)return new h(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function M(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function N(e,t){D("number"==typeof e,"cannot write a non-number as a number"),D(0<=e,"specified a negative value for writing an unsigned value"),D(e<=t,"value is larger than maximum value for type"),D(Math.floor(e)===e,"value has a fractional component")}function Y(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value"),D(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value")}function D(e,t){if(!e)throw new Error(t||"Failed assertion")}h._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=L.get,e.set=L.set,e.write=L.write,e.toString=L.toString,e.toLocaleString=L.toString,e.toJSON=L.toJSON,e.copy=L.copy,e.slice=L.slice,e.readUInt8=L.readUInt8,e.readUInt16LE=L.readUInt16LE,e.readUInt16BE=L.readUInt16BE,e.readUInt32LE=L.readUInt32LE,e.readUInt32BE=L.readUInt32BE,e.readInt8=L.readInt8,e.readInt16LE=L.readInt16LE,e.readInt16BE=L.readInt16BE,e.readInt32LE=L.readInt32LE,e.readInt32BE=L.readInt32BE,e.readFloatLE=L.readFloatLE,e.readFloatBE=L.readFloatBE,e.readDoubleLE=L.readDoubleLE,e.readDoubleBE=L.readDoubleBE,e.writeUInt8=L.writeUInt8,e.writeUInt16LE=L.writeUInt16LE,e.writeUInt16BE=L.writeUInt16BE,e.writeUInt32LE=L.writeUInt32LE,e.writeUInt32BE=L.writeUInt32BE,e.writeInt8=L.writeInt8,e.writeInt16LE=L.writeInt16LE,e.writeInt16BE=L.writeInt16BE,e.writeInt32LE=L.writeInt32LE,e.writeInt32BE=L.writeInt32BE,e.writeFloatLE=L.writeFloatLE,e.writeFloatBE=L.writeFloatBE,e.writeDoubleLE=L.writeDoubleLE,e.writeDoubleBE=L.writeDoubleBE,e.fill=L.fill,e.inspect=L.inspect,e.toArrayBuffer=L.toArrayBuffer,e}}).call(this,O("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},O("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(l,d,e){(function(e,t,u,n,r,o,i,a,s){u=l("buffer").Buffer;var f=4,c=new u(f);c.fill(0);d.exports={hash:function(e,t,n,r){return u.isBuffer(e)||(e=new u(e)),function(e,t,n){for(var r=new u(t),o=n?r.writeInt32BE:r.writeInt32LE,i=0;ih?t=e(t):t.length>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u>>32-a,n);var u,a}function d(e,t,n,r,o,i,u){return l(t&n|~t&r,e,t,o,i,u)}function h(e,t,n,r,o,i,u){return l(t&r|n&~r,e,t,o,i,u)}function p(e,t,n,r,o,i,u){return l(t^n^r,e,t,o,i,u)}function g(e,t,n,r,o,i,u){return l(n^(t|~r),e,t,o,i,u)}function y(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}b.exports=function(e){return f.hash(e,c,16)}}).call(this,w("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},w("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(e,l,t){(function(e,t,n,r,o,i,u,a,s){var f,c;f=function(e){for(var t,n=new Array(e),r=0;r>>((3&r)<<3)&255;return n},l.exports=c||f}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(l,d,e){(function(e,t,n,r,o,i,u,a,s){var f=l("./helpers");function c(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n,r=Array(80),o=1732584193,i=-271733879,u=-1732584194,a=271733878,s=-1009589776,f=0;f>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t){return e<>>32-t}d.exports=function(e){return f.hash(e,c,20,!0)}}).call(this,l("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},l("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(l,d,e){(function(e,t,n,r,o,i,u,a,s){function B(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function L(e,t){return e>>>t|e<<32-t}function U(e,t){return e>>>t}function f(e,t){var n,r,o,i,u,a,s,f,c,l,d,h,p,g,y,w,b,m,v=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),_=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),E=new Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var I=0;I>1,c=-7,l=n?o-1:0,d=n?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-c)-1,h>>=-c,c+=a;0>=-c,c+=r;0>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,u=c):(u=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-u))<1&&(u--,s*=2),2<=(t+=1<=u+l?d/s:d*Math.pow(2,1-l))*s&&(u++,s/=2),c<=u+l?(a=0,u=c):1<=u+l?(a=(t*s-1)*Math.pow(2,o),u+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,o),u=0));8<=o;e[n+h]=255&a,h+=p,a/=256,o-=8);for(u=u< 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), + +/***/ "./node_modules/readable-stream/duplex-browser.js": +/*!********************************************************!*\ + !*** ./node_modules/readable-stream/duplex-browser.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./lib/_stream_duplex.js */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_duplex.js": +/*!************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js"); +/**/ + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +var Readable = __webpack_require__(/*! ./_stream_readable */ "./node_modules/readable-stream/lib/_stream_readable.js"); +var Writable = __webpack_require__(/*! ./_stream_writable */ "./node_modules/readable-stream/lib/_stream_writable.js"); + +util.inherits(Duplex, Readable); + +{ + // avoid scope creep, the keys array can then be collected + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + pna.nextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +Duplex.prototype._destroy = function (err, cb) { + this.push(null); + this.end(); + + pna.nextTick(cb, err); +}; + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_passthrough.js": +/*!*****************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +module.exports = PassThrough; + +var Transform = __webpack_require__(/*! ./_stream_transform */ "./node_modules/readable-stream/lib/_stream_transform.js"); + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_readable.js": +/*!**************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_readable.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js"); +/**/ + +module.exports = Readable; + +/**/ +var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js"); +/**/ + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = __webpack_require__(/*! events */ "./node_modules/events/events.js").EventEmitter; + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +/**/ + +var Buffer = __webpack_require__(/*! safe-buffer */ "./node_modules/readable-stream/node_modules/safe-buffer/index.js").Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +/**/ +var debugUtil = __webpack_require__(/*! util */ 1); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var BufferList = __webpack_require__(/*! ./internal/streams/BufferList */ "./node_modules/readable-stream/lib/internal/streams/BufferList.js"); +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/readable-stream/lib/internal/streams/destroy.js"); +var StringDecoder; + +util.inherits(Readable, Stream); + +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var readableHwm = options.readableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + if (!(this instanceof Readable)) return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + if (options) { + if (typeof options.read === 'function') this._read = options.read; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); + +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + this.push(null); + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; + +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (addToFront) { + if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); + } else if (state.ended) { + stream.emit('error', new Error('stream.push() after EOF')); + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + } + } + + return needMoreData(state); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} + +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + + return ret; +}; + +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + pna.nextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('_read() is not implemented')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { hasUnpiped: false }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, unpipeInfo); + }return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + + dest.emit('unpipe', this, unpipeInfo); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + pna.nextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + pna.nextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + + var state = this._readableState; + var paused = false; + + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + + _this.push(null); + }); + + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return this; +}; + +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._readableState.highWaterMark; + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = Buffer.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + pna.nextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_transform.js": +/*!***************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_transform.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; + +var Duplex = __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +util.inherits(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) { + return this.emit('error', new Error('write callback called multiple times')); + } + + ts.writechunk = null; + ts.writecb = null; + + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + + cb(er); + + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function') { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('_transform() is not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +Transform.prototype._destroy = function (err, cb) { + var _this2 = this; + + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + _this2.emit('close'); + }); +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); + + if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_writable.js": +/*!**************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_writable.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js"); +/**/ + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; +/**/ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +/**/ +var internalUtil = { + deprecate: __webpack_require__(/*! util-deprecate */ "./node_modules/util-deprecate/browser.js") +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +/**/ + +var Buffer = __webpack_require__(/*! safe-buffer */ "./node_modules/readable-stream/node_modules/safe-buffer/index.js").Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/readable-stream/lib/internal/streams/destroy.js"); + +util.inherits(Writable, Stream); + +function nop() {} + +function WritableState(options, stream) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var writableHwm = options.writableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function (object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function (object) { + return object instanceof this; + }; +} + +function Writable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + + if (typeof options.final === 'function') this._final = options.final; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + pna.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + pna.nextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + pna.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + pna.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('_write() is not implemented')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + stream.emit('error', err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function') { + state.pendingcb++; + state.finalCalled = true; + pna.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = corkReq; + } else { + state.corkedRequestsFree = corkReq; + } +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + get: function () { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); + +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + this.end(); + cb(err); +}; +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/internal/streams/BufferList.js": +/*!*************************************************************************!*\ + !*** ./node_modules/readable-stream/lib/internal/streams/BufferList.js ***! + \*************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Buffer = __webpack_require__(/*! safe-buffer */ "./node_modules/readable-stream/node_modules/safe-buffer/index.js").Buffer; +var util = __webpack_require__(/*! util */ 2); + +function copyBuffer(src, target, offset) { + src.copy(target, offset); +} + +module.exports = function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + BufferList.prototype.push = function push(v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + }; + + BufferList.prototype.unshift = function unshift(v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + }; + + BufferList.prototype.shift = function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + }; + + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; + + BufferList.prototype.join = function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; + }; + + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + if (this.length === 1) return this.head.data; + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + }; + + return BufferList; +}(); + +if (util && util.inspect && util.inspect.custom) { + module.exports.prototype[util.inspect.custom] = function () { + var obj = util.inspect({ length: this.length }); + return this.constructor.name + ' ' + obj; + }; +} + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/internal/streams/destroy.js": +/*!**********************************************************************!*\ + !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js"); +/**/ + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { + pna.nextTick(emitErrorNT, this, err); + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + + this._destroy(err || null, function (err) { + if (!cb && err) { + pna.nextTick(emitErrorNT, _this, err); + if (_this._writableState) { + _this._writableState.errorEmitted = true; + } + } else if (cb) { + cb(err); + } + }); + + return this; +} + +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy +}; + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***! + \*****************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! events */ "./node_modules/events/events.js").EventEmitter; + + +/***/ }), + +/***/ "./node_modules/readable-stream/node_modules/safe-buffer/index.js": +/*!************************************************************************!*\ + !*** ./node_modules/readable-stream/node_modules/safe-buffer/index.js ***! + \************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), + +/***/ "./node_modules/readable-stream/passthrough.js": +/*!*****************************************************!*\ + !*** ./node_modules/readable-stream/passthrough.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./readable */ "./node_modules/readable-stream/readable-browser.js").PassThrough + + +/***/ }), + +/***/ "./node_modules/readable-stream/readable-browser.js": +/*!**********************************************************!*\ + !*** ./node_modules/readable-stream/readable-browser.js ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ "./node_modules/readable-stream/lib/_stream_readable.js"); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ "./node_modules/readable-stream/lib/_stream_writable.js"); +exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ "./node_modules/readable-stream/lib/_stream_duplex.js"); +exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ "./node_modules/readable-stream/lib/_stream_transform.js"); +exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ "./node_modules/readable-stream/lib/_stream_passthrough.js"); + + +/***/ }), + +/***/ "./node_modules/readable-stream/transform.js": +/*!***************************************************!*\ + !*** ./node_modules/readable-stream/transform.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./readable */ "./node_modules/readable-stream/readable-browser.js").Transform + + +/***/ }), + +/***/ "./node_modules/readable-stream/writable-browser.js": +/*!**********************************************************!*\ + !*** ./node_modules/readable-stream/writable-browser.js ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./lib/_stream_writable.js */ "./node_modules/readable-stream/lib/_stream_writable.js"); + + +/***/ }), + +/***/ "./node_modules/safe-buffer/index.js": +/*!*******************************************!*\ + !*** ./node_modules/safe-buffer/index.js ***! + \*******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + /*! safe-buffer. MIT License. Feross Aboukhadijeh */ -var r=n(5),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){"use strict";t.exports=o;var r=n(21),i=Object.create(n(6));function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}i.inherits=n(4),i.inherits(o,r),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){t.exports=n(13)},function(t,e,n){t.exports=n(2)},function(t,e,n){t.exports=n(11).Transform},function(t,e,n){t.exports=n(11).PassThrough},function(t,e,n){(function(e){t.exports=class{constructor(t=100){this.size=t,this.length=0,this.buf=e.alloc(t)}prepend(t){const e=this.length++;e===this.size&&this.resize();const n=this.clone();this.buf[0]=t,n.copy(this.buf,1,0,e)}append(t){const e=this.length++;e===this.size&&this.resize(),this.buf[e]=t}clone(){return e.from(this.buf.slice(0,this.length))}resize(){const t=this.length;this.size=2*this.size;const n=e.alloc(this.size);this.buf.copy(n,0,0,t),this.buf=n}toString(){return this.buf.slice(0,this.length).toString()}toJSON(){return this.toString()}reset(){this.length=0}}}).call(this,n(5).Buffer)},function(t,e,n){t.exports=n(41)},function(t,e,n){"use strict";n.r(e);var r=n(0),i=n(1),o=n(7),s=n(23),a=n(24);function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(r=(s=a.next()).done)&&(n.push(s.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw o}}return n}(t,e)||c(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n element; its readystatechange event will be fired asynchronously once it is inserted + // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. + var script = doc.createElement("script"); + script.onreadystatechange = function () { + runIfPresent(handle); + script.onreadystatechange = null; + html.removeChild(script); + script = null; + }; + html.appendChild(script); + }; + } + + function installSetTimeoutImplementation() { + registerImmediate = function(handle) { + setTimeout(runIfPresent, 0, handle); + }; + } + + // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. + var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); + attachTo = attachTo && attachTo.setTimeout ? attachTo : global; + + // Don't get fooled by e.g. browserify environments. + if ({}.toString.call(global.process) === "[object process]") { + // For Node.js before 0.9 + installNextTickImplementation(); + + } else if (canUsePostMessage()) { + // For non-IE10 modern browsers + installPostMessageImplementation(); + + } else if (global.MessageChannel) { + // For web workers, where supported + installMessageChannelImplementation(); + + } else if (doc && "onreadystatechange" in doc.createElement("script")) { + // For IE 6–8 + installReadyStateChangeImplementation(); + + } else { + // For older browsers + installSetTimeoutImplementation(); + } + + attachTo.setImmediate = setImmediate; + attachTo.clearImmediate = clearImmediate; +}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self)); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/stream-browserify/index.js": +/*!*************************************************!*\ + !*** ./node_modules/stream-browserify/index.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +module.exports = Stream; + +var EE = __webpack_require__(/*! events */ "./node_modules/events/events.js").EventEmitter; +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +inherits(Stream, EE); +Stream.Readable = __webpack_require__(/*! readable-stream/readable.js */ "./node_modules/readable-stream/readable-browser.js"); +Stream.Writable = __webpack_require__(/*! readable-stream/writable.js */ "./node_modules/readable-stream/writable-browser.js"); +Stream.Duplex = __webpack_require__(/*! readable-stream/duplex.js */ "./node_modules/readable-stream/duplex-browser.js"); +Stream.Transform = __webpack_require__(/*! readable-stream/transform.js */ "./node_modules/readable-stream/transform.js"); +Stream.PassThrough = __webpack_require__(/*! readable-stream/passthrough.js */ "./node_modules/readable-stream/passthrough.js"); + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; + + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); +} + +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } + + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } + + dest.on('drain', ondrain); + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); + } + + + function onclose() { + if (didOnEnd) return; + didOnEnd = true; + + if (typeof dest.destroy === 'function') dest.destroy(); + } + + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } + + source.on('error', onerror); + dest.on('error', onerror); + + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); + + source.removeListener('end', onend); + source.removeListener('close', onclose); + + source.removeListener('error', onerror); + dest.removeListener('error', onerror); + + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); + } + + source.on('end', cleanup); + source.on('close', cleanup); + + dest.on('close', cleanup); + + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; + + +/***/ }), + +/***/ "./node_modules/string_decoder/lib/string_decoder.js": +/*!***********************************************************!*\ + !*** ./node_modules/string_decoder/lib/string_decoder.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +/**/ + +var Buffer = __webpack_require__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer; +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} + +/***/ }), + +/***/ "./node_modules/timers-browserify/main.js": +/*!************************************************!*\ + !*** ./node_modules/timers-browserify/main.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) || + (typeof self !== "undefined" && self) || + window; +var apply = Function.prototype.apply; + +// DOM APIs, for completeness + +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, scope, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { + if (timeout) { + timeout.close(); + } +}; + +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; +} +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(scope, this._id); +}; + +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; + +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; + +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; + +// setimmediate attaches itself to the global object +__webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js"); +// On some exotic environments, it's not clear which object `setimmediate` was +// able to install onto. Search each possibility in the same order as the +// `setimmediate` library. +exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) || + (typeof global !== "undefined" && global.setImmediate) || + (this && this.setImmediate); +exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) || + (typeof global !== "undefined" && global.clearImmediate) || + (this && this.clearImmediate); + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/util-deprecate/browser.js": +/*!************************************************!*\ + !*** ./node_modules/util-deprecate/browser.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) { +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/webpack/buildin/global.js": +/*!***********************************!*\ + !*** (webpack)/buildin/global.js ***! + \***********************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || new Function("return this")(); +} catch (e) { + // This works if the window reference is available + if (typeof window === "object") g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ "./src/scripts/client.js": +/*!*******************************!*\ + !*** ./src/scripts/client.js ***! + \*******************************/ +/*! no exports provided */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _fields_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fields.js */ "./src/scripts/fields.js"); +/* harmony import */ var _filters_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filters.js */ "./src/scripts/filters.js"); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ "./src/scripts/utils.js"); +/* harmony import */ var _rest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rest.js */ "./src/scripts/rest.js"); +/* harmony import */ var _products__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./products */ "./src/scripts/products.js"); +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +/* eslint-disable camelcase */ + +/* eslint-disable no-undef */ + + + + + +console.log('client-side script executed'); // Mizner notes +// https://wordpress.org/plugins/acf-to-rest-api/ +// Testing: +// 1. Define static object with anticipated schema +// 2. Send XHR/Ajax/fetch (consider axios or similar) POST request to WP REST API +// 3. Handle errors +// Ultimately: +// 1. Get all data to iterate through +// 2. Iterate +// 2.1 Format data in current iteration +// 2.2 Send XHR/Ajax/fetch (consider axios or similar) POST request to WP REST API +// 2.2 Handle errors. +// +// TODO: Find the specs that vary across variations; Product Number Generator +// function findVariationSpecs(variations) + +function processCSV(parentCSV, variationCSV, packageCSV, statusElm) { + // The first row containing attribute names will CONSTantly be referenced + var parentAttr = parentCSV[0]; + var variationAttr = variationCSV[0]; + + if (!parentAttr.includes(_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic) || !variationAttr.includes(_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic)) { + window.alert("Make sure your spreadsheet's \"Parent ID\" ie \"PIC\" attribute is using the name \"".concat(_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic, "\" VERBATIM")); + return false; + } + + var importedProducts = Object(_products__WEBPACK_IMPORTED_MODULE_4__["buildProductObjs"])(parentAttr, parentCSV); + var importedVariations = Object(_products__WEBPACK_IMPORTED_MODULE_4__["buildProductObjs"])(variationAttr, variationCSV); + console.log('imported', importedProducts, importedVariations); + var productsByPIC = Object(_filters_js__WEBPACK_IMPORTED_MODULE_1__["keyByPIC"])(importedProducts); + var productsWithVariations = Object(_filters_js__WEBPACK_IMPORTED_MODULE_1__["linkVariations"])(productsByPIC, importedVariations); + var productsWithPackages = Object(_filters_js__WEBPACK_IMPORTED_MODULE_1__["linkPackages"])(productsWithVariations, packageCSV); + var productsOptimized = Object(_products__WEBPACK_IMPORTED_MODULE_4__["optimizeProducts"])(productsWithPackages); + statusElm.textContent = "Products have been processed. ".concat(Object.keys(productsOptimized).length, " unique PICs found"); // LAST STEP: Once all products are COMPLETELY assembled, save hash for checksum + + var products = Object(_filters_js__WEBPACK_IMPORTED_MODULE_1__["computeChecksum"])(productsOptimized); + return products; +} // Main loop, async to allow blocking + + +function init() { + return _init.apply(this, arguments); +} + +function _init() { + _init = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var importBtn, parentFileInput, variationFileInput, packageFileInput, testBtn, forceBtn, existingProducts, newProducts, importerStatusElement; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + importBtn = document.querySelector('#import_button'); + parentFileInput = document.querySelector('#parent_file_input'); + variationFileInput = document.querySelector('#variation_file_input'); + packageFileInput = document.querySelector('#package_file_input'); + testBtn = document.querySelector('#test_button'); + forceBtn = document.querySelector('#force_button'); + existingProducts = null; + newProducts = null; // Status is updated in several functions. + // Is it okay to be global is the name is long enough to avoid collisions? + // Obviously here it isn't, but I want to get around passing to every function. + + importerStatusElement = document.querySelector('.import_status'); //* ////////////////////////////////////////////////////////////////////// + // Pull existing products, continue + + console.log('Fetching for existing products...'); // Using the '&page' query parameter, build a pagination functionality that + // GETs until there are no more products left. + // another shout-out: https://dev.to/jackedwardlyons/how-to-get-all-wordpress-posts-from-the-wp-api-with-javascript-3j48 + + importerStatusElement.textContent = 'Reading existing products...'; + _context.next = 13; + return Object(_rest_js__WEBPACK_IMPORTED_MODULE_3__["getExistingProducts"])().then(function (data) { + existingProducts = Object(_filters_js__WEBPACK_IMPORTED_MODULE_1__["filterExisting"])(data); + importBtn.disabled = false; + importerStatusElement.textContent = "".concat(Object.keys(existingProducts).length, " products have been found in the WP database."); + console.log("".concat(Object.keys(existingProducts).length, " products have been found in the WP database."), existingProducts); + }); + + case 13: + //* ////////////////////////////////////////////////////////////////////// + // Test POST Call + testBtn.addEventListener('mouseup', function () { + importerStatusElement.textContent = 'Reading existing products...'; + Object(_rest_js__WEBPACK_IMPORTED_MODULE_3__["getExistingProducts"])().then(function (data) { + existingProducts = Object(_filters_js__WEBPACK_IMPORTED_MODULE_1__["filterExisting"])(data); + importBtn.disabled = false; + importerStatusElement.textContent = "".concat(Object.keys(existingProducts).length, " products have been found in the WP database."); + console.log("".concat(Object.keys(existingProducts).length, " products have been found in the WP database."), existingProducts); + }); + }); //* ////////////////////////////////////////////////////////////////////// + // IMPORT EVENT + // TODO: Call this event once all the files are specified, removing need for btn + + console.log('Waiting for input file with product updates...'); + importBtn.addEventListener('mouseup', function (ev) { + ev.preventDefault(); // props to https://javascript.info/file#filereader + + var parentFileHandler = parentFileInput.files[0]; + var variationFileHandler = variationFileInput.files[0]; + var packageFileHandler = packageFileInput.files[0]; + + if (!Object(_filters_js__WEBPACK_IMPORTED_MODULE_1__["verifyFiles"])(parentFileHandler, variationFileHandler, packageFileHandler)) { + return false; + } // Order matters for the sake of passing to processCSV 7 lines below + + + var readPromises = [Object(_utils_js__WEBPACK_IMPORTED_MODULE_2__["readFilePromise"])(parentFileHandler), Object(_utils_js__WEBPACK_IMPORTED_MODULE_2__["readFilePromise"])(variationFileHandler), Object(_utils_js__WEBPACK_IMPORTED_MODULE_2__["readFilePromise"])(packageFileHandler)]; // Prevent additional imports. Enable once the new products have been uploaded and DB has been re-fetched. + + importBtn.disabled = true; + Promise.all(readPromises).then(function (CSVs) { + newProducts = processCSV.apply(void 0, _toConsumableArray(CSVs).concat([importerStatusElement])); + console.log('finished processing', Object.keys(newProducts)); + + var _compareHashesForPayl = Object(_filters_js__WEBPACK_IMPORTED_MODULE_1__["compareHashesForPayload"])(newProducts, existingProducts, forceBtn.checked), + _compareHashesForPayl2 = _slicedToArray(_compareHashesForPayl, 3), + toDelete = _compareHashesForPayl2[0], + toCreate = _compareHashesForPayl2[1], + toUpdate = _compareHashesForPayl2[2]; + + console.log('toDelete and toPost', toDelete, toCreate); + Object(_rest_js__WEBPACK_IMPORTED_MODULE_3__["deleteProducts"])(toDelete, importerStatusElement).then(function (status) { + console.log('finished deleting', status); + Object(_rest_js__WEBPACK_IMPORTED_MODULE_3__["POSTproducts"])(newProducts, toCreate, toUpdate, importerStatusElement).then(function (savedN) { + if (0 === savedN) { + importerStatusElement.textContent = 'New products were not detected.'; + } else { + importerStatusElement.textContent = "".concat(savedN, " have finished uploading."); + } + + importBtn.disabled = false; + }); + }); + }); + }); + + case 16: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _init.apply(this, arguments); +} + +document.addEventListener('DOMContentLoaded', init); + +/***/ }), + +/***/ "./src/scripts/fields.js": +/*!*******************************!*\ + !*** ./src/scripts/fields.js ***! + \*******************************/ +/*! exports provided: f */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return f; }); +// Globals to define spreadsheet column names, +// in case something is changed later. +var f = { + type: 'Type', + name: 'Name', + sku: 'SKU', + pic: 'PIC', + cat: 'tax:product_cat', + tag: 'tax:product_tag', + desc: 'Description', + short_desc: 'Short Description', + visibility: 'Visibility in catalog', + package: 'Package', + title: 'Title', + // Used in packages + attr: 'Attributes', + // Used in packages + model: 'Model', + // Used in packages + skus: 'SKUs', + // Used in packages + prod_info: 'Product Info', + // Used in packages + image: 'Image', + indent: 'Indention', + warrantyList: 'Warranty List', + warrantyBody: 'Warranty Body', + orderInfo: 'Ordering Information', + feats: 'Product Features', + related: 'Related Products', + indict: 'Indications', + downs: 'Downloads', + main_model: 'Main Model', + pnf: 'In Part Number Finder', + searchWeight: 'Search Weight', + region: 'Region Lock' +}; + + +/***/ }), + +/***/ "./src/scripts/filters.js": +/*!********************************!*\ + !*** ./src/scripts/filters.js ***! + \********************************/ +/*! exports provided: findSpecBounds, findSpecIcons, computeChecksum, filterExisting, compareHashesForPayload, keyByPIC, linkVariations, linkPackages, verifyFields, verifyFiles, buildSpec, variationSlice */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findSpecBounds", function() { return findSpecBounds; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findSpecIcons", function() { return findSpecIcons; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeChecksum", function() { return computeChecksum; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filterExisting", function() { return filterExisting; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compareHashesForPayload", function() { return compareHashesForPayload; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyByPIC", function() { return keyByPIC; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linkVariations", function() { return linkVariations; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "linkPackages", function() { return linkPackages; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "verifyFields", function() { return verifyFields; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "verifyFiles", function() { return verifyFiles; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildSpec", function() { return buildSpec; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "variationSlice", function() { return variationSlice; }); +/* harmony import */ var _fields_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fields.js */ "./src/scripts/fields.js"); +/* harmony import */ var object_hash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! object-hash */ "./node_modules/object-hash/dist/object_hash.js"); +/* harmony import */ var object_hash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(object_hash__WEBPACK_IMPORTED_MODULE_1__); +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + + + // The attribute column right before specifications start + +var b_SpecsStart = 'Specification Start'; +var b_SpecsEnd = 'Specification End'; + +function findSpecBounds(attrRow) { + var started = false; + return attrRow.map(function (val, ind) { + if (val === b_SpecsStart) { + started = true; + return ind; + } + + if (val === b_SpecsEnd && started) { + return ind; + } + + return false; + }).filter(function (val) { + if (false !== val) return true; // I know this looks silly, but what if val == 0? + }); +} + +function findSpecIcons(attrRow, row) { + var icons = {}; + + if (!row.includes('ICON')) { + window.alert('Are you sure your defining specification icons?'); + } + + row.map(function (val, ind) { + if ('' !== val && 'ICON' !== val) { + icons[attrRow[ind]] = val; + } + }); + return icons; +} + +function computeChecksum(prods) { + Object.values(prods).map(function (prod) { + prods[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].checksum = object_hash__WEBPACK_IMPORTED_MODULE_1___default()(prod); + }); + console.log('HASHed', prods); + return prods; +} + +function filterExisting(data) { + var existingHashes = {}; + data.forEach(function (WPprod) { + try { + existingHashes[WPprod.meta.PIC[0]] = { + id: WPprod.id, + checksum: String(WPprod.meta.product_hash[0]) + }; + } catch (_unused) { + console.log("ID:".concat(WPprod.id, " is not a legitimate product :(")); + } + }); + return existingHashes; +} + +function compareHashesForPayload(newProds, existing) { + var forcing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + if (!existing) return [[], Object.keys(newProds)]; + var toDelete = []; + var toPost = []; + var toUpdate = []; + var newPics = Object.keys(newProds); + var ignoringN = 0; // Ugh, just redo it + + newPics.forEach(function (pic) { + if (!existing[pic]) { + // Create new products + toPost.push(pic); + } else if (forcing || existing[pic].checksum !== newProds[pic].checksum) { + // Update existing products + existing[pic].pic = pic; // Lol + + toUpdate.push(existing[pic]); + } else { + // Ignore unchanged products, we're just incrementing a counter for stats + ignoringN++; + } // else, this product has not been updated + + }); + console.log("Creating : ".concat(toPost.length)); + console.log("Updating : ".concat(toUpdate.length)); + console.log("Ignoring: ".concat(ignoringN)); + return [toDelete, toPost, toUpdate]; +} + +function keyByPIC(prods) { + var ProdByPIC = {}; + prods.map(function (val) { + if (!val) { + return false; + } + + if (!ProdByPIC[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]]) { + ProdByPIC[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]] = []; + } + + ProdByPIC[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]] = val; + return val; + }); + return ProdByPIC; +} + +function splitAndVerify(commaSeparated) { + if (!commaSeparated) return []; + var rv = commaSeparated.split(',').map(function (val) { + return val.trim(); + }); + + if ('' === rv[0]) { + return false; + } + + return rv; +} + +function buildPackageObj(packages) { + var rv = {}; + var attr = packages[0].splice(1); // Ignore ID field since the rows are spliced too + + packages.splice(1).map(function (row) { + var id = row[0]; + + if (undefined !== rv[id]) { + window.alert("Conflicting package ID's found: ".concat(id)); + } + + rv[id] = {}; + row.splice(1).map(function (val, ind) { + rv[id][attr[ind]] = val; + }); + rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr] = splitAndVerify(rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr]); + rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus] = splitAndVerify(rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus]); + }); + return rv; +} + +function linkVariations(parents, varies) { + // Give all parents an array first, and if prod.type is simple, + // copy the sku and name to make a basic variation + Object.values(parents).map(function (prod) { + parents[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations = []; + + if ('simple' === prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].type]) { + parents[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations.push({ + name: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].name], + sku: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].sku], + specs: prod.specs + }); + } + }); + varies.map(function (val) { + if (undefined === parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]]) return false; + var varN = parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations.push({ + name: val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].name], + sku: val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].sku], + specs: val.specs // This is too heavy optimizeVariations transforms later + + }); // Undefined is better for payload size + + if (val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]) { + parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations[varN - 1].image = val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]; + console.log('has image'); + } + + ; + + if (val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].indent]) { + parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations[varN - 1].indent = val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].indent]; + } + + ; + + if (val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package]) { + parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations[varN - 1].package = val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package]; + } + + ; + }); + return parents; +} + +function linkPackages(parents, packs) { + packs = buildPackageObj(packs); // Learn what you can from just variations + + Object.values(parents).map(function (prod) { + var packages = {}; // Default package + + packages.drop = { + label: '', + //! This should pull from PIC by controller + pic: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic], + model: 'B', + skus: [], + specs: [], + // This needs to be pulled from varying attributes + product_info: ['name', 'description', 'image'] + }; + + if (prod.variations) { + prod.variations.map(function (vary) { + if (undefined !== vary.package) { + // Variation specifies a package to be in + // see if that package exists first + if (!packages[vary.package]) { + packages[vary.package] = { + // Base package template + label: vary.package, + pic: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic], + model: 'B', + skus: [], + specs: [], + // Defined by pack sheet below + product_info: [] // Defined by pack sheet below + + }; // if this is a 'list' package, ensure model A + + if ('list' === vary.package) { + packages[vary.package].model = 'A'; + packages[vary.package].label = ''; //! PIC's name if on another product + + packages[vary.package].product_info = ['name', 'description', 'image']; + } + } // If any of the variations have images, upgrade that package model. + + + if (vary.image) { + packages[vary.package].model = 'C'; // Make sure they're separate from the 'drop' first + // Any other details should be defined by pack sheet + } // Add variation to the package of its choice + + + console.log(prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].name], vary.package); + packages[vary.package].skus.push(vary.sku); // If a package name isn't specified but the variation still uses an image, use a blank package name, similar to 'drop' + } else if (vary.image) { + // Check if there already isn't a package for unlabeled packages of variation images. + if (!packages.varyImage) { + packages.varyImage = { + label: '', + pic: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic], + skus: [], + specs: [], + model: 'C', + product_info: ['name', 'description', 'image'] + }; + } + + packages.varyImage.skus.push(vary.sku); + } else { + packages.drop.skus.push(vary.sku); + } + }); + } // Remove default if every variation found a package + + + if (0 === packages.drop.skus.length) { + delete packages.drop; + } // Now apply the package file for more packages and specs + // All packages must have names by now, otherwise the variations wouldn't be able to save or they would be put in 'drop' + + + if (prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package]) { + prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package].split(',').map(function (id) { + // This is a package who's name derives from PIC + id = id.trim(); // Before making custom package, make sure the variations didn't already define it. + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title] & packages[packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]]) { + packages['custom' + id] = packages[packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]]; + delete packages[packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]]; + } else + /* Otherwise, build the new package */ + { + packages['custom' + id] = { + label: '', + pic: '', + skus: [], + model: 'B', + specs: [], + // This needs to be pulled from varying attributes + product_info: [] + }; + } // For every field that is defined by the package sheet, confirm and re-specify. + + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]) { + packages['custom' + id].model = 'D'; + packages['custom' + id].image = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]) { + packages['custom' + id].pic = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus]) { + var _packages$skus; + + (_packages$skus = packages['custom' + id].skus).push.apply(_packages$skus, _toConsumableArray(packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus])); + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr]) { + packages['custom' + id].specs = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr]; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]) { + packages['custom' + id].label = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]; + } else { + // If the title is not specified, this is a product blurb and the title and product_info should be pulled from the PIC. + packages['custom' + id].product_info = ['name', 'description', 'image']; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].prod_info]) { + packages['custom' + id].product_info = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].prod_info].split(',').map(function (val) { + return val.trim(); + }); + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].model]) { + packages['custom' + id].model = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].model]; + } + }); + } // TODO: Test with Posterior Mounting Brackets with the art of linking via label and specify specs in sheet + // TODO: nevermind, but test anyways + /// / : Confirm that the first package is the 'drop' package + // TODO: Stop using the drop package... + // if (Object.values(packages)[0] && '' !== Object.values(packages)[0].label) { + // window.alert(`${prod[f.name]} should be specifying main product variations first!`); + // } + // Packages makes up both packages implicitly defined in variations and explicitly from the sheet + + + parents[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].packages = packages; + }); + return parents; +} // confirm definition of properties that will be used in POST +// used for cleaning taxonomies for now + + +function verifyFields(prod) { + return prod; +} + +function verifyFiles(parentFileHandler, variationFileHandler, packageFileHandler) { + if (parentFileHandler === undefined) { + window.alert('Specify a parent product file first'); + return false; + } + + if (variationFileHandler === undefined) { + window.alert('Specify a variations file first'); + return false; + } + + if (packageFileHandler === undefined) { + window.alert('Specify a package file first'); + return false; + } + + return true; +} + +function buildSpec(start, end, ind, val, icon) { + if (start < ind && ind < end) { + var spec = {}; // Value + + spec.val = val.trim(); // Icon + + spec.icon = icon; // Featured or Additional + + if (val.includes('*')) { + spec.val = val.replace('*', ''); + spec.featured = true; + } else { + spec.featured = false; + } + + return spec; + } + + return false; +} + +function variationSlice(varyPack, i) { + var rv = { + varies: varyPack.varies[i], + labels: varyPack.labels + }; + return rv; +} + + + +/***/ }), + +/***/ "./src/scripts/products.js": +/*!*********************************!*\ + !*** ./src/scripts/products.js ***! + \*********************************/ +/*! exports provided: buildProductObjs, optimizeProducts */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildProductObjs", function() { return buildProductObjs; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "optimizeProducts", function() { return optimizeProducts; }); +/* harmony import */ var _filters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filters */ "./src/scripts/filters.js"); +/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fields */ "./src/scripts/fields.js"); +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +/* eslint-disable no-undef */ + + + +function combineUnitSpecs(parent) { + var combos = {}; + Object.keys(parent.specs).forEach(function (specLabel) { + var lastBracket = specLabel.lastIndexOf(')'); + + if (-1 !== lastBracket) { + var firstBracket = specLabel.lastIndexOf('('); + var base = specLabel.substr(0, firstBracket); + var unit = specLabel.substr(firstBracket, lastBracket); + if (!combos[base]) combos[base] = {}; + combos[base][unit] = parent.specs[specLabel]; // combos[base][unit].val += unit; + } + }); + Object.keys(combos).forEach(function (combo) { + var comboUnits = Object.keys(combos[combo]); // Don't create a combo unit unless there are at least 2 units to combine + + if (2 > comboUnits.length) return false; + comboUnits.forEach(function (unit, i) { + // First value dictates the logo and featuredBool used + var directUnit = unit.substr(1, unit.length - 2); + delete parent.specs[combo + unit]; + + if (0 === i) { + parent.specs[combo.trim()] = combos[combo][unit]; + parent.specs[combo.trim()].val += " ".concat(directUnit); + } else { + parent.specs[combo.trim()].val += " (".concat(combos[combo][unit].val, " ").concat(directUnit, ")"); + } + }); + }); // Not using includesAny() since I'm particularly looking for units in parenthesis + + return parent.specs; +} + +function buildProductObjs(attrRow, rows) { + // This will go through a CSV and create an array + // of product objects keyed to the attribute name + var _findSpecBounds = Object(_filters__WEBPACK_IMPORTED_MODULE_0__["findSpecBounds"])(attrRow), + _findSpecBounds2 = _slicedToArray(_findSpecBounds, 2), + start = _findSpecBounds2[0], + end = _findSpecBounds2[1]; + + var icons = Object(_filters__WEBPACK_IMPORTED_MODULE_0__["findSpecIcons"])(attrRow, rows[1]); + var region = wpApiSettings.lang; + console.log('Current Region: ', region); // Splice to avoid first two rows of attribute names and icons + + var products = rows.splice(1).map(function (row) { + var product = {}; + product.specs = {}; + product.terms = {}; + product.warranty = {}; + product.indications = []; + product.downloads = []; + product.packages = []; + row.map(function (val, ind) { + var specLabel = attrRow[ind].trim(); + + if ('' !== val) { + // Specification or generic product information + var spec = Object(_filters__WEBPACK_IMPORTED_MODULE_0__["buildSpec"])(start, end, ind, val, icons[specLabel]); + + if (spec) { + product.specs[specLabel] = spec; + } else { + // Generic product info + product[specLabel] = val; + } + } + }); // TODO: ONLY FOR TESTING ONE PRODUCT + // if ('2102' !== product[f.pic] /* || !product[f.type] */) return undefined; + // if ('2076' !== product[f.pic] /* || !product[f.type] */) return undefined; + // Taxonomies + + product.terms.product_cat = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].cat] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].cat].split('::').map(function (term) { + return term.trim(); + }) : []; + product.terms.product_tag = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].tag] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].tag].split(',').map(function (term) { + return term.trim(); + }) : []; // Default search weight of 3 if absent + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].searchWeight] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].searchWeight] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].searchWeight] : 3; // Warranty pieces into one + + product.warranty.body = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].warrantyBody]; + product.warranty.list = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].warrantyList] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].warrantyList].split('\n').map(function (line) { + return line.trim(); + }) : []; /// ////////////// + // Trim whitespace from crucial columns + // type only defined for parent products + + if (product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type]) { + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type].trim(); + } // Gallery + + + product.gallery = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].image] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].image].split(',').map(function (item) { + return item.trim(); + }) : ['1005']; // Features + + product.features = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].feats] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].feats].split('\n').map(function (line) { + return line.trim(); + }) : []; // Indications + + product.indications = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].indict] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].indict].split('\n').map(function (line) { + return line.trim(); + }) : []; // Related Products + + product.related = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].related] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].related].split(',').map(function (val) { + return val.trim(); + }) : []; // Downloads + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs].split(',').map(function (val) { + return val.trim(); + }) : []; // Parse downloads + + for (var i = 0; i < product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs].length; i += 2) { + product.downloads.push({ + title: product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs][i], + url: product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs][i + 1] + }); + } /// * ////////////////////////////////////////////////// + // Field Defaults prior to checksum + // SKU field defined regardless + + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].sku] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].sku] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].sku] : ''; // Order field + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].orderInfo] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].orderInfo] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].orderInfo] : ''; // Main Model field + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].main_model] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].main_model] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].main_model] : 'E'; // Part Number Field toggle field + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].png] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].pnf] ? '1' === product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].pnf] : false; // Visibility + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].visibility] = 'visible' === product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].visibility] ? 'publish' : 'draft'; // Region Specification + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].region] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].region] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].region] : wpApiSettings.lang; // Skip products region locked to another language, different than the current WP WPML Language + + if (product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type] && wpApiSettings.lang !== product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].region]) { + return false; + } // Optimize specs by combining different units of the same spec + + + product.specs = combineUnitSpecs(product); // Ignore blank rows or incomplete products + + if (product !== undefined && product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].name] && product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].pic]) { + return product; + } + }); + return products.filter(function (prod) { + return prod !== undefined; + }); +} + +function optimizeVariations(parent) { + // Since variations are built the same way as products, + // we must use trim away unused data from variations for slimmer POSTs + if (undefined === parent.variations) { + return parent; + } + + var specLabels = []; + parent.variations = parent.variations.map(function (vary) { + var specValues = {}; + Object.keys(vary.specs).forEach(function (specLabel) { + var specIndex = specLabels.indexOf(specLabel); + specIndex = -1 === specIndex ? specLabels.push(specLabel) - 1 : specIndex; + specValues[specIndex] = vary.specs[specLabel].val; // vary.specs[specLabel] = vary.specs[specLabel].val; + }); + vary.specs = specValues; // Wipe out specs and replace with the diet program + + return vary; + }); + var varyPacks = []; + + while (0 < parent.variations.length) { + varyPacks.push(parent.variations.splice(0, 600)); + } + + parent.variations = { + varies: varyPacks, + labels: specLabels + }; // Break up varies + + return parent; +} + +function dependantVariations(parent) { + var specCompare = {}; + var labels = parent.variations.labels; + var variationValues = parent.variations.varies[0]; // TODO: Add support for multiple variation packs. Only [0] at the moment + // I Know, a bigO(n^2), but it could be worse... + + labels.forEach(function (label, ind, arr) { + specCompare[label] = {}; + }); // varies = [values] and the corresponding label sharing index + + Object.values(variationValues).forEach(function (values, pairIndex) { + // console.log('values', values, values.specs, Object.values(values.specs)); + // values = Object.values(values.specs); + Object.values(values.specs).forEach(function (val, ind, arr) { + if (undefined === specCompare[labels[ind]][val]) specCompare[labels[ind]][val] = {}; // A loop for going through all the OTHER spec values + + for (var i = (ind + 1) % arr.length; i !== ind; i = (i + 1) % arr.length) { + // Create new arrays at spec: val : spec level + if (undefined === specCompare[labels[ind]][val][labels[i]]) { + specCompare[labels[ind]][val][labels[i]] = []; + } // Only add unique values to the matrix + + + if (!specCompare[labels[ind]][val][labels[i]].includes(arr[i])) { + // Different spec values at the same variation + specCompare[labels[ind]][val][labels[i]].push(arr[i]); + } + } + }); + }); + return parent; +} +/* +Either combining minimum/maximums with dash '-' + or appending different units into one +*/ + + +function includesAny(subject, arr) { + var mod = false; + var base = ''; + arr.forEach(function (val) { + if (subject.includes(val) && !mod) { + mod = val; + base = subject.replace(mod, '').trim(); + } + }); + return [mod, base]; +} // Spec labels are pulled from just the first variation. + + +function combineVariationSpecs(parent) { + var combos = {}; + var searchFor = ['Minimum', 'Maximum', 'Min', 'Max', 'min', 'max']; // Min/Max combos -> min - max + + if (parent.variations[0] === undefined) { + console.log('Has no variations?', parent); + } + + Object.keys(parent.variations[0].specs).forEach(function (label, ind, arr) { + var _includesAny = includesAny(label, searchFor), + _includesAny2 = _slicedToArray(_includesAny, 2), + mod = _includesAny2[0], + base = _includesAny2[1]; + + if (mod) { + // Attach to base pair which I check to see exists first + if (!combos[base]) combos[base] = []; + combos[base].push(label); + } + }); // console.log('combine specifications:', combos); + // Apply min/max combinations + // For every variations... on each combo... the value of combined fields + + parent.variations.forEach(function (vary, ind) { + vary = vary.specs; + Object.keys(combos).forEach(function (base) { + // Otherwise, this was a product with a single Min OR Max + if (2 === combos[base].length && vary[combos[base][0]]) { + var newVal = { + featured: false, + icon: '', + val: "".concat(vary[combos[base][0]].val, " - ").concat(vary[combos[base][1]].val) + }; // Set other variations to delete + + vary[combos[base][0]].val = ''; + vary[combos[base][1]].val = ''; + vary[base] = newVal; + parent.variations[ind].specs = vary; // Remember vary was set to specs + } + }); + }); + return parent; +} + +function fillBlankVariations(product) { + var totalSpecs = product.variations.labels.length; // An array of false, set to true once seen used + // in a variation after all the optimization. + + var specUsage = product.variations.labels.map(function (val) { + return false; + }); // Figure out which specs are never usage (transformed into another spec) + + product.variations.varies[0].forEach(function (variation, varyInd) { + specUsage.forEach(function (used, ind) { + if ('' !== variation.specs[ind]) { + specUsage[ind] = true; + } + }); + }); // Skipping varies pagination that never got used + + product.variations.varies[0].forEach(function (variation, varyInd) { + // For each spec inside each variation, assign empty string if non-existent. + specUsage.forEach(function (used, ind) { + if (used && !variation.specs[ind]) { + product.variations.varies[0][varyInd].specs[ind] = ' '; + } + }); + }); + return product; +} + +function addFirstSKU(product) { + if ('variation' === product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type]) { + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].sku] = product.variations.varies[0][0].sku; + } + + return product; +} + +function optimizeProducts(parents) { + // Reformat variation object for lighter specs overhead + Object.keys(parents).forEach(function (key) { + parents[key] = combineVariationSpecs(parents[key]); // console.log(parents[key]); + + parents[key] = optimizeVariations(parents[key]); // console.log(parents[key]); + + parents[key] = dependantVariations(parents[key]); + parents[key] = fillBlankVariations(parents[key]); + parents[key] = addFirstSKU(parents[key]); + }); + return parents; +} + + + +/***/ }), + +/***/ "./src/scripts/rest.js": +/*!*****************************!*\ + !*** ./src/scripts/rest.js ***! + \*****************************/ +/*! exports provided: deleteProducts, POSTproducts, getExistingProducts */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deleteProducts", function() { return deleteProducts; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "POSTproducts", function() { return POSTproducts; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getExistingProducts", function() { return getExistingProducts; }); +/* harmony import */ var _filters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filters */ "./src/scripts/filters.js"); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ "./src/scripts/utils.js"); +/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fields */ "./src/scripts/fields.js"); +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + + + + + +function getExistingProducts() { + return _getExistingProducts.apply(this, arguments); +} // Delete a product, ?force to ensure permanent deletion + + +function _getExistingProducts() { + _getExistingProducts = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var pages, crntPage, pagesN; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + pages = []; + crntPage = 1; + pagesN = 20; // Fetch first page to find total pages + + console.log("Nonce: ".concat(wpApiSettings.nonce)); + _context.t0 = pages.push; + _context.t1 = pages; + _context.t2 = _toConsumableArray; + _context.next = 9; + return fetch("".concat(wpApiSettings.root, "wp/v2/product?per_page=100&page=1&status=draft,publish"), { + method: 'get', + headers: { + 'X-WP-Nonce': wpApiSettings.nonce, + 'Content-Type': 'application/json' + } + }).then(function (res) { + pagesN = res.headers.get('x-wp-totalpages'); + console.log("Total Pages: ".concat(pagesN)); + return res.json(); + }).catch(console.error); + + case 9: + _context.t3 = _context.sent; + _context.t4 = (0, _context.t2)(_context.t3); + + _context.t0.apply.call(_context.t0, _context.t1, _context.t4); + + case 12: + if (!(crntPage++ < pagesN)) { + _context.next = 23; + break; + } + + _context.t5 = pages.push; + _context.t6 = pages; + _context.t7 = _toConsumableArray; + _context.next = 18; + return fetch("".concat(wpApiSettings.root, "wp/v2/product?per_page=100&page=").concat(crntPage, "&status=draft,publish"), { + method: 'get', + headers: { + 'X-WP-Nonce': wpApiSettings.nonce, + 'Content-Type': 'application/json' + } + }).then(function (res) { + return res.json(); + }).catch(function (err) { + return console.error(err, pages); + }); + + case 18: + _context.t8 = _context.sent; + _context.t9 = (0, _context.t7)(_context.t8); + + _context.t5.apply.call(_context.t5, _context.t6, _context.t9); + + _context.next = 12; + break; + + case 23: + return _context.abrupt("return", pages); + + case 24: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _getExistingProducts.apply(this, arguments); +} + +function deleteProduct(postID) { + var verbose = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + return new Promise(function (resolve, reject) { + if (!postID) { + reject(postID); + } + + fetch("".concat(wpApiSettings.root, "wp/v2/product/").concat(postID, "?force=true"), { + method: 'delete', + headers: { + 'X-WP-Nonce': wpApiSettings.nonce, + 'Content-Type': 'application/json' + } + }).then(function (res) { + resolve(res); + if (verbose) console.log(res); + }).catch(console.error); + }); +} + +function deleteProducts(_x, _x2) { + return _deleteProducts.apply(this, arguments); +} + +function _deleteProducts() { + _deleteProducts = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(prods, statuseElm) { + var responses, lastDelete; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + responses = []; + + case 1: + if (!(0 < prods.length)) { + _context2.next = 9; + break; + } + + statuseElm.textContent = "Deleting products. ".concat(prods.length, " remain..."); + _context2.next = 5; + return deleteProduct(prods.splice(0, 1)[0], true); + + case 5: + lastDelete = _context2.sent; + responses.push(lastDelete); + _context2.next = 1; + break; + + case 9: + return _context2.abrupt("return", responses); + + case 10: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); + return _deleteProducts.apply(this, arguments); +} + +function POSTproduct(_x3) { + return _POSTproduct.apply(this, arguments); +} + +function _POSTproduct() { + _POSTproduct = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(val) { + var updateID, + payload, + url, + _args3 = arguments; + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + updateID = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false; + // val = verifyFields(val); // Until this is used... If this is used... + payload = { + title: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].name], + content: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].desc], + excerpt: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].short_desc], + status: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].visibility], + terms: val.terms, + meta: { + SKU: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].sku], + PIC: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].pic], + ordering_info: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].orderInfo], + product_type: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].type], + product_hash: val.checksum, + // Used for finding changes between new imports and wp posts + main_model: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].main_model], + part_number_finder: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].pnf], + search_weight: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].searchWeight] + }, + specs: val.specs, + gallery: val.gallery, + variations: val.variations ? Object(_filters__WEBPACK_IMPORTED_MODULE_0__["variationSlice"])(val.variations, 0) : [], + // .splice(0, 40) : [], + packages: Object.values(val.packages ? val.packages : {}), + // Keys only used for construction + warranty: val.warranty, + features: val.features, + indications: val.indications, + downloads: val.downloads, + related: val.related, + region: val[_fields__WEBPACK_IMPORTED_MODULE_2__["f"].region] + }; // console.log('product payload', payload); + + url = "".concat(wpApiSettings.root, "wp/v2/product"); + + if (updateID) { + url = "".concat(wpApiSettings.root, "wp/v2/product/").concat(updateID); + } + + return _context3.abrupt("return", Object(_utils_js__WEBPACK_IMPORTED_MODULE_1__["fetcher"])(url, { + method: 'post', + headers: { + 'X-WP-Nonce': wpApiSettings.nonce, + 'Content-Type': 'application/json' + }, + body: JSON.stringify(payload) + }).then(function (res) { + console.log(res); // Confirm that the POST was ok before adding variations + + if (undefined !== res && val.variations && 1 < val.variations.varies.length) { + return POSTvariations(res.id, val.variations, 1).then(function () { + Object(_utils_js__WEBPACK_IMPORTED_MODULE_1__["incrementProgress"])(); + }); + } else { + Object(_utils_js__WEBPACK_IMPORTED_MODULE_1__["incrementProgress"])(); + } + }).catch(console.error)); + + case 5: + case "end": + return _context3.stop(); + } + } + }, _callee3); + })); + return _POSTproduct.apply(this, arguments); +} + +function POSTvariations(_x4, _x5) { + return _POSTvariations.apply(this, arguments); +} + +function _POSTvariations() { + _POSTvariations = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(POSTid, varies) { + var depth, + payload, + _args4 = arguments; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + depth = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : 1; + console.log("Posting more variations at a depth of ".concat(depth)); + payload = JSON.stringify({ + variations: Object(_filters__WEBPACK_IMPORTED_MODULE_0__["variationSlice"])(varies, depth) + }); // console.log('variations payload: ', payload); + + return _context4.abrupt("return", Object(_utils_js__WEBPACK_IMPORTED_MODULE_1__["fetcher"])("".concat(wpApiSettings.root, "wp/v2/product/").concat(POSTid), { + method: 'post', + headers: { + 'X-WP-Nonce': wpApiSettings.nonce, + 'Content-Type': 'application/json' + }, + body: payload + }).then(function (res) { + if (res && depth + 1 !== varies.varies.length && 16 > depth) { + return POSTvariations(POSTid, varies, depth + 1); + } + })); + + case 4: + case "end": + return _context4.stop(); + } + } + }, _callee4); + })); + return _POSTvariations.apply(this, arguments); +} + +function POSTproducts(_x6, _x7, _x8, _x9) { + return _POSTproducts.apply(this, arguments); +} + +function _POSTproducts() { + _POSTproducts = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(prods, toCreate, toUpdate, statusElm) { + var Nprod, currentProduct, prodData, prodID, finished; + return regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + Nprod = toCreate.length + toUpdate.length; + finished = 0; + statusElm.textContent = "Uploading products: 0 of ".concat(Nprod, " received"); + console.log('POSTing...', toCreate, toUpdate); // POST loop + + case 4: + if (!(0 < toCreate.length)) { + _context5.next = 12; + break; + } + + console.log('posting new product...'); + statusElm.textContent = "Uploading products: ".concat(finished++, " of ").concat(Nprod, " received"); + prodData = prods[toCreate.splice(0, 1)]; + _context5.next = 10; + return POSTproduct(prodData); + + case 10: + _context5.next = 4; + break; + + case 12: + if (!(0 < toUpdate.length)) { + _context5.next = 22; + break; + } + + console.log('posting updates...'); + statusElm.textContent = "Uploading products: ".concat(finished++, " of ").concat(Nprod, " received"); + currentProduct = toUpdate.splice(0, 1)[0]; + prodData = prods[currentProduct.pic]; + prodID = currentProduct.id; + _context5.next = 20; + return POSTproduct(prodData, prodID); + + case 20: + _context5.next = 12; + break; + + case 22: + return _context5.abrupt("return", Nprod); + + case 23: + case "end": + return _context5.stop(); + } + } + }, _callee5); + })); + return _POSTproducts.apply(this, arguments); +} + + + +/***/ }), + +/***/ "./src/scripts/utils.js": +/*!******************************!*\ + !*** ./src/scripts/utils.js ***! + \******************************/ +/*! exports provided: fetcher, readFilePromise, testCall, incrementProgress */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fetcher", function() { return fetcher; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "readFilePromise", function() { return readFilePromise; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "testCall", function() { return testCall; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "incrementProgress", function() { return incrementProgress; }); +/* harmony import */ var csv_parse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! csv-parse */ "./node_modules/csv-parse/lib/index.js"); +/* harmony import */ var csv_parse__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(csv_parse__WEBPACK_IMPORTED_MODULE_0__); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + + // Utitlity Functions + +function fetcher(url, obj) { + var forgiving = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + // Some boilerplate for fetch calls + return fetch(url, obj).then(function (res) { + if (500 === res.status) { + if (forgiving) { + console.error('Trying one more time'); + return fetcher(url, obj, false); + } else { + console.error('Second attempt failed as well'); + } + } else if (!forgiving) { + console.log('Second attempt success!'); + } + + return res.json(); + }).catch(function (err) { + return console.error(err, obj); + }); +} + +function readFilePromise(_x) { + return _readFilePromise.apply(this, arguments); +} + +function _readFilePromise() { + _readFilePromise = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(fileHandler) { + var reader; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + // And another shoutout to this link https://blog.shovonhasan.com/using-promises-with-filereader/ + reader = new FileReader(); + reader.readAsText(fileHandler); + return _context.abrupt("return", new Promise(function (resolve, reject) { + reader.onerror = function () { + reader.abort(); + reject(new DOMException('Problem parsing input file.')); + }; + + reader.onload = function () { + csv_parse__WEBPACK_IMPORTED_MODULE_0___default()(reader.result, {}, function (err, output) { + if (err) console.error('CSV parser failed: ', err);else resolve(output); + }); + }; + })); + + case 3: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _readFilePromise.apply(this, arguments); +} + +function testCall(ev) { + ev.preventDefault(); // Lance magic + + fetch("".concat(wpApiSettings.root, "wp/v2"), { + method: 'get', + headers: { + 'X-WP-Nonce': wpApiSettings.nonce, + 'Content-Type': 'application/json' + } // body: JSON.stringify({ + // title: 'Hello Moon', + // content: '', + // excerpt: '', + // status: 'publish', + // meta: { sku: 'asdf', product_type: 'simple', pic: '12452364' }, + // }), + + }).then(function (response) { + return response.json().then(console.log); + }).catch(console.log); +} // This is not used, was part of an old method I was trying to do with variations and now I'm too scared to delete it all + + +function incrementProgress(elm) { + return elm; +} + + + +/***/ }), + +/***/ 0: +/*!*************************************!*\ + !*** multi ./src/scripts/client.js ***! + \*************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! /Users/jim/Local Sites/Fillauer/Importer/src/scripts/client.js */"./src/scripts/client.js"); + + +/***/ }), + +/***/ 1: +/*!**********************!*\ + !*** util (ignored) ***! + \**********************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), + +/***/ 2: +/*!**********************!*\ + !*** util (ignored) ***! + \**********************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }) + +/******/ }); +//# sourceMappingURL=data:application/json;charset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N0YXRlLndhc1F1b3RpbmcgPSB0cnVlXG4gICAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgICB9ZWxzZSBpZihyZWxheCA9PT0gZmFsc2Upe1xuICAgICAgICAgICAgICBjb25zdCBlcnIgPSB0aGlzLl9fZXJyb3IoXG4gICAgICAgICAgICAgICAgbmV3IENzdkVycm9yKCdDU1ZfSU5WQUxJRF9DTE9TSU5HX1FVT1RFJywgW1xuICAgICAgICAgICAgICAgICAgJ0ludmFsaWQgQ2xvc2luZyBRdW90ZTonLFxuICAgICAgICAgICAgICAgICAgYGdvdCBcIiR7U3RyaW5nLmZyb21DaGFyQ29kZShuZXh0Q2hyKX1cImAsXG4gICAgICAgICAgICAgICAgICBgYXQgbGluZSAke3RoaXMuaW5mby5saW5lc31gLFxuICAgICAgICAgICAgICAgICAgJ2luc3RlYWQgb2YgZGVsaW1pdGVyLCByb3cgZGVsaW1pdGVyLCB0cmltYWJsZSBjaGFyYWN0ZXInLFxuICAgICAgICAgICAgICAgICAgJyhpZiBhY3RpdmF0ZWQpIG9yIGNvbW1lbnQnLFxuICAgICAgICAgICAgICAgIF0sIHRoaXMuX19jb250ZXh0KCkpXG4gICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgaWYoZXJyICE9PSB1bmRlZmluZWQpIHJldHVybiBlcnJcbiAgICAgICAgICAgIH1lbHNle1xuICAgICAgICAgICAgICB0aGlzLnN0YXRlLnF1b3RpbmcgPSBmYWxzZVxuICAgICAgICAgICAgICB0aGlzLnN0YXRlLndhc1F1b3RpbmcgPSB0cnVlXG4gICAgICAgICAgICAgIC8vIGNvbnRpbnVlXG4gICAgICAgICAgICAgIHRoaXMuc3RhdGUuZmllbGQucHJlcGVuZChxdW90ZSlcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9ZWxzZXtcbiAgICAgICAgICAgIGlmKHRoaXMuc3RhdGUuZmllbGQubGVuZ3RoICE9PSAwKXtcbiAgICAgICAgICAgICAgLy8gSW4gcmVsYXggbW9kZSwgdHJlYXQgb3BlbmluZyBxdW90ZSBwcmVjZWRlZCBieSBjaHJzIGFzIHJlZ3VsYXJcbiAgICAgICAgICAgICAgaWYoIHJlbGF4ID09PSBmYWxzZSApe1xuICAgICAgICAgICAgICAgIGNvbnN0IGVyciA9IHRoaXMuX19lcnJvcihcbiAgICAgICAgICAgICAgICAgIG5ldyBDc3ZFcnJvcignSU5WQUxJRF9PUEVOSU5HX1FVT1RFJywgW1xuICAgICAgICAgICAgICAgICAgICAnSW52YWxpZCBPcGVuaW5nIFF1b3RlOicsXG4gICAgICAgICAgICAgICAgICAgIGBhIHF1b3RlIGlzIGZvdW5kIGluc2lkZSBhIGZpZWxkIGF0IGxpbmUgJHt0aGlzLmluZm8ubGluZXN9YCxcbiAgICAgICAgICAgICAgICAgIF0sIHRoaXMuX19jb250ZXh0KCksIHtcbiAgICAgICAgICAgICAgICAgICAgZmllbGQ6IHRoaXMuc3RhdGUuZmllbGQsXG4gICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIClcbiAgICAgICAgICAgICAgICBpZihlcnIgIT09IHVuZGVmaW5lZCkgcmV0dXJuIGVyclxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9ZWxzZXtcbiAgICAgICAgICAgICAgdGhpcy5zdGF0ZS5xdW90aW5nID0gdHJ1ZVxuICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZih0aGlzLnN0YXRlLnF1b3RpbmcgPT09IGZhbHNlKXtcbiAgICAgICAgICBsZXQgcmVjb3JkRGVsaW1pdGVyTGVuZ3RoID0gdGhpcy5fX2lzUmVjb3JkRGVsaW1pdGVyKGNociwgYnVmLCBwb3MpXG4gICAgICAgICAgaWYocmVjb3JkRGVsaW1pdGVyTGVuZ3RoICE9PSAwKXtcbiAgICAgICAgICAgIC8vIERvIG5vdCBlbWl0IGNvbW1lbnRzIHdoaWNoIHRha2UgYSBmdWxsIGxpbmVcbiAgICAgICAgICAgIGNvbnN0IHNraXBDb21tZW50TGluZSA9IHRoaXMuc3RhdGUuY29tbWVudGluZyAmJiAodGhpcy5zdGF0ZS53YXNRdW90aW5nID09PSBmYWxzZSAmJiB0aGlzLnN0YXRlLnJlY29yZC5sZW5ndGggPT09IDAgJiYgdGhpcy5zdGF0ZS5maWVsZC5sZW5ndGggPT09IDApXG4gICAgICAgICAgICBpZihza2lwQ29tbWVudExpbmUpe1xuICAgICAgICAgICAgICB0aGlzLmluZm8uY29tbWVudF9saW5lcysrXG4gICAgICAgICAgICAgIC8vIFNraXAgZnVsbCBjb21tZW50IGxpbmVcbiAgICAgICAgICAgIH1lbHNle1xuICAgICAgICAgICAgICAvLyBTa2lwIGlmIGxpbmUgaXMgZW1wdHkgYW5kIHNraXBfZW1wdHlfbGluZXMgYWN0aXZhdGVkXG4gICAgICAgICAgICAgIGlmKHNraXBfZW1wdHlfbGluZXMgPT09IHRydWUgJiYgdGhpcy5zdGF0ZS53YXNRdW90aW5nID09PSBmYWxzZSAmJiB0aGlzLnN0YXRlLnJlY29yZC5sZW5ndGggPT09IDAgJiYgdGhpcy5zdGF0ZS5maWVsZC5sZW5ndGggPT09IDApe1xuICAgICAgICAgICAgICAgIHRoaXMuaW5mby5lbXB0eV9saW5lcysrXG4gICAgICAgICAgICAgICAgcG9zICs9IHJlY29yZERlbGltaXRlckxlbmd0aCAtIDFcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIC8vIEFjdGl2YXRlIHJlY29yZHMgZW1pdGlvbiBpZiBhYm92ZSBmcm9tX2xpbmVcbiAgICAgICAgICAgICAgaWYodGhpcy5zdGF0ZS5lbmFibGVkID09PSBmYWxzZSAmJiB0aGlzLmluZm8ubGluZXMgKyAodGhpcy5zdGF0ZS53YXNSb3dEZWxpbWl0ZXIgPT09IHRydWUgPyAxOiAwICkgPj0gZnJvbV9saW5lKXtcbiAgICAgICAgICAgICAgICB0aGlzLnN0YXRlLmVuYWJsZWQgPSB0cnVlXG4gICAgICAgICAgICAgICAgdGhpcy5fX3Jlc2V0RmllbGQoKVxuICAgICAgICAgICAgICAgIHRoaXMuX19yZXNldFJvdygpXG4gICAgICAgICAgICAgICAgcG9zICs9IHJlY29yZERlbGltaXRlckxlbmd0aCAtIDFcbiAgICAgICAgICAgICAgICBjb250aW51ZVxuICAgICAgICAgICAgICB9ZWxzZXtcbiAgICAgICAgICAgICAgICBjb25zdCBlcnJGaWVsZCA9IHRoaXMuX19vbkZpZWxkKClcbiAgICAgICAgICAgICAgICBpZihlcnJGaWVsZCAhPT0gdW5kZWZpbmVkKSByZXR1cm4gZXJyRmllbGRcbiAgICAgICAgICAgICAgICBjb25zdCBlcnJSZWNvcmQgPSB0aGlzLl9fb25Sb3coKVxuICAgICAgICAgICAgICAgIGlmKGVyclJlY29yZCAhPT0gdW5kZWZpbmVkKSByZXR1cm4gZXJyUmVjb3JkXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgaWYodG8gIT09IC0xICYmIHRoaXMuaW5mby5yZWNvcmRzID49IHRvKXtcbiAgICAgICAgICAgICAgICB0aGlzLnN0YXRlLnN0b3AgPSB0cnVlXG4gICAgICAgICAgICAgICAgdGhpcy5wdXNoKG51bGwpXG4gICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRoaXMuc3RhdGUuY29tbWVudGluZyA9IGZhbHNlXG4gICAgICAgICAgICBwb3MgKz0gcmVjb3JkRGVsaW1pdGVyTGVuZ3RoIC0gMVxuICAgICAgICAgICAgY29udGludWVcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYodGhpcy5zdGF0ZS5jb21tZW50aW5nKXtcbiAgICAgICAgICAgIGNvbnRpbnVlXG4gICAgICAgICAgfVxuICAgICAgICAgIGNvbnN0IGNvbW1lbnRDb3VudCA9IGNvbW1lbnQgP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gICAgICAgIGlmKGNvbHVtbnMgPT09IGZhbHNlKXtcbiAgICAgICAgICBjb25zdCBlcnIgPSB0aGlzLl9fZXJyb3IoXG4gICAgICAgICAgICBuZXcgQ3N2RXJyb3IoJ0NTVl9JTkNPTlNJU1RFTlRfUkVDT1JEX0xFTkdUSCcsIFtcbiAgICAgICAgICAgICAgJ0ludmFsaWQgUmVjb3JkIExlbmd0aDonLFxuICAgICAgICAgICAgICBgZXhwZWN0ICR7dGhpcy5zdGF0ZS5leHBlY3RlZFJlY29yZExlbmd0aH0sYCxcbiAgICAgICAgICAgICAgYGdvdCAke3JlY29yZExlbmd0aH0gb24gbGluZSAke3RoaXMuaW5mby5saW5lc31gLFxuICAgICAgICAgICAgXSwgdGhpcy5fX2NvbnRleHQoKSwge1xuICAgICAgICAgICAgICByZWNvcmQ6IHJlY29yZCxcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgKVxuICAgICAgICAgIGlmKGVyciAhPT0gdW5kZWZpbmVkKSByZXR1cm4gZXJyXG4gICAgICAgIH1lbHNle1xuICAgICAgICAgIGNvbnN0IGVyciA9IHRoaXMuX19lcnJvcihcbiAgICAgICAgICAgIC8vIENTVl9JTlZBTElEX1JFQ09SRF9MRU5HVEhfRE9OVF9NQVRDSF9DT0xVTU5TXG4gICAgICAgICAgICBuZXcgQ3N2RXJyb3IoJ0NTVl9SRUNPUkRfRE9OVF9NQVRDSF9DT0xVTU5TX0xFTkdUSCcsIFtcbiAgICAgICAgICAgICAgJ0ludmFsaWQgUmVjb3JkIExlbmd0aDonLFxuICAgICAgICAgICAgICBgY29sdW1ucyBsZW5ndGggaXMgJHtjb2x1bW5zLmxlbmd0aH0sYCwgLy8gcmVuYW1lIGNvbHVtbnNcbiAgICAgICAgICAgICAgYGdvdCAke3JlY29yZExlbmd0aH0gb24gbGluZSAke3RoaXMuaW5mby5saW5lc31gLFxuICAgICAgICAgICAgXSwgdGhpcy5fX2NvbnRleHQoKSwge1xuICAgICAgICAgICAgICByZWN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T09IHRydWUgJiYgb2JqW2NvbHVtbnNbaV0ubmFtZV0pIHtcbiAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KG9ialtjb2x1bW5zW2ldLm5hbWVdKSkge1xuICAgICAgICAgICAgICBvYmpbY29sdW1uc1tpXS5uYW1lXSA9IG9ialtjb2x1bW5zW2ldLm5hbWVdLmNvbmNhdChyZWNvcmRbaV0pXG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBvYmpbY29sdW1uc1tpXS5uYW1lXSA9IFtvYmpbY29sdW1uc1tpXS5uYW1lXSwgcmVjb3JkW2ldXVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBvYmpbY29sdW1uc1tpXS5uYW1lXSA9IHJlY29yZFtpXVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBjb25zdCB7b2JqbmFtZX0gPSB0aGlzLm9wdGlvbnNcbiAgICAgICAgaWYob2JqbmFtZSA9PT0gdW5kZWZpbmVkKXtcbiAgICAgICAgICBpZihyYXcgPT09IHRydWUgfHwgaW5mbyA9PT0gdHJ1ZSl7XG4gICAgICAgICAgICBjb25zdCBlcnIgPSB0aGlzLl9fcHVzaChPYmplY3QuYXNzaWduKFxuICAgICAgICAgICAgICB7cmVjb3JkOiBvYmp9LFxuICAgICAgICAgICAgICAocmF3ID09PSB0cnVlID8ge3JhdzogdGhpcy5zdGF0ZS5yYXdCdWZmZXIudG9TdHJpbmcoKX06IHt9KSxcbiAgICAgICAgICAgICAgKGluZm8gPT09IHRydWUgPyB7aW5mbzogdGhpcy5zdGF0ZS5pbmZvfToge30pXG4gICAgICAgICAgICApKVxuICAgICAgICAgICAgaWYoZXJyKXtcbiAgICAgICAgICAgICAgcmV0dXJuIGVyclxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1lbHNle1xuICAgICAgICAgICAgY29uc3QgZXJyID0gdGhpcy5fX3B1c2gob2JqKVxuICAgICAgICAgICAgaWYoZXJyKXtcbiAgICAgICAgICAgICAgcmV0dXJuIGVyclxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfWVsc2V7XG4gICAgICAgICAgaWYocmF3ID09PSB0cnVlIHx8IGluZm8gPT09IHRydWUpe1xuICAgICAgICAgICAgY29uc3QgZXJyID0gdGhpcy5fX3B1c2goT2JqZWN0LmFzc2lnbihcbiAgICAgICAgICAgICAge3JlY29yZDogW29ialtvYmpuYW1lXSwgb2JqXX0sXG4gICAgICAgICAgICAgIHJhdyA9PT0gdHJ1ZSA/IHtyYXc6IHRoaXMuc3RhdGUucmF3QnVmZmVyLnRvU3RyaW5nKCl9OiB7fSxcbiAgICAgICAgICAgICAgaW5mbyA9PT0gdHJ1ZSA/IHtpbmZvOiB0aGlzLnN0YXRlLmluZm99OiB7fVxuICAgICAgICAgICAgKSlcbiAgICAgICAgICAgIGlmKGVycil7XG4gICAgICAgICAgICAgIHJldHVybiBlcnJcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9ZWxzZXtcbiAgICAgICAgICAgIGNvbnN0IGVyciA9IHRoaXMuX19wdXNoKFtvYmpbb2JqbmFtZV0sIG9ial0pXG4gICAgICAgICAgICBpZihlcnIpe1xuICAgICAgICAgICAgICByZXR1cm4gZXJyXG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9ZWxzZXtcbiAgICAgICAgaWYocmF3ID09PSB0cnVlIHx8IGluZm8gPT09IHRydWUpe1xuICAgICAgICAgIGNvbnN0IGVyciA9IHRoaXMuX19wdXNoKE9iamVjdC5hc3NpZ24oXG4gICAgICAgICAgICB7cmVjb3JkOiByZWNvcmR9LFxuICAgICAgICAgICAgcmF3ID09PSB0cnVlID8ge3JhdzogdGhpcy5zdGF0ZS5yYXdCdWZmZXIudG9TdHJpbmcoKX06IHt9LFxuICAgICAgICAgICAgaW5mbyA9PT0gdHJ1ZSA/IHtpbmZvOiB0aGlzLnN0YXRlLmluZm99OiB7fVxuICAgICAgICAgICkpXG4gICAgICAgICAgaWYoZXJyKXtcbiAgICAgICAgICAgIHJldHVybiBlcnJcbiAgICAgICAgICB9XG4gICAgICAgIH1lbHNle1xuICAgICAgICAgIGNvbnN0IGVyciA9IHRoaXMuX19wdXNoKHJlY29yZClcbiAgICAgICAgICBpZihlcnIpe1xuICAgICAgICAgICAgcmV0dXJuIGVyclxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgICB0aGlzLl9fcmVzZXRSb3coKVxuICB9XG4gIF9fZmlyc3RMaW5lVG9Db2x1bW5zKHJlY29yZCl7XG4gICAgY29uc3Qge2ZpcnN0TGluZVRvSGVhZGVyc30gPSB0aGlzLnN0YXRlXG4gICAgdHJ5e1xuICAgICAgY29uc3QgaGVhZGVycyA9IGZpcnN0TGluZVRvSGVhZGVycyA9PT0gdW5kZWZpbmVkID8gcmVjb3JkIDogZmlyc3RMaW5lVG9IZWFkZXJzLmNhbGwobnVsbCwgcmVjb3JkKVxuICAgICAgaWYoIUFycmF5LmlzQXJyYXkoaGVhZGVycykpe1xuICAgICAgICByZXR1cm4gdGhpcy5fX2Vycm9yKFxuICAgICAgICAgIG5ldyBDc3ZFcnJvcignQ1NWX0lOVkFMSURfQ09MVU1OX01BUFBJTkcnLCBbXG4gICAgICAgICAgICAnSW52YWxpZCBDb2x1bW4gTWFwcGluZzonLFxuICAgICAgICAgICAgJ2V4cGVjdCBhbiBhcnJheSBmcm9tIGNvbHVtbiBmdW5jdGlvbiwnLFxuICAgICAgICAgICAgYGdvdCAke0pTT04uc3RyaW5naWZ5KGhlYWRlcnMpfWBcbiAgICAgICAgICBdLCB0aGlzLl9fY29udGV4dCgpLCB7XG4gICAgICAgICAgICBoZWFkZXJzOiBoZWFkZXJzLFxuICAgICAgICAgIH0pXG4gICAgICAgIClcbiAgICAgIH1cbiAgICAgIGNvbnN0IG5vcm1hbGl6ZWRIZWFkZXJzID0gbm9ybWFsaXplQ29sdW1u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2UgMDpcbiAgICAgICAgICAgIGNhbGxiYWNrKCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAxOlxuICAgICAgICAgICAgY2FsbGJhY2soYXJnc1swXSk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAyOlxuICAgICAgICAgICAgY2FsbGJhY2soYXJnc1swXSwgYXJnc1sxXSk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgY2FzZSAzOlxuICAgICAgICAgICAgY2FsbGJhY2soYXJnc1swXSwgYXJnc1sxXSwgYXJnc1syXSk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgZGVmYXVsdDpcbiAgICAgICAgICAgIGNhbGxiYWNrLmFwcGx5KHVuZGVmaW5lZCwgYXJncyk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIHJ1bklmUHJlc2VudChoYW5kbGUpIHtcbiAgICAgICAgLy8gRnJvbSB0aGUgc3BlYzogXCJXYWl0IHVudGlsIGFueSBpbnZvY2F0aW9ucyBvZiB0aGlzIGFsZ29yaXRobSBzdGFydGVkIGJlZm9yZSB0aGlzIG9uZSBoYXZlIGNvbXBsZXRlZC5cIlxuICAgICAgICAvLyBTbyBpZiB3ZSdyZSBjdXJyZW50bHkgcnVubmluZyBhIHRhc2ssIHdlJ2xsIG5lZWQgdG8gZGVsYXkgdGhpcyBpbnZvY2F0aW9uLlxuICAgICAgICBpZiAoY3VycmVudGx5UnVubmluZ0FUYXNrKSB7XG4gICAgICAgICAgICAvLyBEZWxheSBieSBkb2luZyBhIHNldFRpbWVvdXQuIHNldEltbWVkaWF0ZSB3YXMgdHJpZWQgaW5zdGVhZCwgYnV0IGluIEZpcmVmb3ggNyBpdCBnZW5lcmF0ZWQgYVxuICAgICAgICAgICAgLy8gXCJ0b28gbXVjaCByZWN1cnNpb25cIiBlcnJvci5cbiAgICAgICAgICAgIHNldFRpbWVvdXQocnVuS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LyAgIGNvbnRlbnQ6ICcnLFxuICAgIC8vICAgZXhjZXJwdDogJycsXG4gICAgLy8gICBzdGF0dXM6ICdwdWJsaXNoJyxcbiAgICAvLyAgIG1ldGE6IHsgc2t1OiAnYXNkZicsIHByb2R1Y3RfdHlwZTogJ3NpbXBsZScsIHBpYzogJzEyNDUyMzY0JyB9LFxuICAgIC8vIH0pLFxuICB9KVxuICAgIC50aGVuKHJlc3BvbnNlID0+IHJlc3BvbnNlLmpzb24oKS50aGVuKGNvbnNvbGUubG9nKSlcbiAgICAuY2F0Y2goY29uc29sZS5sb2cpO1xufVxuXG4vLyBUaGlzIGlzIG5vdCB1c2VkLCB3YXMgcGFydCBvZiBhbiBvbGQgbWV0aG9kIEkgd2FzIHRyeWluZyB0byBkbyB3aXRoIHZhcmlhdGlvbnMgYW5kIG5vdyBJJ20gdG9vIHNjYXJlZCB0byBkZWxldGUgaXQgYWxsXG5mdW5jdGlvbiBpbmNyZW1lbnRQcm9ncmVzcyhlbG0pIHtcbiAgcmV0dXJuIGVsbTtcbn1cblxuZXhwb3J0IHsgZmV0Y2hlciwgcmVhZEZpbGVQcm9taXNlLCB0ZXN0Q2FsbCwgaW5jcmVtZW50UHJvZ3Jlc3MgfTtcbiIsIi8qIChpZ25vcmVkKSAqLyIsIi8qIChpZ25vcmVkKSAqLyJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/dist/scripts/fields.js b/dist/scripts/fields.js index 868890a..df733e3 100644 --- a/dist/scripts/fields.js +++ b/dist/scripts/fields.js @@ -1 +1,153 @@ -!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=42)}({0:function(t,e,r){"use strict";r.r(e),r.d(e,"f",(function(){return n}));var n={type:"Type",name:"Name",sku:"SKU",pic:"PIC",cat:"tax:product_cat",tag:"tax:product_tag",desc:"Description",short_desc:"Short Description",visibility:"Visibility in catalog",package:"Package",title:"Title",attr:"Attributes",model:"Model",skus:"SKUs",prod_info:"Product Info",image:"Image",indent:"Indention",warrantyList:"Warranty List",warrantyBody:"Warranty Body",orderInfo:"Ordering Information",feats:"Product Features",related:"Related Products",indict:"Indications",downs:"Downloads",main_model:"Main Model",pnf:"In Part Number Finder",searchWeight:"Search Weight",region:"Region Lock"}},42:function(t,e,r){t.exports=r(0)}}); \ No newline at end of file +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 3); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./src/scripts/fields.js": +/*!*******************************!*\ + !*** ./src/scripts/fields.js ***! + \*******************************/ +/*! exports provided: f */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return f; }); +// Globals to define spreadsheet column names, +// in case something is changed later. +var f = { + type: 'Type', + name: 'Name', + sku: 'SKU', + pic: 'PIC', + cat: 'tax:product_cat', + tag: 'tax:product_tag', + desc: 'Description', + short_desc: 'Short Description', + visibility: 'Visibility in catalog', + package: 'Package', + title: 'Title', + // Used in packages + attr: 'Attributes', + // Used in packages + model: 'Model', + // Used in packages + skus: 'SKUs', + // Used in packages + prod_info: 'Product Info', + // Used in packages + image: 'Image', + indent: 'Indention', + warrantyList: 'Warranty List', + warrantyBody: 'Warranty Body', + orderInfo: 'Ordering Information', + feats: 'Product Features', + related: 'Related Products', + indict: 'Indications', + downs: 'Downloads', + main_model: 'Main Model', + pnf: 'In Part Number Finder', + searchWeight: 'Search Weight', + region: 'Region Lock' +}; + + +/***/ }), + +/***/ 3: +/*!*************************************!*\ + !*** multi ./src/scripts/fields.js ***! + \*************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! /Users/jim/Local Sites/Fillauer/Importer/src/scripts/fields.js */"./src/scripts/fields.js"); + + +/***/ }) + +/******/ }); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vc3JjL3NjcmlwdHMvZmllbGRzLmpzIl0sIm5hbWVzIjpbImYiLCJ0eXBlIiwibmFtZSIsInNrdSIsInBpYyIsImNhdCIsInRhZyIsImRlc2MiLCJzaG9ydF9kZXNjIiwidmlzaWJpbGl0eSIsInBhY2thZ2UiLCJ0aXRsZSIsImF0dHIiLCJtb2RlbCIsInNrdXMiLCJwcm9kX2luZm8iLCJpbWFnZ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XNcbiAgYXR0cjogJ0F0dHJpYnV0ZXMnLCAvLyBVc2VkIGluIHBhY2thZ2VzXG4gIG1vZGVsOiAnTW9kZWwnLCAvLyBVc2VkIGluIHBhY2thZ2VzXG4gIHNrdXM6ICdTS1VzJywgLy8gVXNlZCBpbiBwYWNrYWdlc1xuICBwcm9kX2luZm86ICdQcm9kdWN0IEluZm8nLCAvLyBVc2VkIGluIHBhY2thZ2VzXG4gIGltYWdlOiAnSW1hZ2UnLFxuICBpbmRlbnQ6ICdJbmRlbnRpb24nLFxuICB3YXJyYW50eUxpc3Q6ICdXYXJyYW50eSBMaXN0JyxcbiAgd2FycmFudHlCb2R5OiAnV2FycmFudHkgQm9keScsXG4gIG9yZGVySW5mbzogJ09yZGVyaW5nIEluZm9ybWF0aW9uJyxcbiAgZmVhdHM6ICdQcm9kdWN0IEZlYXR1cmVzJyxcbiAgcmVsYXRlZDogJ1JlbGF0ZWQgUHJvZHVjdHMnLFxuICBpbmRpY3Q6ICdJbmRpY2F0aW9ucycsXG4gIGRvd25zOiAnRG93bmxvYWRzJyxcbiAgbWFpbl9tb2RlbDogJ01haW4gTW9kZWwnLFxuICBwbmY6ICdJbiBQYXJ0IE51bWJlciBGaW5kZXInLFxuICBzZWFyY2hXZWlnaHQ6ICdTZWFyY2ggV2VpZ2h0JyxcbiAgcmVnaW9uOiAnUmVnaW9uIExvY2snLFxufTtcblxuZXhwb3J0IHsgZiB9O1xuIl0sInNvdXJjZVJvb3QiOiIifQ== \ No newline at end of file diff --git a/dist/scripts/filters.js b/dist/scripts/filters.js index 818acff..7a4385d 100644 --- a/dist/scripts/filters.js +++ b/dist/scripts/filters.js @@ -1,4 +1,599 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=43)}({0:function(e,t,n){"use strict";n.r(t),n.d(t,"f",(function(){return r}));var r={type:"Type",name:"Name",sku:"SKU",pic:"PIC",cat:"tax:product_cat",tag:"tax:product_tag",desc:"Description",short_desc:"Short Description",visibility:"Visibility in catalog",package:"Package",title:"Title",attr:"Attributes",model:"Model",skus:"SKUs",prod_info:"Product Info",image:"Image",indent:"Indention",warrantyList:"Warranty List",warrantyBody:"Warranty Body",orderInfo:"Ordering Information",feats:"Product Features",related:"Related Products",indict:"Indications",downs:"Downloads",main_model:"Main Model",pnf:"In Part Number Finder",searchWeight:"Search Weight",region:"Region Lock"}},1:function(e,t,n){"use strict";n.r(t),n.d(t,"findSpecBounds",(function(){return s})),n.d(t,"findSpecIcons",(function(){return f})),n.d(t,"computeChecksum",(function(){return c})),n.d(t,"filterExisting",(function(){return l})),n.d(t,"compareHashesForPayload",(function(){return d})),n.d(t,"keyByPIC",(function(){return p})),n.d(t,"linkVariations",(function(){return g})),n.d(t,"linkPackages",(function(){return y})),n.d(t,"verifyFields",(function(){return m})),n.d(t,"verifyFiles",(function(){return w})),n.d(t,"buildSpec",(function(){return b})),n.d(t,"variationSlice",(function(){return v}));var r=n(0),o=n(14),i=n.n(o);function u(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]&&arguments[2];if(!t)return[[],Object.keys(e)];var r=[],o=[],i=[],u=Object.keys(e),a=0;return u.forEach((function(r){t[r]?n||t[r].checksum!==e[r].checksum?(t[r].pic=r,i.push(t[r])):a++:o.push(r)})),console.log("Creating : ".concat(o.length)),console.log("Updating : ".concat(i.length)),console.log("Ignoring: ".concat(a)),[r,o,i]}function p(e){var t={};return e.map((function(e){return!!e&&(t[e[r.f.pic]]||(t[e[r.f.pic]]=[]),t[e[r.f.pic]]=e,e)})),t}function h(e){if(!e)return[];var t=e.split(",").map((function(e){return e.trim()}));return""!==t[0]&&t}function g(e,t){return Object.values(e).map((function(t){e[t[r.f.pic]].variations=[],"simple"===t[r.f.type]&&e[t[r.f.pic]].variations.push({name:t[r.f.name],sku:t[r.f.sku],specs:t.specs})})),t.map((function(t){if(void 0===e[t[r.f.pic]])return!1;var n=e[t[r.f.pic]].variations.push({name:t[r.f.name],sku:t[r.f.sku],specs:t.specs});t[r.f.image]&&(e[t[r.f.pic]].variations[n-1].image=t[r.f.image],console.log("has image")),t[r.f.indent]&&(e[t[r.f.pic]].variations[n-1].indent=t[r.f.indent]),t[r.f.package]&&(e[t[r.f.pic]].variations[n-1].package=t[r.f.package])})),e}function y(e,t){var n,o,i;return o={},i=(n=t)[0].splice(1),n.splice(1).map((function(e){var t=e[0];void 0!==o[t]&&window.alert("Conflicting package ID's found: ".concat(t)),o[t]={},e.splice(1).map((function(e,n){o[t][i[n]]=e})),o[t][r.f.attr]=h(o[t][r.f.attr]),o[t][r.f.skus]=h(o[t][r.f.skus])})),t=o,Object.values(e).map((function(n){var o={};o.drop={label:"", -//! This should pull from PIC by controller -pic:n[r.f.pic],model:"B",skus:[],specs:[],product_info:["name","description","image"]},n.variations&&n.variations.map((function(e){void 0!==e.package?(o[e.package]||(o[e.package]={label:e.package,pic:n[r.f.pic],model:"B",skus:[],specs:[],product_info:[]},"list"===e.package&&(o[e.package].model="A",o[e.package].label="",//! PIC's name if on another product -o[e.package].product_info=["name","description","image"])),e.image&&(o[e.package].model="C"),console.log(n[r.f.name],e.package),o[e.package].skus.push(e.sku)):e.image?(o.varyImage||(o.varyImage={label:"",pic:n[r.f.pic],skus:[],specs:[],model:"C",product_info:["name","description","image"]}),o.varyImage.skus.push(e.sku)):o.drop.skus.push(e.sku)})),0===o.drop.skus.length&&delete o.drop,n[r.f.package]&&n[r.f.package].split(",").map((function(e){var n;(e=e.trim(),t[e][r.f.title]&o[t[e][r.f.title]]?(o["custom"+e]=o[t[e][r.f.title]],delete o[t[e][r.f.title]]):o["custom"+e]={label:"",pic:"",skus:[],model:"B",specs:[],product_info:[]},t[e][r.f.image]&&(o["custom"+e].model="D",o["custom"+e].image=t[e][r.f.image]),t[e][r.f.pic]&&(o["custom"+e].pic=t[e][r.f.pic]),t[e][r.f.skus])&&(n=o["custom"+e].skus).push.apply(n,u(t[e][r.f.skus]));t[e][r.f.attr]&&(o["custom"+e].specs=t[e][r.f.attr]),t[e][r.f.title]?o["custom"+e].label=t[e][r.f.title]:o["custom"+e].product_info=["name","description","image"],t[e][r.f.prod_info]&&(o["custom"+e].product_info=t[e][r.f.prod_info].split(",").map((function(e){return e.trim()}))),t[e][r.f.model]&&(o["custom"+e].model=t[e][r.f.model])})),e[n[r.f.pic]].packages=o})),e}function m(e){return e}function w(e,t,n){return void 0===e?(window.alert("Specify a parent product file first"),!1):void 0===t?(window.alert("Specify a variations file first"),!1):void 0!==n||(window.alert("Specify a package file first"),!1)}function b(e,t,n,r,o){if(e>16),c((65280&o)>>8),c(255&o);return 2==i?c(255&(o=f(e.charAt(n))<<2|f(e.charAt(n+1))>>4)):1==i&&(c((o=f(e.charAt(n))<<10|f(e.charAt(n+1))<<4|f(e.charAt(n+2))>>2)>>8&255),c(255&o)),u},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function a(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t>18&63)+a(o>>12&63)+a(o>>6&63)+a(63&o);switch(i){case 1:u+=a((n=e[e.length-1])>>2),u+=a(n<<4&63),u+="==";break;case 2:u+=a((n=(e[e.length-2]<<8)+e[e.length-1])>>10),u+=a(n>>4&63),u+=a(n<<2&63),u+="="}return u}}(void 0===n?this.base64js={}:n)}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(e,t,n){(function(t,r,o,i,u,a,s,f,c){var l=e("base64-js"),d=e("ieee754");function o(e,t,n){if(!(this instanceof o))return new o(e,t,n);var r,i,u,a,s,f=typeof e;if("base64"===t&&"string"==f)for(e=(r=e).trim?r.trim():r.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==f)i=L(e);else if("string"==f)i=o.byteLength(e,t);else{if("object"!=f)throw new Error("First argument needs to be a number, array or string.");i=L(e.length)}if(o._useTypedArrays?u=o._augment(new Uint8Array(i)):((u=this).length=i,u._isBuffer=!0),o._useTypedArrays&&"number"==typeof e.byteLength)u._set(e);else if(U(s=e)||o.isBuffer(s)||s&&"object"==typeof s&&"number"==typeof s.length)for(a=0;a>>0)):(t+1>>0),o}function m(e,t,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=t,"missing offset"),D(t+1>>8*(r?u:1-u)}function I(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3>>8*(r?u:3-u)&255}function E(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1>8,r=t%256,o.push(r),o.push(n);return o}(t),e,n,r)}(this,e,t,n);break;default:throw new Error("Unknown encoding")}return u},o.prototype.toString=function(e,t,n){var r,o,i,u,a=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,(n=void 0!==n?Number(n):n=a.length)===t)return"";switch(e){case"hex":r=function(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||rthis.length&&(r=this.length),e.length-t=this.length))return this[e]},o.prototype.readUInt16LE=function(e,t){return g(this,e,!0,t)},o.prototype.readUInt16BE=function(e,t){return g(this,e,!1,t)},o.prototype.readUInt32LE=function(e,t){return y(this,e,!0,t)},o.prototype.readUInt32BE=function(e,t){return y(this,e,!1,t)},o.prototype.readInt8=function(e,t){if(t||(D(null!=e,"missing offset"),D(e=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){return m(this,e,!0,t)},o.prototype.readInt16BE=function(e,t){return m(this,e,!1,t)},o.prototype.readInt32LE=function(e,t){return w(this,e,!0,t)},o.prototype.readInt32BE=function(e,t){return w(this,e,!1,t)},o.prototype.readFloatLE=function(e,t){return b(this,e,!0,t)},o.prototype.readFloatBE=function(e,t){return b(this,e,!1,t)},o.prototype.readDoubleLE=function(e,t){return v(this,e,!0,t)},o.prototype.readDoubleBE=function(e,t){return v(this,e,!1,t)},o.prototype.writeUInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(this[t]=e)},o.prototype.writeUInt16LE=function(e,t,n){_(this,e,t,!0,n)},o.prototype.writeUInt16BE=function(e,t,n){_(this,e,t,!1,n)},o.prototype.writeUInt32LE=function(e,t,n){I(this,e,t,!0,n)},o.prototype.writeUInt32BE=function(e,t,n){I(this,e,t,!1,n)},o.prototype.writeInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},o.prototype.writeInt16LE=function(e,t,n){E(this,e,t,!0,n)},o.prototype.writeInt16BE=function(e,t,n){E(this,e,t,!1,n)},o.prototype.writeInt32LE=function(e,t,n){A(this,e,t,!0,n)},o.prototype.writeInt32BE=function(e,t,n){A(this,e,t,!1,n)},o.prototype.writeFloatLE=function(e,t,n){k(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){k(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){B(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){B(this,e,t,!1,n)},o.prototype.fill=function(e,t,n){if(e=e||0,t=t||0,n=n||this.length,"string"==typeof e&&(e=e.charCodeAt(0)),D("number"==typeof e&&!isNaN(e),"value is not a number"),D(t<=n,"end < start"),n!==t&&0!==this.length){D(0<=t&&t"},o.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(o._useTypedArrays)return new o(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function O(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function N(e,t){D("number"==typeof e,"cannot write a non-number as a number"),D(0<=e,"specified a negative value for writing an unsigned value"),D(e<=t,"value is larger than maximum value for type"),D(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value"),D(Math.floor(e)===e,"value has a fractional component")}function Y(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value")}function D(e,t){if(!e)throw new Error(t||"Failed assertion")}o._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=S.get,e.set=S.set,e.write=S.write,e.toString=S.toString,e.toLocaleString=S.toString,e.toJSON=S.toJSON,e.copy=S.copy,e.slice=S.slice,e.readUInt8=S.readUInt8,e.readUInt16LE=S.readUInt16LE,e.readUInt16BE=S.readUInt16BE,e.readUInt32LE=S.readUInt32LE,e.readUInt32BE=S.readUInt32BE,e.readInt8=S.readInt8,e.readInt16LE=S.readInt16LE,e.readInt16BE=S.readInt16BE,e.readInt32LE=S.readInt32LE,e.readInt32BE=S.readInt32BE,e.readFloatLE=S.readFloatLE,e.readFloatBE=S.readFloatBE,e.readDoubleLE=S.readDoubleLE,e.readDoubleBE=S.readDoubleBE,e.writeUInt8=S.writeUInt8,e.writeUInt16LE=S.writeUInt16LE,e.writeUInt16BE=S.writeUInt16BE,e.writeUInt32LE=S.writeUInt32LE,e.writeUInt32BE=S.writeUInt32BE,e.writeInt8=S.writeInt8,e.writeInt16LE=S.writeInt16LE,e.writeInt16BE=S.writeInt16BE,e.writeInt32LE=S.writeInt32LE,e.writeInt32BE=S.writeInt32BE,e.writeFloatLE=S.writeFloatLE,e.writeFloatBE=S.writeFloatBE,e.writeDoubleLE=S.writeDoubleLE,e.writeDoubleBE=S.writeDoubleBE,e.fill=S.fill,e.inspect=S.inspect,e.toArrayBuffer=S.toArrayBuffer,e}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(e,t,n){(function(n,r,o,i,u,a,s,f,c){var l=new(o=e("buffer").Buffer)(4);l.fill(0),t.exports={hash:function(e,t,n,r){return o.isBuffer(e)||(e=new o(e)),function(e,t,n){for(var r=new o(t),i=n?r.writeInt32BE:r.writeInt32LE,u=0;ug?t=e(t):t.length>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u>>32-a,n);var u,a}function h(e,t,n,r,o,i,u){return p(t&n|~t&r,e,t,o,i,u)}function g(e,t,n,r,o,i,u){return p(t&r|n&~r,e,t,o,i,u)}function y(e,t,n,r,o,i,u){return p(t^n^r,e,t,o,i,u)}function m(e,t,n,r,o,i,u){return p(n^(t|~r),e,t,o,i,u)}function w(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}t.exports=function(e){return l.hash(e,d,16)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(e,t,n){(function(e,n,r,o,i,u,a,s,f){var c;c=function(e){for(var t,n=new Array(e),r=0;r>>((3&r)<<3)&255;return n},t.exports=c}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(e,t,n){(function(n,r,o,i,u,a,s,f,c){var l=e("./helpers");function d(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n,r=Array(80),o=1732584193,i=-271733879,u=-1732584194,a=271733878,s=-1009589776,f=0;f>16)+(t>>16)+(n>>16)<<16|65535&n}function g(e,t){return e<>>32-t}t.exports=function(e){return l.hash(e,d,20,!0)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(e,t,n){(function(n,r,o,i,u,a,s,f,c){function l(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function d(e,t){return e>>>t|e<<32-t}function p(e,t){return e>>>t}function h(e,t){var n,r,o,i,u,a,s,f,c,h,g,y,m,w,b,v,_,I,E=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),A=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),k=new Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var B=0;B>1,c=-7,l=n?o-1:0,d=n?-1:1,p=e[t+l];for(l+=d,i=p&(1<<-c)-1,p>>=-c,c+=a;0>=-c,c+=r;0>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,u=c):(u=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-u))<1&&(u--,s*=2),2<=(t+=1<=u+l?d/s:d*Math.pow(2,1-l))*s&&(u++,s/=2),c<=u+l?(a=0,u=c):1<=u+l?(a=(t*s-1)*Math.pow(2,o),u+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,o),u=0));8<=o;e[n+p]=255&a,p+=h,a/=256,o-=8);for(u=u<>16),s((65280&r)>>8),s(255&r);return 2==o?s(255&(r=c(e.charAt(t))<<2|c(e.charAt(t+1))>>4)):1==o&&(s((r=c(e.charAt(t))<<10|c(e.charAt(t+1))<<4|c(e.charAt(t+2))>>2)>>8&255),s(255&r)),i},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function a(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t>18&63)+a(o>>12&63)+a(o>>6&63)+a(63&o);switch(i){case 1:u+=a((n=e[e.length-1])>>2),u+=a(n<<4&63),u+="==";break;case 2:u+=a((n=(e[e.length-2]<<8)+e[e.length-1])>>10),u+=a(n>>4&63),u+=a(n<<2&63),u+="="}return u}}(void 0===f?this.base64js={}:f)}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(O,e,H){(function(e,t,h,n,r,o,i,u,a){var s=O("base64-js"),f=O("ieee754");function h(e,t,n){if(!(this instanceof h))return new h(e,t,n);var r,o,i,u,a,s=typeof e;if("base64"===t&&"string"==s)for(e=(r=e).trim?r.trim():r.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==s)o=x(e);else if("string"==s)o=h.byteLength(e,t);else{if("object"!=s)throw new Error("First argument needs to be a number, array or string.");o=x(e.length)}if(h._useTypedArrays?i=h._augment(new Uint8Array(o)):((i=this).length=o,i._isBuffer=!0),h._useTypedArrays&&"number"==typeof e.byteLength)i._set(e);else if(S(a=e)||h.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length)for(u=0;u>8,r=t%256,o.push(r),o.push(n);return o}(t),e,n,r)}function c(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o>>0)):(t+1>>0),o}function y(e,t,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=t,"missing offset"),D(t+1>>8*(r?u:1-u)}function _(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3>>8*(r?u:3-u)&255}function E(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1this.length&&(r=this.length),e.length-t=this.length))return this[e]},h.prototype.readUInt16LE=function(e,t){return l(this,e,!0,t)},h.prototype.readUInt16BE=function(e,t){return l(this,e,!1,t)},h.prototype.readUInt32LE=function(e,t){return d(this,e,!0,t)},h.prototype.readUInt32BE=function(e,t){return d(this,e,!1,t)},h.prototype.readInt8=function(e,t){if(t||(D(null!=e,"missing offset"),D(e=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){return y(this,e,!0,t)},h.prototype.readInt16BE=function(e,t){return y(this,e,!1,t)},h.prototype.readInt32LE=function(e,t){return w(this,e,!0,t)},h.prototype.readInt32BE=function(e,t){return w(this,e,!1,t)},h.prototype.readFloatLE=function(e,t){return b(this,e,!0,t)},h.prototype.readFloatBE=function(e,t){return b(this,e,!1,t)},h.prototype.readDoubleLE=function(e,t){return m(this,e,!0,t)},h.prototype.readDoubleBE=function(e,t){return m(this,e,!1,t)},h.prototype.writeUInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(this[t]=e)},h.prototype.writeUInt16LE=function(e,t,n){v(this,e,t,!0,n)},h.prototype.writeUInt16BE=function(e,t,n){v(this,e,t,!1,n)},h.prototype.writeUInt32LE=function(e,t,n){_(this,e,t,!0,n)},h.prototype.writeUInt32BE=function(e,t,n){_(this,e,t,!1,n)},h.prototype.writeInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},h.prototype.writeInt16LE=function(e,t,n){E(this,e,t,!0,n)},h.prototype.writeInt16BE=function(e,t,n){E(this,e,t,!1,n)},h.prototype.writeInt32LE=function(e,t,n){I(this,e,t,!0,n)},h.prototype.writeInt32BE=function(e,t,n){I(this,e,t,!1,n)},h.prototype.writeFloatLE=function(e,t,n){A(this,e,t,!0,n)},h.prototype.writeFloatBE=function(e,t,n){A(this,e,t,!1,n)},h.prototype.writeDoubleLE=function(e,t,n){B(this,e,t,!0,n)},h.prototype.writeDoubleBE=function(e,t,n){B(this,e,t,!1,n)},h.prototype.fill=function(e,t,n){if(e=e||0,t=t||0,n=n||this.length,"string"==typeof e&&(e=e.charCodeAt(0)),D("number"==typeof e&&!isNaN(e),"value is not a number"),D(t<=n,"end < start"),n!==t&&0!==this.length){D(0<=t&&t"},h.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(h._useTypedArrays)return new h(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function M(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function N(e,t){D("number"==typeof e,"cannot write a non-number as a number"),D(0<=e,"specified a negative value for writing an unsigned value"),D(e<=t,"value is larger than maximum value for type"),D(Math.floor(e)===e,"value has a fractional component")}function Y(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value"),D(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value")}function D(e,t){if(!e)throw new Error(t||"Failed assertion")}h._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=L.get,e.set=L.set,e.write=L.write,e.toString=L.toString,e.toLocaleString=L.toString,e.toJSON=L.toJSON,e.copy=L.copy,e.slice=L.slice,e.readUInt8=L.readUInt8,e.readUInt16LE=L.readUInt16LE,e.readUInt16BE=L.readUInt16BE,e.readUInt32LE=L.readUInt32LE,e.readUInt32BE=L.readUInt32BE,e.readInt8=L.readInt8,e.readInt16LE=L.readInt16LE,e.readInt16BE=L.readInt16BE,e.readInt32LE=L.readInt32LE,e.readInt32BE=L.readInt32BE,e.readFloatLE=L.readFloatLE,e.readFloatBE=L.readFloatBE,e.readDoubleLE=L.readDoubleLE,e.readDoubleBE=L.readDoubleBE,e.writeUInt8=L.writeUInt8,e.writeUInt16LE=L.writeUInt16LE,e.writeUInt16BE=L.writeUInt16BE,e.writeUInt32LE=L.writeUInt32LE,e.writeUInt32BE=L.writeUInt32BE,e.writeInt8=L.writeInt8,e.writeInt16LE=L.writeInt16LE,e.writeInt16BE=L.writeInt16BE,e.writeInt32LE=L.writeInt32LE,e.writeInt32BE=L.writeInt32BE,e.writeFloatLE=L.writeFloatLE,e.writeFloatBE=L.writeFloatBE,e.writeDoubleLE=L.writeDoubleLE,e.writeDoubleBE=L.writeDoubleBE,e.fill=L.fill,e.inspect=L.inspect,e.toArrayBuffer=L.toArrayBuffer,e}}).call(this,O("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},O("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(l,d,e){(function(e,t,u,n,r,o,i,a,s){u=l("buffer").Buffer;var f=4,c=new u(f);c.fill(0);d.exports={hash:function(e,t,n,r){return u.isBuffer(e)||(e=new u(e)),function(e,t,n){for(var r=new u(t),o=n?r.writeInt32BE:r.writeInt32LE,i=0;ih?t=e(t):t.length>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u>>32-a,n);var u,a}function d(e,t,n,r,o,i,u){return l(t&n|~t&r,e,t,o,i,u)}function h(e,t,n,r,o,i,u){return l(t&r|n&~r,e,t,o,i,u)}function p(e,t,n,r,o,i,u){return l(t^n^r,e,t,o,i,u)}function g(e,t,n,r,o,i,u){return l(n^(t|~r),e,t,o,i,u)}function y(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}b.exports=function(e){return f.hash(e,c,16)}}).call(this,w("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},w("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(e,l,t){(function(e,t,n,r,o,i,u,a,s){var f,c;f=function(e){for(var t,n=new Array(e),r=0;r>>((3&r)<<3)&255;return n},l.exports=c||f}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(l,d,e){(function(e,t,n,r,o,i,u,a,s){var f=l("./helpers");function c(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n,r=Array(80),o=1732584193,i=-271733879,u=-1732584194,a=271733878,s=-1009589776,f=0;f>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t){return e<>>32-t}d.exports=function(e){return f.hash(e,c,20,!0)}}).call(this,l("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},l("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(l,d,e){(function(e,t,n,r,o,i,u,a,s){function B(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function L(e,t){return e>>>t|e<<32-t}function U(e,t){return e>>>t}function f(e,t){var n,r,o,i,u,a,s,f,c,l,d,h,p,g,y,w,b,m,v=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),_=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),E=new Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var I=0;I>1,c=-7,l=n?o-1:0,d=n?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-c)-1,h>>=-c,c+=a;0>=-c,c+=r;0>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,u=c):(u=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-u))<1&&(u--,s*=2),2<=(t+=1<=u+l?d/s:d*Math.pow(2,1-l))*s&&(u++,s/=2),c<=u+l?(a=0,u=c):1<=u+l?(a=(t*s-1)*Math.pow(2,o),u+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,o),u=0));8<=o;e[n+h]=255&a,h+=p,a/=256,o-=8);for(u=u< arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + + + // The attribute column right before specifications start + +var b_SpecsStart = 'Specification Start'; +var b_SpecsEnd = 'Specification End'; + +function findSpecBounds(attrRow) { + var started = false; + return attrRow.map(function (val, ind) { + if (val === b_SpecsStart) { + started = true; + return ind; + } + + if (val === b_SpecsEnd && started) { + return ind; + } + + return false; + }).filter(function (val) { + if (false !== val) return true; // I know this looks silly, but what if val == 0? + }); +} + +function findSpecIcons(attrRow, row) { + var icons = {}; + + if (!row.includes('ICON')) { + window.alert('Are you sure your defining specification icons?'); + } + + row.map(function (val, ind) { + if ('' !== val && 'ICON' !== val) { + icons[attrRow[ind]] = val; + } + }); + return icons; +} + +function computeChecksum(prods) { + Object.values(prods).map(function (prod) { + prods[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].checksum = object_hash__WEBPACK_IMPORTED_MODULE_1___default()(prod); + }); + console.log('HASHed', prods); + return prods; +} + +function filterExisting(data) { + var existingHashes = {}; + data.forEach(function (WPprod) { + try { + existingHashes[WPprod.meta.PIC[0]] = { + id: WPprod.id, + checksum: String(WPprod.meta.product_hash[0]) + }; + } catch (_unused) { + console.log("ID:".concat(WPprod.id, " is not a legitimate product :(")); + } + }); + return existingHashes; +} + +function compareHashesForPayload(newProds, existing) { + var forcing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + if (!existing) return [[], Object.keys(newProds)]; + var toDelete = []; + var toPost = []; + var toUpdate = []; + var newPics = Object.keys(newProds); + var ignoringN = 0; // Ugh, just redo it + + newPics.forEach(function (pic) { + if (!existing[pic]) { + // Create new products + toPost.push(pic); + } else if (forcing || existing[pic].checksum !== newProds[pic].checksum) { + // Update existing products + existing[pic].pic = pic; // Lol + + toUpdate.push(existing[pic]); + } else { + // Ignore unchanged products, we're just incrementing a counter for stats + ignoringN++; + } // else, this product has not been updated + + }); + console.log("Creating : ".concat(toPost.length)); + console.log("Updating : ".concat(toUpdate.length)); + console.log("Ignoring: ".concat(ignoringN)); + return [toDelete, toPost, toUpdate]; +} + +function keyByPIC(prods) { + var ProdByPIC = {}; + prods.map(function (val) { + if (!val) { + return false; + } + + if (!ProdByPIC[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]]) { + ProdByPIC[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]] = []; + } + + ProdByPIC[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]] = val; + return val; + }); + return ProdByPIC; +} + +function splitAndVerify(commaSeparated) { + if (!commaSeparated) return []; + var rv = commaSeparated.split(',').map(function (val) { + return val.trim(); + }); + + if ('' === rv[0]) { + return false; + } + + return rv; +} + +function buildPackageObj(packages) { + var rv = {}; + var attr = packages[0].splice(1); // Ignore ID field since the rows are spliced too + + packages.splice(1).map(function (row) { + var id = row[0]; + + if (undefined !== rv[id]) { + window.alert("Conflicting package ID's found: ".concat(id)); + } + + rv[id] = {}; + row.splice(1).map(function (val, ind) { + rv[id][attr[ind]] = val; + }); + rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr] = splitAndVerify(rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr]); + rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus] = splitAndVerify(rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus]); + }); + return rv; +} + +function linkVariations(parents, varies) { + // Give all parents an array first, and if prod.type is simple, + // copy the sku and name to make a basic variation + Object.values(parents).map(function (prod) { + parents[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations = []; + + if ('simple' === prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].type]) { + parents[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations.push({ + name: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].name], + sku: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].sku], + specs: prod.specs + }); + } + }); + varies.map(function (val) { + if (undefined === parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]]) return false; + var varN = parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations.push({ + name: val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].name], + sku: val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].sku], + specs: val.specs // This is too heavy optimizeVariations transforms later + + }); // Undefined is better for payload size + + if (val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]) { + parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations[varN - 1].image = val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]; + console.log('has image'); + } + + ; + + if (val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].indent]) { + parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations[varN - 1].indent = val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].indent]; + } + + ; + + if (val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package]) { + parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations[varN - 1].package = val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package]; + } + + ; + }); + return parents; +} + +function linkPackages(parents, packs) { + packs = buildPackageObj(packs); // Learn what you can from just variations + + Object.values(parents).map(function (prod) { + var packages = {}; // Default package + + packages.drop = { + label: '', + //! This should pull from PIC by controller + pic: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic], + model: 'B', + skus: [], + specs: [], + // This needs to be pulled from varying attributes + product_info: ['name', 'description', 'image'] + }; + + if (prod.variations) { + prod.variations.map(function (vary) { + if (undefined !== vary.package) { + // Variation specifies a package to be in + // see if that package exists first + if (!packages[vary.package]) { + packages[vary.package] = { + // Base package template + label: vary.package, + pic: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic], + model: 'B', + skus: [], + specs: [], + // Defined by pack sheet below + product_info: [] // Defined by pack sheet below + + }; // if this is a 'list' package, ensure model A + + if ('list' === vary.package) { + packages[vary.package].model = 'A'; + packages[vary.package].label = ''; //! PIC's name if on another product + + packages[vary.package].product_info = ['name', 'description', 'image']; + } + } // If any of the variations have images, upgrade that package model. + + + if (vary.image) { + packages[vary.package].model = 'C'; // Make sure they're separate from the 'drop' first + // Any other details should be defined by pack sheet + } // Add variation to the package of its choice + + + console.log(prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].name], vary.package); + packages[vary.package].skus.push(vary.sku); // If a package name isn't specified but the variation still uses an image, use a blank package name, similar to 'drop' + } else if (vary.image) { + // Check if there already isn't a package for unlabeled packages of variation images. + if (!packages.varyImage) { + packages.varyImage = { + label: '', + pic: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic], + skus: [], + specs: [], + model: 'C', + product_info: ['name', 'description', 'image'] + }; + } + + packages.varyImage.skus.push(vary.sku); + } else { + packages.drop.skus.push(vary.sku); + } + }); + } // Remove default if every variation found a package + + + if (0 === packages.drop.skus.length) { + delete packages.drop; + } // Now apply the package file for more packages and specs + // All packages must have names by now, otherwise the variations wouldn't be able to save or they would be put in 'drop' + + + if (prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package]) { + prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package].split(',').map(function (id) { + // This is a package who's name derives from PIC + id = id.trim(); // Before making custom package, make sure the variations didn't already define it. + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title] & packages[packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]]) { + packages['custom' + id] = packages[packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]]; + delete packages[packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]]; + } else + /* Otherwise, build the new package */ + { + packages['custom' + id] = { + label: '', + pic: '', + skus: [], + model: 'B', + specs: [], + // This needs to be pulled from varying attributes + product_info: [] + }; + } // For every field that is defined by the package sheet, confirm and re-specify. + + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]) { + packages['custom' + id].model = 'D'; + packages['custom' + id].image = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]) { + packages['custom' + id].pic = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus]) { + var _packages$skus; + + (_packages$skus = packages['custom' + id].skus).push.apply(_packages$skus, _toConsumableArray(packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus])); + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr]) { + packages['custom' + id].specs = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr]; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]) { + packages['custom' + id].label = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]; + } else { + // If the title is not specified, this is a product blurb and the title and product_info should be pulled from the PIC. + packages['custom' + id].product_info = ['name', 'description', 'image']; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].prod_info]) { + packages['custom' + id].product_info = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].prod_info].split(',').map(function (val) { + return val.trim(); + }); + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].model]) { + packages['custom' + id].model = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].model]; + } + }); + } // TODO: Test with Posterior Mounting Brackets with the art of linking via label and specify specs in sheet + // TODO: nevermind, but test anyways + /// / : Confirm that the first package is the 'drop' package + // TODO: Stop using the drop package... + // if (Object.values(packages)[0] && '' !== Object.values(packages)[0].label) { + // window.alert(`${prod[f.name]} should be specifying main product variations first!`); + // } + // Packages makes up both packages implicitly defined in variations and explicitly from the sheet + + + parents[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].packages = packages; + }); + return parents; +} // confirm definition of properties that will be used in POST +// used for cleaning taxonomies for now + + +function verifyFields(prod) { + return prod; +} + +function verifyFiles(parentFileHandler, variationFileHandler, packageFileHandler) { + if (parentFileHandler === undefined) { + window.alert('Specify a parent product file first'); + return false; + } + + if (variationFileHandler === undefined) { + window.alert('Specify a variations file first'); + return false; + } + + if (packageFileHandler === undefined) { + window.alert('Specify a package file first'); + return false; + } + + return true; +} + +function buildSpec(start, end, ind, val, icon) { + if (start < ind && ind < end) { + var spec = {}; // Value + + spec.val = val.trim(); // Icon + + spec.icon = icon; // Featured or Additional + + if (val.includes('*')) { + spec.val = val.replace('*', ''); + spec.featured = true; + } else { + spec.featured = false; + } + + return spec; + } + + return false; +} + +function variationSlice(varyPack, i) { + var rv = { + varies: varyPack.varies[i], + labels: varyPack.labels + }; + return rv; +} + + + +/***/ }), + +/***/ 4: +/*!**************************************!*\ + !*** multi ./src/scripts/filters.js ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! /Users/jim/Local Sites/Fillauer/Importer/src/scripts/filters.js */"./src/scripts/filters.js"); + + +/***/ }) + +/******/ }); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vbm9kZV9tb2R1bGVzL29iamVjdC1oYXNoL2Rpc3Qvb2JqZWN0X2hhc2guanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3NjcmlwdHMvZmllbGRzLmpzIiwid2VicGFjazovLy8uL3NyYy9zY3JpcHRzL2ZpbHRlcnMuanMiXSwibmFtZXMiOlsiZiIsInR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uICAgIHNwZWMuaWNvbiA9IGljb247XG5cbiAgICAvLyBGZWF0dXJlZCBvciBBZGRpdGlvbmFsXG4gICAgaWYgKHZhbC5pbmNsdWRlcygnKicpKSB7XG4gICAgICBzcGVjLnZhbCA9IHZhbC5yZXBsYWNlKCcqJywgJycpO1xuICAgICAgc3BlYy5mZWF0dXJlZCA9IHRydWU7XG4gICAgfSBlbHNlIHtcbiAgICAgIHNwZWMuZmVhdHVyZWQgPSBmYWxzZTtcbiAgICB9XG4gICAgcmV0dXJuIHNwZWM7XG4gIH1cblxuICByZXR1cm4gZmFsc2U7XG59XG5cbmZ1bmN0aW9uIHZhcmlhdGlvblNsaWNlKHZhcnlQYWNrLCBpKSB7XG4gIGNvbnN0IHJ2ID0ge1xuICAgIHZhcmllczogdmFyeVBhY2sudmFyaWVzW2ldLFxuICAgIGxhYmVsczogdmFyeVBhY2subGFiZWxzLFxuICB9O1xuICByZXR1cm4gcnY7XG59XG5cbmV4cG9ydCB7IGZpbmRTcGVjQm91bmRzLCBmaW5kU3BlY0ljb25zLCBjb21wdXRlQ2hlY2tzdW0sIGZpbHRlckV4aXN0aW5nLCBjb21wYXJlSGFzaGVzRm9yUGF5bG9hZCwga2V5QnlQSUMsIGxpbmtWYXJpYXRpb25zLCBsaW5rUGFja2FnZXMsIHZlcmlmeUZpZWxkcywgdmVyaWZ5RmlsZXMsIGJ1aWxkU3BlYywgdmFyaWF0aW9uU2xpY2UgfTtcbiJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/dist/scripts/products.js b/dist/scripts/products.js index 9c404d0..e695bd8 100644 --- a/dist/scripts/products.js +++ b/dist/scripts/products.js @@ -1,4 +1,961 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=44)}({0:function(e,t,n){"use strict";n.r(t),n.d(t,"f",(function(){return r}));var r={type:"Type",name:"Name",sku:"SKU",pic:"PIC",cat:"tax:product_cat",tag:"tax:product_tag",desc:"Description",short_desc:"Short Description",visibility:"Visibility in catalog",package:"Package",title:"Title",attr:"Attributes",model:"Model",skus:"SKUs",prod_info:"Product Info",image:"Image",indent:"Indention",warrantyList:"Warranty List",warrantyBody:"Warranty Body",orderInfo:"Ordering Information",feats:"Product Features",related:"Related Products",indict:"Indications",downs:"Downloads",main_model:"Main Model",pnf:"In Part Number Finder",searchWeight:"Search Weight",region:"Region Lock"}},1:function(e,t,n){"use strict";n.r(t),n.d(t,"findSpecBounds",(function(){return s})),n.d(t,"findSpecIcons",(function(){return f})),n.d(t,"computeChecksum",(function(){return c})),n.d(t,"filterExisting",(function(){return l})),n.d(t,"compareHashesForPayload",(function(){return d})),n.d(t,"keyByPIC",(function(){return p})),n.d(t,"linkVariations",(function(){return g})),n.d(t,"linkPackages",(function(){return y})),n.d(t,"verifyFields",(function(){return m})),n.d(t,"verifyFiles",(function(){return b})),n.d(t,"buildSpec",(function(){return w})),n.d(t,"variationSlice",(function(){return v}));var r=n(0),o=n(14),i=n.n(o);function a(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]&&arguments[2];if(!t)return[[],Object.keys(e)];var r=[],o=[],i=[],a=Object.keys(e),u=0;return a.forEach((function(r){t[r]?n||t[r].checksum!==e[r].checksum?(t[r].pic=r,i.push(t[r])):u++:o.push(r)})),console.log("Creating : ".concat(o.length)),console.log("Updating : ".concat(i.length)),console.log("Ignoring: ".concat(u)),[r,o,i]}function p(e){var t={};return e.map((function(e){return!!e&&(t[e[r.f.pic]]||(t[e[r.f.pic]]=[]),t[e[r.f.pic]]=e,e)})),t}function h(e){if(!e)return[];var t=e.split(",").map((function(e){return e.trim()}));return""!==t[0]&&t}function g(e,t){return Object.values(e).map((function(t){e[t[r.f.pic]].variations=[],"simple"===t[r.f.type]&&e[t[r.f.pic]].variations.push({name:t[r.f.name],sku:t[r.f.sku],specs:t.specs})})),t.map((function(t){if(void 0===e[t[r.f.pic]])return!1;var n=e[t[r.f.pic]].variations.push({name:t[r.f.name],sku:t[r.f.sku],specs:t.specs});t[r.f.image]&&(e[t[r.f.pic]].variations[n-1].image=t[r.f.image],console.log("has image")),t[r.f.indent]&&(e[t[r.f.pic]].variations[n-1].indent=t[r.f.indent]),t[r.f.package]&&(e[t[r.f.pic]].variations[n-1].package=t[r.f.package])})),e}function y(e,t){var n,o,i;return o={},i=(n=t)[0].splice(1),n.splice(1).map((function(e){var t=e[0];void 0!==o[t]&&window.alert("Conflicting package ID's found: ".concat(t)),o[t]={},e.splice(1).map((function(e,n){o[t][i[n]]=e})),o[t][r.f.attr]=h(o[t][r.f.attr]),o[t][r.f.skus]=h(o[t][r.f.skus])})),t=o,Object.values(e).map((function(n){var o={};o.drop={label:"", -//! This should pull from PIC by controller -pic:n[r.f.pic],model:"B",skus:[],specs:[],product_info:["name","description","image"]},n.variations&&n.variations.map((function(e){void 0!==e.package?(o[e.package]||(o[e.package]={label:e.package,pic:n[r.f.pic],model:"B",skus:[],specs:[],product_info:[]},"list"===e.package&&(o[e.package].model="A",o[e.package].label="",//! PIC's name if on another product -o[e.package].product_info=["name","description","image"])),e.image&&(o[e.package].model="C"),console.log(n[r.f.name],e.package),o[e.package].skus.push(e.sku)):e.image?(o.varyImage||(o.varyImage={label:"",pic:n[r.f.pic],skus:[],specs:[],model:"C",product_info:["name","description","image"]}),o.varyImage.skus.push(e.sku)):o.drop.skus.push(e.sku)})),0===o.drop.skus.length&&delete o.drop,n[r.f.package]&&n[r.f.package].split(",").map((function(e){var n;(e=e.trim(),t[e][r.f.title]&o[t[e][r.f.title]]?(o["custom"+e]=o[t[e][r.f.title]],delete o[t[e][r.f.title]]):o["custom"+e]={label:"",pic:"",skus:[],model:"B",specs:[],product_info:[]},t[e][r.f.image]&&(o["custom"+e].model="D",o["custom"+e].image=t[e][r.f.image]),t[e][r.f.pic]&&(o["custom"+e].pic=t[e][r.f.pic]),t[e][r.f.skus])&&(n=o["custom"+e].skus).push.apply(n,a(t[e][r.f.skus]));t[e][r.f.attr]&&(o["custom"+e].specs=t[e][r.f.attr]),t[e][r.f.title]?o["custom"+e].label=t[e][r.f.title]:o["custom"+e].product_info=["name","description","image"],t[e][r.f.prod_info]&&(o["custom"+e].product_info=t[e][r.f.prod_info].split(",").map((function(e){return e.trim()}))),t[e][r.f.model]&&(o["custom"+e].model=t[e][r.f.model])})),e[n[r.f.pic]].packages=o})),e}function m(e){return e}function b(e,t,n){return void 0===e?(window.alert("Specify a parent product file first"),!1):void 0===t?(window.alert("Specify a variations file first"),!1):void 0!==n||(window.alert("Specify a package file first"),!1)}function w(e,t,n,r,o){if(e>16),c((65280&o)>>8),c(255&o);return 2==i?c(255&(o=f(e.charAt(n))<<2|f(e.charAt(n+1))>>4)):1==i&&(c((o=f(e.charAt(n))<<10|f(e.charAt(n+1))<<4|f(e.charAt(n+2))>>2)>>8&255),c(255&o)),a},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,a="";function u(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t>18&63)+u(o>>12&63)+u(o>>6&63)+u(63&o);switch(i){case 1:a+=u((n=e[e.length-1])>>2),a+=u(n<<4&63),a+="==";break;case 2:a+=u((n=(e[e.length-2]<<8)+e[e.length-1])>>10),a+=u(n>>4&63),a+=u(n<<2&63),a+="="}return a}}(void 0===n?this.base64js={}:n)}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(e,t,n){(function(t,r,o,i,a,u,s,f,c){var l=e("base64-js"),d=e("ieee754");function o(e,t,n){if(!(this instanceof o))return new o(e,t,n);var r,i,a,u,s,f=typeof e;if("base64"===t&&"string"==f)for(e=(r=e).trim?r.trim():r.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==f)i=x(e);else if("string"==f)i=o.byteLength(e,t);else{if("object"!=f)throw new Error("First argument needs to be a number, array or string.");i=x(e.length)}if(o._useTypedArrays?a=o._augment(new Uint8Array(i)):((a=this).length=i,a._isBuffer=!0),o._useTypedArrays&&"number"==typeof e.byteLength)a._set(e);else if(L(s=e)||o.isBuffer(s)||s&&"object"==typeof s&&"number"==typeof s.length)for(u=0;u>>0)):(t+1>>0),o}function m(e,t,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=t,"missing offset"),D(t+1>>8*(r?a:1-a)}function I(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3>>8*(r?a:3-a)&255}function E(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1>8,r=t%256,o.push(r),o.push(n);return o}(t),e,n,r)}(this,e,t,n);break;default:throw new Error("Unknown encoding")}return a},o.prototype.toString=function(e,t,n){var r,o,i,a,u=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,(n=void 0!==n?Number(n):n=u.length)===t)return"";switch(e){case"hex":r=function(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||rthis.length&&(r=this.length),e.length-t=this.length))return this[e]},o.prototype.readUInt16LE=function(e,t){return g(this,e,!0,t)},o.prototype.readUInt16BE=function(e,t){return g(this,e,!1,t)},o.prototype.readUInt32LE=function(e,t){return y(this,e,!0,t)},o.prototype.readUInt32BE=function(e,t){return y(this,e,!1,t)},o.prototype.readInt8=function(e,t){if(t||(D(null!=e,"missing offset"),D(e=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){return m(this,e,!0,t)},o.prototype.readInt16BE=function(e,t){return m(this,e,!1,t)},o.prototype.readInt32LE=function(e,t){return b(this,e,!0,t)},o.prototype.readInt32BE=function(e,t){return b(this,e,!1,t)},o.prototype.readFloatLE=function(e,t){return w(this,e,!0,t)},o.prototype.readFloatBE=function(e,t){return w(this,e,!1,t)},o.prototype.readDoubleLE=function(e,t){return v(this,e,!0,t)},o.prototype.readDoubleBE=function(e,t){return v(this,e,!1,t)},o.prototype.writeUInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(this[t]=e)},o.prototype.writeUInt16LE=function(e,t,n){_(this,e,t,!0,n)},o.prototype.writeUInt16BE=function(e,t,n){_(this,e,t,!1,n)},o.prototype.writeUInt32LE=function(e,t,n){I(this,e,t,!0,n)},o.prototype.writeUInt32BE=function(e,t,n){I(this,e,t,!1,n)},o.prototype.writeInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},o.prototype.writeInt16LE=function(e,t,n){E(this,e,t,!0,n)},o.prototype.writeInt16BE=function(e,t,n){E(this,e,t,!1,n)},o.prototype.writeInt32LE=function(e,t,n){A(this,e,t,!0,n)},o.prototype.writeInt32BE=function(e,t,n){A(this,e,t,!1,n)},o.prototype.writeFloatLE=function(e,t,n){k(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){k(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){B(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){B(this,e,t,!1,n)},o.prototype.fill=function(e,t,n){if(e=e||0,t=t||0,n=n||this.length,"string"==typeof e&&(e=e.charCodeAt(0)),D("number"==typeof e&&!isNaN(e),"value is not a number"),D(t<=n,"end < start"),n!==t&&0!==this.length){D(0<=t&&t"},o.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(o._useTypedArrays)return new o(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function T(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function N(e,t){D("number"==typeof e,"cannot write a non-number as a number"),D(0<=e,"specified a negative value for writing an unsigned value"),D(e<=t,"value is larger than maximum value for type"),D(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value"),D(Math.floor(e)===e,"value has a fractional component")}function Y(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value")}function D(e,t){if(!e)throw new Error(t||"Failed assertion")}o._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=S.get,e.set=S.set,e.write=S.write,e.toString=S.toString,e.toLocaleString=S.toString,e.toJSON=S.toJSON,e.copy=S.copy,e.slice=S.slice,e.readUInt8=S.readUInt8,e.readUInt16LE=S.readUInt16LE,e.readUInt16BE=S.readUInt16BE,e.readUInt32LE=S.readUInt32LE,e.readUInt32BE=S.readUInt32BE,e.readInt8=S.readInt8,e.readInt16LE=S.readInt16LE,e.readInt16BE=S.readInt16BE,e.readInt32LE=S.readInt32LE,e.readInt32BE=S.readInt32BE,e.readFloatLE=S.readFloatLE,e.readFloatBE=S.readFloatBE,e.readDoubleLE=S.readDoubleLE,e.readDoubleBE=S.readDoubleBE,e.writeUInt8=S.writeUInt8,e.writeUInt16LE=S.writeUInt16LE,e.writeUInt16BE=S.writeUInt16BE,e.writeUInt32LE=S.writeUInt32LE,e.writeUInt32BE=S.writeUInt32BE,e.writeInt8=S.writeInt8,e.writeInt16LE=S.writeInt16LE,e.writeInt16BE=S.writeInt16BE,e.writeInt32LE=S.writeInt32LE,e.writeInt32BE=S.writeInt32BE,e.writeFloatLE=S.writeFloatLE,e.writeFloatBE=S.writeFloatBE,e.writeDoubleLE=S.writeDoubleLE,e.writeDoubleBE=S.writeDoubleBE,e.fill=S.fill,e.inspect=S.inspect,e.toArrayBuffer=S.toArrayBuffer,e}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(e,t,n){(function(n,r,o,i,a,u,s,f,c){var l=new(o=e("buffer").Buffer)(4);l.fill(0),t.exports={hash:function(e,t,n,r){return o.isBuffer(e)||(e=new o(e)),function(e,t,n){for(var r=new o(t),i=n?r.writeInt32BE:r.writeInt32LE,a=0;ag?t=e(t):t.length>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,a=0;a>>32-u,n);var a,u}function h(e,t,n,r,o,i,a){return p(t&n|~t&r,e,t,o,i,a)}function g(e,t,n,r,o,i,a){return p(t&r|n&~r,e,t,o,i,a)}function y(e,t,n,r,o,i,a){return p(t^n^r,e,t,o,i,a)}function m(e,t,n,r,o,i,a){return p(n^(t|~r),e,t,o,i,a)}function b(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}t.exports=function(e){return l.hash(e,d,16)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(e,t,n){(function(e,n,r,o,i,a,u,s,f){var c;c=function(e){for(var t,n=new Array(e),r=0;r>>((3&r)<<3)&255;return n},t.exports=c}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(e,t,n){(function(n,r,o,i,a,u,s,f,c){var l=e("./helpers");function d(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n,r=Array(80),o=1732584193,i=-271733879,a=-1732584194,u=271733878,s=-1009589776,f=0;f>16)+(t>>16)+(n>>16)<<16|65535&n}function g(e,t){return e<>>32-t}t.exports=function(e){return l.hash(e,d,20,!0)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(e,t,n){(function(n,r,o,i,a,u,s,f,c){function l(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function d(e,t){return e>>>t|e<<32-t}function p(e,t){return e>>>t}function h(e,t){var n,r,o,i,a,u,s,f,c,h,g,y,m,b,w,v,_,I,E=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),A=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),k=new Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var B=0;B>1,c=-7,l=n?o-1:0,d=n?-1:1,p=e[t+l];for(l+=d,i=p&(1<<-c)-1,p>>=-c,c+=u;0>=-c,c+=r;0>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),2<=(t+=1<=a+l?d/s:d*Math.pow(2,1-l))*s&&(a++,s/=2),c<=a+l?(u=0,a=c):1<=a+l?(u=(t*s-1)*Math.pow(2,o),a+=l):(u=t*Math.pow(2,l-1)*Math.pow(2,o),a=0));8<=o;e[n+p]=255&u,p+=h,u/=256,o-=8);for(a=a<e.length)&&(t=e.length);for(var n=0,r=new Array(t);nt.length)return!1;t.forEach((function(t,r){var o=t.substr(1,t.length-2);delete n.specs[e+t],0===r?(n.specs[e.trim()]=i[e][t],n.specs[e.trim()].val+=" ".concat(o)):n.specs[e.trim()].val+=" (".concat(i[e][t].val," ").concat(o,")")}))})),n.specs),void 0!==f&&f[o.f.name]&&f[o.f.pic]?f:void 0)})).filter((function(e){return void 0!==e}))}function s(e){return Object.keys(e).forEach((function(t){var n,r,a,u;e[t]=(n=e[t],r={},a=["Minimum","Maximum","Min","Max","min","max"],void 0===n.variations[0]&&console.log("Has no variations?",n),Object.keys(n.variations[0].specs).forEach((function(e,t,n){var o=i(function(e,t){var n=!1,r="";return t.forEach((function(t){e.includes(t)&&!n&&(n=t,r=e.replace(n,"").trim())})),[n,r]}(e,a),2),u=o[0],s=o[1];u&&(r[s]||(r[s]=[]),r[s].push(e))})),n.variations.forEach((function(e,t){e=e.specs,Object.keys(r).forEach((function(o){if(2===r[o].length&&e[r[o][0]]){var i={featured:!1,icon:"",val:"".concat(e[r[o][0]].val," - ").concat(e[r[o][1]].val)};e[r[o][0]].val="",e[r[o][1]].val="",e[o]=i,n.variations[t].specs=e}}))})),n),e[t]=function(e){if(void 0===e.variations)return e;var t=[];e.variations=e.variations.map((function(e){var n={};return Object.keys(e.specs).forEach((function(r){var o=t.indexOf(r);o=-1===o?t.push(r)-1:o,n[o]=e.specs[r].val})),e.specs=n,e}));for(var n=[];0>16),s((65280&r)>>8),s(255&r);return 2==o?s(255&(r=c(e.charAt(t))<<2|c(e.charAt(t+1))>>4)):1==o&&(s((r=c(e.charAt(t))<<10|c(e.charAt(t+1))<<4|c(e.charAt(t+2))>>2)>>8&255),s(255&r)),i},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function a(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t>18&63)+a(o>>12&63)+a(o>>6&63)+a(63&o);switch(i){case 1:u+=a((n=e[e.length-1])>>2),u+=a(n<<4&63),u+="==";break;case 2:u+=a((n=(e[e.length-2]<<8)+e[e.length-1])>>10),u+=a(n>>4&63),u+=a(n<<2&63),u+="="}return u}}(void 0===f?this.base64js={}:f)}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(O,e,H){(function(e,t,h,n,r,o,i,u,a){var s=O("base64-js"),f=O("ieee754");function h(e,t,n){if(!(this instanceof h))return new h(e,t,n);var r,o,i,u,a,s=typeof e;if("base64"===t&&"string"==s)for(e=(r=e).trim?r.trim():r.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==s)o=x(e);else if("string"==s)o=h.byteLength(e,t);else{if("object"!=s)throw new Error("First argument needs to be a number, array or string.");o=x(e.length)}if(h._useTypedArrays?i=h._augment(new Uint8Array(o)):((i=this).length=o,i._isBuffer=!0),h._useTypedArrays&&"number"==typeof e.byteLength)i._set(e);else if(S(a=e)||h.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length)for(u=0;u>8,r=t%256,o.push(r),o.push(n);return o}(t),e,n,r)}function c(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o>>0)):(t+1>>0),o}function y(e,t,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=t,"missing offset"),D(t+1>>8*(r?u:1-u)}function _(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3>>8*(r?u:3-u)&255}function E(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1this.length&&(r=this.length),e.length-t=this.length))return this[e]},h.prototype.readUInt16LE=function(e,t){return l(this,e,!0,t)},h.prototype.readUInt16BE=function(e,t){return l(this,e,!1,t)},h.prototype.readUInt32LE=function(e,t){return d(this,e,!0,t)},h.prototype.readUInt32BE=function(e,t){return d(this,e,!1,t)},h.prototype.readInt8=function(e,t){if(t||(D(null!=e,"missing offset"),D(e=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){return y(this,e,!0,t)},h.prototype.readInt16BE=function(e,t){return y(this,e,!1,t)},h.prototype.readInt32LE=function(e,t){return w(this,e,!0,t)},h.prototype.readInt32BE=function(e,t){return w(this,e,!1,t)},h.prototype.readFloatLE=function(e,t){return b(this,e,!0,t)},h.prototype.readFloatBE=function(e,t){return b(this,e,!1,t)},h.prototype.readDoubleLE=function(e,t){return m(this,e,!0,t)},h.prototype.readDoubleBE=function(e,t){return m(this,e,!1,t)},h.prototype.writeUInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(this[t]=e)},h.prototype.writeUInt16LE=function(e,t,n){v(this,e,t,!0,n)},h.prototype.writeUInt16BE=function(e,t,n){v(this,e,t,!1,n)},h.prototype.writeUInt32LE=function(e,t,n){_(this,e,t,!0,n)},h.prototype.writeUInt32BE=function(e,t,n){_(this,e,t,!1,n)},h.prototype.writeInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},h.prototype.writeInt16LE=function(e,t,n){E(this,e,t,!0,n)},h.prototype.writeInt16BE=function(e,t,n){E(this,e,t,!1,n)},h.prototype.writeInt32LE=function(e,t,n){I(this,e,t,!0,n)},h.prototype.writeInt32BE=function(e,t,n){I(this,e,t,!1,n)},h.prototype.writeFloatLE=function(e,t,n){A(this,e,t,!0,n)},h.prototype.writeFloatBE=function(e,t,n){A(this,e,t,!1,n)},h.prototype.writeDoubleLE=function(e,t,n){B(this,e,t,!0,n)},h.prototype.writeDoubleBE=function(e,t,n){B(this,e,t,!1,n)},h.prototype.fill=function(e,t,n){if(e=e||0,t=t||0,n=n||this.length,"string"==typeof e&&(e=e.charCodeAt(0)),D("number"==typeof e&&!isNaN(e),"value is not a number"),D(t<=n,"end < start"),n!==t&&0!==this.length){D(0<=t&&t"},h.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(h._useTypedArrays)return new h(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function M(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function N(e,t){D("number"==typeof e,"cannot write a non-number as a number"),D(0<=e,"specified a negative value for writing an unsigned value"),D(e<=t,"value is larger than maximum value for type"),D(Math.floor(e)===e,"value has a fractional component")}function Y(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value"),D(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value")}function D(e,t){if(!e)throw new Error(t||"Failed assertion")}h._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=L.get,e.set=L.set,e.write=L.write,e.toString=L.toString,e.toLocaleString=L.toString,e.toJSON=L.toJSON,e.copy=L.copy,e.slice=L.slice,e.readUInt8=L.readUInt8,e.readUInt16LE=L.readUInt16LE,e.readUInt16BE=L.readUInt16BE,e.readUInt32LE=L.readUInt32LE,e.readUInt32BE=L.readUInt32BE,e.readInt8=L.readInt8,e.readInt16LE=L.readInt16LE,e.readInt16BE=L.readInt16BE,e.readInt32LE=L.readInt32LE,e.readInt32BE=L.readInt32BE,e.readFloatLE=L.readFloatLE,e.readFloatBE=L.readFloatBE,e.readDoubleLE=L.readDoubleLE,e.readDoubleBE=L.readDoubleBE,e.writeUInt8=L.writeUInt8,e.writeUInt16LE=L.writeUInt16LE,e.writeUInt16BE=L.writeUInt16BE,e.writeUInt32LE=L.writeUInt32LE,e.writeUInt32BE=L.writeUInt32BE,e.writeInt8=L.writeInt8,e.writeInt16LE=L.writeInt16LE,e.writeInt16BE=L.writeInt16BE,e.writeInt32LE=L.writeInt32LE,e.writeInt32BE=L.writeInt32BE,e.writeFloatLE=L.writeFloatLE,e.writeFloatBE=L.writeFloatBE,e.writeDoubleLE=L.writeDoubleLE,e.writeDoubleBE=L.writeDoubleBE,e.fill=L.fill,e.inspect=L.inspect,e.toArrayBuffer=L.toArrayBuffer,e}}).call(this,O("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},O("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(l,d,e){(function(e,t,u,n,r,o,i,a,s){u=l("buffer").Buffer;var f=4,c=new u(f);c.fill(0);d.exports={hash:function(e,t,n,r){return u.isBuffer(e)||(e=new u(e)),function(e,t,n){for(var r=new u(t),o=n?r.writeInt32BE:r.writeInt32LE,i=0;ih?t=e(t):t.length>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u>>32-a,n);var u,a}function d(e,t,n,r,o,i,u){return l(t&n|~t&r,e,t,o,i,u)}function h(e,t,n,r,o,i,u){return l(t&r|n&~r,e,t,o,i,u)}function p(e,t,n,r,o,i,u){return l(t^n^r,e,t,o,i,u)}function g(e,t,n,r,o,i,u){return l(n^(t|~r),e,t,o,i,u)}function y(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}b.exports=function(e){return f.hash(e,c,16)}}).call(this,w("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},w("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(e,l,t){(function(e,t,n,r,o,i,u,a,s){var f,c;f=function(e){for(var t,n=new Array(e),r=0;r>>((3&r)<<3)&255;return n},l.exports=c||f}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(l,d,e){(function(e,t,n,r,o,i,u,a,s){var f=l("./helpers");function c(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n,r=Array(80),o=1732584193,i=-271733879,u=-1732584194,a=271733878,s=-1009589776,f=0;f>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t){return e<>>32-t}d.exports=function(e){return f.hash(e,c,20,!0)}}).call(this,l("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},l("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(l,d,e){(function(e,t,n,r,o,i,u,a,s){function B(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function L(e,t){return e>>>t|e<<32-t}function U(e,t){return e>>>t}function f(e,t){var n,r,o,i,u,a,s,f,c,l,d,h,p,g,y,w,b,m,v=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),_=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),E=new Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var I=0;I>1,c=-7,l=n?o-1:0,d=n?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-c)-1,h>>=-c,c+=a;0>=-c,c+=r;0>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,u=c):(u=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-u))<1&&(u--,s*=2),2<=(t+=1<=u+l?d/s:d*Math.pow(2,1-l))*s&&(u++,s/=2),c<=u+l?(a=0,u=c):1<=u+l?(a=(t*s-1)*Math.pow(2,o),u+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,o),u=0));8<=o;e[n+h]=255&a,h+=p,a/=256,o-=8);for(u=u< arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + + + // The attribute column right before specifications start + +var b_SpecsStart = 'Specification Start'; +var b_SpecsEnd = 'Specification End'; + +function findSpecBounds(attrRow) { + var started = false; + return attrRow.map(function (val, ind) { + if (val === b_SpecsStart) { + started = true; + return ind; + } + + if (val === b_SpecsEnd && started) { + return ind; + } + + return false; + }).filter(function (val) { + if (false !== val) return true; // I know this looks silly, but what if val == 0? + }); +} + +function findSpecIcons(attrRow, row) { + var icons = {}; + + if (!row.includes('ICON')) { + window.alert('Are you sure your defining specification icons?'); + } + + row.map(function (val, ind) { + if ('' !== val && 'ICON' !== val) { + icons[attrRow[ind]] = val; + } + }); + return icons; +} + +function computeChecksum(prods) { + Object.values(prods).map(function (prod) { + prods[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].checksum = object_hash__WEBPACK_IMPORTED_MODULE_1___default()(prod); + }); + console.log('HASHed', prods); + return prods; +} + +function filterExisting(data) { + var existingHashes = {}; + data.forEach(function (WPprod) { + try { + existingHashes[WPprod.meta.PIC[0]] = { + id: WPprod.id, + checksum: String(WPprod.meta.product_hash[0]) + }; + } catch (_unused) { + console.log("ID:".concat(WPprod.id, " is not a legitimate product :(")); + } + }); + return existingHashes; +} + +function compareHashesForPayload(newProds, existing) { + var forcing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + if (!existing) return [[], Object.keys(newProds)]; + var toDelete = []; + var toPost = []; + var toUpdate = []; + var newPics = Object.keys(newProds); + var ignoringN = 0; // Ugh, just redo it + + newPics.forEach(function (pic) { + if (!existing[pic]) { + // Create new products + toPost.push(pic); + } else if (forcing || existing[pic].checksum !== newProds[pic].checksum) { + // Update existing products + existing[pic].pic = pic; // Lol + + toUpdate.push(existing[pic]); + } else { + // Ignore unchanged products, we're just incrementing a counter for stats + ignoringN++; + } // else, this product has not been updated + + }); + console.log("Creating : ".concat(toPost.length)); + console.log("Updating : ".concat(toUpdate.length)); + console.log("Ignoring: ".concat(ignoringN)); + return [toDelete, toPost, toUpdate]; +} + +function keyByPIC(prods) { + var ProdByPIC = {}; + prods.map(function (val) { + if (!val) { + return false; + } + + if (!ProdByPIC[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]]) { + ProdByPIC[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]] = []; + } + + ProdByPIC[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]] = val; + return val; + }); + return ProdByPIC; +} + +function splitAndVerify(commaSeparated) { + if (!commaSeparated) return []; + var rv = commaSeparated.split(',').map(function (val) { + return val.trim(); + }); + + if ('' === rv[0]) { + return false; + } + + return rv; +} + +function buildPackageObj(packages) { + var rv = {}; + var attr = packages[0].splice(1); // Ignore ID field since the rows are spliced too + + packages.splice(1).map(function (row) { + var id = row[0]; + + if (undefined !== rv[id]) { + window.alert("Conflicting package ID's found: ".concat(id)); + } + + rv[id] = {}; + row.splice(1).map(function (val, ind) { + rv[id][attr[ind]] = val; + }); + rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr] = splitAndVerify(rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr]); + rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus] = splitAndVerify(rv[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus]); + }); + return rv; +} + +function linkVariations(parents, varies) { + // Give all parents an array first, and if prod.type is simple, + // copy the sku and name to make a basic variation + Object.values(parents).map(function (prod) { + parents[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations = []; + + if ('simple' === prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].type]) { + parents[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations.push({ + name: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].name], + sku: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].sku], + specs: prod.specs + }); + } + }); + varies.map(function (val) { + if (undefined === parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]]) return false; + var varN = parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations.push({ + name: val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].name], + sku: val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].sku], + specs: val.specs // This is too heavy optimizeVariations transforms later + + }); // Undefined is better for payload size + + if (val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]) { + parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations[varN - 1].image = val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]; + console.log('has image'); + } + + ; + + if (val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].indent]) { + parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations[varN - 1].indent = val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].indent]; + } + + ; + + if (val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package]) { + parents[val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].variations[varN - 1].package = val[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package]; + } + + ; + }); + return parents; +} + +function linkPackages(parents, packs) { + packs = buildPackageObj(packs); // Learn what you can from just variations + + Object.values(parents).map(function (prod) { + var packages = {}; // Default package + + packages.drop = { + label: '', + //! This should pull from PIC by controller + pic: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic], + model: 'B', + skus: [], + specs: [], + // This needs to be pulled from varying attributes + product_info: ['name', 'description', 'image'] + }; + + if (prod.variations) { + prod.variations.map(function (vary) { + if (undefined !== vary.package) { + // Variation specifies a package to be in + // see if that package exists first + if (!packages[vary.package]) { + packages[vary.package] = { + // Base package template + label: vary.package, + pic: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic], + model: 'B', + skus: [], + specs: [], + // Defined by pack sheet below + product_info: [] // Defined by pack sheet below + + }; // if this is a 'list' package, ensure model A + + if ('list' === vary.package) { + packages[vary.package].model = 'A'; + packages[vary.package].label = ''; //! PIC's name if on another product + + packages[vary.package].product_info = ['name', 'description', 'image']; + } + } // If any of the variations have images, upgrade that package model. + + + if (vary.image) { + packages[vary.package].model = 'C'; // Make sure they're separate from the 'drop' first + // Any other details should be defined by pack sheet + } // Add variation to the package of its choice + + + console.log(prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].name], vary.package); + packages[vary.package].skus.push(vary.sku); // If a package name isn't specified but the variation still uses an image, use a blank package name, similar to 'drop' + } else if (vary.image) { + // Check if there already isn't a package for unlabeled packages of variation images. + if (!packages.varyImage) { + packages.varyImage = { + label: '', + pic: prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic], + skus: [], + specs: [], + model: 'C', + product_info: ['name', 'description', 'image'] + }; + } + + packages.varyImage.skus.push(vary.sku); + } else { + packages.drop.skus.push(vary.sku); + } + }); + } // Remove default if every variation found a package + + + if (0 === packages.drop.skus.length) { + delete packages.drop; + } // Now apply the package file for more packages and specs + // All packages must have names by now, otherwise the variations wouldn't be able to save or they would be put in 'drop' + + + if (prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package]) { + prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].package].split(',').map(function (id) { + // This is a package who's name derives from PIC + id = id.trim(); // Before making custom package, make sure the variations didn't already define it. + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title] & packages[packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]]) { + packages['custom' + id] = packages[packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]]; + delete packages[packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]]; + } else + /* Otherwise, build the new package */ + { + packages['custom' + id] = { + label: '', + pic: '', + skus: [], + model: 'B', + specs: [], + // This needs to be pulled from varying attributes + product_info: [] + }; + } // For every field that is defined by the package sheet, confirm and re-specify. + + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]) { + packages['custom' + id].model = 'D'; + packages['custom' + id].image = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].image]; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]) { + packages['custom' + id].pic = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus]) { + var _packages$skus; + + (_packages$skus = packages['custom' + id].skus).push.apply(_packages$skus, _toConsumableArray(packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].skus])); + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr]) { + packages['custom' + id].specs = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].attr]; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]) { + packages['custom' + id].label = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].title]; + } else { + // If the title is not specified, this is a product blurb and the title and product_info should be pulled from the PIC. + packages['custom' + id].product_info = ['name', 'description', 'image']; + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].prod_info]) { + packages['custom' + id].product_info = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].prod_info].split(',').map(function (val) { + return val.trim(); + }); + } + + if (packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].model]) { + packages['custom' + id].model = packs[id][_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].model]; + } + }); + } // TODO: Test with Posterior Mounting Brackets with the art of linking via label and specify specs in sheet + // TODO: nevermind, but test anyways + /// / : Confirm that the first package is the 'drop' package + // TODO: Stop using the drop package... + // if (Object.values(packages)[0] && '' !== Object.values(packages)[0].label) { + // window.alert(`${prod[f.name]} should be specifying main product variations first!`); + // } + // Packages makes up both packages implicitly defined in variations and explicitly from the sheet + + + parents[prod[_fields_js__WEBPACK_IMPORTED_MODULE_0__["f"].pic]].packages = packages; + }); + return parents; +} // confirm definition of properties that will be used in POST +// used for cleaning taxonomies for now + + +function verifyFields(prod) { + return prod; +} + +function verifyFiles(parentFileHandler, variationFileHandler, packageFileHandler) { + if (parentFileHandler === undefined) { + window.alert('Specify a parent product file first'); + return false; + } + + if (variationFileHandler === undefined) { + window.alert('Specify a variations file first'); + return false; + } + + if (packageFileHandler === undefined) { + window.alert('Specify a package file first'); + return false; + } + + return true; +} + +function buildSpec(start, end, ind, val, icon) { + if (start < ind && ind < end) { + var spec = {}; // Value + + spec.val = val.trim(); // Icon + + spec.icon = icon; // Featured or Additional + + if (val.includes('*')) { + spec.val = val.replace('*', ''); + spec.featured = true; + } else { + spec.featured = false; + } + + return spec; + } + + return false; +} + +function variationSlice(varyPack, i) { + var rv = { + varies: varyPack.varies[i], + labels: varyPack.labels + }; + return rv; +} + + + +/***/ }), + +/***/ "./src/scripts/products.js": +/*!*********************************!*\ + !*** ./src/scripts/products.js ***! + \*********************************/ +/*! exports provided: buildProductObjs, optimizeProducts */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buildProductObjs", function() { return buildProductObjs; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "optimizeProducts", function() { return optimizeProducts; }); +/* harmony import */ var _filters__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filters */ "./src/scripts/filters.js"); +/* harmony import */ var _fields__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fields */ "./src/scripts/fields.js"); +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +/* eslint-disable no-undef */ + + + +function combineUnitSpecs(parent) { + var combos = {}; + Object.keys(parent.specs).forEach(function (specLabel) { + var lastBracket = specLabel.lastIndexOf(')'); + + if (-1 !== lastBracket) { + var firstBracket = specLabel.lastIndexOf('('); + var base = specLabel.substr(0, firstBracket); + var unit = specLabel.substr(firstBracket, lastBracket); + if (!combos[base]) combos[base] = {}; + combos[base][unit] = parent.specs[specLabel]; // combos[base][unit].val += unit; + } + }); + Object.keys(combos).forEach(function (combo) { + var comboUnits = Object.keys(combos[combo]); // Don't create a combo unit unless there are at least 2 units to combine + + if (2 > comboUnits.length) return false; + comboUnits.forEach(function (unit, i) { + // First value dictates the logo and featuredBool used + var directUnit = unit.substr(1, unit.length - 2); + delete parent.specs[combo + unit]; + + if (0 === i) { + parent.specs[combo.trim()] = combos[combo][unit]; + parent.specs[combo.trim()].val += " ".concat(directUnit); + } else { + parent.specs[combo.trim()].val += " (".concat(combos[combo][unit].val, " ").concat(directUnit, ")"); + } + }); + }); // Not using includesAny() since I'm particularly looking for units in parenthesis + + return parent.specs; +} + +function buildProductObjs(attrRow, rows) { + // This will go through a CSV and create an array + // of product objects keyed to the attribute name + var _findSpecBounds = Object(_filters__WEBPACK_IMPORTED_MODULE_0__["findSpecBounds"])(attrRow), + _findSpecBounds2 = _slicedToArray(_findSpecBounds, 2), + start = _findSpecBounds2[0], + end = _findSpecBounds2[1]; + + var icons = Object(_filters__WEBPACK_IMPORTED_MODULE_0__["findSpecIcons"])(attrRow, rows[1]); + var region = wpApiSettings.lang; + console.log('Current Region: ', region); // Splice to avoid first two rows of attribute names and icons + + var products = rows.splice(1).map(function (row) { + var product = {}; + product.specs = {}; + product.terms = {}; + product.warranty = {}; + product.indications = []; + product.downloads = []; + product.packages = []; + row.map(function (val, ind) { + var specLabel = attrRow[ind].trim(); + + if ('' !== val) { + // Specification or generic product information + var spec = Object(_filters__WEBPACK_IMPORTED_MODULE_0__["buildSpec"])(start, end, ind, val, icons[specLabel]); + + if (spec) { + product.specs[specLabel] = spec; + } else { + // Generic product info + product[specLabel] = val; + } + } + }); // TODO: ONLY FOR TESTING ONE PRODUCT + // if ('2102' !== product[f.pic] /* || !product[f.type] */) return undefined; + // if ('2076' !== product[f.pic] /* || !product[f.type] */) return undefined; + // Taxonomies + + product.terms.product_cat = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].cat] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].cat].split('::').map(function (term) { + return term.trim(); + }) : []; + product.terms.product_tag = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].tag] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].tag].split(',').map(function (term) { + return term.trim(); + }) : []; // Default search weight of 3 if absent + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].searchWeight] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].searchWeight] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].searchWeight] : 3; // Warranty pieces into one + + product.warranty.body = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].warrantyBody]; + product.warranty.list = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].warrantyList] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].warrantyList].split('\n').map(function (line) { + return line.trim(); + }) : []; /// ////////////// + // Trim whitespace from crucial columns + // type only defined for parent products + + if (product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type]) { + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type].trim(); + } // Gallery + + + product.gallery = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].image] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].image].split(',').map(function (item) { + return item.trim(); + }) : ['1005']; // Features + + product.features = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].feats] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].feats].split('\n').map(function (line) { + return line.trim(); + }) : []; // Indications + + product.indications = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].indict] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].indict].split('\n').map(function (line) { + return line.trim(); + }) : []; // Related Products + + product.related = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].related] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].related].split(',').map(function (val) { + return val.trim(); + }) : []; // Downloads + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs].split(',').map(function (val) { + return val.trim(); + }) : []; // Parse downloads + + for (var i = 0; i < product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs].length; i += 2) { + product.downloads.push({ + title: product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs][i], + url: product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].downs][i + 1] + }); + } /// * ////////////////////////////////////////////////// + // Field Defaults prior to checksum + // SKU field defined regardless + + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].sku] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].sku] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].sku] : ''; // Order field + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].orderInfo] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].orderInfo] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].orderInfo] : ''; // Main Model field + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].main_model] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].main_model] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].main_model] : 'E'; // Part Number Field toggle field + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].png] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].pnf] ? '1' === product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].pnf] : false; // Visibility + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].visibility] = 'visible' === product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].visibility] ? 'publish' : 'draft'; // Region Specification + + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].region] = product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].region] ? product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].region] : wpApiSettings.lang; // Skip products region locked to another language, different than the current WP WPML Language + + if (product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type] && wpApiSettings.lang !== product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].region]) { + return false; + } // Optimize specs by combining different units of the same spec + + + product.specs = combineUnitSpecs(product); // Ignore blank rows or incomplete products + + if (product !== undefined && product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].name] && product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].pic]) { + return product; + } + }); + return products.filter(function (prod) { + return prod !== undefined; + }); +} + +function optimizeVariations(parent) { + // Since variations are built the same way as products, + // we must use trim away unused data from variations for slimmer POSTs + if (undefined === parent.variations) { + return parent; + } + + var specLabels = []; + parent.variations = parent.variations.map(function (vary) { + var specValues = {}; + Object.keys(vary.specs).forEach(function (specLabel) { + var specIndex = specLabels.indexOf(specLabel); + specIndex = -1 === specIndex ? specLabels.push(specLabel) - 1 : specIndex; + specValues[specIndex] = vary.specs[specLabel].val; // vary.specs[specLabel] = vary.specs[specLabel].val; + }); + vary.specs = specValues; // Wipe out specs and replace with the diet program + + return vary; + }); + var varyPacks = []; + + while (0 < parent.variations.length) { + varyPacks.push(parent.variations.splice(0, 600)); + } + + parent.variations = { + varies: varyPacks, + labels: specLabels + }; // Break up varies + + return parent; +} + +function dependantVariations(parent) { + var specCompare = {}; + var labels = parent.variations.labels; + var variationValues = parent.variations.varies[0]; // TODO: Add support for multiple variation packs. Only [0] at the moment + // I Know, a bigO(n^2), but it could be worse... + + labels.forEach(function (label, ind, arr) { + specCompare[label] = {}; + }); // varies = [values] and the corresponding label sharing index + + Object.values(variationValues).forEach(function (values, pairIndex) { + // console.log('values', values, values.specs, Object.values(values.specs)); + // values = Object.values(values.specs); + Object.values(values.specs).forEach(function (val, ind, arr) { + if (undefined === specCompare[labels[ind]][val]) specCompare[labels[ind]][val] = {}; // A loop for going through all the OTHER spec values + + for (var i = (ind + 1) % arr.length; i !== ind; i = (i + 1) % arr.length) { + // Create new arrays at spec: val : spec level + if (undefined === specCompare[labels[ind]][val][labels[i]]) { + specCompare[labels[ind]][val][labels[i]] = []; + } // Only add unique values to the matrix + + + if (!specCompare[labels[ind]][val][labels[i]].includes(arr[i])) { + // Different spec values at the same variation + specCompare[labels[ind]][val][labels[i]].push(arr[i]); + } + } + }); + }); + return parent; +} +/* +Either combining minimum/maximums with dash '-' + or appending different units into one +*/ + + +function includesAny(subject, arr) { + var mod = false; + var base = ''; + arr.forEach(function (val) { + if (subject.includes(val) && !mod) { + mod = val; + base = subject.replace(mod, '').trim(); + } + }); + return [mod, base]; +} // Spec labels are pulled from just the first variation. + + +function combineVariationSpecs(parent) { + var combos = {}; + var searchFor = ['Minimum', 'Maximum', 'Min', 'Max', 'min', 'max']; // Min/Max combos -> min - max + + if (parent.variations[0] === undefined) { + console.log('Has no variations?', parent); + } + + Object.keys(parent.variations[0].specs).forEach(function (label, ind, arr) { + var _includesAny = includesAny(label, searchFor), + _includesAny2 = _slicedToArray(_includesAny, 2), + mod = _includesAny2[0], + base = _includesAny2[1]; + + if (mod) { + // Attach to base pair which I check to see exists first + if (!combos[base]) combos[base] = []; + combos[base].push(label); + } + }); // console.log('combine specifications:', combos); + // Apply min/max combinations + // For every variations... on each combo... the value of combined fields + + parent.variations.forEach(function (vary, ind) { + vary = vary.specs; + Object.keys(combos).forEach(function (base) { + // Otherwise, this was a product with a single Min OR Max + if (2 === combos[base].length && vary[combos[base][0]]) { + var newVal = { + featured: false, + icon: '', + val: "".concat(vary[combos[base][0]].val, " - ").concat(vary[combos[base][1]].val) + }; // Set other variations to delete + + vary[combos[base][0]].val = ''; + vary[combos[base][1]].val = ''; + vary[base] = newVal; + parent.variations[ind].specs = vary; // Remember vary was set to specs + } + }); + }); + return parent; +} + +function fillBlankVariations(product) { + var totalSpecs = product.variations.labels.length; // An array of false, set to true once seen used + // in a variation after all the optimization. + + var specUsage = product.variations.labels.map(function (val) { + return false; + }); // Figure out which specs are never usage (transformed into another spec) + + product.variations.varies[0].forEach(function (variation, varyInd) { + specUsage.forEach(function (used, ind) { + if ('' !== variation.specs[ind]) { + specUsage[ind] = true; + } + }); + }); // Skipping varies pagination that never got used + + product.variations.varies[0].forEach(function (variation, varyInd) { + // For each spec inside each variation, assign empty string if non-existent. + specUsage.forEach(function (used, ind) { + if (used && !variation.specs[ind]) { + product.variations.varies[0][varyInd].specs[ind] = ' '; + } + }); + }); + return product; +} + +function addFirstSKU(product) { + if ('variation' === product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].type]) { + product[_fields__WEBPACK_IMPORTED_MODULE_1__["f"].sku] = product.variations.varies[0][0].sku; + } + + return product; +} + +function optimizeProducts(parents) { + // Reformat variation object for lighter specs overhead + Object.keys(parents).forEach(function (key) { + parents[key] = combineVariationSpecs(parents[key]); // console.log(parents[key]); + + parents[key] = optimizeVariations(parents[key]); // console.log(parents[key]); + + parents[key] = dependantVariations(parents[key]); + parents[key] = fillBlankVariations(parents[key]); + parents[key] = addFirstSKU(parents[key]); + }); + return parents; +} + + + +/***/ }), + +/***/ 5: +/*!***************************************!*\ + !*** multi ./src/scripts/products.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! /Users/jim/Local Sites/Fillauer/Importer/src/scripts/products.js */"./src/scripts/products.js"); + + +/***/ }) + +/******/ }); +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay9ib290c3RyYXAiLCJ3ZWJwYWNrOi8vLy4vbm9kZV9tb2R1bGVzL29iamVjdC1oYXNoL2Rpc3Qvb2JqZWN0X2hhc2guanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3NjcmlwdHMvZmllbGRzLmpzIiwid2VicGFjazovLy8uL3NyYy9zY3JpcHRzL2ZpbHRlcnMuanMiLCJ3ZWJwYWNrOi8vLy4vc3JjL3NjcmlwdHMvcHJvZHVjdHMuanMiXSwibmFtZXMiOlsiZiIsInR5cGUiLCJuYW1lIiwic2t1IiwicGljIiwiY2F0IiwidGFnIiwiZGVzYyIsInNob3J0X2Rlc2MiLCJ2aXNpYmlsaXR5IiwicGFja2FnZSIsInRpdGxlIiwiYXR0ciIsIm1vZGVsIiwic2t1cyIsInByb2RfaW5mbyIsImltYWdlIiwiaW5kZW50Iiwid2FycmFudHlMaXN0Iiwid2FycmFudHlCb2R5Iiwib3JkZXJJbmZvIiwiZmVhdHMiLCJyZWxhdGVkIiwiaW5kaWN0IiwiZG93bnMiLCJtYWluX21vZGVsIiwicG5mIiwic2VhcmNoV2VpZ2h0IiwicmVnaW9uIiwiYl9TcGVjc1N0YXJ0IiwiYl9TcGVjc0VuZCIsImZpbmRTcGVjQm91bmRzIiwiYXR0clJvdyIsInN0YXJ0ZWQiLCJtYXAiLCJ2YWwiLC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idXRlc1xuICAgICAgICAgICAgcHJvZHVjdF9pbmZvOiBbXSxcbiAgICAgICAgICB9O1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gRm9yIGV2ZXJ5IGZpZWxkIHRoYXQgaXMgZGVmaW5lZCBieSB0aGUgcGFja2FnZSBzaGVldCwgY29uZmlybSBhbmQgcmUtc3BlY2lmeS5cbiAgICAgICAgaWYgKHBhY2tzW2lkXVtmLmltYWdlXSkge1xuICAgICAgICAgIHBhY2thZ2VzWydjdXN0b20nICsgaWRdLm1vZGVsID0gJ0QnO1xuICAgICAgICAgIHBhY2thZ2VzWydjdXN0b20nICsgaWRdLmltYWdlID0gcGFja3NbaWRdW2YuaW1hZ2VdO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwYWNrc1tpZF1bZi5waWNdKSB7XG4gICAgICAgICAgcGFja2FnZXNbJ2N1c3RvbScgKyBpZF0ucGljID0gcGFja3NbaWRdW2YucGljXTtcbiAgICAgICAgfVxuICAgICAgICBpZiAocGFja3NbaWRdW2Yuc2t1c10pIHtcbiAgICAgICAgICBwYWNrYWdlc1snY3VzdG9tJyArIGlkXS5za3VzLnB1c2goLi4ucGFja3NbaWRdW2Yuc2t1c10pO1xuICAgICAgICB9XG4gICAgICAgIGlmIChwYWNrc1tpZF1bZi5hdHRyXSkge1xuICAgICAgICAgIHBhY2thZ2VzWydjdXN0b20nICsgaWRdLnNwZWNzID0gcGFja3NbaWRdW2YuYXR0cl07XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHBhY2tzW2lkXVtmLnRpdGxlXSkge1xuICAgICAgICAgIHBhY2thZ2VzWydjdXN0b20nICsgaWRdLmxhYmVsID0gcGFja3NbaWRdW2YudGl0bGVdO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIElmIHRoZSB0aXRsZSBpcyBub3Qgc3BlY2lmaWVkLCB0aGlzIGlzIGEgcHJvZHVjdCBibHVyYiBhbmQgdGhlIHRpdGxlIGFuZCBwcm9kdWN0X2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wYXJlbnRzW2tleV0gPSBvcHRpbWl6ZVZhcmlhdGlvbnMocGFyZW50c1trZXldKTtcbiAgICAvLyBjb25zb2xlLmxvZyhwYXJlbnRzW2tleV0pO1xuICAgIHBhcmVudHNba2V5XSA9IGRlcGVuZGFudFZhcmlhdGlvbnMocGFyZW50c1trZXldKTtcblxuICAgIHBhcmVudHNba2V5XSA9IGZpbGxCbGFua1ZhcmlhdGlvbnMocGFyZW50c1trZXldKTtcblxuICAgIHBhcmVudHNba2V5XSA9IGFkZEZpcnN0U0tVKHBhcmVudHNba2V5XSk7XG4gIH0pO1xuXG4gIHJldHVybiBwYXJlbnRzO1xufVxuXG5leHBvcnQgeyBidWlsZFByb2R1Y3RPYmpzLCBvcHRpbWl6ZVByb2R1Y3RzIH07XG4iXSwic291cmNlUm9vdCI6IiJ9 \ No newline at end of file diff --git a/dist/scripts/rest.js b/dist/scripts/rest.js index 8d97afb..1252e41 100644 --- a/dist/scripts/rest.js +++ b/dist/scripts/rest.js @@ -1,13 +1,8687 @@ -!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=45)}([function(t,e,n){"use strict";n.r(e),n.d(e,"f",(function(){return r}));var r={type:"Type",name:"Name",sku:"SKU",pic:"PIC",cat:"tax:product_cat",tag:"tax:product_tag",desc:"Description",short_desc:"Short Description",visibility:"Visibility in catalog",package:"Package",title:"Title",attr:"Attributes",model:"Model",skus:"SKUs",prod_info:"Product Info",image:"Image",indent:"Indention",warrantyList:"Warranty List",warrantyBody:"Warranty Body",orderInfo:"Ordering Information",feats:"Product Features",related:"Related Products",indict:"Indications",downs:"Downloads",main_model:"Main Model",pnf:"In Part Number Finder",searchWeight:"Search Weight",region:"Region Lock"}},function(t,e,n){"use strict";n.r(e),n.d(e,"findSpecBounds",(function(){return u})),n.d(e,"findSpecIcons",(function(){return f})),n.d(e,"computeChecksum",(function(){return c})),n.d(e,"filterExisting",(function(){return l})),n.d(e,"compareHashesForPayload",(function(){return h})),n.d(e,"keyByPIC",(function(){return d})),n.d(e,"linkVariations",(function(){return g})),n.d(e,"linkPackages",(function(){return m})),n.d(e,"verifyFields",(function(){return y})),n.d(e,"verifyFiles",(function(){return w})),n.d(e,"buildSpec",(function(){return b})),n.d(e,"variationSlice",(function(){return _}));var r=n(0),i=n(14),o=n.n(i);function s(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&void 0!==arguments[2]&&arguments[2];if(!e)return[[],Object.keys(t)];var r=[],i=[],o=[],s=Object.keys(t),a=0;return s.forEach((function(r){e[r]?n||e[r].checksum!==t[r].checksum?(e[r].pic=r,o.push(e[r])):a++:i.push(r)})),console.log("Creating : ".concat(i.length)),console.log("Updating : ".concat(o.length)),console.log("Ignoring: ".concat(a)),[r,i,o]}function d(t){var e={};return t.map((function(t){return!!t&&(e[t[r.f.pic]]||(e[t[r.f.pic]]=[]),e[t[r.f.pic]]=t,t)})),e}function p(t){if(!t)return[];var e=t.split(",").map((function(t){return t.trim()}));return""!==e[0]&&e}function g(t,e){return Object.values(t).map((function(e){t[e[r.f.pic]].variations=[],"simple"===e[r.f.type]&&t[e[r.f.pic]].variations.push({name:e[r.f.name],sku:e[r.f.sku],specs:e.specs})})),e.map((function(e){if(void 0===t[e[r.f.pic]])return!1;var n=t[e[r.f.pic]].variations.push({name:e[r.f.name],sku:e[r.f.sku],specs:e.specs});e[r.f.image]&&(t[e[r.f.pic]].variations[n-1].image=e[r.f.image],console.log("has image")),e[r.f.indent]&&(t[e[r.f.pic]].variations[n-1].indent=e[r.f.indent]),e[r.f.package]&&(t[e[r.f.pic]].variations[n-1].package=e[r.f.package])})),t}function m(t,e){var n,i,o;return i={},o=(n=e)[0].splice(1),n.splice(1).map((function(t){var e=t[0];void 0!==i[e]&&window.alert("Conflicting package ID's found: ".concat(e)),i[e]={},t.splice(1).map((function(t,n){i[e][o[n]]=t})),i[e][r.f.attr]=p(i[e][r.f.attr]),i[e][r.f.skus]=p(i[e][r.f.skus])})),e=i,Object.values(t).map((function(n){var i={};i.drop={label:"", -//! This should pull from PIC by controller -pic:n[r.f.pic],model:"B",skus:[],specs:[],product_info:["name","description","image"]},n.variations&&n.variations.map((function(t){void 0!==t.package?(i[t.package]||(i[t.package]={label:t.package,pic:n[r.f.pic],model:"B",skus:[],specs:[],product_info:[]},"list"===t.package&&(i[t.package].model="A",i[t.package].label="",//! PIC's name if on another product -i[t.package].product_info=["name","description","image"])),t.image&&(i[t.package].model="C"),console.log(n[r.f.name],t.package),i[t.package].skus.push(t.sku)):t.image?(i.varyImage||(i.varyImage={label:"",pic:n[r.f.pic],skus:[],specs:[],model:"C",product_info:["name","description","image"]}),i.varyImage.skus.push(t.sku)):i.drop.skus.push(t.sku)})),0===i.drop.skus.length&&delete i.drop,n[r.f.package]&&n[r.f.package].split(",").map((function(t){var n;(t=t.trim(),e[t][r.f.title]&i[e[t][r.f.title]]?(i["custom"+t]=i[e[t][r.f.title]],delete i[e[t][r.f.title]]):i["custom"+t]={label:"",pic:"",skus:[],model:"B",specs:[],product_info:[]},e[t][r.f.image]&&(i["custom"+t].model="D",i["custom"+t].image=e[t][r.f.image]),e[t][r.f.pic]&&(i["custom"+t].pic=e[t][r.f.pic]),e[t][r.f.skus])&&(n=i["custom"+t].skus).push.apply(n,s(e[t][r.f.skus]));e[t][r.f.attr]&&(i["custom"+t].specs=e[t][r.f.attr]),e[t][r.f.title]?i["custom"+t].label=e[t][r.f.title]:i["custom"+t].product_info=["name","description","image"],e[t][r.f.prod_info]&&(i["custom"+t].product_info=e[t][r.f.prod_info].split(",").map((function(t){return t.trim()}))),e[t][r.f.model]&&(i["custom"+t].model=e[t][r.f.model])})),t[n[r.f.pic]].packages=i})),t}function y(t){return t}function w(t,e,n){return void 0===t?(window.alert("Specify a parent product file first"),!1):void 0===e?(window.alert("Specify a variations file first"),!1):void 0!==n||(window.alert("Specify a package file first"),!1)}function b(t,e,n,r,i){if(t 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk( + uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) + )) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} + + +/***/ }), + +/***/ "./node_modules/buffer/index.js": +/*!**************************************!*\ + !*** ./node_modules/buffer/index.js ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var r=n(25),i=n(26),o=n(15);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Y(t).length;default:if(r)return F(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return x(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:w(t,e,n,r,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,r,i){var o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var c=-1;for(o=n;oa&&(n=a-u),o=n;o>=0;o--){for(var l=!0,h=0;hi&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function x(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:f>223?3:f>191?2:1;if(i+l<=n)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(c=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&f)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},u.prototype.compare=function(t,e,n,r,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),f=this.slice(r,i),c=t.slice(e,n),l=0;li)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":return v(this,t,e,n);case"latin1":case"binary":return S(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function B(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i>>8*(r?i:1-i)}function N(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i>>8*(r?i:3-i)&255}function j(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(t,e,n,r,o){return o||j(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function P(t,e,n,r,o){return o||j(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||C(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):N(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);C(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);C(this,t,e,n,i-1,-i)}var o=n-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+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):B(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):B(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):N(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return M(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return M(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return P(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return P(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--i)t[i+e]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Y(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(3))},function(t,e,n){(function(t){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,n(5).Buffer)},function(t,e,n){"use strict";n.r(e),n.d(e,"fetcher",(function(){return a})),n.d(e,"readFilePromise",(function(){return u})),n.d(e,"testCall",(function(){return c})),n.d(e,"incrementProgress",(function(){return l}));var r=n(22),i=n.n(r);function o(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var s=t.apply(e,n);function a(t){o(s,r,i,a,u,"next",t)}function u(t){o(s,r,i,a,u,"throw",t)}a(void 0)}))}}function a(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return fetch(t,e).then((function(r){if(500===r.status){if(n)return console.error("Trying one more time"),a(t,e,!1);console.error("Second attempt failed as well")}else n||console.log("Second attempt success!");return r.json()})).catch((function(t){return console.error(t,e)}))}function u(t){return f.apply(this,arguments)}function f(){return(f=s(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=new FileReader).readAsText(e),t.abrupt("return",new Promise((function(t,e){n.onerror=function(){n.abort(),e(new DOMException("Problem parsing input file."))},n.onload=function(){i()(n.result,{},(function(e,n){e?console.error("CSV parser failed: ",e):t(n)}))}})));case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function c(t){t.preventDefault(),fetch("".concat(wpApiSettings.root,"wp/v2"),{method:"get",headers:{"X-WP-Nonce":wpApiSettings.nonce,"Content-Type":"application/json"}}).then((function(t){return t.json().then(console.log)})).catch(console.log)}function l(t){return t}},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,f=[],c=!1,l=-1;function h(){c&&u&&(c=!1,u.length?f=u.concat(f):l=-1,f.length&&d())}function d(){if(!c){var t=a(h);c=!0;for(var e=f.length;e;){for(u=f,f=[];++l1)for(var n=1;n0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,a=u,console&&console.warn&&console.warn(a)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var f=u.length,c=m(u,f);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){(e=t.exports=n(17)).Stream=e,e.Readable=e,e.Writable=n(13),e.Duplex=n(2),e.Transform=n(21),e.PassThrough=n(34)},function(t,e,n){var r=n(5),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){"use strict";(function(e,r,i){var o=n(9);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=w;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:o.nextTick;w.WritableState=y;var f=Object.create(n(6));f.inherits=n(4);var c={deprecate:n(32)},l=n(18),h=n(12).Buffer,d=i.Uint8Array||function(){};var p,g=n(19);function m(){}function y(t,e){a=a||n(2),t=t||{};var r=e instanceof a;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,f=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(f||0===f)?f:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?(o.nextTick(i,r),o.nextTick(I,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(i(r),t._writableState.errorEmitted=!0,t.emit("error",r),I(t,e))}(t,n,r,e,i);else{var s=S(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||v(t,n),r?u(_,t,n,s,i):_(t,n,s,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function w(t){if(a=a||n(2),!(p.call(w,this)||this instanceof a))return new w(t);this._writableState=new y(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),l.call(this)}function b(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function _(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),I(t,e)}function v(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,b(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;n;){var f=n.chunk,c=n.encoding,l=n.callback;if(b(t,e,!1,e.objectMode?1:f.length,f,c,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function S(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function E(t,e){t._final((function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),I(t,e)}))}function I(t,e){var n=S(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(E,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}f.inherits(w,l),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===w&&(t&&t._writableState instanceof y)}})):p=function(t){return t instanceof this},w.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},w.prototype.write=function(t,e,n){var r,i=this._writableState,s=!1,a=!i.objectMode&&(r=t,h.isBuffer(r)||r instanceof d);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=m),i.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),o.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var i=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(t.emit("error",s),o.nextTick(r,s),i=!1),i}(this,i,t,n))&&(i.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n));return e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),w.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,I(t,e),n&&(e.finished?o.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(w.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),w.prototype.destroy=g.destroy,w.prototype._undestroy=g.undestroy,w.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(8),n(16).setImmediate,n(3))},function(t,e,n){t.exports=function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){if(o)return o(s,!0);throw new Error("Cannot find module '"+s+"'")}var u=n[s]={exports:{}};e[s][0].call(u.exports,(function(t){return i(e[s][1][t]||t)}),u,u.exports,t,e,n,r)}return n[s].exports}for(var o=!1,s=0;s>16),c((65280&i)>>8),c(255&i);return 2==o?c(255&(i=f(t.charAt(n))<<2|f(t.charAt(n+1))>>4)):1==o&&(c((i=f(t.charAt(n))<<10|f(t.charAt(n+1))<<4|f(t.charAt(n+2))>>2)>>8&255),c(255&i)),s},t.fromByteArray=function(t){var e,n,r,i,o=t.length%3,s="";function a(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}for(e=0,r=t.length-o;e>18&63)+a(i>>12&63)+a(i>>6&63)+a(63&i);switch(o){case 1:s+=a((n=t[t.length-1])>>2),s+=a(n<<4&63),s+="==";break;case 2:s+=a((n=(t[t.length-2]<<8)+t[t.length-1])>>10),s+=a(n>>4&63),s+=a(n<<2&63),s+="="}return s}}(void 0===n?this.base64js={}:n)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(t,e,n){(function(e,r,i,o,s,a,u,f,c){var l=t("base64-js"),h=t("ieee754");function i(t,e,n){if(!(this instanceof i))return new i(t,e,n);var r,o,s,a,u,f=typeof t;if("base64"===e&&"string"==f)for(t=(r=t).trim?r.trim():r.replace(/^\s+|\s+$/g,"");t.length%4!=0;)t+="=";if("number"==f)o=T(t);else if("string"==f)o=i.byteLength(t,e);else{if("object"!=f)throw new Error("First argument needs to be a number, array or string.");o=T(t.length)}if(i._useTypedArrays?s=i._augment(new Uint8Array(o)):((s=this).length=o,s._isBuffer=!0),i._useTypedArrays&&"number"==typeof t.byteLength)s._set(t);else if(L(u=t)||i.isBuffer(u)||u&&"object"==typeof u&&"number"==typeof u.length)for(a=0;a>>0)):(e+1>>0),i}function y(t,e,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=e,"missing offset"),D(e+1>>8*(r?s:1-s)}function S(t,e,n,r,i){i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3>>8*(r?s:3-s)&255}function E(t,e,n,r,i){i||(D(null!=e,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1>8,r=e%256,i.push(r),i.push(n);return i}(e),t,n,r)}(this,t,e,n);break;default:throw new Error("Unknown encoding")}return s},i.prototype.toString=function(t,e,n){var r,i,o,s,a=this;if(t=String(t||"utf8").toLowerCase(),e=Number(e)||0,(n=void 0!==n?Number(n):n=a.length)===e)return"";switch(t){case"hex":r=function(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||rthis.length&&(r=this.length),t.length-e=this.length))return this[t]},i.prototype.readUInt16LE=function(t,e){return g(this,t,!0,e)},i.prototype.readUInt16BE=function(t,e){return g(this,t,!1,e)},i.prototype.readUInt32LE=function(t,e){return m(this,t,!0,e)},i.prototype.readUInt32BE=function(t,e){return m(this,t,!1,e)},i.prototype.readInt8=function(t,e){if(e||(D(null!=t,"missing offset"),D(t=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){return y(this,t,!0,e)},i.prototype.readInt16BE=function(t,e){return y(this,t,!1,e)},i.prototype.readInt32LE=function(t,e){return w(this,t,!0,e)},i.prototype.readInt32BE=function(t,e){return w(this,t,!1,e)},i.prototype.readFloatLE=function(t,e){return b(this,t,!0,e)},i.prototype.readFloatBE=function(t,e){return b(this,t,!1,e)},i.prototype.readDoubleLE=function(t,e){return _(this,t,!0,e)},i.prototype.readDoubleBE=function(t,e){return _(this,t,!1,e)},i.prototype.writeUInt8=function(t,e,n){n||(D(null!=t,"missing value"),D(null!=e,"missing offset"),D(e=this.length||(this[e]=t)},i.prototype.writeUInt16LE=function(t,e,n){v(this,t,e,!0,n)},i.prototype.writeUInt16BE=function(t,e,n){v(this,t,e,!1,n)},i.prototype.writeUInt32LE=function(t,e,n){S(this,t,e,!0,n)},i.prototype.writeUInt32BE=function(t,e,n){S(this,t,e,!1,n)},i.prototype.writeInt8=function(t,e,n){n||(D(null!=t,"missing value"),D(null!=e,"missing offset"),D(e=this.length||(0<=t?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n))},i.prototype.writeInt16LE=function(t,e,n){E(this,t,e,!0,n)},i.prototype.writeInt16BE=function(t,e,n){E(this,t,e,!1,n)},i.prototype.writeInt32LE=function(t,e,n){I(this,t,e,!0,n)},i.prototype.writeInt32BE=function(t,e,n){I(this,t,e,!1,n)},i.prototype.writeFloatLE=function(t,e,n){x(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){x(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){A(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){A(this,t,e,!1,n)},i.prototype.fill=function(t,e,n){if(t=t||0,e=e||0,n=n||this.length,"string"==typeof t&&(t=t.charCodeAt(0)),D("number"==typeof t&&!isNaN(t),"value is not a number"),D(e<=n,"end < start"),n!==e&&0!==this.length){D(0<=e&&e"},i.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(i._useTypedArrays)return new i(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;e=e.length||i>=t.length);i++)e[i+n]=t[i];return i}function j(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}function M(t,e){D("number"==typeof t,"cannot write a non-number as a number"),D(0<=t,"specified a negative value for writing an unsigned value"),D(t<=e,"value is larger than maximum value for type"),D(Math.floor(t)===t,"value has a fractional component")}function P(t,e,n){D("number"==typeof t,"cannot write a non-number as a number"),D(t<=e,"value larger than maximum allowed value"),D(n<=t,"value smaller than minimum allowed value"),D(Math.floor(t)===t,"value has a fractional component")}function U(t,e,n){D("number"==typeof t,"cannot write a non-number as a number"),D(t<=e,"value larger than maximum allowed value"),D(n<=t,"value smaller than minimum allowed value")}function D(t,e){if(!t)throw new Error(e||"Failed assertion")}i._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=k.get,t.set=k.set,t.write=k.write,t.toString=k.toString,t.toLocaleString=k.toString,t.toJSON=k.toJSON,t.copy=k.copy,t.slice=k.slice,t.readUInt8=k.readUInt8,t.readUInt16LE=k.readUInt16LE,t.readUInt16BE=k.readUInt16BE,t.readUInt32LE=k.readUInt32LE,t.readUInt32BE=k.readUInt32BE,t.readInt8=k.readInt8,t.readInt16LE=k.readInt16LE,t.readInt16BE=k.readInt16BE,t.readInt32LE=k.readInt32LE,t.readInt32BE=k.readInt32BE,t.readFloatLE=k.readFloatLE,t.readFloatBE=k.readFloatBE,t.readDoubleLE=k.readDoubleLE,t.readDoubleBE=k.readDoubleBE,t.writeUInt8=k.writeUInt8,t.writeUInt16LE=k.writeUInt16LE,t.writeUInt16BE=k.writeUInt16BE,t.writeUInt32LE=k.writeUInt32LE,t.writeUInt32BE=k.writeUInt32BE,t.writeInt8=k.writeInt8,t.writeInt16LE=k.writeInt16LE,t.writeInt16BE=k.writeInt16BE,t.writeInt32LE=k.writeInt32LE,t.writeInt32BE=k.writeInt32BE,t.writeFloatLE=k.writeFloatLE,t.writeFloatBE=k.writeFloatBE,t.writeDoubleLE=k.writeDoubleLE,t.writeDoubleBE=k.writeDoubleBE,t.fill=k.fill,t.inspect=k.inspect,t.toArrayBuffer=k.toArrayBuffer,t}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(t,e,n){(function(n,r,i,o,s,a,u,f,c){var l=new(i=t("buffer").Buffer)(4);l.fill(0),e.exports={hash:function(t,e,n,r){return i.isBuffer(t)||(t=new i(t)),function(t,e,n){for(var r=new i(e),o=n?r.writeInt32BE:r.writeInt32LE,s=0;sg?e=t(e):e.length>5]|=128<>>9<<4)]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,s=0;s>>32-a,n);var s,a}function p(t,e,n,r,i,o,s){return d(e&n|~e&r,t,e,i,o,s)}function g(t,e,n,r,i,o,s){return d(e&r|n&~r,t,e,i,o,s)}function m(t,e,n,r,i,o,s){return d(e^n^r,t,e,i,o,s)}function y(t,e,n,r,i,o,s){return d(n^(e|~r),t,e,i,o,s)}function w(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}e.exports=function(t){return l.hash(t,h,16)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(t,e,n){(function(t,n,r,i,o,s,a,u,f){var c;c=function(t){for(var e,n=new Array(t),r=0;r>>((3&r)<<3)&255;return n},e.exports=c}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(t,e,n){(function(n,r,i,o,s,a,u,f,c){var l=t("./helpers");function h(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var n,r=Array(80),i=1732584193,o=-271733879,s=-1732584194,a=271733878,u=-1009589776,f=0;f>16)+(e>>16)+(n>>16)<<16|65535&n}function g(t,e){return t<>>32-e}e.exports=function(t){return l.hash(t,h,20,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(t,e,n){(function(n,r,i,o,s,a,u,f,c){function l(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function h(t,e){return t>>>e|t<<32-e}function d(t,e){return t>>>e}function p(t,e){var n,r,i,o,s,a,u,f,c,p,g,m,y,w,b,_,v,S,E=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),I=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),x=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var A=0;A>1,c=-7,l=n?i-1:0,h=n?-1:1,d=t[e+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=a;0>=-c,c+=r;0>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=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=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),2<=(e+=1<=s+l?h/u:h*Math.pow(2,1-l))*u&&(s++,u/=2),c<=s+l?(a=0,s=c):1<=s+l?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));8<=i;t[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(27),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(3))},function(t,e,n){"use strict";(function(e,r){var i=n(9);t.exports=b;var o,s=n(15);b.ReadableState=w;n(10).EventEmitter;var a=function(t,e){return t.listeners(e).length},u=n(18),f=n(12).Buffer,c=e.Uint8Array||function(){};var l=Object.create(n(6));l.inherits=n(4);var h=n(29),d=void 0;d=h&&h.debuglog?h.debuglog("stream"):function(){};var p,g=n(30),m=n(19);l.inherits(b,u);var y=["error","close","destroy","pause","resume"];function w(t,e){t=t||{};var r=e instanceof(o=o||n(2));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,s=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=n(20).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function b(t){if(o=o||n(2),!(this instanceof b))return new b(t);this._readableState=new w(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function _(t,e,n,r,i){var o,s=t._readableState;null===e?(s.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,E(t)}(t,s)):(i||(o=function(t,e){var n;r=e,f.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(s,e)),o?t.emit("error",o):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===f.prototype||(e=function(t){return f.from(t)}(e)),r?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):v(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?v(t,s,e,!1):x(t,s)):v(t,s,e,!1))):r||(s.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function E(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(I,t):I(t))}function I(t){d("emit readable"),t.emit("readable"),T(t)}function x(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(A,t,e))}function A(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;to.length?o.length:t;if(s===o.length?i+=o:i+=o.slice(0,t),0===(t-=s)){s===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(s));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=f.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,s=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,s),0===(t-=s)){s===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(s));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function R(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(C,e,t))}function C(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function B(t,e){for(var n=0,r=t.length;n=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):E(this),null;if(0===(t=S(t,e))&&e.ended)return 0===e.length&&R(this),null;var r,i=e.needReadable;return d("need readable",i),(0===e.length||e.length-t0?L(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&R(this)),null!==r&&this.emit("data",r),r},b.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:b;function f(e,r){d("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),t.removeListener("close",y),t.removeListener("finish",w),t.removeListener("drain",l),t.removeListener("error",m),t.removeListener("unpipe",f),n.removeListener("end",c),n.removeListener("end",b),n.removeListener("data",g),h=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function c(){d("onend"),t.end()}o.endEmitted?i.nextTick(u):n.once("end",u),t.on("unpipe",f);var l=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,T(t))}}(n);t.on("drain",l);var h=!1;var p=!1;function g(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==B(o.pipes,t))&&!h&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function m(e){d("onerror",e),b(),t.removeListener("error",m),0===a(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",w),b()}function w(){d("onfinish"),t.removeListener("close",y),b()}function b(){d("unpipe"),n.unpipe(t)}return n.on("data",g),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?s(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",m),t.once("close",y),t.once("finish",w),t.emit("pipe",n),o.flowing||(d("pipe resume"),n.resume()),t},b.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function c(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(t.lastNeed=i-1),i;if(--r=0)return i>0&&(t.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";t.exports=s;var r=n(2),i=Object.create(n(6));function o(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length=0);else{if("string"!=typeof n.max_record_size||!/\d+/.test(n.max_record_size))throw new Error("Invalid Option: max_record_size must be a positive integer, got "+JSON.stringify(n.max_record_size));n.max_record_size=parseInt(n.max_record_size)}if(void 0===n.objname||null===n.objname||!1===n.objname)n.objname=void 0;else if(e.isBuffer(n.objname)){if(0===n.objname.length)throw new Error("Invalid Option: objname must be a non empty buffer");n.objname=n.objname.toString()}else{if("string"!=typeof n.objname)throw new Error("Invalid Option: objname must be a string or a buffer, got "+n.objname);if(0===n.objname.length)throw new Error("Invalid Option: objname must be a non empty string")}if(void 0===n.on_record||null===n.on_record)n.on_record=void 0;else if("function"!=typeof n.on_record)throw new f("CSV_INVALID_OPTION_ON_RECORD",["Invalid option `on_record`:","expect a function,","got "+JSON.stringify(n.on_record)]);if(null===n.quote||!1===n.quote||""===n.quote)n.quote=null;else{if(void 0===n.quote||!0===n.quote?n.quote=e.from('"'):"string"==typeof n.quote&&(n.quote=e.from(n.quote)),!e.isBuffer(n.quote))throw new Error("Invalid Option: quote must be a buffer or a string, got "+JSON.stringify(n.quote));if(1!==n.quote.length)throw new Error("Invalid Option Length: quote must be one character, got "+n.quote.length);n.quote=n.quote[0]}if(void 0===n.raw||null===n.raw||!1===n.raw)n.raw=!1;else if(!0!==n.raw)throw new Error("Invalid Option: raw must be true, got "+JSON.stringify(n.raw));if(n.record_delimiter?Array.isArray(n.record_delimiter)||(n.record_delimiter=[n.record_delimiter]):n.record_delimiter=[],n.record_delimiter=n.record_delimiter.map((function(t){return"string"==typeof t&&(t=e.from(t)),t})),"boolean"==typeof n.relax);else{if(void 0!==n.relax&&null!==n.relax)throw new Error("Invalid Option: relax must be a boolean, got "+JSON.stringify(n.relax));n.relax=!1}if("boolean"==typeof n.relax_column_count);else{if(void 0!==n.relax_column_count&&null!==n.relax_column_count)throw new Error("Invalid Option: relax_column_count must be a boolean, got "+JSON.stringify(n.relax_column_count));n.relax_column_count=!1}if("boolean"==typeof n.relax_column_count_less);else{if(void 0!==n.relax_column_count_less&&null!==n.relax_column_count_less)throw new Error("Invalid Option: relax_column_count_less must be a boolean, got "+JSON.stringify(n.relax_column_count_less));n.relax_column_count_less=!1}if("boolean"==typeof n.relax_column_count_more);else{if(void 0!==n.relax_column_count_more&&null!==n.relax_column_count_more)throw new Error("Invalid Option: relax_column_count_more must be a boolean, got "+JSON.stringify(n.relax_column_count_more));n.relax_column_count_more=!1}if("boolean"==typeof n.skip_empty_lines);else{if(void 0!==n.skip_empty_lines&&null!==n.skip_empty_lines)throw new Error("Invalid Option: skip_empty_lines must be a boolean, got "+JSON.stringify(n.skip_empty_lines));n.skip_empty_lines=!1}if("boolean"==typeof n.skip_lines_with_empty_values);else{if(void 0!==n.skip_lines_with_empty_values&&null!==n.skip_lines_with_empty_values)throw new Error("Invalid Option: skip_lines_with_empty_values must be a boolean, got "+JSON.stringify(n.skip_lines_with_empty_values));n.skip_lines_with_empty_values=!1}if("boolean"==typeof n.skip_lines_with_error);else{if(void 0!==n.skip_lines_with_error&&null!==n.skip_lines_with_error)throw new Error("Invalid Option: skip_lines_with_error must be a boolean, got "+JSON.stringify(n.skip_lines_with_error));n.skip_lines_with_error=!1}if(void 0===n.rtrim||null===n.rtrim||!1===n.rtrim)n.rtrim=!1;else if(!0!==n.rtrim)throw new Error("Invalid Option: rtrim must be a boolean, got "+JSON.stringify(n.rtrim));if(void 0===n.ltrim||null===n.ltrim||!1===n.ltrim)n.ltrim=!1;else if(!0!==n.ltrim)throw new Error("Invalid Option: ltrim must be a boolean, got "+JSON.stringify(n.ltrim));if(void 0===n.trim||null===n.trim||!1===n.trim)n.trim=!1;else if(!0!==n.trim)throw new Error("Invalid Option: trim must be a boolean, got "+JSON.stringify(n.trim));if(!0===n.trim&&!1!==t.ltrim?n.ltrim=!0:!0!==n.ltrim&&(n.ltrim=!1),!0===n.trim&&!1!==t.rtrim?n.rtrim=!0:!0!==n.rtrim&&(n.rtrim=!1),void 0===n.to||null===n.to)n.to=-1;else{if("string"==typeof n.to&&/\d+/.test(n.to)&&(n.to=parseInt(n.to)),!Number.isInteger(n.to))throw new Error("Invalid Option: to must be an integer, got "+JSON.stringify(t.to));if(n.to<=0)throw new Error("Invalid Option: to must be a positive integer greater than 0, got "+JSON.stringify(t.to))}if(void 0===n.to_line||null===n.to_line)n.to_line=-1;else{if("string"==typeof n.to_line&&/\d+/.test(n.to_line)&&(n.to_line=parseInt(n.to_line)),!Number.isInteger(n.to_line))throw new Error("Invalid Option: to_line must be an integer, got "+JSON.stringify(t.to_line));if(n.to_line<=0)throw new Error("Invalid Option: to_line must be a positive integer greater than 0, got "+JSON.stringify(t.to_line))}this.info={comment_lines:0,empty_lines:0,invalid_field_length:0,lines:1,records:0},this.options=n,this.state={bomSkipped:!1,castField:r,commenting:!1,enabled:1===n.from_line,escaping:!1,escapeIsQuote:n.escape===n.quote,expectedRecordLength:null===n.columns?0:n.columns.length,field:new o(20),firstLineToHeaders:i,info:Object.assign({},this.info),previousBuf:void 0,quoting:!1,stop:!1,rawBuffer:new o(100),record:[],recordHasError:!1,record_length:0,recordDelimiterMaxLength:0===n.record_delimiter.length?2:Math.max(...n.record_delimiter.map(t=>t.length)),trimChars:[e.from(" ")[0],e.from("\t")[0]],wasQuoting:!1,wasRowDelimiter:!1}}_transform(t,e,n){if(!0===this.state.stop)return;const r=this.__parse(t,!1);void 0!==r&&(this.state.stop=!0),n(r)}_flush(t){if(!0===this.state.stop)return;t(this.__parse(void 0,!0))}__parse(t,n){const{bom:r,comment:i,escape:o,from_line:a,info:u,ltrim:c,max_record_size:l,quote:h,raw:d,relax:p,rtrim:g,skip_empty_lines:m,to:y,to_line:w}=this.options;let{record_delimiter:b}=this.options;const{bomSkipped:_,previousBuf:v,rawBuffer:S,escapeIsQuote:E}=this.state;let I;if(void 0===v){if(void 0===t)return void this.push(null);I=t}else I=void 0!==v&&void 0===t?v:e.concat([v,t]);if(!1===_)if(!1===r)this.state.bomSkipped=!0;else if(I.length<3){if(!1===n)return void(this.state.previousBuf=I)}else 0===s.compare(I,0,3)&&(I=I.slice(3)),this.state.bomSkipped=!0;const x=I.length;let A;for(A=0;Aw)return this.state.stop=!0,void this.push(null);if(!1===this.state.quoting&&0===b.length){this.__autoDiscoverRowDelimiter(I,A)&&(b=this.options.record_delimiter)}const t=I[A];if(!0===d&&S.append(t),13!==t&&10!==t||!1!==this.state.wasRowDelimiter||(this.state.wasRowDelimiter=!0),!0===this.state.escaping)this.state.escaping=!1;else{if(null!==o&&!0===this.state.quoting&&t===o&&A+1=a){this.state.enabled=!0,this.__resetField(),this.__resetRow(),A+=e-1;continue}{const t=this.__onField();if(void 0!==t)return t;const e=this.__onRow();if(void 0!==e)return e}if(-1!==y&&this.info.records>=y)return this.state.stop=!0,void this.push(null)}this.state.commenting=!1,A+=e-1;continue}if(this.state.commenting)continue;if(0!==(null===i?0:this.__compareBytes(i,I,A,t))){this.state.commenting=!0;continue}let n=this.__isDelimiter(t,I,A);if(0!==n){const t=this.__onField();if(void 0!==t)return t;A+=n-1;continue}}}if(!1===this.state.commenting&&0!==l&&this.state.record_length+this.state.field.length>l){const t=this.__error(new f("CSV_MAX_RECORD_SIZE",["Max Record Size:","record exceed the maximum number of tolerated bytes","of "+l,"at line "+this.info.lines],this.__context()));if(void 0!==t)return t}const e=!1===c||!0===this.state.quoting||0!==this.state.field.length||!this.__isCharTrimable(t),n=!1===g||!1===this.state.wasQuoting;if(!0===e&&!0===n)this.state.field.append(t);else if(!0===g&&!this.__isCharTrimable(t)){const t=this.__error(new f("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE",["Invalid Closing Quote:","found non trimable byte after quote","at line "+this.info.lines],this.__context()));if(void 0!==t)return t}}if(!0===n)if(!0===this.state.quoting){const t=this.__error(new f("CSV_QUOTE_NOT_CLOSED",["Quote Not Closed:","the parsing is finished with an opening quote at line "+this.info.lines],this.__context()));if(void 0!==t)return t}else if(!0===this.state.wasQuoting||0!==this.state.record.length||0!==this.state.field.length){const t=this.__onField();if(void 0!==t)return t;const e=this.__onRow();if(void 0!==e)return e}else!0===this.state.wasRowDelimiter?this.info.empty_lines++:!0===this.state.commenting&&this.info.comment_lines++;else this.state.previousBuf=I.slice(A);!0===this.state.wasRowDelimiter&&(this.info.lines++,this.state.wasRowDelimiter=!1)}__isCharTrimable(t){return 32===t||9===t||13===t||10===t||12===t}__onRow(){const{columns:t,columns_duplicates_to_array:e,info:n,from:r,relax_column_count:i,relax_column_count_less:o,relax_column_count_more:s,raw:a,skip_lines_with_empty_values:u}=this.options,{enabled:c,record:l}=this.state;if(!1===c)return this.__resetRow();const d=l.length;if(!0===t)return h(l)?void this.__resetRow():this.__firstLineToColumns(l);if(!1===t&&0===this.info.records&&(this.state.expectedRecordLength=d),d!==this.state.expectedRecordLength)if(!0===i||!0===o&&dthis.state.expectedRecordLength)this.info.invalid_field_length++;else if(!1===t){const t=this.__error(new f("CSV_INCONSISTENT_RECORD_LENGTH",["Invalid Record Length:",`expect ${this.state.expectedRecordLength},`,`got ${d} on line ${this.info.lines}`],this.__context(),{record:l}));if(void 0!==t)return t}else{const e=this.__error(new f("CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH",["Invalid Record Length:",`columns length is ${t.length},`,`got ${d} on line ${this.info.lines}`],this.__context(),{record:l}));if(void 0!==e)return e}if(!0===u&&h(l))this.__resetRow();else{if(!0===this.state.recordHasError)return this.__resetRow(),void(this.state.recordHasError=!1);if(this.info.records++,1===r||this.info.records>=r)if(!1!==t){const r={};for(let n=0,i=l.length;n=0}__compareBytes(t,e,n,r){if(t[0]!==r)return 0;const i=t.length;for(let r=1;rthis.state.record.length?t[this.state.record.length].name:null:this.state.record.length,empty_lines:this.info.empty_lines,header:!0===t,index:this.state.record.length,invalid_field_length:this.info.invalid_field_length,quoting:this.state.wasQuoting,lines:this.info.lines,records:this.info.records}}}const u=function(){let t,n,i;for(let r in arguments){const o=arguments[r],s=typeof o;if(void 0!==t||"string"!=typeof o&&!e.isBuffer(o))if(void 0===n&&l(o))n=o;else{if(void 0!==i||"function"!==s)throw new f("CSV_INVALID_ARGUMENT",["Invalid argument:",`got ${JSON.stringify(o)} at index ${r}`]);i=o}else t=o}const o=new a(n);if(i){const t=void 0===n||void 0===n.objname?[]:{};o.on("readable",(function(){let e;for(;null!==(e=this.read());)void 0===n||void 0===n.objname?t.push(e):t[e[0]]=e[1]})),o.on("error",(function(t){i(t,void 0,o.info)})),o.on("end",(function(){i(void 0,t,o.info)}))}return void 0!==t&&("function"==typeof r?r((function(){o.write(t),o.end()})):(o.write(t),o.end())),o};class f extends Error{constructor(t,n,...r){Array.isArray(n)&&(n=n.join(" ")),super(n),void 0!==Error.captureStackTrace&&Error.captureStackTrace(this,f),this.code=t;for(const t of r)for(const n in t){const r=t[n];this[n]=e.isBuffer(r)?r.toString():null==r?r:JSON.parse(JSON.stringify(r))}}}u.Parser=a,u.CsvError=f,t.exports=u;const c=function(t){return t.replace(/([A-Z])/g,(function(t,e){return"_"+e.toLowerCase()}))},l=function(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)},h=function(t){return t.every(t=>null==t||t.toString&&""===t.toString().trim())},d=function(t){const e=[];for(let n=0,r=t.length;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]&&arguments[1];return new Promise((function(n,r){t||r(t),fetch("".concat(wpApiSettings.root,"wp/v2/product/").concat(t,"?force=true"),{method:"delete",headers:{"X-WP-Nonce":wpApiSettings.nonce,"Content-Type":"application/json"}}).then((function(t){n(t),e&&console.log(t)})).catch(console.error)}))}function d(t,e){return p.apply(this,arguments)}function p(){return(p=f(regeneratorRuntime.mark((function t(e,n){var r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=[];case 1:if(!(01&&void 0!==u[1]&&u[1],s={title:e[o.f.name],content:e[o.f.desc],excerpt:e[o.f.short_desc],status:e[o.f.visibility],terms:e.terms,meta:{SKU:e[o.f.sku],PIC:e[o.f.pic],ordering_info:e[o.f.orderInfo],product_type:e[o.f.type],product_hash:e.checksum,main_model:e[o.f.main_model],part_number_finder:e[o.f.pnf],search_weight:e[o.f.searchWeight]},specs:e.specs,gallery:e.gallery,variations:e.variations?Object(r.variationSlice)(e.variations,0):[],packages:Object.values(e.packages?e.packages:{}),warranty:e.warranty,features:e.features,indications:e.indications,downloads:e.downloads,related:e.related,region:e[o.f.region]},a="".concat(wpApiSettings.root,"wp/v2/product"),n&&(a="".concat(wpApiSettings.root,"wp/v2/product/").concat(n)),t.abrupt("return",Object(i.fetcher)(a,{method:"post",headers:{"X-WP-Nonce":wpApiSettings.nonce,"Content-Type":"application/json"},body:JSON.stringify(s)}).then((function(t){if(console.log(t),void 0!==t&&e.variations&&12&&void 0!==a[2]?a[2]:1,console.log("Posting more variations at a depth of ".concat(o)),s=JSON.stringify({variations:Object(r.variationSlice)(n,o)}),t.abrupt("return",Object(i.fetcher)("".concat(wpApiSettings.root,"wp/v2/product/").concat(e),{method:"post",headers:{"X-WP-Nonce":wpApiSettings.nonce,"Content-Type":"application/json"},body:s}).then((function(t){if(t&&o+1!==n.varies.length&&16>o)return y(e,n,o+1)})));case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function b(t,e,n,r){return _.apply(this,arguments)}function _(){return(_=f(regeneratorRuntime.mark((function t(e,n,r,i){var o,s,a,u,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o=n.length+r.length,f=0,i.textContent="Uploading products: 0 of ".concat(o," received"),console.log("POSTing...",n,r);case 4:if(!(00?s-4:s;for(n=0;n>16&255,u[c++]=e>>8&255,u[c++]=255&e;2===a&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,u[c++]=255&e);1===a&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e);return u},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=0,a=n-i;sa?a:s+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,n){for(var i,o,s=[],a=e;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<>1,c=-7,l=n?i-1:0,h=n?-1:1,d=t[e+l];for(l+=h,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=256*o+t[e+l],l+=h,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=256*s+t[e+l],l+=h,c-=8);if(0===o)o=1-f;else{if(o===u)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=f}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,u,f=8*o-i-1,c=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=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=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?h/u:h*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=c?(a=0,s=c):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;t[n+d]=255&s,d+=p,s/=256,f-=8);t[n+d-p]|=128*g}},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,s,a,u=1,f={},c=!1,l=t.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(t);h=h&&h.setTimeout?h:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},r=function(t){o.port2.postMessage(t)}):l&&"onreadystatechange"in l.createElement("script")?(i=l.documentElement,r=function(t){var e=l.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(p,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&p(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),r=function(e){t.postMessage(s+e,"*")}),h.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e,n,i,o=r.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,n=o,i=a,e.copy(n,i),a+=s.data.length,s=s.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(3))},function(t,e,n){ +/* eslint-disable no-proto */ + + + +var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js") +var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js") +var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js") + +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * Due to various browser bugs, sometimes the Object implementation will be used even + * when the browser supports typed arrays. + * + * Note: + * + * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. + * + * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. + * + * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of + * incorrect length in some situations. + + * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they + * get the Object implementation, which is slower but behaves correctly. + */ +Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined + ? global.TYPED_ARRAY_SUPPORT + : typedArraySupport() + +/* + * Export kMaxLength after typed array support is determined. + */ +exports.kMaxLength = kMaxLength() + +function typedArraySupport () { + try { + var arr = new Uint8Array(1) + arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} + return arr.foo() === 42 && // typed array instances can be augmented + typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` + arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` + } catch (e) { + return false + } +} + +function kMaxLength () { + return Buffer.TYPED_ARRAY_SUPPORT + ? 0x7fffffff + : 0x3fffffff +} + +function createBuffer (that, length) { + if (kMaxLength() < length) { + throw new RangeError('Invalid typed array length') + } + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = new Uint8Array(length) + that.__proto__ = Buffer.prototype + } else { + // Fallback: Return an object instance of the Buffer class + if (that === null) { + that = new Buffer(length) + } + that.length = length + } + + return that +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + +function Buffer (arg, encodingOrOffset, length) { + if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { + return new Buffer(arg, encodingOrOffset, length) + } + + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new Error( + 'If encoding is specified then the first argument must be a string' + ) + } + return allocUnsafe(this, arg) + } + return from(this, arg, encodingOrOffset, length) +} + +Buffer.poolSize = 8192 // not used by this implementation + +// TODO: Legacy, not needed anymore. Remove in next major version. +Buffer._augment = function (arr) { + arr.__proto__ = Buffer.prototype + return arr +} + +function from (that, value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number') + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, encodingOrOffset, length) + } + + if (typeof value === 'string') { + return fromString(that, value, encodingOrOffset) + } + + return fromObject(that, value) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(null, value, encodingOrOffset, length) +} + +if (Buffer.TYPED_ARRAY_SUPPORT) { + Buffer.prototype.__proto__ = Uint8Array.prototype + Buffer.__proto__ = Uint8Array + if (typeof Symbol !== 'undefined' && Symbol.species && + Buffer[Symbol.species] === Buffer) { + // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true + }) + } +} + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number') + } else if (size < 0) { + throw new RangeError('"size" argument must not be negative') + } +} + +function alloc (that, size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(that, size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' + ? createBuffer(that, size).fill(fill, encoding) + : createBuffer(that, size).fill(fill) + } + return createBuffer(that, size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(null, size, fill, encoding) +} + +function allocUnsafe (that, size) { + assertSize(size) + that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) + if (!Buffer.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + that[i] = 0 + } + } + return that +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(null, size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(null, size) +} + +function fromString (that, string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding') + } + + var length = byteLength(string, encoding) | 0 + that = createBuffer(that, length) + + var actual = that.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + that = that.slice(0, actual) + } + + return that +} + +function fromArrayLike (that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0 + that = createBuffer(that, length) + for (var i = 0; i < length; i += 1) { + that[i] = array[i] & 255 + } + return that +} + +function fromArrayBuffer (that, array, byteOffset, length) { + array.byteLength // this throws if `array` is not a valid ArrayBuffer + + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('\'offset\' is out of bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('\'length\' is out of bounds') + } + + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array) + } else if (length === undefined) { + array = new Uint8Array(array, byteOffset) + } else { + array = new Uint8Array(array, byteOffset, length) + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = array + that.__proto__ = Buffer.prototype + } else { + // Fallback: Return an object instance of the Buffer class + that = fromArrayLike(that, array) + } + return that +} + +function fromObject (that, obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0 + that = createBuffer(that, len) + + if (that.length === 0) { + return that + } + + obj.copy(that, 0, 0, len) + return that + } + + if (obj) { + if ((typeof ArrayBuffer !== 'undefined' && + obj.buffer instanceof ArrayBuffer) || 'length' in obj) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0) + } + return fromArrayLike(that, obj) + } + + if (obj.type === 'Buffer' && isArray(obj.data)) { + return fromArrayLike(that, obj.data) + } + } + + throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') +} + +function checked (length) { + // Note: cannot use `length < kMaxLength()` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= kMaxLength()) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + kMaxLength().toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return !!(b != null && b._isBuffer) +} + +Buffer.compare = function compare (a, b) { + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError('Arguments must be Buffers') + } + + if (a === b) return 0 + + var x = a.length + var y = b.length + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + var i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos) + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && + (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + string = '' + string + } + + var len = string.length + if (len === 0) return 0 + + // Use a for loop to avoid recursion + var loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + case undefined: + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) return utf8ToBytes(string).length // assume utf8 + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + var loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect +// Buffer instances. +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + var len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + var len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + var len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + var length = this.length | 0 + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + if (this.length > 0) { + str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') + if (this.length > max) str += ' ... ' + } + return '' +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (!Buffer.isBuffer(target)) { + throw new TypeError('Argument must be a Buffer') + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) + + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (isNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (Buffer.TYPED_ARRAY_SUPPORT && + typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + var i + if (dir) { + var foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + var found = true + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + var remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + // must be an even number of digits + var strLen = string.length + if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') + + if (length > strLen / 2) { + length = strLen / 2 + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16) + if (isNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset | 0 + if (isFinite(length)) { + length = length | 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + // legacy write(string, encoding, offset, length) - remove in v0.13 + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + var loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + return asciiWrite(this, string, offset, length) + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + var res = [] + + var i = start + while (i < end) { + var firstByte = buf[i] + var codePoint = null + var bytesPerSequence = (firstByte > 0xEF) ? 4 + : (firstByte > 0xDF) ? 3 + : (firstByte > 0xBF) ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +var MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + var len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = '' + var i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + var len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + var out = '' + for (var i = start; i < end; ++i) { + out += toHex(buf[i]) + } + return out +} + +function utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end) + var res = '' + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + var len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + var newBuf + if (Buffer.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end) + newBuf.__proto__ = Buffer.prototype + } else { + var sliceLen = end - start + newBuf = new Buffer(sliceLen, undefined) + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start] + } + } + + return newBuf +} + +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var i = byteLength + var mul = 1 + var val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) + this[offset] = (value & 0xff) + return offset + 1 +} + +function objectWriteUInt16 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffff + value + 1 + for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { + buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> + (littleEndian ? i : 1 - i) * 8 + } +} + +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + } else { + objectWriteUInt16(this, value, offset, true) + } + return offset + 2 +} + +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + } else { + objectWriteUInt16(this, value, offset, false) + } + return offset + 2 +} + +function objectWriteUInt32 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffffffff + value + 1 + for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { + buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff + } +} + +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, true) + } + return offset + 4 +} + +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, false) + } + return offset + 4 +} + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = 0 + var mul = 1 + var sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = byteLength - 1 + var mul = 1 + var sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + } else { + objectWriteUInt16(this, value, offset, true) + } + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + } else { + objectWriteUInt16(this, value, offset, false) + } + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + } else { + objectWriteUInt32(this, value, offset, true) + } + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, false) + } + return offset + 4 +} + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + var len = end - start + var i + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } + } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start] + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, start + len), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if (code < 256) { + val = code + } + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + } else if (typeof val === 'number') { + val = val & 255 + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + var i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : utf8ToBytes(new Buffer(val, encoding).toString()) + var len = bytes.length + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// HELPER FUNCTIONS +// ================ + +var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = stringtrim(str).replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function stringtrim (str) { + if (str.trim) return str.trim() + return str.replace(/^\s+|\s+$/g, '') +} + +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) +} + +function utf8ToBytes (string, units) { + units = units || Infinity + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +function isnan (val) { + return val !== val // eslint-disable-line no-self-compare +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/core-util-is/lib/util.js": +/*!***********************************************!*\ + !*** ./node_modules/core-util-is/lib/util.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer)) + +/***/ }), + +/***/ "./node_modules/csv-parse/lib/ResizeableBuffer.js": +/*!********************************************************!*\ + !*** ./node_modules/csv-parse/lib/ResizeableBuffer.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) { + +class ResizeableBuffer{ + constructor(size=100){ + this.size = size + this.length = 0 + this.buf = Buffer.alloc(size) + } + prepend(val){ + const length = this.length++ + if(length === this.size){ + this.resize() + } + const buf = this.clone() + this.buf[0] = val + buf.copy(this.buf,1, 0, length) + } + append(val){ + const length = this.length++ + if(length === this.size){ + this.resize() + } + this.buf[length] = val + } + clone(){ + return Buffer.from(this.buf.slice(0, this.length)) + } + resize(){ + const length = this.length + this.size = this.size * 2 + const buf = Buffer.alloc(this.size) + this.buf.copy(buf,0, 0, length) + this.buf = buf + } + toString(){ + return this.buf.slice(0, this.length).toString() + } + toJSON(){ + return this.toString() + } + reset(){ + this.length = 0 + } +} + +module.exports = ResizeableBuffer + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer)) + +/***/ }), + +/***/ "./node_modules/csv-parse/lib/index.js": +/*!*********************************************!*\ + !*** ./node_modules/csv-parse/lib/index.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer, setImmediate) { +/* +CSV Parse + +Please look at the [project documentation](https://csv.js.org/parse/) for +additional information. +*/ + +const { Transform } = __webpack_require__(/*! stream */ "./node_modules/stream-browserify/index.js") +const ResizeableBuffer = __webpack_require__(/*! ./ResizeableBuffer */ "./node_modules/csv-parse/lib/ResizeableBuffer.js") + +const tab = 9 +const nl = 10 +const np = 12 +const cr = 13 +const space = 32 +const bom_utf8 = Buffer.from([239, 187, 191]) + +class Parser extends Transform { + constructor(opts = {}){ + super({...{readableObjectMode: true}, ...opts}) + const options = {} + // Merge with user options + for(let opt in opts){ + options[underscore(opt)] = opts[opt] + } + // Normalize option `bom` + if(options.bom === undefined || options.bom === null || options.bom === false){ + options.bom = false + }else if(options.bom !== true){ + throw new CsvError('CSV_INVALID_OPTION_BOM', [ + 'Invalid option bom:', 'bom must be true,', + `got ${JSON.stringify(options.bom)}` + ]) + } + // Normalize option `cast` + let fnCastField = null + if(options.cast === undefined || options.cast === null || options.cast === false || options.cast === ''){ + options.cast = undefined + }else if(typeof options.cast === 'function'){ + fnCastField = options.cast + options.cast = true + }else if(options.cast !== true){ + throw new CsvError('CSV_INVALID_OPTION_CAST', [ + 'Invalid option cast:', 'cast must be true or a function,', + `got ${JSON.stringify(options.cast)}` + ]) + } + // Normalize option `cast_date` + if(options.cast_date === undefined || options.cast_date === null || options.cast_date === false || options.cast_date === ''){ + options.cast_date = false + }else if(options.cast_date === true){ + options.cast_date = function(value){ + const date = Date.parse(value) + return !isNaN(date) ? new Date(date) : value + } + }else if(typeof options.cast_date !== 'function'){ + throw new CsvError('CSV_INVALID_OPTION_CAST_DATE', [ + 'Invalid option cast_date:', 'cast_date must be true or a function,', + `got ${JSON.stringify(options.cast_date)}` + ]) + } + // Normalize option `columns` + let fnFirstLineToHeaders = null + if(options.columns === true){ + // Fields in the first line are converted as-is to columns + fnFirstLineToHeaders = undefined + }else if(typeof options.columns === 'function'){ + fnFirstLineToHeaders = options.columns + options.columns = true + }else if(Array.isArray(options.columns)){ + options.columns = normalizeColumnsArray(options.columns) + }else if(options.columns === undefined || options.columns === null || options.columns === false){ + options.columns = false + }else{ + throw new CsvError('CSV_INVALID_OPTION_COLUMNS', [ + 'Invalid option columns:', + 'expect an object, a function or true,', + `got ${JSON.stringify(options.columns)}` + ]) + } + // Normalize option `columns_duplicates_to_array` + if(options.columns_duplicates_to_array === undefined || options.columns_duplicates_to_array === null || options.columns_duplicates_to_array === false){ + options.columns_duplicates_to_array = false + }else if(options.columns_duplicates_to_array !== true){ + throw new CsvError('CSV_INVALID_OPTION_COLUMNS_DUPLICATES_TO_ARRAY', [ + 'Invalid option columns_duplicates_to_array:', + 'expect an boolean,', + `got ${JSON.stringify(options.columns_duplicates_to_array)}` + ]) + } + // Normalize option `comment` + if(options.comment === undefined || options.comment === null || options.comment === false || options.comment === ''){ + options.comment = null + }else{ + if(typeof options.comment === 'string'){ + options.comment = Buffer.from(options.comment) + } + if(!Buffer.isBuffer(options.comment)){ + throw new CsvError('CSV_INVALID_OPTION_COMMENT', [ + 'Invalid option comment:', + 'comment must be a buffer or a string,', + `got ${JSON.stringify(options.comment)}` + ]) + } + } + // Normalize option `delimiter` + const delimiter_json = JSON.stringify(options.delimiter) + if(!Array.isArray(options.delimiter)) options.delimiter = [options.delimiter] + if(options.delimiter.length === 0){ + throw new CsvError('CSV_INVALID_OPTION_DELIMITER', [ + 'Invalid option delimiter:', + 'delimiter must be a non empty string or buffer or array of string|buffer,', + `got ${delimiter_json}` + ]) + } + options.delimiter = options.delimiter.map(function(delimiter){ + if(delimiter === undefined || delimiter === null || delimiter === false){ + return Buffer.from(',') + } + if(typeof delimiter === 'string'){ + delimiter = Buffer.from(delimiter) + } + if( !Buffer.isBuffer(delimiter) || delimiter.length === 0){ + throw new CsvError('CSV_INVALID_OPTION_DELIMITER', [ + 'Invalid option delimiter:', + 'delimiter must be a non empty string or buffer or array of string|buffer,', + `got ${delimiter_json}` + ]) + } + return delimiter + }) + // Normalize option `escape` + if(options.escape === undefined || options.escape === true){ + options.escape = Buffer.from('"') + }else if(typeof options.escape === 'string'){ + options.escape = Buffer.from(options.escape) + }else if (options.escape === null || options.escape === false){ + options.escape = null + } + if(options.escape !== null){ + if(!Buffer.isBuffer(options.escape)){ + throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(options.escape)}`) + }else if(options.escape.length !== 1){ + throw new Error(`Invalid Option Length: escape must be one character, got ${options.escape.length}`) + }else{ + options.escape = options.escape[0] + } + } + // Normalize option `from` + if(options.from === undefined || options.from === null){ + options.from = 1 + }else{ + if(typeof options.from === 'string' && /\d+/.test(options.from)){ + options.from = parseInt(options.from) + } + if(Number.isInteger(options.from)){ + if(options.from < 0){ + throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`) + } + }else{ + throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`) + } + } + // Normalize option `from_line` + if(options.from_line === undefined || options.from_line === null){ + options.from_line = 1 + }else{ + if(typeof options.from_line === 'string' && /\d+/.test(options.from_line)){ + options.from_line = parseInt(options.from_line) + } + if(Number.isInteger(options.from_line)){ + if(options.from_line <= 0){ + throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`) + } + }else{ + throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`) + } + } + // Normalize option `info` + if(options.info === undefined || options.info === null || options.info === false){ + options.info = false + }else if(options.info !== true){ + throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`) + } + // Normalize option `max_record_size` + if(options.max_record_size === undefined || options.max_record_size === null || options.max_record_size === false){ + options.max_record_size = 0 + }else if(Number.isInteger(options.max_record_size) && options.max_record_size >= 0){ + // Great, nothing to do + }else if(typeof options.max_record_size === 'string' && /\d+/.test(options.max_record_size)){ + options.max_record_size = parseInt(options.max_record_size) + }else{ + throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`) + } + // Normalize option `objname` + if(options.objname === undefined || options.objname === null || options.objname === false){ + options.objname = undefined + }else if(Buffer.isBuffer(options.objname)){ + if(options.objname.length === 0){ + throw new Error(`Invalid Option: objname must be a non empty buffer`) + } + options.objname = options.objname.toString() + }else if(typeof options.objname === 'string'){ + if(options.objname.length === 0){ + throw new Error(`Invalid Option: objname must be a non empty string`) + } + // Great, nothing to do + }else{ + throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`) + } + // Normalize option `on_record` + if(options.on_record === undefined || options.on_record === null){ + options.on_record = undefined + }else if(typeof options.on_record !== 'function'){ + throw new CsvError('CSV_INVALID_OPTION_ON_RECORD', [ + 'Invalid option `on_record`:', + 'expect a function,', + `got ${JSON.stringify(options.on_record)}` + ]) + } + // Normalize option `quote` + if(options.quote === null || options.quote === false || options.quote === ''){ + options.quote = null + }else{ + if(options.quote === undefined || options.quote === true){ + options.quote = Buffer.from('"') + }else if(typeof options.quote === 'string'){ + options.quote = Buffer.from(options.quote) + } + if(!Buffer.isBuffer(options.quote)){ + throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`) + }else if(options.quote.length !== 1){ + throw new Error(`Invalid Option Length: quote must be one character, got ${options.quote.length}`) + }else{ + options.quote = options.quote[0] + } + } + // Normalize option `raw` + if(options.raw === undefined || options.raw === null || options.raw === false){ + options.raw = false + }else if(options.raw !== true){ + throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`) + } + // Normalize option `record_delimiter` + if(!options.record_delimiter){ + options.record_delimiter = [] + }else if(!Array.isArray(options.record_delimiter)){ + options.record_delimiter = [options.record_delimiter] + } + options.record_delimiter = options.record_delimiter.map( function(rd){ + if(typeof rd === 'string'){ + rd = Buffer.from(rd) + } + return rd + }) + // Normalize option `relax` + if(typeof options.relax === 'boolean'){ + // Great, nothing to do + }else if(options.relax === undefined || options.relax === null){ + options.relax = false + }else{ + throw new Error(`Invalid Option: relax must be a boolean, got ${JSON.stringify(options.relax)}`) + } + // Normalize option `relax_column_count` + if(typeof options.relax_column_count === 'boolean'){ + // Great, nothing to do + }else if(options.relax_column_count === undefined || options.relax_column_count === null){ + options.relax_column_count = false + }else{ + throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`) + } + if(typeof options.relax_column_count_less === 'boolean'){ + // Great, nothing to do + }else if(options.relax_column_count_less === undefined || options.relax_column_count_less === null){ + options.relax_column_count_less = false + }else{ + throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(options.relax_column_count_less)}`) + } + if(typeof options.relax_column_count_more === 'boolean'){ + // Great, nothing to do + }else if(options.relax_column_count_more === undefined || options.relax_column_count_more === null){ + options.relax_column_count_more = false + }else{ + throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(options.relax_column_count_more)}`) + } + // Normalize option `skip_empty_lines` + if(typeof options.skip_empty_lines === 'boolean'){ + // Great, nothing to do + }else if(options.skip_empty_lines === undefined || options.skip_empty_lines === null){ + options.skip_empty_lines = false + }else{ + throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`) + } + // Normalize option `skip_lines_with_empty_values` + if(typeof options.skip_lines_with_empty_values === 'boolean'){ + // Great, nothing to do + }else if(options.skip_lines_with_empty_values === undefined || options.skip_lines_with_empty_values === null){ + options.skip_lines_with_empty_values = false + }else{ + throw new Error(`Invalid Option: skip_lines_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_lines_with_empty_values)}`) + } + // Normalize option `skip_lines_with_error` + if(typeof options.skip_lines_with_error === 'boolean'){ + // Great, nothing to do + }else if(options.skip_lines_with_error === undefined || options.skip_lines_with_error === null){ + options.skip_lines_with_error = false + }else{ + throw new Error(`Invalid Option: skip_lines_with_error must be a boolean, got ${JSON.stringify(options.skip_lines_with_error)}`) + } + // Normalize option `rtrim` + if(options.rtrim === undefined || options.rtrim === null || options.rtrim === false){ + options.rtrim = false + }else if(options.rtrim !== true){ + throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`) + } + // Normalize option `ltrim` + if(options.ltrim === undefined || options.ltrim === null || options.ltrim === false){ + options.ltrim = false + }else if(options.ltrim !== true){ + throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`) + } + // Normalize option `trim` + if(options.trim === undefined || options.trim === null || options.trim === false){ + options.trim = false + }else if(options.trim !== true){ + throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`) + } + // Normalize options `trim`, `ltrim` and `rtrim` + if(options.trim === true && opts.ltrim !== false){ + options.ltrim = true + }else if(options.ltrim !== true){ + options.ltrim = false + } + if(options.trim === true && opts.rtrim !== false){ + options.rtrim = true + }else if(options.rtrim !== true){ + options.rtrim = false + } + // Normalize option `to` + if(options.to === undefined || options.to === null){ + options.to = -1 + }else{ + if(typeof options.to === 'string' && /\d+/.test(options.to)){ + options.to = parseInt(options.to) + } + if(Number.isInteger(options.to)){ + if(options.to <= 0){ + throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`) + } + }else{ + throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`) + } + } + // Normalize option `to_line` + if(options.to_line === undefined || options.to_line === null){ + options.to_line = -1 + }else{ + if(typeof options.to_line === 'string' && /\d+/.test(options.to_line)){ + options.to_line = parseInt(options.to_line) + } + if(Number.isInteger(options.to_line)){ + if(options.to_line <= 0){ + throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`) + } + }else{ + throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`) + } + } + this.info = { + comment_lines: 0, + empty_lines: 0, + invalid_field_length: 0, + lines: 1, + records: 0 + } + this.options = options + this.state = { + bomSkipped: false, + castField: fnCastField, + commenting: false, + enabled: options.from_line === 1, + escaping: false, + escapeIsQuote: options.escape === options.quote, + expectedRecordLength: options.columns === null ? 0 : options.columns.length, + field: new ResizeableBuffer(20), + firstLineToHeaders: fnFirstLineToHeaders, + info: Object.assign({}, this.info), + previousBuf: undefined, + quoting: false, + stop: false, + rawBuffer: new ResizeableBuffer(100), + record: [], + recordHasError: false, + record_length: 0, + recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 2 : Math.max(...options.record_delimiter.map( (v) => v.length)), + trimChars: [Buffer.from(' ')[0], Buffer.from('\t')[0]], + wasQuoting: false, + wasRowDelimiter: false + } + } + // Implementation of `Transform._transform` + _transform(buf, encoding, callback){ + if(this.state.stop === true){ + return + } + const err = this.__parse(buf, false) + if(err !== undefined){ + this.state.stop = true + } + callback(err) + } + // Implementation of `Transform._flush` + _flush(callback){ + if(this.state.stop === true){ + return + } + const err = this.__parse(undefined, true) + callback(err) + } + // Central parser implementation + __parse(nextBuf, end){ + const {bom, comment, escape, from_line, info, ltrim, max_record_size, quote, raw, relax, rtrim, skip_empty_lines, to, to_line} = this.options + let {record_delimiter} = this.options + const {bomSkipped, previousBuf, rawBuffer, escapeIsQuote} = this.state + let buf + if(previousBuf === undefined){ + if(nextBuf === undefined){ + // Handle empty string + this.push(null) + return + }else{ + buf = nextBuf + } + }else if(previousBuf !== undefined && nextBuf === undefined){ + buf = previousBuf + }else{ + buf = Buffer.concat([previousBuf, nextBuf]) + } + // Handle UTF BOM + if(bomSkipped === false){ + if(bom === false){ + this.state.bomSkipped = true + }else if(buf.length < 3){ + // No enough data + if(end === false){ + // Wait for more data + this.state.previousBuf = buf + return + } + // skip BOM detect because data length < 3 + }else{ + if(bom_utf8.compare(buf, 0, 3) === 0){ + // Skip BOM + buf = buf.slice(3) + } + this.state.bomSkipped = true + } + } + const bufLen = buf.length + let pos + for(pos = 0; pos < bufLen; pos++){ + // Ensure we get enough space to look ahead + // There should be a way to move this out of the loop + if(this.__needMoreData(pos, bufLen, end)){ + break + } + if(this.state.wasRowDelimiter === true){ + this.info.lines++ + if(info === true && this.state.record.length === 0 && this.state.field.length === 0 && this.state.wasQuoting === false){ + this.state.info = Object.assign({}, this.info) + } + this.state.wasRowDelimiter = false + } + if(to_line !== -1 && this.info.lines > to_line){ + this.state.stop = true + this.push(null) + return + } + // Auto discovery of record_delimiter, unix, mac and windows supported + if(this.state.quoting === false && record_delimiter.length === 0){ + const record_delimiterCount = this.__autoDiscoverRowDelimiter(buf, pos) + if(record_delimiterCount){ + record_delimiter = this.options.record_delimiter + } + } + const chr = buf[pos] + if(raw === true){ + rawBuffer.append(chr) + } + if((chr === cr || chr === nl) && this.state.wasRowDelimiter === false ){ + this.state.wasRowDelimiter = true + } + // Previous char was a valid escape char + // treat the current char as a regular char + if(this.state.escaping === true){ + this.state.escaping = false + }else{ + // Escape is only active inside quoted fields + // We are quoting, the char is an escape chr and there is a chr to escape + if(escape !== null && this.state.quoting === true && chr === escape && pos + 1 < bufLen){ + if(escapeIsQuote){ + if(buf[pos+1] === quote){ + this.state.escaping = true + continue + } + }else{ + this.state.escaping = true + continue + } + } + // Not currently escaping and chr is a quote + // TODO: need to compare bytes instead of single char + if(this.state.commenting === false && chr === quote){ + if(this.state.quoting === true){ + const nextChr = buf[pos+1] + const isNextChrTrimable = rtrim && this.__isCharTrimable(nextChr) + // const isNextChrComment = nextChr === comment + const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos+1, nextChr) + const isNextChrDelimiter = this.__isDelimiter(nextChr, buf, pos+1) + const isNextChrRowDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRowDelimiter(buf, pos+1) : this.__isRecordDelimiter(nextChr, buf, pos+1) + // Escape a quote + // Treat next char as a regular character + // TODO: need to compare bytes instead of single char + if(escape !== null && chr === escape && nextChr === quote){ + pos++ + }else if(!nextChr || isNextChrDelimiter || isNextChrRowDelimiter || isNextChrComment || isNextChrTrimable){ + this.state.quoting = false + this.state.wasQuoting = true + continue + }else if(relax === false){ + const err = this.__error( + new CsvError('CSV_INVALID_CLOSING_QUOTE', [ + 'Invalid Closing Quote:', + `got "${String.fromCharCode(nextChr)}"`, + `at line ${this.info.lines}`, + 'instead of delimiter, row delimiter, trimable character', + '(if activated) or comment', + ], this.__context()) + ) + if(err !== undefined) return err + }else{ + this.state.quoting = false + this.state.wasQuoting = true + // continue + this.state.field.prepend(quote) + } + }else{ + if(this.state.field.length !== 0){ + // In relax mode, treat opening quote preceded by chrs as regular + if( relax === false ){ + const err = this.__error( + new CsvError('INVALID_OPENING_QUOTE', [ + 'Invalid Opening Quote:', + `a quote is found inside a field at line ${this.info.lines}`, + ], this.__context(), { + field: this.state.field, + }) + ) + if(err !== undefined) return err + } + }else{ + this.state.quoting = true + continue + } + } + } + if(this.state.quoting === false){ + let recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos) + if(recordDelimiterLength !== 0){ + // Do not emit comments which take a full line + const skipCommentLine = this.state.commenting && (this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0) + if(skipCommentLine){ + this.info.comment_lines++ + // Skip full comment line + }else{ + // Skip if line is empty and skip_empty_lines activated + if(skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0){ + this.info.empty_lines++ + pos += recordDelimiterLength - 1 + continue + } + // Activate records emition if above from_line + if(this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1: 0 ) >= from_line){ + this.state.enabled = true + this.__resetField() + this.__resetRow() + pos += recordDelimiterLength - 1 + continue + }else{ + const errField = this.__onField() + if(errField !== undefined) return errField + const errRecord = this.__onRow() + if(errRecord !== undefined) return errRecord + } + if(to !== -1 && this.info.records >= to){ + this.state.stop = true + this.push(null) + return + } + } + this.state.commenting = false + pos += recordDelimiterLength - 1 + continue + } + if(this.state.commenting){ + continue + } + const commentCount = comment === null ? 0 : this.__compareBytes(comment, buf, pos, chr) + if(commentCount !== 0){ + this.state.commenting = true + continue + } + let delimiterLength = this.__isDelimiter(chr, buf, pos) + if(delimiterLength !== 0){ + const errField = this.__onField() + if(errField !== undefined) return errField + pos += delimiterLength - 1 + continue + } + } + } + if(this.state.commenting === false){ + if(max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size){ + const err = this.__error( + new CsvError('CSV_MAX_RECORD_SIZE', [ + 'Max Record Size:', + 'record exceed the maximum number of tolerated bytes', + `of ${max_record_size}`, + `at line ${this.info.lines}`, + ], this.__context()) + ) + if(err !== undefined) return err + } + } + + const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(chr) + // rtrim in non quoting is handle in __onField + const rappend = rtrim === false || this.state.wasQuoting === false + if( lappend === true && rappend === true ){ + this.state.field.append(chr) + }else if(rtrim === true && !this.__isCharTrimable(chr)){ + const err = this.__error( + new CsvError('CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE', [ + 'Invalid Closing Quote:', + 'found non trimable byte after quote', + `at line ${this.info.lines}`, + ], this.__context()) + ) + if(err !== undefined) return err + } + } + if(end === true){ + // Ensure we are not ending in a quoting state + if(this.state.quoting === true){ + const err = this.__error( + new CsvError('CSV_QUOTE_NOT_CLOSED', [ + 'Quote Not Closed:', + `the parsing is finished with an opening quote at line ${this.info.lines}`, + ], this.__context()) + ) + if(err !== undefined) return err + }else{ + // Skip last line if it has no characters + if(this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0){ + const errField = this.__onField() + if(errField !== undefined) return errField + const errRecord = this.__onRow() + if(errRecord !== undefined) return errRecord + }else if(this.state.wasRowDelimiter === true){ + this.info.empty_lines++ + }else if(this.state.commenting === true){ + this.info.comment_lines++ + } + } + }else{ + this.state.previousBuf = buf.slice(pos) + } + if(this.state.wasRowDelimiter === true){ + this.info.lines++ + this.state.wasRowDelimiter = false + } + } + // Helper to test if a character is a space or a line delimiter + __isCharTrimable(chr){ + return chr === space || chr === tab || chr === cr || chr === nl || chr === np + } + __onRow(){ + const {columns, columns_duplicates_to_array, info, from, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_lines_with_empty_values} = this.options + const {enabled, record} = this.state + if(enabled === false){ + return this.__resetRow() + } + // Convert the first line into column names + const recordLength = record.length + if(columns === true){ + if(isRecordEmpty(record)){ + this.__resetRow() + return + } + return this.__firstLineToColumns(record) + } + if(columns === false && this.info.records === 0){ + this.state.expectedRecordLength = recordLength + } + if(recordLength !== this.state.expectedRecordLength){ + if(relax_column_count === true || + (relax_column_count_less === true && recordLength < this.state.expectedRecordLength) || + (relax_column_count_more === true && recordLength > this.state.expectedRecordLength) ){ + this.info.invalid_field_length++ + }else{ + if(columns === false){ + const err = this.__error( + new CsvError('CSV_INCONSISTENT_RECORD_LENGTH', [ + 'Invalid Record Length:', + `expect ${this.state.expectedRecordLength},`, + `got ${recordLength} on line ${this.info.lines}`, + ], this.__context(), { + record: record, + }) + ) + if(err !== undefined) return err + }else{ + const err = this.__error( + // CSV_INVALID_RECORD_LENGTH_DONT_MATCH_COLUMNS + new CsvError('CSV_RECORD_DONT_MATCH_COLUMNS_LENGTH', [ + 'Invalid Record Length:', + `columns length is ${columns.length},`, // rename columns + `got ${recordLength} on line ${this.info.lines}`, + ], this.__context(), { + record: record, + }) + ) + if(err !== undefined) return err + } + } + } + if(skip_lines_with_empty_values === true){ + if(isRecordEmpty(record)){ + this.__resetRow() + return + } + } + if(this.state.recordHasError === true){ + this.__resetRow() + this.state.recordHasError = false + return + } + this.info.records++ + if(from === 1 || this.info.records >= from){ + if(columns !== false){ + const obj = {} + // Transform record array to an object + for(let i = 0, l = record.length; i < l; i++){ + if(columns[i] === undefined || columns[i].disabled) continue + // obj[columns[i].name] = record[i] + // Turn duplicate columns into an array + if (columns_duplicates_to_array === true && obj[columns[i].name]) { + if (Array.isArray(obj[columns[i].name])) { + obj[columns[i].name] = obj[columns[i].name].concat(record[i]) + } else { + obj[columns[i].name] = [obj[columns[i].name], record[i]] + } + } else { + obj[columns[i].name] = record[i] + } + } + const {objname} = this.options + if(objname === undefined){ + if(raw === true || info === true){ + const err = this.__push(Object.assign( + {record: obj}, + (raw === true ? {raw: this.state.rawBuffer.toString()}: {}), + (info === true ? {info: this.state.info}: {}) + )) + if(err){ + return err + } + }else{ + const err = this.__push(obj) + if(err){ + return err + } + } + }else{ + if(raw === true || info === true){ + const err = this.__push(Object.assign( + {record: [obj[objname], obj]}, + raw === true ? {raw: this.state.rawBuffer.toString()}: {}, + info === true ? {info: this.state.info}: {} + )) + if(err){ + return err + } + }else{ + const err = this.__push([obj[objname], obj]) + if(err){ + return err + } + } + } + }else{ + if(raw === true || info === true){ + const err = this.__push(Object.assign( + {record: record}, + raw === true ? {raw: this.state.rawBuffer.toString()}: {}, + info === true ? {info: this.state.info}: {} + )) + if(err){ + return err + } + }else{ + const err = this.__push(record) + if(err){ + return err + } + } + } + } + this.__resetRow() + } + __firstLineToColumns(record){ + const {firstLineToHeaders} = this.state + try{ + const headers = firstLineToHeaders === undefined ? record : firstLineToHeaders.call(null, record) + if(!Array.isArray(headers)){ + return this.__error( + new CsvError('CSV_INVALID_COLUMN_MAPPING', [ + 'Invalid Column Mapping:', + 'expect an array from column function,', + `got ${JSON.stringify(headers)}` + ], this.__context(), { + headers: headers, + }) + ) + } + const normalizedHeaders = normalizeColumnsArray(headers) + this.state.expectedRecordLength = normalizedHeaders.length + this.options.columns = normalizedHeaders + this.__resetRow() + return + }catch(err){ + return err + } + } + __resetRow(){ + if(this.options.raw === true){ + this.state.rawBuffer.reset() + } + this.state.record = [] + this.state.record_length = 0 + } + __onField(){ + const {cast, rtrim, max_record_size} = this.options + const {enabled, wasQuoting} = this.state + // Short circuit for the from_line options + if(enabled === false){ /* this.options.columns !== true && */ + return this.__resetField() + } + let field = this.state.field.toString() + if(rtrim === true && wasQuoting === false){ + field = field.trimRight() + } + if(cast === true){ + const [err, f] = this.__cast(field) + if(err !== undefined) return err + field = f + } + this.state.record.push(field) + // Increment record length if record size must not exceed a limit + if(max_record_size !== 0 && typeof field === 'string'){ + this.state.record_length += field.length + } + this.__resetField() + } + __resetField(){ + this.state.field.reset() + this.state.wasQuoting = false + } + __push(record){ + const {on_record} = this.options + if(on_record !== undefined){ + const context = this.__context() + try{ + record = on_record.call(null, record, context) + }catch(err){ + return err + } + if(record === undefined || record === null){ return } + } + this.push(record) + } + // Return a tuple with the error and the casted value + __cast(field){ + const {columns, relax_column_count} = this.options + const isColumns = Array.isArray(columns) + // Dont loose time calling cast + // because the final record is an object + // and this field can't be associated to a key present in columns + if( isColumns === true && relax_column_count && this.options.columns.length <= this.state.record.length ){ + return [undefined, undefined] + } + const context = this.__context() + if(this.state.castField !== null){ + try{ + return [undefined, this.state.castField.call(null, field, context)] + }catch(err){ + return [err] + } + } + if(this.__isFloat(field)){ + return [undefined, parseFloat(field)] + }else if(this.options.cast_date !== false){ + return [undefined, this.options.cast_date.call(null, field, context)] + } + return [undefined, field] + } + // Keep it in case we implement the `cast_int` option + // __isInt(value){ + // // return Number.isInteger(parseInt(value)) + // // return !isNaN( parseInt( obj ) ); + // return /^(\-|\+)?[1-9][0-9]*$/.test(value) + // } + __isFloat(value){ + return (value - parseFloat( value ) + 1) >= 0 // Borrowed from jquery + } + __compareBytes(sourceBuf, targetBuf, pos, firtByte){ + if(sourceBuf[0] !== firtByte) return 0 + const sourceLength = sourceBuf.length + for(let i = 1; i < sourceLength; i++){ + if(sourceBuf[i] !== targetBuf[pos+i]) return 0 + } + return sourceLength + } + __needMoreData(i, bufLen, end){ + if(end){ + return false + } + const {comment, delimiter} = this.options + const {quoting, recordDelimiterMaxLength} = this.state + const numOfCharLeft = bufLen - i - 1 + const requiredLength = Math.max( + // Skip if the remaining buffer smaller than comment + comment ? comment.length : 0, + // Skip if the remaining buffer smaller than row delimiter + recordDelimiterMaxLength, + // Skip if the remaining buffer can be row delimiter following the closing quote + // 1 is for quote.length + quoting ? (1 + recordDelimiterMaxLength) : 0, + // Skip if the remaining buffer can be delimiter + delimiter.length, + // Skip if the remaining buffer can be escape sequence + // 1 is for escape.length + 1 + ) + return numOfCharLeft < requiredLength + } + __isDelimiter(chr, buf, pos){ + const {delimiter} = this.options + loop1: for(let i = 0; i < delimiter.length; i++){ + const del = delimiter[i] + if(del[0] === chr){ + for(let j = 1; j < del.length; j++){ + if(del[j] !== buf[pos+j]) continue loop1 + } + return del.length + } + } + return 0 + } + __isRecordDelimiter(chr, buf, pos){ + const {record_delimiter} = this.options + const recordDelimiterLength = record_delimiter.length + loop1: for(let i = 0; i < recordDelimiterLength; i++){ + const rd = record_delimiter[i] + const rdLength = rd.length + if(rd[0] !== chr){ + continue + } + for(let j = 1; j < rdLength; j++){ + if(rd[j] !== buf[pos+j]){ + continue loop1 + } + } + return rd.length + } + return 0 + } + __autoDiscoverRowDelimiter(buf, pos){ + const chr = buf[pos] + if(chr === cr){ + if(buf[pos+1] === nl){ + this.options.record_delimiter.push(Buffer.from('\r\n')) + this.state.recordDelimiterMaxLength = 2 + return 2 + }else{ + this.options.record_delimiter.push(Buffer.from('\r')) + this.state.recordDelimiterMaxLength = 1 + return 1 + } + }else if(chr === nl){ + this.options.record_delimiter.push(Buffer.from('\n')) + this.state.recordDelimiterMaxLength = 1 + return 1 + } + return 0 + } + __error(msg){ + const {skip_lines_with_error} = this.options + const err = typeof msg === 'string' ? new Error(msg) : msg + if(skip_lines_with_error){ + this.state.recordHasError = true + this.emit('skip', err) + return undefined + }else{ + return err + } + } + __context(){ + const {columns} = this.options + const isColumns = Array.isArray(columns) + return { + column: isColumns === true ? + ( columns.length > this.state.record.length ? + columns[this.state.record.length].name : + null + ) : + this.state.record.length, + empty_lines: this.info.empty_lines, + header: columns === true, + index: this.state.record.length, + invalid_field_length: this.info.invalid_field_length, + quoting: this.state.wasQuoting, + lines: this.info.lines, + records: this.info.records + } + } +} + +const parse = function(){ + let data, options, callback + for(let i in arguments){ + const argument = arguments[i] + const type = typeof argument + if(data === undefined && (typeof argument === 'string' || Buffer.isBuffer(argument))){ + data = argument + }else if(options === undefined && isObject(argument)){ + options = argument + }else if(callback === undefined && type === 'function'){ + callback = argument + }else{ + throw new CsvError('CSV_INVALID_ARGUMENT', [ + 'Invalid argument:', + `got ${JSON.stringify(argument)} at index ${i}` + ]) + } + } + const parser = new Parser(options) + if(callback){ + const records = options === undefined || options.objname === undefined ? [] : {} + parser.on('readable', function(){ + let record + while((record = this.read()) !== null){ + if(options === undefined || options.objname === undefined){ + records.push(record) + }else{ + records[record[0]] = record[1] + } + } + }) + parser.on('error', function(err){ + callback(err, undefined, parser.info) + }) + parser.on('end', function(){ + callback(undefined, records, parser.info) + }) + } + if(data !== undefined){ + // Give a chance for events to be registered later + if(typeof setImmediate === 'function'){ + setImmediate(function(){ + parser.write(data) + parser.end() + }) + }else{ + parser.write(data) + parser.end() + } + } + return parser +} + +class CsvError extends Error { + constructor(code, message, ...contexts) { + if(Array.isArray(message)) message = message.join(' ') + super(message) + if(Error.captureStackTrace !== undefined){ + Error.captureStackTrace(this, CsvError) + } + this.code = code + for(const context of contexts){ + for(const key in context){ + const value = context[key] + this[key] = Buffer.isBuffer(value) ? value.toString() : value == null ? value : JSON.parse(JSON.stringify(value)) + } + } + } +} + +parse.Parser = Parser + +parse.CsvError = CsvError + +module.exports = parse + +const underscore = function(str){ + return str.replace(/([A-Z])/g, function(_, match){ + return '_' + match.toLowerCase() + }) +} + +const isObject = function(obj){ + return (typeof obj === 'object' && obj !== null && !Array.isArray(obj)) +} + +const isRecordEmpty = function(record){ + return record.every( (field) => field == null || field.toString && field.toString().trim() === '' ) +} + +const normalizeColumnsArray = function(columns){ + const normalizedColumns = []; + for(let i = 0, l = columns.length; i < l; i++){ + const column = columns[i] + if(column === undefined || column === null || column === false){ + normalizedColumns[i] = { disabled: true } + }else if(typeof column === 'string'){ + normalizedColumns[i] = { name: column } + }else if(isObject(column)){ + if(typeof column.name !== 'string'){ + throw new CsvError('CSV_OPTION_COLUMNS_MISSING_NAME', [ + 'Option columns missing name:', + `property "name" is required at position ${i}`, + 'when column is an object literal' + ]) + } + normalizedColumns[i] = column + }else{ + throw new CsvError('CSV_INVALID_COLUMN_DEFINITION', [ + 'Invalid column definition:', + 'expect a string or a literal object,', + `got ${JSON.stringify(column)} at position ${i}` + ]) + } + } + return normalizedColumns; +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer, __webpack_require__(/*! ./../../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate)) + +/***/ }), + +/***/ "./node_modules/events/events.js": +/*!***************************************!*\ + !*** ./node_modules/events/events.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} +module.exports = EventEmitter; +module.exports.once = once; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); +} + + +/***/ }), + +/***/ "./node_modules/ieee754/index.js": +/*!***************************************!*\ + !*** ./node_modules/ieee754/index.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + + i += d + + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} + + +/***/ }), + +/***/ "./node_modules/inherits/inherits_browser.js": +/*!***************************************************!*\ + !*** ./node_modules/inherits/inherits_browser.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ "./node_modules/isarray/index.js": +/*!***************************************!*\ + !*** ./node_modules/isarray/index.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + + +/***/ }), + +/***/ "./node_modules/object-hash/dist/object_hash.js": +/*!******************************************************!*\ + !*** ./node_modules/object-hash/dist/object_hash.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var require;var require;!function(e){if(true)module.exports=e();else { var t; }}(function(){return function o(i,u,a){function s(n,e){if(!u[n]){if(!i[n]){var t="function"==typeof require&&require;if(!e&&t)return require(n,!0);if(f)return f(n,!0);throw new Error("Cannot find module '"+n+"'")}var r=u[n]={exports:{}};i[n][0].call(r.exports,function(e){var t=i[n][1][e];return s(t||e)},r,r.exports,o,i,u,a)}return u[n].exports}for(var f="function"==typeof require&&require,e=0;e>16),s((65280&r)>>8),s(255&r);return 2==o?s(255&(r=c(e.charAt(t))<<2|c(e.charAt(t+1))>>4)):1==o&&(s((r=c(e.charAt(t))<<10|c(e.charAt(t+1))<<4|c(e.charAt(t+2))>>2)>>8&255),s(255&r)),i},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function a(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t>18&63)+a(o>>12&63)+a(o>>6&63)+a(63&o);switch(i){case 1:u+=a((n=e[e.length-1])>>2),u+=a(n<<4&63),u+="==";break;case 2:u+=a((n=(e[e.length-2]<<8)+e[e.length-1])>>10),u+=a(n>>4&63),u+=a(n<<2&63),u+="="}return u}}(void 0===f?this.base64js={}:f)}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(O,e,H){(function(e,t,h,n,r,o,i,u,a){var s=O("base64-js"),f=O("ieee754");function h(e,t,n){if(!(this instanceof h))return new h(e,t,n);var r,o,i,u,a,s=typeof e;if("base64"===t&&"string"==s)for(e=(r=e).trim?r.trim():r.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==s)o=x(e);else if("string"==s)o=h.byteLength(e,t);else{if("object"!=s)throw new Error("First argument needs to be a number, array or string.");o=x(e.length)}if(h._useTypedArrays?i=h._augment(new Uint8Array(o)):((i=this).length=o,i._isBuffer=!0),h._useTypedArrays&&"number"==typeof e.byteLength)i._set(e);else if(S(a=e)||h.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length)for(u=0;u>8,r=t%256,o.push(r),o.push(n);return o}(t),e,n,r)}function c(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o>>0)):(t+1>>0),o}function y(e,t,n,r){if(r||(D("boolean"==typeof n,"missing or invalid endian"),D(null!=t,"missing offset"),D(t+1>>8*(r?u:1-u)}function _(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+3>>8*(r?u:3-u)&255}function E(e,t,n,r,o){o||(D(null!=t,"missing value"),D("boolean"==typeof r,"missing or invalid endian"),D(null!=n,"missing offset"),D(n+1this.length&&(r=this.length),e.length-t=this.length))return this[e]},h.prototype.readUInt16LE=function(e,t){return l(this,e,!0,t)},h.prototype.readUInt16BE=function(e,t){return l(this,e,!1,t)},h.prototype.readUInt32LE=function(e,t){return d(this,e,!0,t)},h.prototype.readUInt32BE=function(e,t){return d(this,e,!1,t)},h.prototype.readInt8=function(e,t){if(t||(D(null!=e,"missing offset"),D(e=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){return y(this,e,!0,t)},h.prototype.readInt16BE=function(e,t){return y(this,e,!1,t)},h.prototype.readInt32LE=function(e,t){return w(this,e,!0,t)},h.prototype.readInt32BE=function(e,t){return w(this,e,!1,t)},h.prototype.readFloatLE=function(e,t){return b(this,e,!0,t)},h.prototype.readFloatBE=function(e,t){return b(this,e,!1,t)},h.prototype.readDoubleLE=function(e,t){return m(this,e,!0,t)},h.prototype.readDoubleBE=function(e,t){return m(this,e,!1,t)},h.prototype.writeUInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(this[t]=e)},h.prototype.writeUInt16LE=function(e,t,n){v(this,e,t,!0,n)},h.prototype.writeUInt16BE=function(e,t,n){v(this,e,t,!1,n)},h.prototype.writeUInt32LE=function(e,t,n){_(this,e,t,!0,n)},h.prototype.writeUInt32BE=function(e,t,n){_(this,e,t,!1,n)},h.prototype.writeInt8=function(e,t,n){n||(D(null!=e,"missing value"),D(null!=t,"missing offset"),D(t=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},h.prototype.writeInt16LE=function(e,t,n){E(this,e,t,!0,n)},h.prototype.writeInt16BE=function(e,t,n){E(this,e,t,!1,n)},h.prototype.writeInt32LE=function(e,t,n){I(this,e,t,!0,n)},h.prototype.writeInt32BE=function(e,t,n){I(this,e,t,!1,n)},h.prototype.writeFloatLE=function(e,t,n){A(this,e,t,!0,n)},h.prototype.writeFloatBE=function(e,t,n){A(this,e,t,!1,n)},h.prototype.writeDoubleLE=function(e,t,n){B(this,e,t,!0,n)},h.prototype.writeDoubleBE=function(e,t,n){B(this,e,t,!1,n)},h.prototype.fill=function(e,t,n){if(e=e||0,t=t||0,n=n||this.length,"string"==typeof e&&(e=e.charCodeAt(0)),D("number"==typeof e&&!isNaN(e),"value is not a number"),D(t<=n,"end < start"),n!==t&&0!==this.length){D(0<=t&&t"},h.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(h._useTypedArrays)return new h(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function M(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function N(e,t){D("number"==typeof e,"cannot write a non-number as a number"),D(0<=e,"specified a negative value for writing an unsigned value"),D(e<=t,"value is larger than maximum value for type"),D(Math.floor(e)===e,"value has a fractional component")}function Y(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value"),D(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){D("number"==typeof e,"cannot write a non-number as a number"),D(e<=t,"value larger than maximum allowed value"),D(n<=e,"value smaller than minimum allowed value")}function D(e,t){if(!e)throw new Error(t||"Failed assertion")}h._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=L.get,e.set=L.set,e.write=L.write,e.toString=L.toString,e.toLocaleString=L.toString,e.toJSON=L.toJSON,e.copy=L.copy,e.slice=L.slice,e.readUInt8=L.readUInt8,e.readUInt16LE=L.readUInt16LE,e.readUInt16BE=L.readUInt16BE,e.readUInt32LE=L.readUInt32LE,e.readUInt32BE=L.readUInt32BE,e.readInt8=L.readInt8,e.readInt16LE=L.readInt16LE,e.readInt16BE=L.readInt16BE,e.readInt32LE=L.readInt32LE,e.readInt32BE=L.readInt32BE,e.readFloatLE=L.readFloatLE,e.readFloatBE=L.readFloatBE,e.readDoubleLE=L.readDoubleLE,e.readDoubleBE=L.readDoubleBE,e.writeUInt8=L.writeUInt8,e.writeUInt16LE=L.writeUInt16LE,e.writeUInt16BE=L.writeUInt16BE,e.writeUInt32LE=L.writeUInt32LE,e.writeUInt32BE=L.writeUInt32BE,e.writeInt8=L.writeInt8,e.writeInt16LE=L.writeInt16LE,e.writeInt16BE=L.writeInt16BE,e.writeInt32LE=L.writeInt32LE,e.writeInt32BE=L.writeInt32BE,e.writeFloatLE=L.writeFloatLE,e.writeFloatBE=L.writeFloatBE,e.writeDoubleLE=L.writeDoubleLE,e.writeDoubleBE=L.writeDoubleBE,e.fill=L.fill,e.inspect=L.inspect,e.toArrayBuffer=L.toArrayBuffer,e}}).call(this,O("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},O("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(l,d,e){(function(e,t,u,n,r,o,i,a,s){u=l("buffer").Buffer;var f=4,c=new u(f);c.fill(0);d.exports={hash:function(e,t,n,r){return u.isBuffer(e)||(e=new u(e)),function(e,t,n){for(var r=new u(t),o=n?r.writeInt32BE:r.writeInt32LE,i=0;ih?t=e(t):t.length>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u>>32-a,n);var u,a}function d(e,t,n,r,o,i,u){return l(t&n|~t&r,e,t,o,i,u)}function h(e,t,n,r,o,i,u){return l(t&r|n&~r,e,t,o,i,u)}function p(e,t,n,r,o,i,u){return l(t^n^r,e,t,o,i,u)}function g(e,t,n,r,o,i,u){return l(n^(t|~r),e,t,o,i,u)}function y(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}b.exports=function(e){return f.hash(e,c,16)}}).call(this,w("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},w("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(e,l,t){(function(e,t,n,r,o,i,u,a,s){var f,c;f=function(e){for(var t,n=new Array(e),r=0;r>>((3&r)<<3)&255;return n},l.exports=c||f}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(l,d,e){(function(e,t,n,r,o,i,u,a,s){var f=l("./helpers");function c(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n,r=Array(80),o=1732584193,i=-271733879,u=-1732584194,a=271733878,s=-1009589776,f=0;f>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t){return e<>>32-t}d.exports=function(e){return f.hash(e,c,20,!0)}}).call(this,l("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},l("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(l,d,e){(function(e,t,n,r,o,i,u,a,s){function B(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function L(e,t){return e>>>t|e<<32-t}function U(e,t){return e>>>t}function f(e,t){var n,r,o,i,u,a,s,f,c,l,d,h,p,g,y,w,b,m,v=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),_=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),E=new Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var I=0;I>1,c=-7,l=n?o-1:0,d=n?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-c)-1,h>>=-c,c+=a;0>=-c,c+=r;0>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,u=c):(u=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-u))<1&&(u--,s*=2),2<=(t+=1<=u+l?d/s:d*Math.pow(2,1-l))*s&&(u++,s/=2),c<=u+l?(a=0,u=c):1<=u+l?(a=(t*s-1)*Math.pow(2,o),u+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,o),u=0));8<=o;e[n+h]=255&a,h+=p,a/=256,o-=8);for(u=u< 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + + +/***/ }), + +/***/ "./node_modules/readable-stream/duplex-browser.js": +/*!********************************************************!*\ + !*** ./node_modules/readable-stream/duplex-browser.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./lib/_stream_duplex.js */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_duplex.js": +/*!************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js"); +/**/ + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +var Readable = __webpack_require__(/*! ./_stream_readable */ "./node_modules/readable-stream/lib/_stream_readable.js"); +var Writable = __webpack_require__(/*! ./_stream_writable */ "./node_modules/readable-stream/lib/_stream_writable.js"); + +util.inherits(Duplex, Readable); + +{ + // avoid scope creep, the keys array can then be collected + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + pna.nextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +Duplex.prototype._destroy = function (err, cb) { + this.push(null); + this.end(); + + pna.nextTick(cb, err); +}; + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_passthrough.js": +/*!*****************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +module.exports = PassThrough; + +var Transform = __webpack_require__(/*! ./_stream_transform */ "./node_modules/readable-stream/lib/_stream_transform.js"); + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_readable.js": +/*!**************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_readable.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js"); +/**/ + +module.exports = Readable; + +/**/ +var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js"); +/**/ + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = __webpack_require__(/*! events */ "./node_modules/events/events.js").EventEmitter; + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +/**/ + +var Buffer = __webpack_require__(/*! safe-buffer */ "./node_modules/readable-stream/node_modules/safe-buffer/index.js").Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +/**/ +var debugUtil = __webpack_require__(/*! util */ 1); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var BufferList = __webpack_require__(/*! ./internal/streams/BufferList */ "./node_modules/readable-stream/lib/internal/streams/BufferList.js"); +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/readable-stream/lib/internal/streams/destroy.js"); +var StringDecoder; + +util.inherits(Readable, Stream); + +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var readableHwm = options.readableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + if (!(this instanceof Readable)) return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + if (options) { + if (typeof options.read === 'function') this._read = options.read; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); + +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + this.push(null); + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; + +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (addToFront) { + if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); + } else if (state.ended) { + stream.emit('error', new Error('stream.push() after EOF')); + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + } + } + + return needMoreData(state); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} + +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + + return ret; +}; + +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + pna.nextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('_read() is not implemented')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { hasUnpiped: false }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, unpipeInfo); + }return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + + dest.emit('unpipe', this, unpipeInfo); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + pna.nextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + pna.nextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + + var state = this._readableState; + var paused = false; + + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + + _this.push(null); + }); + + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return this; +}; + +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._readableState.highWaterMark; + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = Buffer.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + pna.nextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_transform.js": +/*!***************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_transform.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; + +var Duplex = __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +util.inherits(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) { + return this.emit('error', new Error('write callback called multiple times')); + } + + ts.writechunk = null; + ts.writecb = null; + + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + + cb(er); + + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function') { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('_transform() is not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +Transform.prototype._destroy = function (err, cb) { + var _this2 = this; + + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + _this2.emit('close'); + }); +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); + + if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/_stream_writable.js": +/*!**************************************************************!*\ + !*** ./node_modules/readable-stream/lib/_stream_writable.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js"); +/**/ + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; +/**/ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js")); +util.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); +/**/ + +/**/ +var internalUtil = { + deprecate: __webpack_require__(/*! util-deprecate */ "./node_modules/util-deprecate/browser.js") +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +/**/ + +var Buffer = __webpack_require__(/*! safe-buffer */ "./node_modules/readable-stream/node_modules/safe-buffer/index.js").Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/readable-stream/lib/internal/streams/destroy.js"); + +util.inherits(Writable, Stream); + +function nop() {} + +function WritableState(options, stream) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var writableHwm = options.writableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function (object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function (object) { + return object instanceof this; + }; +} + +function Writable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js"); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + + if (typeof options.final === 'function') this._final = options.final; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + pna.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + pna.nextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + pna.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + pna.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('_write() is not implemented')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + stream.emit('error', err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function') { + state.pendingcb++; + state.finalCalled = true; + pna.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = corkReq; + } else { + state.corkedRequestsFree = corkReq; + } +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + get: function () { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); + +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + this.end(); + cb(err); +}; +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/internal/streams/BufferList.js": +/*!*************************************************************************!*\ + !*** ./node_modules/readable-stream/lib/internal/streams/BufferList.js ***! + \*************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Buffer = __webpack_require__(/*! safe-buffer */ "./node_modules/readable-stream/node_modules/safe-buffer/index.js").Buffer; +var util = __webpack_require__(/*! util */ 2); + +function copyBuffer(src, target, offset) { + src.copy(target, offset); +} + +module.exports = function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + BufferList.prototype.push = function push(v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + }; + + BufferList.prototype.unshift = function unshift(v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + }; + + BufferList.prototype.shift = function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + }; + + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; + + BufferList.prototype.join = function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; + }; + + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + if (this.length === 1) return this.head.data; + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + }; + + return BufferList; +}(); + +if (util && util.inspect && util.inspect.custom) { + module.exports.prototype[util.inspect.custom] = function () { + var obj = util.inspect({ length: this.length }); + return this.constructor.name + ' ' + obj; + }; +} + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/internal/streams/destroy.js": +/*!**********************************************************************!*\ + !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js"); +/**/ + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { + pna.nextTick(emitErrorNT, this, err); + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + + this._destroy(err || null, function (err) { + if (!cb && err) { + pna.nextTick(emitErrorNT, _this, err); + if (_this._writableState) { + _this._writableState.errorEmitted = true; + } + } else if (cb) { + cb(err); + } + }); + + return this; +} + +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy +}; + +/***/ }), + +/***/ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***! + \*****************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! events */ "./node_modules/events/events.js").EventEmitter; + + +/***/ }), + +/***/ "./node_modules/readable-stream/node_modules/safe-buffer/index.js": +/*!************************************************************************!*\ + !*** ./node_modules/readable-stream/node_modules/safe-buffer/index.js ***! + \************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), + +/***/ "./node_modules/readable-stream/passthrough.js": +/*!*****************************************************!*\ + !*** ./node_modules/readable-stream/passthrough.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./readable */ "./node_modules/readable-stream/readable-browser.js").PassThrough + + +/***/ }), + +/***/ "./node_modules/readable-stream/readable-browser.js": +/*!**********************************************************!*\ + !*** ./node_modules/readable-stream/readable-browser.js ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ "./node_modules/readable-stream/lib/_stream_readable.js"); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ "./node_modules/readable-stream/lib/_stream_writable.js"); +exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ "./node_modules/readable-stream/lib/_stream_duplex.js"); +exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ "./node_modules/readable-stream/lib/_stream_transform.js"); +exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ "./node_modules/readable-stream/lib/_stream_passthrough.js"); + + +/***/ }), + +/***/ "./node_modules/readable-stream/transform.js": +/*!***************************************************!*\ + !*** ./node_modules/readable-stream/transform.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./readable */ "./node_modules/readable-stream/readable-browser.js").Transform + + +/***/ }), + +/***/ "./node_modules/readable-stream/writable-browser.js": +/*!**********************************************************!*\ + !*** ./node_modules/readable-stream/writable-browser.js ***! + \**********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./lib/_stream_writable.js */ "./node_modules/readable-stream/lib/_stream_writable.js"); + + +/***/ }), + +/***/ "./node_modules/safe-buffer/index.js": +/*!*******************************************!*\ + !*** ./node_modules/safe-buffer/index.js ***! + \*******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + /*! safe-buffer. MIT License. Feross Aboukhadijeh */ -var r=n(5),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){"use strict";t.exports=o;var r=n(21),i=Object.create(n(6));function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}i.inherits=n(4),i.inherits(o,r),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){t.exports=n(13)},function(t,e,n){t.exports=n(2)},function(t,e,n){t.exports=n(11).Transform},function(t,e,n){t.exports=n(11).PassThrough},function(t,e,n){(function(e){t.exports=class{constructor(t=100){this.size=t,this.length=0,this.buf=e.alloc(t)}prepend(t){const e=this.length++;e===this.size&&this.resize();const n=this.clone();this.buf[0]=t,n.copy(this.buf,1,0,e)}append(t){const e=this.length++;e===this.size&&this.resize(),this.buf[e]=t}clone(){return e.from(this.buf.slice(0,this.length))}resize(){const t=this.length;this.size=2*this.size;const n=e.alloc(this.size);this.buf.copy(n,0,0,t),this.buf=n}toString(){return this.buf.slice(0,this.length).toString()}toJSON(){return this.toString()}reset(){this.length=0}}}).call(this,n(5).Buffer)},,,,,,function(t,e,n){t.exports=n(23)}]); \ No newline at end of file +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), + +/***/ "./node_modules/setimmediate/setImmediate.js": +/*!***************************************************!*\ + !*** ./node_modules/setimmediate/setImmediate.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { + "use strict"; + + if (global.setImmediate) { + return; + } + + var nextHandle = 1; // Spec says greater than zero + var tasksByHandle = {}; + var currentlyRunningATask = false; + var doc = global.document; + var registerImmediate; + + function setImmediate(callback) { + // Callback can either be a function or a string + if (typeof callback !== "function") { + callback = new Function("" + callback); + } + // Copy function arguments + var args = new Array(arguments.length - 1); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i + 1]; + } + // Store and register the task + var task = { callback: callback, args: args }; + tasksByHandle[nextHandle] = task; + registerImmediate(nextHandle); + return nextHandle++; + } + + function clearImmediate(handle) { + delete tasksByHandle[handle]; + } + + function run(task) { + var callback = task.callback; + var args = task.args; + switch (args.length) { + case 0: + callback(); + break; + case 1: + callback(args[0]); + break; + case 2: + callback(args[0], args[1]); + break; + case 3: + callback(args[0], args[1], args[2]); + break; + default: + callback.apply(undefined, args); + break; + } + } + + function runIfPresent(handle) { + // From the spec: "Wait until any invocations of this algorithm started before this one have completed." + // So if we're currently running a task, we'll need to delay this invocation. + if (currentlyRunningATask) { + // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a + // "too much recursion" error. + setTimeout(runIfPresent, 0, handle); + } else { + var task = tasksByHandle[handle]; + if (task) { + currentlyRunningATask = true; + try { + run(task); + } finally { + clearImmediate(handle); + currentlyRunningATask = false; + } + } + } + } + + function installNextTickImplementation() { + registerImmediate = function(handle) { + process.nextTick(function () { runIfPresent(handle); }); + }; + } + + function canUsePostMessage() { + // The test against `importScripts` prevents this implementation from being installed inside a web worker, + // where `global.postMessage` means something completely different and can't be used for this purpose. + if (global.postMessage && !global.importScripts) { + var postMessageIsAsynchronous = true; + var oldOnMessage = global.onmessage; + global.onmessage = function() { + postMessageIsAsynchronous = false; + }; + global.postMessage("", "*"); + global.onmessage = oldOnMessage; + return postMessageIsAsynchronous; + } + } + + function installPostMessageImplementation() { + // Installs an event handler on `global` for the `message` event: see + // * https://developer.mozilla.org/en/DOM/window.postMessage + // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages + + var messagePrefix = "setImmediate$" + Math.random() + "$"; + var onGlobalMessage = function(event) { + if (event.source === global && + typeof event.data === "string" && + event.data.indexOf(messagePrefix) === 0) { + runIfPresent(+event.data.slice(messagePrefix.length)); + } + }; + + if (global.addEventListener) { + global.addEventListener("message", onGlobalMessage, false); + } else { + global.attachEvent("onmessage", onGlobalMessage); + } + + registerImmediate = function(handle) { + global.postMessage(messagePrefix + handle, "*"); + }; + } + + function installMessageChannelImplementation() { + var channel = new MessageChannel(); + channel.port1.onmessage = function(event) { + var handle = event.data; + runIfPresent(handle); + }; + + registerImmediate = function(handle) { + channel.port2.postMessage(handle); + }; + } + + function installReadyStateChangeImplementation() { + var html = doc.documentElement; + registerImmediate = function(handle) { + // Create a