securemark 0.261.1 → 0.261.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/index.js +924 -453
- package/package.json +9 -9
- package/src/debug.test.ts +3 -3
- package/src/parser/block/olist.ts +4 -6
- package/src/parser/processor/figure.ts +2 -1
- package/src/parser/processor/footnote.ts +2 -1
- package/src/renderer/render.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.261.
|
|
1
|
+
/*! securemark v0.261.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("DOMPurify"), require("Prism"));
|
|
@@ -92,6 +92,8 @@ exports.splice = exports.pop = exports.push = exports.shift = exports.unshift =
|
|
|
92
92
|
|
|
93
93
|
const global_1 = __webpack_require__(4128);
|
|
94
94
|
|
|
95
|
+
const undefined = void 0;
|
|
96
|
+
|
|
95
97
|
function indexOf(as, a) {
|
|
96
98
|
if (as.length === 0) return -1;
|
|
97
99
|
return a === a ? as.indexOf(a) : as.findIndex(a => a !== a);
|
|
@@ -101,7 +103,10 @@ exports.indexOf = indexOf;
|
|
|
101
103
|
|
|
102
104
|
function unshift(as, bs) {
|
|
103
105
|
if ('length' in as) {
|
|
104
|
-
|
|
106
|
+
if (as.length === 1) return bs.unshift(as[0]), bs;
|
|
107
|
+
if (global_1.Symbol.iterator in as) return bs.unshift(...as), bs;
|
|
108
|
+
|
|
109
|
+
for (let i = as.length; i--;) {
|
|
105
110
|
bs.unshift(as[i]);
|
|
106
111
|
}
|
|
107
112
|
} else {
|
|
@@ -115,13 +120,16 @@ exports.unshift = unshift;
|
|
|
115
120
|
|
|
116
121
|
function shift(as, count) {
|
|
117
122
|
if (count < 0) throw new Error('Unexpected negative number');
|
|
118
|
-
return count ===
|
|
123
|
+
return count === undefined ? [as.shift(), as] : [splice(as, 0, count), as];
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
exports.shift = shift;
|
|
122
127
|
|
|
123
128
|
function push(as, bs) {
|
|
124
129
|
if ('length' in bs) {
|
|
130
|
+
if (bs.length === 1) return as.push(bs[0]), as;
|
|
131
|
+
if (global_1.Symbol.iterator in bs && bs.length > 50) return as.push(...bs), as;
|
|
132
|
+
|
|
125
133
|
for (let i = 0, len = bs.length; i < len; ++i) {
|
|
126
134
|
as.push(bs[i]);
|
|
127
135
|
}
|
|
@@ -138,50 +146,39 @@ exports.push = push;
|
|
|
138
146
|
|
|
139
147
|
function pop(as, count) {
|
|
140
148
|
if (count < 0) throw new Error('Unexpected negative number');
|
|
141
|
-
return count ===
|
|
149
|
+
return count === undefined ? [as, as.pop()] : [as, splice(as, as.length - count, count)];
|
|
142
150
|
}
|
|
143
151
|
|
|
144
152
|
exports.pop = pop;
|
|
145
153
|
|
|
146
|
-
function splice(as, index, count, ...
|
|
147
|
-
if (
|
|
154
|
+
function splice(as, index, count, ...values) {
|
|
155
|
+
if (as.length === 0) return push(as, values), [];
|
|
156
|
+
|
|
157
|
+
if (index > as.length) {
|
|
158
|
+
index = as.length;
|
|
159
|
+
} else if (index < 0) {
|
|
160
|
+
index = -index > as.length ? 0 : as.length + index;
|
|
161
|
+
}
|
|
162
|
+
|
|
148
163
|
count = count > as.length ? as.length : count;
|
|
164
|
+
if (count === 0 && values.length === 0) return [];
|
|
165
|
+
if (count === 1 && values.length === 1) return [[as[index], as[index] = values[0]][0]];
|
|
149
166
|
|
|
150
167
|
switch (index) {
|
|
151
168
|
case 0:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return [[], unshift(inserts, as)][0];
|
|
155
|
-
|
|
156
|
-
case 1:
|
|
157
|
-
return as.length === 0 ? [[], unshift(inserts, as)][0] : [[as.shift()], unshift(inserts, as)][0];
|
|
158
|
-
|
|
159
|
-
case void 0:
|
|
160
|
-
if (as.length > 1 || arguments.length > 2) break;
|
|
161
|
-
return as.length === 0 ? [] : splice(as, index, 1);
|
|
162
|
-
}
|
|
163
|
-
|
|
169
|
+
if (count === 0) return unshift(values, as), [];
|
|
170
|
+
if (count === 1) return [[as.shift()], unshift(values, as)][0];
|
|
164
171
|
break;
|
|
165
172
|
|
|
166
|
-
case -1:
|
|
167
173
|
case as.length - 1:
|
|
168
|
-
|
|
169
|
-
case 1:
|
|
170
|
-
return as.length === 0 ? [[], push(as, inserts)][0] : [[as.pop()], push(as, inserts)][0];
|
|
171
|
-
|
|
172
|
-
case void 0:
|
|
173
|
-
if (as.length > 1 || arguments.length > 2) break;
|
|
174
|
-
return as.length === 0 ? [] : splice(as, index, 1);
|
|
175
|
-
}
|
|
176
|
-
|
|
174
|
+
if (count === 1) return [[as.pop()], push(as, values)][0];
|
|
177
175
|
break;
|
|
178
176
|
|
|
179
177
|
case as.length:
|
|
180
|
-
|
|
181
|
-
return [[], push(as, inserts)][0];
|
|
178
|
+
return push(as, values), [];
|
|
182
179
|
}
|
|
183
180
|
|
|
184
|
-
return arguments.length > 2 ? as.splice(index, count, ...
|
|
181
|
+
return arguments.length > 2 ? as.splice(index, count, ...values) : as.splice(index);
|
|
185
182
|
}
|
|
186
183
|
|
|
187
184
|
exports.splice = splice;
|
|
@@ -369,15 +366,14 @@ const assign_1 = __webpack_require__(4401);
|
|
|
369
366
|
class Cache {
|
|
370
367
|
constructor(capacity, opts = {}) {
|
|
371
368
|
this.settings = {
|
|
372
|
-
window: 0,
|
|
373
369
|
capacity: 0,
|
|
374
|
-
space: global_1.Infinity,
|
|
375
370
|
age: global_1.Infinity,
|
|
376
371
|
earlyExpiring: false,
|
|
377
372
|
capture: {
|
|
378
373
|
delete: true,
|
|
379
374
|
clear: true
|
|
380
375
|
},
|
|
376
|
+
window: 0,
|
|
381
377
|
resolution: 1,
|
|
382
378
|
offset: 0,
|
|
383
379
|
block: 20,
|
|
@@ -391,7 +387,7 @@ class Cache {
|
|
|
391
387
|
LRU: new invlist_1.List(),
|
|
392
388
|
LFU: new invlist_1.List()
|
|
393
389
|
};
|
|
394
|
-
this.expiries = new heap_1.Heap(
|
|
390
|
+
this.expiries = new heap_1.Heap(heap_1.Heap.min);
|
|
395
391
|
this.misses = 0;
|
|
396
392
|
this.sweep = 0;
|
|
397
393
|
this.ratio = 500;
|
|
@@ -407,8 +403,7 @@ class Cache {
|
|
|
407
403
|
this.capacity = settings.capacity;
|
|
408
404
|
if (this.capacity >= 1 === false) throw new Error(`Spica: Cache: Capacity must be 1 or more.`);
|
|
409
405
|
this.window = settings.window || this.capacity;
|
|
410
|
-
if (this.window * 1000
|
|
411
|
-
this.space = settings.space;
|
|
406
|
+
if (this.window * 1000 >= this.capacity === false) throw new Error(`Spica: Cache: Window must be 0.1% of capacity or more.`);
|
|
412
407
|
this.block = settings.block;
|
|
413
408
|
this.limit = settings.limit;
|
|
414
409
|
this.earlyExpiring = settings.earlyExpiring;
|
|
@@ -438,13 +433,12 @@ class Cache {
|
|
|
438
433
|
|
|
439
434
|
ensure(margin, skip) {
|
|
440
435
|
let size = skip?.value.size ?? 0;
|
|
441
|
-
if (margin - size <= 0) return true;
|
|
442
436
|
const {
|
|
443
437
|
LRU,
|
|
444
438
|
LFU
|
|
445
439
|
} = this.indexes;
|
|
446
440
|
|
|
447
|
-
while (this.
|
|
441
|
+
while (this.size + margin - size > this.capacity) {
|
|
448
442
|
let target;
|
|
449
443
|
|
|
450
444
|
switch (true) {
|
|
@@ -494,7 +488,7 @@ class Cache {
|
|
|
494
488
|
size = 1,
|
|
495
489
|
age = this.settings.age
|
|
496
490
|
} = {}) {
|
|
497
|
-
if (size
|
|
491
|
+
if (size < 1 || this.capacity < size || age <= 0) {
|
|
498
492
|
this.disposer?.(value, key);
|
|
499
493
|
return false;
|
|
500
494
|
}
|
|
@@ -510,7 +504,7 @@ class Cache {
|
|
|
510
504
|
index.expiry = expiry;
|
|
511
505
|
|
|
512
506
|
if (this.earlyExpiring && expiry !== global_1.Infinity) {
|
|
513
|
-
index.enode ? this.expiries.update(index.enode) : index.enode = this.expiries.insert(node);
|
|
507
|
+
index.enode ? this.expiries.update(index.enode, expiry) : index.enode = this.expiries.insert(node, expiry);
|
|
514
508
|
} else if (index.enode) {
|
|
515
509
|
this.expiries.delete(index.enode);
|
|
516
510
|
index.enode = void 0;
|
|
@@ -535,7 +529,7 @@ class Cache {
|
|
|
535
529
|
}));
|
|
536
530
|
|
|
537
531
|
if (this.earlyExpiring && expiry !== global_1.Infinity) {
|
|
538
|
-
LRU.head.value.enode = this.expiries.insert(LRU.head);
|
|
532
|
+
LRU.head.value.enode = this.expiries.insert(LRU.head, expiry);
|
|
539
533
|
}
|
|
540
534
|
|
|
541
535
|
return false;
|
|
@@ -560,14 +554,14 @@ class Cache {
|
|
|
560
554
|
++this.misses;
|
|
561
555
|
this.evict(node, true);
|
|
562
556
|
return;
|
|
563
|
-
}
|
|
557
|
+
}
|
|
564
558
|
|
|
559
|
+
this.misses &&= 0;
|
|
560
|
+
this.sweep &&= 0; // Optimization for memoize.
|
|
565
561
|
|
|
566
562
|
if (this.capacity > 3 && node === node.list.head) return node.value.value;
|
|
567
563
|
this.access(node);
|
|
568
564
|
this.adjust();
|
|
569
|
-
this.misses &&= 0;
|
|
570
|
-
this.sweep = 0;
|
|
571
565
|
return node.value.value;
|
|
572
566
|
}
|
|
573
567
|
|
|
@@ -607,21 +601,35 @@ class Cache {
|
|
|
607
601
|
const memory = this.memory;
|
|
608
602
|
this.memory = new global_1.Map();
|
|
609
603
|
|
|
610
|
-
for (const
|
|
611
|
-
|
|
612
|
-
|
|
604
|
+
for (const {
|
|
605
|
+
0: key,
|
|
606
|
+
1: {
|
|
607
|
+
value: {
|
|
608
|
+
value
|
|
609
|
+
}
|
|
613
610
|
}
|
|
614
|
-
}
|
|
611
|
+
} of memory) {
|
|
615
612
|
this.disposer(value, key);
|
|
616
613
|
}
|
|
617
614
|
}
|
|
618
615
|
|
|
616
|
+
resize(capacity) {
|
|
617
|
+
if (this.capacity >= 1 === false) throw new Error(`Spica: Cache: Capacity must be 1 or more.`);
|
|
618
|
+
this.capacity = capacity;
|
|
619
|
+
this.window = this.settings.window || this.capacity;
|
|
620
|
+
if (this.window * 1000 >= this.capacity === false) throw new Error(`Spica: Cache: Window must be 0.1% of capacity or more.`);
|
|
621
|
+
this.ensure(0);
|
|
622
|
+
}
|
|
623
|
+
|
|
619
624
|
*[Symbol.iterator]() {
|
|
620
|
-
for (const
|
|
621
|
-
|
|
622
|
-
|
|
625
|
+
for (const {
|
|
626
|
+
0: key,
|
|
627
|
+
1: {
|
|
628
|
+
value: {
|
|
629
|
+
value
|
|
630
|
+
}
|
|
623
631
|
}
|
|
624
|
-
}
|
|
632
|
+
} of this.memory) {
|
|
625
633
|
yield [key, value];
|
|
626
634
|
}
|
|
627
635
|
|
|
@@ -792,58 +800,56 @@ function rate(window, hits1, hits2, offset) {
|
|
|
792
800
|
Object.defineProperty(exports, "__esModule", ({
|
|
793
801
|
value: true
|
|
794
802
|
}));
|
|
795
|
-
exports.tick = exports.clock = exports.now = void 0;
|
|
803
|
+
exports.tick = exports.promise = exports.clock = exports.now = void 0;
|
|
796
804
|
|
|
797
805
|
const global_1 = __webpack_require__(4128);
|
|
798
806
|
|
|
799
|
-
const
|
|
807
|
+
const queue_1 = __webpack_require__(4934);
|
|
800
808
|
|
|
801
809
|
const exception_1 = __webpack_require__(7822);
|
|
802
810
|
|
|
803
|
-
|
|
811
|
+
const undefined = void 0;
|
|
812
|
+
let time;
|
|
804
813
|
let count = 0;
|
|
805
814
|
|
|
806
|
-
function now(nocache
|
|
807
|
-
if (
|
|
808
|
-
tick(() =>
|
|
809
|
-
} else if (!nocache && ++
|
|
810
|
-
return
|
|
815
|
+
function now(nocache) {
|
|
816
|
+
if (time === undefined) {
|
|
817
|
+
tick(() => time = undefined);
|
|
818
|
+
} else if (!nocache && count++ !== 20) {
|
|
819
|
+
return time;
|
|
811
820
|
}
|
|
812
821
|
|
|
813
|
-
count =
|
|
814
|
-
return
|
|
822
|
+
count = 1;
|
|
823
|
+
return time = global_1.Date.now();
|
|
815
824
|
}
|
|
816
825
|
|
|
817
826
|
exports.now = now;
|
|
818
|
-
exports.clock = Promise.resolve(
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
827
|
+
exports.clock = global_1.Promise.resolve(undefined);
|
|
828
|
+
|
|
829
|
+
function promise(cb) {
|
|
830
|
+
global_1.Promise.resolve().then(cb);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
exports.promise = promise;
|
|
834
|
+
const queue = new queue_1.Queue();
|
|
835
|
+
const scheduler = global_1.Promise.resolve();
|
|
823
836
|
|
|
824
837
|
function tick(cb) {
|
|
825
|
-
|
|
826
|
-
|
|
838
|
+
queue.isEmpty() && scheduler.then(run);
|
|
839
|
+
queue.push(cb);
|
|
827
840
|
}
|
|
828
841
|
|
|
829
842
|
exports.tick = tick;
|
|
830
843
|
|
|
831
844
|
function run() {
|
|
832
|
-
|
|
833
|
-
[index, queue, jobs] = [0, jobs, queue];
|
|
834
|
-
|
|
835
|
-
for (let i = 0; i < count; ++i) {
|
|
845
|
+
for (let count = queue.length; count--;) {
|
|
836
846
|
try {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
jobs[i] = void 0;
|
|
847
|
+
// @ts-expect-error
|
|
848
|
+
(0, queue.pop())();
|
|
840
849
|
} catch (reason) {
|
|
841
850
|
(0, exception_1.causeAsyncException)(reason);
|
|
842
851
|
}
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
jobs.length > 1000 && count < jobs.length * 0.5 && jobs.splice((0, alias_1.floor)(jobs.length * 0.9), jobs.length);
|
|
852
|
+
}
|
|
847
853
|
}
|
|
848
854
|
|
|
849
855
|
/***/ }),
|
|
@@ -880,62 +886,51 @@ exports.MultiMap = void 0;
|
|
|
880
886
|
|
|
881
887
|
const global_1 = __webpack_require__(4128);
|
|
882
888
|
|
|
883
|
-
const
|
|
889
|
+
const ring_1 = __webpack_require__(6395);
|
|
884
890
|
|
|
885
891
|
class MultiMap {
|
|
886
892
|
constructor(entries = [], memory = new global_1.Map()) {
|
|
887
893
|
this.memory = memory;
|
|
888
894
|
|
|
889
|
-
for (const
|
|
895
|
+
for (const {
|
|
896
|
+
0: k,
|
|
897
|
+
1: v
|
|
898
|
+
} of entries) {
|
|
890
899
|
this.set(k, v);
|
|
891
900
|
}
|
|
892
901
|
}
|
|
893
902
|
|
|
894
903
|
get(key) {
|
|
895
|
-
return this.memory.get(key)?.
|
|
904
|
+
return this.memory.get(key)?.at(0);
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
getAll(key) {
|
|
908
|
+
return this.memory.get(key);
|
|
896
909
|
}
|
|
897
910
|
|
|
898
911
|
set(key, val) {
|
|
899
|
-
|
|
912
|
+
let vs = this.memory.get(key);
|
|
913
|
+
if (vs) return vs.push(val), this;
|
|
914
|
+
vs = new ring_1.Ring();
|
|
915
|
+
vs.push(val);
|
|
916
|
+
this.memory.set(key, vs);
|
|
900
917
|
return this;
|
|
901
918
|
}
|
|
902
919
|
|
|
903
920
|
has(key, value) {
|
|
904
921
|
const vs = this.memory.get(key);
|
|
905
|
-
if (!vs
|
|
922
|
+
if (!vs?.length) return false;
|
|
906
923
|
if (arguments.length < 2) return true;
|
|
907
|
-
|
|
908
|
-
switch (value) {
|
|
909
|
-
case vs[0]:
|
|
910
|
-
case vs[vs.length - 1]:
|
|
911
|
-
return true;
|
|
912
|
-
|
|
913
|
-
default:
|
|
914
|
-
return (0, array_1.indexOf)(vs, value) > -1;
|
|
915
|
-
}
|
|
924
|
+
return vs.includes(value);
|
|
916
925
|
}
|
|
917
926
|
|
|
918
927
|
delete(key, value) {
|
|
919
928
|
if (arguments.length < 2) return this.memory.delete(key);
|
|
920
929
|
const vs = this.memory.get(key);
|
|
921
|
-
if (!vs
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
vs.shift();
|
|
926
|
-
break;
|
|
927
|
-
|
|
928
|
-
case vs[vs.length - 1]:
|
|
929
|
-
vs.pop();
|
|
930
|
-
break;
|
|
931
|
-
|
|
932
|
-
default:
|
|
933
|
-
const i = (0, array_1.indexOf)(vs, value);
|
|
934
|
-
if (i === -1) return false;
|
|
935
|
-
(0, array_1.splice)(vs, i, 1);
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
vs.length === 0 && this.memory.delete(key);
|
|
930
|
+
if (!vs?.length) return false;
|
|
931
|
+
const i = vs.indexOf(value);
|
|
932
|
+
if (i === -1) return false;
|
|
933
|
+
vs.splice(i, 1);
|
|
939
934
|
return true;
|
|
940
935
|
}
|
|
941
936
|
|
|
@@ -944,22 +939,32 @@ class MultiMap {
|
|
|
944
939
|
}
|
|
945
940
|
|
|
946
941
|
take(key, count) {
|
|
947
|
-
const vs = this.memory.get(key)
|
|
948
|
-
|
|
942
|
+
const vs = this.memory.get(key);
|
|
943
|
+
if (count === void 0) return vs?.shift();
|
|
944
|
+
const acc = [];
|
|
945
|
+
|
|
946
|
+
while (vs?.length && count--) {
|
|
947
|
+
acc.push(vs.shift());
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
return acc;
|
|
949
951
|
}
|
|
950
952
|
|
|
951
953
|
ref(key) {
|
|
952
954
|
let vs = this.memory.get(key);
|
|
953
955
|
if (vs) return vs;
|
|
954
|
-
vs =
|
|
956
|
+
vs = new ring_1.Ring();
|
|
955
957
|
this.memory.set(key, vs);
|
|
956
958
|
return vs;
|
|
957
959
|
}
|
|
958
960
|
|
|
959
961
|
*[Symbol.iterator]() {
|
|
960
|
-
for (const
|
|
962
|
+
for (const {
|
|
963
|
+
0: k,
|
|
964
|
+
1: vs
|
|
965
|
+
} of this.memory) {
|
|
961
966
|
for (let i = 0; i < vs.length; ++i) {
|
|
962
|
-
yield [k, vs
|
|
967
|
+
yield [k, vs.at(i)];
|
|
963
968
|
}
|
|
964
969
|
}
|
|
965
970
|
|
|
@@ -981,12 +986,12 @@ exports.MultiMap = MultiMap;
|
|
|
981
986
|
Object.defineProperty(exports, "__esModule", ({
|
|
982
987
|
value: true
|
|
983
988
|
}));
|
|
984
|
-
exports.duffReduce = exports.duffEach = exports.duffbk = exports.duff = void 0;
|
|
989
|
+
exports.duffReduce = exports.duffEach = exports.duffbk = exports.duff = void 0; // 100,000以上でforより大幅に低速となり実用不可
|
|
985
990
|
|
|
986
991
|
function duff(count, proc) {
|
|
987
992
|
if (count > 0) {
|
|
988
993
|
let i = 0,
|
|
989
|
-
m = count
|
|
994
|
+
m = count & 7,
|
|
990
995
|
d = (count - m) / 8;
|
|
991
996
|
|
|
992
997
|
while (m--) {
|
|
@@ -1005,7 +1010,7 @@ function duff(count, proc) {
|
|
|
1005
1010
|
}
|
|
1006
1011
|
} else {
|
|
1007
1012
|
let i = -count,
|
|
1008
|
-
m = i
|
|
1013
|
+
m = i & 7,
|
|
1009
1014
|
d = (i - m) / 8;
|
|
1010
1015
|
|
|
1011
1016
|
while (m--) {
|
|
@@ -1025,12 +1030,12 @@ function duff(count, proc) {
|
|
|
1025
1030
|
}
|
|
1026
1031
|
}
|
|
1027
1032
|
|
|
1028
|
-
exports.duff = duff;
|
|
1033
|
+
exports.duff = duff; // 100,000以上でforより大幅に低速となり実用不可
|
|
1029
1034
|
|
|
1030
1035
|
function duffbk(count, proc) {
|
|
1031
1036
|
if (count > 0) {
|
|
1032
1037
|
let i = 0,
|
|
1033
|
-
m = count
|
|
1038
|
+
m = count & 7,
|
|
1034
1039
|
d = (count - m) / 8;
|
|
1035
1040
|
|
|
1036
1041
|
while (m--) {
|
|
@@ -1038,18 +1043,21 @@ function duffbk(count, proc) {
|
|
|
1038
1043
|
}
|
|
1039
1044
|
|
|
1040
1045
|
while (d--) {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1046
|
+
switch (false) {
|
|
1047
|
+
case proc(i++):
|
|
1048
|
+
case proc(i++):
|
|
1049
|
+
case proc(i++):
|
|
1050
|
+
case proc(i++):
|
|
1051
|
+
case proc(i++):
|
|
1052
|
+
case proc(i++):
|
|
1053
|
+
case proc(i++):
|
|
1054
|
+
case proc(i++):
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1049
1057
|
}
|
|
1050
1058
|
} else {
|
|
1051
1059
|
let i = -count,
|
|
1052
|
-
m = i
|
|
1060
|
+
m = i & 7,
|
|
1053
1061
|
d = (i - m) / 8;
|
|
1054
1062
|
|
|
1055
1063
|
while (m--) {
|
|
@@ -1057,14 +1065,17 @@ function duffbk(count, proc) {
|
|
|
1057
1065
|
}
|
|
1058
1066
|
|
|
1059
1067
|
while (d--) {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
+
switch (false) {
|
|
1069
|
+
case proc(--i):
|
|
1070
|
+
case proc(--i):
|
|
1071
|
+
case proc(--i):
|
|
1072
|
+
case proc(--i):
|
|
1073
|
+
case proc(--i):
|
|
1074
|
+
case proc(--i):
|
|
1075
|
+
case proc(--i):
|
|
1076
|
+
case proc(--i):
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1068
1079
|
}
|
|
1069
1080
|
}
|
|
1070
1081
|
}
|
|
@@ -1074,7 +1085,7 @@ exports.duffbk = duffbk;
|
|
|
1074
1085
|
function duffEach(array, proc) {
|
|
1075
1086
|
let count = array.length;
|
|
1076
1087
|
let i = 0,
|
|
1077
|
-
m = count
|
|
1088
|
+
m = count & 7,
|
|
1078
1089
|
d = (count - m) / 8;
|
|
1079
1090
|
|
|
1080
1091
|
while (m--) {
|
|
@@ -1093,30 +1104,32 @@ function duffEach(array, proc) {
|
|
|
1093
1104
|
}
|
|
1094
1105
|
}
|
|
1095
1106
|
|
|
1096
|
-
exports.duffEach = duffEach;
|
|
1107
|
+
exports.duffEach = duffEach; // ベンチマークの10,000以上で急激な速度低下が見られる場合があるがNodeListなどでの
|
|
1108
|
+
// 実際の使用では速度低下は見られない
|
|
1097
1109
|
|
|
1098
1110
|
function duffReduce(array, proc, initial) {
|
|
1099
1111
|
let count = array.length;
|
|
1100
1112
|
let i = 0,
|
|
1101
|
-
m = count
|
|
1113
|
+
m = count & 7,
|
|
1102
1114
|
d = (count - m) / 8;
|
|
1115
|
+
let acc = initial;
|
|
1103
1116
|
|
|
1104
1117
|
while (m--) {
|
|
1105
|
-
|
|
1118
|
+
acc = proc(acc, array[i], i++, array);
|
|
1106
1119
|
}
|
|
1107
1120
|
|
|
1108
1121
|
while (d--) {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1122
|
+
acc = proc(acc, array[i], i++, array);
|
|
1123
|
+
acc = proc(acc, array[i], i++, array);
|
|
1124
|
+
acc = proc(acc, array[i], i++, array);
|
|
1125
|
+
acc = proc(acc, array[i], i++, array);
|
|
1126
|
+
acc = proc(acc, array[i], i++, array);
|
|
1127
|
+
acc = proc(acc, array[i], i++, array);
|
|
1128
|
+
acc = proc(acc, array[i], i++, array);
|
|
1129
|
+
acc = proc(acc, array[i], i++, array);
|
|
1117
1130
|
}
|
|
1118
1131
|
|
|
1119
|
-
return
|
|
1132
|
+
return acc;
|
|
1120
1133
|
}
|
|
1121
1134
|
|
|
1122
1135
|
exports.duffReduce = duffReduce;
|
|
@@ -1180,18 +1193,22 @@ var global = (/* unused pure expression or super */ null && (globalThis));
|
|
|
1180
1193
|
Object.defineProperty(exports, "__esModule", ({
|
|
1181
1194
|
value: true
|
|
1182
1195
|
}));
|
|
1183
|
-
exports.Heap = void 0;
|
|
1196
|
+
exports.MultiHeap = exports.Heap = void 0;
|
|
1184
1197
|
|
|
1185
|
-
const
|
|
1198
|
+
const global_1 = __webpack_require__(4128);
|
|
1186
1199
|
|
|
1200
|
+
const invlist_1 = __webpack_require__(7452);
|
|
1201
|
+
|
|
1202
|
+
const memoize_1 = __webpack_require__(1808);
|
|
1187
1203
|
|
|
1188
1204
|
const undefined = void 0;
|
|
1205
|
+
let size = 16;
|
|
1189
1206
|
|
|
1190
1207
|
class Heap {
|
|
1191
|
-
constructor(cmp =
|
|
1208
|
+
constructor(cmp = Heap.max, stable = false) {
|
|
1192
1209
|
this.cmp = cmp;
|
|
1193
1210
|
this.stable = stable;
|
|
1194
|
-
this.array =
|
|
1211
|
+
this.array = (0, global_1.Array)(size);
|
|
1195
1212
|
this.$length = 0;
|
|
1196
1213
|
}
|
|
1197
1214
|
|
|
@@ -1199,19 +1216,35 @@ class Heap {
|
|
|
1199
1216
|
return this.$length;
|
|
1200
1217
|
}
|
|
1201
1218
|
|
|
1202
|
-
|
|
1219
|
+
isEmpty() {
|
|
1220
|
+
return this.array[0] !== undefined;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
peek() {
|
|
1224
|
+
return this.array[0]?.[1];
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
insert(value, order) {
|
|
1228
|
+
if (arguments.length < 2) {
|
|
1229
|
+
order = value;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1203
1232
|
const array = this.array;
|
|
1204
1233
|
const node = array[this.$length] = [order, value, this.$length++];
|
|
1205
|
-
upHeapify(
|
|
1234
|
+
upHeapify(this.cmp, array, this.$length);
|
|
1206
1235
|
return node;
|
|
1207
1236
|
}
|
|
1208
1237
|
|
|
1209
|
-
replace(value, order
|
|
1210
|
-
|
|
1238
|
+
replace(value, order) {
|
|
1239
|
+
if (arguments.length < 2) {
|
|
1240
|
+
order = value;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1211
1243
|
if (this.$length === 0) return void this.insert(value, order);
|
|
1244
|
+
const array = this.array;
|
|
1212
1245
|
const replaced = array[0][1];
|
|
1213
1246
|
array[0] = [order, value, 0];
|
|
1214
|
-
downHeapify(
|
|
1247
|
+
downHeapify(this.cmp, array, 1, this.$length, this.stable);
|
|
1215
1248
|
return replaced;
|
|
1216
1249
|
}
|
|
1217
1250
|
|
|
@@ -1229,47 +1262,146 @@ class Heap {
|
|
|
1229
1262
|
swap(array, index, --this.$length); // @ts-expect-error
|
|
1230
1263
|
|
|
1231
1264
|
array[this.$length] = undefined;
|
|
1232
|
-
index < this.$length && this.
|
|
1233
|
-
|
|
1234
|
-
if (array.length >= 2 ** 16 && array.length >= this.$length * 2) {
|
|
1235
|
-
array.splice(array.length / 2, array.length / 2);
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1265
|
+
index < this.$length && sort(this.cmp, array, index, this.$length, this.stable);
|
|
1238
1266
|
return node[1];
|
|
1239
1267
|
}
|
|
1240
1268
|
|
|
1241
|
-
update(node, order
|
|
1269
|
+
update(node, order, value) {
|
|
1270
|
+
if (arguments.length < 2) {
|
|
1271
|
+
order = node[0];
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1242
1274
|
const array = this.array;
|
|
1243
1275
|
if (array[node[2]] !== node) throw new Error('Invalid node');
|
|
1244
|
-
|
|
1276
|
+
|
|
1277
|
+
if (arguments.length > 2) {
|
|
1278
|
+
node[1] = value;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1245
1281
|
if (this.cmp(node[0], node[0] = order) === 0) return;
|
|
1246
|
-
this.
|
|
1282
|
+
sort(this.cmp, array, node[2], this.$length, this.stable);
|
|
1247
1283
|
}
|
|
1248
1284
|
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1285
|
+
clear() {
|
|
1286
|
+
this.array = (0, global_1.Array)(size);
|
|
1287
|
+
this.$length = 0;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
exports.Heap = Heap;
|
|
1293
|
+
|
|
1294
|
+
Heap.max = (a, b) => a > b ? -1 : a < b ? 1 : 0;
|
|
1295
|
+
|
|
1296
|
+
Heap.min = (a, b) => a > b ? 1 : a < b ? -1 : 0;
|
|
1297
|
+
|
|
1298
|
+
class MultiHeap {
|
|
1299
|
+
constructor(cmp = MultiHeap.max, clean = true) {
|
|
1300
|
+
this.cmp = cmp;
|
|
1301
|
+
this.clean = clean;
|
|
1302
|
+
this.heap = new Heap(this.cmp);
|
|
1303
|
+
this.dict = new Map();
|
|
1304
|
+
this.list = (0, memoize_1.memoize)(order => {
|
|
1305
|
+
const list = new invlist_1.List();
|
|
1306
|
+
list[MultiHeap.order] = order;
|
|
1307
|
+
list[MultiHeap.heap] = this.heap.insert(list, order);
|
|
1308
|
+
return list;
|
|
1309
|
+
}, this.dict);
|
|
1310
|
+
this.$length = 0;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
get length() {
|
|
1314
|
+
return this.$length;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
isEmpty() {
|
|
1318
|
+
return this.heap.isEmpty();
|
|
1252
1319
|
}
|
|
1253
1320
|
|
|
1254
1321
|
peek() {
|
|
1255
|
-
return this.
|
|
1322
|
+
return this.heap.peek()?.head.value;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
insert(value, order) {
|
|
1326
|
+
if (arguments.length < 2) {
|
|
1327
|
+
order = value;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
++this.$length;
|
|
1331
|
+
const list = this.list(order);
|
|
1332
|
+
return [order, list.push(value)];
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
extract() {
|
|
1336
|
+
if (this.$length === 0) return;
|
|
1337
|
+
--this.$length;
|
|
1338
|
+
const list = this.heap.peek();
|
|
1339
|
+
const value = list.shift();
|
|
1340
|
+
|
|
1341
|
+
if (list.length === 0) {
|
|
1342
|
+
this.heap.extract();
|
|
1343
|
+
this.clean && this.dict.delete(list[MultiHeap.order]);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
return value;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
delete(node) {
|
|
1350
|
+
if (!node[1].list) throw new Error('Invalid node');
|
|
1351
|
+
const {
|
|
1352
|
+
0: order,
|
|
1353
|
+
1: lnode
|
|
1354
|
+
} = node;
|
|
1355
|
+
--this.$length;
|
|
1356
|
+
|
|
1357
|
+
if (lnode.list.length === 1) {
|
|
1358
|
+
this.heap.delete(lnode[MultiHeap.heap]);
|
|
1359
|
+
this.clean && this.dict.delete(order);
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
return lnode.delete();
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
update(node, order, value) {
|
|
1366
|
+
if (!node[1].list) throw new Error('Invalid node');
|
|
1367
|
+
|
|
1368
|
+
if (arguments.length < 2) {
|
|
1369
|
+
order = node[0];
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
if (arguments.length > 2) {
|
|
1373
|
+
node[1].value = value;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
if (this.cmp(node[0], order) === 0) return node;
|
|
1377
|
+
this.delete(node);
|
|
1378
|
+
return this.insert(node[1].value, order);
|
|
1256
1379
|
}
|
|
1257
1380
|
|
|
1258
1381
|
clear() {
|
|
1259
|
-
this.
|
|
1382
|
+
this.heap.clear();
|
|
1383
|
+
this.dict.clear();
|
|
1260
1384
|
this.$length = 0;
|
|
1261
1385
|
}
|
|
1262
1386
|
|
|
1263
1387
|
}
|
|
1264
1388
|
|
|
1265
|
-
exports.
|
|
1389
|
+
exports.MultiHeap = MultiHeap;
|
|
1390
|
+
MultiHeap.order = Symbol('order');
|
|
1391
|
+
MultiHeap.heap = Symbol('heap');
|
|
1392
|
+
MultiHeap.max = Heap.max;
|
|
1393
|
+
MultiHeap.min = Heap.min;
|
|
1266
1394
|
|
|
1267
|
-
function
|
|
1395
|
+
function sort(cmp, array, index, length, stable) {
|
|
1396
|
+
return upHeapify(cmp, array, index + 1) || downHeapify(cmp, array, index + 1, length, stable);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
function upHeapify(cmp, array, index) {
|
|
1268
1400
|
const order = array[index - 1][0];
|
|
1269
1401
|
let changed = false;
|
|
1270
1402
|
|
|
1271
1403
|
while (index > 1) {
|
|
1272
|
-
const parent =
|
|
1404
|
+
const parent = index / 2 | 0;
|
|
1273
1405
|
if (cmp(array[parent - 1][0], order) <= 0) break;
|
|
1274
1406
|
swap(array, index - 1, parent - 1);
|
|
1275
1407
|
index = parent;
|
|
@@ -1279,7 +1411,7 @@ function upHeapify(array, cmp, index) {
|
|
|
1279
1411
|
return changed;
|
|
1280
1412
|
}
|
|
1281
1413
|
|
|
1282
|
-
function downHeapify(
|
|
1414
|
+
function downHeapify(cmp, array, index, length, stable) {
|
|
1283
1415
|
let changed = false;
|
|
1284
1416
|
|
|
1285
1417
|
while (index < length) {
|
|
@@ -1357,7 +1489,7 @@ __exportStar(__webpack_require__(2310), exports);
|
|
|
1357
1489
|
/***/ ((__unused_webpack_module, exports) => {
|
|
1358
1490
|
|
|
1359
1491
|
"use strict";
|
|
1360
|
-
// Circular
|
|
1492
|
+
// Circular Inverse List
|
|
1361
1493
|
|
|
1362
1494
|
var _a;
|
|
1363
1495
|
|
|
@@ -1395,10 +1527,18 @@ class List {
|
|
|
1395
1527
|
return this.head = this.push(value);
|
|
1396
1528
|
}
|
|
1397
1529
|
|
|
1530
|
+
push(value) {
|
|
1531
|
+
return new Node(this, value, this.head, this.head?.prev);
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1398
1534
|
unshiftNode(node) {
|
|
1399
1535
|
return this.head = this.pushNode(node);
|
|
1400
1536
|
}
|
|
1401
1537
|
|
|
1538
|
+
pushNode(node) {
|
|
1539
|
+
return this.insert(node, this.head);
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1402
1542
|
unshiftRotationally(value) {
|
|
1403
1543
|
const node = this.last;
|
|
1404
1544
|
if (!node) return this.unshift(value);
|
|
@@ -1407,18 +1547,6 @@ class List {
|
|
|
1407
1547
|
return node;
|
|
1408
1548
|
}
|
|
1409
1549
|
|
|
1410
|
-
shift() {
|
|
1411
|
-
return this.head?.delete();
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
push(value) {
|
|
1415
|
-
return new Node(value, this.head, this.head?.prev, this);
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
pushNode(node) {
|
|
1419
|
-
return this.insert(node, this.head);
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
1550
|
pushRotationally(value) {
|
|
1423
1551
|
const node = this.head;
|
|
1424
1552
|
if (!node) return this.push(value);
|
|
@@ -1427,12 +1555,16 @@ class List {
|
|
|
1427
1555
|
return node;
|
|
1428
1556
|
}
|
|
1429
1557
|
|
|
1558
|
+
shift() {
|
|
1559
|
+
return this.head?.delete();
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1430
1562
|
pop() {
|
|
1431
1563
|
return this.last?.delete();
|
|
1432
1564
|
}
|
|
1433
1565
|
|
|
1434
1566
|
insert(node, before = this.head) {
|
|
1435
|
-
if (node.list === this) return
|
|
1567
|
+
if (node.list === this) return node.moveTo(before), node;
|
|
1436
1568
|
node.delete();
|
|
1437
1569
|
++this[LENGTH];
|
|
1438
1570
|
this.head ??= node; // @ts-expect-error
|
|
@@ -1457,11 +1589,11 @@ class List {
|
|
|
1457
1589
|
exports.List = List;
|
|
1458
1590
|
|
|
1459
1591
|
class Node {
|
|
1460
|
-
constructor(value, next, prev
|
|
1592
|
+
constructor(list, value, next, prev) {
|
|
1593
|
+
this.list = list;
|
|
1461
1594
|
this.value = value;
|
|
1462
1595
|
this.next = next;
|
|
1463
1596
|
this.prev = prev;
|
|
1464
|
-
this.list = list;
|
|
1465
1597
|
++list[LENGTH];
|
|
1466
1598
|
list.head ??= this;
|
|
1467
1599
|
next && prev ? next.prev = prev.next = this : this.next = this.prev = this;
|
|
@@ -1470,17 +1602,21 @@ class Node {
|
|
|
1470
1602
|
delete() {
|
|
1471
1603
|
if (!this.list) return this.value;
|
|
1472
1604
|
--this.list[LENGTH];
|
|
1605
|
+
const {
|
|
1606
|
+
next,
|
|
1607
|
+
prev
|
|
1608
|
+
} = this;
|
|
1473
1609
|
|
|
1474
1610
|
if (this.list.head === this) {
|
|
1475
|
-
this.list.head =
|
|
1611
|
+
this.list.head = next === this ? undefined : next;
|
|
1476
1612
|
}
|
|
1477
1613
|
|
|
1478
|
-
if (
|
|
1479
|
-
|
|
1614
|
+
if (next) {
|
|
1615
|
+
next.prev = prev;
|
|
1480
1616
|
}
|
|
1481
1617
|
|
|
1482
|
-
if (
|
|
1483
|
-
|
|
1618
|
+
if (prev) {
|
|
1619
|
+
prev.next = next;
|
|
1484
1620
|
} // @ts-expect-error
|
|
1485
1621
|
|
|
1486
1622
|
|
|
@@ -1491,20 +1627,19 @@ class Node {
|
|
|
1491
1627
|
}
|
|
1492
1628
|
|
|
1493
1629
|
insertBefore(value) {
|
|
1494
|
-
return new Node(value, this, this.prev
|
|
1630
|
+
return new Node(this.list, value, this, this.prev);
|
|
1495
1631
|
}
|
|
1496
1632
|
|
|
1497
1633
|
insertAfter(value) {
|
|
1498
|
-
return new Node(value, this.next, this
|
|
1634
|
+
return new Node(this.list, value, this.next, this);
|
|
1499
1635
|
}
|
|
1500
1636
|
|
|
1501
|
-
|
|
1637
|
+
moveTo(before) {
|
|
1502
1638
|
if (!before) return false;
|
|
1503
1639
|
if (this === before) return false;
|
|
1504
1640
|
if (before.list !== this.list) return before.list.insert(this, before), true;
|
|
1505
1641
|
const a1 = this;
|
|
1506
1642
|
const b1 = before;
|
|
1507
|
-
if (!b1) return false;
|
|
1508
1643
|
if (a1.next === b1) return false;
|
|
1509
1644
|
const b0 = b1.prev;
|
|
1510
1645
|
const a0 = a1.prev;
|
|
@@ -1519,12 +1654,12 @@ class Node {
|
|
|
1519
1654
|
}
|
|
1520
1655
|
|
|
1521
1656
|
moveToHead() {
|
|
1522
|
-
this.
|
|
1657
|
+
this.moveTo(this.list.head);
|
|
1523
1658
|
this.list.head = this;
|
|
1524
1659
|
}
|
|
1525
1660
|
|
|
1526
1661
|
moveToLast() {
|
|
1527
|
-
this.
|
|
1662
|
+
this.moveTo(this.list.head);
|
|
1528
1663
|
}
|
|
1529
1664
|
|
|
1530
1665
|
swap(node) {
|
|
@@ -1533,8 +1668,8 @@ class Node {
|
|
|
1533
1668
|
if (node1 === node2) return false;
|
|
1534
1669
|
const node3 = node2.next;
|
|
1535
1670
|
if (node1.list !== node2.list) throw new Error(`Spica: InvList: Cannot swap nodes across lists.`);
|
|
1536
|
-
node2.
|
|
1537
|
-
node1.
|
|
1671
|
+
node2.moveTo(node1);
|
|
1672
|
+
node1.moveTo(node3);
|
|
1538
1673
|
|
|
1539
1674
|
switch (this.list.head) {
|
|
1540
1675
|
case node1:
|
|
@@ -1570,12 +1705,14 @@ const alias_1 = __webpack_require__(5406);
|
|
|
1570
1705
|
|
|
1571
1706
|
const compare_1 = __webpack_require__(5529);
|
|
1572
1707
|
|
|
1708
|
+
const undefined = void 0;
|
|
1709
|
+
|
|
1573
1710
|
function memoize(f, identify = (...as) => as[0], memory) {
|
|
1574
|
-
if (typeof identify === 'object') return memoize(f,
|
|
1575
|
-
if (memory ===
|
|
1711
|
+
if (typeof identify === 'object') return memoize(f, undefined, identify);
|
|
1712
|
+
if (memory === undefined) return memoize(f, identify, new global_1.Map());
|
|
1576
1713
|
if ((0, alias_1.isArray)(memory)) return memoize(f, identify, {
|
|
1577
1714
|
has(key) {
|
|
1578
|
-
return memory[key] !==
|
|
1715
|
+
return memory[key] !== undefined;
|
|
1579
1716
|
},
|
|
1580
1717
|
|
|
1581
1718
|
get(key) {
|
|
@@ -1596,9 +1733,9 @@ function memoize(f, identify = (...as) => as[0], memory) {
|
|
|
1596
1733
|
return (...as) => {
|
|
1597
1734
|
const b = identify(...as);
|
|
1598
1735
|
let z = memory.get(b);
|
|
1599
|
-
if (z !==
|
|
1736
|
+
if (z !== undefined || nullish && memory.has(b)) return z;
|
|
1600
1737
|
z = f(...as);
|
|
1601
|
-
nullish ||= z ===
|
|
1738
|
+
nullish ||= z === undefined;
|
|
1602
1739
|
memory.set(b, z);
|
|
1603
1740
|
return z;
|
|
1604
1741
|
};
|
|
@@ -1607,8 +1744,8 @@ function memoize(f, identify = (...as) => as[0], memory) {
|
|
|
1607
1744
|
exports.memoize = memoize;
|
|
1608
1745
|
|
|
1609
1746
|
function reduce(f, identify = (...as) => as[0]) {
|
|
1610
|
-
let key =
|
|
1611
|
-
let val
|
|
1747
|
+
let key = {};
|
|
1748
|
+
let val;
|
|
1612
1749
|
return (...as) => {
|
|
1613
1750
|
const b = identify(...as);
|
|
1614
1751
|
|
|
@@ -1650,15 +1787,219 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
1650
1787
|
o[k2] = m[k];
|
|
1651
1788
|
});
|
|
1652
1789
|
|
|
1653
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1654
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1655
|
-
};
|
|
1790
|
+
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1791
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1794
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1795
|
+
value: true
|
|
1796
|
+
}));
|
|
1797
|
+
|
|
1798
|
+
__exportStar(__webpack_require__(5084), exports);
|
|
1799
|
+
|
|
1800
|
+
/***/ }),
|
|
1801
|
+
|
|
1802
|
+
/***/ 4934:
|
|
1803
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1804
|
+
|
|
1805
|
+
"use strict";
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1809
|
+
value: true
|
|
1810
|
+
}));
|
|
1811
|
+
exports.PriorityQueue = exports.Queue = void 0;
|
|
1812
|
+
|
|
1813
|
+
const global_1 = __webpack_require__(4128);
|
|
1814
|
+
|
|
1815
|
+
const heap_1 = __webpack_require__(818);
|
|
1816
|
+
|
|
1817
|
+
const memoize_1 = __webpack_require__(1808);
|
|
1818
|
+
|
|
1819
|
+
const undefined = void 0;
|
|
1820
|
+
const size = 2048;
|
|
1821
|
+
const initsize = 16;
|
|
1822
|
+
|
|
1823
|
+
class Queue {
|
|
1824
|
+
constructor() {
|
|
1825
|
+
this.head = new FixedQueue(initsize);
|
|
1826
|
+
this.tail = this.head;
|
|
1827
|
+
this.count = 0;
|
|
1828
|
+
this.irregular = 0;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
get length() {
|
|
1832
|
+
return this.count === 0 ? this.head.length : this.head.length + this.tail.length + (size - 1) * (this.count - 2) + (this.irregular || size) - 1;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
isEmpty() {
|
|
1836
|
+
return this.head.isEmpty();
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
peek(index = 0) {
|
|
1840
|
+
return index === 0 ? this.head.peek(0) : this.tail.peek(-1);
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
push(value) {
|
|
1844
|
+
const tail = this.tail;
|
|
1845
|
+
|
|
1846
|
+
if (tail.isFull()) {
|
|
1847
|
+
if (tail.next.isEmpty()) {
|
|
1848
|
+
this.tail = tail.next;
|
|
1849
|
+
} else {
|
|
1850
|
+
this.tail = tail.next = new FixedQueue(size, tail.next);
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
++this.count;
|
|
1854
|
+
|
|
1855
|
+
if (tail.size !== size && tail !== this.head) {
|
|
1856
|
+
this.irregular = tail.size;
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
this.tail.push(value);
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
pop() {
|
|
1864
|
+
const head = this.head;
|
|
1865
|
+
const value = head.pop();
|
|
1866
|
+
|
|
1867
|
+
if (head.isEmpty() && !head.next.isEmpty()) {
|
|
1868
|
+
--this.count;
|
|
1869
|
+
this.head = head.next;
|
|
1870
|
+
|
|
1871
|
+
if (this.head.size === this.irregular) {
|
|
1872
|
+
this.irregular = 0;
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
return value;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
clear() {
|
|
1880
|
+
this.head = this.tail = new FixedQueue(initsize);
|
|
1881
|
+
this.count = 0;
|
|
1882
|
+
this.irregular = 0;
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
*[Symbol.iterator]() {
|
|
1886
|
+
while (!this.isEmpty()) {
|
|
1887
|
+
yield this.pop();
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
exports.Queue = Queue;
|
|
1896
|
+
|
|
1897
|
+
class FixedQueue {
|
|
1898
|
+
constructor(size, next) {
|
|
1899
|
+
this.size = size;
|
|
1900
|
+
this.array = (0, global_1.Array)(this.size);
|
|
1901
|
+
this.mask = this.array.length - 1;
|
|
1902
|
+
this.head = 0;
|
|
1903
|
+
this.tail = 0;
|
|
1904
|
+
this.next = next ?? this;
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
get length() {
|
|
1908
|
+
return this.tail >= this.head ? this.tail - this.head : this.array.length - this.head + this.tail;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
isEmpty() {
|
|
1912
|
+
return this.tail === this.head;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1915
|
+
isFull() {
|
|
1916
|
+
return (this.tail + 1 & this.mask) === this.head;
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
peek(index = 0) {
|
|
1920
|
+
return index === 0 ? this.array[this.head] : this.array[this.tail - 1 & this.mask];
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
push(value) {
|
|
1924
|
+
this.array[this.tail] = value;
|
|
1925
|
+
this.tail = this.tail + 1 & this.mask;
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
pop() {
|
|
1929
|
+
if (this.isEmpty()) return;
|
|
1930
|
+
const value = this.array[this.head];
|
|
1931
|
+
this.array[this.head] = undefined;
|
|
1932
|
+
this.head = this.head + 1 & this.mask;
|
|
1933
|
+
return value;
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
class PriorityQueue {
|
|
1939
|
+
constructor(cmp = PriorityQueue.max, clean = true) {
|
|
1940
|
+
this.clean = clean;
|
|
1941
|
+
this.dict = new Map();
|
|
1942
|
+
this.queue = (0, memoize_1.memoize)(priority => {
|
|
1943
|
+
const queue = new Queue();
|
|
1944
|
+
queue[PriorityQueue.priority] = priority;
|
|
1945
|
+
this.heap.insert(queue, priority);
|
|
1946
|
+
return queue;
|
|
1947
|
+
}, this.dict);
|
|
1948
|
+
this.$length = 0;
|
|
1949
|
+
this.heap = new heap_1.Heap(cmp);
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
get length() {
|
|
1953
|
+
return this.$length;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
isEmpty() {
|
|
1957
|
+
return this.$length === 0;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
peek() {
|
|
1961
|
+
return this.heap.peek()?.peek();
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
push(value, priority) {
|
|
1965
|
+
++this.$length;
|
|
1966
|
+
this.queue(priority).push(value);
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
pop() {
|
|
1970
|
+
if (this.$length === 0) return;
|
|
1971
|
+
--this.$length;
|
|
1972
|
+
const queue = this.heap.peek();
|
|
1973
|
+
const value = queue.pop();
|
|
1974
|
+
|
|
1975
|
+
if (queue.isEmpty()) {
|
|
1976
|
+
this.heap.extract();
|
|
1977
|
+
this.clean && this.dict.delete(queue[PriorityQueue.priority]);
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
return value;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
clear() {
|
|
1984
|
+
this.heap.clear();
|
|
1985
|
+
this.dict.clear();
|
|
1986
|
+
this.$length = 0;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
*[Symbol.iterator]() {
|
|
1990
|
+
while (!this.isEmpty()) {
|
|
1991
|
+
yield this.pop();
|
|
1992
|
+
}
|
|
1656
1993
|
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
}));
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1660
1996
|
|
|
1661
|
-
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
exports.PriorityQueue = PriorityQueue;
|
|
2000
|
+
PriorityQueue.priority = Symbol('priority');
|
|
2001
|
+
PriorityQueue.max = heap_1.Heap.max;
|
|
2002
|
+
PriorityQueue.min = heap_1.Heap.min;
|
|
1662
2003
|
|
|
1663
2004
|
/***/ }),
|
|
1664
2005
|
|
|
@@ -1695,12 +2036,14 @@ function unique(rnd, len, mem) {
|
|
|
1695
2036
|
let limit = 5;
|
|
1696
2037
|
return () => {
|
|
1697
2038
|
while (true) {
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
2039
|
+
try {
|
|
2040
|
+
for (let i = 0; i < limit; ++i) {
|
|
2041
|
+
const r = rnd(len);
|
|
2042
|
+
if (mem.has(r)) continue;
|
|
2043
|
+
mem.add(r);
|
|
2044
|
+
return r;
|
|
2045
|
+
}
|
|
2046
|
+
} catch {}
|
|
1704
2047
|
|
|
1705
2048
|
clear && mem.clear();
|
|
1706
2049
|
++len;
|
|
@@ -1761,6 +2104,235 @@ function random(len) {
|
|
|
1761
2104
|
|
|
1762
2105
|
/***/ }),
|
|
1763
2106
|
|
|
2107
|
+
/***/ 6395:
|
|
2108
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2109
|
+
|
|
2110
|
+
"use strict";
|
|
2111
|
+
|
|
2112
|
+
|
|
2113
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
2114
|
+
value: true
|
|
2115
|
+
}));
|
|
2116
|
+
exports.Ring = void 0;
|
|
2117
|
+
|
|
2118
|
+
const global_1 = __webpack_require__(4128);
|
|
2119
|
+
|
|
2120
|
+
const alias_1 = __webpack_require__(5406);
|
|
2121
|
+
|
|
2122
|
+
const array_1 = __webpack_require__(8112);
|
|
2123
|
+
|
|
2124
|
+
const undefined = void 0;
|
|
2125
|
+
const empty = Symbol('empty');
|
|
2126
|
+
|
|
2127
|
+
const unempty = value => value === empty ? undefined : value;
|
|
2128
|
+
|
|
2129
|
+
const space = Object.freeze((0, global_1.Array)(100).fill(empty));
|
|
2130
|
+
let size = 16;
|
|
2131
|
+
|
|
2132
|
+
class Ring {
|
|
2133
|
+
constructor() {
|
|
2134
|
+
this.array = (0, global_1.Array)(size);
|
|
2135
|
+
this.head = 0;
|
|
2136
|
+
this.tail = 0;
|
|
2137
|
+
this.$length = 0;
|
|
2138
|
+
this.excess = 0;
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
get length() {
|
|
2142
|
+
return this.$length;
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
at(index) {
|
|
2146
|
+
// Inline the code for optimization.
|
|
2147
|
+
const array = this.array;
|
|
2148
|
+
|
|
2149
|
+
if (index >= 0) {
|
|
2150
|
+
if (index >= this.$length) return;
|
|
2151
|
+
return unempty(array[(this.head - 1 + index) % array.length]);
|
|
2152
|
+
} else {
|
|
2153
|
+
if (-index > this.$length) return;
|
|
2154
|
+
return this.tail + index >= 0 ? unempty(array[this.tail + index]) : unempty(array[array.length + this.tail + index]);
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
replace(index, value, replacer) {
|
|
2159
|
+
const array = this.array;
|
|
2160
|
+
|
|
2161
|
+
if (index >= 0) {
|
|
2162
|
+
if (index >= this.$length) throw new RangeError('Invalid index');
|
|
2163
|
+
index = (this.head - 1 + index) % array.length;
|
|
2164
|
+
} else {
|
|
2165
|
+
if (-index > this.$length) throw new RangeError('Invalid index');
|
|
2166
|
+
index = this.tail + index >= 0 ? this.tail + index : array.length + this.tail + index;
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
const val = unempty(array[index]);
|
|
2170
|
+
array[index] = replacer ? replacer(val, value) : value;
|
|
2171
|
+
return val;
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
push(value) {
|
|
2175
|
+
const array = this.array;
|
|
2176
|
+
let {
|
|
2177
|
+
head,
|
|
2178
|
+
tail
|
|
2179
|
+
} = this;
|
|
2180
|
+
tail = this.tail = next(head, tail, array.length);
|
|
2181
|
+
head = this.head ||= tail;
|
|
2182
|
+
|
|
2183
|
+
if (head === tail && this.$length !== 0) {
|
|
2184
|
+
(0, array_1.splice)(array, tail - 1, 0, ...space);
|
|
2185
|
+
head = this.head += space.length;
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
array[tail - 1] = value;
|
|
2189
|
+
++this.$length;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
unshift(value) {
|
|
2193
|
+
const array = this.array;
|
|
2194
|
+
let {
|
|
2195
|
+
head,
|
|
2196
|
+
tail
|
|
2197
|
+
} = this;
|
|
2198
|
+
head = this.head = prev(head, tail, array.length);
|
|
2199
|
+
tail = this.tail ||= head;
|
|
2200
|
+
|
|
2201
|
+
if (head === tail && this.$length !== 0) {
|
|
2202
|
+
(0, array_1.splice)(array, head, 0, ...space);
|
|
2203
|
+
head = this.head += space.length;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
array[head - 1] = value;
|
|
2207
|
+
++this.$length;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
pop() {
|
|
2211
|
+
if (this.$length === 0) return;
|
|
2212
|
+
const array = this.array;
|
|
2213
|
+
const i = this.tail - 1;
|
|
2214
|
+
const value = unempty(array[i]);
|
|
2215
|
+
array[i] = empty;
|
|
2216
|
+
--this.$length === 0 ? this.head = this.tail = 0 : this.tail = this.tail === 1 ? array.length : this.tail - 1;
|
|
2217
|
+
return value;
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
shift() {
|
|
2221
|
+
if (this.$length === 0) return;
|
|
2222
|
+
const array = this.array;
|
|
2223
|
+
const i = this.head - 1;
|
|
2224
|
+
const value = unempty(array[i]);
|
|
2225
|
+
array[i] = empty;
|
|
2226
|
+
--this.$length === 0 ? this.head = this.tail = 0 : this.head = this.head === array.length ? 1 : this.head + 1;
|
|
2227
|
+
return value;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
splice(index, count, ...values) {
|
|
2231
|
+
const array = this.array;
|
|
2232
|
+
|
|
2233
|
+
if (this.excess > 100 && array.length - this.$length > 200) {
|
|
2234
|
+
(0, array_1.splice)(array, 0, 100 - (0, array_1.splice)(array, this.tail, 100).length);
|
|
2235
|
+
this.excess -= 100;
|
|
2236
|
+
} else if (-this.excess > array.length * 2) {
|
|
2237
|
+
this.excess = array.length;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
index = index < 0 ? (0, alias_1.max)(0, this.$length + index) : index <= this.$length ? index : this.$length;
|
|
2241
|
+
count = (0, alias_1.min)((0, alias_1.max)(count, 0), this.$length - index);
|
|
2242
|
+
|
|
2243
|
+
if (values.length === 0) {
|
|
2244
|
+
if (count === 0) return [];
|
|
2245
|
+
|
|
2246
|
+
switch (index) {
|
|
2247
|
+
case 0:
|
|
2248
|
+
if (count === 1) return [this.shift()];
|
|
2249
|
+
break;
|
|
2250
|
+
|
|
2251
|
+
case this.$length - 1:
|
|
2252
|
+
if (count === 1) return [this.pop()];
|
|
2253
|
+
break;
|
|
2254
|
+
|
|
2255
|
+
case this.$length:
|
|
2256
|
+
return [];
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
index = (this.head || 1) - 1 + index;
|
|
2261
|
+
index = index > array.length ? index % array.length : index;
|
|
2262
|
+
this.excess += values.length - count;
|
|
2263
|
+
this.$length += values.length - count; // |--H>*>T--|
|
|
2264
|
+
|
|
2265
|
+
if (this.head <= this.tail) {
|
|
2266
|
+
this.tail += values.length - count;
|
|
2267
|
+
return (0, array_1.splice)(array, index, count, ...values);
|
|
2268
|
+
} // |*>T---H>>|
|
|
2269
|
+
|
|
2270
|
+
|
|
2271
|
+
if (index < this.tail) {
|
|
2272
|
+
this.head += values.length - count;
|
|
2273
|
+
this.tail += values.length - count;
|
|
2274
|
+
return (0, array_1.splice)(array, index, count, ...values);
|
|
2275
|
+
} // |>>T---H>*|
|
|
2276
|
+
|
|
2277
|
+
|
|
2278
|
+
const cnt = (0, alias_1.min)(count, array.length - index);
|
|
2279
|
+
const vs = (0, array_1.splice)(array, index, cnt, ...(0, array_1.splice)(values, 0, cnt));
|
|
2280
|
+
vs.push(...(0, array_1.splice)(array, 0, count - vs.length, ...values));
|
|
2281
|
+
return vs;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
clear() {
|
|
2285
|
+
this.array = (0, global_1.Array)(size);
|
|
2286
|
+
this.$length = this.head = this.tail = 0;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
includes(value) {
|
|
2290
|
+
return this.array.includes(value);
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
relational(index) {
|
|
2294
|
+
if (index === -1) return -1;
|
|
2295
|
+
return index + 1 >= this.head ? index + 1 - this.head : this.array.length - this.head + index;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
indexOf(value) {
|
|
2299
|
+
return this.relational((0, array_1.indexOf)(this.array, value));
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
findIndex(f) {
|
|
2303
|
+
return this.relational(this.array.findIndex(value => value !== empty && f(value)));
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
find(f) {
|
|
2307
|
+
return unempty(this.array.find(value => value !== empty && f(value)));
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
toArray() {
|
|
2311
|
+
return this.head <= this.tail ? this.array.slice((this.head || 1) - 1, this.tail) : this.array.slice((this.head || 1) - 1).concat(this.array.slice(0, this.tail));
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
*[Symbol.iterator]() {
|
|
2315
|
+
for (let i = 0; i < this.$length; ++i) {
|
|
2316
|
+
yield this.at(i);
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
return;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
exports.Ring = Ring;
|
|
2325
|
+
|
|
2326
|
+
function next(head, tail, length) {
|
|
2327
|
+
return tail === length && head !== 1 ? 1 : tail + 1;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
function prev(head, tail, length) {
|
|
2331
|
+
return head === 0 || head === 1 ? tail === length ? length + 1 : length : head - 1;
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
/***/ }),
|
|
2335
|
+
|
|
1764
2336
|
/***/ 5177:
|
|
1765
2337
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1766
2338
|
|
|
@@ -1847,84 +2419,80 @@ Object.defineProperty(exports, "ReadonlyURL", ({
|
|
|
1847
2419
|
return format_3.ReadonlyURL;
|
|
1848
2420
|
}
|
|
1849
2421
|
}));
|
|
1850
|
-
const internal = Symbol.for('spica/url::internal');
|
|
1851
2422
|
|
|
1852
2423
|
class URL {
|
|
1853
2424
|
constructor(source, base) {
|
|
1854
2425
|
this.source = source;
|
|
1855
2426
|
this.base = base;
|
|
1856
|
-
this
|
|
1857
|
-
url: new format_1.ReadonlyURL(source, base),
|
|
1858
|
-
searchParams: void 0
|
|
1859
|
-
};
|
|
2427
|
+
this.url = new format_1.ReadonlyURL(source, base);
|
|
1860
2428
|
}
|
|
1861
2429
|
|
|
1862
2430
|
get href() {
|
|
1863
|
-
return this
|
|
2431
|
+
return this.params?.toString().replace(/^(?=.)/, `${this.url.href.slice(0, -this.url.query.length - this.url.fragment.length || this.url.href.length)}?`).concat(this.fragment) ?? this.url.href;
|
|
1864
2432
|
}
|
|
1865
2433
|
|
|
1866
2434
|
get resource() {
|
|
1867
|
-
return this
|
|
2435
|
+
return this.params?.toString().replace(/^(?=.)/, `${this.url.href.slice(0, -this.url.query.length - this.url.fragment.length || this.url.href.length)}?`) ?? this.url.resource;
|
|
1868
2436
|
}
|
|
1869
2437
|
|
|
1870
2438
|
get origin() {
|
|
1871
|
-
return this
|
|
2439
|
+
return this.url.origin;
|
|
1872
2440
|
}
|
|
1873
2441
|
|
|
1874
2442
|
get scheme() {
|
|
1875
|
-
return this
|
|
2443
|
+
return this.url.protocol.slice(0, -1);
|
|
1876
2444
|
}
|
|
1877
2445
|
|
|
1878
2446
|
get protocol() {
|
|
1879
|
-
return this
|
|
2447
|
+
return this.url.protocol;
|
|
1880
2448
|
}
|
|
1881
2449
|
|
|
1882
2450
|
get username() {
|
|
1883
|
-
return this
|
|
2451
|
+
return this.url.username;
|
|
1884
2452
|
}
|
|
1885
2453
|
|
|
1886
2454
|
get password() {
|
|
1887
|
-
return this
|
|
2455
|
+
return this.url.password;
|
|
1888
2456
|
}
|
|
1889
2457
|
|
|
1890
2458
|
get host() {
|
|
1891
|
-
return this
|
|
2459
|
+
return this.url.host;
|
|
1892
2460
|
}
|
|
1893
2461
|
|
|
1894
2462
|
get hostname() {
|
|
1895
|
-
return this
|
|
2463
|
+
return this.url.hostname;
|
|
1896
2464
|
}
|
|
1897
2465
|
|
|
1898
2466
|
get port() {
|
|
1899
|
-
return this
|
|
2467
|
+
return this.url.port;
|
|
1900
2468
|
}
|
|
1901
2469
|
|
|
1902
2470
|
get path() {
|
|
1903
|
-
return this
|
|
2471
|
+
return this.params?.toString().replace(/^(?=.)/, `${this.pathname}?`) ?? this.url.path;
|
|
1904
2472
|
}
|
|
1905
2473
|
|
|
1906
2474
|
get pathname() {
|
|
1907
|
-
return this
|
|
2475
|
+
return this.url.pathname;
|
|
1908
2476
|
}
|
|
1909
2477
|
|
|
1910
2478
|
get search() {
|
|
1911
|
-
return this
|
|
2479
|
+
return this.params?.toString().replace(/^(?=.)/, '?') ?? this.url.search;
|
|
1912
2480
|
}
|
|
1913
2481
|
|
|
1914
2482
|
get query() {
|
|
1915
|
-
return this
|
|
2483
|
+
return this.params?.toString().replace(/^(?=.)/, '?') ?? this.url.query;
|
|
1916
2484
|
}
|
|
1917
2485
|
|
|
1918
2486
|
get hash() {
|
|
1919
|
-
return this
|
|
2487
|
+
return this.url.hash;
|
|
1920
2488
|
}
|
|
1921
2489
|
|
|
1922
2490
|
get fragment() {
|
|
1923
|
-
return this
|
|
2491
|
+
return this.url.fragment;
|
|
1924
2492
|
}
|
|
1925
2493
|
|
|
1926
2494
|
get searchParams() {
|
|
1927
|
-
return this
|
|
2495
|
+
return this.params ??= new global_1.URLSearchParams(this.search);
|
|
1928
2496
|
}
|
|
1929
2497
|
|
|
1930
2498
|
toString() {
|
|
@@ -1973,7 +2541,6 @@ function encode(url) {
|
|
|
1973
2541
|
}
|
|
1974
2542
|
|
|
1975
2543
|
exports._encode = encode;
|
|
1976
|
-
const internal = Symbol.for('spica/url::internal');
|
|
1977
2544
|
|
|
1978
2545
|
class ReadonlyURL {
|
|
1979
2546
|
constructor(source, base) {
|
|
@@ -2006,74 +2573,71 @@ class ReadonlyURL {
|
|
|
2006
2573
|
|
|
2007
2574
|
}
|
|
2008
2575
|
|
|
2009
|
-
this
|
|
2010
|
-
share: ReadonlyURL.get(source, base),
|
|
2011
|
-
searchParams: void 0
|
|
2012
|
-
};
|
|
2576
|
+
this.share = ReadonlyURL.get(source, base);
|
|
2013
2577
|
}
|
|
2014
2578
|
|
|
2015
2579
|
get href() {
|
|
2016
|
-
return this
|
|
2580
|
+
return this.share.href ??= this.share.url.href;
|
|
2017
2581
|
}
|
|
2018
2582
|
|
|
2019
2583
|
get resource() {
|
|
2020
|
-
return this
|
|
2584
|
+
return this.share.resource ??= this.href.slice(0, -this.fragment.length - this.query.length || this.href.length) + this.search;
|
|
2021
2585
|
}
|
|
2022
2586
|
|
|
2023
2587
|
get origin() {
|
|
2024
|
-
return this
|
|
2588
|
+
return this.share.origin ??= this.share.url.origin;
|
|
2025
2589
|
}
|
|
2026
2590
|
|
|
2027
2591
|
get protocol() {
|
|
2028
|
-
return this
|
|
2592
|
+
return this.share.protocol ??= this.share.url.protocol;
|
|
2029
2593
|
}
|
|
2030
2594
|
|
|
2031
2595
|
get username() {
|
|
2032
|
-
return this
|
|
2596
|
+
return this.share.username ??= this.share.url.username;
|
|
2033
2597
|
}
|
|
2034
2598
|
|
|
2035
2599
|
get password() {
|
|
2036
|
-
return this
|
|
2600
|
+
return this.share.password ??= this.share.url.password;
|
|
2037
2601
|
}
|
|
2038
2602
|
|
|
2039
2603
|
get host() {
|
|
2040
|
-
return this
|
|
2604
|
+
return this.share.host ??= this.share.url.host;
|
|
2041
2605
|
}
|
|
2042
2606
|
|
|
2043
2607
|
get hostname() {
|
|
2044
|
-
return this
|
|
2608
|
+
return this.share.hostname ??= this.share.url.hostname;
|
|
2045
2609
|
}
|
|
2046
2610
|
|
|
2047
2611
|
get port() {
|
|
2048
|
-
return this
|
|
2612
|
+
return this.share.port ??= this.share.url.port;
|
|
2049
2613
|
}
|
|
2050
2614
|
|
|
2051
2615
|
get path() {
|
|
2052
|
-
return this
|
|
2616
|
+
return this.share.path ??= `${this.pathname}${this.search}`;
|
|
2053
2617
|
}
|
|
2054
2618
|
|
|
2055
2619
|
get pathname() {
|
|
2056
|
-
return this
|
|
2620
|
+
return this.share.pathname ??= this.share.url.pathname;
|
|
2057
2621
|
}
|
|
2058
2622
|
|
|
2059
2623
|
get search() {
|
|
2060
|
-
return this
|
|
2624
|
+
return this.share.search ??= this.share.url.search;
|
|
2061
2625
|
}
|
|
2062
2626
|
|
|
2063
2627
|
get query() {
|
|
2064
|
-
return this
|
|
2628
|
+
return this.share.query ??= this.search || this.href[this.href.length - this.fragment.length - 1] === '?' && '?' || '';
|
|
2065
2629
|
}
|
|
2066
2630
|
|
|
2067
2631
|
get hash() {
|
|
2068
|
-
return this
|
|
2632
|
+
return this.share.hash ??= this.share.url.hash;
|
|
2069
2633
|
}
|
|
2070
2634
|
|
|
2071
2635
|
get fragment() {
|
|
2072
|
-
return this
|
|
2636
|
+
return this.share.fragment ??= this.hash || this.href[this.href.length - 1] === '#' && '#' || '';
|
|
2073
2637
|
}
|
|
2074
2638
|
|
|
2075
2639
|
get searchParams() {
|
|
2076
|
-
return this
|
|
2640
|
+
return this.params ??= new global_1.URLSearchParams(this.search);
|
|
2077
2641
|
}
|
|
2078
2642
|
|
|
2079
2643
|
toString() {
|
|
@@ -5367,8 +5931,6 @@ const dom_1 = __webpack_require__(3252);
|
|
|
5367
5931
|
|
|
5368
5932
|
const memoize_1 = __webpack_require__(1808);
|
|
5369
5933
|
|
|
5370
|
-
const duff_1 = __webpack_require__(8099);
|
|
5371
|
-
|
|
5372
5934
|
const array_1 = __webpack_require__(8112);
|
|
5373
5935
|
|
|
5374
5936
|
const openers = {
|
|
@@ -5471,19 +6033,20 @@ function format(el, type, form) {
|
|
|
5471
6033
|
'data-type': style(type) || global_1.undefined
|
|
5472
6034
|
});
|
|
5473
6035
|
const marker = el.firstElementChild?.getAttribute('data-marker').match(initial(type))?.[0] ?? '';
|
|
5474
|
-
|
|
5475
|
-
(
|
|
6036
|
+
|
|
6037
|
+
for (let es = el.children, len = es.length, i = 0; i < len; ++i) {
|
|
5476
6038
|
const el = es[i];
|
|
5477
6039
|
|
|
5478
6040
|
switch (el.getAttribute('data-marker')) {
|
|
5479
6041
|
case '':
|
|
5480
6042
|
case marker:
|
|
5481
6043
|
el.removeAttribute('data-marker');
|
|
5482
|
-
|
|
6044
|
+
continue;
|
|
5483
6045
|
}
|
|
5484
6046
|
|
|
5485
|
-
|
|
5486
|
-
}
|
|
6047
|
+
break;
|
|
6048
|
+
}
|
|
6049
|
+
|
|
5487
6050
|
return el;
|
|
5488
6051
|
}
|
|
5489
6052
|
|
|
@@ -7737,7 +8300,9 @@ function* figure(target, footnotes, opts = {}) {
|
|
|
7737
8300
|
labels.add(label);
|
|
7738
8301
|
opts.id !== '' && def.setAttribute('id', `label:${opts.id ? `${opts.id}:` : ''}${label}`);
|
|
7739
8302
|
|
|
7740
|
-
for (
|
|
8303
|
+
for (let rs = refs.take(label, global_1.Infinity), i = 0; i < rs.length; ++i) {
|
|
8304
|
+
const ref = rs[i];
|
|
8305
|
+
|
|
7741
8306
|
if (ref.getAttribute('data-invalid-message') === messages.reference) {
|
|
7742
8307
|
(0, dom_1.define)(ref, {
|
|
7743
8308
|
class: void ref.classList.remove('invalid'),
|
|
@@ -7906,7 +8471,8 @@ function build(syntax, marker, splitter) {
|
|
|
7906
8471
|
if (title && !blank && def.childNodes.length === 1) {
|
|
7907
8472
|
def.insertBefore(content.cloneNode(true), def.lastChild);
|
|
7908
8473
|
|
|
7909
|
-
for (
|
|
8474
|
+
for (let refs = buffer.take(identifier, global_1.Infinity), i = 0; i < refs.length; ++i) {
|
|
8475
|
+
const ref = refs[i];
|
|
7910
8476
|
if (ref.getAttribute('data-invalid-type') !== 'content') continue;
|
|
7911
8477
|
(0, dom_1.define)(ref, {
|
|
7912
8478
|
title,
|
|
@@ -8746,8 +9312,8 @@ function render(source, opts = {}) {
|
|
|
8746
9312
|
opts = extend(opts);
|
|
8747
9313
|
const base = global_1.location.href;
|
|
8748
9314
|
|
|
8749
|
-
for (
|
|
8750
|
-
render_(base,
|
|
9315
|
+
for (let es = (0, query_1.querySelectorAllWith)(source, selector), i = 0; i < es.length; ++i) {
|
|
9316
|
+
render_(base, es[i], opts);
|
|
8751
9317
|
}
|
|
8752
9318
|
}
|
|
8753
9319
|
|
|
@@ -9448,7 +10014,7 @@ function unlink(h) {
|
|
|
9448
10014
|
/***/ 3252:
|
|
9449
10015
|
/***/ (function(module) {
|
|
9450
10016
|
|
|
9451
|
-
/*! typed-dom v0.0.
|
|
10017
|
+
/*! typed-dom v0.0.305 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
9452
10018
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
9453
10019
|
if(true)
|
|
9454
10020
|
module.exports = factory();
|
|
@@ -9466,9 +10032,9 @@ return /******/ (() => { // webpackBootstrap
|
|
|
9466
10032
|
Object.defineProperty(exports, "__esModule", ({
|
|
9467
10033
|
value: true
|
|
9468
10034
|
}));
|
|
9469
|
-
exports.ObjectSetPrototypeOf = exports.ObjectGetPrototypeOf = exports.ObjectCreate = exports.ObjectAssign = exports.toString = exports.isEnumerable = exports.isPrototypeOf = exports.hasOwnProperty = exports.isArray = exports.sign = exports.round = exports.random = exports.min = exports.max = exports.floor = exports.ceil = exports.abs = exports.parseInt = exports.parseFloat = exports.isSafeInteger = exports.isNaN = exports.isInteger = exports.isFinite = exports[NaN] = void 0;
|
|
10035
|
+
exports.ObjectSetPrototypeOf = exports.ObjectGetPrototypeOf = exports.ObjectCreate = exports.ObjectAssign = exports.toString = exports.isEnumerable = exports.isPrototypeOf = exports.hasOwnProperty = exports.isArray = exports.sqrt = exports.log = exports.tan = exports.cos = exports.sign = exports.round = exports.random = exports.min = exports.max = exports.floor = exports.ceil = exports.abs = exports.parseInt = exports.parseFloat = exports.isSafeInteger = exports.isNaN = exports.isInteger = exports.isFinite = exports[NaN] = void 0;
|
|
9470
10036
|
exports[NaN] = Number.NaN, exports.isFinite = Number.isFinite, exports.isInteger = Number.isInteger, exports.isNaN = Number.isNaN, exports.isSafeInteger = Number.isSafeInteger, exports.parseFloat = Number.parseFloat, exports.parseInt = Number.parseInt;
|
|
9471
|
-
exports.abs = Math.abs, exports.ceil = Math.ceil, exports.floor = Math.floor, exports.max = Math.max, exports.min = Math.min, exports.random = Math.random, exports.round = Math.round, exports.sign = Math.sign;
|
|
10037
|
+
exports.abs = Math.abs, exports.ceil = Math.ceil, exports.floor = Math.floor, exports.max = Math.max, exports.min = Math.min, exports.random = Math.random, exports.round = Math.round, exports.sign = Math.sign, exports.cos = Math.cos, exports.tan = Math.tan, exports.log = Math.log, exports.sqrt = Math.sqrt;
|
|
9472
10038
|
exports.isArray = Array.isArray;
|
|
9473
10039
|
exports.hasOwnProperty = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty);
|
|
9474
10040
|
exports.isPrototypeOf = Object.prototype.isPrototypeOf.call.bind(Object.prototype.isPrototypeOf);
|
|
@@ -9500,11 +10066,11 @@ exports.equal = equal;
|
|
|
9500
10066
|
/***/ }),
|
|
9501
10067
|
|
|
9502
10068
|
/***/ 128:
|
|
9503
|
-
/***/ ((module, __unused_webpack_exports,
|
|
10069
|
+
/***/ ((module, __unused_webpack_exports, __nested_webpack_require_2745__) => {
|
|
9504
10070
|
|
|
9505
10071
|
|
|
9506
10072
|
|
|
9507
|
-
|
|
10073
|
+
__nested_webpack_require_2745__(921);
|
|
9508
10074
|
|
|
9509
10075
|
const global = void 0 || typeof globalThis !== 'undefined' && globalThis // @ts-ignore
|
|
9510
10076
|
|| typeof self !== 'undefined' && self || Function('return this')();
|
|
@@ -9525,7 +10091,7 @@ var global = (/* unused pure expression or super */ null && (0));
|
|
|
9525
10091
|
/***/ }),
|
|
9526
10092
|
|
|
9527
10093
|
/***/ 808:
|
|
9528
|
-
/***/ ((__unused_webpack_module, exports,
|
|
10094
|
+
/***/ ((__unused_webpack_module, exports, __nested_webpack_require_3232__) => {
|
|
9529
10095
|
|
|
9530
10096
|
|
|
9531
10097
|
|
|
@@ -9534,11 +10100,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9534
10100
|
}));
|
|
9535
10101
|
exports.reduce = exports.memoize = void 0;
|
|
9536
10102
|
|
|
9537
|
-
const global_1 =
|
|
10103
|
+
const global_1 = __nested_webpack_require_3232__(128);
|
|
9538
10104
|
|
|
9539
|
-
const alias_1 =
|
|
10105
|
+
const alias_1 = __nested_webpack_require_3232__(406);
|
|
9540
10106
|
|
|
9541
|
-
const compare_1 =
|
|
10107
|
+
const compare_1 = __nested_webpack_require_3232__(529);
|
|
9542
10108
|
|
|
9543
10109
|
function memoize(f, identify = (...as) => as[0], memory) {
|
|
9544
10110
|
if (typeof identify === 'object') return memoize(f, void 0, identify);
|
|
@@ -9596,7 +10162,7 @@ exports.reduce = reduce;
|
|
|
9596
10162
|
/***/ }),
|
|
9597
10163
|
|
|
9598
10164
|
/***/ 521:
|
|
9599
|
-
/***/ ((__unused_webpack_module, exports,
|
|
10165
|
+
/***/ ((__unused_webpack_module, exports, __nested_webpack_require_4622__) => {
|
|
9600
10166
|
|
|
9601
10167
|
|
|
9602
10168
|
|
|
@@ -9605,11 +10171,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
9605
10171
|
}));
|
|
9606
10172
|
exports.defrag = exports.prepend = exports.append = exports.isChildren = exports.define = exports.element = exports.text = exports.svg = exports.html = exports.frag = exports.shadow = void 0;
|
|
9607
10173
|
|
|
9608
|
-
const global_1 =
|
|
10174
|
+
const global_1 = __nested_webpack_require_4622__(128);
|
|
9609
10175
|
|
|
9610
|
-
const alias_1 =
|
|
10176
|
+
const alias_1 = __nested_webpack_require_4622__(406);
|
|
9611
10177
|
|
|
9612
|
-
const memoize_1 =
|
|
10178
|
+
const memoize_1 = __nested_webpack_require_4622__(808);
|
|
9613
10179
|
|
|
9614
10180
|
var caches;
|
|
9615
10181
|
|
|
@@ -9650,9 +10216,8 @@ function text(source) {
|
|
|
9650
10216
|
exports.text = text;
|
|
9651
10217
|
|
|
9652
10218
|
function element(context, ns) {
|
|
9653
|
-
const cache = (0, memoize_1.memoize)(elem, (_, ns, tag) => `${ns}:${tag}`);
|
|
9654
10219
|
return (tag, attrs, children) => {
|
|
9655
|
-
const el =
|
|
10220
|
+
const el = elem(context, ns, tag);
|
|
9656
10221
|
return !attrs || isChildren(attrs) ? defineChildren(el, attrs ?? children) : defineChildren(defineAttrs(el, attrs), children);
|
|
9657
10222
|
};
|
|
9658
10223
|
}
|
|
@@ -9845,7 +10410,7 @@ exports.defrag = defrag;
|
|
|
9845
10410
|
/******/ var __webpack_module_cache__ = {};
|
|
9846
10411
|
/******/
|
|
9847
10412
|
/******/ // The require function
|
|
9848
|
-
/******/ function
|
|
10413
|
+
/******/ function __nested_webpack_require_11575__(moduleId) {
|
|
9849
10414
|
/******/ // Check if module is in cache
|
|
9850
10415
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
9851
10416
|
/******/ if (cachedModule !== undefined) {
|
|
@@ -9859,7 +10424,7 @@ exports.defrag = defrag;
|
|
|
9859
10424
|
/******/ };
|
|
9860
10425
|
/******/
|
|
9861
10426
|
/******/ // Execute the module function
|
|
9862
|
-
/******/ __webpack_modules__[moduleId](module, module.exports,
|
|
10427
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11575__);
|
|
9863
10428
|
/******/
|
|
9864
10429
|
/******/ // Return the exports of the module
|
|
9865
10430
|
/******/ return module.exports;
|
|
@@ -9870,7 +10435,7 @@ exports.defrag = defrag;
|
|
|
9870
10435
|
/******/ // startup
|
|
9871
10436
|
/******/ // Load entry module and return exports
|
|
9872
10437
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
9873
|
-
/******/ var __webpack_exports__ =
|
|
10438
|
+
/******/ var __webpack_exports__ = __nested_webpack_require_11575__(521);
|
|
9874
10439
|
/******/
|
|
9875
10440
|
/******/ return __webpack_exports__;
|
|
9876
10441
|
/******/ })()
|
|
@@ -9882,7 +10447,7 @@ exports.defrag = defrag;
|
|
|
9882
10447
|
/***/ 6120:
|
|
9883
10448
|
/***/ (function(module) {
|
|
9884
10449
|
|
|
9885
|
-
/*! typed-dom v0.0.
|
|
10450
|
+
/*! typed-dom v0.0.305 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
9886
10451
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
9887
10452
|
if(true)
|
|
9888
10453
|
module.exports = factory();
|
|
@@ -9892,114 +10457,6 @@ return /******/ (() => { // webpackBootstrap
|
|
|
9892
10457
|
/******/ "use strict";
|
|
9893
10458
|
/******/ var __webpack_modules__ = ({
|
|
9894
10459
|
|
|
9895
|
-
/***/ 112:
|
|
9896
|
-
/***/ ((__unused_webpack_module, exports, __nested_webpack_require_645__) => {
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
9901
|
-
value: true
|
|
9902
|
-
}));
|
|
9903
|
-
exports.splice = exports.pop = exports.push = exports.shift = exports.unshift = exports.indexOf = void 0;
|
|
9904
|
-
|
|
9905
|
-
const global_1 = __nested_webpack_require_645__(128);
|
|
9906
|
-
|
|
9907
|
-
function indexOf(as, a) {
|
|
9908
|
-
if (as.length === 0) return -1;
|
|
9909
|
-
return a === a ? as.indexOf(a) : as.findIndex(a => a !== a);
|
|
9910
|
-
}
|
|
9911
|
-
|
|
9912
|
-
exports.indexOf = indexOf;
|
|
9913
|
-
|
|
9914
|
-
function unshift(as, bs) {
|
|
9915
|
-
if ('length' in as) {
|
|
9916
|
-
for (let i = as.length - 1; i >= 0; --i) {
|
|
9917
|
-
bs.unshift(as[i]);
|
|
9918
|
-
}
|
|
9919
|
-
} else {
|
|
9920
|
-
bs.unshift(...as);
|
|
9921
|
-
}
|
|
9922
|
-
|
|
9923
|
-
return bs;
|
|
9924
|
-
}
|
|
9925
|
-
|
|
9926
|
-
exports.unshift = unshift;
|
|
9927
|
-
|
|
9928
|
-
function shift(as, count) {
|
|
9929
|
-
if (count < 0) throw new Error('Unexpected negative number');
|
|
9930
|
-
return count === void 0 ? [as.shift(), as] : [splice(as, 0, count), as];
|
|
9931
|
-
}
|
|
9932
|
-
|
|
9933
|
-
exports.shift = shift;
|
|
9934
|
-
|
|
9935
|
-
function push(as, bs) {
|
|
9936
|
-
if ('length' in bs) {
|
|
9937
|
-
for (let i = 0, len = bs.length; i < len; ++i) {
|
|
9938
|
-
as.push(bs[i]);
|
|
9939
|
-
}
|
|
9940
|
-
} else {
|
|
9941
|
-
for (const b of bs) {
|
|
9942
|
-
as.push(b);
|
|
9943
|
-
}
|
|
9944
|
-
}
|
|
9945
|
-
|
|
9946
|
-
return as;
|
|
9947
|
-
}
|
|
9948
|
-
|
|
9949
|
-
exports.push = push;
|
|
9950
|
-
|
|
9951
|
-
function pop(as, count) {
|
|
9952
|
-
if (count < 0) throw new Error('Unexpected negative number');
|
|
9953
|
-
return count === void 0 ? [as, as.pop()] : [as, splice(as, as.length - count, count)];
|
|
9954
|
-
}
|
|
9955
|
-
|
|
9956
|
-
exports.pop = pop;
|
|
9957
|
-
|
|
9958
|
-
function splice(as, index, count, ...inserts) {
|
|
9959
|
-
if (count === 0 && inserts.length === 0) return [];
|
|
9960
|
-
count = count > as.length ? as.length : count;
|
|
9961
|
-
|
|
9962
|
-
switch (index) {
|
|
9963
|
-
case 0:
|
|
9964
|
-
switch (count) {
|
|
9965
|
-
case 0:
|
|
9966
|
-
return [[], unshift(inserts, as)][0];
|
|
9967
|
-
|
|
9968
|
-
case 1:
|
|
9969
|
-
return as.length === 0 ? [[], unshift(inserts, as)][0] : [[as.shift()], unshift(inserts, as)][0];
|
|
9970
|
-
|
|
9971
|
-
case void 0:
|
|
9972
|
-
if (as.length > 1 || arguments.length > 2) break;
|
|
9973
|
-
return as.length === 0 ? [] : splice(as, index, 1);
|
|
9974
|
-
}
|
|
9975
|
-
|
|
9976
|
-
break;
|
|
9977
|
-
|
|
9978
|
-
case -1:
|
|
9979
|
-
case as.length - 1:
|
|
9980
|
-
switch (count) {
|
|
9981
|
-
case 1:
|
|
9982
|
-
return as.length === 0 ? [[], push(as, inserts)][0] : [[as.pop()], push(as, inserts)][0];
|
|
9983
|
-
|
|
9984
|
-
case void 0:
|
|
9985
|
-
if (as.length > 1 || arguments.length > 2) break;
|
|
9986
|
-
return as.length === 0 ? [] : splice(as, index, 1);
|
|
9987
|
-
}
|
|
9988
|
-
|
|
9989
|
-
break;
|
|
9990
|
-
|
|
9991
|
-
case as.length:
|
|
9992
|
-
case global_1.Infinity:
|
|
9993
|
-
return [[], push(as, inserts)][0];
|
|
9994
|
-
}
|
|
9995
|
-
|
|
9996
|
-
return arguments.length > 2 ? as.splice(index, count, ...inserts) : as.splice(index);
|
|
9997
|
-
}
|
|
9998
|
-
|
|
9999
|
-
exports.splice = splice;
|
|
10000
|
-
|
|
10001
|
-
/***/ }),
|
|
10002
|
-
|
|
10003
10460
|
/***/ 99:
|
|
10004
10461
|
/***/ ((__unused_webpack_module, exports) => {
|
|
10005
10462
|
|
|
@@ -10013,7 +10470,7 @@ exports.duffReduce = exports.duffEach = exports.duffbk = exports.duff = void 0;
|
|
|
10013
10470
|
function duff(count, proc) {
|
|
10014
10471
|
if (count > 0) {
|
|
10015
10472
|
let i = 0,
|
|
10016
|
-
m = count
|
|
10473
|
+
m = count & 7,
|
|
10017
10474
|
d = (count - m) / 8;
|
|
10018
10475
|
|
|
10019
10476
|
while (m--) {
|
|
@@ -10032,7 +10489,7 @@ function duff(count, proc) {
|
|
|
10032
10489
|
}
|
|
10033
10490
|
} else {
|
|
10034
10491
|
let i = -count,
|
|
10035
|
-
m = i
|
|
10492
|
+
m = i & 7,
|
|
10036
10493
|
d = (i - m) / 8;
|
|
10037
10494
|
|
|
10038
10495
|
while (m--) {
|
|
@@ -10057,7 +10514,7 @@ exports.duff = duff;
|
|
|
10057
10514
|
function duffbk(count, proc) {
|
|
10058
10515
|
if (count > 0) {
|
|
10059
10516
|
let i = 0,
|
|
10060
|
-
m = count
|
|
10517
|
+
m = count & 7,
|
|
10061
10518
|
d = (count - m) / 8;
|
|
10062
10519
|
|
|
10063
10520
|
while (m--) {
|
|
@@ -10065,18 +10522,21 @@ function duffbk(count, proc) {
|
|
|
10065
10522
|
}
|
|
10066
10523
|
|
|
10067
10524
|
while (d--) {
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10525
|
+
switch (false) {
|
|
10526
|
+
case proc(i++):
|
|
10527
|
+
case proc(i++):
|
|
10528
|
+
case proc(i++):
|
|
10529
|
+
case proc(i++):
|
|
10530
|
+
case proc(i++):
|
|
10531
|
+
case proc(i++):
|
|
10532
|
+
case proc(i++):
|
|
10533
|
+
case proc(i++):
|
|
10534
|
+
return;
|
|
10535
|
+
}
|
|
10076
10536
|
}
|
|
10077
10537
|
} else {
|
|
10078
10538
|
let i = -count,
|
|
10079
|
-
m = i
|
|
10539
|
+
m = i & 7,
|
|
10080
10540
|
d = (i - m) / 8;
|
|
10081
10541
|
|
|
10082
10542
|
while (m--) {
|
|
@@ -10084,14 +10544,17 @@ function duffbk(count, proc) {
|
|
|
10084
10544
|
}
|
|
10085
10545
|
|
|
10086
10546
|
while (d--) {
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10547
|
+
switch (false) {
|
|
10548
|
+
case proc(--i):
|
|
10549
|
+
case proc(--i):
|
|
10550
|
+
case proc(--i):
|
|
10551
|
+
case proc(--i):
|
|
10552
|
+
case proc(--i):
|
|
10553
|
+
case proc(--i):
|
|
10554
|
+
case proc(--i):
|
|
10555
|
+
case proc(--i):
|
|
10556
|
+
return;
|
|
10557
|
+
}
|
|
10095
10558
|
}
|
|
10096
10559
|
}
|
|
10097
10560
|
}
|
|
@@ -10101,7 +10564,7 @@ exports.duffbk = duffbk;
|
|
|
10101
10564
|
function duffEach(array, proc) {
|
|
10102
10565
|
let count = array.length;
|
|
10103
10566
|
let i = 0,
|
|
10104
|
-
m = count
|
|
10567
|
+
m = count & 7,
|
|
10105
10568
|
d = (count - m) / 8;
|
|
10106
10569
|
|
|
10107
10570
|
while (m--) {
|
|
@@ -10120,30 +10583,32 @@ function duffEach(array, proc) {
|
|
|
10120
10583
|
}
|
|
10121
10584
|
}
|
|
10122
10585
|
|
|
10123
|
-
exports.duffEach = duffEach;
|
|
10586
|
+
exports.duffEach = duffEach; // ベンチマークの10,000以上で急激な速度低下が見られるがNodeListなどでの
|
|
10587
|
+
// 実際の使用では速度低下は見られない
|
|
10124
10588
|
|
|
10125
10589
|
function duffReduce(array, proc, initial) {
|
|
10126
10590
|
let count = array.length;
|
|
10127
10591
|
let i = 0,
|
|
10128
|
-
m = count
|
|
10592
|
+
m = count & 7,
|
|
10129
10593
|
d = (count - m) / 8;
|
|
10594
|
+
let acc = initial;
|
|
10130
10595
|
|
|
10131
10596
|
while (m--) {
|
|
10132
|
-
|
|
10597
|
+
acc = proc(acc, array[i], i++, array);
|
|
10133
10598
|
}
|
|
10134
10599
|
|
|
10135
10600
|
while (d--) {
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10601
|
+
acc = proc(acc, array[i], i++, array);
|
|
10602
|
+
acc = proc(acc, array[i], i++, array);
|
|
10603
|
+
acc = proc(acc, array[i], i++, array);
|
|
10604
|
+
acc = proc(acc, array[i], i++, array);
|
|
10605
|
+
acc = proc(acc, array[i], i++, array);
|
|
10606
|
+
acc = proc(acc, array[i], i++, array);
|
|
10607
|
+
acc = proc(acc, array[i], i++, array);
|
|
10608
|
+
acc = proc(acc, array[i], i++, array);
|
|
10144
10609
|
}
|
|
10145
10610
|
|
|
10146
|
-
return
|
|
10611
|
+
return acc;
|
|
10147
10612
|
}
|
|
10148
10613
|
|
|
10149
10614
|
exports.duffReduce = duffReduce;
|
|
@@ -10151,11 +10616,11 @@ exports.duffReduce = duffReduce;
|
|
|
10151
10616
|
/***/ }),
|
|
10152
10617
|
|
|
10153
10618
|
/***/ 128:
|
|
10154
|
-
/***/ ((module, __unused_webpack_exports,
|
|
10619
|
+
/***/ ((module, __unused_webpack_exports, __nested_webpack_require_3560__) => {
|
|
10155
10620
|
|
|
10156
10621
|
|
|
10157
10622
|
|
|
10158
|
-
|
|
10623
|
+
__nested_webpack_require_3560__(921);
|
|
10159
10624
|
|
|
10160
10625
|
const global = void 0 || typeof globalThis !== 'undefined' && globalThis // @ts-ignore
|
|
10161
10626
|
|| typeof self !== 'undefined' && self || Function('return this')();
|
|
@@ -10181,7 +10646,7 @@ var global = (/* unused pure expression or super */ null && (0));
|
|
|
10181
10646
|
/******/ var __webpack_module_cache__ = {};
|
|
10182
10647
|
/******/
|
|
10183
10648
|
/******/ // The require function
|
|
10184
|
-
/******/ function
|
|
10649
|
+
/******/ function __nested_webpack_require_4212__(moduleId) {
|
|
10185
10650
|
/******/ // Check if module is in cache
|
|
10186
10651
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
10187
10652
|
/******/ if (cachedModule !== undefined) {
|
|
@@ -10195,7 +10660,7 @@ var global = (/* unused pure expression or super */ null && (0));
|
|
|
10195
10660
|
/******/ };
|
|
10196
10661
|
/******/
|
|
10197
10662
|
/******/ // Execute the module function
|
|
10198
|
-
/******/ __webpack_modules__[moduleId](module, module.exports,
|
|
10663
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_4212__);
|
|
10199
10664
|
/******/
|
|
10200
10665
|
/******/ // Return the exports of the module
|
|
10201
10666
|
/******/ return module.exports;
|
|
@@ -10211,26 +10676,32 @@ var exports = __webpack_exports__;
|
|
|
10211
10676
|
Object.defineProperty(exports, "__esModule", ({
|
|
10212
10677
|
value: true
|
|
10213
10678
|
}));
|
|
10214
|
-
exports.querySelectorAll = exports.
|
|
10679
|
+
exports.querySelectorAll = exports.querySelectorAllWith = exports.querySelectorWith = void 0;
|
|
10215
10680
|
|
|
10216
|
-
const
|
|
10681
|
+
const global_1 = __nested_webpack_require_4212__(128);
|
|
10217
10682
|
|
|
10218
|
-
const
|
|
10683
|
+
const duff_1 = __nested_webpack_require_4212__(99);
|
|
10219
10684
|
|
|
10220
|
-
function
|
|
10685
|
+
function querySelectorWith(node, selector) {
|
|
10221
10686
|
return 'matches' in node && node.matches(selector) ? node : node.querySelector(selector);
|
|
10222
10687
|
}
|
|
10223
10688
|
|
|
10224
|
-
exports.
|
|
10689
|
+
exports.querySelectorWith = querySelectorWith;
|
|
10225
10690
|
|
|
10226
|
-
function
|
|
10691
|
+
function querySelectorAllWith(node, selector) {
|
|
10227
10692
|
const acc = [];
|
|
10228
10693
|
|
|
10229
10694
|
if ('matches' in node && node.matches(selector)) {
|
|
10230
10695
|
acc.push(node);
|
|
10231
10696
|
}
|
|
10232
10697
|
|
|
10233
|
-
return (0, duff_1.duffReduce)(node.querySelectorAll(selector), (acc,
|
|
10698
|
+
return (0, duff_1.duffReduce)(node.querySelectorAll(selector), (acc, el) => (acc.push(el), acc), acc);
|
|
10699
|
+
}
|
|
10700
|
+
|
|
10701
|
+
exports.querySelectorAllWith = querySelectorAllWith;
|
|
10702
|
+
|
|
10703
|
+
function querySelectorAll(node, selector) {
|
|
10704
|
+
return (0, duff_1.duffReduce)(node.querySelectorAll(selector), (acc, el) => (acc.push(el), acc), (0, global_1.Array)());
|
|
10234
10705
|
}
|
|
10235
10706
|
|
|
10236
10707
|
exports.querySelectorAll = querySelectorAll;
|