@eyeon/map 2.0.0 → 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.
- package/README.md +18 -1
- package/dist/assets/MapViewer.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/chunks/MapViewer.js +1745 -356
- package/dist/chunks/MapViewer.js.map +1 -1
- package/dist/chunks/stacking.js +1321 -0
- package/dist/chunks/stacking.js.map +1 -0
- package/dist/core/geometry/index.d.ts +41 -4
- package/dist/core/geometry/index.d.ts.map +1 -1
- package/dist/core/hostChrome.d.ts +20 -0
- package/dist/core/hostChrome.d.ts.map +1 -0
- package/dist/core/import/index.d.ts +48 -3
- package/dist/core/import/index.d.ts.map +1 -1
- package/dist/core/import/svgStyle.d.ts +21 -0
- package/dist/core/import/svgStyle.d.ts.map +1 -0
- package/dist/core/import/svgTransform.d.ts +49 -0
- package/dist/core/import/svgTransform.d.ts.map +1 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +207 -266
- package/dist/core/index.js.map +1 -1
- package/dist/core/layerStyles.d.ts +28 -0
- package/dist/core/layerStyles.d.ts.map +1 -0
- package/dist/core/publish/index.d.ts +8 -2
- package/dist/core/publish/index.d.ts.map +1 -1
- package/dist/core/routing/graph-tools.d.ts +5 -1
- package/dist/core/routing/graph-tools.d.ts.map +1 -1
- package/dist/core/stacking.d.ts +61 -0
- package/dist/core/stacking.d.ts.map +1 -0
- package/dist/core/types.d.ts +27 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/editor/MapEditor.d.ts +28 -16
- package/dist/editor/MapEditor.d.ts.map +1 -1
- package/dist/editor/canvas/EditorCanvas.d.ts +15 -3
- package/dist/editor/canvas/EditorCanvas.d.ts.map +1 -1
- package/dist/editor/canvas/coords.d.ts +21 -0
- package/dist/editor/canvas/coords.d.ts.map +1 -0
- package/dist/editor/draftOps.d.ts +19 -0
- package/dist/editor/draftOps.d.ts.map +1 -0
- package/dist/editor/geometryEdit.d.ts +34 -0
- package/dist/editor/geometryEdit.d.ts.map +1 -0
- package/dist/editor/index.css +1281 -145
- package/dist/editor/index.d.ts +8 -2
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/index.js +2293 -585
- package/dist/editor/index.js.map +1 -1
- package/dist/editor/labels.d.ts +5 -0
- package/dist/editor/labels.d.ts.map +1 -0
- package/dist/editor/panels/FloorsPanel.d.ts +60 -0
- package/dist/editor/panels/FloorsPanel.d.ts.map +1 -0
- package/dist/editor/panels/ImportReviewPanel.d.ts +22 -0
- package/dist/editor/panels/ImportReviewPanel.d.ts.map +1 -0
- package/dist/editor/panels/Inspector.d.ts +4 -2
- package/dist/editor/panels/Inspector.d.ts.map +1 -1
- package/dist/editor/panels/LeftRail.d.ts +19 -6
- package/dist/editor/panels/LeftRail.d.ts.map +1 -1
- package/dist/editor/panels/PreviewOverlay.d.ts +11 -2
- package/dist/editor/panels/PreviewOverlay.d.ts.map +1 -1
- package/dist/editor/portalSurface.d.ts +11 -0
- package/dist/editor/portalSurface.d.ts.map +1 -0
- package/dist/editor/previewDocument.d.ts +9 -0
- package/dist/editor/previewDocument.d.ts.map +1 -0
- package/dist/editor/tools.d.ts +20 -0
- package/dist/editor/tools.d.ts.map +1 -0
- package/dist/test-maps/shops-at-south-town/BASE - Shops At South Town.ai +26780 -26
- package/dist/test-maps/shops-at-south-town/LF - Shops At South Town.ai +4487 -2
- package/dist/test-maps/shops-at-south-town/SVG/BASE - Shops At South Town.svg +567 -0
- package/dist/test-maps/shops-at-south-town/SVG/LF - Shops At South Town.svg +238 -0
- package/dist/test-maps/shops-at-south-town/SVG/UF - Shops At South Town.svg +276 -0
- package/dist/test-maps/shops-at-south-town/UF - Shops At South Town.ai +4228 -1
- package/dist/viewer/MapViewer.d.ts +14 -3
- package/dist/viewer/MapViewer.d.ts.map +1 -1
- package/dist/viewer/camera.d.ts +34 -0
- package/dist/viewer/camera.d.ts.map +1 -0
- package/dist/viewer/components/CameraRig.d.ts +18 -0
- package/dist/viewer/components/CameraRig.d.ts.map +1 -0
- package/dist/viewer/components/LevelMeshes.d.ts +6 -1
- package/dist/viewer/components/LevelMeshes.d.ts.map +1 -1
- package/dist/viewer/components/MapScene.d.ts +6 -1
- package/dist/viewer/components/MapScene.d.ts.map +1 -1
- package/dist/viewer/components/SvgVectorLayer.d.ts +18 -0
- package/dist/viewer/components/SvgVectorLayer.d.ts.map +1 -0
- package/dist/viewer/index.css +124 -35
- package/dist/viewer/index.d.ts +4 -0
- package/dist/viewer/index.d.ts.map +1 -1
- package/dist/viewer/index.js +9 -4
- package/dist/viewer/index.js.map +1 -1
- package/dist/viewer/ui/MapControls.d.ts +14 -0
- package/dist/viewer/ui/MapControls.d.ts.map +1 -0
- package/dist/viewer/ui/RuntimeChrome.d.ts +3 -3
- package/dist/viewer/ui/RuntimeChrome.d.ts.map +1 -1
- package/package.json +17 -7
- package/dist/chunks/graph-tools.js +0 -153
- package/dist/chunks/graph-tools.js.map +0 -1
- package/dist/chunks/pathfinding.js +0 -343
- package/dist/chunks/pathfinding.js.map +0 -1
package/dist/chunks/MapViewer.js
CHANGED
|
@@ -1,402 +1,1767 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { f as
|
|
4
|
-
import { Canvas as
|
|
5
|
-
import { OrthographicCamera as
|
|
6
|
-
import * as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as _, jsxs as ne, Fragment as We } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as ie, useState as ue, useEffect as me, useRef as Ae, useCallback as _e, useImperativeHandle as qe, Suspense as Xe } from "react";
|
|
3
|
+
import { f as Ye, N as $e, Q as Oe, V as ve, a7 as Ze, ae as Qe, r as Ke, U as Me, H as Je, a8 as et, a0 as Ge, z as De, v as Te, y as tt, X as nt, E as ot } from "./stacking.js";
|
|
4
|
+
import { useThree as rt, Canvas as st } from "@react-three/fiber";
|
|
5
|
+
import { OrthographicCamera as it, OrbitControls as at } from "@react-three/drei";
|
|
6
|
+
import * as fe from "three";
|
|
7
|
+
import { Loader as ct, FileLoader as lt, Matrix3 as ye, Vector2 as Q, Vector3 as ke, Box2 as ut, ShapeUtils as ft, Shape as ht, Path as Ne, BufferGeometry as mt, Float32BufferAttribute as Ee, SRGBColorSpace as dt, ShapePath as pe } from "three";
|
|
8
|
+
function pt(u, a, A) {
|
|
9
|
+
if (A) return A;
|
|
10
|
+
switch (u) {
|
|
10
11
|
case "unit":
|
|
11
|
-
return
|
|
12
|
+
return a.STORE_DEFAULT_COLOR;
|
|
12
13
|
case "walkable":
|
|
13
|
-
return
|
|
14
|
+
return a.WALKABLE_COLOR;
|
|
14
15
|
case "wall":
|
|
15
16
|
case "boundary":
|
|
16
|
-
return
|
|
17
|
+
return a.WALL_COLOR;
|
|
17
18
|
case "parking_zone":
|
|
18
|
-
return
|
|
19
|
+
return a.PARKING_ZONE_COLOR;
|
|
19
20
|
case "green_area":
|
|
20
|
-
return
|
|
21
|
+
return a.GREEN_AREA_COLOR;
|
|
21
22
|
case "water":
|
|
22
|
-
return
|
|
23
|
+
return a.WATER_COLOR;
|
|
23
24
|
case "floorplate":
|
|
24
|
-
return
|
|
25
|
+
return a.BASE_COLOR;
|
|
25
26
|
case "void":
|
|
26
27
|
return "#00000000";
|
|
27
28
|
default:
|
|
28
29
|
return "#e2e8f0";
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
for (let
|
|
36
|
-
|
|
37
|
-
return
|
|
32
|
+
function yt(u) {
|
|
33
|
+
if (u.length < 3) return null;
|
|
34
|
+
const a = new fe.Shape();
|
|
35
|
+
a.moveTo(u[0].x, u[0].y);
|
|
36
|
+
for (let A = 1; A < u.length; A++)
|
|
37
|
+
a.lineTo(u[A].x, u[A].y);
|
|
38
|
+
return a.closePath(), a;
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
level:
|
|
41
|
-
theme:
|
|
42
|
-
is3d:
|
|
43
|
-
selectedRetailerId:
|
|
44
|
-
onSelectShape:
|
|
40
|
+
function gt({
|
|
41
|
+
level: u,
|
|
42
|
+
theme: a,
|
|
43
|
+
is3d: A,
|
|
44
|
+
selectedRetailerId: M,
|
|
45
|
+
onSelectShape: I,
|
|
46
|
+
interactiveOnly: h = !1
|
|
45
47
|
}) {
|
|
46
|
-
const
|
|
47
|
-
var
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
const
|
|
51
|
-
return { shape:
|
|
52
|
-
}).filter(Boolean), [
|
|
53
|
-
return /* @__PURE__ */
|
|
48
|
+
const v = ie(() => u.shapes.filter((x) => x.kind !== "void").filter((x) => !h || Ye.includes(x.kind)).filter((x) => !x.orphanedAt).map((x) => {
|
|
49
|
+
var W;
|
|
50
|
+
const T = x.geometry.polygons.map(yt).filter((N) => N != null);
|
|
51
|
+
if (T.length === 0) return null;
|
|
52
|
+
const H = M != null && ((W = x.assignment) == null ? void 0 : W.retailerId) === M, G = H ? a.ACCENT_COLOR : pt(x.kind, a, x.style.fill), E = A && (x.kind === "unit" || x.kind === "wall") ? x.style.extrudeHeight ?? (x.kind === "unit" ? a.STORE_HEIGHT : 2) : 0;
|
|
53
|
+
return { shape: x, threeShapes: T, color: G, extrude: E, selected: H };
|
|
54
|
+
}).filter(Boolean), [u, a, A, M, h]);
|
|
55
|
+
return /* @__PURE__ */ _("group", { children: v.map(({ shape: x, threeShapes: q, color: T, extrude: H, selected: G }) => /* @__PURE__ */ _("group", { children: q.map((E, W) => /* @__PURE__ */ ne(
|
|
54
56
|
"mesh",
|
|
55
57
|
{
|
|
56
|
-
position: [0, 0,
|
|
57
|
-
onClick: (
|
|
58
|
-
|
|
58
|
+
position: [0, 0, x.zIndex * 0.01],
|
|
59
|
+
onClick: (N) => {
|
|
60
|
+
N.stopPropagation(), (x.kind === "unit" || x.kind === "amenity" || x.kind === "kiosk_screen" || x.kind === "entrance" || x.kind === "parking_zone") && (I == null || I(x.id));
|
|
59
61
|
},
|
|
60
62
|
children: [
|
|
61
|
-
|
|
63
|
+
H > 0 ? /* @__PURE__ */ _(
|
|
62
64
|
"extrudeGeometry",
|
|
63
65
|
{
|
|
64
66
|
args: [
|
|
65
|
-
|
|
66
|
-
{ depth:
|
|
67
|
+
E,
|
|
68
|
+
{ depth: H, bevelEnabled: !1 }
|
|
67
69
|
]
|
|
68
70
|
}
|
|
69
|
-
) : /* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
+
) : /* @__PURE__ */ _("shapeGeometry", { args: [E] }),
|
|
72
|
+
/* @__PURE__ */ _(
|
|
71
73
|
"meshBasicMaterial",
|
|
72
74
|
{
|
|
73
|
-
color:
|
|
74
|
-
transparent:
|
|
75
|
-
opacity:
|
|
76
|
-
side:
|
|
75
|
+
color: T,
|
|
76
|
+
transparent: x.style.transparent || x.kind === "amenity",
|
|
77
|
+
opacity: x.style.opacity ?? (x.kind === "amenity" ? 0.01 : 1),
|
|
78
|
+
side: fe.DoubleSide
|
|
77
79
|
}
|
|
78
80
|
),
|
|
79
|
-
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
+
G && /* @__PURE__ */ ne("lineSegments", { children: [
|
|
82
|
+
/* @__PURE__ */ _(
|
|
81
83
|
"edgesGeometry",
|
|
82
84
|
{
|
|
83
85
|
args: [
|
|
84
|
-
|
|
85
|
-
depth:
|
|
86
|
+
H > 0 ? new fe.ExtrudeGeometry(E, {
|
|
87
|
+
depth: H,
|
|
86
88
|
bevelEnabled: !1
|
|
87
|
-
}) : new
|
|
89
|
+
}) : new fe.ShapeGeometry(E)
|
|
88
90
|
]
|
|
89
91
|
}
|
|
90
92
|
),
|
|
91
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ _("lineBasicMaterial", { color: a.ACCENT_COLOR })
|
|
92
94
|
] })
|
|
93
95
|
]
|
|
94
96
|
},
|
|
95
|
-
`${
|
|
96
|
-
)) },
|
|
97
|
+
`${x.id}-${W}`
|
|
98
|
+
)) }, x.id)) });
|
|
97
99
|
}
|
|
98
|
-
function
|
|
99
|
-
route:
|
|
100
|
-
activeLevelId:
|
|
101
|
-
color:
|
|
100
|
+
function bt({
|
|
101
|
+
route: u,
|
|
102
|
+
activeLevelId: a,
|
|
103
|
+
color: A
|
|
102
104
|
}) {
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
105
|
+
const M = ie(() => u.points.filter((h) => a == null || h.levelId === a).map((h) => new fe.Vector3(h.x, h.y, 2)), [u, a]);
|
|
106
|
+
if (M.length < 2) return null;
|
|
107
|
+
const I = new fe.CatmullRomCurve3(M);
|
|
108
|
+
return /* @__PURE__ */ ne("mesh", { children: [
|
|
109
|
+
/* @__PURE__ */ _("tubeGeometry", { args: [I, Math.max(M.length * 4, 8), 1.5, 8, !1] }),
|
|
110
|
+
/* @__PURE__ */ _("meshBasicMaterial", { color: A })
|
|
109
111
|
] });
|
|
110
112
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
const xt = dt;
|
|
114
|
+
class Ie extends ct {
|
|
115
|
+
/**
|
|
116
|
+
* Constructs a new SVG loader.
|
|
117
|
+
*
|
|
118
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
119
|
+
*/
|
|
120
|
+
constructor(a) {
|
|
121
|
+
super(a), this.defaultDPI = 90, this.defaultUnit = "px";
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Starts loading from the given URL and passes the loaded SVG asset
|
|
125
|
+
* to the `onLoad()` callback.
|
|
126
|
+
*
|
|
127
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
128
|
+
* @param {function({paths:Array<ShapePath>,xml:string})} onLoad - Executed when the loading process has been finished.
|
|
129
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
130
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
131
|
+
*/
|
|
132
|
+
load(a, A, M, I) {
|
|
133
|
+
const h = this, v = new lt(h.manager);
|
|
134
|
+
v.setPath(h.path), v.setRequestHeader(h.requestHeader), v.setWithCredentials(h.withCredentials), v.load(a, function(x) {
|
|
135
|
+
try {
|
|
136
|
+
A(h.parse(x));
|
|
137
|
+
} catch (q) {
|
|
138
|
+
I ? I(q) : console.error(q), h.manager.itemError(a);
|
|
139
|
+
}
|
|
140
|
+
}, M, I);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Parses the given SVG data and returns the resulting data.
|
|
144
|
+
*
|
|
145
|
+
* @param {string} text - The raw SVG data as a string.
|
|
146
|
+
* @return {{paths:Array<ShapePath>,xml:string}} An object holding an array of shape paths and the
|
|
147
|
+
* SVG XML document.
|
|
148
|
+
*/
|
|
149
|
+
parse(a) {
|
|
150
|
+
const A = this;
|
|
151
|
+
function M(r, o) {
|
|
152
|
+
if (r.nodeType !== 1) return;
|
|
153
|
+
const t = S(r);
|
|
154
|
+
let e = !1, c = null;
|
|
155
|
+
switch (r.nodeName) {
|
|
156
|
+
case "svg":
|
|
157
|
+
o = N(r, o);
|
|
158
|
+
break;
|
|
159
|
+
case "style":
|
|
160
|
+
h(r);
|
|
161
|
+
break;
|
|
162
|
+
case "g":
|
|
163
|
+
o = N(r, o);
|
|
164
|
+
break;
|
|
165
|
+
case "path":
|
|
166
|
+
o = N(r, o), r.hasAttribute("d") && (c = I(r));
|
|
167
|
+
break;
|
|
168
|
+
case "rect":
|
|
169
|
+
o = N(r, o), c = q(r);
|
|
170
|
+
break;
|
|
171
|
+
case "polygon":
|
|
172
|
+
o = N(r, o), c = T(r);
|
|
173
|
+
break;
|
|
174
|
+
case "polyline":
|
|
175
|
+
o = N(r, o), c = H(r);
|
|
176
|
+
break;
|
|
177
|
+
case "circle":
|
|
178
|
+
o = N(r, o), c = G(r);
|
|
179
|
+
break;
|
|
180
|
+
case "ellipse":
|
|
181
|
+
o = N(r, o), c = E(r);
|
|
182
|
+
break;
|
|
183
|
+
case "line":
|
|
184
|
+
o = N(r, o), c = W(r);
|
|
185
|
+
break;
|
|
186
|
+
case "defs":
|
|
187
|
+
e = !0;
|
|
188
|
+
break;
|
|
189
|
+
case "use":
|
|
190
|
+
o = N(r, o);
|
|
191
|
+
const w = (r.getAttributeNS("http://www.w3.org/1999/xlink", "href") || "").substring(1), C = r.viewportElement.getElementById(w);
|
|
192
|
+
C ? M(C, o) : console.warn("SVGLoader: 'use node' references non-existent node id: " + w);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
c && (o.fill !== void 0 && o.fill !== "none" && c.color.setStyle(o.fill, xt), m(c, se), V.push(c), c.userData = { node: r, style: o });
|
|
196
|
+
const y = r.childNodes;
|
|
197
|
+
for (let i = 0; i < y.length; i++) {
|
|
198
|
+
const w = y[i];
|
|
199
|
+
e && w.nodeName !== "style" && w.nodeName !== "defs" || M(w, o);
|
|
200
|
+
}
|
|
201
|
+
t && ($.pop(), $.length > 0 ? se.copy($[$.length - 1]) : se.identity());
|
|
202
|
+
}
|
|
203
|
+
function I(r) {
|
|
204
|
+
const o = new pe(), t = new Q(), e = new Q(), c = new Q();
|
|
205
|
+
let y = !0, i = !1;
|
|
206
|
+
const w = r.getAttribute("d");
|
|
207
|
+
if (w === "" || w === "none") return null;
|
|
208
|
+
const C = w.match(/[a-df-z][^a-df-z]*/ig);
|
|
209
|
+
for (let O = 0, l = C.length; O < l; O++) {
|
|
210
|
+
const b = C[O], L = b.charAt(0), D = b.slice(1).trim();
|
|
211
|
+
y === !0 && (i = !0, y = !1);
|
|
212
|
+
let s;
|
|
213
|
+
switch (L) {
|
|
214
|
+
case "M":
|
|
215
|
+
s = f(D);
|
|
216
|
+
for (let n = 0, B = s.length; n < B; n += 2)
|
|
217
|
+
t.x = s[n + 0], t.y = s[n + 1], e.x = t.x, e.y = t.y, n === 0 ? o.moveTo(t.x, t.y) : o.lineTo(t.x, t.y), n === 0 && c.copy(t);
|
|
218
|
+
break;
|
|
219
|
+
case "H":
|
|
220
|
+
s = f(D);
|
|
221
|
+
for (let n = 0, B = s.length; n < B; n++)
|
|
222
|
+
t.x = s[n], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && i === !0 && c.copy(t);
|
|
223
|
+
break;
|
|
224
|
+
case "V":
|
|
225
|
+
s = f(D);
|
|
226
|
+
for (let n = 0, B = s.length; n < B; n++)
|
|
227
|
+
t.y = s[n], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && i === !0 && c.copy(t);
|
|
228
|
+
break;
|
|
229
|
+
case "L":
|
|
230
|
+
s = f(D);
|
|
231
|
+
for (let n = 0, B = s.length; n < B; n += 2)
|
|
232
|
+
t.x = s[n + 0], t.y = s[n + 1], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && i === !0 && c.copy(t);
|
|
233
|
+
break;
|
|
234
|
+
case "C":
|
|
235
|
+
s = f(D);
|
|
236
|
+
for (let n = 0, B = s.length; n < B; n += 6)
|
|
237
|
+
o.bezierCurveTo(
|
|
238
|
+
s[n + 0],
|
|
239
|
+
s[n + 1],
|
|
240
|
+
s[n + 2],
|
|
241
|
+
s[n + 3],
|
|
242
|
+
s[n + 4],
|
|
243
|
+
s[n + 5]
|
|
244
|
+
), e.x = s[n + 2], e.y = s[n + 3], t.x = s[n + 4], t.y = s[n + 5], n === 0 && i === !0 && c.copy(t);
|
|
245
|
+
break;
|
|
246
|
+
case "S":
|
|
247
|
+
s = f(D);
|
|
248
|
+
for (let n = 0, B = s.length; n < B; n += 4)
|
|
249
|
+
o.bezierCurveTo(
|
|
250
|
+
k(t.x, e.x),
|
|
251
|
+
k(t.y, e.y),
|
|
252
|
+
s[n + 0],
|
|
253
|
+
s[n + 1],
|
|
254
|
+
s[n + 2],
|
|
255
|
+
s[n + 3]
|
|
256
|
+
), e.x = s[n + 0], e.y = s[n + 1], t.x = s[n + 2], t.y = s[n + 3], n === 0 && i === !0 && c.copy(t);
|
|
257
|
+
break;
|
|
258
|
+
case "Q":
|
|
259
|
+
s = f(D);
|
|
260
|
+
for (let n = 0, B = s.length; n < B; n += 4)
|
|
261
|
+
o.quadraticCurveTo(
|
|
262
|
+
s[n + 0],
|
|
263
|
+
s[n + 1],
|
|
264
|
+
s[n + 2],
|
|
265
|
+
s[n + 3]
|
|
266
|
+
), e.x = s[n + 0], e.y = s[n + 1], t.x = s[n + 2], t.y = s[n + 3], n === 0 && i === !0 && c.copy(t);
|
|
267
|
+
break;
|
|
268
|
+
case "T":
|
|
269
|
+
s = f(D);
|
|
270
|
+
for (let n = 0, B = s.length; n < B; n += 2) {
|
|
271
|
+
const Y = k(t.x, e.x), ae = k(t.y, e.y);
|
|
272
|
+
o.quadraticCurveTo(
|
|
273
|
+
Y,
|
|
274
|
+
ae,
|
|
275
|
+
s[n + 0],
|
|
276
|
+
s[n + 1]
|
|
277
|
+
), e.x = Y, e.y = ae, t.x = s[n + 0], t.y = s[n + 1], n === 0 && i === !0 && c.copy(t);
|
|
278
|
+
}
|
|
279
|
+
break;
|
|
280
|
+
case "A":
|
|
281
|
+
s = f(D, [3, 4], 7);
|
|
282
|
+
for (let n = 0, B = s.length; n < B; n += 7) {
|
|
283
|
+
if (s[n + 5] == t.x && s[n + 6] == t.y) continue;
|
|
284
|
+
const Y = t.clone();
|
|
285
|
+
t.x = s[n + 5], t.y = s[n + 6], e.x = t.x, e.y = t.y, v(
|
|
286
|
+
o,
|
|
287
|
+
s[n],
|
|
288
|
+
s[n + 1],
|
|
289
|
+
s[n + 2],
|
|
290
|
+
s[n + 3],
|
|
291
|
+
s[n + 4],
|
|
292
|
+
Y,
|
|
293
|
+
t
|
|
294
|
+
), n === 0 && i === !0 && c.copy(t);
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
case "m":
|
|
298
|
+
s = f(D);
|
|
299
|
+
for (let n = 0, B = s.length; n < B; n += 2)
|
|
300
|
+
t.x += s[n + 0], t.y += s[n + 1], e.x = t.x, e.y = t.y, n === 0 ? o.moveTo(t.x, t.y) : o.lineTo(t.x, t.y), n === 0 && c.copy(t);
|
|
301
|
+
break;
|
|
302
|
+
case "h":
|
|
303
|
+
s = f(D);
|
|
304
|
+
for (let n = 0, B = s.length; n < B; n++)
|
|
305
|
+
t.x += s[n], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && i === !0 && c.copy(t);
|
|
306
|
+
break;
|
|
307
|
+
case "v":
|
|
308
|
+
s = f(D);
|
|
309
|
+
for (let n = 0, B = s.length; n < B; n++)
|
|
310
|
+
t.y += s[n], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && i === !0 && c.copy(t);
|
|
311
|
+
break;
|
|
312
|
+
case "l":
|
|
313
|
+
s = f(D);
|
|
314
|
+
for (let n = 0, B = s.length; n < B; n += 2)
|
|
315
|
+
t.x += s[n + 0], t.y += s[n + 1], e.x = t.x, e.y = t.y, o.lineTo(t.x, t.y), n === 0 && i === !0 && c.copy(t);
|
|
316
|
+
break;
|
|
317
|
+
case "c":
|
|
318
|
+
s = f(D);
|
|
319
|
+
for (let n = 0, B = s.length; n < B; n += 6)
|
|
320
|
+
o.bezierCurveTo(
|
|
321
|
+
t.x + s[n + 0],
|
|
322
|
+
t.y + s[n + 1],
|
|
323
|
+
t.x + s[n + 2],
|
|
324
|
+
t.y + s[n + 3],
|
|
325
|
+
t.x + s[n + 4],
|
|
326
|
+
t.y + s[n + 5]
|
|
327
|
+
), e.x = t.x + s[n + 2], e.y = t.y + s[n + 3], t.x += s[n + 4], t.y += s[n + 5], n === 0 && i === !0 && c.copy(t);
|
|
328
|
+
break;
|
|
329
|
+
case "s":
|
|
330
|
+
s = f(D);
|
|
331
|
+
for (let n = 0, B = s.length; n < B; n += 4)
|
|
332
|
+
o.bezierCurveTo(
|
|
333
|
+
k(t.x, e.x),
|
|
334
|
+
k(t.y, e.y),
|
|
335
|
+
t.x + s[n + 0],
|
|
336
|
+
t.y + s[n + 1],
|
|
337
|
+
t.x + s[n + 2],
|
|
338
|
+
t.y + s[n + 3]
|
|
339
|
+
), e.x = t.x + s[n + 0], e.y = t.y + s[n + 1], t.x += s[n + 2], t.y += s[n + 3], n === 0 && i === !0 && c.copy(t);
|
|
340
|
+
break;
|
|
341
|
+
case "q":
|
|
342
|
+
s = f(D);
|
|
343
|
+
for (let n = 0, B = s.length; n < B; n += 4)
|
|
344
|
+
o.quadraticCurveTo(
|
|
345
|
+
t.x + s[n + 0],
|
|
346
|
+
t.y + s[n + 1],
|
|
347
|
+
t.x + s[n + 2],
|
|
348
|
+
t.y + s[n + 3]
|
|
349
|
+
), e.x = t.x + s[n + 0], e.y = t.y + s[n + 1], t.x += s[n + 2], t.y += s[n + 3], n === 0 && i === !0 && c.copy(t);
|
|
350
|
+
break;
|
|
351
|
+
case "t":
|
|
352
|
+
s = f(D);
|
|
353
|
+
for (let n = 0, B = s.length; n < B; n += 2) {
|
|
354
|
+
const Y = k(t.x, e.x), ae = k(t.y, e.y);
|
|
355
|
+
o.quadraticCurveTo(
|
|
356
|
+
Y,
|
|
357
|
+
ae,
|
|
358
|
+
t.x + s[n + 0],
|
|
359
|
+
t.y + s[n + 1]
|
|
360
|
+
), e.x = Y, e.y = ae, t.x = t.x + s[n + 0], t.y = t.y + s[n + 1], n === 0 && i === !0 && c.copy(t);
|
|
361
|
+
}
|
|
362
|
+
break;
|
|
363
|
+
case "a":
|
|
364
|
+
s = f(D, [3, 4], 7);
|
|
365
|
+
for (let n = 0, B = s.length; n < B; n += 7) {
|
|
366
|
+
if (s[n + 5] == 0 && s[n + 6] == 0) continue;
|
|
367
|
+
const Y = t.clone();
|
|
368
|
+
t.x += s[n + 5], t.y += s[n + 6], e.x = t.x, e.y = t.y, v(
|
|
369
|
+
o,
|
|
370
|
+
s[n],
|
|
371
|
+
s[n + 1],
|
|
372
|
+
s[n + 2],
|
|
373
|
+
s[n + 3],
|
|
374
|
+
s[n + 4],
|
|
375
|
+
Y,
|
|
376
|
+
t
|
|
377
|
+
), n === 0 && i === !0 && c.copy(t);
|
|
378
|
+
}
|
|
379
|
+
break;
|
|
380
|
+
case "Z":
|
|
381
|
+
case "z":
|
|
382
|
+
o.currentPath.autoClose = !0, o.currentPath.curves.length > 0 && (t.copy(c), o.currentPath.currentPoint.copy(t), y = !0);
|
|
383
|
+
break;
|
|
384
|
+
default:
|
|
385
|
+
console.warn(b);
|
|
386
|
+
}
|
|
387
|
+
i = !1;
|
|
388
|
+
}
|
|
389
|
+
return o;
|
|
390
|
+
}
|
|
391
|
+
function h(r) {
|
|
392
|
+
if (!(!r.sheet || !r.sheet.cssRules || !r.sheet.cssRules.length))
|
|
393
|
+
for (let o = 0; o < r.sheet.cssRules.length; o++) {
|
|
394
|
+
const t = r.sheet.cssRules[o];
|
|
395
|
+
if (t.type !== 1) continue;
|
|
396
|
+
const e = t.selectorText.split(/,/gm).filter(Boolean).map((c) => c.trim());
|
|
397
|
+
for (let c = 0; c < e.length; c++) {
|
|
398
|
+
const y = Object.fromEntries(
|
|
399
|
+
Object.entries(t.style).filter(([, i]) => i !== "")
|
|
400
|
+
);
|
|
401
|
+
K[e[c]] = Object.assign(
|
|
402
|
+
K[e[c]] || {},
|
|
403
|
+
y
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function v(r, o, t, e, c, y, i, w) {
|
|
409
|
+
if (o == 0 || t == 0) {
|
|
410
|
+
r.lineTo(w.x, w.y);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
e = e * Math.PI / 180, o = Math.abs(o), t = Math.abs(t);
|
|
414
|
+
const C = (i.x - w.x) / 2, O = (i.y - w.y) / 2, l = Math.cos(e) * C + Math.sin(e) * O, b = -Math.sin(e) * C + Math.cos(e) * O;
|
|
415
|
+
let L = o * o, D = t * t;
|
|
416
|
+
const s = l * l, n = b * b, B = s / L + n / D;
|
|
417
|
+
if (B > 1) {
|
|
418
|
+
const xe = Math.sqrt(B);
|
|
419
|
+
o = xe * o, t = xe * t, L = o * o, D = t * t;
|
|
420
|
+
}
|
|
421
|
+
const Y = L * n + D * s, ae = (L * D - Y) / Y;
|
|
422
|
+
let le = Math.sqrt(Math.max(0, ae));
|
|
423
|
+
c === y && (le = -le);
|
|
424
|
+
const re = le * o * b / t, de = -le * t * l / o, ge = Math.cos(e) * re - Math.sin(e) * de + (i.x + w.x) / 2, Pe = Math.sin(e) * re + Math.cos(e) * de + (i.y + w.y) / 2, be = x(1, 0, (l - re) / o, (b - de) / t), we = x((l - re) / o, (b - de) / t, (-l - re) / o, (-b - de) / t) % (Math.PI * 2);
|
|
425
|
+
r.currentPath.absellipse(ge, Pe, o, t, be, be + we, y === 0, e);
|
|
426
|
+
}
|
|
427
|
+
function x(r, o, t, e) {
|
|
428
|
+
const c = r * t + o * e, y = Math.sqrt(r * r + o * o) * Math.sqrt(t * t + e * e);
|
|
429
|
+
let i = Math.acos(Math.max(-1, Math.min(1, c / y)));
|
|
430
|
+
return r * e - o * t < 0 && (i = -i), i;
|
|
431
|
+
}
|
|
432
|
+
function q(r) {
|
|
433
|
+
const o = p(r.getAttribute("x") || 0), t = p(r.getAttribute("y") || 0), e = p(r.getAttribute("rx") || r.getAttribute("ry") || 0), c = p(r.getAttribute("ry") || r.getAttribute("rx") || 0), y = p(r.getAttribute("width")), i = p(r.getAttribute("height")), w = 1 - 0.551915024494, C = new pe();
|
|
434
|
+
return C.moveTo(o + e, t), C.lineTo(o + y - e, t), (e !== 0 || c !== 0) && C.bezierCurveTo(
|
|
435
|
+
o + y - e * w,
|
|
436
|
+
t,
|
|
437
|
+
o + y,
|
|
438
|
+
t + c * w,
|
|
439
|
+
o + y,
|
|
440
|
+
t + c
|
|
441
|
+
), C.lineTo(o + y, t + i - c), (e !== 0 || c !== 0) && C.bezierCurveTo(
|
|
442
|
+
o + y,
|
|
443
|
+
t + i - c * w,
|
|
444
|
+
o + y - e * w,
|
|
445
|
+
t + i,
|
|
446
|
+
o + y - e,
|
|
447
|
+
t + i
|
|
448
|
+
), C.lineTo(o + e, t + i), (e !== 0 || c !== 0) && C.bezierCurveTo(
|
|
449
|
+
o + e * w,
|
|
450
|
+
t + i,
|
|
451
|
+
o,
|
|
452
|
+
t + i - c * w,
|
|
453
|
+
o,
|
|
454
|
+
t + i - c
|
|
455
|
+
), C.lineTo(o, t + c), (e !== 0 || c !== 0) && C.bezierCurveTo(o, t + c * w, o + e * w, t, o + e, t), C;
|
|
456
|
+
}
|
|
457
|
+
function T(r) {
|
|
458
|
+
function o(y, i, w) {
|
|
459
|
+
const C = p(i), O = p(w);
|
|
460
|
+
c === 0 ? e.moveTo(C, O) : e.lineTo(C, O), c++;
|
|
461
|
+
}
|
|
462
|
+
const t = /([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g, e = new pe();
|
|
463
|
+
let c = 0;
|
|
464
|
+
return r.getAttribute("points").replace(t, o), e.currentPath.autoClose = !0, e;
|
|
465
|
+
}
|
|
466
|
+
function H(r) {
|
|
467
|
+
function o(y, i, w) {
|
|
468
|
+
const C = p(i), O = p(w);
|
|
469
|
+
c === 0 ? e.moveTo(C, O) : e.lineTo(C, O), c++;
|
|
470
|
+
}
|
|
471
|
+
const t = /([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g, e = new pe();
|
|
472
|
+
let c = 0;
|
|
473
|
+
return r.getAttribute("points").replace(t, o), e.currentPath.autoClose = !1, e;
|
|
474
|
+
}
|
|
475
|
+
function G(r) {
|
|
476
|
+
const o = p(r.getAttribute("cx") || 0), t = p(r.getAttribute("cy") || 0), e = p(r.getAttribute("r") || 0), c = new Ne();
|
|
477
|
+
c.absarc(o, t, e, 0, Math.PI * 2);
|
|
478
|
+
const y = new pe();
|
|
479
|
+
return y.subPaths.push(c), y;
|
|
480
|
+
}
|
|
481
|
+
function E(r) {
|
|
482
|
+
const o = p(r.getAttribute("cx") || 0), t = p(r.getAttribute("cy") || 0), e = p(r.getAttribute("rx") || 0), c = p(r.getAttribute("ry") || 0), y = new Ne();
|
|
483
|
+
y.absellipse(o, t, e, c, 0, Math.PI * 2);
|
|
484
|
+
const i = new pe();
|
|
485
|
+
return i.subPaths.push(y), i;
|
|
486
|
+
}
|
|
487
|
+
function W(r) {
|
|
488
|
+
const o = p(r.getAttribute("x1") || 0), t = p(r.getAttribute("y1") || 0), e = p(r.getAttribute("x2") || 0), c = p(r.getAttribute("y2") || 0), y = new pe();
|
|
489
|
+
return y.moveTo(o, t), y.lineTo(e, c), y.currentPath.autoClose = !1, y;
|
|
490
|
+
}
|
|
491
|
+
function N(r, o) {
|
|
492
|
+
o = Object.assign({}, o);
|
|
493
|
+
let t = {};
|
|
494
|
+
if (r.hasAttribute("class")) {
|
|
495
|
+
const i = r.getAttribute("class").split(/\s/).filter(Boolean).map((w) => w.trim());
|
|
496
|
+
for (let w = 0; w < i.length; w++)
|
|
497
|
+
t = Object.assign(t, K["." + i[w]]);
|
|
498
|
+
}
|
|
499
|
+
r.hasAttribute("id") && (t = Object.assign(t, K["#" + r.getAttribute("id")]));
|
|
500
|
+
function e(i, w, C) {
|
|
501
|
+
C === void 0 && (C = function(l) {
|
|
502
|
+
return l.startsWith("url") && console.warn("SVGLoader: url access in attributes is not implemented."), l;
|
|
503
|
+
}), r.hasAttribute(i) && (o[w] = C(r.getAttribute(i))), t[i] && (o[w] = C(t[i])), r.style && r.style[i] !== "" && (o[w] = C(r.style[i]));
|
|
504
|
+
}
|
|
505
|
+
function c(i) {
|
|
506
|
+
return Math.max(0, Math.min(1, p(i)));
|
|
507
|
+
}
|
|
508
|
+
function y(i) {
|
|
509
|
+
return Math.max(0, p(i));
|
|
510
|
+
}
|
|
511
|
+
return e("fill", "fill"), e("fill-opacity", "fillOpacity", c), e("fill-rule", "fillRule"), e("opacity", "opacity", c), e("stroke", "stroke"), e("stroke-opacity", "strokeOpacity", c), e("stroke-width", "strokeWidth", y), e("stroke-linejoin", "strokeLineJoin"), e("stroke-linecap", "strokeLineCap"), e("stroke-miterlimit", "strokeMiterLimit", y), e("visibility", "visibility"), o;
|
|
512
|
+
}
|
|
513
|
+
function k(r, o) {
|
|
514
|
+
return r - (o - r);
|
|
515
|
+
}
|
|
516
|
+
function f(r, o, t) {
|
|
517
|
+
if (typeof r != "string")
|
|
518
|
+
throw new TypeError("Invalid input: " + typeof r);
|
|
519
|
+
const e = {
|
|
520
|
+
WHITESPACE: /[ \t\r\n]/,
|
|
521
|
+
DIGIT: /[\d]/,
|
|
522
|
+
SIGN: /[-+]/,
|
|
523
|
+
POINT: /\./,
|
|
524
|
+
COMMA: /,/,
|
|
525
|
+
EXP: /e/i,
|
|
526
|
+
FLAGS: /[01]/
|
|
527
|
+
}, c = 0, y = 1, i = 2, w = 3;
|
|
528
|
+
let C = c, O = !0, l = "", b = "";
|
|
529
|
+
const L = [];
|
|
530
|
+
function D(Y, ae, le) {
|
|
531
|
+
const re = new SyntaxError('Unexpected character "' + Y + '" at index ' + ae + ".");
|
|
532
|
+
throw re.partial = le, re;
|
|
533
|
+
}
|
|
534
|
+
function s() {
|
|
535
|
+
l !== "" && (b === "" ? L.push(Number(l)) : L.push(Number(l) * Math.pow(10, Number(b)))), l = "", b = "";
|
|
536
|
+
}
|
|
537
|
+
let n;
|
|
538
|
+
const B = r.length;
|
|
539
|
+
for (let Y = 0; Y < B; Y++) {
|
|
540
|
+
if (n = r[Y], Array.isArray(o) && o.includes(L.length % t) && e.FLAGS.test(n)) {
|
|
541
|
+
C = y, l = n, s();
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
if (C === c) {
|
|
545
|
+
if (e.WHITESPACE.test(n))
|
|
546
|
+
continue;
|
|
547
|
+
if (e.DIGIT.test(n) || e.SIGN.test(n)) {
|
|
548
|
+
C = y, l = n;
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
if (e.POINT.test(n)) {
|
|
552
|
+
C = i, l = n;
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
e.COMMA.test(n) && (O && D(n, Y, L), O = !0);
|
|
556
|
+
}
|
|
557
|
+
if (C === y) {
|
|
558
|
+
if (e.DIGIT.test(n)) {
|
|
559
|
+
l += n;
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
if (e.POINT.test(n)) {
|
|
563
|
+
l += n, C = i;
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
if (e.EXP.test(n)) {
|
|
567
|
+
C = w;
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
e.SIGN.test(n) && l.length === 1 && e.SIGN.test(l[0]) && D(n, Y, L);
|
|
571
|
+
}
|
|
572
|
+
if (C === i) {
|
|
573
|
+
if (e.DIGIT.test(n)) {
|
|
574
|
+
l += n;
|
|
575
|
+
continue;
|
|
576
|
+
}
|
|
577
|
+
if (e.EXP.test(n)) {
|
|
578
|
+
C = w;
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
e.POINT.test(n) && l[l.length - 1] === "." && D(n, Y, L);
|
|
582
|
+
}
|
|
583
|
+
if (C === w) {
|
|
584
|
+
if (e.DIGIT.test(n)) {
|
|
585
|
+
b += n;
|
|
586
|
+
continue;
|
|
587
|
+
}
|
|
588
|
+
if (e.SIGN.test(n)) {
|
|
589
|
+
if (b === "") {
|
|
590
|
+
b += n;
|
|
591
|
+
continue;
|
|
592
|
+
}
|
|
593
|
+
b.length === 1 && e.SIGN.test(b) && D(n, Y, L);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
e.WHITESPACE.test(n) ? (s(), C = c, O = !1) : e.COMMA.test(n) ? (s(), C = c, O = !0) : e.SIGN.test(n) ? (s(), C = y, l = n) : e.POINT.test(n) ? (s(), C = i, l = n) : D(n, Y, L);
|
|
597
|
+
}
|
|
598
|
+
return s(), L;
|
|
599
|
+
}
|
|
600
|
+
const P = ["mm", "cm", "in", "pt", "pc", "px"], d = {
|
|
601
|
+
mm: {
|
|
602
|
+
mm: 1,
|
|
603
|
+
cm: 0.1,
|
|
604
|
+
in: 1 / 25.4,
|
|
605
|
+
pt: 72 / 25.4,
|
|
606
|
+
pc: 6 / 25.4,
|
|
607
|
+
px: -1
|
|
608
|
+
},
|
|
609
|
+
cm: {
|
|
610
|
+
mm: 10,
|
|
611
|
+
cm: 1,
|
|
612
|
+
in: 1 / 2.54,
|
|
613
|
+
pt: 72 / 2.54,
|
|
614
|
+
pc: 6 / 2.54,
|
|
615
|
+
px: -1
|
|
616
|
+
},
|
|
617
|
+
in: {
|
|
618
|
+
mm: 25.4,
|
|
619
|
+
cm: 2.54,
|
|
620
|
+
in: 1,
|
|
621
|
+
pt: 72,
|
|
622
|
+
pc: 6,
|
|
623
|
+
px: -1
|
|
624
|
+
},
|
|
625
|
+
pt: {
|
|
626
|
+
mm: 25.4 / 72,
|
|
627
|
+
cm: 2.54 / 72,
|
|
628
|
+
in: 1 / 72,
|
|
629
|
+
pt: 1,
|
|
630
|
+
pc: 6 / 72,
|
|
631
|
+
px: -1
|
|
632
|
+
},
|
|
633
|
+
pc: {
|
|
634
|
+
mm: 25.4 / 6,
|
|
635
|
+
cm: 2.54 / 6,
|
|
636
|
+
in: 1 / 6,
|
|
637
|
+
pt: 72 / 6,
|
|
638
|
+
pc: 1,
|
|
639
|
+
px: -1
|
|
640
|
+
},
|
|
641
|
+
px: {
|
|
642
|
+
px: 1
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
function p(r) {
|
|
646
|
+
let o = "px";
|
|
647
|
+
if (typeof r == "string" || r instanceof String)
|
|
648
|
+
for (let e = 0, c = P.length; e < c; e++) {
|
|
649
|
+
const y = P[e];
|
|
650
|
+
if (r.endsWith(y)) {
|
|
651
|
+
o = y, r = r.substring(0, r.length - y.length);
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
let t;
|
|
656
|
+
return o === "px" && A.defaultUnit !== "px" ? t = d.in[A.defaultUnit] / A.defaultDPI : (t = d[o][A.defaultUnit], t < 0 && (t = d[o].in * A.defaultDPI)), t * parseFloat(r);
|
|
657
|
+
}
|
|
658
|
+
function S(r) {
|
|
659
|
+
if (!(r.hasAttribute("transform") || r.nodeName === "use" && (r.hasAttribute("x") || r.hasAttribute("y"))))
|
|
660
|
+
return null;
|
|
661
|
+
const o = j(r);
|
|
662
|
+
return $.length > 0 && o.premultiply($[$.length - 1]), se.copy(o), $.push(o), o;
|
|
663
|
+
}
|
|
664
|
+
function j(r) {
|
|
665
|
+
const o = new ye(), t = oe;
|
|
666
|
+
if (r.nodeName === "use" && (r.hasAttribute("x") || r.hasAttribute("y"))) {
|
|
667
|
+
const e = p(r.getAttribute("x")), c = p(r.getAttribute("y"));
|
|
668
|
+
o.translate(e, c);
|
|
669
|
+
}
|
|
670
|
+
if (r.hasAttribute("transform")) {
|
|
671
|
+
const e = r.getAttribute("transform").split(")");
|
|
672
|
+
for (let c = e.length - 1; c >= 0; c--) {
|
|
673
|
+
const y = e[c].trim();
|
|
674
|
+
if (y === "") continue;
|
|
675
|
+
const i = y.indexOf("("), w = y.length;
|
|
676
|
+
if (i > 0 && i < w) {
|
|
677
|
+
const C = y.slice(0, i), O = f(y.slice(i + 1));
|
|
678
|
+
switch (t.identity(), C) {
|
|
679
|
+
case "translate":
|
|
680
|
+
if (O.length >= 1) {
|
|
681
|
+
const l = O[0];
|
|
682
|
+
let b = 0;
|
|
683
|
+
O.length >= 2 && (b = O[1]), t.translate(l, b);
|
|
684
|
+
}
|
|
685
|
+
break;
|
|
686
|
+
case "rotate":
|
|
687
|
+
if (O.length >= 1) {
|
|
688
|
+
let l = 0, b = 0, L = 0;
|
|
689
|
+
l = O[0] * Math.PI / 180, O.length >= 3 && (b = O[1], L = O[2]), J.makeTranslation(-b, -L), U.makeRotation(l), g.multiplyMatrices(U, J), J.makeTranslation(b, L), t.multiplyMatrices(J, g);
|
|
690
|
+
}
|
|
691
|
+
break;
|
|
692
|
+
case "scale":
|
|
693
|
+
if (O.length >= 1) {
|
|
694
|
+
const l = O[0];
|
|
695
|
+
let b = l;
|
|
696
|
+
O.length >= 2 && (b = O[1]), t.scale(l, b);
|
|
697
|
+
}
|
|
698
|
+
break;
|
|
699
|
+
case "skewX":
|
|
700
|
+
O.length === 1 && t.set(
|
|
701
|
+
1,
|
|
702
|
+
Math.tan(O[0] * Math.PI / 180),
|
|
703
|
+
0,
|
|
704
|
+
0,
|
|
705
|
+
1,
|
|
706
|
+
0,
|
|
707
|
+
0,
|
|
708
|
+
0,
|
|
709
|
+
1
|
|
710
|
+
);
|
|
711
|
+
break;
|
|
712
|
+
case "skewY":
|
|
713
|
+
O.length === 1 && t.set(
|
|
714
|
+
1,
|
|
715
|
+
0,
|
|
716
|
+
0,
|
|
717
|
+
Math.tan(O[0] * Math.PI / 180),
|
|
718
|
+
1,
|
|
719
|
+
0,
|
|
720
|
+
0,
|
|
721
|
+
0,
|
|
722
|
+
1
|
|
723
|
+
);
|
|
724
|
+
break;
|
|
725
|
+
case "matrix":
|
|
726
|
+
O.length === 6 && t.set(
|
|
727
|
+
O[0],
|
|
728
|
+
O[2],
|
|
729
|
+
O[4],
|
|
730
|
+
O[1],
|
|
731
|
+
O[3],
|
|
732
|
+
O[5],
|
|
733
|
+
0,
|
|
734
|
+
0,
|
|
735
|
+
1
|
|
736
|
+
);
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
o.premultiply(t);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
return o;
|
|
744
|
+
}
|
|
745
|
+
function m(r, o) {
|
|
746
|
+
function t(i) {
|
|
747
|
+
ee.set(i.x, i.y, 1).applyMatrix3(o), i.set(ee.x, ee.y);
|
|
748
|
+
}
|
|
749
|
+
function e(i) {
|
|
750
|
+
const w = i.xRadius, C = i.yRadius, O = Math.cos(i.aRotation), l = Math.sin(i.aRotation), b = new ke(w * O, w * l, 0), L = new ke(-C * l, C * O, 0), D = b.applyMatrix3(o), s = L.applyMatrix3(o), n = oe.set(
|
|
751
|
+
D.x,
|
|
752
|
+
s.x,
|
|
753
|
+
0,
|
|
754
|
+
D.y,
|
|
755
|
+
s.y,
|
|
756
|
+
0,
|
|
757
|
+
0,
|
|
758
|
+
0,
|
|
759
|
+
1
|
|
760
|
+
), B = J.copy(n).invert(), le = U.copy(B).transpose().multiply(B).elements, re = Z(le[0], le[1], le[4]), de = Math.sqrt(re.rt1), ge = Math.sqrt(re.rt2);
|
|
761
|
+
if (i.xRadius = 1 / de, i.yRadius = 1 / ge, i.aRotation = Math.atan2(re.sn, re.cs), !((i.aEndAngle - i.aStartAngle) % (2 * Math.PI) < Number.EPSILON)) {
|
|
762
|
+
const be = J.set(
|
|
763
|
+
de,
|
|
764
|
+
0,
|
|
765
|
+
0,
|
|
766
|
+
0,
|
|
767
|
+
ge,
|
|
768
|
+
0,
|
|
769
|
+
0,
|
|
770
|
+
0,
|
|
771
|
+
1
|
|
772
|
+
), we = U.set(
|
|
773
|
+
re.cs,
|
|
774
|
+
re.sn,
|
|
775
|
+
0,
|
|
776
|
+
-re.sn,
|
|
777
|
+
re.cs,
|
|
778
|
+
0,
|
|
779
|
+
0,
|
|
780
|
+
0,
|
|
781
|
+
1
|
|
782
|
+
), xe = be.multiply(we).multiply(n), Re = (Le) => {
|
|
783
|
+
const { x: He, y: Ue } = new ke(Math.cos(Le), Math.sin(Le), 0).applyMatrix3(xe);
|
|
784
|
+
return Math.atan2(Ue, He);
|
|
785
|
+
};
|
|
786
|
+
i.aStartAngle = Re(i.aStartAngle), i.aEndAngle = Re(i.aEndAngle), z(o) && (i.aClockwise = !i.aClockwise);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
function c(i) {
|
|
790
|
+
const w = F(o), C = X(o);
|
|
791
|
+
i.xRadius *= w, i.yRadius *= C;
|
|
792
|
+
const O = w > Number.EPSILON ? Math.atan2(o.elements[1], o.elements[0]) : Math.atan2(-o.elements[3], o.elements[4]);
|
|
793
|
+
i.aRotation += O, z(o) && (i.aStartAngle *= -1, i.aEndAngle *= -1, i.aClockwise = !i.aClockwise);
|
|
794
|
+
}
|
|
795
|
+
const y = r.subPaths;
|
|
796
|
+
for (let i = 0, w = y.length; i < w; i++) {
|
|
797
|
+
const O = y[i].curves;
|
|
798
|
+
for (let l = 0; l < O.length; l++) {
|
|
799
|
+
const b = O[l];
|
|
800
|
+
b.isLineCurve ? (t(b.v1), t(b.v2)) : b.isCubicBezierCurve ? (t(b.v0), t(b.v1), t(b.v2), t(b.v3)) : b.isQuadraticBezierCurve ? (t(b.v0), t(b.v1), t(b.v2)) : b.isEllipseCurve && (te.set(b.aX, b.aY), t(te), b.aX = te.x, b.aY = te.y, R(o) ? e(b) : c(b));
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
function z(r) {
|
|
805
|
+
const o = r.elements;
|
|
806
|
+
return o[0] * o[4] - o[1] * o[3] < 0;
|
|
807
|
+
}
|
|
808
|
+
function R(r) {
|
|
809
|
+
const o = r.elements, t = o[0] * o[3] + o[1] * o[4];
|
|
810
|
+
if (t === 0) return !1;
|
|
811
|
+
const e = F(r), c = X(r);
|
|
812
|
+
return Math.abs(t / (e * c)) > Number.EPSILON;
|
|
813
|
+
}
|
|
814
|
+
function F(r) {
|
|
815
|
+
const o = r.elements;
|
|
816
|
+
return Math.sqrt(o[0] * o[0] + o[1] * o[1]);
|
|
817
|
+
}
|
|
818
|
+
function X(r) {
|
|
819
|
+
const o = r.elements;
|
|
820
|
+
return Math.sqrt(o[3] * o[3] + o[4] * o[4]);
|
|
821
|
+
}
|
|
822
|
+
function Z(r, o, t) {
|
|
823
|
+
let e, c, y, i, w;
|
|
824
|
+
const C = r + t, O = r - t, l = Math.sqrt(O * O + 4 * o * o);
|
|
825
|
+
return C > 0 ? (e = 0.5 * (C + l), w = 1 / e, c = r * w * t - o * w * o) : C < 0 ? c = 0.5 * (C - l) : (e = 0.5 * l, c = -0.5 * l), O > 0 ? y = O + l : y = O - l, Math.abs(y) > 2 * Math.abs(o) ? (w = -2 * o / y, i = 1 / Math.sqrt(1 + w * w), y = w * i) : Math.abs(o) === 0 ? (y = 1, i = 0) : (w = -0.5 * y / o, y = 1 / Math.sqrt(1 + w * w), i = w * y), O > 0 && (w = y, y = -i, i = w), { rt1: e, rt2: c, cs: y, sn: i };
|
|
826
|
+
}
|
|
827
|
+
const V = [], K = {}, $ = [], oe = new ye(), J = new ye(), U = new ye(), g = new ye(), te = new Q(), ee = new ke(), se = new ye(), he = new DOMParser().parseFromString(a, "image/svg+xml");
|
|
828
|
+
return M(he.documentElement, {
|
|
829
|
+
fill: "#000",
|
|
830
|
+
fillOpacity: 1,
|
|
831
|
+
strokeOpacity: 1,
|
|
832
|
+
strokeWidth: 1,
|
|
833
|
+
strokeLineJoin: "miter",
|
|
834
|
+
strokeLineCap: "butt",
|
|
835
|
+
strokeMiterLimit: 4
|
|
836
|
+
}), { paths: V, xml: he.documentElement };
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Creates from the given shape path and array of shapes.
|
|
840
|
+
*
|
|
841
|
+
* @param {ShapePath} shapePath - The shape path.
|
|
842
|
+
* @return {Array<Shape>} An array of shapes.
|
|
843
|
+
*/
|
|
844
|
+
static createShapes(a) {
|
|
845
|
+
const M = {
|
|
846
|
+
ORIGIN: 0,
|
|
847
|
+
DESTINATION: 1,
|
|
848
|
+
BETWEEN: 2,
|
|
849
|
+
LEFT: 3,
|
|
850
|
+
RIGHT: 4,
|
|
851
|
+
BEHIND: 5,
|
|
852
|
+
BEYOND: 6
|
|
853
|
+
}, I = {
|
|
854
|
+
loc: M.ORIGIN,
|
|
855
|
+
t: 0
|
|
856
|
+
};
|
|
857
|
+
function h(k, f, P, d) {
|
|
858
|
+
const p = k.x, S = f.x, j = P.x, m = d.x, z = k.y, R = f.y, F = P.y, X = d.y, Z = (m - j) * (z - F) - (X - F) * (p - j), V = (S - p) * (z - F) - (R - z) * (p - j), K = (X - F) * (S - p) - (m - j) * (R - z), $ = Z / K, oe = V / K;
|
|
859
|
+
if (K === 0 && Z !== 0 || $ <= 0 || $ >= 1 || oe < 0 || oe > 1)
|
|
860
|
+
return null;
|
|
861
|
+
if (Z === 0 && K === 0) {
|
|
862
|
+
for (let J = 0; J < 2; J++)
|
|
863
|
+
if (v(J === 0 ? P : d, k, f), I.loc == M.ORIGIN) {
|
|
864
|
+
const U = J === 0 ? P : d;
|
|
865
|
+
return { x: U.x, y: U.y, t: I.t };
|
|
866
|
+
} else if (I.loc == M.BETWEEN) {
|
|
867
|
+
const U = +(p + I.t * (S - p)).toPrecision(10), g = +(z + I.t * (R - z)).toPrecision(10);
|
|
868
|
+
return { x: U, y: g, t: I.t };
|
|
869
|
+
}
|
|
870
|
+
return null;
|
|
871
|
+
} else {
|
|
872
|
+
for (let g = 0; g < 2; g++)
|
|
873
|
+
if (v(g === 0 ? P : d, k, f), I.loc == M.ORIGIN) {
|
|
874
|
+
const te = g === 0 ? P : d;
|
|
875
|
+
return { x: te.x, y: te.y, t: I.t };
|
|
876
|
+
}
|
|
877
|
+
const J = +(p + $ * (S - p)).toPrecision(10), U = +(z + $ * (R - z)).toPrecision(10);
|
|
878
|
+
return { x: J, y: U, t: $ };
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
function v(k, f, P) {
|
|
882
|
+
const d = P.x - f.x, p = P.y - f.y, S = k.x - f.x, j = k.y - f.y, m = d * j - S * p;
|
|
883
|
+
if (k.x === f.x && k.y === f.y) {
|
|
884
|
+
I.loc = M.ORIGIN, I.t = 0;
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
if (k.x === P.x && k.y === P.y) {
|
|
888
|
+
I.loc = M.DESTINATION, I.t = 1;
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
if (m < -Number.EPSILON) {
|
|
892
|
+
I.loc = M.LEFT;
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
if (m > Number.EPSILON) {
|
|
896
|
+
I.loc = M.RIGHT;
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
if (d * S < 0 || p * j < 0) {
|
|
900
|
+
I.loc = M.BEHIND;
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
if (Math.sqrt(d * d + p * p) < Math.sqrt(S * S + j * j)) {
|
|
904
|
+
I.loc = M.BEYOND;
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
let z;
|
|
908
|
+
d !== 0 ? z = S / d : z = j / p, I.loc = M.BETWEEN, I.t = z;
|
|
909
|
+
}
|
|
910
|
+
function x(k, f) {
|
|
911
|
+
const P = [], d = [];
|
|
912
|
+
for (let p = 1; p < k.length; p++) {
|
|
913
|
+
const S = k[p - 1], j = k[p];
|
|
914
|
+
for (let m = 1; m < f.length; m++) {
|
|
915
|
+
const z = f[m - 1], R = f[m], F = h(S, j, z, R);
|
|
916
|
+
F !== null && P.find((X) => X.t <= F.t + Number.EPSILON && X.t >= F.t - Number.EPSILON) === void 0 && (P.push(F), d.push(new Q(F.x, F.y)));
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
return d;
|
|
920
|
+
}
|
|
921
|
+
function q(k, f, P) {
|
|
922
|
+
const d = new Q();
|
|
923
|
+
f.getCenter(d);
|
|
924
|
+
const p = [];
|
|
925
|
+
return P.forEach((S) => {
|
|
926
|
+
S.boundingBox.containsPoint(d) && x(k, S.points).forEach((m) => {
|
|
927
|
+
p.push({ identifier: S.identifier, isCW: S.isCW, point: m });
|
|
928
|
+
});
|
|
929
|
+
}), p.sort((S, j) => S.point.x - j.point.x), p;
|
|
930
|
+
}
|
|
931
|
+
function T(k, f, P, d, p) {
|
|
932
|
+
(p == null || p === "") && (p = "nonzero");
|
|
933
|
+
const S = new Q();
|
|
934
|
+
k.boundingBox.getCenter(S);
|
|
935
|
+
const j = [new Q(P, S.y), new Q(d, S.y)], m = q(j, k.boundingBox, f);
|
|
936
|
+
m.sort((V, K) => V.point.x - K.point.x);
|
|
937
|
+
const z = [], R = [];
|
|
938
|
+
m.forEach((V) => {
|
|
939
|
+
V.identifier === k.identifier ? z.push(V) : R.push(V);
|
|
940
|
+
});
|
|
941
|
+
const F = z[0].point.x, X = [];
|
|
942
|
+
let Z = 0;
|
|
943
|
+
for (; Z < R.length && R[Z].point.x < F; )
|
|
944
|
+
X.length > 0 && X[X.length - 1] === R[Z].identifier ? X.pop() : X.push(R[Z].identifier), Z++;
|
|
945
|
+
if (X.push(k.identifier), p === "evenodd") {
|
|
946
|
+
const V = X.length % 2 === 0, K = X[X.length - 2];
|
|
947
|
+
return { identifier: k.identifier, isHole: V, for: K };
|
|
948
|
+
} else if (p === "nonzero") {
|
|
949
|
+
let V = !0, K = null, $ = null;
|
|
950
|
+
for (let oe = 0; oe < X.length; oe++) {
|
|
951
|
+
const J = X[oe];
|
|
952
|
+
V ? ($ = f[J].isCW, V = !1, K = J) : $ !== f[J].isCW && ($ = f[J].isCW, V = !0);
|
|
953
|
+
}
|
|
954
|
+
return { identifier: k.identifier, isHole: V, for: K };
|
|
955
|
+
} else
|
|
956
|
+
console.warn('fill-rule: "' + p + '" is currently not implemented.');
|
|
957
|
+
}
|
|
958
|
+
let H = 999999999, G = -999999999, E = a.subPaths.map((k) => {
|
|
959
|
+
const f = k.getPoints();
|
|
960
|
+
let P = -999999999, d = 999999999, p = -999999999, S = 999999999;
|
|
961
|
+
for (let j = 0; j < f.length; j++) {
|
|
962
|
+
const m = f[j];
|
|
963
|
+
m.y > P && (P = m.y), m.y < d && (d = m.y), m.x > p && (p = m.x), m.x < S && (S = m.x);
|
|
964
|
+
}
|
|
965
|
+
return G <= p && (G = p + 1), H >= S && (H = S - 1), { curves: k.curves, points: f, isCW: ft.isClockWise(f), identifier: -1, boundingBox: new ut(new Q(S, d), new Q(p, P)) };
|
|
966
|
+
});
|
|
967
|
+
E = E.filter((k) => k.points.length > 1);
|
|
968
|
+
for (let k = 0; k < E.length; k++)
|
|
969
|
+
E[k].identifier = k;
|
|
970
|
+
const W = E.map((k) => T(k, E, H, G, a.userData ? a.userData.style.fillRule : void 0)), N = [];
|
|
971
|
+
return E.forEach((k) => {
|
|
972
|
+
if (!W[k.identifier].isHole) {
|
|
973
|
+
const P = new ht();
|
|
974
|
+
P.curves = k.curves, W.filter((p) => p.isHole && p.for === k.identifier).forEach((p) => {
|
|
975
|
+
const S = E[p.identifier], j = new Ne();
|
|
976
|
+
j.curves = S.curves, P.holes.push(j);
|
|
977
|
+
}), N.push(P);
|
|
978
|
+
}
|
|
979
|
+
}), N;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Returns a stroke style object from the given parameters.
|
|
983
|
+
*
|
|
984
|
+
* @param {number} [width=1] - The stroke width.
|
|
985
|
+
* @param {string} [color='#000'] - The stroke color, as returned by {@link Color#getStyle}.
|
|
986
|
+
* @param {'round'|'bevel'|'miter'|'miter-limit'} [lineJoin='miter'] - The line join style.
|
|
987
|
+
* @param {'round'|'square'|'butt'} [lineCap='butt'] - The line cap style.
|
|
988
|
+
* @param {number} [miterLimit=4] - Maximum join length, in multiples of the `width` parameter (join is truncated if it exceeds that distance).
|
|
989
|
+
* @return {Object} The style object.
|
|
990
|
+
*/
|
|
991
|
+
static getStrokeStyle(a, A, M, I, h) {
|
|
992
|
+
return a = a !== void 0 ? a : 1, A = A !== void 0 ? A : "#000", M = M !== void 0 ? M : "miter", I = I !== void 0 ? I : "butt", h = h !== void 0 ? h : 4, {
|
|
993
|
+
strokeColor: A,
|
|
994
|
+
strokeWidth: a,
|
|
995
|
+
strokeLineJoin: M,
|
|
996
|
+
strokeLineCap: I,
|
|
997
|
+
strokeMiterLimit: h
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Creates a stroke from an array of points.
|
|
1002
|
+
*
|
|
1003
|
+
* @param {Array<Vector2>} points - The points in 2D space. Minimum 2 points. The path can be open or closed (last point equals to first point).
|
|
1004
|
+
* @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object.
|
|
1005
|
+
* @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps.
|
|
1006
|
+
* @param {number} [minDistance=0.001] - Points closer to this distance will be merged.
|
|
1007
|
+
* @return {?BufferGeometry} The stroke geometry. UV coordinates are generated ('u' along path. 'v' across it, from left to right).
|
|
1008
|
+
* Returns `null` if not geometry was generated.
|
|
1009
|
+
*/
|
|
1010
|
+
static pointsToStroke(a, A, M, I) {
|
|
1011
|
+
const h = [], v = [], x = [];
|
|
1012
|
+
if (Ie.pointsToStrokeWithBuffers(a, A, M, I, h, v, x) === 0)
|
|
1013
|
+
return null;
|
|
1014
|
+
const q = new mt();
|
|
1015
|
+
return q.setAttribute("position", new Ee(h, 3)), q.setAttribute("normal", new Ee(v, 3)), q.setAttribute("uv", new Ee(x, 2)), q;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Creates a stroke from an array of points.
|
|
1019
|
+
*
|
|
1020
|
+
* @param {Array<Vector2>} points - The points in 2D space. Minimum 2 points.
|
|
1021
|
+
* @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object.
|
|
1022
|
+
* @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps.
|
|
1023
|
+
* @param {number} [minDistance=0.001] - Points closer to this distance will be merged.
|
|
1024
|
+
* @param {Array<number>} vertices - An array holding vertices.
|
|
1025
|
+
* @param {Array<number>} normals - An array holding normals.
|
|
1026
|
+
* @param {Array<number>} uvs - An array holding uvs.
|
|
1027
|
+
* @param {number} [vertexOffset=0] - The vertex offset.
|
|
1028
|
+
* @return {number} The number of vertices.
|
|
1029
|
+
*/
|
|
1030
|
+
static pointsToStrokeWithBuffers(a, A, M, I, h, v, x, q) {
|
|
1031
|
+
const T = new Q(), H = new Q(), G = new Q(), E = new Q(), W = new Q(), N = new Q(), k = new Q(), f = new Q(), P = new Q(), d = new Q(), p = new Q(), S = new Q(), j = new Q(), m = new Q(), z = new Q(), R = new Q(), F = new Q();
|
|
1032
|
+
M = M !== void 0 ? M : 12, I = I !== void 0 ? I : 1e-3, q = q !== void 0 ? q : 0, a = O(a);
|
|
1033
|
+
const X = a.length;
|
|
1034
|
+
if (X < 2) return 0;
|
|
1035
|
+
const Z = a[0].equals(a[X - 1]);
|
|
1036
|
+
let V, K = a[0], $;
|
|
1037
|
+
const oe = A.strokeWidth / 2, J = 1 / (X - 1);
|
|
1038
|
+
let U = 0, g, te, ee, se, he = !1, ce = 0, r = q * 3, o = q * 2;
|
|
1039
|
+
t(a[0], a[1], T).multiplyScalar(oe), f.copy(a[0]).sub(T), P.copy(a[0]).add(T), d.copy(f), p.copy(P);
|
|
1040
|
+
for (let l = 1; l < X; l++) {
|
|
1041
|
+
V = a[l], l === X - 1 ? Z ? $ = a[1] : $ = void 0 : $ = a[l + 1];
|
|
1042
|
+
const b = T;
|
|
1043
|
+
if (t(K, V, b), G.copy(b).multiplyScalar(oe), S.copy(V).sub(G), j.copy(V).add(G), g = U + J, te = !1, $ !== void 0) {
|
|
1044
|
+
t(V, $, H), G.copy(H).multiplyScalar(oe), m.copy(V).sub(G), z.copy(V).add(G), ee = !0, G.subVectors($, K), b.dot(G) < 0 && (ee = !1), l === 1 && (he = ee), G.subVectors($, V), G.normalize();
|
|
1045
|
+
const L = Math.abs(b.dot(G));
|
|
1046
|
+
if (L > Number.EPSILON) {
|
|
1047
|
+
const D = oe / L;
|
|
1048
|
+
G.multiplyScalar(-D), E.subVectors(V, K), W.copy(E).setLength(D).add(G), R.copy(W).negate();
|
|
1049
|
+
const s = W.length(), n = E.length();
|
|
1050
|
+
E.divideScalar(n), N.subVectors($, V);
|
|
1051
|
+
const B = N.length();
|
|
1052
|
+
switch (N.divideScalar(B), E.dot(R) < n && N.dot(R) < B && (te = !0), F.copy(W).add(V), R.add(V), se = !1, te ? ee ? (z.copy(R), j.copy(R)) : (m.copy(R), S.copy(R)) : y(), A.strokeLineJoin) {
|
|
1053
|
+
case "bevel":
|
|
1054
|
+
i(ee, te, g);
|
|
1055
|
+
break;
|
|
1056
|
+
case "round":
|
|
1057
|
+
w(ee, te), ee ? c(V, S, m, g, 0) : c(V, z, j, g, 1);
|
|
1058
|
+
break;
|
|
1059
|
+
case "miter":
|
|
1060
|
+
case "miter-clip":
|
|
1061
|
+
default:
|
|
1062
|
+
const Y = oe * A.strokeMiterLimit / s;
|
|
1063
|
+
if (Y < 1)
|
|
1064
|
+
if (A.strokeLineJoin !== "miter-clip") {
|
|
1065
|
+
i(ee, te, g);
|
|
1066
|
+
break;
|
|
1067
|
+
} else
|
|
1068
|
+
w(ee, te), ee ? (N.subVectors(F, S).multiplyScalar(Y).add(S), k.subVectors(F, m).multiplyScalar(Y).add(m), e(S, g, 0), e(N, g, 0), e(V, g, 0.5), e(V, g, 0.5), e(N, g, 0), e(k, g, 0), e(V, g, 0.5), e(k, g, 0), e(m, g, 0)) : (N.subVectors(F, j).multiplyScalar(Y).add(j), k.subVectors(F, z).multiplyScalar(Y).add(z), e(j, g, 1), e(N, g, 1), e(V, g, 0.5), e(V, g, 0.5), e(N, g, 1), e(k, g, 1), e(V, g, 0.5), e(k, g, 1), e(z, g, 1));
|
|
1069
|
+
else
|
|
1070
|
+
te ? (ee ? (e(P, U, 1), e(f, U, 0), e(F, g, 0), e(P, U, 1), e(F, g, 0), e(R, g, 1)) : (e(P, U, 1), e(f, U, 0), e(F, g, 1), e(f, U, 0), e(R, g, 0), e(F, g, 1)), ee ? m.copy(F) : z.copy(F)) : ee ? (e(S, g, 0), e(F, g, 0), e(V, g, 0.5), e(V, g, 0.5), e(F, g, 0), e(m, g, 0)) : (e(j, g, 1), e(F, g, 1), e(V, g, 0.5), e(V, g, 0.5), e(F, g, 1), e(z, g, 1)), se = !0;
|
|
1071
|
+
break;
|
|
1072
|
+
}
|
|
1073
|
+
} else
|
|
1074
|
+
y();
|
|
1075
|
+
} else
|
|
1076
|
+
y();
|
|
1077
|
+
!Z && l === X - 1 && C(a[0], d, p, ee, !0, U), U = g, K = V, f.copy(m), P.copy(z);
|
|
1078
|
+
}
|
|
1079
|
+
if (!Z)
|
|
1080
|
+
C(V, S, j, ee, !1, g);
|
|
1081
|
+
else if (te && h) {
|
|
1082
|
+
let l = F, b = R;
|
|
1083
|
+
he !== ee && (l = R, b = F), ee ? (se || he) && (b.toArray(h, 0 * 3), b.toArray(h, 3 * 3), se && l.toArray(h, 1 * 3)) : (se || !he) && (b.toArray(h, 1 * 3), b.toArray(h, 3 * 3), se && l.toArray(h, 0 * 3));
|
|
1084
|
+
}
|
|
1085
|
+
return ce;
|
|
1086
|
+
function t(l, b, L) {
|
|
1087
|
+
return L.subVectors(b, l), L.set(-L.y, L.x).normalize();
|
|
1088
|
+
}
|
|
1089
|
+
function e(l, b, L) {
|
|
1090
|
+
h && (h[r] = l.x, h[r + 1] = l.y, h[r + 2] = 0, v && (v[r] = 0, v[r + 1] = 0, v[r + 2] = 1), r += 3, x && (x[o] = b, x[o + 1] = L, o += 2)), ce += 3;
|
|
1091
|
+
}
|
|
1092
|
+
function c(l, b, L, D, s) {
|
|
1093
|
+
T.copy(b).sub(l).normalize(), H.copy(L).sub(l).normalize();
|
|
1094
|
+
let n = Math.PI;
|
|
1095
|
+
const B = T.dot(H);
|
|
1096
|
+
Math.abs(B) < 1 && (n = Math.abs(Math.acos(B))), n /= M, G.copy(b);
|
|
1097
|
+
for (let Y = 0, ae = M - 1; Y < ae; Y++)
|
|
1098
|
+
E.copy(G).rotateAround(l, n), e(G, D, s), e(E, D, s), e(l, D, 0.5), G.copy(E);
|
|
1099
|
+
e(E, D, s), e(L, D, s), e(l, D, 0.5);
|
|
1100
|
+
}
|
|
1101
|
+
function y() {
|
|
1102
|
+
e(P, U, 1), e(f, U, 0), e(S, g, 0), e(P, U, 1), e(S, g, 0), e(j, g, 1);
|
|
1103
|
+
}
|
|
1104
|
+
function i(l, b, L) {
|
|
1105
|
+
b ? l ? (e(P, U, 1), e(f, U, 0), e(S, g, 0), e(P, U, 1), e(S, g, 0), e(R, g, 1), e(S, L, 0), e(m, L, 0), e(R, L, 0.5)) : (e(P, U, 1), e(f, U, 0), e(j, g, 1), e(f, U, 0), e(R, g, 0), e(j, g, 1), e(j, L, 1), e(R, L, 0), e(z, L, 1)) : l ? (e(S, L, 0), e(m, L, 0), e(V, L, 0.5)) : (e(j, L, 1), e(z, L, 0), e(V, L, 0.5));
|
|
1106
|
+
}
|
|
1107
|
+
function w(l, b) {
|
|
1108
|
+
b && (l ? (e(P, U, 1), e(f, U, 0), e(S, g, 0), e(P, U, 1), e(S, g, 0), e(R, g, 1), e(S, U, 0), e(V, g, 0.5), e(R, g, 1), e(V, g, 0.5), e(m, U, 0), e(R, g, 1)) : (e(P, U, 1), e(f, U, 0), e(j, g, 1), e(f, U, 0), e(R, g, 0), e(j, g, 1), e(j, U, 1), e(R, g, 0), e(V, g, 0.5), e(V, g, 0.5), e(R, g, 0), e(z, U, 1)));
|
|
1109
|
+
}
|
|
1110
|
+
function C(l, b, L, D, s, n) {
|
|
1111
|
+
switch (A.strokeLineCap) {
|
|
1112
|
+
case "round":
|
|
1113
|
+
s ? c(l, L, b, n, 0.5) : c(l, b, L, n, 0.5);
|
|
1114
|
+
break;
|
|
1115
|
+
case "square":
|
|
1116
|
+
if (s)
|
|
1117
|
+
T.subVectors(b, l), H.set(T.y, -T.x), G.addVectors(T, H).add(l), E.subVectors(H, T).add(l), D ? (G.toArray(h, 1 * 3), E.toArray(h, 0 * 3), E.toArray(h, 3 * 3)) : (G.toArray(h, 1 * 3), x[3 * 2 + 1] === 1 ? E.toArray(h, 3 * 3) : G.toArray(h, 3 * 3), E.toArray(h, 0 * 3));
|
|
1118
|
+
else {
|
|
1119
|
+
T.subVectors(L, l), H.set(T.y, -T.x), G.addVectors(T, H).add(l), E.subVectors(H, T).add(l);
|
|
1120
|
+
const B = h.length;
|
|
1121
|
+
D ? (G.toArray(h, B - 1 * 3), E.toArray(h, B - 2 * 3), E.toArray(h, B - 4 * 3)) : (E.toArray(h, B - 2 * 3), G.toArray(h, B - 1 * 3), E.toArray(h, B - 4 * 3));
|
|
1122
|
+
}
|
|
1123
|
+
break;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
function O(l) {
|
|
1127
|
+
let b = !1;
|
|
1128
|
+
for (let D = 1, s = l.length - 1; D < s; D++)
|
|
1129
|
+
if (l[D].distanceTo(l[D + 1]) < I) {
|
|
1130
|
+
b = !0;
|
|
1131
|
+
break;
|
|
1132
|
+
}
|
|
1133
|
+
if (!b) return l;
|
|
1134
|
+
const L = [];
|
|
1135
|
+
L.push(l[0]);
|
|
1136
|
+
for (let D = 1, s = l.length - 1; D < s; D++)
|
|
1137
|
+
l[D].distanceTo(l[D + 1]) >= I && L.push(l[D]);
|
|
1138
|
+
return L.push(l[l.length - 1]), L;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
const kt = -2;
|
|
1143
|
+
function At(u) {
|
|
1144
|
+
if (!u || u.nodeType !== 1) return;
|
|
1145
|
+
let a = u;
|
|
1146
|
+
for (; a; ) {
|
|
1147
|
+
const A = a.getAttribute("id");
|
|
1148
|
+
if (A) return A;
|
|
1149
|
+
a = a.parentElement;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
function Ce(u) {
|
|
1153
|
+
if (!u) return !1;
|
|
1154
|
+
let a = u;
|
|
1155
|
+
for (; a; ) {
|
|
1156
|
+
const A = a.getAttribute("id") ?? "", M = a.getAttribute("data-name") ?? "";
|
|
1157
|
+
if (Oe(A) || Oe(M) || ve(A) || ve(M)) return !0;
|
|
1158
|
+
a = a.parentElement;
|
|
1159
|
+
}
|
|
1160
|
+
return !1;
|
|
1161
|
+
}
|
|
1162
|
+
function It(u, a) {
|
|
1163
|
+
return a ? a + encodeURIComponent(u) : u;
|
|
1164
|
+
}
|
|
1165
|
+
function wt({
|
|
1166
|
+
url: u,
|
|
1167
|
+
suppressIds: a,
|
|
1168
|
+
imageProxyUrl: A,
|
|
1169
|
+
is3d: M = !1
|
|
1170
|
+
}) {
|
|
1171
|
+
const [I, h] = ue(null);
|
|
1172
|
+
me(() => {
|
|
1173
|
+
let x = !1;
|
|
1174
|
+
const q = It(u, A);
|
|
1175
|
+
return fetch(q).then((T) => {
|
|
1176
|
+
if (!T.ok) throw new Error(`SVG fetch ${T.status}`);
|
|
1177
|
+
return T.text();
|
|
1178
|
+
}).then((T) => {
|
|
1179
|
+
if (x) return;
|
|
1180
|
+
const H = $e(T), G = new Ie();
|
|
1181
|
+
h(G.parse(H));
|
|
1182
|
+
}).catch((T) => {
|
|
1183
|
+
x || (h(null), console.warn(
|
|
1184
|
+
`[eyeon-map] Outdoor SVG failed to load from ${q}. If this is a cross-origin error, pass \`imageProxyUrl\` to MapViewer.`,
|
|
1185
|
+
T
|
|
1186
|
+
));
|
|
1187
|
+
}), () => {
|
|
1188
|
+
x = !0;
|
|
1189
|
+
};
|
|
1190
|
+
}, [u, A]);
|
|
1191
|
+
const v = ie(() => {
|
|
1192
|
+
var T, H, G;
|
|
1193
|
+
if (!I) return [];
|
|
1194
|
+
const x = [];
|
|
1195
|
+
let q = 0;
|
|
1196
|
+
for (const E of I.paths) {
|
|
1197
|
+
const W = (T = E.userData) == null ? void 0 : T.node, N = At(W);
|
|
1198
|
+
if (N != null && N.toLowerCase().startsWith("route-path") || N && (a != null && a.has(N)) || Ce(W) && !N || N && (Oe(N) || ve(N)) || W && Ce(W) && N && (a != null && a.has(N)) || W && Ce(W)) continue;
|
|
1199
|
+
const k = Ie.createShapes(E);
|
|
1200
|
+
if (k.length === 0) continue;
|
|
1201
|
+
const f = Ze(N), P = new fe.Color();
|
|
1202
|
+
f != null && f.fill ? P.set(f.fill) : E.color ? P.copy(E.color) : P.set("#cccccc"), f != null && f.stroke && !f.fill && P.set(f.stroke);
|
|
1203
|
+
const d = typeof ((G = (H = E.userData) == null ? void 0 : H.style) == null ? void 0 : G.opacity) == "number" ? E.userData.style.opacity : 1, p = M && (f == null ? void 0 : f.extrudeHeight) != null ? f.extrudeHeight : 0;
|
|
1204
|
+
x.push({
|
|
1205
|
+
key: `${N ?? "path"}-${q++}`,
|
|
1206
|
+
shapes: k,
|
|
1207
|
+
color: P,
|
|
1208
|
+
opacity: d,
|
|
1209
|
+
extrude: p,
|
|
1210
|
+
renderOrder: (f == null ? void 0 : f.renderOrder) ?? 2
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
return x;
|
|
1214
|
+
}, [I, a, M]);
|
|
1215
|
+
return !I || v.length === 0 ? null : /* @__PURE__ */ _("group", { position: [0, 0, kt], renderOrder: -20, children: v.map(
|
|
1216
|
+
(x) => x.shapes.map((q, T) => /* @__PURE__ */ ne("mesh", { renderOrder: x.renderOrder, children: [
|
|
1217
|
+
x.extrude > 0 ? /* @__PURE__ */ _(
|
|
1218
|
+
"extrudeGeometry",
|
|
1219
|
+
{
|
|
1220
|
+
args: [q, { depth: x.extrude, bevelEnabled: !1 }]
|
|
1221
|
+
}
|
|
1222
|
+
) : /* @__PURE__ */ _("shapeGeometry", { args: [q] }),
|
|
1223
|
+
/* @__PURE__ */ _(
|
|
1224
|
+
"meshBasicMaterial",
|
|
1225
|
+
{
|
|
1226
|
+
color: x.color,
|
|
1227
|
+
transparent: x.opacity < 1,
|
|
1228
|
+
opacity: x.opacity,
|
|
1229
|
+
depthWrite: !1,
|
|
1230
|
+
toneMapped: !1,
|
|
1231
|
+
side: fe.DoubleSide
|
|
1232
|
+
}
|
|
1233
|
+
)
|
|
1234
|
+
] }, `${x.key}-${T}`))
|
|
1235
|
+
) });
|
|
1236
|
+
}
|
|
1237
|
+
const Mt = [1, -1, 1];
|
|
1238
|
+
function Tt(u) {
|
|
1239
|
+
return {
|
|
1240
|
+
...u,
|
|
1241
|
+
minY: -u.maxY,
|
|
1242
|
+
maxY: -u.minY,
|
|
1243
|
+
cy: -u.cy
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
function Be(u, a, A, M) {
|
|
1247
|
+
const I = Math.max(u, 1) / Math.max(A, 1), h = Math.max(a, 1) / Math.max(M, 1);
|
|
1248
|
+
return Math.min(I, h);
|
|
1249
|
+
}
|
|
1250
|
+
function Ve(u) {
|
|
1251
|
+
return {
|
|
1252
|
+
width: Math.max(u.maxX - u.minX, 1),
|
|
1253
|
+
height: Math.max(u.maxY - u.minY, 1)
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
function Nt(u, a, A, M, I) {
|
|
1257
|
+
const h = 1 + Math.min(Math.max(A, 0.15), 1) * 0.5, v = a > 0 ? u * h : u / h;
|
|
1258
|
+
return Math.min(I, Math.max(M, v));
|
|
1259
|
+
}
|
|
1260
|
+
const Et = 0, je = 1, Se = 2, Ct = 0, St = 1, ze = 2;
|
|
1261
|
+
function Ot(u) {
|
|
1262
|
+
return u ? { LEFT: Et, MIDDLE: je, RIGHT: Se } : { LEFT: Se, MIDDLE: je, RIGHT: Se };
|
|
1263
|
+
}
|
|
1264
|
+
function vt(u) {
|
|
1265
|
+
return u ? { ONE: Ct, TWO: ze } : { ONE: St, TWO: ze };
|
|
1266
|
+
}
|
|
1267
|
+
function Pt({
|
|
1268
|
+
bounds: u,
|
|
1269
|
+
theme: a,
|
|
1270
|
+
is3d: A,
|
|
1271
|
+
controlsRef: M,
|
|
1272
|
+
cameraRef: I
|
|
1273
|
+
}) {
|
|
1274
|
+
const { camera: h, size: v, invalidate: x } = rt(), q = Ae(!1), T = _e(() => {
|
|
1275
|
+
const G = M.current, { width: E, height: W } = Ve(u);
|
|
1276
|
+
if (h.up.set(0, 1, 0), h instanceof fe.OrthographicCamera && !A) {
|
|
1277
|
+
const N = Be(v.width, v.height, E, W);
|
|
1278
|
+
h.position.set(u.cx, u.cy, 500), h.zoom = N, h.updateProjectionMatrix();
|
|
1279
|
+
} else
|
|
1280
|
+
h.position.set(u.cx, u.cy - u.size * 0.35, u.size * 0.85), h.lookAt(u.cx, u.cy, 0);
|
|
1281
|
+
G && (G.target.set(u.cx, u.cy, 0), G.update()), x();
|
|
1282
|
+
}, [
|
|
1283
|
+
u,
|
|
1284
|
+
h,
|
|
1285
|
+
M,
|
|
1286
|
+
x,
|
|
1287
|
+
A,
|
|
1288
|
+
v.height,
|
|
1289
|
+
v.width
|
|
1290
|
+
]), H = _e(
|
|
1291
|
+
(G) => {
|
|
1292
|
+
q.current = !0;
|
|
1293
|
+
const E = M.current;
|
|
1294
|
+
if (h instanceof fe.OrthographicCamera && !A) {
|
|
1295
|
+
const { width: W, height: N } = Ve(u), k = Be(v.width, v.height, W, N);
|
|
1296
|
+
h.zoom = Nt(
|
|
1297
|
+
h.zoom,
|
|
1298
|
+
G,
|
|
1299
|
+
a.ZOOM_STEP,
|
|
1300
|
+
k * 0.2,
|
|
1301
|
+
k * 10
|
|
1302
|
+
), h.updateProjectionMatrix();
|
|
1303
|
+
} else if (E) {
|
|
1304
|
+
const W = h.position.clone().sub(E.target), N = 1 + Math.min(Math.max(a.ZOOM_STEP, 0.15), 1) * 0.5, k = G > 0 ? W.length() / N : W.length() * N;
|
|
1305
|
+
W.setLength(
|
|
1306
|
+
Math.min(a.CAMERA_MAX_DISTANCE, Math.max(a.CAMERA_MIN_DISTANCE, k))
|
|
1307
|
+
), h.position.copy(E.target).add(W);
|
|
1308
|
+
}
|
|
1309
|
+
E == null || E.update(), x();
|
|
1310
|
+
},
|
|
1311
|
+
[u, h, M, x, A, v.height, v.width, a]
|
|
1312
|
+
);
|
|
1313
|
+
return qe(
|
|
1314
|
+
I,
|
|
1315
|
+
() => ({
|
|
1316
|
+
zoomIn: () => H(1),
|
|
1317
|
+
zoomOut: () => H(-1),
|
|
1318
|
+
reset: () => {
|
|
1319
|
+
q.current = !1, T();
|
|
1320
|
+
}
|
|
1321
|
+
}),
|
|
1322
|
+
[T, H]
|
|
1323
|
+
), me(() => {
|
|
1324
|
+
v.width < 2 || v.height < 2 || (q.current = !1, T());
|
|
1325
|
+
}, [T, u.cx, u.cy, u.maxX, u.maxY, u.minX, u.minY]), me(() => {
|
|
1326
|
+
v.width < 2 || v.height < 2 || q.current || T();
|
|
1327
|
+
}, [T, v.height, v.width]), null;
|
|
1328
|
+
}
|
|
1329
|
+
const Rt = -1;
|
|
1330
|
+
function Lt({
|
|
1331
|
+
doc: u,
|
|
1332
|
+
theme: a,
|
|
1333
|
+
activeLevelId: A,
|
|
1334
|
+
route: M,
|
|
1335
|
+
selectedRetailerId: I,
|
|
1336
|
+
cameraRef: h,
|
|
1337
|
+
onSelectShape: v,
|
|
1338
|
+
imageProxyUrl: x,
|
|
1339
|
+
eventSource: q
|
|
118
1340
|
}) {
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
1341
|
+
const T = a.MAP_STYLE === "3D", H = Ae(null), G = ie(
|
|
1342
|
+
() => Qe(u.levels, A),
|
|
1343
|
+
[u.levels, A]
|
|
1344
|
+
), E = ie(
|
|
1345
|
+
() => Ke(u.levels, A, u.baseViewbox),
|
|
1346
|
+
[u.levels, u.baseViewbox, A]
|
|
1347
|
+
), W = ie(() => Tt(E), [E]), N = ie(
|
|
1348
|
+
() => u.levels.find((d) => Me(d)) ?? null,
|
|
1349
|
+
[u.levels]
|
|
1350
|
+
), k = (N == null ? void 0 : N.sourceSvgUrl) ?? u.baseSvgUrl ?? null, f = ie(() => {
|
|
1351
|
+
const d = /* @__PURE__ */ new Set();
|
|
1352
|
+
if (!N) return d;
|
|
1353
|
+
for (const p of N.shapes)
|
|
1354
|
+
p.sourceSvgId && d.add(p.sourceSvgId);
|
|
1355
|
+
return d;
|
|
1356
|
+
}, [N]), P = G.some((d) => Me(d));
|
|
1357
|
+
return /* @__PURE__ */ ne(
|
|
1358
|
+
st,
|
|
133
1359
|
{
|
|
134
|
-
style: { width: "100%", height: "100%", background:
|
|
135
|
-
|
|
136
|
-
|
|
1360
|
+
style: { width: "100%", height: "100%", background: a.MAP_BACKGROUND_COLOR },
|
|
1361
|
+
eventSource: q ?? void 0,
|
|
1362
|
+
eventPrefix: "offset",
|
|
1363
|
+
orthographic: !T,
|
|
1364
|
+
dpr: [1, 2],
|
|
1365
|
+
flat: !0,
|
|
1366
|
+
gl: { antialias: !0 },
|
|
1367
|
+
camera: T ? {
|
|
1368
|
+
position: [W.cx, W.cy - W.size * 0.35, W.size * 0.85],
|
|
1369
|
+
fov: 50,
|
|
1370
|
+
near: 1,
|
|
1371
|
+
far: 1e4,
|
|
1372
|
+
up: [0, 1, 0]
|
|
1373
|
+
} : void 0,
|
|
137
1374
|
children: [
|
|
138
|
-
!
|
|
139
|
-
|
|
1375
|
+
!T && /* @__PURE__ */ _(
|
|
1376
|
+
it,
|
|
140
1377
|
{
|
|
141
1378
|
makeDefault: !0,
|
|
142
|
-
position: [
|
|
143
|
-
|
|
1379
|
+
position: [W.cx, W.cy, 500],
|
|
1380
|
+
up: [0, 1, 0],
|
|
144
1381
|
near: 0.1,
|
|
145
1382
|
far: 5e3
|
|
146
1383
|
}
|
|
147
1384
|
),
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
1385
|
+
/* @__PURE__ */ _("color", { attach: "background", args: [a.MAP_BACKGROUND_COLOR] }),
|
|
1386
|
+
/* @__PURE__ */ _("ambientLight", { intensity: 4, color: "#c4c4c4" }),
|
|
1387
|
+
/* @__PURE__ */ _("directionalLight", { position: [0, 400, 0], color: "#ffffff", intensity: 0.3 }),
|
|
1388
|
+
/* @__PURE__ */ _("directionalLight", { position: [0, 0, 400], color: "#c4c4c4", intensity: 0.2 }),
|
|
1389
|
+
/* @__PURE__ */ _("directionalLight", { position: [0, 0, -400], color: "#c4c4c4", intensity: 0.2 }),
|
|
1390
|
+
/* @__PURE__ */ ne("group", { scale: Mt, children: [
|
|
1391
|
+
P && k ? /* @__PURE__ */ _(
|
|
1392
|
+
wt,
|
|
1393
|
+
{
|
|
1394
|
+
url: k,
|
|
1395
|
+
suppressIds: f,
|
|
1396
|
+
imageProxyUrl: x,
|
|
1397
|
+
is3d: T
|
|
1398
|
+
}
|
|
1399
|
+
) : null,
|
|
1400
|
+
G.map((d) => {
|
|
1401
|
+
const p = Me(d), S = d.transform;
|
|
1402
|
+
return /* @__PURE__ */ _(
|
|
1403
|
+
"group",
|
|
1404
|
+
{
|
|
1405
|
+
position: [
|
|
1406
|
+
S.translateX,
|
|
1407
|
+
S.translateY,
|
|
1408
|
+
p ? Rt : 0
|
|
1409
|
+
],
|
|
1410
|
+
rotation: [0, 0, S.rotate * Math.PI / 180],
|
|
1411
|
+
scale: S.scale || 1,
|
|
1412
|
+
children: /* @__PURE__ */ _(
|
|
1413
|
+
gt,
|
|
1414
|
+
{
|
|
1415
|
+
level: d,
|
|
1416
|
+
theme: a,
|
|
1417
|
+
is3d: T,
|
|
1418
|
+
selectedRetailerId: I,
|
|
1419
|
+
interactiveOnly: p && !!k,
|
|
1420
|
+
onSelectShape: (j) => v == null ? void 0 : v(j, d.id)
|
|
1421
|
+
}
|
|
1422
|
+
)
|
|
1423
|
+
},
|
|
1424
|
+
d.id
|
|
1425
|
+
);
|
|
1426
|
+
}),
|
|
1427
|
+
M && /* @__PURE__ */ _(
|
|
1428
|
+
bt,
|
|
1429
|
+
{
|
|
1430
|
+
route: M,
|
|
1431
|
+
activeLevelId: A,
|
|
1432
|
+
color: a.ACCENT_COLOR
|
|
1433
|
+
}
|
|
1434
|
+
)
|
|
1435
|
+
] }),
|
|
1436
|
+
/* @__PURE__ */ _(
|
|
1437
|
+
at,
|
|
164
1438
|
{
|
|
165
|
-
|
|
1439
|
+
ref: H,
|
|
1440
|
+
makeDefault: !0,
|
|
1441
|
+
enableDamping: !1,
|
|
1442
|
+
enableRotate: T,
|
|
166
1443
|
enablePan: !0,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
1444
|
+
screenSpacePanning: !0,
|
|
1445
|
+
mouseButtons: Ot(T),
|
|
1446
|
+
touches: vt(T),
|
|
1447
|
+
target: [W.cx, W.cy, 0],
|
|
1448
|
+
maxDistance: a.CAMERA_MAX_DISTANCE,
|
|
1449
|
+
minDistance: a.CAMERA_MIN_DISTANCE
|
|
1450
|
+
}
|
|
1451
|
+
),
|
|
1452
|
+
/* @__PURE__ */ _(
|
|
1453
|
+
Pt,
|
|
1454
|
+
{
|
|
1455
|
+
bounds: W,
|
|
1456
|
+
theme: a,
|
|
1457
|
+
is3d: T,
|
|
1458
|
+
controlsRef: H,
|
|
1459
|
+
cameraRef: h
|
|
170
1460
|
}
|
|
171
1461
|
)
|
|
172
1462
|
]
|
|
173
1463
|
}
|
|
174
1464
|
);
|
|
175
1465
|
}
|
|
176
|
-
function
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
1466
|
+
function Fe(u, a) {
|
|
1467
|
+
var A, M;
|
|
1468
|
+
return ((A = u.assignment) == null ? void 0 : A.customLabel) || a || u.label.text || ((M = u.assignment) == null ? void 0 : M.unitNumber) || u.key;
|
|
1469
|
+
}
|
|
1470
|
+
function _t({
|
|
1471
|
+
doc: u,
|
|
1472
|
+
amenities: a,
|
|
1473
|
+
onActiveLevelChange: A,
|
|
1474
|
+
fromAnchorId: M,
|
|
1475
|
+
toAnchorId: I,
|
|
1476
|
+
onFromChange: h,
|
|
1477
|
+
onToChange: v,
|
|
1478
|
+
accessibleOnly: x,
|
|
1479
|
+
onAccessibleOnlyChange: q,
|
|
1480
|
+
route: T,
|
|
1481
|
+
showSearch: H = !0,
|
|
1482
|
+
showAmenities: G = !0
|
|
190
1483
|
}) {
|
|
191
|
-
const [
|
|
192
|
-
var
|
|
193
|
-
const
|
|
194
|
-
for (const
|
|
195
|
-
for (const
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
198
|
-
id: `store-${
|
|
199
|
-
label:
|
|
200
|
-
group:
|
|
201
|
-
anchorId: (
|
|
202
|
-
levelId:
|
|
203
|
-
kind: "store"
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
1484
|
+
const [E, W] = ue(""), [N, k] = ue(null), f = ie(() => {
|
|
1485
|
+
var z;
|
|
1486
|
+
const m = [];
|
|
1487
|
+
for (const R of u.levels)
|
|
1488
|
+
for (const F of R.shapes) {
|
|
1489
|
+
const X = R.anchors.find((Z) => Z.shapeId === F.id) ?? null;
|
|
1490
|
+
if (F.kind === "unit" && m.push({
|
|
1491
|
+
id: `store-${F.id}`,
|
|
1492
|
+
label: Fe(F),
|
|
1493
|
+
group: R.name,
|
|
1494
|
+
anchorId: (X == null ? void 0 : X.id) ?? null,
|
|
1495
|
+
levelId: R.id,
|
|
1496
|
+
kind: "store",
|
|
1497
|
+
amenityId: null
|
|
1498
|
+
}), F.kind === "amenity" && ((z = F.assignment) != null && z.amenityId)) {
|
|
1499
|
+
const Z = a.find((V) => V.id === F.assignment.amenityId);
|
|
1500
|
+
m.push({
|
|
1501
|
+
id: `amenity-${F.id}`,
|
|
1502
|
+
label: Fe(F, Z == null ? void 0 : Z.name),
|
|
209
1503
|
group: "Amenities",
|
|
210
|
-
anchorId: (
|
|
211
|
-
levelId:
|
|
212
|
-
kind: "amenity"
|
|
1504
|
+
anchorId: (X == null ? void 0 : X.id) ?? null,
|
|
1505
|
+
levelId: R.id,
|
|
1506
|
+
kind: "amenity",
|
|
1507
|
+
amenityId: (Z == null ? void 0 : Z.id) ?? F.assignment.amenityId
|
|
213
1508
|
});
|
|
214
1509
|
}
|
|
215
1510
|
}
|
|
216
|
-
return
|
|
217
|
-
}, [
|
|
218
|
-
const
|
|
219
|
-
return
|
|
220
|
-
}, [
|
|
221
|
-
const
|
|
222
|
-
for (const
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
return Array.from(
|
|
227
|
-
}, [
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
1511
|
+
return m;
|
|
1512
|
+
}, [u, a]), P = ie(() => {
|
|
1513
|
+
const m = E.trim().toLowerCase();
|
|
1514
|
+
return m ? f.filter((z) => z.label.toLowerCase().includes(m)) : f;
|
|
1515
|
+
}, [f, E]), d = ie(() => {
|
|
1516
|
+
const m = /* @__PURE__ */ new Map();
|
|
1517
|
+
for (const z of P) {
|
|
1518
|
+
const R = m.get(z.group) ?? [];
|
|
1519
|
+
R.push(z), m.set(z.group, R);
|
|
1520
|
+
}
|
|
1521
|
+
return Array.from(m.entries());
|
|
1522
|
+
}, [P]), p = f.filter((m) => m.anchorId != null), S = E.trim().length > 0, j = (m) => {
|
|
1523
|
+
k(m), m.anchorId != null && (v(m.anchorId), A(m.levelId));
|
|
1524
|
+
};
|
|
1525
|
+
return !H && !(G && a.length > 0) ? null : /* @__PURE__ */ ne("div", { className: "eyeon-map-chrome", children: [
|
|
1526
|
+
/* @__PURE__ */ ne("div", { className: "eyeon-map-chrome__top", children: [
|
|
1527
|
+
H && /* @__PURE__ */ _(
|
|
1528
|
+
"input",
|
|
232
1529
|
{
|
|
233
|
-
type: "
|
|
234
|
-
className: "eyeon-map-chrome__search-
|
|
235
|
-
|
|
236
|
-
"aria-
|
|
237
|
-
|
|
1530
|
+
type: "search",
|
|
1531
|
+
className: "eyeon-map-chrome__search-input",
|
|
1532
|
+
placeholder: "Search...",
|
|
1533
|
+
"aria-label": "Search...",
|
|
1534
|
+
value: E,
|
|
1535
|
+
onChange: (m) => W(m.target.value)
|
|
238
1536
|
}
|
|
239
1537
|
),
|
|
240
|
-
/* @__PURE__ */
|
|
1538
|
+
G && a.length > 0 && /* @__PURE__ */ _("div", { className: "eyeon-map-chrome__amenities", children: a.map((m) => /* @__PURE__ */ _(
|
|
241
1539
|
"button",
|
|
242
1540
|
{
|
|
243
1541
|
type: "button",
|
|
244
1542
|
className: "eyeon-map-chrome__amenity",
|
|
245
|
-
|
|
1543
|
+
"aria-label": m.name,
|
|
246
1544
|
onClick: () => {
|
|
247
|
-
const
|
|
248
|
-
(
|
|
1545
|
+
const z = f.find(
|
|
1546
|
+
(R) => R.kind === "amenity" && R.amenityId === m.id && R.anchorId != null
|
|
249
1547
|
);
|
|
250
|
-
|
|
1548
|
+
z && j(z);
|
|
251
1549
|
},
|
|
252
|
-
children:
|
|
1550
|
+
children: m.builtinIcon ? /* @__PURE__ */ _("span", { className: "eyeon-map-chrome__amenity-icon", children: m.builtinIcon }) : /* @__PURE__ */ _("span", { className: "eyeon-map-chrome__amenity-label", children: m.name.slice(0, 2) })
|
|
253
1551
|
},
|
|
254
|
-
|
|
1552
|
+
m.id
|
|
255
1553
|
)) })
|
|
256
1554
|
] }),
|
|
257
|
-
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
"
|
|
260
|
-
|
|
261
|
-
className: "eyeon-map-chrome__search-input",
|
|
262
|
-
placeholder: "Search stores & amenities",
|
|
263
|
-
value: b,
|
|
264
|
-
onChange: (e) => x(e.target.value),
|
|
265
|
-
autoFocus: !0
|
|
266
|
-
}
|
|
267
|
-
),
|
|
268
|
-
/* @__PURE__ */ t("div", { className: "eyeon-map-chrome__groups", children: $.map(([e, f]) => /* @__PURE__ */ g("div", { className: "eyeon-map-chrome__group", children: [
|
|
269
|
-
/* @__PURE__ */ t("div", { className: "eyeon-map-chrome__group-title", children: e }),
|
|
270
|
-
f.map((d) => /* @__PURE__ */ t(
|
|
1555
|
+
H && S && /* @__PURE__ */ ne("div", { className: "eyeon-map-chrome__panel", children: [
|
|
1556
|
+
/* @__PURE__ */ _("div", { className: "eyeon-map-chrome__groups", children: d.length === 0 ? /* @__PURE__ */ _("div", { className: "eyeon-map-chrome__empty", children: "No matching stores" }) : d.map(([m, z]) => /* @__PURE__ */ ne("div", { className: "eyeon-map-chrome__group", children: [
|
|
1557
|
+
/* @__PURE__ */ _("div", { className: "eyeon-map-chrome__group-title", children: m }),
|
|
1558
|
+
z.map((R) => /* @__PURE__ */ _(
|
|
271
1559
|
"button",
|
|
272
1560
|
{
|
|
273
1561
|
type: "button",
|
|
274
|
-
className: "eyeon-map-chrome__item",
|
|
275
|
-
onClick: () =>
|
|
276
|
-
|
|
277
|
-
},
|
|
278
|
-
children: d.label
|
|
1562
|
+
className: (N == null ? void 0 : N.id) === R.id ? "eyeon-map-chrome__item is-selected" : "eyeon-map-chrome__item",
|
|
1563
|
+
onClick: () => j(R),
|
|
1564
|
+
children: R.label
|
|
279
1565
|
},
|
|
280
|
-
|
|
1566
|
+
R.id
|
|
281
1567
|
))
|
|
282
|
-
] },
|
|
283
|
-
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */
|
|
1568
|
+
] }, m)) }),
|
|
1569
|
+
N && /* @__PURE__ */ ne("div", { className: "eyeon-map-chrome__detail", children: [
|
|
1570
|
+
/* @__PURE__ */ _("div", { className: "eyeon-map-chrome__detail-title", children: N.label }),
|
|
1571
|
+
/* @__PURE__ */ _("div", { className: "eyeon-map-chrome__detail-meta", children: N.group })
|
|
286
1572
|
] }),
|
|
287
|
-
/* @__PURE__ */
|
|
288
|
-
/* @__PURE__ */
|
|
1573
|
+
/* @__PURE__ */ ne("div", { className: "eyeon-map-chrome__route", children: [
|
|
1574
|
+
/* @__PURE__ */ ne("label", { children: [
|
|
289
1575
|
"From",
|
|
290
|
-
/* @__PURE__ */
|
|
1576
|
+
/* @__PURE__ */ ne(
|
|
291
1577
|
"select",
|
|
292
1578
|
{
|
|
293
|
-
value:
|
|
294
|
-
onChange: (
|
|
1579
|
+
value: M ?? "",
|
|
1580
|
+
onChange: (m) => h(m.target.value ? Number(m.target.value) : null),
|
|
295
1581
|
children: [
|
|
296
|
-
/* @__PURE__ */
|
|
297
|
-
|
|
1582
|
+
/* @__PURE__ */ _("option", { value: "", children: "Select start" }),
|
|
1583
|
+
p.map((m) => /* @__PURE__ */ _("option", { value: m.anchorId, children: m.label }, m.id))
|
|
298
1584
|
]
|
|
299
1585
|
}
|
|
300
1586
|
)
|
|
301
1587
|
] }),
|
|
302
|
-
/* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ ne("label", { children: [
|
|
303
1589
|
"To",
|
|
304
|
-
/* @__PURE__ */
|
|
1590
|
+
/* @__PURE__ */ ne(
|
|
305
1591
|
"select",
|
|
306
1592
|
{
|
|
307
|
-
value:
|
|
308
|
-
onChange: (
|
|
1593
|
+
value: I ?? "",
|
|
1594
|
+
onChange: (m) => v(m.target.value ? Number(m.target.value) : null),
|
|
309
1595
|
children: [
|
|
310
|
-
/* @__PURE__ */
|
|
311
|
-
|
|
1596
|
+
/* @__PURE__ */ _("option", { value: "", children: "Select destination" }),
|
|
1597
|
+
p.map((m) => /* @__PURE__ */ _("option", { value: m.anchorId, children: m.label }, m.id))
|
|
312
1598
|
]
|
|
313
1599
|
}
|
|
314
1600
|
)
|
|
315
1601
|
] }),
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ ne("label", { className: "eyeon-map-chrome__accessible", children: [
|
|
1603
|
+
/* @__PURE__ */ _(
|
|
318
1604
|
"input",
|
|
319
1605
|
{
|
|
320
1606
|
type: "checkbox",
|
|
321
|
-
checked:
|
|
322
|
-
onChange: (
|
|
1607
|
+
checked: x,
|
|
1608
|
+
onChange: (m) => q(m.target.checked)
|
|
323
1609
|
}
|
|
324
1610
|
),
|
|
325
1611
|
"Accessible route"
|
|
326
1612
|
] }),
|
|
327
|
-
|
|
1613
|
+
T && /* @__PURE__ */ _("div", { className: "eyeon-map-chrome__route-meta", children: T.levelChanges.length > 0 ? `${T.levelChanges.length} level change(s)` : "Same level" })
|
|
328
1614
|
] })
|
|
329
|
-
] })
|
|
330
|
-
/* @__PURE__ */ t("div", { className: "eyeon-map-chrome__floors", children: l.levels.filter((e) => e.kind === "floor").map((e) => /* @__PURE__ */ t(
|
|
331
|
-
"button",
|
|
332
|
-
{
|
|
333
|
-
type: "button",
|
|
334
|
-
className: e.id === k ? "eyeon-map-chrome__floor is-active" : "eyeon-map-chrome__floor",
|
|
335
|
-
onClick: () => y(e.id),
|
|
336
|
-
children: e.name
|
|
337
|
-
},
|
|
338
|
-
e.id
|
|
339
|
-
)) })
|
|
1615
|
+
] })
|
|
340
1616
|
] });
|
|
341
1617
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
1618
|
+
function Gt({
|
|
1619
|
+
levels: u,
|
|
1620
|
+
activeLevelId: a,
|
|
1621
|
+
onActiveLevelChange: A,
|
|
1622
|
+
onZoomIn: M,
|
|
1623
|
+
onZoomOut: I,
|
|
1624
|
+
onReset: h,
|
|
1625
|
+
showFloors: v = !0,
|
|
1626
|
+
showZoomReset: x = !0
|
|
1627
|
+
}) {
|
|
1628
|
+
const q = Je(u);
|
|
1629
|
+
return !v && !x ? null : /* @__PURE__ */ _("div", { className: "eyeon-map-controls", children: /* @__PURE__ */ ne("div", { className: "eyeon-map-controls__stack", children: [
|
|
1630
|
+
v && et(u) && /* @__PURE__ */ _("div", { className: "eyeon-map-controls__floors", role: "tablist", "aria-label": "Floors", children: q.map((T) => {
|
|
1631
|
+
const H = T.id === a;
|
|
1632
|
+
return /* @__PURE__ */ _(
|
|
1633
|
+
"button",
|
|
1634
|
+
{
|
|
1635
|
+
type: "button",
|
|
1636
|
+
role: "tab",
|
|
1637
|
+
"aria-selected": H,
|
|
1638
|
+
className: H ? "eyeon-map-controls__floor is-active" : "eyeon-map-controls__floor",
|
|
1639
|
+
onClick: () => A(T.id),
|
|
1640
|
+
children: T.name
|
|
1641
|
+
},
|
|
1642
|
+
T.id
|
|
1643
|
+
);
|
|
1644
|
+
}) }),
|
|
1645
|
+
x && /* @__PURE__ */ ne(We, { children: [
|
|
1646
|
+
/* @__PURE__ */ _(
|
|
1647
|
+
"button",
|
|
1648
|
+
{
|
|
1649
|
+
type: "button",
|
|
1650
|
+
className: "eyeon-map-controls__reset",
|
|
1651
|
+
onClick: h,
|
|
1652
|
+
"aria-label": "Reset map",
|
|
1653
|
+
children: "Reset"
|
|
1654
|
+
}
|
|
1655
|
+
),
|
|
1656
|
+
/* @__PURE__ */ ne("div", { className: "eyeon-map-controls__zoom", children: [
|
|
1657
|
+
/* @__PURE__ */ _(
|
|
1658
|
+
"button",
|
|
1659
|
+
{
|
|
1660
|
+
type: "button",
|
|
1661
|
+
className: "eyeon-map-controls__zoom-btn",
|
|
1662
|
+
onClick: I,
|
|
1663
|
+
"aria-label": "Zoom out",
|
|
1664
|
+
children: "−"
|
|
1665
|
+
}
|
|
1666
|
+
),
|
|
1667
|
+
/* @__PURE__ */ _(
|
|
1668
|
+
"button",
|
|
1669
|
+
{
|
|
1670
|
+
type: "button",
|
|
1671
|
+
className: "eyeon-map-controls__zoom-btn",
|
|
1672
|
+
onClick: M,
|
|
1673
|
+
"aria-label": "Zoom in",
|
|
1674
|
+
children: "+"
|
|
1675
|
+
}
|
|
1676
|
+
)
|
|
1677
|
+
] })
|
|
1678
|
+
] })
|
|
1679
|
+
] }) });
|
|
1680
|
+
}
|
|
1681
|
+
async function Dt(u, a, A) {
|
|
1682
|
+
const M = u.replace(/\/$/, ""), I = new URLSearchParams();
|
|
1683
|
+
a != null && a > 0 && I.set("center_id", String(a)), A && I.set("draft", "1");
|
|
1684
|
+
const h = I.toString(), v = await fetch(`${M}/v1/map/document${h ? `?${h}` : ""}`, {
|
|
1685
|
+
credentials: "include"
|
|
1686
|
+
});
|
|
1687
|
+
if (!v.ok)
|
|
1688
|
+
throw new Error(`Failed to load map document (${v.status})`);
|
|
1689
|
+
return v.json();
|
|
347
1690
|
}
|
|
348
|
-
function
|
|
1691
|
+
function Ut(u) {
|
|
349
1692
|
const {
|
|
350
|
-
document:
|
|
351
|
-
webApiURI:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
1693
|
+
document: a,
|
|
1694
|
+
webApiURI: A,
|
|
1695
|
+
centerId: M,
|
|
1696
|
+
host: I = "WEBSITE",
|
|
1697
|
+
kioskId: h = null,
|
|
1698
|
+
selectedRetailerId: v = null,
|
|
1699
|
+
themeOverrides: x,
|
|
1700
|
+
onExtractedAmenities: q,
|
|
1701
|
+
createRouteRef: T,
|
|
1702
|
+
className: H,
|
|
1703
|
+
style: G,
|
|
1704
|
+
activeLevelId: E,
|
|
1705
|
+
onActiveLevelChange: W,
|
|
1706
|
+
routeOnSelect: N = !0,
|
|
1707
|
+
imageProxyUrl: k
|
|
1708
|
+
} = u, [f, P] = ue(a ?? null), d = ie(
|
|
1709
|
+
() => f ? Ge(f) : null,
|
|
1710
|
+
[f]
|
|
1711
|
+
), [p, S] = ue(null), [j, m] = ue(null), [z, R] = ue(null), [F, X] = ue(null), [Z, V] = ue(!1), [K, $] = ue(() => a ? De(Ge(a).levels) : null), oe = Ae(null), J = Ae(null), U = E ?? K, g = (r) => {
|
|
1712
|
+
$(r), r != null && (W == null || W(r));
|
|
1713
|
+
};
|
|
1714
|
+
me(() => {
|
|
1715
|
+
if (a) {
|
|
1716
|
+
P(a);
|
|
364
1717
|
return;
|
|
365
1718
|
}
|
|
366
|
-
if (!
|
|
1719
|
+
if (!A) return;
|
|
367
1720
|
let r = !1;
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
1721
|
+
const o = Te(I).fetchDraft;
|
|
1722
|
+
return Dt(A, M, o).then((t) => {
|
|
1723
|
+
r || P(t);
|
|
1724
|
+
}).catch((t) => {
|
|
1725
|
+
r || S(t instanceof Error ? t.message : String(t));
|
|
372
1726
|
}), () => {
|
|
373
1727
|
r = !0;
|
|
374
1728
|
};
|
|
375
|
-
}, [
|
|
376
|
-
var
|
|
377
|
-
if (!
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
1729
|
+
}, [a, A, M, I]), me(() => {
|
|
1730
|
+
var t;
|
|
1731
|
+
if (!d) return;
|
|
1732
|
+
const r = new Set(d.levels.map((e) => e.id));
|
|
1733
|
+
(U == null || !r.has(U)) && g(De(d.levels));
|
|
1734
|
+
const o = /* @__PURE__ */ new Set();
|
|
1735
|
+
for (const e of d.levels)
|
|
1736
|
+
for (const c of e.shapes)
|
|
1737
|
+
if (c.kind === "amenity" && ((t = c.assignment) == null ? void 0 : t.amenityId) != null) {
|
|
1738
|
+
const y = d.amenities.find((i) => i.id === c.assignment.amenityId);
|
|
1739
|
+
y && o.add(y.code);
|
|
385
1740
|
}
|
|
386
|
-
|
|
387
|
-
}, [
|
|
1741
|
+
q == null || q(Array.from(o));
|
|
1742
|
+
}, [d, U, q]), me(() => {
|
|
1743
|
+
var r;
|
|
1744
|
+
if (!(!d || v == null)) {
|
|
1745
|
+
for (const o of d.levels)
|
|
1746
|
+
for (const t of o.shapes)
|
|
1747
|
+
if (((r = t.assignment) == null ? void 0 : r.retailerId) === v) {
|
|
1748
|
+
g(o.id);
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
}, [d, v]), me(() => {
|
|
388
1753
|
var r;
|
|
389
|
-
if (!(!
|
|
390
|
-
for (const
|
|
391
|
-
for (const
|
|
392
|
-
if (
|
|
393
|
-
const
|
|
394
|
-
|
|
1754
|
+
if (!(!d || !Te(I).kioskOrigin || h == null)) {
|
|
1755
|
+
for (const o of d.levels)
|
|
1756
|
+
for (const t of o.shapes)
|
|
1757
|
+
if (t.kind === "kiosk_screen" && ((r = t.assignment) == null ? void 0 : r.kioskId) === h) {
|
|
1758
|
+
const e = o.anchors.find((c) => c.shapeId === t.id);
|
|
1759
|
+
e && R(e.id);
|
|
395
1760
|
}
|
|
396
1761
|
}
|
|
397
|
-
}, [
|
|
398
|
-
const
|
|
399
|
-
|
|
1762
|
+
}, [d, I, h]);
|
|
1763
|
+
const te = ie(() => d ? tt(
|
|
1764
|
+
d.graph.nodes.map((r) => ({
|
|
400
1765
|
id: r.id,
|
|
401
1766
|
levelId: r.levelId,
|
|
402
1767
|
shapeId: r.shapeId,
|
|
@@ -405,9 +1770,9 @@ function ce(l) {
|
|
|
405
1770
|
y: r.y,
|
|
406
1771
|
connectorId: r.connectorId
|
|
407
1772
|
})),
|
|
408
|
-
|
|
1773
|
+
d.graph.edges.map((r) => ({
|
|
409
1774
|
id: r.id,
|
|
410
|
-
mapId:
|
|
1775
|
+
mapId: d.mapId,
|
|
411
1776
|
fromAnchorId: r.from,
|
|
412
1777
|
toAnchorId: r.to,
|
|
413
1778
|
weight: r.weight,
|
|
@@ -415,106 +1780,129 @@ function ce(l) {
|
|
|
415
1780
|
accessible: r.accessible,
|
|
416
1781
|
kind: r.kind
|
|
417
1782
|
})),
|
|
418
|
-
|
|
419
|
-
) : null, [
|
|
420
|
-
if (!
|
|
421
|
-
|
|
1783
|
+
d.connectors
|
|
1784
|
+
) : null, [d]), ee = (r, o) => {
|
|
1785
|
+
if (!te || r == null || o == null) {
|
|
1786
|
+
m(null);
|
|
422
1787
|
return;
|
|
423
1788
|
}
|
|
424
|
-
const
|
|
425
|
-
|
|
1789
|
+
const t = ot(te, r, o, { accessibleOnly: Z });
|
|
1790
|
+
m(t);
|
|
426
1791
|
};
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}, [
|
|
430
|
-
!
|
|
1792
|
+
me(() => {
|
|
1793
|
+
ee(z, F);
|
|
1794
|
+
}, [z, F, Z, te]), me(() => {
|
|
1795
|
+
!T || !d || (T.current = {
|
|
431
1796
|
createRouteToStore(r) {
|
|
432
|
-
var
|
|
433
|
-
for (const
|
|
434
|
-
for (const
|
|
435
|
-
if (((
|
|
436
|
-
const
|
|
437
|
-
|
|
1797
|
+
var o;
|
|
1798
|
+
for (const t of d.levels)
|
|
1799
|
+
for (const e of t.shapes)
|
|
1800
|
+
if (((o = e.assignment) == null ? void 0 : o.retailerId) === r) {
|
|
1801
|
+
const c = t.anchors.find((y) => y.shapeId === e.id);
|
|
1802
|
+
c && (X(c.id), g(t.id));
|
|
438
1803
|
}
|
|
439
1804
|
},
|
|
440
1805
|
createRouteToAmenity(r) {
|
|
441
|
-
var
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
444
|
-
for (const
|
|
445
|
-
for (const
|
|
446
|
-
if (((
|
|
447
|
-
const
|
|
448
|
-
if (
|
|
449
|
-
|
|
1806
|
+
var t;
|
|
1807
|
+
const o = d.amenities.find((e) => e.code === r);
|
|
1808
|
+
if (o) {
|
|
1809
|
+
for (const e of d.levels)
|
|
1810
|
+
for (const c of e.shapes)
|
|
1811
|
+
if (((t = c.assignment) == null ? void 0 : t.amenityId) === o.id) {
|
|
1812
|
+
const y = e.anchors.find((i) => i.shapeId === c.id);
|
|
1813
|
+
if (y) {
|
|
1814
|
+
X(y.id), g(e.id);
|
|
450
1815
|
return;
|
|
451
1816
|
}
|
|
452
1817
|
}
|
|
453
1818
|
}
|
|
454
1819
|
},
|
|
455
1820
|
clearRoute() {
|
|
456
|
-
|
|
1821
|
+
X(null), m(null);
|
|
457
1822
|
}
|
|
458
1823
|
});
|
|
459
|
-
}, [
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
(r) => n.levels.some(
|
|
471
|
-
(c) => c.shapes.some((u) => {
|
|
472
|
-
var m;
|
|
473
|
-
return ((m = u.assignment) == null ? void 0 : m.amenityId) === r.id;
|
|
1824
|
+
}, [T, d]);
|
|
1825
|
+
const se = nt(d == null ? void 0 : d.theme, x);
|
|
1826
|
+
if (p)
|
|
1827
|
+
return /* @__PURE__ */ _("div", { className: `eyeon-map-viewer eyeon-map-viewer--error ${H ?? ""}`, style: G, children: /* @__PURE__ */ _("div", { className: "eyeon-map-viewer__error", children: p }) });
|
|
1828
|
+
if (!d)
|
|
1829
|
+
return /* @__PURE__ */ _("div", { className: `eyeon-map-viewer eyeon-map-viewer--loading ${H ?? ""}`, style: G, children: /* @__PURE__ */ _("div", { className: "eyeon-map-viewer__loading", children: "Loading map…" }) });
|
|
1830
|
+
const he = d.amenities.filter(
|
|
1831
|
+
(r) => d.levels.some(
|
|
1832
|
+
(o) => o.shapes.some((t) => {
|
|
1833
|
+
var e;
|
|
1834
|
+
return ((e = t.assignment) == null ? void 0 : e.amenityId) === r.id;
|
|
474
1835
|
})
|
|
475
1836
|
)
|
|
476
|
-
);
|
|
477
|
-
return /* @__PURE__ */
|
|
1837
|
+
), ce = Te(I);
|
|
1838
|
+
return /* @__PURE__ */ ne(
|
|
478
1839
|
"div",
|
|
479
1840
|
{
|
|
480
|
-
className: `eyeon-map-viewer eyeon-map-viewer--${
|
|
1841
|
+
className: `eyeon-map-viewer eyeon-map-viewer--${I} ${H ?? ""}`,
|
|
481
1842
|
style: {
|
|
482
|
-
...
|
|
483
|
-
"--map-accent":
|
|
484
|
-
"--map-bg":
|
|
1843
|
+
...G,
|
|
1844
|
+
"--map-accent": se.ACCENT_COLOR,
|
|
1845
|
+
"--map-bg": se.MAP_BACKGROUND_COLOR
|
|
485
1846
|
},
|
|
486
1847
|
children: [
|
|
487
|
-
|
|
488
|
-
|
|
1848
|
+
(ce.search || ce.amenities) && /* @__PURE__ */ _(
|
|
1849
|
+
_t,
|
|
489
1850
|
{
|
|
490
|
-
doc:
|
|
491
|
-
amenities:
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
1851
|
+
doc: d,
|
|
1852
|
+
amenities: he,
|
|
1853
|
+
activeLevelId: U,
|
|
1854
|
+
onActiveLevelChange: g,
|
|
1855
|
+
fromAnchorId: z,
|
|
1856
|
+
toAnchorId: F,
|
|
1857
|
+
onFromChange: R,
|
|
1858
|
+
onToChange: X,
|
|
1859
|
+
accessibleOnly: Z,
|
|
1860
|
+
onAccessibleOnlyChange: V,
|
|
1861
|
+
route: j,
|
|
1862
|
+
showSearch: ce.search,
|
|
1863
|
+
showAmenities: ce.amenities
|
|
503
1864
|
}
|
|
504
1865
|
),
|
|
505
|
-
/* @__PURE__ */
|
|
506
|
-
|
|
1866
|
+
/* @__PURE__ */ _(
|
|
1867
|
+
Gt,
|
|
507
1868
|
{
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
1869
|
+
levels: d.levels,
|
|
1870
|
+
activeLevelId: U,
|
|
1871
|
+
onActiveLevelChange: g,
|
|
1872
|
+
onZoomIn: () => {
|
|
1873
|
+
var r;
|
|
1874
|
+
return (r = oe.current) == null ? void 0 : r.zoomIn();
|
|
1875
|
+
},
|
|
1876
|
+
onZoomOut: () => {
|
|
1877
|
+
var r;
|
|
1878
|
+
return (r = oe.current) == null ? void 0 : r.zoomOut();
|
|
1879
|
+
},
|
|
1880
|
+
onReset: () => {
|
|
1881
|
+
var r;
|
|
1882
|
+
return (r = oe.current) == null ? void 0 : r.reset();
|
|
1883
|
+
},
|
|
1884
|
+
showFloors: ce.floors,
|
|
1885
|
+
showZoomReset: ce.zoomReset
|
|
1886
|
+
}
|
|
1887
|
+
),
|
|
1888
|
+
/* @__PURE__ */ _("div", { ref: J, className: "eyeon-map-viewer__canvas", children: /* @__PURE__ */ _(Xe, { fallback: null, children: /* @__PURE__ */ _(
|
|
1889
|
+
Lt,
|
|
1890
|
+
{
|
|
1891
|
+
doc: d,
|
|
1892
|
+
theme: se,
|
|
1893
|
+
activeLevelId: U,
|
|
1894
|
+
route: j,
|
|
1895
|
+
selectedRetailerId: v,
|
|
1896
|
+
cameraRef: oe,
|
|
1897
|
+
eventSource: J,
|
|
1898
|
+
imageProxyUrl: k,
|
|
1899
|
+
onSelectShape: (r, o) => {
|
|
1900
|
+
var t;
|
|
1901
|
+
if (g(o), N) {
|
|
1902
|
+
const e = d.levels.find((y) => y.id === o), c = e == null ? void 0 : e.anchors.find((y) => y.shapeId === r);
|
|
1903
|
+
c && X(c.id);
|
|
1904
|
+
}
|
|
1905
|
+
(t = u.onSelectShape) == null || t.call(u, r);
|
|
518
1906
|
}
|
|
519
1907
|
}
|
|
520
1908
|
) }) })
|
|
@@ -523,8 +1911,9 @@ function ce(l) {
|
|
|
523
1911
|
);
|
|
524
1912
|
}
|
|
525
1913
|
export {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
1914
|
+
Gt as M,
|
|
1915
|
+
_t as R,
|
|
1916
|
+
Lt as a,
|
|
1917
|
+
Ut as b
|
|
529
1918
|
};
|
|
530
1919
|
//# sourceMappingURL=MapViewer.js.map
|