adofai 3.1.0 → 3.2.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.
@@ -0,0 +1,20 @@
1
+ export interface LargeFileParseResult {
2
+ settings?: any;
3
+ angleData?: number[];
4
+ pathData?: string;
5
+ actions?: any[];
6
+ decorations?: any[];
7
+ }
8
+ export interface LargeFileParserOptions {
9
+ skipLargeActions?: boolean;
10
+ maxActions?: number;
11
+ }
12
+ export declare class LargeFileParser {
13
+ private onProgress?;
14
+ private skipLargeActions;
15
+ private maxActions;
16
+ constructor(onProgress?: (stage: string, percent: number) => void, options?: LargeFileParserOptions);
17
+ parse(input: ArrayBuffer): LargeFileParseResult;
18
+ stringify(obj: any): string;
19
+ }
20
+ export default LargeFileParser;
@@ -0,0 +1,382 @@
1
+ const BOM = new Uint8Array([0xef, 0xbb, 0xbf]);
2
+ function findAllPropertiesAtRoot(buffer) {
3
+ const result = new Map();
4
+ let depth = 0;
5
+ let inString = false;
6
+ let escapeNext = false;
7
+ let propertyName = '';
8
+ let propertyNameStart = -1;
9
+ for (let i = 0; i < buffer.length; i++) {
10
+ const byte = buffer[i];
11
+ if (escapeNext) {
12
+ escapeNext = false;
13
+ continue;
14
+ }
15
+ if (byte === 92) {
16
+ escapeNext = true;
17
+ continue;
18
+ }
19
+ if (byte === 34) {
20
+ if (inString) {
21
+ inString = false;
22
+ if (depth === 1 && propertyNameStart !== -1) {
23
+ const decoder = new TextDecoder('utf-8');
24
+ propertyName = decoder.decode(buffer.slice(propertyNameStart, i));
25
+ }
26
+ }
27
+ else {
28
+ inString = true;
29
+ propertyNameStart = i + 1;
30
+ }
31
+ continue;
32
+ }
33
+ if (!inString) {
34
+ if (byte === 123) {
35
+ depth++;
36
+ }
37
+ else if (byte === 125) {
38
+ depth--;
39
+ }
40
+ else if (byte === 58 && depth === 1 && propertyName) {
41
+ let pos = i + 1;
42
+ while (pos < buffer.length && (buffer[pos] === 32 || buffer[pos] === 9 || buffer[pos] === 10 || buffer[pos] === 13)) {
43
+ pos++;
44
+ }
45
+ result.set(propertyName, pos);
46
+ propertyName = '';
47
+ propertyNameStart = -1;
48
+ }
49
+ }
50
+ }
51
+ return result;
52
+ }
53
+ function findValueEnd(buffer, startPos) {
54
+ if (startPos >= buffer.length)
55
+ return -1;
56
+ const firstChar = buffer[startPos];
57
+ if (firstChar === 34) {
58
+ let i = startPos + 1;
59
+ let escapeNext = false;
60
+ while (i < buffer.length) {
61
+ if (escapeNext) {
62
+ escapeNext = false;
63
+ i++;
64
+ continue;
65
+ }
66
+ if (buffer[i] === 92) {
67
+ escapeNext = true;
68
+ i++;
69
+ continue;
70
+ }
71
+ if (buffer[i] === 34)
72
+ return i + 1;
73
+ i++;
74
+ }
75
+ return -1;
76
+ }
77
+ if (firstChar === 91 || firstChar === 123) {
78
+ const closeChar = firstChar === 91 ? 93 : 125;
79
+ let depth = 0;
80
+ let i = startPos;
81
+ let inString = false;
82
+ let escapeNext = false;
83
+ while (i < buffer.length) {
84
+ if (escapeNext) {
85
+ escapeNext = false;
86
+ i++;
87
+ continue;
88
+ }
89
+ if (buffer[i] === 92) {
90
+ escapeNext = true;
91
+ i++;
92
+ continue;
93
+ }
94
+ if (buffer[i] === 34) {
95
+ inString = !inString;
96
+ i++;
97
+ continue;
98
+ }
99
+ if (!inString) {
100
+ if (buffer[i] === firstChar) {
101
+ depth++;
102
+ }
103
+ else if (buffer[i] === closeChar) {
104
+ depth--;
105
+ if (depth === 0)
106
+ return i + 1;
107
+ }
108
+ }
109
+ i++;
110
+ }
111
+ return -1;
112
+ }
113
+ let i = startPos;
114
+ while (i < buffer.length) {
115
+ const byte = buffer[i];
116
+ if (byte === 44 || byte === 125 || byte === 93 || byte === 32 || byte === 9 || byte === 10 || byte === 13) {
117
+ return i;
118
+ }
119
+ i++;
120
+ }
121
+ return i;
122
+ }
123
+ function extractValueAsString(buffer, startPos, endPos) {
124
+ const decoder = new TextDecoder('utf-8');
125
+ return decoder.decode(buffer.slice(startPos, endPos));
126
+ }
127
+ function parseNumberArrayIncremental(buffer, startPos, onProgress) {
128
+ if (startPos >= buffer.length || buffer[startPos] !== 91)
129
+ return null;
130
+ const values = [];
131
+ let i = startPos + 1;
132
+ let currentValue = '';
133
+ let depth = 1;
134
+ let inString = false;
135
+ let escapeNext = false;
136
+ let lastWasComma = false;
137
+ const totalLength = buffer.length;
138
+ while (i < buffer.length) {
139
+ const byte = buffer[i];
140
+ if (escapeNext) {
141
+ escapeNext = false;
142
+ i++;
143
+ continue;
144
+ }
145
+ if (byte === 92) {
146
+ escapeNext = true;
147
+ i++;
148
+ continue;
149
+ }
150
+ if (byte === 34) {
151
+ inString = !inString;
152
+ i++;
153
+ continue;
154
+ }
155
+ if (!inString) {
156
+ if (byte === 91) {
157
+ depth++;
158
+ i++;
159
+ lastWasComma = false;
160
+ }
161
+ else if (byte === 93) {
162
+ depth--;
163
+ if (depth === 0) {
164
+ if (currentValue.trim() && !lastWasComma) {
165
+ const num = Number(currentValue.trim());
166
+ if (!isNaN(num))
167
+ values.push(num);
168
+ }
169
+ return { values, endPos: i + 1 };
170
+ }
171
+ i++;
172
+ lastWasComma = false;
173
+ }
174
+ else if (byte === 44) {
175
+ if (currentValue.trim() && !lastWasComma) {
176
+ const num = Number(currentValue.trim());
177
+ if (!isNaN(num))
178
+ values.push(num);
179
+ }
180
+ currentValue = '';
181
+ lastWasComma = true;
182
+ i++;
183
+ }
184
+ else if ((byte >= 48 && byte <= 57) || byte === 45 || byte === 46) {
185
+ currentValue += String.fromCharCode(byte);
186
+ lastWasComma = false;
187
+ i++;
188
+ }
189
+ else if (byte === 32 || byte === 9 || byte === 10 || byte === 13) {
190
+ i++;
191
+ }
192
+ else {
193
+ i++;
194
+ }
195
+ }
196
+ else {
197
+ i++;
198
+ }
199
+ if (onProgress && i % 5000000 === 0) {
200
+ onProgress(Math.round((i / totalLength) * 100));
201
+ }
202
+ }
203
+ return { values, endPos: i };
204
+ }
205
+ function parseObjectArrayIncremental(buffer, startPos, onProgress, maxObjects) {
206
+ if (startPos >= buffer.length || buffer[startPos] !== 91)
207
+ return null;
208
+ const values = [];
209
+ let i = startPos + 1;
210
+ let depth = 1;
211
+ let inString = false;
212
+ let escapeNext = false;
213
+ let objectStart = -1;
214
+ const totalLength = buffer.length;
215
+ let objectCount = 0;
216
+ while (i < buffer.length && (buffer[i] === 32 || buffer[i] === 9 || buffer[i] === 10 || buffer[i] === 13)) {
217
+ i++;
218
+ }
219
+ if (buffer[i] === 93) {
220
+ return { values: [], endPos: i + 1 };
221
+ }
222
+ while (i < buffer.length) {
223
+ const byte = buffer[i];
224
+ if (escapeNext) {
225
+ escapeNext = false;
226
+ i++;
227
+ continue;
228
+ }
229
+ if (byte === 92) {
230
+ escapeNext = true;
231
+ i++;
232
+ continue;
233
+ }
234
+ if (byte === 34) {
235
+ inString = !inString;
236
+ i++;
237
+ continue;
238
+ }
239
+ if (!inString) {
240
+ if (byte === 123) {
241
+ if (depth === 1 && objectStart === -1)
242
+ objectStart = i;
243
+ depth++;
244
+ i++;
245
+ }
246
+ else if (byte === 125) {
247
+ depth--;
248
+ if (depth === 1 && objectStart !== -1) {
249
+ try {
250
+ const obj = JSON.parse(extractValueAsString(buffer, objectStart, i + 1));
251
+ values.push(obj);
252
+ objectCount++;
253
+ if (maxObjects && objectCount >= maxObjects) {
254
+ let searchPos = i + 1;
255
+ while (searchPos < buffer.length && buffer[searchPos] !== 93)
256
+ searchPos++;
257
+ return { values, endPos: searchPos + 1 };
258
+ }
259
+ }
260
+ catch (e) { /* skip malformed objects */ }
261
+ objectStart = -1;
262
+ if (onProgress && objectCount % 50000 === 0) {
263
+ onProgress(Math.round((i / totalLength) * 100));
264
+ }
265
+ }
266
+ i++;
267
+ }
268
+ else if (byte === 91) {
269
+ depth++;
270
+ i++;
271
+ }
272
+ else if (byte === 93) {
273
+ depth--;
274
+ if (depth === 0)
275
+ return { values, endPos: i + 1 };
276
+ i++;
277
+ }
278
+ else {
279
+ i++;
280
+ }
281
+ }
282
+ else {
283
+ i++;
284
+ }
285
+ }
286
+ return { values, endPos: i };
287
+ }
288
+ export class LargeFileParser {
289
+ constructor(onProgress, options) {
290
+ var _a, _b;
291
+ this.skipLargeActions = false;
292
+ this.maxActions = 0;
293
+ this.onProgress = onProgress;
294
+ if (options) {
295
+ this.skipLargeActions = (_a = options.skipLargeActions) !== null && _a !== void 0 ? _a : false;
296
+ this.maxActions = (_b = options.maxActions) !== null && _b !== void 0 ? _b : 0;
297
+ }
298
+ }
299
+ parse(input) {
300
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
301
+ let view = new Uint8Array(input);
302
+ if (view.length >= 3 && view[0] === BOM[0] && view[1] === BOM[1] && view[2] === BOM[2]) {
303
+ view = view.subarray(3);
304
+ }
305
+ (_a = this.onProgress) === null || _a === void 0 ? void 0 : _a.call(this, 'scanning', 5);
306
+ const properties = findAllPropertiesAtRoot(view);
307
+ const angleDataPos = (_b = properties.get('angleData')) !== null && _b !== void 0 ? _b : -1;
308
+ const pathDataPos = (_c = properties.get('pathData')) !== null && _c !== void 0 ? _c : -1;
309
+ const settingsPos = (_d = properties.get('settings')) !== null && _d !== void 0 ? _d : -1;
310
+ const actionsPos = (_e = properties.get('actions')) !== null && _e !== void 0 ? _e : -1;
311
+ const decorationsPos = (_f = properties.get('decorations')) !== null && _f !== void 0 ? _f : -1;
312
+ const result = {};
313
+ if (settingsPos !== -1) {
314
+ (_g = this.onProgress) === null || _g === void 0 ? void 0 : _g.call(this, 'parsing_settings', 10);
315
+ const settingsEnd = findValueEnd(view, settingsPos);
316
+ if (settingsEnd !== -1) {
317
+ try {
318
+ result.settings = JSON.parse(extractValueAsString(view, settingsPos, settingsEnd));
319
+ }
320
+ catch (e) {
321
+ result.settings = {};
322
+ }
323
+ }
324
+ }
325
+ if (angleDataPos !== -1) {
326
+ (_h = this.onProgress) === null || _h === void 0 ? void 0 : _h.call(this, 'parsing_angleData', 15);
327
+ const angleResult = parseNumberArrayIncremental(view, angleDataPos, (p) => {
328
+ var _a;
329
+ (_a = this.onProgress) === null || _a === void 0 ? void 0 : _a.call(this, 'parsing_angleData', 15 + p * 0.25);
330
+ });
331
+ if (angleResult) {
332
+ result.angleData = angleResult.values;
333
+ }
334
+ }
335
+ if (pathDataPos !== -1) {
336
+ const pathEnd = findValueEnd(view, pathDataPos);
337
+ if (pathEnd !== -1) {
338
+ const pathStr = extractValueAsString(view, pathDataPos, pathEnd);
339
+ result.pathData = pathStr.slice(1, -1);
340
+ }
341
+ }
342
+ if (actionsPos !== -1) {
343
+ const actionsEnd = findValueEnd(view, actionsPos);
344
+ const actionsSize = actionsEnd - actionsPos;
345
+ (_j = this.onProgress) === null || _j === void 0 ? void 0 : _j.call(this, 'parsing_actions', 50);
346
+ if (actionsSize > 100 * 1024 * 1024 && this.skipLargeActions) {
347
+ result.actions = [];
348
+ }
349
+ else if (actionsSize > 50 * 1024 * 1024) {
350
+ const actionsResult = parseObjectArrayIncremental(view, actionsPos, (p) => { var _a; return (_a = this.onProgress) === null || _a === void 0 ? void 0 : _a.call(this, 'parsing_actions', 50 + p * 0.45); }, this.maxActions || undefined);
351
+ if (actionsResult)
352
+ result.actions = actionsResult.values;
353
+ }
354
+ else {
355
+ try {
356
+ result.actions = JSON.parse(extractValueAsString(view, actionsPos, actionsEnd));
357
+ }
358
+ catch (e) {
359
+ result.actions = [];
360
+ }
361
+ }
362
+ }
363
+ if (decorationsPos !== -1) {
364
+ (_k = this.onProgress) === null || _k === void 0 ? void 0 : _k.call(this, 'parsing_decorations', 95);
365
+ const decorationsEnd = findValueEnd(view, decorationsPos);
366
+ if (decorationsEnd !== -1) {
367
+ try {
368
+ result.decorations = JSON.parse(extractValueAsString(view, decorationsPos, decorationsEnd));
369
+ }
370
+ catch (e) {
371
+ result.decorations = [];
372
+ }
373
+ }
374
+ }
375
+ (_l = this.onProgress) === null || _l === void 0 ? void 0 : _l.call(this, 'complete', 100);
376
+ return result;
377
+ }
378
+ stringify(obj) {
379
+ return JSON.stringify(obj);
380
+ }
381
+ }
382
+ export default LargeFileParser;
@@ -2,5 +2,6 @@ import Parser from "./parser/index";
2
2
  import BufferParser from './parser/BufferParser';
