@woosh/meep-engine 2.113.4 → 2.113.7
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/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +179 -94
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +179 -94
- package/package.json +1 -1
- package/src/core/binary/Base64.d.ts.map +1 -1
- package/src/core/binary/Base64.js +73 -31
- package/src/core/binary/BitSet.d.ts +2 -2
- package/src/core/binary/BitSet.d.ts.map +1 -1
- package/src/core/binary/BitSet.js +8 -8
- package/src/core/binary/align_32.d.ts +2 -2
- package/src/core/binary/align_32.d.ts.map +1 -1
- package/src/core/binary/align_32.js +7 -3
- package/src/core/binary/bitset_find_clear_gap.d.ts +10 -0
- package/src/core/binary/bitset_find_clear_gap.d.ts.map +1 -0
- package/src/core/binary/bitset_find_clear_gap.js +30 -0
- package/src/core/binary/dec2hex.d.ts +2 -2
- package/src/core/binary/dec2hex.d.ts.map +1 -1
- package/src/core/binary/dec2hex.js +7 -3
- package/src/core/binary/downloadAsFile.d.ts +7 -1
- package/src/core/binary/downloadAsFile.d.ts.map +1 -1
- package/src/core/binary/downloadAsFile.js +10 -7
- package/src/core/binary/downloadUrlAsFile.d.ts +1 -1
- package/src/core/binary/downloadUrlAsFile.d.ts.map +1 -1
- package/src/core/binary/downloadUrlAsFile.js +6 -1
- package/src/core/binary/int32_to_binary_string.d.ts +1 -2
- package/src/core/binary/int32_to_binary_string.d.ts.map +1 -1
- package/src/core/binary/int32_to_binary_string.js +4 -2
- package/src/core/binary/url_to_data_url.d.ts +2 -1
- package/src/core/binary/url_to_data_url.d.ts.map +1 -1
- package/src/core/binary/url_to_data_url.js +2 -1
- package/src/core/codegen/LineBuilder.d.ts +4 -3
- package/src/core/codegen/LineBuilder.d.ts.map +1 -1
- package/src/core/codegen/LineBuilder.js +35 -6
- package/src/core/collection/array/arrayIndexByEquality.d.ts +1 -1
- package/src/core/collection/array/arrayIndexByEquality.js +1 -1
- package/src/core/collection/array/array_push_if_unique.d.ts.map +1 -1
- package/src/core/collection/array/array_push_if_unique.js +4 -0
- package/src/core/collection/array/typed/uint_array_for_count.d.ts +2 -2
- package/src/core/collection/array/typed/uint_array_for_count.d.ts.map +1 -1
- package/src/core/collection/array/typed/uint_array_for_count.js +5 -2
- package/src/core/collection/list/List.d.ts.map +1 -1
- package/src/core/collection/list/List.js +7 -2
- package/src/core/collection/map/HashMap.js +1 -1
- package/src/core/collection/table/RowFirstTable.d.ts +12 -12
- package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTable.js +39 -36
- package/src/core/collection/table/RowFirstTableSpec.d.ts +1 -0
- package/src/core/collection/table/RowFirstTableSpec.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTableSpec.js +1 -0
- package/src/core/collection/table/serializeRowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/serializeRowFirstTable.js +6 -4
- package/src/core/math/{isPowerOrTwo.d.ts → isPowerOfTwo.d.ts} +2 -2
- package/src/core/math/isPowerOfTwo.d.ts.map +1 -0
- package/src/core/math/{isPowerOrTwo.js → isPowerOfTwo.js} +2 -4
- package/src/core/model/LinearValue.d.ts +5 -1
- package/src/core/model/LinearValue.d.ts.map +1 -1
- package/src/core/model/LinearValue.js +16 -5
- package/src/core/model/ModuleRegistry.d.ts.map +1 -1
- package/src/core/model/ModuleRegistry.js +33 -29
- package/src/core/model/ResourceAccessSpecification.d.ts.map +1 -1
- package/src/core/model/ResourceAccessSpecification.js +7 -1
- package/src/core/model/node-graph/Connection.d.ts.map +1 -1
- package/src/core/model/node-graph/Connection.js +13 -7
- package/src/core/model/node-graph/NodeGraph.d.ts +10 -1
- package/src/core/model/node-graph/NodeGraph.d.ts.map +1 -1
- package/src/core/model/node-graph/NodeGraph.js +30 -1
- package/src/core/model/node-graph/node/NodeDescription.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeDescription.js +8 -0
- package/src/core/model/node-graph/node/NodeInstance.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstance.js +4 -0
- package/src/core/model/node-graph/node/NodeInstancePortReference.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeInstancePortReference.js +6 -10
- package/src/core/primitives/strings/computeStringHash.d.ts.map +1 -1
- package/src/core/primitives/strings/computeStringHash.js +13 -4
- package/src/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +4 -4
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +1 -1
- package/src/core/math/isPowerOrTwo.d.ts.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adapted from https://github.com/beatgammit/base64-js
|
|
3
3
|
* @author Jameson Little
|
|
4
|
+
* @author Alex Goldring
|
|
4
5
|
*/
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -8,12 +9,12 @@
|
|
|
8
9
|
* @type {string[]}
|
|
9
10
|
*/
|
|
10
11
|
const lookup = [];
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
*
|
|
13
15
|
* @type {number[]}
|
|
14
16
|
*/
|
|
15
17
|
const revLookup = [];
|
|
16
|
-
const Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
|
|
17
18
|
|
|
18
19
|
const code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
19
20
|
|
|
@@ -33,7 +34,7 @@ revLookup['_'.charCodeAt(0)] = 63;
|
|
|
33
34
|
* @return {number[]}
|
|
34
35
|
*/
|
|
35
36
|
function getLens(b64) {
|
|
36
|
-
|
|
37
|
+
const len = b64.length;
|
|
37
38
|
|
|
38
39
|
if (len % 4 > 0) {
|
|
39
40
|
throw new Error('Invalid string. Length must be a multiple of 4');
|
|
@@ -41,63 +42,88 @@ function getLens(b64) {
|
|
|
41
42
|
|
|
42
43
|
// Trim off extra bytes after placeholder bytes are found
|
|
43
44
|
// See: https://github.com/beatgammit/base64-js/issues/42
|
|
44
|
-
|
|
45
|
+
let validLen = b64.indexOf('=');
|
|
46
|
+
|
|
45
47
|
if (validLen === -1) {
|
|
46
48
|
validLen = len;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
const placeHoldersLen = validLen === len
|
|
50
52
|
? 0
|
|
51
53
|
: 4 - (validLen % 4);
|
|
52
54
|
|
|
53
55
|
return [validLen, placeHoldersLen];
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
/**
|
|
59
|
+
* base64 is 4/3 + up to two characters of the original data
|
|
60
|
+
* @param {number} validLen
|
|
61
|
+
* @param {number} placeHoldersLen
|
|
62
|
+
*/
|
|
63
|
+
function _byteLength(validLen, placeHoldersLen) {
|
|
59
64
|
return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen;
|
|
60
65
|
}
|
|
61
66
|
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param {string} b64
|
|
70
|
+
* @return {Uint8Array}
|
|
71
|
+
*/
|
|
62
72
|
function toByteArray(b64) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
let tmp;
|
|
74
|
+
const lens = getLens(b64);
|
|
75
|
+
const validLen = lens[0];
|
|
76
|
+
const placeHoldersLen = lens[1];
|
|
67
77
|
|
|
68
|
-
|
|
78
|
+
const arr = new Uint8Array(_byteLength(validLen, placeHoldersLen));
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
let curByte = 0;
|
|
71
81
|
|
|
72
82
|
// if there are placeholders, only get up to the last complete 4 chars
|
|
73
|
-
|
|
83
|
+
const len = placeHoldersLen > 0
|
|
74
84
|
? validLen - 4
|
|
75
85
|
: validLen;
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
let i = 0;
|
|
88
|
+
|
|
89
|
+
for (; i < len; i += 4) {
|
|
90
|
+
const char_0 = b64.charCodeAt(i);
|
|
91
|
+
const char_1 = b64.charCodeAt(i + 1);
|
|
92
|
+
const char_2 = b64.charCodeAt(i + 2);
|
|
93
|
+
const char_3 = b64.charCodeAt(i + 3);
|
|
94
|
+
|
|
79
95
|
tmp =
|
|
80
|
-
(revLookup[
|
|
81
|
-
(revLookup[
|
|
82
|
-
(revLookup[
|
|
83
|
-
revLookup[
|
|
96
|
+
(revLookup[char_0] << 18) |
|
|
97
|
+
(revLookup[char_1] << 12) |
|
|
98
|
+
(revLookup[char_2] << 6) |
|
|
99
|
+
revLookup[char_3];
|
|
100
|
+
|
|
84
101
|
arr[curByte++] = (tmp >> 16) & 0xFF;
|
|
85
102
|
arr[curByte++] = (tmp >> 8) & 0xFF;
|
|
86
103
|
arr[curByte++] = tmp & 0xFF;
|
|
87
104
|
}
|
|
88
105
|
|
|
89
106
|
if (placeHoldersLen === 2) {
|
|
107
|
+
const char_0 = b64.charCodeAt(i);
|
|
108
|
+
const char_1 = b64.charCodeAt(i + 1);
|
|
109
|
+
|
|
90
110
|
tmp =
|
|
91
|
-
(revLookup[
|
|
92
|
-
(revLookup[
|
|
111
|
+
(revLookup[char_0] << 2) |
|
|
112
|
+
(revLookup[char_1] >> 4);
|
|
113
|
+
|
|
93
114
|
arr[curByte++] = tmp & 0xFF;
|
|
94
115
|
}
|
|
95
116
|
|
|
96
117
|
if (placeHoldersLen === 1) {
|
|
118
|
+
const char_0 = b64.charCodeAt(i);
|
|
119
|
+
const char_1 = b64.charCodeAt(i + 1);
|
|
120
|
+
const char_2 = b64.charCodeAt(i + 2);
|
|
121
|
+
|
|
97
122
|
tmp =
|
|
98
|
-
(revLookup[
|
|
99
|
-
(revLookup[
|
|
100
|
-
(revLookup[
|
|
123
|
+
(revLookup[char_0] << 10) |
|
|
124
|
+
(revLookup[char_1] << 4) |
|
|
125
|
+
(revLookup[char_2] >> 2);
|
|
126
|
+
|
|
101
127
|
arr[curByte++] = (tmp >> 8) & 0xFF;
|
|
102
128
|
arr[curByte++] = tmp & 0xFF;
|
|
103
129
|
}
|
|
@@ -105,6 +131,11 @@ function toByteArray(b64) {
|
|
|
105
131
|
return arr;
|
|
106
132
|
}
|
|
107
133
|
|
|
134
|
+
/**
|
|
135
|
+
*
|
|
136
|
+
* @param {number} num
|
|
137
|
+
* @return {string}
|
|
138
|
+
*/
|
|
108
139
|
function tripletToBase64(num) {
|
|
109
140
|
return lookup[num >> 18 & 0x3F]
|
|
110
141
|
+ lookup[num >> 12 & 0x3F]
|
|
@@ -135,24 +166,29 @@ function encodeChunk(uint8, start, end) {
|
|
|
135
166
|
return output.join('');
|
|
136
167
|
}
|
|
137
168
|
|
|
169
|
+
/**
|
|
170
|
+
* must be multiple of 3
|
|
171
|
+
*/
|
|
172
|
+
const MAX_CHUNK_LENGTH = 16383;
|
|
173
|
+
|
|
138
174
|
/**
|
|
139
175
|
*
|
|
140
176
|
* @param {Uint8Array} uint8
|
|
141
177
|
* @return {string}
|
|
142
178
|
*/
|
|
143
179
|
function fromByteArray(uint8) {
|
|
144
|
-
let tmp;
|
|
145
180
|
|
|
146
181
|
const len = uint8.length;
|
|
182
|
+
|
|
147
183
|
const extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
|
|
184
|
+
|
|
148
185
|
const parts = [];
|
|
149
|
-
const maxChunkLength = 16383; // must be multiple of 3
|
|
150
186
|
|
|
151
187
|
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
152
188
|
const len2 = len - extraBytes;
|
|
153
189
|
|
|
154
|
-
for (let i = 0; i < len2; i +=
|
|
155
|
-
const end = (i +
|
|
190
|
+
for (let i = 0; i < len2; i += MAX_CHUNK_LENGTH) {
|
|
191
|
+
const end = (i + MAX_CHUNK_LENGTH) > len2 ? len2 : (i + MAX_CHUNK_LENGTH);
|
|
156
192
|
|
|
157
193
|
const chunk = encodeChunk(uint8, i, end);
|
|
158
194
|
|
|
@@ -161,20 +197,26 @@ function fromByteArray(uint8) {
|
|
|
161
197
|
|
|
162
198
|
// pad the end with zeros, but make sure to not forget the extra bytes
|
|
163
199
|
if (extraBytes === 1) {
|
|
164
|
-
|
|
200
|
+
|
|
201
|
+
const tmp = uint8[len - 1];
|
|
202
|
+
|
|
165
203
|
parts.push(
|
|
166
204
|
lookup[tmp >> 2] +
|
|
167
205
|
lookup[(tmp << 4) & 0x3F] +
|
|
168
206
|
'=='
|
|
169
207
|
);
|
|
208
|
+
|
|
170
209
|
} else if (extraBytes === 2) {
|
|
171
|
-
|
|
210
|
+
|
|
211
|
+
const tmp = (uint8[len - 2] << 8) + uint8[len - 1];
|
|
212
|
+
|
|
172
213
|
parts.push(
|
|
173
214
|
lookup[tmp >> 10] +
|
|
174
215
|
lookup[(tmp >> 4) & 0x3F] +
|
|
175
216
|
lookup[(tmp << 2) & 0x3F] +
|
|
176
217
|
'='
|
|
177
218
|
);
|
|
219
|
+
|
|
178
220
|
}
|
|
179
221
|
|
|
180
222
|
return parts.join('');
|
|
@@ -87,10 +87,10 @@ export class BitSet {
|
|
|
87
87
|
nextClearBit(fromIndex: int): number;
|
|
88
88
|
/**
|
|
89
89
|
*
|
|
90
|
-
* @param {int}
|
|
90
|
+
* @param {int} bit_index
|
|
91
91
|
* @param {boolean} value
|
|
92
92
|
*/
|
|
93
|
-
set(
|
|
93
|
+
set(bit_index: int, value: boolean): void;
|
|
94
94
|
/**
|
|
95
95
|
* Sets the bit specified by the index to false.
|
|
96
96
|
* @param {int} bitIndex
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitSet.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/BitSet.js"],"names":[],"mappings":"AAgCA;IAyiBI;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CASlB;IApjBD;;;;OAIG;IACH,+BAFW,MAAM,EA8BhB;IAzBG;;;;OAIG;IACH,iBAAiB;IAEjB;;;;OAIG;IACH,mBAA4C;IAE5C;;;;OAIG;IACH,sBAA0D;IAE1D;;OAEG;IACH,gBAFU,MAAM,CAEmB;IAGvC,sBAEC;IAED;;;OAGG;IACH,mBAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,uBAFW,MAAM,QAUhB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAsBC;IAED,uBAMC;IAED;;;;OAIG;IACH,oBAyBC;IAED;;;;OAIG;IACH,oCAqCC;IAED;;;;OAIG;IACH,4BAFa,MAAM,CAuDlB;IAED;;;;OAIG;IACH,8BAFa,MAAM,CAkDlB;IAED;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"BitSet.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/BitSet.js"],"names":[],"mappings":"AAgCA;IAyiBI;;;;OAIG;IACH,oBAHW,MAAM,GACJ,MAAM,CASlB;IApjBD;;;;OAIG;IACH,+BAFW,MAAM,EA8BhB;IAzBG;;;;OAIG;IACH,iBAAiB;IAEjB;;;;OAIG;IACH,mBAA4C;IAE5C;;;;OAIG;IACH,sBAA0D;IAE1D;;OAEG;IACH,gBAFU,MAAM,CAEmB;IAGvC,sBAEC;IAED;;;OAGG;IACH,mBAFW,MAAM,QAOhB;IAED;;;OAGG;IACH,uBAFW,MAAM,QAUhB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,iBAsBC;IAED,uBAMC;IAED;;;;OAIG;IACH,oBAyBC;IAED;;;;OAIG;IACH,oCAqCC;IAED;;;;OAIG;IACH,4BAFa,MAAM,CAuDlB;IAED;;;;OAIG;IACH,8BAFa,MAAM,CAkDlB;IAED;;;;OAIG;IACH,2BAFW,OAAO,QAmCjB;IAED;;;OAGG;IACH,2BAEC;IAED;;;;OAIG;IACH,qBAHW,MAAM,YACN,MAAM,QAWhB;IAED;;;;OAIG;IACH,uBAHW,MAAM,YACN,MAAM,QAShB;IAED;;;OAGG;IACH,SAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,oBAFa,OAAO,CAkBnB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,qBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAShB;IAED;;;;;OAKG;IACH,gBAJW,MAAM,eACN,MAAM,aACN,MAAM,QAQhB;IAED;;OAEG;IACH,cAgBC;IAED;;;OAGG;IACH,YAFW,MAAM,QAoChB;CAeJ"}
|
|
@@ -341,22 +341,22 @@ export class BitSet {
|
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
343
|
*
|
|
344
|
-
* @param {int}
|
|
344
|
+
* @param {int} bit_index
|
|
345
345
|
* @param {boolean} value
|
|
346
346
|
*/
|
|
347
|
-
set(
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
set(bit_index, value) {
|
|
348
|
+
assert.isNonNegativeInteger(bit_index, 'bit_index');
|
|
349
|
+
assert.isBoolean(value, 'value');
|
|
350
350
|
|
|
351
|
-
const word_offset =
|
|
352
|
-
const bit_offset =
|
|
351
|
+
const word_offset = bit_index >> 5;
|
|
352
|
+
const bit_offset = bit_index & 31;
|
|
353
353
|
|
|
354
354
|
//const oldLength = this.__length;
|
|
355
355
|
|
|
356
356
|
const word_mask = 1 << bit_offset;
|
|
357
357
|
|
|
358
358
|
if (value) {
|
|
359
|
-
const bitIndexInc =
|
|
359
|
+
const bitIndexInc = bit_index + 1;
|
|
360
360
|
|
|
361
361
|
if (bitIndexInc > this.__length) {
|
|
362
362
|
// ensure capacity
|
|
@@ -367,7 +367,7 @@ export class BitSet {
|
|
|
367
367
|
this.__data_uint32[word_offset] |= word_mask;
|
|
368
368
|
|
|
369
369
|
|
|
370
|
-
} else if (
|
|
370
|
+
} else if (bit_index < this.__length) {
|
|
371
371
|
//clear
|
|
372
372
|
this.__data_uint32[word_offset] &= ~word_mask;
|
|
373
373
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Align to the nearest number divisible by 32, rounding up
|
|
3
|
-
* @param {number}
|
|
3
|
+
* @param {number} x must be a non-negative integer
|
|
4
4
|
* @returns {number}
|
|
5
5
|
*/
|
|
6
|
-
export function align_32(
|
|
6
|
+
export function align_32(x: number): number;
|
|
7
7
|
//# sourceMappingURL=align_32.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"align_32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/align_32.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"align_32.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/align_32.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,4BAHW,MAAM,GACJ,MAAM,CAMlB"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { assert } from "../assert.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Align to the nearest number divisible by 32, rounding up
|
|
3
|
-
* @param {number}
|
|
5
|
+
* @param {number} x must be a non-negative integer
|
|
4
6
|
* @returns {number}
|
|
5
7
|
*/
|
|
6
|
-
export function align_32(
|
|
7
|
-
|
|
8
|
+
export function align_32(x) {
|
|
9
|
+
assert.isNonNegativeInteger(x, 'n');
|
|
10
|
+
|
|
11
|
+
return ((x + 31) >>> 5) << 5
|
|
8
12
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find a range of unset bits in the {@link BitSet}
|
|
3
|
+
* useful for allocation algorithms
|
|
4
|
+
* @param {BitSet} bitset
|
|
5
|
+
* @param {number} bit_count
|
|
6
|
+
* @param {number} start_index
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function bitset_find_clear_gap(bitset: BitSet, bit_count: number, start_index?: number): number;
|
|
10
|
+
//# sourceMappingURL=bitset_find_clear_gap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitset_find_clear_gap.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/bitset_find_clear_gap.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,iEAJW,MAAM,gBACN,MAAM,GACJ,MAAM,CAuBlB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find a range of unset bits in the {@link BitSet}
|
|
3
|
+
* useful for allocation algorithms
|
|
4
|
+
* @param {BitSet} bitset
|
|
5
|
+
* @param {number} bit_count
|
|
6
|
+
* @param {number} start_index
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function bitset_find_clear_gap(bitset, bit_count, start_index = 0) {
|
|
10
|
+
let slot_index = start_index;
|
|
11
|
+
|
|
12
|
+
main_loop:while (true) {
|
|
13
|
+
|
|
14
|
+
slot_index = bitset.nextClearBit(slot_index)
|
|
15
|
+
|
|
16
|
+
const search_range_end = slot_index + bit_count;
|
|
17
|
+
|
|
18
|
+
for (let i = slot_index; i < search_range_end; i++) {
|
|
19
|
+
if (bitset.get(i)) {
|
|
20
|
+
// slot is occupied
|
|
21
|
+
slot_index = i + 1;
|
|
22
|
+
|
|
23
|
+
continue main_loop;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// found a hole big enough
|
|
28
|
+
return slot_index;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Convert a decimal value to hex
|
|
3
|
-
* @param {number}
|
|
3
|
+
* @param {number} x generally expects b byte value, 0-255
|
|
4
4
|
* @returns {string} zero-padded value, for example instead of "0", will return "00" and instead of "F" will return "0F"
|
|
5
5
|
*/
|
|
6
|
-
export function dec2hex(
|
|
6
|
+
export function dec2hex(x: number): string;
|
|
7
7
|
//# sourceMappingURL=dec2hex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dec2hex.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/dec2hex.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dec2hex.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/dec2hex.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,2BAHW,MAAM,GACJ,MAAM,CAOlB"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { assert } from "../assert.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Convert a decimal value to hex
|
|
3
|
-
* @param {number}
|
|
5
|
+
* @param {number} x generally expects b byte value, 0-255
|
|
4
6
|
* @returns {string} zero-padded value, for example instead of "0", will return "00" and instead of "F" will return "0F"
|
|
5
7
|
*/
|
|
6
|
-
export function dec2hex(
|
|
7
|
-
|
|
8
|
+
export function dec2hex(x) {
|
|
9
|
+
assert.greaterThanOrEqual(x, 0);
|
|
10
|
+
|
|
11
|
+
const hex = Math.round(x).toString(16);
|
|
8
12
|
return hex.length === 1 ? "0" + hex : hex;
|
|
9
13
|
}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {ArrayBuffer|Uint8Array|Array|Blob|string} data
|
|
4
|
+
* @param {string} [filename]
|
|
5
|
+
* @param {string} [type]
|
|
6
|
+
*/
|
|
7
|
+
export function downloadAsFile(data: ArrayBuffer | Uint8Array | any[] | Blob | string, filename?: string, type?: string): void;
|
|
2
8
|
//# sourceMappingURL=downloadAsFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadAsFile.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/downloadAsFile.js"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"downloadAsFile.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/downloadAsFile.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,qCAJW,WAAW,GAAC,UAAU,WAAO,IAAI,GAAC,MAAM,aACxC,MAAM,SACN,MAAM,QAwBhB"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {downloadUrlAsFile} from "./downloadUrlAsFile.js";
|
|
1
|
+
import { downloadUrlAsFile } from "./downloadUrlAsFile.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {ArrayBuffer|Uint8Array|Array|Blob|string} data
|
|
6
|
+
* @param {string} [filename]
|
|
7
|
+
* @param {string} [type]
|
|
8
|
+
*/
|
|
3
9
|
export function downloadAsFile(data, filename, type = 'text/json') {
|
|
4
10
|
|
|
5
11
|
let blobContent;
|
|
@@ -19,10 +25,7 @@ export function downloadAsFile(data, filename, type = 'text/json') {
|
|
|
19
25
|
blobContent = [data]
|
|
20
26
|
}
|
|
21
27
|
|
|
22
|
-
const blob = new Blob(blobContent, {type});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} else {
|
|
26
|
-
downloadUrlAsFile(window.URL.createObjectURL(blob), filename);
|
|
27
|
-
}
|
|
28
|
+
const blob = new Blob(blobContent, { type });
|
|
29
|
+
|
|
30
|
+
downloadUrlAsFile(window.URL.createObjectURL(blob), filename);
|
|
28
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloadUrlAsFile.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/downloadUrlAsFile.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"downloadUrlAsFile.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/downloadUrlAsFile.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,uCAHW,MAAM,aACN,MAAM,QAchB"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { assert } from "../assert.js";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
*
|
|
3
5
|
* @param {string} url
|
|
4
6
|
* @param {string} filename
|
|
5
7
|
*/
|
|
6
|
-
export function downloadUrlAsFile(url, filename) {
|
|
8
|
+
export function downloadUrlAsFile(url, filename = "file") {
|
|
9
|
+
assert.isString(url,'url');
|
|
10
|
+
assert.isString(filename,'filename');
|
|
11
|
+
|
|
7
12
|
const elem = document.createElement('a');
|
|
8
13
|
elem.href = url;
|
|
9
14
|
elem.download = filename;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts an integer to easily readable binary string representation
|
|
3
|
-
* @see https://stackoverflow.com/questions/9939760/how-do-i-convert-an-integer-to-binary-in-javascript
|
|
4
3
|
* @example 1024 -> "00000000 00000000 00000100 00000000"
|
|
5
4
|
* @example -1 -> "11111111 11111111 11111111 11111111"
|
|
6
5
|
* @param {number} input_value
|
|
7
|
-
* @param {string} [byte_separator] insert this string between each group of 8 bits
|
|
6
|
+
* @param {string} [byte_separator] insert this string between each group of 8 bits, defaults to a space
|
|
8
7
|
* @returns {string}
|
|
9
8
|
*/
|
|
10
9
|
export function int32_to_binary_string(input_value: number, byte_separator?: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int32_to_binary_string.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/int32_to_binary_string.js"],"names":[],"mappings":"AAcA
|
|
1
|
+
{"version":3,"file":"int32_to_binary_string.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/int32_to_binary_string.js"],"names":[],"mappings":"AAcA;;;;;;;GAOG;AACH,oDAJW,MAAM,mBACN,MAAM,GACJ,MAAM,CA+BlB"}
|
|
@@ -14,14 +14,16 @@ const MIN_VALUE = -1 * (2 ** 31);
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Converts an integer to easily readable binary string representation
|
|
17
|
-
* @see https://stackoverflow.com/questions/9939760/how-do-i-convert-an-integer-to-binary-in-javascript
|
|
18
17
|
* @example 1024 -> "00000000 00000000 00000100 00000000"
|
|
19
18
|
* @example -1 -> "11111111 11111111 11111111 11111111"
|
|
20
19
|
* @param {number} input_value
|
|
21
|
-
* @param {string} [byte_separator] insert this string between each group of 8 bits
|
|
20
|
+
* @param {string} [byte_separator] insert this string between each group of 8 bits, defaults to a space
|
|
22
21
|
* @returns {string}
|
|
23
22
|
*/
|
|
24
23
|
export function int32_to_binary_string(input_value, byte_separator = " ") {
|
|
24
|
+
|
|
25
|
+
// @see https://stackoverflow.com/questions/9939760/how-do-i-convert-an-integer-to-binary-in-javascript
|
|
26
|
+
|
|
25
27
|
// nMask must be between -2147483648 and 2147483647
|
|
26
28
|
if (input_value > MAX_VALUE) {
|
|
27
29
|
throw "number too large. number shouldn't be > 2**31-1";//added
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url_to_data_url.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/url_to_data_url.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"url_to_data_url.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/url_to_data_url.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qCAHW,MAAM,GACJ,MAAM,CAwBlB"}
|
|
@@ -4,13 +4,13 @@ export default LineBuilder;
|
|
|
4
4
|
*/
|
|
5
5
|
declare class LineBuilder {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
7
|
* @param {string} text
|
|
8
|
+
* @param {string} [line_separator] defaults to new-line character
|
|
9
9
|
* @returns {LineBuilder}
|
|
10
10
|
*/
|
|
11
|
-
static fromText(text: string): LineBuilder;
|
|
11
|
+
static fromText(text: string, line_separator?: string): LineBuilder;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* TODO replace with indent string, that is tab, space or any combination or something else entirely
|
|
14
14
|
* @type {number}
|
|
15
15
|
*/
|
|
16
16
|
indentSpaces: number;
|
|
@@ -52,6 +52,7 @@ declare class LineBuilder {
|
|
|
52
52
|
* @returns {string}
|
|
53
53
|
*/
|
|
54
54
|
build(): string;
|
|
55
|
+
toString(): string;
|
|
55
56
|
#private;
|
|
56
57
|
}
|
|
57
58
|
//# sourceMappingURL=LineBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/codegen/LineBuilder.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"LineBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/codegen/LineBuilder.js"],"names":[],"mappings":";AA+BA;;GAEG;AACH;IA0II;;;;OAIG;IACH,sBAJW,MAAM,mBACN,MAAM,GACJ,WAAW,CAuBvB;IAtJD;;;OAGG;IACH,cAFU,MAAM,CAEqB;IAErC;;;OAGG;IACH,oBAEC;IAED;;;;OAIG;IACH,wBAFW,MAAM,GADL,OAAO,CAoBlB;IAED;;;OAGG;IACH,UAFa,WAAW,CAKvB;IAED;;;OAGG;IACH,UAFa,WAAW,CAOvB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,WAAW,CASvB;IAED;;;OAGG;IACH,gBAFW,WAAW,QAiBrB;IAED,cAGC;IAED;;;OAGG;IACH,SAFa,MAAM,CAsBlB;IA8BD,mBAEC;;CACJ"}
|
|
@@ -1,14 +1,30 @@
|
|
|
1
|
+
import { assert } from "../assert.js";
|
|
2
|
+
|
|
1
3
|
class Line {
|
|
2
4
|
/**
|
|
3
5
|
*
|
|
4
6
|
* @param {string} text
|
|
5
7
|
* @param {number} indent
|
|
6
|
-
* @constructor
|
|
7
8
|
*/
|
|
8
9
|
constructor(text, indent) {
|
|
10
|
+
assert.isString(text, 'text');
|
|
11
|
+
assert.isNonNegativeInteger(indent, 'index');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
9
17
|
this.text = text;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/
|
|
10
22
|
this.indentation = indent;
|
|
11
23
|
}
|
|
24
|
+
|
|
25
|
+
toString() {
|
|
26
|
+
return `Line{ indentation=${this.indentation}, text="${this.text}" }`
|
|
27
|
+
}
|
|
12
28
|
}
|
|
13
29
|
|
|
14
30
|
const DEFAULT_INDENT_SPACES = 4;
|
|
@@ -25,13 +41,13 @@ class LineBuilder {
|
|
|
25
41
|
#lines = [];
|
|
26
42
|
|
|
27
43
|
/**
|
|
28
|
-
*
|
|
44
|
+
* Current indent level
|
|
29
45
|
* @type {number}
|
|
30
46
|
*/
|
|
31
47
|
#indentation = 0;
|
|
32
48
|
|
|
33
49
|
/**
|
|
34
|
-
*
|
|
50
|
+
* TODO replace with indent string, that is tab, space or any combination or something else entirely
|
|
35
51
|
* @type {number}
|
|
36
52
|
*/
|
|
37
53
|
indentSpaces = DEFAULT_INDENT_SPACES;
|
|
@@ -50,8 +66,11 @@ class LineBuilder {
|
|
|
50
66
|
* @param {string} term
|
|
51
67
|
*/
|
|
52
68
|
containsSubstring(term) {
|
|
69
|
+
assert.isString(term, 'term');
|
|
70
|
+
|
|
53
71
|
const lines = this.#lines;
|
|
54
72
|
const n = lines.length;
|
|
73
|
+
|
|
55
74
|
for (let i = 0; i < n; i++) {
|
|
56
75
|
const line = lines[i];
|
|
57
76
|
|
|
@@ -79,6 +98,8 @@ class LineBuilder {
|
|
|
79
98
|
* @returns {LineBuilder}
|
|
80
99
|
*/
|
|
81
100
|
dedent() {
|
|
101
|
+
assert.greaterThan(this.#indentation, 0, 'indentation is already at 0');
|
|
102
|
+
|
|
82
103
|
this.#indentation--;
|
|
83
104
|
return this;
|
|
84
105
|
}
|
|
@@ -102,6 +123,7 @@ class LineBuilder {
|
|
|
102
123
|
* @param {LineBuilder} lines
|
|
103
124
|
*/
|
|
104
125
|
addLines(lines) {
|
|
126
|
+
assert.defined(lines, 'lines');
|
|
105
127
|
|
|
106
128
|
const other_lines = lines.#lines;
|
|
107
129
|
|
|
@@ -149,14 +171,17 @@ class LineBuilder {
|
|
|
149
171
|
}
|
|
150
172
|
|
|
151
173
|
/**
|
|
152
|
-
*
|
|
153
174
|
* @param {string} text
|
|
175
|
+
* @param {string} [line_separator] defaults to new-line character
|
|
154
176
|
* @returns {LineBuilder}
|
|
155
177
|
*/
|
|
156
|
-
static fromText(text) {
|
|
178
|
+
static fromText(text, line_separator = '\n') {
|
|
179
|
+
assert.isString(text, 'text');
|
|
180
|
+
assert.isString(line_separator, 'line_separator');
|
|
181
|
+
|
|
157
182
|
const r = new LineBuilder();
|
|
158
183
|
|
|
159
|
-
const lines = text.split(
|
|
184
|
+
const lines = text.split(line_separator);
|
|
160
185
|
|
|
161
186
|
const n = lines.length;
|
|
162
187
|
|
|
@@ -172,6 +197,10 @@ class LineBuilder {
|
|
|
172
197
|
|
|
173
198
|
return r;
|
|
174
199
|
}
|
|
200
|
+
|
|
201
|
+
toString() {
|
|
202
|
+
return this.build();
|
|
203
|
+
}
|
|
175
204
|
}
|
|
176
205
|
|
|
177
206
|
export default LineBuilder;
|