dirk-cfx-react 1.0.0

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.
@@ -0,0 +1,1000 @@
1
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
2
+ import { Flex, Text, Image, useMantineTheme } from '@mantine/core';
3
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
4
+ import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
5
+ import { createContext, useRef, useState, useEffect, useContext } from 'react';
6
+ import { create, useStore } from 'zustand';
7
+
8
+ // src/components/BorderedIcon.tsx
9
+
10
+ // src/utils/colorWithAlpha.ts
11
+ var colorNames = {
12
+ AliceBlue: { r: 240, g: 248, b: 255 },
13
+ AntiqueWhite: { r: 250, g: 235, b: 215 },
14
+ Aqua: { r: 0, g: 255, b: 255 },
15
+ Aquamarine: { r: 127, g: 255, b: 212 },
16
+ Azure: { r: 240, g: 255, b: 255 },
17
+ Beige: { r: 245, g: 245, b: 220 },
18
+ Bisque: { r: 255, g: 228, b: 196 },
19
+ Black: { r: 0, g: 0, b: 0 },
20
+ BlanchedAlmond: { r: 255, g: 235, b: 205 },
21
+ Blue: { r: 0, g: 0, b: 255 },
22
+ BlueViolet: { r: 138, g: 43, b: 226 },
23
+ Brown: { r: 165, g: 42, b: 42 },
24
+ BurlyWood: { r: 222, g: 184, b: 135 },
25
+ CadetBlue: { r: 95, g: 158, b: 160 },
26
+ Chartreuse: { r: 127, g: 255, b: 0 },
27
+ Chocolate: { r: 210, g: 105, b: 30 },
28
+ Coral: { r: 255, g: 127, b: 80 },
29
+ CornflowerBlue: { r: 100, g: 149, b: 237 },
30
+ Cornsilk: { r: 255, g: 248, b: 220 },
31
+ Crimson: { r: 220, g: 20, b: 60 },
32
+ Cyan: { r: 0, g: 255, b: 255 },
33
+ DarkBlue: { r: 0, g: 0, b: 139 },
34
+ DarkCyan: { r: 0, g: 139, b: 139 },
35
+ DarkGoldenRod: { r: 184, g: 134, b: 11 },
36
+ DarkGray: { r: 169, g: 169, b: 169 },
37
+ DarkGreen: { r: 0, g: 100, b: 0 },
38
+ DarkKhaki: { r: 189, g: 183, b: 107 },
39
+ DarkMagenta: { r: 139, g: 0, b: 139 },
40
+ DarkOliveGreen: { r: 85, g: 107, b: 47 },
41
+ DarkOrange: { r: 255, g: 140, b: 0 },
42
+ DarkOrchid: { r: 153, g: 50, b: 204 },
43
+ DarkRed: { r: 139, g: 0, b: 0 },
44
+ DarkSalmon: { r: 233, g: 150, b: 122 },
45
+ DarkSeaGreen: { r: 143, g: 188, b: 143 },
46
+ DarkSlateBlue: { r: 72, g: 61, b: 139 },
47
+ DarkSlateGray: { r: 47, g: 79, b: 79 },
48
+ DarkTurquoise: { r: 0, g: 206, b: 209 },
49
+ DarkViolet: { r: 148, g: 0, b: 211 },
50
+ DeepPink: { r: 255, g: 20, b: 147 },
51
+ DeepSkyBlue: { r: 0, g: 191, b: 255 },
52
+ DimGray: { r: 105, g: 105, b: 105 },
53
+ DodgerBlue: { r: 30, g: 144, b: 255 },
54
+ FireBrick: { r: 178, g: 34, b: 34 },
55
+ FloralWhite: { r: 255, g: 250, b: 240 },
56
+ ForestGreen: { r: 34, g: 139, b: 34 },
57
+ Fuchsia: { r: 255, g: 0, b: 255 },
58
+ Gainsboro: { r: 220, g: 220, b: 220 },
59
+ GhostWhite: { r: 248, g: 248, b: 255 },
60
+ Gold: { r: 255, g: 215, b: 0 },
61
+ GoldenRod: { r: 218, g: 165, b: 32 },
62
+ Gray: { r: 128, g: 128, b: 128 },
63
+ Green: { r: 0, g: 128, b: 0 },
64
+ GreenYellow: { r: 173, g: 255, b: 47 },
65
+ HoneyDew: { r: 240, g: 255, b: 240 },
66
+ HotPink: { r: 255, g: 105, b: 180 },
67
+ IndianRed: { r: 205, g: 92, b: 92 },
68
+ Indigo: { r: 75, g: 0, b: 130 },
69
+ Ivory: { r: 255, g: 255, b: 240 },
70
+ Khaki: { r: 240, g: 230, b: 140 },
71
+ Lavender: { r: 230, g: 230, b: 250 },
72
+ LavenderBlush: { r: 255, g: 240, b: 245 },
73
+ LawnGreen: { r: 124, g: 252, b: 0 },
74
+ LemonChiffon: { r: 255, g: 250, b: 205 },
75
+ LightBlue: { r: 173, g: 216, b: 230 },
76
+ LightCoral: { r: 240, g: 128, b: 128 },
77
+ LightCyan: { r: 224, g: 255, b: 255 },
78
+ LightGoldenRodYellow: { r: 250, g: 250, b: 210 },
79
+ LightGray: { r: 211, g: 211, b: 211 },
80
+ LightGreen: { r: 144, g: 238, b: 144 },
81
+ LightPink: { r: 255, g: 182, b: 193 },
82
+ LightSalmon: { r: 255, g: 160, b: 122 },
83
+ LightSeaGreen: { r: 32, g: 178, b: 170 },
84
+ LightSkyBlue: { r: 135, g: 206, b: 250 },
85
+ LightSlateGray: { r: 119, g: 136, b: 153 },
86
+ LightSteelBlue: { r: 176, g: 196, b: 222 },
87
+ LightYellow: { r: 255, g: 255, b: 224 },
88
+ Lime: { r: 0, g: 255, b: 0 },
89
+ LimeGreen: { r: 50, g: 205, b: 50 },
90
+ Linen: { r: 250, g: 240, b: 230 },
91
+ Magenta: { r: 255, g: 0, b: 255 },
92
+ Maroon: { r: 128, g: 0, b: 0 },
93
+ // Maroon
94
+ MediumAquaMarine: { r: 102, g: 205, b: 170 },
95
+ MediumBlue: { r: 0, g: 0, b: 205 },
96
+ MediumOrchid: { r: 186, g: 85, b: 211 },
97
+ MediumPurple: { r: 147, g: 112, b: 219 },
98
+ MediumSeaGreen: { r: 60, g: 179, b: 113 },
99
+ MediumSlateBlue: { r: 123, g: 104, b: 238 },
100
+ MediumSpringGreen: { r: 0, g: 250, b: 154 },
101
+ MediumTurquoise: { r: 72, g: 209, b: 204 },
102
+ MediumVioletRed: { r: 199, g: 21, b: 133 },
103
+ MidnightBlue: { r: 25, g: 25, b: 112 },
104
+ MintCream: { r: 245, g: 255, b: 250 },
105
+ MistyRose: { r: 255, g: 228, b: 225 },
106
+ Moccasin: { r: 255, g: 228, b: 181 },
107
+ NavajoWhite: { r: 255, g: 222, b: 173 },
108
+ Navy: { r: 0, g: 0, b: 128 },
109
+ OldLace: { r: 253, g: 245, b: 230 },
110
+ Olive: { r: 128, g: 128, b: 0 },
111
+ OliveDrab: { r: 107, g: 142, b: 35 },
112
+ Orange: { r: 255, g: 165, b: 0 },
113
+ OrangeRed: { r: 255, g: 69, b: 0 },
114
+ Orchid: { r: 218, g: 112, b: 214 },
115
+ PaleGoldenRod: { r: 238, g: 232, b: 170 },
116
+ PaleGreen: { r: 152, g: 251, b: 152 },
117
+ PaleTurquoise: { r: 175, g: 238, b: 238 },
118
+ PaleVioletRed: { r: 219, g: 112, b: 147 },
119
+ PapayaWhip: { r: 255, g: 239, b: 213 },
120
+ PeachPuff: { r: 255, g: 218, b: 185 },
121
+ Peru: { r: 205, g: 133, b: 63 },
122
+ Pink: { r: 255, g: 192, b: 203 },
123
+ Plum: { r: 221, g: 160, b: 221 },
124
+ PowderBlue: { r: 176, g: 224, b: 230 },
125
+ Purple: { r: 128, g: 0, b: 128 },
126
+ RebeccaPurple: { r: 102, g: 51, b: 153 },
127
+ Red: { r: 255, g: 0, b: 0 },
128
+ RosyBrown: { r: 188, g: 143, b: 143 },
129
+ RoyalBlue: { r: 65, g: 105, b: 225 },
130
+ SaddleBrown: { r: 139, g: 69, b: 19 },
131
+ Salmon: { r: 250, g: 128, b: 114 },
132
+ SandyBrown: { r: 244, g: 164, b: 96 },
133
+ SeaGreen: { r: 46, g: 139, b: 87 },
134
+ SeaShell: { r: 255, g: 245, b: 238 },
135
+ Sienna: { r: 160, g: 82, b: 45 },
136
+ Silver: { r: 192, g: 192, b: 192 },
137
+ SkyBlue: { r: 135, g: 206, b: 235 },
138
+ SlateBlue: { r: 106, g: 90, b: 205 },
139
+ SlateGray: { r: 112, g: 128, b: 144 },
140
+ Snow: { r: 255, g: 250, b: 250 },
141
+ SpringGreen: { r: 0, g: 255, b: 127 },
142
+ SteelBlue: { r: 70, g: 130, b: 180 },
143
+ Tan: { r: 210, g: 180, b: 140 },
144
+ Teal: { r: 0, g: 128, b: 128 },
145
+ Thistle: { r: 216, g: 191, b: 216 },
146
+ Tomato: { r: 255, g: 99, b: 71 },
147
+ Turquoise: { r: 64, g: 224, b: 208 },
148
+ Violet: { r: 238, g: 130, b: 238 },
149
+ Wheat: { r: 245, g: 222, b: 179 },
150
+ White: { r: 255, g: 255, b: 255 },
151
+ WhiteSmoke: { r: 245, g: 245, b: 245 },
152
+ Yellow: { r: 255, g: 255, b: 0 },
153
+ YellowGreen: { r: 154, g: 205, b: 50 }
154
+ };
155
+ function colorWithAlpha(color, alpha) {
156
+ const lowerCasedColor = color.toLowerCase();
157
+ if (colorNames[lowerCasedColor]) {
158
+ const rgb = colorNames[lowerCasedColor];
159
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha})`;
160
+ }
161
+ if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
162
+ const hex = color.slice(1);
163
+ const bigint = parseInt(hex, 16);
164
+ const r = bigint >> 16 & 255;
165
+ const g = bigint >> 8 & 255;
166
+ const b = bigint & 255;
167
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
168
+ }
169
+ if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
170
+ const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
171
+ if (result) {
172
+ return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha})`;
173
+ }
174
+ }
175
+ return color;
176
+ }
177
+ function BorderedIcon(props) {
178
+ const theme = useMantineTheme();
179
+ return /* @__PURE__ */ jsx(
180
+ FontAwesomeIcon,
181
+ {
182
+ icon: props.icon,
183
+ color: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][theme.primaryShade], props.hovered ? 0.9 : 0.9),
184
+ style: {
185
+ // backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
186
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
187
+ padding: props.p || theme.spacing.xs,
188
+ transition: "all 0.2s ease-in-out",
189
+ aspectRatio: "1/1",
190
+ fontSize: props.fontSize ? props.fontSize : "2.5vh",
191
+ borderRadius: theme.radius.xs,
192
+ // border: `2px solid var(--mantine-primary-color-9)`,
193
+ outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][9], 0.8)}`,
194
+ boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7], 0.5)}`
195
+ }
196
+ }
197
+ );
198
+ }
199
+ var MotionFlex = motion(Flex);
200
+ var MotionText = motion(Text);
201
+ var MotionIcon = motion(FontAwesomeIcon);
202
+ var MotionImage = motion(Image);
203
+ function Counter(props) {
204
+ return /* @__PURE__ */ jsx(AnimatePresence, { children: props.count > 0 && /* @__PURE__ */ jsx(
205
+ MotionFlex,
206
+ {
207
+ initial: { opacity: 0 },
208
+ animate: { opacity: 1 },
209
+ exit: { opacity: 0 },
210
+ fz: "1.25vh",
211
+ h: "1.75vh",
212
+ justify: "center",
213
+ align: "center",
214
+ bg: props.color || "rgba(0, 0, 0, 0.51)",
215
+ style: {
216
+ borderRadius: "50%",
217
+ aspectRatio: "1/1",
218
+ marginBottom: "0.3vh",
219
+ fontFamily: "Akrobat Bold",
220
+ boxShadow: "0 0 5px rgba(0, 0, 0, 0.3)"
221
+ },
222
+ children: props.count
223
+ },
224
+ "counter"
225
+ ) });
226
+ }
227
+ var FloatingParticles = ({
228
+ icons = [],
229
+ particleCount = 55,
230
+ color = "#00a552ff",
231
+ size = 32,
232
+ speed = "slow",
233
+ opacity = 0.3,
234
+ style = {},
235
+ mouseRepelDistance = 150,
236
+ mouseRepelStrength = 50,
237
+ backgroundColor = "transparent"
238
+ }) => {
239
+ const containerRef = useRef(null);
240
+ const [particles, setParticles] = useState([]);
241
+ const mouseX = useMotionValue(0);
242
+ const mouseY = useMotionValue(0);
243
+ const durationMap = {
244
+ slow: { base: 10, variance: 10 },
245
+ medium: { base: 2, variance: 2 },
246
+ fast: { base: 4, variance: 2 }
247
+ };
248
+ const duration = durationMap[speed];
249
+ const seededRandom = (seed) => {
250
+ const x = Math.sin(seed) * 1e4;
251
+ return x - Math.floor(x);
252
+ };
253
+ useEffect(() => {
254
+ if (!containerRef.current) return;
255
+ const bounds = containerRef.current.getBoundingClientRect();
256
+ const newParticles = [...Array(particleCount)].map((_, i) => {
257
+ const seedX = i * 123.456;
258
+ const seedY = i * 789.012;
259
+ const seedDuration = i * 345.678;
260
+ const baseX = seededRandom(seedX) * bounds.width;
261
+ const baseY = seededRandom(seedY) * bounds.height;
262
+ return {
263
+ id: i,
264
+ baseX,
265
+ baseY,
266
+ currentX: baseX,
267
+ currentY: baseY,
268
+ icon: icons.length > 0 ? icons[i % icons.length] : null,
269
+ animationDuration: duration.base + seededRandom(seedDuration) * duration.variance
270
+ };
271
+ });
272
+ setParticles(newParticles);
273
+ }, [particleCount, icons.length, duration.base, duration.variance]);
274
+ useEffect(() => {
275
+ if (!containerRef.current) return;
276
+ const handleMouseMove = (e) => {
277
+ const bounds = containerRef.current.getBoundingClientRect();
278
+ const x = e.clientX - bounds.left;
279
+ const y = e.clientY - bounds.top;
280
+ mouseX.set(x);
281
+ mouseY.set(y);
282
+ setParticles(
283
+ (prevParticles) => prevParticles.map((particle) => {
284
+ const dx = x - particle.baseX;
285
+ const dy = y - particle.baseY;
286
+ const distance = Math.sqrt(dx * dx + dy * dy);
287
+ if (distance < mouseRepelDistance && distance > 0) {
288
+ const force = (mouseRepelDistance - distance) / mouseRepelDistance;
289
+ const repelX = dx / distance * force * mouseRepelStrength * -1;
290
+ const repelY = dy / distance * force * mouseRepelStrength * -1;
291
+ return {
292
+ ...particle,
293
+ currentX: particle.baseX + repelX,
294
+ currentY: particle.baseY + repelY
295
+ };
296
+ } else {
297
+ return {
298
+ ...particle,
299
+ currentX: particle.baseX,
300
+ currentY: particle.baseY
301
+ };
302
+ }
303
+ })
304
+ );
305
+ };
306
+ const handleMouseLeave = () => {
307
+ setParticles(
308
+ (prevParticles) => prevParticles.map((particle) => ({
309
+ ...particle,
310
+ currentX: particle.baseX,
311
+ currentY: particle.baseY
312
+ }))
313
+ );
314
+ };
315
+ const container = containerRef.current;
316
+ container.addEventListener("mousemove", handleMouseMove);
317
+ container.addEventListener("mouseleave", handleMouseLeave);
318
+ return () => {
319
+ container.removeEventListener("mousemove", handleMouseMove);
320
+ container.removeEventListener("mouseleave", handleMouseLeave);
321
+ };
322
+ }, [mouseX, mouseY, mouseRepelDistance, mouseRepelStrength]);
323
+ useEffect(() => {
324
+ const handleResize = () => {
325
+ if (!containerRef.current) return;
326
+ const bounds = containerRef.current.getBoundingClientRect();
327
+ setParticles(
328
+ (prevParticles) => prevParticles.map((particle, i) => {
329
+ const seedX = i * 123.456 + bounds.width;
330
+ const seedY = i * 789.012 + bounds.height;
331
+ const newBaseX = seededRandom(seedX) * bounds.width;
332
+ const newBaseY = seededRandom(seedY) * bounds.height;
333
+ return {
334
+ ...particle,
335
+ baseX: newBaseX,
336
+ baseY: newBaseY,
337
+ currentX: newBaseX,
338
+ currentY: newBaseY
339
+ };
340
+ })
341
+ );
342
+ };
343
+ window.addEventListener("resize", handleResize);
344
+ return () => window.removeEventListener("resize", handleResize);
345
+ }, []);
346
+ return /* @__PURE__ */ jsx(
347
+ "div",
348
+ {
349
+ ref: containerRef,
350
+ style: {
351
+ position: "absolute",
352
+ overflow: "hidden",
353
+ width: "100%",
354
+ height: "100%",
355
+ zIndex: -1,
356
+ backgroundColor,
357
+ ...style
358
+ },
359
+ children: /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: particles.map((particle) => /* @__PURE__ */ jsx(
360
+ motion.div,
361
+ {
362
+ style: {
363
+ position: "absolute",
364
+ width: size,
365
+ height: size,
366
+ color,
367
+ opacity,
368
+ left: 0,
369
+ top: 0
370
+ },
371
+ animate: {
372
+ x: particle.currentX,
373
+ y: particle.currentY,
374
+ scale: [0.8, 1.1, 0.8],
375
+ opacity: [opacity * 0.5, opacity, opacity * 0.5],
376
+ // random rotate between 0 and 360 so that not all particles rotate the same
377
+ rotate: particle.id % 2 === 0 ? [0, 360] : [360, 0]
378
+ },
379
+ transition: {
380
+ x: { type: "spring", stiffness: 150, damping: 20 },
381
+ y: { type: "spring", stiffness: 150, damping: 20 },
382
+ rotate: {
383
+ duration: particle.animationDuration,
384
+ repeat: Infinity,
385
+ ease: "linear"
386
+ },
387
+ scale: {
388
+ duration: particle.animationDuration,
389
+ repeat: Infinity,
390
+ delay: seededRandom(particle.id * 111.222) * 5,
391
+ ease: "easeInOut"
392
+ },
393
+ opacity: {
394
+ duration: particle.animationDuration,
395
+ repeat: Infinity,
396
+ delay: seededRandom(particle.id * 333.444) * 5,
397
+ ease: "easeInOut"
398
+ }
399
+ },
400
+ children: particle.icon ? /* @__PURE__ */ jsx("div", { style: { width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx(FontAwesomeIcon, { icon: particle.icon, style: { width: "70%", height: "70%" } }) }) : /* @__PURE__ */ jsx(
401
+ "div",
402
+ {
403
+ style: {
404
+ width: "100%",
405
+ height: "100%",
406
+ borderRadius: "50%",
407
+ backgroundColor: color
408
+ }
409
+ }
410
+ )
411
+ },
412
+ particle.id
413
+ )) })
414
+ }
415
+ );
416
+ };
417
+ function Icon(props) {
418
+ return /* @__PURE__ */ jsx(Fragment, {});
419
+ }
420
+ function InfoBox(props) {
421
+ const theme = useMantineTheme();
422
+ return /* @__PURE__ */ jsxs(
423
+ Flex,
424
+ {
425
+ w: "fit-content",
426
+ h: "fit-content",
427
+ style: {
428
+ borderRadius: theme.radius.xs,
429
+ overflow: "hidden",
430
+ border: `0.2vh solid rgba(77,77,77,0.3)`
431
+ },
432
+ align: "center",
433
+ children: [
434
+ /* @__PURE__ */ jsx(
435
+ Flex,
436
+ {
437
+ miw: "4vh",
438
+ p: "xxs",
439
+ bg: "rgba(77,77,77,0.2)",
440
+ direction: "column",
441
+ justify: "center",
442
+ align: "center",
443
+ children: /* @__PURE__ */ jsx(
444
+ Text,
445
+ {
446
+ c: "lightgrey",
447
+ size: "xxs",
448
+ style: {
449
+ fontFamily: "Akrobat Bold",
450
+ letterSpacing: "0.05em",
451
+ textTransform: "uppercase"
452
+ },
453
+ children: props.leftSide
454
+ }
455
+ )
456
+ }
457
+ ),
458
+ /* @__PURE__ */ jsx(
459
+ Flex,
460
+ {
461
+ p: "xxs",
462
+ flex: 1,
463
+ miw: "4vh",
464
+ bg: "rgba(77,77,77,0.5)",
465
+ direction: "column",
466
+ align: "center",
467
+ justify: "center",
468
+ children: /* @__PURE__ */ jsx(
469
+ Text,
470
+ {
471
+ c: "lightgrey",
472
+ size: "xxs",
473
+ style: {
474
+ fontFamily: "Akrobat Bold",
475
+ letterSpacing: "0.05em",
476
+ textTransform: "uppercase"
477
+ },
478
+ children: props.rightSide
479
+ }
480
+ )
481
+ }
482
+ )
483
+ ]
484
+ }
485
+ );
486
+ }
487
+ function InputContainer(props) {
488
+ const theme = useMantineTheme();
489
+ return /* @__PURE__ */ jsxs(
490
+ MotionFlex,
491
+ {
492
+ w: props.w || "100%",
493
+ flex: props.flex,
494
+ direction: "column",
495
+ h: props.h,
496
+ gap: props.title ? "xs" : 0,
497
+ bg: props.bg || "rgba(69, 69, 69, 0.42)",
498
+ p: "sm",
499
+ style: {
500
+ borderRadius: theme.radius.xs,
501
+ boxShadow: theme.shadows.sm,
502
+ overflow: "hidden",
503
+ outline: props.error ? `1px solid rgba(255, 100, 100, 0.8)` : "none"
504
+ },
505
+ variants: props.variants,
506
+ children: [
507
+ /* @__PURE__ */ jsxs(
508
+ Flex,
509
+ {
510
+ align: "center",
511
+ gap: "xs",
512
+ children: [
513
+ /* @__PURE__ */ jsxs(
514
+ Flex,
515
+ {
516
+ direction: "column",
517
+ gap: "xxs",
518
+ children: [
519
+ props.title && /* @__PURE__ */ jsx(
520
+ Text,
521
+ {
522
+ size: "sm",
523
+ style: {
524
+ lineHeight: "1.25vh",
525
+ fontFamily: "Akrobat Bold",
526
+ letterSpacing: "0.05em",
527
+ textTransform: "uppercase"
528
+ },
529
+ children: props.title
530
+ }
531
+ ),
532
+ props.description && /* @__PURE__ */ jsx(
533
+ Text,
534
+ {
535
+ size: "xs",
536
+ c: "rgba(255, 255, 255, 0.8)",
537
+ fw: 400,
538
+ children: props.description
539
+ }
540
+ )
541
+ ]
542
+ }
543
+ ),
544
+ props.error && /* @__PURE__ */ jsx(
545
+ Text,
546
+ {
547
+ size: "xs",
548
+ c: theme.colors.red[9],
549
+ fw: 600,
550
+ mb: "auto",
551
+ lh: "0.8",
552
+ children: props.error
553
+ }
554
+ ),
555
+ /* @__PURE__ */ jsx(
556
+ Flex,
557
+ {
558
+ ml: "auto",
559
+ children: props.rightSection
560
+ }
561
+ )
562
+ ]
563
+ }
564
+ ),
565
+ props.children
566
+ ]
567
+ }
568
+ );
569
+ }
570
+
571
+ // src/hooks/useAudio/click_sound.mp3
572
+ var click_sound_default = "../click_sound-PNCRRTM4.mp3";
573
+
574
+ // src/hooks/useAudio/hover_sound.mp3
575
+ var hover_sound_default = "../hover_sound-NBUA222C.mp3";
576
+
577
+ // src/hooks/useAudio/store.ts
578
+ var useAudio = create(() => {
579
+ const audioRefs = {};
580
+ const sounds = {
581
+ click: click_sound_default,
582
+ hover: hover_sound_default
583
+ };
584
+ for (const [key, src] of Object.entries(sounds)) {
585
+ audioRefs[key] = new Audio(src);
586
+ }
587
+ return {
588
+ play: (sound) => {
589
+ const audio = audioRefs[sound];
590
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
591
+ audio.currentTime = 0;
592
+ audio.volume = 0.1;
593
+ audio.play();
594
+ },
595
+ stop: (sound) => {
596
+ const audio = audioRefs[sound];
597
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
598
+ audio.pause();
599
+ audio.currentTime = 0;
600
+ }
601
+ };
602
+ });
603
+
604
+ // src/utils/misc.ts
605
+ var isEnvBrowser = () => !window.invokeNative;
606
+
607
+ // src/utils/fetchNui.ts
608
+ async function fetchNui(eventName, data, mockData) {
609
+ const options = {
610
+ method: "post",
611
+ headers: {
612
+ "Content-Type": "application/json; charset=UTF-8"
613
+ },
614
+ body: JSON.stringify(data)
615
+ };
616
+ console.log("Mock Data:", mockData);
617
+ console.log("Is Env Browser:", isEnvBrowser());
618
+ const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
619
+ const resp = await fetch(`https://${resourceName}/${eventName}`, options);
620
+ const respFormatted = await resp.json();
621
+ return respFormatted;
622
+ }
623
+ function fetchOnLoad(eventName, data, mockData) {
624
+ return fetchNui(eventName, data, mockData).catch((err) => {
625
+ console.error(`[fetchOnLoad] Failed for ${eventName}:`, err);
626
+ throw err;
627
+ });
628
+ }
629
+ var localeStore = create((set, get) => {
630
+ return {
631
+ locales: {
632
+ "OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant."
633
+ },
634
+ locale: (key, ...args) => {
635
+ const exists = get().locales[key];
636
+ let translation = exists || key;
637
+ if (args.length) {
638
+ translation = translation.replace(/%s/g, () => String(args.shift() || ""));
639
+ }
640
+ return translation;
641
+ }
642
+ };
643
+ });
644
+ localeStore.getState().locale;
645
+ fetchOnLoad("GET_LOCALES").then((data) => {
646
+ localeStore.setState({ locales: data });
647
+ });
648
+ function SegmentedControl(props) {
649
+ const theme = useMantineTheme();
650
+ const play = useAudio((state) => state.play);
651
+ const handleChange = (newValue) => {
652
+ if (props.sounds) play("click");
653
+ if (props.onChange) {
654
+ props.onChange(newValue);
655
+ }
656
+ };
657
+ return /* @__PURE__ */ jsx(
658
+ Flex,
659
+ {
660
+ bg: "rgba(33, 33, 33, 0.6)",
661
+ w: props.w || "fit-content",
662
+ style: {
663
+ borderRadius: theme.radius.xs,
664
+ overflow: "hidden"
665
+ },
666
+ ...props,
667
+ children: props.items.map((item, index) => /* @__PURE__ */ jsx(
668
+ motion.div,
669
+ {
670
+ initial: { x: -100, opacity: 0 },
671
+ animate: { x: 0, opacity: 1 },
672
+ transition: { duration: 0.3, delay: index * 0.1, ease: "easeInOut" },
673
+ style: {
674
+ display: "flex",
675
+ flexDirection: "row",
676
+ alignItems: "center",
677
+ flex: 1
678
+ },
679
+ children: /* @__PURE__ */ jsx(
680
+ Segment,
681
+ {
682
+ label: item.label,
683
+ value: item.value,
684
+ icon: item.icon,
685
+ rightSection: item.rightSection,
686
+ fz: props.fz,
687
+ selected: !props.multi ? props.value === item.value : Array.isArray(props.value) && props.value.includes(item.value),
688
+ onClick: () => {
689
+ if (props.multi) {
690
+ const newValue = Array.isArray(props.value) ? props.value.includes(item.value) ? props.value.filter((v) => v !== item.value) : [...props.value, item.value] : [item.value];
691
+ handleChange(newValue);
692
+ } else {
693
+ handleChange(item.value);
694
+ }
695
+ }
696
+ },
697
+ item.value
698
+ )
699
+ },
700
+ index
701
+ ))
702
+ }
703
+ );
704
+ }
705
+ function Segment(props) {
706
+ const theme = useMantineTheme();
707
+ return /* @__PURE__ */ jsxs(
708
+ MotionFlex,
709
+ {
710
+ onClick: props.onClick,
711
+ w: "100%",
712
+ direction: "column",
713
+ align: "center",
714
+ h: "100%",
715
+ bg: props.selected ? colorWithAlpha(theme.colors[theme.primaryColor][theme.primaryShade], 0.2) : "transparent",
716
+ pos: "relative",
717
+ style: {
718
+ // position: "relative",
719
+ cursor: "pointer"
720
+ },
721
+ justify: "center",
722
+ whileHover: { scale: 1.05 },
723
+ whileTap: { scale: 0.95 },
724
+ children: [
725
+ /* @__PURE__ */ jsxs(
726
+ Flex,
727
+ {
728
+ align: "center",
729
+ gap: "xs",
730
+ p: "xs",
731
+ children: [
732
+ props.icon && /* @__PURE__ */ jsx(
733
+ MotionIcon,
734
+ {
735
+ icon: props.icon,
736
+ initial: {
737
+ color: props.selected ? theme.colors[theme.primaryColor][5] : "inherit"
738
+ },
739
+ animate: {
740
+ color: props.selected ? theme.colors[theme.primaryColor][5] : "inherit"
741
+ },
742
+ exit: {
743
+ color: "inherit"
744
+ },
745
+ style: {
746
+ fontSize: theme.fontSizes.xs,
747
+ marginBottom: "0.2vh"
748
+ }
749
+ }
750
+ ),
751
+ /* @__PURE__ */ jsx(
752
+ MotionText,
753
+ {
754
+ size: props.fz || "xs",
755
+ initial: {
756
+ color: props.selected ? theme.colors[theme.primaryColor][5] : "inherit"
757
+ },
758
+ animate: {
759
+ color: props.selected ? theme.colors[theme.primaryColor][5] : "inherit"
760
+ },
761
+ exit: {
762
+ color: "inherit"
763
+ },
764
+ style: {
765
+ fontFamily: "Akrobat Bold",
766
+ letterSpacing: "0.1em",
767
+ textTransform: "uppercase"
768
+ },
769
+ children: props.label.toUpperCase()
770
+ }
771
+ ),
772
+ props.rightSection
773
+ ]
774
+ }
775
+ ),
776
+ /* @__PURE__ */ jsx(
777
+ motion.div,
778
+ {
779
+ initial: false,
780
+ animate: {
781
+ scaleX: props.selected ? 1 : 0,
782
+ opacity: props.selected ? 1 : 0
783
+ },
784
+ transition: {
785
+ duration: 0.3,
786
+ ease: [0.4, 0, 0.2, 1]
787
+ // Custom easing curve for smooth feel
788
+ },
789
+ style: {
790
+ position: "absolute",
791
+ bottom: 0,
792
+ left: 0,
793
+ right: 0,
794
+ height: "0.2vh",
795
+ backgroundColor: theme.colors[theme.primaryColor][5],
796
+ transformOrigin: "center"
797
+ }
798
+ }
799
+ )
800
+ ]
801
+ }
802
+ );
803
+ }
804
+ var NavigationContext = createContext(null);
805
+ function useNavigation(selector) {
806
+ const navigation = useContext(NavigationContext);
807
+ if (!navigation) {
808
+ throw new Error("useNavigation must be used within a NavigationProvider");
809
+ }
810
+ return useStore(navigation, selector);
811
+ }
812
+ function useNavigationStore() {
813
+ const navigation = useContext(NavigationContext);
814
+ if (!navigation) {
815
+ throw new Error("useNavigationStore must be used within a NavigationProvider");
816
+ }
817
+ return navigation;
818
+ }
819
+ function NavigationProvider({ children, defaultPage }) {
820
+ const storeRef = useRef(
821
+ create(() => ({
822
+ pageId: defaultPage || "home"
823
+ }))
824
+ );
825
+ return /* @__PURE__ */ jsx(NavigationContext.Provider, { value: storeRef.current, children });
826
+ }
827
+ function NavBar(props) {
828
+ const pageId = useNavigation((state) => state.pageId);
829
+ const store = useNavigationStore();
830
+ return /* @__PURE__ */ jsx(
831
+ SegmentedControl,
832
+ {
833
+ sounds: true,
834
+ w: "100%",
835
+ value: pageId,
836
+ items: props.items,
837
+ onChange: (value) => {
838
+ store.setState({ pageId: value });
839
+ }
840
+ }
841
+ );
842
+ }
843
+ var containerVariants = {
844
+ hidden: { opacity: 0 },
845
+ visible: {
846
+ opacity: 1,
847
+ transition: {
848
+ staggerChildren: 0.1,
849
+ delayChildren: 0.05
850
+ }
851
+ },
852
+ exit: {
853
+ opacity: 0,
854
+ transition: {
855
+ staggerChildren: 0.05,
856
+ staggerDirection: -1
857
+ }
858
+ }
859
+ };
860
+ var itemVariants = {
861
+ hidden: {
862
+ opacity: 0,
863
+ x: 20,
864
+ scale: 0.95
865
+ },
866
+ visible: {
867
+ opacity: 1,
868
+ x: 0,
869
+ scale: 1,
870
+ transition: {
871
+ type: "spring",
872
+ stiffness: 300,
873
+ damping: 24
874
+ }
875
+ },
876
+ exit: {
877
+ opacity: 0,
878
+ x: -10,
879
+ scale: 0.95,
880
+ transition: {
881
+ duration: 0.2
882
+ }
883
+ }
884
+ };
885
+ function SegmentedProgress(props) {
886
+ const progressPerSegment = 100 / props.segments;
887
+ const filledSegments = Math.floor(props.progress / progressPerSegment);
888
+ const partialFill = props.progress % progressPerSegment / progressPerSegment;
889
+ return /* @__PURE__ */ jsx(
890
+ MotionFlex,
891
+ {
892
+ w: "100%",
893
+ h: props.size || "1vh",
894
+ gap: "xs",
895
+ initial: "hidden",
896
+ animate: "visible",
897
+ variants: containerVariants,
898
+ children: [...Array(props.segments)].map((_, index) => {
899
+ const isFilled = index < filledSegments;
900
+ const isPartial = index === filledSegments;
901
+ return /* @__PURE__ */ jsx(
902
+ motion.div,
903
+ {
904
+ variants: itemVariants,
905
+ style: {
906
+ width: `${100 / props.segments}%`,
907
+ // Ensures equal width distribution
908
+ height: "100%",
909
+ background: isFilled ? "rgba(255, 255, 255, 0.8)" : isPartial ? `linear-gradient(to right, rgba(255, 255, 255, 0.8) ${partialFill * 100}%, rgba(255, 255, 255, 0.2) ${partialFill * 100}%)` : "rgba(255, 255, 255, 0.2)",
910
+ transition: "background 0.3s ease"
911
+ }
912
+ },
913
+ index
914
+ );
915
+ })
916
+ }
917
+ );
918
+ }
919
+ function Title(props) {
920
+ const theme = useMantineTheme();
921
+ return /* @__PURE__ */ jsx(
922
+ Flex,
923
+ {
924
+ mt: props.mt,
925
+ direction: "column",
926
+ bg: props.bg || "transparent",
927
+ gap: "xs",
928
+ w: props.w || "100%",
929
+ p: props.p || "0",
930
+ style: {
931
+ userSelect: "none",
932
+ borderBottom: props.removeBorder ? "none" : `0.2vh solid ${props.borderColor || colorWithAlpha(theme.colors[theme.primaryColor][9], 0.5)}`
933
+ },
934
+ children: /* @__PURE__ */ jsxs(
935
+ Flex,
936
+ {
937
+ align: "center",
938
+ justify: "center",
939
+ children: [
940
+ /* @__PURE__ */ jsxs(
941
+ Flex,
942
+ {
943
+ align: "center",
944
+ gap: "sm",
945
+ pr: "xs",
946
+ children: [
947
+ /* @__PURE__ */ jsx(
948
+ BorderedIcon,
949
+ {
950
+ icon: props.icon,
951
+ fontSize: theme.fontSizes.md,
952
+ color: props.iconColor
953
+ }
954
+ ),
955
+ /* @__PURE__ */ jsxs(
956
+ Flex,
957
+ {
958
+ direction: "column",
959
+ gap: "0.25vh",
960
+ children: [
961
+ /* @__PURE__ */ jsx(Text, { p: "0", size: "sm", style: {
962
+ lineHeight: theme.fontSizes.md,
963
+ fontFamily: "Akrobat Bold",
964
+ letterSpacing: "0.05em",
965
+ textTransform: "uppercase"
966
+ }, children: props.title }),
967
+ /* @__PURE__ */ jsx(
968
+ Text,
969
+ {
970
+ size: "xs",
971
+ c: "grey",
972
+ style: { whiteSpace: "normal", wordWrap: "break-word" },
973
+ children: props.description
974
+ }
975
+ )
976
+ ]
977
+ }
978
+ )
979
+ ]
980
+ }
981
+ ),
982
+ /* @__PURE__ */ jsx(
983
+ Flex,
984
+ {
985
+ ml: "auto",
986
+ align: "center",
987
+ gap: "xs",
988
+ children: props.rightSection
989
+ }
990
+ )
991
+ ]
992
+ }
993
+ )
994
+ }
995
+ );
996
+ }
997
+
998
+ export { BorderedIcon, Counter, FloatingParticles, Icon, InfoBox, InputContainer, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, Segment, SegmentedControl, SegmentedProgress, Title, useNavigation, useNavigationStore };
999
+ //# sourceMappingURL=index.mjs.map
1000
+ //# sourceMappingURL=index.mjs.map