@eyeon/map 2.0.1 → 2.0.2

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.
Files changed (96) hide show
  1. package/README.md +18 -1
  2. package/dist/assets/MapViewer.css +1 -1
  3. package/dist/assets/index.css +1 -1
  4. package/dist/chunks/MapViewer.js +1745 -356
  5. package/dist/chunks/MapViewer.js.map +1 -1
  6. package/dist/chunks/stacking.js +1321 -0
  7. package/dist/chunks/stacking.js.map +1 -0
  8. package/dist/core/geometry/index.d.ts +41 -4
  9. package/dist/core/geometry/index.d.ts.map +1 -1
  10. package/dist/core/hostChrome.d.ts +20 -0
  11. package/dist/core/hostChrome.d.ts.map +1 -0
  12. package/dist/core/import/index.d.ts +48 -3
  13. package/dist/core/import/index.d.ts.map +1 -1
  14. package/dist/core/import/svgStyle.d.ts +21 -0
  15. package/dist/core/import/svgStyle.d.ts.map +1 -0
  16. package/dist/core/import/svgTransform.d.ts +49 -0
  17. package/dist/core/import/svgTransform.d.ts.map +1 -0
  18. package/dist/core/index.d.ts +3 -0
  19. package/dist/core/index.d.ts.map +1 -1
  20. package/dist/core/index.js +207 -266
  21. package/dist/core/index.js.map +1 -1
  22. package/dist/core/layerStyles.d.ts +28 -0
  23. package/dist/core/layerStyles.d.ts.map +1 -0
  24. package/dist/core/publish/index.d.ts +8 -2
  25. package/dist/core/publish/index.d.ts.map +1 -1
  26. package/dist/core/routing/graph-tools.d.ts +5 -1
  27. package/dist/core/routing/graph-tools.d.ts.map +1 -1
  28. package/dist/core/stacking.d.ts +61 -0
  29. package/dist/core/stacking.d.ts.map +1 -0
  30. package/dist/core/types.d.ts +27 -0
  31. package/dist/core/types.d.ts.map +1 -1
  32. package/dist/editor/MapEditor.d.ts +28 -16
  33. package/dist/editor/MapEditor.d.ts.map +1 -1
  34. package/dist/editor/canvas/EditorCanvas.d.ts +15 -3
  35. package/dist/editor/canvas/EditorCanvas.d.ts.map +1 -1
  36. package/dist/editor/canvas/coords.d.ts +21 -0
  37. package/dist/editor/canvas/coords.d.ts.map +1 -0
  38. package/dist/editor/draftOps.d.ts +19 -0
  39. package/dist/editor/draftOps.d.ts.map +1 -0
  40. package/dist/editor/geometryEdit.d.ts +34 -0
  41. package/dist/editor/geometryEdit.d.ts.map +1 -0
  42. package/dist/editor/index.css +1281 -145
  43. package/dist/editor/index.d.ts +8 -2
  44. package/dist/editor/index.d.ts.map +1 -1
  45. package/dist/editor/index.js +2293 -585
  46. package/dist/editor/index.js.map +1 -1
  47. package/dist/editor/labels.d.ts +5 -0
  48. package/dist/editor/labels.d.ts.map +1 -0
  49. package/dist/editor/panels/FloorsPanel.d.ts +60 -0
  50. package/dist/editor/panels/FloorsPanel.d.ts.map +1 -0
  51. package/dist/editor/panels/ImportReviewPanel.d.ts +22 -0
  52. package/dist/editor/panels/ImportReviewPanel.d.ts.map +1 -0
  53. package/dist/editor/panels/Inspector.d.ts +4 -2
  54. package/dist/editor/panels/Inspector.d.ts.map +1 -1
  55. package/dist/editor/panels/LeftRail.d.ts +19 -6
  56. package/dist/editor/panels/LeftRail.d.ts.map +1 -1
  57. package/dist/editor/panels/PreviewOverlay.d.ts +11 -2
  58. package/dist/editor/panels/PreviewOverlay.d.ts.map +1 -1
  59. package/dist/editor/portalSurface.d.ts +11 -0
  60. package/dist/editor/portalSurface.d.ts.map +1 -0
  61. package/dist/editor/previewDocument.d.ts +9 -0
  62. package/dist/editor/previewDocument.d.ts.map +1 -0
  63. package/dist/editor/tools.d.ts +20 -0
  64. package/dist/editor/tools.d.ts.map +1 -0
  65. package/dist/test-maps/shops-at-south-town/BASE - Shops At South Town.ai +26780 -26
  66. package/dist/test-maps/shops-at-south-town/LF - Shops At South Town.ai +4487 -2
  67. package/dist/test-maps/shops-at-south-town/SVG/BASE - Shops At South Town.svg +567 -0
  68. package/dist/test-maps/shops-at-south-town/SVG/LF - Shops At South Town.svg +238 -0
  69. package/dist/test-maps/shops-at-south-town/SVG/UF - Shops At South Town.svg +276 -0
  70. package/dist/test-maps/shops-at-south-town/UF - Shops At South Town.ai +4228 -1
  71. package/dist/viewer/MapViewer.d.ts +14 -3
  72. package/dist/viewer/MapViewer.d.ts.map +1 -1
  73. package/dist/viewer/camera.d.ts +34 -0
  74. package/dist/viewer/camera.d.ts.map +1 -0
  75. package/dist/viewer/components/CameraRig.d.ts +18 -0
  76. package/dist/viewer/components/CameraRig.d.ts.map +1 -0
  77. package/dist/viewer/components/LevelMeshes.d.ts +6 -1
  78. package/dist/viewer/components/LevelMeshes.d.ts.map +1 -1
  79. package/dist/viewer/components/MapScene.d.ts +6 -1
  80. package/dist/viewer/components/MapScene.d.ts.map +1 -1
  81. package/dist/viewer/components/SvgVectorLayer.d.ts +18 -0
  82. package/dist/viewer/components/SvgVectorLayer.d.ts.map +1 -0
  83. package/dist/viewer/index.css +124 -35
  84. package/dist/viewer/index.d.ts +4 -0
  85. package/dist/viewer/index.d.ts.map +1 -1
  86. package/dist/viewer/index.js +9 -4
  87. package/dist/viewer/index.js.map +1 -1
  88. package/dist/viewer/ui/MapControls.d.ts +14 -0
  89. package/dist/viewer/ui/MapControls.d.ts.map +1 -0
  90. package/dist/viewer/ui/RuntimeChrome.d.ts +3 -3
  91. package/dist/viewer/ui/RuntimeChrome.d.ts.map +1 -1
  92. package/package.json +7 -3
  93. package/dist/chunks/graph-tools.js +0 -153
  94. package/dist/chunks/graph-tools.js.map +0 -1
  95. package/dist/chunks/pathfinding.js +0 -343
  96. package/dist/chunks/pathfinding.js.map +0 -1
