chunk-VEJPYAE4.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import {
  2. t
  3. } from "./chunk-FZSI6IGI.js";
  4. import {
  5. _n,
  6. ln
  7. } from "./chunk-P24XEEHY.js";
  8. import {
  9. d,
  10. g,
  11. y
  12. } from "./chunk-6T6G6LCQ.js";
  13. import {
  14. E,
  15. I,
  16. k
  17. } from "./chunk-PQFTYGF5.js";
  18. import {
  19. r
  20. } from "./chunk-YXWMMD76.js";
  21. // node_modules/@arcgis/core/layers/graphics/data/projectionSupport.js
  22. var l = [0, 0];
  23. function h(s, t2) {
  24. if (!t2)
  25. return null;
  26. if ("x" in t2) {
  27. const e = { x: 0, y: 0 };
  28. return [e.x, e.y] = s(t2.x, t2.y, l), null != t2.z && (e.z = t2.z), null != t2.m && (e.m = t2.m), e;
  29. }
  30. if ("xmin" in t2) {
  31. const e = { xmin: 0, ymin: 0, xmax: 0, ymax: 0 };
  32. return [e.xmin, e.ymin] = s(t2.xmin, t2.ymin, l), [e.xmax, e.ymax] = s(t2.xmax, t2.ymax, l), t2.hasZ && (e.zmin = t2.zmin, e.zmax = t2.zmax, e.hasZ = true), t2.hasM && (e.mmin = t2.mmin, e.mmax = t2.mmax, e.hasM = true), e;
  33. }
  34. return "rings" in t2 ? { rings: c(t2.rings, s), hasM: t2.hasM, hasZ: t2.hasZ } : "paths" in t2 ? { paths: c(t2.paths, s), hasM: t2.hasM, hasZ: t2.hasZ } : "points" in t2 ? { points: p(t2.points, s), hasM: t2.hasM, hasZ: t2.hasZ } : null;
  35. }
  36. function c(s, t2) {
  37. const e = [];
  38. for (const n of s)
  39. e.push(p(n, t2));
  40. return e;
  41. }
  42. function p(s, t2) {
  43. const e = [];
  44. for (const n of s) {
  45. const s2 = t2(n[0], n[1], [0, 0]);
  46. e.push(s2), n.length > 2 && s2.push(n[2]), n.length > 3 && s2.push(n[3]);
  47. }
  48. return e;
  49. }
  50. async function f(e, n) {
  51. if (!e || !n)
  52. return;
  53. const r2 = Array.isArray(e) ? e.map((t2) => r(t2.geometry) ? t2.geometry.spatialReference : null).filter(r) : [e];
  54. await _n(r2.map((s) => ({ source: s, dest: n })));
  55. }
  56. var x = h.bind(null, y);
  57. var y2 = h.bind(null, d);
  58. function g2(s, t2, a, m) {
  59. if (!s)
  60. return s;
  61. if (a || (a = t2, t2 = s.spatialReference), !I(t2) || !I(a) || E(t2, a))
  62. return s;
  63. if (g(t2, a)) {
  64. const t3 = k(a) ? x(s) : y2(s);
  65. return t3.spatialReference = a, t3;
  66. }
  67. return ln(t, [s], t2, a, null, m)[0];
  68. }
  69. var _ = class {
  70. constructor() {
  71. this._jobs = [], this._timer = null, this._process = this._process.bind(this);
  72. }
  73. async push(s, t2, e) {
  74. if (!s || !s.length || !t2 || !e || E(t2, e))
  75. return s;
  76. const n = { geometries: s, inSpatialReference: t2, outSpatialReference: e, resolve: null };
  77. return this._jobs.push(n), new Promise((s2) => {
  78. n.resolve = s2, null === this._timer && (this._timer = setTimeout(this._process, 10));
  79. });
  80. }
  81. _process() {
  82. this._timer = null;
  83. const s = this._jobs.shift();
  84. if (!s)
  85. return;
  86. const { geometries: t2, inSpatialReference: r2, outSpatialReference: i, resolve: a } = s;
  87. g(r2, i) ? k(i) ? a(t2.map(x)) : a(t2.map(y2)) : a(ln(t, t2, r2, i, null, null)), this._jobs.length > 0 && (this._timer = setTimeout(this._process, 10));
  88. }
  89. };
  90. var j = new _();
  91. function M(s, t2, e) {
  92. return j.push(s, t2, e);
  93. }
  94. export {
  95. f,
  96. g2 as g,
  97. M
  98. };
  99. //# sourceMappingURL=chunk-VEJPYAE4.js.map