function $(e,t,i){window.enmity.settings.set(e,t,i)}function T(e,t,i){return window.enmity.settings.get(e,t,i)}const{components:o}=window.enmity;o.Alert,o.Button,o.FlatList;const M=o.Image;o.ImageBackground,o.KeyboardAvoidingView,o.Modal,o.Pressable,o.RefreshControl;const O=o.ScrollView;o.SectionList,o.StatusBar,o.StyleSheet,o.Switch;const w=o.Text;o.TextInput,o.TouchableHighlight;const y=o.TouchableOpacity;o.TouchableWithoutFeedback,o.Touchable;const b=o.View;o.VirtualizedList,o.Form,o.FormArrow,o.FormCTA,o.FormCTAButton,o.FormCardSection,o.FormCheckbox;const D=o.FormDivider;o.FormHint,o.FormIcon,o.FormInput,o.FormLabel,o.FormRadio;const l=o.FormRow,f=o.FormSection;o.FormSelect,o.FormSubLabel;const L=o.FormSwitch;o.FormTernaryCheckBox,o.FormText,o.FormTextColors,o.FormTextSizes;function Y(e){window.enmity.plugins.registerPlugin(e)}const d=window.enmity.modules.common.Constants;window.enmity.modules.common.Clipboard,window.enmity.modules.common.Assets;const j=window.enmity.modules.common.Messages;window.enmity.modules.common.Clyde,window.enmity.modules.common.Avatars;const _=window.enmity.modules.common.Native,n=window.enmity.modules.common.React;window.enmity.modules.common.Dispatcher;const v=window.enmity.modules.common.Storage,g=window.enmity.modules.common.Toasts,C=window.enmity.modules.common.Dialog;window.enmity.modules.common.Token;const I=window.enmity.modules.common.REST;window.enmity.modules.common.Settings,window.enmity.modules.common.Users,window.enmity.modules.common.Navigation,window.enmity.modules.common.NavigationNative,window.enmity.modules.common.NavigationStack,window.enmity.modules.common.Theme,window.enmity.modules.common.Linking;const A=window.enmity.modules.common.StyleSheet;window.enmity.modules.common.ColorMap,window.enmity.modules.common.Components,window.enmity.modules.common.Locale,window.enmity.modules.common.Profiles,window.enmity.modules.common.Lodash,window.enmity.modules.common.Logger,window.enmity.modules.common.Flux,window.enmity.modules.common.SVG,window.enmity.modules.common.Scenes;function z(e){return window.enmity.patcher.create(e)}const S={byProps:(...e)=>window.enmity.modules.filters.byProps(...e),byName:(e,t)=>window.enmity.modules.filters.byName(e,t),byTypeName:(e,t)=>window.enmity.modules.filters.byTypeName(e,t),byDisplayName:(e,t)=>window.enmity.modules.filters.byDisplayName(e,t)};function R(...e){return window.enmity.modules.bulk(...e)}function G(...e){return window.enmity.modules.getByProps(...e)}window.enmity.modules.common;const B=e=>{let t=0;for(let i in e)t++;return t};function s(e){return window.enmity.assets.getIDByName(e)}const c={Debug:s("debug"),Retry:s("ic_message_retry"),Failed:s("Small"),Cancel:s("ic_megaphone_nsfw_16px"),Add:s("add_white"),Delete:s("ic_message_delete"),Clear:s("ic_clear_all_24px"),Pencil:s("ic_pencil_24px"),Success:s("ic_selection_checked_24px"),Warning:s("ic_warning_24px"),Copy:s("toast_copy_link"),Open:s("ic_leave_stage"),Clipboard:s("pending-alert"),Initial:s("coffee"),Shield:s("ic_person_shield"),Debug_Command:{Sent:s("ic_application_command_24px"),Clock:s("clock")},Settings:{Toasts:{Context:s("toast_image_saved"),Settings:s("ic_selection_checked_24px")},Self:s("friends_toast_icon"),Share:s("share"),Robot:s("ic_robot_24px"),Commands:s("ic_profile_badge_bot_commands"),Debug:s("ic_rulebook_16px")}},F=e=>{g.open({content:`Copied ${e} to clipboard.`,source:c.Clipboard})},W=e=>{let t=e.split(` `).map(i=>{if(i!="")return`"${i.replaceAll(":",'":"').replace(" ","")}",`});return t[0]=`{${t[0]}`,t[B(t)]=`${t[B(t)]}}`,t=t.join(""),t=t.replaceAll("undefined",""),t=t.split("").reverse().join("").replace(",","").split("").reverse().join(""),t};async function H(){try{let e=await v.getItem("device_list");if(e)return JSON.parse(e);let t=(await I.get("https://gist.githubusercontent.com/adamawolf/3048717/raw/1ee7e1a93dff9416f6ff34dd36b0ffbad9b956e9/Apple_mobile_device_types.txt")).text,i=W(t);await v.setItem("device_list",i);let a=await v.getItem("device_list");return JSON.parse(a)}catch(e){console.warn(`[SpinsPlugins Local Error \u2014 Issue when getting devices: ${e}]`);return}}async function J(e,t,i){let a=await H();return`**[${e}] Debug Information** > **Plugin Version:** ${t} > **Plugin Build:** ${i.split("-")[1]} > **Discord Build:** ${_.InfoDictionaryManager.Version} (${_.InfoDictionaryManager.Build}) > **Software Version:** ${_.DCDDeviceManager.systemVersion} > **Device:** ${a[_.DCDDeviceManager.device]}`}const{native:h}=window.enmity;function X(){h.reload()}h.version,h.build,h.device,h.version;const q=G("transitionToGuild");async function K({manifest:e}){const t=`${e.sourceUrl}?${Math.floor(Math.random()*1001)}.js`,i=await(await I.get(t)).text;let a=i.match(/\d\.\d\.\d+/g),r=i.match(/patch\-\d\.\d\.\d+/g);return!a||!r?k(e.name,e.version):(a=a[0],r=r[0],a!=e.version?N(t,a,r.split("-")[1],e,!1):r!=e.build?N(t,a,r.split("-")[1],e,!0):k(e.name,e.version))}const N=(e,t,i,a,r)=>{const u=r?i:t;C.show({title:"Update found",body:`A newer ${r?"build":"version"} is available for ${a.name}. ${r?` The version will remain at ${t}, but the build will update to ${i}.`:""} Would you like to install ${r?`build \`${i}\``:`version \`${t}\``} now?`,confirmText:"Update",cancelText:"Not now",onConfirm:()=>Q(e,u,a,r)})},k=(e,t)=>{console.log(`[${e}] Plugin is on the latest version, which is ${t}`),g.open({content:`${e} is on latest version (${t})`,source:c.Success})};async function Q(e,t,i,a){window.enmity.plugins.installPlugin(e,({data:r})=>{r=="installed_plugin"||r=="overridden_plugin"?C.show({title:`Updated ${i.name}`,body:`Successfully updated to ${a?"build":"version"} \`${t}\`. Would you like to reload Discord now?`,confirmText:"Yep!",cancelText:"Not now",onConfirm:()=>{X()}}):C.show({title:"Error",body:`Something went wrong while updating ${i.name}.`,confirmText:"Report this issue",cancelText:"Cancel",onConfirm:()=>{q.openURL(`https://github.com/spinfal/enmity-plugins/issues/new?assignees=&labels=bug&template=bug_report.md&title=%5BBUG%5D%20${i.name}%20Update%20Error%3A%20${a?`b${t}`:`v${t}`}`)}})})}const E=window.enmity.modules.common.Components.General.Animated,[x,Z]=R(S.byProps("transitionToGuild"),S.byProps("setString")),m=A.createThemedStyleSheet({container:{paddingTop:30,paddingLeft:20,marginBottom:-5,flexDirection:"row"},text_container:{paddingLeft:15,paddingTop:5,flexDirection:"column",flexWrap:"wrap"},image:{width:75,height:75,borderRadius:10},main_text:{opacity:.975,letterSpacing:.25,fontFamily:d.Fonts.DISPLAY_NORMAL},header:{color:d.ThemeColorMap.HEADER_PRIMARY,fontFamily:d.Fonts.DISPLAY_BOLD,fontSize:25,letterSpacing:.25},sub_header:{color:d.ThemeColorMap.HEADER_SECONDARY,opacity:.975,fontSize:12.75}});var ee=({manifest:e})=>{const t=n.useRef(new E.Value(1)).current,i=()=>{E.spring(t,{toValue:1.1,duration:250,useNativeDriver:!0}).start()},a=()=>{E.spring(t,{toValue:1,duration:250,useNativeDriver:!0}).start()},r=()=>{x.openURL("https://spin.rip/")},u={transform:[{scale:t}]};return n.createElement(n.Fragment,null,n.createElement(b,{style:m.container},n.createElement(y,{onPress:r,onPressIn:i,onPressOut:a},n.createElement(E.View,{style:[u]},n.createElement(M,{style:[m.image],source:{uri:"https://cdn.spin.rip/r/l9uevwe4ia0.jpg"}}))),n.createElement(b,{style:m.text_container},n.createElement(y,{onPress:()=>{x.openURL(e.sourceUrl)}},n.createElement(w,{style:[m.main_text,m.header]},e.name," ")),n.createElement(b,{style:{flexDirection:"row"}},n.createElement(w,{style:[m.main_text,m.sub_header]},"A plugin by"),n.createElement(y,{onPress:()=>{x.openURL("https://spin.rip/")}},n.createElement(w,{style:[m.main_text,m.sub_header,{paddingLeft:4,fontFamily:d.Fonts.DISPLAY_BOLD}]},e.authors[0].name))),n.createElement(b,{style:{flexDirection:"row"}},n.createElement(w,{style:[m.main_text,m.sub_header]},"Settings page by"),n.createElement(y,{onPress:()=>{x.openURL("https://github.com/acquitelol/")}},n.createElement(w,{style:[m.main_text,m.sub_header,{paddingLeft:4,fontFamily:d.Fonts.DISPLAY_BOLD}]},"Rosie<3"))),n.createElement(b,null,n.createElement(y,{style:{flexDirection:"row"},onPress:()=>{Z.setString(`**${e.name}** v${e.version}`),F("plugin name and version")}},n.createElement(w,{style:[m.main_text,m.sub_header]},"Version:"),n.createElement(w,{style:[m.main_text,m.sub_header,{paddingLeft:4,fontFamily:d.Fonts.DISPLAY_BOLD}]},e.version," "))))))};const[te,U]=R(S.byProps("transitionToGuild","openURL"),S.byProps("setString","getString")),p=A.createThemedStyleSheet({bottom_padding:{paddingBottom:25},icon:{color:d.ThemeColorMap.INTERACTIVE_NORMAL},item:{color:d.ThemeColorMap.TEXT_MUTED},text_container:{display:"flex",flexDirection:"column"}});var ne=({manifest:e,settings:t,hasToasts:i,children:a,commands:r})=>n.createElement(O,null,n.createElement(ee,{manifest:e}),a,r&&n.createElement(f,{title:"Plugin Commands"},r.map(u=>n.createElement(l,{label:`/${u.name}`,subLabel:u.description,leading:n.createElement(l.Icon,{style:p.icon,source:c.Settings.Commands}),trailing:l.Arrow,onPress:function(){U.setString(`/${u.name}`),F(`the command ${u.name}`)}}))),n.createElement(f,{title:"Utility"},i&&n.createElement(n.Fragment,null,n.createElement(l,{label:"Initialization Toasts",leading:n.createElement(l.Icon,{style:p.icon,source:c.Settings.Toasts.Context}),subLabel:`If available, show toasts when ${e.name} is starting`,trailing:n.createElement(L,{value:t.getBoolean(`${e.name}-toastEnable`,!1),onValueChange:()=>{t.toggle(`${e.name}-toastEnable`,!1),g.open({content:`Successfully ${t.getBoolean(`${e.name}-toastEnable`,!1)?"enabled":"disabled"} initialization toasts.`,source:c.Success})}})}),n.createElement(D,null)),n.createElement(l,{label:"Copy Debug Info",subLabel:`Copy useful debug information of ${e.name} to clipboard.`,leading:n.createElement(l.Icon,{style:p.icon,source:c.Settings.Debug}),trailing:l.Arrow,onPress:async function(){U.setString(await J(e.name,e.version,e.build)),F("plugin debug information")}}),n.createElement(D,null),n.createElement(l,{label:"Clear Device List Cache",subLabel:"Remove the fetched device list storage. This will not clear Discord's or your iDevice's cache.",leading:n.createElement(l.Icon,{style:p.icon,source:c.Delete}),trailing:l.Arrow,onPress:async function(){await v.removeItem("device_list"),g.open({content:"Cleared device list storage.",source:c.Success})}})),n.createElement(f,{title:"Source"},n.createElement(l,{label:"Check for Updates",subLabel:`Check for any plugin updates for ${e.name}.`,leading:n.createElement(l.Icon,{style:p.icon,source:c.Copy}),trailing:l.Arrow,onPress:()=>{K({manifest:e})}}),n.createElement(D,null),n.createElement(l,{label:"Source",subLabel:`View ${e.name} source code`,leading:n.createElement(l.Icon,{style:p.icon,source:c.Open}),trailing:l.Arrow,onPress:()=>{te.openURL(`https://github.com/spinfal/enmity-plugins/tree/master/${e.name}`)}})),n.createElement(l,{style:p.bottom_padding,label:`Plugin Version: ${e.version} Plugin Build: ${e.build.split("-").pop()}`})),oe="BetterTwitterEmbeds",ie="1.1.5",se="patch-1.0.16",ae="Convert Twitter/X links to FxTwitter links so the tweet embed is better.",re=[{name:"spin",id:"308440976723148800"}],le="#ff0069",me="https://raw.githubusercontent.com/spinfal/enmity-plugins/master/dist/BetterTwitterEmbeds.js",P={name:oe,version:ie,build:se,description:ae,authors:re,color:le,sourceUrl:me};const V=z(P.name),ce={...P,onStart(){try{T("_twitter","_type",!1)||$("_twitter","_type","fxtwitter"),V.before(j,"sendMessage",(e,t,i)=>{const a=t[1].content;!a.match(/http(s)?:\/\/(www\.)?(twitter\.com|x\.com)\/\w{4,15}\/status\/\d+/gim)||(t[1].content=a.replace(/http(s)?:\/\/(www\.)?(twitter\.com|x\.com)/gim,`https://${T("_twitter","_type",!1)}.com`))})}catch(e){console.log("[ BetterTwitterEmbeds Error ]",e)}},onStop(){V.unpatchAll()},patches:[],getSettingsPanel({settings:e}){return n.createElement(ne,{manifest:P,settings:e,hasToasts:!1,commands:null},n.createElement(f,{title:"Plugin Settings"},n.createElement(l,{label:"Use vxtwitter.com instead of fxtwitter.com",leading:n.createElement(l.Icon,{source:c.Copy}),trailing:n.createElement(L,{value:e.getBoolean("_vxtwitter",!1),onValueChange:()=>{try{e.toggle("_vxtwitter",!1),e.getBoolean("_vxtwitter",!1)?$("_twitter","_type","vxtwitter"):$("_twitter","_type","fxtwitter"),g.open({content:`Switched to ${T("_twitter","_type",!1)}.`,source:c.Success})}catch(t){console.log("[ BetterTwitterEmbeds Error ]",t),g.open({content:"An error has occurred. Check debug logs for more info.",source:c.Failed})}}})})))}};Y(ce);