const _0x41b621=_0x2d4e;(function(_0x2d8f95,_0x32dc56){const _0x238ee6=_0x2d4e,_0x3ee134=_0x2d8f95();while(!![]){try{const _0x27e6ff=parseInt(_0x238ee6(0x12d))/0x1*(parseInt(_0x238ee6(0x9c))/0x2)+-parseInt(_0x238ee6(0x127))/0x3*(parseInt(_0x238ee6(0x115))/0x4)+-parseInt(_0x238ee6(0x93))/0x5+-parseInt(_0x238ee6(0xa5))/0x6*(parseInt(_0x238ee6(0xb0))/0x7)+parseInt(_0x238ee6(0xc0))/0x8*(parseInt(_0x238ee6(0x10f))/0x9)+parseInt(_0x238ee6(0x103))/0xa+parseInt(_0x238ee6(0x10a))/0xb*(-parseInt(_0x238ee6(0x8a))/0xc);if(_0x27e6ff===_0x32dc56)break;else _0x3ee134['push'](_0x3ee134['shift']());}catch(_0x3ce1df){_0x3ee134['push'](_0x3ee134['shift']());}}}(_0x12a2,0xc78bb));import{extension_settings}from'/scripts/extensions.js';import{saveSettingsDebounced}from'/script.js';import{defaultSettings,extensionName}from'../utils/settings.js';import{pluginAuthStatus,activatePluginAuthorization,getPasswordForDate}from'../utils/auth.js';import{fetchSupportedModels}from'../core/api.js';import{setAvailableModels,populateModelDropdown,getLatestUpdateInfo}from'./state.js';function _0x2d4e(_0x52a8d6,_0x3ba337){const _0x12a2a6=_0x12a2();return _0x2d4e=function(_0x2d4ea1,_0x588d7e){_0x2d4ea1=_0x2d4ea1-0x83;let _0x4e4213=_0x12a2a6[_0x2d4ea1];return _0x4e4213;},_0x2d4e(_0x52a8d6,_0x3ba337);}import{fixCommand,testReplyChecker}from'../core/commands.js';import{createDrawer}from'../ui/drawer.js';import{messageFormatting}from'/script.js';import{executeManualCommand}from'../core/autoHideManager.js';import{showContentModal,showHtmlModal}from'./page-window.js';function displayDailyAuthCode(){const _0xb1a094=_0x2d4e,_0x3ebba8=document[_0xb1a094(0xcd)](_0xb1a094(0xd4)),_0x26d09d=document[_0xb1a094(0xcd)](_0xb1a094(0xcb));if(_0x3ebba8&&_0x26d09d){const _0x3eb3b4=getPasswordForDate(new Date());_0x3ebba8[_0xb1a094(0xeb)]=_0x3eb3b4,_0x26d09d['addEventListener']('click',()=>{const _0x2e1d17=_0xb1a094;navigator[_0x2e1d17(0xc8)][_0x2e1d17(0xe2)](_0x3eb3b4)[_0x2e1d17(0x9b)](()=>{const _0x5bc3c5=_0x2e1d17;toastr[_0x5bc3c5(0xbf)](_0x5bc3c5(0x123));},()=>{const _0x281baf=_0x2e1d17;toastr[_0x281baf(0x88)](_0x281baf(0xdc));});});}}export function bindModalEvents(){const _0x2a6d11=_0x2d4e,_0x5c3856=$(_0x2a6d11(0x138))['length']?$(_0x2a6d11(0x138)):$('#amily2_chat_optimiser');displayDailyAuthCode();function _0x41d965(){const _0x45ae46=_0x2a6d11,_0xb64e2c=extension_settings[extensionName]||{},_0xcb47ef=_0xb64e2c[_0x45ae46(0x99)]===!![],_0x501361=_0xb64e2c[_0x45ae46(0xbd)]||'';_0x5c3856[_0x45ae46(0xea)]('#amily2_force_proxy')[_0x45ae46(0xf9)](_0x45ae46(0x94),_0xcb47ef),_0x5c3856['find'](_0x45ae46(0x133))[_0x45ae46(0x116)](_0x501361);const _0x3766a4=_0x5c3856[_0x45ae46(0xea)](_0x45ae46(0xd9)),_0x458764=_0x5c3856[_0x45ae46(0xea)](_0x45ae46(0x133));_0xcb47ef?(_0x3766a4[_0x45ae46(0xad)](),_0x458764[_0x45ae46(0xa1)]()):(_0x3766a4[_0x45ae46(0xa1)](),_0x458764[_0x45ae46(0xad)]());}if(!_0x5c3856[_0x2a6d11(0x120)]||_0x5c3856['data'](_0x2a6d11(0x137)))return;const _0x4ed327=_0x1e543c=>_0x1e543c[_0x2a6d11(0xac)](/_([a-z])/g,_0x5d4eea=>_0x5d4eea[0x1]['toUpperCase']()),_0x2fb459=(_0x4b77c9,_0x4f25ff)=>{const _0x42b6e7=_0x2a6d11;console['log'](_0x42b6e7(0xfa)+_0x4b77c9+_0x42b6e7(0xc4),_0x4f25ff),!extension_settings[extensionName]&&(extension_settings[extensionName]={}),extension_settings[extensionName]={...extension_settings[extensionName],[_0x4b77c9]:_0x4f25ff},saveSettingsDebounced(),console[_0x42b6e7(0x117)](_0x42b6e7(0x98)+_0x4b77c9+']\x20的新状态已保存。');};_0x5c3856[_0x2a6d11(0x121)](_0x2a6d11(0xc3))['on'](_0x2a6d11(0xc3),_0x2a6d11(0x102),function(){const _0xa68683=_0x2a6d11;if(!pluginAuthStatus[_0xa68683(0xe4)])return;_0x2fb459(_0xa68683(0x99),this['checked']),_0x41d965();}),_0x5c3856['off'](_0x2a6d11(0xb5))['on'](_0x2a6d11(0xb5),_0x2a6d11(0x133),function(){const _0x5cef8b=_0x2a6d11;if(!pluginAuthStatus['authorized'])return;_0x2fb459('model',this[_0x5cef8b(0xf0)]),toastr[_0x5cef8b(0xbf)](_0x5cef8b(0xe7)+this[_0x5cef8b(0xf0)]+_0x5cef8b(0xd6),_0x5cef8b(0x10e));}),_0x5c3856[_0x2a6d11(0x121)](_0x2a6d11(0x83))['on'](_0x2a6d11(0x83),_0x2a6d11(0xcc),async function(){const _0x31e571=_0x2a6d11,_0x58939d=$('#amily2_auth_code')[_0x31e571(0x116)]()[_0x31e571(0xe6)]();_0x58939d?await activatePluginAuthorization(_0x58939d):toastr[_0x31e571(0xd3)](_0x31e571(0x104),_0x31e571(0x10e));}),_0x5c3856[_0x2a6d11(0x121)](_0x2a6d11(0xa3))['on'](_0x2a6d11(0xa3),_0x2a6d11(0xd1),async function(){const _0x16f9f5=_0x2a6d11;if(!pluginAuthStatus[_0x16f9f5(0xe4)])return;const _0x10d997=$(this),_0x4ec6b7=_0x10d997[_0x16f9f5(0xfc)]();_0x10d997[_0x16f9f5(0xf9)](_0x16f9f5(0x9e),!![])[_0x16f9f5(0xfc)]('\x20处理中');try{switch(this['id']){case _0x16f9f5(0x118):const _0x3b4afc=await fetchSupportedModels();_0x3b4afc[_0x16f9f5(0x120)]>0x0&&(setAvailableModels(_0x3b4afc),localStorage[_0x16f9f5(0x11b)](_0x16f9f5(0xe9),JSON[_0x16f9f5(0xf6)](_0x3b4afc)),populateModelDropdown());break;case _0x16f9f5(0x12a):await testReplyChecker();break;case _0x16f9f5(0x135):await fixCommand();break;}}catch(_0x4b1d12){console[_0x16f9f5(0x88)](_0x16f9f5(0x129)+this['id']+_0x16f9f5(0x100),_0x4b1d12),toastr[_0x16f9f5(0x88)](_0x16f9f5(0x111)+_0x4b1d12['message'],_0x16f9f5(0x10e));}finally{_0x10d997['prop'](_0x16f9f5(0x9e),![])['html'](_0x4ec6b7);}}),_0x5c3856['off'](_0x2a6d11(0xa4))['on']('click.amily2.expand_editor','#amily2_expand_editor',function(_0xbc214a){const _0x8aadd0=_0x2a6d11;if(!pluginAuthStatus[_0x8aadd0(0xe4)])return;_0xbc214a['stopPropagation']();const _0x2af351=$(_0x8aadd0(0x87))[_0x8aadd0(0x116)](),_0xbdf39a=$(_0x8aadd0(0xef))[_0x8aadd0(0x116)](),_0x14ba2d=_0x8aadd0(0xc1)+_0x2af351+_0x8aadd0(0xae),_0x5c052c=$(_0x14ba2d)[_0x8aadd0(0x136)](_0x8aadd0(0xd8)),_0x164d2f=_0x5c052c[_0x8aadd0(0xea)](_0x8aadd0(0x112));_0x164d2f[_0x8aadd0(0x116)](_0xbdf39a);const _0x343903=()=>{_0x5c052c[0x0]['close'](),_0x5c052c['remove']();};_0x5c052c['find']('.popup-button-ok')['on'](_0x8aadd0(0x128),()=>{const _0x4e3781=_0x8aadd0,_0x278109=_0x164d2f[_0x4e3781(0x116)]();$(_0x4e3781(0xef))[_0x4e3781(0x116)](_0x278109),_0x2fb459(_0x2af351,_0x278109),toastr[_0x4e3781(0xbf)]('谕令\x20['+_0x2af351+']\x20已镌刻!',_0x4e3781(0x10e)),_0x343903();}),_0x5c052c[_0x8aadd0(0xea)](_0x8aadd0(0xed))['on'](_0x8aadd0(0x128),_0x343903),_0x5c052c[0x0]['showModal']();}),_0x5c3856[_0x2a6d11(0x121)](_0x2a6d11(0x131))['on'](_0x2a6d11(0x131),_0x2a6d11(0xa2),function(){const _0x173de0=_0x2a6d11;if(!pluginAuthStatus[_0x173de0(0xe4)])return;const _0x38f0b7={'amily2_open_tutorial':{'title':_0x173de0(0xb1),'url':_0x173de0(0x9f)},'amily2_open_neige_tutorial':{'title':'内阁使用教程','url':_0x173de0(0xa8)}},_0x4d7964=_0x38f0b7[this['id']];_0x4d7964&&showContentModal(_0x4d7964[_0x173de0(0x114)],_0x4d7964[_0x173de0(0x11f)]);}),_0x5c3856['off'](_0x2a6d11(0x124))['on']('click.amily2.update',_0x2a6d11(0xd5),function(){const _0x3c1659=_0x2a6d11;$(_0x3c1659(0xaa))['hide']();const _0x122efb=getLatestUpdateInfo();if(_0x122efb&&_0x122efb[_0x3c1659(0x101)]){const _0x711b4e=messageFormatting(_0x122efb[_0x3c1659(0x101)]),_0x49dcb0=_0x3c1659(0xf7)+_0x711b4e+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20