statsWorker-Z3SQUZHX.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import {
  2. D,
  3. T,
  4. V,
  5. c,
  6. g,
  7. h,
  8. m,
  9. s,
  10. y as y2,
  11. z
  12. } from "./chunk-D5GG5NVO.js";
  13. import "./chunk-USORKAIZ.js";
  14. import {
  15. O
  16. } from "./chunk-Q34L5KZA.js";
  17. import {
  18. d,
  19. y
  20. } from "./chunk-XLV7RUSE.js";
  21. import "./chunk-NTUXR253.js";
  22. import "./chunk-EOSZHC5H.js";
  23. import "./chunk-C43UE3Z5.js";
  24. import "./chunk-7XXXCK2A.js";
  25. import "./chunk-7ZIDBK7B.js";
  26. import "./chunk-WZQZRKNH.js";
  27. import {
  28. a
  29. } from "./chunk-LRDX4TO7.js";
  30. import {
  31. u
  32. } from "./chunk-WEMIK25H.js";
  33. import "./chunk-JXW4QTJA.js";
  34. import "./chunk-UXF37FQ4.js";
  35. import "./chunk-ZOEK6QHJ.js";
  36. import "./chunk-XNLG7T2T.js";
  37. import "./chunk-IR4PV7VK.js";
  38. import "./chunk-2Z6LERTI.js";
  39. import "./chunk-OWVBLVP3.js";
  40. import "./chunk-PDKDCAAD.js";
  41. import {
  42. j2 as j
  43. } from "./chunk-ECW2QABR.js";
  44. import "./chunk-GCDJLKH4.js";
  45. import {
  46. R,
  47. k2 as k,
  48. p
  49. } from "./chunk-MRJEICT6.js";
  50. import "./chunk-Y3WMVFTW.js";
  51. import "./chunk-SAS7RONY.js";
  52. import "./chunk-WSRBH7BF.js";
  53. import "./chunk-IHXECKQQ.js";
  54. import "./chunk-ULGDPLM2.js";
  55. import "./chunk-EMJ4ZSM2.js";
  56. import "./chunk-IKP3YN53.js";
  57. import {
  58. e
  59. } from "./chunk-GZT4BVFP.js";
  60. import "./chunk-A5ICIBVI.js";
  61. // node_modules/@arcgis/core/smartMapping/statistics/support/utils.js
  62. var h2 = null;
  63. function y3(e2, t, n) {
  64. return e2.x < 0 ? e2.x += t : e2.x > n && (e2.x -= t), e2;
  65. }
  66. function I(e2, n, r2, o) {
  67. const u2 = p(r2) ? R(r2) : null, a2 = u2 ? Math.round((u2.valid[1] - u2.valid[0]) / n.scale[0]) : null;
  68. return e2.map((e3) => {
  69. const r3 = new j(e(e3.geometry));
  70. return O(n, r3, r3, r3.hasZ, r3.hasM), e3.geometry = u2 ? y3(r3, a2, o[0]) : r3, e3;
  71. });
  72. }
  73. function $(e2, t = 18, n, o, i, s3) {
  74. const l = new Float64Array(i * s3);
  75. t = Math.round(u(t));
  76. let u2 = Number.POSITIVE_INFINITY, a2 = Number.NEGATIVE_INFINITY, m2 = 0, d3 = 0, p3 = 0, h3 = 0;
  77. const y4 = d(o, n);
  78. for (const { geometry: r2, attributes: c3 } of e2) {
  79. const { x: e3, y: n2 } = r2, o2 = Math.max(0, e3 - t), I3 = Math.max(0, n2 - t), $2 = Math.min(s3, n2 + t), g3 = Math.min(i, e3 + t), j2 = +y4(c3);
  80. for (let r3 = I3; r3 < $2; r3++)
  81. for (let s4 = o2; s4 < g3; s4++) {
  82. const o3 = r3 * i + s4, c4 = y(s4 - e3, r3 - n2, t), y5 = l[o3];
  83. m2 = l[o3] += c4 * j2;
  84. const I4 = m2 - y5;
  85. d3 += I4, p3 += I4 * I4, m2 < u2 && (u2 = m2), m2 > a2 && (a2 = m2), h3++;
  86. }
  87. }
  88. if (!h3)
  89. return { mean: 0, stddev: 0, min: 0, max: 0, mid: 0, count: 0 };
  90. const I2 = (a2 - u2) / 2;
  91. return { mean: d3 / h3, stdDev: Math.sqrt((p3 - d3 * d3 / h3) / h3), min: u2, max: a2, mid: I2, count: h3 };
  92. }
  93. async function g2(e2, t) {
  94. if (!t)
  95. return [];
  96. const n = e2.field, r2 = e2.valueExpression, i = e2.normalizationType, s3 = e2.normalizationField, l = e2.normalizationTotal, u2 = [], a2 = e2.viewInfoParams;
  97. let f = null, c3 = null;
  98. if (r2) {
  99. if (!h2) {
  100. const { arcadeUtils: e3 } = await a();
  101. h2 = e3;
  102. }
  103. f = h2.createFunction(r2), c3 = a2 && h2.getViewInfo({ viewingMode: a2.viewingMode, scale: a2.scale, spatialReference: new k(a2.spatialReference) });
  104. }
  105. const p3 = e2.fieldInfos, y4 = !(t[0] && "declaredClass" in t[0] && t[0].declaredClass === "esri.Graphic") && p3 ? { fields: p3 } : null;
  106. return t.forEach((e3) => {
  107. const t2 = e3.attributes;
  108. let o;
  109. if (r2) {
  110. const t3 = y4 ? { ...e3, layer: y4 } : e3, n2 = h2.createExecContext(t3, c3);
  111. o = h2.executeFunction(f, n2);
  112. } else
  113. t2 && (o = t2[n]);
  114. if (i && isFinite(o)) {
  115. const e4 = t2 && parseFloat(t2[s3]);
  116. o = T(o, i, e4, l);
  117. }
  118. u2.push(o);
  119. }), u2;
  120. }
  121. // node_modules/@arcgis/core/smartMapping/statistics/support/statsWorker.js
  122. async function d2(i) {
  123. const { attribute: e2, features: s3 } = i, { normalizationType: r2, normalizationField: m2, minValue: u2, maxValue: f, fieldType: d3 } = e2, p3 = await g2({ field: e2.field, valueExpression: e2.valueExpression, normalizationType: r2, normalizationField: m2, normalizationTotal: e2.normalizationTotal, viewInfoParams: e2.viewInfoParams, fieldInfos: e2.fieldInfos }, s3), v2 = s({ normalizationType: r2, normalizationField: m2, minValue: u2, maxValue: f }), c3 = { value: 0.5, fieldType: d3 }, z3 = d3 === "esriFieldTypeString" ? m({ values: p3, supportsNullCount: v2, percentileParams: c3 }) : c({ values: p3, minValue: u2, maxValue: f, useSampleStdDev: !r2, supportsNullCount: v2, percentileParams: c3 });
  124. return V(z3, d3 === "esriFieldTypeDate");
  125. }
  126. async function p2(i) {
  127. const { attribute: e2, features: n } = i, o = await g2({ field: e2.field, valueExpression: e2.valueExpression, viewInfoParams: e2.viewInfoParams, fieldInfos: e2.fieldInfos }, n), t = g(o);
  128. return h(t, e2.domain, e2.returnAllCodedValues);
  129. }
  130. async function v(i) {
  131. const { attribute: e2, features: n } = i, { field: o, normalizationType: t, normalizationField: l, normalizationTotal: s3, classificationMethod: r2 } = e2, f = await g2({ field: o, valueExpression: e2.valueExpression, normalizationType: t, normalizationField: l, normalizationTotal: s3, viewInfoParams: e2.viewInfoParams, fieldInfos: e2.fieldInfos }, n), d3 = y2(f, { field: o, normalizationType: t, normalizationField: l, normalizationTotal: s3, classificationMethod: r2, standardDeviationInterval: e2.standardDeviationInterval, numClasses: e2.numClasses, minValue: e2.minValue, maxValue: e2.maxValue });
  132. return D(d3, r2);
  133. }
  134. async function c2(i) {
  135. const { attribute: e2, features: n } = i, { field: o, normalizationType: t, normalizationField: l, normalizationTotal: s3, classificationMethod: r2 } = e2, m2 = await g2({ field: o, valueExpression: e2.valueExpression, normalizationType: t, normalizationField: l, normalizationTotal: s3, viewInfoParams: e2.viewInfoParams, fieldInfos: e2.fieldInfos }, n);
  136. return z(m2, { field: o, normalizationType: t, normalizationField: l, normalizationTotal: s3, classificationMethod: r2, standardDeviationInterval: e2.standardDeviationInterval, numBins: e2.numBins, minValue: e2.minValue, maxValue: e2.maxValue });
  137. }
  138. async function z2(a2) {
  139. const { attribute: n, features: o } = a2, { field: t, radius: l, fieldOffset: s3, transform: r2, spatialReference: m2, size: u2 } = n, f = I(o, r2, m2, u2), { count: d3, min: p3, max: v2, mean: c3, stdDev: z3 } = $(f, l, s3, t, u2[0], u2[1]);
  140. return { count: d3, min: p3, max: v2, avg: c3, stddev: z3 };
  141. }
  142. export {
  143. v as classBreaks,
  144. z2 as heatmapStatistics,
  145. c2 as histogram,
  146. d2 as summaryStatistics,
  147. p2 as uniqueValues
  148. };
  149. //# sourceMappingURL=statsWorker-Z3SQUZHX.js.map