node-red-contrib-web-worldmap 5.7.1 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +3 -1
  3. package/node_modules/es-object-atoms/CHANGELOG.md +21 -14
  4. package/node_modules/es-object-atoms/isObject.d.ts +1 -1
  5. package/node_modules/es-object-atoms/package.json +6 -7
  6. package/node_modules/es-object-atoms/tsconfig.json +1 -0
  7. package/node_modules/express/History.md +9 -0
  8. package/node_modules/express/lib/utils.js +2 -1
  9. package/node_modules/express/package.json +3 -3
  10. package/node_modules/qs/CHANGELOG.md +178 -0
  11. package/node_modules/qs/README.md +19 -1
  12. package/node_modules/qs/dist/qs.js +17 -17
  13. package/node_modules/qs/eslint.config.mjs +1 -0
  14. package/node_modules/qs/lib/parse.js +57 -25
  15. package/node_modules/qs/lib/stringify.js +11 -4
  16. package/node_modules/qs/lib/utils.js +2 -0
  17. package/node_modules/qs/package.json +3 -3
  18. package/node_modules/qs/test/parse.js +195 -4
  19. package/node_modules/qs/test/stringify.js +138 -0
  20. package/node_modules/qs/test/utils.js +38 -3
  21. package/node_modules/uuid/README.md +182 -177
  22. package/node_modules/uuid/dist/cjs/index.d.ts +15 -0
  23. package/node_modules/uuid/dist/cjs/index.js +31 -0
  24. package/node_modules/uuid/dist/cjs/max.d.ts +2 -0
  25. package/node_modules/uuid/dist/cjs/max.js +3 -0
  26. package/node_modules/uuid/dist/cjs/md5.d.ts +4 -0
  27. package/node_modules/uuid/dist/cjs/md5.js +13 -0
  28. package/node_modules/uuid/dist/cjs/native.d.ts +6 -0
  29. package/node_modules/uuid/dist/cjs/native.js +4 -0
  30. package/node_modules/uuid/dist/cjs/nil.d.ts +2 -0
  31. package/node_modules/uuid/dist/cjs/nil.js +3 -0
  32. package/node_modules/uuid/dist/cjs/package.json +1 -0
  33. package/node_modules/uuid/dist/cjs/parse.d.ts +2 -0
  34. package/node_modules/uuid/dist/cjs/parse.js +11 -0
  35. package/node_modules/uuid/dist/cjs/regex.d.ts +2 -0
  36. package/node_modules/uuid/dist/cjs/regex.js +3 -0
  37. package/node_modules/uuid/dist/cjs/rng.d.ts +1 -0
  38. package/node_modules/uuid/dist/cjs/rng.js +13 -0
  39. package/node_modules/uuid/dist/cjs/sha1.d.ts +4 -0
  40. package/node_modules/uuid/dist/cjs/sha1.js +13 -0
  41. package/node_modules/uuid/dist/cjs/stringify.d.ts +3 -0
  42. package/node_modules/uuid/dist/cjs/stringify.js +39 -0
  43. package/node_modules/uuid/dist/cjs/types.d.ts +21 -0
  44. package/node_modules/uuid/dist/cjs/types.js +2 -0
  45. package/node_modules/uuid/dist/cjs/uuid-bin.d.ts +1 -0
  46. package/node_modules/uuid/dist/cjs/uuid-bin.js +72 -0
  47. package/node_modules/uuid/dist/cjs/v1.d.ts +11 -0
  48. package/node_modules/uuid/dist/cjs/v1.js +87 -0
  49. package/node_modules/uuid/dist/cjs/v1ToV6.d.ts +2 -0
  50. package/node_modules/uuid/dist/cjs/v1ToV6.js +13 -0
  51. package/node_modules/uuid/dist/cjs/v3.d.ts +9 -0
  52. package/node_modules/uuid/dist/cjs/v3.js +14 -0
  53. package/node_modules/uuid/dist/cjs/v35.d.ts +7 -0
  54. package/node_modules/uuid/dist/cjs/v35.js +44 -0
  55. package/node_modules/uuid/dist/cjs/v4.d.ts +4 -0
  56. package/node_modules/uuid/dist/cjs/v4.js +29 -0
  57. package/node_modules/uuid/dist/cjs/v5.d.ts +9 -0
  58. package/node_modules/uuid/dist/cjs/v5.js +14 -0
  59. package/node_modules/uuid/dist/cjs/v6.d.ts +4 -0
  60. package/node_modules/uuid/dist/cjs/v6.js +22 -0
  61. package/node_modules/uuid/dist/cjs/v6ToV1.d.ts +2 -0
  62. package/node_modules/uuid/dist/cjs/v6ToV1.js +13 -0
  63. package/node_modules/uuid/dist/cjs/v7.d.ts +9 -0
  64. package/node_modules/uuid/dist/cjs/v7.js +69 -0
  65. package/node_modules/uuid/dist/cjs/validate.d.ts +2 -0
  66. package/node_modules/uuid/dist/cjs/validate.js +7 -0
  67. package/node_modules/uuid/dist/cjs/version.d.ts +2 -0
  68. package/node_modules/uuid/dist/cjs/version.js +10 -0
  69. package/node_modules/uuid/dist/cjs-browser/index.d.ts +15 -0
  70. package/node_modules/uuid/dist/cjs-browser/index.js +31 -0
  71. package/node_modules/uuid/dist/cjs-browser/max.d.ts +2 -0
  72. package/node_modules/uuid/dist/cjs-browser/max.js +3 -0
  73. package/node_modules/uuid/dist/cjs-browser/md5.d.ts +2 -0
  74. package/node_modules/uuid/dist/cjs-browser/md5.js +137 -0
  75. package/node_modules/uuid/dist/cjs-browser/native.d.ts +4 -0
  76. package/node_modules/uuid/dist/cjs-browser/native.js +4 -0
  77. package/node_modules/uuid/dist/cjs-browser/nil.d.ts +2 -0
  78. package/node_modules/uuid/dist/cjs-browser/nil.js +3 -0
  79. package/node_modules/uuid/dist/cjs-browser/package.json +1 -0
  80. package/node_modules/uuid/dist/cjs-browser/parse.d.ts +2 -0
  81. package/node_modules/uuid/dist/cjs-browser/parse.js +11 -0
  82. package/node_modules/uuid/dist/cjs-browser/regex.d.ts +2 -0
  83. package/node_modules/uuid/dist/cjs-browser/regex.js +3 -0
  84. package/node_modules/uuid/dist/cjs-browser/rng.d.ts +1 -0
  85. package/node_modules/uuid/dist/cjs-browser/rng.js +14 -0
  86. package/node_modules/uuid/dist/cjs-browser/sha1.d.ts +2 -0
  87. package/node_modules/uuid/dist/cjs-browser/sha1.js +72 -0
  88. package/node_modules/uuid/dist/cjs-browser/stringify.d.ts +3 -0
  89. package/node_modules/uuid/dist/cjs-browser/stringify.js +39 -0
  90. package/node_modules/uuid/dist/cjs-browser/types.d.ts +21 -0
  91. package/node_modules/uuid/dist/cjs-browser/types.js +2 -0
  92. package/node_modules/uuid/dist/cjs-browser/uuid-bin.d.ts +1 -0
  93. package/node_modules/uuid/dist/cjs-browser/uuid-bin.js +72 -0
  94. package/node_modules/uuid/dist/cjs-browser/v1.d.ts +11 -0
  95. package/node_modules/uuid/dist/cjs-browser/v1.js +87 -0
  96. package/node_modules/uuid/dist/cjs-browser/v1ToV6.d.ts +2 -0
  97. package/node_modules/uuid/dist/cjs-browser/v1ToV6.js +13 -0
  98. package/node_modules/uuid/dist/cjs-browser/v3.d.ts +9 -0
  99. package/node_modules/uuid/dist/cjs-browser/v3.js +14 -0
  100. package/node_modules/uuid/dist/cjs-browser/v35.d.ts +7 -0
  101. package/node_modules/uuid/dist/cjs-browser/v35.js +44 -0
  102. package/node_modules/uuid/dist/cjs-browser/v4.d.ts +4 -0
  103. package/node_modules/uuid/dist/cjs-browser/v4.js +29 -0
  104. package/node_modules/uuid/dist/cjs-browser/v5.d.ts +9 -0
  105. package/node_modules/uuid/dist/cjs-browser/v5.js +14 -0
  106. package/node_modules/uuid/dist/cjs-browser/v6.d.ts +4 -0
  107. package/node_modules/uuid/dist/cjs-browser/v6.js +22 -0
  108. package/node_modules/uuid/dist/cjs-browser/v6ToV1.d.ts +2 -0
  109. package/node_modules/uuid/dist/cjs-browser/v6ToV1.js +13 -0
  110. package/node_modules/uuid/dist/cjs-browser/v7.d.ts +9 -0
  111. package/node_modules/uuid/dist/cjs-browser/v7.js +69 -0
  112. package/node_modules/uuid/dist/cjs-browser/validate.d.ts +2 -0
  113. package/node_modules/uuid/dist/cjs-browser/validate.js +7 -0
  114. package/node_modules/uuid/dist/cjs-browser/version.d.ts +2 -0
  115. package/node_modules/uuid/dist/cjs-browser/version.js +10 -0
  116. package/node_modules/uuid/dist/esm/bin/uuid +2 -0
  117. package/node_modules/uuid/dist/esm/index.d.ts +15 -0
  118. package/node_modules/uuid/dist/{esm-node → esm}/index.js +9 -4
  119. package/node_modules/uuid/dist/esm/max.d.ts +2 -0
  120. package/node_modules/uuid/dist/esm/max.js +1 -0
  121. package/node_modules/uuid/dist/esm/md5.d.ts +4 -0
  122. package/node_modules/uuid/dist/esm/md5.js +11 -0
  123. package/node_modules/uuid/dist/esm/native.d.ts +6 -0
  124. package/node_modules/uuid/dist/esm/native.js +2 -0
  125. package/node_modules/uuid/dist/esm/nil.d.ts +2 -0
  126. package/node_modules/uuid/dist/esm/nil.js +1 -0
  127. package/node_modules/uuid/dist/esm/parse.d.ts +2 -0
  128. package/node_modules/uuid/dist/esm/parse.js +9 -0
  129. package/node_modules/uuid/dist/esm/regex.d.ts +2 -0
  130. package/node_modules/uuid/dist/esm/regex.js +1 -0
  131. package/node_modules/uuid/dist/esm/rng.d.ts +1 -0
  132. package/node_modules/uuid/dist/esm/rng.js +10 -0
  133. package/node_modules/uuid/dist/esm/sha1.d.ts +4 -0
  134. package/node_modules/uuid/dist/esm/sha1.js +11 -0
  135. package/node_modules/uuid/dist/esm/stringify.d.ts +3 -0
  136. package/node_modules/uuid/dist/esm/stringify.js +35 -0
  137. package/node_modules/uuid/dist/esm/types.d.ts +21 -0
  138. package/node_modules/uuid/dist/esm/types.js +1 -0
  139. package/node_modules/uuid/dist/esm/uuid-bin.d.ts +1 -0
  140. package/node_modules/uuid/dist/esm/uuid-bin.js +70 -0
  141. package/node_modules/uuid/dist/esm/v1.d.ts +11 -0
  142. package/node_modules/uuid/dist/esm/v1.js +83 -0
  143. package/node_modules/uuid/dist/esm/v1ToV6.d.ts +2 -0
  144. package/node_modules/uuid/dist/esm/v1ToV6.js +10 -0
  145. package/node_modules/uuid/dist/esm/v3.d.ts +9 -0
  146. package/node_modules/uuid/dist/esm/v3.js +9 -0
  147. package/node_modules/uuid/dist/esm/v35.d.ts +7 -0
  148. package/node_modules/uuid/dist/esm/v35.js +39 -0
  149. package/node_modules/uuid/dist/esm/v4.d.ts +4 -0
  150. package/node_modules/uuid/dist/esm/v4.js +27 -0
  151. package/node_modules/uuid/dist/esm/v5.d.ts +9 -0
  152. package/node_modules/uuid/dist/esm/v5.js +9 -0
  153. package/node_modules/uuid/dist/esm/v6.d.ts +4 -0
  154. package/node_modules/uuid/dist/esm/v6.js +20 -0
  155. package/node_modules/uuid/dist/esm/v6ToV1.d.ts +2 -0
  156. package/node_modules/uuid/dist/esm/v6ToV1.js +10 -0
  157. package/node_modules/uuid/dist/esm/v7.d.ts +9 -0
  158. package/node_modules/uuid/dist/esm/v7.js +65 -0
  159. package/node_modules/uuid/dist/esm/validate.d.ts +2 -0
  160. package/node_modules/uuid/dist/esm/validate.js +5 -0
  161. package/node_modules/uuid/dist/esm/version.d.ts +2 -0
  162. package/node_modules/uuid/dist/esm/version.js +8 -0
  163. package/node_modules/uuid/dist/esm-browser/index.d.ts +15 -0
  164. package/node_modules/uuid/dist/esm-browser/index.js +9 -4
  165. package/node_modules/uuid/dist/esm-browser/max.d.ts +2 -0
  166. package/node_modules/uuid/dist/esm-browser/max.js +1 -0
  167. package/node_modules/uuid/dist/esm-browser/md5.d.ts +2 -0
  168. package/node_modules/uuid/dist/esm-browser/md5.js +113 -193
  169. package/node_modules/uuid/dist/esm-browser/native.d.ts +4 -0
  170. package/node_modules/uuid/dist/esm-browser/native.js +2 -0
  171. package/node_modules/uuid/dist/esm-browser/nil.d.ts +2 -0
  172. package/node_modules/uuid/dist/esm-browser/nil.js +1 -1
  173. package/node_modules/uuid/dist/esm-browser/parse.d.ts +2 -0
  174. package/node_modules/uuid/dist/esm-browser/parse.js +6 -32
  175. package/node_modules/uuid/dist/esm-browser/regex.d.ts +2 -0
  176. package/node_modules/uuid/dist/esm-browser/regex.js +1 -1
  177. package/node_modules/uuid/dist/esm-browser/rng.d.ts +1 -0
  178. package/node_modules/uuid/dist/esm-browser/rng.js +8 -16
  179. package/node_modules/uuid/dist/esm-browser/sha1.d.ts +2 -0
  180. package/node_modules/uuid/dist/esm-browser/sha1.js +62 -88
  181. package/node_modules/uuid/dist/esm-browser/stringify.d.ts +3 -0
  182. package/node_modules/uuid/dist/esm-browser/stringify.js +32 -27
  183. package/node_modules/uuid/dist/esm-browser/types.d.ts +21 -0
  184. package/node_modules/uuid/dist/esm-browser/types.js +1 -0
  185. package/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +1 -0
  186. package/node_modules/uuid/dist/esm-browser/uuid-bin.js +70 -0
  187. package/node_modules/uuid/dist/esm-browser/v1.d.ts +11 -0
  188. package/node_modules/uuid/dist/esm-browser/v1.js +78 -90
  189. package/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +2 -0
  190. package/node_modules/uuid/dist/esm-browser/v1ToV6.js +10 -0
  191. package/node_modules/uuid/dist/esm-browser/v3.d.ts +9 -0
  192. package/node_modules/uuid/dist/esm-browser/v3.js +8 -3
  193. package/node_modules/uuid/dist/esm-browser/v35.d.ts +7 -0
  194. package/node_modules/uuid/dist/esm-browser/v35.js +33 -58
  195. package/node_modules/uuid/dist/esm-browser/v4.d.ts +4 -0
  196. package/node_modules/uuid/dist/esm-browser/v4.js +23 -20
  197. package/node_modules/uuid/dist/esm-browser/v5.d.ts +9 -0
  198. package/node_modules/uuid/dist/esm-browser/v5.js +8 -3
  199. package/node_modules/uuid/dist/esm-browser/v6.d.ts +4 -0
  200. package/node_modules/uuid/dist/esm-browser/v6.js +20 -0
  201. package/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +2 -0
  202. package/node_modules/uuid/dist/esm-browser/v6ToV1.js +10 -0
  203. package/node_modules/uuid/dist/esm-browser/v7.d.ts +9 -0
  204. package/node_modules/uuid/dist/esm-browser/v7.js +65 -0
  205. package/node_modules/uuid/dist/esm-browser/validate.d.ts +2 -0
  206. package/node_modules/uuid/dist/esm-browser/validate.js +2 -4
  207. package/node_modules/uuid/dist/esm-browser/version.d.ts +2 -0
  208. package/node_modules/uuid/dist/esm-browser/version.js +5 -8
  209. package/node_modules/uuid/package.json +80 -83
  210. package/package.json +5 -2
  211. package/worldmap/worldmap.js +7 -0
  212. package/worldmap.html +1 -1
  213. package/node_modules/body-parser/node_modules/qs/.editorconfig +0 -46
  214. package/node_modules/body-parser/node_modules/qs/.github/FUNDING.yml +0 -12
  215. package/node_modules/body-parser/node_modules/qs/.github/SECURITY.md +0 -11
  216. package/node_modules/body-parser/node_modules/qs/.github/THREAT_MODEL.md +0 -78
  217. package/node_modules/body-parser/node_modules/qs/.nycrc +0 -13
  218. package/node_modules/body-parser/node_modules/qs/CHANGELOG.md +0 -822
  219. package/node_modules/body-parser/node_modules/qs/LICENSE.md +0 -29
  220. package/node_modules/body-parser/node_modules/qs/README.md +0 -758
  221. package/node_modules/body-parser/node_modules/qs/dist/qs.js +0 -141
  222. package/node_modules/body-parser/node_modules/qs/eslint.config.mjs +0 -57
  223. package/node_modules/body-parser/node_modules/qs/lib/formats.js +0 -23
  224. package/node_modules/body-parser/node_modules/qs/lib/index.js +0 -11
  225. package/node_modules/body-parser/node_modules/qs/lib/parse.js +0 -403
  226. package/node_modules/body-parser/node_modules/qs/lib/stringify.js +0 -363
  227. package/node_modules/body-parser/node_modules/qs/lib/utils.js +0 -342
  228. package/node_modules/body-parser/node_modules/qs/package.json +0 -94
  229. package/node_modules/body-parser/node_modules/qs/test/empty-keys-cases.js +0 -267
  230. package/node_modules/body-parser/node_modules/qs/test/parse.js +0 -1703
  231. package/node_modules/body-parser/node_modules/qs/test/stringify.js +0 -1448
  232. package/node_modules/body-parser/node_modules/qs/test/utils.js +0 -432
  233. package/node_modules/uuid/CHANGELOG.md +0 -229
  234. package/node_modules/uuid/CONTRIBUTING.md +0 -18
  235. package/node_modules/uuid/dist/bin/uuid +0 -2
  236. package/node_modules/uuid/dist/esm-node/md5.js +0 -13
  237. package/node_modules/uuid/dist/esm-node/nil.js +0 -1
  238. package/node_modules/uuid/dist/esm-node/parse.js +0 -35
  239. package/node_modules/uuid/dist/esm-node/regex.js +0 -1
  240. package/node_modules/uuid/dist/esm-node/rng.js +0 -12
  241. package/node_modules/uuid/dist/esm-node/sha1.js +0 -13
  242. package/node_modules/uuid/dist/esm-node/stringify.js +0 -29
  243. package/node_modules/uuid/dist/esm-node/v1.js +0 -95
  244. package/node_modules/uuid/dist/esm-node/v3.js +0 -4
  245. package/node_modules/uuid/dist/esm-node/v35.js +0 -64
  246. package/node_modules/uuid/dist/esm-node/v4.js +0 -24
  247. package/node_modules/uuid/dist/esm-node/v5.js +0 -4
  248. package/node_modules/uuid/dist/esm-node/validate.js +0 -7
  249. package/node_modules/uuid/dist/esm-node/version.js +0 -11
  250. package/node_modules/uuid/dist/index.js +0 -79
  251. package/node_modules/uuid/dist/md5-browser.js +0 -223
  252. package/node_modules/uuid/dist/md5.js +0 -23
  253. package/node_modules/uuid/dist/nil.js +0 -8
  254. package/node_modules/uuid/dist/parse.js +0 -45
  255. package/node_modules/uuid/dist/regex.js +0 -8
  256. package/node_modules/uuid/dist/rng-browser.js +0 -26
  257. package/node_modules/uuid/dist/rng.js +0 -24
  258. package/node_modules/uuid/dist/sha1-browser.js +0 -104
  259. package/node_modules/uuid/dist/sha1.js +0 -23
  260. package/node_modules/uuid/dist/stringify.js +0 -39
  261. package/node_modules/uuid/dist/umd/uuid.min.js +0 -1
  262. package/node_modules/uuid/dist/umd/uuidNIL.min.js +0 -1
  263. package/node_modules/uuid/dist/umd/uuidParse.min.js +0 -1
  264. package/node_modules/uuid/dist/umd/uuidStringify.min.js +0 -1
  265. package/node_modules/uuid/dist/umd/uuidValidate.min.js +0 -1
  266. package/node_modules/uuid/dist/umd/uuidVersion.min.js +0 -1
  267. package/node_modules/uuid/dist/umd/uuidv1.min.js +0 -1
  268. package/node_modules/uuid/dist/umd/uuidv3.min.js +0 -1
  269. package/node_modules/uuid/dist/umd/uuidv4.min.js +0 -1
  270. package/node_modules/uuid/dist/umd/uuidv5.min.js +0 -1
  271. package/node_modules/uuid/dist/uuid-bin.js +0 -85
  272. package/node_modules/uuid/dist/v1.js +0 -107
  273. package/node_modules/uuid/dist/v3.js +0 -16
  274. package/node_modules/uuid/dist/v35.js +0 -78
  275. package/node_modules/uuid/dist/v4.js +0 -37
  276. package/node_modules/uuid/dist/v5.js +0 -16
  277. package/node_modules/uuid/dist/validate.js +0 -17
  278. package/node_modules/uuid/dist/version.js +0 -21
  279. package/node_modules/uuid/wrapper.mjs +0 -10
