@archilogic/floor-plan-sdk 5.1.6 → 5.1.8

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/fpe.js CHANGED
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  /*!
5
- Archilogic Floor Plan Engine SDK v5.1.6 webgl build 250326-135213-0888be
5
+ Archilogic Floor Plan Engine SDK v5.1.8 webgl build 250429-111617-277c93
6
6
 
7
7
  Copyright (c) 2025 Archilogic AG. All rights reserved.
8
8
 
@@ -4617,6 +4617,13 @@ function signedArea$1(polygon) {
4617
4617
  function polygonArea(polygon) {
4618
4618
  return Math.abs(signedArea$1(polygon));
4619
4619
  }
4620
+ function polygonWithHolesArea(polygons) {
4621
+ let area2 = Math.abs(signedArea$1(polygons[0]));
4622
+ for (let polygon of polygons.slice(1)) {
4623
+ area2 -= Math.abs(signedArea$1(polygon));
4624
+ }
4625
+ return area2;
4626
+ }
4620
4627
  function cleanPolygons(polygons, distance = 0.01) {
4621
4628
  let _polygons = getClipperPolygons(polygons);
4622
4629
  let result = ClipperLib$1.Clipper.CleanPolygons(_polygons, distance);
@@ -5343,10 +5350,10 @@ function transformMat2d(out, a2, m2) {
5343
5350
  };
5344
5351
  })();
5345
5352
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
5346
- function getDefaultExportFromCjs(x2) {
5353
+ function getDefaultExportFromCjs$1(x2) {
5347
5354
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5348
5355
  }
5349
- function getAugmentedNamespace(n2) {
5356
+ function getAugmentedNamespace$1(n2) {
5350
5357
  if (n2.__esModule) return n2;
5351
5358
  var f3 = n2.default;
5352
5359
  if (typeof f3 == "function") {
@@ -5794,7 +5801,7 @@ earcut.flatten = function(data) {
5794
5801
  return result;
5795
5802
  };
5796
5803
  var earcutExports = earcut$2.exports;
5797
- const earcut$1 = /* @__PURE__ */ getDefaultExportFromCjs(earcutExports);
5804
+ const earcut$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(earcutExports);
5798
5805
  var byteToHex = [];
5799
5806
  for (var i$3 = 0; i$3 < 256; ++i$3) {
5800
5807
  byteToHex.push((i$3 + 256).toString(16).slice(1));
@@ -6400,6 +6407,223 @@ function resolveTransform(position, rotation) {
6400
6407
  }
6401
6408
  return resolvedTransformList;
6402
6409
  }
