Comparing version 0.1.8 to 0.1.9
@@ -1,2 +0,9 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ifid=t():e.ifid=t()}(this,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t){e.exports=require("os")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("path")},function(e,t,r){"use strict";var n;r.r(t),function(e){e.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",e.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",e.OID="6ba7b812-9dad-11d1-80b4-00c04fd430c8",e.X500="6ba7b814-9dad-11d1-80b4-00c04fd430c8"}(n||(n={}));var i=function(e){for(var t=[],r=e.length;r>0;r-=8){var n=e.slice(r-8,r).padStart(8,"0");t.unshift(parseInt(n,2))}return new Uint8Array(t)},o=r(1),a={BIT_ARRAY_INVALID:"The array of bits was not an array, had no contents, or had one or more items which did not meet the isBit type guard.",UUID_VERSION_INVALID:"The version argument was not a valid UUID version.",TIMESTAMP_GENERATION_FAILED:"The random number generator did not produce an acceptable value for the random number used in place of a stable timestamp.",TIMESTAMP_INVALID:"The timestamp property of the UUID object is malformed.",NAMESPACE_ID_MISSING:"In order to construct a v3 or v5 UUID, you need to provide a namespace ID to be hashed.",NAME_MISSING:"In order to construct a v3 or v5 UUID, you need to provide a name to be hashed.",CLOCK_SEQUENCE_INVALID:"The clockSequence property of the UUID object is malformed.",CLOCK_SEQUENCE_GENERATION_FAILED:"The random number generator did not produce an acceptable value for the random number used in place of a stable clock sequence.",CLOCK_SEQUENCE_LOW_INVALID:"The clockSequenceLow property of the UUID object is malformed.",CLOCK_SEQUENCE_HIGH_INVALID:"The clockSequenceHigh property of the UUID object is malformed.",CLOCK_HIGH_AND_RESERVED_INVALID:"The clockSequenceHighAndReserved property of the UUID object is malformed.",MAC_ADDRESS_UNAVAILABLE:"The MAC address is unavailable, which makes creating the version 1 node ID impossible.",MAC_ADDRESS_INVALID:"The MAC address was found, but it was malformed.",UUID_LAST_RESULTS_INVALID:"The provided last results object did not meet the isValidLastResults type guard.",UUID_STRING_INVALID:"The text argument passed to UUID.parse was malformed.",UUID_OPTIONS_INVALID:"The options argument passed to one of the UUID methods did not meet the isUUIDOptions type guard.",TIME_LOW_INVALID:"The timestamp property did not produce a valid low portion of the timestamp.",TIME_MID_INVALID:"The timestamp property did not produce a valid mid portion of the timestamp.",TIME_HIGH_INVALID:"The timestamp property did not produce a valid high portion of the timestamp.",TIME_HIGH_AND_VERSION_INVALID:"The timestamp property did not produce a valid high-and-version multiplex.",NODE_IDENTIFIER_INVALID:"The nodeIdentifier property of the UUID object was malformed."},c=function(e,t,r){if(!t)throw new Error(a.NAMESPACE_ID_MISSING);if(!r)throw new Error(a.NAME_MISSING);var n;n="3"===e.toString()?Object(o.createHash)("md5"):Object(o.createHash)("sha1");var i=t.split("-").map(function(e){var t=e.length;return parseInt(parseInt(e,16).toString(2).split("").reverse().join(""),2).toString(16).padEnd(t,"0")}).join("-");return n.update(i+r),n.digest("hex")};function s(e){return/^[1345]$/.test(e.toString())}var u=r(2);function d(e){return"object"==typeof e&&e&&e.clockSequence&&"BYTES_PER_ELEMENT"in e.clockSequence&&e.nodeIdentifier&&"BYTES_PER_ELEMENT"in e.nodeIdentifier&&e.timestamp&&"BYTES_PER_ELEMENT"in e.timestamp}var f=r(0),p=r(3),I=function(){var e=null;try{var t=Object(u.readFileSync)(Object(p.join)(Object(f.homedir)(),"ifid"),"utf8");e=JSON.parse(t)}catch(e){}return d(e)?e:{}}(),m=function(){return Boolean("undefined"!=typeof process&&process.versions&&process.versions.node)},l=function(e){if(m())return new Uint8Array(Object(o.randomBytes)(e));for(var t=t||msCrypto,r=new Uint8Array(e),n=0;n<e;n+=65536)t.getRandomValues(r.subarray(n,n+Math.min(e-n,65536)));return r},S=function(e){return parseInt(Buffer.from(e).toString("hex"),16)};function h(e,t,r){if(!s(e))throw new Error(a.UUID_VERSION_INVALID);var n;if(/^[14]$/.test(e.toString())){if(I.clockSequence&&"BYTES_PER_ELEMENT"in I.clockSequence)return I.clockSequence;n=function(){var e=S(l(2)).toString(2).slice(0,14);return new Uint8Array([parseInt(e.slice(0,6),2),parseInt(e.slice(6),2)])}(),"1"===e.toString()&&(I.clockSequence=n)}else{var o=c(e,t,r),u="";u+=o.slice(16,18),u+=o.slice(18,20);var d=parseInt(u,16).toString(2).padStart(14,"0");n=i(d)}return n}function _(){for(var e=Object(f.networkInterfaces)(),t=Object.keys(e),r=0;r<t.length;r+=1)for(var n=e[t[r]],i=0;i<n.length;i+=1){var o=n[i];if("object"==typeof o&&o){var c=o.mac;if("string"==typeof c&&c&&"00:00:00:00:00:00"!==c){var s=c.split(":").map(function(e){return parseInt(e,16)});return new Uint8Array(s)}}}throw new Error(a.MAC_ADDRESS_UNAVAILABLE)}function v(e,t,r){var n;if("1"===e.toString()){if(I.nodeIdentifier&&"BYTES_PER_ELEMENT"in I.nodeIdentifier)return I.nodeIdentifier;n=_(),I.nodeIdentifier=n}else if(/^[35]$/.test(e.toString())){var o="";o+=c(e,t,r).slice(20,32);var s=parseInt(o,16).toString(2).padStart(48,"0");n=i(s)}else{if("4"!==e.toString())throw new Error(a.UUID_VERSION_INVALID);n=l(6)}return n}function E(){return 10*((new Date).getTime()-new Date(1582,9,15).getTime())}function g(e,t,r){if(!s(e))throw new Error(a.UUID_VERSION_INVALID);var n;if("1"===e.toString()){var o=I.timestamp,u=E();o&&"BYTES_PER_ELEMENT"in o&&S(o)>u&&I.clockSequence&&"BYTES_PER_ELEMENT"in I.clockSequence&&(I.clockSequence[1]+=1);for(var d=u.toString(2).padStart(60,"0"),f=[],p=60;p>0;p-=8){var m=d.slice(p-8,p).padStart(8,"0");f.unshift(parseInt(m,2))}n=new Uint8Array(f)}else if(/^[35]$/.test(e.toString())){var h=c(e,t,r),_="";_=h.slice(0,8),_=h.slice(8,12)+_,_=h.slice(12,16)+_;var v=parseInt(_,16).toString(2).padStart(60,"0");n=i(v)}else(n=l(8))[7]=parseInt(n[7].toString(2).slice(0,4),2);return I.timestamp=n,n}var y=function(e){void 0===e&&(e={}),this.version="4",this.clockSequenceGetter=h,this.nodeIdentifierGetter=v,this.timestampGetter=g;var t=e||{};if(t.version){if(!s(t.version))throw new Error(a.UUID_VERSION_INVALID);this.version=t.version}if("function"==typeof t.clockSequenceGetter&&(this.clockSequenceGetter=t.clockSequenceGetter),"function"==typeof t.nodeIdentifierGetter&&(this.nodeIdentifierGetter=t.nodeIdentifierGetter),"function"==typeof t.timestampGetter&&(this.timestampGetter=t.timestampGetter),t.name&&"string"==typeof t.name&&(this.name=t.name),t.namespaceId&&"string"==typeof t.namespaceId&&(this.namespaceId=t.namespaceId),/^[35]$/.test(this.version.toString())){if(!this.namespaceId)throw new Error(a.NAMESPACE_ID_MISSING);if(!this.name)throw new Error(a.NAME_MISSING)}},A=function(e){var t=e.toString(2).split("").reverse().join("");return parseInt(t,2).toString(16)},b=function(e){if(!d(e))throw new Error(a.UUID_LAST_RESULTS_INVALID);var t={clockSequence:Array.from(e.clockSequence),nodeIdentifier:Array.from(e.nodeIdentifier),timestamp:Array.from(e.timestamp)};try{Object(u.writeFileSync)(Object(p.join)(Object(f.homedir)(),"ifid"),JSON.stringify(t),{encoding:"utf8"})}catch(e){console.error("Could not save results.")}};function N(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var U=function(){function e(e){var t=new y;"object"==typeof e&&e&&(e.version&&(t.version=e.version),e.clockSequenceGetter&&(t.clockSequenceGetter=e.clockSequenceGetter),e.timestampGetter&&(t.timestampGetter=e.timestampGetter),e.nodeIdentifierGetter&&(t.nodeIdentifierGetter=e.nodeIdentifierGetter),e.namespaceId&&(t.namespaceId=e.namespaceId),e.name&&(t.name=e.name));var r=t.version;if(!s(r))throw new Error(a.UUID_VERSION_INVALID);if(m()||"1"===r.toString()&&(console.error("The time-based version 1 UUID cannot be created within the browser. Falling back to the pseudo-random version 4."),r="4"),this.__version=r,/^[35]$/.test(r.toString())){var n=t.clockSequenceGetter(r,t.namespaceId,t.name);this.__clockSequence=n;var i=t.timestampGetter(r,t.namespaceId,t.name);this.__timestamp=i;var o=t.nodeIdentifierGetter(r,t.namespaceId,t.name);this.__nodeIdentifier=o}else{var c=t.clockSequenceGetter(r);this.__clockSequence=c;var u=t.timestampGetter(r);this.__timestamp=u;var d=t.nodeIdentifierGetter(r);this.__nodeIdentifier=d,m()&&"1"===this.version.toString()&&b(this)}}return e.parse=function(e){var t=e.split("-");if(5!==t.length)throw new Error(a.UUID_STRING_INVALID);for(var r=function(e){return parseInt(parseInt(e,16).toString(2).split("").reverse().join(),2).toString(16)},n=r(t[0]),i=r(t[1]),o=r(t[2]),c=o.slice(0,3),s=o[4],u=c+i+n,d=[],f=0;f<16;f+=2)d.push(parseInt(u.slice(f,f+2),16));for(var p=new Uint8Array(d),I=r(t[3]),m=I.slice(0,2),l=parseInt(parseInt(m,16).toString(2).slice(2),2).toString(16),S=I.slice(2,4)+l,h=[],_=0;_<7;_+=2)h.push(parseInt(S.slice(_,_+2),16));for(var v=new Uint8Array(h),E=r(t[4]),g=[],y=0;y<12;y+=2)g.push(parseInt(E.slice(y,y+2),16));var A=new Uint8Array(g);return Object.assign({},this.prototype,{__version:s,__timestamp:p,__clockSequence:v,__nodeIdentifier:A})},e.prototype.toString=function(){var e=function(e,t){return A(S(e)).padEnd(t,"0")};return e(this.timeLow,8)+"-"+e(this.timeMid,4)+"-"+e(this.timeHighAndVersion,4)+"-"+e(this.clockSequenceHighAndReserved,2)+e(this.clockSequenceLow,2)+"-"+e(this.nodeIdentifier,12)},function(e,t,r){t&&N(e.prototype,t),r&&N(e,r)}(e,[{key:"version",get:function(){return this.__version}},{key:"timestamp",get:function(){return this.__timestamp}},{key:"timeLow",get:function(){return this.timestamp.slice(4,8)}},{key:"timeMid",get:function(){return this.timestamp.slice(2,4)}},{key:"timeHigh",get:function(){return this.timestamp.slice(0,2)}},{key:"timeHighAndVersion",get:function(){var e=this.timeHigh,t=parseInt(this.version.toString()).toString(2),r=S(e).toString(2),n=t.padStart(4,"0")+r.padStart(12,"0"),i=parseInt(n.slice(0,8),2),o=parseInt(n.slice(8,16),2);return new Uint8Array([i,o])}},{key:"clockSequence",get:function(){return this.__clockSequence}},{key:"clockSequenceLow",get:function(){return this.clockSequence.slice(0,1)}},{key:"clockSequenceHigh",get:function(){return this.clockSequence.slice(1)}},{key:"reserved",get:function(){return new Uint8Array([2])}},{key:"clockSequenceHighAndReserved",get:function(){var e=S(this.clockSequenceHigh).toString(2),t=S(this.reserved).toString(2),r=e.padStart(6,"0")+t.padStart(2,"0");return new Uint8Array([parseInt(r,2)])}},{key:"nodeIdentifier",get:function(){return this.__nodeIdentifier}}]),e}();r.d(t,"NamespaceIds",function(){return n}),r.d(t,"UUIDOptions",function(){return y}),r.d(t,"UUID",function(){return U}),r.d(t,"clockSequenceGetter",function(){return h}),r.d(t,"getHashFromNamespaceIdAndName",function(){return c}),r.d(t,"getHundredsOfNanosecondsSinceGregorianReform",function(){return E}),r.d(t,"nodeIdentifierGetter",function(){return v}),r.d(t,"numberAsLittleEndianHexStr",function(){return A}),r.d(t,"timestampGetter",function(){return g}),r.d(t,"uintArrayAsNumber",function(){return S})}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ifid=e():t.ifid=e()}(this,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return 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 i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));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=9)}([function(t,e,r){"use strict";(function(t){r.d(e,"a",function(){return n});var n=function(e){return parseInt(t.from(e).toString("hex"),16)}}).call(this,r(4).Buffer)},function(t,e){},function(t,e){e.endianness=function(){return"LE"},e.hostname=function(){return"undefined"!=typeof location?location.hostname:""},e.loadavg=function(){return[]},e.uptime=function(){return 0},e.freemem=function(){return Number.MAX_VALUE},e.totalmem=function(){return Number.MAX_VALUE},e.cpus=function(){return[]},e.type=function(){return"Browser"},e.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},e.networkInterfaces=e.getNetworkInterfaces=function(){return{}},e.arch=function(){return"javascript"},e.platform=function(){return"browser"},e.tmpdir=e.tmpDir=function(){return"/tmp"},e.EOL="\n",e.homedir=function(){return"/"}},function(t,e){function r(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r--;r)t.unshift("..");return t}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(t){return n.exec(t).slice(1)};function o(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}e.resolve=function(){for(var t="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var i=n>=0?arguments[n]:process.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");i&&(t=i+"/"+t,e="/"===i.charAt(0))}return t=r(o(t.split("/"),function(t){return!!t}),!e).join("/"),(e?"/":"")+t||"."},e.normalize=function(t){var n=e.isAbsolute(t),i="/"===s(t,-1);return(t=r(o(t.split("/"),function(t){return!!t}),!n).join("/"))||n||(t="."),t&&i&&(t+="/"),(n?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(o(t,function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},e.relative=function(t,r){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=e.resolve(t).substr(1),r=e.resolve(r).substr(1);for(var i=n(t.split("/")),o=n(r.split("/")),s=Math.min(i.length,o.length),u=s,a=0;a<s;a++)if(i[a]!==o[a]){u=a;break}var f=[];for(a=u;a<i.length;a++)f.push("..");return(f=f.concat(o.slice(u))).join("/")},e.sep="/",e.delimiter=":",e.dirname=function(t){var e=i(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},e.basename=function(t,e){var r=i(t)[2];return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},e.extname=function(t){return i(t)[3]};var s="b"==="ab".substr(-1)?function(t,e,r){return t.substr(e,r)}:function(t,e,r){return e<0&&(e=t.length+e),t.substr(e,r)}},function(t,e,r){"use strict";(function(t){ | ||
/*! | ||
* The buffer module from node.js, for the browser. | ||
* | ||
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> | ||
* @license MIT | ||
*/ | ||
var n=r(6),i=r(7),o=r(8);function s(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=a.prototype:(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,r){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);a.TYPED_ARRAY_SUPPORT?(t=e).__proto__=a.prototype:t=p(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),i=(t=u(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(a.isBuffer(e)){var r=0|l(e.length);return 0===(t=u(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||function(t){return t!=t}(e.length)?u(t,0):p(t,e);if("Buffer"===e.type&&o(e.data))return p(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(c(e),t=u(t,e<0?0:0|l(e)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function p(t,e){var r=e.length<0?0:0|l(e.length);t=u(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function l(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var o,s=1,u=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,u/=2,a/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var c=-1;for(o=r;o<u;o++)if(f(t,o)===f(e,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===a)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(r+a>u&&(r=u-a),o=r;o>=0;o--){for(var h=!0,p=0;p<a;p++)if(f(t,o+p)!==f(e,p)){h=!1;break}if(h)return o}return-1}function v(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var u=parseInt(e.substr(2*s,2),16);if(isNaN(u))return s;t[r+s]=u}return s}function I(t,e,r,n){return q(G(e,t.length-r),t,r,n)}function w(t,e,r,n){return q(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return w(t,e,r,n)}function _(t,e,r,n){return q(V(e),t,r,n)}function S(t,e,r,n){return q(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function b(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,u,a,f=t[i],c=null,h=f>239?4:f>223?3:f>191?2:1;if(i+h<=r)switch(h){case 1:f<128&&(c=f);break;case 2:128==(192&(o=t[i+1]))&&(a=(31&f)<<6|63&o)>127&&(c=a);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(a=(15&f)<<12|(63&o)<<6|63&s)>2047&&(a<55296||a>57343)&&(c=a);break;case 4:o=t[i+1],s=t[i+2],u=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&o)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(c=a)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(t){var e=t.length;if(e<=U)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=U));return r}(n)}e.Buffer=a,e.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},e.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,r){return f(null,t,e,r)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?u(t,e):void 0!==r?"string"==typeof n?u(t,e).fill(r,n):u(t,e).fill(r):u(t,e)}(null,t,e,r)},a.allocUnsafe=function(t){return h(null,t)},a.allocUnsafeSlow=function(t){return h(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(!a.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},a.byteLength=d,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?b(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return D(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,e,r,n,i){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,s=r-e,u=Math.min(o,s),f=this.slice(n,i),c=t.slice(e,r),h=0;h<u;++h)if(f[h]!==c[h]){o=f[h],s=c[h];break}return o<s?-1:s<o?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return I(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var U=4096;function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function R(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function D(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=Y(t[o]);return i}function N(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function L(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function O(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function k(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(t,e,r,n,o){return o||k(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return o||k(t,0,r,8),i.write(t,e,r,n,52,8),r+8}a.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),a.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=a.prototype;else{var i=e-t;r=new a(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},a.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},a.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},a.prototype.readUInt8=function(t,e){return e||L(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||L(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||L(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||L(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},a.prototype.readInt8=function(t,e){return e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||L(t,4,this.length),i.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||L(t,8,this.length),i.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),a.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},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),a.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},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=0,s=1,u=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===u&&0!==this[e+o-1]&&(u=1),this[e+o]=(t/s>>0)-u&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=r-1,s=1,u=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===u&&0!==this[e+o+1]&&(u=1),this[e+o]=(t/s>>0)-u&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),a.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},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.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},a.prototype.writeFloatLE=function(t,e,r){return M(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return M(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=a.isBuffer(t)?t:G(new a(t,n).toString()),u=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%u]}return this};var C=/[^+\/0-9A-Za-z-_]/g;function Y(t){return t<16?"0"+t.toString(16):t.toString(16)}function G(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function V(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(5))},function(t,e){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){for(var e,r=f(t),n=r[0],s=r[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,n,s)),a=0,c=s>0?n-4:n,h=0;h<c;h+=4)e=i[t.charCodeAt(h)]<<18|i[t.charCodeAt(h+1)]<<12|i[t.charCodeAt(h+2)]<<6|i[t.charCodeAt(h+3)],u[a++]=e>>16&255,u[a++]=e>>8&255,u[a++]=255&e;2===s&&(e=i[t.charCodeAt(h)]<<2|i[t.charCodeAt(h+1)]>>4,u[a++]=255&e);1===s&&(e=i[t.charCodeAt(h)]<<10|i[t.charCodeAt(h+1)]<<4|i[t.charCodeAt(h+2)]>>2,u[a++]=e>>8&255,u[a++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,u=r-i;s<u;s+=16383)o.push(h(t,s,s+16383>u?u:s+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,a=s.length;u<a;++u)n[u]=s[u],i[s.charCodeAt(u)]=u;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[63&t]}function h(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),i.push(c(n));return i.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,s,u=8*i-n-1,a=(1<<u)-1,f=a>>1,c=-7,h=r?i-1:0,p=r?-1:1,l=t[e+h];for(h+=p,o=l&(1<<-c)-1,l>>=-c,c+=u;c>0;o=256*o+t[e+h],h+=p,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=p,c-=8);if(0===o)o=1-f;else{if(o===a)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),o-=f}return(l?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,u,a,f=8*o-i-1,c=(1<<f)-1,h=c>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),(e+=s+h>=1?p/a:p*Math.pow(2,1-h))*a>=2&&(s++,a/=2),s+h>=c?(u=0,s=c):s+h>=1?(u=(e*a-1)*Math.pow(2,i),s+=h):(u=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+l]=255&u,l+=d,u/=256,i-=8);for(s=s<<i|u,f+=i;f>0;t[r+l]=255&s,l+=d,s/=256,f-=8);t[r+l-d]|=128*g}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n;r.r(e),function(t){t.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",t.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",t.OID="6ba7b812-9dad-11d1-80b4-00c04fd430c8",t.X500="6ba7b814-9dad-11d1-80b4-00c04fd430c8"}(n||(n={}));var i=function(t){for(var e=[],r=t.length;r>0;r-=8){var n=t.slice(r-8,r).padStart(8,"0");e.unshift(parseInt(n,2))}return new Uint8Array(e)},o=r(1),s={BIT_ARRAY_INVALID:"The array of bits was not an array, had no contents, or had one or more items which did not meet the isBit type guard.",UUID_VERSION_INVALID:"The version argument was not a valid UUID version.",TIMESTAMP_GENERATION_FAILED:"The random number generator did not produce an acceptable value for the random number used in place of a stable timestamp.",TIMESTAMP_INVALID:"The timestamp property of the UUID object is malformed.",NAMESPACE_ID_MISSING:"In order to construct a v3 or v5 UUID, you need to provide a namespace ID to be hashed.",NAME_MISSING:"In order to construct a v3 or v5 UUID, you need to provide a name to be hashed.",CLOCK_SEQUENCE_INVALID:"The clockSequence property of the UUID object is malformed.",CLOCK_SEQUENCE_GENERATION_FAILED:"The random number generator did not produce an acceptable value for the random number used in place of a stable clock sequence.",CLOCK_SEQUENCE_LOW_INVALID:"The clockSequenceLow property of the UUID object is malformed.",CLOCK_SEQUENCE_HIGH_INVALID:"The clockSequenceHigh property of the UUID object is malformed.",CLOCK_HIGH_AND_RESERVED_INVALID:"The clockSequenceHighAndReserved property of the UUID object is malformed.",MAC_ADDRESS_UNAVAILABLE:"The MAC address is unavailable, which makes creating the version 1 node ID impossible.",MAC_ADDRESS_INVALID:"The MAC address was found, but it was malformed.",UUID_LAST_RESULTS_INVALID:"The provided last results object did not meet the isValidLastResults type guard.",UUID_STRING_INVALID:"The text argument passed to UUID.parse was malformed.",UUID_OPTIONS_INVALID:"The options argument passed to one of the UUID methods did not meet the isUUIDOptions type guard.",TIME_LOW_INVALID:"The timestamp property did not produce a valid low portion of the timestamp.",TIME_MID_INVALID:"The timestamp property did not produce a valid mid portion of the timestamp.",TIME_HIGH_INVALID:"The timestamp property did not produce a valid high portion of the timestamp.",TIME_HIGH_AND_VERSION_INVALID:"The timestamp property did not produce a valid high-and-version multiplex.",NODE_IDENTIFIER_INVALID:"The nodeIdentifier property of the UUID object was malformed."},u=function(t,e,r){if(!e)throw new Error(s.NAMESPACE_ID_MISSING);if(!r)throw new Error(s.NAME_MISSING);var n;n="3"===t.toString()?Object(o.createHash)("md5"):Object(o.createHash)("sha1");var i=e.split("-").map(function(t){var e=t.length;return parseInt(parseInt(t,16).toString(2).split("").reverse().join(""),2).toString(16).padEnd(e,"0")}).join("-");return n.update(i+r),n.digest("hex")};function a(t){return/^[1345]$/.test(t.toString())}function f(t){return"object"==typeof t&&t&&t.clockSequence&&"BYTES_PER_ELEMENT"in t.clockSequence&&t.nodeIdentifier&&"BYTES_PER_ELEMENT"in t.nodeIdentifier&&t.timestamp&&"BYTES_PER_ELEMENT"in t.timestamp}var c=r(2),h=r(3),p=function(){var t=null;try{var e=Object(o.readFileSync)(Object(h.join)(Object(c.homedir)(),"ifid"),"utf8");t=JSON.parse(e)}catch(t){}return f(t)?t:{}}(),l=function(){return Boolean("undefined"!=typeof process&&process.versions&&process.versions.node)},d=function(t){if(l())return new Uint8Array(Object(o.randomBytes)(t));for(var e=e||msCrypto,r=new Uint8Array(t),n=0;n<t;n+=65536)e.getRandomValues(r.subarray(n,n+Math.min(t-n,65536)));return r},g=r(0);function y(t,e,r){if(!a(t))throw new Error(s.UUID_VERSION_INVALID);var n;if(/^[14]$/.test(t.toString())){if(p.clockSequence&&"BYTES_PER_ELEMENT"in p.clockSequence)return p.clockSequence;n=function(){var t=Object(g.a)(d(2)).toString(2).slice(0,14);return new Uint8Array([parseInt(t.slice(0,6),2),parseInt(t.slice(6),2)])}(),"1"===t.toString()&&(p.clockSequence=n)}else{var o=u(t,e,r),f="";f+=o.slice(16,18),f+=o.slice(18,20);var c=parseInt(f,16).toString(2).padStart(14,"0");n=i(c)}return n}function m(){for(var t=Object(c.networkInterfaces)(),e=Object.keys(t),r=0;r<e.length;r+=1)for(var n=t[e[r]],i=0;i<n.length;i+=1){var o=n[i];if("object"==typeof o&&o){var u=o.mac;if("string"==typeof u&&u&&"00:00:00:00:00:00"!==u){var a=u.split(":").map(function(t){return parseInt(t,16)});return new Uint8Array(a)}}}throw new Error(s.MAC_ADDRESS_UNAVAILABLE)}function v(t,e,r){var n;if("1"===t.toString()){if(p.nodeIdentifier&&"BYTES_PER_ELEMENT"in p.nodeIdentifier)return p.nodeIdentifier;n=m(),p.nodeIdentifier=n}else if(/^[35]$/.test(t.toString())){var o="";o+=u(t,e,r).slice(20,32);var a=parseInt(o,16).toString(2).padStart(48,"0");n=i(a)}else{if("4"!==t.toString())throw new Error(s.UUID_VERSION_INVALID);n=d(6)}return n}function I(){return 10*((new Date).getTime()-new Date(1582,9,15).getTime())}function w(t,e,r){if(!a(t))throw new Error(s.UUID_VERSION_INVALID);var n;if("1"===t.toString()){var o=p.timestamp,f=I();o&&"BYTES_PER_ELEMENT"in o&&Object(g.a)(o)>f&&p.clockSequence&&"BYTES_PER_ELEMENT"in p.clockSequence&&(p.clockSequence[1]+=1);for(var c=f.toString(2).padStart(60,"0"),h=[],l=60;l>0;l-=8){var y=c.slice(l-8,l).padStart(8,"0");h.unshift(parseInt(y,2))}n=new Uint8Array(h)}else if(/^[35]$/.test(t.toString())){var m=u(t,e,r),v="";v=m.slice(0,8),v=m.slice(8,12)+v,v=m.slice(12,16)+v;var w=parseInt(v,16).toString(2).padStart(60,"0");n=i(w)}else(n=d(8))[7]=parseInt(n[7].toString(2).slice(0,4),2);return p.timestamp=n,n}var E=function(t){void 0===t&&(t={}),this.version="4",this.clockSequenceGetter=y,this.nodeIdentifierGetter=v,this.timestampGetter=w;var e=t||{};if(e.version){if(!a(e.version))throw new Error(s.UUID_VERSION_INVALID);this.version=e.version}if("function"==typeof e.clockSequenceGetter&&(this.clockSequenceGetter=e.clockSequenceGetter),"function"==typeof e.nodeIdentifierGetter&&(this.nodeIdentifierGetter=e.nodeIdentifierGetter),"function"==typeof e.timestampGetter&&(this.timestampGetter=e.timestampGetter),e.name&&"string"==typeof e.name&&(this.name=e.name),e.namespaceId&&"string"==typeof e.namespaceId&&(this.namespaceId=e.namespaceId),/^[35]$/.test(this.version.toString())){if(!this.namespaceId)throw new Error(s.NAMESPACE_ID_MISSING);if(!this.name)throw new Error(s.NAME_MISSING)}},_=function(t){var e=t.toString(2).split("").reverse().join("");return parseInt(e,2).toString(16)},S=function(t){if(!f(t))throw new Error(s.UUID_LAST_RESULTS_INVALID);var e={clockSequence:Array.from(t.clockSequence),nodeIdentifier:Array.from(t.nodeIdentifier),timestamp:Array.from(t.timestamp)};try{Object(o.writeFileSync)(Object(h.join)(Object(c.homedir)(),"ifid"),JSON.stringify(e),{encoding:"utf8"})}catch(t){console.error("Could not save results.")}};function A(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var b=function(){function t(t){var e=new E;"object"==typeof t&&t&&(t.version&&(e.version=t.version),t.clockSequenceGetter&&(e.clockSequenceGetter=t.clockSequenceGetter),t.timestampGetter&&(e.timestampGetter=t.timestampGetter),t.nodeIdentifierGetter&&(e.nodeIdentifierGetter=t.nodeIdentifierGetter),t.namespaceId&&(e.namespaceId=t.namespaceId),t.name&&(e.name=t.name));var r=e.version;if(!a(r))throw new Error(s.UUID_VERSION_INVALID);if(l()||"1"===r.toString()&&(console.error("The time-based version 1 UUID cannot be created within the browser. Falling back to the pseudo-random version 4."),r="4"),this.__version=r,/^[35]$/.test(r.toString())){var n=e.clockSequenceGetter(r,e.namespaceId,e.name);this.__clockSequence=n;var i=e.timestampGetter(r,e.namespaceId,e.name);this.__timestamp=i;var o=e.nodeIdentifierGetter(r,e.namespaceId,e.name);this.__nodeIdentifier=o}else{var u=e.clockSequenceGetter(r);this.__clockSequence=u;var f=e.timestampGetter(r);this.__timestamp=f;var c=e.nodeIdentifierGetter(r);this.__nodeIdentifier=c,l()&&"1"===this.version.toString()&&S(this)}}return t.parse=function(t){var e=t.split("-");if(5!==e.length)throw new Error(s.UUID_STRING_INVALID);for(var r=function(t){return parseInt(parseInt(t,16).toString(2).split("").reverse().join(),2).toString(16)},n=r(e[0]),i=r(e[1]),o=r(e[2]),u=o.slice(0,3),a=o[4],f=u+i+n,c=[],h=0;h<16;h+=2)c.push(parseInt(f.slice(h,h+2),16));for(var p=new Uint8Array(c),l=r(e[3]),d=l.slice(0,2),g=parseInt(parseInt(d,16).toString(2).slice(2),2).toString(16),y=l.slice(2,4)+g,m=[],v=0;v<7;v+=2)m.push(parseInt(y.slice(v,v+2),16));for(var I=new Uint8Array(m),w=r(e[4]),E=[],_=0;_<12;_+=2)E.push(parseInt(w.slice(_,_+2),16));var S=new Uint8Array(E);return Object.assign({},this.prototype,{__version:a,__timestamp:p,__clockSequence:I,__nodeIdentifier:S})},t.prototype.toString=function(){var t=function(t,e){return _(Object(g.a)(t)).padEnd(e,"0")};return t(this.timeLow,8)+"-"+t(this.timeMid,4)+"-"+t(this.timeHighAndVersion,4)+"-"+t(this.clockSequenceHighAndReserved,2)+t(this.clockSequenceLow,2)+"-"+t(this.nodeIdentifier,12)},function(t,e,r){e&&A(t.prototype,e),r&&A(t,r)}(t,[{key:"version",get:function(){return this.__version}},{key:"timestamp",get:function(){return this.__timestamp}},{key:"timeLow",get:function(){return this.timestamp.slice(4,8)}},{key:"timeMid",get:function(){return this.timestamp.slice(2,4)}},{key:"timeHigh",get:function(){return this.timestamp.slice(0,2)}},{key:"timeHighAndVersion",get:function(){var t=this.timeHigh,e=parseInt(this.version.toString()).toString(2),r=Object(g.a)(t).toString(2),n=e.padStart(4,"0")+r.padStart(12,"0"),i=parseInt(n.slice(0,8),2),o=parseInt(n.slice(8,16),2);return new Uint8Array([i,o])}},{key:"clockSequence",get:function(){return this.__clockSequence}},{key:"clockSequenceLow",get:function(){return this.clockSequence.slice(0,1)}},{key:"clockSequenceHigh",get:function(){return this.clockSequence.slice(1)}},{key:"reserved",get:function(){return new Uint8Array([2])}},{key:"clockSequenceHighAndReserved",get:function(){var t=Object(g.a)(this.clockSequenceHigh).toString(2),e=Object(g.a)(this.reserved).toString(2),r=t.padStart(6,"0")+e.padStart(2,"0");return new Uint8Array([parseInt(r,2)])}},{key:"nodeIdentifier",get:function(){return this.__nodeIdentifier}}]),t}();r.d(e,"NamespaceIds",function(){return n}),r.d(e,"UUIDOptions",function(){return E}),r.d(e,"UUID",function(){return b}),r.d(e,"clockSequenceGetter",function(){return y}),r.d(e,"getHashFromNamespaceIdAndName",function(){return u}),r.d(e,"getHundredsOfNanosecondsSinceGregorianReform",function(){return I}),r.d(e,"nodeIdentifierGetter",function(){return v}),r.d(e,"numberAsLittleEndianHexStr",function(){return _}),r.d(e,"timestampGetter",function(){return w}),r.d(e,"uintArrayAsNumber",function(){return g.a})}])}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "big-uuid", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"description": "An RFC 4112 conformant UUID generator creating v1, v3, v4, and v5 UUIDs.", | ||
"main": "dist/umd/index.js", | ||
"main": "dist/node.es6/index.js", | ||
"browser": "dist/umd/index.js", | ||
"types": "src/index.d.ts", | ||
"scripts": { | ||
"build": "cross-env NODE_ENV=production npm run build-node && npm run build-browser && npm run copy-declaration-file", | ||
"build-node": "tsc", | ||
"build": "cross-env NODE_ENV=production npm run build-node && npm run build-browser && npm run copy-declaration-file", | ||
"build-node": "npm run build-node-esnext && npm run build-node-es6", | ||
"build-node-esnext": "tsc", | ||
"build-node-es6": "tsc --project tsconfig.es6.json", | ||
"copy-declaration-file": "copy dist\\node.esnext\\index.d.ts src\\", | ||
@@ -11,0 +14,0 @@ "build-browser": "webpack -p --display-modules --display-error-details", |
@@ -6,3 +6,2 @@ const path = require('path'); | ||
mode, | ||
target: 'node', | ||
entry: path.resolve(__dirname, 'dist/node.esnext/index.js'), | ||
@@ -9,0 +8,0 @@ resolve: { |
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
301566
146
3089
1
5