@loaders.gl/tiles 5.0.0-alpha.8 → 5.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -3162,6 +3162,88 @@ var __exports__ = (() => {
3162
3162
  }
3163
3163
  };
3164
3164
 
3165
+ // ../../node_modules/@math.gl/core/dist/spheroid.js
3166
+ function spheroidToCartesian(point, geometry, result = point) {
3167
+ const longitude = point.x, latitude = point.y, height = point.z;
3168
+ const { semiMajorAxis: a, semiMinorAxis: b, eccentricitySquared: es } = geometry;
3169
+ const sin = Math.sin(latitude), cos = Math.cos(latitude);
3170
+ const ratio = b / a;
3171
+ const radius = es < 0.9 ? a / Math.sqrt(1 - es * sin * sin) : a / Math.hypot(cos, ratio * sin);
3172
+ const x = (radius + height) * cos * Math.cos(longitude);
3173
+ const y = (radius + height) * cos * Math.sin(longitude);
3174
+ const z = (radius * (es < 0.9 ? 1 - es : ratio * ratio) + height) * sin;
3175
+ return commit(result, x, y, z);
3176
+ }
3177
+ function cartesianToSpheroid(point, geometry, result = point) {
3178
+ const x = point.x, y = point.y, z = point.z;
3179
+ const { semiMajorAxis: a, semiMinorAxis: b, eccentricitySquared: es } = geometry;
3180
+ const p = Math.hypot(x, y), rr = Math.hypot(x, y, z);
3181
+ if (!(rr > 0) || !Number.isFinite(rr))
3182
+ return false;
3183
+ if (es === 0)
3184
+ return commit(result, p === 0 ? 0 : Math.atan2(y, x), Math.atan2(z, p), rr - a);
3185
+ if (p === 0)
3186
+ return commit(result, 0, Math.sign(z) * Math.PI / 2, Math.abs(z) - b);
3187
+ if (es >= 0.9)
3188
+ return exteriorInverse(x, y, z, p, a, b, result);
3189
+ const ct = z / rr, st = p / rr;
3190
+ let rx = 1 / Math.sqrt(1 - es * (2 - es) * st * st);
3191
+ let cos = st * (1 - es) * rx, sin = ct * rx;
3192
+ for (let i = 0; i < 30; i++) {
3193
+ const rn = a / Math.sqrt(1 - es * sin * sin);
3194
+ const height = p * cos + z * sin - rn * (1 - es * sin * sin);
3195
+ const rk = es * rn / (rn + height);
3196
+ rx = 1 / Math.sqrt(1 - rk * (2 - rk) * st * st);
3197
+ const nextCos = st * (1 - rk) * rx, nextSin = ct * rx;
3198
+ if (Math.abs(nextSin * cos - nextCos * sin) <= 1e-12) {
3199
+ if (!Number.isFinite(height) || !Number.isFinite(nextSin) || !Number.isFinite(nextCos))
3200
+ break;
3201
+ return commit(result, Math.atan2(y, x), Math.atan2(nextSin, Math.abs(nextCos)), height);
3202
+ }
3203
+ cos = nextCos;
3204
+ sin = nextSin;
3205
+ }
3206
+ return exteriorInverse(x, y, z, p, a, b, result);
3207
+ }
3208
+ function exteriorInverse(x, y, z, p, a, b, result) {
3209
+ const ratio = b / a, ratio2 = ratio * ratio, horizontal = p / a, vertical = z / a;
3210
+ const norm = Math.hypot(horizontal, z / b);
3211
+ if (!Number.isFinite(norm) || norm < 1 - 8 * Number.EPSILON || !(ratio2 > 0))
3212
+ return false;
3213
+ let lower = 0, upper = Math.hypot(horizontal, vertical * ratio);
3214
+ if (!Number.isFinite(upper))
3215
+ return false;
3216
+ let multiplier = norm <= 1 + 8 * Number.EPSILON ? 0 : upper / 2;
3217
+ for (let i = 0; i < 96; i++) {
3218
+ const equatorial = 1 + multiplier, polar = ratio2 + multiplier;
3219
+ const u = horizontal / equatorial, v = vertical * ratio / polar;
3220
+ const length4 = Math.hypot(u, v);
3221
+ const residual = length4 - 1;
3222
+ if (Math.abs(residual) <= 4 * Number.EPSILON) {
3223
+ const latitude = Math.atan2(vertical / polar, horizontal / equatorial);
3224
+ const sin = Math.sin(latitude), cos = Math.cos(latitude);
3225
+ const height = p * cos + z * sin - a * Math.hypot(cos, ratio * sin);
3226
+ return commit(result, Math.atan2(y, x), latitude, height);
3227
+ }
3228
+ if (residual > 0)
3229
+ lower = multiplier;
3230
+ else
3231
+ upper = multiplier;
3232
+ const derivative = -(u * u / equatorial + v * v / polar) / length4;
3233
+ const next = multiplier - residual / derivative;
3234
+ multiplier = Number.isFinite(next) && next > lower && next < upper ? next : (lower + upper) / 2;
3235
+ }
3236
+ return false;
3237
+ }
3238
+ function commit(result, x, y, z) {
3239
+ if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(z))
3240
+ return false;
3241
+ result.x = x;
3242
+ result.y = y;
3243
+ result.z = z;
3244
+ return true;
3245
+ }
3246
+
3165
3247
  // ../../node_modules/@math.gl/geospatial/dist/constants.js
3166
3248
  var WGS84_RADIUS_X = 6378137;
3167
3249
  var WGS84_RADIUS_Y = 6378137;
