shadcn 4.15.0 → 4.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,145 @@
1
+ import {c as c$2}from'./chunk-2XFBGS5K.js';import {m,f,l,b,d as d$1,c as c$1,e,n,u,q as q$1,r,s,t,z as z$2,B,o,g,p,x}from'./chunk-MTWZIHEW.js';import {a,d,c,b as b$1,g as g$1,f as f$1}from'./chunk-7SBJAAAY.js';import Do,{promises,existsSync,statSync}from'fs';import*as S from'path';import S__default,{join,basename,normalize,delimiter,resolve,dirname}from'path';import {z as z$1}from'zod';import {green,cyan,yellow,red}from'kleur/colors';import X from'fs-extra';import Wt from'fast-glob';import {loadConfig,createMatchPath}from'tsconfig-paths';import {cosmiconfig}from'cosmiconfig';import pf,{tmpdir,homedir}from'os';import gc from'ora';import {Project,SyntaxKind,ScriptKind,VariableDeclarationKind,QuoteKind}from'ts-morph';import {transformFromAstSync}from'@babel/core';import {parse}from'@babel/parser';import Ec from'@babel/plugin-transform-typescript';import*as qt from'recast';import Vc from'prompts';import {AsyncLocalStorage}from'async_hooks';import Ge from'deepmerge';import {createHash}from'crypto';import {EnvHttpProxyAgent}from'undici';import {execa}from'execa';import ru from'stringify-object';import ne,{cwd}from'process';import ef from'readline';import ff from'events';import*as Vi from'fs/promises';import Vi__default from'fs/promises';import {createRequire}from'module';import {spawn}from'child_process';import {PassThrough}from'stream';import df from'tty';import A from'postcss';import vp from'postcss/lib/at-rule';import {twMerge}from'tailwind-merge';import Rd from'fuzzysort';var Pe=process.env.REGISTRY_URL??"https://ui.shadcn.com/r",L=Pe.replace(/\/r\/?$/,""),$t="new-york-v4",xn=[{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"}],H={"@shadcn":`${Pe}/styles/{style}/{name}.json`};var Jd=[{name:"toast",deprecatedBy:"sonner",message:"The toast component is only available for Base UI projects. Use the sonner component instead.",availableIn:["base"]},{name:"toaster",deprecatedBy:"sonner",message:"The toaster component is deprecated. Use the sonner component instead."}],Yd=[{name:"sonner",hiddenIn:["base"]}];var D={NETWORK_ERROR:"NETWORK_ERROR",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"},_=class extends Error{code;statusCode;context;suggestion;timestamp;cause;constructor(t,r={}){super(t),this.name="RegistryError",this.code=r.code||D.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}}},Te=class extends _{constructor(r,s){let n=`The item at ${r} was not found. It may not exist at the registry.`;super(n,{code:D.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";}},Pt=class extends _{constructor(r,s){let n=`The item at ${r} is no longer available. It may have been removed or expired.`;super(n,{code:D.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";}},tt=class extends _{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:D.UNAUTHORIZED,statusCode:401,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}},rt=class extends _{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:D.FORBIDDEN,statusCode:403,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}},st=class extends _{constructor(r,s,n,i){let o=s?`Failed to fetch from registry (${s}): ${r}`:`Failed to fetch from registry: ${r}`,c=typeof i=="string"&&i?`${o} - ${i}`:o,a="Check your network connection and try again.";s===404?a="The requested resource was not found. Check the URL or item name.":s===500?a="The registry server encountered an error. Try again later.":s&&s>=400&&s<500&&(a="There was a client error. Check your request parameters.");super(c,{code:D.FETCH_ERROR,statusCode:s,cause:i,context:{url:r,responseBody:n},suggestion:a});this.url=r;this.responseBody=n;this.name="RegistryFetchError";}},pe=class extends _{constructor(r){let s=r?`Unknown registry "${r}". Make sure it is defined under "registries" in your components.json or package.json file:
2
+ {
3
+ "registries": {
4
+ "${r}": "[URL_TO_REGISTRY]"
5
+ }
6
+ }`:'Unknown registry. Make sure it is defined under "registries" in your components.json or package.json file.';super(s,{code:D.NOT_CONFIGURED,context:{registryName:r},suggestion:'Add the registry configuration under "registries" in your components.json or package.json file.'});this.registryName=r;this.name="RegistryNotConfiguredError";}},oe=class extends _{constructor(r,s,n={}){super(n.message??`Failed to read local registry file: ${r}`,{code:D.LOCAL_FILE_ERROR,cause:s,context:{filePath:r,...n.context},suggestion:n.suggestion??"Check if the file exists and you have read permissions."});this.filePath=r;this.name="RegistryLocalFileError";}},K=class extends _{constructor(r,s,n={}){super(n.message??`Failed to read registry source file: ${r}`,{code:D.FETCH_ERROR,cause:s,context:{filePath:r,...n.context},suggestion:n.suggestion??"Check if the source file exists and is accessible."});this.filePath=r;this.name="RegistrySourceFileError";}},V=class extends _{constructor(r,s,n={}){let i=n.subject??"registry item",o=`Failed to parse ${i}: ${r}`;s instanceof z$1.ZodError&&(o=`Failed to parse ${i}: ${r}
7
+ ${s.errors.map(c=>` - ${c.path.join(".")}: ${c.message}`).join(`
8
+ `)}`);super(o,{code:D.PARSE_ERROR,cause:s,context:{item:r,...n.context},suggestion:n.suggestion??`The registry item may be corrupted or have an invalid format. Please make sure it returns a valid JSON object. See ${L}/schema/registry-item.json.`});this.item=r;this.parseError=s,this.name="RegistryParseError";}parseError},C=class extends _{constructor(t,r={}){super(t,{code:D.VALIDATION_ERROR,cause:r.cause,context:{...r.registryFile?{registryFile:r.registryFile}:{},...r.context},suggestion:r.suggestion??"Update the registry.json file and try running the command again."}),this.name="RegistryValidationError";}},Ae=class extends _{constructor(r){super(`Registry item "${r}" was not found.`,{code:D.NOT_FOUND,statusCode:404,context:{itemName:r},suggestion:"Check that the item name exists in the resolved registry catalog."});this.itemName=r;this.name="RegistryItemNotFoundError";}},nt=class extends _{constructor(r,s){let n=`Registry "${r}" requires the following environment variables:
9
+
10
+ `+s.map(i=>` \u2022 ${i}`).join(`
11
+ `);super(n,{code:D.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";}},it=class extends _{constructor(r){let s=`Invalid registry namespace: "${r}". Registry names must start with @ (e.g., @shadcn, @v0).`;super(s,{code:D.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 Ve=class extends _{constructor(r,s,n="components.json"){let i=n==="package.json"?'package.json "registries"':n==="config"?"provided config":"components.json",o=`Invalid ${i} configuration in ${r}.`;s instanceof z$1.ZodError&&(o=`Invalid ${i} configuration in ${r}:
12
+ ${s.errors.map(c=>` - ${c.path.join(".")}: ${c.message}`).join(`
13
+ `)}`);super(o,{code:D.INVALID_CONFIG,cause:s,context:{cwd:r,configFile:n},suggestion:n==="package.json"?'Check the "registries" field in your package.json file for invalid configuration.':n==="config"?"Pass a valid full project config, or omit resolvedPaths and provide only registry configuration.":"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.configFile=n;this.name="ConfigParseError";}},ot=class extends _{parseError;constructor(t){let r="Failed to parse registries index";if(t instanceof z$1.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:D.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 Ia=/^(@[a-zA-Z0-9](?:[a-zA-Z0-9-_]*[a-zA-Z0-9])?)\/(.+)$/;function de(e){if(!e.startsWith("@"))return {registry:null,item:e};let t=e.match(Ia);return t?{registry:t[1],item:t[2]}:{registry:null,item:e}}var G={"next-app":{name:"next-app",label:"Next.js",links:{installation:`${L}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},"next-pages":{name:"next-pages",label:"Next.js",links:{installation:`${L}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},remix:{name:"remix",label:"Remix",links:{installation:`${L}/docs/installation/remix`,tailwind:"https://tailwindcss.com/docs/guides/remix"}},"react-router":{name:"react-router",label:"React Router",links:{installation:`${L}/docs/installation/react-router`,tailwind:"https://tailwindcss.com/docs/installation/framework-guides/react-router"}},vite:{name:"vite",label:"Vite",links:{installation:`${L}/docs/installation/vite`,tailwind:"https://tailwindcss.com/docs/guides/vite"}},astro:{name:"astro",label:"Astro",links:{installation:`${L}/docs/installation/astro`,tailwind:"https://tailwindcss.com/docs/guides/astro"}},laravel:{name:"laravel",label:"Laravel",links:{installation:`${L}/docs/installation/laravel`,tailwind:"https://tailwindcss.com/docs/guides/laravel"}},"tanstack-start":{name:"tanstack-start",label:"TanStack Start",links:{installation:`${L}/docs/installation/tanstack`,tailwind:"https://tailwindcss.com/docs/installation/using-postcss"}},gatsby:{name:"gatsby",label:"Gatsby",links:{installation:`${L}/docs/installation/gatsby`,tailwind:"https://tailwindcss.com/docs/guides/gatsby"}},expo:{name:"expo",label:"Expo",links:{installation:`${L}/docs/installation/expo`,tailwind:"https://www.nativewind.dev/docs/getting-started/installation"}},manual:{name:"manual",label:"Manual",links:{installation:`${L}/docs/installation/manual`,tailwind:"https://tailwindcss.com/docs/installation"}}};var $={error:red,warn:yellow,info:cyan,success:green};function Tt(e){let t=[e];for(;t.length;){let r=t.shift();if(typeof r=="string"){if(r.startsWith("./"))return r;continue}if(Array.isArray(r)){t.unshift(...r);continue}r&&typeof r=="object"&&t.unshift(...Object.values(r));}return null}function At(e){if(!e.includes("*"))return "strip_extension";let t=e.slice(e.indexOf("*")+1);return t&&/^\.[^/]+$/.test(t)?"strip_extension":"preserve_extension"}function jt(e,t){let r=t.find(n=>!n.hasWildcard&&n.key===e);if(r)return {path:S__default.resolve(r.rootDir,r.target),matchedAlias:r.key,matchedTarget:r.target,emitMode:r.emitMode};let s=t.filter(n=>n.hasWildcard).sort((n,i)=>i.key.length-n.key.length);for(let n of s){let i=yr(e,n.key,{allowBareAliasBase:true});if(i!==null)return {path:S__default.resolve(n.rootDir,Pa(n.target,i)),matchedAlias:n.key,matchedTarget:n.target,emitMode:n.emitMode}}return null}function yr(e,t,r={}){if(!t.includes("*"))return e===t?"":null;let[s,n=""]=t.split("*");return e.startsWith(s)&&e.endsWith(n)?n?e.slice(s.length,-n.length):e.slice(s.length):r.allowBareAliasBase&&n===""&&s.endsWith("/")&&e===s.slice(0,-1)?"":null}function Pa(e,t){if(!e.includes("*"))return e;let[r,s=""]=e.split("*");return t?`${r}${t}${s}`:r.replace(/\/$/,"")}function J(e="",t=true){let r=S__default.join(e,"package.json");return X.readJSONSync(r,{throws:t})}var wr=new Map;function xr(e){let t=S__default.resolve(e),r=wr.get(t);if(r)return r;let n=J(e,false)?.imports;if(!n||typeof n!="object"||Array.isArray(n))return wr.set(t,[]),[];let i=[];for(let[o,c]of Object.entries(n)){if(!o.startsWith("#"))continue;let a=Tt(c);a&&i.push({key:o,aliasBase:o==="#*"?"#":o.endsWith("/*")?o.slice(0,-2):o,target:a,emitMode:At(a),hasWildcard:o.includes("*"),rootDir:t});}return wr.set(t,i),i}function bn(e){let t=xr(e).map(r=>r.aliasBase);return t.length?_a(t):null}function ct(e,t){return jt(e,xr(t))}function Rn(e){let t=xr(e),r=t.some(s=>s.key==="#*")?{components:"#components",ui:"#components/ui",lib:"#lib",hooks:"#hooks",utils:"#lib/utils"}:null;return {components:at(t,"components")??r?.components,ui:at(t,"ui")??r?.ui,lib:at(t,"lib")??r?.lib,hooks:at(t,"hooks")??r?.hooks,utils:at(t,"utils")??r?.utils}}function at(e,t){return e.map(s=>({entry:s,score:Oa(s,t)})).filter(s=>s.score>0).sort((s,n)=>n.score-s.score||n.entry.aliasBase.length-s.entry.aliasBase.length)[0]?.entry.aliasBase}function Oa(e,t){let r=e.aliasBase.toLowerCase(),s=Na(e.target).toLowerCase();switch(t){case "components":return r.endsWith("/ui")||s.includes("/components/ui")?0:Ot(r,"components")?4:Ot(s,"components")?3:0;case "ui":return r.endsWith("/ui")||r==="#ui"?5:s.includes("/components/ui")?4:s.endsWith("/ui")?3:0;case "lib":return r==="#lib"||r.endsWith("/lib")?5:s.endsWith("/lib")?4:Ot(s,"lib")?3:0;case "hooks":return r==="#hooks"||r.endsWith("/hooks")?5:s.endsWith("/hooks")?4:Ot(s,"hooks")?3:0;case "utils":return r==="#utils"||r.endsWith("/utils")?5:s.endsWith("/lib/utils")?4:s.endsWith("/utils")?3:0}}function Na(e){return e.replace(/\/\*$/,"").replace(/\*$/,"").replace(/\/index\.[^/]+$/,"")}function Ot(e,t){return e===t||e.includes(`/${t}`)||e.includes(`${t}/`)}function _a(e){let t=e.map(r=>r.slice(1).split("/").filter(Boolean)).reduce((r,s,n)=>n?r.filter((i,o)=>s[o]===i):s,[]);return t.length?`#${t.join("/")}`:"#"}var I={error(...e){console.log($.error(e.join(" ")));},warn(...e){console.log($.warn(e.join(" ")));},info(...e){console.log($.info(e.join(" ")));},success(...e){console.log($.success(e.join(" ")));},log(...e){console.log(e.join(" "));},break(){console.log("");}};var Fa=["next.config.*","vite.config.*","astro.config.*","remix.config.*","nuxt.config.*","svelte.config.*","gatsby-config.*","angular.json"];async function Rh(e){if(X.existsSync(S__default.resolve(e,"pnpm-workspace.yaml")))return true;let t=S__default.resolve(e,"package.json");if(X.existsSync(t))try{if((await X.readJson(t)).workspaces)return !0}catch{}return !!(X.existsSync(S__default.resolve(e,"lerna.json"))||X.existsSync(S__default.resolve(e,"nx.json")))}async function Sh(e){let t=await Nt(e);if(!t.length)return [];let r=await Wt(t,{cwd:e,onlyDirectories:true,ignore:["**/node_modules/**"]}),s=[];for(let n of r){let i=S__default.resolve(e,n);if(!X.existsSync(S__default.resolve(i,"package.json")))continue;let o=X.existsSync(S__default.resolve(i,"components.json")),c=Fa.some(a=>Wt.sync(a,{cwd:i,dot:true}).length>0);(o||c)&&s.push({name:n,hasConfig:o});}return s}function Ih(e,t,r){let s=r?.cwdFlag??"-c";I.break(),I.log(`It looks like you are running ${$.info(e)} from a monorepo root.`),I.log(`To use shadcn in a specific workspace, use the ${$.info(s)} flag:`),I.break();for(let n of t)I.log(` shadcn ${e} ${s} ${n.name}`);I.break();}async function Nt(e){let t=[],r=S__default.resolve(e,"pnpm-workspace.yaml");if(X.existsSync(r)){let n=await X.readFile(r,"utf8");t.push(...Ma(n));}let s=S__default.resolve(e,"package.json");if(X.existsSync(s))try{let n=await X.readJson(s),i=Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages;Array.isArray(i)&&t.push(...i.filter(o=>!o.startsWith("!")));}catch{}return Array.from(new Set(t))}function Ma(e){let t=[],r=false,s=0;for(let n of e.split(`
18
+ `)){let i=n.trim();if(!i||i.startsWith("#"))continue;let o=n.match(/^(\s*)([A-Za-z0-9_-]+)\s*:/);if(o){s=o[1].length,r=o[2]==="packages";continue}if(!r)continue;let c=n.match(/^(\s*)-\s*(.+?)\s*(?:#.*)?$/);!c||c[1].length<=s||t.push(c[2].trim().replace(/^["']|["']$/g,""));}return t}var In=new Map,vr=new Map,_t=new Map;async function En(e,t){let r=Ka(e);if(!r)return null;let s=await Wa(t,r.packageName);return s?jt(e,Va(s)):null}function Va(e){let t=`${e.packageRoot}:${e.packageName}`,r=vr.get(t);if(r)return r;let n=J(e.packageRoot,false)?.exports;if(!n||typeof n!="object"||Array.isArray(n))return vr.set(t,[]),[];let i=[];for(let[o,c]of Object.entries(n)){if(o!=="."&&!o.startsWith("./"))continue;let a=Tt(c);if(!a)continue;let f=Ga(e.packageName,o);i.push({key:o.includes("*")?`${f}/*`:f,aliasBase:f,target:a,emitMode:At(a),hasWildcard:o.includes("*"),rootDir:e.packageRoot});}return vr.set(t,i),i}async function Wa(e,t){let r=await Ua(e);if(!r)return null;let s=In.get(r);if(s?.has(t))return s.get(t)??null;let n=await za(r);return In.set(r,n),n.get(t)??null}async function za(e){let t=await Nt(e),r=new Map;if(!t.length)return r;let s=await Wt(t.map(n=>S__default.posix.join(n.split(S__default.sep).join("/"),"package.json")),{cwd:e,ignore:["**/node_modules/**"]});for(let n of s){let i=S__default.resolve(e,S__default.dirname(n)),c=J(i,false)?.name;c&&r.set(c,{packageName:c,packageRoot:i});}return r}async function Ua(e){let t=S__default.resolve(e),r=_t.get(t);if(r!==void 0)return r;let s=t,n=await Ha(t);for(;;){if((await Nt(s)).length)return _t.set(t,s),s;if(n&&s===n)return _t.set(t,null),null;let o=S__default.dirname(s);if(o===s)return _t.set(t,null),null;s=o;}}async function Ha(e){let t=S__default.resolve(e);for(;;){if(X.existsSync(S__default.resolve(t,".git")))return t;let r=S__default.dirname(t);if(r===t)return null;t=r;}}function Ka(e){if(e.startsWith("#")||e.startsWith(".")||S__default.isAbsolute(e))return null;let t=e.split("/");return e.startsWith("@")?t.length<2?null:{packageName:`${t[0]}/${t[1]}`}:{packageName:t[0]}}function Ga(e,t){if(t===".")return e;let r=t.slice(2).replace(/\/\*$/,"");return r?`${e}/${r}`:e}async function Ft(e,t){let r=t.cwd??t.absoluteBaseUrl;if(e.startsWith("#")){let n=ct(e,r);if(n)return {path:n.path,source:"package_imports",matchedAlias:n.matchedAlias,matchedTarget:n.matchedTarget,emitMode:n.emitMode}}let s=await En(e,r);return s?{path:s.path,source:"workspace_package_exports",matchedAlias:s.matchedAlias,matchedTarget:s.matchedTarget,emitMode:s.emitMode}:Ja(e,t)}function Cn(e,t){return e.startsWith("#")?true:t?e.startsWith(`${t}/`):false}function qa(e){return /^@[^/]+\/[^/]+(?:\/.*)?$/.test(e)}function Ja(e,t){let r=createMatchPath(t.absoluteBaseUrl,t.paths)(e,void 0,()=>true,[".ts",".tsx",".jsx",".js",".css"]);if(!r)return null;let s=Ya(e,t.paths);return !s&&qa(e)?null:{path:r,source:"tsconfig_paths",matchedAlias:s?.key??e,matchedTarget:s?.target??r,emitMode:"strip_extension"}}function Ya(e,t){for(let[r,s]of Object.entries(t)){let n=Array.isArray(s)?s:[s],i=yr(e,r);if(i!==null)return {key:r,target:n[0]?.includes("*")&&i!==null?n[0].replace(/\*/g,i):n[0]}}return null}var qh="@/components",Jh="@/lib/utils",Yh="app/globals.css",Zh="tailwind.config.js";var Mt=cosmiconfig("components",{searchPlaces:["components.json"]});async function ut(e){let t=await tc(e);return t?(t.iconLibrary||(t.iconLibrary=t.style==="new-york"?"radix":"lucide"),await Dt(e,t)):null}async function Dt(e,t){t.registries={...H,...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());let s=await lt("utils",t.aliases.utils,e,r),n=await lt("components",t.aliases.components,e,r),i=t.aliases.ui?await lt("ui",t.aliases.ui,e,r):S__default.resolve(n??e,"ui"),o=t.aliases.lib?await lt("lib",t.aliases.lib,e,r):S__default.resolve(s??e,".."),c=t.aliases.hooks?await lt("hooks",t.aliases.hooks,e,r):S__default.resolve(n??e,"..","hooks");return ec(e,{components:n,utils:s,ui:i,lib:o,hooks:c}),d$1.parse({...t,resolvedPaths:{cwd:e,tailwindConfig:t.tailwind.config?S__default.resolve(e,t.tailwind.config):"",tailwindCss:S__default.resolve(e,t.tailwind.css),utils:s,components:n,ui:i,lib:o,hooks:c}})}async function lt(e,t,r,s){let n=await Ft(t,{...s,cwd:r});if(!n?.path||t.startsWith("#")&&n.path===S__default.resolve(r,t))return null;if(e!=="utils"&&(n.source==="package_imports"||n.source==="workspace_package_exports")){if(!n.matchedAlias.includes("*")&&/\/index\.[^/]+$/.test(n.path))return S__default.dirname(n.path);if(n.matchedAlias.includes("*")&&/\.[^/]+$/.test(n.path))return n.path.replace(/\.[^/]+$/,"")}return n.path}function ec(e,t){let r=["components","ui","lib","hooks","utils"].filter(s=>!t[s]);if(r.length)throw new Error([`Could not resolve the following aliases in ${$.info(e)}: ${$.info(r.join(", "))}.`,`Configure path aliases in ${$.info("tsconfig.json")} or imports in ${$.info("package.json")} for this workspace and try again.`].join(`
19
+ `))}async function tc(e){try{let t=await Mt.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 H)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 ${$.info(r)}.`)}}async function kn(e$1){let t={};for(let s of Object.keys(e$1.aliases)){if(!rc(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}let o=await ut(i);if(!o)throw new Error([`Could not load the workspace config in ${$.info(i)}.`,`Add ${$.info("components.json")} to this workspace and configure its path aliases or package imports, then try again.`].join(`
20
+ `));t[s]=o;}let r=e.safeParse(t);return r.success?r.data:null}async function br(e,t){let r=Lt(e,t),s=S__default.relative(r,t),i=(await Wt.glob("**/package.json",{cwd:r,deep:3,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/public/**"]})).map(o=>S__default.dirname(o)).find(o=>s.startsWith(o));return i?S__default.join(r,i):null}function rc(e,t){return Object.keys(t.resolvedPaths).filter(r=>r!=="utils").includes(e)}function Lt(e,t){let r=e.split(S__default.sep),s=t.split(S__default.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(S__default.sep)}async function $n(e,t){return (await Y(e))?.tailwindVersion==="v4"?"new-york-v4":t}function Xh(e){return e===void 0?"base":c$2(e).base??"radix"}function Pn(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:{...H}};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}var zt=["**/node_modules/**",".next","public","dist","build"],ic=z$1.object({compilerOptions:z$1.object({paths:z$1.record(z$1.string().or(z$1.array(z$1.string())))})});async function Y(e,t){let[r,s,n,i,o,c,a,f]=await Promise.all([Wt.glob("**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*",{cwd:e,deep:3,ignore:zt}),X.pathExists(S__default.resolve(e,"src")),uc(e),cc(e),ac(e,t?.configCssFile),Tn(e),An(e),J(e,false)]),l=await X.pathExists(S__default.resolve(e,`${s?"src/":""}app`)),u={framework:G.manual,isSrcDir:s,isRSC:false,isTsx:n,tailwindConfigFile:i,tailwindCssFile:o,tailwindVersion:c,frameworkVersion:null,aliasPrefix:a.prefix};if(r.find(p=>p.startsWith("next.config."))?.length)return u.framework=l?G["next-app"]:G["next-pages"],u.isRSC=l,u.frameworkVersion=await oc(u.framework,f),u;if(r.find(p=>p.startsWith("astro.config."))?.length)return u.framework=G.astro,u;if(r.find(p=>p.startsWith("gatsby-config."))?.length)return u.framework=G.gatsby,u;if(r.find(p=>p.startsWith("composer.json"))?.length)return u.framework=G.laravel,u;if(Object.keys(f?.dependencies??{}).find(p=>p.startsWith("@remix-run/")))return u.framework=G.remix,u;if([...Object.keys(f?.dependencies??{}),...Object.keys(f?.devDependencies??{})].find(p=>p.startsWith("@tanstack/react-start")))return u.framework=G["tanstack-start"],u;if(r.find(p=>p.startsWith("react-router.config."))?.length)return u.framework=G["react-router"],u;if(r.find(p=>p.startsWith("vite.config."))?.length)return u.framework=G.vite,u;let d=r.find(p=>p.startsWith("app.config"));return d?.length&&(await X.readFile(S__default.resolve(e,d),"utf8")).includes("defineConfig")?(u.framework=G.vite,u):(f?.dependencies?.expo&&(u.framework=G.expo),u)}async function oc(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 Tn(e){let[t,r]=await Promise.all([J(e,false),ut(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 ac(e,t){if(t){let i=S__default.resolve(e,t);if(await X.pathExists(i))return t}let[r,s]=await Promise.all([Wt.glob(["**/*.css","**/*.scss"],{cwd:e,deep:5,ignore:zt}),Tn(e)]);if(!r.length)return null;for(let i of r){let o=await X.readFile(S__default.resolve(e,i),"utf8");if(o.includes('@import "tailwindcss"')||o.includes("@import 'tailwindcss'")||o.includes("@tailwind base"))return i}return null}async function cc(e){let t=await Wt.glob("tailwind.config.*",{cwd:e,deep:3,ignore:zt});return t.length?t[0]:null}async function lc(e){let t=await loadConfig(e),r=t?.resultType==="success"&&Object.entries(t.paths).length?t.paths:(await fc(e))?.compilerOptions.paths;if(!r||!Object.entries(r).length)return null;for(let[s,n]of Object.entries(r)){let i=Array.isArray(n)?n:[n];if(i.includes("./*")||i.includes("./src/*")||i.includes("./app/*")||i.includes("./resources/js/*"))return s.replace(/\/\*$/,"")??null}return Object.keys(r)?.[0].replace(/\/\*$/,"")??null}async function An(e){let t=await lc(e),r=bn(e);return r&&t?.startsWith("#")?{prefix:r,source:"package_imports"}:t?{prefix:t,source:"tsconfig_paths"}:r?{prefix:r,source:"package_imports"}:{prefix:null,source:null}}async function uc(e){return (await Wt.glob("tsconfig.*",{cwd:e,deep:1,ignore:zt})).length>0}async function fc(e){for(let t of ["tsconfig.json","tsconfig.web.json","tsconfig.app.json"]){let r=S__default.resolve(e,t);if(!await X.pathExists(r))continue;let s=await X.readFile(r,"utf8"),n;try{n=JSON.parse(pc(s));}catch{continue}let i=ic.safeParse(n);if(!i.error)return i.data}return null}function pc(e){let t="",r=false,s=false;for(let n=0;n<e.length;n++){let i=e[n],o=e[n+1];if(r){if(t+=i,s){s=false;continue}if(i==="\\"){s=true;continue}i==='"'&&(r=false);continue}if(i==='"'){r=true,t+=i;continue}if(i==="/"&&o==="/"){for(;n<e.length&&e[n]!==`
21
+ `;)n++;n<e.length&&(t+=e[n]);continue}if(i==="/"&&o==="*"){for(n+=2;n<e.length;){if(e[n]==="*"&&e[n+1]==="/"){n++;break}e[n]===`
22
+ `&&(t+=`
23
+ `),n++;}continue}if(i===","){let c=n+1;for(;c<e.length;){for(;/\s/.test(e[c]??"");)c++;if(e[c]==="/"&&e[c+1]==="/"){for(c+=2;c<e.length&&e[c]!==`
24
+ `&&e[c]!=="\r";)c++;continue}if(e[c]==="/"&&e[c+1]==="*"){for(c+=2;c<e.length&&!(e[c]==="*"&&e[c+1]==="/");)c++;c+=2;continue}break}if(e[c]==="}"||e[c]==="]")continue}t+=i;}return t}async function dm(e,t=null){let[r,s,n]=await Promise.all([ut(e),t?Promise.resolve(t):Y(e),An(e)]);if(r)return r;if(!s||!s.tailwindCssFile||s.tailwindVersion==="v3"&&!s.tailwindConfigFile)return null;let i=n.source==="package_imports"?Rn(e):null;if(!s.aliasPrefix)return null;let o=dc(s.aliasPrefix,n.source==="package_imports"),c=n.source==="package_imports"&&i?hc({...o,components:i.components??o.components,ui:i.ui??o.ui,hooks:i.hooks??o.hooks,lib:i.lib??o.lib,utils:i.utils??o.utils}):o;if(!c.components||!c.utils)return null;let a={$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:c};return await Dt(e,a)}function dc(e,t=false){return t&&e==="#"?{components:"",ui:void 0,hooks:void 0,lib:void 0,utils:""}:{components:`${e}/components`,ui:`${e}/components/ui`,hooks:`${e}/hooks`,lib:`${e}/lib`,utils:`${e}/lib/utils`}}function hc(e){let t={...e};return !t.ui&&t.components&&(t.ui=`${t.components}/ui`),!t.lib&&t.utils.endsWith("/utils")&&(t.lib=t.utils.slice(0,-6)),!t.utils&&t.lib&&(t.utils=`${t.lib}/utils`),t}async function je(e){if(!e.resolvedPaths?.cwd)return "v3";let t=await Y(e.resolvedPaths.cwd);return t?.tailwindVersion?t.tailwindVersion:null}async function hm(e){let t=await ut(e);if(!t)return [];let s=(await Dt(e,t)).resolvedPaths.ui;if(!X.existsSync(s))return [];let n=await Vt(),i=new Set(n?.map(c=>c.name)??[]);return (await promises.readdir(s)).filter(c=>/\.(tsx|jsx)$/.test(c)).map(c=>S__default.basename(c,S__default.extname(c))).filter(c=>i.has(c))}function jn(e,t,r={}){let{ignoreImports:s=false}=r,n=e.replace(/\r\n/g,`
25
+ `).trim(),i=t.replace(/\r\n/g,`
26
+ `).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,c=l=>l.replace(o,(u,d,p,h)=>{if(p.startsWith("."))return `${d}${p}${h}`;let m=p.split("/"),g=m[m.length-1];return `${d}@normalized/${g}${h}`}),a=c(n),f=c(i);return a===f}function Oe(e){let t=S__default.basename(e);return /^\.env(\.|$)/.test(t)}function Ut(e){let t=[".env.local",".env",".env.development.local",".env.development"];for(let r of t){let s=S__default.join(e,r);if(existsSync(s))return s}return null}function ze(e){let t=e.split(`
27
+ `),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(),c=n.substring(i+1).trim();o&&(r[o]=c.replace(/^["']|["']$/g,""));}return r}function Ht(e,t){let r=ze(e),s=ze(t),n=[];for(let i of Object.keys(s))i in r||n.push(i);return n}function Kt(e,t){let r=ze(e),s=ze(t),n=e.trimEnd();n&&!n.endsWith(`
28
+ `)&&(n+=`
29
+ `);let i=[];for(let[o,c]of Object.entries(s))o in r||i.push(`${o}=${c}`);return i.length>0?(n&&(n+=`
30
+ `),n+=i.join(`
31
+ `),n+`
32
+ `):n&&!n.endsWith(`
33
+ `)?n+`
34
+ `:n}function j(e,t){return gc({text:e,isSilent:t?.silent})}var yc=["components","ui","lib","hooks"];function Rr(e){return yc.includes(e)}function Gt(e){let t=e?.match(/^@([^/]+)\//);return t&&Rr(t[1])?t[1]:null}var Bt=async({sourceFile:e,config:t,isRemote:r})=>{let s=t.aliases?.utils,n=typeof s=="string"?vc(s):"@",i=n?`${n}/lib/utils`:"@/lib/utils";if(![".tsx",".ts",".jsx",".js"].includes(e.getExtension()))return e;for(let o of e.getImportStringLiterals()){let c=xc(o.getLiteralValue(),t,r);if(o.setLiteralValue(c),i===c||c==="@/lib/utils"){if(!o.getFirstAncestorByKind(SyntaxKind.ImportDeclaration)?.getNamedImports().some(l=>l.getName()==="cn")||!t.aliases.utils)continue;o.setLiteralValue(i===c?c.replace(i,t.aliases.utils):t.aliases.utils);}}return e};function xc(e,t,r=false){if(e=bc(e,t),!e.startsWith("@/")&&!r)return e;if(r&&e.startsWith("@/")&&(e=e.replace(/^@\//,"@/registry/new-york/")),e==="@/registry")return t.aliases.components;if(!e.startsWith("@/registry/")){if(e==="@/lib/utils"&&t.aliases.utils)return t.aliases.utils;if(t.aliases.ui&&e.match(/^@\/components\/ui(?=\/|$)/))return e.replace(/^@\/components\/ui/,t.aliases.ui);if(t.aliases.components&&e.match(/^@\/components(?=\/|$)/))return e.replace(/^@\/components/,t.aliases.components);if(t.aliases.hooks&&e.match(/^@\/hooks(?=\/|$)/))return e.replace(/^@\/hooks/,t.aliases.hooks);if(t.aliases.lib&&e.match(/^@\/lib(?=\/|$)/))return e.replace(/^@\/lib/,t.aliases.lib);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.utils&&e.match(/^@\/registry\/(.+)\/lib\/utils$/)?t.aliases.utils: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)}function vc(e){if(e.startsWith("#"))return "";if(e.endsWith("/lib/utils"))return e.slice(0,-10);if(e.startsWith("@")){let[r,s]=e.split("/");return r&&s?`${r}/${s}`:e}let t=e.indexOf("/");return t===-1?e:e.slice(0,t)}function bc(e,t){if(e==="#registry")return "@/registry";if(e.startsWith("#/"))return e.replace(/^#\//,"@/");if(e.startsWith("#registry/"))return e.replace(/^#registry\//,"@/registry/");for(let{alias:r,normalized:s}of Rc(t)){if(e===r)return s;if(e.startsWith(`${r}/`))return `${s}${e.slice(r.length)}`}return e}function Rc(e){return e.aliases?[{alias:e.aliases.ui,normalized:"@/components/ui"},{alias:e.aliases.components,normalized:"@/components"},{alias:e.aliases.hooks,normalized:"@/hooks"},{alias:e.aliases.lib,normalized:"@/lib"},{alias:e.aliases.utils,normalized:"@/lib/utils"}].filter(t=>typeof t.alias=="string"&&t.alias.startsWith("#")).sort((t,r)=>r.alias.length-t.alias.length):[]}var Cc={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"]},Nn=async({sourceFile:e,config:t})=>{let r=e.getFullText();if(t.tsx)return r;let s=qt.parse(r,{parser:{parse:i=>parse(i,Cc)}}),n=transformFromAstSync(s,r,{cloneInputAst:false,code:false,ast:true,plugins:[Ec],configFile:false});if(!n||!n.ast)throw new Error("Failed to transform JSX");return qt.print(n.ast).code};var $c=/^["']use client["']$/g,Jt=async({sourceFile:e,config:t})=>{if(t.rsc)return e;let r=e.getFirstChildByKind(SyntaxKind.ExpressionStatement);return r&&$c.test(r.getText())&&r.remove(),e};var Pc=new Set(["cn-font-heading"]),Tc=/\bcn-[a-z-]+\b/;function _n(e){return Tc.test(e)&&!Pc.has(e)}function Fn(e){return e.split(/\s+/).filter(t=>t.length>0&&!_n(t)).join(" ")}function Mn(e){return e.split(/\s+/).some(_n)}function Yt(e){let t=e.getLiteralValue();if(!Mn(t))return;let r=Fn(t);r!==t&&e.setLiteralValue(r);}function Sr(e){for(let t of e.getDescendantsOfKind(SyntaxKind.StringLiteral))Yt(t);for(let t of e.getDescendantsOfKind(SyntaxKind.NoSubstitutionTemplateLiteral))Yt(t);}function Ac(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(Mn(i)){let o=Fn(i);o===""?t.push(r):o!==i&&n.setLiteralValue(o);}}n?.isKind(SyntaxKind.JsxExpression)&&Sr(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)){Yt(s);continue}if(s.isKind(SyntaxKind.NoSubstitutionTemplateLiteral)){Yt(s);continue}Sr(s);}for(let r of e.getDescendantsOfKind(SyntaxKind.CallExpression))r.getExpression().getText()==="mergeProps"&&Sr(r);}var Zt=async({sourceFile:e})=>(Ac(e),e);var Xt=async({sourceFile:e,config:t})=>{if(!t.tailwind?.prefix)return e;let r=await je(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(`"${ge(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(`"${ge(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(`"${ge(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(`"${ge(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),i.isKind(SyntaxKind.StringLiteral)&&i.replaceWithText(`"${ge(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(c=>{c.replaceWithText(`"${ge(c.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),o.isKind(SyntaxKind.StringLiteral)&&o.replaceWithText(`"${ge(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(`"${ge(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}});}),e};function ge(e,t="",r){return r==="v3"?e.split(" ").map(s=>{let[n,i,o]=b$1(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 Fc=new Project({compilerOptions:{}});async function Mc(e){let t=await promises.mkdtemp(S__default.join(tmpdir(),"shadcn-"));return S__default.join(t,e)}async function Ln(e,t=[Bt,Jt,a,Xt,d,c,Zt]){let r=await Mc(e.filename),s=Fc.createSourceFile(r,e.raw,{scriptKind:ScriptKind.TSX});for(let n of t)await n({sourceFile:s,...e});return e.transformJsx?await Nn({sourceFile:s,...e}):s.getText()}var Dc=["a","span","div","Link","label","Label"],Vn=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(a=>a.getOpeningElement().getAttribute("asChild"));if(i.length===0)break;let o=i.filter(a=>!a.getDescendantsOfKind(SyntaxKind.JsxElement).some(l=>l.getOpeningElement().getAttribute("asChild"))),c=[];for(let a of o){let f=a.getOpeningElement(),l=f.getAttribute("asChild");if(!l)continue;let u=f.getTagNameNode().getText(),p=a.getJsxChildren().find(y=>y.getKind()===SyntaxKind.JsxElement||y.getKind()===SyntaxKind.JsxSelfClosingElement);if(!p){l.remove();continue}let h,m,g;if(p.getKind()===SyntaxKind.JsxSelfClosingElement){let y=p.asKindOrThrow(SyntaxKind.JsxSelfClosingElement);h=y.getTagNameNode().getText(),m=y.getAttributes().map(w=>w.getText()).join(" "),g="";}else {let y=p.asKindOrThrow(SyntaxKind.JsxElement),w=y.getOpeningElement();h=w.getTagNameNode().getText(),m=w.getAttributes().map(v=>v.getText()).join(" "),g=y.getJsxChildren().map(v=>v.getText()).join("");}let x=u==="Button"&&Dc.includes(h);c.push({parentElement:a,parentTagName:u,childTagName:h,childProps:m,childChildren:g,needsNativeButton:x});}for(let a of c.reverse()){let l=a.parentElement.getOpeningElement().getAttributes().filter(m=>m.getKind()===SyntaxKind.JsxAttribute?m.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()!=="asChild":true).map(m=>m.getText()).join(" "),u=a.childProps?`{<${a.childTagName} ${a.childProps} />}`:`{<${a.childTagName} />}`,d=l?`${l} `:"";d+=`render=${u}`,a.needsNativeButton&&(d+=" nativeButton={false}");let p=a.childChildren.trim()?`${a.childChildren}`:"",h=`<${a.parentTagName} ${d}>${p}</${a.parentTagName}>`;a.parentElement.replaceWithText(h);}}return e};var Wn=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);var Er=[".ts",".tsx",".js",".jsx"],Wc=new Set(["tailwindConfig","tailwindCss"]);async function Cr(e,t,r){if(!e?.length)return {filesCreated:[],filesUpdated:[],filesSkipped:[]};r={overwrite:false,force:false,silent:false,interactive:true,isRemote:false,isWorkspace:false,...r};let s=j("Updating files.",{silent:r.silent})?.start(),[n,i]=await Promise.all([Y(t.resolvedPaths.cwd),t.tailwind.baseColor?tr(t.tailwind.baseColor):Promise.resolve(void 0)]),o=loadConfig(t.resolvedPaths.cwd),c$1=Bc(r.plannedFiles??e,t,{isSrcDir:n?.isSrcDir,framework:n?.framework.name,path:r.path}),a$1=new Project({compilerOptions:{}}),f=[],l=[],u=[],d$1=[],p=null;for(let x=0;x<e.length;x++){let y=e[x];if(!y.content)continue;let w=Qt(y,t,{isSrcDir:n?.isSrcDir,framework:n?.framework.name,commonRoot:er(e.map(P=>P.path),y.path),path:r.path,fileIndex:x});if(!w)continue;let v=basename(y.path),b=S__default.dirname(w);if(t.tsx||(w=w.replace(/\.tsx?$/,P=>P===".tsx"?".jsx":".js")),Oe(w)&&!existsSync(w)){let P=Ut(b);P&&(w=P);}let R=existsSync(w);if(y.type==="registry:lib"&&basename(y.path)==="utils.ts"&&n?.framework.name==="laravel"&&R){u.push(S__default.relative(t.resolvedPaths.cwd,w));continue}if(R&&statSync(w).isDirectory())throw new Error(`Cannot write to ${w}: path exists and is a directory. Please provide a file path instead.`);let T=y.type==="registry:file"||y.type==="registry:item",k=Oe(w)||T?y.content:await Ln({filename:y.path,raw:y.content,config:t,baseColor:i,transformJsx:!t.tsx,isRemote:r.isRemote,supportedFontMarkers:r.supportedFontMarkers},[Bt,Jt,a,Xt,c,g$1,Vn,d,...zn(w,n,t)?[Wn]:[],f$1,Zt]);if(R&&!Oe(w)){let P=await Bn({config:t,content:k,filePaths:c$1,project:a$1,projectInfo:n,resolvedPath:w,tsConfig:o}),U=await promises.readFile(w,"utf-8");if(jn(U,P,{ignoreImports:r.isWorkspace})){u.push(S__default.relative(t.resolvedPaths.cwd,w));continue}}if(R&&!r.overwrite&&!Oe(w)){if(!r.interactive){u.push(S__default.relative(t.resolvedPaths.cwd,w));continue}s.stop(),r.rootSpinner&&r.rootSpinner.stop();let{overwrite:P}=await Vc({type:"confirm",name:"overwrite",message:`The file ${$.info(v)} already exists. Would you like to overwrite?`,initial:false});if(!P){u.push(S__default.relative(t.resolvedPaths.cwd,w)),r.rootSpinner&&r.rootSpinner.start();continue}s?.start(),r.rootSpinner&&r.rootSpinner.start();}if(zn(w,n,t)&&(w=w.replace(/middleware\.(ts|js)$/,"proxy.$1")),existsSync(b)||await promises.mkdir(b,{recursive:true}),Oe(w)&&R){let P=await promises.readFile(w,"utf-8"),U=Kt(P,k);if(d$1=Ht(P,k),p=S__default.relative(t.resolvedPaths.cwd,w),!d$1.length){u.push(S__default.relative(t.resolvedPaths.cwd,w));continue}await promises.writeFile(w,U,"utf-8"),l.push(S__default.relative(t.resolvedPaths.cwd,w));continue}await promises.writeFile(w,k,"utf-8"),R?l.push(S__default.relative(t.resolvedPaths.cwd,w)):(f.push(S__default.relative(t.resolvedPaths.cwd,w)),Oe(w)&&(d$1=Object.keys(ze(k)),p=S__default.relative(t.resolvedPaths.cwd,w)));}let h=r.interactive?[...f,...l,...u]:[...f,...l],m=await Gc(h,t,c$1);if(l.push(...m),f=Array.from(new Set(f)),l=Array.from(new Set(l.filter(x=>!f.includes(x)))),u=Array.from(new Set(u)),!(f.length||l.length)&&!u.length&&s?.info("No files updated."),f.length){if(s?.succeed(`Created ${f.length} ${f.length===1?"file":"files"}:`),!r.silent)for(let x of f)I.log(` - ${x}`);}else s?.stop();if(l.length&&(j(`Updated ${l.length} ${l.length===1?"file":"files"}:`,{silent:r.silent})?.info(),!r.silent))for(let x of l)I.log(` - ${x}`);if(u.length&&(j(`Skipped ${u.length} ${u.length===1?"file":"files"}: (files might be identical, use --overwrite to overwrite)`,{silent:r.silent})?.info(),!r.silent))for(let x of u)I.log(` - ${x}`);if(d$1.length&&p&&(j(`Added the following variables to ${$.info(p)}:`)?.info(),!r.silent))for(let x of d$1)I.log(` ${$.success("+")} ${x}`);return {filesCreated:f,filesUpdated:l,filesSkipped:u}}function Qt(e,t,r){if(r.path){let i=S__default.isAbsolute(r.path)?r.path:S__default.join(t.resolvedPaths.cwd,r.path);if(/\.[^/\\]+$/.test(i)){if(r.fileIndex===0)return i}else {let c=S__default.basename(e.path);return S__default.join(i,c)}}if(e.target){if(e.target.startsWith("~/"))return S__default.join(t.resolvedPaths.cwd,e.target.replace("~/",""));let i=e.target,o=zc(i,t);return o?.resolvedPath?o.resolvedPath:(o?.target&&(i=o.target),e.type==="registry:page"&&(i=Kc(i,r.framework),!i)?"":r.isSrcDir?S__default.join(t.resolvedPaths.cwd,"src",i.replace("src/","")):S__default.join(t.resolvedPaths.cwd,i.replace("src/","")))}let s=Uc(e,t),n=Hc(e.path,s);return S__default.join(s,n)}function zc(e,t){let r=e.match(/^@([^/]+)\/(.+)$/);if(!r)return null;let[,s,n]=r;if(!Rr(s))return {target:`${s}/${n}`};let i=S__default.resolve(t.resolvedPaths[s]),o=S__default.resolve(i,n);if(o!==i&&!o.startsWith(`${i}${S__default.sep}`))throw new Error(`Invalid target path "${e}". Target paths using @${s}/ must stay within the ${s} alias root.`);return {resolvedPath:o}}function Uc(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 er(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 c=i.slice(0,o).join("/");if(r.some(f=>f!==s&&f.startsWith(c+"/")))return "/"+c}return "/"+n}function Hc(e,t){let r=e.replace(/^\/|\/$/g,""),s=t.replace(/^\/|\/$/g,""),n=r.split("/"),i=s.split("/"),o=i[i.length-1],c=n.findIndex(a=>a===o);return c===-1?n[n.length-1]:n.slice(c+1).join("/")}function Kc(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 Gc(e,t,r=e){let s=new Project({compilerOptions:{}}),n=await Y(t.resolvedPaths.cwd),i=loadConfig(t.resolvedPaths.cwd),o=[];if(!n||i.resultType==="failed")return [];for(let c of e){let a=S__default.resolve(t.resolvedPaths.cwd,c);if(!existsSync(a))continue;let f=await promises.readFile(a,"utf-8"),l=await promises.mkdtemp(S__default.join(tmpdir(),"shadcn-")),u=s.createSourceFile(S__default.join(l,basename(a)),f,{scriptKind:ScriptKind.TSX});if(![".tsx",".ts",".jsx",".js"].includes(u.getExtension()))continue;let d=await Bn({config:t,content:f,filePaths:r,project:s,projectInfo:n,resolvedPath:a,sourceFile:u,tsConfig:i});d!==f&&(await promises.writeFile(a,d,"utf-8"),o.push(c));}return o}function Bc(e,t,r){return (e??[])?.filter(s=>!!s?.content).map((s,n)=>{let i=Qt(s,t,{isSrcDir:r.isSrcDir,framework:r.framework,commonRoot:er((e??[]).map(o=>o.path),s.path),path:r.path,fileIndex:n});return i?(t.tsx||(i=i.replace(/\.tsx?$/,o=>o===".tsx"?".jsx":".js")),S__default.relative(t.resolvedPaths.cwd,i)):null}).filter(s=>!!s)}async function Bn({content:e,resolvedPath:t,filePaths:r,config:s,projectInfo:n,tsConfig:i,project:o,sourceFile:c}){if(!n||i.resultType==="failed")return e;let a=S__default.extname(t);if(![".tsx",".ts",".jsx",".js"].includes(a))return e;let f=c===void 0?o.createSourceFile(S__default.join(tmpdir(),`shadcn-${Math.random().toString(36).slice(2)}${a||".tsx"}`),e,{scriptKind:ScriptKind.TSX,overwrite:true}):null,l=c??f;try{let u=!1;for(let d of l.getImportDeclarations()){let p=d.getModuleSpecifierValue();if(!Cn(p,n.aliasPrefix??null))continue;let h=await qc(p,r,s,i);if(!h)continue;let m=Yc(h,s,n,t);!m||m===p||(d.setModuleSpecifier(m),u=!0);}return u?l.getFullText():e}finally{f&&o.removeSourceFile(f);}}async function qc(e,t,r,s){let n=(await Ft(e,{...s,cwd:r.resolvedPaths.cwd}))?.path,i=!n&&!e.startsWith(".")?Xc(e,r):null;return !n&&!i?null:Jc(n??i,t,r)}function Jc(e,t,r,s=[".tsx",".ts",".js",".jsx",".css"]){let n=S__default.normalize(r.resolvedPaths.cwd),i=t.map(g=>g.split(S__default.sep).join(S__default.posix.sep)),o=new Set(i),c=S__default.extname(e),a=c!=="",f=a?e.slice(0,-c.length):e,u=S__default.relative(n,f).split(S__default.sep).join(S__default.posix.sep),d=a?[c]:s,p=new Set;for(let g of d){let x=f+g,y=S__default.posix.normalize(S__default.relative(n,x));(o.has(y)||existsSync(x))&&p.add(y);let w=S__default.join(f,`index${g}`),v=S__default.posix.normalize(S__default.relative(n,w));(o.has(v)||existsSync(w))&&p.add(v);}let h=S__default.basename(f);for(let g of i)d.some(x=>g.endsWith(`/${h}${x}`))&&p.add(g);return p.size===0?null:Array.from(p).sort((g,x)=>{let y=S__default.posix.extname(g),w=S__default.posix.extname(x),v=d.indexOf(y)-d.indexOf(w);if(v!==0)return v;let b=u&&g.startsWith(u)?-1:1,R=u&&x.startsWith(u)?-1:1;return b-R})[0]}function Yc(e,t,r,s){let n=S__default.normalize(S__default.join(t.resolvedPaths.cwd,e)),i=Object.entries(t.resolvedPaths).filter(([h,m])=>{if(!m||Wc.has(h))return false;let g=S__default.normalize(m);if(n===g){let x=t.aliases[h];if(typeof x!="string"||!x.startsWith("#"))return true;let y=ct(x,t.resolvedPaths.cwd);return y!==null&&!y.matchedAlias.includes("*")}return n.startsWith(S__default.normalize(m+S__default.sep))}).sort((h,m)=>m[1].length-h[1].length);if(i.length===0)return null;let[o,c]=i[0],a=S__default.relative(c,n);a=a.split(S__default.sep).join("/");let f=o==="cwd"?r.aliasPrefix:t.aliases[o];if(!f)return null;if(f.startsWith("#")){let h=ct(f,t.resolvedPaths.cwd);if(h)return Zc(f,a,h)??(s?el(s,n):null)}let l=S__default.posix.extname(a),u=Er.includes(l)?"":l,d=a.slice(0,a.length-l.length);d.endsWith("/index")&&(d=d.slice(0,-6));let p=d===""?"":`/${d}`;return p=p.replace("/src",""),`${f}${p}${u}`}function Zc(e,t,r){let s=S__default.posix.extname(t),n=Er.includes(s)&&r.emitMode==="strip_extension"?"":s,i=t?t.slice(0,t.length-s.length)+n:"";return r.matchedAlias.includes("*")?i?`${e}/${i}`:e:i===""||i==="index"?e:null}function Xc(e,t){let r=Qc(t);for(let s of r){if(e===s.alias||e===s.canonical)return s.rootPath;if(e.startsWith(`${s.alias}/`))return S__default.join(s.rootPath,e.slice(s.alias.length+1));if(e.startsWith(`${s.canonical}/`))return S__default.join(s.rootPath,e.slice(s.canonical.length+1))}return null}function Qc(e){return [{alias:e.aliases.ui,canonical:"@/components/ui",rootPath:e.resolvedPaths.ui},{alias:e.aliases.components,canonical:"@/components",rootPath:e.resolvedPaths.components},{alias:e.aliases.hooks,canonical:"@/hooks",rootPath:e.resolvedPaths.hooks},{alias:e.aliases.lib,canonical:"@/lib",rootPath:e.resolvedPaths.lib},{alias:e.aliases.utils,canonical:"@/lib/utils",rootPath:e.resolvedPaths.utils}].filter(t=>typeof t.alias=="string"&&typeof t.rootPath=="string").sort((t,r)=>r.alias.length-t.alias.length||r.canonical.length-t.canonical.length)}function el(e,t){let r=S__default.relative(S__default.dirname(e),t);r=r.split(S__default.sep).join("/");let s=S__default.posix.extname(r),n=Er.includes(s)?"":s,i=r.slice(0,r.length-s.length);return i.endsWith("/index")&&(i=i.slice(0,-6)),i.startsWith(".")||(i=`./${i}`),`${i}${n}`}function zn(e,t,r){let s=e===S__default.join(r.resolvedPaths.cwd,"middleware.ts")||e===S__default.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 M(e){try{return new URL(e),!0}catch{return false}}function we(e){return e.endsWith(".json")&&!M(e)}function Jn(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 Yn(e,t){if(!rl(t))return z$1.array(g).parse(e.flat().filter(Boolean));let r=await Y(t.resolvedPaths.cwd),s=new Map,n=z$1.array(g).parse(e.flat().filter(Boolean));return n.forEach(i=>{let o=Qt(i,t,{isSrcDir:r?.isSrcDir,framework:r?.framework.name,commonRoot:er(n.map(c=>c.path),i.path)});o&&s.set(o,i);}),Array.from(s.values())}function rl(e){return !!(e?.resolvedPaths?.cwd&&(e?.resolvedPaths?.ui||e?.resolvedPaths?.lib||e?.resolvedPaths?.components||e?.resolvedPaths?.hooks))}var sl=/^(?!.*--)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,37}[a-zA-Z0-9])?$/,nl=/^[a-zA-Z0-9._-]+$/,il=new Set([".",".."]),ol=/[\x00-\x1F\x7F]/,al=/\s/,cl=/^-/;function ft(e){if(M(e))return {scheme:"url",url:e};if(we(e))return {scheme:"file",path:e};let{registry:t,item:r}=de(e);if(t)return {scheme:"namespace",namespace:t,item:r};let s=ll(e);return s||{scheme:"shadcn",item:e}}function rr(e){return ft(e).scheme==="github"}function pt(e){let t=e.indexOf("#"),r=t===-1?e:e.slice(0,t),s=t===-1?void 0:e.slice(t+1),n=r.split("/");if(n.length!==2)return null;let[i,o]=n;if(!Xn(i)||!Qn(o))return null;if(s!==void 0&&!ei(s))throw new C(`Invalid GitHub ref in registry source "${e}".`,{context:{source:e,ref:s},suggestion:"Use a non-empty branch, tag, or commit SHA without whitespace, control characters or leading dashes."});return {owner:i,repo:o,ref:s}}function Zn(e){return pt(e)!==null}function ll(e){let t=e.indexOf("#"),r=t===-1?e:e.slice(0,t),s=t===-1?void 0:e.slice(t+1),n=r.split("/");if(n.length<3)return null;let[i,o,...c]=n;if(!Xn(i)||!Qn(o))return null;let a=c.join("/");if(!a)return null;if(s!==void 0&&!ei(s))throw new C(`Invalid GitHub ref in item address "${e}".`,{context:{address:e,ref:s},suggestion:"Use a non-empty branch, tag, or commit SHA without whitespace, control characters or leading dashes."});return {scheme:"github",owner:i,repo:o,item:a,ref:s}}function Xn(e){return sl.test(e)}function Qn(e){return nl.test(e)&&!il.has(e)}function ei(e){return !!e&&!ol.test(e)&&!al.test(e)&&!cl.test(e)}var He=new AsyncLocalStorage,kr={headers:{}};function xe(e,t={}){let r=He.getStore();return He.run({headers:{},env:t.env??r?.env},e)}function dt(e){let t=He.getStore()??kr;t.headers={...t.headers,...e};}function ti(e){return (He.getStore()??kr).headers[e]||{}}function sr(e){let t=He.getStore();return t?.env?t.env[e]:process.env[e]}function ri(){let e=He.getStore()??kr;e.headers={};}function ht(e){return e.replace(/\${(\w+)}/g,(t,r)=>sr(r)||"")}function mt(e){let t=[],r=/\${(\w+)}/g,s;for(;(s=r.exec(e))!==null;)t.push(s[1]);return t}function pl(e){return e.style?e.style==="new-york"&&e.tailwind?.config===""?$t:e.style:$t}function se(e){let t=Pn({style:$t,registries:H});return e?d$1.parse(Ge(t,{...e,style:pl(e),registries:{...H,...e.registries}})):t}function dl(e){let t=new Set;return typeof e=="string"?mt(e).forEach(r=>t.add(r)):(mt(e.url).forEach(r=>t.add(r)),e.params&&Object.values(e.params).forEach(r=>{mt(r).forEach(s=>t.add(s));}),e.headers&&Object.values(e.headers).forEach(r=>{mt(r).forEach(s=>t.add(s));})),Array.from(t)}function si(e,t){let s=dl(t).filter(n=>!sr(n));if(s.length>0)throw new nt(e,s)}function wy(e,t){for(let r of e)Zn(r)||Ke(r,se(t));ri();}var ni="{name}",nr="{style}",ii=/\${(\w+)}/g,oi="?",hl="&";function ml(e){return e.startsWith("./")||e.startsWith("/")}function Ke(e,t){let{registry:r,item:s}=de(e);if(!r){if(M(e)||we(e)||ml(e)||rr(e))return null;r="@shadcn";}let i={...H,...t?.registries}[r];if(!i)throw new pe(r);return si(r,i),{url:gl(s,i,t),headers:yl(i)}}function gl(e,t,r){if(typeof t=="string"){let n=t.replace(ni,e);return r?.style&&n.includes(nr)&&(n=n.replace(nr,r.style)),ht(n)}let s=t.url.replace(ni,e);return r?.style&&s.includes(nr)&&(s=s.replace(nr,r.style)),s=ht(s),t.params?wl(s,t.params):s}function yl(e){if(typeof e=="string"||!e.headers)return {};let t={};for(let[r,s]of Object.entries(e.headers)){let n=ht(s);xl(s,n)&&(t[r]=n);}return t}function wl(e,t){let r=new URLSearchParams;for(let[i,o]of Object.entries(t)){let c=ht(o);c&&r.append(i,c);}let s=r.toString();if(!s)return e;let n=e.includes(oi)?hl:oi;return `${e}${n}${s}`}function xl(e,t){let r=t.trim();if(!r)return false;if(e.includes("${")&&e.match(ii)){let n=e.replace(ii,"").trim();return r!==n}return true}function ir(e){if(M(e)){let t=new URL(e);return t.pathname.match(/\/chat\/b\//)&&!t.pathname.endsWith("/json")&&(t.pathname=`${t.pathname}/json`),t.toString()}return `${Pe}/${e}`}var bl=process.env.https_proxy||process.env.HTTPS_PROXY||process.env.http_proxy||process.env.HTTP_PROXY?new EnvHttpProxyAgent:void 0,Rl=5,Sl=new Set(["accept","user-agent"]);async function or(e,t){let r=new URL(e).origin,s=new Headers(t?.headers),n=new URL(e).toString(),i=s;for(let o=0;o<=Rl;o++){let c=await Il(n,t,i);if(!(c.status>=300&&c.status<400&&c.headers.has("location")))return c;let f=c.headers.get("location"),l=new URL(f,n);if(l.origin!==r){let u=new Headers;s.forEach((d,p)=>{Sl.has(p.toLowerCase())&&u.set(p,d);}),i=u;}else i=s;n=l.toString();}throw new Error(`Too many redirects while fetching ${e}`)}async function Il(e,t,r){try{return await fetch(e,{...t,headers:r,redirect:"manual",dispatcher:bl})}catch(s){let n=s instanceof TypeError?s.cause:void 0;if(n){let i=new Error(`Request to ${e} failed, reason: ${ai(n)}`);throw i.cause=n,i}throw s}}function ai(e){if(e instanceof Error&&"errors"in e){let t=e.errors;if(Array.isArray(t)&&t.length)return ai(t[0])}return e instanceof Error?e.message||e.code||"unknown error":String(e)}var $r=new Map;async function z(e,t={}){t={useCache:true,...t};try{return await Promise.all(e.map(async s=>{let n=ir(s),i=ti(n),o=$l(n,i);if(t.useCache&&$r.has(o))return $r.get(o);let c=(async()=>{let a=new Headers({Accept:"application/vnd.shadcn.v1+json, application/json;q=0.9","User-Agent":"shadcn"});for(let[l,u]of Object.entries(i))a.set(l,u);let f=await or(n,{headers:a});if(!f.ok){let l;if(f.headers.get("content-type")?.includes("application/json")){let u=await f.json(),d=z$1.object({detail:z$1.string().optional(),title:z$1.string().optional(),message:z$1.string().optional(),error:z$1.string().optional()}).safeParse(u);d.success&&(l=d.data.detail||d.data.message,d.data.error&&(l=`[${d.data.error}] ${l}`));}throw f.status===401?new tt(n,l):f.status===404?new Te(n,l):f.status===410?new Pt(n,l):f.status===403?new rt(n,l):new st(n,f.status,l)}return f.json()})();return t.useCache&&$r.set(o,c),c}))}catch(r){throw r}}function $l(e,t){let r=Object.entries(t).map(([n,i])=>[n.toLowerCase(),i]).sort(([n],[i])=>n.localeCompare(i)),s=createHash("sha256").update(JSON.stringify(r)).digest("hex");return `${e}:${s}`}async function li(e){try{let t=e;e.startsWith("~/")&&(t=S__default.join(homedir(),e.slice(2)));let r=S__default.resolve(t),s=await promises.readFile(r,"utf8"),n$1=JSON.parse(s);try{return n.parse(n$1)}catch(i){throw new V(e,i)}}catch(t){throw t instanceof Error&&(t.message.includes("ENOENT")||t.message.includes("no such file"))?new oe(e,t):t instanceof V?t:new oe(e,t)}}var Tl="https://github.com",ui=/^[a-fA-F0-9]{40}$/,Al=15e3;async function fi(e,t={}){let r=e.ref??"HEAD";if(ui.test(r))return r.toLowerCase();let s=`${e.owner}/${e.repo}#${r}`;if(t.cache?.has(s))return t.cache.get(s);let n=jl(e,r).catch(i=>{throw t.cache?.delete(s),i});return t.cache?.set(s,n),n}async function jl(e,t){let r=`${Tl}/${e.owner}/${e.repo}.git`,s=Ol(t),n;try{n=(await execa("git",["ls-remote","--symref","--",r,...s],{env:{GIT_TERMINAL_PROMPT:"0"},timeout:Al})).stdout;}catch(o){throw _l(e,t,r,o)}let i=Nl(n);for(let o of pi(t)){let c=i.get(o);if(c)return c}throw new K("registry.json",void 0,{message:`Could not resolve GitHub ref "${t}" for ${e.owner}/${e.repo}.`,context:{reason:"github-ref-resolution",source:di(e),ref:t,repoUrl:r},suggestion:'Use an existing branch, tag, or full commit SHA. For example: "owner/repo/item#main" or "owner/repo/item#v1.0.0".'})}function Ol(e){return Array.from(new Set(pi(e)))}function pi(e){return e==="HEAD"?["HEAD"]:e.startsWith("refs/tags/")?[`${e}^{}`,e]:e.startsWith("refs/")?[e]:[`refs/heads/${e}`,`refs/tags/${e}^{}`,`refs/tags/${e}`,e]}function Nl(e){let t=new Map;for(let r of e.split(`
35
+ `)){let s=r.trim();if(!s||s.startsWith("ref:"))continue;let[n,i]=s.split(/\s+/);n&&i&&ui.test(n)&&t.set(i,n.toLowerCase());}return t}function _l(e,t,r,s){return new K("registry.json",s,{message:`Failed to resolve GitHub ref "${t}" for ${e.owner}/${e.repo}.`,context:{reason:"github-ref-resolution",source:di(e),ref:t,repoUrl:r},suggestion:Fl(s)})}function Fl(e){return Ml(e)?"Install Git and try again. Git is required to resolve GitHub registry refs.":Dl(e)?"GitHub ref resolution timed out. Check your network connection and try again.":"Check that the public GitHub repository exists and the ref is accessible."}function Ml(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}function Dl(e){return typeof e=="object"&&e!==null&&"timedOut"in e&&e.timedOut===true}function di(e){return `${e.owner}/${e.repo}#${e.ref??"HEAD"}`}async function Pr(e,t,r={}){let s=Ei(r.registryFile??"registry.json"),n=await gi(s,t,{source:r.source}),i=n.registry.items.find(o=>o.name===e);if(!i)throw new Ae(e);return Ll(i,n,t)}async function Tr(e,t={}){let r=Ei(t.registryFile??"registry.json"),s=await gi(r,e,{source:t.source});return Vl(s)}async function gi(e,t,r={}){let s=await vi(e,t,r),n=bi(s,e);hi(n,e);let i={itemSources:new Map,itemSourcesByItem:new Map,firstIncludedFrom:new Map},o=!!n.include?.length;if(!o){let l=Ii(e);return n.items.forEach((u,d)=>{Si(u,e,l);let p={registryFile:e,registryDir:l,itemIndex:d};i.itemSources.set(u.name,p),i.itemSourcesByItem.set(u,p);}),mi(n.items,i.itemSourcesByItem),{registry:n,itemSources:i.itemSources,itemSourcesByItem:i.itemSourcesByItem,usesInclude:o}}if(S__default.posix.basename(e)!=="registry.json")throw new C(`Invalid source registry file at ${e}: registries that use include must be named registry.json.`,{registryFile:e});let c=await xi(e,n,t,i,[]);mi(c.items,i.itemSourcesByItem);let{include:a,...f}=c;return hi(f,e),{registry:f,itemSources:i.itemSources,itemSourcesByItem:i.itemSourcesByItem,usesInclude:o}}async function Ll(e,t,r){let s={...yi(e,t.itemSourcesByItem),$schema:"https://ui.shadcn.com/schema/registry-item.json"};return await Promise.all((e.files??[]).map(async(n,i)=>{let o=s.files?.[i];if(!o)return;let c=t.itemSourcesByItem.get(e),a=wi(e,n.path,t.itemSourcesByItem);o.content=await Wl(e.name,n.path,a,c,r);})),n.parse(s)}function Vl(e){return {...e.registry,items:e.registry.items.map(t=>zl(yi(t,e.itemSourcesByItem)))}}async function Wl(e,t,r,s,n){try{return await n.readText(r)}catch(i){let o=i instanceof K&&i.context?.reason==="github-source-file";throw new K(r,i,{message:`Failed to read file "${t}" for registry item "${e}" (${yt(s)}). Expected file at ${r}.`,context:{registryFile:s?.registryFile,itemIndex:s?.itemIndex,itemName:e,itemFilePath:t,sourcePath:r},suggestion:o&&i.suggestion?i.suggestion:"Make sure the file path is relative to the registry.json file that declares the item."})}}function yi(e,t){return {...e,files:e.files?.map(r=>({...r,path:Ul(e,r.path,t)}))}}function zl(e){return {...e,files:e.files?.map(({content:t,...r})=>r)}}function wi(e,t,r){let s=r.get(e);return Ar(s?.registryDir??".",t)}function Ul(e,t,r){let s=wi(e,t,r);return Kl(".",s)}async function xi(e,t,r,s,n){if(Ri(e),n.length>=32)throw new C(`Registry include tree is too deep at ${e}. The maximum include depth is 32.`,{registryFile:e,context:{maxDepth:32},suggestion:"Flatten part of the registry include tree or reduce nested include depth."});if(n.includes(e))throw new C(Gl([...n,e]),{registryFile:e});let i=n.at(-1)??e,o=s.firstIncludedFrom.get(e);if(o)throw new C(`Registry file included more than once: ${e}.
36
+ - first included from ${o}
37
+ - included again from ${i}
38
+ Each registry.json file can only appear once in the resolved include tree. Remove one include or move shared items into a single included registry.json.`,{registryFile:e,context:{firstSource:o,secondSource:i}});s.firstIncludedFrom.set(e,i);let c=[...n,e],a=Ii(e),f=[];for(let l of t.include??[]){let u=Hl(l,a,e),d=await vi(u,r),p=bi(d,u),h=await xi(u,p,r,s,c);f.push(...h.items);}return t.items?.forEach((l,u)=>{Si(l,e,a),s.itemSources.set(l.name,{registryFile:e,registryDir:a,itemIndex:u}),s.itemSourcesByItem.set(l,{registryFile:e,registryDir:a,itemIndex:u});}),{...t,items:[...f,...t.items??[]]}}async function vi(e,t,r={}){try{return await t.readText(e)}catch(s){throw s instanceof K&&(s.context?.reason==="github-ref-resolution"||s.context?.reason==="github-source-file")?s:new K(e,s,{message:`Failed to read source registry file at ${Bl(e,r.source)}.`,context:{registryFile:e,source:r.source},suggestion:e==="registry.json"?"Check that the repository has a registry.json file at its root.":"Check that the included registry.json file exists and that the include path is correct."})}}function bi(e,t){let r;try{r=JSON.parse(e);}catch(n){throw new V(t,n,{subject:"registry file",context:{registryFile:t},suggestion:"Fix the JSON syntax in the registry.json file and try again."})}let s=o.safeParse(r);if(!s.success)throw new C(`Invalid registry file at ${t}:
39
+ ${ql(s.error)}`,{registryFile:t,cause:s.error,suggestion:"Update the registry.json file so it matches the registry schema."});return s.data}function hi(e,t){let r=[];if(e.name||r.push("name"),e.homepage||r.push("homepage"),r.length)throw new C(`Invalid root registry file at ${t}: root registry.json must define ${r.map(s=>`"${s}"`).join(" and ")}. Included registry.json files may omit these fields.`,{registryFile:t})}function Hl(e,t,r){if(M(e))throw new C(`Invalid include "${e}" in ${r}: remote includes are not supported by shadcn build. Use a relative path to a registry.json file in the same repository.`,{registryFile:r,context:{includePath:e}});if(S__default.posix.isAbsolute(e))throw new C(`Invalid include "${e}" in ${r}: include paths must be relative. Use a path like "./registry/ui/registry.json".`,{registryFile:r,context:{includePath:e}});if(ki(e))throw new C(`Invalid include "${e}" in ${r}: include paths cannot use parent-directory traversal. Keep included registry.json files inside the registry root.`,{registryFile:r,context:{includePath:e}});if(S__default.posix.basename(e)!=="registry.json")throw new C(`Invalid include "${e}" in ${r}: include paths must explicitly reference a registry.json file. Use a path like "./registry/ui/registry.json".`,{registryFile:r,context:{includePath:e}});let s=Ar(t,e);return Ri(s),s}function Ri(e){if(!Ci(e))throw new C(`Invalid registry file at ${e}: registry includes must stay inside the source registry root.`,{registryFile:e})}function Si(e,t,r){for(let s of e.files??[]){if(M(s.path))throw new C(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: remote file paths are not supported by shadcn build.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});if(S__default.posix.isAbsolute(s.path))throw new C(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths must be relative.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});if(ki(s.path))throw new C(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths cannot use parent-directory traversal.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});let n=Ar(r,s.path);if(!Ci(n,r))throw new C(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths must stay inside the registry chunk directory.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}})}}function mi(e,t){let r=new Map;for(let s of e){let n=r.get(s.name);if(!n){r.set(s.name,s);continue}let i=t.get(n),o=t.get(s);throw new C(`Duplicate registry item name "${s.name}". Registry item names must be unique.
40
+ - ${yt(i)}
41
+ - ${yt(o)}
42
+ Rename one of these items so each name is unique across the resolved registry.`,{context:{itemName:s.name,firstSource:yt(i),secondSource:yt(o)}})}}function Ii(e){let t=S__default.posix.dirname(e);return t==="."?".":t}function Ar(...e){let t=S__default.posix.normalize(S__default.posix.join(...e));return t==="."?"":t}function Ei(e){let t=S__default.posix.normalize(e);return t.startsWith("./")?t.slice(2):t}function Kl(e,t){return S__default.posix.relative(e,t)||S__default.posix.basename(t)}function Ci(e,t="."){let r=S__default.posix.relative(t,e);return !!r&&!r.startsWith("..")&&!S__default.posix.isAbsolute(r)}function ki(e){return e.split(/[\\/]+/).includes("..")}function Gl(e){return `Registry include cycle detected:
43
+ ${e.map(t=>` - ${t}`).join(`
44
+ `)}`}function yt(e){return e?`${e.registryFile} items[${e.itemIndex}]`:"unknown source"}function Bl(e,t){return t?`${t}/${e}`:e}function ql(e){return e.errors.map(t=>` - ${t.path.length?t.path.join("."):"(root)"}: ${t.message}`).join(`
45
+ `)}var Jl="https://raw.githubusercontent.com",Yl=8;async function Pi(e,t={}){t={...t,sourceCache:t.sourceCache??new Map};let r=jr(e,t);return Pr(e.item,r,{source:Ne(e)})}async function Ti(e,t={}){t={...t,sourceCache:t.sourceCache??new Map};let r=jr(e,t);return Tr(r,{source:Ne(e)})}async function Qy(e,t={}){let r=Ne(e),s=`${r}/registry.json`,n=new Set,i=t.sourceCache??new Map,o={...t,sourceCache:i},c=jr(e,o),a={async readText(f){return f.endsWith("registry.json")&&n.add(`${r}/${f}`),c.readText(f)}};try{let f=await Tr(a,{source:r}),u=(await Ql(f.items,Yl,async(d,p)=>{try{return await Pr(d.name,a,{source:r}),null}catch(h){return $i(h,{defaultRegistryFile:s,itemName:d.name,itemIndex:p,sourceLabel:r})}})).filter(d=>d!==null);return {valid:u.length===0,cwd:r,registryFiles:n.size,registryFilePaths:Array.from(n),items:f.items.length,diagnostics:u}}catch(f){return {valid:false,cwd:r,registryFiles:n.size||1,registryFilePaths:n.size?Array.from(n):[s],items:0,diagnostics:[$i(f,{defaultRegistryFile:s,sourceLabel:r})]}}}function jr(e,t){let r=fi(e,{cache:t.sourceCache});return {async readText(s){let n=await r,i=Xl(e,n,s);if(t.useCache!==false&&t.sourceCache?.has(i))return t.sourceCache.get(i);let o=Zl(i,s,e);return t.useCache!==false&&t.sourceCache?.set(i,o),o}}}async function Zl(e,t,r){let s;try{s=await or(e,{headers:new Headers({"Accept-Encoding":"identity","User-Agent":"shadcn"})});}catch(n){throw new K(t,n,{message:`Failed to read GitHub source file "${t}" from ${Ne(r)}.`,context:{reason:"github-source-file",url:e,source:Ne(r),filePath:t},suggestion:"GitHub ref resolution succeeded, but the CLI could not fetch from raw.githubusercontent.com. Check that raw.githubusercontent.com is accessible from this network."})}if(!s.ok)throw new K(t,void 0,{message:`Failed to read GitHub source file "${t}" from ${Ne(r)}.`,context:{reason:"github-source-file",url:e,statusCode:s.status,source:Ne(r),filePath:t},suggestion:t==="registry.json"?"The GitHub repository and ref were resolved, but raw.githubusercontent.com did not return a root registry.json file. Check that the public repository has registry.json at its root and that raw.githubusercontent.com is accessible from this network.":"Check that the file path exists in the public GitHub repository."});return s.text()}function Xl(e,t,r){let s=r.split("/").map(n=>encodeURIComponent(n)).join("/");return `${Jl}/${e.owner}/${e.repo}/${t}/${s}`}async function Ql(e,t,r){let s=new Array(e.length),n=0,i=Math.min(t,e.length),o=Array.from({length:i},async()=>{for(;n<e.length;){let c=n++;s[c]=await r(e[c],c);}});return await Promise.all(o),s}function Ne(e){return `${e.owner}/${e.repo}#${e.ref??"HEAD"}`}function $i(e,t){return e instanceof _?{registryFile:typeof e.context?.registryFile=="string"?`${t.sourceLabel}/${e.context.registryFile}`:t.defaultRegistryFile,itemName:t.itemName,itemIndex:typeof e.context?.itemIndex=="number"?e.context.itemIndex:t.itemIndex,filePath:typeof e.context?.itemFilePath=="string"?e.context.itemFilePath:typeof e.context?.filePath=="string"?e.context.filePath:void 0,includePath:typeof e.context?.includePath=="string"?e.context.includePath:void 0,message:e.message,suggestion:e.suggestion}:{registryFile:t.defaultRegistryFile,itemName:t.itemName,itemIndex:t.itemIndex,message:e instanceof Error?e.message:"Unknown error."}}async function Nr(e,t,r){if(!e||(r={silent:false,tailwindVersion:"v3",...r},r.tailwindVersion==="v4"))return;let s=S__default.relative(t.resolvedPaths.cwd,t.resolvedPaths.tailwindConfig),n=j(`Updating ${$.info(s)}`,{silent:r.silent}).start(),i=await promises.readFile(t.resolvedPaths.tailwindConfig,"utf8"),o=await iu(i,e,t);await promises.writeFile(t.resolvedPaths.tailwindConfig,o,"utf8"),n?.succeed();}async function iu(e,t,r){let s=await ji(e,r),n=s.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression).find(o=>o.getProperties().some(c=>c.isKind(SyntaxKind.PropertyAssignment)&&c.getName()==="content"));if(!n)return e;let i=lu(n);return ou(n,{name:"darkMode",value:"class"},{quoteChar:i}),t.plugins?.forEach(o=>{cu(n,o);}),t.theme&&await au(n,t.theme),s.getFullText()}function ou(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 au(e,t){e.getProperty("theme")||e.addPropertyAssignment({name:"theme",initializer:"{}"}),_r(e);let s=(e.getPropertyOrThrow("theme")?.asKindOrThrow(SyntaxKind.PropertyAssignment)).getInitializer();if(s?.isKind(SyntaxKind.ObjectLiteralExpression)){let n=s.getText(),i=await uu(n),o=Ge(i,t,{arrayMerge:(a,f)=>f}),c=ru(o).replace(/\'\.\.\.(.*)\'/g,"...$1").replace(/\'\"/g,"'").replace(/\"\'/g,"'").replace(/\'\[/g,"[").replace(/\]\'/g,"]").replace(/\'\\\'/g,"'").replace(/\\\'/g,"'").replace(/\\\'\'/g,"'").replace(/\'\'/g,"'");s.replaceWithText(c);}Fr(e);}function cu(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 ji(e,t){let r=await promises.mkdtemp(S__default.join(tmpdir(),"shadcn-")),s=t?.resolvedPaths?.tailwindConfig||"tailwind.config.ts",n=S__default.join(r,`shadcn-${S__default.basename(s)}`);return new Project({compilerOptions:{}}).createSourceFile(n,e,{scriptKind:S__default.extname(s)===".ts"?ScriptKind.TS:ScriptKind.JS})}function lu(e){return e.getFirstDescendantByKind(SyntaxKind.StringLiteral)?.getQuoteKind()===QuoteKind.Single?"'":'"'}function _r(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)?_r(i.asKindOrThrow(SyntaxKind.ObjectLiteralExpression)):i&&i.isKind(SyntaxKind.ArrayLiteralExpression)&&Oi(i.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function Oi(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))_r(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))Oi(s.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));else if(s.isKind(SyntaxKind.SpreadElement)){let n=s.getText();e.removeElement(r),e.insertElement(r,`"${n}"`);}}}function Fr(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)?Fr(i):i&&i.isKind(SyntaxKind.ArrayLiteralExpression)&&Ni(i.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function Ni(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))Fr(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))Ni(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 uu(e){let r=(await ji(`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 ar(n)}throw new Error("Invalid input: not an object literal")}function ar(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]=ar(r.getInitializer()):r.getInitializer()?.isKind(SyntaxKind.ArrayLiteralExpression)?t[s]=_i(r.getInitializer()):t[s]=Mr(r.getInitializer());}return t}function _i(e){let t=[];for(let r of e.getElements())r.isKind(SyntaxKind.ObjectLiteralExpression)?t.push(ar(r.asKindOrThrow(SyntaxKind.ObjectLiteralExpression))):r.isKind(SyntaxKind.ArrayLiteralExpression)?t.push(_i(r.asKindOrThrow(SyntaxKind.ArrayLiteralExpression))):t.push(Mr(r));return t}function Mr(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(Mr);case SyntaxKind.ObjectLiteralExpression:return ar(e);default:return e.getText()}}function Fi(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 Be(e,t){let r={},s=[...e];if(!t?.registries)return dt({}),s;for(let n=0;n<s.length;n++){if(rr(s[n]))continue;let i=Ke(s[n],t);i&&(s[n]=i.url,Object.keys(i.headers).length>0&&(r[i.url]=i.headers));}return dt(r),s}async function ve(e,t,r={}){return r={...r,sourceCache:r.sourceCache??new Map},await Promise.all(e.map(async n$1=>{let i=ft(n$1);if(i.scheme==="github")return Pi(i,r);if(we(n$1))return li(n$1);if(M(n$1)){let[a]=await z([n$1],r);try{return n.parse(a)}catch(f){throw new V(n$1,f)}}if(n$1.startsWith("@")&&t?.registries){let a=Be([n$1],t),[f]=await z(a,r);try{return n.parse(f)}catch(l){throw new V(n$1,l)}}let o=`styles/${t?.style??"new-york-v4"}/${n$1}.json`,[c]=await z([o],r);try{return n.parse(c)}catch(a){throw new V(n$1,a)}}))}m.extend({type:f,_source:z$1.string().optional(),font:l.optional(),config:z$1.any().optional()}).passthrough();async function Je(e,t,r={}){r={useCache:true,...r,sourceCache:r.sourceCache??new Map};let s=[],n$1=[],i=[],o=Array.from(new Set(e)),c=await ve(o,t,r),a=new Map;for(let y=0;y<c.length;y++)c[y]&&a.set(o[y],c[y]);for(let[y,w]of Array.from(a.entries())){let v={...w,_source:y};if(s.push(v),w.registryDependencies){let b=w.registryDependencies;if(t?.registries)b=Be(w.registryDependencies,t);else {let k=w.registryDependencies.filter(P=>P.startsWith("@"));if(k.length>0){let{registry:P}=de(k[0]);throw new pe(P)}}let{items:R,registryNames:T}=await qe(b,t,r,new Set(o));n$1.push(...R),i.push(...T);}}if(s.push(...n$1),i.length>0){let y=Array.from(new Set(i)),w=y.filter(b=>!b.startsWith("@")),v=y.filter(b=>b.startsWith("@"));if(v.length>0){let b=await ve(v,t,r);for(let R=0;R<b.length;R++){let k={...b[R],_source:v[R]};s.push(k);}}if(w.length>0){let b=await Vt();if(!b&&s.length===0)return null;if(b){w.includes("index")&&w.unshift("index");let R=[];for(let U of w){let et=await pu(U,t,r);R.push(...et);}let T=Array.from(new Set(R)),k=await z(T,r),P=z$1.array(n).parse(k);s.push(...P);}}}if(!s.length)return null;if(r.requireUniversal&&!s.every(y=>Jn(y)))throw new Error("A full project config is required to add non-universal registry items or dependencies.");if((o.includes("index")||i.includes("index"))&&t.tailwind.baseColor){let y=await du(t.tailwind.baseColor,t);y&&s.unshift(y);}let f=new Map;s.forEach(y=>{let w=y._source||y.name;f.set(y,w);}),s=mu(s,f),s.sort((y,w)=>y.type==="registry:theme"&&w.type!=="registry:theme"?-1:y.type!=="registry:theme"&&w.type==="registry:theme"?1:0);let l={};s.forEach(y=>{l=Ge(l,y.tailwind??{});});let u$1={};s.forEach(y=>{u$1=Ge(u$1,y.cssVars??{});});let d={};s.forEach(y=>{d=Ge(d,y.css??{});});let p="";s.forEach(y=>{y.docs&&(p+=`${y.docs}
46
+ `);});let h={};s.forEach(y=>{h=Ge(h,y.envVars??{});});let m=await Yn(s.map(y=>y.files??[]),t),g=s.filter(y=>y.type==="registry:font"&&y.font).map(y=>({...y,type:"registry:font",font:y.font})),x=u.parse({dependencies:Ge.all(s.map(y=>y.dependencies??[])),devDependencies:Ge.all(s.map(y=>y.devDependencies??[])),files:m,tailwind:l,cssVars:u$1,css:d,docs:p,fonts:g.length>0?g:void 0});return Object.keys(h).length>0&&(x.envVars=h),x}async function qe(e,t,r={},s=new Set){let n=[],i=[];for(let o of e){if(s.has(o))continue;if(s.add(o),ft(o).scheme==="github"){let[a]=await ve([o],t,r);if(a&&(n.push({...a,_source:o}),a.registryDependencies)){let f=t?.registries?Be(a.registryDependencies,t):a.registryDependencies,l=await qe(f,t,r,s);n.push(...l.items),i.push(...l.registryNames);}}else if(M(o)||we(o)){let[a]=await ve([o],t,r);if(a&&(n.push({...a,_source:o}),a.registryDependencies)){let f=t?.registries?Be(a.registryDependencies,t):a.registryDependencies,l=await qe(f,t,r,s);n.push(...l.items),i.push(...l.registryNames);}}else if(o.startsWith("@")&&t?.registries){let{registry:a}=de(o);if(a&&!(a in t.registries))throw new pe(a);let[f]=await ve([o],t,r);if(f&&(n.push(f),f.registryDependencies)){let l=t?.registries?Be(f.registryDependencies,t):f.registryDependencies,u=await qe(l,t,r,s);n.push(...u.items),i.push(...u.registryNames);}}else if(i.push(o),t)try{let[a]=await ve([o],t,r);if(a&&a.registryDependencies){let f=t?.registries?Be(a.registryDependencies,t):a.registryDependencies,l=await qe(f,t,r,s);n.push(...l.items),i.push(...l.registryNames);}}catch{}}return {items:n,registryNames:i}}async function pu(e,t,r={}){if(M(e))return [e];let{registryNames:s}=await qe([e],t,r,new Set),n=t.resolvedPaths?.cwd?await $n(t.resolvedPaths.cwd,t.style):t.style,i=s.map(o=>ir(M(o)?o:`styles/${n}/${o}.json`));return Array.from(new Set(i))}async function du(e,t){let[r,s]=await Promise.all([tr(e),je(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,...Fi(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 ue(e,t){let r=t||e.name,s=createHash("sha256").update(r).digest("hex").substring(0,8);return `${e.name}::${s}`}function hu(e){let t=ft(e);if(t.scheme==="github")return {name:t.item,hash:ue({name:t.item},e)};if(M(e)){let n=new URL(e).pathname,i=n.match(/\/([^/]+)\.json$/),o=i?i[1]:S__default.basename(n,".json");return {name:o,hash:ue({name:o},e)}}if(we(e)){let s=e.match(/\/([^/]+)\.json$/),n=s?s[1]:S__default.basename(e,".json");return {name:n,hash:ue({name:n},e)}}let{item:r}=de(e);return {name:r,hash:ue({name:r},e)}}function mu(e,t){let r=new Map,s=new Map,n=new Map,i=new Map;e.forEach(f=>{let l=t.get(f)||f.name,u=ue(f,l);r.set(u,f),s.set(u,f),n.set(u,0),i.set(u,[]);});let o=new Map;e.forEach(f=>{let l=t.get(f)||f.name,u=ue(f,l);o.has(f.name)||o.set(f.name,[]),o.get(f.name).push(u),l!==f.name&&(o.has(l)||o.set(l,[]),o.get(l).push(u));}),e.forEach(f=>{let l=t.get(f)||f.name,u=ue(f,l);f.registryDependencies&&f.registryDependencies.forEach(d=>{let p,h=o.get(d)||[];if(h.length===1)p=h[0];else if(h.length>1)p=h[0];else {let{name:m}=hu(d),g=o.get(m)||[];g.length>0&&(p=g[0]);}p&&r.has(p)&&(i.get(p).push(u),n.set(u,n.get(u)+1));});});let c=[],a=[];for(n.forEach((f,l)=>{f===0&&c.push(l);});c.length>0;){let f=c.shift(),l=r.get(f);a.push(l),i.get(f).forEach(u=>{let d=n.get(u)-1;n.set(u,d),d===0&&c.push(u);});}if(a.length!==e.length){let f=new Set(a.map(l=>{let u=t.get(l)||l.name;return ue(l,u)}));e.forEach(l=>{let u=t.get(l)||l.name,d=ue(l,u);f.has(d)||a.push(l);});}return a}var Lr=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],Vr={"bun.lock":"bun","bun.lockb":"bun","deno.lock":"deno","pnpm-lock.yaml":"pnpm","pnpm-workspace.yaml":"pnpm","yarn.lock":"yarn","package-lock.json":"npm","npm-shrinkwrap.json":"npm"},Wr={"node_modules/.deno/":"deno","node_modules/.pnpm/":"pnpm","node_modules/.yarn-state.yml":"yarn","node_modules/.yarn_integrity":"yarn","node_modules/.package-lock.json":"npm",".pnp.cjs":"yarn",".pnp.js":"yarn","bun.lock":"bun","bun.lockb":"bun"},Di={bun:"https://bun.sh",deno:"https://deno.com",pnpm:"https://pnpm.io/installation","pnpm@6":"https://pnpm.io/6.x/installation",yarn:"https://classic.yarnpkg.com/en/docs/install","yarn@berry":"https://yarnpkg.com/getting-started/install",npm:"https://docs.npmjs.com/cli/configuring-npm/install"};async function zr(e,t){try{let r=await Vi__default.stat(e);return t==="file"?r.isFile():r.isDirectory()}catch{return false}}function*yu(e=ne.cwd()){let t=S__default.resolve(e),{root:r}=S__default.parse(t);for(;t&&t!==r;)yield t,t=S__default.dirname(t);}async function Li(e,t){return !e||!zr(e,"file")?null:await xu(e,t)}async function Ur(e={}){let{cwd:t,strategies:r=["lockfile","packageManager-field","devEngines-field"],onUnknown:s}=e,n;if(typeof e.stopDir=="string"){let i=S__default.resolve(e.stopDir);n=o=>o===i;}else n=e.stopDir;for(let i of yu(t)){for(let o of r)switch(o){case "lockfile":{for(let c of Object.keys(Vr))if(await zr(S__default.join(i,c),"file")){let a=Vr[c],f=await Li(S__default.join(i,"package.json"),s);return f||{name:a,agent:a}}break}case "packageManager-field":case "devEngines-field":{let c=await Li(S__default.join(i,"package.json"),s);if(c)return c;break}case "install-metadata":{for(let c of Object.keys(Wr)){let a=c.endsWith("/")?"dir":"file";if(await zr(S__default.join(i,c),a)){let f=Wr[c],l=f==="yarn"?vu(c)?"yarn":"yarn@berry":f;return {name:f,agent:l}}}break}}if(n?.(i))break}return null}function wu(e){let t=r=>r?.match(/\d+(\.\d+){0,2}/)?.[0]??r;if(typeof e.packageManager=="string"){let[r,s]=e.packageManager.replace(/^\^/,"").split("@");return {name:r,ver:t(s)}}if(typeof e.devEngines?.packageManager?.name=="string")return {name:e.devEngines.packageManager.name,ver:t(e.devEngines.packageManager.version)}}async function xu(e,t){try{let r=JSON.parse(await Vi__default.readFile(e,"utf8")),s,n=wu(r);if(n){let i=n.name,o=n.ver,c=o;return i==="yarn"&&o&&Number.parseInt(o)>1?(s="yarn@berry",c="berry",{name:i,agent:s,version:c}):i==="pnpm"&&o&&Number.parseInt(o)<7?(s="pnpm@6",{name:i,agent:s,version:c}):Lr.includes(i)?(s=i,{name:i,agent:s,version:c}):t?.(r.packageManager)??null}}catch{}return null}function vu(e){return e.endsWith(".yarn_integrity")}var Ye=createRequire(import.meta.url),Ru=Object.create,Hi=Object.defineProperty,Su=Object.getOwnPropertyDescriptor,Iu=Object.getOwnPropertyNames,Eu=Object.getPrototypeOf,Cu=Object.prototype.hasOwnProperty,Re=(e=>typeof Ye<"u"?Ye:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Ye<"u"?Ye:t)[r]}):e)(function(e){if(typeof Ye<"u")return Ye.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ku=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Iu(t))!Cu.call(e,n)&&n!==r&&Hi(e,n,{get:()=>t[n],enumerable:!(s=Su(t,n))||s.enumerable});return e},$u=(e,t,r)=>(r=e!=null?Ru(Eu(e)):{},ku(Hi(r,"default",{value:e,enumerable:true}),e)),Pu=q((e,t)=>{t.exports=i,i.sync=o;var r=Re("fs");function s(c,a){var f=a.pathExt!==void 0?a.pathExt:process.env.PATHEXT;if(!f||(f=f.split(";"),f.indexOf("")!==-1))return true;for(var l=0;l<f.length;l++){var u=f[l].toLowerCase();if(u&&c.substr(-u.length).toLowerCase()===u)return true}return false}function n(c,a,f){return !c.isSymbolicLink()&&!c.isFile()?false:s(a,f)}function i(c,a,f){r.stat(c,function(l,u){f(l,l?false:n(u,c,a));});}function o(c,a){return n(r.statSync(c),c,a)}}),Tu=q((e,t)=>{t.exports=s,s.sync=n;var r=Re("fs");function s(c,a,f){r.stat(c,function(l,u){f(l,l?false:i(u,a));});}function n(c,a){return i(r.statSync(c),a)}function i(c,a){return c.isFile()&&o(c,a)}function o(c,a){var f=c.mode,l=c.uid,u=c.gid,d=a.uid!==void 0?a.uid:process.getuid&&process.getuid(),p=a.gid!==void 0?a.gid:process.getgid&&process.getgid(),h=parseInt("100",8),m=parseInt("010",8),g=parseInt("001",8),x=h|m,y=f&g||f&m&&u===p||f&h&&l===d||f&x&&d===0;return y}}),Au=q((e,t)=>{Re("fs");var s;process.platform==="win32"||global.TESTING_WINDOWS?s=Pu():s=Tu(),t.exports=n,n.sync=i;function n(o,c,a){if(typeof c=="function"&&(a=c,c={}),!a){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(f,l){n(o,c||{},function(u,d){u?l(u):f(d);});})}s(o,c||{},function(f,l){f&&(f.code==="EACCES"||c&&c.ignoreErrors)&&(f=null,l=false),a(f,l);});}function i(o,c){try{return s.sync(o,c||{})}catch(a){if(c&&c.ignoreErrors||a.code==="EACCES")return false;throw a}}}),ju=q((e,t)=>{var r=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",s=Re("path"),n=r?";":":",i=Au(),o=l=>Object.assign(new Error(`not found: ${l}`),{code:"ENOENT"}),c=(l,u)=>{let d=u.colon||n,p=l.match(/\//)||r&&l.match(/\\/)?[""]:[...r?[process.cwd()]:[],...(u.path||process.env.PATH||"").split(d)],h=r?u.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",m=r?h.split(d):[""];return r&&l.indexOf(".")!==-1&&m[0]!==""&&m.unshift(""),{pathEnv:p,pathExt:m,pathExtExe:h}},a=(l,u,d)=>{typeof u=="function"&&(d=u,u={}),u||(u={});let{pathEnv:p,pathExt:h,pathExtExe:m}=c(l,u),g=[],x=w=>new Promise((v,b)=>{if(w===p.length)return u.all&&g.length?v(g):b(o(l));let R=p[w],T=/^".*"$/.test(R)?R.slice(1,-1):R,k=s.join(T,l),P=!T&&/^\.[\\\/]/.test(l)?l.slice(0,2)+k:k;v(y(P,w,0));}),y=(w,v,b)=>new Promise((R,T)=>{if(b===h.length)return R(x(v+1));let k=h[b];i(w+k,{pathExt:m},(P,U)=>{if(!P&&U)if(u.all)g.push(w+k);else return R(w+k);return R(y(w,v,b+1))});});return d?x(0).then(w=>d(null,w),d):x(0)},f=(l,u)=>{u=u||{};let{pathEnv:d,pathExt:p,pathExtExe:h}=c(l,u),m=[];for(let g=0;g<d.length;g++){let x=d[g],y=/^".*"$/.test(x)?x.slice(1,-1):x,w=s.join(y,l),v=!y&&/^\.[\\\/]/.test(l)?l.slice(0,2)+w:w;for(let b=0;b<p.length;b++){let R=v+p[b];try{if(i.sync(R,{pathExt:h}))if(u.all)m.push(R);else return R}catch{}}}if(u.all&&m.length)return m;if(u.nothrow)return null;throw o(l)};t.exports=a,a.sync=f;}),Ou=q((e,t)=>{var r=(s={})=>{let n=s.env||process.env;return (s.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};t.exports=r,t.exports.default=r;}),Nu=q((e,t)=>{var r=Re("path"),s=ju(),n=Ou();function i(c,a){let f=c.options.env||process.env,l=process.cwd(),u=c.options.cwd!=null,d=u&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(c.options.cwd);}catch{}let p;try{p=s.sync(c.command,{path:f[n({env:f})],pathExt:a?r.delimiter:void 0});}catch{}finally{d&&process.chdir(l);}return p&&(p=r.resolve(u?c.options.cwd:"",p)),p}function o(c){return i(c)||i(c,true)}t.exports=o;}),_u=q((e,t)=>{var r=/([()\][%!^"`<>&|;, *?])/g;function s(i){return i=i.replace(r,"^$1"),i}function n(i,o){return i=`${i}`,i=i.replace(/(\\*)"/g,'$1$1\\"'),i=i.replace(/(\\*)$/,"$1$1"),i=`"${i}"`,i=i.replace(r,"^$1"),o&&(i=i.replace(r,"^$1")),i}t.exports.command=s,t.exports.argument=n;}),Fu=q((e,t)=>{t.exports=/^#!(.*)/;}),Mu=q((e,t)=>{var r=Fu();t.exports=(s="")=>{let n=s.match(r);if(!n)return null;let[i,o]=n[0].replace(/#! ?/,"").split(" "),c=i.split("/").pop();return c==="env"?o:o?`${c} ${o}`:c};}),Du=q((e,t)=>{var r=Re("fs"),s=Mu();function n(i){let o=Buffer.alloc(150),c;try{c=r.openSync(i,"r"),r.readSync(c,o,0,150,0),r.closeSync(c);}catch{}return s(o.toString())}t.exports=n;}),Lu=q((e,t)=>{var r=Re("path"),s=Nu(),n=_u(),i=Du(),o=process.platform==="win32",c=/\.(?:com|exe)$/i,a=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function f(d){d.file=s(d);let p=d.file&&i(d.file);return p?(d.args.unshift(d.file),d.command=p,s(d)):d.file}function l(d){if(!o)return d;let p=f(d),h=!c.test(p);if(d.options.forceShell||h){let m=a.test(p);d.command=r.normalize(d.command),d.command=n.command(d.command),d.args=d.args.map(x=>n.argument(x,m));let g=[d.command].concat(d.args).join(" ");d.args=["/d","/s","/c",`"${g}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=true;}return d}function u(d,p,h){p&&!Array.isArray(p)&&(h=p,p=null),p=p?p.slice(0):[],h=Object.assign({},h);let m={command:d,args:p,options:h,file:void 0,original:{command:d,args:p}};return h.shell?m:l(m)}t.exports=u;}),Vu=q((e,t)=>{var r=process.platform==="win32";function s(c,a){return Object.assign(new Error(`${a} ${c.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${a} ${c.command}`,path:c.command,spawnargs:c.args})}function n(c,a){if(!r)return;let f=c.emit;c.emit=function(l,u){if(l==="exit"){let d=i(u,a);if(d)return f.call(c,"error",d)}return f.apply(c,arguments)};}function i(c,a){return r&&c===1&&!a.file?s(a.original,"spawn"):null}function o(c,a){return r&&c===1&&!a.file?s(a.original,"spawnSync"):null}t.exports={hookChildProcess:n,verifyENOENT:i,verifyENOENTSync:o,notFoundError:s};}),Wu=q((e,t)=>{var r=Re("child_process"),s=Lu(),n=Vu();function i(c,a,f){let l=s(c,a,f),u=r.spawn(l.command,l.args,l.options);return n.hookChildProcess(u,l),u}function o(c,a,f){let l=s(c,a,f),u=r.spawnSync(l.command,l.args,l.options);return u.error=u.error||n.verifyENOENTSync(u.status,l),u}t.exports=i,t.exports.spawn=i,t.exports.sync=o,t.exports._parse=s,t.exports._enoent=n;}),Bu=/^path$/i,zi={key:"PATH",value:""};function qu(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!Bu.test(t))continue;let r=e[t];return r?{key:t,value:r}:zi}return zi}function Ju(e,t){let r=t.value.split(delimiter),s=e,n;do r.push(resolve(s,"node_modules",".bin")),n=s,s=dirname(s);while(s!==n);return {key:t.key,value:r.join(delimiter)}}function Yu(e,t){let r={...process.env,...t},s=Ju(e,qu(r));return r[s.key]=s.value,r}var Xu=e=>{let t=e.length,r=new PassThrough,s=()=>{--t===0&&r.emit("end");};for(let n of e)n.pipe(r,{end:false}),n.on("end",s);return r},Qu=$u(Wu()),Ui=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(e,t){super(`Process exited with non-zero status (${e.exitCode})`),this.result=e,this.output=t;}},tf={timeout:void 0,persist:false},rf={windowsHide:true};function sf(e,t){return {command:normalize(e),args:t??[]}}function nf(e){let t=new AbortController;for(let r of e){if(r.aborted)return t.abort(),r;let s=()=>{t.abort(r.reason);};r.addEventListener("abort",s,{signal:t.signal});}return t.signal}var of=class{_process;_aborted=false;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(e,t,r){this._options={...tf,...r},this._command=e,this._args=t??[],this._processClosed=new Promise(s=>{this._resolveClose=s;});}kill(e){return this._process?.kill(e)===true}get aborted(){return this._aborted}get killed(){return this._process?.killed===true}pipe(e,t,r){return af(e,t,{...r,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let r=Xu(t),s=ef.createInterface({input:r});for await(let n of s)yield n.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new Ui(this)}async _waitForOutput(){let e=this._process;if(!e)throw new Error("No process was started");let t="",r="";if(this._streamOut)for await(let n of this._streamOut)r+=n.toString();if(this._streamErr)for await(let n of this._streamErr)t+=n.toString();if(await this._processClosed,this._options?.stdin&&await this._options.stdin,e.removeAllListeners(),this._thrownError)throw this._thrownError;let s={stderr:t,stdout:r,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new Ui(this,s);return s}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=cwd(),t=this._options,r={...rf,...t.nodeOptions},s=[];this._resetState(),t.timeout!==void 0&&s.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&s.push(t.signal),t.persist===true&&(r.detached=true),s.length>0&&(r.signal=nf(s)),r.env=Yu(e,r.env);let{command:n,args:i}=sf(this._command,this._args),o=(0, Qu._parse)(n,i,r),c=spawn(o.command,o.args,o.options);if(c.stderr&&(this._streamErr=c.stderr),c.stdout&&(this._streamOut=c.stdout),this._process=c,c.once("error",this._onError),c.once("close",this._onClose),t.stdin!==void 0&&c.stdin&&t.stdin.process){let{stdout:a}=t.stdin.process;a&&a.pipe(c.stdin);}}_resetState(){this._aborted=false,this._processClosed=new Promise(e=>{this._resolveClose=e;}),this._thrownError=void 0;}_onError=e=>{if(e.name==="AbortError"&&(!(e.cause instanceof Error)||e.cause.name!=="TimeoutError")){this._aborted=true;return}this._thrownError=e;};_onClose=()=>{this._resolveClose&&this._resolveClose();}},Hr=(e,t,r)=>{let s=new of(e,t,r);return s.spawn(),s},af=Hr;function js(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gr={},Br,Gi;function ee(){if(Gi)return Br;Gi=1;let e,t,r,s,n=true;typeof process<"u"&&({FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:r,TERM:s}=process.env||{},n=process.stdout&&process.stdout.isTTY);let i={enabled:!t&&r==null&&s!=="dumb"&&(e!=null&&e!=="0"||n),reset:a(0,0),bold:a(1,22),dim:a(2,22),italic:a(3,23),underline:a(4,24),inverse:a(7,27),hidden:a(8,28),strikethrough:a(9,29),black:a(30,39),red:a(31,39),green:a(32,39),yellow:a(33,39),blue:a(34,39),magenta:a(35,39),cyan:a(36,39),white:a(37,39),gray:a(90,39),grey:a(90,39),bgBlack:a(40,49),bgRed:a(41,49),bgGreen:a(42,49),bgYellow:a(43,49),bgBlue:a(44,49),bgMagenta:a(45,49),bgCyan:a(46,49),bgWhite:a(47,49)};function o(f,l){let u=0,d,p="",h="";for(;u<f.length;u++)d=f[u],p+=d.open,h+=d.close,~l.indexOf(d.close)&&(l=l.replace(d.rgx,d.close+d.open));return p+l+h}function c(f,l){let u={has:f,keys:l};return u.reset=i.reset.bind(u),u.bold=i.bold.bind(u),u.dim=i.dim.bind(u),u.italic=i.italic.bind(u),u.underline=i.underline.bind(u),u.inverse=i.inverse.bind(u),u.hidden=i.hidden.bind(u),u.strikethrough=i.strikethrough.bind(u),u.black=i.black.bind(u),u.red=i.red.bind(u),u.green=i.green.bind(u),u.yellow=i.yellow.bind(u),u.blue=i.blue.bind(u),u.magenta=i.magenta.bind(u),u.cyan=i.cyan.bind(u),u.white=i.white.bind(u),u.gray=i.gray.bind(u),u.grey=i.grey.bind(u),u.bgBlack=i.bgBlack.bind(u),u.bgRed=i.bgRed.bind(u),u.bgGreen=i.bgGreen.bind(u),u.bgYellow=i.bgYellow.bind(u),u.bgBlue=i.bgBlue.bind(u),u.bgMagenta=i.bgMagenta.bind(u),u.bgCyan=i.bgCyan.bind(u),u.bgWhite=i.bgWhite.bind(u),u}function a(f,l){let u={open:`\x1B[${f}m`,close:`\x1B[${l}m`,rgx:new RegExp(`\\x1b\\[${l}m`,"g")};return function(d){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(f)||(this.has.push(f),this.keys.push(u)),d===void 0?this:i.enabled?o(this.keys,d+""):d+""):d===void 0?c([f],[u]):i.enabled?o([u],d+""):d+""}}return Br=i,Br}var qr,Bi;function yf(){return Bi||(Bi=1,qr=(e,t)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl)return e.name==="a"?"first":e.name==="c"||e.name==="d"?"abort":e.name==="e"?"last":e.name==="g"?"reset":e.name==="n"?"down":e.name==="p"?"up":void 0;if(t){if(e.name==="j")return "down";if(e.name==="k")return "up"}return e.name==="return"||e.name==="enter"?"submit":e.name==="backspace"?"delete":e.name==="delete"?"deleteForward":e.name==="abort"?"abort":e.name==="escape"?"exit":e.name==="tab"?"next":e.name==="pagedown"?"nextPage":e.name==="pageup"?"prevPage":e.name==="home"?"home":e.name==="end"?"end":e.name==="up"?"up":e.name==="down"?"down":e.name==="right"?"right":e.name==="left"?"left":false}}),qr}var Jr,qi;function Os(){return qi||(qi=1,Jr=e=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),r=new RegExp(t,"g");return typeof e=="string"?e.replace(r,""):e}),Jr}var Yr,Ji;function te(){if(Ji)return Yr;Ji=1;let e="\x1B",t=`${e}[`,r="\x07",s={to(o,c){return c?`${t}${c+1};${o+1}H`:`${t}${o+1}G`},move(o,c){let a="";return o<0?a+=`${t}${-o}D`:o>0&&(a+=`${t}${o}C`),c<0?a+=`${t}${-c}A`:c>0&&(a+=`${t}${c}B`),a},up:(o=1)=>`${t}${o}A`,down:(o=1)=>`${t}${o}B`,forward:(o=1)=>`${t}${o}C`,backward:(o=1)=>`${t}${o}D`,nextLine:(o=1)=>`${t}E`.repeat(o),prevLine:(o=1)=>`${t}F`.repeat(o),left:`${t}G`,hide:`${t}?25l`,show:`${t}?25h`,save:`${e}7`,restore:`${e}8`},n={up:(o=1)=>`${t}S`.repeat(o),down:(o=1)=>`${t}T`.repeat(o)},i={screen:`${t}2J`,up:(o=1)=>`${t}1J`.repeat(o),down:(o=1)=>`${t}J`.repeat(o),line:`${t}2K`,lineEnd:`${t}K`,lineStart:`${t}1K`,lines(o){let c="";for(let a=0;a<o;a++)c+=this.line+(a<o-1?s.up():"");return o&&(c+=s.left),c}};return Yr={cursor:s,scroll:n,erase:i,beep:r},Yr}var Zr,Yi;function wf(){if(Yi)return Zr;Yi=1;let e=Os(),{erase:t,cursor:r}=te(),s=n=>[...e(n)].length;return Zr=function(n,i){if(!i)return t.line+r.to(0);let o=0,c=n.split(/\r?\n/);for(let a of c)o+=1+Math.floor(Math.max(s(a)-1,0)/i);return t.lines(o)},Zr}var Xr,Zi;function Vo(){if(Zi)return Xr;Zi=1;let e={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},t={arrowUp:e.arrowUp,arrowDown:e.arrowDown,arrowLeft:e.arrowLeft,arrowRight:e.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return Xr=process.platform==="win32"?t:e,Xr}var Qr,Xi;function xf(){if(Xi)return Qr;Xi=1;let e=ee(),t=Vo(),r=Object.freeze({password:{scale:1,render:a=>"*".repeat(a.length)},emoji:{scale:2,render:a=>"\u{1F603}".repeat(a.length)},invisible:{scale:0,render:a=>""},default:{scale:1,render:a=>`${a}`}}),s=a=>r[a]||r.default,n=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return Qr={styles:r,render:s,symbols:n,symbol:(a,f,l)=>f?n.aborted:l?n.exited:a?n.done:n.default,delimiter:a=>e.gray(a?t.ellipsis:t.pointerSmall),item:(a,f)=>e.gray(a?f?t.pointerSmall:"+":t.line)},Qr}var es,Qi;function vf(){if(Qi)return es;Qi=1;let e=Os();return es=function(t,r){let s=String(e(t)||"").split(/\r?\n/);return r?s.map(n=>Math.ceil(n.length/r)).reduce((n,i)=>n+i):s.length},es}var ts,eo;function bf(){return eo||(eo=1,ts=(e,t={})=>{let r=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",s=t.width;return (e||"").split(/\r?\n/g).map(n=>n.split(/\s+/g).reduce((i,o)=>(o.length+r.length>=s||i[i.length-1].length+o.length+1<s?i[i.length-1]+=` ${o}`:i.push(`${r}${o}`),i),[r]).join(`
47
+ `)).join(`
48
+ `)}),ts}var rs,to;function Rf(){return to||(to=1,rs=(e,t,r)=>{r=r||t;let s=Math.min(t-r,e-Math.floor(r/2));s<0&&(s=0);let n=Math.min(s+r,t);return {startIndex:s,endIndex:n}}),rs}var ss,ro;function ie(){return ro||(ro=1,ss={action:yf(),clear:wf(),style:xf(),strip:Os(),figures:Vo(),lines:vf(),wrap:bf(),entriesToDisplay:Rf()}),ss}var ns,so;function Se(){if(so)return ns;so=1;let e=ef,{action:t}=ie(),r=ff,{beep:s,cursor:n}=te(),i=ee();class o extends r{constructor(a={}){super(),this.firstRender=true,this.in=a.stdin||process.stdin,this.out=a.stdout||process.stdout,this.onRender=(a.onRender||(()=>{})).bind(this);let f=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,f),this.in.isTTY&&this.in.setRawMode(true);let l=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,u=(d,p)=>{let h=t(p,l);h===false?this._&&this._(d,p):typeof this[h]=="function"?this[h](p):this.bell();};this.close=()=>{this.out.write(n.show),this.in.removeListener("keypress",u),this.in.isTTY&&this.in.setRawMode(false),f.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=true;},this.in.on("keypress",u);}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited});}bell(){this.out.write(s);}render(){this.onRender(i),this.firstRender&&(this.firstRender=false);}}return ns=o,ns}var is,no;function Sf(){if(no)return is;no=1;let e=ee(),t=Se(),{erase:r,cursor:s}=te(),{style:n,clear:i,lines:o,figures:c}=ie();class a extends t{constructor(l={}){super(l),this.transform=n.render(l.style),this.scale=this.transform.scale,this.msg=l.message,this.initial=l.initial||"",this.validator=l.validate||(()=>true),this.value="",this.errorMsg=l.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=i("",this.out.columns),this.render();}set value(l){!l&&this.initial?(this.placeholder=true,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=false,this.rendered=this.transform.render(l)),this._value=l,this.fire();}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render();}exit(){this.abort();}abort(){this.value=this.value||this.initial,this.done=this.aborted=true,this.error=false,this.red=false,this.fire(),this.render(),this.out.write(`
49
+ `),this.close();}async validate(){let l=await this.validator(this.value);typeof l=="string"&&(this.errorMsg=l,l=false),this.error=!l;}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=true,this.fire(),this.render();return}this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
50
+ `),this.close();}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render();}moveCursor(l){this.placeholder||(this.cursor=this.cursor+l,this.cursorOffset+=l);}_(l,u){let d=this.value.slice(0,this.cursor),p=this.value.slice(this.cursor);this.value=`${d}${l}${p}`,this.red=false,this.cursor=this.placeholder?0:d.length+1,this.render();}delete(){if(this.isCursorAtStart())return this.bell();let l=this.value.slice(0,this.cursor-1),u=this.value.slice(this.cursor);this.value=`${l}${u}`,this.red=false,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render();}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let l=this.value.slice(0,this.cursor),u=this.value.slice(this.cursor+1);this.value=`${l}${u}`,this.red=false,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render();}first(){this.cursor=0,this.render();}last(){this.cursor=this.value.length,this.render();}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render();}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render();}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(s.down(o(this.outputError,this.out.columns)-1)+i(this.outputError,this.out.columns)),this.out.write(i(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),this.red?e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
51
+ `).reduce((l,u,d)=>l+`
52
+ ${d?" ":c.pointerSmall} ${e.red().italic(u)}`,"")),this.out.write(r.line+s.to(0)+this.outputText+s.save+this.outputError+s.restore+s.move(this.cursorOffset,0)));}}return is=a,is}var os,io;function If(){if(io)return os;io=1;let e=ee(),t=Se(),{style:r,clear:s,figures:n,wrap:i,entriesToDisplay:o}=ie(),{cursor:c}=te();class a extends t{constructor(l={}){super(l),this.msg=l.message,this.hint=l.hint||"- Use arrow-keys. Return to submit.",this.warn=l.warn||"- This option is disabled",this.cursor=l.initial||0,this.choices=l.choices.map((u,d)=>(typeof u=="string"&&(u={title:u,value:d}),{title:u&&(u.title||u.value||u),value:u&&(u.value===void 0?d:u.value),description:u&&u.description,selected:u&&u.selected,disabled:u&&u.disabled})),this.optionsPerPage=l.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=s("",this.out.columns),this.render();}moveCursor(l){this.cursor=l,this.value=this.choices[l].value,this.fire();}reset(){this.moveCursor(0),this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
53
+ `),this.close();}submit(){this.selection.disabled?this.bell():(this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
54
+ `),this.close());}first(){this.moveCursor(0),this.render();}last(){this.moveCursor(this.choices.length-1),this.render();}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render();}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render();}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render();}_(l,u){if(l===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(c.hide):this.out.write(s(this.outputText,this.out.columns)),super.render();let{startIndex:l,endIndex:u}=o(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(false),this.done?this.selection.title:this.selection.disabled?e.yellow(this.warn):e.gray(this.hint)].join(" "),!this.done){this.outputText+=`
55
+ `;for(let d=l;d<u;d++){let p,h,m="",g=this.choices[d];d===l&&l>0?h=n.arrowUp:d===u-1&&u<this.choices.length?h=n.arrowDown:h=" ",g.disabled?(p=this.cursor===d?e.gray().underline(g.title):e.strikethrough().gray(g.title),h=(this.cursor===d?e.bold().gray(n.pointer)+" ":" ")+h):(p=this.cursor===d?e.cyan().underline(g.title):g.title,h=(this.cursor===d?e.cyan(n.pointer)+" ":" ")+h,g.description&&this.cursor===d&&(m=` - ${g.description}`,(h.length+p.length+m.length>=this.out.columns||g.description.split(/\r?\n/).length>1)&&(m=`
56
+ `+i(g.description,{margin:3,width:this.out.columns})))),this.outputText+=`${h} ${p}${e.gray(m)}
57
+ `;}}this.out.write(this.outputText);}}return os=a,os}var as,oo;function Ef(){if(oo)return as;oo=1;let e=ee(),t=Se(),{style:r,clear:s}=ie(),{cursor:n,erase:i}=te();class o extends t{constructor(a={}){super(a),this.msg=a.message,this.value=!!a.initial,this.active=a.active||"on",this.inactive=a.inactive||"off",this.initialValue=this.value,this.render();}reset(){this.value=this.initialValue,this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
58
+ `),this.close();}submit(){this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
59
+ `),this.close();}deactivate(){if(this.value===false)return this.bell();this.value=false,this.render();}activate(){if(this.value===true)return this.bell();this.value=true,this.render();}delete(){this.deactivate();}left(){this.deactivate();}right(){this.activate();}down(){this.deactivate();}up(){this.activate();}next(){this.value=!this.value,this.fire(),this.render();}_(a,f){if(a===" ")this.value=!this.value;else if(a==="1")this.value=true;else if(a==="0")this.value=false;else return this.bell();this.render();}render(){this.closed||(this.firstRender?this.out.write(n.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(this.done),this.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(i.line+n.to(0)+this.outputText));}}return as=o,as}var cs,ao;function fe(){if(ao)return cs;ao=1;class e{constructor({token:r,date:s,parts:n,locales:i}){this.token=r,this.date=s||new Date,this.parts=n||[this],this.locales=i||{};}up(){}down(){}next(){let r=this.parts.indexOf(this);return this.parts.find((s,n)=>n>r&&s instanceof e)}setTo(r){}prev(){let r=[].concat(this.parts).reverse(),s=r.indexOf(this);return r.find((n,i)=>i>s&&n instanceof e)}toString(){return String(this.date)}}return cs=e,cs}var ls,co;function Cf(){if(co)return ls;co=1;let e=fe();class t extends e{constructor(s={}){super(s);}up(){this.date.setHours((this.date.getHours()+12)%24);}down(){this.up();}toString(){let s=this.date.getHours()>12?"pm":"am";return /\A/.test(this.token)?s.toUpperCase():s}}return ls=t,ls}var us,lo;function kf(){if(lo)return us;lo=1;let e=fe(),t=s=>(s=s%10,s===1?"st":s===2?"nd":s===3?"rd":"th");class r extends e{constructor(n={}){super(n);}up(){this.date.setDate(this.date.getDate()+1);}down(){this.date.setDate(this.date.getDate()-1);}setTo(n){this.date.setDate(parseInt(n.substr(-2)));}toString(){let n=this.date.getDate(),i=this.date.getDay();return this.token==="DD"?String(n).padStart(2,"0"):this.token==="Do"?n+t(n):this.token==="d"?i+1:this.token==="ddd"?this.locales.weekdaysShort[i]:this.token==="dddd"?this.locales.weekdays[i]:n}}return us=r,us}var fs,uo;function $f(){if(uo)return fs;uo=1;let e=fe();class t extends e{constructor(s={}){super(s);}up(){this.date.setHours(this.date.getHours()+1);}down(){this.date.setHours(this.date.getHours()-1);}setTo(s){this.date.setHours(parseInt(s.substr(-2)));}toString(){let s=this.date.getHours();return /h/.test(this.token)&&(s=s%12||12),this.token.length>1?String(s).padStart(2,"0"):s}}return fs=t,fs}var ps,fo;function Pf(){if(fo)return ps;fo=1;let e=fe();class t extends e{constructor(s={}){super(s);}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1);}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1);}setTo(s){this.date.setMilliseconds(parseInt(s.substr(-this.token.length)));}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return ps=t,ps}var ds,po;function Tf(){if(po)return ds;po=1;let e=fe();class t extends e{constructor(s={}){super(s);}up(){this.date.setMinutes(this.date.getMinutes()+1);}down(){this.date.setMinutes(this.date.getMinutes()-1);}setTo(s){this.date.setMinutes(parseInt(s.substr(-2)));}toString(){let s=this.date.getMinutes();return this.token.length>1?String(s).padStart(2,"0"):s}}return ds=t,ds}var hs,ho;function Af(){if(ho)return hs;ho=1;let e=fe();class t extends e{constructor(s={}){super(s);}up(){this.date.setMonth(this.date.getMonth()+1);}down(){this.date.setMonth(this.date.getMonth()-1);}setTo(s){s=parseInt(s.substr(-2))-1,this.date.setMonth(s<0?0:s);}toString(){let s=this.date.getMonth(),n=this.token.length;return n===2?String(s+1).padStart(2,"0"):n===3?this.locales.monthsShort[s]:n===4?this.locales.months[s]:String(s+1)}}return hs=t,hs}var ms,mo;function jf(){if(mo)return ms;mo=1;let e=fe();class t extends e{constructor(s={}){super(s);}up(){this.date.setSeconds(this.date.getSeconds()+1);}down(){this.date.setSeconds(this.date.getSeconds()-1);}setTo(s){this.date.setSeconds(parseInt(s.substr(-2)));}toString(){let s=this.date.getSeconds();return this.token.length>1?String(s).padStart(2,"0"):s}}return ms=t,ms}var gs,go;function Of(){if(go)return gs;go=1;let e=fe();class t extends e{constructor(s={}){super(s);}up(){this.date.setFullYear(this.date.getFullYear()+1);}down(){this.date.setFullYear(this.date.getFullYear()-1);}setTo(s){this.date.setFullYear(s.substr(-4));}toString(){let s=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?s.substr(-2):s}}return gs=t,gs}var ys,yo;function Nf(){return yo||(yo=1,ys={DatePart:fe(),Meridiem:Cf(),Day:kf(),Hours:$f(),Milliseconds:Pf(),Minutes:Tf(),Month:Af(),Seconds:jf(),Year:Of()}),ys}var ws,wo;function _f(){if(wo)return ws;wo=1;let e=ee(),t=Se(),{style:r,clear:s,figures:n}=ie(),{erase:i,cursor:o}=te(),{DatePart:c,Meridiem:a,Day:f,Hours:l,Milliseconds:u,Minutes:d,Month:p,Seconds:h,Year:m}=Nf(),g=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,x={1:({token:v})=>v.replace(/\\(.)/g,"$1"),2:v=>new f(v),3:v=>new p(v),4:v=>new m(v),5:v=>new a(v),6:v=>new l(v),7:v=>new d(v),8:v=>new h(v),9:v=>new u(v)},y={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class w extends t{constructor(b={}){super(b),this.msg=b.message,this.cursor=0,this.typed="",this.locales=Object.assign(y,b.locales),this._date=b.initial||new Date,this.errorMsg=b.error||"Please Enter A Valid Value",this.validator=b.validate||(()=>true),this.mask=b.mask||"YYYY-MM-DD HH:mm:ss",this.clear=s("",this.out.columns),this.render();}get value(){return this.date}get date(){return this._date}set date(b){b&&this._date.setTime(b.getTime());}set mask(b){let R;for(this.parts=[];R=g.exec(b);){let k=R.shift(),P=R.findIndex(U=>U!=null);this.parts.push(P in x?x[P]({token:R[P]||k,date:this.date,parts:this.parts,locales:this.locales}):R[P]||k);}let T=this.parts.reduce((k,P)=>(typeof P=="string"&&typeof k[k.length-1]=="string"?k[k.length-1]+=P:k.push(P),k),[]);this.parts.splice(0),this.parts.push(...T),this.reset();}moveCursor(b){this.typed="",this.cursor=b,this.fire();}reset(){this.moveCursor(this.parts.findIndex(b=>b instanceof c)),this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.error=false,this.fire(),this.render(),this.out.write(`
60
+ `),this.close();}async validate(){let b=await this.validator(this.value);typeof b=="string"&&(this.errorMsg=b,b=false),this.error=!b;}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
61
+ `),this.close();}up(){this.typed="",this.parts[this.cursor].up(),this.render();}down(){this.typed="",this.parts[this.cursor].down(),this.render();}left(){let b=this.parts[this.cursor].prev();if(b==null)return this.bell();this.moveCursor(this.parts.indexOf(b)),this.render();}right(){let b=this.parts[this.cursor].next();if(b==null)return this.bell();this.moveCursor(this.parts.indexOf(b)),this.render();}next(){let b=this.parts[this.cursor].next();this.moveCursor(b?this.parts.indexOf(b):this.parts.findIndex(R=>R instanceof c)),this.render();}_(b){/\d/.test(b)&&(this.typed+=b,this.parts[this.cursor].setTo(this.typed),this.render());}render(){this.closed||(this.firstRender?this.out.write(o.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(false),this.parts.reduce((b,R,T)=>b.concat(T===this.cursor&&!this.done?e.cyan().underline(R.toString()):R),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
62
+ `).reduce((b,R,T)=>b+`
63
+ ${T?" ":n.pointerSmall} ${e.red().italic(R)}`,"")),this.out.write(i.line+o.to(0)+this.outputText));}}return ws=w,ws}var xs,xo;function Ff(){if(xo)return xs;xo=1;let e=ee(),t=Se(),{cursor:r,erase:s}=te(),{style:n,figures:i,clear:o,lines:c}=ie(),a=/[0-9]/,f=d=>d!==void 0,l=(d,p)=>{let h=Math.pow(10,p);return Math.round(d*h)/h};class u extends t{constructor(p={}){super(p),this.transform=n.render(p.style),this.msg=p.message,this.initial=f(p.initial)?p.initial:"",this.float=!!p.float,this.round=p.round||2,this.inc=p.increment||1,this.min=f(p.min)?p.min:-1/0,this.max=f(p.max)?p.max:1/0,this.errorMsg=p.error||"Please Enter A Valid Value",this.validator=p.validate||(()=>true),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render();}set value(p){!p&&p!==0?(this.placeholder=true,this.rendered=e.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=false,this.rendered=this.transform.render(`${l(p,this.round)}`),this._value=l(p,this.round)),this.fire();}get value(){return this._value}parse(p){return this.float?parseFloat(p):parseInt(p)}valid(p){return p==="-"||p==="."&&this.float||a.test(p)}reset(){this.typed="",this.value="",this.fire(),this.render();}exit(){this.abort();}abort(){let p=this.value;this.value=p!==""?p:this.initial,this.done=this.aborted=true,this.error=false,this.fire(),this.render(),this.out.write(`
64
+ `),this.close();}async validate(){let p=await this.validator(this.value);typeof p=="string"&&(this.errorMsg=p,p=false),this.error=!p;}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let p=this.value;this.value=p!==""?p:this.initial,this.done=true,this.aborted=false,this.error=false,this.fire(),this.render(),this.out.write(`
65
+ `),this.close();}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render();}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render();}delete(){let p=this.value.toString();if(p.length===0)return this.bell();this.value=this.parse(p=p.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render();}next(){this.value=this.initial,this.fire(),this.render();}_(p,h){if(!this.valid(p))return this.bell();let m=Date.now();if(m-this.lastHit>1e3&&(this.typed=""),this.typed+=p,this.lastHit=m,this.color="cyan",p===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render();}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(r.down(c(this.outputError,this.out.columns)-1)+o(this.outputError,this.out.columns)),this.out.write(o(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(this.done),!this.done||!this.done&&!this.placeholder?e[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
66
+ `).reduce((p,h,m)=>p+`
67
+ ${m?" ":i.pointerSmall} ${e.red().italic(h)}`,"")),this.out.write(s.line+r.to(0)+this.outputText+r.save+this.outputError+r.restore));}}return xs=u,xs}var vs,vo;function Wo(){if(vo)return vs;vo=1;let e=ee(),{cursor:t}=te(),r=Se(),{clear:s,figures:n,style:i,wrap:o,entriesToDisplay:c}=ie();class a extends r{constructor(l={}){super(l),this.msg=l.message,this.cursor=l.cursor||0,this.scrollIndex=l.cursor||0,this.hint=l.hint||"",this.warn=l.warn||"- This option is disabled -",this.minSelected=l.min,this.showMinError=false,this.maxChoices=l.max,this.instructions=l.instructions,this.optionsPerPage=l.optionsPerPage||10,this.value=l.choices.map((u,d)=>(typeof u=="string"&&(u={title:u,value:d}),{title:u&&(u.title||u.value||u),description:u&&u.description,value:u&&(u.value===void 0?d:u.value),selected:u&&u.selected,disabled:u&&u.disabled})),this.clear=s("",this.out.columns),l.overrideRender||this.render();}reset(){this.value.map(l=>!l.selected),this.cursor=0,this.fire(),this.render();}selected(){return this.value.filter(l=>l.selected)}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
68
+ `),this.close();}submit(){let l=this.value.filter(u=>u.selected);this.minSelected&&l.length<this.minSelected?(this.showMinError=true,this.render()):(this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
69
+ `),this.close());}first(){this.cursor=0,this.render();}last(){this.cursor=this.value.length-1,this.render();}next(){this.cursor=(this.cursor+1)%this.value.length,this.render();}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render();}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render();}left(){this.value[this.cursor].selected=false,this.render();}right(){if(this.value.filter(l=>l.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true,this.render();}handleSpaceToggle(){let l=this.value[this.cursor];if(l.selected)l.selected=false,this.render();else {if(l.disabled||this.value.filter(u=>u.selected).length>=this.maxChoices)return this.bell();l.selected=true,this.render();}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let l=!this.value[this.cursor].selected;this.value.filter(u=>!u.disabled).forEach(u=>u.selected=l),this.render();}_(l,u){if(l===" ")this.handleSpaceToggle();else if(l==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
70
+ Instructions:
71
+ ${n.arrowUp}/${n.arrowDown}: Highlight option
72
+ ${n.arrowLeft}/${n.arrowRight}/[space]: Toggle selection
73
+ `+(this.maxChoices===void 0?` a: Toggle all
74
+ `:"")+" enter/return: Complete answer":""}renderOption(l,u,d,p){let h=(u.selected?e.green(n.radioOn):n.radioOff)+" "+p+" ",m,g;return u.disabled?m=l===d?e.gray().underline(u.title):e.strikethrough().gray(u.title):(m=l===d?e.cyan().underline(u.title):u.title,l===d&&u.description&&(g=` - ${u.description}`,(h.length+m.length+g.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(g=`
75
+ `+o(u.description,{margin:h.length,width:this.out.columns})))),h+m+e.gray(g||"")}paginateOptions(l){if(l.length===0)return e.red("No matches for this query.");let{startIndex:u,endIndex:d}=c(this.cursor,l.length,this.optionsPerPage),p,h=[];for(let m=u;m<d;m++)m===u&&u>0?p=n.arrowUp:m===d-1&&d<l.length?p=n.arrowDown:p=" ",h.push(this.renderOption(this.cursor,l[m],m,p));return `
76
+ `+h.join(`
77
+ `)}renderOptions(l){return this.done?"":this.paginateOptions(l)}renderDoneOrInstructions(){if(this.done)return this.value.filter(u=>u.selected).map(u=>u.title).join(", ");let l=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&l.push(e.yellow(this.warn)),l.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let l=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(false),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(l+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=false),l+=this.renderOptions(this.value),this.out.write(this.clear+l),this.clear=s(l,this.out.columns);}}return vs=a,vs}var bs,bo;function Mf(){if(bo)return bs;bo=1;let e=ee(),t=Se(),{erase:r,cursor:s}=te(),{style:n,clear:i,figures:o,wrap:c,entriesToDisplay:a}=ie(),f=(p,h)=>p[h]&&(p[h].value||p[h].title||p[h]),l=(p,h)=>p[h]&&(p[h].title||p[h].value||p[h]),u=(p,h)=>{let m=p.findIndex(g=>g.value===h||g.title===h);return m>-1?m:void 0};class d extends t{constructor(h={}){super(h),this.msg=h.message,this.suggest=h.suggest,this.choices=h.choices,this.initial=typeof h.initial=="number"?h.initial:u(h.choices,h.initial),this.select=this.initial||h.cursor||0,this.i18n={noMatches:h.noMatches||"no matches found"},this.fallback=h.fallback||this.initial,this.clearFirst=h.clearFirst||false,this.suggestions=[],this.input="",this.limit=h.limit||10,this.cursor=0,this.transform=n.render(h.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=i("",this.out.columns),this.complete(this.render),this.render();}set fallback(h){this._fb=Number.isSafeInteger(parseInt(h))?parseInt(h):h;}get fallback(){let h;return typeof this._fb=="number"?h=this.choices[this._fb]:typeof this._fb=="string"&&(h={title:this._fb}),h||this._fb||{title:this.i18n.noMatches}}moveSelect(h){this.select=h,this.suggestions.length>0?this.value=f(this.suggestions,h):this.value=this.fallback.value,this.fire();}async complete(h){let m=this.completing=this.suggest(this.input,this.choices),g=await m;if(this.completing!==m)return;this.suggestions=g.map((y,w,v)=>({title:l(v,w),value:f(v,w),description:y.description})),this.completing=false;let x=Math.max(g.length-1,0);this.moveSelect(Math.min(x,this.select)),h&&h();}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render();}),this.render();}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
78
+ `),this.close());}abort(){this.done=this.aborted=true,this.exited=false,this.fire(),this.render(),this.out.write(`
79
+ `),this.close();}submit(){this.done=true,this.aborted=this.exited=false,this.fire(),this.render(),this.out.write(`
80
+ `),this.close();}_(h,m){let g=this.input.slice(0,this.cursor),x=this.input.slice(this.cursor);this.input=`${g}${h}${x}`,this.cursor=g.length+1,this.complete(this.render),this.render();}delete(){if(this.cursor===0)return this.bell();let h=this.input.slice(0,this.cursor-1),m=this.input.slice(this.cursor);this.input=`${h}${m}`,this.complete(this.render),this.cursor=this.cursor-1,this.render();}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let h=this.input.slice(0,this.cursor),m=this.input.slice(this.cursor+1);this.input=`${h}${m}`,this.complete(this.render),this.render();}first(){this.moveSelect(0),this.render();}last(){this.moveSelect(this.suggestions.length-1),this.render();}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render();}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render();}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render();}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render();}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render();}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render();}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render();}renderOption(h,m,g,x){let y,w=g?o.arrowUp:x?o.arrowDown:" ",v=m?e.cyan().underline(h.title):h.title;return w=(m?e.cyan(o.pointer)+" ":" ")+w,h.description&&(y=` - ${h.description}`,(w.length+v.length+y.length>=this.out.columns||h.description.split(/\r?\n/).length>1)&&(y=`
81
+ `+c(h.description,{margin:3,width:this.out.columns}))),w+" "+v+e.gray(y||"")}render(){if(this.closed)return;this.firstRender?this.out.write(s.hide):this.out.write(i(this.outputText,this.out.columns)),super.render();let{startIndex:h,endIndex:m}=a(this.select,this.choices.length,this.limit);if(this.outputText=[n.symbol(this.done,this.aborted,this.exited),e.bold(this.msg),n.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){let g=this.suggestions.slice(h,m).map((x,y)=>this.renderOption(x,this.select===y+h,y===0&&h>0,y+h===m-1&&m<this.choices.length)).join(`
82
+ `);this.outputText+=`
83
+ `+(g||e.gray(this.fallback.title));}this.out.write(r.line+s.to(0)+this.outputText);}}return bs=d,bs}var Rs,Ro;function Df(){if(Ro)return Rs;Ro=1;let e=ee(),{cursor:t}=te(),r=Wo(),{clear:s,style:n,figures:i}=ie();class o extends r{constructor(a={}){a.overrideRender=true,super(a),this.inputValue="",this.clear=s("",this.out.columns),this.filteredOptions=this.value,this.render();}last(){this.cursor=this.filteredOptions.length-1,this.render();}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render();}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render();}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render();}left(){this.filteredOptions[this.cursor].selected=false,this.render();}right(){if(this.value.filter(a=>a.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=true,this.render();}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions());}updateFilteredOptions(){let a=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(l=>this.inputValue?!!(typeof l.title=="string"&&l.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof l.value=="string"&&l.value.toLowerCase().includes(this.inputValue.toLowerCase())):true);let f=this.filteredOptions.findIndex(l=>l===a);this.cursor=f<0?0:f,this.render();}handleSpaceToggle(){let a=this.filteredOptions[this.cursor];if(a.selected)a.selected=false,this.render();else {if(a.disabled||this.value.filter(f=>f.selected).length>=this.maxChoices)return this.bell();a.selected=true,this.render();}}handleInputChange(a){this.inputValue=this.inputValue+a,this.updateFilteredOptions();}_(a,f){a===" "?this.handleSpaceToggle():this.handleInputChange(a);}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
84
+ Instructions:
85
+ ${i.arrowUp}/${i.arrowDown}: Highlight option
86
+ ${i.arrowLeft}/${i.arrowRight}/[space]: Toggle selection
87
+ [a,b,c]/delete: Filter choices
88
+ enter/return: Complete answer
89
+ `:""}renderCurrentInput(){return `
90
+ Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}
91
+ `}renderOption(a,f,l,u){let d=(f.selected?e.green(i.radioOn):i.radioOff)+" "+u+" ",p;return f.disabled?p=a===l?e.gray().underline(f.title):e.strikethrough().gray(f.title):p=a===l?e.cyan().underline(f.title):f.title,d+p}renderDoneOrInstructions(){if(this.done)return this.value.filter(f=>f.selected).map(f=>f.title).join(", ");let a=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&a.push(e.yellow(this.warn)),a.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let a=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(false),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(a+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=false),a+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+a),this.clear=s(a,this.out.columns);}}return Rs=o,Rs}var Ss,So;function Lf(){if(So)return Ss;So=1;let e=ee(),t=Se(),{style:r,clear:s}=ie(),{erase:n,cursor:i}=te();class o extends t{constructor(a={}){super(a),this.msg=a.message,this.value=a.initial,this.initialValue=!!a.initial,this.yesMsg=a.yes||"yes",this.yesOption=a.yesOption||"(Y/n)",this.noMsg=a.no||"no",this.noOption=a.noOption||"(y/N)",this.render();}reset(){this.value=this.initialValue,this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
92
+ `),this.close();}submit(){this.value=this.value||false,this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
93
+ `),this.close();}_(a,f){return a.toLowerCase()==="y"?(this.value=true,this.submit()):a.toLowerCase()==="n"?(this.value=false,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(i.hide):this.out.write(s(this.outputText,this.out.columns)),super.render(),this.outputText=[r.symbol(this.done,this.aborted),e.bold(this.msg),r.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(n.line+i.to(0)+this.outputText));}}return Ss=o,Ss}var Is,Io;function Vf(){return Io||(Io=1,Is={TextPrompt:Sf(),SelectPrompt:If(),TogglePrompt:Ef(),DatePrompt:_f(),NumberPrompt:Ff(),MultiselectPrompt:Wo(),AutocompletePrompt:Mf(),AutocompleteMultiselectPrompt:Df(),ConfirmPrompt:Lf()}),Is}var Eo;function Wf(){return Eo||(Eo=1,(function(e){let t=e,r=Vf(),s=o=>o;function n(o,c,a={}){return new Promise((f,l)=>{let u=new r[o](c),d=a.onAbort||s,p=a.onSubmit||s,h=a.onExit||s;u.on("state",c.onState||s),u.on("submit",m=>f(p(m))),u.on("exit",m=>f(h(m))),u.on("abort",m=>l(d(m)));})}t.text=o=>n("TextPrompt",o),t.password=o=>(o.style="password",t.text(o)),t.invisible=o=>(o.style="invisible",t.text(o)),t.number=o=>n("NumberPrompt",o),t.date=o=>n("DatePrompt",o),t.confirm=o=>n("ConfirmPrompt",o),t.list=o=>{let c=o.separator||",";return n("TextPrompt",o,{onSubmit:a=>a.split(c).map(f=>f.trim())})},t.toggle=o=>n("TogglePrompt",o),t.select=o=>n("SelectPrompt",o),t.multiselect=o=>{o.choices=[].concat(o.choices||[]);let c=a=>a.filter(f=>f.selected).map(f=>f.value);return n("MultiselectPrompt",o,{onAbort:c,onSubmit:c})},t.autocompleteMultiselect=o=>{o.choices=[].concat(o.choices||[]);let c=a=>a.filter(f=>f.selected).map(f=>f.value);return n("AutocompleteMultiselectPrompt",o,{onAbort:c,onSubmit:c})};let i=(o,c)=>Promise.resolve(c.filter(a=>a.title.slice(0,o.length).toLowerCase()===o.toLowerCase()));t.autocomplete=o=>(o.suggest=o.suggest||i,o.choices=[].concat(o.choices||[]),n("AutocompletePrompt",o));})(Gr)),Gr}var Es,Co;function zf(){if(Co)return Es;Co=1;let e=Wf(),t=["suggest","format","onState","validate","onRender","type"],r=()=>{};async function s(c=[],{onSubmit:a=r,onCancel:f=r}={}){let l={},u=s._override||{};c=[].concat(c);let d,p,h,m,g,x,y=async(w,v,b=false)=>{if(!(!b&&w.validate&&w.validate(v)!==true))return w.format?await w.format(v,l):v};for(p of c)if({name:m,type:g}=p,typeof g=="function"&&(g=await g(d,{...l},p),p.type=g),!!g){for(let w in p){if(t.includes(w))continue;let v=p[w];p[w]=typeof v=="function"?await v(d,{...l},x):v;}if(x=p,typeof p.message!="string")throw new Error("prompt message is required");if({name:m,type:g}=p,e[g]===void 0)throw new Error(`prompt type (${g}) is not defined`);if(u[p.name]!==void 0&&(d=await y(p,u[p.name]),d!==void 0)){l[m]=d;continue}try{d=s._injected?n(s._injected,p.initial):await e[g](p),l[m]=d=await y(p,d,!0),h=await a(p,d,l);}catch{h=!await f(p,l);}if(h)return l}return l}function n(c,a){let f=c.shift();if(f instanceof Error)throw f;return f===void 0?a:f}function i(c){s._injected=(s._injected||[]).concat(c);}function o(c){s._override=Object.assign({},c);}return Es=Object.assign(s,{prompt:s,prompts:e,inject:i,override:o}),Es}var Cs,ko;function Uf(){return ko||(ko=1,Cs=zf()),Cs}var Hf=Uf(),Kf=js(Hf),Ns=globalThis.window?.document!==void 0;globalThis.process?.versions?.node;globalThis.process?.versions?.bun;globalThis.Deno?.version?.deno;globalThis.process?.versions?.electron;globalThis.navigator?.userAgent?.includes("jsdom");typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope;typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope;typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope;var lr=globalThis.navigator?.userAgentData?.platform;lr==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===true||globalThis.process?.platform;lr==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform;lr==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===true||globalThis.navigator?.userAgent?.includes(" Linux ")===true||globalThis.process?.platform;lr==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===true||globalThis.process?.platform;var $o="\x1B]",Po="\x07",cr=";";!Ns&&ne.env.TERM_PROGRAM;!Ns&&ne.platform;Ns||ne.cwd;var Gf=(e,t)=>[$o,"8",cr,cr,t,Po,e,$o,"8",cr,cr,Po].join(""),ks,To;function zo(){return To||(To=1,ks=(e,t=process.argv)=>{let r=e.startsWith("-")?"":e.length===1?"-":"--",s=t.indexOf(r+e),n=t.indexOf("--");return s!==-1&&(n===-1||s<n)}),ks}var $s,Ao;function Bf(){if(Ao)return $s;Ao=1;let e=pf,t=df,r=zo(),{env:s}=process,n;r("no-color")||r("no-colors")||r("color=false")||r("color=never")?n=0:(r("color")||r("colors")||r("color=true")||r("color=always"))&&(n=1),"FORCE_COLOR"in s&&(s.FORCE_COLOR==="true"?n=1:s.FORCE_COLOR==="false"?n=0:n=s.FORCE_COLOR.length===0?1:Math.min(parseInt(s.FORCE_COLOR,10),3));function i(a){return a===0?false:{level:a,hasBasic:true,has256:a>=2,has16m:a>=3}}function o(a,f){if(n===0)return 0;if(r("color=16m")||r("color=full")||r("color=truecolor"))return 3;if(r("color=256"))return 2;if(a&&!f&&n===void 0)return 0;let l=n||0;if(s.TERM==="dumb")return l;if(process.platform==="win32"){let u=e.release().split(".");return Number(u[0])>=10&&Number(u[2])>=10586?Number(u[2])>=14931?3:2:1}if("CI"in s)return ["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(u=>u in s)||s.CI_NAME==="codeship"?1:l;if("TEAMCITY_VERSION"in s)return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(s.TEAMCITY_VERSION)?1:0;if(s.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in s){let u=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case "iTerm.app":return u>=3?3:2;case "Apple_Terminal":return 2}}return /-256(color)?$/i.test(s.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(s.TERM)||"COLORTERM"in s?1:l}function c(a){let f=o(a,a&&a.isTTY);return i(f)}return $s={supportsColor:c,stdout:i(o(true,t.isatty(1))),stderr:i(o(true,t.isatty(2)))},$s}var Ps,jo;function qf(){if(jo)return Ps;jo=1;let e=Bf(),t=zo();function r(n){if(/^\d{3,4}$/.test(n)){let o=/(\d{1,2})(\d{2})/.exec(n)||[];return {major:0,minor:parseInt(o[1],10),patch:parseInt(o[2],10)}}let i=(n||"").split(".").map(o=>parseInt(o,10));return {major:i[0],minor:i[1],patch:i[2]}}function s(n){let{CI:i,FORCE_HYPERLINK:o,NETLIFY:c,TEAMCITY_VERSION:a,TERM_PROGRAM:f,TERM_PROGRAM_VERSION:l,VTE_VERSION:u,TERM:d}=process.env;if(o)return !(o.length>0&&parseInt(o,10)===0);if(t("no-hyperlink")||t("no-hyperlinks")||t("hyperlink=false")||t("hyperlink=never"))return false;if(t("hyperlink=true")||t("hyperlink=always")||c)return true;if(!e.supportsColor(n)||n&&!n.isTTY)return false;if("WT_SESSION"in process.env)return true;if(process.platform==="win32"||i||a)return false;if(f){let p=r(l||"");switch(f){case "iTerm.app":return p.major===3?p.minor>=1:p.major>3;case "WezTerm":return p.major>=20200620;case "vscode":return p.major>1||p.major===1&&p.minor>=72;case "ghostty":return true}}if(u){if(u==="0.50.0")return false;let p=r(u);return p.major>0||p.minor>=50}switch(d){case "alacritty":return true}return false}return Ps={supportsHyperlink:s,stdout:s(process.stdout),stderr:s(process.stderr)},Ps}var Jf=qf(),_s=js(Jf);function xt(e,t,{target:r="stdout",...s}={}){return _s[r]?Gf(e,t):s.fallback===false?e:typeof s.fallback=="function"?s.fallback(e,t):`${e} (\u200B${t}\u200B)`}xt.isSupported=_s.stdout;xt.stderr=(e,t,r={})=>xt(e,t,{target:"stderr",...r});xt.stderr.isSupported=_s.stderr;var Q={},_e={},Oo;function Yf(){if(Oo)return _e;Oo=1,Object.defineProperty(_e,"__esModule",{value:true}),_e.sync=_e.isexe=void 0;let e=Do,t=Vi__default,r=async(o,c={})=>{let{ignoreErrors:a=false}=c;try{return n(await(0,t.stat)(o),c)}catch(f){let l=f;if(a||l.code==="EACCES")return false;throw l}};_e.isexe=r;let s=(o,c={})=>{let{ignoreErrors:a=false}=c;try{return n((0,e.statSync)(o),c)}catch(f){let l=f;if(a||l.code==="EACCES")return false;throw l}};_e.sync=s;let n=(o,c)=>o.isFile()&&i(o,c),i=(o,c)=>{let a=c.uid??process.getuid?.(),f=c.groups??process.getgroups?.()??[],l=c.gid??process.getgid?.()??f[0];if(a===void 0||l===void 0)throw new Error("cannot get uid or gid");let u=new Set([l,...f]),d=o.mode,p=o.uid,h=o.gid,m=parseInt("100",8),g=parseInt("010",8),x=parseInt("001",8),y=m|g;return !!(d&x||d&g&&u.has(h)||d&m&&p===a||d&y&&a===0)};return _e}var Fe={},No;function Zf(){if(No)return Fe;No=1,Object.defineProperty(Fe,"__esModule",{value:true}),Fe.sync=Fe.isexe=void 0;let e=Do,t=Vi__default,r=async(o,c={})=>{let{ignoreErrors:a=false}=c;try{return i(await(0,t.stat)(o),o,c)}catch(f){let l=f;if(a||l.code==="EACCES")return false;throw l}};Fe.isexe=r;let s=(o,c={})=>{let{ignoreErrors:a=false}=c;try{return i((0,e.statSync)(o),o,c)}catch(f){let l=f;if(a||l.code==="EACCES")return false;throw l}};Fe.sync=s;let n=(o,c)=>{let{pathExt:a=process.env.PATHEXT||""}=c,f=a.split(";");if(f.indexOf("")!==-1)return true;for(let l=0;l<f.length;l++){let u=f[l].toLowerCase(),d=o.substring(o.length-u.length).toLowerCase();if(u&&d===u)return true}return false},i=(o,c,a)=>o.isFile()&&n(c,a);return Fe}var Ts={},_o;function Xf(){return _o||(_o=1,Object.defineProperty(Ts,"__esModule",{value:true})),Ts}var Fo;function Qf(){return Fo||(Fo=1,(function(e){var t=Q&&Q.__createBinding||(Object.create?(function(f,l,u,d){d===void 0&&(d=u);var p=Object.getOwnPropertyDescriptor(l,u);(!p||("get"in p?!l.__esModule:p.writable||p.configurable))&&(p={enumerable:true,get:function(){return l[u]}}),Object.defineProperty(f,d,p);}):(function(f,l,u,d){d===void 0&&(d=u),f[d]=l[u];})),r=Q&&Q.__setModuleDefault||(Object.create?(function(f,l){Object.defineProperty(f,"default",{enumerable:true,value:l});}):function(f,l){f.default=l;}),s=Q&&Q.__importStar||function(f){if(f&&f.__esModule)return f;var l={};if(f!=null)for(var u in f)u!=="default"&&Object.prototype.hasOwnProperty.call(f,u)&&t(l,f,u);return r(l,f),l},n=Q&&Q.__exportStar||function(f,l){for(var u in f)u!=="default"&&!Object.prototype.hasOwnProperty.call(l,u)&&t(l,f,u);};Object.defineProperty(e,"__esModule",{value:true}),e.sync=e.isexe=e.posix=e.win32=void 0;let i=s(Yf());e.posix=i;let o=s(Zf());e.win32=o,n(Xf(),e);let a=(process.env._ISEXE_TEST_PLATFORM_||process.platform)==="win32"?o:i;e.isexe=a.isexe,e.sync=a.sync;})(Q)),Q}var As,Mo;function ep(){if(Mo)return As;Mo=1;let{isexe:e,sync:t}=Qf(),{join:r,delimiter:s,sep:n,posix:i}=S__default,o=process.platform==="win32",c=new RegExp(`[${i.sep}${n===i.sep?"":n}]`.replace(/(\\)/g,"\\$1")),a=new RegExp(`^\\.${c.source}`),f=h=>Object.assign(new Error(`not found: ${h}`),{code:"ENOENT"}),l=(h,{path:m=process.env.PATH,pathExt:g=process.env.PATHEXT,delimiter:x=s})=>{let y=h.match(c)?[""]:[...o?[process.cwd()]:[],...(m||"").split(x)];if(o){let w=g||[".EXE",".CMD",".BAT",".COM"].join(x),v=w.split(x).flatMap(b=>[b,b.toLowerCase()]);return h.includes(".")&&v[0]!==""&&v.unshift(""),{pathEnv:y,pathExt:v,pathExtExe:w}}return {pathEnv:y,pathExt:[""]}},u=(h,m)=>{let g=/^".*"$/.test(h)?h.slice(1,-1):h;return (!g&&a.test(m)?m.slice(0,2):"")+r(g,m)},d=async(h,m={})=>{let{pathEnv:g,pathExt:x,pathExtExe:y}=l(h,m),w=[];for(let v of g){let b=u(v,h);for(let R of x){let T=b+R;if(await e(T,{pathExt:y,ignoreErrors:true})){if(!m.all)return T;w.push(T);}}}if(m.all&&w.length)return w;if(m.nothrow)return null;throw f(h)},p=(h,m={})=>{let{pathEnv:g,pathExt:x,pathExtExe:y}=l(h,m),w=[];for(let v of g){let b=u(v,h);for(let R of x){let T=b+R;if(t(T,{pathExt:y,ignoreErrors:true})){if(!m.all)return T;w.push(T);}}}if(m.all&&w.length)return w;if(m.nothrow)return null;throw f(h)};return As=d,d.sync=p,As}var tp=ep(),rp=js(tp);join(pf.tmpdir(),"antfu-ni");function Uo(e){return rp.sync(e,{nothrow:true})!==null}async function Fs({autoInstall:e,programmatic:t,cwd:r}={}){let{name:s,agent:n,version:i}=await Ur({cwd:r,onUnknown:o=>{t||console.warn("[ni] Unknown packageManager:",o);}})||{};if(s&&!Uo(s)&&!t){if(!e){console.warn(`[ni] Detected ${s} but it doesn't seem to be installed.
94
+ `),ne.env.CI&&ne.exit(1);let o=xt(s,Di[s]),{tryInstall:c}=await Kf({name:"tryInstall",type:"confirm",message:`Would you like to globally install ${o}?`});c||ne.exit(1);}await Hr("npm",["i","-g",`${s}${i?`@${i}`:""}`],{nodeOptions:{stdio:"inherit",cwd:r},throwOnError:true});}return n}ne.env.NI_CONFIG_FILE;var np=ne.platform==="win32"?ne.env.USERPROFILE:ne.env.HOME;S__default.join(np||"~/",".nirc");async function Ms(e,{withFallback:t}={withFallback:false}){let r=await Fs({programmatic:true,cwd:e});return r==="yarn@berry"?"yarn":r==="pnpm@6"?"pnpm":r==="bun"?"bun":r==="deno"?"deno":t?Ds()??"npm":r??"npm"}function Ds(e=process.env.npm_config_user_agent||""){return e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":e.startsWith("deno")?"deno":e.startsWith("npm")?"npm":null}function Ls(e){return e==="pnpm"?"pnpm dlx":e==="bun"?"bunx":"npx"}async function rv(e){let t=await Ms(e);return Ls(t)}var Ho={name:"shadcn",version:"4.16.0",description:"Add components to your apps.",publishConfig:{access:"public"},license:"MIT",author:{name:"shadcn",url:"https://twitter.com/shadcn"},repository:{type:"git",url:"https://github.com/shadcn-ui/ui.git",directory:"packages/shadcn"},files:["dist"],keywords:["components","ui","tailwind","radix-ui","base-ui","shadcn"],type:"module",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"},"./registry":{types:"./dist/registry/index.d.ts",default:"./dist/registry/index.js"},"./schema":{types:"./dist/schema/index.d.ts",default:"./dist/schema/index.js"},"./mcp":{types:"./dist/mcp/index.d.ts",default:"./dist/mcp/index.js"},"./utils":{types:"./dist/utils/index.d.ts",default:"./dist/utils/index.js"},"./icons":{types:"./dist/icons/index.d.ts",default:"./dist/icons/index.js"},"./preset":{types:"./dist/preset/index.d.ts",default:"./dist/preset/index.js"},"./tailwind.css":"./dist/tailwind.css"},sideEffects:["./dist/tailwind.css"],bin:"./dist/index.js",engines:{node:">=20.18.1"},scripts:{dev:"tsup --watch",build:"tsup",typecheck:"tsc --noEmit",clean:"rimraf dist && rimraf components","start:dev":"cross-env REGISTRY_URL=http://localhost:4000/r SHADCN_TEMPLATE_DIR=../../templates node dist/index.js","start:prod":"cross-env REGISTRY_URL=https://ui.shadcn.com/r node dist/index.js",start:"node dist/index.js","format:write":'prettier --write "**/*.{ts,tsx,mdx}" --cache',"format:check":'prettier --check "**/*.{ts,tsx,mdx}" --cache',release:"changeset version","pub:beta":"pnpm build && pnpm publish --no-git-checks --access public --tag beta","pub:rc":"pnpm build && pnpm publish --no-git-checks --access public --tag rc","pub:next":"pnpm build && pnpm publish --no-git-checks --access public --tag next","pub:release":"pnpm build && pnpm publish --access public",test:"vitest run","test:dev":"REGISTRY_URL=http://localhost:4000/r SHADCN_TEMPLATE_DIR=../../templates vitest run","mcp:inspect":"pnpm dlx @modelcontextprotocol/inspector node dist/index.js mcp"},dependencies:{"@babel/core":"^7.28.0","@babel/parser":"^7.28.0","@babel/plugin-transform-typescript":"^7.28.0","@babel/preset-typescript":"^7.27.1","@dotenvx/dotenvx":"^1.48.4","@modelcontextprotocol/sdk":"^1.26.0","@types/validate-npm-package-name":"^4.0.2",browserslist:"^4.26.2",commander:"^14.0.0",cosmiconfig:"^9.0.0",dedent:"^1.6.0",deepmerge:"^4.3.1",diff:"^8.0.2",execa:"^9.6.0","fast-glob":"^3.3.3","fs-extra":"^11.3.1",fuzzysort:"^3.1.0",kleur:"^4.1.5",open:"^11.0.0",ora:"^8.2.0",postcss:"^8.5.6","postcss-selector-parser":"^7.1.0",prompts:"^2.4.2",recast:"^0.23.11","stringify-object":"^5.0.0","tailwind-merge":"^3.0.1","ts-morph":"^26.0.0","tsconfig-paths":"^4.2.0",undici:"^7.27.2","validate-npm-package-name":"^7.0.1",zod:"^3.24.1","zod-to-json-schema":"^3.24.6"},devDependencies:{"@antfu/ni":"^25.0.0","@types/babel__core":"^7.20.5","@types/fs-extra":"^11.0.4","@types/prompts":"^2.4.9","@types/stringify-object":"^4.0.5",msw:"^2.10.4",rimraf:"^6.0.1",tsup:"^8.5.0","type-fest":"^4.41.0",typescript:"^5.9.2"}};function ur(e){if(I.break(),I.error("Something went wrong. Please check the error below for more details."),I.error("If the problem persists, please open an issue on GitHub."),I.error(""),typeof e=="string"&&(I.error(e),vt()),e instanceof _&&(e.message&&(I.error(e.cause?"Error:":"Message:"),I.error(e.message)),e.cause&&(I.error(`
95
+ Message:`),I.error(e.cause)),e.suggestion&&(I.error(`
96
+ Suggestion:`),I.error(e.suggestion)),vt()),e instanceof z$1.ZodError){I.error("Validation failed:");for(let[t,r]of Object.entries(e.flatten().fieldErrors))I.error(`- ${$.info(t)}: ${r}`);vt();}e instanceof Error&&(I.error(e.message),vt()),vt();}function ap(e){let t=e.match(/^(\d+)\.(\d+)\.\d+/);if(!t)return null;let r=Number.parseInt(t[1],10),s=Number.parseInt(t[2],10);return s===0?null:`${r}.${s-1}.0`}function cp(e=Ho.version,t=process.argv.slice(2)){let r=ap(e);return r?[...Ls(Ds()).split(" "),`shadcn@${r}`,...t].map(lp).join(" "):null}function vt(){let e=cp();e&&(I.error(""),I.error("You can also try a previous version to see if that works:"),I.error(e)),I.break(),process.exit(1);}function lp(e){return /^[a-zA-Z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}var Go=cosmiconfig("registries",{packageProp:"registries",searchPlaces:["package.json"]}),fp=z$1.object({registries:b.optional()});async function Ws(e,t){return xe(()=>pp(e,t))}async function pp(e,t){let{config:r,useCache:s}=t||{};if(M(e)){let[a]=await z([e],{useCache:s});return Bo(e,a)}let n=pt(e);if(n)return Ti(n,{useCache:s});if(!e.startsWith("@"))throw new it(e);let i=e;i.endsWith("/registry")||(i=`${i}/registry`);let o=Ke(i,se(r));if(!o?.url)throw new Te(i);o.headers&&Object.keys(o.headers).length>0&&dt({[o.url]:o.headers});let[c]=await z([o.url],{useCache:s});return Bo(i,c)}function Bo(e,t){try{let r=p.parse(t);if(r.include?.length)throw new C(`Registry catalog "${e}" uses "include", but consumer registry endpoints must serve a resolved registry catalog. Run "npx shadcn build" and serve the built registry.json, or use loadRegistry() in a dynamic route.`,{context:{registry:e,include:r.include},suggestion:"Serve a flattened registry.json for CLI consumers. Source registry.json files with include are supported by shadcn build and loadRegistry()."});return r}catch(r){throw r instanceof C?r:new V(e,r,{subject:"registry catalog",suggestion:"The registry catalog may be corrupted or have an invalid format. Please make sure it returns a valid registry.json object. See https://ui.shadcn.com/schema/registry.json."})}}async function zs(e,t){let{config:r,useCache:s=false}=t||{};return xe(()=>ve(e,se(r),{useCache:s}))}async function dp(e,t){let{config:r,useCache:s=false}=t||{};return xe(()=>Je(e,se(r),{useCache:s}))}async function hp(e,t){let{useCache:r=true}=t||{};r||(Mt.clearCaches(),Go.clearCaches());let s=S__default.resolve(e,"components.json");if(existsSync(s)){let i=await Mt.load(s),o=qo(e,i?.config,"components.json");return {registries:{...H,...o.registries}}}let n=S__default.resolve(e,"package.json");if(existsSync(n)){let i=await Go.load(n);return qo(e,{registries:i?.config},"package.json")}return {registries:{}}}function qo(e,t,r){let s=fp.safeParse(t);if(!s.success)throw new Ve(e,s.error,r);return {registries:s.data.registries||{}}}async function Vt(){let[e]=await z(["index.json"]);return q$1.parse(e)}async function jv(){try{let[e]=await z(["styles/index.json"]);return r.parse(e)}catch(e){return I.error(`
97
+ `),ur(e),[]}}async function Ov(){try{let[e]=await z(["icons/index.json"]);return s.parse(e)}catch(e){return ur(e),{}}}async function Nv(){return xn}async function tr(e){let[t$1]=await z([`colors/${e}.json`]);return t.parse(t$1)}async function mp(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 mp(e,n.registryDependencies);r.push(...i);}}return r.filter((s,n,i)=>i.findIndex(o=>o.name===s.name)===n)}async function _v(e,t){try{let r=t.map(n=>`styles/${e}/${n.name}.json`);return (await z(r)).map(n$1=>n.parse(n$1))}catch(r){return ur(r),[]}}async function Fv(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?S__default.join(e.resolvedPaths[s],n):null}async function Yo(e){e={useCache:true,...e};let t=`${Pe}/registries.json`,[r]=await z([t],{useCache:e.useCache});try{return z$2.parse(r)}catch(s){throw s instanceof z$1.ZodError?new ot(s):s}}async function gp(e){let t=await Yo(e);return t?Object.fromEntries(t.map(r=>[r.name,r.url])):null}async function yp(e){e={useCache:true,...e};let t=`${Pe}/config.json`,[r]=await z([t],{useCache:e.useCache});return B.parse(r).presets}async function Mv(e,t){return (await yp(t)).find(s=>s.name.toLowerCase()===e.toLowerCase())??null}var Zo={"--font-heading":"cn-font-heading"};function wp(e){return e.startsWith("--")?e:`--${e}`}function Us(e){let t=new Set;for(let r of e){for(let s of r.fonts??[]){let n=s.font?.variable;if(!n)continue;let i=Zo[n];i&&t.add(i);}for(let s of Object.values(r.cssVars??{}))for(let n of Object.keys(s??{})){let i=Zo[wp(n)];i&&t.add(i);}}return Array.from(t)}function Xo(e,t){if(e.includes("\0"))return false;let r;try{r=e;let d="";for(;r!==d&&r.includes("%");)d=r,r=decodeURIComponent(r);}catch{return false}let s=S__default.normalize(r.replace(/\\/g,"/")),n=S__default.normalize(t),i=d=>d.replace(/\[\.\.\..*?\]/g,"").includes("..");if(i(s)||i(r)||i(e))return false;let o=d=>d.replace(/\[\.\.\..*?\]/g,""),c=o(e),a=o(r);if([/\.\.[\/\\]/,/[\/\\]\.\./,/\.\./,/\.\.%/,/\x00/,/[\x01-\x1f]/].some(d=>d.test(c)||d.test(a))||(e.includes("~")||r.includes("~"))&&(e.includes("../")||r.includes("../")))return false;if(/^[a-zA-Z]:[\/\\]/.test(r))return process.platform==="win32"?r.toLowerCase().startsWith(t.toLowerCase()):false;if(S__default.isAbsolute(s))return s.startsWith(n+S__default.sep);let u=S__default.resolve(n,s);return u.startsWith(n+S__default.sep)||u===n}async function Jv(e,t,r){if(!t.resolvedPaths.tailwindCss||!Object.keys(e??{}).length)return;r={cleanupDefaultNextStyles:false,silent:false,tailwindVersion:"v3",overwriteCssVars:false,...r};let s=t.resolvedPaths.tailwindCss,n=S__default.relative(t.resolvedPaths.cwd,s),i=j(`Updating CSS variables in ${$.info(n)}`,{silent:r.silent}).start(),o=await promises.readFile(s,"utf8"),c=await Hs(o,e??{},t,{cleanupDefaultNextStyles:r.cleanupDefaultNextStyles,tailwindVersion:r.tailwindVersion,tailwindConfig:r.tailwindConfig,overwriteCssVars:r.overwriteCssVars});await promises.writeFile(s,c,"utf8"),i.succeed();}async function Hs(e,t,r,s={cleanupDefaultNextStyles:false,tailwindVersion:"v3",tailwindConfig:void 0,overwriteCssVars:false}){s={cleanupDefaultNextStyles:false,tailwindVersion:"v3",tailwindConfig:void 0,overwriteCssVars:false,...s};let n=[bp(t)];s.cleanupDefaultNextStyles&&n.push(ta()),s.tailwindVersion==="v4"&&(n=[],n.push(Ep({params:"dark (&:is(.dark *))"})),s.cleanupDefaultNextStyles&&n.push(ta()),n.push(Sp(t,{overwriteCssVars:s.overwriteCssVars})),n.push(Ip(t)),s.tailwindConfig&&(n.push(Cp(s.tailwindConfig)),n.push($p(s.tailwindConfig)),n.push(kp(s.tailwindConfig))));let o=(await A(n).process(e,{from:void 0})).css;return o=o.replace(/\/\* ---break--- \*\//g,""),s.tailwindVersion==="v4"&&(o=o.replace(/(\n\s*\n)+/g,`
98
+
99
+ `)),o}function bp(e){return {postcssPlugin:"update-css-vars",Once(t){let r=t.nodes.find(s=>s.type==="atrule"&&s.name==="layer"&&s.params==="base");r instanceof vp||(r=A.atRule({name:"layer",params:"base",nodes:[],raws:{semicolon:true,before:`
100
+ `,between:" "}}),t.append(r),t.insertBefore(r,A.comment({text:"---break---"}))),r!==void 0&&Object.entries(e).forEach(([s,n])=>{let i=s==="light"?":root":`.${s}`;Rp(r,i,n);});}}}function ea(e){let t=e.nodes.find(r=>r.type==="rule"&&r.selector===":root");if(t){let r=["--background","--foreground"];t.nodes.filter(s=>s.type==="decl"&&r.includes(s.prop)).forEach(s=>s.remove()),t.nodes.length===0&&t.remove();}}function ta(){return {postcssPlugin:"cleanup-default-next-styles",Once(e){let t=e.nodes.find(s=>s.type==="rule"&&s.selector==="body");t&&(t.nodes.find(s=>s.type==="decl"&&s.prop==="color"&&["rgb(var(--foreground-rgb))","var(--foreground)"].includes(s.value))?.remove(),t.nodes.find(s=>s.type==="decl"&&s.prop==="background"&&(s.value.startsWith("linear-gradient")||s.value==="var(--background)"))?.remove(),t.nodes.find(s=>s.type==="decl"&&s.prop==="font-family"&&s.value==="Arial, Helvetica, sans-serif")?.remove(),t.nodes.length===0&&t.remove()),ea(e);let r=e.nodes.find(s=>s.type==="atrule"&&s.params==="(prefers-color-scheme: dark)");r&&(ea(r),r.nodes.length===0&&r.remove());}}}function Rp(e,t,r){let s=e.nodes?.find(n=>n.type==="rule"&&n.selector===t);s||Object.keys(r).length>0&&(s=A.rule({selector:t,raws:{between:" ",before:`
101
+ `}}),e.append(s)),Object.entries(r).forEach(([n,i])=>{let o=`--${n.replace(/^--/,"")}`,c=A.decl({prop:o,value:i,raws:{semicolon:true}}),a=s?.nodes.find(f=>f.type==="decl"&&f.prop===o);a?a.replaceWith(c):s?.append(c);});}function Sp(e,t){return {postcssPlugin:"update-css-vars-v4",Once(r){Object.entries(e).forEach(([s,n])=>{let i=s==="light"?":root":`.${s}`;if(s==="theme"){i="@theme";let c=fr(r);Object.entries(n).forEach(([a,f])=>{let l=`--${a.replace(/^--/,"")}`,u=A.decl({prop:l,value:f,raws:{semicolon:true}}),d=c?.nodes?.find(p=>p.type==="decl"&&p.prop===l);t.overwriteCssVars?d?d.replaceWith(u):c?.append(u):d||c?.append(u);});return}let o=r.nodes?.find(c=>c.type==="rule"&&c.selector===i);!o&&Object.keys(n).length>0&&(o=A.rule({selector:i,nodes:[],raws:{semicolon:true,between:" ",before:`
102
+ `}}),r.append(o),r.insertBefore(o,A.comment({text:"---break---"}))),Object.entries(n).forEach(([c,a])=>{let f=`--${c.replace(/^--/,"")}`;f==="--sidebar-background"&&(f="--sidebar"),ra(a)&&(a=`hsl(${a})`);let l=A.decl({prop:f,value:a,raws:{semicolon:true}}),u=o?.nodes.find(d=>d.type==="decl"&&d.prop===f);t.overwriteCssVars?u?u.replaceWith(l):o?.append(l):u||o?.append(l);});});}}}function Ip(e){return {postcssPlugin:"update-theme",Once(t){let r=Array.from(new Set(Object.keys(e).flatMap(i=>Object.keys(e[i]||{}))));if(!r.length)return;let s=fr(t),n=s.nodes?.filter(i=>i.type==="decl"&&i.prop.startsWith("--"));for(let i of r){let o=Object.values(e).find(u=>u[i])?.[i];if(!o)continue;if(i==="radius"){let u={sm:"calc(var(--radius) * 0.6)",md:"calc(var(--radius) * 0.8)",lg:"var(--radius)",xl:"calc(var(--radius) * 1.4)","2xl":"calc(var(--radius) * 1.8)","3xl":"calc(var(--radius) * 2.2)","4xl":"calc(var(--radius) * 2.6)"};for(let[d,p]of Object.entries(u)){let h=A.decl({prop:`--radius-${d}`,value:p,raws:{semicolon:true}});s?.nodes?.find(m=>m.type==="decl"&&m.prop===h.prop)||s?.append(h);}continue}let c=ra(o)||Tp(o)?`--color-${i.replace(/^--/,"")}`:`--${i.replace(/^--/,"")}`;c==="--color-sidebar-background"&&(c="--color-sidebar");let a=`var(--${i})`;c==="--color-sidebar"&&(a="var(--sidebar)");let f=A.decl({prop:c,value:a,raws:{semicolon:true}});s?.nodes?.find(u=>u.type==="decl"&&u.prop===f.prop)||(n?.length?s?.insertAfter(n[n.length-1],f):s?.append(f));}}}}function fr(e){let t=e.nodes.find(r=>r.type==="atrule"&&r.name==="theme"&&r.params==="inline");return t||(t=A.atRule({name:"theme",params:"inline",nodes:[],raws:{semicolon:true,between:" ",before:`
103
+ `}}),e.append(t),e.insertBefore(t,A.comment({text:"---break---"}))),t}function Ep({params:e}){return {postcssPlugin:"add-custom-variant",Once(t){if(!t.nodes.find(s=>s.type==="atrule"&&s.name==="custom-variant")){let s=t.nodes.filter(i=>i.type==="atrule"&&i.name==="import"),n=A.atRule({name:"custom-variant",params:e,raws:{semicolon:true,before:`
104
+ `}});if(s.length>0){let i=s[s.length-1];t.insertAfter(i,n);}else t.insertAfter(t.nodes[0],n);t.insertBefore(n,A.comment({text:"---break---"}));}}}}function Cp(e){return {postcssPlugin:"update-tailwind-config",Once(t){if(!e?.plugins)return;let s=Pp(t)==="single"?"'":'"',n=t.nodes.filter(o=>o.type==="atrule"&&o.name==="plugin"),i=n[n.length-1]||t.nodes[0];for(let o of e.plugins){let c=o.replace(/^require\(["']|["']\)$/g,"");if(n.some(f=>f.params.replace(/["']/g,"")===c))continue;let a=A.atRule({name:"plugin",params:`${s}${c}${s}`,raws:{semicolon:true,before:`
105
+ `}});t.insertAfter(i,a),t.insertBefore(a,A.comment({text:"---break---"}));}}}}function kp(e){return {postcssPlugin:"update-tailwind-config-keyframes",Once(t){if(!e?.theme?.extend?.keyframes)return;let r=fr(t),s=r.nodes?.filter(i=>i.type==="atrule"&&i.name==="keyframes"),n=z$1.record(z$1.string(),z$1.record(z$1.string(),z$1.string()));for(let[i,o]of Object.entries(e.theme.extend.keyframes)){if(typeof i!="string")continue;let c=n.safeParse(o);if(!c.success||s?.find(f=>f.type==="atrule"&&f.name==="keyframes"&&f.params===i))continue;let a=A.atRule({name:"keyframes",params:i,nodes:[],raws:{semicolon:true,between:" ",before:`
106
+ `}});for(let[f,l]of Object.entries(c.data)){let u=A.rule({selector:f,nodes:Object.entries(l).map(([d,p])=>A.decl({prop:d,value:p,raws:{semicolon:true,before:`
107
+ `,between:": "}})),raws:{semicolon:true,between:" ",before:`
108
+ `}});a.append(u);}r.append(a),r.insertBefore(a,A.comment({text:"---break---"}));}}}}function $p(e){return {postcssPlugin:"update-tailwind-config-animation",Once(t){if(!e?.theme?.extend?.animation)return;let r=fr(t),s=r.nodes?.filter(i=>i.type==="decl"&&i.prop.startsWith("--animate-")),n=z$1.record(z$1.string(),z$1.string()).safeParse(e.theme.extend.animation);if(n.success)for(let[i,o]of Object.entries(n.data)){let c=`--animate-${i}`;if(s?.find(f=>f.prop===c))continue;let a=A.decl({prop:c,value:o,raws:{semicolon:true,between:": ",before:`
109
+ `}});r.append(a);}}}}function Pp(e){return e.nodes[0].toString().includes("'")?"single":"double"}function ra(e){if(e.startsWith("hsl")||e.startsWith("rgb")||e.startsWith("#")||e.startsWith("oklch"))return false;let t=e.split(" ");return t.length===3&&t.slice(1,3).every(r=>r.includes("%"))}function Tp(e){return e.startsWith("hsl")||e.startsWith("rgb")||e.startsWith("#")||e.startsWith("oklch")||e.includes("--color-")}async function Ks(e,t,r){let s=e&&Object.keys(e).length>0,n=Object.keys(r.cssVars??{}).length>0;if(!t.resolvedPaths.tailwindCss||!s&&!n)return;r={silent:false,...r};let i=t.resolvedPaths.tailwindCss,o=S__default.relative(t.resolvedPaths.cwd,i),c=j(`Updating ${$.info(o)}`,{silent:r.silent}).start(),a=await promises.readFile(i,"utf8");n&&(a=await Hs(a,r.cssVars,t,{cleanupDefaultNextStyles:r.cleanupDefaultNextStyles,tailwindVersion:r.tailwindVersion,tailwindConfig:r.tailwindConfig,overwriteCssVars:r.overwriteCssVars})),s&&(a=await Op(a,e)),await promises.writeFile(i,a,"utf8"),c.succeed();}async function Op(e,t){let r=[Np(t)],s=await A(r).process(e,{from:void 0}),n=s.css,i=s.root;if(i.nodes&&i.nodes.length>0){let o=i.nodes[i.nodes.length-1];o.type==="atrule"&&!o.nodes&&!n.trimEnd().endsWith(";")&&(n=n.trimEnd()+";");}return n=n.replace(/\/\* ---break--- \*\//g,""),n=n.replace(/(\n\s*\n)+/g,`
110
+
111
+ `),n=n.trimEnd(),n}function Np(e){return {postcssPlugin:"update-css",Once(t){for(let[r,s]of Object.entries(e))if(r.startsWith("@")){let n=r.match(/@([a-zA-Z-]+)\s*(.*)/);if(!n)continue;let[,i,o]=n;if(i==="import"){if(!t.nodes?.find(a=>a.type==="atrule"&&a.name==="import"&&a.params===o)){let a=A.atRule({name:"import",params:o,raws:{semicolon:true}}),f=t.nodes?.filter(l=>l.type==="atrule"&&l.name==="import");if(f&&f.length>0){let l=f[f.length-1];a.raws.before=`
112
+ `,t.insertAfter(l,a);}else !t.nodes||t.nodes.length,a.raws.before="",t.prepend(a);}}else if(i==="plugin"){let c=o;o&&!o.startsWith('"')&&!o.startsWith("'")&&(c=`"${o}"`);let a=l=>l.startsWith('"')&&l.endsWith('"')||l.startsWith("'")&&l.endsWith("'")?l.slice(1,-1):l;if(!t.nodes?.find(l=>l.type!=="atrule"||l.name!=="plugin"?false:a(l.params)===a(o))){let l=A.atRule({name:"plugin",params:c,raws:{semicolon:true,before:`
113
+ `}}),u=t.nodes?.filter(p=>p.type==="atrule"&&p.name==="import"),d=t.nodes?.filter(p=>p.type==="atrule"&&p.name==="plugin");if(d&&d.length>0){let p=d[d.length-1];t.insertAfter(p,l);}else if(u&&u.length>0){let p=u[u.length-1];t.insertAfter(p,l),t.insertBefore(l,A.comment({text:"---break---"})),t.insertAfter(l,A.comment({text:"---break---"}));}else t.prepend(l),t.insertBefore(l,A.comment({text:"---break---"})),t.insertAfter(l,A.comment({text:"---break---"}));}}else if(typeof s=="object"&&Object.keys(s).length===0){if(!t.nodes?.find(a=>a.type==="atrule"&&a.name===i&&a.params===o)){let a=A.atRule({name:i,params:o,raws:{semicolon:true}});t.append(a),t.insertBefore(a,A.comment({text:"---break---"}));}}else if(i==="keyframes"){let c=t.nodes?.find(l=>l.type==="atrule"&&l.name==="theme"&&l.params==="inline");c||(c=A.atRule({name:"theme",params:"inline",raws:{semicolon:true,between:" ",before:`
114
+ `}}),t.append(c),t.insertBefore(c,A.comment({text:"---break---"})));let a=c.nodes?.find(l=>l.type==="atrule"&&l.name==="keyframes"&&l.params===o),f;if(a?(f=A.atRule({name:"keyframes",params:o,raws:{semicolon:true,between:" ",before:`
115
+ `}}),a.replaceWith(f)):(f=A.atRule({name:"keyframes",params:o,raws:{semicolon:true,between:" ",before:`
116
+ `}}),c.append(f)),typeof s=="object")for(let[l,u]of Object.entries(s))Me(f,l,u);}else if(i==="utility"){let c=t.nodes?.find(a=>a.type==="atrule"&&a.name===i&&a.params===o);if(c){if(typeof s=="object")for(let[a,f]of Object.entries(s))if(typeof f=="string"){let l=c.nodes?.find(d=>d.type==="decl"&&d.prop===a),u=A.decl({prop:a,value:f,raws:{semicolon:true,before:`
117
+ `}});l?l.replaceWith(u):c.append(u);}else if(a.startsWith("@")&&typeof f=="object"&&f!==null&&Object.keys(f).length===0){let l=a.match(/@([a-zA-Z-]+)\s*(.*)/);if(l){let[,u,d]=l;if(!c.nodes?.find(h=>h.type==="atrule"&&h.name===u&&h.params===d)){let h=A.atRule({name:u,params:d,raws:{semicolon:true,before:`
118
+ `}});c.append(h);}}}else typeof f=="object"&&Me(c,a,f);}else {let a=A.atRule({name:i,params:o,raws:{semicolon:true,between:" ",before:`
119
+ `}});if(t.append(a),t.insertBefore(a,A.comment({text:"---break---"})),typeof s=="object")for(let[f,l]of Object.entries(s))if(typeof l=="string"){let u=A.decl({prop:f,value:l,raws:{semicolon:true,before:`
120
+ `}});a.append(u);}else if(f.startsWith("@")&&typeof l=="object"&&l!==null&&Object.keys(l).length===0){let u=f.match(/@([a-zA-Z-]+)\s*(.*)/);if(u){let[,d,p]=u;if(!a.nodes?.find(m=>m.type==="atrule"&&m.name===d&&m.params===p)){let m=A.atRule({name:d,params:p,raws:{semicolon:true,before:`
121
+ `}});a.append(m);}}}else typeof l=="object"&&Me(a,f,l);}}else i==="property"?Me(t,r,s):na(t,i,o,s);}else Me(t,r,s);}}}function na(e,t,r,s){let n=e.nodes?.find(i=>i.type==="atrule"&&i.name===t&&i.params===r);if(n||(n=A.atRule({name:t,params:r,raws:{semicolon:true,between:" ",before:`
122
+ `}}),e.append(n),e.insertBefore(n,A.comment({text:"---break---"}))),typeof s=="object")for(let[i,o]of Object.entries(s))if(i.startsWith("@")){let c=i.match(/@([a-zA-Z-]+)\s*(.*)/);if(c){let[,a,f]=c;na(n,a,f,o);}}else Me(n,i,o);else if(typeof s=="string")try{let o=A.parse(`.temp{${s}}`).first;if(o&&o.nodes){let c=A.rule({selector:"temp",raws:{semicolon:!0,between:" ",before:`
123
+ `}});o.nodes.forEach(a=>{if(a.type==="decl"){let f=a.clone();f.raws.before=`
124
+ `,c.append(f);}}),c.nodes?.length&&n.append(c);}}catch(i){throw console.error("Error parsing at-rule content:",s,i),i}}function Me(e,t,r){let s=e.nodes?.find(n=>n.type==="rule"&&n.selector===t);if(s||(s=A.rule({selector:t,raws:{semicolon:true,between:" ",before:`
125
+ `}}),e.append(s)),typeof r=="object"){for(let[n,i]of Object.entries(r))if(n.startsWith("@")&&typeof i=="object"&&i!==null&&Object.keys(i).length===0){let o=n.match(/@([a-zA-Z-]+)\s*(.*)/);if(o){let[,c,a]=o;if(!s.nodes?.find(l=>l.type==="atrule"&&l.name===c&&l.params===a)){if(c==="apply"){let u=s.nodes?.find(d=>d.type==="atrule"&&d.name==="apply");if(u){u.params=twMerge(u.params,a);continue}}let l=A.atRule({name:c,params:a,raws:{semicolon:true,before:`
126
+ `}});s.append(l);}}}else if(typeof i=="string"){let o=A.decl({prop:n,value:i,raws:{semicolon:true,before:`
127
+ `}}),c=s.nodes?.find(a=>a.type==="decl"&&a.prop===n);c?c.replaceWith(o):s.append(o);}else if(typeof i=="object"){let o=n.startsWith("&")?t.replace(/^([^:]+)/,`$1${n.substring(1)}`):n;Me(e,o,i);}}else if(typeof r=="string")try{let i=A.parse(`.temp{${r}}`).first;i&&i.nodes&&i.nodes.forEach(o=>{if(o.type==="decl"){let c=o.clone();c.raws.before=`
128
+ `,s?.append(c);}});}catch(n){throw console.error("Error parsing rule content:",t,r,n),n}}async function Gs(e,t,r,s){let n=J(r.resolvedPaths.cwd,false),i=await Dp(r),o=i!=="expo";if(e=ia(e,n,{skipInstalled:o}),t=ia(t,n,{skipInstalled:o}),!e?.length&&!t?.length)return;s={silent:false,interactive:true,...s};let c=j("Installing dependencies.",{silent:s.silent})?.start(),a="";if(Mp(r)&&i==="npm")if(s.silent||!s.interactive)a="force";else {c.stopAndPersist(),I.warn(`
129
+ It looks like you are using React 19.
130
+ Some packages may fail to install due to peer dependency issues in npm (see ${L}/react-19).
131
+ `);let f=await Vc([{type:"select",name:"flag",message:"How would you like to proceed?",choices:[{title:"Use --force",value:"force"},{title:"Use --legacy-peer-deps",value:"legacy-peer-deps"}]}]);f&&(a=f.flag);}c?.start(),await Lp(i,e,t,r.resolvedPaths.cwd,a),c?.succeed();}function ia(e=[],t,{skipInstalled:r=true}={}){let s=new Set([...Object.keys(t?.dependencies??{}),...Object.keys(t?.devDependencies??{}),...Object.keys(t?.optionalDependencies??{}),...Object.keys(t?.peerDependencies??{})]),n=new Map;for(let i of e){let o=Fp(i);if(!o){n.set(i,{dependency:i,hasSpecifier:true});continue}if(r&&!o.hasSpecifier&&s.has(o.name))continue;let c=n.get(o.name);(!c||!c.hasSpecifier&&o.hasSpecifier)&&n.set(o.name,{dependency:i,hasSpecifier:o.hasSpecifier});}return Array.from(n.values()).map(({dependency:i})=>i)}function Fp(e){if(/^[a-z][a-z0-9+.-]*:/i.test(e))return null;let t=e.startsWith("@")?e.match(/^(@[^/]+\/[^@/]+)(@.+)?$/):e.match(/^([^@/]+)(@.+)?$/);return t?{name:t[1],hasSpecifier:!!t[2]}:null}function Mp(e){let t=J(e.resolvedPaths.cwd,false);if(!t?.dependencies?.react)return false;let r=/^(?:\^|~)?19(?:\.\d+)*(?:-.*)?$/.test(t.dependencies.react),s=t.dependencies["react-day-picker"]?.startsWith("8");return r&&s}async function Dp(e){return J(e.resolvedPaths.cwd,false)?.dependencies?.expo?"expo":Ms(e.resolvedPaths.cwd)}function Xe(e){for(let t of e)if(t.trim().startsWith("-"))throw new Error(`Invalid dependency "${t}": dependency names cannot start with "-".`)}async function Lp(e,t,r,s,n){if(e==="npm")return Vp(t,r,s,n);if(e==="deno")return Wp(t,r,s);if(e==="expo")return zp(t,r,s);Xe(t),Xe(r),t?.length&&await execa(e,["add","--",...t],{cwd:s}),r?.length&&await execa(e,["add","-D","--",...r],{cwd:s});}async function Vp(e,t,r,s){Xe(e),Xe(t),e.length&&await execa("npm",["install",...s?[`--${s}`]:[],"--",...e],{cwd:r}),t.length&&await execa("npm",["install",...s?[`--${s}`]:[],"-D","--",...t],{cwd:r});}async function Wp(e,t,r){e?.length&&await execa("deno",["add",...e.map(s=>`npm:${s}`)],{cwd:r}),t?.length&&await execa("deno",["add","-D",...t.map(s=>`npm:${s}`)],{cwd:r});}async function zp(e,t,r){Xe(e),Xe(t),e.length&&await execa("npx",["expo","install","--",...e],{cwd:r}),t.length&&await execa("npx",["expo","install","-- -D","--",...t],{cwd:r});}async function qs(e,t,r){if(!e||Object.keys(e).length===0)return {envVarsAdded:[],envFileUpdated:null,envFileCreated:null};r={silent:false,...r};let s=j("Adding environment variables.",{silent:r.silent})?.start(),n=t.resolvedPaths.cwd,i=S__default.join(n,".env.local"),o=Ut(n);o&&(i=o);let c=existsSync(i),a=S__default.basename(i),f=Object.entries(e).map(([p,h])=>`${p}=${h}`).join(`
132
+ `),l=[],u=null,d=null;if(c){let p=await promises.readFile(i,"utf-8"),h=Kt(p,f);if(l=Ht(p,f),l.length>0){if(await promises.writeFile(i,h,"utf-8"),u=S__default.relative(n,i),s?.succeed(`Added the following variables to ${$.info(a)}:`),!r.silent)for(let m of l)I.log(` ${$.success("+")} ${m}`);}else s?.stop();}else if(await promises.writeFile(i,f+`
133
+ `,"utf-8"),d=S__default.relative(n,i),l=Object.keys(e),s?.succeed(`Added the following variables to ${$.info(a)}:`),!r.silent)for(let p of l)I.log(` ${$.success("+")} ${p}`);return !r.silent&&l.length>0&&I.break(),{envVarsAdded:l,envFileUpdated:u,envFileCreated:d}}var Jp=new Set(["--font-sans","--font-serif","--font-mono"]);async function Js(e,t){if(!e.fonts?.length)return e;let r=await Y(t.resolvedPaths.cwd);if(!r)return e;e.cssVars??={},e.cssVars.theme??={};let s=r.framework.name==="next-app"||r.framework.name==="next-pages";for(let n of e.fonts)if(s)e.cssVars.theme[n.font.variable]=`var(${n.font.variable})`;else {let i=n.name.replace("font-",""),o=n.font.dependency??`@fontsource-variable/${i}`;e.dependencies??=[],e.dependencies.push(o),e.css??={},e.css[`@import "${o}"`]={},e.cssVars.theme[n.font.variable]=n.font.family;}if(e.fonts.length>0){let n=new Map;for(let i of e.fonts){let o=i.font.selector??ed(i.font.variable);if(!o)continue;let c=i.font.variable.replace("--","");n.has(o)||n.set(o,[]),n.get(o).push(c);}e.css??={},e.css["@layer base"]??={};for(let[i,o]of Array.from(n.entries())){let c=o.join(" ");e.css["@layer base"][i]??={};let a=Object.keys(e.css["@layer base"][i]).find(f=>f.startsWith("@apply "));a?(delete e.css["@layer base"][i][a],e.css["@layer base"][i][`${a} ${c}`]={}):e.css["@layer base"][i][`@apply ${c}`]={};}}return e}async function Ys(e,t,r){if(!e?.length)return;let s=await Y(t.resolvedPaths.cwd);if(!s||s.framework.name!=="next-app"&&s.framework.name!=="next-pages")return;let n=j("Updating fonts.",{silent:r.silent})?.start();try{await Yp(e,t,s),n?.succeed("Updating fonts.");}catch(i){throw n?.fail("Failed to update fonts."),i}}async function Yp(e,t,r){let s=await Zp(t,r);if(!s)return;let n=await promises.readFile(s,"utf-8"),i=await Xp(n,e,t);i!==n&&await promises.writeFile(s,i,"utf-8");}async function Zp(e,t){let r=e.resolvedPaths.cwd,s=t.isSrcDir,i=t.isTsx?"tsx":"jsx",o=s?[`src/app/layout.${i}`,`app/layout.${i}`]:[`app/layout.${i}`];for(let c of o){let a=S__default.join(r,c);if(existsSync(a))return a}return null}async function Xp(e,t,r){let n=new Project({compilerOptions:{}}).createSourceFile("layout.tsx",e,{scriptKind:ScriptKind.TSX}),i=t.filter(u=>u.font.provider==="google"),o=[],c=[];for(let u of i){let d=u.font.import;if(!d)continue;let p=n.getImportDeclaration(w=>w.getModuleSpecifierValue()==="next/font/google"),h=false;p?(h=p.getNamedImports().some(v=>v.getName()===d),h||p.addNamedImport(d)):n.addImportDeclaration({moduleSpecifier:"next/font/google",namedImports:[d]});let m=rd(d,u.font.variable),g=Qp(u),x=id(n,u.font.variable),y=m;if(!(h&&!x&&dr(u.font.variable)&&!od(n,d))){if(x)x.setInitializer(`${d}(${g})`),x.getName()!==m&&x.rename(m),y=m;else {let w=ad(n);n.insertVariableStatement(w,{declarationKind:VariableDeclarationKind.Const,declarations:[{name:m,initializer:`${d}(${g})`}]}).appendWhitespace(`
134
+ `);}o.push(y),td(u)&&c.push(u.font.variable.replace("--",""));}}let a=new Set(["font-sans","font-serif","font-mono"]),f=[...c].reverse().find(u=>a.has(u)),l=c.filter(u=>!a.has(u));return f&&l.unshift(f),o.length>0&&cd(n,o,l,r),n.getFullText()}function Qp(e){let t={};return e.font.subsets?.length&&(t.subsets=e.font.subsets),e.font.weight?.length&&(t.weight=e.font.weight),t.variable=e.font.variable,JSON.stringify(t).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'")}function dr(e){return Jp.has(e)}function ed(e){return dr(e)?"html":null}function td(e){return !e.font.selector&&dr(e.font.variable)}function rd(e,t){let r=sd(e);return dr(t)?r:`${r}${nd(t.replace(/^--font-/,""))}`}function sd(e){return e.split("_").map((t,r)=>r===0?t.toLowerCase():t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join("")}function nd(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function id(e,t){let r=e.getVariableStatements();for(let s of r)for(let n of s.getDeclarations()){let i=n.getInitializer();if(!i||i.getKind()!==SyntaxKind.CallExpression)continue;let c=i.getArguments();if(c.length===0)continue;let a=c[0].getText();if(a.includes("variable:")&&a.includes(t))return n}return null}function od(e,t){let r=e.getVariableStatements();for(let s of r)for(let n of s.getDeclarations()){let i=n.getInitializer();if(!i||i.getKind()!==SyntaxKind.CallExpression)continue;let o=i;if(o.getExpression().getText()!==t)continue;let c=o.getArguments();if(!c.length)continue;let a=c[0].getText();if(a.includes("variable:")&&a.includes("--font-heading"))return true}return false}function ad(e){let t=e.getImportDeclarations();return t.length>0?t[t.length-1].getChildIndex()+1:0}function cd(e,t,r,s){let n=e.getDescendantsOfKind(SyntaxKind.JsxOpeningElement);for(let i of n){if(i.getTagNameNode().getText()!=="html")continue;let c=r.map(p=>`"${p}"`),a=t.map(p=>`${p}.variable`),f=[...c,...a],l=i.getAttribute("className");if(!l){bt(e,s),i.addAttribute({name:"className",initializer:`{cn(${f.join(", ")})}`});return}if(l.getKind()!==SyntaxKind.JsxAttribute)return;let u=l.asKindOrThrow(SyntaxKind.JsxAttribute),d=u.getInitializer();if(!d)return;if(d.getKind()===SyntaxKind.StringLiteral){let p=d.getText().slice(1,-1);bt(e,s),u.setInitializer(`{cn("${p}", ${f.join(", ")})}`);}else if(d.getKind()===SyntaxKind.JsxExpression){let p=d.asKindOrThrow(SyntaxKind.JsxExpression),h=p.getExpression();if(!h)return;let m=h.getText();if(m.startsWith("cn(")){let g=a.every(b=>m.includes(b)),x=r.every(b=>m.includes(`"${b}"`)),y=["font-sans","font-serif","font-mono"].filter(b=>!r.includes(b)).some(b=>m.includes(`"${b}"`));if(g&&x&&!y)continue;let w=ud(m,a);w=fd(w);let v=pd(w,f);p.replaceWithText(`{${v}}`);}else if(/^\w+\.variable$/.test(m)){if(a.includes(m)&&r.length===0)continue;bt(e,s);let x=(m.split(".")[0]??"").toLowerCase().includes("heading")||r.length===0;p.replaceWithText(x?`{cn(${m}, ${f.join(", ")})}`:`{cn(${f.join(", ")})}`);}else if(m.startsWith("`")&&m.endsWith("`")){let g=ld(m);bt(e,s);let x=new Set(f),y=new Set(["font-sans","font-serif","font-mono"].map(v=>`"${v}"`)),w=g.filter(v=>!x.has(v)&&!y.has(v));p.replaceWithText(`{cn(${[...w,...f].join(", ")})}`);}else bt(e,s),p.replaceWithText(`{cn(${m}, ${f.join(", ")})}`);}}}function bt(e,t){if(!e.getImportDeclaration(s=>s.getNamedImports().some(i=>i.getName()==="cn"))){let s=e.getImportDeclaration(n=>n.getModuleSpecifierValue().includes("/lib/utils"));s?s.getNamedImports().some(i=>i.getName()==="cn")||s.addNamedImport("cn"):e.addImportDeclaration({moduleSpecifier:t.aliases.utils,namedImports:["cn"]});}}function ld(e){let t=[],r=[],n=e.slice(1,-1).split(/(\$\{[^}]+\})/);for(let i of n)if(i)if(i.startsWith("${")&&i.endsWith("}")){let o=i.slice(2,-1).trim();o&&r.push(o);}else {let o=i.trim().split(/\s+/).filter(Boolean);for(let c of o)t.push(`"${c}"`);}return [...t,...r]}function ud(e,t){let r=e;for(let s of t)r=r.replace(new RegExp(`,?\\s*${s.replace(".","\\.")}`,"g"),"").replace(/cn\(\s*,/,"cn(");return r}function fd(e){let t=e;for(let r of ["font-sans","font-serif","font-mono"])t=t.replace(new RegExp(`,?\\s*"${r}"`,"g"),"").replace(/cn\(\s*,/,"cn(");return t}function pd(e,t){let r=t.join(", ");return e.replace(/\)$/,`, ${r})`)}async function aa(e,t,r){r={overwrite:false,silent:false,interactive:true,isNewProject:false,...r};let s=await kn(t);return s&&s.ui&&s.ui.resolvedPaths.cwd!==t.resolvedPaths.cwd?await md(e,t,s,{...r,isRemote:e?.length===1&&!!e[0].match(/\/chat\/b\//)}):await hd(e,t,{...r,skipFonts:r.skipFonts})}async function hd(e,t,r){if(!e.length)return;let s=await ca(e,t,r),n=await je(t);r.skipFonts||(s=await Js(s,t));let i=Us([s]);await Gs(s.dependencies,s.devDependencies,t,{silent:r.silent,interactive:r.interactive}),await Nr(s.tailwind?.config,t,{silent:r.silent,tailwindVersion:n}),await qs(s.envVars,t,{silent:r.silent}),r.skipFonts||await Ys(s.fonts,t,{silent:r.silent}),await Cr(s.files,t,{overwrite:r.overwrite,silent:r.silent,interactive:r.interactive,path:r.path,supportedFontMarkers:i});let o=await la(s,e,t,r.overwriteCssVars);await Ks(s.css,t,{silent:r.silent,cssVars:s.cssVars,cleanupDefaultNextStyles:r.isNewProject,overwriteCssVars:o,tailwindVersion:n,tailwindConfig:s.tailwind?.config}),s.docs&&I.info(s.docs);}async function md(e,t,r,s){if(!e.length)return;let n=await ca(e,t,s),i=[],o=[],c=[],a=j("Installing components.")?.start(),f=r.ui,l=await je(f),u=Lt(t.resolvedPaths.cwd,f.resolvedPaths.ui);n=await Js(n,t);let d=Us([n]);await Gs(n.dependencies,n.devDependencies,f,{silent:true,interactive:s.interactive}),n.tailwind?.config&&(await Nr(n.tailwind?.config,f,{silent:true,tailwindVersion:l}),o.push(S__default.relative(u,f.resolvedPaths.tailwindConfig))),n.envVars&&await qs(n.envVars,f,{silent:true}),await Ys(n.fonts,t,{silent:true});let p=new Map,h={"registry:ui":"ui","registry:hook":"hooks","registry:lib":"lib"},m=R=>Gt(R.target)??h[R.type||"registry:ui"]??"components",g=R=>R&&r[R]?r[R]:t;for(let R of n.files??[]){let T=m(R);p.has(T)||p.set(T,[]),p.get(T).push(R);}for(let R of Array.from(p.keys())){let T=p.get(R),k=g(R),P=(n.files??[]).filter($e=>g(m($e)).resolvedPaths.cwd===k.resolvedPaths.cwd),U=Lt(t.resolvedPaths.cwd,k.resolvedPaths.ui||k.resolvedPaths.cwd),et=await br(U,k.resolvedPaths.cwd)??k.resolvedPaths.cwd,hr=await Cr(T,k,{overwrite:s.overwrite,silent:true,interactive:s.interactive,rootSpinner:a,isRemote:s.isRemote,isWorkspace:true,path:s.path,plannedFiles:P,supportedFontMarkers:d});i.push(...hr.filesCreated.map($e=>S__default.relative(U,S__default.join(et,$e)))),o.push(...hr.filesUpdated.map($e=>S__default.relative(U,S__default.join(et,$e)))),c.push(...hr.filesSkipped.map($e=>S__default.relative(U,S__default.join(et,$e))));}let x=await la(n,e,t,s.overwriteCssVars);await Ks(n.css,f,{silent:true,cssVars:n.cssVars,overwriteCssVars:x,tailwindVersion:l,tailwindConfig:n.tailwind?.config}),(n.cssVars||n.css)&&o.push(S__default.relative(u,f.resolvedPaths.tailwindCss)),a?.succeed();let y=Array.from(new Set(i)).sort(),w=Array.from(new Set(o.filter(R=>!i.includes(R)))).sort(),v=Array.from(new Set(c)).sort();if(!(y.length||w.length)&&!v.length&&j("No files updated.",{silent:s.silent})?.info(),y.length){j(`Created ${y.length} ${y.length===1?"file":"files"}:`,{silent:s.silent})?.succeed();for(let R of y)I.log(` - ${R}`);}if(w.length){j(`Updated ${w.length} ${w.length===1?"file":"files"}:`,{silent:s.silent})?.info();for(let R of w)I.log(` - ${R}`);}if(v.length){j(`Skipped ${v.length} ${v.length===1?"file":"files"}: (use --overwrite to overwrite)`,{silent:s.silent})?.info();for(let R of v)I.log(` - ${R}`);}n.docs&&I.info(n.docs);}async function ca(e,t,r){let s=j("Checking registry.",{silent:r.silent})?.start(),n=r.resolvedTree??await Je(e,se(t));if(!n)throw s?.fail(),new Error("Failed to fetch components from registry.");try{yd(n.files??[],t.resolvedPaths.cwd);}catch(i){throw s?.fail(),i}return s?.succeed(),n}async function la(e,t,r,s){if(!(!e.cssVars||Object.keys(e.cssVars).length===0))return s??gd(t,r)}async function gd(e,t){let r=await zs(e,{config:t});return z$1.array(n).parse(r).some(n=>n.type==="registry:theme"||n.type==="registry:style"||n.type==="registry:font"||n.type==="registry:base")}function yd(e,t){for(let r of e){let s=r?.target??r?.path;if(s&&!Xo(s,t))throw new Error(`We found an unsafe file path "${s}" in the registry item. Installation aborted.`)}}async function ua(e=process.cwd(),t={}){let r=t.processEnv??process.env;try{let{config:s}=await import('@dotenvx/dotenvx'),n=[".env.local",".env.development.local",".env.development",".env"];for(let i of n){let o=join(e,i);existsSync(o)&&s({path:o,overload:!1,quiet:!0,processEnv:r});}}catch(s){I.warn("Failed to load env files:",s);}return r}async function vd(e,t={}){if(e.length===0)return;let{config:r,cwd:s,...n}=t,i=d$1.safeParse(r);if(!i.success&&r&&"resolvedPaths"in r){let l=typeof r.resolvedPaths?.cwd=="string"?r.resolvedPaths.cwd:void 0;throw new Ve(S__default.resolve(s??l??process.cwd()),i.error,"config")}let o=i.success?i.data.resolvedPaths.cwd:void 0,c=S__default.resolve(s??o??process.cwd());if(s!==void 0&&o!==void 0&&c!==S__default.resolve(o))throw new Error("The provided cwd must match config.resolvedPaths.cwd.");let a=se(i.success?i.data:{...r,resolvedPaths:{...r?.resolvedPaths,cwd:c}}),f=await ua(c,{processEnv:{...process.env}});return xe(async()=>{let l=await Je(e,a,{useCache:true,requireUniversal:!i.success});if(!l)throw new Error("Failed to fetch components from registry.");if(!i.success&&!bd(l,a))throw new Error("A full project config is required to resolve target aliases.");await aa(e,a,{...n,interactive:false,overwriteCssVars:t.overwriteCssVars??(i.success?void 0:false),resolvedTree:l});},{env:f})}function bd(e,t){return (e.files??[]).every(r=>{let s=Gt(r.target);return !s||!!t.resolvedPaths[s]})}function RR(e,t){return e.length>0?e:Object.keys(t?.registries??{}).filter(r=>!(r in H))}var Sd=8;async function Id(e,t,r){let s=new Array(e.length),n=0;async function i(){for(;n<e.length;){let c=n++;try{s[c]={status:"fulfilled",value:await r(e[c])};}catch(a){s[c]={status:"rejected",reason:a};}}}let o=Array.from({length:Math.min(t,e.length)},()=>i());return await Promise.all(o),s}async function Ed(e,t){return xe(()=>Cd(e,t))}async function Cd(e,t){let{query:r,types:s,limit:n,offset:i,config:o,useCache:c=false,continueOnError:a}=t||{},f=[],l=[],u=await Id(e,Sd,g=>Ws(g,{config:o,useCache:c}));for(let g=0;g<e.length;g++){let x=e[g],y=u[g];if(y.status==="rejected"){if(!a)throw y.reason;l.push({registry:x,message:y.reason instanceof Error?y.reason.message:String(y.reason)});continue}let w=(y.value.items||[]).map(v=>({name:v.name,type:v.type,description:v.description,registry:x,addCommandArgument:Td(v.name,x)}));f=f.concat(w);}if(s?.length){let g=new Set(s.map(x=>Qe(x).toLowerCase()));f=f.filter(x=>x.type&&g.has(Qe(x.type).toLowerCase()));}r&&(f=$d(f,{query:r,limit:f.length,keys:["name","description"]}));let d=i||0,p=n||f.length,h=f.length,m={pagination:{total:h,offset:d,limit:p,hasMore:d+p<h},items:f.slice(d,d+p),...l.length>0?{errors:l}:{}};return x.parse(m)}var kd=z$1.object({name:z$1.string(),type:z$1.string().optional(),description:z$1.string().optional(),registry:z$1.string().optional(),addCommandArgument:z$1.string().optional()}).passthrough();function $d(e,t){t={limit:100,threshold:-1e4,...t};let s=Rd.go(t.query,e,{keys:t.keys,threshold:t.threshold,limit:t.limit}).map(n=>n.obj);return z$1.array(kd).parse(s)}function Pd(e){try{return new URL(e),!0}catch{return false}}function Td(e,t){let r=pt(t);if(r){let p=`${r.owner}/${r.repo}/${e}`;return r.ref?`${p}#${r.ref}`:p}if(!Pd(t))return `${t}/${e}`;let s=t.indexOf("://")+3,n=t.indexOf("/",s);if(n===-1){let p=t.indexOf("?",s);if(p!==-1){let h=t.substring(0,p),g=t.substring(p).replace(/\bregistry\b/g,e);return h+g}return t}let i=t.substring(0,n),o=t.substring(n),c=o.indexOf("?")!==-1?o.indexOf("?"):o.length,a=o.substring(0,c),f=o.substring(c),l=a.lastIndexOf("registry"),u=a;l!==-1&&(u=a.substring(0,l)+e+a.substring(l+8));let d=f.replace(/\bregistry\b/g,e);return i+u+d}var Ad=80;function Qe(e){return e?e.startsWith("registry:")?e.slice(9):e:""}var jd=["registry:example","registry:internal"],Od=f.options.filter(e=>!jd.includes(e)).map(e=>Qe(e));function SR(e){let t=new Set(Od.map(r=>r.toLowerCase()));return e.filter(r=>!t.has(Qe(r).toLowerCase()))}function Nd(e,t=Ad){let r=e.trim().replace(/\s+/g," ");if(r.length<=t)return r;let s=r.slice(0,t-3).trimEnd(),n=s.lastIndexOf(" ");return `${(n>t*.6?s.slice(0,n):s).trimEnd()}...`}function _d(e,t){let r=e.addCommandArgument??e.name,s=Qe(e.type),n=s?` (${s})`:"",i=t.showRegistry&&e.registry?` \xB7 ${e.registry}`:"",o=e.description?` \u2014 ${Nd(e.description)}`:"";return `- ${$.info(r)}${n}${i}${o}`}function fa(e){let{query:t,types:r,registries:s}=e,n="";return r?.length&&(n+=` of type ${r.map(i=>Qe(i)).join(", ")}`),t&&(n+=` matching ${$.info(`"${t}"`)}`),s.length>0&&(n+=` in ${s.join(", ")}`),n}function IR(e,t){let{pagination:r,items:s,errors:n}=e,i=t.registries.length>1;if(n?.length){for(let{registry:f,message:l}of n)I.warn(`Skipped ${f}: ${l}`);I.break();}if(s.length===0){I.warn(`No items found${fa(t)}.`);return}let o=`${r.total} item${r.total===1?"":"s"}`;I.info(`Found ${o}${fa(t)}`);let c=r.offset+1,a=Math.min(r.offset+r.limit,r.total);I.log(`Showing ${c}-${a} of ${r.total}`),I.break(),I.log(s.map(f=>_d(f,{showRegistry:i})).join(`
135
+ `)),r.hasMore&&(I.break(),I.log(`More items available. Use ${$.info(`--offset ${r.offset+r.limit}`)} to see the next page.`));}var Xs=32;async function Fd(e){let{cwd:t,registryFile:r}=va(e),s=await da(r,{cwd:t}),n=ba(s,t,r);return Dd(s,n,t)}async function Md(e,t){let{cwd:r,registryFile:s}=va(t),n=await da(s,{cwd:r}),i=n.registry.items.find(c=>c.name===e);if(!i)throw new Ae(e);let o=ba(n,r,s);return Ld(i,n,o,r)}async function da(e,t){let r=S.resolve(t.cwd,e),s=await ya(r),n=wa(s,r);pa(n,r);let i={cwd:S.resolve(t.cwd),itemSources:new Map,itemSourcesByItem:new Map,firstIncludedFrom:new Map},o=!!n.include?.length;if(!o)return n.items.forEach((l,u)=>{let d={registryFile:r,registryDir:i.cwd,itemIndex:u};i.itemSources.set(l.name,d),i.itemSourcesByItem.set(l,d);}),{registry:n,itemSources:i.itemSources,itemSourcesByItem:i.itemSourcesByItem,usesInclude:o};if(S.basename(r)!=="registry.json")throw new C(`Invalid registry file at ${r}: registries that use include must be named registry.json.`,{registryFile:r});let c=await ga(r,n,i,[]);Kd(c.items,i.itemSourcesByItem);let{include:a,...f}=c;return pa(f,r),{registry:f,itemSources:i.itemSources,itemSourcesByItem:i.itemSourcesByItem,usesInclude:o}}function Dd(e,t,r){return {...e.registry,items:e.registry.items.map(s=>Wd(ha(s,e.itemSourcesByItem,t,r)))}}async function Ld(e,t,r,s){let n$1={...ha(e,t.itemSourcesByItem,r,s),$schema:"https://ui.shadcn.com/schema/registry-item.json"};return await Promise.all((e.files??[]).map(async(i,o)=>{let c=n$1.files?.[o];if(!c)return;let a=t.itemSourcesByItem.get(e),f=ma(e,i.path,t.itemSourcesByItem,s);c.content=await Vd(e.name,i.path,f,a);})),n.parse(n$1)}async function Vd(e,t,r,s){try{return await Vi.readFile(r,"utf-8")}catch(n){throw new oe(r,n,{message:`Failed to read file "${t}" for registry item "${e}" (${Rt(s)}). Expected file at ${r}.`,context:{itemName:e,itemFilePath:t,sourcePath:r},suggestion:"Make sure the file path is relative to the registry.json file that declares the item."})}}function ha(e,t,r,s){return {...e,files:e.files?.map(n=>({...n,path:zd(e,n.path,t,r,s)}))}}function Wd(e){return {...e,files:e.files?.map(({content:t,...r})=>r)}}function ma(e,t,r,s){let n=r.get(e);return S.resolve(n?.registryDir??s,t)}function zd(e,t,r,s,n){let i=ma(e,t,r,n);return S.relative(s,i).split(S.sep).join("/")}async function ga(e,t,r,s){if(xa(e,r.cwd),s.length>=Xs)throw new C(`Registry include tree is too deep at ${e}. The maximum include depth is ${Xs}.`,{registryFile:e,context:{maxDepth:Xs},suggestion:"Flatten part of the registry include tree or reduce nested include depth."});if(s.includes(e))throw new C(Gd([...s,e]),{registryFile:e});let n=s.at(-1)??e,i=r.firstIncludedFrom.get(e);if(i)throw new C(`Registry file included more than once: ${e}.
136
+ - first included from ${i}
137
+ - included again from ${n}
138
+ Each registry.json file can only appear once in the resolved include tree. Remove one include or move shared items into a single included registry.json.`,{registryFile:e,context:{firstSource:i,secondSource:n}});r.firstIncludedFrom.set(e,n);let o=[...s,e],c=S.dirname(e),a=[];for(let f of t.include??[]){let l=Ud(f,c,r.cwd,e),u=await ya(l),d=wa(u,l),p=await ga(l,d,r,o);a.push(...p.items);}return t.items.forEach((f,l)=>{Hd(f,e,c),r.itemSources.set(f.name,{registryFile:e,registryDir:c,itemIndex:l}),r.itemSourcesByItem.set(f,{registryFile:e,registryDir:c,itemIndex:l});}),{...t,items:[...a,...t.items]}}async function ya(e){try{return await Vi.readFile(e,"utf-8")}catch(t){throw new oe(e,t,{message:`Failed to read registry file at ${e}.`,context:{registryFile:e},suggestion:"Check that the registry.json file exists and that the path is correct."})}}function wa(e,t){let r;try{r=JSON.parse(e);}catch(n){throw new V(t,n,{subject:"registry file",context:{registryFile:t},suggestion:"Fix the JSON syntax in the registry.json file and try again."})}let s=o.safeParse(r);if(!s.success)throw new C(`Invalid registry file at ${t}:
139
+ ${Bd(s.error)}`,{registryFile:t,cause:s.error,suggestion:"Update the registry.json file so it matches the registry schema."});return s.data}function pa(e,t){let r=[];if(e.name||r.push("name"),e.homepage||r.push("homepage"),r.length)throw new C(`Invalid root registry file at ${t}: root registry.json must define ${r.map(s=>`"${s}"`).join(" and ")}. Included registry.json files may omit these fields.`,{registryFile:t})}function Ud(e,t,r,s){if(M(e))throw new C(`Invalid include "${e}" in ${s}: remote includes are not supported by shadcn build. Use a relative path to a registry.json file in the same repository.`,{registryFile:s,context:{includePath:e}});if(S.isAbsolute(e))throw new C(`Invalid include "${e}" in ${s}: include paths must be relative. Use a path like "./registry/ui/registry.json".`,{registryFile:s,context:{includePath:e}});if(Ra(e))throw new C(`Invalid include "${e}" in ${s}: include paths cannot use parent-directory traversal. Keep included registry.json files inside the registry root.`,{registryFile:s,context:{includePath:e}});if(S.basename(e)!=="registry.json")throw new C(`Invalid include "${e}" in ${s}: include paths must explicitly reference a registry.json file. Use a path like "./registry/ui/registry.json".`,{registryFile:s,context:{includePath:e}});let n=S.resolve(t,e);return xa(n,r),n}function xa(e,t){if(!Sa(e,t))throw new C(`Invalid registry file at ${e}: registry includes must stay inside ${t}.`,{registryFile:e,context:{cwd:t}})}function va(e){return {cwd:S.resolve(e?.cwd??process.cwd()),registryFile:e?.registryFile??"registry.json"}}function ba(e,t,r){return e.usesInclude?S.dirname(S.resolve(t,r)):t}function Hd(e,t,r){for(let s of e.files??[]){if(M(s.path))throw new C(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: remote file paths are not supported by shadcn build.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});if(S.isAbsolute(s.path))throw new C(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths must be relative.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});if(Ra(s.path))throw new C(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths cannot use parent-directory traversal.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}});let n=S.resolve(r,s.path);if(!Sa(n,r))throw new C(`Invalid file path "${s.path}" for item "${e.name}" in ${t}: file paths must stay inside the registry chunk directory.`,{registryFile:t,context:{itemName:e.name,filePath:s.path}})}}function Kd(e,t){let r=new Map;for(let s of e){let n=r.get(s.name);if(!n){r.set(s.name,s);continue}let i=t.get(n),o=t.get(s);throw new C(`Duplicate registry item name "${s.name}". Registry item names must be unique.
140
+ - ${Rt(i)}
141
+ - ${Rt(o)}
142
+ Rename one of these items so each name is unique across the resolved registry.`,{context:{itemName:s.name,firstSource:Rt(i),secondSource:Rt(o)}})}}function Ra(e){return e.split(/[\\/]+/).includes("..")}function Sa(e,t){let r=S.relative(t,e);return !!r&&!r.startsWith("..")&&!S.isAbsolute(r)}function Gd(e){return `Registry include cycle detected:
143
+ ${e.map(t=>` - ${t}`).join(`
144
+ `)}`}function Rt(e){return e?`${e.registryFile} items[${e.itemIndex}]`:"unknown source"}function Bd(e){return e.errors.map(t=>` - ${t.path.length?t.path.join("."):"(root)"}: ${t.message}`).join(`
145
+ `)}export{se as $,jn as A,dm as Aa,Oe as B,je as Ba,j as C,hm as Ca,Bt as D,Us as Da,Jt as E,Jv as Ea,Zt as F,Hs as Fa,Xt as G,Ks as Ga,Ln as H,Op as Ha,Vn as I,Gs as Ia,Qt as J,Js as Ja,er as K,Ys as Ka,Bc as L,aa as La,Bn as M,ua as Ma,M as N,Fd as Na,Jn as O,Md as Oa,pt as P,da as Pa,ri as Q,Dd as Qa,qh as R,Ld as Ra,Jh as S,vd as Sa,Yh as T,RR as Ta,Zh as U,Ed as Ua,Mt as V,Od as Va,ut as W,SR as Wa,Dt as X,IR as Xa,kn as Y,Xh as Z,Pn as _,L as a,wy as aa,H as b,Ke as ba,Jd as c,Qy as ca,Yd as d,ve as da,$ as e,Je as ea,I as f,Ms as fa,Rh as g,rv as ga,Sh as h,Ho as ha,Ih as i,ur as ia,Ma as j,Ws as ja,D as k,zs as ka,_ as l,dp as la,Te as m,hp as ma,tt as n,Vt as na,rt as o,jv as oa,st as p,Ov as pa,pe as q,Nv as qa,oe as r,tr as ra,V as s,mp as sa,C as t,_v as ta,Ae as u,Fv as ua,nt as v,Yo as va,it as w,gp as wa,ot as x,yp as xa,de as y,Mv as ya,J as z,Y as za};