adofai 3.1.0 → 3.3.0
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 +423 -51
- package/dist/src/parser/LargeFileParser.d.ts +20 -0
- package/dist/src/parser/LargeFileParser.js +382 -0
- package/dist/src/parser.d.ts +2 -1
- package/dist/src/parser.js +2 -1
- package/dist/src/pathdata/index.d.ts +1 -4
- package/dist/src/pathdata/index.js +45 -2
- package/dist/src/structure/Level.d.ts +0 -65
- package/dist/src/structure/Level.js +23 -395
- package/dist/src/structure/levelAngle.d.ts +40 -0
- package/dist/src/structure/levelAngle.js +316 -0
- package/dist/src/types.d.ts +8 -0
- package/dist/src/types.js +27 -0
- package/dist/umd/index.js +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
21
|
+
export function normalizeAngle(v) {
|
|
22
|
+
return ((v % 360) + 360) % 360;
|
|
23
|
+
}
|
|
24
|
+
export function resolveAngleOffset(v) {
|
|
25
|
+
if (v === 555)
|
|
26
|
+
return 72;
|
|
27
|
+
if (v === 666)
|
|
28
|
+
return -72;
|
|
29
|
+
if (v === 777)
|
|
30
|
+
return 52;
|
|
31
|
+
if (v === 888)
|
|
32
|
+
return -52;
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
export function parseAngle(agd, i, angleDir, isTwirl) {
|
|
36
|
+
let prev = 0;
|
|
37
|
+
if (i === 0)
|
|
38
|
+
angleDir.value = 180;
|
|
39
|
+
const offset = resolveAngleOffset(agd[i]);
|
|
40
|
+
if (offset !== null) {
|
|
41
|
+
const prevDir = normalizeAngle(angleDir.value - 180);
|
|
42
|
+
const actualDir = normalizeAngle(prevDir + offset);
|
|
43
|
+
const delta = normalizeAngle(angleDir.value - actualDir);
|
|
44
|
+
prev = isTwirl === 0 ? delta : normalizeAngle(360 - delta);
|
|
45
|
+
if (prev === 0)
|
|
46
|
+
prev = 360;
|
|
47
|
+
angleDir.value = normalizeAngle(actualDir + 180);
|
|
48
|
+
}
|
|
49
|
+
else if (agd[i] === 999) {
|
|
50
|
+
let minus = 1;
|
|
51
|
+
while (i - minus >= 0 && agd[i - minus] === 999)
|
|
52
|
+
minus++;
|
|
53
|
+
const realAngle = i - minus >= 0 ? agd[i - minus] : 0;
|
|
54
|
+
angleDir.value = normalizeAngle(realAngle + (minus - 1) * 180);
|
|
55
|
+
if (isNaN(angleDir.value))
|
|
56
|
+
angleDir.value = 0;
|
|
57
|
+
prev = 0;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const delta = normalizeAngle(angleDir.value - agd[i]);
|
|
61
|
+
prev = isTwirl === 0 ? delta : normalizeAngle(360 - delta);
|
|
62
|
+
if (prev === 0)
|
|
63
|
+
prev = 360;
|
|
64
|
+
angleDir.value = normalizeAngle(agd[i] + 180);
|
|
65
|
+
}
|
|
66
|
+
return prev;
|
|
67
|
+
}
|
|
68
|
+
export function parseChangedAngle(agd, i, angleDir, isTwirl, tiles) {
|
|
69
|
+
var _a;
|
|
70
|
+
let prev = 0;
|
|
71
|
+
if (i === 0)
|
|
72
|
+
angleDir.value = 180;
|
|
73
|
+
const offset = resolveAngleOffset(agd);
|
|
74
|
+
if (offset !== null) {
|
|
75
|
+
const prevDir = normalizeAngle(angleDir.value - 180);
|
|
76
|
+
const actualDir = normalizeAngle(prevDir + offset);
|
|
77
|
+
const delta = normalizeAngle(angleDir.value - actualDir);
|
|
78
|
+
prev = isTwirl === 0 ? delta : normalizeAngle(360 - delta);
|
|
79
|
+
if (prev === 0)
|
|
80
|
+
prev = 360;
|
|
81
|
+
angleDir.value = normalizeAngle(actualDir + 180);
|
|
82
|
+
}
|
|
83
|
+
else if (agd === 999) {
|
|
84
|
+
let minus = 1;
|
|
85
|
+
while (i - minus - 1 >= 0 && ((_a = tiles[i - minus - 1]) === null || _a === void 0 ? void 0 : _a.direction) === 999)
|
|
86
|
+
minus++;
|
|
87
|
+
const realAngle = i - minus - 1 >= 0 ? tiles[i - minus - 1].direction : 0;
|
|
88
|
+
angleDir.value = normalizeAngle(realAngle + (minus - 1) * 180);
|
|
89
|
+
if (isNaN(angleDir.value))
|
|
90
|
+
angleDir.value = 0;
|
|
91
|
+
prev = 0;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
const delta = normalizeAngle(angleDir.value - agd);
|
|
95
|
+
prev = isTwirl === 0 ? delta : normalizeAngle(360 - delta);
|
|
96
|
+
if (prev === 0)
|
|
97
|
+
prev = 360;
|
|
98
|
+
angleDir.value = normalizeAngle(agd + 180);
|
|
99
|
+
}
|
|
100
|
+
return prev;
|
|
101
|
+
}
|
|
102
|
+
export function filterActionsByEventType(tiles, eventType) {
|
|
103
|
+
return tiles
|
|
104
|
+
.flatMap((tile, idx) => (Array.isArray(tile.actions) ? tile.actions : []).map(a => ({ a, idx })))
|
|
105
|
+
.filter(({ a }) => a.eventType === eventType)
|
|
106
|
+
.map(({ a, idx }) => ({ index: idx, action: a }));
|
|
107
|
+
}
|
|
108
|
+
export function getActionsByIndex(tiles, eventType, index) {
|
|
109
|
+
const filtered = filterActionsByEventType(tiles, eventType);
|
|
110
|
+
const matches = filtered.filter(item => item.index === index);
|
|
111
|
+
return {
|
|
112
|
+
count: matches.length,
|
|
113
|
+
actions: matches.map(item => item.action),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function filterByFloor(arr, i) {
|
|
117
|
+
if (!Array.isArray(arr))
|
|
118
|
+
return [];
|
|
119
|
+
return arr.filter(item => item.floor === i).map((_a) => {
|
|
120
|
+
var { floor } = _a, rest = __rest(_a, ["floor"]);
|
|
121
|
+
return rest;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function filterByFloorWithDeco(arr, i) {
|
|
125
|
+
if (!Array.isArray(arr))
|
|
126
|
+
return [];
|
|
127
|
+
return arr.filter(item => item.floor === i).map((_a) => {
|
|
128
|
+
var { floor } = _a, rest = __rest(_a, ["floor"]);
|
|
129
|
+
return rest;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export function createTiles(xLength, opt, cbs) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const tiles = new Array(xLength);
|
|
135
|
+
const batchSize = Math.max(100, Math.floor(xLength / 100));
|
|
136
|
+
const actionsByFloor = new Map();
|
|
137
|
+
if (Array.isArray(opt.actions)) {
|
|
138
|
+
for (const action of opt.actions) {
|
|
139
|
+
if (!actionsByFloor.has(action.floor)) {
|
|
140
|
+
actionsByFloor.set(action.floor, []);
|
|
141
|
+
}
|
|
142
|
+
actionsByFloor.get(action.floor).push(action);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const decorationsByFloor = new Map();
|
|
146
|
+
if (Array.isArray(opt.decorations)) {
|
|
147
|
+
for (const deco of opt.decorations) {
|
|
148
|
+
if (!decorationsByFloor.has(deco.floor)) {
|
|
149
|
+
decorationsByFloor.set(deco.floor, []);
|
|
150
|
+
}
|
|
151
|
+
decorationsByFloor.get(deco.floor).push(deco);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const angleDir = { value: 180 };
|
|
155
|
+
for (let i = 0; i < xLength; i++) {
|
|
156
|
+
const floorActions = actionsByFloor.get(i) || [];
|
|
157
|
+
const floorDecos = decorationsByFloor.get(i) || [];
|
|
158
|
+
for (const action of floorActions) {
|
|
159
|
+
if (action.eventType === 'Twirl') {
|
|
160
|
+
cbs.onTwirl(cbs.getTwirl() + 1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const angle = parseAngle(opt.angleData, i, angleDir, cbs.getTwirl() % 2);
|
|
164
|
+
const tileActions = floorActions.map((_a) => {
|
|
165
|
+
var { floor } = _a, rest = __rest(_a, ["floor"]);
|
|
166
|
+
return rest;
|
|
167
|
+
});
|
|
168
|
+
const tileDecos = floorDecos.map((_a) => {
|
|
169
|
+
var { floor } = _a, rest = __rest(_a, ["floor"]);
|
|
170
|
+
return rest;
|
|
171
|
+
});
|
|
172
|
+
tiles[i] = {
|
|
173
|
+
direction: opt.angleData[i],
|
|
174
|
+
_lastdir: opt.angleData[i - 1] || 0,
|
|
175
|
+
actions: tileActions,
|
|
176
|
+
angle: angle,
|
|
177
|
+
addDecorations: tileDecos,
|
|
178
|
+
twirl: cbs.getTwirl(),
|
|
179
|
+
extraProps: {},
|
|
180
|
+
};
|
|
181
|
+
if (i % batchSize === 0 || i === xLength - 1) {
|
|
182
|
+
cbs.onProgress('relativeAngle', i + 1, xLength, {
|
|
183
|
+
tileIndex: i,
|
|
184
|
+
angle: opt.angleData[i],
|
|
185
|
+
relativeAngle: angle,
|
|
186
|
+
});
|
|
187
|
+
if (i % (batchSize * 10) === 0) {
|
|
188
|
+
yield new Promise(r => setTimeout(r, 0));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return tiles;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
export function changeAngles(tiles) {
|
|
196
|
+
const angleDir = { value: 180 };
|
|
197
|
+
return tiles.map((t, i) => {
|
|
198
|
+
t.angle = parseChangedAngle(t.direction, i + 1, angleDir, t.twirl, tiles);
|
|
199
|
+
return t;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
export function flattenAngleDatas(tiles) {
|
|
203
|
+
return tiles.map(item => item.direction);
|
|
204
|
+
}
|
|
205
|
+
export function flattenActionsWithFloor(tiles) {
|
|
206
|
+
return tiles.flatMap((tile, idx) => (Array.isArray(tile === null || tile === void 0 ? void 0 : tile.actions) ? tile.actions : []).map(a => (Object.assign({ floor: idx }, a))));
|
|
207
|
+
}
|
|
208
|
+
export function flattenDecorationsWithFloor(tiles) {
|
|
209
|
+
return tiles.flatMap((tile, idx) => (Array.isArray(tile === null || tile === void 0 ? void 0 : tile.addDecorations) ? tile.addDecorations : []).map(d => (Object.assign({ floor: idx }, d))));
|
|
210
|
+
}
|
|
211
|
+
export function calculateTilePositions(angleData, tiles, actions, emitProgress) {
|
|
212
|
+
const totalTiles = tiles.length;
|
|
213
|
+
const positions = [];
|
|
214
|
+
const startPos = [0, 0];
|
|
215
|
+
const positionTrackMap = new Map();
|
|
216
|
+
for (const action of actions) {
|
|
217
|
+
if (action.eventType === 'PositionTrack' && action.positionOffset) {
|
|
218
|
+
if (action.editorOnly !== true && action.editorOnly !== 'Enabled') {
|
|
219
|
+
positionTrackMap.set(action.floor, action);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
emitProgress('tilePosition', 0, totalTiles);
|
|
224
|
+
const floats = new Array(totalTiles);
|
|
225
|
+
for (let i = 0; i < totalTiles; i++) {
|
|
226
|
+
const offset = resolveAngleOffset(angleData[i]);
|
|
227
|
+
if (offset !== null) {
|
|
228
|
+
floats[i] = (i > 0 ? floats[i - 1] : 0) + offset;
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
floats[i] = angleData[i];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
for (let i = 0; i < totalTiles; i++) {
|
|
235
|
+
if (floats[i] === 999) {
|
|
236
|
+
let minus = 1;
|
|
237
|
+
while (i - minus >= 0 && floats[i - minus] === 999)
|
|
238
|
+
minus++;
|
|
239
|
+
const realAngle = i - minus >= 0 ? floats[i - minus] : 0;
|
|
240
|
+
floats[i] = realAngle + (minus - 1) * 180;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const progressInterval = Math.max(100, Math.floor(totalTiles / 100));
|
|
244
|
+
for (let i = 0; i <= totalTiles; i++) {
|
|
245
|
+
const isLastTile = i === totalTiles;
|
|
246
|
+
const angle1 = isLastTile ? (floats[i - 1] || 0) : floats[i];
|
|
247
|
+
const angle2 = i === 0 ? 0 : (floats[i - 1] || 0);
|
|
248
|
+
const currentTile = tiles[i];
|
|
249
|
+
const posTrack = positionTrackMap.get(i);
|
|
250
|
+
if (posTrack === null || posTrack === void 0 ? void 0 : posTrack.positionOffset) {
|
|
251
|
+
startPos[0] += posTrack.positionOffset[0];
|
|
252
|
+
startPos[1] += posTrack.positionOffset[1];
|
|
253
|
+
}
|
|
254
|
+
const tempPos = [startPos[0], startPos[1]];
|
|
255
|
+
positions.push(tempPos);
|
|
256
|
+
if (currentTile) {
|
|
257
|
+
currentTile.position = tempPos;
|
|
258
|
+
currentTile.extraProps.angle1 = angle1;
|
|
259
|
+
currentTile.extraProps.angle2 = angle2 - 180;
|
|
260
|
+
currentTile.extraProps.cangle = isLastTile ? floats[i - 1] + 180 : floats[i];
|
|
261
|
+
}
|
|
262
|
+
const rad = angle1 * Math.PI / 180;
|
|
263
|
+
startPos[0] += Math.cos(rad);
|
|
264
|
+
startPos[1] += Math.sin(rad);
|
|
265
|
+
if (i % progressInterval === 0 || isLastTile) {
|
|
266
|
+
emitProgress('tilePosition', i, totalTiles, {
|
|
267
|
+
tileIndex: i,
|
|
268
|
+
position: [tempPos[0], tempPos[1]],
|
|
269
|
+
angle: angle1,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
emitProgress('tilePosition', totalTiles, totalTiles, {
|
|
274
|
+
processed: positions.flat(),
|
|
275
|
+
});
|
|
276
|
+
return positions;
|
|
277
|
+
}
|
|
278
|
+
export function precomputePositions(angleData, totalTiles, actions) {
|
|
279
|
+
const positions = new Array(totalTiles);
|
|
280
|
+
const resolvedAngles = new Array(totalTiles);
|
|
281
|
+
const startPos = [0, 0];
|
|
282
|
+
const positionTrackMap = new Map();
|
|
283
|
+
for (const action of actions) {
|
|
284
|
+
if (action.eventType === 'PositionTrack' && action.positionOffset) {
|
|
285
|
+
if (action.editorOnly !== true && action.editorOnly !== 'Enabled') {
|
|
286
|
+
positionTrackMap.set(action.floor, action);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
for (let i = 0; i < totalTiles; i++) {
|
|
291
|
+
const posTrack = positionTrackMap.get(i);
|
|
292
|
+
if (posTrack === null || posTrack === void 0 ? void 0 : posTrack.positionOffset) {
|
|
293
|
+
startPos[0] += posTrack.positionOffset[0];
|
|
294
|
+
startPos[1] += posTrack.positionOffset[1];
|
|
295
|
+
}
|
|
296
|
+
positions[i] = [startPos[0], startPos[1]];
|
|
297
|
+
const offset = resolveAngleOffset(angleData[i]);
|
|
298
|
+
if (offset !== null) {
|
|
299
|
+
resolvedAngles[i] = (i > 0 ? resolvedAngles[i - 1] : 0) + offset;
|
|
300
|
+
}
|
|
301
|
+
else if (angleData[i] === 999) {
|
|
302
|
+
let minus = 1;
|
|
303
|
+
while (i - minus >= 0 && angleData[i - minus] === 999)
|
|
304
|
+
minus++;
|
|
305
|
+
const realAngle = i - minus >= 0 ? angleData[i - minus] : 0;
|
|
306
|
+
resolvedAngles[i] = realAngle + (minus - 1) * 180;
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
resolvedAngles[i] = angleData[i];
|
|
310
|
+
}
|
|
311
|
+
const rad = resolvedAngles[i] * Math.PI / 180;
|
|
312
|
+
startPos[0] += Math.cos(rad);
|
|
313
|
+
startPos[1] += Math.sin(rad);
|
|
314
|
+
}
|
|
315
|
+
return { positions, angles: resolvedAngles };
|
|
316
|
+
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -94,3 +94,11 @@ export declare const enum HoldMidSoundTimingRelativeTo {
|
|
|
94
94
|
End = "End"
|
|
95
95
|
}
|
|
96
96
|
export declare function isEventEnabled(value: ABoolean | undefined, defaultValue: boolean): boolean;
|
|
97
|
+
export type TileReferenceType = 'ThisTile' | 'Start' | 'End';
|
|
98
|
+
export type TileReference = [number, TileReferenceType];
|
|
99
|
+
export declare function resolveTileReference(relativeTo: TileReference | undefined, thisTileId: number, totalTiles: number): number;
|
|
100
|
+
export type Vec2Like = [number, number] | {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
};
|
|
104
|
+
export declare function normalizeVec2(v: Vec2Like | undefined): [number, number];
|
package/dist/src/types.js
CHANGED
|
@@ -5,3 +5,30 @@ export function isEventEnabled(value, defaultValue) {
|
|
|
5
5
|
return value;
|
|
6
6
|
return value === 'Enabled' || value === 'true';
|
|
7
7
|
}
|
|
8
|
+
export function resolveTileReference(relativeTo, thisTileId, totalTiles) {
|
|
9
|
+
if (!relativeTo)
|
|
10
|
+
return thisTileId;
|
|
11
|
+
const [offset, type] = relativeTo;
|
|
12
|
+
let result;
|
|
13
|
+
switch (type) {
|
|
14
|
+
case 'Start':
|
|
15
|
+
result = offset;
|
|
16
|
+
break;
|
|
17
|
+
case 'End':
|
|
18
|
+
result = totalTiles - 1 + offset;
|
|
19
|
+
break;
|
|
20
|
+
case 'ThisTile':
|
|
21
|
+
default:
|
|
22
|
+
result = thisTileId + offset;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
return Math.max(0, Math.min(result, totalTiles - 1));
|
|
26
|
+
}
|
|
27
|
+
export function normalizeVec2(v) {
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
|
+
if (!v)
|
|
30
|
+
return [0, 0];
|
|
31
|
+
if (Array.isArray(v))
|
|
32
|
+
return [(_a = v[0]) !== null && _a !== void 0 ? _a : 0, (_b = v[1]) !== null && _b !== void 0 ? _b : 0];
|
|
33
|
+
return [(_c = v.x) !== null && _c !== void 0 ? _c : 0, (_d = v.y) !== null && _d !== void 0 ? _d : 0];
|
|
34
|
+
}
|
package/dist/umd/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ADOFAI=e():t.ADOFAI=e()}(globalThis,()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Events:()=>o,Level:()=>St,Parsers:()=>r,Presets:()=>n,Structure:()=>i,Types:()=>a,pathData:()=>u});var r={};t.r(r),t.d(r,{ArrayBufferParser:()=>q,BufferParser:()=>j,StringParser:()=>I,default:()=>Z});var n={};t.r(n),t.d(n,{preset_inner_no_deco:()=>ut,preset_noeffect:()=>it,preset_noeffect_completely:()=>st,preset_noholds:()=>ot,preset_nomovecamera:()=>at});var i={};t.r(i),t.d(i,{default:()=>St});var o={};t.r(o);var a={};t.r(a),t.d(a,{isEventEnabled:()=>kt});var s={R:0,p:15,J:30,E:45,T:60,o:75,U:90,q:105,G:120,Q:135,H:150,W:165,L:180,x:195,N:210,Z:225,F:240,V:255,D:270,Y:285,B:300,C:315,M:330,A:345,5:555,6:666,7:777,8:888,"!":999};const u={pathDataTable:s,parseToangleData:function(t){return Array.from(t).map(function(t){return s[t]})}};function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,f(n.key),n)}}function f(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}const h=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return e=t,r=[{key:"parseError",value:function(t){return t}},{key:"parseAsObject",value:function(e,r){return(r||JSON).parse(t.parseAsText(e))}},{key:"parseAsText",value:function(t){return this.parseError(t)}}],null&&c(e.prototype,null),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r}();function p(t){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}function y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,d(n.key),n)}}function v(t,e,r){return e&&y(t.prototype,e),r&&y(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(t){var e=function(t){if("object"!=p(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==p(e)?e:e+""}const b=v(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)});function g(t){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function m(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function O(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,k(n.key),n)}}function S(t,e,r){return e&&O(t.prototype,e),r&&O(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function k(t){var e=function(t){if("object"!=g(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==g(e)?e:e+""}function w(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(w=function(){return!!t})()}function _(t){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_(t)}function A(t,e){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},A(t,e)}var E=function(t){function e(){return m(this,e),t=this,n=arguments,r=_(r=e),function(t,e){if(e&&("object"==g(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,w()?Reflect.construct(r,n||[],_(t).constructor):r.apply(t,n));var t,r,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&A(t,e)}(e,t),S(e,[{key:"parse",value:function(t){var e,r;return e="string"==typeof t?(new TextEncoder).encode(t):(r=t).length>=3&&239===r[0]&&187===r[1]&&191===r[2]?r.subarray(3):r,new T(e).parseValue()}},{key:"stringify",value:function(t){return JSON.stringify(t)}}])}(b),T=function(){return S(function t(e){m(this,t),this.data=e,this.pos=0,this.decoder=new TextDecoder("utf-8"),this.length=e.length},[{key:"parseValue",value:function(){this.eatWhitespace();var t=this.peek();if(-1===t)return null;switch(t){case 123:return this.parseObject();case 91:return this.parseArray();case 34:return this.parseString();case 116:return this.parseKeyword(!0);case 102:return this.parseKeyword(!1);case 110:return this.parseKeyword(null);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.parseNumber();default:return this.pos++,null}}},{key:"parseObject",value:function(){var t={};for(this.pos++;;){if(this.eatWhitespace(),125===this.peek()){this.pos++;break}var e=this.parseString();if(this.eatWhitespace(),58!==this.peek())break;this.pos++,t[e]=this.parseValue(),this.eatWhitespace(),44===this.peek()&&this.pos++}return t}},{key:"parseArray",value:function(){var t=[];for(this.pos++;;){if(this.eatWhitespace(),93===this.peek()){this.pos++;break}t.push(this.parseValue()),this.eatWhitespace(),44===this.peek()&&this.pos++}return t}},{key:"parseString",value:function(){this.pos++;for(var t=this.pos,e=!1;this.pos<this.length;){var r=this.data[this.pos];if(34===r)break;92===r?(e=!0,this.pos+=2):this.pos++}var n=this.pos;this.pos++;var i=this.data.subarray(t,n);return e?this.processEscapes(i):this.decoder.decode(i)}},{key:"processEscapes",value:function(t){for(var e=this.decoder.decode(t),r="",n=0;n<e.length;n++)if("\\"===e[n]&&n+1<e.length){var i=e[++n];switch(i){case'"':case"\\":case"/":r+=i;break;case"b":r+="\b";break;case"f":r+="\f";break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"u":r+=String.fromCharCode(parseInt(e.substr(n+1,4),16)),n+=4}}else r+=e[n];return r}},{key:"parseNumber",value:function(){for(var t=this.pos;this.pos<this.length;){var e=this.data[this.pos];if(!(e>=48&&e<=57||46===e||101===e||69===e||43===e||45===e))break;this.pos++}var r=this.decoder.decode(this.data.subarray(t,this.pos));return parseFloat(r)}},{key:"parseKeyword",value:function(t){var e=this.data[this.pos];return 116===e?this.pos+=4:102===e?this.pos+=5:110===e&&(this.pos+=4),t}},{key:"eatWhitespace",value:function(){for(;this.pos<this.length;){var t=this.data[this.pos];if(32!==t&&10!==t&&13!==t&&9!==t)break;this.pos++}}},{key:"peek",value:function(){return this.pos<this.length?this.data[this.pos]:-1}}])}();const j=E;function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function D(t){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(t)}function N(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function C(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,M(n.key),n)}}function x(t,e,r){return e&&C(t.prototype,e),r&&C(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function M(t){var e=function(t){if("object"!=D(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=D(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==D(e)?e:e+""}function R(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(R=function(){return!!t})()}function U(t){return U=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},U(t)}function K(t,e){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},K(t,e)}var B=function(t){function e(){return N(this,e),t=this,n=arguments,r=U(r=e),function(t,e){if(e&&("object"==D(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,R()?Reflect.construct(r,n||[],U(t).constructor):r.apply(t,n));var t,r,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&K(t,e)}(e,t),x(e,[{key:"parse",value:function(t,r){if(null==t)return null;var n=new F(t).parseValue();return"function"==typeof r?e._applyReviver("",n,r):n}},{key:"stringify",value:function(t,e,r){return new L(e,r).serialize(t)}}],[{key:"_applyReviver",value:function(t,r,n){if(r&&"object"===D(r))if(Array.isArray(r))for(var i=0;i<r.length;i++)r[i]=e._applyReviver(i.toString(),r[i],n);else for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(r[o]=e._applyReviver(o,r[o],n));return n(t,r)}}])}(b),F=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;N(this,t),this.json=e,this.position=0,this.endSection=r,65279===this.peek()&&this.read()}return x(t,[{key:"parseValue",value:function(){return this.parseByToken(this.nextToken)}},{key:"parseObject",value:function(){var e={};for(this.read();;){var r=void 0;do{if((r=this.nextToken)===t.TOKEN.NONE)return null;if(r===t.TOKEN.CURLY_CLOSE)return e}while(r===t.TOKEN.COMMA);var n=this.parseString();if(null===n)return null;if(this.nextToken!==t.TOKEN.COLON)return null;if(null!=this.endSection&&n===this.endSection)return e;this.read(),e[n]=this.parseValue()}}},{key:"parseArray",value:function(){var e=[];this.read();for(var r=!0;r;){var n=this.nextToken;switch(n){case t.TOKEN.NONE:return null;case t.TOKEN.SQUARED_CLOSE:r=!1;break;case t.TOKEN.COMMA:break;default:var i=this.parseByToken(n);e.push(i)}}return e}},{key:"parseByToken",value:function(e){switch(e){case t.TOKEN.CURLY_OPEN:return this.parseObject();case t.TOKEN.SQUARED_OPEN:return this.parseArray();case t.TOKEN.STRING:return this.parseString();case t.TOKEN.NUMBER:return this.parseNumber();case t.TOKEN.TRUE:return!0;case t.TOKEN.FALSE:return!1;case t.TOKEN.NULL:default:return null}}},{key:"parseString",value:function(){var t="";this.read();for(var e=!0;e&&-1!==this.peek();){var r=this.nextChar;switch(r){case'"':e=!1;break;case"\\":if(-1===this.peek()){e=!1;break}var n=this.nextChar;switch(n){case'"':case"/":case"\\":t+=n;break;case"b":t+="\b";break;case"f":t+="\f";break;case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"u":for(var i="",o=0;o<4;o++)i+=this.nextChar;t+=String.fromCharCode(Number.parseInt(i,16))}break;default:t+=r}}return t}},{key:"parseNumber",value:function(){var t=this.nextWord;return-1===t.indexOf(".")?Number.parseInt(t,10)||0:Number.parseFloat(t)||0}},{key:"eatWhitespace",value:function(){for(;-1!==t.WHITE_SPACE.indexOf(this.peekChar)&&(this.read(),-1!==this.peek()););}},{key:"peek",value:function(){return this.position>=this.json.length?-1:this.json.charCodeAt(this.position)}},{key:"read",value:function(){return this.position>=this.json.length?-1:this.json.charCodeAt(this.position++)}},{key:"peekChar",get:function(){var t=this.peek();return-1===t?"\0":String.fromCharCode(t)}},{key:"nextChar",get:function(){var t=this.read();return-1===t?"\0":String.fromCharCode(t)}},{key:"nextWord",get:function(){for(var e="";-1===t.WORD_BREAK.indexOf(this.peekChar)&&(e+=this.nextChar,-1!==this.peek()););return e}},{key:"nextToken",get:function(){if(this.eatWhitespace(),-1===this.peek())return t.TOKEN.NONE;switch(this.peekChar){case'"':return t.TOKEN.STRING;case",":return this.read(),t.TOKEN.COMMA;case"-":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return t.TOKEN.NUMBER;case":":return t.TOKEN.COLON;case"[":return t.TOKEN.SQUARED_OPEN;case"]":return this.read(),t.TOKEN.SQUARED_CLOSE;case"{":return t.TOKEN.CURLY_OPEN;case"}":return this.read(),t.TOKEN.CURLY_CLOSE;default:switch(this.nextWord){case"false":return t.TOKEN.FALSE;case"true":return t.TOKEN.TRUE;case"null":return t.TOKEN.NULL;default:return t.TOKEN.NONE}}}}])}();F.WHITE_SPACE=" \t\n\r\ufeff",F.WORD_BREAK=' \t\n\r{}[],:"',F.TOKEN={NONE:0,CURLY_OPEN:1,CURLY_CLOSE:2,SQUARED_OPEN:3,SQUARED_CLOSE:4,COLON:5,COMMA:6,STRING:7,NUMBER:8,TRUE:9,FALSE:10,NULL:11};var L=function(){return x(function t(e,r){N(this,t),this.result="",this.indent=0,this.indentStr="",this.replacer=e||null,this.space=r||null,"number"==typeof r?this.indentStr=" ".repeat(Math.min(10,Math.max(0,r))):"string"==typeof r&&(this.indentStr=r.slice(0,10))},[{key:"serialize",value:function(t){return this.result="",this.serializeValue(t,""),this.result}},{key:"serializeValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";"function"==typeof this.replacer&&(t=this.replacer(e,t)),null==t?this.result+="null":"string"==typeof t?this.serializeString(t):"boolean"==typeof t?this.result+=t.toString():Array.isArray(t)?this.serializeArray(t):"object"===D(t)?this.serializeObject(t):this.serializeOther(t)}},{key:"serializeObject",value:function(t){var e=!0;for(var r in this.result+="{",this.indentStr&&(this.result+="\n",this.indent++),t)if(Object.prototype.hasOwnProperty.call(t,r)){if(Array.isArray(this.replacer)&&!this.replacer.includes(r))continue;e||(this.result+=",",this.indentStr&&(this.result+="\n")),this.indentStr&&(this.result+=this.indentStr.repeat(this.indent)),this.serializeString(r.toString()),this.result+=":",this.indentStr&&(this.result+=" "),this.serializeValue(t[r],r),e=!1}this.indentStr&&(this.result+="\n",this.indent--,this.result+=this.indentStr.repeat(this.indent)),this.result+="}"}},{key:"serializeArray",value:function(t){this.result+="[",this.indentStr&&t.length>0&&(this.result+="\n",this.indent++);for(var e=!0,r=0;r<t.length;r++)e||(this.result+=",",this.indentStr&&(this.result+="\n")),this.indentStr&&(this.result+=this.indentStr.repeat(this.indent)),this.serializeValue(t[r],r.toString()),e=!1;this.indentStr&&t.length>0&&(this.result+="\n",this.indent--,this.result+=this.indentStr.repeat(this.indent)),this.result+="]"}},{key:"serializeString",value:function(t){this.result+='"';var e,r=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return P(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(t);try{for(r.s();!(e=r.n()).done;){var n=e.value;switch(n){case"\b":this.result+="\\b";break;case"\t":this.result+="\\t";break;case"\n":this.result+="\\n";break;case"\f":this.result+="\\f";break;case"\r":this.result+="\\r";break;case'"':this.result+='\\"';break;case"\\":this.result+="\\\\";break;default:var i=n.charCodeAt(0);this.result+=i>=32&&i<=126?n:"\\u"+i.toString(16).padStart(4,"0")}}}catch(t){r.e(t)}finally{r.f()}this.result+='"'}},{key:"serializeOther",value:function(t){"number"==typeof t?isFinite(t)?this.result+=t.toString():this.result+="null":this.serializeString(t.toString())}}])}();const I=B;function z(t){return z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},z(t)}function W(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,V(n.key),n)}}function V(t){var e=function(t){if("object"!=z(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==z(e)?e:e+""}function G(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(G=function(){return!!t})()}function H(t){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},H(t)}function J(t,e){return J=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},J(t,e)}var Q=new Uint8Array([239,187,191]),Y=new Uint8Array([44]);function $(t){var e=new Uint8Array(t);return e.length>=3&&e[0]===Q[0]&&e[1]===Q[1]&&e[2]===Q[2]?t.slice(3):t}const q=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,r){return e=H(e),function(t,e){if(e&&("object"==z(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,G()?Reflect.construct(e,r||[],H(t).constructor):e.apply(t,r))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&J(t,e)}(e,t),r=e,(n=[{key:"parse",value:function(t){return"string"==typeof t?I.prototype.parse.call(I.prototype,t):I.prototype.parse.call(I.prototype,(e=function(t){for(var e=new Uint8Array(t),r=[],n="other",i=0,o=0;o<e.length;o++){var a=e[o];if("escape"==n)n="string";else switch(a){case 34:switch(n){case"string":n="other";break;case"comma":r.push(Y);default:n="string"}break;case 92:"string"===n&&(n="escape");break;case 44:r.push(e.subarray(i,o)),i=o+1,"other"===n&&(n="comma");break;case 93:case 125:"comma"===n&&(n="other");break;case 9:case 10:case 11:case 12:case 13:case 32:break;default:"comma"===n&&(r.push(Y),n="other")}}r.push(e.subarray(i));for(var s=0,u=0,l=r;u<l.length;u++)s+=l[u].length;for(var c=new Uint8Array(s),f=0,h=0,p=r;h<p.length;h++){var y=p[h];c.set(y,f),f+=y.length}return c.buffer}($(t)),r=$(e),new TextDecoder("utf-8").decode(r)));var e,r}},{key:"stringify",value:function(t){return JSON.stringify(t)}}])&&W(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(b),Z=h;function X(t){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},X(t)}function tt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"\t",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if("object"!==X(t)||null===t)return JSON.stringify(t);if(Array.isArray(t)){if(t.every(function(t){return"object"!==X(t)||null===t}))return"["+t.map(function(t){return tt(t,0,!1,n,i)}).join(",")+"]";var o=n.repeat(e),a=n.repeat(e+i);return"[\n"+t.map(function(t){return a+et(t,n)}).join(",\n")+"\n"+o+"]"}var s=n.repeat(e),u=Object.keys(t);if(r){var l=n.repeat(i);return"{\n"+u.map(function(e){return l+JSON.stringify(e)+": "+tt(t[e],i,!1,n,i)}).join(",\n")+"\n}"}return"{\n"+u.map(function(r){return s+n.repeat(i)+JSON.stringify(r)+": "+tt(t[r],e+i,!1,n,i)}).join(",\n")+"\n"+s+"}"}function et(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"\t";return"object"!==X(t)||null===t?tt(t,0,!1,e):Array.isArray(t)?"["+t.map(function(t){return et(t,e)}).join(",")+"]":"{"+Object.keys(t).map(function(r){return JSON.stringify(r)+": "+et(t[r],e)}).join(", ")+"}"}const rt=tt;var nt,it={type:"exclude",events:["Flash","SetFilter","SetFilterAdvanced","HallOfMirrors","Bloom","ScalePlanets","ScreenTile","ScreenScroll","ShakeScreen"]},ot={type:"exclude",events:["Hold"]},at={type:"exclude",events:["MoveCamera"]},st={type:"exclude",events:["AddDecoration","AddText","AddObject","Checkpoint","SetHitsound","PlaySound","SetPlanetRotation","ScalePlanets","ColorTrack","AnimateTrack","RecolorTrack","MoveTrack","PositionTrack","MoveDecorations","SetText","SetObject","SetDefaultText","CustomBackground","Flash","MoveCamera","SetFilter","HallOfMirrors","ShakeScreen","Bloom","ScreenTile","ScreenScroll","SetFrameRate","RepeatEvents","SetConditionalEvents","EditorComment","Bookmark","Hold","SetHoldSound","Hide","ScaleMargin","ScaleRadius"]},ut={type:"special",events:["MoveDecorations","SetText","SetObject","SetDefaultText"]};!function(t){t.include="include",t.exclude="exclude",t.special="special"}(nt||(nt={}));const lt=function(t){if(!Array.isArray(t))throw new Error("Arguments are not supported.");return t.map(function(t){var e=Object.assign({},t);return e.hasOwnProperty("addDecorations")&&(e.addDecorations=[]),Array.isArray(e.actions)&&(e.actions=e.actions.filter(function(t){return!ut.events.includes(t.eventType)})),e})},ct=function(t,e){return e.map(function(e){var r=Object.assign({},e);return Array.isArray(e.actions)&&(r.actions=e.actions.filter(function(e){return!t.includes(e.eventType)})),r})},ft=function(t,e){return e.map(function(e){var r=Object.assign({},e);return Array.isArray(e.actions)&&(r.actions=e.actions.filter(function(e){return t.includes(e.eventType)})),r})};function ht(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var u=n&&n.prototype instanceof s?n:s,l=Object.create(u.prototype);return pt(l,"_invoke",function(r,n,i){var o,s,u,l=0,c=i||[],f=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return o=e,s=0,u=t,h.n=r,a}};function p(r,n){for(s=r,u=n,e=0;!f&&l&&!i&&e<c.length;e++){var i,o=c[e],p=h.p,y=o[2];r>3?(i=y===n)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=r<2&&p<o[1])?(s=0,h.v=n,h.n=o[1]):p<y&&(i=r<3||o[0]>n||n>y)&&(o[4]=r,o[5]=n,h.n=y,s=0))}if(i||r>1)return a;throw f=!0,n}return function(i,c,y){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,y),s=c,u=y;(e=s<2?t:u)||!f;){o||(s?s<3?(s>1&&(h.n=-1),p(s,u)):h.n=u:h.v=u);try{if(l=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(f=h.n<0)?u:r.call(n,h))!==a)break}catch(e){o=t,s=1,u=e}finally{l=1}}return{value:e,done:f}}}(r,i,o),!0),l}var a={};function s(){}function u(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(pt(e={},n,function(){return this}),e),f=l.prototype=s.prototype=Object.create(c);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,pt(t,i,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=l,pt(f,"constructor",l),pt(l,"constructor",u),u.displayName="GeneratorFunction",pt(l,i,"GeneratorFunction"),pt(f),pt(f,i,"Generator"),pt(f,n,function(){return this}),pt(f,"toString",function(){return"[object Generator]"}),(ht=function(){return{w:o,m:h}})()}function pt(t,e,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}pt=function(t,e,r,n){function o(e,r){pt(t,e,function(t){return this._invoke(e,r,t)})}e?i?i(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(o("next",0),o("throw",1),o("return",2))},pt(t,e,r,n)}function yt(t){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(t)}function vt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=dt(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function dt(t,e){if(t){if("string"==typeof t)return bt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bt(t,e):void 0}}function bt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function gt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,mt(n.key),n)}}function mt(t){var e=function(t){if("object"!=yt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=yt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yt(e)?e:e+""}var Ot=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r},St=function(){return t=function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._precomputedEvents=null,this._precomputeMode=!1,this._lightweightData=null,this._events=new Map,this.guidCallbacks=new Map,this._options=e,this._provider=r},e=[{key:"generateGUID",value:function(){return"event_".concat(function(){var t,e=new Uint8Array(16),r=null!==(t=globalThis.crypto)&&void 0!==t?t:null===globalThis||void 0===globalThis?void 0:globalThis.msCrypto;if(null==r?void 0:r.getRandomValues)r.getRandomValues(e);else for(var n=0;n<16;n++)e[n]=Math.floor(256*Math.random());e[6]=15&e[6]|64,e[8]=63&e[8]|128;var i=function(t){return(t>>>4).toString(16)+(15&t).toString(16)};return i(e[0])+i(e[1])+i(e[2])+i(e[3])+"-"+i(e[4])+i(e[5])+"-"+i(e[6])+i(e[7])+"-"+i(e[8])+i(e[9])+"-"+i(e[10])+i(e[11])+i(e[12])+i(e[13])+i(e[14])+i(e[15])}())}},{key:"_emitProgress",value:function(t,e,r,n){var i={stage:t,current:e,total:r,percent:r>0?Math.round(e/r*100):0,data:n};this._precomputeMode&&this._precomputedEvents?this._precomputedEvents[t].push(i):(this.trigger("parse:progress",i),this.trigger("parse:".concat(t),i))}},{key:"enablePrecomputeMode",value:function(){this._precomputeMode=!0,this._precomputedEvents={start:[],pathData:[],angleData:[],relativeAngle:[],tilePosition:[],complete:[]}}},{key:"disablePrecomputeMode",value:function(){this._precomputeMode=!1}},{key:"getPrecomputedEvents",value:function(){return this._precomputedEvents}},{key:"clearPrecomputedEvents",value:function(){this._precomputedEvents=null}},{key:"getEventsAtPercent",value:function(t,e){if(!this._precomputedEvents)return[];for(var r=[],n=0,i=e?[e]:["start","pathData","angleData","relativeAngle","tilePosition","complete"];n<i.length;n++){var o,a=i[n],s=vt(this._precomputedEvents[a]);try{for(s.s();!(o=s.n()).done;){var u=o.value;if(u.percent<=t&&(0===r.length||r[r.length-1].percent<=u.percent)){var l=r[r.length-1];l&&l.stage===u.stage&&l.current===u.current||r.push(u)}}}catch(t){s.e(t)}finally{s.f()}}return r}},{key:"getPrecomputedEventCount",value:function(t){return this._precomputedEvents?t?this._precomputedEvents[t].length:Object.values(this._precomputedEvents).reduce(function(t,e){return t+e.length},0):0}},{key:"getLightweightData",value:function(){return this._lightweightData}},{key:"precomputeLightweight",value:function(){for(var t,e,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.tiles.length,i=new Array(n),o=r?[]:new Array(n),a=new Array(n),s=0;s<n;s++){var u=this.tiles[s];i[s]=null!==(t=u.angle)&&void 0!==t?t:0,a[s]=(null!==(e=u.twirl)&&void 0!==e?e:0)%2==1}if(!r){var l,c=[0,0],f=this.angleData,h=new Map,p=vt(this.actions);try{for(p.s();!(l=p.n()).done;){var y=l.value;"PositionTrack"===y.eventType&&y.positionOffset&&!0!==y.editorOnly&&"Enabled"!==y.editorOnly&&h.set(y.floor,y)}}catch(t){p.e(t)}finally{p.f()}for(var v=0;v<n;v++){var d=h.get(v);(null==d?void 0:d.positionOffset)&&(c[0]+=d.positionOffset[0],c[1]+=d.positionOffset[1]),o[v]=[c[0],c[1]];var b=void 0;if(999===f[v]){for(var g=1;v-g>=0&&999===f[v-g];)g++;b=(v-g>=0?f[v-g]:0)+180*(g-1)}else b=f[v];var m=b*Math.PI/180;c[0]+=Math.cos(m),c[1]+=Math.sin(m)}}return this._lightweightData={totalTiles:n,angles:i,positions:o,twirlFlags:a,computed:!0},this._lightweightData}},{key:"getLightweightDataRange",value:function(t,e){if(!this._lightweightData)return null;var r=Math.min(t+e,this._lightweightData.totalTiles);return{angles:this._lightweightData.angles.slice(t,r),positions:this._lightweightData.positions.slice(t,r),twirlFlags:this._lightweightData.twirlFlags.slice(t,r)}}},{key:"clearLightweightData",value:function(){this._lightweightData=null}},{key:"getTileRenderData",value:function(t){var e,r;if(t<0||t>=this.tiles.length)return null;var n=this.tiles[t];return{angle:null!==(e=n.angle)&&void 0!==e?e:0,position:n.position?[n.position[0],n.position[1]]:null,hasTwirl:(null!==(r=n.twirl)&&void 0!==r?r:0)%2==1}}},{key:"load",value:function(){var t=this;return new Promise(function(e,r){var n,i,o=t._options;t._emitProgress("start",0,0);var a=o instanceof ArrayBuffer,s=o instanceof Uint8Array,l="undefined"!=typeof Buffer&&Buffer.isBuffer(o);if("string"==typeof o||a||s||l)try{var c=a?new Uint8Array(o):o;i=null===(n=t._provider)||void 0===n?void 0:n.parse(c)}catch(t){return void r("解析失败: "+t)}else{if("object"!==yt(o)||null===o)return void r("Options must be String, Buffer, ArrayBuffer or Object");i=Object.assign({},o)}var f=i&&"object"===yt(i)&&null!==i&&void 0!==i.pathData,h=i&&"object"===yt(i)&&null!==i&&void 0!==i.angleData;if(f){var p=i.pathData;t._emitProgress("pathData",0,p.length,{source:p}),t.angleData=u.parseToangleData(p),t._emitProgress("pathData",p.length,p.length,{source:p,processed:t.angleData})}else{if(!h)return void r("There is not any angle datas.");t.angleData=i.angleData,t._emitProgress("angleData",t.angleData.length,t.angleData.length,{processed:t.angleData})}i&&"object"===yt(i)&&null!==i&&Array.isArray(i.actions)?t.actions=i.actions:t.actions=[],i&&"object"===yt(i)&&null!==i&&void 0!==i.settings?(t.settings=i.settings,i&&"object"===yt(i)&&null!==i&&Array.isArray(i.decorations)?t.__decorations=i.decorations:t.__decorations=[],t.tiles=[],t._angleDir=-180,t._twirlCount=0,t._createArray(t.angleData.length,{angleData:t.angleData,actions:t.actions,decorations:t.__decorations}).then(function(r){t.tiles=r,t._emitProgress("complete",t.angleData.length,t.angleData.length),t.trigger("load",t),e(!0)}).catch(function(t){r(t)})):r("There is no ADOFAI settings.")})}},{key:"on",value:function(t,e){this._events.has(t)||this._events.set(t,[]);var r=this.generateGUID();return this._events.get(t).push({guid:r,callback:e}),this.guidCallbacks.set(r,{eventName:t,callback:e}),r}},{key:"trigger",value:function(t,e){this._events.has(t)&&this._events.get(t).forEach(function(t){return(0,t.callback)(e)})}},{key:"off",value:function(t){if(this.guidCallbacks.has(t)){var e=this.guidCallbacks.get(t).eventName;if(this.guidCallbacks.delete(t),this._events.has(e)){var r=this._events.get(e),n=r.findIndex(function(e){return e.guid===t});-1!==n&&r.splice(n,1)}}}},{key:"_createArray",value:function(t,e){return r=this,n=void 0,i=void 0,o=ht().m(function r(){var n,i,o,a,s,u,l,c,f,h,p,y,v,d,b,g,m,O;return ht().w(function(r){for(;;)switch(r.n){case 0:if(n=new Array(t),i=Math.max(100,Math.floor(t/100)),o=new Map,Array.isArray(e.actions)){a=vt(e.actions);try{for(a.s();!(s=a.n()).done;)u=s.value,o.has(u.floor)||o.set(u.floor,[]),o.get(u.floor).push(u)}catch(t){a.e(t)}finally{a.f()}}if(l=new Map,Array.isArray(e.decorations)){c=vt(e.decorations);try{for(c.s();!(f=c.n()).done;)h=f.value,l.has(h.floor)||l.set(h.floor,[]),l.get(h.floor).push(h)}catch(t){c.e(t)}finally{c.f()}}p=0;case 1:if(!(p<t)){r.n=3;break}y=o.get(p)||[],v=l.get(p)||[],d=vt(y);try{for(d.s();!(b=d.n()).done;)"Twirl"===b.value.eventType&&this._twirlCount++}catch(t){d.e(t)}finally{d.f()}if(g=this._parseAngle(e.angleData,p,this._twirlCount%2),m=y.map(function(t){return t.floor,Ot(t,["floor"])}),O=v.map(function(t){return t.floor,Ot(t,["floor"])}),n[p]={direction:e.angleData[p],_lastdir:e.angleData[p-1]||0,actions:m,angle:g,addDecorations:O,twirl:this._twirlCount,extraProps:{}},p%i!==0&&p!==t-1){r.n=2;break}if(this._emitProgress("relativeAngle",p+1,t,{tileIndex:p,angle:e.angleData[p],relativeAngle:g}),p%(10*i)!=0){r.n=2;break}return r.n=2,new Promise(function(t){return setTimeout(t,0)});case 2:p++,r.n=1;break;case 3:return r.a(2,n)}},r,this)}),new(i||(i=Promise))(function(t,e){function a(t){try{u(o.next(t))}catch(t){e(t)}}function s(t){try{u(o.throw(t))}catch(t){e(t)}}function u(e){var r;e.done?t(e.value):(r=e.value,r instanceof i?r:new i(function(t){t(r)})).then(a,s)}u((o=o.apply(r,n||[])).next())});var r,n,i,o}},{key:"_changeAngle",value:function(){var t=this,e=0;return this.tiles.map(function(r){return e++,r.angle=t._parsechangedAngle(r.direction,e,r.twirl,r._lastdir),r})}},{key:"_normalizeAngle",value:function(t){return(t%360+360)%360}},{key:"_parsechangedAngle",value:function(t,e,r,n){var i,o=0;if(0===e&&(this._angleDir=180),999===t){for(var a=1;e-a-1>=0&&999===(null===(i=this.tiles[e-a-1])||void 0===i?void 0:i.direction);)a++;var s=e-a-1>=0?this.tiles[e-a-1].direction:0;this._angleDir=this._normalizeAngle(s+180*(a-1)),isNaN(this._angleDir)&&(this._angleDir=0),o=0}else{var u=this._normalizeAngle(this._angleDir-t);0===(o=0===r?u:this._normalizeAngle(360-u))&&(o=360),this._angleDir=this._normalizeAngle(t+180)}return o}},{key:"_filterByFloor",value:function(t,e){if(!Array.isArray(t))return[];var r=t.filter(function(t){return t.floor===e});return this._twirlCount+=r.filter(function(t){return"Twirl"===t.eventType}).length,r.map(function(t){return t.floor,Ot(t,["floor"])})}},{key:"_flattenAngleDatas",value:function(t){return t.map(function(t){return t.direction})}},{key:"_flattenActionsWithFloor",value:function(t){return t.flatMap(function(t,e){return(Array.isArray(null==t?void 0:t.actions)?t.actions:[]).map(function(t){t.floor;var r=Ot(t,["floor"]);return Object.assign({floor:e},r)})})}},{key:"_filterByFloorwithDeco",value:function(t,e){return Array.isArray(t)?t.filter(function(t){return t.floor===e}).map(function(t){return t.floor,Ot(t,["floor"])}):[]}},{key:"_flattenDecorationsWithFloor",value:function(t){return t.flatMap(function(t,e){return(Array.isArray(null==t?void 0:t.addDecorations)?t.addDecorations:[]).map(function(t){t.floor;var r=Ot(t,["floor"]);return Object.assign({floor:e},r)})})}},{key:"_parseAngle",value:function(t,e,r){var n=0;if(0===e&&(this._angleDir=180),999===t[e]){for(var i=1;e-i>=0&&999===t[e-i];)i++;var o=e-i>=0?t[e-i]:0;this._angleDir=this._normalizeAngle(o+180*(i-1)),isNaN(this._angleDir)&&(this._angleDir=0),n=0}else{var a=this._normalizeAngle(this._angleDir-t[e]);0===(n=0===r?a:this._normalizeAngle(360-a))&&(n=360),this._angleDir=this._normalizeAngle(t[e]+180)}return n}},{key:"filterActionsByEventType",value:function(t){return Object.entries(this.tiles).flatMap(function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,e)||dt(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2),r=e[0],n=e[1];return(Array.isArray(n.actions)?n.actions:[]).map(function(t){return{b:t,index:r}})}).filter(function(e){return e.b.eventType===t}).map(function(t){var e=t.b,r=t.index;return{index:Number(r),action:e}})}},{key:"getActionsByIndex",value:function(t,e){var r=this.filterActionsByEventType(t).filter(function(t){return t.index===e});return{count:r.length,actions:r.map(function(t){return t.action})}}},{key:"calculateTileCoordinates",value:function(){console.warn("calculateTileCoordinates is deprecated. Use calculateTilePosition instead.")}},{key:"calculateTilePosition",value:function(){var t,e=this.angleData,r=this.tiles.length,n=[],i=[0,0],o=new Map,a=vt(this.actions);try{for(a.s();!(t=a.n()).done;){var s=t.value;"PositionTrack"===s.eventType&&s.positionOffset&&!0!==s.editorOnly&&"Enabled"!==s.editorOnly&&o.set(s.floor,s)}}catch(t){a.e(t)}finally{a.f()}this._emitProgress("tilePosition",0,r);for(var u=new Array(r),l=0;l<r;l++)if(999===e[l]){for(var c=1;l-c>=0&&999===e[l-c];)c++;var f=l-c>=0?e[l-c]:0;u[l]=f+180*(c-1)}else u[l]=e[l];for(var h=Math.max(100,Math.floor(r/100)),p=0;p<=r;p++){var y=p===r,v=y?u[p-1]||0:u[p],d=0===p?0:u[p-1]||0,b=this.tiles[p],g=o.get(p);(null==g?void 0:g.positionOffset)&&(i[0]+=g.positionOffset[0],i[1]+=g.positionOffset[1]);var m=[i[0],i[1]];n.push(m),b&&(b.position=m,b.extraProps.angle1=v,b.extraProps.angle2=d-180,b.extraProps.cangle=y?u[p-1]+180:u[p]);var O=v*Math.PI/180;i[0]+=Math.cos(O),i[1]+=Math.sin(O),(p%h===0||y)&&this._emitProgress("tilePosition",p,r,{tileIndex:p,position:[m[0],m[1]],angle:v})}return this._emitProgress("tilePosition",r,r,{processed:n.flat()}),n}},{key:"floorOperation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{type:"append",direction:0};switch(t.type){case"append":this.appendFloor(t);break;case"insert":"number"==typeof t.id&&this.tiles.splice(t.id,0,{direction:t.direction||0,angle:0,actions:[],addDecorations:[],_lastdir:this.tiles[t.id-1].direction,twirl:this.tiles[t.id-1].twirl});break;case"delete":"number"==typeof t.id&&this.tiles.splice(t.id,1)}this._changeAngle()}},{key:"appendFloor",value:function(t){this.tiles.push({direction:t.direction,angle:0,actions:[],addDecorations:[],_lastdir:this.tiles[this.tiles.length-1].direction,twirl:this.tiles[this.tiles.length-1].twirl,extraProps:{}}),this._changeAngle()}},{key:"clearDeco",value:function(){return this.tiles=lt(this.tiles),!0}},{key:"clearEffect",value:function(t){this.clearEvent(n[t])}},{key:"clearEvent",value:function(t){t.type==nt.include?this.tiles=ft(t.events,this.tiles):t.type==nt.exclude&&(this.tiles=ct(t.events,this.tiles))}},{key:"export",value:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0,o={angleData:this._flattenAngleDatas(this.tiles),settings:this.settings,actions:this._flattenActionsWithFloor(this.tiles),decorations:this._flattenDecorationsWithFloor(this.tiles)};return"object"===t?o:rt(o,e,r,n,i)}}],e&>(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function kt(t,e){return void 0===t?e:"boolean"==typeof t?t:"Enabled"===t||"true"===t}return e})());
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ADOFAI=t():e.ADOFAI=t()}(globalThis,()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Events:()=>o,Level:()=>Le,Parsers:()=>r,Presets:()=>n,Structure:()=>i,Types:()=>a,pathData:()=>l});var r={};e.r(r),e.d(r,{ArrayBufferParser:()=>Z,BufferParser:()=>_,LargeFileParser:()=>oe,StringParser:()=>z,default:()=>ae});var n={};e.r(n),e.d(n,{preset_inner_no_deco:()=>de,preset_noeffect:()=>pe,preset_noeffect_completely:()=>ye,preset_noholds:()=>he,preset_nomovecamera:()=>ve});var i={};e.r(i),e.d(i,{default:()=>Le});var o={};e.r(o);var a={};e.r(a),e.d(a,{isEventEnabled:()=>Ie,normalizeVec2:()=>Fe,resolveTileReference:()=>Be});var s={R:0,p:15,J:30,E:45,T:60,o:75,U:90,q:105,G:120,Q:135,H:150,W:165,L:180,x:195,N:210,Z:225,F:240,V:255,D:270,Y:285,B:300,C:315,M:330,A:345,"!":999},u={5:72,6:-72,7:52,8:-52,9:-30,h:120,j:-120,t:60,y:300};const l={pathDataTable:s,parseToangleData:function(e){for(var t=new Array(e.length),r=0,n=0;n<e.length;n++){var i=e[n];i in s?(t[n]=s[i],r=s[i]):i in u?(t[n]=r+u[i],r=t[n]):t[n]=r}return t}};function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}const h=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return t=e,r=[{key:"parseError",value:function(e){return e}},{key:"parseAsObject",value:function(t,r){return(r||JSON).parse(e.parseAsText(t))}},{key:"parseAsText",value:function(e){return this.parseError(e)}}],null&&f(t.prototype,null),r&&f(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function y(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,g(n.key),n)}}function d(e,t,r){return t&&y(e.prototype,t),r&&y(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function g(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}const b=d(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)});function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,k(n.key),n)}}function w(e,t,r){return t&&S(e.prototype,t),r&&S(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function k(e){var t=function(e){if("object"!=m(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=m(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}function A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(A=function(){return!!e})()}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function T(e,t){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},T(e,t)}var j=function(e){function t(){return O(this,t),e=this,n=arguments,r=E(r=t),function(e,t){if(t&&("object"==m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,A()?Reflect.construct(r,n||[],E(e).constructor):r.apply(e,n));var e,r,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&T(e,t)}(t,e),w(t,[{key:"parse",value:function(e){var t,r;return t="string"==typeof e?(new TextEncoder).encode(e):(r=e).length>=3&&239===r[0]&&187===r[1]&&191===r[2]?r.subarray(3):r,new P(t).parseValue()}},{key:"stringify",value:function(e){return JSON.stringify(e)}}])}(b),P=function(){return w(function e(t){O(this,e),this.data=t,this.pos=0,this.decoder=new TextDecoder("utf-8"),this.length=t.length},[{key:"parseValue",value:function(){this.eatWhitespace();var e=this.peek();if(-1===e)return null;switch(e){case 123:return this.parseObject();case 91:return this.parseArray();case 34:return this.parseString();case 116:return this.parseKeyword(!0);case 102:return this.parseKeyword(!1);case 110:return this.parseKeyword(null);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.parseNumber();default:return this.pos++,null}}},{key:"parseObject",value:function(){var e={};for(this.pos++;;){if(this.eatWhitespace(),125===this.peek()){this.pos++;break}var t=this.parseString();if(this.eatWhitespace(),58!==this.peek())break;this.pos++,e[t]=this.parseValue(),this.eatWhitespace(),44===this.peek()&&this.pos++}return e}},{key:"parseArray",value:function(){var e=[];for(this.pos++;;){if(this.eatWhitespace(),93===this.peek()){this.pos++;break}e.push(this.parseValue()),this.eatWhitespace(),44===this.peek()&&this.pos++}return e}},{key:"parseString",value:function(){this.pos++;for(var e=this.pos,t=!1;this.pos<this.length;){var r=this.data[this.pos];if(34===r)break;92===r?(t=!0,this.pos+=2):this.pos++}var n=this.pos;this.pos++;var i=this.data.subarray(e,n);return t?this.processEscapes(i):this.decoder.decode(i)}},{key:"processEscapes",value:function(e){for(var t=this.decoder.decode(e),r="",n=0;n<t.length;n++)if("\\"===t[n]&&n+1<t.length){var i=t[++n];switch(i){case'"':case"\\":case"/":r+=i;break;case"b":r+="\b";break;case"f":r+="\f";break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"u":r+=String.fromCharCode(parseInt(t.substr(n+1,4),16)),n+=4}}else r+=t[n];return r}},{key:"parseNumber",value:function(){for(var e=this.pos;this.pos<this.length;){var t=this.data[this.pos];if(!(t>=48&&t<=57||46===t||101===t||69===t||43===t||45===t))break;this.pos++}var r=this.decoder.decode(this.data.subarray(e,this.pos));return parseFloat(r)}},{key:"parseKeyword",value:function(e){var t=this.data[this.pos];return 116===t?this.pos+=4:102===t?this.pos+=5:110===t&&(this.pos+=4),e}},{key:"eatWhitespace",value:function(){for(;this.pos<this.length;){var e=this.data[this.pos];if(32!==e&&10!==e&&13!==e&&9!==e)break;this.pos++}}},{key:"peek",value:function(){return this.pos<this.length?this.data[this.pos]:-1}}])}();const _=j;function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function D(e){return D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D(e)}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,R(n.key),n)}}function M(e,t,r){return t&&C(e.prototype,t),r&&C(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function R(e){var t=function(e){if("object"!=D(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=D(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==D(t)?t:t+""}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(U=function(){return!!e})()}function L(e){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},L(e)}function K(e,t){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},K(e,t)}var I=function(e){function t(){return x(this,t),e=this,n=arguments,r=L(r=t),function(e,t){if(t&&("object"==D(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,U()?Reflect.construct(r,n||[],L(e).constructor):r.apply(e,n));var e,r,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&K(e,t)}(t,e),M(t,[{key:"parse",value:function(e,r){if(null==e)return null;var n=new B(e).parseValue();return"function"==typeof r?t._applyReviver("",n,r):n}},{key:"stringify",value:function(e,t,r){return new F(t,r).serialize(e)}}],[{key:"_applyReviver",value:function(e,r,n){if(r&&"object"===D(r))if(Array.isArray(r))for(var i=0;i<r.length;i++)r[i]=t._applyReviver(i.toString(),r[i],n);else for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(r[o]=t._applyReviver(o,r[o],n));return n(e,r)}}])}(b),B=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;x(this,e),this.json=t,this.position=0,this.endSection=r,65279===this.peek()&&this.read()}return M(e,[{key:"parseValue",value:function(){return this.parseByToken(this.nextToken)}},{key:"parseObject",value:function(){var t={};for(this.read();;){var r=void 0;do{if((r=this.nextToken)===e.TOKEN.NONE)return null;if(r===e.TOKEN.CURLY_CLOSE)return t}while(r===e.TOKEN.COMMA);var n=this.parseString();if(null===n)return null;if(this.nextToken!==e.TOKEN.COLON)return null;if(null!=this.endSection&&n===this.endSection)return t;this.read(),t[n]=this.parseValue()}}},{key:"parseArray",value:function(){var t=[];this.read();for(var r=!0;r;){var n=this.nextToken;switch(n){case e.TOKEN.NONE:return null;case e.TOKEN.SQUARED_CLOSE:r=!1;break;case e.TOKEN.COMMA:break;default:var i=this.parseByToken(n);t.push(i)}}return t}},{key:"parseByToken",value:function(t){switch(t){case e.TOKEN.CURLY_OPEN:return this.parseObject();case e.TOKEN.SQUARED_OPEN:return this.parseArray();case e.TOKEN.STRING:return this.parseString();case e.TOKEN.NUMBER:return this.parseNumber();case e.TOKEN.TRUE:return!0;case e.TOKEN.FALSE:return!1;case e.TOKEN.NULL:default:return null}}},{key:"parseString",value:function(){var e="";this.read();for(var t=!0;t&&-1!==this.peek();){var r=this.nextChar;switch(r){case'"':t=!1;break;case"\\":if(-1===this.peek()){t=!1;break}var n=this.nextChar;switch(n){case'"':case"/":case"\\":e+=n;break;case"b":e+="\b";break;case"f":e+="\f";break;case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"u":for(var i="",o=0;o<4;o++)i+=this.nextChar;e+=String.fromCharCode(Number.parseInt(i,16))}break;default:e+=r}}return e}},{key:"parseNumber",value:function(){var e=this.nextWord;return-1===e.indexOf(".")?Number.parseInt(e,10)||0:Number.parseFloat(e)||0}},{key:"eatWhitespace",value:function(){for(;-1!==e.WHITE_SPACE.indexOf(this.peekChar)&&(this.read(),-1!==this.peek()););}},{key:"peek",value:function(){return this.position>=this.json.length?-1:this.json.charCodeAt(this.position)}},{key:"read",value:function(){return this.position>=this.json.length?-1:this.json.charCodeAt(this.position++)}},{key:"peekChar",get:function(){var e=this.peek();return-1===e?"\0":String.fromCharCode(e)}},{key:"nextChar",get:function(){var e=this.read();return-1===e?"\0":String.fromCharCode(e)}},{key:"nextWord",get:function(){for(var t="";-1===e.WORD_BREAK.indexOf(this.peekChar)&&(t+=this.nextChar,-1!==this.peek()););return t}},{key:"nextToken",get:function(){if(this.eatWhitespace(),-1===this.peek())return e.TOKEN.NONE;switch(this.peekChar){case'"':return e.TOKEN.STRING;case",":return this.read(),e.TOKEN.COMMA;case"-":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return e.TOKEN.NUMBER;case":":return e.TOKEN.COLON;case"[":return e.TOKEN.SQUARED_OPEN;case"]":return this.read(),e.TOKEN.SQUARED_CLOSE;case"{":return e.TOKEN.CURLY_OPEN;case"}":return this.read(),e.TOKEN.CURLY_CLOSE;default:switch(this.nextWord){case"false":return e.TOKEN.FALSE;case"true":return e.TOKEN.TRUE;case"null":return e.TOKEN.NULL;default:return e.TOKEN.NONE}}}}])}();B.WHITE_SPACE=" \t\n\r\ufeff",B.WORD_BREAK=' \t\n\r{}[],:"',B.TOKEN={NONE:0,CURLY_OPEN:1,CURLY_CLOSE:2,SQUARED_OPEN:3,SQUARED_CLOSE:4,COLON:5,COMMA:6,STRING:7,NUMBER:8,TRUE:9,FALSE:10,NULL:11};var F=function(){return M(function e(t,r){x(this,e),this.result="",this.indent=0,this.indentStr="",this.replacer=t||null,this.space=r||null,"number"==typeof r?this.indentStr=" ".repeat(Math.min(10,Math.max(0,r))):"string"==typeof r&&(this.indentStr=r.slice(0,10))},[{key:"serialize",value:function(e){return this.result="",this.serializeValue(e,""),this.result}},{key:"serializeValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";"function"==typeof this.replacer&&(e=this.replacer(t,e)),null==e?this.result+="null":"string"==typeof e?this.serializeString(e):"boolean"==typeof e?this.result+=e.toString():Array.isArray(e)?this.serializeArray(e):"object"===D(e)?this.serializeObject(e):this.serializeOther(e)}},{key:"serializeObject",value:function(e){var t=!0;for(var r in this.result+="{",this.indentStr&&(this.result+="\n",this.indent++),e)if(Object.prototype.hasOwnProperty.call(e,r)){if(Array.isArray(this.replacer)&&!this.replacer.includes(r))continue;t||(this.result+=",",this.indentStr&&(this.result+="\n")),this.indentStr&&(this.result+=this.indentStr.repeat(this.indent)),this.serializeString(r.toString()),this.result+=":",this.indentStr&&(this.result+=" "),this.serializeValue(e[r],r),t=!1}this.indentStr&&(this.result+="\n",this.indent--,this.result+=this.indentStr.repeat(this.indent)),this.result+="}"}},{key:"serializeArray",value:function(e){this.result+="[",this.indentStr&&e.length>0&&(this.result+="\n",this.indent++);for(var t=!0,r=0;r<e.length;r++)t||(this.result+=",",this.indentStr&&(this.result+="\n")),this.indentStr&&(this.result+=this.indentStr.repeat(this.indent)),this.serializeValue(e[r],r.toString()),t=!1;this.indentStr&&e.length>0&&(this.result+="\n",this.indent--,this.result+=this.indentStr.repeat(this.indent)),this.result+="]"}},{key:"serializeString",value:function(e){this.result+='"';var t,r=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return N(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;switch(n){case"\b":this.result+="\\b";break;case"\t":this.result+="\\t";break;case"\n":this.result+="\\n";break;case"\f":this.result+="\\f";break;case"\r":this.result+="\\r";break;case'"':this.result+='\\"';break;case"\\":this.result+="\\\\";break;default:var i=n.charCodeAt(0);this.result+=i>=32&&i<=126?n:"\\u"+i.toString(16).padStart(4,"0")}}}catch(e){r.e(e)}finally{r.f()}this.result+='"'}},{key:"serializeOther",value:function(e){"number"==typeof e?isFinite(e)?this.result+=e.toString():this.result+="null":this.serializeString(e.toString())}}])}();const z=I;function W(e){return W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W(e)}function V(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,J(n.key),n)}}function J(e){var t=function(e){if("object"!=W(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=W(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==W(t)?t:t+""}function G(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(G=function(){return!!e})()}function H(e){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},H(e)}function Q(e,t){return Q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Q(e,t)}var Y=new Uint8Array([239,187,191]),$=new Uint8Array([44]);function q(e){var t=new Uint8Array(e);return t.length>=3&&t[0]===Y[0]&&t[1]===Y[1]&&t[2]===Y[2]?e.slice(3):e}const Z=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,r){return t=H(t),function(e,t){if(t&&("object"==W(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,G()?Reflect.construct(t,r||[],H(e).constructor):t.apply(e,r))}(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Q(e,t)}(t,e),r=t,(n=[{key:"parse",value:function(e){return"string"==typeof e?z.prototype.parse.call(z.prototype,e):z.prototype.parse.call(z.prototype,(t=function(e){for(var t=new Uint8Array(e),r=[],n="other",i=0,o=0;o<t.length;o++){var a=t[o];if("escape"==n)n="string";else switch(a){case 34:switch(n){case"string":n="other";break;case"comma":r.push($);default:n="string"}break;case 92:"string"===n&&(n="escape");break;case 44:r.push(t.subarray(i,o)),i=o+1,"other"===n&&(n="comma");break;case 93:case 125:"comma"===n&&(n="other");break;case 9:case 10:case 11:case 12:case 13:case 32:break;default:"comma"===n&&(r.push($),n="other")}}r.push(t.subarray(i));for(var s=0,u=0,l=r;u<l.length;u++)s+=l[u].length;for(var c=new Uint8Array(s),f=0,p=0,h=r;p<h.length;p++){var v=h[p];c.set(v,f),f+=v.length}return c.buffer}(q(e)),r=q(t),new TextDecoder("utf-8").decode(r)));var t,r}},{key:"stringify",value:function(e){return JSON.stringify(e)}}])&&V(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(b);function X(e){return X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(e)}function ee(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,te(n.key),n)}}function te(e){var t=function(e){if("object"!=X(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=X(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==X(t)?t:t+""}var re=new Uint8Array([239,187,191]);function ne(e,t){if(t>=e.length)return-1;var r=e[t];if(34===r){for(var n=t+1,i=!1;n<e.length;)if(i)i=!1,n++;else if(92!==e[n]){if(34===e[n])return n+1;n++}else i=!0,n++;return-1}if(91===r||123===r){for(var o=91===r?93:125,a=0,s=t,u=!1,l=!1;s<e.length;)if(l)l=!1,s++;else if(92!==e[s])if(34!==e[s]){if(!u)if(e[s]===r)a++;else if(e[s]===o&&0===--a)return s+1;s++}else u=!u,s++;else l=!0,s++;return-1}for(var c=t;c<e.length;){var f=e[c];if(44===f||125===f||93===f||32===f||9===f||10===f||13===f)return c;c++}return c}function ie(e,t,r){return new TextDecoder("utf-8").decode(e.slice(t,r))}const oe=function(){return e=function e(t,r){var n,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.skipLargeActions=!1,this.maxActions=0,this.onProgress=t,r&&(this.skipLargeActions=null!==(n=r.skipLargeActions)&&void 0!==n&&n,this.maxActions=null!==(i=r.maxActions)&&void 0!==i?i:0)},(t=[{key:"parse",value:function(e){var t,r,n,i,o,a,s,u,l,c,f,p=this,h=new Uint8Array(e);h.length>=3&&h[0]===re[0]&&h[1]===re[1]&&h[2]===re[2]&&(h=h.subarray(3)),null===(t=this.onProgress)||void 0===t||t.call(this,"scanning",5);var v=function(e){for(var t=new Map,r=0,n=!1,i=!1,o="",a=-1,s=0;s<e.length;s++){var u=e[s];if(i)i=!1;else if(92!==u)if(34!==u){if(!n)if(123===u)r++;else if(125===u)r--;else if(58===u&&1===r&&o){for(var l=s+1;l<e.length&&(32===e[l]||9===e[l]||10===e[l]||13===e[l]);)l++;t.set(o,l),o="",a=-1}}else n?(n=!1,1===r&&-1!==a&&(o=new TextDecoder("utf-8").decode(e.slice(a,s)))):(n=!0,a=s+1);else i=!0}return t}(h),y=null!==(r=v.get("angleData"))&&void 0!==r?r:-1,d=null!==(n=v.get("pathData"))&&void 0!==n?n:-1,g=null!==(i=v.get("settings"))&&void 0!==i?i:-1,b=null!==(o=v.get("actions"))&&void 0!==o?o:-1,m=null!==(a=v.get("decorations"))&&void 0!==a?a:-1,O={};if(-1!==g){null===(s=this.onProgress)||void 0===s||s.call(this,"parsing_settings",10);var S=ne(h,g);if(-1!==S)try{O.settings=JSON.parse(ie(h,g,S))}catch(e){O.settings={}}}if(-1!==y){null===(u=this.onProgress)||void 0===u||u.call(this,"parsing_angleData",15);var w=function(e,t,r){if(t>=e.length||91!==e[t])return null;for(var n=[],i=t+1,o="",a=1,s=!1,u=!1,l=!1,c=e.length;i<e.length;){var f=e[i];if(u)u=!1,i++;else if(92!==f)if(34!==f){if(s)i++;else if(91===f)a++,i++,l=!1;else if(93===f){if(0===--a){if(o.trim()&&!l){var p=Number(o.trim());isNaN(p)||n.push(p)}return{values:n,endPos:i+1}}i++,l=!1}else if(44===f){if(o.trim()&&!l){var h=Number(o.trim());isNaN(h)||n.push(h)}o="",l=!0,i++}else f>=48&&f<=57||45===f||46===f?(o+=String.fromCharCode(f),l=!1,i++):i++;r&&i%5e6==0&&r(Math.round(i/c*100))}else s=!s,i++;else u=!0,i++}return{values:n,endPos:i}}(h,y,function(e){var t;null===(t=p.onProgress)||void 0===t||t.call(p,"parsing_angleData",15+.25*e)});w&&(O.angleData=w.values)}if(-1!==d){var k=ne(h,d);if(-1!==k){var A=ie(h,d,k);O.pathData=A.slice(1,-1)}}if(-1!==b){var E=ne(h,b),T=E-b;if(null===(l=this.onProgress)||void 0===l||l.call(this,"parsing_actions",50),T>104857600&&this.skipLargeActions)O.actions=[];else if(T>52428800){var j=function(e,t,r,n){if(t>=e.length||91!==e[t])return null;for(var i=[],o=t+1,a=1,s=!1,u=!1,l=-1,c=e.length,f=0;o<e.length&&(32===e[o]||9===e[o]||10===e[o]||13===e[o]);)o++;if(93===e[o])return{values:[],endPos:o+1};for(;o<e.length;){var p=e[o];if(u)u=!1,o++;else if(92!==p)if(34!==p)if(s)o++;else if(123===p)1===a&&-1===l&&(l=o),a++,o++;else if(125===p){if(1===--a&&-1!==l){try{var h=JSON.parse(ie(e,l,o+1));if(i.push(h),f++,n&&f>=n){for(var v=o+1;v<e.length&&93!==e[v];)v++;return{values:i,endPos:v+1}}}catch(e){}l=-1,r&&f%5e4==0&&r(Math.round(o/c*100))}o++}else if(91===p)a++,o++;else if(93===p){if(0===--a)return{values:i,endPos:o+1};o++}else o++;else s=!s,o++;else u=!0,o++}return{values:i,endPos:o}}(h,b,function(e){var t;return null===(t=p.onProgress)||void 0===t?void 0:t.call(p,"parsing_actions",50+.45*e)},this.maxActions||void 0);j&&(O.actions=j.values)}else try{O.actions=JSON.parse(ie(h,b,E))}catch(e){O.actions=[]}}if(-1!==m){null===(c=this.onProgress)||void 0===c||c.call(this,"parsing_decorations",95);var P=ne(h,m);if(-1!==P)try{O.decorations=JSON.parse(ie(h,m,P))}catch(e){O.decorations=[]}}return null===(f=this.onProgress)||void 0===f||f.call(this,"complete",100),O}},{key:"stringify",value:function(e){return JSON.stringify(e)}}])&&ee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),ae=h;function se(e){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},se(e)}function ue(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"\t",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if("object"!==se(e)||null===e)return JSON.stringify(e);if(Array.isArray(e)){if(e.every(function(e){return"object"!==se(e)||null===e}))return"["+e.map(function(e){return ue(e,0,!1,n,i)}).join(",")+"]";var o=n.repeat(t),a=n.repeat(t+i);return"[\n"+e.map(function(e){return a+le(e,n)}).join(",\n")+"\n"+o+"]"}var s=n.repeat(t),u=Object.keys(e);if(r){var l=n.repeat(i);return"{\n"+u.map(function(t){return l+JSON.stringify(t)+": "+ue(e[t],i,!1,n,i)}).join(",\n")+"\n}"}return"{\n"+u.map(function(r){return s+n.repeat(i)+JSON.stringify(r)+": "+ue(e[r],t+i,!1,n,i)}).join(",\n")+"\n"+s+"}"}function le(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"\t";return"object"!==se(e)||null===e?ue(e,0,!1,t):Array.isArray(e)?"["+e.map(function(e){return le(e,t)}).join(",")+"]":"{"+Object.keys(e).map(function(r){return JSON.stringify(r)+": "+le(e[r],t)}).join(", ")+"}"}const ce=ue;var fe,pe={type:"exclude",events:["Flash","SetFilter","SetFilterAdvanced","HallOfMirrors","Bloom","ScalePlanets","ScreenTile","ScreenScroll","ShakeScreen"]},he={type:"exclude",events:["Hold"]},ve={type:"exclude",events:["MoveCamera"]},ye={type:"exclude",events:["AddDecoration","AddText","AddObject","Checkpoint","SetHitsound","PlaySound","SetPlanetRotation","ScalePlanets","ColorTrack","AnimateTrack","RecolorTrack","MoveTrack","PositionTrack","MoveDecorations","SetText","SetObject","SetDefaultText","CustomBackground","Flash","MoveCamera","SetFilter","HallOfMirrors","ShakeScreen","Bloom","ScreenTile","ScreenScroll","SetFrameRate","RepeatEvents","SetConditionalEvents","EditorComment","Bookmark","Hold","SetHoldSound","Hide","ScaleMargin","ScaleRadius"]},de={type:"special",events:["MoveDecorations","SetText","SetObject","SetDefaultText"]};!function(e){e.include="include",e.exclude="exclude",e.special="special"}(fe||(fe={}));const ge=function(e){if(!Array.isArray(e))throw new Error("Arguments are not supported.");return e.map(function(e){var t=Object.assign({},e);return t.hasOwnProperty("addDecorations")&&(t.addDecorations=[]),Array.isArray(t.actions)&&(t.actions=t.actions.filter(function(e){return!de.events.includes(e.eventType)})),t})},be=function(e,t){return t.map(function(t){var r=Object.assign({},t);return Array.isArray(t.actions)&&(r.actions=t.actions.filter(function(t){return!e.includes(t.eventType)})),r})},me=function(e,t){return t.map(function(t){var r=Object.assign({},t);return Array.isArray(t.actions)&&(r.actions=t.actions.filter(function(t){return e.includes(t.eventType)})),r})};function Oe(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var u=n&&n.prototype instanceof s?n:s,l=Object.create(u.prototype);return Se(l,"_invoke",function(r,n,i){var o,s,u,l=0,c=i||[],f=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,r){return o=t,s=0,u=e,p.n=r,a}};function h(r,n){for(s=r,u=n,t=0;!f&&l&&!i&&t<c.length;t++){var i,o=c[t],h=p.p,v=o[2];r>3?(i=v===n)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=h&&((i=r<2&&h<o[1])?(s=0,p.v=n,p.n=o[1]):h<v&&(i=r<3||o[0]>n||n>v)&&(o[4]=r,o[5]=n,p.n=v,s=0))}if(i||r>1)return a;throw f=!0,n}return function(i,c,v){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&h(c,v),s=c,u=v;(t=s<2?e:u)||!f;){o||(s?s<3?(s>1&&(p.n=-1),h(s,u)):p.n=u:p.v=u);try{if(l=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(f=p.n<0)?u:r.call(n,p))!==a)break}catch(t){o=e,s=1,u=t}finally{l=1}}return{value:t,done:f}}}(r,i,o),!0),l}var a={};function s(){}function u(){}function l(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(Se(t={},n,function(){return this}),t),f=l.prototype=s.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Se(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=l,Se(f,"constructor",l),Se(l,"constructor",u),u.displayName="GeneratorFunction",Se(l,i,"GeneratorFunction"),Se(f),Se(f,i,"Generator"),Se(f,n,function(){return this}),Se(f,"toString",function(){return"[object Generator]"}),(Oe=function(){return{w:o,m:p}})()}function Se(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}Se=function(e,t,r,n){function o(t,r){Se(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},Se(e,t,r,n)}function we(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ke(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ke(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Ae=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};function Ee(e){return(e%360+360)%360}function Te(e){return 555===e?72:666===e?-72:777===e?52:888===e?-52:null}function je(e,t,r,n){var i=0;0===t&&(r.value=180);var o=Te(e[t]);if(null!==o){var a=Ee(r.value-180),s=Ee(a+o),u=Ee(r.value-s);0===(i=0===n?u:Ee(360-u))&&(i=360),r.value=Ee(s+180)}else if(999===e[t]){for(var l=1;t-l>=0&&999===e[t-l];)l++;var c=t-l>=0?e[t-l]:0;r.value=Ee(c+180*(l-1)),isNaN(r.value)&&(r.value=0),i=0}else{var f=Ee(r.value-e[t]);0===(i=0===n?f:Ee(360-f))&&(i=360),r.value=Ee(e[t]+180)}return i}function Pe(e,t){return e.flatMap(function(e,t){return(Array.isArray(e.actions)?e.actions:[]).map(function(e){return{a:e,idx:t}})}).filter(function(e){return e.a.eventType===t}).map(function(e){var t=e.a;return{index:e.idx,action:t}})}function _e(e){var t={value:180};return e.map(function(r,n){return r.angle=function(e,t,r,n,i){var o,a=0;0===t&&(r.value=180);var s=Te(e);if(null!==s){var u=Ee(r.value-180),l=Ee(u+s),c=Ee(r.value-l);0===(a=0===n?c:Ee(360-c))&&(a=360),r.value=Ee(l+180)}else if(999===e){for(var f=1;t-f-1>=0&&999===(null===(o=i[t-f-1])||void 0===o?void 0:o.direction);)f++;var p=t-f-1>=0?i[t-f-1].direction:0;r.value=Ee(p+180*(f-1)),isNaN(r.value)&&(r.value=0),a=0}else{var h=Ee(r.value-e);0===(a=0===n?h:Ee(360-h))&&(a=360),r.value=Ee(e+180)}return a}(r.direction,n+1,t,r.twirl,e),r})}function Ne(e){return e.flatMap(function(e,t){return(Array.isArray(null==e?void 0:e.actions)?e.actions:[]).map(function(e){return Object.assign({floor:t},e)})})}function De(e){return e.flatMap(function(e,t){return(Array.isArray(null==e?void 0:e.addDecorations)?e.addDecorations:[]).map(function(e){return Object.assign({floor:t},e)})})}function xe(e){return xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xe(e)}function Ce(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return Me(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Me(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Me(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Re(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Ue(n.key),n)}}function Ue(e){var t=function(e){if("object"!=xe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=xe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xe(t)?t:t+""}var Le=function(){return e=function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._precomputedEvents=null,this._precomputeMode=!1,this._lightweightData=null,this._events=new Map,this.guidCallbacks=new Map,this._options=t,this._provider=r},t=[{key:"generateGUID",value:function(){return"event_".concat(function(){var e,t=new Uint8Array(16),r=null!==(e=globalThis.crypto)&&void 0!==e?e:null===globalThis||void 0===globalThis?void 0:globalThis.msCrypto;if(null==r?void 0:r.getRandomValues)r.getRandomValues(t);else for(var n=0;n<16;n++)t[n]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;var i=function(e){return(e>>>4).toString(16)+(15&e).toString(16)};return i(t[0])+i(t[1])+i(t[2])+i(t[3])+"-"+i(t[4])+i(t[5])+"-"+i(t[6])+i(t[7])+"-"+i(t[8])+i(t[9])+"-"+i(t[10])+i(t[11])+i(t[12])+i(t[13])+i(t[14])+i(t[15])}())}},{key:"_emitProgress",value:function(e,t,r,n){var i={stage:e,current:t,total:r,percent:r>0?Math.round(t/r*100):0,data:n};this._precomputeMode&&this._precomputedEvents?this._precomputedEvents[e].push(i):(this.trigger("parse:progress",i),this.trigger("parse:".concat(e),i))}},{key:"enablePrecomputeMode",value:function(){this._precomputeMode=!0,this._precomputedEvents={start:[],pathData:[],angleData:[],relativeAngle:[],tilePosition:[],complete:[]}}},{key:"disablePrecomputeMode",value:function(){this._precomputeMode=!1}},{key:"getPrecomputedEvents",value:function(){return this._precomputedEvents}},{key:"clearPrecomputedEvents",value:function(){this._precomputedEvents=null}},{key:"getEventsAtPercent",value:function(e,t){if(!this._precomputedEvents)return[];for(var r=[],n=0,i=t?[t]:["start","pathData","angleData","relativeAngle","tilePosition","complete"];n<i.length;n++){var o,a=i[n],s=Ce(this._precomputedEvents[a]);try{for(s.s();!(o=s.n()).done;){var u=o.value;if(u.percent<=e&&(0===r.length||r[r.length-1].percent<=u.percent)){var l=r[r.length-1];l&&l.stage===u.stage&&l.current===u.current||r.push(u)}}}catch(e){s.e(e)}finally{s.f()}}return r}},{key:"getPrecomputedEventCount",value:function(e){return this._precomputedEvents?e?this._precomputedEvents[e].length:Object.values(this._precomputedEvents).reduce(function(e,t){return e+t.length},0):0}},{key:"getLightweightData",value:function(){return this._lightweightData}},{key:"precomputeLightweight",value:function(){for(var e,t,r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.tiles.length,i=new Array(n),o=r?[]:new Array(n),a=new Array(n),s=0;s<n;s++){var u=this.tiles[s];i[s]=null!==(e=u.angle)&&void 0!==e?e:0,a[s]=(null!==(t=u.twirl)&&void 0!==t?t:0)%2==1}if(!r)for(var l=function(e,t,r){var n,i=new Array(t),o=new Array(t),a=[0,0],s=new Map,u=we(r);try{for(u.s();!(n=u.n()).done;){var l=n.value;"PositionTrack"===l.eventType&&l.positionOffset&&!0!==l.editorOnly&&"Enabled"!==l.editorOnly&&s.set(l.floor,l)}}catch(e){u.e(e)}finally{u.f()}for(var c=0;c<t;c++){var f=s.get(c);(null==f?void 0:f.positionOffset)&&(a[0]+=f.positionOffset[0],a[1]+=f.positionOffset[1]),i[c]=[a[0],a[1]];var p=Te(e[c]);if(null!==p)o[c]=(c>0?o[c-1]:0)+p;else if(999===e[c]){for(var h=1;c-h>=0&&999===e[c-h];)h++;var v=c-h>=0?e[c-h]:0;o[c]=v+180*(h-1)}else o[c]=e[c];var y=o[c]*Math.PI/180;a[0]+=Math.cos(y),a[1]+=Math.sin(y)}return{positions:i,angles:o}}(this.angleData,n,this.actions),c=0;c<n;c++)o[c]=l.positions[c];return this._lightweightData={totalTiles:n,angles:i,positions:o,twirlFlags:a,computed:!0},this._lightweightData}},{key:"getLightweightDataRange",value:function(e,t){if(!this._lightweightData)return null;var r=Math.min(e+t,this._lightweightData.totalTiles);return{angles:this._lightweightData.angles.slice(e,r),positions:this._lightweightData.positions.slice(e,r),twirlFlags:this._lightweightData.twirlFlags.slice(e,r)}}},{key:"clearLightweightData",value:function(){this._lightweightData=null}},{key:"getTileRenderData",value:function(e){var t,r;if(e<0||e>=this.tiles.length)return null;var n=this.tiles[e];return{angle:null!==(t=n.angle)&&void 0!==t?t:0,position:n.position?[n.position[0],n.position[1]]:null,hasTwirl:(null!==(r=n.twirl)&&void 0!==r?r:0)%2==1}}},{key:"load",value:function(){var e=this;return new Promise(function(t,r){var n,i,o=e._options;e._emitProgress("start",0,0);var a=o instanceof ArrayBuffer,s=o instanceof Uint8Array,u="undefined"!=typeof Buffer&&Buffer.isBuffer(o);if("string"==typeof o||a||s||u)try{var c=a?new Uint8Array(o):o;i=null===(n=e._provider)||void 0===n?void 0:n.parse(c)}catch(e){return void r("解析失败: "+e)}else{if("object"!==xe(o)||null===o)return void r("Options must be String, Buffer, ArrayBuffer or Object");i=Object.assign({},o)}var f=i&&"object"===xe(i)&&null!==i&&void 0!==i.pathData,p=i&&"object"===xe(i)&&null!==i&&void 0!==i.angleData;if(f){var h=i.pathData;e._emitProgress("pathData",0,h.length,{source:h}),e.angleData=l.parseToangleData(h),e._emitProgress("pathData",h.length,h.length,{source:h,processed:e.angleData})}else{if(!p)return void r("There is not any angle datas.");e.angleData=i.angleData,e._emitProgress("angleData",e.angleData.length,e.angleData.length,{processed:e.angleData})}if(i&&"object"===xe(i)&&null!==i&&Array.isArray(i.actions)?e.actions=i.actions:e.actions=[],i&&"object"===xe(i)&&null!==i&&void 0!==i.settings){e.settings=i.settings,i&&"object"===xe(i)&&null!==i&&Array.isArray(i.decorations)?e.__decorations=i.decorations:e.__decorations=[],e.tiles=[];var v=0;(function(e,t,r){return n=this,i=void 0,o=void 0,a=Oe().m(function n(){var i,o,a,s,u,l,c,f,p,h,v,y,d,g,b,m,O,S,w;return Oe().w(function(n){for(;;)switch(n.n){case 0:if(i=new Array(e),o=Math.max(100,Math.floor(e/100)),a=new Map,Array.isArray(t.actions)){s=we(t.actions);try{for(s.s();!(u=s.n()).done;)l=u.value,a.has(l.floor)||a.set(l.floor,[]),a.get(l.floor).push(l)}catch(e){s.e(e)}finally{s.f()}}if(c=new Map,Array.isArray(t.decorations)){f=we(t.decorations);try{for(f.s();!(p=f.n()).done;)h=p.value,c.has(h.floor)||c.set(h.floor,[]),c.get(h.floor).push(h)}catch(e){f.e(e)}finally{f.f()}}v={value:180},y=0;case 1:if(!(y<e)){n.n=3;break}d=a.get(y)||[],g=c.get(y)||[],b=we(d);try{for(b.s();!(m=b.n()).done;)"Twirl"===m.value.eventType&&r.onTwirl(r.getTwirl()+1)}catch(e){b.e(e)}finally{b.f()}if(O=je(t.angleData,y,v,r.getTwirl()%2),S=d.map(function(e){return e.floor,Ae(e,["floor"])}),w=g.map(function(e){return e.floor,Ae(e,["floor"])}),i[y]={direction:t.angleData[y],_lastdir:t.angleData[y-1]||0,actions:S,angle:O,addDecorations:w,twirl:r.getTwirl(),extraProps:{}},y%o!==0&&y!==e-1){n.n=2;break}if(r.onProgress("relativeAngle",y+1,e,{tileIndex:y,angle:t.angleData[y],relativeAngle:O}),y%(10*o)!=0){n.n=2;break}return n.n=2,new Promise(function(e){return setTimeout(e,0)});case 2:y++,n.n=1;break;case 3:return n.a(2,i)}},n)}),new(o||(o=Promise))(function(e,t){function r(e){try{u(a.next(e))}catch(e){t(e)}}function s(e){try{u(a.throw(e))}catch(e){t(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o(function(e){e(n)})).then(r,s)}u((a=a.apply(n,i||[])).next())});var n,i,o,a})(e.angleData.length,{angleData:e.angleData,actions:e.actions,decorations:e.__decorations},{onProgress:function(t,r,n,i){return e._emitProgress(t,r,n,i)},onTwirl:function(e){v=e},getTwirl:function(){return v}}).then(function(r){e.tiles=r,e._emitProgress("complete",e.angleData.length,e.angleData.length),e.trigger("load",e),t(!0)}).catch(function(e){r(e)})}else r("There is no ADOFAI settings.")})}},{key:"on",value:function(e,t){this._events.has(e)||this._events.set(e,[]);var r=this.generateGUID();return this._events.get(e).push({guid:r,callback:t}),this.guidCallbacks.set(r,{eventName:e,callback:t}),r}},{key:"trigger",value:function(e,t){this._events.has(e)&&this._events.get(e).forEach(function(e){return(0,e.callback)(t)})}},{key:"off",value:function(e){if(this.guidCallbacks.has(e)){var t=this.guidCallbacks.get(e).eventName;if(this.guidCallbacks.delete(e),this._events.has(t)){var r=this._events.get(t),n=r.findIndex(function(t){return t.guid===e});-1!==n&&r.splice(n,1)}}}},{key:"filterActionsByEventType",value:function(e){return Pe(this.tiles,e)}},{key:"getActionsByIndex",value:function(e,t){return function(e,t,r){var n=Pe(e,t).filter(function(e){return e.index===r});return{count:n.length,actions:n.map(function(e){return e.action})}}(this.tiles,e,t)}},{key:"calculateTileCoordinates",value:function(){console.warn("calculateTileCoordinates is deprecated. Use calculateTilePosition instead.")}},{key:"calculateTilePosition",value:function(){var e=this;return function(e,t,r,n){var i,o=t.length,a=[],s=[0,0],u=new Map,l=we(r);try{for(l.s();!(i=l.n()).done;){var c=i.value;"PositionTrack"===c.eventType&&c.positionOffset&&!0!==c.editorOnly&&"Enabled"!==c.editorOnly&&u.set(c.floor,c)}}catch(e){l.e(e)}finally{l.f()}n("tilePosition",0,o);for(var f=new Array(o),p=0;p<o;p++){var h=Te(e[p]);f[p]=null!==h?(p>0?f[p-1]:0)+h:e[p]}for(var v=0;v<o;v++)if(999===f[v]){for(var y=1;v-y>=0&&999===f[v-y];)y++;var d=v-y>=0?f[v-y]:0;f[v]=d+180*(y-1)}for(var g=Math.max(100,Math.floor(o/100)),b=0;b<=o;b++){var m=b===o,O=m?f[b-1]||0:f[b],S=0===b?0:f[b-1]||0,w=t[b],k=u.get(b);(null==k?void 0:k.positionOffset)&&(s[0]+=k.positionOffset[0],s[1]+=k.positionOffset[1]);var A=[s[0],s[1]];a.push(A),w&&(w.position=A,w.extraProps.angle1=O,w.extraProps.angle2=S-180,w.extraProps.cangle=m?f[b-1]+180:f[b]);var E=O*Math.PI/180;s[0]+=Math.cos(E),s[1]+=Math.sin(E),(b%g===0||m)&&n("tilePosition",b,o,{tileIndex:b,position:[A[0],A[1]],angle:O})}return n("tilePosition",o,o,{processed:a.flat()}),a}(this.angleData,this.tiles,this.actions,function(t,r,n,i){return e._emitProgress(t,r,n,i)})}},{key:"floorOperation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{type:"append",direction:0};switch(e.type){case"append":this.appendFloor(e);break;case"insert":"number"==typeof e.id&&this.tiles.splice(e.id,0,{direction:e.direction||0,angle:0,actions:[],addDecorations:[],_lastdir:this.tiles[e.id-1].direction,twirl:this.tiles[e.id-1].twirl});break;case"delete":"number"==typeof e.id&&this.tiles.splice(e.id,1)}_e(this.tiles)}},{key:"appendFloor",value:function(e){this.tiles.push({direction:e.direction,angle:0,actions:[],addDecorations:[],_lastdir:this.tiles[this.tiles.length-1].direction,twirl:this.tiles[this.tiles.length-1].twirl,extraProps:{}}),_e(this.tiles)}},{key:"clearDeco",value:function(){return this.tiles=ge(this.tiles),!0}},{key:"clearEffect",value:function(e){this.clearEvent(n[e])}},{key:"clearEvent",value:function(e){e.type==fe.include?this.tiles=me(e.events,this.tiles):e.type==fe.exclude&&(this.tiles=be(e.events,this.tiles))}},{key:"export",value:function(e,t){var r,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a={angleData:(r=this.tiles,r.map(function(e){return e.direction})),settings:this.settings,actions:Ne(this.tiles),decorations:De(this.tiles)};return"object"===e?a:ce(a,t,n,i,o)}}],t&&Re(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ie(e,t){return void 0===e?t:"boolean"==typeof e?e:"Enabled"===e||"true"===e}function Be(e,t,r){if(!e)return t;var n,i,o,a=(o=2,function(e){if(Array.isArray(e))return e}(i=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,i=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(i,o)||function(e,t){if(e){if("string"==typeof e)return Ke(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ke(e,t):void 0}}(i,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=a[0];switch(a[1]){case"Start":n=s;break;case"End":n=r-1+s;break;default:n=t+s}return Math.max(0,Math.min(n,r-1))}function Fe(e){var t,r,n,i;return e?Array.isArray(e)?[null!==(t=e[0])&&void 0!==t?t:0,null!==(r=e[1])&&void 0!==r?r:0]:[null!==(n=e.x)&&void 0!==n?n:0,null!==(i=e.y)&&void 0!==i?i:0]:[0,0]}return t})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adofai",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -60,6 +60,11 @@
|
|
|
60
60
|
"default": "./dist/src/types.js"
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"webpack": "webpack",
|
|
65
|
+
"tsc": "tsc",
|
|
66
|
+
"build": "webpack && pnpm tsc"
|
|
67
|
+
},
|
|
63
68
|
"keywords": [
|
|
64
69
|
"adofai",
|
|
65
70
|
"adofai-js",
|
|
@@ -88,10 +93,5 @@
|
|
|
88
93
|
"webpack": "^5.99.9",
|
|
89
94
|
"webpack-cli": "^6.0.1"
|
|
90
95
|
},
|
|
91
|
-
"dependencies": {}
|
|
92
|
-
|
|
93
|
-
"webpack": "webpack",
|
|
94
|
-
"tsc": "tsc",
|
|
95
|
-
"build": "webpack && pnpm tsc"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
96
|
+
"dependencies": {}
|
|
97
|
+
}
|