shadcn 4.5.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-SI5IQBLR.js +87 -0
- package/dist/chunk-THLZQQKP.js +71 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +90 -90
- package/dist/mcp/index.js +1 -1
- package/dist/registry/index.js +1 -1
- package/dist/schema/index.d.ts +34 -34
- package/package.json +1 -1
- package/dist/chunk-42UQOK2K.js +0 -33
- package/dist/chunk-KJ7WG52C.js +0 -119
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {m,l,f,d as d$1,c as c$1,e,n,t,o,b as b$1,p,q,r,s,x,z as z$2,v,g as g$1}from'./chunk-HW2MEAJZ.js';import {a,d,c,b,g,f as f$1}from'./chunk-WLJDV6SE.js';import E,{join,basename,normalize,delimiter,resolve,dirname}from'path';import {z as z$1}from'zod';import nn,{promises,existsSync,statSync}from'fs';import {green,cyan,yellow,red}from'kleur/colors';import V from'fs-extra';import ft from'fast-glob';import {loadConfig,createMatchPath}from'tsconfig-paths';import {cosmiconfig}from'cosmiconfig';import Cl,{tmpdir,homedir}from'os';import lo from'ora';import {Project,SyntaxKind,ScriptKind,QuoteKind}from'ts-morph';import {transformFromAstSync}from'@babel/core';import {parse}from'@babel/parser';import yo from'@babel/plugin-transform-typescript';import*as yt from'recast';import Oo from'prompts';import Te from'deepmerge';import {HttpsProxyAgent}from'https-proxy-agent';import ca,{Headers}from'node-fetch';import {createHash}from'crypto';import da from'stringify-object';import B,{cwd}from'process';import pl from'readline';import El from'events';import ai from'fs/promises';import {createRequire}from'module';import {spawn}from'child_process';import {PassThrough}from'stream';import Sl from'tty';import Pc from'fuzzysort';var he=process.env.REGISTRY_URL??"https://ui.shadcn.com/r",_=he.replace(/\/r\/?$/,""),tt="new-york-v4",ps=[{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"}],D={"@shadcn":`${he}/styles/{style}/{name}.json`};var jc=[{name:"toast",deprecatedBy:"sonner",message:"The toast component is deprecated. Use the sonner component instead."},{name:"toaster",deprecatedBy:"sonner",message:"The toaster component is deprecated. Use the sonner component instead."}];function $e(e){return e.replace(/\${(\w+)}/g,(t,r)=>process.env[r]||"")}function Ae(e){let t=[],r=/\${(\w+)}/g,s;for(;(s=r.exec(e))!==null;)t.push(s[1]);return t}var N={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"},A=class extends Error{code;statusCode;context;suggestion;timestamp;cause;constructor(t,r={}){super(t),this.name="RegistryError",this.code=r.code||N.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}}},pe=class extends A{constructor(r,s){let i=`The item at ${r} was not found. It may not exist at the registry.`;super(i,{code:N.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";}},rt=class extends A{constructor(r,s){let i=`The item at ${r} is no longer available. It may have been removed or expired.`;super(i,{code:N.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";}},Oe=class extends A{constructor(r,s){let i=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(i,{code:N.UNAUTHORIZED,statusCode:401,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}},_e=class extends A{constructor(r,s){let i=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(i,{code:N.FORBIDDEN,statusCode:403,cause:s,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}},je=class extends A{constructor(r,s,i,n){let o=s?`Failed to fetch from registry (${s}): ${r}`:`Failed to fetch from registry: ${r}`,a=typeof n=="string"&&n?`${o} - ${n}`:o,l="Check your network connection and try again.";s===404?l="The requested resource was not found. Check the URL or item name.":s===500?l="The registry server encountered an error. Try again later.":s&&s>=400&&s<500&&(l="There was a client error. Check your request parameters.");super(a,{code:N.FETCH_ERROR,statusCode:s,cause:n,context:{url:r,responseBody:i},suggestion:l});this.url=r;this.responseBody=i;this.name="RegistryFetchError";}},te=class extends A{constructor(r){let s=r?`Unknown registry "${r}". Make sure it is defined in components.json as follows:
|
|
2
|
+
{
|
|
3
|
+
"registries": {
|
|
4
|
+
"${r}": "[URL_TO_REGISTRY]"
|
|
5
|
+
}
|
|
6
|
+
}`:'Unknown registry. Make sure it is defined in components.json under "registries".';super(s,{code:N.NOT_CONFIGURED,context:{registryName:r},suggestion:"Add the registry configuration to your components.json file. Consult the registry documentation for the correct format."});this.registryName=r;this.name="RegistryNotConfiguredError";}},xe=class extends A{constructor(r,s){super(`Failed to read local registry file: ${r}`,{code:N.LOCAL_FILE_ERROR,cause:s,context:{filePath:r},suggestion:"Check if the file exists and you have read permissions."});this.filePath=r;this.name="RegistryLocalFileError";}},j=class extends A{constructor(r,s){let i=`Failed to parse registry item: ${r}`;s instanceof z$1.ZodError&&(i=`Failed to parse registry item: ${r}
|
|
7
|
+
${s.errors.map(n=>` - ${n.path.join(".")}: ${n.message}`).join(`
|
|
8
|
+
`)}`);super(i,{code:N.PARSE_ERROR,cause:s,context:{item:r},suggestion:`The registry item may be corrupted or have an invalid format. Please make sure it returns a valid JSON object. See ${_}/schema/registry-item.json.`});this.item=r;this.parseError=s,this.name="RegistryParseError";}parseError},Ne=class extends A{constructor(r,s){let i=`Registry "${r}" requires the following environment variables:
|
|
9
|
+
|
|
10
|
+
`+s.map(n=>` \u2022 ${n}`).join(`
|
|
11
|
+
`);super(i,{code:N.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";}},Me=class extends A{constructor(r){let s=`Invalid registry namespace: "${r}". Registry names must start with @ (e.g., @shadcn, @v0).`;super(s,{code:N.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 st=class extends A{constructor(r,s){let i=`Invalid components.json configuration in ${r}.`;s instanceof z$1.ZodError&&(i=`Invalid components.json configuration in ${r}:
|
|
12
|
+
${s.errors.map(n=>` - ${n.path.join(".")}: ${n.message}`).join(`
|
|
13
|
+
`)}`);super(i,{code:N.INVALID_CONFIG,cause:s,context:{cwd:r},suggestion:"Check your components.json file for syntax errors or invalid configuration. Run 'npx shadcn@latest init' to regenerate a valid configuration."});this.cwd=r;this.name="ConfigParseError";}},Le=class extends A{parseError;constructor(t){let r="Failed to parse registries index";if(t instanceof z$1.ZodError){let s=t.errors.filter(i=>i.path.length>0).map(i=>`"${i.path[0]}"`).filter((i,n,o)=>o.indexOf(i)===n);s.length>0?r=`Failed to parse registries index. Invalid registry namespace(s): ${s.join(", ")}
|
|
14
|
+
${t.errors.map(i=>` - ${i.path.join(".")}: ${i.message}`).join(`
|
|
15
|
+
`)}`:r=`Failed to parse registries index:
|
|
16
|
+
${t.errors.map(i=>` - ${i.path.join(".")}: ${i.message}`).join(`
|
|
17
|
+
`)}`;}super(r,{code:N.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 mn=/^(@[a-zA-Z0-9](?:[a-zA-Z0-9-_]*[a-zA-Z0-9])?)\/(.+)$/;function ve(e){if(!e.startsWith("@"))return {registry:null,item:e};let t=e.match(mn);return t?{registry:t[1],item:t[2]}:{registry:null,item:e}}var M={"next-app":{name:"next-app",label:"Next.js",links:{installation:`${_}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},"next-pages":{name:"next-pages",label:"Next.js",links:{installation:`${_}/docs/installation/next`,tailwind:"https://tailwindcss.com/docs/guides/nextjs"}},remix:{name:"remix",label:"Remix",links:{installation:`${_}/docs/installation/remix`,tailwind:"https://tailwindcss.com/docs/guides/remix"}},"react-router":{name:"react-router",label:"React Router",links:{installation:`${_}/docs/installation/react-router`,tailwind:"https://tailwindcss.com/docs/installation/framework-guides/react-router"}},vite:{name:"vite",label:"Vite",links:{installation:`${_}/docs/installation/vite`,tailwind:"https://tailwindcss.com/docs/guides/vite"}},astro:{name:"astro",label:"Astro",links:{installation:`${_}/docs/installation/astro`,tailwind:"https://tailwindcss.com/docs/guides/astro"}},laravel:{name:"laravel",label:"Laravel",links:{installation:`${_}/docs/installation/laravel`,tailwind:"https://tailwindcss.com/docs/guides/laravel"}},"tanstack-start":{name:"tanstack-start",label:"TanStack Start",links:{installation:`${_}/docs/installation/tanstack`,tailwind:"https://tailwindcss.com/docs/installation/using-postcss"}},gatsby:{name:"gatsby",label:"Gatsby",links:{installation:`${_}/docs/installation/gatsby`,tailwind:"https://tailwindcss.com/docs/guides/gatsby"}},expo:{name:"expo",label:"Expo",links:{installation:`${_}/docs/installation/expo`,tailwind:"https://www.nativewind.dev/docs/getting-started/installation"}},manual:{name:"manual",label:"Manual",links:{installation:`${_}/docs/installation/manual`,tailwind:"https://tailwindcss.com/docs/installation"}}};var I={error:red,warn:yellow,info:cyan,success:green};function it(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 nt(e){if(!e.includes("*"))return "strip_extension";let t=e.slice(e.indexOf("*")+1);return t&&/^\.[^/]+$/.test(t)?"strip_extension":"preserve_extension"}function ot(e,t){let r=t.find(i=>!i.hasWildcard&&i.key===e);if(r)return {path:E.resolve(r.rootDir,r.target),matchedAlias:r.key,matchedTarget:r.target,emitMode:r.emitMode};let s=t.filter(i=>i.hasWildcard).sort((i,n)=>n.key.length-i.key.length);for(let i of s){let n=jt(e,i.key,{allowBareAliasBase:true});if(n!==null)return {path:E.resolve(i.rootDir,vn(i.target,n)),matchedAlias:i.key,matchedTarget:i.target,emitMode:i.emitMode}}return null}function jt(e,t,r={}){if(!t.includes("*"))return e===t?"":null;let[s,i=""]=t.split("*");return e.startsWith(s)&&e.endsWith(i)?i?e.slice(s.length,-i.length):e.slice(s.length):r.allowBareAliasBase&&i===""&&s.endsWith("/")&&e===s.slice(0,-1)?"":null}function vn(e,t){if(!e.includes("*"))return e;let[r,s=""]=e.split("*");return t?`${r}${t}${s}`:r.replace(/\/$/,"")}function re(e="",t=true){let r=E.join(e,"package.json");return V.readJSONSync(r,{throws:t})}var Nt=new Map;function Mt(e){let t=E.resolve(e),r=Nt.get(t);if(r)return r;let i=re(e,false)?.imports;if(!i||typeof i!="object"||Array.isArray(i))return Nt.set(t,[]),[];let n=[];for(let[o,a]of Object.entries(i)){if(!o.startsWith("#"))continue;let l=it(a);l&&n.push({key:o,aliasBase:o==="#*"?"#":o.endsWith("/*")?o.slice(0,-2):o,target:l,emitMode:nt(l),hasWildcard:o.includes("*"),rootDir:t});}return Nt.set(t,n),n}function ds(e){let t=Mt(e).map(r=>r.aliasBase);return t.length?Rn(t):null}function De(e,t){return ot(e,Mt(t))}function ms(e){let t=Mt(e),r=t.some(s=>s.key==="#*")?{components:"#components",ui:"#components/ui",lib:"#lib",hooks:"#hooks",utils:"#lib/utils"}:null;return {components:Fe(t,"components")??r?.components,ui:Fe(t,"ui")??r?.ui,lib:Fe(t,"lib")??r?.lib,hooks:Fe(t,"hooks")??r?.hooks,utils:Fe(t,"utils")??r?.utils}}function Fe(e,t){return e.map(s=>({entry:s,score:Sn(s,t)})).filter(s=>s.score>0).sort((s,i)=>i.score-s.score||i.entry.aliasBase.length-s.entry.aliasBase.length)[0]?.entry.aliasBase}function Sn(e,t){let r=e.aliasBase.toLowerCase(),s=kn(e.target).toLowerCase();switch(t){case "components":return r.endsWith("/ui")||s.includes("/components/ui")?0:at(r,"components")?4:at(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:at(s,"lib")?3:0;case "hooks":return r==="#hooks"||r.endsWith("/hooks")?5:s.endsWith("/hooks")?4:at(s,"hooks")?3:0;case "utils":return r==="#utils"||r.endsWith("/utils")?5:s.endsWith("/lib/utils")?4:s.endsWith("/utils")?3:0}}function kn(e){return e.replace(/\/\*$/,"").replace(/\*$/,"").replace(/\/index\.[^/]+$/,"")}function at(e,t){return e===t||e.includes(`/${t}`)||e.includes(`${t}/`)}function Rn(e){let t=e.map(r=>r.slice(1).split("/").filter(Boolean)).reduce((r,s,i)=>i?r.filter((n,o)=>s[o]===n):s,[]);return t.length?`#${t.join("/")}`:"#"}var k={error(...e){console.log(I.error(e.join(" ")));},warn(...e){console.log(I.warn(e.join(" ")));},info(...e){console.log(I.info(e.join(" ")));},success(...e){console.log(I.success(e.join(" ")));},log(...e){console.log(e.join(" "));},break(){console.log("");}};var Tn=["next.config.*","vite.config.*","astro.config.*","remix.config.*","nuxt.config.*","svelte.config.*","gatsby-config.*","angular.json"];async function au(e){if(V.existsSync(E.resolve(e,"pnpm-workspace.yaml")))return true;let t=E.resolve(e,"package.json");if(V.existsSync(t))try{if((await V.readJson(t)).workspaces)return !0}catch{}return !!(V.existsSync(E.resolve(e,"lerna.json"))||V.existsSync(E.resolve(e,"nx.json")))}async function lu(e){let t=await lt(e);if(!t.length)return [];let r=await ft(t,{cwd:e,onlyDirectories:true,ignore:["**/node_modules/**"]}),s=[];for(let i of r){let n=E.resolve(e,i);if(!V.existsSync(E.resolve(n,"package.json")))continue;let o=V.existsSync(E.resolve(n,"components.json")),a=Tn.some(l=>ft.sync(l,{cwd:n,dot:true}).length>0);(o||a)&&s.push({name:i,hasConfig:o});}return s}function cu(e,t,r){let s=r?.cwdFlag??"-c";k.break(),k.log(`It looks like you are running ${I.info(e)} from a monorepo root.`),k.log(`To use shadcn in a specific workspace, use the ${I.info(s)} flag:`),k.break();for(let i of t)k.log(` shadcn ${e} ${s} ${i.name}`);k.break();}async function lt(e){let t=[],r=E.resolve(e,"pnpm-workspace.yaml");if(V.existsSync(r)){let i=await V.readFile(r,"utf8"),n=Array.from(i.matchAll(/^\s*-\s*["']?([^"'\n#]+)["']?\s*$/gm));for(let o of n)t.push(o[1].trim());}let s=E.resolve(e,"package.json");if(V.existsSync(s))try{let i=await V.readJson(s),n=Array.isArray(i.workspaces)?i.workspaces:i.workspaces?.packages;Array.isArray(n)&&t.push(...n.filter(o=>!o.startsWith("!")));}catch{}return Array.from(new Set(t))}var ys=new Map,Lt=new Map,ct=new Map;async function ws(e,t){let r=Nn(e);if(!r)return null;let s=await An(t,r.packageName);return s?ot(e,$n(s)):null}function $n(e){let t=`${e.packageRoot}:${e.packageName}`,r=Lt.get(t);if(r)return r;let i=re(e.packageRoot,false)?.exports;if(!i||typeof i!="object"||Array.isArray(i))return Lt.set(t,[]),[];let n=[];for(let[o,a]of Object.entries(i)){if(o!=="."&&!o.startsWith("./"))continue;let l=it(a);if(!l)continue;let h=Mn(e.packageName,o);n.push({key:o.includes("*")?`${h}/*`:h,aliasBase:h,target:l,emitMode:nt(l),hasWildcard:o.includes("*"),rootDir:e.packageRoot});}return Lt.set(t,n),n}async function An(e,t){let r=await _n(e);if(!r)return null;let s=ys.get(r);if(s?.has(t))return s.get(t)??null;let i=await On(r);return ys.set(r,i),i.get(t)??null}async function On(e){let t=await lt(e),r=new Map;if(!t.length)return r;let s=await ft(t.map(i=>E.posix.join(i.split(E.sep).join("/"),"package.json")),{cwd:e,ignore:["**/node_modules/**"]});for(let i of s){let n=E.resolve(e,E.dirname(i)),a=re(n,false)?.name;a&&r.set(a,{packageName:a,packageRoot:n});}return r}async function _n(e){let t=E.resolve(e),r=ct.get(t);if(r!==void 0)return r;let s=t,i=await jn(t);for(;;){if((await lt(s)).length)return ct.set(t,s),s;if(i&&s===i)return ct.set(t,null),null;let o=E.dirname(s);if(o===s)return ct.set(t,null),null;s=o;}}async function jn(e){let t=E.resolve(e);for(;;){if(V.existsSync(E.resolve(t,".git")))return t;let r=E.dirname(t);if(r===t)return null;t=r;}}function Nn(e){if(e.startsWith("#")||e.startsWith(".")||E.isAbsolute(e))return null;let t=e.split("/");return e.startsWith("@")?t.length<2?null:{packageName:`${t[0]}/${t[1]}`}:{packageName:t[0]}}function Mn(e,t){if(t===".")return e;let r=t.slice(2).replace(/\/\*$/,"");return r?`${e}/${r}`:e}async function We(e,t){let r=t.cwd??t.absoluteBaseUrl;if(e.startsWith("#")){let i=De(e,r);if(i)return {path:i.path,source:"package_imports",matchedAlias:i.matchedAlias,matchedTarget:i.matchedTarget,emitMode:i.emitMode}}let s=await ws(e,r);return s?{path:s.path,source:"workspace_package_exports",matchedAlias:s.matchedAlias,matchedTarget:s.matchedTarget,emitMode:s.emitMode}:Dn(e,t)}function Ft(e,t){return e.startsWith("#")?true:t?e.startsWith(`${t}/`):false}function Fn(e){return /^@[^/]+\/[^/]+(?:\/.*)?$/.test(e)}function Dn(e,t){let r=createMatchPath(t.absoluteBaseUrl,t.paths)(e,void 0,()=>true,[".ts",".tsx",".jsx",".js",".css"]);if(!r)return null;let s=Wn(e,t.paths);return !s&&Fn(e)?null:{path:r,source:"tsconfig_paths",matchedAlias:s?.key??e,matchedTarget:s?.target??r,emitMode:"strip_extension"}}function Wn(e,t){for(let[r,s]of Object.entries(t)){let i=Array.isArray(s)?s:[s],n=jt(e,r);if(n!==null)return {key:r,target:i[0]?.includes("*")&&n!==null?i[0].replace(/\*/g,n):i[0]}}return null}var Ou="@/components",_u="@/lib/utils",ju="app/globals.css",Nu="tailwind.config.js";var ut=cosmiconfig("components",{searchPlaces:["components.json"]});async function ze(e){let t=await qn(e);return t?(t.iconLibrary||(t.iconLibrary=t.style==="new-york"?"radix":"lucide"),await ht(e,t)):null}async function ht(e,t){t.registries={...D,...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 Ve("utils",t.aliases.utils,e,r),i=await Ve("components",t.aliases.components,e,r),n=t.aliases.ui?await Ve("ui",t.aliases.ui,e,r):E.resolve(i??e,"ui"),o=t.aliases.lib?await Ve("lib",t.aliases.lib,e,r):E.resolve(s??e,".."),a=t.aliases.hooks?await Ve("hooks",t.aliases.hooks,e,r):E.resolve(i??e,"..","hooks");return Un(e,{components:i,utils:s,ui:n,lib:o,hooks:a}),d$1.parse({...t,resolvedPaths:{cwd:e,tailwindConfig:t.tailwind.config?E.resolve(e,t.tailwind.config):"",tailwindCss:E.resolve(e,t.tailwind.css),utils:s,components:i,ui:n,lib:o,hooks:a}})}async function Ve(e,t,r,s){let i=await We(t,{...s,cwd:r});if(!i?.path||t.startsWith("#")&&i.path===E.resolve(r,t))return null;if(e!=="utils"&&(i.source==="package_imports"||i.source==="workspace_package_exports")){if(!i.matchedAlias.includes("*")&&/\/index\.[^/]+$/.test(i.path))return E.dirname(i.path);if(i.matchedAlias.includes("*")&&/\.[^/]+$/.test(i.path))return i.path.replace(/\.[^/]+$/,"")}return i.path}function Un(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 ${I.info(e)}: ${I.info(r.join(", "))}.`,`Configure path aliases in ${I.info("tsconfig.json")} or imports in ${I.info("package.json")} for this workspace and try again.`].join(`
|
|
18
|
+
`))}async function qn(e){try{let t=await ut.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 D)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 ${I.info(r)}.`)}}async function Mu(e$1){let t={};for(let s of Object.keys(e$1.aliases)){if(!Gn(s,e$1))continue;let i=e$1.resolvedPaths[s],n=await Bn(e$1.resolvedPaths.cwd,i);if(!n){t[s]=e$1;continue}let o=await ze(n);if(!o)throw new Error([`Could not load the workspace config in ${I.info(n)}.`,`Add ${I.info("components.json")} to this workspace and configure its path aliases or package imports, then try again.`].join(`
|
|
19
|
+
`));t[s]=o;}let r=e.safeParse(t);return r.success?r.data:null}async function Bn(e,t){let r=Hn(e,t),s=E.relative(r,t),n=(await ft.glob("**/package.json",{cwd:r,deep:3,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/public/**"]})).map(o=>E.dirname(o)).find(o=>s.startsWith(o));return n?E.join(r,n):null}function Gn(e,t){return Object.keys(t.resolvedPaths).filter(r=>r!=="utils").includes(e)}function Hn(e,t){let r=e.split(E.sep),s=t.split(E.sep),i=[];for(let n=0;n<Math.min(r.length,s.length)&&r[n]===s[n];n++)i.push(r[n]);return i.join(E.sep)}async function xs(e,t){return (await X(e))?.tailwindVersion==="v4"?"new-york-v4":t}function Lu(e){return e?.startsWith("base-")?"base":"radix"}function vs(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:{...D}};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 dt=["**/node_modules/**",".next","public","dist","build"],Xn=z$1.object({compilerOptions:z$1.object({paths:z$1.record(z$1.string().or(z$1.array(z$1.string())))})});async function X(e,t){let[r,s,i,n,o,a,l,h]=await Promise.all([ft.glob("**/{next,vite,astro,app}.config.*|gatsby-config.*|composer.json|react-router.config.*",{cwd:e,deep:3,ignore:dt}),V.pathExists(E.resolve(e,"src")),ro(e),eo(e),Qn(e,t?.configCssFile),bs(e),Es(e),re(e,false)]),u=await V.pathExists(E.resolve(e,`${s?"src/":""}app`)),c={framework:M.manual,isSrcDir:s,isRSC:false,isTsx:i,tailwindConfigFile:n,tailwindCssFile:o,tailwindVersion:a,frameworkVersion:null,aliasPrefix:l.prefix};if(r.find(p=>p.startsWith("next.config."))?.length)return c.framework=u?M["next-app"]:M["next-pages"],c.isRSC=u,c.frameworkVersion=await Zn(c.framework,h),c;if(r.find(p=>p.startsWith("astro.config."))?.length)return c.framework=M.astro,c;if(r.find(p=>p.startsWith("gatsby-config."))?.length)return c.framework=M.gatsby,c;if(r.find(p=>p.startsWith("composer.json"))?.length)return c.framework=M.laravel,c;if(Object.keys(h?.dependencies??{}).find(p=>p.startsWith("@remix-run/")))return c.framework=M.remix,c;if([...Object.keys(h?.dependencies??{}),...Object.keys(h?.devDependencies??{})].find(p=>p.startsWith("@tanstack/react-start")))return c.framework=M["tanstack-start"],c;if(r.find(p=>p.startsWith("react-router.config."))?.length)return c.framework=M["react-router"],c;if(r.find(p=>p.startsWith("vite.config."))?.length)return c.framework=M.vite,c;let f=r.find(p=>p.startsWith("app.config"));return f?.length&&(await V.readFile(E.resolve(e,f),"utf8")).includes("defineConfig")?(c.framework=M.vite,c):(h?.dependencies?.expo&&(c.framework=M.expo),c)}async function Zn(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 i=r.match(/(\d+\.\d+\.\d+)/);return i?i[1]:r}async function bs(e){let[t,r]=await Promise.all([re(e,false),ze(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 Qn(e,t){if(t){let n=E.resolve(e,t);if(await V.pathExists(n))return t}let[r,s]=await Promise.all([ft.glob(["**/*.css","**/*.scss"],{cwd:e,deep:5,ignore:dt}),bs(e)]);if(!r.length)return null;for(let n of r){let o=await V.readFile(E.resolve(e,n),"utf8");if(o.includes('@import "tailwindcss"')||o.includes("@import 'tailwindcss'")||o.includes("@tailwind base"))return n}return null}async function eo(e){let t=await ft.glob("tailwind.config.*",{cwd:e,deep:3,ignore:dt});return t.length?t[0]:null}async function to(e){let t=await loadConfig(e),r=t?.resultType==="success"&&Object.entries(t.paths).length?t.paths:(await so(e))?.compilerOptions.paths;if(!r||!Object.entries(r).length)return null;for(let[s,i]of Object.entries(r)){let n=Array.isArray(i)?i:[i];if(n.includes("./*")||n.includes("./src/*")||n.includes("./app/*")||n.includes("./resources/js/*"))return s.replace(/\/\*$/,"")??null}return Object.keys(r)?.[0].replace(/\/\*$/,"")??null}async function Es(e){let t=await to(e),r=ds(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 ro(e){return (await ft.glob("tsconfig.*",{cwd:e,deep:1,ignore:dt})).length>0}async function so(e){for(let t of ["tsconfig.json","tsconfig.web.json","tsconfig.app.json"]){let r=E.resolve(e,t);if(!await V.pathExists(r))continue;let s=await V.readFile(r,"utf8"),i;try{i=JSON.parse(io(s));}catch{continue}let n=Xn.safeParse(i);if(!n.error)return n.data}return null}function io(e){let t="",r=false,s=false;for(let i=0;i<e.length;i++){let n=e[i],o=e[i+1];if(r){if(t+=n,s){s=false;continue}if(n==="\\"){s=true;continue}n==='"'&&(r=false);continue}if(n==='"'){r=true,t+=n;continue}if(n==="/"&&o==="/"){for(;i<e.length&&e[i]!==`
|
|
20
|
+
`;)i++;i<e.length&&(t+=e[i]);continue}if(n==="/"&&o==="*"){for(i+=2;i<e.length;){if(e[i]==="*"&&e[i+1]==="/"){i++;break}e[i]===`
|
|
21
|
+
`&&(t+=`
|
|
22
|
+
`),i++;}continue}if(n===","){let a=i+1;for(;a<e.length;){for(;/\s/.test(e[a]??"");)a++;if(e[a]==="/"&&e[a+1]==="/"){for(a+=2;a<e.length&&e[a]!==`
|
|
23
|
+
`&&e[a]!=="\r";)a++;continue}if(e[a]==="/"&&e[a+1]==="*"){for(a+=2;a<e.length&&!(e[a]==="*"&&e[a+1]==="/");)a++;a+=2;continue}break}if(e[a]==="}"||e[a]==="]")continue}t+=n;}return t}async function Zu(e,t=null){let[r,s,i]=await Promise.all([ze(e),t?Promise.resolve(t):X(e),Es(e)]);if(r)return r;if(!s||!s.tailwindCssFile||s.tailwindVersion==="v3"&&!s.tailwindConfigFile)return null;let n=i.source==="package_imports"?ms(e):null;if(!s.aliasPrefix)return null;let o=no(s.aliasPrefix,i.source==="package_imports"),a=i.source==="package_imports"&&n?oo({...o,components:n.components??o.components,ui:n.ui??o.ui,hooks:n.hooks??o.hooks,lib:n.lib??o.lib,utils:n.utils??o.utils}):o;if(!a.components||!a.utils)return null;let l={$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:a};return await ht(e,l)}function no(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 oo(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 mt(e){if(!e.resolvedPaths?.cwd)return "v3";let t=await X(e.resolvedPaths.cwd);return t?.tailwindVersion?t.tailwindVersion:null}async function Qu(e){let t=await ze(e);if(!t)return [];let s=(await ht(e,t)).resolvedPaths.ui;if(!V.existsSync(s))return [];let i=await pt(),n=new Set(i?.map(a=>a.name)??[]);return (await promises.readdir(s)).filter(a=>/\.(tsx|jsx)$/.test(a)).map(a=>E.basename(a,E.extname(a))).filter(a=>n.has(a))}function Cs(e,t,r={}){let{ignoreImports:s=false}=r,i=e.replace(/\r\n/g,`
|
|
24
|
+
`).trim(),n=t.replace(/\r\n/g,`
|
|
25
|
+
`).trim();if(i===n)return true;if(!s)return false;let o=/^(import\s+(?:type\s+)?(?:\*\s+as\s+\w+|\{[^}]*\}|\w+)?(?:\s*,\s*(?:\{[^}]*\}|\w+))?\s+from\s+["'])([^"']+)(["'])/gm,a=u=>u.replace(o,(c,f,p,d)=>{if(p.startsWith("."))return `${f}${p}${d}`;let m=p.split("/"),g=m[m.length-1];return `${f}@normalized/${g}${d}`}),l=a(i),h=a(n);return l===h}function fe(e){let t=E.basename(e);return /^\.env(\.|$)/.test(t)}function ks(e){let t=[".env.local",".env",".env.development.local",".env.development"];for(let r of t){let s=E.join(e,r);if(existsSync(s))return s}return null}function Ee(e){let t=e.split(`
|
|
26
|
+
`),r={};for(let s of t){let i=s.trim();if(!i||i.startsWith("#"))continue;let n=i.indexOf("=");if(n===-1)continue;let o=i.substring(0,n).trim(),a=i.substring(n+1).trim();o&&(r[o]=a.replace(/^["']|["']$/g,""));}return r}function Rs(e,t){let r=Ee(e),s=Ee(t),i=[];for(let n of Object.keys(s))n in r||i.push(n);return i}function Ts(e,t){let r=Ee(e),s=Ee(t),i=e.trimEnd();i&&!i.endsWith(`
|
|
27
|
+
`)&&(i+=`
|
|
28
|
+
`);let n=[];for(let[o,a]of Object.entries(s))o in r||n.push(`${o}=${a}`);return n.length>0?(i&&(i+=`
|
|
29
|
+
`),i+=n.join(`
|
|
30
|
+
`),i+`
|
|
31
|
+
`):i&&!i.endsWith(`
|
|
32
|
+
`)?i+`
|
|
33
|
+
`:i}function de(e,t){return lo({text:e,isSilent:t?.silent})}var gt=async({sourceFile:e,config:t,isRemote:r})=>{let s=t.aliases?.utils,i=typeof s=="string"?ho(s):"@",n=i?`${i}/lib/utils`:"@/lib/utils";if(![".tsx",".ts",".jsx",".js"].includes(e.getExtension()))return e;for(let o of e.getImportStringLiterals()){let a=uo(o.getLiteralValue(),t,r);if(o.setLiteralValue(a),n===a||a==="@/lib/utils"){if(!o.getFirstAncestorByKind(SyntaxKind.ImportDeclaration)?.getNamedImports().some(u=>u.getName()==="cn")||!t.aliases.utils)continue;o.setLiteralValue(n===a?a.replace(n,t.aliases.utils):t.aliases.utils);}}return e};function uo(e,t,r=false){if(e=po(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 ho(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 po(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 fo(t)){if(e===r)return s;if(e.startsWith(`${r}/`))return `${s}${e.slice(r.length)}`}return e}function fo(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 wo={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"]},Ps=async({sourceFile:e,config:t})=>{let r=e.getFullText();if(t.tsx)return r;let s=yt.parse(r,{parser:{parse:n=>parse(n,wo)}}),i=transformFromAstSync(s,r,{cloneInputAst:false,code:false,ast:true,plugins:[yo],configFile:false});if(!i||!i.ast)throw new Error("Failed to transform JSX");return yt.print(i.ast).code};var vo=/^["']use client["']$/g,wt=async({sourceFile:e,config:t})=>{if(t.rsc)return e;let r=e.getFirstChildByKind(SyntaxKind.ExpressionStatement);return r&&vo.test(r.getText())&&r.remove(),e};var bo=new Set(["cn-font-heading"]),Eo=/\bcn-[a-z-]+\b/;function Is(e){return Eo.test(e)&&!bo.has(e)}function $s(e){return e.split(/\s+/).filter(t=>t.length>0&&!Is(t)).join(" ")}function As(e){return e.split(/\s+/).some(Is)}function xt(e){let t=e.getLiteralValue();if(!As(t))return;let r=$s(t);r!==t&&e.setLiteralValue(r);}function Dt(e){for(let t of e.getDescendantsOfKind(SyntaxKind.StringLiteral))xt(t);for(let t of e.getDescendantsOfKind(SyntaxKind.NoSubstitutionTemplateLiteral))xt(t);}function Co(e){let t=[];for(let r of e.getDescendantsOfKind(SyntaxKind.JsxAttribute)){let s=r.getNameNode().getText();if(s!=="className"&&s!=="classNames")continue;let i=r.getInitializer();if(i?.isKind(SyntaxKind.StringLiteral)){let n=i.getLiteralValue();if(As(n)){let o=$s(n);o===""?t.push(r):o!==n&&i.setLiteralValue(o);}}i?.isKind(SyntaxKind.JsxExpression)&&Dt(i);}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)){xt(s);continue}if(s.isKind(SyntaxKind.NoSubstitutionTemplateLiteral)){xt(s);continue}Dt(s);}for(let r of e.getDescendantsOfKind(SyntaxKind.CallExpression))r.getExpression().getText()==="mergeProps"&&Dt(r);}var vt=async({sourceFile:e})=>(Co(e),e);var bt=async({sourceFile:e,config:t})=>{if(!t.tailwind?.prefix)return e;let r=await mt(t);return e.getDescendantsOfKind(SyntaxKind.CallExpression).filter(s=>s.getExpression().getText()==="cva").forEach(s=>{if(s.getArguments()[0]?.isKind(SyntaxKind.StringLiteral)){let i=s.getArguments()[0];i&&i.replaceWithText(`"${ne(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}s.getArguments()[1]?.isKind(SyntaxKind.ObjectLiteralExpression)&&s.getArguments()[1]?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).find(i=>i.getName()==="variants")?.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(i=>{i.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(n=>{let o=n.getInitializerIfKind(SyntaxKind.StringLiteral);o&&o?.replaceWithText(`"${ne(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 i=s.getInitializer();i&&i.replaceWithText(`"${ne(i.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}if(s.getInitializer()?.isKind(SyntaxKind.JsxExpression)){let i=s.getInitializer()?.getDescendantsOfKind(SyntaxKind.CallExpression).find(n=>n.getExpression().getText()==="cn");i&&i.getArguments().forEach(n=>{(n.isKind(SyntaxKind.ConditionalExpression)||n.isKind(SyntaxKind.BinaryExpression))&&n.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(o=>{o.replaceWithText(`"${ne(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),n.isKind(SyntaxKind.StringLiteral)&&n.replaceWithText(`"${ne(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);});}}s.getNameNode().getText()==="classNames"&&s.getInitializer()?.isKind(SyntaxKind.JsxExpression)&&s.getDescendantsOfKind(SyntaxKind.PropertyAssignment).forEach(i=>{if(i.getInitializer()?.isKind(SyntaxKind.CallExpression)){let n=i.getInitializerIfKind(SyntaxKind.CallExpression);n&&n.getArguments().forEach(o=>{o.isKind(SyntaxKind.ConditionalExpression)&&o.getChildrenOfKind(SyntaxKind.StringLiteral).forEach(a=>{a.replaceWithText(`"${ne(a.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}),o.isKind(SyntaxKind.StringLiteral)&&o.replaceWithText(`"${ne(o.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);});}if(i.getInitializer()?.isKind(SyntaxKind.StringLiteral)&&i.getNameNode().getText()!=="variant"){let n=i.getInitializer();n&&n.replaceWithText(`"${ne(n.getText()?.replace(/"|'/g,""),t.tailwind.prefix,r)}"`);}});}),e};function ne(e,t="",r){return r==="v3"?e.split(" ").map(s=>{let[i,n,o]=b(s);return i?o?`${i}:${t}${n}/${o}`:`${i}:${t}${n}`:o?`${t}${n}/${o}`:`${t}${n}`}).join(" "):e.split(" ").map(s=>s.indexOf(`${t}:`)===0?s:`${t}:${s.trim()}`).join(" ")}var Po=new Project({compilerOptions:{}});async function Io(e){let t=await promises.mkdtemp(E.join(tmpdir(),"shadcn-"));return E.join(t,e)}async function _s(e,t=[gt,wt,a,bt,d,c,vt]){let r=await Io(e.filename),s=Po.createSourceFile(r,e.raw,{scriptKind:ScriptKind.TSX});for(let i of t)await i({sourceFile:s,...e});return e.transformJsx?await Ps({sourceFile:s,...e}):s.getText()}var $o=["a","span","div","Link","label","Label"],js=async({sourceFile:e,config:t})=>{if(!t.style?.startsWith("base-"))return e;let r=10;for(let s=0;s<r;s++){let n=e.getDescendantsOfKind(SyntaxKind.JsxElement).filter(l=>l.getOpeningElement().getAttribute("asChild"));if(n.length===0)break;let o=n.filter(l=>!l.getDescendantsOfKind(SyntaxKind.JsxElement).some(u=>u.getOpeningElement().getAttribute("asChild"))),a=[];for(let l of o){let h=l.getOpeningElement(),u=h.getAttribute("asChild");if(!u)continue;let c=h.getTagNameNode().getText(),p=l.getJsxChildren().find(y=>y.getKind()===SyntaxKind.JsxElement||y.getKind()===SyntaxKind.JsxSelfClosingElement);if(!p){u.remove();continue}let d,m,g;if(p.getKind()===SyntaxKind.JsxSelfClosingElement){let y=p.asKindOrThrow(SyntaxKind.JsxSelfClosingElement);d=y.getTagNameNode().getText(),m=y.getAttributes().map(w=>w.getText()).join(" "),g="";}else {let y=p.asKindOrThrow(SyntaxKind.JsxElement),w=y.getOpeningElement();d=w.getTagNameNode().getText(),m=w.getAttributes().map(v=>v.getText()).join(" "),g=y.getJsxChildren().map(v=>v.getText()).join("");}let x=c==="Button"&&$o.includes(d);a.push({parentElement:l,parentTagName:c,childTagName:d,childProps:m,childChildren:g,needsNativeButton:x});}for(let l of a.reverse()){let u=l.parentElement.getOpeningElement().getAttributes().filter(m=>m.getKind()===SyntaxKind.JsxAttribute?m.asKindOrThrow(SyntaxKind.JsxAttribute).getNameNode().getText()!=="asChild":true).map(m=>m.getText()).join(" "),c=l.childProps?`{<${l.childTagName} ${l.childProps} />}`:`{<${l.childTagName} />}`,f=u?`${u} `:"";f+=`render=${c}`,l.needsNativeButton&&(f+=" nativeButton={false}");let p=l.childChildren.trim()?`${l.childChildren}`:"",d=`<${l.parentTagName} ${f}>${p}</${l.parentTagName}>`;l.parentElement.replaceWithText(d);}}return e};var Ns=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 Vt=[".ts",".tsx",".js",".jsx"],_o=new Set(["tailwindConfig","tailwindCss"]),jo=["components","ui","lib","hooks"];async function vp(e,t,r){if(!e?.length)return {filesCreated:[],filesUpdated:[],filesSkipped:[]};r={overwrite:false,force:false,silent:false,isRemote:false,isWorkspace:false,...r};let s=de("Updating files.",{silent:r.silent})?.start(),[i,n]=await Promise.all([X(t.resolvedPaths.cwd),t.tailwind.baseColor?St(t.tailwind.baseColor):Promise.resolve(void 0)]),o=loadConfig(t.resolvedPaths.cwd),a$1=Vo(r.plannedFiles??e,t,{isSrcDir:i?.isSrcDir,framework:i?.framework.name,path:r.path}),l=new Project({compilerOptions:{}}),h=[],u=[],c$1=[],f=[],p=null;for(let x=0;x<e.length;x++){let y=e[x];if(!y.content)continue;let w=Et(y,t,{isSrcDir:i?.isSrcDir,framework:i?.framework.name,commonRoot:Ct(e.map(R=>R.path),y.path),path:r.path,fileIndex:x});if(!w)continue;let v=basename(y.path),b=E.dirname(w);if(t.tsx||(w=w.replace(/\.tsx?$/,R=>R===".tsx"?".jsx":".js")),fe(w)&&!existsSync(w)){let R=ks(b);R&&(w=R);}let C=existsSync(w);if(y.type==="registry:lib"&&basename(y.path)==="utils.ts"&&i?.framework.name==="laravel"&&C){c$1.push(E.relative(t.resolvedPaths.cwd,w));continue}if(C&&statSync(w).isDirectory())throw new Error(`Cannot write to ${w}: path exists and is a directory. Please provide a file path instead.`);let P=y.type==="registry:file"||y.type==="registry:item",T=fe(w)||P?y.content:await _s({filename:y.path,raw:y.content,config:t,baseColor:n,transformJsx:!t.tsx,isRemote:r.isRemote,supportedFontMarkers:r.supportedFontMarkers},[gt,wt,a,bt,c,g,js,d,...Ms(w,i,t)?[Ns]:[],f$1,vt]);if(C&&!fe(w)){let R=await Vs({config:t,content:T,filePaths:a$1,project:l,projectInfo:i,resolvedPath:w,tsConfig:o}),H=await promises.readFile(w,"utf-8");if(Cs(H,R,{ignoreImports:r.isWorkspace})){c$1.push(E.relative(t.resolvedPaths.cwd,w));continue}}if(C&&!r.overwrite&&!fe(w)){s.stop(),r.rootSpinner&&r.rootSpinner.stop();let{overwrite:R}=await Oo({type:"confirm",name:"overwrite",message:`The file ${I.info(v)} already exists. Would you like to overwrite?`,initial:false});if(!R){c$1.push(E.relative(t.resolvedPaths.cwd,w)),r.rootSpinner&&r.rootSpinner.start();continue}s?.start(),r.rootSpinner&&r.rootSpinner.start();}if(Ms(w,i,t)&&(w=w.replace(/middleware\.(ts|js)$/,"proxy.$1")),existsSync(b)||await promises.mkdir(b,{recursive:true}),fe(w)&&C){let R=await promises.readFile(w,"utf-8"),H=Ts(R,T);if(f=Rs(R,T),p=E.relative(t.resolvedPaths.cwd,w),!f.length){c$1.push(E.relative(t.resolvedPaths.cwd,w));continue}await promises.writeFile(w,H,"utf-8"),u.push(E.relative(t.resolvedPaths.cwd,w));continue}await promises.writeFile(w,T,"utf-8"),C?u.push(E.relative(t.resolvedPaths.cwd,w)):(h.push(E.relative(t.resolvedPaths.cwd,w)),fe(w)&&(f=Object.keys(Ee(T)),p=E.relative(t.resolvedPaths.cwd,w)));}let d$1=[...h,...u,...c$1],m=await Wo(d$1,t,a$1);if(u.push(...m),h=Array.from(new Set(h)),u=Array.from(new Set(u.filter(x=>!h.includes(x)))),c$1=Array.from(new Set(c$1)),!(h.length||u.length)&&!c$1.length&&s?.info("No files updated."),h.length){if(s?.succeed(`Created ${h.length} ${h.length===1?"file":"files"}:`),!r.silent)for(let x of h)k.log(` - ${x}`);}else s?.stop();if(u.length&&(de(`Updated ${u.length} ${u.length===1?"file":"files"}:`,{silent:r.silent})?.info(),!r.silent))for(let x of u)k.log(` - ${x}`);if(c$1.length&&(de(`Skipped ${c$1.length} ${c$1.length===1?"file":"files"}: (files might be identical, use --overwrite to overwrite)`,{silent:r.silent})?.info(),!r.silent))for(let x of c$1)k.log(` - ${x}`);if(f.length&&p&&(de(`Added the following variables to ${I.info(p)}:`)?.info(),!r.silent))for(let x of f)k.log(` ${I.success("+")} ${x}`);return {filesCreated:h,filesUpdated:u,filesSkipped:c$1}}function Et(e,t,r){if(r.path){let n=E.isAbsolute(r.path)?r.path:E.join(t.resolvedPaths.cwd,r.path);if(/\.[^/\\]+$/.test(n)){if(r.fileIndex===0)return n}else {let a=E.basename(e.path);return E.join(n,a)}}if(e.target){if(e.target.startsWith("~/"))return E.join(t.resolvedPaths.cwd,e.target.replace("~/",""));let n=e.target,o=No(n,t);return o?.resolvedPath?o.resolvedPath:(o?.target&&(n=o.target),e.type==="registry:page"&&(n=Do(n,r.framework),!n)?"":r.isSrcDir?E.join(t.resolvedPaths.cwd,"src",n.replace("src/","")):E.join(t.resolvedPaths.cwd,n.replace("src/","")))}let s=Lo(e,t),i=Fo(e.path,s);return E.join(s,i)}function No(e,t){let r=e.match(/^@([^/]+)\/(.+)$/);if(!r)return null;let[,s,i]=r;if(!Mo(s))return {target:`${s}/${i}`};let n=E.resolve(t.resolvedPaths[s]),o=E.resolve(n,i);if(o!==n&&!o.startsWith(`${n}${E.sep}`))throw new Error(`Invalid target path "${e}". Target paths using @${s}/ must stay within the ${s} alias root.`);return {resolvedPath:o}}function Mo(e){return jo.includes(e)}function Lo(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 Ct(e,t){let r=e.map(o=>o.replace(/^\//,"")),s=t.replace(/^\//,""),i=s.split("/").slice(0,-1).join("/");if(!i)return "";let n=i.split("/");for(let o=n.length;o>0;o--){let a=n.slice(0,o).join("/");if(r.some(h=>h!==s&&h.startsWith(a+"/")))return "/"+a}return "/"+i}function Fo(e,t){let r=e.replace(/^\/|\/$/g,""),s=t.replace(/^\/|\/$/g,""),i=r.split("/"),n=s.split("/"),o=n[n.length-1],a=i.findIndex(l=>l===o);return a===-1?i[i.length-1]:i.slice(a+1).join("/")}function Do(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 Wo(e,t,r=e){let s=new Project({compilerOptions:{}}),i=await X(t.resolvedPaths.cwd),n=loadConfig(t.resolvedPaths.cwd),o=[];if(!i||n.resultType==="failed")return [];for(let a of e){let l=E.resolve(t.resolvedPaths.cwd,a);if(!existsSync(l))continue;let h=await promises.readFile(l,"utf-8"),u=await promises.mkdtemp(E.join(tmpdir(),"shadcn-")),c=s.createSourceFile(E.join(u,basename(l)),h,{scriptKind:ScriptKind.TSX});if(![".tsx",".ts",".jsx",".js"].includes(c.getExtension()))continue;let f=await Vs({config:t,content:h,filePaths:r,project:s,projectInfo:i,resolvedPath:l,sourceFile:c,tsConfig:n});f!==h&&(await promises.writeFile(l,f,"utf-8"),o.push(a));}return o}function Vo(e,t,r){return (e??[])?.filter(s=>!!s?.content).map((s,i)=>{let n=Et(s,t,{isSrcDir:r.isSrcDir,framework:r.framework,commonRoot:Ct((e??[]).map(o=>o.path),s.path),path:r.path,fileIndex:i});return n?(t.tsx||(n=n.replace(/\.tsx?$/,o=>o===".tsx"?".jsx":".js")),E.relative(t.resolvedPaths.cwd,n)):null}).filter(s=>!!s)}async function Vs({content:e,resolvedPath:t,filePaths:r,config:s,projectInfo:i,tsConfig:n,project:o,sourceFile:a}){if(!i||n.resultType==="failed")return e;let l=E.extname(t);if(![".tsx",".ts",".jsx",".js"].includes(l))return e;let h=a===void 0?o.createSourceFile(E.join(tmpdir(),`shadcn-${Math.random().toString(36).slice(2)}${l||".tsx"}`),e,{scriptKind:ScriptKind.TSX,overwrite:true}):null,u=a??h;try{let c=!1;for(let f of u.getImportDeclarations()){let p=f.getModuleSpecifierValue();if(!Ft(p,i.aliasPrefix??null))continue;let d=await zo(p,r,s,n);if(!d)continue;let m=Uo(d,s,i,t);!m||m===p||(f.setModuleSpecifier(m),c=!0);}return c?u.getFullText():e}finally{h&&o.removeSourceFile(h);}}async function zo(e,t,r,s){let i=(await We(e,{...s,cwd:r.resolvedPaths.cwd}))?.path,n=!i&&!e.startsWith(".")?Bo(e,r):null;return !i&&!n?null:Ko(i??n,t,r)}function Ko(e,t,r,s=[".tsx",".ts",".js",".jsx",".css"]){let i=E.normalize(r.resolvedPaths.cwd),n=t.map(g=>g.split(E.sep).join(E.posix.sep)),o=new Set(n),a=E.extname(e),l=a!=="",h=l?e.slice(0,-a.length):e,c=E.relative(i,h).split(E.sep).join(E.posix.sep),f=l?[a]:s,p=new Set;for(let g of f){let x=h+g,y=E.posix.normalize(E.relative(i,x));(o.has(y)||existsSync(x))&&p.add(y);let w=E.join(h,`index${g}`),v=E.posix.normalize(E.relative(i,w));(o.has(v)||existsSync(w))&&p.add(v);}let d=E.basename(h);for(let g of n)f.some(x=>g.endsWith(`/${d}${x}`))&&p.add(g);return p.size===0?null:Array.from(p).sort((g,x)=>{let y=E.posix.extname(g),w=E.posix.extname(x),v=f.indexOf(y)-f.indexOf(w);if(v!==0)return v;let b=c&&g.startsWith(c)?-1:1,C=c&&x.startsWith(c)?-1:1;return b-C})[0]}function Uo(e,t,r,s){let i=E.normalize(E.join(t.resolvedPaths.cwd,e)),n=Object.entries(t.resolvedPaths).filter(([d,m])=>{if(!m||_o.has(d))return false;let g=E.normalize(m);if(i===g){let x=t.aliases[d];if(typeof x!="string"||!x.startsWith("#"))return true;let y=De(x,t.resolvedPaths.cwd);return y!==null&&!y.matchedAlias.includes("*")}return i.startsWith(E.normalize(m+E.sep))}).sort((d,m)=>m[1].length-d[1].length);if(n.length===0)return null;let[o,a]=n[0],l=E.relative(a,i);l=l.split(E.sep).join("/");let h=o==="cwd"?r.aliasPrefix:t.aliases[o];if(!h)return null;if(h.startsWith("#")){let d=De(h,t.resolvedPaths.cwd);if(d)return qo(h,l,d)??(s?Ho(s,i):null)}let u=E.posix.extname(l),c=Vt.includes(u)?"":u,f=l.slice(0,l.length-u.length);f.endsWith("/index")&&(f=f.slice(0,-6));let p=f===""?"":`/${f}`;return p=p.replace("/src",""),`${h}${p}${c}`}function qo(e,t,r){let s=E.posix.extname(t),i=Vt.includes(s)&&r.emitMode==="strip_extension"?"":s,n=t?t.slice(0,t.length-s.length)+i:"";return r.matchedAlias.includes("*")?n?`${e}/${n}`:e:n===""||n==="index"?e:null}function Bo(e,t){let r=Go(t);for(let s of r){if(e===s.alias||e===s.canonical)return s.rootPath;if(e.startsWith(`${s.alias}/`))return E.join(s.rootPath,e.slice(s.alias.length+1));if(e.startsWith(`${s.canonical}/`))return E.join(s.rootPath,e.slice(s.canonical.length+1))}return null}function Go(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 Ho(e,t){let r=E.relative(E.dirname(e),t);r=r.split(E.sep).join("/");let s=E.posix.extname(r),i=Vt.includes(s)?"":s,n=r.slice(0,r.length-s.length);return n.endsWith("/index")&&(n=n.slice(0,-6)),n.startsWith(".")||(n=`./${n}`),`${n}${i}`}function Ms(e,t,r){let s=e===E.join(r.resolvedPaths.cwd,"middleware.ts")||e===E.join(r.resolvedPaths.cwd,"middleware.js"),i=t?.framework.name==="next-app"||t?.framework.name==="next-pages";if(!s||!i||!t?.frameworkVersion)return false;let n=parseInt(t.frameworkVersion.split(".")[0]);return !isNaN(n)&&n>=16}new Project({compilerOptions:{}});function W(e){try{return new URL(e),!0}catch{return false}}function Se(e){return e.endsWith(".json")&&!W(e)}function Np(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 Ks(e,t){if(!Yo(t))return z$1.array(g$1).parse(e.flat().filter(Boolean));let r=await X(t.resolvedPaths.cwd),s=new Map,i=z$1.array(g$1).parse(e.flat().filter(Boolean));return i.forEach(n=>{let o=Et(n,t,{isSrcDir:r?.isSrcDir,framework:r?.framework.name,commonRoot:Ct(i.map(a=>a.path),n.path)});o&&s.set(o,n);}),Array.from(s.values())}function Yo(e){return !!(e?.resolvedPaths?.cwd&&(e?.resolvedPaths?.ui||e?.resolvedPaths?.lib||e?.resolvedPaths?.components||e?.resolvedPaths?.hooks))}function Zo(e){return e.style?e.style==="new-york"&&e.tailwind?.config===""?tt:e.style:tt}function ke(e){let t=vs({style:tt,registries:D});return e?d$1.parse(Te(t,{...e,style:Zo(e),registries:{...D,...e.registries}})):t}var kt={headers:{}};function Ke(e){kt.headers={...kt.headers,...e};}function Us(e){return kt.headers[e]||{}}function Ue(){kt.headers={};}function Qo(e){let t=new Set;return typeof e=="string"?Ae(e).forEach(r=>t.add(r)):(Ae(e.url).forEach(r=>t.add(r)),e.params&&Object.values(e.params).forEach(r=>{Ae(r).forEach(s=>t.add(s));}),e.headers&&Object.values(e.headers).forEach(r=>{Ae(r).forEach(s=>t.add(s));})),Array.from(t)}function qs(e,t){let s=Qo(t).filter(i=>!process.env[i]);if(s.length>0)throw new Ne(e,s)}function Yp(e,t){for(let r of e)Re(r,ke(t));Ue();}var Bs="{name}",Rt="{style}",Gs=/\${(\w+)}/g,Hs="?",ea="&";function ta(e){return e.startsWith("./")||e.startsWith("/")}function Re(e,t){let{registry:r,item:s}=ve(e);if(!r){if(W(e)||Se(e)||ta(e))return null;r="@shadcn";}let n={...D,...t?.registries}[r];if(!n)throw new te(r);return qs(r,n),{url:ra(s,n,t),headers:sa(n)}}function ra(e,t,r){if(typeof t=="string"){let i=t.replace(Bs,e);return r?.style&&i.includes(Rt)&&(i=i.replace(Rt,r.style)),$e(i)}let s=t.url.replace(Bs,e);return r?.style&&s.includes(Rt)&&(s=s.replace(Rt,r.style)),s=$e(s),t.params?ia(s,t.params):s}function sa(e){if(typeof e=="string"||!e.headers)return {};let t={};for(let[r,s]of Object.entries(e.headers)){let i=$e(s);na(s,i)&&(t[r]=i);}return t}function ia(e,t){let r=new URLSearchParams;for(let[n,o]of Object.entries(t)){let a=$e(o);a&&r.append(n,a);}let s=r.toString();if(!s)return e;let i=e.includes(Hs)?ea:Hs;return `${e}${i}${s}`}function na(e,t){let r=t.trim();if(!r)return false;if(e.includes("${")&&e.match(Gs)){let i=e.replace(Gs,"").trim();return r!==i}return true}function Tt(e){if(W(e)){let t=new URL(e);return t.pathname.match(/\/chat\/b\//)&&!t.pathname.endsWith("/json")&&(t.pathname=`${t.pathname}/json`),t.toString()}return `${he}/${e}`}var ha=process.env.https_proxy?new HttpsProxyAgent(process.env.https_proxy):void 0,zt=new Map;async function O(e,t={}){t={useCache:true,...t};try{return await Promise.all(e.map(async s=>{let i=Tt(s);if(t.useCache&&zt.has(i))return zt.get(i);let n=(async()=>{let o=Us(i),a=new Headers({Accept:"application/vnd.shadcn.v1+json, application/json;q=0.9","User-Agent":"shadcn"});for(let[h,u]of Object.entries(o))a.set(h,u);let l=await ca(i,{agent:ha,headers:a});if(!l.ok){let h;if(l.headers.get("content-type")?.includes("application/json")){let u=await l.json(),c=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);c.success&&(h=c.data.detail||c.data.message,c.data.error&&(h=`[${c.data.error}] ${h}`));}throw l.status===401?new Oe(i,h):l.status===404?new pe(i,h):l.status===410?new rt(i,h):l.status===403?new _e(i,h):new je(i,l.status,h)}return l.json()})();return t.useCache&&zt.set(i,n),n}))}catch(r){throw r}}async function Ys(e){try{let t=e;e.startsWith("~/")&&(t=E.join(homedir(),e.slice(2)));let r=E.resolve(t),s=await promises.readFile(r,"utf8"),i=JSON.parse(s);try{return n.parse(i)}catch(n){throw new j(e,n)}}catch(t){throw t instanceof Error&&(t.message.includes("ENOENT")||t.message.includes("no such file"))?new xe(e,t):t instanceof j?t:new xe(e,t)}}async function If(e,t,r){if(!e||(r={silent:false,tailwindVersion:"v3",...r},r.tailwindVersion==="v4"))return;let s=E.relative(t.resolvedPaths.cwd,t.resolvedPaths.tailwindConfig),i=de(`Updating ${I.info(s)}`,{silent:r.silent}).start(),n=await promises.readFile(t.resolvedPaths.tailwindConfig,"utf8"),o=await ya(n,e,t);await promises.writeFile(t.resolvedPaths.tailwindConfig,o,"utf8"),i?.succeed();}async function ya(e,t,r){let s=await Zs(e,r),i=s.getDescendantsOfKind(SyntaxKind.ObjectLiteralExpression).find(o=>o.getProperties().some(a=>a.isKind(SyntaxKind.PropertyAssignment)&&a.getName()==="content"));if(!i)return e;let n=ba(i);return wa(i,{name:"darkMode",value:"class"},{quoteChar:n}),t.plugins?.forEach(o=>{va(i,o);}),t.theme&&await xa(i,t.theme),s.getFullText()}function wa(e,t,{quoteChar:r}){let s=e.getProperty("darkMode");if(!s){let i={name:t.name,initializer:`[${r}${t.value}${r}]`};return t.name==="darkMode"?(e.insertPropertyAssignment(0,i),e):(e.addPropertyAssignment(i),e)}if(s.isKind(SyntaxKind.PropertyAssignment)){let i=s.getInitializer(),n=`${r}${t.value}${r}`;if(i?.isKind(SyntaxKind.StringLiteral)){let o=i.getText();return i.replaceWithText(`[${o}, ${n}]`),e}if(i?.isKind(SyntaxKind.ArrayLiteralExpression)){if(i.getElements().map(o=>o.getText()).includes(n))return e;i.addElement(n);}return e}return e}async function xa(e,t){e.getProperty("theme")||e.addPropertyAssignment({name:"theme",initializer:"{}"}),Ut(e);let s=(e.getPropertyOrThrow("theme")?.asKindOrThrow(SyntaxKind.PropertyAssignment)).getInitializer();if(s?.isKind(SyntaxKind.ObjectLiteralExpression)){let i=s.getText(),n=await Ea(i),o=Te(n,t,{arrayMerge:(l,h)=>h}),a=da(o).replace(/\'\.\.\.(.*)\'/g,"...$1").replace(/\'\"/g,"'").replace(/\"\'/g,"'").replace(/\'\[/g,"[").replace(/\]\'/g,"]").replace(/\'\\\'/g,"'").replace(/\\\'/g,"'").replace(/\\\'\'/g,"'").replace(/\'\'/g,"'");s.replaceWithText(a);}qt(e);}function va(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(i=>i.getText().replace(/["']/g,"")).includes(t.replace(/["']/g,"")))return e;s.addElement(t);}return e}return e}async function Zs(e,t){let r=await promises.mkdtemp(E.join(tmpdir(),"shadcn-")),s=t?.resolvedPaths?.tailwindConfig||"tailwind.config.ts",i=E.join(r,`shadcn-${E.basename(s)}`);return new Project({compilerOptions:{}}).createSourceFile(i,e,{scriptKind:E.extname(s)===".ts"?ScriptKind.TS:ScriptKind.JS})}function ba(e){return e.getFirstDescendantByKind(SyntaxKind.StringLiteral)?.getQuoteKind()===QuoteKind.Single?"'":'"'}function Ut(e){let t=e.getProperties();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.SpreadAssignment)){let i=s.asKindOrThrow(SyntaxKind.SpreadAssignment),n=i.getExpression().getText();e.insertPropertyAssignment(r,{name:`"___${n.replace(/^\.\.\./,"")}"`,initializer:`"...${n.replace(/^\.\.\./,"")}"`}),i.remove();}else if(s.isKind(SyntaxKind.PropertyAssignment)){let n=s.asKindOrThrow(SyntaxKind.PropertyAssignment).getInitializer();n&&n.isKind(SyntaxKind.ObjectLiteralExpression)?Ut(n.asKindOrThrow(SyntaxKind.ObjectLiteralExpression)):n&&n.isKind(SyntaxKind.ArrayLiteralExpression)&&Qs(n.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function Qs(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))Ut(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))Qs(s.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));else if(s.isKind(SyntaxKind.SpreadElement)){let i=s.getText();e.removeElement(r),e.insertElement(r,`"${i}"`);}}}function qt(e){let t=e.getProperties();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.PropertyAssignment)){let i=s,n=i.getInitializer();if(n&&n.isKind(SyntaxKind.StringLiteral)){let o=n.asKindOrThrow(SyntaxKind.StringLiteral).getLiteralValue();o.startsWith("...")&&(e.insertSpreadAssignment(r,{expression:o.slice(3)}),i.remove());}else n?.isKind(SyntaxKind.ObjectLiteralExpression)?qt(n):n&&n.isKind(SyntaxKind.ArrayLiteralExpression)&&ei(n.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));}}}function ei(e){let t=e.getElements();for(let r=0;r<t.length;r++){let s=t[r];if(s.isKind(SyntaxKind.ObjectLiteralExpression))qt(s.asKindOrThrow(SyntaxKind.ObjectLiteralExpression));else if(s.isKind(SyntaxKind.ArrayLiteralExpression))ei(s.asKindOrThrow(SyntaxKind.ArrayLiteralExpression));else if(s.isKind(SyntaxKind.StringLiteral)){let i=s.getText(),n=/(?:^['"])(\.\.\..*)(?:['"]$)/g;n.test(i)&&(e.removeElement(r),e.insertElement(r,i.replace(n,"$1")));}}}async function Ea(e){let r=(await Zs(`const theme = ${e}`,null)).getStatements()[0];if(r?.getKind()===SyntaxKind.VariableStatement){let i=(r.getDeclarationList()?.getDeclarations()[0]).getInitializer();if(i?.isKind(SyntaxKind.ObjectLiteralExpression))return await Pt(i)}throw new Error("Invalid input: not an object literal")}function Pt(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]=Pt(r.getInitializer()):r.getInitializer()?.isKind(SyntaxKind.ArrayLiteralExpression)?t[s]=ti(r.getInitializer()):t[s]=Bt(r.getInitializer());}return t}function ti(e){let t=[];for(let r of e.getElements())r.isKind(SyntaxKind.ObjectLiteralExpression)?t.push(Pt(r.asKindOrThrow(SyntaxKind.ObjectLiteralExpression))):r.isKind(SyntaxKind.ArrayLiteralExpression)?t.push(ti(r.asKindOrThrow(SyntaxKind.ArrayLiteralExpression))):t.push(Bt(r));return t}function Bt(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(Bt);case SyntaxKind.ObjectLiteralExpression:return Pt(e);default:return e.getText()}}function ri(e){let t={};for(let r of Object.keys(e)){let s=r.split("-"),i=s[0],n=s.slice(1).join("-");n===""?typeof t[i]=="object"?t[i].DEFAULT=`hsl(var(--${r}))`:t[i]=`hsl(var(--${r}))`:(typeof t[i]!="object"&&(t[i]={DEFAULT:`hsl(var(--${i}))`}),t[i][n]=`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 Ge(e,t){let r={},s=[...e];if(!t?.registries)return Ke({}),s;for(let i=0;i<s.length;i++){let n=Re(s[i],t);n&&(s[i]=n.url,Object.keys(n.headers).length>0&&(r[n.url]=n.headers));}return Ke(r),s}async function me(e,t,r={}){return await Promise.all(e.map(async i=>{if(Se(i))return Ys(i);if(W(i)){let[a]=await O([i],r);try{return n.parse(a)}catch(l){throw new j(i,l)}}if(i.startsWith("@")&&t?.registries){let a=Ge([i],t),[l]=await O(a,r);try{return n.parse(l)}catch(h){throw new j(i,h)}}let n$1=`styles/${t?.style??"new-york-v4"}/${i}.json`,[o]=await O([n$1],r);try{return n.parse(o)}catch(a){throw new j(i,a)}}))}m.extend({type:f,_source:z$1.string().optional(),font:l.optional(),config:z$1.any().optional()}).passthrough();async function ii(e,t$1,r={}){r={useCache:true,...r};let s=[],i=[],n$1=[],o=Array.from(new Set(e)),a=await me(o,t$1,r),l=new Map;for(let y=0;y<a.length;y++)a[y]&&l.set(o[y],a[y]);for(let[y,w]of Array.from(l.entries())){let v={...w,_source:y};if(s.push(v),w.registryDependencies){let b=w.registryDependencies;if(t$1?.registries)b=Ge(w.registryDependencies,t$1);else {let T=w.registryDependencies.filter(R=>R.startsWith("@"));if(T.length>0){let{registry:R}=ve(T[0]);throw new te(R)}}let{items:C,registryNames:P}=await He(b,t$1,r,new Set(o));i.push(...C),n$1.push(...P);}}if(s.push(...i),n$1.length>0){let y=Array.from(new Set(n$1)),w=y.filter(b=>!b.startsWith("@")),v=y.filter(b=>b.startsWith("@"));if(v.length>0){let b=await me(v,t$1,r);for(let C=0;C<b.length;C++){let T={...b[C],_source:v[C]};s.push(T);}}if(w.length>0){let b=await pt();if(!b&&s.length===0)return null;if(b){w.includes("index")&&w.unshift("index");let C=[];for(let H of w){let dn=await Sa(H,t$1,r);C.push(...dn);}let P=Array.from(new Set(C)),T=await O(P,r),R=z$1.array(n).parse(T);s.push(...R);}}}if(!s.length)return null;if((o.includes("index")||n$1.includes("index"))&&t$1.tailwind.baseColor){let y=await ka(t$1.tailwind.baseColor,t$1);y&&s.unshift(y);}let h=new Map;s.forEach(y=>{let w=y._source||y.name;h.set(y,w);}),s=Ta(s,h),s.sort((y,w)=>y.type==="registry:theme"&&w.type!=="registry:theme"?-1:y.type!=="registry:theme"&&w.type==="registry:theme"?1:0);let u={};s.forEach(y=>{u=Te(u,y.tailwind??{});});let c={};s.forEach(y=>{c=Te(c,y.cssVars??{});});let f={};s.forEach(y=>{f=Te(f,y.css??{});});let p="";s.forEach(y=>{y.docs&&(p+=`${y.docs}
|
|
34
|
+
`);});let d={};s.forEach(y=>{d=Te(d,y.envVars??{});});let m=await Ks(s.map(y=>y.files??[]),t$1),g=s.filter(y=>y.type==="registry:font"&&y.font).map(y=>({...y,type:"registry:font",font:y.font})),x=t.parse({dependencies:Te.all(s.map(y=>y.dependencies??[])),devDependencies:Te.all(s.map(y=>y.devDependencies??[])),files:m,tailwind:u,cssVars:c,css:f,docs:p,fonts:g.length>0?g:void 0});return Object.keys(d).length>0&&(x.envVars=d),x}async function He(e,t,r={},s=new Set){let i=[],n=[];for(let o of e)if(!s.has(o)){if(s.add(o),W(o)||Se(o)){let[a]=await me([o],t,r);if(a&&(i.push(a),a.registryDependencies)){let l=t?.registries?Ge(a.registryDependencies,t):a.registryDependencies,h=await He(l,t,r,s);i.push(...h.items),n.push(...h.registryNames);}}else if(o.startsWith("@")&&t?.registries){let{registry:a}=ve(o);if(a&&!(a in t.registries))throw new te(a);let[l]=await me([o],t,r);if(l&&(i.push(l),l.registryDependencies)){let h=t?.registries?Ge(l.registryDependencies,t):l.registryDependencies,u=await He(h,t,r,s);i.push(...u.items),n.push(...u.registryNames);}}else if(n.push(o),t)try{let[a]=await me([o],t,r);if(a&&a.registryDependencies){let l=t?.registries?Ge(a.registryDependencies,t):a.registryDependencies,h=await He(l,t,r,s);i.push(...h.items),n.push(...h.registryNames);}}catch{}}return {items:i,registryNames:n}}async function Sa(e,t,r={}){if(W(e))return [e];let{registryNames:s}=await He([e],t,r,new Set),i=t.resolvedPaths?.cwd?await xs(t.resolvedPaths.cwd,t.style):t.style,n=s.map(o=>Tt(W(o)?o:`styles/${i}/${o}.json`));return Array.from(new Set(n))}async function ka(e,t){let[r,s]=await Promise.all([St(e),mt(t)]);if(!r)return null;let i={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&&(i.tailwind.config.theme.extend.colors={...i.tailwind.config.theme.extend.colors,...ri(r.cssVars.dark??{})},i.cssVars={theme:{...r.cssVars.theme,...i.cssVars.theme},light:{...r.cssVars.light,...i.cssVars.light},dark:{...r.cssVars.dark,...i.cssVars.dark}},s==="v4"&&r.cssVarsV4&&(i.cssVars={theme:{...r.cssVarsV4.theme,...i.cssVars.theme},light:{radius:"0.625rem",...r.cssVarsV4.light},dark:{...r.cssVarsV4.dark}})),i}function ae(e,t){let r=t||e.name,s=createHash("sha256").update(r).digest("hex").substring(0,8);return `${e.name}::${s}`}function Ra(e){if(W(e)){let s=new URL(e).pathname,i=s.match(/\/([^/]+)\.json$/),n=i?i[1]:E.basename(s,".json");return {name:n,hash:ae({name:n},e)}}if(Se(e)){let r=e.match(/\/([^/]+)\.json$/),s=r?r[1]:E.basename(e,".json");return {name:s,hash:ae({name:s},e)}}let{item:t}=ve(e);return {name:t,hash:ae({name:t},e)}}function Ta(e,t){let r=new Map,s=new Map,i=new Map,n=new Map;e.forEach(h=>{let u=t.get(h)||h.name,c=ae(h,u);r.set(c,h),s.set(c,h),i.set(c,0),n.set(c,[]);});let o=new Map;e.forEach(h=>{let u=t.get(h)||h.name,c=ae(h,u);o.has(h.name)||o.set(h.name,[]),o.get(h.name).push(c),u!==h.name&&(o.has(u)||o.set(u,[]),o.get(u).push(c));}),e.forEach(h=>{let u=t.get(h)||h.name,c=ae(h,u);h.registryDependencies&&h.registryDependencies.forEach(f=>{let p,d=o.get(f)||[];if(d.length===1)p=d[0];else if(d.length>1)p=d[0];else {let{name:m}=Ra(f),g=o.get(m)||[];g.length>0&&(p=g[0]);}p&&r.has(p)&&(n.get(p).push(c),i.set(c,i.get(c)+1));});});let a=[],l=[];for(i.forEach((h,u)=>{h===0&&a.push(u);});a.length>0;){let h=a.shift(),u=r.get(h);l.push(u),n.get(h).forEach(c=>{let f=i.get(c)-1;i.set(c,f),f===0&&a.push(c);});}if(l.length!==e.length){let h=new Set(l.map(u=>{let c=t.get(u)||u.name;return ae(u,c)}));e.forEach(u=>{let c=t.get(u)||u.name,f=ae(u,c);h.has(f)||l.push(u);});}return l}var Ht=["npm","yarn","yarn@berry","pnpm","pnpm@6","bun","deno"],Jt={"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"},Yt={"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"},ni={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 Xt(e,t){try{let r=await ai.stat(e);return t==="file"?r.isFile():r.isDirectory()}catch{return false}}function*Ia(e=B.cwd()){let t=E.resolve(e),{root:r}=E.parse(t);for(;t&&t!==r;)yield t,t=E.dirname(t);}async function oi(e,t){return !e||!Xt(e,"file")?null:await Aa(e,t)}async function Zt(e={}){let{cwd:t,strategies:r=["lockfile","packageManager-field","devEngines-field"],onUnknown:s}=e,i;if(typeof e.stopDir=="string"){let n=E.resolve(e.stopDir);i=o=>o===n;}else i=e.stopDir;for(let n of Ia(t)){for(let o of r)switch(o){case "lockfile":{for(let a of Object.keys(Jt))if(await Xt(E.join(n,a),"file")){let l=Jt[a],h=await oi(E.join(n,"package.json"),s);return h||{name:l,agent:l}}break}case "packageManager-field":case "devEngines-field":{let a=await oi(E.join(n,"package.json"),s);if(a)return a;break}case "install-metadata":{for(let a of Object.keys(Yt)){let l=a.endsWith("/")?"dir":"file";if(await Xt(E.join(n,a),l)){let h=Yt[a],u=h==="yarn"?Oa(a)?"yarn":"yarn@berry":h;return {name:h,agent:u}}}break}}if(i?.(n))break}return null}function $a(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 Aa(e,t){try{let r=JSON.parse(await ai.readFile(e,"utf8")),s,i=$a(r);if(i){let n=i.name,o=i.ver,a=o;return n==="yarn"&&o&&Number.parseInt(o)>1?(s="yarn@berry",a="berry",{name:n,agent:s,version:a}):n==="pnpm"&&o&&Number.parseInt(o)<7?(s="pnpm@6",{name:n,agent:s,version:a}):Ht.includes(n)?(s=n,{name:n,agent:s,version:a}):t?.(r.packageManager)??null}}catch{}return null}function Oa(e){return e.endsWith(".yarn_integrity")}var Pe=createRequire(import.meta.url),ja=Object.create,hi=Object.defineProperty,Na=Object.getOwnPropertyDescriptor,Ma=Object.getOwnPropertyNames,La=Object.getPrototypeOf,Fa=Object.prototype.hasOwnProperty,ce=(e=>typeof Pe<"u"?Pe:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof Pe<"u"?Pe:t)[r]}):e)(function(e){if(typeof Pe<"u")return Pe.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),F=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Da=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ma(t))!Fa.call(e,i)&&i!==r&&hi(e,i,{get:()=>t[i],enumerable:!(s=Na(t,i))||s.enumerable});return e},Wa=(e,t,r)=>(r=e!=null?ja(La(e)):{},Da(hi(r,"default",{value:e,enumerable:true}),e)),Va=F((e,t)=>{t.exports=n,n.sync=o;var r=ce("fs");function s(a,l){var h=l.pathExt!==void 0?l.pathExt:process.env.PATHEXT;if(!h||(h=h.split(";"),h.indexOf("")!==-1))return true;for(var u=0;u<h.length;u++){var c=h[u].toLowerCase();if(c&&a.substr(-c.length).toLowerCase()===c)return true}return false}function i(a,l,h){return !a.isSymbolicLink()&&!a.isFile()?false:s(l,h)}function n(a,l,h){r.stat(a,function(u,c){h(u,u?false:i(c,a,l));});}function o(a,l){return i(r.statSync(a),a,l)}}),za=F((e,t)=>{t.exports=s,s.sync=i;var r=ce("fs");function s(a,l,h){r.stat(a,function(u,c){h(u,u?false:n(c,l));});}function i(a,l){return n(r.statSync(a),l)}function n(a,l){return a.isFile()&&o(a,l)}function o(a,l){var h=a.mode,u=a.uid,c=a.gid,f=l.uid!==void 0?l.uid:process.getuid&&process.getuid(),p=l.gid!==void 0?l.gid:process.getgid&&process.getgid(),d=parseInt("100",8),m=parseInt("010",8),g=parseInt("001",8),x=d|m,y=h&g||h&m&&c===p||h&d&&u===f||h&x&&f===0;return y}}),Ka=F((e,t)=>{ce("fs");var s;process.platform==="win32"||global.TESTING_WINDOWS?s=Va():s=za(),t.exports=i,i.sync=n;function i(o,a,l){if(typeof a=="function"&&(l=a,a={}),!l){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(h,u){i(o,a||{},function(c,f){c?u(c):h(f);});})}s(o,a||{},function(h,u){h&&(h.code==="EACCES"||a&&a.ignoreErrors)&&(h=null,u=false),l(h,u);});}function n(o,a){try{return s.sync(o,a||{})}catch(l){if(a&&a.ignoreErrors||l.code==="EACCES")return false;throw l}}}),Ua=F((e,t)=>{var r=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",s=ce("path"),i=r?";":":",n=Ka(),o=u=>Object.assign(new Error(`not found: ${u}`),{code:"ENOENT"}),a=(u,c)=>{let f=c.colon||i,p=u.match(/\//)||r&&u.match(/\\/)?[""]:[...r?[process.cwd()]:[],...(c.path||process.env.PATH||"").split(f)],d=r?c.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",m=r?d.split(f):[""];return r&&u.indexOf(".")!==-1&&m[0]!==""&&m.unshift(""),{pathEnv:p,pathExt:m,pathExtExe:d}},l=(u,c,f)=>{typeof c=="function"&&(f=c,c={}),c||(c={});let{pathEnv:p,pathExt:d,pathExtExe:m}=a(u,c),g=[],x=w=>new Promise((v,b)=>{if(w===p.length)return c.all&&g.length?v(g):b(o(u));let C=p[w],P=/^".*"$/.test(C)?C.slice(1,-1):C,T=s.join(P,u),R=!P&&/^\.[\\\/]/.test(u)?u.slice(0,2)+T:T;v(y(R,w,0));}),y=(w,v,b)=>new Promise((C,P)=>{if(b===d.length)return C(x(v+1));let T=d[b];n(w+T,{pathExt:m},(R,H)=>{if(!R&&H)if(c.all)g.push(w+T);else return C(w+T);return C(y(w,v,b+1))});});return f?x(0).then(w=>f(null,w),f):x(0)},h=(u,c)=>{c=c||{};let{pathEnv:f,pathExt:p,pathExtExe:d}=a(u,c),m=[];for(let g=0;g<f.length;g++){let x=f[g],y=/^".*"$/.test(x)?x.slice(1,-1):x,w=s.join(y,u),v=!y&&/^\.[\\\/]/.test(u)?u.slice(0,2)+w:w;for(let b=0;b<p.length;b++){let C=v+p[b];try{if(n.sync(C,{pathExt:d}))if(c.all)m.push(C);else return C}catch{}}}if(c.all&&m.length)return m;if(c.nothrow)return null;throw o(u)};t.exports=l,l.sync=h;}),qa=F((e,t)=>{var r=(s={})=>{let i=s.env||process.env;return (s.platform||process.platform)!=="win32"?"PATH":Object.keys(i).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};t.exports=r,t.exports.default=r;}),Ba=F((e,t)=>{var r=ce("path"),s=Ua(),i=qa();function n(a,l){let h=a.options.env||process.env,u=process.cwd(),c=a.options.cwd!=null,f=c&&process.chdir!==void 0&&!process.chdir.disabled;if(f)try{process.chdir(a.options.cwd);}catch{}let p;try{p=s.sync(a.command,{path:h[i({env:h})],pathExt:l?r.delimiter:void 0});}catch{}finally{f&&process.chdir(u);}return p&&(p=r.resolve(c?a.options.cwd:"",p)),p}function o(a){return n(a)||n(a,true)}t.exports=o;}),Ga=F((e,t)=>{var r=/([()\][%!^"`<>&|;, *?])/g;function s(n){return n=n.replace(r,"^$1"),n}function i(n,o){return n=`${n}`,n=n.replace(/(\\*)"/g,'$1$1\\"'),n=n.replace(/(\\*)$/,"$1$1"),n=`"${n}"`,n=n.replace(r,"^$1"),o&&(n=n.replace(r,"^$1")),n}t.exports.command=s,t.exports.argument=i;}),Ha=F((e,t)=>{t.exports=/^#!(.*)/;}),Ja=F((e,t)=>{var r=Ha();t.exports=(s="")=>{let i=s.match(r);if(!i)return null;let[n,o]=i[0].replace(/#! ?/,"").split(" "),a=n.split("/").pop();return a==="env"?o:o?`${a} ${o}`:a};}),Ya=F((e,t)=>{var r=ce("fs"),s=Ja();function i(n){let o=Buffer.alloc(150),a;try{a=r.openSync(n,"r"),r.readSync(a,o,0,150,0),r.closeSync(a);}catch{}return s(o.toString())}t.exports=i;}),Xa=F((e,t)=>{var r=ce("path"),s=Ba(),i=Ga(),n=Ya(),o=process.platform==="win32",a=/\.(?:com|exe)$/i,l=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function h(f){f.file=s(f);let p=f.file&&n(f.file);return p?(f.args.unshift(f.file),f.command=p,s(f)):f.file}function u(f){if(!o)return f;let p=h(f),d=!a.test(p);if(f.options.forceShell||d){let m=l.test(p);f.command=r.normalize(f.command),f.command=i.command(f.command),f.args=f.args.map(x=>i.argument(x,m));let g=[f.command].concat(f.args).join(" ");f.args=["/d","/s","/c",`"${g}"`],f.command=process.env.comspec||"cmd.exe",f.options.windowsVerbatimArguments=true;}return f}function c(f,p,d){p&&!Array.isArray(p)&&(d=p,p=null),p=p?p.slice(0):[],d=Object.assign({},d);let m={command:f,args:p,options:d,file:void 0,original:{command:f,args:p}};return d.shell?m:u(m)}t.exports=c;}),Za=F((e,t)=>{var r=process.platform==="win32";function s(a,l){return Object.assign(new Error(`${l} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${l} ${a.command}`,path:a.command,spawnargs:a.args})}function i(a,l){if(!r)return;let h=a.emit;a.emit=function(u,c){if(u==="exit"){let f=n(c,l);if(f)return h.call(a,"error",f)}return h.apply(a,arguments)};}function n(a,l){return r&&a===1&&!l.file?s(l.original,"spawn"):null}function o(a,l){return r&&a===1&&!l.file?s(l.original,"spawnSync"):null}t.exports={hookChildProcess:i,verifyENOENT:n,verifyENOENTSync:o,notFoundError:s};}),Qa=F((e,t)=>{var r=ce("child_process"),s=Xa(),i=Za();function n(a,l,h){let u=s(a,l,h),c=r.spawn(u.command,u.args,u.options);return i.hookChildProcess(c,u),c}function o(a,l,h){let u=s(a,l,h),c=r.spawnSync(u.command,u.args,u.options);return c.error=c.error||i.verifyENOENTSync(c.status,u),c}t.exports=n,t.exports.spawn=n,t.exports.sync=o,t.exports._parse=s,t.exports._enoent=i;}),nl=/^path$/i,ci={key:"PATH",value:""};function ol(e){for(let t in e){if(!Object.prototype.hasOwnProperty.call(e,t)||!nl.test(t))continue;let r=e[t];return r?{key:t,value:r}:ci}return ci}function al(e,t){let r=t.value.split(delimiter),s=e,i;do r.push(resolve(s,"node_modules",".bin")),i=s,s=dirname(s);while(s!==i);return {key:t.key,value:r.join(delimiter)}}function ll(e,t){let r={...process.env,...t},s=al(e,ol(r));return r[s.key]=s.value,r}var ul=e=>{let t=e.length,r=new PassThrough,s=()=>{--t===0&&r.emit("end");};for(let i of e)i.pipe(r,{end:false}),i.on("end",s);return r},hl=Wa(Qa()),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;}},fl={timeout:void 0,persist:false},dl={windowsHide:true};function ml(e,t){return {command:normalize(e),args:t??[]}}function gl(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 yl=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={...fl,...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 wl(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=ul(t),s=pl.createInterface({input:r});for await(let i of s)yield i.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 i of this._streamOut)r+=i.toString();if(this._streamErr)for await(let i of this._streamErr)t+=i.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={...dl,...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=gl(s)),r.env=ll(e,r.env);let{command:i,args:n}=ml(this._command,this._args),o=(0, hl._parse)(i,n,r),a=spawn(o.command,o.args,o.options);if(a.stderr&&(this._streamErr=a.stderr),a.stdout&&(this._streamOut=a.stdout),this._process=a,a.once("error",this._onError),a.once("close",this._onClose),t.stdin!==void 0&&a.stdin&&t.stdin.process){let{stdout:l}=t.stdin.process;l&&l.pipe(a.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();}},Qt=(e,t,r)=>{let s=new yl(e,t,r);return s.spawn(),s},wl=Qt;function Vr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tr={},rr,fi;function K(){if(fi)return rr;fi=1;let e,t,r,s,i=true;typeof process<"u"&&({FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:r,TERM:s}=process.env||{},i=process.stdout&&process.stdout.isTTY);let n={enabled:!t&&r==null&&s!=="dumb"&&(e!=null&&e!=="0"||i),reset:l(0,0),bold:l(1,22),dim:l(2,22),italic:l(3,23),underline:l(4,24),inverse:l(7,27),hidden:l(8,28),strikethrough:l(9,29),black:l(30,39),red:l(31,39),green:l(32,39),yellow:l(33,39),blue:l(34,39),magenta:l(35,39),cyan:l(36,39),white:l(37,39),gray:l(90,39),grey:l(90,39),bgBlack:l(40,49),bgRed:l(41,49),bgGreen:l(42,49),bgYellow:l(43,49),bgBlue:l(44,49),bgMagenta:l(45,49),bgCyan:l(46,49),bgWhite:l(47,49)};function o(h,u){let c=0,f,p="",d="";for(;c<h.length;c++)f=h[c],p+=f.open,d+=f.close,~u.indexOf(f.close)&&(u=u.replace(f.rgx,f.close+f.open));return p+u+d}function a(h,u){let c={has:h,keys:u};return c.reset=n.reset.bind(c),c.bold=n.bold.bind(c),c.dim=n.dim.bind(c),c.italic=n.italic.bind(c),c.underline=n.underline.bind(c),c.inverse=n.inverse.bind(c),c.hidden=n.hidden.bind(c),c.strikethrough=n.strikethrough.bind(c),c.black=n.black.bind(c),c.red=n.red.bind(c),c.green=n.green.bind(c),c.yellow=n.yellow.bind(c),c.blue=n.blue.bind(c),c.magenta=n.magenta.bind(c),c.cyan=n.cyan.bind(c),c.white=n.white.bind(c),c.gray=n.gray.bind(c),c.grey=n.grey.bind(c),c.bgBlack=n.bgBlack.bind(c),c.bgRed=n.bgRed.bind(c),c.bgGreen=n.bgGreen.bind(c),c.bgYellow=n.bgYellow.bind(c),c.bgBlue=n.bgBlue.bind(c),c.bgMagenta=n.bgMagenta.bind(c),c.bgCyan=n.bgCyan.bind(c),c.bgWhite=n.bgWhite.bind(c),c}function l(h,u){let c={open:`\x1B[${h}m`,close:`\x1B[${u}m`,rgx:new RegExp(`\\x1b\\[${u}m`,"g")};return function(f){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(h)||(this.has.push(h),this.keys.push(c)),f===void 0?this:n.enabled?o(this.keys,f+""):f+""):f===void 0?a([h],[c]):n.enabled?o([c],f+""):f+""}}return rr=n,rr}var sr,di;function Pl(){return di||(di=1,sr=(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}}),sr}var ir,mi;function zr(){return mi||(mi=1,ir=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}),ir}var nr,gi;function U(){if(gi)return nr;gi=1;let e="\x1B",t=`${e}[`,r="\x07",s={to(o,a){return a?`${t}${a+1};${o+1}H`:`${t}${o+1}G`},move(o,a){let l="";return o<0?l+=`${t}${-o}D`:o>0&&(l+=`${t}${o}C`),a<0?l+=`${t}${-a}A`:a>0&&(l+=`${t}${a}B`),l},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`},i={up:(o=1)=>`${t}S`.repeat(o),down:(o=1)=>`${t}T`.repeat(o)},n={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 a="";for(let l=0;l<o;l++)a+=this.line+(l<o-1?s.up():"");return o&&(a+=s.left),a}};return nr={cursor:s,scroll:i,erase:n,beep:r},nr}var or,yi;function Il(){if(yi)return or;yi=1;let e=zr(),{erase:t,cursor:r}=U(),s=i=>[...e(i)].length;return or=function(i,n){if(!n)return t.line+r.to(0);let o=0,a=i.split(/\r?\n/);for(let l of a)o+=1+Math.floor(Math.max(s(l)-1,0)/n);return t.lines(o)},or}var ar,wi;function an(){if(wi)return ar;wi=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 ar=process.platform==="win32"?t:e,ar}var lr,xi;function $l(){if(xi)return lr;xi=1;let e=K(),t=an(),r=Object.freeze({password:{scale:1,render:l=>"*".repeat(l.length)},emoji:{scale:2,render:l=>"\u{1F603}".repeat(l.length)},invisible:{scale:0,render:l=>""},default:{scale:1,render:l=>`${l}`}}),s=l=>r[l]||r.default,i=Object.freeze({aborted:e.red(t.cross),done:e.green(t.tick),exited:e.yellow(t.cross),default:e.cyan("?")});return lr={styles:r,render:s,symbols:i,symbol:(l,h,u)=>h?i.aborted:u?i.exited:l?i.done:i.default,delimiter:l=>e.gray(l?t.ellipsis:t.pointerSmall),item:(l,h)=>e.gray(l?h?t.pointerSmall:"+":t.line)},lr}var cr,vi;function Al(){if(vi)return cr;vi=1;let e=zr();return cr=function(t,r){let s=String(e(t)||"").split(/\r?\n/);return r?s.map(i=>Math.ceil(i.length/r)).reduce((i,n)=>i+n):s.length},cr}var ur,bi;function Ol(){return bi||(bi=1,ur=(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(i=>i.split(/\s+/g).reduce((n,o)=>(o.length+r.length>=s||n[n.length-1].length+o.length+1<s?n[n.length-1]+=` ${o}`:n.push(`${r}${o}`),n),[r]).join(`
|
|
35
|
+
`)).join(`
|
|
36
|
+
`)}),ur}var hr,Ei;function _l(){return Ei||(Ei=1,hr=(e,t,r)=>{r=r||t;let s=Math.min(t-r,e-Math.floor(r/2));s<0&&(s=0);let i=Math.min(s+r,t);return {startIndex:s,endIndex:i}}),hr}var pr,Ci;function G(){return Ci||(Ci=1,pr={action:Pl(),clear:Il(),style:$l(),strip:zr(),figures:an(),lines:Al(),wrap:Ol(),entriesToDisplay:_l()}),pr}var fr,Si;function ue(){if(Si)return fr;Si=1;let e=pl,{action:t}=G(),r=El,{beep:s,cursor:i}=U(),n=K();class o extends r{constructor(l={}){super(),this.firstRender=true,this.in=l.stdin||process.stdin,this.out=l.stdout||process.stdout,this.onRender=(l.onRender||(()=>{})).bind(this);let h=e.createInterface({input:this.in,escapeCodeTimeout:50});e.emitKeypressEvents(this.in,h),this.in.isTTY&&this.in.setRawMode(true);let u=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,c=(f,p)=>{let d=t(p,u);d===false?this._&&this._(f,p):typeof this[d]=="function"?this[d](p):this.bell();};this.close=()=>{this.out.write(i.show),this.in.removeListener("keypress",c),this.in.isTTY&&this.in.setRawMode(false),h.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=true;},this.in.on("keypress",c);}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited});}bell(){this.out.write(s);}render(){this.onRender(n),this.firstRender&&(this.firstRender=false);}}return fr=o,fr}var dr,ki;function jl(){if(ki)return dr;ki=1;let e=K(),t=ue(),{erase:r,cursor:s}=U(),{style:i,clear:n,lines:o,figures:a}=G();class l extends t{constructor(u={}){super(u),this.transform=i.render(u.style),this.scale=this.transform.scale,this.msg=u.message,this.initial=u.initial||"",this.validator=u.validate||(()=>true),this.value="",this.errorMsg=u.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=n("",this.out.columns),this.render();}set value(u){!u&&this.initial?(this.placeholder=true,this.rendered=e.gray(this.transform.render(this.initial))):(this.placeholder=false,this.rendered=this.transform.render(u)),this._value=u,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(`
|
|
37
|
+
`),this.close();}async validate(){let u=await this.validator(this.value);typeof u=="string"&&(this.errorMsg=u,u=false),this.error=!u;}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(`
|
|
38
|
+
`),this.close();}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render();}moveCursor(u){this.placeholder||(this.cursor=this.cursor+u,this.cursorOffset+=u);}_(u,c){let f=this.value.slice(0,this.cursor),p=this.value.slice(this.cursor);this.value=`${f}${u}${p}`,this.red=false,this.cursor=this.placeholder?0:f.length+1,this.render();}delete(){if(this.isCursorAtStart())return this.bell();let u=this.value.slice(0,this.cursor-1),c=this.value.slice(this.cursor);this.value=`${u}${c}`,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 u=this.value.slice(0,this.cursor),c=this.value.slice(this.cursor+1);this.value=`${u}${c}`,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)+n(this.outputError,this.out.columns)),this.out.write(n(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.delimiter(this.done),this.red?e.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
|
|
39
|
+
`).reduce((u,c,f)=>u+`
|
|
40
|
+
${f?" ":a.pointerSmall} ${e.red().italic(c)}`,"")),this.out.write(r.line+s.to(0)+this.outputText+s.save+this.outputError+s.restore+s.move(this.cursorOffset,0)));}}return dr=l,dr}var mr,Ri;function Nl(){if(Ri)return mr;Ri=1;let e=K(),t=ue(),{style:r,clear:s,figures:i,wrap:n,entriesToDisplay:o}=G(),{cursor:a}=U();class l extends t{constructor(u={}){super(u),this.msg=u.message,this.hint=u.hint||"- Use arrow-keys. Return to submit.",this.warn=u.warn||"- This option is disabled",this.cursor=u.initial||0,this.choices=u.choices.map((c,f)=>(typeof c=="string"&&(c={title:c,value:f}),{title:c&&(c.title||c.value||c),value:c&&(c.value===void 0?f:c.value),description:c&&c.description,selected:c&&c.selected,disabled:c&&c.disabled})),this.optionsPerPage=u.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=s("",this.out.columns),this.render();}moveCursor(u){this.cursor=u,this.value=this.choices[u].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(`
|
|
41
|
+
`),this.close();}submit(){this.selection.disabled?this.bell():(this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
|
|
42
|
+
`),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();}_(u,c){if(u===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(a.hide):this.out.write(s(this.outputText,this.out.columns)),super.render();let{startIndex:u,endIndex:c}=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+=`
|
|
43
|
+
`;for(let f=u;f<c;f++){let p,d,m="",g=this.choices[f];f===u&&u>0?d=i.arrowUp:f===c-1&&c<this.choices.length?d=i.arrowDown:d=" ",g.disabled?(p=this.cursor===f?e.gray().underline(g.title):e.strikethrough().gray(g.title),d=(this.cursor===f?e.bold().gray(i.pointer)+" ":" ")+d):(p=this.cursor===f?e.cyan().underline(g.title):g.title,d=(this.cursor===f?e.cyan(i.pointer)+" ":" ")+d,g.description&&this.cursor===f&&(m=` - ${g.description}`,(d.length+p.length+m.length>=this.out.columns||g.description.split(/\r?\n/).length>1)&&(m=`
|
|
44
|
+
`+n(g.description,{margin:3,width:this.out.columns})))),this.outputText+=`${d} ${p}${e.gray(m)}
|
|
45
|
+
`;}}this.out.write(this.outputText);}}return mr=l,mr}var gr,Ti;function Ml(){if(Ti)return gr;Ti=1;let e=K(),t=ue(),{style:r,clear:s}=G(),{cursor:i,erase:n}=U();class o extends t{constructor(l={}){super(l),this.msg=l.message,this.value=!!l.initial,this.active=l.active||"on",this.inactive=l.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(`
|
|
46
|
+
`),this.close();}submit(){this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
|
|
47
|
+
`),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();}_(l,h){if(l===" ")this.value=!this.value;else if(l==="1")this.value=true;else if(l==="0")this.value=false;else return this.bell();this.render();}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.value?this.inactive:e.cyan().underline(this.inactive),e.gray("/"),this.value?e.cyan().underline(this.active):this.active].join(" "),this.out.write(n.line+i.to(0)+this.outputText));}}return gr=o,gr}var yr,Pi;function ee(){if(Pi)return yr;Pi=1;class e{constructor({token:r,date:s,parts:i,locales:n}){this.token=r,this.date=s||new Date,this.parts=i||[this],this.locales=n||{};}up(){}down(){}next(){let r=this.parts.indexOf(this);return this.parts.find((s,i)=>i>r&&s instanceof e)}setTo(r){}prev(){let r=[].concat(this.parts).reverse(),s=r.indexOf(this);return r.find((i,n)=>n>s&&i instanceof e)}toString(){return String(this.date)}}return yr=e,yr}var wr,Ii;function Ll(){if(Ii)return wr;Ii=1;let e=ee();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 wr=t,wr}var xr,$i;function Fl(){if($i)return xr;$i=1;let e=ee(),t=s=>(s=s%10,s===1?"st":s===2?"nd":s===3?"rd":"th");class r extends e{constructor(i={}){super(i);}up(){this.date.setDate(this.date.getDate()+1);}down(){this.date.setDate(this.date.getDate()-1);}setTo(i){this.date.setDate(parseInt(i.substr(-2)));}toString(){let i=this.date.getDate(),n=this.date.getDay();return this.token==="DD"?String(i).padStart(2,"0"):this.token==="Do"?i+t(i):this.token==="d"?n+1:this.token==="ddd"?this.locales.weekdaysShort[n]:this.token==="dddd"?this.locales.weekdays[n]:i}}return xr=r,xr}var vr,Ai;function Dl(){if(Ai)return vr;Ai=1;let e=ee();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 vr=t,vr}var br,Oi;function Wl(){if(Oi)return br;Oi=1;let e=ee();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 br=t,br}var Er,_i;function Vl(){if(_i)return Er;_i=1;let e=ee();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 Er=t,Er}var Cr,ji;function zl(){if(ji)return Cr;ji=1;let e=ee();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(),i=this.token.length;return i===2?String(s+1).padStart(2,"0"):i===3?this.locales.monthsShort[s]:i===4?this.locales.months[s]:String(s+1)}}return Cr=t,Cr}var Sr,Ni;function Kl(){if(Ni)return Sr;Ni=1;let e=ee();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 Sr=t,Sr}var kr,Mi;function Ul(){if(Mi)return kr;Mi=1;let e=ee();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 kr=t,kr}var Rr,Li;function ql(){return Li||(Li=1,Rr={DatePart:ee(),Meridiem:Ll(),Day:Fl(),Hours:Dl(),Milliseconds:Wl(),Minutes:Vl(),Month:zl(),Seconds:Kl(),Year:Ul()}),Rr}var Tr,Fi;function Bl(){if(Fi)return Tr;Fi=1;let e=K(),t=ue(),{style:r,clear:s,figures:i}=G(),{erase:n,cursor:o}=U(),{DatePart:a,Meridiem:l,Day:h,Hours:u,Milliseconds:c,Minutes:f,Month:p,Seconds:d,Year:m}=ql(),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 h(v),3:v=>new p(v),4:v=>new m(v),5:v=>new l(v),6:v=>new u(v),7:v=>new f(v),8:v=>new d(v),9:v=>new c(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 C;for(this.parts=[];C=g.exec(b);){let T=C.shift(),R=C.findIndex(H=>H!=null);this.parts.push(R in x?x[R]({token:C[R]||T,date:this.date,parts:this.parts,locales:this.locales}):C[R]||T);}let P=this.parts.reduce((T,R)=>(typeof R=="string"&&typeof T[T.length-1]=="string"?T[T.length-1]+=R:T.push(R),T),[]);this.parts.splice(0),this.parts.push(...P),this.reset();}moveCursor(b){this.typed="",this.cursor=b,this.fire();}reset(){this.moveCursor(this.parts.findIndex(b=>b instanceof a)),this.fire(),this.render();}exit(){this.abort();}abort(){this.done=this.aborted=true,this.error=false,this.fire(),this.render(),this.out.write(`
|
|
48
|
+
`),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(`
|
|
49
|
+
`),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(C=>C instanceof a)),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,C,P)=>b.concat(P===this.cursor&&!this.done?e.cyan().underline(C.toString()):C),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
|
|
50
|
+
`).reduce((b,C,P)=>b+`
|
|
51
|
+
${P?" ":i.pointerSmall} ${e.red().italic(C)}`,"")),this.out.write(n.line+o.to(0)+this.outputText));}}return Tr=w,Tr}var Pr,Di;function Gl(){if(Di)return Pr;Di=1;let e=K(),t=ue(),{cursor:r,erase:s}=U(),{style:i,figures:n,clear:o,lines:a}=G(),l=/[0-9]/,h=f=>f!==void 0,u=(f,p)=>{let d=Math.pow(10,p);return Math.round(f*d)/d};class c extends t{constructor(p={}){super(p),this.transform=i.render(p.style),this.msg=p.message,this.initial=h(p.initial)?p.initial:"",this.float=!!p.float,this.round=p.round||2,this.inc=p.increment||1,this.min=h(p.min)?p.min:-1/0,this.max=h(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(`${u(p,this.round)}`),this._value=u(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||l.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(`
|
|
52
|
+
`),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(`
|
|
53
|
+
`),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,d){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(a(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=[i.symbol(this.done,this.aborted),e.bold(this.msg),i.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(`
|
|
54
|
+
`).reduce((p,d,m)=>p+`
|
|
55
|
+
${m?" ":n.pointerSmall} ${e.red().italic(d)}`,"")),this.out.write(s.line+r.to(0)+this.outputText+r.save+this.outputError+r.restore));}}return Pr=c,Pr}var Ir,Wi;function ln(){if(Wi)return Ir;Wi=1;let e=K(),{cursor:t}=U(),r=ue(),{clear:s,figures:i,style:n,wrap:o,entriesToDisplay:a}=G();class l extends r{constructor(u={}){super(u),this.msg=u.message,this.cursor=u.cursor||0,this.scrollIndex=u.cursor||0,this.hint=u.hint||"",this.warn=u.warn||"- This option is disabled -",this.minSelected=u.min,this.showMinError=false,this.maxChoices=u.max,this.instructions=u.instructions,this.optionsPerPage=u.optionsPerPage||10,this.value=u.choices.map((c,f)=>(typeof c=="string"&&(c={title:c,value:f}),{title:c&&(c.title||c.value||c),description:c&&c.description,value:c&&(c.value===void 0?f:c.value),selected:c&&c.selected,disabled:c&&c.disabled})),this.clear=s("",this.out.columns),u.overrideRender||this.render();}reset(){this.value.map(u=>!u.selected),this.cursor=0,this.fire(),this.render();}selected(){return this.value.filter(u=>u.selected)}exit(){this.abort();}abort(){this.done=this.aborted=true,this.fire(),this.render(),this.out.write(`
|
|
56
|
+
`),this.close();}submit(){let u=this.value.filter(c=>c.selected);this.minSelected&&u.length<this.minSelected?(this.showMinError=true,this.render()):(this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
|
|
57
|
+
`),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(u=>u.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=true,this.render();}handleSpaceToggle(){let u=this.value[this.cursor];if(u.selected)u.selected=false,this.render();else {if(u.disabled||this.value.filter(c=>c.selected).length>=this.maxChoices)return this.bell();u.selected=true,this.render();}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();let u=!this.value[this.cursor].selected;this.value.filter(c=>!c.disabled).forEach(c=>c.selected=u),this.render();}_(u,c){if(u===" ")this.handleSpaceToggle();else if(u==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
58
|
+
Instructions:
|
|
59
|
+
${i.arrowUp}/${i.arrowDown}: Highlight option
|
|
60
|
+
${i.arrowLeft}/${i.arrowRight}/[space]: Toggle selection
|
|
61
|
+
`+(this.maxChoices===void 0?` a: Toggle all
|
|
62
|
+
`:"")+" enter/return: Complete answer":""}renderOption(u,c,f,p){let d=(c.selected?e.green(i.radioOn):i.radioOff)+" "+p+" ",m,g;return c.disabled?m=u===f?e.gray().underline(c.title):e.strikethrough().gray(c.title):(m=u===f?e.cyan().underline(c.title):c.title,u===f&&c.description&&(g=` - ${c.description}`,(d.length+m.length+g.length>=this.out.columns||c.description.split(/\r?\n/).length>1)&&(g=`
|
|
63
|
+
`+o(c.description,{margin:d.length,width:this.out.columns})))),d+m+e.gray(g||"")}paginateOptions(u){if(u.length===0)return e.red("No matches for this query.");let{startIndex:c,endIndex:f}=a(this.cursor,u.length,this.optionsPerPage),p,d=[];for(let m=c;m<f;m++)m===c&&c>0?p=i.arrowUp:m===f-1&&f<u.length?p=i.arrowDown:p=" ",d.push(this.renderOption(this.cursor,u[m],m,p));return `
|
|
64
|
+
`+d.join(`
|
|
65
|
+
`)}renderOptions(u){return this.done?"":this.paginateOptions(u)}renderDoneOrInstructions(){if(this.done)return this.value.filter(c=>c.selected).map(c=>c.title).join(", ");let u=[e.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&u.push(e.yellow(this.warn)),u.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(t.hide),super.render();let u=[n.symbol(this.done,this.aborted),e.bold(this.msg),n.delimiter(false),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(u+=e.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=false),u+=this.renderOptions(this.value),this.out.write(this.clear+u),this.clear=s(u,this.out.columns);}}return Ir=l,Ir}var $r,Vi;function Hl(){if(Vi)return $r;Vi=1;let e=K(),t=ue(),{erase:r,cursor:s}=U(),{style:i,clear:n,figures:o,wrap:a,entriesToDisplay:l}=G(),h=(p,d)=>p[d]&&(p[d].value||p[d].title||p[d]),u=(p,d)=>p[d]&&(p[d].title||p[d].value||p[d]),c=(p,d)=>{let m=p.findIndex(g=>g.value===d||g.title===d);return m>-1?m:void 0};class f extends t{constructor(d={}){super(d),this.msg=d.message,this.suggest=d.suggest,this.choices=d.choices,this.initial=typeof d.initial=="number"?d.initial:c(d.choices,d.initial),this.select=this.initial||d.cursor||0,this.i18n={noMatches:d.noMatches||"no matches found"},this.fallback=d.fallback||this.initial,this.clearFirst=d.clearFirst||false,this.suggestions=[],this.input="",this.limit=d.limit||10,this.cursor=0,this.transform=i.render(d.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=n("",this.out.columns),this.complete(this.render),this.render();}set fallback(d){this._fb=Number.isSafeInteger(parseInt(d))?parseInt(d):d;}get fallback(){let d;return typeof this._fb=="number"?d=this.choices[this._fb]:typeof this._fb=="string"&&(d={title:this._fb}),d||this._fb||{title:this.i18n.noMatches}}moveSelect(d){this.select=d,this.suggestions.length>0?this.value=h(this.suggestions,d):this.value=this.fallback.value,this.fire();}async complete(d){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:u(v,w),value:h(v,w),description:y.description})),this.completing=false;let x=Math.max(g.length-1,0);this.moveSelect(Math.min(x,this.select)),d&&d();}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(`
|
|
66
|
+
`),this.close());}abort(){this.done=this.aborted=true,this.exited=false,this.fire(),this.render(),this.out.write(`
|
|
67
|
+
`),this.close();}submit(){this.done=true,this.aborted=this.exited=false,this.fire(),this.render(),this.out.write(`
|
|
68
|
+
`),this.close();}_(d,m){let g=this.input.slice(0,this.cursor),x=this.input.slice(this.cursor);this.input=`${g}${d}${x}`,this.cursor=g.length+1,this.complete(this.render),this.render();}delete(){if(this.cursor===0)return this.bell();let d=this.input.slice(0,this.cursor-1),m=this.input.slice(this.cursor);this.input=`${d}${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 d=this.input.slice(0,this.cursor),m=this.input.slice(this.cursor+1);this.input=`${d}${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(d,m,g,x){let y,w=g?o.arrowUp:x?o.arrowDown:" ",v=m?e.cyan().underline(d.title):d.title;return w=(m?e.cyan(o.pointer)+" ":" ")+w,d.description&&(y=` - ${d.description}`,(w.length+v.length+y.length>=this.out.columns||d.description.split(/\r?\n/).length>1)&&(y=`
|
|
69
|
+
`+a(d.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(n(this.outputText,this.out.columns)),super.render();let{startIndex:d,endIndex:m}=l(this.select,this.choices.length,this.limit);if(this.outputText=[i.symbol(this.done,this.aborted,this.exited),e.bold(this.msg),i.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(d,m).map((x,y)=>this.renderOption(x,this.select===y+d,y===0&&d>0,y+d===m-1&&m<this.choices.length)).join(`
|
|
70
|
+
`);this.outputText+=`
|
|
71
|
+
`+(g||e.gray(this.fallback.title));}this.out.write(r.line+s.to(0)+this.outputText);}}return $r=f,$r}var Ar,zi;function Jl(){if(zi)return Ar;zi=1;let e=K(),{cursor:t}=U(),r=ln(),{clear:s,style:i,figures:n}=G();class o extends r{constructor(l={}){l.overrideRender=true,super(l),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(l=>l.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 l=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(u=>this.inputValue?!!(typeof u.title=="string"&&u.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof u.value=="string"&&u.value.toLowerCase().includes(this.inputValue.toLowerCase())):true);let h=this.filteredOptions.findIndex(u=>u===l);this.cursor=h<0?0:h,this.render();}handleSpaceToggle(){let l=this.filteredOptions[this.cursor];if(l.selected)l.selected=false,this.render();else {if(l.disabled||this.value.filter(h=>h.selected).length>=this.maxChoices)return this.bell();l.selected=true,this.render();}}handleInputChange(l){this.inputValue=this.inputValue+l,this.updateFilteredOptions();}_(l,h){l===" "?this.handleSpaceToggle():this.handleInputChange(l);}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
|
|
72
|
+
Instructions:
|
|
73
|
+
${n.arrowUp}/${n.arrowDown}: Highlight option
|
|
74
|
+
${n.arrowLeft}/${n.arrowRight}/[space]: Toggle selection
|
|
75
|
+
[a,b,c]/delete: Filter choices
|
|
76
|
+
enter/return: Complete answer
|
|
77
|
+
`:""}renderCurrentInput(){return `
|
|
78
|
+
Filtered results for: ${this.inputValue?this.inputValue:e.gray("Enter something to filter")}
|
|
79
|
+
`}renderOption(l,h,u,c){let f=(h.selected?e.green(n.radioOn):n.radioOff)+" "+c+" ",p;return h.disabled?p=l===u?e.gray().underline(h.title):e.strikethrough().gray(h.title):p=l===u?e.cyan().underline(h.title):h.title,f+p}renderDoneOrInstructions(){if(this.done)return this.value.filter(h=>h.selected).map(h=>h.title).join(", ");let l=[e.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[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.filteredOptions),this.out.write(this.clear+l),this.clear=s(l,this.out.columns);}}return Ar=o,Ar}var Or,Ki;function Yl(){if(Ki)return Or;Ki=1;let e=K(),t=ue(),{style:r,clear:s}=G(),{erase:i,cursor:n}=U();class o extends t{constructor(l={}){super(l),this.msg=l.message,this.value=l.initial,this.initialValue=!!l.initial,this.yesMsg=l.yes||"yes",this.yesOption=l.yesOption||"(Y/n)",this.noMsg=l.no||"no",this.noOption=l.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(`
|
|
80
|
+
`),this.close();}submit(){this.value=this.value||false,this.done=true,this.aborted=false,this.fire(),this.render(),this.out.write(`
|
|
81
|
+
`),this.close();}_(l,h){return l.toLowerCase()==="y"?(this.value=true,this.submit()):l.toLowerCase()==="n"?(this.value=false,this.submit()):this.bell()}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.done?this.value?this.yesMsg:this.noMsg:e.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(i.line+n.to(0)+this.outputText));}}return Or=o,Or}var _r,Ui;function Xl(){return Ui||(Ui=1,_r={TextPrompt:jl(),SelectPrompt:Nl(),TogglePrompt:Ml(),DatePrompt:Bl(),NumberPrompt:Gl(),MultiselectPrompt:ln(),AutocompletePrompt:Hl(),AutocompleteMultiselectPrompt:Jl(),ConfirmPrompt:Yl()}),_r}var qi;function Zl(){return qi||(qi=1,function(e){let t=e,r=Xl(),s=o=>o;function i(o,a,l={}){return new Promise((h,u)=>{let c=new r[o](a),f=l.onAbort||s,p=l.onSubmit||s,d=l.onExit||s;c.on("state",a.onState||s),c.on("submit",m=>h(p(m))),c.on("exit",m=>h(d(m))),c.on("abort",m=>u(f(m)));})}t.text=o=>i("TextPrompt",o),t.password=o=>(o.style="password",t.text(o)),t.invisible=o=>(o.style="invisible",t.text(o)),t.number=o=>i("NumberPrompt",o),t.date=o=>i("DatePrompt",o),t.confirm=o=>i("ConfirmPrompt",o),t.list=o=>{let a=o.separator||",";return i("TextPrompt",o,{onSubmit:l=>l.split(a).map(h=>h.trim())})},t.toggle=o=>i("TogglePrompt",o),t.select=o=>i("SelectPrompt",o),t.multiselect=o=>{o.choices=[].concat(o.choices||[]);let a=l=>l.filter(h=>h.selected).map(h=>h.value);return i("MultiselectPrompt",o,{onAbort:a,onSubmit:a})},t.autocompleteMultiselect=o=>{o.choices=[].concat(o.choices||[]);let a=l=>l.filter(h=>h.selected).map(h=>h.value);return i("AutocompleteMultiselectPrompt",o,{onAbort:a,onSubmit:a})};let n=(o,a)=>Promise.resolve(a.filter(l=>l.title.slice(0,o.length).toLowerCase()===o.toLowerCase()));t.autocomplete=o=>(o.suggest=o.suggest||n,o.choices=[].concat(o.choices||[]),i("AutocompletePrompt",o));}(tr)),tr}var jr,Bi;function Ql(){if(Bi)return jr;Bi=1;let e=Zl(),t=["suggest","format","onState","validate","onRender","type"],r=()=>{};async function s(a=[],{onSubmit:l=r,onCancel:h=r}={}){let u={},c=s._override||{};a=[].concat(a);let f,p,d,m,g,x,y=async(w,v,b=false)=>{if(!(!b&&w.validate&&w.validate(v)!==true))return w.format?await w.format(v,u):v};for(p of a)if({name:m,type:g}=p,typeof g=="function"&&(g=await g(f,{...u},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(f,{...u},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(c[p.name]!==void 0&&(f=await y(p,c[p.name]),f!==void 0)){u[m]=f;continue}try{f=s._injected?i(s._injected,p.initial):await e[g](p),u[m]=f=await y(p,f,!0),d=await l(p,f,u);}catch{d=!await h(p,u);}if(d)return u}return u}function i(a,l){let h=a.shift();if(h instanceof Error)throw h;return h===void 0?l:h}function n(a){s._injected=(s._injected||[]).concat(a);}function o(a){s._override=Object.assign({},a);}return jr=Object.assign(s,{prompt:s,prompts:e,inject:n,override:o}),jr}var Nr,Gi;function ec(){return Gi||(Gi=1,Nr=Ql()),Nr}var tc=ec(),rc=Vr(tc),Kr=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 $t=globalThis.navigator?.userAgentData?.platform;$t==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===true||globalThis.process?.platform;$t==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform;$t==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===true||globalThis.navigator?.userAgent?.includes(" Linux ")===true||globalThis.process?.platform;$t==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===true||globalThis.process?.platform;var Hi="\x1B]",Ji="\x07",It=";";!Kr&&B.env.TERM_PROGRAM;!Kr&&B.platform;Kr||B.cwd;var sc=(e,t)=>[Hi,"8",It,It,t,Ji,e,Hi,"8",It,It,Ji].join(""),Mr,Yi;function cn(){return Yi||(Yi=1,Mr=(e,t=process.argv)=>{let r=e.startsWith("-")?"":e.length===1?"-":"--",s=t.indexOf(r+e),i=t.indexOf("--");return s!==-1&&(i===-1||s<i)}),Mr}var Lr,Xi;function ic(){if(Xi)return Lr;Xi=1;let e=Cl,t=Sl,r=cn(),{env:s}=process,i;r("no-color")||r("no-colors")||r("color=false")||r("color=never")?i=0:(r("color")||r("colors")||r("color=true")||r("color=always"))&&(i=1),"FORCE_COLOR"in s&&(s.FORCE_COLOR==="true"?i=1:s.FORCE_COLOR==="false"?i=0:i=s.FORCE_COLOR.length===0?1:Math.min(parseInt(s.FORCE_COLOR,10),3));function n(l){return l===0?false:{level:l,hasBasic:true,has256:l>=2,has16m:l>=3}}function o(l,h){if(i===0)return 0;if(r("color=16m")||r("color=full")||r("color=truecolor"))return 3;if(r("color=256"))return 2;if(l&&!h&&i===void 0)return 0;let u=i||0;if(s.TERM==="dumb")return u;if(process.platform==="win32"){let c=e.release().split(".");return Number(c[0])>=10&&Number(c[2])>=10586?Number(c[2])>=14931?3:2:1}if("CI"in s)return ["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(c=>c in s)||s.CI_NAME==="codeship"?1:u;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 c=parseInt((s.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(s.TERM_PROGRAM){case "iTerm.app":return c>=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:u}function a(l){let h=o(l,l&&l.isTTY);return n(h)}return Lr={supportsColor:a,stdout:n(o(true,t.isatty(1))),stderr:n(o(true,t.isatty(2)))},Lr}var Fr,Zi;function nc(){if(Zi)return Fr;Zi=1;let e=ic(),t=cn();function r(i){if(/^\d{3,4}$/.test(i)){let o=/(\d{1,2})(\d{2})/.exec(i)||[];return {major:0,minor:parseInt(o[1],10),patch:parseInt(o[2],10)}}let n=(i||"").split(".").map(o=>parseInt(o,10));return {major:n[0],minor:n[1],patch:n[2]}}function s(i){let{CI:n,FORCE_HYPERLINK:o,NETLIFY:a,TEAMCITY_VERSION:l,TERM_PROGRAM:h,TERM_PROGRAM_VERSION:u,VTE_VERSION:c,TERM:f}=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")||a)return true;if(!e.supportsColor(i)||i&&!i.isTTY)return false;if("WT_SESSION"in process.env)return true;if(process.platform==="win32"||n||l)return false;if(h){let p=r(u||"");switch(h){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(c){if(c==="0.50.0")return false;let p=r(c);return p.major>0||p.minor>=50}switch(f){case "alacritty":return true}return false}return Fr={supportsHyperlink:s,stdout:s(process.stdout),stderr:s(process.stderr)},Fr}var oc=nc(),Ur=Vr(oc);function Je(e,t,{target:r="stdout",...s}={}){return Ur[r]?sc(e,t):s.fallback===false?e:typeof s.fallback=="function"?s.fallback(e,t):`${e} (\u200B${t}\u200B)`}Je.isSupported=Ur.stdout;Je.stderr=(e,t,r={})=>Je(e,t,{target:"stderr",...r});Je.stderr.isSupported=Ur.stderr;var z={},ge={},Qi;function ac(){if(Qi)return ge;Qi=1,Object.defineProperty(ge,"__esModule",{value:true}),ge.sync=ge.isexe=void 0;let e=nn,t=ai,r=async(o,a={})=>{let{ignoreErrors:l=false}=a;try{return i(await(0,t.stat)(o),a)}catch(h){let u=h;if(l||u.code==="EACCES")return false;throw u}};ge.isexe=r;let s=(o,a={})=>{let{ignoreErrors:l=false}=a;try{return i((0,e.statSync)(o),a)}catch(h){let u=h;if(l||u.code==="EACCES")return false;throw u}};ge.sync=s;let i=(o,a)=>o.isFile()&&n(o,a),n=(o,a)=>{let l=a.uid??process.getuid?.(),h=a.groups??process.getgroups?.()??[],u=a.gid??process.getgid?.()??h[0];if(l===void 0||u===void 0)throw new Error("cannot get uid or gid");let c=new Set([u,...h]),f=o.mode,p=o.uid,d=o.gid,m=parseInt("100",8),g=parseInt("010",8),x=parseInt("001",8),y=m|g;return !!(f&x||f&g&&c.has(d)||f&m&&p===l||f&y&&l===0)};return ge}var ye={},en;function lc(){if(en)return ye;en=1,Object.defineProperty(ye,"__esModule",{value:true}),ye.sync=ye.isexe=void 0;let e=nn,t=ai,r=async(o,a={})=>{let{ignoreErrors:l=false}=a;try{return n(await(0,t.stat)(o),o,a)}catch(h){let u=h;if(l||u.code==="EACCES")return false;throw u}};ye.isexe=r;let s=(o,a={})=>{let{ignoreErrors:l=false}=a;try{return n((0,e.statSync)(o),o,a)}catch(h){let u=h;if(l||u.code==="EACCES")return false;throw u}};ye.sync=s;let i=(o,a)=>{let{pathExt:l=process.env.PATHEXT||""}=a,h=l.split(";");if(h.indexOf("")!==-1)return true;for(let u=0;u<h.length;u++){let c=h[u].toLowerCase(),f=o.substring(o.length-c.length).toLowerCase();if(c&&f===c)return true}return false},n=(o,a,l)=>o.isFile()&&i(a,l);return ye}var Dr={},tn;function cc(){return tn||(tn=1,Object.defineProperty(Dr,"__esModule",{value:true})),Dr}var rn;function uc(){return rn||(rn=1,function(e){var t=z&&z.__createBinding||(Object.create?function(h,u,c,f){f===void 0&&(f=c);var p=Object.getOwnPropertyDescriptor(u,c);(!p||("get"in p?!u.__esModule:p.writable||p.configurable))&&(p={enumerable:true,get:function(){return u[c]}}),Object.defineProperty(h,f,p);}:function(h,u,c,f){f===void 0&&(f=c),h[f]=u[c];}),r=z&&z.__setModuleDefault||(Object.create?function(h,u){Object.defineProperty(h,"default",{enumerable:true,value:u});}:function(h,u){h.default=u;}),s=z&&z.__importStar||function(h){if(h&&h.__esModule)return h;var u={};if(h!=null)for(var c in h)c!=="default"&&Object.prototype.hasOwnProperty.call(h,c)&&t(u,h,c);return r(u,h),u},i=z&&z.__exportStar||function(h,u){for(var c in h)c!=="default"&&!Object.prototype.hasOwnProperty.call(u,c)&&t(u,h,c);};Object.defineProperty(e,"__esModule",{value:true}),e.sync=e.isexe=e.posix=e.win32=void 0;let n=s(ac());e.posix=n;let o=s(lc());e.win32=o,i(cc(),e);let l=(process.env._ISEXE_TEST_PLATFORM_||process.platform)==="win32"?o:n;e.isexe=l.isexe,e.sync=l.sync;}(z)),z}var Wr,sn;function hc(){if(sn)return Wr;sn=1;let{isexe:e,sync:t}=uc(),{join:r,delimiter:s,sep:i,posix:n}=E,o=process.platform==="win32",a=new RegExp(`[${n.sep}${i===n.sep?"":i}]`.replace(/(\\)/g,"\\$1")),l=new RegExp(`^\\.${a.source}`),h=d=>Object.assign(new Error(`not found: ${d}`),{code:"ENOENT"}),u=(d,{path:m=process.env.PATH,pathExt:g=process.env.PATHEXT,delimiter:x=s})=>{let y=d.match(a)?[""]:[...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 d.includes(".")&&v[0]!==""&&v.unshift(""),{pathEnv:y,pathExt:v,pathExtExe:w}}return {pathEnv:y,pathExt:[""]}},c=(d,m)=>{let g=/^".*"$/.test(d)?d.slice(1,-1):d;return (!g&&l.test(m)?m.slice(0,2):"")+r(g,m)},f=async(d,m={})=>{let{pathEnv:g,pathExt:x,pathExtExe:y}=u(d,m),w=[];for(let v of g){let b=c(v,d);for(let C of x){let P=b+C;if(await e(P,{pathExt:y,ignoreErrors:true})){if(!m.all)return P;w.push(P);}}}if(m.all&&w.length)return w;if(m.nothrow)return null;throw h(d)},p=(d,m={})=>{let{pathEnv:g,pathExt:x,pathExtExe:y}=u(d,m),w=[];for(let v of g){let b=c(v,d);for(let C of x){let P=b+C;if(t(P,{pathExt:y,ignoreErrors:true})){if(!m.all)return P;w.push(P);}}}if(m.all&&w.length)return w;if(m.nothrow)return null;throw h(d)};return Wr=f,f.sync=p,Wr}var pc=hc(),fc=Vr(pc);join(Cl.tmpdir(),"antfu-ni");function un(e){return fc.sync(e,{nothrow:true})!==null}async function qr({autoInstall:e,programmatic:t,cwd:r}={}){let{name:s,agent:i,version:n}=await Zt({cwd:r,onUnknown:o=>{t||console.warn("[ni] Unknown packageManager:",o);}})||{};if(s&&!un(s)&&!t){if(!e){console.warn(`[ni] Detected ${s} but it doesn't seem to be installed.
|
|
82
|
+
`),B.env.CI&&B.exit(1);let o=Je(s,ni[s]),{tryInstall:a}=await rc({name:"tryInstall",type:"confirm",message:`Would you like to globally install ${o}?`});a||B.exit(1);}await Qt("npm",["i","-g",`${s}${n?`@${n}`:""}`],{nodeOptions:{stdio:"inherit",cwd:r},throwOnError:true});}return i}B.env.NI_CONFIG_FILE;var mc=B.platform==="win32"?B.env.USERPROFILE:B.env.HOME;E.join(mc||"~/",".nirc");async function gc(e,{withFallback:t}={withFallback:false}){let r=await qr({programmatic:true,cwd:e});return r==="yarn@berry"?"yarn":r==="pnpm@6"?"pnpm":r==="bun"?"bun":r==="deno"?"deno":t?Br()??"npm":r??"npm"}function Br(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 Gr(e){return e==="pnpm"?"pnpm dlx":e==="bun"?"bunx":"npx"}async function ym(e){let t=await gc(e);return Gr(t)}var hn={name:"shadcn",version:"4.7.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":{style:"./dist/tailwind.css"}},bin:"./dist/index.js",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: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","https-proxy-agent":"^7.0.6",kleur:"^4.1.5",msw:"^2.10.4","node-fetch":"^3.3.2",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","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",rimraf:"^6.0.1",tsup:"^8.5.0","type-fest":"^4.41.0",typescript:"^5.9.2"}};function Ie(e){if(k.break(),k.error("Something went wrong. Please check the error below for more details."),k.error("If the problem persists, please open an issue on GitHub."),k.error(""),typeof e=="string"&&(k.error(e),Ye()),e instanceof A&&(e.message&&(k.error(e.cause?"Error:":"Message:"),k.error(e.message)),e.cause&&(k.error(`
|
|
83
|
+
Message:`),k.error(e.cause)),e.suggestion&&(k.error(`
|
|
84
|
+
Suggestion:`),k.error(e.suggestion)),Ye()),e instanceof z$1.ZodError){k.error("Validation failed:");for(let[t,r]of Object.entries(e.flatten().fieldErrors))k.error(`- ${I.info(t)}: ${r}`);Ye();}e instanceof Error&&(k.error(e.message),Ye()),Ye();}function xc(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 vc(e=hn.version,t=process.argv.slice(2)){let r=xc(e);return r?[...Gr(Br()).split(" "),`shadcn@${r}`,...t].map(bc).join(" "):null}function Ye(){let e=vc();e&&(k.error(""),k.error("You can also try a previous version to see if that works:"),k.error(e)),k.break(),process.exit(1);}function bc(e){return /^[a-zA-Z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replace(/'/g,"'\\''")}'`}async function Hr(e,t){let{config:r,useCache:s}=t||{};if(W(e)){let[a]=await O([e],{useCache:s});try{return o.parse(a)}catch(l){throw new j(e,l)}}if(!e.startsWith("@"))throw new Me(e);let i=e;i.endsWith("/registry")||(i=`${i}/registry`);let n=Re(i,ke(r));if(!n?.url)throw new pe(i);n.headers&&Object.keys(n.headers).length>0&&Ke({[n.url]:n.headers});let[o$1]=await O([n.url],{useCache:s});try{return o.parse(o$1)}catch(a){throw new j(i,a)}}async function Cc(e,t){let{config:r,useCache:s=false}=t||{};return Ue(),me(e,ke(r),{useCache:s})}async function Sc(e,t){let{config:r,useCache:s=false}=t||{};return Ue(),ii(e,ke(r),{useCache:s})}async function Km(e,t){let{useCache:r=true}=t||{};r||ut.clearCaches();let s=await ut.search(e);if(!s)return {registries:D};let i=z$1.object({registries:b$1.optional()}).safeParse(s.config);if(!i.success)throw new st(e,i.error);return {registries:{...D,...i.data.registries||{}}}}async function pt(){try{let[e]=await O(["index.json"]);return p.parse(e)}catch(e){k.error(`
|
|
85
|
+
`),Ie(e);}}async function Um(){try{let[e]=await O(["styles/index.json"]);return q.parse(e)}catch(e){return k.error(`
|
|
86
|
+
`),Ie(e),[]}}async function qm(){try{let[e]=await O(["icons/index.json"]);return r.parse(e)}catch(e){return Ie(e),{}}}async function Bm(){return ps}async function St(e){try{let[t]=await O([`colors/${e}.json`]);return s.parse(t)}catch(t){Ie(t);}}async function kc(e,t){let r=[];for(let s of t){let i=e.find(n=>n.name===s);if(i&&(r.push(i),i.registryDependencies)){let n=await kc(e,i.registryDependencies);r.push(...n);}}return r.filter((s,i,n)=>n.findIndex(o=>o.name===s.name)===i)}async function Gm(e,t){try{let r=t.map(i=>`styles/${e}/${i.name}.json`);return (await O(r)).map(i=>n.parse(i))}catch(r){return Ie(r),[]}}async function Hm(e,t,r){if(r)return r;if(t.type==="registry:ui")return e.resolvedPaths.ui??e.resolvedPaths.components;let[s,i]=t.type?.split(":")??[];return s in e.resolvedPaths?E.join(e.resolvedPaths[s],i):null}async function fn(e){e={useCache:true,...e};let t=`${he}/registries.json`,[r]=await O([t],{useCache:e.useCache});try{return x.parse(r)}catch(s){throw s instanceof z$1.ZodError?new Le(s):s}}async function Rc(e){let t=await fn(e);return t?Object.fromEntries(t.map(r=>[r.name,r.url])):null}async function Tc(e){e={useCache:true,...e};let t=`${he}/config.json`,[r]=await O([t],{useCache:e.useCache});return z$2.parse(r).presets}async function Jm(e,t){return (await Tc(t)).find(s=>s.name.toLowerCase()===e.toLowerCase())??null}async function Ic(e,t){let{query:r,limit:s,offset:i,config:n,useCache:o}=t||{},a=[];for(let f of e){let d=((await Hr(f,{config:n,useCache:o})).items||[]).map(m=>({name:m.name,type:m.type,description:m.description,registry:f,addCommandArgument:_c(m.name,f)}));a=a.concat(d);}r&&(a=Ac(a,{query:r,limit:a.length,keys:["name","description"]}));let l=i||0,h=s||a.length,u=a.length,c={pagination:{total:u,offset:l,limit:h,hasMore:l+h<u},items:a.slice(l,l+h)};return v.parse(c)}var $c=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 Ac(e,t){t={limit:100,threshold:-1e4,...t};let s=Pc.go(t.query,e,{keys:t.keys,threshold:t.threshold,limit:t.limit}).map(i=>i.obj);return z$1.array($c).parse(s)}function Oc(e){try{return new URL(e),!0}catch{return false}}function _c(e,t){if(!Oc(t))return `${t}/${e}`;let r=t.indexOf("://")+3,s=t.indexOf("/",r);if(s===-1){let f=t.indexOf("?",r);if(f!==-1){let p=t.substring(0,f),m=t.substring(f).replace(/\bregistry\b/g,e);return p+m}return t}let i=t.substring(0,s),n=t.substring(s),o=n.indexOf("?")!==-1?n.indexOf("?"):n.length,a=n.substring(0,o),l=n.substring(o),h=a.lastIndexOf("registry"),u=a;h!==-1&&(u=a.substring(0,h)+e+a.substring(h+8));let c=l.replace(/\bregistry\b/g,e);return i+u+c}
|
|
87
|
+
export{Ue as $,de as A,Zu as Aa,gt as B,mt as Ba,wt as C,Qu as Ca,vt as D,Ic as Da,bt as E,_s as F,js as G,vp as H,Et as I,Ct as J,Vo as K,Vs as L,W as M,Np as N,Ou as O,_u as P,ju as Q,Nu as R,ut as S,ze as T,ht as U,Mu as V,Bn as W,Hn as X,Lu as Y,vs as Z,ke as _,_ as a,Yp as aa,D as b,Re as ba,jc as c,If as ca,I as d,me as da,k as e,ii as ea,au as f,gc as fa,lu as g,ym as ga,cu as h,hn as ha,A as i,Ie as ia,pe as j,Hr as ja,Oe as k,Cc as ka,_e as l,Sc as la,je as m,Km as ma,te as n,pt as na,xe as o,Um as oa,j as p,qm as pa,Ne as q,Bm as qa,Me as r,St as ra,Le as s,kc as sa,ve as t,Gm as ta,re as u,Hm as ua,Cs as v,fn as va,fe as w,Rc as wa,ks as x,Tc as xa,Rs as y,Jm as ya,Ts as z,X as za};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {Da,ka,i,ga,ma}from'./chunk-SI5IQBLR.js';import {Server}from'@modelcontextprotocol/sdk/server/index.js';import {ListToolsRequestSchema,CallToolRequestSchema}from'@modelcontextprotocol/sdk/types.js';import a from'dedent';import {z}from'zod';import {zodToJsonSchema}from'zod-to-json-schema';var S="shadcn@latest";async function p(n){return `${await ga(process.cwd())} ${S} ${n}`}async function f(n=process.cwd()){return {registries:(await ma(n,{useCache:false})).registries}}function y(n,t){let{query:r,registries:i}=t||{},s=n.items.map(c=>{let u=[`- ${c.name}`];return c.type&&u.push(`(${c.type})`),c.description&&u.push(`- ${c.description}`),c.registry&&u.push(`[${c.registry}]`),u.push(`
|
|
2
|
+
Add command: \`${p(`add ${c.addCommandArgument}`)}\``),u.join(" ")}),o=`Found ${n.pagination.total} items`;r&&(o+=` matching "${r}"`),i&&i.length>0&&(o+=` in registries ${i.join(", ")}`),o+=":";let m=`Showing items ${n.pagination.offset+1}-${Math.min(n.pagination.offset+n.pagination.limit,n.pagination.total)} of ${n.pagination.total}:`,d=`${o}
|
|
3
|
+
|
|
4
|
+
${m}
|
|
5
|
+
|
|
6
|
+
${s.join(`
|
|
7
|
+
|
|
8
|
+
`)}`;return n.pagination.hasMore&&(d+=`
|
|
9
|
+
|
|
10
|
+
More items available. Use offset: ${n.pagination.offset+n.pagination.limit} to see the next page.`),d}function $(n){return n.map(t=>[`## ${t.name}`,t.description?`
|
|
11
|
+
${t.description}
|
|
12
|
+
`:"",t.type?`**Type:** ${t.type}`:"",t.files&&t.files.length>0?`**Files:** ${t.files.length} file(s)`:"",t.dependencies&&t.dependencies.length>0?`**Dependencies:** ${t.dependencies.join(", ")}`:"",t.devDependencies&&t.devDependencies.length>0?`**Dev Dependencies:** ${t.devDependencies.join(", ")}`:""].filter(Boolean).join(`
|
|
13
|
+
`))}function b(n,t){let r=n.map(s=>{let o=[`## Example: ${s.name}`,s.description?`
|
|
14
|
+
${s.description}
|
|
15
|
+
`:""];return s.files?.length&&s.files.forEach(m=>{m.content&&(o.push(`### Code (${m.path}):
|
|
16
|
+
`),o.push("```tsx"),o.push(m.content),o.push("```"));}),o.filter(Boolean).join(`
|
|
17
|
+
`)});return `# Usage Examples
|
|
18
|
+
|
|
19
|
+
Found ${n.length} example${n.length>1?"s":""} matching "${t}":
|
|
20
|
+
`+r.join(`
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
`)}var j=new Server({name:"shadcn",version:"1.0.0"},{capabilities:{resources:{},tools:{}}});j.setRequestHandler(ListToolsRequestSchema,async()=>({tools:[{name:"get_project_registries",description:"Get configured registry names from components.json - Returns error if no components.json exists (use init_project to create one)",inputSchema:zodToJsonSchema(z.object({}))},{name:"list_items_in_registries",description:"List items from registries (requires components.json - use init_project if missing)",inputSchema:zodToJsonSchema(z.object({registries:z.array(z.string()).describe("Array of registry names to search (e.g., ['@shadcn', '@acme'])"),limit:z.number().optional().describe("Maximum number of items to return"),offset:z.number().optional().describe("Number of items to skip for pagination")}))},{name:"search_items_in_registries",description:"Search for components in registries using fuzzy matching (requires components.json). After finding an item, use get_item_examples_from_registries to see usage examples.",inputSchema:zodToJsonSchema(z.object({registries:z.array(z.string()).describe("Array of registry names to search (e.g., ['@shadcn', '@acme'])"),query:z.string().describe("Search query string for fuzzy matching against item names and descriptions"),limit:z.number().optional().describe("Maximum number of items to return"),offset:z.number().optional().describe("Number of items to skip for pagination")}))},{name:"view_items_in_registries",description:"View detailed information about specific registry items including the name, description, type and files content. For usage examples, use get_item_examples_from_registries instead.",inputSchema:zodToJsonSchema(z.object({items:z.array(z.string()).describe("Array of item names with registry prefix (e.g., ['@shadcn/button', '@shadcn/card'])")}))},{name:"get_item_examples_from_registries",description:"Find usage examples and demos with their complete code. Search for patterns like 'accordion-demo', 'button example', 'card-demo', etc. Returns full implementation code with dependencies.",inputSchema:zodToJsonSchema(z.object({registries:z.array(z.string()).describe("Array of registry names to search (e.g., ['@shadcn', '@acme'])"),query:z.string().describe("Search query for examples (e.g., 'accordion-demo', 'button demo', 'card example', 'tooltip-demo', 'example-booking-form', 'example-hero'). Common patterns: '{item-name}-demo', '{item-name} example', 'example {item-name}'")}))},{name:"get_add_command_for_items",description:"Get the shadcn CLI add command for specific items in a registry. This is useful for adding one or more components to your project.",inputSchema:zodToJsonSchema(z.object({items:z.array(z.string()).describe("Array of items to get the add command for prefixed with the registry name (e.g., ['@shadcn/button', '@shadcn/card'])")}))},{name:"get_audit_checklist",description:"After creating new components or generating new code files, use this tool for a quick checklist to verify that everything is working as expected. Make sure to run the tool after all required steps have been completed.",inputSchema:zodToJsonSchema(z.object({}))}]}));j.setRequestHandler(CallToolRequestSchema,async n=>{try{if(!n.params.arguments)throw new Error("No tool arguments provided.");switch(n.params.name){case "get_project_registries":{let t=await f(process.cwd());return t?.registries?{content:[{type:"text",text:a`The following registries are configured in the current project:
|
|
25
|
+
|
|
26
|
+
${Object.keys(t.registries).map(r=>`- ${r}`).join(`
|
|
27
|
+
`)}
|
|
28
|
+
|
|
29
|
+
You can view the items in a registry by running:
|
|
30
|
+
\`${await p("view @name-of-registry")}\`
|
|
31
|
+
|
|
32
|
+
For example: \`${await p("view @shadcn")}\` or \`${await p("view @shadcn @acme")}\` to view multiple registries.
|
|
33
|
+
`}]}:{content:[{type:"text",text:a`No components.json found or no registries configured.
|
|
34
|
+
|
|
35
|
+
To fix this:
|
|
36
|
+
1. Use the \`init\` command to create a components.json file
|
|
37
|
+
2. Or manually create components.json with a registries section`}]}}case "search_items_in_registries":{let r=z.object({registries:z.array(z.string()),query:z.string(),limit:z.number().optional(),offset:z.number().optional()}).parse(n.params.arguments),i=await Da(r.registries,{query:r.query,limit:r.limit,offset:r.offset,config:await f(process.cwd()),useCache:!1});return i.items.length===0?{content:[{type:"text",text:a`No items found matching "${r.query}" in registries ${r.registries.join(", ")}, Try searching with a different query or registry.`}]}:{content:[{type:"text",text:y(i,{query:r.query,registries:r.registries})}]}}case "list_items_in_registries":{let r=z.object({registries:z.array(z.string()),limit:z.number().optional(),offset:z.number().optional(),cwd:z.string().optional()}).parse(n.params.arguments),i=await Da(r.registries,{limit:r.limit,offset:r.offset,config:await f(process.cwd()),useCache:!1});return i.items.length===0?{content:[{type:"text",text:a`No items found in registries ${r.registries.join(", ")}.`}]}:{content:[{type:"text",text:y(i,{registries:r.registries})}]}}case "view_items_in_registries":{let r=z.object({items:z.array(z.string())}).parse(n.params.arguments),i=await ka(r.items,{config:await f(process.cwd()),useCache:!1});if(i?.length===0)return {content:[{type:"text",text:a`No items found for: ${r.items.join(", ")}
|
|
38
|
+
|
|
39
|
+
Make sure the item names are correct and include the registry prefix (e.g., @shadcn/button).`}]};let s=$(i);return {content:[{type:"text",text:a`Item Details:
|
|
40
|
+
|
|
41
|
+
${s.join(`
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
`)}`}]}}case "get_item_examples_from_registries":{let r=z.object({query:z.string(),registries:z.array(z.string())}).parse(n.params.arguments),i=await f(),s=await Da(r.registries,{query:r.query,config:i,useCache:!1});if(s.items.length===0)return {content:[{type:"text",text:a`No examples found for query "${r.query}".
|
|
46
|
+
|
|
47
|
+
Try searching with patterns like:
|
|
48
|
+
- "accordion-demo" for accordion examples
|
|
49
|
+
- "button demo" or "button example"
|
|
50
|
+
- Component name followed by "-demo" or "example"
|
|
51
|
+
|
|
52
|
+
You can also:
|
|
53
|
+
1. Use search_items_in_registries to find all items matching your query
|
|
54
|
+
2. View the main component with view_items_in_registries for inline usage documentation`}]};let o=s.items.map(d=>d.addCommandArgument),m=await ka(o,{config:i,useCache:!1});return {content:[{type:"text",text:b(m,r.query)}]}}case "get_add_command_for_items":{let t=z.object({items:z.array(z.string())}).parse(n.params.arguments);return {content:[{type:"text",text:await p(`add ${t.items.join(" ")}`)}]}}case "get_audit_checklist":return {content:[{type:"text",text:a`## Component Audit Checklist
|
|
55
|
+
|
|
56
|
+
After adding or generating components, check the following common issues:
|
|
57
|
+
|
|
58
|
+
- [ ] Ensure imports are correct i.e named vs default imports
|
|
59
|
+
- [ ] If using next/image, ensure images.remotePatterns next.config.js is configured correctly.
|
|
60
|
+
- [ ] Ensure all dependencies are installed.
|
|
61
|
+
- [ ] Check for linting errors or warnings
|
|
62
|
+
- [ ] Check for TypeScript errors
|
|
63
|
+
- [ ] Use the Playwright MCP if available.
|
|
64
|
+
`}]};default:throw new Error(`Tool ${n.params.name} not found`)}}catch(t){if(t instanceof z.ZodError)return {content:[{type:"text",text:a`Invalid input parameters:
|
|
65
|
+
${t.errors.map(i=>`- ${i.path.join(".")}: ${i.message}`).join(`
|
|
66
|
+
`)}
|
|
67
|
+
`}],isError:true};if(t instanceof i){let i=t.message;return t.suggestion&&(i+=`
|
|
68
|
+
|
|
69
|
+
\u{1F4A1} ${t.suggestion}`),t.context&&(i+=`
|
|
70
|
+
|
|
71
|
+
Context: ${JSON.stringify(t.context,null,2)}`),{content:[{type:"text",text:a`Error (${t.code}): ${i}`}],isError:true}}let r=t instanceof Error?t.message:String(t);return {content:[{type:"text",text:a`Error: ${r}`}],isError:true}}});export{j as a};
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ declare function getRegistry(name: string, options?: {
|
|
|
36
36
|
iconLibrary?: string | undefined;
|
|
37
37
|
rtl?: boolean | undefined;
|
|
38
38
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
39
|
-
menuAccent?: "
|
|
39
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
40
40
|
aliases?: {
|
|
41
41
|
components?: string | undefined;
|
|
42
42
|
ui?: string | undefined;
|
|
@@ -197,7 +197,7 @@ declare function getRegistryItems(items: string[], options?: {
|
|
|
197
197
|
iconLibrary?: string | undefined;
|
|
198
198
|
rtl?: boolean | undefined;
|
|
199
199
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
200
|
-
menuAccent?: "
|
|
200
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
201
201
|
aliases?: {
|
|
202
202
|
components?: string | undefined;
|
|
203
203
|
ui?: string | undefined;
|
|
@@ -446,7 +446,7 @@ declare function getShadcnRegistryIndex(): Promise<({
|
|
|
446
446
|
iconLibrary?: string | undefined;
|
|
447
447
|
rtl?: boolean | undefined;
|
|
448
448
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
449
|
-
menuAccent?: "
|
|
449
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
450
450
|
aliases?: {
|
|
451
451
|
components?: string | undefined;
|
|
452
452
|
ui?: string | undefined;
|
|
@@ -651,7 +651,7 @@ declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names:
|
|
|
651
651
|
iconLibrary?: string | undefined;
|
|
652
652
|
rtl?: boolean | undefined;
|
|
653
653
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
654
|
-
menuAccent?: "
|
|
654
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
655
655
|
aliases?: {
|
|
656
656
|
components?: string | undefined;
|
|
657
657
|
ui?: string | undefined;
|
|
@@ -811,7 +811,7 @@ declare function fetchTree(style: string, tree: z.infer<typeof registryIndexSche
|
|
|
811
811
|
iconLibrary?: string | undefined;
|
|
812
812
|
rtl?: boolean | undefined;
|
|
813
813
|
menuColor?: "default" | "inverted" | "default-translucent" | "inverted-translucent" | undefined;
|
|
814
|
-
menuAccent?: "
|
|
814
|
+
menuAccent?: "subtle" | "bold" | undefined;
|
|
815
815
|
aliases?: {
|
|
816
816
|
components?: string | undefined;
|
|
817
817
|
ui?: string | undefined;
|
|
@@ -967,7 +967,7 @@ declare function getPresets(options?: {
|
|
|
967
967
|
iconLibrary: string;
|
|
968
968
|
rtl: boolean;
|
|
969
969
|
menuColor: "default" | "inverted" | "default-translucent" | "inverted-translucent";
|
|
970
|
-
menuAccent: "
|
|
970
|
+
menuAccent: "subtle" | "bold";
|
|
971
971
|
theme: string;
|
|
972
972
|
name: string;
|
|
973
973
|
title: string;
|
|
@@ -984,7 +984,7 @@ declare function getPreset(name: string, options?: {
|
|
|
984
984
|
iconLibrary: string;
|
|
985
985
|
rtl: boolean;
|
|
986
986
|
menuColor: "default" | "inverted" | "default-translucent" | "inverted-translucent";
|
|
987
|
-
menuAccent: "
|
|
987
|
+
menuAccent: "subtle" | "bold";
|
|
988
988
|
theme: string;
|
|
989
989
|
name: string;
|
|
990
990
|
title: string;
|