nry 1.1.0 → 1.1.1
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/CHANGELOG.md +69 -0
- package/LICENSE +1 -10
- package/README.md +5 -3
- package/bin.js +1 -1
- package/package.json +9 -6
- package/THIRD-PARTY-LICENSES.txt +0 -254
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# 更新日志 📔
|
|
2
|
+
|
|
3
|
+
## 1.1.1 (2026-6-27)
|
|
4
|
+
|
|
5
|
+
## 1.1.0 (2026-1-17)
|
|
6
|
+
|
|
7
|
+
## v1.0.1 (2025-11-11)
|
|
8
|
+
|
|
9
|
+
### 🐛 bug 修复
|
|
10
|
+
|
|
11
|
+
在输入的自定义的源为非法 URL 后,再次通过本程序设置将导致设置实效,建议使用
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# npm 源
|
|
15
|
+
npm config set registry
|
|
16
|
+
# pnpm 源
|
|
17
|
+
pnpm config set registry
|
|
18
|
+
# yarn 源
|
|
19
|
+
yarn config set registry
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## v1.0.0 (2025-11-11)
|
|
23
|
+
|
|
24
|
+
### 🎨 UI 改进
|
|
25
|
+
|
|
26
|
+
#### 1. 让 npm 的 registry 值更规范
|
|
27
|
+
|
|
28
|
+
- 默认的 `npm config get registry` 的值应当是 `https://registry.npmjs.org/` 而不是 `https://registry.npmjs.org` 。修改默认预设值并修改已有配置的用户的配置
|
|
29
|
+
|
|
30
|
+
所以,可能将之前标记为 ”曾用值“ 的带尾斜杠的修改为同 `value` (如果有)的下。
|
|
31
|
+
|
|
32
|
+
- 新增的自定义的 registry 将自动带上尾斜杠(如果没有的话)
|
|
33
|
+
- 移除旧的设置值并更新为带尾斜杠(在下一次交互时才会触发修改,但是使用 `nry` 设置时将自动追加尾斜杠)
|
|
34
|
+
|
|
35
|
+
## v0.1.3 (2025-8-16)
|
|
36
|
+
|
|
37
|
+
- 修复致命错误
|
|
38
|
+
|
|
39
|
+
## v0.1.2 (2025-7-30)
|
|
40
|
+
|
|
41
|
+
- 文档补充
|
|
42
|
+
|
|
43
|
+
## v0.1.1 (2025-7-24)
|
|
44
|
+
|
|
45
|
+
- 根据调用的包管理器不同配置不同的源,支持 `npm`、`yarn`、`pnpm`
|
|
46
|
+
|
|
47
|
+
## v0.1.0 (2025-7-19)
|
|
48
|
+
|
|
49
|
+
- 么事
|
|
50
|
+
|
|
51
|
+
## v0.0.4 (2025-6-22)
|
|
52
|
+
|
|
53
|
+
- 文档补充
|
|
54
|
+
|
|
55
|
+
## v0.0.3 (2025-6-17)
|
|
56
|
+
|
|
57
|
+
- list 时展示当前的非默认值的设定值(这会让 rs 命令看起来没有重置当前使用值)
|
|
58
|
+
|
|
59
|
+
## v0.0.2 (2025-6-15)
|
|
60
|
+
|
|
61
|
+
- 文档完善
|
|
62
|
+
|
|
63
|
+
## v0.0.1 (2025-6-15)
|
|
64
|
+
|
|
65
|
+
- 功能添加
|
|
66
|
+
|
|
67
|
+
## v0.0.0 (2025-6-14)
|
|
68
|
+
|
|
69
|
+
- 创建项目
|
package/LICENSE
CHANGED
|
@@ -13,13 +13,4 @@ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
13
13
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
14
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
15
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
|
|
17
|
-
# MIT 许可证
|
|
18
|
-
|
|
19
|
-
版权所有 (c) [2025] [泥豆君]
|
|
20
|
-
|
|
21
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
22
|
-
|
|
23
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
24
|
-
|
|
25
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|
|
16
|
+
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm install -g nry
|
|
|
14
14
|
|
|
15
15
|
## 使用
|
|
16
16
|
|
|
17
|
-
本应用使用 [
|
|
17
|
+
本应用使用 [@vvi/command](https://www.npmjs.com/package/@vvi/command) ,所以屏蔽了 `Ctrl + C` 、`Ctrl + D` ,但可采用*双击 `Esc` 退出*。
|
|
18
18
|
|
|
19
19
|
执行能力可能根据当前执行的包管理器有关,
|
|
20
20
|
|
|
@@ -34,6 +34,8 @@ npm install -g nry
|
|
|
34
34
|
|
|
35
35
|
相应的,对应的包管理器调用执行仅用于设置本包管理器的 `registry`。
|
|
36
36
|
|
|
37
|
-
##
|
|
37
|
+
## 状态
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
此软件包是 `MrMudBean` 生态系统的一部分。
|
|
40
|
+
它使用严格的 TypeScript 编写,并通过 Rollup 构建进行验证。
|
|
41
|
+
虽然单元测试较少,但 API 稳定,并在生产环境中大量使用。
|
package/bin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{statSync as e,readFileSync as t,readdirSync as n,writeFileSync as r,unlinkSync as o,mkdirSync as i}from"node:fs";import{arch as s,homedir as a}from"node:os";import{dirname as c,normalize as l,join as u,resolve as f}from"node:path";import"node:fs/promises";import{fileURLToPath as h}from"node:url";import{spawn as d}from"node:child_process";import{emitKeypressEvents as g}from"node:readline";import{resolve as p}from"node:path/posix";function b(e){return e.prototype.apply=Function.apply,e.prototype.bind=Function.bind,e.prototype.call=Function.call,e.prototype.length=Function.length,e.prototype.name=Function.name,e.prototype.toString=Function.toString,e}function m(e,t){return Object.keys(t).forEach(n=>e[n]=t[n]),e}function w(e){const t=typeof e;if("object"!==t&&"function"!==t)return t;const n=Reflect.apply(Object.prototype.toString,e,[]).replace(/^.*\s(.*)]$/,"$1").toLowerCase();return"error"!==n?n:e instanceof SyntaxError?"syntaxerror":e instanceof TypeError?"typeerror":e instanceof URIError?"urierror":e instanceof ReferenceError?"referenceerror":e instanceof AggregateError?"aggregateerror":e instanceof RangeError?"rangeerror":e instanceof EvalError?"evalerror":"error"}function y(e){return"string"===w(e)}function v(e){return"regexp"===w(e)}function x(e){return y(e)&&""===e.valueOf()}function $(e){return y(e)&&""===e.valueOf().trim()}function k(e){return"number"===w(e)}function E(e){return Number.isNaN(e)}function C(e){return 0===e}function I(e){return"boolean"===w(e)}function T(e){return!0===e}function O(e){return!1===e}function S(e){return null===e}function j(e){return void 0===e}function R(e){return"function"===w(e)}function N(e){return Array.isArray(e)}function M(e){if(N(e))return 0===e.length;throw new TypeError("参数必须为数组")}function D(e){return"object"===w(e)}function L(e){return D(e)&&0===Reflect.ownKeys(e).length}function B(e){return"symbol"===w(e)}function P(e,t){return void 0===t||("function"==typeof t?t(e):t)}function F(e=1,t=0){if(!isFinite(e)||!isFinite(t)||E(e)||E(t)||!k(e)||!k(t))throw new TypeError("getRandomInt: max or min is NaN or is not a number");let n=Math.ceil(Number(t)),r=Math.floor(Number(e));return r===n?r:(n>r&&([r,n]=[n,r]),Math.round(Math.random()*(r-n)+n))}function W(e){if(!D(e)&&!k(e)||k(e)&&E(e)||k(e)&&!isFinite(e)||k(e)&&!Number.isInteger(e)||k(e)&&Number.isInteger(e)&&e<1||k(e)&&e<1||D(e)&&(!k(e.length)||e.length<1||!Number.isInteger(e.length)))throw new TypeError("参数类型错误 ❌ (getRandomString)");const t={length:32,chars:"abcdefghijklmnopqrstuvwxyz",chars2:"0123456789",chars3:"!@#$%^&*()_+~`|}{[]:;?><,./-=",type:"string",includeUppercaseLetters:!1,includeNumbers:!1,includeSpecial:!1};if("uuid"===t.type)return crypto.randomUUID();k(e)&&Number.isInteger(e)&&e>0&&m(t,{length:e}),D(e)&&(m(t,e),t.length=t.length<1?32:t.length);const n=t.chars.split("");t.includeUppercaseLetters&&s(n,t.chars.toUpperCase()),t.includeNumbers&&s(n,t.chars2),t.includeSpecial&&s(n,t.chars3);let r="";const o=n.join(""),i=o.length;if(globalThis&&globalThis.crypto&&globalThis.crypto.getRandomValues){globalThis.crypto.getRandomValues(new Uint8Array(t.length)).forEach(e=>r+=o[e%i])}else for(let e=0;e<t.length;e++)r+=o[F(i-1)];function s(e,t){const n=e.length,r=t.length,o=Math.max(n,r);for(let i=0;i<o;i++)i<n&&!j(t[i])?e[i]+=t[i]:i<r&&(e[i]=t[i])}if(!/[a-zA-Z]/.test(r))return String.fromCharCode(F(97,122)).concat(r.slice(1));for(;!/^[a-zA-Z]$/.test(r[0]);)r=r.slice(1)+r[0];return r}function A(e,t=200){if(!R(e))throw new TypeError("callback must be a function");let n;k(t)&&(t={delay:t,this:null}),(j(t.delay)||!isFinite(t.delay)||t.delay<0)&&(t.delay=200);const r=()=>{n&&(clearTimeout(n),n=void 0)},o=(...o)=>{r(),n=setTimeout(()=>{try{const n=t&&t.this?t.this:null;e.apply(n,o)}catch(e){console.log("Debounce callback throw an error",e)}},Math.max(t.delay||5,5))};return o.cancel=()=>r(),o}function q(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _(){return!j(globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node||void 0)}async function z(e=1e3){if(!isFinite(e)||e<0)throw new TypeError("delay 应该是一个正常的数值");return C(e)?Promise.resolve():new Promise(t=>setTimeout(t,e))}const V=[!1,!0,"all","info","error","warn"];function G(e){return!!V.includes(e)&&e}function J(...e){}function H(){this.error=this.info=this.warn=J}const K=_()?"node":"browser",U="",Y=`${U}[`;function Z(){return new RegExp(`(\\x1b\\[(${["([1-4]?[0-9])(;([1-4]?[0-9]+))*m","[m]","\\?(25|7)[hl]","\\d*;?\\d*[HFr]","6n","\\d{0,4}[A-DTS]","[0-3]?[JKg]","[0-6]?W"].map(e=>`(${e})`).join("|")}))`.concat("|(\\x1b[78DMc])"),"g")}const Q=`${Y}0m`;function X(e,t=!0){if(T(t)){if(!y(e))throw new TypeError("`color` must be a string or number but not number[] when isHex is true");if(e.startsWith("0x"))e=e.replace(/0x/,"#");else if(!e.startsWith("#"))throw new TypeError("`color` must be a string or number but not number[] when isHex is true")}else{if(!O(t))throw new TypeError("The second variable `isHex` must be boolean");if(N(e)){if(e.some(e=>!isFinite(e))||3!==e.length)throw new TypeError("If the `color` is an array, it must be 3 in length and be of numeric type");e=`rgb(${e.join(",")})`}else{if(k(e))throw new TypeError("If the `color` is not number when isHex is false");if(y(e)){if(!e.startsWith("rgb(")||!e.endsWith(")"))throw new TypeError("If the `color` is a string, it must be rgb(r, g, b)");{const t=e.replace(/.*\((.*)\).*/,"$1").split(",");if(3!==t.length||t.some(e=>!isFinite(Number(e))||Number(e)<0||Number(e)>255))throw new TypeError("If the `color` is a string, it must be rgb(r, g, b)")}}}}let n=0,r=0,o=0;if(e.startsWith("#"))if(6==(e=e.slice(1)).length)n=ee(parseInt(e.slice(0,2),16)),r=ee(parseInt(e.slice(2,4),16)),o=ee(parseInt(e.slice(4,6),16));else{if(3!=e.length)return F(255);n=ee(parseInt(e.slice(0,1).repeat(2),16)),r=ee(parseInt(e.slice(1,2).repeat(2),16)),o=ee(parseInt(e.slice(2,3).repeat(2),16))}else if(e.startsWith("rgb")){const t=e.replace(/.*\((.*)\).*/,"$1").split(",");n=ee(Number(t[0])),r=ee(Number(t[1])),o=ee(Number(t[2]))}return 16+36*n+6*r+o}function ee(e){const t=isFinite(e)?Math.floor(6*e/256):F(6);return Math.min(5,Math.max(0,t))}function te(e,t,n,r=!0){const o=r?"38":"48";if(k(e)&&k(t)&&k(n))return`${o};5;${X([e,t,n],!1)}`;if(y(e)&&j(t)&&j(n)){if(e.startsWith("rgb"))return`${o};5;${X(e,!1)}`;if(e.startsWith("#")||e.startsWith("0x"))return`${o};5;${X(e,!0)}`;ne()}else{if(k(e)&&j(t)&&j(n))return`${o};5;${X(e,!0)}`;ne()}}function ne(){throw new TypeError(' 使用 color() 或 bgColor() 时,可使用三整数 `r , g , b` 或单字符串 `"rgb(r , g, b)"` 或十六进制数值 `0xrgb`、`0xrrggbb` 或十六进制字符串表达 `"#rgb"`、`"#rrggbb"` ,不接受其他格式的参数')}function re(e,t,n,r=!0){try{return te(e,t,n,r)}catch(e){throw console.error(e),new TypeError('使用 rgb() 或 bgRgb() 时,参数可以为单字符串 `"rgb(r, g, b)"` 或三个数值 `r , g ,b`。不接受其他格式')}}function oe(e,t=!0){try{return te(e,void 0,void 0,t)}catch(e){throw console.error(e),new TypeError('使用 hex() 或 bgHex() 时,参数可以为单字符串 `"0xnnnnnn"`、`"#rgb"` 、`"#rrggbb"` 或一个数值 `0xrrggbb`。不接受其他格式')}}function ie(e,t=!1){return e<0&&(e=0),e>255&&(e=255),e=isFinite(e)?Math.round(e):F(255),`${[48,38][Number(t)]};5;${e}`}const se={black:"38;5;0",red:"38;5;1",green:"38;5;2",yellow:"38;5;3",blue:"38;5;4",magenta:"38;5;5",cyan:"38;5;6",white:"38;5;7",brightBlack:"38;5;8",brightRed:"38;5;9",brightGreen:"38;5;10",brightYellow:"38;5;11",brightBlue:"38;5;12",brightMagenta:"38;5;13",brightCyan:"38;5;14",brightWhite:"38;5;15",bgBlack:"48;5;0",bgRed:"48;5;1",bgGreen:"48;5;2",bgYellow:"48;5;3",bgBlue:"48;5;4",bgMagenta:"48;5;5",bgCyan:"48;5;6",bgWhite:"48;5;7",bgBrightBlack:"48;5;8",bgBrightRed:"48;5;9",bgBrightGreen:"48;5;10",bgBrightYellow:"48;5;11",bgBrightBlue:"48;5;12",bgBrightMagenta:"48;5;13",bgBrightCyan:"48;5;14",bgBrightWhite:"48;5;15",bold:"1",dim:"2",italic:"3",underline:"4",blink:"5",reversed:"7",hide:"8",random:"random",bgRandom:"bgRandom",rgb:(e,t,n)=>re(e,t,n),hex:e=>oe(e),color:(e,t,n)=>te(e,t,n),number:e=>ie(e,!0),bgRgb:(e,t,n)=>re(e,t,n,!1),bgHex:e=>oe(e,!1),bgColor:(e,t,n)=>te(e,t,n,!1),bgNumber:e=>ie(e)};Object.freeze(se);const ae=["#000000","#c23621","#25bc24","#adad29","#492ee1","#dd38dd","#33bbc8","#cbcccd","#818383","#fc391f","#31e722","#eaec23","#5833ff","#f93578","#14f0f0","#ebeded"];function ce(e){let t=Number(e);if(!isFinite(t))throw new TypeError("色值反向解析出错");if(t<16){return ae[t]}const n=e=>Math.floor(256*e/6+F(42)).toString(16).padStart(2,"0");t-=16;const r=t%36;return`#${n(Math.floor(t/36))}${n(Math.floor(r/6))}${n(r%6)}`}class le{constructor(e){this.parse(e),this.build()}build(){this.hide&&(this.color="transparent"),this.reversed&&([this.color,this.bgColor]=[this.bgColor,this.color]),j(this.color)||(this.str+=`color: ${this.color};`),j(this.bgColor)||(this.str+=`background: ${this.bgColor};`),0!==this.bold&&(this.str+=`font-weight: ${1===this.bold?800:200};`),this.italic&&(this.str+="font-style: italic;"),this.underline&&(this.str+="border-bottom: 1px #666 solid;")}color=void 0;bgColor=void 0;bold=0;italic=!1;underline=!1;reversed=!1;hide=!1;str="";parse(e){e.replace(/38;5;(\d+)/g,"c-$1").replace(/48;5;(\d+)/g,"b-$1").split(";").reverse().forEach(e=>{0===this.bold&&e===se.bold?this.bold=1:0===this.bold&&e===se.dim?this.bold=-1:e===se.italic?this.italic=!0:e===se.underline?this.underline=!0:e===se.reversed?this.reversed=!0:e===se.hide?this.hide=!0:j(this.color)&&e.startsWith("c")?this.color=ce(e.split("-")[1]):j(this.bgColor)&&e.startsWith("b")&&(this.bgColor=ce(e.split("-")[1]))})}}function ue(e){return _()?[e]:function(e){e=e.replace(new RegExp("\\\\[0m","g"),"[m");const t=Z(),n=[""];let r,o=0,i="";const s=()=>{const t=e.substring(o,r?.index??e.length);n[0]+="%c".concat(t),n.push(i)};for(;!S(r=t.exec(e));)s(),i=j(r[7])?new le(r[3].slice(0,-1)).str:"",o=t.lastIndex;return s(),n}(e)}function fe(e,t){if(x(e=S(e)||j(e)?"":e.toString()))return"";if(M(t))return e;const n=e.indexOf(Y),r=e.indexOf(`${Y}0m`);return t=function(e){return e.map(e=>"random"===e?`38;5;${F(255)}`:"bgRandom"===e?`48;5;${F(255)}`:e)}(t),n>-1&&r>-1?fe(e.substring(0,n),t).concat(e.substring(n,r+4)).concat(fe(e.substring(r+4),t)):e.endsWith("\r\n")?(e=e.substring(0,e.length-2),`${Y}${t.join(";")}m${e}${Y}0m\r\n`):e.endsWith("\n")?(e=e.substring(0,e.length-1),`${Y}${t.join(";")}m${e}${Y}0m\n`):`${Y}${t.join(";")}m${e}${Y}0m`}function he(e,t){const n=parseInt(t);if(n>10){const r=T(38===n)?"38;5;":"48;5;",o=e.findIndex(e=>e.startsWith(r));return o>-1?e.toSpliced(o,1,t):[...e,t]}return e.includes(t)?[...e]:[...e,t]}const de=b(function(e=[]){const t=(t,...n)=>{if(P(t,()=>N(t)&&t.every(e=>y(e)))){let r="";for(let o=0;o<t.length;o++)r+=fe(t[o],e),o<n.length&&(r+=fe(n[o],e));return r}if(M(n))return fe(t,e);throw new Error("pen: 缺少参数")},n=Object.keys(se).map(t=>[t,{get:()=>function(e,t){let n=[];if(P(e,y(se[e])))return n=he(t,se[e]),new de(n);if("hex"===e||"bgHex"===e)return r=>(n=he(t,se[e](r)),new de(n));if("rgb"===e||"bgRgb"===e)return(r,o,i)=>{if(y(r)&&j(o)&&j(i))n=he(t,se[e](r));else{if(!(k(r)&&k(o)&&k(i)))throw new Error(`${e} 的参数类型不正确,请使用 'rgb' 或 'hex' 函数`);n=he(t,se[e](r,o,i))}return new de(n)};if("color"===e||"bgColor"===e)return(r,o,i)=>{if(y(r)&&j(o)&&j(i))n=he(t,se[e](r));else{if(!(k(r)&&k(o)&&k(i)))throw new Error(`${e} 的参数类型不正确,请使用 'rgb' 或 'hex' 函数`);n=he(t,se[e](r,o,i))}return new de(n)};if("number"===e||"bgNumber"===e)return r=>{if(k(r))return n=he(t,se[e](r)),new de(n);throw new TypeError(`${e} 的参数应为有效正整数数值,范围 0 - 255`)};throw new Error(`${e} 函数不存在`)}(t,e)}]),r=Object.fromEntries(n);return Object.defineProperties(t,r),t});const ge=new de([]),pe=new de([se.red]),be=new de([se.green]),me=new de([se.yellow]),we=new de([se.blue]),ye=new de([se.magenta]),ve=new de([se.cyan]);new de([se.white]);const xe=new de([se.brightBlack]),$e=new de([se.brightRed]),ke=new de([se.brightGreen]),Ee=new de([se.brightYellow]);new de([se.brightBlue]);new de([se.brightMagenta]);const Ce=new de([se.brightCyan]);new de([se.brightWhite]),new de([se.bgBlack]),new de([se.bgRed]),new de([se.bgGreen]),new de([se.bgYellow]),new de([se.bgBlue]),new de([se.bgMagenta]),new de([se.bgCyan]),new de([se.bgWhite]),new de([se.bgBrightBlack]),new de([se.bgBrightRed]),new de([se.bgBrightGreen]),new de([se.bgBrightYellow]),new de([se.bgBrightBlue]);const Ie=new de([se.bgBrightMagenta]);new de([se.bgBrightCyan]),new de([se.bgBrightWhite]);const Te=new de([se.bold]),Oe=new de([se.italic]),Se=new de([se.underline]),je=new de([se.hide]);new de([se.dim]),new de([se.blink]);const Re=new de([se.reversed]);ge.rgb;const Ne=ge.hex;ge.color,ge.bgRgb;const Me=ge.bgHex;function De(e){const t=Z(),n=e.replace(t,"");let r=0;for(let e=0,t=n.length;e<t;e++)r+=1+Number(Le(n[e]));return r}function Le(e){const t=e.codePointAt(0)||0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=131072&&t<=191471||t>=63744&&t<=64255||t>=65280&&t<=65519||t>=65381&&t<=65439||t>=127744&&t<=129750||t>=128512&&t<=128591||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=44032&&t<=55215||t>=12288&&t<=12351}function Be(e,t,n=!0){const r=t,o=e;if(0===r)return"";let i=!1;const s=De(o);if(s<=r)return o.concat(" ".repeat(r-s));const a=r>0,c=Z();c.lastIndex=0;const l=[...o.replaceAll(c,"")],u=a?l:l.reverse(),f=u.length,h=Math.abs(r);let d=Math.floor(h/2),g=u.slice(0,d).join(""),p=De(g);for(;d<f;){if(p+=De(u[d]),p===h){g+=u[d];break}if(p===h+1){n&&(i=!0);break}if(p>h+1)break;g+=u[d],d++}if(a&&o.startsWith(g)||!a&&o.endsWith(g=[...g].reverse().join("")))return i?g+" ":g;if(a){let e;for(c.lastIndex=0;null!==(e=c.exec(o));){const t=g;if(g=t.slice(0,e.index).concat(e[0]).concat(t.slice(e.index)),o.startsWith(g))break}g+=Q}else{const e=[...g];let t=e.length-1;g="";const n=[...o].reverse();for(let r=0,o=n.length;r<o;r++){const o=n[r];if(o===e[t])--t;else if(t<0)break;g=o+g}g=Q+g}return i?g+" ":g}function Pe(e){return`${Y}?7l${e.toString()}${Y}?7h`}function Fe(e){try{throw new Error}catch(t){const n=(t.stack?.split("\n")||[]).map(e=>{const t=/at\s(.*)\s\((.*):(\d*):(\d*)\)/.exec(e);return t?{name:t[1],path:t[2],line:t[3],column:t[4]}:{name:""}}),r=n.filter(e=>""!==e.name&&void 0!==e.path),o=r[3]??r[2]??r[1]??r[0],i=` ${"info"===e?"💡":"error"===e?"❌":"⚠️ "} ${(new Date).toLocaleString()} `,s=("info"===e?ge.bgCyan.brightWhite:"error"===e?ge.bgBlack.red:ge.bgBrightYellow.brightGreen)(i);console.log(`${s} ${o?.name??""} ${o?.line?.concat(" 行")} ${o?.column?.concat(" 列")}`)}}function We(...e){Fe("error"),console.error(...e)}function Ae(...e){Fe("warn"),console.warn(...e)}function qe(...e){Fe("info"),console.info(...e)}function _e(e,t,n){if("node"===K){const r=globalThis?.process.env[n.toUpperCase().concat("_DEV")]||globalThis?.process.env[n.toLowerCase().concat("_dev")];if(!1===e||j(r)||"false"===r)return Reflect.apply(H,t,[]);[...V,"true","false"].includes(r)&&(e="true"===r?"all":r),t.info=["all","info",!0].includes(e)?qe:J,t.error=["all","error",!0].includes(e)?We:J,t.warn=["all","warn",!0].includes(e)?Ae:J}else{if(!1===e)return Reflect.apply(H,t,[]);t.info=["all","info",!0].includes(e)?qe:J,t.error=["all","error",!0].includes(e)?We:J,t.warn=["all","warn",!0].includes(e)?Ae:J}}function ze(e){j(e)&&(e={name:W(10),type:!1}),I(e)&&(e={name:W(10),type:e}),y(e)&&(e={name:e,type:!1});let{name:t="",type:n=!1}=e;t=t.trim().replace(/\s+/g,"_");const r="node"===K&&(globalThis?.process.env[t.toUpperCase().concat("_DEV")]??globalThis?.process.env[t.toLowerCase().concat("_dev")])||!1;n="node"!==K||G(("false"!==r&&("true"===r||r))??n);const o={error:J,warn:J,info:J};_e(n,o,t);const i=(...e)=>{Reflect.apply(o.info,this,e)};return Object.setPrototypeOf(i,this),Object.defineProperties(this,{type:{get:()=>n||!1,set(e){const r=G(e);r!==n&&(n=r,_e(n,o,t))}},error:{value:(...e)=>Reflect.apply(o.error,this,e),configurable:!1,enumerable:!1,writable:!1},warn:{value:(...e)=>Reflect.apply(o.warn,this,e),configurable:!1,enumerable:!1,writable:!1}}),i}ge.bgColor,ge.random,ge.bgRandom,ge.number,ge.bgNumber,ze.prototype.clear=()=>{"browser"===K?console.clear():console.log(U.concat("c"))};const Ve=b(ze),Ge=new Ve({name:"nry",type:!1}),Je=O(Ge.type);function He(t){return e(t,{throwIfNoEntry:!1})}const Ke=new Ve({type:"error",name:"a node tools"});function Ue(...e){return l(u(...e))}function Ye(e,t="file",...n){n=n.filter(e=>y(e));let r=f(...n);const o=He(r);if(Ke("当前工作目录",r),!o)return Ke("🎯 工作目录不存在"),"";if(o.isFile())r=c(r);else if(!o.isDirectory())return;let i=20;const s=()=>{const n=He(Ue(r,e));if(n&&("file"==t&&n.isFile()||"directory"==t&&n.isDirectory()))return r;if(C(i))return;i--,Ke("♻️ 查找中...",r);const o=Ue(r,"..");return o!==r?(r=o,s()):void 0};return s()}function Ze(n){if(!/.json^/.test(n)&&!e(n,{throwIfNoEntry:!1}))return null;try{const e=t(n,{encoding:"utf-8"});return JSON.parse(e||"null")}catch(e){return Ke.error(e),null}}const Qe=function(e,t){try{return r(e,JSON.stringify(t,null,2),{encoding:"utf-8",flag:"w"}),!0}catch(e){return Ke.error(e),!1}},Xe=()=>_()&&process&&process.stdout&&process.stdout.isTTY||!1,et=_()&&"win32"===process.platform||!_()&&window.navigator.userAgent.includes("Windows");function tt(e){const t=new RegExp(e);let n;try{throw new Error}catch(e){n=e}const r=(n.stack?.replace(/\\/gm,"/").split("\n")).reverse(),o=r.findIndex((e,n,r)=>!t.test(e)&&t.test(r[n+1]));if(-1==o)return{name:"",line:0,row:0,originArr:r};let i=r[o];return/\(.*\)/.test(i)&&(i=i.replace(/^.*\((.*)\).*/,"$1")),/file:\/*/.test(i)&&(i=i.replace(/^.*file:\/*(.*)/,"$1")),et||i.startsWith("/")||(i="/"+i),{name:i.replace(/^(.*):\d+:\d+$/,"$1"),line:Number(i.replace(/^.*:(\d+):\d+$/,"$")),row:Number(i.replace(/^.*:\d+:(\d+)$/,"$1")),originArr:r}}function nt(){let e;try{new Function('import("")'),e=h(import.meta.url)}catch(t){Ke.error(t),e=__filename}et&&(e=e.replace(/\\/gm,"/")),e=tt(e).name;return[e,c(e)]}const{stdin:rt}=process,ot={list:[],listened:!1,on(e,t,n){O(this.listened)&&(this.listened=!0,g(process.stdin),Xe()&&process.stdin.setRawMode(!0),process.stdin.resume(),rt.on("keypress",at),process.on("beforeExit",it),process.stdin.on("end",st));const r=this.list,o={key:e,callback:t,resolve:n};return M(r)&&Ke("当前执行的栈中没有数据",o),r.push(e),this[e]=o,o},remove(){const e=this.list,t=e.shift();return t&&this.del(t),Ke("执行完毕一项,还有:",e),!(e.length>0)&&(this.listened=!1,it(),Ke("监听已移除"),!0)},del(e){Ke("开始移除",e);const t=this.list[0]===e&&!j(this[e]);if(Ke("当前 key 是否为当前执行项",t),t)return this.remove(),!0;{const t=this.list.includes(e),n=!j(this[e]);return t&&n?(this.list.splice(this.list.indexOf(e),1),this[e].resolve(!0),delete this[e],!0):t?(this.list.splice(this.list.indexOf(e),1),!0):!!n&&(this.list.splice(this.list.indexOf(e),1),this[e].resolve(!0),!0)}}};function it(){rt.removeListener("keypress",at),process.removeListener("beforeExit",it),process.stdin.removeListener("end",st),Xe()&&rt?.setRawMode(!1),rt.pause()}function st(){it()}function at(e,t){const n=ot[ot.list[0]],{callback:r,resolve:o}=n;Ke("当前执行的回调是",{...n,rl:"原始值为 readline 的 Interface 对象"}),R(r)?T(Reflect.apply(r,null,[e,t]))&&(Ke("回调遇见了想待的键,执行了退出操作,keyValue: < ",e,"> key: <",t,">"),ot.remove(),o(!0)):(ot.remove(),o(!1))}const ct=(e,t)=>async function(e,t){if(!_())throw new RangeError("当前环境不支持 readInput");const n=t??Symbol(W(3));return new Promise(t=>{ot.on(n,e,t)})}(e,t);function lt(e="",t=!0){let n="";const r=w(e);if(!I(t))throw Ke.error(""),new TypeError("lineFeed 的类型必须是 boolean ");if("bigint"===r){const r=Object.prototype.toString.call(e).concat("n");n=t?`${r}\n`:`${r}`}else if(["string","number","boolean","function","null"].includes(r))n=t?`${e}\n`:`${e}`;else{const r=JSON.stringify(e,(e,t)=>R(t)?`${t}`:null==t?"undefined":t,2);n=t?`${r}\n`:`${r}`}_()?process.stdout.write(n):console.log(...ue(n.replace(/\n$/,"")))}function ut(e,t=!0){lt(`${t?Y:U}${e}`,!1)}function ft(){ut("?25l")}function ht(){ut("?25h")}function dt(e=!1){e&&pt(1/0),ut("0J")}function gt(e=1,t=!1){ut(`${mt(e,"vertical")}A`),t&&pt(1/0)}function pt(e=1){ut(`${mt(e)}D`)}function bt(e=1){ut(`${mt(e)}C`)}function mt(e,t="horizontal"){(!k(e=Number(e))||isNaN(e)||e<1||!1===Number.isInteger(e)&&e!==1/0)&&(e=1);const n=_()?"horizontal"===t?process.stdout.columns:process.stdout.rows:80;return(1/0===e||e>n)&&(e=n),e}function wt(){ht()}function yt(e){const t=e[e.length-1];y(t)&&!t.endsWith("\n")&&e.push("\n"),e.forEach(e=>lt(e,!1))}function vt(e,t){const{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}=t??{show:!0,info:"请等待",prefix:0,interval:20,canCtrlCExit:!1,canCtrlDExit:!1,beforeDestroyed:()=>{}},l=I(e)?{show:e,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:y(e)?{show:n,info:e,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:j(e)?{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:k(e)?{show:!0,info:"请等待",prefix:isNaN(e)?o:Math.min(Math.max(0,e),2),interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c,...e};return l.interval=isFinite(l.interval)?Math.max(20,Math.min(2e3,l.interval)):i,l.info=l.info.replace(/\n/g,"\\n"),l}function xt(){ht()}Object.defineProperties(ct,{remove:{value:e=>ot.del(e)}});const $t=[".","..","...","....","...",".."],kt=[["⋯","⋱","⋮","⋰","⋯","⋱","⋮","⋰"],["🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚","🕛"],["🕜","🕝","🕞","🕟","🕠","🕡","🕢","🕣","🕤","🕥","🕦","🕧"],["👈","👆","👉","👇","🤘","🤟","🫳","🫴","👊"],["🌞","🌕","🌖","🌗","🌜","🌘","🌑","🌒","🌓","🌛","🌔","🌔","🌔","🌝"]];class Et{#e;#t=void 0;#n=Symbol("waiting-tips");#r=[];#o=(...e)=>yt(e);state="destroyed";#i=0;#s=4e4;#a=!1;async destroyed(){"destroyed"!==this.state&&(this.state="destroyed",this.#i=0,j(this.#t)||clearInterval(this.#t),ct.remove(this.#n),pt(1/0),dt(),process.removeListener("exit",wt),process.removeListener("SIGINT",xt),ht(),this.#r.forEach(e=>this.#o(...e)),this.#r.length=0,this.log=this.#o,!function(e){return"promise"===w(e)}(this.#e.beforeDestroyed)?this.#e.beforeDestroyed(this.#a):await this.#e.beforeDestroyed(this.#a),this.#a=!1)}log=this.#o;run(e){"run"===this.state&&this.destroyed(),this.#a=!1,this.state="run",this.#i=Date.now(),this.#e=j(e)?this.#e:vt(e,this.#e);const{prefix:t,info:n,interval:r,canCtrlCExit:o,canCtrlDExit:i}=this.#e;this.log=(...e)=>this.#r.push(e);const s=$t.length,a=kt[Math.min(kt.length-1,Math.max(t,0))],c=a.length,l=a.reduce((e,t)=>Math.max(e,De(t)),0);let u=0;ft(),process.on("exit",wt),process.on("SIGINT",xt),this.#t=setInterval(()=>{dt(!0),this.#r.forEach(e=>yt(e)),this.#r.length=0,lt("\n".repeat(2)),gt(3),ut(7,!1);const e=Be(a[++u%c],l);Date.now()-this.#i<this.#s?lt(Pe(`${e} ${n.replace(/\n/,"\\n")}${$t[Math.floor(u/10)%s]}`),!1):lt(Pe(`${e} ${n} ${ye`当前已执行 ${Math.ceil((Date.now()-this.#i)/1e3)} 秒`}\n \n\r${ve`可使用双击 esc 键退出(确保执行完成,若执行仍在期望时间内,请忽略)`}`),!1),ut(8,!1)},r),ct((e,t)=>!!(t?.meta&&t?.sequence===U.repeat(2)||T(t?.ctrl)&&(o&&"c"===t?.name||i&&"d"===t?.name))&&(this.#a=!0,this.destroyed(),!0),this.#n)}set timeout(e){this.#i=Date.now(),this.#s=!isFinite(e)||e<0?4e4:e<600?1e3*e:e}get timeout(){return this.#s}constructor(e){this.#e=vt(e),T(this.#e.show)&&this.run()}}function Ct(e,t,n){let r=e.toString().trim();return/\n$/.test(r)||(r=r.concat(et?"\r\n":"\n")),r=r.replace(/\n+/g,"\n"),dt(),t&&n.log(r),r}function It(e,t){if(O(_()))throw new RangeError("当前环境不支持 node 环境");const{env:r}=t;y(e)&&(r.code=e,e={code:e,waiting:!1});const o=process.cwd();let i=p(o,e.cwd||"");-1===function(e){try{const t=He(e);if(t&&t.isDirectory())return 0==n(e,{withFileTypes:!0}).length?1:0}catch(e){return Ke.error("is ",e),-1}return-1}(i)&&(Ke(`执行目录 ${pe(i)} 不存在,使用命令执行目录 ${ve(o)}`),i=o);const s=e.code.replace(/\s{2,}/g," ").trim().split(" ");Object.assign(t.env,{shell:!0,hideWaiting:!0,waitingMessage:"请稍等",printLog:!1,...e,cmd:s,cwd:i})}function Tt(e){const t={result:{success:!1,data:"",error:"",status:1,isSIGINT:!1,runCode:"",runCwd:""},env:{cmd:[],code:"",cwd:"",printLog:!1,shell:!0,callBack:()=>{},waiting:{show:!1,info:"",prefix:0,interval:10,canCtrlDExit:!1,canCtrlCExit:!1,async beforeDestroyed(){}}}},{env:n,result:r}=t;Ke("runOtherCode 方法 开始执行 "),It(e,t),Ke("执行参数",t);const{cmd:o,waiting:i,cwd:s,shell:a,code:c}=n,[l,u]=(()=>{if(i instanceof Et)return[i,"run"===i.state];const e=vt(i);return[(t=e,new Et(t)),e.show];var t})();r.runCode=c,r.runCwd=s||process.cwd();try{return new Promise(e=>{const n=T(a)?d(c,[],{cwd:s,shell:a}):d(o[0],o.slice(1),{cwd:s,shell:a});u&&l.run({beforeDestroyed:e=>{if(e){if(Ke("执行退出前"),et){try{n.killed||n.kill(-1)}catch(e){Ke.error("使用 child.kill(child.pid, -1 ) 关闭子进程失败",e),d("taskkill",["/pid",n.pid?.toString()||"","/T","/F"],{stdio:"pipe"})}Ke("终结在 windows 下的子进程")}else n.kill("SIGTERM"),Ke("终结在非 windows 下的子进程");t.result.isSIGINT=!0}}}),n.on("spawn",()=>function(e){const{result:t}=e;Ke("子线程已启动,运行状态良好"),t.success=!0,t.status=1}(t)),n.stdout.on("data",e=>function(e,t,n){const{env:r,result:o}=t,i=Ct(e,r.printLog,n);Ke(Ie`stdout on data`,i),o.data+=i}(e,t,l)),n.on("exit",(e,t)=>{Ke("子进程已退出了,退出码为 <",e,">"),S(t)||Ke.error("子进程被其他信号中断执行,执行的退出信号为:",t)}),n.stderr.on("data",e=>function(e,t,n){const{env:r,result:o}=t,i=Ct(e,r.printLog,n);Ke(Ie`stderr on data`,i),o.error+=i}(e,t,l)),n.on("error",e=>function(e,t,n){const{env:r,result:o}=t;{const t=Ct(e,r.printLog,n);Ke(Ie`error`,t),Ke.error("error",t),o.success=!1,o.status=""!==o.data?2:3,o.error+=t}}(e,t,l)),n.on("close",(n,r)=>function(e,t,n,r,o){const{env:i,result:s}=r,{callBack:a}=i;Ke("进行正常关闭",e),setTimeout(async()=>{a&&R(a)&&Reflect.apply(a,null,[]),await o.destroyed(),0!==e&&"SIGINT"!==t&&"SIGTERM"!==t?(s.success=!1,s.status=3):"SIGINT"!==t&&"SIGTERM"!==t||(s.success=!1,s.status=4,s.isSIGINT=!0),n(s)})}(n??0,r??"",e,t,l))})}catch(e){const t=e.toString();return Ke.error("创建(但是确是非 node 无法创建子进程,而是更上游的 node 创建的错误)子进程出错",e),new Promise(e=>{(async()=>{await l.destroyed()})(),r.error=t,r.success=!1,r.status=0,e(r)})}}const Ot=e=>Tt(e);async function St(e,t=10){if(!y(e))throw new TypeError("str 需是一个字符串");if(!isFinite(t)||t<0||t>1e4)throw new RangeError("delay 需是一个 0 到 10000 之间(不包括两端)的数值");const n=Array.from(e);if(0!==n.length){for(const r of n)await z(t),Ke(`当前字符 ${Te(r)} 长度为:`,r.length),Ke(`当前字符 ${ge.reversed(r)} 在 charCodeAt`,r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2)),1===r.length&&E(r.charCodeAt(1))?lt(r,!1):2===e.length&&e.charCodeAt(0)>=55296&&e.charCodeAt(0)<=56319&&e.charCodeAt(1)>=56320&&e.charCodeAt(1)<=57343?(lt(r,!1),lt(" ",!1)):2===e.length&&65039===e.charCodeAt(1)?(lt(r,!1),lt(" ",!1)):(lt(r,!1),lt(" ",!1));lt()}else lt()}const jt=process.argv.slice(2);Object.freeze(jt);class Rt{originalArg=jt.slice();name="";__filename="";get state(){return this._state}set state(e){this._state=[void 0,{code:1,text:"start"},{code:2,text:"bind over"},{code:3,text:"run over"},{code:4,text:"over",overCode:e}][k(e)?e:4]}_state={code:1,text:"start"};args=new Nt;abbr={};helpInfo="";hasShowVersion=!1;originalBind={};values=[]}class Nt extends Array{get $nomatch(){return[]}get $map(){return{}}get $arrMap(){return[]}get $only(){return[]}get $original(){return[]}get $isVoid(){return!1}}const Mt={},Dt=new Ve({name:"a command"}),Lt=O(Dt.type);function Bt(e){return[e.replace(/^(.*?)\s.*/gm,"$1")||"",/<.+>/.test(e)&&e.replace(/.*<(.+)>.*/,"$1")||"",e.replace(/.*?\((.*)\).*?/,"$1")||""]}function Pt(e,t){switch(t.state.code){case 3:return void Dt.warn("执行绑定","但是已经执行过 `run`");case 4:return void Dt.warn("执行绑定,但是 command 已完成全部应做动作");default:t.state=2}if(y(e)){const[n,r,o]=Bt(e);return Pt({name:n,abbr:r,info:o},t)}if(N(e))return e.forEach(e=>Pt(e,t));if(!j(e)&&!e.name&&!e.info)return function(e,t){const n={name:"",info:"",abbr:"",options:[]},r=Object.keys(e),o=Object.keys(n);return r.forEach(n=>{if(!o.includes(n)){const[r,o,i]=Bt(n);return Pt({name:r,info:i,abbr:o,options:e[n]},t)}})}(e,t);const n=e;n.abbr&&(t.abbr[n.abbr]=n.name),n.options?n.options=function(e,t,n){N(e)||(e=[e]);const r={};return e.forEach(e=>{let o={name:"",abbr:"",info:""};y(e)?[o.name,o.abbr,o.info]=Bt(e):o=Object.assign(o,e),o.abbr&&(n.abbr[`${t}^${o.abbr}`]=o.name),r[o.name]=o}),r}(n.options,n.name,t):n.options={},t.originalBind[n.name]={abbr:"",...n}}function Ft(){return new Proxy(new Rt,{get(e,t,n){if("args"===t){const t=JSON.parse(JSON.stringify(e[Symbol.for("_args")]||[]));return new Proxy(t,{get(n,r,o){return"$nomatch"===r?e.values.slice():"$map"===r?function(e){if(M(e))return{};const t=new Object;return e.forEach(e=>{const n=t[e.name]||{};n.value=[...n.value||[],...e.value||[]],e.options&&e.options.forEach(e=>{n[e.name]=[...n[e.name]||[],...e.value||[]]}),t[e.name]=n}),t}(t):"$arrMap"===r?M(i=t)?[]:i.map(e=>{const t={},n=t[e.name]||{};return e.value&&!M(e.value)&&(n.value=e.value),j(e)||j(e.options)||M(e.options)||(n.options=[],e.options.forEach(e=>{n.options?.push(Object.fromEntries([[e.name,e.value]]))})),t[e.name]=n,t}):"$only"===r?[...new Set(t.map(e=>e.name))]:"$original"===r?jt.slice():"$isVoid"===r?0==jt.slice().length:Reflect.get(n,r,o);var i},set:(e,t,n,r)=>(Reflect.set(e,t,n,r),!0)})}return Reflect.get(e,t,n)},set:(e,t,n,r)=>("args"===t?e[Symbol.for("_args")]=n:Reflect.set(e,t,n,r),!0)})}const Wt=" ".repeat(4);function At(e){return e.state="help",y(e.helpInfo)&&"help"!==e.helpInfo?function(e,t){const n=e.originalBind[t];if(lt(`${Wt}${n.name}${Wt}${ye(n.info)}\n`),n.options&&!L(n.options)){lt(`${me(`${Wt}使用:`)} ${e.name} ${t} [subOptions/subAbbr [value]]\n`),lt(`${ve(`${Wt}subOptions:`)} \n`),qt(n.options||{})}else{lt(`${be(`${Wt}使用:`)} ${e.name} ${t} [value]\n`)}}(e,e.helpInfo):N(e.helpInfo)&&2==e.helpInfo.length?function(e){const t=e.name,n=e.helpInfo.join(" "),r=e.originalBind[e.helpInfo[0]].options[e.helpInfo[1]].info;lt(`${ve(" 可使用:")} ${t} ${n} [value]\n${be(" 描述:")} ${r}`)}(e):function(e){lt(`${$e(" 可使用:")} ${e.name} options/abbr [subOptions/subAbbr [value]]\n\n选项:\n`);const t=qt(e.originalBind);!function(e){["version -v 版本描述","help -h 帮助查看"].forEach(t=>{const[n,r,o]=t.split(" ");lt(_t({len:e,name:n,info:o,abbr:r})),lt("")})}(t)}(e)}function qt(e){const t=Object.keys(e).sort();let n=8;t.forEach(e=>n=Math.max(n,e.length));const r=Math.min(15,n+1);return lt(_t({len:r,name:"子命令",info:"描述",abbr:"缩写",color:!1})),lt(""),t.forEach(t=>{const{name:n,abbr:o,info:i}=e[t];let s=!1;"options"in e[t]&&!L(e[t].options)&&(s=!0),lt(_t({len:r,name:n,info:i,abbr:o,textDecoration:s})),lt("")}),r}function _t(e){const t=Object.assign({name:"",info:"",abbr:"",len:15,color:!0,textDecoration:!1},e);let n=ge[t.color?"green":"black"](Wt);return n+=ge[t.textDecoration?"blue":"black"](t.name.slice(0,t.len)),n+=" ".repeat(t.len+1-zt(t.name,t.len)),n+=ge[t.color?"yellow":"black"]`${t.abbr?.slice(0,6)||""}${" ".repeat(7-zt(t.abbr||"",6))}`,n+=t.color?ye(t.info):t.info,n}function zt(e,t){return Math.min(e.replace(/[^\x00-\x7f]/,"11").length,t)}const Vt="";function Gt(e){const{name:t,object:n,item:r,result:o}=e;$(t)||(r.name&&n.options?.push(r),o.push(JSON.parse(JSON.stringify(n))))}function Jt(e,t){"true"==e?e=!0:"false"==e?e=!1:e==Number(e)&&(e=Number(e)),$(t.name)?t.values.push(e):t[t.item.name?"item":"object"].value.push(e)}function Ht(e,t){const n=[];let r="";const o=(e,t)=>j(t)||$(t)?n.push(e):n.push(e,t);function i(e,s){if(!$(r)){if(t.originalBind[r].options[e])return o(e,s);const n=t.abbr[`${r}^${e}`];if(!j(n))return o(n,s)}if(t.originalBind[e])return r=e,o(e,s);if(t.abbr[e])return e=t.abbr[e],r=e,o(e,s);if(e.includes("=")){const t=e.indexOf("=");if(0===t||t===e.length-1)return n.push(e);const[r,o]=[e.slice(0,t),e.slice(t+1)||"true"];return i(r,o)}return j(s)||$(s)?n.push(e):n.push(`${e}=${s}`)}return e.forEach(e=>i(e)),n}function Kt(e,t,n){n.init(),e=Ht(e.filter(e=>""!==e),t),e.forEach(e=>{const{name:r}=n;return e=e.trim(),/^([a-z]|[A-Z]|-|\$|_)/.test(e)?!$(r)&&t.originalBind[r].options&&t.originalBind[r].options[e]?function(e,t){const{item:n,object:r}=t;n.name&&r.options.push(n),t.resetItem(e)}(e,n):t.originalBind[e]?function(e,t){$(t.name)||(Gt(t),t.resetItem("")),t.resetObject(e)}(e,n):Jt(e,n):Jt(e,n)}),Gt(n)}function Ut(e){switch(e.state.code){case 3:return void lt("已经执行过 `run`");case 4:return void lt("已完成全部");default:e.state=3}!function(e){if(2==process.argv.length)return;const t=e.originalArg,n=`${Vt}${t.join(Vt)}${Vt}`,r=t.findIndex(e=>/^(-h|help)$/.test(e));if(new RegExp(`${Vt}(-v|version)${Vt}`,"i").test(n))return void(e.hasShowVersion=!0);if(C(r))return void(e.helpInfo="help");let o=[];const i={result:[],values:[],name:"",object:{name:"",value:[],options:[]},item:{name:"",value:[]},resetObject(e){this.name=e,this.object={name:e,value:[],options:[]}},resetItem(e){this.item={name:e,value:[]}},init(){this.result=[],this.values=[],this.resetItem(""),this.resetObject("")}};r>0?(Kt(t.slice(0,r+1),e,i),e.values=i.values,e.args=i.result,o=e.args,M(o)?e.helpInfo="help":[j,M].some(e=>e(o[0].options))?e.helpInfo=o[0].name:e.helpInfo=[o[0].name,o[0].options[0].name]):(Kt(t,e,i),e.values=i.values,e.args=i.result)}(e),function(e){["name","originBind","abbr"].forEach(t=>{const n=t;e[n]&&(Object.freeze(e[n]),Object.defineProperty(e,t,{value:e[n],writable:!1,enumerable:!0,configurable:!1}))})}(e)}function Yt(e){e.state="version";const t=Ye("package.json","file",tt(e.__filename).name);if(j(t))return Zt();const n=Ue(t,"package.json");if(!He(n))return Zt();const r=Ze(n);if(S(r))return Zt();const{platform:o}=process,i=ge.brightCyan(r.name),a=r.version,c="win32"==o?"Windows":"darwin"==o?"mac":o,l=ge.brightMagenta(s());lt(`${i} 版本 ${ge.brightRed(a)} (${c} ${l})`)}function Zt(){lt("抱歉,未找到版本定义说明")}const Qt=Ne("#333"),Xt=Ne("#666"),en=Ne("#aaa"),tn=Me("#666"),nn=Xt(".".repeat(3)),rn=(e="❖")=>ke(e),on=(e="▶︎")=>Ee(e),sn=(e="⚉")=>$e(e),an=(e="◦")=>Xt(e),cn=(e="●")=>ke.blink(e),ln=(e="□")=>Xt(e),un=(e="□")=>ke.blink(e),fn=(e="■")=>Xt(e),hn=(e="■")=>ke.blink(e);function dn(e,t="⚉"){lt(`${sn(t)} ${Ne("#612").italic(e)}`)}function gn(e,t="❖"){lt(`${rn(t)} ${e}`)}const pn={callList:[],on(e,t){const n=this.callList;M(n)&&(Dt("当前执行列表为空,直接执行任务",e),Reflect.apply(t,void 0,[])),n.push([e,t])},remove(e){const t=this.callList,n=t.findIndex(([t])=>t===e);return t.splice(n,1),M(t)?(Dt("当前执行列表为空,返回 true 结束执行"),!0):(Reflect.apply(t[0][1],null,[]),!1)}},bn={data:"",kind:0,multi:!1,progressCount:0,indexOfCursor:0,init:function(e){this.data=e,this.multi=N(e)}},mn={get kind(){return bn.kind},set kind(e){(!isFinite(e)||0!=e&&1!=e)&&(e=0),bn.kind=e},get multi(){return bn.multi},enterText:[],get progressCount(){return bn.progressCount},set progressCount(e){bn.progressCount=e,e<0&&Reflect.apply(wn,this,[])},get indexOfCursor(){return bn.indexOfCursor},set indexOfCursor(e){bn.indexOfCursor=e},currentIssue:{text:"请更换为你自己的问题",tip:"",type:"text",private:!0,errorText:"",resultText:"",required:!0,defaultValue:"",mustInfo:!1,canCtrlCExit:!1,canCtrlDExit:!1,isWrapLine:!1,usableLength:0,mustInfoLen:0,row:0,cum:0,maxLen:0,minLen:0,len:0,verify:[]},results:[],assign(e){Object.keys(e).forEach(t=>{if(!Object.hasOwn(this,t)||j(e[t]))throw lt(`${t} is not exist`),new Error(`${t} is not exist`);this[t]=e[t]})},beforeStart(){this.results.length=this.enterText.length=this.indexOfCursor=0,this.progressCount=bn.multi?-bn.data.length:-1}};function wn(){const{multi:e,progressCount:t}=this,n=e&&N(bn.data)?bn.data[bn.data.length+t]:bn.data,r={text:"请更换为你自己的问题",tip:"",type:"text",private:!0,errorText:"",resultText:"",required:!0,defaultValue:"",mustInfo:!1,canCtrlCExit:!1,canCtrlDExit:!1,isWrapLine:!1,usableLength:0,mustInfoLen:0,row:0,cum:0,maxLen:0,minLen:0,len:0,verify:[]};Object.assign(r,y(n)||k(n)?{text:n}:n);const o=N(r.tip)?1:0;let i;1==o?i=[r.tip[0]]:(i=[],[r.tip,r.defaultValue].every(e=>x(e))&&(r.required=!0),!$(r.defaultValue)&&x(r.tip)&&(r.tip=r.defaultValue)),r.text=$(r.text.toString())?"请使用你自己的问题":r.text,this.assign({indexOfCursor:0,kind:o,enterText:i,currentIssue:r})}const yn=A(()=>{const{kind:e,currentIssue:t,enterText:n}=mn,{mustInfo:r,text:o,required:i,tip:s,verify:a}=t;ft();let c="",l=!1;if(C(t.row)||(c+=`${Y}${t.row}A`,t.row=0),c+=`\r${Y}0J${Q}`,r)c=vn(c),l=!0;else if(!M(n)){const e=n.join("");for(const n of a)if(v(n.reg)&&y(n.info)&&[j,I].some(e=>e(n.inverse))){n.reg.lastIndex=0;const r=n.reg.test(e);if(T(n.inverse)&&T(r)||T(!n.inverse)&&O(r)){t.mustInfo=n.warn?Ee(n.info):n.info,c=vn(c),l=!0;break}}}const u=0===e&&i?$e.blink("*"):"";c+=`${on()} ${u}${o}${u}: `,t.row+=Number(t.isWrapLine),c+="\n".repeat(Number(t.isWrapLine)),C(e)?M(n)&&y(s)?x(s)?c+=Oe.dim.blink("I"):c+=" ".concat(tn.italic.dim(s[0])).concat(Oe.dim(s.slice(1))):(c+=" ",c=function(e){const{type:t,usableLength:n}=mn.currentIssue;e="text"===t?function(e,t){const{enterText:n,indexOfCursor:r}=mn,o=De(n.join(""))>t;r===n.length?(o?e=function(e,t){const{enterText:n}=mn;return e+=nn.concat([...Be(n.toReversed().join(""),t-3,!1)].reverse().join("")),e}(e,t):e+=n.join(""),e+=tn.hide(" ")):o?e=function(e,t){const{indexOfCursor:n,enterText:r}=mn,o=r.join(""),i=r.length,s=Math.floor(t/2),a=Be(o,s),c=a.length-1,l=a[c]===o[c]?c:c-1,u=Be(o,-s),f=u.length-1,h=u[f]===o[i-1-f]?i-1-f:i-f,d=r.map((e,t)=>t===n?tn(e):e).join("");if(n>=h)e+=nn,e+=Be(d,3-t,!1);else if(n<l)e+=Be(d,t-3,!1),e+=nn;else{const t=s-De(r[n])-3;e+=nn,e+=Be(o.slice(0,n),-t,!1),e+=tn(r[n]),e+=Be(o.slice(n+1),t,!1),e+=nn}return e}(e,t):e+=`${n.map((e,t)=>t===r?tn(e):e).join("")}`;return e}(e,n):function(e){const{enterText:t,indexOfCursor:n}=mn;n===t.length?(e+=` ${t.map(()=>"*").join("")}`,e+=tn.hide("1")):e+=` ${t.map((e,t)=>t===n?tn("*"):"*").join("")}`;return e}(e);return e}(c)):c=function(e){const{currentIssue:t,enterText:n}=mn;return e+t.tip.map(e=>e===n[0]?Se.bold.blink.cyan(e):ye(e)).join(" ")}(c),Dt("计算完成的文本为",c),lt(Pe(c)),t.row++,function(e){const{currentIssue:t,indexOfCursor:n,enterText:r}=mn,{text:o,required:i,mustInfoLen:s}=t;if(e)return bt(s);const a=r.slice(0,n).join(""),c=o.toString().concat(a),l=De(c),u=l+7+2*Number(i),f=u%process.stdout.columns;Dt("用户输入",r.join("")),Dt("光标所在的位置",n),Dt("实际参与计算的用户输入的文本为",a),Dt("计算总文本",c),Dt("计算文本长度",l),Dt("计算可用长度",u),Dt("屏幕宽",process.stdout.columns),Dt("光标偏移量",u%process.stdout.columns),bt(f)}(l),l||lt(je("I"),!1),ut("8m")},66);function vn(e){const{currentIssue:t}=mn;e+="\n\r",t.row++;let n="";if(I(t.mustInfo)){const e=t.required?" ":"";n+=" ".repeat(2).concat(e).concat(pe(t.text)).concat(e).concat(" ".repeat(3)),n+=pe.blink`👆`}else n+=ye(t.mustInfo);let r=De(n);const o=process.stderr.columns-4;return o<r&&(r=o,n=Be(n,o)),t.mustInfoLen=r,e+=n,e+=`\r${Y}1A`,t.row--,t.mustInfo=!1,e}function xn(){const{currentIssue:e}=mn;!function(){const{currentIssue:e}=mn,t=process.stdout.columns;let n=t-De(e.text.toString())-2*Number(e.required)-4-7;const r=n<5;r&&(n=t-4);e.isWrapLine=r,e.usableLength=n}();const{isWrapLine:t}=e,n=2+Number(t);lt("\n".repeat(n),!1),e.row+=n,gt(n),e.row-=n}async function $n(){try{await ct((e=this,(t,n)=>{const{kind:r,currentIssue:o,enterText:i,results:s}=e,{tip:a,text:c,canCtrlCExit:l,canCtrlDExit:u}=o;let f=[],h=0,d=0,g=!0;switch(C(r)||(f=a,h=f.length-1,d=f.indexOf(i[0])),Dt("\n 用户使用了",t,n),n.name){case"return":if(function(){const{enterText:e,currentIssue:t,results:n}=mn,r=t.text;let o=e.join("").trim();if(x(o)&&t.required)return t.mustInfo=!0,!1;const{len:i,minLen:s,maxLen:a,verify:c}=t,l=o.length;if(C(mn.kind)){if(c.length>0)for(const e of c)if([j,O].some(t=>t(e.warn))&&v(e.reg)&&y(e.info)&&[j,I].some(t=>t(e.inverse))){e.reg.lastIndex=0;const t=e.reg.test(o);if(T(e.inverse)&&t||!e.inverse&&!t)return!1}if(!C(i)&&l!==i)return t.mustInfo=`您输入的长度 ${be(l)} 不符合要求值 ${ve(i)}`,!1;if(!C(s)&&l<s)return t.mustInfo=`您输入的长度 ${be(l)} 小于最低要求${ve(s)}`,!1;if(a>s&&l>a)return t.mustInfo=`您输入的长度 ${be(l)} 大于最低要求${ve(a)}`,!1}return x(o)&&O(t.required)&&(o=t.defaultValue||t.tip||""),n.push({q:r,r:o}),!0}())return g=!1,!0;break;case"left":!function(e,t,n){const{kind:r,enterText:o}=mn;C(r)?mn.indexOfCursor=0===mn.indexOfCursor?o.length:mn.indexOfCursor-1:o[0]=e[0===t?n:t-1]}(f,d,h);break;case"right":!function(e,t,n){const{kind:r,enterText:o}=mn;C(r)?mn.indexOfCursor=mn.indexOfCursor==mn.enterText.length?0:mn.indexOfCursor+1:o[0]=e[t==n?0:t+1]}(f,d,h);break;case"delete":case"backspace":!function(){const{enterText:e,kind:t}=mn;C(t)&&!C(mn.indexOfCursor)&&(e.splice(mn.indexOfCursor-1,1),mn.indexOfCursor--)}();break;case"escape":if(n?.sequence===U.repeat(2))return s.push({q:c,r:void 0}),g=!1,!0;break;default:if(Dt("[0m当前触发为含 ctrl 键的功能键",t,n),O(n?.ctrl))!function(e){const{enterText:t,kind:n}=mn;j(e)||0!==n||(mn.indexOfCursor==t.length?t.push(e):t.splice(mn.indexOfCursor,0,e),mn.indexOfCursor+=1)}(t);else if(g=!1,ut("m"),T(l)&&"c"===n?.name||T(u)&&"d"===n?.name)return s.push({q:c,r:void 0}),!0}return g&&yn(),!1}))}catch(e){Dt.error("接收用户输入出错",e),lt(e)}var e}function kn(e,t){const n=Symbol("question");try{return new Promise((r,o)=>{pn.on(n,async()=>{try{const o=await async function(e,t){process.stdout.removeListener("resize",En),process.stdout.on("resize",En),Dt("初始化问题"),bn.init(e),Dt("初始化当前问题"),mn.beforeStart(),Dt("开始绘制问题");do{xn(),yn();try{await Reflect.apply($n,mn,[])}catch(e){Dt.error(e)}const{currentIssue:e,results:t}=mn;C(e.row)||(gt(e.row,!0),e.row=0),ut("m"),ht(),dt(!0);const n=e.resultText||e.text,r=t[t.length-1].r;e.private||(j(r)?dn(e.errorText||n):gn(`${Xt(n)}: ${"text"===e.type?r:r.replace(/./gm,"*")}`)),++mn.progressCount}while(mn.progressCount<0);return process.stdout.removeListener("resize",En),ut("m"),ht(),dt(!0),mn.multi?T(t)&&N(e)?mn.results.map(e=>e.r):mn.results:mn.results[0].r}(e,t);pn.remove(n),r(o)}catch(e){Dt.error("\n\n\n\n\n执行出现错误",e),pn.remove(n),o(e)}})})}catch(e){return Dt.error("系统故障",e),lt("系统故障",!1),lt(e),new Promise((t,n)=>{n(e)})}}const En=A(()=>{const{currentIssue:e}=mn;C(e.row)||(gt(e.row,!0),e.row=0),lt(Q,!1),dt(!0),xn(),yn()}),Cn=async function(e,t){return kn(e,t)};function In(e=!0){return process.stdout.rows-4*(1+Number(e))}function Tn(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];if(P(r,e=>[y,k].some(t=>t(e))))t.push({value:r,label:r,checked:!1,tip:"",disable:!1});else{if(!P(r,e=>[y,y].some(t=>t(e.label))&&[y,k,B].some(t=>t(e.value))))throw new TypeError(`${r} 的类型非法(有可能是返回值类型更改后未在解析中兼容)`);{let e=r.checked;!j(e)&&I(e)||(e=!1);let n=r.tip;!j(n)&&y(n)||(n="");const o=r.value;if(j(o)||S(o))throw new TypeError("value 值类型非法");const i=r.label,s=T(r.disable);t.push({checked:e,tip:n,value:o,label:i,disable:s})}}}return t}const On="请使用键盘选择,请使用 Enter 键进行选择",Sn=!1,jn="radio",Rn={drawData:[],info:On,focus:0,renderInfo:{rows:0,renderRows:0,otherInfoRows:0,allowBelow:!1,size:{width:0,height:0}},resultText:"",errorText:"",private:Sn,required:Sn,kind:jn,canCtrlCExit:Sn,canCtrlDExit:Sn,mustInfo:Sn,maxRows:In(),data:[],initData(e){Dt("初始化数据"),this.reset(),N(e)?this.data=Tn(e):Object.keys(e).forEach(t=>{const n=e[t];switch(t){case"data":this.data=N(n)?Tn(n):[];break;case"info":this.info=y(n)?n:On;break;case"resultText":this.resultText=y(n)?n:this.info||"";break;case"errorText":this.errorText=y(n)?n:this.resultText||this.info||"";break;case"private":this.private=I(n)?n:Sn;break;case"required":this.required=I(n)?n:Sn;break;case"kind":this.kind="check"===n?"check":jn;break;case"canCtrlCExit":this.canCtrlCExit=I(n)?n:Sn;break;case"canCtrlDExit":this.canCtrlDExit=I(n)?n:Sn;break;case"maxRows":this.maxRows=isFinite(n)&&Number.isInteger(n)&&n>0?n+4:In()}});const t=this.data;for(const e in t){if(!t[e].disable)return this.focus=Number(e),!1}return!0},reset(){this.drawData.length=this.data.length=this.focus=0,this.maxRows=In(),this.renderInfo={rows:0,renderRows:0,otherInfoRows:0,allowBelow:!1,size:{width:0,height:0}},this.info=On,this.kind=jn,this.resultText=this.errorText="",this.private=!0,this.required=this.canCtrlCExit=this.canCtrlDExit=this.mustInfo=Sn}};function Nn(e){const{data:t}=Rn,n=process.stdout.columns-7,r=n-3,o=t[e].label.toString();return De(o)<=n?o:Be(o,r,!1).concat(nn)}const Mn=()=>{!function(){const{focus:e,drawData:t,data:n,kind:r}=Rn;for(let o=0,i=n.length;o<i;o++){const i=n[o];if(j(t[o])){const n=De(i.label.toString());t[o]={index:o,text:Nn(o),length:n,checked:"radio"!==r&&i.checked,focus:o===e,changed:!0,show:!0,disable:i.disable}}else o===e?(t[o].changed=!0,t[o].focus=!0):o!==e&&T(t[o].focus)&&(t[o].changed=!0,t[o].focus=!1)}}(),function(){const{drawData:e,renderInfo:t,focus:n}=Rn,{renderRows:r}=t,o=e.length;if(o===r)return void e.forEach(e=>e.show=!0);const i=o-1,s=Math.floor((r-1)/2);let a=1&r?n-s:n-s-1;a=a<0?0:a;let c=r+a-1;c>i&&(c=i,a=c-r+1);e.forEach(e=>{const{index:t}=e;t>c||t<a?e.show=!1:t===c&&t!==i||t===a&&0!==t?(e.show=!0,e.text=nn):e.text===nn?(e.show=!0,e.text=Nn(t)):e.show=!0})}();const{info:e,mustInfo:t,renderInfo:n,focus:r,data:o}=Rn,{rows:i,allowBelow:s,size:a}=n,{width:c}=a;let l=`${Y}${c}D`;l+="\n".repeat(i),l+=`${Y}${i}A`,l+=`${Y}J`,l+=Pe(`${on()} ${e} \n\n`),l+=function(){const{drawData:e,kind:t}=Rn;let n="";for(let r=0,o=e.length;r<o;r++){const o=e[r];o.show&&(o.focus?(n+=Pe(` ${"radio"===t?cn():o.checked?hn():un()} ${o.text}`),n+="\n"):o.text===nn?(n+=` ${nn}`,n+="\n"):o.disable?(n+=Pe(` ${"radio"===t?en`⊗`:o.checked?en`▣`:en`☒`} ${en(o.text)}`),n+="\n"):(n+=Pe(` ${"radio"===t?an():o.checked?fn():ln()} ${Qt(o.text||"")}`),n+="\n"))}return n}(),l+=`${Y}J`,s&&(t?l+=function(){const e=process.stdout.columns-7;Rn.mustInfo=!1;const t="抱歉,该项至少选择一项!!!请使用空格键或是左右键切换选择状态",n=De(t)<e?t:Be(t,e);return"\n".concat(pe(n))}():o[r].tip?(l+="\n",l+=Pe(`${ve(o[r].tip)}`)):l+="\n",l+="\n"),Lt&&(l+=`${Y}${c}D${Y}${i}A`),lt(l,!1)},Dn=A(Mn,66),Ln=A(Mn,600);function Bn(){const{data:e,renderInfo:t,maxRows:n}=Rn,[r,o]=[process.stdout.columns,process.stdout.rows],i=e.length;t.size={width:r,height:o};const s=t.rows=Math.max(Math.min(i+4,In(!1),n),5),a=t.allowBelow=In()>e.length||s>6,c=t.otherInfoRows=a?4:2;t.renderRows=s-c}async function Pn(){const{data:e,required:t,kind:n,drawData:r,canCtrlCExit:o,canCtrlDExit:i}=Rn,s={exit:!1};return await ct((a,c)=>{const{focus:l}=Rn;switch(c.name){case"return":return Dt("用户已选择,返回真值告诉等待程序可终结当前输入"),"check"!==n||!t||!M(r.filter(e=>e.checked))||(Rn.mustInfo=!0,Dn(),!1);case"up":Dt("用户使用了键盘键的 up 键"),Wn(!1),Dn();break;case"down":Dt("用户使用了键盘键的 down 键"),Wn(),Dn();break;case"right":Dt("用户使用了键盘键的右键");case"left":Dt("用户使用了键盘键的左键");case"space":Dt("用户使用了键盘键的空格键"),"check"===n&&(e[l].checked=r[l].checked=!r[l].checked,Dn());break;case"escape":if(c?.sequence===U.repeat(2))return s.exit=!0,!0;break;default:if(Dt("用户使用了键盘键的非方向键 <",a,">, <",c,">"),T(c?.ctrl)&&("check"===Rn.kind&&("a"===c?.name&&(Fn(),Dn()),"z"===c?.name&&(Fn(!1),Dn()),"r"===c?.name&&(Rn.data.forEach(e=>{e.disable||(e.checked=!e.checked)}),Rn.drawData.forEach(e=>{e.disable||(e.checked=!e.checked)}),Dn())),T(o)&&"c"===c?.name||T(i)&&"d"===c?.name))return s.exit=!0,!0}return!1}),s.exit}function Fn(e=!0){Rn.data.forEach(t=>{t.disable||(t.checked=e)}),Rn.drawData.forEach(t=>{t.disable||(t.checked=e)})}function Wn(e=!0){const{focus:t,drawData:n}=Rn,r=n.length-1,o=e?t===r?n:[...n.slice(t+1),...n.slice(0,t+1)]:0===t?n.toReversed():[...n.slice(t),...n.slice(0,t)].toReversed();for(const e of o)if(!e.disable)return void(Rn.focus=e.index)}async function An(e,t){const n=Symbol("selection");return new Promise((r,o)=>{pn.on(n,async()=>{try{const o=await async function(e,t){if(process.stdout.removeListener("resize",qn),process.stdout.on("resize",qn),Rn.initData(e))return;ft(),Dt("初始绘制问题选项"),Bn(),Dn(),Dt("绘制完成,等待用户操作");const n=await Pn();lt(Q,!1),process.stdout.removeListener("resize",qn);const{resultText:r,info:o,focus:i,kind:s,drawData:a,errorText:c}=Rn;if(ht(),dt(!0),n)return void(Rn.private||dn(c||r||o));const l=a.filter(e=>e.checked);if(!Rn.private){const e="radio"===s?[a[i].text]:l.map(e=>e.text);gn(`${Xt.italic.dim(r||o)}: ${Xt(e.join("、"))}`)}const u="radio"===s?Rn.data[i].value:l.map(e=>Rn.data[e.index].value),f="radio"===s?i:l.map(e=>e.index),h="string"==t||j(t)?u:f;return h}(e,t);pn.remove(n),r(o)}catch(e){Dt.error(e),pn.remove(n),o()}})})}const qn=A(()=>{const{drawData:e,renderInfo:t}=Rn,n=t.size.height;e.length=0,lt(Q,!1),dt(),Bn(),process.stdout.rows!==n?Ln():Dn()},33);function _n(e,t){return An(e,t)}const zn=new Ve({name:"qqi",type:!1});O(zn.type);const Vn=new class{#c;#l;constructor(e=""){if(y(e)||(e=`${e}`),this.#c=Symbol(e),Mt[this.#c])throw new Error(`${e} 已经存在,请更换初始化命令名称,若仍想在原命令上操作,请抽离为单独的文件做数据共享`);this.#l=Mt[this.#c]=Ft(),[this.#l.__filename]=nt(),this.#l.name=e||y(process.argv[1])&&process.argv.slice(1,2)[0].replace(/.*\/.*?$/,"$1")||"",Object.defineProperty(this,"#uniKey",{value:this.#c,writable:!1,enumerable:!1,configurable:!1})}get name(){return this.#l.name}get state(){return this.#l.state}isEnd(e=!1){const t=4===this.#l.state.code;return t&&T(e)&&this.end(),t}end(){return this.#l.state="end",process.exit()}error(){return this.#l.state="error",process.exit(1)}bind(e){return Pt(e,this.#l),this}run(){const e=this.#l;return Ut(e),$(e.helpInfo)||At(e),e.hasShowVersion&&Yt(e),this}get args(){return this.#l.args}get values(){return this.#l.values.slice()}help(e,t){const n=this.#l;y(e)&&n.originalBind[e]?y(t)&&n.originalBind[e].options&&n.originalBind[e].options[t]?n.helpInfo=[e,t]:n.helpInfo=e:n.helpInfo="help",At(this.#l)}version(){Yt(this.#l)}}("nry");async function Gn(e="好的,即将退出"){return $(e)||await St(e),ht(),Vn.end()}function Jn(e){return e.endsWith("/")?e:e+"/"}async function Hn(e){return new Promise(t=>{let n;try{return n=new URL(e),t(!0)}catch{return Ge.error("当前传入的",e,"有误"),t(!1)}})}Vn.bind(["add <a> (用于添加一个自定义的 npm、yarn、pnpm 源)","edit <ed> (用于编辑源) ",Je?"":"clean (移除本地数据)","delete <del> (用于移除某个或多个自定义的项)","list <ls> (用于展示当前的所有的源)","manage <mg> (用于管理当前源在列表中的显隐)",`reset <rs> (重制当前的源,将${$e`永久移除自定义源`}、${Ce`恢复已更改的源`})`]).run().isEnd(!0);const Kn={npm:"https://registry.npmjs.org/","tao-bao":"https://registry.npmmirror.com/","ten-xun":"https://mirrors.tencent.com/npm/",ustclug:"https://npmreg.proxy.ustclug.org/",yarn:"https://registry.yarnpkg.com/"},{npm:Un,"tao-bao":Yn,"ten-xun":Zn,ustclug:Qn,yarn:Xn}=Kn,er=[{value:Un,label:"官方",tip:Un},{value:Yn,label:"淘宝",tip:Yn},{value:Zn,label:"腾讯",tip:Zn},{value:Qn,label:"中科大",tip:Qn},{value:Xn,label:"yarn",tip:Xn}];function tr(e=!1){if(e)return[...er];if(!or.available)return[...er];const t=or.read();if(N(t)&&t.every(e=>y(e.value)&&!$(e.label)&&y(e.value)&&!$(e.value))){const e=t.map(e=>(e.value=Jn(e.value),e.tip=Jn(e.tip),e));return e}return[...er]}const nr=new class{#u;#f=!0;get available(){return this.#f}constructor(e){const t=function(){const e=a();if(zn("当前获取用户主目录为",e),!e||"/"===e||e.includes("Default"))throw new Error("未能获取到主目录路径 <"+e+">");try{const t=Ue(e,"test_write"+Date.now());return Qe(t,{}),o(t),e}catch(e){return void zn.error(e)}}();if(j(t))return this.#f=!1,void(this.#u="");this.#f=!0,this.#u=Ue(t,".earthnut.dev.data",`${e}`)}read(e){if(!this.available)return null;const t=Ue(this.#u,e);return j(He(t))?{}:Ze(t)||{}}write(e,t){if(!this.available)return!1;const n=Ue(this.#u,e),r=Ue(n,"../");zn("创建的文件路径为"),i(r,{recursive:!0}),zn("写入的文件路径为:",n),zn("写入文件内容为",t);const o=Qe(n,t);return zn("写入反馈",o),o}getPath(e){return Ue(this.#u,e)}}("nry"),rr="config",or={available:nr.available,read(){if(nr.available){const e=nr.read(rr);if(N(e))return e}return tr(!0)},addNew(e){if(nr.available){const t=this.read();return t.push(e),Ge("新写入的数据为",e),this.write(t)}return!1},write:e=>!!nr.available&&nr.write(rr,e),getPath:()=>nr.getPath(rr),clean(){const e=this.getPath();Ge("将要移除的文件",e),o(e)}},ir={add:!1,edit:!1,delete:!1,manage:!1,list:!1,noMatch:!1,reset:!1,clean:!1},sr={pkgManager:function(e=!1){if(O(e)){const e=e=>Boolean(Ye(e,"file"));if(e("pnpm-lock.yaml"))return"pnpm";if(e("yarn.lock"))return"yarn";if(e("package-lock.json"))return"npm"}const t=process.env.npm_config_user_agent||"";return t.includes("pnpm")?"pnpm":t.includes("yarn")?"yarn":t.includes("npm")?"npm":process.env.PNPM_HOME?"pnpm":process.env.YARN_IGNORE_PATH?"yarn":"npm"}(!0)};function ar(e){if(!or.available)return!1;const t=Jn(e.value);return or.addNew({value:t,label:e.label.toString(),tip:t,disable:!1})}const cr=b(function(e){return this.data=[],Object.setPrototypeOf(this,e),this});function lr(e,t){if(t.align&&(e.align=t.align),t.bgColor&&(e.bgColor=t.bgColor),t.color&&(e.color=t.color),t.italic&&(e.italic=t.italic),t.underline&&(e.underline=t.underline),t.border)if(P(t.border,e=>y(e))){const n=t.border;e.border={left:{color:void 0,style:n},right:{color:void 0,style:n},top:{color:void 0,style:n},bottom:{color:void 0,style:n}}}else if(P(t.border,e=>["color","style"].some(t=>!j(e[t])))){const n=t.border,r=n.style,o=n.color||void 0;e.border=JSON.parse(JSON.stringify({left:{color:o,style:r},right:{color:o,style:r},top:{color:o,style:r},bottom:{color:o,style:r}},(e,t)=>""===t?void 0:t))}else P(t.border,e=>["left","right","top","bottom"].some(t=>!j(e[t])))&&(e.border=t.border)}class ur{}function fr(e,t){N(e)&&(e={data:e});const n=new ur;lr(n,e);const r=new cr(n);return Object.setPrototypeOf(n,t),e.data?.forEach(e=>{e&&r.data.push(function(e,t){if(j(e))return;P(e,e=>!D(e))&&(e={content:e});const n={content:e.content};return lr(n,e),Object.setPrototypeOf(n,t),n}(e,n))}),r}class hr extends ur{border={left:{style:"bold",color:void 0},right:{style:"bold",color:void 0},top:{style:"bold",color:void 0},bottom:{style:"bold",color:void 0}}}function dr(e){const t=new hr;return Object.setPrototypeOf(t,e),t}const gr=!_(),pr={emojiLength:2.08,emojiRegex:/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F900}-\u{1F9FF}]/gu,chineseLength:1.8,chineseRegex:/[\u4E00-\u9FFF]/g};const br=new class{align="left";color="";bgColor="";bold=!1;underline=!1;italic=!1;border={left:{color:void 0,style:"simple"},right:{color:void 0,style:"simple"},top:{color:void 0,style:"simple"},bottom:{color:void 0,style:"simple"}}},mr=b(function(e){return this.body=[],this.header=void 0,Object.setPrototypeOf(this,e),this});class wr{}function yr(e){let t=ge;return P(e)&&(e.bold&&(t=t.bold),$(e.bgColor)||j(e.bgColor)||(t=t.bgColor(e.bgColor)),$(e.color)||j(e.color)||(t=t.color(e.color)),e.italic&&(t=t.italic),e.underline&&(t=t.underline)),t}const vr={fine:{lt:"┌",ct:"┬",rt:"┐",lc:"├",c:"┼",rc:"┤",lb:"└",cb:"┴",rb:"┘",l:"─",v:"│"}};function xr(e){let t=0;return[...e].forEach(e=>{pr.emojiRegex.lastIndex=0,pr.chineseRegex.lastIndex=0,e.match(pr.emojiRegex)?t+=pr.emojiLength:e.match(pr.chineseRegex)?t+=pr.chineseLength:t++}),Math.ceil(t)}function $r(e,t){const n=function(e){const t=[];return e.header&&e.header.data.forEach((e,n)=>{const r=e?.content?.toString()??"";t[n]=Math.max(t[n]??0,gr?xr(r):De(r))}),e.body&&e.body.forEach(e=>{e.data.forEach((e,n)=>{const r=e?.content?.toString()??"";t[n]=Math.max(t[n]??0,gr?xr(r):De(r))})}),t}(e);let r=!1,o="";e.header&&(r=!0,o+=function(e,t){let n="";const r=t.length-1,{fine:o}=vr,i=yr(e);return t.forEach((e,t)=>{0===t&&(n+=o.lt),n+=Q,n+=o.l.repeat(e+2),t===r?(n+=Q,n+=o.rt):(n+=Q,n+=o.ct)}),n+="\n",t.forEach((t,s)=>{n+=Q,n+=o.v;const a=e.data[s];if(j(a)||S(a))n+=Q,n+=i(" ".repeat(t+2));else{const e=yr(a);let r=a.content?.toString()??"";r=r.replace(/[\n]/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),n+=Q,n+=e`\u2002${Be(r,t)}\u2002`}s===r&&(n+=o.v)}),n+="\n",n}(e.header,n)),o+=function(e,t,n){let r="";const o=t.length-1,{fine:i}=vr;return t.forEach((e,t)=>{0===t&&(r+=Q,r+=n?i.lc:i.lt),r+=Q,r+=i.l.repeat(e+2),t===o?(r+=Q,r+=n?i.rc:i.rt):(r+=Q,r+=n?i.c:i.ct)}),r+="\n",e.forEach((n,s)=>{const a=yr(n);t.forEach((e,t)=>{r+=Q,r+=i.v;const s=n.data[t];if(j(s)||S(s))r+=a`${" ".repeat(e+2)}`;else{const t=yr(s);let n=s.content?.toString()||"";n=n.replace(/[\n]/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),r+=Q,r+=t`\u2002${Be(n,e)}\u2002`}t===o&&(r+=Q,r+=i.v)}),r+="\n";const c=e.length-1===s;t.forEach((e,t)=>{0===t&&(r+=Q,r+=c?i.lb:i.lc),r+=Q,r+=i.l.repeat(e+2),t===o?(r+=Q,r+=c?i.rb:i.rc):(r+=Q,r+=c?i.cb:i.c)}),r+="\n"}),r}(e.body,n,r);const i=ue(o);if(gr){const e=i[0].split("%c"),n=i.map((n,r)=>{if(r>0){const o=[...e[r]].reduce((e,t)=>De(t)>1?(pr.emojiRegex.lastIndex=0,t.match(pr.emojiRegex)?e-(pr.emojiLength-2):e+(2-pr.chineseLength)):e,0);return n+"font-family: Consolas,Monaco,Courier,'Courier New','等宽字体',monospace; font-size:"+t+"px;word-spacing:normal;padding:0;margin:0;padding-right:"+o*t+"px"}return n});console.log(...n)}else console.log(...i)}const kr=b(function(e){const[t,n]=function(e){j(e)&&(e={}),N(e)&&(e={body:e});const t=new wr;lr(t,e),Object.setPrototypeOf(t,br);const n=new mr(t);return e.header&&(n.header=fr(e.header,dr(t))),e.body?.forEach(e=>n.body.push(fr(e,t))),[n,t]}(e);let r=12;const o=()=>$r(t,r);return Object.setPrototypeOf(o,this),Object.defineProperties(o,{addRow:{value:e=>(t.body.push(fr(e,n)),o),configurable:!1,writable:!1,enumerable:!1},setHeader:{value:e=>(t.header=fr(e,dr(n)),o),configurable:!1,writable:!1,enumerable:!1},setFontSize:{value:e=>(r=e,o)}}),o});async function Er(){const{pkgManager:e}=sr,t=`${e} config get registry`;Ge("执行可写代码",t);const n=await Ot(t);if(Ge("获取当前的本地配置为",n),n.success)return n.data.replace(/\s/gm,"")}async function Cr(){const{pkgManager:e}=sr,t=tr(),n=await Er(),r=new kr({header:[`${e} registry 源`,"别名","当前可见"]}),o=t.findIndex(e=>e.value===n)>-1;!o&&y(n)&&t.push({value:n,tip:n,label:"曾用值"}),t.forEach(e=>r.addRow([(n===e.value?ye`* `:" ").concat(e.value),(n===e.value?ye`* `:" ").concat(be(e.label)),e.disable?"❌":"✅"])),r(),lt(xe`注:当前可见状态仅影响 npx nry 选择项`)}const{npm:Ir,yarn:Tr}=Kn;async function Or(e){const{pkgManager:t}=sr,n=[{reg:/\s+/g,info:"不允许出现空格",inverse:!0}];e.forEach(e=>{n.push({reg:new RegExp(`^${q(e.value)}/*$`,"mg"),info:`${be(e.value)}(${ve(e.label)}) 已存在`,inverse:!0})});const r=await Cn({text:"请输入自定义的源地址",tip:"yarn"===t?Tr:Ir,minLen:5,maxLen:120,verify:n,required:!1});return Ge("用户输入的地址",r),j(r)?await Gn():await Hn(r)?Jn(r):(lt(`当前设置 registry 「${Re(r)}」 不可用`),lt("请使用正确的源设置"),await Or(e))}async function Sr(){if(!or.available)return await Gn("读写受限,正在退出");const{pkgManager:e}=sr,t=tr(),n=await Or(t),r=await async function(e){const t=[{reg:/\s+/g,info:"不允许出现空格",inverse:!0}],{pkgManager:n}=sr;e.forEach(e=>{t.push({reg:new RegExp(`^${q(e.label)}$`,"mg"),info:`${be(e.label)}(${ve(e.value)}) 已存在`,inverse:!0})});const r=await Cn({text:`请输入自定义的 ${n} 的别名`,tip:"任意别名",minLen:1,maxLen:120,verify:t,defaultValue:"",required:!1});return Ge("用户输入的别名为",r),j(r)?await Gn():r}(t);if(ar({value:n,label:r})){lt(xe`当前的 ${e} registry 源列表为`),await Cr();const t=["退出","继续添加"],n=await Cn({text:"添加完成,是否持续添加",tip:t});return j(n)||n===t[0]?await Gn(""):await Sr()}return await Gn(`写入${$e`失败`},原因未知`)}async function jr(e="",t=!0,n=!0){$(e)&&(e=`请选择想使用的新的 ${sr.pkgManager} registry 源`);let r=!1;const o=tr(),i=await Er();if(!j(i)){for(const e of o)if(e.value===i){e.label=e.label.toString()+`(${ye`当前使用`})`,e.disable=!n,r=!0;break}if(O(r)){const e={value:i,label:"当前使用值",disable:!n};o.push(e),or.available&&ar({value:i,label:"曾用值"})}}Ge("处理完的数据",o);const s=t?o.filter(e=>!e.disable||e.disable&&e.value===i):o.map(e=>(e.value===i?e.disable=!n:e.disable=!1,e)),a=await _n({data:s,info:e},"number");return Ge("用户选择的项",a),j(a)?await Gn():(Ge("当前用户选择为",s[a]),s[a])}async function Rr(){const e=await jr();await async function(e){const{pkgManager:t}=sr,n=Jn(e.value);if(!await Hn(n))return await Gn(`选择的项 「${ye(n)}」 不可连接,无法被设置`);const r=`${t} config set registry "${n}"`;Ge("设置源执行代码",r);(await Ot(r)).success||await Gn();lt(`已将 ${t} registry 更改为 ${be(e.value)}(${we(e.label)})`)}(e)}async function Nr(){if(!or.available)return await Gn("当前读写受限,即将退出程序");const e=await jr("请选择要删除的项",!1,!1),{value:t,label:n}=e,r=tr();for(const e in r){const o=Number(e),i=r[o];if(i.value===t&&i.label===n){r.splice(o,1);break}}if(or.write(r)){lt("删除项后的列表为:"),await Cr();const e=["退出","继续删除"],t=await Cn({text:"是否继续删除其他项",tip:e});return j(t)||t===e[0]?await Gn(""):await Nr()}}async function Mr(){if(!or.available)return await Gn("当前读写权限不足,即将退出程序");const e=await jr("请选择你想要修改的项",!1),{value:t,label:n}=e;Ge("获取用户的选择",e),Ge("原始的值",t),Ge("原始的标签",n),await async function(e){const{pkgManager:t}=sr,n=await Cn({text:`请更改为新的 ${t} registry 值`,tip:e.value,defaultValue:e.value,required:!1});if(Ge("新值为",n),j(n))return;e.value=e.tip=Jn(n)}(e),await async function(e){const{pkgManager:t}=sr,n=await Cn({text:`请更改为新的 ${t} registry 别名`,tip:e.label,defaultValue:e.label.toString(),required:!1});if(Ge("新值为",n),j(n))return;e.label=n}(e);const{value:r,label:o}=e;Ge("更改后的值",r),Ge("更改的标签",o);const i=tr();for(const e of i)if(e.value===t&&e.label===n){e.value=r,e.label=o.toString();break}if(or.write(i)){lt("更改后的列表为:"),await Cr();const e=["退出","继续修改"],t=await Cn({text:"是否继续修改其他项",tip:e});return j(t)||t===e[0]?await Gn(""):await Mr()}}async function Dr(){return function(){const e=Vn.args,t=e.$map;Ge("源解析值",e),Ge("源解析值没有匹配项",e.$isVoid),["add","delete","edit","list","manage","reset","clean"].forEach(e=>ir[e]=O(j(t[e]))),ir.noMatch=e.$isVoid,Ge("解析完的值",ir)}(),Ge("解析参数完毕,开始执行",ir),ir.noMatch?(Ge("当前没有匹配值"),await Rr()):ir.reset?(Ge("重置项"),await async function(){if(!or.available)return await Gn("当前读写权限受限,正在退出程序");const e=["退出","重置"],t=await Cn({text:"请确认是否执行覆盖原数据,该操作无法复原",tip:e});return j(t)||t===e[0]?await Gn("好的,这就退出重置"):or.write(tr(!0))?(await St("写入"+be`成功`,60),await Cr()):await Gn("重置未能完成,原因未知")}()):ir.list?(Ge("当前为展示项"),await Cr()):ir.manage?(Ge("当前执行状态更改"),await async function(){if(!or.available)return await Gn("当前读写受限,即将退出程序。");const e=tr(),t=await Er(),n=await _n({data:e.map(e=>({...e,checked:!e.disable,disable:e.value===t})),kind:"check"},"number");if(Ge("交互结果",n),j(n))return await Gn("好的,将退出状态显隐管理");e.forEach((e,t)=>{e.disable=!n.includes(t)}),Ge("保存前的数据",e),or.write(e)&&await Cr()}()):ir.add?(Ge("添加新的项"),await Sr()):ir.edit?(Ge("编辑项"),await Mr()):ir.delete?(Ge("删除项"),await Nr()):ir.clean?(Ge("当前执行清理"),or.clean()):await Rr()}(async()=>{try{await Dr()}catch(e){Ge.error("系统级捕获 错误",e),console.log("当前出现未知错误",e)}})();
|
|
2
|
+
import{statSync as e,readFileSync as t,readdirSync as n,writeFileSync as r,unlinkSync as o,mkdirSync as i}from"node:fs";import{arch as s,homedir as a}from"node:os";import{dirname as c,normalize as l,join as u,resolve as f}from"node:path";import"node:fs/promises";import{fileURLToPath as h}from"node:url";import{spawn as d}from"node:child_process";import{emitKeypressEvents as g}from"node:readline";import{resolve as p}from"node:path/posix";function b(e){return e.prototype.apply=Function.apply,e.prototype.bind=Function.bind,e.prototype.call=Function.call,e.prototype.length=Function.length,e.prototype.name=Function.name,e.prototype.toString=Function.toString,e}function m(e,t){return Object.keys(t).forEach(n=>e[n]=t[n]),e}function w(e){const t=typeof e;if("object"!==t&&"function"!==t)return t;const n=Reflect.apply(Object.prototype.toString,e,[]).replace(/^.*\s(.*)]$/,"$1").toLowerCase();return"error"!==n?n:e instanceof SyntaxError?"syntaxerror":e instanceof TypeError?"typeerror":e instanceof URIError?"urierror":e instanceof ReferenceError?"referenceerror":e instanceof AggregateError?"aggregateerror":e instanceof RangeError?"rangeerror":e instanceof EvalError?"evalerror":"error"}function y(e){return"string"===w(e)}function v(e){return"regexp"===w(e)}function x(e){return y(e)&&""===e.valueOf()}function $(e){return y(e)&&""===e.valueOf().trim()}function k(e){return"number"===w(e)}function E(e){return 0===e}function C(e){return"boolean"===w(e)}function I(e){return!0===e}function O(e){return!1===e}function T(e){return null===e}function S(e){return void 0===e}function j(e){return"function"===w(e)}function R(e){return Array.isArray(e)}function N(e){if(R(e))return 0===e.length;throw new TypeError("参数必须为数组")}function M(e){return"object"===w(e)}function D(e){return M(e)&&0===Reflect.ownKeys(e).length}function L(e){return"symbol"===w(e)}function B(e,t){return void 0===t||("function"==typeof t?t(e):t)}function P(e=1,t=0){if(!isFinite(e)||!isFinite(t)||isNaN(e)||isNaN(t)||!k(e)||!k(t))throw new TypeError("getRandomInt: max or min is NaN or is not a number");let n=Math.ceil(Number(t)),r=Math.floor(Number(e));return r===n?r:(n>r&&([r,n]=[n,r]),Math.round(Math.random()*(r-n)+n))}function F(e){if(!M(e)&&!k(e)||k(e)&&isNaN(e)||k(e)&&!isFinite(e)||k(e)&&!Number.isInteger(e)||k(e)&&Number.isInteger(e)&&e<1||k(e)&&e<1||M(e)&&(!k(e.length)||e.length<1||!Number.isInteger(e.length)))throw new TypeError("参数类型错误 ❌ (getRandomString)");const t={length:32,chars:"abcdefghijklmnopqrstuvwxyz",chars2:"0123456789",chars3:"!@#$%^&*()_+~`|}{[]:;?><,./-=",type:"string",includeUppercaseLetters:!1,includeNumbers:!1,includeSpecial:!1};if("uuid"===t.type)return crypto.randomUUID();k(e)&&Number.isInteger(e)&&e>0&&m(t,{length:e}),M(e)&&(m(t,e),t.length=t.length<1?32:t.length);const n=t.chars.split("");t.includeUppercaseLetters&&s(n,t.chars.toUpperCase()),t.includeNumbers&&s(n,t.chars2),t.includeSpecial&&s(n,t.chars3);let r="";const o=n.join(""),i=o.length;if(globalThis&&globalThis.crypto&&globalThis.crypto.getRandomValues){globalThis.crypto.getRandomValues(new Uint8Array(t.length)).forEach(e=>r+=o[e%i])}else for(let e=0;e<t.length;e++)r+=o[P(i-1)];function s(e,t){const n=e.length,r=t.length,o=Math.max(n,r);for(let i=0;i<o;i++)i<n&&!S(t[i])?e[i]+=t[i]:i<r&&(e[i]=t[i])}if(!/[a-zA-Z]/.test(r))return String.fromCharCode(P(97,122)).concat(r.slice(1));for(;!/^[a-zA-Z]$/.test(r[0]);)r=r.slice(1)+r[0];return r}function W(e,t=200){if(!j(e))throw new TypeError("callback must be a function");let n;k(t)&&(t={delay:t,this:null}),(S(t.delay)||!isFinite(t.delay)||t.delay<0)&&(t.delay=200);const r=()=>{n&&(clearTimeout(n),n=void 0)},o=(...o)=>{r(),n=setTimeout(()=>{try{const n=t&&t.this?t.this:null;e.apply(n,o)}catch(e){console.log("Debounce callback throw an error",e)}},Math.max(t.delay||5,5))};return o.cancel=()=>r(),o}function A(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(){return!S(globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node||void 0)}async function _(e=1e3){if(!isFinite(e)||e<4)throw new TypeError("delay 应该是一个正常的数值");return E(e)?Promise.resolve():new Promise(t=>setTimeout(t,e))}const z="",V=`${z}[`;function G(){return new RegExp(`(\\x1b\\[(${["([1-4]?[0-9])(;([1-4]?[0-9]+))*m","[m]","\\?(25|7)[hl]","\\d*;?\\d*[HFr]","6n","\\d{0,4}[A-DTS]","[0-3]?[JKg]","[0-6]?W"].map(e=>`(${e})`).join("|")}))`.concat("|(\\x1b[78DMc])"),"g")}const J=`${V}0m`;function H(e,t=!0){if(I(t)){if(!y(e))throw new TypeError("`color` must be a string or number but not number[] when isHex is true");if(e.startsWith("0x"))e=e.replace(/0x/,"#");else if(!e.startsWith("#"))throw new TypeError("`color` must be a string or number but not number[] when isHex is true")}else{if(!O(t))throw new TypeError("The second variable `isHex` must be boolean");if(R(e)){if(e.some(e=>!isFinite(e))||3!==e.length)throw new TypeError("If the `color` is an array, it must be 3 in length and be of numeric type");e=`rgb(${e.join(",")})`}else{if(k(e))throw new TypeError("If the `color` is not number when isHex is false");if(y(e)){if(!e.startsWith("rgb(")||!e.endsWith(")"))throw new TypeError("If the `color` is a string, it must be rgb(r, g, b)");{const t=e.replace(/.*\((.*)\).*/,"$1").split(",");if(3!==t.length||t.some(e=>!isFinite(Number(e))||Number(e)<0||Number(e)>255))throw new TypeError("If the `color` is a string, it must be rgb(r, g, b)")}}}}let n=0,r=0,o=0;if(e.startsWith("#"))if(6==(e=e.slice(1)).length)n=K(parseInt(e.slice(0,2),16)),r=K(parseInt(e.slice(2,4),16)),o=K(parseInt(e.slice(4,6),16));else{if(3!=e.length)return P(255);n=K(parseInt(e.slice(0,1).repeat(2),16)),r=K(parseInt(e.slice(1,2).repeat(2),16)),o=K(parseInt(e.slice(2,3).repeat(2),16))}else if(e.startsWith("rgb")){const t=e.replace(/.*\((.*)\).*/,"$1").split(",");n=K(Number(t[0])),r=K(Number(t[1])),o=K(Number(t[2]))}return 16+36*n+6*r+o}function K(e){const t=isFinite(e)?Math.floor(6*e/256):P(6);return Math.min(5,Math.max(0,t))}function U(e,t,n,r=!0){const o=r?"38":"48";if(k(e)&&k(t)&&k(n))return`${o};5;${H([e,t,n],!1)}`;if(y(e)&&S(t)&&S(n)){if(e.startsWith("rgb"))return`${o};5;${H(e,!1)}`;if(e.startsWith("#")||e.startsWith("0x"))return`${o};5;${H(e,!0)}`;Y()}else{if(k(e)&&S(t)&&S(n))return`${o};5;${H(e,!0)}`;Y()}}function Y(){throw new TypeError(' 使用 color() 或 bgColor() 时,可使用三整数 `r , g , b` 或单字符串 `"rgb(r , g, b)"` 或十六进制数值 `0xrgb`、`0xrrggbb` 或十六进制字符串表达 `"#rgb"`、`"#rrggbb"` ,不接受其他格式的参数')}function Z(e,t,n,r=!0){try{return U(e,t,n,r)}catch(e){throw console.error(e),new TypeError('使用 rgb() 或 bgRgb() 时,参数可以为单字符串 `"rgb(r, g, b)"` 或三个数值 `r , g ,b`。不接受其他格式')}}function Q(e,t=!0){try{return U(e,void 0,void 0,t)}catch(e){throw console.error(e),new TypeError('使用 hex() 或 bgHex() 时,参数可以为单字符串 `"0xnnnnnn"`、`"#rgb"` 、`"#rrggbb"` 或一个数值 `0xrrggbb`。不接受其他格式')}}function X(e,t=!1){return e<0&&(e=0),e>255&&(e=255),e=isFinite(e)?Math.round(e):P(255),`${[48,38][Number(t)]};5;${e}`}const ee={black:"38;5;0",red:"38;5;1",green:"38;5;2",yellow:"38;5;3",blue:"38;5;4",magenta:"38;5;5",cyan:"38;5;6",white:"38;5;7",brightBlack:"38;5;8",brightRed:"38;5;9",brightGreen:"38;5;10",brightYellow:"38;5;11",brightBlue:"38;5;12",brightMagenta:"38;5;13",brightCyan:"38;5;14",brightWhite:"38;5;15",bgBlack:"48;5;0",bgRed:"48;5;1",bgGreen:"48;5;2",bgYellow:"48;5;3",bgBlue:"48;5;4",bgMagenta:"48;5;5",bgCyan:"48;5;6",bgWhite:"48;5;7",bgBrightBlack:"48;5;8",bgBrightRed:"48;5;9",bgBrightGreen:"48;5;10",bgBrightYellow:"48;5;11",bgBrightBlue:"48;5;12",bgBrightMagenta:"48;5;13",bgBrightCyan:"48;5;14",bgBrightWhite:"48;5;15",bold:"1",dim:"2",italic:"3",underline:"4",blink:"5",reversed:"7",hide:"8",random:"random",bgRandom:"bgRandom",rgb:(e,t,n)=>Z(e,t,n),hex:e=>Q(e),color:(e,t,n)=>U(e,t,n),number:e=>X(e,!0),bgRgb:(e,t,n)=>Z(e,t,n,!1),bgHex:e=>Q(e,!1),bgColor:(e,t,n)=>U(e,t,n,!1),bgNumber:e=>X(e)};Object.freeze(ee);const te=["#000000","#c23621","#25bc24","#adad29","#492ee1","#dd38dd","#33bbc8","#cbcccd","#818383","#fc391f","#31e722","#eaec23","#5833ff","#f93578","#14f0f0","#ebeded"];function ne(e){let t=Number(e);if(!isFinite(t))throw new TypeError("色值反向解析出错");if(t<16){return te[t]}const n=e=>Math.floor(256*e/6+P(42)).toString(16).padStart(2,"0");t-=16;const r=t%36;return`#${n(Math.floor(t/36))}${n(Math.floor(r/6))}${n(r%6)}`}class re{constructor(e){this.parse(e),this.build()}build(){this.hide&&(this.color="transparent"),this.reversed&&([this.color,this.bgColor]=[this.bgColor,this.color]),S(this.color)||(this.str+=`color: ${this.color};`),S(this.bgColor)||(this.str+=`background: ${this.bgColor};`),0!==this.bold&&(this.str+=`font-weight: ${1===this.bold?800:200};`),this.italic&&(this.str+="font-style: italic;"),this.underline&&(this.str+="border-bottom: 1px #666 solid;")}color=void 0;bgColor=void 0;bold=0;italic=!1;underline=!1;reversed=!1;hide=!1;str="";parse(e){e.replace(/38;5;(\d+)/g,"c-$1").replace(/48;5;(\d+)/g,"b-$1").split(";").reverse().forEach(e=>{0===this.bold&&e===ee.bold?this.bold=1:0===this.bold&&e===ee.dim?this.bold=-1:e===ee.italic?this.italic=!0:e===ee.underline?this.underline=!0:e===ee.reversed?this.reversed=!0:e===ee.hide?this.hide=!0:S(this.color)&&e.startsWith("c")?this.color=ne(e.split("-")[1]):S(this.bgColor)&&e.startsWith("b")&&(this.bgColor=ne(e.split("-")[1]))})}}function oe(e){return q()?[e]:function(e){e=e.replace(new RegExp("\\\\[0m","g"),"[m");const t=G(),n=[""];let r,o=0,i="";const s=()=>{const t=e.substring(o,r?.index??e.length);n[0]+="%c".concat(t),n.push(i)};for(;!T(r=t.exec(e));)s(),i=S(r[7])?new re(r[3].slice(0,-1)).str:"",o=t.lastIndex;return s(),n}(e)}function ie(e,t){if(x(e=T(e)||S(e)?"":e.toString()))return"";if(N(t))return e;const n=e.indexOf(V),r=e.indexOf(`${V}0m`);return t=function(e){return e.map(e=>"random"===e?`38;5;${P(255)}`:"bgRandom"===e?`48;5;${P(255)}`:e)}(t),n>-1&&r>-1?ie(e.substring(0,n),t).concat(e.substring(n,r+4)).concat(ie(e.substring(r+4),t)):e.endsWith("\r\n")?(e=e.substring(0,e.length-2),`${V}${t.join(";")}m${e}${V}0m\r\n`):e.endsWith("\n")?(e=e.substring(0,e.length-1),`${V}${t.join(";")}m${e}${V}0m\n`):`${V}${t.join(";")}m${e}${V}0m`}function se(e,t){const n=parseInt(t);if(n>10){const r=I(38===n)?"38;5;":"48;5;",o=e.findIndex(e=>e.startsWith(r));return o>-1?e.toSpliced(o,1,t):[...e,t]}return e.includes(t)?[...e]:[...e,t]}const ae=b(function(e=[]){const t=(t,...n)=>{if(B(t,()=>R(t)&&t.every(e=>y(e)))){let r="";for(let o=0;o<t.length;o++)r+=ie(t[o],e),o<n.length&&(r+=ie(n[o],e));return r}if(N(n))return ie(t,e);throw new Error("pen: 缺少参数")},n=Object.keys(ee).map(t=>[t,{get:()=>function(e,t){let n=[];if(B(e,y(ee[e])))return n=se(t,ee[e]),new ae(n);if("hex"===e||"bgHex"===e)return r=>(n=se(t,ee[e](r)),new ae(n));if("rgb"===e||"bgRgb"===e)return(r,o,i)=>{if(y(r)&&S(o)&&S(i))n=se(t,ee[e](r));else{if(!(k(r)&&k(o)&&k(i)))throw new Error(`${e} 的参数类型不正确,请使用 'rgb' 或 'hex' 函数`);n=se(t,ee[e](r,o,i))}return new ae(n)};if("color"===e||"bgColor"===e)return(r,o,i)=>{if(y(r)&&S(o)&&S(i))n=se(t,ee[e](r));else{if(!(k(r)&&k(o)&&k(i)))throw new Error(`${e} 的参数类型不正确,请使用 'rgb' 或 'hex' 函数`);n=se(t,ee[e](r,o,i))}return new ae(n)};if("number"===e||"bgNumber"===e)return r=>{if(k(r))return n=se(t,ee[e](r)),new ae(n);throw new TypeError(`${e} 的参数应为有效正整数数值,范围 0 - 255`)};throw new Error(`${e} 函数不存在`)}(t,e)}]),r=Object.fromEntries(n);return Object.defineProperties(t,r),t});const ce=new ae([]),le=new ae([ee.red]),ue=new ae([ee.green]),fe=new ae([ee.yellow]),he=new ae([ee.blue]),de=new ae([ee.magenta]),ge=new ae([ee.cyan]);new ae([ee.white]);const pe=new ae([ee.brightBlack]),be=new ae([ee.brightRed]),me=new ae([ee.brightGreen]),we=new ae([ee.brightYellow]);new ae([ee.brightBlue]);new ae([ee.brightMagenta]);const ye=new ae([ee.brightCyan]);new ae([ee.brightWhite]);const ve=new ae([ee.bgBlack]);new ae([ee.bgRed]),new ae([ee.bgGreen]),new ae([ee.bgYellow]),new ae([ee.bgBlue]),new ae([ee.bgMagenta]);const xe=new ae([ee.bgCyan]);new ae([ee.bgWhite]),new ae([ee.bgBrightBlack]),new ae([ee.bgBrightRed]),new ae([ee.bgBrightGreen]);const $e=new ae([ee.bgBrightYellow]);new ae([ee.bgBrightBlue]);const ke=new ae([ee.bgBrightMagenta]);new ae([ee.bgBrightCyan]),new ae([ee.bgBrightWhite]);const Ee=new ae([ee.bold]),Ce=new ae([ee.italic]),Ie=new ae([ee.underline]),Oe=new ae([ee.hide]);new ae([ee.dim]),new ae([ee.blink]);const Te=new ae([ee.reversed]);ce.rgb;const Se=ce.hex;ce.color,ce.bgRgb;const je=ce.bgHex;function Re(e){const t=G(),n=e.replace(t,"");let r=0;for(let e=0,t=n.length;e<t;e++)r+=1+Number(Ne(n[e]));return r}function Ne(e){const t=e.codePointAt(0)||0;return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=131072&&t<=191471||t>=63744&&t<=64255||t>=65280&&t<=65519||t>=65381&&t<=65439||t>=127744&&t<=129750||t>=128512&&t<=128591||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=44032&&t<=55215||t>=12288&&t<=12351}function Me(e,t,n=!0){const r=t,o=e;if(0===r)return"";let i=!1;const s=Re(o);if(s<=r)return o.concat(" ".repeat(r-s));const a=r>0,c=G();c.lastIndex=0;const l=[...o.replaceAll(c,"")],u=a?l:l.reverse(),f=u.length,h=Math.abs(r);let d=Math.floor(h/2),g=u.slice(0,d).join(""),p=Re(g);for(;d<f;){if(p+=Re(u[d]),p===h){g+=u[d];break}if(p===h+1){n&&(i=!0);break}if(p>h+1)break;g+=u[d],d++}if(a&&o.startsWith(g)||!a&&o.endsWith(g=[...g].reverse().join("")))return i?g+" ":g;if(a){let e;for(c.lastIndex=0;null!==(e=c.exec(o));){const t=g;if(g=t.slice(0,e.index).concat(e[0]).concat(t.slice(e.index)),o.startsWith(g))break}g+=J}else{const e=[...g];let t=e.length-1;g="";const n=[...o].reverse();for(let r=0,o=n.length;r<o;r++){const o=n[r];if(o===e[t])--t;else if(t<0)break;g=o+g}g=J+g}return i?g+" ":g}function De(e){return`${V}?7l${e.toString()}${V}?7h`}ce.bgColor,ce.random,ce.bgRandom,ce.number,ce.bgNumber;const Le=[!1,!0,"all","info","error","warn"];const Be=q()?"node":"browser";const Pe=b(Fe);function Fe(e){const t=function(e){const t={name:F(10),type:!1,fold:!1};return S(e)?t:C(e)?(t.type=e,t):y(e)?(t.name=e.trim().replace(/\s+/g,"_"),t):(y(e.name)&&(e.name=e.name.trim().replace(/\s+/g,"_")),e.fold=Boolean(e.fold),e)}(e);this.name=t.name||F(12),this.fold=Boolean(t.fold);const n=function(e=F(10)){let t=!1;if("node"===Be&&globalThis?.process?.env){const n=process.env;t=n[e.toUpperCase().concat("_DEV")]||n[e.toLowerCase().concat("_dev")]||!1}return"false"!==t&&("true"===t||t)}(this.name);let r=t.type||!1;this.mark="",this.type="node"!==Be||function(e){return!!Le.includes(e)&&e}(n??r);const o=e=>{try{throw new Error}catch(t){const n=(t.stack?.split("\n")||[]).map(e=>{const t=/at\s(.*)\s\((.*):(\d*):(\d*)\)/.exec(e);return t?{name:t[1],path:t[2],line:t[3],column:t[4]}:{name:""}}),r=n.filter(e=>""!==e.name&&void 0!==e.path),o=r[3]??r[2]??r[1]??r[0],i=` ${"info"===e?"💡":"error"===e?"❌":"⚠️ "} ${(new Date).toLocaleString()} `,s=("info"===e?xe.brightWhite:"error"===e?ve.red:$e.brightGreen)(i),a=o?.name??"";this.fold&&a&&(a===this.mark||(this.mark&&console.groupEnd(),console.groupCollapsed(a))),this.mark=a;return oe(`${s} ${a} ${o?.line?.concat(" 行")} ${o?.column?.concat(" 列")}`)}};this.info=(...e)=>{if("all"===this.type||"info"===this.type||!0===this.type){const t=o("info");console.log(...t),console.log(...e)}},this.warn=(...e)=>{if("all"===this.type||"warn"===this.type||!0===this.type){const t=o("warn");console.log(...t),console.warn.apply(console,e)}},this.error=(...e)=>{if("all"===this.type||"error"===this.type||!0===this.type){const t=o("error");console.log(...t),console.error.apply(console,e)}};const i=(...e)=>{this.info(...e)};Object.setPrototypeOf(i,this);const s=this;return new Proxy(i,{get:(e,t,n)=>"apply"===t?e:Reflect.get(e,t,n),set:(e,t,n)=>(Reflect.set(s,t,n),!0)})}Fe.prototype.clear=()=>{"browser"===Be?console.clear():console.log(z.concat("c"))};const We=new Pe({name:"nry",type:!1}),Ae=O(We.type);function qe(t){return e(t,{throwIfNoEntry:!1})}const _e=new Pe({type:"error",name:"a node tools"});function ze(...e){return l(u(...e))}function Ve(e,t="file",...n){n=n.filter(e=>y(e));let r=f(...n);const o=qe(r);if(_e("当前工作目录",r),!o)return _e("🎯 工作目录不存在"),"";if(o.isFile())r=c(r);else if(!o.isDirectory())return;let i=20;const s=()=>{const n=qe(ze(r,e));if(n&&("file"==t&&n.isFile()||"directory"==t&&n.isDirectory()))return r;if(E(i))return;i--,_e("♻️ 查找中...",r);const o=ze(r,"..");return o!==r?(r=o,s()):void 0};return s()}function Ge(n){if(!/.json^/.test(n)&&!e(n,{throwIfNoEntry:!1}))return null;try{const e=t(n,{encoding:"utf-8"});return JSON.parse(e||"null")}catch(e){return _e.error(e),null}}function Je(e,t){try{return r(e,JSON.stringify(t,null,2),{encoding:"utf-8",flag:"w"}),!0}catch(e){return _e.error(e),!1}}const He=()=>q()&&process&&process.stdout&&process.stdout.isTTY||!1,Ke=q()&&"win32"===process.platform||!q()&&window.navigator.userAgent.includes("Windows");function Ue(e){const t=new RegExp(e);let n;try{throw new Error}catch(e){n=e}const r=(n.stack?.replace(/\\/gm,"/").split("\n")).reverse(),o=r.findIndex((e,n,r)=>!t.test(e)&&t.test(r[n+1]));if(-1==o)return{name:"",line:0,row:0,originArr:r};let i=r[o];return/\(.*\)/.test(i)&&(i=i.replace(/^.*\((.*)\).*/,"$1")),/file:\/*/.test(i)&&(i=i.replace(/^.*file:\/*(.*)/,"$1")),Ke||i.startsWith("/")||(i="/"+i),{name:i.replace(/^(.*):\d+:\d+$/,"$1"),line:Number(i.replace(/^.*:(\d+):\d+$/,"$")),row:Number(i.replace(/^.*:\d+:(\d+)$/,"$1")),originArr:r}}function Ye(){let e;try{new Function('import("")'),e=h(import.meta.url)}catch(t){_e.error(t),e=__filename}Ke&&(e=e.replace(/\\/gm,"/")),e=Ue(e).name;return[e,c(e)]}const{stdin:Ze}=process,Qe={list:[],listened:!1,on(e,t,n){O(this.listened)&&(this.listened=!0,g(process.stdin),He()&&process.stdin.setRawMode(!0),process.stdin.resume(),Ze.on("keypress",tt),process.on("beforeExit",Xe),process.stdin.on("end",et));const r=this.list,o={key:e,callback:t,resolve:n};return N(r)&&_e("当前执行的栈中没有数据",o),r.push(e),this[e]=o,o},remove(){const e=this.list,t=e.shift();return t&&this.del(t),_e("执行完毕一项,还有:",e),!(e.length>0)&&(this.listened=!1,Xe(),_e("代理已移除"),!0)},del(e){_e("开始移除",e);const t=this.list[0]===e&&!S(this[e]);if(_e("当前 key 是否为当前执行项",t),t)return this.remove(),!0;{const t=this.list.includes(e),n=!S(this[e]);return t&&n?(this.list.splice(this.list.indexOf(e),1),this[e].resolve(!0),delete this[e],!0):t?(this.list.splice(this.list.indexOf(e),1),!0):!!n&&(this.list.splice(this.list.indexOf(e),1),this[e].resolve(!0),!0)}}};function Xe(){Ze.removeListener("keypress",tt),process.removeListener("beforeExit",Xe),process.stdin.removeListener("end",et),He()&&Ze?.setRawMode(!1),Ze.pause()}function et(){Xe()}function tt(e,t){const n=Qe[Qe.list[0]],{callback:r,resolve:o}=n;_e("当前执行的回调是",{...n,rl:"原始值为 readline 的 Interface 对象"}),j(r)?I(Reflect.apply(r,null,[e,t]))&&(_e("回调遇见了想待的键,执行了退出操作,keyValue: < ",e,"> key: <",t,">"),Qe.remove(),o(!0)):(Qe.remove(),o(!1))}const nt=(e,t)=>async function(e,t){if(!q())throw new RangeError("当前环境不支持 readInput");const n=t??Symbol(F(3));return new Promise(t=>{Qe.on(n,e,t)})}(e,t);function rt(e="",t=!0){let n="";const r=w(e);if(!C(t))throw _e.error(""),new TypeError("lineFeed 的类型必须是 boolean ");if("bigint"===r){const r=Object.prototype.toString.call(e).concat("n");n=t?`${r}\n`:`${r}`}else if(["string","number","boolean","function","null"].includes(r))n=t?`${e}\n`:`${e}`;else{const r=JSON.stringify(e,(e,t)=>j(t)?`${t}`:null==t?"undefined":t,2);n=t?`${r}\n`:`${r}`}q()?process.stdout.write(n):console.log(...oe(n.replace(/\n$/,"")))}function ot(e,t=!0){rt(`${t?V:z}${e}`,!1)}function it(){ot("?25l")}function st(){ot("?25h")}function at(e=!1){e&<(1/0),ot("0J")}function ct(e=1,t=!1){ot(`${ft(e,"vertical")}A`),t&<(1/0)}function lt(e=1){ot(`${ft(e)}D`)}function ut(e=1){ot(`${ft(e)}C`)}function ft(e,t="horizontal"){(!k(e=Number(e))||isNaN(e)||e<1||!1===Number.isInteger(e)&&e!==1/0)&&(e=1);const n=q()?"horizontal"===t?process.stdout.columns:process.stdout.rows:80;return(1/0===e||e>n)&&(e=n),e}function ht(){st()}function dt(e){const t=e[e.length-1];y(t)&&!t.endsWith("\n")&&e.push("\n"),e.forEach(e=>rt(e,!1))}function gt(e,t){const{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}=t??{show:!0,info:"请等待",prefix:0,interval:20,canCtrlCExit:!1,canCtrlDExit:!1,beforeDestroyed:()=>{}},l=C(e)?{show:e,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:y(e)?{show:n,info:e,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:S(e)?{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:k(e)?{show:!0,info:"请等待",prefix:isNaN(e)?o:Math.min(Math.max(0,e),2),interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c}:{show:n,info:r,prefix:o,interval:i,canCtrlCExit:s,canCtrlDExit:a,beforeDestroyed:c,...e};return l.interval=isFinite(l.interval)?Math.max(20,Math.min(2e3,l.interval)):i,l.info=l.info.replace(/\n/g,"\\n"),l}function pt(){st()}Object.defineProperties(nt,{remove:{value:e=>Qe.del(e)}});const bt=[".","..","...","....","...",".."],mt=[["⋯","⋱","⋮","⋰","⋯","⋱","⋮","⋰"],["🕐","🕑","🕒","🕓","🕔","🕕","🕖","🕗","🕘","🕙","🕚","🕛"],["🕜","🕝","🕞","🕟","🕠","🕡","🕢","🕣","🕤","🕥","🕦","🕧"],["👈","👆","👉","👇","🤘","🤟","🫳","🫴","👊"],["🌞","🌕","🌖","🌗","🌜","🌘","🌑","🌒","🌓","🌛","🌔","🌔","🌔","🌝"]];class wt{#e;#t=void 0;#n=Symbol("waiting-tips");#r=[];#o=(...e)=>dt(e);state="destroyed";#i=0;#s=4e4;#a=!1;async destroyed(){"destroyed"!==this.state&&(this.state="destroyed",this.#i=0,S(this.#t)||clearInterval(this.#t),nt.remove(this.#n),lt(1/0),at(),process.removeListener("exit",ht),process.removeListener("SIGINT",pt),st(),this.#r.forEach(e=>this.#o(...e)),this.#r.length=0,this.log=this.#o,"promise"!==w(this.#e.beforeDestroyed)?this.#e.beforeDestroyed(this.#a):await this.#e.beforeDestroyed(this.#a),this.#a=!1)}log=this.#o;run(e){"run"===this.state&&this.destroyed(),this.#a=!1,this.state="run",this.#i=Date.now(),this.#e=S(e)?this.#e:gt(e,this.#e);const{prefix:t,info:n,interval:r,canCtrlCExit:o,canCtrlDExit:i}=this.#e;this.log=(...e)=>this.#r.push(e);const s=bt.length,a=mt[Math.min(mt.length-1,Math.max(t,0))],c=a.length,l=a.reduce((e,t)=>Math.max(e,Re(t)),0);let u=0;it(),process.on("exit",ht),process.on("SIGINT",pt),this.#t=setInterval(()=>{at(!0),this.#r.forEach(e=>dt(e)),this.#r.length=0,rt("\n".repeat(2)),ct(3),ot(7,!1);const e=Me(a[++u%c],l);Date.now()-this.#i<this.#s?rt(De(`${e} ${n.replace(/\n/,"\\n")}${bt[Math.floor(u/10)%s]}`),!1):rt(De(`${e} ${n} ${de`当前已执行 ${Math.ceil((Date.now()-this.#i)/1e3)} 秒`}\n \n\r${ge`可使用双击 esc 键退出(确保执行完成,若执行仍在期望时间内,请忽略)`}`),!1),ot(8,!1)},r),nt((e,t)=>!!(t?.meta&&t?.sequence===z.repeat(2)||I(t?.ctrl)&&(o&&"c"===t?.name||i&&"d"===t?.name))&&(this.#a=!0,this.destroyed(),!0),this.#n)}set timeout(e){this.#i=Date.now(),this.#s=!isFinite(e)||e<0?4e4:e<600?1e3*e:e}get timeout(){return this.#s}constructor(e){this.#e=gt(e),I(this.#e.show)&&this.run()}}function yt(e,t,n){let r=e.toString().trim();return/\n$/.test(r)||(r=r.concat(Ke?"\r\n":"\n")),r=r.replace(/\n+/g,"\n"),at(),t&&n.log(r),r}function vt(e,t){if(O(q()))throw new RangeError("当前环境不支持 node 环境");const{env:r}=t;y(e)&&(r.code=e,e={code:e,waiting:!1});const o=process.cwd();let i=p(o,e.cwd||"");-1===function(e){try{const t=qe(e);if(t&&t.isDirectory())return 0==n(e,{withFileTypes:!0}).length?1:0}catch(e){return _e.error("is ",e),-1}return-1}(i)&&(_e(`执行目录 ${le(i)} 不存在,使用命令执行目录 ${ge(o)}`),i=o);const s=e.code.replace(/\s{2,}/g," ").trim().split(" ");Object.assign(t.env,{shell:!0,hideWaiting:!0,waitingMessage:"请稍等",printLog:!1,...e,cmd:s,cwd:i})}function xt(e){const t={result:{success:!1,data:"",error:"",status:1,isSIGINT:!1,runCode:"",runCwd:""},env:{cmd:[],code:"",cwd:"",printLog:!1,shell:!0,callBack:()=>{},waiting:{show:!1,info:"",prefix:0,interval:10,canCtrlDExit:!1,canCtrlCExit:!1,async beforeDestroyed(){}}}},{env:n,result:r}=t;_e("runOtherCode 方法 开始执行 "),vt(e,t),_e("执行参数",t);const{cmd:o,waiting:i,cwd:s,shell:a,code:c}=n,[l,u]=(()=>{if(i instanceof wt)return[i,"run"===i.state];const e=gt(i);return[(t=e,new wt(t)),e.show];var t})();r.runCode=c,r.runCwd=s||process.cwd();try{return new Promise(e=>{const n=I(a)?d(c,[],{cwd:s,shell:a}):d(o[0],o.slice(1),{cwd:s,shell:a});u&&l.run({beforeDestroyed:e=>{if(e){if(_e("执行退出前"),Ke){try{n.killed||n.kill(-1)}catch(e){_e.error("使用 child.kill(child.pid, -1 ) 关闭子进程失败",e),d("taskkill",["/pid",n.pid?.toString()||"","/T","/F"],{stdio:"pipe"})}_e("终结在 windows 下的子进程")}else n.kill("SIGTERM"),_e("终结在非 windows 下的子进程");t.result.isSIGINT=!0}}}),n.on("spawn",()=>function(e){const{result:t}=e;_e("子线程已启动,运行状态良好"),t.success=!0,t.status=1}(t)),n.stdout.on("data",e=>function(e,t,n){const{env:r,result:o}=t,i=yt(e,r.printLog,n);_e(ke`stdout on data`,i),o.data+=i}(e,t,l)),n.on("exit",(e,t)=>{_e("子进程已退出了,退出码为 <",e,">"),T(t)||_e.error("子进程被其他信号中断执行,执行的退出信号为:",t)}),n.stderr.on("data",e=>function(e,t,n){const{env:r,result:o}=t,i=yt(e,r.printLog,n);_e(ke`stderr on data`,i),o.error+=i}(e,t,l)),n.on("error",e=>function(e,t,n){const{env:r,result:o}=t;{const t=yt(e,r.printLog,n);_e(ke`error`,t),_e.error("error",t),o.success=!1,o.status=""!==o.data?2:3,o.error+=t}}(e,t,l)),n.on("close",(n,r)=>function(e,t,n,r,o){const{env:i,result:s}=r,{callBack:a}=i;_e("进行正常关闭",e),setTimeout(async()=>{a&&j(a)&&await Promise.resolve(Reflect.apply(a,null,[])),await o.destroyed(),0!==e&&"SIGINT"!==t&&"SIGTERM"!==t?(s.success=!1,s.status=3):"SIGINT"!==t&&"SIGTERM"!==t||(s.success=!1,s.status=4,s.isSIGINT=!0),n(s)})}(n??0,r??"",e,t,l))})}catch(e){const t=e.toString();return _e.error("创建(但是确是非 node 无法创建子进程,而是更上游的 node 创建的错误)子进程出错",e),new Promise(e=>{(async()=>{await l.destroyed()})(),r.error=t,r.success=!1,r.status=0,e(r)})}}const $t=e=>xt(e);async function kt(e,t=10){if(!y(e))throw new TypeError("str 需是一个字符串");if(!isFinite(t)||t<0||t>1e4)throw new RangeError("delay 需是一个 0 到 10000 之间(不包括两端)的数值");const n=Array.from(e);if(0!==n.length){for(const r of n)await _(t),_e(`当前字符 ${Ee(r)} 长度为:`,r.length),_e(`当前字符 ${ce.reversed(r)} 在 charCodeAt`,r.charCodeAt(0),r.charCodeAt(1),r.charCodeAt(2)),1===r.length&&isNaN(r.charCodeAt(1))?rt(r,!1):2===e.length&&e.charCodeAt(0)>=55296&&e.charCodeAt(0)<=56319&&e.charCodeAt(1)>=56320&&e.charCodeAt(1)<=57343?(rt(r,!1),rt(" ",!1)):2===e.length&&65039===e.charCodeAt(1)?(rt(r,!1),rt(" ",!1)):(rt(r,!1),rt(" ",!1));rt()}else rt()}const Et=process.argv.slice(2);Object.freeze(Et);class Ct{originalArg=Et.slice();name="";__filename="";get state(){return this._state}set state(e){this._state=[void 0,{code:1,text:"start"},{code:2,text:"bind over"},{code:3,text:"run over"},{code:4,text:"over",overCode:e}][k(e)?e:4]}_state={code:1,text:"start"};args=new It;abbr={};helpInfo="";hasShowVersion=!1;originalBind={};values=[]}class It extends Array{get $nomatch(){return[]}get $map(){return{}}get $arrMap(){return[]}get $only(){return[]}get $original(){return[]}get $isVoid(){return!1}}const Ot={},Tt=new Pe({name:"a command"}),St=O(Tt.type);function jt(e){return[e.replace(/^(.*?)\s.*/gm,"$1")||"",/<.+>/.test(e)&&e.replace(/.*<(.+)>.*/,"$1")||"",e.replace(/.*?\((.*)\).*?/,"$1")||""]}function Rt(e,t){switch(t.state.code){case 3:return void Tt.warn("执行绑定","但是已经执行过 `run`");case 4:return void Tt.warn("执行绑定,但是 command 已完成全部应做动作");default:t.state=2}if(y(e)){const[n,r,o]=jt(e);return Rt({name:n,abbr:r,info:o},t)}if(R(e))return e.forEach(e=>Rt(e,t));if(!S(e)&&!e.name&&!e.info)return function(e,t){const n={name:"",info:"",abbr:"",options:[]},r=Object.keys(e),o=Object.keys(n);return r.forEach(n=>{if(!o.includes(n)){const[r,o,i]=jt(n);return Rt({name:r,info:i,abbr:o,options:e[n]},t)}})}(e,t);const n=e;n.abbr&&(t.abbr[n.abbr]=n.name),n.options?n.options=function(e,t,n){R(e)||(e=[e]);const r={};return e.forEach(e=>{let o={name:"",abbr:"",info:""};y(e)?[o.name,o.abbr,o.info]=jt(e):o=Object.assign(o,e),o.abbr&&(n.abbr[`${t}^${o.abbr}`]=o.name),r[o.name]=o}),r}(n.options,n.name,t):n.options={},t.originalBind[n.name]={abbr:"",...n}}function Nt(){return new Proxy(new Ct,{get(e,t,n){if("args"===t){const t=JSON.parse(JSON.stringify(e[Symbol.for("_args")]||[]));return new Proxy(t,{get(n,r,o){return"$nomatch"===r?e.values.slice():"$map"===r?function(e){if(N(e))return{};const t=new Object;return e.forEach(e=>{const n=t[e.name]||{};n.value=[...n.value||[],...e.value||[]],e.options&&e.options.forEach(e=>{n[e.name]=[...n[e.name]||[],...e.value||[]]}),t[e.name]=n}),t}(t):"$arrMap"===r?N(i=t)?[]:i.map(e=>{const t={},n=t[e.name]||{};return e.value&&!N(e.value)&&(n.value=e.value),S(e)||S(e.options)||N(e.options)||(n.options=[],e.options.forEach(e=>{n.options?.push(Object.fromEntries([[e.name,e.value]]))})),t[e.name]=n,t}):"$only"===r?[...new Set(t.map(e=>e.name))]:"$original"===r?Et.slice():"$isVoid"===r?0==Et.slice().length:Reflect.get(n,r,o);var i},set:(e,t,n,r)=>(Reflect.set(e,t,n,r),!0)})}return Reflect.get(e,t,n)},set:(e,t,n,r)=>("args"===t?e[Symbol.for("_args")]=n:Reflect.set(e,t,n,r),!0)})}const Mt=" ".repeat(4);function Dt(e){return e.state="help",y(e.helpInfo)&&"help"!==e.helpInfo?function(e,t){const n=e.originalBind[t];if(rt(`${Mt}${n.name}${Mt}${de(n.info)}\n`),n.options&&!D(n.options)){rt(`${fe(`${Mt}使用:`)} ${e.name} ${t} [subOptions/subAbbr [value]]\n`),rt(`${ge(`${Mt}subOptions:`)} \n`),Lt(n.options||{})}else{rt(`${ue(`${Mt}使用:`)} ${e.name} ${t} [value]\n`)}}(e,e.helpInfo):R(e.helpInfo)&&2==e.helpInfo.length?function(e){const t=e.name,n=e.helpInfo.join(" "),r=e.originalBind[e.helpInfo[0]].options[e.helpInfo[1]].info;rt(`${ge(" 可使用:")} ${t} ${n} [value]\n${ue(" 描述:")} ${r}`)}(e):function(e){rt(`${be(" 可使用:")} ${e.name} options/abbr [subOptions/subAbbr [value]]\n\n选项:\n`);const t=Lt(e.originalBind);!function(e){["version -v 版本描述","help -h 帮助查看"].forEach(t=>{const[n,r,o]=t.split(" ");rt(Bt({len:e,name:n,info:o,abbr:r})),rt("")})}(t)}(e)}function Lt(e){const t=Object.keys(e).sort();let n=8;t.forEach(e=>n=Math.max(n,e.length));const r=Math.min(15,n+1);return rt(Bt({len:r,name:"子命令",info:"描述",abbr:"缩写",color:!1})),rt(""),t.forEach(t=>{const{name:n,abbr:o,info:i}=e[t];let s=!1;"options"in e[t]&&!D(e[t].options)&&(s=!0),rt(Bt({len:r,name:n,info:i,abbr:o,textDecoration:s})),rt("")}),r}function Bt(e){const t=Object.assign({name:"",info:"",abbr:"",len:15,color:!0,textDecoration:!1},e);let n=ce[t.color?"green":"black"](Mt);return n+=ce[t.textDecoration?"blue":"black"](t.name.slice(0,t.len)),n+=" ".repeat(t.len+1-Pt(t.name,t.len)),n+=ce[t.color?"yellow":"black"]`${t.abbr?.slice(0,6)||""}${" ".repeat(7-Pt(t.abbr||"",6))}`,n+=t.color?de(t.info):t.info,n}function Pt(e,t){return Math.min(e.replace(/[^\x00-\x7f]/,"11").length,t)}const Ft="";function Wt(e){const{name:t,object:n,item:r,result:o}=e;$(t)||(r.name&&n.options?.push(r),o.push(JSON.parse(JSON.stringify(n))))}function At(e,t){"true"==e?e=!0:"false"==e?e=!1:e==Number(e)&&(e=Number(e)),$(t.name)?t.values.push(e):t[t.item.name?"item":"object"].value.push(e)}function qt(e,t){const n=[];let r="";const o=(e,t)=>S(t)||$(t)?n.push(e):n.push(e,t);function i(e,s){if(!$(r)){if(t.originalBind[r].options[e])return o(e,s);const n=t.abbr[`${r}^${e}`];if(!S(n))return o(n,s)}if(t.originalBind[e])return r=e,o(e,s);if(t.abbr[e])return e=t.abbr[e],r=e,o(e,s);if(e.includes("=")){const t=e.indexOf("=");if(0===t||t===e.length-1)return n.push(e);const[r,o]=[e.slice(0,t),e.slice(t+1)||"true"];return i(r,o)}return S(s)||$(s)?n.push(e):n.push(`${e}=${s}`)}return e.forEach(e=>i(e)),n}function _t(e,t,n){n.init(),(e=qt(e.filter(e=>""!==e),t)).forEach(e=>{const{name:r}=n;return e=e.trim(),/^([a-z]|[A-Z]|-|\$|_)/.test(e)?!$(r)&&t.originalBind[r].options&&t.originalBind[r].options[e]?function(e,t){const{item:n,object:r}=t;n.name&&r.options.push(n),t.resetItem(e)}(e,n):t.originalBind[e]?function(e,t){$(t.name)||(Wt(t),t.resetItem("")),t.resetObject(e)}(e,n):At(e,n):At(e,n)}),Wt(n)}function zt(e){switch(e.state.code){case 3:return void rt("已经执行过 `run`");case 4:return void rt("已完成全部");default:e.state=3}!function(e){if(2==process.argv.length)return;const t=e.originalArg,n=`${Ft}${t.join(Ft)}${Ft}`,r=t.findIndex(e=>/^(-h|help)$/.test(e));if(new RegExp(`${Ft}(-v|version)${Ft}`,"i").test(n))return void(e.hasShowVersion=!0);if(E(r))return void(e.helpInfo="help");let o=[];const i={result:[],values:[],name:"",object:{name:"",value:[],options:[]},item:{name:"",value:[]},resetObject(e){this.name=e,this.object={name:e,value:[],options:[]}},resetItem(e){this.item={name:e,value:[]}},init(){this.result=[],this.values=[],this.resetItem(""),this.resetObject("")}};r>0?(_t(t.slice(0,r+1),e,i),e.values=i.values,e.args=i.result,o=e.args,N(o)?e.helpInfo="help":[S,N].some(e=>e(o[0].options))?e.helpInfo=o[0].name:e.helpInfo=[o[0].name,o[0].options[0].name]):(_t(t,e,i),e.values=i.values,e.args=i.result)}(e),function(e){["name","originBind","abbr"].forEach(t=>{const n=t;e[n]&&(Object.freeze(e[n]),Object.defineProperty(e,t,{value:e[n],writable:!1,enumerable:!0,configurable:!1}))})}(e)}function Vt(e){e.state="version";const t=Ve("package.json","file",Ue(e.__filename).name);if(S(t))return Gt();const n=ze(t,"package.json");if(!qe(n))return Gt();const r=Ge(n);if(T(r))return Gt();const{platform:o}=process,i=ce.brightCyan(r.name),a=r.version,c="win32"==o?"Windows":"darwin"==o?"mac":o,l=ce.brightMagenta(s());rt(`${i} 版本 ${ce.brightRed(a)} (${c} ${l})`)}function Gt(){rt("抱歉,未找到版本定义说明")}const Jt=Se("#333"),Ht=Se("#666"),Kt=Se("#aaa"),Ut=je("#666"),Yt=Ht(".".repeat(3)),Zt=(e="❖")=>me(e),Qt=(e="▶︎")=>we(e),Xt=(e="⚉")=>be(e),en=(e="◦")=>Ht(e),tn=(e="●")=>me.blink(e),nn=(e="□")=>Ht(e),rn=(e="□")=>me.blink(e),on=(e="■")=>Ht(e),sn=(e="■")=>me.blink(e);function an(e,t="⚉"){rt(`${Xt(t)} ${Se("#612").italic(e)}`)}function cn(e,t="❖"){rt(`${Zt(t)} ${e}`)}const ln={callList:[],on(e,t){const n=this.callList;N(n)&&(Tt("当前执行列表为空,直接执行任务",e),Reflect.apply(t,void 0,[])),n.push([e,t])},remove(e){const t=this.callList,n=t.findIndex(([t])=>t===e);return t.splice(n,1),N(t)?(Tt("当前执行列表为空,返回 true 结束执行"),!0):(Reflect.apply(t[0][1],null,[]),!1)}};function un(e=!0){return process.stdout.rows-4*(1+Number(e))}function fn(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];if(B(r,e=>[y,k].some(t=>t(e))))t.push({value:r,label:r,checked:!1,tip:"",disable:!1});else{if(!B(r,e=>[y,y].some(t=>t(e.label))&&[y,k,L].some(t=>t(e.value))))throw new TypeError(`${r} 的类型非法(有可能是返回值类型更改后未在解析中兼容)`);{let e=r.checked;!S(e)&&C(e)||(e=!1);let n=r.tip;!S(n)&&y(n)||(n="");const o=r.value;if(S(o)||T(o))throw new TypeError("value 值类型非法");const i=r.label,s=I(r.disable);t.push({checked:e,tip:n,value:o,label:i,disable:s})}}}return t}const hn="请使用键盘选择,请使用 Enter 键进行选择",dn=!1,gn="radio",pn={drawData:[],info:hn,focus:0,renderInfo:{rows:0,renderRows:0,otherInfoRows:0,allowBelow:!1,size:{width:0,height:0}},resultText:"",errorText:"",private:dn,required:dn,kind:gn,canCtrlCExit:dn,canCtrlDExit:dn,mustInfo:dn,maxRows:un(),data:[],initData(e){Tt("初始化数据"),this.reset(),R(e)?this.data=fn(e):Object.keys(e).forEach(t=>{const n=e[t];switch(t){case"data":this.data=R(n)?fn(n):[];break;case"info":this.info=y(n)?n:hn;break;case"resultText":this.resultText=y(n)?n:this.info||"";break;case"errorText":this.errorText=y(n)?n:this.resultText||this.info||"";break;case"private":this.private=C(n)?n:dn;break;case"required":this.required=C(n)?n:dn;break;case"kind":this.kind="check"===n?"check":gn;break;case"canCtrlCExit":this.canCtrlCExit=C(n)?n:dn;break;case"canCtrlDExit":this.canCtrlDExit=C(n)?n:dn;break;case"maxRows":this.maxRows=isFinite(n)&&Number.isInteger(n)&&n>0?n+4:un()}});const t=this.data;for(const e in t){if(!t[e].disable)return this.focus=Number(e),!1}return!0},reset(){this.drawData.length=this.data.length=this.focus=0,this.maxRows=un(),this.renderInfo={rows:0,renderRows:0,otherInfoRows:0,allowBelow:!1,size:{width:0,height:0}},this.info=hn,this.kind=gn,this.resultText=this.errorText="",this.private=!0,this.required=this.canCtrlCExit=this.canCtrlDExit=this.mustInfo=dn}};function bn(e){const{data:t}=pn,n=process.stdout.columns-7,r=n-3,o=t[e].label.toString();return Re(o)<=n?o:Me(o,r,!1).concat(Yt)}const mn=()=>{!function(){const{focus:e,drawData:t,data:n,kind:r}=pn;for(let o=0,i=n.length;o<i;o++){const i=n[o];if(S(t[o])){const n=Re(i.label.toString());t[o]={index:o,text:bn(o),length:n,checked:"radio"!==r&&i.checked,focus:o===e,changed:!0,show:!0,disable:i.disable}}else o===e?(t[o].changed=!0,t[o].focus=!0):o!==e&&I(t[o].focus)&&(t[o].changed=!0,t[o].focus=!1)}}(),function(){const{drawData:e,renderInfo:t,focus:n}=pn,{renderRows:r}=t,o=e.length;if(o===r)return void e.forEach(e=>e.show=!0);const i=o-1,s=Math.floor((r-1)/2);let a=1&r?n-s:n-s-1;a=a<0?0:a;let c=r+a-1;c>i&&(c=i,a=c-r+1);e.forEach(e=>{const{index:t}=e;t>c||t<a?e.show=!1:t===c&&t!==i||t===a&&0!==t?(e.show=!0,e.text=Yt):e.text===Yt?(e.show=!0,e.text=bn(t)):e.show=!0})}();const{info:e,mustInfo:t,renderInfo:n,focus:r,data:o}=pn,{rows:i,allowBelow:s,size:a}=n,{width:c}=a;let l=`${V}${c}D`;l+="\n".repeat(i),l+=`${V}${i}A`,l+=`${V}J`,l+=De(`${Qt()} ${e} \n\n`),l+=function(){const{drawData:e,kind:t}=pn;let n="";for(let r=0,o=e.length;r<o;r++){const o=e[r];o.show&&(o.focus?(n+=De(` ${"radio"===t?tn():o.checked?sn():rn()} ${o.text}`),n+="\n"):o.text===Yt?(n+=` ${Yt}`,n+="\n"):o.disable?(n+=De(` ${"radio"===t?Kt`⊗`:o.checked?Kt`▣`:Kt`☒`} ${Kt(o.text)}`),n+="\n"):(n+=De(` ${"radio"===t?en():o.checked?on():nn()} ${Jt(o.text||"")}`),n+="\n"))}return n}(),l+=`${V}J`,s&&(t?l+=function(){const e=process.stdout.columns-7;pn.mustInfo=!1;const t="抱歉,该项至少选择一项!!!请使用空格键或是左右键切换选择状态",n=Re(t)<e?t:Me(t,e);return"\n".concat(le(n))}():o[r].tip?(l+="\n",l+=De(`${ge(o[r].tip)}`)):l+="\n",l+="\n"),St&&(l+=`${V}${c}D${V}${i}A`),rt(l,!1)},wn=W(mn,66),yn=W(mn,600);function vn(){const{data:e,renderInfo:t,maxRows:n}=pn,[r,o]=[process.stdout.columns,process.stdout.rows],i=e.length;t.size={width:r,height:o};const s=t.rows=Math.max(Math.min(i+4,un(!1),n),5),a=t.allowBelow=un()>e.length||s>6,c=t.otherInfoRows=a?4:2;t.renderRows=s-c}async function xn(){const{data:e,required:t,kind:n,drawData:r,canCtrlCExit:o,canCtrlDExit:i}=pn,s={exit:!1};return await nt((a,c)=>{const{focus:l}=pn;switch(c.name){case"return":return Tt("用户已选择,返回真值告诉等待程序可终结当前输入"),"check"!==n||!t||!N(r.filter(e=>e.checked))||(pn.mustInfo=!0,wn(),!1);case"up":Tt("用户使用了键盘键的 up 键"),kn(!1),wn();break;case"down":Tt("用户使用了键盘键的 down 键"),kn(),wn();break;case"right":Tt("用户使用了键盘键的右键");case"left":Tt("用户使用了键盘键的左键");case"space":Tt("用户使用了键盘键的空格键"),"check"===n&&(e[l].checked=r[l].checked=!r[l].checked,wn());break;case"escape":if(c?.sequence===z.repeat(2))return s.exit=!0,!0;break;default:if(Tt("用户使用了键盘键的非方向键 <",a,">, <",c,">"),I(c?.ctrl)&&("check"===pn.kind&&("a"===c?.name&&($n(),wn()),"z"===c?.name&&($n(!1),wn()),"r"===c?.name&&(pn.data.forEach(e=>{e.disable||(e.checked=!e.checked)}),pn.drawData.forEach(e=>{e.disable||(e.checked=!e.checked)}),wn())),I(o)&&"c"===c?.name||I(i)&&"d"===c?.name))return s.exit=!0,!0}return!1}),s.exit}function $n(e=!0){pn.data.forEach(t=>{t.disable||(t.checked=e)}),pn.drawData.forEach(t=>{t.disable||(t.checked=e)})}function kn(e=!0){const{focus:t,drawData:n}=pn,r=n.length-1,o=e?t===r?n:[...n.slice(t+1),...n.slice(0,t+1)]:0===t?n.toReversed():[...n.slice(t),...n.slice(0,t)].toReversed();for(const e of o)if(!e.disable)return void(pn.focus=e.index)}async function En(e,t){const n=Symbol("selection");return new Promise((r,o)=>{ln.on(n,async()=>{try{const o=await async function(e,t){if(process.stdout.removeListener("resize",Cn),process.stdout.on("resize",Cn),pn.initData(e))return;it(),Tt("初始绘制问题选项"),vn(),wn(),Tt("绘制完成,等待用户操作");const n=await xn();rt(J,!1),process.stdout.removeListener("resize",Cn);const{resultText:r,info:o,focus:i,kind:s,drawData:a,errorText:c}=pn;if(st(),at(!0),n)return void(pn.private||an(c||r||o));const l=a.filter(e=>e.checked);if(!pn.private){const e="radio"===s?[a[i].text]:l.map(e=>e.text);cn(`${Ht.italic.dim(r||o)}: ${Ht(e.join("、"))}`)}const u="radio"===s?pn.data[i].value:l.map(e=>pn.data[e.index].value),f="radio"===s?i:l.map(e=>e.index),h="string"==t||S(t)?u:f;return h}(e,t);ln.remove(n),r(o)}catch(e){Tt.error(e),ln.remove(n),o()}})})}const Cn=W(()=>{const{drawData:e,renderInfo:t}=pn,n=t.size.height;e.length=0,rt(J,!1),at(),vn(),process.stdout.rows!==n?yn():wn()},33);function In(e,t){return En(e,t)}const On={data:"",kind:0,multi:!1,progressCount:0,indexOfCursor:0,init:function(e){this.data=e,this.multi=R(e)}},Tn={get kind(){return On.kind},set kind(e){(!isFinite(e)||0!=e&&1!=e)&&(e=0),On.kind=e},get multi(){return On.multi},enterText:[],get progressCount(){return On.progressCount},set progressCount(e){On.progressCount=e,e<0&&Reflect.apply(Sn,this,[])},get indexOfCursor(){return On.indexOfCursor},set indexOfCursor(e){On.indexOfCursor=e},currentIssue:{text:"请更换为你自己的问题",tip:"",type:"text",private:!0,errorText:"",resultText:"",required:!0,defaultValue:"",mustInfo:!1,canCtrlCExit:!1,canCtrlDExit:!1,isWrapLine:!1,usableLength:0,mustInfoLen:0,row:0,cum:0,maxLen:0,minLen:0,len:0,verify:[]},results:[],assign(e){Object.keys(e).forEach(t=>{if(!Object.hasOwn(this,t)||S(e[t]))throw rt(`${t} is not exist`),new Error(`${t} is not exist`);this[t]=e[t]})},beforeStart(){this.results.length=this.enterText.length=this.indexOfCursor=0,this.progressCount=On.multi?-On.data.length:-1}};function Sn(){const{multi:e,progressCount:t}=this,n=e&&R(On.data)?On.data[On.data.length+t]:On.data,r={text:"请更换为你自己的问题",tip:"",type:"text",private:!0,errorText:"",resultText:"",required:!0,defaultValue:"",mustInfo:!1,canCtrlCExit:!1,canCtrlDExit:!1,isWrapLine:!1,usableLength:0,mustInfoLen:0,row:0,cum:0,maxLen:0,minLen:0,len:0,verify:[]};Object.assign(r,y(n)||k(n)?{text:n}:n);const o=R(r.tip)?1:0;let i;1==o?i=[r.tip[0]]:(i=[],[r.tip,r.defaultValue].every(e=>x(e))&&(r.required=!0),!$(r.defaultValue)&&x(r.tip)&&(r.tip=r.defaultValue)),r.text=$(r.text.toString())?"请使用你自己的问题":r.text,this.assign({indexOfCursor:0,kind:o,enterText:i,currentIssue:r})}const jn=W(()=>{const{kind:e,currentIssue:t,enterText:n}=Tn,{mustInfo:r,text:o,required:i,tip:s,verify:a}=t;it();let c="",l=!1;if(E(t.row)||(c+=`${V}${t.row}A`,t.row=0),c+=`\r${V}0J${J}`,r)c=Rn(c),l=!0;else if(!N(n)){const e=n.join("");for(const n of a)if(v(n.reg)&&y(n.info)&&[S,C].some(e=>e(n.inverse))){n.reg.lastIndex=0;const r=n.reg.test(e);if(I(n.inverse)&&I(r)||I(!n.inverse)&&O(r)){t.mustInfo=n.warn?we(n.info):n.info,c=Rn(c),l=!0;break}}}const u=0===e&&i?be.blink("*"):"";c+=`${Qt()} ${u}${o}${u}: `,t.row+=Number(t.isWrapLine),c+="\n".repeat(Number(t.isWrapLine)),E(e)?N(n)&&y(s)?x(s)?c+=Ce.dim.blink("I"):c+=" ".concat(Ut.italic.dim(s[0])).concat(Ce.dim(s.slice(1))):(c+=" ",c=function(e){const{type:t,usableLength:n}=Tn.currentIssue;e="text"===t?function(e,t){const{enterText:n,indexOfCursor:r}=Tn,o=Re(n.join(""))>t;r===n.length?(o?e=function(e,t){const{enterText:n}=Tn;return e+=Yt.concat([...Me(n.toReversed().join(""),t-3,!1)].reverse().join("")),e}(e,t):e+=n.join(""),e+=Ut.hide(" ")):o?e=function(e,t){const{indexOfCursor:n,enterText:r}=Tn,o=r.join(""),i=r.length,s=Math.floor(t/2),a=Me(o,s),c=a.length-1,l=a[c]===o[c]?c:c-1,u=Me(o,-s),f=u.length-1,h=u[f]===o[i-1-f]?i-1-f:i-f,d=r.map((e,t)=>t===n?Ut(e):e).join("");if(n>=h)e+=Yt,e+=Me(d,3-t,!1);else if(n<l)e+=Me(d,t-3,!1),e+=Yt;else{const t=s-Re(r[n])-3;e+=Yt,e+=Me(o.slice(0,n),-t,!1),e+=Ut(r[n]),e+=Me(o.slice(n+1),t,!1),e+=Yt}return e}(e,t):e+=`${n.map((e,t)=>t===r?Ut(e):e).join("")}`;return e}(e,n):function(e){const{enterText:t,indexOfCursor:n}=Tn;n===t.length?(e+=` ${t.map(()=>"*").join("")}`,e+=Ut.hide("1")):e+=` ${t.map((e,t)=>t===n?Ut("*"):"*").join("")}`;return e}(e);return e}(c)):c=function(e){const{currentIssue:t,enterText:n}=Tn;return e+t.tip.map(e=>e===n[0]?Ie.bold.blink.cyan(e):de(e)).join(" ")}(c),Tt("计算完成的文本为",c),rt(De(c)),t.row++,function(e){const{currentIssue:t,indexOfCursor:n,enterText:r}=Tn,{text:o,required:i,mustInfoLen:s}=t;if(e)return ut(s);const a=r.slice(0,n).join(""),c=o.toString().concat(a),l=Re(c),u=l+7+2*Number(i),f=u%process.stdout.columns;Tt("用户输入",r.join("")),Tt("光标所在的位置",n),Tt("实际参与计算的用户输入的文本为",a),Tt("计算总文本",c),Tt("计算文本长度",l),Tt("计算可用长度",u),Tt("屏幕宽",process.stdout.columns),Tt("光标偏移量",u%process.stdout.columns),ut(f)}(l),l||rt(Oe("I"),!1),ot("8m")},66);function Rn(e){const{currentIssue:t}=Tn;e+="\n\r",t.row++;let n="";if(C(t.mustInfo)){const e=t.required?" ":"";n+=" ".repeat(2).concat(e).concat(le(t.text)).concat(e).concat(" ".repeat(3)),n+=le.blink`👆`}else n+=de(t.mustInfo);let r=Re(n);const o=process.stderr.columns-4;return o<r&&(r=o,n=Me(n,o)),t.mustInfoLen=r,e+=n,e+=`\r${V}1A`,t.row--,t.mustInfo=!1,e}function Nn(){const{currentIssue:e}=Tn;!function(){const{currentIssue:e}=Tn,t=process.stdout.columns;let n=t-Re(e.text.toString())-2*Number(e.required)-4-7;const r=n<5;r&&(n=t-4);e.isWrapLine=r,e.usableLength=n}();const{isWrapLine:t}=e,n=2+Number(t);rt("\n".repeat(n),!1),e.row+=n,ct(n),e.row-=n}async function Mn(){try{await nt((e=this,(t,n)=>{const{kind:r,currentIssue:o,enterText:i,results:s}=e,{tip:a,text:c,canCtrlCExit:l,canCtrlDExit:u}=o;let f=[],h=0,d=0,g=!0;switch(E(r)||(f=a,h=f.length-1,d=f.indexOf(i[0])),Tt("\n 用户使用了",t,n),n.name){case"return":if(function(){const{enterText:e,currentIssue:t,results:n}=Tn,r=t.text;let o=e.join("").trim();if(x(o)&&t.required)return t.mustInfo=!0,!1;const{len:i,minLen:s,maxLen:a,verify:c}=t,l=o.length;if(E(Tn.kind)){if(c.length>0)for(const e of c)if([S,O].some(t=>t(e.warn))&&v(e.reg)&&y(e.info)&&[S,C].some(t=>t(e.inverse))){e.reg.lastIndex=0;const t=e.reg.test(o);if(I(e.inverse)&&t||!e.inverse&&!t)return!1}if(!E(i)&&l!==i)return t.mustInfo=`您输入的长度 ${ue(l)} 不符合要求值 ${ge(i)}`,!1;if(!E(s)&&l<s)return t.mustInfo=`您输入的长度 ${ue(l)} 小于最低要求${ge(s)}`,!1;if(a>s&&l>a)return t.mustInfo=`您输入的长度 ${ue(l)} 大于最低要求${ge(a)}`,!1}return x(o)&&O(t.required)&&(o=t.defaultValue||t.tip||""),n.push({q:r,r:o}),!0}())return g=!1,!0;break;case"left":!function(e,t,n){const{kind:r,enterText:o}=Tn;E(r)?Tn.indexOfCursor=0===Tn.indexOfCursor?o.length:Tn.indexOfCursor-1:o[0]=e[0===t?n:t-1]}(f,d,h);break;case"right":!function(e,t,n){const{kind:r,enterText:o}=Tn;E(r)?Tn.indexOfCursor=Tn.indexOfCursor==Tn.enterText.length?0:Tn.indexOfCursor+1:o[0]=e[t==n?0:t+1]}(f,d,h);break;case"delete":case"backspace":!function(){const{enterText:e,kind:t}=Tn;E(t)&&!E(Tn.indexOfCursor)&&(e.splice(Tn.indexOfCursor-1,1),Tn.indexOfCursor--)}();break;case"escape":if(n?.sequence===z.repeat(2))return s.push({q:c,r:void 0}),g=!1,!0;break;default:if(Tt("[0m当前触发为含 ctrl 键的功能键",t,n),O(n?.ctrl))!function(e){const{enterText:t,kind:n}=Tn;S(e)||0!==n||(Tn.indexOfCursor==t.length?t.push(e):t.splice(Tn.indexOfCursor,0,e),Tn.indexOfCursor+=1)}(t);else if(g=!1,ot("m"),I(l)&&"c"===n?.name||I(u)&&"d"===n?.name)return s.push({q:c,r:void 0}),!0}return g&&jn(),!1}))}catch(e){Tt.error("接收用户输入出错",e),rt(e)}var e}function Dn(e,t){const n=Symbol("question");try{return new Promise((r,o)=>{ln.on(n,async()=>{try{const o=await async function(e,t){process.stdout.removeListener("resize",Ln),process.stdout.on("resize",Ln),Tt("初始化问题"),On.init(e),Tt("初始化当前问题"),Tn.beforeStart(),Tt("开始绘制问题");do{Nn(),jn();try{await Reflect.apply(Mn,Tn,[])}catch(e){Tt.error(e)}const{currentIssue:e,results:t}=Tn;E(e.row)||(ct(e.row,!0),e.row=0),ot("m"),st(),at(!0);const n=e.resultText||e.text,r=t[t.length-1].r;e.private||(S(r)?an(e.errorText||n):cn(`${Ht(n)}: ${"text"===e.type?r:r.replace(/./gm,"*")}`)),++Tn.progressCount}while(Tn.progressCount<0);return process.stdout.removeListener("resize",Ln),ot("m"),st(),at(!0),Tn.multi?I(t)&&R(e)?Tn.results.map(e=>e.r):Tn.results:Tn.results[0].r}(e,t);ln.remove(n),r(o)}catch(e){Tt.error("\n\n\n\n\n执行出现错误",e),ln.remove(n),o(e)}})})}catch(e){return Tt.error("系统故障",e),rt("系统故障",!1),rt(e),new Promise((t,n)=>{n(e)})}}const Ln=W(()=>{const{currentIssue:e}=Tn;E(e.row)||(ct(e.row,!0),e.row=0),rt(J,!1),at(!0),Nn(),jn()}),Bn=async function(e,t){return Dn(e,t)},Pn=new Pe({name:"qqi",type:!1});O(Pn.type);const Fn=new class{#c;#l;constructor(e=""){if(y(e)||(e=`${e}`),this.#c=Symbol(e),Ot[this.#c])throw new Error(`${e} 已经存在,请更换初始化命令名称,若仍想在原命令上操作,请抽离为单独的文件做数据共享`);this.#l=Ot[this.#c]=Nt(),[this.#l.__filename]=Ye(),this.#l.name=e||y(process.argv[1])&&process.argv.slice(1,2)[0].replace(/.*\/.*?$/,"$1")||"",Object.defineProperty(this,"#uniKey",{value:this.#c,writable:!1,enumerable:!1,configurable:!1})}get name(){return this.#l.name}get state(){return this.#l.state}isEnd(e=!1){const t=4===this.#l.state.code;return t&&I(e)&&this.end(),t}end(){return this.#l.state="end",process.exit()}error(){return this.#l.state="error",process.exit(1)}bind(e){return Rt(e,this.#l),this}run(){const e=this.#l;return zt(e),$(e.helpInfo)||Dt(e),e.hasShowVersion&&Vt(e),this}get args(){return this.#l.args}get values(){return this.#l.values.slice()}help(e,t){const n=this.#l;y(e)&&n.originalBind[e]?y(t)&&n.originalBind[e].options&&n.originalBind[e].options[t]?n.helpInfo=[e,t]:n.helpInfo=e:n.helpInfo="help",Dt(this.#l)}version(){Vt(this.#l)}}("nry");async function Wn(e="好的,即将退出"){return $(e)||await kt(e),st(),Fn.end()}function An(e){return e.endsWith("/")?e:e+"/"}async function qn(e){return new Promise(t=>{let n;try{return n=new URL(e),t(!0)}catch{return We.error("当前传入的",e,"有误"),t(!1)}})}Fn.bind(["add <a> (用于添加一个自定义的 npm、yarn、pnpm 源)","edit <ed> (用于编辑源) ",Ae?"":"clean (移除本地数据)","delete <del> (用于移除某个或多个自定义的项)","list <ls> (用于展示当前的所有的源)","manage <mg> (用于管理当前源在列表中的显隐)",`reset <rs> (重制当前的源,将${be`永久移除自定义源`}、${ye`恢复已更改的源`})`]).run().isEnd(!0);const _n={npm:"https://registry.npmjs.org/","tao-bao":"https://registry.npmmirror.com/","ten-xun":"https://mirrors.tencent.com/npm/",ustclug:"https://npmreg.proxy.ustclug.org/",yarn:"https://registry.yarnpkg.com/"},{npm:zn,"tao-bao":Vn,"ten-xun":Gn,ustclug:Jn,yarn:Hn}=_n,Kn=[{value:zn,label:"官方",tip:zn},{value:Vn,label:"淘宝",tip:Vn},{value:Gn,label:"腾讯",tip:Gn},{value:Jn,label:"中科大",tip:Jn},{value:Hn,label:"yarn",tip:Hn}];function Un(e=!1){if(e)return[...Kn];if(!Qn.available)return[...Kn];const t=Qn.read();if(R(t)&&t.every(e=>y(e.value)&&!$(e.label)&&y(e.value)&&!$(e.value))){return t.map(e=>(e.value=An(e.value),e.tip=An(e.tip),e))}return[...Kn]}const Yn=new class{#u;#f=!0;get available(){return this.#f}constructor(e){const t=function(){const e=a();if(Pn("当前获取用户主目录为",e),!e||"/"===e||e.includes("Default"))throw new Error("未能获取到主目录路径 <"+e+">");try{const t=ze(e,"test_write"+Date.now());return Je(t,{}),o(t),e}catch(e){return void Pn.error(e)}}();if(S(t))return this.#f=!1,void(this.#u="");this.#f=!0,this.#u=ze(t,".earthnut.dev.data",`${e}`)}read(e){if(!this.available)return null;const t=ze(this.#u,e);return S(qe(t))?{}:Ge(t)||{}}write(e,t){if(!this.available)return!1;const n=ze(this.#u,e),r=ze(n,"../");Pn("创建的文件路径为"),i(r,{recursive:!0}),Pn("写入的文件路径为:",n),Pn("写入文件内容为",t);const o=Je(n,t);return Pn("写入反馈",o),o}getPath(e){return ze(this.#u,e)}}("nry"),Zn="config",Qn={available:Yn.available,read(){if(Yn.available){const e=Yn.read(Zn);if(R(e))return e}return Un(!0)},addNew(e){if(Yn.available){const t=this.read();return t.push(e),We("新写入的数据为",e),this.write(t)}return!1},write:e=>!!Yn.available&&Yn.write(Zn,e),getPath:()=>Yn.getPath(Zn),clean(){const e=this.getPath();We("将要移除的文件",e),o(e)}},Xn={add:!1,edit:!1,delete:!1,manage:!1,list:!1,noMatch:!1,reset:!1,clean:!1},er={pkgManager:function(e=!1){if(O(e)){const e=e=>Boolean(Ve(e,"file"));if(e("pnpm-lock.yaml"))return"pnpm";if(e("yarn.lock"))return"yarn";if(e("package-lock.json"))return"npm"}const t=process.env.npm_config_user_agent||"";return t.includes("pnpm")?"pnpm":t.includes("yarn")?"yarn":t.includes("npm")?"npm":process.env.PNPM_HOME?"pnpm":process.env.YARN_IGNORE_PATH?"yarn":"npm"}(!0)};function tr(e){if(!Qn.available)return!1;const t=An(e.value);return Qn.addNew({value:t,label:e.label.toString(),tip:t,disable:!1})}const nr=b(function(e){return this.data=[],Object.setPrototypeOf(this,e),this});function rr(e,t){if(t.align&&(e.align=t.align),t.bgColor&&(e.bgColor=t.bgColor),t.color&&(e.color=t.color),t.italic&&(e.italic=t.italic),t.underline&&(e.underline=t.underline),t.border)if(B(t.border,e=>y(e))){const n=t.border;e.border={left:{color:void 0,style:n},right:{color:void 0,style:n},top:{color:void 0,style:n},bottom:{color:void 0,style:n}}}else if(B(t.border,e=>["color","style"].some(t=>!S(e[t])))){const n=t.border,r=n.style,o=n.color||void 0;e.border=JSON.parse(JSON.stringify({left:{color:o,style:r},right:{color:o,style:r},top:{color:o,style:r},bottom:{color:o,style:r}},(e,t)=>""===t?void 0:t))}else B(t.border,e=>["left","right","top","bottom"].some(t=>!S(e[t])))&&(e.border=t.border)}class or{}function ir(e,t){R(e)&&(e={data:e});const n=new or;rr(n,e);const r=new nr(n);return Object.setPrototypeOf(n,t),e.data?.forEach(e=>{e&&r.data.push(function(e,t){if(S(e))return;B(e,e=>!M(e))&&(e={content:e});const n={content:e.content};return rr(n,e),Object.setPrototypeOf(n,t),n}(e,n))}),r}class sr extends or{border={left:{style:"bold",color:void 0},right:{style:"bold",color:void 0},top:{style:"bold",color:void 0},bottom:{style:"bold",color:void 0}}}function ar(e){const t=new sr;return Object.setPrototypeOf(t,e),t}const cr=!q(),lr={emojiLength:2.08,emojiRegex:/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F900}-\u{1F9FF}]/gu,chineseLength:1.8,chineseRegex:/[\u4E00-\u9FFF]/g};const ur=new class{align="left";color="";bgColor="";bold=!1;underline=!1;italic=!1;border={left:{color:void 0,style:"simple"},right:{color:void 0,style:"simple"},top:{color:void 0,style:"simple"},bottom:{color:void 0,style:"simple"}}},fr=b(function(e){return this.body=[],this.header=void 0,Object.setPrototypeOf(this,e),this});class hr{}function dr(e){let t=ce;return B(e)&&(e.bold&&(t=t.bold),$(e.bgColor)||S(e.bgColor)||(t=t.bgColor(e.bgColor)),$(e.color)||S(e.color)||(t=t.color(e.color)),e.italic&&(t=t.italic),e.underline&&(t=t.underline)),t}const gr={fine:{lt:"┌",ct:"┬",rt:"┐",lc:"├",c:"┼",rc:"┤",lb:"└",cb:"┴",rb:"┘",l:"─",v:"│"}};function pr(e){let t=0;return[...e].forEach(e=>{lr.emojiRegex.lastIndex=0,lr.chineseRegex.lastIndex=0,e.match(lr.emojiRegex)?t+=lr.emojiLength:e.match(lr.chineseRegex)?t+=lr.chineseLength:t++}),Math.ceil(t)}function br(e,t){const n=function(e){const t=[];return e.header&&e.header.data.forEach((e,n)=>{const r=e?.content?.toString()??"";t[n]=Math.max(t[n]??0,cr?pr(r):Re(r))}),e.body&&e.body.forEach(e=>{e.data.forEach((e,n)=>{const r=e?.content?.toString()??"";t[n]=Math.max(t[n]??0,cr?pr(r):Re(r))})}),t}(e);let r=!1,o="";e.header&&(r=!0,o+=function(e,t){let n="";const r=t.length-1,{fine:o}=gr,i=dr(e);return t.forEach((e,t)=>{0===t&&(n+=o.lt),n+=J,n+=o.l.repeat(e+2),t===r?(n+=J,n+=o.rt):(n+=J,n+=o.ct)}),n+="\n",t.forEach((t,s)=>{n+=J,n+=o.v;const a=e.data[s];if(S(a)||T(a))n+=J,n+=i(" ".repeat(t+2));else{const e=dr(a);let r=a.content?.toString()??"";r=r.replace(/[\n]/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),n+=J,n+=e`\u2002${Me(r,t)}\u2002`}s===r&&(n+=o.v)}),n+="\n",n}(e.header,n)),o+=function(e,t,n){let r="";const o=t.length-1,{fine:i}=gr;return t.forEach((e,t)=>{0===t&&(r+=J,r+=n?i.lc:i.lt),r+=J,r+=i.l.repeat(e+2),t===o?(r+=J,r+=n?i.rc:i.rt):(r+=J,r+=n?i.c:i.ct)}),r+="\n",e.forEach((n,s)=>{const a=dr(n);t.forEach((e,t)=>{r+=J,r+=i.v;const s=n.data[t];if(S(s)||T(s))r+=a`${" ".repeat(e+2)}`;else{const t=dr(s);let n=s.content?.toString()||"";n=n.replace(/[\n]/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),r+=J,r+=t`\u2002${Me(n,e)}\u2002`}t===o&&(r+=J,r+=i.v)}),r+="\n";const c=e.length-1===s;t.forEach((e,t)=>{0===t&&(r+=J,r+=c?i.lb:i.lc),r+=J,r+=i.l.repeat(e+2),t===o?(r+=J,r+=c?i.rb:i.rc):(r+=J,r+=c?i.cb:i.c)}),r+="\n"}),r}(e.body,n,r);const i=oe(o);if(cr){const e=i[0].split("%c"),n=i.map((n,r)=>{if(r>0){const o=[...e[r]].reduce((e,t)=>Re(t)>1?(lr.emojiRegex.lastIndex=0,t.match(lr.emojiRegex)?e-(lr.emojiLength-2):e+(2-lr.chineseLength)):e,0);return n+"font-family: Consolas,Monaco,Courier,'Courier New','等宽字体',monospace; font-size:"+t+"px;word-spacing:normal;padding:0;margin:0;padding-right:"+o*t+"px"}return n});console.log(...n)}else console.log(...i)}const mr=b(function(e){const[t,n]=function(e){S(e)&&(e={}),R(e)&&(e={body:e});const t=new hr;rr(t,e),Object.setPrototypeOf(t,ur);const n=new fr(t);return e.header&&(n.header=ir(e.header,ar(t))),e.body?.forEach(e=>n.body.push(ir(e,t))),[n,t]}(e);let r=12;const o=()=>br(t,r);return Object.setPrototypeOf(o,this),Object.defineProperties(o,{addRow:{value:e=>(t.body.push(ir(e,n)),o),configurable:!1,writable:!1,enumerable:!1},setHeader:{value:e=>(t.header=ir(e,ar(n)),o),configurable:!1,writable:!1,enumerable:!1},setFontSize:{value:e=>(r=e,o)}}),o});async function wr(){const{pkgManager:e}=er,t=`${e} config get registry`;We("执行可写代码",t);const n=await $t(t);if(We("获取当前的本地配置为",n),n.success)return n.data.replace(/\s/gm,"")}async function yr(){const{pkgManager:e}=er,t=Un(),n=await wr(),r=new mr({header:[`${e} registry 源`,"别名","当前可见"]});!(t.findIndex(e=>e.value===n)>-1)&&y(n)&&t.push({value:n,tip:n,label:"曾用值"}),t.forEach(e=>r.addRow([(n===e.value?de`* `:" ").concat(e.value),(n===e.value?de`* `:" ").concat(ue(e.label)),e.disable?"❌":"✅"])),r(),rt(pe`注:当前可见状态仅影响 npx nry 选择项`)}const{npm:vr,yarn:xr}=_n;async function $r(e){const{pkgManager:t}=er,n=[{reg:/\s+/g,info:"不允许出现空格",inverse:!0}];e.forEach(e=>{n.push({reg:new RegExp(`^${A(e.value)}/*$`,"mg"),info:`${ue(e.value)}(${ge(e.label)}) 已存在`,inverse:!0})});const r=await Bn({text:"请输入自定义的源地址",tip:"yarn"===t?xr:vr,minLen:5,maxLen:120,verify:n,required:!1});return We("用户输入的地址",r),S(r)?await Wn():await qn(r)?An(r):(rt(`当前设置 registry 「${Te(r)}」 不可用`),rt("请使用正确的源设置"),await $r(e))}async function kr(){if(!Qn.available)return await Wn("读写受限,正在退出");const{pkgManager:e}=er,t=Un(),n=await $r(t),r=await async function(e){const t=[{reg:/\s+/g,info:"不允许出现空格",inverse:!0}],{pkgManager:n}=er;e.forEach(e=>{t.push({reg:new RegExp(`^${A(e.label)}$`,"mg"),info:`${ue(e.label)}(${ge(e.value)}) 已存在`,inverse:!0})});const r=await Bn({text:`请输入自定义的 ${n} 的别名`,tip:"任意别名",minLen:1,maxLen:120,verify:t,defaultValue:"",required:!1});return We("用户输入的别名为",r),S(r)?await Wn():r}(t);if(tr({value:n,label:r})){rt(pe`当前的 ${e} registry 源列表为`),await yr();const t=["退出","继续添加"],n=await Bn({text:"添加完成,是否持续添加",tip:t});return S(n)||n===t[0]?await Wn(""):await kr()}return await Wn(`写入${be`失败`},原因未知`)}async function Er(e="",t=!0,n=!0){$(e)&&(e=`请选择想使用的新的 ${er.pkgManager} registry 源`);let r=!1;const o=Un(),i=await wr();if(!S(i)){for(const e of o)if(e.value===i){e.label=e.label.toString()+`(${de`当前使用`})`,e.disable=!n,r=!0;break}if(O(r)){const e={value:i,label:"当前使用值",disable:!n};o.push(e),Qn.available&&tr({value:i,label:"曾用值"})}}We("处理完的数据",o);const s=t?o.filter(e=>!e.disable||e.disable&&e.value===i):o.map(e=>(e.value===i?e.disable=!n:e.disable=!1,e)),a=await In({data:s,info:e},"number");return We("用户选择的项",a),S(a)?await Wn():(We("当前用户选择为",s[a]),s[a])}async function Cr(){const e=await Er();await async function(e){const{pkgManager:t}=er,n=An(e.value);if(!await qn(n))return await Wn(`选择的项 「${de(n)}」 不可连接,无法被设置`);const r=`${t} config set registry "${n}"`;We("设置源执行代码",r);(await $t(r)).success||await Wn();rt(`已将 ${t} registry 更改为 ${ue(e.value)}(${he(e.label)})`)}(e)}async function Ir(){if(!Qn.available)return await Wn("当前读写受限,即将退出程序");const e=await Er("请选择要删除的项",!1,!1),{value:t,label:n}=e,r=Un();for(const e in r){const o=Number(e),i=r[o];if(i.value===t&&i.label===n){r.splice(o,1);break}}if(Qn.write(r)){rt("删除项后的列表为:"),await yr();const e=["退出","继续删除"],t=await Bn({text:"是否继续删除其他项",tip:e});return S(t)||t===e[0]?await Wn(""):await Ir()}}async function Or(){if(!Qn.available)return await Wn("当前读写权限不足,即将退出程序");const e=await Er("请选择你想要修改的项",!1),{value:t,label:n}=e;We("获取用户的选择",e),We("原始的值",t),We("原始的标签",n),await async function(e){const{pkgManager:t}=er,n=await Bn({text:`请更改为新的 ${t} registry 值`,tip:e.value,defaultValue:e.value,required:!1});if(We("新值为",n),S(n))return;e.value=e.tip=An(n)}(e),await async function(e){const{pkgManager:t}=er,n=await Bn({text:`请更改为新的 ${t} registry 别名`,tip:e.label,defaultValue:e.label.toString(),required:!1});if(We("新值为",n),S(n))return;e.label=n}(e);const{value:r,label:o}=e;We("更改后的值",r),We("更改的标签",o);const i=Un();for(const e of i)if(e.value===t&&e.label===n){e.value=r,e.label=o.toString();break}if(Qn.write(i)){rt("更改后的列表为:"),await yr();const e=["退出","继续修改"],t=await Bn({text:"是否继续修改其他项",tip:e});return S(t)||t===e[0]?await Wn(""):await Or()}}async function Tr(){return function(){const e=Fn.args,t=e.$map;We("源解析值",e),We("源解析值没有匹配项",e.$isVoid),["add","delete","edit","list","manage","reset","clean"].forEach(e=>Xn[e]=O(S(t[e]))),Xn.noMatch=e.$isVoid,We("解析完的值",Xn)}(),We("解析参数完毕,开始执行",Xn),Xn.noMatch?(We("当前没有匹配值"),await Cr()):Xn.reset?(We("重置项"),await async function(){if(!Qn.available)return await Wn("当前读写权限受限,正在退出程序");const e=["退出","重置"],t=await Bn({text:"请确认是否执行覆盖原数据,该操作无法复原",tip:e});return S(t)||t===e[0]?await Wn("好的,这就退出重置"):Qn.write(Un(!0))?(await kt("写入"+ue`成功`,60),await yr()):await Wn("重置未能完成,原因未知")}()):Xn.list?(We("当前为展示项"),await yr()):Xn.manage?(We("当前执行状态更改"),await async function(){if(!Qn.available)return await Wn("当前读写受限,即将退出程序。");const e=Un(),t=await wr(),n=await In({data:e.map(e=>({...e,checked:!e.disable,disable:e.value===t})),kind:"check"},"number");if(We("交互结果",n),S(n))return await Wn("好的,将退出状态显隐管理");e.forEach((e,t)=>{e.disable=!n.includes(t)}),We("保存前的数据",e),Qn.write(e)&&await yr()}()):Xn.add?(We("添加新的项"),await kr()):Xn.edit?(We("编辑项"),await Or()):Xn.delete?(We("删除项"),await Ir()):Xn.clean?(We("当前执行清理"),Qn.clean()):await Cr()}(async()=>{try{await Tr()}catch(e){We.error("系统级捕获 错误",e),console.log("当前出现未知错误",e)}})();
|
package/package.json
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nry",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "泥豆君",
|
|
7
7
|
"email": "Mr.MudBean@outlook.com",
|
|
8
|
-
"url": "https://
|
|
8
|
+
"url": "https://mudbean.cn"
|
|
9
9
|
},
|
|
10
|
-
"license": "MIT",
|
|
11
10
|
"description": "更替及管理 npm、yarn、pnpm registry",
|
|
11
|
+
"license": "MIT",
|
|
12
12
|
"files": [
|
|
13
13
|
"bin.js",
|
|
14
14
|
"LICENSE",
|
|
15
15
|
"README.md",
|
|
16
|
-
"THIRD-PARTY-LICENSES.txt"
|
|
16
|
+
"THIRD-PARTY-LICENSES.txt",
|
|
17
|
+
"CHANGELOG.md"
|
|
17
18
|
],
|
|
18
19
|
"keywords": [
|
|
19
20
|
"nry",
|
|
20
21
|
"npm",
|
|
21
22
|
"pnpm",
|
|
22
23
|
"yarn",
|
|
23
|
-
"registry"
|
|
24
|
+
"registry",
|
|
25
|
+
"mudbean",
|
|
26
|
+
"vvi"
|
|
24
27
|
],
|
|
25
|
-
"homepage": "https://
|
|
28
|
+
"homepage": "https://npm.lmssee.com/nry",
|
|
26
29
|
"bugs": {
|
|
27
30
|
"url": "https://github.com/MrMudBean/nry/issues",
|
|
28
31
|
"email": "Mr.MudBean@outlook.com"
|
package/THIRD-PARTY-LICENSES.txt
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
THIRD-PARTY LICENSE
|
|
2
|
-
==================================================
|
|
3
|
-
|
|
4
|
-
a-js-tools (2.0.1)
|
|
5
|
-
------------------------------
|
|
6
|
-
# MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) <2024> <Mr.MudBean>
|
|
9
|
-
|
|
10
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
12
|
-
copyright notice and this permission notice appear in all copies.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
15
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
17
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
18
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
19
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
20
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
-
|
|
22
|
-
# MIT 许可证
|
|
23
|
-
|
|
24
|
-
版权所有 (c) [2024] [泥豆君]
|
|
25
|
-
|
|
26
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
27
|
-
|
|
28
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
29
|
-
|
|
30
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|
|
31
|
-
|
|
32
|
-
a-type-of-js (2.0.0)
|
|
33
|
-
------------------------------
|
|
34
|
-
# MIT License
|
|
35
|
-
|
|
36
|
-
Copyright (c) <2025> <Mr.MudBean>
|
|
37
|
-
|
|
38
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
39
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
40
|
-
copyright notice and this permission notice appear in all copies.
|
|
41
|
-
|
|
42
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
43
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
44
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
45
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
46
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
47
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
48
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
49
|
-
|
|
50
|
-
# MIT 许可证
|
|
51
|
-
|
|
52
|
-
版权所有 (c) [2025] [花生亻]
|
|
53
|
-
|
|
54
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
55
|
-
|
|
56
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
57
|
-
|
|
58
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|
|
59
|
-
|
|
60
|
-
@qqi/log (1.0.0)
|
|
61
|
-
------------------------------
|
|
62
|
-
# MIT License
|
|
63
|
-
|
|
64
|
-
Copyright (c) <2025> <Mr.MudBean>
|
|
65
|
-
|
|
66
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
67
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
68
|
-
copyright notice and this permission notice appear in all copies.
|
|
69
|
-
|
|
70
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
71
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
72
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
73
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
74
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
75
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
76
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
77
|
-
|
|
78
|
-
# MIT 许可证
|
|
79
|
-
|
|
80
|
-
版权所有 (c) [2025] [泥豆君]
|
|
81
|
-
|
|
82
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
83
|
-
|
|
84
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
85
|
-
|
|
86
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|
|
87
|
-
|
|
88
|
-
@color-pen/static (1.1.1)
|
|
89
|
-
------------------------------
|
|
90
|
-
# MIT License
|
|
91
|
-
|
|
92
|
-
Copyright (c) <2025> <Mr.MudBean>
|
|
93
|
-
|
|
94
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
95
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
96
|
-
copyright notice and this permission notice appear in all copies.
|
|
97
|
-
|
|
98
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
99
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
100
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
101
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
102
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
103
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
104
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
105
|
-
|
|
106
|
-
# MIT 许可证
|
|
107
|
-
|
|
108
|
-
版权所有 (c) [2025] [泥豆君]
|
|
109
|
-
|
|
110
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
111
|
-
|
|
112
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
113
|
-
|
|
114
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|
|
115
|
-
|
|
116
|
-
color-pen (3.0.0)
|
|
117
|
-
------------------------------
|
|
118
|
-
# MIT License
|
|
119
|
-
|
|
120
|
-
Copyright (c) <2025> <Mr.MudBean>
|
|
121
|
-
|
|
122
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
123
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
124
|
-
copyright notice and this permission notice appear in all copies.
|
|
125
|
-
|
|
126
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
127
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
128
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
129
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
130
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
131
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
132
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
133
|
-
|
|
134
|
-
# MIT 许可证
|
|
135
|
-
|
|
136
|
-
版权所有 (c) [2025] [泥豆君]
|
|
137
|
-
|
|
138
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
139
|
-
|
|
140
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
141
|
-
|
|
142
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|
|
143
|
-
|
|
144
|
-
a-node-tools (4.4.2)
|
|
145
|
-
------------------------------
|
|
146
|
-
# MIT License
|
|
147
|
-
|
|
148
|
-
Copyright (c) <2024> <Mr.MudBean>
|
|
149
|
-
|
|
150
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
151
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
152
|
-
copyright notice and this permission notice appear in all copies.
|
|
153
|
-
|
|
154
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
155
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
156
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
157
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
158
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
159
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
160
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
161
|
-
|
|
162
|
-
# MIT 许可证
|
|
163
|
-
|
|
164
|
-
版权所有 (c) [2024] [泥豆君]
|
|
165
|
-
|
|
166
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
167
|
-
|
|
168
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
169
|
-
|
|
170
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|
|
171
|
-
|
|
172
|
-
a-command (3.0.1)
|
|
173
|
-
------------------------------
|
|
174
|
-
# MIT License
|
|
175
|
-
|
|
176
|
-
Copyright (c) <2024> <MrMudBean>
|
|
177
|
-
|
|
178
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
179
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
180
|
-
copyright notice and this permission notice appear in all copies.
|
|
181
|
-
|
|
182
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
183
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
184
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
185
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
186
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
187
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
188
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
189
|
-
|
|
190
|
-
# MIT 许可证
|
|
191
|
-
|
|
192
|
-
版权所有 (c) [2024] [泥豆君]
|
|
193
|
-
|
|
194
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
195
|
-
|
|
196
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
197
|
-
|
|
198
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|
|
199
|
-
|
|
200
|
-
qqi (1.0.0)
|
|
201
|
-
------------------------------
|
|
202
|
-
# MIT License
|
|
203
|
-
|
|
204
|
-
Copyright (c) <2025> <Mr.MudBean>
|
|
205
|
-
|
|
206
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
207
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
208
|
-
copyright notice and this permission notice appear in all copies.
|
|
209
|
-
|
|
210
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
211
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
212
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
213
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
214
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
215
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
216
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
217
|
-
|
|
218
|
-
# MIT 许可证
|
|
219
|
-
|
|
220
|
-
版权所有 (c) [2025] [泥豆君]
|
|
221
|
-
|
|
222
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
223
|
-
|
|
224
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
225
|
-
|
|
226
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|
|
227
|
-
|
|
228
|
-
colored-table (0.2.0)
|
|
229
|
-
------------------------------
|
|
230
|
-
# MIT License
|
|
231
|
-
|
|
232
|
-
Copyright (c) <2025> <Mr.MudBean>
|
|
233
|
-
|
|
234
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
235
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
236
|
-
copyright notice and this permission notice appear in all copies.
|
|
237
|
-
|
|
238
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
239
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
240
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
241
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
242
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
243
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
244
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
245
|
-
|
|
246
|
-
# MIT 许可证
|
|
247
|
-
|
|
248
|
-
版权所有 (c) [2025] [泥豆君]
|
|
249
|
-
|
|
250
|
-
特此免费授予任何获得本软件及相关文档文件(以下简称“软件”)副本的人不受限制地处置该软件的权利,包括不受限制地使用、复制、修改、合并、发布、分发、再许可和/或出售该软件副本的权利,并允许向其提供该软件的人这样做,但须遵守以下条件:
|
|
251
|
-
|
|
252
|
-
上述版权声明和本许可声明应包含在所有副本或软件的重要部分中。
|
|
253
|
-
|
|
254
|
-
软件按“原样”提供,不附带任何形式的明示或暗示的保证,包括但不限于适销性、特定用途适用性和不侵权的保证。在任何情况下,作者或版权持有人均不对因合同、侵权或其他方式引起的任何索赔、损害或其他责任负责,无论是在与软件或软件的使用或其他交易有关的任何诉讼中。
|