dirk-cfx-react 1.0.45 → 1.0.47
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/components/index.cjs +23 -40
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +271 -271
- package/dist/components/index.d.ts +271 -271
- package/dist/components/index.js +23 -40
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +482 -495
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +484 -497
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
4
|
-
var core = require('@mantine/core');
|
|
5
3
|
var react = require('react');
|
|
6
4
|
var zustand = require('zustand');
|
|
5
|
+
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
6
|
+
var core = require('@mantine/core');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var framerMotion = require('framer-motion');
|
|
9
|
+
var clickSoundUrl = require('./click_sound-PNCRRTM4.mp3');
|
|
10
|
+
var hoverSoundUrl = require('./hover_sound-NBUA222C.mp3');
|
|
11
|
+
var hooks = require('@mantine/hooks');
|
|
8
12
|
require('@mantine/core/styles.css');
|
|
9
13
|
require('@mantine/notifications/styles.css');
|
|
10
14
|
require('./styles/notify.css');
|
|
@@ -15,18 +19,12 @@ var fontawesomeSvgCore = require('@fortawesome/fontawesome-svg-core');
|
|
|
15
19
|
var freeBrandsSvgIcons = require('@fortawesome/free-brands-svg-icons');
|
|
16
20
|
var freeRegularSvgIcons = require('@fortawesome/free-regular-svg-icons');
|
|
17
21
|
var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
18
|
-
var framerMotion = require('framer-motion');
|
|
19
|
-
var clickSoundUrl = require('./click_sound-PNCRRTM4.mp3');
|
|
20
|
-
var hoverSoundUrl = require('./hover_sound-NBUA222C.mp3');
|
|
21
|
-
var hooks = require('@mantine/hooks');
|
|
22
22
|
|
|
23
23
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
24
|
|
|
25
25
|
var clickSoundUrl__default = /*#__PURE__*/_interopDefault(clickSoundUrl);
|
|
26
26
|
var hoverSoundUrl__default = /*#__PURE__*/_interopDefault(hoverSoundUrl);
|
|
27
27
|
|
|
28
|
-
// src/components/BorderedIcon.tsx
|
|
29
|
-
|
|
30
28
|
// src/utils/colorWithAlpha.ts
|
|
31
29
|
var colorNames = {
|
|
32
30
|
AliceBlue: { r: 240, g: 248, b: 255 },
|
|
@@ -224,216 +222,7 @@ var openLink = (url) => {
|
|
|
224
222
|
}
|
|
225
223
|
};
|
|
226
224
|
|
|
227
|
-
// src/
|
|
228
|
-
var useNuiEvent = (action, handler) => {
|
|
229
|
-
const savedHandler = react.useRef(noop);
|
|
230
|
-
react.useEffect(() => {
|
|
231
|
-
savedHandler.current = handler;
|
|
232
|
-
}, [handler]);
|
|
233
|
-
react.useEffect(() => {
|
|
234
|
-
const eventListener = (event) => {
|
|
235
|
-
const { action: eventAction, data } = event.data;
|
|
236
|
-
if (savedHandler.current) {
|
|
237
|
-
if (eventAction === action) {
|
|
238
|
-
savedHandler.current(data);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
window.addEventListener("message", eventListener);
|
|
243
|
-
return () => window.removeEventListener("message", eventListener);
|
|
244
|
-
}, [action]);
|
|
245
|
-
};
|
|
246
|
-
function getNested(obj, path) {
|
|
247
|
-
return path.split(".").reduce((acc, key) => acc ? acc[key] : void 0, obj);
|
|
248
|
-
}
|
|
249
|
-
function setNested(obj, path, value) {
|
|
250
|
-
const keys = path.split(".");
|
|
251
|
-
const newObj = { ...obj };
|
|
252
|
-
let current = newObj;
|
|
253
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
254
|
-
const key = keys[i];
|
|
255
|
-
current[key] = { ...current[key] || {} };
|
|
256
|
-
current = current[key];
|
|
257
|
-
}
|
|
258
|
-
current[keys[keys.length - 1]] = value;
|
|
259
|
-
return newObj;
|
|
260
|
-
}
|
|
261
|
-
function deleteNested(obj, path) {
|
|
262
|
-
const keys = path.split(".");
|
|
263
|
-
const newObj = { ...obj };
|
|
264
|
-
let current = newObj;
|
|
265
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
266
|
-
const key = keys[i];
|
|
267
|
-
if (!current[key]) return obj;
|
|
268
|
-
current[key] = { ...current[key] };
|
|
269
|
-
current = current[key];
|
|
270
|
-
}
|
|
271
|
-
delete current[keys[keys.length - 1]];
|
|
272
|
-
return newObj;
|
|
273
|
-
}
|
|
274
|
-
function flattenRules(rules, prefix = "") {
|
|
275
|
-
const result = {};
|
|
276
|
-
for (const key in rules) {
|
|
277
|
-
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
278
|
-
const val = rules[key];
|
|
279
|
-
if (typeof val === "function") result[fullPath] = val;
|
|
280
|
-
else if (typeof val === "object")
|
|
281
|
-
Object.assign(result, flattenRules(val, fullPath));
|
|
282
|
-
}
|
|
283
|
-
return result;
|
|
284
|
-
}
|
|
285
|
-
function createFormStore(initialValues, validationRules, onSubmit) {
|
|
286
|
-
const flatRules = validationRules ? flattenRules(validationRules) : {};
|
|
287
|
-
const history = [];
|
|
288
|
-
const future = [];
|
|
289
|
-
const changed = /* @__PURE__ */ new Set();
|
|
290
|
-
return zustand.createStore((set, get) => ({
|
|
291
|
-
initialValues,
|
|
292
|
-
values: initialValues,
|
|
293
|
-
errors: {},
|
|
294
|
-
canBack: false,
|
|
295
|
-
canForward: false,
|
|
296
|
-
changedFields: [],
|
|
297
|
-
changedCount: 0,
|
|
298
|
-
onSubmit,
|
|
299
|
-
submit: () => {
|
|
300
|
-
const state = get();
|
|
301
|
-
const isValid = state.validate();
|
|
302
|
-
if (isValid && state.onSubmit) state.onSubmit(get());
|
|
303
|
-
},
|
|
304
|
-
resetChangeCount: () => {
|
|
305
|
-
changed.clear();
|
|
306
|
-
set(() => ({
|
|
307
|
-
changedFields: [],
|
|
308
|
-
changedCount: 0
|
|
309
|
-
}));
|
|
310
|
-
},
|
|
311
|
-
setInitialValues: (newInitialValues) => set({ initialValues: newInitialValues }),
|
|
312
|
-
setValue: (path, value) => {
|
|
313
|
-
const currentValues = get().values;
|
|
314
|
-
const newValues = setNested(currentValues, path, value);
|
|
315
|
-
const oldValue = getNested(get().initialValues, path);
|
|
316
|
-
history.push(currentValues);
|
|
317
|
-
future.length = 0;
|
|
318
|
-
if (value !== oldValue) changed.add(path);
|
|
319
|
-
else changed.delete(path);
|
|
320
|
-
set({
|
|
321
|
-
values: newValues,
|
|
322
|
-
canBack: history.length > 0,
|
|
323
|
-
canForward: false,
|
|
324
|
-
changedFields: Array.from(changed),
|
|
325
|
-
changedCount: changed.size
|
|
326
|
-
});
|
|
327
|
-
const rule = flatRules[path];
|
|
328
|
-
if (rule) {
|
|
329
|
-
const error2 = rule(value, newValues);
|
|
330
|
-
if (error2)
|
|
331
|
-
set((state) => ({ errors: setNested(state.errors, path, error2) }));
|
|
332
|
-
else set((state) => ({ errors: deleteNested(state.errors, path) }));
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
setError: (path, message) => set((state) => ({ errors: setNested(state.errors, path, message) })),
|
|
336
|
-
clearError: (path) => set((state) => ({ errors: deleteNested(state.errors, path) })),
|
|
337
|
-
validateField: (path) => {
|
|
338
|
-
const state = get();
|
|
339
|
-
const rule = flatRules[path];
|
|
340
|
-
if (!rule) return true;
|
|
341
|
-
const value = getNested(state.values, path);
|
|
342
|
-
const error2 = rule(value, state.values);
|
|
343
|
-
if (error2) {
|
|
344
|
-
set((state2) => ({ errors: setNested(state2.errors, path, error2) }));
|
|
345
|
-
return false;
|
|
346
|
-
} else {
|
|
347
|
-
set((state2) => ({ errors: deleteNested(state2.errors, path) }));
|
|
348
|
-
return true;
|
|
349
|
-
}
|
|
350
|
-
},
|
|
351
|
-
validate: () => {
|
|
352
|
-
const state = get();
|
|
353
|
-
let isValid = true;
|
|
354
|
-
let newErrors = {};
|
|
355
|
-
for (const path in flatRules) {
|
|
356
|
-
const rule = flatRules[path];
|
|
357
|
-
const value = getNested(state.values, path);
|
|
358
|
-
const error2 = rule(value, state.values);
|
|
359
|
-
if (error2) {
|
|
360
|
-
isValid = false;
|
|
361
|
-
newErrors = setNested(newErrors, path, error2);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
set({ errors: newErrors });
|
|
365
|
-
return isValid;
|
|
366
|
-
},
|
|
367
|
-
reset: () => {
|
|
368
|
-
history.length = 0;
|
|
369
|
-
future.length = 0;
|
|
370
|
-
changed.clear();
|
|
371
|
-
set({
|
|
372
|
-
values: initialValues,
|
|
373
|
-
errors: {},
|
|
374
|
-
canBack: false,
|
|
375
|
-
canForward: false,
|
|
376
|
-
changedFields: [],
|
|
377
|
-
changedCount: 0
|
|
378
|
-
});
|
|
379
|
-
},
|
|
380
|
-
back: () => {
|
|
381
|
-
const state = get();
|
|
382
|
-
if (history.length === 0) return;
|
|
383
|
-
const prev = history.pop();
|
|
384
|
-
future.push(state.values);
|
|
385
|
-
changed.clear();
|
|
386
|
-
const current = prev;
|
|
387
|
-
const initial = get().initialValues;
|
|
388
|
-
for (const key in current) {
|
|
389
|
-
if (JSON.stringify(current[key]) !== JSON.stringify(initial[key]))
|
|
390
|
-
changed.add(key);
|
|
391
|
-
}
|
|
392
|
-
set({
|
|
393
|
-
values: prev,
|
|
394
|
-
canBack: history.length > 0,
|
|
395
|
-
canForward: true,
|
|
396
|
-
changedFields: Array.from(changed),
|
|
397
|
-
changedCount: changed.size
|
|
398
|
-
});
|
|
399
|
-
},
|
|
400
|
-
forward: () => {
|
|
401
|
-
const state = get();
|
|
402
|
-
if (future.length === 0) return;
|
|
403
|
-
const next = future.pop();
|
|
404
|
-
history.push(state.values);
|
|
405
|
-
changed.clear();
|
|
406
|
-
const current = next;
|
|
407
|
-
const initial = get().initialValues;
|
|
408
|
-
for (const key in current) {
|
|
409
|
-
if (JSON.stringify(current[key]) !== JSON.stringify(initial[key]))
|
|
410
|
-
changed.add(key);
|
|
411
|
-
}
|
|
412
|
-
set({
|
|
413
|
-
values: next,
|
|
414
|
-
canBack: true,
|
|
415
|
-
canForward: future.length > 0,
|
|
416
|
-
changedFields: Array.from(changed),
|
|
417
|
-
changedCount: changed.size
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
}));
|
|
421
|
-
}
|
|
422
|
-
var FormContext = react.createContext(null);
|
|
423
|
-
function FormProvider({
|
|
424
|
-
initialValues,
|
|
425
|
-
validate,
|
|
426
|
-
onSubmit,
|
|
427
|
-
children
|
|
428
|
-
}) {
|
|
429
|
-
const storeRef = react.useRef(createFormStore(initialValues, validate, onSubmit));
|
|
430
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FormContext.Provider, { value: storeRef.current, children });
|
|
431
|
-
}
|
|
432
|
-
function useForm() {
|
|
433
|
-
const store = react.useContext(FormContext);
|
|
434
|
-
if (!store) throw new Error("useForm must be used inside a <FormProvider>");
|
|
435
|
-
return zustand.useStore(store);
|
|
436
|
-
}
|
|
225
|
+
// src/utils/fetchNui.ts
|
|
437
226
|
async function fetchNui(eventName, data, mockData) {
|
|
438
227
|
const options = {
|
|
439
228
|
method: "post",
|
|
@@ -960,273 +749,15 @@ function createSkill(defaultSettings) {
|
|
|
960
749
|
useSkill
|
|
961
750
|
};
|
|
962
751
|
}
|
|
963
|
-
var label = {
|
|
964
|
-
fontSize: "var(--mantine-font-size-xs)",
|
|
965
|
-
fontFamily: "Akrobat Bold",
|
|
966
|
-
letterSpacing: "0.05em",
|
|
967
|
-
textTransform: "uppercase"
|
|
968
|
-
};
|
|
969
|
-
var error = {
|
|
970
|
-
fontSize: "var(--mantine-font-size-xs)",
|
|
971
|
-
fontFamily: "Akrobat Regular"
|
|
972
|
-
};
|
|
973
|
-
var theme = core.createTheme({
|
|
974
|
-
primaryColor: "dirk",
|
|
975
|
-
primaryShade: 9,
|
|
976
|
-
defaultRadius: "xs",
|
|
977
|
-
fontFamily: "Akrobat Regular, sans-serif",
|
|
978
|
-
radius: {
|
|
979
|
-
xxs: "0.2vh",
|
|
980
|
-
xs: "0.4vh",
|
|
981
|
-
sm: "0.75vh",
|
|
982
|
-
md: "1vh",
|
|
983
|
-
lg: "1.5vh",
|
|
984
|
-
xl: "2vh",
|
|
985
|
-
xxl: "3vh"
|
|
986
|
-
},
|
|
987
|
-
fontSizes: {
|
|
988
|
-
xxs: "1.2vh",
|
|
989
|
-
xs: "1.5vh",
|
|
990
|
-
sm: "1.8vh",
|
|
991
|
-
md: "2.2vh",
|
|
992
|
-
lg: "2.8vh",
|
|
993
|
-
xl: "3.3vh",
|
|
994
|
-
xxl: "3.8vh"
|
|
995
|
-
},
|
|
996
|
-
lineHeights: {
|
|
997
|
-
xxs: "1.4vh",
|
|
998
|
-
xs: "1.8vh",
|
|
999
|
-
sm: "2.2vh",
|
|
1000
|
-
md: "2.8vh",
|
|
1001
|
-
lg: "3.3vh",
|
|
1002
|
-
xl: "3.8vh"
|
|
1003
|
-
},
|
|
1004
|
-
spacing: {
|
|
1005
|
-
xxs: "0.5vh",
|
|
1006
|
-
xs: "0.75vh",
|
|
1007
|
-
sm: "1.5vh",
|
|
1008
|
-
md: "2vh",
|
|
1009
|
-
lg: "3vh",
|
|
1010
|
-
xl: "4vh",
|
|
1011
|
-
xxl: "5vh"
|
|
1012
|
-
},
|
|
1013
|
-
components: {
|
|
1014
|
-
Progress: {
|
|
1015
|
-
styles: {
|
|
1016
|
-
label: {
|
|
1017
|
-
fontFamily: "Akrobat Bold",
|
|
1018
|
-
letterSpacing: "0.05em",
|
|
1019
|
-
textTransform: "uppercase"
|
|
1020
|
-
},
|
|
1021
|
-
root: {
|
|
1022
|
-
backgroundColor: "rgba(77, 77, 77, 0.4)"
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
},
|
|
1026
|
-
Textarea: {
|
|
1027
|
-
styles: {
|
|
1028
|
-
label,
|
|
1029
|
-
error
|
|
1030
|
-
}
|
|
1031
|
-
},
|
|
1032
|
-
Button: {
|
|
1033
|
-
styles: {
|
|
1034
|
-
root: {
|
|
1035
|
-
fontSize: "var(--mantine-font-size-xs)"
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
},
|
|
1039
|
-
Select: {
|
|
1040
|
-
styles: {
|
|
1041
|
-
input: {
|
|
1042
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
},
|
|
1046
|
-
Pill: {
|
|
1047
|
-
styles: (theme2) => ({
|
|
1048
|
-
root: {
|
|
1049
|
-
display: "inline-flex",
|
|
1050
|
-
alignItems: "center",
|
|
1051
|
-
justifyContent: "space-between",
|
|
1052
|
-
backgroundColor: "rgba(76, 76, 76, 0.3)",
|
|
1053
|
-
height: "fit-content",
|
|
1054
|
-
textTransform: "uppercase",
|
|
1055
|
-
letterSpacing: "0.05em",
|
|
1056
|
-
fontFamily: "Akrobat Bold",
|
|
1057
|
-
fontSize: theme2.fontSizes.xs,
|
|
1058
|
-
borderRadius: theme2.defaultRadius,
|
|
1059
|
-
padding: `${theme2.spacing.xs} ${theme2.spacing.sm}`
|
|
1060
|
-
}
|
|
1061
|
-
})
|
|
1062
|
-
},
|
|
1063
|
-
Input: {
|
|
1064
|
-
styles: {
|
|
1065
|
-
label,
|
|
1066
|
-
error,
|
|
1067
|
-
input: {
|
|
1068
|
-
padding: "var(--mantine-spacing-sm)",
|
|
1069
|
-
backgroundColor: "rgba(76, 76, 76, 0.3)"
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
},
|
|
1073
|
-
ColorInput: {
|
|
1074
|
-
styles: {
|
|
1075
|
-
label,
|
|
1076
|
-
input: {
|
|
1077
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
},
|
|
1081
|
-
TextInput: {
|
|
1082
|
-
styles: {
|
|
1083
|
-
label,
|
|
1084
|
-
wrapper: {},
|
|
1085
|
-
section: {
|
|
1086
|
-
marginRight: "0.2vh"
|
|
1087
|
-
},
|
|
1088
|
-
input: {
|
|
1089
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
},
|
|
1093
|
-
NumberInput: {
|
|
1094
|
-
styles: {
|
|
1095
|
-
label,
|
|
1096
|
-
input: {
|
|
1097
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1098
|
-
},
|
|
1099
|
-
section: {
|
|
1100
|
-
pointerEvents: "all"
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
},
|
|
1105
|
-
colors: {
|
|
1106
|
-
dirk: [
|
|
1107
|
-
"#ffffff",
|
|
1108
|
-
"#f3fce9",
|
|
1109
|
-
"#dbf5bd",
|
|
1110
|
-
"#c3ee91",
|
|
1111
|
-
"#ace765",
|
|
1112
|
-
"#94e039",
|
|
1113
|
-
"#7ac61f",
|
|
1114
|
-
"#5f9a18",
|
|
1115
|
-
"#29420a",
|
|
1116
|
-
"#446e11"
|
|
1117
|
-
]
|
|
1118
|
-
}
|
|
1119
|
-
});
|
|
1120
|
-
var theme_default = theme;
|
|
1121
|
-
fontawesomeSvgCore.library.add(freeSolidSvgIcons.fas, freeRegularSvgIcons.far, freeBrandsSvgIcons.fab);
|
|
1122
|
-
var useSettings = zustand.create((set) => ({
|
|
1123
|
-
game: "fivem",
|
|
1124
|
-
primaryColor: "dirk",
|
|
1125
|
-
primaryShade: 9,
|
|
1126
|
-
itemImgPath: "https://assets.dirkcfx.com/items/",
|
|
1127
|
-
customTheme: {}
|
|
1128
|
-
}));
|
|
1129
|
-
function DirkProvider(props) {
|
|
1130
|
-
const primaryColor = useSettings((data) => data.primaryColor);
|
|
1131
|
-
const primaryShade = useSettings((data) => data.primaryShade);
|
|
1132
|
-
const customTheme = useSettings((data) => data.customTheme);
|
|
1133
|
-
const game = useSettings((data) => data.game);
|
|
1134
|
-
const mergedTheme = react.useMemo(() => ({
|
|
1135
|
-
...theme_default,
|
|
1136
|
-
primaryColor,
|
|
1137
|
-
primaryShade,
|
|
1138
|
-
colors: {
|
|
1139
|
-
...theme_default.colors,
|
|
1140
|
-
...customTheme
|
|
1141
|
-
// Custom theme colors will override/extend base colors
|
|
1142
|
-
}
|
|
1143
|
-
}), [primaryColor, primaryShade, customTheme]);
|
|
1144
|
-
react.useEffect(() => {
|
|
1145
|
-
document.fonts.ready.then(() => {
|
|
1146
|
-
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : game === "fivem" ? '"Akrobat Regular", sans-serif' : "sans-serif";
|
|
1147
|
-
console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
|
|
1148
|
-
});
|
|
1149
|
-
}, [game]);
|
|
1150
|
-
react.useEffect(() => {
|
|
1151
|
-
fetchNui("NUI_READY");
|
|
1152
|
-
}, []);
|
|
1153
|
-
useAutoFetcher();
|
|
1154
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core.MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: props.children }) });
|
|
1155
|
-
}
|
|
1156
|
-
function Wrapper({ children }) {
|
|
1157
|
-
const game = useSettings((data) => data.game);
|
|
1158
|
-
return isEnvBrowser() ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1159
|
-
core.BackgroundImage,
|
|
1160
|
-
{
|
|
1161
|
-
w: "100vw",
|
|
1162
|
-
h: "100vh",
|
|
1163
|
-
style: { overflow: "hidden" },
|
|
1164
|
-
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",
|
|
1165
|
-
children
|
|
1166
|
-
}
|
|
1167
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
1168
|
-
}
|
|
1169
|
-
function useTornEdges() {
|
|
1170
|
-
const game = useSettings((state) => state.game);
|
|
1171
|
-
return game === "rdr3" ? "torn-edge-wrapper" : "";
|
|
1172
|
-
}
|
|
1173
|
-
function TornEdgeSVGFilter() {
|
|
1174
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1175
|
-
"svg",
|
|
1176
|
-
{
|
|
1177
|
-
style: { position: "absolute", width: 0, height: 0, pointerEvents: "none" },
|
|
1178
|
-
"aria-hidden": "true",
|
|
1179
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: "torn-edge-filter", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
1180
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1181
|
-
"feTurbulence",
|
|
1182
|
-
{
|
|
1183
|
-
type: "fractalNoise",
|
|
1184
|
-
baseFrequency: "0.018 0.022",
|
|
1185
|
-
numOctaves: "5",
|
|
1186
|
-
seed: "9",
|
|
1187
|
-
result: "noise1"
|
|
1188
|
-
}
|
|
1189
|
-
),
|
|
1190
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1191
|
-
"feTurbulence",
|
|
1192
|
-
{
|
|
1193
|
-
type: "fractalNoise",
|
|
1194
|
-
baseFrequency: "0.08 0.12",
|
|
1195
|
-
numOctaves: "2",
|
|
1196
|
-
seed: "3",
|
|
1197
|
-
result: "noise2"
|
|
1198
|
-
}
|
|
1199
|
-
),
|
|
1200
|
-
/* @__PURE__ */ jsxRuntime.jsx("feBlend", { in: "noise1", in2: "noise2", mode: "multiply", result: "combinedNoise" }),
|
|
1201
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1202
|
-
"feDisplacementMap",
|
|
1203
|
-
{
|
|
1204
|
-
in: "SourceGraphic",
|
|
1205
|
-
in2: "combinedNoise",
|
|
1206
|
-
scale: "52",
|
|
1207
|
-
xChannelSelector: "R",
|
|
1208
|
-
yChannelSelector: "G",
|
|
1209
|
-
result: "displaced"
|
|
1210
|
-
}
|
|
1211
|
-
),
|
|
1212
|
-
/* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { stdDeviation: "0.8", in: "displaced", result: "blurred" }),
|
|
1213
|
-
/* @__PURE__ */ jsxRuntime.jsx("feComponentTransfer", { in: "blurred", result: "alphaFade", children: /* @__PURE__ */ jsxRuntime.jsx("feFuncA", { type: "gamma", amplitude: "1", exponent: "1.3", offset: "-0.05" }) }),
|
|
1214
|
-
/* @__PURE__ */ jsxRuntime.jsx("feMorphology", { operator: "erode", radius: "0.4", in: "alphaFade", result: "eroded" }),
|
|
1215
|
-
/* @__PURE__ */ jsxRuntime.jsx("feMerge", { children: /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "eroded" }) })
|
|
1216
|
-
] }) })
|
|
1217
|
-
}
|
|
1218
|
-
);
|
|
1219
|
-
}
|
|
1220
752
|
function BorderedIcon(props) {
|
|
1221
753
|
const theme2 = core.useMantineTheme();
|
|
1222
|
-
const tornEdgeCSS = useTornEdges();
|
|
1223
754
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1224
|
-
|
|
755
|
+
reactFontawesome.FontAwesomeIcon,
|
|
1225
756
|
{
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
align: "center",
|
|
757
|
+
icon: props.icon,
|
|
758
|
+
color: colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][theme2.primaryShade], props.hovered ? 0.9 : 0.9),
|
|
1229
759
|
style: {
|
|
760
|
+
// backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
|
|
1230
761
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
1231
762
|
padding: props.p || theme2.spacing.xs,
|
|
1232
763
|
transition: "all 0.2s ease-in-out",
|
|
@@ -1234,19 +765,9 @@ function BorderedIcon(props) {
|
|
|
1234
765
|
fontSize: props.fontSize ? props.fontSize : "2.5vh",
|
|
1235
766
|
borderRadius: theme2.radius.xs,
|
|
1236
767
|
// border: `2px solid var(--mantine-primary-color-9)`,
|
|
1237
|
-
|
|
768
|
+
outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][9], 0.8)}`,
|
|
1238
769
|
boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][7], 0.5)}`
|
|
1239
|
-
}
|
|
1240
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1241
|
-
reactFontawesome.FontAwesomeIcon,
|
|
1242
|
-
{
|
|
1243
|
-
icon: props.icon,
|
|
1244
|
-
color: colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][theme2.primaryShade], props.hovered ? 0.9 : 0.9),
|
|
1245
|
-
style: {
|
|
1246
|
-
// backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
)
|
|
770
|
+
}
|
|
1250
771
|
}
|
|
1251
772
|
);
|
|
1252
773
|
}
|
|
@@ -1754,13 +1275,13 @@ function Segment(props) {
|
|
|
1754
1275
|
{
|
|
1755
1276
|
size: props.fz || "xs",
|
|
1756
1277
|
initial: {
|
|
1757
|
-
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "
|
|
1278
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "rgba(255, 255, 255, 0.7)"
|
|
1758
1279
|
},
|
|
1759
1280
|
animate: {
|
|
1760
|
-
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "
|
|
1281
|
+
color: props.selected ? props.color || theme2.colors[theme2.primaryColor][5] : "rgba(255, 255, 255, 0.7)"
|
|
1761
1282
|
},
|
|
1762
1283
|
exit: {
|
|
1763
|
-
color: "
|
|
1284
|
+
color: "rgba(255, 255, 255, 0.7)"
|
|
1764
1285
|
},
|
|
1765
1286
|
style: {
|
|
1766
1287
|
fontFamily: "Akrobat Bold",
|
|
@@ -2144,6 +1665,472 @@ function Modal() {
|
|
|
2144
1665
|
}
|
|
2145
1666
|
) });
|
|
2146
1667
|
}
|
|
1668
|
+
var useNuiEvent = (action, handler) => {
|
|
1669
|
+
const savedHandler = react.useRef(noop);
|
|
1670
|
+
react.useEffect(() => {
|
|
1671
|
+
savedHandler.current = handler;
|
|
1672
|
+
}, [handler]);
|
|
1673
|
+
react.useEffect(() => {
|
|
1674
|
+
const eventListener = (event) => {
|
|
1675
|
+
const { action: eventAction, data } = event.data;
|
|
1676
|
+
if (savedHandler.current) {
|
|
1677
|
+
if (eventAction === action) {
|
|
1678
|
+
savedHandler.current(data);
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
window.addEventListener("message", eventListener);
|
|
1683
|
+
return () => window.removeEventListener("message", eventListener);
|
|
1684
|
+
}, [action]);
|
|
1685
|
+
};
|
|
1686
|
+
function getNested(obj, path) {
|
|
1687
|
+
return path.split(".").reduce((acc, key) => acc ? acc[key] : void 0, obj);
|
|
1688
|
+
}
|
|
1689
|
+
function setNested(obj, path, value) {
|
|
1690
|
+
const keys = path.split(".");
|
|
1691
|
+
const newObj = { ...obj };
|
|
1692
|
+
let current = newObj;
|
|
1693
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
1694
|
+
const key = keys[i];
|
|
1695
|
+
current[key] = { ...current[key] || {} };
|
|
1696
|
+
current = current[key];
|
|
1697
|
+
}
|
|
1698
|
+
current[keys[keys.length - 1]] = value;
|
|
1699
|
+
return newObj;
|
|
1700
|
+
}
|
|
1701
|
+
function deleteNested(obj, path) {
|
|
1702
|
+
const keys = path.split(".");
|
|
1703
|
+
const newObj = { ...obj };
|
|
1704
|
+
let current = newObj;
|
|
1705
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
1706
|
+
const key = keys[i];
|
|
1707
|
+
if (!current[key]) return obj;
|
|
1708
|
+
current[key] = { ...current[key] };
|
|
1709
|
+
current = current[key];
|
|
1710
|
+
}
|
|
1711
|
+
delete current[keys[keys.length - 1]];
|
|
1712
|
+
return newObj;
|
|
1713
|
+
}
|
|
1714
|
+
function flattenRules(rules, prefix = "") {
|
|
1715
|
+
const result = {};
|
|
1716
|
+
for (const key in rules) {
|
|
1717
|
+
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
1718
|
+
const val = rules[key];
|
|
1719
|
+
if (typeof val === "function") result[fullPath] = val;
|
|
1720
|
+
else if (typeof val === "object")
|
|
1721
|
+
Object.assign(result, flattenRules(val, fullPath));
|
|
1722
|
+
}
|
|
1723
|
+
return result;
|
|
1724
|
+
}
|
|
1725
|
+
function createFormStore(initialValues, validationRules, onSubmit) {
|
|
1726
|
+
const flatRules = validationRules ? flattenRules(validationRules) : {};
|
|
1727
|
+
const history = [];
|
|
1728
|
+
const future = [];
|
|
1729
|
+
const changed = /* @__PURE__ */ new Set();
|
|
1730
|
+
return zustand.createStore((set, get) => ({
|
|
1731
|
+
initialValues,
|
|
1732
|
+
values: initialValues,
|
|
1733
|
+
errors: {},
|
|
1734
|
+
canBack: false,
|
|
1735
|
+
canForward: false,
|
|
1736
|
+
changedFields: [],
|
|
1737
|
+
changedCount: 0,
|
|
1738
|
+
onSubmit,
|
|
1739
|
+
submit: () => {
|
|
1740
|
+
const state = get();
|
|
1741
|
+
const isValid = state.validate();
|
|
1742
|
+
if (isValid && state.onSubmit) state.onSubmit(get());
|
|
1743
|
+
},
|
|
1744
|
+
resetChangeCount: () => {
|
|
1745
|
+
changed.clear();
|
|
1746
|
+
set(() => ({
|
|
1747
|
+
changedFields: [],
|
|
1748
|
+
changedCount: 0
|
|
1749
|
+
}));
|
|
1750
|
+
},
|
|
1751
|
+
setInitialValues: (newInitialValues) => set({ initialValues: newInitialValues }),
|
|
1752
|
+
setValue: (path, value) => {
|
|
1753
|
+
const currentValues = get().values;
|
|
1754
|
+
const newValues = setNested(currentValues, path, value);
|
|
1755
|
+
const oldValue = getNested(get().initialValues, path);
|
|
1756
|
+
history.push(currentValues);
|
|
1757
|
+
future.length = 0;
|
|
1758
|
+
if (value !== oldValue) changed.add(path);
|
|
1759
|
+
else changed.delete(path);
|
|
1760
|
+
set({
|
|
1761
|
+
values: newValues,
|
|
1762
|
+
canBack: history.length > 0,
|
|
1763
|
+
canForward: false,
|
|
1764
|
+
changedFields: Array.from(changed),
|
|
1765
|
+
changedCount: changed.size
|
|
1766
|
+
});
|
|
1767
|
+
const rule = flatRules[path];
|
|
1768
|
+
if (rule) {
|
|
1769
|
+
const error2 = rule(value, newValues);
|
|
1770
|
+
if (error2)
|
|
1771
|
+
set((state) => ({ errors: setNested(state.errors, path, error2) }));
|
|
1772
|
+
else set((state) => ({ errors: deleteNested(state.errors, path) }));
|
|
1773
|
+
}
|
|
1774
|
+
},
|
|
1775
|
+
setError: (path, message) => set((state) => ({ errors: setNested(state.errors, path, message) })),
|
|
1776
|
+
clearError: (path) => set((state) => ({ errors: deleteNested(state.errors, path) })),
|
|
1777
|
+
validateField: (path) => {
|
|
1778
|
+
const state = get();
|
|
1779
|
+
const rule = flatRules[path];
|
|
1780
|
+
if (!rule) return true;
|
|
1781
|
+
const value = getNested(state.values, path);
|
|
1782
|
+
const error2 = rule(value, state.values);
|
|
1783
|
+
if (error2) {
|
|
1784
|
+
set((state2) => ({ errors: setNested(state2.errors, path, error2) }));
|
|
1785
|
+
return false;
|
|
1786
|
+
} else {
|
|
1787
|
+
set((state2) => ({ errors: deleteNested(state2.errors, path) }));
|
|
1788
|
+
return true;
|
|
1789
|
+
}
|
|
1790
|
+
},
|
|
1791
|
+
validate: () => {
|
|
1792
|
+
const state = get();
|
|
1793
|
+
let isValid = true;
|
|
1794
|
+
let newErrors = {};
|
|
1795
|
+
for (const path in flatRules) {
|
|
1796
|
+
const rule = flatRules[path];
|
|
1797
|
+
const value = getNested(state.values, path);
|
|
1798
|
+
const error2 = rule(value, state.values);
|
|
1799
|
+
if (error2) {
|
|
1800
|
+
isValid = false;
|
|
1801
|
+
newErrors = setNested(newErrors, path, error2);
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
set({ errors: newErrors });
|
|
1805
|
+
return isValid;
|
|
1806
|
+
},
|
|
1807
|
+
reset: () => {
|
|
1808
|
+
history.length = 0;
|
|
1809
|
+
future.length = 0;
|
|
1810
|
+
changed.clear();
|
|
1811
|
+
set({
|
|
1812
|
+
values: initialValues,
|
|
1813
|
+
errors: {},
|
|
1814
|
+
canBack: false,
|
|
1815
|
+
canForward: false,
|
|
1816
|
+
changedFields: [],
|
|
1817
|
+
changedCount: 0
|
|
1818
|
+
});
|
|
1819
|
+
},
|
|
1820
|
+
back: () => {
|
|
1821
|
+
const state = get();
|
|
1822
|
+
if (history.length === 0) return;
|
|
1823
|
+
const prev = history.pop();
|
|
1824
|
+
future.push(state.values);
|
|
1825
|
+
changed.clear();
|
|
1826
|
+
const current = prev;
|
|
1827
|
+
const initial = get().initialValues;
|
|
1828
|
+
for (const key in current) {
|
|
1829
|
+
if (JSON.stringify(current[key]) !== JSON.stringify(initial[key]))
|
|
1830
|
+
changed.add(key);
|
|
1831
|
+
}
|
|
1832
|
+
set({
|
|
1833
|
+
values: prev,
|
|
1834
|
+
canBack: history.length > 0,
|
|
1835
|
+
canForward: true,
|
|
1836
|
+
changedFields: Array.from(changed),
|
|
1837
|
+
changedCount: changed.size
|
|
1838
|
+
});
|
|
1839
|
+
},
|
|
1840
|
+
forward: () => {
|
|
1841
|
+
const state = get();
|
|
1842
|
+
if (future.length === 0) return;
|
|
1843
|
+
const next = future.pop();
|
|
1844
|
+
history.push(state.values);
|
|
1845
|
+
changed.clear();
|
|
1846
|
+
const current = next;
|
|
1847
|
+
const initial = get().initialValues;
|
|
1848
|
+
for (const key in current) {
|
|
1849
|
+
if (JSON.stringify(current[key]) !== JSON.stringify(initial[key]))
|
|
1850
|
+
changed.add(key);
|
|
1851
|
+
}
|
|
1852
|
+
set({
|
|
1853
|
+
values: next,
|
|
1854
|
+
canBack: true,
|
|
1855
|
+
canForward: future.length > 0,
|
|
1856
|
+
changedFields: Array.from(changed),
|
|
1857
|
+
changedCount: changed.size
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
}));
|
|
1861
|
+
}
|
|
1862
|
+
var FormContext = react.createContext(null);
|
|
1863
|
+
function FormProvider({
|
|
1864
|
+
initialValues,
|
|
1865
|
+
validate,
|
|
1866
|
+
onSubmit,
|
|
1867
|
+
children
|
|
1868
|
+
}) {
|
|
1869
|
+
const storeRef = react.useRef(createFormStore(initialValues, validate, onSubmit));
|
|
1870
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FormContext.Provider, { value: storeRef.current, children });
|
|
1871
|
+
}
|
|
1872
|
+
function useForm() {
|
|
1873
|
+
const store = react.useContext(FormContext);
|
|
1874
|
+
if (!store) throw new Error("useForm must be used inside a <FormProvider>");
|
|
1875
|
+
return zustand.useStore(store);
|
|
1876
|
+
}
|
|
1877
|
+
var label = {
|
|
1878
|
+
fontSize: "var(--mantine-font-size-xs)",
|
|
1879
|
+
fontFamily: "Akrobat Bold",
|
|
1880
|
+
letterSpacing: "0.05em",
|
|
1881
|
+
textTransform: "uppercase"
|
|
1882
|
+
};
|
|
1883
|
+
var error = {
|
|
1884
|
+
fontSize: "var(--mantine-font-size-xs)",
|
|
1885
|
+
fontFamily: "Akrobat Regular"
|
|
1886
|
+
};
|
|
1887
|
+
var theme = core.createTheme({
|
|
1888
|
+
primaryColor: "dirk",
|
|
1889
|
+
primaryShade: 9,
|
|
1890
|
+
defaultRadius: "xs",
|
|
1891
|
+
fontFamily: "Akrobat Regular, sans-serif",
|
|
1892
|
+
radius: {
|
|
1893
|
+
xxs: "0.2vh",
|
|
1894
|
+
xs: "0.4vh",
|
|
1895
|
+
sm: "0.75vh",
|
|
1896
|
+
md: "1vh",
|
|
1897
|
+
lg: "1.5vh",
|
|
1898
|
+
xl: "2vh",
|
|
1899
|
+
xxl: "3vh"
|
|
1900
|
+
},
|
|
1901
|
+
fontSizes: {
|
|
1902
|
+
xxs: "1.2vh",
|
|
1903
|
+
xs: "1.5vh",
|
|
1904
|
+
sm: "1.8vh",
|
|
1905
|
+
md: "2.2vh",
|
|
1906
|
+
lg: "2.8vh",
|
|
1907
|
+
xl: "3.3vh",
|
|
1908
|
+
xxl: "3.8vh"
|
|
1909
|
+
},
|
|
1910
|
+
lineHeights: {
|
|
1911
|
+
xxs: "1.4vh",
|
|
1912
|
+
xs: "1.8vh",
|
|
1913
|
+
sm: "2.2vh",
|
|
1914
|
+
md: "2.8vh",
|
|
1915
|
+
lg: "3.3vh",
|
|
1916
|
+
xl: "3.8vh"
|
|
1917
|
+
},
|
|
1918
|
+
spacing: {
|
|
1919
|
+
xxs: "0.5vh",
|
|
1920
|
+
xs: "0.75vh",
|
|
1921
|
+
sm: "1.5vh",
|
|
1922
|
+
md: "2vh",
|
|
1923
|
+
lg: "3vh",
|
|
1924
|
+
xl: "4vh",
|
|
1925
|
+
xxl: "5vh"
|
|
1926
|
+
},
|
|
1927
|
+
components: {
|
|
1928
|
+
Progress: {
|
|
1929
|
+
styles: {
|
|
1930
|
+
label: {
|
|
1931
|
+
fontFamily: "Akrobat Bold",
|
|
1932
|
+
letterSpacing: "0.05em",
|
|
1933
|
+
textTransform: "uppercase"
|
|
1934
|
+
},
|
|
1935
|
+
root: {
|
|
1936
|
+
backgroundColor: "rgba(77, 77, 77, 0.4)"
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
},
|
|
1940
|
+
Textarea: {
|
|
1941
|
+
styles: {
|
|
1942
|
+
label,
|
|
1943
|
+
error
|
|
1944
|
+
}
|
|
1945
|
+
},
|
|
1946
|
+
Button: {
|
|
1947
|
+
styles: {
|
|
1948
|
+
root: {
|
|
1949
|
+
fontSize: "var(--mantine-font-size-xs)"
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
},
|
|
1953
|
+
Select: {
|
|
1954
|
+
styles: {
|
|
1955
|
+
input: {
|
|
1956
|
+
padding: "var(--mantine-spacing-sm)"
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
},
|
|
1960
|
+
Pill: {
|
|
1961
|
+
styles: (theme2) => ({
|
|
1962
|
+
root: {
|
|
1963
|
+
display: "inline-flex",
|
|
1964
|
+
alignItems: "center",
|
|
1965
|
+
justifyContent: "space-between",
|
|
1966
|
+
backgroundColor: "rgba(76, 76, 76, 0.3)",
|
|
1967
|
+
height: "fit-content",
|
|
1968
|
+
textTransform: "uppercase",
|
|
1969
|
+
letterSpacing: "0.05em",
|
|
1970
|
+
fontFamily: "Akrobat Bold",
|
|
1971
|
+
fontSize: theme2.fontSizes.xs,
|
|
1972
|
+
borderRadius: theme2.defaultRadius,
|
|
1973
|
+
padding: `${theme2.spacing.xs} ${theme2.spacing.sm}`
|
|
1974
|
+
}
|
|
1975
|
+
})
|
|
1976
|
+
},
|
|
1977
|
+
Input: {
|
|
1978
|
+
styles: {
|
|
1979
|
+
label,
|
|
1980
|
+
error,
|
|
1981
|
+
input: {
|
|
1982
|
+
padding: "var(--mantine-spacing-sm)",
|
|
1983
|
+
backgroundColor: "rgba(76, 76, 76, 0.3)"
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
},
|
|
1987
|
+
ColorInput: {
|
|
1988
|
+
styles: {
|
|
1989
|
+
label,
|
|
1990
|
+
input: {
|
|
1991
|
+
padding: "var(--mantine-spacing-sm)"
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
},
|
|
1995
|
+
TextInput: {
|
|
1996
|
+
styles: {
|
|
1997
|
+
label,
|
|
1998
|
+
wrapper: {},
|
|
1999
|
+
section: {
|
|
2000
|
+
marginRight: "0.2vh"
|
|
2001
|
+
},
|
|
2002
|
+
input: {
|
|
2003
|
+
padding: "var(--mantine-spacing-sm)"
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
},
|
|
2007
|
+
NumberInput: {
|
|
2008
|
+
styles: {
|
|
2009
|
+
label,
|
|
2010
|
+
input: {
|
|
2011
|
+
padding: "var(--mantine-spacing-sm)"
|
|
2012
|
+
},
|
|
2013
|
+
section: {
|
|
2014
|
+
pointerEvents: "all"
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
},
|
|
2019
|
+
colors: {
|
|
2020
|
+
dirk: [
|
|
2021
|
+
"#ffffff",
|
|
2022
|
+
"#f3fce9",
|
|
2023
|
+
"#dbf5bd",
|
|
2024
|
+
"#c3ee91",
|
|
2025
|
+
"#ace765",
|
|
2026
|
+
"#94e039",
|
|
2027
|
+
"#7ac61f",
|
|
2028
|
+
"#5f9a18",
|
|
2029
|
+
"#29420a",
|
|
2030
|
+
"#446e11"
|
|
2031
|
+
]
|
|
2032
|
+
}
|
|
2033
|
+
});
|
|
2034
|
+
var theme_default = theme;
|
|
2035
|
+
fontawesomeSvgCore.library.add(freeSolidSvgIcons.fas, freeRegularSvgIcons.far, freeBrandsSvgIcons.fab);
|
|
2036
|
+
var useSettings = zustand.create((set) => ({
|
|
2037
|
+
game: "fivem",
|
|
2038
|
+
primaryColor: "dirk",
|
|
2039
|
+
primaryShade: 9,
|
|
2040
|
+
itemImgPath: "https://assets.dirkcfx.com/items/",
|
|
2041
|
+
customTheme: {}
|
|
2042
|
+
}));
|
|
2043
|
+
function DirkProvider(props) {
|
|
2044
|
+
const primaryColor = useSettings((data) => data.primaryColor);
|
|
2045
|
+
const primaryShade = useSettings((data) => data.primaryShade);
|
|
2046
|
+
const customTheme = useSettings((data) => data.customTheme);
|
|
2047
|
+
const game = useSettings((data) => data.game);
|
|
2048
|
+
const mergedTheme = react.useMemo(() => ({
|
|
2049
|
+
...theme_default,
|
|
2050
|
+
primaryColor,
|
|
2051
|
+
primaryShade,
|
|
2052
|
+
colors: {
|
|
2053
|
+
...theme_default.colors,
|
|
2054
|
+
...customTheme
|
|
2055
|
+
// Custom theme colors will override/extend base colors
|
|
2056
|
+
}
|
|
2057
|
+
}), [primaryColor, primaryShade, customTheme]);
|
|
2058
|
+
react.useEffect(() => {
|
|
2059
|
+
document.fonts.ready.then(() => {
|
|
2060
|
+
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : game === "fivem" ? '"Akrobat Regular", sans-serif' : "sans-serif";
|
|
2061
|
+
console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
|
|
2062
|
+
});
|
|
2063
|
+
}, [game]);
|
|
2064
|
+
react.useEffect(() => {
|
|
2065
|
+
fetchNui("NUI_READY");
|
|
2066
|
+
}, []);
|
|
2067
|
+
useAutoFetcher();
|
|
2068
|
+
return /* @__PURE__ */ jsxRuntime.jsx(core.MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: props.children }) });
|
|
2069
|
+
}
|
|
2070
|
+
function Wrapper({ children }) {
|
|
2071
|
+
const game = useSettings((data) => data.game);
|
|
2072
|
+
return isEnvBrowser() ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2073
|
+
core.BackgroundImage,
|
|
2074
|
+
{
|
|
2075
|
+
w: "100vw",
|
|
2076
|
+
h: "100vh",
|
|
2077
|
+
style: { overflow: "hidden" },
|
|
2078
|
+
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",
|
|
2079
|
+
children
|
|
2080
|
+
}
|
|
2081
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
2082
|
+
}
|
|
2083
|
+
function useTornEdges() {
|
|
2084
|
+
const game = useSettings((state) => state.game);
|
|
2085
|
+
return game === "rdr3" ? "torn-edge-wrapper" : "";
|
|
2086
|
+
}
|
|
2087
|
+
function TornEdgeSVGFilter() {
|
|
2088
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2089
|
+
"svg",
|
|
2090
|
+
{
|
|
2091
|
+
style: { position: "absolute", width: 0, height: 0, pointerEvents: "none" },
|
|
2092
|
+
"aria-hidden": "true",
|
|
2093
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: "torn-edge-filter", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
2094
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2095
|
+
"feTurbulence",
|
|
2096
|
+
{
|
|
2097
|
+
type: "fractalNoise",
|
|
2098
|
+
baseFrequency: "0.018 0.022",
|
|
2099
|
+
numOctaves: "5",
|
|
2100
|
+
seed: "9",
|
|
2101
|
+
result: "noise1"
|
|
2102
|
+
}
|
|
2103
|
+
),
|
|
2104
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2105
|
+
"feTurbulence",
|
|
2106
|
+
{
|
|
2107
|
+
type: "fractalNoise",
|
|
2108
|
+
baseFrequency: "0.08 0.12",
|
|
2109
|
+
numOctaves: "2",
|
|
2110
|
+
seed: "3",
|
|
2111
|
+
result: "noise2"
|
|
2112
|
+
}
|
|
2113
|
+
),
|
|
2114
|
+
/* @__PURE__ */ jsxRuntime.jsx("feBlend", { in: "noise1", in2: "noise2", mode: "multiply", result: "combinedNoise" }),
|
|
2115
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2116
|
+
"feDisplacementMap",
|
|
2117
|
+
{
|
|
2118
|
+
in: "SourceGraphic",
|
|
2119
|
+
in2: "combinedNoise",
|
|
2120
|
+
scale: "52",
|
|
2121
|
+
xChannelSelector: "R",
|
|
2122
|
+
yChannelSelector: "G",
|
|
2123
|
+
result: "displaced"
|
|
2124
|
+
}
|
|
2125
|
+
),
|
|
2126
|
+
/* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { stdDeviation: "0.8", in: "displaced", result: "blurred" }),
|
|
2127
|
+
/* @__PURE__ */ jsxRuntime.jsx("feComponentTransfer", { in: "blurred", result: "alphaFade", children: /* @__PURE__ */ jsxRuntime.jsx("feFuncA", { type: "gamma", amplitude: "1", exponent: "1.3", offset: "-0.05" }) }),
|
|
2128
|
+
/* @__PURE__ */ jsxRuntime.jsx("feMorphology", { operator: "erode", radius: "0.4", in: "alphaFade", result: "eroded" }),
|
|
2129
|
+
/* @__PURE__ */ jsxRuntime.jsx("feMerge", { children: /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "eroded" }) })
|
|
2130
|
+
] }) })
|
|
2131
|
+
}
|
|
2132
|
+
);
|
|
2133
|
+
}
|
|
2147
2134
|
|
|
2148
2135
|
exports.BorderedIcon = BorderedIcon;
|
|
2149
2136
|
exports.Counter = Counter;
|