123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- import {
- a
- } from "./chunk-QOV6ITMI.js";
- // node_modules/@arcgis/core/chunks/rbush.js
- function i(t, n2) {
- if (!(this instanceof i))
- return new i(t, n2);
- this._maxEntries = Math.max(4, t || 9), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), n2 && (typeof n2 == "function" ? this.toBBox = n2 : this._initFormat(n2)), this.clear();
- }
- function n(t, i2, n2) {
- if (!n2)
- return i2.indexOf(t);
- for (var h2 = 0; h2 < i2.length; h2++)
- if (n2(t, i2[h2]))
- return h2;
- return -1;
- }
- function h(t, i2) {
- a2(t, 0, t.children.length, i2, t);
- }
- function a2(t, i2, n2, h2, a3) {
- a3 || (a3 = x(null)), a3.minX = 1 / 0, a3.minY = 1 / 0, a3.maxX = -1 / 0, a3.maxY = -1 / 0;
- for (var e2, o2 = i2; o2 < n2; o2++)
- e2 = t.children[o2], r(a3, t.leaf ? h2(e2) : e2);
- return a3;
- }
- function r(t, i2) {
- return t.minX = Math.min(t.minX, i2.minX), t.minY = Math.min(t.minY, i2.minY), t.maxX = Math.max(t.maxX, i2.maxX), t.maxY = Math.max(t.maxY, i2.maxY), t;
- }
- function e(t, i2) {
- return t.minX - i2.minX;
- }
- function o(t, i2) {
- return t.minY - i2.minY;
- }
- function s(t) {
- return (t.maxX - t.minX) * (t.maxY - t.minY);
- }
- function l(t) {
- return t.maxX - t.minX + (t.maxY - t.minY);
- }
- function m(t, i2) {
- return (Math.max(i2.maxX, t.maxX) - Math.min(i2.minX, t.minX)) * (Math.max(i2.maxY, t.maxY) - Math.min(i2.minY, t.minY));
- }
- function c(t, i2) {
- var n2 = Math.max(t.minX, i2.minX), h2 = Math.max(t.minY, i2.minY), a3 = Math.min(t.maxX, i2.maxX), r2 = Math.min(t.maxY, i2.maxY);
- return Math.max(0, a3 - n2) * Math.max(0, r2 - h2);
- }
- function u(t, i2) {
- return t.minX <= i2.minX && t.minY <= i2.minY && i2.maxX <= t.maxX && i2.maxY <= t.maxY;
- }
- function f(t, i2) {
- return i2.minX <= t.maxX && i2.minY <= t.maxY && i2.maxX >= t.minX && i2.maxY >= t.minY;
- }
- function x(t) {
- return { children: t, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
- }
- function d(i2, n2, h2, a3, r2) {
- for (var e2, o2 = [n2, h2]; o2.length; )
- (h2 = o2.pop()) - (n2 = o2.pop()) <= a3 || (e2 = n2 + Math.ceil((h2 - n2) / a3 / 2) * a3, a(i2, e2, n2, h2, r2), o2.push(n2, e2, e2, h2));
- }
- i.prototype = { all: function() {
- return this._all(this.data, []);
- }, search: function(t) {
- var i2 = this.data, n2 = [], h2 = this.toBBox;
- if (!f(t, i2))
- return n2;
- for (var a3, r2, e2, o2, s2 = []; i2; ) {
- for (a3 = 0, r2 = i2.children.length; a3 < r2; a3++)
- e2 = i2.children[a3], f(t, o2 = i2.leaf ? h2(e2) : e2) && (i2.leaf ? n2.push(e2) : u(t, o2) ? this._all(e2, n2) : s2.push(e2));
- i2 = s2.pop();
- }
- return n2;
- }, collides: function(t) {
- var i2 = this.data, n2 = this.toBBox;
- if (!f(t, i2))
- return false;
- for (var h2, a3, r2, e2, o2 = []; i2; ) {
- for (h2 = 0, a3 = i2.children.length; h2 < a3; h2++)
- if (r2 = i2.children[h2], f(t, e2 = i2.leaf ? n2(r2) : r2)) {
- if (i2.leaf || u(t, e2))
- return true;
- o2.push(r2);
- }
- i2 = o2.pop();
- }
- return false;
- }, load: function(t) {
- if (!t || !t.length)
- return this;
- if (t.length < this._minEntries) {
- for (var i2 = 0, n2 = t.length; i2 < n2; i2++)
- this.insert(t[i2]);
- return this;
- }
- var h2 = this._build(t.slice(), 0, t.length - 1, 0);
- if (this.data.children.length)
- if (this.data.height === h2.height)
- this._splitRoot(this.data, h2);
- else {
- if (this.data.height < h2.height) {
- var a3 = this.data;
- this.data = h2, h2 = a3;
- }
- this._insert(h2, this.data.height - h2.height - 1, true);
- }
- else
- this.data = h2;
- return this;
- }, insert: function(t) {
- return t && this._insert(t, this.data.height - 1), this;
- }, clear: function() {
- return this.data = x([]), this;
- }, remove: function(t, i2) {
- if (!t)
- return this;
- for (var h2, a3, r2, e2, o2 = this.data, s2 = this.toBBox(t), l2 = [], m2 = []; o2 || l2.length; ) {
- if (o2 || (o2 = l2.pop(), a3 = l2[l2.length - 1], h2 = m2.pop(), e2 = true), o2.leaf && (r2 = n(t, o2.children, i2)) !== -1)
- return o2.children.splice(r2, 1), l2.push(o2), this._condense(l2), this;
- e2 || o2.leaf || !u(o2, s2) ? a3 ? (h2++, o2 = a3.children[h2], e2 = false) : o2 = null : (l2.push(o2), m2.push(h2), h2 = 0, a3 = o2, o2 = o2.children[0]);
- }
- return this;
- }, toBBox: function(t) {
- return t;
- }, compareMinX: e, compareMinY: o, toJSON: function() {
- return this.data;
- }, fromJSON: function(t) {
- return this.data = t, this;
- }, _all: function(t, i2) {
- for (var n2 = []; t; )
- t.leaf ? i2.push.apply(i2, t.children) : n2.push.apply(n2, t.children), t = n2.pop();
- return i2;
- }, _build: function(t, i2, n2, a3) {
- var r2, e2 = n2 - i2 + 1, o2 = this._maxEntries;
- if (e2 <= o2)
- return h(r2 = x(t.slice(i2, n2 + 1)), this.toBBox), r2;
- a3 || (a3 = Math.ceil(Math.log(e2) / Math.log(o2)), o2 = Math.ceil(e2 / Math.pow(o2, a3 - 1))), (r2 = x([])).leaf = false, r2.height = a3;
- var s2, l2, m2, c2, u2 = Math.ceil(e2 / o2), f2 = u2 * Math.ceil(Math.sqrt(o2));
- for (d(t, i2, n2, f2, this.compareMinX), s2 = i2; s2 <= n2; s2 += f2)
- for (d(t, s2, m2 = Math.min(s2 + f2 - 1, n2), u2, this.compareMinY), l2 = s2; l2 <= m2; l2 += u2)
- c2 = Math.min(l2 + u2 - 1, m2), r2.children.push(this._build(t, l2, c2, a3 - 1));
- return h(r2, this.toBBox), r2;
- }, _chooseSubtree: function(t, i2, n2, h2) {
- for (var a3, r2, e2, o2, l2, c2, u2, f2; h2.push(i2), !i2.leaf && h2.length - 1 !== n2; ) {
- for (u2 = f2 = 1 / 0, a3 = 0, r2 = i2.children.length; a3 < r2; a3++)
- l2 = s(e2 = i2.children[a3]), (c2 = m(t, e2) - l2) < f2 ? (f2 = c2, u2 = l2 < u2 ? l2 : u2, o2 = e2) : c2 === f2 && l2 < u2 && (u2 = l2, o2 = e2);
- i2 = o2 || i2.children[0];
- }
- return i2;
- }, _insert: function(t, i2, n2) {
- var h2 = this.toBBox, a3 = n2 ? t : h2(t), e2 = [], o2 = this._chooseSubtree(a3, this.data, i2, e2);
- for (o2.children.push(t), r(o2, a3); i2 >= 0 && e2[i2].children.length > this._maxEntries; )
- this._split(e2, i2), i2--;
- this._adjustParentBBoxes(a3, e2, i2);
- }, _split: function(t, i2) {
- var n2 = t[i2], a3 = n2.children.length, r2 = this._minEntries;
- this._chooseSplitAxis(n2, r2, a3);
- var e2 = this._chooseSplitIndex(n2, r2, a3), o2 = x(n2.children.splice(e2, n2.children.length - e2));
- o2.height = n2.height, o2.leaf = n2.leaf, h(n2, this.toBBox), h(o2, this.toBBox), i2 ? t[i2 - 1].children.push(o2) : this._splitRoot(n2, o2);
- }, _splitRoot: function(t, i2) {
- this.data = x([t, i2]), this.data.height = t.height + 1, this.data.leaf = false, h(this.data, this.toBBox);
- }, _chooseSplitIndex: function(t, i2, n2) {
- var h2, r2, e2, o2, l2, m2, u2, f2;
- for (m2 = u2 = 1 / 0, h2 = i2; h2 <= n2 - i2; h2++)
- o2 = c(r2 = a2(t, 0, h2, this.toBBox), e2 = a2(t, h2, n2, this.toBBox)), l2 = s(r2) + s(e2), o2 < m2 ? (m2 = o2, f2 = h2, u2 = l2 < u2 ? l2 : u2) : o2 === m2 && l2 < u2 && (u2 = l2, f2 = h2);
- return f2;
- }, _chooseSplitAxis: function(t, i2, n2) {
- var h2 = t.leaf ? this.compareMinX : e, a3 = t.leaf ? this.compareMinY : o;
- this._allDistMargin(t, i2, n2, h2) < this._allDistMargin(t, i2, n2, a3) && t.children.sort(h2);
- }, _allDistMargin: function(t, i2, n2, h2) {
- t.children.sort(h2);
- var e2, o2, s2 = this.toBBox, m2 = a2(t, 0, i2, s2), c2 = a2(t, n2 - i2, n2, s2), u2 = l(m2) + l(c2);
- for (e2 = i2; e2 < n2 - i2; e2++)
- o2 = t.children[e2], r(m2, t.leaf ? s2(o2) : o2), u2 += l(m2);
- for (e2 = n2 - i2 - 1; e2 >= i2; e2--)
- o2 = t.children[e2], r(c2, t.leaf ? s2(o2) : o2), u2 += l(c2);
- return u2;
- }, _adjustParentBBoxes: function(t, i2, n2) {
- for (var h2 = n2; h2 >= 0; h2--)
- r(i2[h2], t);
- }, _condense: function(t) {
- for (var i2, n2 = t.length - 1; n2 >= 0; n2--)
- t[n2].children.length === 0 ? n2 > 0 ? (i2 = t[n2 - 1].children).splice(i2.indexOf(t[n2]), 1) : this.clear() : h(t[n2], this.toBBox);
- }, _initFormat: function(t) {
- var i2 = ["return a", " - b", ";"];
- this.compareMinX = new Function("a", "b", i2.join(t[0])), this.compareMinY = new Function("a", "b", i2.join(t[1])), this.toBBox = new Function("a", "return {minX: a" + t[0] + ", minY: a" + t[1] + ", maxX: a" + t[2] + ", maxY: a" + t[3] + "};");
- } };
- export {
- i
- };
- //# sourceMappingURL=chunk-VAY3LZG7.js.map
|