@@ -0,0 +1,49 @@
1
+ import { Vec2 } from '../types';
2
+ /**
3
+ * 2D affine matrix in SVG order:
4
+ *
5
+ * ```
6
+ * | a c e |
7
+ * | b d f |
8
+ * | 0 0 1 |
9
+ * ```
10
+ */
11
+ export interface Matrix2D {
12
+ a: number;
13
+ b: number;
14
+ c: number;
15
+ d: number;
16
+ e: number;
17
+ f: number;
18
+ }
19
+ export declare const IDENTITY_MATRIX: Matrix2D;
20
+ /**
21
+ * Matrix product `outer × inner`: the returned matrix applies `inner` first,
22
+ * then `outer`. SVG composes `transform="A B"` the same way — the rightmost
23
+ * transform is applied to the geometry first, and an ancestor `<g>` transform
24
+ * is the outer one relative to its descendants.
25
+ */
26
+ export declare function multiplyMatrix(outer: Matrix2D, inner: Matrix2D): Matrix2D;
27
+ export declare function applyMatrix(m: Matrix2D, p: Vec2): Vec2;
28
+ export declare function isIdentityMatrix(m: Matrix2D, epsilon?: number): boolean;
29
+ /**
30
+ * Parse an SVG `transform` attribute into a single affine matrix.
31
+ * Unknown functions are skipped. Returns identity for empty / unparseable input.
32
+ */
33
+ export declare function parseTransform(raw: string | null | undefined): Matrix2D;
34
+ /**
35
+ * Bake an affine matrix into a path `d` string, emitting absolute commands.
36
+ *
37
+ * Flattening a bezier commutes with an affine map (control points transform
38
+ * independently, sampling parameters do not change), so
39
+ * `pathToPolygons(transformPathD(d, m))` equals `pathToPolygons(d)` mapped
40
+ * through `m`. That is what keeps `geometry.paths[].d` and `geometry.polygons`
41
+ * in the same coordinate space.
42
+ *
43
+ * Arcs commute exactly under a similarity (translate / rotate / uniform scale /
44
+ * mirror), which covers Illustrator output. A shear or non-uniform scale maps
45
+ * the same curve but reparameterises it, so individual sample points may shift
46
+ * along the outline even though the outline itself is right.
47
+ */
48
+ export declare function transformPathD(d: string, m: Matrix2D): string;
49
+ //# sourceMappingURL=svgTransform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgTransform.d.ts","sourceRoot":"","sources":["../../../src/core/import/svgTransform.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGrC;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,eAAO,MAAM,eAAe,EAAE,QAAiD,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,CASzE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,CAKtD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,SAAO,GAAG,OAAO,CASrE;AAmDD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,CAmBvE;AA+CD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CA8J7D"}
@@ -1,7 +1,10 @@
1
1
  export * from './types';
