dirk-cfx-react 1.0.34 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2,20 +2,21 @@
2
2
 
3
3
  var reactFontawesome = require('@fortawesome/react-fontawesome');
4
4
  var core = require('@mantine/core');
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var framerMotion = require('framer-motion');
7
5
  var react = require('react');
8
- var zustand = require('zustand');
9
- var clickSoundUrl = require('./click_sound-PNCRRTM4.mp3');
10
- var hoverSoundUrl = require('./hover_sound-NBUA222C.mp3');
11
6
  require('@mantine/core/styles.css');
12
7
  require('@mantine/notifications/styles.css');
13
8
  require('./styles/fonts.css');
14
9
  require('./styles/scrollBar.css');
10
+ require('./styles/tornEdge.css');
15
11
  var fontawesomeSvgCore = require('@fortawesome/fontawesome-svg-core');
16
12
  var freeBrandsSvgIcons = require('@fortawesome/free-brands-svg-icons');
17
13
  var freeRegularSvgIcons = require('@fortawesome/free-regular-svg-icons');
18
14
  var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
15
+ var zustand = require('zustand');
16
+ var jsxRuntime = require('react/jsx-runtime');
17
+ var framerMotion = require('framer-motion');
18
+ var clickSoundUrl = require('./click_sound-PNCRRTM4.mp3');
19
+ var hoverSoundUrl = require('./hover_sound-NBUA222C.mp3');
19
20
 
20
21
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
21
22
 
@@ -191,15 +192,804 @@ function colorWithAlpha(color, alpha) {
191
192
  }
192
193
  return color;
193
194
  }