@@ -3208,25 +3290,24 @@ var __exports__ = (() => {
3208
3290
  function fromCartographicToRadians(cartographic, vector = []) {
3209
3291
  return fromCartographic(cartographic, vector, config._cartographicRadians ? identity3 : toRadians);
3210
3292
  }
3211
- function toCartographic(vector, cartographic, map2 = identity3) {
3293
+ function toCartographicFromRadiansComponents(longitude, latitude, height, cartographic) {
3294
+ const map2 = config._cartographicRadians ? identity3 : toDegrees;
3295
+ const mappedLongitude = map2(longitude), mappedLatitude = map2(latitude);
3212
3296
  if ("longitude" in cartographic) {
3213
- cartographic.longitude = map2(vector[0]);
3214
- cartographic.latitude = map2(vector[1]);
3215
- cartographic.height = vector[2];
3297
+ cartographic.longitude = mappedLongitude;
3298
+ cartographic.latitude = mappedLatitude;
3299
+ cartographic.height = height;
3216
3300
  } else if ("x" in cartographic) {
3217
- cartographic.x = map2(vector[0]);
3218
- cartographic.y = map2(vector[1]);
3219
- cartographic.z = vector[2];
3301
+ cartographic.x = mappedLongitude;
3302
+ cartographic.y = mappedLatitude;
3303
+ cartographic.z = height;
3220
3304
  } else {
3221
- cartographic[0] = map2(vector[0]);
3222
- cartographic[1] = map2(vector[1]);
3223
- cartographic[2] = vector[2];
3305
+ cartographic[0] = mappedLongitude;
3306
+ cartographic[1] = mappedLatitude;
3307
+ cartographic[2] = height;
3224
3308
  }
3225
3309
  return cartographic;
3226
3310
  }
3227
- function toCartographicFromRadians(vector, cartographic) {
3228
- return toCartographic(vector, cartographic, config._cartographicRadians ? identity3 : toDegrees);
3229
- }
3230
3311
 
3231
3312
  // ../../node_modules/@math.gl/geospatial/dist/ellipsoid-helpers/ellipsoid-transform.js
3232
3313
  var EPSILON142 = 1e-14;
@@ -3348,10 +3429,14 @@ var __exports__ = (() => {
3348
3429
  var scaleToGeodeticSurfaceGradient = new Vector3();
3349
3430
  function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
3350
3431
  const { oneOverRadii, oneOverRadiiSquared, centerToleranceSquared } = ellipsoid;
3351
- scratchVector4.from(cartesian);
3352
- const positionX = scratchVector4.x;
3353
- const positionY = scratchVector4.y;
3354
- const positionZ = scratchVector4.z;
3432
+ const object2 = cartesian;
3433
+ const positionX = "x" in cartesian ? object2.x : cartesian[0];
3434
+ const positionY = "x" in cartesian ? object2.y : cartesian[1];
3435
+ const positionZ = "x" in cartesian ? object2.z : cartesian[2];
3436
+ if (!Number.isFinite(positionX) || !Number.isFinite(positionY) || !Number.isFinite(positionZ)) {
3437
+ return void 0;
3438
+ }
3439
+ scratchVector4.set(positionX, positionY, positionZ);
3355
3440
  const oneOverRadiiX = oneOverRadii.x;
3356
3441
  const oneOverRadiiY = oneOverRadii.y;
3357
3442
  const oneOverRadiiZ = oneOverRadii.z;
@@ -3360,13 +3445,13 @@ var __exports__ = (() => {
3360
3445
  const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
3361
3446
  const squaredNorm = x2 + y2 + z2;
3362
3447
  const ratio = Math.sqrt(1 / squaredNorm);
3363
- if (!Number.isFinite(ratio)) {
3448
+ if (!Number.isFinite(ratio) || !Number.isFinite(squaredNorm)) {
3364
3449
  return void 0;
3365
3450
  }
3366
3451
  const intersection = scaleToGeodeticSurfaceIntersection;
3367
- intersection.copy(cartesian).scale(ratio);
3452
+ intersection.set(positionX, positionY, positionZ).scale(ratio);
3368
3453
  if (squaredNorm < centerToleranceSquared) {
3369
- return intersection.to(result);
3454
+ return writeResult(result, intersection.x, intersection.y, intersection.z);
3370
3455
  }
3371
3456
  const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
3372
3457
  const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
@@ -3379,7 +3464,7 @@ var __exports__ = (() => {
3379
3464
  let yMultiplier;
3380
3465
  let zMultiplier;
3381
3466
  let func;
3382
- do {
3467
+ for (let iteration = 0; iteration < 64; iteration++) {
3383
3468
  lambda -= correction;
3384
3469
  xMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredX);
3385
3470
  yMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredY);
@@ -3391,21 +3476,52 @@ var __exports__ = (() => {
3391
3476
  const yMultiplier3 = yMultiplier2 * yMultiplier;
3392
3477
  const zMultiplier3 = zMultiplier2 * zMultiplier;
3393
3478
  func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1;
3479
+ if (!Number.isFinite(func))
3480
+ return void 0;
3481
+ if (Math.abs(func) <= math_utils_exports.EPSILON12) {
3482
+ return writeResult(result, positionX * xMultiplier, positionY * yMultiplier, positionZ * zMultiplier);
3483
+ }
3394
3484
  const denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
3395
3485
  const derivative = -2 * denominator;
3486
+ if (!Number.isFinite(derivative) || derivative === 0)
3487
+ return void 0;
3396
3488
  correction = func / derivative;
3397
- } while (Math.abs(func) > math_utils_exports.EPSILON12);
3398
- return scratchVector4.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
3489
+ if (!Number.isFinite(correction))
3490
+ return void 0;
3491
+ }
3492
+ return void 0;
3493
+ }
3494
+ function writeResult(result, x, y, z) {
3495
+ if (isArray(result)) {
3496
+ result[0] = x;
3497
+ result[1] = y;
3498
+ result[2] = z;
3499
+ } else {
3500
+ const point = result;
3501
+ point.x = x;
3502
+ point.y = y;
3503
+ point.z = z;
3504
+ }
3505
+ return result;
3399
3506
  }
3400
3507
 
3401
3508
  // ../../node_modules/@math.gl/geospatial/dist/ellipsoid.js
3509
+ var spheroidScratch = { x: 0, y: 0, z: 0 };
3402
3510
  var scratchVector5 = new Vector3();
3403
3511
  var scratchNormal = new Vector3();
3404
3512
  var scratchK = new Vector3();
3405
3513
  var scratchPosition = new Vector3();
3406
3514
  var scratchHeight = new Vector3();
3407
3515
  var scratchCartesian = new Vector3();
3408
- var Ellipsoid = class {
3516
+ var Ellipsoid = class _Ellipsoid {
3517
+ /** Construct from two-axis geometry, including normalized projection ellipsoids.
3518
+ * The equatorial X/Y radii are equal; no CRS or datum information is inferred.
3519
+ */
3520
+ static fromSpheroid(parameters) {
3521
+ const { semiMajorAxis, semiMinorAxis } = parameters;
3522
+ validateSpheroid(semiMajorAxis, semiMinorAxis);
3523
+ return new _Ellipsoid(semiMajorAxis, semiMajorAxis, semiMinorAxis);
3524
+ }
3409
3525
  constructor(x = 0, y = 0, z = 0) {
3410
3526
  this.centerToleranceSquared = math_utils_exports.EPSILON1;
3411
3527
  assert(x >= 0);
@@ -3421,8 +3537,25 @@ var __exports__ = (() => {
3421
3537
  if (this.radiiSquared.z !== 0) {
3422
3538
  this.squaredXOverSquaredZ = this.radiiSquared.x / this.radiiSquared.z;
3423
3539
  }
3540
+ if (x === y && z > 0 && z <= x && Number.isFinite(this.radiiSquared.x) && this.radiiSquared.z > 0)
3541
+ this.spheroidGeometry = Object.freeze({
3542
+ semiMajorAxis: x,
3543
+ semiMinorAxis: z,
3544
+ eccentricitySquared: 1 - this.radiiSquared.z / this.radiiSquared.x
3545
+ });
3424
3546
  Object.freeze(this);
3425
3547
  }
3548
+ /** Return an owned geometry snapshot for a sphere or oblate spheroid.
3549
+ * Triaxial, prolate and degenerate ellipsoids cannot be represented by this contract.
3550
+ * Call during setup, outside coordinate loops.
3551
+ */
3552
+ toSpheroid() {
3553
+ const { x, y, z } = this.radii;
3554
+ if (x !== y)
3555
+ throw new Error("Spheroid requires equal X/Y radii");
3556
+ validateSpheroid(x, z);
3557
+ return Object.freeze({ semiMajorAxis: x, semiMinorAxis: z });
3558
+ }
3426
3559
  /** Compares this Ellipsoid against the provided Ellipsoid componentwise */
3427
3560
  equals(right) {
3428
3561
  return this === right || Boolean(right && this.radii.equals(right.radii));
@@ -3432,6 +3565,15 @@ var __exports__ = (() => {
3432
3565
  return this.radii.toString();
3433
3566
  }
3434
3567
  cartographicToCartesian(cartographic, result = [0, 0, 0]) {
3568
+ if (this.spheroidGeometry) {
3569
+ const llh = fromCartographicToRadians(cartographic, scratchCartesian);
3570
+ spheroidScratch.x = llh[0];
3571
+ spheroidScratch.y = llh[1];
3572
+ spheroidScratch.z = llh[2];
3573
+ if (!spheroidToCartesian(spheroidScratch, this.spheroidGeometry))
3574
+ return void 0;
3575
+ return writeResult(result, spheroidScratch.x, spheroidScratch.y, spheroidScratch.z);
3576
+ }
3435
3577
  const normal = scratchNormal;
3436
3578
  const k = scratchK;
3437
3579
  const [, , height] = cartographic;
@@ -3444,7 +3586,24 @@ var __exports__ = (() => {
3444
3586
  return k.to(result);
3445
3587
  }
3446
3588
  cartesianToCartographic(cartesian, result = [0, 0, 0]) {
3447
- scratchCartesian.from(cartesian);
3589
+ const object2 = cartesian;
3590
+ const x = "x" in cartesian ? object2.x : cartesian[0];
3591
+ const y = "x" in cartesian ? object2.y : cartesian[1];
3592
+ const z = "x" in cartesian ? object2.z : cartesian[2];
3593
+ if (!Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(z))
3594
+ return void 0;
3595
+ const a = this.radii.x, b = this.radii.z;
3596
+ const normSquared = (x / a) ** 2 + (y / a) ** 2 + (z / b) ** 2;
3597
+ if (this.spheroidGeometry && Number.isFinite(normSquared) && normSquared >= 1 - 16 * Number.EPSILON && Number.isFinite(x * x + y * y + z * z)) {
3598
+ spheroidScratch.x = x;
3599
+ spheroidScratch.y = y;
3600
+ spheroidScratch.z = z;
3601
+ if (!cartesianToSpheroid(spheroidScratch, this.spheroidGeometry))
3602
+ return void 0;
3603
+ const longitude2 = x === 0 && y === 0 ? Math.atan2(y, x) : spheroidScratch.x;
3604
+ return toCartographicFromRadiansComponents(longitude2, spheroidScratch.y, spheroidScratch.z, result);
3605
+ }
3606
+ scratchCartesian.set(x, y, z);
3448
3607
  const point = this.scaleToGeodeticSurface(scratchCartesian, scratchPosition);
3449
3608
  if (!point) {
3450
3609
  return void 0;
@@ -3453,9 +3612,9 @@ var __exports__ = (() => {
3453
3612
  const h = scratchHeight;
3454
3613
  h.copy(scratchCartesian).subtract(point);
3455
3614
  const longitude = Math.atan2(normal.y, normal.x);
3456
- const latitude = Math.asin(normal.z);
3615
+ const latitude = Math.atan2(normal.z, Math.hypot(normal.x, normal.y));
3457
3616
  const height = Math.sign(dot(h, scratchCartesian)) * length(h);
3458
- return toCartographicFromRadians([longitude, latitude, height], result);
3617
+ return toCartographicFromRadiansComponents(longitude, latitude, height, result);
3459
3618
  }
3460
3619
  eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
3461
3620
  return localFrameToFixedFrame(this, "east", "north", "up", origin, result);
@@ -3519,6 +3678,10 @@ var __exports__ = (() => {
3519
3678
  }
3520
3679
  };
3521
3680
  Ellipsoid.WGS84 = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
3681
+ function validateSpheroid(a, b) {
3682
+ if (!Number.isFinite(a) || !Number.isFinite(b) || a <= 0 || b <= 0 || b > a)
3683
+ throw new Error("Spheroid requires finite positive axes with semiMinorAxis <= semiMajorAxis");
3684
+ }
3522
3685
 
3523
3686
  // ../../node_modules/@math.gl/culling/dist/constants.js
3524
3687
  var INTERSECTION;
@@ -11088,8 +11251,8 @@ var __exports__ = (() => {
11088
11251
  return void 0;
11089
11252
  }
11090
11253
 
11091
- // ../../node_modules/@math.gl/proj4/dist/experimental/projection-descriptor.js
11092
- var CACHE_KEY = /* @__PURE__ */ Symbol.for("@math.gl/proj4/projection-implementations");
11254
+ // ../../node_modules/@math.gl/projection/dist/experimental/projection-descriptor.js
11255
+ var CACHE_KEY = /* @__PURE__ */ Symbol.for("@math.gl/projection/projection-implementations");
11093
11256
  function cache() {
11094
11257
  const scope = globalThis;
11095
11258
  scope[CACHE_KEY] || (scope[CACHE_KEY] = /* @__PURE__ */ new WeakMap());
@@ -11123,18 +11286,45 @@ var __exports__ = (() => {
11123
11286
  return entry.pending;
11124
11287
  }
11125
11288
 
11126
- // ../../node_modules/@math.gl/proj4/dist/experimental/mutable-projection.js
11289
+ // ../../node_modules/@math.gl/projection/dist/experimental/projection-scratch.js
11290
+ var ProjectionScratch = class {
11291
+ constructor() {
11292
+ this.point = { x: 0, y: 0, z: 0 };
11293
+ this.busy = false;
11294
+ }
11295
+ acquire() {
11296
+ if (this.busy)
11297
+ return { x: 0, y: 0, z: 0 };
11298
+ this.busy = true;
11299
+ return this.point;
11300
+ }
11301
+ release(point) {
11302
+ if (point === this.point)
11303
+ this.busy = false;
11304
+ }
11305
+ };
11306
+
11307
+ // ../../node_modules/@math.gl/projection/dist/experimental/mutable-projection.js
11127
11308
  function createProjection(forward33, inverse33) {
11309
+ const scratch = new ProjectionScratch();
11310
+ const scalar = (x, y, operation2) => {
11311
+ const point = scratch.acquire();
11312
+ try {
11313
+ point.x = x;
11314
+ point.y = y;
11315
+ point.z = 0;
11316
+ operation2(point);
11317
+ return [point.x, point.y];
11318
+ } finally {
11319
+ scratch.release(point);
11320
+ }
11321
+ };
11128
11322
  return {
11129
11323
  forward(x, y) {
11130
- const point = { x, y, z: 0 };
11131
- forward33(point);
11132
- return [point.x, point.y];
11324
+ return scalar(x, y, forward33);
11133
11325
  },
11134
11326
  inverse(x, y) {
11135
- const point = { x, y, z: 0 };
11136
- inverse33(point);
11137
- return [point.x, point.y];
11327
+ return scalar(x, y, inverse33);
11138
11328
  },
11139
11329
  forwardInPlace: forward33,
11140
11330
  inverseInPlace: inverse33
@@ -11161,9 +11351,43 @@ var __exports__ = (() => {
11161
11351
  };
11162
11352
  }
11163
11353
 
11164
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/types.js
11354
+ // ../../node_modules/@math.gl/projection/dist/experimental/scalar-output.js
11355
+ var FLOAT32_MAX = 34028234663852886e22;
11356
+ function validateScalarOutput(coordinate, output, length4) {
11357
+ if (!(Array.isArray(coordinate) || coordinate instanceof Float32Array || coordinate instanceof Float64Array))
11358
+ throw new Error("Scalar input requires a number array, Float32Array or Float64Array");
11359
+ if (!(Array.isArray(output) || output instanceof Float32Array || output instanceof Float64Array) || output.length < length4)
11360
+ throw new Error("Scalar output requires a preallocated number array, Float32Array or Float64Array with sufficient capacity");
11361
+ if (coordinate === output || Array.isArray(coordinate) || Array.isArray(output))
11362
+ return;
11363
+ const input = coordinate;
11364
+ const result = output;
11365
+ const shared = typeof SharedArrayBuffer !== "undefined" && input.buffer instanceof SharedArrayBuffer && result.buffer instanceof SharedArrayBuffer;
11366
+ if ((input.buffer === result.buffer || shared) && input.byteOffset < result.byteOffset + length4 * result.BYTES_PER_ELEMENT && result.byteOffset < input.byteOffset + input.byteLength)
11367
+ throw new Error("Scalar input/output views overlap; use the same view for in-place projection");
11368
+ }
11369
+ function writeScalarOutput(coordinate, output, point, length4) {
11370
+ if (output instanceof Float32Array) {
11371
+ if (Math.abs(point.x) > FLOAT32_MAX || Math.abs(point.y) > FLOAT32_MAX || length4 >= 3 && Math.abs(point.z) > FLOAT32_MAX)
11372
+ throw new Error("Projected coordinate exceeds Float32 range");
11373
+ for (let i = 3; i < coordinate.length; i++) {
11374
+ const value2 = coordinate[i];
11375
+ if (Number.isFinite(value2) && Math.abs(value2) > FLOAT32_MAX)
11376
+ throw new Error("Trailing ordinate exceeds Float32 range");
11377
+ }
11378
+ }
11379
+ for (let i = 3; i < coordinate.length; i++)
11380
+ output[i] = coordinate[i];
11381
+ output[0] = point.x;
11382
+ output[1] = point.y;
11383
+ if (length4 >= 3)
11384
+ output[2] = point.z;
11385
+ return output;
11386
+ }
11387
+
11388
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/types.js
11165
11389
  var _a;
11166
- var CRS_ERROR = /* @__PURE__ */ Symbol.for("@math.gl/proj4/TypeScriptCRSError");
11390
+ var CRS_ERROR = /* @__PURE__ */ Symbol.for("@math.gl/projection/TypeScriptCRSError");
11167
11391
  var TypeScriptCRSError = class _TypeScriptCRSError extends Error {
11168
11392
  static [(_a = CRS_ERROR, Symbol.hasInstance)](value2) {
11169
11393
  if (this !== _TypeScriptCRSError)
@@ -11181,7 +11405,7 @@ var __exports__ = (() => {
11181
11405
  throw new TypeScriptCRSError("missing-transform-stage", message);
11182
11406
  }
11183
11407
 
11184
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/spatial-reference.js
11408
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/spatial-reference.js
11185
11409
  function resolveCRSInput(input, options) {
11186
11410
  if (typeof input === "string" || "type" in input)
11187
11411
  return { definition: input, lossy: false };
@@ -11255,7 +11479,7 @@ var __exports__ = (() => {
11255
11479
  return Object.freeze({ ...crs, storedAxis });
11256
11480
  }
11257
11481
 
11258
- // ../../node_modules/@math.gl/proj4/dist/experimental/parameters.js
11482
+ // ../../node_modules/@math.gl/projection/dist/experimental/parameters.js
11259
11483
  var DEGREES_TO_RADIANS2 = Math.PI / 180;
11260
11484
  function numberParameter(parameters, name, fallback) {
11261
11485
  if (!Object.prototype.hasOwnProperty.call(parameters, name))
@@ -11282,7 +11506,7 @@ var __exports__ = (() => {
11282
11506
  return ((longitude + Math.PI) % circle + circle) % circle - Math.PI;
11283
11507
  }
11284
11508
 
11285
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/datum-table.js
11509
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/datum-table.js
11286
11510
  var datums = {
11287
11511
  wgs84: {
11288
11512
  towgs84: "0,0,0",
@@ -12644,7 +12868,7 @@ var __exports__ = (() => {
12644
12868
  }
12645
12869
  var datum_table_default = datums;
12646
12870
 
12647
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/ellipsoid-table.js
12871
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/ellipsoid-table.js
12648
12872
  var ellipsoids = {
12649
12873
  MERIT: {
12650
12874
  a: 6378137,
@@ -12870,7 +13094,7 @@ var __exports__ = (() => {
12870
13094
  };
12871
13095
  var ellipsoid_table_default = ellipsoids;
12872
13096
 
12873
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/primemeridian-table.js
13097
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/primemeridian-table.js
12874
13098
  var primeMeridian = {};
12875
13099
  primeMeridian["greenwich"] = 0;
12876
13100
  primeMeridian["lisbon"] = -9.131906111111;
@@ -12887,7 +13111,7 @@ var __exports__ = (() => {
12887
13111
  primeMeridian["oslo"] = 10.722916666667;
12888
13112
  var primemeridian_table_default = primeMeridian;
12889
13113
 
12890
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/units-table.js
13114
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/units-table.js
12891
13115
  var units_table_default = {
12892
13116
  mm: { to_meter: 1e-3 },
12893
13117
  cm: { to_meter: 0.01 },
@@ -12911,7 +13135,7 @@ var __exports__ = (() => {
12911
13135
  "us-yd": { to_meter: 0.914401828803658 }
12912
13136
  };
12913
13137
 
12914
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/normalize.js
13138
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/normalize.js
12915
13139
  var ALIASES = {
12916
13140
  WGS84: "+proj=longlat +datum=WGS84",
12917
13141
  "EPSG:4326": "+proj=longlat +datum=WGS84",
@@ -13142,7 +13366,7 @@ var __exports__ = (() => {
13142
13366
  });
13143
13367
  }
13144
13368
 
13145
- // ../../node_modules/@math.gl/proj4/dist/experimental/datum.js
13369
+ // ../../node_modules/@math.gl/projection/dist/experimental/datum.js
13146
13370
  var ARC_SECOND = Math.PI / (180 * 3600);
13147
13371
  var WGS84 = {
13148
13372
  ellipsoid: {
@@ -13153,47 +13377,29 @@ var __exports__ = (() => {
13153
13377
  towgs84: [0, 0, 0]
13154
13378
  };
13155
13379
  function geodeticToGeocentricInPlace(point, ellipsoid) {
13156
- const lon = point.x, lat = point.y, height = point.z;
13157
- const { semiMajorAxis: a, eccentricitySquared: es } = ellipsoid;
13158
- if (Math.abs(lat) > Math.PI / 2)
13380
+ if (Math.abs(point.y) > Math.PI / 2)
13159
13381
  throw new Error("Latitude outside geocentric domain");
13160
- const sin = Math.sin(lat), cos = Math.cos(lat);
13161
- const radius = a / Math.sqrt(1 - es * sin * sin);
13162
- point.x = (radius + height) * cos * Math.cos(lon);
13163
- point.y = (radius + height) * cos * Math.sin(lon);
13164
- point.z = (radius * (1 - es) + height) * sin;
13382
+ if (!spheroidToCartesian(point, ellipsoid))
13383
+ throw new Error("Geocentric coordinate must be finite");
13165
13384
  }
13166
13385
  function geocentricToGeodeticInPlace(point, ellipsoid) {
13167
13386
  const x = point.x, y = point.y, z = point.z;
13168
13387
  const { semiMajorAxis: a, semiMinorAxis: b, eccentricitySquared: es } = ellipsoid;
13169
- const p = Math.hypot(x, y), rr = Math.hypot(x, y, z);
13170
- if (rr === 0)
13388
+ if (x === 0 && y === 0 && z === 0)
13171
13389
  throw new Error("Geodetic coordinates are undefined at the Earth center");
13172
- if (p < 1e-12 * a) {
13390
+ if (es !== 0 && Math.abs(x) < 1e-12 * a && Math.abs(y) < 1e-12 * a && Math.hypot(x, y) < 1e-12 * a) {
13391
+ if (!Number.isFinite(Math.hypot(x, y, z)))
13392
+ throw new Error("Geocentric radius must be finite");
13173
13393
  point.x = 0;
13174
13394
  point.y = Math.sign(z) * Math.PI / 2;
13175
13395
  point.z = Math.abs(z) - b;
13176
13396
  return;
13177
13397
  }
13178
- const ct = z / rr, st = p / rr;
13179
- let rx = 1 / Math.sqrt(1 - es * (2 - es) * st * st);
13180
- let cos = st * (1 - es) * rx, sin = ct * rx;
13181
- for (let i = 0; i < 30; i++) {
13182
- const rn = a / Math.sqrt(1 - es * sin * sin);
13183
- const height = p * cos + z * sin - rn * (1 - es * sin * sin);
13184
- const rk = es * rn / (rn + height);
13185
- rx = 1 / Math.sqrt(1 - rk * (2 - rk) * st * st);
13186
- const nextCos = st * (1 - rk) * rx, nextSin = ct * rx;
13187
- if (Math.abs(nextSin * cos - nextCos * sin) <= 1e-12) {
13188
- point.x = Math.atan2(y, x);
13189
- point.y = Math.atan2(nextSin, Math.abs(nextCos));
13190
- point.z = height;
13191
- return;
13192
- }
13193
- cos = nextCos;
13194
- sin = nextSin;
13398
+ if (!cartesianToSpheroid(point, ellipsoid)) {
13399
+ if (!Number.isFinite(Math.hypot(x, y, z)))
13400
+ throw new Error("Geocentric radius must be finite");
13401
+ throw new Error("Geocentric inverse did not converge");
13195
13402
  }
13196
- throw new Error("Geocentric inverse did not converge");
13197
13403
  }
13198
13404
  function createHelmert(values, inverse33) {
13199
13405
  const dx = values[0], dy = values[1], dz = values[2];
@@ -13295,7 +13501,7 @@ var __exports__ = (() => {
13295
13501
  return [point.x, point.y, point.z];
13296
13502
  }
13297
13503
 
13298
- // ../../node_modules/@math.gl/proj4/dist/experimental/vertical-datum.js
13504
+ // ../../node_modules/@math.gl/projection/dist/experimental/vertical-datum.js
13299
13505
  function compileVerticalGrid(names, grids2 = {}) {
13300
13506
  if (names === void 0)
13301
13507
  return void 0;
@@ -13332,7 +13538,7 @@ var __exports__ = (() => {
13332
13538
  };
13333
13539
  }
13334
13540
 
13335
- // ../../node_modules/@math.gl/proj4/dist/experimental/typescript-projection.js
13541
+ // ../../node_modules/@math.gl/projection/dist/experimental/typescript-projection.js
13336
13542
  var ProjectionEngine = class _ProjectionEngine {
13337
13543
  /** Resolve required descriptors once, then return an ordinary synchronous instance. */
13338
13544
  static async create(options = {}) {
@@ -13340,6 +13546,7 @@ var __exports__ = (() => {
13340
13546
  return new _ProjectionEngine({ ...options, projections });
13341
13547
  }
13342
13548
  constructor(options = {}) {
13549
+ this.coordinateScratch = new ProjectionScratch();
13343
13550
  const registrations = options.projections || [];
13344
13551
  const plugins = registry(registrations);
13345
13552
  if (registrations.some((projection) => !("create" in projection))) {
@@ -13362,6 +13569,10 @@ var __exports__ = (() => {
13362
13569
  }
13363
13570
  this.project = this.project.bind(this);
13364
13571
  this.unproject = this.unproject.bind(this);
13572
+ this.projectTo = this.projectTo.bind(this);
13573
+ this.unprojectTo = this.unprojectTo.bind(this);
13574
+ this.projectToSync = this.projectToSync.bind(this);
13575
+ this.unprojectToSync = this.unprojectToSync.bind(this);
13365
13576
  this.projectFlat = this.projectFlat.bind(this);
13366
13577
  this.unprojectFlat = this.unprojectFlat.bind(this);
13367
13578
  this.projectSync = this.projectSync.bind(this);
@@ -13401,16 +13612,16 @@ var __exports__ = (() => {
13401
13612
  }
13402
13613
  /** Synchronous variants never import algorithms; descriptors must be preloaded. */
13403
13614
  projectSync(coordinate) {
13404
- return this.deferred ? this.loadSync().project(coordinate) : transformScalar(coordinate, this.forwardTransform);
13615
+ return this.deferred ? this.loadSync().project(coordinate) : transformScalar(coordinate, this.forwardTransform, this.coordinateScratch);
13405
13616
  }
13406
13617
  unprojectSync(coordinate) {
13407
- return this.deferred ? this.loadSync().unproject(coordinate) : transformScalar(coordinate, this.inverseTransform);
13618
+ return this.deferred ? this.loadSync().unproject(coordinate) : transformScalar(coordinate, this.inverseTransform, this.coordinateScratch);
13408
13619
  }
13409
13620
  projectFlatSync(coordinates, dimension = 2) {
13410
- return this.deferred ? this.loadSync().projectFlat(coordinates, dimension) : transformInPlace(coordinates, dimension, this.forwardTransform);
13621
+ return this.deferred ? this.loadSync().projectFlat(coordinates, dimension) : transformInPlace(coordinates, dimension, this.forwardTransform, this.coordinateScratch);
13411
13622
  }
13412
13623
  unprojectFlatSync(coordinates, dimension = 2) {
13413
- return this.deferred ? this.loadSync().unprojectFlat(coordinates, dimension) : transformInPlace(coordinates, dimension, this.inverseTransform);
13624
+ return this.deferred ? this.loadSync().unprojectFlat(coordinates, dimension) : transformInPlace(coordinates, dimension, this.inverseTransform, this.coordinateScratch);
13414
13625
  }
13415
13626
  /** Optional warm-up. Coordinate methods also load automatically on first use. */
13416
13627
  async preload() {
@@ -13418,24 +13629,48 @@ var __exports__ = (() => {
13418
13629
  }
13419
13630
  /** Eager plugins return arrays; descriptor-backed instances return promises. */
13420
13631
  project(coordinate) {
13421
- const result = this.deferred ? this.projectLoaded(coordinate, false) : transformScalar(coordinate, this.forwardTransform);
13632
+ const result = this.deferred ? this.projectLoaded(coordinate, false) : transformScalar(coordinate, this.forwardTransform, this.coordinateScratch);
13422
13633
  return result;
13423
13634
  }
13424
13635
  unproject(coordinate) {
13425
- const result = this.deferred ? this.projectLoaded(coordinate, true) : transformScalar(coordinate, this.inverseTransform);
13636
+ const result = this.deferred ? this.projectLoaded(coordinate, true) : transformScalar(coordinate, this.inverseTransform, this.coordinateScratch);
13426
13637
  return result;
13427
13638
  }
13639
+ /** Write one coordinate into caller-owned storage; return that same output. */
13640
+ projectTo(coordinate, output) {
13641
+ return this.deferred ? this.projectToLoaded(coordinate, output, false) : this.projectToSync(coordinate, output);
13642
+ }
13643
+ unprojectTo(coordinate, output) {
13644
+ return this.deferred ? this.projectToLoaded(coordinate, output, true) : this.unprojectToSync(coordinate, output);
13645
+ }
13646
+ projectToSync(coordinate, output) {
13647
+ if (this.deferred)
13648
+ return this.loadSync().projectTo(coordinate, output);
13649
+ validateScalarOutput(coordinate, output, Math.max(coordinate.length, this.forwardTransform.geocentricOutput ? 3 : 2));
13650
+ return transformScalar(coordinate, this.forwardTransform, this.coordinateScratch, output);
13651
+ }
13652
+ unprojectToSync(coordinate, output) {
13653
+ if (this.deferred)
13654
+ return this.loadSync().unprojectTo(coordinate, output);
13655
+ validateScalarOutput(coordinate, output, Math.max(coordinate.length, this.inverseTransform.geocentricOutput ? 3 : 2));
13656
+ return transformScalar(coordinate, this.inverseTransform, this.coordinateScratch, output);
13657
+ }
13658
+ projectToLoaded(coordinate, output, inverse33) {
13659
+ validateScalarOutput(coordinate, output, coordinate.length);
13660
+ const input = coordinate.slice();
13661
+ return this.load().then((projection) => inverse33 ? projection.unprojectTo(input, output) : projection.projectTo(input, output));
13662
+ }
13428
13663
  projectLoaded(coordinate, inverse33) {
13429
13664
  const input = coordinate.slice();
13430
13665
  return this.load().then((projection) => inverse33 ? projection.unproject(input) : projection.project(input));
13431
13666
  }
13432
13667
  /** In-place; descriptor callers must await completion before reusing the buffer. */
13433
13668
  projectFlat(coordinates, dimension = 2) {
13434
- const result = this.deferred ? this.load().then((projection) => projection.projectFlat(coordinates, dimension)) : transformInPlace(coordinates, dimension, this.forwardTransform);
13669
+ const result = this.deferred ? this.load().then((projection) => projection.projectFlat(coordinates, dimension)) : transformInPlace(coordinates, dimension, this.forwardTransform, this.coordinateScratch);
13435
13670
  return result;
13436
13671
  }
13437
13672
  unprojectFlat(coordinates, dimension = 2) {
13438
- const result = this.deferred ? this.load().then((projection) => projection.unprojectFlat(coordinates, dimension)) : transformInPlace(coordinates, dimension, this.inverseTransform);
13673
+ const result = this.deferred ? this.load().then((projection) => projection.unprojectFlat(coordinates, dimension)) : transformInPlace(coordinates, dimension, this.inverseTransform, this.coordinateScratch);
13439
13674
  return result;
13440
13675
  }
13441
13676
  };
@@ -13593,21 +13828,31 @@ var __exports__ = (() => {
13593
13828
  }
13594
13829
  };
13595
13830
  }
13596
- function transformScalar(coordinate, operation2) {
13831
+ function transformScalar(coordinate, operation2, scratch, output) {
13597
13832
  if (coordinate.length < 2)
13598
13833
  throw new Error("Coordinates must contain finite x, y and optional z values");
13599
13834
  if (coordinate.length < 3 && operation2.requiresInputZ)
13600
13835
  throw new Error("This transform requires three ordinates");
13601
- const point = { x: coordinate[0], y: coordinate[1], z: coordinate.length >= 3 ? coordinate[2] : 0 };
13602
- operation2.run(point);
13603
- const output = coordinate.slice();
13604
- output[0] = point.x;
13605
- output[1] = point.y;
13606
- if (coordinate.length >= 3 || operation2.geocentricOutput)
13607
- output[2] = point.z;
13608
- return output;
13836
+ const length4 = Math.max(coordinate.length, operation2.geocentricOutput ? 3 : 2);
13837
+ const point = scratch.acquire();
13838
+ try {
13839
+ point.x = coordinate[0];
13840
+ point.y = coordinate[1];
13841
+ point.z = coordinate.length >= 3 ? coordinate[2] : 0;
13842
+ operation2.run(point);
13843
+ if (output)
13844
+ return writeScalarOutput(coordinate, output, point, length4);
13845
+ const result = coordinate.slice();
13846
+ result[0] = point.x;
13847
+ result[1] = point.y;
13848
+ if (coordinate.length >= 3 || operation2.geocentricOutput)
13849
+ result[2] = point.z;
13850
+ return result;
13851
+ } finally {
13852
+ scratch.release(point);
13853
+ }
13609
13854
  }
13610
- function transformInPlace(coordinates, dimension, operation2) {
13855
+ function transformInPlace(coordinates, dimension, operation2, scratch) {
13611
13856
  if (!(coordinates instanceof Float32Array || coordinates instanceof Float64Array))
13612
13857
  throw new Error("In-place projection requires a Float32Array or Float64Array");
13613
13858
  if (!Number.isSafeInteger(dimension) || dimension < 2 || coordinates.length % dimension !== 0)
@@ -13618,24 +13863,28 @@ var __exports__ = (() => {
13618
13863
  operation2.flat(coordinates, dimension);
13619
13864
  return coordinates;
13620
13865
  }
13621
- const point = { x: 0, y: 0, z: 0 };
13622
- const float32 = coordinates instanceof Float32Array;
13623
- for (let offset = 0; offset < coordinates.length; offset += dimension) {
13624
- point.x = coordinates[offset];
13625
- point.y = coordinates[offset + 1];
13626
- point.z = dimension >= 3 ? coordinates[offset + 2] : 0;
13627
- operation2.run(point);
13628
- if (float32 && (Math.abs(point.x) > 34028234663852886e22 || Math.abs(point.y) > 34028234663852886e22 || dimension >= 3 && Math.abs(point.z) > 34028234663852886e22))
13629
- throw new Error("Projected coordinate exceeds Float32 range");
13630
- coordinates[offset] = point.x;
13631
- coordinates[offset + 1] = point.y;
13632
- if (dimension >= 3)
13633
- coordinates[offset + 2] = point.z;
13866
+ const point = scratch.acquire();
13867
+ try {
13868
+ const float32 = coordinates instanceof Float32Array;
13869
+ for (let offset = 0; offset < coordinates.length; offset += dimension) {
13870
+ point.x = coordinates[offset];
13871
+ point.y = coordinates[offset + 1];
13872
+ point.z = dimension >= 3 ? coordinates[offset + 2] : 0;
13873
+ operation2.run(point);
13874
+ if (float32 && (Math.abs(point.x) > 34028234663852886e22 || Math.abs(point.y) > 34028234663852886e22 || dimension >= 3 && Math.abs(point.z) > 34028234663852886e22))
13875
+ throw new Error("Projected coordinate exceeds Float32 range");
13876
+ coordinates[offset] = point.x;
13877
+ coordinates[offset + 1] = point.y;
13878
+ if (dimension >= 3)
13879
+ coordinates[offset + 2] = point.z;
13880
+ }
13881
+ return coordinates;
13882
+ } finally {
13883
+ scratch.release(point);
13634
13884
  }
13635
- return coordinates;
13636
13885
  }
13637
13886
 
13638
- // ../../node_modules/@math.gl/proj4/dist/experimental/flat-projection.js
13887
+ // ../../node_modules/@math.gl/projection/dist/experimental/flat-projection.js
13639
13888
  function createFlatProjection(forward33, inverse33) {
13640
13889
  return {
13641
13890
  ...createProjection(forward33, inverse33),
@@ -13683,7 +13932,7 @@ var __exports__ = (() => {
13683
13932
  };
13684
13933
  }
13685
13934
 
13686
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/mercator.js
13935
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/mercator.js
13687
13936
  var mercator = {
13688
13937
  name: "merc",
13689
13938
  aliases: [
@@ -13739,7 +13988,7 @@ var __exports__ = (() => {
13739
13988
  }
13740
13989
  };
13741
13990
 
13742
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/equidistant-cylindrical.js
13991
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/equidistant-cylindrical.js
13743
13992
  var equidistantCylindrical = {
13744
13993
  name: "eqc",
13745
13994
  aliases: ["Equirectangular", "Equidistant_Cylindrical", "Equidistant_Cylindrical_Spherical"],
@@ -13761,7 +14010,7 @@ var __exports__ = (() => {
13761
14010
  }
13762
14011
  };
13763
14012
 
13764
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernel.js
14013
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernel.js
13765
14014
  var ORIGIN_PARAMETERS = ["lon_0", "lat_0", "x_0", "y_0"];
13766
14015
  var SCALE_PARAMETERS = ["k", "k_0"];
13767
14016
  function angleParameter(parameters, name, fallback = 0) {
@@ -13829,13 +14078,13 @@ var __exports__ = (() => {
13829
14078
  }, projectionOperation(implementation, true));
13830
14079
  }
13831
14080
 
13832
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/msfnz.js
14081
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/msfnz.js
13833
14082
  function msfnz_default(eccent, sinphi, cosphi) {
13834
14083
  var con = eccent * sinphi;
13835
14084
  return cosphi / Math.sqrt(1 - con * con);
13836
14085
  }
13837
14086
 
13838
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/constants.js
14087
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/constants.js
13839
14088
  var EPSLN = 1e-10;
13840
14089
  var HALF_PI = Math.PI / 2;
13841
14090
  var FORTPI = Math.PI / 4;
@@ -13845,7 +14094,7 @@ var __exports__ = (() => {
13845
14094
  var R2D = 180 / Math.PI;
13846
14095
  var SEC_TO_RAD = Math.PI / (180 * 3600);
13847
14096
 
13848
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/tsfnz.js
14097
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/tsfnz.js
13849
14098
  function tsfnz_default(eccent, phi, sinphi) {
13850
14099
  var con = eccent * sinphi;
13851
14100
  var com = 0.5 * eccent;
@@ -13853,12 +14102,12 @@ var __exports__ = (() => {
13853
14102
  return Math.tan(0.5 * (HALF_PI - phi)) / con;
13854
14103
  }
13855
14104
 
13856
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/sign.js
14105
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/sign.js
13857
14106
  function sign_default(x) {
13858
14107
  return x < 0 ? -1 : 1;
13859
14108
  }
13860
14109
 
13861
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/adjust_lon.js
14110
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/adjust_lon.js
13862
14111
  function adjust_lon_default(x, skipAdjust) {
13863
14112
  if (skipAdjust) {
13864
14113
  return x;
@@ -13866,7 +14115,7 @@ var __exports__ = (() => {
13866
14115
  return Math.abs(x) <= SPI ? x : x - sign_default(x) * TWO_PI2;
13867
14116
  }
13868
14117
 
13869
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/phi2z.js
14118
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/phi2z.js
13870
14119
  function phi2z_default(eccent, ts) {
13871
14120
  var eccnth = 0.5 * eccent;
13872
14121
  var con, dphi;
@@ -13882,7 +14131,7 @@ var __exports__ = (() => {
13882
14131
  return -9999;
13883
14132
  }
13884
14133
 
13885
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/lcc.js
14134
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/lcc.js
13886
14135
  function initialize(state) {
13887
14136
  if (!state.k0) {
13888
14137
  state.k0 = 1;
@@ -13980,7 +14229,7 @@ var __exports__ = (() => {
13980
14229
  return state;
13981
14230
  }
13982
14231
 
13983
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/lcc.js
14232
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/lcc.js
13984
14233
  var lambertConformalConic = {
13985
14234
  name: "lcc",
13986
14235
  aliases: [
@@ -14007,7 +14256,7 @@ var __exports__ = (() => {
14007
14256
  }
14008
14257
  };
14009
14258
 
14010
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/qsfnz.js
14259
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/qsfnz.js
14011
14260
  function qsfnz_default(eccent, sinphi) {
14012
14261
  var con;
14013
14262
  if (eccent > 1e-7) {
@@ -14018,7 +14267,7 @@ var __exports__ = (() => {
14018
14267
  }
14019
14268
  }
14020
14269
 
14021
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/asinz.js
14270
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/asinz.js
14022
14271
  function asinz_default(x) {
14023
14272
  if (Math.abs(x) > 1) {
14024
14273
  x = x > 1 ? 1 : -1;
@@ -14026,7 +14275,7 @@ var __exports__ = (() => {
14026
14275
  return Math.asin(x);
14027
14276
  }
14028
14277
 
14029
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/aea.js
14278
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/aea.js
14030
14279
  function initialize2(state) {
14031
14280
  if (Math.abs(state.lat1 + state.lat2) < EPSLN) {
14032
14281
  return;
@@ -14144,7 +14393,7 @@ var __exports__ = (() => {
14144
14393
  return state;
14145
14394
  }
14146
14395
 
14147
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/aea.js
14396
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/aea.js
14148
14397
  var albersEqualArea = {
14149
14398
  name: "aea",
14150
14399
  aliases: ["Albers_Conic_Equal_Area", "Albers_Equal_Area", "Albers"],
@@ -14156,7 +14405,7 @@ var __exports__ = (() => {
14156
14405
  }
14157
14406
  };
14158
14407
 
14159
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/pj_enfn.js
14408
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/pj_enfn.js
14160
14409
  var C00 = 1;
14161
14410
  var C02 = 0.25;
14162
14411
  var C04 = 0.046875;
@@ -14181,14 +14430,14 @@ var __exports__ = (() => {
14181
14430
  return en;
14182
14431
  }
14183
14432
 
14184
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/pj_mlfn.js
14433
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/pj_mlfn.js
14185
14434
  function pj_mlfn_default(phi, sphi, cphi, en) {
14186
14435
  cphi *= sphi;
14187
14436
  sphi *= sphi;
14188
14437
  return en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4])));
14189
14438
  }
14190
14439
 
14191
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/pj_inv_mlfn.js
14440
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/pj_inv_mlfn.js
14192
14441
  var MAX_ITER = 20;
14193
14442
  function pj_inv_mlfn_default(arg, es, en) {
14194
14443
  var k = 1 / (1 - es);
@@ -14205,12 +14454,12 @@ var __exports__ = (() => {
14205
14454
  return phi;
14206
14455
  }
14207
14456
 
14208
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/adjust_lat.js
14457
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/adjust_lat.js
14209
14458
  function adjust_lat_default(x) {
14210
14459
  return Math.abs(x) < HALF_PI ? x : x - sign_default(x) * Math.PI;
14211
14460
  }
14212
14461
 
14213
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/eqdc.js
14462
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/eqdc.js
14214
14463
  function initialize3(state) {
14215
14464
  if (Math.abs(state.lat1 + state.lat2) < EPSLN) {
14216
14465
  return;
@@ -14303,7 +14552,7 @@ var __exports__ = (() => {
14303
14552
  return state;
14304
14553
  }
14305
14554
 
14306
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/eqdc.js
14555
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/eqdc.js
14307
14556
  var equidistantConic = {
14308
14557
  name: "eqdc",
14309
14558
  aliases: ["Equidistant_Conic"],
@@ -14315,7 +14564,7 @@ var __exports__ = (() => {
14315
14564
  }
14316
14565
  };
14317
14566
 
14318
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/authset.js
14567
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/authset.js
14319
14568
  var P00 = 0.3333333333333333;
14320
14569
  var P01 = 0.17222222222222222;
14321
14570
  var P02 = 0.10257936507936508;
@@ -14336,13 +14585,13 @@ var __exports__ = (() => {
14336
14585
  return APA;
14337
14586
  }
14338
14587
 
14339
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/authlat.js
14588
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/authlat.js
14340
14589
  function authlat(beta, APA) {
14341
14590
  var t = beta + beta;
14342
14591
  return beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t);
14343
14592
  }
14344
14593
 
14345
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/laea.js
14594
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/laea.js
14346
14595
  var S_POLE = 1;
14347
14596
  var N_POLE = 2;
14348
14597
  var EQUIT = 3;
@@ -14583,7 +14832,7 @@ var __exports__ = (() => {
14583
14832
  return state;
14584
14833
  }
14585
14834
 
14586
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/laea.js
14835
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/laea.js
14587
14836
  var lambertAzimuthalEqualArea = {
14588
14837
  name: "laea",
14589
14838
  aliases: ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area"],
@@ -14594,7 +14843,7 @@ var __exports__ = (() => {
14594
14843
  }
14595
14844
  };
14596
14845
 
14597
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/stere.js
14846
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/stere.js
14598
14847
  function ssfn_(phit, sinphi, eccen) {
14599
14848
  sinphi *= eccen;
14600
14849
  return Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen);
@@ -14739,7 +14988,7 @@ var __exports__ = (() => {
14739
14988
  return state;
14740
14989
  }
14741
14990
 
14742
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/stere.js
14991
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/stere.js
14743
14992
  var stereographic = {
14744
14993
  name: "stere",
14745
14994
  aliases: [
@@ -14755,12 +15004,12 @@ var __exports__ = (() => {
14755
15004
  }
14756
15005
  };
14757
15006
 
14758
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/srat.js
15007
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/srat.js
14759
15008
  function srat_default(esinp, exp) {
14760
15009
  return Math.pow((1 - esinp) / (1 + esinp), exp);
14761
15010
  }
14762
15011
 
14763
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/gauss.js
15012
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/gauss.js
14764
15013
  var MAX_ITER2 = 20;
14765
15014
  function initialize6(state) {
14766
15015
  var sphi = Math.sin(state.lat0);
@@ -14811,7 +15060,7 @@ var __exports__ = (() => {
14811
15060
  return state;
14812
15061
  }
14813
15062
 
14814
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/hypot.js
15063
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/hypot.js
14815
15064
  function hypot_default(x, y) {
14816
15065
  x = Math.abs(x);
14817
15066
  y = Math.abs(y);
@@ -14820,7 +15069,7 @@ var __exports__ = (() => {
14820
15069
  return a * Math.sqrt(1 + Math.pow(b, 2));
14821
15070
  }
14822
15071
 
14823
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/sterea.js
15072
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/sterea.js
14824
15073
  function initialize7(state) {
14825
15074
  if (!state.rc) {
14826
15075
  return;
@@ -14878,7 +15127,7 @@ var __exports__ = (() => {
14878
15127
  return state;
14879
15128
  }
14880
15129
 
14881
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/sterea.js
15130
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/sterea.js
14882
15131
  var obliqueStereographic = {
14883
15132
  name: "sterea",
14884
15133
  aliases: [
@@ -14896,32 +15145,32 @@ var __exports__ = (() => {
14896
15145
  }
14897
15146
  };
14898
15147
 
14899
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/mlfn.js
15148
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/mlfn.js
14900
15149
  function mlfn_default(e0, e1, e2, e3, phi) {
14901
15150
  return e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi);
14902
15151
  }
14903
15152
 
14904
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/e0fn.js
15153
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/e0fn.js
14905
15154
  function e0fn_default(x) {
14906
15155
  return 1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x));
14907
15156
  }
14908
15157
 
14909
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/e1fn.js
15158
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/e1fn.js
14910
15159
  function e1fn_default(x) {
14911
15160
  return 0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x));
14912
15161
  }
14913
15162
 
14914
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/e2fn.js
15163
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/e2fn.js
14915
15164
  function e2fn_default(x) {
14916
15165
  return 0.05859375 * x * x * (1 + 0.75 * x);
14917
15166
  }
14918
15167
 
14919
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/e3fn.js
15168
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/e3fn.js
14920
15169
  function e3fn_default(x) {
14921
15170
  return x * x * x * (35 / 3072);
14922
15171
  }
14923
15172
 
14924
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/imlfn.js
15173
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/imlfn.js
14925
15174
  function imlfn_default(ml, e0, e1, e2, e3) {
14926
15175
  var phi;
14927
15176
  var dphi;
@@ -14936,8 +15185,8 @@ var __exports__ = (() => {
14936
15185
  return NaN;
14937
15186
  }
14938
15187
 
14939
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/vincenty.js
14940
- function vincentyInverse(lat1, lon1, lat2, lon2, a, f) {
15188
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/vincenty.js
15189
+ function vincentyInverse(lat1, lon1, lat2, lon2, a, f, output) {
14941
15190
  const L = lon2 - lon1;
14942
15191
  const U1 = Math.atan((1 - f) * Math.tan(lat1));
14943
15192
  const U2 = Math.atan((1 - f) * Math.tan(lat2));
@@ -14951,7 +15200,9 @@ var __exports__ = (() => {
14951
15200
  cosLambda = Math.cos(lambda);
14952
15201
  sinSigma = Math.sqrt(cosU2 * sinLambda * (cosU2 * sinLambda) + (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda) * (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda));
14953
15202
  if (sinSigma === 0) {
14954
- return { azi1: 0, s12: 0 };
15203
+ output.x = 0;
15204
+ output.y = 0;
15205
+ return;
14955
15206
  }
14956
15207
  cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda;
14957
15208
  sigma = Math.atan2(sinSigma, cosSigma);
@@ -14963,7 +15214,9 @@ var __exports__ = (() => {
14963
15214
  lambda = L + (1 - C) * f * sinAlpha * (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));
14964
15215
  } while (Math.abs(lambda - lambdaP) > 1e-12 && --iterLimit > 0);
14965
15216
  if (iterLimit === 0) {
14966
- return { azi1: NaN, s12: NaN };
15217
+ output.x = NaN;
15218
+ output.y = NaN;
15219
+ return;
14967
15220
  }
14968
15221
  uSq = cos2Alpha * (a * a - a * (1 - f) * (a * (1 - f))) / (a * (1 - f) * (a * (1 - f)));
14969
15222
  A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
@@ -14971,9 +15224,10 @@ var __exports__ = (() => {
14971
15224
  deltaSigma = B * sinSigma * (cos2SigmaM + B / 4 * (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) - B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
14972
15225
  s = a * (1 - f) * A * (sigma - deltaSigma);
14973
15226
  const azi1 = Math.atan2(cosU2 * sinLambda, cosU1 * sinU2 - sinU1 * cosU2 * cosLambda);
14974
- return { azi1, s12: s };
15227
+ output.x = azi1;
15228
+ output.y = s;
14975
15229
  }
14976
- function vincentyDirect(lat1, lon1, azi1, s12, a, f) {
15230
+ function vincentyDirect(lat1, lon1, azi1, s12, a, f, output) {
14977
15231
  const U1 = Math.atan((1 - f) * Math.tan(lat1));
14978
15232
  const sinU1 = Math.sin(U1), cosU1 = Math.cos(U1);
14979
15233
  const sinAlpha1 = Math.sin(azi1), cosAlpha1 = Math.cos(azi1);
@@ -14994,7 +15248,9 @@ var __exports__ = (() => {
14994
15248
  sigma = s12 / (a * (1 - f) * A) + deltaSigma;
14995
15249
  } while (Math.abs(sigma - sigmaP) > 1e-12 && --iterLimit > 0);
14996
15250
  if (iterLimit === 0) {
14997
- return { lat2: NaN, lon2: NaN };
15251
+ output.x = NaN;
15252
+ output.y = NaN;
15253
+ return;
14998
15254
  }
14999
15255
  const tmp = sinU1 * sinSigma - cosU1 * cosSigma * cosAlpha1;
15000
15256
  const lat2 = Math.atan2(sinU1 * cosSigma + cosU1 * sinSigma * cosAlpha1, (1 - f) * Math.sqrt(sinAlpha * sinAlpha + tmp * tmp));
@@ -15002,10 +15258,11 @@ var __exports__ = (() => {
15002
15258
  const C = f / 16 * cos2Alpha * (4 + f * (4 - 3 * cos2Alpha));
15003
15259
  const L = lambda - (1 - C) * f * sinAlpha * (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));
15004
15260
  const lon2 = lon1 + L;
15005
- return { lat2, lon2 };
15261
+ output.x = lon2;
15262
+ output.y = lat2;
15006
15263
  }
15007
15264
 
15008
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/aeqd.js
15265
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/aeqd.js
15009
15266
  function initialize8(state) {
15010
15267
  state.sin_p12 = Math.sin(state.lat0);
15011
15268
  state.cos_p12 = Math.cos(state.lat0);
@@ -15020,7 +15277,7 @@ var __exports__ = (() => {
15020
15277
  var sinphi = Math.sin(p.y);
15021
15278
  var cosphi = Math.cos(p.y);
15022
15279
  var dlon = adjust_lon_default(lon - state.long0, state.over);
15023
- var e0, e1, e2, e3, Mlp, Ml, c, kp, cos_c, vars, azi1;
15280
+ var e0, e1, e2, e3, Mlp, Ml, c, kp, cos_c, azi1;
15024
15281
  if (state.sphere) {
15025
15282
  if (Math.abs(state.sin_p12 - 1) <= EPSLN) {
15026
15283
  p.x = state.x0 + state.a * (HALF_PI - lat) * Math.sin(dlon);
@@ -15061,10 +15318,11 @@ var __exports__ = (() => {
15061
15318
  p.y = state.y0;
15062
15319
  return p;
15063
15320
  }
15064
- vars = vincentyInverse(state.lat0, state.long0, lat, lon, state.a, state.f);
15065
- azi1 = vars.azi1;
15066
- p.x = state.x0 + vars.s12 * Math.sin(azi1);
15067
- p.y = state.y0 + vars.s12 * Math.cos(azi1);
15321
+ vincentyInverse(state.lat0, state.long0, lat, lon, state.a, state.f, p);
15322
+ azi1 = p.x;
15323
+ const distance = p.y;
15324
+ p.x = state.x0 + distance * Math.sin(azi1);
15325
+ p.y = state.y0 + distance * Math.cos(azi1);
15068
15326
  return p;
15069
15327
  }
15070
15328
  }
@@ -15072,7 +15330,7 @@ var __exports__ = (() => {
15072
15330
  function inverse8(state, p) {
15073
15331
  p.x -= state.x0;
15074
15332
  p.y -= state.y0;
15075
- var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M2, azi1, s12, vars;
15333
+ var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M2, azi1, s12;
15076
15334
  if (state.sphere) {
15077
15335
  rh = Math.sqrt(p.x * p.x + p.y * p.y);
15078
15336
  if (rh > 2 * HALF_PI * state.a) {
@@ -15126,9 +15384,7 @@ var __exports__ = (() => {
15126
15384
  } else {
15127
15385
  azi1 = Math.atan2(p.x, p.y);
15128
15386
  s12 = Math.sqrt(p.x * p.x + p.y * p.y);
15129
- vars = vincentyDirect(state.lat0, state.long0, azi1, s12, state.a, state.f);
15130
- p.x = vars.lon2;
15131
- p.y = vars.lat2;
15387
+ vincentyDirect(state.lat0, state.long0, azi1, s12, state.a, state.f, p);
15132
15388
  return p;
15133
15389
  }
15134
15390
  }
@@ -15144,7 +15400,7 @@ var __exports__ = (() => {
15144
15400
  return state;
15145
15401
  }
15146
15402
 
15147
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/aeqd.js
15403
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/aeqd.js
15148
15404
  var azimuthalEquidistant = {
15149
15405
  name: "aeqd",
15150
15406
  aliases: ["Azimuthal_Equidistant"],
@@ -15155,28 +15411,28 @@ var __exports__ = (() => {
15155
15411
  }
15156
15412
  };
15157
15413
 
15158
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/sinh.js
15414
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/sinh.js
15159
15415
  function sinh_default(x) {
15160
15416
  var r = Math.exp(x);
15161
15417
  r = (r - 1 / r) / 2;
15162
15418
  return r;
15163
15419
  }
15164
15420
 
15165
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/log1py.js
15421
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/log1py.js
15166
15422
  function log1py_default(x) {
15167
15423
  var y = 1 + x;
15168
15424
  var z = y - 1;
15169
15425
  return z === 0 ? x : x * Math.log(y) / z;
15170
15426
  }
15171
15427
 
15172
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/asinhy.js
15428
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/asinhy.js
15173
15429
  function asinhy_default(x) {
15174
15430
  var y = Math.abs(x);
15175
15431
  y = log1py_default(y * (1 + y / (hypot_default(1, y) + 1)));
15176
15432
  return x < 0 ? -y : y;
15177
15433
  }
15178
15434
 
15179
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/gatg.js
15435
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/gatg.js
15180
15436
  function gatg_default(pp, B) {
15181
15437
  var cos_2B = 2 * Math.cos(2 * B);
15182
15438
  var i = pp.length - 1;
@@ -15191,7 +15447,7 @@ var __exports__ = (() => {
15191
15447
  return B + h * Math.sin(2 * B);
15192
15448
  }
15193
15449
 
15194
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/clens.js
15450
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/clens.js
15195
15451
  function clens_default(pp, arg_r) {
15196
15452
  var r = 2 * Math.cos(arg_r);
15197
15453
  var i = pp.length - 1;
@@ -15206,14 +15462,14 @@ var __exports__ = (() => {
15206
15462
  return Math.sin(arg_r) * hr;
15207
15463
  }
15208
15464
 
15209
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/cosh.js
15465
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/cosh.js
15210
15466
  function cosh_default(x) {
15211
15467
  var r = Math.exp(x);
15212
15468
  r = (r + 1 / r) / 2;
15213
15469
  return r;
15214
15470
  }
15215
15471
 
15216
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/clens_cmplx.js
15472
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/clens_cmplx.js
15217
15473
  function clens_cmplx_default(pp, arg_r, arg_i, output) {
15218
15474
  var sin_arg_r = Math.sin(arg_r);
15219
15475
  var cos_arg_r = Math.cos(arg_r);
@@ -15242,7 +15498,7 @@ var __exports__ = (() => {
15242
15498
  output.y = r * hi + i * hr;
15243
15499
  }
15244
15500
 
15245
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/etmerc.js
15501
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/etmerc.js
15246
15502
  function initialize9(state) {
15247
15503
  state.x0 = state.x0 !== void 0 ? state.x0 : 0;
15248
15504
  state.y0 = state.y0 !== void 0 ? state.y0 : 0;
@@ -15363,7 +15619,7 @@ var __exports__ = (() => {
15363
15619
  return state;
15364
15620
  }
15365
15621
 
15366
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/tmerc.js
15622
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/tmerc.js
15367
15623
  function initialize10(state) {
15368
15624
  state.x0 = state.x0 !== void 0 ? state.x0 : 0;
15369
15625
  state.y0 = state.y0 !== void 0 ? state.y0 : 0;
@@ -15478,7 +15734,7 @@ var __exports__ = (() => {
15478
15734
  return state;
15479
15735
  }
15480
15736
 
15481
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/transverse-mercator.js
15737
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/transverse-mercator.js
15482
15738
  function createTransverseMercator(context) {
15483
15739
  const base = kernelParameters(context);
15484
15740
  if (flagParameter(context.parameters, "approx")) {
@@ -15510,7 +15766,7 @@ var __exports__ = (() => {
15510
15766
  create: createTransverseMercator
15511
15767
  };
15512
15768
 
15513
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/utm.js
15769
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/utm.js
15514
15770
  var universalTransverseMercator = {
15515
15771
  name: "utm",
15516
15772
  aliases: ["Universal Transverse Mercator System"],
@@ -15536,16 +15792,16 @@ var __exports__ = (() => {
15536
15792
  }
15537
15793
  };
15538
15794
 
15539
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/geocentric.js
15795
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/geocentric.js
15540
15796
  var geocentric = {
15541
15797
  name: "geocent",
15542
15798
  aliases: ["Geocentric", "geocentric", "Geocent"],
15543
15799
  parameters: [],
15544
- create({ semiMajorAxis, eccentricitySquared }) {
15800
+ create({ semiMajorAxis, semiMinorAxis, eccentricitySquared }) {
15545
15801
  const ellipsoid = {
15546
15802
  semiMajorAxis,
15547
15803
  eccentricitySquared,
15548
- semiMinorAxis: semiMajorAxis * Math.sqrt(1 - eccentricitySquared)
15804
+ semiMinorAxis: semiMinorAxis ?? semiMajorAxis * Math.sqrt(1 - eccentricitySquared)
15549
15805
  };
15550
15806
  return {
15551
15807
  forward() {
@@ -15562,7 +15818,7 @@ var __exports__ = (() => {
15562
15818
  }
15563
15819
  };
15564
15820
 
15565
- // ../../node_modules/@math.gl/proj4/dist/experimental/catalogue-kernel.js
15821
+ // ../../node_modules/@math.gl/projection/dist/experimental/catalogue-kernel.js
15566
15822
  function catalogueParameters(context) {
15567
15823
  const base = kernelParameters(context);
15568
15824
  return { ...base, x0: 0, y0: 0, lat_ts: Number.isNaN(base.lat_ts) ? 0 : base.lat_ts };
@@ -15589,7 +15845,7 @@ var __exports__ = (() => {
15589
15845
  };
15590
15846
  }
15591
15847
 
15592
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/bonne.js
15848
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/bonne.js
15593
15849
  var EPS10 = 1e-10;
15594
15850
  function initialize11(state) {
15595
15851
  var c;
@@ -15696,7 +15952,7 @@ var __exports__ = (() => {
15696
15952
  return state;
15697
15953
  }
15698
15954
 
15699
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/bonne.js
15955
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/bonne.js
15700
15956
  var bonne = {
15701
15957
  name: "bonne",
15702
15958
  aliases: ["Bonne (Werner lat_1=90)"],
@@ -15710,13 +15966,13 @@ var __exports__ = (() => {
15710
15966
  }
15711
15967
  };
15712
15968
 
15713
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/gN.js
15969
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/gN.js
15714
15970
  function gN_default(a, e, sinphi) {
15715
15971
  var temp = e * sinphi;
15716
15972
  return a / Math.sqrt(1 - temp * temp);
15717
15973
  }
15718
15974
 
15719
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/cass.js
15975
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/cass.js
15720
15976
  function initialize12(state) {
15721
15977
  if (!state.sphere) {
15722
15978
  state.en = pj_enfn_default(state.es);
@@ -15816,7 +16072,7 @@ var __exports__ = (() => {
15816
16072
  return state;
15817
16073
  }
15818
16074
 
15819
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/cass.js
16075
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/cass.js
15820
16076
  var cassiniSoldner = {
15821
16077
  name: "cass",
15822
16078
  aliases: ["Cassini", "Cassini_Soldner"],
@@ -15828,7 +16084,7 @@ var __exports__ = (() => {
15828
16084
  }
15829
16085
  };
15830
16086
 
15831
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/iqsfnz.js
16087
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/iqsfnz.js
15832
16088
  function iqsfnz_default(eccent, q) {
15833
16089
  var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
15834
16090
  const roundoff = 4 * Number.EPSILON * temp;
@@ -15859,7 +16115,7 @@ var __exports__ = (() => {
15859
16115
  return NaN;
15860
16116
  }
15861
16117
 
15862
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/cea.js
16118
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/cea.js
15863
16119
  function initialize13(state) {
15864
16120
  if (!state.sphere) {
15865
16121
  state.k0 = msfnz_default(state.e, Math.sin(state.lat_ts), Math.cos(state.lat_ts));
@@ -15906,7 +16162,7 @@ var __exports__ = (() => {
15906
16162
  return state;
15907
16163
  }
15908
16164
 
15909
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/cea.js
16165
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/cea.js
15910
16166
  var cylindricalEqualArea = {
15911
16167
  name: "cea",
15912
16168
  aliases: [],
@@ -15920,7 +16176,7 @@ var __exports__ = (() => {
15920
16176
  }
15921
16177
  };
15922
16178
 
15923
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/sinu.js
16179
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/sinu.js
15924
16180
  var MAX_ITER3 = 20;
15925
16181
  function initialize14(state) {
15926
16182
  state.long0 = state.long0 || 0;
@@ -16001,7 +16257,7 @@ var __exports__ = (() => {
16001
16257
  return state;
16002
16258
  }
16003
16259
 
16004
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/eck6.js
16260
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/eck6.js
16005
16261
  function initialize15(state) {
16006
16262
  state.sphere = true;
16007
16263
  state.b = state.a;
@@ -16019,7 +16275,7 @@ var __exports__ = (() => {
16019
16275
  return state;
16020
16276
  }
16021
16277
 
16022
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/eck6.js
16278
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/eck6.js
16023
16279
  var eckertVI = {
16024
16280
  name: "eck6",
16025
16281
  aliases: ["Eckert_VI"],
@@ -16031,7 +16287,7 @@ var __exports__ = (() => {
16031
16287
  }
16032
16288
  };
16033
16289
 
16034
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/eqearth.js
16290
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/eqearth.js
16035
16291
  var A1 = 1.340264;
16036
16292
  var A2 = -0.081106;
16037
16293
  var A3 = 893e-6;
@@ -16099,7 +16355,7 @@ var __exports__ = (() => {
16099
16355
  return state;
16100
16356
  }
16101
16357
 
16102
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/eqearth.js
16358
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/eqearth.js
16103
16359
  var equalEarth = {
16104
16360
  name: "eqearth",
16105
16361
  aliases: ["Equal Earth", "Equal_Earth"],
@@ -16111,7 +16367,7 @@ var __exports__ = (() => {
16111
16367
  }
16112
16368
  };
16113
16369
 
16114
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/equi.js
16370
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/equi.js
16115
16371
  function initialize17(state) {
16116
16372
  state.x0 = state.x0 || 0;
16117
16373
  state.y0 = state.y0 || 0;
@@ -16145,7 +16401,7 @@ var __exports__ = (() => {
16145
16401
  return state;
16146
16402
  }
16147
16403
 
16148
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/equi.js
16404
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/equi.js
16149
16405
  var equirectangular = {
16150
16406
  name: "equi",
16151
16407
  aliases: [],
@@ -16159,7 +16415,7 @@ var __exports__ = (() => {
16159
16415
  }
16160
16416
  };
16161
16417
 
16162
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/geos.js
16418
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/geos.js
16163
16419
  function initialize18(state) {
16164
16420
  state.flip_axis = state.sweep === "x" ? 1 : 0;
16165
16421
  state.h = Number(state.h);
@@ -16301,7 +16557,7 @@ var __exports__ = (() => {
16301
16557
  return state;
16302
16558
  }
16303
16559
 
16304
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/geos.js
16560
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/geos.js
16305
16561
  var geostationary = {
16306
16562
  name: "geos",
16307
16563
  aliases: ["Geostationary Satellite View", "Geostationary_Satellite"],
@@ -16319,7 +16575,7 @@ var __exports__ = (() => {
16319
16575
  }
16320
16576
  };
16321
16577
 
16322
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/gnom.js
16578
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/gnom.js
16323
16579
  function initialize19(state) {
16324
16580
  state.sin_p14 = Math.sin(state.lat0);
16325
16581
  state.cos_p14 = Math.cos(state.lat0);
@@ -16391,7 +16647,7 @@ var __exports__ = (() => {
16391
16647
  return state;
16392
16648
  }
16393
16649
 
16394
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/gnom.js
16650
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/gnom.js
16395
16651
  var gnomonic = {
16396
16652
  name: "gnom",
16397
16653
  aliases: [],
@@ -16403,7 +16659,7 @@ var __exports__ = (() => {
16403
16659
  }
16404
16660
  };
16405
16661
 
16406
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/latiso.js
16662
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/latiso.js
16407
16663
  function latiso_default(eccent, phi, sinphi) {
16408
16664
  if (Math.abs(phi) > HALF_PI) {
16409
16665
  return Number.NaN;
@@ -16418,12 +16674,12 @@ var __exports__ = (() => {
16418
16674
  return Math.log(Math.tan((HALF_PI + phi) / 2)) + eccent * Math.log((1 - con) / (1 + con)) / 2;
16419
16675
  }
16420
16676
 
16421
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/fL.js
16677
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/fL.js
16422
16678
  function fL_default(x, L) {
16423
16679
  return 2 * Math.atan(x * Math.exp(L)) - HALF_PI;
16424
16680
  }
16425
16681
 
16426
- // ../../node_modules/@math.gl/proj4/dist/experimental/common/invlatiso.js
16682
+ // ../../node_modules/@math.gl/projection/dist/experimental/common/invlatiso.js
16427
16683
  function invlatiso_default(eccent, ts) {
16428
16684
  var phi = fL_default(1, ts);
16429
16685
  var Iphi = 0;
@@ -16439,7 +16695,7 @@ var __exports__ = (() => {
16439
16695
  return phi;
16440
16696
  }
16441
16697
 
16442
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/gstmerc.js
16698
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/gstmerc.js
16443
16699
  function initialize20(state) {
16444
16700
  if (!state.k0) {
16445
16701
  state.k0 = 1;
@@ -16483,7 +16739,7 @@ var __exports__ = (() => {
16483
16739
  return state;
16484
16740
  }
16485
16741
 
16486
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/gstmerc.js
16742
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/gstmerc.js
16487
16743
  var gaussSchreiberTransverseMercator = {
16488
16744
  name: "gstmerc",
16489
16745
  aliases: ["gstmerg"],
@@ -16495,7 +16751,7 @@ var __exports__ = (() => {
16495
16751
  }
16496
16752
  };
16497
16753
 
16498
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/krovak.js
16754
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/krovak.js
16499
16755
  function initialize21(state) {
16500
16756
  state.a = 6377397155e-3;
16501
16757
  state.es = 0.006674372230614;
@@ -16595,7 +16851,7 @@ var __exports__ = (() => {
16595
16851
  return state;
16596
16852
  }
16597
16853
 
16598
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/krovak.js
16854
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/krovak.js
16599
16855
  var krovak = {
16600
16856
  name: "krovak",
16601
16857
  aliases: [
@@ -16622,7 +16878,7 @@ var __exports__ = (() => {
16622
16878
  }
16623
16879
  };
16624
16880
 
16625
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/mill.js
16881
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/mill.js
16626
16882
  function initialize22(state) {
16627
16883
  }
16628
16884
  function forward22(state, p) {
@@ -16653,7 +16909,7 @@ var __exports__ = (() => {
16653
16909
  return state;
16654
16910
  }
16655
16911
 
16656
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/mill.js
16912
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/mill.js
16657
16913
  var millerCylindrical = {
16658
16914
  name: "mill",
16659
16915
  aliases: ["Miller_Cylindrical"],
@@ -16665,7 +16921,7 @@ var __exports__ = (() => {
16665
16921
  }
16666
16922
  };
16667
16923
 
16668
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/moll.js
16924
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/moll.js
16669
16925
  function initialize23(state) {
16670
16926
  state.x0 = state.x0 !== void 0 ? state.x0 : 0;
16671
16927
  state.y0 = state.y0 !== void 0 ? state.y0 : 0;
@@ -16735,7 +16991,7 @@ var __exports__ = (() => {
16735
16991
  return state;
16736
16992
  }
16737
16993
 
16738
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/moll.js
16994
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/moll.js
16739
16995
  var mollweide = {
16740
16996
  name: "moll",
16741
16997
  aliases: ["Mollweide"],
@@ -16747,7 +17003,7 @@ var __exports__ = (() => {
16747
17003
  }
16748
17004
  };
16749
17005
 
16750
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/nzmg.js
17006
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/nzmg.js
16751
17007
  function initialize24(state) {
16752
17008
  state.A = [];
16753
17009
  state.A[1] = 0.6399175073;
@@ -16916,7 +17172,7 @@ var __exports__ = (() => {
16916
17172
  return state;
16917
17173
  }
16918
17174
 
16919
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/nzmg.js
17175
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/nzmg.js
16920
17176
  var newZealandMapGrid = {
16921
17177
  name: "nzmg",
16922
17178
  aliases: ["New_Zealand_Map_Grid"],
@@ -16933,7 +17189,7 @@ var __exports__ = (() => {
16933
17189
  }
16934
17190
  };
16935
17191
 
16936
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/omerc.js
17192
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/omerc.js
16937
17193
  var TOL = 1e-7;
16938
17194
  function isTypeA(P) {
16939
17195
  return P.no_uoff || P.no_off || [
@@ -17058,7 +17314,7 @@ var __exports__ = (() => {
17058
17314
  state.v_pole_s = state.ArB * Math.log(Math.tan(FORTPI + F));
17059
17315
  }
17060
17316
  function forward25(state, p) {
17061
- var coords = { x: 0, y: 0 };
17317
+ var coords = p;
17062
17318
  var S, T, U, V, W, temp, u, v;
17063
17319
  p.x = p.x - state.lam0;
17064
17320
  if (Math.abs(Math.abs(p.y) - HALF_PI) > EPSLN) {
@@ -17096,7 +17352,7 @@ var __exports__ = (() => {
17096
17352
  }
17097
17353
  function inverse25(state, p) {
17098
17354
  var u, v, Qp, Sp, Tp, Vp, Up;
17099
- var coords = { x: 0, y: 0 };
17355
+ var coords = p;
17100
17356
  p.x = (p.x - state.x0) * (1 / state.a);
17101
17357
  p.y = (p.y - state.y0) * (1 / state.a);
17102
17358
  if (state.no_rot) {
@@ -17157,7 +17413,7 @@ var __exports__ = (() => {
17157
17413
  return state;
17158
17414
  }
17159
17415
 
17160
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/omerc.js
17416
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/omerc.js
17161
17417
  var obliqueMercator = {
17162
17418
  name: "omerc",
17163
17419
  aliases: [
@@ -17213,7 +17469,7 @@ var __exports__ = (() => {
17213
17469
  }
17214
17470
  };
17215
17471
 
17216
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/ortho.js
17472
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/ortho.js
17217
17473
  function initialize26(state) {
17218
17474
  state.sin_p14 = Math.sin(state.lat0 || 0);
17219
17475
  state.cos_p14 = Math.cos(state.lat0 || 0);
@@ -17287,7 +17543,7 @@ var __exports__ = (() => {
17287
17543
  return state;
17288
17544
  }
17289
17545
 
17290
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/ortho.js
17546
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/ortho.js
17291
17547
  var orthographic = {
17292
17548
  name: "ortho",
17293
17549
  aliases: [],
@@ -17299,7 +17555,7 @@ var __exports__ = (() => {
17299
17555
  }
17300
17556
  };
17301
17557
 
17302
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/poly.js
17558
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/poly.js
17303
17559
  var MAX_ITER4 = 20;
17304
17560
  function initialize27(state) {
17305
17561
  state.temp = state.b / state.a;
@@ -17402,7 +17658,7 @@ var __exports__ = (() => {
17402
17658
  return state;
17403
17659
  }
17404
17660
 
17405
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/poly.js
17661
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/poly.js
17406
17662
  var polyconic = {
17407
17663
  name: "poly",
17408
17664
  aliases: ["Polyconic", "American_Polyconic"],
@@ -17414,7 +17670,7 @@ var __exports__ = (() => {
17414
17670
  }
17415
17671
  };
17416
17672
 
17417
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/qsc.js
17673
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/qsc.js
17418
17674
  var FACE_ENUM = {
17419
17675
  FRONT: 1,
17420
17676
  RIGHT: 2,
@@ -17452,11 +17708,11 @@ var __exports__ = (() => {
17452
17708
  }
17453
17709
  }
17454
17710
  function forward28(state, p) {
17455
- var xy = { x: 0, y: 0 };
17711
+ var xy = p;
17456
17712
  var lat, lon;
17457
17713
  var theta, phi;
17458
17714
  var t, mu;
17459
- var area = { value: 0 };
17715
+ var area = 0;
17460
17716
  p.x -= state.long0;
17461
17717
  if (state.es !== 0) {
17462
17718
  lat = Math.atan(state.one_minus_f_squared * Math.tan(p.y));
@@ -17467,31 +17723,31 @@ var __exports__ = (() => {
17467
17723
  if (state.face === FACE_ENUM.TOP) {
17468
17724
  phi = HALF_PI - lat;
17469
17725
  if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
17470
- area.value = AREA_ENUM.AREA_0;
17726
+ area = AREA_ENUM.AREA_0;
17471
17727
  theta = lon - HALF_PI;
17472
17728
  } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
17473
- area.value = AREA_ENUM.AREA_1;
17729
+ area = AREA_ENUM.AREA_1;
17474
17730
  theta = lon > 0 ? lon - SPI : lon + SPI;
17475
17731
  } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
17476
- area.value = AREA_ENUM.AREA_2;
17732
+ area = AREA_ENUM.AREA_2;
17477
17733
  theta = lon + HALF_PI;
17478
17734
  } else {
17479
- area.value = AREA_ENUM.AREA_3;
17735
+ area = AREA_ENUM.AREA_3;
17480
17736
  theta = lon;
17481
17737
  }
17482
17738
  } else if (state.face === FACE_ENUM.BOTTOM) {
17483
17739
  phi = HALF_PI + lat;
17484
17740
  if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
17485
- area.value = AREA_ENUM.AREA_0;
17741
+ area = AREA_ENUM.AREA_0;
17486
17742
  theta = -lon + HALF_PI;
17487
17743
  } else if (lon < FORTPI && lon >= -FORTPI) {
17488
- area.value = AREA_ENUM.AREA_1;
17744
+ area = AREA_ENUM.AREA_1;
17489
17745
  theta = -lon;
17490
17746
  } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {
17491
- area.value = AREA_ENUM.AREA_2;
17747
+ area = AREA_ENUM.AREA_2;
17492
17748
  theta = -lon - HALF_PI;
17493
17749
  } else {
17494
- area.value = AREA_ENUM.AREA_3;
17750
+ area = AREA_ENUM.AREA_3;
17495
17751
  theta = lon > 0 ? -lon + SPI : -lon - SPI;
17496
17752
  }
17497
17753
  } else {
@@ -17514,58 +17770,67 @@ var __exports__ = (() => {
17514
17770
  s = sinlat;
17515
17771
  if (state.face === FACE_ENUM.FRONT) {
17516
17772
  phi = Math.acos(q);
17517
- theta = qsc_fwd_equat_face_theta(phi, s, r, area);
17773
+ theta = qsc_fwd_equat_face_theta(phi, s, r);
17518
17774
  } else if (state.face === FACE_ENUM.RIGHT) {
17519
17775
  phi = Math.acos(r);
17520
- theta = qsc_fwd_equat_face_theta(phi, s, -q, area);
17776
+ theta = qsc_fwd_equat_face_theta(phi, s, -q);
17521
17777
  } else if (state.face === FACE_ENUM.BACK) {
17522
17778
  phi = Math.acos(-q);
17523
- theta = qsc_fwd_equat_face_theta(phi, s, -r, area);
17779
+ theta = qsc_fwd_equat_face_theta(phi, s, -r);
17524
17780
  } else if (state.face === FACE_ENUM.LEFT) {
17525
17781
  phi = Math.acos(-r);
17526
- theta = qsc_fwd_equat_face_theta(phi, s, q, area);
17782
+ theta = qsc_fwd_equat_face_theta(phi, s, q);
17527
17783
  } else {
17528
17784
  phi = theta = 0;
17529
- area.value = AREA_ENUM.AREA_0;
17785
+ }
17786
+ if (Math.abs(theta) <= FORTPI) {
17787
+ area = AREA_ENUM.AREA_0;
17788
+ } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
17789
+ area = AREA_ENUM.AREA_1;
17790
+ theta -= HALF_PI;
17791
+ } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
17792
+ area = AREA_ENUM.AREA_2;
17793
+ theta = theta >= 0 ? theta - SPI : theta + SPI;
17794
+ } else {
17795
+ area = AREA_ENUM.AREA_3;
17796
+ theta += HALF_PI;
17530
17797
  }
17531
17798
  }
17532
17799
  mu = Math.atan(12 / SPI * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
17533
17800
  t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
17534
- if (area.value === AREA_ENUM.AREA_1) {
17801
+ if (area === AREA_ENUM.AREA_1) {
17535
17802
  mu += HALF_PI;
17536
- } else if (area.value === AREA_ENUM.AREA_2) {
17803
+ } else if (area === AREA_ENUM.AREA_2) {
17537
17804
  mu += SPI;
17538
- } else if (area.value === AREA_ENUM.AREA_3) {
17805
+ } else if (area === AREA_ENUM.AREA_3) {
17539
17806
  mu += 1.5 * SPI;
17540
17807
  }
17541
17808
  xy.x = t * Math.cos(mu);
17542
17809
  xy.y = t * Math.sin(mu);
17543
17810
  xy.x = xy.x * state.a + state.x0;
17544
17811
  xy.y = xy.y * state.a + state.y0;
17545
- p.x = xy.x;
17546
- p.y = xy.y;
17547
17812
  return p;
17548
17813
  }
17549
17814
  function inverse28(state, p) {
17550
- var lp = { lam: 0, phi: 0 };
17815
+ var lam = 0, latitude = 0;
17551
17816
  var mu, nu, cosmu, tannu;
17552
17817
  var tantheta, theta, cosphi, phi;
17553
17818
  var t;
17554
- var area = { value: 0 };
17819
+ var area = 0;
17555
17820
  p.x = (p.x - state.x0) / state.a;
17556
17821
  p.y = (p.y - state.y0) / state.a;
17557
17822
  nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
17558
17823
  mu = Math.atan2(p.y, p.x);
17559
17824
  if (p.x >= 0 && p.x >= Math.abs(p.y)) {
17560
- area.value = AREA_ENUM.AREA_0;
17825
+ area = AREA_ENUM.AREA_0;
17561
17826
  } else if (p.y >= 0 && p.y >= Math.abs(p.x)) {
17562
- area.value = AREA_ENUM.AREA_1;
17827
+ area = AREA_ENUM.AREA_1;
17563
17828
  mu -= HALF_PI;
17564
17829
  } else if (p.x < 0 && -p.x >= Math.abs(p.y)) {
17565
- area.value = AREA_ENUM.AREA_2;
17830
+ area = AREA_ENUM.AREA_2;
17566
17831
  mu = mu < 0 ? mu + SPI : mu - SPI;
17567
17832
  } else {
17568
- area.value = AREA_ENUM.AREA_3;
17833
+ area = AREA_ENUM.AREA_3;
17569
17834
  mu += HALF_PI;
17570
17835
  }
17571
17836
  t = SPI / 12 * Math.tan(mu);
@@ -17581,27 +17846,27 @@ var __exports__ = (() => {
17581
17846
  }
17582
17847
  if (state.face === FACE_ENUM.TOP) {
17583
17848
  phi = Math.acos(cosphi);
17584
- lp.phi = HALF_PI - phi;
17585
- if (area.value === AREA_ENUM.AREA_0) {
17586
- lp.lam = theta + HALF_PI;
17587
- } else if (area.value === AREA_ENUM.AREA_1) {
17588
- lp.lam = theta < 0 ? theta + SPI : theta - SPI;
17589
- } else if (area.value === AREA_ENUM.AREA_2) {
17590
- lp.lam = theta - HALF_PI;
17849
+ latitude = HALF_PI - phi;
17850
+ if (area === AREA_ENUM.AREA_0) {
17851
+ lam = theta + HALF_PI;
17852
+ } else if (area === AREA_ENUM.AREA_1) {
17853
+ lam = theta < 0 ? theta + SPI : theta - SPI;
17854
+ } else if (area === AREA_ENUM.AREA_2) {
17855
+ lam = theta - HALF_PI;
17591
17856
  } else {
17592
- lp.lam = theta;
17857
+ lam = theta;
17593
17858
  }
17594
17859
  } else if (state.face === FACE_ENUM.BOTTOM) {
17595
17860
  phi = Math.acos(cosphi);
17596
- lp.phi = phi - HALF_PI;
17597
- if (area.value === AREA_ENUM.AREA_0) {
17598
- lp.lam = -theta + HALF_PI;
17599
- } else if (area.value === AREA_ENUM.AREA_1) {
17600
- lp.lam = -theta;
17601
- } else if (area.value === AREA_ENUM.AREA_2) {
17602
- lp.lam = -theta - HALF_PI;
17861
+ latitude = phi - HALF_PI;
17862
+ if (area === AREA_ENUM.AREA_0) {
17863
+ lam = -theta + HALF_PI;
17864
+ } else if (area === AREA_ENUM.AREA_1) {
17865
+ lam = -theta;
17866
+ } else if (area === AREA_ENUM.AREA_2) {
17867
+ lam = -theta - HALF_PI;
17603
17868
  } else {
17604
- lp.lam = theta < 0 ? -theta - SPI : -theta + SPI;
17869
+ lam = theta < 0 ? -theta - SPI : -theta + SPI;
17605
17870
  }
17606
17871
  } else {
17607
17872
  var q, r, s;
@@ -17618,14 +17883,14 @@ var __exports__ = (() => {
17618
17883
  } else {
17619
17884
  r = Math.sqrt(1 - t);
17620
17885
  }
17621
- if (area.value === AREA_ENUM.AREA_1) {
17886
+ if (area === AREA_ENUM.AREA_1) {
17622
17887
  t = r;
17623
17888
  r = -s;
17624
17889
  s = t;
17625
- } else if (area.value === AREA_ENUM.AREA_2) {
17890
+ } else if (area === AREA_ENUM.AREA_2) {
17626
17891
  r = -r;
17627
17892
  s = -s;
17628
- } else if (area.value === AREA_ENUM.AREA_3) {
17893
+ } else if (area === AREA_ENUM.AREA_3) {
17629
17894
  t = r;
17630
17895
  r = s;
17631
17896
  s = -t;
@@ -17642,53 +17907,34 @@ var __exports__ = (() => {
17642
17907
  q = r;
17643
17908
  r = -t;
17644
17909
  }
17645
- lp.phi = Math.acos(-s) - HALF_PI;
17646
- lp.lam = Math.atan2(r, q);
17910
+ latitude = Math.acos(-s) - HALF_PI;
17911
+ lam = Math.atan2(r, q);
17647
17912
  if (state.face === FACE_ENUM.RIGHT) {
17648
- lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
17913
+ lam = qsc_shift_lon_origin(lam, -HALF_PI);
17649
17914
  } else if (state.face === FACE_ENUM.BACK) {
17650
- lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
17915
+ lam = qsc_shift_lon_origin(lam, -SPI);
17651
17916
  } else if (state.face === FACE_ENUM.LEFT) {
17652
- lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
17917
+ lam = qsc_shift_lon_origin(lam, +HALF_PI);
17653
17918
  }
17654
17919
  }
17655
17920
  if (state.es !== 0) {
17656
17921
  var invert_sign;
17657
17922
  var tanphi, xa;
17658
- invert_sign = lp.phi < 0 ? 1 : 0;
17659
- tanphi = Math.tan(lp.phi);
17923
+ invert_sign = latitude < 0 ? 1 : 0;
17924
+ tanphi = Math.tan(latitude);
17660
17925
  xa = state.b / Math.sqrt(tanphi * tanphi + state.one_minus_f_squared);
17661
- lp.phi = Math.atan(Math.sqrt(state.a * state.a - xa * xa) / (state.one_minus_f * xa));
17926
+ latitude = Math.atan(Math.sqrt(state.a * state.a - xa * xa) / (state.one_minus_f * xa));
17662
17927
  if (invert_sign) {
17663
- lp.phi = -lp.phi;
17928
+ latitude = -latitude;
17664
17929
  }
17665
17930
  }
17666
- lp.lam += state.long0;
17667
- p.x = lp.lam;
17668
- p.y = lp.phi;
17931
+ lam += state.long0;
17932
+ p.x = lam;
17933
+ p.y = latitude;
17669
17934
  return p;
17670
17935
  }
17671
- function qsc_fwd_equat_face_theta(phi, y, x, area) {
17672
- var theta;
17673
- if (phi < EPSLN) {
17674
- area.value = AREA_ENUM.AREA_0;
17675
- theta = 0;
17676
- } else {
17677
- theta = Math.atan2(y, x);
17678
- if (Math.abs(theta) <= FORTPI) {
17679
- area.value = AREA_ENUM.AREA_0;
17680
- } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
17681
- area.value = AREA_ENUM.AREA_1;
17682
- theta -= HALF_PI;
17683
- } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
17684
- area.value = AREA_ENUM.AREA_2;
17685
- theta = theta >= 0 ? theta - SPI : theta + SPI;
17686
- } else {
17687
- area.value = AREA_ENUM.AREA_3;
17688
- theta += HALF_PI;
17689
- }
17690
- }
17691
- return theta;
17936
+ function qsc_fwd_equat_face_theta(phi, y, x) {
17937
+ return phi < EPSLN ? 0 : Math.atan2(y, x);
17692
17938
  }
17693
17939
  function qsc_shift_lon_origin(lon, offset) {
17694
17940
  var slon = lon + offset;
@@ -17705,7 +17951,7 @@ var __exports__ = (() => {
17705
17951
  return state;
17706
17952
  }
17707
17953
 
17708
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/qsc.js
17954
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/qsc.js
17709
17955
  var quadrilateralizedSphericalCube = {
17710
17956
  name: "qsc",
17711
17957
  aliases: ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube"],
@@ -17717,7 +17963,7 @@ var __exports__ = (() => {
17717
17963
  }
17718
17964
  };
17719
17965
 
17720
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/robin.js
17966
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/robin.js
17721
17967
  var COEFS_X = [
17722
17968
  [1, 22199e-21, -715515e-10, 31103e-10],
17723
17969
  [0.9986, -482243e-9, -24897e-9, -13309e-10],
@@ -17773,10 +18019,10 @@ var __exports__ = (() => {
17773
18019
  var poly3_der = function(coefs, x) {
17774
18020
  return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
17775
18021
  };
17776
- function newton_rapshon(f_df, start, max_err, iters) {
18022
+ function newton_rapshon(coefs, target, start, max_err, iters) {
17777
18023
  var x = start;
17778
18024
  for (; iters; --iters) {
17779
- var upd = f_df(x);
18025
+ var upd = (poly3_val(coefs, x) - target) / poly3_der(coefs, x);
17780
18026
  x -= upd;
17781
18027
  if (Math.abs(upd) < max_err) {
17782
18028
  break;
@@ -17800,32 +18046,30 @@ var __exports__ = (() => {
17800
18046
  i = NODES;
17801
18047
  }
17802
18048
  dphi = R2D * (dphi - RC1 * i);
17803
- var xy = {
17804
- x: poly3_val(COEFS_X[i], dphi) * lon,
17805
- y: poly3_val(COEFS_Y[i], dphi)
17806
- };
18049
+ var x = poly3_val(COEFS_X[i], dphi) * lon;
18050
+ var y = poly3_val(COEFS_Y[i], dphi);
17807
18051
  if (ll.y < 0) {
17808
- xy.y = -xy.y;
18052
+ y = -y;
17809
18053
  }
17810
- xy.x = xy.x * state.a * FXC + state.x0;
17811
- xy.y = xy.y * state.a * FYC + state.y0;
17812
- return xy;
18054
+ ll.x = x * state.a * FXC + state.x0;
18055
+ ll.y = y * state.a * FYC + state.y0;
18056
+ return ll;
17813
18057
  }
17814
18058
  function inverse29(state, xy) {
17815
- var ll = {
17816
- x: (xy.x - state.x0) / (state.a * FXC),
17817
- y: Math.abs(xy.y - state.y0) / (state.a * FYC)
17818
- };
18059
+ var originalY = xy.y;
18060
+ var ll = xy;
18061
+ ll.x = (ll.x - state.x0) / (state.a * FXC);
18062
+ ll.y = Math.abs(originalY - state.y0) / (state.a * FYC);
17819
18063
  for (let knot = 0; knot <= NODES; knot++) {
17820
18064
  if (Math.abs(ll.y - COEFS_Y[knot][0]) <= 8 * Number.EPSILON) {
17821
18065
  ll.x = adjust_lon_default(ll.x / COEFS_X[knot][0] + state.long0, state.over);
17822
- ll.y = (xy.y < state.y0 ? -1 : 1) * knot * 5 * D2R;
18066
+ ll.y = (originalY < state.y0 ? -1 : 1) * knot * 5 * D2R;
17823
18067
  return ll;
17824
18068
  }
17825
18069
  }
17826
18070
  if (ll.y >= 1) {
17827
18071
  ll.x /= COEFS_X[NODES][0];
17828
- ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
18072
+ ll.y = originalY < 0 ? -HALF_PI : HALF_PI;
17829
18073
  } else {
17830
18074
  var i = Math.floor(ll.y * NODES);
17831
18075
  if (i < 0) {
@@ -17844,12 +18088,10 @@ var __exports__ = (() => {
17844
18088
  }
17845
18089
  var coefs = COEFS_Y[i];
17846
18090
  var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i + 1][0] - coefs[0]);
17847
- t = newton_rapshon(function(x) {
17848
- return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
17849
- }, t, EPSLN, 100);
18091
+ t = newton_rapshon(coefs, ll.y, t, EPSLN, 100);
17850
18092
  ll.x /= poly3_val(COEFS_X[i], t);
17851
18093
  ll.y = (5 * i + t) * D2R;
17852
- if (xy.y < 0) {
18094
+ if (originalY < 0) {
17853
18095
  ll.y = -ll.y;
17854
18096
  }
17855
18097
  }
@@ -17865,7 +18107,7 @@ var __exports__ = (() => {
17865
18107
  return state;
17866
18108
  }
17867
18109
 
17868
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/robin.js
18110
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/robin.js
17869
18111
  var robinson = {
17870
18112
  name: "robin",
17871
18113
  aliases: ["Robinson"],
@@ -17877,7 +18119,7 @@ var __exports__ = (() => {
17877
18119
  }
17878
18120
  };
17879
18121
 
17880
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/sinu.js
18122
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/sinu.js
17881
18123
  var sinusoidal = {
17882
18124
  name: "sinu",
17883
18125
  aliases: ["Sinusoidal"],
@@ -17889,7 +18131,7 @@ var __exports__ = (() => {
17889
18131
  }
17890
18132
  };
17891
18133
 
17892
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/somerc.js
18134
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/somerc.js
17893
18135
  function initialize30(state) {
17894
18136
  if (!state.k0) {
17895
18137
  state.k0 = 1;
@@ -17953,7 +18195,7 @@ var __exports__ = (() => {
17953
18195
  return state;
17954
18196
  }
17955
18197
 
17956
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/somerc.js
18198
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/somerc.js
17957
18199
  var swissObliqueMercator = {
17958
18200
  name: "somerc",
17959
18201
  aliases: [],
@@ -17965,7 +18207,7 @@ var __exports__ = (() => {
17965
18207
  }
17966
18208
  };
17967
18209
 
17968
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/tpers.js
18210
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/tpers.js
17969
18211
  var mode = {
17970
18212
  N_POLE: 0,
17971
18213
  S_POLE: 1,
@@ -18046,7 +18288,7 @@ var __exports__ = (() => {
18046
18288
  function inverse31(state, p) {
18047
18289
  p.x /= state.a;
18048
18290
  p.y /= state.a;
18049
- var r = { x: p.x, y: p.y };
18291
+ var rx = p.x, ry = p.y;
18050
18292
  var bm, bq, yt;
18051
18293
  yt = 1 / (state.pn1 - p.y * state.sw);
18052
18294
  bm = state.pn1 * p.x * yt;
@@ -18055,8 +18297,8 @@ var __exports__ = (() => {
18055
18297
  p.y = bq * state.cg - bm * state.sg;
18056
18298
  var rh = hypot_default(p.x, p.y);
18057
18299
  if (Math.abs(rh) < EPSLN) {
18058
- r.x = 0;
18059
- r.y = state.lat0;
18300
+ rx = 0;
18301
+ ry = state.lat0;
18060
18302
  } else {
18061
18303
  var cosz, sinz;
18062
18304
  sinz = 1 - rh * rh * state.pfact;
@@ -18064,27 +18306,27 @@ var __exports__ = (() => {
18064
18306
  cosz = Math.sqrt(1 - sinz * sinz);
18065
18307
  switch (state.mode) {
18066
18308
  case mode.OBLIQ:
18067
- r.y = Math.asin(cosz * state.sinph0 + p.y * sinz * state.cosph0 / rh);
18068
- p.y = (cosz - state.sinph0 * Math.sin(r.y)) * rh;
18309
+ ry = Math.asin(cosz * state.sinph0 + p.y * sinz * state.cosph0 / rh);
18310
+ p.y = (cosz - state.sinph0 * Math.sin(ry)) * rh;
18069
18311
  p.x *= sinz * state.cosph0;
18070
18312
  break;
18071
18313
  case mode.EQUIT:
18072
- r.y = Math.asin(p.y * sinz / rh);
18314
+ ry = Math.asin(p.y * sinz / rh);
18073
18315
  p.y = cosz * rh;
18074
18316
  p.x *= sinz;
18075
18317
  break;
18076
18318
  case mode.N_POLE:
18077
- r.y = Math.asin(cosz);
18319
+ ry = Math.asin(cosz);
18078
18320
  p.y = -p.y;
18079
18321
  break;
18080
18322
  case mode.S_POLE:
18081
- r.y = -Math.asin(cosz);
18323
+ ry = -Math.asin(cosz);
18082
18324
  break;
18083
18325
  }
18084
- r.x = Math.atan2(p.x, p.y);
18326
+ rx = Math.atan2(p.x, p.y);
18085
18327
  }
18086
- p.x = r.x + state.long0;
18087
- p.y = r.y;
18328
+ p.x = rx + state.long0;
18329
+ p.y = ry;
18088
18330
  return p;
18089
18331
  }
18090
18332
  function createState31(base, options = {}) {
@@ -18111,7 +18353,7 @@ var __exports__ = (() => {
18111
18353
  return state;
18112
18354
  }
18113
18355
 
18114
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/tpers.js
18356
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/tpers.js
18115
18357
  var tiltedPerspective = {
18116
18358
  name: "tpers",
18117
18359
  aliases: ["Tilted_Perspective"],
@@ -18128,7 +18370,7 @@ var __exports__ = (() => {
18128
18370
  }
18129
18371
  };
18130
18372
 
18131
- // ../../node_modules/@math.gl/proj4/dist/experimental/kernels/vandg.js
18373
+ // ../../node_modules/@math.gl/projection/dist/experimental/kernels/vandg.js
18132
18374
  function initialize32(state) {
18133
18375
  state.R = state.a;
18134
18376
  }
@@ -18234,7 +18476,7 @@ var __exports__ = (() => {
18234
18476
  return state;
18235
18477
  }
18236
18478
 
18237
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/vandg.js
18479
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/vandg.js
18238
18480
  var vanDerGrinten = {
18239
18481
  name: "vandg",
18240
18482
  aliases: ["Van_der_Grinten_I", "VanDerGrinten", "Van_der_Grinten"],
@@ -18246,7 +18488,7 @@ var __exports__ = (() => {
18246
18488
  }
18247
18489
  };
18248
18490
 
18249
- // ../../node_modules/@math.gl/proj4/dist/experimental/projections/ob-tran.js
18491
+ // ../../node_modules/@math.gl/projection/dist/experimental/projections/ob-tran.js
18250
18492
  var rotationParameters = [
18251
18493
  "o_proj",
18252
18494
  "o_alpha",
@@ -18351,7 +18593,7 @@ var __exports__ = (() => {
18351
18593
  };
18352
18594
  }
18353
18595
 
18354
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/structured.js
18596
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/structured.js
18355
18597
  function object(value2) {
18356
18598
  if (!value2 || typeof value2 !== "object" || Array.isArray(value2))
18357
18599
  throw new Error("Expected a CRS object");
@@ -18761,7 +19003,7 @@ var __exports__ = (() => {
18761
19003
  return result;
18762
19004
  }
18763
19005
 
18764
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/wkt.js
19006
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/wkt.js
18765
19007
  function children(node, ...names) {
18766
19008
  return node.values.filter((value2) => value2.type === "node" && names.includes(value2.keyword.toUpperCase()));
18767
19009
  }
@@ -18922,14 +19164,14 @@ var __exports__ = (() => {
18922
19164
  }
18923
19165
  };
18924
19166
 
18925
- // ../../node_modules/@math.gl/proj4/dist/experimental/crs/projjson.js
19167
+ // ../../node_modules/@math.gl/projection/dist/experimental/crs/projjson.js
18926
19168
  var projJSONCRSParser = {
18927
19169
  name: "projjson",
18928
19170
  canParse: (definition) => inferCRSRepresentation(definition) === "projjson",
18929
19171
  parse: (definition, options) => readStructuredCRS(object(definition), options)
18930
19172
  };
18931
19173
 
18932
- // ../../node_modules/@math.gl/proj4/dist/experimental/grids/grid.js
19174
+ // ../../node_modules/@math.gl/projection/dist/experimental/grids/grid.js
18933
19175
  var TOLERANCE = 1e-12;
18934
19176
  function interpolate(grid, x, y, output, clamp2 = false) {
18935
19177
  let col = (x - grid.origin[0]) / grid.step[0], row = (y - grid.origin[1]) / grid.step[1];
@@ -18946,11 +19188,12 @@ var __exports__ = (() => {
18946
19188
  const weight = (right ? u : 1 - u) * (upper ? v : 1 - v);
18947
19189
  if (weight === 0)
18948
19190
  continue;
18949
- const node = grid.shifts[(j + (upper ? 1 : 0)) * width + i + right];
18950
- if (!Number.isFinite(node[0]) || !Number.isFinite(node[1]))
19191
+ const index = ((j + (upper ? 1 : 0)) * width + i + right) * 2;
19192
+ const xShift = grid.shifts[index], yShift = grid.shifts[index + 1];
19193
+ if (!Number.isFinite(xShift) || !Number.isFinite(yShift))
18951
19194
  return false;
18952
- dx += weight * node[0];
18953
- dy += weight * node[1];
19195
+ dx += weight * xShift;
19196
+ dy += weight * yShift;
18954
19197
  }
18955
19198
  output.x = dx;
18956
19199
  output.y = dy;
@@ -18993,13 +19236,14 @@ var __exports__ = (() => {
18993
19236
  throw new Error("Datum grid requires at least one subgrid");
18994
19237
  const prepared = subgrids.map((grid) => {
18995
19238
  const [width, height] = grid.size;
18996
- if (![width, height].every((n) => Number.isSafeInteger(n) && n >= 2) || width * height !== grid.shifts.length || !grid.origin.every(Number.isFinite) || !grid.step.every((n) => Number.isFinite(n) && n > 0))
19239
+ if (![width, height].every((n) => Number.isSafeInteger(n) && n >= 2) || width * height * 2 !== grid.shifts.length || !grid.origin.every(Number.isFinite) || !grid.step.every((n) => Number.isFinite(n) && n > 0))
18997
19240
  throw new Error("Invalid datum subgrid geometry or node count");
18998
19241
  const maxShift = [0, 0];
18999
- for (const node of grid.shifts)
19000
- for (let i = 0; i < 2; i++)
19001
- if (Number.isFinite(node[i]))
19002
- maxShift[i] = Math.max(maxShift[i], Math.abs(node[i]));
19242
+ for (let index = 0; index < grid.shifts.length; index++) {
19243
+ const value2 = grid.shifts[index];
19244
+ if (Number.isFinite(value2))
19245
+ maxShift[index % 2] = Math.max(maxShift[index % 2], Math.abs(value2));
19246
+ }
19003
19247
  return { ...grid, maxShift };
19004
19248
  });
19005
19249
  const shiftInPlace = (point, inverse33) => {
@@ -19016,17 +19260,19 @@ var __exports__ = (() => {
19016
19260
  point.y = latitude;
19017
19261
  return false;
19018
19262
  };
19263
+ const tupleScratch = { x: NaN, y: NaN };
19019
19264
  return Object.freeze({
19020
19265
  subgridCount: prepared.length,
19021
19266
  shiftInPlace,
19022
19267
  shift(longitude, latitude, inverse33) {
19023
- const point = { x: longitude, y: latitude };
19024
- return shiftInPlace(point, inverse33) ? [point.x, point.y] : void 0;
19268
+ tupleScratch.x = longitude;
19269
+ tupleScratch.y = latitude;
19270
+ return shiftInPlace(tupleScratch, inverse33) ? [tupleScratch.x, tupleScratch.y] : void 0;
19025
19271
  }
19026
19272
  });
19027
19273
  }
19028
19274
 
19029
- // ../../node_modules/@math.gl/proj4/dist/experimental/grids/ntv2.js
19275
+ // ../../node_modules/@math.gl/projection/dist/experimental/grids/ntv2.js
19030
19276
  var ARC_SECOND2 = Math.PI / 648e3;
19031
19277
  function parseNTv2Grid(data, options = {}) {
19032
19278
  const view = new DataView(data);
@@ -19056,12 +19302,11 @@ var __exports__ = (() => {
19056
19302
  const start = offset + 176, end = start + nodes * stride;
19057
19303
  if (end > view.byteLength)
19058
19304
  throw new Error("Truncated NTv2 node records");
19059
- const shifts = [];
19060
- for (let i = 0; i < nodes; i++)
19061
- shifts.push([
19062
- view.getFloat32(start + i * stride + 4, little) * ARC_SECOND2,
19063
- view.getFloat32(start + i * stride, little) * ARC_SECOND2
19064
- ]);
19305
+ const shifts = new Float64Array(nodes * 2);
19306
+ for (let i = 0; i < nodes; i++) {
19307
+ shifts[i * 2] = view.getFloat32(start + i * stride + 4, little) * ARC_SECOND2;
19308
+ shifts[i * 2 + 1] = view.getFloat32(start + i * stride, little) * ARC_SECOND2;
19309
+ }
19065
19310
  subgrids.push({
19066
19311
  origin: [lowerLon * ARC_SECOND2, lowerLat * ARC_SECOND2],
19067
19312
  step: [lonStep * ARC_SECOND2, latStep * ARC_SECOND2],
@@ -19073,7 +19318,7 @@ var __exports__ = (() => {
19073
19318
  return createDatumGrid(subgrids);
19074
19319
  }
19075
19320
 
19076
- // ../../node_modules/@math.gl/proj4/dist/lib/typescript-proj4-projection.js
19321
+ // ../../node_modules/@math.gl/projection/dist/lib/projection.js
19077
19322
  var aliases = /* @__PURE__ */ Object.create(null);
19078
19323
  var grids = /* @__PURE__ */ Object.create(null);
19079
19324
  var preset;
@@ -19143,14 +19388,14 @@ var __exports__ = (() => {
19143
19388
  return preset;
19144
19389
  }
19145
19390
  var Projection = class extends ProjectionEngine {
19146
- /** Register aliases for subsequently constructed TypeScript wrappers. */
19391
+ /** Register aliases for subsequently constructed projections. */
19147
19392
  static defineProjectionAliases(definitions) {
19148
19393
  for (const name of Object.keys(definitions)) {
19149
19394
  const definition = definitions[name];
19150
19395
  aliases[name] = typeof definition === "string" ? definition : JSON.parse(JSON.stringify(definition));
19151
19396
  }
19152
19397
  }
19153
- /** Register an owned NTv2 grid snapshot for subsequent TypeScript wrappers. */
19398
+ /** Register an owned NTv2 grid snapshot for subsequent projections. */
19154
19399
  static registerDatumGrid(name, grid, options) {
19155
19400
  grids[name] = parseNTv2Grid(grid, options);
19156
19401
  }
@@ -19892,15 +20137,15 @@ var __exports__ = (() => {
19892
20137
  this.outputIsGeographic = isWgs84Geographic(outputCrs);
19893
20138
  if (spatialReference.sourceCrs && spatialReference.targetCrs && !this.sourceIsGeocentric && !this.outputIsGeocentric) {
19894
20139
  this.horizontalProjection = new Projection({
19895
- from: getHorizontalProj4Definition(spatialReference.sourceCrs),
19896
- to: getHorizontalProj4Definition(spatialReference.targetCrs),
20140
+ from: getHorizontalProjectionDefinition(spatialReference.sourceCrs),
20141
+ to: getHorizontalProjectionDefinition(spatialReference.targetCrs),
19897
20142
  enforceAxis: false
19898
20143
  });
19899
20144
  }
19900
20145
  if (requiresHeightTransformation(spatialReference) || this.sourceIsGeocentric || this.outputIsGeocentric) {
19901
20146
  if (!this.sourceIsGeographic && !this.sourceIsGeocentric) {
19902
20147
  this.geographicProjection = new Projection({
19903
- from: getHorizontalProj4Definition(spatialReference.sourceCrs),
20148
+ from: getHorizontalProjectionDefinition(spatialReference.sourceCrs),
19904
20149
  to: WGS84_GEOGRAPHIC_CRS,
19905
20150
  enforceAxis: false
19906
20151
  });
@@ -19908,7 +20153,7 @@ var __exports__ = (() => {
19908
20153
  if (!this.outputIsGeographic && !this.outputIsGeocentric) {
19909
20154
  this.heightOutputProjection = new Projection({
19910
20155
  from: WGS84_GEOGRAPHIC_CRS,
19911
- to: getHorizontalProj4Definition(outputCrs),
20156
+ to: getHorizontalProjectionDefinition(outputCrs),
19912
20157
  enforceAxis: false
19913
20158
  });
19914
20159
  }
@@ -20062,7 +20307,7 @@ var __exports__ = (() => {
20062
20307
  (row) => (row[0] * vector[0] + row[1] * vector[1] + row[2] * vector[2]) / determinant3
20063
20308
  );
20064
20309
  }
20065
- function getHorizontalProj4Definition(definition) {
20310
+ function getHorizontalProjectionDefinition(definition) {
20066
20311
  if (!definition) {
20067
20312
  throw new Error("Cannot construct a projection because the CRS is unknown");
20068
20313
  }
@@ -20073,7 +20318,7 @@ var __exports__ = (() => {
20073
20318
  if (horizontalComponents.length !== 1) {
20074
20319
  throw new Error("CompoundCRS requires exactly one horizontal component");
20075
20320
  }
20076
- return getHorizontalProj4Definition(horizontalComponents[0]);
20321
+ return getHorizontalProjectionDefinition(horizontalComponents[0]);
20077
20322
  }
20078
20323
  return definition;
20079
20324
  }
@@ -21393,6 +21638,8 @@ var __exports__ = (() => {
21393
21638
  tileUrlCache = /* @__PURE__ */ new Map();
21394
21639
  /** Original content descriptors retained across {@link Tile3D.unloadContent} calls. */
21395
21640
  tileContentHeaders = /* @__PURE__ */ new WeakMap();
21641
+ /** Installed nested roots by parent placement and ordered nested-content slot, across reloads. */
21642
+ nestedTilesetRoots = /* @__PURE__ */ new WeakMap();
21396
21643
  /** Source-local namespaces assigned to distinct embedded glTF package file collections. */
21397
21644
  packageNamespaces = /* @__PURE__ */ new WeakMap();
21398
21645
  /** Next source-local package namespace. */
@@ -21823,7 +22070,9 @@ var __exports__ = (() => {
21823
22070
  return this.extensionsUsed.includes(extensionName);
21824
22071
  }
21825
22072
  /**
21826
- * Updates content-format flags and installs nested tileset subtrees.
22073
+ * Updates content-format flags and installs nested tileset subtrees once per content slot.
22074
+ * Reloading payloads retains attached roots and their descendants, including duplicate URLs
22075
+ * declared in separate slots or parent placements. Detached roots are reinstalled in declaration order.
21827
22076
  */
21828
22077
  onTileLoaded(tileset, tile, loadResult) {
21829
22078
  const contents = tile.contents.length ? tile.contents : [tile.content];
@@ -21838,8 +22087,23 @@ var __exports__ = (() => {
21838
22087
  this.contentFormats.ktx2 = true;
21839
22088
  }
21840
22089
  const nestedTilesets = loadResult.nestedTilesets || (loadResult.nestedTileset ? [loadResult.nestedTileset] : []);
21841
- for (const nestedTileset of nestedTilesets) {
21842
- tileset._initializeTileHeaders(this.prepareNestedTileset(tileset, nestedTileset), tile);
22090
+ const installedRoots = this.nestedTilesetRoots.get(tile) || [];
22091
+ for (const [nestedIndex, nestedTileset] of nestedTilesets.entries()) {
22092
+ const installedRoot = installedRoots[nestedIndex];
22093
+ if (installedRoot && tile.children.includes(installedRoot)) {
22094
+ continue;
22095
+ }
22096
+ const nextRoot = installedRoots.slice(nestedIndex + 1).find((root) => tile.children.includes(root));
22097
+ const nestedRoot = tileset._initializeTileHeaders(
22098
+ this.prepareNestedTileset(tileset, nestedTileset),
22099
+ tile
22100
+ );
22101
+ if (nextRoot) {
22102
+ tile.children.splice(tile.children.indexOf(nestedRoot), 1);
22103
+ tile.children.splice(tile.children.indexOf(nextRoot), 0, nestedRoot);
22104
+ }
22105
+ installedRoots[nestedIndex] = nestedRoot;
22106
+ this.nestedTilesetRoots.set(tile, installedRoots);
21843
22107
  }
21844
22108
  }
21845
22109
  /**