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