-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopti.js
More file actions
10 lines (10 loc) · 64.4 KB
/
opti.js
File metadata and controls
10 lines (10 loc) · 64.4 KB
1
2
3
4
5
6
7
8
9
10
"use strict";(()=>{var Ra=Object.defineProperty;var c=(e,t)=>()=>(e&&(t=e(e=0)),t);var D=(e,t)=>{for(var n in t)Ra(e,n,{get:t[n],enumerable:!0})};var me,de,B,Xe,re,xe,pe=c(()=>{"use strict";me=window.nativeModuleProxy,de=me.MMKVManager;B=me.DCDFileManager??me.RTNFileManager;Xe=me.InfoDictionaryManager??me.RTNClientInfoManager;re=me.DCDDeviceManager??me.RTNDeviceManager,xe=me.BundleUpdaterManager});var Pt={};D(Pt,{find:()=>$,findAll:()=>Je,findByDisplayName:()=>Nt,findByDisplayNameAll:()=>_a,findByName:()=>M,findByNameAll:()=>wa,findByProps:()=>l,findByPropsAll:()=>ba,findByStoreName:()=>Le,findByTypeName:()=>Sa,findByTypeNameAll:()=>xa,modules:()=>It});var ya,ar,ir,It,$,Je,sr,cr,lr,ur,Ea,l,ba,M,wa,Nt,_a,Sa,xa,Le,w=c(()=>{"use strict";oe();ya=window.ErrorUtils.getGlobalHandler(),ar=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){ar(t);continue}}ir=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{if(H().discord.version>=224){let s=Function.prototype.toString;Object.defineProperty(Function.prototype,"toString",{value:s,configurable:!0,writable:!1}),__r(a),Object.defineProperty(Function.prototype,"toString",{value:s,configurable:!0,writable:!0})}window.ErrorUtils.setGlobalHandler(function(){}),__r(a),window.ErrorUtils.setGlobalHandler(ya)}catch{}if(!i){ar(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}},It=window.modules,$=ir(It,!0),Je=ir(It),sr=function(e){return function(t){return e.every(function(n){return t[n]!==void 0})}},cr=function(e,t){return t?function(n){return n?.name===e}:function(n){return n?.default?.name===e}},lr=function(e,t){return t?function(n){return n?.displayName===e}:function(n){return n?.default?.displayName===e}},ur=function(e,t){return t?function(n){return n?.type?.name===e}:function(n){return n?.default?.type?.name===e}},Ea=function(e){return function(t){return t.getName&&t.getName.length===0&&t.getName()===e}},l=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return $(sr(t))},ba=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Je(sr(t))},M=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return $(cr(e,t))},wa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Je(cr(e,t))},Nt=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return $(lr(e,t))},_a=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Je(lr(e,t))},Sa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return $(ur(e,t))},xa=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Je(ur(e,t))},Le=function(e){return $(Ea(e))}});function ae(e,t){return dt(e,t,{walkable:["props","children","child","sibling"]})}var fr=c(()=>{"use strict";ge()});function Dt(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=Dt(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=Dt(e[o],t,n,r+1);if(a)return a}catch{}}}}function dt(e,t){let{walkable:n=[],ignore:r=[],maxDepth:o=100}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Dt(e,t,{walkable:n,ignore:r,maxDepth:o},0)}var mr=c(()=>{"use strict"});async function he(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1e4,r=await fetch(e,{signal:Ta(n),...t});if(!r.ok)throw new Error("Request returned non-ok");return r}function Ta(e){let t=new AbortController;return setTimeout(function(){return t.abort(`Timed out after ${e}ms`)},e),t.signal}var dr=c(()=>{"use strict"});function Bt(e){return Object.isFrozen(e)?Object.assign({},e):e}var pr=c(()=>{"use strict"});function X(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let o={...e};return n.forEach(function(a){return delete o[a]}),o}var gr=c(()=>{"use strict"});var Mt={};D(Mt,{findInReactTree:()=>ae,findInTree:()=>dt,safeFetch:()=>he,unfreeze:()=>Bt,without:()=>X});var ge=c(()=>{"use strict";fr();mr();dr();pr();gr()});var Ot,te,pt=c(()=>{Ot=["a","b","i"],te=new Map});function hr(e,t,n,r,o){let a=te.get(t)?.[e];if(!a)return o?Reflect.construct(t[e],n,r):t[e].apply(r,n);for(let s of a.b.values()){let m=s.call(r,n);Array.isArray(m)&&(n=m)}let i=[...a.i.values()].reduce(function(s,m){return function(){for(var p=arguments.length,E=new Array(p),C=0;C<p;C++)E[C]=arguments[C];return m.call(r,E,s)}},function(){for(var s=arguments.length,m=new Array(s),p=0;p<s;p++)m[p]=arguments[p];return o?Reflect.construct(a.o,m,r):a.o.apply(r,m)})(...n);for(let s of a.a.values())i=s.call(r,n,i)??i;return i}var Rr=c(()=>{pt()});function Lt(e,t,n,r){let o=te.get(e),a=o?.[t];return a?.[r].has(n)?(a[r].delete(n),Ot.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&&te.delete(e),!0):!1}function yr(){for(let[e,t]of te.entries())for(let n in t)for(let r of Ot)for(let o of t[n]?.[r].keys()??[])Lt(e,n,o,r)}var Ft=c(()=>{pt()});function gt(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}`);te.has(n)||te.set(n,{});let a=te.get(n);if(!a[t]){let m=n[t];a[t]={o:m,b:new Map,i:new Map,a:new Map};let p=function(b,I,P){let Se=hr(t,n,I,b,P);return o&&s(),Se},E=new Proxy(m,{apply:function(b,I,P){return p(I,P,!1)},construct:function(b,I){return p(m,I,!0)},get:function(b,I,P){return I=="toString"?m.toString.bind(m):Reflect.get(b,I,P)}});Reflect.defineProperty(n,t,{value:E,configurable:!0,writable:!0})||(n[t]=E)}let i=Symbol(),s=function(){return Lt(n,t,i,e)};return a[t][e].set(i,r),s}}var Er=c(()=>{Rr();pt();Ft()});var Ut={};D(Ut,{after:()=>R,before:()=>kt,instead:()=>Re,unpatchAll:()=>yr});var kt,Re,R,Gt=c(()=>{Er();Ft();kt=gt("b"),Re=gt("i"),R=gt("a")});var br,U=c(()=>{"use strict";Gt();U();Gt();br={...Ut}});function $t(){return{listeners:Object.values(Vt).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 Vt,wr=c(()=>{"use strict";(function(e){e.GET="GET",e.SET="SET",e.DEL="DEL"})(Vt||(Vt={}))});var _r,Ht,Sr,jt,ie,Fe,xr=c(()=>{"use strict";pe();h();_r=/[<>:"\/\\|?*]/g,Ht=function(e){return f.Platform.select({default:e,ios:B.saveFileToGallery?e:`Documents/${e}`})},Sr=function(e){return _r.test(e)&&(e=e.replace(_r,"-").replace(/-+/g,"-")),`vd_mmkv/${e}`},jt=async function(e){await de.getItem(e)&&de.removeItem(e);let t=Sr(e);await B.fileExists(`${B.getConstants().DocumentsDirPath}/${t}`)&&await B.removeFile?.("documents",t)},ie=function(e){let t=Sr(e);return Fe(t,async function(){try{let n=`${B.getConstants().DocumentsDirPath}/${t}`;if(await B.fileExists(n))return;let r=await de.getItem(e)??"{}";if(r==="!!LARGE_VALUE!!"){let o=`${B.getConstants().CacheDirPath}/mmkv/${e}`;await B.fileExists(o)?r=await B.readFile(o,"utf8"):(console.log(`${e}: Experienced data loss :(`),r="{}")}await B.writeFile("documents",Ht(t),r,"utf8"),await de.getItem(e)!==null&&(de.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)}}())},Fe=function(e,t){let n;return{get:async function(){await t;let r=`${B.getConstants().DocumentsDirPath}/${e}`;return!n&&!await B.fileExists(r)?(n=!0,B.writeFile("documents",Ht(e),"{}","utf8")):JSON.parse(await B.readFile(r,"utf8"))},set:async function(r){await t,await B.writeFile("documents",Ht(e),JSON.stringify(r),"utf8")}}}});var Wt={};D(Wt,{awaitSyncWrapper:()=>Te,createFileBackend:()=>Fe,createMMKVBackend:()=>ie,createProxy:()=>Ar,createStorage:()=>ne,purgeStorage:()=>jt,useProxy:()=>x,wrapSync:()=>ye});function Ar(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=$t();function n(r,o){return new Proxy(r,{get(a,i){if(i===Tr)return t;let s=[...o,i],m=a[i];return m!=null?(t.emit("GET",{path:s,value:m}),typeof m=="object"?n(m,s):m):m},set(a,i,s){return a[i]=s,t.emit("SET",{path:[...o,i],value:s}),!0},deleteProperty(a,i){let s=delete a[i];return s&&t.emit("DEL",{path:[...o,i]}),s}})}return{proxy:n(e,[]),emitter:t}}function x(e){if(e[zt])throw e[zt];let t=e[Tr];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 ne(e){let t=await e.get(),{proxy:n,emitter:r}=Ar(t),o=function(){return e.set(n)};return r.on("SET",o),r.on("DEL",o),n}function ye(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 s=arguments.length,m=new Array(s>1?s-1:0),p=1;p<s;p++)m[p-1]=arguments[p];return Reflect[a](t??i,...m)}]})),get(a,i,s){return i===zt?n:i===vr?o:Reflect.get(t??a,i,s)}})}var Tr,vr,zt,Te,j=c(()=>{"use strict";wr();xr();Tr=Symbol.for("vendetta.storage.emitter"),vr=Symbol.for("vendetta.storage.accessor"),zt=Symbol.for("vendetta.storage.error");Te=function(e){return new Promise(function(t){return e[vr](t)})}});var ht,va,O,ve=c(()=>{"use strict";w();ht=l("setLogFn").default,va=new ht("Opti"),O=va});var Zt={};D(Zt,{color:()=>se,fetchTheme:()=>Ze,getCurrentTheme:()=>Ie,initThemes:()=>Jt,installTheme:()=>Ae,patchChatBackground:()=>Yt,removeTheme:()=>Xt,selectTheme:()=>Ce,themes:()=>F,updateThemes:()=>Ir});async function Kt(e){if(typeof e!="object")throw new Error("Theme must be an object");await Fe("vendetta_theme.json").set(e)}function Yt(){let e=Ie()?.data?.background;if(!e)return;let t=M("MessagesWrapperConnected",!1);if(!t)return;let{MessagesWrapper:n}=l("MessagesWrapper");if(!n)return;let r=[R("default",t,function(o,a){return React.createElement(f.ImageBackground,{style:{flex:1,height:"100%"},source:{uri:e.url},blurRadius:typeof e.blur=="number"?e.blur:0,children:a})}),R("render",n.prototype,function(o,a){let i=ae(a,function(s){return"HACK_fixModalInteraction"in s?.props&&s?.props?.style});i?i.props.style=Object.assign(f.StyleSheet.flatten(i.props.style??{}),{backgroundColor:"#0000"}):O.error("Didn't find Messages when patching MessagesWrapper!")})];return function(){return r.forEach(function(o){return o()})}}function Cr(e){if(ce.valid(e))return ce(e).hex();let t=Number(f.processColor(e));return ce.rgb(t>>16&255,t>>8&255,t&255,t>>24&255).hex()}function Ca(e){if(e.semanticColors){let t=e.semanticColors;for(let n in t)for(let r in t[n])t[n][r]&&=Cr(t[n][r])}if(e.rawColors){let t=e.rawColors;for(let n in t)e.rawColors[n]=Cr(t[n]);f.Platform.OS==="android"&&Ia(t)}return e}function Ia(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]=ce(e[r]).alpha(o).hex())}}async function Ze(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n;try{n=await(await he(e,{cache:"no-store"})).json()}catch{throw new Error(`Failed to fetch theme at ${e}`)}F[e]={id:e,selected:t,data:Ca(n)},t&&Kt(F[e])}async function Ae(e){if(typeof e!="string"||e in F)throw new Error("Theme already installed");await Ze(e)}async function Ce(e){if(e==="default")return await Kt({});let t=Object.values(F).find(function(n){return n.selected})?.id;t&&(F[t].selected=!1),F[e].selected=!0,await Kt(F[e])}async function Xt(e){let t=F[e];return t.selected&&await Ce("default"),delete F[e],t.selected}function Ie(){let e=window.__vendetta_loader?.features?.themes?.prop;return e&&window[e]||null}async function Ir(){await Te(F);let e=Ie();await Promise.allSettled(Object.keys(F).map(function(t){return Ze(t,e?.id===t)}))}async function Jt(){await Te(F);let e=Ie();if(!e)return;let t=se.default.unsafe_rawColors;se.default.unsafe_rawColors=new Proxy(t,{get:function(n,r){return e?e.data?.rawColors?.[r]??Reflect.get(t,r):Reflect.get(t,r)}}),Re("resolveSemanticColor",se.default.meta??se.default.internal,function(n,r){if(!e)return r(...n);let[o,a]=n,[i,s]=Nr(o,a),m=o==="amoled"?2:o==="light"?1:0;let p=Aa[i]??i,E=(e.data?.semanticColors?.[i]??e.data?.semanticColors?.[p])?.[m];if(i==="CHAT_BACKGROUND"&&typeof e.data?.background?.alpha=="number")return ce(E||"black").alpha(1-e.data.background.alpha).hex();if(E)return E;let C=e.data?.rawColors?.[s.raw];return C?s.opacity===1?C:ce(C).alpha(s.opacity).hex():r(...n)}),await Ir()}function Nr(e,t){let n=t[Nr._sym??=Object.getOwnPropertySymbols(t)[0]],r=se.SemanticColor[n];return[n,r[e.toLowerCase()]]}var se,F,Aa,J=c(()=>{"use strict";h();ge();w();U();j();ve();se=l("SemanticColor"),F=ye(ne(ie("VENDETTA_THEMES"))),Aa={BG_BACKDROP:"BACKGROUND_FLOATING",BG_BASE_PRIMARY:"BACKGROUND_PRIMARY",BG_BASE_SECONDARY:"BACKGROUND_SECONDARY",BG_BASE_TERTIARY:"BACKGROUND_SECONDARY_ALT",BG_MOD_FAINT:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_STRONG:"BACKGROUND_MODIFIER_ACCENT",BG_MOD_SUBTLE:"BACKGROUND_MODIFIER_ACCENT",BG_SURFACE_OVERLAY:"BACKGROUND_FLOATING",BG_SURFACE_OVERLAY_TMP:"BACKGROUND_FLOATING",BG_SURFACE_RAISED:"BACKGROUND_MOBILE_PRIMARY"}});var Rt,Pr,f,ce,yt=c(()=>{"use strict";J();U();Rt=function(e){for(let t in window.modules){let n=window.modules[t]?.publicModule.exports;if(n&&e(n))return n}},Pr=Rt(function(e){return e?.default?.name==="requireNativeComponent"});Pr&&Re("default",Pr,function(e,t){try{return t(...e)}catch{return e[0]}});window.React=Rt(function(e){return e.createElement});f=Rt(function(e){return e.AppRegistry}),ce=Rt(function(e){return e.brewer});if(window.__vendetta_loader?.features.themes)try{Jt()}catch(e){console.error("[Opti] Failed to initialize themes...",e)}});var nn={};D(nn,{AsyncProfiles:()=>La,Flux:()=>Fa,FluxDispatcher:()=>bt,Messages:()=>Oa,NavigationNative:()=>le,Profiles:()=>en,React:()=>_,ReactNative:()=>f,assets:()=>Qe,channels:()=>Qt,chroma:()=>ce,clipboard:()=>z,commands:()=>Et,constants:()=>ke,i18n:()=>Ne,invites:()=>Da,lodash:()=>wt,moment:()=>tn,navigation:()=>Ba,navigationStack:()=>Ma,stylesheet:()=>N,toasts:()=>qe,url:()=>Ue,util:()=>ka});function Pa(e){if(qt){for(let t in e)e[t]=new Proxy(f.StyleSheet.flatten(e[t]),{get(n,r,o){let a=Reflect.get(n,r,o);return Dr.isSemanticColor(a)?Dr.resolveSemanticColor(Na.theme,a):a}});return e}}var Na,qt,Dr,ke,Qt,Ne,Ue,qe,N,z,Qe,Da,Et,Ba,Ma,le,Oa,La,en,Fa,bt,_,tn,wt,ka,h=c(()=>{"use strict";w();yt();yt();yt();Na=Le("ThemeStore"),qt=l("colors","unsafe_rawColors"),Dr=qt?.internal??qt?.meta;ke=l("Fonts","Permissions"),Qt=l("getVoiceChannelId"),Ne=l("Messages"),Ue=l("openURL","openDeeplink"),qe=$(function(e){return e.open&&e.close&&!e.startDrag&&!e.init&&!e.openReplay&&!e.setAlwaysOnTop&&!e.setAccountFlag}),N={...$(function(e){return e.createStyles&&!e.ActionSheet}),createThemedStyleSheet:Pa,...l("createThemedStyleSheet")},z=l("setString","getString","hasString"),Qe=l("registerAsset"),Da=l("acceptInviteAndTransitionToInviteChannel"),Et=l("getBuiltInCommands"),Ba=l("pushLazy"),Ma=l("createStackNavigator"),le=l("NavigationContainer"),Oa=l("sendBotMessage"),La=l("getUser","fetchProfile"),en=l("showUserProfile"),Fa=l("connectStores"),bt=l("_currentDispatchActionType"),_=window.React,tn=l("isMoment"),wt=l("forEachRight"),ka=l("inspect","isNullOrUndefined")});var on={};D(on,{all:()=>ue,find:()=>Ua,getAssetByID:()=>Va,getAssetByName:()=>Ga,getAssetIDByName:()=>u,patchAssets:()=>rn});function rn(){let e=R("registerAsset",Qe,function(t,n){let r=t[0];ue[r.name]={...r,id:n}});for(let t=1;;t++){let n=Qe.getAssetByID(t);if(!n)break;ue[n.name]||(ue[n.name]={...n,id:t})}return e}var ue,Ua,Ga,Va,u,S=c(()=>{"use strict";h();U();ue={};Ua=function(e){return Object.values(ue).find(e)},Ga=function(e){return ue[e]},Va=function(e){return Qe.getAssetByID(e)},u=function(e){return ue[e]?.id}});var an={};D(an,{showToast:()=>g});var $a,g,W=c(()=>{"use strict";w();h();({uuid4:$a}=l("uuid4")),g=function(e,t){return qe.open({key:`vd-toast-${$a()}`,content:e,source:t,icon:t})}});var d,Z,G=c(()=>{"use strict";j();d=ye(ne(ie("VENDETTA_SETTINGS"))),Z=ye(ne(Fe("vendetta_loader.json")))});var un={};D(un,{connectToDebugger:()=>cn,getDebugInfo:()=>H,patchLogHook:()=>ln,socket:()=>Y,toggleSafeMode:()=>sn,versionHash:()=>_t});async function sn(){d.safeMode={...d.safeMode,enabled:!d.safeMode?.enabled},window.__vendetta_loader?.features.themes&&(Ie()?.id&&(d.safeMode.currentThemeId=Ie().id),d.safeMode?.enabled?await Ce("default"):d.safeMode?.currentThemeId&&await Ce(d.safeMode?.currentThemeId)),setTimeout(xe.reload,400)}function cn(e){if(Y!==void 0&&Y.readyState!==WebSocket.CLOSED&&Y.close(),!e){g("Invalid debugger URL!",u("Small"));return}Y=new WebSocket(`ws://${e}`),Y.addEventListener("open",function(){return g("Connected to debugger.",u("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}`),g("An error occurred with the debugger connection!",u("Small"))})}function ln(){let e=R("nativeLoggingHook",globalThis,function(t){Y?.readyState===WebSocket.OPEN&&Y.send(JSON.stringify({message:t[0],level:t[1]})),O.log(t[0])});return function(){Y&&Y.close(),e()}}function H(){let e=window.HermesInternal.getRuntimeProperties(),t=e["OSS Release Version"],n="for RN ",r=f.Platform.constants,o=r.reactNativeVersion;return{vendetta:{version:_t,loader:window.__vendetta_loader?.name??"Unknown"},discord:{version:Xe.Version,build:Xe.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"]},...f.Platform.select({android:{os:{name:"Android",version:r.Release,sdk:r.Version}},ios:{os:{name:r.systemName,version:r.osVersion}}}),...f.Platform.select({android:{device:{manufacturer:r.Manufacturer,brand:r.Brand,model:r.Model,codename:re.device}},ios:{device:{manufacturer:re.deviceManufacturer,brand:re.deviceBrand,model:re.deviceModel,codename:re.device}}})}}var Y,_t,oe=c(()=>{"use strict";h();U();J();pe();S();W();G();ve();_t="8e2f275"});var mn={};D(mn,{patchCommands:()=>fn,registerCommand:()=>Ha});function fn(){let e=R("getBuiltInCommands",Et,function(t,n){return n.concat(et)});return function(){et=[],e()}}function Ha(e){let t=Et.getBuiltInCommands(1,!0,!1);t.sort(function(r,o){return parseInt(o.id)-parseInt(r.id)});let n=t[t.length-1];return e.id=(Number(n.id)-1).toString(),et.push(e),function(){return et=et.filter(function(r){let{id:o}=r;return o!==e.id})}}var et,dn=c(()=>{"use strict";h();U();et=[]});var ja,za,Wa,Br,Mr=c(()=>{"use strict";ja=function(e){return{status:"fulfilled",value:e}},za=function(e){return{status:"rejected",reason:e}},Wa=function(e){return Promise.resolve(e).then(ja,za)},Br=function(e){return Promise.all(Array.from(e).map(Wa))}});var bn={};D(bn,{evalCorePlugins:()=>Ka,evalPlugin:()=>Or,fetchPlugin:()=>Ge,getDisabledPlugins:()=>Xa,getPluginList:()=>Ya,getPlugins:()=>yn,getSettings:()=>En,initPlugins:()=>Rn,installPlugin:()=>be,plugins:()=>L,pluginsList:()=>pn,removePlugin:()=>hn,startPlugin:()=>Ve,stopPlugin:()=>$e,stoppedPlugins:()=>gn});async function Ge(e){e.endsWith("/")||(e+="/");let t=L[e],n;try{n=await(await he(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 he(e+(n.main||"index.js"),{cache:"no-store"})).text()}catch{}if(!r&&!t)throw new Error(`Failed to fetch JS for ${e}`);L[e]={id:e,manifest:n,enabled:t?.enabled??!1,update:t?.update??!0,js:r??t.js}}async function be(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.endsWith("/")||(e+="/"),typeof e!="string"||e in L)throw new Error("Plugin already installed");await Ge(e),t&&await Ve(e)}async function Or(e){let t={...window.vendetta,plugin:{id:e.id,manifest:e.manifest,storage:await ne(ie(e.id))},logger:new ht(`Opti \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 Ka(e){let t={...window.vendetta,plugin:{id:e.id,storage:await ne(ie(e.id))},logger:new ht(`Opti Core Plugin \xBB ${e.id}`)},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 Ve(e){e.endsWith("/")||(e+="/");let t=L[e];if(!t)throw new Error("Attempted to start non-existent plugin");try{if(!d.safeMode?.enabled){let n=await Or(t);Ee[e]=n,n.onLoad?.()}pn.push(" "+t.manifest.name),t.enabled=!0}catch(n){gn.push(" "+t.id),O.error(`Plugin ${t.id} errored whilst loading, and will be unloaded`,n),g(`Plugin ${t.id} failed to load. The error output is in console.`,u("ic_close_circle_24px"));try{Ee[t.id]?.onUnload?.()}catch(r){O.error(`Plugin ${t.id} errored whilst unloading`,r),g(`Plugin ${t.id} failed to load. The error output is in console.`,u("ic_close_circle_24px"))}delete Ee[e],t.enabled=!1}}function $e(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;e.endsWith("/")||(e+="/");let n=L[e],r=Ee[e];if(!n)throw new Error("Attempted to stop non-existent plugin");if(!d.safeMode?.enabled){try{r?.onUnload?.()}catch(o){O.error(`Plugin ${n.id} errored whilst unloading`,o)}delete Ee[e]}t&&(n.enabled=!1)}async function hn(e){e.endsWith("/")||(e+="/"),L[e].enabled&&$e(e),delete L[e],await jt(e)}async function Rn(){await Te(d),await Te(L);let e=Object.keys(L);return d.safeMode?.enabled||(await Br(e.filter(function(t){return L[t].enabled}).map(async function(t){return L[t].update&&await Ge(t).catch(function(n){return O.error(n.message)}),await Ve(t)})),e.filter(function(t){return!L[t].enabled&&L[t].update}).forEach(function(t){return Ge(t)})),Ja}function yn(){var e=0;return Object.keys(Ee).forEach(function(t){return e++}),e}function Ya(){return pn.sort()}function Xa(){return gn.sort()}var L,Ee,pn,gn,Ja,En,fe=c(()=>{"use strict";ge();j();Mr();ve();G();W();S();L=ye(ne(ie("VENDETTA_PLUGINS"))),Ee={},pn=new Array,gn=new Array;Ja=function(){return Object.keys(Ee).forEach(function(e){return $e(e,!1)})},En=function(e){return Ee[e]?.settings}});var Tn={};D(Tn,{BADGES:()=>qa,DISCORD_SERVER:()=>wn,DISCORD_SERVER_ID:()=>_n,GITHUB:()=>xn,HTTP_REGEX:()=>Qa,HTTP_REGEX_MULTI:()=>nt,OPTI_PROXY_PREFIX:()=>Za,PLUGINS_CHANNEL_ID:()=>Sn,PROXY_PREFIX:()=>Pe,THEMES_CHANNEL_ID:()=>tt});var wn,_n,Sn,tt,xn,Pe,Za,qa,Qa,nt,De=c(()=>{"use strict";wn="https://discord.gg/zm5MWBPeRp",_n="1228081962883747880",Sn="1298416173586845787",tt="1298416199331348540",xn="https://github.com/opti-mod/Opti",Pe="https://vd-plugins.github.io/proxy",Za="https://opti-plugins.github.io/proxy",qa="https://raw.githubusercontent.com/opti-mod/badges/main/",Qa=/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$/,nt=/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g});function He(e){let{label:t,icon:n,noPadding:r=!1,noAnimation:o=!1,children:a}=e,{FormRow:i,FormDivider:s}=y,[m,p]=React.useState(!0);return React.createElement(React.Fragment,null,React.createElement(i,{label:t,leading:n&&React.createElement(i.Icon,{source:u(n)}),trailing:React.createElement(i.Arrow,{style:{transform:[{rotate:`${m?180:90}deg`}]}}),onPress:function(){p(!m),o||f.LayoutAnimation.configureNext(f.LayoutAnimation.Presets.easeInEaseOut)}}),!m&&React.createElement(React.Fragment,null,React.createElement(s,null),React.createElement(f.View,{style:!r&&{paddingHorizontal:15}},a)))}var Lr=c(()=>{"use strict";h();S();A()});function Fr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var kr=c(()=>{});function Ur(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Gr(e,t,n){return t&&Ur(e.prototype,t),n&&Ur(e,n),e}var Vr=c(()=>{});function $r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Hr=c(()=>{});function St(e,t){return St=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},St(e,t)}var jr=c(()=>{});function zr(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&&St(e,t)}var Wr=c(()=>{jr()});function rt(e){return rt=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},rt(e)}var Kr=c(()=>{});function Yr(){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 Xr=c(()=>{});function Jr(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Zr=c(()=>{});function qr(e){return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}var Qr=c(()=>{});function eo(e,t){return t&&(qr(t)==="object"||typeof t=="function")?t:Jr(e)}var to=c(()=>{Zr();Qr()});function no(e){var t=Yr();return function(){var r=rt(e),o;if(t){var a=rt(this).constructor;o=Reflect.construct(r,arguments,a)}else o=r.apply(this,arguments);return eo(this,o)}}var ro=c(()=>{Kr();Xr();to()});var ei,ti,T,vn=c(()=>{"use strict";kr();Vr();Hr();Wr();ro();h();A();ei=N.createThemedStyleSheet({view:{flex:1,flexDirection:"column",margin:10,borderRadius:5},title:{fontSize:20,textAlign:"center",marginBottom:5,borderRadius:5}}),T=function(e){"use strict";zr(n,e);var t=no(n);function n(r){Fr(this,n);var o;return o=t.call(this,r),o.state={hasErr:!1},o}return Gr(n,[{key:"render",value:function(){var o=this;return this.state.hasErr?_.createElement(f.ScrollView,{style:{flex:1},contentContainerStyle:{padding:24,alignItems:"center"}},_.createElement(y.FormText,{style:ei.title},"Opti has encountered an error."),_.createElement(we,{selectable:!0,style:{marginBottom:8}},this.state.errText),_.createElement(V,{color:V.Colors.RED,size:V.Sizes.MEDIUM,look:V.Looks.FILLED,onPress:function(){return o.setState({hasErr:!1,errText:void 0})},text:"Retry"}),_.createElement(V,{color:V.Colors.ORANGE,size:V.Sizes.MEDIUM,look:V.Looks.FILLED,onPress:function(){return o.setState({hasErr:!1,errText:void 0})},text:"Send Crash Report [WIP]"})):this.props.children}}]),n}(ti=_.Component);$r(T,"getDerivedStateFromError",function(e){return{hasErr:!0,errText:e.message}})});var An={};D(An,{rawColors:()=>ni,semanticColors:()=>v});var v,ni,Be=c(()=>{"use strict";h();J();v=se?.default?.colors??ke?.ThemeColorMap,ni=se?.default?.unsafe_rawColors??ke?.Colors});function we(e){let{selectable:t,style:n,children:r}=e;return t?f.Platform.select({ios:React.createElement(ri,{style:n,children:r}),default:React.createElement(oo,{style:n,children:r,selectable:!0})}):React.createElement(oo,{style:n,children:r})}var ao,ri,oo,io=c(()=>{"use strict";h();Be();ao=N.createThemedStyleSheet({codeBlock:{fontFamily:ke.Fonts.CODE_SEMIBOLD,fontSize:12,textAlignVertical:"center",backgroundColor:v.BACKGROUND_SECONDARY,color:v.TEXT_NORMAL,borderWidth:1,borderRadius:4,borderColor:v.BACKGROUND_TERTIARY,padding:10}}),ri=function(e){let{style:t,children:n}=e;return React.createElement(f.TextInput,{editable:!1,multiline:!0,style:[ao.codeBlock,t&&t],value:n})},oo=function(e){let{selectable:t,style:n,children:r}=e;return React.createElement(f.Text,{selectable:t,style:[ao.codeBlock,n&&n]},r)}});function je(e){let{onChangeText:t,placeholder:n,style:r}=e;return React.createElement(oi,{style:[ai.search,r],placeholder:n,onChangeText:t})}var oi,ai,so=c(()=>{"use strict";h();w();oi=M("StaticSearchBarContainer"),ai=N.createThemedStyleSheet({search:{margin:0,padding:0,borderBottomWidth:0,backgroundColor:"none"}})});var Dn={};D(Dn,{Alert:()=>In,Button:()=>V,Codeblock:()=>we,ErrorBoundary:()=>T,Forms:()=>y,General:()=>ii,HelpMessage:()=>Nn,SafeAreaView:()=>Pn,Search:()=>je,Summary:()=>He,TableRowTrailingText:()=>si,Tabs:()=>q});var Cn,y,ii,si,q,In,V,Nn,Pn,A=c(()=>{"use strict";w();Lr();vn();io();so();Cn=function(e){return $(function(t){return t[e]&&Object.keys(t).length===1})?.[e]},y=l("Form","FormSection"),ii=l("Button","Text","View"),si=l("TableRowTrailingText"),q={...l("TableRow","TableRowGroup"),RedesignSwitch:Cn("FormSwitch"),RedesignCheckbox:Cn("FormCheckbox"),RedesignRadio:Cn("FormRadio")},In=Nt("FluxContainer(Alert)"),V=l("Looks","Colors","Sizes"),Nn=M("HelpMessage"),Pn=l("useSafeAreaInsets").SafeAreaView});function co(){return R("default",ci,function(e,t){let[{thread:n}]=e;if(n.guild_id!==_n)return;let r;if(n.parent_id===Sn)r="Plugin";else if(n.parent_id===tt&&window.__vendetta_loader?.features.themes)r="Theme";else return;let{firstMessage:o}=fi(n),a=o?.content?.match(nt);if(!a)return;r==="Plugin"?a=a.filter(function(p){return p.startsWith(Pe)}):a=a.filter(function(p){return p.endsWith(".json")});let i=a[0];if(!i)return;let s=ae(t,function(p){return p?.[0]?.key}),m=s[0].type;s.unshift(React.createElement(m,{key:"install"},React.createElement(li,{leading:React.createElement(ui,{style:{opacity:1},source:u("ic_download_24px")}),label:`Install ${r}`,onPress:function(){return(r==="Plugin"?be:Ae)(i).then(function(){g(`Successfully installed ${n.name}`,u("Check"))}).catch(function(p){g(p.message,u("Small"))}).finally(function(){return mi()})}})))})}var ci,li,ui,fi,mi,lo=c(()=>{"use strict";w();De();U();fe();J();ge();S();W();A();ci=M("ForumPostLongPressActionSheet",!1),{FormRow:li,FormIcon:ui}=y,{useFirstForumPostMessage:fi}=l("useFirstForumPostMessage"),{hideActionSheet:mi}=l("openLazy","hideActionSheet")});function Bn(e){let{title:t,confirmText:n,confirmColor:r,onConfirm:o,cancelText:a,placeholder:i,initialValue:s="",secureTextEntry:m}=e,[p,E]=React.useState(s),[C,b]=React.useState("");function I(){Promise.resolve(o(p)).then(function(){uo.close()}).catch(function(Se){b(Se.message)})}return React.createElement(In,{title:t,confirmText:n,confirmColor:r,isConfirmButtonDisabled:C.length!==0,onConfirm:I,cancelText:a,onCancel:function(){return uo.close()}},React.createElement(di,{placeholder:i,value:p,onChange:function(P){E(typeof P=="string"?P:P.text),C&&b("")},returnKeyType:"done",onSubmitEditing:I,error:C||void 0,secureTextEntry:m,autoFocus:!0,showBorder:!0,style:{paddingVertical:5,alignSelf:"stretch",paddingHorizontal:0,borderRadius:5}}))}var di,uo,fo=c(()=>{"use strict";w();A();({FormInput:di}=y),uo=l("openLazy","close")});var On={};D(On,{showConfirmationAlert:()=>Q,showCustomAlert:()=>po,showInputAlert:()=>Mn});function Q(e){let t=e;return t.body=e.content,delete t.content,t.isDismissable??=!0,mo.show(t)}var mo,po,Mn,Me=c(()=>{"use strict";w();fo();mo=l("openLazy","close");po=function(e,t){return mo.openLazy({importer:async function(){return function(){return React.createElement(e,t)}}})},Mn=function(e){return po(Bn,e)}});function go(e){return e.startsWith(Pe)?"Plugin":e.endsWith(".json")&&window.__vendetta_loader?.features.themes?"Theme":void 0}function ho(e,t){(e==="Plugin"?be:Ae)(t).then(function(){g("Successfully installed",u("Check"))}).catch(function(n){g(n.message,u("Small"))})}function Ro(){let e=new Array;return e.push(R("showSimpleActionSheet",pi,function(t){if(t[0].key!=="LongPressUrl")return;let{header:{title:n},options:r}=t[0],o=go(n);o&&r.push({label:`Install ${o}`,onPress:function(){return ho(o,n)}})})),e.push(Re("handleClick",gi,async function(t,n){let{href:r}=t[0],o=go(r);if(!o)return n.apply(this,t);if(o==="Theme"&&yi(Ri())?.parent_id!==tt)return n.apply(this,t);Q({title:"Hold Up",content:["Would you like to directly install this",React.createElement(f.Text,{style:Ei["text-md/semibold"]},o),"?"],onConfirm:function(){return ho(o,r)},confirmText:"Install",cancelText:"Cancel",secondaryConfirmText:"Open in Browser",onConfirmSecondary:function(){return hi(r)}})})),function(){return e.forEach(function(t){return t()})}}var pi,gi,hi,Ri,yi,Ei,yo=c(()=>{"use strict";w();h();De();U();fe();J();Me();S();W();pi=$(function(e){return e?.showSimpleActionSheet&&!Object.getOwnPropertyDescriptor(e,"showSimpleActionSheet")?.get}),gi=l("handleClick"),{openURL:hi}=Ue,{getChannelId:Ri}=Qt,{getChannel:yi}=l("getChannel"),{TextStyleSheet:Ei}=l("TextStyleSheet")});function Ln(){let e=new Array;return e.push(co()),e.push(Ro()),function(){return e.forEach(function(t){return t()})}}var Eo=c(()=>{"use strict";lo();yo()});var K,bo,wo,_o,ot=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"})(K||(K={}));(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"})(bo||(bo={}));(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"})(wo||(wo={}));(function(e){e[e.CHAT=1]="CHAT",e[e.USER=2]="USER",e[e.MESSAGE=3]="MESSAGE"})(_o||(_o={}))});function To(){return R("render",bi.prototype,function(e,t){var n=this;if(!this.state.error)return;let r=H();this.state.activeTab??="message";let o=xo.find(function(s){return s.id===n.state.activeTab}),a=this.state.error[this.state.activeTab],i=[{text:"Restart Discord",onPress:this.handleReload},...d.safeMode?.enabled?[]:[{text:"Restart in Safe Mode",onPress:sn}],{text:"Retry Render",color:K.RED,onPress:function(){return n.setState({info:null,error:null})}}];return React.createElement(T,null,React.createElement(Pn,{style:at.container},React.createElement(f.View,{style:at.header},t.props.Illustration&&React.createElement(t.props.Illustration,{style:{flex:1,resizeMode:"contain",maxHeight:96,paddingRight:4}}),React.createElement(f.View,{style:{flex:2,paddingLeft:4}},React.createElement(f.Text,{style:at.headerTitle},t.props.title),React.createElement(f.Text,{style:at.headerDescription},t.props.body))),React.createElement(f.View,{style:{flex:6}},React.createElement(f.View,{style:{paddingBottom:8}},React.createElement(wi,{tabs:xo,activeTab:this.state.activeTab,onTabSelected:function(s){n.setState({activeTab:s})}})),React.createElement(we,{selectable:!0,style:{flexBasis:"auto",marginBottom:8}},[`Discord: ${r.discord.build} (${r.os.name})`,`Vendetta: ${r.vendetta.version}`].join(`
`)),React.createElement(we,{selectable:!0,style:{flex:1,textAlignVertical:"top"}},o?.trimWhitespace?a.split(`
`).filter(function(s){return s.length!==0}).map(function(s){return s.trim()}).join(`
`):a)),React.createElement(f.View,{style:at.footer},i.map(function(s){let m=i.indexOf(s)!==0?8:0;return React.createElement(V,{text:s.text,color:s.color??K.BRAND,size:s.size??"small",onPress:s.onPress,style:re.isTablet?{flex:`0.${i.length}`,marginLeft:m}:{marginTop:m}})}))))})}var bi,wi,So,at,xo,vo=c(()=>{"use strict";ot();h();w();U();oe();pe();Be();A();G();bi=M("ErrorBoundary"),{BadgableTabBar:wi}=l("BadgableTabBar"),{TextStyleSheet:So}=l("TextStyleSheet"),at=N.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_PRIMARY,paddingHorizontal:16},header:{flex:1,flexDirection:"row",justifyContent:"center",alignItems:"center",marginVertical:8},headerTitle:{...So["heading-md/semibold"],textAlign:"center",textTransform:"uppercase",color:v.HEADER_PRIMARY},headerDescription:{...So["text-sm/medium"],textAlign:"center",color:v.TEXT_MUTED},footer:{flexDirection:re.isTablet?"row":"column",justifyContent:"flex-end",marginVertical:8}}),xo=[{id:"message",title:"Message"},{id:"stack",title:"Stack Trace"},{id:"componentStack",title:"Component",trimWhitespace:!0}]});function xt(e){let{alertTitle:t,installFunction:n}=e;return React.createElement(f.TouchableOpacity,{onPress:function(){return z.getString().then(function(r){return Mn({title:t,initialValue:r.match(nt)?.[0]??"",placeholder:"https://example.com/",onConfirm:function(o){return n(o)},confirmText:"Install",cancelText:"Cancel"})})}},React.createElement(f.Image,{style:_i.icon,source:u("ic_add_24px")}))}var _i,Ao=c(()=>{"use strict";h();De();Me();S();Be();_i=N.createThemedStyleSheet({icon:{marginRight:10,tintColor:v.HEADER_PRIMARY}})});function kn(){return x(d),React.createElement(T,null,React.createElement(f.ScrollView,{style:{flex:1},contentContainerStyle:{padding:24,alignItems:"center"}},React.createElement(Si,{spacing:16},React.createElement(Fn,{title:""},React.createElement(it,{label:"Opti Version",icon:React.createElement(Oe,{source:u("boost")}),subLabel:`${Io.vendetta.version}`,onPress:function(){z.setString(Io.vendetta.version),g("Copied to clipboard.")}}),React.createElement(it,{label:"Enabled Plugins",icon:React.createElement(Oe,{source:u("ic_progress_wrench_24px")}),subLabel:`${yn()} enabled plugins.`})),React.createElement(Fn,{title:"Actions"},React.createElement(it,{label:"Reload Discord",icon:React.createElement(Oe,{source:u("ic_message_retry")}),onPress:function(){return xe.reload()}}),React.createElement(Co,{label:"Developer Settings",icon:React.createElement(Oe,{source:u("ic_progress_wrench_24px")}),value:d.developerSettings,onValueChange:function(e){d.developerSettings=e}}),React.createElement(Co,{label:"Enable Crash Reports",icon:React.createElement(Oe,{source:u("ic_progress_wrench_24px")}),value:d.crashLogs,onValueChange:function(e){d.crashLogs=e,g("Does not work yet.")}})),React.createElement(Fn,{title:"Links",titleStyleType:"no_border"},React.createElement(it,{label:"Discord Server",icon:React.createElement(Oe,{source:u("Discord")}),onPress:function(){return Ue.openDeeplink(wn)},arrow:!0}),React.createElement(it,{label:"GitHub",icon:React.createElement(Oe,{source:u("img_account_sync_github_white")}),onPress:function(){return Ue.openURL(xn)},arrow:!0})))))}var pu,gu,hu,Ru,Si,it,Oe,Co,Fn,Io,No=c(()=>{"use strict";h();De();oe();j();pe();S();A();G();W();fe();({FormRow:pu,FormSwitchRow:gu,FormSection:hu,FormDivider:Ru}=y),{Stack:Si,TableRow:it,TableRowIcon:Oe,TableSwitchRow:Co,TableRowGroup:Fn}=q,Io=H()});function st(e){let{items:t,safeModeMessage:n,safeModeExtras:r,card:o}=e;x(d),x(t);let[a,i]=React.useState("");return React.createElement(T,null,React.createElement(f.FlatList,{ListHeaderComponent:React.createElement(React.Fragment,null,d.safeMode?.enabled&&React.createElement(f.View,{style:{marginBottom:10}},React.createElement(Nn,{messageType:0},n),r),React.createElement(je,{style:{marginBottom:10},onChangeText:function(s){return i(s.toLowerCase())},placeholder:"Search"})),style:{paddingHorizontal:10,paddingTop:10},contentContainerStyle:{paddingBottom:20},data:Object.values(t).filter(function(s){return s.id?.toLowerCase().includes(a)}),renderItem:function(s){let{item:m,index:p}=s;return React.createElement(o,{item:m,index:p})}}))}var Un=c(()=>{"use strict";h();j();A();G()});function ct(e){let t=e.toggleValue??!1;return React.createElement(f.View,{style:[ze.card,{marginTop:e.index!==0?8:0}]},React.createElement(Po,{style:ze.header,label:e.headerLabel,icon:e.headerIcon&&React.createElement(Do,{source:u(e.headerIcon)}),trailing:e.toggleType&&(e.toggleType==="switch"?React.createElement(xi,{style:f.Platform.OS==="android"&&{marginVertical:-15},value:e.toggleValue,onValueChange:e.onToggleChange}):React.createElement(f.Pressable,{onPress:function(){t=!t,e.onToggleChange?.(t)}},React.createElement(Ti,{selected:e.toggleValue})))}),React.createElement(Po,{style:ze.description,label:e.descriptionLabel,trailing:React.createElement(f.View,{style:ze.actions},e.overflowActions&&React.createElement(f.TouchableOpacity,{onPress:function(){return Ai({key:"CardOverflow",header:{title:e.overflowTitle,icon:e.headerIcon&&React.createElement(Do,{style:{marginRight:4},source:u(e.headerIcon)}),onClose:function(){return vi()}},options:e.overflowActions?.map(function(n){return{...n,icon:u(n.icon)}})})}},React.createElement(f.Image,{style:ze.icon,source:u("ic_more_24px")})),e.actions?.map(function(n){let{icon:r,onPress:o}=n;return React.createElement(f.TouchableOpacity,{onPress:o},React.createElement(f.Image,{style:ze.icon,source:u(r)}))}))}))}var Iu,xi,Ti,Nu,Po,Do,Pu,Du,vi,Ai,ze,Gn=c(()=>{"use strict";h();w();S();Be();A();({FormRow:Iu,FormSwitch:xi,FormRadio:Ti}=y),{Stack:Nu,TableRow:Po,TableRowIcon:Do,TableSwitchRow:Pu,TableRowGroup:Du}=q,{hideActionSheet:vi}=l("openLazy","hideActionSheet"),{showSimpleActionSheet:Ai}=l("showSimpleActionSheet"),ze=N.createThemedStyleSheet({card:{backgroundColor:v.BACKGROUND_SECONDARY,borderRadius:12,borderColor:v.BACKGROUND_TERTIARY,borderWidth:1},header:{padding:0,backgroundColor:v?.INTERACTIVE_MUTED,color:v?.INTERACTIVE_MUTED,borderTopLeftRadius:6,borderTopRightRadius:6},description:{fontSize:11},actions:{flexDirection:"row-reverse",alignItems:"center"},icon:{width:24,height:24,marginLeft:5,tintColor:v?.INTERACTIVE_NORMAL}})});async function Bo(e,t){e.enabled&&$e(e.id,!1),t(),e.enabled&&await Ve(e.id)}function Vn(e){let{item:t,index:n}=e,r=En(t.id),o=le.useNavigation(),a=t.manifest.authors,[i,s]=React.useState(!1);return i?null:React.createElement(ct,{index:n,headerLabel:`${t.manifest.name}
by ${a.map(function(m){return m.name}).join(", ")}`,headerIcon:t.manifest.vendetta?.icon||"ic_application_command_24px",toggleType:"switch",toggleValue:t.enabled,onToggleChange:function(m){try{m?Ve(t.id):$e(t.id)}catch(p){g(p.message)}},descriptionLabel:`${t.manifest.description}`,overflowTitle:t.manifest.name,overflowActions:[{icon:"ic_sync_24px",label:"Refetch",onPress:async function(){Bo(t,function(){Ge(t.id).then(async function(){g("Successfully refetched plugin.",u("toast_image_saved"))}).catch(function(){g("Failed to refetch plugin!",u("Small"))})})}},{icon:"copy",label:"Copy URL",onPress:function(){z.setString(t.id),g("Copied plugin URL to clipboard.",u("toast_copy_link"))}},{icon:"ic_person",label:"View Authors",onPress:function(){Ci({key:"PluginAuthors",header:{title:"Author's Profiles",onClose:function(){return Ii()}},options:[{label:t.manifest.authors[0].name,onPress:function(){return en.showUserProfile({userId:t.manifest.authors[0]?.id})}},{label:t.manifest.authors[1]?.name,onPress:function(){return g("Working on being able to async load other profiles.")}}]})}},{icon:"ic_download_24px",label:t.update?"Disable updates":"Enable updates",onPress:function(){t.update=!t.update,g(`${t.update?"Enabled":"Disabled"} updates for ${t.manifest.name}.`,u("toast_image_saved"))}},{icon:"ic_duplicate",label:"Clear data",isDestructive:!0,onPress:function(){return Q({title:"Wait!",content:`Are you sure you wish to clear the data of ${t.manifest.name}?`,confirmText:"Clear",cancelText:"Cancel",confirmColor:K.RED,onConfirm:function(){Bo(t,function(){try{de.removeItem(t.id),g(`Cleared data for ${t.manifest.name}.`,u("trash"))}catch{g(`Failed to clear data for ${t.manifest.name}!`,u("Small"))}})}})}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return Q({title:"Wait!",content:`Are you sure you wish to delete ${t.manifest.name}? This will clear all of the plugin's data.`,confirmText:"Delete",cancelText:"Cancel",confirmColor:K.RED,onConfirm:function(){try{hn(t.id),s(!0)}catch(m){g(m.message,u("Small"))}}})}}],actions:[...r?[{icon:"settings",onPress:function(){return o.push("VendettaCustomPage",{title:t.manifest.name,render:r})}}]:[]]})}var Ci,Ii,Hu,Mo=c(()=>{"use strict";ot();w();h();fe();pe();S();W();Me();Gn();({showSimpleActionSheet:Ci}=l("showSimpleActionSheet")),{hideActionSheet:Ii}=l("openLazy","hideActionSheet"),{TextStyleSheet:Hu}=l("TextStyleSheet")});function $n(){return x(d),React.createElement(st,{items:L,safeModeMessage:"You are in Safe Mode, so plugins cannot be loaded. Disable any misbehaving plugins, then return to Normal Mode from the General settings page.",card:Vn})}var Oo=c(()=>{"use strict";j();fe();G();Un();Mo()});async function Lo(e,t){await Ce(e?t:"default"),xe.reload()}function Hn(e){let{item:t,index:n}=e;x(d);let[r,o]=React.useState(!1);if(r)return null;let a=t.data.authors;return React.createElement(ct,{index:n,headerLabel:`${t.data.name} ${a?`by ${a.map(function(i){return i.name}).join(", ")}`:""}`,descriptionLabel:t.data.description??"No description.",toggleType:d.safeMode?.enabled?void 0:"radio",toggleValue:t.selected,onToggleChange:function(i){Lo(i,t.id)},overflowTitle:t.data.name,overflowActions:[{icon:"ic_sync_24px",label:"Refetch",onPress:function(){Ze(t.id,t.selected).then(function(){t.selected?Q({title:"Theme refetched",content:"A reload is required to see the changes. Do you want to reload now?",confirmText:"Reload",cancelText:"Cancel",confirmColor:K.RED,onConfirm:function(){return xe.reload()}}):g("Successfully refetched theme.",u("toast_image_saved"))}).catch(function(){g("Failed to refetch theme!",u("Small"))})}},{icon:"copy",label:"Copy URL",onPress:function(){z.setString(t.id),g("Copied theme URL to clipboard.",u("toast_copy_link"))}},{icon:"ic_message_delete",label:"Delete",isDestructive:!0,onPress:function(){return Q({title:"Wait!",content:`Are you sure you wish to delete ${t.data.name}?`,confirmText:"Delete",cancelText:"Cancel",confirmColor:K.RED,onConfirm:function(){Xt(t.id).then(function(i){o(!0),i&&Lo(!1,t.id)}).catch(function(i){g(i.message,u("Small"))})}})}}]})}var Fo=c(()=>{"use strict";ot();h();J();j();pe();S();Me();W();G();Gn()});function jn(){return x(d),React.createElement(st,{items:F,safeModeMessage:`You are in Safe Mode, meaning themes have been temporarily disabled.${d.safeMode?.currentThemeId?" If a theme appears to be causing the issue, you can press below to disable it persistently.":""}`,safeModeExtras:d.safeMode?.currentThemeId?React.createElement(V,{text:"Disable Theme",color:K.BRAND,size:"small",onPress:function(){delete d.safeMode?.currentThemeId},style:{marginTop:8}}):void 0,card:Hn})}var ko=c(()=>{"use strict";ot();j();J();A();G();Un();Fo()});function zn(e){let{asset:t}=e;return React.createElement(Ni,{label:`${t.name} - ${t.id}`,trailing:React.createElement(f.Image,{source:t.id,style:{width:32,height:32}}),onPress:function(){z.setString(t.name),g("Copied asset name to clipboard.",u("toast_copy_link"))}})}var Ni,Uo=c(()=>{"use strict";h();W();S();A();({FormRow:Ni}=y)});function Wn(){let[e,t]=React.useState("");return React.createElement(T,null,React.createElement(f.View,{style:{flex:1}},React.createElement(je,{style:{margin:10},onChangeText:function(n){return t(n)},placeholder:"Search"}),React.createElement(f.FlatList,{data:Object.values(ue).filter(function(n){return n.name.includes(e)||n.id.toString()===e}),renderItem:function(n){let{item:r}=n;return React.createElement(zn,{asset:r})},ItemSeparatorComponent:Pi,keyExtractor:function(n){return n.name}})))}var Pi,Go=c(()=>{"use strict";h();S();A();Uo();({FormDivider:Pi}=y)});function Tt(e){let{label:t,version:n,icon:r}=e;return React.createElement(Vo,{label:t,leading:React.createElement(Vo.Icon,{source:u(r)}),trailing:React.createElement(Di,null,n),onPress:function(){z.setString(`${t} - ${n}`),g("Copied to clipboard.",u("toast_copy_link"))}})}var Vo,Di,$o=c(()=>{"use strict";h();S();W();A();({FormRow:Vo,FormText:Di}=y)});function Yn(){return x(d),React.createElement(T,null,React.createElement(f.ScrollView,{style:{flex:1},contentContainerStyle:{padding:24,alignItems:"center"}},React.createElement(Bi,{spacing:16},React.createElement(Li,{title:"Actions"},React.createElement(Mi,{label:"TableRow"}),React.createElement(Oi,{label:"TableSwitchRow",leading:React.createElement(Kn,{source:u("ic_progress_wrench_24px")}),value:d.developerSettings,onValueChange:function(e){d.developerSettings=e}}),React.createElement(Ho,{label:"TableRadio",leading:React.createElement(Kn,{source:u("ic_progress_wrench_24px")}),value:d.developerSettings}),React.createElement(Ho,{label:"Second Radio Row",leading:React.createElement(Kn,{source:u("ic_progress_wrench_24px")}),value:d.developerSettings})))))}var kf,Uf,Gf,Vf,Bi,Mi,Kn,Oi,Li,Ho,$f,jo=c(()=>{"use strict";h();oe();j();S();A();G();({FormRow:kf,FormSwitchRow:Uf,FormSection:Gf,FormDivider:Vf}=y),{Stack:Bi,TableRow:Mi,TableRowIcon:Kn,TableSwitchRow:Oi,TableRowGroup:Li,TableRadioRow:Ho}=q,$f=H()});function Jn(){let e=le.useNavigation();x(d),x(Z);let t=[{label:"Opti",version:k.vendetta.version,icon:"ic_progress_wrench_24px"},{label:"Discord",version:`${k.discord.version} (${k.discord.build})`,icon:"Discord"},{label:"React",version:k.react.version,icon:"ic_category_16px"},{label:"RN",version:k.react.nativeVersion,icon:"mobile"},{label:"Bytecode",version:k.hermes.bytecodeVersion,icon:"ic_server_security_24px"}],n=[{label:"Loader",version:k.vendetta.loader,icon:"ic_download_24px"},{label:"Operating System",version:`${k.os.name} ${k.os.version}`,icon:"ic_cog_24px"},...k.os.sdk?[{label:"SDK",version:k.os.sdk,icon:"ic_profile_badge_verified_developer_color"}]:[],{label:"Manufacturer",version:k.device.manufacturer,icon:"ic_badge_staff"},{label:"Brand",version:k.device.brand,icon:"ic_settings_boost_24px"},{label:"Model",version:k.device.model,icon:"ic_phonelink_24px"},{label:f.Platform.select({android:"Codename",ios:"Machine ID"}),version:k.device.codename,icon:"ic_compose_24px"}];return React.createElement(T,null,React.createElement(f.ScrollView,{style:{flex:1},contentContainerStyle:{padding:20,alignItems:"center"}},React.createElement(Ui,{spacing:16},React.createElement(ut,{title:"Debug",titleStyleType:"no_border"},React.createElement(zo,{value:d.debuggerUrl,onChange:function(r){return d.debuggerUrl=r},placeholder:"127.0.0.1:9090",title:"Debug URL"}),React.createElement(lt,{label:"Connect to websocket",icon:React.createElement(_e,{source:u("copy")}),onPress:function(){return cn(d.debuggerUrl)}}),window.__vendetta_rdc&&React.createElement(React.Fragment,null,React.createElement(lt,{label:"Connect to React DevTools",icon:React.createElement(_e,{source:u("ic_badge_staff")}),onPress:function(){return window.__vendetta_rdc?.connectToDevTools({host:d.debuggerUrl.split(":")?.[0],resolveRNStyle:f.StyleSheet.flatten})}}))),window.__vendetta_loader?.features.loaderConfig&&React.createElement(ut,{title:"Loader config"},React.createElement(Xn,{label:"Load from custom url",subLabel:"Load Opti from a custom endpoint.",icon:React.createElement(_e,{source:u("copy")}),value:Z.customLoadUrl.enabled,onValueChange:function(r){Z.customLoadUrl.enabled=r}}),Z.customLoadUrl.enabled&&React.createElement(React.Fragment,null,React.createElement(zo,{value:Z.customLoadUrl.url,onChange:function(r){return Z.customLoadUrl.url=r},placeholder:"http://localhost:4040/opti.js",title:"Opti URL"})),window.__vendetta_loader.features.devtools&&React.createElement(Xn,{label:"Load React DevTools",subLabel:`Version: ${window.__vendetta_loader.features.devtools.version}`,icon:React.createElement(_e,{source:u("ic_badge_staff")}),value:Z.loadReactDevTools,onValueChange:function(r){Z.loadReactDevTools=r}})),React.createElement(ut,{title:"Other"},React.createElement(lt,{label:"Asset Browser",icon:React.createElement(_e,{source:u("ic_image")}),onPress:function(){return e.push("VendettaCustomPage",{title:"Asset Browser",render:Wn})},arrow:!0}),React.createElement(lt,{label:"Opti Design Sheet",icon:React.createElement(_e,{source:u("ic_paint_brush")}),onPress:function(){return e.push("VendettaCustomPage",{title:"Design Test",render:Yn})},arrow:!0}),React.createElement(lt,{label:"ErrorBoundary Tools",icon:React.createElement(_e,{source:u("ic_warning_24px")}),arrow:!0,onPress:function(){return Gi({key:"ErrorBoundaryTools",header:{title:"Which ErrorBoundary do you want to trip?",icon:React.createElement(Fi.Icon,{style:{marginRight:8},source:u("ic_warning_24px")}),onClose:function(){return ki()}},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(Xn,{label:"Enable Post Loader",subLabel:"Settings menu that shows after Opti has loaded.",icon:React.createElement(_e,{source:u("ic_add_circle")}),value:d.postLoader,onValueChange:function(r){d.postLoader=r}})),React.createElement(ut,{title:"Branch"}),React.createElement(ut,{title:"Info"},React.createElement(He,{label:"Versions",icon:"ic_information_filled_24px"},t.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(Tt,{label:r.label,version:r.version,icon:r.icon}),o!==t.length-1&&React.createElement(Wo,null))})),React.createElement(He,{label:"Platform",icon:"ic_mobile_device"},n.map(function(r,o){return React.createElement(React.Fragment,null,React.createElement(Tt,{label:r.label,version:r.version,icon:r.icon}),o!==n.length-1&&React.createElement(Wo,null))}))))))}var em,Fi,tm,zo,Wo,ki,Ui,lt,_e,Xn,ut,Gi,k,Ko=c(()=>{"use strict";h();w();oe();j();S();A();G();Go();$o();jo();({FormSection:em,FormRow:Fi,FormSwitchRow:tm,FormInput:zo,FormDivider:Wo}=y),{hideActionSheet:ki}=l("openLazy","hideActionSheet"),{Stack:Ui,TableRow:lt,TableRowIcon:_e,TableSwitchRow:Xn,TableRowGroup:ut}=q,{showSimpleActionSheet:Gi}=l("showSimpleActionSheet"),k=H()});var Vi,ft,vt,We,mt,Yo,Zn,At=c(()=>{"use strict";h();fe();J();Me();Be();W();ge();S();G();vn();Ao();No();Oo();ko();Ko();De();Vi=N.createThemedStyleSheet({container:{flex:1,backgroundColor:v.BACKGROUND_MOBILE_PRIMARY}}),ft=function(e,t){return t?wt.snakeCase(e).toUpperCase():e},vt=function(e,t){return Object.fromEntries(e.map(function(n){return[n.key,typeof t=="function"?t(n):typeof t=="string"?n[t]:t]}))},We=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return[{key:ft("VendettaSettings",e),title:"Opti",icon:"settings",render:kn},{key:ft("VendettaPlugins",e),title:"Plugins",icon:"debug",options:{headerRight:function(){return React.createElement(xt,{alertTitle:"Install Plugin",installFunction:async function(t){if(!t.startsWith(Pe)&&!d.developerSettings)setImmediate(function(){return Q({title:"Unproxied Plugin",content:"The plugin you are trying to install has not been verified by Opti staff. Are you sure you want to continue?",confirmText:"Install",onConfirm:function(){return be(t).then(function(){return g("Installed plugin",u("Check"))}).catch(function(n){return g(n?.message??`${n}`,u("Small"))})},cancelText:"Cancel"})});else return await be(t)}})}},render:$n},{key:ft("VendettaThemes",e),title:"Themes",icon:"ic_theme_24px",shouldRender:function(){return window.__vendetta_loader?.features.hasOwnProperty("themes")??!1},options:{headerRight:function(){return!d.safeMode?.enabled&&React.createElement(xt,{alertTitle:"Install Theme",installFunction:Ae})}},render:jn},{key:ft("VendettaDeveloper",e),title:"Developer",icon:"ic_report_message",shouldRender:function(){return d.developerSettings??!1},render:Jn},{key:ft("VendettaCustomPage",e),title:"Opti",shouldRender:function(){return!1},render:function(t){let{render:n,noErrorBoundary:r,...o}=t,a=le.useNavigation();return a.addListener("focus",function(){return a.setOptions(X(o,"render","noErrorBoundary"))}),r?React.createElement(n,null):React.createElement(T,null,React.createElement(n,null))}}]},mt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return We(e).filter(function(t){return t.shouldRender?.()??!0})},Yo=function(){return vt(We(),function(e){return{title:e.title,render:e.render,...e.options}})},Zn=function(){let e=We(!0);return{getLayout:function(){return{title:"Opti",label:"Opti",settings:mt(!0).map(function(t){return t.key})}},titleConfig:vt(e,"title"),relationships:vt(e,null),rendererConfigs:vt(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(f.View,{style:Vi.container},React.createElement(t.render,a.params))});return{type:"route",title:function(){return t.title},icon:t.icon?u(t.icon):null,screen:{route:wt.chain(t.key).camelCase().upperFirst().value(),getComponent:function(){return n}}}})}}});function Qn(){let e=le.useNavigation();x(d);let t=mt();return React.createElement(T,null,React.createElement($i,{key:"Vendetta",title:"Opti"},t.map(function(n,r){return React.createElement(React.Fragment,null,React.createElement(qn,{label:n.title,leading:React.createElement(qn.Icon,{source:u(n.icon)}),trailing:qn.Arrow,onPress:function(){return e.push(n.key)}}),r!==t.length-1&&React.createElement(Hi,null))})))}var qn,$i,Hi,Xo=c(()=>{"use strict";h();j();S();At();A();G();({FormRow:qn,FormSection:$i,FormDivider:Hi}=y)});function er(){let e=new Array;return e.push(R("default",ji,function(t,n){return{...n,...Yo()}})),R("default",zi,function(t,n){let r=ae(n.props.children,function(o){return o.type&&o.type.name==="UserSettingsOverview"});e.push(R("renderSupportAndAcknowledgements",r.type.prototype,function(o,a){let{props:{children:i}}=a,s=i.findIndex(function(m){return m?.type?.name==="UploadLogsButton"});s!==-1&&i.splice(s,1)})),e.push(R("render",r.type.prototype,function(o,a){let{props:{children:i}}=a,s=[Ne.Messages.BILLING_SETTINGS,Ne.Messages.PREMIUM_SETTINGS];i=ae(i,function(p){return p.children?.[1].type?.name==="FormSection"}).children;let m=i.findIndex(function(p){return s.includes(p?.props.label)});i.splice(m===-1?4:m,0,React.createElement(Qn,null))}))},!0),function(){return e.forEach(function(t){return t()})}}var ji,zi,Jo=c(()=>{"use strict";h();w();U();ge();At();Xo();ji=M("getScreens",!1),zi=M("UserSettingsOverviewWrapper",!1)});function nr(){let e=new Array;return Ki(e)||Wi(e),function(){return e.forEach(function(t){return t?.()})}}function Wi(e){let t=l("useOverviewSettings"),n=l("getSettingTitleConfig"),r=l("SETTING_RELATIONSHIPS","SETTING_RENDERER_CONFIGS"),o="getSettingSearchListItems",a="getSettingListItems",i=l(o),s=!i,m=s?a:o,p=i??l(a);if(!p||!t)return;let E=We(!0),C=mt(!0),b=Zn();e.push(R("useOverviewSettings",t,function(Se,Ye){return Zo(Ye,b.getLayout())})),e.push(R("getSettingTitleConfig",n,function(Se,Ye){return{...Ye,...b.titleConfig}})),e.push(R(m,p,function(Se,Ye){let[ga]=Se;return[...C.filter(function(ee){return ga.includes(ee.key)}).map(function(ee){return{type:"setting_search_result",ancestorRendererData:b.rendererConfigs[ee.key],setting:ee.key,title:b.titleConfig[ee.key],breadcrumbs:["Vendetta"],icon:b.rendererConfigs[ee.key].icon}}),...Ye.filter(function(ee){return s||!E.map(function(Ct){return Ct.key}).includes(ee.setting)})].map(function(ee,Ct,ha){return{...ee,index:Ct,total:ha.length}})}));let I=r.SETTING_RELATIONSHIPS,P=r.SETTING_RENDERER_CONFIGS;return r.SETTING_RELATIONSHIPS={...I,...b.relationships},r.SETTING_RENDERER_CONFIGS={...P,...b.rendererConfigs},e.push(function(){r.SETTING_RELATIONSHIPS=I,r.SETTING_RENDERER_CONFIGS=P}),!0}function Ki(e){let t=l("SearchableSettingsList"),n=l("SETTING_RENDERER_CONFIG"),r=l("getSettingListItems");if(!r||!t||!n)return!1;let o=We(!0),a=Zn();e.push(kt("type",t.SearchableSettingsList,function(s){let[{sections:m}]=s;return Zo(m,a.getLayout())})),e.push(R("getSettingListSearchResultItems",r,function(s,m){m.forEach(function(p){return o.some(function(E){return E.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 Zo(e,t){if(!Array.isArray(e)||e.find(function(o){return tr(o,"Vendetta")}))return;let n=e.findIndex(function(o){return tr(o,Ne.Messages.ACCOUNT_SETTINGS)});e.splice(n+1,0,t);let r=e.find(function(o){return tr(o,Ne.Messages.SUPPORT)});r&&(r.settings=r.settings.filter(function(o){return o!=="UPLOAD_DEBUG_LOGS"}))}var tr,qo=c(()=>{"use strict";w();U();At();h();tr=function(e,t){return e?.label===t||e?.title===t}});function rr(){let e=[er(),nr()];return function(){return e.forEach(function(t){return t?.()})}}var Qo=c(()=>{"use strict";Jo();qo()});function na(e){let{locale:t}=e;try{ea&&(ea.overrideTheme(Yi?.theme??"dark"),ta&&Xi.useAMOLEDTheme===2&&ta.setAMOLEDThemeEnabled(!0))}catch(n){O.error("Failed to fix theme...",n)}try{tn.locale(t.toLowerCase())}catch(n){O.error("Failed to fix timestamps...",n)}bt.unsubscribe("I18N_LOAD_SUCCESS",na)}function ra(){return bt.subscribe("I18N_LOAD_SUCCESS",na)}var ea,ta,Yi,Xi,oa=c(()=>{"use strict";h();w();ve();ea=l("updateTheme","overrideTheme"),ta=l("setAMOLEDThemeEnabled"),Yi=Le("ThemeStore"),Xi=Le("UnsyncedUserSettingsStore")});async function aa(e){return{patcher:X(br,"unpatchAll"),metro:{...Pt,common:{...nn}},constants:Tn,utils:Mt,debug:X(un,"versionHash","patchLogHook","toggleSafeMode"),ui:{components:Dn,toasts:an,alerts:On,assets:on,...An},plugins:X(bn,"initPlugins","evalPlugin"),themes:X(Zt,"initThemes"),commands:X(mn,"patchCommands"),storage:Wt,settings:d,loader:{identity:window.__vendetta_loader,config:Z},logger:O,version:_t,unload:function(){e.filter(function(t){return typeof t=="function"}).forEach(function(t){return t()}),delete window.vendetta}}}var ia=c(()=>{"use strict";U();ve();G();De();oe();fe();J();dn();j();w();h();A();W();Me();S();Be();ge()});var Ji,Zi,qi,sa,ca=c(()=>{"use strict";h();({View:Ji,Image:Zi,TouchableOpacity:qi}=f),sa=function(e){let{name:t,image:n,size:r,margin:o,custom:a}=e,i=N.createThemedStyleSheet({container:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end"},img:{width:r,height:r,resizeMode:"contain",marginHorizontal:o}}),s=function(){return a||_.createElement(qi,{onPress:function(){return qe.open({content:t,source:{uri:n}})}},_.createElement(Zi,{style:i.img,source:{uri:n}}))};return _.createElement(Ji,{style:i.container},s())}});function la(){let e=M("ProfileBadges",!1);ts=R("default",e,function(t,n){let r=n,[,o]=_.useReducer(function(m){return m=!m},!1),a=t[0]?.user;if(a===void 0)return;if(or=Ke.get(a.id),or===void 0){ns(a.id,o);return}let i=r?.props?.style;r||(r=_.createElement(Qi,{style:[i,{flexDirection:"row",flexWrap:"wrap",alignItems:"flex-end",justifyContent:"flex-end",paddingVertical:2}],accessibilityRole:"list",accessibilityLabel:"User Badges"}),r.props.children=[]);let s=function(m){let{name:p,image:E,custom:C=!1}=m,b=function(){return _.createElement(sa,{custom:C,name:p,image:E,size:Array.isArray(i)?i?.find(function(P){return P.paddingVertical&&P.paddingHorizontal})?16:22:16,margin:Array.isArray(i)?4:6})},I="PUSH";r?.props?.badges?I?r.props.badges=[_.createElement(b,null),...r.props.badges]:r.props.badges=[...r.props.badges,_.createElement(b,null)]:I?r.props.children=[_.createElement(b,null),...r.props.children]:r.props.children=[...r.props.children,_.createElement(b,null)]};Object.entries(or?.badges).forEach(function(m){let[p,E]=m;switch(p){case"opti":E?.developer&&s({name:"Opti Developer",image:"https://raw.githubusercontent.com/Opti-mod/assets/main/BadgeDeveloper.png"}),E?.contributor&&s({name:"Opti Contributor",image:"https://raw.githubusercontent.com/Opti-mod/assets/main/BadgeContributor.png"}),E?.supporter&&s({name:"Opti Supporter",image:"https://raw.githubusercontent.com/Opti-mod/assets/main/BadgeSupporter.png"});break;default:break}})})}async function ns(e,t){if(!Ke.has(e)||Ke.get(e).lastFetch+es<Date.now()){let n=await fetch(`https://raw.githubusercontent.com/Opti-mod/badges/main/${e}.json`),r=await n.json(),o=n.status===200||n.status===404?{badges:r||{},lastFetch:Date.now()}:(Ke.delete(e),{badges:r,lastFetch:Date.now()});Ke.set(e,o),t()}return Ke.get(e).badges}var Qi,Ke,es,ts,or,ua=c(()=>{"use strict";w();U();h();ca();({View:Qi}=f),Ke=new Map,es=1e3*60*30});function fa(){let{showSimpleActionSheet:e}=l("showSimpleActionSheet");console.log("Loading Opti Security"),window.vendetta.settings.developerSettings&&window.vendetta.settings.postLoader&&e({key:"OptiPostload",header:{title:"Opti Post Loader",onClose:function(){return rs()}},options:[{label:"Toggle Safe Mode",onPress:function(t){window.vendetta.settings.safeMode?.enabled==!0,g("Loading Opti in safe mode.")}},{label:"Load without Opti",onPress:function(){alert("Not functional yet..")}}]})}var rs,id,sd,cd,ld,ud,ma=c(()=>{"use strict";w();A();W();({hideActionSheet:rs}=l("openLazy","hideActionSheet")),{Stack:id,TableRow:sd,TableRowIcon:cd,TableSwitchRow:ld,TableRowGroup:ud}=q});var da={};D(da,{default:()=>os});async function os(){let e=await Promise.all([ln(),rn(),fn(),Yt(),ra(),To(),rr(),Ln(),la()]);window.vendetta=await aa(e),e.push(await Rn()),e.push(await fa()),O.log("Opti is ready!")}var pa=c(()=>{"use strict";oe();dn();fe();J();S();Eo();vo();Qo();oa();ve();ia();ua();ma()});pe();oe();var as=H();console.log("Hello from Opti!");Object.freeze=Object;Object.seal=Object;Promise.resolve().then(()=>(pa(),da)).then(function(e){return e.default()}).catch(function(e){console.log("Opti encountered an issue. "+e?.stack),alert([`Failed to load Opti! The error is in console logs.
`,`Build: ${Xe.Build}`,"Opti: 8e2f275",`Discord Version: ${as.discord.version}`].join(`
`))});})();
//# sourceURL=Opti