adofai 2.9.22 → 2.9.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/filter/effectProcessor.d.ts +5 -0
- package/dist/src/filter/effectProcessor.js +6 -0
- package/dist/src/filter/presets.d.ts +2 -1
- package/dist/src/filter/presets.js +1 -1
- package/dist/src/parser/ArrayBufferParser copy.d.ts +9 -0
- package/dist/src/parser/ArrayBufferParser copy.js +98 -0
- package/dist/src/parser/BufferParser copy.d.ts +9 -0
- package/dist/src/parser/BufferParser copy.js +92 -0
- package/dist/src/parser/BufferParser.js +132 -28
- package/dist/src/parser/index.js +1 -2
- package/dist/src/structure/Level.d.ts +4 -2
- package/dist/src/structure/Level.js +20 -13
- package/dist/src/structure/format copy.d.ts +8 -0
- package/dist/src/structure/format copy.js +44 -0
- package/dist/src/structure/format.d.ts +4 -2
- package/dist/src/structure/format.js +18 -13
- package/dist/src/structure.d.ts +2 -4
- package/dist/src/structure.js +2 -2
- package/dist/umd/index.js +1 -1
- package/package.json +2 -5
|
@@ -7,6 +7,11 @@ interface Action {
|
|
|
7
7
|
eventType: string;
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
|
+
export declare enum EffectCleanerType {
|
|
11
|
+
include = "include",
|
|
12
|
+
exclude = "exclude",
|
|
13
|
+
special = "special"
|
|
14
|
+
}
|
|
10
15
|
/**
|
|
11
16
|
* @param {Array} tiles ADOFAI Tiles from ADOFAI.Level
|
|
12
17
|
* @returns {Array} new Tiles
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import * as presets from './presets';
|
|
2
|
+
export var EffectCleanerType;
|
|
3
|
+
(function (EffectCleanerType) {
|
|
4
|
+
EffectCleanerType["include"] = "include";
|
|
5
|
+
EffectCleanerType["exclude"] = "exclude";
|
|
6
|
+
EffectCleanerType["special"] = "special";
|
|
7
|
+
})(EffectCleanerType || (EffectCleanerType = {}));
|
|
2
8
|
/**
|
|
3
9
|
* @param {Array} tiles ADOFAI Tiles from ADOFAI.Level
|
|
4
10
|
* @returns {Array} new Tiles
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Parser from "./Parser";
|
|
2
|
+
export declare class ArrayBufferParser extends Parser<ArrayBuffer | string, any> {
|
|
3
|
+
parse(input: ArrayBuffer | string): any;
|
|
4
|
+
stringify(obj: any): string;
|
|
5
|
+
}
|
|
6
|
+
export declare function stripBOM(buffer: ArrayBuffer): ArrayBuffer;
|
|
7
|
+
export declare function normalizeJsonArrayBuffer(buffer: ArrayBuffer): ArrayBuffer;
|
|
8
|
+
export declare function decodeStringFromUTF8BOM(buffer: ArrayBuffer): string;
|
|
9
|
+
export default ArrayBufferParser;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import Parser from "./Parser";
|
|
2
|
+
import StringParser from "./StringParser";
|
|
3
|
+
const BOM = new Uint8Array([0xef, 0xbb, 0xbf]);
|
|
4
|
+
const COMMA = new Uint8Array([44]); // ASCII for ','
|
|
5
|
+
export class ArrayBufferParser extends Parser {
|
|
6
|
+
parse(input) {
|
|
7
|
+
if (typeof input === "string") {
|
|
8
|
+
return StringParser.prototype.parse.call(StringParser.prototype, input);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return StringParser.prototype.parse.call(StringParser.prototype, decodeStringFromUTF8BOM(normalizeJsonArrayBuffer(stripBOM(input))));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
stringify(obj) {
|
|
15
|
+
return JSON.stringify(obj);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function stripBOM(buffer) {
|
|
19
|
+
const view = new Uint8Array(buffer);
|
|
20
|
+
if (view.length >= 3 && view[0] === BOM[0] && view[1] === BOM[1] && view[2] === BOM[2]) {
|
|
21
|
+
return buffer.slice(3);
|
|
22
|
+
}
|
|
23
|
+
return buffer;
|
|
24
|
+
}
|
|
25
|
+
export function normalizeJsonArrayBuffer(buffer) {
|
|
26
|
+
const view = new Uint8Array(buffer);
|
|
27
|
+
let builder = [];
|
|
28
|
+
let last = "other";
|
|
29
|
+
let from = 0;
|
|
30
|
+
for (let i = 0; i < view.length; i++) {
|
|
31
|
+
const charCode = view[i];
|
|
32
|
+
if (last == "escape") {
|
|
33
|
+
last = "string";
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
switch (charCode) {
|
|
37
|
+
case 34: // "
|
|
38
|
+
switch (last) {
|
|
39
|
+
case "string":
|
|
40
|
+
last = "other";
|
|
41
|
+
break;
|
|
42
|
+
case "comma":
|
|
43
|
+
builder.push(COMMA);
|
|
44
|
+
default:
|
|
45
|
+
last = "string";
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
case 92: // \
|
|
50
|
+
if (last === "string")
|
|
51
|
+
last = "escape";
|
|
52
|
+
break;
|
|
53
|
+
case 44: // ,
|
|
54
|
+
builder.push(view.subarray(from, i));
|
|
55
|
+
from = i + 1;
|
|
56
|
+
if (last === "other")
|
|
57
|
+
last = "comma";
|
|
58
|
+
break;
|
|
59
|
+
case 93: // ]
|
|
60
|
+
case 125: // }
|
|
61
|
+
if (last === "comma")
|
|
62
|
+
last = "other";
|
|
63
|
+
break;
|
|
64
|
+
case 9: // \t
|
|
65
|
+
case 10: // \n
|
|
66
|
+
case 11: // \v
|
|
67
|
+
case 12: // \f
|
|
68
|
+
case 13: // \r
|
|
69
|
+
case 32: // space
|
|
70
|
+
break;
|
|
71
|
+
default:
|
|
72
|
+
if (last === "comma") {
|
|
73
|
+
builder.push(COMMA);
|
|
74
|
+
last = "other";
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
builder.push(view.subarray(from));
|
|
81
|
+
let totalLength = 0;
|
|
82
|
+
for (const arr of builder) {
|
|
83
|
+
totalLength += arr.length;
|
|
84
|
+
}
|
|
85
|
+
const result = new Uint8Array(totalLength);
|
|
86
|
+
let offset = 0;
|
|
87
|
+
for (const arr of builder) {
|
|
88
|
+
result.set(arr, offset);
|
|
89
|
+
offset += arr.length;
|
|
90
|
+
}
|
|
91
|
+
return result.buffer;
|
|
92
|
+
}
|
|
93
|
+
export function decodeStringFromUTF8BOM(buffer) {
|
|
94
|
+
const strippedBuffer = stripBOM(buffer);
|
|
95
|
+
const decoder = new TextDecoder('utf-8');
|
|
96
|
+
return decoder.decode(strippedBuffer);
|
|
97
|
+
}
|
|
98
|
+
export default ArrayBufferParser;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Parser from "./Parser";
|
|
2
|
+
export declare class BufferParser extends Parser<Buffer | string, any> {
|
|
3
|
+
parse(input: Buffer | string): any;
|
|
4
|
+
stringify(obj: any): string;
|
|
5
|
+
}
|
|
6
|
+
export declare function stripBOM(buffer: Buffer): Buffer;
|
|
7
|
+
export declare function normalizeJsonBuffer(text: Buffer): Buffer;
|
|
8
|
+
export declare function decodeStringFromUTF8BOM(buffer: Buffer): string;
|
|
9
|
+
export default BufferParser;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import Parser from "./Parser";
|
|
2
|
+
import StringParser from "./StringParser";
|
|
3
|
+
let BOM;
|
|
4
|
+
let COMMA;
|
|
5
|
+
try {
|
|
6
|
+
BOM = Buffer.of(0xef, 0xbb, 0xbf);
|
|
7
|
+
COMMA = Buffer.from(",");
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
console.warn('Buffer is not available in current environment, try to use ArrayBufferParser');
|
|
11
|
+
BOM = { equals: () => false, subarray: () => null };
|
|
12
|
+
COMMA = { equals: () => false, subarray: () => null };
|
|
13
|
+
}
|
|
14
|
+
export class BufferParser extends Parser {
|
|
15
|
+
parse(input) {
|
|
16
|
+
if (typeof input === "string") {
|
|
17
|
+
return StringParser.prototype.parse.call(StringParser.prototype, input);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return StringParser.prototype.parse.call(StringParser.prototype, decodeStringFromUTF8BOM(normalizeJsonBuffer(stripBOM(input))));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
stringify(obj) {
|
|
24
|
+
return JSON.stringify(obj);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function stripBOM(buffer) {
|
|
28
|
+
if (buffer.length >= 3 && BOM.equals(buffer.subarray(0, 3))) {
|
|
29
|
+
return buffer.subarray(3);
|
|
30
|
+
}
|
|
31
|
+
return buffer;
|
|
32
|
+
}
|
|
33
|
+
export function normalizeJsonBuffer(text) {
|
|
34
|
+
let builder = [];
|
|
35
|
+
let last = "other";
|
|
36
|
+
let from = 0;
|
|
37
|
+
text.forEach((charCode, i) => {
|
|
38
|
+
if (last == "escape") {
|
|
39
|
+
last = "string";
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
switch (charCode) {
|
|
43
|
+
case 34:
|
|
44
|
+
switch (last) {
|
|
45
|
+
case "string":
|
|
46
|
+
last = "other";
|
|
47
|
+
break;
|
|
48
|
+
case "comma":
|
|
49
|
+
builder.push(COMMA);
|
|
50
|
+
default:
|
|
51
|
+
last = "string";
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
case 92:
|
|
56
|
+
if (last === "string")
|
|
57
|
+
last = "escape";
|
|
58
|
+
break;
|
|
59
|
+
case 44:
|
|
60
|
+
builder.push(text.subarray(from, i));
|
|
61
|
+
from = i + 1;
|
|
62
|
+
if (last === "other")
|
|
63
|
+
last = "comma";
|
|
64
|
+
break;
|
|
65
|
+
case 93:
|
|
66
|
+
case 125:
|
|
67
|
+
if (last === "comma")
|
|
68
|
+
last = "other";
|
|
69
|
+
break;
|
|
70
|
+
case 9:
|
|
71
|
+
case 10:
|
|
72
|
+
case 11:
|
|
73
|
+
case 12:
|
|
74
|
+
case 13:
|
|
75
|
+
case 32:
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
if (last === "comma") {
|
|
79
|
+
builder.push(COMMA);
|
|
80
|
+
last = "other";
|
|
81
|
+
}
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
builder.push(text.subarray(from));
|
|
87
|
+
return Buffer.concat(builder);
|
|
88
|
+
}
|
|
89
|
+
export function decodeStringFromUTF8BOM(buffer) {
|
|
90
|
+
return stripBOM(buffer).toString("utf-8");
|
|
91
|
+
}
|
|
92
|
+
export default BufferParser;
|
|
@@ -2,62 +2,113 @@ import Parser from "./Parser";
|
|
|
2
2
|
import StringParser from "./StringParser";
|
|
3
3
|
let BOM;
|
|
4
4
|
let COMMA;
|
|
5
|
+
let BufferAvailable = true;
|
|
5
6
|
try {
|
|
6
7
|
BOM = Buffer.of(0xef, 0xbb, 0xbf);
|
|
7
8
|
COMMA = Buffer.from(",");
|
|
8
9
|
}
|
|
9
10
|
catch (e) {
|
|
11
|
+
BufferAvailable = false;
|
|
10
12
|
console.warn('Buffer is not available in current environment, try to use ArrayBufferParser');
|
|
13
|
+
// minimal shims to keep types happy; won't be used when BufferUnavailable
|
|
11
14
|
BOM = { equals: () => false, subarray: () => null };
|
|
12
15
|
COMMA = { equals: () => false, subarray: () => null };
|
|
13
16
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Inspect buffer to detect an unescaped raw newline inside a quoted string.
|
|
19
|
+
* If found, we must fallback to the more tolerant StringParser.
|
|
20
|
+
*/
|
|
21
|
+
function hasRawNewlineInStringBuffer(buf) {
|
|
22
|
+
let last = "other";
|
|
23
|
+
for (let i = 0; i < buf.length; i++) {
|
|
24
|
+
const c = buf[i];
|
|
25
|
+
if (last === "escape") {
|
|
26
|
+
last = "string";
|
|
27
|
+
continue;
|
|
18
28
|
}
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
switch (c) {
|
|
30
|
+
case 34: // "
|
|
31
|
+
if (last === "string") {
|
|
32
|
+
last = "other";
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
if (last === "comma") {
|
|
36
|
+
// entering string after comma
|
|
37
|
+
}
|
|
38
|
+
last = "string";
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
case 92: // \
|
|
42
|
+
if (last === "string")
|
|
43
|
+
last = "escape";
|
|
44
|
+
break;
|
|
45
|
+
case 44: // ,
|
|
46
|
+
if (last === "other")
|
|
47
|
+
last = "comma";
|
|
48
|
+
break;
|
|
49
|
+
case 93: // ]
|
|
50
|
+
case 125: // }
|
|
51
|
+
if (last === "comma")
|
|
52
|
+
last = "other";
|
|
53
|
+
break;
|
|
54
|
+
// whitespace bytes
|
|
55
|
+
case 9:
|
|
56
|
+
case 10:
|
|
57
|
+
case 11:
|
|
58
|
+
case 12:
|
|
59
|
+
case 13:
|
|
60
|
+
case 32:
|
|
61
|
+
// If we see newline (10) or carriage (13) while inside a string AND not escaped,
|
|
62
|
+
// that's a raw newline in string -> not valid strict JSON; detect and return true.
|
|
63
|
+
if ((c === 10 || c === 13) && last === "string") {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
if (last === "comma") {
|
|
69
|
+
last = "other";
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
21
72
|
}
|
|
22
73
|
}
|
|
23
|
-
|
|
24
|
-
return JSON.stringify(obj);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export function stripBOM(buffer) {
|
|
28
|
-
if (buffer.length >= 3 && BOM.equals(buffer.subarray(0, 3))) {
|
|
29
|
-
return buffer.subarray(3);
|
|
30
|
-
}
|
|
31
|
-
return buffer;
|
|
74
|
+
return false;
|
|
32
75
|
}
|
|
33
|
-
|
|
34
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Normalize buffer by removing insignificant whitespace outside strings.
|
|
78
|
+
* Works on Uint8Array and returns Buffer (for node) or Uint8Array (for arraybuffer flow).
|
|
79
|
+
* This function keeps contents inside strings untouched.
|
|
80
|
+
*/
|
|
81
|
+
function normalizeJsonUint8(buf) {
|
|
82
|
+
const builder = [];
|
|
35
83
|
let last = "other";
|
|
36
84
|
let from = 0;
|
|
37
|
-
|
|
38
|
-
|
|
85
|
+
for (let i = 0; i < buf.length; i++) {
|
|
86
|
+
const charCode = buf[i];
|
|
87
|
+
if (last === "escape") {
|
|
39
88
|
last = "string";
|
|
89
|
+
continue;
|
|
40
90
|
}
|
|
41
91
|
else {
|
|
42
92
|
switch (charCode) {
|
|
43
|
-
case 34:
|
|
93
|
+
case 34: // "
|
|
44
94
|
switch (last) {
|
|
45
95
|
case "string":
|
|
46
96
|
last = "other";
|
|
47
97
|
break;
|
|
48
98
|
case "comma":
|
|
49
|
-
|
|
99
|
+
// when we hit a quote after a comma we keep the comma boundary
|
|
100
|
+
builder.push(COMMA ? COMMA : new Uint8Array([44]));
|
|
50
101
|
default:
|
|
51
102
|
last = "string";
|
|
52
103
|
break;
|
|
53
104
|
}
|
|
54
105
|
break;
|
|
55
|
-
case 92:
|
|
106
|
+
case 92: // \
|
|
56
107
|
if (last === "string")
|
|
57
108
|
last = "escape";
|
|
58
109
|
break;
|
|
59
|
-
case 44:
|
|
60
|
-
builder.push(
|
|
110
|
+
case 44: // ,
|
|
111
|
+
builder.push(buf.subarray(from, i));
|
|
61
112
|
from = i + 1;
|
|
62
113
|
if (last === "other")
|
|
63
114
|
last = "comma";
|
|
@@ -73,18 +124,71 @@ export function normalizeJsonBuffer(text) {
|
|
|
73
124
|
case 12:
|
|
74
125
|
case 13:
|
|
75
126
|
case 32:
|
|
127
|
+
// ignore whitespace outside strings
|
|
76
128
|
break;
|
|
77
129
|
default:
|
|
78
130
|
if (last === "comma") {
|
|
79
|
-
builder.push(COMMA);
|
|
131
|
+
builder.push(COMMA ? COMMA : new Uint8Array([44]));
|
|
80
132
|
last = "other";
|
|
81
133
|
}
|
|
82
134
|
break;
|
|
83
135
|
}
|
|
84
136
|
}
|
|
85
|
-
}
|
|
86
|
-
builder.push(
|
|
87
|
-
|
|
137
|
+
}
|
|
138
|
+
builder.push(buf.subarray(from));
|
|
139
|
+
// concat
|
|
140
|
+
let total = 0;
|
|
141
|
+
for (const piece of builder)
|
|
142
|
+
total += piece.length;
|
|
143
|
+
const out = new Uint8Array(total);
|
|
144
|
+
let offset = 0;
|
|
145
|
+
for (const piece of builder) {
|
|
146
|
+
out.set(piece, offset);
|
|
147
|
+
offset += piece.length;
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
export class BufferParser extends Parser {
|
|
152
|
+
parse(input) {
|
|
153
|
+
// string input: delegate to StringParser (keeps current behavior)
|
|
154
|
+
if (typeof input === "string") {
|
|
155
|
+
return StringParser.prototype.parse.call(StringParser.prototype, input);
|
|
156
|
+
}
|
|
157
|
+
// Node Buffer path
|
|
158
|
+
const nodeBuf = input;
|
|
159
|
+
// strip BOM quickly
|
|
160
|
+
const stripped = stripBOM(nodeBuf);
|
|
161
|
+
const u8 = new Uint8Array(stripped);
|
|
162
|
+
// If there is any raw newline inside a quoted string, fallback to StringParser
|
|
163
|
+
if (hasRawNewlineInStringBuffer(u8)) {
|
|
164
|
+
// decode exactly and let StringParser tolerant-parse it
|
|
165
|
+
return StringParser.prototype.parse.call(StringParser.prototype, decodeStringFromUTF8BOM(stripped));
|
|
166
|
+
}
|
|
167
|
+
// Fast path: normalize then try JSON.parse (much faster than StringParser).
|
|
168
|
+
try {
|
|
169
|
+
const normalized = normalizeJsonUint8(u8);
|
|
170
|
+
const text = decodeStringFromUTF8BOM(Buffer.from(normalized));
|
|
171
|
+
return JSON.parse(text);
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
// Fallback to StringParser if anything unexpected occurs
|
|
175
|
+
return StringParser.prototype.parse.call(StringParser.prototype, decodeStringFromUTF8BOM(stripped));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
stringify(obj) {
|
|
179
|
+
return JSON.stringify(obj);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export function stripBOM(buffer) {
|
|
183
|
+
if (buffer.length >= 3 && BOM.equals(buffer.subarray(0, 3))) {
|
|
184
|
+
return buffer.subarray(3);
|
|
185
|
+
}
|
|
186
|
+
return buffer;
|
|
187
|
+
}
|
|
188
|
+
export function normalizeJsonBuffer(text) {
|
|
189
|
+
// keep backward compatibility: use the Uint8 normalizer and return a Buffer
|
|
190
|
+
const u8 = normalizeJsonUint8(new Uint8Array(text));
|
|
191
|
+
return Buffer.from(u8);
|
|
88
192
|
}
|
|
89
193
|
export function decodeStringFromUTF8BOM(buffer) {
|
|
90
194
|
return stripBOM(buffer).toString("utf-8");
|
package/dist/src/parser/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import StringParser from './StringParser';
|
|
2
1
|
class BaseParser {
|
|
3
2
|
static parseError(f) {
|
|
4
3
|
return f;
|
|
@@ -9,7 +8,7 @@ class BaseParser {
|
|
|
9
8
|
* @returns {LevelOptions} ADOFAI File Object
|
|
10
9
|
*/
|
|
11
10
|
static parseAsObject(t, provider) {
|
|
12
|
-
const parser = provider ||
|
|
11
|
+
const parser = provider || JSON;
|
|
13
12
|
return parser.parse(BaseParser.parseAsText(t));
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AdofaiEvent, LevelOptions, Tile, ParseProvider } from './interfaces';
|
|
2
|
+
import { EffectCleanerType } from '../filter/effectProcessor';
|
|
2
3
|
export declare class Level {
|
|
3
4
|
private _events;
|
|
4
5
|
private guidCallbacks;
|
|
@@ -36,6 +37,7 @@ export declare class Level {
|
|
|
36
37
|
actions: AdofaiEvent[];
|
|
37
38
|
};
|
|
38
39
|
calculateTileCoordinates(): void;
|
|
40
|
+
calculateTilePosition(): number[][];
|
|
39
41
|
floorOperation(info?: {
|
|
40
42
|
type: 'append' | 'insert' | 'delete';
|
|
41
43
|
direction: number;
|
|
@@ -47,8 +49,8 @@ export declare class Level {
|
|
|
47
49
|
clearDeco(): boolean;
|
|
48
50
|
clearEffect(presetName: string): void;
|
|
49
51
|
clearEvent(preset: {
|
|
50
|
-
type: string;
|
|
52
|
+
type: EffectCleanerType | string;
|
|
51
53
|
events: string[];
|
|
52
54
|
}): void;
|
|
53
|
-
export(type: 'string' | 'object', indent
|
|
55
|
+
export(type: 'string' | 'object', indent: number, useAdofaiStyle: boolean | undefined, indentChar: string, indentStep: number): string | Record<string, any>;
|
|
54
56
|
}
|
|
@@ -22,6 +22,7 @@ import pathData from '../pathdata';
|
|
|
22
22
|
import exportAsADOFAI from './format';
|
|
23
23
|
import BaseParser from '../parser';
|
|
24
24
|
import effectProcessor from '../filter/effectProcessor';
|
|
25
|
+
import { EffectCleanerType } from '../filter/effectProcessor';
|
|
25
26
|
import * as presets from '../filter/presets';
|
|
26
27
|
export class Level {
|
|
27
28
|
constructor(opt, provider) {
|
|
@@ -245,8 +246,12 @@ export class Level {
|
|
|
245
246
|
};
|
|
246
247
|
}
|
|
247
248
|
calculateTileCoordinates() {
|
|
249
|
+
console.warn("calculateTileCoordinates is deprecated. Use calculateTilePosition instead.");
|
|
250
|
+
}
|
|
251
|
+
calculateTilePosition() {
|
|
248
252
|
let angles = this.angleData;
|
|
249
253
|
let floats = [];
|
|
254
|
+
let positions = [];
|
|
250
255
|
let startPos = [0, 0];
|
|
251
256
|
for (let i = 0; i < this.tiles.length; i++) {
|
|
252
257
|
let value = angles[i];
|
|
@@ -270,16 +275,20 @@ export class Level {
|
|
|
270
275
|
}
|
|
271
276
|
startPos[0] += Math.cos(angle1 * Math.PI / 180);
|
|
272
277
|
startPos[1] += Math.sin(angle1 * Math.PI / 180);
|
|
278
|
+
let tempPos = [
|
|
279
|
+
Number(startPos[0]),
|
|
280
|
+
Number(startPos[1])
|
|
281
|
+
];
|
|
282
|
+
positions.push(tempPos);
|
|
273
283
|
if (typeof currentTile !== 'undefined') {
|
|
274
|
-
currentTile.position =
|
|
275
|
-
|
|
276
|
-
Number(startPos[1].toFixed(8))
|
|
277
|
-
];
|
|
284
|
+
currentTile.position = tempPos;
|
|
285
|
+
;
|
|
278
286
|
currentTile.extraProps.angle1 = angle1;
|
|
279
287
|
currentTile.extraProps.angle2 = angle2 - 180;
|
|
280
288
|
currentTile.extraProps.cangle = i === floats.length ? floats[i - 1] + 180 : floats[i];
|
|
281
289
|
}
|
|
282
290
|
}
|
|
291
|
+
return positions;
|
|
283
292
|
}
|
|
284
293
|
floorOperation(info = { type: 'append', direction: 0 }) {
|
|
285
294
|
switch (info.type) {
|
|
@@ -326,22 +335,20 @@ export class Level {
|
|
|
326
335
|
this.clearEvent(presets[presetName]);
|
|
327
336
|
}
|
|
328
337
|
clearEvent(preset) {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
this.tiles = effectProcessor.clearEvents(preset.events, this.tiles);
|
|
335
|
-
break;
|
|
338
|
+
if (preset.type == EffectCleanerType.include) {
|
|
339
|
+
this.tiles = effectProcessor.keepEvents(preset.events, this.tiles);
|
|
340
|
+
}
|
|
341
|
+
else if (preset.type == EffectCleanerType.exclude) {
|
|
342
|
+
this.tiles = effectProcessor.clearEvents(preset.events, this.tiles);
|
|
336
343
|
}
|
|
337
344
|
}
|
|
338
|
-
export(type, indent, useAdofaiStyle = true) {
|
|
345
|
+
export(type, indent, useAdofaiStyle = true, indentChar, indentStep) {
|
|
339
346
|
const ADOFAI = {
|
|
340
347
|
angleData: this._flattenAngleDatas(this.tiles),
|
|
341
348
|
settings: this.settings,
|
|
342
349
|
actions: this._flattenActionsWithFloor(this.tiles),
|
|
343
350
|
decorations: this._flattenDecorationsWithFloor(this.tiles)
|
|
344
351
|
};
|
|
345
|
-
return type === 'object' ? ADOFAI : exportAsADOFAI(ADOFAI, indent, useAdofaiStyle);
|
|
352
|
+
return type === 'object' ? ADOFAI : exportAsADOFAI(ADOFAI, indent, useAdofaiStyle, indentChar, indentStep);
|
|
346
353
|
}
|
|
347
354
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} obj - JSON Object
|
|
3
|
+
* @param {number} indent - No usage
|
|
4
|
+
* @param {boolean} isRoot - Is JSON the Root?
|
|
5
|
+
* @returns ADOFAI File Content or Object
|
|
6
|
+
*/
|
|
7
|
+
declare function exportAsADOFAI(obj: any, indent?: number, isRoot?: boolean): string;
|
|
8
|
+
export default exportAsADOFAI;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} obj - JSON Object
|
|
3
|
+
* @param {number} indent - No usage
|
|
4
|
+
* @param {boolean} isRoot - Is JSON the Root?
|
|
5
|
+
* @returns ADOFAI File Content or Object
|
|
6
|
+
*/
|
|
7
|
+
function exportAsADOFAI(obj, indent = 0, isRoot = false) {
|
|
8
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
9
|
+
return JSON.stringify(obj);
|
|
10
|
+
}
|
|
11
|
+
if (Array.isArray(obj)) {
|
|
12
|
+
const allPrimitives = obj.every(item => typeof item !== 'object' || item === null);
|
|
13
|
+
if (allPrimitives) {
|
|
14
|
+
return '[' + obj.map(item => exportAsADOFAI(item)).join(',') + ']';
|
|
15
|
+
}
|
|
16
|
+
const spaces = ' '.repeat(indent);
|
|
17
|
+
const arrayItems = obj.map(item => spaces + ' ' + formatAsSingleLine(item)).join(',\n');
|
|
18
|
+
return '[\n' + arrayItems + '\n' + spaces + ']';
|
|
19
|
+
}
|
|
20
|
+
const spaces = ' '.repeat(indent);
|
|
21
|
+
const keys = Object.keys(obj);
|
|
22
|
+
if (isRoot) {
|
|
23
|
+
const objectItems = keys.map(key => ' ' + JSON.stringify(key) + ': ' + exportAsADOFAI(obj[key], 2)).join(',\n');
|
|
24
|
+
return '{\n' + objectItems + '\n}';
|
|
25
|
+
}
|
|
26
|
+
const objectItems = keys.map(key => spaces + ' ' + JSON.stringify(key) + ': ' + exportAsADOFAI(obj[key], indent + 2)).join(',\n');
|
|
27
|
+
return '{\n' + objectItems + '\n' + spaces + '}';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @param {Array} obj Eventlist to keep
|
|
31
|
+
* @returns {string} JSON formated as singleline
|
|
32
|
+
*/
|
|
33
|
+
function formatAsSingleLine(obj) {
|
|
34
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
35
|
+
return exportAsADOFAI(obj);
|
|
36
|
+
}
|
|
37
|
+
if (Array.isArray(obj)) {
|
|
38
|
+
return '[' + obj.map(formatAsSingleLine).join(',') + ']';
|
|
39
|
+
}
|
|
40
|
+
const keys = Object.keys(obj);
|
|
41
|
+
const entries = keys.map(key => JSON.stringify(key) + ': ' + formatAsSingleLine(obj[key])).join(', ');
|
|
42
|
+
return '{' + entries + '}';
|
|
43
|
+
}
|
|
44
|
+
export default exportAsADOFAI;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {object} obj - JSON Object
|
|
3
|
-
* @param {number}
|
|
3
|
+
* @param {number} indentLevel - 当前缩进层级(数字,乘以 indentStep 得到实际缩进)
|
|
4
4
|
* @param {boolean} isRoot - Is JSON the Root?
|
|
5
|
+
* @param {string} indentChar - 单次缩进使用的字符,默认制表符 '\t'
|
|
6
|
+
* @param {number} indentStep - 每层增加的缩进数(默认 1)
|
|
5
7
|
* @returns ADOFAI File Content or Object
|
|
6
8
|
*/
|
|
7
|
-
declare function exportAsADOFAI(obj: any,
|
|
9
|
+
declare function exportAsADOFAI(obj: any, indentLevel?: number, isRoot?: boolean, indentChar?: string, indentStep?: number): string;
|
|
8
10
|
export default exportAsADOFAI;
|
|
@@ -1,44 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {object} obj - JSON Object
|
|
3
|
-
* @param {number}
|
|
3
|
+
* @param {number} indentLevel - 当前缩进层级(数字,乘以 indentStep 得到实际缩进)
|
|
4
4
|
* @param {boolean} isRoot - Is JSON the Root?
|
|
5
|
+
* @param {string} indentChar - 单次缩进使用的字符,默认制表符 '\t'
|
|
6
|
+
* @param {number} indentStep - 每层增加的缩进数(默认 1)
|
|
5
7
|
* @returns ADOFAI File Content or Object
|
|
6
8
|
*/
|
|
7
|
-
function exportAsADOFAI(obj,
|
|
9
|
+
function exportAsADOFAI(obj, indentLevel = 0, isRoot = false, indentChar = '\t', indentStep = 1) {
|
|
8
10
|
if (typeof obj !== 'object' || obj === null) {
|
|
9
11
|
return JSON.stringify(obj);
|
|
10
12
|
}
|
|
11
13
|
if (Array.isArray(obj)) {
|
|
12
14
|
const allPrimitives = obj.every(item => typeof item !== 'object' || item === null);
|
|
13
15
|
if (allPrimitives) {
|
|
14
|
-
return '[' + obj.map(item => exportAsADOFAI(item)).join(',') + ']';
|
|
16
|
+
return '[' + obj.map(item => exportAsADOFAI(item, 0, false, indentChar, indentStep)).join(',') + ']';
|
|
15
17
|
}
|
|
16
|
-
const spaces =
|
|
17
|
-
const
|
|
18
|
+
const spaces = indentChar.repeat(indentLevel);
|
|
19
|
+
const itemIndent = indentChar.repeat(indentLevel + indentStep);
|
|
20
|
+
const arrayItems = obj.map(item => itemIndent + formatAsSingleLine(item, indentChar)).join(',\n');
|
|
18
21
|
return '[\n' + arrayItems + '\n' + spaces + ']';
|
|
19
22
|
}
|
|
20
|
-
const spaces =
|
|
23
|
+
const spaces = indentChar.repeat(indentLevel);
|
|
21
24
|
const keys = Object.keys(obj);
|
|
22
25
|
if (isRoot) {
|
|
23
|
-
const
|
|
26
|
+
const childIndent = indentChar.repeat(indentStep);
|
|
27
|
+
const objectItems = keys.map(key => childIndent + JSON.stringify(key) + ': ' + exportAsADOFAI(obj[key], indentStep, false, indentChar, indentStep)).join(',\n');
|
|
24
28
|
return '{\n' + objectItems + '\n}';
|
|
25
29
|
}
|
|
26
|
-
const objectItems = keys.map(key => spaces +
|
|
30
|
+
const objectItems = keys.map(key => spaces + indentChar.repeat(indentStep) + JSON.stringify(key) + ': ' + exportAsADOFAI(obj[key], indentLevel + indentStep, false, indentChar, indentStep)).join(',\n');
|
|
27
31
|
return '{\n' + objectItems + '\n' + spaces + '}';
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
|
-
* @param {
|
|
34
|
+
* @param {any} obj Eventlist to keep
|
|
35
|
+
* @param {string} indentChar 缩进字符,传递给内部调用
|
|
31
36
|
* @returns {string} JSON formated as singleline
|
|
32
37
|
*/
|
|
33
|
-
function formatAsSingleLine(obj) {
|
|
38
|
+
function formatAsSingleLine(obj, indentChar = '\t') {
|
|
34
39
|
if (typeof obj !== 'object' || obj === null) {
|
|
35
|
-
return exportAsADOFAI(obj);
|
|
40
|
+
return exportAsADOFAI(obj, 0, false, indentChar);
|
|
36
41
|
}
|
|
37
42
|
if (Array.isArray(obj)) {
|
|
38
|
-
return '[' + obj.map(formatAsSingleLine).join(',') + ']';
|
|
43
|
+
return '[' + obj.map(item => formatAsSingleLine(item, indentChar)).join(',') + ']';
|
|
39
44
|
}
|
|
40
45
|
const keys = Object.keys(obj);
|
|
41
|
-
const entries = keys.map(key => JSON.stringify(key) + ': ' + formatAsSingleLine(obj[key])).join(', ');
|
|
46
|
+
const entries = keys.map(key => JSON.stringify(key) + ': ' + formatAsSingleLine(obj[key], indentChar)).join(', ');
|
|
42
47
|
return '{' + entries + '}';
|
|
43
48
|
}
|
|
44
49
|
export default exportAsADOFAI;
|
package/dist/src/structure.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { AdofaiEvent, LevelOptions, EventCallback, GuidCallback, Tile, ParseProvider };
|
|
4
|
-
export default Level;
|
|
1
|
+
export { Level as default } from './structure/Level';
|
|
2
|
+
export * from './structure/interfaces';
|
package/dist/src/structure.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export { Level as default } from './structure/Level';
|
|
2
|
+
export * from './structure/interfaces';
|
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,{Level:()=>yt,Parsers:()=>r,Presets:()=>n,Structure:()=>i,pathData:()=>a});var r={};t.r(r),t.d(r,{ArrayBufferParser:()=>J,BufferParser:()=>U,StringParser:()=>_,default:()=>Q});var n={};t.r(n),t.d(n,{preset_inner_no_deco:()=>it,preset_noeffect:()=>tt,preset_noeffect_completely:()=>nt,preset_noholds:()=>et,preset_nomovecamera:()=>rt});var i={};t.r(i),t.d(i,{default:()=>yt});var o={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 a={pathDataTable:o,parseToangleData:function(t){return Array.from(t).map((function(t){return o[t]}))}};function u(t){return u="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},u(t)}function s(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,l(n.key),n)}}function c(t,e,r){return e&&s(t.prototype,e),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){var e=function(t){if("object"!=u(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==u(e)?e:e+""}const f=c((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}));function h(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 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){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(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,b(n.key),n)}}function d(t,e,r){return e&&v(t.prototype,e),r&&v(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function b(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+""}function g(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(g=function(){return!!t})()}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function O(t,e){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},O(t,e)}var S=function(t){function e(){return y(this,e),t=this,n=arguments,r=m(r=e),function(t,e){if(e&&("object"==p(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(r,n||[],m(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&&O(t,e)}(e,t),d(e,[{key:"parse",value:function(t,r){if(null==t)return null;var n=new w(t).parseValue();return"function"==typeof r?e._applyReviver("",n,r):n}},{key:"stringify",value:function(t,e,r){return new k(e,r).serialize(t)}}],[{key:"_applyReviver",value:function(t,r,n){if(r&&"object"===p(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)}}])}(f),w=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;y(this,t),this.json=e,this.position=0,this.endSection=r,65279===this.peek()&&this.read()}return d(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}}}}])}();w.WHITE_SPACE=" \t\n\r\ufeff",w.WORD_BREAK=' \t\n\r{}[],:"',w.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 k=function(){return d((function t(e,r){y(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"===p(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 h(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)?h(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,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)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 _=S;function E(t){return E="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},E(t)}function j(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,T(n.key),n)}}function T(t){var e=function(t){if("object"!=E(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==E(e)?e:e+""}const A=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||new _).parse(t.parseAsText(e))}},{key:"parseAsText",value:function(t){return this.parseError(t)}}],null&&j(e.prototype,null),r&&j(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 N(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,x(n.key),n)}}function x(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+""}function D(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(D=function(){return!!t})()}function C(t){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},C(t)}function R(t,e){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},R(t,e)}var B,M;try{B=Buffer.of(239,187,191),M=Buffer.from(",")}catch(t){console.warn("Buffer is not available in current environment, try to use ArrayBufferParser"),B={equals:function(){return!1},subarray:function(){return null}},M={equals:function(){return!1},subarray:function(){return null}}}function F(t){return t.length>=3&&B.equals(t.subarray(0,3))?t.subarray(3):t}const U=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=C(e),function(t,e){if(e&&("object"==P(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,D()?Reflect.construct(e,r||[],C(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&&R(t,e)}(e,t),r=e,(n=[{key:"parse",value:function(t){return"string"==typeof t?_.prototype.parse.call(_.prototype,t):_.prototype.parse.call(_.prototype,(e=F(t),r=[],n="other",i=0,e.forEach((function(t,o){if("escape"==n)n="string";else switch(t){case 34:switch(n){case"string":n="other";break;case"comma":r.push(M);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(M),n="other")}})),r.push(e.subarray(i)),F(Buffer.concat(r)).toString("utf-8")));var e,r,n,i}},{key:"stringify",value:function(t){return JSON.stringify(t)}}])&&N(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(f);function K(t){return K="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},K(t)}function I(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,L(n.key),n)}}function L(t){var e=function(t){if("object"!=K(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=K(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==K(e)?e:e+""}function z(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(z=function(){return!!t})()}function G(t){return G=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},G(t)}function W(t,e){return W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},W(t,e)}var H=new Uint8Array([239,187,191]),V=new Uint8Array([44]);function Y(t){var e=new Uint8Array(t);return e.length>=3&&e[0]===H[0]&&e[1]===H[1]&&e[2]===H[2]?t.slice(3):t}const J=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=G(e),function(t,e){if(e&&("object"==K(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,z()?Reflect.construct(e,r||[],G(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&&W(t,e)}(e,t),r=e,(n=[{key:"parse",value:function(t){return"string"==typeof t?_.prototype.parse.call(_.prototype,t):_.prototype.parse.call(_.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(V);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(V),n="other")}}r.push(e.subarray(i));for(var u=0,s=0,c=r;s<c.length;s++)u+=c[s].length;for(var l=new Uint8Array(u),f=0,h=0,p=r;h<p.length;h++){var y=p[h];l.set(y,f),f+=y.length}return l.buffer}(Y(t)),r=Y(e),new TextDecoder("utf-8").decode(r)));var e,r}},{key:"stringify",value:function(t){return JSON.stringify(t)}}])&&I(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(f),Q=A;function q(t){return q="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},q(t)}function $(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("object"!==q(t)||null===t)return JSON.stringify(t);if(Array.isArray(t)){if(t.every((function(t){return"object"!==q(t)||null===t})))return"["+t.map((function(t){return $(t)})).join(",")+"]";var n=" ".repeat(e);return"[\n"+t.map((function(t){return n+" "+Z(t)})).join(",\n")+"\n"+n+"]"}var i=" ".repeat(e),o=Object.keys(t);return r?"{\n"+o.map((function(e){return" "+JSON.stringify(e)+": "+$(t[e],2)})).join(",\n")+"\n}":"{\n"+o.map((function(r){return i+" "+JSON.stringify(r)+": "+$(t[r],e+2)})).join(",\n")+"\n"+i+"}"}function Z(t){return"object"!==q(t)||null===t?$(t):Array.isArray(t)?"["+t.map(Z).join(",")+"]":"{"+Object.keys(t).map((function(e){return JSON.stringify(e)+": "+Z(t[e])})).join(", ")+"}"}const X=$;var tt={type:"exclude",events:["Flash","SetFilter","SetFilterAdvanced","HallOfMirrors","Bloom","ScalePlanets","ScreenTile","ScreenScroll","ShakeScreen"]},et={type:"exclude",events:["Hold"]},rt={type:"exclude",events:["MoveCamera"]},nt={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"]},it={type:"special",events:["MoveDecorations","SetText","SetObject","SetDefaultText"]};const ot=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!it.events.includes(t.eventType)}))),e}))},at=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}))},ut=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 st(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 ct(){ct=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(e,r,n,i){var o=r&&r.prototype instanceof h?r:h,a=Object.create(o.prototype);return s(a,"_invoke",function(e,r,n){var i=1;return function(o,a){if(3===i)throw Error("Generator is already running");if(4===i){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var u=n.delegate;if(u){var s=S(u,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===i)throw i=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=3;var c=l(e,r,n);if("normal"===c.type){if(i=n.done?4:2,c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=4,n.method="throw",n.arg=c.arg)}}}(e,n,new _(i||[])),!0),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var f={};function h(){}function p(){}function y(){}var v={};s(v,o,(function(){return this}));var d=Object.getPrototypeOf,b=d&&d(d(E([])));b&&b!==r&&n.call(b,o)&&(v=b);var g=y.prototype=h.prototype=Object.create(v);function m(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(i,o,a,u){var s=l(t[i],t,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==lt(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(f).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}var i;s(this,"_invoke",(function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}),!0)}function S(e,r){var n=r.method,i=e.i[n];if(i===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=l(i,e.i,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,f;var a=o.arg;return a?a.done?(r[e.r]=a.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function w(t){this.tryEntries.push(t)}function k(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function _(t){this.tryEntries=[[-1]],t.forEach(w,this),this.reset(!0)}function E(e){if(null!=e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(lt(e)+" is not iterable")}return p.prototype=y,s(g,"constructor",y),s(y,"constructor",p),p.displayName=s(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t},e.awrap=function(t){return{__await:t}},m(O.prototype),s(O.prototype,a,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new O(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=E,_.prototype={constructor:_,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){a.type="throw",a.arg=e,r.next=t}for(var i=r.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o[4],u=this.prev,s=o[1],c=o[2];if(-1===o[0])return n("end"),!1;if(!s&&!c)throw Error("try statement without catch or finally");if(null!=o[0]&&o[0]<=u){if(u<s)return this.method="next",this.arg=t,n(s),!0;if(u<c)return n(c),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var i=n;break}}i&&("break"===t||"continue"===t)&&i[0]<=e&&e<=i[2]&&(i=null);var o=i?i[4]:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i[2],f):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),k(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var i=n.arg;k(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:E(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function lt(t){return lt="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},lt(t)}function ft(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,ht(n.key),n)}}function ht(t){var e=function(t){if("object"!=lt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=lt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==lt(e)?e:e+""}var pt=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};const yt=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._events=new Map,this.guidCallbacks=new Map,this.guidCounter=0,this._options=e,this._provider=r},e=[{key:"generateGUID",value:function(){return"event_".concat(Date.now(),"_").concat(this.guidCounter++,"_").concat(Math.floor(1e3*Math.random()))}},{key:"load",value:function(){var t=this;return new Promise((function(e,r){var n,i=t._options;switch(lt(i)){case"string":try{n=Q.parseAsObject(i,t._provider)}catch(t){return void r(t)}break;case"object":n=Object.assign({},i);break;default:return void r("Options must be String or Object")}if(n&&"object"===lt(n)&&null!==n&&void 0!==n.pathData)t.angleData=a.parseToangleData(n.pathData);else{if(!n||"object"!==lt(n)||null===n||void 0===n.angleData)return void r("There is not any angle datas.");t.angleData=n.angleData}n&&"object"===lt(n)&&null!==n&&void 0!==n.actions?t.actions=n.actions:t.actions=[],n&&"object"===lt(n)&&null!==n&&void 0!==n.settings?(t.settings=n.settings,n&&"object"===lt(n)&&null!==n&&void 0!==n.decorations?t.__decorations=n.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.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=ct().mark((function r(){var n,i=this;return ct().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=Array.from({length:t},(function(t,r){return{direction:e.angleData[r],_lastdir:e.angleData[r-1]||0,actions:i._filterByFloor(e.actions,r),angle:i._parseAngle(e.angleData,r,i._twirlCount%2),addDecorations:i._filterByFloorwithDeco(e.decorations,r),twirl:i._twirlCount,extraProps:{}}})),r.abrupt("return",n);case 2:case"end":return r.stop()}}),r)})),new(i||(i=Promise))((function(t,e){function a(t){try{s(o.next(t))}catch(t){e(t)}}function u(t){try{s(o.throw(t))}catch(t){e(t)}}function s(e){var r;e.done?t(e.value):(r=e.value,r instanceof i?r:new i((function(t){t(r)}))).then(a,u)}s((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:"_parsechangedAngle",value:function(t,e,r,n){var i=0;return 0===e&&(this._angleDir=180),999===t?(this._angleDir=n,isNaN(this._angleDir)&&(this._angleDir=0),i=0):(0==(i=0===r?(this._angleDir-t)%360:360-(this._angleDir-t)%360)&&(i=360),this._angleDir=t+180),i}},{key:"_filterByFloor",value:function(t,e){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,pt(t,["floor"])}))}},{key:"_flattenAngleDatas",value:function(t){return t.map((function(t){return t.direction}))}},{key:"_flattenActionsWithFloor",value:function(t){return t.map((function(t){return t.actions})).flat()}},{key:"_filterByFloorwithDeco",value:function(t,e){return t.filter((function(t){return t.floor===e})).map((function(t){return t.floor,pt(t,["floor"])}))}},{key:"_flattenDecorationsWithFloor",value:function(t){return t.map((function(t){return t.addDecorations})).flat()}},{key:"_parseAngle",value:function(t,e,r){var n=0;return 0===e&&(this._angleDir=180),999===t[e]?(this._angleDir=t[e-1],isNaN(this._angleDir)&&(this._angleDir=0),n=0):(0==(n=0===r?(this._angleDir-t[e])%360:360-(this._angleDir-t[e])%360)&&(n=360),this._angleDir=t[e]+180),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,u=[],s=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(t){c=!0,i=t}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return st(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)?st(t,e):void 0}}(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];return(e[1].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(){for(var t=this.angleData,e=[],r=[0,0],n=0;n<this.tiles.length;n++){var i=t[n];999===i&&(i=t[n-1]+180),e.push(i)}for(var o=0;o<=e.length;o++){var a=Number(o===e.length?e[o-1]:e[o])||0,u=Number(0===o?0:e[o-1])||0,s=this.tiles[o];if(this.getActionsByIndex("PositionTrack",o).count>0){var c=this.getActionsByIndex("PositionTrack",o).actions[0];c.positionOffset&&!0!==c.editorOnly&&"Enabled"!==c.editorOnly&&(r[0]+=c.positionOffset[0],r[1]+=c.positionOffset[1])}r[0]+=Math.cos(a*Math.PI/180),r[1]+=Math.sin(a*Math.PI/180),void 0!==s&&(s.position=[Number(r[0].toFixed(8)),Number(r[1].toFixed(8))],s.extraProps.angle1=a,s.extraProps.angle2=u-180,s.extraProps.cangle=o===e.length?e[o-1]+180:e[o])}}},{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=ot(this.tiles),!0}},{key:"clearEffect",value:function(t){this.clearEvent(n[t])}},{key:"clearEvent",value:function(t){switch(t.type){case"include":this.tiles=ut(t.events,this.tiles);break;case"exclude":this.tiles=at(t.events,this.tiles)}}},{key:"export",value:function(t,e){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n={angleData:this._flattenAngleDatas(this.tiles),settings:this.settings,actions:this._flattenActionsWithFloor(this.tiles),decorations:this._flattenDecorationsWithFloor(this.tiles)};return"object"===t?n:X(n,e,r)}}],e&&ft(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();return e})()));
|
|
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,{Level:()=>dt,Parsers:()=>r,Presets:()=>n,Structure:()=>i,pathData:()=>a});var r={};t.r(r),t.d(r,{ArrayBufferParser:()=>Q,BufferParser:()=>K,StringParser:()=>A,default:()=>q});var n={};t.r(n),t.d(n,{preset_inner_no_deco:()=>at,preset_noeffect:()=>rt,preset_noeffect_completely:()=>ot,preset_noholds:()=>nt,preset_nomovecamera:()=>it});var i={};t.r(i),t.d(i,{default:()=>dt});var o={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 a={pathDataTable:o,parseToangleData:function(t){return Array.from(t).map((function(t){return o[t]}))}};function u(t){return u="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},u(t)}function s(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,c(n.key),n)}}function c(t){var e=function(t){if("object"!=u(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==u(e)?e:e+""}const l=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&&s(e.prototype,null),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r}();function f(t){return f="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},f(t)}function h(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,y(n.key),n)}}function p(t,e,r){return e&&h(t.prototype,e),r&&h(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function y(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}const v=p((function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}));function d(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 b(t){return b="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},b(t)}function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(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,S(n.key),n)}}function O(t,e,r){return e&&m(t.prototype,e),r&&m(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function S(t){var e=function(t){if("object"!=b(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==b(e)?e:e+""}function w(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(w=function(){return!!t})()}function k(t){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},k(t)}function _(t,e){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_(t,e)}var E=function(t){function e(){return g(this,e),t=this,n=arguments,r=k(r=e),function(t,e){if(e&&("object"==b(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||[],k(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&&_(t,e)}(e,t),O(e,[{key:"parse",value:function(t,r){if(null==t)return null;var n=new j(t).parseValue();return"function"==typeof r?e._applyReviver("",n,r):n}},{key:"stringify",value:function(t,e,r){return new T(e,r).serialize(t)}}],[{key:"_applyReviver",value:function(t,r,n){if(r&&"object"===b(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)}}])}(v),j=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;g(this,t),this.json=e,this.position=0,this.endSection=r,65279===this.peek()&&this.read()}return O(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}}}}])}();j.WHITE_SPACE=" \t\n\r\ufeff",j.WORD_BREAK=' \t\n\r{}[],:"',j.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 T=function(){return O((function t(e,r){g(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"===b(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 d(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)?d(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,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)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 A=E;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 N(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,x(n.key),n)}}function x(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+""}function D(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(D=function(){return!!t})()}function C(t){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},C(t)}function R(t,e){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},R(t,e)}var U,B;try{U=Buffer.of(239,187,191),B=Buffer.from(",")}catch(t){console.warn("Buffer is not available in current environment, try to use ArrayBufferParser"),U={equals:function(){return!1},subarray:function(){return null}},B={equals:function(){return!1},subarray:function(){return null}}}function M(t){return t.length>=3&&U.equals(t.subarray(0,3))?t.subarray(3):t}function F(t){return M(t).toString("utf-8")}const K=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=C(e),function(t,e){if(e&&("object"==P(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,D()?Reflect.construct(e,r||[],C(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&&R(t,e)}(e,t),r=e,(n=[{key:"parse",value:function(t){if("string"==typeof t)return A.prototype.parse.call(A.prototype,t);var e=M(t),r=new Uint8Array(e);if(function(t){for(var e="other",r=0;r<t.length;r++){var n=t[r];if("escape"!==e)switch(n){case 34:e="string"===e?"other":"string";break;case 92:"string"===e&&(e="escape");break;case 44:"other"===e&&(e="comma");break;case 93:case 125:default:"comma"===e&&(e="other");break;case 9:case 10:case 11:case 12:case 13:case 32:if((10===n||13===n)&&"string"===e)return!0}else e="string"}return!1}(r))return A.prototype.parse.call(A.prototype,F(e));try{var n=function(t){for(var e=[],r="other",n=0,i=0;i<t.length;i++){var o=t[i];if("escape"!==r)switch(o){case 34:switch(r){case"string":r="other";break;case"comma":e.push(B||new Uint8Array([44]));default:r="string"}break;case 92:"string"===r&&(r="escape");break;case 44:e.push(t.subarray(n,i)),n=i+1,"other"===r&&(r="comma");break;case 93:case 125:"comma"===r&&(r="other");break;case 9:case 10:case 11:case 12:case 13:case 32:break;default:"comma"===r&&(e.push(B||new Uint8Array([44])),r="other")}else r="string"}e.push(t.subarray(n));for(var a=0,u=0,s=e;u<s.length;u++)a+=s[u].length;for(var c=new Uint8Array(a),l=0,f=0,h=e;f<h.length;f++){var p=h[f];c.set(p,l),l+=p.length}return c}(r),i=F(Buffer.from(n));return JSON.parse(i)}catch(t){return A.prototype.parse.call(A.prototype,F(e))}}},{key:"stringify",value:function(t){return JSON.stringify(t)}}])&&N(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v);function I(t){return I="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},I(t)}function L(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,z(n.key),n)}}function z(t){var e=function(t){if("object"!=I(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==I(e)?e:e+""}function G(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(G=function(){return!!t})()}function W(t){return W=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},W(t)}function H(t,e){return H=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},H(t,e)}var J=new Uint8Array([239,187,191]),V=new Uint8Array([44]);function Y(t){var e=new Uint8Array(t);return e.length>=3&&e[0]===J[0]&&e[1]===J[1]&&e[2]===J[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=W(e),function(t,e){if(e&&("object"==I(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||[],W(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&&H(t,e)}(e,t),r=e,(n=[{key:"parse",value:function(t){return"string"==typeof t?A.prototype.parse.call(A.prototype,t):A.prototype.parse.call(A.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(V);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(V),n="other")}}r.push(e.subarray(i));for(var u=0,s=0,c=r;s<c.length;s++)u+=c[s].length;for(var l=new Uint8Array(u),f=0,h=0,p=r;h<p.length;h++){var y=p[h];l.set(y,f),f+=y.length}return l.buffer}(Y(t)),r=Y(e),new TextDecoder("utf-8").decode(r)));var e,r}},{key:"stringify",value:function(t){return JSON.stringify(t)}}])&&L(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(v),q=l;function $(t){return $="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},$(t)}function Z(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"!==$(t)||null===t)return JSON.stringify(t);if(Array.isArray(t)){if(t.every((function(t){return"object"!==$(t)||null===t})))return"["+t.map((function(t){return Z(t,0,!1,n,i)})).join(",")+"]";var o=n.repeat(e),a=n.repeat(e+i);return"[\n"+t.map((function(t){return a+X(t,n)})).join(",\n")+"\n"+o+"]"}var u=n.repeat(e),s=Object.keys(t);if(r){var c=n.repeat(i);return"{\n"+s.map((function(e){return c+JSON.stringify(e)+": "+Z(t[e],i,!1,n,i)})).join(",\n")+"\n}"}return"{\n"+s.map((function(r){return u+n.repeat(i)+JSON.stringify(r)+": "+Z(t[r],e+i,!1,n,i)})).join(",\n")+"\n"+u+"}"}function X(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"\t";return"object"!==$(t)||null===t?Z(t,0,!1,e):Array.isArray(t)?"["+t.map((function(t){return X(t,e)})).join(",")+"]":"{"+Object.keys(t).map((function(r){return JSON.stringify(r)+": "+X(t[r],e)})).join(", ")+"}"}const tt=Z;var et,rt={type:"exclude",events:["Flash","SetFilter","SetFilterAdvanced","HallOfMirrors","Bloom","ScalePlanets","ScreenTile","ScreenScroll","ShakeScreen"]},nt={type:"exclude",events:["Hold"]},it={type:"exclude",events:["MoveCamera"]},ot={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"]},at={type:"special",events:["MoveDecorations","SetText","SetObject","SetDefaultText"]};!function(t){t.include="include",t.exclude="exclude",t.special="special"}(et||(et={}));const ut=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!at.events.includes(t.eventType)}))),e}))},st=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}))},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}))};function lt(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 ft(){ft=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r,n){return Object.defineProperty(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n})}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function c(e,r,n,i){var o=r&&r.prototype instanceof h?r:h,a=Object.create(o.prototype);return s(a,"_invoke",function(e,r,n){var i=1;return function(o,a){if(3===i)throw Error("Generator is already running");if(4===i){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var u=n.delegate;if(u){var s=S(u,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(1===i)throw i=4,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=3;var c=l(e,r,n);if("normal"===c.type){if(i=n.done?4:2,c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=4,n.method="throw",n.arg=c.arg)}}}(e,n,new _(i||[])),!0),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var f={};function h(){}function p(){}function y(){}var v={};s(v,o,(function(){return this}));var d=Object.getPrototypeOf,b=d&&d(d(E([])));b&&b!==r&&n.call(b,o)&&(v=b);var g=y.prototype=h.prototype=Object.create(v);function m(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(i,o,a,u){var s=l(t[i],t,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==ht(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(f).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,u)}))}u(s.arg)}var i;s(this,"_invoke",(function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}),!0)}function S(e,r){var n=r.method,i=e.i[n];if(i===t)return r.delegate=null,"throw"===n&&e.i.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=l(i,e.i,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,f;var a=o.arg;return a?a.done?(r[e.r]=a.value,r.next=e.n,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function w(t){this.tryEntries.push(t)}function k(e){var r=e[4]||{};r.type="normal",r.arg=t,e[4]=r}function _(t){this.tryEntries=[[-1]],t.forEach(w,this),this.reset(!0)}function E(e){if(null!=e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(ht(e)+" is not iterable")}return p.prototype=y,s(g,"constructor",y),s(y,"constructor",p),p.displayName=s(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t},e.awrap=function(t){return{__await:t}},m(O.prototype),s(O.prototype,a,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new O(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},e.values=E,_.prototype={constructor:_,reset:function(e){if(this.prev=this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0][4];if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t){a.type="throw",a.arg=e,r.next=t}for(var i=r.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o[4],u=this.prev,s=o[1],c=o[2];if(-1===o[0])return n("end"),!1;if(!s&&!c)throw Error("try statement without catch or finally");if(null!=o[0]&&o[0]<=u){if(u<s)return this.method="next",this.arg=t,n(s),!0;if(u<c)return n(c),!1}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n[0]>-1&&n[0]<=this.prev&&this.prev<n[2]){var i=n;break}}i&&("break"===t||"continue"===t)&&i[0]<=e&&e<=i[2]&&(i=null);var o=i?i[4]:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i[2],f):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[2]===t)return this.complete(r[4],r[3]),k(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r[0]===t){var n=r[4];if("throw"===n.type){var i=n.arg;k(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={i:E(e),r,n},"next"===this.method&&(this.arg=t),f}},e}function ht(t){return ht="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},ht(t)}function pt(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,yt(n.key),n)}}function yt(t){var e=function(t){if("object"!=ht(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=ht(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ht(e)?e:e+""}var vt=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},dt=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._events=new Map,this.guidCallbacks=new Map,this.guidCounter=0,this._options=e,this._provider=r},e=[{key:"generateGUID",value:function(){return"event_".concat(Date.now(),"_").concat(this.guidCounter++,"_").concat(Math.floor(1e3*Math.random()))}},{key:"load",value:function(){var t=this;return new Promise((function(e,r){var n,i=t._options;switch(ht(i)){case"string":try{n=q.parseAsObject(i,t._provider)}catch(t){return void r(t)}break;case"object":n=Object.assign({},i);break;default:return void r("Options must be String or Object")}if(n&&"object"===ht(n)&&null!==n&&void 0!==n.pathData)t.angleData=a.parseToangleData(n.pathData);else{if(!n||"object"!==ht(n)||null===n||void 0===n.angleData)return void r("There is not any angle datas.");t.angleData=n.angleData}n&&"object"===ht(n)&&null!==n&&void 0!==n.actions?t.actions=n.actions:t.actions=[],n&&"object"===ht(n)&&null!==n&&void 0!==n.settings?(t.settings=n.settings,n&&"object"===ht(n)&&null!==n&&void 0!==n.decorations?t.__decorations=n.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.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=ft().mark((function r(){var n,i=this;return ft().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=Array.from({length:t},(function(t,r){return{direction:e.angleData[r],_lastdir:e.angleData[r-1]||0,actions:i._filterByFloor(e.actions,r),angle:i._parseAngle(e.angleData,r,i._twirlCount%2),addDecorations:i._filterByFloorwithDeco(e.decorations,r),twirl:i._twirlCount,extraProps:{}}})),r.abrupt("return",n);case 2:case"end":return r.stop()}}),r)})),new(i||(i=Promise))((function(t,e){function a(t){try{s(o.next(t))}catch(t){e(t)}}function u(t){try{s(o.throw(t))}catch(t){e(t)}}function s(e){var r;e.done?t(e.value):(r=e.value,r instanceof i?r:new i((function(t){t(r)}))).then(a,u)}s((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:"_parsechangedAngle",value:function(t,e,r,n){var i=0;return 0===e&&(this._angleDir=180),999===t?(this._angleDir=n,isNaN(this._angleDir)&&(this._angleDir=0),i=0):(0==(i=0===r?(this._angleDir-t)%360:360-(this._angleDir-t)%360)&&(i=360),this._angleDir=t+180),i}},{key:"_filterByFloor",value:function(t,e){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,vt(t,["floor"])}))}},{key:"_flattenAngleDatas",value:function(t){return t.map((function(t){return t.direction}))}},{key:"_flattenActionsWithFloor",value:function(t){return t.map((function(t){return t.actions})).flat()}},{key:"_filterByFloorwithDeco",value:function(t,e){return t.filter((function(t){return t.floor===e})).map((function(t){return t.floor,vt(t,["floor"])}))}},{key:"_flattenDecorationsWithFloor",value:function(t){return t.map((function(t){return t.addDecorations})).flat()}},{key:"_parseAngle",value:function(t,e,r){var n=0;return 0===e&&(this._angleDir=180),999===t[e]?(this._angleDir=t[e-1],isNaN(this._angleDir)&&(this._angleDir=0),n=0):(0==(n=0===r?(this._angleDir-t[e])%360:360-(this._angleDir-t[e])%360)&&(n=360),this._angleDir=t[e]+180),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,u=[],s=!0,c=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(t){c=!0,i=t}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return lt(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)?lt(t,e):void 0}}(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];return(e[1].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(){for(var t=this.angleData,e=[],r=[],n=[0,0],i=0;i<this.tiles.length;i++){var o=t[i];999===o&&(o=t[i-1]+180),e.push(o)}for(var a=0;a<=e.length;a++){var u=Number(a===e.length?e[a-1]:e[a])||0,s=Number(0===a?0:e[a-1])||0,c=this.tiles[a];if(this.getActionsByIndex("PositionTrack",a).count>0){var l=this.getActionsByIndex("PositionTrack",a).actions[0];l.positionOffset&&!0!==l.editorOnly&&"Enabled"!==l.editorOnly&&(n[0]+=l.positionOffset[0],n[1]+=l.positionOffset[1])}n[0]+=Math.cos(u*Math.PI/180),n[1]+=Math.sin(u*Math.PI/180);var f=[Number(n[0]),Number(n[1])];r.push(f),void 0!==c&&(c.position=f,c.extraProps.angle1=u,c.extraProps.angle2=s-180,c.extraProps.cangle=a===e.length?e[a-1]+180:e[a])}return r}},{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=ut(this.tiles),!0}},{key:"clearEffect",value:function(t){this.clearEvent(n[t])}},{key:"clearEvent",value:function(t){t.type==et.include?this.tiles=ct(t.events,this.tiles):t.type==et.exclude&&(this.tiles=st(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:tt(o,e,r,n,i)}}],e&&pt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();return e})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adofai",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.26",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -32,11 +32,8 @@
|
|
|
32
32
|
"@types/node": "^20.11.0",
|
|
33
33
|
"babel-loader": "^10.0.0",
|
|
34
34
|
"ts-loader": "^9.5.1",
|
|
35
|
-
"typescript": "^5.
|
|
35
|
+
"typescript": "^5.9.3",
|
|
36
36
|
"webpack": "^5.99.9",
|
|
37
37
|
"webpack-cli": "^6.0.1"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"fs": "0.0.1-security"
|
|
41
38
|
}
|
|
42
39
|
}
|