@plyaz/ui 0.7.9 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-BBFJyA3y.js +89 -0
- package/dist/Button-oW9LiTe6.cjs +39 -0
- package/dist/Skeleton-BuCmZ9yF.cjs +1 -0
- package/dist/Skeleton-Cj9Od_Nd.js +37 -0
- package/dist/Textarea-CLBbcfr_.cjs +24 -0
- package/dist/Textarea-nx_ki3Gv.js +837 -0
- package/dist/client/accordion.cjs.js +1 -0
- package/dist/client/accordion.es.js +62 -0
- package/dist/client/alert-dialog.cjs.js +1 -0
- package/dist/client/alert-dialog.es.js +127 -0
- package/dist/client/avatar.cjs.js +1 -0
- package/dist/client/avatar.es.js +41 -0
- package/dist/client/calendar.cjs.js +1 -0
- package/dist/client/calendar.es.js +160 -0
- package/dist/client/carousel.cjs.js +1 -0
- package/dist/client/carousel.es.js +170 -0
- package/dist/client/checkbox.cjs.js +1 -0
- package/dist/client/checkbox.es.js +28 -0
- package/dist/client/combobox.cjs.js +1 -0
- package/dist/client/combobox.es.js +77 -0
- package/dist/client/command.cjs.js +1 -0
- package/dist/client/command.es.js +143 -0
- package/dist/client/context-menu.cjs.js +1 -0
- package/dist/client/context-menu.es.js +200 -0
- package/dist/client/dialog.cjs.js +1 -0
- package/dist/client/dialog.es.js +122 -0
- package/dist/client/drawer.cjs.js +1 -0
- package/dist/client/drawer.es.js +117 -0
- package/dist/client/dropdown-menu.cjs.js +1 -0
- package/dist/client/dropdown-menu.es.js +204 -0
- package/dist/client/hover-card.cjs.js +1 -0
- package/dist/client/hover-card.es.js +34 -0
- package/dist/client/input-otp.cjs.js +1 -0
- package/dist/client/input-otp.es.js +55 -0
- package/dist/client/label.cjs.js +1 -0
- package/dist/client/label.es.js +19 -0
- package/dist/client/menu-bar.cjs.js +1 -0
- package/dist/client/menu-bar.es.js +229 -0
- package/dist/client/popover.cjs.js +1 -0
- package/dist/client/popover.es.js +38 -0
- package/dist/client/progress.cjs.js +1 -0
- package/dist/client/progress.es.js +29 -0
- package/dist/client/radio-group.cjs.js +1 -0
- package/dist/client/radio-group.es.js +45 -0
- package/dist/client/reveal-text.cjs.js +1 -0
- package/dist/client/reveal-text.es.js +5066 -0
- package/dist/client/scroll-area.cjs.js +1 -0
- package/dist/client/scroll-area.es.js +60 -0
- package/dist/client/sheet.cjs.js +1 -0
- package/dist/client/sheet.es.js +117 -0
- package/dist/client/slider.cjs.js +1 -0
- package/dist/client/slider.es.js +63 -0
- package/dist/client/switch.cjs.js +1 -0
- package/dist/client/switch.es.js +28 -0
- package/dist/client/tabs.cjs.js +1 -0
- package/dist/client/tabs.es.js +55 -0
- package/dist/client/toaster.cjs.js +1 -0
- package/dist/client/toaster.es.js +22 -0
- package/dist/client/toggle.cjs.js +1 -0
- package/dist/client/toggle.es.js +43 -0
- package/dist/client/tooltip.cjs.js +1 -0
- package/dist/client/tooltip.es.js +51 -0
- package/dist/client.cjs.js +1 -93
- package/dist/client.es.js +495 -21191
- package/dist/index.cjs.js +15 -16
- package/dist/index.es.js +312 -558
- package/dist/types/client/accordion.d.ts +2 -0
- package/dist/types/client/alert-dialog.d.ts +2 -0
- package/dist/types/client/avatar.d.ts +2 -0
- package/dist/types/client/calendar.d.ts +2 -0
- package/dist/types/client/carousel.d.ts +2 -0
- package/dist/types/client/checkbox.d.ts +2 -0
- package/dist/types/client/combobox.d.ts +2 -0
- package/dist/types/client/command.d.ts +2 -0
- package/dist/types/client/context-menu.d.ts +2 -0
- package/dist/types/client/dialog.d.ts +2 -0
- package/dist/types/client/drawer.d.ts +2 -0
- package/dist/types/client/dropdown-menu.d.ts +2 -0
- package/dist/types/client/hover-card.d.ts +2 -0
- package/dist/types/client/input-otp.d.ts +2 -0
- package/dist/types/client/label.d.ts +2 -0
- package/dist/types/client/menu-bar.d.ts +2 -0
- package/dist/types/client/popover.d.ts +2 -0
- package/dist/types/client/progress.d.ts +2 -0
- package/dist/types/client/radio-group.d.ts +2 -0
- package/dist/types/client/reveal-text.d.ts +2 -0
- package/dist/types/client/scroll-area.d.ts +2 -0
- package/dist/types/client/sheet.d.ts +2 -0
- package/dist/types/client/slider.d.ts +2 -0
- package/dist/types/client/switch.d.ts +2 -0
- package/dist/types/client/tabs.d.ts +2 -0
- package/dist/types/client/toaster.d.ts +2 -0
- package/dist/types/client/toggle.d.ts +2 -0
- package/dist/types/client/tooltip.d.ts +2 -0
- package/dist/types/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
- package/dist/types/components/Label/Label.stories.d.ts +1 -1
- package/dist/types/components/Label/Label.stories.d.ts.map +1 -1
- package/dist/types/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/RadioGroup/RadioGroup.stories.d.ts.map +1 -1
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/types/components/Select/Select.stories.d.ts +0 -3
- package/dist/types/components/Select/Select.stories.d.ts.map +1 -1
- package/dist/types/components/Switch/Switch.stories.d.ts.map +1 -1
- package/dist/types/components/Textarea/Textarea.stories.d.ts.map +1 -1
- package/dist/types/components/client.d.ts +1 -0
- package/dist/types/components/client.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +0 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/ui.css +1 -1
- package/dist/utils-B6yFEsav.js +8 -0
- package/dist/utils-IjLH3w2e.cjs +1 -0
- package/package.json +186 -1
- package/dist/Skeleton-Bn2Kdinb.cjs +0 -62
- package/dist/Skeleton-CnBXKh2c.js +0 -3511
|
@@ -0,0 +1,837 @@
|
|
|
1
|
+
var ae = Object.defineProperty;
|
|
2
|
+
var re = (e, t, a) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var d = (e, t, a) => re(e, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
+
import { jsx as l, jsxs as ne } from "react/jsx-runtime";
|
|
5
|
+
import { cva as k } from "class-variance-authority";
|
|
6
|
+
import { c as _ } from "./utils-B6yFEsav.js";
|
|
7
|
+
import { B as ie } from "./Button-BBFJyA3y.js";
|
|
8
|
+
import { memo as se } from "react";
|
|
9
|
+
import "@radix-ui/react-select";
|
|
10
|
+
import "lucide-react";
|
|
11
|
+
import "next-intl";
|
|
12
|
+
import { Slot as oe } from "@radix-ui/react-slot";
|
|
13
|
+
import "@radix-ui/react-separator";
|
|
14
|
+
function le({ className: e, type: t, ...a }) {
|
|
15
|
+
return /* @__PURE__ */ l(
|
|
16
|
+
"input",
|
|
17
|
+
{
|
|
18
|
+
type: t,
|
|
19
|
+
"data-slot": "input",
|
|
20
|
+
className: _(
|
|
21
|
+
`
|
|
22
|
+
flex h-10 w-full min-w-0 rounded-sm border border-subtle bg-transparent
|
|
23
|
+
px-3 py-2 text-base transition-[color,box-shadow]
|
|
24
|
+
outline-none
|
|
25
|
+
selection:bg-primary selection:text-primary-foreground
|
|
26
|
+
file:inline-flex file:h-10 file:border-0 file:bg-transparent
|
|
27
|
+
file:text-sm file:font-medium file:text-foreground
|
|
28
|
+
text-secondary
|
|
29
|
+
placeholder:text-accent-foreground
|
|
30
|
+
disabled:pointer-events-none disabled:cursor-not-allowed
|
|
31
|
+
disabled:opacity-50 disabled:placeholder:text-secondary-foreground
|
|
32
|
+
md:text-sm
|
|
33
|
+
`,
|
|
34
|
+
`
|
|
35
|
+
focus-visible:border-ring focus-visible:ring-[3px]
|
|
36
|
+
focus-visible:ring-ring/50
|
|
37
|
+
`,
|
|
38
|
+
`
|
|
39
|
+
aria-invalid:border-destructive aria-invalid:ring-destructive/20
|
|
40
|
+
`,
|
|
41
|
+
e
|
|
42
|
+
),
|
|
43
|
+
...a,
|
|
44
|
+
"data-testid": "input"
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
function We({ className: e, ...t }) {
|
|
49
|
+
return /* @__PURE__ */ l(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
"data-slot": "input-group",
|
|
53
|
+
role: "group",
|
|
54
|
+
className: _(
|
|
55
|
+
"group/input-group border-subtle dark:bg-input/30 relative flex w-full items-center rounded-sm border transition-[color,box-shadow] outline-none",
|
|
56
|
+
"h-10 min-w-0 has-[>textarea]:h-auto",
|
|
57
|
+
// Variants based on alignment.
|
|
58
|
+
"has-[>[data-align=inline-start]]:[&>input]:pl-3",
|
|
59
|
+
"has-[>[data-align=inline-end]]:[&>input]:pr-3",
|
|
60
|
+
"has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-2",
|
|
61
|
+
"has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-2",
|
|
62
|
+
// Focus state.
|
|
63
|
+
"has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
|
|
64
|
+
// Error state.
|
|
65
|
+
"has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
|
|
66
|
+
// Disabled state.
|
|
67
|
+
"has-[[data-slot=input-group-control]:disabled]:opacity-50 has-[[data-slot=input-group-control]:disabled]:pointer-events-none has-[[data-slot=input-group-control]:disabled]:cursor-not-allowed",
|
|
68
|
+
e
|
|
69
|
+
),
|
|
70
|
+
...t
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const ce = k(
|
|
75
|
+
"text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
|
|
76
|
+
{
|
|
77
|
+
variants: {
|
|
78
|
+
align: {
|
|
79
|
+
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
80
|
+
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
|
|
81
|
+
"block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
|
|
82
|
+
"block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
defaultVariants: {
|
|
86
|
+
align: "inline-start"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
function Je({
|
|
91
|
+
className: e,
|
|
92
|
+
align: t = "inline-start",
|
|
93
|
+
...a
|
|
94
|
+
}) {
|
|
95
|
+
const r = (s) => {
|
|
96
|
+
var o, c;
|
|
97
|
+
s.target.closest("button") || (c = (o = s.currentTarget.parentElement) == null ? void 0 : o.querySelector("input")) == null || c.focus();
|
|
98
|
+
}, i = (s) => {
|
|
99
|
+
var o, c;
|
|
100
|
+
if (s.key === "Enter" || s.key === " ") {
|
|
101
|
+
if (s.preventDefault(), s.target.closest("button"))
|
|
102
|
+
return;
|
|
103
|
+
(c = (o = s.currentTarget.parentElement) == null ? void 0 : o.querySelector("input")) == null || c.focus();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
return /* @__PURE__ */ l(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
role: "button",
|
|
110
|
+
tabIndex: 0,
|
|
111
|
+
"data-slot": "input-group-addon",
|
|
112
|
+
"data-align": t,
|
|
113
|
+
className: _(ce({ align: t }), e),
|
|
114
|
+
onClick: r,
|
|
115
|
+
onKeyDown: i,
|
|
116
|
+
"aria-label": "Focus input field",
|
|
117
|
+
...a
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
const ue = k("text-sm shadow-none flex gap-2 items-center", {
|
|
122
|
+
variants: {
|
|
123
|
+
size: {
|
|
124
|
+
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
125
|
+
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
126
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
127
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
defaultVariants: {
|
|
131
|
+
size: "xs"
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
function Qe({
|
|
135
|
+
className: e,
|
|
136
|
+
type: t = "button",
|
|
137
|
+
variant: a = "default",
|
|
138
|
+
size: r = "xs",
|
|
139
|
+
...i
|
|
140
|
+
}) {
|
|
141
|
+
return /* @__PURE__ */ l(
|
|
142
|
+
ie,
|
|
143
|
+
{
|
|
144
|
+
type: t,
|
|
145
|
+
"data-size": r,
|
|
146
|
+
variant: a,
|
|
147
|
+
className: _(ue({ size: r }), e),
|
|
148
|
+
...i
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
function Xe({ className: e, ...t }) {
|
|
153
|
+
return /* @__PURE__ */ l(
|
|
154
|
+
"span",
|
|
155
|
+
{
|
|
156
|
+
className: _(
|
|
157
|
+
"text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
|
|
158
|
+
e
|
|
159
|
+
),
|
|
160
|
+
...t
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
function Ze({ className: e, ...t }) {
|
|
165
|
+
return /* @__PURE__ */ l(
|
|
166
|
+
le,
|
|
167
|
+
{
|
|
168
|
+
"data-slot": "input-group-control",
|
|
169
|
+
className: _(
|
|
170
|
+
"flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
171
|
+
e
|
|
172
|
+
),
|
|
173
|
+
...t
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
function et({ className: e, ...t }) {
|
|
178
|
+
return /* @__PURE__ */ l(
|
|
179
|
+
Ve,
|
|
180
|
+
{
|
|
181
|
+
"data-slot": "input-group-control",
|
|
182
|
+
className: _(
|
|
183
|
+
"flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
|
|
184
|
+
e
|
|
185
|
+
),
|
|
186
|
+
...t
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
const de = 10, _e = se(
|
|
191
|
+
({
|
|
192
|
+
children: e,
|
|
193
|
+
className: t = "",
|
|
194
|
+
colors: a = ["#FF0080", "#7928CA", "#0070F3", "#38bdf8"],
|
|
195
|
+
speed: r = 1
|
|
196
|
+
}) => {
|
|
197
|
+
const i = {
|
|
198
|
+
backgroundImage: `linear-gradient(135deg, ${a.join(", ")}, ${a[0]})`,
|
|
199
|
+
WebkitBackgroundClip: "text",
|
|
200
|
+
WebkitTextFillColor: "transparent",
|
|
201
|
+
animationDuration: `${de / r}s`
|
|
202
|
+
};
|
|
203
|
+
return /* @__PURE__ */ ne(
|
|
204
|
+
"span",
|
|
205
|
+
{
|
|
206
|
+
className: `
|
|
207
|
+
relative inline-block
|
|
208
|
+
${t}
|
|
209
|
+
`,
|
|
210
|
+
"data-testid": "auroraText",
|
|
211
|
+
children: [
|
|
212
|
+
/* @__PURE__ */ l("span", { className: "sr-only", children: e }),
|
|
213
|
+
/* @__PURE__ */ l(
|
|
214
|
+
"span",
|
|
215
|
+
{
|
|
216
|
+
className: `
|
|
217
|
+
relative animate-aurora bg-clip-text text-transparent
|
|
218
|
+
bg-[length:200%_auto]
|
|
219
|
+
`,
|
|
220
|
+
style: i,
|
|
221
|
+
"aria-hidden": "true",
|
|
222
|
+
children: e
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
_e.displayName = "AuroraText";
|
|
231
|
+
var fe = Object.defineProperty, n = (e, t) => fe(e, "name", { value: t, configurable: !0 }), O = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
|
|
232
|
+
function y(e, t) {
|
|
233
|
+
return `${e}:${JSON.stringify(t ?? {})}`;
|
|
234
|
+
}
|
|
235
|
+
n(y, "getFormatterKey");
|
|
236
|
+
function $(e) {
|
|
237
|
+
const t = typeof e == "string" || typeof e == "number" ? new Date(e) : e;
|
|
238
|
+
return t instanceof Date && !Number.isNaN(t.getTime()) ? t : null;
|
|
239
|
+
}
|
|
240
|
+
n($, "parseDate");
|
|
241
|
+
function ge(e, t = "en", a) {
|
|
242
|
+
var s;
|
|
243
|
+
const r = $(e);
|
|
244
|
+
if (!r)
|
|
245
|
+
return "";
|
|
246
|
+
const i = y(t, a);
|
|
247
|
+
return O.has(i) || O.set(i, new Intl.DateTimeFormat(t, a)), ((s = O.get(i)) == null ? void 0 : s.format(r)) ?? "";
|
|
248
|
+
}
|
|
249
|
+
n(ge, "formatDate");
|
|
250
|
+
function pe(e, t = "en", a) {
|
|
251
|
+
var i;
|
|
252
|
+
if (typeof e != "number" || Number.isNaN(e))
|
|
253
|
+
return "";
|
|
254
|
+
const r = y(t, a);
|
|
255
|
+
return S.has(r) || S.set(r, new Intl.NumberFormat(t, a)), ((i = S.get(r)) == null ? void 0 : i.format(e)) ?? "";
|
|
256
|
+
}
|
|
257
|
+
n(pe, "formatNumber");
|
|
258
|
+
var I = {
|
|
259
|
+
defaultLocale: "en",
|
|
260
|
+
supportedLocales: ["en", "es", "fr", "it", "pt-BR", "pt-PT"],
|
|
261
|
+
fallbackLocale: "en"
|
|
262
|
+
};
|
|
263
|
+
function ve() {
|
|
264
|
+
return I.supportedLocales;
|
|
265
|
+
}
|
|
266
|
+
n(ve, "getSupportedLanguages");
|
|
267
|
+
function me() {
|
|
268
|
+
return I.defaultLocale;
|
|
269
|
+
}
|
|
270
|
+
n(me, "getDefaultLanguage");
|
|
271
|
+
function he() {
|
|
272
|
+
return I.fallbackLocale;
|
|
273
|
+
}
|
|
274
|
+
n(he, "getFallbackLanguage");
|
|
275
|
+
function be(e) {
|
|
276
|
+
return I.supportedLocales.includes(e);
|
|
277
|
+
}
|
|
278
|
+
n(be, "isSupportedLanguage");
|
|
279
|
+
var g = /* @__PURE__ */ new Map();
|
|
280
|
+
function xe({
|
|
281
|
+
value: e,
|
|
282
|
+
forms: t,
|
|
283
|
+
lang: a,
|
|
284
|
+
type: r = "cardinal"
|
|
285
|
+
}) {
|
|
286
|
+
if (!W(e, t))
|
|
287
|
+
return "";
|
|
288
|
+
if (e === 0 && t.zero)
|
|
289
|
+
return L(t.zero, e);
|
|
290
|
+
const s = J(a, r).select(e), o = q(t, s) ?? t.other ?? Object.values(t)[0];
|
|
291
|
+
return o ? L(o, e) : "";
|
|
292
|
+
}
|
|
293
|
+
n(xe, "pluralize");
|
|
294
|
+
function C(e, t) {
|
|
295
|
+
return `${e}:${t}`;
|
|
296
|
+
}
|
|
297
|
+
n(C, "getPluralRulesKey");
|
|
298
|
+
var Ee = /{count}|#/g;
|
|
299
|
+
function q(e, t) {
|
|
300
|
+
switch (t) {
|
|
301
|
+
case "zero":
|
|
302
|
+
return e.zero;
|
|
303
|
+
case "one":
|
|
304
|
+
return e.one;
|
|
305
|
+
case "two":
|
|
306
|
+
return e.two;
|
|
307
|
+
case "few":
|
|
308
|
+
return e.few;
|
|
309
|
+
case "many":
|
|
310
|
+
return e.many;
|
|
311
|
+
case "other":
|
|
312
|
+
return e.other;
|
|
313
|
+
default:
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
n(q, "selectTemplate");
|
|
318
|
+
function W(e, t) {
|
|
319
|
+
return typeof e == "number" && t && typeof t == "object";
|
|
320
|
+
}
|
|
321
|
+
n(W, "isValidInput");
|
|
322
|
+
function L(e, t) {
|
|
323
|
+
return e.replaceAll(Ee, t.toString());
|
|
324
|
+
}
|
|
325
|
+
n(L, "replacePlaceholders");
|
|
326
|
+
function J(e, t) {
|
|
327
|
+
const a = C(e, t);
|
|
328
|
+
if (!g.has(a))
|
|
329
|
+
try {
|
|
330
|
+
g.set(a, new Intl.PluralRules(e, { type: t }));
|
|
331
|
+
} catch {
|
|
332
|
+
return A(a, t);
|
|
333
|
+
}
|
|
334
|
+
return g.get(a) ?? A(a, t);
|
|
335
|
+
}
|
|
336
|
+
n(J, "getPluralRules");
|
|
337
|
+
function A(e, t) {
|
|
338
|
+
const a = C("en", t);
|
|
339
|
+
g.has(a) || g.set(a, new Intl.PluralRules("en", { type: t }));
|
|
340
|
+
const r = g.get(a) ?? A(a, t);
|
|
341
|
+
return g.set(e, r), r;
|
|
342
|
+
}
|
|
343
|
+
n(A, "getFallbackPluralRules");
|
|
344
|
+
var w = null;
|
|
345
|
+
function Ne(e) {
|
|
346
|
+
w = e;
|
|
347
|
+
}
|
|
348
|
+
n(Ne, "setTranslationService");
|
|
349
|
+
function D() {
|
|
350
|
+
if (!w)
|
|
351
|
+
throw new Error(
|
|
352
|
+
"Translation service not initialized. Make sure to call setTranslationService() first."
|
|
353
|
+
);
|
|
354
|
+
return w;
|
|
355
|
+
}
|
|
356
|
+
n(D, "getTranslationService");
|
|
357
|
+
function Q(e, t) {
|
|
358
|
+
return t ? e.replace(/\{(\w+)\}/g, (a, r) => t[r] !== void 0 ? String(t[r]) : a) : e;
|
|
359
|
+
}
|
|
360
|
+
n(Q, "format");
|
|
361
|
+
var X = /* @__PURE__ */ ((e) => (e.AUTH_INVALID_CREDENTIALS = "auth.invalid_credentials", e.AUTH_ACCOUNT_LOCKED = "auth.account_locked", e.AUTH_EMAIL_NOT_VERIFIED = "auth.email_not_verified", e.AUTH_TOKEN_EXPIRED = "auth.token_expired", e.AUTH_TOKEN_INVALID = "auth.token_invalid", e.AUTH_INSUFFICIENT_PERMISSIONS = "auth.insufficient_permissions", e.AUTH_EMAIL_TAKEN = "auth.email_taken", e.AUTH_USERNAME_TAKEN = "auth.username_taken", e.AUTH_WALLET_SIGNATURE_INVALID = "auth.wallet_signature_invalid", e.VALIDATION_ERROR = "validation.error", e.REQUIRED_FIELD_MISSING = "validation.required_field_missing", e.INVALID_FORMAT = "validation.invalid_format", e.INVALID_ENUM_VALUE = "validation.invalid_enum_value", e.STRING_TOO_SHORT = "validation.string_too_short", e.STRING_TOO_LONG = "validation.string_too_long", e.NUMBER_TOO_SMALL = "validation.number_too_small", e.NUMBER_TOO_LARGE = "validation.number_too_large", e.ARRAY_TOO_SHORT = "validation.array_too_short", e.ARRAY_TOO_LONG = "validation.array_too_long", e.FILE_TOO_LARGE = "validation.file_too_large", e.UNSUPPORTED_FILE_TYPE = "validation.unsupported_file_type", e.DB_ENTITY_NOT_FOUND = "database.entity_not_found", e.DB_DUPLICATE_ENTRY = "database.duplicate_entry", e.DB_RELATION_VIOLATION = "database.relation_violation", e.DB_CONNECTION_ERROR = "database.connection_error", e.DB_TRANSACTION_FAILED = "database.transaction_failed", e.BLOCKCHAIN_CONNECTION_ERROR = "blockchain.connection_error", e.TRANSACTION_FAILED = "blockchain.transaction_failed", e.WALLET_CONNECTION_ERROR = "blockchain.wallet_connection_error", e.CONTRACT_INTERACTION_ERROR = "blockchain.contract_interaction_error", e.INSUFFICIENT_FUNDS = "blockchain.insufficient_funds", e.INTERNAL_SERVER_ERROR = "system.internal_server_error", e.SERVICE_UNAVAILABLE = "system.service_unavailable", e.EXTERNAL_SERVICE_ERROR = "system.external_service_error", e.RATE_LIMIT_EXCEEDED = "system.rate_limit_exceeded", e.FEATURE_DISABLED = "system.feature_disabled", e.GENERIC_ERROR = "generic.error", e.NOT_FOUND = "generic.not_found", e.CONFLICT = "generic.conflict", e.TIMEOUT = "generic.timeout", e))(X || {}), U = {
|
|
362
|
+
"auth.invalid_credentials": "errors.auth.invalid_credentials",
|
|
363
|
+
"auth.account_locked": "errors.auth.account_locked",
|
|
364
|
+
"auth.email_not_verified": "errors.auth.email_not_verified",
|
|
365
|
+
"auth.token_expired": "errors.auth.token_expired",
|
|
366
|
+
"auth.token_invalid": "errors.auth.token_invalid",
|
|
367
|
+
"auth.insufficient_permissions": "errors.auth.insufficient_permissions",
|
|
368
|
+
"auth.email_taken": "errors.auth.email_taken",
|
|
369
|
+
"auth.username_taken": "errors.auth.username_taken",
|
|
370
|
+
"auth.wallet_signature_invalid": "errors.auth.wallet_signature_invalid"
|
|
371
|
+
}, V = {
|
|
372
|
+
"validation.error": "errors.validation.error",
|
|
373
|
+
"validation.required_field_missing": "errors.validation.required_field_missing",
|
|
374
|
+
"validation.invalid_format": "errors.validation.invalid_format",
|
|
375
|
+
"validation.invalid_enum_value": "errors.validation.invalid_enum_value",
|
|
376
|
+
"validation.string_too_short": "errors.validation.string_too_short",
|
|
377
|
+
"validation.string_too_long": "errors.validation.string_too_long",
|
|
378
|
+
"validation.number_too_small": "errors.validation.number_too_small",
|
|
379
|
+
"validation.number_too_large": "errors.validation.number_too_large",
|
|
380
|
+
"validation.array_too_short": "errors.validation.array_too_short",
|
|
381
|
+
"validation.array_too_long": "errors.validation.array_too_long",
|
|
382
|
+
"validation.file_too_large": "errors.validation.file_too_large",
|
|
383
|
+
"validation.unsupported_file_type": "errors.validation.unsupported_file_type"
|
|
384
|
+
}, B = {
|
|
385
|
+
"database.entity_not_found": "errors.database.entity_not_found",
|
|
386
|
+
"database.duplicate_entry": "errors.database.duplicate_entry",
|
|
387
|
+
"database.relation_violation": "errors.database.relation_violation",
|
|
388
|
+
"database.connection_error": "errors.database.connection_error",
|
|
389
|
+
"database.transaction_failed": "errors.database.transaction_failed"
|
|
390
|
+
}, z = {
|
|
391
|
+
"blockchain.connection_error": "errors.blockchain.connection_error",
|
|
392
|
+
"blockchain.transaction_failed": "errors.blockchain.transaction_failed",
|
|
393
|
+
"blockchain.wallet_connection_error": "errors.blockchain.wallet_connection_error",
|
|
394
|
+
"blockchain.contract_interaction_error": "errors.blockchain.contract_interaction_error",
|
|
395
|
+
"blockchain.insufficient_funds": "errors.blockchain.insufficient_funds"
|
|
396
|
+
}, K = {
|
|
397
|
+
"system.internal_server_error": "errors.system.internal_server_error",
|
|
398
|
+
"system.service_unavailable": "errors.system.service_unavailable",
|
|
399
|
+
"system.external_service_error": "errors.system.external_service_error",
|
|
400
|
+
"system.rate_limit_exceeded": "errors.system.rate_limit_exceeded",
|
|
401
|
+
"system.feature_disabled": "errors.system.feature_disabled"
|
|
402
|
+
}, M = {
|
|
403
|
+
"generic.error": "errors.general.internal_error",
|
|
404
|
+
"generic.not_found": "errors.general.not_found",
|
|
405
|
+
"generic.conflict": "errors.general.conflict",
|
|
406
|
+
"generic.timeout": "errors.general.timeout"
|
|
407
|
+
}, G = {
|
|
408
|
+
"auth.invalid_credentials": 401,
|
|
409
|
+
"auth.account_locked": 423,
|
|
410
|
+
"auth.email_not_verified": 403,
|
|
411
|
+
"auth.token_expired": 401,
|
|
412
|
+
"auth.token_invalid": 401,
|
|
413
|
+
"auth.insufficient_permissions": 403,
|
|
414
|
+
"auth.email_taken": 409,
|
|
415
|
+
"auth.username_taken": 409,
|
|
416
|
+
"auth.wallet_signature_invalid": 401
|
|
417
|
+
}, P = {
|
|
418
|
+
"validation.error": 400,
|
|
419
|
+
"validation.required_field_missing": 400,
|
|
420
|
+
"validation.invalid_format": 400,
|
|
421
|
+
"validation.invalid_enum_value": 400,
|
|
422
|
+
"validation.string_too_short": 400,
|
|
423
|
+
"validation.string_too_long": 400,
|
|
424
|
+
"validation.number_too_small": 400,
|
|
425
|
+
"validation.number_too_large": 400,
|
|
426
|
+
"validation.array_too_short": 400,
|
|
427
|
+
"validation.array_too_long": 400,
|
|
428
|
+
"validation.file_too_large": 400,
|
|
429
|
+
"validation.unsupported_file_type": 400
|
|
430
|
+
}, H = {
|
|
431
|
+
"database.entity_not_found": 404,
|
|
432
|
+
"database.duplicate_entry": 409,
|
|
433
|
+
"database.relation_violation": 400,
|
|
434
|
+
"database.connection_error": 503,
|
|
435
|
+
"database.transaction_failed": 500
|
|
436
|
+
}, j = {
|
|
437
|
+
"blockchain.connection_error": 503,
|
|
438
|
+
"blockchain.transaction_failed": 400,
|
|
439
|
+
"blockchain.wallet_connection_error": 503,
|
|
440
|
+
"blockchain.contract_interaction_error": 400,
|
|
441
|
+
"blockchain.insufficient_funds": 400
|
|
442
|
+
}, Y = {
|
|
443
|
+
"system.internal_server_error": 500,
|
|
444
|
+
"system.service_unavailable": 503,
|
|
445
|
+
"system.external_service_error": 502,
|
|
446
|
+
"system.rate_limit_exceeded": 429,
|
|
447
|
+
"system.feature_disabled": 503
|
|
448
|
+
}, T = {
|
|
449
|
+
"generic.error": 500,
|
|
450
|
+
"generic.not_found": 404,
|
|
451
|
+
"generic.conflict": 409,
|
|
452
|
+
"generic.timeout": 408
|
|
453
|
+
}, p, u = (p = class extends Error {
|
|
454
|
+
constructor(a, r = {}) {
|
|
455
|
+
const { locale: i = "en", params: s, details: o, cause: c } = r, R = F(a, i, s);
|
|
456
|
+
super(R);
|
|
457
|
+
d(this, "name");
|
|
458
|
+
d(this, "type");
|
|
459
|
+
d(this, "code");
|
|
460
|
+
d(this, "statusCode");
|
|
461
|
+
d(this, "timestamp");
|
|
462
|
+
d(this, "details");
|
|
463
|
+
d(this, "cause");
|
|
464
|
+
d(this, "correlationId");
|
|
465
|
+
this.name = this.constructor.name, this.type = a, this.message = R, this.code = a.replace(/\./g, "_").toUpperCase(), this.statusCode = ee(a), this.timestamp = (/* @__PURE__ */ new Date()).toISOString(), this.details = o, this.cause = c, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
466
|
+
}
|
|
467
|
+
// Serialization methods
|
|
468
|
+
toJSON() {
|
|
469
|
+
return {
|
|
470
|
+
name: this.name,
|
|
471
|
+
message: this.message,
|
|
472
|
+
type: this.type,
|
|
473
|
+
code: this.code,
|
|
474
|
+
statusCode: this.statusCode,
|
|
475
|
+
timestamp: this.timestamp,
|
|
476
|
+
details: this.details,
|
|
477
|
+
correlationId: this.correlationId
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
// Factory method for creating error from plain object
|
|
481
|
+
static fromJSON(a) {
|
|
482
|
+
const r = new p(a.type);
|
|
483
|
+
return Object.assign(r, a), r;
|
|
484
|
+
}
|
|
485
|
+
}, n(p, "BaseError"), p), v, Re = (v = class extends u {
|
|
486
|
+
constructor(t, a = {}) {
|
|
487
|
+
super(t, a);
|
|
488
|
+
}
|
|
489
|
+
}, n(v, "ValidationError"), v), m, Ae = (m = class extends u {
|
|
490
|
+
constructor(t, a = {}) {
|
|
491
|
+
super(t, a);
|
|
492
|
+
}
|
|
493
|
+
}, n(m, "AuthError"), m), h;
|
|
494
|
+
h = class extends u {
|
|
495
|
+
constructor(t, a = {}) {
|
|
496
|
+
super(t, a);
|
|
497
|
+
}
|
|
498
|
+
}, n(h, "ApiError");
|
|
499
|
+
var b;
|
|
500
|
+
b = class extends u {
|
|
501
|
+
constructor(t, a = {}) {
|
|
502
|
+
super(t, a);
|
|
503
|
+
}
|
|
504
|
+
}, n(b, "BusinessError");
|
|
505
|
+
var x, ke = (x = class extends u {
|
|
506
|
+
constructor(t, a = {}) {
|
|
507
|
+
super(t, a);
|
|
508
|
+
}
|
|
509
|
+
}, n(x, "BlockchainError"), x), E;
|
|
510
|
+
E = class extends u {
|
|
511
|
+
constructor(t = "generic.error", a = {}) {
|
|
512
|
+
super(t, a);
|
|
513
|
+
}
|
|
514
|
+
}, n(E, "GenericError");
|
|
515
|
+
function F(e, t = "en", a) {
|
|
516
|
+
try {
|
|
517
|
+
const r = Z(e);
|
|
518
|
+
return D().t(r, {
|
|
519
|
+
lang: t,
|
|
520
|
+
interpolation: a,
|
|
521
|
+
defaultValue: `Error: ${e}`
|
|
522
|
+
});
|
|
523
|
+
} catch {
|
|
524
|
+
return D().t("errors.general.internal_error", {
|
|
525
|
+
lang: t,
|
|
526
|
+
interpolation: a,
|
|
527
|
+
defaultValue: "An internal server error occurred"
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
n(F, "translateError");
|
|
532
|
+
function Z(e) {
|
|
533
|
+
return e in U ? U[e] : e in V ? V[e] : e in B ? B[e] : e in z ? z[e] : e in K ? K[e] : e in M ? M[e] : "errors.general.internal_error";
|
|
534
|
+
}
|
|
535
|
+
n(Z, "getTranslationKeyForErrorType");
|
|
536
|
+
function ee(e) {
|
|
537
|
+
return e in G ? G[e] : e in P ? P[e] : e in H ? H[e] : e in j ? j[e] : e in Y ? Y[e] : e in T ? T[e] : T[
|
|
538
|
+
"system.internal_server_error"
|
|
539
|
+
/* INTERNAL_SERVER_ERROR */
|
|
540
|
+
];
|
|
541
|
+
}
|
|
542
|
+
n(ee, "getStatusCodeForType");
|
|
543
|
+
function Ie(e, t = "en", a) {
|
|
544
|
+
if (typeof e == "string")
|
|
545
|
+
return Q(e, a);
|
|
546
|
+
if (e instanceof u)
|
|
547
|
+
return e.message;
|
|
548
|
+
const r = e;
|
|
549
|
+
return r.type && Object.values(X).includes(r.type) ? F(r.type, t, a) : e.message || "An unknown error occurred";
|
|
550
|
+
}
|
|
551
|
+
n(Ie, "formatErrorMessage");
|
|
552
|
+
function Oe(e, t) {
|
|
553
|
+
const a = (/* @__PURE__ */ new Date()).toISOString();
|
|
554
|
+
return e instanceof u ? {
|
|
555
|
+
statusCode: e.statusCode,
|
|
556
|
+
errorCode: e.code,
|
|
557
|
+
message: e.message,
|
|
558
|
+
correlationId: t ?? e.correlationId,
|
|
559
|
+
timestamp: e.timestamp || a
|
|
560
|
+
} : {
|
|
561
|
+
statusCode: 500,
|
|
562
|
+
errorCode: "INTERNAL_SERVER_ERROR",
|
|
563
|
+
message: e.message || "An internal server error occurred",
|
|
564
|
+
correlationId: t,
|
|
565
|
+
timestamp: a
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
n(Oe, "createErrorResponse");
|
|
569
|
+
function Se(e, t) {
|
|
570
|
+
return e instanceof u && e.type === t;
|
|
571
|
+
}
|
|
572
|
+
n(Se, "isErrorType");
|
|
573
|
+
function Te(e) {
|
|
574
|
+
return e instanceof Re || e instanceof u && e.type.startsWith("validation.");
|
|
575
|
+
}
|
|
576
|
+
n(Te, "isValidationError");
|
|
577
|
+
function Le(e) {
|
|
578
|
+
return e instanceof Ae || e instanceof u && e.type.startsWith("auth.");
|
|
579
|
+
}
|
|
580
|
+
n(Le, "isAuthError");
|
|
581
|
+
function we(e) {
|
|
582
|
+
return e instanceof ke || e instanceof u && e.type.startsWith("blockchain.");
|
|
583
|
+
}
|
|
584
|
+
n(we, "isBlockchainError");
|
|
585
|
+
function De(e) {
|
|
586
|
+
return e.toJSON();
|
|
587
|
+
}
|
|
588
|
+
n(De, "serializeError");
|
|
589
|
+
function ye(e) {
|
|
590
|
+
return u.fromJSON(e);
|
|
591
|
+
}
|
|
592
|
+
n(ye, "deserializeError");
|
|
593
|
+
function Ce(e) {
|
|
594
|
+
return e.map((t) => ({
|
|
595
|
+
field: t.field,
|
|
596
|
+
message: t.message,
|
|
597
|
+
errorCode: "VALIDATION_ERROR",
|
|
598
|
+
context: {
|
|
599
|
+
valueGiven: t.value,
|
|
600
|
+
constraints: t.constraints
|
|
601
|
+
}
|
|
602
|
+
}));
|
|
603
|
+
}
|
|
604
|
+
n(Ce, "createValidationErrorDetails");
|
|
605
|
+
var f;
|
|
606
|
+
f = class {
|
|
607
|
+
constructor() {
|
|
608
|
+
d(this, "fallbackLocale");
|
|
609
|
+
this.fallbackLocale = "en";
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Get the singleton instance of LocaleDetector.
|
|
613
|
+
* @returns {LocaleDetector} The singleton instance.
|
|
614
|
+
*/
|
|
615
|
+
static getInstance() {
|
|
616
|
+
return f.instance || (f.instance = new f()), f.instance;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Detect locale using server-side request or client-side settings.
|
|
620
|
+
* @param {any} [request] - Optional server request object.
|
|
621
|
+
* @returns {string} Detected locale string.
|
|
622
|
+
*/
|
|
623
|
+
detectLocale(t) {
|
|
624
|
+
return t ? this.detectFromRequest(t) : this.fallbackLocale;
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Detect locale from a server request (query, headers, cookies).
|
|
628
|
+
* @param {any} request - Server request object.
|
|
629
|
+
* @returns {string} Detected locale string.
|
|
630
|
+
* @private
|
|
631
|
+
*/
|
|
632
|
+
detectFromRequest(t) {
|
|
633
|
+
var s, o, c;
|
|
634
|
+
const a = (s = t.url.split("?")[1]) == null ? void 0 : s.split("=")[1], r = t.headers.get("accept-language"), i = (c = (o = t.headers.get("cookie")) == null ? void 0 : o.split("; ").find((R) => R.startsWith("locale="))) == null ? void 0 : c.split("=")[1];
|
|
635
|
+
return a ?? i ?? this.parseAcceptLanguage(r ?? "") ?? this.fallbackLocale;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* Parse Accept-Language header and return the highest priority language.
|
|
639
|
+
* @param {string} header - Accept-Language header value.
|
|
640
|
+
* @returns {string|null} Best language or null.
|
|
641
|
+
* @private
|
|
642
|
+
*/
|
|
643
|
+
parseAcceptLanguage(t) {
|
|
644
|
+
if (!t)
|
|
645
|
+
return null;
|
|
646
|
+
let a = null, r = 0;
|
|
647
|
+
for (const i of t.split(",")) {
|
|
648
|
+
const { lang: s, q: o } = this.parseLangAndQ(i.trim());
|
|
649
|
+
if (o > r && (r = o, a = s, o === 1))
|
|
650
|
+
break;
|
|
651
|
+
}
|
|
652
|
+
return a;
|
|
653
|
+
}
|
|
654
|
+
parseLangAndQ(t) {
|
|
655
|
+
const a = t.indexOf(";"), r = a === -1 ? t : t.slice(0, Math.max(0, a));
|
|
656
|
+
let i = 1;
|
|
657
|
+
if (a !== -1) {
|
|
658
|
+
const s = /q=(?<q>[\d.]+)/.exec(t.slice(a + 1));
|
|
659
|
+
i = s != null && s.groups ? Number.parseFloat(s.groups.q) || 0 : 1;
|
|
660
|
+
}
|
|
661
|
+
return { lang: r, q: i };
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Set the fallback locale.
|
|
665
|
+
* @param {string} locale - Fallback locale string.
|
|
666
|
+
* @internal
|
|
667
|
+
*/
|
|
668
|
+
setFallbackLocale(t) {
|
|
669
|
+
this.fallbackLocale = t;
|
|
670
|
+
}
|
|
671
|
+
}, n(f, "LocaleDetector"), d(f, "instance");
|
|
672
|
+
var N;
|
|
673
|
+
N = class {
|
|
674
|
+
constructor(t) {
|
|
675
|
+
d(this, "namespaces");
|
|
676
|
+
this.namespaces = t ? new Map(t) : /* @__PURE__ */ new Map();
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Add a namespace with its translations.
|
|
680
|
+
* @param {string} name - Namespace name.
|
|
681
|
+
* @param {Record<string, string>} translations - Translation key-value pairs.
|
|
682
|
+
* @throws {Error} If the namespace name is invalid.
|
|
683
|
+
*/
|
|
684
|
+
addNamespace(t, a) {
|
|
685
|
+
if (!te(t))
|
|
686
|
+
throw new Error("Invalid namespace name");
|
|
687
|
+
this.namespaces.set(t, a);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Get a namespace by name.
|
|
691
|
+
* @param {string} name - Namespace name.
|
|
692
|
+
* @returns {Record<string, string> | undefined} Namespace translations or undefined.
|
|
693
|
+
*/
|
|
694
|
+
getNamespace(t) {
|
|
695
|
+
return this.namespaces.get(t);
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Get all namespace names.
|
|
699
|
+
* @returns {string[]} Array of namespace names.
|
|
700
|
+
*/
|
|
701
|
+
getAllNamespaces() {
|
|
702
|
+
return [...this.namespaces.keys()];
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Merge two namespaces into the target.
|
|
706
|
+
* @param {string} target - Target namespace name.
|
|
707
|
+
* @param {string} source - Source namespace name.
|
|
708
|
+
*/
|
|
709
|
+
mergeNamespaces(t, a) {
|
|
710
|
+
const r = this.namespaces.get(t) ?? {}, i = this.namespaces.get(a) ?? {};
|
|
711
|
+
this.namespaces.set(t, { ...r, ...i });
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Validate a namespace against a schema.
|
|
715
|
+
* @param {string} name - Namespace name.
|
|
716
|
+
* @param {Record<string, string>} [schema] - Optional schema to validate against.
|
|
717
|
+
* @returns {boolean} True if valid, false otherwise.
|
|
718
|
+
*/
|
|
719
|
+
validateNamespace(t, a) {
|
|
720
|
+
const r = this.namespaces.get(t);
|
|
721
|
+
return r ? a ? Object.entries(a).every(([i, s]) => {
|
|
722
|
+
var c;
|
|
723
|
+
const o = (c = Object.getOwnPropertyDescriptor(r, i)) == null ? void 0 : c.value;
|
|
724
|
+
return o !== void 0 && typeof o === s;
|
|
725
|
+
}) : !0 : !1;
|
|
726
|
+
}
|
|
727
|
+
}, n(N, "NamespaceManager");
|
|
728
|
+
function te(e) {
|
|
729
|
+
return /^\w+$/.test(e);
|
|
730
|
+
}
|
|
731
|
+
n(te, "isSafeKey");
|
|
732
|
+
const Fe = k(
|
|
733
|
+
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
734
|
+
{
|
|
735
|
+
variants: {
|
|
736
|
+
variant: {
|
|
737
|
+
default: "bg-card text-card-foreground",
|
|
738
|
+
destructive: "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"
|
|
739
|
+
}
|
|
740
|
+
},
|
|
741
|
+
defaultVariants: {
|
|
742
|
+
variant: "default"
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
);
|
|
746
|
+
function tt({
|
|
747
|
+
className: e,
|
|
748
|
+
variant: t,
|
|
749
|
+
...a
|
|
750
|
+
}) {
|
|
751
|
+
return /* @__PURE__ */ l(
|
|
752
|
+
"div",
|
|
753
|
+
{
|
|
754
|
+
"data-slot": "alert",
|
|
755
|
+
role: "alert",
|
|
756
|
+
className: _(Fe({ variant: t }), e),
|
|
757
|
+
...a
|
|
758
|
+
}
|
|
759
|
+
);
|
|
760
|
+
}
|
|
761
|
+
function at({ className: e, ...t }) {
|
|
762
|
+
return /* @__PURE__ */ l(
|
|
763
|
+
"div",
|
|
764
|
+
{
|
|
765
|
+
"data-slot": "alert-title",
|
|
766
|
+
className: _("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight", e),
|
|
767
|
+
...t
|
|
768
|
+
}
|
|
769
|
+
);
|
|
770
|
+
}
|
|
771
|
+
function rt({ className: e, ...t }) {
|
|
772
|
+
return /* @__PURE__ */ l(
|
|
773
|
+
"div",
|
|
774
|
+
{
|
|
775
|
+
"data-slot": "alert-description",
|
|
776
|
+
className: _(
|
|
777
|
+
"text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",
|
|
778
|
+
e
|
|
779
|
+
),
|
|
780
|
+
...t
|
|
781
|
+
}
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
const Ue = k(
|
|
785
|
+
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
786
|
+
{
|
|
787
|
+
variants: {
|
|
788
|
+
variant: {
|
|
789
|
+
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
790
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
791
|
+
destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
792
|
+
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
defaultVariants: {
|
|
796
|
+
variant: "default"
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
);
|
|
800
|
+
function nt({
|
|
801
|
+
className: e,
|
|
802
|
+
variant: t,
|
|
803
|
+
asChild: a = !1,
|
|
804
|
+
...r
|
|
805
|
+
}) {
|
|
806
|
+
return /* @__PURE__ */ l(a ? oe : "span", { "data-slot": "badge", className: _(Ue({ variant: t }), e), ...r });
|
|
807
|
+
}
|
|
808
|
+
function Ve({ className: e, ...t }) {
|
|
809
|
+
return /* @__PURE__ */ l(
|
|
810
|
+
"textarea",
|
|
811
|
+
{
|
|
812
|
+
"data-slot": "textarea",
|
|
813
|
+
className: _(
|
|
814
|
+
"border-subtle text-secondary bg-background placeholder:text-accent-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive flex field-sizing-content min-h-16 w-full rounded-sm border px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 disabled:placeholder:text-secondary-foreground md:text-sm",
|
|
815
|
+
e
|
|
816
|
+
),
|
|
817
|
+
...t
|
|
818
|
+
}
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
export {
|
|
822
|
+
_e as A,
|
|
823
|
+
nt as B,
|
|
824
|
+
le as I,
|
|
825
|
+
Ve as T,
|
|
826
|
+
pe as a,
|
|
827
|
+
We as b,
|
|
828
|
+
Je as c,
|
|
829
|
+
Qe as d,
|
|
830
|
+
Xe as e,
|
|
831
|
+
ge as f,
|
|
832
|
+
Ze as g,
|
|
833
|
+
et as h,
|
|
834
|
+
tt as i,
|
|
835
|
+
at as j,
|
|
836
|
+
rt as k
|
|
837
|
+
};
|