Files
ST-Amily2-Chat-Optimisation…/core/table-system/executor.js
2025-08-09 17:13:38 +08:00

1 line
4.8 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 _0xd88d(_0x409147,_0x1e061a){const _0x460473=_0x4604();return _0xd88d=function(_0xd88d87,_0x581cd9){_0xd88d87=_0xd88d87-0xea;let _0x25ad85=_0x460473[_0xd88d87];return _0x25ad85;},_0xd88d(_0x409147,_0x1e061a);}(function(_0x3d239a,_0x259163){const _0x3f9ec9=_0xd88d,_0x17235a=_0x3d239a();while(!![]){try{const _0x2a8fed=-parseInt(_0x3f9ec9(0xec))/0x1*(-parseInt(_0x3f9ec9(0x103))/0x2)+parseInt(_0x3f9ec9(0xfd))/0x3*(-parseInt(_0x3f9ec9(0xf4))/0x4)+-parseInt(_0x3f9ec9(0x102))/0x5*(parseInt(_0x3f9ec9(0xed))/0x6)+parseInt(_0x3f9ec9(0xf6))/0x7+-parseInt(_0x3f9ec9(0xf7))/0x8+parseInt(_0x3f9ec9(0xf2))/0x9+parseInt(_0x3f9ec9(0xea))/0xa;if(_0x2a8fed===_0x259163)break;else _0x17235a['push'](_0x17235a['shift']());}catch(_0x2e53f6){_0x17235a['push'](_0x17235a['shift']());}}}(_0x4604,0x48cd5));import{log}from'./logger.js';function insertRow(_0x43387b,_0x3abc03,_0x11b900){const _0x250a06=_0xd88d;if(!_0x43387b[_0x3abc03])return log(_0x250a06(0x106)+_0x3abc03+'\x20中插入行。',_0x250a06(0xee)),_0x43387b;const _0x57284a=_0x43387b[_0x3abc03],_0x29479f=_0x57284a[_0x250a06(0xfa)][_0x250a06(0x109)],_0x168954=Array(_0x29479f)['fill']('');for(const _0x10009a in _0x11b900){parseInt(_0x10009a,0xa)<_0x29479f&&(_0x168954[_0x10009a]=_0x11b900[_0x10009a]);}return _0x57284a[_0x250a06(0x10b)][_0x250a06(0xef)](_0x168954),_0x43387b;}function updateRow(_0x39a32f,_0xc6603c,_0x35b2be,_0x23ef80){const _0x5841f8=_0xd88d;if(!_0x39a32f[_0xc6603c])return log(_0x5841f8(0xff)+_0xc6603c+'。',_0x5841f8(0xee)),_0x39a32f;const _0x191e3c=_0x39a32f[_0xc6603c];if(_0x35b2be>=_0x191e3c[_0x5841f8(0x10b)][_0x5841f8(0x109)])return log('AI指令修正updateRow\x20的行索引\x20'+_0x35b2be+_0x5841f8(0xf9),'warn'),insertRow(_0x39a32f,_0xc6603c,_0x23ef80);const _0x3ddb97=_0x191e3c[_0x5841f8(0x10b)][_0x35b2be];for(const _0x16d120 in _0x23ef80){parseInt(_0x16d120,0xa)<_0x3ddb97[_0x5841f8(0x109)]&&(_0x3ddb97[_0x16d120]=_0x23ef80[_0x16d120]);}return _0x39a32f;}function deleteRow(_0x2b30d8,_0x11743b,_0x370868){const _0x28b06=_0xd88d;if(!_0x2b30d8[_0x11743b]||!_0x2b30d8[_0x11743b][_0x28b06(0x10b)][_0x370868])return log(_0x28b06(0xf8)+_0x11743b+_0x28b06(0x108)+_0x370868+'。','error'),_0x2b30d8;return _0x2b30d8[_0x11743b][_0x28b06(0x10b)]['splice'](_0x370868,0x1),_0x2b30d8;}const allowedFunctions={'insertRow':insertRow,'updateRow':updateRow,'deleteRow':deleteRow};function parseFunctionCall(_0x50d17c){const _0x87fb74=_0xd88d,_0x138a3b=_0x50d17c[_0x87fb74(0xfe)]()['match'](/(\w+)\((.*)\)/);if(!_0x138a3b)return log(_0x87fb74(0x100)+_0x50d17c+'\x22',_0x87fb74(0xee)),null;const _0x5c55ea=_0x138a3b[0x1],_0x22f7af=_0x138a3b[0x2];if(!allowedFunctions[_0x5c55ea])return log(_0x87fb74(0xf3)+_0x5c55ea+'\x22。已阻止执行。',_0x87fb74(0xee)),null;try{const _0x20adac=new Function('return\x20['+_0x22f7af+']')();return{'name':_0x5c55ea,'args':_0x20adac};}catch(_0x5cc00f){return log(_0x87fb74(0x107)+_0x5c55ea+_0x87fb74(0x101)+_0x5cc00f[_0x87fb74(0x10a)],_0x87fb74(0xee)),null;}}export function executeCommands(_0x3af477,_0x447002){const _0x34dfdb=_0xd88d,_0xa0c6dd=/<Amily2Edit>([\s\S]*?)<\/Amily2Edit>/,_0x1c8cea=_0x3af477['match'](_0xa0c6dd);if(!_0x1c8cea)return{'finalState':_0x447002,'hasChanges':![]};log('检测到AI指令块开始推演...',_0x34dfdb(0x10c));const _0x217613=_0x1c8cea[0x1][_0x34dfdb(0x10d)](/<!--|-->/g,'')['trim']();if(!_0x217613)return{'finalState':_0x447002,'hasChanges':![]};const _0x4c0997=_0x217613[_0x34dfdb(0x104)]('\x0a')[_0x34dfdb(0x10e)](_0xd700c6=>_0xd700c6['trim']()!=='');if(_0x4c0997[_0x34dfdb(0x109)]===0x0)return{'finalState':_0x447002,'hasChanges':![]};let _0x313ba1=JSON[_0x34dfdb(0x105)](JSON[_0x34dfdb(0xf5)](_0x447002)),_0x1b2ef3=![];return _0x4c0997['forEach'](_0x31b80a=>{const _0x3cde78=_0x34dfdb,_0x4a9370=parseFunctionCall(_0x31b80a);if(_0x4a9370)try{_0x313ba1=allowedFunctions[_0x4a9370[_0x3cde78(0xf0)]](_0x313ba1,..._0x4a9370[_0x3cde78(0xfc)]),log(_0x3cde78(0xf1)+_0x31b80a,_0x3cde78(0xeb)),_0x1b2ef3=!![];}catch(_0x20b025){log(_0x3cde78(0xfb)+_0x31b80a+'\x22\x20时发生运行时错误:\x20'+_0x20b025[_0x3cde78(0x10a)],'error');}}),{'finalState':_0x313ba1,'hasChanges':_0x1b2ef3};}function _0x4604(){const _0x1fcb08=['\x22\x20的参数时出错:\x20','5bXXhil','1272KJePSo','split','parse','AI指令错误尝试在不存在的表格索引\x20','解析函数\x20\x22','\x20或行\x20','length','message','rows','info','replace','filter','11871680vLKNqB','success','199SVZwzV','3328086kzCLcC','error','push','name','成功推演指令:\x20','1838475RfFCzw','检测到非法函数调用:\x20\x22','596dwmQtO','stringify','207298sUeGGB','1083176qPLmxz','AI指令错误尝试删除不存在的表格\x20','\x20超出范围自动转换为\x20insertRow。','headers','推演指令\x20\x22','args','11262hemfBI','trim','AI指令错误尝试更新不存在的表格\x20','指令格式错误,无法解析:\x20\x22'];_0x4604=function(){return _0x1fcb08;};return _0x4604();}