diff --git a/dist/vendetta.js b/dist/vendetta.js index e1fde438..6a7433d5 100644 --- a/dist/vendetta.js +++ b/dist/vendetta.js @@ -1,12 +1,14 @@ -"use strict";(()=>{var Sa=Object.defineProperty;var c=(e,t)=>()=>(e&&(t=e(e=0)),t);var A=(e,t)=>{for(var n in t)Sa(e,n,{get:t[n],enumerable:!0})};var pe,ge,C,Je,ae,ve,he=c(()=>{"use strict";pe=window.nativeModuleProxy,ge=pe.MMKVManager;C=pe.DCDFileManager??pe.RTNFileManager;Je=pe.InfoDictionaryManager??pe.RTNClientInfoManager;ae=pe.DCDDeviceManager??pe.RTNDeviceManager,ve=pe.BundleUpdaterManager});var $t={};A($t,{find:()=>X,findAll:()=>Ze,findByDisplayName:()=>jt,findByDisplayNameAll:()=>Ca,findByName:()=>N,findByNameAll:()=>Aa,findByProps:()=>u,findByPropsAll:()=>Ia,findByStoreName:()=>Re,findByTypeName:()=>Na,findByTypeNameAll:()=>Pa,modules:()=>Ht});var Ta,hr,Rr,Ht,X,Ze,Er,yr,wr,br,va,u,Ia,N,Aa,jt,Ca,Na,Pa,Re,w=c(()=>{"use strict";Ta=window.ErrorUtils.getGlobalHandler(),hr=function(e){return Object.defineProperty(window.modules,e,{value:window.modules[e],enumerable:!1,configurable:!0,writable:!0})};for(let e in window.modules){let t=Number(e),n=window.modules[t]?.publicModule?.exports;if(!n||n===window||n.proxygone===null){hr(t);continue}}Rr=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function(n){let r=[];for(let o in e){let a=Number(o),s=e[a]?.publicModule?.exports;if(!e[a].isInitialized)try{window.ErrorUtils.setGlobalHandler(function(){}),__r(a),window.ErrorUtils.setGlobalHandler(Ta)}catch{}if(!s){hr(a);continue}if(s.default&&s.__esModule&&n(s.default)){if(t)return s.default;r.push(s.default)}if(n(s)){if(t)return s;r.push(s)}}if(!t)return r}},Ht=window.modules,X=Rr(Ht,!0),Ze=Rr(Ht),Er=function(e){return function(t){return e.every(function(n){return t[n]!==void 0})}},yr=function(e,t){return t?function(n){return n?.name===e}:function(n){return n?.default?.name===e}},wr=function(e,t){return t?function(n){return n?.displayName===e}:function(n){return n?.default?.displayName===e}},br=function(e,t){return t?function(n){return n?.type?.name===e}:function(n){return n?.default?.type?.name===e}},va=function(e){return function(t){return t.getName&&t.getName.length===0&&t.getName()===e}},u=function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return X(yr(e,t))},Aa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(yr(e,t))},jt=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X(wr(e,t))},Ca=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(wr(e,t))},Na=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X(br(e,t))},Pa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(br(e,t))},Re=function(e){return X(va(e))}});function z(e,t){return pt(e,t,{walkable:["props","children","child","sibling"]})}var _r=c(()=>{"use strict";ie()});function zt(e,t,n,r){if(!(r>n.maxDepth)&&e){try{if(t(e))return e}catch{}if(Array.isArray(e)){for(let o of e)if(!(typeof o!="object"||o===null))try{let a=zt(o,t,n,r+1);if(a)return a}catch{}}else if(typeof e=="object"){for(let o of Object.keys(e))if(!(typeof e[o]!="object"||e[o]===null)&&!(n.walkable.length&&!n.walkable.includes(o))&&!n.ignore.includes(o))try{let a=zt(e[o],t,n,r+1);if(a)return a}catch{}}}}function pt(e,t){let{walkable:n=[],ignore:r=[],maxDepth:o=100}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return zt(e,t,{walkable:n,ignore:r,maxDepth:o},0)}var xr=c(()=>{"use strict"});async function Ee(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e4,r=await fetch(e,{signal:Da(n),...t});if(!r.ok)throw new Error("Request returned non-ok");return r}function Da(e){let t=new AbortController;return setTimeout(function(){return t.abort(`Timed out after ${e}ms`)},e),t.signal}var Sr=c(()=>{"use strict"});function Kt(e){return Object.isFrozen(e)?Object.assign({},e):e}var Tr=c(()=>{"use strict"});function J(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{"use strict"});var Wt={};A(Wt,{findInReactTree:()=>z,findInTree:()=>pt,safeFetch:()=>Ee,unfreeze:()=>Kt,without:()=>J});var ie=c(()=>{"use strict";_r();xr();Sr();Tr();vr()});var Yt,re,gt=c(()=>{Yt=["a","b","i"],re=new Map});function Ir(e,t,n,r,o){let a=re.get(t)?.[e];if(!a)return o?Reflect.construct(t[e],n,r):t[e].apply(r,n);for(let l of a.b.values()){let d=l.call(r,n);Array.isArray(d)&&(n=d)}let s=[...a.i.values()].reduce(function(l,d){return function(){for(var p=arguments.length,k=new Array(p),L=0;L{gt()});function Xt(e,t,n,r){let o=re.get(e),a=o?.[t];return a?.[r].has(n)?(a[r].delete(n),Yt.every(function(s){return a[s].size===0})&&(Reflect.defineProperty(e,t,{value:a.o,writable:!0,configurable:!0})||(e[t]=a.o),delete o[t]),Object.keys(o).length==0&&re.delete(e),!0):!1}function Cr(){for(let[e,t]of re.entries())for(let n in t)for(let r of Yt)for(let o of t[n]?.[r].keys()??[])Xt(e,n,o,r)}var Jt=c(()=>{gt()});function ht(e){return function(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(typeof n[t]!="function")throw new Error(`${t} is not a function in ${n.constructor.name}`);re.has(n)||re.set(n,Object.create(null));let a=re.get(n);if(!a[t]){let d=n[t];a[t]={o:d,b:new Map,i:new Map,a:new Map};let p=function(I,G,H){let Te=Ir(t,n,G,I,H);return o&&l(),Te},k=new Proxy(d,{apply:function(I,G,H){return p(G,H,!1)},construct:function(I,G){return p(d,G,!0)},get:function(I,G,H){return G=="toString"?d.toString.bind(d):Reflect.get(I,G,H)}});Reflect.defineProperty(n,t,{value:k,configurable:!0,writable:!0})||(n[t]=k)}let s=Symbol(),l=function(){return Xt(n,t,s,e)};return a[t][e].set(s,r),l}}var Nr=c(()=>{Ar();gt();Jt()});var qt={};A(qt,{after:()=>E,before:()=>Zt,instead:()=>Z,unpatchAll:()=>Cr});var Zt,Z,E,Qt=c(()=>{Nr();Jt();Zt=ht("b"),Z=ht("i"),E=ht("a")});var Pr,P=c(()=>{"use strict";Qt();Qt();Pr={...qt}});function tn(){return{listeners:Object.values(en).reduce(function(e,t){return e[t]=new Set,e},{}),on(e,t){this.listeners[e].has(t)||this.listeners[e].add(t)},off(e,t){this.listeners[e].delete(t)},once(e,t){var n=this;let r=function(o,a){n.off(o,r),t(o,a)};this.on(e,r)},emit(e,t){for(let n of this.listeners[e])n(e,t)}}}var en,Dr=c(()=>{"use strict";(function(e){e.GET="GET",e.SET="SET",e.DEL="DEL"})(en||(en={}))});var Mr,nn,Br,rn,ye,Oe,kr=c(()=>{"use strict";he();g();Mr=/[<>:"\/\\|?*]/g,nn=function(e){return m.Platform.select({default:e,ios:C.saveFileToGallery?e:`Documents/${e}`})},Br=function(e){return Mr.test(e)&&(e=e.replace(Mr,"-").replace(/-+/g,"-")),`vd_mmkv/${e}`},rn=async function(e){await ge.getItem(e)&&ge.removeItem(e);let t=Br(e);await C.fileExists(`${C.getConstants().DocumentsDirPath}/${t}`)&&await C.removeFile?.("documents",t)},ye=function(e){let t=Br(e);return Oe(t,async function(){try{let n=`${C.getConstants().DocumentsDirPath}/${t}`;if(await C.fileExists(n))return;let r=await ge.getItem(e)??"{}";if(r==="!!LARGE_VALUE!!"){let o=`${C.getConstants().CacheDirPath}/mmkv/${e}`;await C.fileExists(o)?r=await C.readFile(o,"utf8"):(console.log(`${e}: Experienced data loss :(`),r="{}")}await C.writeFile("documents",nn(t),r,"utf8"),await ge.getItem(e)!==null&&(ge.removeItem(e),console.log(`Successfully migrated ${e} store from MMKV storage to fs`))}catch(n){console.error("Failed to migrate to fs from MMKVManager ",n)}}())},Oe=function(e,t){let n;return{get:async function(){await t;let r=`${C.getConstants().DocumentsDirPath}/${e}`;return!n&&!await C.fileExists(r)?(n=!0,C.writeFile("documents",nn(e),"{}","utf8")):JSON.parse(await C.readFile(r,"utf8"))},set:async function(r){await t,await C.writeFile("documents",nn(e),JSON.stringify(r),"utf8")}}}});var an={};A(an,{awaitSyncWrapper:()=>Fe,createFileBackend:()=>Oe,createMMKVBackend:()=>ye,createProxy:()=>Fr,createStorage:()=>se,purgeStorage:()=>rn,useProxy:()=>x,wrapSync:()=>we});function Fr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=tn();function n(r,o){return new Proxy(r,{get(a,s){if(s===Lr)return t;let l=[...o,s],d=a[s];return d!=null?(t.emit("GET",{path:l,value:d}),typeof d=="object"?n(d,l):d):d},set(a,s,l){return a[s]=l,t.emit("SET",{path:[...o,s],value:l}),!0},deleteProperty(a,s){let l=delete a[s];return l&&t.emit("DEL",{path:[...o,s]}),l}})}return{proxy:n(e,[]),emitter:t}}function x(e){if(e[on])throw e[on];let t=e[Lr];if(!t)throw new Error("InvalidArgumentExcpetion - storage[emitterSymbol] is "+typeof t);let[,n]=React.useReducer(function(r){return~r},0);return React.useEffect(function(){let r=function(){return n()};return t.on("SET",r),t.on("DEL",r),function(){t.off("SET",r),t.off("DEL",r)}},[]),e}async function se(e){let t=await e.get(),{proxy:n,emitter:r}=Fr(t),o=function(){return e.set(n)};return r.on("SET",o),r.on("DEL",o),n}function we(e){let t,n,r=[],o=function(a){return t?a():r.push(a)};return e.then(function(a){t=a,r.forEach(function(s){return s()})}).catch(function(a){n=a}),new Proxy({},{...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(function(a){return[a,function(s){for(var l=arguments.length,d=new Array(l>1?l-1:0),p=1;p{"use strict";Dr();kr();Lr=Symbol.for("vendetta.storage.emitter"),Or=Symbol.for("vendetta.storage.accessor"),on=Symbol.for("vendetta.storage.error");Fe=function(e){return new Promise(function(t){return e[Or](t)})}});var sn,Ma,D,Ie=c(()=>{"use strict";w();sn=u("setLogFn").default,Ma=new sn("Opti"),D=Ma});var dn={};A(dn,{color:()=>ce,fetchTheme:()=>qe,getCurrentTheme:()=>Ne,getThemes:()=>mn,initThemes:()=>fn,installTheme:()=>Ae,patchChatBackground:()=>ln,removeTheme:()=>un,selectTheme:()=>Ce,themes:()=>O,updateThemes:()=>Vr});async function cn(e){if(typeof e!="object")throw new Error("Theme must be an object");await Oe("vendetta_theme.json").set(e)}function ln(){let e=Ne()?.data?.background;if(!e)return;let t=N("MessagesWrapperConnected",!1);if(!t)return;let{MessagesWrapper:n}=u("MessagesWrapper");if(!n)return;let r=[E("default",t,function(o,a){return React.createElement(m.ImageBackground,{style:{flex:1,height:"100%"},source:{uri:e.url},blurRadius:typeof e.blur=="number"?e.blur:0,children:a})}),E("render",n.prototype,function(o,a){let s=z(a,function(l){return"HACK_fixModalInteraction"in l?.props&&l?.props?.style});s?s.props.style=Object.assign(m.StyleSheet.flatten(s.props.style??{}),{backgroundColor:"#0000"}):D.error("Didn't find Messages when patching MessagesWrapper!")})];return function(){return r.forEach(function(o){return o()})}}function Ur(e){if(le.valid(e))return le(e).hex();let t=Number(m.processColor(e));return le.rgb(t>>16&255,t>>8&255,t&255,t>>24&255).hex()}function ka(e){if(e.semanticColors){let t=e.semanticColors;for(let n in t)for(let r in t[n])t[n][r]&&=Ur(t[n][r])}if(e.rawColors){let t=e.rawColors;for(let n in t)e.rawColors[n]=Ur(t[n]);m.Platform.OS==="android"&&La(t)}return e}function La(e){let t={BLACK_ALPHA_60:["BLACK",.6],BRAND_NEW_360_ALPHA_20:["BRAND_360",.2],BRAND_NEW_360_ALPHA_25:["BRAND_360",.25],BRAND_NEW_500_ALPHA_20:["BRAND_500",.2],PRIMARY_DARK_500_ALPHA_20:["PRIMARY_500",.2],PRIMARY_DARK_700_ALPHA_60:["PRIMARY_700",.6],STATUS_GREEN_500_ALPHA_20:["GREEN_500",.2],STATUS_RED_500_ALPHA_20:["RED_500",.2]};for(let n in t){let[r,o]=t[n];e[r]&&(e[n]=le(e[r]).alpha(o).hex())}}async function qe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;try{n=await(await Ee(e,{cache:"no-store"})).json()}catch{throw new Error(`Failed to fetch theme at ${e}`)}O[e]={id:e,selected:t,data:ka(n)},t&&cn(O[e])}async function Ae(e){if(typeof e!="string"||e in O)throw new Error("Theme already installed");await qe(e)}async function Ce(e){if(e==="default")return await cn({});let t=Object.values(O).find(function(n){return n.selected})?.id;t&&(O[t].selected=!1),O[e].selected=!0,await cn(O[e])}async function un(e){let t=O[e];return t.selected&&await Ce("default"),delete O[e],t.selected}function Ne(){let e=window.__vendetta_loader?.features?.themes?.prop;return e&&window[e]||null}async function Vr(){await Fe(O);let e=Ne();await Promise.allSettled(Object.keys(O).map(function(t){return qe(t,e?.id===t)}))}async function fn(){let e=Ne();if(!e)return;let t=ce.default.unsafe_rawColors;ce.default.unsafe_rawColors=new Proxy(t,{get:function(n,r){return e?e.data?.rawColors?.[r]??Reflect.get(t,r):Reflect.get(t,r)}}),Z("resolveSemanticColor",ce.default.meta??ce.default.internal,function(n,r){if(!e)return r(...n);let[o,a]=n,[s,l]=Gr(o,a),d=o==="amoled"?2:o==="light"?1:0;let p=Ba[s]??s,k=(e.data?.semanticColors?.[s]??e.data?.semanticColors?.[p])?.[d];if(s==="CHAT_BACKGROUND"&&typeof e.data?.background?.alpha=="number")return le(k||"black").alpha(1-e.data.background.alpha).hex();if(k)return k;let L=e.data?.rawColors?.[l.raw];return L?l.opacity===1?L:le(L).alpha(l.opacity).hex():r(...n)}),await Vr()}function Gr(e,t){let n=t[Gr._sym??=Object.getOwnPropertySymbols(t)[0]],r=ce.SemanticColor[n];return[n,r[e.toLowerCase()]]}function mn(){var e=0;return Object.keys(O).forEach(function(t){return e++}),e}var ce,O,Ba,W=c(()=>{"use strict";g();ie();w();P();K();Ie();ce=u("SemanticColor"),O=we(se(ye("VENDETTA_THEMES"))),Ba={BG_BACKDROP:"BACKGROUND_FLOATING",BG_BASE_PRIMARY:"BACKGROUND_PRIMARY",BG_BASE_SECONDARY:"BACKGROUND_SECONDARY",BG_BASE_TERTIARY:"BACKGROUND_SECONDARY_ALT",BG_MOD_FAINT:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_STRONG:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_SUBTLE:"BACKGROUND_MODIFIER_ACCENT",BG_SURFACE_OVERLAY:"BACKGROUND_FLOATING",BG_SURFACE_OVERLAY_TMP:"BACKGROUND_FLOATING",BG_SURFACE_RAISED:"BACKGROUND_MOBILE_PRIMARY"}});var Rt,Hr,m,le,Et=c(()=>{"use strict";W();P();Rt=function(e){for(let t in window.modules){let n=window.modules[t]?.publicModule.exports;if(n&&e(n))return n}},Hr=Rt(function(e){return e?.default?.name==="requireNativeComponent"});Hr&&Z("default",Hr,function(e,t){try{return t(...e)}catch{return e[0]}});window.React=Rt(function(e){return e.createElement});m=Rt(function(e){return e.AppRegistry}),le=Rt(function(e){return e.brewer});if(window.__vendetta_loader?.features.themes)try{fn()}catch(e){console.error("[Vendetta] Failed to initialize themes...",e)}});var En={};A(En,{AsyncUsers:()=>Qe,Flux:()=>Ha,FluxDispatcher:()=>wt,NavigationNative:()=>fe,Profiles:()=>Pe,React:()=>q,ReactNative:()=>m,User:()=>be,assets:()=>et,channels:()=>gn,chroma:()=>le,clipboard:()=>j,commands:()=>yt,constants:()=>Ue,i18n:()=>ue,invites:()=>Ua,lodash:()=>bt,moment:()=>Rn,navigation:()=>Va,navigationStack:()=>Ga,stylesheet:()=>F,toasts:()=>hn,url:()=>Ve,util:()=>ja});function Fa(e){if(pn){for(let t in e)e[t]=new Proxy(m.StyleSheet.flatten(e[t]),{get(n,r,o){let a=Reflect.get(n,r,o);return jr.isSemanticColor(a)?jr.resolveSemanticColor(Oa.theme,a):a}});return e}}var Oa,pn,jr,Ue,gn,ue,Ve,hn,be,Qe,Pe,F,j,et,Ua,yt,Va,Ga,fe,Ha,wt,q,Rn,bt,ja,g=c(()=>{"use strict";w();Et();Et();Et();Oa=Re("ThemeStore"),pn=u("colors","unsafe_rawColors"),jr=pn?.internal??pn?.meta;Ue=u("Fonts","Permissions"),gn=u("getVoiceChannelId"),ue=u("Messages"),Ve=u("openURL","openDeeplink"),hn=X(function(e){return e.open&&e.close&&!e.startDrag&&!e.init&&!e.openReplay&&!e.setAlwaysOnTop&&!e.setAccountFlag}),be=u("getCurrentUser"),Qe=u("getUser","fetchProfile"),Pe=u("showUserProfile"),F={...X(function(e){return e.createStyles&&!e.ActionSheet}),createThemedStyleSheet:Fa,...u("createThemedStyleSheet")},j=u("setString","getString","hasString"),et=u("registerAsset"),Ua=u("acceptInviteAndTransitionToInviteChannel"),yt=u("getBuiltInCommands"),Va=u("pushLazy"),Ga=u("createStackNavigator"),fe=u("NavigationContainer"),Ha=u("connectStores"),wt=u("_currentDispatchActionType"),q=window.React,Rn=u("isMoment"),bt=u("forEachRight"),ja=u("inspect","isNullOrUndefined")});var wn={};A(wn,{all:()=>me,find:()=>$a,getAssetByID:()=>Ka,getAssetByName:()=>za,getAssetIDByName:()=>f,patchAssets:()=>yn});function yn(){let e=E("registerAsset",et,function(t,n){let r=t[0];me[r.name]={...r,id:n}});for(let t=1;;t++){let n=et.getAssetByID(t);if(!n)break;me[n.name]||(me[n.name]={...n,id:t})}return e}var me,$a,za,Ka,f,b=c(()=>{"use strict";g();P();me={};$a=function(e){return Object.values(me).find(e)},za=function(e){return me[e]},Ka=function(e){return et.getAssetByID(e)},f=function(e){return me[e]?.id}});var bn={};A(bn,{showToast:()=>h});var Wa,h,oe=c(()=>{"use strict";w();g();({uuid4:Wa}=u("uuid4")),h=function(e,t){return hn.open({key:`vd-toast-${Wa()}`,content:e,source:t,icon:t})}});var i,Q,U=c(()=>{"use strict";K();i=we(se(ye("VENDETTA_SETTINGS"))),Q=we(se(Oe("vendetta_loader.json")))});var Sn={};A(Sn,{connectToDebugger:()=>_n,getDebugInfo:()=>nt,patchLogHook:()=>xn,socket:()=>Y,toggleSafeMode:()=>tt,versionHash:()=>_t});async function tt(){i.safeMode={...i.safeMode,enabled:!i.safeMode?.enabled},window.__vendetta_loader?.features.themes&&(Ne()?.id&&(i.safeMode.currentThemeId=Ne().id),i.safeMode?.enabled?await Ce("default"):i.safeMode?.currentThemeId&&await Ce(i.safeMode?.currentThemeId)),setTimeout(ve.reload,400)}function _n(e){if(Y!==void 0&&Y.readyState!==WebSocket.CLOSED&&Y.close(),!e){h("Invalid debugger URL!",f("Small"));return}Y=new WebSocket(`ws://${e}`),Y.addEventListener("open",function(){return h("Connected to debugger.",f("Check"))}),Y.addEventListener("message",function(t){try{(0,eval)(t.data)}catch(n){console.error(n)}}),Y.addEventListener("error",function(t){console.log(`Debugger error: ${t.message}`),h("An error occurred with the debugger connection!",f("Small"))})}function xn(){let e=E("nativeLoggingHook",globalThis,function(t){Y?.readyState===WebSocket.OPEN&&Y.send(JSON.stringify({message:t[0],level:t[1]})),D.log(t[0])});return function(){Y&&Y.close(),e()}}function nt(){let e=window.HermesInternal.getRuntimeProperties(),t=e["OSS Release Version"],n="for RN ",r=m.Platform.constants,o=r.reactNativeVersion;return{vendetta:{version:_t,loader:window.__vendetta_loader?.name??"Unknown"},discord:{version:Je.Version,build:Je.Build},react:{version:React.version,nativeVersion:t.startsWith(n)?t.substring(n.length):`${o.major}.${o.minor}.${o.patch}`},hermes:{version:t,buildType:e.Build,bytecodeVersion:e["Bytecode Version"]},...m.Platform.select({android:{os:{name:"Android",version:r.Release,sdk:r.Version}},ios:{os:{name:r.systemName,version:r.osVersion}}}),...m.Platform.select({android:{device:{manufacturer:r.Manufacturer,brand:r.Brand,model:r.Model,codename:ae.device}},ios:{device:{manufacturer:ae.deviceManufacturer,brand:ae.deviceBrand,model:ae.deviceModel,codename:ae.device}}})}}var Y,_t,Ge=c(()=>{"use strict";g();P();W();he();b();oe();U();Ie();_t="fd7b652"});var $,$r,zr,rt,He=c(()=>{(function(e){e.BRAND="brand",e.RED="red",e.GREEN="green",e.PRIMARY="primary",e.TRANSPARENT="transparent",e.GREY="grey",e.LIGHTGREY="lightgrey",e.WHITE="white",e.LINK="link"})($||($={}));(function(e){e[e.BUILT_IN=0]="BUILT_IN",e[e.BUILT_IN_TEXT=1]="BUILT_IN_TEXT",e[e.BUILT_IN_INTEGRATION=2]="BUILT_IN_INTEGRATION",e[e.BOT=3]="BOT",e[e.PLACEHOLDER=4]="PLACEHOLDER"})($r||($r={}));(function(e){e[e.SUB_COMMAND=1]="SUB_COMMAND",e[e.SUB_COMMAND_GROUP=2]="SUB_COMMAND_GROUP",e[e.STRING=3]="STRING",e[e.INTEGER=4]="INTEGER",e[e.BOOLEAN=5]="BOOLEAN",e[e.USER=6]="USER",e[e.CHANNEL=7]="CHANNEL",e[e.ROLE=8]="ROLE",e[e.MENTIONABLE=9]="MENTIONABLE",e[e.NUMBER=10]="NUMBER",e[e.ATTACHMENT=11]="ATTACHMENT"})(zr||(zr={}));(function(e){e[e.CHAT=1]="CHAT",e[e.USER=2]="USER",e[e.MESSAGE=3]="MESSAGE"})(rt||(rt={}))});var vn={};A(vn,{patchCommands:()=>Tn,registerCommand:()=>Ya});function Tn(){let e=E("getBuiltInCommands",yt,function(t,n){let[r]=t;if(r===rt.CHAT)return n.concat(ot)});return function(){ot=[],e()}}function Ya(e){let t=yt.getBuiltInCommands(rt.CHAT,!0,!1);t.sort(function(r,o){return parseInt(o.id)-parseInt(r.id)});let n=t[t.length-1];return e.id=(parseInt(n.id,10)-1).toString(),ot.push(e),function(){return ot=ot.filter(function(r){let{id:o}=r;return o!==e.id})}}var ot,In=c(()=>{"use strict";He();g();P();ot=[]});var Xa,Ja,Za,Kr,Wr=c(()=>{"use strict";Xa=function(e){return{status:"fulfilled",value:e}},Ja=function(e){return{status:"rejected",reason:e}},Za=function(e){return Promise.resolve(e).then(Xa,Ja)},Kr=function(e){return Promise.all(Array.from(e).map(Za))}});var Dn={};A(Dn,{evalPlugin:()=>Yr,fetchPlugin:()=>je,getPlugins:()=>Nn,getSettings:()=>Pn,initPlugins:()=>Cn,installPlugin:()=>xe,plugins:()=>M,removePlugin:()=>An,startPlugin:()=>$e,stopPlugin:()=>ze});async function je(e){e.endsWith("/")||(e+="/");let t=M[e],n;try{n=await(await Ee(e+"manifest.json",{cache:"no-store"})).json()}catch{throw new Error(`Failed to fetch manifest for ${e}`)}let r;if(t?.manifest.hash!==n.hash)try{r=await(await Ee(e+(n.main||"index.js"),{cache:"no-store"})).text()}catch{}if(!r&&!t)throw new Error(`Failed to fetch JS for ${e}`);M[e]={id:e,manifest:n,enabled:t?.enabled??!1,update:t?.update??!0,js:r??t.js}}async function xe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.endsWith("/")||(e+="/"),typeof e!="string"||e in M)throw new Error("Plugin already installed");await je(e),t&&await $e(e)}async function Yr(e){let t={...window.vendetta,plugin:{id:e.id,manifest:e.manifest,storage:await se(ye(e.id))},logger:new sn(`Vendetta \xBB ${e.manifest.name}`)},n=`vendetta=>{return ${e.js}} -//# sourceURL=${e.id}`,r=(0,eval)(n)(t),o=typeof r=="function"?r():r;return o?.default??o??{}}async function $e(e){e.endsWith("/")||(e+="/");let t=M[e];if(!t)throw new Error("Attempted to start non-existent plugin");try{if(!i.safeMode?.enabled){let n=await Yr(t);_e[e]=n,n.onLoad?.()}t.enabled=!0}catch(n){D.error(`Plugin ${t.id} errored whilst loading, and will be unloaded`,n);try{_e[t.id]?.onUnload?.()}catch(r){D.error(`Plugin ${t.id} errored whilst unloading`,r)}delete _e[e],t.enabled=!1}}function ze(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;e.endsWith("/")||(e+="/");let n=M[e],r=_e[e];if(!n)throw new Error("Attempted to stop non-existent plugin");if(!i.safeMode?.enabled){try{r?.onUnload?.()}catch(o){D.error(`Plugin ${n.id} errored whilst unloading`,o)}delete _e[e]}t&&(n.enabled=!1)}async function An(e){e.endsWith("/")||(e+="/"),M[e].enabled&&ze(e),delete M[e],await rn(e)}async function Cn(){await Fe(i),await Fe(M);let e=Object.keys(M);return i.safeMode?.enabled||(await Kr(e.filter(function(t){return M[t].enabled}).map(async function(t){return M[t].update&&await je(t).catch(function(n){return D.error(n.message)}),await $e(t)})),e.filter(function(t){return!M[t].enabled&&M[t].update}).forEach(function(t){return je(t)})),qa}function Nn(){var e=0;return Object.keys(_e).forEach(function(t){return e++}),e}var M,_e,qa,Pn,de=c(()=>{"use strict";ie();K();Wr();Ie();U();M=we(se(ye("VENDETTA_PLUGINS"))),_e={};qa=function(){return Object.keys(_e).forEach(function(e){return ze(e,!1)})};Pn=function(e){return _e[e]?.settings}});var On={};A(On,{BADGES:()=>Qa,DISCORD_SERVER:()=>Mn,DISCORD_SERVER_ID:()=>Bn,GITHUB:()=>Ln,HTTP_REGEX:()=>ei,HTTP_REGEX_MULTI:()=>it,PLUGINS_CHANNEL_ID:()=>kn,PROXY_PREFIX:()=>De,THEMES_CHANNEL_ID:()=>at});var Mn,Bn,kn,at,Ln,Qa,De,ei,it,Me=c(()=>{"use strict";Mn="https://discord.gg/zm5MWBPeRp",Bn="1228081962883747880",kn="1228464451846672465",at="1228464459295756358",Ln="https://github.com/opti-mod",Qa="https://raw.githubusercontent.com/opti-mod/badges/main/",De="https://vd-plugins.github.io/proxy",ei=/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/,it=/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g});function Be(e){let{label:t,icon:n,noPadding:r=!1,noAnimation:o=!1,children:a}=e,{FormRow:s,FormDivider:l}=y,[d,p]=React.useState(!0);return React.createElement(React.Fragment,null,React.createElement(s,{label:t,leading:n&&React.createElement(s.Icon,{source:f(n)}),trailing:React.createElement(s.Arrow,{style:{transform:[{rotate:`${d?180:90}deg`}]}}),onPress:function(){p(!d),o||m.LayoutAnimation.configureNext(m.LayoutAnimation.Presets.easeInEaseOut)}}),!d&&React.createElement(React.Fragment,null,React.createElement(l,null),React.createElement(m.View,{style:!r&&{paddingHorizontal:15}},a)))}var Xr=c(()=>{"use strict";g();b();S()});function Jr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Zr=c(()=>{});function qr(e,t){for(var n=0;n{});function to(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var no=c(()=>{});function xt(e,t){return xt=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},xt(e,t)}var ro=c(()=>{});function oo(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&&xt(e,t)}var ao=c(()=>{ro()});function st(e){return st=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},st(e)}var io=c(()=>{});function so(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var co=c(()=>{});function lo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var uo=c(()=>{});function fo(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}var mo=c(()=>{});function po(e,t){return t&&(fo(t)==="object"||typeof t=="function")?t:lo(e)}var go=c(()=>{uo();mo()});function ho(e){var t=so();return function(){var r=st(e),o;if(t){var a=st(this).constructor;o=Reflect.construct(r,arguments,a)}else o=r.apply(this,arguments);return po(this,o)}}var Ro=c(()=>{io();co();go()});async function Eo(e){try{let n=await(await fetch("https://discord.com/api/webhooks/1228472552385417302/sH0cJpymri9SUkzNSva2kkCT_vtnWeg3ukkcnIpjf1TLsYRGvVOGKsX_FMX683jJEXXK",{method:"POST",body:e,headers:{"Content-Type":"application/json"}})).json();console.log("Sent debug log: ",n)}catch(t){console.error("Error:",t)}}var yo=c(()=>{"use strict"});var St,ti,T,Fn=c(()=>{"use strict";Zr();eo();no();ao();Ro();g();S();yo();St=F.createThemedStyleSheet({view:{flex:1,flexDirection:"column",margin:10},title:{fontSize:20,textAlign:"center",marginBottom:5},br:{fontSize:0,paddingTop:20,paddingLeft:20,paddingRight:20}}),T=function(e){"use strict";oo(n,e);var t=ho(n);function n(r){Jr(this,n);var o;return o=t.call(this,r),o.state={hasErr:!1},o}return Qr(n,[{key:"render",value:function(){var o=this;return this.state.hasErr?q.createElement(m.ScrollView,{style:St.view},q.createElement(y.FormText,{style:St.title},"Opti has encountered an error."),q.createElement(y.FormText,{style:St.title},this.state.errName),q.createElement(y.FormText,{style:St.br}," "),q.createElement(Se,{selectable:!0,style:{marginBottom:4}},this.state.errStack),q.createElement(_,{color:_.Colors.RED,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return o.setState({hasErr:!1,errText:void 0})},text:"Retry"}),q.createElement(_,{color:_.Colors.BRAND,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return j.setString(""+o.state.errStack)},text:"Copy Error to Clipboard"}),q.createElement(_,{color:_.Colors.BRAND,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return Eo(""+o.state.errStack)},text:"Send Crash Report"})):this.props.children}}]),n}(ti=q.Component);to(T,"getDerivedStateFromError",function(e){return{hasErr:!0,errText:e.message,errName:e.name,errCause:e.cause,errStack:e.stack}})});var Un={};A(Un,{rawColors:()=>ni,semanticColors:()=>v});var v,ni,ke=c(()=>{"use strict";g();W();v=ce?.default?.colors??Ue?.ThemeColorMap,ni=ce?.default?.unsafe_rawColors??Ue?.Colors});function Se(e){let{selectable:t,style:n,children:r}=e;return t?m.Platform.select({ios:React.createElement(ri,{style:n,children:r}),default:React.createElement(wo,{style:n,children:r,selectable:!0})}):React.createElement(wo,{style:n,children:r})}var bo,ri,wo,_o=c(()=>{"use strict";g();ke();bo=F.createThemedStyleSheet({codeBlock:{fontFamily:Ue.Fonts.CODE_SEMIBOLD,fontSize:12,textAlignVertical:"center",backgroundColor:v.BACKGROUND_SECONDARY,color:v.TEXT_NORMAL,borderWidth:1,borderRadius:4,borderColor:v.BACKGROUND_TERTIARY,padding:10}}),ri=function(e){let{style:t,children:n}=e;return React.createElement(m.TextInput,{editable:!1,multiline:!0,style:[bo.codeBlock,t&&t],value:n})},wo=function(e){let{selectable:t,style:n,children:r}=e;return React.createElement(m.Text,{selectable:t,style:[bo.codeBlock,n&&n]},r)}});function Ke(e){let{onChangeText:t,placeholder:n,style:r}=e;return React.createElement(oi,{style:[ai.search,r],placeholder:n,onChangeText:t})}var oi,ai,xo=c(()=>{"use strict";g();w();oi=N("StaticSearchBarContainer"),ai=F.createThemedStyleSheet({search:{margin:0,padding:0,borderBottomWidth:0,background:"none",backgroundColor:"none"}})});var jn={};A(jn,{Alert:()=>Vn,Button:()=>_,Codeblock:()=>Se,ErrorBoundary:()=>T,Forms:()=>y,General:()=>ii,HelpMessage:()=>Gn,SafeAreaView:()=>Hn,Search:()=>Ke,Summary:()=>Be});var y,ii,Vn,_,Gn,Hn,S=c(()=>{"use strict";w();Xr();Fn();_o();xo();y=u("Form","FormSection"),ii=u("Button","Text","View"),Vn=jt("FluxContainer(Alert)"),_=u("Looks","Colors","Sizes"),Gn=N("HelpMessage"),Hn=u("useSafeAreaInsets").SafeAreaView});function So(){return E("default",si,function(e,t){let[{thread:n}]=e;if(n.guild_id!==Bn)return;let r;if(n.parent_id===kn)r="Plugin";else if(n.parent_id===at&&window.__vendetta_loader?.features.themes)r="Theme";else return;let{firstMessage:o}=ui(n),a=o?.content?.match(it);if(!a)return;r==="Plugin"?a=a.filter(function(p){return p.startsWith(De)}):a=a.filter(function(p){return p.endsWith(".json")});let s=a[0];if(!s)return;let l=z(t,function(p){return p?.[0]?.key}),d=l[0].type;l.unshift(React.createElement(d,{key:"install"},React.createElement(ci,{leading:React.createElement(li,{style:{opacity:1},source:f("ic_download_24px")}),label:`Install ${r}`,onPress:function(){return(r==="Plugin"?xe:Ae)(s).then(function(){h(`Successfully installed ${n.name}`,f("Check"))}).catch(function(p){h(p.message,f("Small"))}).finally(function(){return fi()})}})))})}var si,ci,li,ui,fi,To=c(()=>{"use strict";w();Me();P();de();W();ie();b();oe();S();si=N("ForumPostLongPressActionSheet",!1),{FormRow:ci,FormIcon:li}=y,{useFirstForumPostMessage:ui}=u("useFirstForumPostMessage"),{hideActionSheet:fi}=u("openLazy","hideActionSheet")});function $n(e){let{title:t,confirmText:n,confirmColor:r,onConfirm:o,cancelText:a,placeholder:s,initialValue:l="",secureTextEntry:d}=e,[p,k]=React.useState(l),[L,I]=React.useState("");function G(){Promise.resolve(o(p)).then(function(){vo.close()}).catch(function(Te){I(Te.message)})}return React.createElement(Vn,{title:t,confirmText:n,confirmColor:r,isConfirmButtonDisabled:L.length!==0,onConfirm:G,cancelText:a,onCancel:function(){return vo.close()}},React.createElement(mi,{placeholder:s,value:p,onChange:function(H){k(typeof H=="string"?H:H.text),L&&I("")},returnKeyType:"done",onSubmitEditing:G,error:L||void 0,secureTextEntry:d,autoFocus:!0,showBorder:!0,style:{paddingVertical:5,alignSelf:"stretch",paddingHorizontal:0}}))}var mi,vo,Io=c(()=>{"use strict";w();S();({FormInput:mi}=y),vo=u("openLazy","close")});var Kn={};A(Kn,{showConfirmationAlert:()=>ee,showCustomAlert:()=>Co,showInputAlert:()=>zn});function ee(e){let t=e;return t.body=e.content,delete t.content,t.isDismissable??=!0,Ao.show(t)}var Ao,Co,zn,Le=c(()=>{"use strict";w();Io();Ao=u("openLazy","close");Co=function(e,t){return Ao.openLazy({importer:async function(){return function(){return React.createElement(e,t)}}})},zn=function(e){return Co($n,e)}});function No(e){return e.startsWith(De)?"Plugin":e.endsWith(".json")&&window.__vendetta_loader?.features.themes?"Theme":void 0}function Po(e,t){(e==="Plugin"?xe:Ae)(t).then(function(){h("Successfully installed",f("Check"))}).catch(function(n){h(n.message,f("Small"))})}function Do(){let e=new Array;return e.push(E("showSimpleActionSheet",di,function(t){if(t[0].key!=="LongPressUrl")return;let{header:{title:n},options:r}=t[0],o=No(n);o&&r.push({label:`Install ${o}`,onPress:function(){return Po(o,n)}})})),e.push(Z("handleClick",pi,async function(t,n){let{href:r}=t[0],o=No(r);if(!o)return n.apply(this,t);if(o==="Theme"&&Ri(hi())?.parent_id!==at)return n.apply(this,t);ee({title:"Hold Up",content:["This link is a ",React.createElement(m.Text,{style:Ei["text-md/semibold"]},o),", would you like to install it?"],onConfirm:function(){return Po(o,r)},confirmText:"Install",cancelText:"Cancel",secondaryConfirmText:"Open in Browser",onConfirmSecondary:function(){return gi(r)}})})),function(){return e.forEach(function(t){return t()})}}var di,pi,gi,hi,Ri,Ei,Mo=c(()=>{"use strict";w();g();Me();P();de();W();Le();b();oe();di=X(function(e){return e?.showSimpleActionSheet&&!Object.getOwnPropertyDescriptor(e,"showSimpleActionSheet")?.get}),pi=u("handleClick"),{openURL:gi}=Ve,{getChannelId:hi}=gn,{getChannel:Ri}=u("getChannel"),{TextStyleSheet:Ei}=u("TextStyleSheet")});function Wn(){let e=new Array;return e.push(So()),e.push(Do()),function(){return e.forEach(function(t){return t()})}}var Bo=c(()=>{"use strict";To();Mo()});function Oo(){return E("render",yi.prototype,function(e,t){var n=this;if(!this.state.error)return;let r=nt();this.state.activeTab??="message";let o=Lo.find(function(l){return l.id===n.state.activeTab}),a=this.state.error[this.state.activeTab],s=[{text:"Restart Discord",onPress:this.handleReload},...i.safeMode?.enabled?[]:[{text:"Restart in Safe Mode",onPress:tt}],{text:"Retry Render",color:$.RED,onPress:function(){return n.setState({info:null,error:null})}}];return React.createElement(T,null,React.createElement(Hn,{style:ct.container},React.createElement(m.View,{style:ct.header},t.props.Illustration&&React.createElement(t.props.Illustration,{style:{flex:1,resizeMode:"contain",maxHeight:96,paddingRight:4}}),React.createElement(m.View,{style:{flex:2,paddingLeft:4}},React.createElement(m.Text,{style:ct.headerTitle},t.props.title),React.createElement(m.Text,{style:ct.headerDescription},t.props.body))),React.createElement(m.View,{style:{flex:6}},React.createElement(m.View,{style:{paddingBottom:8}},React.createElement(wi,{tabs:Lo,activeTab:this.state.activeTab,onTabSelected:function(l){n.setState({activeTab:l})}})),React.createElement(Se,{selectable:!0,style:{flexBasis:"auto",marginBottom:8}},[`Discord: ${r.discord.build} (${r.os.name})`,`Vendetta: ${r.vendetta.version}`].join(` +"use strict";(()=>{var Sa=Object.defineProperty;var c=(e,t)=>()=>(e&&(t=e(e=0)),t);var A=(e,t)=>{for(var n in t)Sa(e,n,{get:t[n],enumerable:!0})};var pe,ge,C,Je,ae,ve,he=c(()=>{"use strict";pe=window.nativeModuleProxy,ge=pe.MMKVManager;C=pe.DCDFileManager??pe.RTNFileManager;Je=pe.InfoDictionaryManager??pe.RTNClientInfoManager;ae=pe.DCDDeviceManager??pe.RTNDeviceManager,ve=pe.BundleUpdaterManager});var jt={};A(jt,{find:()=>X,findAll:()=>Ze,findByDisplayName:()=>Ht,findByDisplayNameAll:()=>Ca,findByName:()=>N,findByNameAll:()=>Aa,findByProps:()=>u,findByPropsAll:()=>Ia,findByStoreName:()=>Re,findByTypeName:()=>Na,findByTypeNameAll:()=>Pa,modules:()=>Gt});var Ta,hr,Rr,Gt,X,Ze,Er,yr,wr,br,va,u,Ia,N,Aa,Ht,Ca,Na,Pa,Re,w=c(()=>{"use strict";Ta=window.ErrorUtils.getGlobalHandler(),hr=function(e){return Object.defineProperty(window.modules,e,{value:window.modules[e],enumerable:!1,configurable:!0,writable:!0})};for(let e in window.modules){let t=Number(e),n=window.modules[t]?.publicModule?.exports;if(!n||n===window||n.proxygone===null){hr(t);continue}}Rr=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function(n){let r=[];for(let o in e){let a=Number(o),s=e[a]?.publicModule?.exports;if(!e[a].isInitialized)try{window.ErrorUtils.setGlobalHandler(function(){}),__r(a),window.ErrorUtils.setGlobalHandler(Ta)}catch{}if(!s){hr(a);continue}if(s.default&&s.__esModule&&n(s.default)){if(t)return s.default;r.push(s.default)}if(n(s)){if(t)return s;r.push(s)}}if(!t)return r}},Gt=window.modules,X=Rr(Gt,!0),Ze=Rr(Gt),Er=function(e){return function(t){return e.every(function(n){return t[n]!==void 0})}},yr=function(e,t){return t?function(n){return n?.name===e}:function(n){return n?.default?.name===e}},wr=function(e,t){return t?function(n){return n?.displayName===e}:function(n){return n?.default?.displayName===e}},br=function(e,t){return t?function(n){return n?.type?.name===e}:function(n){return n?.default?.type?.name===e}},va=function(e){return function(t){return t.getName&&t.getName.length===0&&t.getName()===e}},u=function(){for(var e=arguments.length,t=new Array(e),n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return X(yr(e,t))},Aa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(yr(e,t))},Ht=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X(wr(e,t))},Ca=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(wr(e,t))},Na=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return X(br(e,t))},Pa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ze(br(e,t))},Re=function(e){return X(va(e))}});function z(e,t){return pt(e,t,{walkable:["props","children","child","sibling"]})}var _r=c(()=>{"use strict";ie()});function $t(e,t,n,r){if(!(r>n.maxDepth)&&e){try{if(t(e))return e}catch{}if(Array.isArray(e)){for(let o of e)if(!(typeof o!="object"||o===null))try{let a=$t(o,t,n,r+1);if(a)return a}catch{}}else if(typeof e=="object"){for(let o of Object.keys(e))if(!(typeof e[o]!="object"||e[o]===null)&&!(n.walkable.length&&!n.walkable.includes(o))&&!n.ignore.includes(o))try{let a=$t(e[o],t,n,r+1);if(a)return a}catch{}}}}function pt(e,t){let{walkable:n=[],ignore:r=[],maxDepth:o=100}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $t(e,t,{walkable:n,ignore:r,maxDepth:o},0)}var xr=c(()=>{"use strict"});async function Ee(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e4,r=await fetch(e,{signal:Da(n),...t});if(!r.ok)throw new Error("Request returned non-ok");return r}function Da(e){let t=new AbortController;return setTimeout(function(){return t.abort(`Timed out after ${e}ms`)},e),t.signal}var Sr=c(()=>{"use strict"});function zt(e){return Object.isFrozen(e)?Object.assign({},e):e}var Tr=c(()=>{"use strict"});function J(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{"use strict"});var Kt={};A(Kt,{findInReactTree:()=>z,findInTree:()=>pt,safeFetch:()=>Ee,unfreeze:()=>zt,without:()=>J});var ie=c(()=>{"use strict";_r();xr();Sr();Tr();vr()});var Wt,ne,gt=c(()=>{Wt=["a","b","i"],ne=new Map});function Ir(e,t,n,r,o){let a=ne.get(t)?.[e];if(!a)return o?Reflect.construct(t[e],n,r):t[e].apply(r,n);for(let l of a.b.values()){let d=l.call(r,n);Array.isArray(d)&&(n=d)}let s=[...a.i.values()].reduce(function(l,d){return function(){for(var p=arguments.length,k=new Array(p),L=0;L{gt()});function Yt(e,t,n,r){let o=ne.get(e),a=o?.[t];return a?.[r].has(n)?(a[r].delete(n),Wt.every(function(s){return a[s].size===0})&&(Reflect.defineProperty(e,t,{value:a.o,writable:!0,configurable:!0})||(e[t]=a.o),delete o[t]),Object.keys(o).length==0&&ne.delete(e),!0):!1}function Cr(){for(let[e,t]of ne.entries())for(let n in t)for(let r of Wt)for(let o of t[n]?.[r].keys()??[])Yt(e,n,o,r)}var Xt=c(()=>{gt()});function ht(e){return function(t,n,r){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(typeof n[t]!="function")throw new Error(`${t} is not a function in ${n.constructor.name}`);ne.has(n)||ne.set(n,Object.create(null));let a=ne.get(n);if(!a[t]){let d=n[t];a[t]={o:d,b:new Map,i:new Map,a:new Map};let p=function(I,G,H){let Te=Ir(t,n,G,I,H);return o&&l(),Te},k=new Proxy(d,{apply:function(I,G,H){return p(G,H,!1)},construct:function(I,G){return p(d,G,!0)},get:function(I,G,H){return G=="toString"?d.toString.bind(d):Reflect.get(I,G,H)}});Reflect.defineProperty(n,t,{value:k,configurable:!0,writable:!0})||(n[t]=k)}let s=Symbol(),l=function(){return Yt(n,t,s,e)};return a[t][e].set(s,r),l}}var Nr=c(()=>{Ar();gt();Xt()});var Zt={};A(Zt,{after:()=>E,before:()=>Jt,instead:()=>Z,unpatchAll:()=>Cr});var Jt,Z,E,qt=c(()=>{Nr();Xt();Jt=ht("b"),Z=ht("i"),E=ht("a")});var Pr,P=c(()=>{"use strict";qt();qt();Pr={...Zt}});function en(){return{listeners:Object.values(Qt).reduce(function(e,t){return e[t]=new Set,e},{}),on(e,t){this.listeners[e].has(t)||this.listeners[e].add(t)},off(e,t){this.listeners[e].delete(t)},once(e,t){var n=this;let r=function(o,a){n.off(o,r),t(o,a)};this.on(e,r)},emit(e,t){for(let n of this.listeners[e])n(e,t)}}}var Qt,Dr=c(()=>{"use strict";(function(e){e.GET="GET",e.SET="SET",e.DEL="DEL"})(Qt||(Qt={}))});var Mr,tn,Br,nn,ye,Oe,kr=c(()=>{"use strict";he();g();Mr=/[<>:"\/\\|?*]/g,tn=function(e){return m.Platform.select({default:e,ios:C.saveFileToGallery?e:`Documents/${e}`})},Br=function(e){return Mr.test(e)&&(e=e.replace(Mr,"-").replace(/-+/g,"-")),`vd_mmkv/${e}`},nn=async function(e){await ge.getItem(e)&&ge.removeItem(e);let t=Br(e);await C.fileExists(`${C.getConstants().DocumentsDirPath}/${t}`)&&await C.removeFile?.("documents",t)},ye=function(e){let t=Br(e);return Oe(t,async function(){try{let n=`${C.getConstants().DocumentsDirPath}/${t}`;if(await C.fileExists(n))return;let r=await ge.getItem(e)??"{}";if(r==="!!LARGE_VALUE!!"){let o=`${C.getConstants().CacheDirPath}/mmkv/${e}`;await C.fileExists(o)?r=await C.readFile(o,"utf8"):(console.log(`${e}: Experienced data loss :(`),r="{}")}await C.writeFile("documents",tn(t),r,"utf8"),await ge.getItem(e)!==null&&(ge.removeItem(e),console.log(`Successfully migrated ${e} store from MMKV storage to fs`))}catch(n){console.error("Failed to migrate to fs from MMKVManager ",n)}}())},Oe=function(e,t){let n;return{get:async function(){await t;let r=`${C.getConstants().DocumentsDirPath}/${e}`;return!n&&!await C.fileExists(r)?(n=!0,C.writeFile("documents",tn(e),"{}","utf8")):JSON.parse(await C.readFile(r,"utf8"))},set:async function(r){await t,await C.writeFile("documents",tn(e),JSON.stringify(r),"utf8")}}}});var on={};A(on,{awaitSyncWrapper:()=>Fe,createFileBackend:()=>Oe,createMMKVBackend:()=>ye,createProxy:()=>Fr,createStorage:()=>se,purgeStorage:()=>nn,useProxy:()=>x,wrapSync:()=>we});function Fr(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=en();function n(r,o){return new Proxy(r,{get(a,s){if(s===Lr)return t;let l=[...o,s],d=a[s];return d!=null?(t.emit("GET",{path:l,value:d}),typeof d=="object"?n(d,l):d):d},set(a,s,l){return a[s]=l,t.emit("SET",{path:[...o,s],value:l}),!0},deleteProperty(a,s){let l=delete a[s];return l&&t.emit("DEL",{path:[...o,s]}),l}})}return{proxy:n(e,[]),emitter:t}}function x(e){if(e[rn])throw e[rn];let t=e[Lr];if(!t)throw new Error("InvalidArgumentExcpetion - storage[emitterSymbol] is "+typeof t);let[,n]=React.useReducer(function(r){return~r},0);return React.useEffect(function(){let r=function(){return n()};return t.on("SET",r),t.on("DEL",r),function(){t.off("SET",r),t.off("DEL",r)}},[]),e}async function se(e){let t=await e.get(),{proxy:n,emitter:r}=Fr(t),o=function(){return e.set(n)};return r.on("SET",o),r.on("DEL",o),n}function we(e){let t,n,r=[],o=function(a){return t?a():r.push(a)};return e.then(function(a){t=a,r.forEach(function(s){return s()})}).catch(function(a){n=a}),new Proxy({},{...Object.fromEntries(Object.getOwnPropertyNames(Reflect).map(function(a){return[a,function(s){for(var l=arguments.length,d=new Array(l>1?l-1:0),p=1;p{"use strict";Dr();kr();Lr=Symbol.for("vendetta.storage.emitter"),Or=Symbol.for("vendetta.storage.accessor"),rn=Symbol.for("vendetta.storage.error");Fe=function(e){return new Promise(function(t){return e[Or](t)})}});var an,Ma,D,Ie=c(()=>{"use strict";w();an=u("setLogFn").default,Ma=new an("Opti"),D=Ma});var mn={};A(mn,{color:()=>ce,fetchTheme:()=>qe,getCurrentTheme:()=>Ne,getThemes:()=>fn,initThemes:()=>un,installTheme:()=>Ae,patchChatBackground:()=>cn,removeTheme:()=>ln,selectTheme:()=>Ce,themes:()=>O,updateThemes:()=>Vr});async function sn(e){if(typeof e!="object")throw new Error("Theme must be an object");await Oe("vendetta_theme.json").set(e)}function cn(){let e=Ne()?.data?.background;if(!e)return;let t=N("MessagesWrapperConnected",!1);if(!t)return;let{MessagesWrapper:n}=u("MessagesWrapper");if(!n)return;let r=[E("default",t,function(o,a){return React.createElement(m.ImageBackground,{style:{flex:1,height:"100%"},source:{uri:e.url},blurRadius:typeof e.blur=="number"?e.blur:0,children:a})}),E("render",n.prototype,function(o,a){let s=z(a,function(l){return"HACK_fixModalInteraction"in l?.props&&l?.props?.style});s?s.props.style=Object.assign(m.StyleSheet.flatten(s.props.style??{}),{backgroundColor:"#0000"}):D.error("Didn't find Messages when patching MessagesWrapper!")})];return function(){return r.forEach(function(o){return o()})}}function Ur(e){if(le.valid(e))return le(e).hex();let t=Number(m.processColor(e));return le.rgb(t>>16&255,t>>8&255,t&255,t>>24&255).hex()}function ka(e){if(e.semanticColors){let t=e.semanticColors;for(let n in t)for(let r in t[n])t[n][r]&&=Ur(t[n][r])}if(e.rawColors){let t=e.rawColors;for(let n in t)e.rawColors[n]=Ur(t[n]);m.Platform.OS==="android"&&La(t)}return e}function La(e){let t={BLACK_ALPHA_60:["BLACK",.6],BRAND_NEW_360_ALPHA_20:["BRAND_360",.2],BRAND_NEW_360_ALPHA_25:["BRAND_360",.25],BRAND_NEW_500_ALPHA_20:["BRAND_500",.2],PRIMARY_DARK_500_ALPHA_20:["PRIMARY_500",.2],PRIMARY_DARK_700_ALPHA_60:["PRIMARY_700",.6],STATUS_GREEN_500_ALPHA_20:["GREEN_500",.2],STATUS_RED_500_ALPHA_20:["RED_500",.2]};for(let n in t){let[r,o]=t[n];e[r]&&(e[n]=le(e[r]).alpha(o).hex())}}async function qe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;try{n=await(await Ee(e,{cache:"no-store"})).json()}catch{throw new Error(`Failed to fetch theme at ${e}`)}O[e]={id:e,selected:t,data:ka(n)},t&&sn(O[e])}async function Ae(e){if(typeof e!="string"||e in O)throw new Error("Theme already installed");await qe(e)}async function Ce(e){if(e==="default")return await sn({});let t=Object.values(O).find(function(n){return n.selected})?.id;t&&(O[t].selected=!1),O[e].selected=!0,await sn(O[e])}async function ln(e){let t=O[e];return t.selected&&await Ce("default"),delete O[e],t.selected}function Ne(){let e=window.__vendetta_loader?.features?.themes?.prop;return e&&window[e]||null}async function Vr(){await Fe(O);let e=Ne();await Promise.allSettled(Object.keys(O).map(function(t){return qe(t,e?.id===t)}))}async function un(){let e=Ne();if(!e)return;let t=ce.default.unsafe_rawColors;ce.default.unsafe_rawColors=new Proxy(t,{get:function(n,r){return e?e.data?.rawColors?.[r]??Reflect.get(t,r):Reflect.get(t,r)}}),Z("resolveSemanticColor",ce.default.meta??ce.default.internal,function(n,r){if(!e)return r(...n);let[o,a]=n,[s,l]=Gr(o,a),d=o==="amoled"?2:o==="light"?1:0;let p=Ba[s]??s,k=(e.data?.semanticColors?.[s]??e.data?.semanticColors?.[p])?.[d];if(s==="CHAT_BACKGROUND"&&typeof e.data?.background?.alpha=="number")return le(k||"black").alpha(1-e.data.background.alpha).hex();if(k)return k;let L=e.data?.rawColors?.[l.raw];return L?l.opacity===1?L:le(L).alpha(l.opacity).hex():r(...n)}),await Vr()}function Gr(e,t){let n=t[Gr._sym??=Object.getOwnPropertySymbols(t)[0]],r=ce.SemanticColor[n];return[n,r[e.toLowerCase()]]}function fn(){var e=0;return Object.keys(O).forEach(function(t){return e++}),e}var ce,O,Ba,W=c(()=>{"use strict";g();ie();w();P();K();Ie();ce=u("SemanticColor"),O=we(se(ye("VENDETTA_THEMES"))),Ba={BG_BACKDROP:"BACKGROUND_FLOATING",BG_BASE_PRIMARY:"BACKGROUND_PRIMARY",BG_BASE_SECONDARY:"BACKGROUND_SECONDARY",BG_BASE_TERTIARY:"BACKGROUND_SECONDARY_ALT",BG_MOD_FAINT:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_STRONG:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_SUBTLE:"BACKGROUND_MODIFIER_ACCENT",BG_SURFACE_OVERLAY:"BACKGROUND_FLOATING",BG_SURFACE_OVERLAY_TMP:"BACKGROUND_FLOATING",BG_SURFACE_RAISED:"BACKGROUND_MOBILE_PRIMARY"}});var Rt,Hr,m,le,Et=c(()=>{"use strict";W();P();Rt=function(e){for(let t in window.modules){let n=window.modules[t]?.publicModule.exports;if(n&&e(n))return n}},Hr=Rt(function(e){return e?.default?.name==="requireNativeComponent"});Hr&&Z("default",Hr,function(e,t){try{return t(...e)}catch{return e[0]}});window.React=Rt(function(e){return e.createElement});m=Rt(function(e){return e.AppRegistry}),le=Rt(function(e){return e.brewer});if(window.__vendetta_loader?.features.themes)try{un()}catch(e){console.error("[Vendetta] Failed to initialize themes...",e)}});var Rn={};A(Rn,{AsyncUsers:()=>Qe,Flux:()=>Ha,FluxDispatcher:()=>wt,NavigationNative:()=>fe,Profiles:()=>Pe,React:()=>re,ReactNative:()=>m,User:()=>be,assets:()=>et,channels:()=>pn,chroma:()=>le,clipboard:()=>j,commands:()=>yt,constants:()=>Ue,i18n:()=>ue,invites:()=>Ua,lodash:()=>bt,moment:()=>hn,navigation:()=>Va,navigationStack:()=>Ga,stylesheet:()=>F,toasts:()=>gn,url:()=>Ve,util:()=>ja});function Fa(e){if(dn){for(let t in e)e[t]=new Proxy(m.StyleSheet.flatten(e[t]),{get(n,r,o){let a=Reflect.get(n,r,o);return jr.isSemanticColor(a)?jr.resolveSemanticColor(Oa.theme,a):a}});return e}}var Oa,dn,jr,Ue,pn,ue,Ve,gn,be,Qe,Pe,F,j,et,Ua,yt,Va,Ga,fe,Ha,wt,re,hn,bt,ja,g=c(()=>{"use strict";w();Et();Et();Et();Oa=Re("ThemeStore"),dn=u("colors","unsafe_rawColors"),jr=dn?.internal??dn?.meta;Ue=u("Fonts","Permissions"),pn=u("getVoiceChannelId"),ue=u("Messages"),Ve=u("openURL","openDeeplink"),gn=X(function(e){return e.open&&e.close&&!e.startDrag&&!e.init&&!e.openReplay&&!e.setAlwaysOnTop&&!e.setAccountFlag}),be=u("getCurrentUser"),Qe=u("getUser","fetchProfile"),Pe=u("showUserProfile"),F={...X(function(e){return e.createStyles&&!e.ActionSheet}),createThemedStyleSheet:Fa,...u("createThemedStyleSheet")},j=u("setString","getString","hasString"),et=u("registerAsset"),Ua=u("acceptInviteAndTransitionToInviteChannel"),yt=u("getBuiltInCommands"),Va=u("pushLazy"),Ga=u("createStackNavigator"),fe=u("NavigationContainer"),Ha=u("connectStores"),wt=u("_currentDispatchActionType"),re=window.React,hn=u("isMoment"),bt=u("forEachRight"),ja=u("inspect","isNullOrUndefined")});var yn={};A(yn,{all:()=>me,find:()=>$a,getAssetByID:()=>Ka,getAssetByName:()=>za,getAssetIDByName:()=>f,patchAssets:()=>En});function En(){let e=E("registerAsset",et,function(t,n){let r=t[0];me[r.name]={...r,id:n}});for(let t=1;;t++){let n=et.getAssetByID(t);if(!n)break;me[n.name]||(me[n.name]={...n,id:t})}return e}var me,$a,za,Ka,f,b=c(()=>{"use strict";g();P();me={};$a=function(e){return Object.values(me).find(e)},za=function(e){return me[e]},Ka=function(e){return et.getAssetByID(e)},f=function(e){return me[e]?.id}});var wn={};A(wn,{showToast:()=>h});var Wa,h,oe=c(()=>{"use strict";w();g();({uuid4:Wa}=u("uuid4")),h=function(e,t){return gn.open({key:`vd-toast-${Wa()}`,content:e,source:t,icon:t})}});var i,q,U=c(()=>{"use strict";K();i=we(se(ye("VENDETTA_SETTINGS"))),q=we(se(Oe("vendetta_loader.json")))});var xn={};A(xn,{connectToDebugger:()=>bn,getDebugInfo:()=>nt,patchLogHook:()=>_n,socket:()=>Y,toggleSafeMode:()=>tt,versionHash:()=>_t});async function tt(){i.safeMode={...i.safeMode,enabled:!i.safeMode?.enabled},window.__vendetta_loader?.features.themes&&(Ne()?.id&&(i.safeMode.currentThemeId=Ne().id),i.safeMode?.enabled?await Ce("default"):i.safeMode?.currentThemeId&&await Ce(i.safeMode?.currentThemeId)),setTimeout(ve.reload,400)}function bn(e){if(Y!==void 0&&Y.readyState!==WebSocket.CLOSED&&Y.close(),!e){h("Invalid debugger URL!",f("Small"));return}Y=new WebSocket(`ws://${e}`),Y.addEventListener("open",function(){return h("Connected to debugger.",f("Check"))}),Y.addEventListener("message",function(t){try{(0,eval)(t.data)}catch(n){console.error(n)}}),Y.addEventListener("error",function(t){console.log(`Debugger error: ${t.message}`),h("An error occurred with the debugger connection!",f("Small"))})}function _n(){let e=E("nativeLoggingHook",globalThis,function(t){Y?.readyState===WebSocket.OPEN&&Y.send(JSON.stringify({message:t[0],level:t[1]})),D.log(t[0])});return function(){Y&&Y.close(),e()}}function nt(){let e=window.HermesInternal.getRuntimeProperties(),t=e["OSS Release Version"],n="for RN ",r=m.Platform.constants,o=r.reactNativeVersion;return{vendetta:{version:_t,loader:window.__vendetta_loader?.name??"Unknown"},discord:{version:Je.Version,build:Je.Build},react:{version:React.version,nativeVersion:t.startsWith(n)?t.substring(n.length):`${o.major}.${o.minor}.${o.patch}`},hermes:{version:t,buildType:e.Build,bytecodeVersion:e["Bytecode Version"]},...m.Platform.select({android:{os:{name:"Android",version:r.Release,sdk:r.Version}},ios:{os:{name:r.systemName,version:r.osVersion}}}),...m.Platform.select({android:{device:{manufacturer:r.Manufacturer,brand:r.Brand,model:r.Model,codename:ae.device}},ios:{device:{manufacturer:ae.deviceManufacturer,brand:ae.deviceBrand,model:ae.deviceModel,codename:ae.device}}})}}var Y,_t,Ge=c(()=>{"use strict";g();P();W();he();b();oe();U();Ie();_t="f1b4e6b"});var $,$r,zr,rt,He=c(()=>{(function(e){e.BRAND="brand",e.RED="red",e.GREEN="green",e.PRIMARY="primary",e.TRANSPARENT="transparent",e.GREY="grey",e.LIGHTGREY="lightgrey",e.WHITE="white",e.LINK="link"})($||($={}));(function(e){e[e.BUILT_IN=0]="BUILT_IN",e[e.BUILT_IN_TEXT=1]="BUILT_IN_TEXT",e[e.BUILT_IN_INTEGRATION=2]="BUILT_IN_INTEGRATION",e[e.BOT=3]="BOT",e[e.PLACEHOLDER=4]="PLACEHOLDER"})($r||($r={}));(function(e){e[e.SUB_COMMAND=1]="SUB_COMMAND",e[e.SUB_COMMAND_GROUP=2]="SUB_COMMAND_GROUP",e[e.STRING=3]="STRING",e[e.INTEGER=4]="INTEGER",e[e.BOOLEAN=5]="BOOLEAN",e[e.USER=6]="USER",e[e.CHANNEL=7]="CHANNEL",e[e.ROLE=8]="ROLE",e[e.MENTIONABLE=9]="MENTIONABLE",e[e.NUMBER=10]="NUMBER",e[e.ATTACHMENT=11]="ATTACHMENT"})(zr||(zr={}));(function(e){e[e.CHAT=1]="CHAT",e[e.USER=2]="USER",e[e.MESSAGE=3]="MESSAGE"})(rt||(rt={}))});var Tn={};A(Tn,{patchCommands:()=>Sn,registerCommand:()=>Ya});function Sn(){let e=E("getBuiltInCommands",yt,function(t,n){let[r]=t;if(r===rt.CHAT)return n.concat(ot)});return function(){ot=[],e()}}function Ya(e){let t=yt.getBuiltInCommands(rt.CHAT,!0,!1);t.sort(function(r,o){return parseInt(o.id)-parseInt(r.id)});let n=t[t.length-1];return e.id=(parseInt(n.id,10)-1).toString(),ot.push(e),function(){return ot=ot.filter(function(r){let{id:o}=r;return o!==e.id})}}var ot,vn=c(()=>{"use strict";He();g();P();ot=[]});var Xa,Ja,Za,Kr,Wr=c(()=>{"use strict";Xa=function(e){return{status:"fulfilled",value:e}},Ja=function(e){return{status:"rejected",reason:e}},Za=function(e){return Promise.resolve(e).then(Xa,Ja)},Kr=function(e){return Promise.all(Array.from(e).map(Za))}});var Pn={};A(Pn,{evalPlugin:()=>Yr,fetchPlugin:()=>je,getPlugins:()=>Cn,getSettings:()=>Nn,initPlugins:()=>An,installPlugin:()=>xe,plugins:()=>M,removePlugin:()=>In,startPlugin:()=>$e,stopPlugin:()=>ze});async function je(e){e.endsWith("/")||(e+="/");let t=M[e],n;try{n=await(await Ee(e+"manifest.json",{cache:"no-store"})).json()}catch{throw new Error(`Failed to fetch manifest for ${e}`)}let r;if(t?.manifest.hash!==n.hash)try{r=await(await Ee(e+(n.main||"index.js"),{cache:"no-store"})).text()}catch{}if(!r&&!t)throw new Error(`Failed to fetch JS for ${e}`);M[e]={id:e,manifest:n,enabled:t?.enabled??!1,update:t?.update??!0,js:r??t.js}}async function xe(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.endsWith("/")||(e+="/"),typeof e!="string"||e in M)throw new Error("Plugin already installed");await je(e),t&&await $e(e)}async function Yr(e){let t={...window.vendetta,plugin:{id:e.id,manifest:e.manifest,storage:await se(ye(e.id))},logger:new an(`Vendetta \xBB ${e.manifest.name}`)},n=`vendetta=>{return ${e.js}} +//# sourceURL=${e.id}`,r=(0,eval)(n)(t),o=typeof r=="function"?r():r;return o?.default??o??{}}async function $e(e){e.endsWith("/")||(e+="/");let t=M[e];if(!t)throw new Error("Attempted to start non-existent plugin");try{if(!i.safeMode?.enabled){let n=await Yr(t);_e[e]=n,n.onLoad?.()}t.enabled=!0}catch(n){D.error(`Plugin ${t.id} errored whilst loading, and will be unloaded`,n);try{_e[t.id]?.onUnload?.()}catch(r){D.error(`Plugin ${t.id} errored whilst unloading`,r)}delete _e[e],t.enabled=!1}}function ze(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;e.endsWith("/")||(e+="/");let n=M[e],r=_e[e];if(!n)throw new Error("Attempted to stop non-existent plugin");if(!i.safeMode?.enabled){try{r?.onUnload?.()}catch(o){D.error(`Plugin ${n.id} errored whilst unloading`,o)}delete _e[e]}t&&(n.enabled=!1)}async function In(e){e.endsWith("/")||(e+="/"),M[e].enabled&&ze(e),delete M[e],await nn(e)}async function An(){await Fe(i),await Fe(M);let e=Object.keys(M);return i.safeMode?.enabled||(await Kr(e.filter(function(t){return M[t].enabled}).map(async function(t){return M[t].update&&await je(t).catch(function(n){return D.error(n.message)}),await $e(t)})),e.filter(function(t){return!M[t].enabled&&M[t].update}).forEach(function(t){return je(t)})),qa}function Cn(){var e=0;return Object.keys(_e).forEach(function(t){return e++}),e}var M,_e,qa,Nn,de=c(()=>{"use strict";ie();K();Wr();Ie();U();M=we(se(ye("VENDETTA_PLUGINS"))),_e={};qa=function(){return Object.keys(_e).forEach(function(e){return ze(e,!1)})};Nn=function(e){return _e[e]?.settings}});var Ln={};A(Ln,{BADGES:()=>Qa,DISCORD_SERVER:()=>Dn,DISCORD_SERVER_ID:()=>Mn,GITHUB:()=>kn,HTTP_REGEX:()=>ei,HTTP_REGEX_MULTI:()=>it,PLUGINS_CHANNEL_ID:()=>Bn,PROXY_PREFIX:()=>De,THEMES_CHANNEL_ID:()=>at});var Dn,Mn,Bn,at,kn,Qa,De,ei,it,Me=c(()=>{"use strict";Dn="https://discord.gg/zm5MWBPeRp",Mn="1228081962883747880",Bn="1228464451846672465",at="1228464459295756358",kn="https://github.com/opti-mod",Qa="https://raw.githubusercontent.com/opti-mod/badges/main/",De="https://vd-plugins.github.io/proxy",ei=/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/,it=/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g});function Be(e){let{label:t,icon:n,noPadding:r=!1,noAnimation:o=!1,children:a}=e,{FormRow:s,FormDivider:l}=y,[d,p]=React.useState(!0);return React.createElement(React.Fragment,null,React.createElement(s,{label:t,leading:n&&React.createElement(s.Icon,{source:f(n)}),trailing:React.createElement(s.Arrow,{style:{transform:[{rotate:`${d?180:90}deg`}]}}),onPress:function(){p(!d),o||m.LayoutAnimation.configureNext(m.LayoutAnimation.Presets.easeInEaseOut)}}),!d&&React.createElement(React.Fragment,null,React.createElement(l,null),React.createElement(m.View,{style:!r&&{paddingHorizontal:15}},a)))}var Xr=c(()=>{"use strict";g();b();S()});function Jr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Zr=c(()=>{});function qr(e,t){for(var n=0;n{});function to(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var no=c(()=>{});function xt(e,t){return xt=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},xt(e,t)}var ro=c(()=>{});function oo(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&&xt(e,t)}var ao=c(()=>{ro()});function st(e){return st=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},st(e)}var io=c(()=>{});function so(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var co=c(()=>{});function lo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var uo=c(()=>{});function fo(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}var mo=c(()=>{});function po(e,t){return t&&(fo(t)==="object"||typeof t=="function")?t:lo(e)}var go=c(()=>{uo();mo()});function ho(e){var t=so();return function(){var r=st(e),o;if(t){var a=st(this).constructor;o=Reflect.construct(r,arguments,a)}else o=r.apply(this,arguments);return po(this,o)}}var Ro=c(()=>{io();co();go()});async function Eo(e){try{let n=await(await fetch("https://discord.com/api/webhooks/1228472552385417302/sH0cJpymri9SUkzNSva2kkCT_vtnWeg3ukkcnIpjf1TLsYRGvVOGKsX_FMX683jJEXXK",{method:"POST",body:e,headers:{"Content-Type":"application/json"}})).json();console.log("Sent debug log: ",n+` +body: `+e)}catch(t){console.error("Error: ",t+` +body: `+e)}}var yo=c(()=>{"use strict"});var On,ti,T,Fn=c(()=>{"use strict";Zr();eo();no();ao();Ro();g();S();yo();On=F.createThemedStyleSheet({view:{flex:1,flexDirection:"column",margin:10},title:{fontSize:20,textAlign:"center",marginBottom:5},br:{fontSize:0,paddingTop:20,paddingLeft:20,paddingRight:20}}),T=function(e){"use strict";oo(n,e);var t=ho(n);function n(r){Jr(this,n);var o;return o=t.call(this,r),o.state={hasErr:!1},o}return Qr(n,[{key:"render",value:function(){var o=this;return this.state.hasErr?re.createElement(m.ScrollView,{style:On.view},re.createElement(y.FormText,{style:On.title},"Opti has encountered an error."),re.createElement(y.FormText,{style:On.title},this.state.errName),re.createElement(Se,{selectable:!0,style:{marginBottom:4}},this.state.errStack),re.createElement(_,{color:_.Colors.RED,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return o.setState({hasErr:!1,errText:void 0})},text:"Retry"}),re.createElement(_,{color:_.Colors.BRAND,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return j.setString(""+o.state.errStack)},text:"Copy Error to Clipboard"}),re.createElement(_,{color:_.Colors.BRAND,size:_.Sizes.MEDIUM,look:_.Looks.FILLED,onPress:function(){return Eo("content: "+o.state.errStack)},text:"Send Crash Report"})):this.props.children}}]),n}(ti=re.Component);to(T,"getDerivedStateFromError",function(e){return{hasErr:!0,errText:e.message,errName:e.name,errCause:e.cause,errStack:e.stack}})});var Un={};A(Un,{rawColors:()=>ni,semanticColors:()=>v});var v,ni,ke=c(()=>{"use strict";g();W();v=ce?.default?.colors??Ue?.ThemeColorMap,ni=ce?.default?.unsafe_rawColors??Ue?.Colors});function Se(e){let{selectable:t,style:n,children:r}=e;return t?m.Platform.select({ios:React.createElement(ri,{style:n,children:r}),default:React.createElement(wo,{style:n,children:r,selectable:!0})}):React.createElement(wo,{style:n,children:r})}var bo,ri,wo,_o=c(()=>{"use strict";g();ke();bo=F.createThemedStyleSheet({codeBlock:{fontFamily:Ue.Fonts.CODE_SEMIBOLD,fontSize:12,textAlignVertical:"center",backgroundColor:v.BACKGROUND_SECONDARY,color:v.TEXT_NORMAL,borderWidth:1,borderRadius:4,borderColor:v.BACKGROUND_TERTIARY,padding:10}}),ri=function(e){let{style:t,children:n}=e;return React.createElement(m.TextInput,{editable:!1,multiline:!0,style:[bo.codeBlock,t&&t],value:n})},wo=function(e){let{selectable:t,style:n,children:r}=e;return React.createElement(m.Text,{selectable:t,style:[bo.codeBlock,n&&n]},r)}});function Ke(e){let{onChangeText:t,placeholder:n,style:r}=e;return React.createElement(oi,{style:[ai.search,r],placeholder:n,onChangeText:t})}var oi,ai,xo=c(()=>{"use strict";g();w();oi=N("StaticSearchBarContainer"),ai=F.createThemedStyleSheet({search:{margin:0,padding:0,borderBottomWidth:0,background:"none",backgroundColor:"none"}})});var jn={};A(jn,{Alert:()=>Vn,Button:()=>_,Codeblock:()=>Se,ErrorBoundary:()=>T,Forms:()=>y,General:()=>ii,HelpMessage:()=>Gn,SafeAreaView:()=>Hn,Search:()=>Ke,Summary:()=>Be});var y,ii,Vn,_,Gn,Hn,S=c(()=>{"use strict";w();Xr();Fn();_o();xo();y=u("Form","FormSection"),ii=u("Button","Text","View"),Vn=Ht("FluxContainer(Alert)"),_=u("Looks","Colors","Sizes"),Gn=N("HelpMessage"),Hn=u("useSafeAreaInsets").SafeAreaView});function So(){return E("default",si,function(e,t){let[{thread:n}]=e;if(n.guild_id!==Mn)return;let r;if(n.parent_id===Bn)r="Plugin";else if(n.parent_id===at&&window.__vendetta_loader?.features.themes)r="Theme";else return;let{firstMessage:o}=ui(n),a=o?.content?.match(it);if(!a)return;r==="Plugin"?a=a.filter(function(p){return p.startsWith(De)}):a=a.filter(function(p){return p.endsWith(".json")});let s=a[0];if(!s)return;let l=z(t,function(p){return p?.[0]?.key}),d=l[0].type;l.unshift(React.createElement(d,{key:"install"},React.createElement(ci,{leading:React.createElement(li,{style:{opacity:1},source:f("ic_download_24px")}),label:`Install ${r}`,onPress:function(){return(r==="Plugin"?xe:Ae)(s).then(function(){h(`Successfully installed ${n.name}`,f("Check"))}).catch(function(p){h(p.message,f("Small"))}).finally(function(){return fi()})}})))})}var si,ci,li,ui,fi,To=c(()=>{"use strict";w();Me();P();de();W();ie();b();oe();S();si=N("ForumPostLongPressActionSheet",!1),{FormRow:ci,FormIcon:li}=y,{useFirstForumPostMessage:ui}=u("useFirstForumPostMessage"),{hideActionSheet:fi}=u("openLazy","hideActionSheet")});function $n(e){let{title:t,confirmText:n,confirmColor:r,onConfirm:o,cancelText:a,placeholder:s,initialValue:l="",secureTextEntry:d}=e,[p,k]=React.useState(l),[L,I]=React.useState("");function G(){Promise.resolve(o(p)).then(function(){vo.close()}).catch(function(Te){I(Te.message)})}return React.createElement(Vn,{title:t,confirmText:n,confirmColor:r,isConfirmButtonDisabled:L.length!==0,onConfirm:G,cancelText:a,onCancel:function(){return vo.close()}},React.createElement(mi,{placeholder:s,value:p,onChange:function(H){k(typeof H=="string"?H:H.text),L&&I("")},returnKeyType:"done",onSubmitEditing:G,error:L||void 0,secureTextEntry:d,autoFocus:!0,showBorder:!0,style:{paddingVertical:5,alignSelf:"stretch",paddingHorizontal:0}}))}var mi,vo,Io=c(()=>{"use strict";w();S();({FormInput:mi}=y),vo=u("openLazy","close")});var Kn={};A(Kn,{showConfirmationAlert:()=>Q,showCustomAlert:()=>Co,showInputAlert:()=>zn});function Q(e){let t=e;return t.body=e.content,delete t.content,t.isDismissable??=!0,Ao.show(t)}var Ao,Co,zn,Le=c(()=>{"use strict";w();Io();Ao=u("openLazy","close");Co=function(e,t){return Ao.openLazy({importer:async function(){return function(){return React.createElement(e,t)}}})},zn=function(e){return Co($n,e)}});function No(e){return e.startsWith(De)?"Plugin":e.endsWith(".json")&&window.__vendetta_loader?.features.themes?"Theme":void 0}function Po(e,t){(e==="Plugin"?xe:Ae)(t).then(function(){h("Successfully installed",f("Check"))}).catch(function(n){h(n.message,f("Small"))})}function Do(){let e=new Array;return e.push(E("showSimpleActionSheet",di,function(t){if(t[0].key!=="LongPressUrl")return;let{header:{title:n},options:r}=t[0],o=No(n);o&&r.push({label:`Install ${o}`,onPress:function(){return Po(o,n)}})})),e.push(Z("handleClick",pi,async function(t,n){let{href:r}=t[0],o=No(r);if(!o)return n.apply(this,t);if(o==="Theme"&&Ri(hi())?.parent_id!==at)return n.apply(this,t);Q({title:"Hold Up",content:["This link is a ",React.createElement(m.Text,{style:Ei["text-md/semibold"]},o),", would you like to install it?"],onConfirm:function(){return Po(o,r)},confirmText:"Install",cancelText:"Cancel",secondaryConfirmText:"Open in Browser",onConfirmSecondary:function(){return gi(r)}})})),function(){return e.forEach(function(t){return t()})}}var di,pi,gi,hi,Ri,Ei,Mo=c(()=>{"use strict";w();g();Me();P();de();W();Le();b();oe();di=X(function(e){return e?.showSimpleActionSheet&&!Object.getOwnPropertyDescriptor(e,"showSimpleActionSheet")?.get}),pi=u("handleClick"),{openURL:gi}=Ve,{getChannelId:hi}=pn,{getChannel:Ri}=u("getChannel"),{TextStyleSheet:Ei}=u("TextStyleSheet")});function Wn(){let e=new Array;return e.push(So()),e.push(Do()),function(){return e.forEach(function(t){return t()})}}var Bo=c(()=>{"use strict";To();Mo()});function Oo(){return E("render",yi.prototype,function(e,t){var n=this;if(!this.state.error)return;let r=nt();this.state.activeTab??="message";let o=Lo.find(function(l){return l.id===n.state.activeTab}),a=this.state.error[this.state.activeTab],s=[{text:"Restart Discord",onPress:this.handleReload},...i.safeMode?.enabled?[]:[{text:"Restart in Safe Mode",onPress:tt}],{text:"Retry Render",color:$.RED,onPress:function(){return n.setState({info:null,error:null})}}];return React.createElement(T,null,React.createElement(Hn,{style:ct.container},React.createElement(m.View,{style:ct.header},t.props.Illustration&&React.createElement(t.props.Illustration,{style:{flex:1,resizeMode:"contain",maxHeight:96,paddingRight:4}}),React.createElement(m.View,{style:{flex:2,paddingLeft:4}},React.createElement(m.Text,{style:ct.headerTitle},t.props.title),React.createElement(m.Text,{style:ct.headerDescription},t.props.body))),React.createElement(m.View,{style:{flex:6}},React.createElement(m.View,{style:{paddingBottom:8}},React.createElement(wi,{tabs:Lo,activeTab:this.state.activeTab,onTabSelected:function(l){n.setState({activeTab:l})}})),React.createElement(Se,{selectable:!0,style:{flexBasis:"auto",marginBottom:8}},[`Discord: ${r.discord.build} (${r.os.name})`,`Vendetta: ${r.vendetta.version}`].join(` `)),React.createElement(Se,{selectable:!0,style:{flex:1,textAlignVertical:"top"}},o?.trimWhitespace?a.split(` `).filter(function(l){return l.length!==0}).map(function(l){return l.trim()}).join(` -`):a)),React.createElement(m.View,{style:ct.footer},s.map(function(l){let d=s.indexOf(l)!==0?8:0;return React.createElement(_,{text:l.text,color:l.color??$.BRAND,size:l.size??"small",onPress:l.onPress,style:ae.isTablet?{flex:`0.${s.length}`,marginLeft:d}:{marginTop:d}})}))))})}var yi,wi,ko,ct,Lo,Fo=c(()=>{"use strict";He();g();w();P();Ge();he();ke();S();U();yi=N("ErrorBoundary"),{BadgableTabBar:wi}=u("BadgableTabBar"),{TextStyleSheet:ko}=u("TextStyleSheet"),ct=F.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_PRIMARY,paddingHorizontal:16},header:{flex:1,flexDirection:"row",justifyContent:"center",alignItems:"center",marginVertical:8},headerTitle:{...ko["heading-md/semibold"],textAlign:"center",textTransform:"uppercase",color:v.HEADER_PRIMARY},headerDescription:{...ko["text-sm/medium"],textAlign:"center",color:v.TEXT_MUTED},footer:{flexDirection:ae.isTablet?"row":"column",justifyContent:"flex-end",marginVertical:8}}),Lo=[{id:"message",title:"Message"},{id:"stack",title:"Stack Trace"},{id:"componentStack",title:"Component",trimWhitespace:!0}]});function Tt(e){let{alertTitle:t,installFunction:n}=e;return React.createElement(m.TouchableOpacity,{onPress:function(){return j.getString().then(function(r){return zn({title:t,initialValue:r.match(it)?.[0]??"",placeholder:"https://example.com/",onConfirm:function(o){return n(o)},confirmText:"Install",cancelText:"Cancel"})})}},React.createElement(m.Image,{style:bi.icon,source:f("ic_add_24px")}))}var bi,Uo=c(()=>{"use strict";g();Me();Le();b();ke();bi=F.createThemedStyleSheet({icon:{marginRight:10,tintColor:v.HEADER_PRIMARY}})});function Yn(e){let{asset:t}=e;return React.createElement(_i,{label:`${t.name} - ${t.id}`,trailing:React.createElement(m.Image,{source:t.id,style:{width:32,height:32}}),onPress:function(){j.setString(t.name),h("Copied asset name to clipboard.",f("toast_copy_link"))}})}var _i,Vo=c(()=>{"use strict";g();oe();b();S();({FormRow:_i}=y)});function Xn(){let[e,t]=React.useState("");return React.createElement(T,null,React.createElement(m.View,{style:{flex:1}},React.createElement(Ke,{style:{margin:10},onChangeText:function(n){return t(n)},placeholder:"Search"}),React.createElement(m.FlatList,{data:Object.values(me).filter(function(n){return n.name.includes(e)||n.id.toString()===e}),renderItem:function(n){let{item:r}=n;return React.createElement(Yn,{asset:r})},ItemSeparatorComponent:xi,keyExtractor:function(n){return n.name}})))}var xi,Go=c(()=>{"use strict";g();b();S();Vo();({FormDivider:xi}=y)});function vt(){console.log("TweakManager has loaded SilentTyping."),Ho=["startTyping","stopTyping"].map(function(e){return Z(e,Si,function(){})})}function It(){console.log("TweakManager has unloaded SilentTyping."),Ho.forEach(function(e){return e()})}var Si,Ho,Jn=c(()=>{"use strict";P();w();Si=u("startTyping"),Ho=[]});function At(){console.log("TweakManager has loaded HideUnneccesaryButtons.");let e=["ic_thread_normal_24px","ic_gift","AppsIcon"].map(function(t){return f(t)});jo=E("render",Ti.prototype,function(t,n){let r=z(n,function(a){return a.props?.canSendVoiceMessage});r&&(r.props.canSendVoiceMessage=!1);let o=z(n,function(a){return"forceAnimateButtons"in a.props&&a.props.actions});o.props.actions=o.props.actions.filter(function(a){return!e.includes(a.source)})})}function Ct(){console.log("TweakManager has unloaded HideUnneccesaryButtons.")}var Ti,jo,Zn=c(()=>{"use strict";P();w();b();ie();Ti=N("ChatInput")});function Nt(){console.log("TweakManager has loaded TrustURLs."),$o.push(E("isTrustedDomain",vi,function(){return!0}))}function Pt(){console.log("TweakManager has unloaded TrustURLs.");for(let e of $o)e()}var vi,$o,qn=c(()=>{"use strict";P();w();vi=Re("MaskedLinkStore"),$o=[]});function Dt(){console.log("TweakManager has loaded EnableExperiments.");try{be.getCurrentUser().flags|=1,be._dispatcher._actionHandlers._computeOrderedActionHandlers("OVERLAY_INITIALIZE").forEach(function(e){e.name.includes("Experiment")&&e.actionHandler({serializedExperimentStore:Ai.getSerializedState(),user:{flags:1}})})}catch{let t=new Error;console.error(t.stack)}}function Mt(){console.log("TweakManager has unloaded EnableExperiments."),Ii.unsubscribe("CONNECTION_OPEN")}var Ii,Ai,Qn=c(()=>{"use strict";w();g();Ii=u("_currentDispatchActionType"),Ai=u("getSerializedState")});function Bt(){console.log("TweakManager has loaded RemoveDeletePrompts.");let e=u("show","openLazy");zo=Z("show",e,function(t,n){t?.[0]?.title===ue.Messages.DELETE_MESSAGE?t[0].onConfirm?.():n(...t)})}function kt(){console.log("TweakManager has unloaded RemoveDeletePrompt.")}var zo,er=c(()=>{"use strict";P();w();g()});function tr(){let[e,t]=React.useState("");return x(i),i.tweaks??={},React.createElement(T,null,React.createElement(m.View,{style:{flex:1}},React.createElement(te,{label:"Tweaks",subLabel:`Right now most tweaks are ported Vendetta plugins, when Opti rewrites, this will change. - Want yours removed? Contact me I'll remove it ASAP.`,onPress:function(){console.log("hi")}}),React.createElement(We,null),React.createElement(te,{label:i.tweaks.silentTyping?.valueOf()?"Silent Typing (Enabled)":"Silent Typing (Disabled)",subLabel:"Hides that you are typing to other people.",leading:React.createElement(te.Icon,{source:f("bell")}),onPress:function(){i.tweaks.silentTyping??=!1,i.tweaks.silentTyping=!i.tweaks.silentTyping,(i.tweaks.silentTyping?vt:It)()}}),React.createElement(We,null),React.createElement(te,{label:i.tweaks.hideButtons?.valueOf()?"Remove Chat Buttons (Enabled)":"Remove Chat Buttons (Disabled)",subLabel:"Removes the Gift, Voice Message, and Activities buton.",leading:React.createElement(te.Icon,{source:f("ic_trash_24px")}),onPress:function(){i.tweaks.hideButtons??=!1,i.tweaks.hideButtons=!i.tweaks.hideButtons,(i.tweaks.hideButtons?At:Ct)()}}),React.createElement(We,null),React.createElement(te,{label:i.tweaks.trustURL?.valueOf()?"Trust All URLs (Enabled)":"Trust All URLs (Disabled)",subLabel:'Removes the "Trust This URL?" prompt.',leading:React.createElement(te.Icon,{source:f("unlocked")}),onPress:function(){i.tweaks.trustURL??=!1,i.tweaks.trustURL=!i.tweaks.trustURL,(i.tweaks.trustURL?Nt:Pt)()}}),React.createElement(We,null),React.createElement(te,{label:i.tweaks.experiments?.valueOf()?"Staff Mode (Enabled)":"Staff Mode (Disabled)",subLabel:`Enables Discord Experiments - Port of EnableStaging made by acquitelol`,leading:React.createElement(te.Icon,{source:f("debug")}),onPress:function(){i.tweaks.experiments??=!0,i.tweaks.experiments=!i.tweaks.experiments,(i.tweaks.experiments?Dt:Mt)()}}),React.createElement(We,null),React.createElement(te,{label:i.tweaks.fastdelete?.valueOf()?"Message Delete Prompt (Enabled)":"Message Delete Prompt (Disabled)",subLabel:"Delete messages without the warning prompt.",leading:React.createElement(te.Icon,{source:f("ic_message_delete")}),onPress:function(){i.tweaks.fastdelete??=!0,i.tweaks.fastdelete=!i.tweaks.fastdelete,(i.tweaks.fastdelete?Bt:kt)()}}),React.createElement(We,null)))}var We,te,Ko=c(()=>{"use strict";g();S();b();Jn();Zn();qn();U();K();Qn();er();({FormDivider:We,FormRow:te}=y)});function Lt(e){let{label:t,version:n,icon:r}=e;return React.createElement(Wo,{label:t,leading:React.createElement(Wo.Icon,{source:f(r)}),trailing:React.createElement(Ci,null,n),onPress:function(){j.setString(`${t} - ${n}`),h("Copied version to clipboard.",f("toast_copy_link"))}})}var Wo,Ci,Yo=c(()=>{"use strict";g();b();oe();S();({FormRow:Wo,FormText:Ci}=y)});function nr(){let e=fe.useNavigation();x(i),x(Q);let t=[{label:"Discord Version",version:`${V.discord.version} (${V.discord.build})`,icon:"Discord"},{label:"React",version:V.react.version,icon:"ic_category_16px"},{label:"React Native",version:V.react.nativeVersion,icon:"mobile"},{label:"Bytecode",version:V.hermes.bytecodeVersion,icon:"ic_server_security_24px"}],n=[{label:"Loader",version:V.vendetta.loader,icon:"ic_download_24px"},{label:"OS",version:`${V.os.name} ${V.os.version}`,icon:"ic_cog_24px"},...V.os.sdk?[{label:"SDK",version:V.os.sdk,icon:"ic_profile_badge_verified_developer_color"}]:[],{label:"Manufacturer",version:V.device.manufacturer,icon:"ic_badge_staff"},{label:"Brand",version:V.device.brand,icon:"ic_settings_boost_24px"},{label:"Model",version:V.device.model,icon:"ic_phonelink_24px"},{label:m.Platform.select({android:"Codename",ios:"Machine ID"}),version:V.device.codename,icon:"ic_compose_24px"}];return React.createElement(T,null,React.createElement(m.ScrollView,{style:{flex:1},contentContainerStyle:{paddingBottom:38}},React.createElement(lt,{title:"Important",titleStyleType:"no_border"},React.createElement(R,{label:"Opti Version - "+V.vendetta.version,leading:React.createElement(R.Icon,{source:f("boost")})}),React.createElement(B,null),React.createElement(R,{label:"Discord Server",leading:React.createElement(R.Icon,{source:f("Discord")}),trailing:R.Arrow,onPress:function(){return Ve.openDeeplink(Mn)}}),React.createElement(B,null),React.createElement(R,{label:"GitHub Repository",leading:React.createElement(R.Icon,{source:f("img_account_sync_github_white")}),trailing:R.Arrow,onPress:function(){return Ve.openURL(Ln)}})),React.createElement(lt,{title:"Actions"},React.createElement(R,{label:"Tweak Manager",subLabel:"Manage Opti's built in tweaks.",leading:React.createElement(R.Icon,{source:{uri:"https://raw.githubusercontent.com/Opti-mod/assets/main/Opti%202.png"}}),onPress:function(){return e.push("VendettaCustomPage",{title:"Tweak Manager",render:tr})}}),React.createElement(B,null),React.createElement(R,{label:"Reload Discord",subLabel:"This has a chance of crashing instead of directly reloading.",leading:React.createElement(R.Icon,{source:f("ic_message_retry")}),onPress:function(){return ve.reload()}}),React.createElement(B,null),React.createElement(R,{label:i.safeMode?.enabled?"Return to Normal Mode":"Reload in Safe Mode",subLabel:`This will reload Discord ${i.safeMode?.enabled?"normally.":"without loading plugins."}`,leading:React.createElement(R.Icon,{source:f("ic_privacy_24px")}),onPress:tt}),React.createElement(B,null),React.createElement(R,{label:"Asset Browser",leading:React.createElement(R.Icon,{source:f("ic_image")}),trailing:R.Arrow,onPress:function(){return e.push("VendettaCustomPage",{title:"Asset Browser",render:Xn})}}),React.createElement(B,null)),React.createElement(lt,{title:"Info"},React.createElement(Be,{label:"Versions",icon:"ic_information_filled_24px"},t.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(Lt,{label:r.label,version:r.version,icon:r.icon}),o!==t.length-1&&React.createElement(B,null))})),React.createElement(B,null),React.createElement(Be,{label:"Platform",icon:"ic_mobile_device"},n.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(Lt,{label:r.label,version:r.version,icon:r.icon}),o!==n.length-1&&React.createElement(B,null))})),React.createElement(B,null),React.createElement(Be,{label:"Opti Stats",icon:"ic_list"},React.createElement(R,{label:"Enabled Plugins: "+Nn(),leading:React.createElement(R.Icon,{source:f("ic_download_24px")})}),React.createElement(R,{label:"Enabled Themes: "+mn(),leading:React.createElement(R.Icon,{source:f("ic_paint_brush")})}))),React.createElement(lt,{title:"Developer"},React.createElement(R,{label:"ErrorBoundary Tools",leading:React.createElement(R.Icon,{source:f("ic_warning_24px")}),trailing:R.Arrow,onPress:function(){return Pi({key:"ErrorBoundaryTools",header:{title:"Which ErrorBoundary do you want to trip?",icon:React.createElement(R.Icon,{style:{marginRight:8},source:f("ic_warning_24px")}),onClose:function(){return Ni()}},options:[{label:"Opti",onPress:function(){return e.push("VendettaCustomPage",{render:function(){return React.createElement("undefined",null)}})}},{label:"Discord",isDestructive:!0,onPress:function(){return e.push("VendettaCustomPage",{noErrorBoundary:!0})}}]})}}),React.createElement(B,null),React.createElement(Jo,{value:i.debuggerUrl,onChange:function(r){return i.debuggerUrl=r},placeholder:"127.0.0.1:9090",title:"Debugger URL"}),React.createElement(B,null),React.createElement(R,{label:"Connect to debug websocket",leading:React.createElement(R.Icon,{source:f("copy")}),onPress:function(){return _n(i.debuggerUrl)}}),window.__vendetta_rdc&&React.createElement(React.Fragment,null,React.createElement(B,null),React.createElement(R,{label:"Connect to React DevTools",leading:React.createElement(R.Icon,{source:f("ic_badge_staff")}),onPress:function(){return window.__vendetta_rdc?.connectToDevTools({host:i.debuggerUrl.split(":")?.[0],resolveRNStyle:m.StyleSheet.flatten})}})),window.__vendetta_loader?.features.loaderConfig&&React.createElement(lt,{title:"Developer"},React.createElement(Xo,{label:"Load from custom url",subLabel:"Load Vendetta from a custom endpoint.",leading:React.createElement(R.Icon,{source:f("copy")}),value:Q.customLoadUrl.enabled,onValueChange:function(r){Q.customLoadUrl.enabled=r}}),React.createElement(B,null),Q.customLoadUrl.enabled&&React.createElement(React.Fragment,null,React.createElement(Jo,{value:Q.customLoadUrl.url,onChange:function(r){return Q.customLoadUrl.url=r},placeholder:"http://localhost:4040/vendetta.js",title:"VENDETTA URL"}),React.createElement(B,null)),window.__vendetta_loader.features.devtools&&React.createElement(Xo,{label:"Load React DevTools",subLabel:`Version: ${window.__vendetta_loader.features.devtools.version}`,leading:React.createElement(R.Icon,{source:f("ic_badge_staff")}),value:Q.loadReactDevTools,onValueChange:function(r){Q.loadReactDevTools=r}}),React.createElement(B,null)))))}var R,Xo,lt,B,Jo,Ni,Pi,V,Zo=c(()=>{"use strict";g();Me();Ge();w();K();he();b();S();U();U();Go();Ko();Yo();Ge();de();W();({FormRow:R,FormSwitchRow:Xo,FormSection:lt,FormDivider:B,FormInput:Jo}=y),{hideActionSheet:Ni}=u("openLazy","hideActionSheet"),{showSimpleActionSheet:Pi}=u("showSimpleActionSheet"),V=nt()});function ut(e){let{items:t,safeModeMessage:n,safeModeExtras:r,card:o}=e;x(i),x(t);let[a,s]=React.useState("");return React.createElement(T,null,React.createElement(m.FlatList,{ListHeaderComponent:React.createElement(React.Fragment,null,i.safeMode?.enabled&&React.createElement(m.View,{style:{marginBottom:10}},React.createElement(Gn,{messageType:0},n),r),React.createElement(Ke,{style:{marginBottom:10},onChangeText:function(l){return s(l.toLowerCase())},placeholder:"Search Plugins"})),style:{paddingHorizontal:10,paddingTop:10},contentContainerStyle:{paddingBottom:20},data:Object.values(t).filter(function(l){return l.id?.toLowerCase().includes(a)}),renderItem:function(l){let{item:d,index:p}=l;return React.createElement(o,{item:d,index:p})}}))}var rr=c(()=>{"use strict";g();K();S();U()});function mt(e){let t=e.toggleValue??!1;return React.createElement(m.View,{style:[ft.card,{marginTop:e.index!==0?10:0}]},React.createElement(Ot,{style:ft.header,label:e.headerLabel,leading:e.headerIcon&&React.createElement(Ot.Icon,{source:f(e.headerIcon)}),trailing:e.toggleType&&(e.toggleType==="switch"?React.createElement(Di,{style:m.Platform.OS==="android"&&{marginVertical:-15},value:e.toggleValue,onValueChange:e.onToggleChange}):React.createElement(m.Pressable,{onPress:function(){t=!t,e.onToggleChange?.(t)}},React.createElement(Mi,{selected:e.toggleValue})))}),React.createElement(Ot,{label:e.descriptionLabel,trailing:React.createElement(m.View,{style:ft.actions},e.overflowActions&&React.createElement(m.TouchableOpacity,{onPress:function(){return ki({key:"CardOverflow",header:{title:e.overflowTitle,icon:e.headerIcon&&React.createElement(Ot.Icon,{style:{marginRight:8},source:f(e.headerIcon)}),onClose:function(){return Bi()}},options:e.overflowActions?.map(function(n){return{...n,icon:f(n.icon)}})})}},React.createElement(m.Image,{style:ft.icon,source:f("ic_more_24px")})),e.actions?.map(function(n){let{icon:r,onPress:o}=n;return React.createElement(m.TouchableOpacity,{onPress:o},React.createElement(m.Image,{style:ft.icon,source:f(r)}))}))}))}var Ot,Di,Mi,Bi,ki,ft,or=c(()=>{"use strict";g();w();b();ke();S();({FormRow:Ot,FormSwitch:Di,FormRadio:Mi}=y),{hideActionSheet:Bi}=u("openLazy","hideActionSheet"),{showSimpleActionSheet:ki}=u("showSimpleActionSheet"),ft=F.createThemedStyleSheet({card:{backgroundColor:v?.BACKGROUND_SECONDARY,borderRadius:7},header:{padding:0,backgroundColor:v?.PRIMARY_DARK_800,borderTopLeftRadius:5,borderTopRightRadius:5},actions:{flexDirection:"row-reverse",alignItems:"center"},icon:{width:22,height:22,marginLeft:5,tintColor:v?.INTERACTIVE_NORMAL}})});async function qo(e,t){e.enabled&&ze(e.id,!1),t(),e.enabled&&await $e(e.id)}function ar(e){let{item:t,index:n}=e,r=Pn(t.id),o=fe.useNavigation(),[a,s]=React.useState(!1);return a?null:React.createElement(mt,{index:n,headerLabel:`${t.manifest.name} -by ${t.manifest.authors.map(function(l){return l.name}).join(", ")}`,headerIcon:t.manifest.vendetta?.icon||"ic_application_command_24px",toggleType:"switch",toggleValue:t.enabled,onToggleChange:function(l){try{l?$e(t.id):ze(t.id)}catch(d){h(d.message,f("Small"))}},descriptionLabel:t.manifest.description,overflowTitle:t.manifest.name,overflowActions:[{label:"View Creator Profile",icon:"ic_profile_24px",onPress:function(){be.getUser(t.manifest.authors[0]?.id)?Pe.showUserProfile({userId:t.manifest.authors[0]?.id}):Qe.fetchProfile(t.manifest.authors[0]?.id).then(function(){Pe.showUserProfile({userId:t.manifest.authors[0]?.id})})}},{icon:"RetryIcon",label:"Refetch",onPress:async function(){qo(t,function(){je(t.id).then(async function(){h("Successfully refetched plugin.",f("toast_image_saved"))}).catch(function(){h("Failed to refetch plugin!",f("Small"))})})}},{icon:"copy",label:"Copy URL",onPress:function(){j.setString(t.id),h("Copied plugin URL to clipboard.",f("toast_copy_link"))}},{icon:"ic_download_24px",label:t.update?"Disable updates":"Enable updates",onPress:function(){t.update=!t.update,h(`${t.update?"Enabled":"Disabled"} updates for ${t.manifest.name}.`,f("toast_image_saved"))}},{icon:"ic_duplicate",label:"Clear data",isDestructive:!0,onPress:function(){return ee({title:"Wait!",content:`Are you sure you wish to clear the data of ${t.manifest.name}?`,confirmText:"Clear",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){qo(t,function(){try{ge.removeItem(t.id),h(`Cleared data for ${t.manifest.name}.`,f("trash"))}catch{h(`Failed to clear data for ${t.manifest.name}!`,f("Small"))}})}})}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return ee({title:"Wait!",content:`Are you sure you wish to delete ${t.manifest.name}? This will clear all of the plugin's data.`,confirmText:"Delete",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){try{An(t.id),s(!0)}catch(l){h(l.message,f("Small"))}}})}}],actions:[...r?[{icon:"settings",onPress:function(){return o.push("VendettaCustomPage",{title:t.manifest.name,render:r})}}]:[]]})}var Qo=c(()=>{"use strict";He();g();de();he();b();oe();Le();or()});function ir(){return x(i),React.createElement(ut,{items:M,safeModeMessage:"Safe Mode prevents plugins from being loaded. To exit Safe Mode go to the 'Opti' tab and go back to Normal Mode.",card:ar})}var ea=c(()=>{"use strict";K();de();U();rr();Qo()});async function ta(e,t){await Ce(e?t:"default"),ve.reload()}function sr(e){let{item:t,index:n}=e;x(i);let[r,o]=React.useState(!1);if(r)return null;let a=t.data.authors;return React.createElement(mt,{index:n,headerLabel:`${t.data.name} ${a?` -by ${a.map(function(s){return s.name}).join(", ")}`:""}`,headerIcon:"ic_theme_24px",descriptionLabel:t.data.description??"No description.",toggleType:i.safeMode?.enabled?void 0:"switch",toggleValue:t.selected,onToggleChange:function(s){ta(s,t.id)},overflowTitle:t.data.name,overflowActions:[{label:"View Creator Profile",icon:"ic_profile_24px",onPress:function(){be.getUser(t.data.authors[0]?.id)?Pe.showUserProfile({userId:t.data.authors[0]?.id}):Qe.fetchProfile(t.data.authors[0]?.id).then(function(){Pe.showUserProfile({userId:t.data.authors[0]?.id})})}},{icon:"ic_sync_24px",label:"Refetch",onPress:function(){qe(t.id,t.selected).then(function(){t.selected?ee({title:"Theme refetched",content:"A reload is required to see the changes. Do you want to reload now?",confirmText:"Reload",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){return ve.reload()}}):h("Successfully refetched theme.",f("toast_image_saved"))}).catch(function(){h("Failed to refetch theme!",f("Small"))})}},{icon:"copy",label:"Copy URL",onPress:function(){j.setString(t.id),h("Copied theme URL to clipboard.",f("toast_copy_link"))}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return ee({title:"Wait!",content:`Are you sure you wish to delete ${t.data.name}?`,confirmText:"Delete",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){un(t.id).then(function(s){o(!0),s&&ta(!1,t.id)}).catch(function(s){h(s.message,f("Small"))})}})}}]})}var na=c(()=>{"use strict";He();g();W();K();he();b();Le();oe();U();or()});function cr(){return x(i),React.createElement(ut,{items:O,safeModeMessage:`You are in Safe Mode, meaning themes have been temporarily disabled.${i.safeMode?.currentThemeId?" If a theme appears to be causing the issue, you can press below to disable it.":""}`,safeModeExtras:i.safeMode?.currentThemeId?React.createElement(_,{text:"Disable Theme",color:$.BRAND,size:"small",onPress:function(){delete i.safeMode?.currentThemeId},style:{marginTop:8}}):void 0,card:sr})}var ra=c(()=>{"use strict";He();K();W();S();U();rr();na()});var Li,am,im,sm,cm,Oi,Ft,Ut,Ye,dt,oa,lr,Vt=c(()=>{"use strict";g();de();W();Le();ke();oe();ie();b();U();Fn();Uo();Zo();ea();ra();Me();S();({FormRow:Li,FormSwitchRow:am,FormSection:im,FormDivider:sm,FormInput:cm}=y),Oi=F.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_MOBILE_PRIMARY}}),Ft=function(e,t){return t?bt.snakeCase(e).toUpperCase():e},Ut=function(e,t){return Object.fromEntries(e.map(function(n){return[n.key,typeof t=="function"?t(n):typeof t=="string"?n[t]:t]}))},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return[{key:Ft("VendettaSettings",e),title:"Opti",leading:React.createElement(Li.Icon,{source:{uri:"https://raw.githubusercontent.com/Opti-mod/assets/main/Opti%202.png"}}),render:nr},{key:Ft("VendettaPlugins",e),title:"Plugins",icon:"ic_behavior_24px",options:{headerRight:function(){return React.createElement(Tt,{alertTitle:"Install Plugin",installFunction:async function(t){if(!t.startsWith(De))setImmediate(function(){return ee({title:"Unproxied Plugin",content:"The plugin you are trying to install has not been proxied. Want to download it anyways?",confirmText:"Install",onConfirm:function(){return xe(t).then(function(){return h("Installed plugin",f("Check"))}).catch(function(n){return h(n?.message??`${n}`,f("Small"))})},cancelText:"Cancel"})});else return await xe(t)}})}},render:ir},{key:Ft("VendettaThemes",e),title:"Shaders",icon:"ic_theme_24px",shouldRender:function(){return window.__vendetta_loader?.features.hasOwnProperty("themes")??!0},options:{headerRight:function(){return!i.safeMode?.enabled&&React.createElement(Tt,{alertTitle:"Install Theme",installFunction:Ae})}},render:cr},{key:Ft("VendettaCustomPage",e),title:"Opti Page",shouldRender:function(){return!1},render:function(t){let{render:n,noErrorBoundary:r,...o}=t,a=fe.useNavigation();return a.addListener("focus",function(){return a.setOptions(J(o,"render","noErrorBoundary"))}),r?React.createElement(n,null):React.createElement(T,null,React.createElement(n,null))}}]},dt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Ye(e).filter(function(t){return t.shouldRender?.()??!0})},oa=function(){return Ut(Ye(),function(e){return{title:e.title,render:e.render,...e.options}})},lr=function(){let e=Ye(!0);return{getLayout:function(){return{title:"Opti",label:"Opti",settings:dt(!0).map(function(t){return t.key})}},titleConfig:Ut(e,"title"),relationships:Ut(e,null),rendererConfigs:Ut(e,function(t){let n=React.memo(function(r){let{navigation:o,route:a}=r;return o.addListener("focus",function(){return o.setOptions(t.options)}),React.createElement(m.View,{style:Oi.container},React.createElement(t.render,a.params))});return{type:"route",title:function(){return t.title},icon:t.icon?f(t.icon):null,screen:{route:bt.chain(t.key).camelCase().upperFirst().value(),getComponent:function(){return n}}}})}}});function fr(){let e=fe.useNavigation();x(i);let t=dt();return React.createElement(T,null,React.createElement(Fi,{key:"Vendetta",title:`Opti ${i.safeMode?.enabled?" (Safe Mode)":""}`},t.map(function(n,r){return React.createElement(React.Fragment,null,React.createElement(ur,{label:n.title,leading:React.createElement(ur.Icon,{source:f(n.icon)}),trailing:ur.Arrow,onPress:function(){return e.push(n.key)}}),r!==t.length-1&&React.createElement(Ui,null))})))}var ur,Fi,Ui,aa=c(()=>{"use strict";g();K();b();Vt();S();U();({FormRow:ur,FormSection:Fi,FormDivider:Ui}=y)});function mr(){let e=new Array;return e.push(E("default",Vi,function(t,n){return{...n,...oa()}})),E("default",Gi,function(t,n){let r=z(n.props.children,function(o){return o.type&&o.type.name==="UserSettingsOverview"});e.push(E("renderSupportAndAcknowledgements",r.type.prototype,function(o,a){let{props:{children:s}}=a,l=s.findIndex(function(d){return d?.type?.name==="UploadLogsButton"});l!==-1&&s.splice(l,1)})),e.push(E("render",r.type.prototype,function(o,a){let{props:{children:s}}=a,l=[ue.Messages.BILLING_SETTINGS,ue.Messages.PREMIUM_SETTINGS];s=z(s,function(p){return p.children?.[1].type?.name==="FormSection"}).children;let d=s.findIndex(function(p){return l.includes(p?.props.label)});s.splice(d===-1?4:d,0,React.createElement(fr,null))}))},!0),function(){return e.forEach(function(t){return t()})}}var Vi,Gi,ia=c(()=>{"use strict";g();w();P();ie();Vt();aa();Vi=N("getScreens",!1),Gi=N("UserSettingsOverviewWrapper",!1)});function pr(){let e=new Array;return ji(e)||Hi(e),function(){return e.forEach(function(t){return t?.()})}}function Hi(e){let t=u("useOverviewSettings"),n=u("getSettingTitleConfig"),r=u("SETTING_RELATIONSHIPS","SETTING_RENDERER_CONFIGS"),o="getSettingSearchListItems",a="getSettingListItems",s=u(o),l=!s,d=l?a:o,p=s??u(a);if(!p||!t)return;let k=Ye(!0),L=dt(!0),I=lr();e.push(E("useOverviewSettings",t,function(Te,Xe){return sa(Xe,I.getLayout())})),e.push(E("getSettingTitleConfig",n,function(Te,Xe){return{...Xe,...I.titleConfig}})),e.push(E(d,p,function(Te,Xe){let[_a]=Te;return[...L.filter(function(ne){return _a.includes(ne.key)}).map(function(ne){return{type:"setting_search_result",ancestorRendererData:I.rendererConfigs[ne.key],setting:ne.key,title:I.titleConfig[ne.key],breadcrumbs:["Vendetta"],icon:I.rendererConfigs[ne.key].icon}}),...Xe.filter(function(ne){return l||!k.map(function(Gt){return Gt.key}).includes(ne.setting)})].map(function(ne,Gt,xa){return{...ne,index:Gt,total:xa.length}})}));let G=r.SETTING_RELATIONSHIPS,H=r.SETTING_RENDERER_CONFIGS;return r.SETTING_RELATIONSHIPS={...G,...I.relationships},r.SETTING_RENDERER_CONFIGS={...H,...I.rendererConfigs},e.push(function(){r.SETTING_RELATIONSHIPS=G,r.SETTING_RENDERER_CONFIGS=H}),!0}function ji(e){let t=u("SearchableSettingsList"),n=u("SETTING_RENDERER_CONFIG"),r=u("getSettingListItems");if(!r||!t||!n)return!1;let o=Ye(!0),a=lr();e.push(Zt("type",t.SearchableSettingsList,function(l){let[{sections:d}]=l;return sa(d,a.getLayout())})),e.push(E("getSettingListSearchResultItems",r,function(l,d){d.forEach(function(p){return o.some(function(k){return k.key===p.setting})&&(p.breadcrumbs=["Vendetta"])})}));let s=n.SETTING_RENDERER_CONFIG;return n.SETTING_RENDERER_CONFIG={...s,...a.rendererConfigs},e.push(function(){n.SETTING_RENDERER_CONFIG=s}),!0}function sa(e,t){if(!Array.isArray(e)||e.find(function(o){return dr(o,"Vendetta")}))return;let n=e.findIndex(function(o){return dr(o,ue.Messages.ACCOUNT_SETTINGS)});e.splice(n+1,0,t);let r=e.find(function(o){return dr(o,ue.Messages.SUPPORT)});r&&(r.settings=r.settings.filter(function(o){return o!=="UPLOAD_DEBUG_LOGS"}))}var dr,ca=c(()=>{"use strict";w();P();Vt();g();dr=function(e,t){return e?.label===t||e?.title===t}});function gr(){let e=[mr(),pr()];return function(){return e.forEach(function(t){return t?.()})}}var la=c(()=>{"use strict";ia();ca()});function ma(e){let{locale:t}=e;try{ua&&(ua.overrideTheme($i?.theme??"dark"),fa&&zi.useAMOLEDTheme===2&&fa.setAMOLEDThemeEnabled(!0))}catch(n){D.error("Failed to fix theme...",n)}try{Rn.locale(t.toLowerCase())}catch(n){D.error("Failed to fix timestamps...",n)}wt.unsubscribe("I18N_LOAD_SUCCESS",ma)}function da(){return wt.subscribe("I18N_LOAD_SUCCESS",ma)}var ua,fa,$i,zi,pa=c(()=>{"use strict";g();w();Ie();ua=u("updateTheme","overrideTheme"),fa=u("setAMOLEDThemeEnabled"),$i=Re("ThemeStore"),zi=Re("UnsyncedUserSettingsStore")});var ga=c(()=>{"use strict"});async function ha(e){return{patcher:J(Pr,"unpatchAll"),metro:{...$t,common:{...En}},constants:On,utils:Wt,debug:J(Sn,"versionHash","patchLogHook","toggleSafeMode"),ui:{components:jn,toasts:bn,alerts:Kn,assets:wn,...Un},plugins:J(Dn,"initPlugins","evalPlugin"),themes:J(dn,"initThemes"),commands:J(vn,"patchCommands"),storage:an,settings:i,loader:{identity:window.__vendetta_loader,config:Q},logger:D,version:_t,unload:function(){e.filter(function(t){return typeof t=="function"}).forEach(function(t){return t()}),delete window.vendetta}}}var Ra=c(()=>{"use strict";P();Ie();U();Me();Ge();de();W();In();K();w();g();S();oe();Le();b();ke();ie()});function Ea(){i.tweaks??={},console.log("TweakManager has initialized."),i.tweaks.trustURL==null&&(i.tweaks.trustURL=!1),i.tweaks.hideButtons==null&&(i.tweaks.hideButtons=!1),i.tweaks.silentTyping==null&&(i.tweaks.silentTyping=!1),i.tweaks.experiments==null&&(i.tweaks.experiments=!1),i.tweaks.fastdelete==null&&(i.tweaks.fastdelete=!1),(i.tweaks.trustURL?Nt:Pt)(),(i.tweaks.hideButtons?At:Ct)(),(i.tweaks.silentTyping?vt:It)(),(i.tweaks.experiments?Dt:Mt)(),(i.tweaks.fastdelete?Bt:kt)()}var ya=c(()=>{"use strict";U();Jn();Zn();qn();Qn();er()});var wa={};A(wa,{default:()=>Ki});async function Ki(){let e=await Promise.all([xn(),yn(),Tn(),ln(),da(),Oo(),gr(),Wn(),void 0]);window.vendetta=await ha(e),e.push(await Cn()),e.push(await Ea()),D.log("Opti is ready!")}var ba=c(()=>{"use strict";Ge();In();de();W();b();Bo();Fo();la();pa();ga();Ie();Ra();ya()});he();console.log("Opti has loaded!");Object.freeze=Object;Object.seal=Object;Promise.resolve().then(()=>(ba(),wa)).then(function(e){return e.default()}).catch(function(e){console.log(e?.stack??e.toString()),alert([`Opti failed to initialize and plugins will not be loaded. -`,`Build Number: ${Je.Build}`,"Opti Version: fd7b652",e?.stack||e.toString()].join(` +`):a)),React.createElement(m.View,{style:ct.footer},s.map(function(l){let d=s.indexOf(l)!==0?8:0;return React.createElement(_,{text:l.text,color:l.color??$.BRAND,size:l.size??"small",onPress:l.onPress,style:ae.isTablet?{flex:`0.${s.length}`,marginLeft:d}:{marginTop:d}})}))))})}var yi,wi,ko,ct,Lo,Fo=c(()=>{"use strict";He();g();w();P();Ge();he();ke();S();U();yi=N("ErrorBoundary"),{BadgableTabBar:wi}=u("BadgableTabBar"),{TextStyleSheet:ko}=u("TextStyleSheet"),ct=F.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_PRIMARY,paddingHorizontal:16},header:{flex:1,flexDirection:"row",justifyContent:"center",alignItems:"center",marginVertical:8},headerTitle:{...ko["heading-md/semibold"],textAlign:"center",textTransform:"uppercase",color:v.HEADER_PRIMARY},headerDescription:{...ko["text-sm/medium"],textAlign:"center",color:v.TEXT_MUTED},footer:{flexDirection:ae.isTablet?"row":"column",justifyContent:"flex-end",marginVertical:8}}),Lo=[{id:"message",title:"Message"},{id:"stack",title:"Stack Trace"},{id:"componentStack",title:"Component",trimWhitespace:!0}]});function St(e){let{alertTitle:t,installFunction:n}=e;return React.createElement(m.TouchableOpacity,{onPress:function(){return j.getString().then(function(r){return zn({title:t,initialValue:r.match(it)?.[0]??"",placeholder:"https://example.com/",onConfirm:function(o){return n(o)},confirmText:"Install",cancelText:"Cancel"})})}},React.createElement(m.Image,{style:bi.icon,source:f("ic_add_24px")}))}var bi,Uo=c(()=>{"use strict";g();Me();Le();b();ke();bi=F.createThemedStyleSheet({icon:{marginRight:10,tintColor:v.HEADER_PRIMARY}})});function Yn(e){let{asset:t}=e;return React.createElement(_i,{label:`${t.name} - ${t.id}`,trailing:React.createElement(m.Image,{source:t.id,style:{width:32,height:32}}),onPress:function(){j.setString(t.name),h("Copied asset name to clipboard.",f("toast_copy_link"))}})}var _i,Vo=c(()=>{"use strict";g();oe();b();S();({FormRow:_i}=y)});function Xn(){let[e,t]=React.useState("");return React.createElement(T,null,React.createElement(m.View,{style:{flex:1}},React.createElement(Ke,{style:{margin:10},onChangeText:function(n){return t(n)},placeholder:"Search"}),React.createElement(m.FlatList,{data:Object.values(me).filter(function(n){return n.name.includes(e)||n.id.toString()===e}),renderItem:function(n){let{item:r}=n;return React.createElement(Yn,{asset:r})},ItemSeparatorComponent:xi,keyExtractor:function(n){return n.name}})))}var xi,Go=c(()=>{"use strict";g();b();S();Vo();({FormDivider:xi}=y)});function Tt(){console.log("TweakManager has loaded SilentTyping."),Ho=["startTyping","stopTyping"].map(function(e){return Z(e,Si,function(){})})}function vt(){console.log("TweakManager has unloaded SilentTyping."),Ho.forEach(function(e){return e()})}var Si,Ho,Jn=c(()=>{"use strict";P();w();Si=u("startTyping"),Ho=[]});function It(){console.log("TweakManager has loaded HideUnneccesaryButtons.");let e=["ic_thread_normal_24px","ic_gift","AppsIcon"].map(function(t){return f(t)});jo=E("render",Ti.prototype,function(t,n){let r=z(n,function(a){return a.props?.canSendVoiceMessage});r&&(r.props.canSendVoiceMessage=!1);let o=z(n,function(a){return"forceAnimateButtons"in a.props&&a.props.actions});o.props.actions=o.props.actions.filter(function(a){return!e.includes(a.source)})})}function At(){console.log("TweakManager has unloaded HideUnneccesaryButtons.")}var Ti,jo,Zn=c(()=>{"use strict";P();w();b();ie();Ti=N("ChatInput")});function Ct(){console.log("TweakManager has loaded TrustURLs."),$o.push(E("isTrustedDomain",vi,function(){return!0}))}function Nt(){console.log("TweakManager has unloaded TrustURLs.");for(let e of $o)e()}var vi,$o,qn=c(()=>{"use strict";P();w();vi=Re("MaskedLinkStore"),$o=[]});function Pt(){console.log("TweakManager has loaded EnableExperiments.");try{be.getCurrentUser().flags|=1,be._dispatcher._actionHandlers._computeOrderedActionHandlers("OVERLAY_INITIALIZE").forEach(function(e){e.name.includes("Experiment")&&e.actionHandler({serializedExperimentStore:Ai.getSerializedState(),user:{flags:1}})})}catch{let t=new Error;console.error(t.stack)}}function Dt(){console.log("TweakManager has unloaded EnableExperiments."),Ii.unsubscribe("CONNECTION_OPEN")}var Ii,Ai,Qn=c(()=>{"use strict";w();g();Ii=u("_currentDispatchActionType"),Ai=u("getSerializedState")});function Mt(){console.log("TweakManager has loaded RemoveDeletePrompts.");let e=u("show","openLazy");zo=Z("show",e,function(t,n){t?.[0]?.title===ue.Messages.DELETE_MESSAGE?t[0].onConfirm?.():n(...t)})}function Bt(){console.log("TweakManager has unloaded RemoveDeletePrompt.")}var zo,er=c(()=>{"use strict";P();w();g()});function tr(){let[e,t]=React.useState("");return x(i),i.tweaks??={},React.createElement(T,null,React.createElement(m.View,{style:{flex:1}},React.createElement(ee,{label:"Tweaks",subLabel:`Right now most tweaks are ported Vendetta plugins, when Opti rewrites, this will change. + Want yours removed? Contact me I'll remove it ASAP.`,onPress:function(){console.log("hi")}}),React.createElement(We,null),React.createElement(ee,{label:i.tweaks.silentTyping?.valueOf()?"Silent Typing (Enabled)":"Silent Typing (Disabled)",subLabel:"Hides that you are typing to other people.",leading:React.createElement(ee.Icon,{source:f("bell")}),onPress:function(){i.tweaks.silentTyping??=!1,i.tweaks.silentTyping=!i.tweaks.silentTyping,(i.tweaks.silentTyping?Tt:vt)()}}),React.createElement(We,null),React.createElement(ee,{label:i.tweaks.hideButtons?.valueOf()?"Remove Chat Buttons (Enabled)":"Remove Chat Buttons (Disabled)",subLabel:"Removes the Gift, Voice Message, and Activities buton.",leading:React.createElement(ee.Icon,{source:f("ic_trash_24px")}),onPress:function(){i.tweaks.hideButtons??=!1,i.tweaks.hideButtons=!i.tweaks.hideButtons,(i.tweaks.hideButtons?It:At)()}}),React.createElement(We,null),React.createElement(ee,{label:i.tweaks.trustURL?.valueOf()?"Trust All URLs (Enabled)":"Trust All URLs (Disabled)",subLabel:'Removes the "Trust This URL?" prompt.',leading:React.createElement(ee.Icon,{source:f("unlocked")}),onPress:function(){i.tweaks.trustURL??=!1,i.tweaks.trustURL=!i.tweaks.trustURL,(i.tweaks.trustURL?Ct:Nt)()}}),React.createElement(We,null),React.createElement(ee,{label:i.tweaks.experiments?.valueOf()?"Staff Mode (Enabled)":"Staff Mode (Disabled)",subLabel:`Enables Discord Experiments + Port of EnableStaging made by acquitelol`,leading:React.createElement(ee.Icon,{source:f("debug")}),onPress:function(){i.tweaks.experiments??=!0,i.tweaks.experiments=!i.tweaks.experiments,(i.tweaks.experiments?Pt:Dt)()}}),React.createElement(We,null),React.createElement(ee,{label:i.tweaks.fastdelete?.valueOf()?"Message Delete Prompt (Enabled)":"Message Delete Prompt (Disabled)",subLabel:"Delete messages without the warning prompt.",leading:React.createElement(ee.Icon,{source:f("ic_message_delete")}),onPress:function(){i.tweaks.fastdelete??=!0,i.tweaks.fastdelete=!i.tweaks.fastdelete,(i.tweaks.fastdelete?Mt:Bt)()}}),React.createElement(We,null)))}var We,ee,Ko=c(()=>{"use strict";g();S();b();Jn();Zn();qn();U();K();Qn();er();({FormDivider:We,FormRow:ee}=y)});function kt(e){let{label:t,version:n,icon:r}=e;return React.createElement(Wo,{label:t,leading:React.createElement(Wo.Icon,{source:f(r)}),trailing:React.createElement(Ci,null,n),onPress:function(){j.setString(`${t} - ${n}`),h("Copied version to clipboard.",f("toast_copy_link"))}})}var Wo,Ci,Yo=c(()=>{"use strict";g();b();oe();S();({FormRow:Wo,FormText:Ci}=y)});function nr(){let e=fe.useNavigation();x(i),x(q);let t=[{label:"Discord Version",version:`${V.discord.version} (${V.discord.build})`,icon:"Discord"},{label:"React",version:V.react.version,icon:"ic_category_16px"},{label:"React Native",version:V.react.nativeVersion,icon:"mobile"},{label:"Bytecode",version:V.hermes.bytecodeVersion,icon:"ic_server_security_24px"}],n=[{label:"Loader",version:V.vendetta.loader,icon:"ic_download_24px"},{label:"OS",version:`${V.os.name} ${V.os.version}`,icon:"ic_cog_24px"},...V.os.sdk?[{label:"SDK",version:V.os.sdk,icon:"ic_profile_badge_verified_developer_color"}]:[],{label:"Manufacturer",version:V.device.manufacturer,icon:"ic_badge_staff"},{label:"Brand",version:V.device.brand,icon:"ic_settings_boost_24px"},{label:"Model",version:V.device.model,icon:"ic_phonelink_24px"},{label:m.Platform.select({android:"Codename",ios:"Machine ID"}),version:V.device.codename,icon:"ic_compose_24px"}];return React.createElement(T,null,React.createElement(m.ScrollView,{style:{flex:1},contentContainerStyle:{paddingBottom:38}},React.createElement(lt,{title:"Important",titleStyleType:"no_border"},React.createElement(R,{label:"Opti Version - "+V.vendetta.version,leading:React.createElement(R.Icon,{source:f("boost")})}),React.createElement(B,null),React.createElement(R,{label:"Discord Server",leading:React.createElement(R.Icon,{source:f("Discord")}),trailing:R.Arrow,onPress:function(){return Ve.openDeeplink(Dn)}}),React.createElement(B,null),React.createElement(R,{label:"GitHub Repository",leading:React.createElement(R.Icon,{source:f("img_account_sync_github_white")}),trailing:R.Arrow,onPress:function(){return Ve.openURL(kn)}})),React.createElement(lt,{title:"Actions"},React.createElement(R,{label:"Tweak Manager",subLabel:"Manage Opti's built in tweaks.",leading:React.createElement(R.Icon,{source:{uri:"https://raw.githubusercontent.com/Opti-mod/assets/main/Opti%202.png"}}),onPress:function(){return e.push("VendettaCustomPage",{title:"Tweak Manager",render:tr})}}),React.createElement(B,null),React.createElement(R,{label:"Reload Discord",subLabel:"This has a chance of crashing instead of directly reloading.",leading:React.createElement(R.Icon,{source:f("ic_message_retry")}),onPress:function(){return ve.reload()}}),React.createElement(B,null),React.createElement(R,{label:i.safeMode?.enabled?"Return to Normal Mode":"Reload in Safe Mode",subLabel:`This will reload Discord ${i.safeMode?.enabled?"normally.":"without loading plugins."}`,leading:React.createElement(R.Icon,{source:f("ic_privacy_24px")}),onPress:tt}),React.createElement(B,null),React.createElement(R,{label:"Asset Browser",leading:React.createElement(R.Icon,{source:f("ic_image")}),trailing:R.Arrow,onPress:function(){return e.push("VendettaCustomPage",{title:"Asset Browser",render:Xn})}}),React.createElement(B,null)),React.createElement(lt,{title:"Info"},React.createElement(Be,{label:"Versions",icon:"ic_information_filled_24px"},t.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(kt,{label:r.label,version:r.version,icon:r.icon}),o!==t.length-1&&React.createElement(B,null))})),React.createElement(B,null),React.createElement(Be,{label:"Platform",icon:"ic_mobile_device"},n.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(kt,{label:r.label,version:r.version,icon:r.icon}),o!==n.length-1&&React.createElement(B,null))})),React.createElement(B,null),React.createElement(Be,{label:"Opti Stats",icon:"ic_list"},React.createElement(R,{label:"Enabled Plugins: "+Cn(),leading:React.createElement(R.Icon,{source:f("ic_download_24px")})}),React.createElement(R,{label:"Enabled Themes: "+fn(),leading:React.createElement(R.Icon,{source:f("ic_paint_brush")})}))),React.createElement(lt,{title:"Developer"},React.createElement(R,{label:"ErrorBoundary Tools",leading:React.createElement(R.Icon,{source:f("ic_warning_24px")}),trailing:R.Arrow,onPress:function(){return Pi({key:"ErrorBoundaryTools",header:{title:"Which ErrorBoundary do you want to trip?",icon:React.createElement(R.Icon,{style:{marginRight:8},source:f("ic_warning_24px")}),onClose:function(){return Ni()}},options:[{label:"Opti",onPress:function(){return e.push("VendettaCustomPage",{render:function(){return React.createElement("undefined",null)}})}},{label:"Discord",isDestructive:!0,onPress:function(){return e.push("VendettaCustomPage",{noErrorBoundary:!0})}}]})}}),React.createElement(B,null),React.createElement(Jo,{value:i.debuggerUrl,onChange:function(r){return i.debuggerUrl=r},placeholder:"127.0.0.1:9090",title:"Debugger URL"}),React.createElement(B,null),React.createElement(R,{label:"Connect to debug websocket",leading:React.createElement(R.Icon,{source:f("copy")}),onPress:function(){return bn(i.debuggerUrl)}}),window.__vendetta_rdc&&React.createElement(React.Fragment,null,React.createElement(B,null),React.createElement(R,{label:"Connect to React DevTools",leading:React.createElement(R.Icon,{source:f("ic_badge_staff")}),onPress:function(){return window.__vendetta_rdc?.connectToDevTools({host:i.debuggerUrl.split(":")?.[0],resolveRNStyle:m.StyleSheet.flatten})}})),window.__vendetta_loader?.features.loaderConfig&&React.createElement(lt,{title:"Developer"},React.createElement(Xo,{label:"Load from custom url",subLabel:"Load Vendetta from a custom endpoint.",leading:React.createElement(R.Icon,{source:f("copy")}),value:q.customLoadUrl.enabled,onValueChange:function(r){q.customLoadUrl.enabled=r}}),React.createElement(B,null),q.customLoadUrl.enabled&&React.createElement(React.Fragment,null,React.createElement(Jo,{value:q.customLoadUrl.url,onChange:function(r){return q.customLoadUrl.url=r},placeholder:"http://localhost:4040/vendetta.js",title:"VENDETTA URL"}),React.createElement(B,null)),window.__vendetta_loader.features.devtools&&React.createElement(Xo,{label:"Load React DevTools",subLabel:`Version: ${window.__vendetta_loader.features.devtools.version}`,leading:React.createElement(R.Icon,{source:f("ic_badge_staff")}),value:q.loadReactDevTools,onValueChange:function(r){q.loadReactDevTools=r}}),React.createElement(B,null)))))}var R,Xo,lt,B,Jo,Ni,Pi,V,Zo=c(()=>{"use strict";g();Me();Ge();w();K();he();b();S();U();U();Go();Ko();Yo();Ge();de();W();({FormRow:R,FormSwitchRow:Xo,FormSection:lt,FormDivider:B,FormInput:Jo}=y),{hideActionSheet:Ni}=u("openLazy","hideActionSheet"),{showSimpleActionSheet:Pi}=u("showSimpleActionSheet"),V=nt()});function ut(e){let{items:t,safeModeMessage:n,safeModeExtras:r,card:o}=e;x(i),x(t);let[a,s]=React.useState("");return React.createElement(T,null,React.createElement(m.FlatList,{ListHeaderComponent:React.createElement(React.Fragment,null,i.safeMode?.enabled&&React.createElement(m.View,{style:{marginBottom:10}},React.createElement(Gn,{messageType:0},n),r),React.createElement(Ke,{style:{marginBottom:10},onChangeText:function(l){return s(l.toLowerCase())},placeholder:"Search Plugins"})),style:{paddingHorizontal:10,paddingTop:10},contentContainerStyle:{paddingBottom:20},data:Object.values(t).filter(function(l){return l.id?.toLowerCase().includes(a)}),renderItem:function(l){let{item:d,index:p}=l;return React.createElement(o,{item:d,index:p})}}))}var rr=c(()=>{"use strict";g();K();S();U()});function mt(e){let t=e.toggleValue??!1;return React.createElement(m.View,{style:[ft.card,{marginTop:e.index!==0?10:0}]},React.createElement(Lt,{style:ft.header,label:e.headerLabel,leading:e.headerIcon&&React.createElement(Lt.Icon,{source:f(e.headerIcon)}),trailing:e.toggleType&&(e.toggleType==="switch"?React.createElement(Di,{style:m.Platform.OS==="android"&&{marginVertical:-15},value:e.toggleValue,onValueChange:e.onToggleChange}):React.createElement(m.Pressable,{onPress:function(){t=!t,e.onToggleChange?.(t)}},React.createElement(Mi,{selected:e.toggleValue})))}),React.createElement(Lt,{label:e.descriptionLabel,trailing:React.createElement(m.View,{style:ft.actions},e.overflowActions&&React.createElement(m.TouchableOpacity,{onPress:function(){return ki({key:"CardOverflow",header:{title:e.overflowTitle,icon:e.headerIcon&&React.createElement(Lt.Icon,{style:{marginRight:8},source:f(e.headerIcon)}),onClose:function(){return Bi()}},options:e.overflowActions?.map(function(n){return{...n,icon:f(n.icon)}})})}},React.createElement(m.Image,{style:ft.icon,source:f("ic_more_24px")})),e.actions?.map(function(n){let{icon:r,onPress:o}=n;return React.createElement(m.TouchableOpacity,{onPress:o},React.createElement(m.Image,{style:ft.icon,source:f(r)}))}))}))}var Lt,Di,Mi,Bi,ki,ft,or=c(()=>{"use strict";g();w();b();ke();S();({FormRow:Lt,FormSwitch:Di,FormRadio:Mi}=y),{hideActionSheet:Bi}=u("openLazy","hideActionSheet"),{showSimpleActionSheet:ki}=u("showSimpleActionSheet"),ft=F.createThemedStyleSheet({card:{backgroundColor:v?.BACKGROUND_SECONDARY,borderRadius:7},header:{padding:0,backgroundColor:v?.PRIMARY_DARK_800,borderTopLeftRadius:5,borderTopRightRadius:5},actions:{flexDirection:"row-reverse",alignItems:"center"},icon:{width:22,height:22,marginLeft:5,tintColor:v?.INTERACTIVE_NORMAL}})});async function qo(e,t){e.enabled&&ze(e.id,!1),t(),e.enabled&&await $e(e.id)}function ar(e){let{item:t,index:n}=e,r=Nn(t.id),o=fe.useNavigation(),[a,s]=React.useState(!1);return a?null:React.createElement(mt,{index:n,headerLabel:`${t.manifest.name} +by ${t.manifest.authors.map(function(l){return l.name}).join(", ")}`,headerIcon:t.manifest.vendetta?.icon||"ic_application_command_24px",toggleType:"switch",toggleValue:t.enabled,onToggleChange:function(l){try{l?$e(t.id):ze(t.id)}catch(d){h(d.message,f("Small"))}},descriptionLabel:t.manifest.description,overflowTitle:t.manifest.name,overflowActions:[{label:"View Creator Profile",icon:"ic_profile_24px",onPress:function(){be.getUser(t.manifest.authors[0]?.id)?Pe.showUserProfile({userId:t.manifest.authors[0]?.id}):Qe.fetchProfile(t.manifest.authors[0]?.id).then(function(){Pe.showUserProfile({userId:t.manifest.authors[0]?.id})})}},{icon:"RetryIcon",label:"Refetch",onPress:async function(){qo(t,function(){je(t.id).then(async function(){h("Successfully refetched plugin.",f("toast_image_saved"))}).catch(function(){h("Failed to refetch plugin!",f("Small"))})})}},{icon:"copy",label:"Copy URL",onPress:function(){j.setString(t.id),h("Copied plugin URL to clipboard.",f("toast_copy_link"))}},{icon:"ic_download_24px",label:t.update?"Disable updates":"Enable updates",onPress:function(){t.update=!t.update,h(`${t.update?"Enabled":"Disabled"} updates for ${t.manifest.name}.`,f("toast_image_saved"))}},{icon:"ic_duplicate",label:"Clear data",isDestructive:!0,onPress:function(){return Q({title:"Wait!",content:`Are you sure you wish to clear the data of ${t.manifest.name}?`,confirmText:"Clear",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){qo(t,function(){try{ge.removeItem(t.id),h(`Cleared data for ${t.manifest.name}.`,f("trash"))}catch{h(`Failed to clear data for ${t.manifest.name}!`,f("Small"))}})}})}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return Q({title:"Wait!",content:`Are you sure you wish to delete ${t.manifest.name}? This will clear all of the plugin's data.`,confirmText:"Delete",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){try{In(t.id),s(!0)}catch(l){h(l.message,f("Small"))}}})}}],actions:[...r?[{icon:"settings",onPress:function(){return o.push("VendettaCustomPage",{title:t.manifest.name,render:r})}}]:[]]})}var Qo=c(()=>{"use strict";He();g();de();he();b();oe();Le();or()});function ir(){return x(i),React.createElement(ut,{items:M,safeModeMessage:"Safe Mode prevents plugins from being loaded. To exit Safe Mode go to the 'Opti' tab and go back to Normal Mode.",card:ar})}var ea=c(()=>{"use strict";K();de();U();rr();Qo()});async function ta(e,t){await Ce(e?t:"default"),ve.reload()}function sr(e){let{item:t,index:n}=e;x(i);let[r,o]=React.useState(!1);if(r)return null;let a=t.data.authors;return React.createElement(mt,{index:n,headerLabel:`${t.data.name} ${a?` +by ${a.map(function(s){return s.name}).join(", ")}`:""}`,headerIcon:"ic_theme_24px",descriptionLabel:t.data.description??"No description.",toggleType:i.safeMode?.enabled?void 0:"switch",toggleValue:t.selected,onToggleChange:function(s){ta(s,t.id)},overflowTitle:t.data.name,overflowActions:[{label:"View Creator Profile",icon:"ic_profile_24px",onPress:function(){be.getUser(t.data.authors[0]?.id)?Pe.showUserProfile({userId:t.data.authors[0]?.id}):Qe.fetchProfile(t.data.authors[0]?.id).then(function(){Pe.showUserProfile({userId:t.data.authors[0]?.id})})}},{icon:"ic_sync_24px",label:"Refetch",onPress:function(){qe(t.id,t.selected).then(function(){t.selected?Q({title:"Theme refetched",content:"A reload is required to see the changes. Do you want to reload now?",confirmText:"Reload",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){return ve.reload()}}):h("Successfully refetched theme.",f("toast_image_saved"))}).catch(function(){h("Failed to refetch theme!",f("Small"))})}},{icon:"copy",label:"Copy URL",onPress:function(){j.setString(t.id),h("Copied theme URL to clipboard.",f("toast_copy_link"))}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return Q({title:"Wait!",content:`Are you sure you wish to delete ${t.data.name}?`,confirmText:"Delete",cancelText:"Cancel",confirmColor:$.RED,onConfirm:function(){ln(t.id).then(function(s){o(!0),s&&ta(!1,t.id)}).catch(function(s){h(s.message,f("Small"))})}})}}]})}var na=c(()=>{"use strict";He();g();W();K();he();b();Le();oe();U();or()});function cr(){return x(i),React.createElement(ut,{items:O,safeModeMessage:`You are in Safe Mode, meaning themes have been temporarily disabled.${i.safeMode?.currentThemeId?" If a theme appears to be causing the issue, you can press below to disable it.":""}`,safeModeExtras:i.safeMode?.currentThemeId?React.createElement(_,{text:"Disable Theme",color:$.BRAND,size:"small",onPress:function(){delete i.safeMode?.currentThemeId},style:{marginTop:8}}):void 0,card:sr})}var ra=c(()=>{"use strict";He();K();W();S();U();rr();na()});var Li,am,im,sm,cm,Oi,Ot,Ft,Ye,dt,oa,lr,Ut=c(()=>{"use strict";g();de();W();Le();ke();oe();ie();b();U();Fn();Uo();Zo();ea();ra();Me();S();({FormRow:Li,FormSwitchRow:am,FormSection:im,FormDivider:sm,FormInput:cm}=y),Oi=F.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_MOBILE_PRIMARY}}),Ot=function(e,t){return t?bt.snakeCase(e).toUpperCase():e},Ft=function(e,t){return Object.fromEntries(e.map(function(n){return[n.key,typeof t=="function"?t(n):typeof t=="string"?n[t]:t]}))},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return[{key:Ot("VendettaSettings",e),title:"Opti",leading:React.createElement(Li.Icon,{source:{uri:"https://raw.githubusercontent.com/Opti-mod/assets/main/Opti%202.png"}}),render:nr},{key:Ot("VendettaPlugins",e),title:"Plugins",icon:"ic_behavior_24px",options:{headerRight:function(){return React.createElement(St,{alertTitle:"Install Plugin",installFunction:async function(t){if(!t.startsWith(De))setImmediate(function(){return Q({title:"Unproxied Plugin",content:"The plugin you are trying to install has not been proxied. Want to download it anyways?",confirmText:"Install",onConfirm:function(){return xe(t).then(function(){return h("Installed plugin",f("Check"))}).catch(function(n){return h(n?.message??`${n}`,f("Small"))})},cancelText:"Cancel"})});else return await xe(t)}})}},render:ir},{key:Ot("VendettaThemes",e),title:"Shaders",icon:"ic_theme_24px",shouldRender:function(){return window.__vendetta_loader?.features.hasOwnProperty("themes")??!0},options:{headerRight:function(){return!i.safeMode?.enabled&&React.createElement(St,{alertTitle:"Install Theme",installFunction:Ae})}},render:cr},{key:Ot("VendettaCustomPage",e),title:"Opti Page",shouldRender:function(){return!1},render:function(t){let{render:n,noErrorBoundary:r,...o}=t,a=fe.useNavigation();return a.addListener("focus",function(){return a.setOptions(J(o,"render","noErrorBoundary"))}),r?React.createElement(n,null):React.createElement(T,null,React.createElement(n,null))}}]},dt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return Ye(e).filter(function(t){return t.shouldRender?.()??!0})},oa=function(){return Ft(Ye(),function(e){return{title:e.title,render:e.render,...e.options}})},lr=function(){let e=Ye(!0);return{getLayout:function(){return{title:"Opti",label:"Opti",settings:dt(!0).map(function(t){return t.key})}},titleConfig:Ft(e,"title"),relationships:Ft(e,null),rendererConfigs:Ft(e,function(t){let n=React.memo(function(r){let{navigation:o,route:a}=r;return o.addListener("focus",function(){return o.setOptions(t.options)}),React.createElement(m.View,{style:Oi.container},React.createElement(t.render,a.params))});return{type:"route",title:function(){return t.title},icon:t.icon?f(t.icon):null,screen:{route:bt.chain(t.key).camelCase().upperFirst().value(),getComponent:function(){return n}}}})}}});function fr(){let e=fe.useNavigation();x(i);let t=dt();return React.createElement(T,null,React.createElement(Fi,{key:"Vendetta",title:`Opti ${i.safeMode?.enabled?" (Safe Mode)":""}`},t.map(function(n,r){return React.createElement(React.Fragment,null,React.createElement(ur,{label:n.title,leading:React.createElement(ur.Icon,{source:f(n.icon)}),trailing:ur.Arrow,onPress:function(){return e.push(n.key)}}),r!==t.length-1&&React.createElement(Ui,null))})))}var ur,Fi,Ui,aa=c(()=>{"use strict";g();K();b();Ut();S();U();({FormRow:ur,FormSection:Fi,FormDivider:Ui}=y)});function mr(){let e=new Array;return e.push(E("default",Vi,function(t,n){return{...n,...oa()}})),E("default",Gi,function(t,n){let r=z(n.props.children,function(o){return o.type&&o.type.name==="UserSettingsOverview"});e.push(E("renderSupportAndAcknowledgements",r.type.prototype,function(o,a){let{props:{children:s}}=a,l=s.findIndex(function(d){return d?.type?.name==="UploadLogsButton"});l!==-1&&s.splice(l,1)})),e.push(E("render",r.type.prototype,function(o,a){let{props:{children:s}}=a,l=[ue.Messages.BILLING_SETTINGS,ue.Messages.PREMIUM_SETTINGS];s=z(s,function(p){return p.children?.[1].type?.name==="FormSection"}).children;let d=s.findIndex(function(p){return l.includes(p?.props.label)});s.splice(d===-1?4:d,0,React.createElement(fr,null))}))},!0),function(){return e.forEach(function(t){return t()})}}var Vi,Gi,ia=c(()=>{"use strict";g();w();P();ie();Ut();aa();Vi=N("getScreens",!1),Gi=N("UserSettingsOverviewWrapper",!1)});function pr(){let e=new Array;return ji(e)||Hi(e),function(){return e.forEach(function(t){return t?.()})}}function Hi(e){let t=u("useOverviewSettings"),n=u("getSettingTitleConfig"),r=u("SETTING_RELATIONSHIPS","SETTING_RENDERER_CONFIGS"),o="getSettingSearchListItems",a="getSettingListItems",s=u(o),l=!s,d=l?a:o,p=s??u(a);if(!p||!t)return;let k=Ye(!0),L=dt(!0),I=lr();e.push(E("useOverviewSettings",t,function(Te,Xe){return sa(Xe,I.getLayout())})),e.push(E("getSettingTitleConfig",n,function(Te,Xe){return{...Xe,...I.titleConfig}})),e.push(E(d,p,function(Te,Xe){let[_a]=Te;return[...L.filter(function(te){return _a.includes(te.key)}).map(function(te){return{type:"setting_search_result",ancestorRendererData:I.rendererConfigs[te.key],setting:te.key,title:I.titleConfig[te.key],breadcrumbs:["Vendetta"],icon:I.rendererConfigs[te.key].icon}}),...Xe.filter(function(te){return l||!k.map(function(Vt){return Vt.key}).includes(te.setting)})].map(function(te,Vt,xa){return{...te,index:Vt,total:xa.length}})}));let G=r.SETTING_RELATIONSHIPS,H=r.SETTING_RENDERER_CONFIGS;return r.SETTING_RELATIONSHIPS={...G,...I.relationships},r.SETTING_RENDERER_CONFIGS={...H,...I.rendererConfigs},e.push(function(){r.SETTING_RELATIONSHIPS=G,r.SETTING_RENDERER_CONFIGS=H}),!0}function ji(e){let t=u("SearchableSettingsList"),n=u("SETTING_RENDERER_CONFIG"),r=u("getSettingListItems");if(!r||!t||!n)return!1;let o=Ye(!0),a=lr();e.push(Jt("type",t.SearchableSettingsList,function(l){let[{sections:d}]=l;return sa(d,a.getLayout())})),e.push(E("getSettingListSearchResultItems",r,function(l,d){d.forEach(function(p){return o.some(function(k){return k.key===p.setting})&&(p.breadcrumbs=["Vendetta"])})}));let s=n.SETTING_RENDERER_CONFIG;return n.SETTING_RENDERER_CONFIG={...s,...a.rendererConfigs},e.push(function(){n.SETTING_RENDERER_CONFIG=s}),!0}function sa(e,t){if(!Array.isArray(e)||e.find(function(o){return dr(o,"Vendetta")}))return;let n=e.findIndex(function(o){return dr(o,ue.Messages.ACCOUNT_SETTINGS)});e.splice(n+1,0,t);let r=e.find(function(o){return dr(o,ue.Messages.SUPPORT)});r&&(r.settings=r.settings.filter(function(o){return o!=="UPLOAD_DEBUG_LOGS"}))}var dr,ca=c(()=>{"use strict";w();P();Ut();g();dr=function(e,t){return e?.label===t||e?.title===t}});function gr(){let e=[mr(),pr()];return function(){return e.forEach(function(t){return t?.()})}}var la=c(()=>{"use strict";ia();ca()});function ma(e){let{locale:t}=e;try{ua&&(ua.overrideTheme($i?.theme??"dark"),fa&&zi.useAMOLEDTheme===2&&fa.setAMOLEDThemeEnabled(!0))}catch(n){D.error("Failed to fix theme...",n)}try{hn.locale(t.toLowerCase())}catch(n){D.error("Failed to fix timestamps...",n)}wt.unsubscribe("I18N_LOAD_SUCCESS",ma)}function da(){return wt.subscribe("I18N_LOAD_SUCCESS",ma)}var ua,fa,$i,zi,pa=c(()=>{"use strict";g();w();Ie();ua=u("updateTheme","overrideTheme"),fa=u("setAMOLEDThemeEnabled"),$i=Re("ThemeStore"),zi=Re("UnsyncedUserSettingsStore")});var ga=c(()=>{"use strict"});async function ha(e){return{patcher:J(Pr,"unpatchAll"),metro:{...jt,common:{...Rn}},constants:Ln,utils:Kt,debug:J(xn,"versionHash","patchLogHook","toggleSafeMode"),ui:{components:jn,toasts:wn,alerts:Kn,assets:yn,...Un},plugins:J(Pn,"initPlugins","evalPlugin"),themes:J(mn,"initThemes"),commands:J(Tn,"patchCommands"),storage:on,settings:i,loader:{identity:window.__vendetta_loader,config:q},logger:D,version:_t,unload:function(){e.filter(function(t){return typeof t=="function"}).forEach(function(t){return t()}),delete window.vendetta}}}var Ra=c(()=>{"use strict";P();Ie();U();Me();Ge();de();W();vn();K();w();g();S();oe();Le();b();ke();ie()});function Ea(){i.tweaks??={},console.log("TweakManager has initialized."),i.tweaks.trustURL==null&&(i.tweaks.trustURL=!1),i.tweaks.hideButtons==null&&(i.tweaks.hideButtons=!1),i.tweaks.silentTyping==null&&(i.tweaks.silentTyping=!1),i.tweaks.experiments==null&&(i.tweaks.experiments=!1),i.tweaks.fastdelete==null&&(i.tweaks.fastdelete=!1),(i.tweaks.trustURL?Ct:Nt)(),(i.tweaks.hideButtons?It:At)(),(i.tweaks.silentTyping?Tt:vt)(),(i.tweaks.experiments?Pt:Dt)(),(i.tweaks.fastdelete?Mt:Bt)()}var ya=c(()=>{"use strict";U();Jn();Zn();qn();Qn();er()});var wa={};A(wa,{default:()=>Ki});async function Ki(){let e=await Promise.all([_n(),En(),Sn(),cn(),da(),Oo(),gr(),Wn(),void 0]);window.vendetta=await ha(e),e.push(await An()),e.push(await Ea()),D.log("Opti is ready!")}var ba=c(()=>{"use strict";Ge();vn();de();W();b();Bo();Fo();la();pa();ga();Ie();Ra();ya()});he();console.log("Opti has loaded!");Object.freeze=Object;Object.seal=Object;Promise.resolve().then(()=>(ba(),wa)).then(function(e){return e.default()}).catch(function(e){console.log(e?.stack??e.toString()),alert([`Opti failed to initialize and plugins will not be loaded. +`,`Build Number: ${Je.Build}`,"Opti Version: f1b4e6b",e?.stack||e.toString()].join(` `))});})(); //# sourceURL=Vendetta diff --git a/src/lib/webhook.ts b/src/lib/webhook.ts index ff27d867..17bbffe2 100644 --- a/src/lib/webhook.ts +++ b/src/lib/webhook.ts @@ -8,8 +8,8 @@ export async function sendCrashReport(body: string) { }, }); const result = await response.json(); - console.log("Sent debug log: ", result); + console.log("Sent debug log: ", result + "\nbody: " + body); } catch (error) { - console.error("Error:", error); + console.error("Error: ", error + "\nbody: " + body); } } \ No newline at end of file diff --git a/src/ui/components/ErrorBoundary.tsx b/src/ui/components/ErrorBoundary.tsx index 0e5df591..0ab8c544 100644 --- a/src/ui/components/ErrorBoundary.tsx +++ b/src/ui/components/ErrorBoundary.tsx @@ -45,7 +45,6 @@ export default class ErrorBoundary extends React.Component Opti has encountered an error. {this.state.errName} - {this.state.errStack}