diff --git a/MoreAlts/index.js b/MoreAlts/index.js index e9fa985..da72138 100644 --- a/MoreAlts/index.js +++ b/MoreAlts/index.js @@ -1,13 +1,13 @@ -(function(D,ie,se,k,V,de,B,f,a,e,X,F,le,ue,ge){"use strict";function fe(t){const{metro:{findByProps:c,findByStoreName:u,common:{lodash:{merge:d}}}}=t,i=c("_sendMessage"),{createBotMessage:n}=c("createBotMessage"),o=c("BOT_AVATARS"),{getChannelId:s}=u("SelectedChannelStore");return function(r,p){if(r.channelId??=s(),[null,void 0].includes(r.channelId))throw new Error("No channel id to receive the message into (channelId)");let l=r;if(r.really){typeof p=="object"&&(l=d(l,p));const h=[l,{}];h[0].tts??=!1;for(const w of["allowedMentions","messageReference"])w in h[0]&&(h[1][w]=h[0][w],delete h[0][w]);const y="overwriteSendMessageArg2";return y in h[0]&&(h[1]=h[0][y],delete h[0][y]),i._sendMessage(r.channelId,...h)}return p!==!0&&(l=n(l)),typeof p=="object"&&(l=d(l,p),typeof p.author=="object"&&function(){const h=p.author;typeof h.avatarURL=="string"&&(o.BOT_AVATARS[h.avatar??h.avatarURL]=h.avatarURL,h.avatar??=h.avatarURL,delete h.avatarURL)}()),i.receiveMessage(l.channel_id,l),l}}function he(t,c=27){if(typeof t!="string")throw new Error("Passed chars isn't a string");if(t?.length<=0)throw new Error("Invalid chars length");let u="";for(let d=0;d0;)u=(c?K:q).charAt(t%64)+u,t=Math.floor(t/64);return u}const O=[],we=1e3;function g(t,c,u=null){const d={timestamp:new Date().toISOString(),type:t,message:c,data:u};O.unshift(d),O.length>we&&O.pop(),a.storage?.settings?.enableUnsafeFeatures&&console.log(`[AccountSwitcher] ${t.toUpperCase()}: ${c}`,u||"")}function J(){return O}function be(){O.length=0,g("info","Logs cleared")}function Z(t){let c=0;if(t.length===0)return c.toString();for(let u=0;u=500&&(y="Discord servers are having issues - try again later");f.showToast(y,1),o(!1);return}g("debug","Login successful, fetching user info");const p=await fetch("https://discord.com/api/v9/users/@me",{headers:{Authorization:r.token}});if(!p.ok){g("error","Failed to get user info after login",{status:p.status}),f.showToast("Login succeeded but failed to get user info - check logs",1),o(!1);return}const l=await p.json();if(t.accounts[l.id]){g("warn","Account already exists",{username:l.username}),f.showToast(`Account ${l.username} already saved`,1),o(!1);return}const h={id:l.id,username:l.username,discriminator:l.discriminator,avatar:l.avatar,displayName:l.global_name||l.username,token:r.token,addedAt:Date.now()};t.accounts[l.id]=h,t.accountOrder.includes(l.id)||t.accountOrder.push(l.id),d(""),i(""),n(!1),g("info","Account added successfully via credentials",{username:l.username}),f.showToast(`Account ${l.username} added successfully!`,0)}catch(s){g("error","Credential login failed",{error:s.message,stack:s.stack}),console.error("Login error:",s);let r="Login failed - check logs for more info";s.message.includes("network")||s.message.includes("fetch")?r="Network error - check your connection":s.message.includes("timeout")&&(r="Request timed out - try again"),f.showToast(r,1)}o(!1)},Y=k.findByStoreName("UserStore"),Q=k.findByProps("getToken");a.storage.accounts||(a.storage.accounts={}),a.storage.accountOrder||(a.storage.accountOrder=[]),a.storage.settings?(a.storage.settings.enableUnsafeFeatures===void 0&&(a.storage.settings.enableUnsafeFeatures=!1),a.storage.settings.enableCLI===void 0&&(a.storage.settings.enableCLI=a.storage.settings.showAccountNames!==!1),a.storage.settings.confirmBeforeDelete===void 0&&(a.storage.settings.confirmBeforeDelete=!0),a.storage.settings.addToSidebar===void 0&&(a.storage.settings.addToSidebar=!0),a.storage.settings.showAccountNames!==void 0&&delete a.storage.settings.showAccountNames):a.storage.settings={enableCLI:!0,confirmBeforeDelete:!0,enableUnsafeFeatures:!1,addToSidebar:!0},g("info","AccountSwitcher plugin initialized",{accountsCount:Object.keys(a.storage.accounts).length,cliEnabled:a.storage.settings.enableCLI,unsafeFeaturesEnabled:a.storage.settings.enableUnsafeFeatures});function Ae({onBack:t}){X.useProxy(a.storage);const[c,u]=e.React.useState(""),[d,i]=e.React.useState(!1),[n,o]=e.React.useState(""),[s,r]=e.React.useState(null),[p,l]=e.React.useState(""),[h,y]=e.React.useState(""),w=function(v,P){const x={...a.storage.settings,[v]:P};a.storage.settings=x,g("info",`Setting updated: ${v}`,{newValue:P})},C=function(){const v=J(),P=v.map(function(x){return`[${x.timestamp}] ${x.type.toUpperCase()}: ${x.message}${x.data?" | Data: "+JSON.stringify(x.data):""}`}).join(` -`);e.clipboard.setString(P),g("info","Logs copied to clipboard",{count:v.length}),f.showToast(`Copied ${v.length} log entries to clipboard`,0)},j=function(v){v?F.showConfirmationAlert({title:"\u26A0\uFE0F Enable Unsafe Features - Security Warning",content:"Unsafe features include token copying, manual token adding, and detailed logging. These features can compromise your account security if misused. Tokens provide full access to accounts and should never be shared. Only enable if you understand the security implications.",confirmText:"I Understand - Enable",cancelText:"Cancel",confirmColor:"brand",onConfirm:function(){return w("enableUnsafeFeatures",!0)}}):w("enableUnsafeFeatures",!1)},_=function(){r(null)},G=function(){const v=s.callback;r(null),v()};return s?e.React.createElement(Re,{dialogInfo:s,onCancel:_,onSuccess:G,storage:a.storage}):e.React.createElement(e.ReactNative.View,{style:{flex:1,backgroundColor:"#2f3136"}},[e.React.createElement(e.ReactNative.View,{key:"header",style:{flexDirection:"row",alignItems:"center",padding:16,backgroundColor:"#202225",borderBottomWidth:1,borderBottomColor:"#40444b"}},[e.React.createElement(e.ReactNative.TouchableOpacity,{key:"back",onPress:t,style:{marginRight:16}},e.React.createElement(e.ReactNative.Text,{style:{color:"#7289da",fontSize:16}},"\u2190 Back to Accounts")),e.React.createElement(e.ReactNative.Text,{key:"title",style:{color:"white",fontSize:18,fontWeight:"bold"}},"Settings")]),e.React.createElement(e.ReactNative.ScrollView,{key:"content",style:{flex:1,padding:16},contentContainerStyle:{paddingBottom:100}},[e.React.createElement(e.ReactNative.View,{key:"export-import",style:{marginBottom:24}},[e.React.createElement(e.ReactNative.Text,{key:"export-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:12}},"BACKUP & RESTORE"),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"export-btn",onPress:function(){return ke(a.storage,r)},style:{backgroundColor:"#7289da",paddingVertical:12,paddingHorizontal:16,borderRadius:8,marginBottom:12,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"\u{1F4E4} Export Accounts to Clipboard")),e.React.createElement(e.ReactNative.TextInput,{key:"import-input",placeholder:"Paste exported account data here (or leave empty to use clipboard)...",placeholderTextColor:"#72767d",value:n,onChangeText:o,multiline:!0,numberOfLines:4,style:{backgroundColor:"#40444b",color:"white",padding:12,borderRadius:8,marginBottom:12,fontSize:14,textAlignVertical:"top"}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"import-btn",onPress:function(){return Te(a.storage,r,n)},style:{backgroundColor:"#43b581",paddingVertical:12,paddingHorizontal:16,borderRadius:8,marginBottom:12,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"\u{1F4E5} Import Accounts")),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"force-logout-btn",onPress:xe,style:{backgroundColor:"#f04747",paddingVertical:12,paddingHorizontal:16,borderRadius:8,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"\u{1F6AA} Force Logout"))]),e.React.createElement(e.ReactNative.View,{key:"export-password",style:{marginBottom:24}},[e.React.createElement(e.ReactNative.Text,{key:"password-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:12}},"EXPORT PASSWORD PROTECTION"),a.storage.settings.exportPasswordHash?e.React.createElement(e.ReactNative.View,{key:"password-set"},[e.React.createElement(e.ReactNative.Text,{key:"status",style:{color:"#43b581",fontSize:16,marginBottom:12}},"\u2713 Export password is set (hashed)"),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"remove-pwd",onPress:function(){return Ee(a.storage,r)},style:{backgroundColor:"#f04747",paddingVertical:12,paddingHorizontal:16,borderRadius:8,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"Remove Password"))]):e.React.createElement(e.ReactNative.View,{key:"password-unset"},[e.React.createElement(e.ReactNative.Text,{key:"desc",style:{color:"#72767d",fontSize:14,marginBottom:12}},"Set a password to protect your account exports and imports (will be hashed for security)"),e.React.createElement(e.ReactNative.TextInput,{key:"new-password",placeholder:"New password",placeholderTextColor:"#72767d",value:p,onChangeText:l,secureTextEntry:!0,style:{backgroundColor:"#40444b",color:"white",padding:12,borderRadius:8,marginBottom:8,fontSize:14}}),e.React.createElement(e.ReactNative.TextInput,{key:"confirm-password",placeholder:"Confirm password",placeholderTextColor:"#72767d",value:h,onChangeText:y,secureTextEntry:!0,style:{backgroundColor:"#40444b",color:"white",padding:12,borderRadius:8,marginBottom:12,fontSize:14}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"set-password",onPress:function(){return me(a.storage,p,h,l,y)},style:{backgroundColor:"#7289da",paddingVertical:12,paddingHorizontal:16,borderRadius:8,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"Set Password"))])]),e.React.createElement(e.ReactNative.View,{key:"unsafe",style:{marginBottom:24}},[e.React.createElement(e.ReactNative.Text,{key:"unsafe-title",style:{color:"#f04747",fontSize:14,fontWeight:"bold",marginBottom:12}},"UNSAFE FEATURES"),e.React.createElement(e.ReactNative.View,{key:"enable-unsafe",style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,backgroundColor:"#36393f",paddingHorizontal:16,borderRadius:8,marginBottom:8}},[e.React.createElement(e.ReactNative.View,{key:"text-container",style:{flex:1}},[e.React.createElement(e.ReactNative.Text,{key:"label",style:{color:"white",fontSize:16}},"Enable Unsafe Features"),e.React.createElement(e.ReactNative.Text,{key:"desc",style:{color:"#72767d",fontSize:12,marginTop:2}},"Allows token operations, detailed logging, and troubleshooting")]),e.React.createElement(e.ReactNative.Switch,{key:"toggle",value:a.storage.settings.enableUnsafeFeatures,onValueChange:j,trackColor:{false:"#72767d",true:"#f04747"},thumbColor:"white"})]),a.storage.settings.enableUnsafeFeatures&&e.React.createElement(e.ReactNative.View,{key:"unsafe-features",style:{marginTop:16}},[e.React.createElement(e.ReactNative.Text,{key:"logging-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:8}},"TROUBLESHOOTING & LOGGING"),e.React.createElement(e.ReactNative.View,{key:"log-actions",style:{flexDirection:"row",gap:8,marginBottom:16}},[e.React.createElement(e.ReactNative.TouchableOpacity,{key:"copy-logs",onPress:C,style:{flex:1,backgroundColor:"#7289da",paddingVertical:10,paddingHorizontal:12,borderRadius:6,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:14,fontWeight:"bold"}},`Copy Logs (${J().length})`)),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"clear-logs",onPress:be,style:{flex:1,backgroundColor:"#f04747",paddingVertical:10,paddingHorizontal:12,borderRadius:6,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:14,fontWeight:"bold"}},"Clear Logs"))]),e.React.createElement(e.ReactNative.Text,{key:"token-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:8}},"ADD ACCOUNT VIA TOKEN"),e.React.createElement(e.ReactNative.TextInput,{key:"token-input",placeholder:"Paste account token here (leave empty to add current account)...",placeholderTextColor:"#72767d",value:c,onChangeText:u,secureTextEntry:!0,style:{backgroundColor:"#40444b",color:"white",padding:12,borderRadius:8,marginBottom:12,fontSize:14}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"add-btn",onPress:function(){return Se(a.storage,c,u,i)},disabled:d,style:{backgroundColor:d?"#5c6bc0":"#7289da",paddingVertical:12,paddingHorizontal:20,borderRadius:8,alignItems:"center",opacity:d?.6:1}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},d?"Adding...":c.trim()?"Add Account":"Add Current Account"))])]),e.React.createElement(e.ReactNative.View,{key:"general",style:{marginBottom:24}},[e.React.createElement(e.ReactNative.Text,{key:"general-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:12}},"GENERAL"),e.React.createElement(e.ReactNative.View,{key:"enable-cli",style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,backgroundColor:"#36393f",paddingHorizontal:16,borderRadius:8,marginBottom:8}},[e.React.createElement(e.ReactNative.Text,{key:"label",style:{color:"white",fontSize:16}},"Enable CLI Interface"),e.React.createElement(e.ReactNative.Switch,{key:"toggle",value:a.storage.settings.enableCLI,onValueChange:function(v){return w("enableCLI",v)},trackColor:{false:"#72767d",true:"#7289da"},thumbColor:"white"})]),e.React.createElement(e.ReactNative.View,{key:"add-to-sidebar",style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,backgroundColor:"#36393f",paddingHorizontal:16,borderRadius:8,marginBottom:8}},[e.React.createElement(e.ReactNative.View,{key:"text-container",style:{flex:1}},[e.React.createElement(e.ReactNative.Text,{key:"label",style:{color:"white",fontSize:16}},"Add to Settings Sidebar"),e.React.createElement(e.ReactNative.Text,{key:"desc",style:{color:"#72767d",fontSize:12,marginTop:2}},"Show Account Switcher in Revenge settings menu")]),e.React.createElement(e.ReactNative.Switch,{key:"toggle",value:a.storage.settings.addToSidebar,onValueChange:function(v){w("addToSidebar",v),v?f.showToast("Sidebar enabled - restart app to see changes",0):f.showToast("Sidebar disabled - restart app to remove",0)},trackColor:{false:"#72767d",true:"#7289da"},thumbColor:"white"})]),e.React.createElement(e.ReactNative.View,{key:"confirm-delete",style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,backgroundColor:"#36393f",paddingHorizontal:16,borderRadius:8}},[e.React.createElement(e.ReactNative.Text,{key:"label",style:{color:"white",fontSize:16}},"Confirm Before Delete"),e.React.createElement(e.ReactNative.Switch,{key:"toggle",value:a.storage.settings.confirmBeforeDelete,onValueChange:function(v){return w("confirmBeforeDelete",v)},trackColor:{false:"#72767d",true:"#7289da"},thumbColor:"white"})])])])])}function ee(t){X.useProxy(a.storage);const[c,u]=e.React.useState(!1),[d,i]=e.React.useState(null),[n,o]=e.React.useState(!1),[s,r]=e.React.useState(""),[p,l]=e.React.useState(""),[h,y]=e.React.useState(!1),w=Y.getCurrentUser()?.id,C=function(b){const R=a.storage.accounts[b];if(!R)return;const T=b===w,S=R.username;g("info","Attempting to remove account",{username:S,isCurrent:T});const $=function(){delete a.storage.accounts[b],a.storage.accountOrder=a.storage.accountOrder.filter(function(U){return U!==b})},oe=function(){$(),g("info","Account removed from switcher only",{username:S}),f.showToast(`Account ${S} removed from switcher`,0)},ce=async function(){try{g("info","Starting account removal and logout",{username:S});const U=Q.getToken();await k.findByProps("login","logout","switchAccountToken").switchAccountToken(R.token),g("debug","Switched to account for logout"),await k.findByProps("login","logout").logout(),g("debug","Account logged out from Discord"),setTimeout(async function(){try{await k.findByProps("login","logout","switchAccountToken").switchAccountToken(U),g("debug","Switched back to original account")}catch(Me){g("warn","Could not switch back to original account",{error:Me.message})}},100)}catch(U){g("error","Failed to logout account from Discord",{error:U.message}),f.showToast("Failed to logout, but removed from switcher",1)}$(),g("info","Account removed and logged out",{username:S}),f.showToast(`Account ${S} removed and logged out`,0)};a.storage.settings.confirmBeforeDelete?e.ReactNative.Alert.alert(T?"Remove Current Account":"Remove Account",T?"Do you want to remove the current account from the switcher? (To logout, use Force Logout in settings)":`What do you want to do with ${S}?`,[{text:"Cancel",style:"cancel"},{text:"Delete from switcher only",onPress:oe},!T&&{text:"Delete and logout",onPress:ce}].filter(Boolean)):T?oe():ce()},j=async function(b){const R=a.storage.accounts[b];if(R){i(b),g("info","Starting account switch",{username:R.username});try{f.showToast(`Switching to ${R.username}...`,0),await k.findByProps("login","logout","switchAccountToken").switchAccountToken(R.token),g("info","Account switch successful",{username:R.username}),f.showToast(`Switched to ${R.username}!`,0)}catch(T){g("error","Account switch failed",{username:R.username,error:T.message}),console.error("Switch error:",T),f.showToast(`Failed to switch: ${T.message}`,1)}i(null)}},_=function(b){if(!a.storage.settings.enableUnsafeFeatures)return;const R=a.storage.accounts[b];R&&(e.clipboard.setString(R.token),g("info","Token copied to clipboard",{username:R.username}),f.showToast(`Token for ${R.username} copied`,0))},G=async function(){y(!0),g("info","Adding current account");try{const b=Q.getToken(),R=Y.getCurrentUser();if(!R||a.storage.accounts[R.id]){const S=a.storage.accounts[R.id]?"Current account already saved":"Failed to get current user";g("warn",S,{userId:R?.id}),f.showToast(S,1),y(!1);return}const T={id:R.id,username:R.username,discriminator:R.discriminator,avatar:R.avatar,displayName:R.globalName||R.username,token:b,addedAt:Date.now()};a.storage.accounts[R.id]=T,a.storage.accountOrder.includes(R.id)||a.storage.accountOrder.push(R.id),o(!1),g("info","Current account added successfully",{username:R.username}),f.showToast(`Current account ${R.username} added!`,0)}catch(b){g("error","Failed to add current account",{error:b.message}),console.error("Add current account error:",b),f.showToast("Failed to add current account",1)}y(!1)},v=async function(){await Ce(a.storage,s,p,r,l,o,y)},P=function(b){return new Date(b).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},x=a.storage.accountOrder.filter(function(b){return a.storage.accounts[b]}).map(function(b){return a.storage.accounts[b]});return c?e.React.createElement(Ae,{onBack:function(){return u(!1)}}):n?e.React.createElement(e.ReactNative.View,{style:{flex:1,backgroundColor:"#2f3136"}},[e.React.createElement(e.ReactNative.View,{key:"add-header",style:{flexDirection:"row",alignItems:"center",padding:16,backgroundColor:"#202225",borderBottomWidth:1,borderBottomColor:"#40444b"}},[e.React.createElement(e.ReactNative.TouchableOpacity,{key:"back",onPress:function(){o(!1),r(""),l("")},style:{marginRight:16}},e.React.createElement(e.ReactNative.Text,{style:{color:"#7289da",fontSize:16}},"\u2190 Back")),e.React.createElement(e.ReactNative.Text,{key:"title",style:{color:"white",fontSize:18,fontWeight:"bold"}},"Add Account")]),e.React.createElement(e.ReactNative.ScrollView,{key:"add-content",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:100}},[e.React.createElement(e.ReactNative.Text,{key:"instruction",style:{color:"#b9bbbe",fontSize:16,marginBottom:20,textAlign:"center"}},"Enter your Discord account credentials or add your current account"),e.React.createElement(e.ReactNative.TextInput,{key:"email-input",placeholder:"Email address",placeholderTextColor:"#72767d",value:s,onChangeText:r,keyboardType:"email-address",autoCapitalize:"none",style:{backgroundColor:"#40444b",color:"white",padding:16,borderRadius:8,marginBottom:12,fontSize:16}}),e.React.createElement(e.ReactNative.TextInput,{key:"password-input",placeholder:"Password",placeholderTextColor:"#72767d",value:p,onChangeText:l,secureTextEntry:!0,style:{backgroundColor:"#40444b",color:"white",padding:16,borderRadius:8,marginBottom:20,fontSize:16}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"login-btn",onPress:v,disabled:h,style:{backgroundColor:h?"#5c6bc0":"#7289da",paddingVertical:16,paddingHorizontal:20,borderRadius:8,alignItems:"center",marginBottom:12,opacity:h?.6:1}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:18,fontWeight:"bold"}},h?"Adding Account...":"Add Account with Email & Password")),e.React.createElement(e.ReactNative.View,{key:"divider",style:{height:1,backgroundColor:"#40444b",marginVertical:16}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"add-current-btn",onPress:G,disabled:h,style:{backgroundColor:h?"#5c6bc0":"#43b581",paddingVertical:16,paddingHorizontal:20,borderRadius:8,alignItems:"center",opacity:h?.6:1}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:18,fontWeight:"bold"}},h?"Adding...":"Add Current Account"))])]):e.React.createElement(e.ReactNative.View,{style:{flex:1,backgroundColor:"#2f3136"}},[e.React.createElement(e.ReactNative.View,{key:"header",style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16,backgroundColor:"#202225",borderBottomWidth:1,borderBottomColor:"#40444b"}},[e.React.createElement(e.ReactNative.Text,{key:"title",style:{color:"white",fontSize:20,fontWeight:"bold"}},"Account Switcher"),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"settings-btn",onPress:function(){return u(!0)},style:{padding:8,borderRadius:6,backgroundColor:"#4f545c"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:18}},"\u2699\uFE0F"))]),e.React.createElement(e.ReactNative.View,{key:"accounts-section",style:{flex:1,padding:16}},[e.React.createElement(e.ReactNative.Text,{key:"section-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:12}},`SAVED ACCOUNTS (${x.length})`),x.length===0?e.React.createElement(e.ReactNative.View,{key:"empty",style:{alignItems:"center",justifyContent:"center",paddingVertical:40}},[e.React.createElement(e.ReactNative.Text,{key:"empty-text",style:{color:"#72767d",fontSize:16,marginBottom:8}},"No accounts saved yet"),e.React.createElement(e.ReactNative.Text,{key:"empty-hint",style:{color:"#72767d",fontSize:14,textAlign:"center"}},"Access the switcher by pressing the logout button on the main settings page.")]):e.React.createElement(e.ReactNative.ScrollView,{key:"accounts-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:100}},x.map(function(b,R){const T=b.id===w,S=d===b.id;let $="https://cdn.discordapp.com/embed/avatars/1.png";return b.avatar&&($=`https://cdn.discordapp.com/avatars/${b.id}/${b.avatar}.png?size=48`),e.React.createElement(e.ReactNative.View,{key:b.id,style:{flexDirection:"row",alignItems:"center",backgroundColor:T?"#7289da20":"#36393f",borderWidth:T?2:0,borderColor:"#7289da",borderRadius:12,padding:12,marginBottom:12}},[e.React.createElement(e.ReactNative.TouchableOpacity,{key:"avatar",onPress:function(){return j(b.id)},disabled:T||S,style:{marginRight:12}},e.React.createElement(e.ReactNative.Image,{source:{uri:$},style:{width:48,height:48,borderRadius:24,opacity:T||S?.7:1}})),e.React.createElement(e.ReactNative.View,{key:"info",style:{flex:1}},[e.React.createElement(e.ReactNative.Text,{key:"name",style:{color:"white",fontSize:16,fontWeight:"bold"}},`${R+1}. ${a.storage.settings.enableCLI?`${b.username}${b.discriminator!=="0"?`#${b.discriminator}`:""}`:b.displayName}`),e.React.createElement(e.ReactNative.Text,{key:"status",style:{color:T?"#43b581":"#72767d",fontSize:12,marginTop:2}},T?"\u2713 Current Account":S?"Switching...":"Tap avatar to switch"),e.React.createElement(e.ReactNative.Text,{key:"date",style:{color:"#72767d",fontSize:11,marginTop:2}},`Added: ${P(b.addedAt||Date.now())}`)]),e.React.createElement(e.ReactNative.View,{key:"actions",style:{flexDirection:"column",alignItems:"flex-end"}},[a.storage.settings.enableUnsafeFeatures&&e.React.createElement(e.ReactNative.TouchableOpacity,{key:"copy",onPress:function(){return _(b.id)},style:{backgroundColor:"#4f545c",paddingHorizontal:12,paddingVertical:6,borderRadius:6,minWidth:80,alignItems:"center",marginBottom:6}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:12,fontWeight:"bold"}},"Copy Token")),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"remove",onPress:function(){return C(b.id)},style:{backgroundColor:"#f04747",paddingHorizontal:12,paddingVertical:6,borderRadius:6,minWidth:80,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:12,fontWeight:"bold"}},"Remove"))])])}))]),e.React.createElement(e.ReactNative.View,{key:"bottom-actions",style:{position:"absolute",bottom:0,left:0,right:0,backgroundColor:"#202225",borderTopWidth:1,borderTopColor:"#40444b",paddingVertical:12,paddingHorizontal:16,paddingBottom:40}},e.React.createElement(e.ReactNative.TouchableOpacity,{key:"add",onPress:function(){return o(!0)},style:{backgroundColor:"#7289da",paddingVertical:16,paddingHorizontal:20,borderRadius:8,alignItems:"center",flexDirection:"row",justifyContent:"center"}},[e.React.createElement(e.ReactNative.Text,{key:"add-icon",style:{color:"white",fontSize:20,marginRight:8}},"+"),e.React.createElement(e.ReactNative.Text,{key:"add-text",style:{color:"white",fontSize:18,fontWeight:"bold"}},"Add Account")]))])}const{FormSection:Ne,FormRow:M}=ue.Forms,{TableRowIcon:Ie}=k.findByProps("TableRowIcon"),z=window.bunny,te=z?.metro?.findByPropsLazy("getRootNavigationRef"),W=z?.metro?.findByPropsLazy("SETTING_RENDERER_CONFIG"),ae=z?.metro?.findByNameLazy("SettingsOverviewScreen",!1),re=z.metro.findByPropsLazy("createList");function Pe({tabs:t}){const c=e.NavigationNative.useNavigation();return e.React.createElement(M,{label:t.title(),leading:e.React.createElement(M.Icon,{source:t.icon}),trailing:e.React.createElement(e.React.Fragment,{},[t.trailing?t.trailing():null,e.React.createElement(M.Arrow,{key:"arrow"})]),onPress:function(){const u=t.page;c.navigate("VendettaCustomPage",{title:t.title(),render:function(){return e.React.createElement(u)}})}})}function Be(t,c){try{c.push(B.after("default",z?.metro?.findByNameLazy("UserSettingsOverviewWrapper",!1),function(u,d){const i=V.findInReactTree(d.props.children,function(n){return n.type?.name==="UserSettingsOverview"});i&&c.push(B.after("render",i.type.prototype,function(n,o){const s=V.findInReactTree(o.props.children,function(r){return r?.children?.[1]?.type===Ne})?.children;if(s){const r=s.findIndex(function(p){return["BILLING_SETTINGS","PREMIUM_SETTINGS"].includes(p?.props?.label)});s.splice(-~r||4,0,e.React.createElement(Pe,{key:t.key,tabs:t}))}}))},!0))}catch(u){ge.logger.info("Panel UI patch failed graciously \u{1F494}",u)}}function Fe(t,c){if(!W||!ae||!te){console.warn("[AccountSwitcher] Missing required constants for tabs UI patch");return}const u={};u[t.key]={type:"pressable",title:t.title,icon:t.icon,IconComponent:t.icon&&function(){const n=typeof t.icon=="object"&&t.icon.uri!==void 0?t.icon.uri:t.icon;return e.React.createElement(Ie,{source:n})},usePredicate:t.predicate,useTrailing:t.trailing,onPress:function(){const n=te.getRootNavigationRef(),o=t.page;n.navigate("VendettaCustomPage",{title:t.title(),render:function(){return e.React.createElement(o)}})},withArrow:!0};let d=W.SETTING_RENDERER_CONFIG;Object.defineProperty(W,"SETTING_RENDERER_CONFIG",{enumerable:!0,configurable:!0,get:function(){return{...d,...u}},set:function(n){return d=n}});const i=Symbol("AccountSwitcher-pinToSettings");try{if(!re)return;c.push(B.after("createList",re,function(n,o){if(!n[0][i]){n[0][i]=!0;const[s]=n,r=s.sections,p=r?.find(function(l){["Bunny","Kettu","Revenge"].some(function(h){return l.label===h&&l.title===h})});p||Boolean(r?.find(function(l){return l.settings[0]=="PREMIUM"}))&&r.unshift({label:a.manifest.name,title:a.manifest.name,settings:[t.key]}),p?.settings&&(p.settings=[...p.settings,t.key])}}))}catch{c.push(B.after("default",ae,function(n,o){if(!n[0][i]){n[0][i]=!0;const{sections:s}=V.findInReactTree(o,function(p){return p.props?.sections}).props,r=s?.find(function(p){return["Bunny","Kettu","Revenge"].some(function(l){return p.label===l&&p.title===l})});r||Boolean(s?.find(function(p){return p.settings[0]=="PREMIUM"}))&&s.unshift({label:a.manifest.name,title:a.manifest.name,settings:[t.key]}),r?.settings&&(r.settings=[...r.settings,t.key])}}))}}function Oe(t){const c=[];let u=!1;const d=t.predicate||function(){return!0};return t.predicate=function(){return u?!1:d()},Be(t,c),Fe(t,c),c.push(function(){return u=!0}),function(){for(const i of c)i()}}function ze(){if(!a.storage.settings?.addToSidebar)return console.log("[AccountSwitcher] Sidebar disabled in settings"),function(){};console.log("[AccountSwitcher] Patching sidebar using custom patchSettingsPin...");try{const t=Oe({key:"AccountSwitcher",icon:le.getAssetIDByName("UserIcon"),title:function(){return"Account Switcher"},predicate:function(){return a.storage.settings?.addToSidebar===!0},page:ee});return console.log("[AccountSwitcher] Successfully patched sidebar"),t}catch(t){return console.error("[AccountSwitcher] Failed to patch sidebar:",t),function(){}}}const{meta:{resolveSemanticColor:$e}}=k.findByProps("colors","meta"),Ue=k.findByStoreName("ThemeStore"),A=k.findByStoreName("UserStore"),m=function(){return parseInt($e(Ue.theme,ie.semanticColors.BACKGROUND_SECONDARY).slice(1),16)},I={author:{username:"AccountSwitcher",avatar:"command",avatarURL:ye?.command}};a.storage.accounts||(a.storage.accounts={}),a.storage.accountOrder||(a.storage.accountOrder=[]),a.storage.settings?(a.storage.settings.enableUnsafeFeatures===void 0&&(a.storage.settings.enableUnsafeFeatures=!1),a.storage.settings.enableCLI===void 0&&(a.storage.settings.enableCLI=a.storage.settings.showAccountNames!==!1),a.storage.settings.confirmBeforeDelete===void 0&&(a.storage.settings.confirmBeforeDelete=!0),a.storage.settings.addToSidebar===void 0&&(a.storage.settings.addToSidebar=!0),a.storage.settings.showAccountNames!==void 0&&delete a.storage.settings.showAccountNames):a.storage.settings={enableCLI:!0,confirmBeforeDelete:!0,enableUnsafeFeatures:!1,addToSidebar:!0};let H;function E(){return window.sendMessage?window.sendMessage?.(...arguments):(H||(H=fe?.(vendetta)),H?.(...arguments))}function N(t){return!t||!t.username?"Unknown Account":t.username}function ne(t){const c=a.storage.accounts||{},u=a.storage.accountOrder||[],d=parseInt(t);if(!isNaN(d)&&d>=1&&d<=u.length){const i=u[d-1];return c[i]?[i,c[i]]:null}return Object.entries(c).find(function([i,n]){return n.username.toLowerCase()===t.toLowerCase()||N(n).toLowerCase()===t.toLowerCase()})}function L(t){const c=(a.storage.accountOrder||[]).indexOf(t);return c>=0?c+1:null}function De(t){a.storage.accountOrder||(a.storage.accountOrder=[]),a.storage.accountOrder.includes(t)||a.storage.accountOrder.push(t)}function Ve(t){a.storage.accountOrder||(a.storage.accountOrder=[]);const c=a.storage.accountOrder.indexOf(t);c>-1&&a.storage.accountOrder.splice(c,1)}var Le={meta:vendetta.plugin,settings:ee,patches:[],onUnload(){this.patches.forEach(function(t){return t()}),this.patches=[]},onLoad(){const t=ze();this.patches.push(t);const c="Copy Token",u=B.before("render",k.findByProps("ScrollView").View,function(i){try{if(!a.storage.settings?.enableUnsafeFeatures)return;let n=V.findInReactTree(i,function(l){return l.key===".$UserProfileOverflow"});if(!n||!n.props||n.props.sheetKey!=="UserProfileOverflow")return;const o=n.props.content.props;if(o.options.some(function(l){return l?.label===c}))return;const s=A.getCurrentUser()?.id,r=Object.keys(n._owner.stateNode._keyChildMapping).find(function(l){return n._owner.stateNode._keyChildMapping[l]&&l.match(/(?<=\$UserProfile)\d+/)})?.slice?.(13)||s,p=k.findByProps("getToken").getToken();o.options.unshift({isDestructive:!0,label:c,onPress:function(){try{f.showToast(r===s?"Copied your token":`Copied token of ${o.header.title}`),de.setString(r===s?p:[Buffer.from(r).toString("base64").replaceAll("=",""),pe?.(+Date.now()-129384e4,!0)||"dummy",he?.(K,27)||"dummy"].join(".")),o.hideActionSheet()}catch(l){console.error(l),f.showToast("Failed to copy token",1)}}})}catch(n){console.error("Context menu patch error:",n)}});this.patches.push(u);const d={async mainCommand(i,n){try{const o={...I,interaction:{name:"/accswitcher",user:A.getCurrentUser()}};E?.({loggingName:"AccSwitcher main message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F4F1} Account Switcher",description:a.storage.settings.addToSidebar?"Account Manager is available in your settings sidebar!\n\nQuick commands:\n\u2022 `/accswitcher login <#>` - Switch to account\n\u2022 `/accswitcher add` - Add current account\n\u2022 `/accswitcher list` - Show all accounts":"Opening Account Manager...\n\nQuick commands:\n\u2022 `/accswitcher login <#>` - Switch to account\n\u2022 `/accswitcher add` - Add current account\n\u2022 `/accswitcher list` - Show all accounts",footer:{text:a.storage.settings.addToSidebar?"Check your settings sidebar for Account Switcher":"Check plugin settings for the Account Manager interface"}}]},o),f.showToast(a.storage.settings.addToSidebar?"Check settings sidebar for Account Switcher":"Check plugin settings to access Account Manager",0)}catch(o){console.error("Main command error:",o),f.showToast("Check plugin settings to access Account Manager",1)}},async addAccount(i,n){try{const o={...I,interaction:{name:"/accswitcher add",user:A.getCurrentUser()}},s=k.findByProps("getToken").getToken(),r=A.getCurrentUser();if(!r){E?.({loggingName:"Add account error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C Failed to Get Current User",description:"Could not retrieve current user information."}]},o);return}if(a.storage.accounts[r.id]){const h=L(r.id);E?.({loggingName:"Add account warning message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u26A0\uFE0F Account Already Saved",description:`Your current account **${h}. ${r.username}** is already saved.`}]},o);return}const p={id:r.id,username:r.username,discriminator:r.discriminator,avatar:r.avatar,displayName:r.globalName||r.username,token:s,addedAt:Date.now()};a.storage.accounts[r.id]=p,De(r.id);const l=L(r.id);E?.({loggingName:"Add account success message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u2705 Account Added Successfully",description:`**${l}. ${r.username}** has been saved.`,footer:{text:`Total accounts: ${Object.keys(a.storage.accounts).length}`}}]},o)}catch(o){console.error("Add account error:",o),f.showToast("Failed to add account",1)}},async login(i,n){try{const o={...I,interaction:{name:"/accswitcher login",user:A.getCurrentUser()}},s=new Map(i.map(function(y){return[y.name,y]})).get("account")?.value;if(!s){E?.({loggingName:"Login error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C No Account Specified",description:"Please specify an account number, username, or ID."}]},o);return}const r=ne(s);if(!r){const y=(a.storage.accountOrder||[]).filter(function(w){return a.storage.accounts[w]}).map(function(w,C){return`${C+1}. ${N(a.storage.accounts[w])}`}).join(` -`);E?.({loggingName:"Login error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C Account Not Found",description:`Could not find account "${s}".${y?` +(function(D,ie,se,k,V,de,P,f,a,e,X,O,le,ue,ge){"use strict";function fe(t){const{metro:{findByProps:c,findByStoreName:l,common:{lodash:{merge:d}}}}=t,i=c("_sendMessage"),{createBotMessage:n}=c("createBotMessage"),o=c("BOT_AVATARS"),{getChannelId:s}=l("SelectedChannelStore");return function(r,y){if(r.channelId??=s(),[null,void 0].includes(r.channelId))throw new Error("No channel id to receive the message into (channelId)");let u=r;if(r.really){typeof y=="object"&&(u=d(u,y));const p=[u,{}];p[0].tts??=!1;for(const w of["allowedMentions","messageReference"])w in p[0]&&(p[1][w]=p[0][w],delete p[0][w]);const h="overwriteSendMessageArg2";return h in p[0]&&(p[1]=p[0][h],delete p[0][h]),i._sendMessage(r.channelId,...p)}return y!==!0&&(u=n(u)),typeof y=="object"&&(u=d(u,y),typeof y.author=="object"&&function(){const p=y.author;typeof p.avatarURL=="string"&&(o.BOT_AVATARS[p.avatar??p.avatarURL]=p.avatarURL,p.avatar??=p.avatarURL,delete p.avatarURL)}()),i.receiveMessage(u.channel_id,u),u}}function he(t,c=27){if(typeof t!="string")throw new Error("Passed chars isn't a string");if(t?.length<=0)throw new Error("Invalid chars length");let l="";for(let d=0;d0;)l=(c?K:q).charAt(t%64)+l,t=Math.floor(t/64);return l}const F=[],we=1e3;function g(t,c,l=null){const d={timestamp:new Date().toISOString(),type:t,message:c,data:l};F.unshift(d),F.length>we&&F.pop(),a.storage?.settings?.enableUnsafeFeatures&&console.log(`[AccountSwitcher] ${t.toUpperCase()}: ${c}`,l||"")}function J(){return F}function be(){F.length=0,g("info","Logs cleared")}function Z(t){let c=0;if(t.length===0)return c.toString();for(let l=0;l=500&&(h="Discord servers are having issues - try again later");f.showToast(h,1),o(!1);return}g("debug","Login successful, fetching user info");const y=await fetch("https://discord.com/api/v9/users/@me",{headers:{Authorization:r.token}});if(!y.ok){g("error","Failed to get user info after login",{status:y.status}),f.showToast("Login succeeded but failed to get user info - check logs",1),o(!1);return}const u=await y.json();if(t.accounts[u.id]){g("warn","Account already exists",{username:u.username}),f.showToast(`Account ${u.username} already saved`,1),o(!1);return}const p={id:u.id,username:u.username,discriminator:u.discriminator,avatar:u.avatar,displayName:u.global_name||u.username,token:r.token,addedAt:Date.now()};t.accounts[u.id]=p,t.accountOrder.includes(u.id)||t.accountOrder.push(u.id),d(""),i(""),n(!1),g("info","Account added successfully via credentials",{username:u.username}),f.showToast(`Account ${u.username} added successfully!`,0)}catch(s){g("error","Credential login failed",{error:s.message,stack:s.stack}),console.error("Login error:",s);let r="Login failed - check logs for more info";s.message.includes("network")||s.message.includes("fetch")?r="Network error - check your connection":s.message.includes("timeout")&&(r="Request timed out - try again"),f.showToast(r,1)}o(!1)},Y=k.findByStoreName("UserStore"),Q=k.findByProps("getToken");a.storage.accounts||(a.storage.accounts={}),a.storage.accountOrder||(a.storage.accountOrder=[]),a.storage.settings?(a.storage.settings.enableUnsafeFeatures===void 0&&(a.storage.settings.enableUnsafeFeatures=!1),a.storage.settings.enableCLI===void 0&&(a.storage.settings.enableCLI=a.storage.settings.showAccountNames!==!1),a.storage.settings.confirmBeforeDelete===void 0&&(a.storage.settings.confirmBeforeDelete=!0),a.storage.settings.addToSidebar===void 0&&(a.storage.settings.addToSidebar=!0),a.storage.settings.showAccountNames!==void 0&&delete a.storage.settings.showAccountNames):a.storage.settings={enableCLI:!0,confirmBeforeDelete:!0,enableUnsafeFeatures:!1,addToSidebar:!0},g("info","AccountSwitcher plugin initialized",{accountsCount:Object.keys(a.storage.accounts).length,cliEnabled:a.storage.settings.enableCLI,unsafeFeaturesEnabled:a.storage.settings.enableUnsafeFeatures});function Ae({onBack:t}){X.useProxy(a.storage);const[c,l]=e.React.useState(""),[d,i]=e.React.useState(!1),[n,o]=e.React.useState(""),[s,r]=e.React.useState(null),[y,u]=e.React.useState(""),[p,h]=e.React.useState(""),w=function(v,B){const x={...a.storage.settings,[v]:B};a.storage.settings=x,g("info",`Setting updated: ${v}`,{newValue:B})},C=function(){const v=J(),B=v.map(function(x){return`[${x.timestamp}] ${x.type.toUpperCase()}: ${x.message}${x.data?" | Data: "+JSON.stringify(x.data):""}`}).join(` +`);e.clipboard.setString(B),g("info","Logs copied to clipboard",{count:v.length}),f.showToast(`Copied ${v.length} log entries to clipboard`,0)},j=function(v){v?O.showConfirmationAlert({title:"\u26A0\uFE0F Enable Unsafe Features - Security Warning",content:"Unsafe features include token copying, manual token adding, and detailed logging. These features can compromise your account security if misused. Tokens provide full access to accounts and should never be shared. Only enable if you understand the security implications.",confirmText:"I Understand - Enable",cancelText:"Cancel",confirmColor:"brand",onConfirm:function(){return w("enableUnsafeFeatures",!0)}}):w("enableUnsafeFeatures",!1)},_=function(){r(null)},G=function(){const v=s.callback;r(null),v()};return s?e.React.createElement(Re,{dialogInfo:s,onCancel:_,onSuccess:G,storage:a.storage}):e.React.createElement(e.ReactNative.View,{style:{flex:1,backgroundColor:"#2f3136"}},[e.React.createElement(e.ReactNative.View,{key:"header",style:{flexDirection:"row",alignItems:"center",padding:16,backgroundColor:"#202225",borderBottomWidth:1,borderBottomColor:"#40444b"}},[e.React.createElement(e.ReactNative.TouchableOpacity,{key:"back",onPress:t,style:{marginRight:16}},e.React.createElement(e.ReactNative.Text,{style:{color:"#7289da",fontSize:16}},"\u2190 Back to Accounts")),e.React.createElement(e.ReactNative.Text,{key:"title",style:{color:"white",fontSize:18,fontWeight:"bold"}},"Settings")]),e.React.createElement(e.ReactNative.ScrollView,{key:"content",style:{flex:1,padding:16},contentContainerStyle:{paddingBottom:100}},[e.React.createElement(e.ReactNative.View,{key:"export-import",style:{marginBottom:24}},[e.React.createElement(e.ReactNative.Text,{key:"export-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:12}},"BACKUP & RESTORE"),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"export-btn",onPress:function(){return ke(a.storage,r)},style:{backgroundColor:"#7289da",paddingVertical:12,paddingHorizontal:16,borderRadius:8,marginBottom:12,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"\u{1F4E4} Export Accounts to Clipboard")),e.React.createElement(e.ReactNative.TextInput,{key:"import-input",placeholder:"Paste exported account data here (or leave empty to use clipboard)...",placeholderTextColor:"#72767d",value:n,onChangeText:o,multiline:!0,numberOfLines:4,style:{backgroundColor:"#40444b",color:"white",padding:12,borderRadius:8,marginBottom:12,fontSize:14,textAlignVertical:"top"}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"import-btn",onPress:function(){return Te(a.storage,r,n)},style:{backgroundColor:"#43b581",paddingVertical:12,paddingHorizontal:16,borderRadius:8,marginBottom:12,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"\u{1F4E5} Import Accounts")),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"force-logout-btn",onPress:xe,style:{backgroundColor:"#f04747",paddingVertical:12,paddingHorizontal:16,borderRadius:8,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"\u{1F6AA} Force Logout"))]),e.React.createElement(e.ReactNative.View,{key:"export-password",style:{marginBottom:24}},[e.React.createElement(e.ReactNative.Text,{key:"password-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:12}},"EXPORT PASSWORD PROTECTION"),a.storage.settings.exportPasswordHash?e.React.createElement(e.ReactNative.View,{key:"password-set"},[e.React.createElement(e.ReactNative.Text,{key:"status",style:{color:"#43b581",fontSize:16,marginBottom:12}},"\u2713 Export password is set (hashed)"),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"remove-pwd",onPress:function(){return Se(a.storage,r)},style:{backgroundColor:"#f04747",paddingVertical:12,paddingHorizontal:16,borderRadius:8,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"Remove Password"))]):e.React.createElement(e.ReactNative.View,{key:"password-unset"},[e.React.createElement(e.ReactNative.Text,{key:"desc",style:{color:"#72767d",fontSize:14,marginBottom:12}},"Set a password to protect your account exports and imports (will be hashed for security)"),e.React.createElement(e.ReactNative.TextInput,{key:"new-password",placeholder:"New password",placeholderTextColor:"#72767d",value:y,onChangeText:u,secureTextEntry:!0,style:{backgroundColor:"#40444b",color:"white",padding:12,borderRadius:8,marginBottom:8,fontSize:14}}),e.React.createElement(e.ReactNative.TextInput,{key:"confirm-password",placeholder:"Confirm password",placeholderTextColor:"#72767d",value:p,onChangeText:h,secureTextEntry:!0,style:{backgroundColor:"#40444b",color:"white",padding:12,borderRadius:8,marginBottom:12,fontSize:14}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"set-password",onPress:function(){return me(a.storage,y,p,u,h)},style:{backgroundColor:"#7289da",paddingVertical:12,paddingHorizontal:16,borderRadius:8,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},"Set Password"))])]),e.React.createElement(e.ReactNative.View,{key:"unsafe",style:{marginBottom:24}},[e.React.createElement(e.ReactNative.Text,{key:"unsafe-title",style:{color:"#f04747",fontSize:14,fontWeight:"bold",marginBottom:12}},"UNSAFE FEATURES"),e.React.createElement(e.ReactNative.View,{key:"enable-unsafe",style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,backgroundColor:"#36393f",paddingHorizontal:16,borderRadius:8,marginBottom:8}},[e.React.createElement(e.ReactNative.View,{key:"text-container",style:{flex:1}},[e.React.createElement(e.ReactNative.Text,{key:"label",style:{color:"white",fontSize:16}},"Enable Unsafe Features"),e.React.createElement(e.ReactNative.Text,{key:"desc",style:{color:"#72767d",fontSize:12,marginTop:2}},"Allows token operations, detailed logging, and troubleshooting")]),e.React.createElement(e.ReactNative.Switch,{key:"toggle",value:a.storage.settings.enableUnsafeFeatures,onValueChange:j,trackColor:{false:"#72767d",true:"#f04747"},thumbColor:"white"})]),a.storage.settings.enableUnsafeFeatures&&e.React.createElement(e.ReactNative.View,{key:"unsafe-features",style:{marginTop:16}},[e.React.createElement(e.ReactNative.Text,{key:"logging-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:8}},"TROUBLESHOOTING & LOGGING"),e.React.createElement(e.ReactNative.View,{key:"log-actions",style:{flexDirection:"row",gap:8,marginBottom:16}},[e.React.createElement(e.ReactNative.TouchableOpacity,{key:"copy-logs",onPress:C,style:{flex:1,backgroundColor:"#7289da",paddingVertical:10,paddingHorizontal:12,borderRadius:6,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:14,fontWeight:"bold"}},`Copy Logs (${J().length})`)),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"clear-logs",onPress:be,style:{flex:1,backgroundColor:"#f04747",paddingVertical:10,paddingHorizontal:12,borderRadius:6,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:14,fontWeight:"bold"}},"Clear Logs"))]),e.React.createElement(e.ReactNative.Text,{key:"token-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:8}},"ADD ACCOUNT VIA TOKEN"),e.React.createElement(e.ReactNative.TextInput,{key:"token-input",placeholder:"Paste account token here (leave empty to add current account)...",placeholderTextColor:"#72767d",value:c,onChangeText:l,secureTextEntry:!0,style:{backgroundColor:"#40444b",color:"white",padding:12,borderRadius:8,marginBottom:12,fontSize:14}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"add-btn",onPress:function(){return Ee(a.storage,c,l,i)},disabled:d,style:{backgroundColor:d?"#5c6bc0":"#7289da",paddingVertical:12,paddingHorizontal:20,borderRadius:8,alignItems:"center",opacity:d?.6:1}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:16,fontWeight:"bold"}},d?"Adding...":c.trim()?"Add Account":"Add Current Account"))])]),e.React.createElement(e.ReactNative.View,{key:"general",style:{marginBottom:24}},[e.React.createElement(e.ReactNative.Text,{key:"general-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:12}},"GENERAL"),e.React.createElement(e.ReactNative.View,{key:"enable-cli",style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,backgroundColor:"#36393f",paddingHorizontal:16,borderRadius:8,marginBottom:8}},[e.React.createElement(e.ReactNative.Text,{key:"label",style:{color:"white",fontSize:16}},"Enable CLI Interface"),e.React.createElement(e.ReactNative.Switch,{key:"toggle",value:a.storage.settings.enableCLI,onValueChange:function(v){return w("enableCLI",v)},trackColor:{false:"#72767d",true:"#7289da"},thumbColor:"white"})]),e.React.createElement(e.ReactNative.View,{key:"add-to-sidebar",style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,backgroundColor:"#36393f",paddingHorizontal:16,borderRadius:8,marginBottom:8}},[e.React.createElement(e.ReactNative.View,{key:"text-container",style:{flex:1}},[e.React.createElement(e.ReactNative.Text,{key:"label",style:{color:"white",fontSize:16}},"Add to Settings Sidebar"),e.React.createElement(e.ReactNative.Text,{key:"desc",style:{color:"#72767d",fontSize:12,marginTop:2}},"Show Account Switcher in Revenge settings menu")]),e.React.createElement(e.ReactNative.Switch,{key:"toggle",value:a.storage.settings.addToSidebar,onValueChange:function(v){w("addToSidebar",v),v?f.showToast("Sidebar enabled - restart app to see changes",0):f.showToast("Sidebar disabled - restart app to remove",0)},trackColor:{false:"#72767d",true:"#7289da"},thumbColor:"white"})]),e.React.createElement(e.ReactNative.View,{key:"confirm-delete",style:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:12,backgroundColor:"#36393f",paddingHorizontal:16,borderRadius:8}},[e.React.createElement(e.ReactNative.Text,{key:"label",style:{color:"white",fontSize:16}},"Confirm Before Delete"),e.React.createElement(e.ReactNative.Switch,{key:"toggle",value:a.storage.settings.confirmBeforeDelete,onValueChange:function(v){return w("confirmBeforeDelete",v)},trackColor:{false:"#72767d",true:"#7289da"},thumbColor:"white"})])])])])}function ee(t){X.useProxy(a.storage);const[c,l]=e.React.useState(!1),[d,i]=e.React.useState(null),[n,o]=e.React.useState(!1),[s,r]=e.React.useState(""),[y,u]=e.React.useState(""),[p,h]=e.React.useState(!1),w=Y.getCurrentUser()?.id,C=function(b){const R=a.storage.accounts[b];if(!R)return;const T=b===w,E=R.username;g("info","Attempting to remove account",{username:E,isCurrent:T});const $=function(){delete a.storage.accounts[b],a.storage.accountOrder=a.storage.accountOrder.filter(function(U){return U!==b})},oe=function(){$(),g("info","Account removed from switcher only",{username:E}),f.showToast(`Account ${E} removed from switcher`,0)},ce=async function(){try{g("info","Starting account removal and logout",{username:E});const U=Q.getToken();await k.findByProps("login","logout","switchAccountToken").switchAccountToken(R.token),g("debug","Switched to account for logout"),await k.findByProps("login","logout").logout(),g("debug","Account logged out from Discord"),setTimeout(async function(){try{await k.findByProps("login","logout","switchAccountToken").switchAccountToken(U),g("debug","Switched back to original account")}catch(We){g("warn","Could not switch back to original account",{error:We.message})}},100)}catch(U){g("error","Failed to logout account from Discord",{error:U.message}),f.showToast("Failed to logout, but removed from switcher",1)}$(),g("info","Account removed and logged out",{username:E}),f.showToast(`Account ${E} removed and logged out`,0)};a.storage.settings.confirmBeforeDelete?e.ReactNative.Alert.alert(T?"Remove Current Account":"Remove Account",T?"Do you want to remove the current account from the switcher? (To logout, use Force Logout in settings)":`What do you want to do with ${E}?`,[{text:"Cancel",style:"cancel"},{text:"Delete from switcher only",onPress:oe},!T&&{text:"Delete and logout",onPress:ce}].filter(Boolean)):T?oe():ce()},j=async function(b){const R=a.storage.accounts[b];if(R){i(b),g("info","Starting account switch",{username:R.username});try{f.showToast(`Switching to ${R.username}...`,0),await k.findByProps("login","logout","switchAccountToken").switchAccountToken(R.token),g("info","Account switch successful",{username:R.username}),f.showToast(`Switched to ${R.username}!`,0)}catch(T){g("error","Account switch failed",{username:R.username,error:T.message}),console.error("Switch error:",T),f.showToast(`Failed to switch: ${T.message}`,1)}i(null)}},_=function(b){if(!a.storage.settings.enableUnsafeFeatures)return;const R=a.storage.accounts[b];R&&(e.clipboard.setString(R.token),g("info","Token copied to clipboard",{username:R.username}),f.showToast(`Token for ${R.username} copied`,0))},G=async function(){h(!0),g("info","Adding current account");try{const b=Q.getToken(),R=Y.getCurrentUser();if(!R||a.storage.accounts[R.id]){const E=a.storage.accounts[R.id]?"Current account already saved":"Failed to get current user";g("warn",E,{userId:R?.id}),f.showToast(E,1),h(!1);return}const T={id:R.id,username:R.username,discriminator:R.discriminator,avatar:R.avatar,displayName:R.globalName||R.username,token:b,addedAt:Date.now()};a.storage.accounts[R.id]=T,a.storage.accountOrder.includes(R.id)||a.storage.accountOrder.push(R.id),o(!1),g("info","Current account added successfully",{username:R.username}),f.showToast(`Current account ${R.username} added!`,0)}catch(b){g("error","Failed to add current account",{error:b.message}),console.error("Add current account error:",b),f.showToast("Failed to add current account",1)}h(!1)},v=async function(){await Ce(a.storage,s,y,r,u,o,h)},B=function(b){return new Date(b).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},x=a.storage.accountOrder.filter(function(b){return a.storage.accounts[b]}).map(function(b){return a.storage.accounts[b]});return c?e.React.createElement(Ae,{onBack:function(){return l(!1)}}):n?e.React.createElement(e.ReactNative.View,{style:{flex:1,backgroundColor:"#2f3136"}},[e.React.createElement(e.ReactNative.View,{key:"add-header",style:{flexDirection:"row",alignItems:"center",padding:16,backgroundColor:"#202225",borderBottomWidth:1,borderBottomColor:"#40444b"}},[e.React.createElement(e.ReactNative.TouchableOpacity,{key:"back",onPress:function(){o(!1),r(""),u("")},style:{marginRight:16}},e.React.createElement(e.ReactNative.Text,{style:{color:"#7289da",fontSize:16}},"\u2190 Back")),e.React.createElement(e.ReactNative.Text,{key:"title",style:{color:"white",fontSize:18,fontWeight:"bold"}},"Add Account")]),e.React.createElement(e.ReactNative.ScrollView,{key:"add-content",style:{flex:1},contentContainerStyle:{padding:16,paddingBottom:100}},[e.React.createElement(e.ReactNative.Text,{key:"instruction",style:{color:"#b9bbbe",fontSize:16,marginBottom:20,textAlign:"center"}},"Enter your Discord account credentials or add your current account"),e.React.createElement(e.ReactNative.TextInput,{key:"email-input",placeholder:"Email address",placeholderTextColor:"#72767d",value:s,onChangeText:r,keyboardType:"email-address",autoCapitalize:"none",style:{backgroundColor:"#40444b",color:"white",padding:16,borderRadius:8,marginBottom:12,fontSize:16}}),e.React.createElement(e.ReactNative.TextInput,{key:"password-input",placeholder:"Password",placeholderTextColor:"#72767d",value:y,onChangeText:u,secureTextEntry:!0,style:{backgroundColor:"#40444b",color:"white",padding:16,borderRadius:8,marginBottom:20,fontSize:16}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"login-btn",onPress:v,disabled:p,style:{backgroundColor:p?"#5c6bc0":"#7289da",paddingVertical:16,paddingHorizontal:20,borderRadius:8,alignItems:"center",marginBottom:12,opacity:p?.6:1}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:18,fontWeight:"bold"}},p?"Adding Account...":"Add Account with Email & Password")),e.React.createElement(e.ReactNative.View,{key:"divider",style:{height:1,backgroundColor:"#40444b",marginVertical:16}}),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"add-current-btn",onPress:G,disabled:p,style:{backgroundColor:p?"#5c6bc0":"#43b581",paddingVertical:16,paddingHorizontal:20,borderRadius:8,alignItems:"center",opacity:p?.6:1}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:18,fontWeight:"bold"}},p?"Adding...":"Add Current Account"))])]):e.React.createElement(e.ReactNative.View,{style:{flex:1,backgroundColor:"#2f3136"}},[e.React.createElement(e.ReactNative.View,{key:"header",style:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16,backgroundColor:"#202225",borderBottomWidth:1,borderBottomColor:"#40444b"}},[e.React.createElement(e.ReactNative.Text,{key:"title",style:{color:"white",fontSize:20,fontWeight:"bold"}},"Account Switcher"),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"settings-btn",onPress:function(){return l(!0)},style:{padding:8,borderRadius:6,backgroundColor:"#4f545c"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:18}},"\u2699\uFE0F"))]),e.React.createElement(e.ReactNative.View,{key:"accounts-section",style:{flex:1,padding:16}},[e.React.createElement(e.ReactNative.Text,{key:"section-title",style:{color:"#b9bbbe",fontSize:14,fontWeight:"bold",marginBottom:12}},`SAVED ACCOUNTS (${x.length})`),x.length===0?e.React.createElement(e.ReactNative.View,{key:"empty",style:{alignItems:"center",justifyContent:"center",paddingVertical:40}},[e.React.createElement(e.ReactNative.Text,{key:"empty-text",style:{color:"#72767d",fontSize:16,marginBottom:8}},"No accounts saved yet"),e.React.createElement(e.ReactNative.Text,{key:"empty-hint",style:{color:"#72767d",fontSize:14,textAlign:"center"}},"Access the switcher by pressing the logout button on the main settings page.")]):e.React.createElement(e.ReactNative.ScrollView,{key:"accounts-scroll",style:{flex:1},contentContainerStyle:{paddingBottom:100}},x.map(function(b,R){const T=b.id===w,E=d===b.id;let $="https://cdn.discordapp.com/embed/avatars/1.png";return b.avatar&&($=`https://cdn.discordapp.com/avatars/${b.id}/${b.avatar}.png?size=48`),e.React.createElement(e.ReactNative.View,{key:b.id,style:{flexDirection:"row",alignItems:"center",backgroundColor:T?"#7289da20":"#36393f",borderWidth:T?2:0,borderColor:"#7289da",borderRadius:12,padding:12,marginBottom:12}},[e.React.createElement(e.ReactNative.TouchableOpacity,{key:"avatar",onPress:function(){return j(b.id)},disabled:T||E,style:{marginRight:12}},e.React.createElement(e.ReactNative.Image,{source:{uri:$},style:{width:48,height:48,borderRadius:24,opacity:T||E?.7:1}})),e.React.createElement(e.ReactNative.View,{key:"info",style:{flex:1}},[e.React.createElement(e.ReactNative.Text,{key:"name",style:{color:"white",fontSize:16,fontWeight:"bold"}},`${R+1}. ${a.storage.settings.enableCLI?`${b.username}${b.discriminator!=="0"?`#${b.discriminator}`:""}`:b.displayName}`),e.React.createElement(e.ReactNative.Text,{key:"status",style:{color:T?"#43b581":"#72767d",fontSize:12,marginTop:2}},T?"\u2713 Current Account":E?"Switching...":"Tap avatar to switch"),e.React.createElement(e.ReactNative.Text,{key:"date",style:{color:"#72767d",fontSize:11,marginTop:2}},`Added: ${B(b.addedAt||Date.now())}`)]),e.React.createElement(e.ReactNative.View,{key:"actions",style:{flexDirection:"column",alignItems:"flex-end"}},[a.storage.settings.enableUnsafeFeatures&&e.React.createElement(e.ReactNative.TouchableOpacity,{key:"copy",onPress:function(){return _(b.id)},style:{backgroundColor:"#4f545c",paddingHorizontal:12,paddingVertical:6,borderRadius:6,minWidth:80,alignItems:"center",marginBottom:6}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:12,fontWeight:"bold"}},"Copy Token")),e.React.createElement(e.ReactNative.TouchableOpacity,{key:"remove",onPress:function(){return C(b.id)},style:{backgroundColor:"#f04747",paddingHorizontal:12,paddingVertical:6,borderRadius:6,minWidth:80,alignItems:"center"}},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontSize:12,fontWeight:"bold"}},"Remove"))])])}))]),e.React.createElement(e.ReactNative.View,{key:"bottom-actions",style:{position:"absolute",bottom:0,left:0,right:0,backgroundColor:"#202225",borderTopWidth:1,borderTopColor:"#40444b",paddingVertical:12,paddingHorizontal:16,paddingBottom:40}},e.React.createElement(e.ReactNative.TouchableOpacity,{key:"add",onPress:function(){return o(!0)},style:{backgroundColor:"#7289da",paddingVertical:16,paddingHorizontal:20,borderRadius:8,alignItems:"center",flexDirection:"row",justifyContent:"center"}},[e.React.createElement(e.ReactNative.Text,{key:"add-icon",style:{color:"white",fontSize:20,marginRight:8}},"+"),e.React.createElement(e.ReactNative.Text,{key:"add-text",style:{color:"white",fontSize:18,fontWeight:"bold"}},"Add Account")]))])}const{FormSection:Ne,FormRow:W}=ue.Forms,{TableRowIcon:Ie}=k.findByProps("TableRowIcon"),z=window.bunny,te=z?.metro?.findByPropsLazy("getRootNavigationRef"),M=z?.metro?.findByPropsLazy("SETTING_RENDERER_CONFIG"),ae=z?.metro?.findByNameLazy("SettingsOverviewScreen",!1),re=z.metro.findByPropsLazy("createList");function Be({tabs:t}){const c=e.NavigationNative.useNavigation();return e.React.createElement(W,{label:t.title(),leading:e.React.createElement(W.Icon,{source:t.icon}),trailing:e.React.createElement(e.React.Fragment,{},[t.trailing?t.trailing():null,e.React.createElement(W.Arrow,{key:"arrow"})]),onPress:function(){const l=t.page;c.navigate("VendettaCustomPage",{title:t.title(),render:function(){return e.React.createElement(l)}})}})}function Pe(t,c){try{c.push(P.after("default",z?.metro?.findByNameLazy("UserSettingsOverviewWrapper",!1),function(l,d){const i=V.findInReactTree(d.props.children,function(n){return n.type?.name==="UserSettingsOverview"});i&&c.push(P.after("render",i.type.prototype,function(n,o){const s=V.findInReactTree(o.props.children,function(r){return r?.children?.[1]?.type===Ne})?.children;if(s){const r=s.findIndex(function(y){return["BILLING_SETTINGS","PREMIUM_SETTINGS"].includes(y?.props?.label)});s.splice(-~r||4,0,e.React.createElement(Be,{key:t.key,tabs:t}))}}))},!0))}catch(l){ge.logger.info("Panel UI patch failed graciously \u{1F494}",l)}}function Oe(t,c){if(!M||!ae||!te){console.warn("[AccountSwitcher] Missing required constants for tabs UI patch");return}const l={};l[t.key]={type:"pressable",title:t.title,icon:t.icon,IconComponent:t.icon&&function(){const n=typeof t.icon=="object"&&t.icon.uri!==void 0?t.icon.uri:t.icon;return e.React.createElement(Ie,{source:n})},usePredicate:t.predicate,useTrailing:t.trailing,onPress:function(){const n=te.getRootNavigationRef(),o=t.page;n.navigate("VendettaCustomPage",{title:t.title(),render:function(){return e.React.createElement(o)}})},withArrow:!0};let d=M.SETTING_RENDERER_CONFIG;Object.defineProperty(M,"SETTING_RENDERER_CONFIG",{enumerable:!0,configurable:!0,get:function(){return{...d,...l}},set:function(n){return d=n}});const i=Symbol("AccountSwitcher-pinToSettings");try{if(!re)return;c.push(P.after("createList",re,function(n,o){if(!n[0][i]){n[0][i]=!0;const[s]=n,r=s.sections,y=r?.find(function(u){return["Bunny","Kettu","Revenge"].includes(u?.label)});y||Boolean(r?.find(function(u){return u.settings.includes("ACCOUNT")}))&&r.unshift({label:a.manifest.name,title:a.manifest.name,settings:[t.key]}),y?.settings&&(y.settings=[...y.settings,t.key])}}))}catch{c.push(P.after("default",ae,function(n,o){if(!n[0][i]){n[0][i]=!0;const{sections:s}=V.findInReactTree(o,function(y){return y.props?.sections}).props,r=s?.find(function(y){return["Bunny","Kettu","Revenge"].includes(y?.label)});r||Boolean(s?.find(function(y){return y.settings.includes("ACCOUNT")}))&&s.unshift({label:a.manifest.name,title:a.manifest.name,settings:[t.key]}),r?.settings&&(r.settings=[...r.settings,t.key])}}))}}function Fe(t){const c=[];let l=!1;const d=t.predicate||function(){return!0};return t.predicate=function(){return l?!1:d()},Pe(t,c),Oe(t,c),c.push(function(){return l=!0}),function(){for(const i of c)i()}}function ze(){if(!a.storage.settings?.addToSidebar)return console.log("[AccountSwitcher] Sidebar disabled in settings"),function(){};console.log("[AccountSwitcher] Patching sidebar using custom patchSettingsPin...");try{const t=Fe({key:"AccountSwitcher",icon:le.getAssetIDByName("UserIcon"),title:function(){return"Account Switcher"},predicate:function(){return a.storage.settings?.addToSidebar===!0},page:ee});return console.log("[AccountSwitcher] Successfully patched sidebar"),t}catch(t){return console.error("[AccountSwitcher] Failed to patch sidebar:",t),function(){}}}const{meta:{resolveSemanticColor:$e}}=k.findByProps("colors","meta"),Ue=k.findByStoreName("ThemeStore"),A=k.findByStoreName("UserStore"),m=function(){return parseInt($e(Ue.theme,ie.semanticColors.BACKGROUND_SECONDARY).slice(1),16)},I={author:{username:"AccountSwitcher",avatar:"command",avatarURL:ye?.command}};a.storage.accounts||(a.storage.accounts={}),a.storage.accountOrder||(a.storage.accountOrder=[]),a.storage.settings?(a.storage.settings.enableUnsafeFeatures===void 0&&(a.storage.settings.enableUnsafeFeatures=!1),a.storage.settings.enableCLI===void 0&&(a.storage.settings.enableCLI=a.storage.settings.showAccountNames!==!1),a.storage.settings.confirmBeforeDelete===void 0&&(a.storage.settings.confirmBeforeDelete=!0),a.storage.settings.addToSidebar===void 0&&(a.storage.settings.addToSidebar=!0),a.storage.settings.showAccountNames!==void 0&&delete a.storage.settings.showAccountNames):a.storage.settings={enableCLI:!0,confirmBeforeDelete:!0,enableUnsafeFeatures:!1,addToSidebar:!0};let H;function S(){return window.sendMessage?window.sendMessage?.(...arguments):(H||(H=fe?.(vendetta)),H?.(...arguments))}function N(t){return!t||!t.username?"Unknown Account":t.username}function ne(t){const c=a.storage.accounts||{},l=a.storage.accountOrder||[],d=parseInt(t);if(!isNaN(d)&&d>=1&&d<=l.length){const i=l[d-1];return c[i]?[i,c[i]]:null}return Object.entries(c).find(function([i,n]){return n.username.toLowerCase()===t.toLowerCase()||N(n).toLowerCase()===t.toLowerCase()})}function L(t){const c=(a.storage.accountOrder||[]).indexOf(t);return c>=0?c+1:null}function De(t){a.storage.accountOrder||(a.storage.accountOrder=[]),a.storage.accountOrder.includes(t)||a.storage.accountOrder.push(t)}function Ve(t){a.storage.accountOrder||(a.storage.accountOrder=[]);const c=a.storage.accountOrder.indexOf(t);c>-1&&a.storage.accountOrder.splice(c,1)}var Le={meta:vendetta.plugin,settings:ee,patches:[],onUnload(){this.patches.forEach(function(t){return t()}),this.patches=[]},onLoad(){const t=ze();this.patches.push(t);const c="Copy Token",l=P.before("render",k.findByProps("ScrollView").View,function(i){try{if(!a.storage.settings?.enableUnsafeFeatures)return;let n=V.findInReactTree(i,function(u){return u.key===".$UserProfileOverflow"});if(!n||!n.props||n.props.sheetKey!=="UserProfileOverflow")return;const o=n.props.content.props;if(o.options.some(function(u){return u?.label===c}))return;const s=A.getCurrentUser()?.id,r=Object.keys(n._owner.stateNode._keyChildMapping).find(function(u){return n._owner.stateNode._keyChildMapping[u]&&u.match(/(?<=\$UserProfile)\d+/)})?.slice?.(13)||s,y=k.findByProps("getToken").getToken();o.options.unshift({isDestructive:!0,label:c,onPress:function(){try{f.showToast(r===s?"Copied your token":`Copied token of ${o.header.title}`),de.setString(r===s?y:[Buffer.from(r).toString("base64").replaceAll("=",""),pe?.(+Date.now()-129384e4,!0)||"dummy",he?.(K,27)||"dummy"].join(".")),o.hideActionSheet()}catch(u){console.error(u),f.showToast("Failed to copy token",1)}}})}catch(n){console.error("Context menu patch error:",n)}});this.patches.push(l);const d={async mainCommand(i,n){try{const o={...I,interaction:{name:"/accswitcher",user:A.getCurrentUser()}};S?.({loggingName:"AccSwitcher main message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F4F1} Account Switcher",description:a.storage.settings.addToSidebar?"Account Manager is available in your settings sidebar!\n\nQuick commands:\n\u2022 `/accswitcher login <#>` - Switch to account\n\u2022 `/accswitcher add` - Add current account\n\u2022 `/accswitcher list` - Show all accounts":"Opening Account Manager...\n\nQuick commands:\n\u2022 `/accswitcher login <#>` - Switch to account\n\u2022 `/accswitcher add` - Add current account\n\u2022 `/accswitcher list` - Show all accounts",footer:{text:a.storage.settings.addToSidebar?"Check your settings sidebar for Account Switcher":"Check plugin settings for the Account Manager interface"}}]},o),f.showToast(a.storage.settings.addToSidebar?"Check settings sidebar for Account Switcher":"Check plugin settings to access Account Manager",0)}catch(o){console.error("Main command error:",o),f.showToast("Check plugin settings to access Account Manager",1)}},async addAccount(i,n){try{const o={...I,interaction:{name:"/accswitcher add",user:A.getCurrentUser()}},s=k.findByProps("getToken").getToken(),r=A.getCurrentUser();if(!r){S?.({loggingName:"Add account error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C Failed to Get Current User",description:"Could not retrieve current user information."}]},o);return}if(a.storage.accounts[r.id]){const p=L(r.id);S?.({loggingName:"Add account warning message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u26A0\uFE0F Account Already Saved",description:`Your current account **${p}. ${r.username}** is already saved.`}]},o);return}const y={id:r.id,username:r.username,discriminator:r.discriminator,avatar:r.avatar,displayName:r.globalName||r.username,token:s,addedAt:Date.now()};a.storage.accounts[r.id]=y,De(r.id);const u=L(r.id);S?.({loggingName:"Add account success message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u2705 Account Added Successfully",description:`**${u}. ${r.username}** has been saved.`,footer:{text:`Total accounts: ${Object.keys(a.storage.accounts).length}`}}]},o)}catch(o){console.error("Add account error:",o),f.showToast("Failed to add account",1)}},async login(i,n){try{const o={...I,interaction:{name:"/accswitcher login",user:A.getCurrentUser()}},s=new Map(i.map(function(h){return[h.name,h]})).get("account")?.value;if(!s){S?.({loggingName:"Login error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C No Account Specified",description:"Please specify an account number, username, or ID."}]},o);return}const r=ne(s);if(!r){const h=(a.storage.accountOrder||[]).filter(function(w){return a.storage.accounts[w]}).map(function(w,C){return`${C+1}. ${N(a.storage.accounts[w])}`}).join(` +`);S?.({loggingName:"Login error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C Account Not Found",description:`Could not find account "${s}".${h?` **Available accounts:** -${y}`:"\n\nNo accounts saved yet. Use `/accswitcher add` first."}`}]},o);return}const[p,l]=r,h=L(p);E?.({loggingName:"Login process message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:`\u{1F504} Switching to ${h}. ${N(l)}...`}]},o);try{await k.findByProps("login","logout","switchAccountToken").switchAccountToken(l.token),f.showToast(`Switched to ${h}. ${N(l)}!`,0)}catch(y){console.error("Switch error:",y),E?.({loggingName:"Login failure message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C Failed to switch accounts",description:`Error: ${y.message}`}]},o)}}catch(o){console.error("Login command error:",o),f.showToast("Failed to execute login command",1)}},listAccounts(i,n){try{const o={...I,interaction:{name:"/accswitcher list",user:A.getCurrentUser()}},s=a.storage.accounts||{},r=Object.keys(s).length;if(r===0){E?.({loggingName:"List accounts empty message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F4DD} No Saved Accounts",description:"Use `/accswitcher add` to save your current account."}]},o);return}const p=(a.storage.accountOrder||[]).filter(function(l){return s[l]}).map(function(l,h){const y=s[l],w=N(y),C=new Date(y.addedAt).toLocaleDateString();return`**${h+1}.** ${w} - Added: ${C}`}).join(` -`);E?.({loggingName:"List accounts message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:`\u{1F4DD} Saved Accounts (${r})`,description:p,footer:{text:"Use /accswitcher login to switch accounts"}}]},o)}catch(o){console.error("List accounts error:",o),f.showToast("Failed to list accounts",1)}},removeAccount(i,n){try{const o={...I,interaction:{name:"/accswitcher remove",user:A.getCurrentUser()}},s=new Map(i.map(function(y){return[y.name,y]})).get("account")?.value;if(!s){E?.({loggingName:"Remove account error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C No Account Specified",description:"Please specify an account number, username, or ID to remove."}]},o);return}const r=ne(s);if(!r){const y=(a.storage.accountOrder||[]).filter(function(w){return a.storage.accounts[w]}).map(function(w,C){return`${C+1}. ${N(a.storage.accounts[w])}`}).join(` -`);E?.({loggingName:"Remove account error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C Account Not Found",description:`Could not find account "${s}".${y?` +${h}`:"\n\nNo accounts saved yet. Use `/accswitcher add` first."}`}]},o);return}const[y,u]=r,p=L(y);S?.({loggingName:"Login process message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:`\u{1F504} Switching to ${p}. ${N(u)}...`}]},o);try{await k.findByProps("login","logout","switchAccountToken").switchAccountToken(u.token),f.showToast(`Switched to ${p}. ${N(u)}!`,0)}catch(h){console.error("Switch error:",h),S?.({loggingName:"Login failure message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C Failed to switch accounts",description:`Error: ${h.message}`}]},o)}}catch(o){console.error("Login command error:",o),f.showToast("Failed to execute login command",1)}},listAccounts(i,n){try{const o={...I,interaction:{name:"/accswitcher list",user:A.getCurrentUser()}},s=a.storage.accounts||{},r=Object.keys(s).length;if(r===0){S?.({loggingName:"List accounts empty message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F4DD} No Saved Accounts",description:"Use `/accswitcher add` to save your current account."}]},o);return}const y=(a.storage.accountOrder||[]).filter(function(u){return s[u]}).map(function(u,p){const h=s[u],w=N(h),C=new Date(h.addedAt).toLocaleDateString();return`**${p+1}.** ${w} - Added: ${C}`}).join(` +`);S?.({loggingName:"List accounts message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:`\u{1F4DD} Saved Accounts (${r})`,description:y,footer:{text:"Use /accswitcher login to switch accounts"}}]},o)}catch(o){console.error("List accounts error:",o),f.showToast("Failed to list accounts",1)}},removeAccount(i,n){try{const o={...I,interaction:{name:"/accswitcher remove",user:A.getCurrentUser()}},s=new Map(i.map(function(h){return[h.name,h]})).get("account")?.value;if(!s){S?.({loggingName:"Remove account error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C No Account Specified",description:"Please specify an account number, username, or ID to remove."}]},o);return}const r=ne(s);if(!r){const h=(a.storage.accountOrder||[]).filter(function(w){return a.storage.accounts[w]}).map(function(w,C){return`${C+1}. ${N(a.storage.accounts[w])}`}).join(` +`);S?.({loggingName:"Remove account error message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u274C Account Not Found",description:`Could not find account "${s}".${h?` **Available accounts:** -${y}`:` +${h}`:` -No accounts saved yet.`}`}]},o);return}const[p,l]=r,h=`${L(p)}. ${N(l)}`;delete a.storage.accounts[p],Ve(p),E?.({loggingName:"Remove account success message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F5D1}\uFE0F Account Removed",description:`**${h}** has been removed from saved accounts.`,footer:{text:`Remaining accounts: ${Object.keys(a.storage.accounts).length}`}}]},o)}catch(o){console.error("Remove account error:",o),f.showToast("Failed to remove account",1)}},getCurrentToken(i,n){try{const o={...I,interaction:{name:"/accswitcher token",user:A.getCurrentUser()}};if(!a.storage.settings?.enableUnsafeFeatures){E?.({loggingName:"Get token disabled message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F512} Unsafe Features Disabled",description:"Token access is disabled. Enable 'Unsafe Features' in plugin settings to use this command."}]},o);return}const{getToken:s}=k.findByProps("getToken"),r=s();E?.({loggingName:"Get token message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F511} Current Account Token",description:`\`${r}\``,footer:{text:"\u26A0\uFE0F Keep your token secure and never share it!"}}]},o)}catch(o){console.error("Get token error:",o),f.showToast("Failed to get current token",1)}}};try{[{type:1,inputType:1,applicationId:"-1",execute:d.mainCommand,name:"accswitcher",description:"Open Account Switcher (check plugin settings)",options:[]},{type:1,inputType:1,applicationId:"-1",execute:d.addAccount,name:"accswitcher add",description:"Add your current account to saved accounts",options:[]},{type:1,inputType:1,applicationId:"-1",execute:d.login,name:"accswitcher login",description:"Switch to a saved account",options:[{required:!0,type:3,name:"account",description:"Account number, username, or ID to switch to"}]},{type:1,inputType:1,applicationId:"-1",execute:d.listAccounts,name:"accswitcher list",description:"Show all saved accounts",options:[]},{type:1,inputType:1,applicationId:"-1",execute:d.removeAccount,name:"accswitcher remove",description:"Remove a saved account",options:[{required:!0,type:3,name:"account",description:"Account number, username, or ID to remove"}]},{type:1,inputType:1,applicationId:"-1",execute:d.getCurrentToken,name:"accswitcher token",description:"Get your current account token (requires unsafe features)",options:[]}].forEach(function(i){try{se.registerCommand(i)}catch(n){console.error(`Failed to register command ${i.name}:`,n)}}),console.log("Account Switcher plugin loaded successfully")}catch(i){console.error("Failed to register commands:",i)}}};return D.EMBED_COLOR=m,D.default=Le,Object.defineProperty(D,"__esModule",{value:!0}),D})({},vendetta.ui,vendetta.commands,vendetta.metro,vendetta.utils,vendetta.metro.common.clipboard,vendetta.patcher,vendetta.ui.toasts,vendetta.plugin,vendetta.metro.common,vendetta.storage,vendetta.ui.alerts,vendetta.ui.assets,vendetta.ui.components,vendetta); +No accounts saved yet.`}`}]},o);return}const[y,u]=r,p=`${L(y)}. ${N(u)}`;delete a.storage.accounts[y],Ve(y),S?.({loggingName:"Remove account success message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F5D1}\uFE0F Account Removed",description:`**${p}** has been removed from saved accounts.`,footer:{text:`Remaining accounts: ${Object.keys(a.storage.accounts).length}`}}]},o)}catch(o){console.error("Remove account error:",o),f.showToast("Failed to remove account",1)}},getCurrentToken(i,n){try{const o={...I,interaction:{name:"/accswitcher token",user:A.getCurrentUser()}};if(!a.storage.settings?.enableUnsafeFeatures){S?.({loggingName:"Get token disabled message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F512} Unsafe Features Disabled",description:"Token access is disabled. Enable 'Unsafe Features' in plugin settings to use this command."}]},o);return}const{getToken:s}=k.findByProps("getToken"),r=s();S?.({loggingName:"Get token message",channelId:n.channel.id,embeds:[{color:m(),type:"rich",title:"\u{1F511} Current Account Token",description:`\`${r}\``,footer:{text:"\u26A0\uFE0F Keep your token secure and never share it!"}}]},o)}catch(o){console.error("Get token error:",o),f.showToast("Failed to get current token",1)}}};try{[{type:1,inputType:1,applicationId:"-1",execute:d.mainCommand,name:"accswitcher",description:"Open Account Switcher (check plugin settings)",options:[]},{type:1,inputType:1,applicationId:"-1",execute:d.addAccount,name:"accswitcher add",description:"Add your current account to saved accounts",options:[]},{type:1,inputType:1,applicationId:"-1",execute:d.login,name:"accswitcher login",description:"Switch to a saved account",options:[{required:!0,type:3,name:"account",description:"Account number, username, or ID to switch to"}]},{type:1,inputType:1,applicationId:"-1",execute:d.listAccounts,name:"accswitcher list",description:"Show all saved accounts",options:[]},{type:1,inputType:1,applicationId:"-1",execute:d.removeAccount,name:"accswitcher remove",description:"Remove a saved account",options:[{required:!0,type:3,name:"account",description:"Account number, username, or ID to remove"}]},{type:1,inputType:1,applicationId:"-1",execute:d.getCurrentToken,name:"accswitcher token",description:"Get your current account token (requires unsafe features)",options:[]}].forEach(function(i){try{se.registerCommand(i)}catch(n){console.error(`Failed to register command ${i.name}:`,n)}}),console.log("Account Switcher plugin loaded successfully")}catch(i){console.error("Failed to register commands:",i)}}};return D.EMBED_COLOR=m,D.default=Le,Object.defineProperty(D,"__esModule",{value:!0}),D})({},vendetta.ui,vendetta.commands,vendetta.metro,vendetta.utils,vendetta.metro.common.clipboard,vendetta.patcher,vendetta.ui.toasts,vendetta.plugin,vendetta.metro.common,vendetta.storage,vendetta.ui.alerts,vendetta.ui.assets,vendetta.ui.components,vendetta); diff --git a/MoreAlts/manifest.json b/MoreAlts/manifest.json index 436d23b..efb63f7 100644 --- a/MoreAlts/manifest.json +++ b/MoreAlts/manifest.json @@ -1 +1 @@ -{"name":"More Alts!","description":"Adds ability to safely add more alts to Discord!","authors":[{"name":"Win8.1VMUser","id":"793935599702507542"}],"main":"index.js","vendetta":{"icon":"ic_full_server_gating_24px"},"hash":"47bc2b8b765a45ff5c9a468c8ded4dac581e99cf8a77f437ff2e62ab4c216421"} \ No newline at end of file +{"name":"More Alts!","description":"Adds ability to safely add more alts to Discord!","authors":[{"name":"Win8.1VMUser","id":"793935599702507542"}],"main":"index.js","vendetta":{"icon":"ic_full_server_gating_24px"},"hash":"b0d9e11c8494ee8576acad9b9f2c8d4207acef861a810209dbd77db0c3e12d8f"} \ No newline at end of file