text: var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=_default;exports.URL=exports.DNS=void 0;var _stringify=_interopRequireDefault(require("./stringify.js"));var _parse=_interopRequireDefault(require("./parse.js"));function stringToBytes(str){str=unescape(encodeURIComponent(str));var bytes=[];for(var i=0;i<str.length;++i){bytes.push(str.charCodeAt(i));}return bytes;}var DNS='6ba7b810-9dad-11d1-80b4-00c04fd430c8';exports.DNS=DNS;var URL='6ba7b811-9dad-11d1-80b4-00c04fd430c8';exports.URL=URL;function _default(name,version,hashfunc){function generateUUID(value,namespace,buf,offset){if(typeof value==='string'){value=stringToBytes(value);}if(typeof namespace==='string'){namespace=(0,_parse.default)(namespace);}if(namespace.length!==16){throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');}var bytes=new Uint8Array(16+value.length);bytes.set(namespace);bytes.set(value,namespace.length);bytes=hashfunc(bytes);bytes[6]=bytes[6]&0x0f|version;bytes[8]=bytes[8]&0x3f|0x80;if(buf){offset=offset||0;for(var i=0;i<16;++i){buf[offset+i]=bytes[i];}return buf;}return(0,_stringify.default)(bytes);}try{generateUUID.name=name;}catch(err){}generateUUID.DNS=DNS;generateUUID.URL=URL;return generateUUID;}