6410
+ function getDefaultExportFromCjs(x2) {
6411
+ return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
6412
+ }
6413
+ function getAugmentedNamespace(n2) {
6414
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
6415
+ var f3 = n2.default;
6416
+ if (typeof f3 == "function") {
6417
+ var a2 = function a22() {
6418
+ if (this instanceof a22) {
6419
+ return Reflect.construct(f3, arguments, this.constructor);
6420
+ }
6421
+ return f3.apply(this, arguments);
6422
+ };
6423
+ a2.prototype = f3.prototype;
6424
+ } else a2 = {};
6425
+ Object.defineProperty(a2, "__esModule", { value: true });
6426
+ Object.keys(n2).forEach(function(k3) {
6427
+ var d2 = Object.getOwnPropertyDescriptor(n2, k3);
6428
+ Object.defineProperty(a2, k3, d2.get ? d2 : {
6429
+ enumerable: true,
6430
+ get: function() {
6431
+ return n2[k3];
6432
+ }
6433
+ });
6434
+ });
6435
+ return a2;
6436
+ }
6437
+ var polylabel$1$1 = { exports: {} };
6438
+ let TinyQueue$1 = class TinyQueue {
6439
+ constructor(data = [], compare = defaultCompare$1) {
6440
+ this.data = data;
6441
+ this.length = this.data.length;
6442
+ this.compare = compare;
6443
+ if (this.length > 0) {
6444
+ for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--) this._down(i2);
6445
+ }
6446
+ }
6447
+ push(item) {
6448
+ this.data.push(item);
6449
+ this.length++;
6450
+ this._up(this.length - 1);
6451
+ }
6452
+ pop() {
6453
+ if (this.length === 0) return void 0;
6454
+ const top = this.data[0];
6455
+ const bottom = this.data.pop();
6456
+ this.length--;
6457
+ if (this.length > 0) {
6458
+ this.data[0] = bottom;
6459
+ this._down(0);
6460
+ }
6461
+ return top;
6462
+ }
6463
+ peek() {
6464
+ return this.data[0];
6465
+ }
6466
+ _up(pos) {
6467
+ const { data, compare } = this;
6468
+ const item = data[pos];
6469
+ while (pos > 0) {
6470
+ const parent = pos - 1 >> 1;
6471
+ const current = data[parent];
6472
+ if (compare(item, current) >= 0) break;
6473
+ data[pos] = current;
6474
+ pos = parent;
6475
+ }
6476
+ data[pos] = item;
6477
+ }
6478
+ _down(pos) {
6479
+ const { data, compare } = this;
6480
+ const halfLength = this.length >> 1;
6481
+ const item = data[pos];
6482
+ while (pos < halfLength) {
6483
+ let left = (pos << 1) + 1;
6484
+ let best = data[left];
6485
+ const right = left + 1;
6486
+ if (right < this.length && compare(data[right], best) < 0) {
6487
+ left = right;
6488
+ best = data[right];
6489
+ }
6490
+ if (compare(best, item) >= 0) break;
6491
+ data[pos] = best;
6492
+ pos = left;
6493
+ }
6494
+ data[pos] = item;
6495
+ }
6496
+ };
6497
+ function defaultCompare$1(a2, b2) {
6498
+ return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
6499
+ }
6500
+ const tinyqueue$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6501
+ __proto__: null,
6502
+ default: TinyQueue$1
6503
+ }, Symbol.toStringTag, { value: "Module" }));
6504
+ const require$$0$2 = /* @__PURE__ */ getAugmentedNamespace(tinyqueue$1);
6505
+ var hasRequiredPolylabel;
6506
+ function requirePolylabel() {
6507
+ if (hasRequiredPolylabel) return polylabel$1$1.exports;
6508
+ hasRequiredPolylabel = 1;
6509
+ var Queue2 = require$$0$2;
6510
+ if (Queue2.default) Queue2 = Queue2.default;
6511
+ polylabel$1$1.exports = polylabel2;
6512
+ polylabel$1$1.exports.default = polylabel2;
6513
+ function polylabel2(polygon, precision, debug) {
6514
+ precision = precision || 1;
6515
+ var minX, minY, maxX, maxY;
6516
+ for (var i2 = 0; i2 < polygon[0].length; i2++) {
6517
+ var p2 = polygon[0][i2];
6518
+ if (!i2 || p2[0] < minX) minX = p2[0];
6519
+ if (!i2 || p2[1] < minY) minY = p2[1];
6520
+ if (!i2 || p2[0] > maxX) maxX = p2[0];
6521
+ if (!i2 || p2[1] > maxY) maxY = p2[1];
6522
+ }
6523
+ var width = maxX - minX;
6524
+ var height = maxY - minY;
6525
+ var cellSize = Math.min(width, height);
6526
+ var h2 = cellSize / 2;
6527
+ if (cellSize === 0) {
6528
+ var degeneratePoleOfInaccessibility = [minX, minY];
6529
+ degeneratePoleOfInaccessibility.distance = 0;
6530
+ return degeneratePoleOfInaccessibility;
6531
+ }
6532
+ var cellQueue = new Queue2(void 0, compareMax2);
6533
+ for (var x2 = minX; x2 < maxX; x2 += cellSize) {
6534
+ for (var y2 = minY; y2 < maxY; y2 += cellSize) {
6535
+ cellQueue.push(new Cell2(x2 + h2, y2 + h2, h2, polygon));
6536
+ }
6537
+ }
6538
+ var bestCell = getCentroidCell2(polygon);
6539
+ var bboxCell = new Cell2(minX + width / 2, minY + height / 2, 0, polygon);
6540
+ if (bboxCell.d > bestCell.d) bestCell = bboxCell;
6541
+ var numProbes = cellQueue.length;
6542
+ while (cellQueue.length) {
6543
+ var cell = cellQueue.pop();
6544
+ if (cell.d > bestCell.d) {
6545
+ bestCell = cell;
6546
+ if (debug) console.log("found best %d after %d probes", Math.round(1e4 * cell.d) / 1e4, numProbes);
6547
+ }
6548
+ if (cell.max - bestCell.d <= precision) continue;
6549
+ h2 = cell.h / 2;
6550
+ cellQueue.push(new Cell2(cell.x - h2, cell.y - h2, h2, polygon));
6551
+ cellQueue.push(new Cell2(cell.x + h2, cell.y - h2, h2, polygon));
6552
+ cellQueue.push(new Cell2(cell.x - h2, cell.y + h2, h2, polygon));
6553
+ cellQueue.push(new Cell2(cell.x + h2, cell.y + h2, h2, polygon));
6554
+ numProbes += 4;
6555
+ }
6556
+ if (debug) {
6557
+ console.log("num probes: " + numProbes);
6558
+ console.log("best distance: " + bestCell.d);
6559
+ }
6560
+ var poleOfInaccessibility = [bestCell.x, bestCell.y];
6561
+ poleOfInaccessibility.distance = bestCell.d;
6562
+ return poleOfInaccessibility;
6563
+ }
6564
+ function compareMax2(a2, b2) {
6565
+ return b2.max - a2.max;
6566
+ }
6567
+ function Cell2(x2, y2, h2, polygon) {
6568
+ this.x = x2;
6569
+ this.y = y2;
6570
+ this.h = h2;
6571
+ this.d = pointToPolygonDist2(x2, y2, polygon);
6572
+ this.max = this.d + this.h * Math.SQRT2;
6573
+ }
6574
+ function pointToPolygonDist2(x2, y2, polygon) {
6575
+ var inside = false;
6576
+ var minDistSq = Infinity;
6577
+ for (var k3 = 0; k3 < polygon.length; k3++) {
6578
+ var ring = polygon[k3];
6579
+ for (var i2 = 0, len2 = ring.length, j2 = len2 - 1; i2 < len2; j2 = i2++) {
6580
+ var a2 = ring[i2];
6581
+ var b2 = ring[j2];
6582
+ if (a2[1] > y2 !== b2[1] > y2 && x2 < (b2[0] - a2[0]) * (y2 - a2[1]) / (b2[1] - a2[1]) + a2[0]) inside = !inside;
6583
+ minDistSq = Math.min(minDistSq, getSegDistSq2(x2, y2, a2, b2));
6584
+ }
6585
+ }
6586
+ return minDistSq === 0 ? 0 : (inside ? 1 : -1) * Math.sqrt(minDistSq);
6587
+ }
6588
+ function getCentroidCell2(polygon) {
6589
+ var area2 = 0;
6590
+ var x2 = 0;
6591
+ var y2 = 0;
6592
+ var points = polygon[0];
6593
+ for (var i2 = 0, len2 = points.length, j2 = len2 - 1; i2 < len2; j2 = i2++) {
6594
+ var a2 = points[i2];
6595
+ var b2 = points[j2];
6596
+ var f3 = a2[0] * b2[1] - b2[0] * a2[1];
6597
+ x2 += (a2[0] + b2[0]) * f3;
6598
+ y2 += (a2[1] + b2[1]) * f3;
6599
+ area2 += f3 * 3;
6600
+ }
6601
+ if (area2 === 0) return new Cell2(points[0][0], points[0][1], 0, polygon);
6602
+ return new Cell2(x2 / area2, y2 / area2, 0, polygon);
6603
+ }
6604
+ function getSegDistSq2(px, py, a2, b2) {
6605
+ var x2 = a2[0];
6606
+ var y2 = a2[1];
6607
+ var dx = b2[0] - x2;
6608
+ var dy = b2[1] - y2;
6609
+ if (dx !== 0 || dy !== 0) {
6610
+ var t2 = ((px - x2) * dx + (py - y2) * dy) / (dx * dx + dy * dy);
6611
+ if (t2 > 1) {
6612
+ x2 = b2[0];
6613
+ y2 = b2[1];
6614
+ } else if (t2 > 0) {
6615
+ x2 += dx * t2;
6616
+ y2 += dy * t2;
6617
+ }
6618
+ }
6619
+ dx = px - x2;
6620
+ dy = py - y2;
6621
+ return dx * dx + dy * dy;
6622
+ }
6623
+ return polylabel$1$1.exports;
6624
+ }
6625
+ var polylabelExports = requirePolylabel();
6626
+ const polylabel$2 = /* @__PURE__ */ getDefaultExportFromCjs(polylabelExports);
6403
6627
  function vec2Add(v1, v2) {
6404
6628
  return [v1[0] + v2[0], v1[1] + v2[1]];
6405
6629
  }
