chunk-B5WNDDCF.js 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import {
  2. i,
  3. r,
  4. s as s2
  5. } from "./chunk-WOXHUQGM.js";
  6. import {
  7. u as u2
  8. } from "./chunk-2H5MD622.js";
  9. import {
  10. f,
  11. l,
  12. s,
  13. u,
  14. y
  15. } from "./chunk-RMDDCMKS.js";
  16. import {
  17. c,
  18. m
  19. } from "./chunk-VCH45Q2I.js";
  20. import {
  21. R,
  22. k
  23. } from "./chunk-PQFTYGF5.js";
  24. import {
  25. t
  26. } from "./chunk-YXWMMD76.js";
  27. // node_modules/@arcgis/core/geometry/support/normalizeUtilsSync.js
  28. function a(t2) {
  29. return f2(t2, true);
  30. }
  31. function p(t2) {
  32. return f2(t2, false);
  33. }
  34. function f2(i2, n) {
  35. if (t(i2))
  36. return null;
  37. const a2 = i2.spatialReference, p2 = R(a2), f3 = "toJSON" in i2 ? i2.toJSON() : i2;
  38. if (!p2)
  39. return f3;
  40. const I2 = k(a2) ? 102100 : 4326, g2 = r[I2].maxX, v2 = r[I2].minX;
  41. if (s(f3))
  42. return y2(f3, g2, v2);
  43. if (l(f3))
  44. return f3.points = f3.points.map((t2) => y2(t2, g2, v2)), f3;
  45. if (u(f3))
  46. return d(f3, p2);
  47. if (y(f3) || f(f3)) {
  48. const t2 = c(S, f3), i3 = { xmin: t2[0], ymin: t2[1], xmax: t2[2], ymax: t2[3] }, e = i(i3.xmin, v2) * (2 * g2), h = 0 === e ? f3 : s2(f3, e);
  49. return i3.xmin += e, i3.xmax += e, i3.xmax > g2 ? P(h, g2, n) : i3.xmin < v2 ? P(h, v2, n) : h;
  50. }
  51. return f3;
  52. }
  53. function d(t2, i2) {
  54. if (!i2)
  55. return t2;
  56. const s3 = I(t2, i2).map((t3) => t3.extent);
  57. return s3.length < 2 ? s3[0] || t2 : s3.length > 2 ? (t2.xmin = i2.valid[0], t2.xmax = i2.valid[1], t2) : { rings: s3.map((t3) => [[t3.xmin, t3.ymin], [t3.xmin, t3.ymax], [t3.xmax, t3.ymax], [t3.xmax, t3.ymin], [t3.xmin, t3.ymin]]) };
  58. }
  59. function y2(t2, i2, s3) {
  60. if (Array.isArray(t2)) {
  61. const n = t2[0];
  62. if (n > i2) {
  63. const s4 = i(n, i2);
  64. t2[0] = n + s4 * (-2 * i2);
  65. } else if (n < s3) {
  66. const i3 = i(n, s3);
  67. t2[0] = n + i3 * (-2 * s3);
  68. }
  69. } else {
  70. const n = t2.x;
  71. if (n > i2) {
  72. const s4 = i(n, i2);
  73. t2.x += s4 * (-2 * i2);
  74. } else if (n < s3) {
  75. const i3 = i(n, s3);
  76. t2.x += i3 * (-2 * s3);
  77. }
  78. }
  79. return t2;
  80. }
  81. function I(t2, i2) {
  82. const s3 = [], { ymin: n, ymax: e, xmin: h, xmax: o } = t2, r2 = t2.xmax - t2.xmin, [u3, m2] = i2.valid, { x, frameId: _ } = g(t2.xmin, i2), { x: l2, frameId: c2 } = g(t2.xmax, i2), a2 = x === l2 && r2 > 0;
  83. if (r2 > 2 * m2) {
  84. const t3 = { xmin: h < o ? x : l2, ymin: n, xmax: m2, ymax: e }, i3 = { xmin: u3, ymin: n, xmax: h < o ? l2 : x, ymax: e }, r3 = { xmin: 0, ymin: n, xmax: m2, ymax: e }, a3 = { xmin: u3, ymin: n, xmax: 0, ymax: e }, p2 = [], f3 = [];
  85. v(t3, r3) && p2.push(_), v(t3, a3) && f3.push(_), v(i3, r3) && p2.push(c2), v(i3, a3) && f3.push(c2);
  86. for (let s4 = _ + 1; s4 < c2; s4++)
  87. p2.push(s4), f3.push(s4);
  88. s3.push(new C(t3, [_]), new C(i3, [c2]), new C(r3, p2), new C(a3, f3));
  89. } else
  90. x > l2 || a2 ? s3.push(new C({ xmin: x, ymin: n, xmax: m2, ymax: e }, [_]), new C({ xmin: u3, ymin: n, xmax: l2, ymax: e }, [c2])) : s3.push(new C({ xmin: x, ymin: n, xmax: l2, ymax: e }, [_]));
  91. return s3;
  92. }
  93. function g(t2, i2) {
  94. const [s3, n] = i2.valid, e = 2 * n;
  95. let h, o = 0;
  96. return t2 > n ? (h = Math.ceil(Math.abs(t2 - n) / e), t2 -= h * e, o = h) : t2 < s3 && (h = Math.ceil(Math.abs(t2 - s3) / e), t2 += h * e, o = -h), { x: t2, frameId: o };
  97. }
  98. function v(t2, i2) {
  99. const { xmin: s3, ymin: n, xmax: e, ymax: h } = i2;
  100. return O(t2, s3, n) && O(t2, s3, h) && O(t2, e, h) && O(t2, e, n);
  101. }
  102. function O(t2, i2, s3) {
  103. return i2 >= t2.xmin && i2 <= t2.xmax && s3 >= t2.ymin && s3 <= t2.ymax;
  104. }
  105. function P(t2, i2, s3 = true) {
  106. const e = !f(t2);
  107. if (e && m(t2), s3) {
  108. return new T().cut(t2, i2);
  109. }
  110. const h = e ? t2.rings : t2.paths, o = e ? 4 : 2, r2 = h.length, m2 = -2 * i2;
  111. for (let n = 0; n < r2; n++) {
  112. const t3 = h[n];
  113. if (t3 && t3.length >= o) {
  114. const i3 = [];
  115. for (const s4 of t3)
  116. i3.push([s4[0] + m2, s4[1]]);
  117. h.push(i3);
  118. }
  119. }
  120. return e ? t2.rings = h : t2.paths = h, t2;
  121. }
  122. var C = class {
  123. constructor(t2, i2) {
  124. this.extent = t2, this.frameIds = i2;
  125. }
  126. };
  127. var S = u2();
  128. var T = class {
  129. constructor() {
  130. this._linesIn = [], this._linesOut = [];
  131. }
  132. cut(t2, i2) {
  133. let s3;
  134. if (this._xCut = i2, t2.rings)
  135. this._closed = true, s3 = t2.rings, this._minPts = 4;
  136. else {
  137. if (!t2.paths)
  138. return null;
  139. this._closed = false, s3 = t2.paths, this._minPts = 2;
  140. }
  141. for (const e of s3) {
  142. if (!e || e.length < this._minPts)
  143. continue;
  144. let t3 = true;
  145. for (const i3 of e)
  146. t3 ? (this.moveTo(i3), t3 = false) : this.lineTo(i3);
  147. this._closed && this.close();
  148. }
  149. this._pushLineIn(), this._pushLineOut(), s3 = [];
  150. for (const e of this._linesIn)
  151. e && e.length >= this._minPts && s3.push(e);
  152. const n = -2 * this._xCut;
  153. for (const e of this._linesOut)
  154. if (e && e.length >= this._minPts) {
  155. for (const t3 of e)
  156. t3[0] += n;
  157. s3.push(e);
  158. }
  159. return this._closed ? t2.rings = s3 : t2.paths = s3, t2;
  160. }
  161. moveTo(t2) {
  162. this._pushLineIn(), this._pushLineOut(), this._prevSide = this._side(t2[0]), this._moveTo(t2[0], t2[1], this._prevSide), this._prevPt = t2, this._firstPt = t2;
  163. }
  164. lineTo(t2) {
  165. const i2 = this._side(t2[0]);
  166. if (i2 * this._prevSide == -1) {
  167. const s3 = this._intersect(this._prevPt, t2);
  168. this._lineTo(this._xCut, s3, 0), this._prevSide = 0, this._lineTo(t2[0], t2[1], i2);
  169. } else
  170. this._lineTo(t2[0], t2[1], i2);
  171. this._prevSide = i2, this._prevPt = t2;
  172. }
  173. close() {
  174. const t2 = this._firstPt, i2 = this._prevPt;
  175. t2[0] === i2[0] && t2[1] === i2[1] || this.lineTo(t2), this._checkClosingPt(this._lineIn), this._checkClosingPt(this._lineOut);
  176. }
  177. _moveTo(t2, i2, s3) {
  178. this._closed ? (this._lineIn.push([s3 <= 0 ? t2 : this._xCut, i2]), this._lineOut.push([s3 >= 0 ? t2 : this._xCut, i2])) : (s3 <= 0 && this._lineIn.push([t2, i2]), s3 >= 0 && this._lineOut.push([t2, i2]));
  179. }
  180. _lineTo(t2, i2, s3) {
  181. this._closed ? (this._addPolyVertex(this._lineIn, s3 <= 0 ? t2 : this._xCut, i2), this._addPolyVertex(this._lineOut, s3 >= 0 ? t2 : this._xCut, i2)) : s3 < 0 ? (0 === this._prevSide && this._pushLineOut(), this._lineIn.push([t2, i2])) : s3 > 0 ? (0 === this._prevSide && this._pushLineIn(), this._lineOut.push([t2, i2])) : this._prevSide < 0 ? (this._lineIn.push([t2, i2]), this._lineOut.push([t2, i2])) : this._prevSide > 0 && (this._lineOut.push([t2, i2]), this._lineIn.push([t2, i2]));
  182. }
  183. _addPolyVertex(t2, i2, s3) {
  184. const n = t2.length;
  185. n > 1 && t2[n - 1][0] === i2 && t2[n - 2][0] === i2 ? t2[n - 1][1] = s3 : t2.push([i2, s3]);
  186. }
  187. _checkClosingPt(t2) {
  188. const i2 = t2.length;
  189. i2 > 3 && t2[0][0] === this._xCut && t2[i2 - 2][0] === this._xCut && t2[1][0] === this._xCut && (t2[0][1] = t2[i2 - 2][1], t2.pop());
  190. }
  191. _side(t2) {
  192. return t2 < this._xCut ? -1 : t2 > this._xCut ? 1 : 0;
  193. }
  194. _intersect(t2, i2) {
  195. const s3 = (this._xCut - t2[0]) / (i2[0] - t2[0]);
  196. return t2[1] + s3 * (i2[1] - t2[1]);
  197. }
  198. _pushLineIn() {
  199. this._lineIn && this._lineIn.length >= this._minPts && this._linesIn.push(this._lineIn), this._lineIn = [];
  200. }
  201. _pushLineOut() {
  202. this._lineOut && this._lineOut.length >= this._minPts && this._linesOut.push(this._lineOut), this._lineOut = [];
  203. }
  204. };
  205. export {
  206. a,
  207. p
  208. };
  209. //# sourceMappingURL=chunk-B5WNDDCF.js.map