create-young-proj 0.10.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/README.md +6 -0
  2. package/dist/index.mjs +9 -9
  3. package/package.json +1 -1
  4. package/template-nuxt-admin/README.md +42 -1
  5. package/template-nuxt-admin/components/TopUser.vue +4 -4
  6. package/template-nuxt-admin/components/YoungChangePassword.vue +5 -5
  7. package/template-nuxt-admin/components/layout/Main.vue +2 -2
  8. package/template-nuxt-admin/components/layout/NavBar.vue +11 -2
  9. package/template-nuxt-admin/components/layout/SideBar.vue +7 -2
  10. package/template-nuxt-admin/components/layout/SubMenu.vue +9 -2
  11. package/template-nuxt-admin/components/layout/TabsBar.vue +4 -5
  12. package/template-nuxt-admin/composables/api.ts +20 -21
  13. package/template-nuxt-admin/composables/nav.ts +20 -3
  14. package/template-nuxt-admin/composables/tags.ts +29 -1
  15. package/template-nuxt-admin/composables/user.ts +21 -3
  16. package/template-nuxt-admin/middleware/auth.global.ts +26 -7
  17. package/template-nuxt-admin/nuxt.config.ts +5 -1
  18. package/template-nuxt-admin/package.json +1 -1
  19. package/template-nuxt-admin/pages/home/[id].vue +2 -2
  20. package/template-nuxt-admin/pages/index.vue +2 -7
  21. package/template-nuxt-admin/pages/login.vue +5 -3
  22. package/template-nuxt-admin/pages/system/menuList.vue +0 -1
  23. package/template-nuxt-admin/public/bg.webp +0 -0
  24. package/template-nuxt-admin/public/favicon.svg +2 -0
  25. package/template-nuxt-admin/public/logo.svg +2 -0
  26. package/template-nuxt-admin/server/plugins/env.ts +3 -4
  27. package/template-nuxt-admin/utils/tool.ts +62 -70
  28. package/template-nuxt-admin/public/favicon.ico +0 -0
  29. package/template-vue-admin/.vscode/extensions.json +0 -10
  30. package/template-vue-admin/.vscode/list-add.code-snippets +0 -108
  31. package/template-vue-admin/.vscode/list-export.code-snippets +0 -72
  32. package/template-vue-admin/.vscode/list.code-snippets +0 -61
  33. package/template-vue-admin/.vscode/settings.json +0 -7
  34. package/template-vue-admin/Dockerfile +0 -42
  35. package/template-vue-admin/README.md +0 -75
  36. package/template-vue-admin/_env +0 -8
  37. package/template-vue-admin/_gitignore +0 -30
  38. package/template-vue-admin/boot.mjs +0 -16
  39. package/template-vue-admin/build/custom-plugin.ts +0 -57
  40. package/template-vue-admin/build/index.ts +0 -7
  41. package/template-vue-admin/build/plugins.ts +0 -59
  42. package/template-vue-admin/config/.devrc +0 -2
  43. package/template-vue-admin/config/.onlinerc +0 -2
  44. package/template-vue-admin/config/.testrc +0 -2
  45. package/template-vue-admin/index.html +0 -21
  46. package/template-vue-admin/nitro.config.ts +0 -19
  47. package/template-vue-admin/package.json +0 -51
  48. package/template-vue-admin/plugins/init.ts +0 -31
  49. package/template-vue-admin/public/vite.svg +0 -1
  50. package/template-vue-admin/rome.json +0 -26
  51. package/template-vue-admin/routes/api/[...all].ts +0 -49
  52. package/template-vue-admin/routes/get/env.ts +0 -18
  53. package/template-vue-admin/src/App.vue +0 -14
  54. package/template-vue-admin/src/apis/delete.ts +0 -36
  55. package/template-vue-admin/src/apis/get.ts +0 -83
  56. package/template-vue-admin/src/apis/index.ts +0 -10
  57. package/template-vue-admin/src/apis/patch.ts +0 -78
  58. package/template-vue-admin/src/apis/post.ts +0 -76
  59. package/template-vue-admin/src/assets/img/login_background.jpg +0 -0
  60. package/template-vue-admin/src/auto-components.d.ts +0 -38
  61. package/template-vue-admin/src/auto-imports.d.ts +0 -302
  62. package/template-vue-admin/src/layouts/blank.vue +0 -9
  63. package/template-vue-admin/src/layouts/default/components/Link.vue +0 -23
  64. package/template-vue-admin/src/layouts/default/components/Logo.vue +0 -20
  65. package/template-vue-admin/src/layouts/default/components/Menu.vue +0 -54
  66. package/template-vue-admin/src/layouts/default/components/NavSearch.vue +0 -52
  67. package/template-vue-admin/src/layouts/default/components/ScrollPane.vue +0 -79
  68. package/template-vue-admin/src/layouts/default/components/TagsView.vue +0 -137
  69. package/template-vue-admin/src/layouts/default/components/TopMenu.vue +0 -21
  70. package/template-vue-admin/src/layouts/default/components/UserCenter.vue +0 -50
  71. package/template-vue-admin/src/layouts/default/index.vue +0 -95
  72. package/template-vue-admin/src/main.ts +0 -46
  73. package/template-vue-admin/src/modules/1-router.ts +0 -48
  74. package/template-vue-admin/src/modules/2-pinia.ts +0 -10
  75. package/template-vue-admin/src/modules/3-net.ts +0 -79
  76. package/template-vue-admin/src/modules/4-auth.ts +0 -124
  77. package/template-vue-admin/src/modules/5-checkupdate.ts +0 -38
  78. package/template-vue-admin/src/shims.d.ts +0 -12
  79. package/template-vue-admin/src/stores/index.ts +0 -9
  80. package/template-vue-admin/src/stores/local/index.ts +0 -31
  81. package/template-vue-admin/src/stores/session/index.ts +0 -63
  82. package/template-vue-admin/src/stores/tags.ts +0 -109
  83. package/template-vue-admin/src/typings/global.d.ts +0 -70
  84. package/template-vue-admin/src/typings/index.ts +0 -13
  85. package/template-vue-admin/src/typings/system.d.ts +0 -46
  86. package/template-vue-admin/src/views/403.vue +0 -33
  87. package/template-vue-admin/src/views/[...all_404].vue +0 -557
  88. package/template-vue-admin/src/views/base/login.vue +0 -194
  89. package/template-vue-admin/src/views/dashboard/[name].vue +0 -28
  90. package/template-vue-admin/src/views/index.vue +0 -25
  91. package/template-vue-admin/src/views/system/api.vue +0 -160
  92. package/template-vue-admin/src/views/system/hooks/useRole.ts +0 -286
  93. package/template-vue-admin/src/views/system/menuList.vue +0 -194
  94. package/template-vue-admin/src/views/system/role.vue +0 -131
  95. package/template-vue-admin/src/views/system/user.vue +0 -192
  96. package/template-vue-admin/src/vite-env.d.ts +0 -52
  97. package/template-vue-admin/tsconfig.json +0 -21
  98. package/template-vue-admin/tsconfig.node.json +0 -9
  99. package/template-vue-admin/unocss.config.ts +0 -47
  100. package/template-vue-admin/vite.config.ts +0 -32
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # 从现有模板快速创建工程
2
2
 
3
+ ```bash
4
+ npm create young-proj@latest
5
+ yarn create young-proj@latest
6
+ pnpm create young-proj@latest
7
+ ```
8
+
3
9
  🚧 WIP
4
10
 