@@ -6486,7 +6710,7 @@ function ccw(p1, p2, p3) {
6486
6710
  let d3 = vec2Cross(d1, d2);
6487
6711
  if (d3 > epsilon) {
6488
6712
  return 1;
6489
- } else if (d3 < -epsilon) {
6713
+ } else if (d3 < -1e-7) {
6490
6714
  return -1;
6491
6715
  } else {
6492
6716
  return 0;
@@ -6573,6 +6797,31 @@ function getSignedArea(points) {
6573
6797
  function getPolygonArea(polygon) {
6574
6798
  return Math.abs(getSignedArea(polygon));
6575
6799
  }
6800
+ function getPolygonWithHolesArea(polygonBoundaries) {
6801
+ if (polygonBoundaries.length === 0) {
6802
+ return 0;
6803
+ }
6804
+ let area2 = getPolygonArea(polygonBoundaries[0]);
6805
+ for (let i2 = 1; i2 < polygonBoundaries.length; i2++) {
6806
+ area2 -= getPolygonArea(polygonBoundaries[i2]);
6807
+ }
6808
+ return area2;
6809
+ }
6810
+ function getPolygonCenter(polygon) {
6811
+ const { min, max: max2 } = polygonBounds([polygon]);
6812
+ return [min[0] + (max2[0] - min[0]) / 2, min[1] + (max2[1] - min[1]) / 2];
6813
+ }
6814
+ function getPolygonLabelPoint(polygonWithHoles) {
6815
+ let labelPoint;
6816
+ const area2 = getPolygonWithHolesArea(polygonWithHoles);
6817
+ if (area2 < 0.1) {
6818
+ labelPoint = getPolygonCenter(polygonWithHoles[0]);
6819
+ } else {
6820
+ const point = polylabel$2(polygonWithHoles, 0.1);
6821
+ labelPoint = [point[0], point[1]];
6822
+ }
6823
+ return labelPoint;
6824
+ }
6576
6825
  function getPolygonPerimeter(points, isClosed = true) {
6577
6826
  let perimeter = 0;
6578
6827
  let pointLength = isClosed ? points.length : points.length - 1;
@@ -8174,6 +8423,13 @@ function getCustomAttributeInputType(schema) {
8174
8423
  }
8175
8424
  }
8176
8425
  }
8426
+ function getCustomAttributeResourceTypeCompoundId(customAttributeDefinitionJson) {
8427
+ const {
8428
+ id,
8429
+ attributes: { resourceType }
8430
+ } = customAttributeDefinitionJson;
8431
+ return id.endsWith(`:${resourceType}`) ? id : `${id}:${resourceType}`;
8432
+ }
8177
8433
  function getCustomAttributeSchemaFromValueType(attributesJson) {
8178
8434
  if (attributesJson.schema) {
8179
8435
  return JSON.parse(JSON.stringify(attributesJson.schema));
@@ -8185,6 +8441,41 @@ function getCustomAttributeSchemaFromValueType(attributesJson) {
8185
8441
  return { type: "boolean" };
8186
8442
  }
8187
8443
  }
8444
+ const layoutToCustomAttributeResourceTypeMap = {
8445
+ "spatialStructure:layout": "layout",
8446
+ "layout:space": "space",
8447
+ "product:static": "product",
8448
+ "spatialStructure:building": "building",
8449
+ "spatialStructure:floor": "floor",
8450
+ "element:asset": "element",
8451
+ "element:beam": "element",
8452
+ "element:casework": "element",
8453
+ "element:column": "element",
8454
+ "element:door": "element",
8455
+ "element:kitchen": "element",
8456
+ "element:railing": "element",
8457
+ "element:ramp": "element",
8458
+ "element:roof": "element",
8459
+ "element:slab": "element",
8460
+ "element:stairs": "element",
8461
+ "element:stairFlight": "element",
8462
+ "element:window": "element",
8463
+ "element:generic": "element",
8464
+ "element:floor": "element",
8465
+ "element:ceiling": "element",
8466
+ "element:boundaryWall": "element",
8467
+ "element:curtainWall": "element",
8468
+ "element:opening": "element",
8469
+ "element:spaceDivider": "element",
8470
+ "element:wall": "element"
8471
+ };
8472
+ const getCustomAttributeDefinitionIdForNodeType = (customAttributeNodeKey, nodeType) => {
8473
+ const customAttributeResourceType = layoutToCustomAttributeResourceTypeMap[nodeType];
8474
+ if (!customAttributeResourceType) {
8475
+ logger$1.error(`Missing custom attribute resource type for node type: "${nodeType}"`);
8476
+ }
8477
+ return `${customAttributeNodeKey}:${customAttributeResourceType}`;
8478
+ };
8188
8479
  function migrateCustomAttributeValue(value, schema) {
8189
8480
  if (schema.type === "boolean" && typeof value === "string") {
8190
8481
  if (value.toLowerCase() === "true") return true;
@@ -8256,17 +8547,18 @@ class SpaceGraphNodeWithCustomAttributesBase extends SpaceGraphNodeBase {
8256
8547
  }
8257
8548
  if (customAttributes && customAttributesById) {
8258
8549
  for (const customAttribute in customAttributes) {
8259
- const definition = customAttributesById[customAttribute];
8260
- if (!definition) {
8261
- error = `Missing custom attribute definition: "${customAttribute}""`;
8262
- continue;
8263
- }
8264
8550
  let value = customAttributes[customAttribute];
8265
8551
  if (value === null) {
8266
8552
  delete this.customAttributes[customAttribute];
8267
8553
  attributesChanged = true;
8268
8554
  continue;
8269
8555
  }
8556
+ const attributeId = getCustomAttributeDefinitionIdForNodeType(customAttribute, this.type);
8557
+ const definition = customAttributesById[attributeId];
8558
+ if (!definition) {
8559
+ error = `Missing custom attribute definition for node key: "${customAttribute}", node type: "${this.type}" and definition id: ${attributeId}`;
8560
+ continue;
8561
+ }
8270
8562
  if (!validateCustomAttributeValue(value, definition.attributes.schema)) {
8271
8563
  let migratedValue = migrateCustomAttributeValue(value, definition.attributes.schema);
8272
8564
  if (migratedValue === null) {
@@ -10335,7 +10627,9 @@ function getSpaceFromBoundaries(layout, boundaries, exactMatch) {
10335
10627
  }
10336
10628
  function arePolygonsTheSame(originalSpace, spaces) {
10337
10629
  const insertPolygons = spaces.map((space) => [space.boundaries[0].geometryProfile]);
10338
- const { polygons: unionPolygons } = polygonWithHolesUnion(insertPolygons);
10630
+ const offsetDistance = 0.01;
10631
+ const { polygons: inflatedPolygons } = polygonWithHolesOffset(insertPolygons, offsetDistance);
10632
+ const { polygons: unionPolygons } = polygonWithHolesOffset(inflatedPolygons, -0.01);
10339
10633
  if (unionPolygons.length === 0) {
10340
10634
  logger$1.warn(`No union polygon, cannot match space ${originalSpace.id}.`);
10341
10635
  return false;
@@ -10345,10 +10639,10 @@ function arePolygonsTheSame(originalSpace, spaces) {
10345
10639
  }
10346
10640
  const outerUnionPolygon = unionPolygons[0][0];
10347
10641
  const removePolygon = originalSpace.boundaries[0].geometryProfile;
10348
- const diff1 = polygonDifference([removePolygon], [outerUnionPolygon]);
10349
- const diff2 = polygonDifference([outerUnionPolygon], [removePolygon]);
10350
- const area1 = diff1.length ? polygonArea(diff1[0]) : 0;
10351
- const area2 = diff2.length ? polygonArea(diff2[0]) : 0;
10642
+ const diff1 = polygonWithHolesDifference([[removePolygon]], [[outerUnionPolygon]]).polygons;
10643
+ const diff2 = polygonWithHolesDifference([[outerUnionPolygon]], [[removePolygon]]).polygons;
10644
+ const area1 = diff1.length ? polygonWithHolesArea(diff1[0]) : 0;
10645
+ const area2 = diff2.length ? polygonWithHolesArea(diff2[0]) : 0;
10352
10646
  const eps = 0.01;
10353
10647
  return area1 < eps && area2 < eps;
10354
10648
  }
@@ -14137,7 +14431,7 @@ function getCustomAttributesJson(customAttributes) {
14137
14431
  }
14138
14432
  return customAttributesJson;
14139
14433
  }
14140
- const version = "0.20.6";
14434
+ const version = "0.21.2";
14141
14435
  const schemaVersion = version;
14142
14436
  class SpaceGraph {
14143
14437
  constructor(sourceSchemaVersion) {
@@ -15055,10 +15349,8 @@ function getFloorFromFloorJson(spaceGraph, floorJson) {
15055
15349
  return floor;
15056
15350
  }
15057
15351
  function getCustomAttributeFromCustomAttributeJson(customAttributeDefinitionJson) {
15058
- const customAttribute = new SpaceGraphCustomAttribute(
15059
- customAttributeDefinitionJson.id,
15060
- customAttributeDefinitionJson.attributes
15061
- );
15352
+ const customAttributeId = getCustomAttributeResourceTypeCompoundId(customAttributeDefinitionJson);
15353
+ const customAttribute = new SpaceGraphCustomAttribute(customAttributeId, customAttributeDefinitionJson.attributes);
15062
15354
  loadJsonNameAndCustomId(customAttribute, customAttributeDefinitionJson);
15063
15355
  return customAttribute;
15064
15356
  }
@@ -15138,7 +15430,7 @@ function getSpaceGraphFromSpaceGraphJson(spaceGraphJson) {
15138
15430
  loadSpaceGraph(spaceGraph, spaceGraphJson);
15139
15431
  return spaceGraph;
15140
15432
  }
15141
- function log$2(...args) {
15433
+ function log$4(...args) {
15142
15434
  }
15143
15435
  function computeGraphEdgePoints(graph) {
15144
15436
  const epsilon = 1e-7;
@@ -15286,10 +15578,10 @@ function computeGraphEdgePolygonSegments(graph, edges) {
15286
15578
  computed.points = cleanPoints;
15287
15579
  computed.selfIntersecting = polygonSelfIntersecting(computed.points);
15288
15580
  computed.valid = computed.points.length >= 3 && !computed.skipped && !computed.selfIntersecting;
15289
- log$2(` ${edge.id}`);
15290
- log$2(" valid", computed.valid);
15291
- log$2(" skipped", computed.skipped);
15292
- log$2(" self-intersecting", computed.selfIntersecting);
15581
+ log$4(` ${edge.id}`);
15582
+ log$4(" valid", computed.valid);
15583
+ log$4(" skipped", computed.skipped);
15584
+ log$4(" self-intersecting", computed.selfIntersecting);
15293
15585
  }
15294
15586
  }
15295
15587
  const defaultVertexJoinStyle = "miter";
@@ -15415,7 +15707,7 @@ function sortVertexEdges(graph) {
15415
15707
  }
15416
15708
  const correctiveActionOuter = "intersectCap";
15417
15709
  const correctiveActionInner = "intersectCap";
15418
- function log$1(...args) {
15710
+ function log$3(...args) {
15419
15711
  }
15420
15712
  function valueToFixed(value) {
15421
15713
  let result = value.toFixed(3);
@@ -15436,7 +15728,7 @@ function showPoints(points) {
15436
15728
  if (points.length > 0) {
15437
15729
  for (let i2 = 0; i2 < points.length; i2++) {
15438
15730
  let point = points[i2];
15439
- log$1(` ${i2}: [${point[0]}, ${point[1]}]`);
15731
+ log$3(` ${i2}: [${point[0]}, ${point[1]}]`);
15440
15732
  }
15441
15733
  }
15442
15734
  }
@@ -15508,7 +15800,7 @@ function performCorrectiveAction(fragment2, nextFragment, v2, p1, p2, p3, q1, q2
15508
15800
  }
15509
15801
  }
15510
15802
  function resolveOuter(fragment2, nextFragment, v2, p1, p2, p3, hasGeometry1, q1, q2, q3, hasGeometry2, iteration) {
15511
- log$1(` ${iteration}: ${fragment2.edge.id} -> ${nextFragment.edge.id} (outer)`);
15803
+ log$3(` ${iteration}: ${fragment2.edge.id} -> ${nextFragment.edge.id} (outer)`);
15512
15804
  let ll = getLineIntersection(p1, p2, q1, q2);
15513
15805
  if (ll.tag !== 2) {
15514
15806
  logger$1.warn("Edge side lines do not intersect, ignoring result.", ll);
@@ -15573,11 +15865,11 @@ function resolveOuter(fragment2, nextFragment, v2, p1, p2, p3, hasGeometry1, q1,
15573
15865
  ignoreIntersection(fragment2, nextFragment, v2, p2, q2);
15574
15866
  }
15575
15867
  }
15576
- log$1(` s = ${valueToFixed(s2)} [${sMin.toFixed(3)}] ${correctiveActionTextS}`);
15577
- log$1(` t = ${valueToFixed(t2)} [${tMin.toFixed(3)}] ${correctiveActionTextT}`);
15868
+ log$3(` s = ${valueToFixed(s2)} [${sMin.toFixed(3)}] ${correctiveActionTextS}`);
15869
+ log$3(` t = ${valueToFixed(t2)} [${tMin.toFixed(3)}] ${correctiveActionTextT}`);
15578
15870
  }
15579
15871
  function resolveInner(fragment2, nextFragment, v2, p1, p2, p3, hasGeometry1, q1, q2, q3, hasGeometry2, iteration) {
15580
- log$1(` ${iteration}: ${fragment2.edge.id} -> ${nextFragment.edge.id} (inner)`);
15872
+ log$3(` ${iteration}: ${fragment2.edge.id} -> ${nextFragment.edge.id} (inner)`);
15581
15873
  let ll = getLineIntersection(p1, p2, q1, q2);
15582
15874
  if (ll.tag !== 2) {
15583
15875
  logger$1.warn("Edge side lines do not intersect, ignoring result.", ll);
@@ -15617,8 +15909,8 @@ function resolveInner(fragment2, nextFragment, v2, p1, p2, p3, hasGeometry1, q1,
15617
15909
  } else {
15618
15910
  ignoreIntersection(fragment2, nextFragment, v2, p2, q2);
15619
15911
  }
15620
- log$1(` s = ${valueToFixed(s2)} [${sMin.toFixed(3)}] ${correctiveActionTextS}`);
15621
- log$1(` t = ${valueToFixed(t2)} [${tMin.toFixed(3)}] ${correctiveActionTextT}`);
15912
+ log$3(` s = ${valueToFixed(s2)} [${sMin.toFixed(3)}] ${correctiveActionTextS}`);
15913
+ log$3(` t = ${valueToFixed(t2)} [${tMin.toFixed(3)}] ${correctiveActionTextT}`);
15622
15914
  }
15623
15915
  function resolveSingleEdge(vertexIndex, vertexEdges) {
15624
15916
  let edge = vertexEdges[0];
@@ -15744,7 +16036,7 @@ function computeGraphEdgeIntersections(graph, edges) {
15744
16036
  vertexEdges.push(edge);
15745
16037
  }
15746
16038
  }
15747
- log$1(`Vertex ${i2}, edge count ${vertexEdges.length}`);
16039
+ log$3(`Vertex ${i2}, edge count ${vertexEdges.length}`);
15748
16040
  if (vertexEdges.length === 1) {
15749
16041
  resolveSingleEdge(i2, vertexEdges);
15750
16042
  } else {
@@ -16001,8 +16293,8 @@ var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
16001
16293
  for (var i$2 = 0; i$2 < chars.length; i$2++) {
16002
16294
  lookup[chars.charCodeAt(i$2)] = i$2;
16003
16295
  }
16004
- var polylabel$2 = { exports: {} };
16005
- class TinyQueue {
16296
+ var polylabel$1 = { exports: {} };
16297
+ class TinyQueue2 {
16006
16298
  constructor(data = [], compare = defaultCompare) {
16007
16299
  this.data = data;
16008
16300
  this.length = this.data.length;
@@ -16066,13 +16358,13 @@ function defaultCompare(a2, b2) {
16066
16358
  }
16067
16359
  const tinyqueue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
16068
16360
  __proto__: null,
16069
- default: TinyQueue
16361
+ default: TinyQueue2
16070
16362
  }, Symbol.toStringTag, { value: "Module" }));
16071
- const require$$0$1 = /* @__PURE__ */ getAugmentedNamespace(tinyqueue);
16363
+ const require$$0$1 = /* @__PURE__ */ getAugmentedNamespace$1(tinyqueue);
16072
16364
  var Queue = require$$0$1;
16073
16365
  if (Queue.default) Queue = Queue.default;
16074
- polylabel$2.exports = polylabel;
16075
- polylabel$2.exports.default = polylabel;
16366
+ polylabel$1.exports = polylabel;
16367
+ polylabel$1.exports.default = polylabel;
16076
16368
  function polylabel(polygon, precision, debug) {
16077
16369
  precision = precision || 1;
16078
16370
  var minX, minY, maxX, maxY;
@@ -16183,8 +16475,6 @@ function getSegDistSq(px, py, a2, b2) {
16183
16475
  dy = py - y2;
16184
16476
  return dx * dx + dy * dy;
16185
16477
  }
16186
- var polylabelExports = polylabel$2.exports;
16187
- const polylabel$1 = /* @__PURE__ */ getDefaultExportFromCjs(polylabelExports);
16188
16478
  var sphericalmercator = { exports: {} };
16189
16479
  (function(module, exports) {
16190
16480
  var SphericalMercator = function() {
@@ -16326,7 +16616,7 @@ var sphericalmercator = { exports: {} };
16326
16616
  }
16327
16617
  })(sphericalmercator);
16328
16618
  var sphericalmercatorExports = sphericalmercator.exports;
16329
- const pt = /* @__PURE__ */ getDefaultExportFromCjs(sphericalmercatorExports);
16619
+ const pt = /* @__PURE__ */ getDefaultExportFromCjs$1(sphericalmercatorExports);
16330
16620
  const te = {
16331
16621
  work: {
16332
16622
  name: "Work",
@@ -16913,11 +17203,11 @@ function Te(e2, t2 = create$4(), i2 = /* @__PURE__ */ new Map(), n2 = true) {
16913
17203
  }
16914
17204
  return r2;
16915
17205
  }
16916
- function Vn(e2, t2, i2) {
17206
+ function Hn(e2, t2, i2) {
16917
17207
  let n2 = fromValues(...e2), r2 = fromValues(...t2), l2 = fromValues(...i2), o2 = create$3(), s2 = create$3(), a2 = create$3();
16918
17208
  return subtract(o2, n2, l2), subtract(s2, r2, l2), cross(a2, o2, s2), normalize$2(a2, a2), [...a2];
16919
17209
  }
16920
- function dt(e2) {
17210
+ function mt(e2) {
16921
17211
  let { indices: t2, vertices: i2 } = e2, n2 = [], r2 = [], l2 = [], o2 = getBoundingBox(i2);
16922
17212
  for (let c2 = 0; c2 < i2.length; c2 += 3) {
16923
17213
  let u2 = i2[c2], m2 = i2[c2 + 1], E3 = i2[c2 + 2];
@@ -16925,7 +17215,7 @@ function dt(e2) {
16925
17215
  }
16926
17216
  for (let c2 = 0; c2 < t2.length; c2 += 3) {
16927
17217
  let u2 = t2[c2], m2 = t2[c2 + 1], E3 = t2[c2 + 2];
16928
- Vn(n2[u2], n2[m2], n2[E3])[1] < 0.01 || l2.push([r2[u2], r2[m2], r2[E3]]);
17218
+ Hn(n2[u2], n2[m2], n2[E3])[1] < 0.01 || l2.push([r2[u2], r2[m2], r2[E3]]);
16929
17219
  }
16930
17220
  let s2 = [], a2 = [[]];
16931
17221
  if (!l2.length)
@@ -16936,11 +17226,11 @@ function dt(e2) {
16936
17226
  isCounterClockwise(c2) ? a2[0].push(c2) : s2.push(c2);
16937
17227
  return { outlines: s2, holes: a2, boundingBox: o2 };
16938
17228
  }
16939
- function or(e2, t2 = {}) {
17229
+ function rr(e2, t2 = {}) {
16940
17230
  let i2 = t2.applyElementMatrix ? getElementMatrix(e2, t2.parentMatrix) : void 0, n2 = Te(e2, i2, t2.resources), r2 = [];
16941
17231
  for (let l2 of n2)
16942
17232
  for (let o2 of l2.meshes)
16943
- r2.push(dt(o2));
17233
+ r2.push(mt(o2));
16944
17234
  return r2;
16945
17235
  }
16946
17236
  const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
@@ -18193,7 +18483,7 @@ function getElementAnnotations(element) {
18193
18483
  return shapes;
18194
18484
  }
18195
18485
  function getShapesFromMesh(element) {
18196
- const meshContours = or(element).sort((a2, b2) => {
18486
+ const meshContours = rr(element).sort((a2, b2) => {
18197
18487
  if (a2.boundingBox.max[1] < b2.boundingBox.max[1]) return -1;
18198
18488
  else return 1;
18199
18489
  });
@@ -19166,7 +19456,7 @@ var eventemitter3 = { exports: {} };
19166
19456
  }
19167
19457
  })(eventemitter3);
19168
19458
  var eventemitter3Exports = eventemitter3.exports;
19169
- const EventEmitter = /* @__PURE__ */ getDefaultExportFromCjs(eventemitter3Exports);
19459
+ const EventEmitter = /* @__PURE__ */ getDefaultExportFromCjs$1(eventemitter3Exports);
19170
19460
  var punycode$1 = { exports: {} };
19171
19461
  /*! https://mths.be/punycode v1.4.1 by @mathias */
19172
19462
  punycode$1.exports;
@@ -20043,7 +20333,7 @@ const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
20043
20333
  __proto__: null,
20044
20334
  default: __viteBrowserExternal
20045
20335
  }, Symbol.toStringTag, { value: "Module" }));
20046
- const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
20336
+ const require$$0 = /* @__PURE__ */ getAugmentedNamespace$1(__viteBrowserExternal$1);
20047
20337
  var hasMap = typeof Map === "function" && Map.prototype;
20048
20338
  var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null;
20049
20339
  var mapSize$1 = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === "function" ? mapSizeDescriptor.get : null;
@@ -33059,12 +33349,12 @@ class BezierUtils {
33059
33349
  const n2 = curves._segmentsCount(
33060
33350
  BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)
33061
33351
  );
33062
- let dt2 = 0, dt22 = 0, dt3 = 0, t2 = 0, t3 = 0;
33352
+ let dt = 0, dt2 = 0, dt3 = 0, t2 = 0, t3 = 0;
33063
33353
  points.push(fromX, fromY);
33064
33354
  for (let i2 = 1, j2 = 0; i2 <= n2; ++i2)
33065
- j2 = i2 / n2, dt2 = 1 - j2, dt22 = dt2 * dt2, dt3 = dt22 * dt2, t2 = j2 * j2, t3 = t2 * j2, points.push(
33066
- dt3 * fromX + 3 * dt22 * j2 * cpX + 3 * dt2 * t2 * cpX2 + t3 * toX,
33067
- dt3 * fromY + 3 * dt22 * j2 * cpY + 3 * dt2 * t2 * cpY2 + t3 * toY
33355
+ j2 = i2 / n2, dt = 1 - j2, dt2 = dt * dt, dt3 = dt2 * dt, t2 = j2 * j2, t3 = t2 * j2, points.push(
33356
+ dt3 * fromX + 3 * dt2 * j2 * cpX + 3 * dt * t2 * cpX2 + t3 * toX,
33357
+ dt3 * fromY + 3 * dt2 * j2 * cpY + 3 * dt * t2 * cpY2 + t3 * toY
33068
33358
  );
33069
33359
  }
33070
33360
  }
@@ -36434,7 +36724,7 @@ var penner = { exports: {} };
36434
36724
  }).call(commonjsGlobal);
36435
36725
  })(penner);
36436
36726
  var pennerExports = penner.exports;
36437
- const Penner = /* @__PURE__ */ getDefaultExportFromCjs(pennerExports);
36727
+ const Penner = /* @__PURE__ */ getDefaultExportFromCjs$1(pennerExports);
36438
36728
  Container.prototype._renderCanvas = function(_renderer) {
36439
36729
  };
36440
36730
  Container.prototype.renderCanvas = function(renderer) {
@@ -42778,7 +43068,7 @@ function drawRoomStamp(space, ctx, zoom, settings2) {
42778
43068
  if (profiles.length === 0) {
42779
43069
  return;
42780
43070
  }
42781
- let textPosition = polylabel$1(profiles);
43071
+ let textPosition = getPolygonLabelPoint(profiles);
42782
43072
  let content = getRoomStampContent(space, settings2);
42783
43073
  let contentStr = content.join("\n");
42784
43074
  const txtGfx = new Text(contentStr, style);
@@ -43891,7 +44181,7 @@ class PolygonHelper extends Helper {
43891
44181
  const polygonWithLimitedPrecision = polygon.map((points) => {
43892
44182
  return points.map((number) => Number(number.toFixed(10)));
43893
44183
  }).slice(0, this.isInAreaMode ? void 0 : 2);
43894
- const center = this.isInAreaMode ? polylabel$1([polygonWithLimitedPrecision]) : [
44184
+ const center = this.isInAreaMode ? getPolygonLabelPoint([polygonWithLimitedPrecision]) : [
43895
44185
  polygonWithLimitedPrecision[0][0] + (polygonWithLimitedPrecision[1][0] - polygonWithLimitedPrecision[0][0]) / 2,
43896
44186
  polygonWithLimitedPrecision[0][1] + (polygonWithLimitedPrecision[1][1] - polygonWithLimitedPrecision[0][1]) / 2
43897
44187
  ];