dirk-cfx-react 1.0.46 → 1.0.49
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 +108 -37
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +281 -273
- package/dist/components/index.d.ts +281 -273
- package/dist/components/index.js +109 -39
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +626 -510
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +629 -518
- package/dist/index.js.map +1 -1
- package/dist/utils/index.cjs +44 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +10 -1
- package/dist/utils/index.d.ts +10 -1
- package/dist/utils/index.js +38 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { createContext, useEffect, useRef, useState, useContext, useMemo } from 'react';
|
|
2
|
+
import { create, useStore, createStore } from 'zustand';
|
|
3
|
+
import axios from 'axios';
|
|
1
4
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
5
|
+
import { Flex, Text, Image as Image$1, createTheme, useMantineTheme, alpha, Progress, MantineProvider, BackgroundImage } from '@mantine/core';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
|
|
8
|
+
import clickSoundUrl from './click_sound-PNCRRTM4.mp3';
|
|
9
|
+
import hoverSoundUrl from './hover_sound-NBUA222C.mp3';
|
|
10
|
+
import { useClickOutside } from '@mantine/hooks';
|
|
6
11
|
import '@mantine/core/styles.css';
|
|
7
12
|
import '@mantine/notifications/styles.css';
|
|
8
13
|
import './styles/notify.css';
|
|
@@ -13,12 +18,6 @@ import { library } from '@fortawesome/fontawesome-svg-core';
|
|
|
13
18
|
import { fab } from '@fortawesome/free-brands-svg-icons';
|
|
14
19
|
import { far } from '@fortawesome/free-regular-svg-icons';
|
|
15
20
|
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
16
|
-
import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
|
|
17
|
-
import clickSoundUrl from './click_sound-PNCRRTM4.mp3';
|
|
18
|
-
import hoverSoundUrl from './hover_sound-NBUA222C.mp3';
|
|
19
|
-
import { useClickOutside } from '@mantine/hooks';
|
|
20
|
-
|
|
21
|
-
// src/components/BorderedIcon.tsx
|
|
22
21
|
|
|
23
22
|
// src/utils/colorWithAlpha.ts
|
|
24
23
|
var colorNames = {
|
|
@@ -217,216 +216,7 @@ var openLink = (url) => {
|
|
|
217
216
|
}
|
|
218
217
|
};
|
|
219
218
|
|
|
220
|
-
// src/
|
|
221
|
-
var useNuiEvent = (action, handler) => {
|
|
222
|
-
const savedHandler = useRef(noop);
|
|
223
|
-
useEffect(() => {
|
|
224
|
-
savedHandler.current = handler;
|
|
225
|
-
}, [handler]);
|
|
226
|
-
useEffect(() => {
|
|
227
|
-
const eventListener = (event) => {
|
|
228
|
-
const { action: eventAction, data } = event.data;
|
|
229
|
-
if (savedHandler.current) {
|
|
230
|
-
if (eventAction === action) {
|
|
231
|
-
savedHandler.current(data);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
window.addEventListener("message", eventListener);
|
|
236
|
-
return () => window.removeEventListener("message", eventListener);
|
|
237
|
-
}, [action]);
|
|
238
|
-
};
|
|
239
|
-
function getNested(obj, path) {
|
|
240
|
-
return path.split(".").reduce((acc, key) => acc ? acc[key] : void 0, obj);
|
|
241
|
-
}
|
|
242
|
-
function setNested(obj, path, value) {
|
|
243
|
-
const keys = path.split(".");
|
|
244
|
-
const newObj = { ...obj };
|
|
245
|
-
let current = newObj;
|
|
246
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
247
|
-
const key = keys[i];
|
|
248
|
-
current[key] = { ...current[key] || {} };
|
|
249
|
-
current = current[key];
|
|
250
|
-
}
|
|
251
|
-
current[keys[keys.length - 1]] = value;
|
|
252
|
-
return newObj;
|
|
253
|
-
}
|
|
254
|
-
function deleteNested(obj, path) {
|
|
255
|
-
const keys = path.split(".");
|
|
256
|
-
const newObj = { ...obj };
|
|
257
|
-
let current = newObj;
|
|
258
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
259
|
-
const key = keys[i];
|
|
260
|
-
if (!current[key]) return obj;
|
|
261
|
-
current[key] = { ...current[key] };
|
|
262
|
-
current = current[key];
|
|
263
|
-
}
|
|
264
|
-
delete current[keys[keys.length - 1]];
|
|
265
|
-
return newObj;
|
|
266
|
-
}
|
|
267
|
-
function flattenRules(rules, prefix = "") {
|
|
268
|
-
const result = {};
|
|
269
|
-
for (const key in rules) {
|
|
270
|
-
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
271
|
-
const val = rules[key];
|
|
272
|
-
if (typeof val === "function") result[fullPath] = val;
|
|
273
|
-
else if (typeof val === "object")
|
|
274
|
-
Object.assign(result, flattenRules(val, fullPath));
|
|
275
|
-
}
|
|
276
|
-
return result;
|
|
277
|
-
}
|
|
278
|
-
function createFormStore(initialValues, validationRules, onSubmit) {
|
|
279
|
-
const flatRules = validationRules ? flattenRules(validationRules) : {};
|
|
280
|
-
const history = [];
|
|
281
|
-
const future = [];
|
|
282
|
-
const changed = /* @__PURE__ */ new Set();
|
|
283
|
-
return createStore((set, get) => ({
|
|
284
|
-
initialValues,
|
|
285
|
-
values: initialValues,
|
|
286
|
-
errors: {},
|
|
287
|
-
canBack: false,
|
|
288
|
-
canForward: false,
|
|
289
|
-
changedFields: [],
|
|
290
|
-
changedCount: 0,
|
|
291
|
-
onSubmit,
|
|
292
|
-
submit: () => {
|
|
293
|
-
const state = get();
|
|
294
|
-
const isValid = state.validate();
|
|
295
|
-
if (isValid && state.onSubmit) state.onSubmit(get());
|
|
296
|
-
},
|
|
297
|
-
resetChangeCount: () => {
|
|
298
|
-
changed.clear();
|
|
299
|
-
set(() => ({
|
|
300
|
-
changedFields: [],
|
|
301
|
-
changedCount: 0
|
|
302
|
-
}));
|
|
303
|
-
},
|
|
304
|
-
setInitialValues: (newInitialValues) => set({ initialValues: newInitialValues }),
|
|
305
|
-
setValue: (path, value) => {
|
|
306
|
-
const currentValues = get().values;
|
|
307
|
-
const newValues = setNested(currentValues, path, value);
|
|
308
|
-
const oldValue = getNested(get().initialValues, path);
|
|
309
|
-
history.push(currentValues);
|
|
310
|
-
future.length = 0;
|
|
311
|
-
if (value !== oldValue) changed.add(path);
|
|
312
|
-
else changed.delete(path);
|
|
313
|
-
set({
|
|
314
|
-
values: newValues,
|
|
315
|
-
canBack: history.length > 0,
|
|
316
|
-
canForward: false,
|
|
317
|
-
changedFields: Array.from(changed),
|
|
318
|
-
changedCount: changed.size
|
|
319
|
-
});
|
|
320
|
-
const rule = flatRules[path];
|
|
321
|
-
if (rule) {
|
|
322
|
-
const error2 = rule(value, newValues);
|
|
323
|
-
if (error2)
|
|
324
|
-
set((state) => ({ errors: setNested(state.errors, path, error2) }));
|
|
325
|
-
else set((state) => ({ errors: deleteNested(state.errors, path) }));
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
setError: (path, message) => set((state) => ({ errors: setNested(state.errors, path, message) })),
|
|
329
|
-
clearError: (path) => set((state) => ({ errors: deleteNested(state.errors, path) })),
|
|
330
|
-
validateField: (path) => {
|
|
331
|
-
const state = get();
|
|
332
|
-
const rule = flatRules[path];
|
|
333
|
-
if (!rule) return true;
|
|
334
|
-
const value = getNested(state.values, path);
|
|
335
|
-
const error2 = rule(value, state.values);
|
|
336
|
-
if (error2) {
|
|
337
|
-
set((state2) => ({ errors: setNested(state2.errors, path, error2) }));
|
|
338
|
-
return false;
|
|
339
|
-
} else {
|
|
340
|
-
set((state2) => ({ errors: deleteNested(state2.errors, path) }));
|
|
341
|
-
return true;
|
|
342
|
-
}
|
|
343
|
-
},
|
|
344
|
-
validate: () => {
|
|
345
|
-
const state = get();
|
|
346
|
-
let isValid = true;
|
|
347
|
-
let newErrors = {};
|
|
348
|
-
for (const path in flatRules) {
|
|
349
|
-
const rule = flatRules[path];
|
|
350
|
-
const value = getNested(state.values, path);
|
|
351
|
-
const error2 = rule(value, state.values);
|
|
352
|
-
if (error2) {
|
|
353
|
-
isValid = false;
|
|
354
|
-
newErrors = setNested(newErrors, path, error2);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
set({ errors: newErrors });
|
|
358
|
-
return isValid;
|
|
359
|
-
},
|
|
360
|
-
reset: () => {
|
|
361
|
-
history.length = 0;
|
|
362
|
-
future.length = 0;
|
|
363
|
-
changed.clear();
|
|
364
|
-
set({
|
|
365
|
-
values: initialValues,
|
|
366
|
-
errors: {},
|
|
367
|
-
canBack: false,
|
|
368
|
-
canForward: false,
|
|
369
|
-
changedFields: [],
|
|
370
|
-
changedCount: 0
|
|
371
|
-
});
|
|
372
|
-
},
|
|
373
|
-
back: () => {
|
|
374
|
-
const state = get();
|
|
375
|
-
if (history.length === 0) return;
|
|
376
|
-
const prev = history.pop();
|
|
377
|
-
future.push(state.values);
|
|
378
|
-
changed.clear();
|
|
379
|
-
const current = prev;
|
|
380
|
-
const initial = get().initialValues;
|
|
381
|
-
for (const key in current) {
|
|
382
|
-
if (JSON.stringify(current[key]) !== JSON.stringify(initial[key]))
|
|
383
|
-
changed.add(key);
|
|
384
|
-
}
|
|
385
|
-
set({
|
|
386
|
-
values: prev,
|
|
387
|
-
canBack: history.length > 0,
|
|
388
|
-
canForward: true,
|
|
389
|
-
changedFields: Array.from(changed),
|
|
390
|
-
changedCount: changed.size
|
|
391
|
-
});
|
|
392
|
-
},
|
|
393
|
-
forward: () => {
|
|
394
|
-
const state = get();
|
|
395
|
-
if (future.length === 0) return;
|
|
396
|
-
const next = future.pop();
|
|
397
|
-
history.push(state.values);
|
|
398
|
-
changed.clear();
|
|
399
|
-
const current = next;
|
|
400
|
-
const initial = get().initialValues;
|
|
401
|
-
for (const key in current) {
|
|
402
|
-
if (JSON.stringify(current[key]) !== JSON.stringify(initial[key]))
|
|
403
|
-
changed.add(key);
|
|
404
|
-
}
|
|
405
|
-
set({
|
|
406
|
-
values: next,
|
|
407
|
-
canBack: true,
|
|
408
|
-
canForward: future.length > 0,
|
|
409
|
-
changedFields: Array.from(changed),
|
|
410
|
-
changedCount: changed.size
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
}));
|
|
414
|
-
}
|
|
415
|
-
var FormContext = createContext(null);
|
|
416
|
-
function FormProvider({
|
|
417
|
-
initialValues,
|
|
418
|
-
validate,
|
|
419
|
-
onSubmit,
|
|
420
|
-
children
|
|
421
|
-
}) {
|
|
422
|
-
const storeRef = useRef(createFormStore(initialValues, validate, onSubmit));
|
|
423
|
-
return /* @__PURE__ */ jsx(FormContext.Provider, { value: storeRef.current, children });
|
|
424
|
-
}
|
|
425
|
-
function useForm() {
|
|
426
|
-
const store = useContext(FormContext);
|
|
427
|
-
if (!store) throw new Error("useForm must be used inside a <FormProvider>");
|
|
428
|
-
return useStore(store);
|
|
429
|
-
}
|
|
219
|
+
// src/utils/fetchNui.ts
|
|
430
220
|
async function fetchNui(eventName, data, mockData) {
|
|
431
221
|
const options = {
|
|
432
222
|
method: "post",
|
|
@@ -953,273 +743,51 @@ function createSkill(defaultSettings) {
|
|
|
953
743
|
useSkill
|
|
954
744
|
};
|
|
955
745
|
}
|
|
956
|
-
var
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
letterSpacing: "0.05em",
|
|
960
|
-
textTransform: "uppercase"
|
|
961
|
-
};
|
|
962
|
-
var error = {
|
|
963
|
-
fontSize: "var(--mantine-font-size-xs)",
|
|
964
|
-
fontFamily: "Akrobat Regular"
|
|
965
|
-
};
|
|
966
|
-
var theme = createTheme({
|
|
967
|
-
primaryColor: "dirk",
|
|
968
|
-
primaryShade: 9,
|
|
969
|
-
defaultRadius: "xs",
|
|
970
|
-
fontFamily: "Akrobat Regular, sans-serif",
|
|
971
|
-
radius: {
|
|
972
|
-
xxs: "0.2vh",
|
|
973
|
-
xs: "0.4vh",
|
|
974
|
-
sm: "0.75vh",
|
|
975
|
-
md: "1vh",
|
|
976
|
-
lg: "1.5vh",
|
|
977
|
-
xl: "2vh",
|
|
978
|
-
xxl: "3vh"
|
|
979
|
-
},
|
|
980
|
-
fontSizes: {
|
|
981
|
-
xxs: "1.2vh",
|
|
982
|
-
xs: "1.5vh",
|
|
983
|
-
sm: "1.8vh",
|
|
984
|
-
md: "2.2vh",
|
|
985
|
-
lg: "2.8vh",
|
|
986
|
-
xl: "3.3vh",
|
|
987
|
-
xxl: "3.8vh"
|
|
988
|
-
},
|
|
989
|
-
lineHeights: {
|
|
990
|
-
xxs: "1.4vh",
|
|
991
|
-
xs: "1.8vh",
|
|
992
|
-
sm: "2.2vh",
|
|
993
|
-
md: "2.8vh",
|
|
994
|
-
lg: "3.3vh",
|
|
995
|
-
xl: "3.8vh"
|
|
996
|
-
},
|
|
997
|
-
spacing: {
|
|
998
|
-
xxs: "0.5vh",
|
|
999
|
-
xs: "0.75vh",
|
|
1000
|
-
sm: "1.5vh",
|
|
1001
|
-
md: "2vh",
|
|
1002
|
-
lg: "3vh",
|
|
1003
|
-
xl: "4vh",
|
|
1004
|
-
xxl: "5vh"
|
|
1005
|
-
},
|
|
1006
|
-
components: {
|
|
1007
|
-
Progress: {
|
|
1008
|
-
styles: {
|
|
1009
|
-
label: {
|
|
1010
|
-
fontFamily: "Akrobat Bold",
|
|
1011
|
-
letterSpacing: "0.05em",
|
|
1012
|
-
textTransform: "uppercase"
|
|
1013
|
-
},
|
|
1014
|
-
root: {
|
|
1015
|
-
backgroundColor: "rgba(77, 77, 77, 0.4)"
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
},
|
|
1019
|
-
Textarea: {
|
|
1020
|
-
styles: {
|
|
1021
|
-
label,
|
|
1022
|
-
error
|
|
1023
|
-
}
|
|
1024
|
-
},
|
|
1025
|
-
Button: {
|
|
1026
|
-
styles: {
|
|
1027
|
-
root: {
|
|
1028
|
-
fontSize: "var(--mantine-font-size-xs)"
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
},
|
|
1032
|
-
Select: {
|
|
1033
|
-
styles: {
|
|
1034
|
-
input: {
|
|
1035
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
},
|
|
1039
|
-
Pill: {
|
|
1040
|
-
styles: (theme2) => ({
|
|
1041
|
-
root: {
|
|
1042
|
-
display: "inline-flex",
|
|
1043
|
-
alignItems: "center",
|
|
1044
|
-
justifyContent: "space-between",
|
|
1045
|
-
backgroundColor: "rgba(76, 76, 76, 0.3)",
|
|
1046
|
-
height: "fit-content",
|
|
1047
|
-
textTransform: "uppercase",
|
|
1048
|
-
letterSpacing: "0.05em",
|
|
1049
|
-
fontFamily: "Akrobat Bold",
|
|
1050
|
-
fontSize: theme2.fontSizes.xs,
|
|
1051
|
-
borderRadius: theme2.defaultRadius,
|
|
1052
|
-
padding: `${theme2.spacing.xs} ${theme2.spacing.sm}`
|
|
1053
|
-
}
|
|
1054
|
-
})
|
|
1055
|
-
},
|
|
1056
|
-
Input: {
|
|
1057
|
-
styles: {
|
|
1058
|
-
label,
|
|
1059
|
-
error,
|
|
1060
|
-
input: {
|
|
1061
|
-
padding: "var(--mantine-spacing-sm)",
|
|
1062
|
-
backgroundColor: "rgba(76, 76, 76, 0.3)"
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
},
|
|
1066
|
-
ColorInput: {
|
|
1067
|
-
styles: {
|
|
1068
|
-
label,
|
|
1069
|
-
input: {
|
|
1070
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
},
|
|
1074
|
-
TextInput: {
|
|
1075
|
-
styles: {
|
|
1076
|
-
label,
|
|
1077
|
-
wrapper: {},
|
|
1078
|
-
section: {
|
|
1079
|
-
marginRight: "0.2vh"
|
|
1080
|
-
},
|
|
1081
|
-
input: {
|
|
1082
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
},
|
|
1086
|
-
NumberInput: {
|
|
1087
|
-
styles: {
|
|
1088
|
-
label,
|
|
1089
|
-
input: {
|
|
1090
|
-
padding: "var(--mantine-spacing-sm)"
|
|
1091
|
-
},
|
|
1092
|
-
section: {
|
|
1093
|
-
pointerEvents: "all"
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
},
|
|
1098
|
-
colors: {
|
|
1099
|
-
dirk: [
|
|
1100
|
-
"#ffffff",
|
|
1101
|
-
"#f3fce9",
|
|
1102
|
-
"#dbf5bd",
|
|
1103
|
-
"#c3ee91",
|
|
1104
|
-
"#ace765",
|
|
1105
|
-
"#94e039",
|
|
1106
|
-
"#7ac61f",
|
|
1107
|
-
"#5f9a18",
|
|
1108
|
-
"#29420a",
|
|
1109
|
-
"#446e11"
|
|
1110
|
-
]
|
|
1111
|
-
}
|
|
1112
|
-
});
|
|
1113
|
-
var theme_default = theme;
|
|
1114
|
-
library.add(fas, far, fab);
|
|
1115
|
-
var useSettings = create((set) => ({
|
|
1116
|
-
game: "fivem",
|
|
1117
|
-
primaryColor: "dirk",
|
|
1118
|
-
primaryShade: 9,
|
|
1119
|
-
itemImgPath: "https://assets.dirkcfx.com/items/",
|
|
1120
|
-
customTheme: {}
|
|
1121
|
-
}));
|
|
1122
|
-
function DirkProvider(props) {
|
|
1123
|
-
const primaryColor = useSettings((data) => data.primaryColor);
|
|
1124
|
-
const primaryShade = useSettings((data) => data.primaryShade);
|
|
1125
|
-
const customTheme = useSettings((data) => data.customTheme);
|
|
1126
|
-
const game = useSettings((data) => data.game);
|
|
1127
|
-
const mergedTheme = useMemo(() => ({
|
|
1128
|
-
...theme_default,
|
|
1129
|
-
primaryColor,
|
|
1130
|
-
primaryShade,
|
|
1131
|
-
colors: {
|
|
1132
|
-
...theme_default.colors,
|
|
1133
|
-
...customTheme
|
|
1134
|
-
// Custom theme colors will override/extend base colors
|
|
1135
|
-
}
|
|
1136
|
-
}), [primaryColor, primaryShade, customTheme]);
|
|
1137
|
-
useEffect(() => {
|
|
1138
|
-
document.fonts.ready.then(() => {
|
|
1139
|
-
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : game === "fivem" ? '"Akrobat Regular", sans-serif' : "sans-serif";
|
|
1140
|
-
console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
|
|
1141
|
-
});
|
|
1142
|
-
}, [game]);
|
|
1143
|
-
useEffect(() => {
|
|
1144
|
-
fetchNui("NUI_READY");
|
|
1145
|
-
}, []);
|
|
1146
|
-
useAutoFetcher();
|
|
1147
|
-
return /* @__PURE__ */ jsx(MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsx(Wrapper, { children: props.children }) });
|
|
1148
|
-
}
|
|
1149
|
-
function Wrapper({ children }) {
|
|
1150
|
-
const game = useSettings((data) => data.game);
|
|
1151
|
-
return isEnvBrowser() ? /* @__PURE__ */ jsx(
|
|
1152
|
-
BackgroundImage,
|
|
1153
|
-
{
|
|
1154
|
-
w: "100vw",
|
|
1155
|
-
h: "100vh",
|
|
1156
|
-
style: { overflow: "hidden" },
|
|
1157
|
-
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",
|
|
1158
|
-
children
|
|
1159
|
-
}
|
|
1160
|
-
) : /* @__PURE__ */ jsx(Fragment, { children });
|
|
1161
|
-
}
|
|
1162
|
-
function useTornEdges() {
|
|
1163
|
-
const game = useSettings((state) => state.game);
|
|
1164
|
-
return game === "rdr3" ? "torn-edge-wrapper" : "";
|
|
746
|
+
var dummyURL = "https://fmapi.net/api/v2/presigned-url/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJON0UxM0tzejFRM0NuSzRHWFBPbmUiLCJ0ZWFtSWQiOiJlMDQ1YnpwZzg5TGpoaUFTaURIdVoiLCJmaWxlVHlwZSI6ImltYWdlIiwidG9rZW5JZCI6ImpwczJ4Z0M1eFZqcnRoeWZTZnFsYSIsInNldHRpbmdzIjp7IlRlYW1JRCI6ImUwNDVienBnODlMamhpQVNpREh1WiIsIkltYWdlTm90aWZpY2F0aW9uVHlwZSI6IiIsIkRpc2NvcmRXZWJob29rIjoiIiwiRGlzY29yZEltYWdlQ2hhbm5lbCI6IiIsIlZpZGVvTm90aWZpY2F0aW9uVHlwZSI6IiIsIkRpc2NvcmRWaWRlb1dlYmhvb2siOiIiLCJEaXNjb3JkVmlkZW9DaGFubmVsIjoiIiwiQXVkaW9Ob3RpZmljYXRpb25UeXBlIjoiIiwiRGlzY29yZEF1ZGlvV2ViaG9vayI6IiIsIkRpc2NvcmRBdWRpb0NoYW5uZWwiOiIiLCJEaXNjb3JkQm90VG9rZW4iOiIiLCJSZXRlbnRpb25FbmFibGVkIjpmYWxzZSwiUmV0ZW50aW9uRGF5cyI6NywiVmlkZW9SZXRlbnRpb25FbmFibGVkIjpmYWxzZSwiVmlkZW9SZXRlbnRpb25EYXlzIjo3LCJBdWRpb1JldGVudGlvbkVuYWJsZWQiOmZhbHNlLCJBdWRpb1JldGVudGlvbkRheXMiOjcsIkxvZ0FsZXJ0RW5hYmxlZCI6ZmFsc2UsIkxvZ0FsZXJ0TGV2ZWxzIjpbXSwiTG9nQWxlcnREaXNjb3JkV2ViaG9vayI6IiIsIk92ZXJyaWRlSW1hZ2VRdWFsaXR5IjpmYWxzZSwiSW1hZ2VRdWFsaXR5Ijo1MH0sImV4cCI6MTc2MTg1MTEzNH0.fpPeQ0GCm5GNTddjttUQ78VMqRUAufXoOvv5C7Vh3WA";
|
|
747
|
+
async function updatePresignedURL() {
|
|
748
|
+
return await fetchNui("GET_PRESIGNED_URL", void 0, dummyURL);
|
|
1165
749
|
}
|
|
1166
|
-
function
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
seed: "9",
|
|
1180
|
-
result: "noise1"
|
|
1181
|
-
}
|
|
1182
|
-
),
|
|
1183
|
-
/* @__PURE__ */ jsx(
|
|
1184
|
-
"feTurbulence",
|
|
1185
|
-
{
|
|
1186
|
-
type: "fractalNoise",
|
|
1187
|
-
baseFrequency: "0.08 0.12",
|
|
1188
|
-
numOctaves: "2",
|
|
1189
|
-
seed: "3",
|
|
1190
|
-
result: "noise2"
|
|
1191
|
-
}
|
|
1192
|
-
),
|
|
1193
|
-
/* @__PURE__ */ jsx("feBlend", { in: "noise1", in2: "noise2", mode: "multiply", result: "combinedNoise" }),
|
|
1194
|
-
/* @__PURE__ */ jsx(
|
|
1195
|
-
"feDisplacementMap",
|
|
1196
|
-
{
|
|
1197
|
-
in: "SourceGraphic",
|
|
1198
|
-
in2: "combinedNoise",
|
|
1199
|
-
scale: "52",
|
|
1200
|
-
xChannelSelector: "R",
|
|
1201
|
-
yChannelSelector: "G",
|
|
1202
|
-
result: "displaced"
|
|
1203
|
-
}
|
|
1204
|
-
),
|
|
1205
|
-
/* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "0.8", in: "displaced", result: "blurred" }),
|
|
1206
|
-
/* @__PURE__ */ jsx("feComponentTransfer", { in: "blurred", result: "alphaFade", children: /* @__PURE__ */ jsx("feFuncA", { type: "gamma", amplitude: "1", exponent: "1.3", offset: "-0.05" }) }),
|
|
1207
|
-
/* @__PURE__ */ jsx("feMorphology", { operator: "erode", radius: "0.4", in: "alphaFade", result: "eroded" }),
|
|
1208
|
-
/* @__PURE__ */ jsx("feMerge", { children: /* @__PURE__ */ jsx("feMergeNode", { in: "eroded" }) })
|
|
1209
|
-
] }) })
|
|
1210
|
-
}
|
|
750
|
+
async function uploadImage(props) {
|
|
751
|
+
const uploadURL = await updatePresignedURL();
|
|
752
|
+
const response = await fetch(props.fileURL);
|
|
753
|
+
const blob = await response.blob();
|
|
754
|
+
const file = new File([blob], "upload.png", { type: blob.type });
|
|
755
|
+
const formData = new FormData();
|
|
756
|
+
formData.append("file", file);
|
|
757
|
+
formData.append(
|
|
758
|
+
"metadata",
|
|
759
|
+
JSON.stringify({
|
|
760
|
+
name: props.name || file.name,
|
|
761
|
+
description: props.description || "Uploaded via DirkScripts"
|
|
762
|
+
})
|
|
1211
763
|
);
|
|
764
|
+
const uploadRes = await axios.post(uploadURL, formData, {
|
|
765
|
+
headers: { "Content-Type": "multipart/form-data" }
|
|
766
|
+
});
|
|
767
|
+
const finalUrl = uploadRes.data?.data?.url ?? uploadRes.data?.url;
|
|
768
|
+
if (!finalUrl) throw new Error("Upload succeeded but no URL returned");
|
|
769
|
+
return finalUrl;
|
|
770
|
+
}
|
|
771
|
+
async function getImageShape(file) {
|
|
772
|
+
return new Promise((resolve, reject) => {
|
|
773
|
+
const img = new Image();
|
|
774
|
+
img.onload = () => {
|
|
775
|
+
if (img.width > img.height) resolve("wide");
|
|
776
|
+
else resolve("square");
|
|
777
|
+
};
|
|
778
|
+
img.onerror = () => reject(new Error("Failed to load image"));
|
|
779
|
+
img.src = typeof file === "string" ? file : URL.createObjectURL(file);
|
|
780
|
+
});
|
|
1212
781
|
}
|
|
1213
782
|
function BorderedIcon(props) {
|
|
1214
783
|
const theme2 = useMantineTheme();
|
|
1215
|
-
const tornEdgeCSS = useTornEdges();
|
|
1216
784
|
return /* @__PURE__ */ jsx(
|
|
1217
|
-
|
|
785
|
+
FontAwesomeIcon,
|
|
1218
786
|
{
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
align: "center",
|
|
787
|
+
icon: props.icon,
|
|
788
|
+
color: colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][theme2.primaryShade], props.hovered ? 0.9 : 0.9),
|
|
1222
789
|
style: {
|
|
790
|
+
// backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
|
|
1223
791
|
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
1224
792
|
padding: props.p || theme2.spacing.xs,
|
|
1225
793
|
transition: "all 0.2s ease-in-out",
|
|
@@ -1227,25 +795,15 @@ function BorderedIcon(props) {
|
|
|
1227
795
|
fontSize: props.fontSize ? props.fontSize : "2.5vh",
|
|
1228
796
|
borderRadius: theme2.radius.xs,
|
|
1229
797
|
// border: `2px solid var(--mantine-primary-color-9)`,
|
|
1230
|
-
|
|
798
|
+
outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][9], 0.8)}`,
|
|
1231
799
|
boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][7], 0.5)}`
|
|
1232
|
-
}
|
|
1233
|
-
children: /* @__PURE__ */ jsx(
|
|
1234
|
-
FontAwesomeIcon,
|
|
1235
|
-
{
|
|
1236
|
-
icon: props.icon,
|
|
1237
|
-
color: colorWithAlpha(props.color ? props.color : theme2.colors[theme2.primaryColor][theme2.primaryShade], props.hovered ? 0.9 : 0.9),
|
|
1238
|
-
style: {
|
|
1239
|
-
// backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
)
|
|
800
|
+
}
|
|
1243
801
|
}
|
|
1244
802
|
);
|
|
1245
803
|
}
|
|
1246
804
|
var MotionFlex = motion.create(Flex);
|
|
1247
805
|
var MotionText = motion.create(Text);
|
|
1248
|
-
var MotionImage = motion.create(Image);
|
|
806
|
+
var MotionImage = motion.create(Image$1);
|
|
1249
807
|
var MotionIcon = motion.create(FontAwesomeIcon);
|
|
1250
808
|
function Counter(props) {
|
|
1251
809
|
return /* @__PURE__ */ jsx(AnimatePresence, { children: props.count > 0 && /* @__PURE__ */ jsx(
|
|
@@ -1988,31 +1546,118 @@ function Title(props) {
|
|
|
1988
1546
|
}
|
|
1989
1547
|
);
|
|
1990
1548
|
}
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
1549
|
+
function LevelBanner(props) {
|
|
1550
|
+
return /* @__PURE__ */ jsxs(
|
|
1551
|
+
MotionFlex,
|
|
1552
|
+
{
|
|
1553
|
+
w: "35vh",
|
|
1554
|
+
pos: "absolute",
|
|
1555
|
+
left: "50%",
|
|
1556
|
+
align: "center",
|
|
1557
|
+
gap: "xs",
|
|
1558
|
+
style: {
|
|
1559
|
+
borderRadius: useMantineTheme().radius.xxs
|
|
1560
|
+
},
|
|
1561
|
+
initial: { opacity: 0, y: -10, transform: "translateX(-50%)" },
|
|
1562
|
+
animate: { opacity: 1, y: 0, transform: "translateX(-50%)" },
|
|
1563
|
+
exit: { opacity: 0, y: -10, transform: "translateX(-50%)" },
|
|
1564
|
+
transition: { duration: 0.3 },
|
|
1565
|
+
direction: "column",
|
|
1566
|
+
children: [
|
|
1567
|
+
/* @__PURE__ */ jsxs(
|
|
1568
|
+
Flex,
|
|
1569
|
+
{
|
|
1570
|
+
w: "100%",
|
|
1571
|
+
justify: "space-between",
|
|
1572
|
+
children: [
|
|
1573
|
+
/* @__PURE__ */ jsxs(
|
|
1574
|
+
Text,
|
|
1575
|
+
{
|
|
1576
|
+
size: "xxs",
|
|
1577
|
+
c: "rgba(255, 255, 255, 0.9)",
|
|
1578
|
+
style: {
|
|
1579
|
+
fontFamily: "Akrobat Bold",
|
|
1580
|
+
letterSpacing: "0.1em"
|
|
1581
|
+
},
|
|
1582
|
+
children: [
|
|
1583
|
+
"LVL ",
|
|
1584
|
+
props.level
|
|
1585
|
+
]
|
|
1586
|
+
}
|
|
1587
|
+
),
|
|
1588
|
+
/* @__PURE__ */ jsxs(
|
|
1589
|
+
Text,
|
|
1590
|
+
{
|
|
1591
|
+
size: "xxs",
|
|
1592
|
+
c: "rgba(255, 255, 255, 0.7)",
|
|
1593
|
+
style: {
|
|
1594
|
+
fontFamily: "Akrobat Bold",
|
|
1595
|
+
letterSpacing: "0.1em"
|
|
1596
|
+
},
|
|
1597
|
+
children: [
|
|
1598
|
+
props.exp,
|
|
1599
|
+
"/",
|
|
1600
|
+
props.nextLevelXP,
|
|
1601
|
+
" XP"
|
|
1602
|
+
]
|
|
1603
|
+
}
|
|
1604
|
+
),
|
|
1605
|
+
/* @__PURE__ */ jsxs(
|
|
1606
|
+
Text,
|
|
1607
|
+
{
|
|
1608
|
+
size: "xxs",
|
|
1609
|
+
c: "rgba(255, 255, 255, 0.7)",
|
|
1610
|
+
style: {
|
|
1611
|
+
fontFamily: "Akrobat Bold",
|
|
1612
|
+
letterSpacing: "0.1em"
|
|
1613
|
+
},
|
|
1614
|
+
children: [
|
|
1615
|
+
"LVL ",
|
|
1616
|
+
props.level + 1
|
|
1617
|
+
]
|
|
1618
|
+
}
|
|
1619
|
+
)
|
|
1620
|
+
]
|
|
1621
|
+
}
|
|
1622
|
+
),
|
|
1623
|
+
/* @__PURE__ */ jsx(
|
|
1624
|
+
Progress,
|
|
1625
|
+
{
|
|
1626
|
+
color: props.color,
|
|
1627
|
+
w: "100%",
|
|
1628
|
+
size: "sm",
|
|
1629
|
+
value: props.progressToLevel
|
|
1630
|
+
}
|
|
1631
|
+
)
|
|
1632
|
+
]
|
|
1633
|
+
}
|
|
1634
|
+
);
|
|
1635
|
+
}
|
|
1636
|
+
var ModalContext = createContext(null);
|
|
1637
|
+
function useModal(selector) {
|
|
1638
|
+
const modal = useContext(ModalContext);
|
|
1639
|
+
if (!modal) {
|
|
1640
|
+
throw new Error("useModal must be used within a ModalProvider");
|
|
1641
|
+
}
|
|
1642
|
+
return useStore(modal, selector);
|
|
1643
|
+
}
|
|
1644
|
+
function ModalProvider({ children, defaultPage }) {
|
|
1645
|
+
const storeRef = useRef(
|
|
1646
|
+
create(() => ({
|
|
1647
|
+
active: null
|
|
1648
|
+
}))
|
|
1649
|
+
);
|
|
1650
|
+
return /* @__PURE__ */ jsxs(ModalContext.Provider, { value: storeRef.current, children: [
|
|
1651
|
+
/* @__PURE__ */ jsx(Modal, {}),
|
|
1652
|
+
children
|
|
1653
|
+
] });
|
|
1654
|
+
}
|
|
1655
|
+
function useModalActions() {
|
|
1656
|
+
const modal = useContext(ModalContext);
|
|
1657
|
+
if (!modal) throw new Error("useModalActions must be used within a ModalProvider");
|
|
1658
|
+
const showModal = (openModal) => {
|
|
1659
|
+
modal.setState({ active: openModal });
|
|
1660
|
+
};
|
|
2016
1661
|
const hideModal = () => {
|
|
2017
1662
|
modal.setState({ active: null });
|
|
2018
1663
|
};
|
|
@@ -2137,7 +1782,473 @@ function Modal() {
|
|
|
2137
1782
|
}
|
|
2138
1783
|
) });
|
|
2139
1784
|
}
|
|
1785
|
+
var useNuiEvent = (action, handler) => {
|
|
1786
|
+
const savedHandler = useRef(noop);
|
|
1787
|
+
useEffect(() => {
|
|
1788
|
+
savedHandler.current = handler;
|
|
1789
|
+
}, [handler]);
|
|
1790
|
+
useEffect(() => {
|
|
1791
|
+
const eventListener = (event) => {
|
|
1792
|
+
const { action: eventAction, data } = event.data;
|
|
1793
|
+
if (savedHandler.current) {
|
|
1794
|
+
if (eventAction === action) {
|
|
1795
|
+
savedHandler.current(data);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
};
|
|
1799
|
+
window.addEventListener("message", eventListener);
|
|
1800
|
+
return () => window.removeEventListener("message", eventListener);
|
|
1801
|
+
}, [action]);
|
|
1802
|
+
};
|
|
1803
|
+
function getNested(obj, path) {
|
|
1804
|
+
return path.split(".").reduce((acc, key) => acc ? acc[key] : void 0, obj);
|
|
1805
|
+
}
|
|
1806
|
+
function setNested(obj, path, value) {
|
|
1807
|
+
const keys = path.split(".");
|
|
1808
|
+
const newObj = { ...obj };
|
|
1809
|
+
let current = newObj;
|
|
1810
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
1811
|
+
const key = keys[i];
|
|
1812
|
+
current[key] = { ...current[key] || {} };
|
|
1813
|
+
current = current[key];
|
|
1814
|
+
}
|
|
1815
|
+
current[keys[keys.length - 1]] = value;
|
|
1816
|
+
return newObj;
|
|
1817
|
+
}
|
|
1818
|
+
function deleteNested(obj, path) {
|
|
1819
|
+
const keys = path.split(".");
|
|
1820
|
+
const newObj = { ...obj };
|
|
1821
|
+
let current = newObj;
|
|
1822
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
1823
|
+
const key = keys[i];
|
|
1824
|
+
if (!current[key]) return obj;
|
|
1825
|
+
current[key] = { ...current[key] };
|
|
1826
|
+
current = current[key];
|
|
1827
|
+
}
|
|
1828
|
+
delete current[keys[keys.length - 1]];
|
|
1829
|
+
return newObj;
|
|
1830
|
+
}
|
|
1831
|
+
function flattenRules(rules, prefix = "") {
|
|
1832
|
+
const result = {};
|
|
1833
|
+
for (const key in rules) {
|
|
1834
|
+
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
1835
|
+
const val = rules[key];
|
|
1836
|
+
if (typeof val === "function") result[fullPath] = val;
|
|
1837
|
+
else if (typeof val === "object")
|
|
1838
|
+
Object.assign(result, flattenRules(val, fullPath));
|
|
1839
|
+
}
|
|
1840
|
+
return result;
|
|
1841
|
+
}
|
|
1842
|
+
function createFormStore(initialValues, validationRules, onSubmit) {
|
|
1843
|
+
const flatRules = validationRules ? flattenRules(validationRules) : {};
|
|
1844
|
+
const history = [];
|
|
1845
|
+
const future = [];
|
|
1846
|
+
const changed = /* @__PURE__ */ new Set();
|
|
1847
|
+
return createStore((set, get) => ({
|
|
1848
|
+
initialValues,
|
|
1849
|
+
values: initialValues,
|
|
1850
|
+
errors: {},
|
|
1851
|
+
canBack: false,
|
|
1852
|
+
canForward: false,
|
|
1853
|
+
changedFields: [],
|
|
1854
|
+
changedCount: 0,
|
|
1855
|
+
onSubmit,
|
|
1856
|
+
submit: () => {
|
|
1857
|
+
const state = get();
|
|
1858
|
+
const isValid = state.validate();
|
|
1859
|
+
if (isValid && state.onSubmit) state.onSubmit(get());
|
|
1860
|
+
},
|
|
1861
|
+
resetChangeCount: () => {
|
|
1862
|
+
changed.clear();
|
|
1863
|
+
set(() => ({
|
|
1864
|
+
changedFields: [],
|
|
1865
|
+
changedCount: 0
|
|
1866
|
+
}));
|
|
1867
|
+
},
|
|
1868
|
+
setInitialValues: (newInitialValues) => set({ initialValues: newInitialValues }),
|
|
1869
|
+
setValue: (path, value) => {
|
|
1870
|
+
const currentValues = get().values;
|
|
1871
|
+
const newValues = setNested(currentValues, path, value);
|
|
1872
|
+
const oldValue = getNested(get().initialValues, path);
|
|
1873
|
+
history.push(currentValues);
|
|
1874
|
+
future.length = 0;
|
|
1875
|
+
if (value !== oldValue) changed.add(path);
|
|
1876
|
+
else changed.delete(path);
|
|
1877
|
+
set({
|
|
1878
|
+
values: newValues,
|
|
1879
|
+
canBack: history.length > 0,
|
|
1880
|
+
canForward: false,
|
|
1881
|
+
changedFields: Array.from(changed),
|
|
1882
|
+
changedCount: changed.size
|
|
1883
|
+
});
|
|
1884
|
+
const rule = flatRules[path];
|
|
1885
|
+
if (rule) {
|
|
1886
|
+
const error2 = rule(value, newValues);
|
|
1887
|
+
if (error2)
|
|
1888
|
+
set((state) => ({ errors: setNested(state.errors, path, error2) }));
|
|
1889
|
+
else set((state) => ({ errors: deleteNested(state.errors, path) }));
|
|
1890
|
+
}
|
|
1891
|
+
},
|
|
1892
|
+
setError: (path, message) => set((state) => ({ errors: setNested(state.errors, path, message) })),
|
|
1893
|
+
clearError: (path) => set((state) => ({ errors: deleteNested(state.errors, path) })),
|
|
1894
|
+
validateField: (path) => {
|
|
1895
|
+
const state = get();
|
|
1896
|
+
const rule = flatRules[path];
|
|
1897
|
+
if (!rule) return true;
|
|
1898
|
+
const value = getNested(state.values, path);
|
|
1899
|
+
const error2 = rule(value, state.values);
|
|
1900
|
+
if (error2) {
|
|
1901
|
+
set((state2) => ({ errors: setNested(state2.errors, path, error2) }));
|
|
1902
|
+
return false;
|
|
1903
|
+
} else {
|
|
1904
|
+
set((state2) => ({ errors: deleteNested(state2.errors, path) }));
|
|
1905
|
+
return true;
|
|
1906
|
+
}
|
|
1907
|
+
},
|
|
1908
|
+
validate: () => {
|
|
1909
|
+
const state = get();
|
|
1910
|
+
let isValid = true;
|
|
1911
|
+
let newErrors = {};
|
|
1912
|
+
for (const path in flatRules) {
|
|
1913
|
+
const rule = flatRules[path];
|
|
1914
|
+
const value = getNested(state.values, path);
|
|
1915
|
+
const error2 = rule(value, state.values);
|
|
1916
|
+
if (error2) {
|
|
1917
|
+
isValid = false;
|
|
1918
|
+
newErrors = setNested(newErrors, path, error2);
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
set({ errors: newErrors });
|
|
1922
|
+
return isValid;
|
|
1923
|
+
},
|
|
1924
|
+
reset: () => {
|
|
1925
|
+
history.length = 0;
|
|
1926
|
+
future.length = 0;
|
|
1927
|
+
changed.clear();
|
|
1928
|
+
set({
|
|
1929
|
+
values: initialValues,
|
|
1930
|
+
errors: {},
|
|
1931
|
+
canBack: false,
|
|
1932
|
+
canForward: false,
|
|
1933
|
+
changedFields: [],
|
|
1934
|
+
changedCount: 0
|
|
1935
|
+
});
|
|
1936
|
+
},
|
|
1937
|
+
back: () => {
|
|
1938
|
+
const state = get();
|
|
1939
|
+
if (history.length === 0) return;
|
|
1940
|
+
const prev = history.pop();
|
|
1941
|
+
future.push(state.values);
|
|
1942
|
+
changed.clear();
|
|
1943
|
+
const current = prev;
|
|
1944
|
+
const initial = get().initialValues;
|
|
1945
|
+
for (const key in current) {
|
|
1946
|
+
if (JSON.stringify(current[key]) !== JSON.stringify(initial[key]))
|
|
1947
|
+
changed.add(key);
|
|
1948
|
+
}
|
|
1949
|
+
set({
|
|
1950
|
+
values: prev,
|
|
1951
|
+
canBack: history.length > 0,
|
|
1952
|
+
canForward: true,
|
|
1953
|
+
changedFields: Array.from(changed),
|
|
1954
|
+
changedCount: changed.size
|
|
1955
|
+
});
|
|
1956
|
+
},
|
|
1957
|
+
forward: () => {
|
|
1958
|
+
const state = get();
|
|
1959
|
+
if (future.length === 0) return;
|
|
1960
|
+
const next = future.pop();
|
|
1961
|
+
history.push(state.values);
|
|
1962
|
+
changed.clear();
|
|
1963
|
+
const current = next;
|
|
1964
|
+
const initial = get().initialValues;
|
|
1965
|
+
for (const key in current) {
|
|
1966
|
+
if (JSON.stringify(current[key]) !== JSON.stringify(initial[key]))
|
|
1967
|
+
changed.add(key);
|
|
1968
|
+
}
|
|
1969
|
+
set({
|
|
1970
|
+
values: next,
|
|
1971
|
+
canBack: true,
|
|
1972
|
+
canForward: future.length > 0,
|
|
1973
|
+
changedFields: Array.from(changed),
|
|
1974
|
+
changedCount: changed.size
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1977
|
+
}));
|
|
1978
|
+
}
|
|
1979
|
+
var FormContext = createContext(null);
|
|
1980
|
+
function FormProvider({
|
|
1981
|
+
initialValues,
|
|
1982
|
+
validate,
|
|
1983
|
+
onSubmit,
|
|
1984
|
+
children
|
|
1985
|
+
}) {
|
|
1986
|
+
const storeRef = useRef(createFormStore(initialValues, validate, onSubmit));
|
|
1987
|
+
return /* @__PURE__ */ jsx(FormContext.Provider, { value: storeRef.current, children });
|
|
1988
|
+
}
|
|
1989
|
+
function useForm() {
|
|
1990
|
+
const store = useContext(FormContext);
|
|
1991
|
+
if (!store) throw new Error("useForm must be used inside a <FormProvider>");
|
|
1992
|
+
return useStore(store);
|
|
1993
|
+
}
|
|
1994
|
+
var label = {
|
|
1995
|
+
fontSize: "var(--mantine-font-size-xs)",
|
|
1996
|
+
fontFamily: "Akrobat Bold",
|
|
1997
|
+
letterSpacing: "0.05em",
|
|
1998
|
+
textTransform: "uppercase"
|
|
1999
|
+
};
|
|
2000
|
+
var error = {
|
|
2001
|
+
fontSize: "var(--mantine-font-size-xs)",
|
|
2002
|
+
fontFamily: "Akrobat Regular"
|
|
2003
|
+
};
|
|
2004
|
+
var theme = createTheme({
|
|
2005
|
+
primaryColor: "dirk",
|
|
2006
|
+
primaryShade: 9,
|
|
2007
|
+
defaultRadius: "xs",
|
|
2008
|
+
fontFamily: "Akrobat Regular, sans-serif",
|
|
2009
|
+
radius: {
|
|
2010
|
+
xxs: "0.2vh",
|
|
2011
|
+
xs: "0.4vh",
|
|
2012
|
+
sm: "0.75vh",
|
|
2013
|
+
md: "1vh",
|
|
2014
|
+
lg: "1.5vh",
|
|
2015
|
+
xl: "2vh",
|
|
2016
|
+
xxl: "3vh"
|
|
2017
|
+
},
|
|
2018
|
+
fontSizes: {
|
|
2019
|
+
xxs: "1.2vh",
|
|
2020
|
+
xs: "1.5vh",
|
|
2021
|
+
sm: "1.8vh",
|
|
2022
|
+
md: "2.2vh",
|
|
2023
|
+
lg: "2.8vh",
|
|
2024
|
+
xl: "3.3vh",
|
|
2025
|
+
xxl: "3.8vh"
|
|
2026
|
+
},
|
|
2027
|
+
lineHeights: {
|
|
2028
|
+
xxs: "1.4vh",
|
|
2029
|
+
xs: "1.8vh",
|
|
2030
|
+
sm: "2.2vh",
|
|
2031
|
+
md: "2.8vh",
|
|
2032
|
+
lg: "3.3vh",
|
|
2033
|
+
xl: "3.8vh"
|
|
2034
|
+
},
|
|
2035
|
+
spacing: {
|
|
2036
|
+
xxs: "0.5vh",
|
|
2037
|
+
xs: "0.75vh",
|
|
2038
|
+
sm: "1.5vh",
|
|
2039
|
+
md: "2vh",
|
|
2040
|
+
lg: "3vh",
|
|
2041
|
+
xl: "4vh",
|
|
2042
|
+
xxl: "5vh"
|
|
2043
|
+
},
|
|
2044
|
+
components: {
|
|
2045
|
+
Progress: {
|
|
2046
|
+
styles: {
|
|
2047
|
+
label: {
|
|
2048
|
+
fontFamily: "Akrobat Bold",
|
|
2049
|
+
letterSpacing: "0.05em",
|
|
2050
|
+
textTransform: "uppercase"
|
|
2051
|
+
},
|
|
2052
|
+
root: {
|
|
2053
|
+
backgroundColor: "rgba(77, 77, 77, 0.4)"
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
},
|
|
2057
|
+
Textarea: {
|
|
2058
|
+
styles: {
|
|
2059
|
+
label,
|
|
2060
|
+
error
|
|
2061
|
+
}
|
|
2062
|
+
},
|
|
2063
|
+
Button: {
|
|
2064
|
+
styles: {
|
|
2065
|
+
root: {
|
|
2066
|
+
fontSize: "var(--mantine-font-size-xs)"
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
},
|
|
2070
|
+
Select: {
|
|
2071
|
+
styles: {
|
|
2072
|
+
input: {
|
|
2073
|
+
padding: "var(--mantine-spacing-sm)"
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
},
|
|
2077
|
+
Pill: {
|
|
2078
|
+
styles: (theme2) => ({
|
|
2079
|
+
root: {
|
|
2080
|
+
display: "inline-flex",
|
|
2081
|
+
alignItems: "center",
|
|
2082
|
+
justifyContent: "space-between",
|
|
2083
|
+
backgroundColor: "rgba(76, 76, 76, 0.3)",
|
|
2084
|
+
height: "fit-content",
|
|
2085
|
+
textTransform: "uppercase",
|
|
2086
|
+
letterSpacing: "0.05em",
|
|
2087
|
+
fontFamily: "Akrobat Bold",
|
|
2088
|
+
fontSize: theme2.fontSizes.xs,
|
|
2089
|
+
borderRadius: theme2.defaultRadius,
|
|
2090
|
+
padding: `${theme2.spacing.xs} ${theme2.spacing.sm}`
|
|
2091
|
+
}
|
|
2092
|
+
})
|
|
2093
|
+
},
|
|
2094
|
+
Input: {
|
|
2095
|
+
styles: {
|
|
2096
|
+
label,
|
|
2097
|
+
error,
|
|
2098
|
+
input: {
|
|
2099
|
+
padding: "var(--mantine-spacing-sm)",
|
|
2100
|
+
backgroundColor: "rgba(76, 76, 76, 0.3)"
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
},
|
|
2104
|
+
ColorInput: {
|
|
2105
|
+
styles: {
|
|
2106
|
+
label,
|
|
2107
|
+
input: {
|
|
2108
|
+
padding: "var(--mantine-spacing-sm)"
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
},
|
|
2112
|
+
TextInput: {
|
|
2113
|
+
styles: {
|
|
2114
|
+
label,
|
|
2115
|
+
wrapper: {},
|
|
2116
|
+
section: {
|
|
2117
|
+
marginRight: "0.2vh"
|
|
2118
|
+
},
|
|
2119
|
+
input: {
|
|
2120
|
+
padding: "var(--mantine-spacing-sm)"
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
},
|
|
2124
|
+
NumberInput: {
|
|
2125
|
+
styles: {
|
|
2126
|
+
label,
|
|
2127
|
+
input: {
|
|
2128
|
+
padding: "var(--mantine-spacing-sm)"
|
|
2129
|
+
},
|
|
2130
|
+
section: {
|
|
2131
|
+
pointerEvents: "all"
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
},
|
|
2136
|
+
colors: {
|
|
2137
|
+
dirk: [
|
|
2138
|
+
"#ffffff",
|
|
2139
|
+
"#f3fce9",
|
|
2140
|
+
"#dbf5bd",
|
|
2141
|
+
"#c3ee91",
|
|
2142
|
+
"#ace765",
|
|
2143
|
+
"#94e039",
|
|
2144
|
+
"#7ac61f",
|
|
2145
|
+
"#5f9a18",
|
|
2146
|
+
"#29420a",
|
|
2147
|
+
"#446e11"
|
|
2148
|
+
]
|
|
2149
|
+
}
|
|
2150
|
+
});
|
|
2151
|
+
var theme_default = theme;
|
|
2152
|
+
library.add(fas, far, fab);
|
|
2153
|
+
var useSettings = create((set) => ({
|
|
2154
|
+
game: "fivem",
|
|
2155
|
+
primaryColor: "dirk",
|
|
2156
|
+
primaryShade: 9,
|
|
2157
|
+
itemImgPath: "https://assets.dirkcfx.com/items/",
|
|
2158
|
+
customTheme: {}
|
|
2159
|
+
}));
|
|
2160
|
+
function DirkProvider(props) {
|
|
2161
|
+
const primaryColor = useSettings((data) => data.primaryColor);
|
|
2162
|
+
const primaryShade = useSettings((data) => data.primaryShade);
|
|
2163
|
+
const customTheme = useSettings((data) => data.customTheme);
|
|
2164
|
+
const game = useSettings((data) => data.game);
|
|
2165
|
+
const mergedTheme = useMemo(() => ({
|
|
2166
|
+
...theme_default,
|
|
2167
|
+
primaryColor,
|
|
2168
|
+
primaryShade,
|
|
2169
|
+
colors: {
|
|
2170
|
+
...theme_default.colors,
|
|
2171
|
+
...customTheme
|
|
2172
|
+
// Custom theme colors will override/extend base colors
|
|
2173
|
+
}
|
|
2174
|
+
}), [primaryColor, primaryShade, customTheme]);
|
|
2175
|
+
useEffect(() => {
|
|
2176
|
+
document.fonts.ready.then(() => {
|
|
2177
|
+
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : game === "fivem" ? '"Akrobat Regular", sans-serif' : "sans-serif";
|
|
2178
|
+
console.log(`Game set to ${game}, applied corresponding font family.: ${document.body.style.fontFamily}`);
|
|
2179
|
+
});
|
|
2180
|
+
}, [game]);
|
|
2181
|
+
useEffect(() => {
|
|
2182
|
+
fetchNui("NUI_READY");
|
|
2183
|
+
}, []);
|
|
2184
|
+
useAutoFetcher();
|
|
2185
|
+
return /* @__PURE__ */ jsx(MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsx(Wrapper, { children: props.children }) });
|
|
2186
|
+
}
|
|
2187
|
+
function Wrapper({ children }) {
|
|
2188
|
+
const game = useSettings((data) => data.game);
|
|
2189
|
+
return isEnvBrowser() ? /* @__PURE__ */ jsx(
|
|
2190
|
+
BackgroundImage,
|
|
2191
|
+
{
|
|
2192
|
+
w: "100vw",
|
|
2193
|
+
h: "100vh",
|
|
2194
|
+
style: { overflow: "hidden" },
|
|
2195
|
+
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",
|
|
2196
|
+
children
|
|
2197
|
+
}
|
|
2198
|
+
) : /* @__PURE__ */ jsx(Fragment, { children });
|
|
2199
|
+
}
|
|
2200
|
+
function useTornEdges() {
|
|
2201
|
+
const game = useSettings((state) => state.game);
|
|
2202
|
+
return game === "rdr3" ? "torn-edge-wrapper" : "";
|
|
2203
|
+
}
|
|
2204
|
+
function TornEdgeSVGFilter() {
|
|
2205
|
+
return /* @__PURE__ */ jsx(
|
|
2206
|
+
"svg",
|
|
2207
|
+
{
|
|
2208
|
+
style: { position: "absolute", width: 0, height: 0, pointerEvents: "none" },
|
|
2209
|
+
"aria-hidden": "true",
|
|
2210
|
+
children: /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", { id: "torn-edge-filter", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
2211
|
+
/* @__PURE__ */ jsx(
|
|
2212
|
+
"feTurbulence",
|
|
2213
|
+
{
|
|
2214
|
+
type: "fractalNoise",
|
|
2215
|
+
baseFrequency: "0.018 0.022",
|
|
2216
|
+
numOctaves: "5",
|
|
2217
|
+
seed: "9",
|
|
2218
|
+
result: "noise1"
|
|
2219
|
+
}
|
|
2220
|
+
),
|
|
2221
|
+
/* @__PURE__ */ jsx(
|
|
2222
|
+
"feTurbulence",
|
|
2223
|
+
{
|
|
2224
|
+
type: "fractalNoise",
|
|
2225
|
+
baseFrequency: "0.08 0.12",
|
|
2226
|
+
numOctaves: "2",
|
|
2227
|
+
seed: "3",
|
|
2228
|
+
result: "noise2"
|
|
2229
|
+
}
|
|
2230
|
+
),
|
|
2231
|
+
/* @__PURE__ */ jsx("feBlend", { in: "noise1", in2: "noise2", mode: "multiply", result: "combinedNoise" }),
|
|
2232
|
+
/* @__PURE__ */ jsx(
|
|
2233
|
+
"feDisplacementMap",
|
|
2234
|
+
{
|
|
2235
|
+
in: "SourceGraphic",
|
|
2236
|
+
in2: "combinedNoise",
|
|
2237
|
+
scale: "52",
|
|
2238
|
+
xChannelSelector: "R",
|
|
2239
|
+
yChannelSelector: "G",
|
|
2240
|
+
result: "displaced"
|
|
2241
|
+
}
|
|
2242
|
+
),
|
|
2243
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "0.8", in: "displaced", result: "blurred" }),
|
|
2244
|
+
/* @__PURE__ */ jsx("feComponentTransfer", { in: "blurred", result: "alphaFade", children: /* @__PURE__ */ jsx("feFuncA", { type: "gamma", amplitude: "1", exponent: "1.3", offset: "-0.05" }) }),
|
|
2245
|
+
/* @__PURE__ */ jsx("feMorphology", { operator: "erode", radius: "0.4", in: "alphaFade", result: "eroded" }),
|
|
2246
|
+
/* @__PURE__ */ jsx("feMerge", { children: /* @__PURE__ */ jsx("feMergeNode", { in: "eroded" }) })
|
|
2247
|
+
] }) })
|
|
2248
|
+
}
|
|
2249
|
+
);
|
|
2250
|
+
}
|
|
2140
2251
|
|
|
2141
|
-
export { BorderedIcon, Counter, DirkProvider, FloatingParticles, FormProvider, InfoBox, InputContainer, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, SegmentedControl, SegmentedProgress, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createFormStore, createSkill, fetchNui, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, useAutoFetcher, useForm, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
|
|
2252
|
+
export { BorderedIcon, Counter, DirkProvider, FloatingParticles, FormProvider, InfoBox, InputContainer, LevelBanner, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, SegmentedControl, SegmentedProgress, Title, TornEdgeSVGFilter, colorWithAlpha, copyToClipboard, createFormStore, createSkill, fetchNui, getImageShape, initialFetches, internalEvent, isEnvBrowser, isProfanity, locale, localeStore, noop, numberToRoman, openLink, registerInitialFetch, runFetches, splitFAString, updatePresignedURL, uploadImage, useAutoFetcher, useForm, useModal, useModalActions, useNavigation, useNavigationStore, useNuiEvent, useProfanityStore, useSettings, useTornEdges };
|
|
2142
2253
|
//# sourceMappingURL=index.js.map
|
|
2143
2254
|
//# sourceMappingURL=index.js.map
|