chunk-USORKAIZ.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. import {
  2. m,
  3. p
  4. } from "./chunk-EOSZHC5H.js";
  5. import {
  6. a
  7. } from "./chunk-C43UE3Z5.js";
  8. import {
  9. s
  10. } from "./chunk-PDKDCAAD.js";
  11. import {
  12. d,
  13. e,
  14. l3 as l,
  15. n2 as n
  16. } from "./chunk-Y3WMVFTW.js";
  17. // node_modules/@arcgis/core/rest/support/ClassificationDefinition.js
  18. var c = new s({ classBreaksDef: "class-breaks-definition", uniqueValueDef: "unique-value-definition" });
  19. var l2 = class extends l {
  20. constructor() {
  21. super(...arguments), this.baseSymbol = null, this.colorRamp = null, this.type = null;
  22. }
  23. };
  24. e([d({ type: a, json: { write: true } })], l2.prototype, "baseSymbol", void 0), e([d({ types: m, json: { read: { reader: p }, write: true } })], l2.prototype, "colorRamp", void 0), e([d({ json: { read: c.read, write: c.write } })], l2.prototype, "type", void 0), l2 = e([n("esri.rest.support.ClassificationDefinition")], l2);
  25. var m2 = l2;
  26. // node_modules/@arcgis/core/rest/support/ClassBreaksDefinition.js
  27. var o = new s({ esriClassifyEqualInterval: "equal-interval", esriClassifyManual: "manual", esriClassifyNaturalBreaks: "natural-breaks", esriClassifyQuantile: "quantile", esriClassifyStandardDeviation: "standard-deviation", esriClassifyDefinedInterval: "defined-interval" });
  28. var a2 = new s({ esriNormalizeByLog: "log", esriNormalizeByPercentOfTotal: "percent-of-total", esriNormalizeByField: "field" });
  29. var n2 = class extends m2 {
  30. constructor() {
  31. super(...arguments), this.breakCount = null, this.classificationField = null, this.classificationMethod = null, this.normalizationField = null, this.normalizationType = null, this.type = "class-breaks-definition";
  32. }
  33. set standardDeviationInterval(e3) {
  34. this.classificationMethod === "standard-deviation" && this._set("standardDeviationInterval", e3);
  35. }
  36. set definedInterval(e3) {
  37. this.classificationMethod === "defined-interval" && this._set("definedInterval", e3);
  38. }
  39. };
  40. e([d({ json: { write: true } })], n2.prototype, "breakCount", void 0), e([d({ json: { write: true } })], n2.prototype, "classificationField", void 0), e([d({ type: String, json: { read: o.read, write: o.write } })], n2.prototype, "classificationMethod", void 0), e([d({ json: { write: true } })], n2.prototype, "normalizationField", void 0), e([d({ json: { read: a2.read, write: a2.write } })], n2.prototype, "normalizationType", void 0), e([d({ value: null, json: { write: true } })], n2.prototype, "standardDeviationInterval", null), e([d({ value: null, json: { write: true } })], n2.prototype, "definedInterval", null), e([d()], n2.prototype, "type", void 0), n2 = e([n("esri.rest.support.ClassBreaksDefinition")], n2);
  41. var l3 = n2;
  42. // node_modules/@arcgis/core/rest/support/generateRendererUtils.js
  43. function e2(e3, l4) {
  44. return Number(e3.toFixed(l4));
  45. }
  46. function t(e3) {
  47. const { normalizationTotal: l4 } = e3;
  48. return { classBreaks: n3(e3), normalizationTotal: l4 };
  49. }
  50. function n3(l4) {
  51. const t2 = l4.definition, { classificationMethod: n4, breakCount: o3, normalizationType: r2, definedInterval: h2 } = t2, m3 = [];
  52. let b = l4.values;
  53. if (b.length === 0)
  54. return [];
  55. b = b.sort((e3, l5) => e3 - l5);
  56. const V = b[0], p2 = b[b.length - 1];
  57. if (n4 === "equal-interval")
  58. if (b.length >= o3) {
  59. const l5 = (p2 - V) / o3;
  60. let t3 = V;
  61. for (let n5 = 1; n5 < o3; n5++) {
  62. const u2 = e2(V + n5 * l5, 6);
  63. m3.push({ minValue: t3, maxValue: u2, label: a3(t3, u2, r2) }), t3 = u2;
  64. }
  65. m3.push({ minValue: t3, maxValue: p2, label: a3(t3, p2, r2) });
  66. } else
  67. b.forEach((e3) => {
  68. m3.push({ minValue: e3, maxValue: e3, label: a3(e3, e3, r2) });
  69. });
  70. else if (n4 === "natural-breaks") {
  71. const t3 = u(b), n5 = l4.valueFrequency || t3.valueFrequency, i2 = s2(t3.uniqueValues, n5, o3);
  72. let c3 = V;
  73. for (let l5 = 1; l5 < o3; l5++)
  74. if (t3.uniqueValues.length > l5) {
  75. const n6 = e2(t3.uniqueValues[i2[l5]], 6);
  76. m3.push({ minValue: c3, maxValue: n6, label: a3(c3, n6, r2) }), c3 = n6;
  77. }
  78. m3.push({ minValue: c3, maxValue: p2, label: a3(c3, p2, r2) });
  79. } else if (n4 === "quantile")
  80. if (b.length >= o3 && V !== p2) {
  81. let e3 = V, l5 = Math.ceil(b.length / o3), t3 = 0;
  82. for (let n5 = 1; n5 < o3; n5++) {
  83. let u2 = l5 + t3 - 1;
  84. u2 > b.length && (u2 = b.length - 1), u2 < 0 && (u2 = 0), m3.push({ minValue: e3, maxValue: b[u2], label: a3(e3, b[u2], r2) }), e3 = b[u2], t3 += l5, l5 = Math.ceil((b.length - t3) / (o3 - n5));
  85. }
  86. m3.push({ minValue: e3, maxValue: p2, label: a3(e3, p2, r2) });
  87. } else {
  88. let e3 = -1;
  89. for (let l5 = 0; l5 < b.length; l5++) {
  90. const t3 = b[l5];
  91. t3 !== e3 && (e3 = t3, m3.push({ minValue: e3, maxValue: t3, label: a3(e3, t3, r2) }), e3 = t3);
  92. }
  93. }
  94. else if (n4 === "standard-deviation") {
  95. const l5 = c2(b), t3 = f(b, l5);
  96. if (t3 === 0)
  97. m3.push({ minValue: b[0], maxValue: b[0], label: a3(b[0], b[0], r2) });
  98. else {
  99. const n5 = i(V, p2, o3, l5, t3) * t3;
  100. let u2 = 0, s3 = V;
  101. for (let t4 = o3; t4 >= 1; t4--) {
  102. const o4 = e2(l5 - (t4 - 0.5) * n5, 6);
  103. m3.push({ minValue: s3, maxValue: o4, label: a3(s3, o4, r2) }), s3 = o4, u2++;
  104. }
  105. let c3 = e2(l5 + 0.5 * n5, 6);
  106. m3.push({ minValue: s3, maxValue: c3, label: a3(s3, c3, r2) }), s3 = c3, u2++;
  107. for (let t4 = 1; t4 <= o3; t4++)
  108. c3 = u2 === 2 * o3 ? p2 : e2(l5 + (t4 + 0.5) * n5, 6), m3.push({ minValue: s3, maxValue: c3, label: a3(s3, c3, r2) }), s3 = c3, u2++;
  109. }
  110. } else if (n4 === "defined-interval") {
  111. if (!h2)
  112. return m3;
  113. const l5 = b[0], t3 = b[b.length - 1], n5 = Math.ceil((t3 - l5) / h2);
  114. let u2 = l5;
  115. for (let s3 = 1; s3 < n5; s3++) {
  116. const t4 = e2(l5 + s3 * h2, 6);
  117. m3.push({ minValue: u2, maxValue: t4, label: a3(u2, t4, r2) }), u2 = t4;
  118. }
  119. m3.push({ minValue: u2, maxValue: t3, label: a3(u2, t3, r2) });
  120. }
  121. return m3;
  122. }
  123. function a3(e3, l4, t2) {
  124. let n4 = null;
  125. return n4 = e3 === l4 ? t2 && t2 === "percent-of-total" ? e3 + "%" : e3.toString() : t2 && t2 === "percent-of-total" ? e3 + "% - " + l4 + "%" : e3 + " - " + l4, n4;
  126. }
  127. function u(e3) {
  128. const l4 = [], t2 = [];
  129. let n4 = Number.MIN_VALUE, a4 = 1, u2 = -1;
  130. for (let s3 = 0; s3 < e3.length; s3++) {
  131. const o3 = e3[s3];
  132. o3 === n4 ? (a4++, t2[u2] = a4) : o3 !== null && (l4.push(o3), n4 = o3, a4 = 1, t2.push(a4), u2++);
  133. }
  134. return { uniqueValues: l4, valueFrequency: t2 };
  135. }
  136. function s2(e3, l4, t2) {
  137. const n4 = e3.length, a4 = [];
  138. t2 > n4 && (t2 = n4);
  139. for (let s3 = 0; s3 < t2; s3++)
  140. a4.push(Math.round(s3 * n4 / t2 - 1));
  141. a4.push(n4 - 1);
  142. let u2 = o2(a4, e3, l4, t2);
  143. return r(u2.mean, u2.sdcm, a4, e3, l4, t2) && (u2 = o2(a4, e3, l4, t2)), a4;
  144. }
  145. function o2(e3, l4, t2, n4) {
  146. let a4 = [], u2 = [], s3 = [], o3 = 0;
  147. const r2 = [], i2 = [];
  148. for (let b = 0; b < n4; b++) {
  149. const n5 = h(b, e3, l4, t2);
  150. r2.push(n5.sbMean), i2.push(n5.sbSdcm), o3 += i2[b];
  151. }
  152. let c3, f2 = o3, m3 = true;
  153. for (; m3 || o3 < f2; ) {
  154. m3 = false, a4 = [];
  155. for (let l5 = 0; l5 < n4; l5++)
  156. a4.push(e3[l5]);
  157. for (let t3 = 0; t3 < n4; t3++)
  158. for (let a5 = e3[t3] + 1; a5 <= e3[t3 + 1]; a5++)
  159. if (c3 = l4[a5], t3 > 0 && a5 !== e3[t3 + 1] && Math.abs(c3 - r2[t3]) > Math.abs(c3 - r2[t3 - 1]))
  160. e3[t3] = a5;
  161. else if (t3 < n4 - 1 && e3[t3] !== a5 - 1 && Math.abs(c3 - r2[t3]) > Math.abs(c3 - r2[t3 + 1])) {
  162. e3[t3 + 1] = a5 - 1;
  163. break;
  164. }
  165. f2 = o3, o3 = 0, u2 = [], s3 = [];
  166. for (let a5 = 0; a5 < n4; a5++) {
  167. u2.push(r2[a5]), s3.push(i2[a5]);
  168. const n5 = h(a5, e3, l4, t2);
  169. r2[a5] = n5.sbMean, i2[a5] = n5.sbSdcm, o3 += i2[a5];
  170. }
  171. }
  172. if (o3 > f2) {
  173. for (let l5 = 0; l5 < n4; l5++)
  174. e3[l5] = a4[l5], r2[l5] = u2[l5], i2[l5] = s3[l5];
  175. o3 = f2;
  176. }
  177. return { mean: r2, sdcm: i2 };
  178. }
  179. function r(e3, l4, t2, n4, a4, u2) {
  180. let s3 = 0, o3 = 0, r2 = 0, i2 = 0, c3 = true;
  181. for (let f2 = 0; f2 < 2 && c3; f2++) {
  182. f2 === 0 && (c3 = false);
  183. for (let f3 = 0; f3 < u2 - 1; f3++)
  184. for (; t2[f3 + 1] + 1 !== t2[f3 + 2]; ) {
  185. t2[f3 + 1] = t2[f3 + 1] + 1;
  186. const u3 = h(f3, t2, n4, a4);
  187. r2 = u3.sbMean, s3 = u3.sbSdcm;
  188. const m3 = h(f3 + 1, t2, n4, a4);
  189. if (i2 = m3.sbMean, o3 = m3.sbSdcm, !(s3 + o3 < l4[f3] + l4[f3 + 1])) {
  190. t2[f3 + 1] = t2[f3 + 1] - 1;
  191. break;
  192. }
  193. l4[f3] = s3, l4[f3 + 1] = o3, e3[f3] = r2, e3[f3 + 1] = i2, c3 = true;
  194. }
  195. for (let f3 = u2 - 1; f3 > 0; f3--)
  196. for (; t2[f3] !== t2[f3 - 1] + 1; ) {
  197. t2[f3] = t2[f3] - 1;
  198. const u3 = h(f3 - 1, t2, n4, a4);
  199. r2 = u3.sbMean, s3 = u3.sbSdcm;
  200. const m3 = h(f3, t2, n4, a4);
  201. if (i2 = m3.sbMean, o3 = m3.sbSdcm, !(s3 + o3 < l4[f3 - 1] + l4[f3])) {
  202. t2[f3] = t2[f3] + 1;
  203. break;
  204. }
  205. l4[f3 - 1] = s3, l4[f3] = o3, e3[f3 - 1] = r2, e3[f3] = i2, c3 = true;
  206. }
  207. }
  208. return c3;
  209. }
  210. function i(e3, l4, t2, n4, a4) {
  211. let u2 = Math.max(n4 - e3, l4 - n4) / a4 / t2;
  212. return u2 = u2 >= 1 ? 1 : u2 >= 0.5 ? 0.5 : 0.25, u2;
  213. }
  214. function c2(e3) {
  215. let l4 = 0;
  216. for (let t2 = 0; t2 < e3.length; t2++)
  217. l4 += e3[t2];
  218. return l4 /= e3.length, l4;
  219. }
  220. function f(e3, l4) {
  221. let t2 = 0;
  222. for (let n4 = 0; n4 < e3.length; n4++) {
  223. const a4 = e3[n4];
  224. t2 += (a4 - l4) * (a4 - l4);
  225. }
  226. t2 /= e3.length;
  227. return Math.sqrt(t2);
  228. }
  229. function h(e3, l4, t2, n4) {
  230. let a4 = 0, u2 = 0;
  231. for (let r2 = l4[e3] + 1; r2 <= l4[e3 + 1]; r2++) {
  232. const e4 = n4[r2];
  233. a4 += t2[r2] * e4, u2 += e4;
  234. }
  235. u2 <= 0 && console.log("Exception in Natural Breaks calculation");
  236. const s3 = a4 / u2;
  237. let o3 = 0;
  238. for (let r2 = l4[e3] + 1; r2 <= l4[e3 + 1]; r2++)
  239. o3 += n4[r2] * (t2[r2] - s3) ** 2;
  240. return { sbMean: s3, sbSdcm: o3 };
  241. }
  242. export {
  243. l3 as l,
  244. t
  245. };
  246. //# sourceMappingURL=chunk-USORKAIZ.js.map