icoa-cli 2.19.403 → 2.19.404
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/ai4ctf.js +1 -1
- package/dist/commands/ai4ioai.js +1 -1
- package/dist/commands/arena.js +1 -1
- package/dist/commands/ctf.js +1 -1
- package/dist/commands/ctf4ai-demo.js +1 -1
- package/dist/commands/ctf4vla.js +1 -1
- package/dist/commands/demo2.js +1 -1
- package/dist/commands/exam.js +1 -1
- package/dist/commands/ioailab.js +1 -1
- package/dist/commands/ipynb.js +1 -1
- package/dist/commands/learn.js +1 -1
- package/dist/commands/sim.js +1 -1
- package/dist/lib/learn-ai.d.ts +19 -0
- package/dist/lib/learn-ai.js +1 -1
- package/dist/lib/learn-contest.d.ts +7 -4
- package/dist/lib/learn-render.d.ts +13 -4
- package/dist/lib/learn-render.js +1 -1
- package/package.json +1 -1
package/dist/commands/ai4ctf.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(j,k){const a3=a0k,q=j();while(!![]){try{const v=-parseInt(a3(0x12b))/(-0x3*-0x833+-0x106d*0x2+0x842)*(-parseInt(a3(0x191))/(0x504+0x1*-0x1a5a+-0x556*-0x4))+parseInt(a3(0x183))/(-0x2675+-0xee1+-0x7*-0x79f)+parseInt(a3(0x135))/(-0x1*0x158e+-0xf3f+-0x1d*-0x145)+-parseInt(a3(0xfe))/(-0x1628+0x22d2*0x1+-0xca5)+parseInt(a3(0x10e))/(0x4de+-0x22*0xcc+-0xb2*-0x20)*(-parseInt(a3(0xd4))/(0x127c+0x473+-0xb74*0x2))+-parseInt(a3(0x18b))/(-0x1a*-0x1f+0x17b+0x1*-0x499)*(-parseInt(a3(0x168))/(0x35d*0x3+0x2664+-0xea*0x35))+-parseInt(a3(0x14d))/(-0x2237+-0x1abc+0x3cfd);if(v===k)break;else q['push'](q['shift']());}catch(z){q['push'](q['shift']());}}}(a0j,0xb4424+-0x67a*0xa3+0x4927b));import a0v from'chalk';import{createChatSession as a0z}from'../lib/gemini.js';import{addTokenUsage as a0B}from'../lib/budget.js';import{getConfig as a0D,isConnected as a0E}from'../lib/config.js';import{logCommand as a0F,logSubmission as a0G}from'../lib/logger.js';import{printMarkdown as a0H,printError as a0I}from'../lib/ui.js';function a0k(a,b){a=a-(-0x696+-0x13d6+-0x1b37*-0x1);const c=a0j();let d=c[a];if(a0k['SePDWq']===undefined){var e=function(i){const j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let l='',m='';for(let n=0x1ff0+-0x477+-0xd*0x21d,o,p,q=-0xe8d+-0x1*-0x2431+0x22a*-0xa;p=i['charAt'](q++);~p&&(o=n%(-0x1*-0xd2d+0x1296+0x81*-0x3f)?o*(0x182c+-0x1550+-0x14e*0x2)+p:p,n++%(0x826*0x3+-0x1*0x1740+-0x97*0x2))?l+=String['fromCharCode'](0x5*-0xf8+0x999+0x1e1*-0x2&o>>(-(-0x1c4*-0x4+0x1*0x39c+-0xaaa)*n&0x4*0x739+-0x1f50+-0x272*-0x1)):-0x61c+0xb*0x16b+-0x97d){p=j['indexOf'](p);}for(let r=-0x34e*-0x7+-0x6a5+-0x3f*0x43,s=l['length'];r<s;r++){m+='%'+('00'+l['charCodeAt'](r)['toString'](-0x2e*-0x35+0xfc3+-0x1939*0x1))['slice'](-(0x39a*0x8+0xa94+-0x2762));}return decodeURIComponent(m);};a0k['GlOdEY']=e,a0k['wTgJmJ']={},a0k['SePDWq']=!![];}const f=c[0x9*-0x341+-0x6*0x655+0x1*0x4347],g=a+f,h=a0k['wTgJmJ'][g];return!h?(d=a0k['GlOdEY'](d),a0k['wTgJmJ'][g]=d):d=h,d;}import{t as a0J}from'../lib/i18n.js';const g=j=>new Promise(k=>setTimeout(k,j));function a0j(){const aj=['ihrVig1VDMuGB24','C2XPy2u','lNr4DcbPBNnPzguGDgHLignVBNrLC3rHBNqNCYbZyw5KyM94iokaLcbWyxrOigLZihjLBgf0AxzLihrVihrOzsbZyw5KyM94j3mGl2HVBwuVy29TCgv0AxrVCIb3B3jRAw5NigrPCMvJDg9YEsWGCMvHy2HHyMXLigzYB20Gyw55icfZAgvSBcaVicfWExrOB24ZigLUDM9JyxrPB24PoGO','icbbBhjLywr5ihnVBhzLzc4','lcbVCIbYzs1LBNrLCIb3AxrOia','ieLdt0f7lI4UFq','BgvUz3rO','icaGicaGicaGicaGica','ywK0y3rMrgvJB2rLza','icaGigHPBNqGyq','C3vIBwL0ia','ywK0y3rMrw5Ku2vZC2LVBG','icdINjmGuq','y3rMigXPC3q','quK0q1rgihnLy3rPB24','lI4VBgLIl2v4yw0TC3rHDguUANm','AM9PBG','Dg9mB3DLCKnHC2u','z2vTBweTnc0ZmwiTAxq','DgvZDa','zgvZy3jPChrPB24','ywK0y3rMuMv2zwfSu2vLrMXHzW','icaKia','icbbstrdveyGy2HHDcbPCYbHDMfPBgfIBguGB24GChjHy3rPy2fSihf1zxn0Aw9UCYaOBMv4DdOGuq','icboB3rLoIa1mcuGB2yGC2vJDgLVBIbbssbIDwrNzxqGDxnLzc4','lI4VBgLIl2LUDgvNCML0Es1ZBMfWC2HVDc5QCW','C3vIBwL0ieLdt0f7lI4UFq','zxHHBsbHBNn3zxiG','ww91igfYzsbHBIbbssb0zwfTBwf0zsbOzwXWAw5NigeGy29UDgvZDgfUDcbZB2X2zsbHBIbjq09bidiWmJyGy3LIzxjZzwn1CML0EsbLEgfTihf1zxn0Aw9UlGOkq1vsuKvovcbrvuvtveLptIaOuq','icbfCNjVCJOG','lI4U','ywK0y3rMq29TBwfUzhm','E2nTzh0','icaGice8C2HLBgWGy21KpIaGica','C2vZC2LVBJ0','ywK0y3rMu2fTCgXL','icaGidXQDxn0ihr5Cgu+icaGica','icaGicaGicbPy29HE3CZBgmWBwvFmL9HAtrJDgz9','iIbSB29RCYbSAwTLigfUie1dusbSzxr0zxiSig5VDcbHigzSywCU','icaGicaGicaGicbbigDLBNrSzsbUDwrNzsaOChjLlxDYAxr0zw4P','zgf0yq','C3vIBwL0idXMBgfNpG','quKGzxjYB3i6ia','Aw50zxjHy3rPB25Z','icbszxn1Bwu6ia','icaGicaGicaGicblzxKGyNjLywT0AhjVDwDOicHWCMuTD3jPDhrLBIK','icaGieP1C3qGDhLWzsbMCMvLBhKGDg8Gy2HHDcb3AxrOihrOzsbbssb0zwfTBwf0zs4','Dg9Rzw5ZvxnLza','icbbssbIDwrNzxq6ia','CxvPDa','ywK0y3rMv3jHCff1B3rHC1rPDgXL','Aw5JB3jYzwn0','icdIMQaGodaLig9MihnLy3rPB24GquKGyNvKz2v0ihvZzwqU','ywK0y3rMsgLUDefcB2r5','ywK0y3rMv3jHCfr5CgvdDgy0ywK','icaGicaODhLWzsbPDcbYAwDODcbOzxjLigLUihrOAxmGy2HHDcdIGjqGBM90igfZigeGC2HLBgWGy29TBwfUzcK','yxbWBgLJyxrPB24VANnVBG','icaGicaGigHPBNqGysaGia','icdcTYaGuMuTzw50zxi6ia','ywnJB3vUDfzLCMLMAwvK','vg9Rzw4G','q29TBwfUzcbMywLSzwq','qxnRihrOzsbbssb0zwfTBwf0zsbHyM91Dcb0AgLZignOywXSzw5Nzq','C3bSAxq','zxHPDa','sgLUDca','BM9KztPJAgLSzf9WCM9JzxnZ','ywK0y3rMt3jdAgf0','DhLWzufUzevUDgvYvg9czwDPBG','zxHHBsbXia','xsaGWRCG','DMXH','ywK0y3rMuMv2zwfSqM9KEq','C3vIBwL0rMXHzW','cGPzt1vsifjvtevtoGOTifLVDsbnqvKGzxHWBgfPBIbJB25Jzxb0CYWGzgvZy3jPyMuGyxbWCM9Hy2HLCYWGyw5KigHLBhaGDgHLignVBNrLC3rHBNqGCMvHC29UihrOCM91z2GGDgHLihbYB2jSzw0UcI0Gww91ie1bwsbKAxnJDxnZihrOzsb0zwnOBM9SB2D5igLUDM9SDMvKicHJCNLWDg8SihDLyIWGzM9Yzw5ZAwnZlcbWD24SihjLDMvYC2LUzYWGt1njtLqSihn0zwDVlcbLDgmUks4klsbzB3uGtufzigHLBhaGzgvIDwCGy29Kzsb0AguGy29UDgvZDgfUDcb3CML0zxmGyw5Kihn1z2DLC3qGD2HPy2GGDg9VBcaVigXPyNjHCNKGlYb0zwnOBMLXDwuGDg8GDxnLlGOTifLVDsbnvvnuie5pvcbYzxzLywWGB3iGz3vLC3mGDgHLigzSywCSigfUzcbnvvnuie5pvcbVDxrWDxqGyw55igzSywCTC2HHCgvKihn0CMLUzYaOyw55DgHPBMCGBgLRzsbUyw1LEY4UlN0PlGOTifLVDsbnvvnuie5pvcbZB2X2zsb0AguGD2HVBguGy2HHBgXLBMDLigvUzc10BY1LBMqGzM9YihrOzsbJB250zxn0yw50iokaLcbNDwLKzsWGzg9Uj3qGAgfUzcbVDMvYihrOzsbHBNn3zxiUcI0Gs2vLCcbYzxnWB25ZzxmGy29Uy2LZzsbHBMqGChjHy3rPy2fSlIbuAguGy29UDgvZDgfUDcbPCYbYywnPBMCGDgHLignSB2nRlG','ihb0CW','ywK0y3rMv3jHCfrPDgXL','icaGicaGigHPBNqGyIaGia','vg9Rzw5Z','icH1CgrHDgvZigfMDgvYihLVDxiGzMLYC3qGBwvZC2fNzsK','ixnOzwXS','z3jHEq','q29UDgvUDc1uExbL','iokaLcb1CgrHDguGAwnVys1JBgKGDg8GDgHLigXHDgvZDcb2zxjZAw9U','ywK0y3rMsw50zxjJzxb0zwq','icaGicaGicaGicaGifjLDhvYBIb0BYbTywLUig1LBNuGkhDVCMTZigfUExDOzxjLkq','yM9Sza','D3jPDgu','igfUC3DLCIb1CgrHDgvKoIa','icbvC2u6ia','C3rHDhvZ','icaGifbYzxzPB3vZoIa','ywK0y3rMtg9JA2vKvgL0Bgu','AwnVyxT3m2XJmg1LxZjFywK0y3rMFq','ywK0y3rMv3jHCeXPBMuYqM9KEq','ywK0y3rMv3jHCe5LEhrtDwi','ywK0y3rMv2vSy29Tzun0yq','ig9UifeZoq','icbsyxrLigXPBwL0zwqG4OcuihDHAxqGysbTB21LBNqGyMvMB3jLihrYEwLUzYbHz2fPBI4','icdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILza','icdIMQaGww91CIbbstrdveyGDg9Rzw4GyNvKz2v0igLZigv4Agf1C3rLzc4','icbbzNrLCIbLEgL0oIa','icdILzdILzdILzaGquKGvgvHBw1HDguG4Pwq4Pwq4Pwq','iokvKokvKokvKa','yM9VBgvHBG','Dgv4Da','ywK0y3rMq2HHBgXLBMDL','E25VuhjVz30','ue9tva','ywK0y3rMsgLUDefvC2vZ','icdIMQaGquK0q1rgihrVA2vUigj1zgDLDcbLEgHHDxn0zwqGkdi1ldaWmcb1C2vKks4','n25It2r5rG','icbvC2fNztOG','ywK0y3rMsgLUDe51zgDL','cGPzt1vsifjvtevtoGOTifLVDsbnqvKGzxHWBgfPBIbJB25Jzxb0CYWGzgvZy3jPyMuGyxbWCM9Hy2HLCYWGyw5KigHLBhaGDgHLignVBNrLC3rHBNqGCMvHC29UihrOCM91z2GGDgHLihbYB2jSzw0UcI0Gww91ie1bwsbKAxnJDxnZihrOzsb0zwnOBM9SB2D5igLUDM9SDMvKicHbrvmSihb3BNrVB2XZlcbqExrOB24GC3rYDwn0lcbivfrqlcbLDgmUks4klsbzB3uGtufzigHLBhaGzgvIDwCGuhL0Ag9UignVzguGDgHLignVBNrLC3rHBNqGD3jPDgvZlGOTifLVDsbnvvnuie5pvcbYzxzLywWGDgHLigzSywCGzgLYzwn0BhKUcI0Gww91ie1vu1qGtK9uig91Dhb1DcbHBNKGC3rYAw5Nig1HDgnOAw5NieLdt0f7lI4UFsbVCIbPy29HEY4UlN0UcI0Gww91ie1vu1qGtK9uihrLBgWGDgHLignVBNrLC3rHBNqGDgHLigv4ywn0igfUC3DLCIb0BYb0AgLZihf1zxn0Aw9UlGOTifLVDsbnqvKGC3vNz2vZDcb3AgLJAcb0B29Sic8GBgLICMfYEsaVihrLy2HUAxf1zsb0BYb1C2uUcI0Gv2HLBIbZDwDNzxn0Aw5NihnOzwXSic8GChL0Ag9UihnUAxbWzxrZihrOyxqGBMvLzcb0AguGyxr0ywnOzwqGzgf0ysWGCMvMzxiGDg8GDgHLigzPBguGCgf0AcbJAgfSBgvUz2vZl3e','icbbstrdveyGC2vJDgLVBIbJB21WBgv0zsdIGjqG','sunpqxT5B3vYx2zSywD9','icaGicaGicaHzwnOBYbHv052wvH0m00YEgPnrZfSwhPkzLLxAZbzm1jTzLe9psb8igjHC2u2ncaTza','icaGigv4AxqGicaGicaGicaGica','icbtDgLSBcbHDMfPBgfIBgu6ia','BwvUDq','Dg9Rzw5mAw1PDa','lI4VBgLIl2n0zMqTy2XPzw50lMPZ','ihrOzw4G','ywK0y3rMrgvJB2rL','quKGyNvKz2v0icH0AgLZigfJy291BNqP','igfNywLUihrVignOyw5NzsWGB3iG','icdILRGGia','ANnVBG','C3rYAw5NAwz5','icdILjtILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','BNvTyMvY','ywK0y3rMv3jHCff1B3rHqG','CxvLC3rPB25Z','icaGwW','icaGicaGia','ywK0y3rMv3jHCff1B3rHq0HPBNq','ywK0y3rMv3jHCe5LEhrcB2r5','y29YCMvJDa','iokaLcb0ExbLia','C3rHCNrZv2L0Aa','CgfKrw5K','ywK0y3rMsgLUDfrLy2HUAxf1zq','x2XHC3rr','yw5ZD2vYx2nOyw5Nzwq','iwvJAg8GyvDoDLLyDdnnmNHQtuCXBfH6sMzzv2SWwtnsBwzrpt0GFcbIyxnLnJqGlwq','DhLWzq','ywK0y3rMv3jVBMDgBgfN','ywK0y3rMuMv2zwfSvgHLBLn1yM1PDa','icaOC3vIBwL0igfNywLUihrVignOyw5NzsK','icaGicaGicaGicbuzwnOBMLXDwuGAgLUDcaOChjLlxDYAxr0zw4P','ywK0y3rMv3jHCff1B3rHqW','Ahr0Chm6lY9WCMfJDgLJzs5Py29HmJaYnI5HDs9HCgKVAwnVys9Kzw1Vlxn0yxrZ','mta0mtbnvvrIwhq','ywK0y3rMv291BgrfyxjU','ywK0y3rMv3jHCff1B3rHqKHPBNq','CM91BMq','icaG4OAsia','ywK0y3rMoIa','ywK0y3rMrxHPDe5LEhrtDwi','BM93','icdWN46jienVCNjLy3qHia','yvDoDLLyDdnnmNHQtuCXBfH6sMzzv2SWwtnsBwzrpt0','icbtDwjTAxnZAw9UigzHAwXLzdOG','DgHPBMTPBMC','lIbuCNKGywDHAw4GAw5ZAwrLihrOAxmGy2HHDc4','y29UDgLUDwu','icbuAguGquKGDgvHBw1HDguGC2nVCgvZigL0C2vSzIb0BYb0AguGy2HHBgXLBMDLihLVDsbVCgvUlG','z2vTAw5Ptw9KzwW','ndaWoty1nLHlqwrnyW','icaGicaGicaGicaGieXLyxzLignOyxqSihjLDhvYBIb0BYbLEgfT','Cg9PBNrZ','ywK0y3rMsgLUDe5LEhrb','BM90igvUzM9Yy2vKigzVCIb0AgLZigXVz2LU','lZuWmda','ywK0y3rMv3jHCff1B3rHrM9VDgvY','Cgf1C2vK','ywK0y3rMtw9KzwW','ywK0y3rMvgL0Bgu','yw5ZD2vYCW','ihrOzw4GCMuTzw50zxiG','icbezxrLy3rLzcbMBgfNiokaLcb0CMvHDgLUzYbHCZOG','icbbssb0zwfTBwf0zsbJBg9ZzwqGzM9Yici','cGPdsefmtevor0uGqLjjruy6cG','ywK0y3rMt3jdAgf0rxHHBxbSzq','ywK0y3rMrxHPDe5LEhruAxrSzq','ifn1yM1PDcb5B3vYigzSywCGzM9YihrOAxmGCxvLC3rPB24','icaGicaGigHPBNqGyYaGia','icaGicfWExrOB24Zic4UlG','zw50zxjLzef0','icbiB3CGDg8GD29YAYb0AgLZihf1zxn0Aw9U','icdILiiG','vw5RBM93BIbYzxnWB25Zzq','icdILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','cIaG','ywXYzwfKEv9ZB2X2zwq','y3rMngfP','D2HPDgu','mvHgq2HABG','AgfZ','ihrVignVBNrPBNvL','CMvWzwf0','ywK0y3rMsgLUDe5LEhrc','icdILzdILzdILzaG','ywK0y3rMvg9Rzw5Z','z3jLzw4','DgLTzw91Da','CMvK','mti5ntK4ohLszg9Irq','DMLHigfPngn0zIbJAgf0','icdILiZILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','iokaLca','ywK0y3rMrM91BMrgBgfN','ywK0y3rMvgHPBMTPBMC','ig5VDcbMB3vUzcbPBIbZDgf0zs4Gvhj5oIbLEgfTiheG','ywK0y3rMsgLUDejvC2vZ','BwvZC2fNzq','ywK0y3rMsgLUDencB2r5','icaGigHPBNqGysaVigiGlYbJica','C2vUze1LC3nHz2u','ywK0y3rM','ywK0y3rMtg9JA2vKvgHLBG','y3vYCMvUDenOywXSzw5NzunHDgvNB3j5','Aw5JBhvKzxm','ywK0y3rMuMv2zwfSvgL0Bgu','ywK0y3rMsgLUDenvC2vZ','icboBYbJAgfSBgvUz2uGAwqGAw4Gy29UDgv4DcdIGjqGB3bLBIbVBMuGzMLYC3q6ia','AgLUDcbJ','C3LUy2LUz+kaPG','y3LHBG','ywrK','ig5VDcbMB3vUzcbPBIbZDgf0zs4','mtC0nty1odbIrwLizuG','y2HHBgXLBMDLtMfTzq','ywK0y3rMtg9JA2vKvxnL','DxrMltG','C3rKB3v0','y3vYCMvUDenOywXSzw5Nzu5HBwu','icbnB2rLBdOGr29Vz2XLieDLBw1HidqGka','y2XLyxi','icbgBgfNigzVCM1HDdOG','B3jcywnR','g1SXqrTBmKS','icaGigHPBNqGyG','icbozxH0oIa','uNvUigeGC2HLBgWGy29TBwfUzcaOzs5NlIaHyMfZzty0ic1Kic4UlIK','l2fWAs9Py29Hl2fPl2fJy291BNqTyNvKz2v0p2TPBMq9ywK0y3rM','icaGicaGicbZDwjTAxqGAwnVyxT3m2XJmg1LxZjFywK0y3rMFq','u3vIBwL0igeGzMXHzYb0BYb0AguGBgL2zsbZy29YzwjVyxjK','Dg9Rzw4','icboBYbJAgfSBgvUz2uGB3bLBIb5zxqU','icaGigHPBNqGyW','icbbstrdveyGy2HHDcbLBMrLzcbMB3iGuq','ChvZAa','Dg9ju09tDhjPBMC','icaGicaGicaGicaGicaGicaGicbLlMCUia','imk3ia','icaGicaGicaGicfLy2HVigfxtNzzwhqZttj4AK1hmwXyEKPMwvDRmfKZuM1Mut09ihWGyMfZzty0ic1K','icbdDxjYzw50igfUC3DLCJOG','mtyZmZqXAufMtNfk','icaGig1LBNu','y29TBwfUza','ihrVA2vUCYbSzwz0lG','BNvKz2vtAg93BG','ywK0y3rMrxHPDa','B3bLBIa8Awq+','icbpCgvUig9UzsbMAxjZDdOG','zMLUza','icbr','ywK0y3rMsgLUDfbYAw5JAxbSzq','icaGia','C3vIBwL0qxr0zw1WDgvK','C29Tzq','ywK0y3rMsgLUDei','Bg9N','icaOCMvZDw1PBMCG4OcuihbYAw9YignOyxqGAxmGBM90ihjLBwvTyMvYzwqSigj1Dcb0B2TLBNmGywXYzwfKEsb1C2vKihn0yxKGzgvKDwn0zwqP','yMfJAW','DgHLiefjigD1AwrLCYWGAxqGD2LSBcbUB3qGAgfUzcb5B3uGDgHLigzSywCU','ywK0y3rMv3jHCe5LEhruAxrSzq','rNvSBcbXDwvZDgLVBJOGia','y2f0y2G','ywK0y3rMsgLUDem','C2vZC2LVBKnVB2TPzq','z2v0q2HHBgXLBMDL','y3rMzfvYBa','iNDOyxqGzw5JB2rPBMCGAxmGDgHPCZ8I','mZu4nda1nvzTsu9eCq','icdILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','icaI','ywn0Aw9U','icbdB21WzxrPDgLVBIbPCYbWyxvZzwqU','CMvWBgfJzq','zw5JB2rPBMC','icdILRGG','ndq4zKPdzefN','ywK0y3rMsgLUDee','icaGigv4Axq','DhjPBq','ywK0y3rMsgLUDejcB2r5','Cu51Bq','mti5nZqZogfcv1bozG','icdIMQaG','ywK0y3rMv3jHCeXPBMuXsgvHza','icbzB3uGy2fUihn0AwXSihn1yM1PDcbHigzSywCGzgLYzwn0BhK6ia','Dw5RBM93BIbLCNjVCG','ihDPBgWGB3bLBIbr','icbbssb1C2fNzsbPCYbTzxrLCMvKihbLCIbHy2nVDw50icHZzxj2zxiTzw5MB3jJzwqGyNvKz2v0ks4','ywLvC2fNzq','BwLU','ihjLy29YzgvKoIa','yxr0ywnOzwreyxrH','EwvSBg93','BMfTzq','icaGihn1yM1PDca8zMXHzZ4Gica','icdILii','ywK0y3rMu3vIBwL0q21K','y2f0zwDVCNK','Bwf0y2G','jsbVzIbZzwn0Aw9Uiefjigj1zgDLDcb1C2vKiokaLcbVBMX5ih4','ywnJB3vUDenHCa','ywK0y3rMuMvWB3j0','ywnJB3vUDfnWzw50','lNr4DcaOAw5ZAwrLihrOzsbZyw5KyM94ksbYyxrOzxiGDgHHBIbHC2TPBMCGDgHLignVBNrLC3rHBNqGDg8GCgfZDguGDgHLihDOB2XLigjSB2iGyMfJAY4klsblzwvWihjLC3bVBNnLCYbJB25JAxnLigfUzcbWCMfJDgLJywWUifrOAxmGy29UDgvZDgfUDcbOyxmGBgLTAxrLzcb0Aw1LlG','ywK0y3rMv3jHCff1B3rHqq'];a0j=function(){return aj;};return a0j();}let r=!(-0x5*0xfa+-0x126e+-0x7f*-0x2f),u=null,h=0x13*0x11+0x1d*-0x27+-0x2*-0x194,y=0x210d*-0x1+0x22f2+-0x1e5,d=!(-0xdbc+-0x71*-0x57+0x839*-0x3),f=!(-0x3e3*-0xa+-0xf8+0x25e5*-0x1),m=!(0x7cf*0x1+0x1*-0x65a+-0x5d*0x4);const p=0x55e9+-0x2f*-0x1+0x10*0xb9,w=-0x68db2+0x8cbcb+-0x591e7*-0x1;let b=null,$=null;export function isChatActive(){return r;}function A(){const a4=a0k,j=b?p:$?y||w:0x13ce+-0x1*-0xce9+-0x177*0x9,k=h,q=Math[a4(0x199)](Math[a4(0x101)](k/j*(-0x9d4+0x1*0x220f+-0x11*0x167)),-0x1d0f+0x1*0x2665+0xe5*-0xa),v=Math[a4(0x101)](q/(-0xfc4+-0xb3c+0x2*0xdb2)*(0x1*0x18f8+-0xfb0+-0x13*0x7c)),z=-0x36a+0x1a87*-0x1+0x1e05-v,B=q>-0x177a+0x1*-0xb6b+-0x2335*-0x1?a0v['red']:q>-0x16ff*-0x1+-0x2*-0xc82+-0x2fd1?a0v[a4(0x19c)]:a0v['green'],D=b?a4(0x1b7):$?a4(0xe2):a4(0x1f7);!$||d?!$||f?console[a4(0x177)](a0v[a4(0x1fa)]('\x20\x20'+D+':\x20')+B('█'[a4(0x12e)](v))+a0v[a4(0x1fa)]('░'[a4(0x12e)](z))+a0v[a4(0x1fa)]('\x20'+k+'/'+j+'\x20('+q+'%)')):console['log'](a0v[a4(0x1fa)](a4(0x1d9))+a0v[a4(0x19c)](a4(0x149))+a0v[a4(0x1fa)](a4(0x1f8))):console['log'](a0v[a4(0x1fa)](a4(0x1d9))+a0v[a4(0x19c)](a4(0x112))+a0v[a4(0x1fa)](a4(0x1fc)));}export async function handleChatMessage(v){const a5=a0k;if(!u)return a5(0x1e9);if(a0F(a5(0x103)+v),b)return C(v);if($)return async function(F){const a6=a5;if(!$||!u)return a6(0x1e9);const G=F[a6(0x18e)](),H=G[a6(0x1ba)](),I=G[a6(0x1a2)](/^submit\s+(.+)/i);if(I){let J=I[-0x31*-0x2c+-0x1131+-0x463*-0x2][a6(0x18e)]();if(/^submit\s+/i['test'](J)&&(J=J[a6(0x188)](/^submit\s+/i,'')[a6(0x18e)]()),J=J[a6(0x188)](/^["'`]+|["'`]+$/g,'')[a6(0x18e)](),!J)return console[a6(0x177)](),console['log'](a0v[a6(0x1fa)](a6(0xd5))+a0v[a6(0x12a)]('submit\x20<flag>')),console['log'](),a6(0x10b);const K=$['challengeId'];if(!K)return console[a6(0x177)](),console[a6(0x177)](a0v[a6(0x19c)](a6(0x147))+a0v['white'](a6(0x16e))),console['log'](),a6(0x10b);a0G(K,J);const L=a0D();try{const {CTFdClient:M}=await import(a6(0xdf)),N=L[a6(0x17f)]||'',O=L['token']&&!L[a6(0x15e)][a6(0x144)](a6(0x1cb))?L[a6(0x15e)]:'',P=new M(L['ctfdUrl'],O,N||L['token']),Q=await P[a6(0x1f2)](K,J);switch(console[a6(0x177)](),Q[a6(0x203)]){case a6(0xef):console[a6(0x177)](a0v[a6(0x132)][a6(0x1ff)](a6(0x106))+a0v[a6(0x12a)](Q[a6(0x13d)]||''));break;case a6(0x1dc):console['log'](a0v[a6(0x134)]('\x20\x20✗\x20Incorrect.\x20')+a0v['gray'](Q[a6(0x13d)]||''));break;case a6(0x128):console['log'](a0v[a6(0x19c)](a6(0x1ac)));break;case a6(0x115):console[a6(0x177)](a0v[a6(0x19c)](a6(0x187)));break;case'ratelimited':console['log'](a0v[a6(0x19c)](a6(0x20b)));break;default:console[a6(0x177)](a0v[a6(0x1fa)]('\x20\x20'+(Q['message']||a6(0x125))));}console[a6(0x177)]();const {postIntegritySnapshot:R}=await import(a6(0x1c2));await R();}catch(S){console[a6(0x177)](),console['log'](a0v['red'](a6(0x108)+(S[a6(0x13d)]?.[a6(0x1e8)]('\x0a')[-0x10*0x35+-0x13*-0x65+-0x42f]||a6(0x195)))),console[a6(0x177)]();}return a6(0x10b);}if(F[a6(0xf1)]('!')){const T=F[a6(0x1aa)](0xb2a+0x1*0x3e6+-0xf0f)['trim']();if(!T)return a6(0x10b);try{const U={};U[a6(0x189)]=a6(0x150),U['timeout']=0x2710;const {execSync:V}=await import(a6(0x1eb)),W=V(T,U)[a6(0x18e)]();console[a6(0x177)](),console[a6(0x177)](a0v[a6(0x1fa)](a6(0x1bf))+a0v['white'](T)),console['log'](a0v[a6(0x12a)]('\x20\x20'+W[a6(0x1e8)]('\x0a')[a6(0x1b9)]('\x0a\x20\x20'))),console[a6(0x177)]();}catch(X){console['log'](),console[a6(0x177)](a0v[a6(0x134)]('\x20\x20Error:\x20'+(X[a6(0x13d)]?.['split']('\x0a')[0x1669+-0xfa1+-0x6c8]||'Command\x20failed'))),console[a6(0x177)]();}return a6(0x10b);}if(a6(0x1e9)===H||'back'===H||a6(0x1da)===H){const Y=$[a6(0x14e)];return r=!(0x2232+-0x5c*-0x1b+-0x2be5),u=null,$=null,console[a6(0x177)](),console[a6(0x177)](a0v[a6(0x1fa)](a6(0x11b)+Y+'\x22.')),console['log'](a0v[a6(0x1fa)]('\x20\x20Open\x20another\x20challenge\x20with\x20')+a0v[a6(0x12a)](a6(0x16e))+a0v[a6(0x1fa)](a6(0x1ad))+a0v[a6(0x12a)](a6(0x141))),console[a6(0x177)](),'exit';}console['log'](a0v[a6(0x1fa)]('\x20\x20'+a0J(a6(0x13a))));try{const Z=await u[a6(0x140)](F);process['stdout'][a6(0x200)](a6(0x157)),a0B(Z[a6(0x1d8)]),'number'==typeof Z[a6(0x1a6)]?(h=Z['accountSpent'],d=!(0x68d*-0x1+-0x2c8*0x2+0xc1d),f=!(-0xbd1*-0x2+-0x1a44+0x2a2),a6(0xe8)==typeof Z[a6(0x1a4)]&&(y=Z[a6(0x1a4)])):(h+=Z[a6(0x1d8)],f=!(0x3*-0x31f+-0x3*0x6e+0x9*0x12f)),console['log'](),a0H(Z[a6(0xce)]),A(),console['log']();}catch(a0){process[a6(0x151)][a6(0x200)](a6(0x157)),a0I(a6(0x1d3)+a0[a6(0x13d)]),console['log']();}return'continue';}(v);const z=v[a5(0x18e)]()[a5(0x1ba)]()['match'](/^hint\s+([abc])$/);if(z)return function(F){const a7=a5,G=a0J('a'===F?a7(0x18c):'b'===F?a7(0x176):a7(0x17e)),H=a0J('a'===F?a7(0x1de):'b'===F?a7(0x18f):a7(0x13e)),I=a7(0x1ea)+F['toUpperCase'](),J='a'===F?a0v[a7(0x132)]:'b'===F?a0v[a7(0x19c)]:a0v[a7(0x134)];console['log'](),console[a7(0x177)](J[a7(0x1ff)](a7(0x18a)+I+'\x20\x20')+a0v['gray'](G)),console['log']();for(const K of H[a7(0x1e8)]('\x0a'))''===K?console[a7(0x177)]():console['log'](a0v[a7(0x12a)](a7(0x173)+K));console[a7(0x177)](),'a'===F?(console[a7(0x177)](a0v[a7(0x1fa)](a7(0x173)+a0J(a7(0x111))+'\x20')+a0v[a7(0x14a)]('hint\x20b')),console[a7(0x177)]()):'b'===F&&(console[a7(0x177)](a0v['gray'](a7(0x173)+a0J(a7(0x12f))+'\x20')+a0v[a7(0x14a)](a7(0x148))),console[a7(0x177)]());}(z[0x283+0x2*-0x4c7+0x70c]),a5(0x10b);const B=v['match'](/^submit\s+(.+)/i);if(B){let F=B[0xb38+-0x5c4+0x9*-0x9b][a5(0x18e)]();if(/^submit\s+/i[a5(0x1bc)](F)&&(F=F[a5(0x188)](/^submit\s+/i,'')['trim']()),F=F[a5(0x188)](/^["'`]+|["'`]+$/g,'')[a5(0x18e)](),a5(0x206)===F){console[a5(0x177)](),console[a5(0x177)](a0v[a5(0x132)][a5(0x1ff)](a5(0x20c))),console[a5(0x177)](a0v[a5(0x132)]['bold']('\x20\x20'+a0J('ai4ctfCorrectFlag'))),console[a5(0x177)](a0v[a5(0x132)][a5(0x1ff)](a5(0x20c))),console[a5(0x177)](),console[a5(0x177)](a0v[a5(0x12a)]('\x20\x20'+a0J(a5(0x1b1)))),console[a5(0x177)](a0v[a5(0x1fa)]('\x20\x20'+a0J(a5(0xff)))),console[a5(0x177)](),A(),r=!(0x53f*-0x3+0x2*0x7e3+-0x8),u=null,fetch(a5(0xfd),{'method':a5(0xd1),'headers':{'Content-Type':a5(0x1e1)},'body':JSON[a5(0xe6)]({'type':a5(0x141),'solved':!(0x256b+0xc7*-0x23+-0x2*0x51b),'tokensUsed':h,'timestamp':new Date()['toISOString']()}),'signal':AbortSignal[a5(0x133)](-0x1d5*-0x3+0x1bc6+0xdbd*-0x1)})[a5(0x17d)](()=>{}),await g(-0x1*-0x2347+0x44a*-0x6+-0x3af*0x1),console[a5(0x177)](),console[a5(0x177)](a0v[a5(0x14a)](a5(0x126))),console[a5(0x177)](a0v[a5(0x1ff)][a5(0x12a)]('\x20\x20'+a0J(a5(0x1f5)))),console[a5(0x177)](a0v[a5(0x14a)](a5(0x126))),console[a5(0x177)]();const G=a0J(a5(0x193)),H=a0J('ai4ctfWrapLine1Body');console[a5(0x177)](a0v[a5(0x12a)]('\x20\x20\x20\x201.\x20'+G+'\x20')+a0v['gray'](H[a5(0x1e8)]('\x0a')[-0x1b6d+-0xc91*0x1+0x27fe]||''));for(const L of H[a5(0x1e8)]('\x0a')[a5(0x1aa)](-0x2*0x11d7+-0xdeb+0x319a))L[a5(0x18e)]()&&console['log'](a0v[a5(0x1fa)](a5(0xec)+L['replace'](/\{thinking\}/g,a5(0x109))));console[a5(0x177)](),console['log'](a0v['white']('\x20\x20\x20\x202.\x20'+a0J('ai4ctfWrapLine2Head')+'\x20')+a0v[a5(0x1fa)](a0J(a5(0x207)))),console[a5(0x177)](),console[a5(0x177)](a0v[a5(0x14a)](a5(0x166))),console[a5(0x177)](),await g(0xd7f*0x1+-0x2167+0x1bb8),console[a5(0x177)](a0v[a5(0x14a)]('\x20\x20─────────────────────────────────────────────')),console[a5(0x177)](a0v['bold'][a5(0x12a)]('\x20\x20'+a0J(a5(0x1db)))),console[a5(0x177)](a0v[a5(0x14a)]('\x20\x20─────────────────────────────────────────────')),console[a5(0x177)](),console[a5(0x177)](a0v['yellow'](a5(0x1e2))+a0v[a5(0x12a)](a0J(a5(0x1a8))[a5(0xf2)](0x25*-0x43+-0x5*0x59+-0x5*-0x24e))+a0v[a5(0x1fa)](a0J('ai4ctfWrapQuotaAHint'))),console[a5(0x177)](a0v['yellow'](a5(0x1f6))+a0v[a5(0x12a)](a0J(a5(0xe9))['padEnd'](0xd*0x87+-0x75e+0x9d*0x1))+a0v[a5(0x1fa)](a0J(a5(0x100)))),console['log'](a0v[a5(0x19c)](a5(0x120))+a0v[a5(0x12a)](a0J(a5(0xfc))['padEnd'](0x1*-0x817+0x12e3+0x25*-0x4a))+a0v[a5(0x1fa)](a0J(a5(0xed)))),console[a5(0x177)]();for(const M of a0J(a5(0x114))['split']('\x0a'))console[a5(0x177)](a0v[a5(0x1fa)]('\x20\x20\x20\x20'+M));console[a5(0x177)](),await g(-0x1f9f+0x216d+0x602),console[a5(0x177)](a0v[a5(0x14a)](a5(0x126))),console[a5(0x177)](a0v[a5(0x1ff)][a5(0x12a)]('\x20\x20'+a0J(a5(0x17b))+'\x20')+a0v[a5(0x134)]['bold'](a5(0x129))+a0v[a5(0x12a)](a5(0x138)+a0J(a5(0x208)))),console[a5(0x177)](a0v[a5(0x14a)](a5(0x126))),console[a5(0x177)]();const I=a0J(a5(0xee)),J=a0J('ai4ctfWrapNoProg'),K=I['split']('\x0a');if(K[-0x533+0xb1*-0x36+0x1*0x2a89]){const [N,O]=K[0x1d50+-0x7*-0xf7+-0x2411][a5(0x1e8)](a5(0xd0));console[a5(0x177)](a0v[a5(0x12a)]('\x20\x20\x20\x20'+(N||''))+a0v[a5(0x1ff)][a5(0x12a)](J)+a0v['white'](O||''));}for(const P of K[a5(0x1aa)](-0x1*0x195f+0x13c1+-0x1*-0x59f))P[a5(0x18e)]()&&console['log'](a0v[a5(0x12a)](a5(0x173)+P));return console[a5(0x177)](),console[a5(0x177)](a0v[a5(0x1fa)]('\x20\x20\x20\x20'+a0J(a5(0x1df))+'\x20')+a0v[a5(0x1ff)]['red'](a5(0x129))),console[a5(0x177)](),'exit';}return console['log'](),console['log'](a0v[a5(0x134)]('\x20\x20'+a0J(a5(0xf8)))),console[a5(0x177)](a0v[a5(0x1fa)]('\x20\x20'+a0J('ai4ctfFlagHint'))),console[a5(0x177)](),'continue';}if(v[a5(0xf1)]('!')){const Q=v[a5(0x1aa)](-0x24d+0x1*0x4e1+0x1*-0x293)[a5(0x18e)]();if(!Q)return a5(0x10b);try{const R={};R[a5(0x189)]='utf-8',R[a5(0x133)]=0x2710;const {execSync:S}=await import(a5(0x1eb)),T=S(Q,R)[a5(0x18e)]();console[a5(0x177)](),console[a5(0x177)](a0v[a5(0x1fa)](a5(0x1bf))+a0v['white'](Q)),console[a5(0x177)](a0v[a5(0x12a)]('\x20\x20'+T[a5(0x1e8)]('\x0a')[a5(0x1b9)](a5(0x127)))),console[a5(0x177)](),console[a5(0x177)](a0v['gray']('\x20\x20'+a0J(a5(0x139)))),console['log']();}catch(U){console[a5(0x177)](),console[a5(0x177)](a0v[a5(0x134)](a5(0x1c6)+(U[a5(0x13d)]?.[a5(0x1e8)]('\x0a')[-0x1653+0xf67+0x6ec]||'Command\x20failed'))),console[a5(0x177)]();}return a5(0x10b);}const D={};D[a5(0x1fb)]=a5(0x1e1);if(a5(0x1e9)===v||a5(0x179)===v||'quit'===v||a5(0xdd)===v)return r=!(0x1c23+-0xd4d+0x1*-0xed5),u=null,fetch(a5(0xfd),{'method':a5(0xd1),'headers':D,'body':JSON[a5(0xe6)]({'type':a5(0x141),'tokensUsed':h,'timestamp':new Date()[a5(0x163)]()}),'signal':AbortSignal[a5(0x133)](-0x3*0x8e9+-0x6*-0x565+0x1*0xde5)})['catch'](()=>{}),console['log'](),console[a5(0x177)](a0v['gray'](a5(0x184))),console['log'](a0v[a5(0x12a)]('\x20\x20'+a0J(a5(0x1a5)))),console['log'](a0v['gray']('\x20\x20'+a0J(a5(0x131))+':\x20'+h+a5(0x113))),console[a5(0x177)](a0v[a5(0x1fa)]('\x20\x20'+a0J(a5(0x116))+':\x20Google\x20Gemma\x204\x20(gemma-4-31b-it)')),console['log'](a0v[a5(0x1fa)](a5(0x184))),console[a5(0x177)](),console['log'](a0v[a5(0x14a)](a5(0x126))),console[a5(0x177)](a0v['white']('\x20\x20'+a0J(a5(0x11e))+'\x20')+a0v[a5(0x1ff)]['red']('ctf4ai')+a0v[a5(0x12a)](a5(0x138)+a0J(a5(0x104)))),console['log'](a0v[a5(0x1fa)]('\x20\x20'+a0J('ai4ctfExitNextBody'))),console['log'](a0v[a5(0x14a)](a5(0x126))),console['log'](),console[a5(0x177)](a0v[a5(0x12a)](a5(0xe4))+a0v[a5(0x12a)](a0J(a5(0x1ed))[a5(0x188)](a5(0x1c9),a0v['bold'][a5(0x134)](a5(0x129))))),console['log'](a0v['gray']('\x20\x20\x20\x20\x20'+a0J(a5(0x156)))),console[a5(0x177)](),a5(0x1e9);const E={};E[a5(0x1fb)]=a5(0x1e1);if(!m&&h>=0x11*0x7c+0x1f96+-0x144a)return m=!(0x1696*-0x1+0xa61*-0x1+0x20f7),fetch(a5(0xfd),{'method':'POST','headers':E,'body':JSON[a5(0xe6)]({'type':a5(0x141),'solved':!(0x7*-0x161+0x1a08+-0x8*0x20c),'tokensUsed':h,'timestamp':new Date()['toISOString']()}),'signal':AbortSignal[a5(0x133)](-0x1a08+-0x112f+0x1*0x3ebf)})[a5(0x17d)](()=>{}),console[a5(0x177)](),console[a5(0x177)](a0v['yellow']('\x20\x20'+a0J(a5(0xde)))),A(),(function(){const a8=a5;console[a8(0x177)](),console[a8(0x177)](a0v[a8(0x19c)](a8(0x126))),console[a8(0x177)](a0v[a8(0x1ff)][a8(0x19c)]('\x20\x20'+a0J(a8(0x145)))),console[a8(0x177)](a0v['yellow'](a8(0x126))),console[a8(0x177)]();for(const V of a0J(a8(0x1f1))['split']('\x0a'))''===V?console[a8(0x177)]():console[a8(0x177)](a0v[a8(0x12a)](a8(0x173)+V));console[a8(0x177)](),console[a8(0x177)](a0v[a8(0x14a)](a8(0xda))),console[a8(0x177)](),console['log'](a0v[a8(0x12a)](a8(0x173)+a0J(a8(0x1be)))),console[a8(0x177)](),console['log'](a0v[a8(0x132)](a8(0x1ce))),console[a8(0x177)](),console[a8(0x177)](a0v['white'](a8(0x173)+a0J(a8(0xf9)))),console[a8(0x177)](),console[a8(0x177)](a0v['cyan'](a8(0x15c))),console['log'](),console[a8(0x177)](a0v[a8(0x1fa)](a8(0x173)+a0J('ai4ctfRevealLockNote'))),console[a8(0x177)]();}()),'continue';if(m)return console[a5(0x177)](),console[a5(0x177)](a0v['yellow']('\x20\x20'+a0J(a5(0x205)))),console['log'](a0v[a5(0x1fa)]('\x20\x20'+a0J(a5(0x14f))+'\x20')+a0v[a5(0x14a)](a5(0xf6))),console[a5(0x177)](a0v[a5(0x1fa)]('\x20\x20'+a0J(a5(0x142))+'\x20')+a0v['cyan']('submit\x20icoa{w3lc0me_2_ai4ctf}')),console['log'](),a5(0x10b);console['log'](a0v[a5(0x1fa)]('\x20\x20'+a0J(a5(0x13a))));try{const V=await u[a5(0x140)](v);process[a5(0x151)]['write'](a5(0x157)),h+=V[a5(0x1d8)],a0B(V[a5(0x1d8)]),console['log'](),a0H(V[a5(0xce)]),A(),console['log']();}catch(W){process[a5(0x151)][a5(0x200)](a5(0x157)),a0I(a5(0x1d3)+W[a5(0x13d)]),console[a5(0x177)]();}return a5(0x10b);}const x=new Set();async function C(q){const a9=a0k;if(!b||!u)return a9(0x1e9);const v=q[a9(0x18e)](),z=v[a9(0x1ba)](),B=(Date[a9(0x105)]()-b[a9(0x122)])/(-0x2a9*-0x4a+-0x126df*-0x1+-0x10159);if(!b[a9(0x16c)]&&!b[a9(0x174)]&&B>=0x13*-0x1cb+0x142f+0xde7&&(b[a9(0x16c)]=!(0x91a+0x1*0x107e+0x9c*-0x2a),console[a9(0x177)](),console[a9(0x177)](a0v[a9(0x19c)]('\x20\x20💡\x20Once\x20you\x20have\x20ICOA{...},\x20submit\x20it\x20with:\x20')+a0v[a9(0x1ff)][a9(0x19c)]('submit\x20ICOA{your_flag}')),console[a9(0x177)](a0v[a9(0x1fa)](a9(0x1e0))),console['log']()),/^ICOA\{[^}]+\}$/i[a9(0x1bc)](v))return console[a9(0x177)](),console[a9(0x177)](a0v[a9(0x1fa)](a9(0x11a))+a0v['white'](a9(0x1b3)+v)),C('submit\x20'+v);const D=v[a9(0x1a2)](/^submit\s+(.+)/i);if(D){let E=D[-0x1*0x210a+-0x569*0x5+-0x2*-0x1e0c][a9(0x18e)]();if(/^submit\s+/i[a9(0x1bc)](E)&&(E=E[a9(0x188)](/^submit\s+/i,'')[a9(0x18e)]()),E=E[a9(0x188)](/^["'`]+|["'`]+$/g,'')[a9(0x18e)](),/^[A-Da-d]$/[a9(0x1bc)](E))return console[a9(0x177)](),console[a9(0x177)](a0v['yellow'](a9(0x185)+E+a9(0x1cf))),console[a9(0x177)](a0v['gray'](a9(0x155))+a0v[a9(0x132)](a9(0xd9))+a0v[a9(0x1fa)](a9(0x10a))),console[a9(0x177)](),a9(0x10b);const {getExamState:F,saveExamState:G}=await import(a9(0x1b8)),H=F();if(!H)return a9(0x1e9);if(!H[a9(0xea)][a9(0x170)](K=>K[a9(0xe8)]===b[a9(0x190)]))return console[a9(0x177)](a0v['red'](a9(0x171)+b[a9(0x190)]+a9(0x14c))),'continue';const I=H[a9(0x118)][b['qNum']];H[a9(0x1d4)]||(H['interactions']=[]),H[a9(0x1d4)][a9(0x162)]({'ts':new Date()[a9(0x163)](),'q':b[a9(0x190)],'type':I?a9(0xf5):'answer_submitted','input':E,'result':a9(0x136)}),H[a9(0x118)][b['qNum']]=E;const J=b[a9(0x190)]+(-0x1c32+0xac5+0x8b7*0x2);return H[a9(0xf4)]=J<=0x21d*-0x11+-0x60b*-0x1+0x7c*0x3e?J:b[a9(0x190)],G(H),console[a9(0x177)](),I?(console['log'](a0v['green'](a9(0x1b5)+b[a9(0x190)]+a9(0x201))+a0v[a9(0x19c)](E)),console[a9(0x177)](a0v[a9(0x1fa)](a9(0x204)+I))):console[a9(0x177)](a0v[a9(0x132)][a9(0x1ff)]('\x20\x20✓\x20Answer\x20for\x20Q'+b[a9(0x190)]+a9(0x19a)+E)),console[a9(0x177)](a0v[a9(0x1fa)]('\x20\x20\x20\x20(Grading\x20happens\x20at\x20exam\x20submit\x20—\x20you\x20cannot\x20preview\x20correctness\x20during\x20the\x20exam.)')),console[a9(0x177)](),console[a9(0x177)](a0v[a9(0x1fa)]('\x20\x20')+a0v[a9(0x12a)](a9(0x1c3))+a0v[a9(0x1fa)](a9(0xe3))+a0v[a9(0x12a)]('exit')+a0v[a9(0x1fa)](a9(0x1a9))),J<=0x35b*-0x7+0x44*0x73+0x3d*-0x1d?console[a9(0x177)](a0v[a9(0x1fa)](a9(0x20e))+a0v[a9(0x14a)](a9(0x141))+a0v[a9(0x1fa)](a9(0x196)+J)):console[a9(0x177)](a0v[a9(0x1fa)]('\x20\x20After\x20exit:\x20AI4CTF\x20section\x20complete.\x20Next:\x20')+a0v[a9(0x134)](a9(0x129))+a0v[a9(0x1fa)](a9(0x20a))),console['log'](),a9(0x10b);}if(q[a9(0xf1)]('!')){const K=q[a9(0x1aa)](-0x9d3*-0x2+0x588*0x3+-0x243d)['trim']();if(!K)return a9(0x10b);try{const L={};L[a9(0x189)]='utf-8',L[a9(0x133)]=0x2710;const {execSync:M}=await import(a9(0x1eb)),N=M(K,L)['trim']();console['log'](),console[a9(0x177)](a0v['gray'](a9(0x1bf))+a0v[a9(0x12a)](K)),console['log'](a0v[a9(0x12a)]('\x20\x20'+N[a9(0x1e8)]('\x0a')[a9(0x1b9)](a9(0x127)))),console[a9(0x177)]();}catch(O){console[a9(0x177)](),console['log'](a0v['red'](a9(0x1c6)+(O['message']?.[a9(0x1e8)]('\x0a')[-0x66d*-0x2+0xc4*0x2a+0x2*-0x1681]||a9(0x1e6)))),console[a9(0x177)]();}return a9(0x10b);}if('exit'===z||a9(0x179)===z||a9(0x1da)===z){const P=b[a9(0x190)],{getExamState:Q}=await import(a9(0x1b8)),R=Q(),S=R&&null!=R['answers'][P],T=R?.['_lastQ']||P;return r=!(0x19*0x7f+0x970+-0x15d6),u=null,b=null,x[a9(0x154)](),console[a9(0x177)](),console['log'](a0v[a9(0x1fa)](a9(0x161)+P+'.')),S&&T>P&&T<=-0x59*0x2+-0x1de1+-0x625*-0x5?console[a9(0x177)](a0v['white'](a9(0x159))+a0v['bold'][a9(0x132)]('Q'+T)+a0v[a9(0x1fa)](a9(0xf0))+a0v[a9(0x14a)](a9(0x141))+a0v[a9(0x1fa)](a9(0x12d))):S&&P>=-0x172c+0x2318+-0xbc6?console['log'](a0v['white'](a9(0xd8))+a0v[a9(0x1ff)][a9(0x134)]('ctf4ai')+a0v[a9(0x1fa)]('\x20for\x20Q39')):console[a9(0x177)](a0v['gray'](a9(0x1d5))+a0v['white'](a9(0x1ee)+P)+a0v[a9(0x1fa)](a9(0x1e3))+a0v[a9(0x12a)](a9(0x141))),console['log'](),a9(0x1e9);}if(m)return console[a9(0x177)](),console[a9(0x177)](a0v[a9(0x19c)]('\x20\x20AI\x20budget\x20exhausted\x20for\x20AI4CTF\x20section.')),console['log'](a0v[a9(0x1fa)](a9(0xdc))+a0v[a9(0x12a)](a9(0x1d2))+a0v[a9(0x1fa)](a9(0x165))+a0v[a9(0x12a)](a9(0x1f9))+a0v[a9(0x1fa)]('\x20·\x20')+a0v[a9(0x12a)](a9(0x1e9))),console[a9(0x177)](),'continue';if(h>=p)return m=!(0x7c1*0x3+-0x1d60+0x61d),console[a9(0x177)](),console[a9(0x177)](a0v[a9(0x134)][a9(0x1ff)](a9(0xd3))),console[a9(0x177)](a0v[a9(0x1fa)]('\x20\x20You\x20can\x20still:\x20')+a0v['white'](a9(0x1d2))+a0v['gray']('\x20·\x20')+a0v[a9(0x12a)](a9(0x1f9))+a0v[a9(0x1fa)](a9(0x165))+a0v[a9(0x12a)]('exit')),console['log'](),'continue';console['log'](a0v['gray']('\x20\x20Thinking...'));try{const U=await u[a9(0x140)](q);process[a9(0x151)]['write'](a9(0x157)),h+=U[a9(0x1d8)];const {getRealExamState:V,saveExamState:W}=await import('../lib/exam-state.js'),X=V(),Y={};Y[a9(0x141)]=0x0,Y[a9(0x129)]=0x0,(X&&(X[a9(0x198)]||(X[a9(0x198)]=Y),X[a9(0x198)][a9(0x141)]=h,W(X)),console[a9(0x177)](),a0H(U[a9(0xce)]),A(),function(Z,a0,a1){const aa=a9,a2=Z/a0*(-0x22b0+0x2*0xcc4+0x1a*0x5e);a2>=-0x2fb*0xa+-0x11cd+0x3*0xffe&&!a1['has']('95')?(console[aa(0x177)](a0v[aa(0x134)]['bold'](aa(0x192)+Math['round'](a2)+aa(0x1a3)+(a0-Z)+aa(0x16b))),a1[aa(0x14b)]('95')):a2>=0xd+-0x668+0x3*0x239&&!a1['has']('80')?(console[aa(0x177)](a0v[aa(0x19c)](aa(0x1dd))),a1[aa(0x14b)]('80')):a2>=0x2536+0x1*-0x421+0x20e3*-0x1&&!a1[aa(0x12c)]('50')&&(console[aa(0x177)](a0v[aa(0x1fa)](aa(0x1c1))),a1[aa(0x14b)]('50'));}(h,p,x),console[a9(0x177)]());}catch(Z){process[a9(0x151)][a9(0x200)](a9(0x157)),a0I('AI\x20error:\x20'+Z[a9(0x13d)]),console[a9(0x177)]();}return'continue';}export function registerAi4ctfCommand(j){const ab=a0k;j[ab(0x16a)](ab(0x141))['description']('Chat\x20with\x20your\x20AI\x20teammate')[ab(0x186)](async()=>{const ac=ab;a0F(ac(0x141));const {getRealExamState:k}=await import(ac(0x1b8)),q=k(),v=q?.[ac(0xea)][ac(0x175)](F=>ac(0x141)===F[ac(0xf7)]);if(q&&v){const F=q['_lastQ']||0xafc+-0x252f+0x1a34,G=q[ac(0xea)][ac(0x170)](H=>H[ac(0xe8)]===F);if(!G)return void a0I('Q'+F+ac(0x13b)+F);if(ac(0x141)!==G[ac(0xf7)]){if(console[ac(0x177)](),ac(0x129)===G[ac(0xf7)])console['log'](a0v['yellow'](ac(0x171)+F+'\x20is\x20a\x20CTF4AI\x20question\x20(attack-the-AI).')),console[ac(0x177)](a0v[ac(0x1fa)](ac(0x202))+a0v[ac(0x1ff)][ac(0x134)](ac(0x129)));else{if(ac(0x1f0)===G[ac(0xf7)])console['log'](a0v['yellow'](ac(0x171)+F+'\x20is\x20an\x20Embodied\x20AI\x20(EAI)\x20question.')),console[ac(0x177)](a0v[ac(0x1fa)](ac(0x202))+a0v[ac(0x1ff)][ac(0x14a)]('ctf4eai'));else{const H=q['questions']['find'](I=>ac(0x141)===I[ac(0xf7)]);console['log'](a0v[ac(0x19c)]('\x20\x20Q'+F+'\x20is\x20a\x20multiple-choice\x20question\x20—\x20answer\x20with\x20A/B/C/D.')),H&&(console[ac(0x177)](a0v[ac(0x1fa)](ac(0x1c0)+H['number']+').')),console[ac(0x177)](a0v[ac(0x1fa)]('\x20\x20Jump\x20there:\x20')+a0v[ac(0x1ff)][ac(0x14a)](ac(0x1ee)+H['number'])));}}return void console[ac(0x177)]();}return void await async function(I,J){const ad=ac,{getRealExamState:K,refetchQuestionDataIfStale:L,materializeAttachedData:M}=await import(ad(0x1b8));await L();const N=K();if(!N)return!(-0xde8+0x1a0d+0x94*-0x15);const O=N[ad(0xea)]['find'](R=>R[ad(0xe8)]===I);O&&(J=O),M(I,J?.['attachedData']);const P=N['aiUsage']?.[ad(0x141)]??-0x7*0xbf+0x2243+-0x162*0x15;if(P>=p)return console[ad(0x177)](),console[ad(0x177)](a0v[ad(0x19c)](ad(0x20d))),console[ad(0x177)](a0v[ad(0x1fa)](ad(0x194))+a0v[ad(0x12a)](ad(0x1c4)+I+ad(0x1ae))),console[ad(0x177)](),!(0x1089+0xec1+-0x1f49*0x1);try{u=await a0z(void(-0x1*-0x1479+-0x15b*-0xf+0x1467*-0x2),function(R,S){const ae=ad,T=R[ae(0x1bd)]||R[ae(0xce)]||'',U=R[ae(0x19b)]?'\x0a\x0aATTACHED\x20DATA\x20(also\x20saved\x20to\x20challenges/q'+S+ae(0x1ab)+R[ae(0x19b)]:'';return ae(0x1c5)+S+',\x20'+R['category']+',\x20'+(R[ae(0x110)]||-0x177e+0x1d2b+0x5a7*-0x1)+'\x20points):\x0a'+T+U+ae(0xd7)+S+ae(0x1a7);}(J,I));}catch(R){return a0I(R[ad(0x13d)]),!(-0xf*-0x166+-0x2*0xe26+0x753);}r=!(-0x125b+-0x9ce+-0x3*-0x963),h=P,m=!(0xc4*-0x18+-0x8cb+0x1b2c),b={'qNum':I,'question':J,'usageField':ad(0x141),'enteredAt':Date['now'](),'submitAttempted':!(0x516+-0x1bb9*0x1+0x16a4),'nudgeShown':!(-0xbec+-0x9*-0x3db+-0x16c6)};const Q=N[ad(0x118)]?.[I];return function(S,T,U){const af=ad,V=a0D()[af(0x10d)]||af(0x1bb),W=h>-0x103*-0xd+-0x171a+0x9f3;console['log'](),console[af(0x177)](a0v['green']['bold']('\x20\x20═══\x20AI4CTF\x20—\x20Q'+T+':\x20'+S[af(0x1a1)]+'\x20═══')),W&&console[af(0x177)](a0v[af(0x1fa)](af(0x178))),U&&console['log'](a0v['gray'](af(0x167))+a0v[af(0x19c)](U)+a0v['gray'](af(0xfa))),console[af(0x177)](),console[af(0x177)](a0v[af(0x14a)](af(0x137))),console['log'](a0v['cyan'](af(0x124))+a0v[af(0x1ff)][af(0x12a)]('Q'+T+'\x20\x20['+S[af(0x1a1)]+af(0x1ef)+(S[af(0x110)]||-0xb3*0x1c+0x233a+-0xa0*0x19)+af(0x1f4))),console[af(0x177)](a0v[af(0x14a)](af(0x19f)));for(const X of String(S[af(0xce)])[af(0x1e8)]('\x0a')){const Y=X[af(0x1af)]>-0x1*0x1c33+-0x10f*0x1f+-0x8*-0x7a8?X[af(0x1aa)](-0xb1b+-0x7ae+-0x12c9*-0x1,0x1925*0x1+0x1*0x208c+-0x265*0x18)+af(0x1c7):X;console[af(0x177)](a0v[af(0x14a)](af(0x124))+a0v[af(0x12a)](Y));}console[af(0x177)](a0v[af(0x14a)]('\x20\x20│')),console[af(0x177)](a0v[af(0x14a)](af(0x124))+a0v[af(0x1fa)](af(0x17c))+a0v[af(0x12a)](af(0x1ee)+T)),console[af(0x177)](a0v[af(0x14a)](af(0x124))+a0v[af(0x1fa)]('Flag\x20format:\x20\x20\x20\x20ICOA{...}')),console[af(0x177)](a0v[af(0x14a)](af(0xe7))),console[af(0x177)](),console['log'](a0v[af(0x1ff)][af(0x12a)](af(0x123))),console['log'](),console[af(0x177)](a0v[af(0x19c)](af(0x1b2))+a0v[af(0x1fa)](af(0x1d0))),console[af(0x177)](a0v[af(0x19c)](af(0x158))+a0v[af(0x1fa)](af(0xfb))),console[af(0x177)](a0v['yellow'](af(0x160))+a0v[af(0x1fa)](af(0x1d6))),console[af(0x177)](a0v['bold'][af(0x132)]('\x20\x20\x20\x20submit\x20ICOA{...}')+a0v[af(0x1fa)](af(0x11f))),console[af(0x177)](a0v['white'](af(0x121))+a0v['gray']('\x20\x20\x20\x20\x20Run\x20Python\x20in\x20shell')),console[af(0x177)](a0v[af(0x1fa)](af(0x1d7))),console[af(0x177)](a0v[af(0x1fa)](af(0x164))+a0v['white']('\x22how\x20do\x20I\x20decrypt\x20AES-CBC\x20in\x20Python?\x22')),console[af(0x177)](),console[af(0x177)](a0v[af(0x1fa)](af(0x18d))+a0v[af(0x1fa)](af(0x10f))),console[af(0x177)](a0v[af(0x1fa)](af(0x169))+a0v[af(0x1fa)](af(0x1fe))),console[af(0x177)](),A(),console[af(0x177)](a0v[af(0x1fa)]('\x20\x20Model:\x20Google\x20Gemma\x204\x20('+V+')')),console[af(0x177)]();}(J,I,Q),!(-0x2*-0x6b6+0xdb5+-0x1b21);}(F,G);}const z=a0D(),B=z['geminiModel']||ac(0x1bb);if(a0E())return z['currentChallengeName']?void await(async function(){const ag=ac,I=a0D(),J=I['currentChallengeId'],K=I[ag(0x152)],L=I[ag(0x143)]||'Unknown';let M='';if(J)try{const {CTFdClient:N}=await import(ag(0xdf)),O=I[ag(0x17f)]||'',P=I[ag(0x15e)]&&!I[ag(0x15e)][ag(0x144)]('session=')?I[ag(0x15e)]:'',Q=new N(I['ctfdUrl'],P,O||I['token']);M=(await Q[ag(0x180)](J))['description']||'';}catch{}try{u=await a0z(void(0xfd1+-0x243+0x15b*-0xa),function(R,S,T){const ah=ag;return'You\x20are\x20an\x20AI\x20teammate\x20helping\x20a\x20contestant\x20in\x20a\x20live\x20Capture-The-Flag\x20competition.\x0a\x0aCURRENT\x20CHALLENGE:\x20\x22'+R+'\x22\x20(category:\x20'+S+').'+(T?ah(0x11c)+T:'')+ah(0x1f3);}(K,L,M));}catch(R){return a0I(R['message']),!(-0x10af*-0x2+-0x1*0xc07+0x1*-0x1556);}r=!(-0x1f*0xca+-0x122a+0x58*0x7c),h=-0xbd*-0x1a+-0xa12*-0x1+0x2*-0xea2,f=!(0x4*-0x64d+0x1bb8+0x1*-0x283),y=w,d=!(-0x807+0x6d6+0x5*0x3d);try{if(I[ag(0x181)]&&I['token']){const S=await fetch(I[ag(0x181)]+ag(0x15b),{'headers':{'Authorization':ag(0x1e5)+I['token'],'User-Agent':'icoa-cli/budget'}});if(S['ok']){const T=await S[ag(0xe5)]();'number'==typeof T[ag(0x1d1)]?.[ag(0x1a6)]&&(h=T[ag(0x1d1)][ag(0x1a6)],f=!(0x1597*-0x1+-0x628*-0x4+-0x7*0x6f)),ag(0xe8)==typeof T['data']?.['accountCap']&&(y=T[ag(0x1d1)][ag(0x1a4)]),ag(0xcd)==typeof T['data']?.[ag(0x1e4)]&&(d=T[ag(0x1d1)][ag(0x1e4)]);}}}catch{}return m=!(0xe59+-0x2*-0x721+0x1c9a*-0x1),$={'challengeId':J,'challengeName':K,'challengeCategory':L,'enteredAt':Date[ag(0x105)]()},function(U,V){const ai=ag,W=a0D()[ai(0x10d)]||ai(0x1bb);console[ai(0x177)](),console[ai(0x177)](a0v['green']['bold'](ai(0xcb))),console[ai(0x177)](),console[ai(0x177)](a0v[ai(0x14a)](ai(0x137))),console['log'](a0v['cyan']('\x20\x20│\x20')+a0v[ai(0x1ff)]['white'](U)+a0v[ai(0x1fa)](ai(0xeb)+V+']')),console[ai(0x177)](a0v['cyan']('\x20\x20│')),console[ai(0x177)](a0v[ai(0x14a)](ai(0x124))+a0v['gray']('Scoped\x20to\x20the\x20challenge\x20you\x20opened.\x20Ask\x20freely\x20—')),console['log'](a0v[ai(0x14a)](ai(0x124))+a0v[ai(0x1fa)](ai(0x17a))),console[ai(0x177)](a0v[ai(0x14a)](ai(0xe7))),console[ai(0x177)](),console[ai(0x177)](a0v[ai(0x19c)]('\x20\x20Commands')),console['log'](a0v[ai(0x12a)](ai(0x1cd))+a0v['gray'](ai(0x1e7))),console[ai(0x177)](a0v[ai(0x12a)]('\x20\x20\x20\x20!<shell\x20cmd>\x20\x20\x20\x20')+a0v[ai(0x1fa)](ai(0x15a))),console[ai(0x177)](a0v[ai(0x12a)](ai(0x19e))+a0v[ai(0x1fa)](ai(0x15d))),console[ai(0x177)](a0v[ai(0x12a)](ai(0xdb))+a0v['gray']('Leave\x20the\x20AI\x20teammate')),console[ai(0x177)](),console['log'](a0v[ai(0x1fa)]('\x20\x20Switch\x20challenge:\x20')+a0v[ai(0x12a)](ai(0x16e))+a0v['gray'](ai(0x119))+a0v[ai(0x12a)](ai(0x141))),A(),console['log'](a0v[ai(0x1fa)](ai(0x153)+W+')')),console['log'](a0v[ai(0x1fa)](ai(0x197))),console[ai(0x177)]();}(K,L),!(-0x1e7d+0x13*-0x1b7+0x3f12);}()):(console[ac(0x177)](),console[ac(0x177)](a0v[ac(0x19c)](ac(0x15f))),console[ac(0x177)](a0v[ac(0x1fa)](ac(0x16f))+a0v[ac(0x12a)](ac(0x1b6))+a0v[ac(0x1fa)](ac(0xe0))+a0v['white'](ac(0x16e))),console[ac(0x177)](a0v['gray'](ac(0x10c))),void console[ac(0x177)]());const D={};D[ac(0x19d)]='Hidden\x20Message',D[ac(0x1a1)]='Cryptography';const E=D;try{u=await a0z(E);}catch(I){return void a0I(I['message']);}r=!(-0x1631+0x824*0x4+-0xa5f*0x1),h=0x179b+0xd5d+-0x5b*0x68,m=!(0x1*0x1c6c+0xe0b+-0x2a76),console[ac(0x177)](),console['log'](a0v['green'][ac(0x1ff)](ac(0x130)+a0J(ac(0x117))+ac(0xcc))),console['log'](),console[ac(0x177)](a0v['white']('\x20\x20'+a0J(ac(0x1cc)))),console[ac(0x177)](),console[ac(0x177)](a0v[ac(0x14a)](ac(0x137))),console[ac(0x177)](a0v['cyan'](ac(0x124))+a0v[ac(0x1ff)][ac(0x12a)](a0J(ac(0xcf)))),console[ac(0x177)](a0v[ac(0x14a)](ac(0x19f))),console[ac(0x177)](a0v['cyan'](ac(0x124))+a0v[ac(0x12a)](a0J(ac(0x1fd)))),console[ac(0x177)](a0v[ac(0x14a)](ac(0x124))+a0v[ac(0x132)](ac(0x107))),console[ac(0x177)](a0v[ac(0x14a)]('\x20\x20│')),console[ac(0x177)](a0v['cyan']('\x20\x20│\x20')+a0v['white'](a0J(ac(0xe1)))),console[ac(0x177)](a0v[ac(0x14a)](ac(0x124))+a0v[ac(0x1fa)]('Flag\x20format:\x20icoa{...}')),console[ac(0x177)](a0v[ac(0x14a)](ac(0xe7))),console[ac(0x177)](),console['log'](a0v[ac(0x12a)]('\x20\x20'+a0J('ai4ctfLevels'))),console[ac(0x177)](),console['log'](a0v[ac(0x19c)]('\x20\x20\x20\x20hint\x20a')+a0v['gray']('\x20\x20\x20\x20'+a0J(ac(0x18c)))),console[ac(0x177)](a0v[ac(0x1fa)](ac(0x1b0)+a0J(ac(0xd2)))),console[ac(0x177)](a0v[ac(0x19c)](ac(0x158))+a0v['gray'](ac(0x173)+a0J(ac(0x176)))),console[ac(0x177)](a0v[ac(0x1fa)](ac(0x1b0)+a0J(ac(0x13c)))),console[ac(0x177)](a0v['yellow'](ac(0x160))+a0v[ac(0x1fa)]('\x20\x20\x20\x20'+a0J(ac(0x17e)))),console[ac(0x177)](a0v['gray']('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+a0J(ac(0x146)))),console['log'](),console[ac(0x177)](a0v['gray']('\x20\x20─────────────────────────────────────────')),console['log'](a0v[ac(0x1ff)][ac(0x12a)]('\x20\x20'+a0J(ac(0x209)))),console[ac(0x177)]('\x20\x20\x20\x20'+a0v['cyan']('hint\x20a')+a0v[ac(0x1fa)]('\x20\x20\x20→\x20'+a0J(ac(0xd6)))),console[ac(0x177)]('\x20\x20\x20\x20'+a0v[ac(0x14a)]('hint\x20b')+a0v[ac(0x1fa)](ac(0x102)+a0J(ac(0xf3)))),console['log'](ac(0x173)+a0v[ac(0x14a)]('hint\x20c')+a0v[ac(0x1fa)]('\x20\x20\x20→\x20'+a0J(ac(0x172)))),console[ac(0x177)](a0v[ac(0x1fa)](ac(0x173)+a0J('ai4ctfWelcomeNoReveal'))),console['log'](),console['log'](a0v['white']('\x20\x20'+a0J(ac(0x1ec)))),console['log'](a0v['gray']('\x20\x20'+a0J(ac(0x11d))+'\x20')+a0v['white'](ac(0x182))),console['log'](),console[ac(0x177)](a0v[ac(0x19c)]('\x20\x20'+a0J(ac(0x1c8)))),console[ac(0x177)](a0v[ac(0x12a)](ac(0x13f))+a0v[ac(0x1fa)](a0J('ai4ctfCmdHintLine'))),console[ac(0x177)](a0v[ac(0x12a)](ac(0x19e))+a0v[ac(0x1fa)](a0J(ac(0x1a0)))),console[ac(0x177)](a0v[ac(0x12a)](ac(0x1ca))+a0v[ac(0x1fa)](a0J('ai4ctfCmdShellLine'))),console['log'](a0v['gray'](ac(0x164))+a0v[ac(0x12a)]('!echo\x20aWNv...\x20|\x20base64\x20-d')),console['log'](a0v[ac(0x1fa)](ac(0xdb)+a0J(ac(0x1b4)))),console[ac(0x177)](),A(),console[ac(0x177)](a0v[ac(0x1fa)]('\x20\x20'+a0J(ac(0x116))+':\x20Google\x20Gemma\x204\x20('+B+')')),console['log'](a0v[ac(0x1fa)]('\x20\x20'+a0J(ac(0x16d)))),console[ac(0x177)]();});}
|
|
1
|
+
(function(j,k){const a3=a0k,q=j();while(!![]){try{const v=parseInt(a3(0x260))/(-0x1*-0x12c0+-0x185b+0x4*0x167)*(-parseInt(a3(0x219))/(0x19e5+-0x3a3+-0x40*0x59))+parseInt(a3(0x262))/(-0x3*-0xa39+-0x1bd7*-0x1+-0x3a7f)*(parseInt(a3(0x2a6))/(-0x1*0xf16+0x15db+0x5b*-0x13))+parseInt(a3(0x2ae))/(-0xce6*0x2+-0x28f*0x3+0x217e)+parseInt(a3(0x2ea))/(-0xf*0x67+-0x39d*0x1+0x9ac)*(parseInt(a3(0x2b0))/(0x26c4+-0x1*-0x3ad+0x1*-0x2a6a))+-parseInt(a3(0x1d0))/(0x2048+-0x139*-0x16+-0x3b26*0x1)+-parseInt(a3(0x2dd))/(0x1*-0x9cd+0xdc7+-0x3f1)*(parseInt(a3(0x1c6))/(-0x1*-0x130b+-0x12b1+0x1*-0x50))+parseInt(a3(0x27d))/(0x10e8*0x1+0x24fe+-0x35db)*(parseInt(a3(0x1f6))/(0x1027+0x1*-0x6c5+-0x956));if(v===k)break;else q['push'](q['shift']());}catch(z){q['push'](q['shift']());}}}(a0j,-0x3*0x9e76+0x8e1c+0x50c09));import a0v from'chalk';import{createChatSession as a0z}from'../lib/gemini.js';function a0j(){const aj=['icdILii','EwvSBg93','icaGice8C2HLBgWGy21KpIaGica','ywK0y3rMv3jHCff1B3rHqG','l2fWAs9Py29Hl2fPl2fJy291BNqTyNvKz2v0p2TPBMq9ywK0y3rM','ywK0y3rMuMv2zwfSvgHLBLn1yM1PDa','ywK0y3rMrgvJB2rLza','icaI','DMXH','y2HHBgXLBMDLswq','icaKia','AwnVyxT3m2XJmg1LxZjFywK0y3rMFq','icdILzdILzdILzaGquK0q1rgiokaLcbr','icbiB3CGDg8GD29YAYb0AgLZihf1zxn0Aw9U','zxHHBsbHBNn3zxiG','z2vTBweTnc0ZmwiTAxq','icboBYbJAgfSBgvUz2uGB3bLBIb5zxqU','mti2otK4y3rosgrf','ywK0y3rMt3jdAgf0rxHHBxbSzq','mtuZnZG5zgrMrNfh','Dg9Rzw4','lNr4DcaOAw5ZAwrLihrOzsbZyw5KyM94ksbYyxrOzxiGDgHHBIbHC2TPBMCGDgHLignVBNrLC3rHBNqGDg8GCgfZDguGDgHLihDOB2XLigjSB2iGyMfJAY4klsblzwvWihjLC3bVBNnLCYbJB25JAxnLigfUzcbWCMfJDgLJywWUifrOAxmGy29UDgvZDgfUDcbOyxmGBgLTAxrLzcb0Aw1LlG','ywK0y3rMrgvJB2rL','icaGicaGigHPBNqGysaGia','Dw5RBM93BIbLCNjVCG','vg9Rzw5Z','iwvJAg8GyvDoDI4UlIb8igjHC2u2ncaTza','AgLUDcbI','ywK0y3rMoIa','icbLEgL0ihrVigXLyxzLignOyxqGWRCGC3vIBwL0idXMBgfNpIb0BYbZy29Yzq','ywK0y3rMsgLUDee','u2nVCgvKihrVihrOzsbJAgfSBgvUz2uGEw91ig9Wzw5Lzc4GqxnRigzYzwvSEsdIGjq','zgvZy3jPChrPB24','ywK0y3rMuMv2zwfSvgL0Bgu','jsbVzIbZzwn0Aw9Uiefjigj1zgDLDcb1C2vKiokaLcbVBMX5ih4','zw5JB2rPBMC','y3rMigXPC3q','C3bSAxq','C3rHDhvZ','icaGicaGicbZDwjTAxqGAwnVyxT3m2XJmg1LxZjFywK0y3rMFq','B3jcywnR','ywK0y3rMsgLUDencB2r5','DxrMltG','ywK0y3rMu2fTCgXL','CM91BMq','ihjLy29YzgvKoIa','mte5mdmXB1rwr0vh','ywK0y3rMsgLUDfbYAw5JAxbSzq','icbuAgLUA2LUzY4UlG','icbtD2L0y2GGy2HHBgXLBMDLoIa','icaGicaGicaGicaGieXLyxzLignOyxqSihjLDhvYBIb0BYbLEgfT','ywK0y3rMvgL0Bgu','igzVCIbrmZK','igLZigeGBxvSDgLWBguTy2HVAwnLihf1zxn0Aw9UiokaLcbHBNn3zxiGD2L0Acbbl0iVqY9elG','ww91igfYzsbHBIbbssb0zwfTBwf0zsbOzwXWAw5NigeGy29UDgvZDgfUDcbZB2X2zsbHBIbjq09bidiWmJyGy3LIzxjZzwn1CML0EsbLEgfTihf1zxn0Aw9UlGOkq1vsuKvovcbrvuvtveLptIaOuq','yw5ZD2vYx2nOyw5Nzwq','icaGicaGicaGicaGica','ywK0y3rMv3jHCeXPBMuYqM9KEq','Bg9N','C3vIBwL0idXMBgfNpG','Aw50zxjHy3rPB25Z','DhjPBq','icaGicaGicaGicbuzwnOBMLXDwuGAgLUDcaOChjLlxDYAxr0zw4P','icbdB21WzxrPDgLVBIbPCYbWyxvZzwqU','ywK0y3rMv3jHCff1B3rHqKHPBNq','ywK0y3rMv3jHCfrPDgXL','ywK0y3rMrw5Ku2vZC2LVBG','y3vYCMvUDenOywXSzw5Nzu5HBwu','ywrK','ywK0y3rMtg9JA2vKvgHLBG','y2f0y2G','AgfZ','cGPzt1vsifjvtevtoGOTifLVDsbnqvKGzxHWBgfPBIbJB25Jzxb0CYWGzgvZy3jPyMuGyxbWCM9Hy2HLCYWGyw5KigHLBhaGDgHLignVBNrLC3rHBNqGCMvHC29UihrOCM91z2GGDgHLihbYB2jSzw0UcI0Gww91ie1bwsbKAxnJDxnZihrOzsb0zwnOBM9SB2D5igLUDM9SDMvKicHJCNLWDg8SihDLyIWGzM9Yzw5ZAwnZlcbWD24SihjLDMvYC2LUzYWGt1njtLqSihn0zwDVlcbLDgmUks4klsbzB3uGtufzigHLBhaGzgvIDwCGy29Kzsb0AguGy29UDgvZDgfUDcb3CML0zxmGyw5Kihn1z2DLC3qGD2HPy2GGDg9VBcaVigXPyNjHCNKGlYb0zwnOBMLXDwuGDg8GDxnLlGOTifLVDsbnvvnuie5pvcbYzxzLywWGB3iGz3vLC3mGDgHLigzSywCSigfUzcbnvvnuie5pvcbVDxrWDxqGyw55igzSywCTC2HHCgvKihn0CMLUzYaOyw55DgHPBMCGBgLRzsbUyw1LEY4UlN0PlGOTifLVDsbnvvnuie5pvcbZB2X2zsb0AguGD2HVBguGy2HHBgXLBMDLigvUzc10BY1LBMqGzM9YihrOzsbJB250zxn0yw50iokaLcbNDwLKzsWGzg9Uj3qGAgfUzcbVDMvYihrOzsbHBNn3zxiUcI0Gs2vLCcbYzxnWB25ZzxmGy29Uy2LZzsbHBMqGChjHy3rPy2fSlIbuAguGy29UDgvZDgfUDcbPCYbYywnPBMCGDgHLignSB2nRlG','rNvSBcbXDwvZDgLVBJOGia','icdILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','ywnJB3vUDenHCa','ywK0y3rMq2HHBgXLBMDL','icaGihn1yM1PDcbjq09bEY4UlN0','icaGicaGicaGicfLy2HVigfxtNzzwhqZttj4AK1hmwXyEKPMwvDRmfKZuM1Mut09ihWGyMfZzty0ic1K','icaGicaGicaGicaGifjLDhvYBIb0BYbTywLUig1LBNuGkhDVCMTZigfUExDOzxjLkq','Dg9mB3DLCKnHC2u','y3vYCMvUDenOywXSzw5NzuLK','lI4VBgLIl2LUDgvNCML0Es1ZBMfWC2HVDc5QCW','lI4VBgLIl2n0zMqTy2XPzw50lMPZ','C2XPy2u','ywK0y3rMv3jHCff1B3rHquHPBNq','y3rMngfP','mJH6DezLyvG','ywK0y3rMtgv2zwXZ','ywK0y3rMtg9JA2vKvxnL','ig9UifeZoq','icbuAguGquKGDgvHBw1HDguGC2nVCgvZigL0C2vSzIb0BYb0AguGy2HHBgXLBMDLihLVDsbVCgvUlG','Aw5JB3jYzwn0','icaGicaGigHPBNqGyIaGia','D3jPDgu','mtmXotmYmgfMzNjtva','icbdB21Tyw5KCW','n3rItg1NvW','BM93','CxvLC3rPB25Z','icdINjmGqw5ZD2vYigzVCIbr','Bwf0y2G','ywK0y3rMv3jHCeXPBMuYsgvHza','iwvJAg8GyvDoDLLyDdnnmNHQtuCXBfH6sMzzv2SWwtnsBwzrpt0GFcbIyxnLnJqGlwq','ywK0y3rMrxHPDe5LEhrtDwi','ifn1yM1PDcb5B3vYigzSywCGzM9YihrOAxmGCxvLC3rPB24','icbsyxrLigXPBwL0zwqG4OcuihDHAxqGysbTB21LBNqGyMvMB3jLihrYEwLUzYbHz2fPBI4','sgLUDca','icaGihn1yM1PDca8zMXHzZ4Gica','ywK0y3rMv3jHCff1B3rHqW','g1SXqrTBmKS','zxHHBsbXia','ANnVBG','icaGia','ywK0y3rMt3jdAgf0','ywK0y3rMrxHPDa','iIaOy2f0zwDVCNK6ia','ue9tva','Dg9Rzw5ZvxnLza','Cgf1C2vK','BNvTyMvY','zMLUza','oIbhB29NBguGr2vTBweGncaOz2vTBweTnc0ZmwiTAxqP','Ahr0Chm6lY9WCMfJDgLJzs5Py29HmJaYnI5HDs9HCgKVAwnVys9Kzw1Vlxn0yxrZ','z2vTAw5Ptw9KzwW','imk3ia','uNvUigeGC2HLBgWGy29TBwfUzcaOzs5NlIaHyMfZzty0ic1Kic4UlIK','C3vIBwL0ieLdt0f7lI4UFq','ywK0y3rMrM91BMrgBgfN','y29YCMvJDa','cGPbvfrbq0HfrcbeqvrbicHHBhnVihnHDMvKihrVignOywXSzw5NzxmVCq','AgLUDcbH','ywK0y3rMu3vIBwL0q21K','BwvZC2fNzq','lNr4DcbPBNnPzguGDgHLignVBNrLC3rHBNqNCYbZyw5KyM94iokaLcbWyxrOigLZihjLBgf0AxzLihrVihrOzsbZyw5KyM94j3mGl2HVBwuVy29TCgv0AxrVCIb3B3jRAw5NigrPCMvJDg9YEsWGCMvHy2HHyMXLigzYB20Gyw55icfZAgvSBcaVicfWExrOB24ZigLUDM9JyxrPB24PoGO','ixnOzwXS','ihrVA2vUCYbSzwz0lG','vg9Rzw4G','oIbhB29NBguGr2vTBweGncaO','icbbssb1C2fNzsbPCYbTzxrLCMvKihbLCIbHy2nVDw50icHZzxj2zxiTzw5MB3jJzwqGyNvKz2v0ks4','ihb0CW','icaGideUia','mZKYndGXsxjVv1zf','cGPdsefmtevor0uGqLjjruy6cG','icbgBgfNigzVCM1HDdOG','yxbWBgLJyxrPB24VANnVBG','icaGicaODhLWzsbPDcbYAwDODcbOzxjLigLUihrOAxmGy2HHDcdIGjqGBM90igfZigeGC2HLBgWGy29TBwfUzcK','icH1CgrHDgvZigfMDgvYihLVDxiGzMLYC3qGBwvZC2fNzsK','DgvZDa','icbB','icaGigHPBNqGyG','icdIMQaGodaLig9MihnLy3rPB24GquKGyNvKz2v0ihvZzwqU','z3jLzw4','ihDPBgWGB3bLBIbr','icdILiiG','mtKWnJy3neXwzwHqAW','icaGicaGicaGicaGicaGicaGicbLlMCUia','y3LHBG','DgLTzw91Da','yM9Sza','zw50zxjLzef0','ywnJB3vUDfnWzw50','icboB3rLoIa1mcuGB2yGC2vJDgLVBIbbssbIDwrNzxqGDxnLzc4','C2vZC2LVBKnVB2TPzq','lcbVCIbYzs1LBNrLCIb3AxrOia','icbbBhjLywr5ihnVBhzLzc4','Dgv4Da','C3vIBwL0igLJB2f7DZnSyZbTzv8Yx2fPngn0zN0','AwnVys1JBgKVyNvKz2v0','z3jHEq','icdILRGGia','Dg9ju09tDhjPBMC','CMvWzwf0','ywK0y3rMv3jHCff1B3rHC1rPDgXL','icaGigHPBNqGyW','iNDOyxqGzw5JB2rPBMCGAxmGDgHPCZ8I','quK0q1rgihnLy3rPB24','icaGicbsDw4GuhL0Ag9UigLUihnOzwXS','BgvUz3rO','D2HPDgu','AM9PBG','DhLWzufUzevUDgvYvg9czwDPBG','ywK0y3rM','y3vYCMvUDenOywXSzw5NzunHDgvNB3j5','ywK0y3rMsgLUDei','lIbuCNKGywDHAw4GAw5ZAwrLihrOAxmGy2HHDc4','icdINjCGsw5JB3jYzwn0lIa','mteWB2z4D2Lh','rMXHzYbMB3jTyxq6icaGieLdt0f7lI4UFq','yM9VBgvHBG','C3vIBwL0ia','CgfKrw5K','ywK0y3rMsgLUDejcB2r5','CMf0zwXPBwL0zwq','ywK0y3rMv3jHCe5VuhjVzW','icbvC2u6ia','lI4VBgLIl2v4yw0TC3rHDguUANm','mtiZnJa4zef3uw1o','Cu51Bq','ywK0y3rMrxHPDe5LEhrcB2r5','C3vIBwL0rMXHzW','ywK0y3rMsgLUDe5LEhrb','icbnB2rLBdOGr29Vz2XLieDLBw1HidqGka','icbbssbIDwrNzxqGzxHOyxvZDgvKigzVCIbbstrdveyGC2vJDgLVBI4','sunpqxT5B3vYx2zSywD9','ieLdt0f7lI4UFq','icaGigv4Axq','ywK0y3rMsgLUDe51zgDL','icbfCNjVCJOG','iokvKokvKokvKa','icbzB3uGy2fUihn0AwXSihn1yM1PDcbHigzSywCGzgLYzwn0BhK6ia','Cg9PBNrZ','icbbzNrLCIbLEgL0oIa','icaGicaGicaGicbbigDLBNrSzsbUDwrNzsaOChjLlxDYAxr0zw4P','ywK0y3rMtw9KzwW','ywn0Aw9U','ywK0y3rMq21Ku2HLBgXmAw5L','BM9KztPJAgLSzf9WCM9JzxnZ','icaGicfWExrOB24Zic4UlG','ywK0y3rMvgHPBMTPBMC','C3rHCNrZv2L0Aa','y2HHBgXLBMDLtMfTzq','ywK0y3rMv2vSy29Tzun0yq','ywK0y3rMv3jHCe5LEhrcB2r5','icbLEgL0id0GyMfJAYb0BYbLEgfTimk3ihn1yM1PDcbjq09bEY4UlN0GDg8Gyw5ZD2vY','icdILiZILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','icaG4OAsia','DMLHigfPngn0zIbJAgf0','icaGicaGicaGicblzxKGyNjLywT0AhjVDwDOicHWCMuTD3jPDhrLBIK','q29UDgvUDc1uExbL','ywK0y3rMv2vSy29Tzu5VuMv2zwfS','ywK0y3rMv3jHCff1B3rHrM9VDgvY','C2vZC2LVBJ0','iMHVDYbKBYbjigrLy3j5ChqGquvtluncqYbPBIbqExrOB24/iG','Dg9Rzw5mAw1PDa','nJbiBvHgvey','ywK0y3rMsgLUDfrLy2HUAxf1zq','icbezxrLy3rLzcbMBgfNiokaLcb0CMvHDgLUzYbHCZOG','icaGifbYzxzPB3vZoIa','BM90igvUzM9Yy2vKigzVCIb0AgLZigXVz2LU','icdILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILidILia','icaGicaGia','ywK0y3rMsgLUDenvC2vZ','q29TBwfUzcbMywLSzwq','x2XHC3rr','zxHPDa','ihrVignVBNrPBNvL','ywK0y3rMrxHPDe5LEhruAxrSzq','icaGicaGicaHzwnOBYbHv052wvH0m00YEgPnrZfSwhPkzLLxAZbzm1jTzLe9psb8igjHC2u2ncaTza','Aw5JBhvKzxm','icaGwW','E25VuhjVz30','tgvHDMuGDgHLiefjihrLyw1TyxrL','icaGicaGigHPBNqGyYaGia','icbbzNrLCIbLEgL0oIbbstrdveyGC2vJDgLVBIbJB21WBgv0zs4GtMv4DdOG','icaGieP1C3qGDhLWzsbMCMvLBhKGDg8Gy2HHDcb3AxrOihrOzsbbssb0zwfTBwf0zs4','AgLUDcbJ','rMXHzYbMB3jTyxq6igLJB2f7lI4UFq','E2nTzh0','ywK0y3rMv3jHCff1B3rHq0HPBNq','ig5VDcbMB3vUzcbPBIbZDgf0zs4','ywK0y3rMq21KsgLUDeXPBMu','icaGicaGicbPy29HE3CZBgmWBwvFmL9HAtrJDgz9','u3vIBwL0igeGzMXHzYb0BYb0AguGBgL2zsbZy29YzwjVyxjK','C3rYAw5NAwz5','iIbSB29RCYbSAwTLigfUie1dusbSzxr0zxiSig5VDcbHigzSywCU','ihbVAw50CYK6cG','y29UDgLUDwu','icbdDxjYzw50igfUC3DLCJOG','ywK0y3rMuMvWB3j0','neDxt1P6yW','ig5VDcbMB3vUzcbPBIbZDgf0zs4Gvhj5oIbLEgfTiheG','icdWN46jienVCNjLy3qHia','ywK0y3rMuMv2zwfStg9JA05VDgu','icaGidXQDxn0ihr5Cgu+icaGica','icaGica','icdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILzdILza','icdINjmGuq','ihrVig1VDMuGB24','icaOC3vIBwL0igfNywLUihrVignOyw5NzsK','zgf0yq','lZuWmda','icdILzdILzdILzaGquKGvgvHBw1HDguG4Pwq4Pwq4Pwq','yMfJAW','DhLWzq','ywK0y3rMq29TBwfUzhm','vw5RBM93BIbYzxnWB25Zzq','ywK0y3rMvg9Rzw5Z','yw5ZD2vYCW','icaGigv4AxqGicaGicaGicaGica','BwLU','y2XLyxi','C3rKB3v0','B3bLBIa8Awq+','icaOCMvZDw1PBMCG4OcuihbYAw9YignOyxqGAxmGBM90ihjLBwvTyMvYzwqSigj1Dcb0B2TLBNmGywXYzwfKEsb1C2vKihn0yxKGzgvKDwn0zwqP','CMvWBgfJzq','ywK0y3rMsgLUDem','ywK0y3rMuMv2zwfSu2vLrMXHzW','DgHPBMTPBMC','icbpCgvUig9UzsbMAxjZDdOG','icdcTYaGuMuTzw50zxi6ia','icbszxn1Bwu6ia','CxvPDa','cIaG','BNvKz2vtAg93BG','ywK0y3rMuMv2zwfSqM9KEq','ywK0y3rMv3jHCe5LEhruAxrSzq','y3rMzfvYBa','quKGzxjYB3i6ia','icbbstrdveyGy2HHDcbLBMrLzcbMB3iGuq','ywK0y3rMv3jHCeXPBMuXqM9KEq','igfNywLUihrVignOyw5NzsWGB3iG','y2f0zwDVCNK','ywK0y3rMsgLUDefcB2r5','C2vUze1LC3nHz2u','CMvK','yxr0ywnOzwreyxrH','Dg9vChbLCKnHC2u','icbbssb0zwfTBwf0zsbJBg9ZzwqGzM9Yici','igLZigfUievTyM9KAwvKiefjicHfquKPihf1zxn0Aw9UlG','ywLvC2fNzq','icaGicHhCMfKAw5NigHHChbLBNmGyxqGzxHHBsbZDwjTAxqG4OcuihLVDsbJyw5UB3qGChjLDMLLDYbJB3jYzwn0BMvZCYbKDxjPBMCGDgHLigv4yw0Ukq','icbr','DgHLiefjigD1AwrLCYWGAxqGD2LSBcbUB3qGAgfUzcb5B3uGDgHLigzSywCU'];a0j=function(){return aj;};return a0j();}import{addTokenUsage as a0B}from'../lib/budget.js';import{getConfig as a0D,isConnected as a0E}from'../lib/config.js';import{logCommand as a0F,logSubmission as a0G}from'../lib/logger.js';import{printMarkdown as a0H,printError as a0I}from'../lib/ui.js';import{t as a0J}from'../lib/i18n.js';const g=j=>new Promise(k=>setTimeout(k,j));let r=!(0x63*0x4f+-0xf51+0x1*-0xf3b),u=null,h=0x6bf+0x9*-0x272+-0x1*-0xf43,y=0x2f*-0x7b+-0x1698+0x2d2d,d=!(-0x7f*0x35+0x17+-0xd*-0x204),f=!(-0x6b*0x3b+0x11*-0x156+0x2f60),m=!(-0x9a9*-0x1+0xaa6+-0x144e);const p=-0x9281+0xa58+0x1f7*0x77,w=0xda51b*0x1+-0x4*0x222d3+0x2b631;let b=null,$=null;function a0k(a,b){a=a-(0xecb+-0xccd+0x1*-0x45);const c=a0j();let d=c[a];if(a0k['BvrIgN']===undefined){var e=function(i){const j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let l='',m='';for(let n=-0x57*0x59+0x6d*0x3a+0x58d,o,p,q=-0x2513*-0x1+0x77b+0x3*-0xeda;p=i['charAt'](q++);~p&&(o=n%(0xab1+-0x739+0x11*-0x34)?o*(-0x93a+0x1*-0xd80+0x16fa)+p:p,n++%(-0x14d+0x2061+-0x1f10))?l+=String['fromCharCode'](0x1*0x2207+-0x1a21+0x13*-0x5d&o>>(-(0x13ef+-0x154c+0x15f)*n&0x212+0x18d*-0xf+-0x1537*-0x1)):-0x3*-0x4ee+0x25a0+-0x346a){p=j['indexOf'](p);}for(let r=-0xa9b+-0x838+0x12d3,s=l['length'];r<s;r++){m+='%'+('00'+l['charCodeAt'](r)['toString'](0x6b*0x14+0x9af*0x1+-0x11fb))['slice'](-(-0xf61+-0x3*0xaad+0x2f6a));}return decodeURIComponent(m);};a0k['pSvfLM']=e,a0k['NrMLLb']={},a0k['BvrIgN']=!![];}const f=c[0x518*-0x1+-0x103f*-0x1+-0xb27],g=a+f,h=a0k['NrMLLb'][g];return!h?(d=a0k['pSvfLM'](d),a0k['NrMLLb'][g]=d):d=h,d;}export function isChatActive(){return r;}function A(){const a4=a0k,j=b?p:$?y||w:-0x7e8+-0xa9b+0x260b,k=h,q=Math[a4(0x22d)](Math['round'](k/j*(0x23dd*-0x1+0x85c*0x1+-0x25*-0xc1)),-0xf61+-0x3*0xaad+0x2fcc),v=Math[a4(0x27b)](q/(0x518*-0x1+-0x103f*-0x1+-0xac3)*(0x1e+0x6fd+-0x707)),z=0x79d+-0x4ff*-0x5+-0x821*0x4-v,B=q>0x1cee+0x653*0x3+0xfdd*-0x3?a0v[a4(0x246)]:q>0x4fd*0x2+0x3ce*0xa+-0x2fd4?a0v[a4(0x250)]:a0v['green'],D=b?a4(0x1bb):$?'AI\x20budget\x20(this\x20account)':a4(0x268);!$||d?!$||f?console['log'](a0v['gray']('\x20\x20'+D+':\x20')+B('█'[a4(0x2fb)](v))+a0v[a4(0x2f8)]('░'[a4(0x2fb)](z))+a0v[a4(0x2f8)]('\x20'+k+'/'+j+'\x20('+q+'%)')):console[a4(0x289)](a0v['gray']('\x20\x20AI\x20budget:\x20')+a0v[a4(0x250)]('syncing…')+a0v[a4(0x2f8)](a4(0x2e2))):console[a4(0x289)](a0v[a4(0x2f8)]('\x20\x20AI\x20budget:\x20')+a0v[a4(0x250)](a4(0x1fa))+a0v['gray']('\x20—\x20update\x20icoa-cli\x20to\x20the\x20latest\x20version'));}export async function handleChatMessage(v){const a5=a0k;if(!u)return a5(0x200);if(a0F(a5(0x26b)+v),b)return C(v);if($)return async function(F){const a6=a5;if(!$||!u)return a6(0x200);const G=F['trim'](),H=G[a6(0x29f)](),I=G[a6(0x2b4)](/^submit\s+(.+)/i);if(I){let J=I[0x6*0x209+-0x10c8+0x493][a6(0x28c)]();if(/^submit\s+/i[a6(0x2e3)](J)&&(J=J['replace'](/^submit\s+/i,'')[a6(0x28c)]()),J=J['replace'](/^["'`]+|["'`]+$/g,'')['trim'](),!J)return console[a6(0x289)](),console[a6(0x289)](a0v[a6(0x2f8)]('\x20\x20Usage:\x20')+a0v[a6(0x1be)](a6(0x28a))),console[a6(0x289)](),a6(0x216);const K=$[a6(0x258)];if(!K)return console[a6(0x289)](),console['log'](a0v['yellow']('\x20\x20No\x20challenge\x20id\x20in\x20context\x20—\x20open\x20one\x20first:\x20')+a0v[a6(0x1be)](a6(0x230))),console[a6(0x289)](),a6(0x216);a0G(K,J);const L=a0D();try{const {CTFdClient:M}=await import('../lib/ctfd-client.js'),N=L[a6(0x2f2)]||'',O=L['token']&&!L['token'][a6(0x204)](a6(0x1f3))?L['token']:'',P=new M(L[a6(0x23e)],O,N||L['token']),Q=await P[a6(0x1d3)](K,J);switch(console['log'](),Q[a6(0x275)]){case a6(0x2d0):console[a6(0x289)](a0v[a6(0x2e7)][a6(0x2ee)](a6(0x21b))+a0v['white'](Q[a6(0x2d4)]||''));break;case a6(0x2ab):console[a6(0x289)](a0v[a6(0x246)](a6(0x1c5))+a0v[a6(0x2f8)](Q[a6(0x2d4)]||''));break;case'already_solved':console[a6(0x289)](a0v[a6(0x250)](a6(0x2f4)));break;case a6(0x2c6):console[a6(0x289)](a0v[a6(0x250)](a6(0x28e)));break;case a6(0x1cc):console[a6(0x289)](a0v['yellow'](a6(0x2b9)));break;default:console[a6(0x289)](a0v[a6(0x2f8)]('\x20\x20'+(Q[a6(0x2d4)]||a6(0x229))));}console[a6(0x289)]();const {postIntegritySnapshot:R}=await import(a6(0x2a1));await R();}catch(S){console[a6(0x289)](),console[a6(0x289)](a0v[a6(0x246)]('\x20\x20Submission\x20failed:\x20'+(S[a6(0x2d4)]?.[a6(0x274)]('\x0a')[-0x657+-0x1*-0x18de+-0x1287]||a6(0x267)))),console[a6(0x289)]();}return a6(0x216);}if(F[a6(0x1e7)]('!')){const T=F['slice'](0x2*0x40e+0x2192+-0x29ad)[a6(0x28c)]();if(!T)return'continue';try{const U={};U[a6(0x272)]=a6(0x279),U[a6(0x2ed)]=0x2710;const {execSync:V}=await import(a6(0x1e4)),W=V(T,U)[a6(0x28c)]();console[a6(0x289)](),console[a6(0x289)](a0v[a6(0x2f8)](a6(0x259))+a0v[a6(0x1be)](T)),console['log'](a0v[a6(0x1be)]('\x20\x20'+W[a6(0x274)]('\x0a')['join'](a6(0x23a)))),console['log']();}catch(X){console['log'](),console['log'](a0v['red'](a6(0x1db)+(X['message']?.[a6(0x274)]('\x0a')[0x166+-0x79c+0x636]||a6(0x1fe)))),console[a6(0x289)]();}return'continue';}if(a6(0x200)===H||a6(0x226)===H||a6(0x239)===H){const Y=$[a6(0x1e8)];return r=!(0x846+-0x823*-0x2+-0x188b),u=null,$=null,console['log'](),console[a6(0x289)](a0v[a6(0x2f8)](a6(0x249)+Y+'\x22.')),console[a6(0x289)](a0v[a6(0x2f8)]('\x20\x20Open\x20another\x20challenge\x20with\x20')+a0v[a6(0x1be)](a6(0x230))+a0v['gray'](a6(0x2f3))+a0v[a6(0x1be)](a6(0x1c1))),console[a6(0x289)](),a6(0x200);}console['log'](a0v[a6(0x2f8)]('\x20\x20'+a0J(a6(0x1e6))));try{const Z=await u[a6(0x245)](F);process['stdout']['write'](a6(0x2bd)),a0B(Z[a6(0x2c5)]),a6(0x2c7)==typeof Z[a6(0x2f0)]?(h=Z[a6(0x2f0)],d=!(-0x2*-0xb55+-0x1*-0x1c+-0x16c6),f=!(-0x2*-0x2e3+-0xf75*-0x2+-0x24b0),'number'==typeof Z[a6(0x29a)]&&(y=Z[a6(0x29a)])):(h+=Z[a6(0x2c5)],f=!(0x7*-0x13d+0x2dc+-0x1*-0x5cf)),console['log'](),a0H(Z[a6(0x2f5)]),A(),console['log'](a0v[a6(0x2f8)](a6(0x26c))),console[a6(0x289)]();}catch(a0){process[a6(0x22f)][a6(0x2ad)](a6(0x2bd)),a0I(a6(0x23f)+a0[a6(0x2d4)]),console[a6(0x289)]();}return a6(0x216);}(v);const z=v[a5(0x28c)]()[a5(0x29f)]()[a5(0x2b4)](/^hint\s+([abc])$/);if(z)return function(F){const a7=a5,G=a0J('a'===F?a7(0x26d):'b'===F?a7(0x1c3):a7(0x233)),H=a0J('a'===F?a7(0x244):'b'===F?a7(0x1cb):a7(0x278)),I=a7(0x2ba)+F[a7(0x248)](),J='a'===F?a0v['green']:'b'===F?a0v[a7(0x250)]:a0v[a7(0x246)];console[a7(0x289)](),console[a7(0x289)](J[a7(0x2ee)]('\x20\x20▸\x20'+I+'\x20\x20')+a0v[a7(0x2f8)](G)),console[a7(0x289)]();for(const K of H[a7(0x274)]('\x0a'))''===K?console[a7(0x289)]():console[a7(0x289)](a0v[a7(0x1be)]('\x20\x20\x20\x20'+K));console[a7(0x289)](),'a'===F?(console['log'](a0v['gray'](a7(0x2c0)+a0J(a7(0x1d4))+'\x20')+a0v[a7(0x2ec)](a7(0x26a))),console[a7(0x289)]()):'b'===F&&(console['log'](a0v[a7(0x2f8)](a7(0x2c0)+a0J('ai4ctfHintNextB')+'\x20')+a0v['cyan'](a7(0x20b))),console[a7(0x289)]());}(z[0x1*0x225d+-0x1590+0x222*-0x6]),'continue';const B=v[a5(0x2b4)](/^submit\s+(.+)/i);if(B){let F=B[-0x31e*-0x4+-0x2682+-0x3b*-0x71][a5(0x28c)]();if(/^submit\s+/i[a5(0x2e3)](F)&&(F=F[a5(0x232)](/^submit\s+/i,'')[a5(0x28c)]()),F=F[a5(0x232)](/^["'`]+|["'`]+$/g,'')[a5(0x28c)](),a5(0x25a)===F){console[a5(0x289)](),console[a5(0x289)](a0v[a5(0x2e7)][a5(0x2ee)]('\x20\x20════════════════════════════════════')),console[a5(0x289)](a0v['green'][a5(0x2ee)]('\x20\x20'+a0J('ai4ctfCorrectFlag'))),console[a5(0x289)](a0v['green'][a5(0x2ee)](a5(0x21f))),console[a5(0x289)](),console['log'](a0v['white']('\x20\x20'+a0J(a5(0x255)))),console['log'](a0v['gray']('\x20\x20'+a0J('ai4ctfWouldEarn'))),console[a5(0x289)](),A(),r=!(0x1f02+-0x1*-0x1256+-0x1*0x3157),u=null,fetch('https://practice.icoa2026.au/api/icoa/demo-stats',{'method':'POST','headers':{'Content-Type':a5(0x2e0)},'body':JSON[a5(0x213)]({'type':a5(0x1c1),'solved':!(-0x1e9a+-0x1b*-0x5c+-0x217*-0xa),'tokensUsed':h,'timestamp':new Date()[a5(0x2fa)]()}),'signal':AbortSignal[a5(0x2ed)](-0x1*0x1279+-0x16c7+0x3cc8*0x1)})[a5(0x295)](()=>{}),await g(-0x106d+0x103c*-0x1+-0x13*-0x207),console[a5(0x289)](),console['log'](a0v['cyan'](a5(0x299))),console['log'](a0v['bold']['white']('\x20\x20'+a0J(a5(0x290)))),console[a5(0x289)](a0v[a5(0x2ec)](a5(0x299))),console[a5(0x289)]();const G=a0J('ai4ctfWrapLine1Head'),H=a0J(a5(0x241));console['log'](a0v[a5(0x1be)](a5(0x2dc)+G+'\x20')+a0v['gray'](H[a5(0x274)]('\x0a')[0x12*0x59+0xc17+0x3d*-0x4d]||''));for(const L of H[a5(0x274)]('\x0a')[a5(0x2a3)](0x8cb+0x1182+-0x1a4c))L['trim']()&&console[a5(0x289)](a0v[a5(0x2f8)](a5(0x1fc)+L[a5(0x232)](/\{thinking\}/g,a5(0x235))));console[a5(0x289)](),console['log'](a0v[a5(0x1be)]('\x20\x20\x20\x202.\x20'+a0J(a5(0x2b5))+'\x20')+a0v[a5(0x2f8)](a0J(a5(0x288)))),console['log'](),console[a5(0x289)](a0v[a5(0x2ec)](a5(0x29d))),console[a5(0x289)](),await g(-0x19c+-0x258f+0x2efb),console[a5(0x289)](a0v[a5(0x2ec)](a5(0x299))),console[a5(0x289)](a0v[a5(0x2ee)][a5(0x1be)]('\x20\x20'+a0J(a5(0x2fc)))),console[a5(0x289)](a0v[a5(0x2ec)](a5(0x299))),console[a5(0x289)](),console[a5(0x289)](a0v[a5(0x250)](a5(0x266))+a0v[a5(0x1be)](a0J('ai4ctfWrapQuotaA')[a5(0x1ca)](0x8*-0x22e+-0xa18+0x1ba2))+a0v[a5(0x2f8)](a0J(a5(0x2a4)))),console[a5(0x289)](a0v[a5(0x250)](a5(0x2ac))+a0v[a5(0x1be)](a0J(a5(0x252))[a5(0x1ca)](-0x1*-0xd7+-0x16f6+0x1639*0x1))+a0v[a5(0x2f8)](a0J(a5(0x28f)))),console[a5(0x289)](a0v[a5(0x250)](a5(0x208))+a0v[a5(0x1be)](a0J(a5(0x2bc))[a5(0x1ca)](0x5b*0x2b+0x2075+-0x2fa4))+a0v[a5(0x2f8)](a0J(a5(0x20e)))),console['log']();for(const M of a0J(a5(0x1f2))[a5(0x274)]('\x0a'))console[a5(0x289)](a0v[a5(0x2f8)](a5(0x2c0)+M));console[a5(0x289)](),await g(0x8f*-0x25+-0x31b*0x1+-0xfcb*-0x2),console[a5(0x289)](a0v['cyan'](a5(0x299))),console[a5(0x289)](a0v[a5(0x2ee)]['white']('\x20\x20'+a0J(a5(0x23d))+'\x20')+a0v[a5(0x246)][a5(0x2ee)](a5(0x2a5))+a0v[a5(0x1be)]('\x20—\x20'+a0J('ai4ctfWrapNextSub'))),console['log'](a0v[a5(0x2ec)]('\x20\x20─────────────────────────────────────────────')),console[a5(0x289)]();const I=a0J(a5(0x1ea)),J=a0J(a5(0x1cd)),K=I[a5(0x274)]('\x0a');if(K[0x12a9+0x530+-0x17d9]){const [N,O]=K[-0xf9*-0x1+0x20f3+0x34*-0xa7]['split'](a5(0x206));console['log'](a0v[a5(0x1be)]('\x20\x20\x20\x20'+(N||''))+a0v[a5(0x2ee)][a5(0x1be)](J)+a0v[a5(0x1be)](O||''));}for(const P of K['slice'](-0x2402+-0x10f3+0x34f6))P['trim']()&&console[a5(0x289)](a0v['white']('\x20\x20\x20\x20'+P));return console[a5(0x289)](),console['log'](a0v[a5(0x2f8)](a5(0x2c0)+a0J('ai4ctfWrapTypeCtf4ai')+'\x20')+a0v[a5(0x2ee)]['red']('ctf4ai')),console[a5(0x289)](),a5(0x200);}return console['log'](),console['log'](a0v['red']('\x20\x20'+a0J('ai4ctfWrongFlag'))),console[a5(0x289)](a0v[a5(0x2f8)]('\x20\x20'+a0J('ai4ctfFlagHint'))),console[a5(0x289)](),'continue';}if(v['startsWith']('!')){const Q=v[a5(0x2a3)](0xf9d+0x1dff*0x1+-0x5*0x91f)['trim']();if(!Q)return a5(0x216);try{const R={};R[a5(0x272)]=a5(0x279),R[a5(0x2ed)]=0x2710;const {execSync:S}=await import(a5(0x1e4)),T=S(Q,R)['trim']();console[a5(0x289)](),console[a5(0x289)](a0v[a5(0x2f8)]('\x20\x20$\x20')+a0v[a5(0x1be)](Q)),console[a5(0x289)](a0v['white']('\x20\x20'+T[a5(0x274)]('\x0a')[a5(0x1bf)](a5(0x23a)))),console[a5(0x289)](),console[a5(0x289)](a0v[a5(0x2f8)]('\x20\x20'+a0J(a5(0x2cf)))),console[a5(0x289)]();}catch(U){console[a5(0x289)](),console[a5(0x289)](a0v[a5(0x246)](a5(0x1db)+(U['message']?.[a5(0x274)]('\x0a')[-0x1254+-0x9*0x17f+0x1fcb]||'Command\x20failed'))),console[a5(0x289)]();}return a5(0x216);}const D={};D[a5(0x1f0)]='application/json';if(a5(0x200)===v||a5(0x226)===v||a5(0x239)===v||'menu'===v)return r=!(-0x1*0x47+0x18*-0xd2+0x13f8),u=null,fetch(a5(0x2ca),{'method':a5(0x2c4),'headers':D,'body':JSON[a5(0x213)]({'type':a5(0x1c1),'tokensUsed':h,'timestamp':new Date()[a5(0x2fa)]()}),'signal':AbortSignal[a5(0x2ed)](0x1d5a+0xa*0x1d1+-0x31c*0x9)})[a5(0x295)](()=>{}),console['log'](),console[a5(0x289)](a0v[a5(0x2f8)]('\x20\x20─────────────────────────────────────────')),console[a5(0x289)](a0v[a5(0x1be)]('\x20\x20'+a0J(a5(0x218)))),console['log'](a0v[a5(0x2f8)]('\x20\x20'+a0J(a5(0x22a))+':\x20'+h+a5(0x224))),console[a5(0x289)](a0v[a5(0x2f8)]('\x20\x20'+a0J(a5(0x1e1))+a5(0x2c9))),console['log'](a0v[a5(0x2f8)](a5(0x1fb))),console['log'](),console['log'](a0v[a5(0x2ec)](a5(0x299))),console[a5(0x289)](a0v[a5(0x1be)]('\x20\x20'+a0J(a5(0x202))+'\x20')+a0v[a5(0x2ee)][a5(0x246)](a5(0x2a5))+a0v[a5(0x1be)]('\x20—\x20'+a0J(a5(0x2b7)))),console['log'](a0v[a5(0x2f8)]('\x20\x20'+a0J(a5(0x1d2)))),console[a5(0x289)](a0v['cyan'](a5(0x299))),console[a5(0x289)](),console[a5(0x289)](a0v[a5(0x1be)](a5(0x2f9))+a0v[a5(0x1be)](a0J(a5(0x1c0))[a5(0x232)](a5(0x20d),a0v['bold'][a5(0x246)](a5(0x2a5))))),console[a5(0x289)](a0v['gray'](a5(0x21e)+a0J(a5(0x277)))),console[a5(0x289)](),a5(0x200);const E={};E[a5(0x1f0)]='application/json';if(!m&&h>=-0x2*0xb0f+-0x9b9+-0x1*-0x335f)return m=!(-0x66*-0x1d+-0x1*0x122a+0x69c),fetch(a5(0x2ca),{'method':a5(0x2c4),'headers':E,'body':JSON[a5(0x213)]({'type':a5(0x1c1),'solved':!(0x1330+-0x3dd+-0xf52),'tokensUsed':h,'timestamp':new Date()['toISOString']()}),'signal':AbortSignal[a5(0x2ed)](-0xb34+0x1b3e+0x37e)})[a5(0x295)](()=>{}),console[a5(0x289)](),console['log'](a0v[a5(0x250)]('\x20\x20'+a0J(a5(0x1f5)))),A(),(function(){const a8=a5;console[a8(0x289)](),console['log'](a0v[a8(0x250)]('\x20\x20─────────────────────────────────────────────')),console[a8(0x289)](a0v['bold'][a8(0x250)]('\x20\x20'+a0J(a8(0x270)))),console[a8(0x289)](a0v[a8(0x250)](a8(0x299))),console[a8(0x289)]();for(const V of a0J(a8(0x23c))[a8(0x274)]('\x0a'))''===V?console[a8(0x289)]():console['log'](a0v['white'](a8(0x2c0)+V));console[a8(0x289)](),console[a8(0x289)](a0v['cyan'](a8(0x203))),console['log'](),console[a8(0x289)](a0v[a8(0x1be)]('\x20\x20\x20\x20'+a0J(a8(0x234)))),console[a8(0x289)](),console[a8(0x289)](a0v[a8(0x2e7)](a8(0x211))),console[a8(0x289)](),console[a8(0x289)](a0v['white'](a8(0x2c0)+a0J(a8(0x254)))),console[a8(0x289)](),console[a8(0x289)](a0v[a8(0x2ec)](a8(0x276))),console[a8(0x289)](),console['log'](a0v['gray'](a8(0x2c0)+a0J(a8(0x21c)))),console[a8(0x289)]();}()),a5(0x216);if(m)return console[a5(0x289)](),console[a5(0x289)](a0v[a5(0x250)]('\x20\x20'+a0J('ai4ctfLockedTitle'))),console[a5(0x289)](a0v[a5(0x2f8)]('\x20\x20'+a0J(a5(0x2a8))+'\x20')+a0v[a5(0x2ec)](a5(0x2b6))),console['log'](a0v[a5(0x2f8)]('\x20\x20'+a0J(a5(0x294))+'\x20')+a0v[a5(0x2ec)](a5(0x2f6))),console[a5(0x289)](),a5(0x216);console[a5(0x289)](a0v[a5(0x2f8)]('\x20\x20'+a0J(a5(0x1e6))));try{const V=await u[a5(0x245)](v);process[a5(0x22f)]['write'](a5(0x2bd)),h+=V[a5(0x2c5)],a0B(V[a5(0x2c5)]),console[a5(0x289)](),a0H(V[a5(0x2f5)]),A(),console[a5(0x289)](a0v['gray']('\x20\x20exit\x20to\x20leave\x20chat')),console[a5(0x289)]();}catch(W){process[a5(0x22f)][a5(0x2ad)](a5(0x2bd)),a0I('AI\x20error:\x20'+W[a5(0x2d4)]),console[a5(0x289)]();}return a5(0x216);}const x=new Set();async function C(q){const a9=a0k;if(!b||!u)return'exit';const v=q['trim'](),z=v[a9(0x29f)](),B=(Date['now']()-b[a9(0x2ef)])/(-0x19e0e+0xb*-0x15a0+-0x1bb27*-0x2);if(!b[a9(0x23b)]&&!b['submitAttempted']&&B>=0xfbb*0x1+0x12a3+0x9*-0x3d1&&(b[a9(0x23b)]=!(0xf*0xbf+0x2417*-0x1+0x18e6),console['log'](),console['log'](a0v['yellow']('\x20\x20💡\x20Once\x20you\x20have\x20ICOA{...},\x20submit\x20it\x20with:\x20')+a0v[a9(0x2ee)][a9(0x250)]('submit\x20ICOA{your_flag}')),console[a9(0x289)](a0v['gray'](a9(0x2e1))),console[a9(0x289)]()),/^ICOA\{[^}]+\}$/i[a9(0x2e3)](v))return console['log'](),console[a9(0x289)](a0v[a9(0x2f8)](a9(0x1f8))+a0v[a9(0x1be)](a9(0x1c9)+v)),C(a9(0x1c9)+v);const D=v[a9(0x2b4)](/^submit\s+(.+)/i);if(D){let E=D[-0x1*0x224b+0xa35+0x7*0x371][a9(0x28c)]();if(/^submit\s+/i[a9(0x2e3)](E)&&(E=E[a9(0x232)](/^submit\s+/i,'')['trim']()),E=E[a9(0x232)](/^["'`]+|["'`]+$/g,'')[a9(0x28c)](),/^[A-Da-d]$/[a9(0x2e3)](E))return console[a9(0x289)](),console[a9(0x289)](a0v[a9(0x250)](a9(0x256)+E+a9(0x214))),console[a9(0x289)](a0v['gray'](a9(0x2df))+a0v[a9(0x2e7)](a9(0x1d7))+a0v[a9(0x2f8)](a9(0x1c4))),console['log'](),a9(0x216);const {getExamState:F,saveExamState:G}=await import(a9(0x1cf)),H=F();if(!H)return a9(0x200);if(!H[a9(0x2b2)][a9(0x2c8)](K=>K[a9(0x2c7)]===b[a9(0x1d1)]))return console[a9(0x289)](a0v[a9(0x246)](a9(0x24d)+b[a9(0x1d1)]+a9(0x20f))),'continue';const I=H['answers'][b[a9(0x1d1)]];H[a9(0x28b)]||(H[a9(0x28b)]=[]),H[a9(0x28b)]['push']({'ts':new Date()[a9(0x2fa)](),'q':b[a9(0x1d1)],'type':I?a9(0x286):'answer_submitted','input':E,'result':a9(0x1ee)}),H[a9(0x22b)][b[a9(0x1d1)]]=E;const J=b[a9(0x1d1)]+(-0x3d+0x1bc5+-0x1b87);return H[a9(0x1ff)]=J<=0x106c+-0xc2c+-0x41a?J:b['qNum'],G(H),console['log'](),I?(console[a9(0x289)](a0v[a9(0x2e7)](a9(0x220)+b[a9(0x1d1)]+'\x20answer\x20updated:\x20')+a0v[a9(0x250)](E)),console[a9(0x289)](a0v[a9(0x2f8)](a9(0x1f9)+I))):console[a9(0x289)](a0v[a9(0x2e7)][a9(0x2ee)](a9(0x2b3)+b[a9(0x1d1)]+a9(0x27c)+E)),console[a9(0x289)](a0v['gray'](a9(0x24c))),console[a9(0x289)](),console[a9(0x289)](a0v[a9(0x2f8)]('\x20\x20')+a0v['white'](a9(0x2ce))+a0v[a9(0x2f8)](a9(0x242))+a0v['white'](a9(0x200))+a0v[a9(0x2f8)](a9(0x221))),J<=0x38*-0x1f+-0x2*0x89b+-0xf*-0x19c?console['log'](a0v['gray'](a9(0x1df))+a0v[a9(0x2ec)](a9(0x1c1))+a0v['gray'](a9(0x2e8)+J)):console[a9(0x289)](a0v[a9(0x2f8)](a9(0x209))+a0v['red'](a9(0x2a5))+a0v[a9(0x2f8)](a9(0x2a9))),console[a9(0x289)](),a9(0x216);}if(q[a9(0x1e7)]('!')){const K=q[a9(0x2a3)](0x1e65+-0x19*0x175+0x609)['trim']();if(!K)return a9(0x216);try{const L={};L[a9(0x272)]=a9(0x279),L[a9(0x2ed)]=0x2710;const {execSync:M}=await import('node:child_process'),N=M(K,L)[a9(0x28c)]();console[a9(0x289)](),console['log'](a0v[a9(0x2f8)](a9(0x259))+a0v[a9(0x1be)](K)),console['log'](a0v['white']('\x20\x20'+N[a9(0x274)]('\x0a')[a9(0x1bf)](a9(0x23a)))),console[a9(0x289)]();}catch(O){console['log'](),console[a9(0x289)](a0v[a9(0x246)](a9(0x1db)+(O[a9(0x2d4)]?.[a9(0x274)]('\x0a')[-0x19a*0x3+0x1506+0x1*-0x1038]||a9(0x1fe)))),console[a9(0x289)]();}return a9(0x216);}if(a9(0x200)===z||a9(0x226)===z||a9(0x239)===z){const P=b[a9(0x1d1)],{getExamState:Q}=await import('../lib/exam-state.js'),R=Q(),S=R&&null!=R['answers'][P],T=R?.['_lastQ']||P;return r=!(0x78b+0x102a+-0x17b4),u=null,b=null,x[a9(0x22e)](),console[a9(0x289)](),console[a9(0x289)](a0v[a9(0x2f8)](a9(0x240)+P+'.')),S&&T>P&&T<=0x1b5c+0xf32+-0x2a68?console['log'](a0v['white']('\x20\x20Next:\x20')+a0v['bold'][a9(0x2e7)]('Q'+T)+a0v[a9(0x2f8)]('\x20—\x20type\x20')+a0v['cyan']('ai4ctf')+a0v[a9(0x2f8)](a9(0x201))):S&&P>=0xe*-0x209+0x1609*0x1+0x1*0x69b?console[a9(0x289)](a0v[a9(0x1be)]('\x20\x20AI4CTF\x20section\x20complete\x20—\x20')+a0v[a9(0x2ee)][a9(0x246)](a9(0x2a5))+a0v[a9(0x2f8)](a9(0x283))):console[a9(0x289)](a0v['gray'](a9(0x238))+a0v[a9(0x1be)](a9(0x2be)+P)+a0v[a9(0x2f8)](a9(0x237))+a0v['white'](a9(0x1c1))),console[a9(0x289)](),a9(0x200);}if(m)return console['log'](),console[a9(0x289)](a0v[a9(0x250)](a9(0x1d6))),console[a9(0x289)](a0v['gray']('\x20\x20Still\x20available:\x20')+a0v[a9(0x1be)](a9(0x28a))+a0v['gray']('\x20·\x20')+a0v[a9(0x1be)](a9(0x2d6))+a0v[a9(0x2f8)](a9(0x2cc))+a0v[a9(0x1be)](a9(0x200))),console[a9(0x289)](),'continue';if(h>=p)return m=!(0x189a+-0x215b+0x8c1),console[a9(0x289)](),console[a9(0x289)](a0v[a9(0x246)][a9(0x2ee)]('\x20\x20⚠\x20AI4CTF\x20token\x20budget\x20exhausted\x20(25,000\x20used).')),console['log'](a0v[a9(0x2f8)]('\x20\x20You\x20can\x20still:\x20')+a0v[a9(0x1be)](a9(0x28a))+a0v[a9(0x2f8)](a9(0x2cc))+a0v[a9(0x1be)](a9(0x2d6))+a0v['gray']('\x20·\x20')+a0v[a9(0x1be)](a9(0x200))),console[a9(0x289)](),'continue';console[a9(0x289)](a0v[a9(0x2f8)](a9(0x27f)));try{const U=await u[a9(0x245)](q);process[a9(0x22f)][a9(0x2ad)](a9(0x2bd)),h+=U[a9(0x2c5)];const {getRealExamState:V,saveExamState:W}=await import(a9(0x1cf)),X=V(),Y={};Y[a9(0x1c1)]=0x0,Y['ctf4ai']=0x0,(X&&(X[a9(0x24b)]||(X[a9(0x24b)]=Y),X['aiUsage']['ai4ctf']=h,W(X)),console[a9(0x289)](),a0H(U[a9(0x2f5)]),A(),console['log'](a0v[a9(0x2f8)](a9(0x1eb))),function(Z,a0,a1){const aa=a9,a2=Z/a0*(-0xbc6+-0x2304+0x2f2e);a2>=-0x1*-0x79f+0x1*0x1e17+0x79*-0x4f&&!a1[aa(0x296)]('95')?(console[aa(0x289)](a0v[aa(0x246)]['bold']('\x20\x20⚠\x20'+Math['round'](a2)+aa(0x271)+(a0-Z)+aa(0x2d7))),a1[aa(0x293)]('95')):a2>=0x165d+-0x1*-0x1335+0x14a1*-0x2&&!a1['has']('80')?(console['log'](a0v[aa(0x250)](aa(0x2e6))),a1[aa(0x293)]('80')):a2>=0x1*0xe1a+-0x794*-0x2+0xba*-0x28&&!a1[aa(0x296)]('50')&&(console[aa(0x289)](a0v['gray'](aa(0x2f1))),a1[aa(0x293)]('50'));}(h,p,x),console[a9(0x289)]());}catch(Z){process[a9(0x22f)][a9(0x2ad)]('\x1b[1A\x1b[2K'),a0I('AI\x20error:\x20'+Z[a9(0x2d4)]),console[a9(0x289)]();}return a9(0x216);}export function registerAi4ctfCommand(j){const ab=a0k;j['command'](ab(0x1c1))[ab(0x26f)]('Chat\x20with\x20your\x20AI\x20teammate')[ab(0x1e2)](async()=>{const ac=ab;a0F('ai4ctf');const {getRealExamState:k}=await import(ac(0x1cf)),q=k(),v=q?.[ac(0x2b2)]['some'](F=>'ai4ctf'===F[ac(0x227)]);if(q&&v){const F=q[ac(0x1ff)]||-0x4*-0x511+-0x1*-0x1fd+-0x1640,G=q[ac(0x2b2)][ac(0x2c8)](H=>H[ac(0x2c7)]===F);if(!G)return void a0I('Q'+F+ac(0x21a)+F);if(ac(0x1c1)!==G[ac(0x227)]){if(console[ac(0x289)](),ac(0x2a5)===G[ac(0x227)])console['log'](a0v[ac(0x250)](ac(0x24d)+F+'\x20is\x20a\x20CTF4AI\x20question\x20(attack-the-AI).')),console[ac(0x289)](a0v['gray'](ac(0x1ce))+a0v[ac(0x2ee)][ac(0x246)](ac(0x2a5)));else{if(ac(0x257)===G[ac(0x227)])console['log'](a0v[ac(0x250)](ac(0x24d)+F+ac(0x24a))),console[ac(0x289)](a0v[ac(0x2f8)](ac(0x1ce))+a0v[ac(0x2ee)][ac(0x2ec)]('ctf4eai'));else{const H=q[ac(0x2b2)]['find'](I=>ac(0x1c1)===I[ac(0x227)]);console[ac(0x289)](a0v[ac(0x250)](ac(0x24d)+F+ac(0x284))),H&&(console[ac(0x289)](a0v[ac(0x2f8)]('\x20\x20AI4CTF\x20chat\x20is\x20available\x20on\x20practical\x20questions\x20(next:\x20Q'+H[ac(0x2c7)]+').')),console[ac(0x289)](a0v[ac(0x2f8)]('\x20\x20Jump\x20there:\x20')+a0v[ac(0x2ee)][ac(0x2ec)](ac(0x2be)+H[ac(0x2c7)])));}}return void console[ac(0x289)]();}return void await async function(I,J){const ad=ac,{getRealExamState:K,refetchQuestionDataIfStale:L,materializeAttachedData:M}=await import(ad(0x1cf));await L();const N=K();if(!N)return!(0xc8*-0x4+-0x1726*0x1+0x1a47);const O=N[ad(0x2b2)][ad(0x2c8)](R=>R[ad(0x2c7)]===I);O&&(J=O),M(I,J?.[ad(0x247)]);const P=N['aiUsage']?.[ad(0x1c1)]??-0x535+-0x161e+0x1b53*0x1;if(P>=p)return console['log'](),console[ad(0x289)](a0v['yellow']('\x20\x20⚠\x20Your\x20AI4CTF\x20token\x20budget\x20is\x20exhausted.')),console[ad(0x289)](a0v[ad(0x2f8)](ad(0x1dd))+a0v[ad(0x1be)](ad(0x25d)+I+ad(0x1d8))),console[ad(0x289)](),!(-0xc4+0xb6a*-0x1+0x1*0xc2f);try{u=await a0z(void(-0x5*0x796+0x1224+0x13ca),function(R,S){const ae=ad,T=R[ae(0x26f)]||R[ae(0x2f5)]||'',U=R['attachedData']?ae(0x2d1)+S+ae(0x2d5)+R['attachedData']:'';return ae(0x285)+S+',\x20'+R[ae(0x243)]+',\x20'+(R[ae(0x1de)]||0x67*-0x4a+-0xd*-0x233+0x135)+ae(0x215)+T+U+'\x0a\x0aYOUR\x20RULES:\x0a-\x20You\x20MAY\x20explain\x20concepts,\x20describe\x20approaches,\x20and\x20help\x20the\x20contestant\x20reason\x20through\x20the\x20problem.\x0a-\x20You\x20MAY\x20discuss\x20the\x20technology\x20involved\x20(AES,\x20pwntools,\x20Python\x20struct,\x20HTTP,\x20etc.).\x0a-\x20You\x20MAY\x20help\x20debug\x20Python\x20code\x20the\x20contestant\x20writes.\x0a-\x20You\x20MUST\x20NOT\x20reveal\x20the\x20flag\x20directly.\x0a-\x20You\x20MUST\x20NOT\x20output\x20any\x20string\x20matching\x20ICOA{...}\x20or\x20icoa{...}.\x0a-\x20You\x20MUST\x20NOT\x20tell\x20the\x20contestant\x20the\x20exact\x20answer\x20to\x20this\x20question.\x0a-\x20You\x20MAY\x20suggest\x20which\x20tool\x20/\x20library\x20/\x20technique\x20to\x20use.\x0a-\x20When\x20suggesting\x20shell\x20/\x20python\x20snippets\x20that\x20need\x20the\x20attached\x20data,\x20refer\x20to\x20the\x20file\x20path\x20challenges/q'+S+ae(0x264);}(J,I));}catch(R){return a0I(R[ad(0x2d4)]),!(0xef6+0x12c7+-0x21bc);}r=!(-0x217f+-0x25f0+0x1*0x476f),h=P,m=!(0x1c31+0x3ce*0xa+-0x423c),b={'qNum':I,'question':J,'usageField':ad(0x1c1),'enteredAt':Date[ad(0x2b1)](),'submitAttempted':!(-0x216+0xf*0x259+0x10*-0x212),'nudgeShown':!(0x1b+-0x2f2*0x2+0x5ca)};const Q=N[ad(0x22b)]?.[I];return function(S,T,U){const af=ad,V=a0D()[af(0x2cb)]||af(0x25e),W=h>-0x22f6+-0x7*0x398+0x3c1e;console[af(0x289)](),console[af(0x289)](a0v['green'][af(0x2ee)](af(0x25b)+T+':\x20'+S[af(0x243)]+'\x20═══')),W&&console[af(0x289)](a0v['gray'](af(0x231))),U&&console['log'](a0v[af(0x2f8)](af(0x217))+a0v[af(0x250)](U)+a0v[af(0x2f8)](af(0x222))),console[af(0x289)](),console[af(0x289)](a0v[af(0x2ec)]('\x20\x20┌─────────────────────────────────────────────')),console['log'](a0v[af(0x2ec)](af(0x2e9))+a0v[af(0x2ee)][af(0x1be)]('Q'+T+af(0x2e4)+S[af(0x243)]+']\x20\x20·\x20'+(S['points']||0x1a*0xa4+-0x17f1*0x1+0x74f)+af(0x2db))),console[af(0x289)](a0v[af(0x2ec)](af(0x24f)));for(const X of String(S[af(0x2f5)])[af(0x274)]('\x0a')){const Y=X[af(0x1bd)]>-0x1*-0x2299+0x1*-0x2517+0x2ba*0x1?X[af(0x2a3)](-0xa23+-0x1f76+-0x17*-0x1cf,0x17f9+-0x7*-0x593+-0x1*0x3ec5)+'...':X;console[af(0x289)](a0v[af(0x2ec)]('\x20\x20│\x20')+a0v[af(0x1be)](Y));}console[af(0x289)](a0v[af(0x2ec)]('\x20\x20│')),console['log'](a0v[af(0x2ec)](af(0x2e9))+a0v[af(0x2f8)](af(0x298))+a0v[af(0x1be)](af(0x2be)+T)),console[af(0x289)](a0v[af(0x2ec)](af(0x2e9))+a0v['gray'](af(0x1c7))),console[af(0x289)](a0v[af(0x2ec)]('\x20\x20└─────────────────────────────────────────────')),console['log'](),console['log'](a0v[af(0x2ee)]['white'](af(0x25c))),console[af(0x289)](),console[af(0x289)](a0v[af(0x250)]('\x20\x20\x20\x20hint\x20a')+a0v[af(0x2f8)](af(0x1e0))),console[af(0x289)](a0v[af(0x250)](af(0x2e5))+a0v[af(0x2f8)](af(0x28d))),console[af(0x289)](a0v[af(0x250)](af(0x1b9))+a0v['gray'](af(0x1ef))),console[af(0x289)](a0v['bold']['green'](af(0x29c))+a0v[af(0x2f8)](af(0x2b8))),console[af(0x289)](a0v[af(0x1be)](af(0x1e5))+a0v[af(0x2f8)](af(0x1bc))),console['log'](a0v[af(0x2f8)](af(0x20a))),console[af(0x289)](a0v[af(0x2f8)](af(0x2eb))+a0v[af(0x1be)](af(0x1f4))),console[af(0x289)](),console[af(0x289)](a0v[af(0x2f8)](af(0x1d9))+a0v[af(0x2f8)](af(0x281))),console[af(0x289)](a0v[af(0x2f8)]('\x20\x20\x20\x20menu')+a0v[af(0x2f8)](af(0x29e))),console[af(0x289)](),A(),console[af(0x289)](a0v['gray'](af(0x1d5)+V+')')),console[af(0x289)]();}(J,I,Q),!(0x15f3+-0x1fd5+-0xb*-0xe6);}(F,G);}const z=a0D(),B=z[ac(0x2cb)]||'gemma-4-31b-it';if(a0E())return z[ac(0x292)]?void await(async function(){const ag=ac,I=a0D(),J=I[ag(0x2a0)],K=I[ag(0x292)],L=I[ag(0x1c2)]||'Unknown';let M='';if(J)try{const {CTFdClient:N}=await import(ag(0x2a2)),O=I[ag(0x2f2)]||'',P=I[ag(0x263)]&&!I[ag(0x263)][ag(0x204)]('session=')?I[ag(0x263)]:'',Q=new N(I[ag(0x23e)],P,O||I[ag(0x263)]);M=(await Q['getChallenge'](J))[ag(0x26f)]||'';}catch{}try{u=await a0z(void(-0x783+0x2*0xc64+-0x1145),function(R,S,T){const ah=ag;return'You\x20are\x20an\x20AI\x20teammate\x20helping\x20a\x20contestant\x20in\x20a\x20live\x20Capture-The-Flag\x20competition.\x0a\x0aCURRENT\x20CHALLENGE:\x20\x22'+R+ah(0x2c3)+S+').'+(T?ah(0x2de)+T:'')+ah(0x297);}(K,L,M));}catch(R){return a0I(R[ag(0x2d4)]),!(-0xc32+0x1*0x709+0x2*0x295);}r=!(-0x1d0c+-0x837+0x1*0x2543),h=-0xd*-0x1df+0x118a+-0x29dd,f=!(-0xcd4+-0xe5c+-0x1*-0x1b31),y=w,d=!(0x14fc+0x42+0x2*-0xa9f);try{if(I[ag(0x23e)]&&I[ag(0x263)]){const S=await fetch(I[ag(0x23e)]+ag(0x253),{'headers':{'Authorization':ag(0x2d8)+I[ag(0x263)],'User-Agent':ag(0x2f7)}});if(S['ok']){const T=await S[ag(0x2bf)]();'number'==typeof T['data']?.[ag(0x2f0)]&&(h=T['data'][ag(0x2f0)],f=!(-0xa36+0x1ae8+-0x10b2)),ag(0x2c7)==typeof T[ag(0x223)]?.[ag(0x29a)]&&(y=T[ag(0x223)][ag(0x29a)]),ag(0x1c8)==typeof T[ag(0x223)]?.['accountVerified']&&(d=T[ag(0x223)]['accountVerified']);}}}catch{}return m=!(0x1fc1+0xadd+-0x2a9d),$={'challengeId':J,'challengeName':K,'challengeCategory':L,'enteredAt':Date[ag(0x2b1)]()},function(U,V){const ai=ag,W=a0D()[ai(0x2cb)]||ai(0x25e);console['log'](),console[ai(0x289)](a0v[ai(0x2e7)][ai(0x2ee)](ai(0x225))),console['log'](),console[ai(0x289)](a0v['cyan'](ai(0x1ec))),console[ai(0x289)](a0v['cyan'](ai(0x2e9))+a0v['bold'][ai(0x1be)](U)+a0v[ai(0x2f8)](ai(0x205)+V+']')),console[ai(0x289)](a0v[ai(0x2ec)](ai(0x24f))),console[ai(0x289)](a0v[ai(0x2ec)]('\x20\x20│\x20')+a0v['gray'](ai(0x26e))),console[ai(0x289)](a0v['cyan'](ai(0x2e9))+a0v[ai(0x2f8)](ai(0x24e))),console[ai(0x289)](a0v[ai(0x2ec)]('\x20\x20└─────────────────────────────────────────────')),console[ai(0x289)](),console[ai(0x289)](a0v[ai(0x250)](ai(0x2af))),console['log'](a0v[ai(0x1be)](ai(0x21d))+a0v[ai(0x2f8)]('Ask\x20the\x20AI\x20teammate\x20about\x20this\x20challenge')),console[ai(0x289)](a0v['white'](ai(0x251))+a0v[ai(0x2f8)](ai(0x2cd))),console[ai(0x289)](a0v[ai(0x1be)](ai(0x2bb))+a0v[ai(0x2f8)](ai(0x212))),console['log'](a0v[ai(0x1be)](ai(0x22c))+a0v[ai(0x2f8)](ai(0x207))),console[ai(0x289)](),console[ai(0x289)](a0v['gray'](ai(0x280))+a0v[ai(0x1be)](ai(0x230))+a0v[ai(0x2f8)]('\x20then\x20re-enter\x20')+a0v['white'](ai(0x1c1))),A(),console[ai(0x289)](a0v[ai(0x2f8)]('\x20\x20Model:\x20Google\x20Gemma\x204\x20('+W+')')),console[ai(0x289)](a0v[ai(0x2f8)](ai(0x2da))),console[ai(0x289)]();}(K,L),!(-0xa75+0x167b+-0xc06);}()):(console[ac(0x289)](),console[ac(0x289)](a0v['yellow'](ac(0x25f))),console['log'](a0v['gray'](ac(0x236))+a0v[ac(0x1be)](ac(0x273))+a0v[ac(0x2f8)]('\x20then\x20')+a0v[ac(0x1be)](ac(0x230))),console[ac(0x289)](a0v[ac(0x2f8)](ac(0x2aa))),void console[ac(0x289)]());const D={};D['name']='Hidden\x20Message',D[ac(0x243)]='Cryptography';const E=D;try{u=await a0z(E);}catch(I){return void a0I(I[ac(0x2d4)]);}r=!(-0x337*0x4+-0x182c+-0x1*-0x2508),h=-0x123b+0x1285*-0x1+0x24c0,m=!(0x9d3+-0x1975+0xfa3),console[ac(0x289)](),console[ac(0x289)](a0v[ac(0x2e7)][ac(0x2ee)]('\x20\x20═══\x20'+a0J(ac(0x282))+ac(0x1dc))),console['log'](),console['log'](a0v[ac(0x1be)]('\x20\x20'+a0J(ac(0x27a)))),console[ac(0x289)](),console['log'](a0v[ac(0x2ec)](ac(0x1ec))),console['log'](a0v[ac(0x2ec)](ac(0x2e9))+a0v[ac(0x2ee)][ac(0x1be)](a0J(ac(0x29b)))),console[ac(0x289)](a0v['cyan'](ac(0x24f))),console[ac(0x289)](a0v[ac(0x2ec)]('\x20\x20│\x20')+a0v['white'](a0J('ai4ctfIntercepted'))),console[ac(0x289)](a0v[ac(0x2ec)](ac(0x2e9))+a0v['green']('aWNvYXt3M2xjMG1lXzJfYWk0Y3RmfQ==')),console[ac(0x289)](a0v['cyan'](ac(0x24f))),console[ac(0x289)](a0v[ac(0x2ec)](ac(0x2e9))+a0v[ac(0x1be)](a0J(ac(0x265)))),console['log'](a0v['cyan'](ac(0x2e9))+a0v['gray'](ac(0x20c))),console[ac(0x289)](a0v[ac(0x2ec)]('\x20\x20└─────────────────────────────────────────────')),console[ac(0x289)](),console[ac(0x289)](a0v['white']('\x20\x20'+a0J(ac(0x2a7)))),console[ac(0x289)](),console[ac(0x289)](a0v[ac(0x250)]('\x20\x20\x20\x20hint\x20a')+a0v[ac(0x2f8)]('\x20\x20\x20\x20'+a0J('ai4ctfHintA'))),console['log'](a0v[ac(0x2f8)](ac(0x287)+a0J('ai4ctfHintAUses'))),console[ac(0x289)](a0v[ac(0x250)](ac(0x2e5))+a0v[ac(0x2f8)](ac(0x2c0)+a0J('ai4ctfHintB'))),console[ac(0x289)](a0v[ac(0x2f8)]('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+a0J('ai4ctfHintBUses'))),console['log'](a0v[ac(0x250)](ac(0x1b9))+a0v[ac(0x2f8)](ac(0x2c0)+a0J(ac(0x233)))),console[ac(0x289)](a0v['gray']('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+a0J(ac(0x1fd)))),console[ac(0x289)](),console[ac(0x289)](a0v[ac(0x2f8)](ac(0x1fb))),console[ac(0x289)](a0v[ac(0x2ee)][ac(0x1be)]('\x20\x20'+a0J(ac(0x1e9)))),console[ac(0x289)](ac(0x2c0)+a0v[ac(0x2ec)](ac(0x2d2))+a0v['gray'](ac(0x1ed)+a0J(ac(0x1da)))),console[ac(0x289)]('\x20\x20\x20\x20'+a0v[ac(0x2ec)](ac(0x26a))+a0v[ac(0x2f8)](ac(0x1ed)+a0J(ac(0x1f7)))),console[ac(0x289)](ac(0x2c0)+a0v['cyan'](ac(0x20b))+a0v['gray'](ac(0x1ed)+a0J(ac(0x27e)))),console[ac(0x289)](a0v[ac(0x2f8)](ac(0x2c0)+a0J(ac(0x1f1)))),console[ac(0x289)](),console['log'](a0v[ac(0x1be)]('\x20\x20'+a0J(ac(0x2c1)))),console['log'](a0v[ac(0x2f8)]('\x20\x20'+a0J(ac(0x261))+'\x20')+a0v[ac(0x1be)](ac(0x1ba))),console[ac(0x289)](),console['log'](a0v[ac(0x250)]('\x20\x20'+a0J(ac(0x228)))),console[ac(0x289)](a0v[ac(0x1be)]('\x20\x20\x20\x20hint\x20a\x20/\x20b\x20/\x20c\x20\x20')+a0v['gray'](a0J(ac(0x210)))),console[ac(0x289)](a0v[ac(0x1be)](ac(0x2bb))+a0v[ac(0x2f8)](a0J(ac(0x2d3)))),console['log'](a0v[ac(0x1be)](ac(0x251))+a0v['gray'](a0J(ac(0x1e3)))),console[ac(0x289)](a0v[ac(0x2f8)]('\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20e.g.\x20')+a0v[ac(0x1be)](ac(0x269))),console[ac(0x289)](a0v[ac(0x2f8)](ac(0x22c)+a0J(ac(0x291)))),console[ac(0x289)](),A(),console[ac(0x289)](a0v['gray']('\x20\x20'+a0J(ac(0x1e1))+ac(0x2d9)+B+')')),console[ac(0x289)](a0v[ac(0x2f8)]('\x20\x20'+a0J(ac(0x2c2)))),console[ac(0x289)]();});}
|
package/dist/commands/ai4ioai.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Interface as e,createInterface as o}from"node:readline";import chalk from"chalk";import{getConfig as t}from"../lib/config.js";import{getMainRl as n}from"../lib/main-rl.js";import{logCommand as s}from"../lib/logger.js";import{printMarkdownYellow as l,printError as r}from"../lib/ui.js";const i="google/gemma-3n-e4b-it",a="Gemma 3n E4B",c=32768,g='You are Gemma 3n E4B ("google/gemma-3n-e4b-it"), the exact model named for the IOAI onsite contest chatbox. If asked which model you are, answer "Gemma 3n E4B" — never claim to be any other variant; your training data predates your own release, so trust this note over your intuition. You are an AI assistant for a contestant training for IOAI (the International Olympiad in Artificial Intelligence). Help with machine learning concepts, classic algorithms, model debugging, Python (numpy/pandas/sklearn/pytorch at small scale), and the math behind them. Be concise and practical; prefer worked examples over lectures. If a question is ambiguous, ask one clarifying question instead of guessing.';function h(e){return Math.ceil(e.length/4)}let u=null,d="",y="",m=i,p=[],w=0,f=1,x=0,b=0,k=0,A=!0,I=0,$=0,v=0,O=0;const S=new Set;function T(e){return[...p.map(e=>({role:e.role,text:e.parts.map(e=>e.text).join("")})),{role:"user",text:e}]}export function ai4ioaiPromptLabel(){return"proxy"===u||/gemma-?3/i.test(m)?"gemma3":"ai4ioai"}function L(){const e=Math.min(Math.round(w/c*100),100),o=Math.round(e/100*20),t=e>=80?chalk.red:e>=50?chalk.yellow:chalk.green;console.log(chalk.gray(" Context ")+t("█".repeat(o))+chalk.gray("░".repeat(20-o))+chalk.gray(` ${w.toLocaleString()}/${c.toLocaleString()} tokens (${e}%) · conversation #${f}, ${x} turn${1===x?"":"s"}`))}export async function startAi4ioaiChat(){s("ai4ioai");const e=t();u=null;const o=process.env.ICOA_AI4IOAI_ENDPOINT||e.ai4ioaiEndpoint||"",n=process.env.ICOA_AI4IOAI_API_KEY||e.ai4ioaiApiKey||"";return o&&n?(d=o.replace(/\/+$/,""),y=n,m=process.env.ICOA_AI4IOAI_MODEL||e.ai4ioaiModel||i,u="openai"):(d=(process.env.ICOA_AI4IOAI_PROXY||"https://practice.icoa2026.au").replace(/\/+$/,""),m=i,u="proxy"),p=[],w=h(g),f=1,x=0,k=0,b=0,O=0,A=!0,I=0,$=0,v=0,S.clear(),console.log(),console.log(chalk.bold.green(" ═══ AI4IOAI — contest chatbox simulator (official rules) ═══")),console.log(),console.log(chalk.white(" The revised Technical Appendix (2026-07) fixes the main-contest")),console.log(chalk.white(" chatbox: Gemma E4B, single-turn, tight caps. This trainer enforces")),console.log(chalk.white(" the exact same limits — what works here works onsite.")),console.log(),console.log(chalk.cyan(" ┌─────────────────────────────────────────────")),console.log(chalk.cyan(" │ ")+chalk.bold.white("The official chatbox rules")),console.log(chalk.cyan(" │")),console.log(chalk.cyan(" │ ")+chalk.gray("Your message: ≤ 2,000 characters (~350 words)")),console.log(chalk.cyan(" │ ")+chalk.gray("Its reply: ≤ 1,000 tokens (~750 words)")),console.log(chalk.cyan(" │ ")+chalk.gray("Memory: NONE — every message starts from zero.")),console.log(chalk.cyan(" │ ")+chalk.gray("Nothing you said before exists. You are the memory.")),console.log(chalk.cyan(" └─────────────────────────────────────────────")),console.log(),console.log(chalk.yellow(" Commands")),console.log(chalk.white(" <just type> ")+chalk.gray("Ask the AI — each message is a fresh, complete world")),console.log(chalk.white(" /rules ")+chalk.gray("The official chatbox limits")),console.log(chalk.white(" /ctx ")+chalk.gray("Session stats + contest strategy")),console.log(chalk.white(" /multi ")+chalk.gray("Multi-turn sandbox (off-spec window experiments)")),console.log(chalk.white(" exit ")+chalk.gray("Leave")),console.log(),console.log(chalk.yellowBright(` Model: ${a} · connected · single-turn · ≤2,000 chars in / ≤1,000 tokens out`)),console.log(chalk.yellowBright(` (Real ${a} — the exact chatbox model named in the IOAI Technical Appendix.)`)),console.log(),!0}export async function handleAi4ioaiMessage(e){if(!u)return"exit";s(`ai4ioai: ${e}`);const o=e.trim(),n=o.toLowerCase();if("exit"===n||"quit"===n||"back"===n||"q"===n||"menu"===n)return u=null,console.log(),console.log(chalk.gray(" ─────────────────────────────────────────")),console.log(chalk.white(" AI4IOAI session ended.")),A?(console.log(chalk.gray(` Messages: ${k} · blocked over 2,000 chars: ${v} · billed: ${O.toLocaleString()} tokens`)),console.log(chalk.gray(" The real chatbox forgets between messages — the discipline you just practiced is the tool."))):(console.log(chalk.gray(` Conversations: ${f} · total turns: ${k} · peak context: ${b.toLocaleString()} tokens (${Math.round(b/c*100)}% of window)`)),console.log(chalk.gray(" Reminder: the official contest chatbox is single-turn — the sandbox gauge does not exist there."))),console.log(chalk.gray(" ─────────────────────────────────────────")),console.log(),"exit";if("/new"===n||"new"===n||"/clear"===n||"clear"===n||"/restart"===n)return A?(console.log(),console.log(chalk.gray(" Single-turn mode — every message already starts fresh (official contest behavior).")),console.log(chalk.gray(" Multi-turn sandbox: ")+chalk.white("/multi")),console.log()):(console.log(),console.log(chalk.gray(` Conversation #${f} closed — ${x} turn${1===x?"":"s"}, ${w.toLocaleString()} tokens in the window at close.`)),f+=1,p=[],w=h(g),x=0,S.clear(),console.log(chalk.green.bold(` ✦ Conversation #${f} started — context window is fresh.`)),console.log(chalk.gray(" Carry over a 3–5 line summary of where you were, not the whole history.")),console.log()),"continue";if("/multi"===n||"/sandbox"===n)return A?(A=!1,p=[],w=h(g),x=0,S.clear(),console.log(),console.log(chalk.yellow(" ⚠ Multi-turn SANDBOX — this is NOT the contest.")),console.log(chalk.gray(" The official chatbox is single-turn. Use this to explore how a context")),console.log(chalk.gray(` window (${c.toLocaleString()} tokens) fills, degrades, and dies. `)+chalk.white("/single")+chalk.gray(" returns to the rules.")),console.log(),"continue"):(console.log(chalk.gray(" Already in the multi-turn sandbox. Back to contest rules: ")+chalk.white("/single")),"continue");if("/single"===n||"/contest"===n)return A?(console.log(chalk.gray(" Already in official single-turn mode.")),"continue"):(A=!0,p=[],x=0,S.clear(),console.log(),console.log(chalk.green(" ✓ Back to official contest rules — single-turn, ≤2,000 chars in, ≤1,000 tokens out.")),console.log(),"continue");if("/rules"===n||"rules"===n)return console.log(),console.log(chalk.bold.white(" ═══ Official chatbox rules — Technical Appendix (rev. 2026-07) ═══")),console.log(),console.log(chalk.white(` Model: ${a}`)+chalk.gray(' (the appendix names it "Gemma E4B")')),console.log(chalk.white(" Message: ≤ 2,000 characters")+chalk.gray(" (~350 words) — enforced here")),console.log(chalk.white(" Reply: ≤ 1,000 tokens")+chalk.gray(" (~750 words) — long answers truncate")),console.log(chalk.white(" Memory: NONE")+chalk.gray(" — single-turn; every send starts from zero")),console.log(),console.log(chalk.gray(" What works in this trainer works onsite — the limits are identical.")),console.log(),"continue";if("/ctx"===n||"ctx"===n||"/context"===n)return function(){if(A)return console.log(),console.log(chalk.bold.white(" ═══ Session — official single-turn mode ═══")),console.log(),console.log(chalk.gray(" Messages sent: ")+chalk.white(String(k))+chalk.gray(" · blocked over 2,000 chars: ")+chalk.white(String(v))),console.log(chalk.gray(" Last message: ")+chalk.white(`${I.toLocaleString()}/2,000 chars`)+chalk.gray(" · last reply: ")+chalk.white(`≈${$.toLocaleString()}/1,000 tokens`)),console.log(chalk.gray(" Billed this session: ")+chalk.white(`${O.toLocaleString()} tokens`)),console.log(),console.log(chalk.bold.white(" Contest strategy (you are the memory):")),console.log(chalk.white(" 1. ")+chalk.gray("Every message self-contained: rules header + material + ONE question.")),console.log(chalk.white(" 2. ")+chalk.gray('Iterate by EDITING and resending the whole prompt — there is no "fixing" a chat.')),console.log(chalk.white(" 3. ")+chalk.gray("Long material? Chunk it ≤2,000 chars per message, collect quotes, then reduce.")),void console.log();console.log(),console.log(chalk.bold.white(" ═══ Context usage — multi-turn SANDBOX (off-spec) ═══")),console.log(),L(),console.log(chalk.gray(" Peak this session: ")+chalk.white(`${b.toLocaleString()} tokens`)+chalk.gray(" · conversations used: ")+chalk.white(String(f))),console.log(chalk.gray(" Billed this session: ")+chalk.white(`${O.toLocaleString()} tokens`)+chalk.gray(" — every request re-sends the whole conversation, so provider")),console.log(chalk.gray(" dashboards count far more than the window gauge above. Both are correct.")),console.log(),console.log(chalk.yellow(" Reminder: the official contest chatbox is SINGLE-TURN — ")+chalk.white("/single")),console.log(chalk.gray(" returns to contest rules. This sandbox exists for window experiments only.")),console.log()}(),"continue";if("/help"===n||"help"===n)return console.log(),console.log(chalk.white(" <just type> ")+chalk.gray("ask the AI (each message stands alone)")),console.log(chalk.white(" /rules ")+chalk.gray("the official chatbox limits")),console.log(chalk.white(" /ctx ")+chalk.gray("session stats + contest strategy")),console.log(chalk.white(" /multi ")+chalk.gray("multi-turn sandbox (off-spec) — /single returns")),A||console.log(chalk.white(" /new ")+chalk.gray("new sandbox conversation (context resets)")),console.log(chalk.white(" exit ")+chalk.gray("leave")),console.log(),"continue";if(A&&o.length>2e3)return v+=1,console.log(),console.log(chalk.red.bold(` ■ ${o.length.toLocaleString()} characters — over the contest cap of ${2e3.toLocaleString()}/message.`)),console.log(chalk.white(" The onsite chatbox will refuse this too. Make it fit:")),console.log(chalk.gray(" · cut boilerplate — keep rules header + material + ONE question")),console.log(chalk.gray(" · long material? split into self-contained chunk messages, collect quotes")),console.log(chalk.gray(" · point at the 20 relevant lines, never the whole file")),console.log(),"continue";if(!A&&w>=28768)return console.log(),console.log(chalk.red.bold(" ■ Context window exhausted.")),console.log(chalk.white(" A prompt plus a full answer no longer fit — this conversation is over.")),console.log(chalk.gray(" Start fresh: ")+chalk.bold.white("/new")),console.log(),"continue";console.log(chalk.gray(" Thinking..."));try{const{text:e,windowTokens:n}="openai"===u?await async function(e){const o=[{role:"system",content:g},...T(e).map(e=>({role:"model"===e.role?"assistant":"user",content:e.text}))],t=await fetch(`${d}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`,"HTTP-Referer":"https://icoa2026.au","X-Title":"ICOA AI4IOAI"},body:JSON.stringify({model:m,messages:o,max_tokens:1e3}),signal:AbortSignal.timeout(6e4)});if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(`HTTP ${t.status}${e?`: ${e.slice(0,200)}`:""}`)}const n=await t.json(),s=n.choices?.[0]?.message?.content??"",l=n.usage;return{text:s,windowTokens:null!=l?.prompt_tokens?l.prompt_tokens+(l.completion_tokens??0):null}}(o):await async function(e){const o=t().deviceFingerprint||"",n=await fetch(`${d}/api/icoa/ai/ioai`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"icoa-cli-ai4ioai","X-Device-Fingerprint":o},body:JSON.stringify({systemPrompt:g,messages:T(e),maxTokens:1e3,deviceFingerprint:o}),signal:AbortSignal.timeout(6e4)}),s=await n.json().catch(()=>null);if(!n.ok||!s?.success)throw new Error(s?.message||`HTTP ${n.status}`);return{text:s.data?.text??"",windowTokens:"number"==typeof s.data?.tokensUsed?s.data.tokensUsed:null}}(o);if(process.stdout.write("[1A[2K"),k+=1,A)return I=o.length,$=h(e),O+=n??h(o)+$,console.log(),l(e),console.log(chalk.gray(` · single-turn: window cleared · msg ${I.toLocaleString()}/2,000 chars · reply ≈${$.toLocaleString()}/1,000 tokens ·`)),console.log(),"continue";p.push({role:"user",parts:[{text:o}]}),p.push({role:"model",parts:[{text:e}]}),x+=1,w=n??w+h(o)+h(e),w>b&&(b=w),O+=n??w,console.log(),l(e),L(),function(){const e=w/c*100;e>=95&&!S.has("95")?(S.add("95"),console.log(),console.log(chalk.red.bold(" ⚠ 95% — the window is nearly spent. Maybe 1–2 turns left.")),console.log(chalk.red(" Restart NOW: ")+chalk.bold.white("/new")+chalk.red(" and re-state only the essentials (goal · current approach · last error)."))):e>=80&&!S.has("80")?(S.add("80"),console.log(),console.log(chalk.yellow(" ⚠ 80% of the context window used — answers degrade from here.")),console.log(chalk.gray(" Wrap up this sub-problem, then ")+chalk.white("/new")+chalk.gray('. Tip: first ask the AI to "summarize what we established in 5 bullets" and carry that.'))):e>=50&&!S.has("50")&&(S.add("50"),console.log(),console.log(chalk.gray(" Note: half the sandbox window is gone. Budget it — one sub-problem per conversation.")))}(),console.log()}catch(e){process.stdout.write("[1A[2K");const o=e instanceof Error?e.message:String(e);if(!A&&/token|exceeds|too long|400/i.test(o)&&w>16384)console.log(),console.log(chalk.red.bold(" ■ The API rejected the conversation — the context window is spent.")),console.log(chalk.gray(" Start fresh: ")+chalk.bold.white("/new")),console.log();else{console.log(),console.log(chalk.red.bold(` ✗ AI request failed: ${o.split("\n")[0]}`));const e=d.replace(/^https?:\/\//,"");console.log(chalk.gray(` backend: ${"proxy"===u?`ICOA server (${e})`:e}`)),/timeout|ENOTFOUND|ECONNREFUSED|fetch failed|network/i.test(o)?console.log(chalk.gray(" Looks like a network issue (proxy / firewall / offline?).")):"proxy"===u&&/\b(502|503)\b/.test(o)?console.log(chalk.gray(" The ICOA server could not reach the model — try again shortly.")):"openai"===u&&/\b40[123]\b|unauthor|credit|payment/i.test(o)&&console.log(chalk.gray(" Looks like a key / credit issue — check the endpoint key and its balance/limit.")),console.log(chalk.gray(" You are still in the chat — try again, or type ")+chalk.white("exit")+chalk.gray(".")),console.log()}}return"continue"}export async function runAi4ioaiStandalone(){if(!await startAi4ioaiChat())return;const t=n(),s=null!==t,l=s?t.listeners("line").slice():[];s&&t.removeAllListeners("line");const i=s?t:o({input:process.stdin,output:process.stdout,terminal:!0}),a=s?i.prompt:null;s&&(i.prompt=e.prototype.prompt);const c=()=>{i.setPrompt(chalk.bold.green(`icoa ${ai4ioaiPromptLabel()}> `)),i.prompt()};return new Promise(e=>{const o=t=>{handleAi4ioaiMessage(t.trim()).then(t=>{"exit"===t?((()=>{if(i.removeListener("line",o),s){a&&(i.prompt=a);for(const e of l)i.on("line",e)}else i.close()})(),e()):c()}).catch(e=>{r(`AI error: ${e instanceof Error?e.message:String(e)}`),c()})};i.on("line",o),c()})}
|
|
1
|
+
import{Interface as e,createInterface as o}from"node:readline";import chalk from"chalk";import{getConfig as t}from"../lib/config.js";import{getMainRl as n}from"../lib/main-rl.js";import{logCommand as s}from"../lib/logger.js";import{printMarkdownYellow as l,printError as r}from"../lib/ui.js";const i="google/gemma-3n-e4b-it",a="Gemma 3n E4B",c=32768,g='You are Gemma 3n E4B ("google/gemma-3n-e4b-it"), the exact model named for the IOAI onsite contest chatbox. If asked which model you are, answer "Gemma 3n E4B" — never claim to be any other variant; your training data predates your own release, so trust this note over your intuition. You are an AI assistant for a contestant training for IOAI (the International Olympiad in Artificial Intelligence). Help with machine learning concepts, classic algorithms, model debugging, Python (numpy/pandas/sklearn/pytorch at small scale), and the math behind them. Be concise and practical; prefer worked examples over lectures. If a question is ambiguous, ask one clarifying question instead of guessing.';function h(e){return Math.ceil(e.length/4)}let u=null,d="",y="",m=i,p=[],w=0,f=1,x=0,b=0,k=0,A=!0,I=0,v=0,$=0,O=0;const S=new Set;function T(e){return[...p.map(e=>({role:e.role,text:e.parts.map(e=>e.text).join("")})),{role:"user",text:e}]}export function ai4ioaiPromptLabel(){return"proxy"===u||/gemma-?3/i.test(m)?"gemma3":"ai4ioai"}function L(){const e=Math.min(Math.round(w/c*100),100),o=Math.round(e/100*20),t=e>=80?chalk.red:e>=50?chalk.yellow:chalk.green;console.log(chalk.gray(" Context ")+t("█".repeat(o))+chalk.gray("░".repeat(20-o))+chalk.gray(` ${w.toLocaleString()}/${c.toLocaleString()} tokens (${e}%) · conversation #${f}, ${x} turn${1===x?"":"s"} · exit to leave`))}export async function startAi4ioaiChat(){s("ai4ioai");const e=t();u=null;const o=process.env.ICOA_AI4IOAI_ENDPOINT||e.ai4ioaiEndpoint||"",n=process.env.ICOA_AI4IOAI_API_KEY||e.ai4ioaiApiKey||"";return o&&n?(d=o.replace(/\/+$/,""),y=n,m=process.env.ICOA_AI4IOAI_MODEL||e.ai4ioaiModel||i,u="openai"):(d=(process.env.ICOA_AI4IOAI_PROXY||"https://practice.icoa2026.au").replace(/\/+$/,""),m=i,u="proxy"),p=[],w=h(g),f=1,x=0,k=0,b=0,O=0,A=!0,I=0,v=0,$=0,S.clear(),console.log(),console.log(chalk.bold.green(" ═══ AI4IOAI — contest chatbox simulator (official rules) ═══")),console.log(),console.log(chalk.white(" The revised Technical Appendix (2026-07) fixes the main-contest")),console.log(chalk.white(" chatbox: Gemma E4B, single-turn, tight caps. This trainer enforces")),console.log(chalk.white(" the exact same limits — what works here works onsite.")),console.log(),console.log(chalk.cyan(" ┌─────────────────────────────────────────────")),console.log(chalk.cyan(" │ ")+chalk.bold.white("The official chatbox rules")),console.log(chalk.cyan(" │")),console.log(chalk.cyan(" │ ")+chalk.gray("Your message: ≤ 2,000 characters (~350 words)")),console.log(chalk.cyan(" │ ")+chalk.gray("Its reply: ≤ 1,000 tokens (~750 words)")),console.log(chalk.cyan(" │ ")+chalk.gray("Memory: NONE — every message starts from zero.")),console.log(chalk.cyan(" │ ")+chalk.gray("Nothing you said before exists. You are the memory.")),console.log(chalk.cyan(" └─────────────────────────────────────────────")),console.log(),console.log(chalk.yellow(" Commands")),console.log(chalk.white(" <just type> ")+chalk.gray("Ask the AI — each message is a fresh, complete world")),console.log(chalk.white(" /rules ")+chalk.gray("The official chatbox limits")),console.log(chalk.white(" /ctx ")+chalk.gray("Session stats + contest strategy")),console.log(chalk.white(" /multi ")+chalk.gray("Multi-turn sandbox (off-spec window experiments)")),console.log(chalk.white(" exit ")+chalk.gray("Leave")),console.log(),console.log(chalk.yellowBright(` Model: ${a} · connected · single-turn · ≤2,000 chars in / ≤1,000 tokens out`)),console.log(chalk.yellowBright(` (Real ${a} — the exact chatbox model named in the IOAI Technical Appendix.)`)),console.log(),!0}export async function handleAi4ioaiMessage(e){if(!u)return"exit";s(`ai4ioai: ${e}`);const o=e.trim(),n=o.toLowerCase();if("exit"===n||"quit"===n||"back"===n||"q"===n||"menu"===n)return u=null,console.log(),console.log(chalk.gray(" ─────────────────────────────────────────")),console.log(chalk.white(" AI4IOAI session ended.")),A?(console.log(chalk.gray(` Messages: ${k} · blocked over 2,000 chars: ${$} · billed: ${O.toLocaleString()} tokens`)),console.log(chalk.gray(" The real chatbox forgets between messages — the discipline you just practiced is the tool."))):(console.log(chalk.gray(` Conversations: ${f} · total turns: ${k} · peak context: ${b.toLocaleString()} tokens (${Math.round(b/c*100)}% of window)`)),console.log(chalk.gray(" Reminder: the official contest chatbox is single-turn — the sandbox gauge does not exist there."))),console.log(chalk.gray(" ─────────────────────────────────────────")),console.log(),"exit";if("/new"===n||"new"===n||"/clear"===n||"clear"===n||"/restart"===n)return A?(console.log(),console.log(chalk.gray(" Single-turn mode — every message already starts fresh (official contest behavior).")),console.log(chalk.gray(" Multi-turn sandbox: ")+chalk.white("/multi")),console.log()):(console.log(),console.log(chalk.gray(` Conversation #${f} closed — ${x} turn${1===x?"":"s"}, ${w.toLocaleString()} tokens in the window at close.`)),f+=1,p=[],w=h(g),x=0,S.clear(),console.log(chalk.green.bold(` ✦ Conversation #${f} started — context window is fresh.`)),console.log(chalk.gray(" Carry over a 3–5 line summary of where you were, not the whole history.")),console.log()),"continue";if("/multi"===n||"/sandbox"===n)return A?(A=!1,p=[],w=h(g),x=0,S.clear(),console.log(),console.log(chalk.yellow(" ⚠ Multi-turn SANDBOX — this is NOT the contest.")),console.log(chalk.gray(" The official chatbox is single-turn. Use this to explore how a context")),console.log(chalk.gray(` window (${c.toLocaleString()} tokens) fills, degrades, and dies. `)+chalk.white("/single")+chalk.gray(" returns to the rules.")),console.log(),"continue"):(console.log(chalk.gray(" Already in the multi-turn sandbox. Back to contest rules: ")+chalk.white("/single")),"continue");if("/single"===n||"/contest"===n)return A?(console.log(chalk.gray(" Already in official single-turn mode.")),"continue"):(A=!0,p=[],x=0,S.clear(),console.log(),console.log(chalk.green(" ✓ Back to official contest rules — single-turn, ≤2,000 chars in, ≤1,000 tokens out.")),console.log(),"continue");if("/rules"===n||"rules"===n)return console.log(),console.log(chalk.bold.white(" ═══ Official chatbox rules — Technical Appendix (rev. 2026-07) ═══")),console.log(),console.log(chalk.white(` Model: ${a}`)+chalk.gray(' (the appendix names it "Gemma E4B")')),console.log(chalk.white(" Message: ≤ 2,000 characters")+chalk.gray(" (~350 words) — enforced here")),console.log(chalk.white(" Reply: ≤ 1,000 tokens")+chalk.gray(" (~750 words) — long answers truncate")),console.log(chalk.white(" Memory: NONE")+chalk.gray(" — single-turn; every send starts from zero")),console.log(),console.log(chalk.gray(" What works in this trainer works onsite — the limits are identical.")),console.log(),"continue";if("/ctx"===n||"ctx"===n||"/context"===n)return function(){if(A)return console.log(),console.log(chalk.bold.white(" ═══ Session — official single-turn mode ═══")),console.log(),console.log(chalk.gray(" Messages sent: ")+chalk.white(String(k))+chalk.gray(" · blocked over 2,000 chars: ")+chalk.white(String($))),console.log(chalk.gray(" Last message: ")+chalk.white(`${I.toLocaleString()}/2,000 chars`)+chalk.gray(" · last reply: ")+chalk.white(`≈${v.toLocaleString()}/1,000 tokens`)),console.log(chalk.gray(" Billed this session: ")+chalk.white(`${O.toLocaleString()} tokens`)),console.log(),console.log(chalk.bold.white(" Contest strategy (you are the memory):")),console.log(chalk.white(" 1. ")+chalk.gray("Every message self-contained: rules header + material + ONE question.")),console.log(chalk.white(" 2. ")+chalk.gray('Iterate by EDITING and resending the whole prompt — there is no "fixing" a chat.')),console.log(chalk.white(" 3. ")+chalk.gray("Long material? Chunk it ≤2,000 chars per message, collect quotes, then reduce.")),void console.log();console.log(),console.log(chalk.bold.white(" ═══ Context usage — multi-turn SANDBOX (off-spec) ═══")),console.log(),L(),console.log(chalk.gray(" Peak this session: ")+chalk.white(`${b.toLocaleString()} tokens`)+chalk.gray(" · conversations used: ")+chalk.white(String(f))),console.log(chalk.gray(" Billed this session: ")+chalk.white(`${O.toLocaleString()} tokens`)+chalk.gray(" — every request re-sends the whole conversation, so provider")),console.log(chalk.gray(" dashboards count far more than the window gauge above. Both are correct.")),console.log(),console.log(chalk.yellow(" Reminder: the official contest chatbox is SINGLE-TURN — ")+chalk.white("/single")),console.log(chalk.gray(" returns to contest rules. This sandbox exists for window experiments only.")),console.log()}(),"continue";if("/help"===n||"help"===n)return console.log(),console.log(chalk.white(" <just type> ")+chalk.gray("ask the AI (each message stands alone)")),console.log(chalk.white(" /rules ")+chalk.gray("the official chatbox limits")),console.log(chalk.white(" /ctx ")+chalk.gray("session stats + contest strategy")),console.log(chalk.white(" /multi ")+chalk.gray("multi-turn sandbox (off-spec) — /single returns")),A||console.log(chalk.white(" /new ")+chalk.gray("new sandbox conversation (context resets)")),console.log(chalk.white(" exit ")+chalk.gray("leave")),console.log(),"continue";if(A&&o.length>2e3)return $+=1,console.log(),console.log(chalk.red.bold(` ■ ${o.length.toLocaleString()} characters — over the contest cap of ${2e3.toLocaleString()}/message.`)),console.log(chalk.white(" The onsite chatbox will refuse this too. Make it fit:")),console.log(chalk.gray(" · cut boilerplate — keep rules header + material + ONE question")),console.log(chalk.gray(" · long material? split into self-contained chunk messages, collect quotes")),console.log(chalk.gray(" · point at the 20 relevant lines, never the whole file")),console.log(),"continue";if(!A&&w>=28768)return console.log(),console.log(chalk.red.bold(" ■ Context window exhausted.")),console.log(chalk.white(" A prompt plus a full answer no longer fit — this conversation is over.")),console.log(chalk.gray(" Start fresh: ")+chalk.bold.white("/new")),console.log(),"continue";console.log(chalk.gray(" Thinking..."));try{const{text:e,windowTokens:n}="openai"===u?await async function(e){const o=[{role:"system",content:g},...T(e).map(e=>({role:"model"===e.role?"assistant":"user",content:e.text}))],t=await fetch(`${d}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`,"HTTP-Referer":"https://icoa2026.au","X-Title":"ICOA AI4IOAI"},body:JSON.stringify({model:m,messages:o,max_tokens:1e3}),signal:AbortSignal.timeout(6e4)});if(!t.ok){const e=await t.text().catch(()=>"");throw new Error(`HTTP ${t.status}${e?`: ${e.slice(0,200)}`:""}`)}const n=await t.json(),s=n.choices?.[0]?.message?.content??"",l=n.usage;return{text:s,windowTokens:null!=l?.prompt_tokens?l.prompt_tokens+(l.completion_tokens??0):null}}(o):await async function(e){const o=t().deviceFingerprint||"",n=await fetch(`${d}/api/icoa/ai/ioai`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"icoa-cli-ai4ioai","X-Device-Fingerprint":o},body:JSON.stringify({systemPrompt:g,messages:T(e),maxTokens:1e3,deviceFingerprint:o}),signal:AbortSignal.timeout(6e4)}),s=await n.json().catch(()=>null);if(!n.ok||!s?.success)throw new Error(s?.message||`HTTP ${n.status}`);return{text:s.data?.text??"",windowTokens:"number"==typeof s.data?.tokensUsed?s.data.tokensUsed:null}}(o);if(process.stdout.write("[1A[2K"),k+=1,A)return I=o.length,v=h(e),O+=n??h(o)+v,console.log(),l(e),console.log(chalk.gray(` · single-turn: window cleared · msg ${I.toLocaleString()}/2,000 chars · reply ≈${v.toLocaleString()}/1,000 tokens ·`)),console.log(),"continue";p.push({role:"user",parts:[{text:o}]}),p.push({role:"model",parts:[{text:e}]}),x+=1,w=n??w+h(o)+h(e),w>b&&(b=w),O+=n??w,console.log(),l(e),L(),function(){const e=w/c*100;e>=95&&!S.has("95")?(S.add("95"),console.log(),console.log(chalk.red.bold(" ⚠ 95% — the window is nearly spent. Maybe 1–2 turns left.")),console.log(chalk.red(" Restart NOW: ")+chalk.bold.white("/new")+chalk.red(" and re-state only the essentials (goal · current approach · last error)."))):e>=80&&!S.has("80")?(S.add("80"),console.log(),console.log(chalk.yellow(" ⚠ 80% of the context window used — answers degrade from here.")),console.log(chalk.gray(" Wrap up this sub-problem, then ")+chalk.white("/new")+chalk.gray('. Tip: first ask the AI to "summarize what we established in 5 bullets" and carry that.'))):e>=50&&!S.has("50")&&(S.add("50"),console.log(),console.log(chalk.gray(" Note: half the sandbox window is gone. Budget it — one sub-problem per conversation.")))}(),console.log()}catch(e){process.stdout.write("[1A[2K");const o=e instanceof Error?e.message:String(e);if(!A&&/token|exceeds|too long|400/i.test(o)&&w>16384)console.log(),console.log(chalk.red.bold(" ■ The API rejected the conversation — the context window is spent.")),console.log(chalk.gray(" Start fresh: ")+chalk.bold.white("/new")),console.log();else{console.log(),console.log(chalk.red.bold(` ✗ AI request failed: ${o.split("\n")[0]}`));const e=d.replace(/^https?:\/\//,"");console.log(chalk.gray(` backend: ${"proxy"===u?`ICOA server (${e})`:e}`)),/timeout|ENOTFOUND|ECONNREFUSED|fetch failed|network/i.test(o)?console.log(chalk.gray(" Looks like a network issue (proxy / firewall / offline?).")):"proxy"===u&&/\b(502|503)\b/.test(o)?console.log(chalk.gray(" The ICOA server could not reach the model — try again shortly.")):"openai"===u&&/\b40[123]\b|unauthor|credit|payment/i.test(o)&&console.log(chalk.gray(" Looks like a key / credit issue — check the endpoint key and its balance/limit.")),console.log(chalk.gray(" You are still in the chat — try again, or type ")+chalk.white("exit")+chalk.gray(".")),console.log()}}return"continue"}export async function runAi4ioaiStandalone(){if(!await startAi4ioaiChat())return;const t=n(),s=null!==t,l=s?t.listeners("line").slice():[];s&&t.removeAllListeners("line");const i=s?t:o({input:process.stdin,output:process.stdout,terminal:!0}),a=s?i.prompt:null;s&&(i.prompt=e.prototype.prompt);const c=()=>{i.setPrompt(chalk.bold.green(`icoa ${ai4ioaiPromptLabel()}> `)),i.prompt()};return new Promise(e=>{const o=t=>{handleAi4ioaiMessage(t.trim()).then(t=>{"exit"===t?((()=>{if(i.removeListener("line",o),s){a&&(i.prompt=a);for(const e of l)i.on("line",e)}else i.close()})(),e()):c()}).catch(e=>{r(`AI error: ${e instanceof Error?e.message:String(e)}`),c()})};i.on("line",o),c()})}
|
package/dist/commands/arena.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as e,mkdirSync as o,readFileSync as t,writeFileSync as a}from"node:fs";import{homedir as r}from"node:os";import{join as n}from"node:path";import chalk from"chalk";import{runArenaEai as i}from"./arena-eai.js";import{buildSubmitPayload as s}from"../lib/arena-submit.js";import{makeReplAsker as l}from"../lib/repl-asker.js";import{loadCurriculumById as c}from"../lib/learn-curricula.js";import{deltaLine as d}from"../lib/board-render.js";const g=["ioai","iaio","ai4sci","ai4quant","ctf4ai"],p="ioai";export function resolveTrackAndTask(e,o){return e?o?{track:e,task:o}:g.includes(e)?{track:e}:{track:p,task:e}:{track:p}}function y(){if(process.env.ICOA_ARENA_SERVER)return process.env.ICOA_ARENA_SERVER.replace(/\/$/,"");try{const e=JSON.parse(t(n(r(),".icoa","config.json"),"utf-8"));if("string"==typeof e.arenaServer&&e.arenaServer)return e.arenaServer.replace(/\/$/,"");if("string"==typeof e.ctfdUrl&&e.ctfdUrl)return e.ctfdUrl.replace(/\/$/,"")}catch{}return"https://practice.icoa2026.au"}async function u(e,o){try{const t=await fetch(y()+e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),signal:AbortSignal.timeout(15e3)});return await t.json()}catch{return null}}async function m(e){try{const o=await fetch(y()+e,{signal:AbortSignal.timeout(15e3)});return await o.json()}catch{return null}}function f(e,o,t){const a=Math.max(0,Math.min(40,Math.round(e/t*40))),r=Math.round(o/t*40);let n="";for(let e=0;e<40;e++)n+=e===r?chalk.bold.yellow("┃"):e<a?chalk.green("█"):chalk.gray("░");return n}function h(){console.log(),console.log(chalk.yellow(" The arena server is not reachable right now.")),console.log(chalk.gray(" Check your connection, or try again later.")),console.log()}export async function runArena(r,i){const g=function(e){return`${e}-frontier`}(r),p=l(),y=async e=>await p.ask(e)??"";try{console.log(),console.log(chalk.bold.cyan(` 🏟 ${r.toUpperCase()} SELECTION ARENA`)+chalk.gray(" · compete · climb the board")),console.log(chalk.gray(" Real olympiad ML tasks. Build a model, submit predictions — graded vs a hidden set.")),console.log(),console.log(chalk.white(` Entry is gated behind ${r}-360 mastery (≥320/360).`));const l=(await y(chalk.cyan(` Your completed ${r}-360 token (or blank for panda PIN): `))).trim();let p="";l||(p=(await y(chalk.cyan(" panda exemption PIN: "))).trim());const b=await u("/api/icoa/arena/unlock",{token_360:l||void 0,pin:p||void 0});if(!b)return h();const k=b.data??b;if(!k.eligible){const e="number"==typeof k.score_360?k.score_360:0;return console.log(),console.log(chalk.gray(` ${r}-360: `)+f(e,320,360)),console.log(chalk.gray(" you: ")+chalk.bold.red(`${e}/360`)+chalk.gray(" need: ")+chalk.bold.yellow("320/360")),console.log(),console.log(chalk.yellow(` Not yet — keep going on ${r}-360, or enter the panda PIN.`)),void console.log()}const _=String(k.arena_token||""),w="number"==typeof k.score_360?k.score_360:320;console.log(),console.log(chalk.gray(` ${r}-360: `)+f(w,320,360)),k.via_pin?console.log(chalk.bold.magenta(" ⚑ panda override — welcome in.")):console.log(chalk.bold.green(` ✓ ${w}/360 — you have potential. Welcome to the arena.`)),console.log(chalk.gray(" arena token: ")+chalk.white(_)),console.log();const v=await c(g),$=(v?.cards??[]).filter(e=>"arena_task"===e.type);if(0===$.length)return void console.log(chalk.yellow(` No live arena tasks for ${r} yet — check back soon.`));let A=i?$.find(e=>e.task_id===i):void 0;if(!A){console.log(chalk.white(" Live tasks:")),$.forEach((e,o)=>{console.log(chalk.gray(` ${o+1}. `)+chalk.cyan(e.task_id)+chalk.gray(` — ${e.title}`))});const e=(await y(chalk.cyan(" Pick a task (number or id): "))).trim(),o=Number(e);A=!Number.isNaN(o)&&$[o-1]||$.find(o=>o.task_id===e)||void 0}if(!A)return void console.log(chalk.yellow(" No such task."));const E=A.task_id;console.log(),console.log(chalk.bold.white(` ${A.title}`)+chalk.gray(` · ${A.metric}`)),console.log(),console.log(chalk.gray(" Optional — call your approach in 1–2 lines before you see the data")),console.log(chalk.gray(" (locked once, just for the record). Press enter to skip."));const S=(await y(chalk.cyan(" approach > "))).trim(),N=[S,S?(await y(chalk.cyan(" approach > "))).trim():""].filter(Boolean).join("\n");if(N){const e=await u(`/api/icoa/arena/${E}/guess`,{arena_token:_,guess:N}),o=e?.data??e;o?.ok?console.log(chalk.green(" ✓ guess locked.")):"already_set"===o?.reason&&console.log(chalk.gray(" (guess already locked earlier.)"))}console.log(),console.log(chalk.white(" Data:"));const L=await m(`/api/icoa/arena/${E}/data`),O=L?.data??L;if(O?.public_train&&O?.public_test){const e=n(process.cwd(),"icoa-arena",E),t=n(e,"public_train.csv"),r=n(e,"public_test.csv");try{o(e,{recursive:!0}),a(t,O.public_train),a(r,O.public_test);const i=O.meta??{},s="number"==typeof i.n_train?i.n_train:"?",l="number"==typeof i.n_test?i.n_test:"?",c="string"==typeof i.metric?i.metric:A.metric,d=n(e,"solve_template.py");a(d,function(e,o){const t=/rmse|mse|mae|error/i.test(o);return["# %% setup — data loading (leave as is)","# ICOA Selection Arena — starter. Open: icoa ipynb solve_template.py (fill the MODEL cell, run all)","# It self-checks your score, then writes predictions.csv next to the data.","import pandas as pd","from sklearn.model_selection import train_test_split",t?"from sklearn.metrics import mean_squared_error":"from sklearn.metrics import accuracy_score","",`DIR = r"${e}"`,'train = pd.read_csv(DIR + "/public_train.csv")','test = pd.read_csv(DIR + "/public_test.csv")','features = [c for c in train.columns if c not in ("id", "target")]','X, y = train[features], train["target"]',"X_test = test[features]","X_tr, X_val, y_tr, y_val = train_test_split(X, y, test_size=0.2, random_state=0)","","# %% MODEL — this is the judged part","# ================ YOUR MODEL HERE (this is what is judged) ================","# Does this task need StandardScaler? a neural net (MLPClassifier)? a tree?","# or is something simple enough? Build ONE scikit-learn model:","# from sklearn.linear_model import LogisticRegression","# model = LogisticRegression(max_iter=2000)","model = ... # <-- replace ... with your model","# =========================================================================","","# %% validate","model.fit(X_tr, y_tr)",t?'print("val RMSE:", round(mean_squared_error(y_val, model.predict(X_val)) ** 0.5, 4))':'print("val accuracy:", round(accuracy_score(y_val, model.predict(X_val)), 4))',"","# %% submit — writes predictions.csv","model.fit(X, y) # retrain on ALL data for the real submission","pred = model.predict(X_test)",'out = DIR + "/predictions.csv"','pd.DataFrame({"id": test["id"], "target": pred}).to_csv(out, index=False)','print("wrote", out, "-- paste THIS path back in arena to submit.")',""].join("\n")}(e,c)),console.log(chalk.green(" ✓ train: ")+chalk.white(t)+chalk.gray(` (${s} rows, has target)`)),console.log(chalk.green(" ✓ test: ")+chalk.white(r)+chalk.gray(` (${l} rows, predict these)`)),console.log(chalk.green(" ✓ starter: ")+chalk.white(d)+chalk.gray(" (fill in the MODEL cell, run it)")),console.log(chalk.gray(` id: ${i.id_col??"id"} · target: ${i.target_col??"target"} · metric: ${c}`)),console.log(),console.log(chalk.bold.white(" Your move — 3 steps to get on the board:")),console.log(chalk.gray(" 1. ")+chalk.bold.cyan("icoa ipynb solve_template.py")+chalk.gray(" → edit only the MODEL cell (edit 2), then run all")),console.log(chalk.gray(" 2. it self-checks your score and writes ")+chalk.white("predictions.csv")),console.log(chalk.gray(" 3. come back here and paste that path to submit"))}catch{console.log(chalk.yellow(" Could not write the data files here — check directory permissions."))}}else console.log(chalk.gray(" (no downloadable data package — use the baseline reference below.)"));if(A.baseline_ref){console.log(),console.log(chalk.white(" Baseline to beat:"));for(const e of A.baseline_ref.split("\n"))console.log(chalk.gray(` ${e}`))}for(console.log(),console.log(chalk.gray(" Optional hints a–e (logged — fewer hints reads as stronger). Enter to skip."));;){const e=(await y(chalk.cyan(" hint a-e (or enter to skip): "))).trim().toLowerCase();if(!e)break;if(!"abcde".includes(e)||1!==e.length){console.log(chalk.gray(" hints are a, b, c, d, or e."));continue}const o=await u(`/api/icoa/arena/${E}/hint`,{arena_token:_,level:e}),t=o?.data??o;t?.ok&&"string"==typeof t.hint?console.log(chalk.yellow(` hint ${e}: `)+chalk.white(t.hint)):console.log(chalk.gray(" (could not fetch that hint.)"))}for(console.log(),console.log(chalk.white(" Submit your predictions (")+chalk.gray(`${A.submission_format}`)+chalk.white("):")),console.log(chalk.gray(" • paste the path to the ")+chalk.white("predictions.csv")+chalk.gray(" the starter wrote (next to the data)")),console.log(chalk.gray(" • Colab/Kaggle users: a Google-Drive (link-viewable) share link also works")),console.log(chalk.gray(" 5 submissions — best score counts. Make them count."));;){const o=(await y(chalk.cyan(" predictions file path or drive link (enter to skip): "))).trim();if(!o)break;const a=s(o,_,{exists:e,read:e=>t(e,"utf-8")});"local"===a.source&&console.log(chalk.gray(" Uploading local predictions file…"));const r=await u(`/api/icoa/arena/${E}/submit`,a),n=r?.data??r;if(!n){h();break}if(!n.ok){if("locked"===n.reason){console.log(chalk.yellow(" Locked — you've used all 5 submissions."));break}console.log(chalk.yellow(" Submission rejected: ")+chalk.gray(String(n.reason||"error")));continue}const i=null==n.display_score?"n/a":`${Number(n.display_score).toFixed(1)}/100`;if(console.log(chalk.green(" ✓ scored: ")+chalk.bold.white(`${n.metric}=${Number(n.value).toFixed(4)}`)+chalk.gray(` (${i}) rank ${n.rank}/${n.field_size} · ${n.remaining} left`)),"prev_rank"in n){const e=d(n.prev_rank,n.rank_at_time??n.rank,n.field_size);e&&console.log(chalk.cyan(` ${e}`))}if(n.locked){console.log(chalk.gray(" That was your last submission — entry locked into the board."));break}}console.log();const R=await m(`/api/icoa/arena/${E}/leaderboard`),j=(R?.data??R)?.leaderboard??(Array.isArray(R?.leaderboard)?R.leaderboard:[]);if(Array.isArray(j)&&j.length){console.log(chalk.bold.white(" Leaderboard (anonymous):"));for(const e of j.slice(0,20))console.log(chalk.gray(` #${e.rank} `)+chalk.cyan(String(e.pseudonym))+chalk.gray(" ")+chalk.white(String(e.value))+(null==e.display_score?"":chalk.gray(` (${e.display_score}/100)`)))}else console.log(chalk.gray(" Leaderboard is empty or unavailable."));console.log()}finally{p.close()}}export function registerArenaCommand(e){e.command("arena [track] [task]",{hidden:!0}).description("Arena (<track>-frontier) — gated hands-on olympiad tasks with a server-graded leaderboard").action(async(e,o)=>{if("eai"===e)return void await i(o);const{track:t,task:a}=resolveTrackAndTask(e,o);await runArena(t,a)}),e.command("eai [task]").description("ctf4eai Embodied-AI Arena — red-team the robot policy and claim the flag").action(async e=>{await i(e)})}
|
|
1
|
+
import{existsSync as e,mkdirSync as o,readFileSync as a,writeFileSync as t}from"node:fs";import{homedir as r}from"node:os";import{join as n}from"node:path";import chalk from"chalk";import{runArenaEai as i}from"./arena-eai.js";import{buildSubmitPayload as s}from"../lib/arena-submit.js";import{makeReplAsker as l}from"../lib/repl-asker.js";import{loadCurriculumById as c}from"../lib/learn-curricula.js";import{deltaLine as d}from"../lib/board-render.js";const g=["ioai","iaio","ai4sci","ai4quant","ctf4ai"],p="ioai";export function resolveTrackAndTask(e,o){return e?o?{track:e,task:o}:g.includes(e)?{track:e}:{track:p,task:e}:{track:p}}function y(){if(process.env.ICOA_ARENA_SERVER)return process.env.ICOA_ARENA_SERVER.replace(/\/$/,"");try{const e=JSON.parse(a(n(r(),".icoa","config.json"),"utf-8"));if("string"==typeof e.arenaServer&&e.arenaServer)return e.arenaServer.replace(/\/$/,"");if("string"==typeof e.ctfdUrl&&e.ctfdUrl)return e.ctfdUrl.replace(/\/$/,"")}catch{}return"https://practice.icoa2026.au"}async function u(e,o){try{const a=await fetch(y()+e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),signal:AbortSignal.timeout(15e3)});return await a.json()}catch{return null}}async function m(e){try{const o=await fetch(y()+e,{signal:AbortSignal.timeout(15e3)});return await o.json()}catch{return null}}function h(e,o,a){const t=Math.max(0,Math.min(40,Math.round(e/a*40))),r=Math.round(o/a*40);let n="";for(let e=0;e<40;e++)n+=e===r?chalk.bold.yellow("┃"):e<t?chalk.green("█"):chalk.gray("░");return n}function f(){console.log(),console.log(chalk.yellow(" The arena server is not reachable right now.")),console.log(chalk.gray(" Check your connection, or try again later.")),console.log()}class b extends Error{}const k=new Set(["back","quit","exit","menu"]);export async function runArena(r,i){const g=function(e){return`${e}-frontier`}(r),p=l(),y=async e=>{const o=await p.ask(e)??"";if(k.has(o.trim().toLowerCase()))throw new b;return o};try{console.log(),console.log(chalk.bold.cyan(` 🏟 ${r.toUpperCase()} SELECTION ARENA`)+chalk.gray(" · compete · climb the board")),console.log(chalk.gray(" Real olympiad ML tasks. Build a model, submit predictions — graded vs a hidden set.")),console.log(),console.log(chalk.white(` Entry is gated behind ${r}-360 mastery (≥320/360).`));const l=(await y(chalk.cyan(` Your completed ${r}-360 token (or blank for panda PIN)`)+chalk.gray(" · back to leave")+chalk.cyan(": "))).trim();let p="";l||(p=(await y(chalk.cyan(" panda exemption PIN: "))).trim());const b=await u("/api/icoa/arena/unlock",{token_360:l||void 0,pin:p||void 0});if(!b)return f();const k=b.data??b;if(!k.eligible){const e="number"==typeof k.score_360?k.score_360:0;return console.log(),console.log(chalk.gray(` ${r}-360: `)+h(e,320,360)),console.log(chalk.gray(" you: ")+chalk.bold.red(`${e}/360`)+chalk.gray(" need: ")+chalk.bold.yellow("320/360")),console.log(),console.log(chalk.yellow(` Not yet — keep going on ${r}-360, or enter the panda PIN.`)),void console.log()}const _=String(k.arena_token||""),w="number"==typeof k.score_360?k.score_360:320;console.log(),console.log(chalk.gray(` ${r}-360: `)+h(w,320,360)),k.via_pin?console.log(chalk.bold.magenta(" ⚑ panda override — welcome in.")):console.log(chalk.bold.green(` ✓ ${w}/360 — you have potential. Welcome to the arena.`)),console.log(chalk.gray(" arena token: ")+chalk.white(_)),console.log();const v=await c(g),$=(v?.cards??[]).filter(e=>"arena_task"===e.type);if(0===$.length)return void console.log(chalk.yellow(` No live arena tasks for ${r} yet — check back soon.`));let A=i?$.find(e=>e.task_id===i):void 0;if(!A){console.log(chalk.white(" Live tasks:")),$.forEach((e,o)=>{console.log(chalk.gray(` ${o+1}. `)+chalk.cyan(e.task_id)+chalk.gray(` — ${e.title}`))});const e=(await y(chalk.cyan(" Pick a task (number or id)")+chalk.gray(" · back to leave")+chalk.cyan(": "))).trim(),o=Number(e);A=!Number.isNaN(o)&&$[o-1]||$.find(o=>o.task_id===e)||void 0}if(!A)return void console.log(chalk.yellow(" No such task."));const E=A.task_id;console.log(),console.log(chalk.bold.white(` ${A.title}`)+chalk.gray(` · ${A.metric}`)),console.log(),console.log(chalk.gray(" Optional — call your approach in 1–2 lines before you see the data")),console.log(chalk.gray(" (locked once, just for the record). Press enter to skip · back to leave."));const S=(await y(chalk.cyan(" approach > "))).trim(),L=[S,S?(await y(chalk.cyan(" approach > "))).trim():""].filter(Boolean).join("\n");if(L){const e=await u(`/api/icoa/arena/${E}/guess`,{arena_token:_,guess:L}),o=e?.data??e;o?.ok?console.log(chalk.green(" ✓ guess locked.")):"already_set"===o?.reason&&console.log(chalk.gray(" (guess already locked earlier.)"))}console.log(),console.log(chalk.white(" Data:"));const N=await m(`/api/icoa/arena/${E}/data`),O=N?.data??N;if(O?.public_train&&O?.public_test){const e=n(process.cwd(),"icoa-arena",E),a=n(e,"public_train.csv"),r=n(e,"public_test.csv");try{o(e,{recursive:!0}),t(a,O.public_train),t(r,O.public_test);const i=O.meta??{},s="number"==typeof i.n_train?i.n_train:"?",l="number"==typeof i.n_test?i.n_test:"?",c="string"==typeof i.metric?i.metric:A.metric,d=n(e,"solve_template.py");t(d,function(e,o){const a=/rmse|mse|mae|error/i.test(o);return["# %% setup — data loading (leave as is)","# ICOA Selection Arena — starter. Open: icoa ipynb solve_template.py (fill the MODEL cell, run all)","# It self-checks your score, then writes predictions.csv next to the data.","import pandas as pd","from sklearn.model_selection import train_test_split",a?"from sklearn.metrics import mean_squared_error":"from sklearn.metrics import accuracy_score","",`DIR = r"${e}"`,'train = pd.read_csv(DIR + "/public_train.csv")','test = pd.read_csv(DIR + "/public_test.csv")','features = [c for c in train.columns if c not in ("id", "target")]','X, y = train[features], train["target"]',"X_test = test[features]","X_tr, X_val, y_tr, y_val = train_test_split(X, y, test_size=0.2, random_state=0)","","# %% MODEL — this is the judged part","# ================ YOUR MODEL HERE (this is what is judged) ================","# Does this task need StandardScaler? a neural net (MLPClassifier)? a tree?","# or is something simple enough? Build ONE scikit-learn model:","# from sklearn.linear_model import LogisticRegression","# model = LogisticRegression(max_iter=2000)","model = ... # <-- replace ... with your model","# =========================================================================","","# %% validate","model.fit(X_tr, y_tr)",a?'print("val RMSE:", round(mean_squared_error(y_val, model.predict(X_val)) ** 0.5, 4))':'print("val accuracy:", round(accuracy_score(y_val, model.predict(X_val)), 4))',"","# %% submit — writes predictions.csv","model.fit(X, y) # retrain on ALL data for the real submission","pred = model.predict(X_test)",'out = DIR + "/predictions.csv"','pd.DataFrame({"id": test["id"], "target": pred}).to_csv(out, index=False)','print("wrote", out, "-- paste THIS path back in arena to submit.")',""].join("\n")}(e,c)),console.log(chalk.green(" ✓ train: ")+chalk.white(a)+chalk.gray(` (${s} rows, has target)`)),console.log(chalk.green(" ✓ test: ")+chalk.white(r)+chalk.gray(` (${l} rows, predict these)`)),console.log(chalk.green(" ✓ starter: ")+chalk.white(d)+chalk.gray(" (fill in the MODEL cell, run it)")),console.log(chalk.gray(` id: ${i.id_col??"id"} · target: ${i.target_col??"target"} · metric: ${c}`)),console.log(),console.log(chalk.bold.white(" Your move — 3 steps to get on the board:")),console.log(chalk.gray(" 1. ")+chalk.bold.cyan("icoa ipynb solve_template.py")+chalk.gray(" → edit only the MODEL cell (edit 2), then run all")),console.log(chalk.gray(" 2. it self-checks your score and writes ")+chalk.white("predictions.csv")),console.log(chalk.gray(" 3. come back here and paste that path to submit"))}catch{console.log(chalk.yellow(" Could not write the data files here — check directory permissions."))}}else console.log(chalk.gray(" (no downloadable data package — use the baseline reference below.)"));if(A.baseline_ref){console.log(),console.log(chalk.white(" Baseline to beat:"));for(const e of A.baseline_ref.split("\n"))console.log(chalk.gray(` ${e}`))}for(console.log(),console.log(chalk.gray(" Optional hints a–e (logged — fewer hints reads as stronger). Enter to skip."));;){const e=(await y(chalk.cyan(" hint a-e (or enter to skip): "))).trim().toLowerCase();if(!e)break;if(!"abcde".includes(e)||1!==e.length){console.log(chalk.gray(" hints are a, b, c, d, or e."));continue}const o=await u(`/api/icoa/arena/${E}/hint`,{arena_token:_,level:e}),a=o?.data??o;a?.ok&&"string"==typeof a.hint?console.log(chalk.yellow(` hint ${e}: `)+chalk.white(a.hint)):console.log(chalk.gray(" (could not fetch that hint.)"))}for(console.log(),console.log(chalk.white(" Submit your predictions (")+chalk.gray(`${A.submission_format}`)+chalk.white("):")),console.log(chalk.gray(" • paste the path to the ")+chalk.white("predictions.csv")+chalk.gray(" the starter wrote (next to the data)")),console.log(chalk.gray(" • Colab/Kaggle users: a Google-Drive (link-viewable) share link also works")),console.log(chalk.gray(" 5 submissions — best score counts. Make them count."));;){const o=(await y(chalk.cyan(" predictions file path or drive link (enter to skip): "))).trim();if(!o)break;const t=s(o,_,{exists:e,read:e=>a(e,"utf-8")});"local"===t.source&&console.log(chalk.gray(" Uploading local predictions file…"));const r=await u(`/api/icoa/arena/${E}/submit`,t),n=r?.data??r;if(!n){f();break}if(!n.ok){if("locked"===n.reason){console.log(chalk.yellow(" Locked — you've used all 5 submissions."));break}console.log(chalk.yellow(" Submission rejected: ")+chalk.gray(String(n.reason||"error")));continue}const i=null==n.display_score?"n/a":`${Number(n.display_score).toFixed(1)}/100`;if(console.log(chalk.green(" ✓ scored: ")+chalk.bold.white(`${n.metric}=${Number(n.value).toFixed(4)}`)+chalk.gray(` (${i}) rank ${n.rank}/${n.field_size} · ${n.remaining} left`)),"prev_rank"in n){const e=d(n.prev_rank,n.rank_at_time??n.rank,n.field_size);e&&console.log(chalk.cyan(` ${e}`))}if(n.locked){console.log(chalk.gray(" That was your last submission — entry locked into the board."));break}}console.log();const R=await m(`/api/icoa/arena/${E}/leaderboard`),j=(R?.data??R)?.leaderboard??(Array.isArray(R?.leaderboard)?R.leaderboard:[]);if(Array.isArray(j)&&j.length){console.log(chalk.bold.white(" Leaderboard (anonymous):"));for(const e of j.slice(0,20))console.log(chalk.gray(` #${e.rank} `)+chalk.cyan(String(e.pseudonym))+chalk.gray(" ")+chalk.white(String(e.value))+(null==e.display_score?"":chalk.gray(` (${e.display_score}/100)`)))}else console.log(chalk.gray(" Leaderboard is empty or unavailable."));console.log()}catch(e){if(!(e instanceof b))throw e;console.log(),console.log(chalk.gray(" Left the arena — back at the icoa> prompt.")),console.log()}finally{p.close()}}export function registerArenaCommand(e){e.command("arena [track] [task]",{hidden:!0}).description("Arena (<track>-frontier) — gated hands-on olympiad tasks with a server-graded leaderboard").action(async(e,o)=>{if("eai"===e)return void await i(o);const{track:a,task:t}=resolveTrackAndTask(e,o);await runArena(a,t)}),e.command("eai [task]").description("ctf4eai Embodied-AI Arena — red-team the robot policy and claim the flag").action(async e=>{await i(e)})}
|
package/dist/commands/ctf.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import chalk from"chalk";import{CTFdClient as e}from"../lib/ctfd-client.js";import{getConfig as o,saveConfig as t}from"../lib/config.js";import{postIntegritySnapshot as n}from"../lib/integrity-snapshot.js";import{logCommand as i,logSubmission as s}from"../lib/logger.js";import{getTranslation as a}from"../lib/translation.js";import{isLeaderAccount as l,isLeaderToken as c,leaderAuth as r}from"../lib/comms.js";import{printSuccess as d,printError as g,printWarning as m,printInfo as p,printTable as y,printMarkdown as h,printHeader as u,printKeyValue as w,createSpinner as f,formatCountdown as b}from"../lib/ui.js";import{eaiArenaTask as S,printEaiArenaGuide as v}from"./connect.js";export function detectFlagFormat(e){if(!e)return null;const o=e.match(/flag\s*format\s*[::]?\s*`?([A-Za-z][A-Za-z0-9_]{0,20}\{[^}\n]{1,60}\})`?/i);return o?o[1]:null}function C(){const t=o();t.ctfdUrl&&(t.token||t.sessionCookie)||(g("Not connected to CTFd. Run: join <url>"),process.exit(1));const n=t.sessionCookie||"",i=t.token&&!t.token.includes("session=")?t.token:"";return{config:t,client:new e(t.ctfdUrl,i,n||t.token)}}export function registerCtfCommands(k){const I=k.command("ctf").description("Competition commands");I.command("join <url>").description("Connect to a CTFd instance").action(async n=>{let s=n.trim().replace(/\/+$/,"");function a(e,o){return new Promise(t=>{process.stdout.write(chalk.white(e));const n=!!process.stdin.isTTY&&!!process.stdin.isRaw,i=process.stdin.listeners("data").slice(),s=process.stdin.listeners("keypress").slice();for(const e of i)process.stdin.removeListener("data",e);for(const e of s)process.stdin.removeListener("keypress",e);process.stdin.isTTY&&process.stdin.setRawMode?.(!0),process.stdin.resume();let a="";const l=e=>{const c=e.toString(),r=e=>{process.stdin.isTTY&&process.stdin.setRawMode?.(n),process.stdin.removeListener("data",l);for(const e of i)process.stdin.on("data",e);for(const e of s)process.stdin.on("keypress",e);process.stdout.write("\n"),t(e)};"\n"===c||"\r"===c?r(a):""===c||"\b"===c?a.length>0&&(a=a.slice(0,-1),process.stdout.write("\b \b")):""===c?r(""):(a+=c,process.stdout.write(o||c))};process.stdin.on("data",l)})}s.startsWith("http://")||s.startsWith("https://")||(s=`https://${s}`),i(`ctf join ${s}`),console.log(),p(`Connecting to ${chalk.bold(s)}`);const y=await a(" Username: ");if(c(y)){const e=f("Verifying leader token...");e.start();const o=await r(s,y);return o?(e.succeed("Leader verified"),t({ctfdUrl:s,token:"",sessionCookie:"",leaderToken:y.trim(),leaderTeam:o.team,userName:o.account,userId:null,teamId:null,joinedAt:(new Date).toISOString()}),console.log(),w("Leader",o.account),o.team&&w("Team",o.team),console.log(),console.log(chalk.yellow(" ─────────────────────────────────────────────")),console.log(chalk.bold.yellow(" Team Leader console")),console.log(),console.log(chalk.white(" scoreboard")+chalk.gray(" Live team rankings")),console.log(chalk.white(" jury")+chalk.gray(" File a clarification / appeal (recorded)")),console.log(chalk.white(" news")+chalk.gray(" Latest organizer broadcast")),console.log(chalk.white(" time")+chalk.gray(" Event clock")),console.log(chalk.white(" logout")+chalk.gray(" Sign out")),console.log(chalk.yellow(" ─────────────────────────────────────────────")),console.log(),void console.log(chalk.gray(" The challenge bracket is not available to leaders."))):(e.fail("Invalid leader token"),void g("That leader token was not accepted. Check the token on your card and retry."))}const h=await a(" Password: ","*");let u="",b="",S="";const v=f("Logging in...");v.start();try{const o=new e(s,""),t=await o.loginWithCredentials(y,h);u=t.token,b=t.session,S=t.csrf,u?v.succeed("Login successful — API token auto-generated"):v.succeed("Login successful (session mode)")}catch(e){return v.fail("Login failed"),void g(e.message)}const C=f("Testing connection...");C.start();try{const n=new e(s,u,b,S),i=await n.testConnection();C.succeed("Connected successfully"),console.log(),w("User",i.name),w("Score",String(i.score||0)),i.team_id&&w("Team ID",String(i.team_id));try{const e=await n.getCompetitionMeta(),o={ctfdUrl:s,token:u||b,userId:i.id,userName:i.name,teamId:i.team_id,sessionCookie:b,country:i.country||"",joinedAt:(new Date).toISOString()};e.start?(o.competitionStartsAt=new Date(1e3*e.start).toISOString(),w("Starts",new Date(1e3*e.start).toLocaleString())):o.competitionStartsAt="",e.end?(o.competitionEndsAt=new Date(1e3*e.end).toISOString(),w("Ends",new Date(1e3*e.end).toLocaleString())):o.competitionEndsAt="";const a=Date.now()/1e3;e.start&&a<e.start?o.competitionState="pre_competition":e.end&&a>e.end?o.competitionState="finished":o.competitionState="live",w("Status",o.competitionState),t(o)}catch{t({ctfdUrl:s,token:u,userId:i.id,userName:i.name,teamId:i.team_id,joinedAt:(new Date).toISOString()})}console.log(),d("Connection saved. You are ready!"),console.log();const a=o().mode||"";l(i.name||"")?(console.log(chalk.yellow(" ─────────────────────────────────────────────")),console.log(chalk.bold.yellow(" Team Leader console")),console.log(),console.log(chalk.white(" scoreboard")+chalk.gray(" Live team rankings")),console.log(chalk.white(" news")+chalk.gray(" Latest organizer broadcast")),console.log(chalk.white(" jury")+chalk.gray(" File a clarification / appeal (recorded)")),console.log(chalk.white(" time")+chalk.gray(" Event clock")),console.log(chalk.white(" status")+chalk.gray(" Event state")),console.log(chalk.white(" logout")+chalk.gray(" Sign out")),console.log(chalk.yellow(" ─────────────────────────────────────────────"))):"olympiad"===a?(console.log(chalk.cyan(" ─────────────────────────────────────────────")),console.log(chalk.bold.white(" How to compete:")),console.log(),console.log(chalk.white(" Step 1 ")+chalk.bold.cyan("challenges")+chalk.gray(" Browse all challenges")),console.log(chalk.white(" Step 2 ")+chalk.bold.cyan("open <id>")+chalk.gray(" Read challenge details")),console.log(chalk.white(" Step 3 ")+chalk.bold.cyan("submit <id> <flag>")+chalk.gray(" Submit your answer")),console.log(),console.log(chalk.bold.yellow(" ★ Need AI help? ")+chalk.bold.cyan("ai4ctf")+chalk.gray(" Chat freely with your AI teammate")),console.log(chalk.bold.yellow(" ★ Stuck on a tool? ")+chalk.bold.cyan("man <tool>")+chalk.gray(" how to use steghide / binwalk / nmap … (")+chalk.cyan("man tools")+chalk.gray(" = list)")),console.log(),console.log(chalk.gray(" More:")),console.log(chalk.white(" scoreboard")+chalk.gray(" Live rankings")),console.log(chalk.white(" status")+chalk.gray(" Your score & timer")),console.log(chalk.white(" memo")+chalk.gray(" Report an issue with a challenge")),console.log(chalk.white(" news")+chalk.gray(" Show the latest organizer broadcast")),console.log(chalk.cyan(" ─────────────────────────────────────────────"))):(console.log(chalk.gray(" Next:")),console.log(chalk.white(" exam list ")+chalk.gray("View available exams")),console.log(chalk.white(" challenges ")+chalk.gray("View CTF challenges")),console.log(chalk.white(" status ")+chalk.gray("Check score & timer")))}catch(e){/ACCOUNT_BLOCKED|banned|not enabled/i.test(e?.message||"")?(C.fail("This account cannot access the competition"),console.log(),g("Signed in OK, but the account is banned / disabled / not enabled. Try a different account, or contact the organizer."),t({ctfdUrl:s})):b?(C.succeed("Connected (session mode — limited API)"),t({ctfdUrl:s,token:b,userName:y,sessionCookie:b}),console.log(),w("User",y),m("API access limited. Some features may not work."),d("Connection saved.")):(C.fail("Connection test failed"),g(e.message),t({ctfdUrl:s}),console.log(),p(`Connection saved. Try: join ${s}`))}}),I.command("logout").description("Disconnect and clear credentials").action(()=>{i("ctf logout"),t({ctfdUrl:"",token:"",sessionCookie:"",userId:null,userName:"",teamId:null,country:"",leaderToken:"",leaderTeam:""}),d("Logged out. Credentials cleared."),console.log(),console.log(chalk.gray(" What now?")),console.log(chalk.white(" join <url>")+chalk.gray(" Re-connect to competition")),console.log(chalk.white(" setup")+chalk.gray(" Switch mode")),console.log(chalk.white(" exit")+chalk.gray(" Quit ICOA CLI"))}),I.command("activate <code>").description("Validate competition code").action(async e=>{i(`ctf activate ${e}`),C();const n=f("Validating competition code...");n.start();try{const i=await fetch(`${o().ctfdUrl}/api/v1/icoa/activate`,{method:"POST",headers:{Authorization:`Token ${o().token}`,"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(i.ok){const s=await i.json();n.succeed("Competition code validated"),t({competitionCode:e,teamId:s.data?.team_id||o().teamId,competitionState:"live"}),d(`Activated: ${e}`)}else n.succeed("Competition code saved"),t({competitionCode:e}),p("Code stored locally. Server validation will be attempted during competition.")}catch{n.succeed("Competition code saved"),t({competitionCode:e}),p("Code stored locally.")}}),I.command("challenges").description("List all challenges").action(async()=>{i("ctf challenges");const{client:e}=C(),o=f("Loading challenges...");o.start();try{const t=await e.getChallenges();if(o.stop(),!t||0===t.length)return void p("No challenges available yet.");const n=new Map;for(const e of t){const o=e.category||"Uncategorized";n.has(o)||n.set(o,[]),n.get(o).push(e)}const i=t.filter(e=>e.solved_by_me).length;u(`Challenges (${i}/${t.length} solved)`);const s={Web:"Find vulnerabilities in websites",Crypto:"Break ciphers & encryption",Reversing:"Analyze compiled programs",Rev:"Analyze compiled programs",Pwn:"Exploit binary vulnerabilities",Forensics:"Investigate digital evidence",Misc:"Creative & mixed challenges",OSINT:"Open-source intelligence gathering",AI:"AI security & adversarial ML",ai4ctf:"Use AI to solve CTF challenges",ctf4ai:"Attack live AI targets (LLM / ML / agents)",ctf4eai:"Red-team embodied-AI robot policies"},a=e=>{if(s[e])return s[e];const o=e.toLowerCase().replace(/\s+practice$/,""),t=Object.keys(s).find(e=>e.toLowerCase()===o);return t?s[t]:""},l=e=>e<=100?chalk.green("Easy"):e<=250?chalk.yellow("Medium"):e<=500?chalk.red("Hard"):chalk.magenta("Expert"),c=new Set(["auditagent"]),r=e=>c.has((e||"").trim().toLowerCase()),d=[...n.entries()].sort(([e],[o])=>e.localeCompare(o)).flatMap(([e,o])=>{const t=a(e);return[[t?`${chalk.cyan.bold(`── ${e} ──`)} ${chalk.gray(t)}`:chalk.cyan.bold(`── ${e} ──`),"","","",""],...o.sort((e,o)=>{const t=r(e.name);return t!==r(o.name)?t?-1:1:e.value-o.value}).map(e=>[String(e.id),e.solved_by_me?chalk.gray.strikethrough(e.name):e.name,e.solved_by_me?chalk.gray(String(e.value)):chalk.yellow(String(e.value)),e.solved_by_me?chalk.gray("--"):l(e.value),e.solved_by_me?chalk.green("✓"):chalk.gray("○")])]});y(["#","Name","Points","Difficulty","Solved"],d),console.log(chalk.gray(` ${t.length} challenges, ${i} solved`)),0===i&&(console.log(),console.log(chalk.gray(" Tip: Start with ")+chalk.green("Easy")+chalk.gray(" challenges! Type ")+chalk.white("open <id>")+chalk.gray(" to read one.")))}catch(e){o.fail("Failed to load challenges"),g(e.message)}}),I.command("open <id>").description("View challenge details").action(async e=>{i(`ctf open ${e}`);const{config:o,client:n}=C(),s=f("Loading challenge...");s.start();try{const i=await n.getChallenge(parseInt(e,10));s.stop(),t({currentChallengeId:i.id,currentChallengeName:i.name,currentChallengeCategory:i.category});const l=S(i);u(`${i.name} [${i.category}]`),w("Points",String(i.value)),w("Solves",String(i.solves)),i.connection_info&&!l&&w("Connection",i.connection_info),console.log();let c=i.description;if("en"!==o.language)try{c=await a(c,i.id,o.language)}catch{}h(c);const r=detectFlagFormat(i.description);if(console.log(),r?console.log(chalk.bold.white(" Flag format: ")+chalk.green(r)):console.log(chalk.bold.white(" Flag format: ")+chalk.gray("submit the flag exactly as you receive it, including its ")+chalk.green("wrapper{...}")+chalk.gray(" — don't retype or add a prefix.")),i.files&&i.files.length>0&&(console.log(),p(`Files (${i.files.length}): use ${chalk.white(`files ${e}`)} to download`)),i.hints&&i.hints.length>0&&p(`CTFd Hints available: ${i.hints.length}`),l)return console.log(),void v(e,l);i.connection_info&&(console.log(),p(`Quick connect: ${chalk.white(`connect ${e}`)}`));const d=!!i.connection_info&&/^https?:\/\//i.test(i.connection_info.trim());console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.bold.white(" What to do next:")),d&&console.log(chalk.white(` connect ${e}`)+chalk.gray(" How to attack & submit — full guide")),console.log(chalk.white(' hint "how to start?"')+chalk.gray(" Ask the AI teammate (if enabled this round)")),i.files&&i.files.length>0&&console.log(chalk.white(` files ${e}`)+chalk.gray(" Download challenge files")),i.connection_info&&!d&&console.log(chalk.white(` connect ${e}`)+chalk.gray(" Connect to target")),console.log(chalk.white(` submit ${e} <flag>`)+chalk.gray(" Submit your answer (paste the full flag with its wrapper)")),console.log(chalk.gray(" ─────────────────────────────────────────────"))}catch(e){s.fail("Failed to load challenge"),g(e.message)}}),I.command("submit <id> <flag>").description("Submit a flag").action(async(e,o)=>{i(`ctf submit ${e}`),s(parseInt(e,10),o);const{client:t}=C(),a=f("Submitting flag...");a.start();try{const i=await t.submitFlag(parseInt(e,10),o);switch(a.stop(),i.status){case"correct":console.log(),console.log(chalk.green.bold(" 🎉 Correct! ")+chalk.white(i.message)),console.log();break;case"incorrect":g(`Incorrect. ${i.message}`);break;case"already_solved":m("Already solved.");break;case"paused":m("Competition is paused.");break;case"ratelimited":m("Rate limited. Please wait before trying again.");break;default:p(i.message||"Unknown response")}await n()}catch(e){a.fail("Submission failed"),g(e.message)}}),I.command("scoreboard [top]").description("View scoreboard (optional: top N)").action(async e=>{i("ctf scoreboard");const{config:o,client:t}=C(),n=f("Loading scoreboard...");n.start();try{const e=await t.getScoreboard();if(n.stop(),!e||0===e.length)return void p("Scoreboard is empty.");u("Scoreboard");const i=e.map(e=>{const t=e.account_id===o.teamId,n=[String(e.pos),e.name,String(e.score)];return t?n.map(e=>chalk.yellow.bold(e)):n});y(["Rank","Team","Score"],i)}catch(e){n.fail("Failed to load scoreboard"),g(e.message)}}),I.command("status").description("Show competition status").action(async()=>{i("ctf status");const{config:e,client:o}=C();u("Competition Status");const t={pre_competition:chalk.yellow,demo:chalk.blue,live:chalk.green,finished:chalk.red,unknown:chalk.gray},n=e.competitionState||"unknown",s=t[n]||chalk.gray;console.log(` ${chalk.gray("State:")} ${chalk.bold(s({pre_competition:"PRE-COMPETITION",demo:"DEMO",live:"LIVE",finished:"FINISHED",unknown:"UNKNOWN"}[n]||n))}`);try{const e=await o.testConnection();w("User",chalk.white.bold(e.name)),w("Score",chalk.yellow.bold(String(e.score||0))),w("Rank",chalk.cyan(e.place||"N/A"))}catch{w("User",e.userName||"Unknown")}if(e.competitionEndsAt){console.log();const o=new Date(e.competitionEndsAt);new Date<o?w("Time Remaining",chalk.yellow.bold(b(o))):w("Time",chalk.red("Competition ended"))}console.log()}),I.command("time").description("Show competition countdown").action(async()=>{i("ctf time");let n=o();if(n.ctfdUrl)try{const i=new e(n.ctfdUrl,n.token,n.sessionCookie),s=await i.getCompetitionMeta(),a={};a.competitionStartsAt=s.start?new Date(1e3*s.start).toISOString():"",a.competitionEndsAt=s.end?new Date(1e3*s.end).toISOString():"",t(a),n=o()}catch{}if(!n.competitionStartsAt&&!n.competitionEndsAt)return p("Competition times not configured."),void p("They will be set when the competition server provides timing information.");const s=new Date,a=n.competitionStartsAt?new Date(n.competitionStartsAt):null,l=n.competitionEndsAt?new Date(n.competitionEndsAt):null;u("Competition Timer"),a&&s<a?(console.log(chalk.yellow(" Competition has not started yet.")),console.log(),console.log(` ${chalk.bold("Starts in:")} ${b(a)}`)):l&&s<l?(console.log(chalk.green(" Competition is LIVE")),console.log(),console.log(` ${chalk.bold("Time remaining:")} ${b(l)}`),console.log(),console.log(chalk.gray(" This is the shared event clock. If you are on a timed exam")),console.log(chalk.gray(" paper, your personal deadline is shown by ")+chalk.white("exam info")+chalk.gray("."))):console.log(chalk.red(" Competition has ended."))})}
|
|
1
|
+
import chalk from"chalk";import{CTFdClient as e}from"../lib/ctfd-client.js";import{getConfig as o,saveConfig as t}from"../lib/config.js";import{postIntegritySnapshot as n}from"../lib/integrity-snapshot.js";import{logCommand as s,logSubmission as a}from"../lib/logger.js";import{getTranslation as i}from"../lib/translation.js";import{isLeaderAccount as l,isLeaderToken as c,leaderAuth as r}from"../lib/comms.js";import{printSuccess as d,printError as g,printWarning as m,printInfo as p,printTable as y,printMarkdown as h,printHeader as u,printKeyValue as w,createSpinner as f,formatCountdown as b}from"../lib/ui.js";import{eaiArenaTask as S,printEaiArenaGuide as C}from"./connect.js";export function detectFlagFormat(e){if(!e)return null;const o=e.match(/flag\s*format\s*[::]?\s*`?([A-Za-z][A-Za-z0-9_]{0,20}\{[^}\n]{1,60}\})`?/i);return o?o[1]:null}function v(){const t=o();t.ctfdUrl&&(t.token||t.sessionCookie)||(g("Not connected to CTFd. Run: join <url>"),process.exit(1));const n=t.sessionCookie||"",s=t.token&&!t.token.includes("session=")?t.token:"";return{config:t,client:new e(t.ctfdUrl,s,n||t.token)}}export function registerCtfCommands(k){const I=k.command("ctf").description("Competition commands");I.command("join <url>").description("Connect to a CTFd instance").action(async n=>{let a=n.trim().replace(/\/+$/,"");function i(e,o){return new Promise(t=>{process.stdout.write(chalk.white(e));const n=!!process.stdin.isTTY&&!!process.stdin.isRaw,s=process.stdin.listeners("data").slice(),a=process.stdin.listeners("keypress").slice();for(const e of s)process.stdin.removeListener("data",e);for(const e of a)process.stdin.removeListener("keypress",e);process.stdin.isTTY&&process.stdin.setRawMode?.(!0),process.stdin.resume();let i="";const l=e=>{const c=e.toString(),r=e=>{process.stdin.isTTY&&process.stdin.setRawMode?.(n),process.stdin.removeListener("data",l);for(const e of s)process.stdin.on("data",e);for(const e of a)process.stdin.on("keypress",e);process.stdout.write("\n"),t(e)};"\n"===c||"\r"===c?r(i):""===c||"\b"===c?i.length>0&&(i=i.slice(0,-1),process.stdout.write("\b \b")):""===c?r(""):(i+=c,process.stdout.write(o||c))};process.stdin.on("data",l)})}a.startsWith("http://")||a.startsWith("https://")||(a=`https://${a}`),s(`ctf join ${a}`),console.log(),p(`Connecting to ${chalk.bold(a)}`),console.log(chalk.gray(" (Ctrl+C to cancel)"));const y=await i(" Username: ");if(c(y)){const e=f("Verifying leader token...");e.start();const o=await r(a,y);return o?(e.succeed("Leader verified"),t({ctfdUrl:a,token:"",sessionCookie:"",leaderToken:y.trim(),leaderTeam:o.team,userName:o.account,userId:null,teamId:null,joinedAt:(new Date).toISOString()}),console.log(),w("Leader",o.account),o.team&&w("Team",o.team),console.log(),console.log(chalk.yellow(" ─────────────────────────────────────────────")),console.log(chalk.bold.yellow(" Team Leader console")),console.log(),console.log(chalk.white(" scoreboard")+chalk.gray(" Live team rankings")),console.log(chalk.white(" jury")+chalk.gray(" File a clarification / appeal (recorded)")),console.log(chalk.white(" news")+chalk.gray(" Latest organizer broadcast")),console.log(chalk.white(" time")+chalk.gray(" Event clock")),console.log(chalk.white(" logout")+chalk.gray(" Sign out")),console.log(chalk.yellow(" ─────────────────────────────────────────────")),console.log(),void console.log(chalk.gray(" The challenge bracket is not available to leaders."))):(e.fail("Invalid leader token"),void g("That leader token was not accepted. Check the token on your card and retry."))}const h=await i(" Password: ","*");let u="",b="",S="";const C=f("Logging in...");C.start();try{const o=new e(a,""),t=await o.loginWithCredentials(y,h);u=t.token,b=t.session,S=t.csrf,u?C.succeed("Login successful — API token auto-generated"):C.succeed("Login successful (session mode)")}catch(e){return C.fail("Login failed"),void g(e.message)}const v=f("Testing connection...");v.start();try{const n=new e(a,u,b,S),s=await n.testConnection();v.succeed("Connected successfully"),console.log(),w("User",s.name),w("Score",String(s.score||0)),s.team_id&&w("Team ID",String(s.team_id));try{const e=await n.getCompetitionMeta(),o={ctfdUrl:a,token:u||b,userId:s.id,userName:s.name,teamId:s.team_id,sessionCookie:b,country:s.country||"",joinedAt:(new Date).toISOString()};e.start?(o.competitionStartsAt=new Date(1e3*e.start).toISOString(),w("Starts",new Date(1e3*e.start).toLocaleString())):o.competitionStartsAt="",e.end?(o.competitionEndsAt=new Date(1e3*e.end).toISOString(),w("Ends",new Date(1e3*e.end).toLocaleString())):o.competitionEndsAt="";const i=Date.now()/1e3;e.start&&i<e.start?o.competitionState="pre_competition":e.end&&i>e.end?o.competitionState="finished":o.competitionState="live",w("Status",o.competitionState),t(o)}catch{t({ctfdUrl:a,token:u,userId:s.id,userName:s.name,teamId:s.team_id,joinedAt:(new Date).toISOString()})}console.log(),d("Connection saved. You are ready!"),console.log();const i=o().mode||"";l(s.name||"")?(console.log(chalk.yellow(" ─────────────────────────────────────────────")),console.log(chalk.bold.yellow(" Team Leader console")),console.log(),console.log(chalk.white(" scoreboard")+chalk.gray(" Live team rankings")),console.log(chalk.white(" news")+chalk.gray(" Latest organizer broadcast")),console.log(chalk.white(" jury")+chalk.gray(" File a clarification / appeal (recorded)")),console.log(chalk.white(" time")+chalk.gray(" Event clock")),console.log(chalk.white(" status")+chalk.gray(" Event state")),console.log(chalk.white(" logout")+chalk.gray(" Sign out")),console.log(chalk.yellow(" ─────────────────────────────────────────────"))):"olympiad"===i?(console.log(chalk.cyan(" ─────────────────────────────────────────────")),console.log(chalk.bold.white(" How to compete:")),console.log(),console.log(chalk.white(" Step 1 ")+chalk.bold.cyan("challenges")+chalk.gray(" Browse all challenges")),console.log(chalk.white(" Step 2 ")+chalk.bold.cyan("open <id>")+chalk.gray(" Read challenge details")),console.log(chalk.white(" Step 3 ")+chalk.bold.cyan("submit <id> <flag>")+chalk.gray(" Submit your answer")),console.log(),console.log(chalk.bold.yellow(" ★ Need AI help? ")+chalk.bold.cyan("ai4ctf")+chalk.gray(" Chat freely with your AI teammate")),console.log(chalk.bold.yellow(" ★ Stuck on a tool? ")+chalk.bold.cyan("man <tool>")+chalk.gray(" how to use steghide / binwalk / nmap … (")+chalk.cyan("man tools")+chalk.gray(" = list)")),console.log(),console.log(chalk.gray(" More:")),console.log(chalk.white(" scoreboard")+chalk.gray(" Live rankings")),console.log(chalk.white(" status")+chalk.gray(" Your score & timer")),console.log(chalk.white(" memo")+chalk.gray(" Report an issue with a challenge")),console.log(chalk.white(" news")+chalk.gray(" Show the latest organizer broadcast")),console.log(chalk.cyan(" ─────────────────────────────────────────────"))):(console.log(chalk.gray(" Next:")),console.log(chalk.white(" exam list ")+chalk.gray("View available exams")),console.log(chalk.white(" challenges ")+chalk.gray("View CTF challenges")),console.log(chalk.white(" status ")+chalk.gray("Check score & timer")))}catch(e){/ACCOUNT_BLOCKED|banned|not enabled/i.test(e?.message||"")?(v.fail("This account cannot access the competition"),console.log(),g("Signed in OK, but the account is banned / disabled / not enabled. Try a different account, or contact the organizer."),t({ctfdUrl:a})):b?(v.succeed("Connected (session mode — limited API)"),t({ctfdUrl:a,token:b,userName:y,sessionCookie:b}),console.log(),w("User",y),m("API access limited. Some features may not work."),d("Connection saved.")):(v.fail("Connection test failed"),g(e.message),t({ctfdUrl:a}),console.log(),p(`Connection saved. Try: join ${a}`))}}),I.command("logout").description("Disconnect and clear credentials").action(()=>{s("ctf logout"),t({ctfdUrl:"",token:"",sessionCookie:"",userId:null,userName:"",teamId:null,country:"",leaderToken:"",leaderTeam:""}),d("Logged out. Credentials cleared."),console.log(),console.log(chalk.gray(" What now?")),console.log(chalk.white(" join <url>")+chalk.gray(" Re-connect to competition")),console.log(chalk.white(" setup")+chalk.gray(" Switch mode")),console.log(chalk.white(" quit")+chalk.gray(" Close ICOA CLI"))}),I.command("activate <code>").description("Validate competition code").action(async e=>{s(`ctf activate ${e}`),v();const n=f("Validating competition code...");n.start();try{const s=await fetch(`${o().ctfdUrl}/api/v1/icoa/activate`,{method:"POST",headers:{Authorization:`Token ${o().token}`,"Content-Type":"application/json"},body:JSON.stringify({code:e})});if(s.ok){const a=await s.json();n.succeed("Competition code validated"),t({competitionCode:e,teamId:a.data?.team_id||o().teamId,competitionState:"live"}),d(`Activated: ${e}`)}else n.succeed("Competition code saved"),t({competitionCode:e}),p("Code stored locally. Server validation will be attempted during competition.")}catch{n.succeed("Competition code saved"),t({competitionCode:e}),p("Code stored locally.")}}),I.command("challenges").description("List all challenges").action(async()=>{s("ctf challenges");const{client:e}=v(),o=f("Loading challenges...");o.start();try{const t=await e.getChallenges();if(o.stop(),!t||0===t.length)return void p("No challenges available yet.");const n=new Map;for(const e of t){const o=e.category||"Uncategorized";n.has(o)||n.set(o,[]),n.get(o).push(e)}const s=t.filter(e=>e.solved_by_me).length;u(`Challenges (${s}/${t.length} solved)`);const a={Web:"Find vulnerabilities in websites",Crypto:"Break ciphers & encryption",Reversing:"Analyze compiled programs",Rev:"Analyze compiled programs",Pwn:"Exploit binary vulnerabilities",Forensics:"Investigate digital evidence",Misc:"Creative & mixed challenges",OSINT:"Open-source intelligence gathering",AI:"AI security & adversarial ML",ai4ctf:"Use AI to solve CTF challenges",ctf4ai:"Attack live AI targets (LLM / ML / agents)",ctf4eai:"Red-team embodied-AI robot policies"},i=e=>{if(a[e])return a[e];const o=e.toLowerCase().replace(/\s+practice$/,""),t=Object.keys(a).find(e=>e.toLowerCase()===o);return t?a[t]:""},l=e=>e<=100?chalk.green("Easy"):e<=250?chalk.yellow("Medium"):e<=500?chalk.red("Hard"):chalk.magenta("Expert"),c=new Set(["auditagent"]),r=e=>c.has((e||"").trim().toLowerCase()),d=[...n.entries()].sort(([e],[o])=>e.localeCompare(o)).flatMap(([e,o])=>{const t=i(e);return[[t?`${chalk.cyan.bold(`── ${e} ──`)} ${chalk.gray(t)}`:chalk.cyan.bold(`── ${e} ──`),"","","",""],...o.sort((e,o)=>{const t=r(e.name);return t!==r(o.name)?t?-1:1:e.value-o.value}).map(e=>[String(e.id),e.solved_by_me?chalk.gray.strikethrough(e.name):e.name,e.solved_by_me?chalk.gray(String(e.value)):chalk.yellow(String(e.value)),e.solved_by_me?chalk.gray("--"):l(e.value),e.solved_by_me?chalk.green("✓"):chalk.gray("○")])]});y(["#","Name","Points","Difficulty","Solved"],d),console.log(chalk.gray(` ${t.length} challenges, ${s} solved`)),0===s&&(console.log(),console.log(chalk.gray(" Tip: Start with ")+chalk.green("Easy")+chalk.gray(" challenges! Type ")+chalk.white("open <id>")+chalk.gray(" to read one.")))}catch(e){o.fail("Failed to load challenges"),g(e.message)}}),I.command("open <id>").description("View challenge details").action(async e=>{s(`ctf open ${e}`);const{config:o,client:n}=v(),a=f("Loading challenge...");a.start();try{const s=await n.getChallenge(parseInt(e,10));a.stop(),t({currentChallengeId:s.id,currentChallengeName:s.name,currentChallengeCategory:s.category});const l=S(s);u(`${s.name} [${s.category}]`),w("Points",String(s.value)),w("Solves",String(s.solves)),s.connection_info&&!l&&w("Connection",s.connection_info),console.log();let c=s.description;if("en"!==o.language)try{c=await i(c,s.id,o.language)}catch{}h(c);const r=detectFlagFormat(s.description);if(console.log(),r?console.log(chalk.bold.white(" Flag format: ")+chalk.green(r)):console.log(chalk.bold.white(" Flag format: ")+chalk.gray("submit the flag exactly as you receive it, including its ")+chalk.green("wrapper{...}")+chalk.gray(" — don't retype or add a prefix.")),s.files&&s.files.length>0&&(console.log(),p(`Files (${s.files.length}): use ${chalk.white(`files ${e}`)} to download`)),s.hints&&s.hints.length>0&&p(`CTFd Hints available: ${s.hints.length}`),l)return console.log(),void C(e,l);s.connection_info&&(console.log(),p(`Quick connect: ${chalk.white(`connect ${e}`)}`));const d=!!s.connection_info&&/^https?:\/\//i.test(s.connection_info.trim());console.log(),console.log(chalk.gray(" ─────────────────────────────────────────────")),console.log(chalk.bold.white(" What to do next:")),d&&console.log(chalk.white(` connect ${e}`)+chalk.gray(" How to attack & submit — full guide")),console.log(chalk.white(' hint "how to start?"')+chalk.gray(" Ask the AI teammate (if enabled this round)")),s.files&&s.files.length>0&&console.log(chalk.white(` files ${e}`)+chalk.gray(" Download challenge files")),s.connection_info&&!d&&console.log(chalk.white(` connect ${e}`)+chalk.gray(" Connect to target")),console.log(chalk.white(` submit ${e} <flag>`)+chalk.gray(" Submit your answer (paste the full flag with its wrapper)")),console.log(chalk.gray(" ─────────────────────────────────────────────"))}catch(e){a.fail("Failed to load challenge"),g(e.message)}}),I.command("submit <id> <flag>").description("Submit a flag").action(async(e,o)=>{s(`ctf submit ${e}`),a(parseInt(e,10),o);const{client:t}=v(),i=f("Submitting flag...");i.start();try{const s=await t.submitFlag(parseInt(e,10),o);switch(i.stop(),s.status){case"correct":console.log(),console.log(chalk.green.bold(" 🎉 Correct! ")+chalk.white(s.message)),console.log();break;case"incorrect":g(`Incorrect. ${s.message}`);break;case"already_solved":m("Already solved.");break;case"paused":m("Competition is paused.");break;case"ratelimited":m("Rate limited. Please wait before trying again.");break;default:p(s.message||"Unknown response")}await n()}catch(e){i.fail("Submission failed"),g(e.message)}}),I.command("scoreboard [top]").description("View scoreboard (optional: top N)").action(async e=>{s("ctf scoreboard");const{config:o,client:t}=v(),n=f("Loading scoreboard...");n.start();try{const e=await t.getScoreboard();if(n.stop(),!e||0===e.length)return void p("Scoreboard is empty.");u("Scoreboard");const s=e.map(e=>{const t=e.account_id===o.teamId,n=[String(e.pos),e.name,String(e.score)];return t?n.map(e=>chalk.yellow.bold(e)):n});y(["Rank","Team","Score"],s)}catch(e){n.fail("Failed to load scoreboard"),g(e.message)}}),I.command("status").description("Show competition status").action(async()=>{s("ctf status");const{config:e,client:o}=v();u("Competition Status");const t={pre_competition:chalk.yellow,demo:chalk.blue,live:chalk.green,finished:chalk.red,unknown:chalk.gray},n=e.competitionState||"unknown",a=t[n]||chalk.gray;console.log(` ${chalk.gray("State:")} ${chalk.bold(a({pre_competition:"PRE-COMPETITION",demo:"DEMO",live:"LIVE",finished:"FINISHED",unknown:"UNKNOWN"}[n]||n))}`);try{const e=await o.testConnection();w("User",chalk.white.bold(e.name)),w("Score",chalk.yellow.bold(String(e.score||0))),w("Rank",chalk.cyan(e.place||"N/A"))}catch{w("User",e.userName||"Unknown")}if(e.competitionEndsAt){console.log();const o=new Date(e.competitionEndsAt);new Date<o?w("Time Remaining",chalk.yellow.bold(b(o))):w("Time",chalk.red("Competition ended"))}console.log()}),I.command("time").description("Show competition countdown").action(async()=>{s("ctf time");let n=o();if(n.ctfdUrl)try{const s=new e(n.ctfdUrl,n.token,n.sessionCookie),a=await s.getCompetitionMeta(),i={};i.competitionStartsAt=a.start?new Date(1e3*a.start).toISOString():"",i.competitionEndsAt=a.end?new Date(1e3*a.end).toISOString():"",t(i),n=o()}catch{}if(!n.competitionStartsAt&&!n.competitionEndsAt)return p("Competition times not configured."),void p("They will be set when the competition server provides timing information.");const a=new Date,i=n.competitionStartsAt?new Date(n.competitionStartsAt):null,l=n.competitionEndsAt?new Date(n.competitionEndsAt):null;u("Competition Timer"),i&&a<i?(console.log(chalk.yellow(" Competition has not started yet.")),console.log(),console.log(` ${chalk.bold("Starts in:")} ${b(i)}`)):l&&a<l?(console.log(chalk.green(" Competition is LIVE")),console.log(),console.log(` ${chalk.bold("Time remaining:")} ${b(l)}`),console.log(),console.log(chalk.gray(" This is the shared event clock. If you are on a timed exam")),console.log(chalk.gray(" paper, your personal deadline is shown by ")+chalk.white("exam info")+chalk.gray("."))):console.log(chalk.red(" Competition has ended."))})}
|