dirk-cfx-react 1.1.2 → 1.1.6
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 +1413 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +699 -0
- package/dist/components/index.d.ts +699 -0
- package/dist/components/index.js +1383 -0
- package/dist/components/index.js.map +1 -0
- package/dist/hooks/index.cjs +348 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +71 -0
- package/dist/hooks/index.d.ts +71 -0
- package/dist/hooks/index.js +340 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +178 -139
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -886
- package/dist/index.d.ts +10 -886
- package/dist/index.js +157 -119
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +315 -0
- package/dist/providers/index.cjs.map +1 -0
- package/dist/providers/index.d.cts +9 -0
- package/dist/providers/index.d.ts +9 -0
- package/dist/providers/index.js +309 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/utils/index.cjs +844 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +120 -0
- package/dist/utils/index.d.ts +120 -0
- package/dist/utils/index.js +813 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React3 = require('react');
|
|
4
4
|
var zustand = require('zustand');
|
|
5
5
|
var axios = require('axios');
|
|
6
6
|
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
@@ -23,10 +23,15 @@ var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
|
23
23
|
|
|
24
24
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
25
|
|
|
26
|
+
var React3__default = /*#__PURE__*/_interopDefault(React3);
|
|
26
27
|
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
27
28
|
var clickSoundUrl__default = /*#__PURE__*/_interopDefault(clickSoundUrl);
|
|
28
29
|
var hoverSoundUrl__default = /*#__PURE__*/_interopDefault(hoverSoundUrl);
|
|
29
30
|
|
|
31
|
+
var __defProp = Object.defineProperty;
|
|
32
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
33
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
|
|
34
|
+
|
|
30
35
|
// src/utils/colorWithAlpha.ts
|
|
31
36
|
var colorNames = {
|
|
32
37
|
AliceBlue: { r: 240, g: 248, b: 255 },
|
|
@@ -259,7 +264,7 @@ async function runFetches() {
|
|
|
259
264
|
);
|
|
260
265
|
}
|
|
261
266
|
var useAutoFetcher = () => {
|
|
262
|
-
|
|
267
|
+
React3.useEffect(() => {
|
|
263
268
|
if (isEnvBrowser()) return;
|
|
264
269
|
const run = async () => {
|
|
265
270
|
await runFetches();
|
|
@@ -734,7 +739,7 @@ function createSkill(defaultSettings) {
|
|
|
734
739
|
}));
|
|
735
740
|
const useSkill = (xp) => {
|
|
736
741
|
const { settings, levelMap } = useStore4();
|
|
737
|
-
return
|
|
742
|
+
return React3.useMemo(() => {
|
|
738
743
|
const currentLevel = getLevelFromXP(xp, levelMap, settings);
|
|
739
744
|
const nextLevel = Math.min(currentLevel + 1, settings.maxLevel);
|
|
740
745
|
const currentLevelXP = levelMap[currentLevel.toString()] || 0;
|
|
@@ -805,6 +810,33 @@ async function getImageShape(file) {
|
|
|
805
810
|
img.src = typeof file === "string" ? file : URL.createObjectURL(file);
|
|
806
811
|
});
|
|
807
812
|
}
|
|
813
|
+
var useSettings = zustand.create(() => ({
|
|
814
|
+
hydrated: false,
|
|
815
|
+
game: "fivem",
|
|
816
|
+
primaryColor: "dirk",
|
|
817
|
+
primaryShade: 9,
|
|
818
|
+
itemImgPath: "",
|
|
819
|
+
customTheme: [
|
|
820
|
+
"#f0f4ff",
|
|
821
|
+
"#d9e3ff",
|
|
822
|
+
"#bfcfff",
|
|
823
|
+
"#a6bbff",
|
|
824
|
+
"#8ca7ff",
|
|
825
|
+
"#7393ff",
|
|
826
|
+
"#5a7fff",
|
|
827
|
+
"#406bff",
|
|
828
|
+
"#2547ff",
|
|
829
|
+
"#0b33ff"
|
|
830
|
+
]
|
|
831
|
+
}));
|
|
832
|
+
registerInitialFetch("GET_SETTINGS").then((data) => {
|
|
833
|
+
useSettings.setState({
|
|
834
|
+
...data,
|
|
835
|
+
hydrated: true
|
|
836
|
+
});
|
|
837
|
+
}).catch(() => {
|
|
838
|
+
useSettings.setState({ hydrated: true });
|
|
839
|
+
});
|
|
808
840
|
function BorderedIcon(props) {
|
|
809
841
|
const theme2 = core.useMantineTheme();
|
|
810
842
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -868,8 +900,8 @@ var FloatingParticles = ({
|
|
|
868
900
|
mouseRepelStrength = 50,
|
|
869
901
|
backgroundColor = "transparent"
|
|
870
902
|
}) => {
|
|
871
|
-
const containerRef =
|
|
872
|
-
const [particles, setParticles] =
|
|
903
|
+
const containerRef = React3.useRef(null);
|
|
904
|
+
const [particles, setParticles] = React3.useState([]);
|
|
873
905
|
const mouseX = framerMotion.useMotionValue(0);
|
|
874
906
|
const mouseY = framerMotion.useMotionValue(0);
|
|
875
907
|
const durationMap = {
|
|
@@ -882,7 +914,7 @@ var FloatingParticles = ({
|
|
|
882
914
|
const x = Math.sin(seed) * 1e4;
|
|
883
915
|
return x - Math.floor(x);
|
|
884
916
|
};
|
|
885
|
-
|
|
917
|
+
React3.useEffect(() => {
|
|
886
918
|
if (!containerRef.current) return;
|
|
887
919
|
const bounds = containerRef.current.getBoundingClientRect();
|
|
888
920
|
const newParticles = [...Array(particleCount)].map((_, i) => {
|
|
@@ -903,7 +935,7 @@ var FloatingParticles = ({
|
|
|
903
935
|
});
|
|
904
936
|
setParticles(newParticles);
|
|
905
937
|
}, [particleCount, icons.length, duration.base, duration.variance]);
|
|
906
|
-
|
|
938
|
+
React3.useEffect(() => {
|
|
907
939
|
if (!containerRef.current) return;
|
|
908
940
|
const handleMouseMove = (e) => {
|
|
909
941
|
const bounds = containerRef.current.getBoundingClientRect();
|
|
@@ -952,7 +984,7 @@ var FloatingParticles = ({
|
|
|
952
984
|
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
953
985
|
};
|
|
954
986
|
}, [mouseX, mouseY, mouseRepelDistance, mouseRepelStrength]);
|
|
955
|
-
|
|
987
|
+
React3.useEffect(() => {
|
|
956
988
|
const handleResize = () => {
|
|
957
989
|
if (!containerRef.current) return;
|
|
958
990
|
const bounds = containerRef.current.getBoundingClientRect();
|
|
@@ -1380,23 +1412,23 @@ function Segment(props) {
|
|
|
1380
1412
|
}
|
|
1381
1413
|
);
|
|
1382
1414
|
}
|
|
1383
|
-
var NavigationContext =
|
|
1415
|
+
var NavigationContext = React3.createContext(null);
|
|
1384
1416
|
function useNavigation(selector) {
|
|
1385
|
-
const navigation =
|
|
1417
|
+
const navigation = React3.useContext(NavigationContext);
|
|
1386
1418
|
if (!navigation) {
|
|
1387
1419
|
throw new Error("useNavigation must be used within a NavigationProvider");
|
|
1388
1420
|
}
|
|
1389
1421
|
return zustand.useStore(navigation, selector);
|
|
1390
1422
|
}
|
|
1391
1423
|
function useNavigationStore() {
|
|
1392
|
-
const navigation =
|
|
1424
|
+
const navigation = React3.useContext(NavigationContext);
|
|
1393
1425
|
if (!navigation) {
|
|
1394
1426
|
throw new Error("useNavigationStore must be used within a NavigationProvider");
|
|
1395
1427
|
}
|
|
1396
1428
|
return navigation;
|
|
1397
1429
|
}
|
|
1398
1430
|
function NavigationProvider({ children, defaultPage }) {
|
|
1399
|
-
const storeRef =
|
|
1431
|
+
const storeRef = React3.useRef(
|
|
1400
1432
|
zustand.create(() => ({
|
|
1401
1433
|
pageId: defaultPage || "home"
|
|
1402
1434
|
}))
|
|
@@ -1738,16 +1770,16 @@ function LevelPanel(props) {
|
|
|
1738
1770
|
}
|
|
1739
1771
|
);
|
|
1740
1772
|
}
|
|
1741
|
-
var ModalContext =
|
|
1773
|
+
var ModalContext = React3.createContext(null);
|
|
1742
1774
|
function useModal(selector) {
|
|
1743
|
-
const modal =
|
|
1775
|
+
const modal = React3.useContext(ModalContext);
|
|
1744
1776
|
if (!modal) {
|
|
1745
1777
|
throw new Error("useModal must be used within a ModalProvider");
|
|
1746
1778
|
}
|
|
1747
1779
|
return zustand.useStore(modal, selector);
|
|
1748
1780
|
}
|
|
1749
1781
|
function ModalProvider({ children, defaultPage }) {
|
|
1750
|
-
const storeRef =
|
|
1782
|
+
const storeRef = React3.useRef(
|
|
1751
1783
|
zustand.create(() => ({
|
|
1752
1784
|
active: null
|
|
1753
1785
|
}))
|
|
@@ -1758,7 +1790,7 @@ function ModalProvider({ children, defaultPage }) {
|
|
|
1758
1790
|
] });
|
|
1759
1791
|
}
|
|
1760
1792
|
function useModalActions() {
|
|
1761
|
-
const modal =
|
|
1793
|
+
const modal = React3.useContext(ModalContext);
|
|
1762
1794
|
if (!modal) throw new Error("useModalActions must be used within a ModalProvider");
|
|
1763
1795
|
const showModal = (openModal) => {
|
|
1764
1796
|
modal.setState({ active: openModal });
|
|
@@ -1935,11 +1967,11 @@ function PromptModal(props) {
|
|
|
1935
1967
|
);
|
|
1936
1968
|
}
|
|
1937
1969
|
var useNuiEvent = (action, handler) => {
|
|
1938
|
-
const savedHandler =
|
|
1939
|
-
|
|
1970
|
+
const savedHandler = React3.useRef(noop);
|
|
1971
|
+
React3.useEffect(() => {
|
|
1940
1972
|
savedHandler.current = handler;
|
|
1941
1973
|
}, [handler]);
|
|
1942
|
-
|
|
1974
|
+
React3.useEffect(() => {
|
|
1943
1975
|
const eventListener = (event) => {
|
|
1944
1976
|
const { action: eventAction, data } = event.data;
|
|
1945
1977
|
if (savedHandler.current) {
|
|
@@ -2128,21 +2160,85 @@ function createFormStore(initialValues, validationRules, onSubmit) {
|
|
|
2128
2160
|
}
|
|
2129
2161
|
}));
|
|
2130
2162
|
}
|
|
2131
|
-
var FormContext =
|
|
2163
|
+
var FormContext = React3.createContext(null);
|
|
2132
2164
|
function FormProvider({
|
|
2133
2165
|
initialValues,
|
|
2134
2166
|
validate,
|
|
2135
2167
|
onSubmit,
|
|
2136
2168
|
children
|
|
2137
2169
|
}) {
|
|
2138
|
-
const storeRef =
|
|
2170
|
+
const storeRef = React3.useRef(createFormStore(initialValues, validate, onSubmit));
|
|
2139
2171
|
return /* @__PURE__ */ jsxRuntime.jsx(FormContext.Provider, { value: storeRef.current, children });
|
|
2140
2172
|
}
|
|
2141
2173
|
function useForm() {
|
|
2142
|
-
const store =
|
|
2174
|
+
const store = React3.useContext(FormContext);
|
|
2143
2175
|
if (!store) throw new Error("useForm must be used inside a <FormProvider>");
|
|
2144
2176
|
return zustand.useStore(store);
|
|
2145
2177
|
}
|
|
2178
|
+
function useTornEdges() {
|
|
2179
|
+
const game = useSettings((state) => state.game);
|
|
2180
|
+
return game === "rdr3" ? "torn-edge-wrapper" : "";
|
|
2181
|
+
}
|
|
2182
|
+
function TornEdgeSVGFilter() {
|
|
2183
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2184
|
+
"svg",
|
|
2185
|
+
{
|
|
2186
|
+
style: { position: "absolute", width: 0, height: 0, pointerEvents: "none" },
|
|
2187
|
+
"aria-hidden": "true",
|
|
2188
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: "torn-edge-filter", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
2189
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2190
|
+
"feTurbulence",
|
|
2191
|
+
{
|
|
2192
|
+
type: "fractalNoise",
|
|
2193
|
+
baseFrequency: "0.018 0.022",
|
|
2194
|
+
numOctaves: "5",
|
|
2195
|
+
seed: "9",
|
|
2196
|
+
result: "noise1"
|
|
2197
|
+
}
|
|
2198
|
+
),
|
|
2199
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2200
|
+
"feTurbulence",
|
|
2201
|
+
{
|
|
2202
|
+
type: "fractalNoise",
|
|
2203
|
+
baseFrequency: "0.08 0.12",
|
|
2204
|
+
numOctaves: "2",
|
|
2205
|
+
seed: "3",
|
|
2206
|
+
result: "noise2"
|
|
2207
|
+
}
|
|
2208
|
+
),
|
|
2209
|
+
/* @__PURE__ */ jsxRuntime.jsx("feBlend", { in: "noise1", in2: "noise2", mode: "multiply", result: "combinedNoise" }),
|
|
2210
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2211
|
+
"feDisplacementMap",
|
|
2212
|
+
{
|
|
2213
|
+
in: "SourceGraphic",
|
|
2214
|
+
in2: "combinedNoise",
|
|
2215
|
+
scale: "52",
|
|
2216
|
+
xChannelSelector: "R",
|
|
2217
|
+
yChannelSelector: "G",
|
|
2218
|
+
result: "displaced"
|
|
2219
|
+
}
|
|
2220
|
+
),
|
|
2221
|
+
/* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { stdDeviation: "0.8", in: "displaced", result: "blurred" }),
|
|
2222
|
+
/* @__PURE__ */ jsxRuntime.jsx("feComponentTransfer", { in: "blurred", result: "alphaFade", children: /* @__PURE__ */ jsxRuntime.jsx("feFuncA", { type: "gamma", amplitude: "1", exponent: "1.3", offset: "-0.05" }) }),
|
|
2223
|
+
/* @__PURE__ */ jsxRuntime.jsx("feMorphology", { operator: "erode", radius: "0.4", in: "alphaFade", result: "eroded" }),
|
|
2224
|
+
/* @__PURE__ */ jsxRuntime.jsx("feMerge", { children: /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "eroded" }) })
|
|
2225
|
+
] }) })
|
|
2226
|
+
}
|
|
2227
|
+
);
|
|
2228
|
+
}
|
|
2229
|
+
function createScriptSettings(defaultValue) {
|
|
2230
|
+
const store = zustand.create(() => defaultValue);
|
|
2231
|
+
const useScriptSettingHooks = () => {
|
|
2232
|
+
useNuiEvent("UPDATE_SCRIPT_SETTINGS", (newSettings) => {
|
|
2233
|
+
store.setState((prev) => ({ ...prev, ...newSettings }));
|
|
2234
|
+
});
|
|
2235
|
+
};
|
|
2236
|
+
const updateScriptSettings = async (newSettings) => {
|
|
2237
|
+
store.setState((prev) => ({ ...prev, ...newSettings }));
|
|
2238
|
+
return await fetchNui("UPDATE_SCRIPT_SETTINGS", newSettings);
|
|
2239
|
+
};
|
|
2240
|
+
return { store, updateScriptSettings, useScriptSettingHooks };
|
|
2241
|
+
}
|
|
2146
2242
|
var label = {
|
|
2147
2243
|
fontSize: "var(--mantine-font-size-xs)",
|
|
2148
2244
|
fontFamily: "Akrobat Bold",
|
|
@@ -2302,134 +2398,77 @@ var theme = core.createTheme({
|
|
|
2302
2398
|
}
|
|
2303
2399
|
});
|
|
2304
2400
|
var theme_default = theme;
|
|
2401
|
+
|
|
2402
|
+
// src/utils/mergeMantineTheme.ts
|
|
2403
|
+
var isValidColorScale = (v) => Array.isArray(v) && v.length === 10 && v.every((shade) => typeof shade === "string");
|
|
2404
|
+
function mergeMantineThemeSafe(base, custom, override) {
|
|
2405
|
+
const colors = { ...base.colors };
|
|
2406
|
+
if (custom && isValidColorScale(custom)) {
|
|
2407
|
+
colors["custom"] = custom;
|
|
2408
|
+
}
|
|
2409
|
+
return {
|
|
2410
|
+
...base,
|
|
2411
|
+
...override,
|
|
2412
|
+
colors: {
|
|
2413
|
+
...colors,
|
|
2414
|
+
...override?.colors ?? {}
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2417
|
+
}
|
|
2418
|
+
var DirkErrorBoundary = class extends React3__default.default.Component {
|
|
2419
|
+
constructor() {
|
|
2420
|
+
super(...arguments);
|
|
2421
|
+
__publicField(this, "state", { error: null });
|
|
2422
|
+
}
|
|
2423
|
+
static getDerivedStateFromError(error2) {
|
|
2424
|
+
return { error: error2 };
|
|
2425
|
+
}
|
|
2426
|
+
componentDidCatch(error2, info) {
|
|
2427
|
+
console.group("\u{1F525} Dirk UI Crash");
|
|
2428
|
+
console.error(error2);
|
|
2429
|
+
console.error(info.componentStack);
|
|
2430
|
+
console.groupEnd();
|
|
2431
|
+
}
|
|
2432
|
+
render() {
|
|
2433
|
+
if (!this.state.error) return this.props.children;
|
|
2434
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Box, { p: "md", bg: "dark.8", children: [
|
|
2435
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { c: "red", fw: 600, children: "UI crashed" }),
|
|
2436
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Code, { block: true, mt: "sm", children: this.state.error.message })
|
|
2437
|
+
] });
|
|
2438
|
+
}
|
|
2439
|
+
};
|
|
2305
2440
|
fontawesomeSvgCore.library.add(freeSolidSvgIcons.fas, freeRegularSvgIcons.far, freeBrandsSvgIcons.fab);
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
primaryShade: 9,
|
|
2310
|
-
itemImgPath: "https://assets.dirkcfx.com/items/",
|
|
2311
|
-
customTheme: {}
|
|
2312
|
-
}));
|
|
2313
|
-
registerInitialFetch("GET_SETTINGS", void 0, {
|
|
2314
|
-
game: "fivem",
|
|
2315
|
-
primaryColor: "dirk",
|
|
2316
|
-
primaryShade: 9,
|
|
2317
|
-
itemImgPath: "https://assets.dirkcfx.com/items/",
|
|
2318
|
-
customTheme: {}
|
|
2319
|
-
}).then((data) => {
|
|
2320
|
-
console.log("Fetched initial settings:");
|
|
2321
|
-
useSettings.setState({
|
|
2322
|
-
...data
|
|
2323
|
-
});
|
|
2324
|
-
});
|
|
2325
|
-
function DirkProvider(props) {
|
|
2326
|
-
const primaryColor = useSettings((data) => data.primaryColor);
|
|
2327
|
-
const primaryShade = useSettings((data) => data.primaryShade);
|
|
2328
|
-
const customTheme = useSettings((data) => data.customTheme);
|
|
2329
|
-
const game = useSettings((data) => data.game);
|
|
2330
|
-
const mergedTheme = react.useMemo(() => ({
|
|
2331
|
-
...theme_default,
|
|
2441
|
+
function DirkProvider({ children, themeOverride }) {
|
|
2442
|
+
const {
|
|
2443
|
+
hydrated,
|
|
2332
2444
|
primaryColor,
|
|
2333
2445
|
primaryShade,
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2446
|
+
customTheme,
|
|
2447
|
+
game
|
|
2448
|
+
} = useSettings();
|
|
2449
|
+
if (!hydrated) return null;
|
|
2450
|
+
const mergedTheme = React3.useMemo(
|
|
2451
|
+
() => mergeMantineThemeSafe(
|
|
2452
|
+
{ ...theme_default, primaryColor, primaryShade },
|
|
2453
|
+
customTheme,
|
|
2454
|
+
themeOverride
|
|
2455
|
+
),
|
|
2456
|
+
[primaryColor, primaryShade, customTheme, themeOverride]
|
|
2457
|
+
);
|
|
2458
|
+
React3.useEffect(() => {
|
|
2459
|
+
document.body.style.fontFamily = game === "rdr3" ? '"Red Dead", sans-serif' : '"Akrobat Regular", sans-serif';
|
|
2460
|
+
console.log(`%cNew Font Applied: ${document.body.style.fontFamily}`, "font-family: " + document.body.style.fontFamily);
|
|
2348
2461
|
}, [game]);
|
|
2349
|
-
|
|
2350
|
-
fetchNui("NUI_READY");
|
|
2351
|
-
}, []);
|
|
2352
|
-
useAutoFetcher();
|
|
2353
|
-
console.log("DirkProvider rendered with game:", game);
|
|
2354
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core.MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: props.children }) });
|
|
2355
|
-
}
|
|
2356
|
-
function Wrapper({ children }) {
|
|
2357
|
-
const game = useSettings((data) => data.game);
|
|
2358
|
-
if (!isEnvBrowser()) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
2359
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2462
|
+
const content = isEnvBrowser() ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2360
2463
|
core.BackgroundImage,
|
|
2361
2464
|
{
|
|
2362
2465
|
w: "100vw",
|
|
2363
2466
|
h: "100vh",
|
|
2364
|
-
style: { overflow: "hidden", backgroundColor: "transparent" },
|
|
2365
2467
|
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",
|
|
2366
2468
|
children
|
|
2367
2469
|
}
|
|
2368
|
-
);
|
|
2369
|
-
}
|
|
2370
|
-
function useTornEdges() {
|
|
2371
|
-
const game = useSettings((state) => state.game);
|
|
2372
|
-
return game === "rdr3" ? "torn-edge-wrapper" : "";
|
|
2373
|
-
}
|
|
2374
|
-
function TornEdgeSVGFilter() {
|
|
2375
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2376
|
-
"svg",
|
|
2377
|
-
{
|
|
2378
|
-
style: { position: "absolute", width: 0, height: 0, pointerEvents: "none" },
|
|
2379
|
-
"aria-hidden": "true",
|
|
2380
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: "torn-edge-filter", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
2381
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2382
|
-
"feTurbulence",
|
|
2383
|
-
{
|
|
2384
|
-
type: "fractalNoise",
|
|
2385
|
-
baseFrequency: "0.018 0.022",
|
|
2386
|
-
numOctaves: "5",
|
|
2387
|
-
seed: "9",
|
|
2388
|
-
result: "noise1"
|
|
2389
|
-
}
|
|
2390
|
-
),
|
|
2391
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2392
|
-
"feTurbulence",
|
|
2393
|
-
{
|
|
2394
|
-
type: "fractalNoise",
|
|
2395
|
-
baseFrequency: "0.08 0.12",
|
|
2396
|
-
numOctaves: "2",
|
|
2397
|
-
seed: "3",
|
|
2398
|
-
result: "noise2"
|
|
2399
|
-
}
|
|
2400
|
-
),
|
|
2401
|
-
/* @__PURE__ */ jsxRuntime.jsx("feBlend", { in: "noise1", in2: "noise2", mode: "multiply", result: "combinedNoise" }),
|
|
2402
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2403
|
-
"feDisplacementMap",
|
|
2404
|
-
{
|
|
2405
|
-
in: "SourceGraphic",
|
|
2406
|
-
in2: "combinedNoise",
|
|
2407
|
-
scale: "52",
|
|
2408
|
-
xChannelSelector: "R",
|
|
2409
|
-
yChannelSelector: "G",
|
|
2410
|
-
result: "displaced"
|
|
2411
|
-
}
|
|
2412
|
-
),
|
|
2413
|
-
/* @__PURE__ */ jsxRuntime.jsx("feGaussianBlur", { stdDeviation: "0.8", in: "displaced", result: "blurred" }),
|
|
2414
|
-
/* @__PURE__ */ jsxRuntime.jsx("feComponentTransfer", { in: "blurred", result: "alphaFade", children: /* @__PURE__ */ jsxRuntime.jsx("feFuncA", { type: "gamma", amplitude: "1", exponent: "1.3", offset: "-0.05" }) }),
|
|
2415
|
-
/* @__PURE__ */ jsxRuntime.jsx("feMorphology", { operator: "erode", radius: "0.4", in: "alphaFade", result: "eroded" }),
|
|
2416
|
-
/* @__PURE__ */ jsxRuntime.jsx("feMerge", { children: /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "eroded" }) })
|
|
2417
|
-
] }) })
|
|
2418
|
-
}
|
|
2419
|
-
);
|
|
2420
|
-
}
|
|
2421
|
-
function createScriptSettings(defaultValue) {
|
|
2422
|
-
const store = zustand.create(() => defaultValue);
|
|
2423
|
-
const useScriptSettingHooks = () => {
|
|
2424
|
-
useNuiEvent("UPDATE_SCRIPT_SETTINGS", (newSettings) => {
|
|
2425
|
-
store.setState((prev) => ({ ...prev, ...newSettings }));
|
|
2426
|
-
});
|
|
2427
|
-
};
|
|
2428
|
-
const updateScriptSettings = async (newSettings) => {
|
|
2429
|
-
store.setState((prev) => ({ ...prev, ...newSettings }));
|
|
2430
|
-
return await fetchNui("UPDATE_SCRIPT_SETTINGS", newSettings);
|
|
2431
|
-
};
|
|
2432
|
-
return { store, updateScriptSettings, useScriptSettingHooks };
|
|
2470
|
+
) : children;
|
|
2471
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DirkErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(core.MantineProvider, { theme: mergedTheme, defaultColorScheme: "dark", children: content }) });
|
|
2433
2472
|
}
|
|
2434
2473
|
|
|
2435
2474
|
exports.BorderedIcon = BorderedIcon;
|