@lovrabet/cli 1.3.4-beta.2 → 1.4.1-beta.0

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.
Files changed (86) hide show
  1. package/lib/ai-setup/config.js +1 -1
  2. package/lib/api/api-doc-ui.js +1 -1
  3. package/lib/api/api-doc.js +1 -1
  4. package/lib/api/api-pull-ui.js +1 -1
  5. package/lib/api/fetch-model-list.js +1 -1
  6. package/lib/api/generate-api-file.js +1 -1
  7. package/lib/api/main.js +1 -1
  8. package/lib/api/pull-silent.js +1 -1
  9. package/lib/app-menu/app-menu-sync-ui.js +1 -1
  10. package/lib/app-menu/create-menu.js +1 -1
  11. package/lib/app-menu/get-local-pages.js +1 -1
  12. package/lib/app-menu/get-online-menu-list.js +1 -1
  13. package/lib/app-menu/use-get-online-menu-list.js +1 -1
  14. package/lib/app-menu/utils.js +1 -1
  15. package/lib/app-menu/valid-url.js +1 -1
  16. package/lib/app-menu-update-cdn/current-content.js +1 -1
  17. package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
  18. package/lib/app-menu-update-cdn/main.js +1 -1
  19. package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
  20. package/lib/auth/auth-server-ui.js +1 -1
  21. package/lib/auth/auth-server.js +1 -1
  22. package/lib/auth/constant.js +1 -1
  23. package/lib/auth/get-cookie.js +1 -1
  24. package/lib/auth/is-session-valid.js +1 -1
  25. package/lib/auth/logout.js +1 -1
  26. package/lib/cli-flags.js +1 -1
  27. package/lib/cli.js +1 -1
  28. package/lib/cmd/build-watch.js +1 -1
  29. package/lib/cmd/build.js +1 -1
  30. package/lib/cmd/logs.js +1 -1
  31. package/lib/cmd/preview.js +1 -1
  32. package/lib/cmd/start-execa.js +1 -1
  33. package/lib/cmd/start.js +1 -1
  34. package/lib/config/config-help.js +1 -1
  35. package/lib/config/main.js +1 -1
  36. package/lib/constant/domain.js +1 -1
  37. package/lib/constant/env.js +1 -1
  38. package/lib/create-app/enhanced-guided-create.js +1 -1
  39. package/lib/create-app/format-elapsed.js +1 -1
  40. package/lib/create-app/main.js +1 -1
  41. package/lib/create-app/non-interactive.js +1 -1
  42. package/lib/create-app/task-finished.js +1 -1
  43. package/lib/create-app/task-loading.js +1 -1
  44. package/lib/create-app/task-running.js +1 -1
  45. package/lib/create-app/task-time.js +1 -1
  46. package/lib/create-app/use-copy-project-template.js +1 -1
  47. package/lib/create-app/use-format-code.js +1 -1
  48. package/lib/create-app/use-install-dependencies.js +1 -1
  49. package/lib/help.js +1 -1
  50. package/lib/i18n/I18nProvider.js +1 -1
  51. package/lib/i18n/hooks.js +1 -1
  52. package/lib/i18n/index.js +1 -1
  53. package/lib/i18n/locales/en-US.js +1 -1
  54. package/lib/i18n/locales/zh-CN.js +1 -1
  55. package/lib/init/main.js +1 -1
  56. package/lib/mcp/McpInstallUI.js +1 -1
  57. package/lib/mcp/claude.js +1 -1
  58. package/lib/mcp/cursor.js +1 -1
  59. package/lib/mcp/main.js +1 -1
  60. package/lib/mcp/mcp-install-non-interactive.js +1 -1
  61. package/lib/mcp/mcp-installer.js +1 -1
  62. package/lib/skills/main.js +1 -1
  63. package/lib/skills/npx-skills-add.js +1 -0
  64. package/lib/ui/IDESelector.js +1 -1
  65. package/lib/ui/useIDESelection.js +1 -1
  66. package/lib/utils/ai_config.js +1 -1
  67. package/lib/utils/cdn-config.js +1 -1
  68. package/lib/utils/check-sdk-version.js +1 -1
  69. package/lib/utils/cli-version-check.js +1 -1
  70. package/lib/utils/config.js +1 -1
  71. package/lib/utils/copy-directory.js +1 -1
  72. package/lib/utils/file-utils.js +1 -1
  73. package/lib/utils/guides-cdn.js +1 -1
  74. package/lib/utils/http-client.js +1 -1
  75. package/lib/utils/logger.js +1 -1
  76. package/lib/utils/rules-cdn.js +1 -1
  77. package/lib/utils/sleep.js +1 -1
  78. package/lib/utils/template-replacer.js +1 -1
  79. package/package.json +5 -5
  80. package/sidecar/flags.json +10 -0
  81. package/templates/rules/lovrabet_rules.mdc.tpl +891 -0
  82. package/templates/skill/SKILL.md.tpl +120 -0
  83. package/lib/ai-setup/AISetupUI.js +0 -1
  84. package/lib/skills/SkillInstallUI.js +0 -1
  85. package/lib/skills/skill-install-non-interactive.js +0 -1
  86. package/lib/skills/skill-installer.js +0 -1
