@mui/x-charts-vendor 7.12.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 (312) hide show
  1. package/README.md +76 -0
  2. package/d3-color.d.ts +5 -0
  3. package/d3-color.js +7 -0
  4. package/d3-delaunay.d.ts +5 -0
  5. package/d3-delaunay.js +7 -0
  6. package/d3-interpolate.d.ts +5 -0
  7. package/d3-interpolate.js +7 -0
  8. package/d3-scale.d.ts +5 -0
  9. package/d3-scale.js +7 -0
  10. package/d3-shape.d.ts +5 -0
  11. package/d3-shape.js +7 -0
  12. package/d3-time.d.ts +5 -0
  13. package/d3-time.js +7 -0
  14. package/es/d3-array.js +6 -0
  15. package/es/d3-color.js +6 -0
  16. package/es/d3-delaunay.js +6 -0
  17. package/es/d3-format.js +6 -0
  18. package/es/d3-interpolate.js +6 -0
  19. package/es/d3-path.js +6 -0
  20. package/es/d3-scale.js +6 -0
  21. package/es/d3-shape.js +6 -0
  22. package/es/d3-time-format.js +6 -0
  23. package/es/d3-time.js +6 -0
  24. package/es/delaunator.js +6 -0
  25. package/es/internmap.js +6 -0
  26. package/es/robust-predicates.js +6 -0
  27. package/lib/d3-array.js +6 -0
  28. package/lib/d3-color.js +6 -0
  29. package/lib/d3-delaunay.js +6 -0
  30. package/lib/d3-format.js +6 -0
  31. package/lib/d3-interpolate.js +6 -0
  32. package/lib/d3-path.js +6 -0
  33. package/lib/d3-scale.js +6 -0
  34. package/lib/d3-shape.js +6 -0
  35. package/lib/d3-time-format.js +6 -0
  36. package/lib/d3-time.js +6 -0
  37. package/lib/delaunator.js +6 -0
  38. package/lib/internmap.js +6 -0
  39. package/lib/robust-predicates.js +6 -0
  40. package/lib-vendor/d3-array/LICENSE +13 -0
  41. package/lib-vendor/d3-array/dist/d3-array.js +1349 -0
  42. package/lib-vendor/d3-array/dist/d3-array.min.js +777 -0
  43. package/lib-vendor/d3-array/src/array.js +9 -0
  44. package/lib-vendor/d3-array/src/ascending.js +9 -0
  45. package/lib-vendor/d3-array/src/bin.js +126 -0
  46. package/lib-vendor/d3-array/src/bisect.js +15 -0
  47. package/lib-vendor/d3-array/src/bisector.js +59 -0
  48. package/lib-vendor/d3-array/src/blur.js +122 -0
  49. package/lib-vendor/d3-array/src/constant.js +9 -0
  50. package/lib-vendor/d3-array/src/count.js +24 -0
  51. package/lib-vendor/d3-array/src/cross.js +35 -0
  52. package/lib-vendor/d3-array/src/cumsum.js +11 -0
  53. package/lib-vendor/d3-array/src/descending.js +9 -0
  54. package/lib-vendor/d3-array/src/deviation.js +12 -0
  55. package/lib-vendor/d3-array/src/difference.js +16 -0
  56. package/lib-vendor/d3-array/src/disjoint.js +24 -0
  57. package/lib-vendor/d3-array/src/every.js +16 -0
  58. package/lib-vendor/d3-array/src/extent.js +35 -0
  59. package/lib-vendor/d3-array/src/filter.js +17 -0
  60. package/lib-vendor/d3-array/src/fsum.js +77 -0
  61. package/lib-vendor/d3-array/src/greatest.js +31 -0
  62. package/lib-vendor/d3-array/src/greatestIndex.js +23 -0
  63. package/lib-vendor/d3-array/src/group.js +67 -0
  64. package/lib-vendor/d3-array/src/groupSort.js +15 -0
  65. package/lib-vendor/d3-array/src/identity.js +9 -0
  66. package/lib-vendor/d3-array/src/index.js +539 -0
  67. package/lib-vendor/d3-array/src/intersection.js +23 -0
  68. package/lib-vendor/d3-array/src/least.js +31 -0
  69. package/lib-vendor/d3-array/src/leastIndex.js +23 -0
  70. package/lib-vendor/d3-array/src/map.js +11 -0
  71. package/lib-vendor/d3-array/src/max.js +24 -0
  72. package/lib-vendor/d3-array/src/maxIndex.js +26 -0
  73. package/lib-vendor/d3-array/src/mean.js +25 -0
  74. package/lib-vendor/d3-array/src/median.js +16 -0
  75. package/lib-vendor/d3-array/src/merge.js +14 -0
  76. package/lib-vendor/d3-array/src/min.js +24 -0
  77. package/lib-vendor/d3-array/src/minIndex.js +26 -0
  78. package/lib-vendor/d3-array/src/mode.js +33 -0
  79. package/lib-vendor/d3-array/src/nice.js +23 -0
  80. package/lib-vendor/d3-array/src/number.js +26 -0
  81. package/lib-vendor/d3-array/src/pairs.js +21 -0
  82. package/lib-vendor/d3-array/src/permute.js +9 -0
  83. package/lib-vendor/d3-array/src/quantile.js +55 -0
  84. package/lib-vendor/d3-array/src/quickselect.js +47 -0
  85. package/lib-vendor/d3-array/src/range.js +16 -0
  86. package/lib-vendor/d3-array/src/rank.js +30 -0
  87. package/lib-vendor/d3-array/src/reduce.js +28 -0
  88. package/lib-vendor/d3-array/src/reverse.js +10 -0
  89. package/lib-vendor/d3-array/src/scan.js +12 -0
  90. package/lib-vendor/d3-array/src/shuffle.js +20 -0
  91. package/lib-vendor/d3-array/src/some.js +16 -0
  92. package/lib-vendor/d3-array/src/sort.js +45 -0
  93. package/lib-vendor/d3-array/src/subset.js +11 -0
  94. package/lib-vendor/d3-array/src/sum.js +24 -0
  95. package/lib-vendor/d3-array/src/superset.js +28 -0
  96. package/lib-vendor/d3-array/src/threshold/freedmanDiaconis.js +14 -0
  97. package/lib-vendor/d3-array/src/threshold/scott.js +14 -0
  98. package/lib-vendor/d3-array/src/threshold/sturges.js +11 -0
  99. package/lib-vendor/d3-array/src/ticks.js +60 -0
  100. package/lib-vendor/d3-array/src/transpose.js +20 -0
  101. package/lib-vendor/d3-array/src/union.js +16 -0
  102. package/lib-vendor/d3-array/src/variance.js +31 -0
  103. package/lib-vendor/d3-array/src/zip.js +11 -0
  104. package/lib-vendor/d3-color/LICENSE +13 -0
  105. package/lib-vendor/d3-color/dist/d3-color.js +532 -0
  106. package/lib-vendor/d3-color/dist/d3-color.min.js +446 -0
  107. package/lib-vendor/d3-color/src/color.js +366 -0
  108. package/lib-vendor/d3-color/src/cubehelix.js +61 -0
  109. package/lib-vendor/d3-color/src/define.js +16 -0
  110. package/lib-vendor/d3-color/src/index.js +59 -0
  111. package/lib-vendor/d3-color/src/lab.js +117 -0
  112. package/lib-vendor/d3-color/src/math.js +8 -0
  113. package/lib-vendor/d3-delaunay/LICENSE +14 -0
  114. package/lib-vendor/d3-delaunay/dist/d3-delaunay.js +1398 -0
  115. package/lib-vendor/d3-delaunay/dist/d3-delaunay.min.js +853 -0
  116. package/lib-vendor/d3-delaunay/src/delaunay.js +282 -0
  117. package/lib-vendor/d3-delaunay/src/index.js +20 -0
  118. package/lib-vendor/d3-delaunay/src/path.js +43 -0
  119. package/lib-vendor/d3-delaunay/src/polygon.js +24 -0
  120. package/lib-vendor/d3-delaunay/src/voronoi.js +390 -0
  121. package/lib-vendor/d3-format/LICENSE +13 -0
  122. package/lib-vendor/d3-format/dist/d3-format.js +313 -0
  123. package/lib-vendor/d3-format/dist/d3-format.min.js +193 -0
  124. package/lib-vendor/d3-format/src/defaultLocale.js +23 -0
  125. package/lib-vendor/d3-format/src/exponent.js +10 -0
  126. package/lib-vendor/d3-format/src/formatDecimal.js +23 -0
  127. package/lib-vendor/d3-format/src/formatGroup.js +22 -0
  128. package/lib-vendor/d3-format/src/formatNumerals.js +13 -0
  129. package/lib-vendor/d3-format/src/formatPrefixAuto.js +18 -0
  130. package/lib-vendor/d3-format/src/formatRounded.js +14 -0
  131. package/lib-vendor/d3-format/src/formatSpecifier.js +42 -0
  132. package/lib-vendor/d3-format/src/formatTrim.js +25 -0
  133. package/lib-vendor/d3-format/src/formatTypes.js +25 -0
  134. package/lib-vendor/d3-format/src/identity.js +9 -0
  135. package/lib-vendor/d3-format/src/index.js +68 -0
  136. package/lib-vendor/d3-format/src/locale.js +152 -0
  137. package/lib-vendor/d3-format/src/precisionFixed.js +11 -0
  138. package/lib-vendor/d3-format/src/precisionPrefix.js +11 -0
  139. package/lib-vendor/d3-format/src/precisionRound.js +12 -0
  140. package/lib-vendor/d3-interpolate/LICENSE +13 -0
  141. package/lib-vendor/d3-interpolate/dist/d3-interpolate.js +543 -0
  142. package/lib-vendor/d3-interpolate/dist/d3-interpolate.min.js +362 -0
  143. package/lib-vendor/d3-interpolate/src/array.js +28 -0
  144. package/lib-vendor/d3-interpolate/src/basis.js +23 -0
  145. package/lib-vendor/d3-interpolate/src/basisClosed.js +18 -0
  146. package/lib-vendor/d3-interpolate/src/color.js +33 -0
  147. package/lib-vendor/d3-interpolate/src/constant.js +8 -0
  148. package/lib-vendor/d3-interpolate/src/cubehelix.js +32 -0
  149. package/lib-vendor/d3-interpolate/src/date.js +12 -0
  150. package/lib-vendor/d3-interpolate/src/discrete.js +12 -0
  151. package/lib-vendor/d3-interpolate/src/hcl.js +27 -0
  152. package/lib-vendor/d3-interpolate/src/hsl.js +27 -0
  153. package/lib-vendor/d3-interpolate/src/hue.js +14 -0
  154. package/lib-vendor/d3-interpolate/src/index.js +191 -0
  155. package/lib-vendor/d3-interpolate/src/lab.js +22 -0
  156. package/lib-vendor/d3-interpolate/src/number.js +11 -0
  157. package/lib-vendor/d3-interpolate/src/numberArray.js +20 -0
  158. package/lib-vendor/d3-interpolate/src/object.js +26 -0
  159. package/lib-vendor/d3-interpolate/src/piecewise.js +20 -0
  160. package/lib-vendor/d3-interpolate/src/quantize.js +11 -0
  161. package/lib-vendor/d3-interpolate/src/rgb.js +59 -0
  162. package/lib-vendor/d3-interpolate/src/round.js +11 -0
  163. package/lib-vendor/d3-interpolate/src/string.js +75 -0
  164. package/lib-vendor/d3-interpolate/src/transform/decompose.js +31 -0
  165. package/lib-vendor/d3-interpolate/src/transform/index.js +83 -0
  166. package/lib-vendor/d3-interpolate/src/transform/parse.js +25 -0
  167. package/lib-vendor/d3-interpolate/src/value.js +23 -0
  168. package/lib-vendor/d3-interpolate/src/zoom.js +66 -0
  169. package/lib-vendor/d3-path/LICENSE +13 -0
  170. package/lib-vendor/d3-path/dist/d3-path.js +161 -0
  171. package/lib-vendor/d3-path/dist/d3-path.min.js +92 -0
  172. package/lib-vendor/d3-path/src/index.js +24 -0
  173. package/lib-vendor/d3-path/src/path.js +158 -0
  174. package/lib-vendor/d3-scale/LICENSE +13 -0
  175. package/lib-vendor/d3-scale/dist/d3-scale.js +944 -0
  176. package/lib-vendor/d3-scale/dist/d3-scale.min.js +690 -0
  177. package/lib-vendor/d3-scale/src/band.js +87 -0
  178. package/lib-vendor/d3-scale/src/colors.js +11 -0
  179. package/lib-vendor/d3-scale/src/constant.js +11 -0
  180. package/lib-vendor/d3-scale/src/continuous.js +116 -0
  181. package/lib-vendor/d3-scale/src/diverging.js +91 -0
  182. package/lib-vendor/d3-scale/src/identity.js +27 -0
  183. package/lib-vendor/d3-scale/src/index.js +193 -0
  184. package/lib-vendor/d3-scale/src/init.js +38 -0
  185. package/lib-vendor/d3-scale/src/linear.js +67 -0
  186. package/lib-vendor/d3-scale/src/log.js +123 -0
  187. package/lib-vendor/d3-scale/src/nice.js +21 -0
  188. package/lib-vendor/d3-scale/src/number.js +9 -0
  189. package/lib-vendor/d3-scale/src/ordinal.js +44 -0
  190. package/lib-vendor/d3-scale/src/pow.js +44 -0
  191. package/lib-vendor/d3-scale/src/quantile.js +48 -0
  192. package/lib-vendor/d3-scale/src/quantize.js +46 -0
  193. package/lib-vendor/d3-scale/src/radial.js +53 -0
  194. package/lib-vendor/d3-scale/src/sequential.js +90 -0
  195. package/lib-vendor/d3-scale/src/sequentialQuantile.js +38 -0
  196. package/lib-vendor/d3-scale/src/symlog.js +35 -0
  197. package/lib-vendor/d3-scale/src/threshold.js +34 -0
  198. package/lib-vendor/d3-scale/src/tickFormat.js +37 -0
  199. package/lib-vendor/d3-scale/src/time.js +62 -0
  200. package/lib-vendor/d3-scale/src/utcTime.js +13 -0
  201. package/lib-vendor/d3-shape/LICENSE +13 -0
  202. package/lib-vendor/d3-shape/dist/d3-shape.js +2004 -0
  203. package/lib-vendor/d3-shape/dist/d3-shape.min.js +1389 -0
  204. package/lib-vendor/d3-shape/src/arc.js +250 -0
  205. package/lib-vendor/d3-shape/src/area.js +98 -0
  206. package/lib-vendor/d3-shape/src/areaRadial.js +42 -0
  207. package/lib-vendor/d3-shape/src/array.js +12 -0
  208. package/lib-vendor/d3-shape/src/constant.js +11 -0
  209. package/lib-vendor/d3-shape/src/curve/basis.js +62 -0
  210. package/lib-vendor/d3-shape/src/curve/basisClosed.js +70 -0
  211. package/lib-vendor/d3-shape/src/curve/basisOpen.js +54 -0
  212. package/lib-vendor/d3-shape/src/curve/bump.js +81 -0
  213. package/lib-vendor/d3-shape/src/curve/bundle.js +50 -0
  214. package/lib-vendor/d3-shape/src/curve/cardinal.js +69 -0
  215. package/lib-vendor/d3-shape/src/curve/cardinalClosed.js +76 -0
  216. package/lib-vendor/d3-shape/src/curve/cardinalOpen.js +60 -0
  217. package/lib-vendor/d3-shape/src/curve/catmullRom.js +92 -0
  218. package/lib-vendor/d3-shape/src/curve/catmullRomClosed.js +83 -0
  219. package/lib-vendor/d3-shape/src/curve/catmullRomOpen.js +67 -0
  220. package/lib-vendor/d3-shape/src/curve/linear.js +42 -0
  221. package/lib-vendor/d3-shape/src/curve/linearClosed.js +28 -0
  222. package/lib-vendor/d3-shape/src/curve/monotone.js +121 -0
  223. package/lib-vendor/d3-shape/src/curve/natural.js +67 -0
  224. package/lib-vendor/d3-shape/src/curve/radial.js +37 -0
  225. package/lib-vendor/d3-shape/src/curve/step.js +63 -0
  226. package/lib-vendor/d3-shape/src/descending.js +9 -0
  227. package/lib-vendor/d3-shape/src/identity.js +9 -0
  228. package/lib-vendor/d3-shape/src/index.js +436 -0
  229. package/lib-vendor/d3-shape/src/line.js +52 -0
  230. package/lib-vendor/d3-shape/src/lineRadial.js +24 -0
  231. package/lib-vendor/d3-shape/src/link.js +70 -0
  232. package/lib-vendor/d3-shape/src/math.js +26 -0
  233. package/lib-vendor/d3-shape/src/noop.js +7 -0
  234. package/lib-vendor/d3-shape/src/offset/diverging.js +20 -0
  235. package/lib-vendor/d3-shape/src/offset/expand.js +16 -0
  236. package/lib-vendor/d3-shape/src/offset/none.js +15 -0
  237. package/lib-vendor/d3-shape/src/offset/silhouette.js +16 -0
  238. package/lib-vendor/d3-shape/src/offset/wiggle.js +30 -0
  239. package/lib-vendor/d3-shape/src/order/appearance.js +23 -0
  240. package/lib-vendor/d3-shape/src/order/ascending.js +23 -0
  241. package/lib-vendor/d3-shape/src/order/descending.js +11 -0
  242. package/lib-vendor/d3-shape/src/order/insideOut.js +31 -0
  243. package/lib-vendor/d3-shape/src/order/none.js +12 -0
  244. package/lib-vendor/d3-shape/src/order/reverse.js +11 -0
  245. package/lib-vendor/d3-shape/src/path.js +22 -0
  246. package/lib-vendor/d3-shape/src/pie.js +79 -0
  247. package/lib-vendor/d3-shape/src/point.js +13 -0
  248. package/lib-vendor/d3-shape/src/pointRadial.js +9 -0
  249. package/lib-vendor/d3-shape/src/stack.js +55 -0
  250. package/lib-vendor/d3-shape/src/symbol/asterisk.js +21 -0
  251. package/lib-vendor/d3-shape/src/symbol/circle.js +14 -0
  252. package/lib-vendor/d3-shape/src/symbol/cross.js +25 -0
  253. package/lib-vendor/d3-shape/src/symbol/diamond.js +20 -0
  254. package/lib-vendor/d3-shape/src/symbol/diamond2.js +17 -0
  255. package/lib-vendor/d3-shape/src/symbol/plus.js +16 -0
  256. package/lib-vendor/d3-shape/src/symbol/square.js +14 -0
  257. package/lib-vendor/d3-shape/src/symbol/square2.js +17 -0
  258. package/lib-vendor/d3-shape/src/symbol/star.js +28 -0
  259. package/lib-vendor/d3-shape/src/symbol/times.js +16 -0
  260. package/lib-vendor/d3-shape/src/symbol/triangle.js +17 -0
  261. package/lib-vendor/d3-shape/src/symbol/triangle2.js +19 -0
  262. package/lib-vendor/d3-shape/src/symbol/wye.js +32 -0
  263. package/lib-vendor/d3-shape/src/symbol.js +50 -0
  264. package/lib-vendor/d3-time/LICENSE +13 -0
  265. package/lib-vendor/d3-time/dist/d3-time.js +367 -0
  266. package/lib-vendor/d3-time/dist/d3-time.min.js +190 -0
  267. package/lib-vendor/d3-time/src/day.js +30 -0
  268. package/lib-vendor/d3-time/src/duration.js +13 -0
  269. package/lib-vendor/d3-time/src/hour.js +28 -0
  270. package/lib-vendor/d3-time/src/index.js +417 -0
  271. package/lib-vendor/d3-time/src/interval.js +61 -0
  272. package/lib-vendor/d3-time/src/millisecond.js +29 -0
  273. package/lib-vendor/d3-time/src/minute.js +28 -0
  274. package/lib-vendor/d3-time/src/month.js +29 -0
  275. package/lib-vendor/d3-time/src/second.js +18 -0
  276. package/lib-vendor/d3-time/src/ticks.js +41 -0
  277. package/lib-vendor/d3-time/src/week.js +56 -0
  278. package/lib-vendor/d3-time/src/year.js +51 -0
  279. package/lib-vendor/d3-time-format/LICENSE +13 -0
  280. package/lib-vendor/d3-time-format/dist/d3-time-format.js +648 -0
  281. package/lib-vendor/d3-time-format/dist/d3-time-format.min.js +528 -0
  282. package/lib-vendor/d3-time-format/src/defaultLocale.js +32 -0
  283. package/lib-vendor/d3-time-format/src/index.js +60 -0
  284. package/lib-vendor/d3-time-format/src/isoFormat.js +13 -0
  285. package/lib-vendor/d3-time-format/src/isoParse.js +14 -0
  286. package/lib-vendor/d3-time-format/src/locale.js +606 -0
  287. package/lib-vendor/delaunator/LICENSE +15 -0
  288. package/lib-vendor/delaunator/delaunator.js +688 -0
  289. package/lib-vendor/delaunator/delaunator.min.js +316 -0
  290. package/lib-vendor/delaunator/index.js +440 -0
  291. package/lib-vendor/internmap/LICENSE +13 -0
  292. package/lib-vendor/internmap/dist/internmap.js +93 -0
  293. package/lib-vendor/internmap/dist/internmap.min.js +81 -0
  294. package/lib-vendor/internmap/src/index.js +87 -0
  295. package/lib-vendor/robust-predicates/LICENSE +24 -0
  296. package/lib-vendor/robust-predicates/esm/incircle.js +667 -0
  297. package/lib-vendor/robust-predicates/esm/insphere.js +693 -0
  298. package/lib-vendor/robust-predicates/esm/orient2d.js +174 -0
  299. package/lib-vendor/robust-predicates/esm/orient3d.js +422 -0
  300. package/lib-vendor/robust-predicates/esm/util.js +147 -0
  301. package/lib-vendor/robust-predicates/index.js +57 -0
  302. package/lib-vendor/robust-predicates/umd/incircle.js +798 -0
  303. package/lib-vendor/robust-predicates/umd/incircle.min.js +170 -0
  304. package/lib-vendor/robust-predicates/umd/insphere.js +828 -0
  305. package/lib-vendor/robust-predicates/umd/insphere.min.js +223 -0
  306. package/lib-vendor/robust-predicates/umd/orient2d.js +260 -0
  307. package/lib-vendor/robust-predicates/umd/orient2d.min.js +69 -0
  308. package/lib-vendor/robust-predicates/umd/orient3d.js +550 -0
  309. package/lib-vendor/robust-predicates/umd/orient3d.min.js +133 -0
  310. package/lib-vendor/robust-predicates/umd/predicates.js +2073 -0
  311. package/lib-vendor/robust-predicates/umd/predicates.min.js +468 -0
  312. package/package.json +63 -0
