shadcn 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-SI5IQBLR.js +87 -0
- package/dist/chunk-THLZQQKP.js +71 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +91 -91
- package/dist/mcp/index.js +1 -1
- package/dist/registry/index.js +1 -1
- package/dist/schema/index.d.ts +34 -34
- package/package.json +1 -1
- package/dist/chunk-42UQOK2K.js +0 -33
- package/dist/chunk-KJ7WG52C.js +0 -119
package/dist/mcp/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{a as server}from'../chunk-THLZQQKP.js';import'../chunk-SI5IQBLR.js';import'../chunk-HW2MEAJZ.js';import'../chunk-WLJDV6SE.js';import'../chunk-CHWMSXYA.js';
|
package/dist/registry/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{s as RegistriesIndexParseError,i as RegistryError,m as RegistryFetchError,l as RegistryForbiddenError,r as RegistryInvalidNamespaceError,o as RegistryLocalFileError,q as RegistryMissingEnvironmentVariablesError,n as RegistryNotConfiguredError,j as RegistryNotFoundError,p as RegistryParseError,k as RegistryUnauthorizedError,va as getRegistries,wa as getRegistriesIndex,ja as getRegistry,ka as getRegistryItems,la as resolveRegistryItems,Da as searchRegistries}from'../chunk-SI5IQBLR.js';import'../chunk-HW2MEAJZ.js';import'../chunk-WLJDV6SE.js';import'../chunk-CHWMSXYA.js';
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ declare const rawConfigSchema: z.ZodObject<{
|
|
|
108
108
|
iconLibrary?: string | undefined;
|
|
109
109
|
rtl?: boolean | undefined;
|
|
110
110
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
111
|
-
menuAccent?: "
|
|
111
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
112
112
|
registries?: Record<string, string | {
|
|
113
113
|
url: string;
|
|
114
114
|
params?: Record<string, string> | undefined;
|
|
@@ -136,7 +136,7 @@ declare const rawConfigSchema: z.ZodObject<{
|
|
|
136
136
|
iconLibrary?: string | undefined;
|
|
137
137
|
rtl?: boolean | undefined;
|
|
138
138
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
139
|
-
menuAccent?: "
|
|
139
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
140
140
|
registries?: Record<string, string | {
|
|
141
141
|
url: string;
|
|
142
142
|
params?: Record<string, string> | undefined;
|
|
@@ -216,19 +216,19 @@ declare const configSchema: z.ZodObject<{
|
|
|
216
216
|
}, "strip", z.ZodTypeAny, {
|
|
217
217
|
components: string;
|
|
218
218
|
ui: string;
|
|
219
|
-
cwd: string;
|
|
220
219
|
utils: string;
|
|
221
220
|
lib: string;
|
|
222
221
|
hooks: string;
|
|
222
|
+
cwd: string;
|
|
223
223
|
tailwindConfig: string;
|
|
224
224
|
tailwindCss: string;
|
|
225
225
|
}, {
|
|
226
226
|
components: string;
|
|
227
227
|
ui: string;
|
|
228
|
-
cwd: string;
|
|
229
228
|
utils: string;
|
|
230
229
|
lib: string;
|
|
231
230
|
hooks: string;
|
|
231
|
+
cwd: string;
|
|
232
232
|
tailwindConfig: string;
|
|
233
233
|
tailwindCss: string;
|
|
234
234
|
}>;
|
|
@@ -253,10 +253,10 @@ declare const configSchema: z.ZodObject<{
|
|
|
253
253
|
resolvedPaths: {
|
|
254
254
|
components: string;
|
|
255
255
|
ui: string;
|
|
256
|
-
cwd: string;
|
|
257
256
|
utils: string;
|
|
258
257
|
lib: string;
|
|
259
258
|
hooks: string;
|
|
259
|
+
cwd: string;
|
|
260
260
|
tailwindConfig: string;
|
|
261
261
|
tailwindCss: string;
|
|
262
262
|
};
|
|
@@ -264,7 +264,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
264
264
|
iconLibrary?: string | undefined;
|
|
265
265
|
rtl?: boolean | undefined;
|
|
266
266
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
267
|
-
menuAccent?: "
|
|
267
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
268
268
|
registries?: Record<string, string | {
|
|
269
269
|
url: string;
|
|
270
270
|
params?: Record<string, string> | undefined;
|
|
@@ -289,10 +289,10 @@ declare const configSchema: z.ZodObject<{
|
|
|
289
289
|
resolvedPaths: {
|
|
290
290
|
components: string;
|
|
291
291
|
ui: string;
|
|
292
|
-
cwd: string;
|
|
293
292
|
utils: string;
|
|
294
293
|
lib: string;
|
|
295
294
|
hooks: string;
|
|
295
|
+
cwd: string;
|
|
296
296
|
tailwindConfig: string;
|
|
297
297
|
tailwindCss: string;
|
|
298
298
|
};
|
|
@@ -302,7 +302,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
302
302
|
iconLibrary?: string | undefined;
|
|
303
303
|
rtl?: boolean | undefined;
|
|
304
304
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
305
|
-
menuAccent?: "
|
|
305
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
306
306
|
registries?: Record<string, string | {
|
|
307
307
|
url: string;
|
|
308
308
|
params?: Record<string, string> | undefined;
|
|
@@ -382,19 +382,19 @@ declare const workspaceConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
382
382
|
}, "strip", z.ZodTypeAny, {
|
|
383
383
|
components: string;
|
|
384
384
|
ui: string;
|
|
385
|
-
cwd: string;
|
|
386
385
|
utils: string;
|
|
387
386
|
lib: string;
|
|
388
387
|
hooks: string;
|
|
388
|
+
cwd: string;
|
|
389
389
|
tailwindConfig: string;
|
|
390
390
|
tailwindCss: string;
|
|
391
391
|
}, {
|
|
392
392
|
components: string;
|
|
393
393
|
ui: string;
|
|
394
|
-
cwd: string;
|
|
395
394
|
utils: string;
|
|
396
395
|
lib: string;
|
|
397
396
|
hooks: string;
|
|
397
|
+
cwd: string;
|
|
398
398
|
tailwindConfig: string;
|
|
399
399
|
tailwindCss: string;
|
|
400
400
|
}>;
|
|
@@ -419,10 +419,10 @@ declare const workspaceConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
419
419
|
resolvedPaths: {
|
|
420
420
|
components: string;
|
|
421
421
|
ui: string;
|
|
422
|
-
cwd: string;
|
|
423
422
|
utils: string;
|
|
424
423
|
lib: string;
|
|
425
424
|
hooks: string;
|
|
425
|
+
cwd: string;
|
|
426
426
|
tailwindConfig: string;
|
|
427
427
|
tailwindCss: string;
|
|
428
428
|
};
|
|
@@ -430,7 +430,7 @@ declare const workspaceConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
430
430
|
iconLibrary?: string | undefined;
|
|
431
431
|
rtl?: boolean | undefined;
|
|
432
432
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
433
|
-
menuAccent?: "
|
|
433
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
434
434
|
registries?: Record<string, string | {
|
|
435
435
|
url: string;
|
|
436
436
|
params?: Record<string, string> | undefined;
|
|
@@ -455,10 +455,10 @@ declare const workspaceConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
455
455
|
resolvedPaths: {
|
|
456
456
|
components: string;
|
|
457
457
|
ui: string;
|
|
458
|
-
cwd: string;
|
|
459
458
|
utils: string;
|
|
460
459
|
lib: string;
|
|
461
460
|
hooks: string;
|
|
461
|
+
cwd: string;
|
|
462
462
|
tailwindConfig: string;
|
|
463
463
|
tailwindCss: string;
|
|
464
464
|
};
|
|
@@ -468,7 +468,7 @@ declare const workspaceConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
468
468
|
iconLibrary?: string | undefined;
|
|
469
469
|
rtl?: boolean | undefined;
|
|
470
470
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
471
|
-
menuAccent?: "
|
|
471
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
472
472
|
registries?: Record<string, string | {
|
|
473
473
|
url: string;
|
|
474
474
|
params?: Record<string, string> | undefined;
|
|
@@ -903,7 +903,7 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
903
903
|
iconLibrary?: string | undefined;
|
|
904
904
|
rtl?: boolean | undefined;
|
|
905
905
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
906
|
-
menuAccent?: "
|
|
906
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
907
907
|
aliases?: {
|
|
908
908
|
components?: string | undefined;
|
|
909
909
|
ui?: string | undefined;
|
|
@@ -931,7 +931,7 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
931
931
|
iconLibrary?: string | undefined;
|
|
932
932
|
rtl?: boolean | undefined;
|
|
933
933
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
934
|
-
menuAccent?: "
|
|
934
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
935
935
|
aliases?: {
|
|
936
936
|
components?: string | undefined;
|
|
937
937
|
ui?: string | undefined;
|
|
@@ -972,7 +972,7 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
972
972
|
iconLibrary?: string | undefined;
|
|
973
973
|
rtl?: boolean | undefined;
|
|
974
974
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
975
|
-
menuAccent?: "
|
|
975
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
976
976
|
aliases?: {
|
|
977
977
|
components?: string | undefined;
|
|
978
978
|
ui?: string | undefined;
|
|
@@ -1040,7 +1040,7 @@ declare const registryItemSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
|
1040
1040
|
iconLibrary?: string | undefined;
|
|
1041
1041
|
rtl?: boolean | undefined;
|
|
1042
1042
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
1043
|
-
menuAccent?: "
|
|
1043
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
1044
1044
|
aliases?: {
|
|
1045
1045
|
components?: string | undefined;
|
|
1046
1046
|
ui?: string | undefined;
|
|
@@ -1635,7 +1635,7 @@ declare const registrySchema: z.ZodObject<{
|
|
|
1635
1635
|
iconLibrary?: string | undefined;
|
|
1636
1636
|
rtl?: boolean | undefined;
|
|
1637
1637
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
1638
|
-
menuAccent?: "
|
|
1638
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
1639
1639
|
aliases?: {
|
|
1640
1640
|
components?: string | undefined;
|
|
1641
1641
|
ui?: string | undefined;
|
|
@@ -1663,7 +1663,7 @@ declare const registrySchema: z.ZodObject<{
|
|
|
1663
1663
|
iconLibrary?: string | undefined;
|
|
1664
1664
|
rtl?: boolean | undefined;
|
|
1665
1665
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
1666
|
-
menuAccent?: "
|
|
1666
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
1667
1667
|
aliases?: {
|
|
1668
1668
|
components?: string | undefined;
|
|
1669
1669
|
ui?: string | undefined;
|
|
@@ -1704,7 +1704,7 @@ declare const registrySchema: z.ZodObject<{
|
|
|
1704
1704
|
iconLibrary?: string | undefined;
|
|
1705
1705
|
rtl?: boolean | undefined;
|
|
1706
1706
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
1707
|
-
menuAccent?: "
|
|
1707
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
1708
1708
|
aliases?: {
|
|
1709
1709
|
components?: string | undefined;
|
|
1710
1710
|
ui?: string | undefined;
|
|
@@ -1772,7 +1772,7 @@ declare const registrySchema: z.ZodObject<{
|
|
|
1772
1772
|
iconLibrary?: string | undefined;
|
|
1773
1773
|
rtl?: boolean | undefined;
|
|
1774
1774
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
1775
|
-
menuAccent?: "
|
|
1775
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
1776
1776
|
aliases?: {
|
|
1777
1777
|
components?: string | undefined;
|
|
1778
1778
|
ui?: string | undefined;
|
|
@@ -2224,7 +2224,7 @@ declare const registrySchema: z.ZodObject<{
|
|
|
2224
2224
|
iconLibrary?: string | undefined;
|
|
2225
2225
|
rtl?: boolean | undefined;
|
|
2226
2226
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
2227
|
-
menuAccent?: "
|
|
2227
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
2228
2228
|
aliases?: {
|
|
2229
2229
|
components?: string | undefined;
|
|
2230
2230
|
ui?: string | undefined;
|
|
@@ -2384,7 +2384,7 @@ declare const registrySchema: z.ZodObject<{
|
|
|
2384
2384
|
iconLibrary?: string | undefined;
|
|
2385
2385
|
rtl?: boolean | undefined;
|
|
2386
2386
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
2387
|
-
menuAccent?: "
|
|
2387
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
2388
2388
|
aliases?: {
|
|
2389
2389
|
components?: string | undefined;
|
|
2390
2390
|
ui?: string | undefined;
|
|
@@ -2679,7 +2679,7 @@ declare const registryIndexSchema: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z
|
|
|
2679
2679
|
iconLibrary?: string | undefined;
|
|
2680
2680
|
rtl?: boolean | undefined;
|
|
2681
2681
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
2682
|
-
menuAccent?: "
|
|
2682
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
2683
2683
|
aliases?: {
|
|
2684
2684
|
components?: string | undefined;
|
|
2685
2685
|
ui?: string | undefined;
|
|
@@ -2707,7 +2707,7 @@ declare const registryIndexSchema: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z
|
|
|
2707
2707
|
iconLibrary?: string | undefined;
|
|
2708
2708
|
rtl?: boolean | undefined;
|
|
2709
2709
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
2710
|
-
menuAccent?: "
|
|
2710
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
2711
2711
|
aliases?: {
|
|
2712
2712
|
components?: string | undefined;
|
|
2713
2713
|
ui?: string | undefined;
|
|
@@ -2748,7 +2748,7 @@ declare const registryIndexSchema: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z
|
|
|
2748
2748
|
iconLibrary?: string | undefined;
|
|
2749
2749
|
rtl?: boolean | undefined;
|
|
2750
2750
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
2751
|
-
menuAccent?: "
|
|
2751
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
2752
2752
|
aliases?: {
|
|
2753
2753
|
components?: string | undefined;
|
|
2754
2754
|
ui?: string | undefined;
|
|
@@ -2816,7 +2816,7 @@ declare const registryIndexSchema: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z
|
|
|
2816
2816
|
iconLibrary?: string | undefined;
|
|
2817
2817
|
rtl?: boolean | undefined;
|
|
2818
2818
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
2819
|
-
menuAccent?: "
|
|
2819
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
2820
2820
|
aliases?: {
|
|
2821
2821
|
components?: string | undefined;
|
|
2822
2822
|
ui?: string | undefined;
|
|
@@ -3905,7 +3905,7 @@ declare const presetSchema: z.ZodObject<{
|
|
|
3905
3905
|
iconLibrary: string;
|
|
3906
3906
|
rtl: boolean;
|
|
3907
3907
|
menuColor: "default" | "inverted" | "default-translucent" | "inverted-translucent";
|
|
3908
|
-
menuAccent: "
|
|
3908
|
+
menuAccent: "subtle" | "bold";
|
|
3909
3909
|
theme: string;
|
|
3910
3910
|
name: string;
|
|
3911
3911
|
title: string;
|
|
@@ -3918,7 +3918,7 @@ declare const presetSchema: z.ZodObject<{
|
|
|
3918
3918
|
baseColor: string;
|
|
3919
3919
|
iconLibrary: string;
|
|
3920
3920
|
menuColor: "default" | "inverted" | "default-translucent" | "inverted-translucent";
|
|
3921
|
-
menuAccent: "
|
|
3921
|
+
menuAccent: "subtle" | "bold";
|
|
3922
3922
|
theme: string;
|
|
3923
3923
|
name: string;
|
|
3924
3924
|
title: string;
|
|
@@ -3950,7 +3950,7 @@ declare const configJsonSchema: z.ZodObject<{
|
|
|
3950
3950
|
iconLibrary: string;
|
|
3951
3951
|
rtl: boolean;
|
|
3952
3952
|
menuColor: "default" | "inverted" | "default-translucent" | "inverted-translucent";
|
|
3953
|
-
menuAccent: "
|
|
3953
|
+
menuAccent: "subtle" | "bold";
|
|
3954
3954
|
theme: string;
|
|
3955
3955
|
name: string;
|
|
3956
3956
|
title: string;
|
|
@@ -3963,7 +3963,7 @@ declare const configJsonSchema: z.ZodObject<{
|
|
|
3963
3963
|
baseColor: string;
|
|
3964
3964
|
iconLibrary: string;
|
|
3965
3965
|
menuColor: "default" | "inverted" | "default-translucent" | "inverted-translucent";
|
|
3966
|
-
menuAccent: "
|
|
3966
|
+
menuAccent: "subtle" | "bold";
|
|
3967
3967
|
theme: string;
|
|
3968
3968
|
name: string;
|
|
3969
3969
|
title: string;
|
|
@@ -3980,7 +3980,7 @@ declare const configJsonSchema: z.ZodObject<{
|
|
|
3980
3980
|
iconLibrary: string;
|
|
3981
3981
|
rtl: boolean;
|
|
3982
3982
|
menuColor: "default" | "inverted" | "default-translucent" | "inverted-translucent";
|
|
3983
|
-
menuAccent: "
|
|
3983
|
+
menuAccent: "subtle" | "bold";
|
|
3984
3984
|
theme: string;
|
|
3985
3985
|
name: string;
|
|
3986
3986
|
title: string;
|
|
@@ -3995,7 +3995,7 @@ declare const configJsonSchema: z.ZodObject<{
|
|
|
3995
3995
|
baseColor: string;
|
|
3996
3996
|
iconLibrary: string;
|
|
3997
3997
|
menuColor: "default" | "inverted" | "default-translucent" | "inverted-translucent";
|
|
3998
|
-
menuAccent: "
|
|
3998
|
+
menuAccent: "subtle" | "bold";
|
|
3999
3999
|
theme: string;
|
|
4000
4000
|
name: string;
|
|
4001
4001
|
title: string;
|
package/package.json
CHANGED
package/dist/chunk-42UQOK2K.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {m,l,f,d as d$1,c as c$1,e,n,t,o,b as b$1,p,q as q$1,r,s,x,z as z$1,v as v$1,g as g$1}from'./chunk-HW2MEAJZ.js';import {a,d,c,b,g,f as f$1}from'./chunk-WLJDV6SE.js';import y,{basename}from'path';import {z}from'zod';import {promises,existsSync,statSync}from'fs';import {green,cyan,yellow,red}from'kleur/colors';import {loadConfig,createMatchPath}from'tsconfig-paths';import {cosmiconfig}from'cosmiconfig';import Ke from'fast-glob';import ne from'fs-extra';import {tmpdir,homedir}from'os';import Kr from'ora';import {Project,SyntaxKind,ScriptKind,QuoteKind}from'ts-morph';import {transformFromAstSync}from'@babel/core';import {parse}from'@babel/parser';import Ur from'@babel/plugin-transform-typescript';import*as We from'recast';import is from'prompts';import pe from'deepmerge';import {HttpsProxyAgent}from'https-proxy-agent';import js,{Headers}from'node-fetch';import {createHash}from'crypto';import Ns from'stringify-object';import tn from'fuzzysort';var H=process.env.REGISTRY_URL??"https://ui.shadcn.com/r",k=H.replace(/\/r\/?$/,""),Ae="new-york-v4",kt=[{name:"neutral",label:"Neutral"},{name:"zinc",label:"Zinc"},{name:"stone",label:"Stone"},{name:"mauve",label:"Mauve"},{name:"olive",label:"Olive"},{name:"mist",label:"Mist"},{name:"taupe",label:"Taupe"}],N={"@shadcn":`${H}/styles/{style}/{name}.json`};var ln=[{name:"toast",deprecatedBy:"sonner",message:"The toast component is deprecated. Use the sonner component instead."},{name:"toaster",deprecatedBy:"sonner",message:"The toaster component is deprecated. Use the sonner component instead."}];function ge(e){return e.replace(/\${(\w+)}/g,(t,r)=>process.env[r]||"")}function de(e){let t=[],r=/\${(\w+)}/g,s;for(;(s=r.exec(e))!==null;)t.push(s[1]);return t}var A={NOT_FOUND:"NOT_FOUND",GONE:"GONE",UNAUTHORIZED:"UNAUTHORIZED",FORBIDDEN:"FORBIDDEN",FETCH_ERROR:"FETCH_ERROR",NOT_CONFIGURED:"NOT_CONFIGURED",INVALID_CONFIG:"INVALID_CONFIG",MISSING_ENV_VARS:"MISSING_ENV_VARS",LOCAL_FILE_ERROR:"LOCAL_FILE_ERROR",PARSE_ERROR:"PARSE_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"},I=class extends Error{code;statusCode;context;suggestion;timestamp;cause;constructor(t,r={}){super(t),this.name="RegistryError",this.code=r.code||A.UNKNOWN_ERROR,this.statusCode=r.statusCode,this.cause=r.cause,this.context=r.context,this.suggestion=r.suggestion,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor);}toJSON(){return {name:this.name,message:this.message,code:this.code,statusCode:this.statusCode,context:this.context,suggestion:this.suggestion,timestamp:this.timestamp,stack:this.stack}}},J=class extends I{constructor(r,s){let n=`The item at ${r} was not found. It may not exist at the registry.`;super(n,{code:A.NOT_FOUND,statusCode:404,cause:s,context:{url:r},suggestion:"Check if the item name is correct and the registry URL is accessible."});this.url=r;this.name="RegistryNotFoundError";}},Oe=class extends I{constructor(r,s){let n=`The item at ${r} is no longer available. It may have been removed or expired.`;super(n,{code:A.GONE,statusCode:410,cause:s,context:{url:r},suggestion:"This resource was previously available but has been permanently removed. Check if a newer version exists or contact the registry maintainer."});this.url=r;this.name="RegistryGoneError";}},ue=class extends I{constructor(r,s){let n=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(n,{code:A.UNAUTHORIZED,statusCode:401,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}},he=class extends I{constructor(r,s){let n=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(n,{code:A.FORBIDDEN,statusCode:403,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}},ye=class extends I{constructor(r,s,n,i){let o=s?`Failed to fetch from registry (${s}): ${r}`:`Failed to fetch from registry: ${r}`,a=typeof i=="string"&&i?`${o} - ${i}`:o,l="Check your network connection and try again.";s===404?l="The requested resource was not found. Check the URL or item name.":s===500?l="The registry server encountered an error. Try again later.":s&&s>=400&&s<500&&(l="There was a client error. Check your request parameters.");super(a,{code:A.FETCH_ERROR,statusCode:s,cause:i,context:{url:r,responseBody:n},suggestion:l});this.url=r;this.responseBody=n;this.name="RegistryFetchError";}},W=class extends I{constructor(r){let s=r?`Unknown registry "${r}". Make sure it is defined in components.json as follows:
|
|
2
|
-
{
|
|
3
|
-
"registries": {
|
|
4
|
-
"${r}": "[URL_TO_REGISTRY]"
|
|
5
|
-
}
|
|
6
|
-
}`:'Unknown registry. Make sure it is defined in components.json under "registries".';super(s,{code:A.NOT_CONFIGURED,context:{registryName:r},suggestion:"Add the registry configuration to your components.json file. Consult the registry documentation for the correct format."});this.registryName=r;this.name="RegistryNotConfiguredError";}},te=class extends I{constructor(r,s){super(`Failed to read local registry file: ${r}`,{code:A.LOCAL_FILE_ERROR,cause:s,context:{filePath:r},suggestion:"Check if the file exists and you have read permissions."});this.filePath=r;this.name="RegistryLocalFileError";}},$=class extends I{constructor(r,s){let n=`Failed to parse registry item: ${r}`;s instanceof z.ZodError&&(n=`Failed to parse registry item: ${r}
|
|
7
|
-
${s.errors.map(i=>` - ${i.path.join(".")}: ${i.message}`).join(`
|
|
8
|
-
`)}`);super(n,{code:A.PARSE_ERROR,cause:s,context:{item:r},suggestion:`The registry item may be corrupted or have an invalid format. Please make sure it returns a valid JSON object. See ${k}/schema/registry-item.json.`});this.item=r;this.parseError=s,this.name="RegistryParseError";}parseError},xe=class extends I{constructor(r,s){let n=`Registry "${r}" requires the following environment variables:
|
|
9
|
-
|
|
10
|
-
`+s.map(i=>` \u2022 ${i}`).join(`
|
|
11
|
-
`);super(n,{code:A.MISSING_ENV_VARS,context:{registryName:r,missingVars:s},suggestion:"Set the required environment variables to your .env or .env.local file."});this.registryName=r;this.missingVars=s;this.name="RegistryMissingEnvironmentVariablesError";}},we=class extends I{constructor(r){let s=`Invalid registry namespace: "${r}". Registry names must start with @ (e.g., @shadcn, @v0).`;super(s,{code:A.VALIDATION_ERROR,context:{name:r},suggestion:"Use a valid registry name starting with @ or provide a direct URL to the registry."});this.name=r;this.name="RegistryInvalidNamespaceError";}};var Ne=class extends I{constructor(r,s){let n=`Invalid components.json configuration in ${r}.`;s instanceof z.ZodError&&(n=`Invalid components.json configuration in ${r}:
|
|
12
|
-
${s.errors.map(i=>` - ${i.path.join(".")}: ${i.message}`).join(`
|
|
13
|
-
`)}`);super(n,{code:A.INVALID_CONFIG,cause:s,context:{cwd:r},suggestion:"Check your components.json file for syntax errors or invalid configuration. Run 'npx shadcn@latest init' to regenerate a valid configuration."});this.cwd=r;this.name="ConfigParseError";}},Ee=class extends I{parseError;constructor(t){let r="Failed to parse registries index";if(t instanceof z.ZodError){let s=t.errors.filter(n=>n.path.length>0).map(n=>`"${n.path[0]}"`).filter((n,i,o)=>o.indexOf(n)===i);s.length>0?r=`Failed to parse registries index. Invalid registry namespace(s): ${s.join(", ")}
|
|
14
|
-
${t.errors.map(n=>` - ${n.path.join(".")}: ${n.message}`).join(`
|
|
15
|
-
`)}`:r=`Failed to parse registries index:
|
|
16
|
-
${t.errors.map(n=>` - ${n.path.join(".")}: ${n.message}`).join(`
|
|
17
|
-
`)}`;}super(r,{code:A.PARSE_ERROR,cause:t,context:{parseError:t},suggestion:"The registries index may be corrupted or have invalid registry namespace format. Registry names must start with @ (e.g., @shadcn, @example)."}),this.parseError=t,this.name="RegistriesIndexParseError";}};var ur=/^(@[a-zA-Z0-9](?:[a-zA-Z0-9-_]*[a-zA-Z0-9])?)\/(.+)$/;function re(e){if(!e.startsWith("@"))return {registry:null,item:e};let t=e.match(ur);return t?{registry:t[1],item:t[2]}:{registry:null,item:e}}var O={"next-app":{name:"next-app",label:"Next.js",links:{installation:`${k}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},"next-pages":{name:"next-pages",label:"Next.js",links:{installation:`${k}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},remix:{name:"remix",label:"Remix",links:{installation:`${k}/docs/installation/remix`,tailwind:"https://tailwindcss.com/docs/guides/remix"}},"react-router":{name:"react-router",label:"React Router",links:{installation:`${k}/docs/installation/react-router`,tailwind:"https://tailwindcss.com/docs/installation/framework-guides/react-router"}},vite:{name:"vite",label:"Vite",links:{installation:`${k}/docs/installation/vite`,tailwind:"https://tailwindcss.com/docs/guides/vite"}},astro:{name:"astro",label:"Astro",links:{installation:`${k}/docs/installation/astro`,tailwind:"https://tailwindcss.com/docs/guides/astro"}},laravel:{name:"laravel",label:"Laravel",links:{installation:`${k}/docs/installation/laravel`,tailwind:"https://tailwindcss.com/docs/guides/laravel"}},"tanstack-start":{name:"tanstack-start",label:"TanStack Start",links:{installation:`${k}/docs/installation/tanstack`,tailwind:"https://tailwindcss.com/docs/installation/using-postcss"}},gatsby:{name:"gatsby",label:"Gatsby",links:{installation:`${k}/docs/installation/gatsby`,tailwind:"https://tailwindcss.com/docs/guides/gatsby"}},expo:{name:"expo",label:"Expo",links:{installation:`${k}/docs/installation/expo`,tailwind:"https://www.nativewind.dev/docs/getting-started/installation"}},manual:{name:"manual",label:"Manual",links:{installation:`${k}/docs/installation/manual`,tailwind:"https://tailwindcss.com/docs/installation"}}};var T={error:red,warn:yellow,info:cyan,success:green};async function F(e,t){return createMatchPath(t.absoluteBaseUrl,t.paths)(e,void 0,()=>true,[".ts",".tsx",".jsx",".js",".css"])}var kn="@/components",$n="@/lib/utils",An="app/globals.css",On="tailwind.config.js";var Fe=cosmiconfig("components",{searchPlaces:["components.json"]});async function ve(e){let t=await Sr(e);return t?(t.iconLibrary||(t.iconLibrary=t.style==="new-york"?"radix":"lucide"),await Le(e,t)):null}async function Le(e,t){t.registries={...N,...t.registries||{}};let r=await loadConfig(e);if(r.resultType==="failed")throw new Error(`Failed to load ${t.tsx?"tsconfig":"jsconfig"}.json. ${r.message??""}`.trim());return d$1.parse({...t,resolvedPaths:{cwd:e,tailwindConfig:t.tailwind.config?y.resolve(e,t.tailwind.config):"",tailwindCss:y.resolve(e,t.tailwind.css),utils:await F(t.aliases.utils,r),components:await F(t.aliases.components,r),ui:t.aliases.ui?await F(t.aliases.ui,r):y.resolve(await F(t.aliases.components,r)??e,"ui"),lib:t.aliases.lib?await F(t.aliases.lib,r):y.resolve(await F(t.aliases.utils,r)??e,".."),hooks:t.aliases.hooks?await F(t.aliases.hooks,r):y.resolve(await F(t.aliases.components,r)??e,"..","hooks")}})}async function Sr(e){try{let t=await Fe.search(e);if(!t)return null;let r=c$1.parse(t.config);if(r.registries){for(let s of Object.keys(r.registries))if(s in N)throw new Error(`"${s}" is a built-in registry and cannot be overridden.`)}return r}catch(t){let r=`${e}/components.json`;throw t instanceof Error&&t.message.includes("reserved registry")?t:new Error(`Invalid configuration found in ${T.info(r)}.`)}}async function Nn(e$1){let t={};for(let s of Object.keys(e$1.aliases)){if(!Ir(s,e$1))continue;let n=e$1.resolvedPaths[s],i=await br(e$1.resolvedPaths.cwd,n);if(!i){t[s]=e$1;continue}t[s]=await ve(i);}let r=e.safeParse(t);return r.success?r.data:null}async function br(e,t){let r=Tr(e,t),s=y.relative(r,t),i=(await Ke.glob("**/package.json",{cwd:r,deep:3,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/public/**"]})).map(o=>y.dirname(o)).find(o=>s.startsWith(o));return i?y.join(r,i):null}function Ir(e,t){return Object.keys(t.resolvedPaths).filter(r=>r!=="utils").includes(e)}function Tr(e,t){let r=e.split(y.sep),s=t.split(y.sep),n=[];for(let i=0;i<Math.min(r.length,s.length)&&r[i]===s[i];i++)n.push(r[i]);return n.join(y.sep)}async function $t(e,t){return (await _(e))?.tailwindVersion==="v4"?"new-york-v4":t}function Fn(e){return e?.startsWith("base-")?"base":"radix"}function At(e){let t={resolvedPaths:{cwd:process.cwd(),tailwindConfig:"",tailwindCss:"",utils:"",components:"",ui:"",lib:"",hooks:""},style:"",tailwind:{config:"",css:"",baseColor:"",cssVariables:false},rsc:false,tsx:true,aliases:{components:"",utils:""},registries:{...N}};return e?{...t,...e,resolvedPaths:{...t.resolvedPaths,...e.resolvedPaths||{}},tailwind:{...t.tailwind,...e.tailwind||{}},aliases:{...t.aliases,...e.aliases||{}},registries:{...t.registries,...e.registries||{}}}:t}function tt(e="",t=true){let r=y.join(e,"package.json");return ne.readJSONSync(r,{throws:t})}var _e=["**/node_modules/**",".next","public","dist","build"];z.object({compilerOptions:z.object({paths:z.record(z.string().or(z.array(z.string())))})});async function _(e,t){let[r,s,n,i,o,a,l,c]=await Promise.all([Ke.glob("**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*",{cwd:e,deep:3,ignore:_e}),ne.pathExists(y.resolve(e,"src")),Lr(e),Nr(e),Or(e,t?.configCssFile),Ot(e),Fr(e),tt(e,false)]),f=await ne.pathExists(y.resolve(e,`${s?"src/":""}app`)),p={framework:O.manual,isSrcDir:s,isRSC:false,isTsx:n,tailwindConfigFile:i,tailwindCssFile:o,tailwindVersion:a,frameworkVersion:null,aliasPrefix:l};if(r.find(d=>d.startsWith("next.config."))?.length)return p.framework=f?O["next-app"]:O["next-pages"],p.isRSC=f,p.frameworkVersion=await Ar(p.framework,c),p;if(r.find(d=>d.startsWith("astro.config."))?.length)return p.framework=O.astro,p;if(r.find(d=>d.startsWith("gatsby-config."))?.length)return p.framework=O.gatsby,p;if(r.find(d=>d.startsWith("composer.json"))?.length)return p.framework=O.laravel,p;if(Object.keys(c?.dependencies??{}).find(d=>d.startsWith("@remix-run/")))return p.framework=O.remix,p;if([...Object.keys(c?.dependencies??{}),...Object.keys(c?.devDependencies??{})].find(d=>d.startsWith("@tanstack/react-start")))return p.framework=O["tanstack-start"],p;if(r.find(d=>d.startsWith("react-router.config."))?.length)return p.framework=O["react-router"],p;if(r.find(d=>d.startsWith("vite.config."))?.length)return p.framework=O.vite,p;let x=r.find(d=>d.startsWith("app.config"));return x?.length&&(await ne.readFile(y.resolve(e,x),"utf8")).includes("defineConfig")?(p.framework=O.vite,p):(c?.dependencies?.expo&&(p.framework=O.expo),p)}async function Ar(e,t){if(!t||!["next-app","next-pages"].includes(e.name))return null;let r=t.dependencies?.next||t.devDependencies?.next;if(!r)return null;let s=r.match(/^[\^~]?(\d+\.\d+\.\d+)/);if(s)return s[1];let n=r.match(/(\d+\.\d+\.\d+)/);return n?n[1]:r}async function Ot(e){let[t,r]=await Promise.all([tt(e,false),ve(e)]);return r?.tailwind?.config===""?"v4":!t?.dependencies?.tailwindcss&&!t?.devDependencies?.tailwindcss?null:/^(?:\^|~)?3(?:\.\d+)*(?:-.*)?$/.test(t?.dependencies?.tailwindcss||t?.devDependencies?.tailwindcss||"")?"v3":"v4"}async function Or(e,t){if(t){let i=y.resolve(e,t);if(await ne.pathExists(i))return t}let[r,s]=await Promise.all([Ke.glob(["**/*.css","**/*.scss"],{cwd:e,deep:5,ignore:_e}),Ot(e)]);if(!r.length)return null;for(let i of r){let o=await ne.readFile(y.resolve(e,i),"utf8");if(o.includes('@import "tailwindcss"')||o.includes("@import 'tailwindcss'")||o.includes("@tailwind base"))return i}return null}async function Nr(e){let t=await Ke.glob("tailwind.config.*",{cwd:e,deep:3,ignore:_e});return t.length?t[0]:null}async function Fr(e){let t=await loadConfig(e);if(t?.resultType==="failed"||!Object.entries(t?.paths).length)return null;for(let[r,s]of Object.entries(t.paths))if(s.includes("./*")||s.includes("./src/*")||s.includes("./app/*")||s.includes("./resources/js/*"))return r.replace(/\/\*$/,"")??null;return Object.keys(t?.paths)?.[0].replace(/\/\*$/,"")??null}async function Lr(e){return (await Ke.glob("tsconfig.*",{cwd:e,deep:1,ignore:_e})).length>0}async function Xn(e,t=null){let[r,s]=await Promise.all([ve(e),t?Promise.resolve(t):_(e)]);if(r)return r;if(!s||!s.tailwindCssFile||s.tailwindVersion==="v3"&&!s.tailwindConfigFile)return null;let n={$schema:"https://ui.shadcn.com/schema.json",rsc:s.isRSC,tsx:s.isTsx,style:"new-york",tailwind:{config:s.tailwindConfigFile??"",baseColor:"zinc",css:s.tailwindCssFile,cssVariables:true,prefix:""},iconLibrary:"lucide",aliases:{components:`${s.aliasPrefix}/components`,ui:`${s.aliasPrefix}/components/ui`,hooks:`${s.aliasPrefix}/hooks`,lib:`${s.aliasPrefix}/lib`,utils:`${s.aliasPrefix}/lib/utils`}};return await Le(e,n)}async function ze(e){if(!e.resolvedPaths?.cwd)return "v3";let t=await _(e.resolvedPaths.cwd);return t?.tailwindVersion?t.tailwindVersion:null}async function ei(e){let t=await ve(e);if(!t)return [];let s=(await Le(e,t)).resolvedPaths.ui;if(!ne.existsSync(s))return [];let n=await De(),i=new Set(n?.map(a=>a.name)??[]);return (await promises.readdir(s)).filter(a=>/\.(tsx|jsx)$/.test(a)).map(a=>y.basename(a,y.extname(a))).filter(a=>i.has(a))}function Nt(e,t,r={}){let{ignoreImports:s=false}=r,n=e.replace(/\r\n/g,`
|
|
18
|
-
`).trim(),i=t.replace(/\r\n/g,`
|
|
19
|
-
`).trim();if(n===i)return true;if(!s)return false;let o=/^(import\s+(?:type\s+)?(?:\*\s+as\s+\w+|\{[^}]*\}|\w+)?(?:\s*,\s*(?:\{[^}]*\}|\w+))?\s+from\s+["'])([^"']+)(["'])/gm,a=f=>f.replace(o,(p,x,d,h)=>{if(d.startsWith("."))return `${x}${d}${h}`;let w=d.split("/"),g=w[w.length-1];return `${x}@normalized/${g}${h}`}),l=a(n),c=a(i);return l===c}function q(e){let t=y.basename(e);return /^\.env(\.|$)/.test(t)}function Lt(e){let t=[".env.local",".env",".env.development.local",".env.development"];for(let r of t){let s=y.join(e,r);if(existsSync(s))return s}return null}function ie(e){let t=e.split(`
|
|
20
|
-
`),r={};for(let s of t){let n=s.trim();if(!n||n.startsWith("#"))continue;let i=n.indexOf("=");if(i===-1)continue;let o=n.substring(0,i).trim(),a=n.substring(i+1).trim();o&&(r[o]=a.replace(/^["']|["']$/g,""));}return r}function Dt(e,t){let r=ie(e),s=ie(t),n=[];for(let i of Object.keys(s))i in r||n.push(i);return n}function Kt(e,t){let r=ie(e),s=ie(t),n=e.trimEnd();n&&!n.endsWith(`
|
|
21
|
-
`)&&(n+=`
|
|
22
|
-
`);let i=[];for(let[o,a]of Object.entries(s))o in r||i.push(`${o}=${a}`);return i.length>0?(n&&(n+=`
|
|
23
|
-
`),n+=i.join(`
|
|
24
|
-
`),n+`
|
|
25
|
-
`):n&&!n.endsWith(`
|
|
26
|
-
`)?n+`
|
|
27
|
-
`:n}var v={error(...e){console.log(T.error(e.join(" ")));},warn(...e){console.log(T.warn(e.join(" ")));},info(...e){console.log(T.info(e.join(" ")));},success(...e){console.log(T.success(e.join(" ")));},log(...e){console.log(e.join(" "));},break(){console.log("");}};function Y(e,t){return Kr({text:e,isSilent:t?.silent})}var Ve=async({sourceFile:e,config:t,isRemote:r})=>{let s=t.aliases?.utils,i=`${typeof s=="string"&&s.includes("/")?s.split("/")[0]:"@"}/lib/utils`;if(![".tsx",".ts",".jsx",".js"].includes(e.getExtension()))return e;for(let o of e.getImportStringLiterals()){let a=zr(o.getLiteralValue(),t,r);if(o.setLiteralValue(a),i===a||a==="@/lib/utils"){if(!o.getFirstAncestorByKind(SyntaxKind.ImportDeclaration)?.getNamedImports().some(f=>f.getName()==="cn")||!t.aliases.utils)continue;o.setLiteralValue(i===a?a.replace(i,t.aliases.utils):t.aliases.utils);}}return e};function zr(e,t,r=false){if(!e.startsWith("@/")&&!r)return e;if(r&&e.startsWith("@/")&&(e=e.replace(/^@\//,"@/registry/new-york/")),!e.startsWith("@/registry/")){let s=t.aliases.components.split("/")[0];return e.replace(/^@\//,`${s}/`)}return e.match(/^@\/registry\/(.+)\/ui/)?e.replace(/^@\/registry\/(.+)\/ui/,t.aliases.ui??`${t.aliases.components}/ui`):t.aliases.components&&e.match(/^@\/registry\/(.+)\/components/)?e.replace(/^@\/registry\/(.+)\/components/,t.aliases.components):t.aliases.lib&&e.match(/^@\/registry\/(.+)\/lib/)?e.replace(/^@\/registry\/(.+)\/lib/,t.aliases.lib):t.aliases.hooks&&e.match(/^@\/registry\/(.+)\/hooks/)?e.replace(/^@\/registry\/(.+)\/hooks/,t.aliases.hooks):e.replace(/^@\/registry\/[^/]+/,t.aliases.components)}var Mr={sourceType:"module",allowImportExportEverywhere:true,allowReturnOutsideFunction:true,startLine:1,tokens:true,plugins:["asyncGenerators","bigInt","classPrivateMethods","classPrivateProperties","classProperties","classStaticBlock","decimal","decorators-legacy","doExpressions","dynamicImport","exportDefaultFrom","exportNamespaceFrom","functionBind","functionSent","importAssertions","importMeta","nullishCoalescingOperator","numericSeparator","objectRestSpread","optionalCatchBinding","optionalChaining",["pipelineOperator",{proposal:"minimal"}],["recordAndTuple",{syntaxType:"hash"}],"throwExpressions","topLevelAwait","v8intrinsic","typescript","jsx"]},_t=async({sourceFile:e,config:t})=>{let r=e.getFullText();if(t.tsx)return r;let s=We.parse(r,{parser:{parse:i=>parse(i,Mr)}}),n=transformFromAstSync(s,r,{cloneInputAst:false,code:false,ast:true,plugins:[Ur],configFile:false});if(!n||!n.ast)throw new Error("Failed to transform JSX");return We.print(n.ast).code};var Hr=/^["']use client["']$/g,Ue=async({sourceFile:e,config:t})=>{if(t.rsc)return e;let r=e.getFirstChildByKind(SyntaxKind.ExpressionStatement);return r&&Hr.test(r.getText())&&r.remove(),e};var Jr=new Set(["cn-font-heading"]),Gr=/\bcn-[a-z-]+\b/;function zt(e){return Gr.test(e)&&!Jr.has(e)}function Vt(e){return e.split(/\s+/).filter(t=>t.length>0&&!zt(t)).join(" ")}function Wt(e){return e.split(/\s+/).some(zt)}function Me(e){let t=e.getLiteralValue();if(!Wt(t))return;let r=Vt(t);r!==t&&e.setLiteralValue(r);}function rt(e){for(let t of e.getDescendantsOfKind(SyntaxKind.StringLiteral))Me(t);for(let t of e.getDescendantsOfKind(SyntaxKind.NoSubstitutionTemplateLiteral))Me(t);}function qr(e){let t=[];for(let r of e.getDescendantsOfKind(SyntaxKind.JsxAttribute)){let s=r.getNameNode().getText();if(s!=="className"&&s!=="classNames")continue;let n=r.getInitializer();if(n?.isKind(SyntaxKind.StringLiteral)){let i=n.getLiteralValue();if(Wt(i)){let o=Vt(i);o===""?t.push(r):o!==i&&n.setLiteralValue(o);}}n?.isKind(SyntaxKind.JsxExpression)&&rt(n);}for(let r of t)r.remove();for(let r of e.getDescendantsOfKind(SyntaxKind.CallExpression))if(r.getExpression().getText()==="cva")for(let s of r.getArguments()){if(s.isKind(SyntaxKind.StringLiteral)){Me(s);continue}if(s.isKind(SyntaxKind.NoSubstitutionTemplateLiteral)){Me(s);continue}rt(s);}for(let r of e.getDescendantsOfKind(SyntaxKind.CallExpression))r.getExpression().getText()==="mergeProps"&&rt(r);}var Be=async({sourceFile:e})=>(qr(e),e);var He=async({sourceFile:e,config:t})=>{if(!t.tailwind?.prefix)return e;let r=await ze(t);return e.getDescendantsOfKind(SyntaxKind.CallExpression).filter(s=>s.getExpression().getText()==="cva").forEach(s=>{if(s.getArguments()[0]?.isKind(SyntaxKind.StringLiteral)){let n=s.getArguments()[0];n&&n.replaceWithText(`"${U(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}s.getArguments()[1]?.isKind(SyntaxKind.ObjectLiteralExpression)&&s.getArguments()[1]?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).find(n=>n.getName()==="variants")?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(n=>{n.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(i=>{let o=i.getInitializerIfKind(SyntaxKind.StringLiteral);o&&o?.replaceWithText(`"${U(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);});});}),e.getDescendantsOfKind(SyntaxKind.JsxAttribute).forEach(s=>{if(s.getNameNode().getText()==="className"){if(s.getInitializer()?.isKind(SyntaxKind.StringLiteral)){let n=s.getInitializer();n&&n.replaceWithText(`"${U(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}if(s.getInitializer()?.isKind(SyntaxKind.JsxExpression)){let n=s.getInitializer()?.getDescendantsOfKind(SyntaxKind.CallExpression).find(i=>i.getExpression().getText()==="cn");n&&n.getArguments().forEach(i=>{(i.isKind(SyntaxKind.ConditionalExpression)||i.isKind(SyntaxKind.BinaryExpression))&&i.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(o=>{o.replaceWithText(`"${U(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),i.isKind(SyntaxKind.StringLiteral)&&i.replaceWithText(`"${U(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);});}}s.getNameNode().getText()==="classNames"&&s.getInitializer()?.isKind(SyntaxKind.JsxExpression)&&s.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(n=>{if(n.getInitializer()?.isKind(SyntaxKind.CallExpression)){let i=n.getInitializerIfKind(SyntaxKind.CallExpression);i&&i.getArguments().forEach(o=>{o.isKind(SyntaxKind.ConditionalExpression)&&o.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(a=>{a.replaceWithText(`"${U(a.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),o.isKind(SyntaxKind.StringLiteral)&&o.replaceWithText(`"${U(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);});}if(n.getInitializer()?.isKind(SyntaxKind.StringLiteral)&&n.getNameNode().getText()!=="variant"){let i=n.getInitializer();i&&i.replaceWithText(`"${U(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}});}),e};function U(e,t="",r){return r==="v3"?e.split(" ").map(s=>{let[n,i,o]=b(s);return n?o?`${n}:${t}${i}/${o}`:`${n}:${t}${i}`:o?`${t}${i}/${o}`:`${t}${i}`}).join(" "):e.split(" ").map(s=>s.indexOf(`${t}:`)===0?s:`${t}:${s.trim()}`).join(" ")}var es=new Project({compilerOptions:{}});async function ts(e){let t=await promises.mkdtemp(y.join(tmpdir(),"shadcn-"));return y.join(t,e)}async function Mt(e,t=[Ve,Ue,a,He,d,c,Be]){let r=await ts(e.filename),s=es.createSourceFile(r,e.raw,{scriptKind:ScriptKind.TSX});for(let n of t)await n({sourceFile:s,...e});return e.transformJsx?await _t({sourceFile:s,...e}):s.getText()}var rs=["a","span","div","Link","label","Label"],Bt=async({sourceFile:e,config:t})=>{if(!t.style?.startsWith("base-"))return e;let r=10;for(let s=0;s<r;s++){let i=e.getDescendantsOfKind(SyntaxKind.JsxElement).filter(l=>l.getOpeningElement().getAttribute("asChild"));if(i.length===0)break;let o=i.filter(l=>!l.getDescendantsOfKind(SyntaxKind.JsxElement).some(f=>f.getOpeningElement().getAttribute("asChild"))),a=[];for(let l of o){let c=l.getOpeningElement(),f=c.getAttribute("asChild");if(!f)continue;let p=c.getTagNameNode().getText(),d=l.getJsxChildren().find(m=>m.getKind()===SyntaxKind.JsxElement||m.getKind()===SyntaxKind.JsxSelfClosingElement);if(!d){f.remove();continue}let h,w,g;if(d.getKind()===SyntaxKind.JsxSelfClosingElement){let m=d.asKindOrThrow(SyntaxKind.JsxSelfClosingElement);h=m.getTagNameNode().getText(),w=m.getAttributes().map(E=>E.getText()).join(" "),g="";}else {let m=d.asKindOrThrow(SyntaxKind.JsxElement),E=m.getOpeningElement();h=E.getTagNameNode().getText(),w=E.getAttributes().map(b=>b.getText()).join(" "),g=m.getJsxChildren().map(b=>b.getText()).join("");}let j=p==="Button"&&rs.includes(h);a.push({parentElement:l,parentTagName:p,childTagName:h,childProps:w,childChildren:g,needsNativeButton:j});}for(let l of a.reverse()){let f=l.parentElement.getOpeningElement().getAttributes().filter(w=>w.getKind()===SyntaxKind.JsxAttribute?w.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()!=="asChild":true).map(w=>w.getText()).join(" "),p=l.childProps?`{<${l.childTagName} ${l.childProps} />}`:`{<${l.childTagName} />}`,x=f?`${f} `:"";x+=`render=${p}`,l.needsNativeButton&&(x+=" nativeButton={false}");let d=l.childChildren.trim()?`${l.childChildren}`:"",h=`<${l.parentTagName} ${x}>${d}</${l.parentTagName}>`;l.parentElement.replaceWithText(h);}}return e};var Ht=async({sourceFile:e})=>(e.getFunctions().forEach(t=>{t.getName()==="middleware"&&t.rename("proxy");}),e.getVariableDeclarations().forEach(t=>{t.getName()==="middleware"&&t.rename("proxy");}),e.getExportDeclarations().forEach(t=>{t.getNamedExports().forEach(s=>{s.getName()==="middleware"&&s.setName("proxy"),s.getAliasNode()?.getText()==="middleware"&&s.setAlias("proxy");});}),e);async function Co(e,t,r){if(!e?.length)return {filesCreated:[],filesUpdated:[],filesSkipped:[]};r={overwrite:false,force:false,silent:false,isRemote:false,isWorkspace:false,...r};let s=Y("Updating files.",{silent:r.silent})?.start(),[n,i]=await Promise.all([_(t.resolvedPaths.cwd),t.tailwind.baseColor?Je(t.tailwind.baseColor):Promise.resolve(void 0)]),o=[],a$1=[],l=[],c$1=[],f=null;for(let h=0;h<e.length;h++){let w=e[h];if(!w.content)continue;let g$1=nt(w,t,{isSrcDir:n?.isSrcDir,framework:n?.framework.name,commonRoot:it(e.map(R=>R.path),w.path),path:r.path,fileIndex:h});if(!g$1)continue;let j=basename(w.path),m=y.dirname(g$1);if(t.tsx||(g$1=g$1.replace(/\.tsx?$/,R=>R===".tsx"?".jsx":".js")),q(g$1)&&!existsSync(g$1)){let R=Lt(m);R&&(g$1=R);}let E=existsSync(g$1);if(w.type==="registry:lib"&&basename(w.path)==="utils.ts"&&n?.framework.name==="laravel"&&E){l.push(y.relative(t.resolvedPaths.cwd,g$1));continue}if(E&&statSync(g$1).isDirectory())throw new Error(`Cannot write to ${g$1}: path exists and is a directory. Please provide a file path instead.`);let b=w.type==="registry:file"||w.type==="registry:item",S=q(g$1)||b?w.content:await Mt({filename:w.path,raw:w.content,config:t,baseColor:i,transformJsx:!t.tsx,isRemote:r.isRemote,supportedFontMarkers:r.supportedFontMarkers},[Ve,Ue,a,He,c,g,Bt,d,...Jt(g$1,n,t)?[Ht]:[],f$1,Be]);if(E&&!q(g$1)){let R=await promises.readFile(g$1,"utf-8");if(Nt(R,S,{ignoreImports:r.isWorkspace})){l.push(y.relative(t.resolvedPaths.cwd,g$1));continue}}if(E&&!r.overwrite&&!q(g$1)){s.stop(),r.rootSpinner&&r.rootSpinner.stop();let{overwrite:R}=await is({type:"confirm",name:"overwrite",message:`The file ${T.info(j)} already exists. Would you like to overwrite?`,initial:false});if(!R){l.push(y.relative(t.resolvedPaths.cwd,g$1)),r.rootSpinner&&r.rootSpinner.start();continue}s?.start(),r.rootSpinner&&r.rootSpinner.start();}if(Jt(g$1,n,t)&&(g$1=g$1.replace(/middleware\.(ts|js)$/,"proxy.$1")),existsSync(m)||await promises.mkdir(m,{recursive:true}),q(g$1)&&E){let R=await promises.readFile(g$1,"utf-8"),X=Kt(R,S);if(c$1=Dt(R,S),f=y.relative(t.resolvedPaths.cwd,g$1),!c$1.length){l.push(y.relative(t.resolvedPaths.cwd,g$1));continue}await promises.writeFile(g$1,X,"utf-8"),a$1.push(y.relative(t.resolvedPaths.cwd,g$1));continue}await promises.writeFile(g$1,S,"utf-8"),E?a$1.push(y.relative(t.resolvedPaths.cwd,g$1)):(o.push(y.relative(t.resolvedPaths.cwd,g$1)),q(g$1)&&(c$1=Object.keys(ie(S)),f=y.relative(t.resolvedPaths.cwd,g$1)));}let p=[...o,...a$1,...l],x=await ms(p,t);if(a$1.push(...x),o=Array.from(new Set(o)),a$1=Array.from(new Set(a$1.filter(h=>!o.includes(h)))),l=Array.from(new Set(l)),!(o.length||a$1.length)&&!l.length&&s?.info("No files updated."),o.length){if(s?.succeed(`Created ${o.length} ${o.length===1?"file":"files"}:`),!r.silent)for(let h of o)v.log(` - ${h}`);}else s?.stop();if(a$1.length&&(Y(`Updated ${a$1.length} ${a$1.length===1?"file":"files"}:`,{silent:r.silent})?.info(),!r.silent))for(let h of a$1)v.log(` - ${h}`);if(l.length&&(Y(`Skipped ${l.length} ${l.length===1?"file":"files"}: (files might be identical, use --overwrite to overwrite)`,{silent:r.silent})?.info(),!r.silent))for(let h of l)v.log(` - ${h}`);if(c$1.length&&f&&(Y(`Added the following variables to ${T.info(f)}:`)?.info(),!r.silent))for(let h of c$1)v.log(` ${T.success("+")} ${h}`);return {filesCreated:o,filesUpdated:a$1,filesSkipped:l}}function nt(e,t,r){if(r.path){let i=y.isAbsolute(r.path)?r.path:y.join(t.resolvedPaths.cwd,r.path);if(/\.[^/\\]+$/.test(i)){if(r.fileIndex===0)return i}else {let a=y.basename(e.path);return y.join(i,a)}}if(e.target){if(e.target.startsWith("~/"))return y.join(t.resolvedPaths.cwd,e.target.replace("~/",""));let i=e.target;return e.type==="registry:page"&&(i=fs(i,r.framework),!i)?"":r.isSrcDir?y.join(t.resolvedPaths.cwd,"src",i.replace("src/","")):y.join(t.resolvedPaths.cwd,i.replace("src/",""))}let s=cs(e,t),n=ps(e.path,s);return y.join(s,n)}function cs(e,t){return e.type==="registry:ui"?t.resolvedPaths.ui:e.type==="registry:lib"?t.resolvedPaths.lib:e.type==="registry:block"||e.type==="registry:component"?t.resolvedPaths.components:e.type==="registry:hook"?t.resolvedPaths.hooks:t.resolvedPaths.components}function it(e,t){let r=e.map(o=>o.replace(/^\//,"")),s=t.replace(/^\//,""),n=s.split("/").slice(0,-1).join("/");if(!n)return "";let i=n.split("/");for(let o=i.length;o>0;o--){let a=i.slice(0,o).join("/");if(r.some(c=>c!==s&&c.startsWith(a+"/")))return "/"+a}return "/"+n}function ps(e,t){let r=e.replace(/^\/|\/$/g,""),s=t.replace(/^\/|\/$/g,""),n=r.split("/"),i=s.split("/"),o=i[i.length-1],a=n.findIndex(l=>l===o);return a===-1?n[n.length-1]:n.slice(a+1).join("/")}function fs(e,t){if(!t)return "";if(t==="next-app")return e;if(t==="next-pages"){let r=e.replace(/^app\//,"pages/");return r=r.replace(/\/page(\.[jt]sx?)$/,"$1"),r}if(t==="react-router"){let r=e.replace(/^app\//,"app/routes/");return r=r.replace(/\/page(\.[jt]sx?)$/,"$1"),r}if(t==="laravel"){let r=e.replace(/^app\//,"resources/js/pages/");return r=r.replace(/\/page(\.[jt]sx?)$/,"$1"),r}return ""}async function ms(e,t){let r=new Project({compilerOptions:{}}),s=await _(t.resolvedPaths.cwd),n=loadConfig(t.resolvedPaths.cwd),i=[];if(!s||n.resultType==="failed")return [];for(let o of e){let a=y.resolve(t.resolvedPaths.cwd,o);if(!existsSync(a))continue;let l=await promises.readFile(a,"utf-8"),c=await promises.mkdtemp(y.join(tmpdir(),"shadcn-")),f=r.createSourceFile(y.join(c,basename(a)),l,{scriptKind:ScriptKind.TSX});if(![".tsx",".ts",".jsx",".js"].includes(f.getExtension()))continue;let p=f.getImportDeclarations();for(let x of p){let d=x.getModuleSpecifierValue();if(s?.aliasPrefix&&!d.startsWith(`${s.aliasPrefix}/`))continue;let h=await F(d,n);if(!h)continue;let w=gs(h,e,t);if(!w)continue;let g=ds(w,t,s);!g||g===d||(x.setModuleSpecifier(g),await promises.writeFile(a,f.getFullText(),"utf-8"),i.push(o));}}return i}function gs(e,t,r,s=[".tsx",".ts",".js",".jsx",".css"]){let n=y.normalize(r.resolvedPaths.cwd),i=t.map(g=>g.split(y.sep).join(y.posix.sep)),o=new Set(i),a=y.extname(e),l=a!=="",c=l?e.slice(0,-a.length):e,p=y.relative(n,c).split(y.sep).join(y.posix.sep),x=l?[a]:s,d=new Set;for(let g of x){let j=c+g,m=y.posix.normalize(y.relative(n,j));(o.has(m)||existsSync(j))&&d.add(m);let E=y.join(c,`index${g}`),b=y.posix.normalize(y.relative(n,E));(o.has(b)||existsSync(E))&&d.add(b);}let h=y.basename(c);for(let g of i)x.some(j=>g.endsWith(`/${h}${j}`))&&d.add(g);return d.size===0?null:Array.from(d).sort((g,j)=>{let m=y.posix.extname(g),E=y.posix.extname(j),b=x.indexOf(m)-x.indexOf(E);if(b!==0)return b;let S=p&&g.startsWith(p)?-1:1,R=p&&j.startsWith(p)?-1:1;return S-R})[0]}function ds(e,t,r){let s=y.normalize(y.join(t.resolvedPaths.cwd,e)),n=Object.entries(t.resolvedPaths).filter(([,h])=>h&&s.startsWith(y.normalize(h+y.sep))).sort((h,w)=>w[1].length-h[1].length);if(n.length===0)return null;let[i,o]=n[0],a=y.relative(o,s);a=a.split(y.sep).join("/");let l=y.posix.extname(a),f=[".ts",".tsx",".js",".jsx"].includes(l)?"":l,p=a.slice(0,a.length-l.length);p.endsWith("/index")&&(p=p.slice(0,-6));let x=i==="cwd"?r.aliasPrefix:t.aliases[i];if(!x)return null;let d=p===""?"":`/${p}`;return d=d.replace("/src",""),`${x}${d}${f}`}function Jt(e,t,r){let s=e===y.join(r.resolvedPaths.cwd,"middleware.ts")||e===y.join(r.resolvedPaths.cwd,"middleware.js"),n=t?.framework.name==="next-app"||t?.framework.name==="next-pages";if(!s||!n||!t?.frameworkVersion)return false;let i=parseInt(t.frameworkVersion.split(".")[0]);return !isNaN(i)&&i>=16}new Project({compilerOptions:{}});function L(e){try{return new URL(e),!0}catch{return false}}function ae(e){return e.endsWith(".json")&&!L(e)}function Ko(e){return !e||e.type!=="registry:item"&&e.type!=="registry:file"?false:(e.files??[]).every(r=>!!r.target&&(r.type==="registry:file"||r.type==="registry:item"))}async function qt(e,t){if(!hs(t))return z.array(g$1).parse(e.flat().filter(Boolean));let r=await _(t.resolvedPaths.cwd),s=new Map,n=z.array(g$1).parse(e.flat().filter(Boolean));return n.forEach(i=>{let o=nt(i,t,{isSrcDir:r?.isSrcDir,framework:r?.framework.name,commonRoot:it(n.map(a=>a.path),i.path)});o&&s.set(o,i);}),Array.from(s.values())}function hs(e){return !!(e?.resolvedPaths?.cwd&&(e?.resolvedPaths?.ui||e?.resolvedPaths?.lib||e?.resolvedPaths?.components||e?.resolvedPaths?.hooks))}function xs(e){return e.style?e.style==="new-york"&&e.tailwind?.config===""?Ae:e.style:Ae}function le(e){let t=At({style:Ae,registries:N});return e?d$1.parse(pe(t,{...e,style:xs(e),registries:{...N,...e.registries}})):t}var Ge={headers:{}};function Re(e){Ge.headers={...Ge.headers,...e};}function Yt(e){return Ge.headers[e]||{}}function Ce(){Ge.headers={};}function ws(e){let t=new Set;return typeof e=="string"?de(e).forEach(r=>t.add(r)):(de(e.url).forEach(r=>t.add(r)),e.params&&Object.values(e.params).forEach(r=>{de(r).forEach(s=>t.add(s));}),e.headers&&Object.values(e.headers).forEach(r=>{de(r).forEach(s=>t.add(s));})),Array.from(t)}function Zt(e,t){let s=ws(t).filter(n=>!process.env[n]);if(s.length>0)throw new xe(e,s)}function Xo(e,t){for(let r of e)ce(r,le(t));Ce();}var Qt="{name}",qe="{style}",Xt=/\${(\w+)}/g,er="?",Es="&";function vs(e){return e.startsWith("./")||e.startsWith("/")}function ce(e,t){let{registry:r,item:s}=re(e);if(!r){if(L(e)||ae(e)||vs(e))return null;r="@shadcn";}let i={...N,...t?.registries}[r];if(!i)throw new W(r);return Zt(r,i),{url:Rs(s,i,t),headers:Cs(i)}}function Rs(e,t,r){if(typeof t=="string"){let n=t.replace(Qt,e);return r?.style&&n.includes(qe)&&(n=n.replace(qe,r.style)),ge(n)}let s=t.url.replace(Qt,e);return r?.style&&s.includes(qe)&&(s=s.replace(qe,r.style)),s=ge(s),t.params?Ss(s,t.params):s}function Cs(e){if(typeof e=="string"||!e.headers)return {};let t={};for(let[r,s]of Object.entries(e.headers)){let n=ge(s);bs(s,n)&&(t[r]=n);}return t}function Ss(e,t){let r=new URLSearchParams;for(let[i,o]of Object.entries(t)){let a=ge(o);a&&r.append(i,a);}let s=r.toString();if(!s)return e;let n=e.includes(er)?Es:er;return `${e}${n}${s}`}function bs(e,t){let r=t.trim();if(!r)return false;if(e.includes("${")&&e.match(Xt)){let n=e.replace(Xt,"").trim();return r!==n}return true}function Ye(e){if(L(e)){let t=new URL(e);return t.pathname.match(/\/chat\/b\//)&&!t.pathname.endsWith("/json")&&(t.pathname=`${t.pathname}/json`),t.toString()}return `${H}/${e}`}var $s=process.env.https_proxy?new HttpsProxyAgent(process.env.https_proxy):void 0,ot=new Map;async function P(e,t={}){t={useCache:true,...t};try{return await Promise.all(e.map(async s=>{let n=Ye(s);if(t.useCache&&ot.has(n))return ot.get(n);let i=(async()=>{let o=Yt(n),a=new Headers({Accept:"application/vnd.shadcn.v1+json, application/json;q=0.9","User-Agent":"shadcn"});for(let[c,f]of Object.entries(o))a.set(c,f);let l=await js(n,{agent:$s,headers:a});if(!l.ok){let c;if(l.headers.get("content-type")?.includes("application/json")){let f=await l.json(),p=z.object({detail:z.string().optional(),title:z.string().optional(),message:z.string().optional(),error:z.string().optional()}).safeParse(f);p.success&&(c=p.data.detail||p.data.message,p.data.error&&(c=`[${p.data.error}] ${c}`));}throw l.status===401?new ue(n,c):l.status===404?new J(n,c):l.status===410?new Oe(n,c):l.status===403?new he(n,c):new ye(n,l.status,c)}return l.json()})();return t.useCache&&ot.set(n,i),i}))}catch(r){throw r}}async function rr(e){try{let t=e;e.startsWith("~/")&&(t=y.join(homedir(),e.slice(2)));let r=y.resolve(t),s=await promises.readFile(r,"utf8"),n$1=JSON.parse(s);try{return n.parse(n$1)}catch(i){throw new $(e,i)}}catch(t){throw t instanceof Error&&(t.message.includes("ENOENT")||t.message.includes("no such file"))?new te(e,t):t instanceof $?t:new te(e,t)}}async function $a(e,t,r){if(!e||(r={silent:false,tailwindVersion:"v3",...r},r.tailwindVersion==="v4"))return;let s=y.relative(t.resolvedPaths.cwd,t.resolvedPaths.tailwindConfig),n=Y(`Updating ${T.info(s)}`,{silent:r.silent}).start(),i=await promises.readFile(t.resolvedPaths.tailwindConfig,"utf8"),o=await Ds(i,e,t);await promises.writeFile(t.resolvedPaths.tailwindConfig,o,"utf8"),n?.succeed();}async function Ds(e,t,r){let s=await nr(e,r),n=s.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression).find(o=>o.getProperties().some(a=>a.isKind(SyntaxKind.PropertyAssignment)&&a.getName()==="content"));if(!n)return e;let i=Vs(n);return Ks(n,{name:"darkMode",value:"class"},{quoteChar:i}),t.plugins?.forEach(o=>{zs(n,o);}),t.theme&&await _s(n,t.theme),s.getFullText()}function Ks(e,t,{quoteChar:r}){let s=e.getProperty("darkMode");if(!s){let n={name:t.name,initializer:`[${r}${t.value}${r}]`};return t.name==="darkMode"?(e.insertPropertyAssignment(0,n),e):(e.addPropertyAssignment(n),e)}if(s.isKind(SyntaxKind.PropertyAssignment)){let n=s.getInitializer(),i=`${r}${t.value}${r}`;if(n?.isKind(SyntaxKind.StringLiteral)){let o=n.getText();return n.replaceWithText(`[${o}, ${i}]`),e}if(n?.isKind(SyntaxKind.ArrayLiteralExpression)){if(n.getElements().map(o=>o.getText()).includes(i))return e;n.addElement(i);}return e}return e}async function _s(e,t){e.getProperty("theme")||e.addPropertyAssignment({name:"theme",initializer:"{}"}),lt(e);let s=(e.getPropertyOrThrow("theme")?.asKindOrThrow(SyntaxKind.PropertyAssignment)).getInitializer();if(s?.isKind(SyntaxKind.ObjectLiteralExpression)){let n=s.getText(),i=await Ws(n),o=pe(i,t,{arrayMerge:(l,c)=>c}),a=Ns(o).replace(/\'\.\.\.(.*)\'/g,"...$1").replace(/\'\"/g,"'").replace(/\"\'/g,"'").replace(/\'\[/g,"[").replace(/\]\'/g,"]").replace(/\'\\\'/g,"'").replace(/\\\'/g,"'").replace(/\\\'\'/g,"'").replace(/\'\'/g,"'");s.replaceWithText(a);}ct(e);}function zs(e,t){let r=e.getProperty("plugins");if(!r)return e.addPropertyAssignment({name:"plugins",initializer:`[${t}]`}),e;if(r.isKind(SyntaxKind.PropertyAssignment)){let s=r.getInitializer();if(s?.isKind(SyntaxKind.ArrayLiteralExpression)){if(s.getElements().map(n=>n.getText().replace(/["']/g,"")).includes(t.replace(/["']/g,"")))return e;s.addElement(t);}return e}return e}async function nr(e,t){let r=await promises.mkdtemp(y.join(tmpdir(),"shadcn-")),s=t?.resolvedPaths?.tailwindConfig||"tailwind.config.ts",n=y.join(r,`shadcn-${y.basename(s)}`);return new Project({compilerOptions:{}}).createSourceFile(n,e,{scriptKind:y.extname(s)===".ts"?ScriptKind.TS:ScriptKind.JS})}function Vs(e){return e.getFirstDescendantByKind(SyntaxKind.StringLiteral)?.getQuoteKind()===QuoteKind.Single?"'":'"'}function lt(e){let t=e.getProperties();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.SpreadAssignment)){let n=s.asKindOrThrow(SyntaxKind.SpreadAssignment),i=n.getExpression().getText();e.insertPropertyAssignment(r,{name:`"___${i.replace(/^\.\.\./,"")}"`,initializer:`"...${i.replace(/^\.\.\./,"")}"`}),n.remove();}else if(s.isKind(SyntaxKind.PropertyAssignment)){let i=s.asKindOrThrow(SyntaxKind.PropertyAssignment).getInitializer();i&&i.isKind(SyntaxKind.ObjectLiteralExpression)?lt(i.asKindOrThrow(SyntaxKind.ObjectLiteralExpression)):i&&i.isKind(SyntaxKind.ArrayLiteralExpression)&&ir(i.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function ir(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))lt(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))ir(s.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));else if(s.isKind(SyntaxKind.SpreadElement)){let n=s.getText();e.removeElement(r),e.insertElement(r,`"${n}"`);}}}function ct(e){let t=e.getProperties();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.PropertyAssignment)){let n=s,i=n.getInitializer();if(i&&i.isKind(SyntaxKind.StringLiteral)){let o=i.asKindOrThrow(SyntaxKind.StringLiteral).getLiteralValue();o.startsWith("...")&&(e.insertSpreadAssignment(r,{expression:o.slice(3)}),n.remove());}else i?.isKind(SyntaxKind.ObjectLiteralExpression)?ct(i):i&&i.isKind(SyntaxKind.ArrayLiteralExpression)&&or(i.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function or(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))ct(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))or(s.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));else if(s.isKind(SyntaxKind.StringLiteral)){let n=s.getText(),i=/(?:^['"])(\.\.\..*)(?:['"]$)/g;i.test(n)&&(e.removeElement(r),e.insertElement(r,n.replace(i,"$1")));}}}async function Ws(e){let r=(await nr(`const theme = ${e}`,null)).getStatements()[0];if(r?.getKind()===SyntaxKind.VariableStatement){let n=(r.getDeclarationList()?.getDeclarations()[0]).getInitializer();if(n?.isKind(SyntaxKind.ObjectLiteralExpression))return await Ze(n)}throw new Error("Invalid input: not an object literal")}function Ze(e){let t={};for(let r of e.getProperties())if(r.isKind(SyntaxKind.PropertyAssignment)){let s=r.getName().replace(/\'/g,"");r.getInitializer()?.isKind(SyntaxKind.ObjectLiteralExpression)?t[s]=Ze(r.getInitializer()):r.getInitializer()?.isKind(SyntaxKind.ArrayLiteralExpression)?t[s]=ar(r.getInitializer()):t[s]=pt(r.getInitializer());}return t}function ar(e){let t=[];for(let r of e.getElements())r.isKind(SyntaxKind.ObjectLiteralExpression)?t.push(Ze(r.asKindOrThrow(SyntaxKind.ObjectLiteralExpression))):r.isKind(SyntaxKind.ArrayLiteralExpression)?t.push(ar(r.asKindOrThrow(SyntaxKind.ArrayLiteralExpression))):t.push(pt(r));return t}function pt(e){switch(e.getKind()){case SyntaxKind.StringLiteral:return e.getText();case SyntaxKind.NumericLiteral:return Number(e.getText());case SyntaxKind.TrueKeyword:return true;case SyntaxKind.FalseKeyword:return false;case SyntaxKind.NullKeyword:return null;case SyntaxKind.ArrayLiteralExpression:return e.getElements().map(pt);case SyntaxKind.ObjectLiteralExpression:return Ze(e);default:return e.getText()}}function lr(e){let t={};for(let r of Object.keys(e)){let s=r.split("-"),n=s[0],i=s.slice(1).join("-");i===""?typeof t[n]=="object"?t[n].DEFAULT=`hsl(var(--${r}))`:t[n]=`hsl(var(--${r}))`:(typeof t[n]!="object"&&(t[n]={DEFAULT:`hsl(var(--${n}))`}),t[n][i]=`hsl(var(--${r}))`);}for(let[r,s]of Object.entries(t))typeof s=="object"&&s.DEFAULT===`hsl(var(--${r}))`&&!(r in e)&&delete s.DEFAULT;return t}function Ie(e,t){let r={},s=[...e];if(!t?.registries)return Re({}),s;for(let n=0;n<s.length;n++){let i=ce(s[n],t);i&&(s[n]=i.url,Object.keys(i.headers).length>0&&(r[i.url]=i.headers));}return Re(r),s}async function Z(e,t,r={}){return await Promise.all(e.map(async n$1=>{if(ae(n$1))return rr(n$1);if(L(n$1)){let[a]=await P([n$1],r);try{return n.parse(a)}catch(l){throw new $(n$1,l)}}if(n$1.startsWith("@")&&t?.registries){let a=Ie([n$1],t),[l]=await P(a,r);try{return n.parse(l)}catch(c){throw new $(n$1,c)}}let i=`styles/${t?.style??"new-york-v4"}/${n$1}.json`,[o]=await P([i],r);try{return n.parse(o)}catch(a){throw new $(n$1,a)}}))}m.extend({type:f,_source:z.string().optional(),font:l.optional(),config:z.any().optional()}).passthrough();async function pr(e,t$1,r={}){r={useCache:true,...r};let s=[],n$1=[],i=[],o=Array.from(new Set(e)),a=await Z(o,t$1,r),l=new Map;for(let m=0;m<a.length;m++)a[m]&&l.set(o[m],a[m]);for(let[m,E]of Array.from(l.entries())){let b={...E,_source:m};if(s.push(b),E.registryDependencies){let S=E.registryDependencies;if(t$1?.registries)S=Ie(E.registryDependencies,t$1);else {let ee=E.registryDependencies.filter(me=>me.startsWith("@"));if(ee.length>0){let{registry:me}=re(ee[0]);throw new W(me)}}let{items:R,registryNames:X}=await Te(S,t$1,r,new Set(o));n$1.push(...R),i.push(...X);}}if(s.push(...n$1),i.length>0){let m=Array.from(new Set(i)),E=m.filter(S=>!S.startsWith("@")),b=m.filter(S=>S.startsWith("@"));if(b.length>0){let S=await Z(b,t$1,r);for(let R=0;R<S.length;R++){let ee={...S[R],_source:b[R]};s.push(ee);}}if(E.length>0){let S=await De();if(!S&&s.length===0)return null;if(S){E.includes("index")&&E.unshift("index");let R=[];for(let gr of E){let dr=await Ms(gr,t$1,r);R.push(...dr);}let X=Array.from(new Set(R)),ee=await P(X,r),me=z.array(n).parse(ee);s.push(...me);}}}if(!s.length)return null;if((o.includes("index")||i.includes("index"))&&t$1.tailwind.baseColor){let m=await Bs(t$1.tailwind.baseColor,t$1);m&&s.unshift(m);}let c=new Map;s.forEach(m=>{let E=m._source||m.name;c.set(m,E);}),s=Js(s,c),s.sort((m,E)=>m.type==="registry:theme"&&E.type!=="registry:theme"?-1:m.type!=="registry:theme"&&E.type==="registry:theme"?1:0);let f={};s.forEach(m=>{f=pe(f,m.tailwind??{});});let p={};s.forEach(m=>{p=pe(p,m.cssVars??{});});let x={};s.forEach(m=>{x=pe(x,m.css??{});});let d="";s.forEach(m=>{m.docs&&(d+=`${m.docs}
|
|
28
|
-
`);});let h={};s.forEach(m=>{h=pe(h,m.envVars??{});});let w=await qt(s.map(m=>m.files??[]),t$1),g=s.filter(m=>m.type==="registry:font"&&m.font).map(m=>({...m,type:"registry:font",font:m.font})),j=t.parse({dependencies:pe.all(s.map(m=>m.dependencies??[])),devDependencies:pe.all(s.map(m=>m.devDependencies??[])),files:w,tailwind:f,cssVars:p,css:x,docs:d,fonts:g.length>0?g:void 0});return Object.keys(h).length>0&&(j.envVars=h),j}async function Te(e,t,r={},s=new Set){let n=[],i=[];for(let o of e)if(!s.has(o)){if(s.add(o),L(o)||ae(o)){let[a]=await Z([o],t,r);if(a&&(n.push(a),a.registryDependencies)){let l=t?.registries?Ie(a.registryDependencies,t):a.registryDependencies,c=await Te(l,t,r,s);n.push(...c.items),i.push(...c.registryNames);}}else if(o.startsWith("@")&&t?.registries){let{registry:a}=re(o);if(a&&!(a in t.registries))throw new W(a);let[l]=await Z([o],t,r);if(l&&(n.push(l),l.registryDependencies)){let c=t?.registries?Ie(l.registryDependencies,t):l.registryDependencies,f=await Te(c,t,r,s);n.push(...f.items),i.push(...f.registryNames);}}else if(i.push(o),t)try{let[a]=await Z([o],t,r);if(a&&a.registryDependencies){let l=t?.registries?Ie(a.registryDependencies,t):a.registryDependencies,c=await Te(l,t,r,s);n.push(...c.items),i.push(...c.registryNames);}}catch{}}return {items:n,registryNames:i}}async function Ms(e,t,r={}){if(L(e))return [e];let{registryNames:s}=await Te([e],t,r,new Set),n=t.resolvedPaths?.cwd?await $t(t.resolvedPaths.cwd,t.style):t.style,i=s.map(o=>Ye(L(o)?o:`styles/${n}/${o}.json`));return Array.from(new Set(i))}async function Bs(e,t){let[r,s]=await Promise.all([Je(e),ze(t)]);if(!r)return null;let n={name:e,type:"registry:theme",tailwind:{config:{theme:{extend:{borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},colors:{}}}}},cssVars:{theme:{},light:{radius:"0.5rem"},dark:{}}};return t.tailwind.cssVariables&&(n.tailwind.config.theme.extend.colors={...n.tailwind.config.theme.extend.colors,...lr(r.cssVars.dark??{})},n.cssVars={theme:{...r.cssVars.theme,...n.cssVars.theme},light:{...r.cssVars.light,...n.cssVars.light},dark:{...r.cssVars.dark,...n.cssVars.dark}},s==="v4"&&r.cssVarsV4&&(n.cssVars={theme:{...r.cssVarsV4.theme,...n.cssVars.theme},light:{radius:"0.625rem",...r.cssVarsV4.light},dark:{...r.cssVarsV4.dark}})),n}function B(e,t){let r=t||e.name,s=createHash("sha256").update(r).digest("hex").substring(0,8);return `${e.name}::${s}`}function Hs(e){if(L(e)){let s=new URL(e).pathname,n=s.match(/\/([^/]+)\.json$/),i=n?n[1]:y.basename(s,".json");return {name:i,hash:B({name:i},e)}}if(ae(e)){let r=e.match(/\/([^/]+)\.json$/),s=r?r[1]:y.basename(e,".json");return {name:s,hash:B({name:s},e)}}let{item:t}=re(e);return {name:t,hash:B({name:t},e)}}function Js(e,t){let r=new Map,s=new Map,n=new Map,i=new Map;e.forEach(c=>{let f=t.get(c)||c.name,p=B(c,f);r.set(p,c),s.set(p,c),n.set(p,0),i.set(p,[]);});let o=new Map;e.forEach(c=>{let f=t.get(c)||c.name,p=B(c,f);o.has(c.name)||o.set(c.name,[]),o.get(c.name).push(p),f!==c.name&&(o.has(f)||o.set(f,[]),o.get(f).push(p));}),e.forEach(c=>{let f=t.get(c)||c.name,p=B(c,f);c.registryDependencies&&c.registryDependencies.forEach(x=>{let d,h=o.get(x)||[];if(h.length===1)d=h[0];else if(h.length>1)d=h[0];else {let{name:w}=Hs(x),g=o.get(w)||[];g.length>0&&(d=g[0]);}d&&r.has(d)&&(i.get(d).push(p),n.set(p,n.get(p)+1));});});let a=[],l=[];for(n.forEach((c,f)=>{c===0&&a.push(f);});a.length>0;){let c=a.shift(),f=r.get(c);l.push(f),i.get(c).forEach(p=>{let x=n.get(p)-1;n.set(p,x),x===0&&a.push(p);});}if(l.length!==e.length){let c=new Set(l.map(f=>{let p=t.get(f)||f.name;return B(f,p)}));e.forEach(f=>{let p=t.get(f)||f.name,x=B(f,p);c.has(x)||l.push(f);});}return l}function fe(e){if(v.break(),v.error("Something went wrong. Please check the error below for more details."),v.error("If the problem persists, please open an issue on GitHub."),v.error(""),typeof e=="string"&&(v.error(e),v.break(),process.exit(1)),e instanceof I&&(e.message&&(v.error(e.cause?"Error:":"Message:"),v.error(e.message)),e.cause&&(v.error(`
|
|
29
|
-
Message:`),v.error(e.cause)),e.suggestion&&(v.error(`
|
|
30
|
-
Suggestion:`),v.error(e.suggestion)),v.break(),process.exit(1)),e instanceof z.ZodError){v.error("Validation failed:");for(let[t,r]of Object.entries(e.flatten().fieldErrors))v.error(`- ${T.info(t)}: ${r}`);v.break(),process.exit(1);}e instanceof Error&&(v.error(e.message),v.break(),process.exit(1)),v.break(),process.exit(1);}async function mt(e,t){let{config:r,useCache:s}=t||{};if(L(e)){let[a]=await P([e],{useCache:s});try{return o.parse(a)}catch(l){throw new $(e,l)}}if(!e.startsWith("@"))throw new we(e);let n=e;n.endsWith("/registry")||(n=`${n}/registry`);let i=ce(n,le(r));if(!i?.url)throw new J(n);i.headers&&Object.keys(i.headers).length>0&&Re({[i.url]:i.headers});let[o$1]=await P([i.url],{useCache:s});try{return o.parse(o$1)}catch(a){throw new $(n,a)}}async function Ys(e,t){let{config:r,useCache:s=false}=t||{};return Ce(),Z(e,le(r),{useCache:s})}async function Zs(e,t){let{config:r,useCache:s=false}=t||{};return Ce(),pr(e,le(r),{useCache:s})}async function wl(e,t){let{useCache:r=true}=t||{};r||Fe.clearCaches();let s=await Fe.search(e);if(!s)return {registries:N};let n=z.object({registries:b$1.optional()}).safeParse(s.config);if(!n.success)throw new Ne(e,n.error);return {registries:{...N,...n.data.registries||{}}}}async function De(){try{let[e]=await P(["index.json"]);return p.parse(e)}catch(e){v.error(`
|
|
31
|
-
`),fe(e);}}async function El(){try{let[e]=await P(["styles/index.json"]);return q$1.parse(e)}catch(e){return v.error(`
|
|
32
|
-
`),fe(e),[]}}async function vl(){try{let[e]=await P(["icons/index.json"]);return r.parse(e)}catch(e){return fe(e),{}}}async function Rl(){return kt}async function Je(e){try{let[t]=await P([`colors/${e}.json`]);return s.parse(t)}catch(t){fe(t);}}async function Qs(e,t){let r=[];for(let s of t){let n=e.find(i=>i.name===s);if(n&&(r.push(n),n.registryDependencies)){let i=await Qs(e,n.registryDependencies);r.push(...i);}}return r.filter((s,n,i)=>i.findIndex(o=>o.name===s.name)===n)}async function Cl(e,t){try{let r=t.map(n=>`styles/${e}/${n.name}.json`);return (await P(r)).map(n$1=>n.parse(n$1))}catch(r){return fe(r),[]}}async function Sl(e,t,r){if(r)return r;if(t.type==="registry:ui")return e.resolvedPaths.ui??e.resolvedPaths.components;let[s,n]=t.type?.split(":")??[];return s in e.resolvedPaths?y.join(e.resolvedPaths[s],n):null}async function mr(e){e={useCache:true,...e};let t=`${H}/registries.json`,[r]=await P([t],{useCache:e.useCache});try{return x.parse(r)}catch(s){throw s instanceof z.ZodError?new Ee(s):s}}async function Xs(e){let t=await mr(e);return t?Object.fromEntries(t.map(r=>[r.name,r.url])):null}async function en(e){e={useCache:true,...e};let t=`${H}/config.json`,[r]=await P([t],{useCache:e.useCache});return z$1.parse(r).presets}async function bl(e,t){return (await en(t)).find(s=>s.name.toLowerCase()===e.toLowerCase())??null}async function rn(e,t){let{query:r,limit:s,offset:n,config:i,useCache:o}=t||{},a=[];for(let x of e){let h=((await mt(x,{config:i,useCache:o})).items||[]).map(w=>({name:w.name,type:w.type,description:w.description,registry:x,addCommandArgument:an(w.name,x)}));a=a.concat(h);}r&&(a=nn(a,{query:r,limit:a.length,keys:["name","description"]}));let l=n||0,c=s||a.length,f=a.length,p={pagination:{total:f,offset:l,limit:c,hasMore:l+c<f},items:a.slice(l,l+c)};return v$1.parse(p)}var sn=z.object({name:z.string(),type:z.string().optional(),description:z.string().optional(),registry:z.string().optional(),addCommandArgument:z.string().optional()}).passthrough();function nn(e,t){t={limit:100,threshold:-1e4,...t};let s=tn.go(t.query,e,{keys:t.keys,threshold:t.threshold,limit:t.limit}).map(n=>n.obj);return z.array(sn).parse(s)}function on(e){try{return new URL(e),!0}catch{return false}}function an(e,t){if(!on(t))return `${t}/${e}`;let r=t.indexOf("://")+3,s=t.indexOf("/",r);if(s===-1){let x=t.indexOf("?",r);if(x!==-1){let d=t.substring(0,x),w=t.substring(x).replace(/\bregistry\b/g,e);return d+w}return t}let n=t.substring(0,s),i=t.substring(s),o=i.indexOf("?")!==-1?i.indexOf("?"):i.length,a=i.substring(0,o),l=i.substring(o),c=a.lastIndexOf("registry"),f=a;c!==-1&&(f=a.substring(0,c)+e+a.substring(c+8));let p=l.replace(/\bregistry\b/g,e);return n+f+p}
|
|
33
|
-
export{fe as $,He as A,Mt as B,Bt as C,Co as D,nt as E,it as F,L as G,Ko as H,kn as I,$n as J,An as K,On as L,Fe as M,ve as N,Le as O,Nn as P,br as Q,Tr as R,Fn as S,At as T,le as U,Ce as V,Xo as W,ce as X,$a as Y,Z,pr as _,T as a,mt as aa,v as b,Ys as ba,k as c,Zs as ca,N as d,wl as da,ln as e,De as ea,I as f,El as fa,J as g,vl as ga,ue as h,Rl as ha,he as i,Je as ia,ye as j,Qs as ja,W as k,Cl as ka,te as l,Sl as la,$ as m,mr as ma,xe as n,Xs as na,we as o,en as oa,Ee as p,bl as pa,re as q,tt as qa,Nt as r,_ as ra,q as s,Xn as sa,Lt as t,ze as ta,Dt as u,ei as ua,Kt as v,rn as va,Y as w,Ve as x,Ue as y,Be as z};
|