chunk-7LRVL5YB.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import {
  2. i
  3. } from "./chunk-RYY6632W.js";
  4. // node_modules/@arcgis/core/geometry/support/meshUtils/deduplicate.js
  5. function n(n2, f, i2) {
  6. var _a;
  7. const u = n2.byteLength / (4 * f), c = new Uint32Array(n2, 0, u * f);
  8. let s = new Uint32Array(u);
  9. const a = (_a = i2 == null ? void 0 : i2.minReduction) != null ? _a : 0, h = (i2 == null ? void 0 : i2.originalIndices) || null, g = h ? h.length : 0, y = (i2 == null ? void 0 : i2.componentOffsets) || null;
  10. let U = 0;
  11. if (y)
  12. for (let t = 0; t < y.length - 1; t++) {
  13. const n3 = y[t + 1] - y[t];
  14. n3 > U && (U = n3);
  15. }
  16. else
  17. U = u;
  18. const w = Math.floor(1.1 * U) + 1;
  19. (null == o || o.length < 2 * w) && (o = new Uint32Array(i(2 * w)));
  20. for (let t = 0; t < 2 * w; t++)
  21. o[t] = 0;
  22. let A = 0;
  23. const m = !!y && !!h, b = m ? g : u, d = m ? new Uint32Array(g) : null, p = 1.96;
  24. let M = 0 !== a ? Math.ceil(4 * p * p / (a * a) * a * (1 - a)) : b, q = 1, j = y ? y[1] : b;
  25. for (let t = 0; t < b; t++) {
  26. if (t === M) {
  27. const n4 = 1 - A / t;
  28. if (n4 + p * Math.sqrt(n4 * (1 - n4) / t) < a)
  29. return null;
  30. M *= 2;
  31. }
  32. if (t === j) {
  33. for (let t2 = 0; t2 < 2 * w; t2++)
  34. o[t2] = 0;
  35. if (h)
  36. for (let t2 = y[q - 1]; t2 < y[q]; t2++)
  37. d[t2] = s[h[t2]];
  38. j = y[++q];
  39. }
  40. const n3 = m ? h[t] : t, r2 = n3 * f, i3 = l(c, r2, f);
  41. let u2 = i3 % w, g2 = A;
  42. for (; 0 !== o[2 * u2 + 1]; ) {
  43. if (o[2 * u2] === i3) {
  44. const t2 = o[2 * u2 + 1] - 1;
  45. if (e(c, r2, t2 * f, f)) {
  46. g2 = s[t2];
  47. break;
  48. }
  49. }
  50. u2++, u2 >= w && (u2 -= w);
  51. }
  52. g2 === A && (o[2 * u2] = i3, o[2 * u2 + 1] = n3 + 1, A++), s[n3] = g2;
  53. }
  54. if (0 !== a && 1 - A / u < a)
  55. return null;
  56. if (m) {
  57. for (let t = y[q - 1]; t < d.length; t++)
  58. d[t] = s[h[t]];
  59. s = d;
  60. }
  61. const k = new Uint32Array(f * A);
  62. A = 0;
  63. for (let t = 0; t < b; t++)
  64. if (s[t] === A) {
  65. r(c, (m ? h[t] : t) * f, k, A * f, f), A++;
  66. }
  67. if (h && !m) {
  68. const t = new Uint32Array(g);
  69. for (let n3 = 0; n3 < t.length; n3++)
  70. t[n3] = s[h[n3]];
  71. s = t;
  72. }
  73. return { buffer: k.buffer, indices: s, uniqueCount: A };
  74. }
  75. function e(t, n2, e2, r2) {
  76. for (let l2 = 0; l2 < r2; l2++)
  77. if (t[n2 + l2] !== t[e2 + l2])
  78. return false;
  79. return true;
  80. }
  81. function r(t, n2, e2, r2, l2) {
  82. for (let o2 = 0; o2 < l2; o2++)
  83. e2[r2 + o2] = t[n2 + o2];
  84. }
  85. function l(t, n2, e2) {
  86. let r2 = 0;
  87. for (let l2 = 0; l2 < e2; l2++)
  88. r2 = t[n2 + l2] + r2 | 0, r2 = r2 + (r2 << 11) + (r2 >>> 2) | 0;
  89. return r2 >>> 0;
  90. }
  91. var o = null;
  92. export {
  93. n
  94. };
  95. //# sourceMappingURL=chunk-7LRVL5YB.js.map