@@ -0,0 +1,440 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _index = require("../../lib-vendor/robust-predicates/index.js");
8
+ const EPSILON = Math.pow(2, -52);
9
+ const EDGE_STACK = new Uint32Array(512);
10
+ class Delaunator {
11
+ static from(points, getX = defaultGetX, getY = defaultGetY) {
12
+ const n = points.length;
13
+ const coords = new Float64Array(n * 2);
14
+ for (let i = 0; i < n; i++) {
15
+ const p = points[i];
16
+ coords[2 * i] = getX(p);
17
+ coords[2 * i + 1] = getY(p);
18
+ }
19
+ return new Delaunator(coords);
20
+ }
21
+ constructor(coords) {
22
+ const n = coords.length >> 1;
23
+ if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.');
24
+ this.coords = coords;
25
+
26
+ // arrays that will store the triangulation graph
27
+ const maxTriangles = Math.max(2 * n - 5, 0);
28
+ this._triangles = new Uint32Array(maxTriangles * 3);
29
+ this._halfedges = new Int32Array(maxTriangles * 3);
30
+
31
+ // temporary arrays for tracking the edges of the advancing convex hull
32
+ this._hashSize = Math.ceil(Math.sqrt(n));
33
+ this._hullPrev = new Uint32Array(n); // edge to prev edge
34
+ this._hullNext = new Uint32Array(n); // edge to next edge
35
+ this._hullTri = new Uint32Array(n); // edge to adjacent triangle
36
+ this._hullHash = new Int32Array(this._hashSize); // angular edge hash
37
+
38
+ // temporary arrays for sorting points
39
+ this._ids = new Uint32Array(n);
40
+ this._dists = new Float64Array(n);
41
+ this.update();
42
+ }
43
+ update() {
44
+ const {
45
+ coords,
46
+ _hullPrev: hullPrev,
47
+ _hullNext: hullNext,
48
+ _hullTri: hullTri,
49
+ _hullHash: hullHash
50
+ } = this;
51
+ const n = coords.length >> 1;
52
+
53
+ // populate an array of point indices; calculate input data bbox
54
+ let minX = Infinity;
55
+ let minY = Infinity;
56
+ let maxX = -Infinity;
57
+ let maxY = -Infinity;
58
+ for (let i = 0; i < n; i++) {
59
+ const x = coords[2 * i];
60
+ const y = coords[2 * i + 1];
61
+ if (x < minX) minX = x;
62
+ if (y < minY) minY = y;
63
+ if (x > maxX) maxX = x;
64
+ if (y > maxY) maxY = y;
65
+ this._ids[i] = i;
66
+ }
67
+ const cx = (minX + maxX) / 2;
68
+ const cy = (minY + maxY) / 2;
69
+ let i0, i1, i2;
70
+
71
+ // pick a seed point close to the center
72
+ for (let i = 0, minDist = Infinity; i < n; i++) {
73
+ const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]);
74
+ if (d < minDist) {
75
+ i0 = i;
76
+ minDist = d;
77
+ }
78
+ }
79
+ const i0x = coords[2 * i0];
80
+ const i0y = coords[2 * i0 + 1];
81
+
82
+ // find the point closest to the seed
83
+ for (let i = 0, minDist = Infinity; i < n; i++) {
84
+ if (i === i0) continue;
85
+ const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]);
86
+ if (d < minDist && d > 0) {
87
+ i1 = i;
88
+ minDist = d;
89
+ }
90
+ }
91
+ let i1x = coords[2 * i1];
92
+ let i1y = coords[2 * i1 + 1];
93
+ let minRadius = Infinity;
94
+
95
+ // find the third point which forms the smallest circumcircle with the first two
96
+ for (let i = 0; i < n; i++) {
97
+ if (i === i0 || i === i1) continue;
98
+ const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]);
99
+ if (r < minRadius) {
100
+ i2 = i;
101
+ minRadius = r;
102
+ }
103
+ }
104
+ let i2x = coords[2 * i2];
105
+ let i2y = coords[2 * i2 + 1];
106
+ if (minRadius === Infinity) {
107
+ // order collinear points by dx (or dy if all x are identical)
108
+ // and return the list as a hull
109
+ for (let i = 0; i < n; i++) {
110
+ this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1];
111
+ }
112
+ quicksort(this._ids, this._dists, 0, n - 1);
113
+ const hull = new Uint32Array(n);
114
+ let j = 0;
115
+ for (let i = 0, d0 = -Infinity; i < n; i++) {
116
+ const id = this._ids[i];
117
+ const d = this._dists[id];
118
+ if (d > d0) {
119
+ hull[j++] = id;
120
+ d0 = d;
121
+ }
122
+ }
123
+ this.hull = hull.subarray(0, j);
124
+ this.triangles = new Uint32Array(0);
125
+ this.halfedges = new Uint32Array(0);
126
+ return;
127
+ }
128
+
129
+ // swap the order of the seed points for counter-clockwise orientation
130
+ if ((0, _index.orient2d)(i0x, i0y, i1x, i1y, i2x, i2y) < 0) {
131
+ const i = i1;
132
+ const x = i1x;
133
+ const y = i1y;
134
+ i1 = i2;
135
+ i1x = i2x;
136
+ i1y = i2y;
137
+ i2 = i;
138
+ i2x = x;
139
+ i2y = y;
140
+ }
141
+ const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y);
142
+ this._cx = center.x;
143
+ this._cy = center.y;
144
+ for (let i = 0; i < n; i++) {
145
+ this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y);
146
+ }
147
+
148
+ // sort the points by distance from the seed triangle circumcenter
149
+ quicksort(this._ids, this._dists, 0, n - 1);
150
+
151
+ // set up the seed triangle as the starting hull
152
+ this._hullStart = i0;
153
+ let hullSize = 3;
154
+ hullNext[i0] = hullPrev[i2] = i1;
155
+ hullNext[i1] = hullPrev[i0] = i2;
156
+ hullNext[i2] = hullPrev[i1] = i0;
157
+ hullTri[i0] = 0;
158
+ hullTri[i1] = 1;
159
+ hullTri[i2] = 2;
160
+ hullHash.fill(-1);
161
+ hullHash[this._hashKey(i0x, i0y)] = i0;
162
+ hullHash[this._hashKey(i1x, i1y)] = i1;
163
+ hullHash[this._hashKey(i2x, i2y)] = i2;
164
+ this.trianglesLen = 0;
165
+ this._addTriangle(i0, i1, i2, -1, -1, -1);
166
+ for (let k = 0, xp, yp; k < this._ids.length; k++) {
167
+ const i = this._ids[k];
168
+ const x = coords[2 * i];
169
+ const y = coords[2 * i + 1];
170
+
171
+ // skip near-duplicate points
172
+ if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue;
173
+ xp = x;
174
+ yp = y;
175
+
176
+ // skip seed triangle points
177
+ if (i === i0 || i === i1 || i === i2) continue;
178
+
179
+ // find a visible edge on the convex hull using edge hash
180
+ let start = 0;
181
+ for (let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++) {
182
+ start = hullHash[(key + j) % this._hashSize];
183
+ if (start !== -1 && start !== hullNext[start]) break;
184
+ }
185
+ start = hullPrev[start];
186
+ let e = start,
187
+ q;
188
+ while (q = hullNext[e], (0, _index.orient2d)(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) {
189
+ e = q;
190
+ if (e === start) {
191
+ e = -1;
192
+ break;
193
+ }
194
+ }
195
+ if (e === -1) continue; // likely a near-duplicate point; skip it
196
+
197
+ // add the first triangle from the point
198
+ let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]);
199
+
200
+ // recursively flip triangles from the point until they satisfy the Delaunay condition
201
+ hullTri[i] = this._legalize(t + 2);
202
+ hullTri[e] = t; // keep track of boundary triangles on the hull
203
+ hullSize++;
204
+
205
+ // walk forward through the hull, adding more triangles and flipping recursively
206
+ let n = hullNext[e];
207
+ while (q = hullNext[n], (0, _index.orient2d)(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1]) < 0) {
208
+ t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]);
209
+ hullTri[i] = this._legalize(t + 2);
210
+ hullNext[n] = n; // mark as removed
211
+ hullSize--;
212
+ n = q;
213
+ }
214
+
215
+ // walk backward from the other side, adding more triangles and flipping
216
+ if (e === start) {
217
+ while (q = hullPrev[e], (0, _index.orient2d)(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) {
218
+ t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]);
219
+ this._legalize(t + 2);
220
+ hullTri[q] = t;
221
+ hullNext[e] = e; // mark as removed
222
+ hullSize--;
223
+ e = q;
224
+ }
225
+ }
226
+
227
+ // update the hull indices
228
+ this._hullStart = hullPrev[i] = e;
229
+ hullNext[e] = hullPrev[n] = i;
230
+ hullNext[i] = n;
231
+
232
+ // save the two new edges in the hash table
233
+ hullHash[this._hashKey(x, y)] = i;
234
+ hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e;
235
+ }
236
+ this.hull = new Uint32Array(hullSize);
237
+ for (let i = 0, e = this._hullStart; i < hullSize; i++) {
238
+ this.hull[i] = e;
239
+ e = hullNext[e];
240
+ }
241
+
242
+ // trim typed triangle mesh arrays
243
+ this.triangles = this._triangles.subarray(0, this.trianglesLen);
244
+ this.halfedges = this._halfedges.subarray(0, this.trianglesLen);
245
+ }
246
+ _hashKey(x, y) {
247
+ return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize;
248
+ }
249
+ _legalize(a) {
250
+ const {
251
+ _triangles: triangles,
252
+ _halfedges: halfedges,
253
+ coords
254
+ } = this;
255
+ let i = 0;
256
+ let ar = 0;
257
+
258
+ // recursion eliminated with a fixed-size stack
259
+ while (true) {
260
+ const b = halfedges[a];
261
+
262
+ /* if the pair of triangles doesn't satisfy the Delaunay condition
263
+ * (p1 is inside the circumcircle of [p0, pl, pr]), flip them,
264
+ * then do the same check/flip recursively for the new pair of triangles
265
+ *
266
+ * pl pl
267
+ * /||\ / \
268
+ * al/ || \bl al/ \a
269
+ * / || \ / \
270
+ * / a||b \ flip /___ar___\
271
+ * p0\ || /p1 => p0\---bl---/p1
272
+ * \ || / \ /
273
+ * ar\ || /br b\ /br
274
+ * \||/ \ /
275
+ * pr pr
276
+ */
277
+ const a0 = a - a % 3;
278
+ ar = a0 + (a + 2) % 3;
279
+ if (b === -1) {
280
+ // convex hull edge
281
+ if (i === 0) break;
282
+ a = EDGE_STACK[--i];
283
+ continue;
284
+ }
285
+ const b0 = b - b % 3;
286
+ const al = a0 + (a + 1) % 3;
287
+ const bl = b0 + (b + 2) % 3;
288
+ const p0 = triangles[ar];
289
+ const pr = triangles[a];
290
+ const pl = triangles[al];
291
+ const p1 = triangles[bl];
292
+ const illegal = inCircle(coords[2 * p0], coords[2 * p0 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1]);
293
+ if (illegal) {
294
+ triangles[a] = p1;
295
+ triangles[b] = p0;
296
+ const hbl = halfedges[bl];
297
+
298
+ // edge swapped on the other side of the hull (rare); fix the halfedge reference
299
+ if (hbl === -1) {
300
+ let e = this._hullStart;
301
+ do {
302
+ if (this._hullTri[e] === bl) {
303
+ this._hullTri[e] = a;
304
+ break;
305
+ }
306
+ e = this._hullPrev[e];
307
+ } while (e !== this._hullStart);
308
+ }
309
+ this._link(a, hbl);
310
+ this._link(b, halfedges[ar]);
311
+ this._link(ar, bl);
312
+ const br = b0 + (b + 1) % 3;
313
+
314
+ // don't worry about hitting the cap: it can only happen on extremely degenerate input
315
+ if (i < EDGE_STACK.length) {
316
+ EDGE_STACK[i++] = br;
317
+ }
318
+ } else {
319
+ if (i === 0) break;
320
+ a = EDGE_STACK[--i];
321
+ }
322
+ }
323
+ return ar;
324
+ }
325
+ _link(a, b) {
326
+ this._halfedges[a] = b;
327
+ if (b !== -1) this._halfedges[b] = a;
328
+ }
329
+
330
+ // add a new triangle given vertex indices and adjacent half-edge ids
331
+ _addTriangle(i0, i1, i2, a, b, c) {
332
+ const t = this.trianglesLen;
333
+ this._triangles[t] = i0;
334
+ this._triangles[t + 1] = i1;
335
+ this._triangles[t + 2] = i2;
336
+ this._link(t, a);
337
+ this._link(t + 1, b);
338
+ this._link(t + 2, c);
339
+ this.trianglesLen += 3;
340
+ return t;
341
+ }
342
+ }
343
+
344
+ // monotonically increases with real angle, but doesn't need expensive trigonometry
345
+ exports.default = Delaunator;
346
+ function pseudoAngle(dx, dy) {
347
+ const p = dx / (Math.abs(dx) + Math.abs(dy));
348
+ return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1]
349
+ }
350
+ function dist(ax, ay, bx, by) {
351
+ const dx = ax - bx;
352
+ const dy = ay - by;
353
+ return dx * dx + dy * dy;
354
+ }
355
+ function inCircle(ax, ay, bx, by, cx, cy, px, py) {
356
+ const dx = ax - px;
357
+ const dy = ay - py;
358
+ const ex = bx - px;
359
+ const ey = by - py;
360
+ const fx = cx - px;
361
+ const fy = cy - py;
362
+ const ap = dx * dx + dy * dy;
363
+ const bp = ex * ex + ey * ey;
364
+ const cp = fx * fx + fy * fy;
365
+ return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0;
366
+ }
367
+ function circumradius(ax, ay, bx, by, cx, cy) {
368
+ const dx = bx - ax;
369
+ const dy = by - ay;
370
+ const ex = cx - ax;
371
+ const ey = cy - ay;
372
+ const bl = dx * dx + dy * dy;
373
+ const cl = ex * ex + ey * ey;
374
+ const d = 0.5 / (dx * ey - dy * ex);
375
+ const x = (ey * bl - dy * cl) * d;
376
+ const y = (dx * cl - ex * bl) * d;
377
+ return x * x + y * y;
378
+ }
379
+ function circumcenter(ax, ay, bx, by, cx, cy) {
380
+ const dx = bx - ax;
381
+ const dy = by - ay;
382
+ const ex = cx - ax;
383
+ const ey = cy - ay;
384
+ const bl = dx * dx + dy * dy;
385
+ const cl = ex * ex + ey * ey;
386
+ const d = 0.5 / (dx * ey - dy * ex);
387
+ const x = ax + (ey * bl - dy * cl) * d;
388
+ const y = ay + (dx * cl - ex * bl) * d;
389
+ return {
390
+ x,
391
+ y
392
+ };
393
+ }
394
+ function quicksort(ids, dists, left, right) {
395
+ if (right - left <= 20) {
396
+ for (let i = left + 1; i <= right; i++) {
397
+ const temp = ids[i];
398
+ const tempDist = dists[temp];
399
+ let j = i - 1;
400
+ while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--];
401
+ ids[j + 1] = temp;
402
+ }
403
+ } else {
404
+ const median = left + right >> 1;
405
+ let i = left + 1;
406
+ let j = right;
407
+ swap(ids, median, i);
408
+ if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right);
409
+ if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right);
410
+ if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i);
411
+ const temp = ids[i];
412
+ const tempDist = dists[temp];
413
+ while (true) {
414
+ do i++; while (dists[ids[i]] < tempDist);
415
+ do j--; while (dists[ids[j]] > tempDist);
416
+ if (j < i) break;
417
+ swap(ids, i, j);
418
+ }
419
+ ids[left + 1] = ids[j];
420
+ ids[j] = temp;
421
+ if (right - i + 1 >= j - left) {
422
+ quicksort(ids, dists, i, right);
423
+ quicksort(ids, dists, left, j - 1);
424
+ } else {
425
+ quicksort(ids, dists, left, j - 1);
426
+ quicksort(ids, dists, i, right);
427
+ }
428
+ }
429
+ }
430
+ function swap(arr, i, j) {
431
+ const tmp = arr[i];
432
+ arr[i] = arr[j];
433
+ arr[j] = tmp;
434
+ }
435
+ function defaultGetX(p) {
436
+ return p[0];
437
+ }
438
+ function defaultGetY(p) {
439
+ return p[1];
440
+ }
@@ -0,0 +1,13 @@
1
+ Copyright 2021 Mike Bostock
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose
4
+ with or without fee is hereby granted, provided that the above copyright notice
5
+ and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13
+ THIS SOFTWARE.
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ // https://github.com/mbostock/internmap/ v2.0.3 Copyright 2021 Mike Bostock
4
+ (function (global, factory) {
5
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.internmap = {}));
6
+ })(this, function (exports) {
7
+ 'use strict';
8
+
9
+ class InternMap extends Map {
10
+ constructor(entries, key = keyof) {
11
+ super();
12
+ Object.defineProperties(this, {
13
+ _intern: {
14
+ value: new Map()
15
+ },
16
+ _key: {
17
+ value: key
18
+ }
19
+ });
20
+ if (entries != null) for (const [key, value] of entries) this.set(key, value);
21
+ }
22
+ get(key) {
23
+ return super.get(intern_get(this, key));
24
+ }
25
+ has(key) {
26
+ return super.has(intern_get(this, key));
27
+ }
28
+ set(key, value) {
29
+ return super.set(intern_set(this, key), value);
30
+ }
31
+ delete(key) {
32
+ return super.delete(intern_delete(this, key));
33
+ }
34
+ }
35
+ class InternSet extends Set {
36
+ constructor(values, key = keyof) {
37
+ super();
38
+ Object.defineProperties(this, {
39
+ _intern: {
40
+ value: new Map()
41
+ },
42
+ _key: {
43
+ value: key
44
+ }
45
+ });
46
+ if (values != null) for (const value of values) this.add(value);
47
+ }
48
+ has(value) {
49
+ return super.has(intern_get(this, value));
50
+ }
51
+ add(value) {
52
+ return super.add(intern_set(this, value));
53
+ }
54
+ delete(value) {
55
+ return super.delete(intern_delete(this, value));
56
+ }
57
+ }
58
+ function intern_get({
59
+ _intern,
60
+ _key
61
+ }, value) {
62
+ const key = _key(value);
63
+ return _intern.has(key) ? _intern.get(key) : value;
64
+ }
65
+ function intern_set({
66
+ _intern,
67
+ _key
68
+ }, value) {
69
+ const key = _key(value);
70
+ if (_intern.has(key)) return _intern.get(key);
71
+ _intern.set(key, value);
72
+ return value;
73
+ }
74
+ function intern_delete({
75
+ _intern,
76
+ _key
77
+ }, value) {
78
+ const key = _key(value);
79
+ if (_intern.has(key)) {
80
+ value = _intern.get(key);
81
+ _intern.delete(key);
82
+ }
83
+ return value;
84
+ }
85
+ function keyof(value) {
86
+ return value !== null && typeof value === "object" ? value.valueOf() : value;
87
+ }
88
+ exports.InternMap = InternMap;
89
+ exports.InternSet = InternSet;
90
+ Object.defineProperty(exports, '__esModule', {
91
+ value: true
92
+ });
93
+ });
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ // https://github.com/mbostock/internmap/ v2.0.3 Copyright 2021 Mike Bostock
4
+ !function (e, t) {
5
+ "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).internmap = {});
6
+ }(this, function (e) {
7
+ "use strict";
8
+
9
+ class InternMap extends Map {
10
+ constructor(e, t = r) {
11
+ if (super(), Object.defineProperties(this, {
12
+ _intern: {
13
+ value: new Map()
14
+ },
15
+ _key: {
16
+ value: t
17
+ }
18
+ }), null != e) for (const [t, n] of e) this.set(t, n);
19
+ }
20
+ get(e) {
21
+ return super.get(t(this, e));
22
+ }
23
+ has(e) {
24
+ return super.has(t(this, e));
25
+ }
26
+ set(e, t) {
27
+ return super.set(n(this, e), t);
28
+ }
29
+ delete(e) {
30
+ return super.delete(s(this, e));
31
+ }
32
+ }
33
+ class InternSet extends Set {
34
+ constructor(e, t = r) {
35
+ if (super(), Object.defineProperties(this, {
36
+ _intern: {
37
+ value: new Map()
38
+ },
39
+ _key: {
40
+ value: t
41
+ }
42
+ }), null != e) for (const t of e) this.add(t);
43
+ }
44
+ has(e) {
45
+ return super.has(t(this, e));
46
+ }
47
+ add(e) {
48
+ return super.add(n(this, e));
49
+ }
50
+ delete(e) {
51
+ return super.delete(s(this, e));
52
+ }
53
+ }
54
+ function t({
55
+ _intern: e,
56
+ _key: t
57
+ }, n) {
58
+ const s = t(n);
59
+ return e.has(s) ? e.get(s) : n;
60
+ }
61
+ function n({
62
+ _intern: e,
63
+ _key: t
64
+ }, n) {
65
+ const s = t(n);
66
+ return e.has(s) ? e.get(s) : (e.set(s, n), n);
67
+ }
68
+ function s({
69
+ _intern: e,
70
+ _key: t
71
+ }, n) {
72
+ const s = t(n);
73
+ return e.has(s) && (n = e.get(s), e.delete(s)), n;
74
+ }
75
+ function r(e) {
76
+ return null !== e && "object" == typeof e ? e.valueOf() : e;
77
+ }
78
+ e.InternMap = InternMap, e.InternSet = InternSet, Object.defineProperty(e, "__esModule", {
79
+ value: !0
80
+ });
81
+ });
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.InternSet = exports.InternMap = void 0;
7
+ class InternMap extends Map {
8
+ constructor(entries, key = keyof) {
9
+ super();
10
+ Object.defineProperties(this, {
11
+ _intern: {
12
+ value: new Map()
13
+ },
14
+ _key: {
15
+ value: key
16
+ }
17
+ });
18
+ if (entries != null) for (const [key, value] of entries) this.set(key, value);
19
+ }
20
+ get(key) {
21
+ return super.get(intern_get(this, key));
22
+ }
23
+ has(key) {
24
+ return super.has(intern_get(this, key));
25
+ }
26
+ set(key, value) {
27
+ return super.set(intern_set(this, key), value);
28
+ }
29
+ delete(key) {
30
+ return super.delete(intern_delete(this, key));
31
+ }
32
+ }
33
+ exports.InternMap = InternMap;
34
+ class InternSet extends Set {
35
+ constructor(values, key = keyof) {
36
+ super();
37
+ Object.defineProperties(this, {
38
+ _intern: {
39
+ value: new Map()
40
+ },
41
+ _key: {
42
+ value: key
43
+ }
44
+ });
45
+ if (values != null) for (const value of values) this.add(value);
46
+ }
47
+ has(value) {
48
+ return super.has(intern_get(this, value));
49
+ }
50
+ add(value) {
51
+ return super.add(intern_set(this, value));
52
+ }
53
+ delete(value) {
54
+ return super.delete(intern_delete(this, value));
55
+ }
56
+ }
57
+ exports.InternSet = InternSet;
58
+ function intern_get({
59
+ _intern,
60
+ _key
61
+ }, value) {
62
+ const key = _key(value);
63
+ return _intern.has(key) ? _intern.get(key) : value;
64
+ }
65
+ function intern_set({
66
+ _intern,
67
+ _key
68
+ }, value) {
69
+ const key = _key(value);
70
+ if (_intern.has(key)) return _intern.get(key);
71
+ _intern.set(key, value);
72
+ return value;
73
+ }
74
+ function intern_delete({
75
+ _intern,
76
+ _key
77
+ }, value) {
78
+ const key = _key(value);
79
+ if (_intern.has(key)) {
80
+ value = _intern.get(key);
81
+ _intern.delete(key);
82
+ }
83
+ return value;
84
+ }
85
+ function keyof(value) {
86
+ return value !== null && typeof value === "object" ? value.valueOf() : value;
87
+ }