3
3
  import ArrayBufferParser from "./parser/ArrayBufferParser";
4
4
  import StringParser from "./parser/StringParser";
5
- export { StringParser, BufferParser, ArrayBufferParser };
5
+ import LargeFileParser from "./parser/LargeFileParser";
6
+ export { StringParser, BufferParser, ArrayBufferParser, LargeFileParser };
6
7
  export default Parser;
@@ -2,5 +2,6 @@ import Parser from "./parser/index";
2
2
  import BufferParser from './parser/BufferParser';
3
3
  import ArrayBufferParser from "./parser/ArrayBufferParser";
4
4
  import StringParser from "./parser/StringParser";
5
- export { StringParser, BufferParser, ArrayBufferParser };
5
+ import LargeFileParser from "./parser/LargeFileParser";
6
+ export { StringParser, BufferParser, ArrayBufferParser, LargeFileParser };
6
7
  export default Parser;
@@ -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&&gt(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:()=>Te,Parsers:()=>r,Presets:()=>n,Structure:()=>i,Types:()=>a,pathData:()=>l});var r={};e.r(r),e.d(r,{ArrayBufferParser:()=>q,BufferParser:()=>T,LargeFileParser:()=>ie,StringParser:()=>I,default:()=>oe});var n={};e.r(n),e.d(n,{preset_inner_no_deco:()=>ve,preset_noeffect:()=>fe,preset_noeffect_completely:()=>ye,preset_noholds:()=>he,preset_nomovecamera:()=>pe});var i={};e.r(i),e.d(i,{default:()=>Te});var o={};e.r(o);var a={};e.r(a),e.d(a,{isEventEnabled:()=>De,normalizeVec2:()=>xe,resolveTileReference:()=>Ne});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 l={pathDataTable:s,parseToangleData:function(e){return Array.from(e).map(function(e){return s[e]})}};function u(e){return u="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},u(e)}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,f(n.key),n)}}function f(e){var t=function(e){if("object"!=u(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==u(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&&c(t.prototype,null),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r}();function p(e){return p="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},p(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,d(n.key),n)}}function v(e,t,r){return t&&y(e.prototype,t),r&&y(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}const g=v(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)});function b(e){return b="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},b(e)}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(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 S(e,t,r){return t&&O(e.prototype,t),r&&O(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function k(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}function w(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(w=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}var E=function(e){function t(){return m(this,t),e=this,n=arguments,r=_(r=t),function(e,t){if(t&&("object"==b(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,w()?Reflect.construct(r,n||[],_(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&&A(e,t)}(t,e),S(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 j(t).parseValue()}},{key:"stringify",value:function(e){return JSON.stringify(e)}}])}(g),j=function(){return S(function e(t){m(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 T=E;function P(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 N(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function x(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,M(n.key),n)}}function C(e,t,r){return t&&x(e.prototype,t),r&&x(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function M(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 R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}function U(e){return U=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},U(e)}function L(e,t){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},L(e,t)}var K=function(e){function t(){return N(this,t),e=this,n=arguments,r=U(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,R()?Reflect.construct(r,n||[],U(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&&L(e,t)}(t,e),C(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)}}])}(g),B=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;N(this,e),this.json=t,this.position=0,this.endSection=r,65279===this.peek()&&this.read()}return C(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 C(function e(t,r){N(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 P(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)?P(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 I=K;function z(e){return z="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},z(e)}function W(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,V(n.key),n)}}function V(e){var t=function(e){if("object"!=z(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==z(t)?t:t+""}function J(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(J=function(){return!!e})()}function G(e){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},G(e)}function H(e,t){return H=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},H(e,t)}var Q=new Uint8Array([239,187,191]),Y=new Uint8Array([44]);function $(e){var t=new Uint8Array(e);return t.length>=3&&t[0]===Q[0]&&t[1]===Q[1]&&t[2]===Q[2]?e.slice(3):e}const q=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=G(t),function(e,t){if(t&&("object"==z(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,J()?Reflect.construct(t,r||[],G(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&&H(e,t)}(t,e),r=t,(n=[{key:"parse",value:function(e){return"string"==typeof e?I.prototype.parse.call(I.prototype,e):I.prototype.parse.call(I.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(Y);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(Y),n="other")}}r.push(t.subarray(i));for(var s=0,l=0,u=r;l<u.length;l++)s+=u[l].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}($(e)),r=$(t),new TextDecoder("utf-8").decode(r)));var t,r}},{key:"stringify",value:function(e){return JSON.stringify(e)}}])&&W(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(g);function Z(e){return Z="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},Z(e)}function X(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,ee(n.key),n)}}function ee(e){var t=function(e){if("object"!=Z(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Z(t)?t:t+""}var te=new Uint8Array([239,187,191]);function re(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,l=!1,u=!1;s<e.length;)if(u)u=!1,s++;else if(92!==e[s])if(34!==e[s]){if(!l)if(e[s]===r)a++;else if(e[s]===o&&0===--a)return s+1;s++}else l=!l,s++;else u=!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 ne(e,t,r){return new TextDecoder("utf-8").decode(e.slice(t,r))}const ie=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,l,u,c,f,h=this,p=new Uint8Array(e);p.length>=3&&p[0]===te[0]&&p[1]===te[1]&&p[2]===te[2]&&(p=p.subarray(3)),null===(t=this.onProgress)||void 0===t||t.call(this,"scanning",5);var y=function(e){for(var t=new Map,r=0,n=!1,i=!1,o="",a=-1,s=0;s<e.length;s++){var l=e[s];if(i)i=!1;else if(92!==l)if(34!==l){if(!n)if(123===l)r++;else if(125===l)r--;else if(58===l&&1===r&&o){for(var u=s+1;u<e.length&&(32===e[u]||9===e[u]||10===e[u]||13===e[u]);)u++;t.set(o,u),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}(p),v=null!==(r=y.get("angleData"))&&void 0!==r?r:-1,d=null!==(n=y.get("pathData"))&&void 0!==n?n:-1,g=null!==(i=y.get("settings"))&&void 0!==i?i:-1,b=null!==(o=y.get("actions"))&&void 0!==o?o:-1,m=null!==(a=y.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=re(p,g);if(-1!==S)try{O.settings=JSON.parse(ne(p,g,S))}catch(e){O.settings={}}}if(-1!==v){null===(l=this.onProgress)||void 0===l||l.call(this,"parsing_angleData",15);var k=function(e,t,r){if(t>=e.length||91!==e[t])return null;for(var n=[],i=t+1,o="",a=1,s=!1,l=!1,u=!1,c=e.length;i<e.length;){var f=e[i];if(l)l=!1,i++;else if(92!==f)if(34!==f){if(s)i++;else if(91===f)a++,i++,u=!1;else if(93===f){if(0===--a){if(o.trim()&&!u){var h=Number(o.trim());isNaN(h)||n.push(h)}return{values:n,endPos:i+1}}i++,u=!1}else if(44===f){if(o.trim()&&!u){var p=Number(o.trim());isNaN(p)||n.push(p)}o="",u=!0,i++}else f>=48&&f<=57||45===f||46===f?(o+=String.fromCharCode(f),u=!1,i++):i++;r&&i%5e6==0&&r(Math.round(i/c*100))}else s=!s,i++;else l=!0,i++}return{values:n,endPos:i}}(p,v,function(e){var t;null===(t=h.onProgress)||void 0===t||t.call(h,"parsing_angleData",15+.25*e)});k&&(O.angleData=k.values)}if(-1!==d){var w=re(p,d);if(-1!==w){var _=ne(p,d,w);O.pathData=_.slice(1,-1)}}if(-1!==b){var A=re(p,b),E=A-b;if(null===(u=this.onProgress)||void 0===u||u.call(this,"parsing_actions",50),E>104857600&&this.skipLargeActions)O.actions=[];else if(E>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,l=!1,u=-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 h=e[o];if(l)l=!1,o++;else if(92!==h)if(34!==h)if(s)o++;else if(123===h)1===a&&-1===u&&(u=o),a++,o++;else if(125===h){if(1===--a&&-1!==u){try{var p=JSON.parse(ne(e,u,o+1));if(i.push(p),f++,n&&f>=n){for(var y=o+1;y<e.length&&93!==e[y];)y++;return{values:i,endPos:y+1}}}catch(e){}u=-1,r&&f%5e4==0&&r(Math.round(o/c*100))}o++}else if(91===h)a++,o++;else if(93===h){if(0===--a)return{values:i,endPos:o+1};o++}else o++;else s=!s,o++;else l=!0,o++}return{values:i,endPos:o}}(p,b,function(e){var t;return null===(t=h.onProgress)||void 0===t?void 0:t.call(h,"parsing_actions",50+.45*e)},this.maxActions||void 0);j&&(O.actions=j.values)}else try{O.actions=JSON.parse(ne(p,b,A))}catch(e){O.actions=[]}}if(-1!==m){null===(c=this.onProgress)||void 0===c||c.call(this,"parsing_decorations",95);var T=re(p,m);if(-1!==T)try{O.decorations=JSON.parse(ne(p,m,T))}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)}}])&&X(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),oe=h;function ae(e){return ae="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},ae(e)}function se(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"!==ae(e)||null===e)return JSON.stringify(e);if(Array.isArray(e)){if(e.every(function(e){return"object"!==ae(e)||null===e}))return"["+e.map(function(e){return se(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),l=Object.keys(e);if(r){var u=n.repeat(i);return"{\n"+l.map(function(t){return u+JSON.stringify(t)+": "+se(e[t],i,!1,n,i)}).join(",\n")+"\n}"}return"{\n"+l.map(function(r){return s+n.repeat(i)+JSON.stringify(r)+": "+se(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"!==ae(e)||null===e?se(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 ue=se;var ce,fe={type:"exclude",events:["Flash","SetFilter","SetFilterAdvanced","HallOfMirrors","Bloom","ScalePlanets","ScreenTile","ScreenScroll","ShakeScreen"]},he={type:"exclude",events:["Hold"]},pe={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"]},ve={type:"special",events:["MoveDecorations","SetText","SetObject","SetDefaultText"]};!function(e){e.include="include",e.exclude="exclude",e.special="special"}(ce||(ce={}));const de=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!ve.events.includes(e.eventType)})),t})},ge=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})},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})};function me(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function o(r,n,i,o){var l=n&&n.prototype instanceof s?n:s,u=Object.create(l.prototype);return Oe(u,"_invoke",function(r,n,i){var o,s,l,u=0,c=i||[],f=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,s=0,l=e,h.n=r,a}};function p(r,n){for(s=r,l=n,t=0;!f&&u&&!i&&t<c.length;t++){var i,o=c[t],p=h.p,y=o[2];r>3?(i=y===n)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):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(u>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,y),s=c,l=y;(t=s<2?e:l)||!f;){o||(s?s<3?(s>1&&(h.n=-1),p(s,l)):h.n=l:h.v=l);try{if(u=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(f=h.n<0)?l:r.call(n,h))!==a)break}catch(t){o=e,s=1,l=t}finally{u=1}}return{value:t,done:f}}}(r,i,o),!0),u}var a={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(Oe(t={},n,function(){return this}),t),f=u.prototype=s.prototype=Object.create(c);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Oe(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=u,Oe(f,"constructor",u),Oe(u,"constructor",l),l.displayName="GeneratorFunction",Oe(u,i,"GeneratorFunction"),Oe(f),Oe(f,i,"Generator"),Oe(f,n,function(){return this}),Oe(f,"toString",function(){return"[object Generator]"}),(me=function(){return{w:o,m:h}})()}function Oe(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}Oe=function(e,t,r,n){function o(t,r){Oe(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))},Oe(e,t,r,n)}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 ke(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=we(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 we(e,t){if(e){if("string"==typeof e)return _e(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)?_e(e,t):void 0}}function _e(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 Ae(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,Ee(n.key),n)}}function Ee(e){var t=function(e){if("object"!=Se(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Se(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Se(t)?t:t+""}var je=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},Te=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=ke(this._precomputedEvents[a]);try{for(s.s();!(o=s.n()).done;){var l=o.value;if(l.percent<=e&&(0===r.length||r[r.length-1].percent<=l.percent)){var u=r[r.length-1];u&&u.stage===l.stage&&u.current===l.current||r.push(l)}}}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 l=this.tiles[s];i[s]=null!==(e=l.angle)&&void 0!==e?e:0,a[s]=(null!==(t=l.twirl)&&void 0!==t?t:0)%2==1}if(!r){var u,c=[0,0],f=this.angleData,h=new Map,p=ke(this.actions);try{for(p.s();!(u=p.n()).done;){var y=u.value;"PositionTrack"===y.eventType&&y.positionOffset&&!0!==y.editorOnly&&"Enabled"!==y.editorOnly&&h.set(y.floor,y)}}catch(e){p.e(e)}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 g=void 0;if(999===f[v]){for(var b=1;v-b>=0&&999===f[v-b];)b++;g=(v-b>=0?f[v-b]:0)+180*(b-1)}else g=f[v];var m=g*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(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"!==Se(o)||null===o)return void r("Options must be String, Buffer, ArrayBuffer or Object");i=Object.assign({},o)}var f=i&&"object"===Se(i)&&null!==i&&void 0!==i.pathData,h=i&&"object"===Se(i)&&null!==i&&void 0!==i.angleData;if(f){var p=i.pathData;e._emitProgress("pathData",0,p.length,{source:p}),e.angleData=l.parseToangleData(p),e._emitProgress("pathData",p.length,p.length,{source:p,processed:e.angleData})}else{if(!h)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})}i&&"object"===Se(i)&&null!==i&&Array.isArray(i.actions)?e.actions=i.actions:e.actions=[],i&&"object"===Se(i)&&null!==i&&void 0!==i.settings?(e.settings=i.settings,i&&"object"===Se(i)&&null!==i&&Array.isArray(i.decorations)?e.__decorations=i.decorations:e.__decorations=[],e.tiles=[],e._angleDir=-180,e._twirlCount=0,e._createArray(e.angleData.length,{angleData:e.angleData,actions:e.actions,decorations:e.__decorations}).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)})):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:"_createArray",value:function(e,t){return r=this,n=void 0,i=void 0,o=me().m(function r(){var n,i,o,a,s,l,u,c,f,h,p,y,v,d,g,b,m,O;return me().w(function(r){for(;;)switch(r.n){case 0:if(n=new Array(e),i=Math.max(100,Math.floor(e/100)),o=new Map,Array.isArray(t.actions)){a=ke(t.actions);try{for(a.s();!(s=a.n()).done;)l=s.value,o.has(l.floor)||o.set(l.floor,[]),o.get(l.floor).push(l)}catch(e){a.e(e)}finally{a.f()}}if(u=new Map,Array.isArray(t.decorations)){c=ke(t.decorations);try{for(c.s();!(f=c.n()).done;)h=f.value,u.has(h.floor)||u.set(h.floor,[]),u.get(h.floor).push(h)}catch(e){c.e(e)}finally{c.f()}}p=0;case 1:if(!(p<e)){r.n=3;break}y=o.get(p)||[],v=u.get(p)||[],d=ke(y);try{for(d.s();!(g=d.n()).done;)"Twirl"===g.value.eventType&&this._twirlCount++}catch(e){d.e(e)}finally{d.f()}if(b=this._parseAngle(t.angleData,p,this._twirlCount%2),m=y.map(function(e){return e.floor,je(e,["floor"])}),O=v.map(function(e){return e.floor,je(e,["floor"])}),n[p]={direction:t.angleData[p],_lastdir:t.angleData[p-1]||0,actions:m,angle:b,addDecorations:O,twirl:this._twirlCount,extraProps:{}},p%i!==0&&p!==e-1){r.n=2;break}if(this._emitProgress("relativeAngle",p+1,e,{tileIndex:p,angle:t.angleData[p],relativeAngle:b}),p%(10*i)!=0){r.n=2;break}return r.n=2,new Promise(function(e){return setTimeout(e,0)});case 2:p++,r.n=1;break;case 3:return r.a(2,n)}},r,this)}),new(i||(i=Promise))(function(e,t){function a(e){try{l(o.next(e))}catch(e){t(e)}}function s(e){try{l(o.throw(e))}catch(e){t(e)}}function l(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i(function(e){e(r)})).then(a,s)}l((o=o.apply(r,n||[])).next())});var r,n,i,o}},{key:"_changeAngle",value:function(){var e=this,t=0;return this.tiles.map(function(r){return t++,r.angle=e._parsechangedAngle(r.direction,t,r.twirl,r._lastdir),r})}},{key:"_normalizeAngle",value:function(e){return(e%360+360)%360}},{key:"_parsechangedAngle",value:function(e,t,r,n){var i,o=0;if(0===t&&(this._angleDir=180),999===e){for(var a=1;t-a-1>=0&&999===(null===(i=this.tiles[t-a-1])||void 0===i?void 0:i.direction);)a++;var s=t-a-1>=0?this.tiles[t-a-1].direction:0;this._angleDir=this._normalizeAngle(s+180*(a-1)),isNaN(this._angleDir)&&(this._angleDir=0),o=0}else{var l=this._normalizeAngle(this._angleDir-e);0===(o=0===r?l:this._normalizeAngle(360-l))&&(o=360),this._angleDir=this._normalizeAngle(e+180)}return o}},{key:"_filterByFloor",value:function(e,t){if(!Array.isArray(e))return[];var r=e.filter(function(e){return e.floor===t});return this._twirlCount+=r.filter(function(e){return"Twirl"===e.eventType}).length,r.map(function(e){return e.floor,je(e,["floor"])})}},{key:"_flattenAngleDatas",value:function(e){return e.map(function(e){return e.direction})}},{key:"_flattenActionsWithFloor",value:function(e){return e.flatMap(function(e,t){return(Array.isArray(null==e?void 0:e.actions)?e.actions:[]).map(function(e){e.floor;var r=je(e,["floor"]);return Object.assign({floor:t},r)})})}},{key:"_filterByFloorwithDeco",value:function(e,t){return Array.isArray(e)?e.filter(function(e){return e.floor===t}).map(function(e){return e.floor,je(e,["floor"])}):[]}},{key:"_flattenDecorationsWithFloor",value:function(e){return e.flatMap(function(e,t){return(Array.isArray(null==e?void 0:e.addDecorations)?e.addDecorations:[]).map(function(e){e.floor;var r=je(e,["floor"]);return Object.assign({floor:t},r)})})}},{key:"_parseAngle",value:function(e,t,r){var n=0;if(0===t&&(this._angleDir=180),999===e[t]){for(var i=1;t-i>=0&&999===e[t-i];)i++;var o=t-i>=0?e[t-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-e[t]);0===(n=0===r?a:this._normalizeAngle(360-a))&&(n=360),this._angleDir=this._normalizeAngle(e[t]+180)}return n}},{key:"filterActionsByEventType",value:function(e){return Object.entries(this.tiles).flatMap(function(e){var t=function(e,t){return function(e){if(Array.isArray(e))return e}(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=[],l=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(e,t)||we(e,t)||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.")}()}(e,2),r=t[0],n=t[1];return(Array.isArray(n.actions)?n.actions:[]).map(function(e){return{b:e,index:r}})}).filter(function(t){return t.b.eventType===e}).map(function(e){var t=e.b,r=e.index;return{index:Number(r),action:t}})}},{key:"getActionsByIndex",value:function(e,t){var r=this.filterActionsByEventType(e).filter(function(e){return e.index===t});return{count:r.length,actions:r.map(function(e){return e.action})}}},{key:"calculateTileCoordinates",value:function(){console.warn("calculateTileCoordinates is deprecated. Use calculateTilePosition instead.")}},{key:"calculateTilePosition",value:function(){var e,t=this.angleData,r=this.tiles.length,n=[],i=[0,0],o=new Map,a=ke(this.actions);try{for(a.s();!(e=a.n()).done;){var s=e.value;"PositionTrack"===s.eventType&&s.positionOffset&&!0!==s.editorOnly&&"Enabled"!==s.editorOnly&&o.set(s.floor,s)}}catch(e){a.e(e)}finally{a.f()}this._emitProgress("tilePosition",0,r);for(var l=new Array(r),u=0;u<r;u++)if(999===t[u]){for(var c=1;u-c>=0&&999===t[u-c];)c++;var f=u-c>=0?t[u-c]:0;l[u]=f+180*(c-1)}else l[u]=t[u];for(var h=Math.max(100,Math.floor(r/100)),p=0;p<=r;p++){var y=p===r,v=y?l[p-1]||0:l[p],d=0===p?0:l[p-1]||0,g=this.tiles[p],b=o.get(p);(null==b?void 0:b.positionOffset)&&(i[0]+=b.positionOffset[0],i[1]+=b.positionOffset[1]);var m=[i[0],i[1]];n.push(m),g&&(g.position=m,g.extraProps.angle1=v,g.extraProps.angle2=d-180,g.extraProps.cangle=y?l[p-1]+180:l[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 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)}this._changeAngle()}},{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:{}}),this._changeAngle()}},{key:"clearDeco",value:function(){return this.tiles=de(this.tiles),!0}},{key:"clearEffect",value:function(e){this.clearEvent(n[e])}},{key:"clearEvent",value:function(e){e.type==ce.include?this.tiles=be(e.events,this.tiles):e.type==ce.exclude&&(this.tiles=ge(e.events,this.tiles))}},{key:"export",value:function(e,t){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"===e?o:ue(o,t,r,n,i)}}],t&&Ae(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Pe(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 De(e,t){return void 0===e?t:"boolean"==typeof e?e:"Enabled"===e||"true"===e}function Ne(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=[],l=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return s}}(i,o)||function(e,t){if(e){if("string"==typeof e)return Pe(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)?Pe(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 xe(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.1.0",
3
+ "version": "3.2.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
- "scripts": {
93
- "webpack": "webpack",
94
- "tsc": "tsc",
95
- "build": "webpack && pnpm tsc"
96
- }
97
- }
96
+ "dependencies": {}
97
+ }