@@ -1,30 +1,35 @@
1
1
  import validate from './validate.js';
2
- /**
3
- * Convert array of 16 byte values to UUID string format of the form:
4
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
5
- */
6
-
7
- var byteToHex = [];
8
-
9
- for (var i = 0; i < 256; ++i) {
10
- byteToHex.push((i + 0x100).toString(16).substr(1));
2
+ const byteToHex = [];
3
+ for (let i = 0; i < 256; ++i) {
4
+ byteToHex.push((i + 0x100).toString(16).slice(1));
11
5
  }
12
-
13
- function stringify(arr) {
14
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
15
- // Note: Be careful editing this code! It's been tuned for performance
16
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
17
- var uuid = (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(); // Consistency check for valid UUID. If this throws, it's likely due to one
18
- // of the following:
19
- // - One or more input array values don't map to a hex octet (leading to
20
- // "undefined" in the uuid)
21
- // - Invalid input values for the RFC `version` or `variant` fields
22
-
23
- if (!validate(uuid)) {
24
- throw TypeError('Stringified UUID is invalid');
25
- }
26
-
27
- return uuid;
6
+ export function unsafeStringify(arr, offset = 0) {
7
+ return (byteToHex[arr[offset + 0]] +
8
+ byteToHex[arr[offset + 1]] +
9
+ byteToHex[arr[offset + 2]] +
10
+ byteToHex[arr[offset + 3]] +
11
+ '-' +
12
+ byteToHex[arr[offset + 4]] +
13
+ byteToHex[arr[offset + 5]] +
14
+ '-' +
15
+ byteToHex[arr[offset + 6]] +
16
+ byteToHex[arr[offset + 7]] +
17
+ '-' +
18
+ byteToHex[arr[offset + 8]] +
19
+ byteToHex[arr[offset + 9]] +
20
+ '-' +
21
+ byteToHex[arr[offset + 10]] +
22
+ byteToHex[arr[offset + 11]] +
23
+ byteToHex[arr[offset + 12]] +
24
+ byteToHex[arr[offset + 13]] +
25
+ byteToHex[arr[offset + 14]] +
26
+ byteToHex[arr[offset + 15]]).toLowerCase();
28
27
  }
29
-
30
- export default stringify;
28
+ function stringify(arr, offset = 0) {
29
+ const uuid = unsafeStringify(arr, offset);
30
+ if (!validate(uuid)) {
31
+ throw TypeError('Stringified UUID is invalid');
32
+ }
33
+ return uuid;
34
+ }
35
+ export default stringify;
@@ -0,0 +1,21 @@
1
+ export type UUIDTypes<TBuf extends Uint8Array = Uint8Array> = string | TBuf;
2
+ export type Version1Options = {
3
+ node?: Uint8Array;
4
+ clockseq?: number;
5
+ random?: Uint8Array;
6
+ rng?: () => Uint8Array;
7
+ msecs?: number;
8
+ nsecs?: number;
9
+ _v6?: boolean;
10
+ };
11
+ export type Version4Options = {
12
+ random?: Uint8Array;
13
+ rng?: () => Uint8Array;
14
+ };
15
+ export type Version6Options = Version1Options;
16
+ export type Version7Options = {
17
+ random?: Uint8Array;
18
+ msecs?: number;
19
+ seq?: number;
20
+ rng?: () => Uint8Array;
21
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,70 @@
1
+ import * as assert from 'assert';
2
+ import v1 from './v1.js';
3
+ import v3 from './v3.js';
4
+ import v4 from './v4.js';
5
+ import v5 from './v5.js';
6
+ import v6 from './v6.js';
7
+ import v7 from './v7.js';
8
+ function usage() {
9
+ console.log('Usage:');
10
+ console.log(' uuid');
11
+ console.log(' uuid v1');
12
+ console.log(' uuid v3 <name> <namespace uuid>');
13
+ console.log(' uuid v4');
14
+ console.log(' uuid v5 <name> <namespace uuid>');
15
+ console.log(' uuid v6');
16
+ console.log(' uuid v7');
17
+ console.log(' uuid --help');
18
+ console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC9562');
19
+ }
20
+ const args = process.argv.slice(2);
21
+ if (args.indexOf('--help') >= 0) {
22
+ usage();
23
+ process.exit(0);
24
+ }
25
+ const version = args.shift() || 'v4';
26
+ switch (version) {
27
+ case 'v1':
28
+ console.log(v1());
29
+ break;
30
+ case 'v3': {
31
+ const name = args.shift();
32
+ let namespace = args.shift();
33
+ assert.ok(name != null, 'v3 name not specified');
34
+ assert.ok(namespace != null, 'v3 namespace not specified');
35
+ if (namespace === 'URL') {
36
+ namespace = v3.URL;
37
+ }
38
+ if (namespace === 'DNS') {
39
+ namespace = v3.DNS;
40
+ }
41
+ console.log(v3(name, namespace));
42
+ break;
43
+ }
44
+ case 'v4':
45
+ console.log(v4());
46
+ break;
47
+ case 'v5': {
48
+ const name = args.shift();
49
+ let namespace = args.shift();
50
+ assert.ok(name != null, 'v5 name not specified');
51
+ assert.ok(namespace != null, 'v5 namespace not specified');
52
+ if (namespace === 'URL') {
53
+ namespace = v5.URL;
54
+ }
55
+ if (namespace === 'DNS') {
56
+ namespace = v5.DNS;
57
+ }
58
+ console.log(v5(name, namespace));
59
+ break;
60
+ }
61
+ case 'v6':
62
+ console.log(v6());
63
+ break;
64
+ case 'v7':
65
+ console.log(v7());
66
+ break;
67
+ default:
68
+ usage();
69
+ process.exit(1);
70
+ }
@@ -0,0 +1,11 @@
1
+ import { Version1Options } from './types.js';
2
+ type V1State = {
3
+ node?: Uint8Array;
4
+ clockseq?: number;
5
+ msecs?: number;
6
+ nsecs?: number;
7
+ };
8
+ declare function v1(options?: Version1Options, buf?: undefined, offset?: number): string;
9
+ declare function v1<Buf extends Uint8Array = Uint8Array>(options: Version1Options | undefined, buf: Buf, offset?: number): Buf;
10
+ export declare function updateV1State(state: V1State, now: number, rnds: Uint8Array): V1State;
11
+ export default v1;
@@ -1,95 +1,83 @@
1
1
  import rng from './rng.js';
2
- import stringify from './stringify.js'; // **`v1()` - Generate time-based UUID**
3
- //
4
- // Inspired by https://github.com/LiosK/UUID.js
5
- // and http://docs.python.org/library/uuid.html
6
-
7
- var _nodeId;
8
-
9
- var _clockseq; // Previous uuid creation time
10
-
11
-
12
- var _lastMSecs = 0;
13
- var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
14
-
2
+ import { unsafeStringify } from './stringify.js';
3
+ const _state = {};
15
4
  function v1(options, buf, offset) {
16
- var i = buf && offset || 0;
17
- var b = buf || new Array(16);
18
- options = options || {};
19
- var node = options.node || _nodeId;
20
- var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
21
- // specified. We do this lazily to minimize issues related to insufficient
22
- // system entropy. See #189
23
-
24
- if (node == null || clockseq == null) {
25
- var seedBytes = options.random || (options.rng || rng)();
26
-
27
- if (node == null) {
28
- // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
29
- node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
5
+ let bytes;
6
+ const isV6 = options?._v6 ?? false;
7
+ if (options) {
8
+ const optionsKeys = Object.keys(options);
9
+ if (optionsKeys.length === 1 && optionsKeys[0] === '_v6') {
10
+ options = undefined;
11
+ }
30
12
  }
31
-
32
- if (clockseq == null) {
33
- // Per 4.2.2, randomize (14 bit) clockseq
34
- clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
13
+ if (options) {
14
+ bytes = v1Bytes(options.random ?? options.rng?.() ?? rng(), options.msecs, options.nsecs, options.clockseq, options.node, buf, offset);
35
15
  }
36
- } // UUID timestamps are 100 nano-second units since the Gregorian epoch,
37
- // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
38
- // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
39
- // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
40
-
41
-
42
- var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
43
- // cycle to simulate higher resolution clock
44
-
45
- var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
46
-
47
- var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
48
-
49
- if (dt < 0 && options.clockseq === undefined) {
50
- clockseq = clockseq + 1 & 0x3fff;
51
- } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
52
- // time interval
53
-
54
-
55
- if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
56
- nsecs = 0;
57
- } // Per 4.2.1.2 Throw error if too many uuids are requested
58
-
59
-
60
- if (nsecs >= 10000) {
61
- throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
62
- }
63
-
64
- _lastMSecs = msecs;
65
- _lastNSecs = nsecs;
66
- _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
67
-
68
- msecs += 12219292800000; // `time_low`
69
-
70
- var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
71
- b[i++] = tl >>> 24 & 0xff;
72
- b[i++] = tl >>> 16 & 0xff;
73
- b[i++] = tl >>> 8 & 0xff;
74
- b[i++] = tl & 0xff; // `time_mid`
75
-
76
- var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
77
- b[i++] = tmh >>> 8 & 0xff;
78
- b[i++] = tmh & 0xff; // `time_high_and_version`
79
-
80
- b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
81
-
82
- b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
83
-
84
- b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
85
-
86
- b[i++] = clockseq & 0xff; // `node`
87
-
88
- for (var n = 0; n < 6; ++n) {
89
- b[i + n] = node[n];
90
- }
91
-
92
- return buf || stringify(b);
16
+ else {
17
+ const now = Date.now();
18
+ const rnds = rng();
19
+ updateV1State(_state, now, rnds);
20
+ bytes = v1Bytes(rnds, _state.msecs, _state.nsecs, isV6 ? undefined : _state.clockseq, isV6 ? undefined : _state.node, buf, offset);
21
+ }
22
+ return buf ?? unsafeStringify(bytes);
23
+ }
24
+ export function updateV1State(state, now, rnds) {
25
+ state.msecs ??= -Infinity;
26
+ state.nsecs ??= 0;
27
+ if (now === state.msecs) {
28
+ state.nsecs++;
29
+ if (state.nsecs >= 10000) {
30
+ state.node = undefined;
31
+ state.nsecs = 0;
32
+ }
33
+ }
34
+ else if (now > state.msecs) {
35
+ state.nsecs = 0;
36
+ }
37
+ else if (now < state.msecs) {
38
+ state.node = undefined;
39
+ }
40
+ if (!state.node) {
41
+ state.node = rnds.slice(10, 16);
42
+ state.node[0] |= 0x01;
43
+ state.clockseq = ((rnds[8] << 8) | rnds[9]) & 0x3fff;
44
+ }
45
+ state.msecs = now;
46
+ return state;
47
+ }
48
+ function v1Bytes(rnds, msecs, nsecs, clockseq, node, buf, offset = 0) {
49
+ if (rnds.length < 16) {
50
+ throw new Error('Random bytes length must be >= 16');
51
+ }
52
+ if (!buf) {
53
+ buf = new Uint8Array(16);
54
+ offset = 0;
55
+ }
56
+ else {
57
+ if (offset < 0 || offset + 16 > buf.length) {
58
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
59
+ }
60
+ }
61
+ msecs ??= Date.now();
62
+ nsecs ??= 0;
63
+ clockseq ??= ((rnds[8] << 8) | rnds[9]) & 0x3fff;
64
+ node ??= rnds.slice(10, 16);
65
+ msecs += 12219292800000;
66
+ const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
67
+ buf[offset++] = (tl >>> 24) & 0xff;
68
+ buf[offset++] = (tl >>> 16) & 0xff;
69
+ buf[offset++] = (tl >>> 8) & 0xff;
70
+ buf[offset++] = tl & 0xff;
71
+ const tmh = ((msecs / 0x100000000) * 10000) & 0xfffffff;
72
+ buf[offset++] = (tmh >>> 8) & 0xff;
73
+ buf[offset++] = tmh & 0xff;
74
+ buf[offset++] = ((tmh >>> 24) & 0xf) | 0x10;
75
+ buf[offset++] = (tmh >>> 16) & 0xff;
76
+ buf[offset++] = (clockseq >>> 8) | 0x80;
77
+ buf[offset++] = clockseq & 0xff;
78
+ for (let n = 0; n < 6; ++n) {
79
+ buf[offset++] = node[n];
80
+ }
81
+ return buf;
93
82
  }
94
-
95
- export default v1;
83
+ export default v1;
@@ -0,0 +1,2 @@
1
+ export default function v1ToV6(uuid: string): string;
2
+ export default function v1ToV6(uuid: Uint8Array): Uint8Array;
@@ -0,0 +1,10 @@
1
+ import parse from './parse.js';
2
+ import { unsafeStringify } from './stringify.js';
3
+ export default function v1ToV6(uuid) {
4
+ const v1Bytes = typeof uuid === 'string' ? parse(uuid) : uuid;
5
+ const v6Bytes = _v1ToV6(v1Bytes);
6
+ return typeof uuid === 'string' ? unsafeStringify(v6Bytes) : v6Bytes;
7
+ }
8
+ function _v1ToV6(v1Bytes) {
9
+ return Uint8Array.of(((v1Bytes[6] & 0x0f) << 4) | ((v1Bytes[7] >> 4) & 0x0f), ((v1Bytes[7] & 0x0f) << 4) | ((v1Bytes[4] & 0xf0) >> 4), ((v1Bytes[4] & 0x0f) << 4) | ((v1Bytes[5] & 0xf0) >> 4), ((v1Bytes[5] & 0x0f) << 4) | ((v1Bytes[0] & 0xf0) >> 4), ((v1Bytes[0] & 0x0f) << 4) | ((v1Bytes[1] & 0xf0) >> 4), ((v1Bytes[1] & 0x0f) << 4) | ((v1Bytes[2] & 0xf0) >> 4), 0x60 | (v1Bytes[2] & 0x0f), v1Bytes[3], v1Bytes[8], v1Bytes[9], v1Bytes[10], v1Bytes[11], v1Bytes[12], v1Bytes[13], v1Bytes[14], v1Bytes[15]);
10
+ }
@@ -0,0 +1,9 @@
1
+ import { UUIDTypes } from './types.js';
2
+ export { DNS, URL } from './v35.js';
3
+ declare function v3(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
4
+ declare function v3<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
5
+ declare namespace v3 {
6
+ var DNS: string;
7
+ var URL: string;
8
+ }
9
+ export default v3;
@@ -1,4 +1,9 @@
1
- import v35 from './v35.js';
2
1
  import md5 from './md5.js';
3
- var v3 = v35('v3', 0x30, md5);
4
- export default v3;
2
+ import v35, { DNS, URL } from './v35.js';
3
+ export { DNS, URL } from './v35.js';
4
+ function v3(value, namespace, buf, offset) {
5
+ return v35(0x30, md5, value, namespace, buf, offset);
6
+ }
7
+ v3.DNS = DNS;
8
+ v3.URL = URL;
9
+ export default v3;
@@ -0,0 +1,7 @@
1
+ import { UUIDTypes } from './types.js';
2
+ export declare function stringToBytes(str: string): Uint8Array;
3
+ export declare const DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
4
+ export declare const URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
5
+ type HashFunction = (bytes: Uint8Array) => Uint8Array;
6
+ export default function v35<TBuf extends Uint8Array = Uint8Array>(version: 0x30 | 0x50, hash: HashFunction, value: string | Uint8Array, namespace: UUIDTypes, buf?: TBuf, offset?: number): UUIDTypes<TBuf>;
7
+ export {};
@@ -1,64 +1,39 @@
1
- import stringify from './stringify.js';
2
1
  import parse from './parse.js';
3
-
4
- function stringToBytes(str) {
5
- str = unescape(encodeURIComponent(str)); // UTF8 escape
6
-
7
- var bytes = [];
8
-
9
- for (var i = 0; i < str.length; ++i) {
10
- bytes.push(str.charCodeAt(i));
11
- }
12
-
13
- return bytes;
14
- }
15
-
16
- export var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
17
- export var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
18
- export default function (name, version, hashfunc) {
19
- function generateUUID(value, namespace, buf, offset) {
20
- if (typeof value === 'string') {
21
- value = stringToBytes(value);
2
+ import { unsafeStringify } from './stringify.js';
3
+ export function stringToBytes(str) {
4
+ str = unescape(encodeURIComponent(str));
5
+ const bytes = new Uint8Array(str.length);
6
+ for (let i = 0; i < str.length; ++i) {
7
+ bytes[i] = str.charCodeAt(i);
22
8
  }
23
-
9
+ return bytes;
10
+ }
11
+ export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
12
+ export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
13
+ export default function v35(version, hash, value, namespace, buf, offset) {
14
+ const valueBytes = typeof value === 'string' ? stringToBytes(value) : value;
15
+ const namespaceBytes = typeof namespace === 'string' ? parse(namespace) : namespace;
24
16
  if (typeof namespace === 'string') {
25
- namespace = parse(namespace);
17
+ namespace = parse(namespace);
26
18
  }
27
-
28
- if (namespace.length !== 16) {
29
- throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
30
- } // Compute hash of namespace and value, Per 4.3
31
- // Future: Use spread syntax when supported on all platforms, e.g. `bytes =
32
- // hashfunc([...namespace, ... value])`
33
-
34
-
35
- var bytes = new Uint8Array(16 + value.length);
36
- bytes.set(namespace);
37
- bytes.set(value, namespace.length);
38
- bytes = hashfunc(bytes);
39
- bytes[6] = bytes[6] & 0x0f | version;
40
- bytes[8] = bytes[8] & 0x3f | 0x80;
41
-
19
+ if (namespace?.length !== 16) {
20
+ throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
21
+ }
22
+ let bytes = new Uint8Array(16 + valueBytes.length);
23
+ bytes.set(namespaceBytes);
24
+ bytes.set(valueBytes, namespaceBytes.length);
25
+ bytes = hash(bytes);
26
+ bytes[6] = (bytes[6] & 0x0f) | version;
27
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
42
28
  if (buf) {
43
- offset = offset || 0;
44
-
45
- for (var i = 0; i < 16; ++i) {
46
- buf[offset + i] = bytes[i];
47
- }
48
-
49
- return buf;
29
+ offset = offset || 0;
30
+ if (offset < 0 || offset + 16 > buf.length) {
31
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
32
+ }
33
+ for (let i = 0; i < 16; ++i) {
34
+ buf[offset + i] = bytes[i];
35
+ }
36
+ return buf;
50
37
  }
51
-
52
- return stringify(bytes);
53
- } // Function#name is not settable on some platforms (#270)
54
-
55
-
56
- try {
57
- generateUUID.name = name; // eslint-disable-next-line no-empty
58
- } catch (err) {} // For CommonJS default export support
59
-
60
-
61
- generateUUID.DNS = DNS;
62
- generateUUID.URL = URL;
63
- return generateUUID;
64
- }
38
+ return unsafeStringify(bytes);
39
+ }
@@ -0,0 +1,4 @@
1
+ import { Version4Options } from './types.js';
2
+ declare function v4(options?: Version4Options, buf?: undefined, offset?: number): string;
3
+ declare function v4<TBuf extends Uint8Array = Uint8Array>(options: Version4Options | undefined, buf: TBuf, offset?: number): TBuf;
4
+ export default v4;
@@ -1,24 +1,27 @@
1
+ import native from './native.js';
1
2
  import rng from './rng.js';
2
- import stringify from './stringify.js';
3
-
3
+ import { unsafeStringify } from './stringify.js';
4
4
  function v4(options, buf, offset) {
5
- options = options || {};
6
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
7
-
8
- rnds[6] = rnds[6] & 0x0f | 0x40;
9
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
10
-
11
- if (buf) {
12
- offset = offset || 0;
13
-
14
- for (var i = 0; i < 16; ++i) {
15
- buf[offset + i] = rnds[i];
5
+ if (native.randomUUID && !buf && !options) {
6
+ return native.randomUUID();
16
7
  }
17
-
18
- return buf;
19
- }
20
-
21
- return stringify(rnds);
8
+ options = options || {};
9
+ const rnds = options.random ?? options.rng?.() ?? rng();
10
+ if (rnds.length < 16) {
11
+ throw new Error('Random bytes length must be >= 16');
12
+ }
13
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
14
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
15
+ if (buf) {
16
+ offset = offset || 0;
17
+ if (offset < 0 || offset + 16 > buf.length) {
18
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
19
+ }
20
+ for (let i = 0; i < 16; ++i) {
21
+ buf[offset + i] = rnds[i];
22
+ }
23
+ return buf;
24
+ }
25
+ return unsafeStringify(rnds);
22
26
  }
23
-
24
- export default v4;
27
+ export default v4;
@@ -0,0 +1,9 @@
1
+ import { UUIDTypes } from './types.js';
2
+ export { DNS, URL } from './v35.js';
3
+ declare function v5(value: string | Uint8Array, namespace: UUIDTypes, buf?: undefined, offset?: number): string;
4
+ declare function v5<TBuf extends Uint8Array = Uint8Array>(value: string | Uint8Array, namespace: UUIDTypes, buf: TBuf, offset?: number): TBuf;
5
+ declare namespace v5 {
6
+ var DNS: string;
7
+ var URL: string;
8
+ }
9
+ export default v5;
@@ -1,4 +1,9 @@
1
- import v35 from './v35.js';
2
1
  import sha1 from './sha1.js';
3
- var v5 = v35('v5', 0x50, sha1);
4
- export default v5;
2
+ import v35, { DNS, URL } from './v35.js';
3
+ export { DNS, URL } from './v35.js';
4
+ function v5(value, namespace, buf, offset) {
5
+ return v35(0x50, sha1, value, namespace, buf, offset);
6
+ }
7
+ v5.DNS = DNS;
8
+ v5.URL = URL;
9
+ export default v5;
@@ -0,0 +1,4 @@
1
+ import { Version6Options } from './types.js';
2
+ declare function v6(options?: Version6Options, buf?: undefined, offset?: number): string;
3
+ declare function v6<TBuf extends Uint8Array = Uint8Array>(options: Version6Options | undefined, buf: TBuf, offset?: number): TBuf;
4
+ export default v6;
@@ -0,0 +1,20 @@
1
+ import { unsafeStringify } from './stringify.js';
2
+ import v1 from './v1.js';
3
+ import v1ToV6 from './v1ToV6.js';
4
+ function v6(options, buf, offset) {
5
+ options ??= {};
6
+ offset ??= 0;
7
+ let bytes = v1({ ...options, _v6: true }, new Uint8Array(16));
8
+ bytes = v1ToV6(bytes);
9
+ if (buf) {
10
+ if (offset < 0 || offset + 16 > buf.length) {
11
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
12
+ }
13
+ for (let i = 0; i < 16; i++) {
14
+ buf[offset + i] = bytes[i];
15
+ }
16
+ return buf;
17
+ }
18
+ return unsafeStringify(bytes);
19
+ }
20
+ export default v6;
@@ -0,0 +1,2 @@
1
+ export default function v6ToV1(uuid: string): string;
2
+ export default function v6ToV1(uuid: Uint8Array): Uint8Array;
@@ -0,0 +1,10 @@
1
+ import parse from './parse.js';
2
+ import { unsafeStringify } from './stringify.js';
3
+ export default function v6ToV1(uuid) {
4
+ const v6Bytes = typeof uuid === 'string' ? parse(uuid) : uuid;
5
+ const v1Bytes = _v6ToV1(v6Bytes);
6
+ return typeof uuid === 'string' ? unsafeStringify(v1Bytes) : v1Bytes;
7
+ }
8
+ function _v6ToV1(v6Bytes) {
9
+ return Uint8Array.of(((v6Bytes[3] & 0x0f) << 4) | ((v6Bytes[4] >> 4) & 0x0f), ((v6Bytes[4] & 0x0f) << 4) | ((v6Bytes[5] & 0xf0) >> 4), ((v6Bytes[5] & 0x0f) << 4) | (v6Bytes[6] & 0x0f), v6Bytes[7], ((v6Bytes[1] & 0x0f) << 4) | ((v6Bytes[2] & 0xf0) >> 4), ((v6Bytes[2] & 0x0f) << 4) | ((v6Bytes[3] & 0xf0) >> 4), 0x10 | ((v6Bytes[0] & 0xf0) >> 4), ((v6Bytes[0] & 0x0f) << 4) | ((v6Bytes[1] & 0xf0) >> 4), v6Bytes[8], v6Bytes[9], v6Bytes[10], v6Bytes[11], v6Bytes[12], v6Bytes[13], v6Bytes[14], v6Bytes[15]);
10
+ }
@@ -0,0 +1,9 @@
1
+ import { Version7Options } from './types.js';
2
+ type V7State = {
3
+ msecs?: number;
4
+ seq?: number;
5
+ };
6
+ declare function v7(options?: Version7Options, buf?: undefined, offset?: number): string;
7
+ declare function v7<TBuf extends Uint8Array = Uint8Array>(options: Version7Options | undefined, buf: TBuf, offset?: number): TBuf;
8
+ export declare function updateV7State(state: V7State, now: number, rnds: Uint8Array): V7State;
9
+ export default v7;