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