From 6afbf697cf2c1a3c7ed2798e298ee99e43b71d6f Mon Sep 17 00:00:00 2001 From: everestmcarthur Date: Sun, 2 Aug 2026 13:30:56 +0000 Subject: [PATCH] deploy: c070c7d8dcc230c0f19d91d92cace679c98c27b7 --- server-drawer/install/index.js | 2 +- server-drawer/install/manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server-drawer/install/index.js b/server-drawer/install/index.js index 1367e2d..2f1fb4a 100644 --- a/server-drawer/install/index.js +++ b/server-drawer/install/index.js @@ -1 +1 @@ -(function(v,N,f,c,o,r,a,ee,D,L,te,Ne){"use strict";function E(e){const t=window?.modules;if(t)for(const n in t){const s=t[n];if(!s?.isInitialized)continue;const i=s.publicModule?.exports;if(i)try{if(e(i))return i;if(i.default!=null&&e(i.default))return i.default}catch{}}}function w(...e){return E(function(t){return e.every(function(n){return t?.[n]!==void 0})})}function P(...e){return E(function(t){return e.every(function(n){return typeof t?.[n]=="function"})})}function et(e){return E(function(t){return typeof t?.getName=="function"&&t.getName.length===0&&t.getName()===e})}function tt(e){const t=P("useIsMobileQuestDockRendered");if(!t?.useIsMobileQuestDockRendered)return!1;const n=t.useIsMobileQuestDockRendered;return t.useIsMobileQuestDockRendered=function(...s){return n.apply(this,s),!0},e.push(function(){t.useIsMobileQuestDockRendered=n}),!0}function nt(e){const t=P("useIsMobileQuestDockRenderedBase");if(!t?.useIsMobileQuestDockRenderedBase)return!1;const n=t.useIsMobileQuestDockRenderedBase;return t.useIsMobileQuestDockRenderedBase=function(...s){return n.apply(this,s),!0},e.push(function(){t.useIsMobileQuestDockRenderedBase=n}),!0}function ot(e){const t=P("useIsMobileQuestDockVisibleToUser");if(!t?.useIsMobileQuestDockVisibleToUser)return!1;const n=t.useIsMobileQuestDockVisibleToUser;return t.useIsMobileQuestDockVisibleToUser=function(...s){return n.apply(this,s),!0},e.push(function(){t.useIsMobileQuestDockVisibleToUser=n}),!0}function rt(e){const t=P("useMobileQuestDock");if(!t?.useMobileQuestDock)return!1;const n=t.useMobileQuestDock;return t.useMobileQuestDock=function(...s){return n.apply(this,s)||{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:null,questBarHero:null},features:[]},userStatus:{enrolledAt:"2099-01-01",claimedAt:null},benefits:{rewards:[]},guildId:"0",tasks:[]}},e.push(function(){t.useMobileQuestDock=n}),!0}const st="[ServerDrawer]";function it(e){const t=P("getQuestAsset");if(!t?.getQuestAsset)return console.log(st,"WARN: getQuestAsset not found"),!1;const n=t.getQuestAsset;return t.getQuestAsset=function(...s){try{return n.apply(this,s)}catch{return{url:null,isAnimated:!1}}},e.push(function(){t.getQuestAsset=n}),!0}function S(e){let t,n=!1;return function(){if(n)return t;const s=e();return s!=null&&(t=s,n=!0),s??void 0}}const me=a.findByStoreName("GuildStore"),lt=a.findByProps("useStateFromStores"),at=a.findByProps("colors","unsafe_rawColors")?.colors;function be({id:e,size:t=48}){const n=lt?.useStateFromStores?.([me],function(){return me?.getGuild?.(e)},[e])??null;if(!n)return null;const s=t>=40?16:8;return n.icon?o.createElement(r.Image,{source:{uri:`https://cdn.discordapp.com/icons/${n.id}/${n.icon}.png?size=${t*2}`},style:{width:t,height:t,borderRadius:s}}):o.createElement(r.View,{style:[Ce.fallback,{width:t,height:t,borderRadius:s,backgroundColor:at?.BG_ACCENT??"#5865f2"}]},o.createElement(r.Text,{style:[Ce.letter,{fontSize:Math.max(10,t*.4)}]},n.name?.split(" ").map(function(i){return i[0]}).join("").slice(0,2).toUpperCase()||"?"))}const Ce=r.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),ut=a.findByStoreName("ThemeStore"),ct=a.find(function(e){return e?.default?.internal?.resolveSemanticColor})?.default?.internal?.resolveSemanticColor??a.find(function(e){return e?.meta?.resolveSemanticColor})?.meta?.resolveSemanticColor??function(){};function dt(e,t=ut?.theme){if(e)try{return ct(t,e)}catch{return}}const Se=a.findByProps("TextStyleSheet")?.TextStyleSheet,ke=a.findByProps("triggerHapticFeedback","HapticFeedbackTypes");function j(e,t){return dt(e)??t}const F=12,ne=12,Ee=42,oe=220,we=4,x=16,O=20,De={tension:200,friction:20};function ft({visible:e,items:t,title:n,anchorX:s,anchorY:i,onClose:l}){const{width:u,height:g}=r.Dimensions.get("window"),p=(n?ne+20+we:0)+t.length*Ee;let b=s,y=i+48+10;b+oe>u-F&&(b=u-oe-F),bg-F&&(y=i-p-10),y0?o.createElement(r.View,{style:A.outline},o.createElement(r.View,{style:A.badge},o.createElement(r.Text,{style:A.text},t>99?"99+":String(t)))):n?o.createElement(r.View,{style:A.dotOutline},o.createElement(r.View,{style:A.dot})):null:null}function Fe({node:e,onPick:t}){const n=o.useRef(null),s=o.useRef(new r.Animated.Value(1)).current,i=function(){return r.Animated.spring(s,{toValue:.85,useNativeDriver:!0}).start()},l=function(){return r.Animated.spring(s,{toValue:1,useNativeDriver:!0}).start()},[u,g]=o.useState({visible:!1,items:[],title:"",x:0,y:0}),p=o.useCallback(function(){const m=e.id,d=ht?.getGuild?.(m);if(!d)return;const C=n.current;if(!C?.measure)return;const B=[{label:"Mark as Read",action:function(){return mt(m)}},{label:"Copy Server ID",action:function(){c.clipboard.setString(m),D.showToast("Copied server ID",void 0)}}];C.measure(function(G,Q,M,fe,$,T){g({visible:!0,items:B,title:d.name,x:$,y:T})})},[e.id]),b=o.useCallback(function(){Re?.triggerHapticFeedback?.(Re.HapticFeedbackTypes.IMPACT_MEDIUM),p()},[p]),y=e.id;return o.createElement(o.Fragment,null,o.createElement(r.Pressable,{onPressIn:i,onPressOut:l,onPress:function(){return t(y)},onLongPress:b,delayLongPress:500},o.createElement(r.View,{ref:n,style:Be.outer,collapsable:!1},o.createElement(r.Animated.View,{style:[Be.icon,{transform:[{scale:s}]}]},o.createElement(be,{id:y})),o.createElement(bt,{guildId:y}))),o.createElement(ft,{visible:u.visible,items:u.items,title:u.title,anchorX:u.x,anchorY:u.y,onClose:function(){return g(function(m){return{...m,visible:!1}})}}))}const Be=r.StyleSheet.create({outer:{width:_,height:_},icon:{width:_,height:_,borderRadius:16,overflow:"hidden"}}),A=r.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19},dotOutline:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},dot:{width:10,height:10,borderRadius:5,backgroundColor:"#ed4245"}}),Ct=a.findByProps("useStateFromStores");a.findByProps("colors","unsafe_rawColors")?.colors;const Te=a.findByStoreName("ExpandedGuildFolderStore");function St(e){return Ct?.useStateFromStores?.([Te],function(){const t=Te?.getExpandedFolders?.();return t instanceof Set?t.has(e):!1},[e])??!1}const kt=a.findByProps("toggleGuildFolderExpand"),Et=a.findByProps("useStateFromStores"),Pe=a.findByStoreName("GuildReadStateStore"),I=48,ie=16,wt=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],xe=te.getAssetIDByName("FolderIcon");function Ae(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function Dt({node:e}){const t=Et?.useStateFromStores?.([Pe],function(){let n=0;for(const s of e.children)n+=Pe?.getMentionCount?.(s.id)??0;return n},[e.children])??0;return t>0?o.createElement(r.View,{style:ae.outline},o.createElement(r.View,{style:ae.badge},o.createElement(r.Text,{style:ae.text},t>99?"99+":String(t)))):null}function It({node:e}){ee.useProxy(f.storage);const t=Ae(e.color);return o.createElement(r.View,{style:z.outer},o.createElement(r.View,{style:[z.icon,{backgroundColor:t}]},f.storage.hideFolderIcons?o.createElement(r.View,{style:z.plainIcon},o.createElement(r.Image,{source:xe,style:le.folderImg,tintColor:"#fff"})):e.children.slice(0,4).map(function(n,s){return o.createElement(r.View,{key:n.id,style:[z.cell,wt[s]]},o.createElement(be,{id:n.id,size:ie}))})),o.createElement(Dt,{node:e}))}const z=r.StyleSheet.create({outer:{width:I,height:I},icon:{width:I,height:I,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:ie,height:ie,borderRadius:8,overflow:"hidden"},plainIcon:{width:I,height:I,alignItems:"center",justifyContent:"center"}});function Rt({children:e}){const t=o.useRef(new r.Animated.Value(0)).current;return o.useEffect(function(){r.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),o.createElement(r.Animated.View,{style:{opacity:t}},e)}function Ft({node:e,onPick:t}){const n=St(e.id),s=function(){kt?.toggleGuildFolderExpand?.(e.id)};return n?o.createElement(o.Fragment,null,o.createElement(r.Pressable,{onPress:s},o.createElement(r.View,{style:[le.openIcon,{backgroundColor:Ae(e.color)}]},o.createElement(r.Image,{source:xe,style:le.folderImg,tintColor:"#fff"}))),e.children.map(function(i){return o.createElement(Rt,{key:i.id},o.createElement(Fe,{node:i,onPick:t}))})):o.createElement(r.Pressable,{onPress:s},o.createElement(It,{node:e}))}const le=r.StyleSheet.create({openIcon:{width:I,height:I,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),ae=r.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19}}),W=48,Bt=te.getAssetIDByName("ChatIcon"),Ve=a.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),He=a.findByProps("selectPrivateChannel"),Tt=a.findByName("SelectedChannelStore"),Pt=a.findByProps("useStateFromStores"),Ge=a.findByProps("getGuildId"),xt=a.findByProps("colors","unsafe_rawColors")?.colors;function At(){if(Ve?.triggerHapticFeedback(Ve.HapticFeedbackTypes.SOFT),He?.selectPrivateChannel){const e=Tt?.getLastSelectedChannelId?.();He.selectPrivateChannel(e)}}function Vt(){const e=Pt?.useStateFromStores?.([Ge],function(){return Ge?.getGuildId?.()==null})??!1;return o.createElement(r.Pressable,{onPress:At,style:Qe.outer},o.createElement(r.View,{style:[Qe.icon,{backgroundColor:e?xt?.BG_ACCENT??"#5865f2":"rgba(128,128,128,0.24)"}]},o.createElement(r.Image,{source:Bt,style:{width:24,height:24,tintColor:"#fff"}})))}const Qe=r.StyleSheet.create({outer:{width:W,height:W},icon:{width:W,height:W,borderRadius:16,alignItems:"center",justifyContent:"center"}}),Me=48,Ht=te.getAssetIDByName("CheckmarkLargeIcon"),Gt=a.findByStoreName("SortedGuildStore"),q=a.findByStoreName("GuildChannelStore"),Qt=a.findByStoreName("ChannelStore"),Mt=S(function(){return w("triggerHapticFeedback","HapticFeedbackTypes")}),vt=S(function(){return w("bulkAck","ackChannel")}),Lt=S(function(){return w("ReadStateTypes","UnreadSetting")?.ReadStateTypes});function jt(){const e=(Gt?.getGuildsTree?.()?.root?.children??[]).filter(function(s){return s?.type!=="root"}),t=[],n=function(s){for(const i of s)i.type==="folder"?n(i.children??[]):i.id!=null&&t.push(String(i.id))};return n(e),t}function Ot(){const e=vt(),t=Lt();if(!e?.bulkAck||t?.CHANNEL==null||!q?.getSelectableChannelIds||!q?.getVocalChannelIds){D.showToast("Couldn't find Discord's read-state action - this may be unavailable on your version.",void 0);return}const n=jt();if(n.length===0){D.showToast("Nothing to mark as read.",void 0);return}const s=[];for(const i of n){const l=[...q.getSelectableChannelIds(i)??[],...q.getVocalChannelIds(i)??[]];for(const u of l)s.push({channelId:u,readStateType:t.CHANNEL,messageId:Qt?.getChannel?.(u)?.lastMessageId??null})}if(s.length===0){D.showToast("Nothing to mark as read.",void 0);return}e.bulkAck(s),D.showToast(`Marked ${s.length} channel${s.length===1?"":"s"} as read`,void 0)}function _t(){const e=o.useCallback(function(){const t=Mt();t?.triggerHapticFeedback?.(t.HapticFeedbackTypes.SOFT),Ot()},[]);return o.createElement(r.Pressable,{onPress:e,style:Ut.outer},o.createElement(r.Image,{source:Ht,style:{width:24,height:24,tintColor:"#80848e"}}))}const Ut=r.StyleSheet.create({outer:{width:Me,height:Me,alignItems:"center",justifyContent:"center"}}),zt=a.findByProps("useStateFromStores"),ve=a.findByStoreName("SortedGuildStore"),Wt=S(function(){return w("getRootNavigationRef")}),Le=S(function(){return w("triggerHapticFeedback","HapticFeedbackTypes")}),qt=S(function(){return w("transitionToGuild")}),Xt=S(function(){return E(function(e){return typeof e?.handleCreateJoinGuildPress=="function"})}),Jt=S(function(){return E(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon}),Kt=S(function(){return w("colors","unsafe_rawColors")?.unsafe_rawColors}),Yt=a.find(function(e){return e?.QuestDockExternalCoordinationContext}),je=Yt?.QuestDockExternalCoordinationContext,Oe=a.find(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode,X=48,J=6,Zt=12;function $t(){const e=o.useRef(new r.Animated.Value(1)).current,t=o.useCallback(function(){r.Animated.spring(e,{toValue:.9,useNativeDriver:!0}).start()},[e]),n=o.useCallback(function(){r.Animated.spring(e,{toValue:1,useNativeDriver:!0}).start()},[e]),s=o.useCallback(function(){const u=Le();u?.triggerHapticFeedback?.(u.HapticFeedbackTypes.SOFT),Xt()?.handleCreateJoinGuildPress?.()},[]),i=Jt(),l=Kt();return o.createElement(r.Pressable,{onPress:s,onPressIn:t,onPressOut:n},o.createElement(r.Animated.View,{style:[K.createJoin,{backgroundColor:l?.GREEN_360,transform:[{scale:e}]}]},i?o.createElement(i,{size:"md",color:l?.WHITE}):o.createElement(r.Text,{style:[K.createJoinFallback,{color:l?.WHITE}]},"+")))}function _e({gestureContext:e}){const t=o.useCallback(function(d){const C=Le();C?.triggerHapticFeedback?.(C.HapticFeedbackTypes.SOFT);const B=qt();B?.transitionToGuild?B.transitionToGuild(d):Wt()?.getRootNavigationRef?.()?.navigate("guilds",{guildId:d})},[]),n=zt?.useStateFromStores?.([ve],function(){return(ve?.getGuildsTree()?.root?.children||[]).filter(function(d){return d.type!=="root"})})??[],s=e?o.useContext(e):null,i=s?.minExpandedContentHeight,l=o.useCallback(function(d){if(!i)return;const C=d.nativeEvent.layout.height;i.get()!==C&&i.set(C)},[i]),u=(je?o.useContext(je):null)?.setRestingQuestDockMode,g=s?.questDockWrapperSpecs;o.useEffect(function(){if(!u||!Oe||!g)return;const d=r.BackHandler.addEventListener("hardwareBackPress",function(){return(g.get()?.height??56)>80?(u(Oe.COLLAPSED),!0):!1});return function(){return d.remove()}},[u,g]);const{width:p}=r.Dimensions.get("window"),b=Math.max(3,Math.floor((p-Zt*2+J)/(X+J))),y=b*X+(b-1)*J,m=Math.max(0,(p-y)/2);return o.createElement(r.View,{style:K.alignTop},o.createElement(r.View,{style:[K.grid,{paddingHorizontal:m,gap:J}],onLayout:l},o.createElement(Vt,null),n.map(function(d){return d.type==="folder"?o.createElement(Ft,{key:d.id,node:d,onPick:t}):o.createElement(Fe,{key:d.id,node:d,onPick:t})}),o.createElement($t,null),o.createElement(_t,null)))}const K=r.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16},createJoin:{width:X,height:X,borderRadius:16,alignItems:"center",justifyContent:"center"},createJoinFallback:{fontSize:28,fontWeight:"700",lineHeight:30}});function Nt(e,t,n=100){let s=!1,i;const l=e();return l?(t(l),{cancel(){}}):(i=setInterval(function(){if(s)return;const u=e();u&&(s=!0,clearInterval(i),t(u))},n),{cancel(){s=!0,i&&clearInterval(i)}})}const ue=new Map,Ue=[];let V=[],Y=!1;function ze(e,t,n){ue.set(e,{replacement:t,extraProps:n})}function en(e,t){V.push({predicate:e,onDetected:t})}function tn(e){if(V.length===0)return;const t=[];for(const n of V){let s=!1;try{s=n.predicate(e)}catch{}if(s)try{n.onDetected(e)}catch{}else t.push(n)}V=t}function We(e,t){if(tn(e),t)for(const{predicate:s,replacement:i}of Ue)try{if(s(t))return i?{type:i,props:t}:null}catch{}const n=ue.get(e);if(n)return{type:n.replacement,props:n.extraProps?{...t,...n.extraProps}:t}}function nn(e){if(Y)return;const t=c.React.createElement;if(!t){console.warn("[ServerDrawer] React.createElement is null, skipping patch");return}const n=function(l,u,...g){const p=We(l,u);return p===null?null:p?t.call(c.React,p.type,p.props,...g):t.call(c.React,l,u,...g)};Object.assign(n,t),c.React.createElement=n,Y=!0;const s=[],i=Nt(function(){return E(function(l){return typeof l?.jsx=="function"&&typeof l?.jsxs=="function"&&"Fragment"in l})},function(l){for(const u of["jsx","jsxs"]){const g=l[u];typeof g=="function"&&(l[u]=function(p,b,...y){const m=We(p,b);return m===null?null:m?g.call(this,m.type,m.props,...y):g.call(this,p,b,...y)},s.push(function(){l[u]=g}))}});e.push(function(){i.cancel(),Y&&(c.React.createElement=t,Y=!1),s.forEach(function(l){return l()}),ue.clear(),Ue.length=0,V=[]})}const ce="[ServerDrawer]";let de=null;function qe(){return de||(de=E(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),de}function on(e){const t=E(function(s){return s?.type?.displayName==="QuestDockContentExpanded"||s?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(ce,"WARN: QuestDockContentExpanded not found (will retry)"),!1;const n=t.type;return ze(n,_e,{gestureContext:qe()}),t.type=function(){return c.React.createElement(_e,{gestureContext:qe()})},e.push(function(){t.type=n}),console.log(ce,"PATCH: QuestDockContentExpanded replaced"),!0}function H(e,t){const n=E(function(l){return l?.type?.displayName===e||l?.type?.name===e});if(!n?.type)return console.log(ce,`WARN: ${e} not found`),!1;const s=n.type,i=s;return n.type=function(){return null},i&&(Object.defineProperties(n.type,Object.getOwnPropertyDescriptors(i)),n.type.displayName=e),t.push(function(){n.type=s}),!0}const Xe="[ServerDrawer]";function rn(){return null}function sn(e){return e?.name==="GuildsBar"||e?.displayName==="GuildsBar"}function ln(e){return en(sn,function(t){ze(t,rn),console.log(Xe,"PATCH: found the real GuildsBar reference, now rendering nothing")}),e.push(function(){}),console.log(Xe,"PATCH: watching for the real GuildsBar to appear"),!0}function an(e){const t=et("ExpandedGuildFolderStore");if(!t?.getExpandedFolders)return!1;const n=function({folderId:s}){if(!f.storage.autoCollapseFolders||s==null)return;const i=t.getExpandedFolders();if(!(!(i instanceof Set)||!i.has(s)))for(const l of i)l!==s&&c.FluxDispatcher.dispatch({type:"TOGGLE_GUILD_FOLDER_EXPAND",folderId:l})};return c.FluxDispatcher.subscribe("TOGGLE_GUILD_FOLDER_EXPAND",n),e.push(function(){return c.FluxDispatcher.unsubscribe("TOGGLE_GUILD_FOLDER_EXPAND",n)}),!0}const{ScrollView:un,View:cn}=c.ReactNative;function dn({children:e}){return c.React.createElement(un,{style:{flex:1}},e,c.React.createElement(cn,{style:{height:24}}))}const{View:fn,Text:hn}=c.ReactNative;function Je({children:e,style:t}){return c.React.createElement(fn,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},t]},c.React.createElement(hn,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},e))}const{FormSection:Ke,FormSwitchRow:Z}=Ne.Forms;function gn(){return ee.useProxy(f.storage),c.React.createElement(dn,null,c.React.createElement(Je,null,"Server Drawer takes over the Quest Dock (the strip above the tab bar) to show your servers as a grid instead - tap to expand, long-press a server for its usual context menu, the chat bubble jumps to DMs, the + button creates or joins a server through Discord's own modal, and the check button marks every channel in every server as read."),c.React.createElement(Ke,{title:"Layout"},c.React.createElement(Z,{label:"Hide the left server rail",subLabel:"Your servers and DMs already live in the drawer, so the rail is redundant",value:f.storage.hideGuildsBar!==!1,onValueChange:function(e){f.storage.hideGuildsBar=e,$e()}}),c.React.createElement(Z,{label:"Unread badges",subLabel:"Show mention counts and unread dots on server icons in the drawer",value:f.storage.showUnreadBadges!==!1,onValueChange:function(e){f.storage.showUnreadBadges=e}})),c.React.createElement(Ke,{title:"Folders"},c.React.createElement(Z,{label:"Auto-collapse other folders",subLabel:"Opening a folder collapses any other folder that was already open",value:!!f.storage.autoCollapseFolders,onValueChange:function(e){f.storage.autoCollapseFolders=e}}),c.React.createElement(Z,{label:"Hide icons in collapsed folders",subLabel:"Show a plain folder icon instead of a 4-server preview",value:!!f.storage.hideFolderIcons,onValueChange:function(e){f.storage.hideFolderIcons=e}})),c.React.createElement(Je,null,"The folder options above are ported from fres621's BetterFolders - its other half (hiding icons in the native left server rail) patched a component that no longer exists in current Discord builds, so it's been rebuilt here instead, where it actually applies to what you see."))}let h=[],k;function pn(e,t){try{return t()}catch(n){return N.logger.error(`[ServerDrawer] "${e}" patch threw, skipping: ${n}`),!1}}function Ye(){const e={questDockRender:function(){return tt(h)},questDockBase:function(){return nt(h)},questDockVisible:function(){return ot(h)},mobileQuestDock:function(){return rt(h)},getQuestAsset:function(){return it(h)},expanded:function(){return on(h)},collapsed:function(){return H("QuestDockContentCollapsed",h)},enrolledHeader:function(){return H("QuestDockEnrolledHeader",h)},unenrolledHeader:function(){return H("QuestDockUnenrolledHeader",h)},enrolledBody:function(){return H("QuestDockEnrolledBody",h)},unenrolledBody:function(){return H("QuestDockUnenrolledBody",h)},autoCollapseFolders:function(){return an(h)},...f.storage.hideGuildsBar?{hideGuildsBar:function(){return ln(h)}}:{}};nn(h);const t=new Set(Object.keys(e)),n=new Set,s=function(){for(const i of t)pn(i,e[i])&&(n.add(i),t.delete(i));t.size===0&&k&&(clearInterval(k),k=void 0)};if(s(),t.size>0){let i=0;k=setInterval(function(){s(),++i>=50&&k&&(clearInterval(k),k=void 0,t.size>0&&N.logger.error(`[ServerDrawer] Gave up waiting on: ${[...t].join(", ")}`))},200)}N.logger.log(`[ServerDrawer] onLoad: applied immediately - ${[...n].join(", ")||"none"}${t.size?`, still waiting on ${[...t].join(", ")}`:""}`)}function Ze(){k&&(clearInterval(k),k=void 0);for(const e of h)try{e()}catch{}h=[]}function $e(){Ze(),Ye()}var yn={onLoad:function(){f.storage.hideGuildsBar??=!0,f.storage.showUnreadBadges??=!0,f.storage.autoCollapseFolders??=!1,f.storage.hideFolderIcons??=!1,Ye()},onUnload:function(){return Ze()},settings:gn};return v.default=yn,v.restart=$e,Object.defineProperty(v,"__esModule",{value:!0}),v})({},vendetta,vendetta.plugin,vendetta.metro.common,window.React,vendetta.metro.common.ReactNative,vendetta.metro,vendetta.storage,vendetta.ui.toasts,vendetta.ui,vendetta.ui.assets,vendetta.ui.components); +(function(j,te,h,c,o,i,ne,D,O,oe,Ue){"use strict";function m(e){const t=window?.modules;if(t)for(const n in t){const r=t[n];if(!r?.isInitialized)continue;const s=r.publicModule?.exports;if(s)try{if(e(s))return s;if(s.default!=null&&e(s.default))return s.default}catch{}}}function ze(e){return m(function(t){return t?.name===e||t?.displayName===e})}function y(...e){return m(function(t){return e.every(function(n){return typeof t?.[n]=="function"})})}function _(e){const t=Object.keys(e);return m(function(n){return t.every(function(r){try{return e[r](n?.[r])}catch{return!1}})})}function C(e){return m(function(t){return typeof t?.getName=="function"&&t.getName.length===0&&t.getName()===e})}function We(e){const t=y("useIsMobileQuestDockRendered");if(!t?.useIsMobileQuestDockRendered)return!1;const n=t.useIsMobileQuestDockRendered;return t.useIsMobileQuestDockRendered=function(...r){return n.apply(this,r),!0},e.push(function(){t.useIsMobileQuestDockRendered=n}),!0}function qe(e){const t=y("useIsMobileQuestDockRenderedBase");if(!t?.useIsMobileQuestDockRenderedBase)return!1;const n=t.useIsMobileQuestDockRenderedBase;return t.useIsMobileQuestDockRenderedBase=function(...r){return n.apply(this,r),!0},e.push(function(){t.useIsMobileQuestDockRenderedBase=n}),!0}function Je(e){const t=y("useIsMobileQuestDockVisibleToUser");if(!t?.useIsMobileQuestDockVisibleToUser)return!1;const n=t.useIsMobileQuestDockVisibleToUser;return t.useIsMobileQuestDockVisibleToUser=function(...r){return n.apply(this,r),!0},e.push(function(){t.useIsMobileQuestDockVisibleToUser=n}),!0}function Xe(e){const t=y("useMobileQuestDock");if(!t?.useMobileQuestDock)return!1;const n=t.useMobileQuestDock;return t.useMobileQuestDock=function(...r){return n.apply(this,r)||{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:null,questBarHero:null},features:[]},userStatus:{enrolledAt:"2099-01-01",claimedAt:null},benefits:{rewards:[]},guildId:"0",tasks:[]}},e.push(function(){t.useMobileQuestDock=n}),!0}const Ye="[ServerDrawer]";function Ke(e){const t=y("getQuestAsset");if(!t?.getQuestAsset)return console.log(Ye,"WARN: getQuestAsset not found"),!1;const n=t.getQuestAsset;return t.getQuestAsset=function(...r){try{return n.apply(this,r)}catch{return{url:null,isAnimated:!1}}},e.push(function(){t.getQuestAsset=n}),!0}function a(e){let t,n=!1;return function(){if(n)return t;const r=e();return r!=null&&(t=r,n=!0),r??void 0}}const V=a(function(){return y("useStateFromStores")}),B=a(function(){return _({triggerHapticFeedback:function(e){return typeof e=="function"},HapticFeedbackTypes:function(e){return e?.SOFT!==void 0}})}),re=a(function(){return _({colors:function(e){return e?.BG_ACCENT!==void 0},unsafe_rawColors:function(e){return e?.WHITE!==void 0}})}),Ce=a(function(){return y("bulkAck","ackChannel")}),Ee=a(function(){return _({ReadStateTypes:function(e){return e?.CHANNEL!==void 0},UnreadSetting:function(e){return e?.ALL_MESSAGES!==void 0}})}),Ze=a(function(){return C("GuildStore")});function we({id:e,size:t=48}){const n=V(),r=Ze(),s=re()?.colors,u=n?.useStateFromStores?.([r],function(){return r?.getGuild?.(e)},[e])??null;if(!u)return null;const l=t>=40?16:8;return u.icon?o.createElement(i.Image,{source:{uri:`https://cdn.discordapp.com/icons/${u.id}/${u.icon}.png?size=${t*2}`},style:{width:t,height:t,borderRadius:l}}):o.createElement(i.View,{style:[Se.fallback,{width:t,height:t,borderRadius:l,backgroundColor:s?.BG_ACCENT??"#5865f2"}]},o.createElement(i.Text,{style:[Se.letter,{fontSize:Math.max(10,t*.4)}]},u.name?.split(" ").map(function(g){return g[0]}).join("").slice(0,2).toUpperCase()||"?"))}const Se=i.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),$e=a(function(){return C("ThemeStore")}),Ne=a(function(){return m(function(e){return e?.default?.internal?.resolveSemanticColor})?.default?.internal?.resolveSemanticColor??m(function(e){return e?.meta?.resolveSemanticColor})?.meta?.resolveSemanticColor});function et(e,t=$e()?.theme){if(e)try{return Ne()?.(t,e)}catch{return}}const tt=a(function(){return _({TextStyleSheet:function(e){return e?.["text-md/bold"]!==void 0}})?.TextStyleSheet});function U(e,t){return et(e)??t}const A=12,ie=12,ke=42,se=220,Ie=4,P=16,z=20,De={tension:200,friction:20};function nt({visible:e,items:t,title:n,anchorX:r,anchorY:s,onClose:u}){const l=tt(),g=B(),{width:p,height:k}=i.Dimensions.get("window"),b=(n?ie+20+Ie:0)+t.length*ke;let d=r,E=s+48+10;d+se>p-A&&(d=p-se-A),dk-A&&(E=s-b-10),E0?o.createElement(i.View,{style:M.outline},o.createElement(i.View,{style:M.badge},o.createElement(i.Text,{style:M.text},r>99?"99+":String(r)))):s?o.createElement(i.View,{style:M.dotOutline},o.createElement(i.View,{style:M.dot})):null:null}function Re({node:e,onPick:t}){const n=o.useRef(null),r=o.useRef(new i.Animated.Value(1)).current,s=function(){return i.Animated.spring(r,{toValue:.85,useNativeDriver:!0}).start()},u=function(){return i.Animated.spring(r,{toValue:1,useNativeDriver:!0}).start()},[l,g]=o.useState({visible:!1,items:[],title:"",x:0,y:0}),p=o.useCallback(function(){const d=e.id,E=st()?.getGuild?.(d);if(!E)return;const G=n.current;if(!G?.measure)return;const x=[{label:"Mark as Read",action:function(){return at(d)}},{label:"Copy Server ID",action:function(){c.clipboard.setString(d),D.showToast("Copied server ID",void 0)}}];G.measure(function(f,I,T,L,H,N){g({visible:!0,items:x,title:E.name,x:H,y:N})})},[e.id]),k=o.useCallback(function(){const d=B();d?.triggerHapticFeedback?.(d.HapticFeedbackTypes.IMPACT_MEDIUM),p()},[p]),b=e.id;return o.createElement(o.Fragment,null,o.createElement(i.Pressable,{onPressIn:s,onPressOut:u,onPress:function(){return t(b)},onLongPress:k,delayLongPress:500},o.createElement(i.View,{ref:n,style:Te.outer,collapsable:!1},o.createElement(i.Animated.View,{style:[Te.icon,{transform:[{scale:r}]}]},o.createElement(we,{id:b})),o.createElement(ct,{guildId:b}))),o.createElement(nt,{visible:l.visible,items:l.items,title:l.title,anchorX:l.x,anchorY:l.y,onClose:function(){return g(function(d){return{...d,visible:!1}})}}))}const Te=i.StyleSheet.create({outer:{width:W,height:W},icon:{width:W,height:W,borderRadius:16,overflow:"hidden"}}),M=i.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19},dotOutline:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},dot:{width:10,height:10,borderRadius:5,backgroundColor:"#ed4245"}}),dt=a(function(){return C("ExpandedGuildFolderStore")});function ft(e){const t=V(),n=dt();return t?.useStateFromStores?.([n],function(){const r=n?.getExpandedFolders?.();return r instanceof Set?r.has(e):!1},[e])??!1}const ht=a(function(){return y("toggleGuildFolderExpand")}),gt=a(function(){return C("GuildReadStateStore")}),R=48,le=16,pt=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],Fe=oe.getAssetIDByName("FolderIcon");function Ae(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function mt({node:e}){const t=V(),n=gt(),r=t?.useStateFromStores?.([n],function(){let s=0;for(const u of e.children)s+=n?.getMentionCount?.(u.id)??0;return s},[e.children])??0;return r>0?o.createElement(i.View,{style:ce.outline},o.createElement(i.View,{style:ce.badge},o.createElement(i.Text,{style:ce.text},r>99?"99+":String(r)))):null}function bt({node:e}){ne.useProxy(h.storage);const t=Ae(e.color);return o.createElement(i.View,{style:q.outer},o.createElement(i.View,{style:[q.icon,{backgroundColor:t}]},h.storage.hideFolderIcons?o.createElement(i.View,{style:q.plainIcon},o.createElement(i.Image,{source:Fe,style:ae.folderImg,tintColor:"#fff"})):e.children.slice(0,4).map(function(n,r){return o.createElement(i.View,{key:n.id,style:[q.cell,pt[r]]},o.createElement(we,{id:n.id,size:le}))})),o.createElement(mt,{node:e}))}const q=i.StyleSheet.create({outer:{width:R,height:R},icon:{width:R,height:R,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:le,height:le,borderRadius:8,overflow:"hidden"},plainIcon:{width:R,height:R,alignItems:"center",justifyContent:"center"}});function yt({children:e}){const t=o.useRef(new i.Animated.Value(0)).current;return o.useEffect(function(){i.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),o.createElement(i.Animated.View,{style:{opacity:t}},e)}function Ct({node:e,onPick:t}){const n=ft(e.id),r=function(){ht()?.toggleGuildFolderExpand?.(e.id)};return n?o.createElement(o.Fragment,null,o.createElement(i.Pressable,{onPress:r},o.createElement(i.View,{style:[ae.openIcon,{backgroundColor:Ae(e.color)}]},o.createElement(i.Image,{source:Fe,style:ae.folderImg,tintColor:"#fff"}))),e.children.map(function(s){return o.createElement(yt,{key:s.id},o.createElement(Re,{node:s,onPick:t}))})):o.createElement(i.Pressable,{onPress:r},o.createElement(bt,{node:e}))}const ae=i.StyleSheet.create({openIcon:{width:R,height:R,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),ce=i.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19}}),J=48,Et=oe.getAssetIDByName("ChatIcon"),wt=a(function(){return y("selectPrivateChannel")}),St=a(function(){return ze("SelectedChannelStore")}),kt=a(function(){return y("getGuildId")});function It(){const e=B();e?.triggerHapticFeedback?.(e.HapticFeedbackTypes.SOFT);const t=wt();if(t?.selectPrivateChannel){const n=St()?.getLastSelectedChannelId?.();t.selectPrivateChannel(n)}}function Dt(){const e=V(),t=kt(),n=re()?.colors,r=e?.useStateFromStores?.([t],function(){return t?.getGuildId?.()==null})??!1;return o.createElement(i.Pressable,{onPress:It,style:xe.outer},o.createElement(i.View,{style:[xe.icon,{backgroundColor:r?n?.BG_ACCENT??"#5865f2":"rgba(128,128,128,0.24)"}]},o.createElement(i.Image,{source:Et,style:{width:24,height:24,tintColor:"#fff"}})))}const xe=i.StyleSheet.create({outer:{width:J,height:J},icon:{width:J,height:J,borderRadius:16,alignItems:"center",justifyContent:"center"}}),Ve=48,Rt=oe.getAssetIDByName("CheckmarkLargeIcon"),Tt=Ce,Ft=a(function(){return Ee()?.ReadStateTypes}),At=a(function(){return C("SortedGuildStore")}),xt=a(function(){return C("GuildChannelStore")}),Vt=a(function(){return C("ChannelStore")});function Bt(){const e=(At()?.getGuildsTree?.()?.root?.children??[]).filter(function(r){return r?.type!=="root"}),t=[],n=function(r){for(const s of r)s.type==="folder"?n(s.children??[]):s.id!=null&&t.push(String(s.id))};return n(e),t}function Gt(){const e=Tt(),t=Ft(),n=xt(),r=Vt();if(!e?.bulkAck||t?.CHANNEL==null||!n?.getSelectableChannelIds||!n?.getVocalChannelIds){D.showToast("Couldn't find Discord's read-state action - this may be unavailable on your version.",void 0);return}const s=Bt();if(s.length===0){D.showToast("Nothing to mark as read.",void 0);return}const u=[];for(const l of s){const g=[...n.getSelectableChannelIds(l)??[],...n.getVocalChannelIds(l)??[]];for(const p of g)u.push({channelId:p,readStateType:t.CHANNEL,messageId:r?.getChannel?.(p)?.lastMessageId??null})}if(u.length===0){D.showToast("Nothing to mark as read.",void 0);return}e.bulkAck(u),D.showToast(`Marked ${u.length} channel${u.length===1?"":"s"} as read`,void 0)}function Ht(){const e=o.useCallback(function(){const t=B();t?.triggerHapticFeedback?.(t.HapticFeedbackTypes.SOFT),Gt()},[]);return o.createElement(i.Pressable,{onPress:e,style:Pt.outer},o.createElement(i.Image,{source:Rt,style:{width:24,height:24,tintColor:"#80848e"}}))}const Pt=i.StyleSheet.create({outer:{width:Ve,height:Ve,alignItems:"center",justifyContent:"center"}}),Mt=a(function(){return y("getRootNavigationRef")}),vt=a(function(){return y("transitionToGuild")}),Qt=a(function(){return m(function(e){return typeof e?.handleCreateJoinGuildPress=="function"})}),Lt=a(function(){return m(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon}),jt=a(function(){return m(function(e){return e?.QuestDockExternalCoordinationContext})?.QuestDockExternalCoordinationContext}),Ot=a(function(){return m(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode}),_t=a(function(){return m(function(e){return typeof e?.getName=="function"&&e.getName.length===0&&e.getName()==="SortedGuildStore"})}),X=48,Y=6,Ut=12;function zt(){const e=o.useRef(new i.Animated.Value(1)).current,t=o.useCallback(function(){i.Animated.spring(e,{toValue:.9,useNativeDriver:!0}).start()},[e]),n=o.useCallback(function(){i.Animated.spring(e,{toValue:1,useNativeDriver:!0}).start()},[e]),r=o.useCallback(function(){const l=B();l?.triggerHapticFeedback?.(l.HapticFeedbackTypes.SOFT),Qt()?.handleCreateJoinGuildPress?.()},[]),s=Lt(),u=re()?.unsafe_rawColors;return o.createElement(i.Pressable,{onPress:r,onPressIn:t,onPressOut:n},o.createElement(i.Animated.View,{style:[K.createJoin,{backgroundColor:u?.GREEN_360,transform:[{scale:e}]}]},s?o.createElement(s,{size:"md",color:u?.WHITE}):o.createElement(i.Text,{style:[K.createJoinFallback,{color:u?.WHITE}]},"+")))}function Wt({gestureContext:e}){const t=o.useCallback(function(f){const I=B();I?.triggerHapticFeedback?.(I.HapticFeedbackTypes.SOFT);const T=vt();T?.transitionToGuild?T.transitionToGuild(f):Mt()?.getRootNavigationRef?.()?.navigate("guilds",{guildId:f})},[]),n=V(),r=_t(),s=n?.useStateFromStores?.([r],function(){return(r?.getGuildsTree()?.root?.children||[]).filter(function(f){return f.type!=="root"})})??[],u=e?o.useContext(e):null,l=u?.minExpandedContentHeight,g=o.useCallback(function(f){if(!l)return;const I=f.nativeEvent.layout.height;l.get()!==I&&l.set(I)},[l]),p=jt(),k=(p?o.useContext(p):null)?.setRestingQuestDockMode,b=u?.questDockWrapperSpecs;o.useEffect(function(){const f=Ot();if(!k||!f||!b)return;const I=i.BackHandler.addEventListener("hardwareBackPress",function(){return(b.get()?.height??56)>80?(k(f.COLLAPSED),!0):!1});return function(){return I.remove()}},[k,b]);const{width:d}=i.Dimensions.get("window"),E=Math.max(3,Math.floor((d-Ut*2+Y)/(X+Y))),G=E*X+(E-1)*Y,x=Math.max(0,(d-G)/2);return o.createElement(i.View,{style:K.alignTop},o.createElement(i.View,{style:[K.grid,{paddingHorizontal:x,gap:Y}],onLayout:g},o.createElement(Dt,null),s.map(function(f){return f.type==="folder"?o.createElement(Ct,{key:f.id,node:f,onPick:t}):o.createElement(Re,{key:f.id,node:f,onPick:t})}),o.createElement(zt,null),o.createElement(Ht,null)))}const K=i.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16},createJoin:{width:X,height:X,borderRadius:16,alignItems:"center",justifyContent:"center"},createJoinFallback:{fontSize:28,fontWeight:"700",lineHeight:30}});function qt(e,t,n=100){let r=!1,s;const u=e();return u?(t(u),{cancel(){}}):(s=setInterval(function(){if(r)return;const l=e();l&&(r=!0,clearInterval(s),t(l))},n),{cancel(){r=!0,s&&clearInterval(s)}})}const de=new Map,Be=[];let v=[],Z=!1;function fe(e,t,n){de.set(e,{replacement:t,extraProps:n})}function he(e,t){v.push({predicate:e,onDetected:t})}function Jt(e){if(v.length===0)return;const t=[];for(const n of v){let r=!1;try{r=n.predicate(e)}catch{}if(r)try{n.onDetected(e)}catch{}else t.push(n)}v=t}function Ge(e,t){if(Jt(e),t)for(const{predicate:r,replacement:s}of Be)try{if(r(t))return s?{type:s,props:t}:null}catch{}const n=de.get(e);if(n)return{type:n.replacement,props:n.extraProps?{...t,...n.extraProps}:t}}function Xt(e){if(Z)return;const t=c.React.createElement;if(!t){console.warn("[ServerDrawer] React.createElement is null, skipping patch");return}const n=function(u,l,...g){const p=Ge(u,l);return p===null?null:p?t.call(c.React,p.type,p.props,...g):t.call(c.React,u,l,...g)};Object.assign(n,t),c.React.createElement=n,Z=!0;const r=[],s=qt(function(){return m(function(u){return typeof u?.jsx=="function"&&typeof u?.jsxs=="function"&&"Fragment"in u})},function(u){for(const l of["jsx","jsxs"]){const g=u[l];typeof g=="function"&&(u[l]=function(p,k,...b){const d=Ge(p,k);return d===null?null:d?g.call(this,d.type,d.props,...b):g.call(this,p,k,...b)},r.push(function(){u[l]=g}))}});e.push(function(){s.cancel(),Z&&(c.React.createElement=t,Z=!1),r.forEach(function(u){return u()}),de.clear(),Be.length=0,v=[]})}const He="[ServerDrawer]";let ge=null;function Yt(){return ge||(ge=m(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),ge}function Pe(e){return function(t){return t?.name===e||t?.displayName===e||t?.type?.name===e||t?.type?.displayName===e}}function Kt(){return null}function Zt(e){return he(Pe("QuestDockContentExpanded"),function(t){fe(t,$t),console.log(He,"PATCH: found the real QuestDockContentExpanded, now rendering the drawer")}),!0}function $t(){return c.React.createElement(Wt,{gestureContext:Yt()})}function Q(e,t){return he(Pe(e),function(n){fe(n,Kt),console.log(He,`PATCH: found the real ${e}, now rendering nothing`)}),!0}const Me="[ServerDrawer]";function Nt(){return null}function en(e){return e?.name==="GuildsBar"||e?.displayName==="GuildsBar"||e?.type?.name==="GuildsBar"||e?.type?.displayName==="GuildsBar"}function tn(e){return he(en,function(t){fe(t,Nt),console.log(Me,"PATCH: found the real GuildsBar reference, now rendering nothing")}),e.push(function(){}),console.log(Me,"PATCH: watching for the real GuildsBar to appear"),!0}function nn(e){const t=C("ExpandedGuildFolderStore");if(!t?.getExpandedFolders)return!1;const n=function({folderId:r}){if(!h.storage.autoCollapseFolders||r==null)return;const s=t.getExpandedFolders();if(!(!(s instanceof Set)||!s.has(r)))for(const u of s)u!==r&&c.FluxDispatcher.dispatch({type:"TOGGLE_GUILD_FOLDER_EXPAND",folderId:u})};return c.FluxDispatcher.subscribe("TOGGLE_GUILD_FOLDER_EXPAND",n),e.push(function(){return c.FluxDispatcher.unsubscribe("TOGGLE_GUILD_FOLDER_EXPAND",n)}),!0}const{ScrollView:on,View:rn}=c.ReactNative;function sn({children:e}){return c.React.createElement(on,{style:{flex:1}},e,c.React.createElement(rn,{style:{height:24}}))}const{View:un,Text:ln}=c.ReactNative;function ve({children:e,style:t}){return c.React.createElement(un,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},t]},c.React.createElement(ln,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},e))}const{FormSection:Qe,FormSwitchRow:$}=Ue.Forms;function an(){return ne.useProxy(h.storage),c.React.createElement(sn,null,c.React.createElement(ve,null,"Server Drawer takes over the Quest Dock (the strip above the tab bar) to show your servers as a grid instead - tap to expand, long-press a server for its usual context menu, the chat bubble jumps to DMs, the + button creates or joins a server through Discord's own modal, and the check button marks every channel in every server as read."),c.React.createElement(Qe,{title:"Layout"},c.React.createElement($,{label:"Hide the left server rail",subLabel:"Your servers and DMs already live in the drawer, so the rail is redundant",value:h.storage.hideGuildsBar!==!1,onValueChange:function(e){h.storage.hideGuildsBar=e,Oe()}}),c.React.createElement($,{label:"Unread badges",subLabel:"Show mention counts and unread dots on server icons in the drawer",value:h.storage.showUnreadBadges!==!1,onValueChange:function(e){h.storage.showUnreadBadges=e}})),c.React.createElement(Qe,{title:"Folders"},c.React.createElement($,{label:"Auto-collapse other folders",subLabel:"Opening a folder collapses any other folder that was already open",value:!!h.storage.autoCollapseFolders,onValueChange:function(e){h.storage.autoCollapseFolders=e}}),c.React.createElement($,{label:"Hide icons in collapsed folders",subLabel:"Show a plain folder icon instead of a 4-server preview",value:!!h.storage.hideFolderIcons,onValueChange:function(e){h.storage.hideFolderIcons=e}})),c.React.createElement(ve,null,"The folder options above are ported from fres621's BetterFolders - its other half (hiding icons in the native left server rail) patched a component that no longer exists in current Discord builds, so it's been rebuilt here instead, where it actually applies to what you see."))}let w=[],S;function cn(e,t){try{return t()}catch(n){return te.logger.error(`[ServerDrawer] "${e}" patch threw, skipping: ${n}`),!1}}function Le(){const e={questDockRender:function(){return We(w)},questDockBase:function(){return qe(w)},questDockVisible:function(){return Je(w)},mobileQuestDock:function(){return Xe(w)},getQuestAsset:function(){return Ke(w)},expanded:function(){return Zt()},collapsed:function(){return Q("QuestDockContentCollapsed")},enrolledHeader:function(){return Q("QuestDockEnrolledHeader")},unenrolledHeader:function(){return Q("QuestDockUnenrolledHeader")},enrolledBody:function(){return Q("QuestDockEnrolledBody")},unenrolledBody:function(){return Q("QuestDockUnenrolledBody")},autoCollapseFolders:function(){return nn(w)},...h.storage.hideGuildsBar?{hideGuildsBar:function(){return tn(w)}}:{}};Xt(w);const t=new Set(Object.keys(e)),n=new Set,r=function(){for(const s of t)cn(s,e[s])&&(n.add(s),t.delete(s));t.size===0&&S&&(clearInterval(S),S=void 0)};if(r(),t.size>0){let s=0;S=setInterval(function(){r(),++s>=50&&S&&(clearInterval(S),S=void 0,t.size>0&&te.logger.error(`[ServerDrawer] Gave up waiting on: ${[...t].join(", ")}`))},200)}te.logger.log(`[ServerDrawer] onLoad: applied immediately - ${[...n].join(", ")||"none"}${t.size?`, still waiting on ${[...t].join(", ")}`:""}`)}function je(){S&&(clearInterval(S),S=void 0);for(const e of w)try{e()}catch{}w=[]}function Oe(){je(),Le()}var dn={onLoad:function(){h.storage.hideGuildsBar??=!0,h.storage.showUnreadBadges??=!0,h.storage.autoCollapseFolders??=!1,h.storage.hideFolderIcons??=!1,Le()},onUnload:function(){return je()},settings:an};return j.default=dn,j.restart=Oe,Object.defineProperty(j,"__esModule",{value:!0}),j})({},vendetta,vendetta.plugin,vendetta.metro.common,window.React,vendetta.metro.common.ReactNative,vendetta.storage,vendetta.ui.toasts,vendetta.ui,vendetta.ui.assets,vendetta.ui.components); diff --git a/server-drawer/install/manifest.json b/server-drawer/install/manifest.json index 5e6dbb7..f409e41 100644 --- a/server-drawer/install/manifest.json +++ b/server-drawer/install/manifest.json @@ -1 +1 @@ -{"name":"ServerDrawer","description":"Replaces the Quest Dock with a server grid drawer above the YouBar - tap to expand, long-press a server for its context menu, plus a one-tap create/join button.","authors":[{"name":"everestmcarthur"},{"name":"kmmiio99o"},{"name":"fres"}],"main":"index.js","vendetta":{"icon":"ServerIcon"},"hash":"447ec96bfac69e85045d6274e02397593a6faa75bec9a92d62a4ecfe84529809"} \ No newline at end of file +{"name":"ServerDrawer","description":"Replaces the Quest Dock with a server grid drawer above the YouBar - tap to expand, long-press a server for its context menu, plus a one-tap create/join button.","authors":[{"name":"everestmcarthur"},{"name":"kmmiio99o"},{"name":"fres"}],"main":"index.js","vendetta":{"icon":"ServerIcon"},"hash":"d374081dc635b5f64747a8899193c09a16d4602a34a3f25e5b52cc520d1f8b3d"} \ No newline at end of file