@@ -1 +1 @@
1
- const a1_0x1771ed=a1_0x6a5d;(function(_0x5dec89,_0x506b97){const _0x39991a=a1_0x6a5d,_0x1ddb5a=_0x5dec89();while(!![]){try{const _0x1c783c=parseInt(_0x39991a(0x13f))/0x1*(-parseInt(_0x39991a(0x134))/0x2)+-parseInt(_0x39991a(0x11d))/0x3+parseInt(_0x39991a(0x11a))/0x4+parseInt(_0x39991a(0x135))/0x5+parseInt(_0x39991a(0x126))/0x6+-parseInt(_0x39991a(0x11e))/0x7*(parseInt(_0x39991a(0x14c))/0x8)+parseInt(_0x39991a(0x12e))/0x9*(-parseInt(_0x39991a(0x14f))/0xa);if(_0x1c783c===_0x506b97)break;else _0x1ddb5a['push'](_0x1ddb5a['shift']());}catch(_0x46b3b5){_0x1ddb5a['push'](_0x1ddb5a['shift']());}}}(a1_0x496d,0xa12f3));import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{join,resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';import{IDE_CONFIGS}from'../utils/ai_config.js';import{installSingleIDE}from'../skills/skill-installer.js';import{fetchGuidesFromCDN,writeGuidesToProject}from'../utils/guides-cdn.js';import{getRulesContent}from'../utils/rules-cdn.js';import a1_0x4d8569 from'../i18n/index.js';const __dirname=dirname(fileURLToPath(import.meta.url)),MCP_SERVER_NAME='lovrabet-dataset',MCP_COMMAND=a1_0x1771ed(0x147),MCP_ARGS=[a1_0x1771ed(0x156)];export function buildEnvConfig(_0x4d0554,_0x5c65da){const _0x166de3=a1_0x1771ed,_0x84dde2={'LOVRABET_APP_CODE':String(_0x4d0554)};return _0x5c65da!==_0x166de3(0x14b)&&(_0x84dde2['LOVRABET_ENV']=String(_0x5c65da)),_0x84dde2;}function a1_0x496d(){const _0x1f7007=['3838692IktVzx','\x20\x20\x20\x20\x20\x20}','aiSetup.skill.sharedCopyFailed','617406sPuTbE','329QaCcYo','\x20\x20AppCode:\x20','app','../../cdn-source/skills','Cursor','aiSetup.skill.manifestCreated','success','aiSetup.mcp.other.title','136128uToQHD','.lovrabet/skill/.shared','\x20\x20\x22mcpServers\x22:\x20{','mcp.json','log','claude','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20\x20\x20}','14238mMKAWY','\x22:\x20{','aiSetup.mcp.claude.commandGenerated','object','aiSetup.mcp.claude.configInfo','utf-8','2gMWETS','2958110DIrJmg','aiSetup.skill.installSuccess','cursor','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','stringify','aiSetup.mcp.cursor.rules.copyFailed','appcode','join','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20[','env','46477IpggZm','aiSetup.error.missingAppcode','agents.md','.lovrabet/skill-manifest.json','lovrabet_rules.mdc','aiSetup.mcp.unsupportedIDE','mcp-install','aiSetup.mcp.cursor.error','npx','\x20-e\x20LOVRABET_APP_CODE=','manual','2.0.0','online','10808TqANkN','cwd','skill-install','3780nApTfb','.shared','aiSetup.mcp.cursor.success','aiSetup.mcp.other.name','aiSetup.skill.sharedCopied','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','map','@lovrabet/dataset-mcp-server@latest','toISOString','info','rules','aiSetup.mcp.claude.agents.created','node:fs','mcpServers','\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22','.cursor','aiSetup.mcp.other.guideShown','aiSetup.mcp.claude.agents.copyFailed','Claude\x20Code','message','error','aiSetup.mcp.cursor.rules.created','aiSetup.mcp.claude.env','.lovrabet','\x20\x20\x20\x20\x22'];a1_0x496d=function(){return _0x1f7007;};return a1_0x496d();}export async function configureCursorMcp(_0x2a7997){const _0xb4595d=a1_0x1771ed,_0x2f7257=_0x2a7997||process['cwd'](),_0x458114=readConfig(_0x2f7257),_0x2ada5c=_0x458114[_0xb4595d(0x13b)]||_0x458114[_0xb4595d(0x120)],_0x35ef1f=_0x458114[_0xb4595d(0x13e)]||'online';if(!_0x2ada5c)return{'ide':_0xb4595d(0x122),'status':_0xb4595d(0x163),'message':a1_0x4d8569['t'](_0xb4595d(0x140))};const _0x17045=buildEnvConfig(_0x2ada5c,_0x35ef1f),_0x520810={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0x17045},_0x3031f1=join(_0x2f7257,'.cursor',_0xb4595d(0x129)),_0xf6bc57=join(_0x2f7257,_0xb4595d(0x15e));try{!existsSync(_0xf6bc57)&&mkdirSync(_0xf6bc57,{'recursive':!![]});let _0x2be87e={'mcpServers':{}};if(existsSync(_0x3031f1)){const _0x1b02bb=readFileSync(_0x3031f1,_0xb4595d(0x133));_0x2be87e=JSON['parse'](_0x1b02bb);}return(!_0x2be87e[_0xb4595d(0x15c)]||typeof _0x2be87e[_0xb4595d(0x15c)]!==_0xb4595d(0x131))&&(_0x2be87e[_0xb4595d(0x15c)]={}),_0x2be87e[_0xb4595d(0x15c)][MCP_SERVER_NAME]=_0x520810,writeFileSync(_0x3031f1,JSON[_0xb4595d(0x139)](_0x2be87e,null,0x2),_0xb4595d(0x133)),logger[_0xb4595d(0x158)](_0xb4595d(0x145),a1_0x4d8569['t'](_0xb4595d(0x151)),{'appcode':_0x2ada5c,'env':_0x35ef1f,'path':_0x3031f1}),await copyCursorRules(_0xf6bc57),{'ide':_0xb4595d(0x122),'status':'success','message':a1_0x4d8569['t']('aiSetup.mcp.cursor.written')};}catch(_0x4d6430){return logger['error']('mcp-install',a1_0x4d8569['t'](_0xb4595d(0x146)),{'error':_0x4d6430 instanceof Error?_0x4d6430[_0xb4595d(0x162)]:String(_0x4d6430)}),{'ide':_0xb4595d(0x122),'status':_0xb4595d(0x163),'message':_0x4d6430 instanceof Error?_0x4d6430[_0xb4595d(0x162)]:String(_0x4d6430)};}}export async function configureClaudeMcp(_0x450ae2){const _0x2422d9=a1_0x1771ed,_0x30ee75=_0x450ae2||process[_0x2422d9(0x14d)](),_0x12536b=readConfig(_0x30ee75),_0x3e647a=_0x12536b[_0x2422d9(0x13b)]||_0x12536b[_0x2422d9(0x120)],_0x40d8fa=_0x12536b[_0x2422d9(0x13e)]||'online';if(!_0x3e647a)return{'ide':_0x2422d9(0x161),'status':_0x2422d9(0x163),'message':a1_0x4d8569['t'](_0x2422d9(0x140))};let _0x3f0162='claude\x20mcp\x20add\x20'+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0x2422d9(0x13c)]('\x20')+_0x2422d9(0x148)+_0x3e647a;return _0x40d8fa!==_0x2422d9(0x14b)&&(_0x3f0162+='\x20-e\x20LOVRABET_ENV='+_0x40d8fa),await copyAgentsMd(_0x30ee75),logger['info'](_0x2422d9(0x145),a1_0x4d8569['t'](_0x2422d9(0x130)),{'command':_0x3f0162,'appcode':_0x3e647a,'env':_0x40d8fa}),console['log'](a1_0x4d8569['t']('aiSetup.mcp.claude.manualCommand')),console['log']('\x20\x20'+_0x3f0162+'\x0a'),console[_0x2422d9(0x12a)](a1_0x4d8569['t'](_0x2422d9(0x132))),console[_0x2422d9(0x12a)](_0x2422d9(0x11f)+_0x3e647a),_0x40d8fa!==_0x2422d9(0x14b)&&console['log'](a1_0x4d8569['t'](_0x2422d9(0x165),{'env':_0x40d8fa})),console[_0x2422d9(0x12a)](a1_0x4d8569['t']('aiSetup.mcp.claude.restartRequired')),{'ide':_0x2422d9(0x161),'status':_0x2422d9(0x149),'message':a1_0x4d8569['t']('aiSetup.mcp.claude.manualExecute',{'command':_0x3f0162})};}export async function showOtherGuide(_0x4ac7a4){const _0x472e6a=a1_0x1771ed,_0x3cdf54=_0x4ac7a4||process['cwd'](),_0x555c60=readConfig(_0x3cdf54),_0x5606d6=_0x555c60[_0x472e6a(0x13b)]||_0x555c60[_0x472e6a(0x120)],_0x3aa2ee=_0x555c60['env']||_0x472e6a(0x14b);if(!_0x5606d6)return{'ide':a1_0x4d8569['t'](_0x472e6a(0x152)),'status':_0x472e6a(0x163),'message':a1_0x4d8569['t']('aiSetup.error.missingAppcode')};return console['log'](a1_0x4d8569['t'](_0x472e6a(0x125))),console[_0x472e6a(0x12a)]('{'),console[_0x472e6a(0x12a)](_0x472e6a(0x128)),console[_0x472e6a(0x12a)](_0x472e6a(0x119)+MCP_SERVER_NAME+_0x472e6a(0x12f)),console[_0x472e6a(0x12a)](_0x472e6a(0x15d)+MCP_COMMAND+'\x22,'),console['log'](_0x472e6a(0x13d)+MCP_ARGS[_0x472e6a(0x155)](_0xd39a48=>'\x22'+_0xd39a48+'\x22')[_0x472e6a(0x13c)](',\x20')+'],'),console[_0x472e6a(0x12a)](_0x472e6a(0x12c)),console[_0x472e6a(0x12a)](_0x472e6a(0x154)+_0x5606d6+'\x22,'),_0x3aa2ee!=='online'&&console[_0x472e6a(0x12a)](_0x472e6a(0x138)+_0x3aa2ee+'\x22,'),console[_0x472e6a(0x12a)](_0x472e6a(0x11b)),console[_0x472e6a(0x12a)](_0x472e6a(0x12d)),console['log']('\x20\x20}'),console[_0x472e6a(0x12a)]('}\x0a'),logger[_0x472e6a(0x158)](_0x472e6a(0x145),a1_0x4d8569['t'](_0x472e6a(0x15f)),{'appcode':_0x5606d6,'env':_0x3aa2ee}),{'ide':a1_0x4d8569['t'](_0x472e6a(0x152)),'status':_0x472e6a(0x149),'message':a1_0x4d8569['t'](_0x472e6a(0x15f))};}function a1_0x6a5d(_0x3208d9,_0x3cc922){_0x3208d9=_0x3208d9-0x119;const _0x496dcd=a1_0x496d();let _0x6a5d86=_0x496dcd[_0x3208d9];return _0x6a5d86;}export async function configureMcp(_0x7bb5a5,_0x536e2d){const _0x1e85b5=a1_0x1771ed;switch(_0x7bb5a5){case _0x1e85b5(0x137):return await configureCursorMcp(_0x536e2d);case _0x1e85b5(0x12b):return await configureClaudeMcp(_0x536e2d);default:throw new Error(a1_0x4d8569['t'](_0x1e85b5(0x144),{'ide':_0x7bb5a5}));}}async function copyCursorRules(_0x211810){const _0x3f3974=a1_0x1771ed,_0x10feca=join(_0x211810,_0x3f3974(0x159)),_0xa6d8d0=join(_0x10feca,_0x3f3974(0x143));if(existsSync(_0xa6d8d0))return;try{!existsSync(_0x10feca)&&mkdirSync(_0x10feca,{'recursive':!![]});const _0x35af93=await getRulesContent();writeFileSync(_0xa6d8d0,_0x35af93,_0x3f3974(0x133)),logger[_0x3f3974(0x158)](_0x3f3974(0x145),a1_0x4d8569['t'](_0x3f3974(0x164)),{'to':_0xa6d8d0});}catch(_0x1ab4f3){logger['error'](_0x3f3974(0x145),a1_0x4d8569['t'](_0x3f3974(0x13a)),{'error':_0x1ab4f3 instanceof Error?_0x1ab4f3[_0x3f3974(0x162)]:String(_0x1ab4f3)});}}async function copyAgentsMd(_0x495acb){const _0x2a5c78=a1_0x1771ed,_0x3e30a0=join(_0x495acb,_0x2a5c78(0x141));if(existsSync(_0x3e30a0))return;try{const _0x46adf9=await getRulesContent();writeFileSync(_0x3e30a0,_0x46adf9,'utf-8'),logger[_0x2a5c78(0x158)](_0x2a5c78(0x145),a1_0x4d8569['t'](_0x2a5c78(0x15a)),{'to':_0x3e30a0});}catch(_0x1c83e4){logger['error'](_0x2a5c78(0x145),a1_0x4d8569['t'](_0x2a5c78(0x160)),{'error':_0x1c83e4 instanceof Error?_0x1c83e4[_0x2a5c78(0x162)]:String(_0x1c83e4)});}}export const SKILL_IDE_CONFIGS=IDE_CONFIGS;export async function installSkill(_0x43f1d0,_0x31fb36){const _0x17038f=a1_0x1771ed,_0x5d90cd=_0x31fb36||process['cwd'](),_0x1863f7=resolve(__dirname,_0x17038f(0x121)),_0x5e5533=SKILL_IDE_CONFIGS[_0x43f1d0];if(!_0x5e5533)return{'ide':_0x43f1d0,'status':_0x17038f(0x163),'message':a1_0x4d8569['t']('aiSetup.skill.unknownIDE',{'ide':_0x43f1d0})};const _0x349abd=_0x5e5533['name'];try{let _0x28286d;try{_0x28286d=await fetchGuidesFromCDN();}catch{}const _0x216967=await installSingleIDE(_0x43f1d0,_0x5e5533,_0x5d90cd,_0x1863f7,_0x28286d);return _0x28286d&&writeGuidesToProject(_0x28286d,_0x5d90cd),logger[_0x17038f(0x158)](_0x17038f(0x14e),a1_0x4d8569['t'](_0x17038f(0x136),{'name':_0x349abd}),{'ide':_0x43f1d0,'filesCount':_0x216967}),{'ide':_0x349abd,'status':_0x17038f(0x124),'message':a1_0x4d8569['t']('aiSetup.skill.itemsCreated',{'count':_0x216967})};}catch(_0x5eefef){return logger[_0x17038f(0x163)](_0x17038f(0x14e),a1_0x4d8569['t']('aiSetup.skill.installFailed',{'name':_0x349abd}),{'error':_0x5eefef instanceof Error?_0x5eefef[_0x17038f(0x162)]:String(_0x5eefef)}),{'ide':_0x349abd,'status':_0x17038f(0x163),'message':_0x5eefef instanceof Error?_0x5eefef[_0x17038f(0x162)]:String(_0x5eefef)};}}async function copyDir(_0x5c1260,_0x716ac6){const _0x2494f6=a1_0x1771ed,{statSync:_0x5e1f11}=await import(_0x2494f6(0x15b)),{readdirSync:_0x5d00c8}=await import(_0x2494f6(0x15b)),_0x9c9c59=_0x5e1f11(_0x5c1260);if(_0x9c9c59['isDirectory']()){!existsSync(_0x716ac6)&&mkdirSync(_0x716ac6,{'recursive':!![]});const _0x36afa0=_0x5d00c8(_0x5c1260);for(const _0x5ff27e of _0x36afa0){await copyDir(join(_0x5c1260,_0x5ff27e),join(_0x716ac6,_0x5ff27e));}}else copyFileSync(_0x5c1260,_0x716ac6);}export async function copySharedSkills(_0x23d0ec){const _0x35844d=a1_0x1771ed,_0x4eb93f=_0x23d0ec||process[_0x35844d(0x14d)](),_0x237bfe=resolve(__dirname,_0x35844d(0x121)),_0x2377b8=join(_0x237bfe,_0x35844d(0x150)),_0x160583=join(_0x4eb93f,_0x35844d(0x127));if(!existsSync(_0x2377b8))return![];try{return await copyDir(_0x2377b8,_0x160583),logger[_0x35844d(0x158)](_0x35844d(0x14e),a1_0x4d8569['t'](_0x35844d(0x153)),{'path':_0x160583}),!![];}catch(_0x49652e){return logger[_0x35844d(0x163)]('skill-install',a1_0x4d8569['t'](_0x35844d(0x11c)),{'error':_0x49652e instanceof Error?_0x49652e[_0x35844d(0x162)]:String(_0x49652e)}),![];}}export function createSkillManifest(_0x4400a0,_0x3011b3){const _0x5640d7=a1_0x1771ed,_0x24bedc={'version':_0x5640d7(0x14a),'installedAt':new Date()[_0x5640d7(0x157)](),'platforms':_0x3011b3},_0x46f47c=join(_0x4400a0,_0x5640d7(0x142)),_0x376551=join(_0x4400a0,_0x5640d7(0x166));!existsSync(_0x376551)&&mkdirSync(_0x376551,{'recursive':!![]}),writeFileSync(_0x46f47c,JSON[_0x5640d7(0x139)](_0x24bedc,null,0x2),_0x5640d7(0x133)),logger[_0x5640d7(0x158)]('skill-install',a1_0x4d8569['t'](_0x5640d7(0x123)),{'path':_0x46f47c});}
1
+ function a0_0x1146(_0x1e6e58,_0x15c07c){_0x1e6e58=_0x1e6e58-0x171;const _0x5104ae=a0_0x5104();let _0x114622=_0x5104ae[_0x1e6e58];return _0x114622;}const a0_0x2828b7=a0_0x1146;(function(_0x372230,_0x25e294){const _0x5277ed=a0_0x1146,_0x33792e=_0x372230();while(!![]){try{const _0x55a724=-parseInt(_0x5277ed(0x187))/0x1+parseInt(_0x5277ed(0x182))/0x2+parseInt(_0x5277ed(0x177))/0x3+parseInt(_0x5277ed(0x1a1))/0x4*(parseInt(_0x5277ed(0x193))/0x5)+-parseInt(_0x5277ed(0x1a2))/0x6+-parseInt(_0x5277ed(0x186))/0x7+-parseInt(_0x5277ed(0x174))/0x8*(parseInt(_0x5277ed(0x19f))/0x9);if(_0x55a724===_0x25e294)break;else _0x33792e['push'](_0x33792e['shift']());}catch(_0x196098){_0x33792e['push'](_0x33792e['shift']());}}}(a0_0x5104,0x661cb));import{existsSync,mkdirSync,writeFileSync,readFileSync}from'node:fs';import{join}from'node:path';function a0_0x5104(){const _0x433316=['env','cwd','aiSetup.mcp.claude.manualExecute','aiSetup.mcp.claude.manualCommand','aiSetup.mcp.other.guideShown','stringify','npx','5IlQpSD','aiSetup.mcp.cursor.success','info','aiSetup.mcp.claude.configInfo','mcp-install','cursor','aiSetup.error.missingAppcode','.cursor','aiSetup.mcp.cursor.error','error','\x20\x20\x20\x20\x20\x20}','appcode','3357iXqvBG','map','2275716IWvqac','460302jxxacj','\x22:\x20{','claude\x20mcp\x20add\x20','utf-8','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','object','aiSetup.mcp.unsupportedIDE','\x20\x20AppCode:\x20','aiSetup.mcp.claude.env','5288WWfLHe','mcpServers','\x20\x20}','1492569RXizGv','lovrabet-dataset','Claude\x20Code','manual','\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22','join','app','claude','\x20\x20\x22mcpServers\x22:\x20{','aiSetup.mcp.claude.restartRequired','Cursor','1566990oVjzrD','aiSetup.mcp.claude.commandGenerated','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20[','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','3521777qEiuLc','605315uszxQT','@lovrabet/dataset-mcp-server@latest','log','parse','production'];a0_0x5104=function(){return _0x433316;};return a0_0x5104();}import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';import{copyRulesToAgentsMd,copyRulesToCursor}from'../utils/rules-cdn.js';import{normalizeEnv}from'../constant/env.js';import a0_0x13f956 from'../i18n/index.js';const MCP_SERVER_NAME=a0_0x2828b7(0x178),MCP_COMMAND=a0_0x2828b7(0x192),MCP_ARGS=[a0_0x2828b7(0x188)];export function buildEnvConfig(_0x17ac70,_0xde6879){const _0x55a7f9=a0_0x2828b7,_0x73aae5={'LOVRABET_APP_CODE':String(_0x17ac70)};return _0xde6879!==_0x55a7f9(0x18b)&&(_0x73aae5['LOVRABET_ENV']=String(_0xde6879)),_0x73aae5;}export async function configureCursorMcp(_0x1e085d){const _0x5ef303=a0_0x2828b7,_0x1a51fc=_0x1e085d||process[_0x5ef303(0x18d)](),_0x5220f0=readConfig(_0x1a51fc),_0x53a6e6=_0x5220f0['appcode']||_0x5220f0[_0x5ef303(0x17d)],_0x3ec381=normalizeEnv(_0x5220f0[_0x5ef303(0x18c)]||_0x5ef303(0x18b));if(!_0x53a6e6)return{'ide':'Cursor','status':'error','message':a0_0x13f956['t']('aiSetup.error.missingAppcode')};const _0xdcdc29=buildEnvConfig(_0x53a6e6,_0x3ec381),_0x22f1bd={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0xdcdc29},_0x40ceed=join(_0x1a51fc,'.cursor','mcp.json'),_0x2024d6=join(_0x1a51fc,_0x5ef303(0x19a));try{!existsSync(_0x2024d6)&&mkdirSync(_0x2024d6,{'recursive':!![]});let _0x397184={'mcpServers':{}};if(existsSync(_0x40ceed)){const _0x13892f=readFileSync(_0x40ceed,_0x5ef303(0x1a5));_0x397184=JSON[_0x5ef303(0x18a)](_0x13892f);}return(!_0x397184['mcpServers']||typeof _0x397184[_0x5ef303(0x175)]!==_0x5ef303(0x1a7))&&(_0x397184['mcpServers']={}),_0x397184[_0x5ef303(0x175)][MCP_SERVER_NAME]=_0x22f1bd,writeFileSync(_0x40ceed,JSON[_0x5ef303(0x191)](_0x397184,null,0x2),_0x5ef303(0x1a5)),logger[_0x5ef303(0x195)](_0x5ef303(0x197),a0_0x13f956['t'](_0x5ef303(0x194)),{'appcode':_0x53a6e6,'env':_0x3ec381,'path':_0x40ceed}),await copyRulesToCursor(_0x1a51fc),{'ide':'Cursor','status':'success','message':a0_0x13f956['t']('aiSetup.mcp.cursor.written')};}catch(_0x572521){return logger[_0x5ef303(0x19c)]('mcp-install',a0_0x13f956['t'](_0x5ef303(0x19b)),{'error':_0x572521 instanceof Error?_0x572521['message']:String(_0x572521)}),{'ide':_0x5ef303(0x181),'status':_0x5ef303(0x19c),'message':_0x572521 instanceof Error?_0x572521['message']:String(_0x572521)};}}export async function configureClaudeMcp(_0x904b5){const _0x194efa=a0_0x2828b7,_0x336b8c=_0x904b5||process[_0x194efa(0x18d)](),_0x563e53=readConfig(_0x336b8c),_0x4048ce=_0x563e53[_0x194efa(0x19e)]||_0x563e53['app'],_0x1a50fe=normalizeEnv(_0x563e53[_0x194efa(0x18c)]||_0x194efa(0x18b));if(!_0x4048ce)return{'ide':_0x194efa(0x179),'status':_0x194efa(0x19c),'message':a0_0x13f956['t'](_0x194efa(0x199))};let _0xf2549e=_0x194efa(0x1a4)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0x194efa(0x17c)]('\x20')+'\x20-e\x20LOVRABET_APP_CODE='+_0x4048ce;return _0x1a50fe!==_0x194efa(0x18b)&&(_0xf2549e+='\x20-e\x20LOVRABET_ENV='+_0x1a50fe),await copyRulesToAgentsMd(_0x336b8c),logger[_0x194efa(0x195)]('mcp-install',a0_0x13f956['t'](_0x194efa(0x183)),{'command':_0xf2549e,'appcode':_0x4048ce,'env':_0x1a50fe}),console[_0x194efa(0x189)](a0_0x13f956['t'](_0x194efa(0x18f))),console[_0x194efa(0x189)]('\x20\x20'+_0xf2549e+'\x0a'),console[_0x194efa(0x189)](a0_0x13f956['t'](_0x194efa(0x196))),console[_0x194efa(0x189)](_0x194efa(0x172)+_0x4048ce),_0x1a50fe!==_0x194efa(0x18b)&&console['log'](a0_0x13f956['t'](_0x194efa(0x173),{'env':_0x1a50fe})),console[_0x194efa(0x189)](a0_0x13f956['t'](_0x194efa(0x180))),{'ide':_0x194efa(0x179),'status':'manual','message':a0_0x13f956['t'](_0x194efa(0x18e),{'command':_0xf2549e})};}export async function showOtherGuide(_0x2093f3){const _0x38801d=a0_0x2828b7,_0x34e183=_0x2093f3||process[_0x38801d(0x18d)](),_0x2342ac=readConfig(_0x34e183),_0x14b127=_0x2342ac[_0x38801d(0x19e)]||_0x2342ac[_0x38801d(0x17d)],_0x181efc=normalizeEnv(_0x2342ac[_0x38801d(0x18c)]||_0x38801d(0x18b));if(!_0x14b127)return{'ide':a0_0x13f956['t']('aiSetup.mcp.other.name'),'status':_0x38801d(0x19c),'message':a0_0x13f956['t'](_0x38801d(0x199))};return console[_0x38801d(0x189)](a0_0x13f956['t']('aiSetup.mcp.other.title')),console['log']('{'),console[_0x38801d(0x189)](_0x38801d(0x17f)),console['log']('\x20\x20\x20\x20\x22'+MCP_SERVER_NAME+_0x38801d(0x1a3)),console[_0x38801d(0x189)](_0x38801d(0x17b)+MCP_COMMAND+'\x22,'),console[_0x38801d(0x189)](_0x38801d(0x184)+MCP_ARGS[_0x38801d(0x1a0)](_0x4285f5=>'\x22'+_0x4285f5+'\x22')[_0x38801d(0x17c)](',\x20')+'],'),console[_0x38801d(0x189)](_0x38801d(0x1a6)),console[_0x38801d(0x189)]('\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22'+_0x14b127+'\x22,'),_0x181efc!=='production'&&console['log'](_0x38801d(0x185)+_0x181efc+'\x22,'),console[_0x38801d(0x189)](_0x38801d(0x19d)),console[_0x38801d(0x189)]('\x20\x20\x20\x20}'),console[_0x38801d(0x189)](_0x38801d(0x176)),console[_0x38801d(0x189)]('}\x0a'),logger[_0x38801d(0x195)](_0x38801d(0x197),a0_0x13f956['t'](_0x38801d(0x190)),{'appcode':_0x14b127,'env':_0x181efc}),{'ide':a0_0x13f956['t']('aiSetup.mcp.other.name'),'status':_0x38801d(0x17a),'message':a0_0x13f956['t'](_0x38801d(0x190))};}export async function configureMcp(_0x540341,_0x56c6d2){const _0x5ed66a=a0_0x2828b7;switch(_0x540341){case _0x5ed66a(0x198):return await configureCursorMcp(_0x56c6d2);case _0x5ed66a(0x17e):return await configureClaudeMcp(_0x56c6d2);default:throw new Error(a0_0x13f956['t'](_0x5ed66a(0x171),{'ide':_0x540341}));}}
@@ -1 +1 @@
1
- (function(_0x5b3620,_0x29d975){const _0xe49886=a2_0x1e33,_0xfa0044=_0x5b3620();while(!![]){try{const _0x367235=-parseInt(_0xe49886(0x87))/0x1*(parseInt(_0xe49886(0x81))/0x2)+parseInt(_0xe49886(0x8a))/0x3+-parseInt(_0xe49886(0x79))/0x4*(-parseInt(_0xe49886(0x7a))/0x5)+parseInt(_0xe49886(0x8e))/0x6+parseInt(_0xe49886(0x75))/0x7+-parseInt(_0xe49886(0x6a))/0x8+parseInt(_0xe49886(0x67))/0x9*(-parseInt(_0xe49886(0x9b))/0xa);if(_0x367235===_0x29d975)break;else _0xfa0044['push'](_0xfa0044['shift']());}catch(_0x9598f1){_0xfa0044['push'](_0xfa0044['shift']());}}}(a2_0x597f,0x18d7a));function a2_0x1e33(_0x4382e2,_0x3b2eca){_0x4382e2=_0x4382e2-0x65;const _0x597f19=a2_0x597f();let _0x1e3351=_0x597f19[_0x4382e2];return _0x1e3351;}import{jsx as a2_0xae22bc,jsxs as a2_0x2d53aa,Fragment as a2_0x4085bb}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';import{useI18n}from'../i18n/hooks.js';export const ApiDocUI=({appCode:_0x385310,env:_0x1da2b3,output:_0x2d792d,extraParams:_0x5dfc34,datasetCodes:_0x40c0bc})=>{const _0x4193f2=a2_0x1e33,{exit:_0x192d21}=useApp(),{t:_0x187094}=useI18n(),[_0x395223,_0x233185]=useState(![]),[_0x2b82a7,_0x256b67]=useState(''),[_0x8f7520,_0x933ff]=useState(![]),[_0x5b3572,_0x4ab6e3]=useState(null),[_0x2a7768,_0x56d14f]=useState(null),[_0x2180f7,_0xc029e5]=useState(0x0),_0xa87d18=readConfig(),_0x22364f=getConfigAppCode(),_0x323a05=_0x385310||_0x22364f,_0x32277e=typeof _0xa87d18?.[_0x4193f2(0x6b)]===_0x4193f2(0x76)?_0xa87d18['env']:undefined,_0x11dc27=_0x1da2b3||_0x32277e||_0x4193f2(0x85);initEnv(_0x11dc27);const _0x5826eb=_0x2d792d||_0x4193f2(0x94),_0x254fd7=_0x385310?_0x187094(_0x4193f2(0x7b),{'appCode':_0x323a05}):_0x187094(_0x4193f2(0x7e),{'appCode':_0x323a05});useEffect(()=>{_0x233185(!![]),_0x10426f();},[]),useEffect(()=>{(_0x8f7520||_0x5b3572)&&_0x192d21();},[_0x8f7520,_0x5b3572,_0x192d21]);async function _0x10426f(){const _0x2013a9=_0x4193f2;if(!_0x323a05){_0x4ab6e3(_0x187094(_0x2013a9(0x83)));return;}try{logger[_0x2013a9(0x78)](process[_0x2013a9(0x93)]()),_0x256b67(_0x187094('api.docUI.fetchingDatasets'));const {configArray:_0x1049cd}=await fetchModelList(_0x323a05);_0xc029e5(_0x1049cd[_0x2013a9(0x84)]);if(_0x1049cd[_0x2013a9(0x84)]===0x0){_0x4ab6e3(_0x187094('api.docUI.noDatasets'));return;}let _0x19a55d=_0x1049cd;if(_0x40c0bc&&_0x40c0bc[_0x2013a9(0x84)]>0x0){_0x19a55d=_0x1049cd['filter'](_0x279a70=>_0x40c0bc[_0x2013a9(0x73)](_0x279a70[_0x2013a9(0x9a)]));const _0x4c7d03=_0x19a55d[_0x2013a9(0x86)](_0x3fd507=>_0x3fd507[_0x2013a9(0x9a)]),_0x13d83b=_0x40c0bc[_0x2013a9(0x72)](_0x4be9aa=>!_0x4c7d03[_0x2013a9(0x73)](_0x4be9aa));_0x13d83b[_0x2013a9(0x84)]>0x0&&console[_0x2013a9(0x92)]('\x1b[33m'+_0x187094(_0x2013a9(0x70),{'codes':_0x13d83b['join'](',\x20')})+_0x2013a9(0x77));if(_0x19a55d[_0x2013a9(0x84)]===0x0){_0x4ab6e3(_0x187094(_0x2013a9(0x66),{'codes':_0x40c0bc[_0x2013a9(0x7d)](',\x20')}));return;}console[_0x2013a9(0x92)](_0x2013a9(0x90)+_0x187094(_0x2013a9(0x8d),{'total':_0x1049cd['length'],'count':_0x19a55d['length']})+'\x1b[0m');}_0x256b67(_0x187094('api.docUI.generatingDocs',{'count':_0x19a55d[_0x2013a9(0x84)]}));const _0x383ce1=await generateDatasetDocs(_0x19a55d,_0x323a05,_0x5826eb,(_0x55e511,_0x9a3048,_0x227dc4)=>{_0x256b67(_0x187094('api.docUI.generatingFile',{'fileName':_0x227dc4,'current':_0x55e511,'total':_0x9a3048}));},_0x5dfc34);_0x56d14f(_0x383ce1),_0x933ff(!![]);const _0x5bb205=_0x383ce1[_0x2013a9(0x72)](_0x2d2b78=>_0x2d2b78['success'])[_0x2013a9(0x84)],_0x3fdd16=_0x383ce1[_0x2013a9(0x72)](_0x5acf00=>!_0x5acf00[_0x2013a9(0x96)])['length'];logger['success'](_0x2013a9(0x95),_0x2013a9(0x80),undefined,{'totalCount':_0x383ce1[_0x2013a9(0x84)],'successCount':_0x5bb205,'failCount':_0x3fdd16,'outputDir':_0x5826eb});}catch(_0x311063){const _0x567d1b=_0x311063 instanceof Error?_0x311063[_0x2013a9(0x6e)]:String(_0x311063);logger['error'](_0x2013a9(0x95),_0x2013a9(0x91)+_0x567d1b,{'appCode':_0x323a05,'outputDir':_0x5826eb}),_0x4ab6e3(_0x187094(_0x2013a9(0x82),{'error':_0x567d1b}));}finally{_0x233185(![]);}}const _0x1d1807=_0x2a7768?.[_0x4193f2(0x72)](_0xfd03ab=>_0xfd03ab[_0x4193f2(0x96)])['length']||0x0,_0x20df54=_0x2a7768?.[_0x4193f2(0x72)](_0x29bbe0=>!_0x29bbe0[_0x4193f2(0x96)])[_0x4193f2(0x84)]||0x0;return a2_0x2d53aa(Box,{'flexDirection':'column','children':[(_0x395223||_0x8f7520)&&a2_0x2d53aa(Box,{'children':[a2_0xae22bc(Text,{'color':_0x4193f2(0x7c),'children':'*\x20'}),a2_0xae22bc(Text,{'color':_0x385310?_0x4193f2(0x71):'dim','children':_0x254fd7})]}),_0x395223&&a2_0xae22bc(Box,{'children':a2_0x2d53aa(Text,{'children':['*\x20',_0x2b82a7]})}),_0x8f7520&&_0x2a7768&&a2_0x2d53aa(Box,{'flexDirection':_0x4193f2(0x8b),'children':[a2_0xae22bc(Box,{'children':a2_0x2d53aa(Text,{'color':_0x4193f2(0x8c),'children':[_0x187094(_0x4193f2(0x8f),{'successCount':_0x1d1807}),_0x20df54>0x0?_0x187094('api.docUI.docFailed',{'failCount':_0x20df54}):'']})}),a2_0xae22bc(Box,{'marginTop':0x1,'children':a2_0xae22bc(Text,{'color':_0x4193f2(0x7c),'children':_0x187094(_0x4193f2(0x6d),{'count':_0x2180f7})})}),a2_0x2d53aa(Box,{'marginTop':0x1,'children':[a2_0xae22bc(Text,{'color':_0x4193f2(0x7c),'children':_0x187094('api.docUI.outputDir')}),a2_0xae22bc(Text,{'color':'cyan','children':_0x5826eb})]}),_0x1d1807>0x0&&a2_0x2d53aa(a2_0x4085bb,{'children':[a2_0xae22bc(Box,{'marginTop':0x1,'children':a2_0xae22bc(Text,{'color':_0x4193f2(0x7c),'children':_0x187094(_0x4193f2(0x6c))})}),_0x2a7768['filter'](_0x57c2e1=>_0x57c2e1[_0x4193f2(0x96)])[_0x4193f2(0x86)]((_0x1ef0f1,_0xb19e69)=>a2_0x2d53aa(Box,{'marginLeft':0x2,'children':[a2_0x2d53aa(Text,{'color':'cyan','children':['•\x20',_0x1ef0f1[_0x4193f2(0x69)]]}),a2_0x2d53aa(Text,{'color':_0x4193f2(0x74),'children':[_0x4193f2(0x89),_0x1ef0f1['datasetName']]})]},_0xb19e69))]}),_0x20df54>0x0&&a2_0x2d53aa(a2_0x4085bb,{'children':[a2_0xae22bc(Box,{'marginTop':0x1,'children':a2_0xae22bc(Text,{'color':_0x4193f2(0x9c),'children':_0x187094(_0x4193f2(0x7f))})}),_0x2a7768[_0x4193f2(0x72)](_0x2f7d7e=>!_0x2f7d7e[_0x4193f2(0x96)])[_0x4193f2(0x86)]((_0x1ef1c5,_0x1ae6fa)=>a2_0x2d53aa(Box,{'marginLeft':0x2,'flexDirection':_0x4193f2(0x8b),'children':[a2_0x2d53aa(Text,{'color':'red','children':['•\x20',_0x1ef1c5[_0x4193f2(0x97)],'\x20(',_0x1ef1c5[_0x4193f2(0x9a)],')']}),_0x1ef1c5[_0x4193f2(0x68)]&&a2_0xae22bc(Box,{'marginLeft':0x2,'children':a2_0xae22bc(Text,{'color':_0x4193f2(0x74),'children':_0x1ef1c5[_0x4193f2(0x68)]})})]},_0x1ae6fa))]})]}),_0x5b3572&&a2_0x2d53aa(Box,{'flexDirection':'column','children':[a2_0xae22bc(Box,{'children':a2_0x2d53aa(Text,{'color':_0x4193f2(0x65),'children':[_0x4193f2(0x88),_0x5b3572]})}),(_0x5b3572[_0x4193f2(0x73)]('登录')||_0x5b3572[_0x4193f2(0x73)](_0x4193f2(0x98))||_0x5b3572['includes']('expired'))&&a2_0x2d53aa(Box,{'marginTop':0x1,'children':[a2_0xae22bc(Text,{'color':'yellow','children':'*\x20'}),a2_0xae22bc(Text,{'color':_0x4193f2(0x99),'children':_0x4193f2(0x6f)}),a2_0x2d53aa(Text,{'color':'yellow','children':['\x20',_0x187094('api.common.authRetry')]})]})]})]});};function a2_0x597f(){const _0x3dc0b3=['datasetCode','460920NBvVmC','yellow','red','api.docUI.allDatasetsNotFound','18dMvVpH','error','filePath','958344mrVBOr','env','api.docUI.generatedDocs','api.docUI.processedDatasets','message','lovrabet\x20auth','api.docUI.datasetsNotFound','white','filter','includes','dim','43512qetlXy','string','\x1b[0m','setLogPath','38996pXnuFx','10lVTTmH','api.common.usingSpecifiedAppCode','gray','join','api.common.usingDefaultAppCode','api.docUI.failedDatasets','文档生成完成','14gTVZNX','api.docUI.docGenerateFailed','api.common.noAppCodeDefault','length','online','map','4631enHGEe','[ERROR]\x20','\x20-\x20','382374KfCayy','column','green','api.docUI.filteredDatasets','1157856mZONLD','api.docUI.docComplete','\x1b[90m','文档生成失败:\x20','log','cwd','./docs','api-doc','success','datasetName','Authentication','cyan'];a2_0x597f=function(){return _0x3dc0b3;};return a2_0x597f();}
1
+ (function(_0xd49548,_0x2a9523){const _0x4a8440=a1_0x4c53,_0x4c70e1=_0xd49548();while(!![]){try{const _0x30df9a=-parseInt(_0x4a8440(0xdb))/0x1*(parseInt(_0x4a8440(0xf2))/0x2)+parseInt(_0x4a8440(0xef))/0x3*(parseInt(_0x4a8440(0xe3))/0x4)+-parseInt(_0x4a8440(0xc7))/0x5*(parseInt(_0x4a8440(0xcb))/0x6)+parseInt(_0x4a8440(0xc3))/0x7*(-parseInt(_0x4a8440(0xce))/0x8)+parseInt(_0x4a8440(0xf8))/0x9+-parseInt(_0x4a8440(0xeb))/0xa*(parseInt(_0x4a8440(0xe1))/0xb)+parseInt(_0x4a8440(0xf9))/0xc*(parseInt(_0x4a8440(0xc8))/0xd);if(_0x30df9a===_0x2a9523)break;else _0x4c70e1['push'](_0x4c70e1['shift']());}catch(_0x34bb09){_0x4c70e1['push'](_0x4c70e1['shift']());}}}(a1_0x44ad,0xd07bc));import{jsx as a1_0x384452,jsxs as a1_0x214f39,Fragment as a1_0x35b9a6}from'react/jsx-runtime';function a1_0x44ad(){const _0x38b1ec=['length','error','api.common.usingSpecifiedAppCode','3eETrdO','api.docUI.outputDir','api.common.noAppCodeDefault','20674qkUUlX','文档生成完成','api.docUI.generatedDocs','./docs','api.docUI.noDatasets','red','15097824tSadSv','312WgooKO','map','161854MjQUBC','gray','green','message','49745WkrphG','439426KecrZl','api.docUI.datasetsNotFound','filter','42BMSadr','white','api.docUI.generatingDocs','160tVOBZc','cyan','string','yellow','includes','log','\x1b[0m','setLogPath','api.docUI.processedDatasets','api-doc','api.docUI.docFailed','success','api.docUI.generatingFile','106sJoKZO','Authentication','filePath','api.docUI.docComplete','env','\x1b[90m','407PVrCLi','column','378412rTGckL','文档生成失败:\x20','datasetCode','expired','api.docUI.filteredDatasets','join','dim','api.docUI.docGenerateFailed','45740ojUhpb'];a1_0x44ad=function(){return _0x38b1ec;};return a1_0x44ad();}import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';import{useI18n}from'../i18n/hooks.js';function a1_0x4c53(_0x56d799,_0x2748f5){_0x56d799=_0x56d799-0xc3;const _0x44ad21=a1_0x44ad();let _0x4c535f=_0x44ad21[_0x56d799];return _0x4c535f;}export const ApiDocUI=({appCode:_0x59698a,env:_0x789a03,output:_0x2e6a5f,extraParams:_0x4cc573,datasetCodes:_0x18cffc})=>{const _0x363130=a1_0x4c53,{exit:_0x2bb61c}=useApp(),{t:_0xccc799}=useI18n(),[_0x8f99eb,_0x2295e9]=useState(![]),[_0x4ba16e,_0x1827af]=useState(''),[_0x4c4e50,_0x166597]=useState(![]),[_0x28ce91,_0x322744]=useState(null),[_0x2f4e07,_0x4c1aad]=useState(null),[_0x4eb8ea,_0x35d268]=useState(0x0),_0x5a60cc=readConfig(),_0x54eabc=getConfigAppCode(),_0x58f9f3=_0x59698a||_0x54eabc,_0x52693f=typeof _0x5a60cc?.[_0x363130(0xdf)]===_0x363130(0xd0)?_0x5a60cc['env']:undefined,_0x573204=_0x789a03||_0x52693f||'production';initEnv(_0x573204);const _0x57385d=_0x2e6a5f||_0x363130(0xf5),_0x1205f1=_0x59698a?_0xccc799(_0x363130(0xee),{'appCode':_0x58f9f3}):_0xccc799('api.common.usingDefaultAppCode',{'appCode':_0x58f9f3});useEffect(()=>{_0x2295e9(!![]),_0x41e582();},[]),useEffect(()=>{(_0x4c4e50||_0x28ce91)&&_0x2bb61c();},[_0x4c4e50,_0x28ce91,_0x2bb61c]);async function _0x41e582(){const _0x27fbab=_0x363130;if(!_0x58f9f3){_0x322744(_0xccc799(_0x27fbab(0xf1)));return;}try{logger[_0x27fbab(0xd5)](process['cwd']()),_0x1827af(_0xccc799('api.docUI.fetchingDatasets'));const {configArray:_0x37ea3b}=await fetchModelList(_0x58f9f3);_0x35d268(_0x37ea3b[_0x27fbab(0xec)]);if(_0x37ea3b[_0x27fbab(0xec)]===0x0){_0x322744(_0xccc799(_0x27fbab(0xf6)));return;}let _0x494bd9=_0x37ea3b;if(_0x18cffc&&_0x18cffc[_0x27fbab(0xec)]>0x0){_0x494bd9=_0x37ea3b[_0x27fbab(0xca)](_0x571aad=>_0x18cffc[_0x27fbab(0xd2)](_0x571aad[_0x27fbab(0xe5)]));const _0x39b1d4=_0x494bd9[_0x27fbab(0xfa)](_0x22713f=>_0x22713f[_0x27fbab(0xe5)]),_0x51fa9a=_0x18cffc[_0x27fbab(0xca)](_0x1c18b1=>!_0x39b1d4['includes'](_0x1c18b1));_0x51fa9a[_0x27fbab(0xec)]>0x0&&console[_0x27fbab(0xd3)]('\x1b[33m'+_0xccc799(_0x27fbab(0xc9),{'codes':_0x51fa9a[_0x27fbab(0xe8)](',\x20')})+_0x27fbab(0xd4));if(_0x494bd9[_0x27fbab(0xec)]===0x0){_0x322744(_0xccc799('api.docUI.allDatasetsNotFound',{'codes':_0x18cffc[_0x27fbab(0xe8)](',\x20')}));return;}console[_0x27fbab(0xd3)](_0x27fbab(0xe0)+_0xccc799(_0x27fbab(0xe7),{'total':_0x37ea3b[_0x27fbab(0xec)],'count':_0x494bd9['length']})+'\x1b[0m');}_0x1827af(_0xccc799(_0x27fbab(0xcd),{'count':_0x494bd9[_0x27fbab(0xec)]}));const _0x44a6bc=await generateDatasetDocs(_0x494bd9,_0x58f9f3,_0x57385d,(_0x482bd3,_0x495613,_0x41b164)=>{const _0x477551=_0x27fbab;_0x1827af(_0xccc799(_0x477551(0xda),{'fileName':_0x41b164,'current':_0x482bd3,'total':_0x495613}));},_0x4cc573);_0x4c1aad(_0x44a6bc),_0x166597(!![]);const _0x1d85b4=_0x44a6bc[_0x27fbab(0xca)](_0x152e9b=>_0x152e9b[_0x27fbab(0xd9)])[_0x27fbab(0xec)],_0x219309=_0x44a6bc[_0x27fbab(0xca)](_0xd9b7c0=>!_0xd9b7c0[_0x27fbab(0xd9)])[_0x27fbab(0xec)];logger[_0x27fbab(0xd9)]('api-doc',_0x27fbab(0xf3),undefined,{'totalCount':_0x44a6bc[_0x27fbab(0xec)],'successCount':_0x1d85b4,'failCount':_0x219309,'outputDir':_0x57385d});}catch(_0x59c629){const _0xa85ea8=_0x59c629 instanceof Error?_0x59c629[_0x27fbab(0xc6)]:String(_0x59c629);logger[_0x27fbab(0xed)](_0x27fbab(0xd7),_0x27fbab(0xe4)+_0xa85ea8,{'appCode':_0x58f9f3,'outputDir':_0x57385d}),_0x322744(_0xccc799(_0x27fbab(0xea),{'error':_0xa85ea8}));}finally{_0x2295e9(![]);}}const _0x47a294=_0x2f4e07?.['filter'](_0x477c24=>_0x477c24[_0x363130(0xd9)])[_0x363130(0xec)]||0x0,_0x253f0f=_0x2f4e07?.[_0x363130(0xca)](_0xb67ad2=>!_0xb67ad2[_0x363130(0xd9)])[_0x363130(0xec)]||0x0;return a1_0x214f39(Box,{'flexDirection':_0x363130(0xe2),'children':[(_0x8f99eb||_0x4c4e50)&&a1_0x214f39(Box,{'children':[a1_0x384452(Text,{'color':_0x363130(0xc4),'children':'*\x20'}),a1_0x384452(Text,{'color':_0x59698a?_0x363130(0xcc):'dim','children':_0x1205f1})]}),_0x8f99eb&&a1_0x384452(Box,{'children':a1_0x214f39(Text,{'children':['*\x20',_0x4ba16e]})}),_0x4c4e50&&_0x2f4e07&&a1_0x214f39(Box,{'flexDirection':_0x363130(0xe2),'children':[a1_0x384452(Box,{'children':a1_0x214f39(Text,{'color':_0x363130(0xc5),'children':[_0xccc799(_0x363130(0xde),{'successCount':_0x47a294}),_0x253f0f>0x0?_0xccc799(_0x363130(0xd8),{'failCount':_0x253f0f}):'']})}),a1_0x384452(Box,{'marginTop':0x1,'children':a1_0x384452(Text,{'color':_0x363130(0xc4),'children':_0xccc799(_0x363130(0xd6),{'count':_0x4eb8ea})})}),a1_0x214f39(Box,{'marginTop':0x1,'children':[a1_0x384452(Text,{'color':_0x363130(0xc4),'children':_0xccc799(_0x363130(0xf0))}),a1_0x384452(Text,{'color':_0x363130(0xcf),'children':_0x57385d})]}),_0x47a294>0x0&&a1_0x214f39(a1_0x35b9a6,{'children':[a1_0x384452(Box,{'marginTop':0x1,'children':a1_0x384452(Text,{'color':_0x363130(0xc4),'children':_0xccc799(_0x363130(0xf4))})}),_0x2f4e07['filter'](_0x328f13=>_0x328f13['success'])['map']((_0x1e4ac6,_0x3d4f4d)=>a1_0x214f39(Box,{'marginLeft':0x2,'children':[a1_0x214f39(Text,{'color':_0x363130(0xcf),'children':['•\x20',_0x1e4ac6[_0x363130(0xdd)]]}),a1_0x214f39(Text,{'color':_0x363130(0xe9),'children':['\x20-\x20',_0x1e4ac6['datasetName']]})]},_0x3d4f4d))]}),_0x253f0f>0x0&&a1_0x214f39(a1_0x35b9a6,{'children':[a1_0x384452(Box,{'marginTop':0x1,'children':a1_0x384452(Text,{'color':_0x363130(0xd1),'children':_0xccc799('api.docUI.failedDatasets')})}),_0x2f4e07[_0x363130(0xca)](_0x21a776=>!_0x21a776['success'])[_0x363130(0xfa)]((_0x72b62f,_0x3aa95d)=>a1_0x214f39(Box,{'marginLeft':0x2,'flexDirection':_0x363130(0xe2),'children':[a1_0x214f39(Text,{'color':_0x363130(0xf7),'children':['•\x20',_0x72b62f['datasetName'],'\x20(',_0x72b62f[_0x363130(0xe5)],')']}),_0x72b62f[_0x363130(0xed)]&&a1_0x384452(Box,{'marginLeft':0x2,'children':a1_0x384452(Text,{'color':_0x363130(0xe9),'children':_0x72b62f[_0x363130(0xed)]})})]},_0x3aa95d))]})]}),_0x28ce91&&a1_0x214f39(Box,{'flexDirection':'column','children':[a1_0x384452(Box,{'children':a1_0x214f39(Text,{'color':_0x363130(0xf7),'children':['[ERROR]\x20',_0x28ce91]})}),(_0x28ce91[_0x363130(0xd2)]('登录')||_0x28ce91[_0x363130(0xd2)](_0x363130(0xdc))||_0x28ce91[_0x363130(0xd2)](_0x363130(0xe6)))&&a1_0x214f39(Box,{'marginTop':0x1,'children':[a1_0x384452(Text,{'color':_0x363130(0xd1),'children':'*\x20'}),a1_0x384452(Text,{'color':'cyan','children':'lovrabet\x20auth'}),a1_0x214f39(Text,{'color':_0x363130(0xd1),'children':['\x20',_0xccc799('api.common.authRetry')]})]})]})]});};
@@ -1 +1 @@
1
- const a3_0x547bed=a3_0x3836;(function(_0x138c47,_0x44e9ae){const _0x2ead5a=a3_0x3836,_0x5b9700=_0x138c47();while(!![]){try{const _0x43ba1b=parseInt(_0x2ead5a(0x134))/0x1*(-parseInt(_0x2ead5a(0x120))/0x2)+-parseInt(_0x2ead5a(0x140))/0x3*(-parseInt(_0x2ead5a(0x125))/0x4)+parseInt(_0x2ead5a(0x11d))/0x5*(parseInt(_0x2ead5a(0x11b))/0x6)+-parseInt(_0x2ead5a(0x13a))/0x7*(-parseInt(_0x2ead5a(0x131))/0x8)+parseInt(_0x2ead5a(0x12c))/0x9*(-parseInt(_0x2ead5a(0x122))/0xa)+-parseInt(_0x2ead5a(0x11e))/0xb*(parseInt(_0x2ead5a(0x130))/0xc)+parseInt(_0x2ead5a(0x123))/0xd;if(_0x43ba1b===_0x44e9ae)break;else _0x5b9700['push'](_0x5b9700['shift']());}catch(_0x16e4fb){_0x5b9700['push'](_0x5b9700['shift']());}}}(a3_0x2061,0x83ebd));import{mkdirSync,writeFileSync}from'node:fs';import a3_0x414639 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';function a3_0x3836(_0x3da205,_0x523165){_0x3da205=_0x3da205-0x11a;const _0x2061e8=a3_0x2061();let _0x3836b8=_0x2061e8[_0x3da205];return _0x3836b8;}function a3_0x2061(){const _0x553e99=['api.docBatch.docFormatError','api.docBatch.waiting','32QIIDzf','.md','api-doc','stringify','string','api.common.authExpired','7wwqhpp','error','name','api.docBatch.success','api.docBatch.totalDatasets','length','16782xQBREm','text','生成文档成功:\x20','POST','application/json','1293528kmHaWn','生成文档失败:\x20','15miNqbl','121NUMnAm','bind','31334DinYwh','status','2110JvTpno','17614883jbGAsn','api.docBatch.generating','44GwOOmr','api.docBatch.httpError','markdown','log','push','utf8','join','6381lxmfke','data','datasetCode','api.docBatch.failed','961776pDdsvi','77048cSaDIi'];a3_0x2061=function(){return _0x553e99;};return a3_0x2061();}import a3_0x52ddba from'../i18n/index.js';const t=a3_0x52ddba['t'][a3_0x547bed(0x11f)](a3_0x52ddba);export async function fetchDatasetDoc(_0x4d4bc6){const _0x565917=a3_0x547bed,{appCode:_0x13879b,datasetCode:_0x5df273,datasetId:_0x2869f2,extraParams:_0x5264b1}=_0x4d4bc6,_0x4bede4=getApiDomain(),_0x515f0a=_0x4bede4+'/api/node-toolbox/api-doc-generator',_0x5f2017={'appCode':_0x13879b,'datasetCode':_0x5df273,'datasetId':_0x2869f2,..._0x5264b1||{}},_0x172548=await fetch(_0x515f0a,{'method':_0x565917(0x143),'headers':{'Content-Type':_0x565917(0x11a),'Cookie':getCookie()},'body':JSON[_0x565917(0x137)](_0x5f2017)});if(!_0x172548['ok']){if(_0x172548[_0x565917(0x121)]===0x191)throw new Error(t(_0x565917(0x139)));let _0x468786='';try{_0x468786=await _0x172548[_0x565917(0x141)]();}catch(_0x57b963){}throw new Error(''+t(_0x565917(0x126),{'datasetCode':_0x5df273,'status':_0x172548['status']})+(_0x468786?'\x0a'+_0x468786:''));}const _0x4f3561=await _0x172548['json']();if(!_0x4f3561[_0x565917(0x12d)]||typeof _0x4f3561[_0x565917(0x12d)][_0x565917(0x127)]!==_0x565917(0x138))throw new Error(t(_0x565917(0x132),{'datasetCode':_0x5df273}));return _0x4f3561[_0x565917(0x12d)]['markdown'];}function delay(_0x35826f){return new Promise(_0x3b4314=>setTimeout(_0x3b4314,_0x35826f));}export async function generateDatasetDocs(_0x41056b,_0x10a389,_0x488f46='./docs',_0x596969,_0x355419){const _0x431909=a3_0x547bed;mkdirSync(_0x488f46,{'recursive':!![]});const _0x5277fb=[],_0x103564=_0x41056b[_0x431909(0x13f)];console[_0x431909(0x128)](t(_0x431909(0x13e),{'count':_0x103564}));for(let _0x3ffdbf=0x0;_0x3ffdbf<_0x41056b[_0x431909(0x13f)];_0x3ffdbf++){const _0x47b75b=_0x41056b[_0x3ffdbf],_0x388f33=_0x3ffdbf+0x1,_0x5be2b2=_0x47b75b['tableName'];try{console[_0x431909(0x128)](t(_0x431909(0x124),{'current':_0x388f33,'total':_0x103564,'fileName':_0x5be2b2,'name':_0x47b75b['name']}));_0x596969&&_0x596969(_0x388f33,_0x103564,_0x5be2b2);const _0x4b0129=await fetchDatasetDoc({'appCode':_0x10a389,'datasetCode':_0x47b75b[_0x431909(0x12e)],'datasetId':_0x47b75b['id'],'enableAI':![],'extraParams':_0x355419}),_0x2674cb=a3_0x414639[_0x431909(0x12b)](_0x488f46,_0x5be2b2+_0x431909(0x135));writeFileSync(_0x2674cb,_0x4b0129,{'encoding':_0x431909(0x12a)}),console[_0x431909(0x128)](t(_0x431909(0x13d),{'fileName':_0x5be2b2})),logger['success'](_0x431909(0x136),_0x431909(0x142)+_0x5be2b2,undefined,{'datasetCode':_0x47b75b[_0x431909(0x12e)],'datasetName':_0x47b75b[_0x431909(0x13c)],'filePath':_0x2674cb,'progress':_0x388f33+'/'+_0x103564}),_0x5277fb['push']({'datasetCode':_0x47b75b[_0x431909(0x12e)],'datasetName':_0x47b75b[_0x431909(0x13c)],'filePath':_0x2674cb,'success':!![]}),_0x388f33<_0x103564&&await delay(0x1388);}catch(_0x3a1c70){const _0x4ecadc=_0x3a1c70 instanceof Error?_0x3a1c70['message']:String(_0x3a1c70);console[_0x431909(0x128)](t(_0x431909(0x12f),{'fileName':_0x5be2b2,'error':_0x4ecadc})),logger[_0x431909(0x13b)](_0x431909(0x136),_0x431909(0x11c)+_0x47b75b[_0x431909(0x12e)],{'datasetCode':_0x47b75b[_0x431909(0x12e)],'datasetName':_0x47b75b[_0x431909(0x13c)],'error':_0x4ecadc,'progress':_0x388f33+'/'+_0x103564}),_0x5277fb[_0x431909(0x129)]({'datasetCode':_0x47b75b[_0x431909(0x12e)],'datasetName':_0x47b75b[_0x431909(0x13c)],'filePath':'','success':![],'error':_0x4ecadc}),_0x388f33<_0x103564&&(console[_0x431909(0x128)](t(_0x431909(0x133))),await delay(0xbb8));}}return _0x5277fb;}
1
+ const a2_0x448f0d=a2_0x35b6;function a2_0x35b6(_0x30a4eb,_0x1b1b2d){_0x30a4eb=_0x30a4eb-0xd6;const _0x9331c1=a2_0x9331();let _0x35b63e=_0x9331c1[_0x30a4eb];return _0x35b63e;}(function(_0xf41a24,_0x140a90){const _0x2c8b50=a2_0x35b6,_0x3cc682=_0xf41a24();while(!![]){try{const _0x106b9e=parseInt(_0x2c8b50(0xd8))/0x1+-parseInt(_0x2c8b50(0xfa))/0x2+parseInt(_0x2c8b50(0xda))/0x3+parseInt(_0x2c8b50(0xed))/0x4+-parseInt(_0x2c8b50(0xdf))/0x5*(-parseInt(_0x2c8b50(0xec))/0x6)+-parseInt(_0x2c8b50(0xf4))/0x7+parseInt(_0x2c8b50(0xdb))/0x8*(-parseInt(_0x2c8b50(0xe1))/0x9);if(_0x106b9e===_0x140a90)break;else _0x3cc682['push'](_0x3cc682['shift']());}catch(_0x17042f){_0x3cc682['push'](_0x3cc682['shift']());}}}(a2_0x9331,0x5d546));import{mkdirSync,writeFileSync}from'node:fs';function a2_0x9331(){const _0x379035=['.md','158025gRlVqS','error','name','api.docBatch.totalDatasets','api.docBatch.waiting','/api/node-toolbox/api-doc-generator','109434DiajPQ','api.docBatch.failed','push','109942CZdzIN','api.docBatch.success','2011596Yiqjeh','24ViUuLK','api.docBatch.generating','tableName','markdown','10epbZoT','生成文档失败:\x20','4160358VaCfHh','join','success','status','log','length','./docs','message','api-doc','生成文档成功:\x20','api.common.authExpired','1290834NBreGm','2542416uLiVKo','utf8','json','api.docBatch.httpError','data','datasetCode'];a2_0x9331=function(){return _0x379035;};return a2_0x9331();}import a2_0x180155 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';import a2_0x4274d9 from'../i18n/index.js';const t=a2_0x4274d9['t']['bind'](a2_0x4274d9);export async function fetchDatasetDoc(_0x18f54f){const _0x480b2=a2_0x35b6,{appCode:_0x32843f,datasetCode:_0xedfac2,datasetId:_0x39feb7,extraParams:_0x246278}=_0x18f54f,_0x469f86=getApiDomain(),_0x35f5ed=_0x469f86+_0x480b2(0xf9),_0xc21024={'appCode':_0x32843f,'datasetCode':_0xedfac2,'datasetId':_0x39feb7,..._0x246278||{}},_0x365f35=await fetch(_0x35f5ed,{'method':'POST','headers':{'Content-Type':'application/json','Cookie':getCookie()},'body':JSON['stringify'](_0xc21024)});if(!_0x365f35['ok']){if(_0x365f35[_0x480b2(0xe4)]===0x191)throw new Error(t(_0x480b2(0xeb)));let _0x53abf5='';try{_0x53abf5=await _0x365f35['text']();}catch(_0x41037a){}throw new Error(''+t(_0x480b2(0xf0),{'datasetCode':_0xedfac2,'status':_0x365f35['status']})+(_0x53abf5?'\x0a'+_0x53abf5:''));}const _0x517d07=await _0x365f35[_0x480b2(0xef)]();if(!_0x517d07[_0x480b2(0xf1)]||typeof _0x517d07[_0x480b2(0xf1)][_0x480b2(0xde)]!=='string')throw new Error(t('api.docBatch.docFormatError',{'datasetCode':_0xedfac2}));return _0x517d07['data'][_0x480b2(0xde)];}function delay(_0x437cb7){return new Promise(_0x3060af=>setTimeout(_0x3060af,_0x437cb7));}export async function generateDatasetDocs(_0x2ba9a3,_0x167357,_0x28ad81=a2_0x448f0d(0xe7),_0x2c76aa,_0x14cc74){const _0x151b30=a2_0x448f0d;mkdirSync(_0x28ad81,{'recursive':!![]});const _0xb82f4d=[],_0x395f1d=_0x2ba9a3[_0x151b30(0xe6)];console[_0x151b30(0xe5)](t(_0x151b30(0xf7),{'count':_0x395f1d}));for(let _0x10add8=0x0;_0x10add8<_0x2ba9a3[_0x151b30(0xe6)];_0x10add8++){const _0x5526d3=_0x2ba9a3[_0x10add8],_0x334019=_0x10add8+0x1,_0x3e1730=_0x5526d3[_0x151b30(0xdd)];try{console[_0x151b30(0xe5)](t(_0x151b30(0xdc),{'current':_0x334019,'total':_0x395f1d,'fileName':_0x3e1730,'name':_0x5526d3['name']}));_0x2c76aa&&_0x2c76aa(_0x334019,_0x395f1d,_0x3e1730);const _0x4b7fa9=await fetchDatasetDoc({'appCode':_0x167357,'datasetCode':_0x5526d3[_0x151b30(0xf2)],'datasetId':_0x5526d3['id'],'enableAI':![],'extraParams':_0x14cc74}),_0x339ff9=a2_0x180155[_0x151b30(0xe2)](_0x28ad81,_0x3e1730+_0x151b30(0xf3));writeFileSync(_0x339ff9,_0x4b7fa9,{'encoding':_0x151b30(0xee)}),console[_0x151b30(0xe5)](t(_0x151b30(0xd9),{'fileName':_0x3e1730})),logger[_0x151b30(0xe3)](_0x151b30(0xe9),_0x151b30(0xea)+_0x3e1730,undefined,{'datasetCode':_0x5526d3[_0x151b30(0xf2)],'datasetName':_0x5526d3['name'],'filePath':_0x339ff9,'progress':_0x334019+'/'+_0x395f1d}),_0xb82f4d[_0x151b30(0xd7)]({'datasetCode':_0x5526d3['datasetCode'],'datasetName':_0x5526d3[_0x151b30(0xf6)],'filePath':_0x339ff9,'success':!![]}),_0x334019<_0x395f1d&&await delay(0x1388);}catch(_0x2499d2){const _0x1ade70=_0x2499d2 instanceof Error?_0x2499d2[_0x151b30(0xe8)]:String(_0x2499d2);console[_0x151b30(0xe5)](t(_0x151b30(0xd6),{'fileName':_0x3e1730,'error':_0x1ade70})),logger[_0x151b30(0xf5)](_0x151b30(0xe9),_0x151b30(0xe0)+_0x5526d3[_0x151b30(0xf2)],{'datasetCode':_0x5526d3[_0x151b30(0xf2)],'datasetName':_0x5526d3[_0x151b30(0xf6)],'error':_0x1ade70,'progress':_0x334019+'/'+_0x395f1d}),_0xb82f4d[_0x151b30(0xd7)]({'datasetCode':_0x5526d3[_0x151b30(0xf2)],'datasetName':_0x5526d3['name'],'filePath':'','success':![],'error':_0x1ade70}),_0x334019<_0x395f1d&&(console[_0x151b30(0xe5)](t(_0x151b30(0xf8))),await delay(0xbb8));}}return _0xb82f4d;}
@@ -1 +1 @@
1
- (function(_0x3e1c2b,_0xbd30c1){const _0x33e68d=a4_0x31b3,_0x16874d=_0x3e1c2b();while(!![]){try{const _0x4388d8=-parseInt(_0x33e68d(0x130))/0x1+parseInt(_0x33e68d(0x13a))/0x2+-parseInt(_0x33e68d(0x142))/0x3+-parseInt(_0x33e68d(0x143))/0x4*(parseInt(_0x33e68d(0x12e))/0x5)+-parseInt(_0x33e68d(0x136))/0x6+-parseInt(_0x33e68d(0x14a))/0x7*(-parseInt(_0x33e68d(0x141))/0x8)+-parseInt(_0x33e68d(0x144))/0x9*(-parseInt(_0x33e68d(0x152))/0xa);if(_0x4388d8===_0xbd30c1)break;else _0x16874d['push'](_0x16874d['shift']());}catch(_0xdd5664){_0x16874d['push'](_0x16874d['shift']());}}}(a4_0x4c95,0x84bb1));import{jsx as a4_0xedb1f8,jsxs as a4_0x5c92cf}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';function a4_0x4c95(){const _0x35cd46=['5xdhuxV','import\x20','1029006bXqsyM','yellow','message','cyan','dim','includes','809706CtzrvP','column','拉取\x20API\x20配置失败:\x20','api.pullUI.clientFile','345962yBdZdG','duplicateCount','originalCount','white','client','api.common.authRetry','lovrabet\x20auth','8ZmLuwZ','2368551RSRDQf','786248YdgBrz','7346727SpqYbm','[ERROR]\x20','api.common.usingDefaultAppCode','env','gray','setLogPath','6216798fGOHxa','api','api.pullUI.modelFile','api.common.usingSpecifiedAppCode','string','.ts','endsWith','./src/api/','20ktiXoM','-client','slice','{\x20lovrabetClient\x20}','online','cwd','api-pull','api.pullUI.importHint','api.pullUI.successPull','length','replace','datasetCount','api.pullUI.generatedFiles','\x20from\x20\x27@/','Authentication','green','-api','red','api.common.noAppCodeDefault','error','join'];a4_0x4c95=function(){return _0x35cd46;};return a4_0x4c95();}import{fetchModelList}from'./fetch-model-list.js';function a4_0x31b3(_0x38d50a,_0x13c7c9){_0x38d50a=_0x38d50a-0x11c;const _0x4c950f=a4_0x4c95();let _0x31b391=_0x4c950f[_0x38d50a];return _0x31b391;}import{useI18n}from'../i18n/hooks.js';export const ApiPullUI=({appCode:_0xa84bf1,env:_0x1082ec,output:_0x2a174d})=>{const _0x1f646e=a4_0x31b3,{exit:_0x211c63}=useApp(),{t:_0x1e73e8}=useI18n(),[_0x5c9b08,_0x3079fc]=useState(![]),[_0x4dc361,_0x14aa85]=useState(![]),[_0x9f2c74,_0x4d950f]=useState(null),[_0x58d5c6,_0x2e3e0f]=useState(null),_0x27d434=readConfig(),_0x27e753=getConfigAppCode(),_0x5400b5=_0xa84bf1||_0x27e753,_0x5e8fac=typeof _0x27d434?.[_0x1f646e(0x147)]===_0x1f646e(0x14e)?_0x27d434[_0x1f646e(0x147)]:undefined,_0x56fd5d=_0x1082ec||_0x5e8fac||_0x1f646e(0x11d);initEnv(_0x56fd5d);const _0x18719b=_0x2a174d||_0x1f646e(0x151),_0x463332=_0xa84bf1&&_0xa84bf1['includes']('-')?_0xa84bf1['split']('-')[_0x1f646e(0x154)](0x1)[_0x1f646e(0x12d)]('-'):'',_0x1d5af2=_0xa84bf1?_0x1e73e8(_0x1f646e(0x14d),{'appCode':_0x5400b5}):_0x1e73e8(_0x1f646e(0x146),{'appCode':_0x5400b5}),_0x438ea5=_0x463332?_0x463332+_0x1f646e(0x129):_0x1f646e(0x14b),_0x3ab574=_0x463332?_0x463332+_0x1f646e(0x153):'client';useEffect(()=>{_0x3079fc(!![]),_0x215982();},[]),useEffect(()=>{(_0x4dc361||_0x9f2c74)&&_0x211c63();},[_0x4dc361,_0x9f2c74,_0x211c63]);async function _0x215982(){const _0x42210b=_0x1f646e;if(!_0x5400b5){_0x4d950f(_0x1e73e8(_0x42210b(0x12b)));return;}try{logger[_0x42210b(0x149)](process[_0x42210b(0x11e)]());const {configArray:_0x48eaa1}=await fetchModelList(_0x5400b5),_0xd9a352=_0x48eaa1[_0x42210b(0x122)],_0x1e5533=!_0xa84bf1,_0x5ad809=await generateApiFile(_0x48eaa1,_0x463332,_0x5400b5,_0x1e5533,_0x56fd5d,_0x18719b),_0x2399b5=_0x18719b[_0x42210b(0x150)]('/')?_0x18719b:_0x18719b+'/';_0x2e3e0f({'api':''+_0x2399b5+_0x438ea5+_0x42210b(0x14f),'client':''+_0x2399b5+_0x3ab574+'.ts','modelCount':_0x5ad809['modelCount'],'datasetCount':_0xd9a352,'originalCount':_0xd9a352,'duplicateCount':0x0}),_0x14aa85(!![]);}catch(_0x548118){const _0x5efe67=_0x548118 instanceof Error?_0x548118[_0x42210b(0x132)]:String(_0x548118);logger[_0x42210b(0x12c)](_0x42210b(0x11f),_0x42210b(0x138)+_0x5efe67,{'appCode':_0x5400b5,'error':_0x5efe67}),_0x4d950f(_0x1e73e8('api.pullUI.pullFailed',{'error':_0x5efe67}));}finally{_0x3079fc(![]);}}return a4_0x5c92cf(Box,{'flexDirection':_0x1f646e(0x137),'children':[(_0x5c9b08||_0x4dc361)&&a4_0x5c92cf(Box,{'children':[a4_0xedb1f8(Text,{'color':_0x1f646e(0x148),'children':'*\x20'}),a4_0xedb1f8(Text,{'color':_0xa84bf1?_0x1f646e(0x13d):_0x1f646e(0x134),'children':_0x1d5af2})]}),_0x5c9b08&&a4_0xedb1f8(Box,{'children':a4_0xedb1f8(Text,{'children':_0x1e73e8('api.pullUI.fetching',{'env':_0x56fd5d})})}),_0x4dc361&&_0x58d5c6&&a4_0x5c92cf(Box,{'flexDirection':'column','children':[a4_0xedb1f8(Box,{'children':a4_0xedb1f8(Text,{'color':_0x1f646e(0x128),'children':_0x1e73e8(_0x1f646e(0x121),{'datasetCount':_0x58d5c6[_0x1f646e(0x124)],'modelCount':_0x58d5c6['modelCount']})})}),_0x58d5c6[_0x1f646e(0x13b)]>0x0&&a4_0xedb1f8(Box,{'marginTop':0x1,'children':a4_0xedb1f8(Text,{'color':_0x1f646e(0x131),'children':_0x1e73e8('api.pullUI.duplicateInfo',{'originalCount':_0x58d5c6[_0x1f646e(0x13c)],'duplicateCount':_0x58d5c6[_0x1f646e(0x13b)]})})}),a4_0xedb1f8(Box,{'marginTop':0x1,'children':a4_0xedb1f8(Text,{'color':'gray','children':_0x1e73e8(_0x1f646e(0x125))})}),a4_0x5c92cf(Box,{'marginLeft':0x2,'children':[a4_0x5c92cf(Text,{'color':_0x1f646e(0x133),'children':['•\x20',_0x58d5c6['api']]}),a4_0x5c92cf(Text,{'color':_0x1f646e(0x134),'children':['\x20',_0x1e73e8(_0x1f646e(0x14c),{'count':_0x58d5c6['modelCount']})]})]}),a4_0x5c92cf(Box,{'marginLeft':0x2,'children':[a4_0x5c92cf(Text,{'color':'cyan','children':['•\x20',_0x58d5c6[_0x1f646e(0x13e)]]}),a4_0x5c92cf(Text,{'color':_0x1f646e(0x134),'children':['\x20',_0x1e73e8(_0x1f646e(0x139))]})]}),a4_0xedb1f8(Box,{'marginTop':0x1,'children':a4_0xedb1f8(Text,{'color':'gray','children':_0x1e73e8(_0x1f646e(0x120))})}),a4_0xedb1f8(Box,{'marginLeft':0x2,'children':a4_0x5c92cf(Text,{'color':_0x1f646e(0x131),'children':[_0x1f646e(0x12f),_0x1f646e(0x11c),_0x1f646e(0x126),_0x58d5c6[_0x1f646e(0x13e)][_0x1f646e(0x123)](/^\.\//,'')[_0x1f646e(0x123)](_0x1f646e(0x14f),''),'\x27']})})]}),_0x9f2c74&&a4_0x5c92cf(Box,{'flexDirection':_0x1f646e(0x137),'children':[a4_0xedb1f8(Box,{'children':a4_0x5c92cf(Text,{'color':_0x1f646e(0x12a),'children':[_0x1f646e(0x145),_0x9f2c74]})}),(_0x9f2c74['includes']('登录')||_0x9f2c74[_0x1f646e(0x135)](_0x1f646e(0x127))||_0x9f2c74[_0x1f646e(0x135)]('expired'))&&a4_0x5c92cf(Box,{'marginTop':0x1,'children':[a4_0xedb1f8(Text,{'color':_0x1f646e(0x131),'children':'*\x20'}),a4_0xedb1f8(Text,{'color':_0x1f646e(0x133),'children':_0x1f646e(0x140)}),a4_0x5c92cf(Text,{'color':_0x1f646e(0x131),'children':['\x20',_0x1e73e8(_0x1f646e(0x13f))]})]})]})]});};
1
+ (function(_0x415a74,_0x1750e2){const _0x404f2b=a3_0x45ed,_0x8b44dc=_0x415a74();while(!![]){try{const _0x17c1ce=-parseInt(_0x404f2b(0xa7))/0x1+parseInt(_0x404f2b(0x86))/0x2+-parseInt(_0x404f2b(0xaa))/0x3+parseInt(_0x404f2b(0x9e))/0x4+parseInt(_0x404f2b(0xad))/0x5*(parseInt(_0x404f2b(0x90))/0x6)+-parseInt(_0x404f2b(0x92))/0x7*(parseInt(_0x404f2b(0x9c))/0x8)+parseInt(_0x404f2b(0xa6))/0x9;if(_0x17c1ce===_0x1750e2)break;else _0x8b44dc['push'](_0x8b44dc['shift']());}catch(_0x27f9a4){_0x8b44dc['push'](_0x8b44dc['shift']());}}}(a3_0x59b4,0x6814d));import{jsx as a3_0x1dd1c8,jsxs as a3_0x4003b1}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';function a3_0x59b4(){const _0x23b903=['env','expired','white','datasetCount','string','import\x20','./src/api/','75526LYRNnn','split','.ts','Authentication','api.common.noAppCodeDefault','lovrabet\x20auth','setLogPath','-api','column','message','3592782lPbenj','api-pull','35zbmKhZ','gray','duplicateCount','red','dim','api.pullUI.modelFile','{\x20lovrabetClient\x20}','\x20from\x20\x27@/','api.common.authRetry','modelCount','1275256kYQxod','api.pullUI.importHint','35596uXSHAG','originalCount','join','api.pullUI.duplicateInfo','api.pullUI.clientFile','cyan','api.pullUI.pullFailed','length','14680674zEZtRG','276338Cdxmgw','replace','client','2330865xNLiDC','api.pullUI.generatedFiles','api.common.usingSpecifiedAppCode','5jeXtBY','yellow','api','green','production','includes','api.common.usingDefaultAppCode','cwd'];a3_0x59b4=function(){return _0x23b903;};return a3_0x59b4();}import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a3_0x45ed(_0x1de2e1,_0x5dfe30){_0x1de2e1=_0x1de2e1-0x78;const _0x59b44c=a3_0x59b4();let _0x45ed17=_0x59b44c[_0x1de2e1];return _0x45ed17;}import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';import{useI18n}from'../i18n/hooks.js';export const ApiPullUI=({appCode:_0x59b683,env:_0x248fd8,output:_0x13a662})=>{const _0x6d6580=a3_0x45ed,{exit:_0xa68750}=useApp(),{t:_0x339e17}=useI18n(),[_0x2bee63,_0x279469]=useState(![]),[_0x177025,_0x3a76ad]=useState(![]),[_0x11cfda,_0x37c7bd]=useState(null),[_0x49c0ae,_0x57fd7e]=useState(null),_0x57e906=readConfig(),_0x58fe8e=getConfigAppCode(),_0x43dfa1=_0x59b683||_0x58fe8e,_0x4c1ebc=typeof _0x57e906?.[_0x6d6580(0x7f)]===_0x6d6580(0x83)?_0x57e906[_0x6d6580(0x7f)]:undefined,_0x439630=_0x248fd8||_0x4c1ebc||_0x6d6580(0x7b);initEnv(_0x439630);const _0x56e2c5=_0x13a662||_0x6d6580(0x85),_0x48eb7c=_0x59b683&&_0x59b683[_0x6d6580(0x7c)]('-')?_0x59b683[_0x6d6580(0x87)]('-')['slice'](0x1)[_0x6d6580(0xa0)]('-'):'',_0x469fc8=_0x59b683?_0x339e17(_0x6d6580(0xac),{'appCode':_0x43dfa1}):_0x339e17(_0x6d6580(0x7d),{'appCode':_0x43dfa1}),_0x2869a7=_0x48eb7c?_0x48eb7c+_0x6d6580(0x8d):'api',_0x5b3894=_0x48eb7c?_0x48eb7c+'-client':_0x6d6580(0xa9);useEffect(()=>{_0x279469(!![]),_0x2f8dba();},[]),useEffect(()=>{(_0x177025||_0x11cfda)&&_0xa68750();},[_0x177025,_0x11cfda,_0xa68750]);async function _0x2f8dba(){const _0x4944ed=_0x6d6580;if(!_0x43dfa1){_0x37c7bd(_0x339e17(_0x4944ed(0x8a)));return;}try{logger[_0x4944ed(0x8c)](process[_0x4944ed(0x7e)]());const {configArray:_0x207f6f}=await fetchModelList(_0x43dfa1),_0xcbf016=_0x207f6f[_0x4944ed(0xa5)],_0x4e3bb4=!_0x59b683,_0xfd3a7e=await generateApiFile(_0x207f6f,_0x48eb7c,_0x43dfa1,_0x4e3bb4,_0x439630,_0x56e2c5),_0x5d0d51=_0x56e2c5['endsWith']('/')?_0x56e2c5:_0x56e2c5+'/';_0x57fd7e({'api':''+_0x5d0d51+_0x2869a7+_0x4944ed(0x88),'client':''+_0x5d0d51+_0x5b3894+_0x4944ed(0x88),'modelCount':_0xfd3a7e['modelCount'],'datasetCount':_0xcbf016,'originalCount':_0xcbf016,'duplicateCount':0x0}),_0x3a76ad(!![]);}catch(_0x304ba8){const _0x22d5d4=_0x304ba8 instanceof Error?_0x304ba8[_0x4944ed(0x8f)]:String(_0x304ba8);logger['error'](_0x4944ed(0x91),'拉取\x20API\x20配置失败:\x20'+_0x22d5d4,{'appCode':_0x43dfa1,'error':_0x22d5d4}),_0x37c7bd(_0x339e17(_0x4944ed(0xa4),{'error':_0x22d5d4}));}finally{_0x279469(![]);}}return a3_0x4003b1(Box,{'flexDirection':'column','children':[(_0x2bee63||_0x177025)&&a3_0x4003b1(Box,{'children':[a3_0x1dd1c8(Text,{'color':_0x6d6580(0x93),'children':'*\x20'}),a3_0x1dd1c8(Text,{'color':_0x59b683?_0x6d6580(0x81):_0x6d6580(0x96),'children':_0x469fc8})]}),_0x2bee63&&a3_0x1dd1c8(Box,{'children':a3_0x1dd1c8(Text,{'children':_0x339e17('api.pullUI.fetching',{'env':_0x439630})})}),_0x177025&&_0x49c0ae&&a3_0x4003b1(Box,{'flexDirection':_0x6d6580(0x8e),'children':[a3_0x1dd1c8(Box,{'children':a3_0x1dd1c8(Text,{'color':_0x6d6580(0x7a),'children':_0x339e17('api.pullUI.successPull',{'datasetCount':_0x49c0ae[_0x6d6580(0x82)],'modelCount':_0x49c0ae['modelCount']})})}),_0x49c0ae['duplicateCount']>0x0&&a3_0x1dd1c8(Box,{'marginTop':0x1,'children':a3_0x1dd1c8(Text,{'color':_0x6d6580(0x78),'children':_0x339e17(_0x6d6580(0xa1),{'originalCount':_0x49c0ae[_0x6d6580(0x9f)],'duplicateCount':_0x49c0ae[_0x6d6580(0x94)]})})}),a3_0x1dd1c8(Box,{'marginTop':0x1,'children':a3_0x1dd1c8(Text,{'color':_0x6d6580(0x93),'children':_0x339e17(_0x6d6580(0xab))})}),a3_0x4003b1(Box,{'marginLeft':0x2,'children':[a3_0x4003b1(Text,{'color':_0x6d6580(0xa3),'children':['•\x20',_0x49c0ae[_0x6d6580(0x79)]]}),a3_0x4003b1(Text,{'color':_0x6d6580(0x96),'children':['\x20',_0x339e17(_0x6d6580(0x97),{'count':_0x49c0ae[_0x6d6580(0x9b)]})]})]}),a3_0x4003b1(Box,{'marginLeft':0x2,'children':[a3_0x4003b1(Text,{'color':'cyan','children':['•\x20',_0x49c0ae[_0x6d6580(0xa9)]]}),a3_0x4003b1(Text,{'color':_0x6d6580(0x96),'children':['\x20',_0x339e17(_0x6d6580(0xa2))]})]}),a3_0x1dd1c8(Box,{'marginTop':0x1,'children':a3_0x1dd1c8(Text,{'color':_0x6d6580(0x93),'children':_0x339e17(_0x6d6580(0x9d))})}),a3_0x1dd1c8(Box,{'marginLeft':0x2,'children':a3_0x4003b1(Text,{'color':'yellow','children':[_0x6d6580(0x84),_0x6d6580(0x98),_0x6d6580(0x99),_0x49c0ae[_0x6d6580(0xa9)]['replace'](/^\.\//,'')[_0x6d6580(0xa8)](_0x6d6580(0x88),''),'\x27']})})]}),_0x11cfda&&a3_0x4003b1(Box,{'flexDirection':'column','children':[a3_0x1dd1c8(Box,{'children':a3_0x4003b1(Text,{'color':_0x6d6580(0x95),'children':['[ERROR]\x20',_0x11cfda]})}),(_0x11cfda[_0x6d6580(0x7c)]('登录')||_0x11cfda[_0x6d6580(0x7c)](_0x6d6580(0x89))||_0x11cfda[_0x6d6580(0x7c)](_0x6d6580(0x80)))&&a3_0x4003b1(Box,{'marginTop':0x1,'children':[a3_0x1dd1c8(Text,{'color':_0x6d6580(0x78),'children':'*\x20'}),a3_0x1dd1c8(Text,{'color':_0x6d6580(0xa3),'children':_0x6d6580(0x8b)}),a3_0x4003b1(Text,{'color':'yellow','children':['\x20',_0x339e17(_0x6d6580(0x9a))]})]})]})]});};
@@ -1 +1 @@
1
- const a5_0xc001e3=a5_0x4a75;(function(_0x55f9ae,_0x32088a){const _0x42737c=a5_0x4a75,_0x152412=_0x55f9ae();while(!![]){try{const _0x1572ec=parseInt(_0x42737c(0x1e7))/0x1*(-parseInt(_0x42737c(0x1fd))/0x2)+parseInt(_0x42737c(0x1ea))/0x3*(parseInt(_0x42737c(0x200))/0x4)+parseInt(_0x42737c(0x1f0))/0x5*(-parseInt(_0x42737c(0x1f6))/0x6)+-parseInt(_0x42737c(0x1f4))/0x7+parseInt(_0x42737c(0x1f9))/0x8*(parseInt(_0x42737c(0x1ee))/0x9)+parseInt(_0x42737c(0x1ef))/0xa+parseInt(_0x42737c(0x1f5))/0xb;if(_0x1572ec===_0x32088a)break;else _0x152412['push'](_0x152412['shift']());}catch(_0x1132ef){_0x152412['push'](_0x152412['shift']());}}}(a5_0x3658,0x9c5ba));import{getCookie}from'../auth/get-cookie.js';function a5_0x3658(){const _0x20f93d=['7417848GUyJoS','bind','code','message','262456ZdJUwk','json','name','64yDEDsO','replace','/api/node-toolbox/dataset/model-list?appcode=','includes','errorCode','api.common.authExpired','configArray','2eYxySR','401','UNAUTHORIZED','25278gziKmJ','success','data','length','9BlEYez','7971990nCELXU','900175Cpuiml','&otype=array','api.common.unknownError','api.fetchModel.fetchError','8548596wLkwcf','8854835dFywuG','18UDZIOG','status','map'];a5_0x3658=function(){return _0x20f93d;};return a5_0x3658();}import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';import a5_0x31af06 from'../i18n/index.js';const t=a5_0x31af06['t'][a5_0xc001e3(0x1fa)](a5_0x31af06);function cleanNewlines(_0x2d74f9){const _0x2f43e7=a5_0xc001e3;return _0x2d74f9[_0x2f43e7(0x201)](/[\r\n]+/g,'\x20')['trim']();}function cleanDatasetName(_0x237e6e){const _0x5cd526=a5_0xc001e3;if(!_0x237e6e[_0x5cd526(0x1ff)])return _0x237e6e;return{..._0x237e6e,'name':cleanNewlines(_0x237e6e[_0x5cd526(0x1ff)])};}function a5_0x4a75(_0x51ed04,_0x5344cc){_0x51ed04=_0x51ed04-0x1e4;const _0x3658e1=a5_0x3658();let _0x4a752d=_0x3658e1[_0x51ed04];return _0x4a752d;}function cleanDatasetNames(_0x462bb6){const _0x12d68f=a5_0xc001e3;return _0x462bb6[_0x12d68f(0x1f8)](cleanDatasetName);}export async function fetchModelList(_0x57e97c){const _0x20878c=a5_0xc001e3,_0x20c30b=getEnv(),_0x4099af=getApiDomain()+_0x20878c(0x202)+_0x57e97c+_0x20878c(0x1f1);logger['info']('fetch-model-list','正在从服务器拉取模型列表...\x20(环境:\x20'+_0x20c30b+')',{'apiUrl':_0x4099af});const _0x3612d2=await fetch(_0x4099af,{'headers':{'Cookie':getCookie()}});if(!_0x3612d2['ok']){if(_0x3612d2[_0x20878c(0x1f7)]===0x191)throw new Error(t(_0x20878c(0x1e5)));throw new Error(t('api.fetchModel.httpError',{'status':_0x3612d2[_0x20878c(0x1f7)]}));}const _0x14586e=await _0x3612d2[_0x20878c(0x1fe)]();if(!_0x14586e[_0x20878c(0x1eb)]){const _0x296d52=_0x14586e['errorMsg']||_0x14586e[_0x20878c(0x1fc)]||_0x14586e['data']?.[_0x20878c(0x1fc)]||_0x14586e['errorMessage']||_0x14586e['error']||t(_0x20878c(0x1f2));if(_0x296d52['includes']('401')||_0x296d52[_0x20878c(0x203)]('Unauthorized')||_0x296d52[_0x20878c(0x203)]('登录')||_0x296d52[_0x20878c(0x203)]('认证')||_0x14586e[_0x20878c(0x1e4)]===_0x20878c(0x1e9)||_0x14586e['code']===0x191||_0x14586e[_0x20878c(0x1fb)]===_0x20878c(0x1e8))throw new Error(t('api.common.authExpired'));throw new Error(t(_0x20878c(0x1f3),{'error':_0x296d52}));}const _0x595ac2=cleanDatasetNames(_0x14586e[_0x20878c(0x1ec)][_0x20878c(0x1e6)]);return{'configArray':_0x595ac2,'count':_0x595ac2[_0x20878c(0x1ed)]};}
1
+ const a4_0x54e710=a4_0x2d0c;(function(_0x4fa289,_0x2501ed){const _0x203a22=a4_0x2d0c,_0x2b1d3c=_0x4fa289();while(!![]){try{const _0xd51e2f=-parseInt(_0x203a22(0x12e))/0x1+parseInt(_0x203a22(0x116))/0x2*(parseInt(_0x203a22(0x127))/0x3)+parseInt(_0x203a22(0x11a))/0x4+-parseInt(_0x203a22(0x126))/0x5*(parseInt(_0x203a22(0x11e))/0x6)+parseInt(_0x203a22(0x11b))/0x7*(-parseInt(_0x203a22(0x122))/0x8)+-parseInt(_0x203a22(0x125))/0x9+parseInt(_0x203a22(0x129))/0xa*(parseInt(_0x203a22(0x121))/0xb);if(_0xd51e2f===_0x2501ed)break;else _0x2b1d3c['push'](_0x2b1d3c['shift']());}catch(_0x40a955){_0x2b1d3c['push'](_0x2b1d3c['shift']());}}}(a4_0x23b1,0xa3f21));function a4_0x2d0c(_0x5376a1,_0x21db1e){_0x5376a1=_0x5376a1-0x114;const _0x23b1f3=a4_0x23b1();let _0x2d0c15=_0x23b1f3[_0x5376a1];return _0x2d0c15;}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';function a4_0x23b1(){const _0x24756a=['error','Unauthorized','fetch-model-list','map','2zYoTyz','replace','data','message','988080fIAnOJ','6684937xfZBTE','正在从服务器拉取模型列表...\x20(环境:\x20','api.fetchModel.httpError','12216ewjvsn','api.fetchModel.fetchError','success','11giJwHM','8rDmrFj','configArray','bind','4678605BnXWxu','695kwIDXz','3239487eWOqCk','api.common.authExpired','17128950VLbsoL','errorCode','includes','UNAUTHORIZED','status','610383oddeQj','401','errorMsg','json','/api/node-toolbox/dataset/model-list?appcode=','length','errorMessage','name','code','api.common.unknownError'];a4_0x23b1=function(){return _0x24756a;};return a4_0x23b1();}import a4_0xede180 from'../i18n/index.js';const t=a4_0xede180['t'][a4_0x54e710(0x124)](a4_0xede180);function cleanNewlines(_0x5a4fc3){const _0x4b3805=a4_0x54e710;return _0x5a4fc3[_0x4b3805(0x117)](/[\r\n]+/g,'\x20')['trim']();}function cleanDatasetName(_0x4b34bb){const _0x3e7b6f=a4_0x54e710;if(!_0x4b34bb[_0x3e7b6f(0x135)])return _0x4b34bb;return{..._0x4b34bb,'name':cleanNewlines(_0x4b34bb['name'])};}function cleanDatasetNames(_0x3817e5){const _0x8deb65=a4_0x54e710;return _0x3817e5[_0x8deb65(0x115)](cleanDatasetName);}export async function fetchModelList(_0x89385e){const _0x3cc509=a4_0x54e710,_0x5418a9=getEnv(),_0x2e9d29=getApiDomain()+_0x3cc509(0x132)+_0x89385e+'&otype=array';logger['info'](_0x3cc509(0x114),_0x3cc509(0x11c)+_0x5418a9+')',{'apiUrl':_0x2e9d29});const _0x1f8f88=await fetch(_0x2e9d29,{'headers':{'Cookie':getCookie()}});if(!_0x1f8f88['ok']){if(_0x1f8f88[_0x3cc509(0x12d)]===0x191)throw new Error(t(_0x3cc509(0x128)));throw new Error(t(_0x3cc509(0x11d),{'status':_0x1f8f88[_0x3cc509(0x12d)]}));}const _0xbd61=await _0x1f8f88[_0x3cc509(0x131)]();if(!_0xbd61[_0x3cc509(0x120)]){const _0x4b5540=_0xbd61[_0x3cc509(0x130)]||_0xbd61[_0x3cc509(0x119)]||_0xbd61['data']?.['message']||_0xbd61[_0x3cc509(0x134)]||_0xbd61[_0x3cc509(0x138)]||t(_0x3cc509(0x137));if(_0x4b5540[_0x3cc509(0x12b)](_0x3cc509(0x12f))||_0x4b5540[_0x3cc509(0x12b)](_0x3cc509(0x139))||_0x4b5540[_0x3cc509(0x12b)]('登录')||_0x4b5540[_0x3cc509(0x12b)]('认证')||_0xbd61[_0x3cc509(0x12a)]===_0x3cc509(0x12c)||_0xbd61[_0x3cc509(0x136)]===0x191||_0xbd61[_0x3cc509(0x136)]===_0x3cc509(0x12f))throw new Error(t('api.common.authExpired'));throw new Error(t(_0x3cc509(0x11f),{'error':_0x4b5540}));}const _0x381e4a=cleanDatasetNames(_0xbd61[_0x3cc509(0x118)][_0x3cc509(0x123)]);return{'configArray':_0x381e4a,'count':_0x381e4a[_0x3cc509(0x133)]};}
@@ -1 +1 @@
1
- const a6_0x30af0f=a6_0x36db;(function(_0x5e91b6,_0x58d51a){const _0x2b2d39=a6_0x36db,_0x45ce17=_0x5e91b6();while(!![]){try{const _0x994556=parseInt(_0x2b2d39(0x81))/0x1+-parseInt(_0x2b2d39(0x8b))/0x2*(-parseInt(_0x2b2d39(0x85))/0x3)+-parseInt(_0x2b2d39(0x8e))/0x4*(parseInt(_0x2b2d39(0x87))/0x5)+parseInt(_0x2b2d39(0x82))/0x6*(parseInt(_0x2b2d39(0x7b))/0x7)+-parseInt(_0x2b2d39(0x73))/0x8+parseInt(_0x2b2d39(0x95))/0x9+-parseInt(_0x2b2d39(0x91))/0xa;if(_0x994556===_0x58d51a)break;else _0x45ce17['push'](_0x45ce17['shift']());}catch(_0x11933b){_0x45ce17['push'](_0x45ce17['shift']());}}}(a6_0x1077,0x581d4));import a6_0xc890dd from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a6_0x41e72f from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{TemplateReplacer}from'../utils/template-replacer.js';function a6_0x36db(_0x25c910,_0xefc299){_0x25c910=_0x25c910-0x71;const _0x107748=a6_0x1077();let _0x36dbf1=_0x107748[_0x25c910];return _0x36dbf1;}import{logger}from'../utils/logger.js';import a6_0x52ce82 from'../i18n/index.js';const t=a6_0x52ce82['t'][a6_0x30af0f(0x90)](a6_0x52ce82);function a6_0x1077(){const _0x42aef2=['api.ts.tpl','\x22\x20}','3026GgEUei','-api','success','2051068jgCzzq','resolve','bind','10705200TnBuGi','name','.ts','../..','5540985LYXdaR','tableName','-client','online','endsWith','1464376ImAjRj','CONFIG_NAMES.DEFAULT','alias','slice','utf8','{\x20apiConfigName:\x20','typescript','client.ts.tpl','1477qVHaii','string','dirname','format','join','app','702834sfngzi','19986pAmoxQ','replaceApiContent','client','210GyAzcS',',\x20env:\x20\x22','5nwSGPH','{\x20apiConfigName:\x20\x22'];a6_0x1077=function(){return _0x42aef2;};return a6_0x1077();}export async function generateApiFile(_0x44e01d,_0x50419f='',_0x91c4d,_0x5a0fd9=![],_0x5bf153,_0x214f8b='./src/api/'){const _0x4e6f44=a6_0x30af0f,_0x30f7d6=readConfig(),_0x407494=_0x91c4d||_0x30f7d6?.[_0x4e6f44(0x80)];if(typeof _0x407494!==_0x4e6f44(0x7c)||!_0x407494)throw new Error(t('api.generateFile.noAppCode'));const _0x513624=_0x5a0fd9?_0x4e6f44(0x74):'\x22'+_0x407494+'\x22',_0x254b52=typeof _0x30f7d6['env']===_0x4e6f44(0x7c)?_0x30f7d6['env']:undefined,_0x3094b2=_0x5bf153||_0x254b52||_0x4e6f44(0x71),_0x27cb11=_0x3094b2!==_0x4e6f44(0x71);let _0x4257c4;if(_0x5a0fd9)_0x27cb11?_0x4257c4=_0x4e6f44(0x78)+_0x513624+_0x4e6f44(0x86)+_0x3094b2+_0x4e6f44(0x8a):_0x4257c4='';else{const _0x3ac3ae=_0x27cb11?_0x4e6f44(0x86)+_0x3094b2+'\x22':'';_0x4257c4=_0x4e6f44(0x88)+_0x407494+'\x22'+_0x3ac3ae+'\x20}';}const _0x37fad3=_0x50419f?_0x50419f+_0x4e6f44(0x8c):'api',_0x33f52c=_0x50419f?_0x50419f+_0x4e6f44(0x97):_0x4e6f44(0x84),_0x292965=[];_0x44e01d['forEach'](_0x10181f=>{const _0x37cf8b=_0x4e6f44;_0x292965['push']({'datasetCode':_0x10181f['datasetCode'],'tableName':_0x10181f[_0x37cf8b(0x96)],'name':_0x10181f[_0x37cf8b(0x92)]||'','alias':_0x10181f['alias']||_0x10181f['key']});});const _0x4301eb=fileURLToPath(import.meta.url),_0x523257=a6_0x41e72f[_0x4e6f44(0x8f)](a6_0x41e72f[_0x4e6f44(0x7d)](_0x4301eb),_0x4e6f44(0x94)),_0x599ecd=a6_0x41e72f[_0x4e6f44(0x7f)](_0x523257,'templates/generate-api'),_0x15d818=a6_0x41e72f[_0x4e6f44(0x7f)](_0x599ecd,_0x4e6f44(0x89)),_0x392d1b=a6_0x41e72f[_0x4e6f44(0x7f)](_0x599ecd,_0x4e6f44(0x7a)),_0x40202e=_0x214f8b[_0x4e6f44(0x72)]('/')?_0x214f8b[_0x4e6f44(0x76)](0x0,-0x1):_0x214f8b;mkdirSync(_0x40202e,{'recursive':!![]});const _0x2ea687=_0x292965[0x0]?.[_0x4e6f44(0x75)],_0x4eb460=readFileSync(_0x15d818,_0x4e6f44(0x77)),_0x673fcd=TemplateReplacer[_0x4e6f44(0x83)](_0x4eb460,_0x407494,_0x292965,_0x2ea687,_0x37fad3,_0x513624),_0x410810=await a6_0xc890dd[_0x4e6f44(0x7e)](_0x673fcd,{'parser':_0x4e6f44(0x79)}),_0x38b8ff=_0x40202e+'/'+_0x37fad3+'.ts';writeFileSync(_0x38b8ff,_0x410810,{'encoding':'utf8'});const _0x51dfb5=readFileSync(_0x392d1b,'utf8'),_0x4b4b4d=TemplateReplacer[_0x4e6f44(0x83)](_0x51dfb5,_0x407494,_0x292965,_0x2ea687,_0x37fad3,_0x513624,_0x4257c4),_0x5e19c9=await a6_0xc890dd[_0x4e6f44(0x7e)](_0x4b4b4d,{'parser':_0x4e6f44(0x79)}),_0x2583a4=_0x40202e+'/'+_0x33f52c+_0x4e6f44(0x93);writeFileSync(_0x2583a4,_0x5e19c9,{'encoding':_0x4e6f44(0x77)});const _0xbaab57=_0x292965['length'];return logger[_0x4e6f44(0x8d)]('init-api','API\x20文件生成成功!',undefined,{'apiFile':_0x38b8ff,'clientFile':_0x2583a4,'modelCount':_0xbaab57,'configName':_0x513624}),{'modelCount':_0xbaab57,'apiFilePath':_0x38b8ff,'clientFilePath':_0x2583a4,'configName':_0x513624};}
1
+ function a5_0x9509(_0x2908da,_0x2aa660){_0x2908da=_0x2908da-0x178;const _0x1bea71=a5_0x1bea();let _0x95095=_0x1bea71[_0x2908da];return _0x95095;}const a5_0x209f87=a5_0x9509;(function(_0x4f7aa5,_0x659123){const _0x1374f2=a5_0x9509,_0x5cafd1=_0x4f7aa5();while(!![]){try{const _0x1a7a87=parseInt(_0x1374f2(0x185))/0x1*(-parseInt(_0x1374f2(0x18d))/0x2)+parseInt(_0x1374f2(0x17e))/0x3*(parseInt(_0x1374f2(0x198))/0x4)+parseInt(_0x1374f2(0x193))/0x5+-parseInt(_0x1374f2(0x199))/0x6+parseInt(_0x1374f2(0x17c))/0x7+-parseInt(_0x1374f2(0x183))/0x8+parseInt(_0x1374f2(0x179))/0x9;if(_0x1a7a87===_0x659123)break;else _0x5cafd1['push'](_0x5cafd1['shift']());}catch(_0x4db626){_0x5cafd1['push'](_0x5cafd1['shift']());}}}(a5_0x1bea,0xb35d5));import a5_0x19a695 from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a5_0x19f44c 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';import a5_0x58f72f from'../i18n/index.js';const t=a5_0x58f72f['t'][a5_0x209f87(0x196)](a5_0x58f72f);function a5_0x1bea(){const _0x1bb38e=['API\x20文件生成成功!','../..','.ts','production','-api','2915825BNcKiH','forEach','{\x20apiConfigName:\x20\x22','bind','length','8hcViEJ','7879248pCbVVc','tableName','success','api.generateFile.noAppCode','9074817XWtlNo','env','dirname','6805841NyPLuV','alias','1314708XLWHlJ','typescript','init-api','format','utf8','7612976ahaVEW','name','2998JbVGWg',',\x20env:\x20\x22','string','datasetCode','app','join','slice','client','294LBrkfO'];a5_0x1bea=function(){return _0x1bb38e;};return a5_0x1bea();}export async function generateApiFile(_0x3bdc28,_0xaf62d1='',_0x4f6120,_0x44eef6=![],_0x2efdfc,_0x39bfeb='./src/api/'){const _0xc5ec8f=a5_0x209f87,_0xf59204=readConfig(),_0x3d2800=_0x4f6120||_0xf59204?.[_0xc5ec8f(0x189)];if(typeof _0x3d2800!==_0xc5ec8f(0x187)||!_0x3d2800)throw new Error(t(_0xc5ec8f(0x178)));const _0x3bf60c=_0x44eef6?'CONFIG_NAMES.DEFAULT':'\x22'+_0x3d2800+'\x22',_0x161158=typeof _0xf59204[_0xc5ec8f(0x17a)]==='string'?_0xf59204[_0xc5ec8f(0x17a)]:undefined,_0x160f3d=_0x2efdfc||_0x161158||_0xc5ec8f(0x191),_0x23c9dd=_0x160f3d!==_0xc5ec8f(0x191);let _0x20ba47;if(_0x44eef6)_0x23c9dd?_0x20ba47='{\x20apiConfigName:\x20'+_0x3bf60c+_0xc5ec8f(0x186)+_0x160f3d+'\x22\x20}':_0x20ba47='';else{const _0x11d73b=_0x23c9dd?_0xc5ec8f(0x186)+_0x160f3d+'\x22':'';_0x20ba47=_0xc5ec8f(0x195)+_0x3d2800+'\x22'+_0x11d73b+'\x20}';}const _0x229227=_0xaf62d1?_0xaf62d1+_0xc5ec8f(0x192):'api',_0x21c243=_0xaf62d1?_0xaf62d1+'-client':_0xc5ec8f(0x18c),_0x5c72ef=[];_0x3bdc28[_0xc5ec8f(0x194)](_0x523f5c=>{const _0x33b17b=_0xc5ec8f;_0x5c72ef['push']({'datasetCode':_0x523f5c[_0x33b17b(0x188)],'tableName':_0x523f5c[_0x33b17b(0x19a)],'name':_0x523f5c[_0x33b17b(0x184)]||'','alias':_0x523f5c[_0x33b17b(0x17d)]||_0x523f5c['key']});});const _0x24b9fc=fileURLToPath(import.meta.url),_0x4319bb=a5_0x19f44c['resolve'](a5_0x19f44c[_0xc5ec8f(0x17b)](_0x24b9fc),_0xc5ec8f(0x18f)),_0x127e2c=a5_0x19f44c[_0xc5ec8f(0x18a)](_0x4319bb,'templates/generate-api'),_0x3cf7ae=a5_0x19f44c[_0xc5ec8f(0x18a)](_0x127e2c,'api.ts.tpl'),_0x5197bf=a5_0x19f44c[_0xc5ec8f(0x18a)](_0x127e2c,'client.ts.tpl'),_0x1bb322=_0x39bfeb['endsWith']('/')?_0x39bfeb[_0xc5ec8f(0x18b)](0x0,-0x1):_0x39bfeb;mkdirSync(_0x1bb322,{'recursive':!![]});const _0x1a6eb9=_0x5c72ef[0x0]?.[_0xc5ec8f(0x17d)],_0x355c3e=readFileSync(_0x3cf7ae,_0xc5ec8f(0x182)),_0x1309d6=TemplateReplacer['replaceApiContent'](_0x355c3e,_0x3d2800,_0x5c72ef,_0x1a6eb9,_0x229227,_0x3bf60c),_0x794688=await a5_0x19a695[_0xc5ec8f(0x181)](_0x1309d6,{'parser':_0xc5ec8f(0x17f)}),_0x17f3e2=_0x1bb322+'/'+_0x229227+_0xc5ec8f(0x190);writeFileSync(_0x17f3e2,_0x794688,{'encoding':'utf8'});const _0x4c3791=readFileSync(_0x5197bf,_0xc5ec8f(0x182)),_0x4ff680=TemplateReplacer['replaceApiContent'](_0x4c3791,_0x3d2800,_0x5c72ef,_0x1a6eb9,_0x229227,_0x3bf60c,_0x20ba47),_0x529351=await a5_0x19a695[_0xc5ec8f(0x181)](_0x4ff680,{'parser':_0xc5ec8f(0x17f)}),_0x523d41=_0x1bb322+'/'+_0x21c243+'.ts';writeFileSync(_0x523d41,_0x529351,{'encoding':_0xc5ec8f(0x182)});const _0x1fb14d=_0x5c72ef[_0xc5ec8f(0x197)];return logger[_0xc5ec8f(0x19b)](_0xc5ec8f(0x180),_0xc5ec8f(0x18e),undefined,{'apiFile':_0x17f3e2,'clientFile':_0x523d41,'modelCount':_0x1fb14d,'configName':_0x3bf60c}),{'modelCount':_0x1fb14d,'apiFilePath':_0x17f3e2,'clientFilePath':_0x523d41,'configName':_0x3bf60c};}
package/lib/api/main.js CHANGED
@@ -1 +1 @@
1
- (function(_0x45d1ec,_0xc9e407){const _0x260633=a7_0x5da0,_0x2431a7=_0x45d1ec();while(!![]){try{const _0x3dfcb2=parseInt(_0x260633(0x92))/0x1+parseInt(_0x260633(0x7e))/0x2*(-parseInt(_0x260633(0xb6))/0x3)+parseInt(_0x260633(0x6e))/0x4*(-parseInt(_0x260633(0xa8))/0x5)+parseInt(_0x260633(0x7c))/0x6+parseInt(_0x260633(0x87))/0x7*(parseInt(_0x260633(0x99))/0x8)+parseInt(_0x260633(0x94))/0x9*(-parseInt(_0x260633(0xb7))/0xa)+-parseInt(_0x260633(0x9c))/0xb*(-parseInt(_0x260633(0x80))/0xc);if(_0x3dfcb2===_0xc9e407)break;else _0x2431a7['push'](_0x2431a7['shift']());}catch(_0x268540){_0x2431a7['push'](_0x2431a7['shift']());}}}(a7_0x2b95,0xa7a3b));import{jsx as a7_0x29f42e}from'react/jsx-runtime';import{render}from'ink';function a7_0x5da0(_0x1044a5,_0x40623f){_0x1044a5=_0x1044a5-0x6e;const _0x2b952e=a7_0x2b95();let _0x5da090=_0x2b952e[_0x1044a5];return _0x5da090;}import{ApiPullUI}from'./api-pull-ui.js';function a7_0x2b95(){const _0x1729e8=['15804SrHugM','api.help.docDataset','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20','api.help.docDatasets','api.help.pullEnv','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20','error','170093XXTKFE','api.help.pullDesc','split','api.help.examples','api.help.options','\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','isArray','filter','api.help.optHelp','api.common.noAppCode','api.help.pullOutput','173969Wbxesa','input','2655tLXqRM','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\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','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20','api.common.noPositionalArgs','424NfYYzD','api.common.noAppCodeOption1','api.help.usage','7139cMBmES','api.common.noAppCodeOption2Pull','api.help.docAppcode','\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20','api.help.unknownCommand','\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20','join','\x0a\x20\x20--datasetcode\x20<codes>\x20','\x1b[0m','api.common.usingConfigAppCodeHint','datasetcode','\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','785uUdJRY','api.help.availableCommands','doc','api.help.optOutput','api.help.optAppcode','api.help.docDesc','\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20','output','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20','\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','api.common.onlyGenerateDatasets','\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a','\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','message','876jQQkAa','27290qqTCGK','pull','\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','\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20','api.common.noAppCodeHint','api.common.datasetcodeEmpty','api.common.paramsNotJson','length','9580wWbMXs','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','api.help.pullAppcode','trim','params','api.common.noAppCodeOption2Doc','\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','log','\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','api.help.optDatasetcode','\x1b[90m','string','flags','3863016RBCgDF','exit','7484HrPRgA','env'];a7_0x2b95=function(){return _0x1729e8;};return a7_0x2b95();}import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';import a7_0x597b9b from'../i18n/index.js';const t=a7_0x597b9b['t']['bind'](a7_0x597b9b);export async function apiCli(_0x118b45){const _0x5a0215=a7_0x5da0,_0x21317a=_0x118b45[_0x5a0215(0x93)][0x1];if(_0x118b45[_0x5a0215(0x7b)]['help']){console[_0x5a0215(0x75)]('\x0a'+t('api.help.title')+'\x0a\x0a'+t(_0x5a0215(0x9b))+_0x5a0215(0xb3)+t(_0x5a0215(0x8b))+_0x5a0215(0xa1)+t(_0x5a0215(0xac))+'\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20'+t(_0x5a0215(0xab))+_0x5a0215(0x76)+t('api.help.optEnv')+_0x5a0215(0xa3)+t(_0x5a0215(0x78))+_0x5a0215(0xb1)+t(_0x5a0215(0x8f))+'\x0a\x0a'+t(_0x5a0215(0x8a))+_0x5a0215(0xa7)+t(_0x5a0215(0x88))+_0x5a0215(0x9f)+t(_0x5a0215(0x70))+'\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20'+t(_0x5a0215(0x91))+_0x5a0215(0xae)+t(_0x5a0215(0x84))+_0x5a0215(0x8c)+t(_0x5a0215(0xad))+'\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'+t('api.help.docAppcode')+_0x5a0215(0xb4)+t('api.help.docOutput')+_0x5a0215(0x74)+t('api.help.docEnv')+_0x5a0215(0xba)+t(_0x5a0215(0x81))+_0x5a0215(0x96)+t(_0x5a0215(0x83))+'\x0a');return;}if(_0x21317a===_0x5a0215(0xb8)){_0x118b45[_0x5a0215(0x93)][0x2]&&(console[_0x5a0215(0x86)](t(_0x5a0215(0x98))),console[_0x5a0215(0x75)](t('api.common.useAppcodeFlag')),console[_0x5a0215(0x75)](_0x5a0215(0x6f)+_0x118b45[_0x5a0215(0x93)][0x2]),process['exit'](0x1));const _0x1fa65f=getConfigAppCode();let _0x349f77=_0x118b45[_0x5a0215(0x7b)]['appcode'];const _0xed70f7=typeof _0x118b45[_0x5a0215(0x7b)]['env']===_0x5a0215(0x7a)?_0x118b45['flags'][_0x5a0215(0x7f)]:undefined,_0x212367=_0x118b45[_0x5a0215(0x7b)]['output'];!_0x349f77&&!_0x1fa65f&&(console[_0x5a0215(0x86)](t('api.common.noAppCode')),console['log'](t('api.common.noAppCodeHint')),console[_0x5a0215(0x75)](t(_0x5a0215(0x9a))),console[_0x5a0215(0x75)](t(_0x5a0215(0x9d))),process['exit'](0x1)),_0x349f77&&_0x1fa65f&&_0x349f77===_0x1fa65f&&(console[_0x5a0215(0x75)](_0x5a0215(0x79)+t('api.common.usingConfigAppCode',{'appCode':_0x349f77})+_0x5a0215(0xa4)),console[_0x5a0215(0x75)]('\x1b[90m'+t(_0x5a0215(0xa5))+_0x5a0215(0xa4)),_0x349f77=undefined),render(a7_0x29f42e(ApiPullUI,{'appCode':_0x349f77,'env':_0xed70f7,'output':_0x212367}));}else{if(_0x21317a===_0x5a0215(0xaa)){_0x118b45[_0x5a0215(0x93)][0x2]&&(console[_0x5a0215(0x86)](t(_0x5a0215(0x98))),console['log'](t('api.common.useAppcodeFlag')),console[_0x5a0215(0x75)](_0x5a0215(0x77)+_0x118b45[_0x5a0215(0x93)][0x2]),process[_0x5a0215(0x7d)](0x1));const _0x1ed967=getConfigAppCode();let _0x2a69bd=_0x118b45[_0x5a0215(0x7b)]['appcode'];const _0xd50110=typeof _0x118b45[_0x5a0215(0x7b)][_0x5a0215(0x7f)]===_0x5a0215(0x7a)?_0x118b45[_0x5a0215(0x7b)][_0x5a0215(0x7f)]:undefined,_0x4d67ea=_0x118b45[_0x5a0215(0x7b)][_0x5a0215(0xaf)],_0x22a8c9=_0x118b45[_0x5a0215(0x7b)][_0x5a0215(0x72)],_0x20db70=_0x118b45['flags'][_0x5a0215(0xa6)];!_0x2a69bd&&!_0x1ed967&&(console['error'](t(_0x5a0215(0x90))),console[_0x5a0215(0x75)](t(_0x5a0215(0xbb))),console[_0x5a0215(0x75)](t('api.common.noAppCodeOption1')),console[_0x5a0215(0x75)](t(_0x5a0215(0x73))),process[_0x5a0215(0x7d)](0x1));_0x2a69bd&&_0x1ed967&&_0x2a69bd===_0x1ed967&&(console[_0x5a0215(0x75)]('\x1b[90m'+t('api.common.usingConfigAppCode',{'appCode':_0x2a69bd})+_0x5a0215(0xa4)),_0x2a69bd=undefined);let _0x752dc2;if(_0x22a8c9)try{_0x752dc2=JSON['parse'](_0x22a8c9),(typeof _0x752dc2!=='object'||_0x752dc2===null||Array[_0x5a0215(0x8d)](_0x752dc2))&&(console[_0x5a0215(0x86)](t('api.common.paramsInvalidJson')),process[_0x5a0215(0x7d)](0x1));}catch(_0x24b55c){console[_0x5a0215(0x86)](t(_0x5a0215(0xbd))),console['error'](t('api.common.paramsError',{'error':_0x24b55c instanceof Error?_0x24b55c[_0x5a0215(0xb5)]:String(_0x24b55c)})),process[_0x5a0215(0x7d)](0x1);}let _0x3c2c1a;_0x20db70&&(_0x3c2c1a=_0x20db70[_0x5a0215(0x89)](',')['map'](_0x20df57=>_0x20df57[_0x5a0215(0x71)]())[_0x5a0215(0x8e)](_0x2ec02a=>_0x2ec02a[_0x5a0215(0xbe)]>0x0),_0x3c2c1a['length']===0x0&&(console[_0x5a0215(0x86)](t(_0x5a0215(0xbc))),process[_0x5a0215(0x7d)](0x1)),console['log'](_0x5a0215(0x79)+t(_0x5a0215(0xb2),{'codes':_0x3c2c1a[_0x5a0215(0xa2)](',\x20')})+_0x5a0215(0xa4))),render(a7_0x29f42e(ApiDocUI,{'appCode':_0x2a69bd,'env':_0xd50110,'output':_0x4d67ea,'extraParams':_0x752dc2,'datasetCodes':_0x3c2c1a}));}else console[_0x5a0215(0x86)](t(_0x5a0215(0xa0))+':\x20'+_0x21317a),console[_0x5a0215(0x75)](t(_0x5a0215(0xa9))),console[_0x5a0215(0x75)](_0x5a0215(0xb9)+t(_0x5a0215(0x88))),console[_0x5a0215(0x75)](_0x5a0215(0x85)+t(_0x5a0215(0x70))),console[_0x5a0215(0x75)](_0x5a0215(0x82)+t(_0x5a0215(0x91))),console['log']('\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20'+t(_0x5a0215(0x84))),console['log'](''),console[_0x5a0215(0x75)]('\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'+t(_0x5a0215(0xad))),console['log'](_0x5a0215(0xb0)+t(_0x5a0215(0x9e))),console[_0x5a0215(0x75)](_0x5a0215(0x95)+t('api.help.docOutput')),console['log'](_0x5a0215(0x97)+t('api.help.docEnv')),process['exit'](0x1);}}
1
+ const a6_0x30094b=a6_0x4d79;(function(_0x2f4624,_0x243d21){const _0x3f7e4e=a6_0x4d79,_0x2d5bcf=_0x2f4624();while(!![]){try{const _0x24e9ae=-parseInt(_0x3f7e4e(0x1c4))/0x1*(-parseInt(_0x3f7e4e(0x1e2))/0x2)+parseInt(_0x3f7e4e(0x1db))/0x3*(-parseInt(_0x3f7e4e(0x1ad))/0x4)+-parseInt(_0x3f7e4e(0x1f5))/0x5*(parseInt(_0x3f7e4e(0x1f7))/0x6)+-parseInt(_0x3f7e4e(0x1e4))/0x7*(parseInt(_0x3f7e4e(0x1c8))/0x8)+parseInt(_0x3f7e4e(0x1de))/0x9*(-parseInt(_0x3f7e4e(0x1ae))/0xa)+-parseInt(_0x3f7e4e(0x1cd))/0xb+parseInt(_0x3f7e4e(0x1ca))/0xc;if(_0x24e9ae===_0x243d21)break;else _0x2d5bcf['push'](_0x2d5bcf['shift']());}catch(_0x52db31){_0x2d5bcf['push'](_0x2d5bcf['shift']());}}}(a6_0x3b4d,0xd6d13));import{jsx as a6_0xf25437}from'react/jsx-runtime';function a6_0x3b4d(){const _0x3a6e50=['api.help.optHelp','\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20','log','\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','output','env','pull','api.help.examples','6IZioxq','\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','api.help.optOutput','18EVcEIx','api.common.paramsError','datasetcode','flags','10916NcrIfF','isArray','147mdWQVB','\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20','api.help.docOutput','\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20','filter','api.common.noAppCodeOption2Doc','api.help.pullOutput','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20','help','\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','bind','\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','\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','parse','input','api.help.docAppcode','api.common.usingConfigAppCode','85PdnUaV','api.help.usage','327150OKbWIF','\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20','message','api.help.docDatasets','split','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20','\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a','api.help.docDesc','api.common.usingConfigAppCodeHint','api.help.pullEnv','\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20','doc','appcode','api.common.noAppCodeOption2Pull','3438076DvCiGJ','5716180GRZqNM','\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20','api.help.unknownCommand','api.help.docEnv','length','api.common.paramsNotJson','error','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','trim','api.common.paramsInvalidJson','api.common.noAppCode','api.help.pullDesc','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20','\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','api.help.optDatasetcode','\x1b[0m','\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20','\x1b[90m','api.common.onlyGenerateDatasets','api.help.options','api.common.noAppCodeOption1','13geSxWa','api.help.optAppcode','\x0a\x20\x20--datasetcode\x20<codes>\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','507888FrNUpZ','api.help.availableCommands','74345784fWzNPc','string','api.help.pullAppcode','2905540WoYjRQ','object','exit','api.common.noPositionalArgs','api.common.useAppcodeFlag'];a6_0x3b4d=function(){return _0x3a6e50;};return a6_0x3b4d();}import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';function a6_0x4d79(_0x2e9292,_0x2e9c2d){_0x2e9292=_0x2e9292-0x1a2;const _0x3b4df8=a6_0x3b4d();let _0x4d793c=_0x3b4df8[_0x2e9292];return _0x4d793c;}import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';import a6_0xe492ba from'../i18n/index.js';const t=a6_0xe492ba['t'][a6_0x30094b(0x1ee)](a6_0xe492ba);export async function apiCli(_0x34cec8){const _0x5947f5=a6_0x30094b,_0x309e70=_0x34cec8['input'][0x1];if(_0x34cec8['flags'][_0x5947f5(0x1ec)]){console[_0x5947f5(0x1d5)]('\x0a'+t('api.help.title')+'\x0a\x0a'+t(_0x5947f5(0x1f6))+_0x5947f5(0x1a5)+t(_0x5947f5(0x1c2))+_0x5947f5(0x1af)+t(_0x5947f5(0x1c5))+'\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20'+t(_0x5947f5(0x1dd))+'\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+t('api.help.optEnv')+_0x5947f5(0x1c6)+t(_0x5947f5(0x1bd))+_0x5947f5(0x1d6)+t(_0x5947f5(0x1d2))+'\x0a\x0a'+t(_0x5947f5(0x1da))+_0x5947f5(0x1ef)+t(_0x5947f5(0x1ba))+_0x5947f5(0x1e5)+t(_0x5947f5(0x1cc))+_0x5947f5(0x1bf)+t(_0x5947f5(0x1ea))+_0x5947f5(0x1e7)+t(_0x5947f5(0x1a8))+_0x5947f5(0x1bc)+t(_0x5947f5(0x1a6))+_0x5947f5(0x1c7)+t(_0x5947f5(0x1f3))+_0x5947f5(0x1ed)+t(_0x5947f5(0x1e6))+_0x5947f5(0x1f0)+t(_0x5947f5(0x1b2))+_0x5947f5(0x1a9)+t('api.help.docDataset')+_0x5947f5(0x1d3)+t(_0x5947f5(0x1a2))+'\x0a');return;}if(_0x309e70===_0x5947f5(0x1d9)){_0x34cec8[_0x5947f5(0x1f2)][0x2]&&(console['error'](t(_0x5947f5(0x1d0))),console[_0x5947f5(0x1d5)](t(_0x5947f5(0x1d1))),console['log'](_0x5947f5(0x1b6)+_0x34cec8[_0x5947f5(0x1f2)][0x2]),process[_0x5947f5(0x1cf)](0x1));const _0x571c8c=getConfigAppCode();let _0x394be9=_0x34cec8[_0x5947f5(0x1e1)][_0x5947f5(0x1ab)];const _0x1bca04=typeof _0x34cec8['flags'][_0x5947f5(0x1d8)]===_0x5947f5(0x1cb)?_0x34cec8[_0x5947f5(0x1e1)][_0x5947f5(0x1d8)]:undefined,_0x5320a9=_0x34cec8[_0x5947f5(0x1e1)][_0x5947f5(0x1d7)];!_0x394be9&&!_0x571c8c&&(console[_0x5947f5(0x1b5)](t(_0x5947f5(0x1b9))),console[_0x5947f5(0x1d5)](t('api.common.noAppCodeHint')),console[_0x5947f5(0x1d5)](t(_0x5947f5(0x1c3))),console[_0x5947f5(0x1d5)](t(_0x5947f5(0x1ac))),process[_0x5947f5(0x1cf)](0x1)),_0x394be9&&_0x571c8c&&_0x394be9===_0x571c8c&&(console['log']('\x1b[90m'+t(_0x5947f5(0x1f4),{'appCode':_0x394be9})+_0x5947f5(0x1be)),console[_0x5947f5(0x1d5)](_0x5947f5(0x1c0)+t(_0x5947f5(0x1a7))+'\x1b[0m'),_0x394be9=undefined),render(a6_0xf25437(ApiPullUI,{'appCode':_0x394be9,'env':_0x1bca04,'output':_0x5320a9}));}else{if(_0x309e70===_0x5947f5(0x1aa)){_0x34cec8[_0x5947f5(0x1f2)][0x2]&&(console['error'](t('api.common.noPositionalArgs')),console[_0x5947f5(0x1d5)](t(_0x5947f5(0x1d1))),console[_0x5947f5(0x1d5)]('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20'+_0x34cec8[_0x5947f5(0x1f2)][0x2]),process[_0x5947f5(0x1cf)](0x1));const _0x2e432d=getConfigAppCode();let _0x4d1f58=_0x34cec8[_0x5947f5(0x1e1)]['appcode'];const _0x4cee99=typeof _0x34cec8[_0x5947f5(0x1e1)]['env']===_0x5947f5(0x1cb)?_0x34cec8[_0x5947f5(0x1e1)][_0x5947f5(0x1d8)]:undefined,_0x4746c8=_0x34cec8[_0x5947f5(0x1e1)][_0x5947f5(0x1d7)],_0x55758c=_0x34cec8['flags']['params'],_0x3b2098=_0x34cec8[_0x5947f5(0x1e1)][_0x5947f5(0x1e0)];!_0x4d1f58&&!_0x2e432d&&(console[_0x5947f5(0x1b5)](t(_0x5947f5(0x1b9))),console[_0x5947f5(0x1d5)](t('api.common.noAppCodeHint')),console[_0x5947f5(0x1d5)](t(_0x5947f5(0x1c3))),console[_0x5947f5(0x1d5)](t(_0x5947f5(0x1e9))),process[_0x5947f5(0x1cf)](0x1));_0x4d1f58&&_0x2e432d&&_0x4d1f58===_0x2e432d&&(console['log'](_0x5947f5(0x1c0)+t('api.common.usingConfigAppCode',{'appCode':_0x4d1f58})+_0x5947f5(0x1be)),_0x4d1f58=undefined);let _0x2448e5;if(_0x55758c)try{_0x2448e5=JSON[_0x5947f5(0x1f1)](_0x55758c),(typeof _0x2448e5!==_0x5947f5(0x1ce)||_0x2448e5===null||Array[_0x5947f5(0x1e3)](_0x2448e5))&&(console[_0x5947f5(0x1b5)](t(_0x5947f5(0x1b8))),process[_0x5947f5(0x1cf)](0x1));}catch(_0x3b97fc){console['error'](t(_0x5947f5(0x1b4))),console[_0x5947f5(0x1b5)](t(_0x5947f5(0x1df),{'error':_0x3b97fc instanceof Error?_0x3b97fc[_0x5947f5(0x1f9)]:String(_0x3b97fc)})),process[_0x5947f5(0x1cf)](0x1);}let _0x4ae020;_0x3b2098&&(_0x4ae020=_0x3b2098[_0x5947f5(0x1a3)](',')['map'](_0x324309=>_0x324309[_0x5947f5(0x1b7)]())[_0x5947f5(0x1e8)](_0x3da47a=>_0x3da47a[_0x5947f5(0x1b3)]>0x0),_0x4ae020[_0x5947f5(0x1b3)]===0x0&&(console[_0x5947f5(0x1b5)](t('api.common.datasetcodeEmpty')),process['exit'](0x1)),console['log'](_0x5947f5(0x1c0)+t(_0x5947f5(0x1c1),{'codes':_0x4ae020['join'](',\x20')})+_0x5947f5(0x1be))),render(a6_0xf25437(ApiDocUI,{'appCode':_0x4d1f58,'env':_0x4cee99,'output':_0x4746c8,'extraParams':_0x2448e5,'datasetCodes':_0x4ae020}));}else console[_0x5947f5(0x1b5)](t(_0x5947f5(0x1b1))+':\x20'+_0x309e70),console[_0x5947f5(0x1d5)](t(_0x5947f5(0x1c9))),console[_0x5947f5(0x1d5)]('\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'+t(_0x5947f5(0x1ba))),console[_0x5947f5(0x1d5)](_0x5947f5(0x1bb)+t(_0x5947f5(0x1cc))),console[_0x5947f5(0x1d5)](_0x5947f5(0x1eb)+t(_0x5947f5(0x1ea))),console[_0x5947f5(0x1d5)](_0x5947f5(0x1a4)+t('api.help.pullEnv')),console[_0x5947f5(0x1d5)](''),console[_0x5947f5(0x1d5)](_0x5947f5(0x1dc)+t(_0x5947f5(0x1a6))),console[_0x5947f5(0x1d5)](_0x5947f5(0x1b0)+t(_0x5947f5(0x1f3))),console[_0x5947f5(0x1d5)](_0x5947f5(0x1f8)+t(_0x5947f5(0x1e6))),console[_0x5947f5(0x1d5)](_0x5947f5(0x1d4)+t(_0x5947f5(0x1b2))),process[_0x5947f5(0x1cf)](0x1);}}
@@ -1 +1 @@
1
- const a8_0x2804ab=a8_0x2238;function a8_0x19cd(){const _0x1e0f6e=['142930ETCDjv','306xWMsVG','chdir','length','64XgLnOY','api.silent.invalidPrefix','api.silent.fetching','37200dWsDRA','error','string','api.silent.generating','-client','online','env','client','message','cwd','api.silent.error','create-api-pull','34670MtlnAV','api.silent.success','93CNQhbP','12ZuUqAC','bind','trim','API\x20配置拉取成功:\x20','711424zRUNub','API\x20配置拉取异常:\x20','1341344Hmrcev','19762611NuiDdQ','test','421392RwCvhZ','api.silent.modelFileName','189ijEaBt','api.silent.processing','log'];a8_0x19cd=function(){return _0x1e0f6e;};return a8_0x19cd();}(function(_0x584a59,_0x1a1996){const _0x1277f1=a8_0x2238,_0x1dd672=_0x584a59();while(!![]){try{const _0x32b27b=-parseInt(_0x1277f1(0x185))/0x1+parseInt(_0x1277f1(0x179))/0x2*(-parseInt(_0x1277f1(0x17b))/0x3)+parseInt(_0x1277f1(0x182))/0x4+parseInt(_0x1277f1(0x16d))/0x5*(parseInt(_0x1277f1(0x167))/0x6)+-parseInt(_0x1277f1(0x180))/0x7*(parseInt(_0x1277f1(0x16a))/0x8)+-parseInt(_0x1277f1(0x187))/0x9*(parseInt(_0x1277f1(0x18a))/0xa)+-parseInt(_0x1277f1(0x183))/0xb*(-parseInt(_0x1277f1(0x17c))/0xc);if(_0x32b27b===_0x1a1996)break;else _0x1dd672['push'](_0x1dd672['shift']());}catch(_0x1cd411){_0x1dd672['push'](_0x1dd672['shift']());}}}(a8_0x19cd,0x6b45f));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';import a8_0x408c6c from'../i18n/index.js';const t=a8_0x408c6c['t'][a8_0x2804ab(0x17d)](a8_0x408c6c);function a8_0x2238(_0x1c8f5b,_0x108791){_0x1c8f5b=_0x1c8f5b-0x167;const _0x19cddb=a8_0x19cd();let _0x22384f=_0x19cddb[_0x1c8f5b];return _0x22384f;}export async function pullApiSilent(_0x36eced,_0x4f82a7,_0x30576b,_0x70f5fd){const _0x5f1662=a8_0x2804ab;let _0x14a013;try{const _0x9e533e=_0x4f82a7?.[_0x5f1662(0x17e)]()||'';if(_0x9e533e){const _0x519a70=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x519a70[_0x5f1662(0x184)](_0x9e533e))return console[_0x5f1662(0x16e)](t(_0x5f1662(0x16b))),![];}_0x30576b&&(_0x14a013=process[_0x5f1662(0x176)](),process[_0x5f1662(0x168)](_0x30576b));const _0x4cfc11=readConfig(),_0x5b9054=typeof _0x4cfc11[_0x5f1662(0x173)]===_0x5f1662(0x16f)?_0x4cfc11[_0x5f1662(0x173)]:undefined,_0x5ad9be=_0x70f5fd||_0x5b9054||_0x5f1662(0x172);initEnv(_0x5ad9be),console[_0x5f1662(0x189)](t(_0x5f1662(0x16c),{'env':_0x5ad9be}));const {configArray:_0x2a9bd8}=await fetchModelList(_0x36eced),_0x3dcb9f=_0x9e533e?_0x9e533e+'-api':'api',_0x2885e5=_0x9e533e?_0x9e533e+_0x5f1662(0x171):_0x5f1662(0x174);console[_0x5f1662(0x189)](t(_0x5f1662(0x170))),console[_0x5f1662(0x189)](t(_0x5f1662(0x186),{'name':_0x3dcb9f})),console['log'](t('api.silent.clientFileName',{'name':_0x2885e5})),console[_0x5f1662(0x189)](t(_0x5f1662(0x188),{'count':_0x2a9bd8[_0x5f1662(0x169)]}));const _0x1cfb52=await generateApiFile(_0x2a9bd8,_0x9e533e,_0x36eced,!![],_0x5ad9be);return console[_0x5f1662(0x189)](t(_0x5f1662(0x17a),{'datasetCount':_0x2a9bd8[_0x5f1662(0x169)],'modelCount':_0x1cfb52['modelCount']})),_0x30576b&&logger['info'](_0x5f1662(0x178),_0x5f1662(0x17f)+_0x36eced,{'projectPath':_0x30576b,'appCode':_0x36eced,'datasetCount':_0x2a9bd8[_0x5f1662(0x169)],'filePrefix':_0x9e533e}),!![];}catch(_0x20c6fc){const _0x31f535=_0x20c6fc instanceof Error?_0x20c6fc[_0x5f1662(0x175)]:String(_0x20c6fc);return console[_0x5f1662(0x16e)](t(_0x5f1662(0x177),{'error':_0x31f535})),_0x30576b&&logger['error'](_0x5f1662(0x178),_0x5f1662(0x181)+_0x31f535,{'appCode':_0x36eced,'projectPath':_0x30576b}),![];}finally{_0x14a013&&process['chdir'](_0x14a013);}}
1
+ const a7_0x104ae7=a7_0x4a15;(function(_0xdaf0be,_0x3ead5b){const _0x3e120f=a7_0x4a15,_0x62263e=_0xdaf0be();while(!![]){try{const _0x2cf7d3=parseInt(_0x3e120f(0x10e))/0x1+-parseInt(_0x3e120f(0x119))/0x2+parseInt(_0x3e120f(0x11c))/0x3+parseInt(_0x3e120f(0x110))/0x4*(-parseInt(_0x3e120f(0x111))/0x5)+parseInt(_0x3e120f(0x122))/0x6+parseInt(_0x3e120f(0x11a))/0x7*(parseInt(_0x3e120f(0x11f))/0x8)+-parseInt(_0x3e120f(0x12a))/0x9;if(_0x2cf7d3===_0x3ead5b)break;else _0x62263e['push'](_0x62263e['shift']());}catch(_0x459095){_0x62263e['push'](_0x62263e['shift']());}}}(a7_0x3aeb,0x5508d));import{readConfig}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';function a7_0x4a15(_0x56cf84,_0x2434ad){_0x56cf84=_0x56cf84-0x10d;const _0x3aeb65=a7_0x3aeb();let _0x4a15ea=_0x3aeb65[_0x56cf84];return _0x4a15ea;}import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';function a7_0x3aeb(){const _0x2f4227=['266654NnIIyR','98NmGNDw','-client','135012AmKXrI','env','error','132168xWoZRZ','chdir','log','380538wlnlgy','info','length','create-api-pull','client','API\x20配置拉取成功:\x20','message','api.silent.invalidPrefix','4547772bDwwMj','API\x20配置拉取异常:\x20','api.silent.clientFileName','cwd','663875hwlQGd','api.silent.generating','980eEYxed','340aVjgjZ','api.silent.fetching','test','api.silent.success','bind','api','api.silent.processing','-api'];a7_0x3aeb=function(){return _0x2f4227;};return a7_0x3aeb();}import a7_0x108f26 from'../i18n/index.js';const t=a7_0x108f26['t'][a7_0x104ae7(0x115)](a7_0x108f26);export async function pullApiSilent(_0x1a051f,_0x1b1c10,_0x41235e,_0x496c07){const _0x365648=a7_0x104ae7;let _0x1b19e7;try{const _0x40a59d=_0x1b1c10?.['trim']()||'';if(_0x40a59d){const _0x3d2ec5=/^[a-zA-Z][a-zA-Z0-9_-]*$/;if(!_0x3d2ec5[_0x365648(0x113)](_0x40a59d))return console['error'](t(_0x365648(0x129))),![];}_0x41235e&&(_0x1b19e7=process[_0x365648(0x10d)](),process[_0x365648(0x120)](_0x41235e));const _0x27ae48=readConfig(),_0x18a084=typeof _0x27ae48[_0x365648(0x11d)]==='string'?_0x27ae48['env']:undefined,_0x346091=_0x496c07||_0x18a084||'production';initEnv(_0x346091),console[_0x365648(0x121)](t(_0x365648(0x112),{'env':_0x346091}));const {configArray:_0x53b36c}=await fetchModelList(_0x1a051f),_0x3f9e70=_0x40a59d?_0x40a59d+_0x365648(0x118):_0x365648(0x116),_0x46cb8d=_0x40a59d?_0x40a59d+_0x365648(0x11b):_0x365648(0x126);console[_0x365648(0x121)](t(_0x365648(0x10f))),console[_0x365648(0x121)](t('api.silent.modelFileName',{'name':_0x3f9e70})),console['log'](t(_0x365648(0x12c),{'name':_0x46cb8d})),console[_0x365648(0x121)](t(_0x365648(0x117),{'count':_0x53b36c[_0x365648(0x124)]}));const _0x133753=await generateApiFile(_0x53b36c,_0x40a59d,_0x1a051f,!![],_0x346091);return console[_0x365648(0x121)](t(_0x365648(0x114),{'datasetCount':_0x53b36c[_0x365648(0x124)],'modelCount':_0x133753['modelCount']})),_0x41235e&&logger[_0x365648(0x123)](_0x365648(0x125),_0x365648(0x127)+_0x1a051f,{'projectPath':_0x41235e,'appCode':_0x1a051f,'datasetCount':_0x53b36c['length'],'filePrefix':_0x40a59d}),!![];}catch(_0x5d7dcc){const _0x4f656b=_0x5d7dcc instanceof Error?_0x5d7dcc[_0x365648(0x128)]:String(_0x5d7dcc);return console[_0x365648(0x11e)](t('api.silent.error',{'error':_0x4f656b})),_0x41235e&&logger[_0x365648(0x11e)]('create-api-pull',_0x365648(0x12b)+_0x4f656b,{'appCode':_0x1a051f,'projectPath':_0x41235e}),![];}finally{_0x1b19e7&&process['chdir'](_0x1b19e7);}}
@@ -1 +1 @@
1
- (function(_0x478fea,_0x5a133e){const _0x440847=a9_0x5031,_0xc348ca=_0x478fea();while(!![]){try{const _0x1055ed=parseInt(_0x440847(0x99))/0x1+parseInt(_0x440847(0x7f))/0x2+-parseInt(_0x440847(0xa2))/0x3+parseInt(_0x440847(0x6b))/0x4*(parseInt(_0x440847(0x7e))/0x5)+-parseInt(_0x440847(0xa6))/0x6*(parseInt(_0x440847(0x92))/0x7)+parseInt(_0x440847(0x9d))/0x8*(-parseInt(_0x440847(0x81))/0x9)+parseInt(_0x440847(0x76))/0xa;if(_0x1055ed===_0x5a133e)break;else _0xc348ca['push'](_0xc348ca['shift']());}catch(_0x226169){_0xc348ca['push'](_0xc348ca['shift']());}}}(a9_0x2543,0xe0d00));import{jsx as a9_0x4da313,jsxs as a9_0x34ae55,Fragment as a9_0x2184f4}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';import{useEffect,useState}from'react';import a9_0x20bc58 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{useI18n}from'../i18n/hooks.js';import.meta.main&&render(a9_0x4da313(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x554684=a9_0x5031,{exit:_0x1ac485}=useApp(),{t:_0x4afafb}=useI18n(),{loading:_0x1e0faa,menuList:_0x470ee1,error:_0x3442f3}=useGetOnlineMenuList(),_0x5bceb4=getLocalPages(),_0x29e120=_0x470ee1[_0x554684(0x7d)](_0x438a7c=>_0x438a7c['path']),_0x1cef38=_0x4afafb(_0x554684(0x95)),_0x7f9066=[_0x1cef38,..._0x5bceb4[_0x554684(0x7d)](_0x3b1186=>_0x3b1186['label'])],_0x1fc2fa=getStringWidth(getMaxWidth(_0x7f9066,0x4)),_0x57f312=getStringWidth(getMaxWidth([_0x1cef38])),[_0x18654e,_0x48a9a4]=useState(_0x554684(0x70)),[_0xa42cb2,_0x5c24e5]=useState(new Set()),[_0x2c7b59,_0x2b70af]=useState(0x0),[_0x50f701,_0x445cc6]=useState(''),[_0xbedcd4,_0xdf07f4]=useState(''),[_0x1e6d5d,_0x2130fb]=useState(''),[_0x382456,_0x41359d]=useState(''),[_0x221cdf,_0x54c172]=useState([]),_0x3dd683=_0x5bceb4[_0x554684(0x7d)](_0x44ff5c=>({'label':_0x44ff5c[_0x554684(0x80)],'path':_0x44ff5c['path'],'local':!![],'online':_0x29e120['includes'](_0x44ff5c[_0x554684(0x71)])})),_0x68546d=_0x5bceb4['filter'](_0x1059bd=>{const _0x453ed2=_0x554684;return!_0x29e120[_0x453ed2(0x74)](_0x1059bd[_0x453ed2(0x71)]);});useEffect(()=>{const _0xe9d12d=_0x554684;if(!_0x1e0faa&&_0x5bceb4[_0xe9d12d(0x6c)]>0x0&&_0xa42cb2[_0xe9d12d(0x89)]===0x0){const _0x43c5d5=new Set(_0x5bceb4['map']((_0x190455,_0x41e412)=>({'page':_0x190455,'index':_0x41e412}))[_0xe9d12d(0x6a)](({page:_0x29e87e})=>!_0x29e120[_0xe9d12d(0x74)](_0x29e87e[_0xe9d12d(0x71)]))[_0xe9d12d(0x7d)](({index:_0x247ee3})=>_0x247ee3));_0x5c24e5(_0x43c5d5);}},[_0x1e0faa,_0x5bceb4['length'],_0x29e120[_0x554684(0x6c)]]),useInput(async(_0x1bafe4,_0x15f75b)=>{const _0xa741f=_0x554684;if(_0x18654e===_0xa741f(0x70)){if(_0x15f75b['upArrow']){_0x2b70af(_0x44a511=>_0x44a511>0x0?_0x44a511-0x1:_0x5bceb4[_0xa741f(0x6c)]-0x1);return;}if(_0x15f75b['downArrow']){_0x2b70af(_0x328bcb=>_0x328bcb<_0x5bceb4[_0xa741f(0x6c)]-0x1?_0x328bcb+0x1:0x0);return;}if(_0x1bafe4==='\x20'){_0x5c24e5(_0x3d0800=>{const _0x20a20b=_0xa741f,_0x96db73=new Set(_0x3d0800);return _0x96db73[_0x20a20b(0x94)](_0x2c7b59)?_0x96db73[_0x20a20b(0x9a)](_0x2c7b59):_0x96db73['add'](_0x2c7b59),_0x96db73;});return;}if(_0x1bafe4==='a'||_0x1bafe4==='A'){const _0x448527=new Set(_0x5bceb4[_0xa741f(0x7d)]((_0x1ed7d5,_0x41211a)=>_0x41211a));_0x5c24e5(_0x448527);return;}if(_0x1bafe4==='i'||_0x1bafe4==='I'||_0x1bafe4==='r'||_0x1bafe4==='R'){_0x5c24e5(_0x53272e=>{const _0x59e62a=_0xa741f,_0x37823b=new Set();for(let _0x2ad015=0x0;_0x2ad015<_0x5bceb4[_0x59e62a(0x6c)];_0x2ad015++){!_0x53272e[_0x59e62a(0x94)](_0x2ad015)&&_0x37823b['add'](_0x2ad015);}return _0x37823b;});return;}if(_0x1bafe4==='q'||_0x1bafe4==='Q'){_0x1ac485();return;}if(_0x15f75b[_0xa741f(0x87)]){if(_0xa42cb2[_0xa741f(0x89)]===0x0){_0x41359d(_0x4afafb(_0xa741f(0x97)));return;}const _0xc01dec=_0x5bceb4[_0xa741f(0x6a)]((_0xe991a2,_0x1a86b6)=>_0xa42cb2[_0xa741f(0x94)](_0x1a86b6)),_0x3c8750=_0xc01dec[_0xa741f(0x7d)](_0x48cb0e=>_0x48cb0e['label'])['join'](',\x20');_0x54c172([{'label':_0x4afafb(_0xa741f(0x79)),'value':_0x4afafb(_0xa741f(0x77),{'count':_0xa42cb2['size']})}]),_0x41359d(''),_0x48a9a4(_0xa741f(0x84));return;}return;}if(_0x18654e===_0xa741f(0x84)){if(_0x15f75b['return']){const _0x19f707=_0x1e6d5d[_0xa741f(0x69)]();if(_0x19f707==='')return;if(!isValidJsHttpsUrl(_0x19f707)){_0x41359d(_0x4afafb(_0xa741f(0x8b)));return;}if(!await isUrlReachable(_0x19f707)){_0x41359d(_0x4afafb(_0xa741f(0x83)));return;}_0x445cc6(_0x19f707),_0x54c172(_0x2f45d6=>[..._0x2f45d6,{'label':_0x4afafb(_0xa741f(0x7a)),'value':_0x19f707}]),_0x2130fb(''),_0x41359d(''),_0x48a9a4(_0xa741f(0xa4));return;}if(_0x15f75b['backspace']||_0x15f75b[_0xa741f(0x9a)]){_0x2130fb(_0xcdd61b=>_0xcdd61b['slice'](0x0,-0x1)),_0x41359d('');return;}_0x2130fb(_0x215355=>_0x215355+_0x1bafe4);return;}if(_0x18654e==='input-css'){if(_0x15f75b[_0xa741f(0x87)]){const _0x5d282a=_0x1e6d5d['trim']();if(_0x5d282a==='')return;if(!isValidCssHttpsUrl(_0x5d282a)){_0x41359d(_0x4afafb('appMenu.sync.error.invalidCssUrl'));return;}if(!await isUrlReachable(_0x5d282a)){_0x41359d(_0x4afafb(_0xa741f(0x85)));return;}_0xdf07f4(_0x5d282a),_0x54c172(_0x3ff5e5=>[..._0x3ff5e5,{'label':_0x4afafb(_0xa741f(0x7c)),'value':_0x5d282a}]),_0x2130fb(''),_0x41359d(''),_0x48a9a4(_0xa741f(0x6d));const _0x1038fe=_0x5bceb4[_0xa741f(0x6a)]((_0x4c19b6,_0x525290)=>_0xa42cb2[_0xa741f(0x94)](_0x525290));createMenus(_0x1038fe,[_0x50f701,_0x5d282a])[_0xa741f(0xa1)](()=>{const _0x18512a=_0xa741f;_0x48a9a4(_0x18512a(0x8c)),setTimeout(()=>{_0x1ac485();},0x3e8);})[_0xa741f(0xab)](_0x1f09db=>{const _0x5672fb=_0xa741f;_0x41359d(_0x1f09db[_0x5672fb(0x86)]||_0x4afafb('appMenu.sync.error.createMenuFailed')),_0x48a9a4(_0x5672fb(0x70));});return;}if(_0x15f75b[_0xa741f(0x67)]||_0x15f75b[_0xa741f(0x9a)]){_0x2130fb(_0x2558ef=>_0x2558ef[_0xa741f(0x82)](0x0,-0x1)),_0x41359d('');return;}_0x2130fb(_0x41b7c0=>_0x41b7c0+_0x1bafe4);return;}});if(_0x1e0faa)return a9_0x34ae55(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a9_0x4da313(Text,{'children':'\x20\x20'}),a9_0x4da313(a9_0x20bc58,{'type':'dots'}),a9_0x4da313(Text,{'children':_0x4afafb(_0x554684(0x73))})]});if(_0x3442f3)return a9_0x34ae55(Box,{'flexDirection':_0x554684(0x88),'marginTop':0x1,'marginBottom':0x1,'children':[a9_0x34ae55(Text,{'color':_0x554684(0x78),'children':['✗\x20',_0x3442f3]}),a9_0x34ae55(Box,{'marginTop':0x1,'children':[a9_0x4da313(Text,{'color':_0x554684(0x7b),'children':_0x4afafb('appMenu.sync.error.authHint.prefix')}),a9_0x4da313(Text,{'color':_0x554684(0x8f),'children':_0x554684(0x8a)}),a9_0x4da313(Text,{'color':_0x554684(0x7b),'children':_0x4afafb(_0x554684(0x68))})]})]});if(_0x5bceb4[_0x554684(0x6c)]===0x0)return a9_0x4da313(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a9_0x4da313(Text,{'color':_0x554684(0x72),'children':_0x4afafb(_0x554684(0x8e))})});return a9_0x34ae55(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':[_0x18654e===_0x554684(0x70)&&a9_0x34ae55(a9_0x2184f4,{'children':[a9_0x34ae55(Box,{'children':[a9_0x34ae55(Text,{'bold':!![],'children':['\x20\x20',_0x1cef38,getRemainingSpaces(_0x1fc2fa,_0x1cef38)]}),a9_0x34ae55(Text,{'bold':!![],'children':[_0x4afafb('appMenu.sync.table.local'),getRemainingSpaces(_0x57f312,_0x1cef38)]}),a9_0x34ae55(Text,{'bold':!![],'children':[_0x4afafb(_0x554684(0x9f)),getRemainingSpaces(_0x57f312,_0x1cef38)]})]}),_0x3dd683['map'](_0x28b086=>a9_0x34ae55(Box,{'children':[a9_0x34ae55(Text,{'children':['\x20\x20',_0x28b086[_0x554684(0x80)],getRemainingSpaces(_0x1fc2fa,_0x28b086[_0x554684(0x80)])]}),a9_0x34ae55(Text,{'color':_0x554684(0xa9),'children':[_0x28b086[_0x554684(0x75)]?'✓':'✗',getRemainingSpaces(_0x57f312,'✓')]}),a9_0x34ae55(Text,{'color':_0x28b086[_0x554684(0xa7)]?_0x554684(0xa9):_0x554684(0x78),'children':[_0x28b086[_0x554684(0xa7)]?'✓':'✗',getRemainingSpaces(_0x57f312,'✓')]})]},_0x28b086['path']))]}),_0x18654e===_0x554684(0x70)&&_0x221cdf[_0x554684(0x6c)]===0x0&&a9_0x4da313(Box,{'marginTop':0x1,'children':a9_0x4da313(Text,{'color':_0x554684(0x8f),'children':_0x4afafb(_0x554684(0x9c))})}),_0x221cdf['map']((_0x175179,_0x3529c3)=>a9_0x34ae55(Box,{'children':[a9_0x34ae55(Text,{'color':'green','children':['√\x20',_0x175179[_0x554684(0x80)],':\x20']}),a9_0x4da313(Text,{'color':_0x554684(0x8f),'children':_0x175179[_0x554684(0xa0)]})]},_0x3529c3)),_0x382456&&_0x18654e===_0x554684(0x70)&&a9_0x4da313(Box,{'marginTop':0x1,'children':a9_0x34ae55(Text,{'color':_0x554684(0x78),'children':['✗\x20',_0x382456]})}),_0x18654e===_0x554684(0x70)&&a9_0x4da313(a9_0x2184f4,{'children':a9_0x34ae55(Box,{'marginTop':_0x221cdf['length']>0x0||_0x382456?0x1:0x0,'flexDirection':'column','children':[a9_0x4da313(Text,{'bold':!![],'children':_0x4afafb(_0x554684(0x93))}),_0x5bceb4[_0x554684(0x7d)]((_0x5219ce,_0x336d43)=>{const _0x452866=_0x554684,_0x2a4b5d=_0x2c7b59===_0x336d43,_0x5c5ee8=_0xa42cb2[_0x452866(0x94)](_0x336d43),_0x3106aa=_0x29e120['includes'](_0x5219ce[_0x452866(0x71)]),_0x173740=_0x3106aa?_0x4afafb('appMenu.sync.operation.update'):_0x4afafb(_0x452866(0x9e));return a9_0x4da313(Box,{'children':a9_0x34ae55(Text,{'backgroundColor':_0x2a4b5d?_0x452866(0x96):undefined,'color':_0x2a4b5d?_0x452866(0x6f):undefined,'children':['\x20\x20',_0x5c5ee8?'[✓]':'[\x20]','\x20',_0x5219ce['label']]})},_0x5219ce[_0x452866(0x71)]);}),a9_0x4da313(Box,{'marginTop':0x1,'children':a9_0x34ae55(Text,{'color':'gray','children':['\x20',_0x4afafb(_0x554684(0xa3))]})})]})}),_0x18654e==='input-js'&&a9_0x34ae55(a9_0x2184f4,{'children':[a9_0x34ae55(Box,{'children':[a9_0x4da313(Text,{'children':_0x4afafb(_0x554684(0x90))}),a9_0x4da313(Text,{'color':_0x554684(0xa9),'children':_0x1e6d5d}),_0x382456&&a9_0x34ae55(Text,{'color':_0x554684(0x78),'children':[_0x554684(0xaa),_0x382456]})]}),!_0x382456&&a9_0x4da313(Box,{'children':a9_0x4da313(Text,{'color':_0x554684(0x7b),'children':_0x4afafb(_0x554684(0x8d))})})]}),_0x18654e===_0x554684(0xa4)&&a9_0x34ae55(a9_0x2184f4,{'children':[a9_0x34ae55(Box,{'children':[a9_0x4da313(Text,{'children':_0x4afafb(_0x554684(0x9b))}),a9_0x4da313(Text,{'color':'green','children':_0x1e6d5d}),_0x382456&&a9_0x34ae55(Text,{'color':_0x554684(0x78),'children':[_0x554684(0xaa),_0x382456]})]}),!_0x382456&&a9_0x4da313(Box,{'children':a9_0x4da313(Text,{'color':_0x554684(0x7b),'children':_0x4afafb(_0x554684(0x98))})})]}),_0x18654e===_0x554684(0x6d)&&a9_0x4da313(Box,{'children':a9_0x4da313(Text,{'children':_0x4afafb(_0x554684(0xa8))})}),_0x18654e==='done'&&a9_0x4da313(Box,{'children':a9_0x4da313(Text,{'color':'green','children':_0x4afafb('appMenu.sync.step.completed')})})]});}function getStringWidth(_0x18352b){const _0x5dceaf=a9_0x5031;let _0x407927=0x0;for(const _0x594ed9 of _0x18352b){/[\u4e00-\u9fa5]/[_0x5dceaf(0x6e)](_0x594ed9)?_0x407927+=0x2:_0x407927+=0x1;}return _0x407927;}function a9_0x2543(){const _0x4f0cc5=['appMenu.sync.table.menuName','blue','appMenu.sync.error.noMenuSelected','appMenu.sync.input.cssUrl.placeholder','230765wJSESx','delete','appMenu.sync.input.cssUrl.label','appMenu.sync.title','4390808GQepWu','appMenu.sync.operation.create','appMenu.sync.table.lovrabetPlatform','value','then','2847627NEjMlX','appMenu.sync.hotkeys','input-css','max','6024zdgfjp','online','appMenu.sync.step.creating','green','\x20←\x20','catch','backspace','appMenu.sync.error.authHint.suffix','trim','filter','4kRFglu','length','creating','test','white','selecting','path','yellow','appMenu.sync.loading.fetchingMenuList','includes','local','23763240ADCoMh','appMenu.sync.step.selectedMenusCount','red','appMenu.sync.step.selectedMenus','appMenu.sync.step.jsUrl','gray','appMenu.sync.step.cssUrl','map','3309005mlBtZa','2684802nRQwJm','label','18ybfjml','slice','appMenu.sync.error.jsUrlUnreachable','input-js','appMenu.sync.error.cssUrlUnreachable','message','return','column','size','lovrabet\x20auth','appMenu.sync.error.invalidJsUrl','done','appMenu.sync.input.jsUrl.placeholder','appMenu.sync.error.noLocalPages','cyan','appMenu.sync.input.jsUrl.label','repeat','11459npEChT','appMenu.sync.step.selectMenus','has'];a9_0x2543=function(){return _0x4f0cc5;};return a9_0x2543();}function getRemainingSpaces(_0x5ce64a,_0x422aab){const _0x3024e1=a9_0x5031,_0x2a85af=getStringWidth(_0x422aab);return Array(Math[_0x3024e1(0xa5)](0x0,_0x5ce64a-_0x2a85af))['fill']('\x20')['join']('');}function a9_0x5031(_0x35e70f,_0x3eebf6){_0x35e70f=_0x35e70f-0x67;const _0x25436e=a9_0x2543();let _0x5031cb=_0x25436e[_0x35e70f];return _0x5031cb;}function getMaxWidth(_0x10dd02,_0x5aebf5=0x2){const _0x1132ca=a9_0x5031;let _0x272229='',_0xef354f=0x0;for(const _0x523614 of _0x10dd02){const _0x2eaf27=getStringWidth(_0x523614);_0x2eaf27>_0xef354f&&(_0xef354f=_0x2eaf27,_0x272229=_0x523614);}return _0x272229+'\x20'[_0x1132ca(0x91)](_0x5aebf5);}
1
+ function a8_0x3910(){const _0x421693=['appMenu.sync.input.jsUrl.placeholder','creating','done','column','trim','appMenu.sync.error.invalidCssUrl','appMenu.sync.step.selectedMenusCount','red','appMenu.sync.error.authHint.suffix','map','input-js','then','gray','appMenu.sync.table.lovrabetPlatform','1252512jhsaeh','appMenu.sync.input.cssUrl.placeholder','7jpJGVU','lovrabet\x20auth','\x20←\x20','fill','has','selecting','appMenu.sync.table.menuName','downArrow','value','2641700RVPQPm','filter','online','size','max','appMenu.sync.operation.update','147633FHdFBA','dots','input-css','appMenu.sync.step.selectedMenus','slice','appMenu.sync.loading.fetchingMenuList','backspace','green','appMenu.sync.step.jsUrl','message','cyan','933444VJNALG','12fGELbL','2010136JWJBKl','upArrow','appMenu.sync.hotkeys','590588KsIDLt','path','appMenu.sync.step.completed','appMenu.sync.step.cssUrl','return','appMenu.sync.step.selectMenus','catch','delete','appMenu.sync.table.local','blue','appMenu.sync.operation.create','appMenu.sync.error.createMenuFailed','appMenu.sync.error.invalidJsUrl','label','white','includes','length','yellow','appMenu.sync.error.authHint.prefix','add','10kTVMjF','test','appMenu.sync.error.noLocalPages','repeat','7229637hfOPIf','appMenu.sync.error.cssUrlUnreachable','join'];a8_0x3910=function(){return _0x421693;};return a8_0x3910();}(function(_0x89412e,_0x14db1e){const _0x5c4bfe=a8_0xd899,_0x80b4be=_0x89412e();while(!![]){try{const _0x29c476=parseInt(_0x5c4bfe(0xd2))/0x1+parseInt(_0x5c4bfe(0xdd))/0x2+-parseInt(_0x5c4bfe(0xde))/0x3*(parseInt(_0x5c4bfe(0xe2))/0x4)+-parseInt(_0x5c4bfe(0xcc))/0x5+-parseInt(_0x5c4bfe(0xc1))/0x6+parseInt(_0x5c4bfe(0xc3))/0x7*(parseInt(_0x5c4bfe(0xdf))/0x8)+parseInt(_0x5c4bfe(0xb0))/0x9*(parseInt(_0x5c4bfe(0xac))/0xa);if(_0x29c476===_0x14db1e)break;else _0x80b4be['push'](_0x80b4be['shift']());}catch(_0x3ab006){_0x80b4be['push'](_0x80b4be['shift']());}}}(a8_0x3910,0x534f3));import{jsx as a8_0x47a222,jsxs as a8_0x4a0ee6,Fragment as a8_0x42778c}from'react/jsx-runtime';import{Text,Box,useInput,useApp,render}from'ink';function a8_0xd899(_0x59c3f3,_0x915b46){_0x59c3f3=_0x59c3f3-0x9d;const _0x3910b4=a8_0x3910();let _0xd89973=_0x3910b4[_0x59c3f3];return _0xd89973;}import{useEffect,useState}from'react';import a8_0x20dcb8 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{useI18n}from'../i18n/hooks.js';import.meta.main&&render(a8_0x47a222(AppMenuSyncUI,{}));export function AppMenuSyncUI(){const _0x22fd7e=a8_0xd899,{exit:_0x14c705}=useApp(),{t:_0x291453}=useI18n(),{loading:_0x30f64e,menuList:_0x586a5e,error:_0x40c32e}=useGetOnlineMenuList(),_0x2136b2=getLocalPages(),_0x122ab7=_0x586a5e['map'](_0x4b85ab=>_0x4b85ab[_0x22fd7e(0xe3)]),_0x33a0a2=_0x291453(_0x22fd7e(0xc9)),_0x589bea=[_0x33a0a2,..._0x2136b2['map'](_0x4703bd=>_0x4703bd[_0x22fd7e(0xa5)])],_0x51b43f=getStringWidth(getMaxWidth(_0x589bea,0x4)),_0x5b747b=getStringWidth(getMaxWidth([_0x33a0a2])),[_0x3871d0,_0x22b9cc]=useState('selecting'),[_0x2c3666,_0x1aacc7]=useState(new Set()),[_0x5a97f8,_0x420445]=useState(0x0),[_0x36d5a1,_0x41f413]=useState(''),[_0x378e73,_0x47920b]=useState(''),[_0x3972fd,_0x19f81e]=useState(''),[_0x25b037,_0x2b9105]=useState(''),[_0x24cc79,_0x283251]=useState([]),_0x3ee8a1=_0x2136b2[_0x22fd7e(0xbc)](_0x416f46=>({'label':_0x416f46[_0x22fd7e(0xa5)],'path':_0x416f46[_0x22fd7e(0xe3)],'local':!![],'online':_0x122ab7['includes'](_0x416f46['path'])})),_0x1bbf6c=_0x2136b2['filter'](_0x4b4b9f=>{const _0x149bdc=_0x22fd7e;return!_0x122ab7[_0x149bdc(0xa7)](_0x4b4b9f[_0x149bdc(0xe3)]);});useEffect(()=>{const _0x4a0b3e=_0x22fd7e;if(!_0x30f64e&&_0x2136b2[_0x4a0b3e(0xa8)]>0x0&&_0x2c3666['size']===0x0){const _0x26fa0d=new Set(_0x2136b2[_0x4a0b3e(0xbc)]((_0x2b1adf,_0x379d24)=>({'page':_0x2b1adf,'index':_0x379d24}))['filter'](({page:_0x7066cc})=>!_0x122ab7[_0x4a0b3e(0xa7)](_0x7066cc[_0x4a0b3e(0xe3)]))[_0x4a0b3e(0xbc)](({index:_0x13ed18})=>_0x13ed18));_0x1aacc7(_0x26fa0d);}},[_0x30f64e,_0x2136b2[_0x22fd7e(0xa8)],_0x122ab7['length']]),useInput(async(_0x3d6a7b,_0x3273b3)=>{const _0x52f0bc=_0x22fd7e;if(_0x3871d0===_0x52f0bc(0xc8)){if(_0x3273b3[_0x52f0bc(0xe0)]){_0x420445(_0x25c0c4=>_0x25c0c4>0x0?_0x25c0c4-0x1:_0x2136b2[_0x52f0bc(0xa8)]-0x1);return;}if(_0x3273b3[_0x52f0bc(0xca)]){_0x420445(_0x3f6cd1=>_0x3f6cd1<_0x2136b2[_0x52f0bc(0xa8)]-0x1?_0x3f6cd1+0x1:0x0);return;}if(_0x3d6a7b==='\x20'){_0x1aacc7(_0x1b27e1=>{const _0x1b9e4c=_0x52f0bc,_0x13df9e=new Set(_0x1b27e1);return _0x13df9e[_0x1b9e4c(0xc7)](_0x5a97f8)?_0x13df9e[_0x1b9e4c(0x9f)](_0x5a97f8):_0x13df9e[_0x1b9e4c(0xab)](_0x5a97f8),_0x13df9e;});return;}if(_0x3d6a7b==='a'||_0x3d6a7b==='A'){const _0x33f4ea=new Set(_0x2136b2[_0x52f0bc(0xbc)]((_0x30fa1d,_0x3df686)=>_0x3df686));_0x1aacc7(_0x33f4ea);return;}if(_0x3d6a7b==='i'||_0x3d6a7b==='I'||_0x3d6a7b==='r'||_0x3d6a7b==='R'){_0x1aacc7(_0x3d3e29=>{const _0x1eab47=_0x52f0bc,_0x27c9c9=new Set();for(let _0x3bca50=0x0;_0x3bca50<_0x2136b2[_0x1eab47(0xa8)];_0x3bca50++){!_0x3d3e29['has'](_0x3bca50)&&_0x27c9c9[_0x1eab47(0xab)](_0x3bca50);}return _0x27c9c9;});return;}if(_0x3d6a7b==='q'||_0x3d6a7b==='Q'){_0x14c705();return;}if(_0x3273b3[_0x52f0bc(0xe6)]){if(_0x2c3666[_0x52f0bc(0xcf)]===0x0){_0x2b9105(_0x291453('appMenu.sync.error.noMenuSelected'));return;}const _0x210ba9=_0x2136b2[_0x52f0bc(0xcd)]((_0x14c7c2,_0x1c9f48)=>_0x2c3666['has'](_0x1c9f48)),_0x26e154=_0x210ba9['map'](_0x36e94d=>_0x36e94d[_0x52f0bc(0xa5)])[_0x52f0bc(0xb2)](',\x20');_0x283251([{'label':_0x291453(_0x52f0bc(0xd5)),'value':_0x291453(_0x52f0bc(0xb9),{'count':_0x2c3666[_0x52f0bc(0xcf)]})}]),_0x2b9105(''),_0x22b9cc(_0x52f0bc(0xbd));return;}return;}if(_0x3871d0===_0x52f0bc(0xbd)){if(_0x3273b3['return']){const _0xf4ea8e=_0x3972fd[_0x52f0bc(0xb7)]();if(_0xf4ea8e==='')return;if(!isValidJsHttpsUrl(_0xf4ea8e)){_0x2b9105(_0x291453(_0x52f0bc(0xa4)));return;}if(!await isUrlReachable(_0xf4ea8e)){_0x2b9105(_0x291453('appMenu.sync.error.jsUrlUnreachable'));return;}_0x41f413(_0xf4ea8e),_0x283251(_0x5494b6=>[..._0x5494b6,{'label':_0x291453(_0x52f0bc(0xda)),'value':_0xf4ea8e}]),_0x19f81e(''),_0x2b9105(''),_0x22b9cc(_0x52f0bc(0xd4));return;}if(_0x3273b3[_0x52f0bc(0xd8)]||_0x3273b3['delete']){_0x19f81e(_0x28999f=>_0x28999f[_0x52f0bc(0xd6)](0x0,-0x1)),_0x2b9105('');return;}_0x19f81e(_0x16582a=>_0x16582a+_0x3d6a7b);return;}if(_0x3871d0===_0x52f0bc(0xd4)){if(_0x3273b3['return']){const _0x54c704=_0x3972fd[_0x52f0bc(0xb7)]();if(_0x54c704==='')return;if(!isValidCssHttpsUrl(_0x54c704)){_0x2b9105(_0x291453(_0x52f0bc(0xb8)));return;}if(!await isUrlReachable(_0x54c704)){_0x2b9105(_0x291453(_0x52f0bc(0xb1)));return;}_0x47920b(_0x54c704),_0x283251(_0x161942=>[..._0x161942,{'label':_0x291453(_0x52f0bc(0xe5)),'value':_0x54c704}]),_0x19f81e(''),_0x2b9105(''),_0x22b9cc(_0x52f0bc(0xb4));const _0x69345a=_0x2136b2[_0x52f0bc(0xcd)]((_0x517b47,_0x211ca6)=>_0x2c3666[_0x52f0bc(0xc7)](_0x211ca6));createMenus(_0x69345a,[_0x36d5a1,_0x54c704])[_0x52f0bc(0xbe)](()=>{const _0x4b7daa=_0x52f0bc;_0x22b9cc(_0x4b7daa(0xb5)),setTimeout(()=>{_0x14c705();},0x3e8);})[_0x52f0bc(0x9e)](_0x2980b5=>{const _0x118218=_0x52f0bc;_0x2b9105(_0x2980b5[_0x118218(0xdb)]||_0x291453(_0x118218(0xa3))),_0x22b9cc(_0x118218(0xc8));});return;}if(_0x3273b3[_0x52f0bc(0xd8)]||_0x3273b3[_0x52f0bc(0x9f)]){_0x19f81e(_0xf4f5db=>_0xf4f5db[_0x52f0bc(0xd6)](0x0,-0x1)),_0x2b9105('');return;}_0x19f81e(_0xf53589=>_0xf53589+_0x3d6a7b);return;}});if(_0x30f64e)return a8_0x4a0ee6(Box,{'marginTop':0x1,'marginBottom':0x1,'children':[a8_0x47a222(Text,{'children':'\x20\x20'}),a8_0x47a222(a8_0x20dcb8,{'type':_0x22fd7e(0xd3)}),a8_0x47a222(Text,{'children':_0x291453(_0x22fd7e(0xd7))})]});if(_0x40c32e)return a8_0x4a0ee6(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':[a8_0x4a0ee6(Text,{'color':_0x22fd7e(0xba),'children':['✗\x20',_0x40c32e]}),a8_0x4a0ee6(Box,{'marginTop':0x1,'children':[a8_0x47a222(Text,{'color':_0x22fd7e(0xbf),'children':_0x291453(_0x22fd7e(0xaa))}),a8_0x47a222(Text,{'color':_0x22fd7e(0xdc),'children':_0x22fd7e(0xc4)}),a8_0x47a222(Text,{'color':'gray','children':_0x291453(_0x22fd7e(0xbb))})]})]});if(_0x2136b2[_0x22fd7e(0xa8)]===0x0)return a8_0x47a222(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a8_0x47a222(Text,{'color':_0x22fd7e(0xa9),'children':_0x291453(_0x22fd7e(0xae))})});return a8_0x4a0ee6(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':[_0x3871d0===_0x22fd7e(0xc8)&&a8_0x4a0ee6(a8_0x42778c,{'children':[a8_0x4a0ee6(Box,{'children':[a8_0x4a0ee6(Text,{'bold':!![],'children':['\x20\x20',_0x33a0a2,getRemainingSpaces(_0x51b43f,_0x33a0a2)]}),a8_0x4a0ee6(Text,{'bold':!![],'children':[_0x291453(_0x22fd7e(0xa0)),getRemainingSpaces(_0x5b747b,_0x33a0a2)]}),a8_0x4a0ee6(Text,{'bold':!![],'children':[_0x291453(_0x22fd7e(0xc0)),getRemainingSpaces(_0x5b747b,_0x33a0a2)]})]}),_0x3ee8a1['map'](_0x244e9e=>a8_0x4a0ee6(Box,{'children':[a8_0x4a0ee6(Text,{'children':['\x20\x20',_0x244e9e['label'],getRemainingSpaces(_0x51b43f,_0x244e9e[_0x22fd7e(0xa5)])]}),a8_0x4a0ee6(Text,{'color':_0x22fd7e(0xd9),'children':[_0x244e9e['local']?'✓':'✗',getRemainingSpaces(_0x5b747b,'✓')]}),a8_0x4a0ee6(Text,{'color':_0x244e9e['online']?_0x22fd7e(0xd9):_0x22fd7e(0xba),'children':[_0x244e9e[_0x22fd7e(0xce)]?'✓':'✗',getRemainingSpaces(_0x5b747b,'✓')]})]},_0x244e9e[_0x22fd7e(0xe3)]))]}),_0x3871d0==='selecting'&&_0x24cc79[_0x22fd7e(0xa8)]===0x0&&a8_0x47a222(Box,{'marginTop':0x1,'children':a8_0x47a222(Text,{'color':_0x22fd7e(0xdc),'children':_0x291453('appMenu.sync.title')})}),_0x24cc79[_0x22fd7e(0xbc)]((_0x375de1,_0x20acc2)=>a8_0x4a0ee6(Box,{'children':[a8_0x4a0ee6(Text,{'color':_0x22fd7e(0xd9),'children':['√\x20',_0x375de1[_0x22fd7e(0xa5)],':\x20']}),a8_0x47a222(Text,{'color':_0x22fd7e(0xdc),'children':_0x375de1[_0x22fd7e(0xcb)]})]},_0x20acc2)),_0x25b037&&_0x3871d0==='selecting'&&a8_0x47a222(Box,{'marginTop':0x1,'children':a8_0x4a0ee6(Text,{'color':_0x22fd7e(0xba),'children':['✗\x20',_0x25b037]})}),_0x3871d0===_0x22fd7e(0xc8)&&a8_0x47a222(a8_0x42778c,{'children':a8_0x4a0ee6(Box,{'marginTop':_0x24cc79[_0x22fd7e(0xa8)]>0x0||_0x25b037?0x1:0x0,'flexDirection':_0x22fd7e(0xb6),'children':[a8_0x47a222(Text,{'bold':!![],'children':_0x291453(_0x22fd7e(0x9d))}),_0x2136b2[_0x22fd7e(0xbc)]((_0x53cb23,_0x190925)=>{const _0x3eee45=_0x22fd7e,_0x55f4b2=_0x5a97f8===_0x190925,_0x5ea8f3=_0x2c3666[_0x3eee45(0xc7)](_0x190925),_0x1205b6=_0x122ab7[_0x3eee45(0xa7)](_0x53cb23[_0x3eee45(0xe3)]),_0x46c4f1=_0x1205b6?_0x291453(_0x3eee45(0xd1)):_0x291453(_0x3eee45(0xa2));return a8_0x47a222(Box,{'children':a8_0x4a0ee6(Text,{'backgroundColor':_0x55f4b2?_0x3eee45(0xa1):undefined,'color':_0x55f4b2?_0x3eee45(0xa6):undefined,'children':['\x20\x20',_0x5ea8f3?'[✓]':'[\x20]','\x20',_0x53cb23[_0x3eee45(0xa5)]]})},_0x53cb23[_0x3eee45(0xe3)]);}),a8_0x47a222(Box,{'marginTop':0x1,'children':a8_0x4a0ee6(Text,{'color':_0x22fd7e(0xbf),'children':['\x20',_0x291453(_0x22fd7e(0xe1))]})})]})}),_0x3871d0===_0x22fd7e(0xbd)&&a8_0x4a0ee6(a8_0x42778c,{'children':[a8_0x4a0ee6(Box,{'children':[a8_0x47a222(Text,{'children':_0x291453('appMenu.sync.input.jsUrl.label')}),a8_0x47a222(Text,{'color':'green','children':_0x3972fd}),_0x25b037&&a8_0x4a0ee6(Text,{'color':'red','children':[_0x22fd7e(0xc5),_0x25b037]})]}),!_0x25b037&&a8_0x47a222(Box,{'children':a8_0x47a222(Text,{'color':'gray','children':_0x291453(_0x22fd7e(0xb3))})})]}),_0x3871d0===_0x22fd7e(0xd4)&&a8_0x4a0ee6(a8_0x42778c,{'children':[a8_0x4a0ee6(Box,{'children':[a8_0x47a222(Text,{'children':_0x291453('appMenu.sync.input.cssUrl.label')}),a8_0x47a222(Text,{'color':_0x22fd7e(0xd9),'children':_0x3972fd}),_0x25b037&&a8_0x4a0ee6(Text,{'color':_0x22fd7e(0xba),'children':[_0x22fd7e(0xc5),_0x25b037]})]}),!_0x25b037&&a8_0x47a222(Box,{'children':a8_0x47a222(Text,{'color':_0x22fd7e(0xbf),'children':_0x291453(_0x22fd7e(0xc2))})})]}),_0x3871d0===_0x22fd7e(0xb4)&&a8_0x47a222(Box,{'children':a8_0x47a222(Text,{'children':_0x291453('appMenu.sync.step.creating')})}),_0x3871d0===_0x22fd7e(0xb5)&&a8_0x47a222(Box,{'children':a8_0x47a222(Text,{'color':_0x22fd7e(0xd9),'children':_0x291453(_0x22fd7e(0xe4))})})]});}function getStringWidth(_0x5ea88c){const _0x5efe61=a8_0xd899;let _0x3fea76=0x0;for(const _0x55a876 of _0x5ea88c){/[\u4e00-\u9fa5]/[_0x5efe61(0xad)](_0x55a876)?_0x3fea76+=0x2:_0x3fea76+=0x1;}return _0x3fea76;}function getRemainingSpaces(_0x3813d9,_0x34aef2){const _0x3bc6d8=a8_0xd899,_0x157383=getStringWidth(_0x34aef2);return Array(Math[_0x3bc6d8(0xd0)](0x0,_0x3813d9-_0x157383))[_0x3bc6d8(0xc6)]('\x20')[_0x3bc6d8(0xb2)]('');}function getMaxWidth(_0x30f77a,_0x12943e=0x2){const _0x505adc=a8_0xd899;let _0x319d03='',_0x565f77=0x0;for(const _0x18680b of _0x30f77a){const _0x18a3cf=getStringWidth(_0x18680b);_0x18a3cf>_0x565f77&&(_0x565f77=_0x18a3cf,_0x319d03=_0x18680b);}return _0x319d03+'\x20'[_0x505adc(0xaf)](_0x12943e);}
@@ -1 +1 @@
1
- const a10_0x5df351=a10_0xc102;(function(_0x30d42e,_0x14edd7){const _0x5e95cb=a10_0xc102,_0x539cd9=_0x30d42e();while(!![]){try{const _0x18c30a=-parseInt(_0x5e95cb(0xaf))/0x1*(-parseInt(_0x5e95cb(0xbd))/0x2)+-parseInt(_0x5e95cb(0xca))/0x3*(parseInt(_0x5e95cb(0xc1))/0x4)+parseInt(_0x5e95cb(0xb3))/0x5*(parseInt(_0x5e95cb(0xa8))/0x6)+parseInt(_0x5e95cb(0xc4))/0x7*(parseInt(_0x5e95cb(0xcb))/0x8)+-parseInt(_0x5e95cb(0xb5))/0x9+parseInt(_0x5e95cb(0xae))/0xa+-parseInt(_0x5e95cb(0xc6))/0xb*(parseInt(_0x5e95cb(0xcc))/0xc);if(_0x18c30a===_0x14edd7)break;else _0x539cd9['push'](_0x539cd9['shift']());}catch(_0x33bea3){_0x539cd9['push'](_0x539cd9['shift']());}}}(a10_0x4a31,0x53cd9));function a10_0xc102(_0x49e5b8,_0x29476c){_0x49e5b8=_0x49e5b8-0xa1;const _0x4a3138=a10_0x4a31();let _0xc10216=_0x4a3138[_0x49e5b8];return _0xc10216;}import{getCookie}from'../auth/get-cookie.js';function a10_0x4a31(){const _0x3167f7=['import','appMenu.error.appCodeHint.option2','345oGQzVu','appMenu.error.createHttpStatus','4737303akBHgs','appMenu.error.authExpired','create-menus','success','0011','create-menu','appMenu.creating.batch.start','bind','522846fHdmbg','POST','appMenu.error.appCodeHint.title','data','20eDNvAW','errorCode','stringify','7KheLvC','appMenu.error.missingAppCode','44bJimnv','appMenu.creating.single','json','common.error','182238yaWdJS','5312008MdeunI','1525224nXvvrk','errorMsg','status','error','all','appMenu.error.createFailed','length','application/json','label','resources','/smartapi/menu/create','info','9402Lvgyjc','appcode','log','map','procode','appMenu.success.created','6482150VPSZLz','1omqFwA','appMenu.error.appCodeHint.option1'];a10_0x4a31=function(){return _0x3167f7;};return a10_0x4a31();}import{getApiDomain}from'../constant/domain.js';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';import a10_0xe55c30 from'../i18n/index.js';const config=readConfig(),t=a10_0xe55c30['t'][a10_0x5df351(0xbc)](a10_0xe55c30);export async function createMenu(_0x560fbc){const _0x136811=a10_0x5df351,_0x3738f4=config?.[_0x136811(0xa9)];if(!_0x3738f4){const _0xaa9e94=t(_0x136811(0xc5));logger[_0x136811(0xcf)](_0x136811(0xba),_0xaa9e94),console['error']('×\x20'+_0xaa9e94),console[_0x136811(0xaa)](t('appMenu.error.appCodeHint.title')),console[_0x136811(0xaa)](t('appMenu.error.appCodeHint.option1')),console[_0x136811(0xaa)](t(_0x136811(0xb2)));return;}logger[_0x136811(0xa7)]('create-menu',t(_0x136811(0xc7),{'label':_0x560fbc[_0x136811(0xa4)],'path':_0x560fbc['path']}));const _0xafb307={'appCode':_0x3738f4,'type':_0x136811(0xac),'sort':0x0,'extend':{'loadScriptMode':'import','resources':_0x560fbc[_0x136811(0xa5)]?JSON[_0x136811(0xc3)](_0x560fbc[_0x136811(0xa5)]):undefined},..._0x560fbc},_0x15fc56=await fetch(getApiDomain()+_0x136811(0xa6),{'method':_0x136811(0xbe),'body':JSON[_0x136811(0xc3)](_0xafb307),'headers':{'Content-Type':_0x136811(0xa3),'Cookie':getCookie()}});if(!_0x15fc56['ok']){if(_0x15fc56[_0x136811(0xce)]===0x191){const _0x4c5de4=t('appMenu.error.authExpired');logger[_0x136811(0xcf)](_0x136811(0xba),_0x4c5de4,{'status':_0x15fc56[_0x136811(0xce)],'menu':_0x560fbc[_0x136811(0xa4)]});throw new Error(_0x4c5de4);}const _0x34de13=t('appMenu.error.createHttpStatus',{'status':_0x15fc56[_0x136811(0xce)]});logger[_0x136811(0xcf)](_0x136811(0xba),_0x34de13,{'menu':_0x560fbc[_0x136811(0xa4)]});throw new Error(_0x34de13);}const _0x3c2a9e=await _0x15fc56[_0x136811(0xc8)]();if(!_0x3c2a9e[_0x136811(0xb8)]){const _0xab4bb0=t('appMenu.error.createFailed',{'error':_0x3c2a9e[_0x136811(0xcd)]||t('common.error')});logger[_0x136811(0xcf)](_0x136811(0xba),_0xab4bb0,{'errorCode':_0x3c2a9e['errorCode'],'errorMsg':_0x3c2a9e[_0x136811(0xcd)],'menu':_0x560fbc[_0x136811(0xa4)]});throw new Error(_0xab4bb0);}logger[_0x136811(0xa7)](_0x136811(0xba),''+t(_0x136811(0xad))+_0x560fbc[_0x136811(0xa4)],_0x3c2a9e['data']),console[_0x136811(0xaa)](t('appMenu.success.created'),_0x3c2a9e[_0x136811(0xc0)]);}async function _createMenu(_0x404ec5,_0x1ab54c){const _0x48f553=a10_0x5df351,_0x125bad=config?.[_0x48f553(0xa9)];if(!_0x125bad){const _0x45047d=t('appMenu.error.missingAppCode');logger[_0x48f553(0xcf)](_0x48f553(0xba),_0x45047d),console[_0x48f553(0xcf)]('×\x20'+_0x45047d),console['log'](t(_0x48f553(0xbf))),console[_0x48f553(0xaa)](t(_0x48f553(0xb0))),console[_0x48f553(0xaa)](t(_0x48f553(0xb2)));return;}const _0x470856={'appCode':_0x125bad,'type':_0x48f553(0xac),'sort':0x0,'extend':{'loadScriptMode':_0x48f553(0xb1),'resources':_0x1ab54c?JSON[_0x48f553(0xc3)](_0x1ab54c):undefined},'label':_0x404ec5['label'],'path':_0x404ec5['path']},_0x2ccfb6=await fetch(getApiDomain()+_0x48f553(0xa6),{'method':_0x48f553(0xbe),'body':JSON[_0x48f553(0xc3)](_0x470856),'headers':{'Content-Type':'application/json','Cookie':getCookie()}});if(!_0x2ccfb6['ok']){if(_0x2ccfb6[_0x48f553(0xce)]===0x191){const _0x205def=t(_0x48f553(0xb6));logger['error'](_0x48f553(0xba),_0x205def,{'status':_0x2ccfb6[_0x48f553(0xce)],'menu':_0x404ec5['label']});throw new Error(_0x205def);}const _0x3ba8f4=t(_0x48f553(0xb4),{'status':_0x2ccfb6[_0x48f553(0xce)]});logger[_0x48f553(0xcf)](_0x48f553(0xba),_0x3ba8f4,{'menu':_0x404ec5['label']});throw new Error(_0x3ba8f4);}const _0x163167=await _0x2ccfb6['json']();if(!_0x163167[_0x48f553(0xb8)]){if(_0x163167['errorCode']===_0x48f553(0xb9)||_0x163167['errorMsg']?.['includes']('登录')){const _0x39218d=t('appMenu.error.authValidationFailed');logger[_0x48f553(0xcf)](_0x48f553(0xba),_0x39218d,{'errorCode':_0x163167[_0x48f553(0xc2)],'errorMsg':_0x163167[_0x48f553(0xcd)],'menu':_0x404ec5[_0x48f553(0xa4)]});throw new Error(_0x39218d);}const _0xf9571f=t(_0x48f553(0xa1),{'error':_0x163167['errorMsg']||t(_0x48f553(0xc9))});logger[_0x48f553(0xcf)](_0x48f553(0xba),_0xf9571f,{'errorCode':_0x163167[_0x48f553(0xc2)],'errorMsg':_0x163167[_0x48f553(0xcd)],'menu':_0x404ec5[_0x48f553(0xa4)]});throw new Error(_0xf9571f);}logger[_0x48f553(0xa7)]('create-menu',''+t('appMenu.success.created')+_0x404ec5['label']);}export async function createMenus(_0x1bb25b,_0x2c3b45){const _0x15720e=a10_0x5df351;logger[_0x15720e(0xa7)](_0x15720e(0xb7),t(_0x15720e(0xbb),{'count':_0x1bb25b['length']})),await Promise[_0x15720e(0xd0)](_0x1bb25b[_0x15720e(0xab)](async _0x540242=>{await _createMenu(_0x540242,_0x2c3b45);})),logger['info']('create-menus',t('appMenu.creating.batch.completed',{'count':_0x1bb25b[_0x15720e(0xa2)]}));}
1
+ const a9_0x275898=a9_0x2530;(function(_0xd82aea,_0x33f541){const _0x26988c=a9_0x2530,_0x4911d3=_0xd82aea();while(!![]){try{const _0x1f42b2=parseInt(_0x26988c(0x193))/0x1+-parseInt(_0x26988c(0x1a2))/0x2+-parseInt(_0x26988c(0x1a6))/0x3*(parseInt(_0x26988c(0x1a8))/0x4)+-parseInt(_0x26988c(0x1a0))/0x5+-parseInt(_0x26988c(0x1ad))/0x6+-parseInt(_0x26988c(0x1b3))/0x7+parseInt(_0x26988c(0x1a4))/0x8;if(_0x1f42b2===_0x33f541)break;else _0x4911d3['push'](_0x4911d3['shift']());}catch(_0x3b8c06){_0x4911d3['push'](_0x4911d3['shift']());}}}(a9_0x46aa,0x21fb7));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{readConfig}from'../utils/config.js';function a9_0x2530(_0x350d0e,_0x912a2b){_0x350d0e=_0x350d0e-0x192;const _0x46aa5c=a9_0x46aa();let _0x253011=_0x46aa5c[_0x350d0e];return _0x253011;}import{logger}from'../utils/logger.js';import a9_0x1beb2e from'../i18n/index.js';const config=readConfig(),t=a9_0x1beb2e['t'][a9_0x275898(0x1b8)](a9_0x1beb2e);function a9_0x46aa(){const _0x503882=['status','errorCode','json','create-menus','info','create-menu','0011','573270TcYRZd','success','218442XUDUMo','appMenu.error.authValidationFailed','4820592upQket','appMenu.creating.batch.completed','4035QvPEBU','appMenu.error.authExpired','428VHNYXz','application/json','appMenu.error.appCodeHint.option1','/smartapi/menu/create','POST','206124KRuKMx','appcode','appMenu.creating.batch.start','common.error','appMenu.error.createFailed','all','1923663SQNqUH','appMenu.error.missingAppCode','stringify','label','procode','bind','length','appMenu.creating.single','import','error','data','appMenu.error.appCodeHint.option2','appMenu.success.created','213570mHDmKX','errorMsg','appMenu.error.appCodeHint.title','map','path','log'];a9_0x46aa=function(){return _0x503882;};return a9_0x46aa();}export async function createMenu(_0x53bd35){const _0x3b0e74=a9_0x275898,_0xf69b30=config?.[_0x3b0e74(0x1ae)];if(!_0xf69b30){const _0x13c16f=t(_0x3b0e74(0x1b4));logger[_0x3b0e74(0x1bc)](_0x3b0e74(0x19e),_0x13c16f),console[_0x3b0e74(0x1bc)]('×\x20'+_0x13c16f),console[_0x3b0e74(0x198)](t(_0x3b0e74(0x195))),console[_0x3b0e74(0x198)](t(_0x3b0e74(0x1aa))),console[_0x3b0e74(0x198)](t(_0x3b0e74(0x1be)));return;}logger[_0x3b0e74(0x19d)](_0x3b0e74(0x19e),t(_0x3b0e74(0x1ba),{'label':_0x53bd35[_0x3b0e74(0x1b6)],'path':_0x53bd35[_0x3b0e74(0x197)]}));const _0x2d61e9={'appCode':_0xf69b30,'type':'procode','sort':0x0,'extend':{'loadScriptMode':_0x3b0e74(0x1bb),'resources':_0x53bd35['resources']?JSON[_0x3b0e74(0x1b5)](_0x53bd35['resources']):undefined},..._0x53bd35},_0x3810b0=await fetch(getApiDomain()+_0x3b0e74(0x1ab),{'method':'POST','body':JSON[_0x3b0e74(0x1b5)](_0x2d61e9),'headers':{'Content-Type':_0x3b0e74(0x1a9),'Cookie':getCookie()}});if(!_0x3810b0['ok']){if(_0x3810b0[_0x3b0e74(0x199)]===0x191){const _0xd08a8c=t(_0x3b0e74(0x1a7));logger[_0x3b0e74(0x1bc)](_0x3b0e74(0x19e),_0xd08a8c,{'status':_0x3810b0[_0x3b0e74(0x199)],'menu':_0x53bd35[_0x3b0e74(0x1b6)]});throw new Error(_0xd08a8c);}const _0x34dcba=t('appMenu.error.createHttpStatus',{'status':_0x3810b0[_0x3b0e74(0x199)]});logger[_0x3b0e74(0x1bc)](_0x3b0e74(0x19e),_0x34dcba,{'menu':_0x53bd35[_0x3b0e74(0x1b6)]});throw new Error(_0x34dcba);}const _0x2cdc2e=await _0x3810b0[_0x3b0e74(0x19b)]();if(!_0x2cdc2e[_0x3b0e74(0x1a1)]){const _0x549dd5=t(_0x3b0e74(0x1b1),{'error':_0x2cdc2e[_0x3b0e74(0x194)]||t('common.error')});logger[_0x3b0e74(0x1bc)]('create-menu',_0x549dd5,{'errorCode':_0x2cdc2e['errorCode'],'errorMsg':_0x2cdc2e[_0x3b0e74(0x194)],'menu':_0x53bd35[_0x3b0e74(0x1b6)]});throw new Error(_0x549dd5);}logger[_0x3b0e74(0x19d)](_0x3b0e74(0x19e),''+t(_0x3b0e74(0x192))+_0x53bd35[_0x3b0e74(0x1b6)],_0x2cdc2e[_0x3b0e74(0x1bd)]),console['log'](t(_0x3b0e74(0x192)),_0x2cdc2e[_0x3b0e74(0x1bd)]);}async function _createMenu(_0x1ca388,_0x28bfb0){const _0x55d1cc=a9_0x275898,_0x4a4a75=config?.[_0x55d1cc(0x1ae)];if(!_0x4a4a75){const _0x1a74d9=t(_0x55d1cc(0x1b4));logger['error'](_0x55d1cc(0x19e),_0x1a74d9),console[_0x55d1cc(0x1bc)]('×\x20'+_0x1a74d9),console['log'](t(_0x55d1cc(0x195))),console[_0x55d1cc(0x198)](t('appMenu.error.appCodeHint.option1')),console[_0x55d1cc(0x198)](t(_0x55d1cc(0x1be)));return;}const _0x211a0={'appCode':_0x4a4a75,'type':_0x55d1cc(0x1b7),'sort':0x0,'extend':{'loadScriptMode':_0x55d1cc(0x1bb),'resources':_0x28bfb0?JSON[_0x55d1cc(0x1b5)](_0x28bfb0):undefined},'label':_0x1ca388[_0x55d1cc(0x1b6)],'path':_0x1ca388[_0x55d1cc(0x197)]},_0x56001b=await fetch(getApiDomain()+'/smartapi/menu/create',{'method':_0x55d1cc(0x1ac),'body':JSON[_0x55d1cc(0x1b5)](_0x211a0),'headers':{'Content-Type':_0x55d1cc(0x1a9),'Cookie':getCookie()}});if(!_0x56001b['ok']){if(_0x56001b[_0x55d1cc(0x199)]===0x191){const _0xba08d5=t(_0x55d1cc(0x1a7));logger[_0x55d1cc(0x1bc)]('create-menu',_0xba08d5,{'status':_0x56001b[_0x55d1cc(0x199)],'menu':_0x1ca388[_0x55d1cc(0x1b6)]});throw new Error(_0xba08d5);}const _0x2c3f1e=t('appMenu.error.createHttpStatus',{'status':_0x56001b[_0x55d1cc(0x199)]});logger[_0x55d1cc(0x1bc)]('create-menu',_0x2c3f1e,{'menu':_0x1ca388[_0x55d1cc(0x1b6)]});throw new Error(_0x2c3f1e);}const _0x4a83ec=await _0x56001b[_0x55d1cc(0x19b)]();if(!_0x4a83ec[_0x55d1cc(0x1a1)]){if(_0x4a83ec[_0x55d1cc(0x19a)]===_0x55d1cc(0x19f)||_0x4a83ec[_0x55d1cc(0x194)]?.['includes']('登录')){const _0xf63c65=t(_0x55d1cc(0x1a3));logger[_0x55d1cc(0x1bc)](_0x55d1cc(0x19e),_0xf63c65,{'errorCode':_0x4a83ec[_0x55d1cc(0x19a)],'errorMsg':_0x4a83ec['errorMsg'],'menu':_0x1ca388[_0x55d1cc(0x1b6)]});throw new Error(_0xf63c65);}const _0x321404=t('appMenu.error.createFailed',{'error':_0x4a83ec[_0x55d1cc(0x194)]||t(_0x55d1cc(0x1b0))});logger[_0x55d1cc(0x1bc)](_0x55d1cc(0x19e),_0x321404,{'errorCode':_0x4a83ec[_0x55d1cc(0x19a)],'errorMsg':_0x4a83ec['errorMsg'],'menu':_0x1ca388[_0x55d1cc(0x1b6)]});throw new Error(_0x321404);}logger[_0x55d1cc(0x19d)](_0x55d1cc(0x19e),''+t('appMenu.success.created')+_0x1ca388[_0x55d1cc(0x1b6)]);}export async function createMenus(_0x1fe4fb,_0x4b07fb){const _0x46d617=a9_0x275898;logger[_0x46d617(0x19d)]('create-menus',t(_0x46d617(0x1af),{'count':_0x1fe4fb['length']})),await Promise[_0x46d617(0x1b2)](_0x1fe4fb[_0x46d617(0x196)](async _0x20d1b1=>{await _createMenu(_0x20d1b1,_0x4b07fb);})),logger[_0x46d617(0x19d)](_0x46d617(0x19c),t(_0x46d617(0x1a5),{'count':_0x1fe4fb[_0x46d617(0x1b9)]}));}