2
+ export * from './hostChrome';
3
+ export * from './layerStyles';
2
4
  export * from './geometry';
3
5
  export * from './import';
4
6
  export * from './routing/graph-tools';
5
7
  export * from './routing/pathfinding';
6
8
  export * from './publish';
9
+ export * from './stacking';
7
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
@@ -1,282 +1,223 @@
1
- import { b as w, g as I, c as y, e as S, f as E } from "../chunks/pathfinding.js";
2
- import { D as K, F as U, I as z, h as B, i as W, j as G, k as V, l as H, m as j, d as X, o as Z, q as Y, r as q, s as Q, n as J, a as ee, t as ne, p as ie, u as se, v as te } from "../chunks/pathfinding.js";
3
- import { a as re, b as ae, f as ce, i as de, u as le, w as pe } from "../chunks/graph-tools.js";
4
- const P = [
5
- { prefix: "walkable", kind: "walkable" },
6
- { prefix: "void", kind: "void" },
7
- { prefix: "unit", kind: "unit" },
8
- { prefix: "store", kind: "unit" },
9
- // v1 compatibility
10
- { prefix: "wall", kind: "wall" },
11
- { prefix: "boundary", kind: "boundary" },
12
- { prefix: "outer-wall", kind: "wall" },
13
- { prefix: "amenity-", kind: "amenity" },
14
- { prefix: "kiosk-", kind: "kiosk_screen" },
15
- { prefix: "escalator-", kind: "connector" },
16
- { prefix: "elevator-", kind: "connector" },
17
- { prefix: "stairs-", kind: "connector" },
18
- { prefix: "entrance-", kind: "entrance" },
19
- { prefix: "zone-", kind: "zone" },
20
- { prefix: "label-", kind: "label" },
21
- { prefix: "floorplate", kind: "floorplate" },
22
- { prefix: "base", kind: "floorplate" },
23
- { prefix: "decor", kind: "decor" },
24
- { prefix: "special-shape", kind: "decor" },
25
- { prefix: "overlay", kind: "decor" }
26
- ], $ = [
27
- { prefix: "parking-zone", kind: "parking_zone" },
28
- { prefix: "parking-lane", kind: "parking_zone" },
29
- { prefix: "parking-line", kind: "decor" },
30
- { prefix: "parking-icon", kind: "parking_icon" },
31
- { prefix: "green-area", kind: "green_area" },
32
- { prefix: "water", kind: "water" },
33
- { prefix: "decor", kind: "decor" },
34
- { prefix: "entrance-", kind: "entrance" },
35
- { prefix: "unit", kind: "unit" },
36
- { prefix: "store", kind: "unit" },
37
- { prefix: "interactive-", kind: "unit" },
38
- { prefix: "walkable", kind: "walkable" },
39
- { prefix: "amenity-", kind: "amenity" }
40
- ], A = "route-path";
41
- function L(n, t = "floor") {
42
- const o = n.toLowerCase(), a = t === "base" ? $ : P;
43
- for (const { prefix: l, kind: p } of a)
44
- if (o === l || o.startsWith(l))
45
- return { kind: p, guessed: !1 };
46
- return o.startsWith("interactive") ? { kind: "unit", guessed: !0 } : { kind: null, guessed: !1 };
47
- }
48
- function v(n) {
49
- const t = n.trim().split(/[\s,]+/).map(Number);
50
- if (t.length < 4) return "";
51
- let o = `M ${t[0]} ${t[1]}`;
52
- for (let a = 2; a < t.length; a += 2)
53
- o += ` L ${t[a]} ${t[a + 1]}`;
54
- return o += " Z", o;
55
- }
56
- function _(n, t, o, a) {
57
- return `M ${n} ${t} L ${o} ${a}`;
58
- }
59
- function C(n) {
60
- const t = n.match(/viewBox\s*=\s*["']([^"']+)["']/i), o = y(t == null ? void 0 : t[1]), a = [], l = [], p = /<(path|polygon|polyline|line|rect|g)\b([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/gi;
61
- let i;
62
- for (; (i = p.exec(n)) !== null; ) {
63
- const e = i[1].toLowerCase(), c = i[2] ?? "", k = c.match(/\bid\s*=\s*["']([^"']+)["']/i);
64
- if (!k) continue;
65
- const f = k[1], g = /\bdata-interactive\s*=\s*["']?(true|1|yes)/i.test(c);
66
- if (f.toLowerCase().startsWith(A)) {
67
- const s = c.match(/\bd\s*=\s*["']([^"']+)["']/i);
68
- s && l.push(s[1]);
69
- const r = c.match(/\bpoints\s*=\s*["']([^"']+)["']/i);
70
- r && l.push(v(r[1]).replace(/ Z$/, ""));
1
+ import { D as g, n as L, d as A, p as S, a as T } from "../chunks/stacking.js";
2
+ import { b as F, F as O, I as R, c as N, e as B, f as $, S as G, g as Y, h as H, j as V, k as j, l as K, o as U, q as W, r as X, s as z, t as Q, u as q, w as J, x as Z, y as ee, z as ne, A as te, B as oe, C as se, E as ae, G as ie, H as re, J as de, K as ce, L as le, M as fe, N as ue, O as he, P as pe, Q as me, R as Ie, i as ye, T as xe, U as ge, V as Ae, m as Se, W as ve, X as Le, Y as Te, Z as we, _ as Ee, $ as be, a0 as Me, a1 as Pe, a2 as ke, a3 as De, a4 as _e, a5 as Ce, a6 as Fe, a7 as Oe, a8 as Re, a9 as Ne, aa as Be, ab as $e, ac as Ge, ad as Ye, v as He, ae as Ve } from "../chunks/stacking.js";
3
+ function E(a, f, i, r = g) {
4
+ const e = a.filter((n) => i.includes(n.id));
5
+ if (e.length < 2) return null;
6
+ const t = e.reduce((n, c) => c.id < n.id ? c : n), o = [];
7
+ for (const n of e)
8
+ n.id !== t.id && A(n, t) <= r && o.push(n.id);
9
+ if (o.length === 0) return null;
10
+ const d = new Set(o), h = [];
11
+ for (const n of f) {
12
+ let c = !1;
13
+ if (d.has(n.fromAnchorId) && (n.fromAnchorId = t.id, c = !0), d.has(n.toAnchorId) && (n.toAnchorId = t.id, c = !0), n.fromAnchorId === n.toAnchorId) {
14
+ h.push(n.id);
71
15
  continue;
72
16
  }
73
- const d = { id: f, tag: e, interactive: g };
74
- if (e === "path") {
75
- const s = c.match(/\bd\s*=\s*["']([^"']+)["']/i);
76
- s && (d.d = s[1]);
77
- } else if (e === "polygon" || e === "polyline") {
78
- const s = c.match(/\bpoints\s*=\s*["']([^"']+)["']/i);
79
- s && (d.d = v(s[1]));
80
- } else if (e === "line") {
81
- const s = (r) => {
82
- const u = c.match(new RegExp(`\\b${r}\\s*=\\s*["']?(-?[\\d.]+)`, "i"));
83
- return u ? Number(u[1]) : 0;
84
- };
85
- d.d = _(s("x1"), s("y1"), s("x2"), s("y2"));
86
- } else if (e === "rect") {
87
- const s = (b) => {
88
- const m = c.match(new RegExp(`\\b${b}\\s*=\\s*["']?(-?[\\d.]+)`, "i"));
89
- return m ? Number(m[1]) : 0;
90
- }, r = s("x"), u = s("y"), h = s("width"), x = s("height");
91
- d.d = `M ${r} ${u} L ${r + h} ${u} L ${r + h} ${u + x} L ${r} ${u + x} Z`;
92
- } else if (e === "g") {
93
- const s = i[3] ?? "", r = [], u = /<(path|polygon|polyline|line|rect)\b([^>]*)\/?>/gi;
94
- let h;
95
- for (; (h = u.exec(s)) !== null; ) {
96
- const x = h[1].toLowerCase(), b = h[2] ?? "";
97
- if (x === "path") {
98
- const m = b.match(/\bd\s*=\s*["']([^"']+)["']/i);
99
- m && r.push(m[1]);
100
- } else if (x === "polygon" || x === "polyline") {
101
- const m = b.match(/\bpoints\s*=\s*["']([^"']+)["']/i);
102
- m && r.push(v(m[1]));
103
- }
104
- }
105
- r.length > 0 && (d.d = r.join(" "));
106
- }
107
- (d.d || e === "g") && a.push(d);
17
+ c && h.push(n.id);
108
18
  }
109
- return { viewbox: o, elements: a, routePathDs: l };
110
- }
111
- function N(n) {
112
- return n.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 80);
19
+ return {
20
+ survivingAnchorId: t.id,
21
+ removedAnchorIds: o,
22
+ rewiredEdgeIds: h
23
+ };
113
24
  }
114
- function O(n, t = "floor") {
115
- const o = C(n), a = [], l = [], p = [], i = [], e = [];
116
- let c = 0, k = 0, f = 0;
117
- for (const g of o.elements) {
118
- let { kind: d, guessed: s } = L(g.id, t);
119
- g.interactive && !d && (d = "unit", s = !0);
120
- const r = {
121
- sourceSvgId: g.id,
122
- kind: d,
123
- guessed: s
124
- };
125
- if (!d) {
126
- l.push(g.id), r.message = "No matching prefix; skipped", a.push(r);
127
- continue;
128
- }
129
- if (!g.d) {
130
- i.push(`Element ${g.id} has no drawable geometry`);
131
- continue;
132
- }
133
- s && (p.push(r), r.message = "Guessed kind from interactive/fallback rule"), a.push(r), d === "walkable" && c++, d === "void" && k++, d === "unit" && f++;
134
- const u = w([g.d], o.viewbox, !0), h = I(u);
135
- e.push({
136
- key: N(g.id),
137
- kind: d,
138
- geometry: u,
139
- bbox: h,
140
- sourceSvgId: g.id,
141
- style: {}
142
- });
25
+ function b(a, f = g) {
26
+ const i = [], r = /* @__PURE__ */ new Set();
27
+ for (let e = 0; e < a.length; e++) {
28
+ if (r.has(a[e].id)) continue;
29
+ const t = [a[e].id];
30
+ for (let o = e + 1; o < a.length; o++)
31
+ r.has(a[o].id) || a[e].levelId === a[o].levelId && A(a[e], a[o]) <= f && (t.push(a[o].id), r.add(a[o].id));
32
+ t.length > 1 && (r.add(a[e].id), i.push(t));
143
33
  }
144
- return t === "floor" && c === 0 && i.push(
145
- "No walkable layer found — auto-skeleton will be unavailable for this level"
146
- ), {
147
- report: {
148
- classified: a,
149
- unrecognized: l,
150
- guessed: p,
151
- walkableCount: c,
152
- voidCount: k,
153
- unitCount: f,
154
- warnings: i
155
- },
156
- shapes: e,
157
- viewbox: o.viewbox,
158
- routePathDs: o.routePathDs
159
- };
34
+ return i;
160
35
  }
161
- function T(n, t, o) {
162
- const a = new Map(
163
- t.filter((i) => i.sourceSvgId).map((i) => [i.sourceSvgId, i])
164
- ), l = /* @__PURE__ */ new Set(), p = [];
165
- for (const i of n) {
166
- const e = a.get(i.sourceSvgId);
167
- l.add(i.sourceSvgId), e ? e.kind !== i.kind ? p.push({
168
- sourceSvgId: i.sourceSvgId,
169
- change: "kind_changed",
170
- existingShapeId: e.id,
171
- existingKind: e.kind,
172
- newKind: i.kind,
173
- preserve: { key: e.key, assignment: !0, anchors: !0 }
174
- }) : p.push({
175
- sourceSvgId: i.sourceSvgId,
176
- change: "unchanged",
177
- existingShapeId: e.id,
178
- existingKind: e.kind,
179
- newKind: i.kind,
180
- preserve: { key: e.key, assignment: !0, anchors: !0 }
181
- }) : p.push({
182
- sourceSvgId: i.sourceSvgId,
183
- change: "added",
184
- newKind: i.kind
185
- });
36
+ function M(a, f, i, r = g) {
37
+ let e = null;
38
+ for (const o of f) {
39
+ const d = L(a, o);
40
+ d && (!e || d.distance < e.distance) && (e = { point: d.point, distance: d.distance });
186
41
  }
187
- for (const i of t)
188
- i.sourceSvgId && !l.has(i.sourceSvgId) && p.push({
189
- sourceSvgId: i.sourceSvgId,
190
- change: "removed",
191
- existingShapeId: i.id,
192
- existingKind: i.kind
193
- });
42
+ if (!e) return null;
43
+ const t = i.find(
44
+ (o) => o.levelId === a.levelId && A(o, e.point) <= r
45
+ );
194
46
  return {
195
- items: p,
196
- shapes: n,
197
- viewbox: o
47
+ unitAnchorId: a.id,
48
+ junctionAnchor: t ? { x: t.x, y: t.y, existingId: t.id } : { x: e.point.x, y: e.point.y },
49
+ edge: {
50
+ fromAnchorId: a.id,
51
+ toAnchorId: t == null ? void 0 : t.id
52
+ }
198
53
  };
199
54
  }
200
- function F(n) {
201
- const t = { ...S, ...n.theme }, o = new Map(
202
- n.assignments.map((e) => [e.shapeId, e])
203
- ), a = n.resolveSvgUrl ?? ((e) => e), l = n.levels.filter((e) => e.isActive).sort((e, c) => e.ordering - c.ordering).map((e) => {
204
- const c = n.shapes.filter((f) => f.levelId === e.id).map((f) => ({
205
- ...f,
206
- assignment: o.get(f.id) ?? null
207
- })), k = n.anchors.filter((f) => f.levelId === e.id);
208
- return {
209
- id: e.id,
210
- buildingId: e.buildingId,
211
- kind: e.kind,
212
- name: e.name,
213
- levelIndex: e.levelIndex,
214
- ordering: e.ordering,
215
- sourceSvgUrl: a(e.sourceSvgKey),
216
- viewbox: e.sourceViewbox,
217
- transform: e.transform,
218
- shapes: c,
219
- anchors: k
220
- };
221
- }), { nodes: p, edges: i } = E(
222
- n.anchors,
223
- n.edges,
224
- n.connectors
225
- );
55
+ function P(a, f, i, r) {
56
+ if (i.length === 0) return null;
57
+ const e = i.flat();
58
+ if (e.length === 0) return null;
59
+ let t = 0, o = 0;
60
+ for (const n of e)
61
+ t += n.x, o += n.y;
62
+ const d = { x: t / e.length, y: o / e.length }, h = S(d, i) ? d : e[0];
226
63
  return {
227
- version: 2,
228
- revisionId: n.revisionId,
229
- revisionNumber: n.revisionNumber,
230
- centerId: n.centerId,
231
- mapId: n.mapId,
232
- theme: t,
233
- baseSvgUrl: n.baseSvgUrl,
234
- baseViewbox: n.baseViewbox,
235
- buildings: n.buildings,
236
- levels: l,
237
- connectors: n.connectors,
238
- amenities: n.amenities.filter((e) => e.isActive),
239
- graph: { nodes: p, edges: i },
240
- responsiveOverrides: n.responsiveOverrides,
241
- publishedAt: n.publishedAt ?? (/* @__PURE__ */ new Date()).toISOString()
64
+ id: r,
65
+ levelId: f,
66
+ shapeId: a,
67
+ kind: "unit",
68
+ x: h.x,
69
+ y: h.y,
70
+ connectorId: null
71
+ };
72
+ }
73
+ function k(a, f, i = 20) {
74
+ if (a.length === 0)
75
+ return { anchors: [], edges: [] };
76
+ let r = 1 / 0, e = 1 / 0, t = -1 / 0, o = -1 / 0;
77
+ for (const s of a)
78
+ for (const l of s)
79
+ r = Math.min(r, l.x), e = Math.min(e, l.y), t = Math.max(t, l.x), o = Math.max(o, l.y);
80
+ const d = Math.max(1, Math.ceil((t - r) / i)), h = Math.max(1, Math.ceil((o - e) / i)), n = [];
81
+ for (let s = 0; s < h; s++)
82
+ for (let l = 0; l < d; l++) {
83
+ const I = r + (l + 0.5) * i, x = e + (s + 0.5) * i, y = { x: I, y: x };
84
+ S(y, a) && (f.length > 0 && S(y, f) || n.push({ key: `${l},${s}`, x: I, y: x, col: l, row: s }));
85
+ }
86
+ const c = new Map(n.map((s) => [s.key, s])), p = n.map((s) => ({
87
+ tempId: s.key,
88
+ x: s.x,
89
+ y: s.y,
90
+ kind: "junction"
91
+ })), u = [], m = /* @__PURE__ */ new Set();
92
+ for (const s of n) {
93
+ const l = [
94
+ [s.col + 1, s.row],
95
+ [s.col, s.row + 1]
96
+ ];
97
+ for (const [I, x] of l) {
98
+ const y = `${I},${x}`;
99
+ if (!c.has(y)) continue;
100
+ const v = s.key < y ? `${s.key}|${y}` : `${y}|${s.key}`;
101
+ m.has(v) || (m.add(v), u.push({ fromTempId: s.key, toTempId: y }));
102
+ }
103
+ }
104
+ return { anchors: p, edges: u };
105
+ }
106
+ function D(a, f, i, r, e = g) {
107
+ const t = [], o = [];
108
+ let d = r;
109
+ const h = (n, c) => {
110
+ const p = t.find(
111
+ (m) => A(m, { x: n, y: c }) <= e
112
+ );
113
+ if (p) return p.id;
114
+ const u = d++;
115
+ return t.push({
116
+ id: u,
117
+ levelId: f,
118
+ shapeId: null,
119
+ kind: "junction",
120
+ x: n,
121
+ y: c,
122
+ connectorId: null
123
+ }), u;
242
124
  };
125
+ for (const n of a) {
126
+ const c = T(n);
127
+ for (const p of c)
128
+ for (let u = 0; u < p.length - 1; u++) {
129
+ const m = h(p[u].x, p[u].y), s = h(p[u + 1].x, p[u + 1].y);
130
+ m === s || o.some(
131
+ (I) => I.fromAnchorId === m && I.toAnchorId === s || I.fromAnchorId === s && I.toAnchorId === m
132
+ ) || o.push({
133
+ id: d++,
134
+ mapId: i,
135
+ fromAnchorId: m,
136
+ toAnchorId: s,
137
+ weight: null,
138
+ directed: !1,
139
+ accessible: !0,
140
+ kind: "walk"
141
+ });
142
+ }
143
+ }
144
+ return { anchors: t, edges: o, nextId: d };
243
145
  }
244
146
  export {
245
- S as DEFAULT_THEME,
246
- K as DEFAULT_WELD_TOLERANCE,
247
- U as FLOOR_CHANGE_PENALTY,
248
- z as INTERACTIVE_SHAPE_KINDS,
249
- B as angleFromWall,
250
- W as approximateCubic,
251
- G as approximateQuadratic,
252
- re as autoConnectUnitAnchor,
253
- V as bboxOf,
254
- H as bboxUnion,
255
- ae as buildAutoSkeleton,
256
- w as buildGeometryFromPaths,
257
- j as centroid,
258
- L as classifyId,
259
- F as compileDocument,
260
- E as compileGraph,
261
- T as diffImport,
262
- X as distance,
263
- Z as findNearestAmenityPath,
264
- Y as findPath,
265
- ce as findWeldCandidates,
266
- q as flipY,
267
- I as geometryBBox,
268
- Q as geometryCentroid,
269
- de as importRoutePaths,
270
- O as importSvg,
271
- J as nearestPointOnPolyline,
272
- C as parseSvgString,
273
- y as parseViewBox,
274
- ee as pathToPolygons,
275
- ne as pointInPolygon,
276
- ie as pointInPolygons,
277
- se as projectOntoSegment,
278
- te as snapAngle,
279
- le as unitAnchorFromShape,
280
- pe as weldAnchors
147
+ F as DEFAULT_THEME,
148
+ g as DEFAULT_WELD_TOLERANCE,
149
+ O as FLOOR_CHANGE_PENALTY,
150
+ R as IDENTITY_MATRIX,
151
+ N as IMPORT_DRIFT_THRESHOLD,
152
+ B as IMPORT_PERSISTED_KINDS,
153
+ $ as INTERACTIVE_SHAPE_KINDS,
154
+ G as STATIC_LAYER_STYLES,
155
+ Y as angleFromWall,
156
+ H as applyMatrix,
157
+ V as approximateArc,
158
+ j as approximateCubic,
159
+ K as approximateQuadratic,
160
+ M as autoConnectUnitAnchor,
161
+ U as bboxOf,
162
+ W as bboxUnion,
163
+ X as boundsFromStackedLevels,
164
+ k as buildAutoSkeleton,
165
+ z as buildGeometryFromPaths,
166
+ Q as centroid,
167
+ q as classifyId,
168
+ J as compareBuildingFloors,
169
+ Z as compileDocument,
170
+ ee as compileGraph,
171
+ ne as defaultViewerLevelId,
172
+ te as diffImport,
173
+ A as distance,
174
+ oe as expandBounds,
175
+ se as findNearestAmenityPath,
176
+ ae as findPath,
177
+ b as findWeldCandidates,
178
+ ie as flipY,
179
+ re as floorSwitcherDisplayLevels,
180
+ de as floorSwitcherLevels,
181
+ ce as geometryBBox,
182
+ le as geometryCentroid,
183
+ D as importRoutePaths,
184
+ fe as importSvg,
185
+ ue as inlineSvgStyles,
186
+ he as isGeometrySpaceStale,
187
+ pe as isIdentityMatrix,
188
+ me as isInteractiveGroupLabel,
189
+ Ie as isLayerContainerLabel,
190
+ ye as isMapViewerHost,
191
+ xe as isNonInteractiveGroupLabel,
192
+ ge as isOutdoorLevel,
193
+ Ae as isStoreFolderLabel,
194
+ Se as mapSurface,
195
+ ve as mergePresentationStyle,
196
+ Le as mergeTheme,
197
+ Te as multiplyMatrix,
198
+ L as nearestPointOnPolyline,
199
+ we as normalizeGeometrySpace,
200
+ Ee as normalizeLayerLabel,
201
+ be as normalizeLayerName,
202
+ Me as normalizePublishedDocument,
203
+ Pe as parseSvgString,
204
+ ke as parseTransform,
205
+ De as parseViewBox,
206
+ T as pathToPolygons,
207
+ _e as pointInPolygon,
208
+ S as pointInPolygons,
209
+ Ce as projectOntoSegment,
210
+ Fe as readPresentationStyle,
211
+ Oe as resolveLayerStyle,
212
+ Re as shouldShowFloorSwitcher,
213
+ Ne as snapAngle,
214
+ Be as tokenizePathData,
215
+ $e as transformPathD,
216
+ Ge as unionViewBox,
217
+ P as unitAnchorFromShape,
218
+ Ye as viewBoxToBounds,
219
+ He as viewerChrome,
220
+ Ve as viewerLevelStack,
221
+ E as weldAnchors
281
222
  };
282
223
  //# sourceMappingURL=index.js.map