@lovrabet/cli 1.1.26-beta.1 → 1.1.26-beta.3
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 -1
- package/lib/app-menu/utils.js +1 -1
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/app-menu-cdn-version/app-menu-sync-cdn-version-ui.js +1 -1
- package/lib/app-menu-cdn-version/cdn-url-compare-table.js +1 -0
- package/lib/app-menu-cdn-version/update-menu-cdn-url.js +1 -1
- 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 +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x18c47c,_0x516f49){const _0x3a01df=a0_0x3307,_0x3664a9=_0x18c47c();while(!![]){try{const _0x1e91e5=parseInt(_0x3a01df(0x129))/0x1*(parseInt(_0x3a01df(0x136))/0x2)+-parseInt(_0x3a01df(0x123))/0x3+-parseInt(_0x3a01df(0x12e))/0x4+parseInt(_0x3a01df(0x128))/0x5+-parseInt(_0x3a01df(0x137))/0x6*(parseInt(_0x3a01df(0x12c))/0x7)+-parseInt(_0x3a01df(0x13f))/0x8*(parseInt(_0x3a01df(0x13e))/0x9)+parseInt(_0x3a01df(0x139))/0xa;if(_0x1e91e5===_0x516f49)break;else _0x3664a9['push'](_0x3664a9['shift']());}catch(_0x4e2860){_0x3664a9['push'](_0x3664a9['shift']());}}}(a0_0xbcb7,0x83bc9));import{jsx as a0_0x48a777,jsxs as a0_0xe968a2}from'react/jsx-runtime';function a0_0x3307(_0x4d0a13,_0x5aa0ad){const _0xbcb72e=a0_0xbcb7();return a0_0x3307=function(_0x330732,_0x4b9e88){_0x330732=_0x330732-0x123;let _0x2f0b98=_0xbcb72e[_0x330732];return _0x2f0b98;},a0_0x3307(_0x4d0a13,_0x5aa0ad);}function a0_0xbcb7(){const _0x52f80f=['428256stXbvC','endsWith','页面路由地址:\x20','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','slice','247875HOkTFh','635zkAWfy','length','页面路径\x20','1659GDJlly','trim','826624PfpQJr','页面路径不合法','startsWith','路径不能以\x20/\x20开头或结尾','gray','\x20直接回车确认,或输入自定义路由地址','\x20←\x20','red','816InCesw','12588RntJIF','existsSync','19060320UPZIvi','green','backspace','路径不能包含连续的\x20/','\x20已存在,请使用其他路径','4140SMdTjG','14408rNBbMu'];a0_0xbcb7=function(){return _0x52f80f;};return a0_0xbcb7();}import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x315c6b from'node:fs';export function InputProjectCode(_0x3be506){const _0x4662a0=a0_0x3307,{onSubmit:_0x555923,pagePath:_0x3939f9}=_0x3be506,[_0xa9391c,_0x3c9b0c]=useState(''),[_0x4fdd4b,_0x3448fa]=useState(''),_0x37ccff='my-page';function _0x4642c5(_0x1bcee3){const _0x28589b=a0_0x3307;if(_0x1bcee3[_0x28589b(0x12a)]>0x64)return{'valid':![],'message':'页面路径长度不能超过\x20100\x20个字符'};if(_0x1bcee3[_0x28589b(0x130)]('/')||_0x1bcee3[_0x28589b(0x124)]('/'))return{'valid':![],'message':_0x28589b(0x131)};if(_0x1bcee3['includes']('//'))return{'valid':![],'message':_0x28589b(0x13c)};const _0x385d81=_0x1bcee3['split']('/');for(const _0x219b1f of _0x385d81){if(!_0x219b1f)continue;const _0x1f5ba6=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x1f5ba6['test'](_0x219b1f))return{'valid':![],'message':_0x28589b(0x126)};}return{'valid':!![]};}return useInput((_0x253af3,_0x2aefff)=>{const _0x9b0eb5=a0_0x3307;if(_0x2aefff['return']){const _0xd2df4b=_0xa9391c[_0x9b0eb5(0x12d)]()||_0x37ccff;if(_0x4fdd4b)return;const _0x52d8ee=_0x3939f9+'/'+_0xd2df4b;if(a0_0x315c6b[_0x9b0eb5(0x138)](_0x52d8ee)){_0x3448fa(_0x9b0eb5(0x12b)+_0xd2df4b+_0x9b0eb5(0x13d));return;}_0x555923(_0xd2df4b),_0x3c9b0c(''),_0x3448fa('');}else _0x2aefff[_0x9b0eb5(0x13b)]||_0x2aefff['delete']?_0x3c9b0c(_0x397cbd=>{const _0x6d0420=_0x9b0eb5,_0x5eb6c8=_0x397cbd[_0x6d0420(0x127)](0x0,-0x1),{valid:_0xdacd33,message:_0xcd67af}=_0x4642c5(_0x5eb6c8);return _0x3448fa(_0xdacd33?'':_0xcd67af||_0x6d0420(0x12f)),_0x5eb6c8;}):_0x3c9b0c(_0x20bdd6=>{const _0x37e956=_0x9b0eb5,_0x5b8753=_0x20bdd6+_0x253af3,{valid:_0x908636,message:_0x3f79f6}=_0x4642c5(_0x5b8753);return _0x3448fa(_0x908636?'':_0x3f79f6||_0x37e956(0x12f)),_0x5b8753;});}),a0_0xe968a2(Box,{'flexDirection':'column','children':[a0_0xe968a2(Box,{'children':[a0_0x48a777(Text,{'color':_0x4662a0(0x132),'children':'\x20Step2:\x20'}),a0_0x48a777(Text,{'children':_0x4662a0(0x125)}),_0xa9391c?a0_0x48a777(Text,{'color':_0x4662a0(0x13a),'children':_0xa9391c}):a0_0x48a777(Text,{'color':_0x4662a0(0x132),'children':_0x37ccff}),_0x4fdd4b&&a0_0xe968a2(Text,{'color':_0x4662a0(0x135),'children':[_0x4662a0(0x134),_0x4fdd4b]})]}),!_0x4fdd4b&&!_0xa9391c&&a0_0x48a777(Box,{'children':a0_0x48a777(Text,{'color':_0x4662a0(0x132),'children':_0x4662a0(0x133)})})]});}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0x4a795c=a1_0x40e1;(function(_0x2432c1,_0x467d22){const _0x531422=a1_0x40e1,_0x492dec=_0x2432c1();while(!![]){try{const _0x3e62f5=-parseInt(_0x531422(0xd2))/0x1*(-parseInt(_0x531422(0xdf))/0x2)+-parseInt(_0x531422(0xd8))/0x3*(parseInt(_0x531422(0xf1))/0x4)+-parseInt(_0x531422(0xe0))/0x5*(-parseInt(_0x531422(0xf8))/0x6)+-parseInt(_0x531422(0xf5))/0x7*(parseInt(_0x531422(0xd6))/0x8)+parseInt(_0x531422(0xfc))/0x9*(parseInt(_0x531422(0xed))/0xa)+parseInt(_0x531422(0xde))/0xb*(-parseInt(_0x531422(0xf3))/0xc)+parseInt(_0x531422(0xd3))/0xd;if(_0x3e62f5===_0x467d22)break;else _0x492dec['push'](_0x492dec['shift']());}catch(_0x38ac72){_0x492dec['push'](_0x492dec['shift']());}}}(a1_0xf602,0xb029d));import{jsx as a1_0x27d756,jsxs as a1_0x25649d,Fragment as a1_0x28902d}from'react/jsx-runtime';function a1_0xf602(){const _0x401da5=['column','error','resolve','\x20*\x20页面文件已创建,可直接通过路由访问','\x20Step2:\x20','开始添加页面:\x20','info','页面添加成功:\x20','1344300UeRVBI','catch','正在创建页面,请稍候…','setLogPath','3537548YKRZEQ','processTemplate','2388QSfGFa','已选择页面模板\x20','27559uNuLgw','\x20*\x20页面路径:\x20','页面添加失败:\x20','2172KKXgTB','pages','src','gray','45EkdPHj','cwd','success','4UNFsUf','2182843fUWMWI','cyan','finally','2664yeGYeA','url','3AkADYw','\x20*\x20页面创建成功!','../../templates/pages','dirname','green','\x20Step1:\x20','1826LdkEqj','421654JPwZIg','17495fDmtFm','\x20*\x20路由地址:\x20','join','message','add-page'];a1_0xf602=function(){return _0x401da5;};return a1_0xf602();}import{fileURLToPath}from'node:url';import a1_0x384fd3 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';function a1_0x40e1(_0x3be597,_0x20366c){const _0xf602e2=a1_0xf602();return a1_0x40e1=function(_0x40e19f,_0x517b7a){_0x40e19f=_0x40e19f-0xd1;let _0x4bf238=_0xf602e2[_0x40e19f];return _0x4bf238;},a1_0x40e1(_0x3be597,_0x20366c);}import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x384fd3[a1_0x4a795c(0xdb)](fileURLToPath(import.meta[a1_0x4a795c(0xd7)])),pageTemplateDir=a1_0x384fd3[a1_0x4a795c(0xe7)](__dirname,a1_0x4a795c(0xda)),projectDir=process[a1_0x4a795c(0xfd)]();export const AddPage=()=>{const _0x10e7e7=a1_0x4a795c,{exit:_0x4736ce}=useApp(),[_0x3ae51e,_0x1657de]=useState(''),[_0x3a9b70,_0x1d6f51]=useState(''),[_0x471f40,_0x5009dd]=useState(![]),[_0xa4d14b,_0xe06862]=useState(![]),_0x56b98b=a1_0x384fd3['join'](projectDir,_0x10e7e7(0xfa),_0x10e7e7(0xf9)),_0x4dedc3=a1_0x384fd3[_0x10e7e7(0xe2)](_0x56b98b,_0x3a9b70),_0x4af360=a1_0x384fd3['join']('src',_0x10e7e7(0xf9),_0x3a9b70);useEffect(()=>{const _0x272b11=_0x10e7e7,_0x11e6d4=a1_0x384fd3[_0x272b11(0xe7)](pageTemplateDir,_0x3ae51e);if(_0x3ae51e&&_0x3a9b70){_0x5009dd(!![]),logger[_0x272b11(0xf0)](process[_0x272b11(0xfd)]());const _0x5a80d8=Date['now']();logger[_0x272b11(0xeb)](_0x272b11(0xe4),_0x272b11(0xea)+_0x3a9b70,{'template':_0x3ae51e,'targetPath':_0x4af360}),TemplateReplacer[_0x272b11(0xf2)](_0x11e6d4,a1_0x384fd3[_0x272b11(0xe2)](_0x56b98b,_0x3a9b70),_0x3a9b70,_0x3ae51e)['then'](()=>{const _0x2c23f1=_0x272b11,_0x5267fb=Date['now']()-_0x5a80d8;logger[_0x2c23f1(0xd1)](_0x2c23f1(0xe4),_0x2c23f1(0xec)+_0x3a9b70,_0x5267fb,{'template':_0x3ae51e,'targetPath':_0x4af360,'routePath':_0x3a9b70}),_0xe06862(!![]);})[_0x272b11(0xee)](_0x5e727a=>{const _0x38df22=_0x272b11,_0x58b451=Date['now']()-_0x5a80d8;logger[_0x38df22(0xe6)](_0x38df22(0xe4),_0x38df22(0xf7)+_0x3a9b70,{'template':_0x3ae51e,'targetPath':_0x4af360,'error':_0x5e727a instanceof Error?_0x5e727a[_0x38df22(0xe3)]:String(_0x5e727a),'duration':_0x58b451});})[_0x272b11(0xd5)](()=>{_0x5009dd(![]);});}},[_0x3ae51e,_0x3a9b70]),useEffect(()=>{_0xa4d14b&&setTimeout(()=>{_0x4736ce();});},[_0xa4d14b]);if(_0x3ae51e)return a1_0x25649d(Box,{'flexDirection':_0x10e7e7(0xe5),'paddingY':0x1,'children':[a1_0x25649d(Box,{'children':[a1_0x27d756(Text,{'color':_0x10e7e7(0xfb),'children':_0x10e7e7(0xdd)}),a1_0x27d756(Text,{'children':_0x10e7e7(0xf4)}),a1_0x27d756(Text,{'color':_0x10e7e7(0xdc),'children':_0x3ae51e})]}),_0x3a9b70?a1_0x25649d(Box,{'children':[a1_0x27d756(Text,{'color':_0x10e7e7(0xfb),'children':_0x10e7e7(0xe9)}),a1_0x27d756(Text,{'children':'已输入的页面路由\x20'}),a1_0x27d756(Text,{'color':_0x10e7e7(0xdc),'children':_0x3a9b70})]}):a1_0x27d756(InputProjectCode,{'pagePath':_0x4dedc3,'onSubmit':_0x1d6f51}),_0x3a9b70&&_0x471f40?a1_0x25649d(Box,{'marginTop':0x1,'children':[a1_0x27d756(Box,{'width':'4'}),a1_0x27d756(Text,{'children':_0x10e7e7(0xef)})]}):null,_0xa4d14b?a1_0x25649d(a1_0x28902d,{'children':[a1_0x27d756(Box,{'marginTop':0x1,'children':a1_0x27d756(Text,{'color':'gray','children':_0x10e7e7(0xd9)})}),a1_0x25649d(Box,{'children':[a1_0x27d756(Text,{'color':'gray','children':_0x10e7e7(0xf6)}),a1_0x27d756(Text,{'color':_0x10e7e7(0xdc),'children':_0x4af360})]}),a1_0x25649d(Box,{'children':[a1_0x27d756(Text,{'color':_0x10e7e7(0xfb),'children':_0x10e7e7(0xe1)}),a1_0x25649d(Text,{'color':'green','children':['/',_0x3a9b70]})]}),a1_0x27d756(Box,{'marginTop':0x1,'children':a1_0x27d756(Text,{'color':_0x10e7e7(0xd4),'children':_0x10e7e7(0xe8)})})]}):null]});return a1_0x27d756(SelectPageTemplate,{'onSelect':_0x1657de});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x244945,_0x28fbf5){const _0x22b133=a2_0x2b7a,_0x32c699=_0x244945();while(!![]){try{const _0x17f586=parseInt(_0x22b133(0x1b7))/0x1*(parseInt(_0x22b133(0x1a4))/0x2)+parseInt(_0x22b133(0x1b6))/0x3*(-parseInt(_0x22b133(0x1ac))/0x4)+parseInt(_0x22b133(0x1c6))/0x5+-parseInt(_0x22b133(0x1bf))/0x6+-parseInt(_0x22b133(0x1b9))/0x7+parseInt(_0x22b133(0x1ab))/0x8*(parseInt(_0x22b133(0x1ba))/0x9)+parseInt(_0x22b133(0x1bb))/0xa*(parseInt(_0x22b133(0x1c5))/0xb);if(_0x17f586===_0x28fbf5)break;else _0x32c699['push'](_0x32c699['shift']());}catch(_0x1cfe88){_0x32c699['push'](_0x32c699['shift']());}}}(a2_0x50d3,0xf0a4e));import{jsx as a2_0x16a2cf,jsxs as a2_0x462711}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x538ba7 from'node:path';function a2_0x2b7a(_0x1cb6d9,_0x1332a7){const _0x50d382=a2_0x50d3();return a2_0x2b7a=function(_0x2b7a49,_0x999f94){_0x2b7a49=_0x2b7a49-0x1a4;let _0x90e651=_0x50d382[_0x2b7a49];return _0x90e651;},a2_0x2b7a(_0x1cb6d9,_0x1332a7);}import{fileURLToPath}from'node:url';function a2_0x50d3(){const _0x27c8cb=['url','resolve','localeCompare','gray','map','\x20Step1:\x20','filter','column','../..','81sAIpIm','1soFdfe','获取模板列表失败:','2358811YCbdBp','1431855vudRVy','9517030gOEbus','isDirectory','join','sort','11588280CHgrsU','正在加载页面模板...','green','sdk-fetch','downArrow','templates/pages','33ahSOXs','3762370oSWnHs','onSelect','return','1051276MDbLIO','error','label','请选择您要创建的页面模板','blank','length','\x20\x20\x20\x20\x20\x20>\x20','8DImVpY','153820dvPRjT'];a2_0x50d3=function(){return _0x27c8cb;};return a2_0x50d3();}async function getTemplateList(){const _0x280efe=a2_0x2b7a;try{const _0x5112fb=fileURLToPath(import.meta[_0x280efe(0x1ad)]),_0x1d74b7=a2_0x538ba7[_0x280efe(0x1ae)](a2_0x538ba7['dirname'](_0x5112fb),_0x280efe(0x1b5)),_0x31b64=a2_0x538ba7[_0x280efe(0x1bd)](_0x1d74b7,_0x280efe(0x1c4)),_0x41a2bf=await readdir(_0x31b64,{'withFileTypes':!![]}),_0x389003=_0x41a2bf[_0x280efe(0x1b3)](_0x1a596d=>_0x1a596d[_0x280efe(0x1bc)]())[_0x280efe(0x1b1)](_0x56e6f0=>({'label':_0x56e6f0['name']}))[_0x280efe(0x1be)]((_0x38ad8d,_0x50bda2)=>_0x38ad8d[_0x280efe(0x1a6)][_0x280efe(0x1af)](_0x50bda2[_0x280efe(0x1a6)]));return _0x389003;}catch(_0x4f26de){return console[_0x280efe(0x1a5)](_0x280efe(0x1b8),_0x4f26de),[{'label':_0x280efe(0x1a8)},{'label':_0x280efe(0x1c2)}];}}export function SelectPageTemplate(_0xbcdb07){const _0x51ac21=a2_0x2b7a,[_0x58b3b8,_0x3227f2]=useState(0x0),[_0x1532c8,_0x4566cc]=useState([]),[_0x465834,_0x1b4fda]=useState(!![]);useEffect(()=>{async function _0x41ebb3(){const _0x5ae387=await getTemplateList();_0x4566cc(_0x5ae387),_0x1b4fda(![]);}_0x41ebb3();},[]),useInput((_0x43d81f,_0xcbf3eb)=>{const _0x4c8772=a2_0x2b7a;if(_0x465834)return;if(_0xcbf3eb[_0x4c8772(0x1c8)]){const _0x281fe7=_0x1532c8[_0x58b3b8];_0x281fe7&&_0xbcdb07[_0x4c8772(0x1c7)](_0x281fe7[_0x4c8772(0x1a6)]);}_0xcbf3eb['upArrow']&&_0x3227f2(_0x1a20b8=>_0x1a20b8===0x0?_0x1532c8[_0x4c8772(0x1a9)]-0x1:_0x1a20b8-0x1),_0xcbf3eb[_0x4c8772(0x1c3)]&&_0x3227f2(_0x3df69c=>_0x3df69c===_0x1532c8[_0x4c8772(0x1a9)]-0x1?0x0:_0x3df69c+0x1);});if(_0x465834)return a2_0x16a2cf(Box,{'flexDirection':_0x51ac21(0x1b4),'paddingY':0x1,'children':a2_0x462711(Box,{'children':[a2_0x16a2cf(Text,{'color':'gray','children':_0x51ac21(0x1b2)}),a2_0x16a2cf(Text,{'children':_0x51ac21(0x1c0)})]})});return a2_0x462711(Box,{'flexDirection':_0x51ac21(0x1b4),'paddingY':0x1,'children':[a2_0x462711(Box,{'children':[a2_0x16a2cf(Text,{'color':_0x51ac21(0x1b0),'children':_0x51ac21(0x1b2)}),a2_0x16a2cf(Text,{'children':_0x51ac21(0x1a7)})]}),_0x1532c8[_0x51ac21(0x1b1)]((_0x38c3d9,_0x2fbacc)=>{const _0xafb9=_0x51ac21,_0x2f2b2f=_0x2fbacc===_0x58b3b8,_0x421ebd=_0x2f2b2f?_0xafb9(0x1aa)+_0x38c3d9[_0xafb9(0x1a6)]:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x38c3d9['label'];return a2_0x16a2cf(Box,{'children':a2_0x16a2cf(Text,{'color':_0x2f2b2f?_0xafb9(0x1c1):undefined,'children':_0x421ebd})},_0x421ebd);})]});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3040cc,_0x23843c){const _0x191f7a=a3_0x3afc,_0x1deb13=_0x3040cc();while(!![]){try{const _0x52b077=-parseInt(_0x191f7a(0x181))/0x1*(-parseInt(_0x191f7a(0x18e))/0x2)+parseInt(_0x191f7a(0x180))/0x3*(parseInt(_0x191f7a(0x19b))/0x4)+-parseInt(_0x191f7a(0x176))/0x5+parseInt(_0x191f7a(0x17c))/0x6+-parseInt(_0x191f7a(0x18c))/0x7+-parseInt(_0x191f7a(0x172))/0x8*(parseInt(_0x191f7a(0x183))/0x9)+parseInt(_0x191f7a(0x18f))/0xa*(parseInt(_0x191f7a(0x197))/0xb);if(_0x52b077===_0x23843c)break;else _0x1deb13['push'](_0x1deb13['shift']());}catch(_0x3f2fd1){_0x1deb13['push'](_0x1deb13['shift']());}}}(a3_0x589a,0x255ed));import{jsx as a3_0x3265c3,jsxs as a3_0x13ca40,Fragment as a3_0x2b08d4}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';function a3_0x589a(){const _0x46f0b7=['cwd','文档生成失败:\x20','api-doc','length','map','cyan','log','1131592OpwIWK','success','gray','使用配置的应用AppCode:\x20','832020sOakUj','includes','*\x20输出目录:\x20','.md\x20(','\x1b[90m*\x20从\x20',',\x20失败\x20','1655322EutWnz','使用指定的应用AppCode:\x20','green','white','48HMmRBz','63218YtRJyt','./docs','9unySmh','文档生成完成','\x20个数据集','message','setLogPath','💡\x20请使用\x20','yellow','filter','\x1b[33m!\x20以下数据集代码不存在:\x20','1740242tjXsVn','*\x20生成的文档文件:','2msipdi','10UoHkgs','√\x20文档生成完成!成功\x20','lovrabet\x20auth','env','正在生成\x20','🚀\x20','datasetName','dim','3936669mqSQUm','正在获取数据集列表...','datasetCode','error','3136LaHjOT','指定的数据集代码都不存在:\x20','column','filePath','join'];a3_0x589a=function(){return _0x46f0b7;};return a3_0x589a();}function a3_0x3afc(_0x42ce2b,_0x1aba96){const _0x589a30=a3_0x589a();return a3_0x3afc=function(_0x3afc79,_0xab2f52){_0x3afc79=_0x3afc79-0x16d;let _0x24e45a=_0x589a30[_0x3afc79];return _0x24e45a;},a3_0x3afc(_0x42ce2b,_0x1aba96);}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:_0x2eaea8,env:_0x26a2b7,output:_0x12157f,extraParams:_0x11fbb9,datasetCodes:_0x4b978})=>{const _0x21a048=a3_0x3afc,{exit:_0x2930a6}=useApp(),[_0x1cd851,_0x5813b6]=useState(![]),[_0x55e4b9,_0xf083a2]=useState(''),[_0x244086,_0x366f8b]=useState(![]),[_0x43b52,_0x7ad2c4]=useState(null),[_0x42b872,_0x4477ca]=useState(null),[_0x4a0d7c,_0x20552c]=useState(0x0),_0x3aa0c2=readConfig(),_0x10e67d=getConfigAppCode(),_0x267e52=_0x2eaea8||_0x10e67d,_0x27b9db=typeof _0x3aa0c2?.[_0x21a048(0x192)]==='string'?_0x3aa0c2['env']:undefined,_0x24ddcb=_0x26a2b7||_0x27b9db||'online';initEnv(_0x24ddcb);const _0x1d3255=_0x12157f||_0x21a048(0x182),_0x5631bc=_0x2eaea8?_0x21a048(0x17d)+_0x267e52:_0x21a048(0x175)+_0x267e52;useEffect(()=>{_0x5813b6(!![]),_0x38c28f();},[]),useEffect(()=>{(_0x244086||_0x43b52)&&_0x2930a6();},[_0x244086,_0x43b52,_0x2930a6]);async function _0x38c28f(){const _0x293acc=_0x21a048;if(!_0x267e52){_0x7ad2c4('未提供应用AppCode,且配置中也没有默认值');return;}try{logger[_0x293acc(0x187)](process[_0x293acc(0x1a0)]()),_0xf083a2(_0x293acc(0x198));const {configArray:_0x1ce702}=await fetchModelList(_0x267e52);_0x20552c(_0x1ce702[_0x293acc(0x16e)]);if(_0x1ce702[_0x293acc(0x16e)]===0x0){_0x7ad2c4('未找到任何数据集');return;}let _0x2aefef=_0x1ce702;if(_0x4b978&&_0x4b978[_0x293acc(0x16e)]>0x0){_0x2aefef=_0x1ce702[_0x293acc(0x18a)](_0xe8e56c=>_0x4b978[_0x293acc(0x177)](_0xe8e56c[_0x293acc(0x199)]));const _0x258034=_0x2aefef[_0x293acc(0x16f)](_0x5a53de=>_0x5a53de[_0x293acc(0x199)]),_0x1b405d=_0x4b978[_0x293acc(0x18a)](_0xec053e=>!_0x258034['includes'](_0xec053e));_0x1b405d['length']>0x0&&console['log'](_0x293acc(0x18b)+_0x1b405d[_0x293acc(0x19f)](',\x20')+'\x1b[0m');if(_0x2aefef[_0x293acc(0x16e)]===0x0){_0x7ad2c4(_0x293acc(0x19c)+_0x4b978[_0x293acc(0x19f)](',\x20'));return;}console[_0x293acc(0x171)](_0x293acc(0x17a)+_0x1ce702['length']+'\x20个数据集中筛选出\x20'+_0x2aefef['length']+'\x20个匹配的数据集\x1b[0m');}_0xf083a2(_0x293acc(0x193)+_0x2aefef[_0x293acc(0x16e)]+'\x20个数据集的文档...');const _0x1b7cd4=await generateDatasetDocs(_0x2aefef,_0x267e52,_0x1d3255,(_0x14fdf4,_0x520cd1,_0xf5c410)=>{const _0x4bf223=_0x293acc;_0xf083a2(_0x4bf223(0x193)+_0xf5c410+_0x4bf223(0x179)+_0x14fdf4+'/'+_0x520cd1+')');},_0x11fbb9);_0x4477ca(_0x1b7cd4),_0x366f8b(!![]);const _0x25e23b=_0x1b7cd4[_0x293acc(0x18a)](_0x4b1d6c=>_0x4b1d6c[_0x293acc(0x173)])['length'],_0xaa8406=_0x1b7cd4[_0x293acc(0x18a)](_0x137b1c=>!_0x137b1c[_0x293acc(0x173)])[_0x293acc(0x16e)];logger[_0x293acc(0x173)](_0x293acc(0x16d),_0x293acc(0x184),undefined,{'totalCount':_0x1b7cd4[_0x293acc(0x16e)],'successCount':_0x25e23b,'failCount':_0xaa8406,'outputDir':_0x1d3255});}catch(_0x5571b2){const _0x1a3359=_0x5571b2 instanceof Error?_0x5571b2[_0x293acc(0x186)]:String(_0x5571b2);logger['error'](_0x293acc(0x16d),_0x293acc(0x1a1)+_0x1a3359,{'appCode':_0x267e52,'outputDir':_0x1d3255}),_0x7ad2c4(_0x293acc(0x1a1)+_0x1a3359);}finally{_0x5813b6(![]);}}const _0x50ed3e=_0x42b872?.[_0x21a048(0x18a)](_0x51b271=>_0x51b271[_0x21a048(0x173)])[_0x21a048(0x16e)]||0x0,_0x43adf6=_0x42b872?.[_0x21a048(0x18a)](_0xf66d78=>!_0xf66d78[_0x21a048(0x173)])['length']||0x0;return a3_0x13ca40(Box,{'flexDirection':_0x21a048(0x19d),'children':[(_0x1cd851||_0x244086)&&a3_0x13ca40(Box,{'children':[a3_0x3265c3(Text,{'color':_0x21a048(0x174),'children':'*\x20'}),a3_0x3265c3(Text,{'color':_0x2eaea8?_0x21a048(0x17f):_0x21a048(0x196),'children':_0x5631bc})]}),_0x1cd851&&a3_0x3265c3(Box,{'children':a3_0x13ca40(Text,{'children':[_0x21a048(0x194),_0x55e4b9,'\x20(环境:\x20',_0x24ddcb,')']})}),_0x244086&&_0x42b872&&a3_0x13ca40(Box,{'flexDirection':_0x21a048(0x19d),'children':[a3_0x3265c3(Box,{'children':a3_0x13ca40(Text,{'color':_0x21a048(0x17e),'children':[_0x21a048(0x190),_0x50ed3e,'\x20个',_0x43adf6>0x0&&_0x21a048(0x17b)+_0x43adf6+'\x20个']})}),a3_0x3265c3(Box,{'marginTop':0x1,'children':a3_0x13ca40(Text,{'color':_0x21a048(0x174),'children':['*\x20共处理\x20',_0x4a0d7c,_0x21a048(0x185)]})}),a3_0x13ca40(Box,{'marginTop':0x1,'children':[a3_0x3265c3(Text,{'color':_0x21a048(0x174),'children':_0x21a048(0x178)}),a3_0x3265c3(Text,{'color':'cyan','children':_0x1d3255})]}),_0x50ed3e>0x0&&a3_0x13ca40(a3_0x2b08d4,{'children':[a3_0x3265c3(Box,{'marginTop':0x1,'children':a3_0x3265c3(Text,{'color':'gray','children':_0x21a048(0x18d)})}),_0x42b872[_0x21a048(0x18a)](_0x2ee439=>_0x2ee439[_0x21a048(0x173)])[_0x21a048(0x16f)]((_0x341807,_0x23d42d)=>a3_0x13ca40(Box,{'marginLeft':0x2,'children':[a3_0x13ca40(Text,{'color':'cyan','children':['•\x20',_0x341807[_0x21a048(0x19e)]]}),a3_0x13ca40(Text,{'color':_0x21a048(0x196),'children':['\x20-\x20',_0x341807[_0x21a048(0x195)]]})]},_0x23d42d))]}),_0x43adf6>0x0&&a3_0x13ca40(a3_0x2b08d4,{'children':[a3_0x3265c3(Box,{'marginTop':0x1,'children':a3_0x3265c3(Text,{'color':'yellow','children':'⚠️\x20以下数据集生成失败:'})}),_0x42b872[_0x21a048(0x18a)](_0x68d8ac=>!_0x68d8ac[_0x21a048(0x173)])[_0x21a048(0x16f)]((_0xa11bfd,_0x349bc8)=>a3_0x13ca40(Box,{'marginLeft':0x2,'flexDirection':_0x21a048(0x19d),'children':[a3_0x13ca40(Text,{'color':'red','children':['•\x20',_0xa11bfd[_0x21a048(0x195)],'\x20(',_0xa11bfd[_0x21a048(0x199)],')']}),_0xa11bfd[_0x21a048(0x19a)]&&a3_0x3265c3(Box,{'marginLeft':0x2,'children':a3_0x3265c3(Text,{'color':_0x21a048(0x196),'children':_0xa11bfd[_0x21a048(0x19a)]})})]},_0x349bc8))]})]}),_0x43b52&&a3_0x13ca40(Box,{'flexDirection':_0x21a048(0x19d),'children':[a3_0x3265c3(Box,{'children':a3_0x13ca40(Text,{'color':'red','children':['❌\x20',_0x43b52]})}),_0x43b52[_0x21a048(0x177)]('登录')&&a3_0x13ca40(Box,{'marginTop':0x1,'children':[a3_0x3265c3(Text,{'color':_0x21a048(0x189),'children':_0x21a048(0x188)}),a3_0x3265c3(Text,{'color':_0x21a048(0x170),'children':_0x21a048(0x191)}),a3_0x3265c3(Text,{'color':'yellow','children':'\x20重新登录后再试'})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a4_0x16f9aa=a4_0x3d74;(function(_0x392fb3,_0x1cdb03){const _0x36ee01=a4_0x3d74,_0x3b472f=_0x392fb3();while(!![]){try{const _0x3e79b6=parseInt(_0x36ee01(0xef))/0x1+-parseInt(_0x36ee01(0x112))/0x2+-parseInt(_0x36ee01(0x106))/0x3+parseInt(_0x36ee01(0xff))/0x4+parseInt(_0x36ee01(0x10d))/0x5+-parseInt(_0x36ee01(0x108))/0x6+parseInt(_0x36ee01(0x113))/0x7;if(_0x3e79b6===_0x1cdb03)break;else _0x3b472f['push'](_0x3b472f['shift']());}catch(_0x363d74){_0x3b472f['push'](_0x3b472f['shift']());}}}(a4_0x4bbb,0x7aaf8));import{mkdirSync,writeFileSync}from'node:fs';function a4_0x3d74(_0x3f823c,_0xf529f4){const _0x4bbb83=a4_0x4bbb();return a4_0x3d74=function(_0x3d740e,_0x15094b){_0x3d740e=_0x3d740e-0xec;let _0x130482=_0x4bbb83[_0x3d740e];return _0x130482;},a4_0x3d74(_0x3f823c,_0xf529f4);}import a4_0xe5adc9 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a4_0x4bbb(){const _0x250b10=['✓\x20成功生成:\x20','),HTTP状态码:\x20','/api/node-toolbox/api-doc-generator','等待\x203\x20秒...\x0a','4609250QZiKjY','length','error','json','api-doc','756150YitznO','2044700etdNLj',']\x20正在生成:\x20','status','markdown','./docs','60377sfosYk','utf8','data','stringify','POST','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','.md\x20(','响应数据格式错误\x20(','.md\x20-\x20','name','datasetCode','text','push','tableName','✗\x20失败:\x20','string','2820184EQtbyl','\x20个数据集需要生成文档\x0a','获取文档失败\x20(','生成文档成功:\x20','log','success','):缺少\x20data.markdown\x20字段','1122243KvUkUL','message','4348182PglReR'];a4_0x4bbb=function(){return _0x250b10;};return a4_0x4bbb();}import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x337794){const _0x35c1e6=a4_0x3d74,{appCode:_0x3fd19d,datasetCode:_0x47b246,datasetId:_0xaeb4b1,extraParams:_0x8e1823}=_0x337794,_0x2d5c48=getApiDomain(),_0x5d8c41=_0x2d5c48+_0x35c1e6(0x10b),_0x475210={'appCode':_0x3fd19d,'datasetCode':_0x47b246,'datasetId':_0xaeb4b1,..._0x8e1823||{}},_0x5b6acc=await fetch(_0x5d8c41,{'method':_0x35c1e6(0xf3),'headers':{'Content-Type':'application/json','Cookie':getCookie()},'body':JSON[_0x35c1e6(0xf2)](_0x475210)});if(!_0x5b6acc['ok']){if(_0x5b6acc['status']===0x191)throw new Error(_0x35c1e6(0xf4));let _0x14874a='';try{_0x14874a=await _0x5b6acc[_0x35c1e6(0xfa)]();}catch(_0x221493){}throw new Error(_0x35c1e6(0x101)+_0x47b246+_0x35c1e6(0x10a)+_0x5b6acc[_0x35c1e6(0xec)]+(_0x14874a?'\x0a'+_0x14874a:''));}const _0x59c1be=await _0x5b6acc[_0x35c1e6(0x110)]();if(!_0x59c1be[_0x35c1e6(0xf1)]||typeof _0x59c1be['data'][_0x35c1e6(0xed)]!==_0x35c1e6(0xfe))throw new Error(_0x35c1e6(0xf6)+_0x47b246+_0x35c1e6(0x105));return _0x59c1be[_0x35c1e6(0xf1)][_0x35c1e6(0xed)];}function delay(_0x5d7b5e){return new Promise(_0x539aec=>setTimeout(_0x539aec,_0x5d7b5e));}export async function generateDatasetDocs(_0x5b2f42,_0x331d94,_0x2e27c1=a4_0x16f9aa(0xee),_0x365195,_0x2a6050){const _0x3e8c46=a4_0x16f9aa;mkdirSync(_0x2e27c1,{'recursive':!![]});const _0xc9eb96=[],_0x18bff7=_0x5b2f42['length'];console[_0x3e8c46(0x103)]('\x0a共有\x20'+_0x18bff7+_0x3e8c46(0x100));for(let _0xf615f2=0x0;_0xf615f2<_0x5b2f42[_0x3e8c46(0x10e)];_0xf615f2++){const _0xbad819=_0x5b2f42[_0xf615f2],_0x280569=_0xf615f2+0x1,_0x50dd39=_0xbad819[_0x3e8c46(0xfc)];try{console[_0x3e8c46(0x103)]('['+_0x280569+'/'+_0x18bff7+_0x3e8c46(0x114)+_0x50dd39+_0x3e8c46(0xf5)+_0xbad819[_0x3e8c46(0xf8)]+')');_0x365195&&_0x365195(_0x280569,_0x18bff7,_0x50dd39);const _0x8dc52d=await fetchDatasetDoc({'appCode':_0x331d94,'datasetCode':_0xbad819[_0x3e8c46(0xf9)],'datasetId':_0xbad819['id'],'enableAI':![],'extraParams':_0x2a6050}),_0x3cebfb=a4_0xe5adc9['join'](_0x2e27c1,_0x50dd39+'.md');writeFileSync(_0x3cebfb,_0x8dc52d,{'encoding':_0x3e8c46(0xf0)}),console[_0x3e8c46(0x103)](_0x3e8c46(0x109)+_0x50dd39+'.md'),logger[_0x3e8c46(0x104)](_0x3e8c46(0x111),_0x3e8c46(0x102)+_0x50dd39,undefined,{'datasetCode':_0xbad819[_0x3e8c46(0xf9)],'datasetName':_0xbad819[_0x3e8c46(0xf8)],'filePath':_0x3cebfb,'progress':_0x280569+'/'+_0x18bff7}),_0xc9eb96[_0x3e8c46(0xfb)]({'datasetCode':_0xbad819[_0x3e8c46(0xf9)],'datasetName':_0xbad819[_0x3e8c46(0xf8)],'filePath':_0x3cebfb,'success':!![]}),_0x280569<_0x18bff7&&await delay(0x1388);}catch(_0x518f7f){const _0x55fbc7=_0x518f7f instanceof Error?_0x518f7f[_0x3e8c46(0x107)]:String(_0x518f7f);console[_0x3e8c46(0x103)](_0x3e8c46(0xfd)+_0x50dd39+_0x3e8c46(0xf7)+_0x55fbc7+'\x0a'),logger[_0x3e8c46(0x10f)](_0x3e8c46(0x111),'生成文档失败:\x20'+_0xbad819[_0x3e8c46(0xf9)],{'datasetCode':_0xbad819[_0x3e8c46(0xf9)],'datasetName':_0xbad819[_0x3e8c46(0xf8)],'error':_0x55fbc7,'progress':_0x280569+'/'+_0x18bff7}),_0xc9eb96[_0x3e8c46(0xfb)]({'datasetCode':_0xbad819['datasetCode'],'datasetName':_0xbad819['name'],'filePath':'','success':![],'error':_0x55fbc7}),_0x280569<_0x18bff7&&(console['log'](_0x3e8c46(0x10c)),await delay(0xbb8));}}return _0xc9eb96;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4dcfa7,_0x5207c2){const _0x3a7ee0=a5_0x3772,_0x1ca130=_0x4dcfa7();while(!![]){try{const _0x36690d=-parseInt(_0x3a7ee0(0x138))/0x1+-parseInt(_0x3a7ee0(0x12f))/0x2*(parseInt(_0x3a7ee0(0x121))/0x3)+-parseInt(_0x3a7ee0(0x126))/0x4+-parseInt(_0x3a7ee0(0x13a))/0x5+parseInt(_0x3a7ee0(0x150))/0x6*(parseInt(_0x3a7ee0(0x14a))/0x7)+parseInt(_0x3a7ee0(0x13d))/0x8*(-parseInt(_0x3a7ee0(0x134))/0x9)+parseInt(_0x3a7ee0(0x142))/0xa*(parseInt(_0x3a7ee0(0x13c))/0xb);if(_0x36690d===_0x5207c2)break;else _0x1ca130['push'](_0x1ca130['shift']());}catch(_0x2a2b44){_0x1ca130['push'](_0x1ca130['shift']());}}}(a5_0xb658,0x74a86));function a5_0xb658(){const _0xc07b5c=['gray','white','46773TEZiLa','\x20个模型)','red','dim','207681npmuOR','lovrabet\x20auth','834330jsviki','column','44KywfnU','776wyxZJC','.ts','使用指定的应用AppCode:\x20','拉取\x20API\x20配置失败:\x20','datasetCount','2856590fUxmJH','\x20个,过滤重复','includes','-api','\x20个数据集,生成','未提供应用AppCode,且配置中也没有默认值','yellow','replace','5618543XtVkVE','💡\x20请使用\x20','!\x20原始数据集\x20','\x20-\x20客户端实例文件','import\x20','modelCount','6UJtHWZ','√\x20成功拉取\x20','cyan','originalCount','split','length','*\x20已生成文件:','\x20重新登录后再试','72wBVuqB','endsWith','\x20个模型','string','green','1746844pGZLkc','{\x20lovrabetClient\x20}','-\x20模型配置文件\x20(','*\x20导入方式:','online','env','使用配置的应用AppCode:\x20','client','duplicateCount','12674gfWFQg','setLogPath','-client'];a5_0xb658=function(){return _0xc07b5c;};return a5_0xb658();}import{jsx as a5_0x111128,jsxs as a5_0x22f730}from'react/jsx-runtime';function a5_0x3772(_0x82f06d,_0x1e38b0){const _0xb658a5=a5_0xb658();return a5_0x3772=function(_0x3772ac,_0x4344af){_0x3772ac=_0x3772ac-0x120;let _0x1ce878=_0xb658a5[_0x3772ac];return _0x1ce878;},a5_0x3772(_0x82f06d,_0x1e38b0);}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{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x49dc2d,env:_0x5b80d7,output:_0x290bf5})=>{const _0x2021a5=a5_0x3772,{exit:_0x918485}=useApp(),[_0x592084,_0x160729]=useState(![]),[_0x286b83,_0x54b97b]=useState(![]),[_0x933755,_0x33254e]=useState(null),[_0x1b123e,_0x21903d]=useState(null),_0x2bb04d=readConfig(),_0x320997=getConfigAppCode(),_0x203a29=_0x49dc2d||_0x320997,_0x3bc4f2=typeof _0x2bb04d?.[_0x2021a5(0x12b)]===_0x2021a5(0x124)?_0x2bb04d[_0x2021a5(0x12b)]:undefined,_0x1703bb=_0x5b80d7||_0x3bc4f2||_0x2021a5(0x12a);initEnv(_0x1703bb);const _0x2ea273=_0x290bf5||'./src/api/',_0x313990=_0x49dc2d&&_0x49dc2d[_0x2021a5(0x144)]('-')?_0x49dc2d[_0x2021a5(0x154)]('-')['slice'](0x1)['join']('-'):'',_0x42ac7e=_0x49dc2d?_0x2021a5(0x13f)+_0x203a29:_0x2021a5(0x12c)+_0x203a29,_0x4768c1=_0x313990?_0x313990+_0x2021a5(0x145):'api',_0xfb3577=_0x313990?_0x313990+_0x2021a5(0x131):'client';useEffect(()=>{_0x160729(!![]),_0x2cf687();},[]),useEffect(()=>{(_0x286b83||_0x933755)&&_0x918485();},[_0x286b83,_0x933755,_0x918485]);async function _0x2cf687(){const _0x197ae2=_0x2021a5;if(!_0x203a29){_0x33254e(_0x197ae2(0x147));return;}try{logger[_0x197ae2(0x130)](process['cwd']());const {configArray:_0x3c8958}=await fetchModelList(_0x203a29),_0x154179=_0x3c8958[_0x197ae2(0x155)],_0x2ec8ad=!_0x49dc2d,_0x239501=await generateApiFile(_0x3c8958,_0x313990,_0x203a29,_0x2ec8ad,_0x1703bb,_0x2ea273),_0xed9d2=_0x2ea273[_0x197ae2(0x122)]('/')?_0x2ea273:_0x2ea273+'/';_0x21903d({'api':''+_0xed9d2+_0x4768c1+'.ts','client':''+_0xed9d2+_0xfb3577+_0x197ae2(0x13e),'modelCount':_0x239501[_0x197ae2(0x14f)],'datasetCount':_0x154179,'originalCount':_0x154179,'duplicateCount':0x0}),_0x54b97b(!![]);}catch(_0xd1cacd){const _0x50702f=_0xd1cacd instanceof Error?_0xd1cacd['message']:String(_0xd1cacd);logger['error']('api-pull',_0x197ae2(0x140)+_0x50702f,{'appCode':_0x203a29,'error':_0x50702f}),_0x33254e(_0x197ae2(0x140)+_0x50702f);}finally{_0x160729(![]);}}return a5_0x22f730(Box,{'flexDirection':_0x2021a5(0x13b),'children':[(_0x592084||_0x286b83)&&a5_0x22f730(Box,{'children':[a5_0x111128(Text,{'color':'gray','children':'*\x20'}),a5_0x111128(Text,{'color':_0x49dc2d?_0x2021a5(0x133):_0x2021a5(0x137),'children':_0x42ac7e})]}),_0x592084&&a5_0x111128(Box,{'children':a5_0x22f730(Text,{'children':['🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20',_0x1703bb,')']})}),_0x286b83&&_0x1b123e&&a5_0x22f730(Box,{'flexDirection':'column','children':[a5_0x111128(Box,{'children':a5_0x22f730(Text,{'color':_0x2021a5(0x125),'children':[_0x2021a5(0x151),_0x1b123e[_0x2021a5(0x141)],_0x2021a5(0x146),'\x20',_0x1b123e[_0x2021a5(0x14f)],_0x2021a5(0x123)]})}),_0x1b123e[_0x2021a5(0x12e)]>0x0&&a5_0x111128(Box,{'marginTop':0x1,'children':a5_0x22f730(Text,{'color':_0x2021a5(0x148),'children':[_0x2021a5(0x14c),_0x1b123e[_0x2021a5(0x153)],_0x2021a5(0x143),'\x20',_0x1b123e[_0x2021a5(0x12e)],'\x20个']})}),a5_0x111128(Box,{'marginTop':0x1,'children':a5_0x111128(Text,{'color':_0x2021a5(0x132),'children':_0x2021a5(0x156)})}),a5_0x22f730(Box,{'marginLeft':0x2,'children':[a5_0x22f730(Text,{'color':_0x2021a5(0x152),'children':['•\x20',_0x1b123e['api']]}),a5_0x22f730(Text,{'color':_0x2021a5(0x137),'children':['\x20',_0x2021a5(0x128),_0x1b123e['modelCount'],_0x2021a5(0x135)]})]}),a5_0x22f730(Box,{'marginLeft':0x2,'children':[a5_0x22f730(Text,{'color':_0x2021a5(0x152),'children':['•\x20',_0x1b123e[_0x2021a5(0x12d)]]}),a5_0x111128(Text,{'color':_0x2021a5(0x137),'children':_0x2021a5(0x14d)})]}),a5_0x111128(Box,{'marginTop':0x1,'children':a5_0x111128(Text,{'color':_0x2021a5(0x132),'children':_0x2021a5(0x129)})}),a5_0x111128(Box,{'marginLeft':0x2,'children':a5_0x22f730(Text,{'color':_0x2021a5(0x148),'children':[_0x2021a5(0x14e),_0x2021a5(0x127),'\x20from\x20\x27@/',_0x1b123e[_0x2021a5(0x12d)][_0x2021a5(0x149)](/^\.\//,'')[_0x2021a5(0x149)](_0x2021a5(0x13e),''),'\x27']})})]}),_0x933755&&a5_0x22f730(Box,{'flexDirection':_0x2021a5(0x13b),'children':[a5_0x111128(Box,{'children':a5_0x22f730(Text,{'color':_0x2021a5(0x136),'children':['❌\x20',_0x933755]})}),_0x933755['includes']('登录')&&a5_0x22f730(Box,{'marginTop':0x1,'children':[a5_0x111128(Text,{'color':_0x2021a5(0x148),'children':_0x2021a5(0x14b)}),a5_0x111128(Text,{'color':_0x2021a5(0x152),'children':_0x2021a5(0x139)}),a5_0x111128(Text,{'color':_0x2021a5(0x148),'children':_0x2021a5(0x120)})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4cef0c,_0x5b5fc9){const _0x1cf845=a6_0xe7d1,_0x5ecb59=_0x4cef0c();while(!![]){try{const _0x14807d=parseInt(_0x1cf845(0x1e9))/0x1*(parseInt(_0x1cf845(0x1e4))/0x2)+parseInt(_0x1cf845(0x1e6))/0x3*(parseInt(_0x1cf845(0x1f5))/0x4)+parseInt(_0x1cf845(0x1f6))/0x5+-parseInt(_0x1cf845(0x1f3))/0x6*(-parseInt(_0x1cf845(0x1f0))/0x7)+parseInt(_0x1cf845(0x1ea))/0x8+-parseInt(_0x1cf845(0x1f4))/0x9+-parseInt(_0x1cf845(0x1ed))/0xa;if(_0x14807d===_0x5b5fc9)break;else _0x5ecb59['push'](_0x5ecb59['shift']());}catch(_0x52ab1f){_0x5ecb59['push'](_0x5ecb59['shift']());}}}(a6_0x1ea1,0x21509));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';function a6_0x1ea1(){const _0x3c2a49=['获取数据集失败,HTTP状态码:\x20','1rqMeuo','795928huISAu','status','data','4619950wBmGZf','正在从服务器拉取模型列表...\x20(环境:\x20','json','11641JYfxOp','success','message','882ZBOuCC','860661tANrsM','7380BXOPzg','1080600ARezcG','/api/node-toolbox/dataset/model-list?appcode=','未知错误','&otype=array','90898cLRhoW','获取数据集失败:\x20','144kQfjTu','count'];a6_0x1ea1=function(){return _0x3c2a49;};return a6_0x1ea1();}function a6_0xe7d1(_0x32500e,_0x55c3d5){const _0x1ea1ad=a6_0x1ea1();return a6_0xe7d1=function(_0xe7d145,_0x1618bb){_0xe7d145=_0xe7d145-0x1e4;let _0x409dec=_0x1ea1ad[_0xe7d145];return _0x409dec;},a6_0xe7d1(_0x32500e,_0x55c3d5);}import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';export async function fetchModelList(_0x1a8bdc){const _0x50478b=a6_0xe7d1,_0x321ca4=getEnv(),_0x6b7e95=getApiDomain()+_0x50478b(0x1f7)+_0x1a8bdc+_0x50478b(0x1f9);logger['info']('fetch-model-list',_0x50478b(0x1ee)+_0x321ca4+')',{'apiUrl':_0x6b7e95});const _0x5e7119=await fetch(_0x6b7e95,{'headers':{'Cookie':getCookie()}});if(!_0x5e7119['ok']){if(_0x5e7119[_0x50478b(0x1eb)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');throw new Error(_0x50478b(0x1e8)+_0x5e7119[_0x50478b(0x1eb)]);}const _0x56e048=await _0x5e7119[_0x50478b(0x1ef)]();if(!_0x56e048[_0x50478b(0x1f1)])throw new Error(_0x50478b(0x1e5)+(_0x56e048[_0x50478b(0x1f2)]||_0x50478b(0x1f8)));return{'configArray':_0x56e048[_0x50478b(0x1ec)]['configArray'],'count':_0x56e048[_0x50478b(0x1ec)][_0x50478b(0x1e7)]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a7_0x34630e=a7_0xb681;function a7_0x2959(){const _0x379303=['API\x20文件生成成功!','online','10nlgQTC','endsWith','./src/api/','9079910NgMkcs','1612flTcLZ','../..','datasetCode','typescript','keys','-client','app','client','6Lnxmff','resolve','url','string','10678216WoFcFS','format','{\x20apiConfigName:\x20','867720gtQtiN','546792hLcDYA','forEach','533VpARPR','3449853nUviFe','name','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','CONFIG_NAMES.DEFAULT','length','17140OpDeDZ','utf8','.ts','client.ts.tpl',',\x20env:\x20\x22','api','env','-api','api.ts.tpl','4074pPewYv','key','9arKtWH','join','replaceApiContent','1908tEUaLl','\x22\x20}'];a7_0x2959=function(){return _0x379303;};return a7_0x2959();}(function(_0x51e1f9,_0x47be0f){const _0x55776a=a7_0xb681,_0x4e358d=_0x51e1f9();while(!![]){try{const _0x336663=-parseInt(_0x55776a(0x1f6))/0x1+parseInt(_0x55776a(0x208))/0x2*(-parseInt(_0x55776a(0x20d))/0x3)+parseInt(_0x55776a(0x215))/0x4*(parseInt(_0x55776a(0x1ff))/0x5)+-parseInt(_0x55776a(0x1ef))/0x6*(-parseInt(_0x55776a(0x214))/0x7)+-parseInt(_0x55776a(0x1f3))/0x8*(parseInt(_0x55776a(0x20a))/0x9)+-parseInt(_0x55776a(0x211))/0xa*(parseInt(_0x55776a(0x1fa))/0xb)+-parseInt(_0x55776a(0x1f7))/0xc*(-parseInt(_0x55776a(0x1f9))/0xd);if(_0x336663===_0x47be0f)break;else _0x4e358d['push'](_0x4e358d['shift']());}catch(_0x1694e6){_0x4e358d['push'](_0x4e358d['shift']());}}}(a7_0x2959,0xb37c0));function a7_0xb681(_0x207bf5,_0xb311d){const _0x2959cb=a7_0x2959();return a7_0xb681=function(_0xb681d3,_0x122746){_0xb681d3=_0xb681d3-0x1ee;let _0x2a6565=_0x2959cb[_0xb681d3];return _0x2a6565;},a7_0xb681(_0x207bf5,_0xb311d);}import a7_0x4e2529 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0x229a16 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0xcaf89c,_0x28b4b4='',_0xe68669,_0x3df7a7=![],_0x528e05,_0x1a2196=a7_0x34630e(0x213)){const _0x2d9c36=a7_0x34630e,_0x432dd2=readConfig(),_0x5299aa=_0xe68669||_0x432dd2?.[_0x2d9c36(0x21b)];if(typeof _0x5299aa!==_0x2d9c36(0x1f2)||!_0x5299aa)throw new Error(_0x2d9c36(0x1fc));const _0x16dae3=_0x3df7a7?_0x2d9c36(0x1fd):'\x22'+_0x5299aa+'\x22',_0x50b48b=typeof _0x432dd2[_0x2d9c36(0x205)]==='string'?_0x432dd2[_0x2d9c36(0x205)]:undefined,_0x22ce32=_0x528e05||_0x50b48b||_0x2d9c36(0x210),_0x112215=_0x22ce32!==_0x2d9c36(0x210);let _0x39b912;if(_0x3df7a7)_0x112215?_0x39b912=_0x2d9c36(0x1f5)+_0x16dae3+_0x2d9c36(0x203)+_0x22ce32+_0x2d9c36(0x20e):_0x39b912='';else{const _0x1b8b77=_0x112215?_0x2d9c36(0x203)+_0x22ce32+'\x22':'';_0x39b912='{\x20apiConfigName:\x20\x22'+_0x5299aa+'\x22'+_0x1b8b77+'\x20}';}const _0x56ab69=_0x28b4b4?_0x28b4b4+_0x2d9c36(0x206):_0x2d9c36(0x204),_0x1e5e17=_0x28b4b4?_0x28b4b4+_0x2d9c36(0x21a):_0x2d9c36(0x1ee),_0x1c3317={};_0xcaf89c[_0x2d9c36(0x1f8)](_0x2d5db7=>{const _0x4da040=_0x2d9c36;_0x1c3317[_0x2d5db7[_0x4da040(0x209)]]={'tableName':_0x2d5db7['tableName'],'datasetCode':_0x2d5db7[_0x4da040(0x217)],'name':_0x2d5db7[_0x4da040(0x1fb)]||''};});const _0x141246=fileURLToPath(import.meta[_0x2d9c36(0x1f1)]),_0x291d4a=a7_0x229a16[_0x2d9c36(0x1f0)](a7_0x229a16['dirname'](_0x141246),_0x2d9c36(0x216)),_0x134eb7=a7_0x229a16['join'](_0x291d4a,'templates/generate-api'),_0x5c1d2a=a7_0x229a16[_0x2d9c36(0x20b)](_0x134eb7,_0x2d9c36(0x207)),_0xc3ddc=a7_0x229a16[_0x2d9c36(0x20b)](_0x134eb7,_0x2d9c36(0x202)),_0x56b1d4=_0x1a2196[_0x2d9c36(0x212)]('/')?_0x1a2196['slice'](0x0,-0x1):_0x1a2196;mkdirSync(_0x56b1d4,{'recursive':!![]});const _0x50cccc=readFileSync(_0x5c1d2a,_0x2d9c36(0x200)),_0x57b9e2=TemplateReplacer[_0x2d9c36(0x20c)](_0x50cccc,_0x5299aa,_0x1c3317,Object[_0x2d9c36(0x219)](_0x1c3317)[0x0],_0x56ab69,_0x16dae3),_0x96928f=await a7_0x4e2529[_0x2d9c36(0x1f4)](_0x57b9e2,{'parser':_0x2d9c36(0x218)}),_0x12367c=_0x56b1d4+'/'+_0x56ab69+_0x2d9c36(0x201);writeFileSync(_0x12367c,_0x96928f,{'encoding':_0x2d9c36(0x200)});const _0x1fcd95=readFileSync(_0xc3ddc,'utf8'),_0x47a821=TemplateReplacer[_0x2d9c36(0x20c)](_0x1fcd95,_0x5299aa,_0x1c3317,Object[_0x2d9c36(0x219)](_0x1c3317)[0x0],_0x56ab69,_0x16dae3,_0x39b912),_0x24dee4=await a7_0x4e2529[_0x2d9c36(0x1f4)](_0x47a821,{'parser':_0x2d9c36(0x218)}),_0x1f484d=_0x56b1d4+'/'+_0x1e5e17+_0x2d9c36(0x201);writeFileSync(_0x1f484d,_0x24dee4,{'encoding':_0x2d9c36(0x200)});const _0x901060=Object[_0x2d9c36(0x219)](_0x1c3317)[_0x2d9c36(0x1fe)];return logger['success']('init-api',_0x2d9c36(0x20f),undefined,{'apiFile':_0x12367c,'clientFile':_0x1f484d,'modelCount':_0x901060,'configName':_0x16dae3}),{'modelCount':_0x901060,'apiFilePath':_0x12367c,'clientFilePath':_0x1f484d,'configName':_0x16dae3};}
|
package/lib/api/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x34bf99,_0x22c2a0){const _0x3a3a42=a8_0x3001,_0x50dba8=_0x34bf99();while(!![]){try{const _0x1486ca=parseInt(_0x3a3a42(0x107))/0x1*(parseInt(_0x3a3a42(0xe5))/0x2)+parseInt(_0x3a3a42(0xf1))/0x3+-parseInt(_0x3a3a42(0xf5))/0x4*(-parseInt(_0x3a3a42(0xef))/0x5)+parseInt(_0x3a3a42(0x109))/0x6+parseInt(_0x3a3a42(0x101))/0x7*(parseInt(_0x3a3a42(0xf0))/0x8)+-parseInt(_0x3a3a42(0xe0))/0x9*(parseInt(_0x3a3a42(0xff))/0xa)+-parseInt(_0x3a3a42(0xe1))/0xb;if(_0x1486ca===_0x22c2a0)break;else _0x50dba8['push'](_0x50dba8['shift']());}catch(_0x1c9b96){_0x50dba8['push'](_0x50dba8['shift']());}}}(a8_0x34db,0x4c78e));function a8_0x3001(_0x184ec5,_0x1e9636){const _0x34db7a=a8_0x34db();return a8_0x3001=function(_0x3001c0,_0x2093ca){_0x3001c0=_0x3001c0-0xd4;let _0x26e6cb=_0x34db7a[_0x3001c0];return _0x26e6cb;},a8_0x3001(_0x184ec5,_0x1e9636);}import{jsx as a8_0x2ed1fd}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';function a8_0x34db(){const _0x498bf6=['Available\x20commands:','length','578781gxBbQf','7212920zCCuEE','\x20\x20错误:\x20','split','object','712864LnoUNk','请使用\x20--appcode\x20参数,例如:','output','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','error','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','pull','❌\x20错误:不再支持位置参数方式','filter','90sWAfJN','248HeNYSG','867246QrLkYI','env','×\x20未配置\x20AppCode','input','41572CXvcya','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','!\x20请使用以下方式之一:','\x1b[90m*\x20使用配置的应用AppCode:\x20','help','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','flags','Unknown\x20api\x20command:\x20','×\x20--params\x20参数不是有效的\x20JSON\x20格式','30vtdSwu','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','64407CkFmNi','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','exit','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象','\x1b[0m','1cgEZCp','\x1b[90m*\x20仅生成指定数据集的文档:\x20','264348jJHDwY','string','×\x20--datasetcode\x20参数不能为空','isArray','params','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','map','datasetcode','\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配置文件','\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\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','doc','log','parse','join'];a8_0x34db=function(){return _0x498bf6;};return a8_0x34db();}export async function apiCli(_0x13d4fc){const _0x552e04=a8_0x3001,_0x2c1a57=_0x13d4fc['input'][0x1];if(_0x13d4fc[_0x552e04(0xfc)][_0x552e04(0xf9)]){console[_0x552e04(0xdb)](_0x552e04(0xd8));return;}if(_0x2c1a57===_0x552e04(0xec)){_0x13d4fc[_0x552e04(0xf4)][0x2]&&(console['error']('❌\x20错误:不再支持位置参数方式'),console[_0x552e04(0xdb)]('请使用\x20--appcode\x20参数,例如:'),console[_0x552e04(0xdb)](_0x552e04(0xf6)+_0x13d4fc[_0x552e04(0xf4)][0x2]),process[_0x552e04(0x103)](0x1));const _0x3cd970=getConfigAppCode();let _0x4f8897=_0x13d4fc['flags']['appcode'];const _0x163643=typeof _0x13d4fc['flags'][_0x552e04(0xf2)]===_0x552e04(0x10a)?_0x13d4fc[_0x552e04(0xfc)][_0x552e04(0xf2)]:undefined,_0x16ed98=_0x13d4fc[_0x552e04(0xfc)][_0x552e04(0xe7)];!_0x4f8897&&!_0x3cd970&&(console[_0x552e04(0xe9)](_0x552e04(0xf3)),console[_0x552e04(0xdb)](_0x552e04(0xf7)),console[_0x552e04(0xdb)]('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console[_0x552e04(0xdb)](_0x552e04(0xd9)),process[_0x552e04(0x103)](0x1)),_0x4f8897&&_0x3cd970&&_0x4f8897===_0x3cd970&&(console[_0x552e04(0xdb)]('\x1b[90m*\x20使用配置的应用AppCode:\x20'+_0x4f8897+'\x1b[0m'),console['log'](_0x552e04(0xfa)),_0x4f8897=undefined),render(a8_0x2ed1fd(ApiPullUI,{'appCode':_0x4f8897,'env':_0x163643,'output':_0x16ed98}));}else{if(_0x2c1a57===_0x552e04(0xda)){_0x13d4fc[_0x552e04(0xf4)][0x2]&&(console[_0x552e04(0xe9)](_0x552e04(0xed)),console['log'](_0x552e04(0xe6)),console[_0x552e04(0xdb)](_0x552e04(0xd4)+_0x13d4fc[_0x552e04(0xf4)][0x2]),process[_0x552e04(0x103)](0x1));const _0x5a2d9e=getConfigAppCode();let _0x352242=_0x13d4fc[_0x552e04(0xfc)]['appcode'];const _0x308149=typeof _0x13d4fc['flags']['env']===_0x552e04(0x10a)?_0x13d4fc[_0x552e04(0xfc)]['env']:undefined,_0x1225d7=_0x13d4fc[_0x552e04(0xfc)]['output'],_0x23452e=_0x13d4fc[_0x552e04(0xfc)][_0x552e04(0x10d)],_0x5ce7be=_0x13d4fc[_0x552e04(0xfc)][_0x552e04(0xd6)];!_0x352242&&!_0x5a2d9e&&(console[_0x552e04(0xe9)]('×\x20未配置\x20AppCode'),console[_0x552e04(0xdb)](_0x552e04(0xf7)),console['log'](_0x552e04(0x100)),console[_0x552e04(0xdb)](_0x552e04(0x104)),process[_0x552e04(0x103)](0x1));_0x352242&&_0x5a2d9e&&_0x352242===_0x5a2d9e&&(console[_0x552e04(0xdb)](_0x552e04(0xf8)+_0x352242+_0x552e04(0x106)),_0x352242=undefined);let _0x357da1;if(_0x23452e)try{_0x357da1=JSON[_0x552e04(0xdc)](_0x23452e),(typeof _0x357da1!==_0x552e04(0xe4)||_0x357da1===null||Array[_0x552e04(0x10c)](_0x357da1))&&(console[_0x552e04(0xe9)](_0x552e04(0x105)),process[_0x552e04(0x103)](0x1));}catch(_0x1f9ab6){console[_0x552e04(0xe9)](_0x552e04(0xfe)),console[_0x552e04(0xe9)](_0x552e04(0xe2)+(_0x1f9ab6 instanceof Error?_0x1f9ab6['message']:String(_0x1f9ab6))),process[_0x552e04(0x103)](0x1);}let _0x3df68e;_0x5ce7be&&(_0x3df68e=_0x5ce7be[_0x552e04(0xe3)](',')[_0x552e04(0xd5)](_0x944dd=>_0x944dd['trim']())[_0x552e04(0xee)](_0x451bcd=>_0x451bcd[_0x552e04(0xdf)]>0x0),_0x3df68e['length']===0x0&&(console[_0x552e04(0xe9)](_0x552e04(0x10b)),process[_0x552e04(0x103)](0x1)),console['log'](_0x552e04(0x108)+_0x3df68e[_0x552e04(0xdd)](',\x20')+_0x552e04(0x106))),render(a8_0x2ed1fd(ApiDocUI,{'appCode':_0x352242,'env':_0x308149,'output':_0x1225d7,'extraParams':_0x357da1,'datasetCodes':_0x3df68e}));}else console[_0x552e04(0xe9)](_0x552e04(0xfd)+_0x2c1a57),console[_0x552e04(0xdb)](_0x552e04(0xde)),console[_0x552e04(0xdb)](_0x552e04(0xd7)),console['log']('\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode'),console[_0x552e04(0xdb)](_0x552e04(0x102)),console[_0x552e04(0xdb)](_0x552e04(0xfb)),console[_0x552e04(0xdb)](''),console[_0x552e04(0xdb)]('\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文档'),console['log'](_0x552e04(0xeb)),console[_0x552e04(0xdb)](_0x552e04(0xe8)),console['log'](_0x552e04(0xea)),process[_0x552e04(0x103)](0x1);}}
|
package/lib/api/pull-silent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3ed954,_0x16a515){const _0x428c75=a9_0x2610,_0x4fe25e=_0x3ed954();while(!![]){try{const _0x1517c9=-parseInt(_0x428c75(0x205))/0x1*(-parseInt(_0x428c75(0x1fc))/0x2)+-parseInt(_0x428c75(0x201))/0x3+-parseInt(_0x428c75(0x1f0))/0x4+parseInt(_0x428c75(0x1f1))/0x5+-parseInt(_0x428c75(0x20a))/0x6*(-parseInt(_0x428c75(0x203))/0x7)+-parseInt(_0x428c75(0x1f5))/0x8+parseInt(_0x428c75(0x1ec))/0x9;if(_0x1517c9===_0x16a515)break;else _0x4fe25e['push'](_0x4fe25e['shift']());}catch(_0xb2252b){_0x4fe25e['push'](_0x4fe25e['shift']());}}}(a9_0x4bbb,0xb2441));function a9_0x4bbb(){const _0xe1c0a6=['env','modelCount','×\x20API\x20配置拉取异常:','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','2540748sRMfAW','\x20个数据集...','19481ztrVSQ','*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','1xVNFEO','trim','chdir','log','.ts\x20-\x20模型配置文件','42yLsdaw','-api','API\x20配置拉取异常:\x20','\x20\x20\x20•\x20','17610435nGZRaV','api','info','test','5781364cBjfbW','1051670kBXRaC','string','\x20个数据集,生成\x20','cwd','2539848JjjFXk','error','online','create-api-pull','*\x20正在处理\x20','length','API\x20配置拉取成功:\x20','2306770ECftmy'];a9_0x4bbb=function(){return _0xe1c0a6;};return a9_0x4bbb();}function a9_0x2610(_0x55cfb2,_0x34b83e){const _0x4bbbbb=a9_0x4bbb();return a9_0x2610=function(_0x2610ed,_0x21a233){_0x2610ed=_0x2610ed-0x1eb;let _0x25187a=_0x4bbbbb[_0x2610ed];return _0x25187a;},a9_0x2610(_0x55cfb2,_0x34b83e);}import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x27f6f6,_0x141992,_0xb5773f,_0x2d5b6e){const _0x3d74af=a9_0x2610;let _0x47a951;try{const _0x5a4d26=_0x141992?.[_0x3d74af(0x206)]()||'';if(_0x5a4d26){const _0x3db6bf=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x3db6bf[_0x3d74af(0x1ef)](_0x5a4d26))return console[_0x3d74af(0x1f6)](_0x3d74af(0x200)),![];}_0xb5773f&&(_0x47a951=process[_0x3d74af(0x1f4)](),process['chdir'](_0xb5773f));const _0xcce89e=readConfig(),_0x241455=typeof _0xcce89e[_0x3d74af(0x1fd)]===_0x3d74af(0x1f2)?_0xcce89e[_0x3d74af(0x1fd)]:undefined,_0x12393c=_0x2d5b6e||_0x241455||_0x3d74af(0x1f7);initEnv(_0x12393c),console['log'](_0x3d74af(0x204)+_0x12393c+')');const {configArray:_0x415c72}=await fetchModelList(_0x27f6f6),_0x215b27=_0x5a4d26?_0x5a4d26+_0x3d74af(0x20b):_0x3d74af(0x1ed),_0x3bb077=_0x5a4d26?_0x5a4d26+'-client':'client';console['log']('*\x20开始生成\x20API\x20配置文件:'),console[_0x3d74af(0x208)]('\x20\x20\x20•\x20'+_0x215b27+_0x3d74af(0x209)),console[_0x3d74af(0x208)](_0x3d74af(0x1eb)+_0x3bb077+'.ts\x20-\x20客户端实例文件'),console[_0x3d74af(0x208)](_0x3d74af(0x1f9)+_0x415c72[_0x3d74af(0x1fa)]+_0x3d74af(0x202));const _0xe17cb1=await generateApiFile(_0x415c72,_0x5a4d26,_0x27f6f6,!![],_0x12393c);return console[_0x3d74af(0x208)]('√\x20成功拉取\x20'+_0x415c72[_0x3d74af(0x1fa)]+_0x3d74af(0x1f3)+_0xe17cb1[_0x3d74af(0x1fe)]+'\x20个模型'),_0xb5773f&&logger[_0x3d74af(0x1ee)](_0x3d74af(0x1f8),_0x3d74af(0x1fb)+_0x27f6f6,{'projectPath':_0xb5773f,'appCode':_0x27f6f6,'datasetCount':_0x415c72['length'],'filePrefix':_0x5a4d26}),!![];}catch(_0x2cfc6b){const _0x2e00f3=_0x2cfc6b instanceof Error?_0x2cfc6b['message']:String(_0x2cfc6b);return console['error'](_0x3d74af(0x1ff),_0x2e00f3),_0xb5773f&&logger[_0x3d74af(0x1f6)]('create-api-pull',_0x3d74af(0x20c)+_0x2e00f3,{'appCode':_0x27f6f6,'projectPath':_0xb5773f}),![];}finally{_0x47a951&&process[_0x3d74af(0x207)](_0x47a951);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a10_0x1c3d(){const _0x386cd2=['slice','delete','length','fill','6221952NTiGst','!\x20未找到本地页面,请先创建页面','CSS\x20链接无法访问','[✓]','gray','message','downArrow','提示:使用\x20','5EAoqHh','input-js','green','selecting','filter','label','red','5805068jkBYuV','JS\x20链接无法访问','online','max','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认','302772juajNp','catch','has','blue','请输入有效的\x20JS\x20https\x20链接','size','path','3970vZdWNK','\x20输入项目的\x20JS\x20资源链接(https://...)','value','white','cyan','*\x20CSS\x20链接:\x20','\x20←\x20','input-css','创建菜单失败','17858082fBjDGF','*\x20请选择要同步的菜单:','map','return','*\x20正在创建菜单...','[\x20]','菜单名称','join','local','then','21177kuxrpy','includes','upArrow','lovrabet\x20auth','dots','请输入有效的\x20CSS\x20https\x20链接','2309223PVzHQp','add','*\x20JS\x20链接:\x20','\x20命令重新登录','\x20输入项目的\x20CSS\x20资源链接(https://...)','*\x20同步菜单到\x20Lovrabet\x20平台','creating','column','1BHujXf','2809912kXzaqd','yellow','14BunPsV'];a10_0x1c3d=function(){return _0x386cd2;};return a10_0x1c3d();}(function(_0x3574a0,_0x47a5fa){const _0x1371b1=a10_0x11d3,_0x4918f2=_0x3574a0();while(!![]){try{const _0x374658=-parseInt(_0x1371b1(0x119))/0x1*(parseInt(_0x1371b1(0x11a))/0x2)+parseInt(_0x1371b1(0x111))/0x3+parseInt(_0x1371b1(0xec))/0x4*(parseInt(_0x1371b1(0xe5))/0x5)+-parseInt(_0x1371b1(0xf1))/0x6*(-parseInt(_0x1371b1(0x11c))/0x7)+-parseInt(_0x1371b1(0x121))/0x8+parseInt(_0x1371b1(0x10b))/0x9*(-parseInt(_0x1371b1(0xf8))/0xa)+parseInt(_0x1371b1(0x101))/0xb;if(_0x374658===_0x47a5fa)break;else _0x4918f2['push'](_0x4918f2['shift']());}catch(_0x1351de){_0x4918f2['push'](_0x4918f2['shift']());}}}(a10_0x1c3d,0xca489));import{jsx as a10_0x5c19b9,jsxs as a10_0x7bffe6,Fragment as a10_0x2823bc}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a10_0x12a9c9 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_0x5c19b9(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x2598d9=a10_0x11d3,{exit:_0x1085d7}=useApp(),{loading:_0x44c94b,menuList:_0x5d6d9e,error:_0x381e4f}=useGetOnlineMenuList(),_0x39c73c=getLocalPages(),_0x51263b=_0x5d6d9e[_0x2598d9(0x103)](_0x18f074=>_0x18f074[_0x2598d9(0xf7)]),_0x3a4471=[_0x2598d9(0x107),..._0x39c73c[_0x2598d9(0x103)](_0x277772=>_0x277772[_0x2598d9(0xea)])],_0x1167de=getStringWidth(getMaxWidth(_0x3a4471,0x4)),_0x29e8ad=getStringWidth(getMaxWidth(['菜单名称'])),[_0x67d263,_0x909b53]=useState(_0x2598d9(0xe8)),[_0x42f884,_0x22c2f7]=useState(new Set()),[_0x56becb,_0x436523]=useState(0x0),[_0x514f15,_0x1ab9d4]=useState(''),[_0x3be1c8,_0x3eff15]=useState(''),[_0x4dec9a,_0x1d68ed]=useState(''),[_0x22599e,_0xf6ae72]=useState(''),[_0x1f5893,_0x2cfa6b]=useState([]),_0x5ee784=_0x39c73c['map'](_0xf8db52=>({'label':_0xf8db52[_0x2598d9(0xea)],'path':_0xf8db52[_0x2598d9(0xf7)],'local':!![],'online':_0x51263b[_0x2598d9(0x10c)](_0xf8db52[_0x2598d9(0xf7)])})),_0x3e3042=_0x39c73c['filter'](_0x1387d3=>{const _0x5c4630=_0x2598d9;return!_0x51263b['includes'](_0x1387d3[_0x5c4630(0xf7)]);});useEffect(()=>{const _0x4cd346=_0x2598d9;if(!_0x44c94b&&_0x39c73c[_0x4cd346(0x11f)]>0x0&&_0x42f884[_0x4cd346(0xf6)]===0x0){const _0xa978c4=new Set(_0x39c73c[_0x4cd346(0x103)]((_0x407cf8,_0x4a074b)=>({'page':_0x407cf8,'index':_0x4a074b}))[_0x4cd346(0xe9)](({page:_0x5ddf4e})=>!_0x51263b['includes'](_0x5ddf4e[_0x4cd346(0xf7)]))[_0x4cd346(0x103)](({index:_0x3f312e})=>_0x3f312e));_0x22c2f7(_0xa978c4);}},[_0x44c94b,_0x39c73c['length'],_0x51263b[_0x2598d9(0x11f)]]),useInput(async(_0x1508ee,_0x1b05c4)=>{const _0x5f1d98=_0x2598d9;if(_0x67d263===_0x5f1d98(0xe8)){if(_0x1b05c4[_0x5f1d98(0x10d)]){_0x436523(_0x42b890=>_0x42b890>0x0?_0x42b890-0x1:_0x39c73c['length']-0x1);return;}if(_0x1b05c4[_0x5f1d98(0x127)]){_0x436523(_0x4d751a=>_0x4d751a<_0x39c73c['length']-0x1?_0x4d751a+0x1:0x0);return;}if(_0x1508ee==='\x20'){_0x22c2f7(_0x11a210=>{const _0x4b1f51=_0x5f1d98,_0x40cb09=new Set(_0x11a210);return _0x40cb09[_0x4b1f51(0xf3)](_0x56becb)?_0x40cb09['delete'](_0x56becb):_0x40cb09['add'](_0x56becb),_0x40cb09;});return;}if(_0x1508ee==='a'||_0x1508ee==='A'){const _0x23e9a0=new Set(_0x39c73c[_0x5f1d98(0x103)]((_0x14fc5e,_0x170656)=>_0x170656));_0x22c2f7(_0x23e9a0);return;}if(_0x1508ee==='i'||_0x1508ee==='I'||_0x1508ee==='r'||_0x1508ee==='R'){_0x22c2f7(_0xb9a149=>{const _0x239391=_0x5f1d98,_0x52bd16=new Set();for(let _0x3d4731=0x0;_0x3d4731<_0x39c73c['length'];_0x3d4731++){!_0xb9a149[_0x239391(0xf3)](_0x3d4731)&&_0x52bd16[_0x239391(0x112)](_0x3d4731);}return _0x52bd16;});return;}if(_0x1508ee==='q'||_0x1508ee==='Q'){_0x1085d7();return;}if(_0x1b05c4[_0x5f1d98(0x104)]){if(_0x42f884[_0x5f1d98(0xf6)]===0x0){_0xf6ae72('请至少选择一个菜单');return;}const _0x40a63f=_0x39c73c[_0x5f1d98(0xe9)]((_0x43cf26,_0x15741e)=>_0x42f884[_0x5f1d98(0xf3)](_0x15741e)),_0x3d467c=_0x40a63f[_0x5f1d98(0x103)](_0x4f9879=>_0x4f9879[_0x5f1d98(0xea)])[_0x5f1d98(0x108)](',\x20');_0x2cfa6b([{'label':'已选择菜单','value':_0x42f884['size']+'\x20个'}]),_0xf6ae72(''),_0x909b53('input-js');return;}return;}if(_0x67d263===_0x5f1d98(0xe6)){if(_0x1b05c4[_0x5f1d98(0x104)]){const _0x395243=_0x4dec9a['trim']();if(_0x395243==='')return;if(!isValidJsHttpsUrl(_0x395243)){_0xf6ae72(_0x5f1d98(0xf5));return;}if(!await isUrlReachable(_0x395243)){_0xf6ae72(_0x5f1d98(0xed));return;}_0x1ab9d4(_0x395243),_0x2cfa6b(_0x24d430=>[..._0x24d430,{'label':'JS\x20链接','value':_0x395243}]),_0x1d68ed(''),_0xf6ae72(''),_0x909b53(_0x5f1d98(0xff));return;}if(_0x1b05c4['backspace']||_0x1b05c4[_0x5f1d98(0x11e)]){_0x1d68ed(_0x36a666=>_0x36a666[_0x5f1d98(0x11d)](0x0,-0x1)),_0xf6ae72('');return;}_0x1d68ed(_0x1dfe71=>_0x1dfe71+_0x1508ee);return;}if(_0x67d263===_0x5f1d98(0xff)){if(_0x1b05c4['return']){const _0x3aa1cf=_0x4dec9a['trim']();if(_0x3aa1cf==='')return;if(!isValidCssHttpsUrl(_0x3aa1cf)){_0xf6ae72(_0x5f1d98(0x110));return;}if(!await isUrlReachable(_0x3aa1cf)){_0xf6ae72(_0x5f1d98(0x123));return;}_0x3eff15(_0x3aa1cf),_0x2cfa6b(_0x2d85ae=>[..._0x2d85ae,{'label':'CSS\x20链接','value':_0x3aa1cf}]),_0x1d68ed(''),_0xf6ae72(''),_0x909b53(_0x5f1d98(0x117));const _0x1b0ad3=_0x39c73c[_0x5f1d98(0xe9)]((_0xf9344a,_0x35140f)=>_0x42f884[_0x5f1d98(0xf3)](_0x35140f));createMenus(_0x1b0ad3,[_0x514f15,_0x3aa1cf])[_0x5f1d98(0x10a)](()=>{_0x909b53('done'),setTimeout(()=>{_0x1085d7();},0x3e8);})[_0x5f1d98(0xf2)](_0x4cc83f=>{const _0x3a8c91=_0x5f1d98;_0xf6ae72(_0x4cc83f[_0x3a8c91(0x126)]||_0x3a8c91(0x100)),_0x909b53('selecting');});return;}if(_0x1b05c4['backspace']||_0x1b05c4['delete']){_0x1d68ed(_0x12d810=>_0x12d810[_0x5f1d98(0x11d)](0x0,-0x1)),_0xf6ae72('');return;}_0x1d68ed(_0x42a618=>_0x42a618+_0x1508ee);return;}});if(_0x44c94b)return a10_0x7bffe6(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x5c19b9(Text,{'children':'\x20\x20'}),a10_0x5c19b9(a10_0x12a9c9,{'type':_0x2598d9(0x10f)}),a10_0x5c19b9(Text,{'children':'\x20正在获取线上菜单列表...'})]});if(_0x381e4f)return a10_0x7bffe6(Box,{'flexDirection':_0x2598d9(0x118),'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x7bffe6(Text,{'color':_0x2598d9(0xeb),'children':['✗\x20',_0x381e4f]}),a10_0x7bffe6(Box,{'marginTop':0x1,'children':[a10_0x5c19b9(Text,{'color':_0x2598d9(0x125),'children':_0x2598d9(0xe4)}),a10_0x5c19b9(Text,{'color':'cyan','children':_0x2598d9(0x10e)}),a10_0x5c19b9(Text,{'color':'gray','children':_0x2598d9(0x114)})]})]});if(_0x39c73c[_0x2598d9(0x11f)]===0x0)return a10_0x5c19b9(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x5c19b9(Text,{'color':_0x2598d9(0x11b),'children':_0x2598d9(0x122)})});return a10_0x7bffe6(Box,{'flexDirection':_0x2598d9(0x118),'marginTop':0x1,'marginBottom':0x1,'children':[_0x67d263===_0x2598d9(0xe8)&&a10_0x7bffe6(a10_0x2823bc,{'children':[a10_0x7bffe6(Box,{'children':[a10_0x7bffe6(Text,{'bold':!![],'children':['\x20\x20',_0x2598d9(0x107),getRemainingSpaces(_0x1167de,_0x2598d9(0x107))]}),a10_0x7bffe6(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x29e8ad,_0x2598d9(0x107))]}),a10_0x7bffe6(Text,{'bold':!![],'children':['Lovrabet平台',getRemainingSpaces(_0x29e8ad,'菜单名称')]})]}),_0x5ee784[_0x2598d9(0x103)](_0x22f866=>a10_0x7bffe6(Box,{'children':[a10_0x7bffe6(Text,{'children':['\x20\x20',_0x22f866[_0x2598d9(0xea)],getRemainingSpaces(_0x1167de,_0x22f866['label'])]}),a10_0x7bffe6(Text,{'color':_0x2598d9(0xe7),'children':[_0x22f866[_0x2598d9(0x109)]?'✓':'✗',getRemainingSpaces(_0x29e8ad,'✓')]}),a10_0x7bffe6(Text,{'color':_0x22f866['online']?_0x2598d9(0xe7):_0x2598d9(0xeb),'children':[_0x22f866[_0x2598d9(0xee)]?'✓':'✗',getRemainingSpaces(_0x29e8ad,'✓')]})]},_0x22f866[_0x2598d9(0xf7)]))]}),_0x67d263===_0x2598d9(0xe8)&&_0x1f5893['length']===0x0&&a10_0x5c19b9(Box,{'marginTop':0x1,'children':a10_0x5c19b9(Text,{'color':_0x2598d9(0xfc),'children':_0x2598d9(0x116)})}),_0x1f5893[_0x2598d9(0x103)]((_0x4a3f17,_0x51d6e4)=>a10_0x7bffe6(Box,{'children':[a10_0x7bffe6(Text,{'color':_0x2598d9(0xe7),'children':['√\x20',_0x4a3f17[_0x2598d9(0xea)],':\x20']}),a10_0x5c19b9(Text,{'color':_0x2598d9(0xfc),'children':_0x4a3f17[_0x2598d9(0xfa)]})]},_0x51d6e4)),_0x22599e&&_0x67d263==='selecting'&&a10_0x5c19b9(Box,{'marginTop':0x1,'children':a10_0x7bffe6(Text,{'color':_0x2598d9(0xeb),'children':['✗\x20',_0x22599e]})}),_0x67d263===_0x2598d9(0xe8)&&a10_0x5c19b9(a10_0x2823bc,{'children':a10_0x7bffe6(Box,{'marginTop':_0x1f5893[_0x2598d9(0x11f)]>0x0||_0x22599e?0x1:0x0,'flexDirection':_0x2598d9(0x118),'children':[a10_0x5c19b9(Text,{'bold':!![],'children':_0x2598d9(0x102)}),_0x39c73c[_0x2598d9(0x103)]((_0x45249a,_0x11b903)=>{const _0x347e57=_0x2598d9,_0x2d22c9=_0x56becb===_0x11b903,_0x1544fc=_0x42f884[_0x347e57(0xf3)](_0x11b903),_0x5ddf12=_0x51263b[_0x347e57(0x10c)](_0x45249a[_0x347e57(0xf7)]),_0x41c699=_0x5ddf12?'更新':'新建';return a10_0x5c19b9(Box,{'children':a10_0x7bffe6(Text,{'backgroundColor':_0x2d22c9?_0x347e57(0xf4):undefined,'color':_0x2d22c9?_0x347e57(0xfb):undefined,'children':['\x20\x20',_0x1544fc?_0x347e57(0x124):_0x347e57(0x106),'\x20',_0x45249a[_0x347e57(0xea)]]})},_0x45249a[_0x347e57(0xf7)]);}),a10_0x5c19b9(Box,{'marginTop':0x1,'children':a10_0x7bffe6(Text,{'color':_0x2598d9(0x125),'children':['\x20',_0x2598d9(0xf0)]})})]})}),_0x67d263===_0x2598d9(0xe6)&&a10_0x7bffe6(a10_0x2823bc,{'children':[a10_0x7bffe6(Box,{'children':[a10_0x5c19b9(Text,{'children':_0x2598d9(0x113)}),a10_0x5c19b9(Text,{'color':'green','children':_0x4dec9a}),_0x22599e&&a10_0x7bffe6(Text,{'color':'red','children':[_0x2598d9(0xfe),_0x22599e]})]}),!_0x22599e&&a10_0x5c19b9(Box,{'children':a10_0x5c19b9(Text,{'color':'gray','children':_0x2598d9(0xf9)})})]}),_0x67d263===_0x2598d9(0xff)&&a10_0x7bffe6(a10_0x2823bc,{'children':[a10_0x7bffe6(Box,{'children':[a10_0x5c19b9(Text,{'children':_0x2598d9(0xfd)}),a10_0x5c19b9(Text,{'color':_0x2598d9(0xe7),'children':_0x4dec9a}),_0x22599e&&a10_0x7bffe6(Text,{'color':_0x2598d9(0xeb),'children':['\x20←\x20',_0x22599e]})]}),!_0x22599e&&a10_0x5c19b9(Box,{'children':a10_0x5c19b9(Text,{'color':_0x2598d9(0x125),'children':_0x2598d9(0x115)})})]}),_0x67d263===_0x2598d9(0x117)&&a10_0x5c19b9(Box,{'children':a10_0x5c19b9(Text,{'children':_0x2598d9(0x105)})}),_0x67d263==='done'&&a10_0x5c19b9(Box,{'children':a10_0x5c19b9(Text,{'color':_0x2598d9(0xe7),'children':'√\x20菜单创建完成'})})]});}function getStringWidth(_0x42a163){let _0x4dd365=0x0;for(const _0x498b63 of _0x42a163){/[\u4e00-\u9fa5]/['test'](_0x498b63)?_0x4dd365+=0x2:_0x4dd365+=0x1;}return _0x4dd365;}function getRemainingSpaces(_0x25e948,_0x211c0d){const _0x384665=a10_0x11d3,_0x35be0a=getStringWidth(_0x211c0d);return Array(Math[_0x384665(0xef)](0x0,_0x25e948-_0x35be0a))[_0x384665(0x120)]('\x20')[_0x384665(0x108)]('');}function a10_0x11d3(_0x1e8673,_0x1326cf){const _0x1c3db0=a10_0x1c3d();return a10_0x11d3=function(_0x11d319,_0x9bdd85){_0x11d319=_0x11d319-0xe4;let _0x417b3d=_0x1c3db0[_0x11d319];return _0x417b3d;},a10_0x11d3(_0x1e8673,_0x1326cf);}function getMaxWidth(_0x5d4083,_0x47ff50=0x2){let _0x5419fc='',_0x26c26d=0x0;for(const _0x374e57 of _0x5d4083){const _0x3407fa=getStringWidth(_0x374e57);_0x3407fa>_0x26c26d&&(_0x26c26d=_0x3407fa,_0x5419fc=_0x374e57);}return _0x5419fc+'\x20'['repeat'](_0x47ff50);}
|
|
1
|
+
const a10_0x3f9db8=a10_0x2863;function a10_0x1313(){const _0x15c86b=['label','join','local','selecting','\x20正在获取线上菜单列表...','repeat','path','Lovrabet平台','red','test','length','JS\x20链接','catch','4926485XWvTeb','message','value','310173rHYbWm','JS\x20链接无法访问','map','size','*\x20正在创建菜单...','max','lovrabet\x20auth','blue','请输入有效的\x20CSS\x20https\x20链接','fill','then','slice','yellow','white','232246LbqZFS','online','trim','\x20输入项目的\x20CSS\x20资源链接(https://...)','请至少选择一个菜单','\x20输入项目的\x20JS\x20资源链接(https://...)','column','*\x20请选择要同步的菜单:','[\x20]','has','创建菜单失败','32IQNSMf','main','10DJzwLO','dots','菜单名称','return','1378056yKIdJG','[✓]','includes','\x20←\x20','3519198fwfXnP','gray','*\x20CSS\x20链接:\x20','*\x20同步菜单到\x20Lovrabet\x20平台','done','cyan','input-css','CSS\x20链接无法访问','219291aQmWnx','backspace','green','add','4663848mZwjln','creating','30KKCxlp','delete','filter','upArrow','input-js'];a10_0x1313=function(){return _0x15c86b;};return a10_0x1313();}(function(_0x1224e7,_0xffaab3){const _0x3af5da=a10_0x2863,_0xcf0a2e=_0x1224e7();while(!![]){try{const _0x2d3b61=parseInt(_0x3af5da(0x178))/0x1+-parseInt(_0x3af5da(0x16c))/0x2+parseInt(_0x3af5da(0x193))/0x3*(-parseInt(_0x3af5da(0x166))/0x4)+parseInt(_0x3af5da(0x190))/0x5+parseInt(_0x3af5da(0x17e))/0x6*(-parseInt(_0x3af5da(0x1a1))/0x7)+parseInt(_0x3af5da(0x17c))/0x8+parseInt(_0x3af5da(0x170))/0x9*(parseInt(_0x3af5da(0x168))/0xa);if(_0x2d3b61===_0xffaab3)break;else _0xcf0a2e['push'](_0xcf0a2e['shift']());}catch(_0x486d70){_0xcf0a2e['push'](_0xcf0a2e['shift']());}}}(a10_0x1313,0x793a1));import{jsx as a10_0x249ef8,jsxs as a10_0x3297a3,Fragment as a10_0x32c546}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a10_0x4ecc62 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[a10_0x3f9db8(0x167)]&&render(a10_0x249ef8(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x1b7521=a10_0x3f9db8,{exit:_0x207903}=useApp(),{loading:_0x86243f,menuList:_0x457861,error:_0x9e4c5}=useGetOnlineMenuList(),_0x48ebc8=getLocalPages(),_0x140cd9=_0x457861[_0x1b7521(0x195)](_0x43648b=>_0x43648b[_0x1b7521(0x189)]),_0x5819d6=[_0x1b7521(0x16a),..._0x48ebc8[_0x1b7521(0x195)](_0x1e4014=>_0x1e4014[_0x1b7521(0x183)])],_0x23d384=getStringWidth(getMaxWidth(_0x5819d6,0x4)),_0x374a8b=getStringWidth(getMaxWidth(['菜单名称'])),[_0x35dc77,_0x4d6794]=useState(_0x1b7521(0x186)),[_0x176ff1,_0x2f9e31]=useState(new Set()),[_0x2d585b,_0x406b02]=useState(0x0),[_0x2d4a80,_0x4ffa69]=useState(''),[_0x1b33c4,_0x4144b5]=useState(''),[_0x5095df,_0x5bcdc7]=useState(''),[_0x4e5205,_0x71a7a5]=useState(''),[_0x41aaef,_0x1bf5e8]=useState([]),_0x21cc0a=_0x48ebc8[_0x1b7521(0x195)](_0x2ce6dd=>({'label':_0x2ce6dd[_0x1b7521(0x183)],'path':_0x2ce6dd[_0x1b7521(0x189)],'local':!![],'online':_0x140cd9[_0x1b7521(0x16e)](_0x2ce6dd[_0x1b7521(0x189)])})),_0x7d1a45=_0x48ebc8['filter'](_0x16f6aa=>{const _0x5db113=_0x1b7521;return!_0x140cd9[_0x5db113(0x16e)](_0x16f6aa[_0x5db113(0x189)]);});useEffect(()=>{const _0x35f00f=_0x1b7521;if(!_0x86243f&&_0x48ebc8[_0x35f00f(0x18d)]>0x0&&_0x176ff1[_0x35f00f(0x196)]===0x0){const _0xe77d02=new Set(_0x48ebc8['map']((_0x56b22e,_0x36167e)=>({'page':_0x56b22e,'index':_0x36167e}))[_0x35f00f(0x180)](({page:_0x1c4d21})=>!_0x140cd9[_0x35f00f(0x16e)](_0x1c4d21['path']))[_0x35f00f(0x195)](({index:_0x311ae6})=>_0x311ae6));_0x2f9e31(_0xe77d02);}},[_0x86243f,_0x48ebc8['length'],_0x140cd9[_0x1b7521(0x18d)]]),useInput(async(_0x2bfa1c,_0x4215cc)=>{const _0x35370a=_0x1b7521;if(_0x35dc77===_0x35370a(0x186)){if(_0x4215cc[_0x35370a(0x181)]){_0x406b02(_0x57b6b8=>_0x57b6b8>0x0?_0x57b6b8-0x1:_0x48ebc8['length']-0x1);return;}if(_0x4215cc['downArrow']){_0x406b02(_0x32e393=>_0x32e393<_0x48ebc8['length']-0x1?_0x32e393+0x1:0x0);return;}if(_0x2bfa1c==='\x20'){_0x2f9e31(_0x8924f5=>{const _0x196678=_0x35370a,_0x493776=new Set(_0x8924f5);return _0x493776[_0x196678(0x164)](_0x2d585b)?_0x493776[_0x196678(0x17f)](_0x2d585b):_0x493776[_0x196678(0x17b)](_0x2d585b),_0x493776;});return;}if(_0x2bfa1c==='a'||_0x2bfa1c==='A'){const _0xe60127=new Set(_0x48ebc8[_0x35370a(0x195)]((_0x36022f,_0x4a2926)=>_0x4a2926));_0x2f9e31(_0xe60127);return;}if(_0x2bfa1c==='i'||_0x2bfa1c==='I'||_0x2bfa1c==='r'||_0x2bfa1c==='R'){_0x2f9e31(_0x2dade1=>{const _0x25c1ba=_0x35370a,_0x348f3c=new Set();for(let _0x50cb84=0x0;_0x50cb84<_0x48ebc8['length'];_0x50cb84++){!_0x2dade1[_0x25c1ba(0x164)](_0x50cb84)&&_0x348f3c[_0x25c1ba(0x17b)](_0x50cb84);}return _0x348f3c;});return;}if(_0x2bfa1c==='q'||_0x2bfa1c==='Q'){_0x207903();return;}if(_0x4215cc[_0x35370a(0x16b)]){if(_0x176ff1['size']===0x0){_0x71a7a5(_0x35370a(0x1a5));return;}const _0xb9da8d=_0x48ebc8[_0x35370a(0x180)]((_0x136109,_0x31d796)=>_0x176ff1['has'](_0x31d796)),_0x84e8aa=_0xb9da8d[_0x35370a(0x195)](_0x124559=>_0x124559['label'])[_0x35370a(0x184)](',\x20');_0x1bf5e8([{'label':'已选择菜单','value':_0x176ff1[_0x35370a(0x196)]+'\x20个'}]),_0x71a7a5(''),_0x4d6794(_0x35370a(0x182));return;}return;}if(_0x35dc77===_0x35370a(0x182)){if(_0x4215cc[_0x35370a(0x16b)]){const _0x516bae=_0x5095df[_0x35370a(0x1a3)]();if(_0x516bae==='')return;if(!isValidJsHttpsUrl(_0x516bae)){_0x71a7a5('请输入有效的\x20JS\x20https\x20链接');return;}if(!await isUrlReachable(_0x516bae)){_0x71a7a5(_0x35370a(0x194));return;}_0x4ffa69(_0x516bae),_0x1bf5e8(_0x5fd94=>[..._0x5fd94,{'label':_0x35370a(0x18e),'value':_0x516bae}]),_0x5bcdc7(''),_0x71a7a5(''),_0x4d6794(_0x35370a(0x176));return;}if(_0x4215cc[_0x35370a(0x179)]||_0x4215cc['delete']){_0x5bcdc7(_0x441a60=>_0x441a60['slice'](0x0,-0x1)),_0x71a7a5('');return;}_0x5bcdc7(_0x173c18=>_0x173c18+_0x2bfa1c);return;}if(_0x35dc77===_0x35370a(0x176)){if(_0x4215cc[_0x35370a(0x16b)]){const _0x15bcfe=_0x5095df[_0x35370a(0x1a3)]();if(_0x15bcfe==='')return;if(!isValidCssHttpsUrl(_0x15bcfe)){_0x71a7a5(_0x35370a(0x19b));return;}if(!await isUrlReachable(_0x15bcfe)){_0x71a7a5(_0x35370a(0x177));return;}_0x4144b5(_0x15bcfe),_0x1bf5e8(_0x55a23e=>[..._0x55a23e,{'label':'CSS\x20链接','value':_0x15bcfe}]),_0x5bcdc7(''),_0x71a7a5(''),_0x4d6794(_0x35370a(0x17d));const _0x2c68d8=_0x48ebc8['filter']((_0x5cb7ac,_0x786186)=>_0x176ff1[_0x35370a(0x164)](_0x786186));createMenus(_0x2c68d8,[_0x2d4a80,_0x15bcfe])[_0x35370a(0x19d)](()=>{const _0x4059be=_0x35370a;_0x4d6794(_0x4059be(0x174)),setTimeout(()=>{_0x207903();},0x3e8);})[_0x35370a(0x18f)](_0x3788d1=>{const _0xf435cf=_0x35370a;_0x71a7a5(_0x3788d1[_0xf435cf(0x191)]||_0xf435cf(0x165)),_0x4d6794(_0xf435cf(0x186));});return;}if(_0x4215cc[_0x35370a(0x179)]||_0x4215cc[_0x35370a(0x17f)]){_0x5bcdc7(_0x67c7cc=>_0x67c7cc[_0x35370a(0x19e)](0x0,-0x1)),_0x71a7a5('');return;}_0x5bcdc7(_0x1105b1=>_0x1105b1+_0x2bfa1c);return;}});if(_0x86243f)return a10_0x3297a3(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x249ef8(Text,{'children':'\x20\x20'}),a10_0x249ef8(a10_0x4ecc62,{'type':_0x1b7521(0x169)}),a10_0x249ef8(Text,{'children':_0x1b7521(0x187)})]});if(_0x9e4c5)return a10_0x3297a3(Box,{'flexDirection':_0x1b7521(0x161),'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x3297a3(Text,{'color':_0x1b7521(0x18b),'children':['✗\x20',_0x9e4c5]}),a10_0x3297a3(Box,{'marginTop':0x1,'children':[a10_0x249ef8(Text,{'color':_0x1b7521(0x171),'children':'提示:使用\x20'}),a10_0x249ef8(Text,{'color':_0x1b7521(0x175),'children':_0x1b7521(0x199)}),a10_0x249ef8(Text,{'color':_0x1b7521(0x171),'children':'\x20命令重新登录'})]})]});if(_0x48ebc8[_0x1b7521(0x18d)]===0x0)return a10_0x249ef8(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x249ef8(Text,{'color':_0x1b7521(0x19f),'children':'!\x20未找到本地页面,请先创建页面'})});return a10_0x3297a3(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':[_0x35dc77===_0x1b7521(0x186)&&a10_0x3297a3(a10_0x32c546,{'children':[a10_0x3297a3(Box,{'children':[a10_0x3297a3(Text,{'bold':!![],'children':['\x20\x20',_0x1b7521(0x16a),getRemainingSpaces(_0x23d384,_0x1b7521(0x16a))]}),a10_0x3297a3(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x374a8b,'菜单名称')]}),a10_0x3297a3(Text,{'bold':!![],'children':[_0x1b7521(0x18a),getRemainingSpaces(_0x374a8b,_0x1b7521(0x16a))]})]}),_0x21cc0a[_0x1b7521(0x195)](_0x4ae650=>a10_0x3297a3(Box,{'children':[a10_0x3297a3(Text,{'children':['\x20\x20',_0x4ae650[_0x1b7521(0x183)],getRemainingSpaces(_0x23d384,_0x4ae650[_0x1b7521(0x183)])]}),a10_0x3297a3(Text,{'color':_0x1b7521(0x17a),'children':[_0x4ae650[_0x1b7521(0x185)]?'✓':'✗',getRemainingSpaces(_0x374a8b,'✓')]}),a10_0x3297a3(Text,{'color':_0x4ae650[_0x1b7521(0x1a2)]?'green':_0x1b7521(0x18b),'children':[_0x4ae650[_0x1b7521(0x1a2)]?'✓':'✗',getRemainingSpaces(_0x374a8b,'✓')]})]},_0x4ae650[_0x1b7521(0x189)]))]}),_0x35dc77===_0x1b7521(0x186)&&_0x41aaef[_0x1b7521(0x18d)]===0x0&&a10_0x249ef8(Box,{'marginTop':0x1,'children':a10_0x249ef8(Text,{'color':'cyan','children':_0x1b7521(0x173)})}),_0x41aaef[_0x1b7521(0x195)]((_0x522137,_0x3690aa)=>a10_0x3297a3(Box,{'children':[a10_0x3297a3(Text,{'color':_0x1b7521(0x17a),'children':['√\x20',_0x522137[_0x1b7521(0x183)],':\x20']}),a10_0x249ef8(Text,{'color':_0x1b7521(0x175),'children':_0x522137[_0x1b7521(0x192)]})]},_0x3690aa)),_0x4e5205&&_0x35dc77===_0x1b7521(0x186)&&a10_0x249ef8(Box,{'marginTop':0x1,'children':a10_0x3297a3(Text,{'color':_0x1b7521(0x18b),'children':['✗\x20',_0x4e5205]})}),_0x35dc77===_0x1b7521(0x186)&&a10_0x249ef8(a10_0x32c546,{'children':a10_0x3297a3(Box,{'marginTop':_0x41aaef[_0x1b7521(0x18d)]>0x0||_0x4e5205?0x1:0x0,'flexDirection':'column','children':[a10_0x249ef8(Text,{'bold':!![],'children':_0x1b7521(0x162)}),_0x48ebc8[_0x1b7521(0x195)]((_0x5ee328,_0x2d607b)=>{const _0x1c131b=_0x1b7521,_0x2501ae=_0x2d585b===_0x2d607b,_0x5b3131=_0x176ff1[_0x1c131b(0x164)](_0x2d607b),_0x735ce4=_0x140cd9[_0x1c131b(0x16e)](_0x5ee328[_0x1c131b(0x189)]),_0x29b338=_0x735ce4?'更新':'新建';return a10_0x249ef8(Box,{'children':a10_0x3297a3(Text,{'backgroundColor':_0x2501ae?_0x1c131b(0x19a):undefined,'color':_0x2501ae?_0x1c131b(0x1a0):undefined,'children':['\x20\x20',_0x5b3131?_0x1c131b(0x16d):_0x1c131b(0x163),'\x20',_0x5ee328['label']]})},_0x5ee328[_0x1c131b(0x189)]);}),a10_0x249ef8(Box,{'marginTop':0x1,'children':a10_0x3297a3(Text,{'color':'gray','children':['\x20','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认']})})]})}),_0x35dc77===_0x1b7521(0x182)&&a10_0x3297a3(a10_0x32c546,{'children':[a10_0x3297a3(Box,{'children':[a10_0x249ef8(Text,{'children':'*\x20JS\x20链接:\x20'}),a10_0x249ef8(Text,{'color':_0x1b7521(0x17a),'children':_0x5095df}),_0x4e5205&&a10_0x3297a3(Text,{'color':_0x1b7521(0x18b),'children':[_0x1b7521(0x16f),_0x4e5205]})]}),!_0x4e5205&&a10_0x249ef8(Box,{'children':a10_0x249ef8(Text,{'color':'gray','children':_0x1b7521(0x160)})})]}),_0x35dc77===_0x1b7521(0x176)&&a10_0x3297a3(a10_0x32c546,{'children':[a10_0x3297a3(Box,{'children':[a10_0x249ef8(Text,{'children':_0x1b7521(0x172)}),a10_0x249ef8(Text,{'color':_0x1b7521(0x17a),'children':_0x5095df}),_0x4e5205&&a10_0x3297a3(Text,{'color':'red','children':[_0x1b7521(0x16f),_0x4e5205]})]}),!_0x4e5205&&a10_0x249ef8(Box,{'children':a10_0x249ef8(Text,{'color':_0x1b7521(0x171),'children':_0x1b7521(0x1a4)})})]}),_0x35dc77===_0x1b7521(0x17d)&&a10_0x249ef8(Box,{'children':a10_0x249ef8(Text,{'children':_0x1b7521(0x197)})}),_0x35dc77===_0x1b7521(0x174)&&a10_0x249ef8(Box,{'children':a10_0x249ef8(Text,{'color':_0x1b7521(0x17a),'children':'√\x20菜单创建完成'})})]});}function a10_0x2863(_0x2dfd44,_0x4681ad){const _0x131365=a10_0x1313();return a10_0x2863=function(_0x286355,_0x130b75){_0x286355=_0x286355-0x160;let _0xd1e46f=_0x131365[_0x286355];return _0xd1e46f;},a10_0x2863(_0x2dfd44,_0x4681ad);}function getStringWidth(_0x5a6c4d){const _0x166e0c=a10_0x3f9db8;let _0x4592d6=0x0;for(const _0x2edbd4 of _0x5a6c4d){/[\u4e00-\u9fa5]/[_0x166e0c(0x18c)](_0x2edbd4)?_0x4592d6+=0x2:_0x4592d6+=0x1;}return _0x4592d6;}function getRemainingSpaces(_0x3cc6c9,_0x22d446){const _0x5100bf=a10_0x3f9db8,_0x1fe2a0=getStringWidth(_0x22d446);return Array(Math[_0x5100bf(0x198)](0x0,_0x3cc6c9-_0x1fe2a0))[_0x5100bf(0x19c)]('\x20')[_0x5100bf(0x184)]('');}function getMaxWidth(_0x179f29,_0x8ff162=0x2){const _0x1d4293=a10_0x3f9db8;let _0x206262='',_0x18552e=0x0;for(const _0x23e8aa of _0x179f29){const _0x480064=getStringWidth(_0x23e8aa);_0x480064>_0x18552e&&(_0x18552e=_0x480064,_0x206262=_0x23e8aa);}return _0x206262+'\x20'[_0x1d4293(0x188)](_0x8ff162);}
|