@goplusvn/core 0.1.1 → 0.1.3

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.
Files changed (223) hide show
  1. package/package.json +31 -175
  2. package/dist/audit/index.d.mts +0 -115
  3. package/dist/audit/index.d.ts +0 -115
  4. package/dist/audit/index.js +0 -204
  5. package/dist/audit/index.js.map +0 -1
  6. package/dist/audit/index.mjs +0 -200
  7. package/dist/audit/index.mjs.map +0 -1
  8. package/dist/auth/index.d.mts +0 -86
  9. package/dist/auth/index.d.ts +0 -86
  10. package/dist/auth/index.js +0 -210
  11. package/dist/auth/index.js.map +0 -1
  12. package/dist/auth/index.mjs +0 -198
  13. package/dist/auth/index.mjs.map +0 -1
  14. package/dist/button-1dWvP9Ib.d.mts +0 -30
  15. package/dist/button-1dWvP9Ib.d.ts +0 -30
  16. package/dist/calendar-2QzdEo1z.d.mts +0 -20
  17. package/dist/calendar-2QzdEo1z.d.ts +0 -20
  18. package/dist/code-generation/index.d.mts +0 -30
  19. package/dist/code-generation/index.d.ts +0 -30
  20. package/dist/code-generation/index.js +0 -31
  21. package/dist/code-generation/index.js.map +0 -1
  22. package/dist/code-generation/index.mjs +0 -28
  23. package/dist/code-generation/index.mjs.map +0 -1
  24. package/dist/configs/index.d.mts +0 -175
  25. package/dist/configs/index.d.ts +0 -175
  26. package/dist/configs/index.js +0 -254
  27. package/dist/configs/index.js.map +0 -1
  28. package/dist/configs/index.mjs +0 -233
  29. package/dist/configs/index.mjs.map +0 -1
  30. package/dist/crud/index.d.mts +0 -646
  31. package/dist/crud/index.d.ts +0 -646
  32. package/dist/crud/index.js +0 -11772
  33. package/dist/crud/index.js.map +0 -1
  34. package/dist/crud/index.mjs +0 -11665
  35. package/dist/crud/index.mjs.map +0 -1
  36. package/dist/crud/server.d.mts +0 -20
  37. package/dist/crud/server.d.ts +0 -20
  38. package/dist/crud/server.js +0 -123
  39. package/dist/crud/server.js.map +0 -1
  40. package/dist/crud/server.mjs +0 -120
  41. package/dist/crud/server.mjs.map +0 -1
  42. package/dist/data-table-skeleton-12NA8Mjx.d.mts +0 -39
  43. package/dist/data-table-skeleton-12NA8Mjx.d.ts +0 -39
  44. package/dist/dialog-bKfjZMTd.d.mts +0 -22
  45. package/dist/dialog-bKfjZMTd.d.ts +0 -22
  46. package/dist/dynamic-icon-DrGIiu2N.d.mts +0 -10
  47. package/dist/dynamic-icon-DrGIiu2N.d.ts +0 -10
  48. package/dist/home/index.d.mts +0 -269
  49. package/dist/home/index.d.ts +0 -269
  50. package/dist/home/index.js +0 -1678
  51. package/dist/home/index.js.map +0 -1
  52. package/dist/home/index.mjs +0 -1635
  53. package/dist/home/index.mjs.map +0 -1
  54. package/dist/hooks/index.d.mts +0 -7
  55. package/dist/hooks/index.d.ts +0 -7
  56. package/dist/hooks/index.js +0 -8316
  57. package/dist/hooks/index.js.map +0 -1
  58. package/dist/hooks/index.mjs +0 -8255
  59. package/dist/hooks/index.mjs.map +0 -1
  60. package/dist/index-50hpiPrV.d.ts +0 -116
  61. package/dist/index-B9zQVEVi.d.mts +0 -116
  62. package/dist/index.d.mts +0 -5
  63. package/dist/index.d.ts +0 -5
  64. package/dist/index.js +0 -123
  65. package/dist/index.js.map +0 -1
  66. package/dist/index.mjs +0 -118
  67. package/dist/index.mjs.map +0 -1
  68. package/dist/infrastructure/index.d.mts +0 -423
  69. package/dist/infrastructure/index.d.ts +0 -423
  70. package/dist/infrastructure/index.js +0 -633
  71. package/dist/infrastructure/index.js.map +0 -1
  72. package/dist/infrastructure/index.mjs +0 -619
  73. package/dist/infrastructure/index.mjs.map +0 -1
  74. package/dist/label-DWTEkNPo.d.ts +0 -226
  75. package/dist/label-LPpdcoBx.d.mts +0 -226
  76. package/dist/layout/index.d.mts +0 -48
  77. package/dist/layout/index.d.ts +0 -48
  78. package/dist/layout/index.js +0 -117
  79. package/dist/layout/index.js.map +0 -1
  80. package/dist/layout/index.mjs +0 -90
  81. package/dist/layout/index.mjs.map +0 -1
  82. package/dist/navigation/index.d.mts +0 -16
  83. package/dist/navigation/index.d.ts +0 -16
  84. package/dist/navigation/index.js +0 -53
  85. package/dist/navigation/index.js.map +0 -1
  86. package/dist/navigation/index.mjs +0 -50
  87. package/dist/navigation/index.mjs.map +0 -1
  88. package/dist/notification/index.d.mts +0 -105
  89. package/dist/notification/index.d.ts +0 -105
  90. package/dist/notification/index.js +0 -278
  91. package/dist/notification/index.js.map +0 -1
  92. package/dist/notification/index.mjs +0 -274
  93. package/dist/notification/index.mjs.map +0 -1
  94. package/dist/organization/index.d.mts +0 -99
  95. package/dist/organization/index.d.ts +0 -99
  96. package/dist/organization/index.js +0 -360
  97. package/dist/organization/index.js.map +0 -1
  98. package/dist/organization/index.mjs +0 -352
  99. package/dist/organization/index.mjs.map +0 -1
  100. package/dist/plugin/index.d.mts +0 -83
  101. package/dist/plugin/index.d.ts +0 -83
  102. package/dist/plugin/index.js +0 -86
  103. package/dist/plugin/index.js.map +0 -1
  104. package/dist/plugin/index.mjs +0 -84
  105. package/dist/plugin/index.mjs.map +0 -1
  106. package/dist/providers/index.d.mts +0 -25
  107. package/dist/providers/index.d.ts +0 -25
  108. package/dist/providers/index.js +0 -84
  109. package/dist/providers/index.js.map +0 -1
  110. package/dist/providers/index.mjs +0 -77
  111. package/dist/providers/index.mjs.map +0 -1
  112. package/dist/rbac/index.d.mts +0 -226
  113. package/dist/rbac/index.d.ts +0 -226
  114. package/dist/rbac/index.js +0 -4784
  115. package/dist/rbac/index.js.map +0 -1
  116. package/dist/rbac/index.mjs +0 -4722
  117. package/dist/rbac/index.mjs.map +0 -1
  118. package/dist/rbac/permissions.d.mts +0 -26
  119. package/dist/rbac/permissions.d.ts +0 -26
  120. package/dist/rbac/permissions.js +0 -94
  121. package/dist/rbac/permissions.js.map +0 -1
  122. package/dist/rbac/permissions.mjs +0 -90
  123. package/dist/rbac/permissions.mjs.map +0 -1
  124. package/dist/rbac/server.d.mts +0 -1
  125. package/dist/rbac/server.d.ts +0 -1
  126. package/dist/rbac/server.js +0 -128
  127. package/dist/rbac/server.js.map +0 -1
  128. package/dist/rbac/server.mjs +0 -124
  129. package/dist/rbac/server.mjs.map +0 -1
  130. package/dist/schemas/index.d.mts +0 -1257
  131. package/dist/schemas/index.d.ts +0 -1257
  132. package/dist/schemas/index.js +0 -572
  133. package/dist/schemas/index.js.map +0 -1
  134. package/dist/schemas/index.mjs +0 -523
  135. package/dist/schemas/index.mjs.map +0 -1
  136. package/dist/server-QuYCTa89.d.mts +0 -83
  137. package/dist/server-QuYCTa89.d.ts +0 -83
  138. package/dist/sonner-C74GlRDQ.d.mts +0 -71
  139. package/dist/sonner-C74GlRDQ.d.ts +0 -71
  140. package/dist/status-BOXZgIqX.d.mts +0 -12
  141. package/dist/status-BOXZgIqX.d.ts +0 -12
  142. package/dist/system/index.d.mts +0 -77
  143. package/dist/system/index.d.ts +0 -77
  144. package/dist/system/index.js +0 -102
  145. package/dist/system/index.js.map +0 -1
  146. package/dist/system/index.mjs +0 -100
  147. package/dist/system/index.mjs.map +0 -1
  148. package/dist/tabs-C6FfBwPY.d.mts +0 -18
  149. package/dist/tabs-C6FfBwPY.d.ts +0 -18
  150. package/dist/tenant-provider-B8eC_Wpb.d.mts +0 -27
  151. package/dist/tenant-provider-B8eC_Wpb.d.ts +0 -27
  152. package/dist/types/index.d.mts +0 -469
  153. package/dist/types/index.d.ts +0 -469
  154. package/dist/types/index.js +0 -25
  155. package/dist/types/index.js.map +0 -1
  156. package/dist/types/index.mjs +0 -21
  157. package/dist/types/index.mjs.map +0 -1
  158. package/dist/ui/auth.d.mts +0 -39
  159. package/dist/ui/auth.d.ts +0 -39
  160. package/dist/ui/auth.js +0 -4941
  161. package/dist/ui/auth.js.map +0 -1
  162. package/dist/ui/auth.mjs +0 -4896
  163. package/dist/ui/auth.mjs.map +0 -1
  164. package/dist/ui/crud.d.mts +0 -2
  165. package/dist/ui/crud.d.ts +0 -2
  166. package/dist/ui/crud.js +0 -4
  167. package/dist/ui/crud.js.map +0 -1
  168. package/dist/ui/crud.mjs +0 -3
  169. package/dist/ui/crud.mjs.map +0 -1
  170. package/dist/ui/data-display.d.mts +0 -596
  171. package/dist/ui/data-display.d.ts +0 -596
  172. package/dist/ui/data-display.js +0 -5307
  173. package/dist/ui/data-display.js.map +0 -1
  174. package/dist/ui/data-display.mjs +0 -5212
  175. package/dist/ui/data-display.mjs.map +0 -1
  176. package/dist/ui/feedback.d.mts +0 -55
  177. package/dist/ui/feedback.d.ts +0 -55
  178. package/dist/ui/feedback.js +0 -2608
  179. package/dist/ui/feedback.js.map +0 -1
  180. package/dist/ui/feedback.mjs +0 -2526
  181. package/dist/ui/feedback.mjs.map +0 -1
  182. package/dist/ui/forms.d.mts +0 -309
  183. package/dist/ui/forms.d.ts +0 -309
  184. package/dist/ui/forms.js +0 -4656
  185. package/dist/ui/forms.js.map +0 -1
  186. package/dist/ui/forms.mjs +0 -4571
  187. package/dist/ui/forms.mjs.map +0 -1
  188. package/dist/ui/index.d.mts +0 -331
  189. package/dist/ui/index.d.ts +0 -331
  190. package/dist/ui/index.js +0 -16953
  191. package/dist/ui/index.js.map +0 -1
  192. package/dist/ui/index.mjs +0 -16598
  193. package/dist/ui/index.mjs.map +0 -1
  194. package/dist/ui/primitives/client.d.mts +0 -61
  195. package/dist/ui/primitives/client.d.ts +0 -61
  196. package/dist/ui/primitives/client.js +0 -3408
  197. package/dist/ui/primitives/client.js.map +0 -1
  198. package/dist/ui/primitives/client.mjs +0 -3256
  199. package/dist/ui/primitives/client.mjs.map +0 -1
  200. package/dist/ui/primitives.d.mts +0 -113
  201. package/dist/ui/primitives.d.ts +0 -113
  202. package/dist/ui/primitives.js +0 -3356
  203. package/dist/ui/primitives.js.map +0 -1
  204. package/dist/ui/primitives.mjs +0 -3227
  205. package/dist/ui/primitives.mjs.map +0 -1
  206. package/dist/user/index.d.mts +0 -228
  207. package/dist/user/index.d.ts +0 -228
  208. package/dist/user/index.js +0 -4306
  209. package/dist/user/index.js.map +0 -1
  210. package/dist/user/index.mjs +0 -4260
  211. package/dist/user/index.mjs.map +0 -1
  212. package/dist/utils/index.d.mts +0 -205
  213. package/dist/utils/index.d.ts +0 -205
  214. package/dist/utils/index.js +0 -574
  215. package/dist/utils/index.js.map +0 -1
  216. package/dist/utils/index.mjs +0 -514
  217. package/dist/utils/index.mjs.map +0 -1
  218. package/dist/workflow/index.d.mts +0 -40
  219. package/dist/workflow/index.d.ts +0 -40
  220. package/dist/workflow/index.js +0 -3710
  221. package/dist/workflow/index.js.map +0 -1
  222. package/dist/workflow/index.mjs +0 -3677
  223. package/dist/workflow/index.mjs.map +0 -1
