@lovrabet/cli 1.1.25 → 1.1.26-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/add-page/input-page-router.js +1 -1
- package/lib/add-page/main.js +1 -1
- package/lib/add-page/select-page-template.js +1 -1
- package/lib/api/api-doc-ui.js +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-pull-ui.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/main.js +1 -1
- package/lib/api/pull-silent.js +1 -1
- package/lib/app-menu/app-menu-sync-ui.js +1 -1
- package/lib/app-menu/create-menu.js +1 -1
- package/lib/app-menu/get-local-pages.js +1 -1
- package/lib/app-menu/get-online-menu-list.js +1 -1
- package/lib/app-menu/use-get-online-menu-list.js +1 -0
- package/lib/app-menu/utils.js +1 -0
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/app-menu-cdn-version/app-menu-sync-cdn-version-ui.js +1 -0
- package/lib/app-menu-cdn-version/cdn-url-compare-table.js +1 -0
- package/lib/app-menu-cdn-version/types.js +1 -0
- package/lib/app-menu-cdn-version/update-menu-cdn-url.js +1 -0
- package/lib/app-menu-update-cdn/current-content.js +1 -0
- package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -0
- package/lib/app-menu-update-cdn/main.js +1 -0
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/cmd/build-watch.js +1 -1
- package/lib/cmd/build.js +1 -1
- package/lib/cmd/logs.js +1 -1
- package/lib/cmd/preview.js +1 -1
- package/lib/cmd/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/create-app/enhanced-guided-create.js +1 -1
- package/lib/create-app/format-elapsed.js +1 -1
- package/lib/create-app/main.js +1 -1
- package/lib/create-app/task-finished.js +1 -1
- package/lib/create-app/task-loading.js +1 -1
- package/lib/create-app/task-running.js +1 -1
- package/lib/create-app/task-time.js +1 -1
- package/lib/create-app/use-copy-project-template.js +1 -1
- package/lib/create-app/use-format-code.js +1 -1
- package/lib/create-app/use-install-dependencies.js +1 -1
- package/lib/help.js +1 -1
- package/lib/init/main.js +1 -1
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/router-updater.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a0_0xfa0e(_0x4af09f,_0x172a56){_0x4af09f=_0x4af09f-0xde;const _0x24207b=a0_0x2420();let _0xfa0e14=_0x24207b[_0x4af09f];return _0xfa0e14;}function a0_0x2420(){const _0x3acb2f=['路径不能以\x20/\x20开头或结尾','existsSync','length','gray','306615VXbBNs','test','\x20←\x20','delete','\x20直接回车确认,或输入自定义路由地址','2702357kWecAo','280JUnYAK','页面路由地址:\x20','green','return','1107086RdMQJW','5136250PQfrKZ','1WSlOIX','路径不能包含连续的\x20/','16tfbXqC','页面路径不合法','startsWith','red','787567suklUP','my-page','slice','6EzQlzG','1871496FRASuC','split','trim','10815104dJCfCr'];a0_0x2420=function(){return _0x3acb2f;};return a0_0x2420();}(function(_0x1f24e5,_0x4f7452){const _0x548c82=a0_0xfa0e,_0x414e09=_0x1f24e5();while(!![]){try{const _0x327107=parseInt(_0x548c82(0xf7))/0x1*(-parseInt(_0x548c82(0xf5))/0x2)+-parseInt(_0x548c82(0xeb))/0x3*(parseInt(_0x548c82(0xf9))/0x4)+-parseInt(_0x548c82(0xf6))/0x5+parseInt(_0x548c82(0xe2))/0x6*(-parseInt(_0x548c82(0xf0))/0x7)+parseInt(_0x548c82(0xe6))/0x8+-parseInt(_0x548c82(0xe3))/0x9+-parseInt(_0x548c82(0xf1))/0xa*(-parseInt(_0x548c82(0xdf))/0xb);if(_0x327107===_0x4f7452)break;else _0x414e09['push'](_0x414e09['shift']());}catch(_0x318d5d){_0x414e09['push'](_0x414e09['shift']());}}}(a0_0x2420,0xbcb84));import{jsx as a0_0x3bd9fd,jsxs as a0_0xaa54d9}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x2c1f9d from'node:fs';export function InputProjectCode(_0x2ab15f){const _0x5b11c9=a0_0xfa0e,{onSubmit:_0x55e01f,pagePath:_0x406881}=_0x2ab15f,[_0x3aae06,_0x27f2df]=useState(''),[_0x5bc463,_0x57bf21]=useState(''),_0x352691=_0x5b11c9(0xe0);function _0x2829ab(_0x41a8e3){const _0x24bf94=_0x5b11c9;if(_0x41a8e3[_0x24bf94(0xe9)]>0x64)return{'valid':![],'message':'页面路径长度不能超过\x20100\x20个字符'};if(_0x41a8e3[_0x24bf94(0xfb)]('/')||_0x41a8e3['endsWith']('/'))return{'valid':![],'message':_0x24bf94(0xe7)};if(_0x41a8e3['includes']('//'))return{'valid':![],'message':_0x24bf94(0xf8)};const _0x7c8520=_0x41a8e3[_0x24bf94(0xe4)]('/');for(const _0x41c55a of _0x7c8520){if(!_0x41c55a)continue;const _0x4ba1d1=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x4ba1d1[_0x24bf94(0xec)](_0x41c55a))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x85d5fb,_0x580647)=>{const _0x494f8c=_0x5b11c9;if(_0x580647[_0x494f8c(0xf4)]){const _0x374e88=_0x3aae06[_0x494f8c(0xe5)]()||_0x352691;if(_0x5bc463)return;const _0x4f495f=_0x406881+'/'+_0x374e88;if(a0_0x2c1f9d[_0x494f8c(0xe8)](_0x4f495f)){_0x57bf21('页面路径\x20'+_0x374e88+'\x20已存在,请使用其他路径');return;}_0x55e01f(_0x374e88),_0x27f2df(''),_0x57bf21('');}else _0x580647['backspace']||_0x580647[_0x494f8c(0xee)]?_0x27f2df(_0x22ade1=>{const _0x31eb54=_0x494f8c,_0x1a0fd9=_0x22ade1[_0x31eb54(0xe1)](0x0,-0x1),{valid:_0x3daca7,message:_0x494764}=_0x2829ab(_0x1a0fd9);return _0x57bf21(_0x3daca7?'':_0x494764||_0x31eb54(0xfa)),_0x1a0fd9;}):_0x27f2df(_0x51c428=>{const _0x55ebe4=_0x494f8c,_0x53b61c=_0x51c428+_0x85d5fb,{valid:_0x40af5a,message:_0x3a4f54}=_0x2829ab(_0x53b61c);return _0x57bf21(_0x40af5a?'':_0x3a4f54||_0x55ebe4(0xfa)),_0x53b61c;});}),a0_0xaa54d9(Box,{'flexDirection':'column','children':[a0_0xaa54d9(Box,{'children':[a0_0x3bd9fd(Text,{'color':_0x5b11c9(0xea),'children':'\x20Step2:\x20'}),a0_0x3bd9fd(Text,{'children':_0x5b11c9(0xf2)}),_0x3aae06?a0_0x3bd9fd(Text,{'color':_0x5b11c9(0xf3),'children':_0x3aae06}):a0_0x3bd9fd(Text,{'color':_0x5b11c9(0xea),'children':_0x352691}),_0x5bc463&&a0_0xaa54d9(Text,{'color':_0x5b11c9(0xde),'children':[_0x5b11c9(0xed),_0x5bc463]})]}),!_0x5bc463&&!_0x3aae06&&a0_0x3bd9fd(Box,{'children':a0_0x3bd9fd(Text,{'color':'gray','children':_0x5b11c9(0xef)})})]});}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0x4e7c90=a1_0x6bc8;(function(_0x35de54,_0x26c343){const _0x2c91c6=a1_0x6bc8,_0x21aba2=_0x35de54();while(!![]){try{const _0x56ac6b=parseInt(_0x2c91c6(0x198))/0x1*(parseInt(_0x2c91c6(0x199))/0x2)+-parseInt(_0x2c91c6(0x1b5))/0x3+parseInt(_0x2c91c6(0x19b))/0x4*(-parseInt(_0x2c91c6(0x19f))/0x5)+-parseInt(_0x2c91c6(0x1b1))/0x6*(parseInt(_0x2c91c6(0x195))/0x7)+parseInt(_0x2c91c6(0x1a1))/0x8+-parseInt(_0x2c91c6(0x1b4))/0x9*(parseInt(_0x2c91c6(0x19c))/0xa)+-parseInt(_0x2c91c6(0x1b8))/0xb*(-parseInt(_0x2c91c6(0x1ba))/0xc);if(_0x56ac6b===_0x26c343)break;else _0x21aba2['push'](_0x21aba2['shift']());}catch(_0x131ccf){_0x21aba2['push'](_0x21aba2['shift']());}}}(a1_0x358b,0xb80c5));import{jsx as a1_0x2afa01,jsxs as a1_0x2af3a5,Fragment as a1_0x36bf09}from'react/jsx-runtime';import{fileURLToPath}from'node:url';function a1_0x6bc8(_0x128f3c,_0x12623c){_0x128f3c=_0x128f3c-0x194;const _0x358bc8=a1_0x358b();let _0x6bc82e=_0x358bc8[_0x128f3c];return _0x6bc82e;}import a1_0x289f89 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a1_0x358b(){const _0x31ce0c=['catch','green','\x20*\x20页面路径:\x20','开始添加页面:\x20','2550282oCmtnP','info','正在创建页面,请稍候…','10260eNqmkr','322563TCKyaJ','join','gray','32219OuOggw','then','7608MMPefF','setLogPath','resolve','7cpyQlq','\x20*\x20页面文件已创建,可直接通过路由访问','processTemplate','10732WIhFpB','4QgdHHy','error','80RhSjuK','1850HXVxxd','../../templates/pages','\x20*\x20路由地址:\x20','180985rrZYls','已选择页面模板\x20','2742552iNsxaX','src','finally','\x20Step1:\x20','pages','已输入的页面路由\x20','\x20*\x20页面创建成功!','页面添加成功:\x20','dirname','message','add-page','now'];a1_0x358b=function(){return _0x31ce0c;};return a1_0x358b();}import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x289f89[a1_0x4e7c90(0x1a9)](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x289f89['resolve'](__dirname,a1_0x4e7c90(0x19d)),projectDir=process['cwd']();export const AddPage=()=>{const _0x2f2d06=a1_0x4e7c90,{exit:_0x41004d}=useApp(),[_0x59ef8e,_0x57589]=useState(''),[_0x48fe2c,_0x358772]=useState(''),[_0xfff8ba,_0x3a00c8]=useState(![]),[_0x831ed,_0x38b4cb]=useState(![]),_0x4ab5eb=a1_0x289f89[_0x2f2d06(0x1b6)](projectDir,_0x2f2d06(0x1a2),_0x2f2d06(0x1a5)),_0x4f453c=a1_0x289f89[_0x2f2d06(0x1b6)](_0x4ab5eb,_0x48fe2c),_0x23932c=a1_0x289f89[_0x2f2d06(0x1b6)](_0x2f2d06(0x1a2),'pages',_0x48fe2c);useEffect(()=>{const _0x6aea37=_0x2f2d06,_0x148a63=a1_0x289f89[_0x6aea37(0x194)](pageTemplateDir,_0x59ef8e);if(_0x59ef8e&&_0x48fe2c){_0x3a00c8(!![]),logger[_0x6aea37(0x1bb)](process['cwd']());const _0x174bd7=Date[_0x6aea37(0x1ac)]();logger[_0x6aea37(0x1b2)](_0x6aea37(0x1ab),_0x6aea37(0x1b0)+_0x48fe2c,{'template':_0x59ef8e,'targetPath':_0x23932c}),TemplateReplacer[_0x6aea37(0x197)](_0x148a63,a1_0x289f89[_0x6aea37(0x1b6)](_0x4ab5eb,_0x48fe2c),_0x48fe2c,_0x59ef8e)[_0x6aea37(0x1b9)](()=>{const _0x5db6a=_0x6aea37,_0x278bbe=Date[_0x5db6a(0x1ac)]()-_0x174bd7;logger['success'](_0x5db6a(0x1ab),_0x5db6a(0x1a8)+_0x48fe2c,_0x278bbe,{'template':_0x59ef8e,'targetPath':_0x23932c,'routePath':_0x48fe2c}),_0x38b4cb(!![]);})[_0x6aea37(0x1ad)](_0x444c54=>{const _0x2c9e52=_0x6aea37,_0x4084af=Date[_0x2c9e52(0x1ac)]()-_0x174bd7;logger[_0x2c9e52(0x19a)](_0x2c9e52(0x1ab),'页面添加失败:\x20'+_0x48fe2c,{'template':_0x59ef8e,'targetPath':_0x23932c,'error':_0x444c54 instanceof Error?_0x444c54[_0x2c9e52(0x1aa)]:String(_0x444c54),'duration':_0x4084af});})[_0x6aea37(0x1a3)](()=>{_0x3a00c8(![]);});}},[_0x59ef8e,_0x48fe2c]),useEffect(()=>{_0x831ed&&setTimeout(()=>{_0x41004d();});},[_0x831ed]);if(_0x59ef8e)return a1_0x2af3a5(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0x2af3a5(Box,{'children':[a1_0x2afa01(Text,{'color':_0x2f2d06(0x1b7),'children':_0x2f2d06(0x1a4)}),a1_0x2afa01(Text,{'children':_0x2f2d06(0x1a0)}),a1_0x2afa01(Text,{'color':_0x2f2d06(0x1ae),'children':_0x59ef8e})]}),_0x48fe2c?a1_0x2af3a5(Box,{'children':[a1_0x2afa01(Text,{'color':_0x2f2d06(0x1b7),'children':'\x20Step2:\x20'}),a1_0x2afa01(Text,{'children':_0x2f2d06(0x1a6)}),a1_0x2afa01(Text,{'color':_0x2f2d06(0x1ae),'children':_0x48fe2c})]}):a1_0x2afa01(InputProjectCode,{'pagePath':_0x4f453c,'onSubmit':_0x358772}),_0x48fe2c&&_0xfff8ba?a1_0x2af3a5(Box,{'marginTop':0x1,'children':[a1_0x2afa01(Box,{'width':'4'}),a1_0x2afa01(Text,{'children':_0x2f2d06(0x1b3)})]}):null,_0x831ed?a1_0x2af3a5(a1_0x36bf09,{'children':[a1_0x2afa01(Box,{'marginTop':0x1,'children':a1_0x2afa01(Text,{'color':_0x2f2d06(0x1b7),'children':_0x2f2d06(0x1a7)})}),a1_0x2af3a5(Box,{'children':[a1_0x2afa01(Text,{'color':_0x2f2d06(0x1b7),'children':_0x2f2d06(0x1af)}),a1_0x2afa01(Text,{'color':_0x2f2d06(0x1ae),'children':_0x23932c})]}),a1_0x2af3a5(Box,{'children':[a1_0x2afa01(Text,{'color':_0x2f2d06(0x1b7),'children':_0x2f2d06(0x19e)}),a1_0x2af3a5(Text,{'color':'green','children':['/',_0x48fe2c]})]}),a1_0x2afa01(Box,{'marginTop':0x1,'children':a1_0x2afa01(Text,{'color':'cyan','children':_0x2f2d06(0x196)})})]}):null]});return a1_0x2afa01(SelectPageTemplate,{'onSelect':_0x57589});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x32f858,_0x544a96){const _0x43c04c=a2_0x3f06,_0x4d3a1f=_0x32f858();while(!![]){try{const _0x202c62=-parseInt(_0x43c04c(0x1f1))/0x1*(-parseInt(_0x43c04c(0x1f6))/0x2)+parseInt(_0x43c04c(0x1fe))/0x3*(parseInt(_0x43c04c(0x1f8))/0x4)+parseInt(_0x43c04c(0x1fd))/0x5*(parseInt(_0x43c04c(0x1f5))/0x6)+parseInt(_0x43c04c(0x1e9))/0x7*(-parseInt(_0x43c04c(0x1e3))/0x8)+-parseInt(_0x43c04c(0x1e7))/0x9*(parseInt(_0x43c04c(0x1e6))/0xa)+parseInt(_0x43c04c(0x1ef))/0xb+-parseInt(_0x43c04c(0x202))/0xc;if(_0x202c62===_0x544a96)break;else _0x4d3a1f['push'](_0x4d3a1f['shift']());}catch(_0x3abf22){_0x4d3a1f['push'](_0x4d3a1f['shift']());}}}(a2_0x3bb3,0x5e5d8));import{jsx as a2_0x2f9cfb,jsxs as a2_0x3f5a08}from'react/jsx-runtime';function a2_0x3bb3(){const _0x56879d=['blank','../..','正在加载页面模板...','12765NEqWKo','6894jZcwhp','gray','请选择您要创建的页面模板','isDirectory','3826944zYjSNN','downArrow','获取模板列表失败:','map','4503160imwGLk','green','label','270IgIssL','104049ERovRn','sdk-fetch','7KlvPva','\x20\x20\x20\x20\x20\x20>\x20','join','length','name','onSelect','3168594GEWPan','dirname','1INSPaB','return','column','templates/pages','450jKwwmV','1020718vGloWX','localeCompare','1028pGRlMz','upArrow'];a2_0x3bb3=function(){return _0x56879d;};return a2_0x3bb3();}import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x4119ad from'node:path';function a2_0x3f06(_0x4f444f,_0x42d471){_0x4f444f=_0x4f444f-0x1e0;const _0x3bb3ca=a2_0x3bb3();let _0x3f065d=_0x3bb3ca[_0x4f444f];return _0x3f065d;}import{fileURLToPath}from'node:url';async function getTemplateList(){const _0x1c37b0=a2_0x3f06;try{const _0x531a1e=fileURLToPath(import.meta.url),_0x14b59f=a2_0x4119ad['resolve'](a2_0x4119ad[_0x1c37b0(0x1f0)](_0x531a1e),_0x1c37b0(0x1fb)),_0x12fc69=a2_0x4119ad[_0x1c37b0(0x1eb)](_0x14b59f,_0x1c37b0(0x1f4)),_0x4be737=await readdir(_0x12fc69,{'withFileTypes':!![]}),_0x269d88=_0x4be737['filter'](_0x3759a2=>_0x3759a2[_0x1c37b0(0x201)]())[_0x1c37b0(0x1e2)](_0x3bd23b=>({'label':_0x3bd23b[_0x1c37b0(0x1ed)]}))['sort']((_0x2367a2,_0x304426)=>_0x2367a2[_0x1c37b0(0x1e5)][_0x1c37b0(0x1f7)](_0x304426['label']));return _0x269d88;}catch(_0x2cf688){return console['error'](_0x1c37b0(0x1e1),_0x2cf688),[{'label':_0x1c37b0(0x1fa)},{'label':_0x1c37b0(0x1e8)}];}}export function SelectPageTemplate(_0x2461c5){const _0x108bdb=a2_0x3f06,[_0x460355,_0x54da27]=useState(0x0),[_0x53bde6,_0x4333c4]=useState([]),[_0x4521f0,_0xd3bbbc]=useState(!![]);useEffect(()=>{async function _0x11d39c(){const _0x2353bb=await getTemplateList();_0x4333c4(_0x2353bb),_0xd3bbbc(![]);}_0x11d39c();},[]),useInput((_0x45197d,_0x42d8d0)=>{const _0x39f173=a2_0x3f06;if(_0x4521f0)return;if(_0x42d8d0[_0x39f173(0x1f2)]){const _0x5aba98=_0x53bde6[_0x460355];_0x5aba98&&_0x2461c5[_0x39f173(0x1ee)](_0x5aba98[_0x39f173(0x1e5)]);}_0x42d8d0[_0x39f173(0x1f9)]&&_0x54da27(_0x22447c=>_0x22447c===0x0?_0x53bde6['length']-0x1:_0x22447c-0x1),_0x42d8d0[_0x39f173(0x1e0)]&&_0x54da27(_0xf520a6=>_0xf520a6===_0x53bde6[_0x39f173(0x1ec)]-0x1?0x0:_0xf520a6+0x1);});if(_0x4521f0)return a2_0x2f9cfb(Box,{'flexDirection':_0x108bdb(0x1f3),'paddingY':0x1,'children':a2_0x3f5a08(Box,{'children':[a2_0x2f9cfb(Text,{'color':'gray','children':'\x20Step1:\x20'}),a2_0x2f9cfb(Text,{'children':_0x108bdb(0x1fc)})]})});return a2_0x3f5a08(Box,{'flexDirection':_0x108bdb(0x1f3),'paddingY':0x1,'children':[a2_0x3f5a08(Box,{'children':[a2_0x2f9cfb(Text,{'color':_0x108bdb(0x1ff),'children':'\x20Step1:\x20'}),a2_0x2f9cfb(Text,{'children':_0x108bdb(0x200)})]}),_0x53bde6['map']((_0x2fef2c,_0x573332)=>{const _0x53e577=_0x108bdb,_0x887cab=_0x573332===_0x460355,_0x466b0c=_0x887cab?_0x53e577(0x1ea)+_0x2fef2c[_0x53e577(0x1e5)]:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x2fef2c[_0x53e577(0x1e5)];return a2_0x2f9cfb(Box,{'children':a2_0x2f9cfb(Text,{'color':_0x887cab?_0x53e577(0x1e4):undefined,'children':_0x466b0c})},_0x466b0c);})]});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a3_0x48a3(){const _0x5b0492=['\x20-\x20','\x20重新登录后再试','includes','\x1b[33m!\x20以下数据集代码不存在:\x20','cyan','dim','文档生成完成','api-doc','setLogPath','32iVsGaa','💡\x20请使用\x20','\x20个匹配的数据集\x1b[0m','column','./docs','10aFyoYE','filter','\x1b[90m*\x20从\x20','gray',',\x20失败\x20','🚀\x20','filePath','2901488EnrqlY','正在获取数据集列表...','error','message','online','7fsAEOz','green','datasetCode','join','1689570kOgmkh','yellow','.md\x20(','未提供应用AppCode,且配置中也没有默认值','\x20个数据集','log','env','length','25609hgPHLT','指定的数据集代码都不存在:\x20','1086628nXNhaA','2286gPxABe','string','18980dMCXAZ','success','496584AaaqnA','⚠️\x20以下数据集生成失败:','未找到任何数据集','red','\x20个数据集中筛选出\x20','*\x20生成的文档文件:','474738CwsyHa','正在生成\x20','使用指定的应用AppCode:\x20','cwd','使用配置的应用AppCode:\x20','√\x20文档生成完成!成功\x20','map','white'];a3_0x48a3=function(){return _0x5b0492;};return a3_0x48a3();}(function(_0x1d2b5e,_0x455782){const _0x22d8ef=a3_0x5611,_0x573cad=_0x1d2b5e();while(!![]){try{const _0x39cd91=parseInt(_0x22d8ef(0x204))/0x1*(parseInt(_0x22d8ef(0x1e7))/0x2)+parseInt(_0x22d8ef(0x20b))/0x3+-parseInt(_0x22d8ef(0x206))/0x4*(-parseInt(_0x22d8ef(0x1ec))/0x5)+parseInt(_0x22d8ef(0x1fc))/0x6+-parseInt(_0x22d8ef(0x1f8))/0x7*(parseInt(_0x22d8ef(0x1f3))/0x8)+-parseInt(_0x22d8ef(0x207))/0x9*(parseInt(_0x22d8ef(0x209))/0xa)+-parseInt(_0x22d8ef(0x1d6))/0xb;if(_0x39cd91===_0x455782)break;else _0x573cad['push'](_0x573cad['shift']());}catch(_0x1a7252){_0x573cad['push'](_0x573cad['shift']());}}}(a3_0x48a3,0x7d0f5));function a3_0x5611(_0x3b7c75,_0x12856e){_0x3b7c75=_0x3b7c75-0x1d5;const _0x48a377=a3_0x48a3();let _0x56117b=_0x48a377[_0x3b7c75];return _0x56117b;}import{jsx as a3_0x369fda,jsxs as a3_0x89ef0b,Fragment as a3_0x35ccfb}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x49a123,env:_0x230504,output:_0x5a4108,extraParams:_0x4ef60f,datasetCodes:_0x161404})=>{const _0x52969c=a3_0x5611,{exit:_0x328074}=useApp(),[_0x27482e,_0x2bca8e]=useState(![]),[_0x473adb,_0x339c1b]=useState(''),[_0x31ebac,_0x44bd35]=useState(![]),[_0x5a47fc,_0x9e4271]=useState(null),[_0x2a663b,_0x124041]=useState(null),[_0x140dff,_0x1d011d]=useState(0x0),_0x440d37=readConfig(),_0x4af17b=getConfigAppCode(),_0x5cef42=_0x49a123||_0x4af17b,_0x3a3f23=typeof _0x440d37?.[_0x52969c(0x202)]===_0x52969c(0x208)?_0x440d37[_0x52969c(0x202)]:undefined,_0x41f8b5=_0x230504||_0x3a3f23||_0x52969c(0x1f7);initEnv(_0x41f8b5);const _0x489258=_0x5a4108||_0x52969c(0x1eb),_0x5d9836=_0x49a123?_0x52969c(0x1d8)+_0x5cef42:_0x52969c(0x1da)+_0x5cef42;useEffect(()=>{_0x2bca8e(!![]),_0x5557ec();},[]),useEffect(()=>{(_0x31ebac||_0x5a47fc)&&_0x328074();},[_0x31ebac,_0x5a47fc,_0x328074]);async function _0x5557ec(){const _0x47e774=_0x52969c;if(!_0x5cef42){_0x9e4271(_0x47e774(0x1ff));return;}try{logger[_0x47e774(0x1e6)](process[_0x47e774(0x1d9)]()),_0x339c1b(_0x47e774(0x1f4));const {configArray:_0x2d82cc}=await fetchModelList(_0x5cef42);_0x1d011d(_0x2d82cc[_0x47e774(0x203)]);if(_0x2d82cc[_0x47e774(0x203)]===0x0){_0x9e4271(_0x47e774(0x20d));return;}let _0x4916f4=_0x2d82cc;if(_0x161404&&_0x161404[_0x47e774(0x203)]>0x0){_0x4916f4=_0x2d82cc[_0x47e774(0x1ed)](_0x266c7f=>_0x161404[_0x47e774(0x1e0)](_0x266c7f['datasetCode']));const _0x3c0779=_0x4916f4['map'](_0x1a21fa=>_0x1a21fa['datasetCode']),_0x4f2e07=_0x161404[_0x47e774(0x1ed)](_0x3a8bd3=>!_0x3c0779['includes'](_0x3a8bd3));_0x4f2e07[_0x47e774(0x203)]>0x0&&console[_0x47e774(0x201)](_0x47e774(0x1e1)+_0x4f2e07[_0x47e774(0x1fb)](',\x20')+'\x1b[0m');if(_0x4916f4['length']===0x0){_0x9e4271(_0x47e774(0x205)+_0x161404[_0x47e774(0x1fb)](',\x20'));return;}console[_0x47e774(0x201)](_0x47e774(0x1ee)+_0x2d82cc[_0x47e774(0x203)]+_0x47e774(0x20f)+_0x4916f4['length']+_0x47e774(0x1e9));}_0x339c1b(_0x47e774(0x1d7)+_0x4916f4[_0x47e774(0x203)]+'\x20个数据集的文档...');const _0x24fa49=await generateDatasetDocs(_0x4916f4,_0x5cef42,_0x489258,(_0x299682,_0xb4cd7,_0x2a8a7e)=>{const _0xcc3676=_0x47e774;_0x339c1b(_0xcc3676(0x1d7)+_0x2a8a7e+_0xcc3676(0x1fe)+_0x299682+'/'+_0xb4cd7+')');},_0x4ef60f);_0x124041(_0x24fa49),_0x44bd35(!![]);const _0x21f21b=_0x24fa49[_0x47e774(0x1ed)](_0x154b57=>_0x154b57[_0x47e774(0x20a)])['length'],_0x3476d8=_0x24fa49[_0x47e774(0x1ed)](_0x204929=>!_0x204929[_0x47e774(0x20a)])['length'];logger[_0x47e774(0x20a)](_0x47e774(0x1e5),_0x47e774(0x1e4),undefined,{'totalCount':_0x24fa49[_0x47e774(0x203)],'successCount':_0x21f21b,'failCount':_0x3476d8,'outputDir':_0x489258});}catch(_0x5e3fd9){const _0x422788=_0x5e3fd9 instanceof Error?_0x5e3fd9[_0x47e774(0x1f6)]:String(_0x5e3fd9);logger[_0x47e774(0x1f5)](_0x47e774(0x1e5),'文档生成失败:\x20'+_0x422788,{'appCode':_0x5cef42,'outputDir':_0x489258}),_0x9e4271('文档生成失败:\x20'+_0x422788);}finally{_0x2bca8e(![]);}}const _0x56138c=_0x2a663b?.['filter'](_0x145037=>_0x145037['success'])[_0x52969c(0x203)]||0x0,_0x52e013=_0x2a663b?.[_0x52969c(0x1ed)](_0x28101e=>!_0x28101e[_0x52969c(0x20a)])['length']||0x0;return a3_0x89ef0b(Box,{'flexDirection':_0x52969c(0x1ea),'children':[(_0x27482e||_0x31ebac)&&a3_0x89ef0b(Box,{'children':[a3_0x369fda(Text,{'color':_0x52969c(0x1ef),'children':'*\x20'}),a3_0x369fda(Text,{'color':_0x49a123?_0x52969c(0x1dd):_0x52969c(0x1e3),'children':_0x5d9836})]}),_0x27482e&&a3_0x369fda(Box,{'children':a3_0x89ef0b(Text,{'children':[_0x52969c(0x1f1),_0x473adb,'\x20(环境:\x20',_0x41f8b5,')']})}),_0x31ebac&&_0x2a663b&&a3_0x89ef0b(Box,{'flexDirection':_0x52969c(0x1ea),'children':[a3_0x369fda(Box,{'children':a3_0x89ef0b(Text,{'color':_0x52969c(0x1f9),'children':[_0x52969c(0x1db),_0x56138c,'\x20个',_0x52e013>0x0&&_0x52969c(0x1f0)+_0x52e013+'\x20个']})}),a3_0x369fda(Box,{'marginTop':0x1,'children':a3_0x89ef0b(Text,{'color':'gray','children':['*\x20共处理\x20',_0x140dff,_0x52969c(0x200)]})}),a3_0x89ef0b(Box,{'marginTop':0x1,'children':[a3_0x369fda(Text,{'color':_0x52969c(0x1ef),'children':'*\x20输出目录:\x20'}),a3_0x369fda(Text,{'color':_0x52969c(0x1e2),'children':_0x489258})]}),_0x56138c>0x0&&a3_0x89ef0b(a3_0x35ccfb,{'children':[a3_0x369fda(Box,{'marginTop':0x1,'children':a3_0x369fda(Text,{'color':_0x52969c(0x1ef),'children':_0x52969c(0x1d5)})}),_0x2a663b['filter'](_0x443c97=>_0x443c97[_0x52969c(0x20a)])['map']((_0x64cf67,_0x14512a)=>a3_0x89ef0b(Box,{'marginLeft':0x2,'children':[a3_0x89ef0b(Text,{'color':_0x52969c(0x1e2),'children':['•\x20',_0x64cf67[_0x52969c(0x1f2)]]}),a3_0x89ef0b(Text,{'color':'dim','children':[_0x52969c(0x1de),_0x64cf67['datasetName']]})]},_0x14512a))]}),_0x52e013>0x0&&a3_0x89ef0b(a3_0x35ccfb,{'children':[a3_0x369fda(Box,{'marginTop':0x1,'children':a3_0x369fda(Text,{'color':_0x52969c(0x1fd),'children':_0x52969c(0x20c)})}),_0x2a663b[_0x52969c(0x1ed)](_0x592aba=>!_0x592aba[_0x52969c(0x20a)])[_0x52969c(0x1dc)]((_0x1d67cf,_0x343ce5)=>a3_0x89ef0b(Box,{'marginLeft':0x2,'flexDirection':'column','children':[a3_0x89ef0b(Text,{'color':_0x52969c(0x20e),'children':['•\x20',_0x1d67cf['datasetName'],'\x20(',_0x1d67cf[_0x52969c(0x1fa)],')']}),_0x1d67cf[_0x52969c(0x1f5)]&&a3_0x369fda(Box,{'marginLeft':0x2,'children':a3_0x369fda(Text,{'color':_0x52969c(0x1e3),'children':_0x1d67cf[_0x52969c(0x1f5)]})})]},_0x343ce5))]})]}),_0x5a47fc&&a3_0x89ef0b(Box,{'flexDirection':'column','children':[a3_0x369fda(Box,{'children':a3_0x89ef0b(Text,{'color':'red','children':['❌\x20',_0x5a47fc]})}),_0x5a47fc[_0x52969c(0x1e0)]('登录')&&a3_0x89ef0b(Box,{'marginTop':0x1,'children':[a3_0x369fda(Text,{'color':_0x52969c(0x1fd),'children':_0x52969c(0x1e8)}),a3_0x369fda(Text,{'color':_0x52969c(0x1e2),'children':'lovrabet\x20auth'}),a3_0x369fda(Text,{'color':_0x52969c(0x1fd),'children':_0x52969c(0x1df)})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a4_0x5916a0=a4_0x3737;function a4_0x3737(_0x83916a,_0x46bf5c){_0x83916a=_0x83916a-0x75;const _0x46a27c=a4_0x46a2();let _0x3737f3=_0x46a27c[_0x83916a];return _0x3737f3;}(function(_0x34ab85,_0xdfa1a2){const _0x5e26b5=a4_0x3737,_0xdecdc1=_0x34ab85();while(!![]){try{const _0x3d2837=-parseInt(_0x5e26b5(0x82))/0x1*(parseInt(_0x5e26b5(0x75))/0x2)+-parseInt(_0x5e26b5(0x95))/0x3*(parseInt(_0x5e26b5(0x83))/0x4)+-parseInt(_0x5e26b5(0x7e))/0x5+-parseInt(_0x5e26b5(0x91))/0x6*(-parseInt(_0x5e26b5(0x8b))/0x7)+parseInt(_0x5e26b5(0x96))/0x8+parseInt(_0x5e26b5(0x81))/0x9+-parseInt(_0x5e26b5(0x85))/0xa;if(_0x3d2837===_0xdfa1a2)break;else _0xdecdc1['push'](_0xdecdc1['shift']());}catch(_0x34ec18){_0xdecdc1['push'](_0xdecdc1['shift']());}}}(a4_0x46a2,0x77a18));function a4_0x46a2(){const _0x1db873=['error','api-doc','1583485CAUPGk','✗\x20失败:\x20','data','2371113plBkyc','9466qpKTqP','8252YmWoZd','datasetCode','915070bEfSRD','.md','tableName','stringify','等待\x203\x20秒...\x0a','join','12894JocjWL','text','生成文档失败:\x20','name','\x20个数据集需要生成文档\x0a','log','2598oHqdrB','),HTTP状态码:\x20','application/json','status','225nnWDsx','4403104Rryupn','push','markdown','响应数据格式错误\x20(','./docs','118ztvqMs','string','.md\x20-\x20','生成文档成功:\x20','):缺少\x20data.markdown\x20字段','\x0a共有\x20','length'];a4_0x46a2=function(){return _0x1db873;};return a4_0x46a2();}import{mkdirSync,writeFileSync}from'node:fs';import a4_0x5af51b from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x5610cd){const _0x28e687=a4_0x3737,{appCode:_0x2d066d,datasetCode:_0x427413,datasetId:_0x21ec6e,extraParams:_0x4f0469}=_0x5610cd,_0x588ce0=getApiDomain(),_0x1e0656=_0x588ce0+'/api/node-toolbox/api-doc-generator',_0xd1450b={'appCode':_0x2d066d,'datasetCode':_0x427413,'datasetId':_0x21ec6e,..._0x4f0469||{}},_0xf217e=await fetch(_0x1e0656,{'method':'POST','headers':{'Content-Type':_0x28e687(0x93),'Cookie':getCookie()},'body':JSON[_0x28e687(0x88)](_0xd1450b)});if(!_0xf217e['ok']){if(_0xf217e[_0x28e687(0x94)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');let _0x1c7d8b='';try{_0x1c7d8b=await _0xf217e[_0x28e687(0x8c)]();}catch(_0x5e72c7){}throw new Error('获取文档失败\x20('+_0x427413+_0x28e687(0x92)+_0xf217e[_0x28e687(0x94)]+(_0x1c7d8b?'\x0a'+_0x1c7d8b:''));}const _0x544c30=await _0xf217e['json']();if(!_0x544c30['data']||typeof _0x544c30['data'][_0x28e687(0x98)]!==_0x28e687(0x76))throw new Error(_0x28e687(0x99)+_0x427413+_0x28e687(0x79));return _0x544c30[_0x28e687(0x80)][_0x28e687(0x98)];}function delay(_0x3cb4b2){return new Promise(_0x39e5a4=>setTimeout(_0x39e5a4,_0x3cb4b2));}export async function generateDatasetDocs(_0x1e9640,_0x2bdd47,_0x5cdbe7=a4_0x5916a0(0x9a),_0x54d273,_0x4a4ba3){const _0x38eb96=a4_0x5916a0;mkdirSync(_0x5cdbe7,{'recursive':!![]});const _0x3ce95d=[],_0x4fca59=_0x1e9640[_0x38eb96(0x7b)];console['log'](_0x38eb96(0x7a)+_0x4fca59+_0x38eb96(0x8f));for(let _0x4a804f=0x0;_0x4a804f<_0x1e9640[_0x38eb96(0x7b)];_0x4a804f++){const _0xe95b03=_0x1e9640[_0x4a804f],_0x1d5b43=_0x4a804f+0x1,_0x494ce6=_0xe95b03[_0x38eb96(0x87)];try{console[_0x38eb96(0x90)]('['+_0x1d5b43+'/'+_0x4fca59+']\x20正在生成:\x20'+_0x494ce6+'.md\x20('+_0xe95b03[_0x38eb96(0x8e)]+')');_0x54d273&&_0x54d273(_0x1d5b43,_0x4fca59,_0x494ce6);const _0x2e7534=await fetchDatasetDoc({'appCode':_0x2bdd47,'datasetCode':_0xe95b03[_0x38eb96(0x84)],'datasetId':_0xe95b03['id'],'enableAI':![],'extraParams':_0x4a4ba3}),_0x4347b7=a4_0x5af51b[_0x38eb96(0x8a)](_0x5cdbe7,_0x494ce6+_0x38eb96(0x86));writeFileSync(_0x4347b7,_0x2e7534,{'encoding':'utf8'}),console['log']('✓\x20成功生成:\x20'+_0x494ce6+_0x38eb96(0x86)),logger['success'](_0x38eb96(0x7d),_0x38eb96(0x78)+_0x494ce6,undefined,{'datasetCode':_0xe95b03['datasetCode'],'datasetName':_0xe95b03[_0x38eb96(0x8e)],'filePath':_0x4347b7,'progress':_0x1d5b43+'/'+_0x4fca59}),_0x3ce95d['push']({'datasetCode':_0xe95b03[_0x38eb96(0x84)],'datasetName':_0xe95b03[_0x38eb96(0x8e)],'filePath':_0x4347b7,'success':!![]}),_0x1d5b43<_0x4fca59&&await delay(0x1388);}catch(_0x41e5d4){const _0x3c5a06=_0x41e5d4 instanceof Error?_0x41e5d4['message']:String(_0x41e5d4);console[_0x38eb96(0x90)](_0x38eb96(0x7f)+_0x494ce6+_0x38eb96(0x77)+_0x3c5a06+'\x0a'),logger[_0x38eb96(0x7c)](_0x38eb96(0x7d),_0x38eb96(0x8d)+_0xe95b03['datasetCode'],{'datasetCode':_0xe95b03[_0x38eb96(0x84)],'datasetName':_0xe95b03['name'],'error':_0x3c5a06,'progress':_0x1d5b43+'/'+_0x4fca59}),_0x3ce95d[_0x38eb96(0x97)]({'datasetCode':_0xe95b03[_0x38eb96(0x84)],'datasetName':_0xe95b03[_0x38eb96(0x8e)],'filePath':'','success':![],'error':_0x3c5a06}),_0x1d5b43<_0x4fca59&&(console[_0x38eb96(0x90)](_0x38eb96(0x89)),await delay(0xbb8));}}return _0x3ce95d;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x12318e,_0x37b014){const _0x27845b=a5_0xbbae,_0x5f1be4=_0x12318e();while(!![]){try{const _0x6a7f48=-parseInt(_0x27845b(0x18f))/0x1*(parseInt(_0x27845b(0x1b0))/0x2)+-parseInt(_0x27845b(0x1ad))/0x3+parseInt(_0x27845b(0x19a))/0x4*(-parseInt(_0x27845b(0x1a2))/0x5)+parseInt(_0x27845b(0x1a3))/0x6*(-parseInt(_0x27845b(0x1aa))/0x7)+-parseInt(_0x27845b(0x1a5))/0x8*(parseInt(_0x27845b(0x1b1))/0x9)+parseInt(_0x27845b(0x191))/0xa+-parseInt(_0x27845b(0x19e))/0xb*(-parseInt(_0x27845b(0x1a7))/0xc);if(_0x6a7f48===_0x37b014)break;else _0x5f1be4['push'](_0x5f1be4['shift']());}catch(_0x120a05){_0x5f1be4['push'](_0x5f1be4['shift']());}}}(a5_0x2742,0x36851));import{jsx as a5_0x5c18b3,jsxs as a5_0x260dff}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';function a5_0xbbae(_0x23a15b,_0x13c95d){_0x23a15b=_0x23a15b-0x17c;const _0x27429d=a5_0x2742();let _0xbbae45=_0x27429d[_0x23a15b];return _0xbbae45;}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';function a5_0x2742(){const _0xedd3f5=['length','datasetCount','includes','column','string','√\x20成功拉取\x20','{\x20lovrabetClient\x20}','api-pull','setLogPath','\x20-\x20客户端实例文件','-api','lovrabet\x20auth','modelCount','gray','api','使用配置的应用AppCode:\x20','545odTUns','\x20个模型','2571610ldewpE','💡\x20请使用\x20','\x20个数据集,生成','-\x20模型配置文件\x20(','拉取\x20API\x20配置失败:\x20','./src/api/','未提供应用AppCode,且配置中也没有默认值','\x20个模型)','replace','20FQSEKc','green','cwd','red','14937109wMKMmb','duplicateCount','yellow','slice','160235EwKask','1380CEfTwx','使用指定的应用AppCode:\x20','152CneTma','endsWith','12DChDQI','originalCount','.ts','434kIPlRU','import\x20','client','1203042lOCegf','!\x20原始数据集\x20','*\x20导入方式:','1400MnvbBO','205938cMZeib','split','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','*\x20已生成文件:','\x20个,过滤重复','white','\x20from\x20\x27@/','cyan','\x20重新登录后再试','dim'];a5_0x2742=function(){return _0xedd3f5;};return a5_0x2742();}import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x19d021,env:_0x4d140c,output:_0x1100bf})=>{const _0x36aa3e=a5_0xbbae,{exit:_0x3a80a9}=useApp(),[_0x6896e2,_0x474027]=useState(![]),[_0x24332b,_0x160a6c]=useState(![]),[_0x555184,_0x4fa3cc]=useState(null),[_0x76c535,_0x3ba262]=useState(null),_0x403ad7=readConfig(),_0x595524=getConfigAppCode(),_0x471bf8=_0x19d021||_0x595524,_0x520c29=typeof _0x403ad7?.['env']===_0x36aa3e(0x183)?_0x403ad7['env']:undefined,_0x3834c7=_0x4d140c||_0x520c29||'online';initEnv(_0x3834c7);const _0x9c47a8=_0x1100bf||_0x36aa3e(0x196),_0x4172f7=_0x19d021&&_0x19d021[_0x36aa3e(0x181)]('-')?_0x19d021[_0x36aa3e(0x1b2)]('-')[_0x36aa3e(0x1a1)](0x1)['join']('-'):'',_0x44d8dd=_0x19d021?_0x36aa3e(0x1a4)+_0x471bf8:_0x36aa3e(0x18e)+_0x471bf8,_0x5ca658=_0x4172f7?_0x4172f7+_0x36aa3e(0x189):_0x36aa3e(0x18d),_0x2d0b30=_0x4172f7?_0x4172f7+'-client':_0x36aa3e(0x1ac);useEffect(()=>{_0x474027(!![]),_0x450c4b();},[]),useEffect(()=>{(_0x24332b||_0x555184)&&_0x3a80a9();},[_0x24332b,_0x555184,_0x3a80a9]);async function _0x450c4b(){const _0x3074b1=_0x36aa3e;if(!_0x471bf8){_0x4fa3cc(_0x3074b1(0x197));return;}try{logger[_0x3074b1(0x187)](process[_0x3074b1(0x19c)]());const {configArray:_0x4f259d}=await fetchModelList(_0x471bf8),_0x18cdbb=_0x4f259d[_0x3074b1(0x17f)],_0x50f09a=!_0x19d021,_0x4df718=await generateApiFile(_0x4f259d,_0x4172f7,_0x471bf8,_0x50f09a,_0x3834c7,_0x9c47a8),_0x1ee4c9=_0x9c47a8[_0x3074b1(0x1a6)]('/')?_0x9c47a8:_0x9c47a8+'/';_0x3ba262({'api':''+_0x1ee4c9+_0x5ca658+'.ts','client':''+_0x1ee4c9+_0x2d0b30+_0x3074b1(0x1a9),'modelCount':_0x4df718['modelCount'],'datasetCount':_0x18cdbb,'originalCount':_0x18cdbb,'duplicateCount':0x0}),_0x160a6c(!![]);}catch(_0x55055b){const _0x2a4a64=_0x55055b instanceof Error?_0x55055b['message']:String(_0x55055b);logger['error'](_0x3074b1(0x186),_0x3074b1(0x195)+_0x2a4a64,{'appCode':_0x471bf8,'error':_0x2a4a64}),_0x4fa3cc(_0x3074b1(0x195)+_0x2a4a64);}finally{_0x474027(![]);}}return a5_0x260dff(Box,{'flexDirection':_0x36aa3e(0x182),'children':[(_0x6896e2||_0x24332b)&&a5_0x260dff(Box,{'children':[a5_0x5c18b3(Text,{'color':_0x36aa3e(0x18c),'children':'*\x20'}),a5_0x5c18b3(Text,{'color':_0x19d021?_0x36aa3e(0x1b6):'dim','children':_0x44d8dd})]}),_0x6896e2&&a5_0x5c18b3(Box,{'children':a5_0x260dff(Text,{'children':[_0x36aa3e(0x1b3),_0x3834c7,')']})}),_0x24332b&&_0x76c535&&a5_0x260dff(Box,{'flexDirection':_0x36aa3e(0x182),'children':[a5_0x5c18b3(Box,{'children':a5_0x260dff(Text,{'color':_0x36aa3e(0x19b),'children':[_0x36aa3e(0x184),_0x76c535[_0x36aa3e(0x180)],_0x36aa3e(0x193),'\x20',_0x76c535['modelCount'],_0x36aa3e(0x190)]})}),_0x76c535[_0x36aa3e(0x19f)]>0x0&&a5_0x5c18b3(Box,{'marginTop':0x1,'children':a5_0x260dff(Text,{'color':_0x36aa3e(0x1a0),'children':[_0x36aa3e(0x1ae),_0x76c535[_0x36aa3e(0x1a8)],_0x36aa3e(0x1b5),'\x20',_0x76c535[_0x36aa3e(0x19f)],'\x20个']})}),a5_0x5c18b3(Box,{'marginTop':0x1,'children':a5_0x5c18b3(Text,{'color':_0x36aa3e(0x18c),'children':_0x36aa3e(0x1b4)})}),a5_0x260dff(Box,{'marginLeft':0x2,'children':[a5_0x260dff(Text,{'color':_0x36aa3e(0x17c),'children':['•\x20',_0x76c535[_0x36aa3e(0x18d)]]}),a5_0x260dff(Text,{'color':_0x36aa3e(0x17e),'children':['\x20',_0x36aa3e(0x194),_0x76c535[_0x36aa3e(0x18b)],_0x36aa3e(0x198)]})]}),a5_0x260dff(Box,{'marginLeft':0x2,'children':[a5_0x260dff(Text,{'color':_0x36aa3e(0x17c),'children':['•\x20',_0x76c535[_0x36aa3e(0x1ac)]]}),a5_0x5c18b3(Text,{'color':_0x36aa3e(0x17e),'children':_0x36aa3e(0x188)})]}),a5_0x5c18b3(Box,{'marginTop':0x1,'children':a5_0x5c18b3(Text,{'color':_0x36aa3e(0x18c),'children':_0x36aa3e(0x1af)})}),a5_0x5c18b3(Box,{'marginLeft':0x2,'children':a5_0x260dff(Text,{'color':_0x36aa3e(0x1a0),'children':[_0x36aa3e(0x1ab),_0x36aa3e(0x185),_0x36aa3e(0x1b7),_0x76c535[_0x36aa3e(0x1ac)][_0x36aa3e(0x199)](/^\.\//,'')['replace']('.ts',''),'\x27']})})]}),_0x555184&&a5_0x260dff(Box,{'flexDirection':_0x36aa3e(0x182),'children':[a5_0x5c18b3(Box,{'children':a5_0x260dff(Text,{'color':_0x36aa3e(0x19d),'children':['❌\x20',_0x555184]})}),_0x555184['includes']('登录')&&a5_0x260dff(Box,{'marginTop':0x1,'children':[a5_0x5c18b3(Text,{'color':_0x36aa3e(0x1a0),'children':_0x36aa3e(0x192)}),a5_0x5c18b3(Text,{'color':_0x36aa3e(0x17c),'children':_0x36aa3e(0x18a)}),a5_0x5c18b3(Text,{'color':'yellow','children':_0x36aa3e(0x17d)})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x7cc52e,_0x5a790a){const _0x27d791=a6_0x530a,_0x51eced=_0x7cc52e();while(!![]){try{const _0x5a6019=parseInt(_0x27d791(0x93))/0x1*(parseInt(_0x27d791(0x96))/0x2)+-parseInt(_0x27d791(0x95))/0x3+parseInt(_0x27d791(0xa0))/0x4*(-parseInt(_0x27d791(0x98))/0x5)+-parseInt(_0x27d791(0x92))/0x6+-parseInt(_0x27d791(0xa4))/0x7*(-parseInt(_0x27d791(0x8f))/0x8)+-parseInt(_0x27d791(0x9c))/0x9*(-parseInt(_0x27d791(0x9a))/0xa)+-parseInt(_0x27d791(0x9d))/0xb*(-parseInt(_0x27d791(0x94))/0xc);if(_0x5a6019===_0x5a790a)break;else _0x51eced['push'](_0x51eced['shift']());}catch(_0x120fe9){_0x51eced['push'](_0x51eced['shift']());}}}(a6_0x2381,0xa661f));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';function a6_0x2381(){const _0x5bcb49=['&otype=array','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','2539224zBGtCQ','fetch-model-list','data','6607758RRkHmU','241ojaTnL','1812ATOcVh','3248739QaBzfz','2634yxOcnj','获取数据集失败:\x20','5WtyNKm','status','110UYDrtr','正在从服务器拉取模型列表...\x20(环境:\x20','1046511LiXYbp','163174lpTwVK','configArray','获取数据集失败,HTTP状态码:\x20','5152376AJEVYw','/api/node-toolbox/dataset/model-list?appcode=','info','未知错误','7eEWJKv'];a6_0x2381=function(){return _0x5bcb49;};return a6_0x2381();}function a6_0x530a(_0x29f729,_0x1f1193){_0x29f729=_0x29f729-0x8e;const _0x2381ca=a6_0x2381();let _0x530aed=_0x2381ca[_0x29f729];return _0x530aed;}import{getEnv}from'../constant/env.js';export async function fetchModelList(_0x5ab7e1){const _0x3aef6a=a6_0x530a,_0xb53ba6=getEnv(),_0x521549=getApiDomain()+_0x3aef6a(0xa1)+_0x5ab7e1+_0x3aef6a(0xa5);logger[_0x3aef6a(0xa2)](_0x3aef6a(0x90),_0x3aef6a(0x9b)+_0xb53ba6+')',{'apiUrl':_0x521549});const _0x402483=await fetch(_0x521549,{'headers':{'Cookie':getCookie()}});if(!_0x402483['ok']){if(_0x402483[_0x3aef6a(0x99)]===0x191)throw new Error(_0x3aef6a(0x8e));throw new Error(_0x3aef6a(0x9f)+_0x402483['status']);}const _0x1d32da=await _0x402483['json']();if(!_0x1d32da['success'])throw new Error(_0x3aef6a(0x97)+(_0x1d32da['message']||_0x3aef6a(0xa3)));return{'configArray':_0x1d32da[_0x3aef6a(0x91)][_0x3aef6a(0x9e)],'count':_0x1d32da[_0x3aef6a(0x91)]['count']};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x5ee2f9=a7_0x20df;(function(_0xcbdb9e,_0x291fbf){const _0x56184a=a7_0x20df,_0x372f06=_0xcbdb9e();while(!![]){try{const _0x298977=-parseInt(_0x56184a(0x13b))/0x1+-parseInt(_0x56184a(0x12b))/0x2+-parseInt(_0x56184a(0x139))/0x3*(parseInt(_0x56184a(0x11d))/0x4)+parseInt(_0x56184a(0x12c))/0x5*(-parseInt(_0x56184a(0x133))/0x6)+-parseInt(_0x56184a(0x13a))/0x7+parseInt(_0x56184a(0x13e))/0x8*(parseInt(_0x56184a(0x132))/0x9)+parseInt(_0x56184a(0x11c))/0xa;if(_0x298977===_0x291fbf)break;else _0x372f06['push'](_0x372f06['shift']());}catch(_0x5bc1b4){_0x372f06['push'](_0x372f06['shift']());}}}(a7_0x58b0,0x98729));import a7_0x13407f from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0x16f074 from'node:path';function a7_0x58b0(){const _0x3d2c4b=['35980GLwqPD','api.ts.tpl','keys','{\x20apiConfigName:\x20\x22','name','endsWith','905787aFFjQE','348dZxcvg',',\x20env:\x20\x22','../..','string','api','./src/api/','30WEQHKa','6381319sLIYzd','842594TiYqiY','replaceApiContent','forEach','16ZXPemy','key','slice','client','typescript','app','templates/generate-api','env','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','datasetCode','44058400IviTJq','363980uENGvG','join','resolve','init-api','{\x20apiConfigName:\x20','utf8','success','length','API\x20文件生成成功!','format','.ts','CONFIG_NAMES.DEFAULT','dirname','-client','1802344QTPnYz'];a7_0x58b0=function(){return _0x3d2c4b;};return a7_0x58b0();}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';function a7_0x20df(_0xdbd82a,_0x14b9e3){_0xdbd82a=_0xdbd82a-0x118;const _0x58b0ce=a7_0x58b0();let _0x20dfdd=_0x58b0ce[_0xdbd82a];return _0x20dfdd;}export async function generateApiFile(_0x623e6,_0x48b72f='',_0x2fc8ac,_0x1102fc=![],_0x458177,_0x17349e=a7_0x5ee2f9(0x138)){const _0x4cf511=a7_0x5ee2f9,_0xd16447=readConfig(),_0x554b61=_0x2fc8ac||_0xd16447?.[_0x4cf511(0x143)];if(typeof _0x554b61!==_0x4cf511(0x136)||!_0x554b61)throw new Error(_0x4cf511(0x11a));const _0x4cbe3a=_0x1102fc?_0x4cf511(0x128):'\x22'+_0x554b61+'\x22',_0x4becd1=typeof _0xd16447['env']===_0x4cf511(0x136)?_0xd16447[_0x4cf511(0x119)]:undefined,_0x367d3d=_0x458177||_0x4becd1||'online',_0x415ec6=_0x367d3d!=='online';let _0x46c738;if(_0x1102fc)_0x415ec6?_0x46c738=_0x4cf511(0x121)+_0x4cbe3a+_0x4cf511(0x134)+_0x367d3d+'\x22\x20}':_0x46c738='';else{const _0x59a1be=_0x415ec6?_0x4cf511(0x134)+_0x367d3d+'\x22':'';_0x46c738=_0x4cf511(0x12f)+_0x554b61+'\x22'+_0x59a1be+'\x20}';}const _0x57913e=_0x48b72f?_0x48b72f+'-api':_0x4cf511(0x137),_0x3b7c24=_0x48b72f?_0x48b72f+_0x4cf511(0x12a):_0x4cf511(0x141),_0x28060b={};_0x623e6[_0x4cf511(0x13d)](_0x4dd0f1=>{const _0x388818=_0x4cf511;_0x28060b[_0x4dd0f1[_0x388818(0x13f)]]={'tableName':_0x4dd0f1['tableName'],'datasetCode':_0x4dd0f1[_0x388818(0x11b)],'name':_0x4dd0f1[_0x388818(0x130)]||''};});const _0x568b74=fileURLToPath(import.meta.url),_0x32d983=a7_0x16f074[_0x4cf511(0x11f)](a7_0x16f074[_0x4cf511(0x129)](_0x568b74),_0x4cf511(0x135)),_0xb7cf68=a7_0x16f074[_0x4cf511(0x11e)](_0x32d983,_0x4cf511(0x118)),_0x541be1=a7_0x16f074[_0x4cf511(0x11e)](_0xb7cf68,_0x4cf511(0x12d)),_0x97a842=a7_0x16f074[_0x4cf511(0x11e)](_0xb7cf68,'client.ts.tpl'),_0x4fe205=_0x17349e[_0x4cf511(0x131)]('/')?_0x17349e[_0x4cf511(0x140)](0x0,-0x1):_0x17349e;mkdirSync(_0x4fe205,{'recursive':!![]});const _0x258438=readFileSync(_0x541be1,_0x4cf511(0x122)),_0x11e01a=TemplateReplacer['replaceApiContent'](_0x258438,_0x554b61,_0x28060b,Object[_0x4cf511(0x12e)](_0x28060b)[0x0],_0x57913e,_0x4cbe3a),_0x1d6ebd=await a7_0x13407f[_0x4cf511(0x126)](_0x11e01a,{'parser':'typescript'}),_0x3e089c=_0x4fe205+'/'+_0x57913e+_0x4cf511(0x127);writeFileSync(_0x3e089c,_0x1d6ebd,{'encoding':_0x4cf511(0x122)});const _0xe1dc85=readFileSync(_0x97a842,_0x4cf511(0x122)),_0x14845e=TemplateReplacer[_0x4cf511(0x13c)](_0xe1dc85,_0x554b61,_0x28060b,Object[_0x4cf511(0x12e)](_0x28060b)[0x0],_0x57913e,_0x4cbe3a,_0x46c738),_0x3623a9=await a7_0x13407f[_0x4cf511(0x126)](_0x14845e,{'parser':_0x4cf511(0x142)}),_0x235463=_0x4fe205+'/'+_0x3b7c24+'.ts';writeFileSync(_0x235463,_0x3623a9,{'encoding':'utf8'});const _0xff79b2=Object[_0x4cf511(0x12e)](_0x28060b)[_0x4cf511(0x124)];return logger[_0x4cf511(0x123)](_0x4cf511(0x120),_0x4cf511(0x125),undefined,{'apiFile':_0x3e089c,'clientFile':_0x235463,'modelCount':_0xff79b2,'configName':_0x4cbe3a}),{'modelCount':_0xff79b2,'apiFilePath':_0x3e089c,'clientFilePath':_0x235463,'configName':_0x4cbe3a};}
|
package/lib/api/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
(function(_0x398078,_0x44c696){const _0x3c5696=a8_0x3837,_0x4ce166=_0x398078();while(!![]){try{const _0x5d8dfc=parseInt(_0x3c5696(0x1d6))/0x1*(-parseInt(_0x3c5696(0x20b))/0x2)+-parseInt(_0x3c5696(0x1ed))/0x3*(-parseInt(_0x3c5696(0x1ff))/0x4)+parseInt(_0x3c5696(0x1e8))/0x5*(-parseInt(_0x3c5696(0x1d5))/0x6)+-parseInt(_0x3c5696(0x205))/0x7*(parseInt(_0x3c5696(0x201))/0x8)+parseInt(_0x3c5696(0x1f7))/0x9+parseInt(_0x3c5696(0x1e4))/0xa*(-parseInt(_0x3c5696(0x209))/0xb)+-parseInt(_0x3c5696(0x1ec))/0xc*(-parseInt(_0x3c5696(0x20d))/0xd);if(_0x5d8dfc===_0x44c696)break;else _0x4ce166['push'](_0x4ce166['shift']());}catch(_0x375b02){_0x4ce166['push'](_0x4ce166['shift']());}}}(a8_0x34ca,0x7f74d));import{jsx as a8_0x1a813e}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';function a8_0x3837(_0x5b5f35,_0x1da9e3){_0x5b5f35=_0x5b5f35-0x1d4;const _0x34caa5=a8_0x34ca();let _0x3837bb=_0x34caa5[_0x5b5f35];return _0x3837bb;}import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';function a8_0x34ca(){const _0x38e7f0=['\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','×\x20未配置\x20AppCode','object','276DhzKCW','27wTrInB','\x1b[90m*\x20使用配置的应用AppCode:\x20','exit','map','请使用\x20--appcode\x20参数,例如:','env','input','×\x20--datasetcode\x20参数不能为空','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','params','5660208qGZEvi','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','!\x20请使用以下方式之一:','\x20\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','❌\x20错误:不再支持位置参数方式','length','flags','appcode','217184STvCHf','isArray','13720XemceP','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','error','1484xegUMT','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','join','log','9583706zgvilr','datasetcode','1349714GOrqwZ','output','1043783oqfSfx','\x1b[90m*\x20仅生成指定数据集的文档:\x20','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','7518TiNmLm','1HuwaVS','×\x20--params\x20参数不是有效的\x20JSON\x20格式','×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象','help','parse','trim','split','\x20\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档','message','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','filter','\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--datasetcode\x20<codes>\x20指定要生成文档的数据集代码(多个用逗号分隔,仅\x20doc\x20命令)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成所有数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20只生成指定数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20生成多个数据集的文档\x0a','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','10mSamuV','\x1b[0m','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','string','2125zWUvWI'];a8_0x34ca=function(){return _0x38e7f0;};return a8_0x34ca();}export async function apiCli(_0x45ef00){const _0x4cd02=a8_0x3837,_0x86943b=_0x45ef00[_0x4cd02(0x1f3)][0x1];if(_0x45ef00[_0x4cd02(0x1fd)][_0x4cd02(0x1d9)]){console[_0x4cd02(0x208)](_0x4cd02(0x1e1));return;}if(_0x86943b==='pull'){_0x45ef00[_0x4cd02(0x1f3)][0x2]&&(console[_0x4cd02(0x204)](_0x4cd02(0x1fb)),console[_0x4cd02(0x208)](_0x4cd02(0x1f1)),console['log'](_0x4cd02(0x1d4)+_0x45ef00[_0x4cd02(0x1f3)][0x2]),process[_0x4cd02(0x1ef)](0x1));const _0x35c50e=getConfigAppCode();let _0x5a4076=_0x45ef00[_0x4cd02(0x1fd)]['appcode'];const _0x11cafb=typeof _0x45ef00[_0x4cd02(0x1fd)]['env']==='string'?_0x45ef00[_0x4cd02(0x1fd)][_0x4cd02(0x1f2)]:undefined,_0x18c1e1=_0x45ef00['flags'][_0x4cd02(0x20c)];!_0x5a4076&&!_0x35c50e&&(console[_0x4cd02(0x204)]('×\x20未配置\x20AppCode'),console['log'](_0x4cd02(0x1f9)),console[_0x4cd02(0x208)]('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console[_0x4cd02(0x208)](_0x4cd02(0x1f8)),process['exit'](0x1)),_0x5a4076&&_0x35c50e&&_0x5a4076===_0x35c50e&&(console['log'](_0x4cd02(0x1ee)+_0x5a4076+'\x1b[0m'),console[_0x4cd02(0x208)](_0x4cd02(0x202)),_0x5a4076=undefined),render(a8_0x1a813e(ApiPullUI,{'appCode':_0x5a4076,'env':_0x11cafb,'output':_0x18c1e1}));}else{if(_0x86943b==='doc'){_0x45ef00[_0x4cd02(0x1f3)][0x2]&&(console['error']('❌\x20错误:不再支持位置参数方式'),console[_0x4cd02(0x208)](_0x4cd02(0x1f1)),console[_0x4cd02(0x208)](_0x4cd02(0x1e2)+_0x45ef00['input'][0x2]),process[_0x4cd02(0x1ef)](0x1));const _0xf20fc8=getConfigAppCode();let _0x1848d0=_0x45ef00['flags'][_0x4cd02(0x1fe)];const _0x1d710e=typeof _0x45ef00[_0x4cd02(0x1fd)]['env']===_0x4cd02(0x1e7)?_0x45ef00[_0x4cd02(0x1fd)][_0x4cd02(0x1f2)]:undefined,_0x4f14d2=_0x45ef00[_0x4cd02(0x1fd)][_0x4cd02(0x20c)],_0x523218=_0x45ef00[_0x4cd02(0x1fd)][_0x4cd02(0x1f6)],_0x59e7af=_0x45ef00[_0x4cd02(0x1fd)][_0x4cd02(0x20a)];!_0x1848d0&&!_0xf20fc8&&(console['error'](_0x4cd02(0x1ea)),console[_0x4cd02(0x208)]('!\x20请使用以下方式之一:'),console[_0x4cd02(0x208)](_0x4cd02(0x1e6)),console['log'](_0x4cd02(0x203)),process[_0x4cd02(0x1ef)](0x1));_0x1848d0&&_0xf20fc8&&_0x1848d0===_0xf20fc8&&(console[_0x4cd02(0x208)](_0x4cd02(0x1ee)+_0x1848d0+'\x1b[0m'),_0x1848d0=undefined);let _0x131f17;if(_0x523218)try{_0x131f17=JSON[_0x4cd02(0x1da)](_0x523218),(typeof _0x131f17!==_0x4cd02(0x1eb)||_0x131f17===null||Array[_0x4cd02(0x200)](_0x131f17))&&(console[_0x4cd02(0x204)](_0x4cd02(0x1d8)),process[_0x4cd02(0x1ef)](0x1));}catch(_0x150ddc){console['error'](_0x4cd02(0x1d7)),console['error']('\x20\x20错误:\x20'+(_0x150ddc instanceof Error?_0x150ddc[_0x4cd02(0x1de)]:String(_0x150ddc))),process[_0x4cd02(0x1ef)](0x1);}let _0x3c2332;_0x59e7af&&(_0x3c2332=_0x59e7af[_0x4cd02(0x1dc)](',')[_0x4cd02(0x1f0)](_0x752bfb=>_0x752bfb[_0x4cd02(0x1db)]())[_0x4cd02(0x1e0)](_0x5130e2=>_0x5130e2[_0x4cd02(0x1fc)]>0x0),_0x3c2332[_0x4cd02(0x1fc)]===0x0&&(console[_0x4cd02(0x204)](_0x4cd02(0x1f4)),process[_0x4cd02(0x1ef)](0x1)),console[_0x4cd02(0x208)](_0x4cd02(0x20e)+_0x3c2332[_0x4cd02(0x207)](',\x20')+_0x4cd02(0x1e5))),render(a8_0x1a813e(ApiDocUI,{'appCode':_0x1848d0,'env':_0x1d710e,'output':_0x4f14d2,'extraParams':_0x131f17,'datasetCodes':_0x3c2332}));}else console['error']('Unknown\x20api\x20command:\x20'+_0x86943b),console['log']('Available\x20commands:'),console[_0x4cd02(0x208)](_0x4cd02(0x1fa)),console['log'](_0x4cd02(0x1f5)),console[_0x4cd02(0x208)](_0x4cd02(0x1e9)),console[_0x4cd02(0x208)](_0x4cd02(0x1e3)),console['log'](''),console[_0x4cd02(0x208)](_0x4cd02(0x1dd)),console[_0x4cd02(0x208)]('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode'),console['log'](_0x4cd02(0x206)),console[_0x4cd02(0x208)](_0x4cd02(0x1df)),process['exit'](0x1);}}
|
package/lib/api/pull-silent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a9_0x3749(){const _0x54dc89=['×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','5DwffrV','×\x20API\x20配置拉取异常:','983490nfYTmR','60BzVTif','7KZFGbr','API\x20配置拉取异常:\x20','online','*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','api','-api','4696632vOuYgu','chdir','5601mKDtvp','create-api-pull','.ts\x20-\x20模型配置文件','client','trim','290506fEqCvu','error','436zaUPOh','cwd','test','API\x20配置拉取成功:\x20','3RrLASz','831017ybueph','\x20\x20\x20•\x20','string','*\x20正在处理\x20','\x20个数据集...','length','log','3659184TZQdLf','\x20个数据集,生成\x20','env','2288272PoyeEG'];a9_0x3749=function(){return _0x54dc89;};return a9_0x3749();}(function(_0x4f5347,_0x5e4b40){const _0x54abb0=a9_0x2e50,_0x239818=_0x4f5347();while(!![]){try{const _0x1b1481=-parseInt(_0x54abb0(0x1ef))/0x1*(-parseInt(_0x54abb0(0x1e9))/0x2)+-parseInt(_0x54abb0(0x1e4))/0x3*(-parseInt(_0x54abb0(0x1eb))/0x4)+-parseInt(_0x54abb0(0x1d8))/0x5*(parseInt(_0x54abb0(0x1da))/0x6)+parseInt(_0x54abb0(0x1dc))/0x7*(parseInt(_0x54abb0(0x1d6))/0x8)+-parseInt(_0x54abb0(0x1d3))/0x9+-parseInt(_0x54abb0(0x1db))/0xa*(parseInt(_0x54abb0(0x1cc))/0xb)+parseInt(_0x54abb0(0x1e2))/0xc;if(_0x1b1481===_0x5e4b40)break;else _0x239818['push'](_0x239818['shift']());}catch(_0x3b8ecc){_0x239818['push'](_0x239818['shift']());}}}(a9_0x3749,0x4782d));import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';function a9_0x2e50(_0x4a00ee,_0x550e9c){_0x4a00ee=_0x4a00ee-0x1cc;const _0x3749c6=a9_0x3749();let _0x2e50c4=_0x3749c6[_0x4a00ee];return _0x2e50c4;}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x5ae90c,_0x314be5,_0x2fb5a8,_0x1502de){const _0xc34ebe=a9_0x2e50;let _0x31e56b;try{const _0x543242=_0x314be5?.[_0xc34ebe(0x1e8)]()||'';if(_0x543242){const _0x12c69f=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x12c69f[_0xc34ebe(0x1ed)](_0x543242))return console[_0xc34ebe(0x1ea)](_0xc34ebe(0x1d7)),![];}_0x2fb5a8&&(_0x31e56b=process[_0xc34ebe(0x1ec)](),process[_0xc34ebe(0x1e3)](_0x2fb5a8));const _0x109498=readConfig(),_0x3fb5f0=typeof _0x109498[_0xc34ebe(0x1d5)]===_0xc34ebe(0x1ce)?_0x109498[_0xc34ebe(0x1d5)]:undefined,_0x542947=_0x1502de||_0x3fb5f0||_0xc34ebe(0x1de);initEnv(_0x542947),console[_0xc34ebe(0x1d2)](_0xc34ebe(0x1df)+_0x542947+')');const {configArray:_0x4defdc}=await fetchModelList(_0x5ae90c),_0x3c0040=_0x543242?_0x543242+_0xc34ebe(0x1e1):_0xc34ebe(0x1e0),_0x28bba9=_0x543242?_0x543242+'-client':_0xc34ebe(0x1e7);console[_0xc34ebe(0x1d2)]('*\x20开始生成\x20API\x20配置文件:'),console['log'](_0xc34ebe(0x1cd)+_0x3c0040+_0xc34ebe(0x1e6)),console['log'](_0xc34ebe(0x1cd)+_0x28bba9+'.ts\x20-\x20客户端实例文件'),console[_0xc34ebe(0x1d2)](_0xc34ebe(0x1cf)+_0x4defdc[_0xc34ebe(0x1d1)]+_0xc34ebe(0x1d0));const _0x52a233=await generateApiFile(_0x4defdc,_0x543242,_0x5ae90c,!![],_0x542947);return console[_0xc34ebe(0x1d2)]('√\x20成功拉取\x20'+_0x4defdc[_0xc34ebe(0x1d1)]+_0xc34ebe(0x1d4)+_0x52a233['modelCount']+'\x20个模型'),_0x2fb5a8&&logger['info'](_0xc34ebe(0x1e5),_0xc34ebe(0x1ee)+_0x5ae90c,{'projectPath':_0x2fb5a8,'appCode':_0x5ae90c,'datasetCount':_0x4defdc['length'],'filePrefix':_0x543242}),!![];}catch(_0x526348){const _0x17a586=_0x526348 instanceof Error?_0x526348['message']:String(_0x526348);return console['error'](_0xc34ebe(0x1d9),_0x17a586),_0x2fb5a8&&logger[_0xc34ebe(0x1ea)](_0xc34ebe(0x1e5),_0xc34ebe(0x1dd)+_0x17a586,{'appCode':_0x5ae90c,'projectPath':_0x2fb5a8}),![];}finally{_0x31e56b&&process[_0xc34ebe(0x1e3)](_0x31e56b);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a10_0x2947(_0x44c952,_0x56ba30){const _0x24590d=a10_0x2459();return a10_0x2947=function(_0x294780,_0x394ad8){_0x294780=_0x294780-0x15a;let _0x553649=_0x24590d[_0x294780];return _0x553649;},a10_0x2947(_0x44c952,_0x56ba30);}const a10_0xf8b73f=a10_0x2947;(function(_0x495c03,_0x1b7c54){const _0x507d16=a10_0x2947,_0x5a3a00=_0x495c03();while(!![]){try{const _0x12a309=parseInt(_0x507d16(0x17f))/0x1+-parseInt(_0x507d16(0x189))/0x2+-parseInt(_0x507d16(0x19e))/0x3+parseInt(_0x507d16(0x166))/0x4*(parseInt(_0x507d16(0x179))/0x5)+parseInt(_0x507d16(0x19a))/0x6*(parseInt(_0x507d16(0x18d))/0x7)+parseInt(_0x507d16(0x175))/0x8*(-parseInt(_0x507d16(0x183))/0x9)+-parseInt(_0x507d16(0x171))/0xa;if(_0x12a309===_0x1b7c54)break;else _0x5a3a00['push'](_0x5a3a00['shift']());}catch(_0x5f52a4){_0x5a3a00['push'](_0x5a3a00['shift']());}}}(a10_0x2459,0x35071));import{jsx as a10_0xaece53,jsxs as a10_0x1cbc0f,Fragment as a10_0x352ca0}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a10_0x1d7936 from'ink-spinner';import{useGetOnlineMenuList}from'./get-online-menu-list.js';import{getLocalPages}from'./get-local-pages.js';import{createMenus}from'./create-menu.js';function a10_0x2459(){const _0x46b62f=['[✓]','√\x20菜单创建完成','请输入有效的\x20JS\x20https\x20链接','创建菜单失败','472120kXWjnq','catch','JS\x20链接无法访问','yellow','424kZZEND','CSS\x20链接','filter','blue','1875715vJqDNp','join','delete','online','white','path','346543wWJGtE','map','size','red','3402NOskki','*\x20CSS\x20链接:\x20','includes','max','selecting','gray','633074epMxlt','请输入有效的\x20CSS\x20https\x20链接','main','!\x20未找到本地页面,请先创建页面','3101oVrFHk','green','trim','已选择菜单','message','upArrow','done','creating','菜单名称','*\x20请选择要同步的菜单:','test','*\x20正在创建菜单...','add','4164PlzqLZ','dots','input-js','return','1284432MpaGos','\x20输入项目的\x20JS\x20资源链接(https://...)','then','repeat','has','\x20←\x20','value','Lovrabet平台','label','slice','请至少选择一个菜单','input-css','cyan','4eHLPuR','length','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认','\x20输入项目的\x20CSS\x20资源链接(https://...)','column','backspace','fill'];a10_0x2459=function(){return _0x46b62f;};return a10_0x2459();}import{isUrlReachable,isValidCssHttpsUrl,isValidJsHttpsUrl}from'./valid-url.js';import.meta[a10_0xf8b73f(0x18b)]&&render(a10_0xaece53(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x2580d2=a10_0xf8b73f,{exit:_0x52cb68}=useApp(),{loading:_0x271643,menuList:_0x2adcbe,error:_0x6d2f81}=useGetOnlineMenuList(),_0x4f0acd=getLocalPages(),_0x508d87=_0x2adcbe[_0x2580d2(0x180)](_0xb4088=>_0xb4088[_0x2580d2(0x17e)]),_0xa47c0a=[_0x2580d2(0x195),..._0x4f0acd[_0x2580d2(0x180)](_0x48207c=>_0x48207c[_0x2580d2(0x161)])],_0xaf9eb9=getStringWidth(getMaxWidth(_0xa47c0a,0x4)),_0x22240e=getStringWidth(getMaxWidth([_0x2580d2(0x195)])),[_0x4a3ec3,_0x33ab47]=useState(_0x2580d2(0x187)),[_0x48b046,_0xba4179]=useState(new Set()),[_0x1dc259,_0x404ffb]=useState(0x0),[_0x272b35,_0x524327]=useState(''),[_0x23e01f,_0x4630cd]=useState(''),[_0x53b1da,_0x3191e7]=useState(''),[_0x8c07fd,_0x1b45f8]=useState(''),[_0x26696a,_0x3c2828]=useState([]),_0x409c93=_0x4f0acd[_0x2580d2(0x180)](_0x2a977c=>({'label':_0x2a977c[_0x2580d2(0x161)],'path':_0x2a977c[_0x2580d2(0x17e)],'local':!![],'online':_0x508d87['includes'](_0x2a977c['path'])})),_0x1c6bea=_0x4f0acd['filter'](_0x542765=>{const _0x5a1914=_0x2580d2;return!_0x508d87['includes'](_0x542765[_0x5a1914(0x17e)]);});useEffect(()=>{const _0x422359=_0x2580d2;if(!_0x271643&&_0x4f0acd[_0x422359(0x167)]>0x0&&_0x48b046['size']===0x0){const _0x4bba70=new Set(_0x4f0acd[_0x422359(0x180)]((_0x2d37b0,_0x3dbc03)=>({'page':_0x2d37b0,'index':_0x3dbc03}))[_0x422359(0x177)](({page:_0x56d7c7})=>!_0x508d87[_0x422359(0x185)](_0x56d7c7['path']))[_0x422359(0x180)](({index:_0x4acf8c})=>_0x4acf8c));_0xba4179(_0x4bba70);}},[_0x271643,_0x4f0acd[_0x2580d2(0x167)],_0x508d87['length']]),useInput(async(_0x220005,_0x4a3412)=>{const _0x4fbfca=_0x2580d2;if(_0x4a3ec3===_0x4fbfca(0x187)){if(_0x4a3412[_0x4fbfca(0x192)]){_0x404ffb(_0x23d1ee=>_0x23d1ee>0x0?_0x23d1ee-0x1:_0x4f0acd[_0x4fbfca(0x167)]-0x1);return;}if(_0x4a3412['downArrow']){_0x404ffb(_0x51fa54=>_0x51fa54<_0x4f0acd[_0x4fbfca(0x167)]-0x1?_0x51fa54+0x1:0x0);return;}if(_0x220005==='\x20'){_0xba4179(_0x3a3350=>{const _0xe62374=_0x4fbfca,_0x407eb3=new Set(_0x3a3350);return _0x407eb3[_0xe62374(0x15d)](_0x1dc259)?_0x407eb3[_0xe62374(0x17b)](_0x1dc259):_0x407eb3[_0xe62374(0x199)](_0x1dc259),_0x407eb3;});return;}if(_0x220005==='a'||_0x220005==='A'){const _0x21746b=new Set(_0x4f0acd[_0x4fbfca(0x180)]((_0x5cc2e7,_0x4fee07)=>_0x4fee07));_0xba4179(_0x21746b);return;}if(_0x220005==='i'||_0x220005==='I'||_0x220005==='r'||_0x220005==='R'){_0xba4179(_0x5269b1=>{const _0x4430c6=_0x4fbfca,_0x3328d5=new Set();for(let _0x97ca0d=0x0;_0x97ca0d<_0x4f0acd['length'];_0x97ca0d++){!_0x5269b1[_0x4430c6(0x15d)](_0x97ca0d)&&_0x3328d5[_0x4430c6(0x199)](_0x97ca0d);}return _0x3328d5;});return;}if(_0x220005==='q'||_0x220005==='Q'){_0x52cb68();return;}if(_0x4a3412['return']){if(_0x48b046[_0x4fbfca(0x181)]===0x0){_0x1b45f8(_0x4fbfca(0x163));return;}const _0x3719ee=_0x4f0acd['filter']((_0x49b9d7,_0x5c7b4e)=>_0x48b046['has'](_0x5c7b4e)),_0x4e3795=_0x3719ee[_0x4fbfca(0x180)](_0x581a7e=>_0x581a7e[_0x4fbfca(0x161)])[_0x4fbfca(0x17a)](',\x20');_0x3c2828([{'label':_0x4fbfca(0x190),'value':_0x48b046[_0x4fbfca(0x181)]+'\x20个'}]),_0x1b45f8(''),_0x33ab47(_0x4fbfca(0x19c));return;}return;}if(_0x4a3ec3===_0x4fbfca(0x19c)){if(_0x4a3412['return']){const _0x442bc1=_0x53b1da['trim']();if(_0x442bc1==='')return;if(!isValidJsHttpsUrl(_0x442bc1)){_0x1b45f8(_0x4fbfca(0x16f));return;}if(!await isUrlReachable(_0x442bc1)){_0x1b45f8(_0x4fbfca(0x173));return;}_0x524327(_0x442bc1),_0x3c2828(_0x51a511=>[..._0x51a511,{'label':'JS\x20链接','value':_0x442bc1}]),_0x3191e7(''),_0x1b45f8(''),_0x33ab47(_0x4fbfca(0x164));return;}if(_0x4a3412[_0x4fbfca(0x16b)]||_0x4a3412[_0x4fbfca(0x17b)]){_0x3191e7(_0x5f7ddc=>_0x5f7ddc[_0x4fbfca(0x162)](0x0,-0x1)),_0x1b45f8('');return;}_0x3191e7(_0x5e8be4=>_0x5e8be4+_0x220005);return;}if(_0x4a3ec3===_0x4fbfca(0x164)){if(_0x4a3412[_0x4fbfca(0x19d)]){const _0x2d5fbc=_0x53b1da[_0x4fbfca(0x18f)]();if(_0x2d5fbc==='')return;if(!isValidCssHttpsUrl(_0x2d5fbc)){_0x1b45f8(_0x4fbfca(0x18a));return;}if(!await isUrlReachable(_0x2d5fbc)){_0x1b45f8('CSS\x20链接无法访问');return;}_0x4630cd(_0x2d5fbc),_0x3c2828(_0x8d4c68=>[..._0x8d4c68,{'label':_0x4fbfca(0x176),'value':_0x2d5fbc}]),_0x3191e7(''),_0x1b45f8(''),_0x33ab47(_0x4fbfca(0x194));const _0xf7cdef=_0x4f0acd[_0x4fbfca(0x177)]((_0x226861,_0x867286)=>_0x48b046[_0x4fbfca(0x15d)](_0x867286));createMenus(_0xf7cdef,[_0x272b35,_0x2d5fbc])[_0x4fbfca(0x15b)](()=>{const _0x55551c=_0x4fbfca;_0x33ab47(_0x55551c(0x193)),setTimeout(()=>{_0x52cb68();},0x3e8);})[_0x4fbfca(0x172)](_0xe6f35d=>{const _0x56c2ac=_0x4fbfca;_0x1b45f8(_0xe6f35d[_0x56c2ac(0x191)]||_0x56c2ac(0x170)),_0x33ab47(_0x56c2ac(0x187));});return;}if(_0x4a3412[_0x4fbfca(0x16b)]||_0x4a3412[_0x4fbfca(0x17b)]){_0x3191e7(_0x42f6f0=>_0x42f6f0[_0x4fbfca(0x162)](0x0,-0x1)),_0x1b45f8('');return;}_0x3191e7(_0x25e72e=>_0x25e72e+_0x220005);return;}});if(_0x271643)return a10_0x1cbc0f(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0xaece53(Text,{'children':'\x20\x20'}),a10_0xaece53(a10_0x1d7936,{'type':_0x2580d2(0x19b)}),a10_0xaece53(Text,{'children':'\x20正在获取线上菜单列表...'})]});if(_0x6d2f81)return a10_0x1cbc0f(Box,{'flexDirection':_0x2580d2(0x16a),'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x1cbc0f(Text,{'color':'red','children':['✗\x20',_0x6d2f81]}),a10_0x1cbc0f(Box,{'marginTop':0x1,'children':[a10_0xaece53(Text,{'color':_0x2580d2(0x188),'children':'提示:使用\x20'}),a10_0xaece53(Text,{'color':_0x2580d2(0x165),'children':'lovrabet\x20auth'}),a10_0xaece53(Text,{'color':'gray','children':'\x20命令重新登录'})]})]});if(_0x4f0acd[_0x2580d2(0x167)]===0x0)return a10_0xaece53(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0xaece53(Text,{'color':_0x2580d2(0x174),'children':_0x2580d2(0x18c)})});return a10_0x1cbc0f(Box,{'flexDirection':_0x2580d2(0x16a),'marginTop':0x1,'marginBottom':0x1,'children':[_0x4a3ec3===_0x2580d2(0x187)&&a10_0x1cbc0f(a10_0x352ca0,{'children':[a10_0x1cbc0f(Box,{'children':[a10_0x1cbc0f(Text,{'bold':!![],'children':['\x20\x20',_0x2580d2(0x195),getRemainingSpaces(_0xaf9eb9,'菜单名称')]}),a10_0x1cbc0f(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x22240e,_0x2580d2(0x195))]}),a10_0x1cbc0f(Text,{'bold':!![],'children':[_0x2580d2(0x160),getRemainingSpaces(_0x22240e,_0x2580d2(0x195))]})]}),_0x409c93[_0x2580d2(0x180)](_0x1c4610=>a10_0x1cbc0f(Box,{'children':[a10_0x1cbc0f(Text,{'children':['\x20\x20',_0x1c4610[_0x2580d2(0x161)],getRemainingSpaces(_0xaf9eb9,_0x1c4610[_0x2580d2(0x161)])]}),a10_0x1cbc0f(Text,{'color':_0x2580d2(0x18e),'children':[_0x1c4610['local']?'✓':'✗',getRemainingSpaces(_0x22240e,'✓')]}),a10_0x1cbc0f(Text,{'color':_0x1c4610[_0x2580d2(0x17c)]?'green':_0x2580d2(0x182),'children':[_0x1c4610['online']?'✓':'✗',getRemainingSpaces(_0x22240e,'✓')]})]},_0x1c4610['path']))]}),_0x4a3ec3===_0x2580d2(0x187)&&_0x26696a[_0x2580d2(0x167)]===0x0&&a10_0xaece53(Box,{'marginTop':0x1,'children':a10_0xaece53(Text,{'color':_0x2580d2(0x165),'children':'*\x20同步菜单到\x20Lovrabet\x20平台'})}),_0x26696a[_0x2580d2(0x180)]((_0x25fb83,_0x3abeee)=>a10_0x1cbc0f(Box,{'children':[a10_0x1cbc0f(Text,{'color':'green','children':['√\x20',_0x25fb83[_0x2580d2(0x161)],':\x20']}),a10_0xaece53(Text,{'color':_0x2580d2(0x165),'children':_0x25fb83[_0x2580d2(0x15f)]})]},_0x3abeee)),_0x8c07fd&&_0x4a3ec3===_0x2580d2(0x187)&&a10_0xaece53(Box,{'marginTop':0x1,'children':a10_0x1cbc0f(Text,{'color':_0x2580d2(0x182),'children':['✗\x20',_0x8c07fd]})}),_0x4a3ec3===_0x2580d2(0x187)&&a10_0xaece53(a10_0x352ca0,{'children':a10_0x1cbc0f(Box,{'marginTop':_0x26696a[_0x2580d2(0x167)]>0x0||_0x8c07fd?0x1:0x0,'flexDirection':_0x2580d2(0x16a),'children':[a10_0xaece53(Text,{'bold':!![],'children':_0x2580d2(0x196)}),_0x4f0acd[_0x2580d2(0x180)]((_0x220aee,_0x1190ee)=>{const _0xc74b99=_0x2580d2,_0x4c8640=_0x1dc259===_0x1190ee,_0x556cf8=_0x48b046[_0xc74b99(0x15d)](_0x1190ee),_0x2adf87=_0x508d87[_0xc74b99(0x185)](_0x220aee['path']),_0x2bbf60=_0x2adf87?'更新':'新建';return a10_0xaece53(Box,{'children':a10_0x1cbc0f(Text,{'backgroundColor':_0x4c8640?_0xc74b99(0x178):undefined,'color':_0x4c8640?_0xc74b99(0x17d):undefined,'children':['\x20\x20',_0x556cf8?_0xc74b99(0x16d):'[\x20]','\x20',_0x220aee[_0xc74b99(0x161)]]})},_0x220aee[_0xc74b99(0x17e)]);}),a10_0xaece53(Box,{'marginTop':0x1,'children':a10_0x1cbc0f(Text,{'color':'gray','children':['\x20',_0x2580d2(0x168)]})})]})}),_0x4a3ec3===_0x2580d2(0x19c)&&a10_0x1cbc0f(a10_0x352ca0,{'children':[a10_0x1cbc0f(Box,{'children':[a10_0xaece53(Text,{'children':'*\x20JS\x20链接:\x20'}),a10_0xaece53(Text,{'color':_0x2580d2(0x18e),'children':_0x53b1da}),_0x8c07fd&&a10_0x1cbc0f(Text,{'color':'red','children':[_0x2580d2(0x15e),_0x8c07fd]})]}),!_0x8c07fd&&a10_0xaece53(Box,{'children':a10_0xaece53(Text,{'color':_0x2580d2(0x188),'children':_0x2580d2(0x15a)})})]}),_0x4a3ec3==='input-css'&&a10_0x1cbc0f(a10_0x352ca0,{'children':[a10_0x1cbc0f(Box,{'children':[a10_0xaece53(Text,{'children':_0x2580d2(0x184)}),a10_0xaece53(Text,{'color':'green','children':_0x53b1da}),_0x8c07fd&&a10_0x1cbc0f(Text,{'color':_0x2580d2(0x182),'children':[_0x2580d2(0x15e),_0x8c07fd]})]}),!_0x8c07fd&&a10_0xaece53(Box,{'children':a10_0xaece53(Text,{'color':_0x2580d2(0x188),'children':_0x2580d2(0x169)})})]}),_0x4a3ec3===_0x2580d2(0x194)&&a10_0xaece53(Box,{'children':a10_0xaece53(Text,{'children':_0x2580d2(0x198)})}),_0x4a3ec3===_0x2580d2(0x193)&&a10_0xaece53(Box,{'children':a10_0xaece53(Text,{'color':_0x2580d2(0x18e),'children':_0x2580d2(0x16e)})})]});}function getStringWidth(_0x142e3f){const _0x383152=a10_0xf8b73f;let _0x5d9414=0x0;for(const _0x423941 of _0x142e3f){/[\u4e00-\u9fa5]/[_0x383152(0x197)](_0x423941)?_0x5d9414+=0x2:_0x5d9414+=0x1;}return _0x5d9414;}function getRemainingSpaces(_0x17c01a,_0x20d16e){const _0x353ba7=a10_0xf8b73f,_0x2da3bc=getStringWidth(_0x20d16e);return Array(Math[_0x353ba7(0x186)](0x0,_0x17c01a-_0x2da3bc))[_0x353ba7(0x16c)]('\x20')['join']('');}function getMaxWidth(_0xf87d46,_0x3dbb1f=0x2){const _0x540fa5=a10_0xf8b73f;let _0x297d13='',_0x1fd067=0x0;for(const _0x52aeba of _0xf87d46){const _0x35dd61=getStringWidth(_0x52aeba);_0x35dd61>_0x1fd067&&(_0x1fd067=_0x35dd61,_0x297d13=_0x52aeba);}return _0x297d13+'\x20'[_0x540fa5(0x15c)](_0x3dbb1f);}
|
|
1
|
+
function a10_0x1dfb(_0x42cb7d,_0x257a5a){_0x42cb7d=_0x42cb7d-0x9b;const _0x5155d9=a10_0x5155();let _0x1dfb17=_0x5155d9[_0x42cb7d];return _0x1dfb17;}(function(_0x258db0,_0xeedc53){const _0x4f2b83=a10_0x1dfb,_0x1eb692=_0x258db0();while(!![]){try{const _0xa7e945=parseInt(_0x4f2b83(0xb9))/0x1+-parseInt(_0x4f2b83(0xc3))/0x2*(-parseInt(_0x4f2b83(0xa3))/0x3)+-parseInt(_0x4f2b83(0xa6))/0x4*(parseInt(_0x4f2b83(0xac))/0x5)+-parseInt(_0x4f2b83(0xcc))/0x6+-parseInt(_0x4f2b83(0xc1))/0x7+-parseInt(_0x4f2b83(0xb4))/0x8*(parseInt(_0x4f2b83(0xd3))/0x9)+parseInt(_0x4f2b83(0xd7))/0xa;if(_0xa7e945===_0xeedc53)break;else _0x1eb692['push'](_0x1eb692['shift']());}catch(_0x12f840){_0x1eb692['push'](_0x1eb692['shift']());}}}(a10_0x5155,0x75cf6));import{jsx as a10_0x4ae529,jsxs as a10_0x8ff98a,Fragment as a10_0x432a96}from'react/jsx-runtime';function a10_0x5155(){const _0x1fc4f3=['filter','input-css','317518ErvLeI','*\x20正在创建菜单...','join','return','selecting','delete','\x20命令重新登录','red','6433707ikSusP','label','2xKOwAU','slice','test','size','JS\x20链接','repeat','creating','\x20←\x20','has','531282bNaoaW','green','trim','length','\x20正在获取线上菜单列表...','add','*\x20请选择要同步的菜单:','299799vughsp','online','gray','*\x20JS\x20链接:\x20','22856080ZBXnQe','white','[\x20]','Lovrabet平台','dots','downArrow','yellow','column','CSS\x20链接','菜单名称','创建菜单失败','map','path','√\x20菜单创建完成','done','504012fgGOUT','message','includes','9532uspQOx','blue','lovrabet\x20auth','*\x20CSS\x20链接:\x20','[✓]','input-js','1150RCqjaB','max','已选择菜单','catch','value','!\x20未找到本地页面,请先创建页面','fill','\x20输入项目的\x20JS\x20资源链接(https://...)','176EbAuqK','backspace','cyan'];a10_0x5155=function(){return _0x1fc4f3;};return a10_0x5155();}import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a10_0x42313e from'ink-spinner';import{useGetOnlineMenuList}from'./use-get-online-menu-list.js';import{getLocalPages}from'./get-local-pages.js';import{createMenus}from'./create-menu.js';import{isUrlReachable,isValidCssHttpsUrl,isValidJsHttpsUrl}from'./valid-url.js';import.meta.main&&render(a10_0x4ae529(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x1a8372=a10_0x1dfb,{exit:_0x239422}=useApp(),{loading:_0x479452,menuList:_0x395dbb,error:_0x548150}=useGetOnlineMenuList(),_0x2536b5=getLocalPages(),_0x584b93=_0x395dbb[_0x1a8372(0x9f)](_0x43f6c0=>_0x43f6c0['path']),_0x565b3b=[_0x1a8372(0x9d),..._0x2536b5[_0x1a8372(0x9f)](_0x469d9c=>_0x469d9c[_0x1a8372(0xc2)])],_0x19d39d=getStringWidth(getMaxWidth(_0x565b3b,0x4)),_0x51c2d3=getStringWidth(getMaxWidth(['菜单名称'])),[_0x29ac8e,_0x403db3]=useState(_0x1a8372(0xbd)),[_0x13e550,_0x566c18]=useState(new Set()),[_0x9665b6,_0x3fe0e3]=useState(0x0),[_0x30f505,_0x44b900]=useState(''),[_0x4391b8,_0x599793]=useState(''),[_0x4c218a,_0x1f1b05]=useState(''),[_0x2455d0,_0x26681d]=useState(''),[_0x586cf0,_0x4e32e3]=useState([]),_0x37e137=_0x2536b5[_0x1a8372(0x9f)](_0x20a60b=>({'label':_0x20a60b['label'],'path':_0x20a60b['path'],'local':!![],'online':_0x584b93[_0x1a8372(0xa5)](_0x20a60b[_0x1a8372(0xa0)])})),_0x55cc82=_0x2536b5[_0x1a8372(0xb7)](_0x4ecf5d=>{const _0x5da351=_0x1a8372;return!_0x584b93[_0x5da351(0xa5)](_0x4ecf5d[_0x5da351(0xa0)]);});useEffect(()=>{const _0xcd2f4c=_0x1a8372;if(!_0x479452&&_0x2536b5[_0xcd2f4c(0xcf)]>0x0&&_0x13e550['size']===0x0){const _0x25b517=new Set(_0x2536b5[_0xcd2f4c(0x9f)]((_0x379281,_0x399201)=>({'page':_0x379281,'index':_0x399201}))[_0xcd2f4c(0xb7)](({page:_0x325060})=>!_0x584b93['includes'](_0x325060[_0xcd2f4c(0xa0)]))[_0xcd2f4c(0x9f)](({index:_0x171e98})=>_0x171e98));_0x566c18(_0x25b517);}},[_0x479452,_0x2536b5[_0x1a8372(0xcf)],_0x584b93[_0x1a8372(0xcf)]]),useInput(async(_0x3c230a,_0x5cb512)=>{const _0x2c5579=_0x1a8372;if(_0x29ac8e===_0x2c5579(0xbd)){if(_0x5cb512['upArrow']){_0x3fe0e3(_0x27d191=>_0x27d191>0x0?_0x27d191-0x1:_0x2536b5[_0x2c5579(0xcf)]-0x1);return;}if(_0x5cb512[_0x2c5579(0xdc)]){_0x3fe0e3(_0x49e9bd=>_0x49e9bd<_0x2536b5[_0x2c5579(0xcf)]-0x1?_0x49e9bd+0x1:0x0);return;}if(_0x3c230a==='\x20'){_0x566c18(_0x44b1e4=>{const _0x29f6d2=_0x2c5579,_0x6ca0b9=new Set(_0x44b1e4);return _0x6ca0b9[_0x29f6d2(0xcb)](_0x9665b6)?_0x6ca0b9[_0x29f6d2(0xbe)](_0x9665b6):_0x6ca0b9[_0x29f6d2(0xd1)](_0x9665b6),_0x6ca0b9;});return;}if(_0x3c230a==='a'||_0x3c230a==='A'){const _0x3d1b4c=new Set(_0x2536b5[_0x2c5579(0x9f)]((_0x3d5fb5,_0x1b6018)=>_0x1b6018));_0x566c18(_0x3d1b4c);return;}if(_0x3c230a==='i'||_0x3c230a==='I'||_0x3c230a==='r'||_0x3c230a==='R'){_0x566c18(_0x15c155=>{const _0x19d84f=_0x2c5579,_0x1cf6e6=new Set();for(let _0x35c785=0x0;_0x35c785<_0x2536b5['length'];_0x35c785++){!_0x15c155[_0x19d84f(0xcb)](_0x35c785)&&_0x1cf6e6['add'](_0x35c785);}return _0x1cf6e6;});return;}if(_0x3c230a==='q'||_0x3c230a==='Q'){_0x239422();return;}if(_0x5cb512[_0x2c5579(0xbc)]){if(_0x13e550[_0x2c5579(0xc6)]===0x0){_0x26681d('请至少选择一个菜单');return;}const _0x4e6b94=_0x2536b5['filter']((_0x780af,_0xa3f957)=>_0x13e550[_0x2c5579(0xcb)](_0xa3f957)),_0xcb09d8=_0x4e6b94[_0x2c5579(0x9f)](_0x2b53b9=>_0x2b53b9['label'])[_0x2c5579(0xbb)](',\x20');_0x4e32e3([{'label':_0x2c5579(0xae),'value':_0x13e550[_0x2c5579(0xc6)]+'\x20个'}]),_0x26681d(''),_0x403db3('input-js');return;}return;}if(_0x29ac8e===_0x2c5579(0xab)){if(_0x5cb512[_0x2c5579(0xbc)]){const _0x5de874=_0x4c218a[_0x2c5579(0xce)]();if(_0x5de874==='')return;if(!isValidJsHttpsUrl(_0x5de874)){_0x26681d('请输入有效的\x20JS\x20https\x20链接');return;}if(!await isUrlReachable(_0x5de874)){_0x26681d('JS\x20链接无法访问');return;}_0x44b900(_0x5de874),_0x4e32e3(_0x5418ce=>[..._0x5418ce,{'label':_0x2c5579(0xc7),'value':_0x5de874}]),_0x1f1b05(''),_0x26681d(''),_0x403db3('input-css');return;}if(_0x5cb512[_0x2c5579(0xb5)]||_0x5cb512['delete']){_0x1f1b05(_0x4b8f6=>_0x4b8f6[_0x2c5579(0xc4)](0x0,-0x1)),_0x26681d('');return;}_0x1f1b05(_0x168b5b=>_0x168b5b+_0x3c230a);return;}if(_0x29ac8e===_0x2c5579(0xb8)){if(_0x5cb512['return']){const _0x1a3cf6=_0x4c218a['trim']();if(_0x1a3cf6==='')return;if(!isValidCssHttpsUrl(_0x1a3cf6)){_0x26681d('请输入有效的\x20CSS\x20https\x20链接');return;}if(!await isUrlReachable(_0x1a3cf6)){_0x26681d('CSS\x20链接无法访问');return;}_0x599793(_0x1a3cf6),_0x4e32e3(_0x54e75a=>[..._0x54e75a,{'label':_0x2c5579(0x9c),'value':_0x1a3cf6}]),_0x1f1b05(''),_0x26681d(''),_0x403db3(_0x2c5579(0xc9));const _0x45f395=_0x2536b5['filter']((_0x16fe3d,_0x24e0c5)=>_0x13e550[_0x2c5579(0xcb)](_0x24e0c5));createMenus(_0x45f395,[_0x30f505,_0x1a3cf6])['then'](()=>{const _0x4bd6e5=_0x2c5579;_0x403db3(_0x4bd6e5(0xa2)),setTimeout(()=>{_0x239422();},0x3e8);})[_0x2c5579(0xaf)](_0x1d3bed=>{const _0x139098=_0x2c5579;_0x26681d(_0x1d3bed[_0x139098(0xa4)]||_0x139098(0x9e)),_0x403db3(_0x139098(0xbd));});return;}if(_0x5cb512['backspace']||_0x5cb512['delete']){_0x1f1b05(_0x9b1dca=>_0x9b1dca[_0x2c5579(0xc4)](0x0,-0x1)),_0x26681d('');return;}_0x1f1b05(_0x5cbcc6=>_0x5cbcc6+_0x3c230a);return;}});if(_0x479452)return a10_0x8ff98a(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x4ae529(Text,{'children':'\x20\x20'}),a10_0x4ae529(a10_0x42313e,{'type':_0x1a8372(0xdb)}),a10_0x4ae529(Text,{'children':_0x1a8372(0xd0)})]});if(_0x548150)return a10_0x8ff98a(Box,{'flexDirection':_0x1a8372(0x9b),'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x8ff98a(Text,{'color':_0x1a8372(0xc0),'children':['✗\x20',_0x548150]}),a10_0x8ff98a(Box,{'marginTop':0x1,'children':[a10_0x4ae529(Text,{'color':_0x1a8372(0xd5),'children':'提示:使用\x20'}),a10_0x4ae529(Text,{'color':_0x1a8372(0xb6),'children':_0x1a8372(0xa8)}),a10_0x4ae529(Text,{'color':_0x1a8372(0xd5),'children':_0x1a8372(0xbf)})]})]});if(_0x2536b5[_0x1a8372(0xcf)]===0x0)return a10_0x4ae529(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x4ae529(Text,{'color':_0x1a8372(0xdd),'children':_0x1a8372(0xb1)})});return a10_0x8ff98a(Box,{'flexDirection':_0x1a8372(0x9b),'marginTop':0x1,'marginBottom':0x1,'children':[_0x29ac8e===_0x1a8372(0xbd)&&a10_0x8ff98a(a10_0x432a96,{'children':[a10_0x8ff98a(Box,{'children':[a10_0x8ff98a(Text,{'bold':!![],'children':['\x20\x20',_0x1a8372(0x9d),getRemainingSpaces(_0x19d39d,_0x1a8372(0x9d))]}),a10_0x8ff98a(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x51c2d3,_0x1a8372(0x9d))]}),a10_0x8ff98a(Text,{'bold':!![],'children':[_0x1a8372(0xda),getRemainingSpaces(_0x51c2d3,_0x1a8372(0x9d))]})]}),_0x37e137[_0x1a8372(0x9f)](_0x3d21d3=>a10_0x8ff98a(Box,{'children':[a10_0x8ff98a(Text,{'children':['\x20\x20',_0x3d21d3[_0x1a8372(0xc2)],getRemainingSpaces(_0x19d39d,_0x3d21d3['label'])]}),a10_0x8ff98a(Text,{'color':_0x1a8372(0xcd),'children':[_0x3d21d3['local']?'✓':'✗',getRemainingSpaces(_0x51c2d3,'✓')]}),a10_0x8ff98a(Text,{'color':_0x3d21d3[_0x1a8372(0xd4)]?_0x1a8372(0xcd):'red','children':[_0x3d21d3[_0x1a8372(0xd4)]?'✓':'✗',getRemainingSpaces(_0x51c2d3,'✓')]})]},_0x3d21d3[_0x1a8372(0xa0)]))]}),_0x29ac8e===_0x1a8372(0xbd)&&_0x586cf0[_0x1a8372(0xcf)]===0x0&&a10_0x4ae529(Box,{'marginTop':0x1,'children':a10_0x4ae529(Text,{'color':_0x1a8372(0xb6),'children':'*\x20同步菜单到\x20Lovrabet\x20平台'})}),_0x586cf0[_0x1a8372(0x9f)]((_0x5668c2,_0x37a2df)=>a10_0x8ff98a(Box,{'children':[a10_0x8ff98a(Text,{'color':_0x1a8372(0xcd),'children':['√\x20',_0x5668c2[_0x1a8372(0xc2)],':\x20']}),a10_0x4ae529(Text,{'color':'cyan','children':_0x5668c2[_0x1a8372(0xb0)]})]},_0x37a2df)),_0x2455d0&&_0x29ac8e===_0x1a8372(0xbd)&&a10_0x4ae529(Box,{'marginTop':0x1,'children':a10_0x8ff98a(Text,{'color':_0x1a8372(0xc0),'children':['✗\x20',_0x2455d0]})}),_0x29ac8e===_0x1a8372(0xbd)&&a10_0x4ae529(a10_0x432a96,{'children':a10_0x8ff98a(Box,{'marginTop':_0x586cf0[_0x1a8372(0xcf)]>0x0||_0x2455d0?0x1:0x0,'flexDirection':_0x1a8372(0x9b),'children':[a10_0x4ae529(Text,{'bold':!![],'children':_0x1a8372(0xd2)}),_0x2536b5['map']((_0x523fee,_0x3b3ab5)=>{const _0x2a454c=_0x1a8372,_0x41c916=_0x9665b6===_0x3b3ab5,_0x30a28d=_0x13e550[_0x2a454c(0xcb)](_0x3b3ab5),_0x116fc9=_0x584b93[_0x2a454c(0xa5)](_0x523fee[_0x2a454c(0xa0)]),_0x1dee77=_0x116fc9?'更新':'新建';return a10_0x4ae529(Box,{'children':a10_0x8ff98a(Text,{'backgroundColor':_0x41c916?_0x2a454c(0xa7):undefined,'color':_0x41c916?_0x2a454c(0xd8):undefined,'children':['\x20\x20',_0x30a28d?_0x2a454c(0xaa):_0x2a454c(0xd9),'\x20',_0x523fee[_0x2a454c(0xc2)]]})},_0x523fee[_0x2a454c(0xa0)]);}),a10_0x4ae529(Box,{'marginTop':0x1,'children':a10_0x8ff98a(Text,{'color':_0x1a8372(0xd5),'children':['\x20','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认']})})]})}),_0x29ac8e===_0x1a8372(0xab)&&a10_0x8ff98a(a10_0x432a96,{'children':[a10_0x8ff98a(Box,{'children':[a10_0x4ae529(Text,{'children':_0x1a8372(0xd6)}),a10_0x4ae529(Text,{'color':_0x1a8372(0xcd),'children':_0x4c218a}),_0x2455d0&&a10_0x8ff98a(Text,{'color':_0x1a8372(0xc0),'children':[_0x1a8372(0xca),_0x2455d0]})]}),!_0x2455d0&&a10_0x4ae529(Box,{'children':a10_0x4ae529(Text,{'color':_0x1a8372(0xd5),'children':_0x1a8372(0xb3)})})]}),_0x29ac8e===_0x1a8372(0xb8)&&a10_0x8ff98a(a10_0x432a96,{'children':[a10_0x8ff98a(Box,{'children':[a10_0x4ae529(Text,{'children':_0x1a8372(0xa9)}),a10_0x4ae529(Text,{'color':_0x1a8372(0xcd),'children':_0x4c218a}),_0x2455d0&&a10_0x8ff98a(Text,{'color':_0x1a8372(0xc0),'children':['\x20←\x20',_0x2455d0]})]}),!_0x2455d0&&a10_0x4ae529(Box,{'children':a10_0x4ae529(Text,{'color':_0x1a8372(0xd5),'children':'\x20输入项目的\x20CSS\x20资源链接(https://...)'})})]}),_0x29ac8e==='creating'&&a10_0x4ae529(Box,{'children':a10_0x4ae529(Text,{'children':_0x1a8372(0xba)})}),_0x29ac8e===_0x1a8372(0xa2)&&a10_0x4ae529(Box,{'children':a10_0x4ae529(Text,{'color':_0x1a8372(0xcd),'children':_0x1a8372(0xa1)})})]});}function getStringWidth(_0x4eb69a){const _0x5003b3=a10_0x1dfb;let _0x258331=0x0;for(const _0x21cf70 of _0x4eb69a){/[\u4e00-\u9fa5]/[_0x5003b3(0xc5)](_0x21cf70)?_0x258331+=0x2:_0x258331+=0x1;}return _0x258331;}function getRemainingSpaces(_0x18f9f1,_0x519605){const _0x5b37e3=a10_0x1dfb,_0x1504cf=getStringWidth(_0x519605);return Array(Math[_0x5b37e3(0xad)](0x0,_0x18f9f1-_0x1504cf))[_0x5b37e3(0xb2)]('\x20')[_0x5b37e3(0xbb)]('');}function getMaxWidth(_0x5d11d6,_0x8d1739=0x2){const _0x525151=a10_0x1dfb;let _0xbab582='',_0x4e2711=0x0;for(const _0x17ff2e of _0x5d11d6){const _0x211a8c=getStringWidth(_0x17ff2e);_0x211a8c>_0x4e2711&&(_0x4e2711=_0x211a8c,_0xbab582=_0x17ff2e);}return _0xbab582+'\x20'[_0x525151(0xc8)](_0x8d1739);}
|