pelatform-ui 1.1.21 → 1.2.1
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/README.md +60 -42
- package/css/animations.css +48 -0
- package/css/shadcn/gray.css +105 -0
- package/css/shadcn/neutral.css +105 -0
- package/css/shadcn/slate.css +105 -0
- package/css/shadcn/stone.css +105 -0
- package/css/shadcn/zinc.css +105 -0
- package/css/styles/style-lyra.css +1335 -0
- package/css/styles/style-maia.css +1360 -0
- package/css/styles/style-mira.css +1362 -0
- package/css/styles/style-nova.css +1360 -0
- package/css/styles/style-vega.css +1356 -0
- package/css/theme.css +122 -182
- package/dist/animation.d.ts +3 -7
- package/dist/animation.js +1 -1
- package/dist/base.d.ts +1 -1
- package/dist/base.js +1 -1
- package/dist/chunk-7EOSDFS3.js +10 -0
- package/dist/chunk-HW52LCWN.js +22 -0
- package/dist/{chunk-M2YFAZ2T.js → chunk-NOAZYT3J.js} +5 -1
- package/dist/colors-CUDWvz1g.d.ts +42 -0
- package/dist/components-B1rw2xzN.d.ts +46 -0
- package/dist/components.d.ts +23 -224
- package/dist/components.js +2283 -619
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +2 -1
- package/dist/index.d.ts +130 -2
- package/dist/index.js +636 -3
- package/dist/radix.d.ts +1 -0
- package/dist/radix.js +2 -0
- package/package.json +49 -33
- package/css/components/apexcharts.css +0 -101
- package/css/components/book.css +0 -19
- package/css/components/extra.css +0 -12
- package/css/components/image-input.css +0 -51
- package/css/components/leaflet.css +0 -25
- package/css/components/patterns.css +0 -34
- package/css/components/rating.css +0 -89
- package/css/components/scrollable.css +0 -118
- package/css/components/theme-transition.css +0 -51
- package/dist/aria.d.ts +0 -1
- package/dist/aria.js +0 -2
- package/dist/default.d.ts +0 -1
- package/dist/default.js +0 -2
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -2
package/dist/components.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
useMetaColor
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NOAZYT3J.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-7EOSDFS3.js";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_THEME_MODE,
|
|
10
|
+
THEME_MODES
|
|
11
|
+
} from "./chunk-HW52LCWN.js";
|
|
5
12
|
|
|
6
13
|
// src/components/feedback/alert.tsx
|
|
7
14
|
import {
|
|
@@ -13,7 +20,7 @@ import {
|
|
|
13
20
|
TriangleAlertIcon
|
|
14
21
|
} from "lucide-react";
|
|
15
22
|
import { toast } from "sonner";
|
|
16
|
-
import { Alert,
|
|
23
|
+
import { Alert, AlertTitle } from "@pelatform/ui.components/base";
|
|
17
24
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
25
|
var iconMap = {
|
|
19
26
|
primary: /* @__PURE__ */ jsx(CircleAlertIcon, {}),
|
|
@@ -25,11 +32,11 @@ var iconMap = {
|
|
|
25
32
|
function AlertToast({
|
|
26
33
|
message = "This is a toast",
|
|
27
34
|
icon = "success",
|
|
28
|
-
variant = "
|
|
35
|
+
variant = "default"
|
|
29
36
|
}) {
|
|
30
37
|
toast.custom(
|
|
31
|
-
() => /* @__PURE__ */ jsxs(Alert, { variant,
|
|
32
|
-
|
|
38
|
+
() => /* @__PURE__ */ jsxs(Alert, { variant, children: [
|
|
39
|
+
iconMap[icon ?? "success"],
|
|
33
40
|
/* @__PURE__ */ jsx(AlertTitle, { children: message })
|
|
34
41
|
] }),
|
|
35
42
|
{
|
|
@@ -57,18 +64,17 @@ function AlertNotification({ message, variant = "info" }) {
|
|
|
57
64
|
}
|
|
58
65
|
};
|
|
59
66
|
return /* @__PURE__ */ jsxs(Alert, { variant, children: [
|
|
60
|
-
|
|
67
|
+
getIcon(),
|
|
61
68
|
/* @__PURE__ */ jsx(AlertTitle, { children: message })
|
|
62
69
|
] });
|
|
63
70
|
}
|
|
64
71
|
var AlertComingsoon = ({
|
|
65
72
|
message = "This feature is coming soon.",
|
|
66
|
-
|
|
67
|
-
variant = "mono"
|
|
73
|
+
variant = "default"
|
|
68
74
|
} = {}) => {
|
|
69
75
|
toast.custom(
|
|
70
|
-
() => /* @__PURE__ */ jsxs(Alert, { variant,
|
|
71
|
-
/* @__PURE__ */ jsx(
|
|
76
|
+
() => /* @__PURE__ */ jsxs(Alert, { variant, children: [
|
|
77
|
+
/* @__PURE__ */ jsx(CircleAlertIcon, {}),
|
|
72
78
|
/* @__PURE__ */ jsx(AlertTitle, { children: message })
|
|
73
79
|
] }),
|
|
74
80
|
{
|
|
@@ -92,7 +98,7 @@ import {
|
|
|
92
98
|
AlertDialogFooter,
|
|
93
99
|
AlertDialogHeader,
|
|
94
100
|
AlertDialogTitle
|
|
95
|
-
} from "@pelatform/ui.
|
|
101
|
+
} from "@pelatform/ui.components/base";
|
|
96
102
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
97
103
|
var ConfirmDismissDialog = ({
|
|
98
104
|
open,
|
|
@@ -126,18 +132,17 @@ var ConfirmDismissDialog = ({
|
|
|
126
132
|
|
|
127
133
|
// src/components/feedback/screen-loader.tsx
|
|
128
134
|
import { LoaderIcon } from "lucide-react";
|
|
129
|
-
import { cn } from "@pelatform/utils";
|
|
130
135
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
131
136
|
function ScreenLoader({
|
|
132
137
|
loadingText = "Loading...",
|
|
133
138
|
className = "",
|
|
134
|
-
spinnerClassName = "size-6
|
|
139
|
+
spinnerClassName = "size-6",
|
|
135
140
|
textClassName = "text-muted-foreground font-medium text-sm",
|
|
136
141
|
contentLoader = false
|
|
137
142
|
} = {}) {
|
|
138
143
|
if (contentLoader) {
|
|
139
144
|
return /* @__PURE__ */ jsx3("div", { className: cn("flex w-full grow items-center justify-center", className), children: /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2.5", children: [
|
|
140
|
-
/* @__PURE__ */ jsx3(LoaderIcon, { className:
|
|
145
|
+
/* @__PURE__ */ jsx3(LoaderIcon, { className: cn("animate-spin", spinnerClassName) }),
|
|
141
146
|
/* @__PURE__ */ jsx3("span", { className: textClassName, children: loadingText })
|
|
142
147
|
] }) });
|
|
143
148
|
}
|
|
@@ -152,7 +157,7 @@ function ScreenLoader({
|
|
|
152
157
|
"aria-live": "polite",
|
|
153
158
|
"aria-label": loadingText,
|
|
154
159
|
children: [
|
|
155
|
-
/* @__PURE__ */ jsx3(LoaderIcon, { className:
|
|
160
|
+
/* @__PURE__ */ jsx3(LoaderIcon, { className: cn("animate-spin", spinnerClassName) }),
|
|
156
161
|
/* @__PURE__ */ jsx3("div", { className: textClassName, children: loadingText })
|
|
157
162
|
]
|
|
158
163
|
}
|
|
@@ -160,8 +165,7 @@ function ScreenLoader({
|
|
|
160
165
|
}
|
|
161
166
|
|
|
162
167
|
// src/components/layout/auth.tsx
|
|
163
|
-
import { Card, CardContent } from "@pelatform/ui.
|
|
164
|
-
import { cn as cn2 } from "@pelatform/utils";
|
|
168
|
+
import { Card, CardContent } from "@pelatform/ui.components/base";
|
|
165
169
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
166
170
|
function LayoutAuth({
|
|
167
171
|
children,
|
|
@@ -171,7 +175,7 @@ function LayoutAuth({
|
|
|
171
175
|
return /* @__PURE__ */ jsxs4(
|
|
172
176
|
"div",
|
|
173
177
|
{
|
|
174
|
-
className:
|
|
178
|
+
className: cn("flex min-h-screen grow flex-col items-center justify-center p-4", className),
|
|
175
179
|
children: [
|
|
176
180
|
logo && /* @__PURE__ */ jsx4("div", { className: "m-5", children: logo }),
|
|
177
181
|
/* @__PURE__ */ jsx4(Card, { className: "w-full max-w-md", children: /* @__PURE__ */ jsx4(CardContent, { className: "p-6", children }) })
|
|
@@ -180,12 +184,8 @@ function LayoutAuth({
|
|
|
180
184
|
);
|
|
181
185
|
}
|
|
182
186
|
|
|
183
|
-
// src/components/layout/blank.tsx
|
|
184
|
-
import { cn as cn4 } from "@pelatform/utils";
|
|
185
|
-
|
|
186
187
|
// src/components/layout/grid.tsx
|
|
187
188
|
import { useId } from "react";
|
|
188
|
-
import { cn as cn3 } from "@pelatform/utils";
|
|
189
189
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
190
190
|
function Grid({
|
|
191
191
|
cellSize = 12,
|
|
@@ -197,7 +197,7 @@ function Grid({
|
|
|
197
197
|
return /* @__PURE__ */ jsxs5(
|
|
198
198
|
"svg",
|
|
199
199
|
{
|
|
200
|
-
className:
|
|
200
|
+
className: cn("pointer-events-none absolute inset-0 text-foreground/10", className),
|
|
201
201
|
width: "100%",
|
|
202
202
|
height: "100%",
|
|
203
203
|
children: [
|
|
@@ -234,7 +234,7 @@ function LayoutBlank({ children, footer, className, logo }) {
|
|
|
234
234
|
/* @__PURE__ */ jsx6("div", { className: "absolute inset-0 isolate overflow-hidden bg-background", children: /* @__PURE__ */ jsx6(
|
|
235
235
|
"div",
|
|
236
236
|
{
|
|
237
|
-
className:
|
|
237
|
+
className: cn(
|
|
238
238
|
"absolute inset-y-0 start-1/2 w-[1200px] -translate-x-1/2",
|
|
239
239
|
"mask-intersect mask-[linear-gradient(black,transparent_320px),linear-gradient(90deg,transparent,black_5%,black_95%,transparent)]"
|
|
240
240
|
),
|
|
@@ -244,7 +244,7 @@ function LayoutBlank({ children, footer, className, logo }) {
|
|
|
244
244
|
/* @__PURE__ */ jsxs6(
|
|
245
245
|
"div",
|
|
246
246
|
{
|
|
247
|
-
className:
|
|
247
|
+
className: cn(
|
|
248
248
|
"relative flex min-h-screen w-full flex-col items-center justify-between",
|
|
249
249
|
className
|
|
250
250
|
),
|
|
@@ -259,22 +259,20 @@ function LayoutBlank({ children, footer, className, logo }) {
|
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
// src/components/layout/body.tsx
|
|
262
|
-
import { cn as cn5 } from "@pelatform/utils";
|
|
263
262
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
264
263
|
function useMode(slug) {
|
|
265
264
|
return Array.isArray(slug) && slug.length > 0 ? slug[0] : void 0;
|
|
266
265
|
}
|
|
267
266
|
function Body({ slug, children, className }) {
|
|
268
267
|
const mode = useMode(slug);
|
|
269
|
-
return /* @__PURE__ */ jsx7("body", { className:
|
|
268
|
+
return /* @__PURE__ */ jsx7("body", { className: cn(mode, className), children });
|
|
270
269
|
}
|
|
271
270
|
|
|
272
271
|
// src/components/layout/comingsoon.tsx
|
|
273
|
-
import { HoverBackground } from "@pelatform/ui.animation";
|
|
274
|
-
import { cn as cn6 } from "@pelatform/utils";
|
|
272
|
+
import { HoverBackground } from "@pelatform/ui.components/animation";
|
|
275
273
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
276
274
|
function ComingSoon({ className, title, description }) {
|
|
277
|
-
return /* @__PURE__ */ jsx8("div", { className:
|
|
275
|
+
return /* @__PURE__ */ jsx8("div", { className: cn("h-[calc(100vh-54px)] w-full overflow-hidden", className), children: /* @__PURE__ */ jsx8(
|
|
278
276
|
HoverBackground,
|
|
279
277
|
{
|
|
280
278
|
colors: {
|
|
@@ -299,18 +297,18 @@ function ComingSoon({ className, title, description }) {
|
|
|
299
297
|
}
|
|
300
298
|
|
|
301
299
|
// src/components/layout/error.tsx
|
|
302
|
-
import { Badge } from "@pelatform/ui.
|
|
303
|
-
import { assetsUrl, cn as cn7 } from "@pelatform/utils";
|
|
300
|
+
import { Badge } from "@pelatform/ui.components/base";
|
|
304
301
|
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
305
302
|
function ErrorComponents({
|
|
306
303
|
className,
|
|
307
304
|
type = "default",
|
|
308
305
|
textTitle,
|
|
309
306
|
textSubtitle,
|
|
310
|
-
button
|
|
307
|
+
button,
|
|
308
|
+
assetsUrl = (path) => path
|
|
311
309
|
}) {
|
|
312
310
|
if (type === "404") {
|
|
313
|
-
return /* @__PURE__ */ jsxs8("div", { className:
|
|
311
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("flex h-[95%] grow flex-col items-center justify-center", className), children: [
|
|
314
312
|
/* @__PURE__ */ jsxs8("div", { className: "mb-10", children: [
|
|
315
313
|
/* @__PURE__ */ jsx9(
|
|
316
314
|
"img",
|
|
@@ -329,13 +327,13 @@ function ErrorComponents({
|
|
|
329
327
|
}
|
|
330
328
|
)
|
|
331
329
|
] }),
|
|
332
|
-
/* @__PURE__ */ jsx9(Badge, { variant: "destructive",
|
|
330
|
+
/* @__PURE__ */ jsx9(Badge, { variant: "destructive", className: "mb-3", children: "404 Error" }),
|
|
333
331
|
/* @__PURE__ */ jsx9("h3", { className: "mb-2 text-center font-semibold text-2xl text-foreground", children: textTitle }),
|
|
334
332
|
/* @__PURE__ */ jsx9("div", { className: "mb-10 text-center text-base text-secondary-foreground", children: textSubtitle })
|
|
335
333
|
] });
|
|
336
334
|
}
|
|
337
335
|
if (type === "500") {
|
|
338
|
-
return /* @__PURE__ */ jsxs8("div", { className:
|
|
336
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("flex h-[95%] grow flex-col items-center justify-center", className), children: [
|
|
339
337
|
/* @__PURE__ */ jsxs8("div", { className: "mb-10", children: [
|
|
340
338
|
/* @__PURE__ */ jsx9(
|
|
341
339
|
"img",
|
|
@@ -354,13 +352,13 @@ function ErrorComponents({
|
|
|
354
352
|
}
|
|
355
353
|
)
|
|
356
354
|
] }),
|
|
357
|
-
/* @__PURE__ */ jsx9(Badge, { variant: "destructive",
|
|
355
|
+
/* @__PURE__ */ jsx9(Badge, { variant: "destructive", className: "mb-3", children: "500 Error" }),
|
|
358
356
|
/* @__PURE__ */ jsx9("h3", { className: "mb-2 text-center font-semibold text-2xl text-foreground", children: textTitle }),
|
|
359
357
|
/* @__PURE__ */ jsx9("div", { className: "mb-10 text-center text-base text-secondary-foreground", children: textSubtitle }),
|
|
360
358
|
button
|
|
361
359
|
] });
|
|
362
360
|
}
|
|
363
|
-
return /* @__PURE__ */ jsxs8("div", { className:
|
|
361
|
+
return /* @__PURE__ */ jsxs8("div", { className: cn("flex h-[95%] grow flex-col items-center justify-center", className), children: [
|
|
364
362
|
/* @__PURE__ */ jsxs8("div", { className: "mb-10", children: [
|
|
365
363
|
/* @__PURE__ */ jsx9(
|
|
366
364
|
"img",
|
|
@@ -386,10 +384,8 @@ function ErrorComponents({
|
|
|
386
384
|
|
|
387
385
|
// src/components/layout/section.tsx
|
|
388
386
|
import { PlusIcon } from "lucide-react";
|
|
389
|
-
import { cn as cn9 } from "@pelatform/utils";
|
|
390
387
|
|
|
391
388
|
// src/components/ui/grid-background.tsx
|
|
392
|
-
import { cn as cn8 } from "@pelatform/utils";
|
|
393
389
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
394
390
|
var GridBackground = ({
|
|
395
391
|
columns = 4,
|
|
@@ -408,53 +404,58 @@ var GridBackground = ({
|
|
|
408
404
|
},
|
|
409
405
|
i
|
|
410
406
|
));
|
|
411
|
-
return /* @__PURE__ */ jsx10("div", { className:
|
|
407
|
+
return /* @__PURE__ */ jsx10("div", { className: cn("stripe-grid absolute inset-0 -z-50 h-full w-full", className), children: /* @__PURE__ */ jsx10("div", { className: "relative h-full w-full overflow-hidden", children: /* @__PURE__ */ jsx10(
|
|
412
408
|
"div",
|
|
413
409
|
{
|
|
414
|
-
className:
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
410
|
+
className: "pointer-events-none absolute start-0 top-0 h-full w-full",
|
|
411
|
+
"aria-hidden": "true",
|
|
412
|
+
children: /* @__PURE__ */ jsxs9(
|
|
413
|
+
"div",
|
|
414
|
+
{
|
|
415
|
+
className: cn("relative mx-auto grid h-full grid-cols-4 grid-rows-1", maxWidthClass),
|
|
416
|
+
children: [
|
|
417
|
+
columnElements,
|
|
418
|
+
/* @__PURE__ */ jsx10(
|
|
419
|
+
"div",
|
|
420
|
+
{
|
|
421
|
+
className: "absolute end-0 top-0 h-full w-px",
|
|
422
|
+
style: { backgroundColor: "var(--grid-base-color)" }
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
)
|
|
425
428
|
}
|
|
426
|
-
) }) })
|
|
429
|
+
) }) });
|
|
427
430
|
};
|
|
428
431
|
|
|
429
432
|
// src/components/layout/section.tsx
|
|
430
433
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
431
434
|
var Cross = () => /* @__PURE__ */ jsxs10("div", { className: "relative h-6 w-6", children: [
|
|
432
|
-
/* @__PURE__ */ jsx11("div", { className: "absolute
|
|
435
|
+
/* @__PURE__ */ jsx11("div", { className: "absolute start-3 h-6 w-px bg-background" }),
|
|
433
436
|
/* @__PURE__ */ jsx11("div", { className: "absolute top-3 h-px w-6 bg-background" }),
|
|
434
|
-
/* @__PURE__ */ jsx11("div", { className: "absolute
|
|
437
|
+
/* @__PURE__ */ jsx11("div", { className: "absolute start-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx11(PlusIcon, { size: 20, className: "text-border/70 dark:text-border" }) })
|
|
435
438
|
] });
|
|
436
439
|
var Section = ({ children, sectionClassName, className, ...props }) => /* @__PURE__ */ jsx11("section", { className: sectionClassName, ...props, children: /* @__PURE__ */ jsxs10("div", { className: "grid-container relative mx-auto", children: [
|
|
437
440
|
/* @__PURE__ */ jsx11(GridBackground, { maxWidthClass: "grid-container" }),
|
|
438
|
-
/* @__PURE__ */ jsx11("div", { className:
|
|
439
|
-
/* @__PURE__ */ jsx11("div", { className: "absolute -
|
|
440
|
-
/* @__PURE__ */ jsx11("div", { className: "absolute -
|
|
441
|
+
/* @__PURE__ */ jsx11("div", { className: cn(className), children }),
|
|
442
|
+
/* @__PURE__ */ jsx11("div", { className: "absolute -start-3 -bottom-3 z-10 hidden h-6 sm:block", children: /* @__PURE__ */ jsx11(Cross, {}) }),
|
|
443
|
+
/* @__PURE__ */ jsx11("div", { className: "absolute -end-3 -bottom-3 z-10 hidden h-6 -translate-x-px sm:block", children: /* @__PURE__ */ jsx11(Cross, {}) })
|
|
441
444
|
] }) });
|
|
442
445
|
|
|
443
446
|
// src/components/layout/site-footer.tsx
|
|
444
|
-
import { cn as cn10 } from "@pelatform/utils";
|
|
445
447
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
446
448
|
function SiteFooter({ children, className }) {
|
|
447
|
-
return /* @__PURE__ */ jsx12("footer", { className:
|
|
449
|
+
return /* @__PURE__ */ jsx12("footer", { className: cn("border-border border-t py-5 md:py-0", className), children: /* @__PURE__ */ jsx12("div", { className: "container flex flex-col items-center justify-between gap-4 py-4 md:h-16 md:flex-row", children }) });
|
|
448
450
|
}
|
|
449
451
|
|
|
450
452
|
// src/components/layout/site-header.tsx
|
|
451
|
-
import { cn as cn11 } from "@pelatform/utils";
|
|
452
453
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
453
454
|
function SiteHeader({ className, children }) {
|
|
454
455
|
return /* @__PURE__ */ jsx13(
|
|
455
456
|
"header",
|
|
456
457
|
{
|
|
457
|
-
className:
|
|
458
|
+
className: cn(
|
|
458
459
|
"sticky top-0 z-50 w-full border-border border-b bg-background/95 backdrop-blur-sm supports-backdrop-filter:bg-background/60",
|
|
459
460
|
className
|
|
460
461
|
),
|
|
@@ -464,10 +465,9 @@ function SiteHeader({ className, children }) {
|
|
|
464
465
|
}
|
|
465
466
|
|
|
466
467
|
// src/components/layout/wrapper.tsx
|
|
467
|
-
import { cn as cn12 } from "@pelatform/utils";
|
|
468
468
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
469
469
|
function MaxWidthWrapper({ className, children }) {
|
|
470
|
-
return /* @__PURE__ */ jsx14("div", { className:
|
|
470
|
+
return /* @__PURE__ */ jsx14("div", { className: cn("mx-auto w-full max-w-7xl p-3 lg:px-10", className), children });
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
// src/components/mdx/code-display.tsx
|
|
@@ -484,19 +484,15 @@ function CodeDisplay({
|
|
|
484
484
|
|
|
485
485
|
// src/components/mdx/download.tsx
|
|
486
486
|
import { DownloadIcon } from "lucide-react";
|
|
487
|
-
import { Button } from "@pelatform/ui.
|
|
488
|
-
import { cn as cn13 } from "@pelatform/utils";
|
|
487
|
+
import { Button } from "@pelatform/ui.components/base";
|
|
489
488
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
490
489
|
function DownloadFile({ children, className, href }) {
|
|
491
|
-
return /* @__PURE__ */ jsx16("div", { className: "inline-flex pb-4", children: /* @__PURE__ */ jsx16(Button, { size: "lg", className:
|
|
492
|
-
/* @__PURE__ */ jsx16(DownloadIcon, { className: "
|
|
490
|
+
return /* @__PURE__ */ jsx16("div", { className: "inline-flex pb-4", children: /* @__PURE__ */ jsx16(Button, { size: "lg", className: cn("rounded-full", className), children: /* @__PURE__ */ jsxs12("a", { href, target: "_blank", rel: "noopener noreferrer", children: [
|
|
491
|
+
/* @__PURE__ */ jsx16(DownloadIcon, { className: "me-2 size-5" }),
|
|
493
492
|
children
|
|
494
493
|
] }) }) });
|
|
495
494
|
}
|
|
496
495
|
|
|
497
|
-
// src/components/mdx/link.tsx
|
|
498
|
-
import { cn as cn14 } from "@pelatform/utils";
|
|
499
|
-
|
|
500
496
|
// src/components/utils/shared.tsx
|
|
501
497
|
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
502
498
|
var DefaultImage = ({ src, alt, className }) => /* @__PURE__ */ jsx17("img", { src, alt, className });
|
|
@@ -519,27 +515,25 @@ function ExtraLink({
|
|
|
519
515
|
{
|
|
520
516
|
href,
|
|
521
517
|
target,
|
|
522
|
-
className:
|
|
518
|
+
className: cn("font-medium underline underline-offset-4", className),
|
|
523
519
|
children
|
|
524
520
|
}
|
|
525
521
|
);
|
|
526
522
|
}
|
|
527
523
|
|
|
528
524
|
// src/components/mdx/video.tsx
|
|
529
|
-
import { cn as cn15 } from "@pelatform/utils";
|
|
530
525
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
531
526
|
function Video({ className, ...props }) {
|
|
532
|
-
return /* @__PURE__ */ jsx19("video", { className:
|
|
527
|
+
return /* @__PURE__ */ jsx19("video", { className: cn("w-full rounded-lg border", className), controls: true, loop: true, ...props });
|
|
533
528
|
}
|
|
534
529
|
|
|
535
530
|
// src/components/mdx/wrapper.tsx
|
|
536
|
-
import { cn as cn16 } from "@pelatform/utils";
|
|
537
531
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
538
532
|
function Wrapper({ children, className }) {
|
|
539
533
|
return /* @__PURE__ */ jsx20(
|
|
540
534
|
"div",
|
|
541
535
|
{
|
|
542
|
-
className:
|
|
536
|
+
className: cn(
|
|
543
537
|
"prose-no-margin rounded-lg border border-fd-primary/10 bg-radial-[at_bottom] from-blue-500/20 bg-origin-border p-4 dark:bg-black/20",
|
|
544
538
|
className
|
|
545
539
|
),
|
|
@@ -571,15 +565,14 @@ function Youtube({ id }) {
|
|
|
571
565
|
|
|
572
566
|
// src/components/navigation/back-link.tsx
|
|
573
567
|
import { ChevronLeftIcon } from "lucide-react";
|
|
574
|
-
import { Button as Button2 } from "@pelatform/ui.
|
|
575
|
-
import { cn as cn17 } from "@pelatform/utils";
|
|
568
|
+
import { Button as Button2 } from "@pelatform/ui.components/base";
|
|
576
569
|
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
577
570
|
function BackLink({ Link = DefaultLink, children, href, className }) {
|
|
578
571
|
return /* @__PURE__ */ jsxs13(
|
|
579
572
|
Link,
|
|
580
573
|
{
|
|
581
574
|
href,
|
|
582
|
-
className:
|
|
575
|
+
className: cn(
|
|
583
576
|
"group flex items-center gap-2 text-foreground transition-colors duration-100 hover:text-foreground/75",
|
|
584
577
|
className
|
|
585
578
|
),
|
|
@@ -587,8 +580,8 @@ function BackLink({ Link = DefaultLink, children, href, className }) {
|
|
|
587
580
|
/* @__PURE__ */ jsx22(
|
|
588
581
|
Button2,
|
|
589
582
|
{
|
|
583
|
+
size: "icon",
|
|
590
584
|
variant: "secondary",
|
|
591
|
-
mode: "icon",
|
|
592
585
|
className: "size-7.5! transition-transform duration-100 group-hover:-translate-x-0.5",
|
|
593
586
|
children: /* @__PURE__ */ jsx22(ChevronLeftIcon, {})
|
|
594
587
|
}
|
|
@@ -602,8 +595,7 @@ function BackLink({ Link = DefaultLink, children, href, className }) {
|
|
|
602
595
|
// src/components/navigation/command-menu.tsx
|
|
603
596
|
import * as React from "react";
|
|
604
597
|
import { SearchIcon } from "lucide-react";
|
|
605
|
-
import { Button as Button3, CommandDialog, CommandInput, CommandList } from "@pelatform/ui.
|
|
606
|
-
import { cn as cn18, googleTrackEvent } from "@pelatform/utils";
|
|
598
|
+
import { Button as Button3, CommandDialog, CommandInput, CommandList } from "@pelatform/ui.components/base";
|
|
607
599
|
import { Fragment as Fragment2, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
608
600
|
function CommandMenu({
|
|
609
601
|
children,
|
|
@@ -626,17 +618,6 @@ function CommandMenu({
|
|
|
626
618
|
e.preventDefault();
|
|
627
619
|
setOpen((currentOpen) => {
|
|
628
620
|
const newState = !currentOpen;
|
|
629
|
-
if (newState) {
|
|
630
|
-
googleTrackEvent({
|
|
631
|
-
name: "site_header_search_trigger_shortcut",
|
|
632
|
-
properties: {
|
|
633
|
-
method: e.key === "/" ? "slash" : "cmd_k",
|
|
634
|
-
category: "search",
|
|
635
|
-
label: `Search Trigger - ${e.key === "/" ? "Slash" : "Cmd+K"}`,
|
|
636
|
-
timestamp: Date.now()
|
|
637
|
-
}
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
621
|
return newState;
|
|
641
622
|
});
|
|
642
623
|
}
|
|
@@ -644,39 +625,26 @@ function CommandMenu({
|
|
|
644
625
|
document.addEventListener("keydown", handleKeyDown);
|
|
645
626
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
646
627
|
}, []);
|
|
647
|
-
const handleButtonClick = React.useCallback(() => {
|
|
648
|
-
googleTrackEvent({
|
|
649
|
-
name: "site_header_search_trigger_click",
|
|
650
|
-
properties: {
|
|
651
|
-
method: "button_click",
|
|
652
|
-
category: "search",
|
|
653
|
-
label: "Search Trigger - Button Click",
|
|
654
|
-
timestamp: Date.now()
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
}, []);
|
|
658
628
|
const handleOpenMenu = React.useCallback(() => {
|
|
659
629
|
setOpen(true);
|
|
660
|
-
|
|
661
|
-
}, [handleButtonClick]);
|
|
630
|
+
}, []);
|
|
662
631
|
return /* @__PURE__ */ jsxs14(Fragment2, { children: [
|
|
663
632
|
/* @__PURE__ */ jsxs14(
|
|
664
633
|
Button3,
|
|
665
634
|
{
|
|
666
|
-
variant: "outline",
|
|
667
|
-
mode: "input",
|
|
668
635
|
size: "sm",
|
|
669
|
-
|
|
636
|
+
variant: "outline",
|
|
637
|
+
className: cn("relative h-8 w-full py-0 ps-2 sm:w-40 sm:pe-12 lg:w-48", classButton),
|
|
670
638
|
onClick: handleOpenMenu,
|
|
671
639
|
"aria-label": `Open command menu (${keyHint})`,
|
|
672
640
|
...props,
|
|
673
641
|
children: [
|
|
674
|
-
/* @__PURE__ */ jsx23(SearchIcon, { className: "
|
|
642
|
+
/* @__PURE__ */ jsx23(SearchIcon, { className: "me-2 size-4" }),
|
|
675
643
|
/* @__PURE__ */ jsx23("span", { className: "inline-flex text-muted-foreground", children: searchButtonText }),
|
|
676
644
|
/* @__PURE__ */ jsx23(
|
|
677
645
|
"kbd",
|
|
678
646
|
{
|
|
679
|
-
className: "pointer-events-none absolute top-1/2
|
|
647
|
+
className: "pointer-events-none absolute end-[5px] top-1/2 hidden h-5 -translate-y-1/2 select-none items-center gap-1 rounded border bg-muted px-1.5 font-medium font-mono text-[10px] opacity-100 sm:flex",
|
|
680
648
|
"aria-label": `Keyboard shortcut: ${keyHint}`,
|
|
681
649
|
children: keyHint
|
|
682
650
|
}
|
|
@@ -689,7 +657,7 @@ function CommandMenu({
|
|
|
689
657
|
{
|
|
690
658
|
open,
|
|
691
659
|
onOpenChange: setOpen,
|
|
692
|
-
className:
|
|
660
|
+
className: cn(
|
|
693
661
|
"**:data-dialog-close:end-[0.925rem] **:data-dialog-close:top-[0.925rem]",
|
|
694
662
|
classDialog
|
|
695
663
|
),
|
|
@@ -712,11 +680,10 @@ import {
|
|
|
712
680
|
DropdownMenuSubContent,
|
|
713
681
|
DropdownMenuSubTrigger,
|
|
714
682
|
DropdownMenuTrigger
|
|
715
|
-
} from "@pelatform/ui.
|
|
716
|
-
import { cn as cn19, googleTrackEvent as googleTrackEvent2 } from "@pelatform/utils";
|
|
683
|
+
} from "@pelatform/ui.components/base";
|
|
717
684
|
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
718
685
|
function MainNav({ Link = DefaultLink, pathname, items, className }) {
|
|
719
|
-
return /* @__PURE__ */ jsx24("div", { className:
|
|
686
|
+
return /* @__PURE__ */ jsx24("div", { className: cn("me-4 hidden items-center justify-center md:flex", className), children: /* @__PURE__ */ jsx24("nav", { className: "flex items-center gap-4 font-medium text-sm xl:gap-6", children: items.map((item) => /* @__PURE__ */ jsx24(NavItemRenderer, { Link, item, pathname, level: 1 }, item.title)) }) });
|
|
720
687
|
}
|
|
721
688
|
function NavItemRenderer({ Link = DefaultLink, item, pathname, level }) {
|
|
722
689
|
const hasChildren = item.children && item.children.length > 0;
|
|
@@ -727,10 +694,10 @@ function NavItemRenderer({ Link = DefaultLink, item, pathname, level }) {
|
|
|
727
694
|
) ?? false : item.href === pathname || item.href !== "/" && item.href && pathname?.startsWith(item.href);
|
|
728
695
|
if (hasChildren && level <= 3) {
|
|
729
696
|
return /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
730
|
-
/* @__PURE__ */ jsx24(DropdownMenuTrigger, {
|
|
697
|
+
/* @__PURE__ */ jsx24(DropdownMenuTrigger, { children: /* @__PURE__ */ jsxs15(
|
|
731
698
|
"button",
|
|
732
699
|
{
|
|
733
|
-
className:
|
|
700
|
+
className: cn(
|
|
734
701
|
"inline-flex cursor-pointer items-center gap-1 transition-colors hover:text-foreground/80 focus-visible:outline-0",
|
|
735
702
|
isActive ? "text-foreground" : "text-foreground/60"
|
|
736
703
|
),
|
|
@@ -767,11 +734,10 @@ function NavItemRenderer({ Link = DefaultLink, item, pathname, level }) {
|
|
|
767
734
|
{
|
|
768
735
|
href: item.href ?? "#",
|
|
769
736
|
...item.external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
770
|
-
className:
|
|
737
|
+
className: cn(
|
|
771
738
|
"relative inline-flex items-center gap-1 transition-colors hover:text-foreground/80",
|
|
772
739
|
isActive ? "text-foreground" : "text-foreground/60"
|
|
773
740
|
),
|
|
774
|
-
onClick: () => handleMenuClick(item),
|
|
775
741
|
children: [
|
|
776
742
|
item.icon && /* @__PURE__ */ jsx24(item.icon, {}),
|
|
777
743
|
item.title,
|
|
@@ -790,7 +756,7 @@ function ChildNavItemRenderer({ Link = DefaultLink, item, pathname, level }) {
|
|
|
790
756
|
/* @__PURE__ */ jsxs15(
|
|
791
757
|
DropdownMenuSubTrigger,
|
|
792
758
|
{
|
|
793
|
-
className:
|
|
759
|
+
className: cn(
|
|
794
760
|
"flex w-full items-center justify-between text-muted-foreground hover:text-foreground",
|
|
795
761
|
isChildActive && "font-medium text-foreground"
|
|
796
762
|
),
|
|
@@ -811,16 +777,15 @@ function ChildNavItemRenderer({ Link = DefaultLink, item, pathname, level }) {
|
|
|
811
777
|
)) })
|
|
812
778
|
] });
|
|
813
779
|
}
|
|
814
|
-
return /* @__PURE__ */ jsx24(DropdownMenuItem, {
|
|
780
|
+
return /* @__PURE__ */ jsx24(DropdownMenuItem, { children: /* @__PURE__ */ jsxs15(
|
|
815
781
|
Link,
|
|
816
782
|
{
|
|
817
783
|
href: item.href || "",
|
|
818
784
|
...item.external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
819
|
-
className:
|
|
785
|
+
className: cn(
|
|
820
786
|
"block w-full cursor-pointer transition-colors",
|
|
821
787
|
isChildActive ? "font-medium text-foreground" : "text-muted-foreground hover:text-foreground"
|
|
822
788
|
),
|
|
823
|
-
onClick: () => handleMenuClick(item),
|
|
824
789
|
children: [
|
|
825
790
|
item.icon && /* @__PURE__ */ jsx24(item.icon, {}),
|
|
826
791
|
item.title,
|
|
@@ -829,18 +794,6 @@ function ChildNavItemRenderer({ Link = DefaultLink, item, pathname, level }) {
|
|
|
829
794
|
}
|
|
830
795
|
) });
|
|
831
796
|
}
|
|
832
|
-
function handleMenuClick(item) {
|
|
833
|
-
googleTrackEvent2({
|
|
834
|
-
name: `site_header_menu_${item.title.toLowerCase().replace(/\s+/g, "_")}_link_click`,
|
|
835
|
-
properties: {
|
|
836
|
-
menu_item: item.title,
|
|
837
|
-
menu_path: item.href || "#",
|
|
838
|
-
is_external: !!item.external,
|
|
839
|
-
category: "navigation",
|
|
840
|
-
label: `Header Menu ${item.title} Click`
|
|
841
|
-
}
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
797
|
|
|
845
798
|
// src/components/navigation/mobile-nav.tsx
|
|
846
799
|
import { useCallback as useCallback2, useState as useState2 } from "react";
|
|
@@ -855,8 +808,7 @@ import {
|
|
|
855
808
|
DrawerDescription,
|
|
856
809
|
DrawerTitle,
|
|
857
810
|
DrawerTrigger
|
|
858
|
-
} from "@pelatform/ui.
|
|
859
|
-
import { cn as cn20 } from "@pelatform/utils";
|
|
811
|
+
} from "@pelatform/ui.components/base";
|
|
860
812
|
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
861
813
|
function MobileNav({ children, className }) {
|
|
862
814
|
const { setMetaColor, metaColor } = useMetaColor();
|
|
@@ -868,7 +820,7 @@ function MobileNav({ children, className }) {
|
|
|
868
820
|
},
|
|
869
821
|
[setMetaColor, metaColor]
|
|
870
822
|
);
|
|
871
|
-
return /* @__PURE__ */ jsx25("div", { className:
|
|
823
|
+
return /* @__PURE__ */ jsx25("div", { className: cn("flex items-center gap-2.5 md:hidden", className), children: /* @__PURE__ */ jsxs16(Drawer, { open, onOpenChange, children: [
|
|
872
824
|
/* @__PURE__ */ jsx25(DrawerTrigger, { asChild: true, children: /* @__PURE__ */ jsxs16(Button4, { variant: "ghost", className: "group/toggle size-8 px-0 text-foreground", children: [
|
|
873
825
|
/* @__PURE__ */ jsx25(MenuIcon, {}),
|
|
874
826
|
/* @__PURE__ */ jsx25("span", { className: "sr-only", children: "Toggle Menu" })
|
|
@@ -902,69 +854,2070 @@ function MobileNavItemRenderer({
|
|
|
902
854
|
/* @__PURE__ */ jsxs16(
|
|
903
855
|
CollapsibleTrigger,
|
|
904
856
|
{
|
|
905
|
-
className:
|
|
906
|
-
"flex w-full cursor-pointer items-center gap-1 text-sm transition-colors",
|
|
907
|
-
isOpen ? "text-foreground" : "text-foreground/60"
|
|
908
|
-
),
|
|
909
|
-
children: [
|
|
910
|
-
item.icon && /* @__PURE__ */ jsx25(item.icon, {}),
|
|
911
|
-
item.title,
|
|
912
|
-
/* @__PURE__ */ jsx25(
|
|
913
|
-
ChevronDownIcon2,
|
|
914
|
-
{
|
|
915
|
-
className:
|
|
916
|
-
"
|
|
917
|
-
isOpen && "rotate-180"
|
|
918
|
-
)
|
|
919
|
-
}
|
|
920
|
-
)
|
|
921
|
-
]
|
|
922
|
-
}
|
|
923
|
-
),
|
|
924
|
-
/* @__PURE__ */ jsx25(CollapsibleContent, { children: /* @__PURE__ */ jsx25("div", { className:
|
|
925
|
-
MobileNavItemRenderer,
|
|
857
|
+
className: cn(
|
|
858
|
+
"flex w-full cursor-pointer items-center gap-1 text-sm transition-colors",
|
|
859
|
+
isOpen ? "text-foreground" : "text-foreground/60"
|
|
860
|
+
),
|
|
861
|
+
children: [
|
|
862
|
+
item.icon && /* @__PURE__ */ jsx25(item.icon, {}),
|
|
863
|
+
item.title,
|
|
864
|
+
/* @__PURE__ */ jsx25(
|
|
865
|
+
ChevronDownIcon2,
|
|
866
|
+
{
|
|
867
|
+
className: cn(
|
|
868
|
+
"ms-auto size-3.5 opacity-60 transition-transform",
|
|
869
|
+
isOpen && "rotate-180"
|
|
870
|
+
)
|
|
871
|
+
}
|
|
872
|
+
)
|
|
873
|
+
]
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
/* @__PURE__ */ jsx25(CollapsibleContent, { children: /* @__PURE__ */ jsx25("div", { className: cn("flex flex-col space-y-2.5 pt-3", `ps-5`), children: item.children.map((child) => /* @__PURE__ */ jsx25(
|
|
877
|
+
MobileNavItemRenderer,
|
|
878
|
+
{
|
|
879
|
+
item: child,
|
|
880
|
+
pathname,
|
|
881
|
+
level: level + 1,
|
|
882
|
+
onOpenChange
|
|
883
|
+
},
|
|
884
|
+
child.title
|
|
885
|
+
)) }) })
|
|
886
|
+
] });
|
|
887
|
+
}
|
|
888
|
+
return /* @__PURE__ */ jsxs16(
|
|
889
|
+
Link,
|
|
890
|
+
{
|
|
891
|
+
href: item.href || "#",
|
|
892
|
+
...item.external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
893
|
+
onClick: () => {
|
|
894
|
+
if (!item.external && item.href) {
|
|
895
|
+
router(item.href.toString());
|
|
896
|
+
}
|
|
897
|
+
onOpenChange?.(false);
|
|
898
|
+
},
|
|
899
|
+
className: cn(
|
|
900
|
+
"inline-flex items-center gap-1 text-sm transition-colors",
|
|
901
|
+
isActive ? "text-foreground" : "text-foreground/60"
|
|
902
|
+
),
|
|
903
|
+
children: [
|
|
904
|
+
item.icon && /* @__PURE__ */ jsx25(item.icon, {}),
|
|
905
|
+
item.title,
|
|
906
|
+
item.external && /* @__PURE__ */ jsx25(ArrowUpRightIcon2, { className: "ms-1 size-3.5 opacity-60" })
|
|
907
|
+
]
|
|
908
|
+
}
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
// src/components/providers/query-provider.tsx
|
|
913
|
+
import { useState as useState3 } from "react";
|
|
914
|
+
|
|
915
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/subscribable.js
|
|
916
|
+
var Subscribable = class {
|
|
917
|
+
constructor() {
|
|
918
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
919
|
+
this.subscribe = this.subscribe.bind(this);
|
|
920
|
+
}
|
|
921
|
+
subscribe(listener) {
|
|
922
|
+
this.listeners.add(listener);
|
|
923
|
+
this.onSubscribe();
|
|
924
|
+
return () => {
|
|
925
|
+
this.listeners.delete(listener);
|
|
926
|
+
this.onUnsubscribe();
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
hasListeners() {
|
|
930
|
+
return this.listeners.size > 0;
|
|
931
|
+
}
|
|
932
|
+
onSubscribe() {
|
|
933
|
+
}
|
|
934
|
+
onUnsubscribe() {
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/timeoutManager.js
|
|
939
|
+
var defaultTimeoutProvider = {
|
|
940
|
+
// We need the wrapper function syntax below instead of direct references to
|
|
941
|
+
// global setTimeout etc.
|
|
942
|
+
//
|
|
943
|
+
// BAD: `setTimeout: setTimeout`
|
|
944
|
+
// GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
|
|
945
|
+
//
|
|
946
|
+
// If we use direct references here, then anything that wants to spy on or
|
|
947
|
+
// replace the global setTimeout (like tests) won't work since we'll already
|
|
948
|
+
// have a hard reference to the original implementation at the time when this
|
|
949
|
+
// file was imported.
|
|
950
|
+
setTimeout: (callback, delay) => setTimeout(callback, delay),
|
|
951
|
+
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
952
|
+
setInterval: (callback, delay) => setInterval(callback, delay),
|
|
953
|
+
clearInterval: (intervalId) => clearInterval(intervalId)
|
|
954
|
+
};
|
|
955
|
+
var TimeoutManager = class {
|
|
956
|
+
// We cannot have TimeoutManager<T> as we must instantiate it with a concrete
|
|
957
|
+
// type at app boot; and if we leave that type, then any new timer provider
|
|
958
|
+
// would need to support ReturnType<typeof setTimeout>, which is infeasible.
|
|
959
|
+
//
|
|
960
|
+
// We settle for type safety for the TimeoutProvider type, and accept that
|
|
961
|
+
// this class is unsafe internally to allow for extension.
|
|
962
|
+
#provider = defaultTimeoutProvider;
|
|
963
|
+
#providerCalled = false;
|
|
964
|
+
setTimeoutProvider(provider) {
|
|
965
|
+
if (process.env.NODE_ENV !== "production") {
|
|
966
|
+
if (this.#providerCalled && provider !== this.#provider) {
|
|
967
|
+
console.error(
|
|
968
|
+
`[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,
|
|
969
|
+
{ previous: this.#provider, provider }
|
|
970
|
+
);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
this.#provider = provider;
|
|
974
|
+
if (process.env.NODE_ENV !== "production") {
|
|
975
|
+
this.#providerCalled = false;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
setTimeout(callback, delay) {
|
|
979
|
+
if (process.env.NODE_ENV !== "production") {
|
|
980
|
+
this.#providerCalled = true;
|
|
981
|
+
}
|
|
982
|
+
return this.#provider.setTimeout(callback, delay);
|
|
983
|
+
}
|
|
984
|
+
clearTimeout(timeoutId) {
|
|
985
|
+
this.#provider.clearTimeout(timeoutId);
|
|
986
|
+
}
|
|
987
|
+
setInterval(callback, delay) {
|
|
988
|
+
if (process.env.NODE_ENV !== "production") {
|
|
989
|
+
this.#providerCalled = true;
|
|
990
|
+
}
|
|
991
|
+
return this.#provider.setInterval(callback, delay);
|
|
992
|
+
}
|
|
993
|
+
clearInterval(intervalId) {
|
|
994
|
+
this.#provider.clearInterval(intervalId);
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
var timeoutManager = new TimeoutManager();
|
|
998
|
+
function systemSetTimeoutZero(callback) {
|
|
999
|
+
setTimeout(callback, 0);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/utils.js
|
|
1003
|
+
var isServer = typeof window === "undefined" || "Deno" in globalThis;
|
|
1004
|
+
function noop() {
|
|
1005
|
+
}
|
|
1006
|
+
function functionalUpdate(updater, input) {
|
|
1007
|
+
return typeof updater === "function" ? updater(input) : updater;
|
|
1008
|
+
}
|
|
1009
|
+
function isValidTimeout(value) {
|
|
1010
|
+
return typeof value === "number" && value >= 0 && value !== Infinity;
|
|
1011
|
+
}
|
|
1012
|
+
function timeUntilStale(updatedAt, staleTime) {
|
|
1013
|
+
return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
|
|
1014
|
+
}
|
|
1015
|
+
function resolveStaleTime(staleTime, query) {
|
|
1016
|
+
return typeof staleTime === "function" ? staleTime(query) : staleTime;
|
|
1017
|
+
}
|
|
1018
|
+
function resolveEnabled(enabled, query) {
|
|
1019
|
+
return typeof enabled === "function" ? enabled(query) : enabled;
|
|
1020
|
+
}
|
|
1021
|
+
function matchQuery(filters, query) {
|
|
1022
|
+
const {
|
|
1023
|
+
type = "all",
|
|
1024
|
+
exact,
|
|
1025
|
+
fetchStatus,
|
|
1026
|
+
predicate,
|
|
1027
|
+
queryKey,
|
|
1028
|
+
stale
|
|
1029
|
+
} = filters;
|
|
1030
|
+
if (queryKey) {
|
|
1031
|
+
if (exact) {
|
|
1032
|
+
if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
|
|
1033
|
+
return false;
|
|
1034
|
+
}
|
|
1035
|
+
} else if (!partialMatchKey(query.queryKey, queryKey)) {
|
|
1036
|
+
return false;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
if (type !== "all") {
|
|
1040
|
+
const isActive = query.isActive();
|
|
1041
|
+
if (type === "active" && !isActive) {
|
|
1042
|
+
return false;
|
|
1043
|
+
}
|
|
1044
|
+
if (type === "inactive" && isActive) {
|
|
1045
|
+
return false;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
if (typeof stale === "boolean" && query.isStale() !== stale) {
|
|
1049
|
+
return false;
|
|
1050
|
+
}
|
|
1051
|
+
if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
|
|
1052
|
+
return false;
|
|
1053
|
+
}
|
|
1054
|
+
if (predicate && !predicate(query)) {
|
|
1055
|
+
return false;
|
|
1056
|
+
}
|
|
1057
|
+
return true;
|
|
1058
|
+
}
|
|
1059
|
+
function matchMutation(filters, mutation) {
|
|
1060
|
+
const { exact, status, predicate, mutationKey } = filters;
|
|
1061
|
+
if (mutationKey) {
|
|
1062
|
+
if (!mutation.options.mutationKey) {
|
|
1063
|
+
return false;
|
|
1064
|
+
}
|
|
1065
|
+
if (exact) {
|
|
1066
|
+
if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {
|
|
1067
|
+
return false;
|
|
1068
|
+
}
|
|
1069
|
+
} else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
|
|
1070
|
+
return false;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
if (status && mutation.state.status !== status) {
|
|
1074
|
+
return false;
|
|
1075
|
+
}
|
|
1076
|
+
if (predicate && !predicate(mutation)) {
|
|
1077
|
+
return false;
|
|
1078
|
+
}
|
|
1079
|
+
return true;
|
|
1080
|
+
}
|
|
1081
|
+
function hashQueryKeyByOptions(queryKey, options) {
|
|
1082
|
+
const hashFn = options?.queryKeyHashFn || hashKey;
|
|
1083
|
+
return hashFn(queryKey);
|
|
1084
|
+
}
|
|
1085
|
+
function hashKey(queryKey) {
|
|
1086
|
+
return JSON.stringify(
|
|
1087
|
+
queryKey,
|
|
1088
|
+
(_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
|
|
1089
|
+
result[key] = val[key];
|
|
1090
|
+
return result;
|
|
1091
|
+
}, {}) : val
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
function partialMatchKey(a, b) {
|
|
1095
|
+
if (a === b) {
|
|
1096
|
+
return true;
|
|
1097
|
+
}
|
|
1098
|
+
if (typeof a !== typeof b) {
|
|
1099
|
+
return false;
|
|
1100
|
+
}
|
|
1101
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
1102
|
+
return Object.keys(b).every((key) => partialMatchKey(a[key], b[key]));
|
|
1103
|
+
}
|
|
1104
|
+
return false;
|
|
1105
|
+
}
|
|
1106
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
|
1107
|
+
function replaceEqualDeep(a, b, depth = 0) {
|
|
1108
|
+
if (a === b) {
|
|
1109
|
+
return a;
|
|
1110
|
+
}
|
|
1111
|
+
if (depth > 500) return b;
|
|
1112
|
+
const array = isPlainArray(a) && isPlainArray(b);
|
|
1113
|
+
if (!array && !(isPlainObject(a) && isPlainObject(b))) return b;
|
|
1114
|
+
const aItems = array ? a : Object.keys(a);
|
|
1115
|
+
const aSize = aItems.length;
|
|
1116
|
+
const bItems = array ? b : Object.keys(b);
|
|
1117
|
+
const bSize = bItems.length;
|
|
1118
|
+
const copy = array ? new Array(bSize) : {};
|
|
1119
|
+
let equalItems = 0;
|
|
1120
|
+
for (let i = 0; i < bSize; i++) {
|
|
1121
|
+
const key = array ? i : bItems[i];
|
|
1122
|
+
const aItem = a[key];
|
|
1123
|
+
const bItem = b[key];
|
|
1124
|
+
if (aItem === bItem) {
|
|
1125
|
+
copy[key] = aItem;
|
|
1126
|
+
if (array ? i < aSize : hasOwn.call(a, key)) equalItems++;
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
|
|
1130
|
+
copy[key] = bItem;
|
|
1131
|
+
continue;
|
|
1132
|
+
}
|
|
1133
|
+
const v = replaceEqualDeep(aItem, bItem, depth + 1);
|
|
1134
|
+
copy[key] = v;
|
|
1135
|
+
if (v === aItem) equalItems++;
|
|
1136
|
+
}
|
|
1137
|
+
return aSize === bSize && equalItems === aSize ? a : copy;
|
|
1138
|
+
}
|
|
1139
|
+
function isPlainArray(value) {
|
|
1140
|
+
return Array.isArray(value) && value.length === Object.keys(value).length;
|
|
1141
|
+
}
|
|
1142
|
+
function isPlainObject(o) {
|
|
1143
|
+
if (!hasObjectPrototype(o)) {
|
|
1144
|
+
return false;
|
|
1145
|
+
}
|
|
1146
|
+
const ctor = o.constructor;
|
|
1147
|
+
if (ctor === void 0) {
|
|
1148
|
+
return true;
|
|
1149
|
+
}
|
|
1150
|
+
const prot = ctor.prototype;
|
|
1151
|
+
if (!hasObjectPrototype(prot)) {
|
|
1152
|
+
return false;
|
|
1153
|
+
}
|
|
1154
|
+
if (!prot.hasOwnProperty("isPrototypeOf")) {
|
|
1155
|
+
return false;
|
|
1156
|
+
}
|
|
1157
|
+
if (Object.getPrototypeOf(o) !== Object.prototype) {
|
|
1158
|
+
return false;
|
|
1159
|
+
}
|
|
1160
|
+
return true;
|
|
1161
|
+
}
|
|
1162
|
+
function hasObjectPrototype(o) {
|
|
1163
|
+
return Object.prototype.toString.call(o) === "[object Object]";
|
|
1164
|
+
}
|
|
1165
|
+
function sleep(timeout) {
|
|
1166
|
+
return new Promise((resolve) => {
|
|
1167
|
+
timeoutManager.setTimeout(resolve, timeout);
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
function replaceData(prevData, data, options) {
|
|
1171
|
+
if (typeof options.structuralSharing === "function") {
|
|
1172
|
+
return options.structuralSharing(prevData, data);
|
|
1173
|
+
} else if (options.structuralSharing !== false) {
|
|
1174
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1175
|
+
try {
|
|
1176
|
+
return replaceEqualDeep(prevData, data);
|
|
1177
|
+
} catch (error) {
|
|
1178
|
+
console.error(
|
|
1179
|
+
`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${options.queryHash}]: ${error}`
|
|
1180
|
+
);
|
|
1181
|
+
throw error;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
return replaceEqualDeep(prevData, data);
|
|
1185
|
+
}
|
|
1186
|
+
return data;
|
|
1187
|
+
}
|
|
1188
|
+
function addToEnd(items, item, max = 0) {
|
|
1189
|
+
const newItems = [...items, item];
|
|
1190
|
+
return max && newItems.length > max ? newItems.slice(1) : newItems;
|
|
1191
|
+
}
|
|
1192
|
+
function addToStart(items, item, max = 0) {
|
|
1193
|
+
const newItems = [item, ...items];
|
|
1194
|
+
return max && newItems.length > max ? newItems.slice(0, -1) : newItems;
|
|
1195
|
+
}
|
|
1196
|
+
var skipToken = /* @__PURE__ */ Symbol();
|
|
1197
|
+
function ensureQueryFn(options, fetchOptions) {
|
|
1198
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1199
|
+
if (options.queryFn === skipToken) {
|
|
1200
|
+
console.error(
|
|
1201
|
+
`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${options.queryHash}'`
|
|
1202
|
+
);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
if (!options.queryFn && fetchOptions?.initialPromise) {
|
|
1206
|
+
return () => fetchOptions.initialPromise;
|
|
1207
|
+
}
|
|
1208
|
+
if (!options.queryFn || options.queryFn === skipToken) {
|
|
1209
|
+
return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));
|
|
1210
|
+
}
|
|
1211
|
+
return options.queryFn;
|
|
1212
|
+
}
|
|
1213
|
+
function addConsumeAwareSignal(object, getSignal, onCancelled) {
|
|
1214
|
+
let consumed = false;
|
|
1215
|
+
let signal;
|
|
1216
|
+
Object.defineProperty(object, "signal", {
|
|
1217
|
+
enumerable: true,
|
|
1218
|
+
get: () => {
|
|
1219
|
+
signal ??= getSignal();
|
|
1220
|
+
if (consumed) {
|
|
1221
|
+
return signal;
|
|
1222
|
+
}
|
|
1223
|
+
consumed = true;
|
|
1224
|
+
if (signal.aborted) {
|
|
1225
|
+
onCancelled();
|
|
1226
|
+
} else {
|
|
1227
|
+
signal.addEventListener("abort", onCancelled, { once: true });
|
|
1228
|
+
}
|
|
1229
|
+
return signal;
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1232
|
+
return object;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/focusManager.js
|
|
1236
|
+
var FocusManager = class extends Subscribable {
|
|
1237
|
+
#focused;
|
|
1238
|
+
#cleanup;
|
|
1239
|
+
#setup;
|
|
1240
|
+
constructor() {
|
|
1241
|
+
super();
|
|
1242
|
+
this.#setup = (onFocus) => {
|
|
1243
|
+
if (!isServer && window.addEventListener) {
|
|
1244
|
+
const listener = () => onFocus();
|
|
1245
|
+
window.addEventListener("visibilitychange", listener, false);
|
|
1246
|
+
return () => {
|
|
1247
|
+
window.removeEventListener("visibilitychange", listener);
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
return;
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
onSubscribe() {
|
|
1254
|
+
if (!this.#cleanup) {
|
|
1255
|
+
this.setEventListener(this.#setup);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
onUnsubscribe() {
|
|
1259
|
+
if (!this.hasListeners()) {
|
|
1260
|
+
this.#cleanup?.();
|
|
1261
|
+
this.#cleanup = void 0;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
setEventListener(setup) {
|
|
1265
|
+
this.#setup = setup;
|
|
1266
|
+
this.#cleanup?.();
|
|
1267
|
+
this.#cleanup = setup((focused) => {
|
|
1268
|
+
if (typeof focused === "boolean") {
|
|
1269
|
+
this.setFocused(focused);
|
|
1270
|
+
} else {
|
|
1271
|
+
this.onFocus();
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
setFocused(focused) {
|
|
1276
|
+
const changed = this.#focused !== focused;
|
|
1277
|
+
if (changed) {
|
|
1278
|
+
this.#focused = focused;
|
|
1279
|
+
this.onFocus();
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
onFocus() {
|
|
1283
|
+
const isFocused = this.isFocused();
|
|
1284
|
+
this.listeners.forEach((listener) => {
|
|
1285
|
+
listener(isFocused);
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
isFocused() {
|
|
1289
|
+
if (typeof this.#focused === "boolean") {
|
|
1290
|
+
return this.#focused;
|
|
1291
|
+
}
|
|
1292
|
+
return globalThis.document?.visibilityState !== "hidden";
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
var focusManager = new FocusManager();
|
|
1296
|
+
|
|
1297
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/thenable.js
|
|
1298
|
+
function pendingThenable() {
|
|
1299
|
+
let resolve;
|
|
1300
|
+
let reject;
|
|
1301
|
+
const thenable = new Promise((_resolve, _reject) => {
|
|
1302
|
+
resolve = _resolve;
|
|
1303
|
+
reject = _reject;
|
|
1304
|
+
});
|
|
1305
|
+
thenable.status = "pending";
|
|
1306
|
+
thenable.catch(() => {
|
|
1307
|
+
});
|
|
1308
|
+
function finalize(data) {
|
|
1309
|
+
Object.assign(thenable, data);
|
|
1310
|
+
delete thenable.resolve;
|
|
1311
|
+
delete thenable.reject;
|
|
1312
|
+
}
|
|
1313
|
+
thenable.resolve = (value) => {
|
|
1314
|
+
finalize({
|
|
1315
|
+
status: "fulfilled",
|
|
1316
|
+
value
|
|
1317
|
+
});
|
|
1318
|
+
resolve(value);
|
|
1319
|
+
};
|
|
1320
|
+
thenable.reject = (reason) => {
|
|
1321
|
+
finalize({
|
|
1322
|
+
status: "rejected",
|
|
1323
|
+
reason
|
|
1324
|
+
});
|
|
1325
|
+
reject(reason);
|
|
1326
|
+
};
|
|
1327
|
+
return thenable;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/notifyManager.js
|
|
1331
|
+
var defaultScheduler = systemSetTimeoutZero;
|
|
1332
|
+
function createNotifyManager() {
|
|
1333
|
+
let queue = [];
|
|
1334
|
+
let transactions = 0;
|
|
1335
|
+
let notifyFn = (callback) => {
|
|
1336
|
+
callback();
|
|
1337
|
+
};
|
|
1338
|
+
let batchNotifyFn = (callback) => {
|
|
1339
|
+
callback();
|
|
1340
|
+
};
|
|
1341
|
+
let scheduleFn = defaultScheduler;
|
|
1342
|
+
const schedule = (callback) => {
|
|
1343
|
+
if (transactions) {
|
|
1344
|
+
queue.push(callback);
|
|
1345
|
+
} else {
|
|
1346
|
+
scheduleFn(() => {
|
|
1347
|
+
notifyFn(callback);
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
const flush = () => {
|
|
1352
|
+
const originalQueue = queue;
|
|
1353
|
+
queue = [];
|
|
1354
|
+
if (originalQueue.length) {
|
|
1355
|
+
scheduleFn(() => {
|
|
1356
|
+
batchNotifyFn(() => {
|
|
1357
|
+
originalQueue.forEach((callback) => {
|
|
1358
|
+
notifyFn(callback);
|
|
1359
|
+
});
|
|
1360
|
+
});
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
return {
|
|
1365
|
+
batch: (callback) => {
|
|
1366
|
+
let result;
|
|
1367
|
+
transactions++;
|
|
1368
|
+
try {
|
|
1369
|
+
result = callback();
|
|
1370
|
+
} finally {
|
|
1371
|
+
transactions--;
|
|
1372
|
+
if (!transactions) {
|
|
1373
|
+
flush();
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
return result;
|
|
1377
|
+
},
|
|
1378
|
+
/**
|
|
1379
|
+
* All calls to the wrapped function will be batched.
|
|
1380
|
+
*/
|
|
1381
|
+
batchCalls: (callback) => {
|
|
1382
|
+
return (...args) => {
|
|
1383
|
+
schedule(() => {
|
|
1384
|
+
callback(...args);
|
|
1385
|
+
});
|
|
1386
|
+
};
|
|
1387
|
+
},
|
|
1388
|
+
schedule,
|
|
1389
|
+
/**
|
|
1390
|
+
* Use this method to set a custom notify function.
|
|
1391
|
+
* This can be used to for example wrap notifications with `React.act` while running tests.
|
|
1392
|
+
*/
|
|
1393
|
+
setNotifyFunction: (fn) => {
|
|
1394
|
+
notifyFn = fn;
|
|
1395
|
+
},
|
|
1396
|
+
/**
|
|
1397
|
+
* Use this method to set a custom function to batch notifications together into a single tick.
|
|
1398
|
+
* By default React Query will use the batch function provided by ReactDOM or React Native.
|
|
1399
|
+
*/
|
|
1400
|
+
setBatchNotifyFunction: (fn) => {
|
|
1401
|
+
batchNotifyFn = fn;
|
|
1402
|
+
},
|
|
1403
|
+
setScheduler: (fn) => {
|
|
1404
|
+
scheduleFn = fn;
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
var notifyManager = createNotifyManager();
|
|
1409
|
+
|
|
1410
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/onlineManager.js
|
|
1411
|
+
var OnlineManager = class extends Subscribable {
|
|
1412
|
+
#online = true;
|
|
1413
|
+
#cleanup;
|
|
1414
|
+
#setup;
|
|
1415
|
+
constructor() {
|
|
1416
|
+
super();
|
|
1417
|
+
this.#setup = (onOnline) => {
|
|
1418
|
+
if (!isServer && window.addEventListener) {
|
|
1419
|
+
const onlineListener = () => onOnline(true);
|
|
1420
|
+
const offlineListener = () => onOnline(false);
|
|
1421
|
+
window.addEventListener("online", onlineListener, false);
|
|
1422
|
+
window.addEventListener("offline", offlineListener, false);
|
|
1423
|
+
return () => {
|
|
1424
|
+
window.removeEventListener("online", onlineListener);
|
|
1425
|
+
window.removeEventListener("offline", offlineListener);
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1428
|
+
return;
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
onSubscribe() {
|
|
1432
|
+
if (!this.#cleanup) {
|
|
1433
|
+
this.setEventListener(this.#setup);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
onUnsubscribe() {
|
|
1437
|
+
if (!this.hasListeners()) {
|
|
1438
|
+
this.#cleanup?.();
|
|
1439
|
+
this.#cleanup = void 0;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
setEventListener(setup) {
|
|
1443
|
+
this.#setup = setup;
|
|
1444
|
+
this.#cleanup?.();
|
|
1445
|
+
this.#cleanup = setup(this.setOnline.bind(this));
|
|
1446
|
+
}
|
|
1447
|
+
setOnline(online) {
|
|
1448
|
+
const changed = this.#online !== online;
|
|
1449
|
+
if (changed) {
|
|
1450
|
+
this.#online = online;
|
|
1451
|
+
this.listeners.forEach((listener) => {
|
|
1452
|
+
listener(online);
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
isOnline() {
|
|
1457
|
+
return this.#online;
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
var onlineManager = new OnlineManager();
|
|
1461
|
+
|
|
1462
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/retryer.js
|
|
1463
|
+
function defaultRetryDelay(failureCount) {
|
|
1464
|
+
return Math.min(1e3 * 2 ** failureCount, 3e4);
|
|
1465
|
+
}
|
|
1466
|
+
function canFetch(networkMode) {
|
|
1467
|
+
return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
|
|
1468
|
+
}
|
|
1469
|
+
var CancelledError = class extends Error {
|
|
1470
|
+
constructor(options) {
|
|
1471
|
+
super("CancelledError");
|
|
1472
|
+
this.revert = options?.revert;
|
|
1473
|
+
this.silent = options?.silent;
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1476
|
+
function createRetryer(config) {
|
|
1477
|
+
let isRetryCancelled = false;
|
|
1478
|
+
let failureCount = 0;
|
|
1479
|
+
let continueFn;
|
|
1480
|
+
const thenable = pendingThenable();
|
|
1481
|
+
const isResolved = () => thenable.status !== "pending";
|
|
1482
|
+
const cancel = (cancelOptions) => {
|
|
1483
|
+
if (!isResolved()) {
|
|
1484
|
+
const error = new CancelledError(cancelOptions);
|
|
1485
|
+
reject(error);
|
|
1486
|
+
config.onCancel?.(error);
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
const cancelRetry = () => {
|
|
1490
|
+
isRetryCancelled = true;
|
|
1491
|
+
};
|
|
1492
|
+
const continueRetry = () => {
|
|
1493
|
+
isRetryCancelled = false;
|
|
1494
|
+
};
|
|
1495
|
+
const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
|
|
1496
|
+
const canStart = () => canFetch(config.networkMode) && config.canRun();
|
|
1497
|
+
const resolve = (value) => {
|
|
1498
|
+
if (!isResolved()) {
|
|
1499
|
+
continueFn?.();
|
|
1500
|
+
thenable.resolve(value);
|
|
1501
|
+
}
|
|
1502
|
+
};
|
|
1503
|
+
const reject = (value) => {
|
|
1504
|
+
if (!isResolved()) {
|
|
1505
|
+
continueFn?.();
|
|
1506
|
+
thenable.reject(value);
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
const pause = () => {
|
|
1510
|
+
return new Promise((continueResolve) => {
|
|
1511
|
+
continueFn = (value) => {
|
|
1512
|
+
if (isResolved() || canContinue()) {
|
|
1513
|
+
continueResolve(value);
|
|
1514
|
+
}
|
|
1515
|
+
};
|
|
1516
|
+
config.onPause?.();
|
|
1517
|
+
}).then(() => {
|
|
1518
|
+
continueFn = void 0;
|
|
1519
|
+
if (!isResolved()) {
|
|
1520
|
+
config.onContinue?.();
|
|
1521
|
+
}
|
|
1522
|
+
});
|
|
1523
|
+
};
|
|
1524
|
+
const run = () => {
|
|
1525
|
+
if (isResolved()) {
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
let promiseOrValue;
|
|
1529
|
+
const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
|
|
1530
|
+
try {
|
|
1531
|
+
promiseOrValue = initialPromise ?? config.fn();
|
|
1532
|
+
} catch (error) {
|
|
1533
|
+
promiseOrValue = Promise.reject(error);
|
|
1534
|
+
}
|
|
1535
|
+
Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
|
|
1536
|
+
if (isResolved()) {
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1539
|
+
const retry = config.retry ?? (isServer ? 0 : 3);
|
|
1540
|
+
const retryDelay = config.retryDelay ?? defaultRetryDelay;
|
|
1541
|
+
const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
|
|
1542
|
+
const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
|
|
1543
|
+
if (isRetryCancelled || !shouldRetry) {
|
|
1544
|
+
reject(error);
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
failureCount++;
|
|
1548
|
+
config.onFail?.(failureCount, error);
|
|
1549
|
+
sleep(delay).then(() => {
|
|
1550
|
+
return canContinue() ? void 0 : pause();
|
|
1551
|
+
}).then(() => {
|
|
1552
|
+
if (isRetryCancelled) {
|
|
1553
|
+
reject(error);
|
|
1554
|
+
} else {
|
|
1555
|
+
run();
|
|
1556
|
+
}
|
|
1557
|
+
});
|
|
1558
|
+
});
|
|
1559
|
+
};
|
|
1560
|
+
return {
|
|
1561
|
+
promise: thenable,
|
|
1562
|
+
status: () => thenable.status,
|
|
1563
|
+
cancel,
|
|
1564
|
+
continue: () => {
|
|
1565
|
+
continueFn?.();
|
|
1566
|
+
return thenable;
|
|
1567
|
+
},
|
|
1568
|
+
cancelRetry,
|
|
1569
|
+
continueRetry,
|
|
1570
|
+
canStart,
|
|
1571
|
+
start: () => {
|
|
1572
|
+
if (canStart()) {
|
|
1573
|
+
run();
|
|
1574
|
+
} else {
|
|
1575
|
+
pause().then(run);
|
|
1576
|
+
}
|
|
1577
|
+
return thenable;
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/removable.js
|
|
1583
|
+
var Removable = class {
|
|
1584
|
+
#gcTimeout;
|
|
1585
|
+
destroy() {
|
|
1586
|
+
this.clearGcTimeout();
|
|
1587
|
+
}
|
|
1588
|
+
scheduleGc() {
|
|
1589
|
+
this.clearGcTimeout();
|
|
1590
|
+
if (isValidTimeout(this.gcTime)) {
|
|
1591
|
+
this.#gcTimeout = timeoutManager.setTimeout(() => {
|
|
1592
|
+
this.optionalRemove();
|
|
1593
|
+
}, this.gcTime);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
updateGcTime(newGcTime) {
|
|
1597
|
+
this.gcTime = Math.max(
|
|
1598
|
+
this.gcTime || 0,
|
|
1599
|
+
newGcTime ?? (isServer ? Infinity : 5 * 60 * 1e3)
|
|
1600
|
+
);
|
|
1601
|
+
}
|
|
1602
|
+
clearGcTimeout() {
|
|
1603
|
+
if (this.#gcTimeout) {
|
|
1604
|
+
timeoutManager.clearTimeout(this.#gcTimeout);
|
|
1605
|
+
this.#gcTimeout = void 0;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/query.js
|
|
1611
|
+
var Query = class extends Removable {
|
|
1612
|
+
#initialState;
|
|
1613
|
+
#revertState;
|
|
1614
|
+
#cache;
|
|
1615
|
+
#client;
|
|
1616
|
+
#retryer;
|
|
1617
|
+
#defaultOptions;
|
|
1618
|
+
#abortSignalConsumed;
|
|
1619
|
+
constructor(config) {
|
|
1620
|
+
super();
|
|
1621
|
+
this.#abortSignalConsumed = false;
|
|
1622
|
+
this.#defaultOptions = config.defaultOptions;
|
|
1623
|
+
this.setOptions(config.options);
|
|
1624
|
+
this.observers = [];
|
|
1625
|
+
this.#client = config.client;
|
|
1626
|
+
this.#cache = this.#client.getQueryCache();
|
|
1627
|
+
this.queryKey = config.queryKey;
|
|
1628
|
+
this.queryHash = config.queryHash;
|
|
1629
|
+
this.#initialState = getDefaultState(this.options);
|
|
1630
|
+
this.state = config.state ?? this.#initialState;
|
|
1631
|
+
this.scheduleGc();
|
|
1632
|
+
}
|
|
1633
|
+
get meta() {
|
|
1634
|
+
return this.options.meta;
|
|
1635
|
+
}
|
|
1636
|
+
get promise() {
|
|
1637
|
+
return this.#retryer?.promise;
|
|
1638
|
+
}
|
|
1639
|
+
setOptions(options) {
|
|
1640
|
+
this.options = { ...this.#defaultOptions, ...options };
|
|
1641
|
+
this.updateGcTime(this.options.gcTime);
|
|
1642
|
+
if (this.state && this.state.data === void 0) {
|
|
1643
|
+
const defaultState = getDefaultState(this.options);
|
|
1644
|
+
if (defaultState.data !== void 0) {
|
|
1645
|
+
this.setState(
|
|
1646
|
+
successState(defaultState.data, defaultState.dataUpdatedAt)
|
|
1647
|
+
);
|
|
1648
|
+
this.#initialState = defaultState;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
optionalRemove() {
|
|
1653
|
+
if (!this.observers.length && this.state.fetchStatus === "idle") {
|
|
1654
|
+
this.#cache.remove(this);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
setData(newData, options) {
|
|
1658
|
+
const data = replaceData(this.state.data, newData, this.options);
|
|
1659
|
+
this.#dispatch({
|
|
1660
|
+
data,
|
|
1661
|
+
type: "success",
|
|
1662
|
+
dataUpdatedAt: options?.updatedAt,
|
|
1663
|
+
manual: options?.manual
|
|
1664
|
+
});
|
|
1665
|
+
return data;
|
|
1666
|
+
}
|
|
1667
|
+
setState(state, setStateOptions) {
|
|
1668
|
+
this.#dispatch({ type: "setState", state, setStateOptions });
|
|
1669
|
+
}
|
|
1670
|
+
cancel(options) {
|
|
1671
|
+
const promise = this.#retryer?.promise;
|
|
1672
|
+
this.#retryer?.cancel(options);
|
|
1673
|
+
return promise ? promise.then(noop).catch(noop) : Promise.resolve();
|
|
1674
|
+
}
|
|
1675
|
+
destroy() {
|
|
1676
|
+
super.destroy();
|
|
1677
|
+
this.cancel({ silent: true });
|
|
1678
|
+
}
|
|
1679
|
+
reset() {
|
|
1680
|
+
this.destroy();
|
|
1681
|
+
this.setState(this.#initialState);
|
|
1682
|
+
}
|
|
1683
|
+
isActive() {
|
|
1684
|
+
return this.observers.some(
|
|
1685
|
+
(observer) => resolveEnabled(observer.options.enabled, this) !== false
|
|
1686
|
+
);
|
|
1687
|
+
}
|
|
1688
|
+
isDisabled() {
|
|
1689
|
+
if (this.getObserversCount() > 0) {
|
|
1690
|
+
return !this.isActive();
|
|
1691
|
+
}
|
|
1692
|
+
return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
1693
|
+
}
|
|
1694
|
+
isStatic() {
|
|
1695
|
+
if (this.getObserversCount() > 0) {
|
|
1696
|
+
return this.observers.some(
|
|
1697
|
+
(observer) => resolveStaleTime(observer.options.staleTime, this) === "static"
|
|
1698
|
+
);
|
|
1699
|
+
}
|
|
1700
|
+
return false;
|
|
1701
|
+
}
|
|
1702
|
+
isStale() {
|
|
1703
|
+
if (this.getObserversCount() > 0) {
|
|
1704
|
+
return this.observers.some(
|
|
1705
|
+
(observer) => observer.getCurrentResult().isStale
|
|
1706
|
+
);
|
|
1707
|
+
}
|
|
1708
|
+
return this.state.data === void 0 || this.state.isInvalidated;
|
|
1709
|
+
}
|
|
1710
|
+
isStaleByTime(staleTime = 0) {
|
|
1711
|
+
if (this.state.data === void 0) {
|
|
1712
|
+
return true;
|
|
1713
|
+
}
|
|
1714
|
+
if (staleTime === "static") {
|
|
1715
|
+
return false;
|
|
1716
|
+
}
|
|
1717
|
+
if (this.state.isInvalidated) {
|
|
1718
|
+
return true;
|
|
1719
|
+
}
|
|
1720
|
+
return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
|
|
1721
|
+
}
|
|
1722
|
+
onFocus() {
|
|
1723
|
+
const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());
|
|
1724
|
+
observer?.refetch({ cancelRefetch: false });
|
|
1725
|
+
this.#retryer?.continue();
|
|
1726
|
+
}
|
|
1727
|
+
onOnline() {
|
|
1728
|
+
const observer = this.observers.find((x) => x.shouldFetchOnReconnect());
|
|
1729
|
+
observer?.refetch({ cancelRefetch: false });
|
|
1730
|
+
this.#retryer?.continue();
|
|
1731
|
+
}
|
|
1732
|
+
addObserver(observer) {
|
|
1733
|
+
if (!this.observers.includes(observer)) {
|
|
1734
|
+
this.observers.push(observer);
|
|
1735
|
+
this.clearGcTimeout();
|
|
1736
|
+
this.#cache.notify({ type: "observerAdded", query: this, observer });
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
removeObserver(observer) {
|
|
1740
|
+
if (this.observers.includes(observer)) {
|
|
1741
|
+
this.observers = this.observers.filter((x) => x !== observer);
|
|
1742
|
+
if (!this.observers.length) {
|
|
1743
|
+
if (this.#retryer) {
|
|
1744
|
+
if (this.#abortSignalConsumed) {
|
|
1745
|
+
this.#retryer.cancel({ revert: true });
|
|
1746
|
+
} else {
|
|
1747
|
+
this.#retryer.cancelRetry();
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
this.scheduleGc();
|
|
1751
|
+
}
|
|
1752
|
+
this.#cache.notify({ type: "observerRemoved", query: this, observer });
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
getObserversCount() {
|
|
1756
|
+
return this.observers.length;
|
|
1757
|
+
}
|
|
1758
|
+
invalidate() {
|
|
1759
|
+
if (!this.state.isInvalidated) {
|
|
1760
|
+
this.#dispatch({ type: "invalidate" });
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
async fetch(options, fetchOptions) {
|
|
1764
|
+
if (this.state.fetchStatus !== "idle" && // If the promise in the retryer is already rejected, we have to definitely
|
|
1765
|
+
// re-start the fetch; there is a chance that the query is still in a
|
|
1766
|
+
// pending state when that happens
|
|
1767
|
+
this.#retryer?.status() !== "rejected") {
|
|
1768
|
+
if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {
|
|
1769
|
+
this.cancel({ silent: true });
|
|
1770
|
+
} else if (this.#retryer) {
|
|
1771
|
+
this.#retryer.continueRetry();
|
|
1772
|
+
return this.#retryer.promise;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
if (options) {
|
|
1776
|
+
this.setOptions(options);
|
|
1777
|
+
}
|
|
1778
|
+
if (!this.options.queryFn) {
|
|
1779
|
+
const observer = this.observers.find((x) => x.options.queryFn);
|
|
1780
|
+
if (observer) {
|
|
1781
|
+
this.setOptions(observer.options);
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1785
|
+
if (!Array.isArray(this.options.queryKey)) {
|
|
1786
|
+
console.error(
|
|
1787
|
+
`As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`
|
|
1788
|
+
);
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
const abortController = new AbortController();
|
|
1792
|
+
const addSignalProperty = (object) => {
|
|
1793
|
+
Object.defineProperty(object, "signal", {
|
|
1794
|
+
enumerable: true,
|
|
1795
|
+
get: () => {
|
|
1796
|
+
this.#abortSignalConsumed = true;
|
|
1797
|
+
return abortController.signal;
|
|
1798
|
+
}
|
|
1799
|
+
});
|
|
1800
|
+
};
|
|
1801
|
+
const fetchFn = () => {
|
|
1802
|
+
const queryFn = ensureQueryFn(this.options, fetchOptions);
|
|
1803
|
+
const createQueryFnContext = () => {
|
|
1804
|
+
const queryFnContext2 = {
|
|
1805
|
+
client: this.#client,
|
|
1806
|
+
queryKey: this.queryKey,
|
|
1807
|
+
meta: this.meta
|
|
1808
|
+
};
|
|
1809
|
+
addSignalProperty(queryFnContext2);
|
|
1810
|
+
return queryFnContext2;
|
|
1811
|
+
};
|
|
1812
|
+
const queryFnContext = createQueryFnContext();
|
|
1813
|
+
this.#abortSignalConsumed = false;
|
|
1814
|
+
if (this.options.persister) {
|
|
1815
|
+
return this.options.persister(
|
|
1816
|
+
queryFn,
|
|
1817
|
+
queryFnContext,
|
|
1818
|
+
this
|
|
1819
|
+
);
|
|
1820
|
+
}
|
|
1821
|
+
return queryFn(queryFnContext);
|
|
1822
|
+
};
|
|
1823
|
+
const createFetchContext = () => {
|
|
1824
|
+
const context2 = {
|
|
1825
|
+
fetchOptions,
|
|
1826
|
+
options: this.options,
|
|
1827
|
+
queryKey: this.queryKey,
|
|
1828
|
+
client: this.#client,
|
|
1829
|
+
state: this.state,
|
|
1830
|
+
fetchFn
|
|
1831
|
+
};
|
|
1832
|
+
addSignalProperty(context2);
|
|
1833
|
+
return context2;
|
|
1834
|
+
};
|
|
1835
|
+
const context = createFetchContext();
|
|
1836
|
+
this.options.behavior?.onFetch(context, this);
|
|
1837
|
+
this.#revertState = this.state;
|
|
1838
|
+
if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
|
|
1839
|
+
this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
|
|
1840
|
+
}
|
|
1841
|
+
this.#retryer = createRetryer({
|
|
1842
|
+
initialPromise: fetchOptions?.initialPromise,
|
|
1843
|
+
fn: context.fetchFn,
|
|
1844
|
+
onCancel: (error) => {
|
|
1845
|
+
if (error instanceof CancelledError && error.revert) {
|
|
1846
|
+
this.setState({
|
|
1847
|
+
...this.#revertState,
|
|
1848
|
+
fetchStatus: "idle"
|
|
1849
|
+
});
|
|
1850
|
+
}
|
|
1851
|
+
abortController.abort();
|
|
1852
|
+
},
|
|
1853
|
+
onFail: (failureCount, error) => {
|
|
1854
|
+
this.#dispatch({ type: "failed", failureCount, error });
|
|
1855
|
+
},
|
|
1856
|
+
onPause: () => {
|
|
1857
|
+
this.#dispatch({ type: "pause" });
|
|
1858
|
+
},
|
|
1859
|
+
onContinue: () => {
|
|
1860
|
+
this.#dispatch({ type: "continue" });
|
|
1861
|
+
},
|
|
1862
|
+
retry: context.options.retry,
|
|
1863
|
+
retryDelay: context.options.retryDelay,
|
|
1864
|
+
networkMode: context.options.networkMode,
|
|
1865
|
+
canRun: () => true
|
|
1866
|
+
});
|
|
1867
|
+
try {
|
|
1868
|
+
const data = await this.#retryer.start();
|
|
1869
|
+
if (data === void 0) {
|
|
1870
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1871
|
+
console.error(
|
|
1872
|
+
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
1873
|
+
);
|
|
1874
|
+
}
|
|
1875
|
+
throw new Error(`${this.queryHash} data is undefined`);
|
|
1876
|
+
}
|
|
1877
|
+
this.setData(data);
|
|
1878
|
+
this.#cache.config.onSuccess?.(data, this);
|
|
1879
|
+
this.#cache.config.onSettled?.(
|
|
1880
|
+
data,
|
|
1881
|
+
this.state.error,
|
|
1882
|
+
this
|
|
1883
|
+
);
|
|
1884
|
+
return data;
|
|
1885
|
+
} catch (error) {
|
|
1886
|
+
if (error instanceof CancelledError) {
|
|
1887
|
+
if (error.silent) {
|
|
1888
|
+
return this.#retryer.promise;
|
|
1889
|
+
} else if (error.revert) {
|
|
1890
|
+
if (this.state.data === void 0) {
|
|
1891
|
+
throw error;
|
|
1892
|
+
}
|
|
1893
|
+
return this.state.data;
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
this.#dispatch({
|
|
1897
|
+
type: "error",
|
|
1898
|
+
error
|
|
1899
|
+
});
|
|
1900
|
+
this.#cache.config.onError?.(
|
|
1901
|
+
error,
|
|
1902
|
+
this
|
|
1903
|
+
);
|
|
1904
|
+
this.#cache.config.onSettled?.(
|
|
1905
|
+
this.state.data,
|
|
1906
|
+
error,
|
|
1907
|
+
this
|
|
1908
|
+
);
|
|
1909
|
+
throw error;
|
|
1910
|
+
} finally {
|
|
1911
|
+
this.scheduleGc();
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
#dispatch(action) {
|
|
1915
|
+
const reducer = (state) => {
|
|
1916
|
+
switch (action.type) {
|
|
1917
|
+
case "failed":
|
|
1918
|
+
return {
|
|
1919
|
+
...state,
|
|
1920
|
+
fetchFailureCount: action.failureCount,
|
|
1921
|
+
fetchFailureReason: action.error
|
|
1922
|
+
};
|
|
1923
|
+
case "pause":
|
|
1924
|
+
return {
|
|
1925
|
+
...state,
|
|
1926
|
+
fetchStatus: "paused"
|
|
1927
|
+
};
|
|
1928
|
+
case "continue":
|
|
1929
|
+
return {
|
|
1930
|
+
...state,
|
|
1931
|
+
fetchStatus: "fetching"
|
|
1932
|
+
};
|
|
1933
|
+
case "fetch":
|
|
1934
|
+
return {
|
|
1935
|
+
...state,
|
|
1936
|
+
...fetchState(state.data, this.options),
|
|
1937
|
+
fetchMeta: action.meta ?? null
|
|
1938
|
+
};
|
|
1939
|
+
case "success":
|
|
1940
|
+
const newState = {
|
|
1941
|
+
...state,
|
|
1942
|
+
...successState(action.data, action.dataUpdatedAt),
|
|
1943
|
+
dataUpdateCount: state.dataUpdateCount + 1,
|
|
1944
|
+
...!action.manual && {
|
|
1945
|
+
fetchStatus: "idle",
|
|
1946
|
+
fetchFailureCount: 0,
|
|
1947
|
+
fetchFailureReason: null
|
|
1948
|
+
}
|
|
1949
|
+
};
|
|
1950
|
+
this.#revertState = action.manual ? newState : void 0;
|
|
1951
|
+
return newState;
|
|
1952
|
+
case "error":
|
|
1953
|
+
const error = action.error;
|
|
1954
|
+
return {
|
|
1955
|
+
...state,
|
|
1956
|
+
error,
|
|
1957
|
+
errorUpdateCount: state.errorUpdateCount + 1,
|
|
1958
|
+
errorUpdatedAt: Date.now(),
|
|
1959
|
+
fetchFailureCount: state.fetchFailureCount + 1,
|
|
1960
|
+
fetchFailureReason: error,
|
|
1961
|
+
fetchStatus: "idle",
|
|
1962
|
+
status: "error",
|
|
1963
|
+
// flag existing data as invalidated if we get a background error
|
|
1964
|
+
// note that "no data" always means stale so we can set unconditionally here
|
|
1965
|
+
isInvalidated: true
|
|
1966
|
+
};
|
|
1967
|
+
case "invalidate":
|
|
1968
|
+
return {
|
|
1969
|
+
...state,
|
|
1970
|
+
isInvalidated: true
|
|
1971
|
+
};
|
|
1972
|
+
case "setState":
|
|
1973
|
+
return {
|
|
1974
|
+
...state,
|
|
1975
|
+
...action.state
|
|
1976
|
+
};
|
|
1977
|
+
}
|
|
1978
|
+
};
|
|
1979
|
+
this.state = reducer(this.state);
|
|
1980
|
+
notifyManager.batch(() => {
|
|
1981
|
+
this.observers.forEach((observer) => {
|
|
1982
|
+
observer.onQueryUpdate();
|
|
1983
|
+
});
|
|
1984
|
+
this.#cache.notify({ query: this, type: "updated", action });
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
function fetchState(data, options) {
|
|
1989
|
+
return {
|
|
1990
|
+
fetchFailureCount: 0,
|
|
1991
|
+
fetchFailureReason: null,
|
|
1992
|
+
fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
|
|
1993
|
+
...data === void 0 && {
|
|
1994
|
+
error: null,
|
|
1995
|
+
status: "pending"
|
|
1996
|
+
}
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
function successState(data, dataUpdatedAt) {
|
|
2000
|
+
return {
|
|
2001
|
+
data,
|
|
2002
|
+
dataUpdatedAt: dataUpdatedAt ?? Date.now(),
|
|
2003
|
+
error: null,
|
|
2004
|
+
isInvalidated: false,
|
|
2005
|
+
status: "success"
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
function getDefaultState(options) {
|
|
2009
|
+
const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
|
|
2010
|
+
const hasData = data !== void 0;
|
|
2011
|
+
const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
|
|
2012
|
+
return {
|
|
2013
|
+
data,
|
|
2014
|
+
dataUpdateCount: 0,
|
|
2015
|
+
dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
|
|
2016
|
+
error: null,
|
|
2017
|
+
errorUpdateCount: 0,
|
|
2018
|
+
errorUpdatedAt: 0,
|
|
2019
|
+
fetchFailureCount: 0,
|
|
2020
|
+
fetchFailureReason: null,
|
|
2021
|
+
fetchMeta: null,
|
|
2022
|
+
isInvalidated: false,
|
|
2023
|
+
status: hasData ? "success" : "pending",
|
|
2024
|
+
fetchStatus: "idle"
|
|
2025
|
+
};
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js
|
|
2029
|
+
function infiniteQueryBehavior(pages) {
|
|
2030
|
+
return {
|
|
2031
|
+
onFetch: (context, query) => {
|
|
2032
|
+
const options = context.options;
|
|
2033
|
+
const direction = context.fetchOptions?.meta?.fetchMore?.direction;
|
|
2034
|
+
const oldPages = context.state.data?.pages || [];
|
|
2035
|
+
const oldPageParams = context.state.data?.pageParams || [];
|
|
2036
|
+
let result = { pages: [], pageParams: [] };
|
|
2037
|
+
let currentPage = 0;
|
|
2038
|
+
const fetchFn = async () => {
|
|
2039
|
+
let cancelled = false;
|
|
2040
|
+
const addSignalProperty = (object) => {
|
|
2041
|
+
addConsumeAwareSignal(
|
|
2042
|
+
object,
|
|
2043
|
+
() => context.signal,
|
|
2044
|
+
() => cancelled = true
|
|
2045
|
+
);
|
|
2046
|
+
};
|
|
2047
|
+
const queryFn = ensureQueryFn(context.options, context.fetchOptions);
|
|
2048
|
+
const fetchPage = async (data, param, previous) => {
|
|
2049
|
+
if (cancelled) {
|
|
2050
|
+
return Promise.reject();
|
|
2051
|
+
}
|
|
2052
|
+
if (param == null && data.pages.length) {
|
|
2053
|
+
return Promise.resolve(data);
|
|
2054
|
+
}
|
|
2055
|
+
const createQueryFnContext = () => {
|
|
2056
|
+
const queryFnContext2 = {
|
|
2057
|
+
client: context.client,
|
|
2058
|
+
queryKey: context.queryKey,
|
|
2059
|
+
pageParam: param,
|
|
2060
|
+
direction: previous ? "backward" : "forward",
|
|
2061
|
+
meta: context.options.meta
|
|
2062
|
+
};
|
|
2063
|
+
addSignalProperty(queryFnContext2);
|
|
2064
|
+
return queryFnContext2;
|
|
2065
|
+
};
|
|
2066
|
+
const queryFnContext = createQueryFnContext();
|
|
2067
|
+
const page = await queryFn(queryFnContext);
|
|
2068
|
+
const { maxPages } = context.options;
|
|
2069
|
+
const addTo = previous ? addToStart : addToEnd;
|
|
2070
|
+
return {
|
|
2071
|
+
pages: addTo(data.pages, page, maxPages),
|
|
2072
|
+
pageParams: addTo(data.pageParams, param, maxPages)
|
|
2073
|
+
};
|
|
2074
|
+
};
|
|
2075
|
+
if (direction && oldPages.length) {
|
|
2076
|
+
const previous = direction === "backward";
|
|
2077
|
+
const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
|
|
2078
|
+
const oldData = {
|
|
2079
|
+
pages: oldPages,
|
|
2080
|
+
pageParams: oldPageParams
|
|
2081
|
+
};
|
|
2082
|
+
const param = pageParamFn(options, oldData);
|
|
2083
|
+
result = await fetchPage(oldData, param, previous);
|
|
2084
|
+
} else {
|
|
2085
|
+
const remainingPages = pages ?? oldPages.length;
|
|
2086
|
+
do {
|
|
2087
|
+
const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
|
|
2088
|
+
if (currentPage > 0 && param == null) {
|
|
2089
|
+
break;
|
|
2090
|
+
}
|
|
2091
|
+
result = await fetchPage(result, param);
|
|
2092
|
+
currentPage++;
|
|
2093
|
+
} while (currentPage < remainingPages);
|
|
2094
|
+
}
|
|
2095
|
+
return result;
|
|
2096
|
+
};
|
|
2097
|
+
if (context.options.persister) {
|
|
2098
|
+
context.fetchFn = () => {
|
|
2099
|
+
return context.options.persister?.(
|
|
2100
|
+
fetchFn,
|
|
2101
|
+
{
|
|
2102
|
+
client: context.client,
|
|
2103
|
+
queryKey: context.queryKey,
|
|
2104
|
+
meta: context.options.meta,
|
|
2105
|
+
signal: context.signal
|
|
2106
|
+
},
|
|
2107
|
+
query
|
|
2108
|
+
);
|
|
2109
|
+
};
|
|
2110
|
+
} else {
|
|
2111
|
+
context.fetchFn = fetchFn;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
};
|
|
2115
|
+
}
|
|
2116
|
+
function getNextPageParam(options, { pages, pageParams }) {
|
|
2117
|
+
const lastIndex = pages.length - 1;
|
|
2118
|
+
return pages.length > 0 ? options.getNextPageParam(
|
|
2119
|
+
pages[lastIndex],
|
|
2120
|
+
pages,
|
|
2121
|
+
pageParams[lastIndex],
|
|
2122
|
+
pageParams
|
|
2123
|
+
) : void 0;
|
|
2124
|
+
}
|
|
2125
|
+
function getPreviousPageParam(options, { pages, pageParams }) {
|
|
2126
|
+
return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/mutation.js
|
|
2130
|
+
var Mutation = class extends Removable {
|
|
2131
|
+
#client;
|
|
2132
|
+
#observers;
|
|
2133
|
+
#mutationCache;
|
|
2134
|
+
#retryer;
|
|
2135
|
+
constructor(config) {
|
|
2136
|
+
super();
|
|
2137
|
+
this.#client = config.client;
|
|
2138
|
+
this.mutationId = config.mutationId;
|
|
2139
|
+
this.#mutationCache = config.mutationCache;
|
|
2140
|
+
this.#observers = [];
|
|
2141
|
+
this.state = config.state || getDefaultState2();
|
|
2142
|
+
this.setOptions(config.options);
|
|
2143
|
+
this.scheduleGc();
|
|
2144
|
+
}
|
|
2145
|
+
setOptions(options) {
|
|
2146
|
+
this.options = options;
|
|
2147
|
+
this.updateGcTime(this.options.gcTime);
|
|
2148
|
+
}
|
|
2149
|
+
get meta() {
|
|
2150
|
+
return this.options.meta;
|
|
2151
|
+
}
|
|
2152
|
+
addObserver(observer) {
|
|
2153
|
+
if (!this.#observers.includes(observer)) {
|
|
2154
|
+
this.#observers.push(observer);
|
|
2155
|
+
this.clearGcTimeout();
|
|
2156
|
+
this.#mutationCache.notify({
|
|
2157
|
+
type: "observerAdded",
|
|
2158
|
+
mutation: this,
|
|
2159
|
+
observer
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
removeObserver(observer) {
|
|
2164
|
+
this.#observers = this.#observers.filter((x) => x !== observer);
|
|
2165
|
+
this.scheduleGc();
|
|
2166
|
+
this.#mutationCache.notify({
|
|
2167
|
+
type: "observerRemoved",
|
|
2168
|
+
mutation: this,
|
|
2169
|
+
observer
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
optionalRemove() {
|
|
2173
|
+
if (!this.#observers.length) {
|
|
2174
|
+
if (this.state.status === "pending") {
|
|
2175
|
+
this.scheduleGc();
|
|
2176
|
+
} else {
|
|
2177
|
+
this.#mutationCache.remove(this);
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
continue() {
|
|
2182
|
+
return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
2183
|
+
this.execute(this.state.variables);
|
|
2184
|
+
}
|
|
2185
|
+
async execute(variables) {
|
|
2186
|
+
const onContinue = () => {
|
|
2187
|
+
this.#dispatch({ type: "continue" });
|
|
2188
|
+
};
|
|
2189
|
+
const mutationFnContext = {
|
|
2190
|
+
client: this.#client,
|
|
2191
|
+
meta: this.options.meta,
|
|
2192
|
+
mutationKey: this.options.mutationKey
|
|
2193
|
+
};
|
|
2194
|
+
this.#retryer = createRetryer({
|
|
2195
|
+
fn: () => {
|
|
2196
|
+
if (!this.options.mutationFn) {
|
|
2197
|
+
return Promise.reject(new Error("No mutationFn found"));
|
|
2198
|
+
}
|
|
2199
|
+
return this.options.mutationFn(variables, mutationFnContext);
|
|
2200
|
+
},
|
|
2201
|
+
onFail: (failureCount, error) => {
|
|
2202
|
+
this.#dispatch({ type: "failed", failureCount, error });
|
|
2203
|
+
},
|
|
2204
|
+
onPause: () => {
|
|
2205
|
+
this.#dispatch({ type: "pause" });
|
|
2206
|
+
},
|
|
2207
|
+
onContinue,
|
|
2208
|
+
retry: this.options.retry ?? 0,
|
|
2209
|
+
retryDelay: this.options.retryDelay,
|
|
2210
|
+
networkMode: this.options.networkMode,
|
|
2211
|
+
canRun: () => this.#mutationCache.canRun(this)
|
|
2212
|
+
});
|
|
2213
|
+
const restored = this.state.status === "pending";
|
|
2214
|
+
const isPaused = !this.#retryer.canStart();
|
|
2215
|
+
try {
|
|
2216
|
+
if (restored) {
|
|
2217
|
+
onContinue();
|
|
2218
|
+
} else {
|
|
2219
|
+
this.#dispatch({ type: "pending", variables, isPaused });
|
|
2220
|
+
if (this.#mutationCache.config.onMutate) {
|
|
2221
|
+
await this.#mutationCache.config.onMutate(
|
|
2222
|
+
variables,
|
|
2223
|
+
this,
|
|
2224
|
+
mutationFnContext
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
const context = await this.options.onMutate?.(
|
|
2228
|
+
variables,
|
|
2229
|
+
mutationFnContext
|
|
2230
|
+
);
|
|
2231
|
+
if (context !== this.state.context) {
|
|
2232
|
+
this.#dispatch({
|
|
2233
|
+
type: "pending",
|
|
2234
|
+
context,
|
|
2235
|
+
variables,
|
|
2236
|
+
isPaused
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
const data = await this.#retryer.start();
|
|
2241
|
+
await this.#mutationCache.config.onSuccess?.(
|
|
2242
|
+
data,
|
|
2243
|
+
variables,
|
|
2244
|
+
this.state.context,
|
|
2245
|
+
this,
|
|
2246
|
+
mutationFnContext
|
|
2247
|
+
);
|
|
2248
|
+
await this.options.onSuccess?.(
|
|
2249
|
+
data,
|
|
2250
|
+
variables,
|
|
2251
|
+
this.state.context,
|
|
2252
|
+
mutationFnContext
|
|
2253
|
+
);
|
|
2254
|
+
await this.#mutationCache.config.onSettled?.(
|
|
2255
|
+
data,
|
|
2256
|
+
null,
|
|
2257
|
+
this.state.variables,
|
|
2258
|
+
this.state.context,
|
|
2259
|
+
this,
|
|
2260
|
+
mutationFnContext
|
|
2261
|
+
);
|
|
2262
|
+
await this.options.onSettled?.(
|
|
2263
|
+
data,
|
|
2264
|
+
null,
|
|
2265
|
+
variables,
|
|
2266
|
+
this.state.context,
|
|
2267
|
+
mutationFnContext
|
|
2268
|
+
);
|
|
2269
|
+
this.#dispatch({ type: "success", data });
|
|
2270
|
+
return data;
|
|
2271
|
+
} catch (error) {
|
|
2272
|
+
try {
|
|
2273
|
+
await this.#mutationCache.config.onError?.(
|
|
2274
|
+
error,
|
|
2275
|
+
variables,
|
|
2276
|
+
this.state.context,
|
|
2277
|
+
this,
|
|
2278
|
+
mutationFnContext
|
|
2279
|
+
);
|
|
2280
|
+
} catch (e) {
|
|
2281
|
+
void Promise.reject(e);
|
|
2282
|
+
}
|
|
2283
|
+
try {
|
|
2284
|
+
await this.options.onError?.(
|
|
2285
|
+
error,
|
|
2286
|
+
variables,
|
|
2287
|
+
this.state.context,
|
|
2288
|
+
mutationFnContext
|
|
2289
|
+
);
|
|
2290
|
+
} catch (e) {
|
|
2291
|
+
void Promise.reject(e);
|
|
2292
|
+
}
|
|
2293
|
+
try {
|
|
2294
|
+
await this.#mutationCache.config.onSettled?.(
|
|
2295
|
+
void 0,
|
|
2296
|
+
error,
|
|
2297
|
+
this.state.variables,
|
|
2298
|
+
this.state.context,
|
|
2299
|
+
this,
|
|
2300
|
+
mutationFnContext
|
|
2301
|
+
);
|
|
2302
|
+
} catch (e) {
|
|
2303
|
+
void Promise.reject(e);
|
|
2304
|
+
}
|
|
2305
|
+
try {
|
|
2306
|
+
await this.options.onSettled?.(
|
|
2307
|
+
void 0,
|
|
2308
|
+
error,
|
|
2309
|
+
variables,
|
|
2310
|
+
this.state.context,
|
|
2311
|
+
mutationFnContext
|
|
2312
|
+
);
|
|
2313
|
+
} catch (e) {
|
|
2314
|
+
void Promise.reject(e);
|
|
2315
|
+
}
|
|
2316
|
+
this.#dispatch({ type: "error", error });
|
|
2317
|
+
throw error;
|
|
2318
|
+
} finally {
|
|
2319
|
+
this.#mutationCache.runNext(this);
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
#dispatch(action) {
|
|
2323
|
+
const reducer = (state) => {
|
|
2324
|
+
switch (action.type) {
|
|
2325
|
+
case "failed":
|
|
2326
|
+
return {
|
|
2327
|
+
...state,
|
|
2328
|
+
failureCount: action.failureCount,
|
|
2329
|
+
failureReason: action.error
|
|
2330
|
+
};
|
|
2331
|
+
case "pause":
|
|
2332
|
+
return {
|
|
2333
|
+
...state,
|
|
2334
|
+
isPaused: true
|
|
2335
|
+
};
|
|
2336
|
+
case "continue":
|
|
2337
|
+
return {
|
|
2338
|
+
...state,
|
|
2339
|
+
isPaused: false
|
|
2340
|
+
};
|
|
2341
|
+
case "pending":
|
|
2342
|
+
return {
|
|
2343
|
+
...state,
|
|
2344
|
+
context: action.context,
|
|
2345
|
+
data: void 0,
|
|
2346
|
+
failureCount: 0,
|
|
2347
|
+
failureReason: null,
|
|
2348
|
+
error: null,
|
|
2349
|
+
isPaused: action.isPaused,
|
|
2350
|
+
status: "pending",
|
|
2351
|
+
variables: action.variables,
|
|
2352
|
+
submittedAt: Date.now()
|
|
2353
|
+
};
|
|
2354
|
+
case "success":
|
|
2355
|
+
return {
|
|
2356
|
+
...state,
|
|
2357
|
+
data: action.data,
|
|
2358
|
+
failureCount: 0,
|
|
2359
|
+
failureReason: null,
|
|
2360
|
+
error: null,
|
|
2361
|
+
status: "success",
|
|
2362
|
+
isPaused: false
|
|
2363
|
+
};
|
|
2364
|
+
case "error":
|
|
2365
|
+
return {
|
|
2366
|
+
...state,
|
|
2367
|
+
data: void 0,
|
|
2368
|
+
error: action.error,
|
|
2369
|
+
failureCount: state.failureCount + 1,
|
|
2370
|
+
failureReason: action.error,
|
|
2371
|
+
isPaused: false,
|
|
2372
|
+
status: "error"
|
|
2373
|
+
};
|
|
2374
|
+
}
|
|
2375
|
+
};
|
|
2376
|
+
this.state = reducer(this.state);
|
|
2377
|
+
notifyManager.batch(() => {
|
|
2378
|
+
this.#observers.forEach((observer) => {
|
|
2379
|
+
observer.onMutationUpdate(action);
|
|
2380
|
+
});
|
|
2381
|
+
this.#mutationCache.notify({
|
|
2382
|
+
mutation: this,
|
|
2383
|
+
type: "updated",
|
|
2384
|
+
action
|
|
2385
|
+
});
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
};
|
|
2389
|
+
function getDefaultState2() {
|
|
2390
|
+
return {
|
|
2391
|
+
context: void 0,
|
|
2392
|
+
data: void 0,
|
|
2393
|
+
error: null,
|
|
2394
|
+
failureCount: 0,
|
|
2395
|
+
failureReason: null,
|
|
2396
|
+
isPaused: false,
|
|
2397
|
+
status: "idle",
|
|
2398
|
+
variables: void 0,
|
|
2399
|
+
submittedAt: 0
|
|
2400
|
+
};
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/mutationCache.js
|
|
2404
|
+
var MutationCache = class extends Subscribable {
|
|
2405
|
+
constructor(config = {}) {
|
|
2406
|
+
super();
|
|
2407
|
+
this.config = config;
|
|
2408
|
+
this.#mutations = /* @__PURE__ */ new Set();
|
|
2409
|
+
this.#scopes = /* @__PURE__ */ new Map();
|
|
2410
|
+
this.#mutationId = 0;
|
|
2411
|
+
}
|
|
2412
|
+
#mutations;
|
|
2413
|
+
#scopes;
|
|
2414
|
+
#mutationId;
|
|
2415
|
+
build(client, options, state) {
|
|
2416
|
+
const mutation = new Mutation({
|
|
2417
|
+
client,
|
|
2418
|
+
mutationCache: this,
|
|
2419
|
+
mutationId: ++this.#mutationId,
|
|
2420
|
+
options: client.defaultMutationOptions(options),
|
|
2421
|
+
state
|
|
2422
|
+
});
|
|
2423
|
+
this.add(mutation);
|
|
2424
|
+
return mutation;
|
|
2425
|
+
}
|
|
2426
|
+
add(mutation) {
|
|
2427
|
+
this.#mutations.add(mutation);
|
|
2428
|
+
const scope = scopeFor(mutation);
|
|
2429
|
+
if (typeof scope === "string") {
|
|
2430
|
+
const scopedMutations = this.#scopes.get(scope);
|
|
2431
|
+
if (scopedMutations) {
|
|
2432
|
+
scopedMutations.push(mutation);
|
|
2433
|
+
} else {
|
|
2434
|
+
this.#scopes.set(scope, [mutation]);
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
this.notify({ type: "added", mutation });
|
|
2438
|
+
}
|
|
2439
|
+
remove(mutation) {
|
|
2440
|
+
if (this.#mutations.delete(mutation)) {
|
|
2441
|
+
const scope = scopeFor(mutation);
|
|
2442
|
+
if (typeof scope === "string") {
|
|
2443
|
+
const scopedMutations = this.#scopes.get(scope);
|
|
2444
|
+
if (scopedMutations) {
|
|
2445
|
+
if (scopedMutations.length > 1) {
|
|
2446
|
+
const index = scopedMutations.indexOf(mutation);
|
|
2447
|
+
if (index !== -1) {
|
|
2448
|
+
scopedMutations.splice(index, 1);
|
|
2449
|
+
}
|
|
2450
|
+
} else if (scopedMutations[0] === mutation) {
|
|
2451
|
+
this.#scopes.delete(scope);
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
this.notify({ type: "removed", mutation });
|
|
2457
|
+
}
|
|
2458
|
+
canRun(mutation) {
|
|
2459
|
+
const scope = scopeFor(mutation);
|
|
2460
|
+
if (typeof scope === "string") {
|
|
2461
|
+
const mutationsWithSameScope = this.#scopes.get(scope);
|
|
2462
|
+
const firstPendingMutation = mutationsWithSameScope?.find(
|
|
2463
|
+
(m) => m.state.status === "pending"
|
|
2464
|
+
);
|
|
2465
|
+
return !firstPendingMutation || firstPendingMutation === mutation;
|
|
2466
|
+
} else {
|
|
2467
|
+
return true;
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
runNext(mutation) {
|
|
2471
|
+
const scope = scopeFor(mutation);
|
|
2472
|
+
if (typeof scope === "string") {
|
|
2473
|
+
const foundMutation = this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused);
|
|
2474
|
+
return foundMutation?.continue() ?? Promise.resolve();
|
|
2475
|
+
} else {
|
|
2476
|
+
return Promise.resolve();
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
clear() {
|
|
2480
|
+
notifyManager.batch(() => {
|
|
2481
|
+
this.#mutations.forEach((mutation) => {
|
|
2482
|
+
this.notify({ type: "removed", mutation });
|
|
2483
|
+
});
|
|
2484
|
+
this.#mutations.clear();
|
|
2485
|
+
this.#scopes.clear();
|
|
2486
|
+
});
|
|
2487
|
+
}
|
|
2488
|
+
getAll() {
|
|
2489
|
+
return Array.from(this.#mutations);
|
|
2490
|
+
}
|
|
2491
|
+
find(filters) {
|
|
2492
|
+
const defaultedFilters = { exact: true, ...filters };
|
|
2493
|
+
return this.getAll().find(
|
|
2494
|
+
(mutation) => matchMutation(defaultedFilters, mutation)
|
|
2495
|
+
);
|
|
2496
|
+
}
|
|
2497
|
+
findAll(filters = {}) {
|
|
2498
|
+
return this.getAll().filter((mutation) => matchMutation(filters, mutation));
|
|
2499
|
+
}
|
|
2500
|
+
notify(event) {
|
|
2501
|
+
notifyManager.batch(() => {
|
|
2502
|
+
this.listeners.forEach((listener) => {
|
|
2503
|
+
listener(event);
|
|
2504
|
+
});
|
|
2505
|
+
});
|
|
2506
|
+
}
|
|
2507
|
+
resumePausedMutations() {
|
|
2508
|
+
const pausedMutations = this.getAll().filter((x) => x.state.isPaused);
|
|
2509
|
+
return notifyManager.batch(
|
|
2510
|
+
() => Promise.all(
|
|
2511
|
+
pausedMutations.map((mutation) => mutation.continue().catch(noop))
|
|
2512
|
+
)
|
|
2513
|
+
);
|
|
2514
|
+
}
|
|
2515
|
+
};
|
|
2516
|
+
function scopeFor(mutation) {
|
|
2517
|
+
return mutation.options.scope?.id;
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/queryCache.js
|
|
2521
|
+
var QueryCache = class extends Subscribable {
|
|
2522
|
+
constructor(config = {}) {
|
|
2523
|
+
super();
|
|
2524
|
+
this.config = config;
|
|
2525
|
+
this.#queries = /* @__PURE__ */ new Map();
|
|
2526
|
+
}
|
|
2527
|
+
#queries;
|
|
2528
|
+
build(client, options, state) {
|
|
2529
|
+
const queryKey = options.queryKey;
|
|
2530
|
+
const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
|
|
2531
|
+
let query = this.get(queryHash);
|
|
2532
|
+
if (!query) {
|
|
2533
|
+
query = new Query({
|
|
2534
|
+
client,
|
|
2535
|
+
queryKey,
|
|
2536
|
+
queryHash,
|
|
2537
|
+
options: client.defaultQueryOptions(options),
|
|
2538
|
+
state,
|
|
2539
|
+
defaultOptions: client.getQueryDefaults(queryKey)
|
|
2540
|
+
});
|
|
2541
|
+
this.add(query);
|
|
2542
|
+
}
|
|
2543
|
+
return query;
|
|
2544
|
+
}
|
|
2545
|
+
add(query) {
|
|
2546
|
+
if (!this.#queries.has(query.queryHash)) {
|
|
2547
|
+
this.#queries.set(query.queryHash, query);
|
|
2548
|
+
this.notify({
|
|
2549
|
+
type: "added",
|
|
2550
|
+
query
|
|
2551
|
+
});
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
remove(query) {
|
|
2555
|
+
const queryInMap = this.#queries.get(query.queryHash);
|
|
2556
|
+
if (queryInMap) {
|
|
2557
|
+
query.destroy();
|
|
2558
|
+
if (queryInMap === query) {
|
|
2559
|
+
this.#queries.delete(query.queryHash);
|
|
2560
|
+
}
|
|
2561
|
+
this.notify({ type: "removed", query });
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
clear() {
|
|
2565
|
+
notifyManager.batch(() => {
|
|
2566
|
+
this.getAll().forEach((query) => {
|
|
2567
|
+
this.remove(query);
|
|
2568
|
+
});
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
get(queryHash) {
|
|
2572
|
+
return this.#queries.get(queryHash);
|
|
2573
|
+
}
|
|
2574
|
+
getAll() {
|
|
2575
|
+
return [...this.#queries.values()];
|
|
2576
|
+
}
|
|
2577
|
+
find(filters) {
|
|
2578
|
+
const defaultedFilters = { exact: true, ...filters };
|
|
2579
|
+
return this.getAll().find(
|
|
2580
|
+
(query) => matchQuery(defaultedFilters, query)
|
|
2581
|
+
);
|
|
2582
|
+
}
|
|
2583
|
+
findAll(filters = {}) {
|
|
2584
|
+
const queries = this.getAll();
|
|
2585
|
+
return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
|
|
2586
|
+
}
|
|
2587
|
+
notify(event) {
|
|
2588
|
+
notifyManager.batch(() => {
|
|
2589
|
+
this.listeners.forEach((listener) => {
|
|
2590
|
+
listener(event);
|
|
2591
|
+
});
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
onFocus() {
|
|
2595
|
+
notifyManager.batch(() => {
|
|
2596
|
+
this.getAll().forEach((query) => {
|
|
2597
|
+
query.onFocus();
|
|
2598
|
+
});
|
|
2599
|
+
});
|
|
2600
|
+
}
|
|
2601
|
+
onOnline() {
|
|
2602
|
+
notifyManager.batch(() => {
|
|
2603
|
+
this.getAll().forEach((query) => {
|
|
2604
|
+
query.onOnline();
|
|
2605
|
+
});
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
};
|
|
2609
|
+
|
|
2610
|
+
// ../../node_modules/.bun/@tanstack+query-core@5.90.20/node_modules/@tanstack/query-core/build/modern/queryClient.js
|
|
2611
|
+
var QueryClient = class {
|
|
2612
|
+
#queryCache;
|
|
2613
|
+
#mutationCache;
|
|
2614
|
+
#defaultOptions;
|
|
2615
|
+
#queryDefaults;
|
|
2616
|
+
#mutationDefaults;
|
|
2617
|
+
#mountCount;
|
|
2618
|
+
#unsubscribeFocus;
|
|
2619
|
+
#unsubscribeOnline;
|
|
2620
|
+
constructor(config = {}) {
|
|
2621
|
+
this.#queryCache = config.queryCache || new QueryCache();
|
|
2622
|
+
this.#mutationCache = config.mutationCache || new MutationCache();
|
|
2623
|
+
this.#defaultOptions = config.defaultOptions || {};
|
|
2624
|
+
this.#queryDefaults = /* @__PURE__ */ new Map();
|
|
2625
|
+
this.#mutationDefaults = /* @__PURE__ */ new Map();
|
|
2626
|
+
this.#mountCount = 0;
|
|
2627
|
+
}
|
|
2628
|
+
mount() {
|
|
2629
|
+
this.#mountCount++;
|
|
2630
|
+
if (this.#mountCount !== 1) return;
|
|
2631
|
+
this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
|
|
2632
|
+
if (focused) {
|
|
2633
|
+
await this.resumePausedMutations();
|
|
2634
|
+
this.#queryCache.onFocus();
|
|
2635
|
+
}
|
|
2636
|
+
});
|
|
2637
|
+
this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
|
|
2638
|
+
if (online) {
|
|
2639
|
+
await this.resumePausedMutations();
|
|
2640
|
+
this.#queryCache.onOnline();
|
|
2641
|
+
}
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
unmount() {
|
|
2645
|
+
this.#mountCount--;
|
|
2646
|
+
if (this.#mountCount !== 0) return;
|
|
2647
|
+
this.#unsubscribeFocus?.();
|
|
2648
|
+
this.#unsubscribeFocus = void 0;
|
|
2649
|
+
this.#unsubscribeOnline?.();
|
|
2650
|
+
this.#unsubscribeOnline = void 0;
|
|
2651
|
+
}
|
|
2652
|
+
isFetching(filters) {
|
|
2653
|
+
return this.#queryCache.findAll({ ...filters, fetchStatus: "fetching" }).length;
|
|
2654
|
+
}
|
|
2655
|
+
isMutating(filters) {
|
|
2656
|
+
return this.#mutationCache.findAll({ ...filters, status: "pending" }).length;
|
|
2657
|
+
}
|
|
2658
|
+
/**
|
|
2659
|
+
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
2660
|
+
* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
|
|
2661
|
+
*
|
|
2662
|
+
* Hint: Do not use this function inside a component, because it won't receive updates.
|
|
2663
|
+
* Use `useQuery` to create a `QueryObserver` that subscribes to changes.
|
|
2664
|
+
*/
|
|
2665
|
+
getQueryData(queryKey) {
|
|
2666
|
+
const options = this.defaultQueryOptions({ queryKey });
|
|
2667
|
+
return this.#queryCache.get(options.queryHash)?.state.data;
|
|
2668
|
+
}
|
|
2669
|
+
ensureQueryData(options) {
|
|
2670
|
+
const defaultedOptions = this.defaultQueryOptions(options);
|
|
2671
|
+
const query = this.#queryCache.build(this, defaultedOptions);
|
|
2672
|
+
const cachedData = query.state.data;
|
|
2673
|
+
if (cachedData === void 0) {
|
|
2674
|
+
return this.fetchQuery(options);
|
|
2675
|
+
}
|
|
2676
|
+
if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {
|
|
2677
|
+
void this.prefetchQuery(defaultedOptions);
|
|
2678
|
+
}
|
|
2679
|
+
return Promise.resolve(cachedData);
|
|
2680
|
+
}
|
|
2681
|
+
getQueriesData(filters) {
|
|
2682
|
+
return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
|
|
2683
|
+
const data = state.data;
|
|
2684
|
+
return [queryKey, data];
|
|
2685
|
+
});
|
|
2686
|
+
}
|
|
2687
|
+
setQueryData(queryKey, updater, options) {
|
|
2688
|
+
const defaultedOptions = this.defaultQueryOptions({ queryKey });
|
|
2689
|
+
const query = this.#queryCache.get(
|
|
2690
|
+
defaultedOptions.queryHash
|
|
2691
|
+
);
|
|
2692
|
+
const prevData = query?.state.data;
|
|
2693
|
+
const data = functionalUpdate(updater, prevData);
|
|
2694
|
+
if (data === void 0) {
|
|
2695
|
+
return void 0;
|
|
2696
|
+
}
|
|
2697
|
+
return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });
|
|
2698
|
+
}
|
|
2699
|
+
setQueriesData(filters, updater, options) {
|
|
2700
|
+
return notifyManager.batch(
|
|
2701
|
+
() => this.#queryCache.findAll(filters).map(({ queryKey }) => [
|
|
2702
|
+
queryKey,
|
|
2703
|
+
this.setQueryData(queryKey, updater, options)
|
|
2704
|
+
])
|
|
2705
|
+
);
|
|
2706
|
+
}
|
|
2707
|
+
getQueryState(queryKey) {
|
|
2708
|
+
const options = this.defaultQueryOptions({ queryKey });
|
|
2709
|
+
return this.#queryCache.get(
|
|
2710
|
+
options.queryHash
|
|
2711
|
+
)?.state;
|
|
2712
|
+
}
|
|
2713
|
+
removeQueries(filters) {
|
|
2714
|
+
const queryCache = this.#queryCache;
|
|
2715
|
+
notifyManager.batch(() => {
|
|
2716
|
+
queryCache.findAll(filters).forEach((query) => {
|
|
2717
|
+
queryCache.remove(query);
|
|
2718
|
+
});
|
|
2719
|
+
});
|
|
2720
|
+
}
|
|
2721
|
+
resetQueries(filters, options) {
|
|
2722
|
+
const queryCache = this.#queryCache;
|
|
2723
|
+
return notifyManager.batch(() => {
|
|
2724
|
+
queryCache.findAll(filters).forEach((query) => {
|
|
2725
|
+
query.reset();
|
|
2726
|
+
});
|
|
2727
|
+
return this.refetchQueries(
|
|
2728
|
+
{
|
|
2729
|
+
type: "active",
|
|
2730
|
+
...filters
|
|
2731
|
+
},
|
|
2732
|
+
options
|
|
2733
|
+
);
|
|
2734
|
+
});
|
|
2735
|
+
}
|
|
2736
|
+
cancelQueries(filters, cancelOptions = {}) {
|
|
2737
|
+
const defaultedCancelOptions = { revert: true, ...cancelOptions };
|
|
2738
|
+
const promises = notifyManager.batch(
|
|
2739
|
+
() => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
|
|
2740
|
+
);
|
|
2741
|
+
return Promise.all(promises).then(noop).catch(noop);
|
|
2742
|
+
}
|
|
2743
|
+
invalidateQueries(filters, options = {}) {
|
|
2744
|
+
return notifyManager.batch(() => {
|
|
2745
|
+
this.#queryCache.findAll(filters).forEach((query) => {
|
|
2746
|
+
query.invalidate();
|
|
2747
|
+
});
|
|
2748
|
+
if (filters?.refetchType === "none") {
|
|
2749
|
+
return Promise.resolve();
|
|
2750
|
+
}
|
|
2751
|
+
return this.refetchQueries(
|
|
926
2752
|
{
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
level: level + 1,
|
|
930
|
-
onOpenChange
|
|
2753
|
+
...filters,
|
|
2754
|
+
type: filters?.refetchType ?? filters?.type ?? "active"
|
|
931
2755
|
},
|
|
932
|
-
|
|
933
|
-
)
|
|
934
|
-
|
|
2756
|
+
options
|
|
2757
|
+
);
|
|
2758
|
+
});
|
|
935
2759
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
2760
|
+
refetchQueries(filters, options = {}) {
|
|
2761
|
+
const fetchOptions = {
|
|
2762
|
+
...options,
|
|
2763
|
+
cancelRefetch: options.cancelRefetch ?? true
|
|
2764
|
+
};
|
|
2765
|
+
const promises = notifyManager.batch(
|
|
2766
|
+
() => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
|
|
2767
|
+
let promise = query.fetch(void 0, fetchOptions);
|
|
2768
|
+
if (!fetchOptions.throwOnError) {
|
|
2769
|
+
promise = promise.catch(noop);
|
|
944
2770
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
item.title,
|
|
955
|
-
item.external && /* @__PURE__ */ jsx25(ArrowUpRightIcon2, { className: "ml-1 size-3.5 opacity-60" })
|
|
956
|
-
]
|
|
2771
|
+
return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
|
|
2772
|
+
})
|
|
2773
|
+
);
|
|
2774
|
+
return Promise.all(promises).then(noop);
|
|
2775
|
+
}
|
|
2776
|
+
fetchQuery(options) {
|
|
2777
|
+
const defaultedOptions = this.defaultQueryOptions(options);
|
|
2778
|
+
if (defaultedOptions.retry === void 0) {
|
|
2779
|
+
defaultedOptions.retry = false;
|
|
957
2780
|
}
|
|
958
|
-
|
|
959
|
-
|
|
2781
|
+
const query = this.#queryCache.build(this, defaultedOptions);
|
|
2782
|
+
return query.isStaleByTime(
|
|
2783
|
+
resolveStaleTime(defaultedOptions.staleTime, query)
|
|
2784
|
+
) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
|
|
2785
|
+
}
|
|
2786
|
+
prefetchQuery(options) {
|
|
2787
|
+
return this.fetchQuery(options).then(noop).catch(noop);
|
|
2788
|
+
}
|
|
2789
|
+
fetchInfiniteQuery(options) {
|
|
2790
|
+
options.behavior = infiniteQueryBehavior(options.pages);
|
|
2791
|
+
return this.fetchQuery(options);
|
|
2792
|
+
}
|
|
2793
|
+
prefetchInfiniteQuery(options) {
|
|
2794
|
+
return this.fetchInfiniteQuery(options).then(noop).catch(noop);
|
|
2795
|
+
}
|
|
2796
|
+
ensureInfiniteQueryData(options) {
|
|
2797
|
+
options.behavior = infiniteQueryBehavior(options.pages);
|
|
2798
|
+
return this.ensureQueryData(options);
|
|
2799
|
+
}
|
|
2800
|
+
resumePausedMutations() {
|
|
2801
|
+
if (onlineManager.isOnline()) {
|
|
2802
|
+
return this.#mutationCache.resumePausedMutations();
|
|
2803
|
+
}
|
|
2804
|
+
return Promise.resolve();
|
|
2805
|
+
}
|
|
2806
|
+
getQueryCache() {
|
|
2807
|
+
return this.#queryCache;
|
|
2808
|
+
}
|
|
2809
|
+
getMutationCache() {
|
|
2810
|
+
return this.#mutationCache;
|
|
2811
|
+
}
|
|
2812
|
+
getDefaultOptions() {
|
|
2813
|
+
return this.#defaultOptions;
|
|
2814
|
+
}
|
|
2815
|
+
setDefaultOptions(options) {
|
|
2816
|
+
this.#defaultOptions = options;
|
|
2817
|
+
}
|
|
2818
|
+
setQueryDefaults(queryKey, options) {
|
|
2819
|
+
this.#queryDefaults.set(hashKey(queryKey), {
|
|
2820
|
+
queryKey,
|
|
2821
|
+
defaultOptions: options
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
getQueryDefaults(queryKey) {
|
|
2825
|
+
const defaults = [...this.#queryDefaults.values()];
|
|
2826
|
+
const result = {};
|
|
2827
|
+
defaults.forEach((queryDefault) => {
|
|
2828
|
+
if (partialMatchKey(queryKey, queryDefault.queryKey)) {
|
|
2829
|
+
Object.assign(result, queryDefault.defaultOptions);
|
|
2830
|
+
}
|
|
2831
|
+
});
|
|
2832
|
+
return result;
|
|
2833
|
+
}
|
|
2834
|
+
setMutationDefaults(mutationKey, options) {
|
|
2835
|
+
this.#mutationDefaults.set(hashKey(mutationKey), {
|
|
2836
|
+
mutationKey,
|
|
2837
|
+
defaultOptions: options
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
getMutationDefaults(mutationKey) {
|
|
2841
|
+
const defaults = [...this.#mutationDefaults.values()];
|
|
2842
|
+
const result = {};
|
|
2843
|
+
defaults.forEach((queryDefault) => {
|
|
2844
|
+
if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
|
|
2845
|
+
Object.assign(result, queryDefault.defaultOptions);
|
|
2846
|
+
}
|
|
2847
|
+
});
|
|
2848
|
+
return result;
|
|
2849
|
+
}
|
|
2850
|
+
defaultQueryOptions(options) {
|
|
2851
|
+
if (options._defaulted) {
|
|
2852
|
+
return options;
|
|
2853
|
+
}
|
|
2854
|
+
const defaultedOptions = {
|
|
2855
|
+
...this.#defaultOptions.queries,
|
|
2856
|
+
...this.getQueryDefaults(options.queryKey),
|
|
2857
|
+
...options,
|
|
2858
|
+
_defaulted: true
|
|
2859
|
+
};
|
|
2860
|
+
if (!defaultedOptions.queryHash) {
|
|
2861
|
+
defaultedOptions.queryHash = hashQueryKeyByOptions(
|
|
2862
|
+
defaultedOptions.queryKey,
|
|
2863
|
+
defaultedOptions
|
|
2864
|
+
);
|
|
2865
|
+
}
|
|
2866
|
+
if (defaultedOptions.refetchOnReconnect === void 0) {
|
|
2867
|
+
defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
|
|
2868
|
+
}
|
|
2869
|
+
if (defaultedOptions.throwOnError === void 0) {
|
|
2870
|
+
defaultedOptions.throwOnError = !!defaultedOptions.suspense;
|
|
2871
|
+
}
|
|
2872
|
+
if (!defaultedOptions.networkMode && defaultedOptions.persister) {
|
|
2873
|
+
defaultedOptions.networkMode = "offlineFirst";
|
|
2874
|
+
}
|
|
2875
|
+
if (defaultedOptions.queryFn === skipToken) {
|
|
2876
|
+
defaultedOptions.enabled = false;
|
|
2877
|
+
}
|
|
2878
|
+
return defaultedOptions;
|
|
2879
|
+
}
|
|
2880
|
+
defaultMutationOptions(options) {
|
|
2881
|
+
if (options?._defaulted) {
|
|
2882
|
+
return options;
|
|
2883
|
+
}
|
|
2884
|
+
return {
|
|
2885
|
+
...this.#defaultOptions.mutations,
|
|
2886
|
+
...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
|
|
2887
|
+
...options,
|
|
2888
|
+
_defaulted: true
|
|
2889
|
+
};
|
|
2890
|
+
}
|
|
2891
|
+
clear() {
|
|
2892
|
+
this.#queryCache.clear();
|
|
2893
|
+
this.#mutationCache.clear();
|
|
2894
|
+
}
|
|
2895
|
+
};
|
|
2896
|
+
|
|
2897
|
+
// ../../node_modules/.bun/@tanstack+react-query@5.90.21+b1ab299f0a400331/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js
|
|
2898
|
+
import * as React2 from "react";
|
|
2899
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
2900
|
+
var QueryClientContext = React2.createContext(
|
|
2901
|
+
void 0
|
|
2902
|
+
);
|
|
2903
|
+
var QueryClientProvider = ({
|
|
2904
|
+
client,
|
|
2905
|
+
children
|
|
2906
|
+
}) => {
|
|
2907
|
+
React2.useEffect(() => {
|
|
2908
|
+
client.mount();
|
|
2909
|
+
return () => {
|
|
2910
|
+
client.unmount();
|
|
2911
|
+
};
|
|
2912
|
+
}, [client]);
|
|
2913
|
+
return /* @__PURE__ */ jsx26(QueryClientContext.Provider, { value: client, children });
|
|
2914
|
+
};
|
|
960
2915
|
|
|
961
2916
|
// src/components/providers/query-provider.tsx
|
|
962
|
-
import { useState as useState3 } from "react";
|
|
963
|
-
import { QueryCache, QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
964
2917
|
import { CircleAlertIcon as CircleAlertIcon2 } from "lucide-react";
|
|
965
2918
|
import { toast as toast2 } from "sonner";
|
|
966
|
-
import { Alert as Alert2,
|
|
967
|
-
import { jsx as
|
|
2919
|
+
import { Alert as Alert2, AlertTitle as AlertTitle2 } from "@pelatform/ui.components/base";
|
|
2920
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
968
2921
|
var QueryProvider = ({
|
|
969
2922
|
client: clientProps,
|
|
970
2923
|
children
|
|
@@ -1012,9 +2965,9 @@ var QueryProvider = ({
|
|
|
1012
2965
|
});
|
|
1013
2966
|
}
|
|
1014
2967
|
toast2.custom(
|
|
1015
|
-
() => /* @__PURE__ */ jsxs17(Alert2, { variant: "
|
|
1016
|
-
/* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
2968
|
+
() => /* @__PURE__ */ jsxs17(Alert2, { variant: "default", children: [
|
|
2969
|
+
/* @__PURE__ */ jsx27(CircleAlertIcon2, {}),
|
|
2970
|
+
/* @__PURE__ */ jsx27(AlertTitle2, { children: message })
|
|
1018
2971
|
] }),
|
|
1019
2972
|
{
|
|
1020
2973
|
position: "top-center",
|
|
@@ -1028,16 +2981,15 @@ var QueryProvider = ({
|
|
|
1028
2981
|
})
|
|
1029
2982
|
})
|
|
1030
2983
|
);
|
|
1031
|
-
return /* @__PURE__ */
|
|
2984
|
+
return /* @__PURE__ */ jsx27(QueryClientProvider, { client: clientProps ?? queryClient, children });
|
|
1032
2985
|
};
|
|
1033
2986
|
|
|
1034
2987
|
// src/components/providers/theme-provider.tsx
|
|
1035
2988
|
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
|
1036
|
-
import { TooltipProvider } from "@pelatform/ui.
|
|
1037
|
-
import {
|
|
1038
|
-
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
2989
|
+
import { TooltipProvider } from "@pelatform/ui.components/base";
|
|
2990
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1039
2991
|
function ThemeProvider({ children, ...props }) {
|
|
1040
|
-
return /* @__PURE__ */
|
|
2992
|
+
return /* @__PURE__ */ jsx28(
|
|
1041
2993
|
NextThemesProvider,
|
|
1042
2994
|
{
|
|
1043
2995
|
attribute: "class",
|
|
@@ -1048,25 +3000,24 @@ function ThemeProvider({ children, ...props }) {
|
|
|
1048
3000
|
storageKey: "theme",
|
|
1049
3001
|
themes: [THEME_MODES.LIGHT, THEME_MODES.DARK, THEME_MODES.SYSTEM],
|
|
1050
3002
|
...props,
|
|
1051
|
-
children: /* @__PURE__ */
|
|
3003
|
+
children: /* @__PURE__ */ jsx28(TooltipProvider, { delay: 0, children })
|
|
1052
3004
|
}
|
|
1053
3005
|
);
|
|
1054
3006
|
}
|
|
1055
3007
|
|
|
1056
3008
|
// src/components/ui/announcement.tsx
|
|
1057
|
-
import { Badge as Badge2 } from "@pelatform/ui.
|
|
1058
|
-
import {
|
|
1059
|
-
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3009
|
+
import { Badge as Badge2 } from "@pelatform/ui.components/base";
|
|
3010
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1060
3011
|
var Announcement = ({
|
|
1061
3012
|
variant = "outline",
|
|
1062
3013
|
themed = false,
|
|
1063
3014
|
className,
|
|
1064
3015
|
...props
|
|
1065
|
-
}) => /* @__PURE__ */
|
|
3016
|
+
}) => /* @__PURE__ */ jsx29(
|
|
1066
3017
|
Badge2,
|
|
1067
3018
|
{
|
|
1068
3019
|
variant,
|
|
1069
|
-
className:
|
|
3020
|
+
className: cn(
|
|
1070
3021
|
"group max-w-full gap-2 rounded-full bg-background px-3 py-0.5 font-medium shadow-sm transition-all",
|
|
1071
3022
|
"hover:shadow-md",
|
|
1072
3023
|
themed && "announcement-themed border-foreground/5",
|
|
@@ -1075,10 +3026,10 @@ var Announcement = ({
|
|
|
1075
3026
|
...props
|
|
1076
3027
|
}
|
|
1077
3028
|
);
|
|
1078
|
-
var AnnouncementTag = ({ className, ...props }) => /* @__PURE__ */
|
|
3029
|
+
var AnnouncementTag = ({ className, ...props }) => /* @__PURE__ */ jsx29(
|
|
1079
3030
|
"div",
|
|
1080
3031
|
{
|
|
1081
|
-
className:
|
|
3032
|
+
className: cn(
|
|
1082
3033
|
"-ml-2.5 shrink-0 truncate rounded-full bg-foreground/5 px-2.5 py-1 text-xs",
|
|
1083
3034
|
"group-[.announcement-themed]:bg-background/60",
|
|
1084
3035
|
className
|
|
@@ -1086,12 +3037,11 @@ var AnnouncementTag = ({ className, ...props }) => /* @__PURE__ */ jsx28(
|
|
|
1086
3037
|
...props
|
|
1087
3038
|
}
|
|
1088
3039
|
);
|
|
1089
|
-
var AnnouncementTitle = ({ className, ...props }) => /* @__PURE__ */
|
|
3040
|
+
var AnnouncementTitle = ({ className, ...props }) => /* @__PURE__ */ jsx29("div", { className: cn("flex items-center gap-1 truncate py-1", className), ...props });
|
|
1090
3041
|
|
|
1091
3042
|
// src/components/ui/background-paths.tsx
|
|
1092
3043
|
import { motion } from "motion/react";
|
|
1093
|
-
import {
|
|
1094
|
-
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3044
|
+
import { jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1095
3045
|
function FloatingPaths({
|
|
1096
3046
|
position,
|
|
1097
3047
|
color = "text-slate-950 dark:text-white"
|
|
@@ -1102,7 +3052,7 @@ function FloatingPaths({
|
|
|
1102
3052
|
color: `rgba(15,23,42,${0.1 + i * 0.03})`,
|
|
1103
3053
|
width: 0.5 + i * 0.03
|
|
1104
3054
|
}));
|
|
1105
|
-
return /* @__PURE__ */
|
|
3055
|
+
return /* @__PURE__ */ jsx30("div", { className: "pointer-events-none absolute inset-0 -z-50", children: /* @__PURE__ */ jsx30("svg", { className: cn("h-full w-full", color), viewBox: "0 0 696 316", fill: "none", children: paths.map((path) => /* @__PURE__ */ jsx30(
|
|
1106
3056
|
motion.path,
|
|
1107
3057
|
{
|
|
1108
3058
|
d: path.d,
|
|
@@ -1125,15 +3075,14 @@ function FloatingPaths({
|
|
|
1125
3075
|
)) }) });
|
|
1126
3076
|
}
|
|
1127
3077
|
function BackgroundPaths({ color = "text-slate-950 dark:text-white" }) {
|
|
1128
|
-
return /* @__PURE__ */
|
|
1129
|
-
/* @__PURE__ */
|
|
1130
|
-
/* @__PURE__ */
|
|
3078
|
+
return /* @__PURE__ */ jsx30("div", { className: "relative flex min-h-screen w-full items-center justify-center overflow-hidden bg-white dark:bg-neutral-950", children: /* @__PURE__ */ jsxs18("div", { className: "absolute inset-0", children: [
|
|
3079
|
+
/* @__PURE__ */ jsx30(FloatingPaths, { position: 1, color }),
|
|
3080
|
+
/* @__PURE__ */ jsx30(FloatingPaths, { position: -1, color })
|
|
1131
3081
|
] }) });
|
|
1132
3082
|
}
|
|
1133
3083
|
|
|
1134
3084
|
// src/components/ui/book.tsx
|
|
1135
|
-
import {
|
|
1136
|
-
import { jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3085
|
+
import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1137
3086
|
function Book(props) {
|
|
1138
3087
|
const {
|
|
1139
3088
|
children,
|
|
@@ -1145,10 +3094,10 @@ function Book(props) {
|
|
|
1145
3094
|
illustration,
|
|
1146
3095
|
width
|
|
1147
3096
|
} = props;
|
|
1148
|
-
return /* @__PURE__ */
|
|
3097
|
+
return /* @__PURE__ */ jsx31(
|
|
1149
3098
|
"div",
|
|
1150
3099
|
{
|
|
1151
|
-
className:
|
|
3100
|
+
className: cn("group perspective-[900px] inline-block w-fit"),
|
|
1152
3101
|
style: {
|
|
1153
3102
|
"--book-color": color,
|
|
1154
3103
|
"--text-color": textColor,
|
|
@@ -1168,20 +3117,20 @@ function Book(props) {
|
|
|
1168
3117
|
shrink: true,
|
|
1169
3118
|
grow: true,
|
|
1170
3119
|
direction: "row",
|
|
1171
|
-
className:
|
|
3120
|
+
className: cn(
|
|
1172
3121
|
"relative min-w-[calc(var(--book-width))] overflow-hidden bg-(--book-color)"
|
|
1173
3122
|
),
|
|
1174
3123
|
children: [
|
|
1175
|
-
/* @__PURE__ */
|
|
1176
|
-
illustration && /* @__PURE__ */
|
|
3124
|
+
/* @__PURE__ */ jsx31("div", { className: "absolute inset-y-0 min-w-[8.2%] bg-book-bind-bg opacity-100 mix-blend-overlay" }),
|
|
3125
|
+
illustration && /* @__PURE__ */ jsx31("div", { className: "object-cover", children: illustration })
|
|
1177
3126
|
]
|
|
1178
3127
|
}
|
|
1179
3128
|
),
|
|
1180
3129
|
/* @__PURE__ */ jsxs19(Stack, { grow: variant === "simple", direction: "row", className: "h-fit", children: [
|
|
1181
|
-
/* @__PURE__ */
|
|
1182
|
-
/* @__PURE__ */
|
|
3130
|
+
/* @__PURE__ */ jsx31("div", { className: "h-full min-w-[8.2%] bg-book-bind-bg opacity-100 mix-blend-overlay" }),
|
|
3131
|
+
/* @__PURE__ */ jsx31("div", { className: "w-full contain-inline-size", children })
|
|
1183
3132
|
] }),
|
|
1184
|
-
texture && /* @__PURE__ */
|
|
3133
|
+
texture && /* @__PURE__ */ jsx31(
|
|
1185
3134
|
"div",
|
|
1186
3135
|
{
|
|
1187
3136
|
"aria-hidden": true,
|
|
@@ -1191,7 +3140,7 @@ function Book(props) {
|
|
|
1191
3140
|
]
|
|
1192
3141
|
}
|
|
1193
3142
|
),
|
|
1194
|
-
/* @__PURE__ */
|
|
3143
|
+
/* @__PURE__ */ jsx31(
|
|
1195
3144
|
"div",
|
|
1196
3145
|
{
|
|
1197
3146
|
"aria-hidden": true,
|
|
@@ -1201,7 +3150,7 @@ function Book(props) {
|
|
|
1201
3150
|
}
|
|
1202
3151
|
}
|
|
1203
3152
|
),
|
|
1204
|
-
/* @__PURE__ */
|
|
3153
|
+
/* @__PURE__ */ jsx31(
|
|
1205
3154
|
"div",
|
|
1206
3155
|
{
|
|
1207
3156
|
"aria-hidden": true,
|
|
@@ -1229,7 +3178,7 @@ function Stack(props) {
|
|
|
1229
3178
|
className,
|
|
1230
3179
|
...etc
|
|
1231
3180
|
} = props;
|
|
1232
|
-
return /* @__PURE__ */
|
|
3181
|
+
return /* @__PURE__ */ jsx31(
|
|
1233
3182
|
"div",
|
|
1234
3183
|
{
|
|
1235
3184
|
className,
|
|
@@ -1253,8 +3202,7 @@ function Stack(props) {
|
|
|
1253
3202
|
|
|
1254
3203
|
// src/components/ui/dots-pattern.tsx
|
|
1255
3204
|
import { useId as useId2 } from "react";
|
|
1256
|
-
import {
|
|
1257
|
-
import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3205
|
+
import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1258
3206
|
function DotsPattern({
|
|
1259
3207
|
dotSize = 2,
|
|
1260
3208
|
gapSize = 10,
|
|
@@ -1265,11 +3213,11 @@ function DotsPattern({
|
|
|
1265
3213
|
return /* @__PURE__ */ jsxs20(
|
|
1266
3214
|
"svg",
|
|
1267
3215
|
{
|
|
1268
|
-
className:
|
|
3216
|
+
className: cn("pointer-events-none absolute inset-0 text-foreground/10", className),
|
|
1269
3217
|
width: "100%",
|
|
1270
3218
|
height: "100%",
|
|
1271
3219
|
children: [
|
|
1272
|
-
/* @__PURE__ */
|
|
3220
|
+
/* @__PURE__ */ jsx32("defs", { children: /* @__PURE__ */ jsx32(
|
|
1273
3221
|
"pattern",
|
|
1274
3222
|
{
|
|
1275
3223
|
id: `dots-${id}`,
|
|
@@ -1278,38 +3226,37 @@ function DotsPattern({
|
|
|
1278
3226
|
width: dotSize + gapSize,
|
|
1279
3227
|
height: dotSize + gapSize,
|
|
1280
3228
|
patternUnits: "userSpaceOnUse",
|
|
1281
|
-
children: /* @__PURE__ */
|
|
3229
|
+
children: /* @__PURE__ */ jsx32("rect", { x: 1, y: 1, width: dotSize, height: dotSize, fill: "currentColor" })
|
|
1282
3230
|
}
|
|
1283
3231
|
) }),
|
|
1284
|
-
/* @__PURE__ */
|
|
3232
|
+
/* @__PURE__ */ jsx32("rect", { fill: `url(#dots-${id})`, width: "100%", height: "100%" })
|
|
1285
3233
|
]
|
|
1286
3234
|
}
|
|
1287
3235
|
);
|
|
1288
3236
|
}
|
|
1289
3237
|
|
|
1290
3238
|
// src/components/ui/hexagon-badge.tsx
|
|
1291
|
-
import {
|
|
1292
|
-
import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3239
|
+
import { jsx as jsx33, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1293
3240
|
var HexagonBadge = ({ children, classNames }) => {
|
|
1294
|
-
return /* @__PURE__ */ jsxs21("div", { className:
|
|
3241
|
+
return /* @__PURE__ */ jsxs21("div", { className: cn("relative shrink-0", classNames?.base), children: [
|
|
1295
3242
|
/* @__PURE__ */ jsxs21(
|
|
1296
3243
|
"svg",
|
|
1297
3244
|
{
|
|
1298
|
-
className:
|
|
3245
|
+
className: cn("h-full w-full", classNames?.svg),
|
|
1299
3246
|
width: "44",
|
|
1300
3247
|
height: "48",
|
|
1301
3248
|
viewBox: "0 0 44 48",
|
|
1302
3249
|
fill: "none",
|
|
1303
3250
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1304
3251
|
children: [
|
|
1305
|
-
/* @__PURE__ */
|
|
3252
|
+
/* @__PURE__ */ jsx33(
|
|
1306
3253
|
"path",
|
|
1307
3254
|
{
|
|
1308
3255
|
d: "M16 2.4641C19.7128 0.320509 24.2872 0.320508 28 2.4641L37.6506 8.0359C41.3634 10.1795 43.6506 14.141 43.6506\n 18.4282V29.5718C43.6506 33.859 41.3634 37.8205 37.6506 39.9641L28 45.5359C24.2872 47.6795 19.7128 47.6795 16 45.5359L6.34937\n 39.9641C2.63655 37.8205 0.349365 33.859 0.349365 29.5718V18.4282C0.349365 14.141 2.63655 10.1795 6.34937 8.0359L16 2.4641Z",
|
|
1309
3256
|
fill: ""
|
|
1310
3257
|
}
|
|
1311
3258
|
),
|
|
1312
|
-
/* @__PURE__ */
|
|
3259
|
+
/* @__PURE__ */ jsx33(
|
|
1313
3260
|
"path",
|
|
1314
3261
|
{
|
|
1315
3262
|
d: "M16.25 2.89711C19.8081 0.842838 24.1919 0.842837 27.75 2.89711L37.4006 8.46891C40.9587 10.5232 43.1506 14.3196 43.1506\n 18.4282V29.5718C43.1506 33.6804 40.9587 37.4768 37.4006 39.5311L27.75 45.1029C24.1919 47.1572 19.8081 47.1572 16.25 45.1029L6.59937\n 39.5311C3.04125 37.4768 0.849365 33.6803 0.849365 29.5718V18.4282C0.849365 14.3196 3.04125 10.5232 6.59937 8.46891L16.25 2.89711Z",
|
|
@@ -1319,10 +3266,10 @@ var HexagonBadge = ({ children, classNames }) => {
|
|
|
1319
3266
|
]
|
|
1320
3267
|
}
|
|
1321
3268
|
),
|
|
1322
|
-
/* @__PURE__ */
|
|
3269
|
+
/* @__PURE__ */ jsx33(
|
|
1323
3270
|
"div",
|
|
1324
3271
|
{
|
|
1325
|
-
className:
|
|
3272
|
+
className: cn(
|
|
1326
3273
|
"absolute start-2/4 top-2/4 -translate-x-2/4 -translate-y-2/4 leading-none rtl:translate-x-2/4",
|
|
1327
3274
|
classNames?.wraper
|
|
1328
3275
|
),
|
|
@@ -1338,7 +3285,7 @@ import {
|
|
|
1338
3285
|
useRef,
|
|
1339
3286
|
useState as useState4
|
|
1340
3287
|
} from "react";
|
|
1341
|
-
import { Fragment as Fragment3, jsx as
|
|
3288
|
+
import { Fragment as Fragment3, jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1342
3289
|
var DEFAULT_NULL_INDEX = -1;
|
|
1343
3290
|
var DEFAULT_DATA_URL_KEY = "dataURL";
|
|
1344
3291
|
var openFileDialog = (inputRef) => {
|
|
@@ -1475,7 +3422,7 @@ var ImageInput = ({
|
|
|
1475
3422
|
e.dataTransfer.clearData();
|
|
1476
3423
|
};
|
|
1477
3424
|
return /* @__PURE__ */ jsxs22(Fragment3, { children: [
|
|
1478
|
-
/* @__PURE__ */
|
|
3425
|
+
/* @__PURE__ */ jsx34(
|
|
1479
3426
|
"input",
|
|
1480
3427
|
{
|
|
1481
3428
|
ref: inputRef,
|
|
@@ -1522,14 +3469,17 @@ import {
|
|
|
1522
3469
|
DropdownMenuSubContent as DropdownMenuSubContent2,
|
|
1523
3470
|
DropdownMenuSubTrigger as DropdownMenuSubTrigger2,
|
|
1524
3471
|
DropdownMenuTrigger as DropdownMenuTrigger2
|
|
1525
|
-
} from "@pelatform/ui.
|
|
1526
|
-
import {
|
|
1527
|
-
|
|
3472
|
+
} from "@pelatform/ui.components/base";
|
|
3473
|
+
import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3474
|
+
function getFlagUrl(flag) {
|
|
3475
|
+
const flagCode = flag.toLowerCase();
|
|
3476
|
+
return `"https://assets.pelatform.com"/media/flags/${flagCode}.svg`;
|
|
3477
|
+
}
|
|
1528
3478
|
function LanguageSwitcher({
|
|
1529
3479
|
className,
|
|
1530
3480
|
type = "dropdown",
|
|
1531
3481
|
variant = "ghost",
|
|
1532
|
-
size = "
|
|
3482
|
+
size = "default",
|
|
1533
3483
|
showNames = true,
|
|
1534
3484
|
showFlags = true,
|
|
1535
3485
|
label = "Language",
|
|
@@ -1555,70 +3505,62 @@ function LanguageSwitcher({
|
|
|
1555
3505
|
}
|
|
1556
3506
|
if (type === "dropdown") {
|
|
1557
3507
|
return /* @__PURE__ */ jsxs23(DropdownMenu2, { children: [
|
|
1558
|
-
/* @__PURE__ */
|
|
3508
|
+
/* @__PURE__ */ jsx35(DropdownMenuTrigger2, { children: /* @__PURE__ */ jsxs23(
|
|
1559
3509
|
Button5,
|
|
1560
3510
|
{
|
|
1561
3511
|
variant,
|
|
1562
3512
|
size,
|
|
1563
|
-
className:
|
|
3513
|
+
className: cn(
|
|
1564
3514
|
"group/toggle size-8 px-0 text-foreground ring-0! focus:outline-none! focus:ring-0! focus-visible:outline-none! focus-visible:ring-0! focus-visible:ring-offset-0!",
|
|
1565
3515
|
isPending && "cursor-not-allowed opacity-50",
|
|
1566
3516
|
className
|
|
1567
3517
|
),
|
|
1568
3518
|
disabled: isPending,
|
|
1569
3519
|
children: [
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx35(LanguagesIcon, { className: "size-4" }),
|
|
3521
|
+
/* @__PURE__ */ jsx35("span", { className: "sr-only", children: isPending ? "Changing language..." : "Language dropdown" })
|
|
1572
3522
|
]
|
|
1573
3523
|
}
|
|
1574
3524
|
) }),
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
|
|
3525
|
+
/* @__PURE__ */ jsx35(DropdownMenuContent2, { align: "end", className: "min-w-[150px]", children: languages.map((lang) => /* @__PURE__ */ jsxs23(
|
|
3526
|
+
DropdownMenuItem2,
|
|
1577
3527
|
{
|
|
1578
|
-
|
|
1579
|
-
className: "
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
showNames && /* @__PURE__ */ jsx34("span", { className: "text-sm", children: lang.name }),
|
|
1598
|
-
currentLocale === lang.code && /* @__PURE__ */ jsx34("span", { className: "ms-auto text-muted-foreground text-xs", children: "\u2713" })
|
|
1599
|
-
]
|
|
1600
|
-
},
|
|
1601
|
-
lang.code
|
|
1602
|
-
))
|
|
1603
|
-
}
|
|
1604
|
-
)
|
|
3528
|
+
onClick: () => handleLanguageChange(lang.code),
|
|
3529
|
+
className: cn("gap-2", currentLocale === lang.code && "bg-accent"),
|
|
3530
|
+
children: [
|
|
3531
|
+
showFlags && lang.flag ? /* @__PURE__ */ jsx35(
|
|
3532
|
+
Image2,
|
|
3533
|
+
{
|
|
3534
|
+
src: customFlagUrl ? lang.flag : getFlagUrl(lang.flag),
|
|
3535
|
+
alt: `${lang.name} flag`,
|
|
3536
|
+
className: "size-4 rounded-full object-cover",
|
|
3537
|
+
width: 24,
|
|
3538
|
+
height: 24
|
|
3539
|
+
}
|
|
3540
|
+
) : showFlags ? /* @__PURE__ */ jsx35(GlobeIcon, { className: "size-4" }) : null,
|
|
3541
|
+
showNames && /* @__PURE__ */ jsx35("span", { className: "text-sm", children: lang.name }),
|
|
3542
|
+
currentLocale === lang.code && /* @__PURE__ */ jsx35("span", { className: "ms-auto text-muted-foreground text-xs", children: "\u2713" })
|
|
3543
|
+
]
|
|
3544
|
+
},
|
|
3545
|
+
lang.code
|
|
3546
|
+
)) })
|
|
1605
3547
|
] });
|
|
1606
3548
|
}
|
|
1607
3549
|
return /* @__PURE__ */ jsxs23(DropdownMenuSub2, { children: [
|
|
1608
3550
|
/* @__PURE__ */ jsxs23(
|
|
1609
3551
|
DropdownMenuSubTrigger2,
|
|
1610
3552
|
{
|
|
1611
|
-
className:
|
|
3553
|
+
className: cn(
|
|
1612
3554
|
"flex items-center gap-2 data-[state=open]:**:data-[slot=badge]:border-input **:data-[slot=dropdown-menu-sub-trigger-indicator]:hidden hover:**:data-[slot=badge]:border-input",
|
|
1613
3555
|
className
|
|
1614
3556
|
),
|
|
1615
3557
|
children: [
|
|
1616
|
-
/* @__PURE__ */
|
|
3558
|
+
/* @__PURE__ */ jsx35(GlobeIcon, { className: "size-4" }),
|
|
1617
3559
|
/* @__PURE__ */ jsxs23("span", { className: "relative flex grow items-center justify-between gap-2", children: [
|
|
1618
3560
|
label,
|
|
1619
|
-
currentLanguage && /* @__PURE__ */ jsxs23(Badge3, {
|
|
3561
|
+
currentLanguage && /* @__PURE__ */ jsxs23(Badge3, { variant: "outline", className: "absolute end-0 top-1/2 -translate-y-1/2", children: [
|
|
1620
3562
|
currentLanguage.name,
|
|
1621
|
-
showFlags && currentLanguage.flag && /* @__PURE__ */
|
|
3563
|
+
showFlags && currentLanguage.flag && /* @__PURE__ */ jsx35(
|
|
1622
3564
|
Image2,
|
|
1623
3565
|
{
|
|
1624
3566
|
src: customFlagUrl ? currentLanguage.flag : getFlagUrl(currentLanguage.flag),
|
|
@@ -1633,7 +3575,7 @@ function LanguageSwitcher({
|
|
|
1633
3575
|
]
|
|
1634
3576
|
}
|
|
1635
3577
|
),
|
|
1636
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsx35(DropdownMenuSubContent2, { className: "w-48", children: /* @__PURE__ */ jsx35(
|
|
1637
3579
|
DropdownMenuRadioGroup,
|
|
1638
3580
|
{
|
|
1639
3581
|
value: currentLocale,
|
|
@@ -1644,7 +3586,7 @@ function LanguageSwitcher({
|
|
|
1644
3586
|
value: item.code,
|
|
1645
3587
|
className: "flex items-center gap-2",
|
|
1646
3588
|
children: [
|
|
1647
|
-
showFlags && item.flag ? /* @__PURE__ */
|
|
3589
|
+
showFlags && item.flag ? /* @__PURE__ */ jsx35(
|
|
1648
3590
|
Image2,
|
|
1649
3591
|
{
|
|
1650
3592
|
src: customFlagUrl ? item.flag : getFlagUrl(item.flag),
|
|
@@ -1653,8 +3595,8 @@ function LanguageSwitcher({
|
|
|
1653
3595
|
width: 24,
|
|
1654
3596
|
height: 24
|
|
1655
3597
|
}
|
|
1656
|
-
) : showFlags ? /* @__PURE__ */
|
|
1657
|
-
/* @__PURE__ */
|
|
3598
|
+
) : showFlags ? /* @__PURE__ */ jsx35(GlobeIcon, { className: "size-4" }) : null,
|
|
3599
|
+
/* @__PURE__ */ jsx35("span", { children: item.name })
|
|
1658
3600
|
]
|
|
1659
3601
|
},
|
|
1660
3602
|
item.code
|
|
@@ -1665,16 +3607,15 @@ function LanguageSwitcher({
|
|
|
1665
3607
|
}
|
|
1666
3608
|
|
|
1667
3609
|
// src/components/ui/logo.tsx
|
|
1668
|
-
import {
|
|
1669
|
-
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
3610
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
1670
3611
|
function Logo({ className }) {
|
|
1671
|
-
return /* @__PURE__ */
|
|
3612
|
+
return /* @__PURE__ */ jsx36(
|
|
1672
3613
|
"svg",
|
|
1673
3614
|
{
|
|
1674
3615
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1675
3616
|
viewBox: "0 0 300 300",
|
|
1676
|
-
className:
|
|
1677
|
-
children: /* @__PURE__ */
|
|
3617
|
+
className: cn("size-8 text-primary", className),
|
|
3618
|
+
children: /* @__PURE__ */ jsx36(
|
|
1678
3619
|
"path",
|
|
1679
3620
|
{
|
|
1680
3621
|
fill: "currentColor",
|
|
@@ -1686,7 +3627,7 @@ function Logo({ className }) {
|
|
|
1686
3627
|
}
|
|
1687
3628
|
|
|
1688
3629
|
// src/components/ui/mode-switcher.tsx
|
|
1689
|
-
import * as
|
|
3630
|
+
import * as React3 from "react";
|
|
1690
3631
|
import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react";
|
|
1691
3632
|
import { useTheme } from "next-themes";
|
|
1692
3633
|
import {
|
|
@@ -1695,14 +3636,13 @@ import {
|
|
|
1695
3636
|
DropdownMenuContent as DropdownMenuContent3,
|
|
1696
3637
|
DropdownMenuItem as DropdownMenuItem3,
|
|
1697
3638
|
DropdownMenuTrigger as DropdownMenuTrigger3
|
|
1698
|
-
} from "@pelatform/ui.
|
|
1699
|
-
import {
|
|
1700
|
-
import { Fragment as Fragment4, jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3639
|
+
} from "@pelatform/ui.components/base";
|
|
3640
|
+
import { Fragment as Fragment4, jsx as jsx37, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1701
3641
|
function ModeSwitcher({
|
|
1702
3642
|
className,
|
|
1703
3643
|
variant = "ghost",
|
|
1704
|
-
size = "
|
|
1705
|
-
cycleOrder = [
|
|
3644
|
+
size = "default",
|
|
3645
|
+
cycleOrder = [THEME_MODES.SYSTEM, THEME_MODES.LIGHT, THEME_MODES.DARK],
|
|
1706
3646
|
type = "toogle",
|
|
1707
3647
|
label = {
|
|
1708
3648
|
system: "System",
|
|
@@ -1711,31 +3651,31 @@ function ModeSwitcher({
|
|
|
1711
3651
|
}
|
|
1712
3652
|
}) {
|
|
1713
3653
|
const { setTheme, theme } = useTheme();
|
|
1714
|
-
const toggleTheme =
|
|
3654
|
+
const toggleTheme = React3.useCallback(() => {
|
|
1715
3655
|
const currentIndex = cycleOrder.indexOf(theme);
|
|
1716
3656
|
const nextIndex = (currentIndex + 1) % cycleOrder.length;
|
|
1717
3657
|
const nextTheme = cycleOrder[nextIndex];
|
|
1718
3658
|
setTheme(nextTheme);
|
|
1719
3659
|
}, [theme, setTheme, cycleOrder]);
|
|
1720
3660
|
const getCurrentIcon = (withLabel = false) => {
|
|
1721
|
-
if (theme ===
|
|
3661
|
+
if (theme === THEME_MODES.SYSTEM) {
|
|
1722
3662
|
return /* @__PURE__ */ jsxs24(Fragment4, { children: [
|
|
1723
|
-
/* @__PURE__ */
|
|
3663
|
+
/* @__PURE__ */ jsx37(MonitorIcon, {}),
|
|
1724
3664
|
" ",
|
|
1725
|
-
withLabel && /* @__PURE__ */
|
|
3665
|
+
withLabel && /* @__PURE__ */ jsx37("span", { children: label.system })
|
|
1726
3666
|
] });
|
|
1727
3667
|
}
|
|
1728
|
-
if (theme ===
|
|
3668
|
+
if (theme === THEME_MODES.DARK) {
|
|
1729
3669
|
return /* @__PURE__ */ jsxs24(Fragment4, { children: [
|
|
1730
|
-
/* @__PURE__ */
|
|
3670
|
+
/* @__PURE__ */ jsx37(MoonIcon, {}),
|
|
1731
3671
|
" ",
|
|
1732
|
-
withLabel && /* @__PURE__ */
|
|
3672
|
+
withLabel && /* @__PURE__ */ jsx37("span", { children: label.dark })
|
|
1733
3673
|
] });
|
|
1734
3674
|
}
|
|
1735
3675
|
return /* @__PURE__ */ jsxs24(Fragment4, { children: [
|
|
1736
|
-
/* @__PURE__ */
|
|
3676
|
+
/* @__PURE__ */ jsx37(SunIcon, {}),
|
|
1737
3677
|
" ",
|
|
1738
|
-
withLabel && /* @__PURE__ */
|
|
3678
|
+
withLabel && /* @__PURE__ */ jsx37("span", { children: label.light })
|
|
1739
3679
|
] });
|
|
1740
3680
|
};
|
|
1741
3681
|
const isActive = (val) => theme === val;
|
|
@@ -1743,43 +3683,43 @@ function ModeSwitcher({
|
|
|
1743
3683
|
return /* @__PURE__ */ jsxs24(
|
|
1744
3684
|
Button6,
|
|
1745
3685
|
{
|
|
1746
|
-
variant,
|
|
1747
3686
|
size,
|
|
1748
|
-
|
|
3687
|
+
variant,
|
|
3688
|
+
className: cn("group/toggle size-8 px-0 text-foreground", className),
|
|
1749
3689
|
onClick: toggleTheme,
|
|
1750
3690
|
"aria-label": "Switch theme",
|
|
1751
3691
|
children: [
|
|
1752
3692
|
getCurrentIcon(),
|
|
1753
|
-
/* @__PURE__ */
|
|
3693
|
+
/* @__PURE__ */ jsx37("span", { className: "sr-only", children: "Toggle theme" })
|
|
1754
3694
|
]
|
|
1755
3695
|
}
|
|
1756
3696
|
);
|
|
1757
3697
|
}
|
|
1758
3698
|
if (type === "dropdown") {
|
|
1759
3699
|
return /* @__PURE__ */ jsxs24(DropdownMenu3, { children: [
|
|
1760
|
-
/* @__PURE__ */
|
|
3700
|
+
/* @__PURE__ */ jsx37(DropdownMenuTrigger3, { children: /* @__PURE__ */ jsxs24(
|
|
1761
3701
|
Button6,
|
|
1762
3702
|
{
|
|
1763
|
-
variant,
|
|
1764
3703
|
size,
|
|
1765
|
-
|
|
3704
|
+
variant,
|
|
3705
|
+
className: cn(
|
|
1766
3706
|
"group/toggle size-8 px-0 text-foreground ring-0! focus:outline-none! focus:ring-0! focus-visible:outline-none! focus-visible:ring-0! focus-visible:ring-offset-0!",
|
|
1767
3707
|
className
|
|
1768
3708
|
),
|
|
1769
3709
|
children: [
|
|
1770
3710
|
getCurrentIcon(),
|
|
1771
|
-
/* @__PURE__ */
|
|
3711
|
+
/* @__PURE__ */ jsx37("span", { className: "sr-only", children: "Toggle theme" })
|
|
1772
3712
|
]
|
|
1773
3713
|
}
|
|
1774
3714
|
) }),
|
|
1775
|
-
/* @__PURE__ */ jsxs24(DropdownMenuContent3, { align: "end",
|
|
3715
|
+
/* @__PURE__ */ jsxs24(DropdownMenuContent3, { align: "end", children: [
|
|
1776
3716
|
/* @__PURE__ */ jsxs24(
|
|
1777
3717
|
DropdownMenuItem3,
|
|
1778
3718
|
{
|
|
1779
3719
|
className: isActive("light") ? "bg-accent" : "",
|
|
1780
3720
|
onClick: () => setTheme("light"),
|
|
1781
3721
|
children: [
|
|
1782
|
-
/* @__PURE__ */
|
|
3722
|
+
/* @__PURE__ */ jsx37(SunIcon, {}),
|
|
1783
3723
|
label.light
|
|
1784
3724
|
]
|
|
1785
3725
|
}
|
|
@@ -1790,7 +3730,7 @@ function ModeSwitcher({
|
|
|
1790
3730
|
className: isActive("dark") ? "bg-accent" : "",
|
|
1791
3731
|
onClick: () => setTheme("dark"),
|
|
1792
3732
|
children: [
|
|
1793
|
-
/* @__PURE__ */
|
|
3733
|
+
/* @__PURE__ */ jsx37(MoonIcon, {}),
|
|
1794
3734
|
label.dark
|
|
1795
3735
|
]
|
|
1796
3736
|
}
|
|
@@ -1801,7 +3741,7 @@ function ModeSwitcher({
|
|
|
1801
3741
|
className: isActive("system") ? "bg-accent" : "",
|
|
1802
3742
|
onClick: () => setTheme("system"),
|
|
1803
3743
|
children: [
|
|
1804
|
-
/* @__PURE__ */
|
|
3744
|
+
/* @__PURE__ */ jsx37(MonitorIcon, {}),
|
|
1805
3745
|
label.system
|
|
1806
3746
|
]
|
|
1807
3747
|
}
|
|
@@ -1809,7 +3749,7 @@ function ModeSwitcher({
|
|
|
1809
3749
|
] })
|
|
1810
3750
|
] });
|
|
1811
3751
|
}
|
|
1812
|
-
return /* @__PURE__ */
|
|
3752
|
+
return /* @__PURE__ */ jsx37(
|
|
1813
3753
|
DropdownMenuItem3,
|
|
1814
3754
|
{
|
|
1815
3755
|
className,
|
|
@@ -1831,8 +3771,7 @@ import {
|
|
|
1831
3771
|
useMotionValue,
|
|
1832
3772
|
useTransform
|
|
1833
3773
|
} from "motion/react";
|
|
1834
|
-
import {
|
|
1835
|
-
import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3774
|
+
import { Fragment as Fragment5, jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1836
3775
|
function MovingLabel({
|
|
1837
3776
|
borderRadius = "1.75rem",
|
|
1838
3777
|
children,
|
|
@@ -1846,25 +3785,25 @@ function MovingLabel({
|
|
|
1846
3785
|
return /* @__PURE__ */ jsxs25(
|
|
1847
3786
|
Component,
|
|
1848
3787
|
{
|
|
1849
|
-
className:
|
|
3788
|
+
className: cn("relative h-9 overflow-hidden bg-transparent p-px text-xl", containerClassName),
|
|
1850
3789
|
style: {
|
|
1851
3790
|
borderRadius
|
|
1852
3791
|
},
|
|
1853
3792
|
...otherProps,
|
|
1854
3793
|
children: [
|
|
1855
|
-
/* @__PURE__ */
|
|
3794
|
+
/* @__PURE__ */ jsx38("div", { className: "absolute inset-0", style: { borderRadius: `calc(${borderRadius} * 0.96)` }, children: /* @__PURE__ */ jsx38(MovingBorder, { duration, rx: "30%", ry: "30%", children: /* @__PURE__ */ jsx38(
|
|
1856
3795
|
"div",
|
|
1857
3796
|
{
|
|
1858
|
-
className:
|
|
3797
|
+
className: cn(
|
|
1859
3798
|
"h-12 w-20 bg-[radial-gradient(#24B47E_15%,transparent_60%)] opacity-[0.6]",
|
|
1860
3799
|
borderClassName
|
|
1861
3800
|
)
|
|
1862
3801
|
}
|
|
1863
3802
|
) }) }),
|
|
1864
|
-
/* @__PURE__ */
|
|
3803
|
+
/* @__PURE__ */ jsx38(
|
|
1865
3804
|
"div",
|
|
1866
3805
|
{
|
|
1867
|
-
className:
|
|
3806
|
+
className: cn(
|
|
1868
3807
|
"relative flex h-full w-full items-center justify-center border border-slate-800 bg-slate-900/50 text-sm text-white antialiased backdrop-blur-xl",
|
|
1869
3808
|
className
|
|
1870
3809
|
),
|
|
@@ -1898,7 +3837,7 @@ var MovingBorder = ({
|
|
|
1898
3837
|
const y = useTransform(progress, (val) => pathRef.current?.getPointAtLength(val).y);
|
|
1899
3838
|
const transform = useMotionTemplate`translateX(${x}px) translateY(${y}px) translateX(-50%) translateY(-50%)`;
|
|
1900
3839
|
return /* @__PURE__ */ jsxs25(Fragment5, { children: [
|
|
1901
|
-
/* @__PURE__ */
|
|
3840
|
+
/* @__PURE__ */ jsx38(
|
|
1902
3841
|
"svg",
|
|
1903
3842
|
{
|
|
1904
3843
|
preserveAspectRatio: "none",
|
|
@@ -1906,10 +3845,10 @@ var MovingBorder = ({
|
|
|
1906
3845
|
width: "100%",
|
|
1907
3846
|
height: "100%",
|
|
1908
3847
|
...otherProps,
|
|
1909
|
-
children: /* @__PURE__ */
|
|
3848
|
+
children: /* @__PURE__ */ jsx38("rect", { fill: "none", width: "100%", height: "100%", rx, ry, ref: pathRef })
|
|
1910
3849
|
}
|
|
1911
3850
|
),
|
|
1912
|
-
/* @__PURE__ */
|
|
3851
|
+
/* @__PURE__ */ jsx38(
|
|
1913
3852
|
motion2.div,
|
|
1914
3853
|
{
|
|
1915
3854
|
style: {
|
|
@@ -1925,302 +3864,30 @@ var MovingBorder = ({
|
|
|
1925
3864
|
] });
|
|
1926
3865
|
};
|
|
1927
3866
|
|
|
1928
|
-
// src/components/ui/subscribe.tsx
|
|
1929
|
-
import { useState as useState5 } from "react";
|
|
1930
|
-
import { CircleAlertIcon as CircleAlertIcon4, CircleCheckIcon as CircleCheckIcon2 } from "lucide-react";
|
|
1931
|
-
import { toast as toast4 } from "sonner";
|
|
1932
|
-
import { Alert as Alert4, AlertIcon as AlertIcon4, AlertTitle as AlertTitle4, Button as Button8, Input } from "@pelatform/ui.default";
|
|
1933
|
-
import { googleTrackEvent as googleTrackEvent3 } from "@pelatform/utils";
|
|
1934
|
-
|
|
1935
|
-
// src/components/utils/recaptcha-popover.tsx
|
|
1936
|
-
import { CircleAlertIcon as CircleAlertIcon3 } from "lucide-react";
|
|
1937
|
-
import { Popover } from "radix-ui";
|
|
1938
|
-
import { toast as toast3 } from "sonner";
|
|
1939
|
-
import { Alert as Alert3, AlertIcon as AlertIcon3, AlertTitle as AlertTitle3, Button as Button7 } from "@pelatform/ui.default";
|
|
1940
|
-
import { useRecaptchaV2 } from "@pelatform/ui.hook";
|
|
1941
|
-
import { jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
1942
|
-
function RecaptchaPopover({
|
|
1943
|
-
open,
|
|
1944
|
-
onOpenChange,
|
|
1945
|
-
onVerify,
|
|
1946
|
-
trigger,
|
|
1947
|
-
verifyButtonText = "Verify & Submit"
|
|
1948
|
-
}) {
|
|
1949
|
-
const { containerRef, getToken, resetCaptcha, initializeRecaptcha } = useRecaptchaV2(
|
|
1950
|
-
process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY || ""
|
|
1951
|
-
);
|
|
1952
|
-
const handleOpenChange = (newOpen) => {
|
|
1953
|
-
onOpenChange(newOpen);
|
|
1954
|
-
if (newOpen) {
|
|
1955
|
-
resetCaptcha();
|
|
1956
|
-
setTimeout(() => {
|
|
1957
|
-
initializeRecaptcha();
|
|
1958
|
-
}, 100);
|
|
1959
|
-
}
|
|
1960
|
-
};
|
|
1961
|
-
const handleVerify = () => {
|
|
1962
|
-
try {
|
|
1963
|
-
const token = getToken();
|
|
1964
|
-
if (!token) {
|
|
1965
|
-
toast3.custom(
|
|
1966
|
-
() => /* @__PURE__ */ jsxs26(Alert3, { variant: "mono", icon: "destructive", children: [
|
|
1967
|
-
/* @__PURE__ */ jsx38(AlertIcon3, { children: /* @__PURE__ */ jsx38(CircleAlertIcon3, {}) }),
|
|
1968
|
-
/* @__PURE__ */ jsx38(AlertTitle3, { children: "Please complete the reCAPTCHA verification." })
|
|
1969
|
-
] }),
|
|
1970
|
-
{
|
|
1971
|
-
position: "top-center"
|
|
1972
|
-
}
|
|
1973
|
-
);
|
|
1974
|
-
return;
|
|
1975
|
-
}
|
|
1976
|
-
onVerify(token);
|
|
1977
|
-
} catch (error) {
|
|
1978
|
-
console.error("Error getting reCAPTCHA token:", error);
|
|
1979
|
-
toast3.custom(
|
|
1980
|
-
() => /* @__PURE__ */ jsxs26(Alert3, { variant: "mono", icon: "destructive", children: [
|
|
1981
|
-
/* @__PURE__ */ jsx38(AlertIcon3, { children: /* @__PURE__ */ jsx38(CircleAlertIcon3, {}) }),
|
|
1982
|
-
/* @__PURE__ */ jsx38(AlertTitle3, { children: "Please complete the reCAPTCHA verification." })
|
|
1983
|
-
] }),
|
|
1984
|
-
{
|
|
1985
|
-
position: "top-center"
|
|
1986
|
-
}
|
|
1987
|
-
);
|
|
1988
|
-
return;
|
|
1989
|
-
}
|
|
1990
|
-
};
|
|
1991
|
-
return /* @__PURE__ */ jsxs26(Popover.Root, { open, onOpenChange: handleOpenChange, children: [
|
|
1992
|
-
/* @__PURE__ */ jsx38(Popover.Trigger, { asChild: true, children: trigger }),
|
|
1993
|
-
/* @__PURE__ */ jsx38(Popover.Portal, { children: /* @__PURE__ */ jsxs26(
|
|
1994
|
-
Popover.Content,
|
|
1995
|
-
{
|
|
1996
|
-
className: "z-50 rounded-lg bg-white p-4 shadow-lg",
|
|
1997
|
-
sideOffset: 5,
|
|
1998
|
-
align: "end",
|
|
1999
|
-
onInteractOutside: (e) => {
|
|
2000
|
-
if (e.target.tagName === "IFRAME") {
|
|
2001
|
-
e.preventDefault();
|
|
2002
|
-
}
|
|
2003
|
-
},
|
|
2004
|
-
children: [
|
|
2005
|
-
/* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4", children: [
|
|
2006
|
-
/* @__PURE__ */ jsx38("div", { ref: containerRef, className: "min-h-[78px]" }),
|
|
2007
|
-
/* @__PURE__ */ jsx38(Button7, { type: "button", variant: "mono", onClick: handleVerify, className: "w-full", children: verifyButtonText })
|
|
2008
|
-
] }),
|
|
2009
|
-
/* @__PURE__ */ jsx38(Popover.Arrow, { className: "fill-white" })
|
|
2010
|
-
]
|
|
2011
|
-
}
|
|
2012
|
-
) })
|
|
2013
|
-
] });
|
|
2014
|
-
}
|
|
2015
|
-
|
|
2016
|
-
// src/components/ui/subscribe.tsx
|
|
2017
|
-
import { jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2018
|
-
function Subscribe({
|
|
2019
|
-
heading = "Stay notified on every new release",
|
|
2020
|
-
subheading = "Only the updates worth knowing",
|
|
2021
|
-
buttonText = "Subscribe",
|
|
2022
|
-
loadingButtonText = "Subscribing...",
|
|
2023
|
-
inputPlaceholder = "Your email address",
|
|
2024
|
-
successMessage = "Thank you for your subscription. Expect amazing stuff soon!",
|
|
2025
|
-
invalidEmailMessage = "Invalid email address. Please check and try again.",
|
|
2026
|
-
recaptchaMessage = "Please complete the reCAPTCHA verification.",
|
|
2027
|
-
errorMessage = "Oops! Something unexpected happened. Please try again later.",
|
|
2028
|
-
apiEndpoint = "/api/subscribe",
|
|
2029
|
-
verifyButtonText = "Verify & Subscribe",
|
|
2030
|
-
className
|
|
2031
|
-
} = {}) {
|
|
2032
|
-
const [email, setEmail] = useState5("");
|
|
2033
|
-
const [loading, setLoading] = useState5(false);
|
|
2034
|
-
const [showRecaptcha, setShowRecaptcha] = useState5(false);
|
|
2035
|
-
const validateEmail = () => {
|
|
2036
|
-
if (!email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
|
|
2037
|
-
toast4.custom(
|
|
2038
|
-
() => /* @__PURE__ */ jsxs27(Alert4, { variant: "mono", icon: "destructive", children: [
|
|
2039
|
-
/* @__PURE__ */ jsx39(AlertIcon4, { children: /* @__PURE__ */ jsx39(CircleAlertIcon4, {}) }),
|
|
2040
|
-
/* @__PURE__ */ jsx39(AlertTitle4, { children: invalidEmailMessage })
|
|
2041
|
-
] }),
|
|
2042
|
-
{
|
|
2043
|
-
position: "top-center"
|
|
2044
|
-
}
|
|
2045
|
-
);
|
|
2046
|
-
return false;
|
|
2047
|
-
}
|
|
2048
|
-
return true;
|
|
2049
|
-
};
|
|
2050
|
-
const handleSubmit = async (e) => {
|
|
2051
|
-
e.preventDefault();
|
|
2052
|
-
if (!validateEmail()) {
|
|
2053
|
-
setShowRecaptcha(false);
|
|
2054
|
-
return;
|
|
2055
|
-
}
|
|
2056
|
-
setShowRecaptcha(true);
|
|
2057
|
-
};
|
|
2058
|
-
const handleVerifiedSubmit = async (token) => {
|
|
2059
|
-
if (!token) {
|
|
2060
|
-
toast4.custom(
|
|
2061
|
-
() => /* @__PURE__ */ jsxs27(Alert4, { variant: "mono", icon: "destructive", children: [
|
|
2062
|
-
/* @__PURE__ */ jsx39(AlertIcon4, { children: /* @__PURE__ */ jsx39(CircleAlertIcon4, {}) }),
|
|
2063
|
-
/* @__PURE__ */ jsx39(AlertTitle4, { children: recaptchaMessage })
|
|
2064
|
-
] }),
|
|
2065
|
-
{
|
|
2066
|
-
position: "top-center"
|
|
2067
|
-
}
|
|
2068
|
-
);
|
|
2069
|
-
return;
|
|
2070
|
-
}
|
|
2071
|
-
setLoading(true);
|
|
2072
|
-
setShowRecaptcha(false);
|
|
2073
|
-
try {
|
|
2074
|
-
googleTrackEvent3({
|
|
2075
|
-
name: "site_newsletter_subscribe_submit",
|
|
2076
|
-
properties: {
|
|
2077
|
-
category: "conversion",
|
|
2078
|
-
label: "Newsletter Subscribe Submit",
|
|
2079
|
-
email
|
|
2080
|
-
}
|
|
2081
|
-
});
|
|
2082
|
-
const res = await fetch(apiEndpoint, {
|
|
2083
|
-
method: "POST",
|
|
2084
|
-
headers: {
|
|
2085
|
-
"Content-Type": "application/json",
|
|
2086
|
-
"x-recaptcha-token": token
|
|
2087
|
-
},
|
|
2088
|
-
body: JSON.stringify({ email })
|
|
2089
|
-
});
|
|
2090
|
-
const data = await res.json();
|
|
2091
|
-
if (res.ok) {
|
|
2092
|
-
toast4.custom(
|
|
2093
|
-
() => /* @__PURE__ */ jsxs27(Alert4, { variant: "mono", icon: "success", children: [
|
|
2094
|
-
/* @__PURE__ */ jsx39(AlertIcon4, { children: /* @__PURE__ */ jsx39(CircleCheckIcon2, {}) }),
|
|
2095
|
-
/* @__PURE__ */ jsx39(AlertTitle4, { children: successMessage })
|
|
2096
|
-
] }),
|
|
2097
|
-
{
|
|
2098
|
-
position: "top-center"
|
|
2099
|
-
}
|
|
2100
|
-
);
|
|
2101
|
-
googleTrackEvent3({
|
|
2102
|
-
name: "site_newsletter_subscribe_success",
|
|
2103
|
-
properties: {
|
|
2104
|
-
category: "conversion",
|
|
2105
|
-
label: "Newsletter Subscribe Success",
|
|
2106
|
-
email
|
|
2107
|
-
}
|
|
2108
|
-
});
|
|
2109
|
-
setEmail("");
|
|
2110
|
-
} else {
|
|
2111
|
-
toast4.custom(
|
|
2112
|
-
() => /* @__PURE__ */ jsxs27(Alert4, { variant: "mono", icon: "destructive", children: [
|
|
2113
|
-
/* @__PURE__ */ jsx39(AlertIcon4, { children: /* @__PURE__ */ jsx39(CircleAlertIcon4, {}) }),
|
|
2114
|
-
/* @__PURE__ */ jsx39(AlertTitle4, { children: data.message || errorMessage })
|
|
2115
|
-
] }),
|
|
2116
|
-
{
|
|
2117
|
-
position: "top-center"
|
|
2118
|
-
}
|
|
2119
|
-
);
|
|
2120
|
-
}
|
|
2121
|
-
} catch (err) {
|
|
2122
|
-
console.error("Newsletter subscription error:", err);
|
|
2123
|
-
toast4.custom(
|
|
2124
|
-
() => /* @__PURE__ */ jsxs27(Alert4, { variant: "mono", icon: "destructive", children: [
|
|
2125
|
-
/* @__PURE__ */ jsx39(AlertIcon4, { children: /* @__PURE__ */ jsx39(CircleAlertIcon4, {}) }),
|
|
2126
|
-
/* @__PURE__ */ jsx39(AlertTitle4, { children: errorMessage })
|
|
2127
|
-
] }),
|
|
2128
|
-
{
|
|
2129
|
-
position: "top-center"
|
|
2130
|
-
}
|
|
2131
|
-
);
|
|
2132
|
-
} finally {
|
|
2133
|
-
setLoading(false);
|
|
2134
|
-
}
|
|
2135
|
-
};
|
|
2136
|
-
const style = {
|
|
2137
|
-
backgroundImage: `linear-gradient(0deg, transparent 0%, transparent 60%, rgba(183, 183, 183, 0.05) 60%, rgba(183, 183, 183, 0.05) 93%, transparent 93%, transparent 100%), linear-gradient(135deg, transparent 0%, transparent 55%, rgba(183, 183, 183, 0.05) 55%, rgba(183, 183, 183, 0.05) 84%, transparent 84%, transparent 100%), linear-gradient(0deg, transparent 0%, transparent 80%, rgba(183, 183, 183, 0.05) 80%, rgba(183, 183, 183, 0.05) 94%, transparent 94%, transparent 100%), linear-gradient(90deg, rgb(0,0,0), rgb(0,0,0))`
|
|
2138
|
-
};
|
|
2139
|
-
return /* @__PURE__ */ jsx39("footer", { children: /* @__PURE__ */ jsx39("div", { className: "container pt-10", children: /* @__PURE__ */ jsxs27(
|
|
2140
|
-
"div",
|
|
2141
|
-
{
|
|
2142
|
-
className: `mt-10 mb-8 flex flex-wrap items-center justify-between gap-7 rounded-xl px-10 py-16 md:px-20 ${className || ""}`,
|
|
2143
|
-
style,
|
|
2144
|
-
children: [
|
|
2145
|
-
/* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1.5", children: [
|
|
2146
|
-
/* @__PURE__ */ jsx39("h2", { className: "font-medium text-3xl text-white", children: heading }),
|
|
2147
|
-
/* @__PURE__ */ jsx39("div", { className: "font-medium text-2xl text-white/50", children: subheading })
|
|
2148
|
-
] }),
|
|
2149
|
-
/* @__PURE__ */ jsxs27("form", { onSubmit: handleSubmit, className: "flex gap-2.5", children: [
|
|
2150
|
-
/* @__PURE__ */ jsx39(
|
|
2151
|
-
Input,
|
|
2152
|
-
{
|
|
2153
|
-
type: "email",
|
|
2154
|
-
value: email,
|
|
2155
|
-
onChange: (e) => {
|
|
2156
|
-
setEmail(e.target.value);
|
|
2157
|
-
setShowRecaptcha(false);
|
|
2158
|
-
},
|
|
2159
|
-
placeholder: inputPlaceholder,
|
|
2160
|
-
className: "h-auto rounded-lg border border-input/20 bg-white/5 px-5 py-3 text-white/80 placeholder:text-white/50 focus:outline-none focus:ring md:min-w-64",
|
|
2161
|
-
required: true
|
|
2162
|
-
}
|
|
2163
|
-
),
|
|
2164
|
-
/* @__PURE__ */ jsx39(
|
|
2165
|
-
RecaptchaPopover,
|
|
2166
|
-
{
|
|
2167
|
-
open: showRecaptcha,
|
|
2168
|
-
onOpenChange: (open) => {
|
|
2169
|
-
if (!open) {
|
|
2170
|
-
setShowRecaptcha(false);
|
|
2171
|
-
}
|
|
2172
|
-
},
|
|
2173
|
-
onVerify: handleVerifiedSubmit,
|
|
2174
|
-
verifyButtonText,
|
|
2175
|
-
trigger: /* @__PURE__ */ jsx39(
|
|
2176
|
-
Button8,
|
|
2177
|
-
{
|
|
2178
|
-
type: "submit",
|
|
2179
|
-
className: "h-auto rounded-lg bg-white px-5 py-3 font-semibold text-black/80 hover:bg-white hover:text-black",
|
|
2180
|
-
disabled: loading,
|
|
2181
|
-
children: loading ? loadingButtonText : buttonText
|
|
2182
|
-
}
|
|
2183
|
-
)
|
|
2184
|
-
}
|
|
2185
|
-
)
|
|
2186
|
-
] })
|
|
2187
|
-
]
|
|
2188
|
-
}
|
|
2189
|
-
) }) });
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
3867
|
// src/components/ui/toolbar.tsx
|
|
2193
|
-
import {
|
|
2194
|
-
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
3868
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2195
3869
|
var Toolbar = ({ children }) => {
|
|
2196
|
-
return /* @__PURE__ */
|
|
3870
|
+
return /* @__PURE__ */ jsx39("div", { className: "flex grow items-center justify-between gap-2.5 pb-5", children });
|
|
2197
3871
|
};
|
|
2198
3872
|
var ToolbarHeading = ({ children, className }) => {
|
|
2199
|
-
return /* @__PURE__ */
|
|
3873
|
+
return /* @__PURE__ */ jsx39("div", { className: cn("flex flex-col flex-wrap gap-px", className), children });
|
|
2200
3874
|
};
|
|
2201
3875
|
var ToolbarTitle = ({ className, children }) => {
|
|
2202
|
-
return /* @__PURE__ */
|
|
3876
|
+
return /* @__PURE__ */ jsx39("h1", { className: cn("font-semibold text-foreground text-lg", className), children });
|
|
2203
3877
|
};
|
|
2204
3878
|
var ToolbarActions = ({ children }) => {
|
|
2205
|
-
return /* @__PURE__ */
|
|
3879
|
+
return /* @__PURE__ */ jsx39("div", { className: "flex flex-wrap items-center gap-1.5 lg:gap-3.5", children });
|
|
2206
3880
|
};
|
|
2207
3881
|
|
|
2208
3882
|
// src/components/ui/user-avatar.tsx
|
|
2209
|
-
import {
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
AvatarImage,
|
|
2213
|
-
AvatarIndicator,
|
|
2214
|
-
AvatarStatus
|
|
2215
|
-
} from "@pelatform/ui.default";
|
|
2216
|
-
import { jsx as jsx41, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2217
|
-
function UserAvatar({ className, indicator = false, src, alt }) {
|
|
3883
|
+
import { Avatar, AvatarFallback, AvatarImage } from "@pelatform/ui.components/base";
|
|
3884
|
+
import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3885
|
+
function UserAvatar({ className, src, alt }) {
|
|
2218
3886
|
const name = alt ?? "User";
|
|
2219
3887
|
const initial = getInitials(name);
|
|
2220
|
-
return /* @__PURE__ */
|
|
2221
|
-
/* @__PURE__ */
|
|
2222
|
-
/* @__PURE__ */
|
|
2223
|
-
indicator && /* @__PURE__ */ jsx41(AvatarIndicator, { className: "-end-2 -top-2", children: /* @__PURE__ */ jsx41(AvatarStatus, { variant: "online", className: "size-2.5" }) })
|
|
3888
|
+
return /* @__PURE__ */ jsxs26(Avatar, { className, children: [
|
|
3889
|
+
/* @__PURE__ */ jsx40(AvatarImage, { src: src ?? void 0, alt: name }),
|
|
3890
|
+
/* @__PURE__ */ jsx40(AvatarFallback, { children: initial })
|
|
2224
3891
|
] });
|
|
2225
3892
|
}
|
|
2226
3893
|
var getInitials = (name, count) => {
|
|
@@ -2232,7 +3899,7 @@ var getInitials = (name, count) => {
|
|
|
2232
3899
|
};
|
|
2233
3900
|
|
|
2234
3901
|
// src/components/utils/fonts.tsx
|
|
2235
|
-
import { jsx as
|
|
3902
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
2236
3903
|
var satoshiFontUrl = "https://assets.pelatform.com/fonts/satoshi/Satoshi-Variable.woff2";
|
|
2237
3904
|
var cssFontFace = `
|
|
2238
3905
|
@font-face {
|
|
@@ -2244,7 +3911,7 @@ var cssFontFace = `
|
|
|
2244
3911
|
}
|
|
2245
3912
|
`;
|
|
2246
3913
|
function SatoshiFontCSS() {
|
|
2247
|
-
return /* @__PURE__ */
|
|
3914
|
+
return /* @__PURE__ */ jsx41("style", { dangerouslySetInnerHTML: { __html: cssFontFace } });
|
|
2248
3915
|
}
|
|
2249
3916
|
export {
|
|
2250
3917
|
AlertComingsoon,
|
|
@@ -2287,14 +3954,12 @@ export {
|
|
|
2287
3954
|
MovingBorder,
|
|
2288
3955
|
MovingLabel,
|
|
2289
3956
|
QueryProvider,
|
|
2290
|
-
RecaptchaPopover,
|
|
2291
3957
|
SatoshiFontCSS,
|
|
2292
3958
|
ScreenLoader,
|
|
2293
3959
|
Section,
|
|
2294
3960
|
SiteFooter,
|
|
2295
3961
|
SiteHeader,
|
|
2296
3962
|
Stack,
|
|
2297
|
-
Subscribe,
|
|
2298
3963
|
ThemeProvider,
|
|
2299
3964
|
Toolbar,
|
|
2300
3965
|
ToolbarActions,
|
|
@@ -2310,7 +3975,6 @@ export {
|
|
|
2310
3975
|
getImage,
|
|
2311
3976
|
getInitials,
|
|
2312
3977
|
getListFiles,
|
|
2313
|
-
handleMenuClick,
|
|
2314
3978
|
openFileDialog,
|
|
2315
3979
|
satoshiFontUrl
|
|
2316
3980
|
};
|