package/dist/ui/auth.mjs DELETED
@@ -1,4896 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
3
- import { EyeOff, Eye, Earth, Dot, Facebook, Github, Chrome, Twitter, Check, X, PanelLeft, ChevronsUpDown, Search } from 'lucide-react';
4
- import * as React10 from 'react';
5
- import { useCallback, useContext, useId, createContext, useState, useRef, useEffect, useMemo, memo } from 'react';
6
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
7
- import 'react-use';
8
- import '@radix-ui/react-direction';
9
- import { useParams, useSearchParams, useRouter, usePathname } from 'next/navigation';
10
- import { cva } from 'class-variance-authority';
11
- import { Slot } from '@radix-ui/react-slot';
12
- import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
13
- import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
14
- import * as DialogPrimitive from '@radix-ui/react-dialog';
15
- import * as TabsPrimitive from '@radix-ui/react-tabs';
16
- import Link15 from 'next/link';
17
- import '@radix-ui/react-progress';
18
- import '@radix-ui/react-context-menu';
19
- import 'vaul';
20
- import { toast } from 'sonner';
21
- import '@radix-ui/react-alert-dialog';
22
- import * as TooltipPrimitive from '@radix-ui/react-tooltip';
23
- import '@radix-ui/react-popover';
24
- import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
25
- import 'react-day-picker';
26
- import 'react-resizable-panels';
27
- import '@radix-ui/react-slider';
28
- import '@radix-ui/react-switch';
29
- import '@radix-ui/react-select';
30
- import '@radix-ui/react-menubar';
31
- import '@radix-ui/react-navigation-menu';
32
- import '@radix-ui/react-toggle';
33
- import '@radix-ui/react-toggle-group';
34
- import * as LabelPrimitive from '@radix-ui/react-label';
35
- import '@radix-ui/react-radio-group';
36
- import 'cmdk';
37
- import 'date-fns';
38
- import dynamic from 'next/dynamic';
39
- import 'emoji-picker-react';
40
- import Image8 from 'next/image';
41
- import 'react-dropzone';
42
- import 'input-otp';
43
- import 'react-phone-number-input';
44
- import '@tiptap/extension-color';
45
- import '@tiptap/extension-image';
46
- import '@tiptap/extension-link';
47
- import '@tiptap/extension-placeholder';
48
- import '@tiptap/extension-text-align';
49
- import '@tiptap/extension-text-style';
50
- import '@tiptap/extension-typography';
51
- import '@tiptap/extension-underline';
52
- import '@tiptap/react';
53
- import '@tiptap/starter-kit';
54
- import { useForm, Controller, useFormContext, FormProvider } from 'react-hook-form';
55
- import '@radix-ui/react-avatar';
56
- import 'recharts';
57
- import 'embla-carousel-react';
58
- import '@radix-ui/react-accordion';
59
- import '@dnd-kit/sortable';
60
- import '@dnd-kit/utilities';
61
- import '@dnd-kit/core';
62
- import 'react-dom';
63
- import '@radix-ui/react-aspect-ratio';
64
- import 'hast-util-to-jsx-runtime';
65
- import 'shiki/bundle/web';
66
- import '@radix-ui/react-collapsible';
67
- import '@radix-ui/react-hover-card';
68
- import 'framer-motion';
69
- import { signIn } from 'next-auth/react';
70
- import { z } from 'zod';
71
- import { zodResolver } from '@hookform/resolvers/zod';
72
-
73
- var __getOwnPropNames = Object.getOwnPropertyNames;
74
- var __esm = (fn, res) => function __init() {
75
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
76
- };
77
-
78
- // src/configs/status.ts
79
- function booleanToStatus(value) {
80
- return value ? STATUS_ACTIVE : STATUS_INACTIVE;
81
- }
82
- var STATUS_ACTIVE, STATUS_INACTIVE, STATUS_VALUES;
83
- var init_status = __esm({
84
- "src/configs/status.ts"() {
85
- STATUS_ACTIVE = "active";
86
- STATUS_INACTIVE = "inactive";
87
- STATUS_VALUES = [STATUS_ACTIVE, STATUS_INACTIVE];
88
- }
89
- });
90
- function cn(...inputs) {
91
- return twMerge(clsx(inputs));
92
- }
93
- function ensureWithPrefix(value, prefix) {
94
- return value.startsWith(prefix) ? value : `${prefix}${value}`;
95
- }
96
- function ensureWithSuffix(value, suffix) {
97
- return value.endsWith(suffix) ? value : `${value}${suffix}`;
98
- }
99
- function ensureWithoutSuffix(value, suffix) {
100
- return value.endsWith(suffix) ? value.slice(0, -suffix.length) : value;
101
- }
102
- function getDictionaryValue(key, section, fallback) {
103
- const value = section[key];
104
- if (typeof value !== "string") {
105
- const normalizedKey = key.replace(/[-_]/g, "");
106
- const normalizedValue = section[normalizedKey];
107
- if (typeof normalizedValue === "string") {
108
- return normalizedValue;
109
- }
110
- return key;
111
- }
112
- return value;
113
- }
114
- function ensureRedirectPathname(basePathname, redirectPathname) {
115
- const searchParams = new URLSearchParams({
116
- redirectTo: ensureWithoutSuffix(redirectPathname, "/")
117
- });
118
- return ensureWithSuffix(basePathname, "?" + searchParams.toString());
119
- }
120
- function isPathnameMissingLocale(pathname) {
121
- return !LOCALE_LIST.some((locale) => pathname.startsWith(`/${locale}`));
122
- }
123
- function ensureLocalizedPathname(pathname, locale) {
124
- if (!pathname || !locale)
125
- throw new Error("Pathname or Locale cannot be empty");
126
- return isPathnameMissingLocale(pathname) ? `${ensureWithPrefix(locale, "/")}${ensureWithPrefix(pathname, "/")}` : pathname;
127
- }
128
- function relocalizePathname(pathname, locale) {
129
- if (!pathname || !locale)
130
- throw new Error("Pathname or Locale cannot be empty");
131
- const segments = pathname.split("/");
132
- segments[1] = locale;
133
- return segments.join("/");
134
- }
135
- var LOCALE_LIST, Logger;
136
- var init_utils = __esm({
137
- "src/utils/index.ts"() {
138
- LOCALE_LIST = ["vi", "en"];
139
- Logger = class {
140
- log(level, message, context, error) {
141
- const entry = {
142
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
143
- level,
144
- message,
145
- context
146
- };
147
- if (error instanceof Error) {
148
- entry.error = {
149
- name: error.name,
150
- message: error.message,
151
- stack: error.stack
152
- };
153
- } else if (error) {
154
- entry.error = error;
155
- }
156
- const logString = JSON.stringify(entry);
157
- switch (level) {
158
- case "error":
159
- console.error(logString);
160
- break;
161
- case "warn":
162
- console.warn(logString);
163
- break;
164
- case "debug":
165
- if (process.env.NODE_ENV === "development") console.debug(logString);
166
- break;
167
- default:
168
- console.log(logString);
169
- }
170
- }
171
- info(message, context) {
172
- this.log("info", message, context);
173
- }
174
- warn(message, context) {
175
- this.log("warn", message, context);
176
- }
177
- error(message, error, context) {
178
- this.log("error", message, context, error);
179
- }
180
- debug(message, context) {
181
- this.log("debug", message, context);
182
- }
183
- };
184
- new Logger();
185
- }
186
- });
187
- var oauthLinksData;
188
- var init_oauth_links = __esm({
189
- "src/configs/data/oauth-links.ts"() {
190
- oauthLinksData = [
191
- { href: "/", label: "Facebook", icon: Facebook },
192
- { href: "/", label: "GitHub", icon: Github },
193
- { href: "/", label: "Google", icon: Chrome },
194
- { href: "/", label: "X", icon: Twitter }
195
- ];
196
- }
197
- });
198
-
199
- // src/configs/i18n.ts
200
- var i18n;
201
- var init_i18n = __esm({
202
- "src/configs/i18n.ts"() {
203
- i18n = {
204
- defaultLocale: "vi",
205
- locales: ["vi", "en"],
206
- localeDirection: {
207
- vi: "ltr",
208
- en: "ltr"
209
- },
210
- localeNames: {
211
- vi: "vietnamese",
212
- en: "english"
213
- }
214
- };
215
- }
216
- });
217
-
218
- // src/configs/themes.ts
219
- var init_themes = __esm({
220
- "src/configs/themes.ts"() {
221
- }
222
- });
223
-
224
- // src/configs/auth-routes.ts
225
- var init_auth_routes = __esm({
226
- "src/configs/auth-routes.ts"() {
227
- }
228
- });
229
-
230
- // src/configs/crud.ts
231
- function getCrudDataLoaderConfig() {
232
- const cacheEnabled = process.env.CRUD_CACHE_ENABLED === void 0 ? true : process.env.CRUD_CACHE_ENABLED === "true" || process.env.CRUD_CACHE_ENABLED === "1";
233
- const defaultCacheTime = process.env.CRUD_CACHE_TIME_MS ? parseInt(process.env.CRUD_CACHE_TIME_MS, 10) : 6e4;
234
- const validatedCacheTime = defaultCacheTime > 0 ? defaultCacheTime : 6e4;
235
- return {
236
- cacheEnabled,
237
- defaultCacheTime: validatedCacheTime
238
- };
239
- }
240
- function getCrudServiceConfig() {
241
- const cacheEnabled = process.env.CRUD_SERVICE_CACHE_ENABLED === "true" || process.env.CRUD_SERVICE_CACHE_ENABLED === "1";
242
- const cacheBusterEnabled = process.env.CRUD_SERVICE_CACHE_BUSTER_ENABLED === void 0 ? true : process.env.CRUD_SERVICE_CACHE_BUSTER_ENABLED === "true" || process.env.CRUD_SERVICE_CACHE_BUSTER_ENABLED === "1";
243
- return {
244
- cacheEnabled,
245
- cacheBusterEnabled
246
- };
247
- }
248
- function getCrudApiRouteConfig() {
249
- const sMaxAge = process.env.CRUD_API_CACHE_S_MAXAGE ? parseInt(process.env.CRUD_API_CACHE_S_MAXAGE, 10) : 60;
250
- const staleWhileRevalidate = process.env.CRUD_API_CACHE_STALE_WHILE_REVALIDATE ? parseInt(process.env.CRUD_API_CACHE_STALE_WHILE_REVALIDATE, 10) : 300;
251
- const validatedSMaxAge = sMaxAge > 0 ? sMaxAge : 60;
252
- const validatedStaleWhileRevalidate = staleWhileRevalidate > 0 ? staleWhileRevalidate : 300;
253
- return {
254
- sMaxAge: validatedSMaxAge,
255
- staleWhileRevalidate: validatedStaleWhileRevalidate
256
- };
257
- }
258
- function getCrudLazyLoaderConfig() {
259
- const maxStates = process.env.CRUD_LAZY_LOADER_MAX_STATES ? parseInt(process.env.CRUD_LAZY_LOADER_MAX_STATES, 10) : 50;
260
- const maxAge = process.env.CRUD_LAZY_LOADER_MAX_AGE_MS ? parseInt(process.env.CRUD_LAZY_LOADER_MAX_AGE_MS, 10) : 6e5;
261
- const validatedMaxStates = maxStates > 0 ? maxStates : 50;
262
- const validatedMaxAge = maxAge > 0 ? maxAge : 6e5;
263
- return {
264
- maxStates: validatedMaxStates,
265
- maxAge: validatedMaxAge
266
- };
267
- }
268
- var init_crud = __esm({
269
- "src/configs/crud.ts"() {
270
- ({
271
- /**
272
- * DataLoader Configuration
273
- * Configure via environment variables:
274
- * - CRUD_CACHE_ENABLED: Enable/disable caching (default: true)
275
- * - CRUD_CACHE_TIME_MS: Cache time in milliseconds (default: 60000 = 1 minute)
276
- */
277
- dataLoader: getCrudDataLoaderConfig(),
278
- /**
279
- * CrudService Configuration
280
- * Configure via environment variables:
281
- * - CRUD_SERVICE_CACHE_ENABLED: Enable browser cache for fetch requests (default: false)
282
- * - CRUD_SERVICE_CACHE_BUSTER_ENABLED: Enable cache buster timestamp (default: true)
283
- */
284
- service: getCrudServiceConfig(),
285
- /**
286
- * API Route Cache Configuration
287
- * Configure via environment variables:
288
- * - CRUD_API_CACHE_S_MAXAGE: Cache max age in seconds for CDN/proxy (default: 60)
289
- * - CRUD_API_CACHE_STALE_WHILE_REVALIDATE: Stale-while-revalidate time in seconds (default: 300 = 5 minutes)
290
- */
291
- apiRoute: getCrudApiRouteConfig(),
292
- /**
293
- * LazyLoader Configuration
294
- * Configure via environment variables:
295
- * - CRUD_LAZY_LOADER_MAX_STATES: Maximum number of cached states (default: 50)
296
- * - CRUD_LAZY_LOADER_MAX_AGE_MS: Maximum age of cached state in milliseconds (default: 600000 = 10 minutes)
297
- */
298
- lazyLoader: getCrudLazyLoaderConfig()
299
- });
300
- }
301
- });
302
- var init_configs = __esm({
303
- "src/configs/index.ts"() {
304
- init_oauth_links();
305
- init_i18n();
306
- init_themes();
307
- init_auth_routes();
308
- init_status();
309
- init_crud();
310
- init_i18n();
311
- i18n.locales;
312
- }
313
- });
314
- var init_tenant_provider = __esm({
315
- "src/providers/tenant-provider.tsx"() {
316
- createContext(void 0);
317
- }
318
- });
319
- var defaultSettings, SettingsContext;
320
- var init_providers = __esm({
321
- "src/providers/index.tsx"() {
322
- "use client";
323
- init_tenant_provider();
324
- defaultSettings = {
325
- theme: "blue",
326
- mode: "system",
327
- radius: 0.5,
328
- layout: "vertical",
329
- locale: "vi",
330
- sidebarVariant: "sidebar",
331
- sidebarCollapsible: "icon",
332
- density: "comfortable"
333
- };
334
- SettingsContext = createContext(void 0);
335
- }
336
- });
337
-
338
- // src/hooks/use-tenant.ts
339
- var init_use_tenant = __esm({
340
- "src/hooks/use-tenant.ts"() {
341
- }
342
- });
343
- function useMediaQuery(query) {
344
- const [matches, setMatches] = useState(false);
345
- useEffect(() => {
346
- if (typeof window !== "undefined") {
347
- const media = window.matchMedia(query);
348
- setMatches(media.matches);
349
- const listener = (event) => setMatches(event.matches);
350
- media.addEventListener("change", listener);
351
- return () => media.removeEventListener("change", listener);
352
- }
353
- }, [query]);
354
- return matches;
355
- }
356
- function useMobile() {
357
- return useMediaQuery("(max-width: 768px)");
358
- }
359
- function useSettings() {
360
- const context = useContext(SettingsContext);
361
- if (!context) {
362
- return defaultSettingsValue;
363
- }
364
- return context;
365
- }
366
- var defaultSettingsValue;
367
- var init_hooks = __esm({
368
- "src/hooks/index.tsx"() {
369
- "use client";
370
- init_providers();
371
- init_use_tenant();
372
- defaultSettingsValue = {
373
- settings: defaultSettings,
374
- updateSettings: () => {
375
- },
376
- resetSettings: () => {
377
- }
378
- };
379
- createContext(null);
380
- }
381
- });
382
- var buttonVariants, Button;
383
- var init_button = __esm({
384
- "src/ui/primitives/button.tsx"() {
385
- init_utils();
386
- buttonVariants = cva(
387
- "inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
388
- {
389
- variants: {
390
- variant: {
391
- // Existing variants (backwards-compatible)
392
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
393
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
394
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
395
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
396
- ghost: "hover:bg-accent hover:text-accent-foreground",
397
- link: "text-primary underline-offset-4 hover:underline",
398
- // New Plane-inspired variants using semantic tokens
399
- accent: "bg-accent-primary text-text-on-color hover:bg-accent-primary-hover active:bg-accent-primary-active disabled:bg-layer-disabled disabled:text-text-disabled",
400
- danger: "bg-danger text-text-on-color hover:bg-danger-hover active:bg-danger-hover disabled:bg-layer-disabled disabled:text-text-disabled",
401
- "danger-outline": "border border-danger bg-layer-2 text-danger-text hover:bg-danger-subtle active:bg-danger-subtle disabled:border-border-subtle disabled:bg-layer-2 disabled:text-text-disabled",
402
- success: "bg-success-semantic text-text-on-color hover:bg-success-semantic/90 active:bg-success-semantic/80 disabled:bg-layer-disabled disabled:text-text-disabled",
403
- tertiary: "bg-layer-3 text-text-secondary hover:bg-layer-3-hover active:bg-layer-3-hover disabled:bg-transparent disabled:text-text-disabled"
404
- },
405
- size: {
406
- // Existing sizes (backwards-compatible)
407
- default: "h-10 px-4 py-2",
408
- sm: "h-9 rounded-md px-3",
409
- lg: "h-11 rounded-md px-8",
410
- icon: "h-10 w-10",
411
- // New ERP-specific compact sizes
412
- xs: "h-7 rounded-sm px-2 text-xs",
413
- compact: "h-8 rounded-md px-3 text-xs",
414
- "icon-sm": "h-8 w-8",
415
- "icon-xs": "h-7 w-7"
416
- }
417
- },
418
- defaultVariants: {
419
- variant: "default",
420
- size: "default"
421
- }
422
- }
423
- );
424
- Button = React10.forwardRef(
425
- ({ className, variant, size, asChild = false, loading = false, prependIcon, appendIcon, children, disabled, ...props }, ref) => {
426
- if (asChild) {
427
- return /* @__PURE__ */ jsx(
428
- Slot,
429
- {
430
- className: cn(buttonVariants({ variant, size }), className),
431
- ref,
432
- ...{ disabled: disabled || loading },
433
- ...props,
434
- children: React10.isValidElement(children) && (prependIcon || appendIcon) ? React10.cloneElement(children, {}, /* @__PURE__ */ jsxs(Fragment, { children: [
435
- prependIcon && React10.cloneElement(prependIcon, {
436
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
437
- }),
438
- children.props.children,
439
- appendIcon && React10.cloneElement(appendIcon, {
440
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
441
- })
442
- ] })) : children
443
- }
444
- );
445
- }
446
- return /* @__PURE__ */ jsxs(
447
- "button",
448
- {
449
- className: cn(buttonVariants({ variant, size }), className),
450
- ref,
451
- disabled: disabled || loading,
452
- ...props,
453
- children: [
454
- prependIcon && React10.cloneElement(prependIcon, {
455
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
456
- }),
457
- children,
458
- appendIcon && React10.cloneElement(appendIcon, {
459
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
460
- })
461
- ]
462
- }
463
- );
464
- }
465
- );
466
- Button.displayName = "Button";
467
- }
468
- });
469
- function Badge({ className, variant, size, ...props }) {
470
- return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant, size }), className), ...props });
471
- }
472
- var badgeVariants;
473
- var init_badge = __esm({
474
- "src/ui/primitives/badge.tsx"() {
475
- init_utils();
476
- badgeVariants = cva(
477
- "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
478
- {
479
- variants: {
480
- variant: {
481
- // Existing variants (backwards-compatible)
482
- default: "border-transparent bg-primary text-primary-foreground",
483
- secondary: "border-transparent bg-secondary text-secondary-foreground",
484
- destructive: "border-transparent bg-destructive text-destructive-foreground",
485
- outline: "text-foreground",
486
- // Enhanced semantic variants (using Design Tokens)
487
- success: "border-transparent bg-success-subtle text-success-text",
488
- warning: "border-transparent bg-warning-subtle text-warning-text",
489
- danger: "border-transparent bg-danger-subtle text-danger-text",
490
- info: "border-transparent bg-info-subtle text-info-text",
491
- accent: "border-transparent bg-accent-primary-subtle text-accent-primary"
492
- },
493
- size: {
494
- default: "",
495
- sm: "px-1.5 py-0 text-[10px]",
496
- lg: "px-3 py-1 text-sm"
497
- }
498
- },
499
- defaultVariants: {
500
- variant: "default",
501
- size: "default"
502
- }
503
- }
504
- );
505
- }
506
- });
507
- var Input;
508
- var init_input = __esm({
509
- "src/ui/primitives/input.tsx"() {
510
- init_utils();
511
- Input = React10.forwardRef(
512
- ({ className, type, ...props }, ref) => {
513
- return /* @__PURE__ */ jsx(
514
- "input",
515
- {
516
- type,
517
- className: cn(
518
- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
519
- className
520
- ),
521
- ref,
522
- ...props
523
- }
524
- );
525
- }
526
- );
527
- Input.displayName = "Input";
528
- }
529
- });
530
- var Checkbox;
531
- var init_checkbox = __esm({
532
- "src/ui/primitives/checkbox.tsx"() {
533
- "use client";
534
- init_utils();
535
- Checkbox = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
536
- CheckboxPrimitive.Root,
537
- {
538
- ref,
539
- className: cn(
540
- "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
541
- className
542
- ),
543
- ...props,
544
- children: /* @__PURE__ */ jsx(
545
- CheckboxPrimitive.Indicator,
546
- {
547
- className: cn("flex items-center justify-center text-current"),
548
- children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
549
- }
550
- )
551
- }
552
- ));
553
- Checkbox.displayName = CheckboxPrimitive.Root.displayName;
554
- }
555
- });
556
- var Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter;
557
- var init_card = __esm({
558
- "src/ui/primitives/card.tsx"() {
559
- init_utils();
560
- Card = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
561
- "div",
562
- {
563
- ref,
564
- className: cn(
565
- "rounded-lg border bg-card text-card-foreground shadow-sm",
566
- className
567
- ),
568
- ...props
569
- }
570
- ));
571
- Card.displayName = "Card";
572
- CardHeader = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
573
- "div",
574
- {
575
- ref,
576
- className: cn("flex flex-col space-y-1.5 p-6", className),
577
- ...props
578
- }
579
- ));
580
- CardHeader.displayName = "CardHeader";
581
- CardTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
582
- "h3",
583
- {
584
- ref,
585
- className: cn(
586
- "text-2xl font-semibold leading-none tracking-tight",
587
- className
588
- ),
589
- ...props
590
- }
591
- ));
592
- CardTitle.displayName = "CardTitle";
593
- CardDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
594
- "p",
595
- {
596
- ref,
597
- className: cn("text-sm text-muted-foreground", className),
598
- ...props
599
- }
600
- ));
601
- CardDescription.displayName = "CardDescription";
602
- CardContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
603
- CardContent.displayName = "CardContent";
604
- CardFooter = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
605
- "div",
606
- {
607
- ref,
608
- className: cn("flex items-center p-6 pt-0", className),
609
- ...props
610
- }
611
- ));
612
- CardFooter.displayName = "CardFooter";
613
- }
614
- });
615
- var Separator;
616
- var init_separator = __esm({
617
- "src/ui/primitives/separator.tsx"() {
618
- init_utils();
619
- Separator = React10.forwardRef(
620
- ({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx(
621
- "div",
622
- {
623
- ref,
624
- className: cn(
625
- "shrink-0 bg-border",
626
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
627
- className
628
- ),
629
- ...props
630
- }
631
- )
632
- );
633
- Separator.displayName = "Separator";
634
- }
635
- });
636
- var Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption;
637
- var init_table = __esm({
638
- "src/ui/primitives/table.tsx"() {
639
- init_utils();
640
- Table = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
641
- "table",
642
- {
643
- ref,
644
- className: cn("w-max min-w-full caption-bottom text-xs", className),
645
- ...props
646
- }
647
- ) }));
648
- Table.displayName = "Table";
649
- TableHeader = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
650
- TableHeader.displayName = "TableHeader";
651
- TableBody = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
652
- "tbody",
653
- {
654
- ref,
655
- className: cn("[&_tr:last-child]:border-0", className),
656
- ...props
657
- }
658
- ));
659
- TableBody.displayName = "TableBody";
660
- TableFooter = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
661
- "tfoot",
662
- {
663
- ref,
664
- className: cn(
665
- "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
666
- className
667
- ),
668
- ...props
669
- }
670
- ));
671
- TableFooter.displayName = "TableFooter";
672
- TableRow = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
673
- "tr",
674
- {
675
- ref,
676
- className: cn(
677
- "border-b transition-colors even:bg-muted/30 data-[state=selected]:bg-muted",
678
- className
679
- ),
680
- ...props
681
- }
682
- ));
683
- TableRow.displayName = "TableRow";
684
- TableHead = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
685
- "th",
686
- {
687
- ref,
688
- className: cn(
689
- "h-9 px-3 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
690
- className
691
- ),
692
- ...props
693
- }
694
- ));
695
- TableHead.displayName = "TableHead";
696
- TableCell = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
697
- "td",
698
- {
699
- ref,
700
- className: cn("px-3 py-1.5 align-middle [&:has([role=checkbox])]:pr-0 text-xs", className),
701
- ...props
702
- }
703
- ));
704
- TableCell.displayName = "TableCell";
705
- TableCaption = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
706
- "caption",
707
- {
708
- ref,
709
- className: cn("mt-4 text-sm text-muted-foreground", className),
710
- ...props
711
- }
712
- ));
713
- TableCaption.displayName = "TableCaption";
714
- }
715
- });
716
- function DropdownMenu({
717
- ...props
718
- }) {
719
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
720
- }
721
- function DropdownMenuTrigger({
722
- className,
723
- ...props
724
- }) {
725
- return /* @__PURE__ */ jsx(
726
- DropdownMenuPrimitive.Trigger,
727
- {
728
- "data-slot": "dropdown-menu-trigger",
729
- className: cn("cursor-pointer", className),
730
- ...props
731
- }
732
- );
733
- }
734
- function DropdownMenuRadioGroup({
735
- ...props
736
- }) {
737
- return /* @__PURE__ */ jsx(
738
- DropdownMenuPrimitive.RadioGroup,
739
- {
740
- "data-slot": "dropdown-menu-radio-group",
741
- ...props
742
- }
743
- );
744
- }
745
- function DropdownMenuContent({
746
- className,
747
- sideOffset = 4,
748
- ...props
749
- }) {
750
- return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
751
- DropdownMenuPrimitive.Content,
752
- {
753
- "data-slot": "dropdown-menu-content",
754
- sideOffset,
755
- className: cn(
756
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
757
- className
758
- ),
759
- ...props
760
- }
761
- ) });
762
- }
763
- function DropdownMenuRadioItem({
764
- className,
765
- children,
766
- ...props
767
- }) {
768
- return /* @__PURE__ */ jsxs(
769
- DropdownMenuPrimitive.RadioItem,
770
- {
771
- "data-slot": "dropdown-menu-radio-item",
772
- className: cn(
773
- "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
774
- className
775
- ),
776
- ...props,
777
- children: [
778
- /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Dot, { className: "h-4 w-4 fill-current" }) }) }),
779
- children
780
- ]
781
- }
782
- );
783
- }
784
- function DropdownMenuLabel({
785
- className,
786
- inset,
787
- ...props
788
- }) {
789
- return /* @__PURE__ */ jsx(
790
- DropdownMenuPrimitive.Label,
791
- {
792
- "data-slot": "dropdown-menu-label",
793
- "data-inset": inset,
794
- className: cn(
795
- "px-2 py-1.5 text-sm font-semibold data-[inset]:ps-8",
796
- className
797
- ),
798
- ...props
799
- }
800
- );
801
- }
802
- function DropdownMenuSeparator({
803
- className,
804
- ...props
805
- }) {
806
- return /* @__PURE__ */ jsx(
807
- DropdownMenuPrimitive.Separator,
808
- {
809
- "data-slot": "dropdown-menu-separator",
810
- className: cn("-mx-1 my-1 h-px bg-muted", className),
811
- ...props
812
- }
813
- );
814
- }
815
- var init_dropdown_menu = __esm({
816
- "src/ui/primitives/dropdown-menu.tsx"() {
817
- "use client";
818
- init_utils();
819
- }
820
- });
821
- var DialogPortal, DialogOverlay, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
822
- var init_dialog = __esm({
823
- "src/ui/primitives/dialog.tsx"() {
824
- "use client";
825
- init_utils();
826
- DialogPortal = DialogPrimitive.Portal;
827
- DialogOverlay = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
828
- DialogPrimitive.Overlay,
829
- {
830
- ref,
831
- className: cn(
832
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
833
- className
834
- ),
835
- ...props
836
- }
837
- ));
838
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
839
- DialogContent = React10.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
840
- /* @__PURE__ */ jsx(DialogOverlay, {}),
841
- /* @__PURE__ */ jsxs(
842
- DialogPrimitive.Content,
843
- {
844
- ref,
845
- className: cn(
846
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
847
- className
848
- ),
849
- ...props,
850
- children: [
851
- children,
852
- /* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
853
- /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
854
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
855
- ] })
856
- ]
857
- }
858
- )
859
- ] }));
860
- DialogContent.displayName = DialogPrimitive.Content.displayName;
861
- DialogHeader = ({
862
- className,
863
- ...props
864
- }) => /* @__PURE__ */ jsx(
865
- "div",
866
- {
867
- className: cn(
868
- "flex flex-col space-y-1.5 text-center sm:text-left",
869
- className
870
- ),
871
- ...props
872
- }
873
- );
874
- DialogHeader.displayName = "DialogHeader";
875
- DialogFooter = ({
876
- className,
877
- ...props
878
- }) => /* @__PURE__ */ jsx(
879
- "div",
880
- {
881
- className: cn(
882
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
883
- className
884
- ),
885
- ...props
886
- }
887
- );
888
- DialogFooter.displayName = "DialogFooter";
889
- DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
890
- DialogPrimitive.Title,
891
- {
892
- ref,
893
- className: cn(
894
- "text-lg font-semibold leading-none tracking-tight",
895
- className
896
- ),
897
- ...props
898
- }
899
- ));
900
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
901
- DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
902
- DialogPrimitive.Description,
903
- {
904
- ref,
905
- className: cn("text-sm text-muted-foreground", className),
906
- ...props
907
- }
908
- ));
909
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
910
- }
911
- });
912
- var TabsList, TabsTrigger, TabsContent;
913
- var init_tabs = __esm({
914
- "src/ui/primitives/tabs.tsx"() {
915
- "use client";
916
- init_utils();
917
- TabsList = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
918
- TabsPrimitive.List,
919
- {
920
- ref,
921
- className: cn(
922
- "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
923
- className
924
- ),
925
- ...props
926
- }
927
- ));
928
- TabsList.displayName = TabsPrimitive.List.displayName;
929
- TabsTrigger = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
930
- TabsPrimitive.Trigger,
931
- {
932
- ref,
933
- className: cn(
934
- "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
935
- className
936
- ),
937
- ...props
938
- }
939
- ));
940
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
941
- TabsContent = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
942
- TabsPrimitive.Content,
943
- {
944
- ref,
945
- className: cn(
946
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
947
- className
948
- ),
949
- ...props
950
- }
951
- ));
952
- TabsContent.displayName = TabsPrimitive.Content.displayName;
953
- }
954
- });
955
- var init_breadcrumb = __esm({
956
- "src/ui/primitives/breadcrumb.tsx"() {
957
- }
958
- });
959
- var init_keyboard = __esm({
960
- "src/ui/primitives/keyboard.tsx"() {
961
- }
962
- });
963
- var init_pagination = __esm({
964
- "src/ui/primitives/pagination.tsx"() {
965
- }
966
- });
967
- var init_status_badge = __esm({
968
- "src/ui/primitives/status-badge.tsx"() {
969
- }
970
- });
971
- var init_progress = __esm({
972
- "src/ui/feedback/progress.tsx"() {
973
- "use client";
974
- }
975
- });
976
- function Sheet({
977
- ...props
978
- }) {
979
- return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "sheet", ...props });
980
- }
981
- function SheetPortal({
982
- ...props
983
- }) {
984
- return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
985
- }
986
- function SheetOverlay({
987
- className,
988
- ...props
989
- }) {
990
- return /* @__PURE__ */ jsx(
991
- DialogPrimitive.Overlay,
992
- {
993
- "data-slot": "sheet-overlay",
994
- className: cn(
995
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
996
- className
997
- ),
998
- ...props
999
- }
1000
- );
1001
- }
1002
- function SheetContent({
1003
- className,
1004
- children,
1005
- side = "right",
1006
- ...props
1007
- }) {
1008
- return /* @__PURE__ */ jsxs(SheetPortal, { children: [
1009
- /* @__PURE__ */ jsx(SheetOverlay, {}),
1010
- /* @__PURE__ */ jsx(
1011
- DialogPrimitive.Content,
1012
- {
1013
- "data-slot": "sheet-content",
1014
- className: cn(sheetVariants({ side }), className),
1015
- ...props,
1016
- children
1017
- }
1018
- )
1019
- ] });
1020
- }
1021
- function SheetTitle({
1022
- className,
1023
- ...props
1024
- }) {
1025
- return /* @__PURE__ */ jsx(
1026
- DialogPrimitive.Title,
1027
- {
1028
- "data-slot": "sheet-title",
1029
- className: cn("text-lg font-semibold text-foreground", className),
1030
- ...props
1031
- }
1032
- );
1033
- }
1034
- var sheetVariants;
1035
- var init_sheet = __esm({
1036
- "src/ui/feedback/sheet.tsx"() {
1037
- "use client";
1038
- init_utils();
1039
- sheetVariants = cva(
1040
- "fixed z-50 gap-4 bg-background p-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
1041
- {
1042
- variants: {
1043
- side: {
1044
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
1045
- bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
1046
- left: "inset-y-0 left-0 h-full w-72 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
1047
- right: "inset-y-0 right-0 h-full w-72 border-s data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
1048
- start: "inset-y-0 start-0 h-full w-72 border-e data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left data-[state=closed]:rtl:slide-out-to-right data-[state=open]:rtl:slide-in-from-right sm:max-w-sm",
1049
- end: "inset-y-0 end-0 h-full w-72 border-s data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right data-[state=closed]:rtl:slide-out-to-left data-[state=open]:rtl:slide-in-from-left sm:max-w-sm"
1050
- }
1051
- },
1052
- defaultVariants: {
1053
- side: "right"
1054
- }
1055
- }
1056
- );
1057
- }
1058
- });
1059
- function Alert({
1060
- className,
1061
- variant,
1062
- ...props
1063
- }) {
1064
- return /* @__PURE__ */ jsx(
1065
- "div",
1066
- {
1067
- "data-slot": "alert",
1068
- role: "alert",
1069
- className: cn(alertVariants({ variant }), className),
1070
- ...props
1071
- }
1072
- );
1073
- }
1074
- function AlertDescription({
1075
- className,
1076
- ...props
1077
- }) {
1078
- return /* @__PURE__ */ jsx(
1079
- "div",
1080
- {
1081
- "data-slot": "alert-description",
1082
- className: cn("text-sm [&_p]:leading-relaxed", className),
1083
- ...props
1084
- }
1085
- );
1086
- }
1087
- var alertVariants;
1088
- var init_alert = __esm({
1089
- "src/ui/feedback/alert.tsx"() {
1090
- init_utils();
1091
- alertVariants = cva(
1092
- "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
1093
- {
1094
- variants: {
1095
- variant: {
1096
- default: "bg-background text-foreground",
1097
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
1098
- }
1099
- },
1100
- defaultVariants: {
1101
- variant: "default"
1102
- }
1103
- }
1104
- );
1105
- }
1106
- });
1107
- var init_context_menu = __esm({
1108
- "src/ui/feedback/context-menu.tsx"() {
1109
- "use client";
1110
- }
1111
- });
1112
- var init_drawer = __esm({
1113
- "src/ui/feedback/drawer.tsx"() {
1114
- "use client";
1115
- }
1116
- });
1117
- var init_sonner = __esm({
1118
- "src/ui/feedback/sonner.tsx"() {
1119
- "use client";
1120
- }
1121
- });
1122
- var GlobalErrorEmitter;
1123
- var init_error_dialog = __esm({
1124
- "src/ui/feedback/error-dialog.tsx"() {
1125
- "use client";
1126
- GlobalErrorEmitter = class {
1127
- constructor() {
1128
- this.listeners = [];
1129
- }
1130
- subscribe(listener) {
1131
- this.listeners.push(listener);
1132
- return () => {
1133
- this.listeners = this.listeners.filter((l) => l !== listener);
1134
- };
1135
- }
1136
- emit(data) {
1137
- this.listeners.forEach((listener) => listener(data));
1138
- }
1139
- };
1140
- new GlobalErrorEmitter();
1141
- createContext(null);
1142
- }
1143
- });
1144
- var init_feedback = __esm({
1145
- "src/ui/feedback/index.tsx"() {
1146
- init_progress();
1147
- init_sheet();
1148
- init_alert();
1149
- init_context_menu();
1150
- init_drawer();
1151
- init_sonner();
1152
- init_error_dialog();
1153
- }
1154
- });
1155
- function TooltipProvider({
1156
- delayDuration = 0,
1157
- ...props
1158
- }) {
1159
- return /* @__PURE__ */ jsx(
1160
- TooltipPrimitive.Provider,
1161
- {
1162
- "data-slot": "tooltip-provider",
1163
- delayDuration,
1164
- ...props
1165
- }
1166
- );
1167
- }
1168
- function Tooltip({
1169
- ...props
1170
- }) {
1171
- return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
1172
- }
1173
- function TooltipTrigger({
1174
- className,
1175
- ...props
1176
- }) {
1177
- return /* @__PURE__ */ jsx(
1178
- TooltipPrimitive.Trigger,
1179
- {
1180
- "data-slot": "tooltip-trigger",
1181
- className: cn("cursor-pointer", className),
1182
- ...props
1183
- }
1184
- );
1185
- }
1186
- function TooltipContent({
1187
- className,
1188
- sideOffset = 0,
1189
- ...props
1190
- }) {
1191
- return /* @__PURE__ */ jsx(
1192
- TooltipPrimitive.Content,
1193
- {
1194
- "data-slot": "tooltip-content",
1195
- sideOffset,
1196
- className: cn(
1197
- "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
1198
- className
1199
- ),
1200
- ...props
1201
- }
1202
- );
1203
- }
1204
- var init_tooltip = __esm({
1205
- "src/ui/primitives/tooltip.tsx"() {
1206
- "use client";
1207
- init_utils();
1208
- }
1209
- });
1210
- function useSidebar() {
1211
- const context = React10.useContext(SidebarContext);
1212
- if (!context) {
1213
- throw new Error("useSidebar must be used within a SidebarProvider.");
1214
- }
1215
- return context;
1216
- }
1217
- var SIDEBAR_WIDTH, SIDEBAR_WIDTH_MOBILE, SIDEBAR_WIDTH_ICON, SIDEBAR_KEYBOARD_SHORTCUT, SidebarContext, SidebarProvider, Sidebar, SidebarTrigger, SidebarRail, SidebarInset, SidebarInput, SidebarHeader, SidebarFooter, SidebarSeparator, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarGroupAction, SidebarGroupContent, SidebarMenu, SidebarMenuItem, sidebarMenuButtonVariants, SidebarMenuButton, SidebarMenuAction, SidebarMenuBadge, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton;
1218
- var init_sidebar = __esm({
1219
- "src/ui/primitives/sidebar.tsx"() {
1220
- "use client";
1221
- init_hooks();
1222
- init_utils();
1223
- init_button();
1224
- init_feedback();
1225
- init_tooltip();
1226
- SIDEBAR_WIDTH = "16rem";
1227
- SIDEBAR_WIDTH_MOBILE = "18rem";
1228
- SIDEBAR_WIDTH_ICON = "3rem";
1229
- SIDEBAR_KEYBOARD_SHORTCUT = "b";
1230
- SidebarContext = React10.createContext(null);
1231
- SidebarProvider = React10.forwardRef(
1232
- ({
1233
- defaultOpen = false,
1234
- open: openProp,
1235
- onOpenChange: setOpenProp,
1236
- className,
1237
- style,
1238
- children,
1239
- ...props
1240
- }, ref) => {
1241
- const isMobile = useMobile();
1242
- const [openMobile, setOpenMobile] = React10.useState(false);
1243
- const [hoverOpen, setHoverOpen] = React10.useState(false);
1244
- const [_open, _setOpen] = React10.useState(defaultOpen);
1245
- const open = openProp ?? _open;
1246
- const setOpen = React10.useCallback(
1247
- (value) => {
1248
- if (setOpenProp) {
1249
- return setOpenProp(typeof value === "function" ? value(open) : value);
1250
- }
1251
- _setOpen(value);
1252
- },
1253
- [setOpenProp, open]
1254
- );
1255
- const toggleSidebar = React10.useCallback(() => {
1256
- return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
1257
- }, [isMobile, setOpen, setOpenMobile]);
1258
- React10.useEffect(() => {
1259
- const handleKeyDown = (event) => {
1260
- if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
1261
- event.preventDefault();
1262
- toggleSidebar();
1263
- }
1264
- };
1265
- window.addEventListener("keydown", handleKeyDown);
1266
- return () => window.removeEventListener("keydown", handleKeyDown);
1267
- }, [toggleSidebar]);
1268
- const state = open ? "expanded" : "collapsed";
1269
- const isHoverExpanded = !open && hoverOpen;
1270
- const contextValue = React10.useMemo(
1271
- () => ({
1272
- state,
1273
- open,
1274
- setOpen,
1275
- isMobile,
1276
- openMobile,
1277
- setOpenMobile,
1278
- toggleSidebar,
1279
- hoverOpen,
1280
- setHoverOpen,
1281
- isHoverExpanded
1282
- }),
1283
- [
1284
- state,
1285
- open,
1286
- setOpen,
1287
- isMobile,
1288
- openMobile,
1289
- setOpenMobile,
1290
- toggleSidebar,
1291
- hoverOpen,
1292
- setHoverOpen,
1293
- isHoverExpanded
1294
- ]
1295
- );
1296
- return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(
1297
- "div",
1298
- {
1299
- style: {
1300
- "--sidebar-width": SIDEBAR_WIDTH,
1301
- "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
1302
- ...style
1303
- },
1304
- className: cn(
1305
- "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
1306
- className
1307
- ),
1308
- ref,
1309
- ...props,
1310
- children
1311
- }
1312
- ) }) });
1313
- }
1314
- );
1315
- SidebarProvider.displayName = "SidebarProvider";
1316
- Sidebar = React10.forwardRef(
1317
- ({
1318
- side = "left",
1319
- variant = "sidebar",
1320
- collapsible = "offcanvas",
1321
- hoverExpandEnabled = true,
1322
- className,
1323
- children,
1324
- ...props
1325
- }, ref) => {
1326
- const {
1327
- isMobile,
1328
- state,
1329
- openMobile,
1330
- setOpenMobile,
1331
- setHoverOpen,
1332
- isHoverExpanded
1333
- } = useSidebar();
1334
- const handleMouseEnter = React10.useCallback(() => {
1335
- if (hoverExpandEnabled && state === "collapsed" && collapsible === "icon") {
1336
- setHoverOpen(true);
1337
- }
1338
- }, [hoverExpandEnabled, state, collapsible, setHoverOpen]);
1339
- const handleMouseLeave = React10.useCallback(() => {
1340
- if (hoverExpandEnabled) {
1341
- setHoverOpen(false);
1342
- }
1343
- }, [hoverExpandEnabled, setHoverOpen]);
1344
- if (collapsible === "none") {
1345
- return /* @__PURE__ */ jsx(
1346
- "div",
1347
- {
1348
- className: cn(
1349
- "flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
1350
- className
1351
- ),
1352
- ref,
1353
- ...props,
1354
- children
1355
- }
1356
- );
1357
- }
1358
- if (isMobile) {
1359
- return /* @__PURE__ */ jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs(
1360
- SheetContent,
1361
- {
1362
- "data-sidebar": "sidebar",
1363
- "data-mobile": "true",
1364
- className: "w-(--sidebar-width) bg-background p-0 text-foreground [&>button]:hidden",
1365
- style: {
1366
- "--sidebar-width": SIDEBAR_WIDTH_MOBILE
1367
- },
1368
- side,
1369
- children: [
1370
- /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Mobile Menu" }),
1371
- /* @__PURE__ */ jsx("div", { className: "flex h-full w-full flex-col", children })
1372
- ]
1373
- }
1374
- ) });
1375
- }
1376
- return /* @__PURE__ */ jsxs(
1377
- "div",
1378
- {
1379
- ref,
1380
- className: cn(
1381
- "group peer hidden md:block transition-colors duration-200",
1382
- // Blue bg + white text when collapsed, white bg + dark text when expanded/hover
1383
- state === "collapsed" && !isHoverExpanded ? "text-sidebar-foreground" : "text-foreground"
1384
- ),
1385
- "data-state": state,
1386
- "data-hover-expanded": isHoverExpanded,
1387
- "data-collapsible": state === "collapsed" ? collapsible : "",
1388
- "data-variant": variant,
1389
- "data-side": side,
1390
- onMouseEnter: handleMouseEnter,
1391
- onMouseLeave: handleMouseLeave,
1392
- children: [
1393
- /* @__PURE__ */ jsx(
1394
- "div",
1395
- {
1396
- className: cn(
1397
- "duration-200 relative h-svh w-(--sidebar-width) bg-transparent transition-[width] ease-linear",
1398
- "group-data-[collapsible=offcanvas]:w-0",
1399
- "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
1400
- variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
1401
- )
1402
- }
1403
- ),
1404
- /* @__PURE__ */ jsx(
1405
- "div",
1406
- {
1407
- className: cn(
1408
- "duration-200 fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] ease-linear md:flex",
1409
- side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
1410
- // Adjustments for collapsible=icon
1411
- variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_8px)] group-data-[collapsible=icon]:px-2.5" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[collapsible=icon]:border-r group-data-[collapsible=icon]:px-0",
1412
- // Hover expand - override icon width to full width on hover
1413
- "group-data-[hover-expanded=true]:!w-(--sidebar-width) group-data-[hover-expanded=true]:shadow-xl group-data-[hover-expanded=true]:z-[100]",
1414
- className
1415
- ),
1416
- ...props,
1417
- children: /* @__PURE__ */ jsx(
1418
- "div",
1419
- {
1420
- "data-sidebar": "sidebar",
1421
- className: cn(
1422
- "flex h-full w-full flex-col border-r transition-colors duration-200",
1423
- // Blue background when collapsed, white when expanded/hover
1424
- "group-data-[state=collapsed]:bg-sidebar group-data-[state=collapsed]:border-sidebar-border",
1425
- "group-data-[state=expanded]:bg-background group-data-[state=expanded]:border-border",
1426
- "group-data-[hover-expanded=true]:!bg-background group-data-[hover-expanded=true]:!border-border",
1427
- "group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
1428
- ),
1429
- children
1430
- }
1431
- )
1432
- }
1433
- )
1434
- ]
1435
- }
1436
- );
1437
- }
1438
- );
1439
- Sidebar.displayName = "Sidebar";
1440
- SidebarTrigger = React10.forwardRef(({ className, onClick, ...props }, ref) => {
1441
- const { toggleSidebar } = useSidebar();
1442
- return /* @__PURE__ */ jsxs(
1443
- Button,
1444
- {
1445
- ref,
1446
- "data-sidebar": "trigger",
1447
- variant: "ghost",
1448
- size: "icon",
1449
- className: cn("h-7 w-7", className),
1450
- onClick: (event) => {
1451
- onClick?.(event);
1452
- toggleSidebar();
1453
- },
1454
- ...props,
1455
- children: [
1456
- /* @__PURE__ */ jsx(PanelLeft, {}),
1457
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
1458
- ]
1459
- }
1460
- );
1461
- });
1462
- SidebarTrigger.displayName = "SidebarTrigger";
1463
- SidebarRail = React10.forwardRef(({ className, ...props }, ref) => {
1464
- const { toggleSidebar } = useSidebar();
1465
- return /* @__PURE__ */ jsx(
1466
- "button",
1467
- {
1468
- ref,
1469
- "data-sidebar": "rail",
1470
- "aria-label": "Toggle Sidebar",
1471
- tabIndex: -1,
1472
- onClick: toggleSidebar,
1473
- title: "Toggle Sidebar",
1474
- className: cn(
1475
- "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
1476
- "[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
1477
- "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
1478
- "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar",
1479
- "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
1480
- "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
1481
- className
1482
- ),
1483
- ...props
1484
- }
1485
- );
1486
- });
1487
- SidebarRail.displayName = "SidebarRail";
1488
- SidebarInset = React10.forwardRef(({ className, ...props }, ref) => {
1489
- return /* @__PURE__ */ jsx(
1490
- "main",
1491
- {
1492
- ref,
1493
- className: cn(
1494
- "relative flex min-h-svh flex-1 flex-col bg-muted/40 transition-[margin] duration-200 ease-linear",
1495
- "peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
1496
- className
1497
- ),
1498
- ...props
1499
- }
1500
- );
1501
- });
1502
- SidebarInset.displayName = "SidebarInset";
1503
- SidebarInput = React10.forwardRef(({ className, ...props }, ref) => {
1504
- return /* @__PURE__ */ jsx(
1505
- "input",
1506
- {
1507
- ref,
1508
- "data-sidebar": "input",
1509
- className: cn(
1510
- "flex h-8 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1511
- className
1512
- ),
1513
- ...props
1514
- }
1515
- );
1516
- });
1517
- SidebarInput.displayName = "SidebarInput";
1518
- SidebarHeader = React10.forwardRef(({ className, ...props }, ref) => {
1519
- return /* @__PURE__ */ jsx(
1520
- "div",
1521
- {
1522
- ref,
1523
- "data-sidebar": "header",
1524
- className: cn("flex flex-col gap-2 p-2", className),
1525
- ...props
1526
- }
1527
- );
1528
- });
1529
- SidebarHeader.displayName = "SidebarHeader";
1530
- SidebarFooter = React10.forwardRef(({ className, ...props }, ref) => {
1531
- return /* @__PURE__ */ jsx(
1532
- "div",
1533
- {
1534
- ref,
1535
- "data-sidebar": "footer",
1536
- className: cn("flex flex-col gap-2 p-2", className),
1537
- ...props
1538
- }
1539
- );
1540
- });
1541
- SidebarFooter.displayName = "SidebarFooter";
1542
- SidebarSeparator = React10.forwardRef(({ className, ...props }, ref) => {
1543
- return /* @__PURE__ */ jsx(
1544
- "div",
1545
- {
1546
- ref,
1547
- "data-sidebar": "separator",
1548
- className: cn("mx-2 h-[1px] w-auto bg-sidebar-border", className),
1549
- ...props
1550
- }
1551
- );
1552
- });
1553
- SidebarSeparator.displayName = "SidebarSeparator";
1554
- SidebarContent = React10.forwardRef(({ className, ...props }, ref) => {
1555
- return /* @__PURE__ */ jsx(
1556
- "div",
1557
- {
1558
- ref,
1559
- "data-sidebar": "content",
1560
- className: cn(
1561
- "flex min-h-0 flex-1 flex-col gap-2 overflow-auto",
1562
- // Hide overflow when collapsed, but show when hover-expanded
1563
- "group-data-[collapsible=icon]:overflow-hidden group-data-[hover-expanded=true]:!overflow-auto",
1564
- className
1565
- ),
1566
- ...props
1567
- }
1568
- );
1569
- });
1570
- SidebarContent.displayName = "SidebarContent";
1571
- SidebarGroup = React10.forwardRef(({ className, ...props }, ref) => {
1572
- return /* @__PURE__ */ jsx(
1573
- "div",
1574
- {
1575
- ref,
1576
- "data-sidebar": "group",
1577
- className: cn("relative flex w-full min-w-0 flex-col p-2", className),
1578
- ...props
1579
- }
1580
- );
1581
- });
1582
- SidebarGroup.displayName = "SidebarGroup";
1583
- SidebarGroupLabel = React10.forwardRef(({ className, asChild = false, ...props }, ref) => {
1584
- const Comp = asChild ? Slot : "div";
1585
- return /* @__PURE__ */ jsx(
1586
- Comp,
1587
- {
1588
- ref,
1589
- "data-sidebar": "group-label",
1590
- className: cn(
1591
- "duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-bold text-primary uppercase tracking-wider outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
1592
- // Hide when collapsed, show when hover-expanded
1593
- "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
1594
- "group-data-[hover-expanded=true]:!mt-0 group-data-[hover-expanded=true]:!opacity-100",
1595
- className
1596
- ),
1597
- ...props
1598
- }
1599
- );
1600
- });
1601
- SidebarGroupLabel.displayName = "SidebarGroupLabel";
1602
- SidebarGroupAction = React10.forwardRef(({ className, asChild = false, ...props }, ref) => {
1603
- const Comp = asChild ? Slot : "button";
1604
- return /* @__PURE__ */ jsx(
1605
- Comp,
1606
- {
1607
- ref,
1608
- "data-sidebar": "group-action",
1609
- className: cn(
1610
- "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
1611
- // Increases the hit area of the button on mobile.
1612
- "after:absolute after:-inset-2 after:md:hidden",
1613
- "group-data-[collapsible=icon]:hidden",
1614
- className
1615
- ),
1616
- ...props
1617
- }
1618
- );
1619
- });
1620
- SidebarGroupAction.displayName = "SidebarGroupAction";
1621
- SidebarGroupContent = React10.forwardRef(({ className, ...props }, ref) => {
1622
- return /* @__PURE__ */ jsx(
1623
- "div",
1624
- {
1625
- ref,
1626
- "data-sidebar": "group-content",
1627
- className: cn("w-full text-sm", className),
1628
- ...props
1629
- }
1630
- );
1631
- });
1632
- SidebarGroupContent.displayName = "SidebarGroupContent";
1633
- SidebarMenu = React10.forwardRef(({ className, ...props }, ref) => {
1634
- return /* @__PURE__ */ jsx(
1635
- "ul",
1636
- {
1637
- ref,
1638
- "data-sidebar": "menu",
1639
- className: cn("flex w-full min-w-0 flex-col gap-1", className),
1640
- ...props
1641
- }
1642
- );
1643
- });
1644
- SidebarMenu.displayName = "SidebarMenu";
1645
- SidebarMenuItem = React10.forwardRef(({ className, ...props }, ref) => {
1646
- return /* @__PURE__ */ jsx(
1647
- "li",
1648
- {
1649
- ref,
1650
- "data-sidebar": "menu-item",
1651
- className: cn("group/menu-item relative", className),
1652
- ...props
1653
- }
1654
- );
1655
- });
1656
- SidebarMenuItem.displayName = "SidebarMenuItem";
1657
- sidebarMenuButtonVariants = cva(
1658
- // Base styles + hover-expand overrides
1659
- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[hover-expanded=true]:!size-auto group-data-[hover-expanded=true]:!w-full group-data-[hover-expanded=true]:!p-2",
1660
- {
1661
- variants: {
1662
- variant: {
1663
- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
1664
- outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
1665
- },
1666
- size: {
1667
- default: "h-8 text-sm",
1668
- sm: "h-7 text-xs",
1669
- lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0"
1670
- },
1671
- isActive: {
1672
- true: "bg-primary/10 text-primary font-bold"
1673
- }
1674
- },
1675
- defaultVariants: {
1676
- variant: "default",
1677
- size: "default"
1678
- }
1679
- }
1680
- );
1681
- SidebarMenuButton = React10.forwardRef(
1682
- ({
1683
- asChild = false,
1684
- isActive = false,
1685
- variant = "default",
1686
- size = "default",
1687
- tooltip,
1688
- className,
1689
- ...props
1690
- }, ref) => {
1691
- const Comp = asChild ? Slot : "button";
1692
- const { isMobile, state } = useSidebar();
1693
- const button = /* @__PURE__ */ jsx(
1694
- Comp,
1695
- {
1696
- ref,
1697
- "data-sidebar": "menu-button",
1698
- "data-size": size,
1699
- "data-active": isActive,
1700
- className: cn(
1701
- sidebarMenuButtonVariants({ variant, size, isActive }),
1702
- className
1703
- ),
1704
- ...props
1705
- }
1706
- );
1707
- if (!tooltip) {
1708
- return button;
1709
- }
1710
- if (typeof tooltip === "string") {
1711
- tooltip = {
1712
- children: tooltip
1713
- };
1714
- }
1715
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
1716
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: button }),
1717
- /* @__PURE__ */ jsx(
1718
- TooltipContent,
1719
- {
1720
- side: "right",
1721
- align: "center",
1722
- hidden: state !== "collapsed" || isMobile,
1723
- ...tooltip
1724
- }
1725
- )
1726
- ] });
1727
- }
1728
- );
1729
- SidebarMenuButton.displayName = "SidebarMenuButton";
1730
- SidebarMenuAction = React10.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
1731
- const Comp = asChild ? Slot : "button";
1732
- return /* @__PURE__ */ jsx(
1733
- Comp,
1734
- {
1735
- ref,
1736
- "data-sidebar": "menu-action",
1737
- className: cn(
1738
- "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
1739
- // Increases the hit area of the button on mobile.
1740
- "after:absolute after:-inset-2 after:md:hidden",
1741
- "peer-data-[size=sm]/menu-button:top-1",
1742
- "peer-data-[size=default]/menu-button:top-1.5",
1743
- "peer-data-[size=lg]/menu-button:top-2.5",
1744
- "group-data-[collapsible=icon]:hidden",
1745
- showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
1746
- className
1747
- ),
1748
- ...props
1749
- }
1750
- );
1751
- });
1752
- SidebarMenuAction.displayName = "SidebarMenuAction";
1753
- SidebarMenuBadge = React10.forwardRef(({ className, ...props }, ref) => {
1754
- return /* @__PURE__ */ jsx(
1755
- "div",
1756
- {
1757
- ref,
1758
- "data-sidebar": "menu-badge",
1759
- className: cn(
1760
- "pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none",
1761
- "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
1762
- "peer-data-[size=sm]/menu-button:top-1",
1763
- "peer-data-[size=default]/menu-button:top-1.5",
1764
- "peer-data-[size=lg]/menu-button:top-2.5",
1765
- "group-data-[collapsible=icon]:hidden",
1766
- className
1767
- ),
1768
- ...props
1769
- }
1770
- );
1771
- });
1772
- SidebarMenuBadge.displayName = "SidebarMenuBadge";
1773
- SidebarMenuSkeleton = React10.forwardRef(({ className, showIcon = false, ...props }, ref) => {
1774
- const width = React10.useMemo(() => {
1775
- return `${Math.floor(Math.random() * 40) + 50}%`;
1776
- }, []);
1777
- return /* @__PURE__ */ jsxs(
1778
- "div",
1779
- {
1780
- ref,
1781
- "data-sidebar": "menu-skeleton",
1782
- className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
1783
- ...props,
1784
- children: [
1785
- showIcon && /* @__PURE__ */ jsx(
1786
- "div",
1787
- {
1788
- className: "size-4 rounded-md animate-pulse bg-muted",
1789
- "data-sidebar": "menu-skeleton-icon"
1790
- }
1791
- ),
1792
- /* @__PURE__ */ jsx(
1793
- "div",
1794
- {
1795
- className: "h-4 flex-1 max-w-[--skeleton-width] animate-pulse bg-muted rounded-full",
1796
- "data-sidebar": "menu-skeleton-text",
1797
- style: {
1798
- "--skeleton-width": width
1799
- }
1800
- }
1801
- )
1802
- ]
1803
- }
1804
- );
1805
- });
1806
- SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
1807
- SidebarMenuSub = React10.forwardRef(({ className, ...props }, ref) => {
1808
- return /* @__PURE__ */ jsx(
1809
- "ul",
1810
- {
1811
- ref,
1812
- "data-sidebar": "menu-sub",
1813
- className: cn(
1814
- "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
1815
- // Hide when collapsed, show when hover-expanded
1816
- "group-data-[collapsible=icon]:hidden group-data-[hover-expanded=true]:!flex",
1817
- className
1818
- ),
1819
- ...props
1820
- }
1821
- );
1822
- });
1823
- SidebarMenuSub.displayName = "SidebarMenuSub";
1824
- SidebarMenuSubItem = React10.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("li", { ref, ...props }));
1825
- SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
1826
- SidebarMenuSubButton = React10.forwardRef(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
1827
- const Comp = asChild ? Slot : "a";
1828
- return /* @__PURE__ */ jsx(
1829
- Comp,
1830
- {
1831
- ref,
1832
- "data-sidebar": "menu-sub-button",
1833
- "data-size": size,
1834
- "data-active": isActive,
1835
- className: cn(
1836
- "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 text-xs",
1837
- "data-[active=true]:bg-primary/15 data-[active=true]:!text-primary data-[active=true]:font-bold",
1838
- size === "sm" && "text-xs",
1839
- size === "md" && "text-sm",
1840
- className
1841
- ),
1842
- ...props
1843
- }
1844
- );
1845
- });
1846
- SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
1847
- }
1848
- });
1849
- var init_popover = __esm({
1850
- "src/ui/primitives/popover.tsx"() {
1851
- "use client";
1852
- }
1853
- });
1854
- function ScrollArea({
1855
- orientation,
1856
- className,
1857
- children,
1858
- ...props
1859
- }) {
1860
- return /* @__PURE__ */ jsxs(
1861
- ScrollAreaPrimitive.Root,
1862
- {
1863
- "data-slot": "scroll-area",
1864
- className: cn("relative overflow-hidden", className),
1865
- ...props,
1866
- children: [
1867
- /* @__PURE__ */ jsx(
1868
- ScrollAreaPrimitive.Viewport,
1869
- {
1870
- "data-slot": "scroll-area-viewport",
1871
- className: "h-full w-full rounded-[inherit]",
1872
- children
1873
- }
1874
- ),
1875
- /* @__PURE__ */ jsx(ScrollBar, { orientation }),
1876
- /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
1877
- ]
1878
- }
1879
- );
1880
- }
1881
- function ScrollBar({
1882
- className,
1883
- orientation = "vertical",
1884
- ...props
1885
- }) {
1886
- return /* @__PURE__ */ jsx(
1887
- ScrollAreaPrimitive.ScrollAreaScrollbar,
1888
- {
1889
- "data-slot": "scroll-area-scrollbar",
1890
- orientation,
1891
- className: cn(
1892
- "flex touch-none select-none transition-colors",
1893
- orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
1894
- orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
1895
- className
1896
- ),
1897
- ...props,
1898
- children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
1899
- }
1900
- );
1901
- }
1902
- var init_scroll_area = __esm({
1903
- "src/ui/primitives/scroll-area.tsx"() {
1904
- "use client";
1905
- init_utils();
1906
- }
1907
- });
1908
- var init_calendar = __esm({
1909
- "src/ui/primitives/calendar.tsx"() {
1910
- "use client";
1911
- init_utils();
1912
- init_button();
1913
- }
1914
- });
1915
- var init_resizable = __esm({
1916
- "src/ui/primitives/resizable.tsx"() {
1917
- "use client";
1918
- }
1919
- });
1920
- var init_slider = __esm({
1921
- "src/ui/primitives/slider.tsx"() {
1922
- "use client";
1923
- }
1924
- });
1925
- var init_switch = __esm({
1926
- "src/ui/primitives/switch.tsx"() {
1927
- "use client";
1928
- }
1929
- });
1930
- var init_select = __esm({
1931
- "src/ui/primitives/select.tsx"() {
1932
- "use client";
1933
- }
1934
- });
1935
- var init_menubar = __esm({
1936
- "src/ui/primitives/menubar.tsx"() {
1937
- "use client";
1938
- }
1939
- });
1940
- var init_navigation_menu = __esm({
1941
- "src/ui/primitives/navigation-menu.tsx"() {
1942
- cva(
1943
- "group cursor-pointer inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1"
1944
- );
1945
- }
1946
- });
1947
- var init_toggle = __esm({
1948
- "src/ui/primitives/toggle.tsx"() {
1949
- "use client";
1950
- cva(
1951
- "cursor-pointer inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
1952
- {
1953
- variants: {
1954
- variant: {
1955
- default: "bg-transparent",
1956
- outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
1957
- },
1958
- size: {
1959
- default: "h-9 px-3",
1960
- sm: "h-8 px-2",
1961
- lg: "h-10 px-3"
1962
- }
1963
- },
1964
- defaultVariants: {
1965
- variant: "default",
1966
- size: "default"
1967
- }
1968
- }
1969
- );
1970
- }
1971
- });
1972
- var init_toggle_group = __esm({
1973
- "src/ui/primitives/toggle-group.tsx"() {
1974
- "use client";
1975
- createContext({
1976
- size: "default",
1977
- variant: "default"
1978
- });
1979
- }
1980
- });
1981
- var init_combobox = __esm({
1982
- "src/ui/primitives/combobox.tsx"() {
1983
- "use client";
1984
- }
1985
- });
1986
- var Label5;
1987
- var init_label = __esm({
1988
- "src/ui/primitives/label.tsx"() {
1989
- "use client";
1990
- init_utils();
1991
- Label5 = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1992
- LabelPrimitive.Root,
1993
- {
1994
- ref,
1995
- className: cn(
1996
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
1997
- className
1998
- ),
1999
- ...props
2000
- }
2001
- ));
2002
- Label5.displayName = LabelPrimitive.Root.displayName;
2003
- }
2004
- });
2005
- function Spinner({ size = "md", className }) {
2006
- const sizeClasses = {
2007
- sm: "h-4 w-4",
2008
- md: "h-6 w-6",
2009
- lg: "h-8 w-8"
2010
- };
2011
- return /* @__PURE__ */ jsx(
2012
- "div",
2013
- {
2014
- className: cn(
2015
- "animate-spin rounded-full border-2 border-current border-t-transparent",
2016
- sizeClasses[size],
2017
- className
2018
- )
2019
- }
2020
- );
2021
- }
2022
- var Textarea, ButtonLoading;
2023
- var init_primitives = __esm({
2024
- "src/ui/primitives/index.tsx"() {
2025
- init_utils();
2026
- init_button();
2027
- init_badge();
2028
- init_button();
2029
- init_input();
2030
- init_checkbox();
2031
- init_card();
2032
- init_separator();
2033
- init_card();
2034
- init_table();
2035
- init_dropdown_menu();
2036
- init_dialog();
2037
- init_tabs();
2038
- init_breadcrumb();
2039
- init_keyboard();
2040
- init_pagination();
2041
- init_status_badge();
2042
- init_sidebar();
2043
- init_popover();
2044
- init_scroll_area();
2045
- init_calendar();
2046
- init_resizable();
2047
- init_slider();
2048
- init_switch();
2049
- init_tooltip();
2050
- init_select();
2051
- init_menubar();
2052
- init_navigation_menu();
2053
- init_toggle();
2054
- init_toggle_group();
2055
- init_combobox();
2056
- init_label();
2057
- Textarea = React10.forwardRef(
2058
- ({ className, ...props }, ref) => {
2059
- return /* @__PURE__ */ jsx(
2060
- "textarea",
2061
- {
2062
- className: cn(
2063
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
2064
- className
2065
- ),
2066
- ref,
2067
- ...props
2068
- }
2069
- );
2070
- }
2071
- );
2072
- Textarea.displayName = "Textarea";
2073
- ButtonLoading = React10.forwardRef(({ className, isLoading, children, disabled, ...props }, ref) => {
2074
- return /* @__PURE__ */ jsxs(
2075
- Button,
2076
- {
2077
- className: cn("gap-2", className),
2078
- disabled: isLoading || disabled,
2079
- ref,
2080
- ...props,
2081
- children: [
2082
- isLoading && /* @__PURE__ */ jsx(Spinner, { size: "sm" }),
2083
- children
2084
- ]
2085
- }
2086
- );
2087
- });
2088
- ButtonLoading.displayName = "ButtonLoading";
2089
- }
2090
- });
2091
- var init_sticky_layout = __esm({
2092
- "src/ui/primitives/sticky-layout.tsx"() {
2093
- }
2094
- });
2095
- var init_prefetch_link = __esm({
2096
- "src/ui/primitives/prefetch-link.tsx"() {
2097
- "use client";
2098
- }
2099
- });
2100
- var init_dynamic_icon = __esm({
2101
- "src/ui/primitives/dynamic-icon.tsx"() {
2102
- "use client";
2103
- }
2104
- });
2105
- var InputNumber;
2106
- var init_input_number = __esm({
2107
- "src/ui/primitives/input-number.tsx"() {
2108
- "use client";
2109
- init_utils();
2110
- init_input();
2111
- InputNumber = React10.forwardRef(
2112
- ({ value, onChange, className, decimalScale = 0, suffix, ...props }, ref) => {
2113
- const [displayValue, setDisplayValue] = React10.useState("");
2114
- const parseDisplayValue = (val) => {
2115
- const clean = val.replace(/\./g, "").replace(",", ".");
2116
- return Number(clean);
2117
- };
2118
- const formatNumber = React10.useCallback(
2119
- (num) => {
2120
- return new Intl.NumberFormat("vi-VN", {
2121
- maximumFractionDigits: decimalScale,
2122
- minimumFractionDigits: 0
2123
- }).format(num);
2124
- },
2125
- [decimalScale]
2126
- );
2127
- React10.useEffect(() => {
2128
- if (value === null || value === void 0 || value === "") {
2129
- setDisplayValue("");
2130
- return;
2131
- }
2132
- const numValue = Number(value);
2133
- if (isNaN(numValue)) return;
2134
- const currentNum = parseDisplayValue(displayValue);
2135
- if (currentNum !== numValue) {
2136
- setDisplayValue(formatNumber(numValue));
2137
- }
2138
- }, [value, decimalScale, displayValue, formatNumber]);
2139
- const handleChange = (e) => {
2140
- const rawValue = e.target.value;
2141
- let cleanVal = rawValue.replace(/[^0-9,]/g, "");
2142
- const parts = cleanVal.split(",");
2143
- if (parts.length > 2) {
2144
- cleanVal = parts[0] + "," + parts.slice(1).join("");
2145
- }
2146
- if (cleanVal === "") {
2147
- setDisplayValue("");
2148
- onChange?.(null);
2149
- return;
2150
- }
2151
- const [integerPart, decimalPart] = cleanVal.split(",");
2152
- let formattedInteger = integerPart;
2153
- if (integerPart) {
2154
- formattedInteger = new Intl.NumberFormat("vi-VN").format(
2155
- Number(integerPart)
2156
- );
2157
- }
2158
- let newDisplayValue = formattedInteger;
2159
- let finalDecimalPart = decimalPart;
2160
- if (decimalPart !== void 0) {
2161
- if (decimalScale !== void 0 && decimalPart.length > decimalScale) {
2162
- finalDecimalPart = decimalPart.substring(0, decimalScale);
2163
- }
2164
- newDisplayValue += "," + finalDecimalPart;
2165
- }
2166
- setDisplayValue(newDisplayValue);
2167
- let numStr = integerPart;
2168
- if (finalDecimalPart !== void 0) {
2169
- numStr += "." + finalDecimalPart;
2170
- }
2171
- const numValue = Number(numStr.replace(/\./g, ""));
2172
- onChange?.(numValue);
2173
- };
2174
- return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
2175
- /* @__PURE__ */ jsx(
2176
- Input,
2177
- {
2178
- ...props,
2179
- ref,
2180
- type: "text",
2181
- inputMode: "numeric",
2182
- value: displayValue,
2183
- onChange: handleChange,
2184
- className: cn("pr-8", className)
2185
- }
2186
- ),
2187
- suffix && /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-muted-foreground text-sm", children: suffix })
2188
- ] });
2189
- }
2190
- );
2191
- InputNumber.displayName = "InputNumber";
2192
- }
2193
- });
2194
-
2195
- // src/ui/primitives/client.ts
2196
- var init_client = __esm({
2197
- "src/ui/primitives/client.ts"() {
2198
- "use client";
2199
- init_calendar();
2200
- init_combobox();
2201
- init_scroll_area();
2202
- init_select();
2203
- init_popover();
2204
- init_dropdown_menu();
2205
- init_switch();
2206
- init_checkbox();
2207
- init_label();
2208
- init_tooltip();
2209
- init_sidebar();
2210
- init_resizable();
2211
- init_slider();
2212
- init_toggle();
2213
- init_toggle_group();
2214
- init_menubar();
2215
- init_navigation_menu();
2216
- init_sticky_layout();
2217
- init_prefetch_link();
2218
- init_dynamic_icon();
2219
- init_input_number();
2220
- init_sheet();
2221
- init_context_menu();
2222
- init_drawer();
2223
- init_progress();
2224
- init_sonner();
2225
- }
2226
- });
2227
- var init_radio_group = __esm({
2228
- "src/ui/forms/radio-group.tsx"() {
2229
- "use client";
2230
- }
2231
- });
2232
- var init_rating = __esm({
2233
- "src/ui/forms/rating.tsx"() {
2234
- "use client";
2235
- cva(
2236
- "transition-all duration-100 ease-in-out hover:scale-110",
2237
- {
2238
- variants: {
2239
- size: {
2240
- sm: "w-4 h-4",
2241
- default: "w-6 h-6",
2242
- lg: "w-8 h-8"
2243
- },
2244
- variant: {
2245
- default: "text-yellow-400",
2246
- primary: "text-primary",
2247
- muted: "text-muted-foreground"
2248
- },
2249
- filled: {
2250
- true: "",
2251
- false: "text-gray-200"
2252
- }
2253
- },
2254
- defaultVariants: {
2255
- size: "default",
2256
- variant: "default",
2257
- filled: false
2258
- }
2259
- }
2260
- );
2261
- }
2262
- });
2263
- var init_command = __esm({
2264
- "src/ui/forms/command.tsx"() {
2265
- "use client";
2266
- }
2267
- });
2268
- var MultiSelect;
2269
- var init_multi_select = __esm({
2270
- "src/ui/forms/multi-select.tsx"() {
2271
- "use client";
2272
- init_utils();
2273
- init_primitives();
2274
- init_client();
2275
- MultiSelect = React10.forwardRef(
2276
- ({
2277
- options,
2278
- value: controlledValue,
2279
- onValueChange,
2280
- defaultValue = [],
2281
- placeholder = "Select options...",
2282
- searchPlaceholder = "Search...",
2283
- emptyText = "No option found.",
2284
- maxCount = 3,
2285
- disabled = false,
2286
- responsive = false,
2287
- className,
2288
- id
2289
- }, ref) => {
2290
- const [internalValue, setInternalValue] = useState(defaultValue);
2291
- const [open, setOpen] = useState(false);
2292
- const [searchValue, setSearchValue] = useState("");
2293
- const isControlled = controlledValue !== void 0;
2294
- const value = isControlled ? controlledValue : internalValue;
2295
- const containerRef = useRef(null);
2296
- const searchInputRef = useRef(null);
2297
- const dropdownRef = useRef(null);
2298
- const buttonRef = useRef(null);
2299
- const [politeMessage, setPoliteMessage] = useState("");
2300
- const [assertiveMessage, setAssertiveMessage] = useState("");
2301
- const prevSelectedCount = useRef(value.length);
2302
- const announce = useCallback(
2303
- (message, priority = "polite") => {
2304
- if (priority === "assertive") {
2305
- setAssertiveMessage(message);
2306
- setTimeout(() => setAssertiveMessage(""), 100);
2307
- } else {
2308
- setPoliteMessage(message);
2309
- setTimeout(() => setPoliteMessage(""), 100);
2310
- }
2311
- },
2312
- []
2313
- );
2314
- const [screenSize, setScreenSize] = useState("desktop");
2315
- useEffect(() => {
2316
- if (typeof window === "undefined") return;
2317
- const handleResize = () => {
2318
- const width = window.innerWidth;
2319
- if (width < 640) {
2320
- setScreenSize("mobile");
2321
- } else if (width < 1024) {
2322
- setScreenSize("tablet");
2323
- } else {
2324
- setScreenSize("desktop");
2325
- }
2326
- };
2327
- handleResize();
2328
- window.addEventListener("resize", handleResize);
2329
- return () => window.removeEventListener("resize", handleResize);
2330
- }, []);
2331
- const getResponsiveSettings = useCallback(() => {
2332
- if (!responsive) {
2333
- return {
2334
- maxCount,
2335
- compactMode: false
2336
- };
2337
- }
2338
- if (responsive === true) {
2339
- const defaultResponsive = {
2340
- mobile: { maxCount: 2, compactMode: true },
2341
- tablet: { maxCount: 4, compactMode: false },
2342
- desktop: { maxCount: 6, compactMode: false }
2343
- };
2344
- const currentSettings2 = defaultResponsive[screenSize];
2345
- return {
2346
- maxCount: currentSettings2?.maxCount ?? maxCount,
2347
- compactMode: currentSettings2?.compactMode ?? false
2348
- };
2349
- }
2350
- const currentSettings = responsive[screenSize];
2351
- return {
2352
- maxCount: currentSettings?.maxCount ?? maxCount,
2353
- compactMode: currentSettings?.compactMode ?? false
2354
- };
2355
- }, [responsive, screenSize, maxCount]);
2356
- const responsiveSettings = getResponsiveSettings();
2357
- const filteredOptions = useMemo(() => {
2358
- if (!searchValue.trim()) {
2359
- return options;
2360
- }
2361
- const searchLower = searchValue.toLowerCase();
2362
- return options.filter(
2363
- (option) => option.label.toLowerCase().includes(searchLower) || String(option.value).toLowerCase().includes(searchLower)
2364
- );
2365
- }, [options, searchValue]);
2366
- useEffect(() => {
2367
- if (!open) {
2368
- setSearchValue("");
2369
- }
2370
- }, [open]);
2371
- useEffect(() => {
2372
- if (open && searchInputRef.current) {
2373
- setTimeout(() => {
2374
- searchInputRef.current?.focus();
2375
- }, 50);
2376
- }
2377
- }, [open]);
2378
- useEffect(() => {
2379
- if (!open) return;
2380
- const handleClickOutside = (event) => {
2381
- const target = event.target;
2382
- if (containerRef.current && !containerRef.current.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
2383
- if (target.closest('[data-slot="dialog-content"]')) {
2384
- return;
2385
- }
2386
- setOpen(false);
2387
- }
2388
- };
2389
- const handleEscape = (event) => {
2390
- if (event.key === "Escape" && open) {
2391
- event.stopPropagation();
2392
- setOpen(false);
2393
- }
2394
- };
2395
- document.addEventListener("mousedown", handleClickOutside, true);
2396
- document.addEventListener("keydown", handleEscape, true);
2397
- return () => {
2398
- document.removeEventListener("mousedown", handleClickOutside, true);
2399
- document.removeEventListener("keydown", handleEscape, true);
2400
- };
2401
- }, [open]);
2402
- useEffect(() => {
2403
- const selectedCount = value.length;
2404
- const totalOptions = options.filter((opt) => !opt.disabled).length;
2405
- if (selectedCount !== prevSelectedCount.current) {
2406
- const diff = selectedCount - prevSelectedCount.current;
2407
- if (diff > 0) {
2408
- announce(`${selectedCount} of ${totalOptions} options selected.`);
2409
- } else if (diff < 0) {
2410
- announce(
2411
- `Option removed. ${selectedCount} of ${totalOptions} options selected.`
2412
- );
2413
- }
2414
- prevSelectedCount.current = selectedCount;
2415
- }
2416
- }, [value, announce, options]);
2417
- const updateValue = useCallback(
2418
- (newValue) => {
2419
- if (!isControlled) {
2420
- setInternalValue(newValue);
2421
- }
2422
- onValueChange?.(newValue);
2423
- },
2424
- [isControlled, onValueChange]
2425
- );
2426
- const handleSelect = useCallback(
2427
- (optionValue) => {
2428
- const option = options.find((opt) => opt.value === optionValue);
2429
- if (option?.disabled) {
2430
- return;
2431
- }
2432
- const newValue = value.includes(optionValue) ? value.filter((v) => v !== optionValue) : [...value, optionValue];
2433
- updateValue(newValue);
2434
- },
2435
- [value, options, updateValue]
2436
- );
2437
- const handleSelectAll = useCallback(() => {
2438
- updateValue(
2439
- filteredOptions.filter((opt) => !opt.disabled).map((opt) => opt.value)
2440
- );
2441
- }, [updateValue, filteredOptions]);
2442
- const handleClearAll = useCallback(() => {
2443
- updateValue([]);
2444
- }, [updateValue]);
2445
- const handleRemove = useCallback(
2446
- (optionValue, e) => {
2447
- e.stopPropagation();
2448
- updateValue(value.filter((v) => v !== optionValue));
2449
- },
2450
- [updateValue, value]
2451
- );
2452
- const clearExtraOptions = useCallback(() => {
2453
- const newSelectedValues = value.slice(0, responsiveSettings.maxCount);
2454
- updateValue(newSelectedValues);
2455
- }, [value, responsiveSettings.maxCount, updateValue]);
2456
- React10.useImperativeHandle(
2457
- ref,
2458
- () => ({
2459
- reset: () => {
2460
- updateValue(defaultValue);
2461
- setOpen(false);
2462
- setSearchValue("");
2463
- },
2464
- getSelectedValues: () => value,
2465
- setSelectedValues: (values) => {
2466
- updateValue(values);
2467
- },
2468
- clear: () => {
2469
- updateValue([]);
2470
- },
2471
- focus: () => {
2472
- buttonRef.current?.focus();
2473
- }
2474
- }),
2475
- [value, defaultValue, updateValue]
2476
- );
2477
- const selectedOptions = options.filter(
2478
- (option) => value.includes(option.value)
2479
- );
2480
- const getBadgeColor = (index) => {
2481
- const colors = [
2482
- "bg-blue-100 text-blue-700 hover:bg-blue-200",
2483
- "bg-green-100 text-green-700 hover:bg-green-200",
2484
- "bg-purple-100 text-purple-700 hover:bg-purple-200",
2485
- "bg-orange-100 text-orange-700 hover:bg-orange-200",
2486
- "bg-pink-100 text-pink-700 hover:bg-pink-200",
2487
- "bg-cyan-100 text-cyan-700 hover:bg-cyan-200"
2488
- ];
2489
- return colors[index % colors.length];
2490
- };
2491
- return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative w-full", children: [
2492
- /* @__PURE__ */ jsxs("div", { className: "sr-only", children: [
2493
- /* @__PURE__ */ jsx("div", { "aria-live": "polite", "aria-atomic": "true", role: "status", children: politeMessage }),
2494
- /* @__PURE__ */ jsx("div", { "aria-live": "assertive", "aria-atomic": "true", role: "alert", children: assertiveMessage })
2495
- ] }),
2496
- /* @__PURE__ */ jsxs(
2497
- Button,
2498
- {
2499
- ref: buttonRef,
2500
- type: "button",
2501
- variant: "outline",
2502
- role: "combobox",
2503
- "aria-expanded": open,
2504
- disabled,
2505
- className: cn(
2506
- "w-full justify-between h-auto min-h-10 px-3 py-2",
2507
- responsiveSettings.compactMode && "min-h-8 text-sm",
2508
- className
2509
- ),
2510
- id,
2511
- onClick: (e) => {
2512
- e.stopPropagation();
2513
- setOpen(!open);
2514
- },
2515
- children: [
2516
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: selectedOptions.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
2517
- selectedOptions.slice(0, responsiveSettings.maxCount).map((option, index) => /* @__PURE__ */ jsxs(
2518
- Badge,
2519
- {
2520
- className: cn(
2521
- "mr-1 mb-1",
2522
- getBadgeColor(index),
2523
- responsiveSettings.compactMode && "text-xs px-1.5 py-0.5"
2524
- ),
2525
- onClick: (e) => handleRemove(option.value, e),
2526
- children: [
2527
- option.icon && !responsiveSettings.compactMode && /* @__PURE__ */ jsx(option.icon, { className: "mr-2 h-4 w-4" }),
2528
- option.label,
2529
- /* @__PURE__ */ jsx(
2530
- "div",
2531
- {
2532
- role: "button",
2533
- tabIndex: 0,
2534
- className: "ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",
2535
- onKeyDown: (e) => {
2536
- if (e.key === "Enter") {
2537
- handleRemove(option.value, e);
2538
- }
2539
- },
2540
- onMouseDown: (e) => {
2541
- e.preventDefault();
2542
- e.stopPropagation();
2543
- },
2544
- onClick: (e) => handleRemove(option.value, e),
2545
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
2546
- }
2547
- )
2548
- ]
2549
- },
2550
- String(option.value)
2551
- )),
2552
- value.length > responsiveSettings.maxCount && /* @__PURE__ */ jsxs(
2553
- Badge,
2554
- {
2555
- className: cn(
2556
- "mr-1 mb-1 bg-muted text-muted-foreground hover:bg-muted",
2557
- responsiveSettings.compactMode && "text-xs px-1.5 py-0.5"
2558
- ),
2559
- children: [
2560
- "+",
2561
- value.length - responsiveSettings.maxCount,
2562
- " more",
2563
- /* @__PURE__ */ jsx(
2564
- "div",
2565
- {
2566
- role: "button",
2567
- tabIndex: 0,
2568
- className: "ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",
2569
- onClick: (e) => {
2570
- e.stopPropagation();
2571
- clearExtraOptions();
2572
- },
2573
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
2574
- }
2575
- )
2576
- ]
2577
- }
2578
- )
2579
- ] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }) }),
2580
- /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
2581
- ]
2582
- }
2583
- ),
2584
- open && /* @__PURE__ */ jsx(
2585
- "div",
2586
- {
2587
- ref: dropdownRef,
2588
- className: "absolute z-[100] mt-1 w-full rounded-md border bg-popover text-popover-foreground shadow-md",
2589
- style: {
2590
- top: "100%",
2591
- left: 0
2592
- },
2593
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
2594
- /* @__PURE__ */ jsxs("div", { className: "flex items-center border-b px-3 py-2", children: [
2595
- /* @__PURE__ */ jsx(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
2596
- /* @__PURE__ */ jsx(
2597
- Input,
2598
- {
2599
- ref: searchInputRef,
2600
- placeholder: searchPlaceholder,
2601
- value: searchValue,
2602
- onChange: (e) => {
2603
- e.stopPropagation();
2604
- setSearchValue(e.target.value);
2605
- },
2606
- onKeyDown: (e) => {
2607
- e.stopPropagation();
2608
- if (e.key === "Escape") {
2609
- e.preventDefault();
2610
- setOpen(false);
2611
- }
2612
- },
2613
- onClick: (e) => {
2614
- e.stopPropagation();
2615
- },
2616
- onFocus: (e) => {
2617
- e.stopPropagation();
2618
- },
2619
- className: "border-0 focus-visible:ring-0 focus-visible:ring-offset-0 h-9 bg-transparent px-0"
2620
- }
2621
- ),
2622
- searchValue && /* @__PURE__ */ jsx(
2623
- Button,
2624
- {
2625
- type: "button",
2626
- variant: "ghost",
2627
- size: "sm",
2628
- className: "h-6 w-6 p-0",
2629
- onClick: (e) => {
2630
- e.stopPropagation();
2631
- setSearchValue("");
2632
- searchInputRef.current?.focus();
2633
- },
2634
- children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
2635
- }
2636
- )
2637
- ] }),
2638
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b p-1", children: [
2639
- /* @__PURE__ */ jsx(
2640
- Button,
2641
- {
2642
- type: "button",
2643
- variant: "ghost",
2644
- size: "sm",
2645
- className: "h-8 px-2 text-xs",
2646
- onClick: (e) => {
2647
- e.stopPropagation();
2648
- handleSelectAll();
2649
- },
2650
- children: "Select All"
2651
- }
2652
- ),
2653
- /* @__PURE__ */ jsx(
2654
- Button,
2655
- {
2656
- type: "button",
2657
- variant: "ghost",
2658
- size: "sm",
2659
- className: "h-8 px-2 text-xs",
2660
- onClick: (e) => {
2661
- e.stopPropagation();
2662
- handleClearAll();
2663
- },
2664
- children: "Clear All"
2665
- }
2666
- )
2667
- ] }),
2668
- /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[300px]", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-6 text-center text-sm text-muted-foreground", children: emptyText }) : /* @__PURE__ */ jsx("div", { className: "p-1", children: filteredOptions.map((option) => {
2669
- const isSelected = value.includes(option.value);
2670
- const isDisabled = option.disabled || false;
2671
- return /* @__PURE__ */ jsxs(
2672
- "div",
2673
- {
2674
- role: "option",
2675
- "aria-selected": isSelected,
2676
- "aria-disabled": isDisabled,
2677
- className: cn(
2678
- "relative flex select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
2679
- isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-accent hover:text-accent-foreground",
2680
- isSelected && !isDisabled && "bg-accent text-accent-foreground"
2681
- ),
2682
- onMouseDown: (e) => {
2683
- e.preventDefault();
2684
- e.stopPropagation();
2685
- },
2686
- onClick: (e) => {
2687
- e.preventDefault();
2688
- e.stopPropagation();
2689
- if (!isDisabled) {
2690
- handleSelect(option.value);
2691
- }
2692
- },
2693
- children: [
2694
- /* @__PURE__ */ jsx(
2695
- "div",
2696
- {
2697
- className: cn(
2698
- "mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
2699
- isSelected ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"
2700
- ),
2701
- children: /* @__PURE__ */ jsx(Check, { className: cn("h-4 w-4") })
2702
- }
2703
- ),
2704
- option.icon && /* @__PURE__ */ jsx(option.icon, { className: "mr-2 h-4 w-4 text-muted-foreground" }),
2705
- /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: option.label })
2706
- ]
2707
- },
2708
- String(option.value)
2709
- );
2710
- }) }) }),
2711
- /* @__PURE__ */ jsx("div", { className: "border-t p-2", children: /* @__PURE__ */ jsx(
2712
- Button,
2713
- {
2714
- type: "button",
2715
- variant: "outline",
2716
- size: "sm",
2717
- className: "w-full h-8 text-xs",
2718
- onClick: (e) => {
2719
- e.stopPropagation();
2720
- setOpen(false);
2721
- },
2722
- children: "Close"
2723
- }
2724
- ) })
2725
- ] })
2726
- }
2727
- )
2728
- ] });
2729
- }
2730
- );
2731
- MultiSelect.displayName = "MultiSelect";
2732
- }
2733
- });
2734
- var init_date_picker = __esm({
2735
- "src/ui/forms/date-picker.tsx"() {
2736
- "use client";
2737
- }
2738
- });
2739
- var init_date_range_picker = __esm({
2740
- "src/ui/forms/date-range-picker.tsx"() {
2741
- "use client";
2742
- }
2743
- });
2744
- var init_input_time = __esm({
2745
- "src/ui/forms/input-time.tsx"() {
2746
- "use client";
2747
- }
2748
- });
2749
- var init_date_time_picker = __esm({
2750
- "src/ui/forms/date-time-picker.tsx"() {
2751
- "use client";
2752
- }
2753
- });
2754
- var init_emoji_picker = __esm({
2755
- "src/ui/forms/emoji-picker.tsx"() {
2756
- "use client";
2757
- dynamic(
2758
- () => {
2759
- return import('emoji-picker-react');
2760
- },
2761
- { ssr: false }
2762
- );
2763
- }
2764
- });
2765
- var init_file_thumbnail = __esm({
2766
- "src/ui/forms/file-thumbnail.tsx"() {
2767
- }
2768
- });
2769
- var init_file_dropzone = __esm({
2770
- "src/ui/forms/file-dropzone.tsx"() {
2771
- "use client";
2772
- }
2773
- });
2774
- var init_input_file = __esm({
2775
- "src/ui/forms/input-file.tsx"() {
2776
- "use client";
2777
- }
2778
- });
2779
- var init_input_group = __esm({
2780
- "src/ui/forms/input-group.tsx"() {
2781
- "use client";
2782
- }
2783
- });
2784
- var init_input_otp = __esm({
2785
- "src/ui/forms/input-otp.tsx"() {
2786
- "use client";
2787
- }
2788
- });
2789
- var init_input_phone = __esm({
2790
- "src/ui/forms/input-phone.tsx"() {
2791
- "use client";
2792
- }
2793
- });
2794
- var init_input_spin = __esm({
2795
- "src/ui/forms/input-spin.tsx"() {
2796
- "use client";
2797
- }
2798
- });
2799
- var init_input_tags = __esm({
2800
- "src/ui/forms/input-tags.tsx"() {
2801
- "use client";
2802
- }
2803
- });
2804
- var init_multiple_date_picker = __esm({
2805
- "src/ui/forms/multiple-date-picker.tsx"() {
2806
- "use client";
2807
- }
2808
- });
2809
- var init_time_picker = __esm({
2810
- "src/ui/forms/time-picker.tsx"() {
2811
- "use client";
2812
- }
2813
- });
2814
- var init_editor = __esm({
2815
- "src/ui/forms/editor/index.tsx"() {
2816
- "use client";
2817
- }
2818
- });
2819
- function FormField(props) {
2820
- return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
2821
- }
2822
- function useFormField() {
2823
- const fieldContext = useContext(FormFieldContext);
2824
- const itemContext = useContext(FormItemContext);
2825
- const { getFieldState, formState } = useFormContext();
2826
- const fieldState = getFieldState(fieldContext.name, formState);
2827
- if (!fieldContext) {
2828
- throw new Error("useFormField should be used within <FormField>");
2829
- }
2830
- const { id } = itemContext;
2831
- return {
2832
- id,
2833
- name: fieldContext.name,
2834
- formItemId: `${id}-form-item`,
2835
- formDescriptionId: `${id}-form-item-description`,
2836
- formMessageId: `${id}-form-item-message`,
2837
- ...fieldState
2838
- };
2839
- }
2840
- function FormItem({ className, ...props }) {
2841
- const id = useId();
2842
- return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx(
2843
- "div",
2844
- {
2845
- "data-slot": "form-item",
2846
- className: cn("grid gap-2", className),
2847
- ...props
2848
- }
2849
- ) });
2850
- }
2851
- function FormLabel({
2852
- className,
2853
- ...props
2854
- }) {
2855
- const { error, formItemId } = useFormField();
2856
- return /* @__PURE__ */ jsx(
2857
- Label5,
2858
- {
2859
- "data-slot": "form-label",
2860
- "data-error": !!error,
2861
- className: cn("data-[error=true]:text-destructive", className),
2862
- htmlFor: formItemId,
2863
- ...props
2864
- }
2865
- );
2866
- }
2867
- function FormControl({ ...props }) {
2868
- const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
2869
- return /* @__PURE__ */ jsx(
2870
- Slot,
2871
- {
2872
- "data-slot": "form-control",
2873
- id: formItemId,
2874
- "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
2875
- "aria-invalid": !!error,
2876
- ...props
2877
- }
2878
- );
2879
- }
2880
- function FormMessage({
2881
- className,
2882
- children,
2883
- ...props
2884
- }) {
2885
- const { error, formMessageId } = useFormField();
2886
- const body = error ? String(error?.message) : children;
2887
- if (!body) {
2888
- return null;
2889
- }
2890
- return /* @__PURE__ */ jsx(
2891
- "p",
2892
- {
2893
- "data-slot": "form-message",
2894
- id: formMessageId,
2895
- className: cn("text-[0.8rem] font-medium text-destructive", className),
2896
- ...props,
2897
- children: body
2898
- }
2899
- );
2900
- }
2901
- var Form, FormFieldContext, FormItemContext;
2902
- var init_forms = __esm({
2903
- "src/ui/forms/index.tsx"() {
2904
- "use client";
2905
- init_utils();
2906
- init_client();
2907
- init_radio_group();
2908
- init_rating();
2909
- init_command();
2910
- init_multi_select();
2911
- init_date_picker();
2912
- init_date_range_picker();
2913
- init_date_time_picker();
2914
- init_emoji_picker();
2915
- init_file_dropzone();
2916
- init_file_thumbnail();
2917
- init_input_file();
2918
- init_input_group();
2919
- init_input_otp();
2920
- init_input_phone();
2921
- init_input_spin();
2922
- init_input_tags();
2923
- init_input_time();
2924
- init_multiple_date_picker();
2925
- init_time_picker();
2926
- init_editor();
2927
- Form = FormProvider;
2928
- FormFieldContext = createContext(
2929
- {}
2930
- );
2931
- FormItemContext = createContext(
2932
- {}
2933
- );
2934
- }
2935
- });
2936
- var init_formatted_number_input = __esm({
2937
- "src/ui/data-display/formatted-number-input.tsx"() {
2938
- "use client";
2939
- }
2940
- });
2941
- var init_data_table_pagination = __esm({
2942
- "src/ui/data-display/data-table-pagination.tsx"() {
2943
- "use client";
2944
- }
2945
- });
2946
- var init_avatar = __esm({
2947
- "src/ui/data-display/avatar.tsx"() {
2948
- "use client";
2949
- cva(
2950
- "transition duration-300 hover:scale-105 hover:z-10",
2951
- {
2952
- variants: {
2953
- size: {
2954
- default: "h-10 w-10",
2955
- sm: "h-9 w-9 text-sm",
2956
- lg: "h-11 w-11"
2957
- }
2958
- },
2959
- defaultVariants: {
2960
- size: "default"
2961
- }
2962
- }
2963
- );
2964
- }
2965
- });
2966
- var init_kpi_card = __esm({
2967
- "src/ui/data-display/kpi-card.tsx"() {
2968
- "use client";
2969
- }
2970
- });
2971
- var THEME_STYLES;
2972
- var init_compact_stat_bar = __esm({
2973
- "src/ui/data-display/compact-stat-bar.tsx"() {
2974
- init_utils();
2975
- THEME_STYLES = {
2976
- dark: {
2977
- wrapper: "hover:bg-[#181d26]/5 dark:hover:bg-slate-100/5",
2978
- box: "bg-[#181d26] group-hover:bg-[#0a2e0e] dark:bg-slate-800 dark:group-hover:bg-slate-700",
2979
- icon: "text-white",
2980
- label: "text-[#181d26] dark:text-slate-300"
2981
- },
2982
- green: {
2983
- wrapper: "hover:bg-[#006400]/10",
2984
- box: "bg-[#006400] group-hover:bg-[#39bf45]",
2985
- icon: "text-white",
2986
- label: "text-[#006400] dark:text-[#39bf45]"
2987
- },
2988
- blue: {
2989
- wrapper: "hover:bg-[#254fad]/10",
2990
- box: "bg-[#254fad] group-hover:bg-[#1d3d8f]",
2991
- icon: "text-white",
2992
- label: "text-[#254fad] dark:text-[#60a5fa]"
2993
- },
2994
- purple: {
2995
- wrapper: "hover:bg-[#7C3AED]/10",
2996
- box: "bg-[#7C3AED] group-hover:bg-[#6D28D9]",
2997
- icon: "text-white",
2998
- label: "text-[#7C3AED] dark:text-[#a78bfa]"
2999
- },
3000
- orange: {
3001
- wrapper: "hover:bg-[#EA580C]/10",
3002
- box: "bg-[#EA580C] group-hover:bg-[#C2410C]",
3003
- icon: "text-white",
3004
- label: "text-[#EA580C] dark:text-[#fb923c]"
3005
- },
3006
- emerald: {
3007
- wrapper: "hover:bg-[#059669]/10",
3008
- box: "bg-[#059669] group-hover:bg-[#047857]",
3009
- icon: "text-white",
3010
- label: "text-[#059669] dark:text-[#34d399]"
3011
- },
3012
- primary: {
3013
- wrapper: "hover:bg-primary/10",
3014
- box: "bg-primary group-hover:bg-primary/90",
3015
- icon: "text-primary-foreground",
3016
- label: "text-primary"
3017
- },
3018
- destructive: {
3019
- wrapper: "hover:bg-destructive/10",
3020
- box: "bg-destructive group-hover:bg-destructive/90",
3021
- icon: "text-destructive-foreground",
3022
- label: "text-destructive"
3023
- },
3024
- muted: {
3025
- wrapper: "hover:bg-muted/50",
3026
- box: "bg-muted group-hover:bg-muted-foreground/20",
3027
- icon: "text-muted-foreground",
3028
- label: "text-muted-foreground"
3029
- },
3030
- rose: {
3031
- wrapper: "hover:bg-[#E11D48]/10",
3032
- box: "bg-[#E11D48] group-hover:bg-[#BE123C]",
3033
- icon: "text-white",
3034
- label: "text-[#E11D48] dark:text-[#fb7185]"
3035
- }
3036
- };
3037
- memo(function CompactStatBar2({
3038
- items,
3039
- className
3040
- }) {
3041
- if (!items || items.length === 0) return null;
3042
- return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col md:flex-row md:items-stretch gap-2 pb-1", className), children: /* @__PURE__ */ jsx("div", { className: "flex items-stretch overflow-x-auto no-scrollbar flex-1 bg-white dark:bg-[#1e293b] border border-slate-200 dark:border-slate-800 shadow-sm rounded-[10px] divide-x divide-slate-100 dark:divide-slate-800", children: items.map((item) => {
3043
- const theme = THEME_STYLES[item.colorTheme || "dark"];
3044
- const Icon2 = item.icon;
3045
- return /* @__PURE__ */ jsxs(
3046
- "div",
3047
- {
3048
- className: cn(
3049
- "flex items-center gap-3 min-w-fit px-5 py-2 flex-1 transition-colors group cursor-default",
3050
- theme.wrapper
3051
- ),
3052
- children: [
3053
- /* @__PURE__ */ jsx(
3054
- "div",
3055
- {
3056
- className: cn(
3057
- "p-1.5 rounded-md transition-colors shadow-sm shrink-0",
3058
- theme.box
3059
- ),
3060
- children: /* @__PURE__ */ jsx(Icon2, { className: cn("w-3.5 h-3.5", theme.icon), strokeWidth: 2.5 })
3061
- }
3062
- ),
3063
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
3064
- /* @__PURE__ */ jsx(
3065
- "span",
3066
- {
3067
- className: cn(
3068
- "text-[9px] font-bold uppercase tracking-wider mb-0.5",
3069
- item.isHighlighted ? "text-emerald-600 dark:text-emerald-400" : theme.label
3070
- ),
3071
- children: item.label
3072
- }
3073
- ),
3074
- /* @__PURE__ */ jsx("span", { className: cn(
3075
- "font-black leading-none",
3076
- item.isHighlighted ? "text-[22px] text-emerald-700 dark:text-emerald-400" : "text-[17px] text-slate-900 dark:text-white"
3077
- ), children: item.value })
3078
- ] })
3079
- ]
3080
- },
3081
- item.id
3082
- );
3083
- }) }) });
3084
- });
3085
- }
3086
- });
3087
- var init_show_more_text = __esm({
3088
- "src/ui/data-display/show-more-text.tsx"() {
3089
- "use client";
3090
- }
3091
- });
3092
- var init_chart = __esm({
3093
- "src/ui/data-display/chart.tsx"() {
3094
- "use client";
3095
- createContext(null);
3096
- }
3097
- });
3098
- var init_carousel = __esm({
3099
- "src/ui/data-display/carousel.tsx"() {
3100
- "use client";
3101
- createContext(null);
3102
- }
3103
- });
3104
- var init_accordion = __esm({
3105
- "src/ui/data-display/accordion.tsx"() {
3106
- "use client";
3107
- }
3108
- });
3109
- var init_kanban_item = __esm({
3110
- "src/ui/data-display/kanban/kanban-item.tsx"() {
3111
- }
3112
- });
3113
- var init_kanban_column = __esm({
3114
- "src/ui/data-display/kanban/kanban-column.tsx"() {
3115
- }
3116
- });
3117
- var init_kanban_board = __esm({
3118
- "src/ui/data-display/kanban/kanban-board.tsx"() {
3119
- }
3120
- });
3121
-
3122
- // src/ui/data-display/kanban/kanban-types.ts
3123
- var init_kanban_types = __esm({
3124
- "src/ui/data-display/kanban/kanban-types.ts"() {
3125
- }
3126
- });
3127
-
3128
- // src/ui/data-display/kanban/index.ts
3129
- var init_kanban = __esm({
3130
- "src/ui/data-display/kanban/index.ts"() {
3131
- init_kanban_board();
3132
- init_kanban_column();
3133
- init_kanban_item();
3134
- init_kanban_types();
3135
- }
3136
- });
3137
- var init_aspect_ratio = __esm({
3138
- "src/ui/data-display/aspect-ratio.tsx"() {
3139
- "use client";
3140
- }
3141
- });
3142
- var init_bento_grid = __esm({
3143
- "src/ui/data-display/bento-grid.tsx"() {
3144
- }
3145
- });
3146
- var init_highlight = __esm({
3147
- "src/ui/data-display/highlight.tsx"() {
3148
- }
3149
- });
3150
- var init_code_block_highlight = __esm({
3151
- "src/ui/data-display/code-block-highlight.tsx"() {
3152
- "use client";
3153
- }
3154
- });
3155
- var init_collapsible = __esm({
3156
- "src/ui/data-display/collapsible.tsx"() {
3157
- "use client";
3158
- }
3159
- });
3160
- var init_hover_card = __esm({
3161
- "src/ui/data-display/hover-card.tsx"() {
3162
- "use client";
3163
- }
3164
- });
3165
- var init_iphone_15_pro = __esm({
3166
- "src/ui/data-display/iphone-15-pro.tsx"() {
3167
- }
3168
- });
3169
- var init_media_grid = __esm({
3170
- "src/ui/data-display/media-grid.tsx"() {
3171
- "use client";
3172
- }
3173
- });
3174
- var init_safari = __esm({
3175
- "src/ui/data-display/safari.tsx"() {
3176
- }
3177
- });
3178
- var init_timeline = __esm({
3179
- "src/ui/data-display/timeline.tsx"() {
3180
- cva("grid", {
3181
- variants: {
3182
- align: {
3183
- left: "[&>li]:grid-cols-[0_min-content_1fr]",
3184
- right: "[&>li]:grid-cols-[1fr_min-content]",
3185
- center: "[&>li]:grid-cols-[1fr_min-content_1fr]"
3186
- }
3187
- },
3188
- defaultVariants: {
3189
- align: "left"
3190
- }
3191
- });
3192
- cva("grid items-center gap-x-2", {
3193
- variants: {
3194
- status: {
3195
- done: "text-foreground",
3196
- default: "text-muted-foreground"
3197
- }
3198
- },
3199
- defaultVariants: {
3200
- status: "default"
3201
- }
3202
- });
3203
- cva("row-start-2 row-end-2 pb-8", {
3204
- variants: {
3205
- side: {
3206
- start: "col-start-3 col-end-4 me-auto text-start",
3207
- end: "col-start-1 col-end-2 ms-auto text-end"
3208
- }
3209
- },
3210
- defaultVariants: {
3211
- side: "start"
3212
- }
3213
- });
3214
- cva(
3215
- "row-start-1 row-end-1 line-clamp-1 max-w-full truncate",
3216
- {
3217
- variants: {
3218
- side: {
3219
- start: "col-start-3 col-end-4 me-auto text-start",
3220
- end: "col-start-1 col-end-2 ms-auto text-end"
3221
- },
3222
- variant: {
3223
- primary: "text-base font-medium text-foreground",
3224
- secondary: "text-sm font-light text-muted-foreground"
3225
- }
3226
- },
3227
- defaultVariants: {
3228
- side: "start",
3229
- variant: "primary"
3230
- }
3231
- }
3232
- );
3233
- }
3234
- });
3235
-
3236
- // src/ui/data-display/data-table/index.ts
3237
- var init_data_table = __esm({
3238
- "src/ui/data-display/data-table/index.ts"() {
3239
- }
3240
- });
3241
-
3242
- // src/ui/data-display/index.tsx
3243
- var init_data_display = __esm({
3244
- "src/ui/data-display/index.tsx"() {
3245
- "use client";
3246
- init_formatted_number_input();
3247
- init_data_table_pagination();
3248
- init_avatar();
3249
- init_kpi_card();
3250
- init_compact_stat_bar();
3251
- init_show_more_text();
3252
- init_chart();
3253
- init_carousel();
3254
- init_accordion();
3255
- init_kanban();
3256
- init_aspect_ratio();
3257
- init_bento_grid();
3258
- init_code_block_highlight();
3259
- init_collapsible();
3260
- init_highlight();
3261
- init_hover_card();
3262
- init_iphone_15_pro();
3263
- init_media_grid();
3264
- init_safari();
3265
- init_timeline();
3266
- init_data_table();
3267
- }
3268
- });
3269
- var init_job_management = __esm({
3270
- "src/ui/management/job-management.tsx"() {
3271
- "use client";
3272
- }
3273
- });
3274
- var init_audit_log_page = __esm({
3275
- "src/ui/management/audit-log-page.tsx"() {
3276
- "use client";
3277
- }
3278
- });
3279
- var init_cache_management = __esm({
3280
- "src/ui/management/cache-management.tsx"() {
3281
- "use client";
3282
- }
3283
- });
3284
-
3285
- // src/ui/management/index.ts
3286
- var init_management = __esm({
3287
- "src/ui/management/index.ts"() {
3288
- init_job_management();
3289
- init_audit_log_page();
3290
- init_cache_management();
3291
- }
3292
- });
3293
- var init_not_found = __esm({
3294
- "src/ui/pages/not-found.tsx"() {
3295
- }
3296
- });
3297
-
3298
- // src/ui/index.tsx
3299
- var init_ui = __esm({
3300
- "src/ui/index.tsx"() {
3301
- init_primitives();
3302
- init_client();
3303
- init_forms();
3304
- init_data_display();
3305
- init_feedback();
3306
- init_layout();
3307
- init_auth();
3308
- init_management();
3309
- init_not_found();
3310
- }
3311
- });
3312
- var init_command_menu = __esm({
3313
- "src/ui/layout/command-menu.tsx"() {
3314
- "use client";
3315
- }
3316
- });
3317
- var init_logo = __esm({
3318
- "src/ui/layout/logo.tsx"() {
3319
- "use client";
3320
- }
3321
- });
3322
- var init_sidebar_group_icon_menu = __esm({
3323
- "src/ui/layout/sidebar-group-icon-menu.tsx"() {
3324
- "use client";
3325
- }
3326
- });
3327
- var init_sidebar2 = __esm({
3328
- "src/ui/layout/sidebar.tsx"() {
3329
- "use client";
3330
- }
3331
- });
3332
- function LanguageDropdown({
3333
- dictionary
3334
- }) {
3335
- const pathname = usePathname();
3336
- const params = useParams();
3337
- const { settings, updateSettings } = useSettings();
3338
- const locale = params.lang || "vi";
3339
- const direction = i18n2.localeDirection[locale] || "ltr";
3340
- const setLocale = useCallback(
3341
- (localeName) => {
3342
- updateSettings({ ...settings, locale: localeName });
3343
- },
3344
- [settings, updateSettings]
3345
- );
3346
- return /* @__PURE__ */ jsxs(DropdownMenu, { dir: direction, children: [
3347
- /* @__PURE__ */ jsxs(Tooltip, { children: [
3348
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", "aria-label": "Language", children: /* @__PURE__ */ jsx(Earth, { className: "size-4" }) }) }) }),
3349
- /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Language" }) })
3350
- ] }),
3351
- /* @__PURE__ */ jsxs(DropdownMenuContent, { children: [
3352
- /* @__PURE__ */ jsx(DropdownMenuLabel, { children: dictionary?.navigation?.language?.language || "Language" }),
3353
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
3354
- /* @__PURE__ */ jsx(DropdownMenuRadioGroup, { value: locale, children: i18n2.locales.map((l) => {
3355
- const localeName = i18n2.localeNames[l];
3356
- const localizedLocaleName = getDictionaryValue(
3357
- localeName,
3358
- dictionary?.navigation?.language || {}
3359
- );
3360
- return /* @__PURE__ */ jsx(
3361
- Link15,
3362
- {
3363
- href: relocalizePathname(pathname, l),
3364
- onClick: () => setLocale(l),
3365
- children: /* @__PURE__ */ jsx(DropdownMenuRadioItem, { value: l, children: localizedLocaleName })
3366
- },
3367
- l
3368
- );
3369
- }) })
3370
- ] })
3371
- ] });
3372
- }
3373
- var i18n2;
3374
- var init_language_dropdown = __esm({
3375
- "src/ui/layout/language-dropdown.tsx"() {
3376
- "use client";
3377
- init_hooks();
3378
- init_utils();
3379
- init_ui();
3380
- init_client();
3381
- i18n2 = {
3382
- locales: ["vi", "en"],
3383
- localeNames: {
3384
- vi: "Ti\u1EBFng Vi\u1EC7t",
3385
- en: "English"
3386
- },
3387
- localeDirection: {
3388
- vi: "ltr",
3389
- en: "ltr"
3390
- }
3391
- };
3392
- }
3393
- });
3394
- var init_footer = __esm({
3395
- "src/ui/layout/footer.tsx"() {
3396
- }
3397
- });
3398
- var init_header_breadcrumb = __esm({
3399
- "src/ui/layout/header-breadcrumb.tsx"() {
3400
- "use client";
3401
- }
3402
- });
3403
- var init_animated_list = __esm({
3404
- "src/ui/layout/animated-list.tsx"() {
3405
- }
3406
- });
3407
- var init_animated_sidebar = __esm({
3408
- "src/ui/layout/animated-sidebar.tsx"() {
3409
- "use client";
3410
- }
3411
- });
3412
- var init_customizer = __esm({
3413
- "src/ui/layout/customizer.tsx"() {
3414
- "use client";
3415
- }
3416
- });
3417
- function useTabContentCache() {
3418
- const context = useContext(TabContentCacheContext);
3419
- return context ?? noopTabContentCache;
3420
- }
3421
- var TabContentCacheContext, noopTabContentCache;
3422
- var init_tab_content_cache = __esm({
3423
- "src/ui/layout/tab-content-cache.tsx"() {
3424
- "use client";
3425
- TabContentCacheContext = createContext(void 0);
3426
- noopTabContentCache = {
3427
- getCachedContent: () => null,
3428
- setCachedContent: () => {
3429
- },
3430
- clearCache: () => {
3431
- },
3432
- clearAllCache: () => {
3433
- },
3434
- isCached: () => false
3435
- };
3436
- }
3437
- });
3438
- function useTabNavigation() {
3439
- const context = useContext(TabNavigationContext);
3440
- return context ?? noopTabNavigation;
3441
- }
3442
- var TabNavigationContext, noopTabNavigation;
3443
- var init_tab_navigation_provider = __esm({
3444
- "src/ui/layout/tab-navigation-provider.tsx"() {
3445
- "use client";
3446
- TabNavigationContext = createContext(void 0);
3447
- noopTabNavigation = {
3448
- tabs: [],
3449
- activeTabId: null,
3450
- addTab: () => {
3451
- },
3452
- removeTab: () => {
3453
- },
3454
- setActiveTab: () => {
3455
- },
3456
- clearTabs: () => {
3457
- },
3458
- removeOtherTabs: () => {
3459
- },
3460
- removeTabsToRight: () => {
3461
- },
3462
- goToNextTab: () => {
3463
- },
3464
- goToPreviousTab: () => {
3465
- },
3466
- goToTabByIndex: () => {
3467
- },
3468
- closeAndGoToParent: () => {
3469
- }
3470
- };
3471
- }
3472
- });
3473
- var init_user_dropdown = __esm({
3474
- "src/ui/layout/user-dropdown.tsx"() {
3475
- "use client";
3476
- }
3477
- });
3478
- var init_notification_dropdown = __esm({
3479
- "src/ui/layout/notification-dropdown.tsx"() {
3480
- "use client";
3481
- }
3482
- });
3483
- var init_mode_dropdown = __esm({
3484
- "src/ui/layout/mode-dropdown.tsx"() {
3485
- "use client";
3486
- }
3487
- });
3488
- var init_full_screen_toggle = __esm({
3489
- "src/ui/layout/full-screen-toggle.tsx"() {
3490
- "use client";
3491
- }
3492
- });
3493
- var init_route_cache = __esm({
3494
- "src/ui/layout/route-cache.tsx"() {
3495
- "use client";
3496
- createContext(
3497
- void 0
3498
- );
3499
- }
3500
- });
3501
- var init_page_tabs = __esm({
3502
- "src/ui/layout/page-tabs.tsx"() {
3503
- "use client";
3504
- }
3505
- });
3506
- var init_toggle_mobile_sidebar = __esm({
3507
- "src/ui/layout/toggle-mobile-sidebar.tsx"() {
3508
- "use client";
3509
- }
3510
- });
3511
- var init_top_bar_header_menubar = __esm({
3512
- "src/ui/layout/top-bar-header-menubar.tsx"() {
3513
- "use client";
3514
- }
3515
- });
3516
- var init_vertical_layout_header = __esm({
3517
- "src/ui/layout/vertical-layout-header.tsx"() {
3518
- "use client";
3519
- }
3520
- });
3521
- var init_horizontal_layout_header = __esm({
3522
- "src/ui/layout/horizontal-layout-header.tsx"() {
3523
- "use client";
3524
- }
3525
- });
3526
- var init_vertical_layout = __esm({
3527
- "src/ui/layout/vertical-layout.tsx"() {
3528
- "use client";
3529
- }
3530
- });
3531
- var init_horizontal_layout = __esm({
3532
- "src/ui/layout/horizontal-layout.tsx"() {
3533
- "use client";
3534
- }
3535
- });
3536
- var init_main_layout = __esm({
3537
- "src/ui/layout/main-layout.tsx"() {
3538
- "use client";
3539
- }
3540
- });
3541
-
3542
- // src/ui/layout/index.tsx
3543
- var init_layout = __esm({
3544
- "src/ui/layout/index.tsx"() {
3545
- init_sidebar2();
3546
- init_language_dropdown();
3547
- init_footer();
3548
- init_logo();
3549
- init_header_breadcrumb();
3550
- init_animated_list();
3551
- init_animated_sidebar();
3552
- init_command_menu();
3553
- init_sidebar_group_icon_menu();
3554
- init_customizer();
3555
- init_user_dropdown();
3556
- init_notification_dropdown();
3557
- init_mode_dropdown();
3558
- init_full_screen_toggle();
3559
- init_page_tabs();
3560
- init_tab_navigation_provider();
3561
- init_route_cache();
3562
- init_toggle_mobile_sidebar();
3563
- init_top_bar_header_menubar();
3564
- init_vertical_layout_header();
3565
- init_horizontal_layout_header();
3566
- init_vertical_layout();
3567
- init_horizontal_layout();
3568
- init_main_layout();
3569
- init_tab_content_cache();
3570
- }
3571
- });
3572
- function Auth({
3573
- className,
3574
- children,
3575
- imgSrc,
3576
- imgClassName,
3577
- imageClassName,
3578
- dictionary,
3579
- ...props
3580
- }) {
3581
- const params = useParams();
3582
- const locale = params.lang || "vi";
3583
- return /* @__PURE__ */ jsxs(
3584
- "section",
3585
- {
3586
- className: cn(
3587
- "min-h-screen w-full grid grid-cols-1 md:grid-cols-2",
3588
- className
3589
- ),
3590
- ...props,
3591
- children: [
3592
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col relative bg-background", children: [
3593
- /* @__PURE__ */ jsxs("div", { className: "absolute top-0 inset-x-0 flex justify-between items-center px-4 py-2.5 z-50", children: [
3594
- /* @__PURE__ */ jsxs(
3595
- Link15,
3596
- {
3597
- href: ensureLocalizedPathname("/", locale),
3598
- className: "flex items-center gap-2 text-foreground font-black",
3599
- children: [
3600
- /* @__PURE__ */ jsx(
3601
- Image8,
3602
- {
3603
- src: "/images/icons/shadboard.svg",
3604
- alt: "Logo",
3605
- height: 24,
3606
- width: 24,
3607
- className: "dark:invert"
3608
- }
3609
- ),
3610
- /* @__PURE__ */ jsx("span", { children: "GoERP" })
3611
- ]
3612
- }
3613
- ),
3614
- /* @__PURE__ */ jsx(LanguageDropdown, { dictionary })
3615
- ] }),
3616
- /* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center justify-center p-6", children: /* @__PURE__ */ jsx("div", { className: "max-w-md w-full space-y-6", children }) })
3617
- ] }),
3618
- imgSrc && /* @__PURE__ */ jsx(
3619
- AuthImage,
3620
- {
3621
- imgSrc,
3622
- className: cn("", imgClassName),
3623
- imageClassName
3624
- }
3625
- )
3626
- ]
3627
- }
3628
- );
3629
- }
3630
- function AuthImage({
3631
- className,
3632
- imageClassName,
3633
- imgSrc,
3634
- ...props
3635
- }) {
3636
- return /* @__PURE__ */ jsx(
3637
- "div",
3638
- {
3639
- className: cn(
3640
- "relative hidden h-full min-h-screen bg-muted md:block",
3641
- className
3642
- ),
3643
- ...props,
3644
- children: /* @__PURE__ */ jsx(
3645
- Image8,
3646
- {
3647
- src: imgSrc,
3648
- alt: "Authentication Image",
3649
- fill: true,
3650
- sizes: "(max-width: 768px) 100vw, 50vw",
3651
- priority: true,
3652
- className: cn("object-cover", imageClassName)
3653
- }
3654
- )
3655
- }
3656
- );
3657
- }
3658
- function AuthHeader({ className, ...props }) {
3659
- return /* @__PURE__ */ jsx("div", { className: cn("space-y-2 text-center", className), ...props });
3660
- }
3661
- function AuthTitle({ className, ...props }) {
3662
- return /* @__PURE__ */ jsx(
3663
- "h1",
3664
- {
3665
- className: cn(
3666
- "text-2xl font-semibold leading-none tracking-tight",
3667
- className
3668
- ),
3669
- ...props
3670
- }
3671
- );
3672
- }
3673
- function AuthDescription({ className, ...props }) {
3674
- return /* @__PURE__ */ jsx("p", { className: cn("text-sm text-muted-foreground", className), ...props });
3675
- }
3676
- function AuthForm({ className, ...props }) {
3677
- return /* @__PURE__ */ jsx("div", { className, ...props });
3678
- }
3679
- function AuthFooter({ className, ...props }) {
3680
- return /* @__PURE__ */ jsx("div", { className: cn("grid gap-6", className), ...props });
3681
- }
3682
- var init_auth_layout = __esm({
3683
- "src/ui/auth/auth-layout.tsx"() {
3684
- "use client";
3685
- init_utils();
3686
- init_layout();
3687
- }
3688
- });
3689
- var supplierBaseSchema;
3690
- var init_supplier_schema = __esm({
3691
- "src/schemas/supplier.schema.ts"() {
3692
- init_configs();
3693
- supplierBaseSchema = z.object({
3694
- code: z.string().min(1, "M\xE3 nh\xE0 cung c\u1EA5p l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 nh\xE0 cung c\u1EA5p t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
3695
- name: z.string().min(1, "T\xEAn nh\xE0 cung c\u1EA5p l\xE0 b\u1EAFt bu\u1ED9c").max(200, "T\xEAn nh\xE0 cung c\u1EA5p t\u1ED1i \u0111a 200 k\xFD t\u1EF1").trim(),
3696
- taxCode: z.string().min(1, "M\xE3 s\u1ED1 thu\u1EBF l\xE0 b\u1EAFt bu\u1ED9c").regex(/^[0-9]{10,13}$/, "M\xE3 s\u1ED1 thu\u1EBF ph\u1EA3i l\xE0 10-13 ch\u1EEF s\u1ED1"),
3697
- email: z.string().email("Email kh\xF4ng h\u1EE3p l\u1EC7").optional().or(z.literal("")),
3698
- phone: z.string().regex(/^[0-9]{10}$/, "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i ph\u1EA3i l\xE0 10 ch\u1EEF s\u1ED1").optional().or(z.literal("")),
3699
- address: z.string().max(500, "\u0110\u1ECBa ch\u1EC9 t\u1ED1i \u0111a 500 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3700
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3701
- status: z.preprocess((val) => {
3702
- if (typeof val === "boolean") {
3703
- return booleanToStatus(val);
3704
- }
3705
- if (val === "Active" || val === "Inactive") {
3706
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
3707
- }
3708
- return val;
3709
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE)),
3710
- contractStartDate: z.string().optional().transform((val) => val ? new Date(val) : null).or(z.date().optional()).nullable(),
3711
- contractEndDate: z.string().optional().transform((val) => val ? new Date(val) : null).or(z.date().optional()).nullable()
3712
- });
3713
- supplierBaseSchema.refine(
3714
- (data) => {
3715
- if (data.contractStartDate && data.contractEndDate) {
3716
- return data.contractEndDate >= data.contractStartDate;
3717
- }
3718
- return true;
3719
- },
3720
- {
3721
- message: "Ng\xE0y k\u1EBFt th\xFAc h\u1EE3p \u0111\u1ED3ng ph\u1EA3i sau ng\xE0y b\u1EAFt \u0111\u1EA7u",
3722
- path: ["contractEndDate"]
3723
- }
3724
- );
3725
- supplierBaseSchema.partial();
3726
- z.object({
3727
- ids: z.array(z.string()).min(1, "Ph\u1EA3i ch\u1ECDn \xEDt nh\u1EA5t 1 nh\xE0 cung c\u1EA5p"),
3728
- action: z.enum(["delete", "activate", "deactivate"])
3729
- });
3730
- }
3731
- });
3732
- var materialSchema;
3733
- var init_material_schema = __esm({
3734
- "src/schemas/material.schema.ts"() {
3735
- init_configs();
3736
- materialSchema = z.object({
3737
- code: z.string().min(1, "M\xE3 nguy\xEAn v\u1EADt li\u1EC7u l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 nguy\xEAn v\u1EADt li\u1EC7u t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
3738
- item_name: z.string().min(1, "T\xEAn nguy\xEAn v\u1EADt li\u1EC7u l\xE0 b\u1EAFt bu\u1ED9c").max(200, "T\xEAn nguy\xEAn v\u1EADt li\u1EC7u t\u1ED1i \u0111a 200 k\xFD t\u1EF1").trim(),
3739
- stock_uom: z.string().min(1, "\u0110\u01A1n v\u1ECB t\xEDnh l\xE0 b\u1EAFt bu\u1ED9c").max(20, "\u0110\u01A1n v\u1ECB t\xEDnh t\u1ED1i \u0111a 20 k\xFD t\u1EF1"),
3740
- item_group: z.string().min(1, "Danh m\u1EE5c l\xE0 b\u1EAFt bu\u1ED9c").max(50, "Danh m\u1EE5c t\u1ED1i \u0111a 50 k\xFD t\u1EF1"),
3741
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3742
- status: z.preprocess((val) => {
3743
- if (typeof val === "boolean") {
3744
- return val ? STATUS_ACTIVE : STATUS_INACTIVE;
3745
- }
3746
- if (val === "Active" || val === "Inactive") {
3747
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
3748
- }
3749
- return val;
3750
- }, z.enum(STATUS_VALUES).optional())
3751
- });
3752
- materialSchema.partial();
3753
- z.object({
3754
- ids: z.array(z.string()).min(1, "Ph\u1EA3i ch\u1ECDn \xEDt nh\u1EA5t 1 nguy\xEAn v\u1EADt li\u1EC7u"),
3755
- action: z.enum(["delete", "activate", "deactivate"])
3756
- });
3757
- }
3758
- });
3759
- var materialCategorySchema;
3760
- var init_material_category_schema = __esm({
3761
- "src/schemas/material-category.schema.ts"() {
3762
- init_configs();
3763
- materialCategorySchema = z.object({
3764
- code: z.string().min(1, "M\xE3 danh m\u1EE5c l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 danh m\u1EE5c t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
3765
- name: z.string().min(1, "T\xEAn danh m\u1EE5c l\xE0 b\u1EAFt bu\u1ED9c").max(200, "T\xEAn danh m\u1EE5c t\u1ED1i \u0111a 200 k\xFD t\u1EF1").trim(),
3766
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3767
- status: z.preprocess((val) => {
3768
- if (typeof val === "boolean") {
3769
- return val ? STATUS_ACTIVE : STATUS_INACTIVE;
3770
- }
3771
- if (val === "Active" || val === "Inactive") {
3772
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
3773
- }
3774
- return val;
3775
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE))
3776
- });
3777
- materialCategorySchema.partial();
3778
- }
3779
- });
3780
- var uomBaseSchema;
3781
- var init_uom_schema = __esm({
3782
- "src/schemas/uom.schema.ts"() {
3783
- init_configs();
3784
- uomBaseSchema = z.object({
3785
- code: z.string().min(1, "M\xE3 \u0111\u01A1n v\u1ECB t\xEDnh l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 \u0111\u01A1n v\u1ECB t\xEDnh t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
3786
- name: z.string().min(1, "T\xEAn \u0111\u01A1n v\u1ECB t\xEDnh l\xE0 b\u1EAFt bu\u1ED9c").max(100, "T\xEAn \u0111\u01A1n v\u1ECB t\xEDnh t\u1ED1i \u0111a 100 k\xFD t\u1EF1").trim(),
3787
- description: z.string().max(500, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 500 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3788
- status: z.preprocess((val) => {
3789
- if (typeof val === "boolean") {
3790
- return val ? STATUS_ACTIVE : STATUS_INACTIVE;
3791
- }
3792
- if (val === "Active" || val === "Inactive") {
3793
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
3794
- }
3795
- return val;
3796
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE)),
3797
- baseUomCode: z.preprocess((val) => {
3798
- if (val === "" || val === null || val === void 0) {
3799
- return null;
3800
- }
3801
- return val;
3802
- }, z.string().max(20, "M\xE3 \u0111\u01A1n v\u1ECB quy \u0111\u1ED5i t\u1ED1i \u0111a 20 k\xFD t\u1EF1").nullable().optional()),
3803
- conversionRate: z.preprocess(
3804
- (val) => {
3805
- if (val === "" || val === null || val === void 0) {
3806
- return null;
3807
- }
3808
- if (typeof val === "string") {
3809
- const parsed = parseFloat(val);
3810
- return isNaN(parsed) ? null : parsed;
3811
- }
3812
- return val;
3813
- },
3814
- z.union([z.number().positive("T\u1EF7 l\u1EC7 quy \u0111\u1ED5i ph\u1EA3i l\u1EDBn h\u01A1n 0"), z.null()]).optional()
3815
- )
3816
- });
3817
- uomBaseSchema.partial();
3818
- }
3819
- });
3820
- var warehouseSchema;
3821
- var init_warehouse_schema = __esm({
3822
- "src/schemas/warehouse.schema.ts"() {
3823
- init_configs();
3824
- warehouseSchema = z.object({
3825
- code: z.string().min(1, "M\xE3 kho l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 kho t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
3826
- name: z.string().min(1, "T\xEAn kho l\xE0 b\u1EAFt bu\u1ED9c").max(200, "T\xEAn kho t\u1ED1i \u0111a 200 k\xFD t\u1EF1").trim(),
3827
- address: z.string().min(1, "\u0110\u1ECBa ch\u1EC9 l\xE0 b\u1EAFt bu\u1ED9c").max(500, "\u0110\u1ECBa ch\u1EC9 t\u1ED1i \u0111a 500 k\xFD t\u1EF1").trim(),
3828
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3829
- status: z.preprocess((val) => {
3830
- if (typeof val === "boolean") {
3831
- return val ? STATUS_ACTIVE : STATUS_INACTIVE;
3832
- }
3833
- if (val === "Active" || val === "Inactive") {
3834
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
3835
- }
3836
- return val;
3837
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE))
3838
- });
3839
- warehouseSchema.partial();
3840
- }
3841
- });
3842
- var dateStringSchema, partnerCompanyBaseSchema;
3843
- var init_partner_company_schema = __esm({
3844
- "src/schemas/partner-company.schema.ts"() {
3845
- init_configs();
3846
- dateStringSchema = (fieldLabel) => z.string().min(1, `${fieldLabel} l\xE0 b\u1EAFt bu\u1ED9c`).refine(
3847
- (value) => {
3848
- const date = new Date(value);
3849
- return !Number.isNaN(date.getTime());
3850
- },
3851
- {
3852
- message: `${fieldLabel} kh\xF4ng h\u1EE3p l\u1EC7`
3853
- }
3854
- );
3855
- partnerCompanyBaseSchema = z.object({
3856
- code: z.string().min(1, "M\xE3 c\xF4ng ty \u0111\u1ED1i t\xE1c l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 c\xF4ng ty \u0111\u1ED1i t\xE1c t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
3857
- name: z.string().min(1, "T\xEAn c\xF4ng ty l\xE0 b\u1EAFt bu\u1ED9c").max(200, "T\xEAn c\xF4ng ty t\u1ED1i \u0111a 200 k\xFD t\u1EF1").trim(),
3858
- taxCode: z.string().min(1, "M\xE3 s\u1ED1 thu\u1EBF l\xE0 b\u1EAFt bu\u1ED9c").regex(/^[0-9]{10,13}$/, "M\xE3 s\u1ED1 thu\u1EBF ph\u1EA3i l\xE0 10-13 ch\u1EEF s\u1ED1"),
3859
- email: z.string().email("Email kh\xF4ng h\u1EE3p l\u1EC7").optional().or(z.literal("")).transform((val) => val || ""),
3860
- phone: z.string().regex(/^[0-9]{10}$/, "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i ph\u1EA3i l\xE0 10 ch\u1EEF s\u1ED1").optional().or(z.literal("")).transform((val) => val || ""),
3861
- address: z.string().max(500, "\u0110\u1ECBa ch\u1EC9 t\u1ED1i \u0111a 500 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3862
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3863
- warehouseIds: z.preprocess((val) => {
3864
- if (Array.isArray(val)) {
3865
- return val;
3866
- }
3867
- if (!val || val === "") {
3868
- return [];
3869
- }
3870
- if (typeof val === "string") {
3871
- try {
3872
- const parsed = JSON.parse(val);
3873
- return Array.isArray(parsed) ? parsed : [];
3874
- } catch {
3875
- return val.split(",").map((v) => v.trim()).filter(Boolean);
3876
- }
3877
- }
3878
- return [];
3879
- }, z.array(z.string()).optional().default([])),
3880
- status: z.preprocess((val) => {
3881
- if (typeof val === "boolean") {
3882
- return booleanToStatus(val);
3883
- }
3884
- if (val === "Active" || val === "Inactive") {
3885
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
3886
- }
3887
- return val;
3888
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE)),
3889
- contractStartDate: dateStringSchema("Ng\xE0y b\u1EAFt \u0111\u1EA7u h\u1EE3p \u0111\u1ED3ng"),
3890
- contractEndDate: dateStringSchema("Ng\xE0y k\u1EBFt th\xFAc h\u1EE3p \u0111\u1ED3ng")
3891
- });
3892
- partnerCompanyBaseSchema.refine(
3893
- ({ contractStartDate, contractEndDate }) => {
3894
- const start = new Date(contractStartDate);
3895
- const end = new Date(contractEndDate);
3896
- return end.getTime() >= start.getTime();
3897
- },
3898
- {
3899
- message: "Ng\xE0y k\u1EBFt th\xFAc h\u1EE3p \u0111\u1ED3ng ph\u1EA3i sau ho\u1EB7c b\u1EB1ng ng\xE0y b\u1EAFt \u0111\u1EA7u",
3900
- path: ["contractEndDate"]
3901
- }
3902
- );
3903
- partnerCompanyBaseSchema.partial().refine(
3904
- (data) => {
3905
- if (!data.contractStartDate || !data.contractEndDate) {
3906
- return true;
3907
- }
3908
- const start = new Date(data.contractStartDate);
3909
- const end = new Date(data.contractEndDate);
3910
- return end.getTime() >= start.getTime();
3911
- },
3912
- {
3913
- message: "Ng\xE0y k\u1EBFt th\xFAc h\u1EE3p \u0111\u1ED3ng ph\u1EA3i sau ho\u1EB7c b\u1EB1ng ng\xE0y b\u1EAFt \u0111\u1EA7u",
3914
- path: ["contractEndDate"]
3915
- }
3916
- );
3917
- }
3918
- });
3919
- var systemCategoryGroupSchema;
3920
- var init_system_category_group_schema = __esm({
3921
- "src/schemas/system-category-group.schema.ts"() {
3922
- init_configs();
3923
- systemCategoryGroupSchema = z.object({
3924
- code: z.string().min(1, "M\xE3 nh\xF3m danh m\u1EE5c l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 nh\xF3m danh m\u1EE5c t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
3925
- name: z.string().min(1, "T\xEAn nh\xF3m danh m\u1EE5c l\xE0 b\u1EAFt bu\u1ED9c").max(200, "T\xEAn nh\xF3m danh m\u1EE5c t\u1ED1i \u0111a 200 k\xFD t\u1EF1").trim(),
3926
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3927
- status: z.preprocess((val) => {
3928
- if (typeof val === "boolean") {
3929
- return val ? STATUS_ACTIVE : STATUS_INACTIVE;
3930
- }
3931
- if (val === "Active" || val === "Inactive") {
3932
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
3933
- }
3934
- return val;
3935
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE))
3936
- });
3937
- systemCategoryGroupSchema.partial();
3938
- z.object({
3939
- ids: z.array(z.string()).min(1, "Ph\u1EA3i ch\u1ECDn \xEDt nh\u1EA5t 1 nh\xF3m danh m\u1EE5c"),
3940
- action: z.enum(["delete", "activate", "deactivate"])
3941
- });
3942
- }
3943
- });
3944
- var systemCategorySchema;
3945
- var init_system_category_schema = __esm({
3946
- "src/schemas/system-category.schema.ts"() {
3947
- init_configs();
3948
- systemCategorySchema = z.object({
3949
- code: z.string().min(1, "M\xE3 danh m\u1EE5c l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 danh m\u1EE5c t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
3950
- name: z.string().min(1, "T\xEAn danh m\u1EE5c l\xE0 b\u1EAFt bu\u1ED9c").max(200, "T\xEAn danh m\u1EE5c t\u1ED1i \u0111a 200 k\xFD t\u1EF1").trim(),
3951
- groupCode: z.string().min(1, "M\xE3 nh\xF3m danh m\u1EE5c l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 nh\xF3m danh m\u1EE5c t\u1ED1i \u0111a 50 k\xFD t\u1EF1"),
3952
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3953
- status: z.preprocess((val) => {
3954
- if (typeof val === "boolean") {
3955
- return val ? STATUS_ACTIVE : STATUS_INACTIVE;
3956
- }
3957
- if (val === "Active" || val === "Inactive") {
3958
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
3959
- }
3960
- return val;
3961
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE)),
3962
- order: z.number().int("Th\u1EE9 t\u1EF1 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn").min(0, "Th\u1EE9 t\u1EF1 ph\u1EA3i >= 0").optional()
3963
- });
3964
- systemCategorySchema.partial();
3965
- z.object({
3966
- ids: z.array(z.string()).min(1, "Ph\u1EA3i ch\u1ECDn \xEDt nh\u1EA5t 1 danh m\u1EE5c"),
3967
- action: z.enum(["delete", "activate", "deactivate"])
3968
- });
3969
- }
3970
- });
3971
- var actionSchema;
3972
- var init_action_schema = __esm({
3973
- "src/schemas/action.schema.ts"() {
3974
- init_configs();
3975
- actionSchema = z.object({
3976
- code: z.string().min(1, "M\xE3 h\xE0nh \u0111\u1ED9ng l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 h\xE0nh \u0111\u1ED9ng t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
3977
- name: z.string().min(1, "T\xEAn h\xE0nh \u0111\u1ED9ng l\xE0 b\u1EAFt bu\u1ED9c").max(200, "T\xEAn h\xE0nh \u0111\u1ED9ng t\u1ED1i \u0111a 200 k\xFD t\u1EF1").trim(),
3978
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || ""),
3979
- isDefault: z.boolean().default(false),
3980
- status: z.preprocess((val) => {
3981
- if (typeof val === "boolean") {
3982
- return val ? STATUS_ACTIVE : STATUS_INACTIVE;
3983
- }
3984
- if (val === "Active" || val === "Inactive") {
3985
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
3986
- }
3987
- return val;
3988
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE))
3989
- });
3990
- actionSchema.partial();
3991
- z.object({
3992
- ids: z.array(z.string()).min(1, "Ph\u1EA3i ch\u1ECDn \xEDt nh\u1EA5t 1 h\xE0nh \u0111\u1ED9ng"),
3993
- action: z.enum(["delete", "activate", "deactivate"])
3994
- });
3995
- }
3996
- });
3997
- var resourceSchema;
3998
- var init_resource_schema = __esm({
3999
- "src/schemas/resource.schema.ts"() {
4000
- init_configs();
4001
- resourceSchema = z.object({
4002
- code: z.string().min(1, "M\xE3 t\xE0i nguy\xEAn l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 t\xE0i nguy\xEAn t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
4003
- name: z.string().min(1, "T\xEAn t\xE0i nguy\xEAn l\xE0 b\u1EAFt bu\u1ED9c").max(200, "T\xEAn t\xE0i nguy\xEAn t\u1ED1i \u0111a 200 k\xFD t\u1EF1").trim(),
4004
- group: z.string().max(100, "Nh\xF3m t\u1ED1i \u0111a 100 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || void 0),
4005
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || void 0),
4006
- status: z.preprocess((val) => {
4007
- if (typeof val === "boolean") {
4008
- return booleanToStatus(val);
4009
- }
4010
- if (val === STATUS_ACTIVE || val === STATUS_INACTIVE || val === "Active" || val === "Inactive") {
4011
- return val === "Active" ? STATUS_ACTIVE : val === "Inactive" ? STATUS_INACTIVE : val;
4012
- }
4013
- return STATUS_ACTIVE;
4014
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE)),
4015
- parentCode: z.string().max(50, "M\xE3 cha t\u1ED1i \u0111a 50 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || void 0),
4016
- order: z.number().int("Th\u1EE9 t\u1EF1 ph\u1EA3i l\xE0 s\u1ED1 nguy\xEAn").min(0, "Th\u1EE9 t\u1EF1 ph\u1EA3i >= 0").optional(),
4017
- type: z.string().max(50, "Lo\u1EA1i t\u1ED1i \u0111a 50 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || void 0),
4018
- icon: z.string().max(100, "Icon t\u1ED1i \u0111a 100 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || void 0),
4019
- path: z.string().max(500, "\u0110\u01B0\u1EDDng d\u1EABn t\u1ED1i \u0111a 500 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || void 0),
4020
- config: z.string().optional().or(z.literal("")).transform((val) => val || void 0)
4021
- });
4022
- resourceSchema.partial();
4023
- z.object({
4024
- ids: z.array(z.string()).min(1, "Ph\u1EA3i ch\u1ECDn \xEDt nh\u1EA5t 1 t\xE0i nguy\xEAn"),
4025
- action: z.enum(["delete", "activate", "deactivate"])
4026
- });
4027
- }
4028
- });
4029
- var materialPricingSchema;
4030
- var init_material_pricing_schema = __esm({
4031
- "src/schemas/material-pricing.schema.ts"() {
4032
- materialPricingSchema = z.object({
4033
- supplierId: z.string().min(1, "Nh\xE0 cung c\u1EA5p l\xE0 b\u1EAFt bu\u1ED9c"),
4034
- materialId: z.string().min(1, "Nguy\xEAn v\u1EADt li\u1EC7u l\xE0 b\u1EAFt bu\u1ED9c"),
4035
- price: z.number().positive("Gi\xE1 ph\u1EA3i l\u1EDBn h\u01A1n 0").min(0.01, "Gi\xE1 t\u1ED1i thi\u1EC3u l\xE0 0.01"),
4036
- effectiveDate: z.string().min(1, "Ng\xE0y hi\u1EC7u l\u1EF1c l\xE0 b\u1EAFt bu\u1ED9c").refine((val) => {
4037
- const date = new Date(val);
4038
- return !isNaN(date.getTime());
4039
- }, "Ng\xE0y hi\u1EC7u l\u1EF1c kh\xF4ng h\u1EE3p l\u1EC7"),
4040
- applicableWarehouseIds: z.array(z.string()).optional().default([]),
4041
- status: z.enum(["pending", "approved", "rejected"]).optional().default("pending")
4042
- });
4043
- materialPricingSchema.partial();
4044
- z.object({
4045
- materialId: z.string().min(1, "Nguy\xEAn v\u1EADt li\u1EC7u l\xE0 b\u1EAFt bu\u1ED9c"),
4046
- supplierId: z.string().min(1, "Nh\xE0 cung c\u1EA5p l\xE0 b\u1EAFt bu\u1ED9c")
4047
- });
4048
- z.object({
4049
- id: z.string().min(1, "ID l\xE0 b\u1EAFt bu\u1ED9c"),
4050
- action: z.enum(["approve", "reject"]),
4051
- notes: z.string().optional(),
4052
- effectiveDate: z.string().optional().refine((val) => {
4053
- if (!val) return true;
4054
- const date = new Date(val);
4055
- return !isNaN(date.getTime());
4056
- }, "Ng\xE0y hi\u1EC7u l\u1EF1c kh\xF4ng h\u1EE3p l\u1EC7")
4057
- });
4058
- }
4059
- });
4060
- var init_user_schema = __esm({
4061
- "src/schemas/user.schema.ts"() {
4062
- z.object({
4063
- name: z.string().min(1, "T\xEAn hi\u1EC3n th\u1ECB l\xE0 b\u1EAFt bu\u1ED9c"),
4064
- email: z.string().email("Email kh\xF4ng h\u1EE3p l\u1EC7"),
4065
- // Support both boolean and status string, normalize to boolean
4066
- isActive: z.preprocess((val) => {
4067
- if (typeof val === "boolean") return val;
4068
- if (val === "active") return true;
4069
- if (val === "inactive") return false;
4070
- return true;
4071
- }, z.boolean().default(true)),
4072
- // Also accept status string from form
4073
- status: z.enum(["active", "inactive"]).optional(),
4074
- image: z.string().optional().nullable()
4075
- });
4076
- }
4077
- });
4078
- var init_role_schema = __esm({
4079
- "src/schemas/role.schema.ts"() {
4080
- z.object({
4081
- name: z.string().min(1, "Name is required"),
4082
- code: z.string().min(1, "Code is required"),
4083
- description: z.string().optional(),
4084
- status: z.enum(["active", "inactive"]).default("active"),
4085
- permissions: z.array(z.string()).optional()
4086
- });
4087
- }
4088
- });
4089
- var cuidRegex, uuidRegex, cuidOrUuid, userSupplierBaseSchema;
4090
- var init_user_supplier_schema = __esm({
4091
- "src/schemas/user-supplier.schema.ts"() {
4092
- init_configs();
4093
- cuidRegex = /^c[a-z0-9]{20,30}$/;
4094
- uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
4095
- cuidOrUuid = z.string().refine((val) => cuidRegex.test(val) || uuidRegex.test(val), {
4096
- message: "ID kh\xF4ng h\u1EE3p l\u1EC7 (ph\u1EA3i l\xE0 UUID, t\u1EA1m th\u1EDDi ch\u1EA5p nh\u1EADn CUID cho d\u1EEF li\u1EC7u c\u0169)"
4097
- });
4098
- userSupplierBaseSchema = z.object({
4099
- userId: z.preprocess(
4100
- (val) => {
4101
- if (val === null || val === void 0 || val === "") {
4102
- return void 0;
4103
- }
4104
- return String(val).trim();
4105
- },
4106
- z.string({
4107
- required_error: "Ng\u01B0\u1EDDi d\xF9ng l\xE0 b\u1EAFt bu\u1ED9c"
4108
- }).min(1, "Ng\u01B0\u1EDDi d\xF9ng l\xE0 b\u1EAFt bu\u1ED9c").pipe(cuidOrUuid)
4109
- ),
4110
- supplierId: z.preprocess(
4111
- (val) => {
4112
- if (val === null || val === void 0 || val === "") {
4113
- return void 0;
4114
- }
4115
- return String(val).trim();
4116
- },
4117
- z.string({
4118
- required_error: "Nh\xE0 cung c\u1EA5p l\xE0 b\u1EAFt bu\u1ED9c"
4119
- }).min(1, "Nh\xE0 cung c\u1EA5p l\xE0 b\u1EAFt bu\u1ED9c").pipe(cuidOrUuid)
4120
- ),
4121
- status: z.preprocess((val) => {
4122
- if (typeof val === "boolean") {
4123
- return booleanToStatus(val);
4124
- }
4125
- if (val === "Active" || val === "Inactive") {
4126
- return val === "Active" ? STATUS_ACTIVE : STATUS_INACTIVE;
4127
- }
4128
- return val;
4129
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE)),
4130
- startDate: z.string().optional().transform((val) => {
4131
- if (!val) return /* @__PURE__ */ new Date();
4132
- const date = new Date(val);
4133
- if (isNaN(date.getTime())) {
4134
- throw new Error("Ng\xE0y b\u1EAFt \u0111\u1EA7u kh\xF4ng h\u1EE3p l\u1EC7");
4135
- }
4136
- return date;
4137
- }).or(z.date().default(() => /* @__PURE__ */ new Date())),
4138
- endDate: z.string().optional().transform((val) => {
4139
- if (!val) return void 0;
4140
- const date = new Date(val);
4141
- if (isNaN(date.getTime())) {
4142
- throw new Error("Ng\xE0y k\u1EBFt th\xFAc kh\xF4ng h\u1EE3p l\u1EC7");
4143
- }
4144
- return date;
4145
- }).or(z.date().optional()).nullable(),
4146
- role: z.string().max(100, "Vai tr\xF2 t\u1ED1i \u0111a 100 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || void 0)
4147
- });
4148
- userSupplierBaseSchema.refine(
4149
- (data) => {
4150
- if (data.endDate && data.startDate) {
4151
- return data.endDate >= data.startDate;
4152
- }
4153
- return true;
4154
- },
4155
- {
4156
- message: "Ng\xE0y k\u1EBFt th\xFAc ph\u1EA3i sau ng\xE0y b\u1EAFt \u0111\u1EA7u",
4157
- path: ["endDate"]
4158
- }
4159
- );
4160
- userSupplierBaseSchema.partial().refine(
4161
- (data) => {
4162
- if (data.endDate && data.startDate) {
4163
- return data.endDate >= data.startDate;
4164
- }
4165
- return true;
4166
- },
4167
- {
4168
- message: "Ng\xE0y k\u1EBFt th\xFAc ph\u1EA3i sau ng\xE0y b\u1EAFt \u0111\u1EA7u",
4169
- path: ["endDate"]
4170
- }
4171
- );
4172
- z.object({
4173
- ids: z.array(z.string()).min(1, "Ph\u1EA3i ch\u1ECDn \xEDt nh\u1EA5t 1 b\u1EA3n ghi"),
4174
- action: z.enum(["delete", "activate", "deactivate"])
4175
- });
4176
- }
4177
- });
4178
- var systemConfigSchema;
4179
- var init_system_config_schema = __esm({
4180
- "src/schemas/system-config.schema.ts"() {
4181
- init_configs();
4182
- systemConfigSchema = z.object({
4183
- key: z.string().min(1, "Key l\xE0 b\u1EAFt bu\u1ED9c").max(100, "Key t\u1ED1i \u0111a 100 k\xFD t\u1EF1").trim().regex(
4184
- /^[a-zA-Z0-9._-]+$/,
4185
- "Key ch\u1EC9 \u0111\u01B0\u1EE3c ch\u1EE9a ch\u1EEF c\xE1i, s\u1ED1, d\u1EA5u ch\u1EA5m, g\u1EA1ch d\u01B0\u1EDBi v\xE0 g\u1EA1ch ngang"
4186
- ),
4187
- value: z.string().min(1, "Value l\xE0 b\u1EAFt bu\u1ED9c").max(5e3, "Value t\u1ED1i \u0111a 5000 k\xFD t\u1EF1").trim(),
4188
- type: z.string().max(50, "Type t\u1ED1i \u0111a 50 k\xFD t\u1EF1").default("string").optional().or(z.literal("")).transform((val) => val || "string"),
4189
- category: z.string().max(100, "Category t\u1ED1i \u0111a 100 k\xFD t\u1EF1").default("general").optional().or(z.literal("")).transform((val) => val || "general"),
4190
- description: z.string().max(1e3, "M\xF4 t\u1EA3 t\u1ED1i \u0111a 1000 k\xFD t\u1EF1").optional().or(z.literal("")).transform((val) => val || void 0),
4191
- isEncrypted: z.boolean().default(false).optional(),
4192
- isReadOnly: z.boolean().default(false).optional(),
4193
- status: z.preprocess((val) => {
4194
- if (typeof val === "boolean") {
4195
- return booleanToStatus(val);
4196
- }
4197
- if (val === STATUS_ACTIVE || val === STATUS_INACTIVE || val === "Active" || val === "Inactive") {
4198
- return val === "Active" ? STATUS_ACTIVE : val === "Inactive" ? STATUS_INACTIVE : val;
4199
- }
4200
- return STATUS_ACTIVE;
4201
- }, z.enum(STATUS_VALUES).default(STATUS_ACTIVE))
4202
- });
4203
- systemConfigSchema.partial().extend({
4204
- key: z.string().min(1, "Key l\xE0 b\u1EAFt bu\u1ED9c").max(100, "Key t\u1ED1i \u0111a 100 k\xFD t\u1EF1").trim().regex(
4205
- /^[a-zA-Z0-9._-]+$/,
4206
- "Key ch\u1EC9 \u0111\u01B0\u1EE3c ch\u1EE9a ch\u1EEF c\xE1i, s\u1ED1, d\u1EA5u ch\u1EA5m, g\u1EA1ch d\u01B0\u1EDBi v\xE0 g\u1EA1ch ngang"
4207
- ).optional()
4208
- });
4209
- z.object({
4210
- ids: z.array(z.string()).min(1, "Ph\u1EA3i ch\u1ECDn \xEDt nh\u1EA5t 1 c\u1EA5u h\xECnh"),
4211
- action: z.enum(["delete", "activate", "deactivate"])
4212
- });
4213
- }
4214
- });
4215
- var companySchema;
4216
- var init_company_schema = __esm({
4217
- "src/schemas/company.schema.ts"() {
4218
- companySchema = z.object({
4219
- name: z.string().min(1, "T\xEAn c\xF4ng ty l\xE0 b\u1EAFt bu\u1ED9c").max(255, "T\xEAn c\xF4ng ty t\u1ED1i \u0111a 255 k\xFD t\u1EF1").trim(),
4220
- taxCode: z.string().min(1, "M\xE3 s\u1ED1 thu\u1EBF l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 s\u1ED1 thu\u1EBF t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
4221
- address: z.string().min(1, "\u0110\u1ECBa ch\u1EC9 l\xE0 b\u1EAFt bu\u1ED9c").max(500, "\u0110\u1ECBa ch\u1EC9 t\u1ED1i \u0111a 500 k\xFD t\u1EF1").trim(),
4222
- phone: z.string().min(1, "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i l\xE0 b\u1EAFt bu\u1ED9c").max(20, "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i t\u1ED1i \u0111a 20 k\xFD t\u1EF1").trim(),
4223
- email: z.string().min(1, "Email l\xE0 b\u1EAFt bu\u1ED9c").max(255, "Email t\u1ED1i \u0111a 255 k\xFD t\u1EF1").email("Email kh\xF4ng h\u1EE3p l\u1EC7").trim()
4224
- });
4225
- companySchema.partial();
4226
- }
4227
- });
4228
- var branchSchema;
4229
- var init_branch_schema = __esm({
4230
- "src/schemas/branch.schema.ts"() {
4231
- branchSchema = z.object({
4232
- companyId: z.string().min(1, "C\xF4ng ty l\xE0 b\u1EAFt bu\u1ED9c"),
4233
- code: z.string().min(1, "M\xE3 chi nh\xE1nh l\xE0 b\u1EAFt bu\u1ED9c").max(50, "M\xE3 chi nh\xE1nh t\u1ED1i \u0111a 50 k\xFD t\u1EF1").trim(),
4234
- name: z.string().min(1, "T\xEAn chi nh\xE1nh l\xE0 b\u1EAFt bu\u1ED9c").max(255, "T\xEAn chi nh\xE1nh t\u1ED1i \u0111a 255 k\xFD t\u1EF1").trim(),
4235
- address: z.string().max(500, "\u0110\u1ECBa ch\u1EC9 t\u1ED1i \u0111a 500 k\xFD t\u1EF1").trim().optional().nullable(),
4236
- phone: z.string().max(20, "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i t\u1ED1i \u0111a 20 k\xFD t\u1EF1").trim().optional().nullable(),
4237
- email: z.string().max(255, "Email t\u1ED1i \u0111a 255 k\xFD t\u1EF1").email("Email kh\xF4ng h\u1EE3p l\u1EC7").trim().optional().nullable().or(z.literal("")),
4238
- status: z.enum(["active", "inactive"]).default("active")
4239
- });
4240
- branchSchema.partial();
4241
- }
4242
- });
4243
- var RegisterSchema;
4244
- var init_register_schema = __esm({
4245
- "src/schemas/register-schema.ts"() {
4246
- RegisterSchema = z.object({
4247
- firstName: z.string().trim().min(2, { message: "First Name must contain at least 2 characters." }).max(50, { message: "First Name must contain at most 50 characters." }),
4248
- lastName: z.string().trim().min(2, { message: "Last Name must contain at least 2 characters." }).max(50, { message: "Last Name must contain at most 50 characters." }),
4249
- username: z.string().toLowerCase().trim().min(3, { message: "Username must contain at least 3 characters." }).max(50, { message: "Username must contain at most 50 characters." }),
4250
- email: z.string().email({ message: "Invalid email address" }).toLowerCase().trim(),
4251
- password: z.string().min(8, {
4252
- message: "Password must contain at least 8 characters"
4253
- }).regex(/(?=.*[a-zA-Z])/, {
4254
- message: "Password must contain at least one letter."
4255
- }).regex(/(?=.*[0-9])/, {
4256
- message: "Password must contain at least one number."
4257
- })
4258
- });
4259
- }
4260
- });
4261
- var SignInSchema;
4262
- var init_sign_in_schema = __esm({
4263
- "src/schemas/sign-in-schema.ts"() {
4264
- SignInSchema = z.object({
4265
- email: z.string().email({ message: "Invalid email address" }).toLowerCase().trim(),
4266
- password: z.string().min(8, {
4267
- message: "Password must contain at least 8 characters"
4268
- }).max(250, {
4269
- message: "Password must contain at most 250 characters"
4270
- }).regex(/(?=.*[a-zA-Z])/, {
4271
- message: "Password must contain at least one letter."
4272
- }).regex(/(?=.*[0-9])/, {
4273
- message: "Password must contain at least one number."
4274
- }),
4275
- rememberMe: z.boolean().optional()
4276
- });
4277
- }
4278
- });
4279
- var ForgotPasswordSchema;
4280
- var init_forgot_passward_schema = __esm({
4281
- "src/schemas/forgot-passward-schema.ts"() {
4282
- ForgotPasswordSchema = z.object({
4283
- email: z.string().email({ message: "Invalid email address" }).toLowerCase().trim()
4284
- });
4285
- }
4286
- });
4287
- var NewPasswordSchema;
4288
- var init_new_passward_schema = __esm({
4289
- "src/schemas/new-passward-schema.ts"() {
4290
- NewPasswordSchema = z.object({
4291
- password: z.string().min(8, {
4292
- message: "Password must contain at least 8 characters"
4293
- }),
4294
- confirmPassword: z.string().min(8, {
4295
- message: "Confirm password must contain at least 8 characters"
4296
- })
4297
- }).refine((data) => data.password === data.confirmPassword, {
4298
- message: "Passwords must match",
4299
- path: ["confirmPassword"]
4300
- });
4301
- }
4302
- });
4303
- var VerifyEmailSchema;
4304
- var init_verify_email_schema = __esm({
4305
- "src/schemas/verify-email-schema.ts"() {
4306
- VerifyEmailSchema = z.object({
4307
- email: z.string().email({ message: "Invalid email address" }).toLowerCase().trim()
4308
- });
4309
- }
4310
- });
4311
- var init_coming_soon_schema = __esm({
4312
- "src/schemas/coming-soon-schema.ts"() {
4313
- z.object({
4314
- email: z.string().email({ message: "Invalid email address" }).toLowerCase().trim()
4315
- });
4316
- }
4317
- });
4318
-
4319
- // src/schemas/index.ts
4320
- var init_schemas = __esm({
4321
- "src/schemas/index.ts"() {
4322
- init_supplier_schema();
4323
- init_material_schema();
4324
- init_material_category_schema();
4325
- init_uom_schema();
4326
- init_warehouse_schema();
4327
- init_partner_company_schema();
4328
- init_system_category_group_schema();
4329
- init_system_category_schema();
4330
- init_action_schema();
4331
- init_resource_schema();
4332
- init_material_pricing_schema();
4333
- init_user_schema();
4334
- init_role_schema();
4335
- init_user_supplier_schema();
4336
- init_system_config_schema();
4337
- init_company_schema();
4338
- init_branch_schema();
4339
- init_register_schema();
4340
- init_sign_in_schema();
4341
- init_forgot_passward_schema();
4342
- init_new_passward_schema();
4343
- init_verify_email_schema();
4344
- init_coming_soon_schema();
4345
- }
4346
- });
4347
- function SignInForm() {
4348
- const params = useParams();
4349
- const searchParams = useSearchParams();
4350
- const router = useRouter();
4351
- const { clearAllCache } = useTabContentCache();
4352
- const { clearTabs } = useTabNavigation();
4353
- const redirectPathname = searchParams.get("redirectTo") || process.env.NEXT_PUBLIC_HOME_PATHNAME || "/";
4354
- const form = useForm({
4355
- resolver: zodResolver(SignInSchema),
4356
- defaultValues: {
4357
- email: "",
4358
- password: "",
4359
- rememberMe: false
4360
- }
4361
- });
4362
- const [showPassword, setShowPassword] = React10.useState(false);
4363
- const locale = params.lang || "vi";
4364
- const { isSubmitting } = form.formState;
4365
- const isDisabled = isSubmitting;
4366
- async function onSubmit(data) {
4367
- const { email, password } = data;
4368
- try {
4369
- const result = await signIn("credentials", {
4370
- redirect: false,
4371
- email,
4372
- password
4373
- });
4374
- if (result && result.error) {
4375
- throw new Error(result.error);
4376
- }
4377
- toast.success("\u0110\u0103ng nh\u1EADp th\xE0nh c\xF4ng", {
4378
- description: "Ch\xE0o m\u1EEBng b\u1EA1n quay tr\u1EDF l\u1EA1i!"
4379
- });
4380
- try {
4381
- clearAllCache();
4382
- clearTabs();
4383
- if (typeof window !== "undefined") {
4384
- sessionStorage.removeItem("tab-content-cache");
4385
- sessionStorage.removeItem("tab-navigation-state");
4386
- }
4387
- } catch {
4388
- }
4389
- router.push(redirectPathname);
4390
- } catch (error) {
4391
- const rawMessage = error instanceof Error ? error.message : "\u0110\u0103ng nh\u1EADp th\u1EA5t b\u1EA1i";
4392
- const isSuspended = rawMessage.includes("ACCOUNT_SUSPENDED");
4393
- const message = isSuspended ? "T\xE0i kho\u1EA3n c\u1EE7a b\u1EA1n \u0111\xE3 b\u1ECB kh\xF3a. Vui l\xF2ng li\xEAn h\u1EC7 qu\u1EA3n tr\u1ECB vi\xEAn." : rawMessage;
4394
- toast.error(isSuspended ? "T\xE0i kho\u1EA3n b\u1ECB kh\xF3a" : "\u0110\u0103ng nh\u1EADp th\u1EA5t b\u1EA1i", {
4395
- description: message
4396
- });
4397
- form.setError("root", { message });
4398
- }
4399
- }
4400
- return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-6", children: [
4401
- form.formState.errors.root && /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: form.formState.errors.root.message }) }),
4402
- /* @__PURE__ */ jsxs("div", { className: "grid grow gap-2", children: [
4403
- /* @__PURE__ */ jsx(
4404
- FormField,
4405
- {
4406
- control: form.control,
4407
- name: "email",
4408
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4409
- /* @__PURE__ */ jsx(FormLabel, { children: "Email" }),
4410
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
4411
- Input,
4412
- {
4413
- type: "email",
4414
- placeholder: "name@example.com",
4415
- ...field
4416
- }
4417
- ) }),
4418
- /* @__PURE__ */ jsx(FormMessage, {})
4419
- ] })
4420
- }
4421
- ),
4422
- /* @__PURE__ */ jsx(
4423
- FormField,
4424
- {
4425
- control: form.control,
4426
- name: "password",
4427
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4428
- /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
4429
- /* @__PURE__ */ jsx(FormLabel, { children: "M\u1EADt kh\u1EA9u" }),
4430
- /* @__PURE__ */ jsx(
4431
- Link15,
4432
- {
4433
- href: ensureLocalizedPathname(
4434
- redirectPathname !== "/" && redirectPathname !== process.env.NEXT_PUBLIC_HOME_PATHNAME ? ensureRedirectPathname(
4435
- "/forgot-password",
4436
- redirectPathname
4437
- ) : "/forgot-password",
4438
- locale
4439
- ),
4440
- className: "ms-auto inline-block text-sm underline",
4441
- children: "Qu\xEAn m\u1EADt kh\u1EA9u?"
4442
- }
4443
- )
4444
- ] }),
4445
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
4446
- /* @__PURE__ */ jsx(
4447
- Input,
4448
- {
4449
- type: showPassword ? "text" : "password",
4450
- ...field
4451
- }
4452
- ),
4453
- /* @__PURE__ */ jsxs(
4454
- Button,
4455
- {
4456
- type: "button",
4457
- variant: "ghost",
4458
- size: "sm",
4459
- className: "absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",
4460
- onClick: () => setShowPassword((prev) => !prev),
4461
- children: [
4462
- showPassword ? /* @__PURE__ */ jsx(EyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Eye, { className: "h-4 w-4" }),
4463
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: showPassword ? "Hide password" : "Show password" })
4464
- ]
4465
- }
4466
- )
4467
- ] }) }),
4468
- /* @__PURE__ */ jsx(FormMessage, {})
4469
- ] })
4470
- }
4471
- ),
4472
- /* @__PURE__ */ jsx(
4473
- FormField,
4474
- {
4475
- control: form.control,
4476
- name: "rememberMe",
4477
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { className: "flex flex-row items-center space-x-2 space-y-0", children: [
4478
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
4479
- Checkbox,
4480
- {
4481
- checked: field.value,
4482
- onCheckedChange: field.onChange
4483
- }
4484
- ) }),
4485
- /* @__PURE__ */ jsx("div", { className: "space-y-1 leading-none", children: /* @__PURE__ */ jsx(FormLabel, { children: "Ghi nh\u1EDB \u0111\u0103ng nh\u1EADp" }) })
4486
- ] })
4487
- }
4488
- )
4489
- ] }),
4490
- /* @__PURE__ */ jsx(ButtonLoading, { isLoading: isSubmitting, disabled: isDisabled, children: "\u0110\u0103ng nh\u1EADp v\u1EDBi Email" }),
4491
- /* @__PURE__ */ jsxs("div", { className: "-mt-4 text-center text-sm", children: [
4492
- "Ch\u01B0a c\xF3 t\xE0i kho\u1EA3n?",
4493
- " ",
4494
- /* @__PURE__ */ jsx(
4495
- Link15,
4496
- {
4497
- href: ensureLocalizedPathname(
4498
- redirectPathname !== "/" && redirectPathname !== process.env.NEXT_PUBLIC_HOME_PATHNAME ? ensureRedirectPathname("/register", redirectPathname) : "/register",
4499
- locale
4500
- ),
4501
- className: "underline",
4502
- children: "\u0110\u0103ng k\xFD"
4503
- }
4504
- )
4505
- ] })
4506
- ] }) });
4507
- }
4508
- var init_sign_in_form = __esm({
4509
- "src/ui/auth/sign-in-form.tsx"() {
4510
- "use client";
4511
- init_utils();
4512
- init_schemas();
4513
- init_tab_content_cache();
4514
- init_tab_navigation_provider();
4515
- init_ui();
4516
- }
4517
- });
4518
- function RegisterForm() {
4519
- const router = useRouter();
4520
- const params = useParams();
4521
- const searchParams = useSearchParams();
4522
- const form = useForm({
4523
- resolver: zodResolver(RegisterSchema),
4524
- defaultValues: {
4525
- firstName: "",
4526
- lastName: "",
4527
- username: "",
4528
- email: "",
4529
- password: ""
4530
- }
4531
- });
4532
- const locale = params.lang || "vi";
4533
- const redirectPathname = searchParams.get("redirectTo");
4534
- const { isSubmitting, isDirty } = form.formState;
4535
- const isDisabled = isSubmitting || !isDirty;
4536
- async function onSubmit(data) {
4537
- const { firstName, lastName, username, email, password } = data;
4538
- try {
4539
- const res = await fetch("/api/register", {
4540
- method: "POST",
4541
- headers: {
4542
- "Content-Type": "application/json"
4543
- },
4544
- body: JSON.stringify({
4545
- firstName,
4546
- lastName,
4547
- username,
4548
- email,
4549
- password
4550
- })
4551
- });
4552
- if (res && res.status >= 400) {
4553
- const {
4554
- issues,
4555
- message
4556
- } = await res.json();
4557
- if (!issues) throw new Error(message ?? "An unknown error occurred.");
4558
- issues.forEach((issue) => {
4559
- const field = issue.path[0];
4560
- form.setError(field, { type: "manual", message: issue.message });
4561
- });
4562
- } else {
4563
- toast.success("\u0110\u0103ng k\xFD th\xE0nh c\xF4ng");
4564
- router.push(
4565
- ensureLocalizedPathname(
4566
- redirectPathname ? ensureRedirectPathname("/sign-in", redirectPathname) : "/sign-in",
4567
- locale
4568
- )
4569
- );
4570
- }
4571
- } catch (error) {
4572
- toast.error("\u0110\u0103ng k\xFD th\u1EA5t b\u1EA1i", {
4573
- description: error instanceof Error ? error.message : void 0
4574
- });
4575
- }
4576
- }
4577
- return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-6", children: [
4578
- /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
4579
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
4580
- /* @__PURE__ */ jsx(
4581
- FormField,
4582
- {
4583
- control: form.control,
4584
- name: "firstName",
4585
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4586
- /* @__PURE__ */ jsx(FormLabel, { children: "First Name" }),
4587
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "text", placeholder: "John", ...field }) }),
4588
- /* @__PURE__ */ jsx(FormMessage, {})
4589
- ] })
4590
- }
4591
- ),
4592
- /* @__PURE__ */ jsx(
4593
- FormField,
4594
- {
4595
- control: form.control,
4596
- name: "lastName",
4597
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4598
- /* @__PURE__ */ jsx(FormLabel, { children: "Last Name" }),
4599
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "text", placeholder: "Doe", ...field }) }),
4600
- /* @__PURE__ */ jsx(FormMessage, {})
4601
- ] })
4602
- }
4603
- )
4604
- ] }),
4605
- /* @__PURE__ */ jsx(
4606
- FormField,
4607
- {
4608
- control: form.control,
4609
- name: "username",
4610
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4611
- /* @__PURE__ */ jsx(FormLabel, { children: "Username" }),
4612
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "text", placeholder: "john_doe", ...field }) }),
4613
- /* @__PURE__ */ jsx(FormMessage, {})
4614
- ] })
4615
- }
4616
- ),
4617
- /* @__PURE__ */ jsx(
4618
- FormField,
4619
- {
4620
- control: form.control,
4621
- name: "email",
4622
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4623
- /* @__PURE__ */ jsx(FormLabel, { children: "Email" }),
4624
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
4625
- Input,
4626
- {
4627
- type: "email",
4628
- placeholder: "name@example.com",
4629
- ...field
4630
- }
4631
- ) }),
4632
- /* @__PURE__ */ jsx(FormMessage, {})
4633
- ] })
4634
- }
4635
- ),
4636
- /* @__PURE__ */ jsx(
4637
- FormField,
4638
- {
4639
- control: form.control,
4640
- name: "password",
4641
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4642
- /* @__PURE__ */ jsx(FormLabel, { children: "Password" }),
4643
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "password", ...field }) }),
4644
- /* @__PURE__ */ jsx(FormMessage, {})
4645
- ] })
4646
- }
4647
- )
4648
- ] }),
4649
- /* @__PURE__ */ jsx(ButtonLoading, { isLoading: isSubmitting, disabled: isDisabled, children: "\u0110\u0103ng k\xFD v\u1EDBi Email" }),
4650
- /* @__PURE__ */ jsxs("div", { className: "-mt-4 text-center text-sm", children: [
4651
- "\u0110\xE3 c\xF3 t\xE0i kho\u1EA3n?",
4652
- " ",
4653
- /* @__PURE__ */ jsx(
4654
- Link15,
4655
- {
4656
- href: ensureLocalizedPathname(
4657
- redirectPathname ? ensureRedirectPathname("/sign-in", redirectPathname) : "/sign-in",
4658
- locale
4659
- ),
4660
- className: "underline",
4661
- children: "\u0110\u0103ng nh\u1EADp"
4662
- }
4663
- )
4664
- ] })
4665
- ] }) });
4666
- }
4667
- var init_register_form = __esm({
4668
- "src/ui/auth/register-form.tsx"() {
4669
- "use client";
4670
- init_utils();
4671
- init_schemas();
4672
- init_ui();
4673
- }
4674
- });
4675
- function OAuthLinks({ className }) {
4676
- return /* @__PURE__ */ jsx("div", { className: cn("grid grid-cols-4 gap-2", className), children: oauthLinksData.map((link) => {
4677
- const Icon2 = link.icon;
4678
- return /* @__PURE__ */ jsx(
4679
- Link15,
4680
- {
4681
- href: link.href,
4682
- className: buttonVariants({ variant: "outline", size: "icon" }),
4683
- "aria-label": link.label,
4684
- children: /* @__PURE__ */ jsx(Icon2, { className: "size-4" })
4685
- },
4686
- link.label
4687
- );
4688
- }) });
4689
- }
4690
- var init_oauth_links2 = __esm({
4691
- "src/ui/auth/oauth-links.tsx"() {
4692
- "use client";
4693
- init_oauth_links();
4694
- init_button();
4695
- init_utils();
4696
- }
4697
- });
4698
- function ForgotPasswordForm() {
4699
- const params = useParams();
4700
- const searchParams = useSearchParams();
4701
- const form = useForm({
4702
- resolver: zodResolver(ForgotPasswordSchema),
4703
- defaultValues: {
4704
- email: ""
4705
- }
4706
- });
4707
- const locale = params.lang || "vi";
4708
- const redirectPathname = searchParams.get("redirectTo");
4709
- const { isSubmitting, isDirty } = form.formState;
4710
- const isDisabled = isSubmitting || !isDirty;
4711
- async function onSubmit(_data) {
4712
- try {
4713
- toast.success("Check your email", {
4714
- description: "We've sent you an email with instructions to reset your password."
4715
- });
4716
- } catch (error) {
4717
- toast.error("Something went wrong", {
4718
- description: error instanceof Error ? error.message : void 0
4719
- });
4720
- }
4721
- }
4722
- return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-6", children: [
4723
- /* @__PURE__ */ jsx("div", { className: "grid gap-2", children: /* @__PURE__ */ jsx(
4724
- FormField,
4725
- {
4726
- control: form.control,
4727
- name: "email",
4728
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4729
- /* @__PURE__ */ jsx(FormLabel, { children: "Email" }),
4730
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
4731
- Input,
4732
- {
4733
- type: "email",
4734
- placeholder: "name@example.com",
4735
- ...field
4736
- }
4737
- ) }),
4738
- /* @__PURE__ */ jsx(FormMessage, {})
4739
- ] })
4740
- }
4741
- ) }),
4742
- /* @__PURE__ */ jsx(ButtonLoading, { isLoading: isSubmitting, disabled: isDisabled, children: "Send instructions" }),
4743
- /* @__PURE__ */ jsx(
4744
- Link15,
4745
- {
4746
- href: ensureLocalizedPathname(
4747
- redirectPathname ? ensureRedirectPathname("/sign-in", redirectPathname) : "/sign-in",
4748
- locale
4749
- ),
4750
- className: "-mt-4 text-center text-sm underline",
4751
- children: "Back to Sign in"
4752
- }
4753
- )
4754
- ] }) });
4755
- }
4756
- var init_forgot_password_form = __esm({
4757
- "src/ui/auth/forgot-password-form.tsx"() {
4758
- "use client";
4759
- init_utils();
4760
- init_schemas();
4761
- init_ui();
4762
- }
4763
- });
4764
- function NewPasswordForm() {
4765
- const params = useParams();
4766
- const searchParams = useSearchParams();
4767
- const form = useForm({
4768
- resolver: zodResolver(NewPasswordSchema),
4769
- defaultValues: {
4770
- password: "",
4771
- confirmPassword: ""
4772
- }
4773
- });
4774
- const locale = params.lang || "vi";
4775
- const redirectPathname = searchParams.get("redirectTo");
4776
- const { isSubmitting, isDirty } = form.formState;
4777
- const isDisabled = isSubmitting || !isDirty;
4778
- async function onSubmit(_data) {
4779
- try {
4780
- toast.success("Password reset", {
4781
- description: "Your password has been successfully reset."
4782
- });
4783
- } catch (error) {
4784
- toast.error("Something went wrong", {
4785
- description: error instanceof Error ? error.message : void 0
4786
- });
4787
- }
4788
- }
4789
- return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-6", children: [
4790
- /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
4791
- /* @__PURE__ */ jsx(
4792
- FormField,
4793
- {
4794
- control: form.control,
4795
- name: "password",
4796
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4797
- /* @__PURE__ */ jsx(FormLabel, { children: "Password" }),
4798
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "password", ...field }) }),
4799
- /* @__PURE__ */ jsx(FormMessage, {})
4800
- ] })
4801
- }
4802
- ),
4803
- /* @__PURE__ */ jsx(
4804
- FormField,
4805
- {
4806
- control: form.control,
4807
- name: "confirmPassword",
4808
- render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
4809
- /* @__PURE__ */ jsx(FormLabel, { children: "Confirm Password" }),
4810
- /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { type: "password", ...field }) }),
4811
- /* @__PURE__ */ jsx(FormMessage, {})
4812
- ] })
4813
- }
4814
- )
4815
- ] }),
4816
- /* @__PURE__ */ jsx(ButtonLoading, { isLoading: isSubmitting, disabled: isDisabled, children: "Set new password" }),
4817
- /* @__PURE__ */ jsx(
4818
- Link15,
4819
- {
4820
- href: ensureLocalizedPathname(
4821
- redirectPathname ? ensureRedirectPathname("/sign-in", redirectPathname) : "/sign-in",
4822
- locale
4823
- ),
4824
- className: "-mt-4 text-center text-sm underline",
4825
- children: "Back to Sign in"
4826
- }
4827
- )
4828
- ] }) });
4829
- }
4830
- var init_new_password_form = __esm({
4831
- "src/ui/auth/new-password-form.tsx"() {
4832
- "use client";
4833
- init_utils();
4834
- init_schemas();
4835
- init_ui();
4836
- }
4837
- });
4838
- function VerifyEmailForm() {
4839
- const params = useParams();
4840
- const form = useForm({
4841
- resolver: zodResolver(VerifyEmailSchema),
4842
- // @ts-ignore - Schema might expect 'code' but original used 'email'.
4843
- // I will ignore defaultValues discrepancy for now to safely port UI.
4844
- defaultValues: {
4845
- // email: "",
4846
- }
4847
- });
4848
- const locale = params.lang || "vi";
4849
- async function onSubmit(data) {
4850
- console.log("Verify email submit", data);
4851
- }
4852
- return /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "grid gap-2", children: [
4853
- /* @__PURE__ */ jsx(
4854
- Link15,
4855
- {
4856
- href: ensureLocalizedPathname(
4857
- process.env.NEXT_PUBLIC_HOME_PATHNAME || "/",
4858
- locale
4859
- ),
4860
- className: cn(buttonVariants({ variant: "default" })),
4861
- children: "Skip for now"
4862
- }
4863
- ),
4864
- /* @__PURE__ */ jsxs("div", { className: "text-center text-sm", children: [
4865
- "Didn't receive the email?",
4866
- " ",
4867
- /* @__PURE__ */ jsx(Link15, { href: "#", className: "underline", children: "Resend" })
4868
- ] })
4869
- ] }) });
4870
- }
4871
- var init_verify_email_form = __esm({
4872
- "src/ui/auth/verify-email-form.tsx"() {
4873
- "use client";
4874
- init_utils();
4875
- init_schemas();
4876
- init_ui();
4877
- }
4878
- });
4879
-
4880
- // src/ui/auth/index.tsx
4881
- var init_auth = __esm({
4882
- "src/ui/auth/index.tsx"() {
4883
- init_auth_layout();
4884
- init_sign_in_form();
4885
- init_register_form();
4886
- init_oauth_links2();
4887
- init_forgot_password_form();
4888
- init_new_password_form();
4889
- init_verify_email_form();
4890
- }
4891
- });
4892
- init_auth();
4893
-
4894
- export { Auth, AuthDescription, AuthFooter, AuthForm, AuthHeader, AuthImage, AuthTitle, ForgotPasswordForm, NewPasswordForm, OAuthLinks, RegisterForm, SignInForm, VerifyEmailForm };
4895
- //# sourceMappingURL=auth.mjs.map
4896
- //# sourceMappingURL=auth.mjs.map