@lovrabet/cli 1.1.21 → 1.1.23
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/valid-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
- package/templates/projects/sub-app-react-demo/CHANGELOG.md +16 -0
- package/templates/projects/sub-app-react-demo/README.md +163 -54
- package/templates/projects/sub-app-react-demo/package-lock.json +1347 -149
- package/templates/projects/sub-app-react-demo/package.json +2 -2
- package/templates/projects/sub-app-react-demo/src/layouts/MainLayout.tsx +286 -55
- package/templates/projects/sub-app-react-demo/src/pages/data-screen/index.tsx +526 -0
- package/templates/projects/sub-app-react-demo/src/pages/index.tsx +942 -87
- package/templates/projects/sub-app-react-demo/src/pages/intro/index.tsx +560 -0
- package/templates/projects/sub-app-react-demo/src/pages/sdk-demo/index.tsx +113 -118
- package/templates/projects/sub-app-react-demo/src/pages/workbench/index.tsx +469 -0
- package/templates/projects/sub-app-react-demo/src/style.css +39 -0
- package/templates/rules/lovrabet_rules.mdc.tpl +181 -115
- package/templates/projects/sub-app-react-demo/bun.lock +0 -600
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a0_0x4a5e(_0x5ee7f5,_0xfb4c29){const _0x32add5=a0_0x32ad();return a0_0x4a5e=function(_0x4a5e04,_0x2552b5){_0x4a5e04=_0x4a5e04-0x185;let _0x3828f0=_0x32add5[_0x4a5e04];return _0x3828f0;},a0_0x4a5e(_0x5ee7f5,_0xfb4c29);}(function(_0x2e2dee,_0x2fac7c){const _0x19cd22=a0_0x4a5e,_0x467cd9=_0x2e2dee();while(!![]){try{const _0x364107=parseInt(_0x19cd22(0x194))/0x1*(parseInt(_0x19cd22(0x197))/0x2)+-parseInt(_0x19cd22(0x189))/0x3*(-parseInt(_0x19cd22(0x192))/0x4)+parseInt(_0x19cd22(0x186))/0x5*(parseInt(_0x19cd22(0x195))/0x6)+-parseInt(_0x19cd22(0x1a3))/0x7+parseInt(_0x19cd22(0x187))/0x8*(-parseInt(_0x19cd22(0x19b))/0x9)+-parseInt(_0x19cd22(0x18d))/0xa*(-parseInt(_0x19cd22(0x19d))/0xb)+parseInt(_0x19cd22(0x188))/0xc;if(_0x364107===_0x2fac7c)break;else _0x467cd9['push'](_0x467cd9['shift']());}catch(_0x4cdb5f){_0x467cd9['push'](_0x467cd9['shift']());}}}(a0_0x32ad,0x89633));function a0_0x32ad(){const _0x4669fb=['64rRUpfX','5555388fBpRnL','68808UdnOPf','includes','路径不能以\x20/\x20开头或结尾','red','40KIKOtw','\x20Step2:\x20','startsWith','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','backspace','44rdYtPH','return','38894FaRtHH','30YiiNXN','\x20←\x20','2XxCBnL','页面路径\x20','delete','length','1177560bVwVqN','split','1117391dhPyOx','slice','路径不能包含连续的\x20/','existsSync','gray','column','2502073fVaeWa','green','页面路由地址:\x20','页面路径不合法','\x20已存在,请使用其他路径','806435XpePRO'];a0_0x32ad=function(){return _0x4669fb;};return a0_0x32ad();}import{jsx as a0_0x543245,jsxs as a0_0x5a151c}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x569e67 from'node:fs';export function InputProjectCode(_0x1f9b16){const _0x49ce43=a0_0x4a5e,{onSubmit:_0x1d2605,pagePath:_0xefbe84}=_0x1f9b16,[_0x18d4f3,_0x196803]=useState(''),[_0x211ef3,_0x159bd1]=useState(''),_0x2d3466='my-page';function _0x366dfd(_0x2168f5){const _0x2cd481=a0_0x4a5e;if(_0x2168f5[_0x2cd481(0x19a)]>0x64)return{'valid':![],'message':'页面路径长度不能超过\x20100\x20个字符'};if(_0x2168f5[_0x2cd481(0x18f)]('/')||_0x2168f5['endsWith']('/'))return{'valid':![],'message':_0x2cd481(0x18b)};if(_0x2168f5[_0x2cd481(0x18a)]('//'))return{'valid':![],'message':_0x2cd481(0x19f)};const _0x202010=_0x2168f5[_0x2cd481(0x19c)]('/');for(const _0x14abf1 of _0x202010){if(!_0x14abf1)continue;const _0x34dc41=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x34dc41['test'](_0x14abf1))return{'valid':![],'message':_0x2cd481(0x190)};}return{'valid':!![]};}return useInput((_0x40e822,_0x4ea074)=>{const _0x2e43a7=a0_0x4a5e;if(_0x4ea074[_0x2e43a7(0x193)]){const _0x3e5803=_0x18d4f3['trim']()||_0x2d3466;if(_0x211ef3)return;const _0x5c4ba1=_0xefbe84+'/'+_0x3e5803;if(a0_0x569e67[_0x2e43a7(0x1a0)](_0x5c4ba1)){_0x159bd1(_0x2e43a7(0x198)+_0x3e5803+_0x2e43a7(0x185));return;}_0x1d2605(_0x3e5803),_0x196803(''),_0x159bd1('');}else _0x4ea074[_0x2e43a7(0x191)]||_0x4ea074[_0x2e43a7(0x199)]?_0x196803(_0x35bd9d=>{const _0x120c1c=_0x2e43a7,_0x49c5f4=_0x35bd9d[_0x120c1c(0x19e)](0x0,-0x1),{valid:_0x347436,message:_0x199169}=_0x366dfd(_0x49c5f4);return _0x159bd1(_0x347436?'':_0x199169||_0x120c1c(0x1a6)),_0x49c5f4;}):_0x196803(_0x1253ca=>{const _0x580e38=_0x2e43a7,_0x2a4e6c=_0x1253ca+_0x40e822,{valid:_0x4d0a34,message:_0x44a16a}=_0x366dfd(_0x2a4e6c);return _0x159bd1(_0x4d0a34?'':_0x44a16a||_0x580e38(0x1a6)),_0x2a4e6c;});}),a0_0x5a151c(Box,{'flexDirection':_0x49ce43(0x1a2),'children':[a0_0x5a151c(Box,{'children':[a0_0x543245(Text,{'color':'gray','children':_0x49ce43(0x18e)}),a0_0x543245(Text,{'children':_0x49ce43(0x1a5)}),_0x18d4f3?a0_0x543245(Text,{'color':_0x49ce43(0x1a4),'children':_0x18d4f3}):a0_0x543245(Text,{'color':_0x49ce43(0x1a1),'children':_0x2d3466}),_0x211ef3&&a0_0x5a151c(Text,{'color':_0x49ce43(0x18c),'children':[_0x49ce43(0x196),_0x211ef3]})]}),!_0x211ef3&&!_0x18d4f3&&a0_0x543245(Box,{'children':a0_0x543245(Text,{'color':_0x49ce43(0x1a1),'children':'\x20直接回车确认,或输入自定义路由地址'})})]});}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0x114233=a1_0x38d9;function a1_0x38d9(_0x4d68ab,_0x13c857){const _0x5cadd5=a1_0x5cad();return a1_0x38d9=function(_0x38d9d5,_0x235465){_0x38d9d5=_0x38d9d5-0x1f4;let _0x78df2b=_0x5cadd5[_0x38d9d5];return _0x78df2b;},a1_0x38d9(_0x4d68ab,_0x13c857);}(function(_0x30e6b6,_0x19a2d0){const _0x2166d3=a1_0x38d9,_0x3ec578=_0x30e6b6();while(!![]){try{const _0x48bbbc=parseInt(_0x2166d3(0x209))/0x1+parseInt(_0x2166d3(0x20b))/0x2+-parseInt(_0x2166d3(0x210))/0x3+-parseInt(_0x2166d3(0x1f5))/0x4*(-parseInt(_0x2166d3(0x215))/0x5)+parseInt(_0x2166d3(0x211))/0x6+-parseInt(_0x2166d3(0x203))/0x7+-parseInt(_0x2166d3(0x212))/0x8;if(_0x48bbbc===_0x19a2d0)break;else _0x3ec578['push'](_0x3ec578['shift']());}catch(_0xc3100d){_0x3ec578['push'](_0x3ec578['shift']());}}}(a1_0x5cad,0x91b14));import{jsx as a1_0x4abca,jsxs as a1_0x124428,Fragment as a1_0x27462c}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x3bdc9f 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';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x3bdc9f['dirname'](fileURLToPath(import.meta['url'])),pageTemplateDir=a1_0x3bdc9f[a1_0x114233(0x1ff)](__dirname,'../../templates/pages'),projectDir=process['cwd']();function a1_0x5cad(){const _0x325d47=['info','639066AJMInZ','1038258sirLQr','13899696cSFbhs','页面添加失败:\x20','setLogPath','5945605eySBpq','finally','processTemplate','add-page','4PVvRjt','\x20*\x20页面路径:\x20','join','cyan','页面添加成功:\x20','gray','error','pages','message','green','resolve','now','开始添加页面:\x20','已选择页面模板\x20','6336456XMfvvc','正在创建页面,请稍候…','\x20*\x20路由地址:\x20','\x20*\x20页面创建成功!','src','then','1178530XVIrSP','catch','1823508lNzBAf','\x20Step1:\x20','success','已输入的页面路由\x20'];a1_0x5cad=function(){return _0x325d47;};return a1_0x5cad();}export const AddPage=()=>{const _0x391ef4=a1_0x114233,{exit:_0x81377f}=useApp(),[_0x4a2fa6,_0x507923]=useState(''),[_0x2f2c28,_0x56fcd9]=useState(''),[_0x4e1f61,_0x2a7b5d]=useState(![]),[_0x2bc3c8,_0x562690]=useState(![]),_0x19d796=a1_0x3bdc9f[_0x391ef4(0x1f7)](projectDir,_0x391ef4(0x207),_0x391ef4(0x1fc)),_0x331ef2=a1_0x3bdc9f[_0x391ef4(0x1f7)](_0x19d796,_0x2f2c28),_0x5b813d=a1_0x3bdc9f['join'](_0x391ef4(0x207),'pages',_0x2f2c28);useEffect(()=>{const _0x37cfea=_0x391ef4,_0x14ea5c=a1_0x3bdc9f[_0x37cfea(0x1ff)](pageTemplateDir,_0x4a2fa6);if(_0x4a2fa6&&_0x2f2c28){_0x2a7b5d(!![]),logger[_0x37cfea(0x214)](process['cwd']());const _0x2ff8ef=Date[_0x37cfea(0x200)]();logger[_0x37cfea(0x20f)]('add-page',_0x37cfea(0x201)+_0x2f2c28,{'template':_0x4a2fa6,'targetPath':_0x5b813d}),TemplateReplacer[_0x37cfea(0x217)](_0x14ea5c,a1_0x3bdc9f[_0x37cfea(0x1f7)](_0x19d796,_0x2f2c28),_0x2f2c28,_0x4a2fa6)[_0x37cfea(0x208)](()=>{const _0x5b785b=_0x37cfea,_0x159ccc=Date[_0x5b785b(0x200)]()-_0x2ff8ef;logger[_0x5b785b(0x20d)](_0x5b785b(0x1f4),_0x5b785b(0x1f9)+_0x2f2c28,_0x159ccc,{'template':_0x4a2fa6,'targetPath':_0x5b813d,'routePath':_0x2f2c28}),_0x562690(!![]);})[_0x37cfea(0x20a)](_0x4e94ec=>{const _0x16ed70=_0x37cfea,_0x3a43a6=Date[_0x16ed70(0x200)]()-_0x2ff8ef;logger[_0x16ed70(0x1fb)](_0x16ed70(0x1f4),_0x16ed70(0x213)+_0x2f2c28,{'template':_0x4a2fa6,'targetPath':_0x5b813d,'error':_0x4e94ec instanceof Error?_0x4e94ec[_0x16ed70(0x1fd)]:String(_0x4e94ec),'duration':_0x3a43a6});})[_0x37cfea(0x216)](()=>{_0x2a7b5d(![]);});}},[_0x4a2fa6,_0x2f2c28]),useEffect(()=>{_0x2bc3c8&&setTimeout(()=>{_0x81377f();});},[_0x2bc3c8]);if(_0x4a2fa6)return a1_0x124428(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0x124428(Box,{'children':[a1_0x4abca(Text,{'color':'gray','children':_0x391ef4(0x20c)}),a1_0x4abca(Text,{'children':_0x391ef4(0x202)}),a1_0x4abca(Text,{'color':_0x391ef4(0x1fe),'children':_0x4a2fa6})]}),_0x2f2c28?a1_0x124428(Box,{'children':[a1_0x4abca(Text,{'color':_0x391ef4(0x1fa),'children':'\x20Step2:\x20'}),a1_0x4abca(Text,{'children':_0x391ef4(0x20e)}),a1_0x4abca(Text,{'color':_0x391ef4(0x1fe),'children':_0x2f2c28})]}):a1_0x4abca(InputProjectCode,{'pagePath':_0x331ef2,'onSubmit':_0x56fcd9}),_0x2f2c28&&_0x4e1f61?a1_0x124428(Box,{'marginTop':0x1,'children':[a1_0x4abca(Box,{'width':'4'}),a1_0x4abca(Text,{'children':_0x391ef4(0x204)})]}):null,_0x2bc3c8?a1_0x124428(a1_0x27462c,{'children':[a1_0x4abca(Box,{'marginTop':0x1,'children':a1_0x4abca(Text,{'color':'gray','children':_0x391ef4(0x206)})}),a1_0x124428(Box,{'children':[a1_0x4abca(Text,{'color':_0x391ef4(0x1fa),'children':_0x391ef4(0x1f6)}),a1_0x4abca(Text,{'color':'green','children':_0x5b813d})]}),a1_0x124428(Box,{'children':[a1_0x4abca(Text,{'color':_0x391ef4(0x1fa),'children':_0x391ef4(0x205)}),a1_0x124428(Text,{'color':'green','children':['/',_0x2f2c28]})]}),a1_0x4abca(Box,{'marginTop':0x1,'children':a1_0x4abca(Text,{'color':_0x391ef4(0x1f8),'children':'\x20*\x20页面文件已创建,可直接通过路由访问'})})]}):null]});return a1_0x4abca(SelectPageTemplate,{'onSelect':_0x507923});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3add32,_0x5342f7){const _0x53b06a=a2_0x3f9f,_0x461a8e=_0x3add32();while(!![]){try{const _0x2f2577=-parseInt(_0x53b06a(0x73))/0x1*(parseInt(_0x53b06a(0x87))/0x2)+-parseInt(_0x53b06a(0x72))/0x3*(parseInt(_0x53b06a(0x80))/0x4)+-parseInt(_0x53b06a(0x74))/0x5*(-parseInt(_0x53b06a(0x6e))/0x6)+-parseInt(_0x53b06a(0x89))/0x7+parseInt(_0x53b06a(0x7b))/0x8*(parseInt(_0x53b06a(0x8b))/0x9)+parseInt(_0x53b06a(0x82))/0xa+-parseInt(_0x53b06a(0x84))/0xb*(-parseInt(_0x53b06a(0x7d))/0xc);if(_0x2f2577===_0x5342f7)break;else _0x461a8e['push'](_0x461a8e['shift']());}catch(_0x147c1a){_0x461a8e['push'](_0x461a8e['shift']());}}}(a2_0x5306,0x61269));import{jsx as a2_0x2273a6,jsxs as a2_0x105b22}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x55ee0f from'node:path';import{fileURLToPath}from'node:url';function a2_0x5306(){const _0xbb3e17=['sdk-fetch','column','../..','onSelect','45168CDOonl','error','正在加载页面模板...','\x20Step1:\x20','213IUUqiN','97VjPnyV','290gOHkHs','blank','获取模板列表失败:','localeCompare','filter','label','map','7088qVAiab','gray','12xdfaIU','url','join','42116upoDRW','isDirectory','1537980NfSLxp','templates/pages','7399986McRNhg','green','dirname','10408iRZwdf','return','378dRHRKK','length','3933qvTBqJ','upArrow','请选择您要创建的页面模板','name','resolve','sort'];a2_0x5306=function(){return _0xbb3e17;};return a2_0x5306();}function a2_0x3f9f(_0x3be73d,_0x541942){const _0x5306b1=a2_0x5306();return a2_0x3f9f=function(_0x3f9f7c,_0x29ebad){_0x3f9f7c=_0x3f9f7c-0x6e;let _0x289ad6=_0x5306b1[_0x3f9f7c];return _0x289ad6;},a2_0x3f9f(_0x3be73d,_0x541942);}async function getTemplateList(){const _0x4bb91a=a2_0x3f9f;try{const _0x548af6=fileURLToPath(import.meta[_0x4bb91a(0x7e)]),_0x776dcf=a2_0x55ee0f[_0x4bb91a(0x8f)](a2_0x55ee0f[_0x4bb91a(0x86)](_0x548af6),_0x4bb91a(0x93)),_0x201964=a2_0x55ee0f[_0x4bb91a(0x7f)](_0x776dcf,_0x4bb91a(0x83)),_0x1955ef=await readdir(_0x201964,{'withFileTypes':!![]}),_0x200d24=_0x1955ef[_0x4bb91a(0x78)](_0x16701c=>_0x16701c[_0x4bb91a(0x81)]())['map'](_0x2c07e8=>({'label':_0x2c07e8[_0x4bb91a(0x8e)]}))[_0x4bb91a(0x90)]((_0x491c1c,_0x1eba7e)=>_0x491c1c['label'][_0x4bb91a(0x77)](_0x1eba7e['label']));return _0x200d24;}catch(_0x1b218b){return console[_0x4bb91a(0x6f)](_0x4bb91a(0x76),_0x1b218b),[{'label':_0x4bb91a(0x75)},{'label':_0x4bb91a(0x91)}];}}export function SelectPageTemplate(_0x53587a){const _0x4a0ff7=a2_0x3f9f,[_0x459d27,_0x5ac31b]=useState(0x0),[_0x3acd1e,_0x3458f3]=useState([]),[_0x1b5291,_0x29d04d]=useState(!![]);useEffect(()=>{async function _0x1d48b7(){const _0x572ffb=await getTemplateList();_0x3458f3(_0x572ffb),_0x29d04d(![]);}_0x1d48b7();},[]),useInput((_0x4e55cc,_0x13b19d)=>{const _0x6d829b=a2_0x3f9f;if(_0x1b5291)return;if(_0x13b19d[_0x6d829b(0x88)]){const _0x832a9f=_0x3acd1e[_0x459d27];_0x832a9f&&_0x53587a[_0x6d829b(0x94)](_0x832a9f[_0x6d829b(0x79)]);}_0x13b19d[_0x6d829b(0x8c)]&&_0x5ac31b(_0x1f6874=>_0x1f6874===0x0?_0x3acd1e[_0x6d829b(0x8a)]-0x1:_0x1f6874-0x1),_0x13b19d['downArrow']&&_0x5ac31b(_0x397b40=>_0x397b40===_0x3acd1e[_0x6d829b(0x8a)]-0x1?0x0:_0x397b40+0x1);});if(_0x1b5291)return a2_0x2273a6(Box,{'flexDirection':'column','paddingY':0x1,'children':a2_0x105b22(Box,{'children':[a2_0x2273a6(Text,{'color':_0x4a0ff7(0x7c),'children':_0x4a0ff7(0x71)}),a2_0x2273a6(Text,{'children':_0x4a0ff7(0x70)})]})});return a2_0x105b22(Box,{'flexDirection':_0x4a0ff7(0x92),'paddingY':0x1,'children':[a2_0x105b22(Box,{'children':[a2_0x2273a6(Text,{'color':_0x4a0ff7(0x7c),'children':_0x4a0ff7(0x71)}),a2_0x2273a6(Text,{'children':_0x4a0ff7(0x8d)})]}),_0x3acd1e[_0x4a0ff7(0x7a)]((_0x415ea8,_0x24b833)=>{const _0x55e8aa=_0x4a0ff7,_0x5348ed=_0x24b833===_0x459d27,_0x773589=_0x5348ed?'\x20\x20\x20\x20\x20\x20>\x20'+_0x415ea8['label']:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x415ea8[_0x55e8aa(0x79)];return a2_0x2273a6(Box,{'children':a2_0x2273a6(Text,{'color':_0x5348ed?_0x55e8aa(0x85):undefined,'children':_0x773589})},_0x773589);})]});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x58622b,_0x33787e){const _0xae7041=a3_0x2a41,_0x260d2b=_0x58622b();while(!![]){try{const _0x72fd96=parseInt(_0xae7041(0x21e))/0x1+parseInt(_0xae7041(0x21c))/0x2+parseInt(_0xae7041(0x205))/0x3+-parseInt(_0xae7041(0x212))/0x4*(parseInt(_0xae7041(0x224))/0x5)+parseInt(_0xae7041(0x21d))/0x6+parseInt(_0xae7041(0x219))/0x7+-parseInt(_0xae7041(0x1fa))/0x8*(parseInt(_0xae7041(0x201))/0x9);if(_0x72fd96===_0x33787e)break;else _0x260d2b['push'](_0x260d2b['shift']());}catch(_0x469ba0){_0x260d2b['push'](_0x260d2b['shift']());}}}(a3_0x1f1f,0x7ec7f));import{jsx as a3_0x1c37f7,jsxs as a3_0xf06219,Fragment as a3_0x3d218a}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a3_0x1f1f(){const _0x5c7a89=['*\x20生成的文档文件:','env','dim','column','文档生成失败:\x20','4153645RKpTHu','green','正在生成\x20','success','filter','文档生成完成','gray','red','cwd','*\x20共处理\x20','yellow','cyan','未提供应用AppCode,且配置中也没有默认值','指定的数据集代码都不存在:\x20','datasetName','map','856qPrFUO','\x20个数据集','white','lovrabet\x20auth','\x20(环境:\x20','includes','\x20个匹配的数据集\x1b[0m','165411cUlJJP','join','\x20个数据集的文档...','log','1160100IhlrgO','message','\x1b[90m*\x20从\x20','string','error','datasetCode','未找到任何数据集','online','\x20重新登录后再试','length','⚠️\x20以下数据集生成失败:','\x1b[33m!\x20以下数据集代码不存在:\x20','\x20-\x20','4pPFmLR','使用指定的应用AppCode:\x20','使用配置的应用AppCode:\x20','./docs','.md\x20(','setLogPath','💡\x20请使用\x20','4321268AEqMGU','\x1b[0m','api-doc','2017464YqlTDE','4151796MjUzLg','611855NGkFEE'];a3_0x1f1f=function(){return _0x5c7a89;};return a3_0x1f1f();}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';function a3_0x2a41(_0x12cdd1,_0x2f5273){const _0x1f1feb=a3_0x1f1f();return a3_0x2a41=function(_0x2a415f,_0x439324){_0x2a415f=_0x2a415f-0x1ed;let _0x345c16=_0x1f1feb[_0x2a415f];return _0x345c16;},a3_0x2a41(_0x12cdd1,_0x2f5273);}import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x138336,env:_0x30159e,output:_0x180706,extraParams:_0x37f0ce,datasetCodes:_0x1be8d9})=>{const _0x59714b=a3_0x2a41,{exit:_0x2a50e5}=useApp(),[_0x45de83,_0x4454ce]=useState(![]),[_0x1d0d69,_0x41859c]=useState(''),[_0xde0a38,_0x1369fe]=useState(![]),[_0x55b4ac,_0x353934]=useState(null),[_0x1794a0,_0xef80da]=useState(null),[_0x433334,_0x3e510e]=useState(0x0),_0x2a62dd=readConfig(),_0x10f4d1=getConfigAppCode(),_0x5babf3=_0x138336||_0x10f4d1,_0x94e60f=typeof _0x2a62dd?.[_0x59714b(0x220)]===_0x59714b(0x208)?_0x2a62dd[_0x59714b(0x220)]:undefined,_0x56cb40=_0x30159e||_0x94e60f||_0x59714b(0x20c);initEnv(_0x56cb40);const _0x434237=_0x180706||_0x59714b(0x215),_0x42d049=_0x138336?_0x59714b(0x213)+_0x5babf3:_0x59714b(0x214)+_0x5babf3;useEffect(()=>{_0x4454ce(!![]),_0x462bc2();},[]),useEffect(()=>{(_0xde0a38||_0x55b4ac)&&_0x2a50e5();},[_0xde0a38,_0x55b4ac,_0x2a50e5]);async function _0x462bc2(){const _0x2d1651=_0x59714b;if(!_0x5babf3){_0x353934(_0x2d1651(0x1f6));return;}try{logger[_0x2d1651(0x217)](process[_0x2d1651(0x1f2)]()),_0x41859c('正在获取数据集列表...');const {configArray:_0x18269e}=await fetchModelList(_0x5babf3);_0x3e510e(_0x18269e[_0x2d1651(0x20e)]);if(_0x18269e['length']===0x0){_0x353934(_0x2d1651(0x20b));return;}let _0x5621e7=_0x18269e;if(_0x1be8d9&&_0x1be8d9[_0x2d1651(0x20e)]>0x0){_0x5621e7=_0x18269e[_0x2d1651(0x1ee)](_0x5bbe28=>_0x1be8d9[_0x2d1651(0x1ff)](_0x5bbe28['datasetCode']));const _0x249518=_0x5621e7[_0x2d1651(0x1f9)](_0x51c113=>_0x51c113[_0x2d1651(0x20a)]),_0x4ef8d0=_0x1be8d9[_0x2d1651(0x1ee)](_0x7382c1=>!_0x249518['includes'](_0x7382c1));_0x4ef8d0['length']>0x0&&console[_0x2d1651(0x204)](_0x2d1651(0x210)+_0x4ef8d0['join'](',\x20')+_0x2d1651(0x21a));if(_0x5621e7[_0x2d1651(0x20e)]===0x0){_0x353934(_0x2d1651(0x1f7)+_0x1be8d9[_0x2d1651(0x202)](',\x20'));return;}console[_0x2d1651(0x204)](_0x2d1651(0x207)+_0x18269e[_0x2d1651(0x20e)]+'\x20个数据集中筛选出\x20'+_0x5621e7[_0x2d1651(0x20e)]+_0x2d1651(0x200));}_0x41859c(_0x2d1651(0x226)+_0x5621e7[_0x2d1651(0x20e)]+_0x2d1651(0x203));const _0x194185=await generateDatasetDocs(_0x5621e7,_0x5babf3,_0x434237,(_0x4c2b67,_0x511ed1,_0x2e21a3)=>{const _0x25d30b=_0x2d1651;_0x41859c(_0x25d30b(0x226)+_0x2e21a3+_0x25d30b(0x216)+_0x4c2b67+'/'+_0x511ed1+')');},_0x37f0ce);_0xef80da(_0x194185),_0x1369fe(!![]);const _0x133018=_0x194185['filter'](_0x428605=>_0x428605['success'])[_0x2d1651(0x20e)],_0x37ef4c=_0x194185[_0x2d1651(0x1ee)](_0x3cd698=>!_0x3cd698[_0x2d1651(0x1ed)])[_0x2d1651(0x20e)];logger[_0x2d1651(0x1ed)](_0x2d1651(0x21b),_0x2d1651(0x1ef),undefined,{'totalCount':_0x194185['length'],'successCount':_0x133018,'failCount':_0x37ef4c,'outputDir':_0x434237});}catch(_0x2c0029){const _0x57ec62=_0x2c0029 instanceof Error?_0x2c0029[_0x2d1651(0x206)]:String(_0x2c0029);logger[_0x2d1651(0x209)]('api-doc',_0x2d1651(0x223)+_0x57ec62,{'appCode':_0x5babf3,'outputDir':_0x434237}),_0x353934(_0x2d1651(0x223)+_0x57ec62);}finally{_0x4454ce(![]);}}const _0x1698b5=_0x1794a0?.[_0x59714b(0x1ee)](_0x46e9bf=>_0x46e9bf[_0x59714b(0x1ed)])[_0x59714b(0x20e)]||0x0,_0x8d2dfb=_0x1794a0?.[_0x59714b(0x1ee)](_0x4ead83=>!_0x4ead83[_0x59714b(0x1ed)])['length']||0x0;return a3_0xf06219(Box,{'flexDirection':_0x59714b(0x222),'children':[(_0x45de83||_0xde0a38)&&a3_0xf06219(Box,{'children':[a3_0x1c37f7(Text,{'color':_0x59714b(0x1f0),'children':'*\x20'}),a3_0x1c37f7(Text,{'color':_0x138336?_0x59714b(0x1fc):_0x59714b(0x221),'children':_0x42d049})]}),_0x45de83&&a3_0x1c37f7(Box,{'children':a3_0xf06219(Text,{'children':['🚀\x20',_0x1d0d69,_0x59714b(0x1fe),_0x56cb40,')']})}),_0xde0a38&&_0x1794a0&&a3_0xf06219(Box,{'flexDirection':_0x59714b(0x222),'children':[a3_0x1c37f7(Box,{'children':a3_0xf06219(Text,{'color':_0x59714b(0x225),'children':['√\x20文档生成完成!成功\x20',_0x1698b5,'\x20个',_0x8d2dfb>0x0&&',\x20失败\x20'+_0x8d2dfb+'\x20个']})}),a3_0x1c37f7(Box,{'marginTop':0x1,'children':a3_0xf06219(Text,{'color':'gray','children':[_0x59714b(0x1f3),_0x433334,_0x59714b(0x1fb)]})}),a3_0xf06219(Box,{'marginTop':0x1,'children':[a3_0x1c37f7(Text,{'color':'gray','children':'*\x20输出目录:\x20'}),a3_0x1c37f7(Text,{'color':_0x59714b(0x1f5),'children':_0x434237})]}),_0x1698b5>0x0&&a3_0xf06219(a3_0x3d218a,{'children':[a3_0x1c37f7(Box,{'marginTop':0x1,'children':a3_0x1c37f7(Text,{'color':_0x59714b(0x1f0),'children':_0x59714b(0x21f)})}),_0x1794a0['filter'](_0x4b4f56=>_0x4b4f56['success'])['map']((_0x243e8e,_0x186c6a)=>a3_0xf06219(Box,{'marginLeft':0x2,'children':[a3_0xf06219(Text,{'color':'cyan','children':['•\x20',_0x243e8e['filePath']]}),a3_0xf06219(Text,{'color':'dim','children':[_0x59714b(0x211),_0x243e8e['datasetName']]})]},_0x186c6a))]}),_0x8d2dfb>0x0&&a3_0xf06219(a3_0x3d218a,{'children':[a3_0x1c37f7(Box,{'marginTop':0x1,'children':a3_0x1c37f7(Text,{'color':_0x59714b(0x1f4),'children':_0x59714b(0x20f)})}),_0x1794a0[_0x59714b(0x1ee)](_0x41c82c=>!_0x41c82c[_0x59714b(0x1ed)])[_0x59714b(0x1f9)]((_0x319b2a,_0x158099)=>a3_0xf06219(Box,{'marginLeft':0x2,'flexDirection':_0x59714b(0x222),'children':[a3_0xf06219(Text,{'color':_0x59714b(0x1f1),'children':['•\x20',_0x319b2a[_0x59714b(0x1f8)],'\x20(',_0x319b2a[_0x59714b(0x20a)],')']}),_0x319b2a['error']&&a3_0x1c37f7(Box,{'marginLeft':0x2,'children':a3_0x1c37f7(Text,{'color':_0x59714b(0x221),'children':_0x319b2a[_0x59714b(0x209)]})})]},_0x158099))]})]}),_0x55b4ac&&a3_0xf06219(Box,{'flexDirection':_0x59714b(0x222),'children':[a3_0x1c37f7(Box,{'children':a3_0xf06219(Text,{'color':_0x59714b(0x1f1),'children':['❌\x20',_0x55b4ac]})}),_0x55b4ac[_0x59714b(0x1ff)]('登录')&&a3_0xf06219(Box,{'marginTop':0x1,'children':[a3_0x1c37f7(Text,{'color':_0x59714b(0x1f4),'children':_0x59714b(0x218)}),a3_0x1c37f7(Text,{'color':_0x59714b(0x1f5),'children':_0x59714b(0x1fd)}),a3_0x1c37f7(Text,{'color':_0x59714b(0x1f4),'children':_0x59714b(0x20d)})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a4_0xdae0(_0x1122c8,_0x433b9e){const _0xbca84b=a4_0xbca8();return a4_0xdae0=function(_0xdae06a,_0x1b1495){_0xdae06a=_0xdae06a-0x192;let _0x57e86f=_0xbca84b[_0xdae06a];return _0x57e86f;},a4_0xdae0(_0x1122c8,_0x433b9e);}const a4_0x335c6c=a4_0xdae0;(function(_0x1c6c3c,_0x3985c9){const _0x8aa9ab=a4_0xdae0,_0x5a91c1=_0x1c6c3c();while(!![]){try{const _0x3e559e=parseInt(_0x8aa9ab(0x19d))/0x1*(parseInt(_0x8aa9ab(0x1b5))/0x2)+-parseInt(_0x8aa9ab(0x1b6))/0x3+-parseInt(_0x8aa9ab(0x19b))/0x4*(parseInt(_0x8aa9ab(0x1ad))/0x5)+parseInt(_0x8aa9ab(0x1b7))/0x6*(parseInt(_0x8aa9ab(0x1ae))/0x7)+parseInt(_0x8aa9ab(0x193))/0x8+-parseInt(_0x8aa9ab(0x1a8))/0x9+-parseInt(_0x8aa9ab(0x197))/0xa*(parseInt(_0x8aa9ab(0x1a7))/0xb);if(_0x3e559e===_0x3985c9)break;else _0x5a91c1['push'](_0x5a91c1['shift']());}catch(_0x4bbb6c){_0x5a91c1['push'](_0x5a91c1['shift']());}}}(a4_0xbca8,0x5b3a6));import{mkdirSync,writeFileSync}from'node:fs';import a4_0x271777 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';function a4_0xbca8(){const _0x60f265=['length','utf8','4419856aHCTVx','text','\x0a共有\x20','./docs','8172310kqlXkR','json','等待\x203\x20秒...\x0a','push','4KqRwJb','string','4sEOkeS','):缺少\x20data.markdown\x20字段','.md\x20(','log','join','name','响应数据格式错误\x20(','生成文档成功:\x20','),HTTP状态码:\x20','.md','11fGjnAV','772875OFTTVw','.md\x20-\x20','error','status','message','1078835qPlBFy','602609WuZhIn','stringify','datasetCode','✓\x20成功生成:\x20','/api/node-toolbox/api-doc-generator','markdown',']\x20正在生成:\x20','369596bVhYIU','1205220nMXFXH','42POmzrr','✗\x20失败:\x20','data','tableName','api-doc'];a4_0xbca8=function(){return _0x60f265;};return a4_0xbca8();}export async function fetchDatasetDoc(_0x19cf72){const _0x3d79bf=a4_0xdae0,{appCode:_0xeabf26,datasetCode:_0x28829d,datasetId:_0x2965ce,extraParams:_0x3a5c44}=_0x19cf72,_0x413406=getApiDomain(),_0x441acb=_0x413406+_0x3d79bf(0x1b2),_0x12ce97={'appCode':_0xeabf26,'datasetCode':_0x28829d,'datasetId':_0x2965ce,..._0x3a5c44||{}},_0x533a40=await fetch(_0x441acb,{'method':'POST','headers':{'Content-Type':'application/json','Cookie':getCookie()},'body':JSON[_0x3d79bf(0x1af)](_0x12ce97)});if(!_0x533a40['ok']){if(_0x533a40[_0x3d79bf(0x1ab)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');let _0x4eff97='';try{_0x4eff97=await _0x533a40[_0x3d79bf(0x194)]();}catch(_0x445512){}throw new Error('获取文档失败\x20('+_0x28829d+_0x3d79bf(0x1a5)+_0x533a40[_0x3d79bf(0x1ab)]+(_0x4eff97?'\x0a'+_0x4eff97:''));}const _0x218b4d=await _0x533a40[_0x3d79bf(0x198)]();if(!_0x218b4d[_0x3d79bf(0x1b9)]||typeof _0x218b4d[_0x3d79bf(0x1b9)][_0x3d79bf(0x1b3)]!==_0x3d79bf(0x19c))throw new Error(_0x3d79bf(0x1a3)+_0x28829d+_0x3d79bf(0x19e));return _0x218b4d[_0x3d79bf(0x1b9)][_0x3d79bf(0x1b3)];}function delay(_0x106dce){return new Promise(_0x56d15f=>setTimeout(_0x56d15f,_0x106dce));}export async function generateDatasetDocs(_0x25066d,_0x1eab25,_0x43af55=a4_0x335c6c(0x196),_0x50074d,_0xf52a39){const _0x2da675=a4_0x335c6c;mkdirSync(_0x43af55,{'recursive':!![]});const _0x4e22cd=[],_0x3b2678=_0x25066d[_0x2da675(0x1bc)];console['log'](_0x2da675(0x195)+_0x3b2678+'\x20个数据集需要生成文档\x0a');for(let _0x4f33fe=0x0;_0x4f33fe<_0x25066d['length'];_0x4f33fe++){const _0x23de22=_0x25066d[_0x4f33fe],_0x119cf6=_0x4f33fe+0x1,_0xe04a5c=_0x23de22[_0x2da675(0x1ba)];try{console[_0x2da675(0x1a0)]('['+_0x119cf6+'/'+_0x3b2678+_0x2da675(0x1b4)+_0xe04a5c+_0x2da675(0x19f)+_0x23de22[_0x2da675(0x1a2)]+')');_0x50074d&&_0x50074d(_0x119cf6,_0x3b2678,_0xe04a5c);const _0x238225=await fetchDatasetDoc({'appCode':_0x1eab25,'datasetCode':_0x23de22['datasetCode'],'datasetId':_0x23de22['id'],'enableAI':![],'extraParams':_0xf52a39}),_0xead356=a4_0x271777[_0x2da675(0x1a1)](_0x43af55,_0xe04a5c+_0x2da675(0x1a6));writeFileSync(_0xead356,_0x238225,{'encoding':_0x2da675(0x192)}),console[_0x2da675(0x1a0)](_0x2da675(0x1b1)+_0xe04a5c+_0x2da675(0x1a6)),logger['success'](_0x2da675(0x1bb),_0x2da675(0x1a4)+_0xe04a5c,undefined,{'datasetCode':_0x23de22[_0x2da675(0x1b0)],'datasetName':_0x23de22[_0x2da675(0x1a2)],'filePath':_0xead356,'progress':_0x119cf6+'/'+_0x3b2678}),_0x4e22cd[_0x2da675(0x19a)]({'datasetCode':_0x23de22[_0x2da675(0x1b0)],'datasetName':_0x23de22[_0x2da675(0x1a2)],'filePath':_0xead356,'success':!![]}),_0x119cf6<_0x3b2678&&await delay(0x1388);}catch(_0x2b10f0){const _0xa8405e=_0x2b10f0 instanceof Error?_0x2b10f0[_0x2da675(0x1ac)]:String(_0x2b10f0);console[_0x2da675(0x1a0)](_0x2da675(0x1b8)+_0xe04a5c+_0x2da675(0x1a9)+_0xa8405e+'\x0a'),logger[_0x2da675(0x1aa)]('api-doc','生成文档失败:\x20'+_0x23de22[_0x2da675(0x1b0)],{'datasetCode':_0x23de22[_0x2da675(0x1b0)],'datasetName':_0x23de22[_0x2da675(0x1a2)],'error':_0xa8405e,'progress':_0x119cf6+'/'+_0x3b2678}),_0x4e22cd[_0x2da675(0x19a)]({'datasetCode':_0x23de22[_0x2da675(0x1b0)],'datasetName':_0x23de22[_0x2da675(0x1a2)],'filePath':'','success':![],'error':_0xa8405e}),_0x119cf6<_0x3b2678&&(console[_0x2da675(0x1a0)](_0x2da675(0x199)),await delay(0xbb8));}}return _0x4e22cd;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x17a9da,_0x40468a){const _0x178b4c=a5_0x28e9,_0x2913ce=_0x17a9da();while(!![]){try{const _0xd4ed31=-parseInt(_0x178b4c(0xcb))/0x1+parseInt(_0x178b4c(0xc4))/0x2+-parseInt(_0x178b4c(0xc5))/0x3*(parseInt(_0x178b4c(0xd8))/0x4)+parseInt(_0x178b4c(0xe6))/0x5*(parseInt(_0x178b4c(0xee))/0x6)+parseInt(_0x178b4c(0xef))/0x7*(-parseInt(_0x178b4c(0xcc))/0x8)+-parseInt(_0x178b4c(0xe2))/0x9+-parseInt(_0x178b4c(0xc9))/0xa*(-parseInt(_0x178b4c(0xe5))/0xb);if(_0xd4ed31===_0x40468a)break;else _0x2913ce['push'](_0x2913ce['shift']());}catch(_0x456a2f){_0x2913ce['push'](_0x2913ce['shift']());}}}(a5_0x512e,0xc686c));import{jsx as a5_0x5c109c,jsxs as a5_0x42d720}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a5_0x28e9(_0x1ab334,_0x3804e6){const _0x512e49=a5_0x512e();return a5_0x28e9=function(_0x28e928,_0x21122c){_0x28e928=_0x28e928-0xc0;let _0x36e56b=_0x512e49[_0x28e928];return _0x36e56b;},a5_0x28e9(_0x1ab334,_0x3804e6);}import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a5_0x512e(){const _0x567c58=['dim','-client','length','endsWith','.ts','api-pull','slice','cyan','\x20个模型)','未提供应用AppCode,且配置中也没有默认值','156cHAPWT','💡\x20请使用\x20','gray','\x20from\x20\x27@/','\x20个模型','使用配置的应用AppCode:\x20','includes','red','modelCount','{\x20lovrabetClient\x20}','6026373bKNtgI','originalCount','√\x20成功拉取\x20','126841mKZTsa','1590910LJncPd','duplicateCount','yellow','\x20-\x20客户端实例文件','*\x20导入方式:','online','message','setLogPath','30lMUBDZ','4046CZmykk','datasetCount','env','-\x20模型配置文件\x20(','\x20个数据集,生成','replace','api','column','string','406324lgSLQz','19404MCegtd','join','拉取\x20API\x20配置失败:\x20','\x20个,过滤重复','490eHsWjy','cwd','352418EVzzsB','3760LNoaso','client'];a5_0x512e=function(){return _0x567c58;};return a5_0x512e();}import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x41f691,env:_0x31c160,output:_0x4d67b2})=>{const _0x57edbc=a5_0x28e9,{exit:_0x2e0ca6}=useApp(),[_0x31196d,_0x2e1d5a]=useState(![]),[_0x483258,_0x6e624d]=useState(![]),[_0xe31b9b,_0x1ac963]=useState(null),[_0x276700,_0x49085f]=useState(null),_0x3e0c1c=readConfig(),_0x33f2f4=getConfigAppCode(),_0x3ea7ce=_0x41f691||_0x33f2f4,_0xfece6d=typeof _0x3e0c1c?.['env']===_0x57edbc(0xc3)?_0x3e0c1c[_0x57edbc(0xf1)]:undefined,_0x4e45a9=_0x31c160||_0xfece6d||_0x57edbc(0xeb);initEnv(_0x4e45a9);const _0x350066=_0x4d67b2||'./src/api/',_0x2208f0=_0x41f691&&_0x41f691['includes']('-')?_0x41f691['split']('-')[_0x57edbc(0xd4)](0x1)[_0x57edbc(0xc6)]('-'):'',_0x481aa8=_0x41f691?'使用指定的应用AppCode:\x20'+_0x3ea7ce:_0x57edbc(0xdd)+_0x3ea7ce,_0x327425=_0x2208f0?_0x2208f0+'-api':_0x57edbc(0xc1),_0x190ddf=_0x2208f0?_0x2208f0+_0x57edbc(0xcf):_0x57edbc(0xcd);useEffect(()=>{_0x2e1d5a(!![]),_0x5bdba6();},[]),useEffect(()=>{(_0x483258||_0xe31b9b)&&_0x2e0ca6();},[_0x483258,_0xe31b9b,_0x2e0ca6]);async function _0x5bdba6(){const _0x69a64d=_0x57edbc;if(!_0x3ea7ce){_0x1ac963(_0x69a64d(0xd7));return;}try{logger[_0x69a64d(0xed)](process[_0x69a64d(0xca)]());const {configArray:_0x51869b}=await fetchModelList(_0x3ea7ce),_0x4f332f=_0x51869b[_0x69a64d(0xd0)],_0x14affc=!_0x41f691,_0x30ef45=await generateApiFile(_0x51869b,_0x2208f0,_0x3ea7ce,_0x14affc,_0x4e45a9,_0x350066),_0x2827ef=_0x350066[_0x69a64d(0xd1)]('/')?_0x350066:_0x350066+'/';_0x49085f({'api':''+_0x2827ef+_0x327425+'.ts','client':''+_0x2827ef+_0x190ddf+_0x69a64d(0xd2),'modelCount':_0x30ef45[_0x69a64d(0xe0)],'datasetCount':_0x4f332f,'originalCount':_0x4f332f,'duplicateCount':0x0}),_0x6e624d(!![]);}catch(_0x5ea1e5){const _0x431195=_0x5ea1e5 instanceof Error?_0x5ea1e5[_0x69a64d(0xec)]:String(_0x5ea1e5);logger['error'](_0x69a64d(0xd3),_0x69a64d(0xc7)+_0x431195,{'appCode':_0x3ea7ce,'error':_0x431195}),_0x1ac963(_0x69a64d(0xc7)+_0x431195);}finally{_0x2e1d5a(![]);}}return a5_0x42d720(Box,{'flexDirection':'column','children':[(_0x31196d||_0x483258)&&a5_0x42d720(Box,{'children':[a5_0x5c109c(Text,{'color':_0x57edbc(0xda),'children':'*\x20'}),a5_0x5c109c(Text,{'color':_0x41f691?'white':_0x57edbc(0xce),'children':_0x481aa8})]}),_0x31196d&&a5_0x5c109c(Box,{'children':a5_0x42d720(Text,{'children':['🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20',_0x4e45a9,')']})}),_0x483258&&_0x276700&&a5_0x42d720(Box,{'flexDirection':_0x57edbc(0xc2),'children':[a5_0x5c109c(Box,{'children':a5_0x42d720(Text,{'color':'green','children':[_0x57edbc(0xe4),_0x276700[_0x57edbc(0xf0)],_0x57edbc(0xf3),'\x20',_0x276700[_0x57edbc(0xe0)],_0x57edbc(0xdc)]})}),_0x276700[_0x57edbc(0xe7)]>0x0&&a5_0x5c109c(Box,{'marginTop':0x1,'children':a5_0x42d720(Text,{'color':_0x57edbc(0xe8),'children':['!\x20原始数据集\x20',_0x276700[_0x57edbc(0xe3)],_0x57edbc(0xc8),'\x20',_0x276700[_0x57edbc(0xe7)],'\x20个']})}),a5_0x5c109c(Box,{'marginTop':0x1,'children':a5_0x5c109c(Text,{'color':_0x57edbc(0xda),'children':'*\x20已生成文件:'})}),a5_0x42d720(Box,{'marginLeft':0x2,'children':[a5_0x42d720(Text,{'color':_0x57edbc(0xd5),'children':['•\x20',_0x276700[_0x57edbc(0xc1)]]}),a5_0x42d720(Text,{'color':'dim','children':['\x20',_0x57edbc(0xf2),_0x276700[_0x57edbc(0xe0)],_0x57edbc(0xd6)]})]}),a5_0x42d720(Box,{'marginLeft':0x2,'children':[a5_0x42d720(Text,{'color':_0x57edbc(0xd5),'children':['•\x20',_0x276700['client']]}),a5_0x5c109c(Text,{'color':_0x57edbc(0xce),'children':_0x57edbc(0xe9)})]}),a5_0x5c109c(Box,{'marginTop':0x1,'children':a5_0x5c109c(Text,{'color':'gray','children':_0x57edbc(0xea)})}),a5_0x5c109c(Box,{'marginLeft':0x2,'children':a5_0x42d720(Text,{'color':_0x57edbc(0xe8),'children':['import\x20',_0x57edbc(0xe1),_0x57edbc(0xdb),_0x276700[_0x57edbc(0xcd)][_0x57edbc(0xc0)](/^\.\//,'')['replace'](_0x57edbc(0xd2),''),'\x27']})})]}),_0xe31b9b&&a5_0x42d720(Box,{'flexDirection':_0x57edbc(0xc2),'children':[a5_0x5c109c(Box,{'children':a5_0x42d720(Text,{'color':_0x57edbc(0xdf),'children':['❌\x20',_0xe31b9b]})}),_0xe31b9b[_0x57edbc(0xde)]('登录')&&a5_0x42d720(Box,{'marginTop':0x1,'children':[a5_0x5c109c(Text,{'color':_0x57edbc(0xe8),'children':_0x57edbc(0xd9)}),a5_0x5c109c(Text,{'color':_0x57edbc(0xd5),'children':'lovrabet\x20auth'}),a5_0x5c109c(Text,{'color':_0x57edbc(0xe8),'children':'\x20重新登录后再试'})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x50806f,_0xe59403){const _0x2a7870=a6_0x4e30,_0x574bc3=_0x50806f();while(!![]){try{const _0x5bdf0a=parseInt(_0x2a7870(0xfb))/0x1+-parseInt(_0x2a7870(0x108))/0x2*(parseInt(_0x2a7870(0x10c))/0x3)+parseInt(_0x2a7870(0x107))/0x4+-parseInt(_0x2a7870(0xf9))/0x5+parseInt(_0x2a7870(0xfa))/0x6*(parseInt(_0x2a7870(0xfe))/0x7)+parseInt(_0x2a7870(0xff))/0x8*(parseInt(_0x2a7870(0x10b))/0x9)+-parseInt(_0x2a7870(0x105))/0xa*(parseInt(_0x2a7870(0xf8))/0xb);if(_0x5bdf0a===_0xe59403)break;else _0x574bc3['push'](_0x574bc3['shift']());}catch(_0x42785b){_0x574bc3['push'](_0x574bc3['shift']());}}}(a6_0x3a71,0x6cd13));import{getCookie}from'../auth/get-cookie.js';function a6_0x3a71(){const _0x5bfad4=['获取数据集失败,HTTP状态码:\x20','success','9gVbpYr','12QWrCDj','message','获取数据集失败:\x20','110yQGZgI','1176335qLUraF','1313112pBLvlh','631602VmMTHR','fetch-model-list','configArray','21Brdddt','1070584ogSMnF','json','info','未知错误','正在从服务器拉取模型列表...\x20(环境:\x20','&otype=array','730770txnvCv','status','1335500Quehuw','172052pOLeAB'];a6_0x3a71=function(){return _0x5bfad4;};return a6_0x3a71();}import{getApiDomain}from'../constant/domain.js';function a6_0x4e30(_0x356667,_0x5468b5){const _0x3a713e=a6_0x3a71();return a6_0x4e30=function(_0x4e30bb,_0x4c7ead){_0x4e30bb=_0x4e30bb-0xf6;let _0x3d1f71=_0x3a713e[_0x4e30bb];return _0x3d1f71;},a6_0x4e30(_0x356667,_0x5468b5);}import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';export async function fetchModelList(_0x431338){const _0x32bd85=a6_0x4e30,_0x2cb897=getEnv(),_0x52862d=getApiDomain()+'/api/node-toolbox/dataset/model-list?appcode='+_0x431338+_0x32bd85(0x104);logger[_0x32bd85(0x101)](_0x32bd85(0xfc),_0x32bd85(0x103)+_0x2cb897+')',{'apiUrl':_0x52862d});const _0x1e20ee=await fetch(_0x52862d,{'headers':{'Cookie':getCookie()}});if(!_0x1e20ee['ok']){if(_0x1e20ee[_0x32bd85(0x106)]===0x191)throw new Error('登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录');throw new Error(_0x32bd85(0x109)+_0x1e20ee[_0x32bd85(0x106)]);}const _0x4b88b3=await _0x1e20ee[_0x32bd85(0x100)]();if(!_0x4b88b3[_0x32bd85(0x10a)])throw new Error(_0x32bd85(0xf7)+(_0x4b88b3[_0x32bd85(0xf6)]||_0x32bd85(0x102)));return{'configArray':_0x4b88b3['data'][_0x32bd85(0xfd)],'count':_0x4b88b3['data']['count']};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a7_0x220f48=a7_0x1065;(function(_0x51c8f2,_0x5ae7ea){const _0x48a5b8=a7_0x1065,_0x2064d7=_0x51c8f2();while(!![]){try{const _0x43ea4f=parseInt(_0x48a5b8(0x1ab))/0x1*(-parseInt(_0x48a5b8(0x18b))/0x2)+parseInt(_0x48a5b8(0x18a))/0x3*(-parseInt(_0x48a5b8(0x1af))/0x4)+parseInt(_0x48a5b8(0x18e))/0x5+-parseInt(_0x48a5b8(0x1a4))/0x6*(parseInt(_0x48a5b8(0x1b0))/0x7)+parseInt(_0x48a5b8(0x1b1))/0x8+-parseInt(_0x48a5b8(0x199))/0x9+-parseInt(_0x48a5b8(0x192))/0xa*(-parseInt(_0x48a5b8(0x197))/0xb);if(_0x43ea4f===_0x5ae7ea)break;else _0x2064d7['push'](_0x2064d7['shift']());}catch(_0x1c78af){_0x2064d7['push'](_0x2064d7['shift']());}}}(a7_0x3a03,0x88d5d));import a7_0x29eb76 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a7_0xa5c04b from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';function a7_0x3a03(){const _0x19e8de=['-client','string','url','online','resolve','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','dirname','format','6CefEtz','CONFIG_NAMES.DEFAULT','join','slice','{\x20apiConfigName:\x20\x22','datasetCode','keys','241497kvQQZx','replaceApiContent','success','length','615596YbyTRx','171115sKPxQQ','8102528MabYnN','api.ts.tpl','init-api','forEach','client','endsWith','typescript','env','21NcDGfJ','4WVPqYc','./src/api/','{\x20apiConfigName:\x20','1523980uEKIBG','../..','name','API\x20文件生成成功!','13200630uVzEFC','client.ts.tpl','utf8','app','api','11pAzLQD',',\x20env:\x20\x22','4432194qkFjoE','\x22\x20}','templates/generate-api'];a7_0x3a03=function(){return _0x19e8de;};return a7_0x3a03();}import{TemplateReplacer}from'../utils/template-replacer.js';function a7_0x1065(_0x379bee,_0x5ea6d9){const _0x3a0371=a7_0x3a03();return a7_0x1065=function(_0x106596,_0x542058){_0x106596=_0x106596-0x183;let _0x509447=_0x3a0371[_0x106596];return _0x509447;},a7_0x1065(_0x379bee,_0x5ea6d9);}import{logger}from'../utils/logger.js';export async function generateApiFile(_0x276748,_0x384a4c='',_0x2eade8,_0x383785=![],_0x1516aa,_0x5e26df=a7_0x220f48(0x18c)){const _0x2ddb7f=a7_0x220f48,_0x513709=readConfig(),_0x5641a0=_0x2eade8||_0x513709?.[_0x2ddb7f(0x195)];if(typeof _0x5641a0!==_0x2ddb7f(0x19d)||!_0x5641a0)throw new Error(_0x2ddb7f(0x1a1));const _0x42f48b=_0x383785?_0x2ddb7f(0x1a5):'\x22'+_0x5641a0+'\x22',_0x593d08=typeof _0x513709[_0x2ddb7f(0x189)]===_0x2ddb7f(0x19d)?_0x513709['env']:undefined,_0x385117=_0x1516aa||_0x593d08||'online',_0x3be211=_0x385117!==_0x2ddb7f(0x19f);let _0xaee83f;if(_0x383785)_0x3be211?_0xaee83f=_0x2ddb7f(0x18d)+_0x42f48b+_0x2ddb7f(0x198)+_0x385117+_0x2ddb7f(0x19a):_0xaee83f='';else{const _0x32176d=_0x3be211?_0x2ddb7f(0x198)+_0x385117+'\x22':'';_0xaee83f=_0x2ddb7f(0x1a8)+_0x5641a0+'\x22'+_0x32176d+'\x20}';}const _0x57750d=_0x384a4c?_0x384a4c+'-api':_0x2ddb7f(0x196),_0x1437f0=_0x384a4c?_0x384a4c+_0x2ddb7f(0x19c):_0x2ddb7f(0x186),_0x1798c5={};_0x276748[_0x2ddb7f(0x185)](_0x3b5ec5=>{const _0x4e1734=_0x2ddb7f;_0x1798c5[_0x3b5ec5['key']]={'tableName':_0x3b5ec5['tableName'],'datasetCode':_0x3b5ec5[_0x4e1734(0x1a9)],'name':_0x3b5ec5[_0x4e1734(0x190)]||''};});const _0x32fa42=fileURLToPath(import.meta[_0x2ddb7f(0x19e)]),_0x3f5367=a7_0xa5c04b[_0x2ddb7f(0x1a0)](a7_0xa5c04b[_0x2ddb7f(0x1a2)](_0x32fa42),_0x2ddb7f(0x18f)),_0x5b8bd2=a7_0xa5c04b['join'](_0x3f5367,_0x2ddb7f(0x19b)),_0x8f8b6c=a7_0xa5c04b['join'](_0x5b8bd2,_0x2ddb7f(0x183)),_0x41b208=a7_0xa5c04b[_0x2ddb7f(0x1a6)](_0x5b8bd2,_0x2ddb7f(0x193)),_0x365364=_0x5e26df[_0x2ddb7f(0x187)]('/')?_0x5e26df[_0x2ddb7f(0x1a7)](0x0,-0x1):_0x5e26df;mkdirSync(_0x365364,{'recursive':!![]});const _0x466f2a=readFileSync(_0x8f8b6c,_0x2ddb7f(0x194)),_0x1beeb4=TemplateReplacer['replaceApiContent'](_0x466f2a,_0x5641a0,_0x1798c5,Object[_0x2ddb7f(0x1aa)](_0x1798c5)[0x0],_0x57750d,_0x42f48b),_0x565584=await a7_0x29eb76[_0x2ddb7f(0x1a3)](_0x1beeb4,{'parser':_0x2ddb7f(0x188)}),_0x59fdd3=_0x365364+'/'+_0x57750d+'.ts';writeFileSync(_0x59fdd3,_0x565584,{'encoding':_0x2ddb7f(0x194)});const _0x1cf328=readFileSync(_0x41b208,_0x2ddb7f(0x194)),_0x4ca7b6=TemplateReplacer[_0x2ddb7f(0x1ac)](_0x1cf328,_0x5641a0,_0x1798c5,Object[_0x2ddb7f(0x1aa)](_0x1798c5)[0x0],_0x57750d,_0x42f48b,_0xaee83f),_0x5bcbd5=await a7_0x29eb76[_0x2ddb7f(0x1a3)](_0x4ca7b6,{'parser':_0x2ddb7f(0x188)}),_0x3af466=_0x365364+'/'+_0x1437f0+'.ts';writeFileSync(_0x3af466,_0x5bcbd5,{'encoding':'utf8'});const _0x26f0f3=Object['keys'](_0x1798c5)[_0x2ddb7f(0x1ae)];return logger[_0x2ddb7f(0x1ad)](_0x2ddb7f(0x184),_0x2ddb7f(0x191),undefined,{'apiFile':_0x59fdd3,'clientFile':_0x3af466,'modelCount':_0x26f0f3,'configName':_0x42f48b}),{'modelCount':_0x26f0f3,'apiFilePath':_0x59fdd3,'clientFilePath':_0x3af466,'configName':_0x42f48b};}
|
package/lib/api/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x16f4c6,_0x278b17){const _0x124172=a8_0x12f7,_0x4cf66b=_0x16f4c6();while(!![]){try{const _0x2ef18a=-parseInt(_0x124172(0xe2))/0x1+parseInt(_0x124172(0xf2))/0x2+-parseInt(_0x124172(0xd2))/0x3+parseInt(_0x124172(0xc9))/0x4+-parseInt(_0x124172(0xc6))/0x5+-parseInt(_0x124172(0xcb))/0x6+parseInt(_0x124172(0xc0))/0x7;if(_0x2ef18a===_0x278b17)break;else _0x4cf66b['push'](_0x4cf66b['shift']());}catch(_0x35e9c7){_0x4cf66b['push'](_0x4cf66b['shift']());}}}(a8_0x1bea,0x2c3c2));import{jsx as a8_0x509f3d}from'react/jsx-runtime';function a8_0x1bea(){const _0x53cdb5=['\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','609932DTLRRv','env','832194ypEytd','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','message','error','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','parse','\x1b[90m*\x20使用配置的应用AppCode:\x20','288204wADWkc','appcode','help','\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文档','exit','\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配置文件','pull','map','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','log','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','datasetcode','\x1b[90m*\x20仅生成指定数据集的文档:\x20','!\x20请使用以下方式之一:','×\x20--datasetcode\x20参数不能为空','1145ulpYGk','Available\x20commands:','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','input','split','object','×\x20--params\x20参数不是有效的\x20JSON\x20格式','×\x20未配置\x20AppCode','params','请使用\x20--appcode\x20参数,例如:','flags','\x20\x20错误:\x20','length','output','join','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','240266fnCqZI','1028685jogERx','\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错误:不再支持位置参数方式','filter','Unknown\x20api\x20command:\x20','\x1b[0m','12365cDANCO','string'];a8_0x1bea=function(){return _0x53cdb5;};return a8_0x1bea();}import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';function a8_0x12f7(_0x5a095b,_0x12111a){const _0x1beacf=a8_0x1bea();return a8_0x12f7=function(_0x12f7dc,_0x28dc29){_0x12f7dc=_0x12f7dc-0xc0;let _0x35220c=_0x1beacf[_0x12f7dc];return _0x35220c;},a8_0x12f7(_0x5a095b,_0x12111a);}import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';export async function apiCli(_0x47eae6){const _0x4c90f2=a8_0x12f7,_0xd75b31=_0x47eae6[_0x4c90f2(0xe5)][0x1];if(_0x47eae6[_0x4c90f2(0xec)][_0x4c90f2(0xd4)]){console[_0x4c90f2(0xdb)](_0x4c90f2(0xc1));return;}if(_0xd75b31===_0x4c90f2(0xd8)){_0x47eae6[_0x4c90f2(0xe5)][0x2]&&(console[_0x4c90f2(0xce)](_0x4c90f2(0xc2)),console[_0x4c90f2(0xdb)](_0x4c90f2(0xeb)),console[_0x4c90f2(0xdb)](_0x4c90f2(0xdd)+_0x47eae6[_0x4c90f2(0xe5)][0x2]),process['exit'](0x1));const _0x5a279d=getConfigAppCode();let _0x31f19d=_0x47eae6[_0x4c90f2(0xec)][_0x4c90f2(0xd3)];const _0x422006=typeof _0x47eae6['flags'][_0x4c90f2(0xca)]===_0x4c90f2(0xc7)?_0x47eae6[_0x4c90f2(0xec)][_0x4c90f2(0xca)]:undefined,_0x4154a0=_0x47eae6[_0x4c90f2(0xec)]['output'];!_0x31f19d&&!_0x5a279d&&(console[_0x4c90f2(0xce)](_0x4c90f2(0xe9)),console['log'](_0x4c90f2(0xe0)),console['log'](_0x4c90f2(0xda)),console['log']('\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>'),process[_0x4c90f2(0xd6)](0x1)),_0x31f19d&&_0x5a279d&&_0x31f19d===_0x5a279d&&(console['log'](_0x4c90f2(0xd1)+_0x31f19d+_0x4c90f2(0xc5)),console['log']('\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m'),_0x31f19d=undefined),render(a8_0x509f3d(ApiPullUI,{'appCode':_0x31f19d,'env':_0x422006,'output':_0x4154a0}));}else{if(_0xd75b31==='doc'){_0x47eae6[_0x4c90f2(0xe5)][0x2]&&(console[_0x4c90f2(0xce)](_0x4c90f2(0xc2)),console['log'](_0x4c90f2(0xeb)),console['log'](_0x4c90f2(0xf1)+_0x47eae6['input'][0x2]),process[_0x4c90f2(0xd6)](0x1));const _0x2a5630=getConfigAppCode();let _0x3edd36=_0x47eae6[_0x4c90f2(0xec)][_0x4c90f2(0xd3)];const _0x1405a3=typeof _0x47eae6['flags'][_0x4c90f2(0xca)]==='string'?_0x47eae6[_0x4c90f2(0xec)]['env']:undefined,_0x4ec428=_0x47eae6[_0x4c90f2(0xec)][_0x4c90f2(0xef)],_0x436105=_0x47eae6['flags'][_0x4c90f2(0xea)],_0x5a56f7=_0x47eae6['flags'][_0x4c90f2(0xde)];!_0x3edd36&&!_0x2a5630&&(console[_0x4c90f2(0xce)](_0x4c90f2(0xe9)),console['log'](_0x4c90f2(0xe0)),console[_0x4c90f2(0xdb)](_0x4c90f2(0xda)),console['log'](_0x4c90f2(0xe4)),process[_0x4c90f2(0xd6)](0x1));_0x3edd36&&_0x2a5630&&_0x3edd36===_0x2a5630&&(console[_0x4c90f2(0xdb)](_0x4c90f2(0xd1)+_0x3edd36+'\x1b[0m'),_0x3edd36=undefined);let _0x3bd3ef;if(_0x436105)try{_0x3bd3ef=JSON[_0x4c90f2(0xd0)](_0x436105),(typeof _0x3bd3ef!==_0x4c90f2(0xe7)||_0x3bd3ef===null||Array['isArray'](_0x3bd3ef))&&(console[_0x4c90f2(0xce)]('×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象'),process[_0x4c90f2(0xd6)](0x1));}catch(_0x3adebd){console[_0x4c90f2(0xce)](_0x4c90f2(0xe8)),console[_0x4c90f2(0xce)](_0x4c90f2(0xed)+(_0x3adebd instanceof Error?_0x3adebd[_0x4c90f2(0xcd)]:String(_0x3adebd))),process[_0x4c90f2(0xd6)](0x1);}let _0x41cc6e;_0x5a56f7&&(_0x41cc6e=_0x5a56f7[_0x4c90f2(0xe6)](',')[_0x4c90f2(0xd9)](_0x57b8fe=>_0x57b8fe['trim']())[_0x4c90f2(0xc3)](_0x2e0bfd=>_0x2e0bfd['length']>0x0),_0x41cc6e[_0x4c90f2(0xee)]===0x0&&(console[_0x4c90f2(0xce)](_0x4c90f2(0xe1)),process[_0x4c90f2(0xd6)](0x1)),console['log'](_0x4c90f2(0xdf)+_0x41cc6e[_0x4c90f2(0xf0)](',\x20')+_0x4c90f2(0xc5))),render(a8_0x509f3d(ApiDocUI,{'appCode':_0x3edd36,'env':_0x1405a3,'output':_0x4ec428,'extraParams':_0x3bd3ef,'datasetCodes':_0x41cc6e}));}else console['error'](_0x4c90f2(0xc4)+_0xd75b31),console[_0x4c90f2(0xdb)](_0x4c90f2(0xe3)),console[_0x4c90f2(0xdb)](_0x4c90f2(0xd7)),console[_0x4c90f2(0xdb)](_0x4c90f2(0xcc)),console[_0x4c90f2(0xdb)]('\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)'),console[_0x4c90f2(0xdb)](_0x4c90f2(0xc8)),console[_0x4c90f2(0xdb)](''),console['log'](_0x4c90f2(0xd5)),console[_0x4c90f2(0xdb)](_0x4c90f2(0xcf)),console[_0x4c90f2(0xdb)](_0x4c90f2(0xdc)),console[_0x4c90f2(0xdb)]('\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),process[_0x4c90f2(0xd6)](0x1);}}
|
package/lib/api/pull-silent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a9_0x4be6(){const _0x4175a8=['996kcuACs','\x20个数据集,生成\x20','client','test','chdir','online','17182055xEOfVu','×\x20文件前缀格式不正确。只能包含字母、数字、连字符和下划线,且必须以字母开头。','√\x20成功拉取\x20','5166190wzxvWV','log','12welOZj','cwd','\x20\x20\x20•\x20','trim','-api','api','14npIcAO','length','string','2765565lmVwLm','2117052kApNRD','1061NxUMqA','*\x20正在处理\x20','error','.ts\x20-\x20模型配置文件','-client','6quousK','\x20个数据集...','1251534kbSEMh','*\x20开始生成\x20API\x20配置文件:','2634408GoOjMm','.ts\x20-\x20客户端实例文件','×\x20API\x20配置拉取异常:','env','5gzMufO','create-api-pull'];a9_0x4be6=function(){return _0x4175a8;};return a9_0x4be6();}(function(_0x5b645c,_0x3ca5f3){const _0x327492=a9_0xc3ef,_0x11954d=_0x5b645c();while(!![]){try{const _0x8521c5=-parseInt(_0x327492(0xe1))/0x1*(parseInt(_0x327492(0xf0))/0x2)+parseInt(_0x327492(0xe6))/0x3*(-parseInt(_0x327492(0x105))/0x4)+-parseInt(_0x327492(0xee))/0x5*(-parseInt(_0x327492(0xe8))/0x6)+parseInt(_0x327492(0x101))/0x7*(parseInt(_0x327492(0xea))/0x8)+parseInt(_0x327492(0x104))/0x9+-parseInt(_0x327492(0xf9))/0xa+parseInt(_0x327492(0xf6))/0xb*(parseInt(_0x327492(0xfb))/0xc);if(_0x8521c5===_0x3ca5f3)break;else _0x11954d['push'](_0x11954d['shift']());}catch(_0x28991f){_0x11954d['push'](_0x11954d['shift']());}}}(a9_0x4be6,0x9a87e));import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';function a9_0xc3ef(_0x26486e,_0x5c8521){const _0x4be6da=a9_0x4be6();return a9_0xc3ef=function(_0xc3eff,_0xee20c5){_0xc3eff=_0xc3eff-0xe1;let _0x3918c3=_0x4be6da[_0xc3eff];return _0x3918c3;},a9_0xc3ef(_0x26486e,_0x5c8521);}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export async function pullApiSilent(_0x242168,_0x2b0b21,_0x20041,_0x4cbe2c){const _0x502035=a9_0xc3ef;let _0x2a8818;try{const _0x4f1145=_0x2b0b21?.[_0x502035(0xfe)]()||'';if(_0x4f1145){const _0x30f305=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x30f305[_0x502035(0xf3)](_0x4f1145))return console[_0x502035(0xe3)](_0x502035(0xf7)),![];}_0x20041&&(_0x2a8818=process[_0x502035(0xfc)](),process['chdir'](_0x20041));const _0x1513b8=readConfig(),_0x204904=typeof _0x1513b8[_0x502035(0xed)]===_0x502035(0x103)?_0x1513b8[_0x502035(0xed)]:undefined,_0x28cfd5=_0x4cbe2c||_0x204904||_0x502035(0xf5);initEnv(_0x28cfd5),console[_0x502035(0xfa)]('*\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20'+_0x28cfd5+')');const {configArray:_0x4ead31}=await fetchModelList(_0x242168),_0x257455=_0x4f1145?_0x4f1145+_0x502035(0xff):_0x502035(0x100),_0x5d9d3b=_0x4f1145?_0x4f1145+_0x502035(0xe5):_0x502035(0xf2);console[_0x502035(0xfa)](_0x502035(0xe9)),console[_0x502035(0xfa)](_0x502035(0xfd)+_0x257455+_0x502035(0xe4)),console[_0x502035(0xfa)](_0x502035(0xfd)+_0x5d9d3b+_0x502035(0xeb)),console[_0x502035(0xfa)](_0x502035(0xe2)+_0x4ead31[_0x502035(0x102)]+_0x502035(0xe7));const _0x553e1b=await generateApiFile(_0x4ead31,_0x4f1145,_0x242168,!![],_0x28cfd5);return console['log'](_0x502035(0xf8)+_0x4ead31[_0x502035(0x102)]+_0x502035(0xf1)+_0x553e1b['modelCount']+'\x20个模型'),_0x20041&&logger['info'](_0x502035(0xef),'API\x20配置拉取成功:\x20'+_0x242168,{'projectPath':_0x20041,'appCode':_0x242168,'datasetCount':_0x4ead31[_0x502035(0x102)],'filePrefix':_0x4f1145}),!![];}catch(_0x5182cb){const _0x1195ac=_0x5182cb instanceof Error?_0x5182cb['message']:String(_0x5182cb);return console[_0x502035(0xe3)](_0x502035(0xec),_0x1195ac),_0x20041&&logger['error'](_0x502035(0xef),'API\x20配置拉取异常:\x20'+_0x1195ac,{'appCode':_0x242168,'projectPath':_0x20041}),![];}finally{_0x2a8818&&process[_0x502035(0xf4)](_0x2a8818);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function a10_0xf4f3(_0x2b3f98,_0x1b43cf){const _0x61037b=a10_0x6103();return a10_0xf4f3=function(_0xf4f3a,_0x821423){_0xf4f3a=_0xf4f3a-0x148;let _0x1685c0=_0x61037b[_0xf4f3a];return _0x1685c0;},a10_0xf4f3(_0x2b3f98,_0x1b43cf);}(function(_0x4fbd35,_0x256672){const _0x51d5e4=a10_0xf4f3,_0x1af409=_0x4fbd35();while(!![]){try{const _0x5de459=-parseInt(_0x51d5e4(0x15a))/0x1*(parseInt(_0x51d5e4(0x14f))/0x2)+-parseInt(_0x51d5e4(0x169))/0x3+parseInt(_0x51d5e4(0x17b))/0x4*(parseInt(_0x51d5e4(0x178))/0x5)+parseInt(_0x51d5e4(0x16b))/0x6*(parseInt(_0x51d5e4(0x172))/0x7)+parseInt(_0x51d5e4(0x171))/0x8+parseInt(_0x51d5e4(0x170))/0x9*(parseInt(_0x51d5e4(0x189))/0xa)+parseInt(_0x51d5e4(0x154))/0xb;if(_0x5de459===_0x256672)break;else _0x1af409['push'](_0x1af409['shift']());}catch(_0x2fa4ac){_0x1af409['push'](_0x1af409['shift']());}}}(a10_0x6103,0x23f36));import{jsx as a10_0x4da0a5,jsxs as a10_0x4b3517,Fragment as a10_0x2fce08}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a10_0x5af0a7 from'ink-spinner';import{useGetOnlineMenuList}from'./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_0x4da0a5(AppMenuSyncUI,{}));function a10_0x6103(){const _0x2395ba=['\x20输入项目的\x20CSS\x20资源链接(https://...)','提示:使用\x20','CSS\x20链接','\x20正在获取线上菜单列表...','selecting','已选择菜单','cyan','column','return','854865IgXxDC','\x20输入项目的\x20JS\x20资源链接(https://...)','138jgjGvS','has','online','input-js','gray','1899KFpARi','1464008YJhYGz','23191buciBV','join','请至少选择一个菜单','then','trim','*\x20同步菜单到\x20Lovrabet\x20平台','10mJcvej','请输入有效的\x20CSS\x20https\x20链接','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认','15172xsUgEE','path','test','red','value','dots','*\x20正在创建菜单...','green','\x20←\x20','creating','map','*\x20请选择要同步的菜单:','label','max','7430UDIacd','local','input-css','[✓]','white','请输入有效的\x20JS\x20https\x20链接','*\x20CSS\x20链接:\x20','!\x20未找到本地页面,请先创建页面','includes','backspace','fill','菜单名称','lovrabet\x20auth','[\x20]','catch','16GJTTYd','创建菜单失败','message','*\x20JS\x20链接:\x20','done','1231846XoLLlA','delete','yellow','√\x20菜单创建完成','length','add','12917KLPEYP','slice','blue','filter','downArrow','size'];a10_0x6103=function(){return _0x2395ba;};return a10_0x6103();}export function AppMenuSyncUI(){const _0x35bcde=a10_0xf4f3,{exit:_0x547f6e}=useApp(),{loading:_0x505269,menuList:_0x31bf04,error:_0x10abe3}=useGetOnlineMenuList(),_0x156199=getLocalPages(),_0x2b7843=_0x31bf04['map'](_0xc135b5=>_0xc135b5['path']),_0x3c8587=[_0x35bcde(0x14b),..._0x156199['map'](_0x2c92d2=>_0x2c92d2['label'])],_0x4f72d0=getStringWidth(getMaxWidth(_0x3c8587,0x4)),_0x1e4dbc=getStringWidth(getMaxWidth([_0x35bcde(0x14b)])),[_0x11b275,_0xbe8ec6]=useState(_0x35bcde(0x164)),[_0x49f419,_0x475f59]=useState(new Set()),[_0x5c3a86,_0x13337e]=useState(0x0),[_0x95ad9e,_0x1cd770]=useState(''),[_0x30d1ac,_0x335b10]=useState(''),[_0x289ef7,_0x5b1547]=useState(''),[_0x309aeb,_0x3138bc]=useState(''),[_0x51b42c,_0xbb7f31]=useState([]),_0x1d5a13=_0x156199[_0x35bcde(0x185)](_0x166339=>({'label':_0x166339[_0x35bcde(0x187)],'path':_0x166339['path'],'local':!![],'online':_0x2b7843['includes'](_0x166339[_0x35bcde(0x17c)])})),_0xdaed31=_0x156199['filter'](_0x54f55d=>{const _0x165052=_0x35bcde;return!_0x2b7843[_0x165052(0x148)](_0x54f55d[_0x165052(0x17c)]);});useEffect(()=>{const _0x23ed13=_0x35bcde;if(!_0x505269&&_0x156199['length']>0x0&&_0x49f419[_0x23ed13(0x15f)]===0x0){const _0x59a68b=new Set(_0x156199[_0x23ed13(0x185)]((_0x1a0de5,_0x1c0a9f)=>({'page':_0x1a0de5,'index':_0x1c0a9f}))[_0x23ed13(0x15d)](({page:_0x1e08e9})=>!_0x2b7843[_0x23ed13(0x148)](_0x1e08e9[_0x23ed13(0x17c)]))[_0x23ed13(0x185)](({index:_0x4adb88})=>_0x4adb88));_0x475f59(_0x59a68b);}},[_0x505269,_0x156199[_0x35bcde(0x158)],_0x2b7843['length']]),useInput(async(_0x4f8f37,_0x2189a7)=>{const _0x367d44=_0x35bcde;if(_0x11b275===_0x367d44(0x164)){if(_0x2189a7['upArrow']){_0x13337e(_0x598d59=>_0x598d59>0x0?_0x598d59-0x1:_0x156199[_0x367d44(0x158)]-0x1);return;}if(_0x2189a7[_0x367d44(0x15e)]){_0x13337e(_0x5d9c3a=>_0x5d9c3a<_0x156199['length']-0x1?_0x5d9c3a+0x1:0x0);return;}if(_0x4f8f37==='\x20'){_0x475f59(_0x4fc3d3=>{const _0x5c1a28=_0x367d44,_0x4519c0=new Set(_0x4fc3d3);return _0x4519c0['has'](_0x5c3a86)?_0x4519c0['delete'](_0x5c3a86):_0x4519c0[_0x5c1a28(0x159)](_0x5c3a86),_0x4519c0;});return;}if(_0x4f8f37==='a'||_0x4f8f37==='A'){const _0x108d43=new Set(_0x156199['map']((_0x3daaea,_0x585b6c)=>_0x585b6c));_0x475f59(_0x108d43);return;}if(_0x4f8f37==='i'||_0x4f8f37==='I'||_0x4f8f37==='r'||_0x4f8f37==='R'){_0x475f59(_0x5d2f75=>{const _0x1fe56e=_0x367d44,_0x212422=new Set();for(let _0x565853=0x0;_0x565853<_0x156199['length'];_0x565853++){!_0x5d2f75[_0x1fe56e(0x16c)](_0x565853)&&_0x212422[_0x1fe56e(0x159)](_0x565853);}return _0x212422;});return;}if(_0x4f8f37==='q'||_0x4f8f37==='Q'){_0x547f6e();return;}if(_0x2189a7['return']){if(_0x49f419[_0x367d44(0x15f)]===0x0){_0x3138bc(_0x367d44(0x174));return;}const _0x2606fc=_0x156199[_0x367d44(0x15d)]((_0x2682f8,_0x3dc0e4)=>_0x49f419[_0x367d44(0x16c)](_0x3dc0e4)),_0x19e5b9=_0x2606fc['map'](_0x7a5652=>_0x7a5652['label'])[_0x367d44(0x173)](',\x20');_0xbb7f31([{'label':_0x367d44(0x165),'value':_0x49f419[_0x367d44(0x15f)]+'\x20个'}]),_0x3138bc(''),_0xbe8ec6('input-js');return;}return;}if(_0x11b275==='input-js'){if(_0x2189a7[_0x367d44(0x168)]){const _0x207e45=_0x289ef7[_0x367d44(0x176)]();if(_0x207e45==='')return;if(!isValidJsHttpsUrl(_0x207e45)){_0x3138bc(_0x367d44(0x18e));return;}if(!await isUrlReachable(_0x207e45)){_0x3138bc('JS\x20链接无法访问');return;}_0x1cd770(_0x207e45),_0xbb7f31(_0x677c21=>[..._0x677c21,{'label':'JS\x20链接','value':_0x207e45}]),_0x5b1547(''),_0x3138bc(''),_0xbe8ec6(_0x367d44(0x18b));return;}if(_0x2189a7[_0x367d44(0x149)]||_0x2189a7[_0x367d44(0x155)]){_0x5b1547(_0x50f363=>_0x50f363[_0x367d44(0x15b)](0x0,-0x1)),_0x3138bc('');return;}_0x5b1547(_0x4b3dd2=>_0x4b3dd2+_0x4f8f37);return;}if(_0x11b275===_0x367d44(0x18b)){if(_0x2189a7['return']){const _0x2d067b=_0x289ef7['trim']();if(_0x2d067b==='')return;if(!isValidCssHttpsUrl(_0x2d067b)){_0x3138bc(_0x367d44(0x179));return;}if(!await isUrlReachable(_0x2d067b)){_0x3138bc('CSS\x20链接无法访问');return;}_0x335b10(_0x2d067b),_0xbb7f31(_0x15da57=>[..._0x15da57,{'label':_0x367d44(0x162),'value':_0x2d067b}]),_0x5b1547(''),_0x3138bc(''),_0xbe8ec6('creating');const _0x31a944=_0x156199['filter']((_0x43617c,_0x913980)=>_0x49f419['has'](_0x913980));createMenus(_0x31a944,[_0x95ad9e,_0x2d067b])[_0x367d44(0x175)](()=>{_0xbe8ec6('done'),setTimeout(()=>{_0x547f6e();},0x3e8);})[_0x367d44(0x14e)](_0x163e25=>{const _0x42955c=_0x367d44;_0x3138bc(_0x163e25[_0x42955c(0x151)]||_0x42955c(0x150)),_0xbe8ec6(_0x42955c(0x164));});return;}if(_0x2189a7[_0x367d44(0x149)]||_0x2189a7[_0x367d44(0x155)]){_0x5b1547(_0x4b02f5=>_0x4b02f5[_0x367d44(0x15b)](0x0,-0x1)),_0x3138bc('');return;}_0x5b1547(_0x4855cd=>_0x4855cd+_0x4f8f37);return;}});if(_0x505269)return a10_0x4b3517(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x4da0a5(Text,{'children':'\x20\x20'}),a10_0x4da0a5(a10_0x5af0a7,{'type':_0x35bcde(0x180)}),a10_0x4da0a5(Text,{'children':_0x35bcde(0x163)})]});if(_0x10abe3)return a10_0x4b3517(Box,{'flexDirection':_0x35bcde(0x167),'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x4b3517(Text,{'color':_0x35bcde(0x17e),'children':['✗\x20',_0x10abe3]}),a10_0x4b3517(Box,{'marginTop':0x1,'children':[a10_0x4da0a5(Text,{'color':'gray','children':_0x35bcde(0x161)}),a10_0x4da0a5(Text,{'color':_0x35bcde(0x166),'children':_0x35bcde(0x14c)}),a10_0x4da0a5(Text,{'color':_0x35bcde(0x16f),'children':'\x20命令重新登录'})]})]});if(_0x156199[_0x35bcde(0x158)]===0x0)return a10_0x4da0a5(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x4da0a5(Text,{'color':_0x35bcde(0x156),'children':_0x35bcde(0x190)})});return a10_0x4b3517(Box,{'flexDirection':_0x35bcde(0x167),'marginTop':0x1,'marginBottom':0x1,'children':[_0x11b275===_0x35bcde(0x164)&&a10_0x4b3517(a10_0x2fce08,{'children':[a10_0x4b3517(Box,{'children':[a10_0x4b3517(Text,{'bold':!![],'children':['\x20\x20','菜单名称',getRemainingSpaces(_0x4f72d0,_0x35bcde(0x14b))]}),a10_0x4b3517(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x1e4dbc,_0x35bcde(0x14b))]}),a10_0x4b3517(Text,{'bold':!![],'children':['Lovrabet平台',getRemainingSpaces(_0x1e4dbc,_0x35bcde(0x14b))]})]}),_0x1d5a13[_0x35bcde(0x185)](_0x2d5c44=>a10_0x4b3517(Box,{'children':[a10_0x4b3517(Text,{'children':['\x20\x20',_0x2d5c44[_0x35bcde(0x187)],getRemainingSpaces(_0x4f72d0,_0x2d5c44['label'])]}),a10_0x4b3517(Text,{'color':_0x35bcde(0x182),'children':[_0x2d5c44[_0x35bcde(0x18a)]?'✓':'✗',getRemainingSpaces(_0x1e4dbc,'✓')]}),a10_0x4b3517(Text,{'color':_0x2d5c44[_0x35bcde(0x16d)]?'green':_0x35bcde(0x17e),'children':[_0x2d5c44['online']?'✓':'✗',getRemainingSpaces(_0x1e4dbc,'✓')]})]},_0x2d5c44[_0x35bcde(0x17c)]))]}),_0x11b275==='selecting'&&_0x51b42c['length']===0x0&&a10_0x4da0a5(Box,{'marginTop':0x1,'children':a10_0x4da0a5(Text,{'color':_0x35bcde(0x166),'children':_0x35bcde(0x177)})}),_0x51b42c[_0x35bcde(0x185)]((_0x2c9069,_0x581168)=>a10_0x4b3517(Box,{'children':[a10_0x4b3517(Text,{'color':_0x35bcde(0x182),'children':['√\x20',_0x2c9069[_0x35bcde(0x187)],':\x20']}),a10_0x4da0a5(Text,{'color':_0x35bcde(0x166),'children':_0x2c9069[_0x35bcde(0x17f)]})]},_0x581168)),_0x309aeb&&_0x11b275===_0x35bcde(0x164)&&a10_0x4da0a5(Box,{'marginTop':0x1,'children':a10_0x4b3517(Text,{'color':_0x35bcde(0x17e),'children':['✗\x20',_0x309aeb]})}),_0x11b275===_0x35bcde(0x164)&&a10_0x4da0a5(a10_0x2fce08,{'children':a10_0x4b3517(Box,{'marginTop':_0x51b42c[_0x35bcde(0x158)]>0x0||_0x309aeb?0x1:0x0,'flexDirection':_0x35bcde(0x167),'children':[a10_0x4da0a5(Text,{'bold':!![],'children':_0x35bcde(0x186)}),_0x156199[_0x35bcde(0x185)]((_0x260ede,_0x30b55f)=>{const _0x7ffbf2=_0x35bcde,_0x188423=_0x5c3a86===_0x30b55f,_0x353baa=_0x49f419[_0x7ffbf2(0x16c)](_0x30b55f),_0x4490a5=_0x2b7843['includes'](_0x260ede['path']),_0x13014f=_0x4490a5?'更新':'新建';return a10_0x4da0a5(Box,{'children':a10_0x4b3517(Text,{'backgroundColor':_0x188423?_0x7ffbf2(0x15c):undefined,'color':_0x188423?_0x7ffbf2(0x18d):undefined,'children':['\x20\x20',_0x353baa?_0x7ffbf2(0x18c):_0x7ffbf2(0x14d),'\x20',_0x260ede['label']]})},_0x260ede[_0x7ffbf2(0x17c)]);}),a10_0x4da0a5(Box,{'marginTop':0x1,'children':a10_0x4b3517(Text,{'color':_0x35bcde(0x16f),'children':['\x20',_0x35bcde(0x17a)]})})]})}),_0x11b275===_0x35bcde(0x16e)&&a10_0x4b3517(a10_0x2fce08,{'children':[a10_0x4b3517(Box,{'children':[a10_0x4da0a5(Text,{'children':_0x35bcde(0x152)}),a10_0x4da0a5(Text,{'color':_0x35bcde(0x182),'children':_0x289ef7}),_0x309aeb&&a10_0x4b3517(Text,{'color':'red','children':[_0x35bcde(0x183),_0x309aeb]})]}),!_0x309aeb&&a10_0x4da0a5(Box,{'children':a10_0x4da0a5(Text,{'color':_0x35bcde(0x16f),'children':_0x35bcde(0x16a)})})]}),_0x11b275===_0x35bcde(0x18b)&&a10_0x4b3517(a10_0x2fce08,{'children':[a10_0x4b3517(Box,{'children':[a10_0x4da0a5(Text,{'children':_0x35bcde(0x18f)}),a10_0x4da0a5(Text,{'color':_0x35bcde(0x182),'children':_0x289ef7}),_0x309aeb&&a10_0x4b3517(Text,{'color':_0x35bcde(0x17e),'children':[_0x35bcde(0x183),_0x309aeb]})]}),!_0x309aeb&&a10_0x4da0a5(Box,{'children':a10_0x4da0a5(Text,{'color':_0x35bcde(0x16f),'children':_0x35bcde(0x160)})})]}),_0x11b275===_0x35bcde(0x184)&&a10_0x4da0a5(Box,{'children':a10_0x4da0a5(Text,{'children':_0x35bcde(0x181)})}),_0x11b275===_0x35bcde(0x153)&&a10_0x4da0a5(Box,{'children':a10_0x4da0a5(Text,{'color':_0x35bcde(0x182),'children':_0x35bcde(0x157)})})]});}function getStringWidth(_0x29da9e){const _0x4a0836=a10_0xf4f3;let _0x1e0263=0x0;for(const _0x3c2634 of _0x29da9e){/[\u4e00-\u9fa5]/[_0x4a0836(0x17d)](_0x3c2634)?_0x1e0263+=0x2:_0x1e0263+=0x1;}return _0x1e0263;}function getRemainingSpaces(_0x171f4b,_0x4bd102){const _0x1ffe9c=a10_0xf4f3,_0x59d16a=getStringWidth(_0x4bd102);return Array(Math[_0x1ffe9c(0x188)](0x0,_0x171f4b-_0x59d16a))[_0x1ffe9c(0x14a)]('\x20')[_0x1ffe9c(0x173)]('');}function getMaxWidth(_0x4397fe,_0x40b9c1=0x2){let _0x4c1e87='',_0xcaa174=0x0;for(const _0x16534e of _0x4397fe){const _0x58033e=getStringWidth(_0x16534e);_0x58033e>_0xcaa174&&(_0xcaa174=_0x58033e,_0x4c1e87=_0x16534e);}return _0x4c1e87+'\x20'['repeat'](_0x40b9c1);}
|
|
1
|
+
function a10_0x4645(){const _0x42ca50=['red','dots','*\x20请选择要同步的菜单:','[✓]','online','main','607580gBpepX','size','input-js','*\x20JS\x20链接:\x20','add','JS\x20链接','已选择菜单','\x20命令重新登录','5uocjwZ','has','gray','selecting','fill','upArrow','2uRiRVb','3262482MIkZcs','56MqesVV','[\x20]','提示:使用\x20','\x20输入项目的\x20CSS\x20资源链接(https://...)','yellow','cyan','then','return','path','label','CSS\x20链接无法访问','CSS\x20链接','1012689LriwBn','map','lovrabet\x20auth','trim','创建菜单失败','请输入有效的\x20JS\x20https\x20链接','菜单名称','green','done','delete','length','23048wWbatW','*\x20CSS\x20链接:\x20','includes','*\x20正在创建菜单...','213508hNtdXJ','\x20←\x20','backspace','input-css','repeat','55vEJWUr','2017512HWkCdl','creating','local','white','value','downArrow','slice','*\x20同步菜单到\x20Lovrabet\x20平台','message','filter','column','请至少选择一个菜单','请输入有效的\x20CSS\x20https\x20链接','√\x20菜单创建完成','755613lASCrM','\x20输入项目的\x20JS\x20资源链接(https://...)'];a10_0x4645=function(){return _0x42ca50;};return a10_0x4645();}const a10_0x214c7f=a10_0x54fd;(function(_0x5ada4f,_0x1b97cd){const _0x6fc026=a10_0x54fd,_0x3a600a=_0x5ada4f();while(!![]){try{const _0x26af81=-parseInt(_0x6fc026(0x1d3))/0x1+parseInt(_0x6fc026(0x1ba))/0x2*(parseInt(_0x6fc026(0x1c8))/0x3)+-parseInt(_0x6fc026(0x1d7))/0x4*(parseInt(_0x6fc026(0x1b4))/0x5)+-parseInt(_0x6fc026(0x1bb))/0x6+-parseInt(_0x6fc026(0x1dd))/0x7+-parseInt(_0x6fc026(0x1bc))/0x8*(-parseInt(_0x6fc026(0x1a4))/0x9)+parseInt(_0x6fc026(0x1ac))/0xa*(parseInt(_0x6fc026(0x1dc))/0xb);if(_0x26af81===_0x1b97cd)break;else _0x3a600a['push'](_0x3a600a['shift']());}catch(_0x31d213){_0x3a600a['push'](_0x3a600a['shift']());}}}(a10_0x4645,0x4e498));import{jsx as a10_0x338117,jsxs as a10_0x752a14,Fragment as a10_0xbca042}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a10_0x214354 from'ink-spinner';import{useGetOnlineMenuList}from'./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_0x214c7f(0x1ab)]&&render(a10_0x338117(AppMenuSyncUI,{}));function a10_0x54fd(_0x1b5fe4,_0x507f31){const _0x46457f=a10_0x4645();return a10_0x54fd=function(_0x54fdd6,_0x32ac36){_0x54fdd6=_0x54fdd6-0x1a4;let _0x4e9b1f=_0x46457f[_0x54fdd6];return _0x4e9b1f;},a10_0x54fd(_0x1b5fe4,_0x507f31);}export function AppMenuSyncUI(){const _0x132a35=a10_0x214c7f,{exit:_0x188e5e}=useApp(),{loading:_0x3befb8,menuList:_0x5d9e4b,error:_0x126a3a}=useGetOnlineMenuList(),_0x5d5351=getLocalPages(),_0x2539de=_0x5d9e4b[_0x132a35(0x1c9)](_0x1e321e=>_0x1e321e[_0x132a35(0x1c4)]),_0x319723=[_0x132a35(0x1ce),..._0x5d5351[_0x132a35(0x1c9)](_0x31626e=>_0x31626e['label'])],_0x1380d6=getStringWidth(getMaxWidth(_0x319723,0x4)),_0x188e1c=getStringWidth(getMaxWidth([_0x132a35(0x1ce)])),[_0x4c52ad,_0x52f6f9]=useState(_0x132a35(0x1b7)),[_0x278cc3,_0x2985de]=useState(new Set()),[_0xb10c38,_0x8e8f5f]=useState(0x0),[_0x9ab284,_0x45912e]=useState(''),[_0x185885,_0xc06797]=useState(''),[_0x438ffa,_0x59fae2]=useState(''),[_0x18cda3,_0x34f62b]=useState(''),[_0x387911,_0x5bb854]=useState([]),_0x53cab6=_0x5d5351['map'](_0x3a3c53=>({'label':_0x3a3c53['label'],'path':_0x3a3c53[_0x132a35(0x1c4)],'local':!![],'online':_0x2539de[_0x132a35(0x1d5)](_0x3a3c53['path'])})),_0x453a75=_0x5d5351[_0x132a35(0x1e6)](_0x4dd106=>{const _0x288f97=_0x132a35;return!_0x2539de[_0x288f97(0x1d5)](_0x4dd106[_0x288f97(0x1c4)]);});useEffect(()=>{const _0x30f6d8=_0x132a35;if(!_0x3befb8&&_0x5d5351[_0x30f6d8(0x1d2)]>0x0&&_0x278cc3[_0x30f6d8(0x1ad)]===0x0){const _0x72d7a2=new Set(_0x5d5351['map']((_0x362d31,_0x656f07)=>({'page':_0x362d31,'index':_0x656f07}))[_0x30f6d8(0x1e6)](({page:_0x347c21})=>!_0x2539de['includes'](_0x347c21[_0x30f6d8(0x1c4)]))[_0x30f6d8(0x1c9)](({index:_0x4e05bd})=>_0x4e05bd));_0x2985de(_0x72d7a2);}},[_0x3befb8,_0x5d5351[_0x132a35(0x1d2)],_0x2539de[_0x132a35(0x1d2)]]),useInput(async(_0x193b04,_0x5ec309)=>{const _0x76ef8=_0x132a35;if(_0x4c52ad==='selecting'){if(_0x5ec309[_0x76ef8(0x1b9)]){_0x8e8f5f(_0xdb3aec=>_0xdb3aec>0x0?_0xdb3aec-0x1:_0x5d5351[_0x76ef8(0x1d2)]-0x1);return;}if(_0x5ec309[_0x76ef8(0x1e2)]){_0x8e8f5f(_0x26af82=>_0x26af82<_0x5d5351['length']-0x1?_0x26af82+0x1:0x0);return;}if(_0x193b04==='\x20'){_0x2985de(_0x50dbb5=>{const _0x5b8831=_0x76ef8,_0x5c15a4=new Set(_0x50dbb5);return _0x5c15a4['has'](_0xb10c38)?_0x5c15a4[_0x5b8831(0x1d1)](_0xb10c38):_0x5c15a4[_0x5b8831(0x1b0)](_0xb10c38),_0x5c15a4;});return;}if(_0x193b04==='a'||_0x193b04==='A'){const _0x1a0fb5=new Set(_0x5d5351[_0x76ef8(0x1c9)]((_0x1b701b,_0x52cb5a)=>_0x52cb5a));_0x2985de(_0x1a0fb5);return;}if(_0x193b04==='i'||_0x193b04==='I'||_0x193b04==='r'||_0x193b04==='R'){_0x2985de(_0x15d50b=>{const _0x39d1b5=_0x76ef8,_0xd00038=new Set();for(let _0x54bb6a=0x0;_0x54bb6a<_0x5d5351[_0x39d1b5(0x1d2)];_0x54bb6a++){!_0x15d50b[_0x39d1b5(0x1b5)](_0x54bb6a)&&_0xd00038[_0x39d1b5(0x1b0)](_0x54bb6a);}return _0xd00038;});return;}if(_0x193b04==='q'||_0x193b04==='Q'){_0x188e5e();return;}if(_0x5ec309[_0x76ef8(0x1c3)]){if(_0x278cc3[_0x76ef8(0x1ad)]===0x0){_0x34f62b(_0x76ef8(0x1e8));return;}const _0x1b6463=_0x5d5351[_0x76ef8(0x1e6)]((_0x40d38f,_0x1b5f68)=>_0x278cc3[_0x76ef8(0x1b5)](_0x1b5f68)),_0x2dc815=_0x1b6463['map'](_0x279d84=>_0x279d84[_0x76ef8(0x1c5)])['join'](',\x20');_0x5bb854([{'label':_0x76ef8(0x1b2),'value':_0x278cc3[_0x76ef8(0x1ad)]+'\x20个'}]),_0x34f62b(''),_0x52f6f9('input-js');return;}return;}if(_0x4c52ad==='input-js'){if(_0x5ec309[_0x76ef8(0x1c3)]){const _0x203248=_0x438ffa['trim']();if(_0x203248==='')return;if(!isValidJsHttpsUrl(_0x203248)){_0x34f62b(_0x76ef8(0x1cd));return;}if(!await isUrlReachable(_0x203248)){_0x34f62b('JS\x20链接无法访问');return;}_0x45912e(_0x203248),_0x5bb854(_0x5e8b8c=>[..._0x5e8b8c,{'label':_0x76ef8(0x1b1),'value':_0x203248}]),_0x59fae2(''),_0x34f62b(''),_0x52f6f9(_0x76ef8(0x1da));return;}if(_0x5ec309[_0x76ef8(0x1d9)]||_0x5ec309['delete']){_0x59fae2(_0x404d4a=>_0x404d4a[_0x76ef8(0x1e3)](0x0,-0x1)),_0x34f62b('');return;}_0x59fae2(_0x29e4c4=>_0x29e4c4+_0x193b04);return;}if(_0x4c52ad==='input-css'){if(_0x5ec309[_0x76ef8(0x1c3)]){const _0x4e69d5=_0x438ffa[_0x76ef8(0x1cb)]();if(_0x4e69d5==='')return;if(!isValidCssHttpsUrl(_0x4e69d5)){_0x34f62b(_0x76ef8(0x1e9));return;}if(!await isUrlReachable(_0x4e69d5)){_0x34f62b(_0x76ef8(0x1c6));return;}_0xc06797(_0x4e69d5),_0x5bb854(_0x4343f8=>[..._0x4343f8,{'label':_0x76ef8(0x1c7),'value':_0x4e69d5}]),_0x59fae2(''),_0x34f62b(''),_0x52f6f9('creating');const _0x17e0da=_0x5d5351['filter']((_0x44a316,_0x4191f4)=>_0x278cc3[_0x76ef8(0x1b5)](_0x4191f4));createMenus(_0x17e0da,[_0x9ab284,_0x4e69d5])[_0x76ef8(0x1c2)](()=>{const _0x196e20=_0x76ef8;_0x52f6f9(_0x196e20(0x1d0)),setTimeout(()=>{_0x188e5e();},0x3e8);})['catch'](_0x52fa70=>{const _0x5e542c=_0x76ef8;_0x34f62b(_0x52fa70[_0x5e542c(0x1e5)]||_0x5e542c(0x1cc)),_0x52f6f9('selecting');});return;}if(_0x5ec309['backspace']||_0x5ec309['delete']){_0x59fae2(_0xae3d19=>_0xae3d19[_0x76ef8(0x1e3)](0x0,-0x1)),_0x34f62b('');return;}_0x59fae2(_0x33f733=>_0x33f733+_0x193b04);return;}});if(_0x3befb8)return a10_0x752a14(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x338117(Text,{'children':'\x20\x20'}),a10_0x338117(a10_0x214354,{'type':_0x132a35(0x1a7)}),a10_0x338117(Text,{'children':'\x20正在获取线上菜单列表...'})]});if(_0x126a3a)return a10_0x752a14(Box,{'flexDirection':_0x132a35(0x1e7),'marginTop':0x1,'marginBottom':0x1,'children':[a10_0x752a14(Text,{'color':_0x132a35(0x1a6),'children':['✗\x20',_0x126a3a]}),a10_0x752a14(Box,{'marginTop':0x1,'children':[a10_0x338117(Text,{'color':_0x132a35(0x1b6),'children':_0x132a35(0x1be)}),a10_0x338117(Text,{'color':'cyan','children':_0x132a35(0x1ca)}),a10_0x338117(Text,{'color':_0x132a35(0x1b6),'children':_0x132a35(0x1b3)})]})]});if(_0x5d5351[_0x132a35(0x1d2)]===0x0)return a10_0x338117(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a10_0x338117(Text,{'color':_0x132a35(0x1c0),'children':'!\x20未找到本地页面,请先创建页面'})});return a10_0x752a14(Box,{'flexDirection':_0x132a35(0x1e7),'marginTop':0x1,'marginBottom':0x1,'children':[_0x4c52ad===_0x132a35(0x1b7)&&a10_0x752a14(a10_0xbca042,{'children':[a10_0x752a14(Box,{'children':[a10_0x752a14(Text,{'bold':!![],'children':['\x20\x20','菜单名称',getRemainingSpaces(_0x1380d6,_0x132a35(0x1ce))]}),a10_0x752a14(Text,{'bold':!![],'children':['本地',getRemainingSpaces(_0x188e1c,_0x132a35(0x1ce))]}),a10_0x752a14(Text,{'bold':!![],'children':['Lovrabet平台',getRemainingSpaces(_0x188e1c,_0x132a35(0x1ce))]})]}),_0x53cab6['map'](_0x4a3ef9=>a10_0x752a14(Box,{'children':[a10_0x752a14(Text,{'children':['\x20\x20',_0x4a3ef9[_0x132a35(0x1c5)],getRemainingSpaces(_0x1380d6,_0x4a3ef9[_0x132a35(0x1c5)])]}),a10_0x752a14(Text,{'color':'green','children':[_0x4a3ef9[_0x132a35(0x1df)]?'✓':'✗',getRemainingSpaces(_0x188e1c,'✓')]}),a10_0x752a14(Text,{'color':_0x4a3ef9[_0x132a35(0x1aa)]?_0x132a35(0x1cf):_0x132a35(0x1a6),'children':[_0x4a3ef9[_0x132a35(0x1aa)]?'✓':'✗',getRemainingSpaces(_0x188e1c,'✓')]})]},_0x4a3ef9[_0x132a35(0x1c4)]))]}),_0x4c52ad===_0x132a35(0x1b7)&&_0x387911[_0x132a35(0x1d2)]===0x0&&a10_0x338117(Box,{'marginTop':0x1,'children':a10_0x338117(Text,{'color':_0x132a35(0x1c1),'children':_0x132a35(0x1e4)})}),_0x387911[_0x132a35(0x1c9)]((_0x5bd193,_0x1c964c)=>a10_0x752a14(Box,{'children':[a10_0x752a14(Text,{'color':_0x132a35(0x1cf),'children':['√\x20',_0x5bd193['label'],':\x20']}),a10_0x338117(Text,{'color':'cyan','children':_0x5bd193[_0x132a35(0x1e1)]})]},_0x1c964c)),_0x18cda3&&_0x4c52ad===_0x132a35(0x1b7)&&a10_0x338117(Box,{'marginTop':0x1,'children':a10_0x752a14(Text,{'color':_0x132a35(0x1a6),'children':['✗\x20',_0x18cda3]})}),_0x4c52ad===_0x132a35(0x1b7)&&a10_0x338117(a10_0xbca042,{'children':a10_0x752a14(Box,{'marginTop':_0x387911[_0x132a35(0x1d2)]>0x0||_0x18cda3?0x1:0x0,'flexDirection':_0x132a35(0x1e7),'children':[a10_0x338117(Text,{'bold':!![],'children':_0x132a35(0x1a8)}),_0x5d5351[_0x132a35(0x1c9)]((_0x30cae1,_0x480309)=>{const _0x5463c3=_0x132a35,_0x485358=_0xb10c38===_0x480309,_0xe74e13=_0x278cc3[_0x5463c3(0x1b5)](_0x480309),_0x7ad71=_0x2539de[_0x5463c3(0x1d5)](_0x30cae1['path']),_0x366a03=_0x7ad71?'更新':'新建';return a10_0x338117(Box,{'children':a10_0x752a14(Text,{'backgroundColor':_0x485358?'blue':undefined,'color':_0x485358?_0x5463c3(0x1e0):undefined,'children':['\x20\x20',_0xe74e13?_0x5463c3(0x1a9):_0x5463c3(0x1bd),'\x20',_0x30cae1['label']]})},_0x30cae1['path']);}),a10_0x338117(Box,{'marginTop':0x1,'children':a10_0x752a14(Text,{'color':_0x132a35(0x1b6),'children':['\x20','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20Enter:\x20确认']})})]})}),_0x4c52ad===_0x132a35(0x1ae)&&a10_0x752a14(a10_0xbca042,{'children':[a10_0x752a14(Box,{'children':[a10_0x338117(Text,{'children':_0x132a35(0x1af)}),a10_0x338117(Text,{'color':_0x132a35(0x1cf),'children':_0x438ffa}),_0x18cda3&&a10_0x752a14(Text,{'color':'red','children':[_0x132a35(0x1d8),_0x18cda3]})]}),!_0x18cda3&&a10_0x338117(Box,{'children':a10_0x338117(Text,{'color':_0x132a35(0x1b6),'children':_0x132a35(0x1a5)})})]}),_0x4c52ad===_0x132a35(0x1da)&&a10_0x752a14(a10_0xbca042,{'children':[a10_0x752a14(Box,{'children':[a10_0x338117(Text,{'children':_0x132a35(0x1d4)}),a10_0x338117(Text,{'color':_0x132a35(0x1cf),'children':_0x438ffa}),_0x18cda3&&a10_0x752a14(Text,{'color':_0x132a35(0x1a6),'children':[_0x132a35(0x1d8),_0x18cda3]})]}),!_0x18cda3&&a10_0x338117(Box,{'children':a10_0x338117(Text,{'color':_0x132a35(0x1b6),'children':_0x132a35(0x1bf)})})]}),_0x4c52ad===_0x132a35(0x1de)&&a10_0x338117(Box,{'children':a10_0x338117(Text,{'children':_0x132a35(0x1d6)})}),_0x4c52ad===_0x132a35(0x1d0)&&a10_0x338117(Box,{'children':a10_0x338117(Text,{'color':_0x132a35(0x1cf),'children':_0x132a35(0x1ea)})})]});}function getStringWidth(_0x4fb792){let _0x44884d=0x0;for(const _0x5dee6a of _0x4fb792){/[\u4e00-\u9fa5]/['test'](_0x5dee6a)?_0x44884d+=0x2:_0x44884d+=0x1;}return _0x44884d;}function getRemainingSpaces(_0x56b4d7,_0x283250){const _0x12fa27=a10_0x214c7f,_0x44928d=getStringWidth(_0x283250);return Array(Math['max'](0x0,_0x56b4d7-_0x44928d))[_0x12fa27(0x1b8)]('\x20')['join']('');}function getMaxWidth(_0x4eaa8b,_0x5b042e=0x2){const _0xa93b47=a10_0x214c7f;let _0xdb84c2='',_0x2f97e5=0x0;for(const _0x2a955e of _0x4eaa8b){const _0x344272=getStringWidth(_0x2a955e);_0x344272>_0x2f97e5&&(_0x2f97e5=_0x344272,_0xdb84c2=_0x2a955e);}return _0xdb84c2+'\x20'[_0xa93b47(0x1db)](_0x5b042e);}
|