pickier 0.1.64 → 0.1.66
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/bin/cli.js +2 -2
- package/dist/chunk-0byqg5rc.js +2 -0
- package/dist/chunk-nke9r0j5.js +2 -0
- package/dist/chunk-p0j2ra3t.js +31 -0
- package/dist/chunk-p5zbyxq6.js +2 -0
- package/dist/chunk-rg0g2fzg.js +92 -0
- package/dist/chunk-vbmkrdh6.js +226 -0
- package/dist/chunk-zzacmw52.js +2 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/linter.d.ts +9 -0
- package/package.json +1 -1
- package/dist/chunk-1x4nw0af.js +0 -2
- package/dist/chunk-abs1kewd.js +0 -2
- package/dist/chunk-awmb5sg5.js +0 -3
- package/dist/chunk-djgqvaq1.js +0 -3
- package/dist/chunk-dsmbhdmt.js +0 -226
- package/dist/chunk-gy6wyx8t.js +0 -62
- package/dist/chunk-hwa8gmzb.js +0 -156
- package/dist/chunk-vdbbvx8x.js +0 -33
- package/dist/chunk-yx80g50v.js +0 -2
- package/dist/chunk-z7exyj5z.js +0 -2
package/dist/chunk-hwa8gmzb.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import"./chunk-awmb5sg5.js";import{existsSync as It}from"fs";import de from"fs/promises";import ke from"os";import fe from"path";import G from"process";import{EventEmitter as Ot}from"events";import P from"process";import Ve from"process";import we from"process";import ae from"process";import Ne from"process";import Z from"process";import Re from"tty";import rt,{stdin as hs,stdout as ms}from"process";import*as U from"readline";import{ReadStream as je,WriteStream as ds}from"tty";import Le,{stdin as ys,stdout as bs}from"process";import xs from"readline";import Es from"process";import Rs from"process";import{WriteStream as js}from"tty";import Ws from"process";import Te from"process";import Fs from"process";import{stripVTControlCharacters as ge}from"util";import{existsSync as Us,lstatSync as Fe,readdirSync as Gs}from"fs";import{dirname as He,join as Ks}from"path";import qs from"process";import A from"process";import ee from"process";import{stripVTControlCharacters as $e}from"util";import Ys from"process";import{Buffer as Ke}from"buffer";import j from"fs/promises";import Js from"os";import le from"path";import x from"process";import{Readable as Qs,Writable as Xs}from"stream";class qe{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let e=ke.homedir(),t=fe.join(e,".config","clapp");this.configPath=fe.join(t,"telemetry.json")}async isEnabled(){if(G.env.DO_NOT_TRACK==="1"||G.env.DO_NOT_TRACK==="true")return!1;if(G.env.NO_TELEMETRY==="1"||G.env.NO_TELEMETRY==="true")return!1;return(await this.loadConfig()).enabled}async enable(){let e=await this.loadConfig();if(e.enabled=!0,!e.userId)e.userId=this.generateUserId();await this.saveConfig(e)}async disable(){let e=await this.loadConfig();e.enabled=!1,await this.saveConfig(e)}async track(e,t){if(!await this.isEnabled())return;let i={event:e,...t,timestamp:Date.now(),platform:ke.platform(),nodeVersion:G.version};if(this.events.push(i),this.events.length>=10)await this.send()}async trackCommand(e,t){await this.track("command",{command:e,duration:t})}async trackError(e,t){await this.track("error",{error:e,command:t})}async send(){if(!await this.isEnabled()||this.events.length===0)return!0;try{this.events=[],this.retryCount=0;let t=await this.loadConfig();return t.lastSent=Date.now(),await this.saveConfig(t),!0}catch{if(this.retryCount<this.maxRetries){this.retryCount++;let t=this.retryDelayMs*2**(this.retryCount-1);return await this.sleep(t),this.send()}return this.events=[],this.retryCount=0,!1}}async flush(){if(this.events.length===0)return!0;return this.send()}sleep(e){return new Promise((t)=>setTimeout(t,e))}async status(){let e=await this.loadConfig();return{enabled:e.enabled,doNotTrack:G.env.DO_NOT_TRACK==="1"||G.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:e.lastSent}}async loadConfig(){if(this.config)return this.config;try{if(It(this.configPath)){let e=await de.readFile(this.configPath,"utf-8");return this.config=JSON.parse(e),this.config}}catch{}return this.config={enabled:!1},this.config}async saveConfig(e){this.config=e;try{let t=fe.dirname(this.configPath);await de.mkdir(t,{recursive:!0}),await de.writeFile(this.configPath,JSON.stringify(e,null,2),"utf-8")}catch{}}generateUserId(){let e=Math.random().toString(36).substring(2,15),t=Date.now().toString(36);return`${e}-${t}`}}var oi=new qe;function Et(e,t={}){let s={_:[]},i=t.alias||{},r=new Set(t.boolean||[]),o={};for(let u of Object.keys(i))for(let a of i[u])o[a]=u;for(let u of r)if(i[u])for(let a of i[u])r.add(a);function l(u,a){let c=o[u]||u;if(s[c]=a,i[c])for(let h of i[c])s[h]=a;if(o[u]&&i[o[u]])for(let h of i[o[u]])s[h]=a;s[u]=a}for(let u=0;u<e.length;u++){let a=e[u];if(a==="--"){s._.push(...e.slice(u+1));break}if(a.startsWith("--")){let c=a.indexOf("=");if(c!==-1){let h=a.slice(2,c),f=a.slice(c+1);l(h,f)}else{let h=a.slice(2);if(h.startsWith("no-")){let p=h.slice(3);l(p,!1);continue}let f=o[h]||h;if(r.has(f)||r.has(h))l(h,!0);else{let p=e[u+1];if(p!==void 0&&!p.startsWith("-"))l(h,p),u++;else l(h,!0)}}}else if(a.startsWith("-")&&a.length>1){let c=a.slice(1);for(let h=0;h<c.length;h++){let f=c[h],p=o[f]||f;if(h===c.length-1&&!r.has(p)&&!r.has(f)){let d=e[u+1];if(d!==void 0&&!d.startsWith("-"))l(f,d),u++;else l(f,!0)}else l(f,!0)}}else s._.push(a)}return s}function ve(e){return e.replace(/[<[].+/,"").trim()}function Bt(e){let t=/<([^>]+)>/g,s=/\[([^\]]+)\]/g,i=[],r=(u)=>{let a=!1,c=u[1];if(c.startsWith("..."))c=c.slice(3),a=!0;return{required:u[0].startsWith("<"),value:c,variadic:a}},o;while(o=t.exec(e))i.push(r(o));let l;while(l=s.exec(e))i.push(r(l));return i}function Tt(e){let t={alias:{},boolean:[]};for(let[s,i]of e.entries()){if(i.names.length>1)t.alias[i.names[0]]=i.names.slice(1);if(i.isBoolean)if(i.negated){if(!e.some((o,l)=>l!==s&&o.names.some((u)=>i.names.includes(u))&&typeof o.required==="boolean"))t.boolean.push(i.names[0])}else t.boolean.push(i.names[0])}return t}function Me(e){return e.reduce((t,s)=>t.length>=s.length?t:s,"")}function pe(e,t){return e.length>=t?e:`${e}${" ".repeat(t-e.length)}`}function kt(e){return e.replace(/([a-z])-([a-z])/g,(t,s,i)=>s+i.toUpperCase())}function Vt(e,t,s){let i=0,r=t.length,o=e,l;for(;i<r;++i)l=o[t[i]],o=o[t[i]]=i===r-1?s:l!=null?l:!!~t[i+1].indexOf(".")||!(+t[i+1]>-1)?{}:[]}function Mt(e,t){for(let s of Object.keys(t)){let i=t[s];if(i.shouldTransform){if(e[s]=Array.prototype.concat.call([],e[s]),typeof i.transformFunction==="function")e[s]=e[s].map(i.transformFunction)}}}function At(e){let t=/([^\\/]+)$/.exec(e);return t?t[1]:""}function ze(e){return e.split(".").map((t,s)=>s===0?kt(t):t).join(".")}class oe extends Error{exitCode=2;isUsageError=!0;constructor(e){super(e);if(this.name=this.constructor.name,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(e).stack}format(e=!1){if(e&&this.stack)return`${this.message}
|
|
3
|
-
|
|
4
|
-
Stack trace:
|
|
5
|
-
${this.stack}`;return this.message}}function Nt(){let{env:e}=Ve,{TERM:t,TERM_PROGRAM:s}=e;if(Ve.platform!=="win32")return t!=="linux";return Boolean(e.WT_SESSION)||Boolean(e.TERMINUS_SUBLIME)||e.ConEmuTask==="{cmd::Cmder}"||s==="Terminus-Sublime"||s==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var ue="\x1B",S=`${ue}[`,ci="\x07",k={to(e,t){if(!t)return`${S}${e+1}G`;return`${S}${t+1};${e+1}H`},move(e,t){let s="";if(e<0)s+=`${S}${-e}D`;else if(e>0)s+=`${S}${e}C`;if(t<0)s+=`${S}${-t}A`;else if(t>0)s+=`${S}${t}B`;return s},up:(e=1)=>`${S}${e}A`,down:(e=1)=>`${S}${e}B`,forward:(e=1)=>`${S}${e}C`,backward:(e=1)=>`${S}${e}D`,nextLine:(e=1)=>`${S}E`.repeat(e),prevLine:(e=1)=>`${S}F`.repeat(e),left:`${S}G`,hide:`${S}?25l`,show:`${S}?25h`,save:`${ue}7`,restore:`${ue}8`},hi={up:(e=1)=>`${S}S`.repeat(e),down:(e=1)=>`${S}T`.repeat(e)},te={screen:`${S}2J`,up:(e=1)=>`${S}1J`.repeat(e),down:(e=1)=>`${S}J`.repeat(e),line:`${S}2K`,lineEnd:`${S}K`,lineStart:`${S}1K`,lines(e){let t="";for(let s=0;s<e;s++)t+=this.line+(s<e-1?k.up():"");if(e)t+=k.left;return t}},mi={screen:`${ue}c`};function Rt(e,t){let s=[];for(let i=0;i<=t.length;i++)s[i]=[i];for(let i=0;i<=e.length;i++)s[0][i]=i;for(let i=1;i<=t.length;i++)for(let r=1;r<=e.length;r++)if(t.charAt(i-1)===e.charAt(r-1))s[i][r]=s[i-1][r-1];else s[i][r]=Math.min(s[i-1][r-1]+1,s[i][r-1]+1,s[i-1][r]+1);return s[t.length][e.length]}function Ye(e,t,s=2,i=3){return t.map((r)=>({cmd:r,distance:Rt(e,r)})).filter(({distance:r})=>r<=s).sort((r,o)=>r.distance-o.distance).slice(0,i).map(({cmd:r})=>r)}class Je{rawName;description;name;names;isBoolean;required;config;negated;constructor(e,t,s){if(this.rawName=e,this.description=t,this.config=Object.assign({},s),e=e.replace(/\.\*/g,""),this.negated=!1,this.names=ve(e).split(",").map((i)=>{let r=i.trim().replace(/^-{1,2}/,"");if(r.startsWith("no-"))this.negated=!0,r=r.replace(/^no-/,"");return ze(r)}).sort((i,r)=>i.length>r.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(e.includes("<"))this.required=!0;else if(e.includes("["))this.required=!1;else this.isBoolean=!0}}var fi=we.argv,jt=`${we.platform}-${we.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,Ae=ae.argv,Lt=`${ae.platform}-${ae.arch} node-${ae.version}`;class _e{rawName;description;config;cli;options;aliasNames;name;namespace;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;beforeHooks;afterHooks;middleware;constructor(e,t,s,i){this.rawName=e,this.description=t,this.config=s,this.cli=i,this.options=[],this.aliasNames=[],this.name=ve(e);let r=ve(e),o=r.indexOf(":");if(o>0)this.namespace=r.substring(0,o),this.name=r.substring(o+1);if(this.args=Bt(e),this.examples=[],this.beforeHooks=[],this.afterHooks=[],this.middleware=[],!s)this.config={}}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,t="-v, --version"){return this.versionNumber=e,this.option(t,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,t,s){let i=new Je(e,t,s);return this.options.push(i),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}before(e){return this.beforeHooks.push(e),this}after(e){return this.afterHooks.push(e),this}use(e){return this.middleware.push(e),this}isMatched(e){if(this.aliasNames.includes(e))return!0;if(this.namespace)return`${this.namespace}:${this.name}`===e;return this.name===e}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof Ie}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(e){return e=e.split(".")[0],!!this.options.find((t)=>t.names.includes(e))}outputHelp(){let{name:e,commands:t}=this.cli,{versionNumber:s,options:i,helpCallback:r}=this.cli.globalCommand,o=[{body:`${e}${s?`/${s}`:""}`}];if(o.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&t.length>0){let a=Me(t.map((d)=>d.rawName)),c=new Map,h=[];for(let d of t)if(d.namespace){if(!c.has(d.namespace))c.set(d.namespace,[]);c.get(d.namespace).push(d)}else h.push(d);let f="";if(h.length>0)f+=h.map((d)=>` ${pe(d.rawName,a.length)} ${d.description}`).join(`
|
|
6
|
-
`);let p=Array.from(c.keys()).sort();for(let d of p){let v=c.get(d);if(f.length>0)f+=`
|
|
7
|
-
|
|
8
|
-
`;f+=` ${d}:
|
|
9
|
-
`,f+=v.map((y)=>` ${pe(y.rawName,a.length-2)} ${y.description}`).join(`
|
|
10
|
-
`)}o.push({title:"Commands",body:f}),o.push({title:"For more info, run any command with the `--help` flag",body:t.map((d)=>` $ ${e}${d.displayName===""?"":` ${d.displayName}`} --help`).join(`
|
|
11
|
-
`)})}let u=this.isGlobalCommand?i:[...this.options,...i||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand)u=u.filter((a)=>a.name!=="version");if(u.length>0){let a=Me(u.map((c)=>c.rawName));o.push({title:"Options",body:u.map((c)=>` ${pe(c.rawName,a.length)} ${c.description} ${c.config.default===void 0?"":`(default: ${c.config.default})`}`).join(`
|
|
12
|
-
`)})}if(this.examples.length>0)o.push({title:"Examples",body:this.examples.map((a)=>{if(typeof a==="function")return a(e);return a}).join(`
|
|
13
|
-
`)});if(r)o=r(o)||o;console.log(o.map((a)=>a.title?`${a.title}:
|
|
14
|
-
${a.body}`:a.body).join(`
|
|
15
|
-
|
|
16
|
-
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:t}=this.cli.globalCommand;if(t)console.log(`${e}/${t} ${typeof Bun<"u"?jt:Lt}`)}checkRequiredArgs(){let e=this.args.filter((t)=>t.required).length;if(this.cli.args.length<e){let s=this.args.filter((r)=>r.required).slice(this.cli.args.length),i=s.map((r)=>`<${r.value}>`).join(" ");throw new oe(`Missing required argument${s.length>1?"s":""}: ${i}
|
|
17
|
-
|
|
18
|
-
Run \`${this.cli.name} ${this.rawName} --help\` for usage information.`)}}checkUnknownOptions(){let{options:e,globalCommand:t}=this.cli;if(!this.config.allowUnknownOptions){for(let s of Object.keys(e))if(s!=="--"&&!this.hasOption(s)&&!t.hasOption(s)){let r=[...t.options,...this.options].flatMap((a)=>a.names),o=s.length>1?`--${s}`:`-${s}`,l=Ye(s,r),u=`Unknown option \`${o}\``;if(l.length>0)u+=`
|
|
19
|
-
|
|
20
|
-
Did you mean one of these?`,l.forEach((a)=>{let c=a.length>1?`--${a}`:`-${a}`;u+=`
|
|
21
|
-
\u2022 ${c}`});throw u+=`
|
|
22
|
-
|
|
23
|
-
Run \`${this.cli.name} ${this.rawName} --help\` to see available options.`,new oe(u)}}}checkOptionValue(){let{options:e,globalCommand:t}=this.cli,s=[...t.options,...this.options];for(let i of s){let r=e[i.name.split(".")[0]];if(i.required){let o=s.some((l)=>l.negated&&l.names.includes(i.name));if(r===!0||r===!1&&!o)throw new oe(`Option \`${i.rawName}\` requires a value.
|
|
24
|
-
|
|
25
|
-
Example: ${this.cli.name} ${this.rawName} ${i.rawName} <value>`)}}}}class Ie extends _e{constructor(e){super("@@global@@","",{},e)}}var Dt=_e,F={red:["\x1B[31m","\x1B[39m"],green:["\x1B[32m","\x1B[39m"],blue:["\x1B[34m","\x1B[39m"],yellow:["\x1B[33m","\x1B[39m"],cyan:["\x1B[36m","\x1B[39m"],magenta:["\x1B[35m","\x1B[39m"],white:["\x1B[37m","\x1B[39m"],gray:["\x1B[90m","\x1B[39m"],bgRed:["\x1B[41m","\x1B[49m"],bgGreen:["\x1B[42m","\x1B[49m"],bgBlue:["\x1B[44m","\x1B[49m"],bgYellow:["\x1B[43m","\x1B[49m"],bgCyan:["\x1B[46m","\x1B[49m"],bgMagenta:["\x1B[45m","\x1B[49m"],bold:["\x1B[1m","\x1B[22m"],italic:["\x1B[3m","\x1B[23m"],underline:["\x1B[4m","\x1B[24m"],dim:["\x1B[2m","\x1B[22m"],inverse:["\x1B[7m","\x1B[27m"],hidden:["\x1B[8m","\x1B[28m"],strikethrough:["\x1B[9m","\x1B[29m"]},ye={default:{primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"},dracula:{primary:"magenta",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"blue",muted:"gray"},nord:{primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"cyan",muted:"gray"},solarized:{primary:"cyan",secondary:"blue",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"},monokai:{primary:"magenta",secondary:"blue",success:"green",warning:"yellow",error:"red",info:"cyan",muted:"gray"}},J={primary:"blue",secondary:"cyan",success:"green",warning:"yellow",error:"red",info:"magenta",muted:"gray"};function Wt(){return!0}function Pt(){let e={};e.supportsColor=Wt();function t(i,r=[]){let o=i===""?[]:[...r,i],l=function(a){if(!e.supportsColor)return a;let c="",h="";for(let f of o)if(f in J&&J[f]in F){let p=J[f];c+=F[p][0],h=F[p][1]+h}else if(f in F)c+=F[f][0],h=F[f][1]+h;return c+a+h},u=[...Object.keys(F),...Object.keys(J)];for(let a of u)if(!(a in l))Object.defineProperty(l,a,{get(){return t(a,o)}});return l}let s=[...Object.keys(F),...Object.keys(J)];for(let i of s)if(!(i in e))Object.defineProperty(e,i,{get(){return t(i)}});return e}var K=Pt();function Ft(e){for(let t in e)if(e[t]!==void 0)J[t]=e[t]}function gi(e){if(e in ye)Ft(ye[e])}function $i(){return Object.keys(ye)}function vi(e){if(e.colors!==void 0)K.supportsColor=e.colors}function wi(e,t){let s=t?.title?` ${t.title} `:"",i=t?.padding||0,r=" ".repeat(i),o=e.split(`
|
|
26
|
-
`),u=Math.max(...o.map((c)=>c.length))+i*2,a=u;console.log(`\u250C${s?"\u2500".repeat(Math.floor((a-s.length)/2))+s+"\u2500".repeat(Math.ceil((a-s.length)/2)):"\u2500".repeat(a)}\u2510`),console.log(`\u2502${" ".repeat(a)}\u2502`);for(let c of o){let h=u-c.length-i;console.log(`\u2502${r}${c}${" ".repeat(h)}\u2502`)}console.log(`\u2502${" ".repeat(a)}\u2502`),console.log(`\u2514${"\u2500".repeat(a)}\u2518`)}function yi(e){let t=e?.title?` ${e.title} `:"",i=e.content.split(`
|
|
27
|
-
`),o=Math.max(...i.map((l)=>l.length))+2;console.log(`\u2554${t?"\u2550".repeat(Math.floor((o-t.length)/2))+t+"\u2550".repeat(Math.ceil((o-t.length)/2)):"\u2550".repeat(o)}\u2557`),console.log(`\u2551${" ".repeat(o)}\u2551`);for(let l of i){let u=o-l.length-1;console.log(`\u2551 ${l}${" ".repeat(u)}\u2551`)}console.log(`\u2551${" ".repeat(o)}\u2551`),console.log(`\u255A${"\u2550".repeat(o)}\u255D`)}function bi(e,t){if(!e||e.length===0)return;let s=Array.from({length:e[0].length},()=>0);for(let r of e)for(let o=0;o<r.length;o++)s[o]=Math.max(s[o],String(r[o]).length);if(t?.border)console.log(`\u250C${s.map((r)=>"\u2500".repeat(r+2)).join("\u252C")}\u2510`);if(t?.header&&e.length>0)if(console.log((t.border?"\u2502 ":"")+e[0].map((r,o)=>`${r}${" ".repeat(s[o]-String(r).length)}`).join(" \u2502 ")+(t.border?" \u2502":"")),t.border)console.log(`\u251C${s.map((r)=>"\u2500".repeat(r+2)).join("\u253C")}\u2524`);else console.log(`${s.map((r)=>"\u2500".repeat(r)).join("\u2500\u253C\u2500")}`);let i=t?.header?1:0;for(let r=i;r<e.length;r++)console.log((t?.border?"\u2502 ":"")+e[r].map((o,l)=>`${o}${" ".repeat(s[l]-String(o).length)}`).join(" \u2502 ")+(t?.border?" \u2502":""));if(t?.border)console.log(`\u2514${s.map((r)=>"\u2500".repeat(r+2)).join("\u2534")}\u2518`)}class Qe extends Ot{name;commands;globalCommand;matchedCommand;matchedCommandName;rawArgs;args;options;showHelpOnExit;showVersionOnExit;enableDidYouMean=!0;signalHandlersSet=!1;isVerbose=!1;isQuiet=!1;isDebug=!1;isNoInteraction=!1;environment;isDryRun=!1;isForce=!1;useEmoji=!0;theme;isNoCache=!1;constructor(e=""){super();this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new Ie(this),this.globalCommand.usage("<command> [options]")}handleSignals(e){if(this.signalHandlersSet)return this;let t=async(s)=>{if(console.log(`
|
|
28
|
-
|
|
29
|
-
Received ${s}, cleaning up...`),e)try{await e()}catch(i){console.error("Error during cleanup:",i)}P.exit(0)};return P.on("SIGINT",()=>t("SIGINT")),P.on("SIGTERM",()=>t("SIGTERM")),this.signalHandlersSet=!0,this}didYouMean(e=!0){return this.enableDidYouMean=e,this}verbose(){return this.globalCommand.option("-v, --verbose","Enable verbose output"),this}quiet(){return this.globalCommand.option("-q, --quiet","Suppress non-essential output"),this}debug(){return this.globalCommand.option("--debug","Enable debug mode with detailed error information"),this}noInteraction(){return this.globalCommand.option("-n, --no-interaction","Do not ask any interactive questions (for CI/CD)"),this}env(){return this.globalCommand.option("--env <environment>","Target environment (e.g., production, staging, local)"),this}dryRun(){return this.globalCommand.option("--dry-run","Preview actions without executing them"),this}force(){return this.globalCommand.option("-f, --force","Skip confirmation prompts"),this}emoji(){return this.globalCommand.option("--no-emoji","Disable emoji in output"),this}themes(){return this.globalCommand.option("--theme <theme>","Color theme (default, dracula, nord, solarized, monokai)"),this}cache(){return this.globalCommand.option("--no-cache","Disable caching"),this}usage(e){return this.globalCommand.usage(e),this}command(e,t,s){if(!s)s={};let i=new Dt(e,t||"",s,this);return i.globalCommand=this.globalCommand,this.commands.push(i),i}option(e,t,s){return this.globalCommand.option(e,t,s),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,t="-v, --version"){return this.globalCommand.version(e,t),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){if(this.matchedCommand)this.matchedCommand.outputHelp();else this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:t},s,i){if(this.args=e,this.options=t,s)this.matchedCommand=s;if(i)this.matchedCommandName=i;return this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}showCommandNotFound(e){if(console.log(K.red(`
|
|
30
|
-
\u2717 Command "${e}" not found.
|
|
31
|
-
`)),this.enableDidYouMean){let t=[];for(let i of this.commands){if(i.displayName)t.push(i.displayName);if(i.aliasNames)t.push(...i.aliasNames)}let s=Ye(e,t);if(s.length>0)console.log(K.yellow("Did you mean one of these?")),s.forEach((i)=>console.log(` ${K.dim("\u2022")} ${this.name} ${i}`)),console.log("")}console.log(K.dim("Run"),`${this.name} --help`,K.dim("to see all available commands")),P.exit(1)}async parse(e=Ae,t={}){let{run:s=!0,exitOnError:i=!1}=t;if(i)try{return await this.parse(e,{run:s})}catch(a){throw this.handleUsageError(a),a}if(this.rawArgs=e,!this.name)this.name=e[1]?At(e[1]):"cli";let r=!0,o=e.slice(2),l=o[0];if(l&&!l.startsWith("-")){for(let a of this.commands)if(a.isMatched(l)){let c=this.mri(o,a);r=!1;let h={...c,args:c.args.slice(1)};this.setParsedInfo(h,a,l),this.emit(`command:${l}`,a);break}}if(r){for(let a of this.commands)if(a.name===""){r=!1;let c=this.mri(o,a);this.setParsedInfo(c,a),this.emit("command:!",a);break}}if(r){let a=this.mri(e.slice(2));this.setParsedInfo(a)}if(this.options.verbose)this.isVerbose=!0;if(this.options.quiet)this.isQuiet=!0;if(this.options.debug)this.isDebug=!0;if(this.options.noInteraction)this.isNoInteraction=!0;if(this.options.env)this.environment=String(this.options.env);if(this.options.dryRun)this.isDryRun=!0;if(this.options.force)this.isForce=!0;if(this.options.noEmoji!==void 0)this.useEmoji=!this.options.noEmoji;if(this.options.theme)this.theme=String(this.options.theme);if(this.options.noCache!==void 0)this.isNoCache=Boolean(this.options.noCache);if(this.options.help&&this.showHelpOnExit)this.outputHelp(),s=!1,this.unsetMatchedCommand();if(this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null)this.outputVersion(),s=!1,this.unsetMatchedCommand();let u={args:this.args,options:this.options};if(s)await this.runMatchedCommand();if(!this.matchedCommand&&this.args[0]){if(this.emit("command:*"),!(this.listenerCount("command:*")>0))this.showCommandNotFound(this.args[0])}return u}mri(e,t){let s=[...this.globalCommand.options,...t?t.options:[]],i=Tt(s),r=[],o=e.indexOf("--");if(o>-1)r=e.slice(o+1),e=e.slice(0,o);let l=Et(e,i),u={_:l._};for(let p of Object.keys(l))if(p!=="_")u[ze(p)]=l[p];let a=u._,c={"--":r},h=t&&t.config.ignoreOptionDefaultValue?t.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,f=Object.create(null);for(let p of s){if(!h&&p.config.default!==void 0)for(let d of p.names)c[d]=p.config.default;if(Array.isArray(p.config.type)){if(f[p.name]===void 0)f[p.name]={shouldTransform:!0,transformFunction:p.config.type[0]}}}for(let p of Object.keys(u))if(p!=="_"){let d=p.split(".");Vt(c,d,u[p]),Mt(c,f)}return{args:a,options:c}}async run(e=Ae){return this.parse(e,{run:!0,exitOnError:!0})}handleUsageError(e){if(!(!!e&&typeof e==="object"&&e.name==="ClappError"&&e.isUsageError!==!1))return;let i=e,r=i.message??"command-line error",o=this.name?`${this.name}: `:"",l=/--help/.test(r)?"":`
|
|
32
|
-
Run \`${this.name??"cli"} --help\` for usage.`;P.stderr.write(`${o}${r}${l}
|
|
33
|
-
`),P.exit(i.exitCode??2)}async runMatchedCommand(){let{args:e,options:t,matchedCommand:s}=this;if(!s||!s.commandAction)return;s.checkUnknownOptions(),s.checkOptionValue(),s.checkRequiredArgs();let i=[];s.args.forEach((u,a)=>{if(u.variadic)i.push(e.slice(a));else i.push(e[a])}),i.push(t);let r={command:s,args:i,options:t};for(let u of s.beforeHooks)await u(r);let o,l=async()=>{let u=s.commandAction.apply(this,i);if(u instanceof Promise)o=await u;else o=u;return o};if(s.middleware.length>0){let u=0,a=async()=>{if(u<s.middleware.length){let c=s.middleware[u++];await c({...r,next:a})}else await l()};await a()}else await l();for(let u of s.afterHooks)await u(r);return o}removeSignalHandlers(){if(!this.signalHandlersSet)return this;return P.removeAllListeners("SIGINT"),P.removeAllListeners("SIGTERM"),this.signalHandlersSet=!1,this}destroy(){this.removeSignalHandlers(),this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.matchedCommand=void 0,this.matchedCommandName=void 0,this.removeAllListeners()}}var Xe=(e="")=>new Qe(e);class Ze{cache;enabled;cleanupInterval=null;hits=0;misses=0;constructor(){this.cache=new Map,this.enabled=!0,this.startCleanupInterval()}startCleanupInterval(){if(this.cleanupInterval)return;this.cleanupInterval=setInterval(()=>{this.cleanup()},30000),this.cleanupInterval.unref()}stopCleanup(){if(this.cleanupInterval)clearInterval(this.cleanupInterval),this.cleanupInterval=null}isEnabled(){return this.enabled}get(e){if(!this.enabled){this.misses++;return}let t=this.cache.get(e);if(!t){this.misses++;return}if(Date.now()-t.timestamp>t.ttl){this.cache.delete(e),this.misses++;return}return this.hits++,t.value}set(e,t,s=5000){if(!this.enabled)return;this.cache.set(e,{value:t,timestamp:Date.now(),ttl:s})}has(e){if(!this.enabled)return!1;let t=this.cache.get(e);if(!t)return!1;if(Date.now()-t.timestamp>t.ttl)return this.cache.delete(e),!1;return!0}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}disable(){this.enabled=!1,this.clear()}enable(){this.enabled=!0}stats(){return{size:this.cache.size,enabled:this.enabled,hits:this.hits,misses:this.misses}}resetStats(){this.hits=0,this.misses=0}keys(){return Array.from(this.cache.keys())}cleanup(){let e=Date.now();for(let[t,s]of this.cache.entries())if(e-s.timestamp>s.ttl)this.cache.delete(t)}destroy(){this.stopCleanup(),this.clear(),this.resetStats()}}var xi=new Ze;function Si(e,t){e.on(`${t}:*`,()=>{let s=e.args??[];Ne.stderr.write(`Unknown ${t} subcommand: ${[...s].join(" ")}
|
|
34
|
-
Run \`${e.name??"cli"} ${t} --help\` to see available subcommands.
|
|
35
|
-
`),Ne.exit(64)})}function Ht(){if("FORCE_COLOR"in Z.env)return Z.env.FORCE_COLOR!=="0";if("NO_COLOR"in Z.env||Z.env.TERM==="dumb")return!1;if(Z.platform==="win32")return!0;return Re.isatty(1)&&Re.isatty(2)}var et=Ht();function _(e,t){if(!et)return(s)=>s;return(s)=>e+s+t}var Ut=_("\x1B[0m","\x1B[0m"),Gt=_("\x1B[31m","\x1B[39m"),tt=_("\x1B[32m","\x1B[39m"),Kt=_("\x1B[33m","\x1B[39m"),qt=_("\x1B[34m","\x1B[39m"),zt=_("\x1B[35m","\x1B[39m"),Yt=_("\x1B[36m","\x1B[39m"),Jt=_("\x1B[37m","\x1B[39m"),st=_("\x1B[90m","\x1B[39m"),it=_("\x1B[1m","\x1B[22m"),Qt=_("\x1B[3m","\x1B[23m"),Xt=_("\x1B[4m","\x1B[24m"),nt=_("\x1B[2m","\x1B[22m"),Zt=_("\x1B[7m","\x1B[27m"),es=_("\x1B[8m","\x1B[28m"),ts=_("\x1B[9m","\x1B[29m"),ss=_("\x1B[41m","\x1B[49m"),is=_("\x1B[42m","\x1B[49m"),ns=_("\x1B[43m","\x1B[49m"),rs=_("\x1B[44m","\x1B[49m"),os=_("\x1B[45m","\x1B[49m"),as=_("\x1B[46m","\x1B[49m"),ls=_("\x1B[47m","\x1B[49m"),us=et,cs={reset:Ut,red:Gt,green:tt,yellow:Kt,blue:qt,magenta:zt,cyan:Yt,white:Jt,gray:st,bold:it,italic:Qt,underline:Xt,dim:nt,inverse:Zt,hidden:es,strikethrough:ts,bgRed:ss,bgGreen:is,bgYellow:ns,bgBlue:rs,bgMagenta:os,bgCyan:as,bgWhite:ls,isColorSupported:us},n=cs,fs=["up","down","left","right","space","enter","cancel"],N={actions:new Set(fs),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"}};function Bi(e){if(e.aliases!==void 0){let t=e.aliases;for(let s in t){if(!Object.hasOwn(t,s))continue;let i=t[s];if(!N.actions.has(i))continue;if(!N.aliases.has(s))N.aliases.set(s,i)}}if(e.messages!==void 0){let t=e.messages;if(t.cancel!==void 0)N.messages.cancel=t.cancel;if(t.error!==void 0)N.messages.error=t.error}}function Oe(e,t){if(typeof e==="string")return N.aliases.get(e)===t;for(let s of e){if(s===void 0)continue;if(Oe(s,t))return!0}return!1}function ps(e,t){if(e===t)return[];let s=e.split(`
|
|
36
|
-
`),i=t.split(`
|
|
37
|
-
`),r=[];for(let o=0;o<Math.max(s.length,i.length);o++)if(s[o]!==i[o])r.push(o);return r}var gs=rt.platform.startsWith("win"),be=Symbol("clapp:cancel");function $s(e){return e===be}function re(e,t){let s=e;if(s.isTTY)s.setRawMode(t)}function vs(e){let{input:t=hs,output:s=ms,overwrite:i=!0,hideCursor:r=!0}=e||{},o=U.createInterface({input:t,output:s,prompt:"",tabSize:1});if(U.emitKeypressEvents(t,o),t instanceof je&&t.isTTY)t.setRawMode(!0);let l=(u,{name:a,sequence:c})=>{let h=String(u);if(Oe([h,a,c],"cancel")){if(r)s.write(k.show);rt.exit(0);return}if(!i)return;U.moveCursor(s,a==="return"?0:-1,a==="return"?-1:0,()=>{U.clearLine(s,1,()=>{t.once("keypress",l)})})};if(r)s.write(k.hide);return t.once("keypress",l),()=>{if(t.off("keypress",l),r)s.write(k.show);if(t instanceof je&&t.isTTY&&!gs)t.setRawMode(!1);o.terminal=!1,o.close()}}function ws(e){if(e instanceof ds&&e.columns)return e.columns;return 80}function Cs(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function Ss(e){return Cs(e).length}function De(e,t,s){if(!t||t<1)return e;let i=s?.hard??!1,r=s?.trim??!0,o=e.split(`
|
|
38
|
-
`),l=[];for(let u of o){if(Ss(u)<=t){l.push(r?u.trimEnd():u);continue}if(i){let a="",c=0,h=0;while(h<u.length){let f=u.slice(h).match(/^\x1b\[[0-9;]*m/);if(f){a+=f[0],h+=f[0].length;continue}if(c>=t)l.push(r?a.trimEnd():a),a="",c=0;a+=u[h],c++,h++}if(a)l.push(r?a.trimEnd():a)}else l.push(r?u.trimEnd():u)}return l.join(`
|
|
39
|
-
`)}class D{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;_manualLine="";state="initial";error="";value;userInput="";constructor(e,t=!0){let{input:s=ys,output:i=bs,render:r,signal:o,...l}=e;this.opts=l,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=r.bind(this),this._track=t,this._abortSignal=o,this.input=s,this.output=i}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let s=this._subscribers.get(e)??[];s.push(t),this._subscribers.set(e,s)}on(e,t){return this.setSubscriber(e,{cb:t}),this}once(e,t){return this.setSubscriber(e,{cb:t,once:!0}),this}emit(e,...t){let s=this._subscribers.get(e)??[],i=[];for(let r of s)if(r.cb(...t),r.once)i.push(()=>s.splice(s.indexOf(r),1));for(let r of i)r();return this}prompt(){return new Promise((e)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),e(be);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}if(this.rl=xs.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0)this._setUserInput(this.opts.initialUserInput,!0);this.input.on("keypress",this.onKeypress),re(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(k.show),this.output.off("resize",this.render),re(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(k.show),this.output.off("resize",this.render),re(this.input,!1),e(be)})})}_isActionKey(e,t){return e==="\t"}_setValue(e){this.value=e,this.emit("value",this.value)}_setUserInput(e,t){if(this.userInput=e??"",this.emit("userInput",this.userInput),t&&this._track&&this.rl)this.rl.write(this.userInput),this._cursor=this.rl.cursor}onKeypress(e,t){if(this._track&&t.name!=="return"){if(t.name&&this._isActionKey(e,t))this.rl?.write(null,{ctrl:!0,name:"h"});this._cursor=this.rl?.cursor??0;let s=t.name==="tab"||t.name==="escape"||t.name==="backspace"||t.name==="delete"||t.name==="enter"||t.name==="return"||t.name&&["up","down","left","right"].includes(t.name);if(e&&!s&&e.length===1&&e>=" ")this._manualLine+=e;else if(t.name==="backspace"&&this._manualLine.length>0)this._manualLine=this._manualLine.slice(0,-1);let i=this._manualLine.length>=(this.rl?.line?.length||0)?this._manualLine:this.rl?.line;this._setUserInput(i)}if(this.state==="error")this.state="active",this.error="";if(t?.name){if(!this._track&&N.aliases.has(t.name))this.emit("cursor",N.aliases.get(t.name));if(N.actions.has(t.name))this.emit("cursor",t.name)}if(e&&(e.toLowerCase()==="y"||e.toLowerCase()==="n"))this.emit("confirm",e.toLowerCase()==="y");if(this.emit("key",e?.toLowerCase(),t),t?.name==="return"){if(this.opts.validate){let s=this.opts.validate(this.value);if(s)this.error=s instanceof Error?s.message:s,this.state="error"}if(this.state!=="error")this.state="submit"}if(Oe([e,t?.name,t?.sequence],"cancel"))this.state="cancel";if(this.state==="submit"||this.state==="cancel")this.emit("finalize");if(this.render(),this.state==="submit"||this.state==="cancel")this.close()}close(){if(this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
40
|
-
`),re(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.state==="cancel")setTimeout(()=>{this.unsubscribe()},10);else this.unsubscribe()}restoreCursor(){let e=De(this._prevFrame,Le.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
41
|
-
`).length-1;this.output.write(k.move(-999,e*-1))}render(){let e=De(this._render(this)??"",Le.stdout.columns,{hard:!0,trim:!1});if(e===this._prevFrame)return;if(this.state==="initial")this.output.write(k.hide);else{let t=ps(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let s=t[0];this.output.write(k.move(0,s)),this.output.write(te.lines(1));let i=e.split(`
|
|
42
|
-
`);this.output.write(i[s]),this._prevFrame=e,this.output.write(k.move(0,i.length-s-1));return}if(t&&t?.length>1){let s=t[0];this.output.write(k.move(0,s)),this.output.write(te.down());let r=e.split(`
|
|
43
|
-
`).slice(s);this.output.write(r.join(`
|
|
44
|
-
`)),this._prevFrame=e;return}this.output.write(te.down())}if(this.output.write(e),this.state==="initial")this.state="active";this._prevFrame=e}}function _s(e,t){if(e===void 0)return 0;if(t.length===0)return 0;let i=t.findIndex((r)=>r.value===e);return i!==-1?i:0}function Is(e,t){return(t.label??String(t.value)).toLowerCase().includes(e.toLowerCase())}function Os(e,t){if(!t)return;if(e)return t;return t[0]}class Ee extends D{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#e=0;#s="";#i;#t;get cursor(){return this.#e}get userInputWithCursor(){if(!this.userInput)return n.inverse(n.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}\u2588`;let e=this.userInput.slice(0,this._cursor),[t,...s]=this.userInput.slice(this._cursor);return`${e}${n.inverse(t)}${s.join("")}`}get options(){if(typeof this.#t==="function")return this.#t();return this.#t}constructor(e){super(e);this.#t=e.options;let t=this.options;this.filteredOptions=[...t],this.multiple=e.multiple===!0,this.#i=e.filter??Is;let s;if(e.initialValue&&Array.isArray(e.initialValue))if(this.multiple)s=e.initialValue;else s=e.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)s=[this.options[0].value];if(s)for(let i of s){let r=t.findIndex((o)=>o.value===i);if(r!==-1)this.toggleSelected(i),this.#e=r}this.focusedValue=this.options[this.#e]?.value,this.on("key",(i,r)=>this.#n(i,r)),this.on("userInput",(i)=>this.#r(i))}_isActionKey(e,t){return e==="\t"||this.multiple&&this.isNavigating&&t.name==="space"&&e!==void 0&&e!==""}#n(e,t){let s=t.name==="up",i=t.name==="down",r=t.name==="return";if(s||i){if(this.#e=Math.max(0,Math.min(this.#e+(s?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#e]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(r)this.value=Os(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&(t.name==="tab"||this.isNavigating&&t.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected(e){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes(e))this.selectedValues=this.selectedValues.filter((t)=>t!==e);else this.selectedValues=[...this.selectedValues,e];else this.selectedValues=[e]}#r(e){if(e!==this.#s){this.#s=e;let t=this.options;if(e)this.filteredOptions=t.filter((s)=>this.#i(e,s));else this.filteredOptions=[...t];if(this.#e=_s(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#e]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class ot extends D{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1);this.value=!!e.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(t)=>{this.output.write(k.move(0,-1)),this.value=t,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}class at extends D{options;cursor=0;#e;getGroupItems(e){return this.options.filter((t)=>t.group===e)}isGroupSelected(e){let t=this.getGroupItems(e),s=this.value;if(s===void 0)return!1;return t.every((i)=>s.includes(i.value))}toggleValue(){let e=this.options[this.cursor];if(this.value===void 0)this.value=[];if(e.group===!0){let t=String(e.value),s=this.getGroupItems(t);if(this.isGroupSelected(t))this.value=this.value.filter((i)=>s.findIndex((r)=>r.value===i)===-1);else this.value=[...this.value,...s.map((i)=>i.value)];this.value=Array.from(new Set(this.value))}else{let t=this.value.includes(e.value);this.value=t?this.value.filter((s)=>s!==e.value):[...this.value,e.value]}}constructor(e){super(e,!1);let{options:t}=e;this.#e=e.selectableGroups!==!1,this.options=Object.entries(t).flatMap(([s,i])=>[{value:s,group:!0,label:s},...i.map((r)=>({...r,group:s}))]),this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:s})=>s===e.cursorAt),this.#e?0:1),this.on("cursor",(s)=>{switch(s){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let i=this.options[this.cursor]?.group===!0;if(!this.#e&&i)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let i=this.options[this.cursor]?.group===!0;if(!this.#e&&i)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}class lt extends D{options;cursor=0;get _value(){return this.options[this.cursor].value}toggleAll(){let e=this.value!==void 0&&this.value.length===this.options.length;this.value=e?[]:this.options.map((t)=>t.value)}toggleValue(){if(this.value===void 0)this.value=[];let e=this.value.includes(this._value);this.value=e?this.value.filter((t)=>t!==this._value):[...this.value,this._value]}constructor(e){super(e,!1);this.options=e.options,this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0),this.on("key",(t)=>{if(t==="a")this.toggleAll()}),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}}class ut extends D{_mask="\u2022";get cursor(){return this._cursor}get masked(){return this.userInput.replaceAll(/./g,this._mask)}get userInputWithCursor(){if(this.state==="submit"||this.state==="cancel")return this.masked;let e=this.userInput;if(this.cursor>=e.length)return`${this.masked}${n.inverse(n.hidden("_"))}`;let t=this.masked,s=t.slice(0,this.cursor),i=t.slice(this.cursor);return`${s}${n.inverse(i[0])}${i.slice(1)}`}constructor({mask:e,...t}){super(t);this._mask=e??"\u2022",this.on("userInput",(s)=>{this._setValue(s)})}}class ct extends D{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(e){super(e,!1);if(this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1)this.cursor=0;this.changeValue(),this.on("cursor",(t)=>{switch(t){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}}class ht extends D{options;cursor=0;constructor(e){super(e,!1);this.options=e.options;let t=this.options.map(({value:[s]})=>s?.toLowerCase());this.cursor=Math.max(t.indexOf(e.initialValue),0),this.on("key",(s)=>{if(!s||!t.includes(s))return;let i=this.options.find(({value:[r]})=>r?.toLowerCase()===s);if(i)this.value=i.value,this.state="submit",this.emit("submit")})}}class mt extends D{placeholder;get userInputWithCursor(){if(this.state==="submit")return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let t=e.slice(0,this.cursor),[s,...i]=e.slice(this.cursor);return`${t}${n.inverse(s)}${i.join("")}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue});this.placeholder=e.placeholder,this.on("key",(t)=>{if(t==="\t"&&this.placeholder){if(!this.userInput||this.userInput==="\t")this._setValue(this.placeholder),this._setUserInput(this.placeholder,!0)}}),this.on("userInput",(t)=>{this._setValue(t)}),this.on("finalize",()=>{if(!this.userInput&&this.placeholder)this.value=this.placeholder;if(!this.value)this.value=e.defaultValue;if(this.value===void 0)this.value=""})}}var xe=Nt(),dt=()=>Es.env.CI==="true";function Bs(e){return e.isTTY===!0}var C=(e,t)=>xe?e:t,Ts=C("\u25C6","*"),ft=C("\u25A0","x"),pt=C("\u25B2","x"),X=C("\u25C7","o"),ks=C("\u250C","T"),m=C("\u2502","|"),T=C("\u2514","\u2014"),ce=C("\u25CF",">"),he=C("\u25CB"," "),Ce=C("\u25FB","[\u2022]"),Q=C("\u25FC","[+]"),Be=C("\u25FB","[ ]"),Vs=C("\u25AA","\u2022"),We=C("\u2500","-"),Ms=C("\u256E","+"),As=C("\u251C","+"),Ns=C("\u256F","+"),gt=C("\u25CF","\u2022"),$t=C("\u25C6","*"),vt=C("\u25B2","!"),wt=C("\u25A0","x");function W(e){switch(e){case"initial":case"active":return n.cyan(Ts);case"cancel":return n.red(ft);case"error":return n.yellow(pt);case"submit":return n.green(X)}}function q(e){return e.replace(/_([^_]+)_/g,(t,s)=>K.italic(s))}function se(e){let{cursor:t,options:s,style:i}=e,r=e.output??Rs.stdout,o=r instanceof js&&r.rows!==void 0?r.rows:10,l=n.dim("..."),u=e.maxItems??Number.POSITIVE_INFINITY,a=Math.max(o-4,0),c=Math.min(a,Math.max(u,5)),h=0;if(t>=h+c-3)h=Math.max(Math.min(t-c+3,s.length-c),0);else if(t<h+2)h=Math.max(t-2,0);let f=c<s.length&&h>0,p=c<s.length&&h+c<s.length;return s.slice(h,h+c).map((d,v,y)=>{let g=v===0&&f,w=v===y.length-1&&p;return g||w?l:i(d,v+h===t)})}function Pe(e){return e.label??String(e.value??"")}function yt(e,t){if(!e)return!0;let s=(t.label??String(t.value??"")).toLowerCase(),i=(t.hint??"").toLowerCase(),r=String(t.value).toLowerCase(),o=e.toLowerCase();return s.includes(o)||i.includes(o)||r.includes(o)}function Ls(e,t){let s=[];for(let i of t)if(e.includes(i.value))s.push(i);return s}function Ds(e){return new Ee({options:e.options,initialValue:e.initialValue?[e.initialValue]:void 0,initialUserInput:e.initialUserInput,filter:(s,i)=>yt(s,i),signal:e.signal,input:e.input,output:e.output,validate:e.validate,render(){let s=`${n.gray(m)}
|
|
45
|
-
${W(this.state)} ${e.message}
|
|
46
|
-
`,i=this.userInput,r=String(this.value??""),o=this.options,l=e.placeholder,u=r===""&&l!==void 0;switch(this.state){case"submit":{let a=Ls(this.selectedValues,o),c=a.length>0?` ${n.dim(a.map(Pe).join(", "))}`:"";return`${s}${n.gray(m)}${c}`}case"cancel":{let a=i?` ${n.strikethrough(n.dim(i))}`:"";return`${s}${n.gray(m)}${a}`}default:{let a="";if(this.isNavigating||u){let v=u?l:i;a=v!==""?` ${n.dim(v)}`:""}else a=` ${this.userInputWithCursor}`;let c=this.filteredOptions.length!==o.length?n.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"",h=this.filteredOptions.length===0?[]:se({cursor:this.cursor,options:this.filteredOptions,style:(v,y)=>{let g=Pe(v),w=v.hint&&v.value===this.focusedValue?n.dim(` (${v.hint})`):"";return y?`${n.green(ce)} ${g}${w}`:`${n.dim(he)} ${n.dim(g)}${w}`},maxItems:e.maxItems,output:e.output}),f=[`${n.dim("\u2191/\u2193")} to select`,`${n.dim("Enter:")} confirm`,`${n.dim("Type:")} to search`],p=this.filteredOptions.length===0&&i?[`${n.cyan(m)} ${n.yellow("No matches found")}`]:[],d=this.state==="error"?[`${n.yellow(m)} ${n.yellow(this.error)}`]:[];return[`${s}${n.cyan(m)}`,`${n.cyan(m)} ${n.dim("Search:")}${a}${c}`,...p,...d,...h.map((v)=>`${n.cyan(m)} ${v}`),`${n.cyan(m)} ${n.dim(f.join(" \u2022 "))}`,`${n.cyan(T)}`].join(`
|
|
47
|
-
`)}}}}).prompt()}function Ni(e){let t=(i,r,o,l)=>{let u=o.includes(i.value),a=i.label??String(i.value??""),c=i.hint&&l!==void 0&&i.value===l?n.dim(` (${i.hint})`):"",h=u?n.green(Q):n.dim(Be);if(r)return`${h} ${a}${c}`;return`${h} ${n.dim(a)}`},s=new Ee({options:e.options,multiple:!0,filter:(i,r)=>yt(i,r),validate:()=>{if(e.required&&s.selectedValues.length===0)return"Please select at least one item";return},initialValue:e.initialValues,signal:e.signal,input:e.input,output:e.output,render(){let i=`${n.gray(m)}
|
|
48
|
-
${W(this.state)} ${e.message}
|
|
49
|
-
`,r=this.userInput,o=e.placeholder,l=r===""&&o!==void 0,u=this.isNavigating||l?n.dim(l?o:r):this.userInputWithCursor,a=this.options,c=this.filteredOptions.length!==a.length?n.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length===1?"":"es"})`):"";switch(this.state){case"submit":return`${i}${n.gray(m)} ${n.dim(`${this.selectedValues.length} items selected`)}`;case"cancel":return`${i}${n.gray(m)} ${n.strikethrough(n.dim(r))}`;default:{let h=[`${n.dim("\u2191/\u2193")} to navigate`,`${n.dim("Space:")} select`,`${n.dim("Enter:")} confirm`,`${n.dim("Type:")} to search`],f=this.filteredOptions.length===0&&r?[`${n.cyan(m)} ${n.yellow("No matches found")}`]:[],p=this.state==="error"?[`${n.cyan(m)} ${n.yellow(this.error)}`]:[],d=se({cursor:this.cursor,options:this.filteredOptions,style:(v,y)=>t(v,y,this.selectedValues,this.focusedValue),maxItems:e.maxItems,output:e.output});return[i,`${n.cyan(m)} ${n.dim("Search:")} ${u}${c}`,...f,...p,...d.map((v)=>`${n.cyan(m)} ${v}`),`${n.cyan(m)} ${n.dim(h.join(" \u2022 "))}`,`${n.cyan(T)}`].join(`
|
|
50
|
-
`)}}}});return s.prompt()}function Ri(e){let t=e.active??"Yes",s=e.inactive??"No",i=q(e.message);return new ot({active:t,inactive:s,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let r=`${n.gray(m)}
|
|
51
|
-
${W(this.state)} ${i}
|
|
52
|
-
`,o=this.value?t:s;switch(this.state){case"submit":return`${r}${n.gray(m)} ${n.dim(o)}`;case"cancel":return`${r}${n.gray(m)} ${n.strikethrough(n.dim(o))}
|
|
53
|
-
${n.gray(m)}`;default:return`${r}${n.cyan(m)} ${this.value?`${n.green(ce)} ${t}`:`${n.dim(he)} ${n.dim(t)}`} ${n.dim("/")} ${!this.value?`${n.green(ce)} ${s}`:`${n.dim(he)} ${n.dim(s)}`}
|
|
54
|
-
${n.cyan(T)}
|
|
55
|
-
`}}}).prompt()}async function ji(e,t){let s={},i=Object.keys(e);for(let r of i){let o=e[r],l=await o({results:s})?.catch((u)=>{throw u});if(typeof t?.onCancel==="function"&&$s(l)){s[r]="canceled",t.onCancel({results:s});continue}s[r]=l}return s}function Li(e){let{selectableGroups:t=!0,groupSpacing:s=0}=e,i=(o,l,u=[])=>{let a=o.label??String(o.value),c=typeof o.group==="string",h=c&&(u[u.indexOf(o)+1]??{group:!0}),f=c&&h.group===!0,p=c?t?`${f?T:m} `:" ":"",d="";if(s>0&&!c){let y=`
|
|
56
|
-
${n.cyan(m)}`;d=`${y.repeat(s-1)}${y} `}if(l==="active")return`${d}${n.dim(p)}${n.cyan(Ce)} ${a}${o.hint?` ${n.dim(`(${o.hint})`)}`:""}`;if(l==="group-active")return`${d}${p}${n.cyan(Ce)} ${n.dim(a)}`;if(l==="group-active-selected")return`${d}${p}${n.green(Q)} ${n.dim(a)}`;if(l==="selected"){let y=c||t?n.green(Q):"";return`${d}${n.dim(p)}${y} ${n.dim(a)}${o.hint?` ${n.dim(`(${o.hint})`)}`:""}`}if(l==="cancelled")return`${n.strikethrough(n.dim(a))}`;if(l==="active-selected")return`${d}${n.dim(p)}${n.green(Q)} ${a}${o.hint?` ${n.dim(`(${o.hint})`)}`:""}`;if(l==="submitted")return`${n.dim(a)}`;let v=c||t?n.dim(Be):"";return`${d}${n.dim(p)}${v} ${n.dim(a)}`},r=e.required??!0;return new at({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:r,cursorAt:e.cursorAt,selectableGroups:t,validate(o){if(r&&(o===void 0||o.length===0))return`Please select at least one option.
|
|
57
|
-
${n.reset(n.dim(`Press ${n.gray(n.bgWhite(n.inverse(" space ")))} to select, ${n.gray(n.bgWhite(n.inverse(" enter ")))} to submit`))}`},render(){let o=`${n.gray(m)}
|
|
58
|
-
${W(this.state)} ${e.message}
|
|
59
|
-
`,l=this.value??[];switch(this.state){case"submit":{let u=this.options.filter(({value:c})=>l.includes(c)).map((c)=>i(c,"submitted")),a=u.length===0?"":` ${u.join(n.dim(", "))}`;return`${o}${n.gray(m)}${a}`}case"cancel":{let u=this.options.filter(({value:a})=>l.includes(a)).map((a)=>i(a,"cancelled")).join(n.dim(", "));return`${o}${n.gray(m)} ${u.trim()?`${u}
|
|
60
|
-
${n.gray(m)}`:""}`}case"error":{let u=this.error.split(`
|
|
61
|
-
`).map((a,c)=>c===0?`${n.yellow(T)} ${n.yellow(a)}`:` ${a}`).join(`
|
|
62
|
-
`);return`${o}${n.yellow(m)} ${this.options.map((a,c,h)=>{let f=l.includes(a.value)||a.group===!0&&this.isGroupSelected(`${a.value}`),p=c===this.cursor;if(!p&&typeof a.group==="string"&&this.options[this.cursor].value===a.group)return i(a,f?"group-active-selected":"group-active",h);if(p&&f)return i(a,"active-selected",h);if(f)return i(a,"selected",h);return i(a,p?"active":"inactive",h)}).join(`
|
|
63
|
-
${n.yellow(m)} `)}
|
|
64
|
-
${u}
|
|
65
|
-
`}default:{let u=this.options.map((c,h,f)=>{let p=l.includes(c.value)||c.group===!0&&this.isGroupSelected(`${c.value}`),d=h===this.cursor,v=!d&&typeof c.group==="string"&&this.options[this.cursor].value===c.group,y="";if(v)y=i(c,p?"group-active-selected":"group-active",f);else if(d&&p)y=i(c,"active-selected",f);else if(p)y=i(c,"selected",f);else y=i(c,d?"active":"inactive",f);return`${h!==0&&!y.startsWith(`
|
|
66
|
-
`)?" ":""}${y}`}).join(`
|
|
67
|
-
${n.cyan(m)}`),a=u.startsWith(`
|
|
68
|
-
`)?"":" ";return`${o}${n.cyan(m)}${a}${u}
|
|
69
|
-
${n.cyan(T)}
|
|
70
|
-
`}}}}).prompt()}function Ps(e){if(Array.isArray(e))return e.map((t)=>q(t));return q(e)}var V={message:(e=[],{symbol:t=n.gray(m),secondarySymbol:s=n.gray(m),output:i=Ws.stdout,spacing:r=1}={})=>{let o=[];for(let a=0;a<r;a++)o.push(`${s}`);let l=Ps(e),u=Array.isArray(l)?l:l.split(`
|
|
71
|
-
`);if(u.length>0){let[a,...c]=u;if(a.length>0)o.push(`${t} ${a}`);else o.push(t);for(let h of c)if(h.length>0)o.push(`${s} ${h}`);else o.push(s)}i.write(`${o.join(`
|
|
72
|
-
`)}
|
|
73
|
-
`)},info:(e,t)=>{V.message(e,{...t,symbol:n.blue(gt)})},success:(e,t)=>{V.message(e,{...t,symbol:n.green($t)})},step:(e,t)=>{V.message(e,{...t,symbol:n.green(X)})},warn:(e,t)=>{V.message(e,{...t,symbol:n.yellow(vt)})},warning:(e,t)=>{V.warn(e,t)},error:(e,t)=>{V.message(e,{...t,symbol:n.red(wt)})},custom:(e,t,s,i)=>{let r=typeof s==="string"?(o)=>n[s]?.(o)||o:s;V.message(t,{...i,symbol:r(e),secondarySymbol:r(e)})}};function Pi(e="",t){(t?.output??Te.stdout).write(`${n.gray(T)} ${n.red(e)}
|
|
74
|
-
|
|
75
|
-
`)}function Fi(e="",t){(t?.output??Te.stdout).write(`${n.gray(ks)} ${e}
|
|
76
|
-
`)}function Hi(e="",t){(t?.output??Te.stdout).write(`${n.gray(m)}
|
|
77
|
-
${n.gray(T)} ${e}
|
|
78
|
-
|
|
79
|
-
`)}function Ui(e){let t=(i,r)=>{let o=i.label??String(i.value);if(r==="active")return`${n.cyan(Ce)} ${o}${i.hint?` ${n.dim(`(${i.hint})`)}`:""}`;if(r==="selected")return`${n.green(Q)} ${n.dim(o)}${i.hint?` ${n.dim(`(${i.hint})`)}`:""}`;if(r==="cancelled")return`${n.strikethrough(n.dim(o))}`;if(r==="active-selected")return`${n.green(Q)} ${o}${i.hint?` ${n.dim(`(${i.hint})`)}`:""}`;if(r==="submitted")return`${n.dim(o)}`;return`${n.dim(Be)} ${n.dim(o)}`},s=e.required??!0;return new lt({options:e.options,input:e.input,output:e.output,initialValues:e.initialValues,required:s,cursorAt:e.cursorAt,validate(i){if(s&&(i===void 0||i.length===0))return`Please select at least one option.
|
|
80
|
-
${n.reset(n.dim(`Press ${n.gray(n.bgWhite(n.inverse(" space ")))} to select, ${n.gray(n.bgWhite(n.inverse(" enter ")))} to submit`))}`},render(){let i=`${n.gray(m)}
|
|
81
|
-
${W(this.state)} ${e.message}
|
|
82
|
-
`,r=this.value??[],o=(l,u)=>{let a=r.includes(l.value);if(u&&a)return t(l,"active-selected");if(a)return t(l,"selected");return t(l,u?"active":"inactive")};switch(this.state){case"submit":return`${i}${n.gray(m)} ${this.options.filter(({value:l})=>r.includes(l)).map((l)=>t(l,"submitted")).join(n.dim(", "))||n.dim("none")}`;case"cancel":{let l=this.options.filter(({value:u})=>r.includes(u)).map((u)=>t(u,"cancelled")).join(n.dim(", "));return`${i}${n.gray(m)}${l.trim()?` ${l}
|
|
83
|
-
${n.gray(m)}`:""}`}case"error":{let l=this.error.split(`
|
|
84
|
-
`).map((u,a)=>a===0?`${n.yellow(T)} ${n.yellow(u)}`:` ${u}`).join(`
|
|
85
|
-
`);return`${i+n.yellow(m)} ${se({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:o}).join(`
|
|
86
|
-
${n.yellow(m)} `)}
|
|
87
|
-
${l}
|
|
88
|
-
`}default:return`${i}${n.cyan(m)} ${se({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:o}).join(`
|
|
89
|
-
${n.cyan(m)} `)}
|
|
90
|
-
${n.cyan(T)}
|
|
91
|
-
`}}}).prompt()}var Hs=(e)=>n.dim(e);function qi(e="",t="",s){let i=s?.format??Hs,r=q(e),o=q(t),l=["",...r.split(`
|
|
92
|
-
`).map(i),""],u=ge(o).length,a=s?.output??Fs.stdout,c=Math.max(l.reduce((f,p)=>{let d=ge(p);return d.length>f?d.length:f},0),u)+2,h=l.map((f)=>`${n.gray(m)} ${f}${" ".repeat(c-ge(f).length)}${n.gray(m)}`).join(`
|
|
93
|
-
`);a.write(`${n.gray(m)}
|
|
94
|
-
${n.green(X)} ${n.reset(o)} ${n.gray(We.repeat(Math.max(c-u-1,1))+Ms)}
|
|
95
|
-
${h}
|
|
96
|
-
${n.gray(As+We.repeat(c+2)+Ns)}
|
|
97
|
-
`)}function zi(e){return new ut({validate:e.validate,mask:e.mask??Vs,signal:e.signal,input:e.input,output:e.output,render(){let t=`${n.gray(m)}
|
|
98
|
-
${W(this.state)} ${e.message}
|
|
99
|
-
`,s=this.userInputWithCursor,i=this.masked;switch(this.state){case"error":{let r=i?` ${i}`:"";return`${t.trim()}
|
|
100
|
-
${n.yellow(m)}${r}
|
|
101
|
-
${n.yellow(T)} ${n.yellow(this.error)}
|
|
102
|
-
`}case"submit":{let r=i?` ${n.dim(i)}`:"";return`${t}${n.gray(m)}${r}`}case"cancel":{let r=i?` ${n.strikethrough(n.dim(i))}`:"";return`${t}${n.gray(m)}${r}${i?`
|
|
103
|
-
${n.gray(m)}`:""}`}default:return`${t}${n.cyan(m)} ${s}
|
|
104
|
-
${n.cyan(T)}
|
|
105
|
-
`}}}).prompt()}function Xi(e){let t=e.validate;return Ds({...e,initialUserInput:e.initialValue??e.root??qs.cwd(),maxItems:5,validate(s){if(Array.isArray(s))return;if(!s)return"Please select a path";if(t)return t(s);return},options(){let s=this.userInput;if(s==="")return[];try{let i;if(!Us(s))i=He(s);else if(Fe(s).isDirectory())i=s;else i=He(s);return Gs(i).map((o)=>{let l=Ks(i,o),u=Fe(l);return{name:o,path:l,isDirectory:u.isDirectory()}}).filter(({path:o,isDirectory:l})=>o.startsWith(s)&&(e.directory||!l)).map((o)=>({value:o.path}))}catch(i){return console.error("Error reading directory:",i),[]}}})}function bt({indicator:e="dots",onCancel:t,output:s=A.stdout,cancelMessage:i,errorMessage:r,frames:o=xe?["\u25D2","\u25D0","\u25D3","\u25D1"]:["\u2022","o","O","0"],delay:l=xe?80:120,signal:u}={}){let a=dt(),c,h,f=!1,p=!1,d="",v,y=performance.now();function g(){if(v===void 0)return;if(a)s.write(`
|
|
106
|
-
`);let B=v.split(`
|
|
107
|
-
`);s.write(k.move(-999,B.length-1)),s.write(te.down(B.length))}function w(B){return B.replace(/\.+$/,"")}function I(B){let M=(performance.now()-B)/1000,R=Math.floor(M/60),z=Math.floor(M%60);return R>0?`[${R}m ${z}s]`:`[${z}s]`}function b(B="",M=0){f=!1,clearInterval(h),g();let R=M===0?n.green(X):M===1?n.red(ft):n.red(pt);if(d=B??d,e==="timer")s.write(`${R} ${d} ${I(y)}
|
|
108
|
-
`);else s.write(`${R} ${d}
|
|
109
|
-
`);ne(),c()}function O(B){let M=B>1?r??N.messages.error:i??N.messages.cancel;if(p=B===1,f){if(b(M,B),p&&typeof t==="function")t()}}function E(){O(2)}function L(){O(1)}function ie(){A.on("uncaughtExceptionMonitor",E),A.on("unhandledRejection",E),A.on("SIGINT",L),A.on("SIGTERM",L),A.on("exit",O)}function ne(){if(A.removeListener("uncaughtExceptionMonitor",E),A.removeListener("unhandledRejection",E),A.removeListener("SIGINT",L),A.removeListener("SIGTERM",L),A.removeListener("exit",O),u)u.removeEventListener("abort",L)}function Ct(B=""){f=!0,c=vs({output:s}),d=w(B),y=performance.now(),s.write(`${n.gray(m)}
|
|
110
|
-
`);let M=0,R=0;ie(),h=setInterval(()=>{if(a&&d===v)return;g(),v=d;let z=n.magenta(o[M]);if(a)s.write(`${z} ${d}...`);else if(e==="timer")s.write(`${z} ${d} ${I(y)}`);else{let _t=".".repeat(Math.floor(R)).slice(0,3);s.write(`${z} ${d}${_t}`)}M=M+1<o.length?M+1:0,R=R<4?R+0.125:0},l)}function St(B=""){d=w(B??d)}return{start:Ct,stop:b,message:St,get isCancelled(){return p}}}var Ue={light:C("\u2500","-"),heavy:C("\u2501","="),block:C("\u2588","#")};function en(e={}){let{style:t="heavy",max:s=100,size:i=40,...r}=e,o=bt(r),l=0,u="",a=Math.max(1,s),c=Math.max(1,i),h=(v)=>{switch(v){case"initial":case"active":return n.magenta;case"error":case"cancel":return n.red;case"submit":return n.green;default:return n.magenta}},f=(v,y)=>{let g=Math.floor(l/a*c);return`${h(v)(Ue[t].repeat(g))}${n.dim(Ue[t].repeat(c-g))} ${y}`},p=(v="")=>(u=v,o.start(f("initial",v))),d=(v=1,y)=>{l=Math.min(a,v+l),o.message(f("active",y??u)),u=y??u};return{start:p,stop:o.stop,advance:d,isCancelled:o.isCancelled,message:(v)=>d(0,v)}}function tn(e){let t=q(e.message),s=(i,r)=>{let o=i.label??String(i.value);switch(r){case"selected":return`${n.dim(o)}`;case"active":return`${n.green(ce)} ${o}${i.hint?` ${n.dim(`(${i.hint})`)}`:""}`;case"cancelled":return`${n.strikethrough(n.dim(o))}`;default:return`${n.dim(he)} ${n.dim(o)}`}};return new ct({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let i=`${n.gray(m)}
|
|
111
|
-
${W(this.state)} ${t}
|
|
112
|
-
`;switch(this.state){case"submit":return`${i}${n.gray(m)} ${s(this.options[this.cursor],"selected")}`;case"cancel":return`${i}${n.gray(m)} ${s(this.options[this.cursor],"cancelled")}
|
|
113
|
-
${n.gray(m)}`;default:return`${i}${n.cyan(m)} ${se({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,style:(r,o)=>s(r,o?"active":"inactive")}).join(`
|
|
114
|
-
${n.cyan(m)} `)}
|
|
115
|
-
${n.cyan(T)}
|
|
116
|
-
`}}}).prompt()}function sn(e){let t=(s,i="inactive")=>{let r=s.label??String(s.value);if(i==="selected")return`${n.dim(r)}`;if(i==="cancelled")return`${n.strikethrough(n.dim(r))}`;if(i==="active")return`${n.bgCyan(n.gray(` ${s.value} `))} ${r} ${s.hint?n.dim(`(${s.hint})`):""}`;return`${n.gray(n.bgWhite(n.inverse(` ${s.value} `)))} ${r} ${s.hint?n.dim(`(${s.hint})`):""}`};return new ht({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let s=`${n.gray(m)}
|
|
117
|
-
${W(this.state)} ${e.message}
|
|
118
|
-
`;switch(this.state){case"submit":return`${s}${n.gray(m)} ${t(this.options.find((i)=>i.value===this.value)??e.options[0],"selected")}`;case"cancel":return`${s}${n.gray(m)} ${t(this.options[0],"cancelled")}
|
|
119
|
-
${n.gray(m)}`;default:return`${s}${n.cyan(m)} ${this.options.map((i,r)=>t(i,r===this.cursor?"active":"inactive")).join(`
|
|
120
|
-
${n.cyan(m)} `)}
|
|
121
|
-
${n.cyan(T)}
|
|
122
|
-
`}}}).prompt()}function zs(){return`${n.gray(m)} `}var Ge=zs(),Y={message:async(e,{symbol:t=n.gray(m)}={})=>{ee.stdout.write(`${n.gray(m)}
|
|
123
|
-
${t} `);let s=3;for await(let i of e){if(i=i.replace(/\n/g,`
|
|
124
|
-
${Ge}`),i.includes(`
|
|
125
|
-
`))s=3+$e(i.slice(i.lastIndexOf(`
|
|
126
|
-
`))).length;let r=$e(i).length;if(s+r<ee.stdout.columns)s+=r,ee.stdout.write(i);else ee.stdout.write(`
|
|
127
|
-
${Ge}${i.trimStart()}`),s=3+$e(i.trimStart()).length}ee.stdout.write(`
|
|
128
|
-
`)},info:(e)=>Y.message(e,{symbol:n.blue(gt)}),success:(e)=>Y.message(e,{symbol:n.green($t)}),step:(e)=>Y.message(e,{symbol:n.green(X)}),warn:(e)=>Y.message(e,{symbol:n.yellow(vt)}),warning:(e)=>Y.warn(e),error:(e)=>Y.message(e,{symbol:n.red(wt)})};async function on(e,t){for(let s of e){if(s.enabled===!1)continue;let i=bt(t);i.start(s.title);let r=await s.task(i.message);i.stop(r||s.title)}}function ln(e){let t=e.output??Ys.stdout,s=ws(t),i=st(m),r=e.spacing??1,o=3,l=e.retainLog===!0,u=!dt()&&Bs(t);t.write(`${i}
|
|
129
|
-
`),t.write(`${tt(X)} ${e.title}
|
|
130
|
-
`);for(let g=0;g<r;g++)t.write(`${i}
|
|
131
|
-
`);let a=[{value:"",full:""}],c=!1,h=(g)=>{if(a.length===0)return;let w=0;if(g)w+=r+2;for(let I of a){let{value:b,result:O}=I,E=O?.message??b;if(E.length===0)continue;if(O===void 0&&I.header!==void 0&&I.header!=="")E+=`
|
|
132
|
-
${I.header}`;let L=E.split(`
|
|
133
|
-
`).reduce((ie,ne)=>{if(ne==="")return ie+1;return ie+Math.ceil((ne.length+3)/s)},0);w+=L}if(w>0)w+=1,t.write(te.lines(w))},f=(g,w,I)=>{let b=I?`${g.full}
|
|
134
|
-
${g.value}`:g.value;if(g.header!==void 0&&g.header!=="")V.message(g.header.split(`
|
|
135
|
-
`).map(it),{output:t,secondarySymbol:i,symbol:i,spacing:0});V.message(b.split(`
|
|
136
|
-
`).map(nt),{output:t,secondarySymbol:i,symbol:i,spacing:w??r})},p=()=>{for(let g of a){let{header:w,value:I,full:b}=g;if((w===void 0||w.length===0)&&I.length===0)continue;f(g,void 0,l===!0&&b.length>0)}},d=()=>{for(let g of a)if(g.result)if(g.result.status==="error")V.error(g.result.message,{output:t,secondarySymbol:i,spacing:0});else V.success(g.result.message,{output:t,secondarySymbol:i,spacing:0});else if(g.value!=="")f(g,0)},v=(g,w,I)=>{if(h(!1),(I?.raw!==!0||!c)&&g.value!=="")g.value+=`
|
|
137
|
-
`;if(g.value+=w,c=I?.raw===!0,e.limit!==void 0){let b=g.value.split(`
|
|
138
|
-
`),O=b.length-e.limit;if(O>0){let E=b.splice(0,O);if(l)g.full+=(g.full===""?"":`
|
|
139
|
-
`)+E.join(`
|
|
140
|
-
`)}g.value=b.join(`
|
|
141
|
-
`)}if(u)d()},y=(g,w)=>{if(h(!1),g.result=w,u)d()};return{message(g,w){v(a[0],g,w)},group(g){let w={header:g,value:"",full:""};return a.push(w),{message(I,b){v(w,I,b)},error(I){y(w,{status:"error",message:I})},success(I){y(w,{status:"success",message:I})}}},error(g,w){if(h(!0),V.error(g,{output:t,secondarySymbol:i,spacing:1}),w?.showLog!==!1)p();a.splice(1,a.length-1),a[0].value="",a[0].full=""},success(g,w){if(h(!0),V.success(g,{output:t,secondarySymbol:i,spacing:1}),w?.showLog===!0)p();a.splice(1,a.length-1),a[0].value="",a[0].full=""}}}function un(e){let t=q(e.message);return new mt({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let s=`${n.gray(m)}
|
|
142
|
-
${W(this.state)} ${t}
|
|
143
|
-
`,i=e.placeholder?n.inverse(e.placeholder[0])+n.dim(e.placeholder.slice(1)):n.inverse(n.hidden("_")),r=!this.userInput?i:this.userInputWithCursor,o=this.value??"";switch(this.state){case"error":{let l=this.error?` ${n.yellow(this.error)}`:"";return`${s.trim()}
|
|
144
|
-
${n.yellow(m)} ${r}
|
|
145
|
-
${n.yellow(T)}${l}
|
|
146
|
-
`}case"submit":{let u=(this.userInput||o!==e.placeholder)&&o?` ${n.dim(o)}`:"";return`${s}${n.gray(m)}${u}`}case"cancel":{let l=o?` ${n.strikethrough(n.dim(o))}`:"";return`${s}${n.gray(m)}${l}${o.trim()?`
|
|
147
|
-
${n.gray(m)}`:""}`}default:return`${s}${n.cyan(m)} ${r}
|
|
148
|
-
${n.cyan(T)}
|
|
149
|
-
`}}}).prompt()}class Se extends Xs{buffer=[];_write(e,t,s){this.buffer.push(e.toString()),s()}}class xt extends Qs{_buffer=[];_read(){if(this._buffer===null){this.push(null);return}for(let e of this._buffer)this.push(e);this._buffer=[]}pushValue(e){this._buffer?.push(e)}close(){this._buffer=null}}function gn(e={}){return Xe(e.name||"")}function Zs(){let e=new Se,t=new Se,s=new xt,i=x.exit,r=x.stdout,o=x.stderr,l=x.stdin,u=console.log;return x.exit=(a)=>{throw Error(`Process exit with code: ${a||0}`)},Object.defineProperty(x,"stdout",{value:e,writable:!0}),Object.defineProperty(x,"stderr",{value:t,writable:!0}),Object.defineProperty(x,"stdin",{value:s,writable:!0}),{stdout:e,stderr:t,stdin:s,originalExit:i,originalStdout:r,originalStderr:o,originalStdin:l,originalConsoleLog:u}}function ei(e){x.exit=e.originalExit,Object.defineProperty(x,"stdout",{value:e.originalStdout,writable:!0}),Object.defineProperty(x,"stderr",{value:e.originalStderr,writable:!0}),Object.defineProperty(x,"stdin",{value:e.originalStdin,writable:!0}),console.log=e.originalConsoleLog}async function $n(e,t,s={}){let i=Date.now(),{inputs:r=[],env:o={},cwd:l=x.cwd(),timeout:u=5000}=s,a=Zs(),{stdin:c,stdout:h,stderr:f}=a,p=t.includes("--help")||t.includes("-h"),d=[];if(x.stdout.write=function(b){let O=b.toString();return d.push(O),h.write(O),!0},console.log=function(...b){let O=b.map((E)=>String(E)).join(" ");d.push(`${O}
|
|
150
|
-
`),h.write(`${O}
|
|
151
|
-
`);return},r.length>0)for(let b of r)c.pushValue(`${b}
|
|
152
|
-
`);let v={...x.env},y=x.cwd();if(Object.entries(o).forEach(([b,O])=>{x.env[b]=O}),l!==y)x.chdir(l);let g,w=0;try{let b=new Promise((E,L)=>{setTimeout(()=>L(Error("Command execution timed out")),u)}),O=Promise.resolve().then(async()=>{try{if(e.showHelpOnExit=!1,e.showVersionOnExit=!1,await e.parse(["node","cli",...t],{run:!1}),p)e.outputHelp();return g=await e.runMatchedCommand(),g}catch(E){throw w=1,f.write(`${E}
|
|
153
|
-
`),E}});await Promise.race([O,b])}catch(b){if(b.message==="Command execution timed out")throw b}finally{if(x.env=v,l!==y)x.chdir(y);ei(a)}let I=Date.now()-i;if(p)w=0;return{stdout:d.join(""),stderr:f.buffer.join(""),exitCode:w,duration:I,outputs:[...d],result:g}}var H=null;function vn(e){H=e}function wn(e){if(!H)return;if(e in H)return H[e];for(let[t,s]of Object.entries(H))if(t.startsWith("/")&&t.endsWith("/i")){let i=t.slice(1,-2);if(new RegExp(i,"i").test(e))return s}else if(t.startsWith("/")&&t.endsWith("/")){let i=t.slice(1,-1);if(new RegExp(i).test(e))return s}if("*"in H)return H["*"];return}function yn(){H=null}var me=null;function bn(){let e=[],t=[],s=x.stdout.write,i=x.stderr.write;x.stdout.write=function(o){return e.push(o.toString()),!0},x.stderr.write=function(o){return t.push(o.toString()),!0};let r={stdout:e,stderr:t,stop:()=>(x.stdout.write=s,x.stderr.write=i,me=null,{stdout:e.join(""),stderr:t.join("")})};return me=r,r}function xn(){if(!me)throw Error("No output capture in progress. Call captureOutput() first.");return me.stdout.join("")}async function Cn(e){let t=await j.mkdtemp(le.join(Js.tmpdir(),"clapp-test-")),s=async(i,r)=>{for(let[o,l]of Object.entries(r)){let u=le.join(i,o);if(typeof l==="object"&&!Ke.isBuffer(l))if(o.endsWith("/"))await j.mkdir(u,{recursive:!0}),await s(u,l);else await j.mkdir(u,{recursive:!0}),await s(u,l);else{let a=le.dirname(u);if(await j.mkdir(a,{recursive:!0}),Ke.isBuffer(l))await j.writeFile(u,l);else if(typeof l==="string")await j.writeFile(u,l,"utf8");else await j.writeFile(u,JSON.stringify(l),"utf8")}}};return await s(t,e),t}async function Sn(e){let t=async(s)=>{let i=await j.readdir(s,{withFileTypes:!0});for(let r of i){let o=le.join(s,r.name);if(r.isDirectory())await t(o);else await j.unlink(o)}await j.rmdir(s)};await t(e)}var _n={outputToContain(e,t){if(!e.stdout.includes(t))throw Error(`Expected output to contain "${t}", but got:
|
|
154
|
-
${e.stdout}`)},outputToMatch(e,t){if(!t.test(e.stdout))throw Error(`Expected output to match ${t}, but got:
|
|
155
|
-
${e.stdout}`)},exitCode(e,t){if(e.exitCode!==t)throw Error(`Expected exit code ${t}, but got ${e.exitCode}`)},completedWithin(e,t){if(e.duration>t)throw Error(`Expected command to complete within ${t}ms, but took ${e.duration}ms`)},outputNotToContain(e,t){if(e.stdout.includes(t))throw Error(`Expected output not to contain "${t}", but it did`)},stderrToContain(e,t){if(!e.stderr.includes(t))throw Error(`Expected stderr to contain "${t}", but got:
|
|
156
|
-
${e.stderr}`)}},In=Xe;export{be as CANCEL_SYMBOL,Qe as CLI,S as CSI,oe as ClappError,_e as Command,ue as ESC,Ie as GlobalCommand,m as S_BAR,T as S_BAR_END,We as S_BAR_H,ks as S_BAR_START,Ce as S_CHECKBOX_ACTIVE,Be as S_CHECKBOX_INACTIVE,Q as S_CHECKBOX_SELECTED,As as S_CONNECT_LEFT,Ns as S_CORNER_BOTTOM_RIGHT,Ms as S_CORNER_TOP_RIGHT,wt as S_ERROR,gt as S_INFO,Vs as S_PASSWORD_MASK,ce as S_RADIO_ACTIVE,he as S_RADIO_INACTIVE,Ts as S_STEP_ACTIVE,ft as S_STEP_CANCEL,pt as S_STEP_ERROR,X as S_STEP_SUBMIT,$t as S_SUCCESS,vt as S_WARN,gi as applyTheme,Ds as autocomplete,Ni as autocompleteMultiselect,ci as beep,vs as block,wi as box,kt as camelcase,ze as camelcaseOptionName,Pi as cancel,bn as captureOutput,Sn as cleanupTestFS,mi as clear,Xe as cli,xi as cliCache,F as codes,Ri as confirm,gn as createTestCLI,Cn as createTestFS,k as cursor,In as default,ps as diffLines,te as erase,$n as execCommand,_n as expect,Bt as findAllBrackets,Me as findLongest,Ye as findSimilarCommands,$i as getAvailableThemes,ws as getColumns,At as getFileName,xn as getLastOutput,wn as getMockResponse,Tt as getMriOptions,ji as group,Li as groupMultiselect,Fi as intro,Oe as isActionKey,dt as isCI,$s as isCancel,Bs as isTTY,Nt as isUnicodeSupported,Rt as levenshteinDistance,se as limitOptions,V as log,vn as mockPrompt,Ui as multiselect,qi as note,Si as onUnknownSubcommand,Hi as outro,pe as padRight,yi as panel,zi as password,Xi as path,q as processMarkdown,en as progress,ve as removeBrackets,yn as resetMockPrompts,hi as scroll,tn as select,sn as selectKey,vi as setAccessibility,Mt as setByType,Vt as setDotProp,re as setRawMode,Ft as setTheme,N as settings,Zs as setupTest,bt as spinner,Y as stream,K as style,W as symbol,bi as table,ln as taskLog,on as tasks,ei as teardownTest,oi as telemetry,un as text,ye as themes,xe as unicode,C as unicodeOr,Bi as updateSettings};
|
package/dist/chunk-vdbbvx8x.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{N as I}from"./chunk-gy6wyx8t.js";import{Q as dt}from"./chunk-awmb5sg5.js";function ue(e){let s=e.length,n=Array.from({length:s},(r,i)=>e[i]),t=0;while(t<s){let r=e[t];if(r==="#"&&(t===0||/\s/.test(e[t-1]))){while(t<s)n[t]=" ",t++;break}if(r==="$"&&e[t+1]==="'"){t+=2;while(t<s){if(e[t]==="\\"&&t+1<s){n[t]=" ",n[t+1]=" ",t+=2;continue}if(e[t]==="'"){t++;break}n[t]=" ",t++}continue}if(r==="$"&&e[t+1]==='"'){t++,t=A(e,t,n);continue}if(r==="$"&&e[t+1]==="{"){t+=2;let i=1;while(t<s&&i>0){let o=e[t];if(o==="\\"&&t+1<s){n[t]=" ",n[t+1]=" ",t+=2;continue}if(o==="'"){t++;while(t<s&&e[t]!=="'")n[t]=" ",t++;if(t<s)t++;continue}if(o==='"'){t=A(e,t,n);continue}if(o==="{"){i++,t++;continue}if(o==="}"){i--,t++;continue}n[t]=" ",t++}continue}if(r==="$"&&e[t+1]==="("&&e[t+2]==="("){t+=3;let i=2;while(t<s&&i>0){let o=e[t];if(o==="("){i++,t++;continue}if(o===")"){i--,t++;continue}n[t]=" ",t++}continue}if(r==="$"&&e[t+1]==="("){t+=2;let i=1;while(t<s&&i>0){let o=e[t];if(o==="\\"&&t+1<s){n[t]=" ",n[t+1]=" ",t+=2;continue}if(o==="'"){t++;while(t<s&&e[t]!=="'")n[t]=" ",t++;if(t<s)t++;continue}if(o==='"'){t=A(e,t,n);continue}if(o==="("){i++,t++;continue}if(o===")"){i--,t++;continue}n[t]=" ",t++}continue}if(r==="'"){t++;while(t<s&&e[t]!=="'")n[t]=" ",t++;if(t<s)t++;continue}if(r==='"'){t=A(e,t,n);continue}if(r==="`"){t++;while(t<s&&e[t]!=="`"){if(e[t]==="\\"&&t+1<s){n[t]=" ",n[t+1]=" ",t+=2;continue}n[t]=" ",t++}if(t<s)t++;continue}t++}return n.join("")}function A(e,s,n){let t=e.length,r=s+1;while(r<t){let i=e[r];if(i==="\\"&&r+1<t){n[r]=" ",n[r+1]=" ",r+=2;continue}if(i==='"')return r+1;if(i==="$"&&e[r+1]==="("&&e[r+2]==="("){r+=3;let o=2;while(r<t&&o>0){let c=e[r];if(c==="("){o++,r++;continue}if(c===")"){o--,r++;continue}n[r]=" ",r++}continue}if(i==="$"&&e[r+1]==="("){r+=2;let o=1;while(r<t&&o>0){let c=e[r];if(c==="\\"&&r+1<t){n[r]=" ",n[r+1]=" ",r+=2;continue}if(c==="'"){r++;while(r<t&&e[r]!=="'")n[r]=" ",r++;if(r<t)r++;continue}if(c==='"'){r=A(e,r,n);continue}if(c==="("){o++,r++;continue}if(c===")"){o--,r++;continue}n[r]=" ",r++}continue}if(i==="$"&&e[r+1]==="{"){r+=2;let o=1;while(r<t&&o>0){let c=e[r];if(c==="{"){o++,r++;continue}if(c==="}"){o--,r++;continue}n[r]=" ",r++}continue}n[r]=" ",r++}return r}function Y(e){let n=ue(e).match(/<<-?/);if(!n||n.index===void 0)return null;let r=e.slice(n.index+n[0].length).match(/^\s*(['"]?)(\w+)\1/);if(!r)return null;return r[2]}var ge=new Set([".ts",".js"]),pe=new Set([".json",".jsonc"]),de=new Set([".yaml",".yml"]),me=new Set([".sh",".bash",".zsh",".ksh",".dash"]),he=/^#!\s*(?:\/usr\/bin\/env\s+)?(?:ba|z|k|da)?sh\b/;var ye=/^[}\])]/,be=/[{[(]\s*$/,we=/\s*\/\/.*$/,Se=/^(?:if|else\s+if|for|while)\s*\(/,xe=/^(?:\.[\w$[]|\?[\s.:]|:\s|&&|\|\|)/;function Ce(e){let s=Se.exec(e);if(!s)return/^(?:else|do)\s*$/.test(e);let n=0,t=null;for(let r=s[0].length-1;r<e.length;r++){let i=e[r];if(t){if(i==="\\"){r++;continue}if(i===t)t=null;continue}if(i==="'"||i==='"'||i==="`"){t=i;continue}if(i==="(")n++;else if(i===")"){if(n--,n===0)return e.slice(r+1).trim().length===0}}return!1}var Ee=/^\s*for\s*\(/,ke=new RegExp("^\\s*;\\s*$"),$e=new RegExp(";{2,}\\s*$"),Re=/([\w)])\{/g,_e=/\{(return|if|for|while|switch|const|let|var|function)\b/g,Ie=/,(\S)/g,Oe=/(?<![=!<>+\-*/%&|^?])=(?![=><])/g,Te=/(\w)\+(\w)/g,Ne=/(\w)-(\w)/g,ve=/(\w)\*(\w)/g,Ae=/(\w)\/(\w)/g,Pe=new RegExp("(?<=\\S);([^\\s;])","g"),Me=/([\w)\]])<(\d)/g,Le=/([\w)\]])>(\d)/g,H=/\s{2,}/g,Q=/^\s*$/,je=/^\s*\/\//,X=/^\s*\/\*/,De=/^\s*import\b/,V=/\bfrom\s*['"][^'"]+['"]|^\s*import\s+['"][^'"]+['"]/,Fe=/package\.json$/i,Ue=/[jt]sconfig(?:\..+)?\.json$/i,D=/[ \t]+$/,Ge=/^\n+/;function L(e){let s=e.lastIndexOf(".");return s>=0?e.slice(s):""}function F(e){return ge.has(L(e))}function We(e){return pe.has(L(e))}function Be(e){return de.has(L(e))}function Je(e){return me.has(L(e))}function Ke(e,s){return Je(e)||he.test(s)}function ze(e,s){let n=e.split(`
|
|
3
|
-
`),t=n.length,r=Array(t),i=s.format.indent,o=s.format.indentStyle==="tabs",c=0,f=!1,g="",p=!1,m=0;for(let a=0;a<t;a++){let h=n[a];if(h.length===0||/^\s*$/.test(h)){r[a]="";continue}if(f){if(r[a]=h,h.trim()===g)f=!1,g="";continue}let b=Y(h);if(b)f=!0,g=b;let w=0;while(w<h.length&&(h.charCodeAt(w)===32||h.charCodeAt(w)===9))w++;let d=h.slice(w).trimEnd();if(d.startsWith("#")&&a>0){let v=o?"\t".repeat(c):" ".repeat(c*i);r[a]=v+d;continue}if(/^case\b/.test(d)&&/\bin\s*$/.test(d))m++,p=!0;if(/^esac\b/.test(d)){if(m=Math.max(0,m-1),m===0)p=!1}let C=p&&/\)\s*$/.test(d)&&!/\$\(/.test(d)&&!/^\s*\(/.test(d)&&!d.startsWith("#"),E=/^;[;&]\s*$/.test(d);if(/^(?:fi|done|esac|elif|else)\b/.test(d)||/^\}/.test(d))c=Math.max(0,c-1);if(E)c=Math.max(0,c-1);let N=o?"\t".repeat(c):" ".repeat(c*i);if(r[a]=N+d,/^then\b/.test(d)||/^do\b/.test(d)||/^else\b/.test(d))c++;else if(/^if\b/.test(d)&&/\bthen\s*$/.test(d))c++;else if(/^elif\b/.test(d)&&/\bthen\s*$/.test(d))c++;else if(/^(?:while|for|until)\b/.test(d)&&/\bdo\s*$/.test(d))c++;else if(/^case\b/.test(d)&&/\bin\s*$/.test(d))c++;else if(C)c++;else if(/\{\s*$/.test(d)&&!d.startsWith("#"))c++}return r.join(`
|
|
4
|
-
`)}function Ye(e,s){try{let n=Bun.YAML.parse(e),t=s.format.indentStyle==="tabs"?"\t":s.format.indent;return Bun.YAML.stringify(n,null,t).split(`
|
|
5
|
-
`).map((i)=>i.replace(/[ \t]+$/,"")).join(`
|
|
6
|
-
`)}catch{return e}}function He(e){return" ".repeat(Math.max(0,e))}function Qe(e,s){if((s.format.indentStyle||"spaces")==="tabs")return"\t".repeat(Math.max(0,e));return He(Math.max(0,e*s.format.indent))}function Xe(e){return`'${e.slice(1,-1).replace(/\\"/g,'"')}'`}function Ve(e){return`"${e.slice(1,-1).replace(/\\'/g,"'")}"`}function Ze(e,s){for(let n=0;n<e.length;n++){if(e[n]==="\\"){n++;continue}if(e[n]===s)return!0}return!1}function qe(e,s,n){if(!F(n))return e;let t=e.split(`
|
|
7
|
-
`);for(let r=0;r<t.length;r++)t[r]=te(t[r],s);return t.join(`
|
|
8
|
-
`)}function te(e,s){let n=s==="single";if(n?!e.includes('"'):!e.includes("'"))return e;let t=[],r=0,i=0,o=0,c=0;while(r<e.length){let f=e[r];if(o===0){if(f==="/"){let g=e[r+1];if(g==="/")break;if(g==="*"){let p=e.indexOf("*/",r+2);r=p===-1?e.length:p+2;continue}if(re(e,r)){let p=ie(e,r);if(p!==-1){r=p;continue}}r++;continue}if(f==='"'){o=2,c=r,r++;continue}if(f==="'"){o=1,c=r,r++;continue}if(f==="`"){o=3,r++;continue}r++}else if(o===3){if(f==="\\"){r+=2;continue}if(f==="`")o=0;r++}else{if(f==="\\"){r+=2;continue}if(f===(o===1?"'":'"')){let p=e.slice(c+1,r);if((o===2&&n||o===1&&!n)&&!Ze(p,n?"'":'"')){if(c>i)t.push(e.slice(i,c));if(o===2)t.push(Xe(`"${p}"`));else t.push(Ve(`'${p}'`));i=r+1}o=0,r++;continue}r++}}if(t.length===0)return e;if(i<e.length)t.push(e.slice(i));return t.join("")}var et=new Set(["{",",","=","+","-","*","/",";","<",">"]);function tt(e){if(e.length<4)return e;let s=0;while(s<e.length&&(e[s]===" "||e[s]==="\t"))s++;if(s<e.length){let o=e[s];if(o==="/"&&(e[s+1]==="/"||e[s+1]==="*"))return e;if(o==="*")return e}let n=!1;for(let o=s;o<e.length;o++)if(et.has(e[o])){n=!0;break}if(!n)return e;let{text:t,strings:r}=it(e),i=t;if(i=i.replace(Re,"$1 {"),i=i.replace(_e,"{ $1"),i=i.replace(Ie,", $1"),i=i.replace(Oe," = "),i=i.replace(Te,"$1 + $2"),i=i.replace(Ne,"$1 - $2"),i=i.replace(ve,"$1 * $2"),i=i.replace(Ae,"$1 / $2"),i=i.replace(Pe,"; $1"),i=i.replace(Me,"$1 < $2"),i=i.replace(Le,"$1 > $2"),s>0){let o=i.slice(s);i=i.slice(0,s)+o.replace(H," ")}else i=i.replace(H," ");return r.length>0?ot(i,r):i}function j(e){let s=e[e.length-1];return s!==void 0&&s.t==="tmpl"}function ne(e,s,n){s++;while(s<e.length){let t=e[s];if(t==="\\"){s+=2;continue}if(t===n)return s+1;s++}return s}function U(e,s){for(let t of s)if(t.t==="tmpl")t.start=-1;let n=0;while(n<e.length){let t=s[s.length-1],r=e[n];if(t===void 0||t.t==="interp"){if(r==="`"){s.push({t:"tmpl",start:n}),n++;continue}if(r==="'"||r==='"'){n=ne(e,n,r);continue}if(r==="/"&&e[n+1]==="/")break;if(t!==void 0){if(r==="{"){t.braces++,n++;continue}if(r==="}"){if(t.braces===0)s.pop();else t.braces--;n++;continue}}n++}else{if(r==="\\"){n+=2;continue}if(r==="`"){s.pop(),n++;continue}if(r==="$"&&e[n+1]==="{"){s.push({t:"interp",braces:0}),n+=2;continue}n++}}if(j(s)){for(let t of s)if(t.t==="tmpl"&&t.start>=0)return t.start}return-1}function Z(e,s){let n=s,t=null,r=0;while(r<e.length){let i=e[r];if(n){if(i==="*"&&e[r+1]==="/"){n=!1,r+=2;continue}r++;continue}if(t){if(i==="\\"){r+=2;continue}if(i===t)t=null;r++;continue}if(i==="'"||i==='"'||i==="`"){t=i,r++;continue}if(i==="/"){if(e[r+1]==="/")break;if(e[r+1]==="*"){n=!0,r+=2;continue}}r++}return n}function nt(e,s){let n=e.split(`
|
|
9
|
-
`),t=n.length,r=Array(t),i=s.format.quotes,o=s.format.semi===!0,c=0,f=0,g=!1,p=[];for(let m=0;m<t;m++){let a=n[m];if(g){g=Z(a,!0),r[m]=a;continue}let h=j(p),b=-1;if(p.length>0||a.indexOf("`")!==-1)b=U(a,p);if(h){r[m]=a;continue}if(b<0&&p.length===0)g=Z(a,!1);let w="",d=!1,C="";if(b>=0){w=a.slice(b);let _=a.slice(0,b);if(_.length===0){r[m]=w;continue}if(d=D.test(_),_.trim().length===0)C=_;a=_}if(a.length===0){r[m]="";continue}a=te(a,i);let E=0;while(E<a.length&&(a.charCodeAt(E)===32||a.charCodeAt(E)===9))E++;let k=a.slice(E).trimEnd();if(ye.test(k))c=Math.max(0,c-1);let N=xe.test(k)?1:0,v=a.slice(0,E);if(a=s.format.preserveCodeIndentation?v+k:Qe(c+f+N,s)+k,be.test(k))c+=1,f=0;else if(!k.startsWith("//")&&!k.startsWith("*")&&!k.startsWith("/*")){let _=k.replace(we,"");f=Ce(_)?f+1:0}if(a=tt(a),o){if(!Ee.test(a))if(ke.test(a))a="";else a=a.replace($e,";")}if(s.format.trimTrailingWhitespace)a=a.trimEnd();if(b>=0){if(C)a=C;else if(d&&!D.test(a))a+=" ";a+=w}r[m]=a}return r.join(`
|
|
10
|
-
`)}function st(e,s){let n=[],t=0,r=[];for(let i of e){let o=j(r);if(r.length>0||i.indexOf("`")!==-1)U(i,r);if(o){n.push(i),t=0;continue}if(i===""){if(t++,t<=s)n.push("")}else t=0,n.push(i)}return n}function Nt(e,s,n){if(e.length===0)return"";let r=(e.includes("\r")?e.replace(/\r\n/g,`
|
|
11
|
-
`):e).split(`
|
|
12
|
-
`),i;if(s.format.trimTrailingWhitespace){i=[];let g=0,p=Math.max(0,s.format.maxConsecutiveBlankLines),m=[];for(let a of r){let h=j(m),b=!1;if(m.length>0||a.indexOf("`")!==-1)b=U(a,m)>=0;if(h||b){i.push(a),g=0;continue}let w=a[a.length-1],d=w===" "||w==="\t"?a.replace(D,""):a;if(d===""){if(g++,g<=p)i.push("")}else g=0,i.push(d)}}else i=st(r,Math.max(0,s.format.maxConsecutiveBlankLines));let o=i.join(`
|
|
13
|
-
`);if(o=o.replace(Ge,""),F(n))o=at(o);if(Be(n)){let g=Ye(o,s);if(g!==o)o=g}if(We(n)){let g=ut(o,n);if(g!=null)o=g}if(Ke(n,o))o=ze(o,s);else if(F(n))o=nt(o,s);else o=qe(o,s.format.quotes,n);if(s.format.finalNewline==="none")return o.replace(/\n+$/g,"");let c=/[^\n]\n$/.test(o)||o===`
|
|
14
|
-
`,f=/\n\n$/.test(o);if(s.format.finalNewline==="two"){if(f)return o;if(c)return`${o}
|
|
15
|
-
`;return`${o}
|
|
16
|
-
|
|
17
|
-
`}if(f)return o.replace(/\n\n$/,`
|
|
18
|
-
`);if(c)return o;return`${o}
|
|
19
|
-
`}function q(e,s,n,t){for(let r=s+1;r<e.length;r++){let i=e[r];if(i==="\\"){r++;continue}if(i===n)return!0;if(i===t)return!1}return!0}function vt(e,s){if(/^\s*\/\/\/\s*<reference/.test(e))return[];let n=[],t=null,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(r){r=!1;continue}if(o==="\\"){r=!0;continue}if(!t){if(o==="/"&&e[i+1]==="/")break;if(o==="'"){if(s==="double"&&q(e,i,"'",'"'))n.push(i);t="single";continue}else if(o==='"'){if(s==="single"&&q(e,i,'"',"'"))n.push(i);t="double";continue}else if(o==="`"){t="template";continue}}else if(t==="single"&&o==="'"||t==="double"&&o==='"'||t==="template"&&o==="`"){t=null;continue}}return n}function At(e,s,n="spaces",t){if(n==="tabs")return/[^\t]/.test(e);if(/\t/.test(e))return!0;let r=e.length;if(t&&r%s===1){let i=t.trimStart();if(i.startsWith("* ")||i.startsWith("*/")||i==="*")return!1}return r%s!==0}function se(e,s){let n=s+1;while(n<e.length){let t=e[n];if(t==="\\"){n+=2;continue}if(t==="`")return n+1;if(t==="$"&&e[n+1]==="{"){n+=2;let r=1;while(n<e.length&&r>0){let i=e[n];if(i==="\\"){n+=2;continue}if(i==="`"){n=se(e,n);continue}if(i==="'"||i==='"'){n=ne(e,n,i);continue}if(i==="{")r++;else if(i==="}")r--;n++}continue}n++}return n}var rt=new Set(["return","typeof","instanceof","in","of","new","delete","void","do","else","case","yield","await"]);function re(e,s){let n=s-1;while(n>=0&&(e[n]===" "||e[n]==="\t"))n--;if(n<0)return!0;let t=e[n];if("(,=:[!&|?;{}<>+-*%^~".includes(t))return!0;if(/[\w$]/.test(t)){let r=n;while(r>=0&&/[\w$]/.test(e[r]))r--;return rt.has(e.slice(r+1,n+1))}return!1}function ie(e,s){let n=s+1,t=!1,r=-1;while(n<e.length){let i=e[n];if(i==="\\"){n+=2;continue}if(i==="["&&!t)t=!0,r=n;else if(i==="]"&&t){let o=e[r+1]==="^"?r+2:r+1;if(n!==o)t=!1}else if(i==="/"&&!t){n++;while(n<e.length&&/[a-z]/i.test(e[n]))n++;return n}n++}return-1}function it(e){if(!e.includes("'")&&!e.includes('"')&&!e.includes("`")&&!e.includes("/"))return{text:e,strings:[]};let s=[],n=[],t=0,r=0;while(t<e.length){let i=e[t];if(i==="/"){let o=e[t+1];if(o==="/"){if(t>r)n.push(e.slice(r,t));s.push(e.slice(t)),n.push(`@@S${s.length-1}@@`),r=e.length;break}if(o==="*"){let c=e.indexOf("*/",t+2),f=c===-1?e.length:c+2;if(t>r)n.push(e.slice(r,t));s.push(e.slice(t,f)),n.push(`@@S${s.length-1}@@`),t=f,r=t;continue}if(re(e,t)){let c=ie(e,t);if(c!==-1){if(t>r)n.push(e.slice(r,t));s.push(e.slice(t,c)),n.push(`@@S${s.length-1}@@`),t=c,r=t;continue}}t++;continue}if(i==="'"||i==='"'||i==="`"){if(t>r)n.push(e.slice(r,t));let o=t;if(i==="`")t=se(e,t);else{let c=i;t++;while(t<e.length){if(e[t]==="\\"){t+=2;continue}if(e[t]===c){t++;break}t++}}s.push(e.slice(o,t)),n.push(`@@S${s.length-1}@@`),r=t;continue}t++}if(r<e.length)n.push(e.slice(r));return{text:n.join(""),strings:s}}function ot(e,s){if(s.length===0)return e;return e.replace(/@@S(\d+)@@/g,(n,t)=>s[Number(t)]??"")}function ct(e){let s=new Set,n=/[$A-Z_][\w$]*/gi,t=n.exec(e);while(t!==null)s.add(t[0]),t=n.exec(e);return s}function at(e){let s=e[0];if(s!=="i"&&s!==" "&&s!=="\t"&&s!=="/"&&s!==`
|
|
20
|
-
`)return e;let n=e.split(`
|
|
21
|
-
`),t=[],r=[],i=[],o=0,c=0,f=-1,g=!1;while(o<n.length){let l=n[o];if(Q.test(l)){o++;continue}if(je.test(l)||X.test(l)){let y=o;if(X.test(l)){while(o<n.length&&!n[o].includes("*/"))o++;o++}else o++;if(!g){for(let R=y;R<o&&R<n.length;R++)r.push(n[R]);c=o}else if(f<0)f=y;continue}if(!De.test(l))break;let u=l.trim(),x=o+1;while(!V.test(u)&&x<n.length&&x-o<50)u+=` ${n[x].trim()}`,x++;if(!V.test(u))return e;let S=ft(u);if(!S)return e;if(f>=0){for(let y=f;y<o;y++)if(!Q.test(n[y]))i.push(n[y]);f=-1}t.push(S),o=x,c=o,g=!0}if(t.length===0)return e;let p=f>=0?f:c,m=n.slice(p).join(`
|
|
22
|
-
`),a=ct(m),h=(l)=>a.has(l);for(let l of t){if(l.kind!=="value")continue;l.named=l.named.filter((u)=>{if(u.alias)return!0;return h(u.name)})}let b=t.filter((l)=>{if(l.kind==="side-effect")return!0;if(l.kind==="type")return l.namedTypes.length>0;return Boolean(l.defaultName||l.namespaceName||l.named.length>0)}),w=new Map;for(let l of b){let u=w.get(l.source)||{};if(l.kind==="side-effect")u.side=u.side||[],u.side.push(l);else if(l.kind==="type"){if(!u.type)u.type={kind:"type",source:l.source,named:[],namedTypes:[],original:""};u.type.namedTypes=(u.type.namedTypes||[]).concat(l.namedTypes)}else{if(!u.value)u.value={kind:"value",source:l.source,named:[],namedTypes:[],original:""};if(l.defaultName)u.value.defaultName=l.defaultName;if(l.namespaceName)u.value.namespaceName=l.namespaceName;if(u.value.named=(u.value.named||[]).concat(l.named),l.namedTypes.length>0){if(!u.type)u.type={kind:"type",source:l.source,named:[],namedTypes:[],original:""};u.type.namedTypes=u.type.namedTypes.concat(l.namedTypes)}}w.set(l.source,u)}let d=[];for(let[l,u]of w){if(u.side)d.push(...u.side);if(u.value){let x=(S)=>{if(!S.alias)return S;return/^[A-Z]$/i.test(S.name)&&/^[A-Z]$/i.test(S.alias)?{name:S.alias,alias:S.name}:S};u.value.named=u.value.named.map(x),u.value.named.sort((S,y)=>S.name.localeCompare(y.name)),d.push(u.value)}if(u.type&&u.type.namedTypes.length>0){let x=new Set,S=(y)=>{if(!y.alias)return y;return/^[A-Z]$/i.test(y.name)&&/^[A-Z]$/i.test(y.alias)?{name:y.alias,alias:y.name}:y};u.type.namedTypes=u.type.namedTypes.map(S).filter((y)=>{let R=`${y.name}|${y.alias||""}`;if(x.has(R))return!1;return x.add(R),!0}),u.type.namedTypes.sort((y,R)=>y.name.localeCompare(R.name)),d.push(u.type)}}let C=(l)=>l.startsWith(".")?2:l.startsWith("node:")?0:1,E=(l)=>{if(l.kind!=="value")return 99;if(l.defaultName)return 0;if(l.namespaceName)return 1;return 2};d.sort((l,u)=>{if(l.kind!==u.kind){if(l.kind==="type")return-1;if(u.kind==="type")return 1;if(l.kind==="side-effect")return-1;if(u.kind==="side-effect")return 1}if(l.kind==="type"&&u.kind==="type"){let x=C(l.source),S=C(u.source);if(x!==S)return x-S;return l.source.localeCompare(u.source)}if(l.kind==="value"&&u.kind==="value"){let x=C(l.source),S=C(u.source);if(x!==S)return x-S;let y=E(l),R=E(u);if(y!==R)return y-R;return l.source.localeCompare(u.source)}return l.source.localeCompare(u.source)});let k=r.length>0?`${r.join(`
|
|
23
|
-
`)}
|
|
24
|
-
`:"";if(d.length===0){let l=m.replace(/^\n+/,""),u=[...i];if(k||u.length>0)return`${k}${u.length>0?`${u.join(`
|
|
25
|
-
`)}
|
|
26
|
-
`:""}${l}`;return l}let N=d.map(lt).join(`
|
|
27
|
-
`),v=i.length>0?`
|
|
28
|
-
${i.join(`
|
|
29
|
-
`)}`:"",_=m.replace(/^\n+/,""),fe=_.length>0?`
|
|
30
|
-
|
|
31
|
-
`:`
|
|
32
|
-
`;return`${k}${N}${v}${fe}${_}`}function lt(e){if(e.kind==="side-effect")return`import '${e.source}'`;if(e.kind==="type")return`import type { ${e.namedTypes.map((r)=>r.alias?`${r.name} as ${r.alias}`:r.name).join(", ")} } from '${e.source}'`;let s=[];if(e.defaultName)s.push(e.defaultName);if(e.namespaceName)s.push(`* as ${e.namespaceName}`);if(e.named.length>0){let t=e.named.map((r)=>r.alias?`${r.name} as ${r.alias}`:r.name).join(", ");s.push(`{ ${t} }`)}return`import ${s.join(", ")} from '${e.source}'`}function ft(e){let s=e.match(/^\s*import\s+['"]([^'"]+)['"]/);if(s)return{kind:"side-effect",source:s[1],named:[],namedTypes:[],original:e};if(s=e.match(/^\s*import\s+type\s+\{([^}]*)\}\s+from\s+['"]([^'"]+)['"]/),s){let a=s[1],h=s[2],b=a.split(",").map((w)=>w.trim()).filter(Boolean).map((w)=>{let d=w.match(/^(\w+)(?:\s+as\s+(\w+))?$/);return{name:d?.[1]||w,alias:d?.[2]}});return{kind:"type",source:h,named:[],namedTypes:b,original:e}}let n=e.match(/^\s*import\s+/),t=new RegExp(`\\sfrom\\s+['"]([^'"]+)['"]\\s*;?$`),r=e.match(t);if(!n||!r)return;let i=r[1],o=e.slice(n[0].length,r.index).trim(),c,f,g=[],p=[],m=o.match(/\{([^}]*)\}/);if(m){let h=m[1].split(",").map((b)=>b.trim()).filter(Boolean);for(let b of h){let w=/^type\s+/.test(b),C=b.replace(/^type\s+/,"").match(/^(\w+)(?:\s+as\s+(\w+))?$/);if(!C)continue;let E={name:C[1],alias:C[2]};if(w)p.push(E);else g.push(E)}o=o.replace(/\{[\s\S]*?\}/,"").trim()}if(o.length>0){let a=o.split(",").map((h)=>h.trim()).filter(Boolean);for(let h of a)if(h.startsWith("* as "))f=h.slice(5).trim();else if(/^\w+$/.test(h))c=h}return{kind:"value",source:i,defaultName:c,namespaceName:f,named:g,namedTypes:p,original:e}}function ut(e,s){if(Fe.test(s))return gt(e);if(Ue.test(s))return pt(e);return null}function oe(e){try{return JSON.parse(e)}catch{return null}}function P(e,s,n=[]){let t={};for(let i of s)if(Object.prototype.hasOwnProperty.call(e,i))t[i]=e[i];for(let i of n){let o=Object.keys(e).filter((c)=>i.test(c)&&!(c in t)).sort();for(let c of o)t[c]=e[c]}let r=Object.keys(e).filter((i)=>!(i in t)).sort();for(let i of r)t[i]=e[i];return t}function ee(e){let s={};for(let n of Object.keys(e).sort())s[n]=e[n];return s}function gt(e){let s=oe(e);if(!s||typeof s!=="object")return e;let t=P(s,["publisher","name","displayName","type","version","private","packageManager","description","author","contributors","license","funding","homepage","repository","bugs","keywords","categories","sideEffects","imports","exports","main","module","unpkg","jsdelivr","types","typesVersions","bin","icon","files","engines","activationEvents","contributes","scripts","peerDependencies","peerDependenciesMeta","dependencies","optionalDependencies","devDependencies","pnpm","overrides","resolutions","husky","simple-git-hooks","lint-staged","eslintConfig"]);if(Array.isArray(t.files)){if(t.files.every((o)=>typeof o==="string"))t.files=[...t.files].sort()}for(let i of Object.keys(t))if(/^(?:dev|peer|optional|bundled)?[Dd]ependencies(?:Meta)?$/.test(i)||/^(?:resolutions|overrides|pnpm\.overrides)$/.test(i)){if(t[i]&&typeof t[i]==="object")t[i]=ee(t[i])}if(t.pnpm&&typeof t.pnpm==="object"&&t.pnpm.overrides&&typeof t.pnpm.overrides==="object")t.pnpm.overrides=ee(t.pnpm.overrides);if(t.exports&&typeof t.exports==="object"){let i=t.exports,o=["types","import","require","default"];if(!Array.isArray(i)){let c={};for(let f of Object.keys(i)){let g=i[f];if(g&&typeof g==="object"&&!Array.isArray(g))c[f]=P(g,o);else c[f]=g}t.exports=c}}let r=["pre-commit","prepare-commit-msg","commit-msg","post-commit","pre-rebase","post-rewrite","post-checkout","post-merge","pre-push","pre-auto-gc"];for(let i of["gitHooks","husky","simple-git-hooks"])if(t[i]&&typeof t[i]==="object")t[i]=P(t[i],r);return JSON.stringify(t,null,2)}function pt(e){let s=oe(e);if(!s||typeof s!=="object")return e;let t=P(s,["extends","compilerOptions","references","files","include","exclude"]);if(t.compilerOptions&&typeof t.compilerOptions==="object"){let r=["incremental","composite","tsBuildInfoFile","disableSourceOfProjectReferenceRedirect","disableSolutionSearching","disableReferencedProjectLoad","target","jsx","jsxFactory","jsxFragmentFactory","jsxImportSource","lib","moduleDetection","noLib","reactNamespace","useDefineForClassFields","emitDecoratorMetadata","experimentalDecorators","libReplacement","baseUrl","rootDir","rootDirs","customConditions","module","moduleResolution","moduleSuffixes","noResolve","paths","resolveJsonModule","resolvePackageJsonExports","resolvePackageJsonImports","typeRoots","types","allowArbitraryExtensions","allowImportingTsExtensions","allowUmdGlobalAccess","allowJs","checkJs","maxNodeModuleJsDepth","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","allowUnreachableCode","allowUnusedLabels","alwaysStrict","exactOptionalPropertyTypes","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noPropertyAccessFromIndexSignature","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","useUnknownInCatchVariables","declaration","declarationDir","declarationMap","downlevelIteration","emitBOM","emitDeclarationOnly","importHelpers","importsNotUsedAsValues","inlineSourceMap","inlineSources","mapRoot","newLine","noEmit","noEmitHelpers","noEmitOnError","outDir","outFile","preserveConstEnums","preserveValueImports","removeComments","sourceMap","sourceRoot","stripInternal","allowSyntheticDefaultImports","esModuleInterop","forceConsistentCasingInFileNames","isolatedDeclarations","isolatedModules","preserveSymlinks","verbatimModuleSyntax","erasableSyntaxOnly","skipDefaultLibCheck","skipLibCheck"];t.compilerOptions=P(t.compilerOptions,r)}return JSON.stringify(t,null,2)}import{readdirSync as mt,readFileSync as ht,statSync as ae}from"fs";import{extname as yt,isAbsolute as W,join as B,resolve as bt}from"path";var Dt=5;function wt(e){let s="",n=0;while(n<e.length){let t=e[n];if(t==="*")if(e[n+1]==="*"){if(s+=".*",n+=2,e[n]==="/")n++}else s+="[^/]*",n++;else if(t==="?")s+="[^/]",n++;else if(t==="["){let r=e.indexOf("]",n);if(r===-1)s+="\\[",n++;else s+=e.slice(n,r+1),n=r+1}else if(".+^${}()|\\".includes(t))s+=`\\${t}`,n++;else s+=t,n++}return new RegExp(`^${s}$`)}function*le(e,s,n){let t;try{t=mt(e)}catch{return}for(let r of t){if(!n&&r.startsWith("."))continue;let i=B(e,r);if(s(i))continue;let o;try{o=ae(i)}catch{continue}if(o.isDirectory())yield*le(i,s,n);else yield i}}function*ce(e,s,n,t){yield*le(e,z(s,t),n)}async function Ft(e,s={}){let n=s.cwd??process.cwd(),t=s.ignore??[],r=s.dot??!1,i=s.absolute??!0,o=z(t,n);if(typeof globalThis.Bun?.Glob<"u"){let f=globalThis.Bun.Glob,g=[];for(let p of e){let m=new f(p);for await(let a of m.scan({cwd:n,dot:r,onlyFiles:s.onlyFiles??!0,followSymlinks:!1})){let h=W(a)?a:B(n,a),b=h.startsWith(`${n}/`)?h.slice(n.length+1):h;if(o(h))continue;g.push(i?h:b)}}return g}let c=[];for(let f of e){if(!/[*?[{]/.test(f)){let p=W(f)?f:B(n,f);try{if(!ae(p).isDirectory()){let a=p.startsWith(`${n}/`)?p.slice(n.length+1):p;if(!o(p))c.push(i?p:a)}else for(let a of ce(p,t,r,n))c.push(i?a:a.startsWith(`${n}/`)?a.slice(n.length+1):a)}catch{}continue}let g=wt(f);for(let p of ce(n,t,r,n)){let m=p.startsWith(`${n}/`)?p.slice(n.length+1):p;if(g.test(m)||g.test(m.replace(/\\/g,"/")))c.push(i?p:m)}}return c}function Ut(e){let s=0,n=[],t=()=>{if(n.length>0&&s<e)s++,n.shift()()};return(r)=>new Promise((i,o)=>{let c=()=>{r().then((f)=>{s--,i(f),t()},(f)=>{s--,o(f),t()})};if(s<e)s++,c();else n.push(c)})}var St={get TRACE(){return process.env.PICKIER_TRACE==="1"},get TIMEOUT_MS(){return Number(process.env.PICKIER_TIMEOUT_MS||"8000")},get RULE_TIMEOUT_MS(){return Number(process.env.PICKIER_RULE_TIMEOUT_MS||"5000")},get CONCURRENCY(){return Number(process.env.PICKIER_CONCURRENCY)||8},get DIAGNOSTICS(){return process.env.PICKIER_DIAGNOSTICS==="1"},get FAIL_ON_WARNINGS(){return process.env.PICKIER_FAIL_ON_WARNINGS==="1"},get NO_AUTO_CONFIG(){return process.env.PICKIER_NO_AUTO_CONFIG==="1"}},J=["**/node_modules/**","**/.git/**"],xt=["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.vercel/**","**/.netlify/**","**/.cache/**","**/.turbo/**","**/.vscode/**","**/.idea/**","**/.zed/**","**/.cursor/**","**/.claude/**","**/.github/**","**/coverage/**","**/.nyc_output/**","**/.tmp/**","**/.temp/**","**/vendor/**","**/pantry/**","**/target/**","**/zig-cache/**","**/zig-out/**","**/.zig-cache/**","**/__pycache__/**","**/.pytest_cache/**","**/venv/**","**/.venv/**","**/out/**","**/.DS_Store","**/Thumbs.db"];function Gt(e,s){let n=e[s];if(n===void 0){let i=s.indexOf("/");if(i>0){let o=s.slice(0,i),c=s.slice(i+1),f=o==="general"?"pickier":o==="pickier"?"general":null;if(f)n=e[`${f}/${c}`];if(n===void 0)n=e[c]}}let t,r;if(typeof n==="string"){if(n==="error")t="error";else if(n==="warn"||n==="warning")t="warning"}else if(Array.isArray(n)&&typeof n[0]==="string"){let i=n[0];if(i==="error")t="error";else if(i==="warn"||i==="warning")t="warning";r=n[1]}return{enabled:!!t,severity:t,options:r}}function M(e){let s=Array.isArray(e)?e[0]:e;if(typeof s!=="string")return;if(s==="off")return"off";if(s==="error")return"error";if(s==="warn"||s==="warning")return"warning";return}function Wt(e,s,n=[],t){for(let i of[s,...n]){let o=M(e.rules?.[i])??M(e.pluginRules?.[i]);if(o)return o==="off"?void 0:o}let r=M(t);return r==="off"?void 0:r}function Bt(e,s){return M(e.rules?.[s])==="off"||M(e.pluginRules?.[s])==="off"}function T(e,s){return`\x1B[${e}m${s}\x1B[0m`}function Ct(e){return T("32",e)}function Et(e){return T("31",e)}function kt(e){return T("33",e)}function $t(e){return T("34",e)}function Rt(e){return T("90",e)}function _t(e){return T("1",e)}var Jt={green:Ct,red:Et,yellow:kt,blue:$t,gray:Rt,bold:_t};function O(e,s){let n=s.ignores?[...new Set([...e.ignores||[],...s.ignores])]:e.ignores,t={...e.pluginRules||{},...s.pluginRules||{}};if((s.tailwind??e.tailwind)?.enabled&&!Object.prototype.hasOwnProperty.call(t,"pickier/sort-tailwind-classes"))t["pickier/sort-tailwind-classes"]="warn";return{...e,...s,verbose:s.verbose??e.verbose,ignores:n,lint:{...e.lint,...s.lint||{}},format:{...e.format,...s.format||{}},rules:{...e.rules,...s.rules||{}},pluginRules:t}}var G=null;async function Kt(e){if(!e){if(St.NO_AUTO_CONFIG){if(!G)G=O(I,{});return G}try{let{getConfig:t}=await import("./chunk-z7exyj5z.js"),r=await t();return O(I,r)}catch{}return O(I,{})}let s=W(e)?e:bt(process.cwd(),e);if(yt(s).toLowerCase()===".json")try{let t=ht(s,"utf8");return O(I,JSON.parse(t))}catch{return console.warn(`[pickier:warn] Config file not found: ${s}. Using default config values.`),O(I,{})}try{let t=await import(s);return O(I,t.default||t)}catch{return console.warn(`[pickier:warn] Config file not found: ${s}. Using default config values.`),O(I,{})}}function zt(e){return e.map((s)=>{if(/[*?[\]{}()!]/.test(s))return s;if(/\.[A-Z0-9]+$/i.test(s))return s;return`${s.replace(/\/$/,"")}/**/*`})}function Yt(e,s){let n=e.lastIndexOf(".");if(n<0)return!1;let t=e.slice(n);return s.has(t)}function K(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/")}function It(e){let s=[];for(let n of e){let t=K(n.trim());if(!t)continue;let r=t.match(/\*\*\/\*\.(.+)$/);if(r){s.push({raw:t,kind:"extension",value:r[1]});continue}let i=t.match(/\*\*\/(.+?)\/\*\*$/);if(i){s.push({raw:t,kind:"segment",value:i[1]});continue}let o=t.match(/\*\*\/(.+)$/);if(o)s.push({raw:t,kind:"suffix",value:o[1].replace(/\/$/,"")})}return s}function Ht(e){return[...new Set([...J,...e])]}function z(e,s=process.cwd()){let n=It([...J,...e]);if(n.length===0)return()=>!1;let t=new Set([...xt,...J]);return(r)=>{let i=K(r),o=K(s).replace(/\/$/,""),c=i!==o&&!i.startsWith(`${o}/`),f=c?i:i.slice(o.length);for(let g of n){if(c&&!t.has(g.raw))continue;if(g.kind==="extension"){if(f.endsWith(`.${g.value}`))return!0;continue}if(g.kind==="segment"||g.kind==="suffix"){let p=g.value;if(f.includes(`/${p}/`)||f.endsWith(`/${p}`))return!0}}return!1}}function Qt(e,s){return z(s)(e)}
|
|
33
|
-
export{ue as i,Y as j,Nt as k,vt as l,At as m,at as n,Dt as o,Ft as p,Ut as q,St as r,J as s,xt as t,Gt as u,M as v,Wt as w,Bt as x,T as y,Ct as z,Et as A,kt as B,$t as C,Rt as D,_t as E,Jt as F,O as G,Kt as H,zt as I,Yt as J,Ht as K,z as L,Qt as M};
|
package/dist/chunk-yx80g50v.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{b as a,c as b,d as c,e as d,f as e,g as f}from"./chunk-dsmbhdmt.js";import"./chunk-vdbbvx8x.js";import"./chunk-gy6wyx8t.js";import"./chunk-awmb5sg5.js";export{c as applyPlugins,a as lintText,f as runLint,b as runLintProgrammatic,e as scanContent,d as scanContentOptimized};
|
package/dist/chunk-z7exyj5z.js
DELETED