diff --git a/Commands/index.js b/Commands/index.js new file mode 100644 index 0000000..b266148 --- /dev/null +++ b/Commands/index.js @@ -0,0 +1,19 @@ +(function(ne,Ye,r,u,p,O,N,y,e,ye,o,S,I,Je,j,ae){"use strict";const Qe=async function(){const t=await(await fetch("https://uselessfacts.jsph.pl/api/v2/facts/random")).json();return{text:t.text,source:t.source,language:t.language}},Ze=async function(){return{text:(await(await fetch("https://dogapi.dog/api/v2/facts?limit=1")).json()).data[0].attributes.body}},et=async function(){const t=await(await fetch("https://catfact.ninja/fact")).json();return{text:t.fact,length:t.length}},tt=async function(t){return await(await fetch(`https://api.obamabot.me/v2/image/petpet?image=${t.replace("webp","png")}`)).json()},nt=async function(t="gary"){try{switch(t){case"gary":return(await(await fetch("https://api.garythe.cat/gary")).json()).url;case"goober":return(await(await fetch("https://api.garythe.cat/goober")).json()).url;case"catapi":return(await(await fetch("https://api.thecatapi.com/v1/images/search")).json())[0].url;case"minker":return"https://minky.materii.dev/";default:throw new Error("Invalid Gary image source value")}}catch(n){return console.error(`[Gary API] Error fetching image from ${t}:`,n),null}},re=u.findByProps("sendMessage"),ie=function(t){let n=t.text;return r.storage.factSettings?.includeCitation&&t.source&&(n+=` + +Source: ${t.source}`),n},at={name:"catfact",displayName:"catfact",description:"Sends a random cat fact.",displayDescription:"Sends a random cat fact.",applicationId:"-1",inputType:1,type:1,execute:async function(t,n){try{const a=await et(),i=Date.now().toString();return re.sendMessage(n.channel.id,{content:ie(a)},void 0,{nonce:i}),null}catch(a){return console.error("[CatFact] Error:",a),p.showToast("Failed to fetch cat fact",3e3),null}}},rt={name:"dogfact",displayName:"dogfact",description:"Sends a dog fact.",displayDescription:"Sends a dog fact.",applicationId:"-1",inputType:1,type:1,execute:async function(t,n){try{const a=await Ze(),i=Date.now().toString();return re.sendMessage(n.channel.id,{content:ie(a)},void 0,{nonce:i}),null}catch(a){return console.error("[DogFact] Error:",a),p.showToast("Failed to fetch dog fact",3e3),null}}},it={name:"useless",displayName:"useless",description:"Sends a useless fact.",displayDescription:"Sends a useless fact.",applicationId:"-1",inputType:1,type:1,execute:async function(t,n){try{const a=await Qe(),i=Date.now().toString();return re.sendMessage(n.channel.id,{content:ie(a)},void 0,{nonce:i}),null}catch(a){return console.error("[UselessFact] Error:",a),p.showToast("Failed to fetch useless fact",3e3),null}}},D={CONTENT:"This list is over 2000 characters. Send anyway?",CONFIRM:"Send",CANCEL:"Cancel"},st={DETAILED:"detailed"},se="",z={SLM_NOT_INSTALLED:"This list is over 2000 characters. Install the Split Large Messages plugin to send it.",SLM_NOT_ENABLED:"This list is over 2000 characters. Enable the Split Large Messages plugin to send it."},he={SEMICOL:"; ",NEW_LINE:` +`},ot="Nothing to see here, huh...",me="github.com/fres621/vendetta-plugins",T={ENABLED:"\u2705",DISABLED:"\u274C",SELECTED:"\u2705",NOT_SELECTED:"\u274C"},ct=u.findByProps("sendMessage","receiveMessage"),k=u.findByProps("sendBotMessage"),pe=(function(){try{return u.findByStoreName("UserStore").getCurrentUser()?.premiumType===2?4e3:2e3}catch{return 2e3}})(),Ce=function(t){return Object.keys(t).includes(me)},be=function(t){return Object.values(t).find(function(n){return n.id==me})?.enabled},ve=function(t){return t.find(function(n){return n.name===st.DETAILED})?.value??!1},H=function(t){return!t||!Array.isArray(t)||t.length===0?"Unknown":t.filter(function(n){return n&&(typeof n=="string"||typeof n=="object"&&n.name)}).map(function(n){return typeof n=="string"?n:n.name||"Unknown"}).join(he.SEMICOL)||"Unknown"},Re=function(t){return t.join(he.NEW_LINE).trimEnd()},K=function(t){return Re(t).length},q=async function(t,n){const a=Date.now().toString();await ct.sendMessage(t,{content:Re(n)},void 0,{nonce:a})},Ie=function(t,n){return[`**My ${t} List | ${n} ${t}s**`,se]};async function lt(t,n){try{const a=ve(t),i=r.storage.themeListAlwaysDetailed??!1;if(!O.themes||typeof O.themes!="object"){const g=n.channel.id;return k.sendBotMessage(g,"No themes found or themes not loaded yet."),null}const s=Object.values(O.themes),c=n.channel.id,d=Ie("Theme",Object.keys(O.themes).length);if(s.length)for(const g of s){if(!g||typeof g!="object")continue;const{selected:f,data:h,id:b}=g,w=h?.name||"Unknown Theme",R=h?.description||"No description",E=h?.authors;a||i?d.push(`> **Name**: ${w}`,`> **Selected**: ${f?T.SELECTED:T.NOT_SELECTED}`,`> **Description**: ${R}`,`> **Authors**: ${H(E)}`,`> **[Install!](${b||"unknown"})**`,se):d.push(`> ${f?T.SELECTED:T.NOT_SELECTED} **${w}** by ${H(E)}`)}else d.push(ot);const l=K(d)>pe;if(l&&!Ce(N.plugins))k.sendBotMessage(c,z.SLM_NOT_INSTALLED);else if(l&&!be(N.plugins))k.sendBotMessage(c,z.SLM_NOT_ENABLED);else{if(K(d)>2e3)return y.alerts.showConfirmationAlert({content:D.CONTENT,confirmText:D.CONFIRM,cancelText:D.CANCEL,onConfirm:async function(){return await q(c,d)}});await q(c,d)}}catch(a){return console.error("[ThemeList] Error:",a),null}}async function dt(t,n){try{const a=ve(t),i=r.storage.pluginListAlwaysDetailed??!1,s=n.channel.id;if(!N.plugins||typeof N.plugins!="object")return k.sendBotMessage(s,"No plugins found or plugins not loaded yet."),null;const c=Ie("Plugin",Object.keys(N.plugins).length);for(const l of Object.values(N.plugins)){if(!l||typeof l!="object")continue;const{enabled:g,manifest:f,id:h}=l,b=f?.name||"Unknown Plugin",w=f?.description||"No description",R=f?.authors;a||i?c.push(`> **Name**: ${b}`,`> **Status**: ${g?T.ENABLED:T.DISABLED}`,`> **Description**: ${w}`,`> **Authors**: ${H(R)}`,`> **[Install!](${h||"unknown"})**`,se):c.push(`> ${g?T.ENABLED:T.DISABLED} **${b}** by ${H(R)}`)}const d=K(c)>pe;if(d&&!Ce(N.plugins))k.sendBotMessage(s,z.SLM_NOT_INSTALLED);else if(d&&!be(N.plugins))k.sendBotMessage(s,z.SLM_NOT_ENABLED);else{if(K(c)>2e3)return y.alerts.showConfirmationAlert({content:D.CONTENT,confirmText:D.CONFIRM,cancelText:D.CANCEL,onConfirm:async function(){return await q(s,c)}});await q(s,c)}}catch(a){return console.error("[PluginList] Error:",a),null}}const ut={name:"plugin-list",displayName:"plugin list",description:"Send your plugin list to the current channel",displayDescription:"Send your plugin list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:dt,applicationId:"-1",inputType:1,type:1},gt={name:"theme-list",displayName:"theme list",description:"Send your theme list to the current channel",displayDescription:"Send your theme list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:lt,applicationId:"-1",inputType:1,type:1},ft=u.findByStoreName("UserStore"),yt=u.findByProps("sendMessage"),ht={name:"petpet",displayName:"petpet",description:"PetPet someone",displayDescription:"PetPet someone",options:[{name:"user",description:"The user(or their id) to be patted",type:6,required:!0,displayName:"user",displayDescription:"The user(or their id) to be patted"}],execute:async function(t,n){try{const a=(await ft.getUser(t[0].value)).getAvatarURL(512),i=await tt(a),s=Date.now().toString();return yt.sendMessage(n.channel.id,{content:i.url},void 0,{nonce:s}),null}catch(a){return console.error("[PetPet] Error:",a),null}},applicationId:"-1",inputType:1,type:1},mt=u.findByProps("sendMessage"),pt=u.findByProps("sendBotMessage","sendMessage","receiveMessage"),we=async function(t){const n="https://konachan.com/post.json",a=t?"rating:explicit":"rating:safe",i=Math.floor(Math.random()*100);try{const s=await(await fetch(`${n}?tags=${a}&limit=1&page=${i}`)).json();return!Array.isArray(s)||s.length===0?null:s[0].file_url}catch(s){return console.error("[KonoChan Randomizer] Error fetching image:",s),null}},Se=function(){return new Promise(function(t){y.alerts.showConfirmationAlert({title:"NSFW Content Warning",content:"NSFW content can only be sent in NSFW channels!",confirmText:"Okay",cancelText:"Cancel",confirmColor:"brand",isDismissable:!0,onConfirm:function(){return t(!0)},onCancel:function(){return t(!1)}})})},Ee={name:"nsfw",description:"Include NSFW content?",type:5,required:!1,displayName:"nsfw",displayDescription:"Include NSFW content?"},Ct={name:"konoself",displayName:"konoself",description:"Fetch a random image from KonoChan for yourself.",displayDescription:"Fetch a random image from KonoChan for yourself.",options:[Ee],execute:async function(t,n){try{const a=new Map((t||[]).map(function(c){return[c.name,c]})).get("nsfw")?.value||!1,i=r.storage.hiddenSettings?.konochanBypassNsfw||!1;if(console.log(`[KonoSelf] NSFW: ${a}, Channel NSFW: ${n.channel.nsfw}, Bypass: ${i}`),a&&!n.channel.nsfw&&!i)return Se(),null;const s=await we(a);return s&&pt.sendBotMessage(n.channel.id,`Here's your random image: ${s}`),null}catch(a){return console.error("[KonoSelf] Error:",a),null}},applicationId:"-1",inputType:1,type:1},bt={name:"konosend",displayName:"konosend",description:"Fetch a random image from KonoChan and send it to the channel.",displayDescription:"Fetch a random image from KonoChan and send it to the channel.",options:[Ee],execute:async function(t,n){try{const a=new Map((t||[]).map(function(d){return[d.name,d]})).get("nsfw")?.value||!1,i=r.storage.hiddenSettings?.konochanBypassNsfw||!1;if(console.log(`[KonoSend] NSFW: ${a}, Channel NSFW: ${n.channel.nsfw}, Bypass: ${i}`),a&&!n.channel.nsfw&&!i)return Se(),null;const s=await we(a);if(!s)return null;const c=Date.now().toString();return mt.sendMessage(n.channel.id,{content:s},void 0,{nonce:c}),null}catch(a){return console.error("[KonoSend] Error:",a),{type:4}}},applicationId:"-1",inputType:1,type:1},Ne=u.findByProps("getAPIBaseURL","get"),vt=u.findByProps("sendMessage"),Rt=async function(t,n,a){const i=n?`&author_id=${n}`:"",s=a?`&channel_id=${a}`:"",c=n?"":"&min_id=0";return(await Ne.get({url:`/guilds/${t}/messages/search`,query:`include_nsfw=true${i}${s}${c}&sort_by=timestamp&sort_order=asc&offset=0`})).body.messages[0][0]},It=async function(t,n){const a=n?`&author_id=${n}`:"",i=n?"":"&min_id=0";return(await Ne.get({url:`/channels/${t}/messages/search`,query:`&sort_by=timestamp&sort_order=asc&offset=0${a}${i}`})).body.messages[0][0]},wt={name:"firstmessage",displayName:"firstmessage",description:"Tired of scrolling to first message?",displayDescription:"Tired of scrolling to first message?",options:[{name:"user",displayName:"user",description:"Target user to get their first message in this server/dm",displayDescription:"Target user to get their first message in this server/dm",type:6,required:!1},{name:"channel",displayName:"channel",description:"Target channel to get first message of",displayDescription:"Target channel to get first message of",type:7,required:!1},{name:"send",displayName:"send",description:"Whether to send the resulting url",displayDescription:"Whether to send the resulting url",type:5,required:!1}],execute:async function(t,n){try{const a=new Map(t.map(function(b){return[b.name,b]})),i=a.get("user")?.value,s=a.get("channel")?.value,c=a.get("send")?.value,d=n.guild?.id,l=n.channel.id,g=n.channel.type===1;if(g&&s)return p.showToast("Channel option cannot be used in DMs",3e3),null;let f="https://discord.com/channels/",h;if(g)h=await It(l,i),f+=`@me/${l}/${h.id}`;else{h=await Rt(d,i,s);const b=s||h.channel_id;f+=`${d}/${b}/${h.id}`}if(c){const b=Date.now().toString();vt.sendMessage(n.channel.id,{content:f},void 0,{nonce:b})}else e.ReactNative.Linking.openURL(f);return null}catch(a){return console.error("[FirstMessage] Error:",a),p.showToast("Failed to fetch first message",3e3),null}},applicationId:"-1",inputType:1,type:1},St=u.findByProps("sendMessage"),Et=u.findByProps("sendBotMessage","sendMessage","receiveMessage");function Nt(){let{height:t,width:n,scale:a}=e.ReactNative.Dimensions.get("screen");return t*=a,n*=a,{width:n,height:t}}function Tt(){try{const t=new Date,n=new Date(t.getTime()+t.getTimezoneOffset()*6e4),a=n.getFullYear(),i=String(n.getMonth()+1).padStart(2,"0"),s=String(n.getDate()).padStart(2,"0"),c=String(n.getHours()).padStart(2,"0"),d=String(n.getMinutes()).padStart(2,"0"),l=String(n.getSeconds()).padStart(2,"0");return`${a}-${i}-${s} ${c}:${d}:${l}`}catch{return"Unknown"}}function At(){try{const t=u.findByProps("memory");if(!t)return{cpuCoreCount:"N/A",cpuPerc:"N/A",memUsage:"N/A"};const{cpuCoreCount:n,cpuPercentage:a,memory:i}=t,s=a?a.toFixed(2)+"%":"N/A",c=i?parseFloat((i/1e3).toPrecision(3))+" MB":"N/A";return{cpuCoreCount:n,cpuPerc:s,memUsage:c}}catch(t){return console.warn("Hardware info unavailable:",t),{cpuCoreCount:"N/A",cpuPerc:"N/A",memUsage:"N/A"}}}function Dt(){try{const{NativeModules:t}=e.ReactNative;return(t.InfoDictionaryManager??t.RTNClientInfoManager)||{}}catch(t){return console.warn("Discord info unavailable:",t),{}}}function kt(){try{const{cpuCoreCount:t,cpuPerc:n,memUsage:a}=At(),i=Dt(),s=(typeof ye.getDebugInfo=="function"?ye.getDebugInfo():{})||{},{vendetta:c,discord:d,react:l,hermes:g,os:f,device:h}=s,b=Tt(),{version:w,bytecodeVersion:R}=g||{},{version:E,nativeVersion:B}=l||{},{name:v,version:A,sdk:G}=f||{},{manufacturer:P,brand:Ke,model:qe,codename:Fn}=h||{},{version:Vn}=c||{},{version:Un,build:Wn}=d||{},Gn=v=="iOS"?Fn:`${Ke} ${qe}`,{width:On,height:jn}=Nt(),Xe={Device:{Device:Gn||"Unknown",Model:qe||"Unknown",Manufacturer:P||"Unknown",Brand:Ke||"Unknown",Display:`${On}x${jn}`},Hardware:{"CPU Cores":t||"N/A","CPU Usage":n,"Memory Usage":a},Software:{OS:v||"Unknown",Version:A||"Unknown"},Discord:{Version:Un||"Unknown",Build:Wn||"Unknown",Vendetta:Vn||"Unknown"},React:{Version:E||"Unknown","Hermes Bytecode":R||"Unknown",Hermes:w||"Unknown",Native:B||"Unknown"},Time:{UTC:b}};return G&&(Xe.Software["SDK Version"]=G),Xe}catch(t){throw console.error("Error generating system info:",t),t}}const Te=["device","hardware","software","discord","react","time","ephemeral"];for(const t of Te)r.storage[t]===void 0&&(r.storage[t]=!0);function Bt(t,n){try{const a=[`__System Information__ +`],i=kt();Object.keys(i).forEach(function(d){const l=r.storage[d.toLowerCase()],g=t.find(function(f){return f.name==d.toLowerCase()})?.value??l;(g||l)&&!(l&&!g)&&(a.push(`[**${d}**]`),Object.keys(i[d]).forEach(function(f){a.push(`> ${f}: ${i[d][f]}`)}))});const s=r.storage.ephemeral,c=t.find(function(d){return d.name=="ephemeral"})?.value??s;if((c||s)&&!(s&&!c))return Et.sendBotMessage(n.channel.id,a.join(` +`)),null;{const d=Date.now().toString();return St.sendMessage(n.channel.id,{content:a.join(` +`)},void 0,{nonce:d}),null}}catch(a){return console.error("[Sysinfo] Error:",a),null}}const Pt={name:"sysinfo",displayName:"sysinfo",description:"Display system information",displayDescription:"Display system information",options:[{name:"ephemeral",displayName:"ephemeral",description:"Keep sysinfo ephemeral (default: true)",displayDescription:"Keep sysinfo ephemeral (default: true)",type:5,required:!1},...Te.slice(0,-1).map(function(t){return{name:t,displayName:t,description:`Display the ${t} section. Set default in settings.`,displayDescription:`Display the ${t} section. Set default in settings.`,type:5,required:!1}})],execute:Bt,applicationId:"-1",inputType:1,type:1},Ae=u.findByProps("sendMessage","receiveMessage"),xt=u.findByStoreName("SpotifyStore");async function $t(t,n){return r.storage.enabledCommands?.spotifyTrack?X(n,function(a){return`https://open.spotify.com/track/${a.id}`}):null}async function Lt(t,n){return r.storage.enabledCommands?.spotifyAlbum?X(n,function(a){return`https://open.spotify.com/album/${a.album.id}`}):null}async function Mt(t,n){return r.storage.enabledCommands?.spotifyArtists?X(n,function(a){return a.artists.map(function(i){return`[${i.name}](${i.external_urls.spotify})`}).join(` +`)}):null}async function _t(t,n){return r.storage.enabledCommands?.spotifyCover?X(n,function(a){return a.album.image.url}):null}async function X(t,n){try{const a=t.channel.id,i=xt?.getTrack?.();if(!i){const d=Date.now().toString();return Ae.sendMessage(a,{content:"You are not listening to any track."},void 0,{nonce:d}),null}const s=n(i),c=Date.now().toString();return Ae.sendMessage(a,{content:s},void 0,{nonce:c}),null}catch(a){return console.error("[Spotify Command] Error:",a),null}}const Ft={name:"spotify track",displayName:"spotify track",description:"Sends your current Spotify track",displayDescription:"Sends your current Spotify track",applicationId:"-1",inputType:1,type:1,execute:$t},Vt={name:"spotify album",displayName:"spotify album",description:"Sends your current track's album",displayDescription:"Sends your current track's album",applicationId:"-1",inputType:1,type:1,execute:Lt},Ut={name:"spotify artists",displayName:"spotify artists",description:"Sends your current track's artists",displayDescription:"Sends your current track's artists",applicationId:"-1",inputType:1,type:1,execute:Mt},Wt={name:"spotify cover",displayName:"spotify cover",description:"Sends your current track's cover",displayDescription:"Sends your current track's cover",applicationId:"-1",inputType:1,type:1,execute:_t},Gt=u.findByProps("sendMessage"),Ot={name:"gary",displayName:"gary",description:"Send a random Gary image to the channel.",displayDescription:"Send a random Gary image to the channel.",options:[],execute:async function(t,n){try{r.storage.garySettings||(r.storage.garySettings={imageSource:"gary"});const a=r.storage.garySettings.imageSource||"gary";console.log(`[Gary Command] Using image source: ${a}`);const i=await nt(a);if(!i)return console.log("[Gary Command] No image URL received"),null;console.log(`[Gary Command] Sending image: ${i}`);const s=Date.now().toString();return Gt.sendMessage(n.channel.id,{content:i},void 0,{nonce:s}),{type:4}}catch(a){return console.error("[Gary] Error:",a),null}},applicationId:"-1",inputType:1,type:1},De=u.findByProps("sendMessage","receiveMessage"),jt=u.findByProps("getLastSelectedChannelId"),zt=u.findByProps("createBotMessage"),Ht=u.findByProps("BOT_AVATARS");function Y(t,n,a){const i=t??jt?.getChannelId?.(),s=zt.createBotMessage({channelId:i,content:"",embeds:a});s.author.username="Astolfo",s.author.avatar="Astolfo",Ht.BOT_AVATARS.Astolfo="https://i.pinimg.com/736x/50/77/1f/50771f45b1c015cfbb8b0853ba7b8521.jpg",typeof n=="string"?s.content=n:Object.assign(s,n),De.receiveMessage(i,s)}const Kt={name:"lovefemboys",displayName:"lovefemboys",description:"Get an image of a femboy",displayDescription:"Get an image of a femboy",options:[{name:"nsfw",displayName:"nsfw",description:"Get the result from r/femboys instead of r/femboy (NSFW)",displayDescription:"Get the result from r/femboys instead of r/femboy (NSFW)",required:!1,type:5},{name:"sort",displayName:"sort",description:"Changes the way reddit sorts.",displayDescription:"Changes the way reddit sorts",required:!1,type:3},{name:"silent",displayName:"silent",description:"Makes it so only you can see the message.",displayDescription:"Makes it so only you can see the message.",required:!1,type:5}],applicationId:"-1",inputType:1,type:1,execute:async function(t,n){try{const a=t.find(function(l){return l.name==="nsfw"})?.value;let i=t.find(function(l){return l.name==="sort"})?.value;const s=t.find(function(l){return l.name==="silent"})?.value;if(typeof i>"u"&&(i=r.storage.sortdefs),!["best","hot","new","rising","top","controversial"].includes(i)){Y(n.channel.id,"Incorrect sorting type. Valid options are\n`best`, `hot`, `new`, `rising`, `top`, `controversial`.",[]);return}if(a&&!await new Promise(function(l){y.alerts.showConfirmationAlert({title:"\u26A0\uFE0F NSFW Content Warning",content:"This command will send NSFW (Not Safe For Work) content from r/femboys. Are you sure you want to continue?",confirmText:"Yes, Continue",onConfirm:function(){return l(!0)},cancelText:"Cancel",onCancel:function(){return l(!1)}})}))return null;let c=await fetch(`https://www.reddit.com/r/femboy/${i}.json?limit=100`).then(function(l){return l.json()});if(!n.channel.nsfw_&&a&&r.storage.nsfwwarn&&!(s??!0)){Y(n.channel.id,`This channel is not marked as NSFW +(You can disable this check in plugin settings)`,[]);return}a&&(c=await fetch(`https://www.reddit.com/r/femboys/${i}.json?limit=100`).then(function(l){return l.json()})),c=c.data?.children?.[Math.floor(Math.random()*c.data?.children?.length)]?.data;const d=await fetch(`https://www.reddit.com/u/${c?.author}/about.json`).then(function(l){return l.json()});if(s??!0)Y(n.channel.id,"",[{type:"rich",title:c?.title,url:`https://reddit.com${c?.permalink}`,author:{name:`u/${c?.author} \u2022 r/${c?.subreddit}`,proxy_icon_url:d?.data.icon_img.split("?")[0],icon_url:d?.data.icon_img.split("?")[0]},image:{proxy_url:c?.url_overridden_by_dest?.replace(/.gifv$/g,".gif")??c?.url.replace(/.gifv$/g,".gif"),url:c?.url_overridden_by_dest?.replace(/.gifv$/g,".gif")??c?.url?.replace(/.gifv$/g,".gif"),width:c?.preview?.images?.[0]?.source?.width,height:c?.preview?.images?.[0]?.source?.height},color:"0xf4b8e4"}]);else{const l=Date.now().toString();De.sendMessage(n.channel.id,{content:c?.url_overridden_by_dest??c?.url},void 0,{nonce:l})}}catch(a){console.error("[LoveFemboys] Error:",a),Y(n.channel.id,"ERROR !!!!!!!!!!!! \u{1F62D}\u{1F62D}\u{1F62D} Check debug logs!! \u{1F97A}\u{1F97A}\u{1F97A}",[])}}},qt=u.findByProps("sendMessage"),Xt=u.findByProps("sendBotMessage","sendMessage","receiveMessage"),Yt={name:"ip",displayName:"ip",description:"IP address and domain lookup",displayDescription:"IP address and domain lookup",options:[{name:"query",displayName:"query",description:"Enter IPv4/IPv6 address or domain name",displayDescription:"Enter IPv4/IPv6 address or domain name",type:3,required:!0},{name:"send",displayName:"send",description:"Send to chat",displayDescription:"Send to chat",type:5,required:!1},{name:"ephemeral",displayName:"ephemeral",description:"Send as ephemeral message (only you can see)",displayDescription:"Send as ephemeral message (only you can see)",type:5,required:!1}],execute:async function(t,n){try{const a=t.find(function(f){return f.name==="query"})?.value,i=t.find(function(f){return f.name==="send"})?.value||!1,s=t.find(function(f){return f.name==="ephemeral"})?.value||!1;if(!a){const f="\u274C Query parameter is required!";return s?{type:4,data:{content:f,flags:64}}:(p.showToast(f,o.getAssetIDByName("CircleXIcon")),null)}!s&&!i&&p.showToast(`Looking up IP information for ${a}...`,o.getAssetIDByName("DownloadIcon"));const c=`http://ipwhois.app/json/${encodeURIComponent(a)}?objects=success,ip,type,as,org,isp,continent,country,country_capital,city,region,country_phone,latitude,longitude,timezone,currency,completed_requests`,d=await fetch(c);if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);const l=await d.json();if(!l.success){const f=`\u274C Failed to lookup IP information for: ${a}`;return s?{type:4,data:{content:f,flags:64}}:(p.showToast(f,o.getAssetIDByName("CircleXIcon")),null)}const g=`\`\`\`json +${JSON.stringify(l,null,4)} +\`\`\``;if(s)return{type:4,data:{content:g,flags:64}};if(i){const f=Date.now().toString();return qt.sendMessage(n.channel.id,{content:g},void 0,{nonce:f}),{type:4}}else return Xt.sendBotMessage(n.channel.id,g),null}catch(a){console.error("[IP] Command error:",a);const i=`\u274C An error occurred while looking up IP information: ${a.message||"Unknown error"}`;return t?.find?.(function(s){return s.name==="ephemeral"})?.value??!1?{type:4,data:{content:i,flags:64}}:(p.showToast(i,o.getAssetIDByName("CircleXIcon")),null)}},applicationId:"-1",inputType:1,type:1},Jt=u.findByProps("sendMessage"),Qt=u.findByProps("sendBotMessage","sendMessage","receiveMessage"),Zt=["avatar","classic","cuddle","fox_girl","gecg","holo","kemonomimi","kiss","neko","ngif","smug","spank","tickle","waifu","wallpaper","woof"];async function en(t,n){const a=[];for(let i=0;i0&&await new Promise(function(d){return setTimeout(d,1e3)});const s=await fetch(`https://nekos.life/api/v2/img/${t}`);if(!s.ok){console.error(`[NekosLife] API request failed: ${s.status}`);continue}const c=await s.json();c.url&&a.push(c.url)}catch(s){console.error(`[NekosLife] Error fetching image ${i+1}:`,s)}return a}function tn(t){return!t||typeof t!="string"?!1:Zt.includes(t.toLowerCase().trim())}const nn={name:"nekoslife",displayName:"nekoslife",description:"Get SFW images/gifs from nekos.life",displayDescription:"Get SFW images/gifs from nekos.life",options:[{name:"category",displayName:"category",description:"Category name (e.g. neko, waifu, cuddle, etc.)",displayDescription:"Category name (e.g. neko, waifu, cuddle, etc.)",type:3,required:!0},{name:"limit",displayName:"limit",description:"Number of images (1-5, default: 1)",displayDescription:"Number of images (1-5, default: 1)",type:4,required:!1},{name:"send",displayName:"send",description:"Send to chat",displayDescription:"Send to chat",type:5,required:!1},{name:"ephemeral",displayName:"ephemeral",description:"Send as ephemeral message (only you can see)",displayDescription:"Send as ephemeral message (only you can see)",type:5,required:!1}],execute:async function(t,n){try{console.log("[NekosLife] Command executed with args:",t);const a=t.find(function(h){return h.name==="category"})?.value,i=t.find(function(h){return h.name==="limit"})?.value,s=t.find(function(h){return h.name==="send"})?.value||!1,c=t.find(function(h){return h.name==="ephemeral"})?.value||!1;if(console.log("[NekosLife] Parsed values:",{categoryInput:a,limitInput:i,shouldSend:s,isEphemeral:c}),!a||typeof a!="string"){const h="\u274C Category is required! Examples: neko, waifu, cuddle, kiss";return console.error("[NekosLife] No category provided"),c?{type:4,data:{content:h,flags:64}}:(p.showToast(h,o.getAssetIDByName("CircleXIcon")),null)}const d=a.toLowerCase().trim();if(!tn(d)){const h=`\u274C Invalid SFW category "${a}". Valid: neko, waifu, cuddle, kiss, holo, etc.`;return c?{type:4,data:{content:h,flags:64}}:(p.showToast(h,o.getAssetIDByName("CircleXIcon")),null)}let l=1;i!=null&&(l=parseInt(String(i))||1,l=Math.max(1,Math.min(5,l))),console.log("[NekosLife] Processing SFW request:",{category:d,limit:l,shouldSend:s,isEphemeral:c}),c||p.showToast(`Fetching ${l} SFW image(s) from nekos.life...`,o.getAssetIDByName("DownloadIcon"));const g=await en(d,l);if(g.length===0){const h="\u274C Failed to fetch images from nekos.life. Try again later!";return c?{type:4,data:{content:h,flags:64}}:(p.showToast(h,o.getAssetIDByName("CircleXIcon")),null)}const f=g.join(` +`);if(c)return console.log("[NekosLife] Sending ephemeral response"),{type:4,data:{content:f,flags:64}};if(s){console.log("[NekosLife] Sending to chat");const h=Date.now().toString();return Jt.sendMessage(n.channel.id,{content:f},void 0,{nonce:h}),null}else return console.log("[NekosLife] Sending as bot message"),Qt.sendBotMessage(n.channel.id,f),null}catch(a){console.error("[NekosLife] Command error:",a);const i="\u274C An error occurred while fetching images.";return t?.find?.(function(s){return s.name==="ephemeral"})?.value??!1?{type:4,data:{content:i,flags:64}}:(p.showToast(i,o.getAssetIDByName("CircleXIcon")),null)}},applicationId:"-1",inputType:1,type:1},an=u.findByProps("sendBotMessage","sendMessage"),x=u.findByProps("getAllFriendInvites","createFriendInvite","revokeFriendInvites"),rn=u.findByProps("getCurrentUser")?.getCurrentUser;function ke(t,n){const a=Date.now().toString();an.sendMessage(t.channel.id,{content:n},void 0,{nonce:a})}const sn={name:"invite create",displayName:"invite create",description:"Generates a friend invite link.",displayDescription:"Generates a friend invite link.",type:1,applicationId:"-1",inputType:1,execute:async function(t,n){try{if(!rn?.().phone)return p.showToast("You need a phone number connected to your account!",o.getAssetIDByName("Small")),null;const a=await x.createFriendInvite({code:null,recipient_phone_number_or_email:null,contact_visibility:0,filter_visibilities:[],filtered_invite_suggestions_index:0});if(a?.code){const i=Math.floor(new Date(a.expires_at).getTime()/1e3),s=`https://discord.gg/${a.code} \xB7 Expires: `;ke(n,s),p.showToast("Friend invite created!",o.getAssetIDByName("Check"))}else throw new Error("No invite code generated");return null}catch(a){return console.error("[FriendInvite] Create error:",a),p.showToast("Error creating friend invite",o.getAssetIDByName("Small")),null}}},on={name:"view invites",displayName:"view invites",description:"View your current friend invite links that you've made.",displayDescription:"View your current friend invite links that you've made.",type:1,applicationId:"-1",execute:async function(t,n){try{const a=await x.getAllFriendInvites();if(!a?.length)return p.showToast("No active friend invites found",o.getAssetIDByName("Info")),null;const i=a.map(function(s){const c=Math.floor(new Date(s.expires_at).getTime()/1e3);return`_https://discord.gg/${s.code}_ \xB7 Expires: \xB7 Uses: \`${s.uses}/${s.max_uses}\``});return ke(n,`**Your Active Friend Invites:** +${i.join(` +`)}`),null}catch(a){return console.error("[FriendInvite] View error:",a),p.showToast("Error viewing friend invites",o.getAssetIDByName("Small")),null}}},cn={name:"revoke invites",displayName:"revoke invites",description:"Revoke all your friend invite links.",displayDescription:"Revoke all your friend invite links.",type:1,applicationId:"-1",inputType:1,execute:async function(t,n){try{const a=await x.getAllFriendInvites();if(!a?.length)return p.showToast("No active friend invites to revoke",o.getAssetIDByName("Info")),null;await x.revokeFriendInvites();const i=await x.getAllFriendInvites();return i.length===0?p.showToast(`Successfully revoked all ${a.length} friend invite(s)!`,o.getAssetIDByName("Check")):p.showToast(`\u26A0\uFE0F Partially revoked invites. ${i.length} invite(s) remain active.`,o.getAssetIDByName("Warning")),null}catch(a){return console.error("[FriendInvite] Revoke error:",a),p.showToast("Error revoking friend invites",o.getAssetIDByName("Small")),null}}};function ln(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function dn(t,n){for(var a=0;a>22)%6}.png`;c(v),l(A)}},[g]);const w=function(){if(r.storage.hiddenSettings?.enabled){r.storage.hiddenSettings.visible=!r.storage.hiddenSettings.visible,p.showToast(`Hidden settings ${r.storage.hiddenSettings.visible?"visible":"hidden"}`,o.getAssetIDByName("SettingsIcon"));return}a&&clearTimeout(a);const v=setTimeout(function(){n(0)},1e3);i(v);const A=t+1;n(A),!(A<10)&&(p.showToast("Hidden settings unlocked!",o.getAssetIDByName("CheckmarkIcon")),r.storage.hiddenSettings={...r.storage.hiddenSettings,enabled:!0,visible:!0},n(0))},R=function(){const v=!r.storage.sidebarEnabled;r.storage.sidebarEnabled=v,r.storage.pendingRestart=!0,p.showToast(`Sidebar ${v?"enabled":"disabled"}. Restart Discord to apply.`,o.getAssetIDByName(v?"CheckmarkIcon":"XIcon"))},[E,B]=e.React.useState(!1);return e.React.createElement(e.ReactNative.View,{style:b.container},e.React.createElement(e.ReactNative.View,{style:b.leftSection},e.React.createElement(e.ReactNative.Pressable,{style:b.avatarContainer,onPress:w,onPressIn:function(){return B(!0)},onPressOut:function(){return B(!1)},delayLongPress:500,onLongPress:R},e.React.createElement(e.ReactNative.View,{style:b.avatarWrapper},s?e.React.createElement(e.React.Fragment,null,e.React.createElement(e.ReactNative.Image,{source:{uri:s},style:b.avatar,resizeMode:"cover"}),d&&e.React.createElement(e.ReactNative.View,{style:b.animatedIndicator})):e.React.createElement(e.ReactNative.Image,{source:o.getAssetIDByName("ic_account_circle_24px"),style:b.avatarPlaceholder})),e.React.createElement(e.ReactNative.View,{style:[b.cogwheelBackground,{opacity:E?.8:0}]},e.React.createElement(e.ReactNative.Image,{source:o.getAssetIDByName("SettingsIcon"),style:b.cogwheelIcon}))),e.React.createElement(e.ReactNative.View,{style:b.textContainer},e.React.createElement(xe,{variant:"display-md",color:"TEXT_DEFAULT",align:"left"},"Commands"),e.React.createElement(xe,{variant:"text-md/bold",color:"TEXT_MUTED",align:"left"},"A collection of useful commands for Vendetta like clients"))))}function m({title:t,icon:n,children:a,padding:i=!1}){const s=e.stylesheet.createThemedStyleSheet({main:{backgroundColor:y.rawColors.PLUM_18,borderColor:y.semanticColors.CARD_BACKGROUND_DEFAULT,borderWidth:1,borderRadius:16,overflow:"hidden",flex:1,maxWidth:"100%"},titleContainer:{marginBottom:8,marginHorizontal:16,marginTop:8,gap:4,flexDirection:"row",alignItems:"center"},icon:{width:16,height:16,marginTop:1.5,tintColor:y.semanticColors.TEXT_MUTED},titleText:{fontSize:14,fontWeight:"600",color:y.semanticColors.TEXT_MUTED},wrapper:{marginHorizontal:16,marginTop:16,maxWidth:"100%"}});return e.React.createElement(e.ReactNative.View,{style:s.wrapper},t&&e.React.createElement(e.ReactNative.View,{style:s.titleContainer},n&&e.React.createElement(e.ReactNative.Image,{style:s.icon,source:n,resizeMode:"cover"}),e.React.createElement(e.ReactNative.Text,{style:s.titleText},t.toUpperCase())),e.React.createElement(e.ReactNative.View,{style:s.main},i?e.React.createElement(e.ReactNative.View,{style:{paddingHorizontal:16,paddingVertical:16}},a):a))}const{FormSwitchRow:$,FormRow:L}=I.Forms;function bn(){S.useProxy(r.storage);const[,t]=e.React.useReducer(function(n){return n+1},0);return e.React.createElement(e.ReactNative.ScrollView,{style:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},contentContainerStyle:{flexGrow:1,paddingVertical:16,maxWidth:"100%"}},e.React.createElement(m,{title:"Fact Display Settings",icon:o.getAssetIDByName("SettingsIcon")},e.React.createElement($,{label:"Send as Reply",subLabel:"Send facts as a reply to the command message",leading:e.React.createElement(L.Icon,{source:o.getAssetIDByName("ArrowAngleLeftUpIcon")}),value:r.storage.factSettings.sendAsReply,onValueChange:function(n){r.storage.factSettings.sendAsReply=n}}),e.React.createElement($,{label:"Include Source Citation",subLabel:"Include the source of facts when available",leading:e.React.createElement(L.Icon,{source:o.getAssetIDByName("LinkIcon")}),value:r.storage.factSettings.includeCitation,onValueChange:function(n){r.storage.factSettings.includeCitation=n}})),e.React.createElement(m,{title:"Available Fact Commands",icon:o.getAssetIDByName("BookmarkIcon")},e.React.createElement($,{label:"/catfact",subLabel:"Get random cat facts",leading:e.React.createElement(L.Icon,{source:o.getAssetIDByName("BookCheckIcon")}),value:r.storage.enabledCommands.catfact,onValueChange:function(n){r.storage.enabledCommands.catfact=n,r.storage.pendingRestart=!0,t()}}),e.React.createElement($,{label:"/dogfact",subLabel:"Get random dog facts",leading:e.React.createElement(L.Icon,{source:o.getAssetIDByName("BookCheckIcon")}),value:r.storage.enabledCommands.dogfact,onValueChange:function(n){r.storage.enabledCommands.dogfact=n,r.storage.pendingRestart=!0,t()}}),e.React.createElement($,{label:"/useless",subLabel:"Get random useless facts",leading:e.React.createElement(L.Icon,{source:o.getAssetIDByName("BookCheckIcon")}),value:r.storage.enabledCommands.useless,onValueChange:function(n){r.storage.enabledCommands.useless=n,r.storage.pendingRestart=!0,t()}})))}const{FormSwitchRow:J,FormRow:Q}=I.Forms;function vn(){S.useProxy(r.storage);const[,t]=e.React.useReducer(function(n){return n+1},0);return e.React.createElement(e.ReactNative.ScrollView,{style:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},contentContainerStyle:{flexGrow:1,paddingVertical:16,maxWidth:"100%"}},e.React.createElement(m,{title:"List Display Settings",icon:o.getAssetIDByName("SettingsIcon")},e.React.createElement(J,{label:"Always Send Detailed Plugin List",subLabel:"Always use detailed mode when listing plugins",leading:e.React.createElement(Q.Icon,{source:o.getAssetIDByName("PuzzlePieceIcon")}),value:r.storage.listSettings.pluginListAlwaysDetailed,onValueChange:function(n){r.storage.listSettings.pluginListAlwaysDetailed=n}}),e.React.createElement(J,{label:"Always Send Detailed Theme List",subLabel:"Always use detailed mode when listing themes",leading:e.React.createElement(Q.Icon,{source:o.getAssetIDByName("PaintPaletteIcon")}),value:r.storage.listSettings.themeListAlwaysDetailed,onValueChange:function(n){r.storage.listSettings.themeListAlwaysDetailed=n}})),e.React.createElement(m,{title:"Available List Commands",icon:o.getAssetIDByName("ListViewIcon")},e.React.createElement(J,{label:"/plugin-list",subLabel:"List all installed plugins",leading:e.React.createElement(Q.Icon,{source:o.getAssetIDByName("PuzzlePieceIcon")}),value:r.storage.enabledCommands.pluginList,onValueChange:function(n){r.storage.enabledCommands.pluginList=n,r.storage.pendingRestart=!0,t()}}),e.React.createElement(J,{label:"/theme-list",subLabel:"List all installed themes",leading:e.React.createElement(Q.Icon,{source:o.getAssetIDByName("PaintPaletteIcon")}),value:r.storage.enabledCommands.themeList,onValueChange:function(n){r.storage.enabledCommands.themeList=n,r.storage.pendingRestart=!0,t()}})))}const{FormSwitchRow:ce,FormRow:le}=I.Forms;function Rn(){S.useProxy(r.storage);const[,t]=e.React.useReducer(function(n){return n+1},0);return e.React.createElement(e.ReactNative.ScrollView,{style:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},contentContainerStyle:{flexGrow:1,paddingVertical:16,maxWidth:"100%"}},e.React.createElement(m,{title:"Image Commands",icon:o.getAssetIDByName("ImageIcon")},e.React.createElement(ce,{label:"/petpet",subLabel:"Create pet-pet GIF of a user",leading:e.React.createElement(le.Icon,{source:o.getAssetIDByName("HandRequestSpeakIcon")}),value:r.storage.enabledCommands.petpet,onValueChange:function(n){r.storage.enabledCommands.petpet=n,r.storage.pendingRestart=!0,t()}})),e.React.createElement(m,{title:"KonoChan Commands",icon:o.getAssetIDByName("ImageIcon")},e.React.createElement(ce,{label:"/konoself",subLabel:"Get random image from KonoChan (private)",leading:e.React.createElement(le.Icon,{source:o.getAssetIDByName("EyeIcon")}),value:r.storage.enabledCommands.konoself,onValueChange:function(n){r.storage.enabledCommands.konoself=n,r.storage.pendingRestart=!0,t()}}),e.React.createElement(ce,{label:"/konosend",subLabel:"Send random image from KonoChan to channel",leading:e.React.createElement(le.Icon,{source:o.getAssetIDByName("ImageIcon")}),value:r.storage.enabledCommands.konosend,onValueChange:function(n){r.storage.enabledCommands.konosend=n,r.storage.pendingRestart=!0,t()}})))}const{FormSwitchRow:M,FormRow:_}=I.Forms;function In(){S.useProxy(r.storage);const[,t]=e.React.useReducer(function(i){return i+1},0),n=e.stylesheet.createThemedStyleSheet({container:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},infoText:{fontSize:14,color:y.semanticColors.TEXT_MUTED,marginBottom:16,textAlign:"center"},currentText:{fontSize:14,color:y.semanticColors.TEXT_MUTED,textAlign:"center",fontWeight:"600"}}),a=r.storage.garySettings.imageSource;return e.React.createElement(e.ReactNative.ScrollView,{style:n.container,contentContainerStyle:{flexGrow:1,paddingVertical:16,maxWidth:"100%"}},e.React.createElement(m,{title:"Gary Command Settings",icon:o.getAssetIDByName("SettingsIcon")},e.React.createElement(M,{label:"/gary",subLabel:"Send random Gary images to channel",leading:e.React.createElement(_.Icon,{source:o.getAssetIDByName("AttachmentIcon")}),value:r.storage.enabledCommands.gary,onValueChange:function(i){r.storage.enabledCommands.gary=i,r.storage.pendingRestart=!0,t()}})),e.React.createElement(m,{title:"Image Source Selection",icon:o.getAssetIDByName("DownloadIcon"),padding:!0},e.React.createElement(e.ReactNative.Text,{style:n.infoText},"Choose which API the /gary command should use to fetch images.")),e.React.createElement(m,{title:"API Options",icon:o.getAssetIDByName("CloudIcon")},e.React.createElement(M,{label:"Gary API",subLabel:"Original Gary the cat images from api.garythe.cat",leading:e.React.createElement(_.Icon,{source:o.getAssetIDByName("ImageIcon")}),value:a==="gary",onValueChange:function(i){i&&(r.storage.garySettings.imageSource="gary",t())}}),e.React.createElement(M,{label:"Cat API",subLabel:"Random cat pictures from thecatapi.com",leading:e.React.createElement(_.Icon,{source:o.getAssetIDByName("ImageIcon")}),value:a==="catapi",onValueChange:function(i){i&&(r.storage.garySettings.imageSource="catapi",t())}}),e.React.createElement(M,{label:"Minker API",subLabel:"Minky images from minky.materii.dev",leading:e.React.createElement(_.Icon,{source:o.getAssetIDByName("ImageIcon")}),value:a==="minker",onValueChange:function(i){i&&(r.storage.garySettings.imageSource="minker",t())}}),e.React.createElement(M,{label:"Goober API",subLabel:"Goober images from api.garythe.cat/goober",leading:e.React.createElement(_.Icon,{source:o.getAssetIDByName("ImageIcon")}),value:a==="goober",onValueChange:function(i){i&&(r.storage.garySettings.imageSource="goober",t())}})),e.React.createElement(m,{title:"Current Selection",icon:o.getAssetIDByName("CheckmarkIcon"),padding:!0},e.React.createElement(e.ReactNative.Text,{style:n.currentText},"Currently using:"," ",a==="gary"?"Gary API":a==="catapi"?"Cat API":a==="minker"?"Minker API":a==="goober"?"Goober API":"Gary API")))}const{FormSwitchRow:Z,FormRow:ee}=I.Forms;function wn(){S.useProxy(r.storage);const[,t]=e.React.useReducer(function(a){return a+1},0),n=e.stylesheet.createThemedStyleSheet({infoText:{fontSize:14,color:y.semanticColors.TEXT_MUTED,textAlign:"center",lineHeight:20}});return e.React.createElement(e.ReactNative.ScrollView,{style:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},contentContainerStyle:{flexGrow:1,paddingVertical:16,maxWidth:"100%"}},e.React.createElement(m,{title:"Spotify Commands",icon:o.getAssetIDByName("SpotifyNeutralIcon")},e.React.createElement(Z,{label:"/spotify track",subLabel:"Share your current Spotify track",leading:e.React.createElement(ee.Icon,{source:o.getAssetIDByName("SpotifyNeutralIcon")}),value:r.storage.enabledCommands.spotifyTrack,onValueChange:function(a){r.storage.enabledCommands.spotifyTrack=a,r.storage.pendingRestart=!0,t()}}),e.React.createElement(Z,{label:"/spotify album",subLabel:"Share your current track's album",leading:e.React.createElement(ee.Icon,{source:o.getAssetIDByName("SpotifyNeutralIcon")}),value:r.storage.enabledCommands.spotifyAlbum,onValueChange:function(a){r.storage.enabledCommands.spotifyAlbum=a,r.storage.pendingRestart=!0,t()}}),e.React.createElement(Z,{label:"/spotify artists",subLabel:"Share your current track's artists",leading:e.React.createElement(ee.Icon,{source:o.getAssetIDByName("SpotifyNeutralIcon")}),value:r.storage.enabledCommands.spotifyArtists,onValueChange:function(a){r.storage.enabledCommands.spotifyArtists=a,r.storage.pendingRestart=!0,t()}}),e.React.createElement(Z,{label:"/spotify cover",subLabel:"Share your current track's cover",leading:e.React.createElement(ee.Icon,{source:o.getAssetIDByName("SpotifyNeutralIcon")}),value:r.storage.enabledCommands.spotifyCover,onValueChange:function(a){r.storage.enabledCommands.spotifyCover=a,r.storage.pendingRestart=!0,t()}})),e.React.createElement(m,{title:"About Spotify Commands",icon:o.getAssetIDByName("InfoIcon"),padding:!0},e.React.createElement(e.ReactNative.Text,{style:n.infoText},"These commands allow you to share your current Spotify activity in Discord. Make sure you have Spotify connected to Discord for these commands to work properly.")))}function Sn(){const t=e.stylesheet.createThemedStyleSheet({container:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},tableHeader:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,backgroundColor:y.semanticColors.BACKGROUND_MODIFIER_ACCENT,borderBottomWidth:2,borderBottomColor:y.semanticColors.BORDER_STRONG},headerText:{fontSize:14,fontWeight:"700",color:y.semanticColors.HEADER_PRIMARY,textTransform:"uppercase"},nameHeader:{flex:2},codeHeader:{flex:2,textAlign:"center"},badgeHeader:{flex:1,textAlign:"center"},categoryItem:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:16,borderBottomWidth:1,borderBottomColor:y.semanticColors.BORDER_FAINT},categoryName:{fontSize:16,fontWeight:"500",color:y.semanticColors.HEADER_PRIMARY,flex:2},categoryValue:{fontSize:14,color:y.semanticColors.TEXT_MUTED,fontFamily:"monospace",flex:2,textAlign:"center"},sfwBadgeContainer:{flex:1,alignItems:"center"},sfwBadge:{backgroundColor:y.semanticColors.STATUS_POSITIVE,paddingHorizontal:8,paddingVertical:4,borderRadius:12},badgeText:{fontSize:12,fontWeight:"600",color:y.semanticColors.TEXT_NORMAL},infoText:{fontSize:14,color:y.semanticColors.TEXT_MUTED,textAlign:"center",lineHeight:20}}),n=[{name:"Avatar",value:"avatar"},{name:"Classic",value:"classic"},{name:"Cuddle",value:"cuddle"},{name:"Fox Girl",value:"fox_girl"},{name:"Gecg",value:"gecg"},{name:"Holo",value:"holo"},{name:"Kemonomimi",value:"kemonomimi"},{name:"Kiss",value:"kiss"},{name:"Neko",value:"neko"},{name:"Neko GIF",value:"ngif"},{name:"Smug",value:"smug"},{name:"Spank",value:"spank"},{name:"Tickle",value:"tickle"},{name:"Waifu",value:"waifu"},{name:"Wallpaper",value:"wallpaper"},{name:"Woof",value:"woof"}],a=n.sort(function(i,s){return i.name.localeCompare(s.name)});return e.React.createElement(e.ReactNative.ScrollView,{style:t.container,contentContainerStyle:{flexGrow:1,paddingVertical:16,maxWidth:"100%"}},e.React.createElement(m,{title:"\u{1F4CA} Category Statistics",icon:o.getAssetIDByName("ChartIcon"),padding:!0},e.React.createElement(e.ReactNative.Text,{style:t.infoText},"Total SFW Categories: ",n.length,` + +`,"Use these category names with the /nekoslife command.",` +`,"All categories are Safe For Work (SFW).")),e.React.createElement(m,{title:"\u{1F4CB} SFW Categories",icon:o.getAssetIDByName("ListViewIcon")},e.React.createElement(e.ReactNative.View,{style:t.tableHeader},e.React.createElement(e.ReactNative.Text,{style:[t.headerText,t.nameHeader]},"Category Name"),e.React.createElement(e.ReactNative.Text,{style:[t.headerText,t.codeHeader]},"Command Code"),e.React.createElement(e.ReactNative.Text,{style:[t.headerText,t.badgeHeader]},"Type")),a.map(function(i,s){return e.React.createElement(e.ReactNative.View,{key:s,style:t.categoryItem},e.React.createElement(e.ReactNative.Text,{style:t.categoryName},i.name),e.React.createElement(e.ReactNative.Text,{style:t.categoryValue},i.value),e.React.createElement(e.ReactNative.View,{style:t.sfwBadgeContainer},e.React.createElement(e.ReactNative.View,{style:t.sfwBadge},e.React.createElement(e.ReactNative.Text,{style:t.badgeText},"SFW"))))})))}const{FormSwitchRow:$e,FormRow:F}=I.Forms;function En(){S.useProxy(r.storage);const[,t]=e.React.useReducer(function(a){return a+1},0),n=e.NavigationNative.useNavigation();return e.React.createElement(e.ReactNative.ScrollView,{style:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},contentContainerStyle:{flexGrow:1,paddingVertical:16,maxWidth:"100%"}},e.React.createElement(m,{title:"IP Commands",icon:o.getAssetIDByName("GlobeEarthIcon")},e.React.createElement($e,{label:"/ip",subLabel:"Get your current IP address",leading:e.React.createElement(F.Icon,{source:o.getAssetIDByName("GlobeEarthIcon")}),value:r.storage.enabledCommands.ip,onValueChange:function(a){r.storage.enabledCommands.ip=a,r.storage.pendingRestart=!0,t()}})),e.React.createElement(m,{title:"NekosLife Commands",icon:o.getAssetIDByName("ImageIcon")},e.React.createElement($e,{label:"/nekoslife",subLabel:"Get images/gifs from nekos.life",leading:e.React.createElement(F.Icon,{source:o.getAssetIDByName("ImageIcon")}),value:r.storage.enabledCommands.nekoslife,onValueChange:function(a){r.storage.enabledCommands.nekoslife=a,r.storage.pendingRestart=!0,t()}}),e.React.createElement(F,{label:"View Categories",subLabel:"See all 16 available categories",leading:e.React.createElement(F.Icon,{source:o.getAssetIDByName("BookOpenIcon")}),trailing:e.React.createElement(F.Arrow,null),onPress:function(){return n.push("VendettaCustomPage",{title:"NekosLife Categories",render:Sn})}})),e.React.createElement(e.ReactNative.View,{style:{height:32}}))}const{FormSwitchRow:V,FormRow:Le}=I.Forms;function Nn(){S.useProxy(r.storage);const[,t]=e.React.useReducer(function(n){return n+1},0);return e.React.createElement(e.ReactNative.ScrollView,{style:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},contentContainerStyle:{flexGrow:1,paddingVertical:16,maxWidth:"100%"}},e.React.createElement(m,{title:"Message Commands",icon:o.getAssetIDByName("ChatIcon")},e.React.createElement(V,{label:"/firstmessage",subLabel:"Get the first message in a channel",leading:e.React.createElement(Le.Icon,{source:o.getAssetIDByName("ChatIcon")}),value:r.storage.enabledCommands.firstmessage,onValueChange:function(n){r.storage.enabledCommands.firstmessage=n,r.storage.pendingRestart=!0,t()}})),e.React.createElement(m,{title:"System Commands",icon:o.getAssetIDByName("SettingsIcon")},e.React.createElement(V,{label:"/sysinfo",subLabel:"Display system information",leading:e.React.createElement(Le.Icon,{source:o.getAssetIDByName("SettingsIcon")}),value:r.storage.enabledCommands.sysinfo,onValueChange:function(n){r.storage.enabledCommands.sysinfo=n,r.storage.pendingRestart=!0,t()}})),e.React.createElement(m,{title:"Friend Invites",icon:o.getAssetIDByName("UserAddIcon")},e.React.createElement(V,{label:"/invite create",subLabel:"Generate a friend invite link",value:r.storage.enabledCommands.friendInviteCreate,onValueChange:function(n){r.storage.enabledCommands.friendInviteCreate=n,r.storage.pendingRestart=!0,t()}}),e.React.createElement(V,{label:"/view invites",subLabel:"View your current friend invites",value:r.storage.enabledCommands.friendInviteView,onValueChange:function(n){r.storage.enabledCommands.friendInviteView=n,r.storage.pendingRestart=!0,t()}}),e.React.createElement(V,{label:"/revoke invites",subLabel:"Revoke all your friend invites",value:r.storage.enabledCommands.friendInviteRevoke,onValueChange:function(n){r.storage.enabledCommands.friendInviteRevoke=n,r.storage.pendingRestart=!0,t()}})))}const{FormSwitchRow:de,FormRow:U}=I.Forms;function Tn(){S.useProxy(r.storage);const[,t]=e.React.useReducer(function(a){return a+1},0),n=e.stylesheet.createThemedStyleSheet({container:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},warningText:{fontSize:14,color:y.semanticColors.TEXT_MUTED,textAlign:"center",lineHeight:20,fontWeight:"600"},infoText:{fontSize:14,color:y.semanticColors.TEXT_MUTED,textAlign:"center",lineHeight:20,marginTop:8}});return e.React.createElement(e.ReactNative.ScrollView,{style:n.container,contentContainerStyle:{flexGrow:1,paddingVertical:16,maxWidth:"100%"}},e.React.createElement(m,{title:"Warning",icon:o.getAssetIDByName("WarningIcon"),padding:!0},e.React.createElement(e.ReactNative.Text,{style:n.warningText},"These are hidden commands that may contain mature content or experimental features."),e.React.createElement(e.ReactNative.Text,{style:n.infoText},"Use at your own discretion. Commands in this section are disabled by default.")),e.React.createElement(m,{title:"Hidden Commands",icon:o.getAssetIDByName("EyeIcon")},e.React.createElement(de,{label:"/lovefemboys",subLabel:"Get random femboy images from r/femboys (NSFW content available)",leading:e.React.createElement(U.Icon,{source:o.getAssetIDByName("HeartIcon")}),value:r.storage.enabledCommands.lovefemboys,onValueChange:function(a){r.storage.enabledCommands.lovefemboys=a,r.storage.pendingRestart=!0,t()}})),e.React.createElement(m,{title:"NSFW Bypass Options",icon:o.getAssetIDByName("WarningIcon")},e.React.createElement(de,{label:"KonoChan NSFW Bypass",subLabel:"Allow NSFW KonoChan content in non-NSFW channels (USE WITH CAUTION)",leading:e.React.createElement(U.Icon,{source:o.getAssetIDByName("ShieldIcon")}),value:r.storage.hiddenSettings.konochanBypassNsfw,onValueChange:function(a){a?y.alerts.showConfirmationAlert({title:"\u26A0\uFE0F NSFW Bypass Warning",content:"Enabling this allows NSFW content from KonoChan to be sent in any channel, including non-NSFW channels. This could violate server rules or Discord ToS. Use responsibly!",confirmText:"I Understand",cancelText:"Cancel",onConfirm:function(){r.storage.hiddenSettings.konochanBypassNsfw=!0,t()},onCancel:function(){}}):(r.storage.hiddenSettings.konochanBypassNsfw=!1,t())}})),e.React.createElement(m,{title:"Hidden Settings Control",icon:o.getAssetIDByName("SettingsIcon")},e.React.createElement(de,{label:"Keep Hidden Settings Visible",subLabel:"Keep this section visible even when navigating away",leading:e.React.createElement(U.Icon,{source:o.getAssetIDByName("EyeIcon")}),value:r.storage.hiddenSettings.visible,onValueChange:function(a){r.storage.hiddenSettings.visible=a}}),e.React.createElement(U,{label:"Reset Hidden Settings",subLabel:"Hide this section and disable all hidden commands",leading:e.React.createElement(U.Icon,{source:o.getAssetIDByName("TrashIcon")}),onPress:function(){y.alerts.showConfirmationAlert({title:"Reset Hidden Settings",content:"This will hide the hidden settings section and disable all hidden commands. Are you sure?",confirmText:"Reset",onConfirm:function(){r.storage.hiddenSettings.enabled=!1,r.storage.hiddenSettings.visible=!1,r.storage.hiddenSettings.konochanBypassNsfw=!1,r.storage.enabledCommands.lovefemboys=!1,r.storage.pendingRestart=!0,p.showToast("Hidden settings reset",o.getAssetIDByName("CheckmarkIcon"))},cancelText:"Cancel"})}})))}function An(){const t=e.stylesheet.createThemedStyleSheet({container:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},scrollContent:{paddingVertical:16,paddingHorizontal:12,alignItems:"stretch"},groupWrapper:{marginHorizontal:16,marginTop:16,maxWidth:"100%"},groupMain:{backgroundColor:y.rawColors.PLUM_18,borderColor:y.semanticColors.CARD_BACKGROUND_DEFAULT,borderWidth:1,borderRadius:16,overflow:"hidden",flex:1,maxWidth:"100%"},rippleContainer:{borderRadius:16,overflow:"hidden"},cardPressable:{flexDirection:"row",alignItems:"center",paddingVertical:12,paddingHorizontal:12},avatarContainer:{width:56,height:56,borderRadius:12,overflow:"hidden",backgroundColor:y.semanticColors.BACKGROUND_SECONDARY,justifyContent:"center",alignItems:"center",marginRight:12},avatar:{width:56,height:56,borderRadius:12,resizeMode:"cover"},textContainer:{flex:1,justifyContent:"center"},commandText:{fontSize:16,fontWeight:"700",color:y.semanticColors.MOBILE_TEXT_HEADING_PRIMARY,marginBottom:2},authorText:{fontSize:14,color:y.semanticColors.TEXT_MUTED,marginBottom:6},linkText:{fontSize:13,color:y.semanticColors.LINK,fontWeight:"600"},infoText:{fontSize:14,color:y.semanticColors.TEXT_MUTED,marginBottom:20,textAlign:"center",lineHeight:20},versionText:{fontSize:15,color:y.semanticColors.TEXT_MUTED,textAlign:"center",fontWeight:"600",lineHeight:22}}),n=[{command:"Facts Commands",author:"jdev082",avatar:"https://github.com/jdev082.png",github:"https://github.com/jdev082"},{command:"List Commands",author:"Kitomanari",avatar:"https://github.com/Kitosight.png",github:"https://github.com/Kitosight"},{command:"PetPet",author:"wolfieeee",avatar:"https://github.com/WolfPlugs.png",github:"https://github.com/WolfPlugs"},{command:"KonoChan Commands",author:"btmc727 & Rico040",avatar:"https://github.com/OTKUSteyler.png",github:"https://github.com/OTKUSteyler"},{command:"FirstMessage Command",author:"sapphire",avatar:"https://github.com/aeongdesu.png",github:"https://github.com/aeongdesu"},{command:"Sysinfo Command",author:"mugman",avatar:"https://github.com/mugman174.png",github:"https://github.com/mugman174"},{command:"Spotify Commands",author:"Kitomanari",avatar:"https://github.com/Kitosight.png",github:"https://github.com/Kitosight"},{command:"Gary Command",author:"Zach Orange",avatar:"https://github.com/IAmGaryTheCat.png",github:"https://github.com/IAmGaryTheCat"},{command:"IP & NekosLife Commands",author:"scruzism",avatar:"https://github.com/scrazzz.png",github:"https://github.com/scrazzz"},{command:"FriendInvites",author:"nikosszzz",avatar:"https://github.com/nikosszzz.png",github:"https://github.com/nikosszzz"}],a=function(l){e.ReactNative.Linking.openURL(l)},i=o.getAssetIDByName("HeartIcon"),s=o.getAssetIDByName("ic_information_24px"),c=typeof i=="number"?i:void 0,d=typeof s=="number"?s:void 0;return e.React.createElement(e.ReactNative.ScrollView,{style:t.container,contentContainerStyle:t.scrollContent},e.React.createElement(m,{title:"Plugin Authors",icon:c,padding:!0},e.React.createElement(e.ReactNative.Text,{style:t.infoText},"Thanks to these developers for creating such great plugins!",` +`,"Tap any developer to visit their GitHub profile.")),n.map(function(l){return e.React.createElement(e.ReactNative.View,{key:l.github,style:t.groupWrapper},e.React.createElement(e.ReactNative.View,{style:t.groupMain},e.React.createElement(e.ReactNative.View,{style:t.rippleContainer},e.React.createElement(e.ReactNative.Pressable,{style:t.cardPressable,onPress:function(){return a(l.github)},android_ripple:{color:y.semanticColors.ANDROID_RIPPLE,borderless:!1,radius:200},accessibilityRole:"button"},e.React.createElement(e.ReactNative.View,{style:t.avatarContainer},e.React.createElement(e.ReactNative.Image,{source:{uri:l.avatar},style:t.avatar})),e.React.createElement(e.ReactNative.View,{style:t.textContainer},e.React.createElement(e.ReactNative.Text,{numberOfLines:1,style:t.commandText},l.command),e.React.createElement(e.ReactNative.Text,{numberOfLines:1,style:t.authorText},"by ",l.author))))))}),e.React.createElement(m,{title:"About",icon:d,padding:!0},e.React.createElement(e.ReactNative.Text,{style:t.versionText},"Commands Plugin Collection",` +`,"Version 1.3.0")))}var Me,_e,Fe,Ve,Ue,We,Ge;const{FormRow:C}=I.Forms;(Me=r.storage).factSettings??(Me.factSettings={sendAsReply:!0,includeCitation:!1}),(_e=r.storage).listSettings??(_e.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),(Fe=r.storage).garySettings??(Fe.garySettings={imageSource:"gary"}),(Ve=r.storage).enabledCommands??(Ve.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0,sysinfo:!0,spotifyTrack:!0,spotifyAlbum:!0,spotifyArtists:!0,spotifyCover:!0,gary:!0,ip:!0,lovefemboys:!1,nekoslife:!1,friendInviteCreate:!0,friendInviteView:!0,friendInviteRevoke:!0}),(Ue=r.storage).pendingRestart??(Ue.pendingRestart=!1),(We=r.storage).hiddenSettings??(We.hiddenSettings={enabled:!1,visible:!1,konochanBypassNsfw:!1}),(Ge=r.storage).sidebarEnabled??(Ge.sidebarEnabled=!0);function Oe(){S.useProxy(r.storage);const t=e.NavigationNative.useNavigation();return e.React.useEffect(function(){return function(){r.storage.pendingRestart&&(r.storage.pendingRestart=!1,y.alerts.showConfirmationAlert({title:"Restart Required",content:"You have made changes to commands. Please restart Discord to apply these changes.",confirmText:"Okay",cancelText:null,onConfirm:function(){}}))}},[]),e.React.createElement(e.ReactNative.View,{style:{flex:1}},e.React.createElement(e.ReactNative.ScrollView,{style:{flex:1,backgroundColor:y.semanticColors.BACKGROUND_PRIMARY},contentContainerStyle:{flexGrow:1,maxWidth:"100%"},showsVerticalScrollIndicator:!1},e.React.createElement(Cn,null),e.React.createElement(m,{title:"Command Categories",icon:o.getAssetIDByName("ChannelListIcon")},e.React.createElement(C,{label:"Facts Commands",subLabel:"Cat facts, dog facts, and useless facts",leading:e.React.createElement(C.Icon,{source:o.getAssetIDByName("BookmarkIcon")}),trailing:e.React.createElement(C.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"Facts Commands",render:bn})}}),e.React.createElement(C,{label:"List Commands",subLabel:"Plugin lists and theme lists",leading:e.React.createElement(C.Icon,{source:o.getAssetIDByName("ListViewIcon")}),trailing:e.React.createElement(C.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"List Commands",render:vn})}}),e.React.createElement(C,{label:"Image Commands",subLabel:"PetPet, KonoChan, and image utilities",leading:e.React.createElement(C.Icon,{source:o.getAssetIDByName("ImageIcon")}),trailing:e.React.createElement(C.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"Image Commands",render:Rn})}}),e.React.createElement(C,{label:"Gary Commands",subLabel:`Gary images - Current: ${r.storage.garySettings.imageSource==="gary"?"Gary API":r.storage.garySettings.imageSource==="catapi"?"Cat API":r.storage.garySettings.imageSource==="minker"?"Minker API":r.storage.garySettings.imageSource==="goober"?"Goober API":"Gary API"}`,leading:e.React.createElement(C.Icon,{source:o.getAssetIDByName("CameraIcon")}),trailing:e.React.createElement(C.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"Gary Commands",render:In})}}),e.React.createElement(C,{label:"Spotify Commands",subLabel:"Share your Spotify activity",leading:e.React.createElement(C.Icon,{source:o.getAssetIDByName("SpotifyNeutralIcon")}),trailing:e.React.createElement(C.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"Spotify Commands",render:wn})}}),e.React.createElement(C,{label:"Aliucord Commands",subLabel:"Commands from Aliucord",leading:e.React.createElement(C.Icon,{source:{uri:"https://avatars.githubusercontent.com/u/78881422?s=200&v=4"}}),trailing:e.React.createElement(C.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"Aliucord",render:En})}}),e.React.createElement(C,{label:"Other Commands",subLabel:"Utility and system commands",leading:e.React.createElement(C.Icon,{source:o.getAssetIDByName("WrenchIcon")}),trailing:e.React.createElement(C.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"Other Commands",render:Nn})}})),r.storage.hiddenSettings?.visible&&e.React.createElement(m,{title:"Hidden Settings",icon:o.getAssetIDByName("EyeIcon")},e.React.createElement(C,{label:"Hidden Commands",subLabel:"Access to experimental and NSFW commands",leading:e.React.createElement(C.Icon,{source:o.getAssetIDByName("EyeIcon")}),trailing:e.React.createElement(C.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"Hidden Settings",render:Tn})}})),e.React.createElement(m,{title:"Other",icon:o.getAssetIDByName("CircleInformationIcon-primary")},e.React.createElement(C,{label:"Credits",subLabel:"View original authors of the plugins",leading:e.React.createElement(C.Icon,{source:o.getAssetIDByName("HeartIcon")}),trailing:e.React.createElement(C.Arrow,null),onPress:function(){return t.push("VendettaCustomPage",{title:"Credits",render:An})}})),e.React.createElement(e.ReactNative.View,{style:{height:32}})))}const{FormSection:Dn,FormRow:ue}=I.Forms,{TableRowIcon:kn}=u.findByProps("TableRowIcon"),W=window.bunny,je=W?.metro?.findByPropsLazy("getRootNavigationRef"),ge=W?.metro?.findByPropsLazy("SETTING_RENDERER_CONFIG"),ze=W?.metro?.findByPropsLazy("createList"),He=W?.metro?.findByNameLazy("SettingsOverviewScreen",!1);function Bn({tabs:t}){const n=e.NavigationNative.useNavigation();return e.React.createElement(ue,{label:t.title(),leading:e.React.createElement(ue.Icon,{source:t.icon}),trailing:e.React.createElement(e.React.Fragment,{},[t.trailing?t.trailing():null,e.React.createElement(ue.Arrow,{key:"arrow"})]),onPress:function(){const a=t.page;n.navigate("VendettaCustomPage",{title:t.title(),render:function(){return e.React.createElement(a)}})}})}function Pn(t,n){try{n.push(j.after("default",W?.metro?.findByPropsLazy(["renderTitle","sections"],!1),function(a,i){const s=ae.findInReactTree(i.props.children,function(c){return c.type?.name==="UserSettingsOverview"});s&&n.push(j.after("render",s.type.prototype,function(c,d){const l=ae.findInReactTree(d.props.children,function(g){return g?.children?.[1]?.type===Dn})?.children;if(l){const g=l.findIndex(function(f){return["BILLING_SETTINGS","PREMIUM_SETTINGS"].includes(f?.props?.label)});l.splice(-~g||4,0,e.React.createElement(Bn,{key:t.key,tabs:t}))}}))},!0))}catch(a){Je.logger.info("Panel UI patch failed graciously \u{1F494}",a)}}function xn(t,n){if(!ge||!je){console.warn("[Commands Plugin] Missing required constants for tabs UI patch");return}const a={[t.key]:{type:"pressable",useTitle:t.title,title:t.title,icon:t.icon,IconComponent:t.icon&&function(){return e.React.createElement(kn,{source:t.icon})},usePredicate:t.predicate,useTrailing:t.trailing,onPress:function(){const c=je.getRootNavigationRef(),d=t.page;c.navigate("VendettaCustomPage",{title:t.title(),render:function(){return e.React.createElement(d)}})},withArrow:!0}};let i=ge.SETTING_RENDERER_CONFIG;Object.defineProperty(ge,"SETTING_RENDERER_CONFIG",{enumerable:!0,configurable:!0,get:function(){return{...i,...a}},set:function(c){return i=c}});const s=Symbol("pinToSettings meow meow");try{if(!ze)return;n.push(j.after("createList",ze,function(c,d){if(!c[0][s]){c[0][s]=!0;const[l]=c,g=l.sections?.find(function(f){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(h){return f.label===h&&f.title===h})});g?.settings&&(g.settings=[...g.settings,t.key])}}))}catch{if(!He)return;n.push(j.after("default",He,function(c,d){if(!c[0][s]){c[0][s]=!0;const{sections:l}=ae.findInReactTree(d,function(f){return f.props?.sections}).props,g=l?.find(function(f){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(h){return f.label===h&&f.title===h})});g?.settings&&(g.settings=[...g.settings,t.key])}}))}}function $n(t){const n=[];let a=!1;const i=t.predicate||function(){return!0};return t.predicate=function(){return a?!1:i()},Pn(t,n),xn(t,n),n.push(function(){return a=!0}),function(){for(const s of n)s()}}function Ln(){if(r.storage.sidebarEnabled===!1)return console.log("[Commands Plugin] Sidebar disabled in settings"),function(){};console.log("[Commands Plugin] Patching sidebar...");try{const t=$n({key:"CommandsPlugin",icon:o.getAssetIDByName("SettingsIcon"),title:function(){return"Commands"},predicate:function(){return r.storage.sidebarEnabled!==!1},page:Oe});return console.log("[Commands Plugin] Successfully patched sidebar"),t}catch(t){return console.error("[Commands Plugin] Failed to patch sidebar:",t),function(){}}}r.storage.factSettings||(r.storage.factSettings={sendAsReply:!0,includeCitation:!1}),r.storage.listSettings||(r.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),r.storage.garySettings||(r.storage.garySettings={imageSource:"gary"}),r.storage.enabledCommands||(r.storage.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0,sysinfo:!0,spotifyTrack:!0,spotifyAlbum:!0,spotifyArtists:!0,spotifyCover:!0,gary:!0,ip:!0,lovefemboys:!1,nekoslife:!1,friendInviteCreate:!0,friendInviteView:!0,friendInviteRevoke:!0}),r.storage.hiddenSettings||(r.storage.hiddenSettings={enabled:!1,visible:!1,konochanBypassNsfw:!1}),r.storage.sidebarEnabled===void 0&&(r.storage.sidebarEnabled=!0);const Mn={catfact:at,dogfact:rt,useless:it,petpet:ht,pluginList:ut,themeList:gt,konoself:Ct,konosend:bt,firstmessage:wt,sysinfo:Pt,spotifyTrack:Ft,spotifyAlbum:Vt,spotifyArtists:Ut,spotifyCover:Wt,gary:Ot,ip:Yt,lovefemboys:Kt,nekoslife:nn,friendInviteCreate:sn,friendInviteView:on,friendInviteRevoke:cn};let fe=[],te;var _n={onLoad:function(){if(console.log("[Commands Plugin] Loading..."),r.storage.sidebarEnabled!==!1)try{te=Ln(),console.log("[Commands Plugin] Sidebar patched successfully")}catch(t){console.error("[Commands Plugin] Failed to patch sidebar:",t)}for(const[t,n]of Object.entries(Mn))if(r.storage.enabledCommands[t])try{fe.push(Ye.registerCommand(n)),console.log(`[Commands Plugin] Registered command: ${t}`)}catch(a){console.error(`[Commands Plugin] Failed to register command ${t}:`,a)}},onUnload:function(){if(console.log("[Commands Plugin] Unloading..."),fe.forEach(function(t){try{t()}catch{}}),fe=[],te)try{te(),te=void 0,console.log("[Commands Plugin] Sidebar unpatched")}catch(t){console.error("[Commands Plugin] Failed to unpatch sidebar:",t)}},settings:Oe};return ne.default=_n,Object.defineProperty(ne,"__esModule",{value:!0}),ne})({},vendetta.commands,vendetta.plugin,vendetta.metro,vendetta.ui.toasts,vendetta.themes,vendetta.plugins,vendetta.ui,vendetta.metro.common,vendetta.debug,vendetta.ui.assets,vendetta.storage,vendetta.ui.components,vendetta,vendetta.patcher,vendetta.utils); diff --git a/Commands/manifest.json b/Commands/manifest.json new file mode 100644 index 0000000..ff369a8 --- /dev/null +++ b/Commands/manifest.json @@ -0,0 +1 @@ +{"authors":[{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","vendetta":{"icon":"ic_badge_staff","original":"plugins/all-in-one"},"name":"Commands","description":"A collection of fixed commands including facts, petpet, and more.","version":"1.0.0","hash":"5ac903b87ff0bf956fff5b45ec24c1aa5254351fdcd8892136a4b6067d786608"} \ No newline at end of file diff --git a/multi-scrobbler/index.js b/multi-scrobbler/index.js new file mode 100644 index 0000000..0e7f664 --- /dev/null +++ b/multi-scrobbler/index.js @@ -0,0 +1 @@ +(function(Y,p,r,x,Pt,U,re,T,w,Q,Qe,ne){"use strict";const b={DEFAULT_APP_NAME:"Music",DEFAULT_TIME_INTERVAL:5,APPLICATION_ID:"1368513179272871956",MIN_UPDATE_INTERVAL:3,LIBREFM_MIN_UPDATE_INTERVAL:60,MAX_RETRY_ATTEMPTS:3,RETRY_DELAY:5e3,SERVICES:{lastfm:{name:"Last.fm",baseUrl:"https://ws.audioscrobbler.com/2.0",requiresApiKey:!0,requiresToken:!1},librefm:{name:"Libre.fm",baseUrl:"https://libre.fm/2.0",requiresApiKey:!0,requiresToken:!1},listenbrainz:{name:"ListenBrainz",baseUrl:"https://api.listenbrainz.org/1",requiresApiKey:!0,requiresToken:!0}},DEFAULT_HEADERS:{},DEFAULT_COVER_HASHES:["2a96cbd8b46e442fc41c2b86b821562f"],DEFAULT_SETTINGS:{username:"",apiKey:"",appName:"Music",timeInterval:5,showTimestamp:!0,listeningTo:!0,showLargeText:!0,ignoreYouTubeMusic:!1,verboseLogging:!1,service:void 0,librefmUsername:"",librefmApiKey:"",listenbrainzUsername:"",listenbrainzToken:""},API_ERROR_CODES:{2:"Invalid service",3:"Invalid method",4:"Invalid format",5:"Invalid parameters",6:"Invalid resource specified",7:"Invalid session key",8:"Invalid API key",9:"Invalid session",10:"Invalid API signature",11:"Service offline",13:"Invalid method signature supplied",16:"Service temporarily unavailable",26:"Suspended API key",29:"Rate limit exceeded"}};function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function be(e,t){for(var n=0;n10&&(R.serviceErrors[e]=R.serviceErrors[e].slice(-10)),me(`${e} error:`,t)}function we(){R.lastSuccessfulUpdate=new Date().toISOString(),J("Successful update recorded at:",R.lastSuccessfulUpdate)}function ee(e){return ee=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},ee(e)}function Re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Re=function(){return!!e})()}function tt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function nt(e,t){return t&&(rt(t)==="object"||typeof t=="function")?t:tt(e)}function ie(e,t,n){return t=ee(t),nt(e,Re()?Reflect.construct(t,n||[],ee(e).constructor):t.apply(e,n))}function se(e,t){return se=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},se(e,t)}function oe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&se(e,t)}let le=(function(){function e(){B(this,e)}return O(e,[{key:"log",value:function(...t){console.log(`[${this.getServiceName()}]`,...t)}},{key:"logError",value:function(...t){console.error(`[${this.getServiceName()}] Error:`,...t)}},{key:"logVerbose",value:function(...t){console.log(`[${this.getServiceName()}] Verbose:`,...t)}},{key:"handleError",value:async function(t){this.lastError=t.error||0;const n=this.getErrorMessage(t);throw this.logError(n),Z(this.getServiceName().toLowerCase(),n),new Error(`${this.getServiceName()} API Error: ${n}`)}},{key:"getErrorMessage",value:function(t){return t.error&&b.API_ERROR_CODES[t.error]?b.API_ERROR_CODES[t.error]:t.message||t.toString()||"Unknown error"}},{key:"makeRequest",value:async function(t,n={}){try{this.logVerbose(`Making request to: ${t}`),ve();const a=await fetch(t,{...n,headers:{"User-Agent":"Vendetta Multi-Service Scrobbler/3.0.0",...n.headers}});if(!a.ok){const s=new Error(`HTTP ${a.status}: ${a.statusText}`);throw Z(this.getServiceName().toLowerCase(),s.message),s}const i=await a.json();return i.error&&await this.handleError(i),this.retryCount=0,i}catch(a){if(this.retryCount++,this.retryCount>b.MAX_RETRY_ATTEMPTS)throw this.retryCount=0,Z(this.getServiceName().toLowerCase(),`Max retries exceeded: ${a.message}`),a;return this.logVerbose(`Request failed, retrying (${this.retryCount}/${b.MAX_RETRY_ATTEMPTS})`),await new Promise(function(i){return setTimeout(i,b.RETRY_DELAY)}),this.makeRequest(t,n)}}},{key:"isDefaultCover",value:function(t){return t?b.DEFAULT_COVER_HASHES.some(function(n){return t.includes(n)}):!0}},{key:"processAlbumArt",value:function(t){return!t||this.isDefaultCover(t)?null:t}},{key:"getLastError",value:function(){return this.lastError}},{key:"resetRetryCount",value:function(){this.retryCount=0}}]),e})(),at=(function(e){oe(t,e);function t(){return B(this,t),ie(this,t,arguments)}return O(t,[{key:"getServiceName",value:function(){return"Last.fm"}},{key:"logVerbose",value:function(...n){l.verboseLogging&&console.log(`[${this.getServiceName()}] Verbose:`,...n)}},{key:"validateCredentials",value:async function(){try{if(!l.username||!l.apiKey)throw new Error("Username or API key not set");const n=new URLSearchParams({method:"user.getinfo",user:l.username,api_key:l.apiKey,format:"json"}),a=`${b.SERVICES.lastfm.baseUrl}?${n}`;return await this.makeRequest(a),this.log("Credentials validation successful"),!0}catch(n){return this.logError("Credentials validation failed:",n),!1}}},{key:"fetchLatestScrobble",value:async function(){try{if(!l.username||!l.apiKey)throw new Error("Username or API key not set");this.logVerbose("Fetching latest scrobble for user:",l.username);const n=new URLSearchParams({method:"user.getrecenttracks",user:l.username,api_key:l.apiKey,limit:"1",extended:"1",format:"json"}),a=`${b.SERVICES.lastfm.baseUrl}?${n}`,i=(await this.makeRequest(a))?.recenttracks?.track?.[0];if(!i)throw new Error("No tracks found");this.logVerbose("Raw track data:",i);const s=!!i["@attr"]?.nowplaying,o=i.date?.uts?parseInt(i.date.uts):Math.floor(Date.now()/1e3);let g=null,f=null;if(s)try{const P=new URLSearchParams({method:"track.getInfo",track:i.name,artist:i.artist.name,api_key:l.apiKey,format:"json"}),$=`${b.SERVICES.lastfm.baseUrl}?${P}`,y=await this.makeRequest($);y?.track?.duration&&(g=parseInt(y.track.duration),g>0&&(g=Math.floor(g/1e3),f=o+g))}catch(P){this.logVerbose("Failed to fetch track duration:",P)}const h=this.processAlbumArt(i.image?.find(function(P){return P.size==="large"})?.["#text"]),k={name:i.name,artist:i.artist.name,album:i.album["#text"],albumArt:h,url:i.url,date:i.date?.["#text"]??"now",nowPlaying:s,loved:i.loved==="1",from:o,to:f,duration:g};return this.logVerbose("Processed track:",k),this.log(`${s?"Now playing":"Last played"}:`,`${k.artist} - ${k.name}`),k}catch(n){throw this.logError("Failed to fetch latest scrobble:",n),n}}}]),t})(le),it=(function(e){oe(t,e);function t(){return B(this,t),ie(this,t,arguments)}return O(t,[{key:"getServiceName",value:function(){return"Libre.fm"}},{key:"logVerbose",value:function(...n){l.verboseLogging&&console.log(`[${this.getServiceName()}] Verbose:`,...n)}},{key:"validateCredentials",value:async function(){try{const n=l.librefmUsername,a=l.librefmApiKey;if(!n||!a)throw new Error("Username or API key not set for Libre.fm");const i=new URLSearchParams({method:"user.getinfo",user:n,api_key:a,format:"json"}),s=`${b.SERVICES.librefm.baseUrl}?${i}`;return await this.makeRequest(s),this.log("Credentials validation successful"),!0}catch(n){return this.logError("Credentials validation failed:",n),!1}}},{key:"fetchLatestScrobble",value:async function(){try{const n=l.librefmUsername,a=l.librefmApiKey;if(!n||!a)throw new Error("Username or API key not set for Libre.fm");this.logVerbose("Fetching latest scrobble for user:",n);const i=new URLSearchParams({method:"user.getrecenttracks",user:n,api_key:a,limit:"1",extended:"1",format:"json"}),s=`${b.SERVICES.librefm.baseUrl}?${i}`,o=(await this.makeRequest(s))?.recenttracks?.track?.[0];if(!o)throw new Error("No tracks found");this.logVerbose("Raw track data:",o);const g=!!o["@attr"]?.nowplaying,f=o.date?.uts?parseInt(o.date.uts):Math.floor(Date.now()/1e3);let h=null,k=null;if(g)try{const y=new URLSearchParams({method:"track.getInfo",track:o.name,artist:o.artist.name,api_key:a,format:"json"}),D=`${b.SERVICES.librefm.baseUrl}?${y}`,L=await this.makeRequest(D);L?.track?.duration&&(h=parseInt(L.track.duration),h>0&&(h=Math.floor(h/1e3),k=f+h))}catch(y){this.logVerbose("Failed to fetch track duration:",y)}const P=this.processAlbumArt(o.image?.find(function(y){return y.size==="large"})?.["#text"]),$={name:o.name,artist:o.artist.name,album:o.album["#text"],albumArt:P,url:o.url,date:o.date?.["#text"]??"now",nowPlaying:g,loved:o.loved==="1",from:f,to:k,duration:h};return this.logVerbose("Processed track:",$),this.log(`${g?"Now playing":"Last played"}:`,`${$.artist} - ${$.name}`),$}catch(n){throw this.logError("Failed to fetch latest scrobble:",n),n}}}]),t})(le),st=(function(e){oe(t,e);function t(){return B(this,t),ie(this,t,arguments)}return O(t,[{key:"getServiceName",value:function(){return"ListenBrainz"}},{key:"logVerbose",value:function(...n){l.verboseLogging&&console.log(`[${this.getServiceName()}] Verbose:`,...n)}},{key:"validateCredentials",value:async function(){try{const n=l.listenbrainzUsername,a=l.listenbrainzToken;if(!n)throw new Error("Username not set for ListenBrainz");const i=`${b.SERVICES.listenbrainz.baseUrl}/user/${encodeURIComponent(n)}/listens?count=1`,s={};return a&&(s.Authorization=`Token ${a}`),await this.makeRequest(i,{headers:s}),this.log("Credentials validation successful"),!0}catch(n){return this.logError("Credentials validation failed:",n),!1}}},{key:"fetchLatestScrobble",value:async function(){try{const n=l.listenbrainzUsername,a=l.listenbrainzToken;if(!n)throw new Error("Username not set for ListenBrainz");this.logVerbose("Fetching latest scrobble for user:",n);let i=null;const s=function(y){if(y){if(Array.isArray(y.listens))return y.listens;if(y.payload&&Array.isArray(y.payload.listens))return y.payload.listens;if(y.data&&Array.isArray(y.data.listens))return y.data.listens}};try{const y=`${b.SERVICES.listenbrainz.baseUrl}/user/${encodeURIComponent(n)}/playing-now`,D={};a&&(D.Authorization=`Token ${a}`);const L=await this.makeRequest(y,{headers:D}),M=s(L);M&&M.length>0&&(i=M[0],i.playing_now=!0)}catch(y){this.logVerbose("No currently playing track or failed to fetch:",y)}let o;if(i)o=i,this.logVerbose("Using currently playing track");else{const y=`${b.SERVICES.listenbrainz.baseUrl}/user/${encodeURIComponent(n)}/listens?count=1`,D={};a&&(D.Authorization=`Token ${a}`);const L=await this.makeRequest(y,{headers:D}),M=(function(){if(L){if(Array.isArray(L.listens))return L.listens;if(L.payload&&Array.isArray(L.payload.listens))return L.payload.listens;if(L.data&&Array.isArray(L.data.listens))return L.data.listens}})();if(!M||M.length===0)throw new Error("No listens found");o=M[0],this.logVerbose("Using latest completed listen")}this.logVerbose("Raw listen data:",o);const g=!!o.playing_now,f=o.listened_at||Math.floor(Date.now()/1e3);let h=null,k=null;o.track_metadata.additional_info?.duration_ms&&(h=Math.floor(o.track_metadata.additional_info.duration_ms/1e3),g&&h>0&&(k=f+h));const P=null;o.track_metadata.additional_info?.release_mbid;const $={name:o.track_metadata.track_name,artist:o.track_metadata.artist_name,album:o.track_metadata.release_name||"",albumArt:P,url:o.track_metadata.additional_info?.origin_url||`https://listenbrainz.org/player/${o.track_metadata.additional_info?.recording_mbid||`${encodeURIComponent(o.track_metadata.artist_name)}/${encodeURIComponent(o.track_metadata.track_name)}`}`,date:g?"now":new Date(f*1e3).toISOString(),nowPlaying:g,loved:!1,from:f,to:k,duration:h};return this.logVerbose("Processed track:",$),this.log(`${g?"Now playing":"Last played"}:`,`${$.artist} - ${$.name}`),$}catch(n){throw this.logError("Failed to fetch latest listen:",n),n}}},{key:"getErrorMessage",value:function(n){return n.error?n.error:n.message?n.message:n.toString()||"Unknown error"}}]),t})(le);const K=(function(){function e(){B(this,e),this.serviceInstances=new Map}return O(e,[{key:"getService",value:function(t){this.serviceInstances||(this.serviceInstances=new Map);const n=t||l.service;if(!n)throw new Error("[ServiceFactory] No service type specified and no default service configured");return this.serviceInstances.has(n)||this.serviceInstances.set(n,this.createService(n)),this.serviceInstances.get(n)}},{key:"getCurrentService",value:function(){return this.getService(l.service)}},{key:"createService",value:function(t){switch(t){case"lastfm":return new at;case"librefm":return new it;case"listenbrainz":return new st;default:throw new Error(`[ServiceFactory] Unknown service type: ${t}`)}}},{key:"clearCache",value:function(){this.serviceInstances?this.serviceInstances.clear():this.serviceInstances=new Map}},{key:"validateCurrentService",value:function(){return this.getCurrentService().validateCredentials()}},{key:"testService",value:async function(t){try{return await this.getService(t).validateCredentials()}catch(n){return console.error(`[ServiceFactory] Failed to test ${t}:`,n),!1}}},{key:"getSupportedServices",value:function(){return["lastfm","librefm","listenbrainz"]}},{key:"getServiceDisplayName",value:function(t){return this.getService(t).getServiceName()}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e})().getInstance();function Se(e){if(!e||e<0)return"0:00";const t=Math.floor(e/3600),n=Math.floor(e%3600/60),a=Math.floor(e%60);return t>0?`${t}:${n.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${n}:${a.toString().padStart(2,"0")}`}function Ee(){return Math.floor(Date.now()/1e3)}var ot=(function(e){return e[e.PLAYING=0]="PLAYING",e[e.STREAMING=1]="STREAMING",e[e.LISTENING=2]="LISTENING",e[e.COMPETING=5]="COMPETING",e})(ot||{});const A=function(...e){return console.log("[Scrobble Plugin]",...e)},z=function(...e){return console.error("[Scrobble Plugin] Error:",...e)},C=function(...e){return l.verboseLogging&&console.log("[Scrobble Plugin] Verbose:",...e)},ce=(function(){function e(){B(this,e)}return O(e,[{key:"updateActivity",value:async function(){if(S.pluginStopped){A("Plugin is stopped; skipping activity updates and clearing timers"),C("Plugin is stopped, skipping update");try{this.stopUpdates(),C("Update timers cleared due to stopped plugin")}catch(a){z("Error while stopping updates for stopped plugin:",a)}return}const t=K.getCurrentService().getServiceName();C(`Fetching latest track from ${t}...`);let n=!1;try{if(l.ignoreList&&l.ignoreList.length>0){const o=Ze.findActivity(function(g){return g.name?l.ignoreList.some(function(f){return g.name.toLowerCase().includes(f.toLowerCase())}):!1});if(o){A(`Ignored app (${o.name}) is currently active; clearing activity and skipping updates`),C(`Ignored app (${o.name}) is currently playing, clearing activity`);try{G("ignoredActivity",o.name)}catch(g){C("Failed to set debug info for ignored activity:",g)}ae();return}}ve();const a=await K.getCurrentService().fetchLatestScrobble();if(G("lastTrack",a),!a.nowPlaying){A("No currently playing track reported by service; clearing activity and skipping RPC update"),C("Track is not currently playing");try{G("lastTrack_nowPlaying",!1)}catch(o){C("Failed to set debug info for nowPlaying:",o)}ae();return}if(S.lastTrackUrl===a.url){A("Track unchanged; skipping Discord RPC update"),C("Track hasn't changed"),we(),this.consecutiveFailures=0;return}n=!0,A(`\u{1F3B5} Track changed: ${a.artist} - ${a.name}`);let i;if(a.nowPlaying&&l.showTimestamp&&a.from){const o=Ee();let g=a.from;if(g0){const f=Math.min(a.duration*.1,30);g=o-f}else g=o;C("had to estimate start time")}i={start:g*1e3},a.to&&(i.end=a.to*1e3)}C(`\u{1F3AF} Preparing RPC update for: ${a.artist} - ${a.name}`);const s={name:l.appName||b.DEFAULT_APP_NAME,flags:0,type:l.listeningTo?2:0,details:a.name,state:`${a.artist}`,status_display_type:1,application_id:b.APPLICATION_ID};if(s.name.includes("{{")){const o={artist:a.artist,name:a.name,album:a.album,service:t};for(const[g,f]of Object.entries(o))s.name=s.name.replace(new RegExp(`{{${g}}}`,"g"),f||"")}if(i&&(s.timestamps=i,C("Timestamps set:",{start:new Date(i.start).toISOString(),end:i.end?new Date(i.end).toISOString():"none",duration:a.duration?Se(a.duration):"unknown"})),a.album||a.albumArt){const o=a.albumArt?[a.albumArt]:[];let g=(await et(o))[0];if(g){if(s.assets={large_image:g},l.showLargeText){let f="";if(l.showAlbumInTooltip&&a.album&&(f+=`on ${a.album}`),l.showDurationInTooltip&&a.duration){const h=Se(a.duration);f?f+=` \u2022 ${h}`:f=h}f&&(s.assets.large_text=f)}C("Album art set:",g),s.assets.large_text&&C("Tooltip text set:",s.assets.large_text)}else a.album&&l.showLargeText&&l.showAlbumInTooltip&&(s.assets={large_text:`on ${a.album}`})}C("Setting Discord activity:",s),G("lastActivity",s),await ye(s),S.lastTrackUrl=a.url,this.currentActivity=s,S.lastActivity=s,this.consecutiveFailures=0,this.lastUpdateTime=Ee(),we(),A(`\u2705 RPC updated successfully: ${a.artist} - ${a.name}`)}catch(a){z("Update failed:",a);try{Z(l.service,a.message)}catch(i){z("Failed to record service error:",i)}try{G("lastUpdateError",{message:a.message,service:l.service,lastTrackUrl:S.lastTrackUrl})}catch(i){C("Failed to set debug info for last update error:",i)}this.handleError(a)}}},{key:"handleError",value:function(t){this.consecutiveFailures++,G("lastError",t),z(`Failure ${this.consecutiveFailures}/${b.MAX_RETRY_ATTEMPTS}:`,t.message),this.consecutiveFailures>=b.MAX_RETRY_ATTEMPTS&&(z("Max retry attempts reached, initiating reconnection..."),this.startReconnection())}},{key:"startReconnection",value:function(){var t=this;this.isReconnecting||(this.isReconnecting=!0,this.stopUpdates(),A("Starting reconnection process..."),this.reconnectTimer=setInterval(function(){A("Attempting to reconnect..."),t.initialize().then(function(){A("Reconnection successful!"),t.stopReconnection()}).catch(function(n){z("Reconnection attempt failed:",n.message)})},b.RETRY_DELAY))}},{key:"stopReconnection",value:function(){try{this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=void 0),this.isReconnecting=!1,this.consecutiveFailures=0}catch(t){console.error("[Scrobble Plugin] Reconnection cleanup error:",t)}}},{key:"stopUpdates",value:function(){try{this.updateTimer&&(clearInterval(this.updateTimer),this.updateTimer=void 0)}catch(t){console.error("[Scrobble Plugin] Timer cleanup error:",t)}}},{key:"initialize",value:async function(){var t=this;if(S.pluginStopped)throw new Error("Plugin is stopped");const n=K.getCurrentService().getServiceName();A(`Initializing with ${n}...`);try{if(!await K.validateCurrentService())throw new Error(`Invalid credentials for ${n}`);A(`${n} credentials validated successfully`)}catch(o){throw z(`Failed to validate ${n} credentials:`,o),o}this.stopUpdates(),A("\u{1F3B5} checking for already playing songs..."),await this.updateActivity();const a=l.service;let i=b.MIN_UPDATE_INTERVAL;a==="librefm"&&(i=b.LIBREFM_MIN_UPDATE_INTERVAL,A(`Libre.fm active: enforcing ${i}s minimum update interval`));const s=Math.max((Number(l.timeInterval)||b.DEFAULT_SETTINGS.timeInterval)*1e3,i*1e3);this.updateTimer=setInterval(function(){return t.updateActivity()},s),A(`Update timer started with interval: ${s}ms (${s/1e3}s)`)}},{key:"stop",value:function(){if(!S.pluginStopped){A("Stopping plugin..."),S.pluginStopped=!0;try{this.stopUpdates(),this.stopReconnection(),ae(),A("Plugin stopped successfully")}catch(t){console.error("[Scrobble Plugin] Stop error:",t)}}}},{key:"switchService",value:async function(t){if(S.pluginStopped)return;A(`Switching to ${t}...`);const n=!S.pluginStopped;this.stop();try{K.clearCache(),S.lastTrackUrl=void 0,this.currentActivity=void 0,this.lastUpdateTime=0,n&&(S.pluginStopped=!1,await this.initialize())}catch(a){z("Failed to switch service:",a)}}},{key:"getStatus",value:function(){const t=K.getCurrentService().getServiceName();return{running:!S.pluginStopped,service:t,consecutiveFailures:this.consecutiveFailures,isReconnecting:this.isReconnecting,lastTrackUrl:S.lastTrackUrl,updateInterval:this.updateTimer?"Active":"Inactive"}}}],[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}]),e})().getInstance(),lt=function(){return ce.initialize()},ue=function(){return ce.stop()},ct=function(e){return ce.switchService(e)},{ScrollView:F}=x.findByProps("ScrollView"),{TableRowGroup:E,TableSwitchRow:Te,TableCheckboxRow:q,Stack:N,TableRow:u}=x.findByProps("TableSwitchRow","TableCheckboxRow","TableRowGroup","Stack","TableRow"),{TextInput:_}=x.findByProps("TextInput");function ut(){U.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(n){return n+1},0),t=async function(){T.showToast("Testing Last.fm connection...",w.getAssetIDByName("ClockIcon"));try{await W.testService("lastfm")?T.showToast("\u2705 Last.fm connection successful!",w.getAssetIDByName("CheckIcon")):T.showToast("\u274C Last.fm connection failed",w.getAssetIDByName("XIcon"))}catch{T.showToast("\u274C Connection error",w.getAssetIDByName("XIcon"))}};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(N,{spacing:8},r.React.createElement(E,{title:"Credentials"},r.React.createElement(N,{spacing:4},r.React.createElement(_,{placeholder:"Last.fm Username",value:c("username"),onChange:function(n){I("username",n),e()},isClearable:!0}),r.React.createElement(_,{placeholder:"Last.fm API Key",value:c("apiKey"),onChange:function(n){I("apiKey",n),e()},secureTextEntry:!0,isClearable:!0}))),r.React.createElement(E,{title:"Actions"},r.React.createElement(u,{label:"Test Connection",subLabel:"Verify your Last.fm credentials",trailing:r.React.createElement(u.Arrow,null),onPress:t}),r.React.createElement(u,{label:"Get API Key",subLabel:"Create a Last.fm API key at last.fm/api/account/create",trailing:r.React.createElement(u.Arrow,null),onPress:async function(){try{await re.Linking.openURL("https://www.last.fm/api/account/create")}catch(n){console.error("Failed to open Last.fm API URL:",n),T.showToast("Failed to open web browser. Please visit: https://www.last.fm/api/account/create",w.getAssetIDByName("XIcon"))}}}))))}function gt(){U.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(n){return n+1},0),t=async function(){T.showToast("Testing Libre.fm connection...",w.getAssetIDByName("ClockIcon"));try{await W.testService("librefm")?T.showToast("\u2705 Libre.fm connection successful!",w.getAssetIDByName("CheckIcon")):T.showToast("\u274C Libre.fm connection failed",w.getAssetIDByName("XIcon"))}catch{T.showToast("\u274C Connection error",w.getAssetIDByName("XIcon"))}};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(N,{spacing:8},r.React.createElement(E,{title:"Credentials"},r.React.createElement(N,{spacing:4},r.React.createElement(_,{placeholder:"Libre.fm Username",value:c("librefmUsername"),onChange:function(n){I("librefmUsername",n),e()},isClearable:!0}),r.React.createElement(_,{placeholder:"Libre.fm API Key",value:c("librefmApiKey"),onChange:function(n){I("librefmApiKey",n),e()},secureTextEntry:!0,isClearable:!0}))),r.React.createElement(E,{title:"Actions"},r.React.createElement(u,{label:"Test Connection",subLabel:"Verify your Libre.fm credentials",trailing:r.React.createElement(u.Arrow,null),onPress:t}),r.React.createElement(u,{label:"Get API Key",subLabel:"Create a Last.fm API key (compatible with Libre.fm)",trailing:r.React.createElement(u.Arrow,null),onPress:async function(){try{await re.Linking.openURL("https://www.last.fm/api/account/create")}catch(n){console.error("Failed to open Last.fm API URL:",n),T.showToast("Failed to open web browser. Please visit: https://www.last.fm/api/account/create",w.getAssetIDByName("XIcon"))}}}))))}function ft(){U.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(n){return n+1},0),t=async function(){T.showToast("Testing ListenBrainz connection...",w.getAssetIDByName("ClockIcon"));try{await W.testService("listenbrainz")?T.showToast("\u2705 ListenBrainz connection successful!",w.getAssetIDByName("CheckIcon")):T.showToast("\u274C ListenBrainz connection failed",w.getAssetIDByName("XIcon"))}catch{T.showToast("\u274C Connection error",w.getAssetIDByName("XIcon"))}};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(N,{spacing:8},r.React.createElement(E,{title:"Credentials"},r.React.createElement(N,{spacing:4},r.React.createElement(_,{placeholder:"ListenBrainz Username",value:c("listenbrainzUsername"),onChange:function(n){I("listenbrainzUsername",n),e()},isClearable:!0}),r.React.createElement(_,{placeholder:"ListenBrainz Token",value:c("listenbrainzToken"),onChange:function(n){I("listenbrainzToken",n),e()},secureTextEntry:!0,isClearable:!0}))),r.React.createElement(E,{title:"Actions"},r.React.createElement(u,{label:"Test Connection",subLabel:"Verify your ListenBrainz credentials",trailing:r.React.createElement(u.Arrow,null),onPress:t}),r.React.createElement(u,{label:"Get User Token",subLabel:"Get your ListenBrainz user token at listenbrainz.org/settings/",trailing:r.React.createElement(u.Arrow,null),onPress:async function(){try{await re.Linking.openURL("https://listenbrainz.org/settings/")}catch(n){console.error("Failed to open ListenBrainz settings URL:",n),T.showToast("Failed to open web browser. Please visit: https://listenbrainz.org/settings/",w.getAssetIDByName("XIcon"))}}}))))}function dt(){U.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(n){return n+1},0),t=c("service")==="librefm";return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(N,{spacing:8},r.React.createElement(E,{title:"Activity Display"},r.React.createElement(N,{spacing:4},r.React.createElement(_,{placeholder:`App Name (Default: ${b.DEFAULT_SETTINGS.appName})`,value:c("appName",b.DEFAULT_SETTINGS.appName),onChange:function(n){I("appName",n),e()},isClearable:!0}),t?r.React.createElement(u,{label:"Update Interval Disabled",subLabel:"Libre.fm requires a fixed 60s update interval to prevent rate limiting",disabled:!0,dimmed:!0}):r.React.createElement(_,{placeholder:`Update Interval (Default: ${b.DEFAULT_SETTINGS.timeInterval}s)`,value:String(c("timeInterval",b.DEFAULT_SETTINGS.timeInterval)),onChange:function(n){const a=Number(n);a>=b.MIN_UPDATE_INTERVAL&&(I("timeInterval",a),e())},keyboardType:"numeric",isClearable:!0}))),r.React.createElement(E,{title:"About Display Settings"},r.React.createElement(u,{label:"App Name",subLabel:"The name shown in Discord for your activity"}),r.React.createElement(u,{label:"Update Interval",subLabel:"How often the plugin checks for new tracks (in seconds)"}),r.React.createElement(u,{label:"Minimum Interval",subLabel:`The plugin will never check more frequently than ${b.MIN_UPDATE_INTERVAL} seconds`}))))}function pt(){U.useProxy(p.plugin.storage);const[e,t]=r.React.useState(null),[n,a]=r.React.useState(!0),[i,s]=r.React.useState(0),[o,g]=r.React.useState(!1),f={name:"Bohemian Rhapsody",artist:"Queen",artists:["Queen"],album:"A Night at the Opera",image:null,nowPlaying:!0,duration:354,startTime:Math.floor(Date.now()/1e3)-120},h=function(d){return d?Array.isArray(d)?d.filter(function(m){return m&&typeof m=="string"}):d["#text"]?d["#text"].split(/[,;&]/).map(function(m){return m.trim()}).filter(function(m){return m.length>0}):typeof d=="string"?d.split(/[,;&]/).map(function(m){return m.trim()}).filter(function(m){return m.length>0}):["Unknown Artist"]:["Unknown Artist"]},k=function(d){return!d||d.length===0?"Unknown Artist":d.length===1?d[0]:d.length===2?`${d[0]} & ${d[1]}`:`${d.slice(0,-1).join(", ")} & ${d[d.length-1]}`};r.React.useEffect(function(){(async function(){if(!c("username")||!c("apiKey")){t(f),g(!0),a(!1);return}try{a(!0);const d=await(await fetch(`https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${c("username")}&api_key=${c("apiKey")}&format=json&limit=1`)).json();if(d.recenttracks&&d.recenttracks.track&&d.recenttracks.track.length>0){const m=d.recenttracks.track[0],j=h(m.artist);let He=180;try{const Ct=j[0]||"Unknown Artist",pe=await(await fetch(`https://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=${c("apiKey")}&artist=${encodeURIComponent(Ct)}&track=${encodeURIComponent(m.name)}&format=json&u[...]`)).json();pe.track&&pe.track.duration&&(He=Math.floor(pe.track.duration/1e3))}catch{console.log("Could not fetch track duration, using default")}t({name:m.name||"Unknown Track",artist:k(j),artists:j,album:m.album?.["#text"]||"Unknown Album",image:m.image?.[2]?.["#text"]||m.image?.[1]?.["#text"]||null,nowPlaying:m["@attr"]?.nowplaying==="true",duration:He,startTime:m["@attr"]?.nowplaying==="true"?Math.floor(Date.now()/1e3)-60:null}),g(!1)}else t(f),g(!0)}catch(d){console.error("Failed to fetch preview data, using fallback:",d),t(f),g(!0)}finally{a(!1)}})()},[c("username"),c("apiKey")]),r.React.useEffect(function(){if(!e?.nowPlaying||!c("showTimestamp"))return;const d=setInterval(function(){if(e.startTime&&e.duration){const m=Math.floor(Date.now()/1e3)-e.startTime,j=Math.min(m/e.duration,1);s(j)}},1e3);return function(){return clearInterval(d)}},[e,c("showTimestamp")]);const P=function(d){const m=Math.floor(d/60),j=Math.floor(d%60);return`${m}:${j.toString().padStart(2,"0")}`},$=function(){let d="";if(c("showAlbumInTooltip")&&e?.album&&(d+=`on ${e.album}`),c("showDurationInTooltip")&&e?.duration){const m=` \u2022 ${P(e.duration)}`;d?d+=m:d=P(e.duration)}return d||"No tooltip text"},y=function(){return e?.duration?e.nowPlaying?{current:i*e.duration,total:e.duration,progress:i}:{current:e.duration*.3,total:e.duration,progress:.3}:{current:0,total:0,progress:0}},D=c("listeningTo")?"Listening to":"Playing",L=c("appName")||"Music",M=c("showLargeText",!0),Lt=c("showTimestamp",!1);if(n)return r.React.createElement(r.ReactNative.View,{style:v.container},r.React.createElement(r.ReactNative.View,{style:v.loadingContent},r.React.createElement(r.ReactNative.View,{style:v.loadingSpinner}),r.React.createElement(r.ReactNative.Text,{style:v.loadingText},"Loading preview...")));if(!e)return r.React.createElement(r.ReactNative.View,{style:v.container},r.React.createElement(r.ReactNative.Text,{style:v.centeredText},"Unable to load preview"));const de=y(),Xe=$();return r.React.createElement(r.ReactNative.View,{style:v.previewContainer},r.React.createElement(r.ReactNative.View,{style:v.header},r.React.createElement(r.ReactNative.Text,{style:v.activityType},D," ",L),r.React.createElement(r.ReactNative.Text,{style:v.rpcPreviewText,numberOfLines:1},"RPC Preview")),r.React.createElement(r.ReactNative.View,{style:v.content},r.React.createElement(r.ReactNative.View,{style:v.albumArt},e.image?r.React.createElement(r.ReactNative.Image,{source:{uri:e.image},style:v.albumImage,resizeMode:"cover"}):r.React.createElement(r.ReactNative.Text,{style:v.musicIcon},"\u{1F3B5}")),r.React.createElement(r.ReactNative.View,{style:v.trackInfo},r.React.createElement(r.ReactNative.Text,{style:v.trackName,numberOfLines:1},e.name),r.React.createElement(r.ReactNative.Text,{style:v.artistName,numberOfLines:1},e.artist),M&&Xe!=="No tooltip text"&&r.React.createElement(r.ReactNative.Text,{style:v.tooltipText,numberOfLines:1},Xe),Lt&&e.duration?r.React.createElement(r.ReactNative.View,{style:v.progressContainer},r.React.createElement(r.ReactNative.Text,{style:v.timeText},P(de.current)),r.React.createElement(r.ReactNative.View,{style:v.progressBar},r.React.createElement(r.ReactNative.View,{style:[v.progressFill,{width:`${de.progress*100}%`}]})),r.React.createElement(r.ReactNative.Text,{style:v.timeText},P(de.total))):null)))}const v=r.ReactNative.StyleSheet.create({container:{backgroundColor:"#1e1f22",borderRadius:12,padding:16,marginHorizontal:10,marginBottom:16,borderWidth:1,borderColor:"#3a3c41",alignItems:"center",justifyContent:"center",minHeight:120},loadingContent:{alignItems:"center",justifyContent:"center"},loadingSpinner:{width:20,height:20,borderRadius:10,borderWidth:2,borderColor:"#5865f2",borderTopColor:"transparent",marginBottom:8},previewContainer:{backgroundColor:"#1e1f22",borderRadius:12,padding:16,marginHorizontal:10,marginBottom:16,borderWidth:1,borderColor:"#3a3c41"},header:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:12,gap:8},content:{flexDirection:"row",alignItems:"center"},albumArt:{width:80,height:80,backgroundColor:"#2b2d31",borderRadius:12,justifyContent:"center",alignItems:"center",marginRight:16,borderWidth:1,borderColor:"#40444b",overflow:"hidden",flexShrink:0},trackInfo:{flex:1,minWidth:0},progressContainer:{flexDirection:"row",alignItems:"center",gap:8,marginTop:6},progressBar:{flex:1,height:2,backgroundColor:"#2b2d31",borderRadius:3,overflow:"hidden"},progressFill:{height:2,backgroundColor:"#5865f2",borderRadius:3},loadingText:{color:"#949ba4",fontSize:14,fontWeight:"500"},centeredText:{color:"#949ba4",fontSize:14,fontWeight:"500",textAlign:"center"},activityType:{color:"#dbdee1",fontSize:14,fontWeight:"600",flex:1},rpcPreviewText:{color:"#80848e",fontSize:12,fontStyle:"italic",flexShrink:0},albumImage:{width:80,height:80,borderRadius:12},musicIcon:{color:"#80848e",fontSize:32},trackName:{color:"#ffffff",fontSize:16,fontWeight:"700",marginBottom:4},artistName:{color:"#b5bac1",fontSize:14,fontWeight:"500",marginBottom:4},tooltipText:{color:"#80848e",fontSize:12,fontStyle:"italic",marginBottom:6},timeText:{color:"#80848e",fontSize:11,fontWeight:"500",minWidth:35,textAlign:"center"}});function bt(){U.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(s){return s+1},0),t=c("listeningTo",b.DEFAULT_SETTINGS.listeningTo),n=c("showTimestamp",b.DEFAULT_SETTINGS.showTimestamp),a=function(){const s=!t;I("listeningTo",s),!s&&n&&I("showTimestamp",!1),e()},i=function(){t&&(I("showTimestamp",!n),e())};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(pt,null),r.React.createElement(N,{spacing:8},r.React.createElement(E,{title:"RPC Display Options"},r.React.createElement(q,{label:"Show as Listening",subLabel:"Display as 'Listening to' instead of 'Playing'",checked:t,onPress:a}),r.React.createElement(q,{label:"Show Tooltip Text",subLabel:"Show album name and track duration in Discord activity tooltip",checked:c("showLargeText",!0),onPress:function(){const s=c("showLargeText",!0);I("showLargeText",!s),e()}}),!t&&r.React.createElement(u,{label:"Timestamp Unavailable",subLabel:"Enable 'Show as Listening' to use timestamp feature",disabled:!0,dimmed:!0}),r.React.createElement(q,{label:"Show Timestamp",subLabel:"Display track progress and duration",checked:n,onPress:i,disabled:!t}),r.React.createElement(q,{label:"Show Album in Tooltip",subLabel:"Include album name in the tooltip text",checked:c("showAlbumInTooltip",!0),onPress:function(){const s=c("showAlbumInTooltip",!0);I("showAlbumInTooltip",!s),e()}}),r.React.createElement(q,{label:"Show Duration in Tooltip",subLabel:"Include track duration in the tooltip text",checked:c("showDurationInTooltip",!0),onPress:function(){const s=c("showDurationInTooltip",!0);I("showDurationInTooltip",!s),e()}}))))}function ht(){U.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(s){return s+1},0),[t,n]=r.React.useState(""),a=function(){if(!t.trim()){T.showToast("Please enter an app name",w.getAssetIDByName("Small"));return}const s=c("ignoreList",[]);s.includes(t.trim())?T.showToast("App already in ignore list",w.getAssetIDByName("Warning")):(I("ignoreList",[...s,t.trim()]),n(""),e(),T.showToast("App added to ignore list",w.getAssetIDByName("Check")))},i=function(s){const o=c("ignoreList",[]);I("ignoreList",o.filter(function(g){return g!==s})),e(),T.showToast("App removed from ignore list",w.getAssetIDByName("Check"))};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(N,{spacing:8},r.React.createElement(E,{title:"Add App to Ignore"},r.React.createElement(N,{spacing:4},r.React.createElement(_,{placeholder:"Enter app name",value:t,onChange:n,isClearable:!0,onSubmitEditing:a,returnKeyType:"done"}))),r.React.createElement(E,null,r.React.createElement(u,{label:"Add to Ignore List",subLabel:"Add the current app name to your ignore list",trailing:r.React.createElement(u.Arrow,null),onPress:a})),c("ignoreList",[]).length>0&&r.React.createElement(E,{title:"Ignored Apps"},c("ignoreList",[]).map(function(s,o){return r.React.createElement(u,{key:o,label:s,trailing:r.React.createElement(r.ReactNative.TouchableOpacity,{onPress:function(){return i(s)},style:{padding:8,backgroundColor:"#ff4d4d",borderRadius:12,width:24,height:24,justifyContent:"center",alignItems:"center"}},r.React.createElement(r.ReactNative.Image,{source:w.getAssetIDByName("TrashIcon"),style:{width:14,height:14,tintColor:"#ffffff"}}))})})),r.React.createElement(E,{title:"About Ignore List"},r.React.createElement(u,{label:"How it Works",subLabel:"When any app in your ignore list is active, your music status will be hidden"}),r.React.createElement(u,{label:"Detection",subLabel:"Apps are detected by their Discord activity name"}),r.React.createElement(u,{label:"Examples",subLabel:"Spotify, YouTube Music, Kizzy, Metrolist, echo"}))))}function yt(){U.useProxy(p.plugin.storage);const[,e]=r.React.useReducer(function(t){return t+1},0);return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(N,{spacing:8},r.React.createElement(E,{title:"Logging Options"},r.React.createElement(Te,{label:"Verbose Logging",subLabel:"Enable detailed console logging for debugging",value:c("verboseLogging",b.DEFAULT_SETTINGS.verboseLogging),onValueChange:function(t){I("verboseLogging",t),e()}})),r.React.createElement(E,{title:"Debug Information"},r.React.createElement(u,{label:"Console Logging",subLabel:"Logs are written to the browser/app console when verbose is enabled"}),r.React.createElement(u,{label:"Error Tracking",subLabel:"Connection errors and API failures are automatically logged"})),r.React.createElement(E,{title:"Log Information"},r.React.createElement(u,{label:"API Calls",subLabel:"All API requests are logged when verbose is enabled"}),r.React.createElement(u,{label:"Track Updates",subLabel:"Song changes and RPC updates are logged"}),r.React.createElement(u,{label:"Error Details",subLabel:"Connection errors and retries are logged"}))))}var Ie,ke,Ae,Le,Ce,Pe,Ne,$e,Ue,_e,De,Me,xe,ze,Fe,Ve,Be;(Ie=p.plugin.storage).username??(Ie.username=""),(ke=p.plugin.storage).apiKey??(ke.apiKey=""),(Ae=p.plugin.storage).appName??(Ae.appName="Music"),(Le=p.plugin.storage).timeInterval??(Le.timeInterval=5),(Ce=p.plugin.storage).showTimestamp??(Ce.showTimestamp=!0),(Pe=p.plugin.storage).listeningTo??(Pe.listeningTo=!0),(Ne=p.plugin.storage).verboseLogging??(Ne.verboseLogging=!1),($e=p.plugin.storage).service??($e.service="lastfm"),(Ue=p.plugin.storage).librefmUsername??(Ue.librefmUsername=""),(_e=p.plugin.storage).librefmApiKey??(_e.librefmApiKey=""),(De=p.plugin.storage).listenbrainzUsername??(De.listenbrainzUsername=""),(Me=p.plugin.storage).listenbrainzToken??(Me.listenbrainzToken=""),(xe=p.plugin.storage).addToSidebar??(xe.addToSidebar=!0),(ze=p.plugin.storage).showLargeText??(ze.showLargeText=!0),(Fe=p.plugin.storage).ignoreList??(Fe.ignoreList=[]),(Ve=p.plugin.storage).showAlbumInTooltip??(Ve.showAlbumInTooltip=!0),(Be=p.plugin.storage).showDurationInTooltip??(Be.showDurationInTooltip=!0);const c=function(e,t){return p.plugin.storage[e]??t},I=function(e,t){return p.plugin.storage[e]=t},W=(function(){function e(){B(this,e)}return O(e,null,[{key:"getServiceDisplayName",value:function(t){switch(t){case"lastfm":return"Last.fm";case"librefm":return"Libre.fm";case"listenbrainz":return"ListenBrainz";default:return"Unknown"}}},{key:"testService",value:async function(t){try{switch(t){case"lastfm":return await this.testLastFmConnection();case"librefm":return await this.testLibreFmConnection();case"listenbrainz":return await this.testListenBrainzConnection();default:return!1}}catch(n){return console.error(`Error testing ${t}:`,n),!1}}},{key:"testLastFmConnection",value:async function(){const t=c("username"),n=c("apiKey");if(!t||!n)return!1;try{return!(await(await fetch(`https://ws.audioscrobbler.com/2.0/?method=user.getinfo&user=${t}&api_key=${n}&format=json`)).json()).error}catch(a){return console.error("Last.fm connection test failed:",a),!1}}},{key:"testLibreFmConnection",value:async function(){const t=c("librefmUsername"),n=c("librefmApiKey");if(!t||!n)return!1;try{return!(await(await fetch(`https://libre.fm/2.0/?method=user.getinfo&user=${t}&api_key=${n}&format=json`)).json()).error}catch(a){return console.error("Libre.fm connection test failed:",a),!1}}},{key:"testListenBrainzConnection",value:async function(){const t=c("listenbrainzUsername"),n=c("listenbrainzToken");if(!t)return!1;try{const a={"Content-Type":"application/json"};return n&&(a.Authorization=`Token ${n}`),(await fetch(`https://api.listenbrainz.org/1/user/${t}/listen-count`,{headers:a})).status===200}catch(a){return console.error("ListenBrainz connection test failed:",a),!1}}}]),e})();function Oe(){U.useProxy(p.plugin.storage);const e=r.NavigationNative.useNavigation(),[,t]=r.React.useReducer(function(i){return i+1},0),n=c("service"),a=function(i){switch(i){case"lastfm":return c("username")&&c("apiKey")?"\u2705 Configured":"\u274C Missing credentials";case"librefm":return c("librefmUsername")&&c("librefmApiKey")?"\u2705 Configured":"\u274C Missing credentials";case"listenbrainz":return c("listenbrainzUsername")?"\u2705 Configured":"\u274C Missing username";default:return"\u2753 Unknown"}};return r.React.createElement(F,{style:{flex:1},contentContainerStyle:{padding:10}},r.React.createElement(N,{spacing:8},r.React.createElement(E,{title:"Active Service"},r.React.createElement(u,{label:"Current Service",subLabel:n?`Using: ${W.getServiceDisplayName(n)}`:"No service selected"}),["lastfm","librefm","listenbrainz"].map(function(i){return r.React.createElement(q,{key:i,label:W.getServiceDisplayName(i),subLabel:a(i),checked:n===i,onPress:function(){i!==n&&(I("service",i),t())}})})),r.React.createElement(E,{title:"Service Configuration"},r.React.createElement(u,{label:"Last.fm Settings",subLabel:"Configure Last.fm credentials and options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Last.fm Settings",render:ut})}}),r.React.createElement(u,{label:"Libre.fm Settings",subLabel:"Configure Libre.fm credentials and options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Libre.fm Settings",render:gt})}}),r.React.createElement(u,{label:"ListenBrainz Settings",subLabel:"Configure ListenBrainz credentials and options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"ListenBrainz Settings",render:ft})}})),r.React.createElement(E,{title:"Plugin Configuration"},r.React.createElement(u,{label:"Display Settings",subLabel:"Customize app name and update interval",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Display Settings",render:dt})}}),r.React.createElement(u,{label:"RPC Customization",subLabel:"Customize Discord rich presence display options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"RPC Customization",render:bt})}}),r.React.createElement(u,{label:"Ignore List",subLabel:"Configure apps that should hide your status",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Ignore List Settings",render:ht})}}),r.React.createElement(u,{label:"Logging Settings",subLabel:"Configure logging and debugging options",trailing:r.React.createElement(u.Arrow,null),onPress:function(){return e.push("VendettaCustomPage",{title:"Logging Settings",render:yt})}}),r.React.createElement(Te,{label:"Add to Sidebar",subLabel:"Show plugin in Discord settings",value:c("addToSidebar",!1),onValueChange:function(i){I("addToSidebar",i),t()}})),r.React.createElement(E,{title:"About"},r.React.createElement(u,{label:"Multi Scrobbler",subLabel:"Show off your music status from multiple services"}),r.React.createElement(u,{label:"Author",subLabel:"kmmiio99o"}),r.React.createElement(u,{label:"Version",subLabel:"1.3.2"}))))}const{FormSection:mt,FormRow:ge}=Qe.Forms,{TableRowIcon:vt}=x.findByProps("TableRowIcon"),X=window.bunny,Ke=X?.metro?.findByPropsLazy("getRootNavigationRef"),fe=X?.metro?.findByPropsLazy("SETTING_RENDERER_CONFIG"),je=X?.metro?.findByPropsLazy("createList"),Ge=X?.metro?.findByNameLazy("SettingsOverviewScreen",!1);function wt({tabs:e}){const t=r.NavigationNative.useNavigation();return r.React.createElement(ge,{label:e.title(),leading:r.React.createElement(ge.Icon,{source:e.icon}),trailing:r.React.createElement(r.React.Fragment,{},[e.trailing?e.trailing():null,r.React.createElement(ge.Arrow,{key:"arrow"})]),onPress:function(){const n=e.page;t.navigate("VendettaCustomPage",{title:e.title(),render:function(){return r.React.createElement(n)}})}})}function Rt(e,t){try{t.push(Q.after("default",X?.metro?.findByPropsLazy(["renderTitle","sections"],!1),function(n,a){const i=ne.findInReactTree(a.props.children,function(s){return s.type?.name==="UserSettingsOverview"});i&&t.push(Q.after("render",i.type.prototype,function(s,o){const g=ne.findInReactTree(o.props.children,function(f){return f?.children?.[1]?.type===mt})?.children;if(g){const f=g.findIndex(function(h){return["BILLING_SETTINGS","PREMIUM_SETTINGS"].includes(h?.props?.label)});g.splice(-~f||4,0,r.React.createElement(wt,{key:e.key,tabs:e}))}}))},!0))}catch(n){p.logger.info("Panel UI patch failed graciously \u{1F494}",n)}}function St(e,t){if(!fe||!Ke){console.warn("[LastFm] Missing required constants for tabs UI patch");return}const n={[e.key]:{type:"pressable",useTitle:e.title,title:e.title,icon:e.icon,IconComponent:e.icon&&function(){return r.React.createElement(vt,{source:e.icon})},usePredicate:e.predicate,useTrailing:e.trailing,onPress:function(){const s=Ke.getRootNavigationRef(),o=e.page;s.navigate("VendettaCustomPage",{title:e.title(),render:function(){return r.React.createElement(o)}})},withArrow:!0}};let a=fe.SETTING_RENDERER_CONFIG;Object.defineProperty(fe,"SETTING_RENDERER_CONFIG",{enumerable:!0,configurable:!0,get:function(){return{...a,...n}},set:function(s){return a=s}});const i=Symbol("pinToSettings meow meow");try{if(!je)return;t.push(Q.after("createList",je,function(s,o){if(!s[0][i]){s[0][i]=!0;const[g]=s,f=g.sections?.find(function(h){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(k){return h.label===k&&h.title===k})});f?.settings&&(f.settings=[...f.settings,e.key])}}))}catch{if(!Ge)return;t.push(Q.after("default",Ge,function(s,o){if(!s[0][i]){s[0][i]=!0;const{sections:g}=ne.findInReactTree(o,function(h){return h.props?.sections}).props,f=g?.find(function(h){return["Bunny","Revenge","Kettu","Vencore","ShiggyCord"].some(function(k){return h.label===k&&h.title===k})});f?.settings&&(f.settings=[...f.settings,e.key])}}))}}function Et(e){const t=[];let n=!1;const a=e.predicate||function(){return!0};return e.predicate=function(){return n?!1:a()},Rt(e,t),St(e,t),t.push(function(){return n=!0}),function(){for(const i of t)i()}}function qe(){if(!p.plugin.storage.addToSidebar)return console.log("[Multi Scrobbler] Sidebar disabled in settings"),function(){};console.log("[Multi Scrobbler] Patching sidebar using custom patchSettingsPin...");try{const e=Et({key:"LastFmScrobbler",icon:w.getAssetIDByName("MusicIcon"),title:function(){return"Multi Scrobbler"},predicate:function(){return p.plugin.storage.addToSidebar===!0},page:Oe});return console.log("[Multi Scrobbler] Successfully patched sidebar"),e}catch(e){return console.error("[Multi Scrobbler] Failed to patch sidebar:",e),function(){}}}var Ye;const S={pluginStopped:!1,lastActivity:void 0,updateInterval:void 0,lastTrackUrl:void 0};let V;const We=b.DEFAULT_SETTINGS;Object.keys(We).forEach(function(e){p.plugin.storage[e]=p.plugin.storage[e]??We[e]}),(Ye=p.plugin.storage).addToSidebar??(Ye.addToSidebar=!1);const l=new Proxy(p.plugin.storage,{get(e,t){return e[t]},set(e,t,n){return e[t]=n,!0}});let te=0;const Tt=3,It=5e3;async function H(){try{await lt(),te=0,console.log("[Multi-Scrobbler] Successfully connected")}catch(e){console.error("[Multi-Scrobbler] Initialization error:",e),te++,te