Files
ST-Amily2-Chat-Optimisation/core/table-system/executor.js
2025-08-12 22:35:53 +08:00

2 lines
5.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(_0x35fff5,_0x383545){const _0x3f7c5f=_0xd439,_0x45b015=_0x35fff5();while(!![]){try{const _0x1cfd06=parseInt(_0x3f7c5f(0x1be))/0x1+-parseInt(_0x3f7c5f(0x1b5))/0x2*(parseInt(_0x3f7c5f(0x1bf))/0x3)+parseInt(_0x3f7c5f(0x1c1))/0x4+parseInt(_0x3f7c5f(0x1c0))/0x5*(-parseInt(_0x3f7c5f(0x1d0))/0x6)+parseInt(_0x3f7c5f(0x1cc))/0x7*(-parseInt(_0x3f7c5f(0x1b7))/0x8)+-parseInt(_0x3f7c5f(0x1ce))/0x9+parseInt(_0x3f7c5f(0x1c9))/0xa;if(_0x1cfd06===_0x383545)break;else _0x45b015['push'](_0x45b015['shift']());}catch(_0x32ca2){_0x45b015['push'](_0x45b015['shift']());}}}(_0x5089,0x6d631));import{log}from'./logger.js';function insertRow(_0x4aa2f9,_0x242786,_0x478a79){const _0x13bda2=_0xd439;if(!_0x4aa2f9[_0x242786])return log(_0x13bda2(0x1d2)+_0x242786+_0x13bda2(0x1ca),_0x13bda2(0x1cd)),_0x4aa2f9;const _0xa55d28=_0x4aa2f9[_0x242786],_0x1f7667=_0xa55d28[_0x13bda2(0x1c4)][_0x13bda2(0x1d9)],_0x2da063=Array(_0x1f7667)[_0x13bda2(0x1d7)]('');for(const _0x581313 in _0x478a79){parseInt(_0x581313,0xa)<_0x1f7667&&(_0x2da063[_0x581313]=_0x478a79[_0x581313]);}return _0xa55d28['rows'][_0x13bda2(0x1bd)](_0x2da063),_0x4aa2f9;}function updateRow(_0x1c9bb0,_0xa4c79,_0x12da50,_0x280882){const _0x111353=_0xd439;if(!_0x1c9bb0[_0xa4c79])return log('AI指令错误尝试更新不存在的表格\x20'+_0xa4c79+'。','error'),_0x1c9bb0;const _0x458d5c=_0x1c9bb0[_0xa4c79];if(_0x12da50>=_0x458d5c[_0x111353(0x1cb)][_0x111353(0x1d9)])return log(_0x111353(0x1d5)+_0x12da50+_0x111353(0x1b4),'warn'),insertRow(_0x1c9bb0,_0xa4c79,_0x280882);const _0x28c416=_0x458d5c[_0x111353(0x1cb)][_0x12da50];for(const _0x4032e6 in _0x280882){parseInt(_0x4032e6,0xa)<_0x28c416['length']&&(_0x28c416[_0x4032e6]=_0x280882[_0x4032e6]);}return _0x1c9bb0;}function _0xd439(_0x1b2a0b,_0x525da7){const _0x508956=_0x5089();return _0xd439=function(_0xd4398d,_0x4535a4){_0xd4398d=_0xd4398d-0x1b4;let _0x22f7fb=_0x508956[_0xd4398d];return _0x22f7fb;},_0xd439(_0x1b2a0b,_0x525da7);}function deleteRow(_0x2d06bf,_0x3760f4,_0x279b5a){const _0x3dad52=_0xd439;if(!_0x2d06bf[_0x3760f4]||!_0x2d06bf[_0x3760f4][_0x3dad52(0x1cb)][_0x279b5a])return log(_0x3dad52(0x1c5)+_0x3760f4+_0x3dad52(0x1d4)+_0x279b5a+'。',_0x3dad52(0x1cd)),_0x2d06bf;return _0x2d06bf[_0x3760f4][_0x3dad52(0x1cb)][_0x3dad52(0x1ba)](_0x279b5a,0x1),_0x2d06bf;}const allowedFunctions={'insertRow':insertRow,'updateRow':updateRow,'deleteRow':deleteRow};function parseFunctionCall(_0x42498d){const _0xed1a2e=_0xd439,_0x407ff1=_0x42498d[_0xed1a2e(0x1c7)]()[_0xed1a2e(0x1d1)](/(\w+)\((.*)\)/);if(!_0x407ff1)return log(_0xed1a2e(0x1bc)+_0x42498d+'\x22',_0xed1a2e(0x1cd)),null;const _0x74ac2=_0x407ff1[0x1],_0x1c4d6c=_0x407ff1[0x2];if(!allowedFunctions[_0x74ac2])return log(_0xed1a2e(0x1c2)+_0x74ac2+_0xed1a2e(0x1c3),_0xed1a2e(0x1cd)),null;try{const _0x2e2e09=new Function(_0xed1a2e(0x1bb)+_0x1c4d6c+']')();return{'name':_0x74ac2,'args':_0x2e2e09};}catch(_0x2abd29){return log('解析函数\x20\x22'+_0x74ac2+'\x22\x20的参数时出错:\x20'+_0x2abd29[_0xed1a2e(0x1b9)],_0xed1a2e(0x1cd)),null;}}export function executeCommands(_0x39f37d,_0x130c57){const _0x47352c=_0xd439,_0x31b83c=/<Amily2Edit>([\s\S]*?)<\/Amily2Edit>/,_0x37993b=_0x39f37d['match'](_0x31b83c);if(!_0x37993b)return{'finalState':_0x130c57,'hasChanges':![]};log(_0x47352c(0x1d8),_0x47352c(0x1c8));const _0x1a0a32=_0x37993b[0x1]['replace'](/<!--|-->/g,'')[_0x47352c(0x1c7)]();if(!_0x1a0a32)return{'finalState':_0x130c57,'hasChanges':![]};const _0x167aaf=_0x1a0a32['split']('\x0a')['filter'](_0x216c21=>_0x216c21[_0x47352c(0x1c7)]()!=='');if(_0x167aaf['length']===0x0)return{'finalState':_0x130c57,'hasChanges':![]};let _0x3757fe=JSON['parse'](JSON[_0x47352c(0x1b6)](_0x130c57)),_0x1ebbd8=![];return _0x167aaf[_0x47352c(0x1c6)](_0x22ecbf=>{const _0x101569=_0x47352c,_0xd996c1=_0x22ecbf[_0x101569(0x1c7)]();if(_0xd996c1[_0x101569(0x1cf)](_0x101569(0x1d3))||_0xd996c1[_0x101569(0x1cf)]('deleteRow(')||_0xd996c1[_0x101569(0x1cf)](_0x101569(0x1b8))){const _0x2b3035=parseFunctionCall(_0xd996c1);if(_0x2b3035)try{_0x3757fe=allowedFunctions[_0x2b3035[_0x101569(0x1da)]](_0x3757fe,..._0x2b3035[_0x101569(0x1d6)]),log('成功推演指令:\x20'+_0x22ecbf,'success'),_0x1ebbd8=!![];}catch(_0x6d72f3){log('推演指令\x20\x22'+_0x22ecbf+'\x22\x20时发生运行时错误:\x20'+_0x6d72f3['message'],'error');}}}),{'finalState':_0x3757fe,'hasChanges':_0x1ebbd8};}function _0x5089(){const _0x838e03=['308667XyUnXk','75FshzOy','5JkvenN','2237788jGByNf','检测到非法函数调用:\x20\x22','\x22。已阻止执行。','headers','AI指令错误尝试删除不存在的表格\x20','forEach','trim','info','10202500YYVPgw','\x20中插入行。','rows','304486tDzpay','error','2308959tNHaCL','startsWith','4547418RZbVtg','match','AI指令错误尝试在不存在的表格索引\x20','insertRow(','\x20或行\x20','AI指令修正updateRow\x20的行索引\x20','args','fill','检测到AI指令块开始推演...','length','name','\x20超出范围自动转换为\x20insertRow。','9710wAadNk','stringify','56eqsaPX','updateRow(','message','splice','return\x20[','指令格式错误,无法解析:\x20\x22','push'];_0x5089=function(){return _0x838e03;};return _0x5089();}