venue-js 1.4.0-next.15 → 1.4.0-next.17

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/index.mjs CHANGED
@@ -27,6 +27,71 @@ var IMDF_FEATURE_TYPES = [
27
27
  "unit",
28
28
  "venue"
29
29
  ];
30
+ var IMDF_UNIT_CATEGORIES = [
31
+ "auditorium",
32
+ "brick",
33
+ "classroom",
34
+ "column",
35
+ "concrete",
36
+ "conferenceroom",
37
+ "drywall",
38
+ "elevator",
39
+ "escalator",
40
+ "fieldofplay",
41
+ "firstaid",
42
+ "fitnessroom",
43
+ "foodservice",
44
+ "footbridge",
45
+ "glass",
46
+ "huddleroom",
47
+ "kitchen",
48
+ "laboratory",
49
+ "library",
50
+ "lobby",
51
+ "lounge",
52
+ "mailroom",
53
+ "mothersroom",
54
+ "movietheater",
55
+ "movingwalkway",
56
+ "nonpublic",
57
+ "office",
58
+ "opentobelow",
59
+ "parking",
60
+ "phoneroom",
61
+ "platform",
62
+ "privatelounge",
63
+ "ramp",
64
+ "recreation",
65
+ "restroom",
66
+ "restroom.family",
67
+ "restroom.female",
68
+ "restroom.female.wheelchair",
69
+ "restroom.male",
70
+ "restroom.male.wheelchair",
71
+ "restroom.transgender",
72
+ "restroom.transgender.wheelchair",
73
+ "restroom.unisex",
74
+ "restroom.unisex.wheelchair",
75
+ "restroom.wheelchair",
76
+ "road",
77
+ "room",
78
+ "serverroom",
79
+ "shower",
80
+ "smokingarea",
81
+ "stairs",
82
+ "steps",
83
+ "storage",
84
+ "structure",
85
+ "terrace",
86
+ "theater",
87
+ "unenclosedarea",
88
+ "unspecified",
89
+ "vegetation",
90
+ "waitingroom",
91
+ "walkway",
92
+ "walkway.island",
93
+ "wood"
94
+ ];
30
95
  var NONIMDF_FEATURE_TYPES = [
31
96
  "taxonomy",
32
97
  "event",
@@ -268,7 +333,7 @@ var isValidPoint = (geometry) => {
268
333
  function isInFilter(filter) {
269
334
  return typeof filter === "object" && filter !== null && "$in" in filter && Array.isArray(filter.$in);
270
335
  }
271
- var someIntersect = (a, b) => a.some((v2) => b.includes(v2));
336
+ var someIntersect = (a, b) => a.some((v) => b.includes(v));
272
337
  function matchFilter(value, filter) {
273
338
  if (Array.isArray(value)) {
274
339
  if (isInFilter(filter)) return someIntersect(value, filter.$in);
@@ -326,7 +391,27 @@ import {
326
391
  } from "@tanstack/query-core";
327
392
 
328
393
  // src/data/populator/index.ts
329
- import { booleanWithin } from "@turf/boolean-within";
394
+ import { center as center2 } from "@turf/center";
395
+ import { booleanPointInPolygon as booleanPointInPolygon2 } from "@turf/boolean-point-in-polygon";
396
+
397
+ // src/data/utils/findContaining.ts
398
+ import { center } from "@turf/center";
399
+ import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon";
400
+ var findContainingUnit = (poi, units) => {
401
+ const unit = units.find(
402
+ (unit2) => {
403
+ try {
404
+ return unit2.properties.level_id === poi.properties.level_id && booleanPointInPolygon(center(poi), unit2);
405
+ } catch (e) {
406
+ console.log(`Cannot find containing unit of (${poi.id}):`, e.message);
407
+ return false;
408
+ }
409
+ }
410
+ );
411
+ return unit;
412
+ };
413
+
414
+ // src/data/populator/index.ts
330
415
  var createPopulator = ({
331
416
  internalFindById,
332
417
  internalFilterByType
@@ -336,7 +421,6 @@ var createPopulator = ({
336
421
  const populateDetail = (detail) => Promise.resolve(detail);
337
422
  const populateFootprint = (footprint) => Promise.resolve(footprint);
338
423
  const populateGeofence = (geofence) => Promise.resolve(geofence);
339
- const populateRelationship = (relationship) => Promise.resolve(relationship);
340
424
  const populatePrivilege = (privilege) => Promise.resolve(privilege);
341
425
  const populateEvent = (event) => Promise.resolve(event);
342
426
  const populatePromotion = async (promotion) => {
@@ -360,7 +444,7 @@ var createPopulator = ({
360
444
  const ordinalKiosks = kiosks.filter(
361
445
  (kiosk2) => kiosk2.properties.level_id === defaultLevel.id
362
446
  );
363
- const kiosk = ordinalKiosks.find((kiosk2) => booleanWithin(amenity, kiosk2));
447
+ const kiosk = ordinalKiosks.find((kiosk2) => booleanPointInPolygon2(amenity, kiosk2));
364
448
  return {
365
449
  ...amenity,
366
450
  properties: {
@@ -379,7 +463,7 @@ var createPopulator = ({
379
463
  const venue = await internalFindById(unit.properties.venue_id);
380
464
  const level = await internalFindById(unit.properties.level_id);
381
465
  const sections = await internalFilterByType("section");
382
- const section = sections.find((section2) => booleanWithin(anchor, section2));
466
+ const section = sections.find((section2) => booleanPointInPolygon2(anchor, section2));
383
467
  return {
384
468
  ...anchor,
385
469
  properties: {
@@ -412,20 +496,11 @@ var createPopulator = ({
412
496
  const venue = await internalFindById(kiosk.properties.venue_id);
413
497
  const anchor = await internalFindById(kiosk.properties.anchor_id);
414
498
  const units = await internalFilterByType("unit");
415
- const unit = units.find(
416
- (unit2) => {
417
- try {
418
- return unit2.properties.category === "walkway" && unit2.properties.level_id === kiosk.properties.level_id && booleanWithin(kiosk, unit2);
419
- } catch (e) {
420
- console.log(`Cannot find kiosk(${kiosk.id})'s units:`, e.message);
421
- return false;
422
- }
423
- }
424
- );
499
+ const unit = findContainingUnit(kiosk, units.filter((unit2) => unit2.properties.category === "walkway"));
425
500
  let section = null;
426
501
  if (anchor) {
427
502
  const sections = await internalFilterByType("section");
428
- section = sections.find((section2) => booleanWithin(anchor, section2));
503
+ section = sections.find((section2) => booleanPointInPolygon2(anchor, section2));
429
504
  }
430
505
  return {
431
506
  ...kiosk,
@@ -507,6 +582,23 @@ var createPopulator = ({
507
582
  }
508
583
  };
509
584
  };
585
+ const populateRelationship = async (relationship) => {
586
+ const originId = relationship.properties.origin?.id;
587
+ const destinationId = relationship.properties.destination?.id;
588
+ const origin = originId ? await internalFindById(originId) : null;
589
+ const destination = destinationId ? await internalFindById(destinationId) : null;
590
+ const intermediary_ids = (relationship.properties.intermediary || []).map(({ id }) => id);
591
+ const intermediary = await Promise.all(intermediary_ids.map(internalFindById));
592
+ return {
593
+ ...relationship,
594
+ properties: {
595
+ ...relationship.properties,
596
+ origin,
597
+ destination,
598
+ intermediary
599
+ }
600
+ };
601
+ };
510
602
  const populateSection = async (section) => {
511
603
  const venue = await internalFindById(section.properties.venue_id);
512
604
  const level = await internalFindById(section.properties.level_id);
@@ -525,7 +617,7 @@ var createPopulator = ({
525
617
  const level = await internalFindById(unit.properties.level_id);
526
618
  const sections = await internalFilterByType("section");
527
619
  try {
528
- const section = unit.geometry.type !== "MultiPolygon" ? sections.find((section2) => booleanWithin(unit, section2)) : null;
620
+ const section = unit.geometry.type !== "MultiPolygon" ? sections.find((section2) => booleanPointInPolygon2(center2(unit), section2)) : null;
529
621
  return {
530
622
  ...unit,
531
623
  properties: {
@@ -2086,6 +2178,7 @@ var getDataClient = (options) => {
2086
2178
  destroyObservers,
2087
2179
  createFilterByTypeQueryOptions,
2088
2180
  createFindByIdQueryOptions,
2181
+ _internalFindById: internalFindById,
2089
2182
  filterByType,
2090
2183
  findById,
2091
2184
  search: searchFn
@@ -2105,7 +2198,7 @@ import "@maptalks/transcoders.draco";
2105
2198
  import TWEEN from "@tweenjs/tween.js";
2106
2199
  import _5 from "lodash";
2107
2200
 
2108
- // ../../node_modules/@turf/helpers/dist/esm/index.js
2201
+ // node_modules/@turf/helpers/dist/esm/index.js
2109
2202
  var earthRadius = 63710088e-1;
2110
2203
  var factors = {
2111
2204
  centimeters: earthRadius * 100,
@@ -2346,7 +2439,7 @@ var Billboard = class extends BaseObject {
2346
2439
  this._initOptions(options);
2347
2440
  const {
2348
2441
  altitude = OPTIONS.altitude,
2349
- scale: scale3 = OPTIONS.scale,
2442
+ scale: scale2 = OPTIONS.scale,
2350
2443
  alphaTest = OPTIONS.alphaTest,
2351
2444
  legColor = OPTIONS.legColor,
2352
2445
  showLeg = OPTIONS.showLeg
@@ -2380,8 +2473,8 @@ var Billboard = class extends BaseObject {
2380
2473
  const sprite = new Sprite(material);
2381
2474
  sprite.material.sizeAttenuation = false;
2382
2475
  sprite.scale.set(
2383
- scale3 * naturalWidth / divider,
2384
- scale3 * naturalHeight / divider,
2476
+ scale2 * naturalWidth / divider,
2477
+ scale2 * naturalHeight / divider,
2385
2478
  1
2386
2479
  );
2387
2480
  this.getObject3d().add(sprite);
@@ -2390,7 +2483,7 @@ var Billboard = class extends BaseObject {
2390
2483
  const position = layer.coordinateToVector3(coordinate, z);
2391
2484
  _.set(this.properties, "default.position", position);
2392
2485
  _.set(this.properties, "default.altitude", altitude);
2393
- _.set(this.properties, "default.scale", scale3);
2486
+ _.set(this.properties, "default.scale", scale2);
2394
2487
  this.getObject3d().position.copy(position);
2395
2488
  }
2396
2489
  setLineHeight(altitude) {
@@ -2430,18 +2523,18 @@ var SpriteMarker = class extends BaseObject2 {
2430
2523
  this._createGroup();
2431
2524
  const {
2432
2525
  altitude = DEFAULT_OPTIONS.altitude,
2433
- scale: scale3 = DEFAULT_OPTIONS.scale,
2526
+ scale: scale2 = DEFAULT_OPTIONS.scale,
2434
2527
  highlight = DEFAULT_OPTIONS.highlight,
2435
2528
  alphaTest = DEFAULT_OPTIONS.alphaTest
2436
2529
  } = options;
2437
2530
  this.properties = { ...properties };
2438
2531
  const modifiedAltitude = altitude + 2;
2439
- this.#default = { options: { scale: scale3, altitude: modifiedAltitude }, material };
2532
+ this.#default = { options: { scale: scale2, altitude: modifiedAltitude }, material };
2440
2533
  this.#highlight = _2.merge({}, DEFAULT_OPTIONS.highlight, highlight);
2441
2534
  if (material && material instanceof SpriteMaterial2)
2442
2535
  material.alphaTest = alphaTest;
2443
2536
  const sprite = new Sprite2(material);
2444
- sprite.scale.set(scale3, scale3, scale3);
2537
+ sprite.scale.set(scale2, scale2, scale2);
2445
2538
  const obj3d = this.getObject3d();
2446
2539
  obj3d.add(sprite);
2447
2540
  const z = layer.altitudeToVector3(modifiedAltitude, modifiedAltitude).x;
@@ -2587,14 +2680,14 @@ var NavigationPath = class extends BaseObject3 {
2587
2680
  };
2588
2681
 
2589
2682
  // src/IndoorMap/utils/geometry.ts
2590
- import center from "@turf/center";
2683
+ import center3 from "@turf/center";
2591
2684
  import _3 from "lodash";
2592
2685
  import turfLineOffset from "@turf/line-offset";
2593
2686
  var getCenterFromGeometry = (geometry) => {
2594
2687
  try {
2595
2688
  const { type = null, coordinates = null } = geometry;
2596
2689
  if (!type || !coordinates) return null;
2597
- const centerPoint = center(geometry);
2690
+ const centerPoint = center3(geometry);
2598
2691
  return _3.get(centerPoint, "geometry.coordinates");
2599
2692
  } catch (error) {
2600
2693
  return null;
@@ -2641,8 +2734,8 @@ var createSVGPathFromMarkerSymbol = (style) => {
2641
2734
  markerFill,
2642
2735
  markerPath
2643
2736
  } = style;
2644
- const scale3 = markerWidth / 24;
2645
- return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale3})" fill="${markerFill}"/>`;
2737
+ const scale2 = markerWidth / 24;
2738
+ return `<path d="${markerPath}" style="transform:translate(${markerDx}px, ${markerDy}px) scale(${scale2})" fill="${markerFill}"/>`;
2646
2739
  };
2647
2740
 
2648
2741
  // src/IndoorMap/utils/createElements.js
@@ -3578,7 +3671,7 @@ var styledFeatureGenerator = (mapTheme) => {
3578
3671
  const {
3579
3672
  logo,
3580
3673
  altitude,
3581
- scale: scale3,
3674
+ scale: scale2,
3582
3675
  alphaTest,
3583
3676
  legColor,
3584
3677
  showLeg,
@@ -3592,7 +3685,7 @@ var styledFeatureGenerator = (mapTheme) => {
3592
3685
  };
3593
3686
  const options = {
3594
3687
  altitude,
3595
- scale: scale3,
3688
+ scale: scale2,
3596
3689
  alphaTest,
3597
3690
  legColor,
3598
3691
  showLeg,
@@ -3836,9 +3929,9 @@ var getRelatedLocationsByAmenity = (feature2) => {
3836
3929
  var getRelatedLocationIdsByFeature = (feature2) => {
3837
3930
  switch (feature2?.feature_type) {
3838
3931
  case "amenity":
3839
- return getRelatedLocationsByAmenity(feature2).map((v2) => v2?.id);
3932
+ return getRelatedLocationsByAmenity(feature2).map((v) => v?.id);
3840
3933
  case "occupant":
3841
- return getRelatedLocationsByOccupant(feature2).map((v2) => v2?.id);
3934
+ return getRelatedLocationsByOccupant(feature2).map((v) => v?.id);
3842
3935
  default:
3843
3936
  return [];
3844
3937
  }
@@ -4172,22 +4265,22 @@ var getMaterial = (text, flatLabelOptions) => {
4172
4265
  texts = wrapText(ctx, text, maxWidth);
4173
4266
  }
4174
4267
  let textWidth = max(texts.map((text2) => ctx.measureText(text2).width));
4175
- let scale3 = 1;
4176
- while (scale3 > 0 && textWidth + 2 * margin > SIZE) {
4177
- scale3 -= scaleStep;
4178
- ctx.font = `${fontWeight} ${scale3 * fontSize}px "${fontFamily}", Arial`;
4268
+ let scale2 = 1;
4269
+ while (scale2 > 0 && textWidth + 2 * margin > SIZE) {
4270
+ scale2 -= scaleStep;
4271
+ ctx.font = `${fontWeight} ${scale2 * fontSize}px "${fontFamily}", Arial`;
4179
4272
  textWidth = max(texts.map((text2) => ctx.measureText(text2).width));
4180
4273
  }
4181
- const center2 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
4182
- if (scale3 > scaleMin) {
4183
- const totalHeight = texts.length * (fontSize * scale3 * lineHeight);
4184
- const startY = center2.y - totalHeight / 2 + fontSize * scale3 * lineHeight * 0.5;
4274
+ const center4 = { x: 0.5 * SIZE, y: 0.5 * SIZE };
4275
+ if (scale2 > scaleMin) {
4276
+ const totalHeight = texts.length * (fontSize * scale2 * lineHeight);
4277
+ const startY = center4.y - totalHeight / 2 + fontSize * scale2 * lineHeight * 0.5;
4185
4278
  texts.forEach((text2, index) => {
4186
- const yOffset = startY + index * (fontSize * scale3 * lineHeight);
4279
+ const yOffset = startY + index * (fontSize * scale2 * lineHeight);
4187
4280
  if (strokeStyle && lineWidth) {
4188
- ctx.strokeText(text2, center2.x, yOffset);
4281
+ ctx.strokeText(text2, center4.x, yOffset);
4189
4282
  }
4190
- ctx.fillText(text2, center2.x, yOffset);
4283
+ ctx.fillText(text2, center4.x, yOffset);
4191
4284
  });
4192
4285
  }
4193
4286
  const texture = new Texture(canvas);
@@ -4264,8 +4357,8 @@ var GroundLabel = class extends BaseObject4 {
4264
4357
  const basePosition = layer.coordinateToVector3([cx, cy], z);
4265
4358
  this.#originalPosition = basePosition.clone();
4266
4359
  const finalPosition = this.#calculateFinalPosition(basePosition);
4267
- const scale3 = width / 6456122659e-13;
4268
- const finalScale = maxFontScale && scale3 > maxFontScale ? maxFontScale : scale3;
4360
+ const scale2 = width / 6456122659e-13;
4361
+ const finalScale = maxFontScale && scale2 > maxFontScale ? maxFontScale : scale2;
4269
4362
  this.getObject3d().scale.set(finalScale, finalScale, finalScale);
4270
4363
  this.getObject3d().position.copy(finalPosition);
4271
4364
  this.getObject3d().rotation.z = Math.PI / 180 * this.#angle;
@@ -5238,478 +5331,11 @@ var angleBetweenLineStrings = (line1, line2) => {
5238
5331
  return Math.atan2(dy, dx);
5239
5332
  };
5240
5333
 
5241
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/util.js
5242
- var epsilon = 11102230246251565e-32;
5243
- var splitter = 134217729;
5244
- var resulterrbound = (3 + 8 * epsilon) * epsilon;
5245
- function sum(elen, e, flen, f, h) {
5246
- let Q, Qnew, hh, bvirt;
5247
- let enow = e[0];
5248
- let fnow = f[0];
5249
- let eindex = 0;
5250
- let findex = 0;
5251
- if (fnow > enow === fnow > -enow) {
5252
- Q = enow;
5253
- enow = e[++eindex];
5254
- } else {
5255
- Q = fnow;
5256
- fnow = f[++findex];
5257
- }
5258
- let hindex = 0;
5259
- if (eindex < elen && findex < flen) {
5260
- if (fnow > enow === fnow > -enow) {
5261
- Qnew = enow + Q;
5262
- hh = Q - (Qnew - enow);
5263
- enow = e[++eindex];
5264
- } else {
5265
- Qnew = fnow + Q;
5266
- hh = Q - (Qnew - fnow);
5267
- fnow = f[++findex];
5268
- }
5269
- Q = Qnew;
5270
- if (hh !== 0) {
5271
- h[hindex++] = hh;
5272
- }
5273
- while (eindex < elen && findex < flen) {
5274
- if (fnow > enow === fnow > -enow) {
5275
- Qnew = Q + enow;
5276
- bvirt = Qnew - Q;
5277
- hh = Q - (Qnew - bvirt) + (enow - bvirt);
5278
- enow = e[++eindex];
5279
- } else {
5280
- Qnew = Q + fnow;
5281
- bvirt = Qnew - Q;
5282
- hh = Q - (Qnew - bvirt) + (fnow - bvirt);
5283
- fnow = f[++findex];
5284
- }
5285
- Q = Qnew;
5286
- if (hh !== 0) {
5287
- h[hindex++] = hh;
5288
- }
5289
- }
5290
- }
5291
- while (eindex < elen) {
5292
- Qnew = Q + enow;
5293
- bvirt = Qnew - Q;
5294
- hh = Q - (Qnew - bvirt) + (enow - bvirt);
5295
- enow = e[++eindex];
5296
- Q = Qnew;
5297
- if (hh !== 0) {
5298
- h[hindex++] = hh;
5299
- }
5300
- }
5301
- while (findex < flen) {
5302
- Qnew = Q + fnow;
5303
- bvirt = Qnew - Q;
5304
- hh = Q - (Qnew - bvirt) + (fnow - bvirt);
5305
- fnow = f[++findex];
5306
- Q = Qnew;
5307
- if (hh !== 0) {
5308
- h[hindex++] = hh;
5309
- }
5310
- }
5311
- if (Q !== 0 || hindex === 0) {
5312
- h[hindex++] = Q;
5313
- }
5314
- return hindex;
5315
- }
5316
- function estimate(elen, e) {
5317
- let Q = e[0];
5318
- for (let i = 1; i < elen; i++) Q += e[i];
5319
- return Q;
5320
- }
5321
- function vec(n) {
5322
- return new Float64Array(n);
5323
- }
5324
-
5325
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient2d.js
5326
- var ccwerrboundA = (3 + 16 * epsilon) * epsilon;
5327
- var ccwerrboundB = (2 + 12 * epsilon) * epsilon;
5328
- var ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;
5329
- var B = vec(4);
5330
- var C1 = vec(8);
5331
- var C2 = vec(12);
5332
- var D = vec(16);
5333
- var u = vec(4);
5334
- function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
5335
- let acxtail, acytail, bcxtail, bcytail;
5336
- let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u32;
5337
- const acx = ax - cx;
5338
- const bcx = bx - cx;
5339
- const acy = ay - cy;
5340
- const bcy = by - cy;
5341
- s1 = acx * bcy;
5342
- c = splitter * acx;
5343
- ahi = c - (c - acx);
5344
- alo = acx - ahi;
5345
- c = splitter * bcy;
5346
- bhi = c - (c - bcy);
5347
- blo = bcy - bhi;
5348
- s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
5349
- t1 = acy * bcx;
5350
- c = splitter * acy;
5351
- ahi = c - (c - acy);
5352
- alo = acy - ahi;
5353
- c = splitter * bcx;
5354
- bhi = c - (c - bcx);
5355
- blo = bcx - bhi;
5356
- t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
5357
- _i = s0 - t0;
5358
- bvirt = s0 - _i;
5359
- B[0] = s0 - (_i + bvirt) + (bvirt - t0);
5360
- _j = s1 + _i;
5361
- bvirt = _j - s1;
5362
- _0 = s1 - (_j - bvirt) + (_i - bvirt);
5363
- _i = _0 - t1;
5364
- bvirt = _0 - _i;
5365
- B[1] = _0 - (_i + bvirt) + (bvirt - t1);
5366
- u32 = _j + _i;
5367
- bvirt = u32 - _j;
5368
- B[2] = _j - (u32 - bvirt) + (_i - bvirt);
5369
- B[3] = u32;
5370
- let det = estimate(4, B);
5371
- let errbound = ccwerrboundB * detsum;
5372
- if (det >= errbound || -det >= errbound) {
5373
- return det;
5374
- }
5375
- bvirt = ax - acx;
5376
- acxtail = ax - (acx + bvirt) + (bvirt - cx);
5377
- bvirt = bx - bcx;
5378
- bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
5379
- bvirt = ay - acy;
5380
- acytail = ay - (acy + bvirt) + (bvirt - cy);
5381
- bvirt = by - bcy;
5382
- bcytail = by - (bcy + bvirt) + (bvirt - cy);
5383
- if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
5384
- return det;
5385
- }
5386
- errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
5387
- det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
5388
- if (det >= errbound || -det >= errbound) return det;
5389
- s1 = acxtail * bcy;
5390
- c = splitter * acxtail;
5391
- ahi = c - (c - acxtail);
5392
- alo = acxtail - ahi;
5393
- c = splitter * bcy;
5394
- bhi = c - (c - bcy);
5395
- blo = bcy - bhi;
5396
- s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
5397
- t1 = acytail * bcx;
5398
- c = splitter * acytail;
5399
- ahi = c - (c - acytail);
5400
- alo = acytail - ahi;
5401
- c = splitter * bcx;
5402
- bhi = c - (c - bcx);
5403
- blo = bcx - bhi;
5404
- t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
5405
- _i = s0 - t0;
5406
- bvirt = s0 - _i;
5407
- u[0] = s0 - (_i + bvirt) + (bvirt - t0);
5408
- _j = s1 + _i;
5409
- bvirt = _j - s1;
5410
- _0 = s1 - (_j - bvirt) + (_i - bvirt);
5411
- _i = _0 - t1;
5412
- bvirt = _0 - _i;
5413
- u[1] = _0 - (_i + bvirt) + (bvirt - t1);
5414
- u32 = _j + _i;
5415
- bvirt = u32 - _j;
5416
- u[2] = _j - (u32 - bvirt) + (_i - bvirt);
5417
- u[3] = u32;
5418
- const C1len = sum(4, B, 4, u, C1);
5419
- s1 = acx * bcytail;
5420
- c = splitter * acx;
5421
- ahi = c - (c - acx);
5422
- alo = acx - ahi;
5423
- c = splitter * bcytail;
5424
- bhi = c - (c - bcytail);
5425
- blo = bcytail - bhi;
5426
- s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
5427
- t1 = acy * bcxtail;
5428
- c = splitter * acy;
5429
- ahi = c - (c - acy);
5430
- alo = acy - ahi;
5431
- c = splitter * bcxtail;
5432
- bhi = c - (c - bcxtail);
5433
- blo = bcxtail - bhi;
5434
- t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
5435
- _i = s0 - t0;
5436
- bvirt = s0 - _i;
5437
- u[0] = s0 - (_i + bvirt) + (bvirt - t0);
5438
- _j = s1 + _i;
5439
- bvirt = _j - s1;
5440
- _0 = s1 - (_j - bvirt) + (_i - bvirt);
5441
- _i = _0 - t1;
5442
- bvirt = _0 - _i;
5443
- u[1] = _0 - (_i + bvirt) + (bvirt - t1);
5444
- u32 = _j + _i;
5445
- bvirt = u32 - _j;
5446
- u[2] = _j - (u32 - bvirt) + (_i - bvirt);
5447
- u[3] = u32;
5448
- const C2len = sum(C1len, C1, 4, u, C2);
5449
- s1 = acxtail * bcytail;
5450
- c = splitter * acxtail;
5451
- ahi = c - (c - acxtail);
5452
- alo = acxtail - ahi;
5453
- c = splitter * bcytail;
5454
- bhi = c - (c - bcytail);
5455
- blo = bcytail - bhi;
5456
- s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
5457
- t1 = acytail * bcxtail;
5458
- c = splitter * acytail;
5459
- ahi = c - (c - acytail);
5460
- alo = acytail - ahi;
5461
- c = splitter * bcxtail;
5462
- bhi = c - (c - bcxtail);
5463
- blo = bcxtail - bhi;
5464
- t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
5465
- _i = s0 - t0;
5466
- bvirt = s0 - _i;
5467
- u[0] = s0 - (_i + bvirt) + (bvirt - t0);
5468
- _j = s1 + _i;
5469
- bvirt = _j - s1;
5470
- _0 = s1 - (_j - bvirt) + (_i - bvirt);
5471
- _i = _0 - t1;
5472
- bvirt = _0 - _i;
5473
- u[1] = _0 - (_i + bvirt) + (bvirt - t1);
5474
- u32 = _j + _i;
5475
- bvirt = u32 - _j;
5476
- u[2] = _j - (u32 - bvirt) + (_i - bvirt);
5477
- u[3] = u32;
5478
- const Dlen = sum(C2len, C2, 4, u, D);
5479
- return D[Dlen - 1];
5480
- }
5481
- function orient2d(ax, ay, bx, by, cx, cy) {
5482
- const detleft = (ay - cy) * (bx - cx);
5483
- const detright = (ax - cx) * (by - cy);
5484
- const det = detleft - detright;
5485
- const detsum = Math.abs(detleft + detright);
5486
- if (Math.abs(det) >= ccwerrboundA * detsum) return det;
5487
- return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
5488
- }
5489
-
5490
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/orient3d.js
5491
- var o3derrboundA = (7 + 56 * epsilon) * epsilon;
5492
- var o3derrboundB = (3 + 28 * epsilon) * epsilon;
5493
- var o3derrboundC = (26 + 288 * epsilon) * epsilon * epsilon;
5494
- var bc = vec(4);
5495
- var ca = vec(4);
5496
- var ab = vec(4);
5497
- var at_b = vec(4);
5498
- var at_c = vec(4);
5499
- var bt_c = vec(4);
5500
- var bt_a = vec(4);
5501
- var ct_a = vec(4);
5502
- var ct_b = vec(4);
5503
- var bct = vec(8);
5504
- var cat = vec(8);
5505
- var abt = vec(8);
5506
- var u2 = vec(4);
5507
- var _8 = vec(8);
5508
- var _8b = vec(8);
5509
- var _16 = vec(8);
5510
- var _12 = vec(12);
5511
- var fin = vec(192);
5512
- var fin2 = vec(192);
5513
-
5514
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/incircle.js
5515
- var iccerrboundA = (10 + 96 * epsilon) * epsilon;
5516
- var iccerrboundB = (4 + 48 * epsilon) * epsilon;
5517
- var iccerrboundC = (44 + 576 * epsilon) * epsilon * epsilon;
5518
- var bc2 = vec(4);
5519
- var ca2 = vec(4);
5520
- var ab2 = vec(4);
5521
- var aa = vec(4);
5522
- var bb = vec(4);
5523
- var cc = vec(4);
5524
- var u3 = vec(4);
5525
- var v = vec(4);
5526
- var axtbc = vec(8);
5527
- var aytbc = vec(8);
5528
- var bxtca = vec(8);
5529
- var bytca = vec(8);
5530
- var cxtab = vec(8);
5531
- var cytab = vec(8);
5532
- var abt2 = vec(8);
5533
- var bct2 = vec(8);
5534
- var cat2 = vec(8);
5535
- var abtt = vec(4);
5536
- var bctt = vec(4);
5537
- var catt = vec(4);
5538
- var _82 = vec(8);
5539
- var _162 = vec(16);
5540
- var _16b = vec(16);
5541
- var _16c = vec(16);
5542
- var _32 = vec(32);
5543
- var _32b = vec(32);
5544
- var _48 = vec(48);
5545
- var _64 = vec(64);
5546
- var fin3 = vec(1152);
5547
- var fin22 = vec(1152);
5548
-
5549
- // ../../node_modules/point-in-polygon-hao/node_modules/robust-predicates/esm/insphere.js
5550
- var isperrboundA = (16 + 224 * epsilon) * epsilon;
5551
- var isperrboundB = (5 + 72 * epsilon) * epsilon;
5552
- var isperrboundC = (71 + 1408 * epsilon) * epsilon * epsilon;
5553
- var ab3 = vec(4);
5554
- var bc3 = vec(4);
5555
- var cd = vec(4);
5556
- var de = vec(4);
5557
- var ea = vec(4);
5558
- var ac = vec(4);
5559
- var bd = vec(4);
5560
- var ce = vec(4);
5561
- var da = vec(4);
5562
- var eb = vec(4);
5563
- var abc = vec(24);
5564
- var bcd = vec(24);
5565
- var cde = vec(24);
5566
- var dea = vec(24);
5567
- var eab = vec(24);
5568
- var abd = vec(24);
5569
- var bce = vec(24);
5570
- var cda = vec(24);
5571
- var deb = vec(24);
5572
- var eac = vec(24);
5573
- var adet = vec(1152);
5574
- var bdet = vec(1152);
5575
- var cdet = vec(1152);
5576
- var ddet = vec(1152);
5577
- var edet = vec(1152);
5578
- var abdet = vec(2304);
5579
- var cddet = vec(2304);
5580
- var cdedet = vec(3456);
5581
- var deter = vec(5760);
5582
- var _83 = vec(8);
5583
- var _8b2 = vec(8);
5584
- var _8c = vec(8);
5585
- var _163 = vec(16);
5586
- var _24 = vec(24);
5587
- var _482 = vec(48);
5588
- var _48b = vec(48);
5589
- var _96 = vec(96);
5590
- var _192 = vec(192);
5591
- var _384x = vec(384);
5592
- var _384y = vec(384);
5593
- var _384z = vec(384);
5594
- var _768 = vec(768);
5595
- var xdet = vec(96);
5596
- var ydet = vec(96);
5597
- var zdet = vec(96);
5598
- var fin4 = vec(1152);
5599
-
5600
- // ../../node_modules/point-in-polygon-hao/dist/esm/index.js
5601
- function pointInPolygon(p, polygon2) {
5602
- var i;
5603
- var ii;
5604
- var k = 0;
5605
- var f;
5606
- var u1;
5607
- var v1;
5608
- var u22;
5609
- var v2;
5610
- var currentP;
5611
- var nextP;
5612
- var x = p[0];
5613
- var y = p[1];
5614
- var numContours = polygon2.length;
5615
- for (i = 0; i < numContours; i++) {
5616
- ii = 0;
5617
- var contour = polygon2[i];
5618
- var contourLen = contour.length - 1;
5619
- currentP = contour[0];
5620
- if (currentP[0] !== contour[contourLen][0] && currentP[1] !== contour[contourLen][1]) {
5621
- throw new Error("First and last coordinates in a ring must be the same");
5622
- }
5623
- u1 = currentP[0] - x;
5624
- v1 = currentP[1] - y;
5625
- for (ii; ii < contourLen; ii++) {
5626
- nextP = contour[ii + 1];
5627
- u22 = nextP[0] - x;
5628
- v2 = nextP[1] - y;
5629
- if (v1 === 0 && v2 === 0) {
5630
- if (u22 <= 0 && u1 >= 0 || u1 <= 0 && u22 >= 0) {
5631
- return 0;
5632
- }
5633
- } else if (v2 >= 0 && v1 <= 0 || v2 <= 0 && v1 >= 0) {
5634
- f = orient2d(u1, u22, v1, v2, 0, 0);
5635
- if (f === 0) {
5636
- return 0;
5637
- }
5638
- if (f > 0 && v2 > 0 && v1 <= 0 || f < 0 && v2 <= 0 && v1 > 0) {
5639
- k++;
5640
- }
5641
- }
5642
- currentP = nextP;
5643
- v1 = v2;
5644
- u1 = u22;
5645
- }
5646
- }
5647
- if (k % 2 === 0) {
5648
- return false;
5649
- }
5650
- return true;
5651
- }
5652
-
5653
- // ../../node_modules/@turf/invariant/dist/esm/index.js
5654
- function getCoord(coord) {
5655
- if (!coord) {
5656
- throw new Error("coord is required");
5657
- }
5658
- if (!Array.isArray(coord)) {
5659
- if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
5660
- return [...coord.geometry.coordinates];
5661
- }
5662
- if (coord.type === "Point") {
5663
- return [...coord.coordinates];
5664
- }
5665
- }
5666
- if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
5667
- return [...coord];
5668
- }
5669
- throw new Error("coord must be GeoJSON Point or an Array of numbers");
5670
- }
5671
- function getGeom(geojson) {
5672
- if (geojson.type === "Feature") {
5673
- return geojson.geometry;
5674
- }
5675
- return geojson;
5676
- }
5677
-
5678
- // ../../node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js
5679
- function booleanPointInPolygon(point2, polygon2, options = {}) {
5680
- if (!point2) {
5681
- throw new Error("point is required");
5682
- }
5683
- if (!polygon2) {
5684
- throw new Error("polygon is required");
5685
- }
5686
- const pt = getCoord(point2);
5687
- const geom = getGeom(polygon2);
5688
- const type = geom.type;
5689
- const bbox2 = polygon2.bbox;
5690
- let polys = geom.coordinates;
5691
- if (bbox2 && inBBox(pt, bbox2) === false) {
5692
- return false;
5693
- }
5694
- if (type === "Polygon") {
5695
- polys = [polys];
5696
- }
5697
- let result = false;
5698
- for (var i = 0; i < polys.length; ++i) {
5699
- const polyResult = pointInPolygon(pt, polys[i]);
5700
- if (polyResult === 0) return options.ignoreBoundary ? false : true;
5701
- else if (polyResult) result = true;
5702
- }
5703
- return result;
5704
- }
5705
- function inBBox(pt, bbox2) {
5706
- return bbox2[0] <= pt[0] && bbox2[1] <= pt[1] && bbox2[2] >= pt[0] && bbox2[3] >= pt[1];
5707
- }
5708
-
5709
5334
  // src/IndoorMap/renderer/utils/findUnitOnPoint.ts
5335
+ import { booleanPointInPolygon as booleanPointInPolygon3 } from "@turf/boolean-point-in-polygon";
5710
5336
  var findUnitOnPoint = (units, point2) => {
5711
5337
  try {
5712
- return units.find((unit) => booleanPointInPolygon(point2, polygon(unit.geometry.coordinates)));
5338
+ return units.find((unit) => booleanPointInPolygon3(point2, polygon(unit.geometry.coordinates)));
5713
5339
  } catch (err) {
5714
5340
  return null;
5715
5341
  }
@@ -5758,9 +5384,9 @@ var RendererManager = class extends EventTarget {
5758
5384
  const pos = geom?.attributes?.position?.array;
5759
5385
  if (!pos || pos.length === 0) return;
5760
5386
  for (let i = 0; i < pos.length; i++) {
5761
- const v2 = pos[i];
5762
- if (!Number.isFinite(v2)) {
5763
- bad.push({ mesh: obj, index: i, value: v2 });
5387
+ const v = pos[i];
5388
+ if (!Number.isFinite(v)) {
5389
+ bad.push({ mesh: obj, index: i, value: v });
5764
5390
  break;
5765
5391
  }
5766
5392
  }
@@ -5856,7 +5482,7 @@ var RendererManager = class extends EventTarget {
5856
5482
  populate: true
5857
5483
  });
5858
5484
  units.filter(
5859
- (u4) => !["opentobelow", "escalator", "room"].includes(u4.properties.category)
5485
+ (u) => !["opentobelow", "escalator", "room"].includes(u.properties.category)
5860
5486
  ).forEach((unit) => {
5861
5487
  const element = this.elementRenderer.createGeometry(unit);
5862
5488
  if (element) {
@@ -5864,7 +5490,7 @@ var RendererManager = class extends EventTarget {
5864
5490
  this.addElementsToManager(unit.id, _elements, unit.properties.level.properties.ordinal);
5865
5491
  }
5866
5492
  });
5867
- units.filter((u4) => u4.properties.category === "room").forEach((unit) => {
5493
+ units.filter((u) => u.properties.category === "room").forEach((unit) => {
5868
5494
  const openingRelationships = relationships.filter((r) => r.properties.origin?.id === unit.id || r.properties.destination?.id === unit.id);
5869
5495
  const roomOpenings = compact2(openingRelationships.map((rel) => {
5870
5496
  const openingId = rel?.properties.intermediary[0].id;
@@ -5890,7 +5516,7 @@ var RendererManager = class extends EventTarget {
5890
5516
  this.addElementsToManager(kiosk.id, _elements, kiosk.properties.level.properties.ordinal);
5891
5517
  }
5892
5518
  });
5893
- const escalators = units.filter((u4) => u4.properties.category === "escalator");
5519
+ const escalators = units.filter((u) => u.properties.category === "escalator");
5894
5520
  for (const escalator of escalators) {
5895
5521
  try {
5896
5522
  const escalatorRelationships = relationships.filter((r) => (r.properties?.intermediary || []).some((inter) => inter.id === escalator.id));
@@ -5924,8 +5550,8 @@ var RendererManager = class extends EventTarget {
5924
5550
  }
5925
5551
  const groundLabels = await this.#dataClient.filterByType("label");
5926
5552
  for (const label of groundLabels) {
5927
- const center2 = turfCenter2(polygon(label.geometry.coordinates)).geometry.coordinates;
5928
- const unit = findUnitOnPoint(units, center2);
5553
+ const center4 = turfCenter2(polygon(label.geometry.coordinates)).geometry.coordinates;
5554
+ const unit = findUnitOnPoint(units, center4);
5929
5555
  if (unit) {
5930
5556
  const element = this.elementRenderer.createGroundLabel(label, unit);
5931
5557
  if (element) {
@@ -6160,8 +5786,8 @@ var IndoorMap = class extends EventTarget {
6160
5786
  this.#venues = venues;
6161
5787
  const venueCenters = turfCenter3(featureCollection(venues));
6162
5788
  const [x, y] = venueCenters.geometry.coordinates;
6163
- const center2 = new Coordinate4(x, y);
6164
- this.camera.setView({ center: center2, pitch: 60, zoom: 19 });
5789
+ const center4 = new Coordinate4(x, y);
5790
+ this.camera.setView({ center: center4, pitch: 60, zoom: 19 });
6165
5791
  });
6166
5792
  }
6167
5793
  }
@@ -6804,6 +6430,7 @@ export {
6804
6430
  GEOJSON_FEATURE_TYPES,
6805
6431
  HIGHLIGHT_LAYER_NAME,
6806
6432
  IMDF_FEATURE_TYPES,
6433
+ IMDF_UNIT_CATEGORIES,
6807
6434
  IndoorMap,
6808
6435
  LAST_USER_LOCATION_ELEMENT_ID_PREFIX,
6809
6436
  LAYERS,