195
+
196
+ // src/utils/misc.ts
197
+ var isEnvBrowser = () => !window.invokeNative;
198
+ var noop = () => {
199
+ };
200
+ var splitFAString = (faString) => {
201
+ const [prefix, newIcon] = faString.split("-");
202
+ if (!prefix || !newIcon) return { prefix: "fas", newIcon: "question" };
203
+ return { prefix, newIcon };
204
+ };
205
+ var numberToRoman = (num) => {
206
+ const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX"];
207
+ return romanNumerals[num];
208
+ };
209
+ var copyToClipboard = (text) => {
210
+ const el = document.createElement("textarea");
211
+ el.value = text;
212
+ document.body.appendChild(el);
213
+ el.select();
214
+ document.execCommand("copy");
215
+ document.body.removeChild(el);
216
+ };
217
+ var openLink = (url) => {
218
+ if (isEnvBrowser()) {
219
+ window.open(url, "_blank");
220
+ } else {
221
+ window.invokeNative("openLink", url);
222
+ }
223
+ };
224
+
225
+ // src/hooks/useNuiEvent.ts
226
+ var useNuiEvent = (action, handler) => {
227
+ const savedHandler = react.useRef(noop);
228
+ react.useEffect(() => {
229
+ savedHandler.current = handler;
230
+ }, [handler]);
231
+ react.useEffect(() => {
232
+ const eventListener = (event) => {
233
+ const { action: eventAction, data } = event.data;
234
+ if (savedHandler.current) {
235
+ if (eventAction === action) {
236
+ savedHandler.current(data);
237
+ }
238
+ }
239
+ };
240
+ window.addEventListener("message", eventListener);
241
+ return () => window.removeEventListener("message", eventListener);
242
+ }, [action]);
243
+ };
244
+ async function fetchNui(eventName, data, mockData) {
245
+ const options = {
246
+ method: "post",
247
+ headers: {
248
+ "Content-Type": "application/json; charset=UTF-8"
249
+ },
250
+ body: JSON.stringify(data)
251
+ };
252
+ console.log(mockData);
253
+ if (isEnvBrowser() && mockData) return mockData;
254
+ if (isEnvBrowser() && mockData === void 0) {
255
+ console.warn(
256
+ `[fetchNui] Called fetchNui for event "${eventName}" in browser environment without mockData. Returning empty object.`
257
+ );
258
+ return {};
259
+ }
260
+ const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
261
+ const resp = await fetch(`https://${resourceName}/${eventName}`, options);
262
+ return await resp.json();
263
+ }
264
+ var initialFetches = {};
265
+ async function registerInitialFetch(eventName, data, mockData) {
266
+ const fetcher = () => fetchNui(eventName, data, mockData);
267
+ initialFetches[eventName] = fetcher;
268
+ return fetcher();
269
+ }
270
+ async function runFetches() {
271
+ return Promise.all(
272
+ Object.entries(initialFetches).map(async ([eventName, fetcher]) => {
273
+ const data = await fetcher();
274
+ return { eventName, data };
275
+ })
276
+ );
277
+ }
278
+ var useAutoFetcher = () => {
279
+ react.useEffect(() => {
280
+ if (isEnvBrowser()) return;
281
+ const run = async () => {
282
+ const results = await runFetches();
283
+ console.log("[useAutoFetcher] Fetched initial data:", results);
284
+ };
285
+ run();
286
+ }, []);
287
+ };
288
+
289
+ // src/utils/internalEvent.ts
290
+ var internalEvent = (events, timer = 1e3) => {
291
+ if (isEnvBrowser()) {
292
+ for (const event of events) {
293
+ setTimeout(() => {
294
+ window.dispatchEvent(
295
+ new MessageEvent("message", {
296
+ data: {
297
+ action: event.action,
298
+ data: event.data
299
+ }
300
+ })
301
+ );
302
+ }, timer);
303
+ }
304
+ }
305
+ };
306
+ var localeStore = zustand.create((set, get) => {
307
+ return {
308
+ locales: {
309
+ "OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant."
310
+ },
311
+ locale: (key, ...args) => {
312
+ const exists = get().locales[key];
313
+ let translation = exists || key;
314
+ if (args.length) {
315
+ translation = translation.replace(/%s/g, () => String(args.shift() || ""));
316
+ }
317
+ return translation;
318
+ }
319
+ };
320
+ });
321
+ var locale = localeStore.getState().locale;
322
+ registerInitialFetch("GET_LOCALES", void 0).then((data) => {
323
+ localeStore.setState({ locales: data });
324
+ });
325
+ var useProfanityStore = zustand.create(() => [
326
+ "ars3",
327
+ "a55",
328
+ "a55hole",
329
+ "ahole",
330
+ "anus",
331
+ "ash0le",
332
+ "ash0les",
333
+ "asholes",
334
+ "4r5e",
335
+ "5h1t",
336
+ "5hit",
337
+ "a55",
338
+ "anal",
339
+ "anus",
340
+ "ar5e",
341
+ "arrse",
342
+ "arse",
343
+ "ass",
344
+ "ass-fucker",
345
+ "asses",
346
+ "assfucker",
347
+ "assfukka",
348
+ "asshole",
349
+ "assholes",
350
+ "asswhole",
351
+ "a_s_s",
352
+ "b!tch",
353
+ "b00bs",
354
+ "b17ch",
355
+ "b1tch",
356
+ "ballsack",
357
+ "beastial",
358
+ "beastiality",
359
+ "bestial",
360
+ "bestiality",
361
+ "bi+ch",
362
+ "biatch",
363
+ "bitch",
364
+ "bitcher",
365
+ "bitchers",
366
+ "bitches",
367
+ "bitchin",
368
+ "bitching",
369
+ "blow job",
370
+ "blowjob",
371
+ "blowjobs",
372
+ "boiolas",
373
+ "bollock",
374
+ "bollok",
375
+ "boner",
376
+ "boob",
377
+ "boobs",
378
+ "booobs",
379
+ "boooobs",
380
+ "booooobs",
381
+ "booooooobs",
382
+ "breasts",
383
+ "buceta",
384
+ "bunny fucker",
385
+ "butthole",
386
+ "buttmuch",
387
+ "buttplug",
388
+ "c0ck",
389
+ "c0cksucker",
390
+ "carpet muncher",
391
+ "chink",
392
+ "cipa",
393
+ "cl1t",
394
+ "clit",
395
+ "clitoris",
396
+ "clits",
397
+ "cnut",
398
+ "cock",
399
+ "cock-sucker",
400
+ "cockface",
401
+ "cockhead",
402
+ "cockmunch",
403
+ "cockmuncher",
404
+ "cocks",
405
+ "cocksuck",
406
+ "cocksucked",
407
+ "cocksucker",
408
+ "cocksucking",
409
+ "cocksucks",
410
+ "cocksuka",
411
+ "cocksukka",
412
+ "cokmuncher",
413
+ "coksucka",
414
+ "coon",
415
+ "cum",
416
+ "cummer",
417
+ "cumming",
418
+ "cums",
419
+ "cumshot",
420
+ "cunilingus",
421
+ "cunillingus",
422
+ "cunnilingus",
423
+ "cunt",
424
+ "cuntlick",
425
+ "cuntlicker",
426
+ "cuntlicking",
427
+ "cunts",
428
+ "cyalis",
429
+ "cyberfuc",
430
+ "cyberfuck",
431
+ "cyberfucked",
432
+ "cyberfucker",
433
+ "cyberfuckers",
434
+ "cyberfucking",
435
+ "d1ck",
436
+ "dlck",
437
+ "dog-fucker",
438
+ "doggin",
439
+ "dogging",
440
+ "donkeyribber",
441
+ "dyke",
442
+ "ejaculate",
443
+ "ejaculated",
444
+ "ejaculates",
445
+ "ejaculating",
446
+ "ejaculatings",
447
+ "ejaculation",
448
+ "ejakulate",
449
+ "f u c k",
450
+ "f u c k e r",
451
+ "f4nny",
452
+ "fag",
453
+ "fagging",
454
+ "faggitt",
455
+ "faggot",
456
+ "faggs",
457
+ "fagot",
458
+ "fagots",
459
+ "fags",
460
+ "fannyflaps",
461
+ "fannyfucker",
462
+ "fatass",
463
+ "fcuk",
464
+ "fcuker",
465
+ "fcuking",
466
+ "feck",
467
+ "fecker",
468
+ "felching",
469
+ "fellate",
470
+ "fellatio",
471
+ "fingerfuck",
472
+ "fingerfucked",
473
+ "fingerfucker",
474
+ "fingerfuckers",
475
+ "fingerfucking",
476
+ "fingerfucks",
477
+ "fistfuck",
478
+ "fistfucked",
479
+ "fistfucker",
480
+ "fistfuckers",
481
+ "fistfucking",
482
+ "fistfuckings",
483
+ "fistfucks",
484
+ "fuck",
485
+ "fucka",
486
+ "fucked",
487
+ "fucker",
488
+ "fuckers",
489
+ "fuckhead",
490
+ "fuckheads",
491
+ "fuckin",
492
+ "fucking",
493
+ "fuckings",
494
+ "fuckingshitmotherfucker",
495
+ "fuckme",
496
+ "fucks",
497
+ "fuckwhit",
498
+ "fuckwit",
499
+ "fudge packer",
500
+ "fudgepacker",
501
+ "fuk",
502
+ "fuker",
503
+ "fukker",
504
+ "fukkin",
505
+ "fuks",
506
+ "fukwhit",
507
+ "fukwit",
508
+ "fux",
509
+ "fux0r",
510
+ "f_u_c_k",
511
+ "gangbang",
512
+ "gangbanged",
513
+ "gangbangs",
514
+ "gaysex",
515
+ "God",
516
+ "god-dam",
517
+ "god-damned",
518
+ "goddamn",
519
+ "goddamned",
520
+ "homo",
521
+ "jack-off",
522
+ "jerk-off",
523
+ "l3i+ch",
524
+ "l3itch",
525
+ "labia",
526
+ "lusting",
527
+ "m0f0",
528
+ "m0fo",
529
+ "m45terbate",
530
+ "ma5terb8",
531
+ "ma5terbate",
532
+ "masochist",
533
+ "master-bate",
534
+ "masterb8",
535
+ "masterbat*",
536
+ "masterbat3",
537
+ "masterbate",
538
+ "masterbation",
539
+ "masterbations",
540
+ "masturbate",
541
+ "mo-fo",
542
+ "mof0",
543
+ "mothafuck",
544
+ "mothafucka",
545
+ "mothafuckas",
546
+ "mothafuckaz",
547
+ "mothafucked",
548
+ "mothafucker",
549
+ "mothafuckers",
550
+ "mothafuckin",
551
+ "mothafucking",
552
+ "mothafuckings",
553
+ "mothafucks",
554
+ "mother fucker",
555
+ "motherfuck",
556
+ "motherfucked",
557
+ "motherfucker",
558
+ "motherfuckers",
559
+ "motherfuckin",
560
+ "motherfucking",
561
+ "motherfuckings",
562
+ "motherfuckka",
563
+ "motherfucks",
564
+ "muthafecker",
565
+ "muthafuckker",
566
+ "mutherfucker",
567
+ "n1gga",
568
+ "n1gger",
569
+ "nazi",
570
+ "nigg3r",
571
+ "nigg4h",
572
+ "nigga",
573
+ "niggah",
574
+ "niggas",
575
+ "niggaz",
576
+ "nigger",
577
+ "niggers",
578
+ "nob jokey",
579
+ "nobjocky",
580
+ "nobjokey",
581
+ "orgasim",
582
+ "orgasims",
583
+ "orgasm",
584
+ "orgasms",
585
+ "p0rn",
586
+ "penis",
587
+ "penisfucker",
588
+ "phonesex",
589
+ "phuck",
590
+ "phuked",
591
+ "phuking",
592
+ "phukked",
593
+ "phukking",
594
+ "phuks",
595
+ "phuq",
596
+ "pigfucker",
597
+ "pimpis",
598
+ "piss",
599
+ "pissed",
600
+ "pisser",
601
+ "pissers",
602
+ "pisses",
603
+ "pissflaps",
604
+ "pissin",
605
+ "pissing",
606
+ "pissoff",
607
+ "poop",
608
+ "porn",
609
+ "porno",
610
+ "pornography",
611
+ "pornos",
612
+ "prick",
613
+ "pricks",
614
+ "pron",
615
+ "pube",
616
+ "pusse",
617
+ "pussi",
618
+ "pussies",
619
+ "pussy",
620
+ "pussys",
621
+ "rectum",
622
+ "retard",
623
+ "rimjaw",
624
+ "rimming",
625
+ "s hit",
626
+ "s.o.b.",
627
+ "scroat",
628
+ "scrote",
629
+ "scrotum",
630
+ "semen",
631
+ "sex",
632
+ "sh!+",
633
+ "sh!t",
634
+ "sh1t",
635
+ "shemale",
636
+ "shit",
637
+ "shitdick",
638
+ "shite",
639
+ "shited",
640
+ "shitey",
641
+ "shitfuck",
642
+ "shitfull",
643
+ "shithead",
644
+ "shiting",
645
+ "shitings",
646
+ "shits",
647
+ "shitted",
648
+ "shitter",
649
+ "shitters",
650
+ "shitting",
651
+ "shittings",
652
+ "shitty",
653
+ "skank",
654
+ "slut",
655
+ "sluts",
656
+ "smegma",
657
+ "smut",
658
+ "son-of-a-bitch",
659
+ "spac",
660
+ "s_h_i_t",
661
+ "t1tt1e5",
662
+ "t1tties",
663
+ "teets",
664
+ "teez",
665
+ "testical",
666
+ "testicle",
667
+ "titfuck",
668
+ "tits",
669
+ "titt",
670
+ "tittie5",
671
+ "tittiefucker",
672
+ "titties",
673
+ "tittyfuck",
674
+ "tittywank",
675
+ "titwank",
676
+ "tosser",
677
+ "tw4t",
678
+ "twat",
679
+ "twathead",
680
+ "twatty",
681
+ "twunt",
682
+ "twunter",
683
+ "v14gra",
684
+ "v1gra",
685
+ "vagina",
686
+ "viagra",
687
+ "vulva",
688
+ "w00se",
689
+ "whoar",
690
+ "whore",
691
+ "xrated"
692
+ ]);
693
+ var isProfanity = (word) => {
694
+ const all = useProfanityStore.getState();
695
+ const profanityArray = Array.isArray(all) ? all : typeof all === "object" && all !== null ? Object.values(all) : [];
696
+ return profanityArray.includes(word);
697
+ };
698
+ function calculateXPForLevel(level, settings) {
699
+ if (level < settings.baseLevel) return 0;
700
+ if (level === 1) return 0;
701
+ if (level === 2) return settings.baseXP;
702
+ let totalXP = settings.baseXP;
703
+ for (let i = 2; i <= level - 1; i++) {
704
+ const baseRuneScapeXP = Math.floor((i + 300 * 2 ** (i / 7)) / 4);
705
+ totalXP += baseRuneScapeXP * settings.modifier;
706
+ }
707
+ return Math.floor(totalXP);
708
+ }
709
+ function generateLevelMap(settings) {
710
+ const levelMap = {};
711
+ for (let level = settings.baseLevel; level <= settings.maxLevel; level++) {
712
+ levelMap[level.toString()] = calculateXPForLevel(level, settings);
713
+ }
714
+ return levelMap;
715
+ }
716
+ function getLevelFromXP(xp, levelMap, settings) {
717
+ for (let level = settings.baseLevel; level <= settings.maxLevel; level++) {
718
+ const xpForLevel = levelMap[level.toString()];
719
+ if (xpForLevel > xp) return level - 1;
720
+ }
721
+ return settings.maxLevel;
722
+ }
723
+ function createSkill(defaultSettings) {
724
+ const useStore2 = zustand.create((set) => ({
725
+ settings: defaultSettings,
726
+ levelMap: generateLevelMap(defaultSettings),
727
+ setSettings: (updater) => set((state) => {
728
+ const newSettings = typeof updater === "function" ? updater(state.settings) : updater;
729
+ return {
730
+ settings: newSettings,
731
+ levelMap: generateLevelMap(newSettings)
732
+ };
733
+ })
734
+ }));
735
+ const useSkill = (xp) => {
736
+ const { settings, levelMap } = useStore2();
737
+ return react.useMemo(() => {
738
+ const currentLevel = getLevelFromXP(xp, levelMap, settings);
739
+ const nextLevel = Math.min(currentLevel + 1, settings.maxLevel);
740
+ const currentLevelXP = levelMap[currentLevel.toString()] || 0;
741
+ const nextLevelXP = levelMap[nextLevel.toString()] || 0;
742
+ const xpInCurrentLevel = xp - currentLevelXP;
743
+ const xpRequiredForLevel = nextLevelXP - currentLevelXP;
744
+ const progressToLevel = xpRequiredForLevel > 0 ? xpInCurrentLevel / xpRequiredForLevel * 100 : 100;
745
+ const xpToNextLevel = Math.max(0, nextLevelXP - xp);
746
+ return {
747
+ currentLevel,
748
+ nextLevel,
749
+ currentLevelXP,
750
+ nextLevelXP,
751
+ progressToLevel: Math.min(100, Math.max(0, progressToLevel)),
752
+ xpToNextLevel
753
+ };
754
+ }, [xp, levelMap, settings]);
755
+ };
756
+ const skill = {
757
+ get settings() {
758
+ return useStore2.getState().settings;
759
+ },
760
+ setSettings: (updater) => {
761
+ useStore2.getState().setSettings(updater);
762
+ },
763
+ useSettings: () => useStore2((state) => state.settings)
764
+ };
765
+ return {
766
+ skill,
767
+ useSkill
768
+ };
769
+ }
770
+ var theme = core.createTheme({
771
+ primaryColor: "dirk",
772
+ primaryShade: 9,
773
+ defaultRadius: "xxs",
774
+ fontFamily: "Akrobat Regular, sans-serif",
775
+ radius: {
776
+ xxs: "0.2vh",
777
+ xs: "0.4vh",
778
+ sm: "0.75vh",
779
+ md: "1vh",
780
+ lg: "1.5vh",
781
+ xl: "2vh",
782
+ xxl: "3vh"
783
+ },
784
+ fontSizes: {
785
+ xxs: "1.2vh",
786
+ xs: "1.5vh",
787
+ sm: "1.8vh",
788
+ md: "2.2vh",
789
+ lg: "2.8vh",
790
+ xl: "3.3vh",
791
+ xxl: "3.8vh"
792
+ },
793
+ spacing: {
794
+ xxs: "0.5vh",
795
+ xs: "0.75vh",
796
+ sm: "1.5vh",
797
+ md: "2vh",
798
+ lg: "3vh",
799
+ xl: "4vh",
800
+ xxl: "5vh"
801
+ },
802
+ components: {
803
+ Progress: {
804
+ styles: {
805
+ root: {
806
+ backgroundColor: "rgba(77, 77, 77, 0.4)"
807
+ }
808
+ }
809
+ },
810
+ Select: {
811
+ styles: {
812
+ dropdown: {
813
+ borderRadius: "var(--mantine-radius-xxs)"
814
+ },
815
+ input: {
816
+ padding: "var(--mantine-spacing-sm)"
817
+ },
818
+ item: {
819
+ borderRadius: "var(--mantine-radius-xxs)"
820
+ },
821
+ wrapper: {
822
+ borderRadius: "var(--mantine-radius-xxs)"
823
+ },
824
+ option: {
825
+ borderRadius: "var(--mantine-radius-xxs)"
826
+ }
827
+ }
828
+ },
829
+ MultiSelect: {
830
+ styles: {
831
+ dropdown: {
832
+ borderRadius: "var(--mantine-radius-xxs)"
833
+ },
834
+ pill: {
835
+ borderRadius: "var(--mantine-radius-xxs)"
836
+ },
837
+ item: {
838
+ borderRadius: "var(--mantine-radius-xxs)"
839
+ },
840
+ wrapper: {
841
+ borderRadius: "var(--mantine-radius-xxs)"
842
+ },
843
+ option: {
844
+ borderRadius: "var(--mantine-radius-xxs)"
845
+ }
846
+ }
847
+ },
848
+ TextInput: {
849
+ styles: {
850
+ section: {
851
+ marginRight: "0.2vh"
852
+ },
853
+ input: {
854
+ padding: "var(--mantine-spacing-sm)"
855
+ }
856
+ }
857
+ }
858
+ },
859
+ colors: {
860
+ dark: [
861
+ "#ffffff",
862
+ "#e2e2e2",
863
+ "#c6c6c6",
864
+ "#aaaaaa",
865
+ "#8d8d8d",
866
+ "#717171",
867
+ "#555555",
868
+ "#393939",
869
+ "#1c1c1c",
870
+ "#000000"
871
+ ],
872
+ dirk: [
873
+ "#ffffff",
874
+ "#f3fce9",
875
+ "#dbf5bd",
876
+ "#c3ee91",
877
+ "#ace765",
878
+ "#94e039",
879
+ "#7ac61f",
880
+ "#5f9a18",
881
+ "#29420a",
882
+ "#446e11"
883
+ ]
884
+ }
885
+ });
886
+ var theme_default = theme;
887
+ fontawesomeSvgCore.library.add(freeSolidSvgIcons.fas, freeRegularSvgIcons.far, freeBrandsSvgIcons.fab);
888
+ var useSettings = zustand.create((set) => ({
889
+ game: "fivem",
890
+ primaryColor: "dirk",
891
+ primaryShade: 9,
892
+ itemImgPath: "https://assets.dirkcfx.com/items/",
893
+ customTheme: {}
894
+ }));
895
+ function DirkProvider(props) {
896
+ const primaryColor = useSettings((data) => data.primaryColor);
897
+ const primaryShade = useSettings((data) => data.primaryShade);
898
+ const customTheme = useSettings((data) => data.customTheme);
899
+ const game = useSettings((data) => data.game);
900
+ const mergedTheme = react.useMemo(() => ({
901
+ ...theme_default,
902
+ primaryColor,
903
+ primaryShade,
904
+ colors: {
905
+ ...theme_default.colors,
906
+ ...customTheme
907
+ // Custom theme colors will override/extend base colors
908
+ }
909
+ }), [primaryColor, primaryShade, customTheme]);
910
+ react.useEffect(() => {
911
+ document.fonts.ready.then(() => {
912
+ document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : game === "fivem" ? '"Akrobat Regular", sans-serif' : "sans-serif";
913
+ console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
914
+ });
915
+ }, [game]);
916
+ useAutoFetcher();
917
+ return /* @__PURE__ */ jsxRuntime.jsx(core.MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: props.children }) });
918
+ }
919
+ function Wrapper({ children }) {
920
+ const game = useSettings((data) => data.game);
921
+ return isEnvBrowser() ? /* @__PURE__ */ jsxRuntime.jsx(
922
+ core.BackgroundImage,
923
+ {
924
+ w: "100vw",
925
+ h: "100vh",
926
+ style: { overflow: "hidden" },
927
+ src: game === "fivem" ? "https://i.ytimg.com/vi/TOxuNbXrO28/maxresdefault.jpg" : "https://raw.githubusercontent.com/Jump-On-Studios/RedM-jo_libs/refs/heads/main/source-repositories/Menu/public/assets/images/background_dev.jpg",
928
+ children
929
+ }
930
+ ) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
931
+ }
932
+ function useTornEdges() {
933
+ const game = useSettings((state) => state.game);
934
+ return game === "rdr3" ? "torn-edge-wrapper" : "";
935
+ }
936
+ function TornEdgeSVGFilter() {
937
+ return /* @__PURE__ */ jsxRuntime.jsx(
938
+ "svg",
939
+ {
940
+ style: { position: "absolute", width: 0, height: 0, pointerEvents: "none" },
941
+ "aria-hidden": "true",
942
+ children: /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: "torn-edge-filter", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
943
+ /* @__PURE__ */ jsxRuntime.jsx(
944
+ "feTurbulence",
945
+ {
946
+ type: "fractalNoise",
947
+ baseFrequency: "0.018 0.022",
948
+ numOctaves: "5",
949
+ seed: "9",
950
+ result: "noise1"
951
+ }
952
+ ),
953
+ /* @__PURE__ */ jsxRuntime.jsx(
954
+ "feTurbulence",
955
+ {
956
+ type: "fractalNoise",
957
+ baseFrequency: "0.08 0.12",
958
+ numOctaves: "2",
959
+ seed: "3",
960
+ result: "noise2"
961
+ }
962
+ ),
963
+ /* @__PURE__ */ jsxRuntime.jsx("feBlend", { in: "noise1", in2: "noise2", mode: "multiply", result: "combinedNoise" }),
964
+ /* @__PURE__ */ jsxRuntime.jsx(
965
+ "feDisplacementMap",
966
+ {
967
+ in: "SourceGraphic",
968
+ in2: "combinedNoise",
969
+ scale: "52",
970
+ xChannelSelector: "R",
971
+ yChannelSelector: "G",
972
+ result: "displaced"
973
+ }
974
+ ),
975
+ /* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { stdDeviation: "0.8", in: "displaced", result: "blurred" }),
976
+ /* @__PURE__ */ jsxRuntime.jsx("feComponentTransfer", { in: "blurred", result: "alphaFade", children: /* @__PURE__ */ jsxRuntime.jsx("feFuncA", { type: "gamma", amplitude: "1", exponent: "1.3", offset: "-0.05" }) }),
977
+ /* @__PURE__ */ jsxRuntime.jsx("feMorphology", { operator: "erode", radius: "0.4", in: "alphaFade", result: "eroded" }),
978
+ /* @__PURE__ */ jsxRuntime.jsx("feMerge", { children: /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "eroded" }) })
979
+ ] }) })
980
+ }
981
+ );
982
+ }
194
983
  function BorderedIcon(props) {
195
984
  const theme2 = core.useMantineTheme();
985
+ const tornEdgeCSS = useTornEdges();
196
986
  return /* @__PURE__ */ jsxRuntime.jsx(
197
- reactFontawesome.FontAwesomeIcon,
987
+ core.Flex,
198
988
  {
199
- icon: props.icon,
200
- color: colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][theme2.primaryShade], props.hovered ? 0.9 : 0.9),
989
+ className: tornEdgeCSS,
990
+ justify: "center",
991
+ align: "center",
201
992
  style: {
202
- // backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
203
993
  backgroundColor: "rgba(0, 0, 0, 0.5)",
204
994
  padding: props.p || theme2.spacing.xs,
205
995
  transition: "all 0.2s ease-in-out",
@@ -207,9 +997,19 @@ function BorderedIcon(props) {
207
997
  fontSize: props.fontSize ? props.fontSize : "2.5vh",
208
998
  borderRadius: theme2.radius.xs,
209
999
  // border: `2px solid var(--mantine-primary-color-9)`,
210
- outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][9], 0.8)}`,
1000
+ // outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][9], 0.8)}`,
211
1001
  boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][7], 0.5)}`
212
- }
1002
+ },
1003
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1004
+ reactFontawesome.FontAwesomeIcon,
1005
+ {
1006
+ icon: props.icon,
1007
+ color: colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][theme2.primaryShade], props.hovered ? 0.9 : 0.9),
1008
+ style: {
1009
+ // backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
1010
+ }
1011
+ }
1012
+ )
213
1013
  }
214
1014
  );
215
1015
  }
@@ -533,179 +1333,79 @@ function InputContainer(props) {
533
1333
  props.title && /* @__PURE__ */ jsxRuntime.jsx(
534
1334
  core.Text,
535
1335
  {
536
- size: "sm",
537
- style: {
538
- lineHeight: "1.25vh",
539
- fontFamily: "Akrobat Bold",
540
- letterSpacing: "0.05em",
541
- textTransform: "uppercase"
542
- },
543
- children: props.title
544
- }
545
- ),
546
- props.description && /* @__PURE__ */ jsxRuntime.jsx(
547
- core.Text,
548
- {
549
- size: "xs",
550
- c: "rgba(255, 255, 255, 0.8)",
551
- fw: 400,
552
- children: props.description
553
- }
554
- )
555
- ]
556
- }
557
- ),
558
- props.error && /* @__PURE__ */ jsxRuntime.jsx(
559
- core.Text,
560
- {
561
- size: "xs",
562
- c: theme2.colors.red[9],
563
- fw: 600,
564
- mb: "auto",
565
- lh: "0.8",
566
- children: props.error
567
- }
568
- ),
569
- /* @__PURE__ */ jsxRuntime.jsx(
570
- core.Flex,
571
- {
572
- ml: "auto",
573
- children: props.rightSection
574
- }
575
- )
576
- ]
577
- }
578
- ),
579
- props.children
580
- ]
581
- }
582
- );
583
- }
584
- var useAudio = zustand.create(() => {
585
- const audioRefs = {};
586
- const sounds = {
587
- click: clickSoundUrl__default.default,
588
- hover: hoverSoundUrl__default.default
589
- };
590
- for (const [key, src] of Object.entries(sounds)) {
591
- audioRefs[key] = new Audio(src);
592
- }
593
- return {
594
- play: (sound) => {
595
- const audio = audioRefs[sound];
596
- if (!audio) return console.warn(`Sound '${sound}' not found.`);
597
- audio.currentTime = 0;
598
- audio.volume = 0.1;
599
- audio.play();
600
- },
601
- stop: (sound) => {
602
- const audio = audioRefs[sound];
603
- if (!audio) return console.warn(`Sound '${sound}' not found.`);
604
- audio.pause();
605
- audio.currentTime = 0;
606
- }
607
- };
608
- });
609
-
610
- // src/utils/misc.ts
611
- var isEnvBrowser = () => !window.invokeNative;
612
- var noop = () => {
613
- };
614
- var splitFAString = (faString) => {
615
- const [prefix, newIcon] = faString.split("-");
616
- if (!prefix || !newIcon) return { prefix: "fas", newIcon: "question" };
617
- return { prefix, newIcon };
618
- };
619
- var numberToRoman = (num) => {
620
- const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX"];
621
- return romanNumerals[num];
622
- };
623
- var copyToClipboard = (text) => {
624
- const el = document.createElement("textarea");
625
- el.value = text;
626
- document.body.appendChild(el);
627
- el.select();
628
- document.execCommand("copy");
629
- document.body.removeChild(el);
630
- };
631
- var openLink = (url) => {
632
- if (isEnvBrowser()) {
633
- window.open(url, "_blank");
634
- } else {
635
- window.invokeNative("openLink", url);
636
- }
637
- };
638
-
639
- // src/utils/fetchNui.ts
640
- async function fetchNui(eventName, data, mockData) {
641
- const options = {
642
- method: "post",
643
- headers: {
644
- "Content-Type": "application/json; charset=UTF-8"
645
- },
646
- body: JSON.stringify(data)
647
- };
648
- if (isEnvBrowser() && mockData !== void 0) return mockData;
649
- if (isEnvBrowser()) {
650
- console.warn(
651
- `[fetchNui] Called fetchNui for event "${eventName}" in browser environment without mockData. Returning empty object.`
652
- );
653
- return {};
654
- }
655
- const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
656
- const resp = await fetch(`https://${resourceName}/${eventName}`, options);
657
- const respFormatted = await resp.json();
658
- return respFormatted;
659
- }
660
- function fetchOnLoad(eventName, data, mockData) {
661
- return fetchNui(eventName, data, mockData).catch((err) => {
662
- console.error(`[fetchOnLoad] Failed for ${eventName}:`, err);
663
- throw err;
664
- });
665
- }
666
- var fetchLuaTable = (tableName) => () => {
667
- if (isEnvBrowser()) {
668
- return Promise.resolve({});
669
- }
670
- return fetchNui("GET_LUA_TABLE", { tableName });
671
- };
672
-
673
- // src/utils/internalEvent.ts
674
- var internalEvent = (events, timer = 1e3) => {
675
- if (isEnvBrowser()) {
676
- for (const event of events) {
677
- setTimeout(() => {
678
- window.dispatchEvent(
679
- new MessageEvent("message", {
680
- data: {
681
- action: event.action,
682
- data: event.data
683
- }
684
- })
685
- );
686
- }, timer);
1336
+ size: "sm",
1337
+ style: {
1338
+ lineHeight: "1.25vh",
1339
+ fontFamily: "Akrobat Bold",
1340
+ letterSpacing: "0.05em",
1341
+ textTransform: "uppercase"
1342
+ },
1343
+ children: props.title
1344
+ }
1345
+ ),
1346
+ props.description && /* @__PURE__ */ jsxRuntime.jsx(
1347
+ core.Text,
1348
+ {
1349
+ size: "xs",
1350
+ c: "rgba(255, 255, 255, 0.8)",
1351
+ fw: 400,
1352
+ children: props.description
1353
+ }
1354
+ )
1355
+ ]
1356
+ }
1357
+ ),
1358
+ props.error && /* @__PURE__ */ jsxRuntime.jsx(
1359
+ core.Text,
1360
+ {
1361
+ size: "xs",
1362
+ c: theme2.colors.red[9],
1363
+ fw: 600,
1364
+ mb: "auto",
1365
+ lh: "0.8",
1366
+ children: props.error
1367
+ }
1368
+ ),
1369
+ /* @__PURE__ */ jsxRuntime.jsx(
1370
+ core.Flex,
1371
+ {
1372
+ ml: "auto",
1373
+ children: props.rightSection
1374
+ }
1375
+ )
1376
+ ]
1377
+ }
1378
+ ),
1379
+ props.children
1380
+ ]
687
1381
  }