5
11
  - [x] template-vue-thin
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import T from"node:fs";import C from"node:path";import{fileURLToPath as Ne}from"node:url";import je from"child_process";import lt from"path";import at from"fs";import Fe from"readline";import Ve from"events";var Le=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},U={exports:{}},ht,jt;function Ye(){if(jt)return ht;jt=1,ht=i,i.sync=o;var s=at;function t(n,r){var l=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var c=0;c<l.length;c++){var h=l[c].toLowerCase();if(h&&n.substr(-h.length).toLowerCase()===h)return!0}return!1}function e(n,r,l){return!n.isSymbolicLink()&&!n.isFile()?!1:t(r,l)}function i(n,r,l){s.stat(n,function(c,h){l(c,c?!1:e(h,n,r))})}function o(n,r){return e(s.statSync(n),n,r)}return ht}var ut,Ft;function He(){if(Ft)return ut;Ft=1,ut=t,t.sync=e;var s=at;function t(n,r,l){s.stat(n,function(c,h){l(c,c?!1:i(h,r))})}function e(n,r){return i(s.statSync(n),r)}function i(n,r){return n.isFile()&&o(n,r)}function o(n,r){var l=n.mode,c=n.uid,h=n.gid,$=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),f=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),b=parseInt("010",8),p=parseInt("001",8),S=a|b,E=l&p||l&b&&h===f||l&a&&c===$||l&S&&$===0;return E}return ut}var tt;process.platform==="win32"||Le.TESTING_WINDOWS?tt=Ye():tt=He();var Be=ct;ct.sync=Ue;function ct(s,t,e){if(typeof t=="function"&&(e=t,t={}),!e){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,o){ct(s,t||{},function(n,r){n?o(n):i(r)})})}tt(s,t||{},function(i,o){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,o=!1),e(i,o)})}function Ue(s,t){try{return tt.sync(s,t||{})}catch(e){if(t&&t.ignoreErrors||e.code==="EACCES")return!1;throw e}}const z=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Vt=lt,ze=z?";":":",Lt=Be,Yt=s=>Object.assign(new Error(`not found: ${s}`),{code:"ENOENT"}),Ht=(s,t)=>{const e=t.colon||ze,i=s.match(/\//)||z&&s.match(/\\/)?[""]:[...z?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(e)],o=z?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=z?o.split(e):[""];return z&&s.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:i,pathExt:n,pathExtExe:o}},Bt=(s,t,e)=>{typeof t=="function"&&(e=t,t={}),t||(t={});const{pathEnv:i,pathExt:o,pathExtExe:n}=Ht(s,t),r=[],l=h=>new Promise(($,f)=>{if(h===i.length)return t.all&&r.length?$(r):f(Yt(s));const a=i[h],b=/^".*"$/.test(a)?a.slice(1,-1):a,p=Vt.join(b,s),S=!b&&/^\.[\\\/]/.test(s)?s.slice(0,2)+p:p;$(c(S,h,0))}),c=(h,$,f)=>new Promise((a,b)=>{if(f===o.length)return a(l($+1));const p=o[f];Lt(h+p,{pathExt:n},(S,E)=>{if(!S&&E)if(t.all)r.push(h+p);else return a(h+p);return a(c(h,$,f+1))})});return e?l(0).then(h=>e(null,h),e):l(0)},We=(s,t)=>{t=t||{};const{pathEnv:e,pathExt:i,pathExtExe:o}=Ht(s,t),n=[];for(let r=0;r<e.length;r++){const l=e[r],c=/^".*"$/.test(l)?l.slice(1,-1):l,h=Vt.join(c,s),$=!c&&/^\.[\\\/]/.test(s)?s.slice(0,2)+h:h;for(let f=0;f<i.length;f++){const a=$+i[f];try{if(Lt.sync(a,{pathExt:o}))if(t.all)n.push(a);else return a}catch{}}}if(t.all&&n.length)return n;if(t.nothrow)return null;throw Yt(s)};var Ge=Bt;Bt.sync=We;var dt={exports:{}};const Ut=(s={})=>{const t=s.env||process.env;return(s.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};dt.exports=Ut,dt.exports.default=Ut;const zt=lt,Je=Ge,Ke=dt.exports;function Wt(s,t){const e=s.options.env||process.env,i=process.cwd(),o=s.options.cwd!=null,n=o&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(s.options.cwd)}catch{}let r;try{r=Je.sync(s.command,{path:e[Ke({env:e})],pathExt:t?zt.delimiter:void 0})}catch{}finally{n&&process.chdir(i)}return r&&(r=zt.resolve(o?s.options.cwd:"",r)),r}function qe(s){return Wt(s)||Wt(s,!0)}var Ze=qe,ft={};const pt=/([()\][%!^"`<>&|;, *?])/g;function Xe(s){return s=s.replace(pt,"^$1"),s}function Qe(s,t){return s=`${s}`,s=s.replace(/(\\*)"/g,'$1$1\\"'),s=s.replace(/(\\*)$/,"$1$1"),s=`"${s}"`,s=s.replace(pt,"^$1"),t&&(s=s.replace(pt,"^$1")),s}ft.command=Xe,ft.argument=Qe;var ts=/^#!(.*)/;const es=ts;var ss=(s="")=>{const t=s.match(es);if(!t)return null;const[e,i]=t[0].replace(/#! ?/,"").split(" "),o=e.split("/").pop();return o==="env"?i:i?`${o} ${i}`:o};const mt=at,is=ss;function rs(s){const e=Buffer.alloc(150);let i;try{i=mt.openSync(s,"r"),mt.readSync(i,e,0,150,0),mt.closeSync(i)}catch{}return is(e.toString())}var ns=rs;const os=lt,Gt=Ze,Jt=ft,ls=ns,as=process.platform==="win32",hs=/\.(?:com|exe)$/i,us=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cs(s){s.file=Gt(s);const t=s.file&&ls(s.file);return t?(s.args.unshift(s.file),s.command=t,Gt(s)):s.file}function ds(s){if(!as)return s;const t=cs(s),e=!hs.test(t);if(s.options.forceShell||e){const i=us.test(t);s.command=os.normalize(s.command),s.command=Jt.command(s.command),s.args=s.args.map(n=>Jt.argument(n,i));const o=[s.command].concat(s.args).join(" ");s.args=["/d","/s","/c",`"${o}"`],s.command=process.env.comspec||"cmd.exe",s.options.windowsVerbatimArguments=!0}return s}function fs(s,t,e){t&&!Array.isArray(t)&&(e=t,t=null),t=t?t.slice(0):[],e=Object.assign({},e);const i={command:s,args:t,options:e,file:void 0,original:{command:s,args:t}};return e.shell?i:ds(i)}var ps=fs;const gt=process.platform==="win32";function vt(s,t){return Object.assign(new Error(`${t} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${s.command}`,path:s.command,spawnargs:s.args})}function ms(s,t){if(!gt)return;const e=s.emit;s.emit=function(i,o){if(i==="exit"){const n=Kt(o,t);if(n)return e.call(s,"error",n)}return e.apply(s,arguments)}}function Kt(s,t){return gt&&s===1&&!t.file?vt(t.original,"spawn"):null}function gs(s,t){return gt&&s===1&&!t.file?vt(t.original,"spawnSync"):null}var vs={hookChildProcess:ms,verifyENOENT:Kt,verifyENOENTSync:gs,notFoundError:vt};const qt=je,bt=ps,wt=vs;function Zt(s,t,e){const i=bt(s,t,e),o=qt.spawn(i.command,i.args,i.options);return wt.hookChildProcess(o,i),o}function bs(s,t,e){const i=bt(s,t,e),o=qt.spawnSync(i.command,i.args,i.options);return o.error=o.error||wt.verifyENOENTSync(o.status,i),o}U.exports=Zt,U.exports.spawn=Zt,U.exports.sync=bs,U.exports._parse=bt,U.exports._enoent=wt;var ws=function(s,t){t||(t={});var e={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(e.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?e.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(u){e.bools[u]=!0});var i={};Object.keys(t.alias||{}).forEach(function(u){i[u]=[].concat(t.alias[u]),i[u].forEach(function(w){i[w]=[u].concat(i[u].filter(function(O){return w!==O}))})}),[].concat(t.string).filter(Boolean).forEach(function(u){e.strings[u]=!0,i[u]&&(e.strings[i[u]]=!0)});var o=t.default||{},n={_:[]};Object.keys(e.bools).forEach(function(u){c(u,o[u]===void 0?!1:o[u])});var r=[];s.indexOf("--")!==-1&&(r=s.slice(s.indexOf("--")+1),s=s.slice(0,s.indexOf("--")));function l(u,w){return e.allBools&&/^--[^=]+$/.test(w)||e.strings[u]||e.bools[u]||i[u]}function c(u,w,O){if(!(O&&e.unknownFn&&!l(u,O)&&e.unknownFn(O)===!1)){var g=!e.strings[u]&&Xt(w)?Number(w):w;h(n,u.split("."),g),(i[u]||[]).forEach(function(K){h(n,K.split("."),g)})}}function h(u,w,O){for(var g=u,K=0;K<w.length-1;K++){var x=w[K];if(Qt(g,x))return;g[x]===void 0&&(g[x]={}),(g[x]===Object.prototype||g[x]===Number.prototype||g[x]===String.prototype)&&(g[x]={}),g[x]===Array.prototype&&(g[x]=[]),g=g[x]}var x=w[w.length-1];Qt(g,x)||((g===Object.prototype||g===Number.prototype||g===String.prototype)&&(g={}),g===Array.prototype&&(g=[]),g[x]===void 0||e.bools[x]||typeof g[x]=="boolean"?g[x]=O:Array.isArray(g[x])?g[x].push(O):g[x]=[g[x],O])}function $(u){return i[u].some(function(w){return e.bools[w]})}for(var f=0;f<s.length;f++){var a=s[f];if(/^--.+=/.test(a)){var b=a.match(/^--([^=]+)=([\s\S]*)$/),p=b[1],S=b[2];e.bools[p]&&(S=S!=="false"),c(p,S,a)}else if(/^--no-.+/.test(a)){var p=a.match(/^--no-(.+)/)[1];c(p,!1,a)}else if(/^--.+/.test(a)){var p=a.match(/^--(.+)/)[1],E=s[f+1];E!==void 0&&!/^-/.test(E)&&!e.bools[p]&&!e.allBools&&(i[p]?!$(p):!0)?(c(p,E,a),f++):/^(true|false)$/.test(E)?(c(p,E==="true",a),f++):c(p,e.strings[p]?"":!0,a)}else if(/^-[^-]+/.test(a)){for(var P=a.slice(1,-1).split(""),Y=!1,d=0;d<P.length;d++){var E=a.slice(d+2);if(E==="-"){c(P[d],E,a);continue}if(/[A-Za-z]/.test(P[d])&&/=/.test(E)){c(P[d],E.split("=")[1],a),Y=!0;break}if(/[A-Za-z]/.test(P[d])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(E)){c(P[d],E,a),Y=!0;break}if(P[d+1]&&P[d+1].match(/\W/)){c(P[d],a.slice(d+2),a),Y=!0;break}else c(P[d],e.strings[P[d]]?"":!0,a)}var p=a.slice(-1)[0];!Y&&p!=="-"&&(s[f+1]&&!/^(-|--)[^-]/.test(s[f+1])&&!e.bools[p]&&(i[p]?!$(p):!0)?(c(p,s[f+1],a),f++):s[f+1]&&/^(true|false)$/.test(s[f+1])?(c(p,s[f+1]==="true",a),f++):c(p,e.strings[p]?"":!0,a))}else if((!e.unknownFn||e.unknownFn(a)!==!1)&&n._.push(e.strings._||!Xt(a)?a:Number(a)),t.stopEarly){n._.push.apply(n._,s.slice(f+1));break}}return Object.keys(o).forEach(function(u){ys(n,u.split("."))||(h(n,u.split("."),o[u]),(i[u]||[]).forEach(function(w){h(n,w.split("."),o[u])}))}),t["--"]?(n["--"]=new Array,r.forEach(function(u){n["--"].push(u)})):r.forEach(function(u){n._.push(u)}),n};function ys(s,t){var e=s;t.slice(0,-1).forEach(function(o){e=e[o]||{}});var i=t[t.length-1];return i in e}function Xt(s){return typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function Qt(s,t){return t==="constructor"&&typeof s[t]=="function"||t==="__proto__"}var te={};const{FORCE_COLOR:$s,NODE_DISABLE_COLORS:xs,TERM:Ss}=process.env,m={enabled:!xs&&Ss!=="dumb"&&$s!=="0",reset:v(0,0),bold:v(1,22),dim:v(2,22),italic:v(3,23),underline:v(4,24),inverse:v(7,27),hidden:v(8,28),strikethrough:v(9,29),black:v(30,39),red:v(31,39),green:v(32,39),yellow:v(33,39),blue:v(34,39),magenta:v(35,39),cyan:v(36,39),white:v(37,39),gray:v(90,39),grey:v(90,39),bgBlack:v(40,49),bgRed:v(41,49),bgGreen:v(42,49),bgYellow:v(43,49),bgBlue:v(44,49),bgMagenta:v(45,49),bgCyan:v(46,49),bgWhite:v(47,49)};function ee(s,t){let e=0,i,o="",n="";for(;e<s.length;e++)i=s[e],o+=i.open,n+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return o+t+n}function Es(s,t){let e={has:s,keys:t};return e.reset=m.reset.bind(e),e.bold=m.bold.bind(e),e.dim=m.dim.bind(e),e.italic=m.italic.bind(e),e.underline=m.underline.bind(e),e.inverse=m.inverse.bind(e),e.hidden=m.hidden.bind(e),e.strikethrough=m.strikethrough.bind(e),e.black=m.black.bind(e),e.red=m.red.bind(e),e.green=m.green.bind(e),e.yellow=m.yellow.bind(e),e.blue=m.blue.bind(e),e.magenta=m.magenta.bind(e),e.cyan=m.cyan.bind(e),e.white=m.white.bind(e),e.gray=m.gray.bind(e),e.grey=m.grey.bind(e),e.bgBlack=m.bgBlack.bind(e),e.bgRed=m.bgRed.bind(e),e.bgGreen=m.bgGreen.bind(e),e.bgYellow=m.bgYellow.bind(e),e.bgBlue=m.bgBlue.bind(e),e.bgMagenta=m.bgMagenta.bind(e),e.bgCyan=m.bgCyan.bind(e),e.bgWhite=m.bgWhite.bind(e),e}function v(s,t){let e={open:`\x1B[${s}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(s)||(this.has.push(s),this.keys.push(e)),i===void 0?this:m.enabled?ee(this.keys,i+""):i+""):i===void 0?Es([s],[e]):m.enabled?ee([e],i+""):i+""}}var M=m,Ts=(s,t)=>{if(!(s.meta&&s.name!=="escape")){if(s.ctrl){if(s.name==="a")return"first";if(s.name==="c"||s.name==="d")return"abort";if(s.name==="e")return"last";if(s.name==="g")return"reset"}if(t){if(s.name==="j")return"down";if(s.name==="k")return"up"}return s.name==="return"||s.name==="enter"?"submit":s.name==="backspace"?"delete":s.name==="delete"?"deleteForward":s.name==="abort"?"abort":s.name==="escape"?"exit":s.name==="tab"?"next":s.name==="pagedown"?"nextPage":s.name==="pageup"?"prevPage":s.name==="home"?"home":s.name==="end"?"end":s.name==="up"?"up":s.name==="down"?"down":s.name==="right"?"right":s.name==="left"?"left":!1}},yt=s=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),e=new RegExp(t,"g");return typeof s=="string"?s.replace(e,""):s};const $t="\x1B",y=`${$t}[`,Ps="\x07",xt={to(s,t){return t?`${y}${t+1};${s+1}H`:`${y}${s+1}G`},move(s,t){let e="";return s<0?e+=`${y}${-s}D`:s>0&&(e+=`${y}${s}C`),t<0?e+=`${y}${-t}A`:t>0&&(e+=`${y}${t}B`),e},up:(s=1)=>`${y}${s}A`,down:(s=1)=>`${y}${s}B`,forward:(s=1)=>`${y}${s}C`,backward:(s=1)=>`${y}${s}D`,nextLine:(s=1)=>`${y}E`.repeat(s),prevLine:(s=1)=>`${y}F`.repeat(s),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${$t}7`,restore:`${$t}8`},Os={up:(s=1)=>`${y}S`.repeat(s),down:(s=1)=>`${y}T`.repeat(s)},Cs={screen:`${y}2J`,up:(s=1)=>`${y}1J`.repeat(s),down:(s=1)=>`${y}J`.repeat(s),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(s){let t="";for(let e=0;e<s;e++)t+=this.line+(e<s-1?xt.up():"");return s&&(t+=xt.left),t}};var D={cursor:xt,scroll:Os,erase:Cs,beep:Ps};const Ms=yt,{erase:se,cursor:Ds}=D,_s=s=>[...Ms(s)].length;var Is=function(s,t){if(!t)return se.line+Ds.to(0);let e=0;const i=s.split(/\r?\n/);for(let o of i)e+=1+Math.floor(Math.max(_s(o)-1,0)/t);return se.lines(e)};const q={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},As={arrowUp:q.arrowUp,arrowDown:q.arrowDown,arrowLeft:q.arrowLeft,arrowRight:q.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Rs=process.platform==="win32"?As:q;var ie=Rs;const W=M,H=ie,St=Object.freeze({password:{scale:1,render:s=>"*".repeat(s.length)},emoji:{scale:2,render:s=>"\u{1F603}".repeat(s.length)},invisible:{scale:0,render:s=>""},default:{scale:1,render:s=>`${s}`}}),ks=s=>St[s]||St.default,Z=Object.freeze({aborted:W.red(H.cross),done:W.green(H.tick),exited:W.yellow(H.cross),default:W.cyan("?")}),Ns=(s,t,e)=>t?Z.aborted:e?Z.exited:s?Z.done:Z.default,js=s=>W.gray(s?H.ellipsis:H.pointerSmall),Fs=(s,t)=>W.gray(s?t?H.pointerSmall:"+":H.line);var Vs={styles:St,render:ks,symbols:Z,symbol:Ns,delimiter:js,item:Fs};const Ls=yt;var Ys=function(s,t){let e=String(Ls(s)||"").split(/\r?\n/);return t?e.map(i=>Math.ceil(i.length/t)).reduce((i,o)=>i+o):e.length},Hs=(s,t={})=>{const e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(s||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((n,r)=>(r.length+e.length>=i||n[n.length-1].length+r.length+1<i?n[n.length-1]+=` ${r}`:n.push(`${e}${r}`),n),[e]).join(`
1
+ import T from"node:fs";import C from"node:path";import{fileURLToPath as Ne}from"node:url";import je from"child_process";import lt from"path";import at from"fs";import Fe from"readline";import Le from"events";var Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},U={exports:{}},ht,jt;function Ye(){if(jt)return ht;jt=1,ht=i,i.sync=o;var s=at;function t(n,r){var l=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var c=0;c<l.length;c++){var h=l[c].toLowerCase();if(h&&n.substr(-h.length).toLowerCase()===h)return!0}return!1}function e(n,r,l){return!n.isSymbolicLink()&&!n.isFile()?!1:t(r,l)}function i(n,r,l){s.stat(n,function(c,h){l(c,c?!1:e(h,n,r))})}function o(n,r){return e(s.statSync(n),n,r)}return ht}var ut,Ft;function He(){if(Ft)return ut;Ft=1,ut=t,t.sync=e;var s=at;function t(n,r,l){s.stat(n,function(c,h){l(c,c?!1:i(h,r))})}function e(n,r){return i(s.statSync(n),r)}function i(n,r){return n.isFile()&&o(n,r)}function o(n,r){var l=n.mode,c=n.uid,h=n.gid,$=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),f=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),a=parseInt("100",8),b=parseInt("010",8),p=parseInt("001",8),S=a|b,E=l&p||l&b&&h===f||l&a&&c===$||l&S&&$===0;return E}return ut}var tt;process.platform==="win32"||Ve.TESTING_WINDOWS?tt=Ye():tt=He();var Be=ct;ct.sync=Ue;function ct(s,t,e){if(typeof t=="function"&&(e=t,t={}),!e){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,o){ct(s,t||{},function(n,r){n?o(n):i(r)})})}tt(s,t||{},function(i,o){i&&(i.code==="EACCES"||t&&t.ignoreErrors)&&(i=null,o=!1),e(i,o)})}function Ue(s,t){try{return tt.sync(s,t||{})}catch(e){if(t&&t.ignoreErrors||e.code==="EACCES")return!1;throw e}}const z=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Lt=lt,ze=z?";":":",Vt=Be,Yt=s=>Object.assign(new Error(`not found: ${s}`),{code:"ENOENT"}),Ht=(s,t)=>{const e=t.colon||ze,i=s.match(/\//)||z&&s.match(/\\/)?[""]:[...z?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(e)],o=z?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=z?o.split(e):[""];return z&&s.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:i,pathExt:n,pathExtExe:o}},Bt=(s,t,e)=>{typeof t=="function"&&(e=t,t={}),t||(t={});const{pathEnv:i,pathExt:o,pathExtExe:n}=Ht(s,t),r=[],l=h=>new Promise(($,f)=>{if(h===i.length)return t.all&&r.length?$(r):f(Yt(s));const a=i[h],b=/^".*"$/.test(a)?a.slice(1,-1):a,p=Lt.join(b,s),S=!b&&/^\.[\\\/]/.test(s)?s.slice(0,2)+p:p;$(c(S,h,0))}),c=(h,$,f)=>new Promise((a,b)=>{if(f===o.length)return a(l($+1));const p=o[f];Vt(h+p,{pathExt:n},(S,E)=>{if(!S&&E)if(t.all)r.push(h+p);else return a(h+p);return a(c(h,$,f+1))})});return e?l(0).then(h=>e(null,h),e):l(0)},We=(s,t)=>{t=t||{};const{pathEnv:e,pathExt:i,pathExtExe:o}=Ht(s,t),n=[];for(let r=0;r<e.length;r++){const l=e[r],c=/^".*"$/.test(l)?l.slice(1,-1):l,h=Lt.join(c,s),$=!c&&/^\.[\\\/]/.test(s)?s.slice(0,2)+h:h;for(let f=0;f<i.length;f++){const a=$+i[f];try{if(Vt.sync(a,{pathExt:o}))if(t.all)n.push(a);else return a}catch{}}}if(t.all&&n.length)return n;if(t.nothrow)return null;throw Yt(s)};var Ge=Bt;Bt.sync=We;var dt={exports:{}};const Ut=(s={})=>{const t=s.env||process.env;return(s.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};dt.exports=Ut,dt.exports.default=Ut;const zt=lt,Je=Ge,Ke=dt.exports;function Wt(s,t){const e=s.options.env||process.env,i=process.cwd(),o=s.options.cwd!=null,n=o&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(s.options.cwd)}catch{}let r;try{r=Je.sync(s.command,{path:e[Ke({env:e})],pathExt:t?zt.delimiter:void 0})}catch{}finally{n&&process.chdir(i)}return r&&(r=zt.resolve(o?s.options.cwd:"",r)),r}function qe(s){return Wt(s)||Wt(s,!0)}var Ze=qe,ft={};const pt=/([()\][%!^"`<>&|;, *?])/g;function Xe(s){return s=s.replace(pt,"^$1"),s}function Qe(s,t){return s=`${s}`,s=s.replace(/(\\*)"/g,'$1$1\\"'),s=s.replace(/(\\*)$/,"$1$1"),s=`"${s}"`,s=s.replace(pt,"^$1"),t&&(s=s.replace(pt,"^$1")),s}ft.command=Xe,ft.argument=Qe;var ts=/^#!(.*)/;const es=ts;var ss=(s="")=>{const t=s.match(es);if(!t)return null;const[e,i]=t[0].replace(/#! ?/,"").split(" "),o=e.split("/").pop();return o==="env"?i:i?`${o} ${i}`:o};const mt=at,is=ss;function rs(s){const e=Buffer.alloc(150);let i;try{i=mt.openSync(s,"r"),mt.readSync(i,e,0,150,0),mt.closeSync(i)}catch{}return is(e.toString())}var ns=rs;const os=lt,Gt=Ze,Jt=ft,ls=ns,as=process.platform==="win32",hs=/\.(?:com|exe)$/i,us=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cs(s){s.file=Gt(s);const t=s.file&&ls(s.file);return t?(s.args.unshift(s.file),s.command=t,Gt(s)):s.file}function ds(s){if(!as)return s;const t=cs(s),e=!hs.test(t);if(s.options.forceShell||e){const i=us.test(t);s.command=os.normalize(s.command),s.command=Jt.command(s.command),s.args=s.args.map(n=>Jt.argument(n,i));const o=[s.command].concat(s.args).join(" ");s.args=["/d","/s","/c",`"${o}"`],s.command=process.env.comspec||"cmd.exe",s.options.windowsVerbatimArguments=!0}return s}function fs(s,t,e){t&&!Array.isArray(t)&&(e=t,t=null),t=t?t.slice(0):[],e=Object.assign({},e);const i={command:s,args:t,options:e,file:void 0,original:{command:s,args:t}};return e.shell?i:ds(i)}var ps=fs;const gt=process.platform==="win32";function vt(s,t){return Object.assign(new Error(`${t} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${s.command}`,path:s.command,spawnargs:s.args})}function ms(s,t){if(!gt)return;const e=s.emit;s.emit=function(i,o){if(i==="exit"){const n=Kt(o,t);if(n)return e.call(s,"error",n)}return e.apply(s,arguments)}}function Kt(s,t){return gt&&s===1&&!t.file?vt(t.original,"spawn"):null}function gs(s,t){return gt&&s===1&&!t.file?vt(t.original,"spawnSync"):null}var vs={hookChildProcess:ms,verifyENOENT:Kt,verifyENOENTSync:gs,notFoundError:vt};const qt=je,bt=ps,wt=vs;function Zt(s,t,e){const i=bt(s,t,e),o=qt.spawn(i.command,i.args,i.options);return wt.hookChildProcess(o,i),o}function bs(s,t,e){const i=bt(s,t,e),o=qt.spawnSync(i.command,i.args,i.options);return o.error=o.error||wt.verifyENOENTSync(o.status,i),o}U.exports=Zt,U.exports.spawn=Zt,U.exports.sync=bs,U.exports._parse=bt,U.exports._enoent=wt;var ws=function(s,t){t||(t={});var e={bools:{},strings:{},unknownFn:null};typeof t.unknown=="function"&&(e.unknownFn=t.unknown),typeof t.boolean=="boolean"&&t.boolean?e.allBools=!0:[].concat(t.boolean).filter(Boolean).forEach(function(u){e.bools[u]=!0});var i={};Object.keys(t.alias||{}).forEach(function(u){i[u]=[].concat(t.alias[u]),i[u].forEach(function(w){i[w]=[u].concat(i[u].filter(function(P){return w!==P}))})}),[].concat(t.string).filter(Boolean).forEach(function(u){e.strings[u]=!0,i[u]&&(e.strings[i[u]]=!0)});var o=t.default||{},n={_:[]};Object.keys(e.bools).forEach(function(u){c(u,o[u]===void 0?!1:o[u])});var r=[];s.indexOf("--")!==-1&&(r=s.slice(s.indexOf("--")+1),s=s.slice(0,s.indexOf("--")));function l(u,w){return e.allBools&&/^--[^=]+$/.test(w)||e.strings[u]||e.bools[u]||i[u]}function c(u,w,P){if(!(P&&e.unknownFn&&!l(u,P)&&e.unknownFn(P)===!1)){var g=!e.strings[u]&&Xt(w)?Number(w):w;h(n,u.split("."),g),(i[u]||[]).forEach(function(K){h(n,K.split("."),g)})}}function h(u,w,P){for(var g=u,K=0;K<w.length-1;K++){var x=w[K];if(Qt(g,x))return;g[x]===void 0&&(g[x]={}),(g[x]===Object.prototype||g[x]===Number.prototype||g[x]===String.prototype)&&(g[x]={}),g[x]===Array.prototype&&(g[x]=[]),g=g[x]}var x=w[w.length-1];Qt(g,x)||((g===Object.prototype||g===Number.prototype||g===String.prototype)&&(g={}),g===Array.prototype&&(g=[]),g[x]===void 0||e.bools[x]||typeof g[x]=="boolean"?g[x]=P:Array.isArray(g[x])?g[x].push(P):g[x]=[g[x],P])}function $(u){return i[u].some(function(w){return e.bools[w]})}for(var f=0;f<s.length;f++){var a=s[f];if(/^--.+=/.test(a)){var b=a.match(/^--([^=]+)=([\s\S]*)$/),p=b[1],S=b[2];e.bools[p]&&(S=S!=="false"),c(p,S,a)}else if(/^--no-.+/.test(a)){var p=a.match(/^--no-(.+)/)[1];c(p,!1,a)}else if(/^--.+/.test(a)){var p=a.match(/^--(.+)/)[1],E=s[f+1];E!==void 0&&!/^-/.test(E)&&!e.bools[p]&&!e.allBools&&(i[p]?!$(p):!0)?(c(p,E,a),f++):/^(true|false)$/.test(E)?(c(p,E==="true",a),f++):c(p,e.strings[p]?"":!0,a)}else if(/^-[^-]+/.test(a)){for(var O=a.slice(1,-1).split(""),V=!1,d=0;d<O.length;d++){var E=a.slice(d+2);if(E==="-"){c(O[d],E,a);continue}if(/[A-Za-z]/.test(O[d])&&/=/.test(E)){c(O[d],E.split("=")[1],a),V=!0;break}if(/[A-Za-z]/.test(O[d])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(E)){c(O[d],E,a),V=!0;break}if(O[d+1]&&O[d+1].match(/\W/)){c(O[d],a.slice(d+2),a),V=!0;break}else c(O[d],e.strings[O[d]]?"":!0,a)}var p=a.slice(-1)[0];!V&&p!=="-"&&(s[f+1]&&!/^(-|--)[^-]/.test(s[f+1])&&!e.bools[p]&&(i[p]?!$(p):!0)?(c(p,s[f+1],a),f++):s[f+1]&&/^(true|false)$/.test(s[f+1])?(c(p,s[f+1]==="true",a),f++):c(p,e.strings[p]?"":!0,a))}else if((!e.unknownFn||e.unknownFn(a)!==!1)&&n._.push(e.strings._||!Xt(a)?a:Number(a)),t.stopEarly){n._.push.apply(n._,s.slice(f+1));break}}return Object.keys(o).forEach(function(u){ys(n,u.split("."))||(h(n,u.split("."),o[u]),(i[u]||[]).forEach(function(w){h(n,w.split("."),o[u])}))}),t["--"]?(n["--"]=new Array,r.forEach(function(u){n["--"].push(u)})):r.forEach(function(u){n._.push(u)}),n};function ys(s,t){var e=s;t.slice(0,-1).forEach(function(o){e=e[o]||{}});var i=t[t.length-1];return i in e}function Xt(s){return typeof s=="number"||/^0x[0-9a-f]+$/i.test(s)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s)}function Qt(s,t){return t==="constructor"&&typeof s[t]=="function"||t==="__proto__"}var te={};const{FORCE_COLOR:$s,NODE_DISABLE_COLORS:xs,TERM:Ss}=process.env,m={enabled:!xs&&Ss!=="dumb"&&$s!=="0",reset:v(0,0),bold:v(1,22),dim:v(2,22),italic:v(3,23),underline:v(4,24),inverse:v(7,27),hidden:v(8,28),strikethrough:v(9,29),black:v(30,39),red:v(31,39),green:v(32,39),yellow:v(33,39),blue:v(34,39),magenta:v(35,39),cyan:v(36,39),white:v(37,39),gray:v(90,39),grey:v(90,39),bgBlack:v(40,49),bgRed:v(41,49),bgGreen:v(42,49),bgYellow:v(43,49),bgBlue:v(44,49),bgMagenta:v(45,49),bgCyan:v(46,49),bgWhite:v(47,49)};function ee(s,t){let e=0,i,o="",n="";for(;e<s.length;e++)i=s[e],o+=i.open,n+=i.close,t.includes(i.close)&&(t=t.replace(i.rgx,i.close+i.open));return o+t+n}function Es(s,t){let e={has:s,keys:t};return e.reset=m.reset.bind(e),e.bold=m.bold.bind(e),e.dim=m.dim.bind(e),e.italic=m.italic.bind(e),e.underline=m.underline.bind(e),e.inverse=m.inverse.bind(e),e.hidden=m.hidden.bind(e),e.strikethrough=m.strikethrough.bind(e),e.black=m.black.bind(e),e.red=m.red.bind(e),e.green=m.green.bind(e),e.yellow=m.yellow.bind(e),e.blue=m.blue.bind(e),e.magenta=m.magenta.bind(e),e.cyan=m.cyan.bind(e),e.white=m.white.bind(e),e.gray=m.gray.bind(e),e.grey=m.grey.bind(e),e.bgBlack=m.bgBlack.bind(e),e.bgRed=m.bgRed.bind(e),e.bgGreen=m.bgGreen.bind(e),e.bgYellow=m.bgYellow.bind(e),e.bgBlue=m.bgBlue.bind(e),e.bgMagenta=m.bgMagenta.bind(e),e.bgCyan=m.bgCyan.bind(e),e.bgWhite=m.bgWhite.bind(e),e}function v(s,t){let e={open:`\x1B[${s}m`,close:`\x1B[${t}m`,rgx:new RegExp(`\\x1b\\[${t}m`,"g")};return function(i){return this!==void 0&&this.has!==void 0?(this.has.includes(s)||(this.has.push(s),this.keys.push(e)),i===void 0?this:m.enabled?ee(this.keys,i+""):i+""):i===void 0?Es([s],[e]):m.enabled?ee([e],i+""):i+""}}var M=m,Ts=(s,t)=>{if(!(s.meta&&s.name!=="escape")){if(s.ctrl){if(s.name==="a")return"first";if(s.name==="c"||s.name==="d")return"abort";if(s.name==="e")return"last";if(s.name==="g")return"reset"}if(t){if(s.name==="j")return"down";if(s.name==="k")return"up"}return s.name==="return"||s.name==="enter"?"submit":s.name==="backspace"?"delete":s.name==="delete"?"deleteForward":s.name==="abort"?"abort":s.name==="escape"?"exit":s.name==="tab"?"next":s.name==="pagedown"?"nextPage":s.name==="pageup"?"prevPage":s.name==="home"?"home":s.name==="end"?"end":s.name==="up"?"up":s.name==="down"?"down":s.name==="right"?"right":s.name==="left"?"left":!1}},yt=s=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),e=new RegExp(t,"g");return typeof s=="string"?s.replace(e,""):s};const $t="\x1B",y=`${$t}[`,Os="\x07",xt={to(s,t){return t?`${y}${t+1};${s+1}H`:`${y}${s+1}G`},move(s,t){let e="";return s<0?e+=`${y}${-s}D`:s>0&&(e+=`${y}${s}C`),t<0?e+=`${y}${-t}A`:t>0&&(e+=`${y}${t}B`),e},up:(s=1)=>`${y}${s}A`,down:(s=1)=>`${y}${s}B`,forward:(s=1)=>`${y}${s}C`,backward:(s=1)=>`${y}${s}D`,nextLine:(s=1)=>`${y}E`.repeat(s),prevLine:(s=1)=>`${y}F`.repeat(s),left:`${y}G`,hide:`${y}?25l`,show:`${y}?25h`,save:`${$t}7`,restore:`${$t}8`},Ps={up:(s=1)=>`${y}S`.repeat(s),down:(s=1)=>`${y}T`.repeat(s)},Cs={screen:`${y}2J`,up:(s=1)=>`${y}1J`.repeat(s),down:(s=1)=>`${y}J`.repeat(s),line:`${y}2K`,lineEnd:`${y}K`,lineStart:`${y}1K`,lines(s){let t="";for(let e=0;e<s;e++)t+=this.line+(e<s-1?xt.up():"");return s&&(t+=xt.left),t}};var D={cursor:xt,scroll:Ps,erase:Cs,beep:Os};const Ms=yt,{erase:se,cursor:Ds}=D,_s=s=>[...Ms(s)].length;var Is=function(s,t){if(!t)return se.line+Ds.to(0);let e=0;const i=s.split(/\r?\n/);for(let o of i)e+=1+Math.floor(Math.max(_s(o)-1,0)/t);return se.lines(e)};const q={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},As={arrowUp:q.arrowUp,arrowDown:q.arrowDown,arrowLeft:q.arrowLeft,arrowRight:q.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"},Rs=process.platform==="win32"?As:q;var ie=Rs;const W=M,Y=ie,St=Object.freeze({password:{scale:1,render:s=>"*".repeat(s.length)},emoji:{scale:2,render:s=>"\u{1F603}".repeat(s.length)},invisible:{scale:0,render:s=>""},default:{scale:1,render:s=>`${s}`}}),ks=s=>St[s]||St.default,Z=Object.freeze({aborted:W.red(Y.cross),done:W.green(Y.tick),exited:W.yellow(Y.cross),default:W.cyan("?")}),Ns=(s,t,e)=>t?Z.aborted:e?Z.exited:s?Z.done:Z.default,js=s=>W.gray(s?Y.ellipsis:Y.pointerSmall),Fs=(s,t)=>W.gray(s?t?Y.pointerSmall:"+":Y.line);var Ls={styles:St,render:ks,symbols:Z,symbol:Ns,delimiter:js,item:Fs};const Vs=yt;var Ys=function(s,t){let e=String(Vs(s)||"").split(/\r?\n/);return t?e.map(i=>Math.ceil(i.length/t)).reduce((i,o)=>i+o):e.length},Hs=(s,t={})=>{const e=Number.isSafeInteger(parseInt(t.margin))?new Array(parseInt(t.margin)).fill(" ").join(""):t.margin||"",i=t.width;return(s||"").split(/\r?\n/g).map(o=>o.split(/\s+/g).reduce((n,r)=>(r.length+e.length>=i||n[n.length-1].length+r.length+1<i?n[n.length-1]+=` ${r}`:n.push(`${e}${r}`),n),[e]).join(`
2
2
  `)).join(`
3
- `)},Bs=(s,t,e)=>{e=e||t;let i=Math.min(t-e,s-Math.floor(e/2));i<0&&(i=0);let o=Math.min(i+e,t);return{startIndex:i,endIndex:o}},_={action:Ts,clear:Is,style:Vs,strip:yt,figures:ie,lines:Ys,wrap:Hs,entriesToDisplay:Bs};const re=Fe,{action:Us}=_,zs=Ve,{beep:Ws,cursor:Gs}=D,Js=M;let Ks=class extends zs{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);const e=re.createInterface({input:this.in,escapeCodeTimeout:50});re.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,o=(n,r)=>{let l=Us(r,i);l===!1?this._&&this._(n,r):typeof this[l]=="function"?this[l](r):this.bell()};this.close=()=>{this.out.write(Gs.show),this.in.removeListener("keypress",o),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",o)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Ws)}render(){this.onRender(Js),this.firstRender&&(this.firstRender=!1)}};var j=Ks;const et=M,qs=j,{erase:Zs,cursor:X}=D,{style:Et,clear:Tt,lines:Xs,figures:Qs}=_;class ti extends qs{constructor(t={}){super(t),this.transform=Et.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=Tt("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=et.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
3
+ `)},Bs=(s,t,e)=>{e=e||t;let i=Math.min(t-e,s-Math.floor(e/2));i<0&&(i=0);let o=Math.min(i+e,t);return{startIndex:i,endIndex:o}},_={action:Ts,clear:Is,style:Ls,strip:yt,figures:ie,lines:Ys,wrap:Hs,entriesToDisplay:Bs};const re=Fe,{action:Us}=_,zs=Le,{beep:Ws,cursor:Gs}=D,Js=M;let Ks=class extends zs{constructor(t={}){super(),this.firstRender=!0,this.in=t.stdin||process.stdin,this.out=t.stdout||process.stdout,this.onRender=(t.onRender||(()=>{})).bind(this);const e=re.createInterface({input:this.in,escapeCodeTimeout:50});re.emitKeypressEvents(this.in,e),this.in.isTTY&&this.in.setRawMode(!0);const i=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,o=(n,r)=>{let l=Us(r,i);l===!1?this._&&this._(n,r):typeof this[l]=="function"?this[l](r):this.bell()};this.close=()=>{this.out.write(Gs.show),this.in.removeListener("keypress",o),this.in.isTTY&&this.in.setRawMode(!1),e.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",o)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(Ws)}render(){this.onRender(Js),this.firstRender&&(this.firstRender=!1)}};var j=Ks;const et=M,qs=j,{erase:Zs,cursor:X}=D,{style:Et,clear:Tt,lines:Xs,figures:Qs}=_;class ti extends qs{constructor(t={}){super(t),this.transform=Et.render(t.style),this.scale=this.transform.scale,this.msg=t.message,this.initial=t.initial||"",this.validator=t.validate||(()=>!0),this.value="",this.errorMsg=t.error||"Please Enter A Valid Value",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.clear=Tt("",this.out.columns),this.render()}set value(t){!t&&this.initial?(this.placeholder=!0,this.rendered=et.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(t)),this._value=t,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=Number(!!this.initial),this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
4
4
  `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
5
5
  `),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(t){this.placeholder||(this.cursor=this.cursor+t,this.cursorOffset+=t)}_(t,e){let i=this.value.slice(0,this.cursor),o=this.value.slice(this.cursor);this.value=`${i}${t}${o}`,this.red=!1,this.cursor=this.placeholder?0:i.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let t=this.value.slice(0,this.cursor-1),e=this.value.slice(this.cursor);this.value=`${t}${e}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let t=this.value.slice(0,this.cursor),e=this.value.slice(this.cursor+1);this.value=`${t}${e}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(X.down(Xs(this.outputError,this.out.columns)-1)+Tt(this.outputError,this.out.columns)),this.out.write(Tt(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Et.symbol(this.done,this.aborted),et.bold(this.msg),Et.delimiter(this.done),this.red?et.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
6
6
  `).reduce((t,e,i)=>t+`
@@ -11,11 +11,11 @@ ${i?" ":Qs.pointerSmall} ${et.red().italic(e)}`,"")),this.out.write(Zs.line+X.to
11
11
  `+ii(l.description,{margin:3,width:this.out.columns})))),this.outputText+=`${n} ${o}${A.gray(r)}
12
12
  `}}this.out.write(this.outputText)}}var li=oi;const it=M,ai=j,{style:le,clear:hi}=_,{cursor:ae,erase:ui}=D;class ci extends ai{constructor(t={}){super(t),this.msg=t.message,this.value=!!t.initial,this.active=t.active||"on",this.inactive=t.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
13
13
  `),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
14
- `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(ae.hide):this.out.write(hi(this.outputText,this.out.columns)),super.render(),this.outputText=[le.symbol(this.done,this.aborted),it.bold(this.msg),le.delimiter(this.done),this.value?this.inactive:it.cyan().underline(this.inactive),it.gray("/"),this.value?it.cyan().underline(this.active):this.active].join(" "),this.out.write(ui.line+ae.to(0)+this.outputText))}}var di=ci;let Pt=class{constructor({token:t,date:e,parts:i,locales:o}){this.token=t,this.date=e||new Date,this.parts=i||[this],this.locales=o||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((e,i)=>i>t&&e instanceof Pt)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const e=t.indexOf(this);return t.find((i,o)=>o>e&&i instanceof Pt)}toString(){return String(this.date)}};var R=Pt;const fi=R;let pi=class extends fi{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};var mi=pi;const gi=R,vi=s=>(s=s%10,s===1?"st":s===2?"nd":s===3?"rd":"th");let bi=class extends gi{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+vi(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};var wi=bi;const yi=R;let $i=class extends yi{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};var xi=$i;const Si=R;let Ei=class extends Si{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};var Ti=Ei;const Pi=R;let Oi=class extends Pi{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};var Ci=Oi;const Mi=R;let Di=class extends Mi{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};var _i=Di;const Ii=R;let Ai=class extends Ii{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};var Ri=Ai;const ki=R;let Ni=class extends ki{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};var ji=Ni,Fi={DatePart:R,Meridiem:mi,Day:wi,Hours:xi,Milliseconds:Ti,Minutes:Ci,Month:_i,Seconds:Ri,Year:ji};const Ot=M,Vi=j,{style:he,clear:ue,figures:Li}=_,{erase:Yi,cursor:ce}=D,{DatePart:de,Meridiem:Hi,Day:Bi,Hours:Ui,Milliseconds:zi,Minutes:Wi,Month:Gi,Seconds:Ji,Year:Ki}=Fi,qi=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,fe={1:({token:s})=>s.replace(/\\(.)/g,"$1"),2:s=>new Bi(s),3:s=>new Gi(s),4:s=>new Ki(s),5:s=>new Hi(s),6:s=>new Ui(s),7:s=>new Wi(s),8:s=>new Ji(s),9:s=>new zi(s)},Zi={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class Xi extends Vi{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Zi,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=ue("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=qi.exec(t);){let o=e.shift(),n=e.findIndex(r=>r!=null);this.parts.push(n in fe?fe[n]({token:e[n]||o,date:this.date,parts:this.parts,locales:this.locales}):e[n]||o)}let i=this.parts.reduce((o,n)=>(typeof n=="string"&&typeof o[o.length-1]=="string"?o[o.length-1]+=n:o.push(n),o),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof de)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
14
+ `),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(t,e){if(t===" ")this.value=!this.value;else if(t==="1")this.value=!0;else if(t==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(ae.hide):this.out.write(hi(this.outputText,this.out.columns)),super.render(),this.outputText=[le.symbol(this.done,this.aborted),it.bold(this.msg),le.delimiter(this.done),this.value?this.inactive:it.cyan().underline(this.inactive),it.gray("/"),this.value?it.cyan().underline(this.active):this.active].join(" "),this.out.write(ui.line+ae.to(0)+this.outputText))}}var di=ci;let Ot=class{constructor({token:t,date:e,parts:i,locales:o}){this.token=t,this.date=e||new Date,this.parts=i||[this],this.locales=o||{}}up(){}down(){}next(){const t=this.parts.indexOf(this);return this.parts.find((e,i)=>i>t&&e instanceof Ot)}setTo(t){}prev(){let t=[].concat(this.parts).reverse();const e=t.indexOf(this);return t.find((i,o)=>o>e&&i instanceof Ot)}toString(){return String(this.date)}};var R=Ot;const fi=R;let pi=class extends fi{constructor(t={}){super(t)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let t=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?t.toUpperCase():t}};var mi=pi;const gi=R,vi=s=>(s=s%10,s===1?"st":s===2?"nd":s===3?"rd":"th");let bi=class extends gi{constructor(t={}){super(t)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(t){this.date.setDate(parseInt(t.substr(-2)))}toString(){let t=this.date.getDate(),e=this.date.getDay();return this.token==="DD"?String(t).padStart(2,"0"):this.token==="Do"?t+vi(t):this.token==="d"?e+1:this.token==="ddd"?this.locales.weekdaysShort[e]:this.token==="dddd"?this.locales.weekdays[e]:t}};var wi=bi;const yi=R;let $i=class extends yi{constructor(t={}){super(t)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(t){this.date.setHours(parseInt(t.substr(-2)))}toString(){let t=this.date.getHours();return/h/.test(this.token)&&(t=t%12||12),this.token.length>1?String(t).padStart(2,"0"):t}};var xi=$i;const Si=R;let Ei=class extends Si{constructor(t={}){super(t)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(t){this.date.setMilliseconds(parseInt(t.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}};var Ti=Ei;const Oi=R;let Pi=class extends Oi{constructor(t={}){super(t)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(t){this.date.setMinutes(parseInt(t.substr(-2)))}toString(){let t=this.date.getMinutes();return this.token.length>1?String(t).padStart(2,"0"):t}};var Ci=Pi;const Mi=R;let Di=class extends Mi{constructor(t={}){super(t)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(t){t=parseInt(t.substr(-2))-1,this.date.setMonth(t<0?0:t)}toString(){let t=this.date.getMonth(),e=this.token.length;return e===2?String(t+1).padStart(2,"0"):e===3?this.locales.monthsShort[t]:e===4?this.locales.months[t]:String(t+1)}};var _i=Di;const Ii=R;let Ai=class extends Ii{constructor(t={}){super(t)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(t){this.date.setSeconds(parseInt(t.substr(-2)))}toString(){let t=this.date.getSeconds();return this.token.length>1?String(t).padStart(2,"0"):t}};var Ri=Ai;const ki=R;let Ni=class extends ki{constructor(t={}){super(t)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(t){this.date.setFullYear(t.substr(-4))}toString(){let t=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?t.substr(-2):t}};var ji=Ni,Fi={DatePart:R,Meridiem:mi,Day:wi,Hours:xi,Milliseconds:Ti,Minutes:Ci,Month:_i,Seconds:Ri,Year:ji};const Pt=M,Li=j,{style:he,clear:ue,figures:Vi}=_,{erase:Yi,cursor:ce}=D,{DatePart:de,Meridiem:Hi,Day:Bi,Hours:Ui,Milliseconds:zi,Minutes:Wi,Month:Gi,Seconds:Ji,Year:Ki}=Fi,qi=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,fe={1:({token:s})=>s.replace(/\\(.)/g,"$1"),2:s=>new Bi(s),3:s=>new Gi(s),4:s=>new Ki(s),5:s=>new Hi(s),6:s=>new Ui(s),7:s=>new Wi(s),8:s=>new Ji(s),9:s=>new zi(s)},Zi={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class Xi extends Li{constructor(t={}){super(t),this.msg=t.message,this.cursor=0,this.typed="",this.locales=Object.assign(Zi,t.locales),this._date=t.initial||new Date,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.mask=t.mask||"YYYY-MM-DD HH:mm:ss",this.clear=ue("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(t){t&&this._date.setTime(t.getTime())}set mask(t){let e;for(this.parts=[];e=qi.exec(t);){let o=e.shift(),n=e.findIndex(r=>r!=null);this.parts.push(n in fe?fe[n]({token:e[n]||o,date:this.date,parts:this.parts,locales:this.locales}):e[n]||o)}let i=this.parts.reduce((o,n)=>(typeof n=="string"&&typeof o[o.length-1]=="string"?o[o.length-1]+=n:o.push(n),o),[]);this.parts.splice(0),this.parts.push(...i),this.reset()}moveCursor(t){this.typed="",this.cursor=t,this.fire()}reset(){this.moveCursor(this.parts.findIndex(t=>t instanceof de)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
15
15
  `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
16
- `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof de)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(ce.hide):this.out.write(ue(this.outputText,this.out.columns)),super.render(),this.outputText=[he.symbol(this.done,this.aborted),Ot.bold(this.msg),he.delimiter(!1),this.parts.reduce((t,e,i)=>t.concat(i===this.cursor&&!this.done?Ot.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
16
+ `),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let t=this.parts[this.cursor].prev();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}right(){let t=this.parts[this.cursor].next();if(t==null)return this.bell();this.moveCursor(this.parts.indexOf(t)),this.render()}next(){let t=this.parts[this.cursor].next();this.moveCursor(t?this.parts.indexOf(t):this.parts.findIndex(e=>e instanceof de)),this.render()}_(t){/\d/.test(t)&&(this.typed+=t,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(ce.hide):this.out.write(ue(this.outputText,this.out.columns)),super.render(),this.outputText=[he.symbol(this.done,this.aborted),Pt.bold(this.msg),he.delimiter(!1),this.parts.reduce((t,e,i)=>t.concat(i===this.cursor&&!this.done?Pt.cyan().underline(e.toString()):e),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
17
17
  `).reduce((t,e,i)=>t+`
18
- ${i?" ":Li.pointerSmall} ${Ot.red().italic(e)}`,"")),this.out.write(Yi.line+ce.to(0)+this.outputText))}}var Qi=Xi;const rt=M,tr=j,{cursor:nt,erase:er}=D,{style:Ct,figures:sr,clear:pe,lines:ir}=_,rr=/[0-9]/,Mt=s=>s!==void 0,me=(s,t)=>{let e=Math.pow(10,t);return Math.round(s*e)/e};class nr extends tr{constructor(t={}){super(t),this.transform=Ct.render(t.style),this.msg=t.message,this.initial=Mt(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=Mt(t.min)?t.min:-1/0,this.max=Mt(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=rt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${me(t,this.round)}`),this._value=me(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||rr.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
18
+ ${i?" ":Vi.pointerSmall} ${Pt.red().italic(e)}`,"")),this.out.write(Yi.line+ce.to(0)+this.outputText))}}var Qi=Xi;const rt=M,tr=j,{cursor:nt,erase:er}=D,{style:Ct,figures:sr,clear:pe,lines:ir}=_,rr=/[0-9]/,Mt=s=>s!==void 0,me=(s,t)=>{let e=Math.pow(10,t);return Math.round(s*e)/e};class nr extends tr{constructor(t={}){super(t),this.transform=Ct.render(t.style),this.msg=t.message,this.initial=Mt(t.initial)?t.initial:"",this.float=!!t.float,this.round=t.round||2,this.inc=t.increment||1,this.min=Mt(t.min)?t.min:-1/0,this.max=Mt(t.max)?t.max:1/0,this.errorMsg=t.error||"Please Enter A Valid Value",this.validator=t.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(t){!t&&t!==0?(this.placeholder=!0,this.rendered=rt.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${me(t,this.round)}`),this._value=me(t,this.round)),this.fire()}get value(){return this._value}parse(t){return this.float?parseFloat(t):parseInt(t)}valid(t){return t==="-"||t==="."&&this.float||rr.test(t)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let t=this.value;this.value=t!==""?t:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
19
19
  `),this.close()}async validate(){let t=await this.validator(this.value);typeof t=="string"&&(this.errorMsg=t,t=!1),this.error=!t}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let t=this.value;this.value=t!==""?t:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
20
20
  `),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let t=this.value.toString();if(t.length===0)return this.bell();this.value=this.parse(t=t.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(t,e){if(!this.valid(t))return this.bell();const i=Date.now();if(i-this.lastHit>1e3&&(this.typed=""),this.typed+=t,this.lastHit=i,this.color="cyan",t===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(nt.down(ir(this.outputError,this.out.columns)-1)+pe(this.outputError,this.out.columns)),this.out.write(pe(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[Ct.symbol(this.done,this.aborted),rt.bold(this.msg),Ct.delimiter(this.done),!this.done||!this.done&&!this.placeholder?rt[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
21
21
  `).reduce((t,e,i)=>t+`
@@ -43,9 +43,9 @@ Instructions:
43
43
  enter/return: Complete answer
44
44
  `:""}renderCurrentInput(){return`
45
45
  Filtered results for: ${this.inputValue?this.inputValue:k.gray("Enter something to filter")}
46
- `}renderOption(t,e,i){let o;return e.disabled?o=t===i?k.gray().underline(e.title):k.strikethrough().gray(e.title):o=t===i?k.cyan().underline(e.title):e.title,(e.selected?k.green(G.radioOn):G.radioOff)+" "+o}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[k.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(k.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(yr.hide),super.render();let t=[Se.symbol(this.done,this.aborted),k.bold(this.msg),Se.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=k.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=xe(t,this.out.columns)}}var Sr=xr;const Ee=M,Er=j,{style:Te,clear:Tr}=_,{erase:Pr,cursor:Pe}=D;class Or extends Er{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
46
+ `}renderOption(t,e,i){let o;return e.disabled?o=t===i?k.gray().underline(e.title):k.strikethrough().gray(e.title):o=t===i?k.cyan().underline(e.title):e.title,(e.selected?k.green(G.radioOn):G.radioOff)+" "+o}renderDoneOrInstructions(){if(this.done)return this.value.filter(e=>e.selected).map(e=>e.title).join(", ");const t=[k.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&t.push(k.yellow(this.warn)),t.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(yr.hide),super.render();let t=[Se.symbol(this.done,this.aborted),k.bold(this.msg),Se.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(t+=k.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),t+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+t),this.clear=xe(t,this.out.columns)}}var Sr=xr;const Ee=M,Er=j,{style:Te,clear:Tr}=_,{erase:Or,cursor:Oe}=D;class Pr extends Er{constructor(t={}){super(t),this.msg=t.message,this.value=t.initial,this.initialValue=!!t.initial,this.yesMsg=t.yes||"yes",this.yesOption=t.yesOption||"(Y/n)",this.noMsg=t.no||"no",this.noOption=t.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
47
47
  `),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
48
- `),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Pe.hide):this.out.write(Tr(this.outputText,this.out.columns)),super.render(),this.outputText=[Te.symbol(this.done,this.aborted),Ee.bold(this.msg),Te.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Ee.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Pr.line+Pe.to(0)+this.outputText))}}var Cr=Or,Mr={TextPrompt:ei,SelectPrompt:li,TogglePrompt:di,DatePrompt:Qi,NumberPrompt:or,MultiselectPrompt:be,AutocompletePrompt:wr,AutocompleteMultiselectPrompt:Sr,ConfirmPrompt:Cr};(function(s){const t=s,e=Mr,i=r=>r;function o(r,l,c={}){return new Promise((h,$)=>{const f=new e[r](l),a=c.onAbort||i,b=c.onSubmit||i,p=c.onExit||i;f.on("state",l.onState||i),f.on("submit",S=>h(b(S))),f.on("exit",S=>h(p(S))),f.on("abort",S=>$(a(S)))})}t.text=r=>o("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>o("NumberPrompt",r),t.date=r=>o("DatePrompt",r),t.confirm=r=>o("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return o("TextPrompt",r,{onSubmit:c=>c.split(l).map(h=>h.trim())})},t.toggle=r=>o("TogglePrompt",r),t.select=r=>o("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=c=>c.filter(h=>h.selected).map(h=>h.value);return o("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=c=>c.filter(h=>h.selected).map(h=>h.value);return o("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const n=(r,l)=>Promise.resolve(l.filter(c=>c.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||n,r.choices=[].concat(r.choices||[]),o("AutocompletePrompt",r))})(te);const It=te,Dr=["suggest","format","onState","validate","onRender","type"],Oe=()=>{};async function V(s=[],{onSubmit:t=Oe,onCancel:e=Oe}={}){const i={},o=V._override||{};s=[].concat(s);let n,r,l,c,h,$;const f=async(a,b,p=!1)=>{if(!(!p&&a.validate&&a.validate(b)!==!0))return a.format?await a.format(b,i):b};for(r of s)if({name:c,type:h}=r,typeof h=="function"&&(h=await h(n,{...i},r),r.type=h),!!h){for(let a in r){if(Dr.includes(a))continue;let b=r[a];r[a]=typeof b=="function"?await b(n,{...i},$):b}if($=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:c,type:h}=r,It[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(o[r.name]!==void 0&&(n=await f(r,o[r.name]),n!==void 0)){i[c]=n;continue}try{n=V._injected?_r(V._injected,r.initial):await It[h](r),i[c]=n=await f(r,n,!0),l=await t(r,n,i)}catch{l=!await e(r,i)}if(l)return i}return i}function _r(s,t){const e=s.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function Ir(s){V._injected=(V._injected||[]).concat(s)}function Ar(s){V._override=Object.assign({},s)}var Rr=Object.assign(V,{prompt:V,prompts:It,inject:Ir,override:Ar});let B=!0;const J=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let Ce=0;if(J.process&&J.process.env&&J.process.stdout){const{FORCE_COLOR:s,NODE_DISABLE_COLORS:t,TERM:e}=J.process.env;t||s==="0"?B=!1:s==="1"?B=!0:e==="dumb"?B=!1:"CI"in J.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(i=>i in J.process.env)?B=!0:B=process.stdout.isTTY,B&&(Ce=e&&e.endsWith("-256color")?2:1)}let Me={enabled:B,supportLevel:Ce};function ot(s,t,e=1){const i=`\x1B[${s}m`,o=`\x1B[${t}m`,n=new RegExp(`\\x1b\\[${t}m`,"g");return r=>Me.enabled&&Me.supportLevel>=e?i+(""+r).replace(n,i)+o:""+r}const N=ot(0,0),De=ot(31,39),_e=ot(32,39),L=ot(34,39),At=ws(process.argv.slice(2),{string:["_"]}),Rt=process.cwd(),kt=[{name:"vue",display:"Young Designed Vue Template",color:_e,variants:[{name:"vue-thin",display:"Vue3 + TS + Pinia + Unocss",color:_e},{name:"nuxt-admin",display:"Nuxt3 + ElementPlus + Vant + TS + Pinia + Unocss",color:L},{name:"admin-server",display:"Node Server Based on Midwayjs",color:L},{name:"vue-mobile",display:"Vue3 + Vant4 + TS + Pinia + Unocss",color:L},{name:"uni-app",display:"Vue3 + uni-app + TS + Pinia + Unocss",color:L},{name:"nuxt3",display:"Nuxt3 + TS + Pinia + Unocss",color:L,wip:!0},{name:"ssr",display:"NestJS + TS + Pinia + Tailwindcss",color:L,wip:!0},{name:"solidjs-ssr",display:"SolidJS + TS + Pinia + Unocss",color:L,wip:!0},{name:"vue-admin",display:"Vue3 + ElementPlus + TS + Pinia + Unocss",color:L,deprecated:!0}]},{name:"vite",display:"Vite Formal",color:N,variants:[{name:"create-vite",display:"create-vite",color:N,customCommand:"npm create vite@latest TARGET_DIR"}]},{name:"others",display:"Others",color:N,variants:[{name:"create-vite-extra",display:"create-vite-extra \u2197",color:N,customCommand:"npm create vite-extra@latest TARGET_DIR"}]}],Ie=kt.map(s=>s.variants&&s.variants.map(t=>t.name)||[s.name]).reduce((s,t)=>s.concat(t),[]),kr={_gitignore:".gitignore",_npmrc:".npmrc"},Nr=/_env.*/,Nt="vite-project";async function jr(){const s=Ae(At._[0]),t=At.template||At.t;let e=s||Nt;const i=()=>e==="."?C.basename(C.resolve()):e;let o;try{o=await Rr([{type:s?null:"text",name:"projectName",message:N("Project name:"),initial:Nt,onState:d=>{e=Ae(d.value)||Nt}},{type:()=>!T.existsSync(e)||Lr(e)?null:"confirm",name:"overwrite",message:()=>(e==="."?"Current directory":`Target directory "${e}"`)+" is not empty. Remove existing files and continue?"},{type:(d,{overwrite:u})=>{if(u===!1)throw new Error(De("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>ke(i())?null:"text",name:"packageName",message:N("Package name:"),initial:()=>Fr(i()),validate:d=>ke(d)||"Invalid package.json name"},{type:t&&Ie.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!Ie.includes(t)?N(`"${t}" isn't a valid template. Please choose from below: `):N("Select a framework:"),initial:0,choices:kt.map(d=>{const u=d.color;return{title:u(d.display||d.name),value:d}})},{type:d=>d&&d.variants?"select":null,name:"variant",message:N("Select a variant:"),choices:d=>d.variants.map(u=>{const w=u.color;return{title:w(u.display||u.name),value:u.name,disabled:u.wip||u.deprecated}})}],{onCancel:()=>{throw new Error(De("\u2716")+" Operation cancelled")}})}catch(d){console.log(d.message);return}const{framework:n,overwrite:r,packageName:l,variant:c}=o,h=C.join(Rt,e);r?Yr(h):T.existsSync(h)||T.mkdirSync(h,{recursive:!0});const $=c||n?.name||t,f=Hr(process.env.npm_config_user_agent),a=f?f.name:"npm",b=a==="yarn"&&f?.version.startsWith("1."),{customCommand:p}=kt.flatMap(d=>d.variants).find(d=>d.name===$)??{};if(p){const d=p.replace("TARGET_DIR",e).replace(/^npm create/,`${a} create`).replace("@latest",()=>b?"":"@latest").replace(/^npm exec/,()=>a==="pnpm"?"pnpm dlx":a==="yarn"&&!b?"yarn dlx":"npm exec"),[u,...w]=d.split(" "),{status:O}=U.exports.sync(u,w,{stdio:"inherit"});process.exit(O??0)}console.log(`
49
- Scaffolding project in ${h}...`);const S=C.resolve(Ne(import.meta.url),"../..",`template-${$}`),E=(d,u)=>{const w=C.join(h,kr[d]??Nr.test(d)?d.replace("_","."):d);u?T.writeFileSync(w,u):Re(C.join(S,d),w)},P=T.readdirSync(S);for(const d of P.filter(u=>u!=="package.json"))E(d);const Y=JSON.parse(T.readFileSync(C.join(S,"package.json"),"utf-8"));switch(Y.name=l||i(),E("package.json",JSON.stringify(Y,null,2)),console.log(`
48
+ `),this.close()}_(t,e){return t.toLowerCase()==="y"?(this.value=!0,this.submit()):t.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(Oe.hide):this.out.write(Tr(this.outputText,this.out.columns)),super.render(),this.outputText=[Te.symbol(this.done,this.aborted),Ee.bold(this.msg),Te.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:Ee.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(Or.line+Oe.to(0)+this.outputText))}}var Cr=Pr,Mr={TextPrompt:ei,SelectPrompt:li,TogglePrompt:di,DatePrompt:Qi,NumberPrompt:or,MultiselectPrompt:be,AutocompletePrompt:wr,AutocompleteMultiselectPrompt:Sr,ConfirmPrompt:Cr};(function(s){const t=s,e=Mr,i=r=>r;function o(r,l,c={}){return new Promise((h,$)=>{const f=new e[r](l),a=c.onAbort||i,b=c.onSubmit||i,p=c.onExit||i;f.on("state",l.onState||i),f.on("submit",S=>h(b(S))),f.on("exit",S=>h(p(S))),f.on("abort",S=>$(a(S)))})}t.text=r=>o("TextPrompt",r),t.password=r=>(r.style="password",t.text(r)),t.invisible=r=>(r.style="invisible",t.text(r)),t.number=r=>o("NumberPrompt",r),t.date=r=>o("DatePrompt",r),t.confirm=r=>o("ConfirmPrompt",r),t.list=r=>{const l=r.separator||",";return o("TextPrompt",r,{onSubmit:c=>c.split(l).map(h=>h.trim())})},t.toggle=r=>o("TogglePrompt",r),t.select=r=>o("SelectPrompt",r),t.multiselect=r=>{r.choices=[].concat(r.choices||[]);const l=c=>c.filter(h=>h.selected).map(h=>h.value);return o("MultiselectPrompt",r,{onAbort:l,onSubmit:l})},t.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const l=c=>c.filter(h=>h.selected).map(h=>h.value);return o("AutocompleteMultiselectPrompt",r,{onAbort:l,onSubmit:l})};const n=(r,l)=>Promise.resolve(l.filter(c=>c.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));t.autocomplete=r=>(r.suggest=r.suggest||n,r.choices=[].concat(r.choices||[]),o("AutocompletePrompt",r))})(te);const It=te,Dr=["suggest","format","onState","validate","onRender","type"],Pe=()=>{};async function L(s=[],{onSubmit:t=Pe,onCancel:e=Pe}={}){const i={},o=L._override||{};s=[].concat(s);let n,r,l,c,h,$;const f=async(a,b,p=!1)=>{if(!(!p&&a.validate&&a.validate(b)!==!0))return a.format?await a.format(b,i):b};for(r of s)if({name:c,type:h}=r,typeof h=="function"&&(h=await h(n,{...i},r),r.type=h),!!h){for(let a in r){if(Dr.includes(a))continue;let b=r[a];r[a]=typeof b=="function"?await b(n,{...i},$):b}if($=r,typeof r.message!="string")throw new Error("prompt message is required");if({name:c,type:h}=r,It[h]===void 0)throw new Error(`prompt type (${h}) is not defined`);if(o[r.name]!==void 0&&(n=await f(r,o[r.name]),n!==void 0)){i[c]=n;continue}try{n=L._injected?_r(L._injected,r.initial):await It[h](r),i[c]=n=await f(r,n,!0),l=await t(r,n,i)}catch{l=!await e(r,i)}if(l)return i}return i}function _r(s,t){const e=s.shift();if(e instanceof Error)throw e;return e===void 0?t:e}function Ir(s){L._injected=(L._injected||[]).concat(s)}function Ar(s){L._override=Object.assign({},s)}var Rr=Object.assign(L,{prompt:L,prompts:It,inject:Ir,override:Ar});let H=!0;const J=typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{};let Ce=0;if(J.process&&J.process.env&&J.process.stdout){const{FORCE_COLOR:s,NODE_DISABLE_COLORS:t,TERM:e}=J.process.env;t||s==="0"?H=!1:s==="1"?H=!0:e==="dumb"?H=!1:"CI"in J.process.env&&["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(i=>i in J.process.env)?H=!0:H=process.stdout.isTTY,H&&(Ce=e&&e.endsWith("-256color")?2:1)}let Me={enabled:H,supportLevel:Ce};function ot(s,t,e=1){const i=`\x1B[${s}m`,o=`\x1B[${t}m`,n=new RegExp(`\\x1b\\[${t}m`,"g");return r=>Me.enabled&&Me.supportLevel>=e?i+(""+r).replace(n,i)+o:""+r}const N=ot(0,0),De=ot(31,39),_e=ot(32,39),B=ot(34,39),At=ws(process.argv.slice(2),{string:["_"]}),Rt=process.cwd(),kt=[{name:"vue",display:"Young Designed Vue Template",color:_e,variants:[{name:"vue-thin",display:"Vue3 + TS + Pinia + Unocss",color:_e},{name:"nuxt-admin",display:"Nuxt3 + ElementPlus + Vant + TS + Pinia + Unocss",color:B},{name:"admin-server",display:"Node Server Based on Midwayjs",color:B},{name:"vue-mobile",display:"Vue3 + Vant4 + TS + Pinia + Unocss",color:B},{name:"uni-app",display:"Vue3 + uni-app + TS + Pinia + Unocss",color:B},{name:"nuxt3",display:"Nuxt3 + TS + Pinia + Unocss",color:B,wip:!0},{name:"ssr",display:"NestJS + TS + Pinia + Tailwindcss",color:B,wip:!0},{name:"solidjs-ssr",display:"SolidJS + TS + Pinia + Unocss",color:B,wip:!0}]},{name:"vite",display:"Vite Formal",color:N,variants:[{name:"create-vite",display:"create-vite",color:N,customCommand:"npm create vite@latest TARGET_DIR"}]},{name:"others",display:"Others",color:N,variants:[{name:"create-vite-extra",display:"create-vite-extra \u2197",color:N,customCommand:"npm create vite-extra@latest TARGET_DIR"}]}],Ie=kt.map(s=>s.variants&&s.variants.map(t=>t.name)||[s.name]).reduce((s,t)=>s.concat(t),[]),kr={_gitignore:".gitignore",_npmrc:".npmrc"},Nr=/_env.*/,Nt="vite-project";async function jr(){const s=Ae(At._[0]),t=At.template||At.t;let e=s||Nt;const i=()=>e==="."?C.basename(C.resolve()):e;let o;try{o=await Rr([{type:s?null:"text",name:"projectName",message:N("Project name:"),initial:Nt,onState:d=>{e=Ae(d.value)||Nt}},{type:()=>!T.existsSync(e)||Vr(e)?null:"confirm",name:"overwrite",message:()=>`${e==="."?"Current directory":`Target directory "${e}"`} is not empty. Remove existing files and continue?`},{type:(d,{overwrite:u})=>{if(u===!1)throw new Error(`${De("\u2716")} Operation cancelled`);return null},name:"overwriteChecker"},{type:()=>ke(i())?null:"text",name:"packageName",message:N("Package name:"),initial:()=>Fr(i()),validate:d=>ke(d)||"Invalid package.json name"},{type:t&&Ie.includes(t)?null:"select",name:"framework",message:typeof t=="string"&&!Ie.includes(t)?N(`"${t}" isn't a valid template. Please choose from below: `):N("Select a framework:"),initial:0,choices:kt.map(d=>{const u=d.color;return{title:u(d.display||d.name),value:d}})},{type:d=>d&&d.variants?"select":null,name:"variant",message:N("Select a variant:"),choices:d=>d.variants.map(u=>{const w=u.color;return{title:w(u.display||u.name),value:u.name,disabled:u.wip||u.deprecated}})}],{onCancel:()=>{throw new Error(`${De("\u2716")} Operation cancelled`)}})}catch(d){console.log(d.message);return}const{framework:n,overwrite:r,packageName:l,variant:c}=o,h=C.join(Rt,e);r?Yr(h):T.existsSync(h)||T.mkdirSync(h,{recursive:!0});const $=c||n?.name||t,f=Hr(process.env.npm_config_user_agent),a=f?f.name:"npm",b=a==="yarn"&&f?.version.startsWith("1."),{customCommand:p}=kt.flatMap(d=>d.variants).find(d=>d.name===$)??{};if(p){const d=p.replace("TARGET_DIR",e).replace(/^npm create/,`${a} create`).replace("@latest",()=>b?"":"@latest").replace(/^npm exec/,()=>a==="pnpm"?"pnpm dlx":a==="yarn"&&!b?"yarn dlx":"npm exec"),[u,...w]=d.split(" "),{status:P}=U.exports.sync(u,w,{stdio:"inherit"});process.exit(P??0)}console.log(`
49
+ Scaffolding project in ${h}...`);const S=C.resolve(Ne(import.meta.url),"../..",`template-${$}`),E=(d,u)=>{const w=C.join(h,kr[d]??Nr.test(d)?d.replace("_","."):d);u?T.writeFileSync(w,u):Re(C.join(S,d),w)},O=T.readdirSync(S);for(const d of O.filter(u=>u!=="package.json"))E(d);const V=JSON.parse(T.readFileSync(C.join(S,"package.json"),"utf-8"));switch(V.name=l||i(),E("package.json",JSON.stringify(V,null,2)),console.log(`
50
50
  Done. Now run:
51
- `),h!==Rt&&console.log(` cd ${C.relative(Rt,h)}`),a){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${a} install`),console.log(` ${a} run dev`);break}console.log()}function Ae(s){return s?.trim().replace(/\/+$/g,"")}function Re(s,t){T.statSync(s).isDirectory()?Vr(s,t):T.copyFileSync(s,t)}function ke(s){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(s)}function Fr(s){return s.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Vr(s,t){T.mkdirSync(t,{recursive:!0});for(const e of T.readdirSync(s)){const i=C.resolve(s,e),o=C.resolve(t,e);Re(i,o)}}function Lr(s){const t=T.readdirSync(s);return t.length===0||t.length===1&&t[0]===".git"}function Yr(s){if(!!T.existsSync(s))for(const t of T.readdirSync(s))t!==".git"&&T.rmSync(C.resolve(s,t),{recursive:!0,force:!0})}function Hr(s){if(!s)return;const e=s.split(" ")[0].split("/");return{name:e[0],version:e[1]}}jr().catch(s=>{console.error(s)});
51
+ `),h!==Rt&&console.log(` cd ${C.relative(Rt,h)}`),a){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${a} install`),console.log(` ${a} run dev`);break}console.log()}function Ae(s){return s?.trim().replace(/\/+$/g,"")}function Re(s,t){T.statSync(s).isDirectory()?Lr(s,t):T.copyFileSync(s,t)}function ke(s){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(s)}function Fr(s){return s.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Lr(s,t){T.mkdirSync(t,{recursive:!0});for(const e of T.readdirSync(s)){const i=C.resolve(s,e),o=C.resolve(t,e);Re(i,o)}}function Vr(s){const t=T.readdirSync(s);return t.length===0||t.length===1&&t[0]===".git"}function Yr(s){if(!!T.existsSync(s))for(const t of T.readdirSync(s))t!==".git"&&T.rmSync(C.resolve(s,t),{recursive:!0,force:!0})}function Hr(s){if(!s)return;const e=s.split(" ")[0].split("/");return{name:e[0],version:e[1]}}jr().catch(s=>{console.error(s)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-young-proj",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "description": "create project from template",
5
5
  "author": "BluesYoung-web",
6
6
  "license": "MIT",
@@ -2,6 +2,48 @@
2
2
 
3
3
  [![code style](https://antfu.me/badge-code-style.svg)](https://github.com/antfu/eslint-config)
4
4
 
5
+ ## 与旧版的区别
6
+
7
+ ### 所有的页面都是默认缓存的
8
+
9
+ - 原有的 route 代码块,使用 definePageMeta 宏进行定义
10
+
11
+ - 所有需要 keep-alive 的页面,setup 里面直接执行的函数或者 onMounted 包裹的函数,全部替换为 useTabReOpen 进行包裹
12
+
13
+ - 所有不需要 keep-alive 的页面,setup 里面直接执行的函数或者 onMounted 包裹的函数,全部替换为 useTabNoCache 进行包裹
14
+
15
+ - onUnmounted 包裹的函数,全部替换为 useTabClose 进行包裹
16
+
17
+ ### 组件库(@bluesyoung/ui-vue3-element-plus)
18
+
19
+ > 自 0.13.0 开始,YoungDialog 默认表现为 Drawer !!!, 可通过设置 as='dialog' 改为 Dialog
20
+
21
+ ### 其他
22
+
23
+ - 路由跳转,使用 navigateTo 替换 router
24
+
25
+ - 二次确认弹窗,统一使用 useConfirm(自带汉化,代码更精简)
26
+
27
+ - prompt 情况更复杂,需自行汉化
28
+
29
+ - alert 使用频率不高,自行汉化
30
+
31
+ - 使用 tsx 代替 h:
32
+ - hooks 直接修改扩展名为 .tsx
33
+ - vue 内修改 lang 为 tsx
34
+
35
+ - stores/* 已经被删除了,需要取数据,使用 pinia
36
+
37
+ - 一些存在于 keep-alive 页面内的组件,需要在例如 @focus 内 getList(),或者使用 useTabReOpen 替换 onMounted
38
+
39
+ - 尽量使用 YoungTablePro 而不是 YoungTable
40
+
41
+ - 保持页面美观,页面内容全部使用 ElCard 进行包裹
42
+
43
+ - **SelectOption 的值不要给 null !!!**
44
+
45
+ - **所有非原生的标签,统一使用大驼峰书写**
46
+
5
47
  ## 配套 git 提交工具
6
48
 
7
49
  ### 安装
@@ -12,7 +54,6 @@ npm i -g young-commit
12
54
 
13
55
  ### 使用
14
56
 
15
- > **依赖 which 命令,Windows 环境请在 git bash 内执行!!!**
16
57
 
17
58
  - 正常使用 `git add` 将要提交的文件添加到暂存区
18
59
 
@@ -1,11 +1,12 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 16:31:41
4
- * @LastEditTime: 2023-07-24 15:04:21
4
+ * @LastEditTime: 2023-09-08 10:35:46
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
8
- const { avatar, nick, cookie } = storeToRefs(useUserStore())
8
+ const user = useUserStore()
9
+ const { avatar, nick } = storeToRefs(user)
9
10
 
10
11
  function loginOut() {
11
12
  showDialog({
@@ -13,8 +14,7 @@ function loginOut() {
13
14
  message: '确认退出登录?',
14
15
  showCancelButton: true,
15
16
  }).then(() => {
16
- // @ts-expect-error
17
- cookie.value = undefined
17
+ user.removeToken()
18
18
  navigateTo(`/login?redirect=${encodeURIComponent(location.href.replace(location.origin, ''))}`)
19
19
  }).catch(() => null)
20
20
  }
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-24 14:21:55
4
- * @LastEditTime: 2023-08-02 10:38:16
4
+ * @LastEditTime: 2023-09-08 10:34:56
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -33,7 +33,7 @@ const form = reactive<LoginForm>({
33
33
  password: '',
34
34
  })
35
35
 
36
- const { cookie } = storeToRefs(useUserStore())
36
+ const user = useUserStore()
37
37
 
38
38
  const formRef = ref<FormInstance>()
39
39
  function sure() {
@@ -41,11 +41,11 @@ function sure() {
41
41
  if (valid) {
42
42
  await apis.post.changePassword(form)
43
43
  hide()
44
- await showDialog({
44
+ showNotify({
45
45
  message: '密码修改成功,请重新登录',
46
+ type: 'success',
46
47
  })
47
- // @ts-expect-error
48
- cookie.value = undefined
48
+ user.removeToken()
49
49
  const redirect = location.pathname === '/login' ? '/' : encodeURIComponent(location.href.replace(location.origin, ''))
50
50
  navigateTo(`/login?redirect=${redirect}`)
51
51
  }
@@ -1,12 +1,12 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 11:55:27
4
- * @LastEditTime: 2023-09-06 16:03:36
4
+ * @LastEditTime: 2023-09-15 15:18:09
5
5
  * @Description:
6
6
  -->
7
7
  <template>
8
8
  <main class="app-main-height w-full">
9
- <NuxtPage :keepalive="!$route.meta.noCache" />
9
+ <NuxtPage keepalive />
10
10
  </main>
11
11
  </template>
12
12
 
@@ -1,11 +1,11 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 16:38:20
4
- * @LastEditTime: 2023-07-28 16:37:04
4
+ * @LastEditTime: 2023-09-13 09:46:18
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
8
- const { isCollapse } = storeToRefs(useNavStore())
8
+ const { isCollapse, breadcrumb_arr } = storeToRefs(useNavStore())
9
9
 
10
10
  function collapseHandler() {
11
11
  if (WindowSize['lt-lg']) {
@@ -36,6 +36,15 @@ function collapseHandler() {
36
36
  class="fold-unfold i-ep-expand" :class="[isCollapse ? '' : 'rotate-180']"
37
37
  :title="`${(isCollapse ? '展开' : '收起')}菜单`" @click="collapseHandler"
38
38
  />
39
+
40
+ <ElBreadcrumb separator="/" class="ml-10px" lt-md="hidden">
41
+ <ElBreadcrumbItem :to="{ path: '/' }">
42
+ 首页
43
+ </ElBreadcrumbItem>
44
+ <ElBreadcrumbItem v-for="(title, index) in breadcrumb_arr" :key="`${index}fsdakjroe`">
45
+ {{ title }}
46
+ </ElBreadcrumbItem>
47
+ </ElBreadcrumb>
39
48
  </div>
40
49
  <div class="right-panel">
41
50
  <TopSearch />
@@ -1,11 +1,14 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 12:25:23
4
- * @LastEditTime: 2023-09-04 09:24:44
4
+ * @LastEditTime: 2023-09-15 15:25:15
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
8
- const { isCollapse, nav_arr } = storeToRefs(useNavStore())
8
+ const { isCollapse, nav_arr, nav_index_map } = storeToRefs(useNavStore())
9
+
10
+ const route = useRoute()
11
+ const active = computed(() => nav_index_map.value.get(route.path))
9
12
  </script>
10
13
 
11
14
  <template>
@@ -14,6 +17,7 @@ const { isCollapse, nav_arr } = storeToRefs(useNavStore())
14
17
 
15
18
  <ElScrollbar>
16
19
  <ElMenu
20
+ :default-active="active"
17
21
  background-color="#001529" text-color="hsla(0,0%,100%,.65)" active-text-color="#fff" unique-opened
18
22
  :collapse="isCollapse || WindowSize['lt-lg']" menu-trigger="click" :collapse-transition="false"
19
23
  >
@@ -68,6 +72,7 @@ const { isCollapse, nav_arr } = storeToRefs(useNavStore())
68
72
 
69
73
  :deep(.el-scrollbar__wrap) {
70
74
  overflow-x: hidden;
75
+ height: calc(100vh - $base-nav-bar-height);
71
76
 
72
77
  .el-menu {
73
78
  border: 0;
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 14:06:48
4
- * @LastEditTime: 2023-07-28 15:59:48
4
+ * @LastEditTime: 2023-09-15 15:24:33
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -15,7 +15,14 @@ const props = withDefaults(defineProps<{
15
15
 
16
16
  const randomKey = randomId()
17
17
  const visibleMenu = computed(() => props.menuList.filter(n => +n.visible === 1))
18
- const { isCollapse } = storeToRefs(useNavStore())
18
+ const { isCollapse, nav_index_map } = storeToRefs(useNavStore())
19
+
20
+ watch(() => visibleMenu.value, (v) => {
21
+ v.forEach((n, i) => {
22
+ nav_index_map.value.set(n.component, (n.component + randomKey + i))
23
+ })
24
+ }, { immediate: true, deep: true })
25
+
19
26
  function collapseMenu() {
20
27
  if (WindowSize['lt-lg'])
21
28
  isCollapse.value = true
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-07-21 17:05:40
4
- * @LastEditTime: 2023-09-06 16:07:49
4
+ * @LastEditTime: 2023-09-18 14:14:12
5
5
  * @Description:
6
6
  -->
7
7
  <script lang="ts" setup>
@@ -21,7 +21,7 @@ function tabClick(e: any) {
21
21
  }
22
22
 
23
23
  const isActive = (view: RouteLocationNormalized) => view.path === route.path
24
- const isAffix = (route: RouteLocationNormalized | RouteRecordRaw) => route?.meta?.affix ?? false
24
+ const isAffix = (route: RouteLocationNormalized | RouteRecordRaw) => visitedViews.value.length === 1 || (route?.meta?.affix ?? false)
25
25
 
26
26
  function toLastView(visitedViews: RouteLocationNormalized[]) {
27
27
  const lastView = visitedViews.slice(-1)[0]
@@ -74,8 +74,8 @@ function closeAllTab() {
74
74
  </ElTabs>
75
75
  </div>
76
76
  <div class="tabs-action">
77
- <ElDropdown trigger="click">
78
- <ElIcon color="rgba(0, 0, 0, 0.65)" :size="20">
77
+ <ElDropdown trigger="click" :disabled="visitedViews.length <= 1">
78
+ <ElIcon color="rgba(0, 0, 0, 0.65)" :size="20" :class="[visitedViews.length <= 1 ? '!cursor-not-allowed' : '!cursor-pointer']">
79
79
  <div class="i-ep-menu" />
80
80
  </ElIcon>
81
81
  <template #dropdown>
@@ -108,7 +108,6 @@ function closeAllTab() {
108
108
  <style lang="scss" scoped>
109
109
  .tabs-action {
110
110
  padding-bottom: 5px;
111
- cursor: pointer;
112
111
 
113
112
  :deep(.el-icon) {
114
113
  transition: all 0.3s;
@@ -1,10 +1,12 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-06-20 17:14:58
4
- * @LastEditTime: 2023-07-26 11:56:53
4
+ * @LastEditTime: 2023-09-08 17:33:20
5
5
  * @Description:
6
6
  */
7
7
  import { useHttp } from '@bluesyoung/http'
8
+ import type { LoadingInstance } from 'element-plus/es/components/loading/src/loading'
9
+ import { ElLoadingService } from 'element-plus'
8
10
  import { useDelete, useGet, usePatch, usePost } from './apis'
9
11
 
10
12
  export function startLoading() {
@@ -17,6 +19,18 @@ export function endLoading() {
17
19
  isLoading.value = false
18
20
  }
19
21
 
22
+ let loading: LoadingInstance
23
+
24
+ export function ajaxStartLoading() {
25
+ loading = ElLoadingService({
26
+ lock: true,
27
+ text: '拼命加载中...',
28
+ background: 'rgba(0, 0, 0, 0.7)',
29
+ })
30
+ }
31
+
32
+ export const ajaxEndLoading = () => loading?.close?.()
33
+
20
34
  const http = useHttp<{
21
35
  code: number
22
36
  data: any
@@ -24,30 +38,15 @@ const http = useHttp<{
24
38
  }>({
25
39
  timeout: -1,
26
40
  loading: {
27
- start: startLoading,
28
- end: endLoading,
41
+ start: ajaxStartLoading,
42
+ end: ajaxEndLoading,
29
43
  },
30
44
  fail: (err: any) => {
31
45
  console.log('🚀 ~ file: api.ts:28 ~ err:', err)
32
- const { cookie } = storeToRefs(useUserStore())
46
+ const user = useUserStore()
33
47
  if (err?.response?.status === 401) {
34
- showDialog({
35
- title: '温馨提示',
36
- message: '未登录或登录过期,请登录后再继续!',
37
- showCancelButton: true,
38
- })
39
- .then(() => {
40
- cookie.value && (cookie.value.uuid = '')
41
- navigateTo(
42
- `/login?redirect=${encodeURIComponent(location.href.replace(location.origin, ''))}`,
43
- )
44
- })
45
- .catch(() => {
46
- navigateTo({
47
- path: '/',
48
- replace: true,
49
- })
50
- })
48
+ user.removeToken()
49
+ checkLogin(true)
51
50
 
52
51
  throw err
53
52
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: zhangyang
3
3
  * @Date: 2023-06-01 12:03:44
4
- * @LastEditTime: 2023-07-28 17:43:00
4
+ * @LastEditTime: 2023-09-15 15:23:04
5
5
  * @Description:
6
6
  */
7
7
  export const useNavStore = defineStore('useNavStore', () => {
@@ -20,7 +20,21 @@ export const useNavStore = defineStore('useNavStore', () => {
20
20
  */
21
21
  const auth_routes = ref<string[]>([])
22
22
 
23
- const active_nav = ref('')
23
+ const breadcrumb_arr = ref<string[]>([])
24
+
25
+ /**
26
+ * 生成节点映射
27
+ */
28
+ const nodeMap = ref<Map<string, NavArrItem>>(new Map())
29
+ const generateNodeMap = (list: NavArrItem[]) => {
30
+ for (const node of list) {
31
+ nodeMap.value.set(node.id.toString(), node)
32
+ if (node.children && node.children?.length > 0)
33
+ generateNodeMap(node.children)
34
+ }
35
+ }
36
+
37
+ const nav_index_map = ref<Map<string, string>>(new Map())
24
38
 
25
39
  const isLoading = ref(false)
26
40
  const isCollapse = ref(false)
@@ -46,11 +60,14 @@ export const useNavStore = defineStore('useNavStore', () => {
46
60
  title,
47
61
  sub_title,
48
62
  nav_arr,
49
- active_nav,
63
+ nav_index_map,
50
64
  flat_nav_arr,
51
65
  auth_routes,
52
66
  isLoading,
53
67
  isCollapse,
68
+ nodeMap,
69
+ breadcrumb_arr,
70
+ generateNodeMap,
54
71
  }
55
72
  })
56
73