-
Notifications
You must be signed in to change notification settings - Fork 0
/
felocord.js
9842 lines (9712 loc) · 338 KB
/
felocord.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"use strict";
(() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function")
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// shims/asyncIteratorSymbol.js
var asyncIteratorSymbol;
var init_asyncIteratorSymbol = __esm({
"shims/asyncIteratorSymbol.js"() {
"use strict";
asyncIteratorSymbol = Symbol("Symbol.asyncIterator");
}
});
// shims/promiseAllSettled.js
var allSettledFulfill, allSettledReject, mapAllSettled, allSettled;
var init_promiseAllSettled = __esm({
"shims/promiseAllSettled.js"() {
"use strict";
allSettledFulfill = (value) => ({
status: "fulfilled",
value
});
allSettledReject = (reason) => ({
status: "rejected",
reason
});
mapAllSettled = (item) => Promise.resolve(item).then(allSettledFulfill, allSettledReject);
allSettled = Promise.allSettled ??= (iterator) => {
return Promise.all(Array.from(iterator).map(mapAllSettled));
};
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_async_to_generator.js
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
if (info.done)
resolve(value);
else
Promise.resolve(value).then(_next, _throw);
}
function _async_to_generator(fn) {
return function() {
var self = this, args = arguments;
return new Promise(function(resolve, reject) {
var gen = fn.apply(self, args);
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(void 0);
});
};
}
var init_async_to_generator = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_async_to_generator.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/[email protected]/node_modules/spitroast/dist/cjs.js
var require_cjs = __commonJS({
"node_modules/.pnpm/[email protected]/node_modules/spitroast/dist/cjs.js"(exports, module) {
init_asyncIteratorSymbol();
init_promiseAllSettled();
var __defProp2 = Object.defineProperty;
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
var __getOwnPropNames2 = Object.getOwnPropertyNames;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __export2 = (target, all) => {
for (var name in all)
__defProp2(target, name, {
get: all[name],
enumerable: true
});
};
var __copyProps2 = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
var _loop2 = function(key2) {
if (!__hasOwnProp2.call(to, key2) && key2 !== except)
__defProp2(to, key2, {
get: () => from[key2],
enumerable: !(desc = __getOwnPropDesc2(from, key2)) || desc.enumerable
});
};
for (var key of __getOwnPropNames2(from))
_loop2(key);
}
return to;
};
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", {
value: true
}), mod);
var src_exports2 = {};
__export2(src_exports2, {
after: () => after2,
before: () => before3,
instead: () => instead4,
unpatchAll: () => unpatchAll
});
module.exports = __toCommonJS2(src_exports2);
var patchTypes = [
"a",
"b",
"i"
];
var patchedObjects = /* @__PURE__ */ new Map();
function hook_default(funcName, funcParent, funcArgs, ctxt, isConstruct) {
var patch = patchedObjects.get(funcParent)?.[funcName];
if (!patch)
return isConstruct ? Reflect.construct(funcParent[funcName], funcArgs, ctxt) : funcParent[funcName].apply(ctxt, funcArgs);
for (var hook of patch.b.values()) {
var maybefuncArgs = hook.call(ctxt, funcArgs);
if (Array.isArray(maybefuncArgs))
funcArgs = maybefuncArgs;
}
var workingRetVal = [
...patch.i.values()
].reduce(
(prev, current) => (...args) => current.call(ctxt, args, prev),
// This calls the original function
(...args) => isConstruct ? Reflect.construct(patch.o, args, ctxt) : patch.o.apply(ctxt, args)
)(...funcArgs);
for (var hook1 of patch.a.values())
workingRetVal = hook1.call(ctxt, funcArgs, workingRetVal) ?? workingRetVal;
return workingRetVal;
}
function unpatch(funcParent, funcName, hookId, type) {
var patchedObject = patchedObjects.get(funcParent);
var patch = patchedObject?.[funcName];
if (!patch?.[type].has(hookId))
return false;
patch[type].delete(hookId);
if (patchTypes.every((t) => patch[t].size === 0)) {
var success = Reflect.defineProperty(funcParent, funcName, {
value: patch.o,
writable: true,
configurable: true
});
if (!success)
funcParent[funcName] = patch.o;
delete patchedObject[funcName];
}
if (Object.keys(patchedObject).length == 0)
patchedObjects.delete(funcParent);
return true;
}
function unpatchAll() {
for (var [parentObject, patchedObject] of patchedObjects.entries())
for (var funcName in patchedObject)
for (var hookType of patchTypes)
for (var hookId of patchedObject[funcName]?.[hookType].keys() ?? [])
unpatch(parentObject, funcName, hookId, hookType);
}
var getPatchFunc_default = (patchType) => (funcName, funcParent, callback, oneTime = false) => {
if (typeof funcParent[funcName] !== "function")
throw new Error(`${funcName} is not a function in ${funcParent.constructor.name}`);
if (!patchedObjects.has(funcParent))
patchedObjects.set(funcParent, /* @__PURE__ */ Object.create(null));
var parentInjections = patchedObjects.get(funcParent);
if (!parentInjections[funcName]) {
var origFunc = funcParent[funcName];
parentInjections[funcName] = {
o: origFunc,
b: /* @__PURE__ */ new Map(),
i: /* @__PURE__ */ new Map(),
a: /* @__PURE__ */ new Map()
};
var runHook = (ctxt, args, construct) => {
var ret = hook_default(funcName, funcParent, args, ctxt, construct);
if (oneTime)
unpatchThisPatch();
return ret;
};
var replaceProxy = new Proxy(origFunc, {
apply: (_, ctxt, args) => runHook(ctxt, args, false),
construct: (_, args) => runHook(origFunc, args, true),
get: (target, prop, receiver) => prop == "toString" ? origFunc.toString.bind(origFunc) : Reflect.get(target, prop, receiver)
});
var success = Reflect.defineProperty(funcParent, funcName, {
value: replaceProxy,
configurable: true,
writable: true
});
if (!success)
funcParent[funcName] = replaceProxy;
}
var hookId = Symbol();
var unpatchThisPatch = () => unpatch(funcParent, funcName, hookId, patchType);
parentInjections[funcName][patchType].set(hookId, callback);
return unpatchThisPatch;
};
var before3 = getPatchFunc_default("b");
var instead4 = getPatchFunc_default("i");
var after2 = getPatchFunc_default("a");
}
});
// src/lib/api/native/modules.ts
var modules_exports = {};
__export(modules_exports, {
BundleUpdaterManager: () => BundleUpdaterManager,
ClientInfoManager: () => ClientInfoManager,
DeviceManager: () => DeviceManager,
FileManager: () => FileManager,
MMKVManager: () => MMKVManager,
ThemeManager: () => ThemeManager
});
var nmp, MMKVManager, FileManager, ClientInfoManager, DeviceManager, BundleUpdaterManager, ThemeManager;
var init_modules = __esm({
"src/lib/api/native/modules.ts"() {
"use strict";
init_asyncIteratorSymbol();
init_promiseAllSettled();
nmp = window.nativeModuleProxy;
MMKVManager = nmp.MMKVManager;
FileManager = nmp.DCDFileManager ?? nmp.RTNFileManager;
ClientInfoManager = nmp.InfoDictionaryManager ?? nmp.RTNClientInfoManager;
DeviceManager = nmp.DCDDeviceManager ?? nmp.RTNDeviceManager;
({ BundleUpdaterManager } = nmp);
ThemeManager = nmp.RTNThemeManager ?? nmp.DCDTheme;
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_get_prototype_of.js
function _get_prototype_of(o) {
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o2) {
return o2.__proto__ || Object.getPrototypeOf(o2);
};
return _get_prototype_of(o);
}
var init_get_prototype_of = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_get_prototype_of.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_is_native_reflect_construct.js
function _is_native_reflect_construct() {
try {
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
}));
} catch (_) {
}
return (_is_native_reflect_construct = function _is_native_reflect_construct2() {
return !!result;
})();
}
var init_is_native_reflect_construct = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_is_native_reflect_construct.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_assert_this_initialized.js
function _assert_this_initialized(self) {
if (self === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return self;
}
var init_assert_this_initialized = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_assert_this_initialized.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_type_of.js
function _type_of(obj) {
"@swc/helpers - typeof";
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
}
var init_type_of = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_type_of.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_possible_constructor_return.js
function _possible_constructor_return(self, call) {
if (call && (_type_of(call) === "object" || typeof call === "function"))
return call;
return _assert_this_initialized(self);
}
var init_possible_constructor_return = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_possible_constructor_return.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_assert_this_initialized();
init_type_of();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_call_super.js
function _call_super(_this, derived, args) {
derived = _get_prototype_of(derived);
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
}
var init_call_super = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_call_super.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_get_prototype_of();
init_is_native_reflect_construct();
init_possible_constructor_return();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_class_call_check.js
function _class_call_check(instance, Constructor) {
if (!(instance instanceof Constructor))
throw new TypeError("Cannot call a class as a function");
}
var init_class_call_check = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_class_call_check.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_set_prototype_of.js
function _set_prototype_of(o, p) {
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _set_prototype_of(o, p);
}
var init_set_prototype_of = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_set_prototype_of.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_inherits.js
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass)
_set_prototype_of(subClass, superClass);
}
var init_inherits = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_inherits.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_set_prototype_of();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_construct.js
function _construct(Parent, args, Class) {
if (_is_native_reflect_construct())
_construct = Reflect.construct;
else {
_construct = function construct(Parent2, args2, Class2) {
var a = [
null
];
a.push.apply(a, args2);
var Constructor = Function.bind.apply(Parent2, a);
var instance = new Constructor();
if (Class2)
_set_prototype_of(instance, Class2.prototype);
return instance;
};
}
return _construct.apply(null, arguments);
}
var init_construct = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_construct.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_is_native_reflect_construct();
init_set_prototype_of();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_is_native_function.js
function _is_native_function(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
var init_is_native_function = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_is_native_function.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_wrap_native_super.js
function _wrap_native_super(Class) {
var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
_wrap_native_super = function _wrap_native_super2(Class2) {
if (Class2 === null || !_is_native_function(Class2))
return Class2;
if (typeof Class2 !== "function")
throw new TypeError("Super expression must either be null or a function");
if (typeof _cache !== "undefined") {
if (_cache.has(Class2))
return _cache.get(Class2);
_cache.set(Class2, Wrapper);
}
function Wrapper() {
return _construct(Class2, arguments, _get_prototype_of(this).constructor);
}
Wrapper.prototype = Object.create(Class2.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _set_prototype_of(Wrapper, Class2);
};
return _wrap_native_super(Class);
}
var init_wrap_native_super = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_wrap_native_super.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_construct();
init_get_prototype_of();
init_is_native_function();
init_set_prototype_of();
}
});
// node_modules/.pnpm/[email protected]/node_modules/es-toolkit/dist/function/debounce.mjs
function debounce(func, debounceMs, { signal } = {}) {
var timeoutId = null;
var debounced = function debounced2(...args) {
if (timeoutId !== null) {
clearTimeout(timeoutId);
}
if (signal?.aborted) {
return;
}
timeoutId = setTimeout(() => {
func(...args);
timeoutId = null;
}, debounceMs);
};
var onAbort = function onAbort2() {
debounced.cancel();
};
debounced.cancel = function() {
if (timeoutId !== null) {
clearTimeout(timeoutId);
timeoutId = null;
}
};
signal?.addEventListener("abort", onAbort, {
once: true
});
return debounced;
}
var init_debounce = __esm({
"node_modules/.pnpm/[email protected]/node_modules/es-toolkit/dist/function/debounce.mjs"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/[email protected]/node_modules/es-toolkit/dist/object/omit.mjs
function omit(obj, keys) {
var result = {
...obj
};
for (var key of keys) {
delete result[key];
}
return result;
}
var init_omit = __esm({
"node_modules/.pnpm/[email protected]/node_modules/es-toolkit/dist/object/omit.mjs"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/[email protected]/node_modules/es-toolkit/dist/index.mjs
var init_dist = __esm({
"node_modules/.pnpm/[email protected]/node_modules/es-toolkit/dist/index.mjs"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_debounce();
init_omit();
}
});
// src/metro/internals/enums.ts
var ModuleFlags, ModulesMapInternal;
var init_enums = __esm({
"src/metro/internals/enums.ts"() {
"use strict";
init_asyncIteratorSymbol();
init_promiseAllSettled();
(function(ModuleFlags2) {
ModuleFlags2[ModuleFlags2["EXISTS"] = 1] = "EXISTS";
ModuleFlags2[ModuleFlags2["BLACKLISTED"] = 2] = "BLACKLISTED";
})(ModuleFlags || (ModuleFlags = {}));
(function(ModulesMapInternal2) {
ModulesMapInternal2[ModulesMapInternal2["FULL_LOOKUP"] = 0] = "FULL_LOOKUP";
ModulesMapInternal2[ModulesMapInternal2["NOT_FOUND"] = 1] = "NOT_FOUND";
})(ModulesMapInternal || (ModulesMapInternal = {}));
}
});
// src/lib/api/patcher.ts
var patcher_exports = {};
__export(patcher_exports, {
_patcherDelaySymbol: () => _patcherDelaySymbol,
after: () => after,
before: () => before,
default: () => patcher_default,
instead: () => instead
});
function create(fn) {
function patchFn(...args) {
if (_patcherDelaySymbol in args[1]) {
var delayCallback = args[1][_patcherDelaySymbol];
var cancel = false;
var unpatch = () => cancel = true;
delayCallback((target) => {
if (cancel)
return;
args[1] = target;
unpatch = fn.apply(this, args);
});
return () => unpatch();
}
return fn.apply(this, args);
}
function promisePatchFn(...args) {
var thenable = args[1];
if (!thenable || !("then" in thenable))
throw new Error("target is not a then-able object");
var cancel = false;
var unpatch = () => cancel = true;
thenable.then((target) => {
if (cancel)
return;
args[1] = target;
unpatch = patchFn.apply(this, args);
});
return () => unpatch();
}
return Object.assign(patchFn, {
await: promisePatchFn
});
}
var _after, _before, _instead, _patcherDelaySymbol, after, before, instead, patcher_default;
var init_patcher = __esm({
"src/lib/api/patcher.ts"() {
"use strict";
init_asyncIteratorSymbol();
init_promiseAllSettled();
({ after: _after, before: _before, instead: _instead } = require_cjs());
_patcherDelaySymbol = Symbol.for("felocord.api.patcher.delay");
after = create(_after);
before = create(_before);
instead = create(_instead);
patcher_default = {
after,
before,
instead
};
}
});
// src/lib/api/assets.ts
var assets_exports = {};
__export(assets_exports, {
assetsMap: () => assetsMap,
findAsset: () => findAsset,
findAssetId: () => findAssetId,
patchAssets: () => patchAssets
});
function patchAssets(module) {
if (assetsModule)
return;
assetsModule = module;
var unpatch = after("registerAsset", assetsModule, ([asset]) => {
var moduleId = getImportingModuleId();
if (moduleId !== -1)
indexAssetName(asset.name, moduleId);
});
return unpatch;
}
function findAsset(param) {
if (typeof param === "number")
return assetsModule.getAssetByID(param);
if (typeof param === "string")
return assetsMap[param];
return Object.values(assetsMap).find(param);
}
function findAssetId(name) {
return assetsMap[name]?.index;
}
var assetsMap, assetsModule;
var init_assets = __esm({
"src/lib/api/assets.ts"() {
"use strict";
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_patcher();
init_caches();
init_modules2();
assetsMap = new Proxy({}, {
get(cache, p) {
if (typeof p !== "string")
return void 0;
if (cache[p])
return cache[p];
var moduleIds = getMetroCache().assetsIndex[p];
if (moduleIds == null)
return void 0;
for (var id in moduleIds) {
var assetIndex = requireModule(Number(id));
if (typeof assetIndex !== "number")
continue;
var assetDefinition = assetsModule.getAssetByID(assetIndex);
if (!assetDefinition)
continue;
assetDefinition.index ??= assetDefinition.id ??= assetIndex;
assetDefinition.moduleId ??= id;
cache[p] ??= assetDefinition;
}
return cache[p];
},
ownKeys(cache) {
var keys = [];
for (var key in getMetroCache().assetsIndex) {
cache[key] = this.get(cache, key, {});
if (cache[key])
keys.push(key);
}
return keys;
}
});
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_create_class.js
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _create_class(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties(Constructor.prototype, protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
return Constructor;
}
var init_create_class = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_create_class.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_define_property.js
function _define_property(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value,
enumerable: true,
configurable: true,
writable: true
});
} else
obj[key] = value;
return obj;
}
var init_define_property = __esm({
"node_modules/.pnpm/@[email protected]/node_modules/@swc/helpers/esm/_define_property.js"() {
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// src/lib/utils/Emitter.ts
var Events, Emitter;
var init_Emitter = __esm({
"src/lib/utils/Emitter.ts"() {
"use strict";
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_class_call_check();
init_create_class();
init_define_property();
(function(Events2) {
Events2["GET"] = "GET";
Events2["SET"] = "SET";
Events2["DEL"] = "DEL";
})(Events || (Events = {}));
Emitter = /* @__PURE__ */ function() {
"use strict";
function Emitter2() {
_class_call_check(this, Emitter2);
_define_property(this, "listeners", Object.values(Events).reduce((acc, val) => (acc[val] = /* @__PURE__ */ new Set(), acc), {}));
}
_create_class(Emitter2, [
{
key: "on",
value: function on(event, listener) {
if (!this.listeners[event].has(listener))
this.listeners[event].add(listener);
}
},
{
key: "off",
value: function off(event, listener) {
this.listeners[event].delete(listener);
}
},
{
key: "once",
value: function once(event, listener) {
var once2 = (event2, data) => {
this.off(event2, once2);
listener(event2, data);
};
this.on(event, once2);
}
},
{
key: "emit",
value: function emit(event, data) {
for (var listener of this.listeners[event])
listener(event, data);
}
}
]);
return Emitter2;
}();
}
});
// src/metro/factories.ts
var factories_exports = {};
__export(factories_exports, {
createFilterDefinition: () => createFilterDefinition,
createSimpleFilter: () => createSimpleFilter
});
function createFilterDefinition(fn, uniqMaker) {
function createHolder(func, args, raw) {
return Object.assign(func, {
filter: fn,
raw,
uniq: [
raw && "raw::",
uniqMaker(args)
].filter(Boolean).join("")
});
}
var curry = (raw) => (...args) => {
return createHolder((m, id, defaultCheck) => {
return fn(args, m, id, defaultCheck);
}, args, raw);
};
return Object.assign(curry(false), {
byRaw: curry(true),
uniqMaker
});
}
function createSimpleFilter(filter, uniq) {
return createFilterDefinition((_, m) => filter(m), () => `dynamic::${uniq}`)();
}
var init_factories = __esm({
"src/metro/factories.ts"() {
"use strict";
init_asyncIteratorSymbol();
init_promiseAllSettled();
}
});
// src/metro/filters.ts
var filters_exports = {};
__export(filters_exports, {
byDisplayName: () => byDisplayName,
byFilePath: () => byFilePath,
byMutableProp: () => byMutableProp,
byName: () => byName,
byProps: () => byProps,
byStoreName: () => byStoreName,
byTypeName: () => byTypeName
});
var byProps, byName, byDisplayName, byTypeName, byStoreName, byFilePath, byMutableProp;
var init_filters = __esm({
"src/metro/filters.ts"() {
"use strict";
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_factories();
init_modules2();
byProps = createFilterDefinition((props, m) => props.length === 0 ? m[props[0]] : props.every((p) => m[p]), (props) => `felocord.metro.byProps(${props.join(",")})`);
byName = createFilterDefinition(([name], m) => m.name === name, (name) => `felocord.metro.byName(${name})`);
byDisplayName = createFilterDefinition(([displayName], m) => m.displayName === displayName, (name) => `felocord.metro.byDisplayName(${name})`);
byTypeName = createFilterDefinition(([typeName], m) => m.type?.name === typeName, (name) => `felocord.metro.byTypeName(${name})`);
byStoreName = createFilterDefinition(([name], m) => m.getName?.length === 0 && m.getName() === name, (name) => `felocord.metro.byStoreName(${name})`);
byFilePath = createFilterDefinition(
// module return depends on defaultCheck. if true, it'll return module.default, otherwise the whole module
// unlike filters like byName, defaultCheck doesn't affect the return since we don't rely on exports, but only its ID
// one could say that this is technically a hack, since defaultCheck is meant for filtering exports
([path, exportDefault], _, id, defaultCheck) => exportDefault === defaultCheck && metroModules[id]?.__filePath === path,
([path, exportDefault]) => `felocord.metro.byFilePath(${path},${exportDefault})`
);
byMutableProp = createFilterDefinition(([prop], m) => m?.[prop] && !Object.getOwnPropertyDescriptor(m, prop)?.get, (prop) => `felocord.metro.byMutableProp(${prop})`);
}
});
// src/metro/finders.ts
function filterExports(moduleExports, moduleId, filter) {
if (moduleExports.default && moduleExports.__esModule && filter(moduleExports.default, moduleId, true)) {
return {
exports: filter.raw ? moduleExports : moduleExports.default,
defaultExport: !filter.raw
};
}
if (!filter.raw && filter(moduleExports, moduleId, false)) {
return {
exports: moduleExports,
defaultExport: false
};
}
return {};
}
function findModule(filter) {
var { cacheId, finish } = getCacherForUniq(filter.uniq, false);
for (var [id, moduleExports] of getModules(filter.uniq, false)) {
var { exports: testedExports, defaultExport } = filterExports(moduleExports, id, filter);
if (testedExports !== void 0) {
cacheId(id, testedExports);
return {
id,
defaultExport
};
}
}
finish(true);
return {};
}
function findModuleId(filter) {
return findModule(filter)?.id;
}
function findExports(filter) {
var { id, defaultExport } = findModule(filter);
if (id == null)
return;
return defaultExport ? requireModule(id).default : requireModule(id);
}
function findAllModule(filter) {
var { cacheId, finish } = getCacherForUniq(filter.uniq, true);
var foundExports = [];
for (var [id, moduleExports] of getModules(filter.uniq, true)) {
var { exports: testedExports, defaultExport } = filterExports(moduleExports, id, filter);
if (testedExports !== void 0 && typeof defaultExport === "boolean") {
foundExports.push({
id,
defaultExport
});
cacheId(id, testedExports);
}
}
finish(foundExports.length === 0);
return foundExports;
}
function findAllModuleId(filter) {
return findAllModule(filter).map((e) => e.id);
}
function findAllExports(filter) {
return findAllModule(filter).map((ret) => {
if (!ret.id)
return;
var { id, defaultExport } = ret;
return defaultExport ? requireModule(id).default : requireModule(id);
});
}
var init_finders = __esm({
"src/metro/finders.ts"() {
"use strict";
init_asyncIteratorSymbol();
init_promiseAllSettled();
init_caches();
init_modules2();
}
});
// src/lib/utils/lazy.ts
var lazy_exports = {};
__export(lazy_exports, {
getProxyFactory: () => getProxyFactory,
lazyDestructure: () => lazyDestructure,
proxyLazy: () => proxyLazy
});
function proxyLazy(factory, opts = {}) {
var cache;
var dummy = opts.hint !== "object" ? function dummy2() {
} : {};
var proxyFactory = () => cache ??= factory();
var proxy = new Proxy(dummy, lazyHandler);
factories.set(proxy, proxyFactory);
proxyContextHolder.set(dummy, {
factory,
options: opts
});
return proxy;
}
function lazyDestructure(factory, opts = {}) {
var proxiedObject = proxyLazy(factory);
return new Proxy({}, {
get(_, property) {
if (property === Symbol.iterator) {
return function* () {
yield proxiedObject;
yield new Proxy({}, {
get: (_2, p) => proxyLazy(() => proxiedObject[p], opts)
});
throw new Error("This is not a real iterator, this is likely used incorrectly");
};
}
return proxyLazy(() => proxiedObject[property], opts);
}
});
}
function getProxyFactory(obj) {
return factories.get(obj);
}
var unconfigurable, isUnconfigurable, factories, proxyContextHolder, lazyHandler;
var init_lazy = __esm({
"src/lib/utils/lazy.ts"() {
"use strict";
init_asyncIteratorSymbol();
init_promiseAllSettled();
unconfigurable = /* @__PURE__ */ new Set([
"arguments",
"caller",
"prototype"