1382
+ );
1383
+ }
1384
+ var useAudio = zustand.create(() => {
1385
+ const audioRefs = {};
1386
+ const sounds = {
1387
+ click: clickSoundUrl__default.default,
1388
+ hover: hoverSoundUrl__default.default
1389
+ };
1390
+ for (const [key, src] of Object.entries(sounds)) {
1391
+ audioRefs[key] = new Audio(src);
688
1392
  }
689
- };
690
- var localeStore = zustand.create((set, get) => {
691
1393
  return {
692
- locales: {
693
- "OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant."
1394
+ play: (sound) => {
1395
+ const audio = audioRefs[sound];
1396
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
1397
+ audio.currentTime = 0;
1398
+ audio.volume = 0.1;
1399
+ audio.play();
694
1400
  },
695
- locale: (key, ...args) => {
696
- const exists = get().locales[key];
697
- let translation = exists || key;
698
- if (args.length) {
699
- translation = translation.replace(/%s/g, () => String(args.shift() || ""));
700
- }
701
- return translation;
1401
+ stop: (sound) => {
1402
+ const audio = audioRefs[sound];
1403
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
1404
+ audio.pause();
1405
+ audio.currentTime = 0;
702
1406
  }
703
1407
  };
704
1408
  });
705
- var locale = localeStore.getState().locale;
706
- fetchOnLoad("GET_LOCALES").then((data) => {
707
- localeStore.setState({ locales: data });
708
- });
709
1409
  function SegmentedControl(props) {
710
1410
  const theme2 = core.useMantineTheme();
711
1411
  const play = useAudio((state) => state.play);
@@ -978,11 +1678,11 @@ function SegmentedProgress(props) {
978
1678
  );
979
1679
  }
980
1680
  function Title(props) {
1681
+ const game = useSettings((state) => state.game);
981
1682
  const theme2 = core.useMantineTheme();
982
1683
  return /* @__PURE__ */ jsxRuntime.jsx(
983
1684
  core.Flex,
984
1685
  {
985
- mt: props.mt,
986
1686
  direction: "column",
987
1687
  bg: props.bg || "transparent",
988
1688
  gap: "xs",
@@ -1021,7 +1721,7 @@ function Title(props) {
1021
1721
  children: [
1022
1722
  /* @__PURE__ */ jsxRuntime.jsx(core.Text, { p: "0", size: "sm", style: {
1023
1723
  lineHeight: theme2.fontSizes.md,
1024
- fontFamily: "Akrobat Bold",
1724
+ fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
1025
1725
  letterSpacing: "0.05em",
1026
1726
  textTransform: "uppercase"
1027
1727
  }, children: props.title }),
@@ -1055,184 +1755,6 @@ function Title(props) {
1055
1755
  }
1056
1756
  );
1057
1757
  }
1058
- var useNuiEvent = (action, handler) => {
1059
- const savedHandler = react.useRef(noop);
1060
- react.useEffect(() => {
1061
- savedHandler.current = handler;
1062
- }, [handler]);
1063
- react.useEffect(() => {
1064
- const eventListener = (event) => {
1065
- const { action: eventAction, data } = event.data;
1066
- if (savedHandler.current) {
1067
- if (eventAction === action) {
1068
- savedHandler.current(data);
1069
- }
1070
- }
1071
- };
1072
- window.addEventListener("message", eventListener);
1073
- return () => window.removeEventListener("message", eventListener);
1074
- }, [action]);
1075
- };
1076
- var theme = core.createTheme({
1077
- primaryColor: "dirk",
1078
- primaryShade: 9,
1079
- defaultRadius: "xxs",
1080
- fontFamily: "Akrobat Regular, sans-serif",
1081
- radius: {
1082
- xxs: "0.2vh",
1083
- xs: "0.4vh",
1084
- sm: "0.75vh",
1085
- md: "1vh",
1086
- lg: "1.5vh",
1087
- xl: "2vh",
1088
- xxl: "3vh"
1089
- },
1090
- fontSizes: {
1091
- xxs: "1.2vh",
1092
- xs: "1.5vh",
1093
- sm: "1.8vh",
1094
- md: "2.2vh",
1095
- lg: "2.8vh",
1096
- xl: "3.3vh",
1097
- xxl: "3.8vh"
1098
- },
1099
- spacing: {
1100
- xxs: "0.5vh",
1101
- xs: "0.75vh",
1102
- sm: "1.5vh",
1103
- md: "2vh",
1104
- lg: "3vh",
1105
- xl: "4vh",
1106
- xxl: "5vh"
1107
- },
1108
- components: {
1109
- Progress: {
1110
- styles: {
1111
- root: {
1112
- backgroundColor: "rgba(77, 77, 77, 0.4)"
1113
- }
1114
- }
1115
- },
1116
- Select: {
1117
- styles: {
1118
- dropdown: {
1119
- borderRadius: "var(--mantine-radius-xxs)"
1120
- },
1121
- input: {
1122
- padding: "var(--mantine-spacing-sm)"
1123
- },
1124
- item: {
1125
- borderRadius: "var(--mantine-radius-xxs)"
1126
- },
1127
- wrapper: {
1128
- borderRadius: "var(--mantine-radius-xxs)"
1129
- },
1130
- option: {
1131
- borderRadius: "var(--mantine-radius-xxs)"
1132
- }
1133
- }
1134
- },
1135
- MultiSelect: {
1136
- styles: {
1137
- dropdown: {
1138
- borderRadius: "var(--mantine-radius-xxs)"
1139
- },
1140
- pill: {
1141
- borderRadius: "var(--mantine-radius-xxs)"
1142
- },
1143
- item: {
1144
- borderRadius: "var(--mantine-radius-xxs)"
1145
- },
1146
- wrapper: {
1147
- borderRadius: "var(--mantine-radius-xxs)"
1148
- },
1149
- option: {
1150
- borderRadius: "var(--mantine-radius-xxs)"
1151
- }
1152
- }
1153
- },
1154
- TextInput: {
1155
- styles: {
1156
- section: {
1157
- marginRight: "0.2vh"
1158
- },
1159
- input: {
1160
- padding: "var(--mantine-spacing-sm)"
1161
- }
1162
- }
1163
- }
1164
- },
1165
- colors: {
1166
- dark: [
1167
- "#ffffff",
1168
- "#e2e2e2",
1169
- "#c6c6c6",
1170
- "#aaaaaa",
1171
- "#8d8d8d",
1172
- "#717171",
1173
- "#555555",
1174
- "#393939",
1175
- "#1c1c1c",
1176
- "#000000"
1177
- ],
1178
- dirk: [
1179
- "#ffffff",
1180
- "#f3fce9",
1181
- "#dbf5bd",
1182
- "#c3ee91",
1183
- "#ace765",
1184
- "#94e039",
1185
- "#7ac61f",
1186
- "#5f9a18",
1187
- "#29420a",
1188
- "#446e11"
1189
- ]
1190
- }
1191
- });
1192
- var theme_default = theme;
1193
- fontawesomeSvgCore.library.add(freeSolidSvgIcons.fas, freeRegularSvgIcons.far, freeBrandsSvgIcons.fab);
1194
- var useSettings = zustand.create((set) => ({
1195
- game: "rdr3",
1196
- primaryColor: "teal",
1197
- primaryShade: 6,
1198
- customTheme: {}
1199
- }));
1200
- function DirkProvider(props) {
1201
- const primaryColor = useSettings((data) => data.primaryColor);
1202
- const primaryShade = useSettings((data) => data.primaryShade);
1203
- const customTheme = useSettings((data) => data.customTheme);
1204
- const game = useSettings((data) => data.game);
1205
- const mergedTheme = react.useMemo(() => ({
1206
- ...theme_default,
1207
- primaryColor,
1208
- primaryShade,
1209
- colors: {
1210
- ...theme_default.colors,
1211
- ...customTheme
1212
- // Custom theme colors will override/extend base colors
1213
- }
1214
- }), [primaryColor, primaryShade, customTheme]);
1215
- react.useEffect(() => {
1216
- document.fonts.ready.then(() => {
1217
- document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : game === "fivem" ? '"Akrobat Regular", sans-serif' : "sans-serif";
1218
- console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
1219
- });
1220
- }, [game]);
1221
- return /* @__PURE__ */ jsxRuntime.jsx(core.MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: props.children }) });
1222
- }
1223
- function Wrapper({ children }) {
1224
- const game = useSettings((data) => data.game);
1225
- return isEnvBrowser() ? /* @__PURE__ */ jsxRuntime.jsx(
1226
- core.BackgroundImage,
1227
- {
1228
- w: "100vw",
1229
- h: "100vh",
1230
- style: { overflow: "hidden" },
1231
- src: game === "fivem" ? "https://i.ytimg.com/vi/TOxuNbXrO28/maxresdefault.jpg" : "https://raw.githubusercontent.com/Jump-On-Studios/RedM-jo_libs/refs/heads/main/source-repositories/Menu/public/assets/images/background_dev.jpg",
1232
- children
1233
- }
1234
- ) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
1235
- }
1236
1758
 
1237
1759
  exports.BorderedIcon = BorderedIcon;
1238
1760
  exports.Counter = Counter;
@@ -1251,22 +1773,29 @@ exports.Segment = Segment;
1251
1773
  exports.SegmentedControl = SegmentedControl;
1252
1774
  exports.SegmentedProgress = SegmentedProgress;
1253
1775
  exports.Title = Title;
1776
+ exports.TornEdgeSVGFilter = TornEdgeSVGFilter;
1254
1777
  exports.colorWithAlpha = colorWithAlpha;
1255
1778
  exports.copyToClipboard = copyToClipboard;
1256
- exports.fetchLuaTable = fetchLuaTable;
1779
+ exports.createSkill = createSkill;
1257
1780
  exports.fetchNui = fetchNui;
1258
- exports.fetchOnLoad = fetchOnLoad;
1781
+ exports.initialFetches = initialFetches;
1259
1782
  exports.internalEvent = internalEvent;
1260
1783
  exports.isEnvBrowser = isEnvBrowser;
1784
+ exports.isProfanity = isProfanity;
1261
1785
  exports.locale = locale;
1262
1786
  exports.localeStore = localeStore;
1263
1787
  exports.noop = noop;
1264
1788
  exports.numberToRoman = numberToRoman;
1265
1789
  exports.openLink = openLink;
1790
+ exports.registerInitialFetch = registerInitialFetch;
1791
+ exports.runFetches = runFetches;
1266
1792
  exports.splitFAString = splitFAString;
1793
+ exports.useAutoFetcher = useAutoFetcher;
1267
1794
  exports.useNavigation = useNavigation;
1268
1795
  exports.useNavigationStore = useNavigationStore;
1269
1796
  exports.useNuiEvent = useNuiEvent;
1797
+ exports.useProfanityStore = useProfanityStore;
1270
1798
  exports.useSettings = useSettings;
1799
+ exports.useTornEdges = useTornEdges;
1271
1800
  //# sourceMappingURL=index.cjs.map
1272
1801
  //# sourceMappingURL=index.cjs.map