@contentstack/live-preview-utils
Version:
Contentstack provides the Live Preview SDK to establish a communication channel between the various Contentstack SDKs and your website, transmitting live changes to the preview pane.
1 lines • 113 kB
Source Map (JSON)
{"version":3,"sources":["../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/webpack/universalModuleDefinition","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/configHandler.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/constants/errorMessages.constants.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/constants/index.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/defaults/config.default.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/index.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/sendMessage.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/types/index.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/types/postMessageEvents.types.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/utils/logger.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/utils/safeInterval.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/src/utils/uniqueId.ts","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/index.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/md5.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/native.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/nil.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/parse.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/regex.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/rng.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/sha1.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/stringify.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/v1.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/v3.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/v35.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/v4.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/v5.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/validate.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/uuid/dist/commonjs-browser/version.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/zalgo-promise/dist/zalgo-promise.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/node_modules/zalgo-promise/index.js","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/webpack/bootstrap","../../../../node_modules/@contentstack/advanced-post-message/dist/webpack:/ContentstackAdvPostMessage/webpack/startup","../../../../src/visualBuilder/utils/visualBuilderPostMessage.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ContentstackAdvPostMessage\"] = factory();\n\telse\n\t\troot[\"ContentstackAdvPostMessage\"] = factory();\n})(this, () => {\nreturn ","import { ERROR_MESSAGES } from \"./constants\";\nimport { getDefaultConfig } from \"./defaults/config.default\";\nimport { EventManagerOptions, UserConfig } from \"./types\";\nimport { getErrorMessage } from \"./utils/logger\";\n\n/**\n * Class responsible for handling the configuration settings.\n */\nexport class Config {\n private config: UserConfig = getDefaultConfig();\n\n /**\n * Replaces the current configuration with the provided partial configuration.\n * @param config - The partial configuration to replace the current configuration with.\n */\n replace(\n config: Partial<EventManagerOptions> & { channelId?: string }\n ): void {\n updateConfig(config, this.config);\n }\n\n /**\n * Sets a specific configuration key to the provided value.\n * @param key - The configuration key to set.\n * @param value - The value to set for the configuration key.\n */\n set<K extends keyof UserConfig>(key: K, value: UserConfig[K]): void {\n this.config[key] = value;\n }\n\n /**\n * Retrieves the value of a specific configuration key.\n * @param key - The configuration key to retrieve the value for.\n * @returns The value of the configuration key.\n */\n get<K extends keyof UserConfig>(key: K): UserConfig[K] {\n return this.config[key];\n }\n\n /**\n * Retrieves all user configurations.\n * @returns {UserConfig} The user configurations.\n */\n getAll(): UserConfig {\n return this.config;\n }\n\n /**\n * Resets the configuration to the default values.\n */\n reset(): void {\n this.config = getDefaultConfig();\n }\n}\n\n/**\n * Updates the configuration object with the provided partial configuration.\n * @param userInput - The partial configuration provided by the user.\n * @param config - The current configuration object.\n */\nfunction updateConfig(\n userInput: Partial<EventManagerOptions> & { channelId?: string },\n config: UserConfig\n): void {\n config.debug = userInput.debug ?? config.debug;\n\n if (userInput.channelId === \"\") {\n throw new Error(\n getErrorMessage(ERROR_MESSAGES.common.channelIdRequired)\n );\n }\n\n config.channelId = userInput.channelId ?? config.channelId;\n\n config.suppressErrors = userInput.suppressErrors ?? config.suppressErrors;\n\n config.targetOrigin = userInput.targetOrigin ?? config.targetOrigin;\n\n if (userInput.target) {\n config.targetWindow = userInput.target;\n } else if (window) {\n config.targetWindow = window;\n } else {\n config.targetWindow = {\n postMessage: () => {},\n } as unknown as Window;\n }\n}\n","export const ERROR_MESSAGES = {\n common: {\n windowClosed: \"The window closed before the response was received\",\n windowNotFound: \"The window was not found.\",\n channelIdRequired: \"The channelId is required\",\n },\n sendEvent: {\n receiverReturnedError: \"The receiver returned an error\",\n eventCancelled: \"The event was cancelled\",\n noAckReceived: \"The ACK was not received\",\n },\n receiveEvent: {\n noRequestListenerFound(type: string) {\n return `No request listener found for event \"${type}\"` as const;\n },\n codeReturnedError: \"The code returned an error\",\n noResponseListenerFound(hash: string) {\n return `No response listener found for hash \"${hash}\"` as const;\n },\n noAckListenerFound(hash: string) {\n return `No ack listener found for hash \"${hash}\"` as const;\n },\n unknownNature(nature: string) {\n return `The nature \"${nature}\" is unknown` as const;\n },\n },\n registerEvent: {\n eventAlreadyRegistered(type: string) {\n return `The event \"${type}\" is already registered` as const;\n },\n },\n unregisterEvent: {\n eventDoesNotExist(type: string) {\n return `The event \"${type}\" does not exist` as const;\n },\n },\n} as const;\n\n\nexport const ERROR_CODES = {\n common: {\n windowClosed: \"WINDOW_CLOSED\",\n windowNotFound: \"WINDOW_NOT_FOUND\",\n },\n sendEvent: {\n receiverReturnedError: \"RECEIVER_RETURNED_ERROR\",\n eventCancelled: \"EVENT_CANCELLED\",\n noAckReceived: \"NO_ACK_RECEIVED\",\n },\n receiveEvent: {\n noRequestListenerFound: \"NO_REQUEST_LISTENER_FOUND\",\n codeReturnedError: \"CODE_RETURNED_ERROR\",\n noResponseListenerFound: \"NO_RESPONSE_LISTENER_FOUND\",\n noAckListenerFound: \"NO_ACK_LISTENER_FOUND\",\n unknownNature: \"UNKNOWN_NATURE\",\n },\n registerEvent: {\n eventAlreadyRegistered: \"EVENT_ALREADY_REGISTERED\",\n },\n unregisterEvent: {\n eventDoesNotExist: \"EVENT_DOES_NOT_EXIST\",\n },\n} as const;","export const RESPONSE_CYCLE = 500;\nexport const ANY_ORIGIN = \"*\";\nexport const EVENT_MANAGER_NAME = \"contentstack-adv-post-message\";\n\nexport * from \"./errorMessages.constants\";\n","import { UserConfig } from \"../types/configHandler.types\";\nimport { ANY_ORIGIN } from \"../constants\";\n\nexport function getDefaultConfig(): UserConfig {\n return {\n targetOrigin: ANY_ORIGIN,\n targetWindow: {\n postMessage: () => {},\n } as unknown as Window,\n debug: false,\n channelId: \"\",\n suppressErrors: false,\n };\n}\n","import { ZalgoPromise } from \"zalgo-promise\";\n\nimport { Config } from \"./configHandler\";\nimport {\n ERROR_CODES,\n ERROR_MESSAGES,\n EVENT_MANAGER_NAME,\n RESPONSE_CYCLE,\n} from \"./constants\";\nimport { PostMessage } from \"./sendMessage\";\nimport { Logger, getErrorMessage } from \"./utils/logger\";\nimport { safeInterval } from \"./utils/safeInterval\";\nimport { uniqueId } from \"./utils/uniqueId\";\n\nimport {\n EditorPostMessageNature,\n EditorRequestEventMessage,\n EventManagerOptions,\n OnEvent,\n RequestHandler,\n RequestListener,\n ResponseListener,\n} from \"./types\";\n\nexport class EventManager {\n private requestMessageHandlers = new Map<string, RequestListener>();\n private responseMessageHandlers = new Map<string, ResponseListener>();\n private postMessage: PostMessage;\n private logger: Logger;\n private config: Config;\n\n constructor(channelId: string, options: Partial<EventManagerOptions> = {}) {\n if (!channelId) {\n throw new Error(\n getErrorMessage(ERROR_MESSAGES.common.channelIdRequired)\n );\n }\n\n this.config = new Config();\n\n this.config.replace({ ...options, channelId: channelId });\n\n this.logger = new Logger(this.config);\n this.postMessage = new PostMessage(this.logger, this.config);\n\n this.handleIncomingMessage = this.handleIncomingMessage.bind(this);\n this.send = this.send.bind(this);\n this.on = this.on.bind(this);\n this.unregisterEvent = this.unregisterEvent.bind(this);\n\n if (!window) {\n this.logger.debug(\n getErrorMessage(ERROR_MESSAGES.common.windowNotFound)\n );\n } else {\n window.addEventListener(\"message\", this.handleIncomingMessage);\n }\n }\n\n /**\n * Handle an incoming post message event\n * @param event The post message event containing details of the request\n * @returns A promise that resolves when the response is received\n */\n private async handleIncomingMessage(\n event: MessageEvent<EditorRequestEventMessage>\n ) {\n const { type, channel, payload, eventManager, metadata, error } =\n event.data;\n\n if (\n eventManager !== EVENT_MANAGER_NAME ||\n channel !== this.config.get(\"channelId\")\n ) {\n return;\n }\n\n const { hash, nature } = metadata;\n\n switch (nature) {\n case EditorPostMessageNature.REQUEST: {\n this.logger.debug(\"REQUEST received\", event.data);\n if (this.config.get(\"targetWindow\").closed) {\n this.logger.error(\n getErrorMessage(ERROR_MESSAGES.common.windowClosed)\n );\n }\n\n this.postMessage.sendAck({ type, hash });\n\n if (!this.requestMessageHandlers.has(type)) {\n this.logger.debug(\n getErrorMessage(\n ERROR_MESSAGES.receiveEvent.noRequestListenerFound(\n type\n )\n )\n );\n\n this.postMessage.sendResponse({\n type,\n hash,\n payload: undefined,\n error: {\n code: ERROR_CODES.receiveEvent\n .noRequestListenerFound,\n message: getErrorMessage(\n ERROR_MESSAGES.receiveEvent.noRequestListenerFound(\n type\n )\n ),\n },\n });\n return;\n }\n\n const { handler } = this.requestMessageHandlers.get(type)!;\n\n const handlerEvent: OnEvent = {\n data: payload,\n };\n\n return ZalgoPromise.all([\n ZalgoPromise.try(() => {\n return handler(handlerEvent);\n })\n .then((data) => {\n this.postMessage.sendResponse({\n type,\n hash,\n payload: data,\n error: undefined,\n });\n })\n .catch((err) => {\n this.logger.error(\n getErrorMessage(\n ERROR_MESSAGES.receiveEvent\n .codeReturnedError\n ),\n err\n );\n }),\n ]);\n }\n case EditorPostMessageNature.RESPONSE: {\n this.logger.debug(\"RESPONSE received\", event.data);\n\n if (!this.responseMessageHandlers.has(hash)) {\n this.logger.error(\n getErrorMessage(\n ERROR_MESSAGES.receiveEvent.noResponseListenerFound(\n hash\n )\n )\n );\n return;\n }\n\n const responseListener =\n this.responseMessageHandlers.get(hash)!;\n\n if (error) {\n responseListener.promise.reject(error);\n } else {\n responseListener.promise.resolve(payload);\n }\n\n break;\n }\n case EditorPostMessageNature.ACK: {\n this.logger.debug(\"ACK received\", event.data);\n\n if (!this.responseMessageHandlers.has(hash)) {\n this.logger.error(\n getErrorMessage(\n ERROR_MESSAGES.receiveEvent.noAckListenerFound(hash)\n )\n );\n return;\n }\n\n const responseListener =\n this.responseMessageHandlers.get(hash)!;\n responseListener.hasReceivedAck = true;\n\n break;\n }\n default:\n this.logger.error(\n getErrorMessage(\n ERROR_MESSAGES.receiveEvent.unknownNature(nature)\n ),\n event.data\n );\n }\n }\n\n /**\n * Send an event to the target window\n * @param type The type of event to send\n * @param payload The payload to send with the event\n *\n * @example\n * const eventManager = new EventManager(\"channel-id\");\n *\n * const output = eventManager.send(\"my-event\", { foo: \"bar\" });\n * console.log(output) // { foo: \"bar1\" }\n */\n async send<ReturnType = undefined>(type: string, payload?: any) {\n const promise = new ZalgoPromise<ReturnType>();\n const hash = uniqueId(type);\n\n const responseListener: ResponseListener = {\n type,\n promise,\n hasCancelled: false,\n hasReceivedAck: false,\n };\n\n this.responseMessageHandlers.set(hash, responseListener);\n\n const totalAllowedAckTime = 1000;\n let ackTimeLeft = totalAllowedAckTime;\n\n const interval = safeInterval(() => {\n if (this.config.get(\"targetWindow\").closed) {\n return promise.reject(\n new Error(\n getErrorMessage(ERROR_MESSAGES.common.windowClosed)\n )\n );\n }\n\n // TODO: raise this event\n // if (responseListener.hasCancelled) {\n // return promise.reject(\n // new Error(\n // getErrorMessage(ERROR_MESSAGES.sendEvent.eventCancelled)\n // )\n // );\n // }\n\n ackTimeLeft = Math.max(ackTimeLeft - RESPONSE_CYCLE, 0);\n\n if (!responseListener.hasReceivedAck && ackTimeLeft <= 0) {\n return promise.reject(\n getErrorMessage(ERROR_MESSAGES.sendEvent.noAckReceived)\n );\n }\n }, RESPONSE_CYCLE);\n\n promise\n .finally(() => {\n this.responseMessageHandlers.delete(hash);\n interval.cancel();\n })\n .catch((err) => {\n this.logger.debug(\n getErrorMessage(\n ERROR_MESSAGES.sendEvent.receiverReturnedError\n ),\n err\n );\n });\n\n this.postMessage.sendRequest({\n type,\n hash,\n error: undefined,\n payload,\n });\n\n return promise;\n }\n\n /**\n * Register an event handler for a specific event type\n * @param type The type of event to listen for\n * @param handler The handler to call when the event is received\n * @returns An object with an unregister method to unregister the event\n *\n * @example\n * const eventManager = new EventManager(\"channel-id\");\n *\n * const unregister = eventManager.on(\"my-event\", (event) => {\n * console.log(\"event received\", event.data);\n * return { foo: \"bar1\" };\n * });\n *\n * unregister();\n */\n on<Payload = unknown, ReturnType = any>(\n type: string,\n handler: RequestHandler<Payload, ReturnType>\n ) {\n if (this.requestMessageHandlers.has(type)) {\n this.logger.error(\n getErrorMessage(\n ERROR_MESSAGES.registerEvent.eventAlreadyRegistered(type)\n )\n );\n }\n\n const requestListener: RequestListener = {\n handler,\n };\n this.requestMessageHandlers.set(type, requestListener);\n\n return {\n unregister: () => {\n this.unregisterEvent(type);\n },\n };\n }\n\n /**\n * Unregister an event handler for a specific event type\n * @param type The type of event to unregister\n */\n private unregisterEvent(type: string) {\n if (!this.requestMessageHandlers.has(type)) {\n this.logger.error(\n getErrorMessage(\n ERROR_MESSAGES.unregisterEvent.eventDoesNotExist(type)\n )\n );\n } else {\n this.logger.debug(\"Unregistering event\", type);\n\n this.requestMessageHandlers.delete(type);\n }\n }\n\n /**\n * Updates the configuration options for the event manager.\n * @param config - The partial configuration options to update.\n */\n updateConfig(\n config: Partial<EventManagerOptions> & { channelId?: string }\n ) {\n this.config.replace(config);\n }\n\n /**\n * Destroy the event manager\n */\n destroy(config?: { soft?: boolean }) {\n this.requestMessageHandlers.clear();\n this.responseMessageHandlers.clear();\n\n if (!config?.soft) {\n window.removeEventListener(\"message\", this.handleIncomingMessage);\n }\n }\n}\n\nexport * from \"./types\";\n","import { Config } from \"./configHandler\";\nimport {\n EditorPostMessageNature,\n EditorRequestEventMessage,\n PostMessageSendOptions,\n UserConfig,\n} from \"./types\";\nimport { Logger } from \"./utils/logger\";\n\nexport class PostMessage {\n private config: UserConfig;\n\n constructor(\n private logger: Logger,\n config: Config\n ) {\n this.sendResponse = this.sendResponse.bind(this);\n this.sendRequest = this.sendRequest.bind(this);\n this.sendAck = this.sendAck.bind(this);\n this.getMessage = this.getMessage.bind(this);\n this.config = config.getAll();\n }\n\n sendRequest(config: PostMessageSendOptions) {\n const completeConfig = {\n ...config,\n nature: EditorPostMessageNature.REQUEST,\n };\n this.logger.debug(\"Sending REQUEST\", completeConfig);\n\n const message = this.getMessage(completeConfig);\n this.config.targetWindow.postMessage(message, this.config.targetOrigin);\n }\n\n sendResponse(config: PostMessageSendOptions) {\n const completeConfig = {\n ...config,\n nature: EditorPostMessageNature.RESPONSE,\n };\n this.logger.debug(\"Sending RESPONSE\", completeConfig);\n\n const message = this.getMessage(completeConfig);\n this.config.targetWindow.postMessage(message, this.config.targetOrigin);\n }\n\n sendAck(config: Omit<PostMessageSendOptions, \"payload\" | \"error\">) {\n const completeConfig = {\n ...config,\n payload: undefined,\n error: undefined,\n nature: EditorPostMessageNature.ACK,\n };\n this.logger.debug(\"Sending ACK\", completeConfig);\n\n const message = this.getMessage(completeConfig);\n this.config.targetWindow.postMessage(message, this.config.targetOrigin);\n }\n private getMessage(\n config: PostMessageSendOptions & {\n nature: EditorPostMessageNature;\n }\n ): EditorRequestEventMessage {\n const { nature, hash, payload, type, error } = config;\n return {\n eventManager: \"contentstack-adv-post-message\",\n metadata: {\n hash,\n nature,\n },\n channel: this.config.channelId,\n error,\n payload,\n type,\n };\n }\n}\n","export * from \"./eventManager.types\";\nexport * from \"./postMessageEvents.types\";\nexport * from \"./configHandler.types\";\n","export enum EditorPostMessageNature {\n ACK = \"ACK\",\n RESPONSE = \"RESPONSE\",\n REQUEST = \"REQUEST\",\n}\n\nexport interface AdvPostMessageErrorObject {\n code: string;\n message: string;\n}\nexport interface EditorRequestEventMessage {\n eventManager: \"contentstack-adv-post-message\";\n metadata: {\n hash: string;\n nature: EditorPostMessageNature;\n };\n channel: string;\n payload: any;\n error: undefined | AdvPostMessageErrorObject;\n type: string;\n}\n\nexport interface PostMessageSendOptions {\n hash: string;\n error: undefined | AdvPostMessageErrorObject;\n payload: any;\n type: string;\n}\n","import { Config } from \"../configHandler\";\nimport { EVENT_MANAGER_NAME } from \"../constants\";\n\nexport class Logger {\n prefix = EVENT_MANAGER_NAME;\n\n constructor(private config: Config) {\n this.log = this.log.bind(this);\n this.info = this.info.bind(this);\n this.debug = this.debug.bind(this);\n this.error = this.error.bind(this);\n }\n\n public log(...args: any[]) {\n console.log(this.prefix, ...args);\n }\n\n public info(...args: any[]) {\n console.info(this.prefix, ...args);\n }\n\n public debug(...args: any[]) {\n if (this.config.get(\"debug\")) {\n console.debug(\n this.prefix,\n \"DEBUG:\",\n ...args,\n this.getDebugOptions()\n );\n }\n }\n\n public error(...args: any[]) {\n if (!this.config.get(\"suppressErrors\")) {\n console.error(this.prefix, ...args);\n }\n }\n\n private getDebugOptions() {\n return {\n targetOrigin: this.config.get(\"targetOrigin\"),\n targetWindow: this.config.get(\"targetWindow\"),\n };\n }\n}\n\nexport function getErrorMessage(message: string) {\n return EVENT_MANAGER_NAME + \": \" + message;\n}\n","export function safeInterval(\n method: () => void,\n time: number\n): { cancel: () => void } {\n let timeout: NodeJS.Timeout;\n\n function loop() {\n timeout = setTimeout(() => {\n method();\n loop();\n }, time);\n }\n loop();\n\n return {\n cancel() {\n clearTimeout(timeout);\n },\n };\n}\n","import { v4 as uuid } from \"uuid\";\n\nexport function uniqueId(prefix?: string) {\n const suffix = uuid().split(\"-\")[0];\n return prefix ? `${prefix}-${suffix}` : suffix;\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"NIL\", {\n enumerable: true,\n get: function get() {\n return _nil.default;\n }\n});\nObject.defineProperty(exports, \"parse\", {\n enumerable: true,\n get: function get() {\n return _parse.default;\n }\n});\nObject.defineProperty(exports, \"stringify\", {\n enumerable: true,\n get: function get() {\n return _stringify.default;\n }\n});\nObject.defineProperty(exports, \"v1\", {\n enumerable: true,\n get: function get() {\n return _v.default;\n }\n});\nObject.defineProperty(exports, \"v3\", {\n enumerable: true,\n get: function get() {\n return _v2.default;\n }\n});\nObject.defineProperty(exports, \"v4\", {\n enumerable: true,\n get: function get() {\n return _v3.default;\n }\n});\nObject.defineProperty(exports, \"v5\", {\n enumerable: true,\n get: function get() {\n return _v4.default;\n }\n});\nObject.defineProperty(exports, \"validate\", {\n enumerable: true,\n get: function get() {\n return _validate.default;\n }\n});\nObject.defineProperty(exports, \"version\", {\n enumerable: true,\n get: function get() {\n return _version.default;\n }\n});\n\nvar _v = _interopRequireDefault(require(\"./v1.js\"));\n\nvar _v2 = _interopRequireDefault(require(\"./v3.js\"));\n\nvar _v3 = _interopRequireDefault(require(\"./v4.js\"));\n\nvar _v4 = _interopRequireDefault(require(\"./v5.js\"));\n\nvar _nil = _interopRequireDefault(require(\"./nil.js\"));\n\nvar _version = _interopRequireDefault(require(\"./version.js\"));\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\n/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = new Uint8Array(msg.length);\n\n for (let i = 0; i < msg.length; ++i) {\n bytes[i] = msg.charCodeAt(i);\n }\n }\n\n return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n const output = [];\n const length32 = input.length * 32;\n const hexTab = '0123456789abcdef';\n\n for (let i = 0; i < length32; i += 8) {\n const x = input[i >> 5] >>> i % 32 & 0xff;\n const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n output.push(hex);\n }\n\n return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[getOutputLength(len) - 1] = len;\n let a = 1732584193;\n let b = -271733879;\n let c = -1732584194;\n let d = 271733878;\n\n for (let i = 0; i < x.length; i += 16) {\n const olda = a;\n const oldb = b;\n const oldc = c;\n const oldd = d;\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n if (input.length === 0) {\n return [];\n }\n\n const length8 = input.length * 8;\n const output = new Uint32Array(getOutputLength(length8));\n\n for (let i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n }\n\n return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n const lsw = (x & 0xffff) + (y & 0xffff);\n const msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nvar _default = md5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nconst randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nvar _default = {\n randomUUID\n};\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _default = '00000000-0000-0000-0000-000000000000';\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction parse(uuid) {\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n let v;\n const arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nvar _default = parse;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = rng;\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\n\nfunction rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\n// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (let i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n const l = bytes.length / 4 + 2;\n const N = Math.ceil(l / 16);\n const M = new Array(N);\n\n for (let i = 0; i < N; ++i) {\n const arr = new Uint32Array(16);\n\n for (let j = 0; j < 16; ++j) {\n arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];\n }\n\n M[i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (let i = 0; i < N; ++i) {\n const W = new Uint32Array(80);\n\n for (let t = 0; t < 16; ++t) {\n W[t] = M[i][t];\n }\n\n for (let t = 16; t < 80; ++t) {\n W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n }\n\n let a = H[0];\n let b = H[1];\n let c = H[2];\n let d = H[3];\n let e = H[4];\n\n for (let t = 0; t < 80; ++t) {\n const s = Math.floor(t / 20);\n const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nvar _default = sha1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nexports.unsafeStringify = unsafeStringify;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nfunction unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nvar _default = stringify;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = require(\"./stringify.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\nlet _nodeId;\n\nlet _clockseq; // Previous uuid creation time\n\n\nlet _lastMSecs = 0;\nlet _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n let i = buf && offset || 0;\n const b = buf || new Array(16);\n options = options || {};\n let node = options.node || _nodeId;\n let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n const seedBytes = options.random || (options.rng || _rng.default)();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (let n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || (0, _stringify.unsafeStringify)(b);\n}\n\nvar _default = v1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _md = _interopRequireDefault(require(\"./md5.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v3 = (0, _v.default)('v3', 0x30, _md.default);\nvar _default = v3;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.URL = exports.DNS = void 0;\nexports.default = v35;\n\nvar _stringify = require(\"./stringify.js\");\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n const bytes = [];\n\n for (let i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nconst DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexports.DNS = DNS;\nconst URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexports.URL = URL;\n\nfunction v35(name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n var _namespace;\n\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = (0, _parse.default)(namespace);\n }\n\n if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace