diff --git a/server-drawer/install/index.js b/server-drawer/install/index.js index 8c34a90..1367e2d 100644 --- a/server-drawer/install/index.js +++ b/server-drawer/install/index.js @@ -1 +1 @@ -(function(Q,$,f,c,o,r,a,N,w,M,ee,Ye){"use strict";function I(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 y(...e){return I(function(t){return e.every(function(n){return t?.[n]!==void 0})})}function Ze(e){return I(function(t){return typeof t?.getName=="function"&&t.getName.length===0&&t.getName()===e})}function $e(e){const t=y("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 Ne(e){const t=y("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 et(e){const t=y("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 tt(e){const t=y("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 nt="[ServerDrawer]";function ot(e){const t=y("getQuestAsset");if(!t?.getQuestAsset)return console.log(nt,"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 k(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"),rt=a.findByProps("useStateFromStores"),st=a.findByProps("colors","unsafe_rawColors")?.colors;function be({id:e,size:t=48}){const n=rt?.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:st?.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"}}),it=a.findByStoreName("ThemeStore"),lt=a.find(function(e){return e?.default?.internal?.resolveSemanticColor})?.default?.internal?.resolveSemanticColor??a.find(function(e){return e?.meta?.resolveSemanticColor})?.meta?.resolveSemanticColor??function(){};function at(e,t=it?.theme){if(e)try{return lt(t,e)}catch{return}}const Se=a.findByProps("TextStyleSheet")?.TextStyleSheet,ke=a.findByProps("triggerHapticFeedback","HapticFeedbackTypes");function v(e,t){return at(e)??t}const F=12,te=12,Ee=42,ne=220,we=4,x=16,L=20,Ie={tension:200,friction:20};function ut({visible:e,items:t,title:n,anchorX:s,anchorY:i,onClose:l}){const{width:u,height:g}=r.Dimensions.get("window"),p=(n?te+20+we:0)+t.length*Ee;let C=s,m=i+48+10;C+ne>u-F&&(C=u-ne-F),Cg-F&&(m=i-p-10),m0?o.createElement(r.View,{style:P.outline},o.createElement(r.View,{style:P.badge},o.createElement(r.Text,{style:P.text},t>99?"99+":String(t)))):n?o.createElement(r.View,{style:P.dotOutline},o.createElement(r.View,{style:P.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 b=e.id,d=ct?.getGuild?.(b);if(!d)return;const S=n.current;if(!S?.measure)return;const B=[{label:"Mark as Read",action:function(){return gt(b)}},{label:"Copy Server ID",action:function(){c.clipboard.setString(b),w.showToast("Copied server ID",void 0)}}];S.measure(function(V,H,G,fe,Z,T){g({visible:!0,items:B,title:d.name,x:Z,y:T})})},[e.id]),C=o.useCallback(function(){Re?.triggerHapticFeedback?.(Re.HapticFeedbackTypes.IMPACT_MEDIUM),p()},[p]),m=e.id;return o.createElement(o.Fragment,null,o.createElement(r.Pressable,{onPressIn:i,onPressOut:l,onPress:function(){return t(m)},onLongPress:C,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:m})),o.createElement(pt,{guildId:m}))),o.createElement(ut,{visible:u.visible,items:u.items,title:u.title,anchorX:u.x,anchorY:u.y,onClose:function(){return g(function(b){return{...b,visible:!1}})}}))}const Be=r.StyleSheet.create({outer:{width:j,height:j},icon:{width:j,height:j,borderRadius:16,overflow:"hidden"}}),P=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"}}),yt=a.findByProps("useStateFromStores");a.findByProps("colors","unsafe_rawColors")?.colors;const Te=a.findByStoreName("ExpandedGuildFolderStore");function mt(e){return yt?.useStateFromStores?.([Te],function(){const t=Te?.getExpandedFolders?.();return t instanceof Set?t.has(e):!1},[e])??!1}const bt=a.findByProps("toggleGuildFolderExpand"),Ct=a.findByProps("useStateFromStores"),xe=a.findByStoreName("GuildReadStateStore"),D=48,se=16,St=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],Pe=ee.getAssetIDByName("FolderIcon");function Ae(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function kt({node:e}){const t=Ct?.useStateFromStores?.([xe],function(){let n=0;for(const s of e.children)n+=xe?.getMentionCount?.(s.id)??0;return n},[e.children])??0;return t>0?o.createElement(r.View,{style:le.outline},o.createElement(r.View,{style:le.badge},o.createElement(r.Text,{style:le.text},t>99?"99+":String(t)))):null}function Et({node:e}){N.useProxy(f.storage);const t=Ae(e.color);return o.createElement(r.View,{style:_.outer},o.createElement(r.View,{style:[_.icon,{backgroundColor:t}]},f.storage.hideFolderIcons?o.createElement(r.View,{style:_.plainIcon},o.createElement(r.Image,{source:Pe,style:ie.folderImg,tintColor:"#fff"})):e.children.slice(0,4).map(function(n,s){return o.createElement(r.View,{key:n.id,style:[_.cell,St[s]]},o.createElement(be,{id:n.id,size:se}))})),o.createElement(kt,{node:e}))}const _=r.StyleSheet.create({outer:{width:D,height:D},icon:{width:D,height:D,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:se,height:se,borderRadius:8,overflow:"hidden"},plainIcon:{width:D,height:D,alignItems:"center",justifyContent:"center"}});function wt({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 It({node:e,onPick:t}){const n=mt(e.id),s=function(){bt?.toggleGuildFolderExpand?.(e.id)};return n?o.createElement(o.Fragment,null,o.createElement(r.Pressable,{onPress:s},o.createElement(r.View,{style:[ie.openIcon,{backgroundColor:Ae(e.color)}]},o.createElement(r.Image,{source:Pe,style:ie.folderImg,tintColor:"#fff"}))),e.children.map(function(i){return o.createElement(wt,{key:i.id},o.createElement(Fe,{node:i,onPick:t}))})):o.createElement(r.Pressable,{onPress:s},o.createElement(Et,{node:e}))}const ie=r.StyleSheet.create({openIcon:{width:D,height:D,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),le=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}}),U=48,Dt=ee.getAssetIDByName("ChatIcon"),Ve=a.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),He=a.findByProps("selectPrivateChannel"),Rt=a.findByName("SelectedChannelStore"),Ft=a.findByProps("useStateFromStores"),Ge=a.findByProps("getGuildId"),Bt=a.findByProps("colors","unsafe_rawColors")?.colors;function Tt(){if(Ve?.triggerHapticFeedback(Ve.HapticFeedbackTypes.SOFT),He?.selectPrivateChannel){const e=Rt?.getLastSelectedChannelId?.();He.selectPrivateChannel(e)}}function xt(){const e=Ft?.useStateFromStores?.([Ge],function(){return Ge?.getGuildId?.()==null})??!1;return o.createElement(r.Pressable,{onPress:Tt,style:Qe.outer},o.createElement(r.View,{style:[Qe.icon,{backgroundColor:e?Bt?.BG_ACCENT??"#5865f2":"rgba(128,128,128,0.24)"}]},o.createElement(r.Image,{source:Dt,style:{width:24,height:24,tintColor:"#fff"}})))}const Qe=r.StyleSheet.create({outer:{width:U,height:U},icon:{width:U,height:U,borderRadius:16,alignItems:"center",justifyContent:"center"}}),Me=48,Pt=ee.getAssetIDByName("CheckmarkLargeIcon"),At=a.findByStoreName("SortedGuildStore"),z=a.findByStoreName("GuildChannelStore"),Vt=a.findByStoreName("ChannelStore"),Ht=k(function(){return y("triggerHapticFeedback","HapticFeedbackTypes")}),Gt=k(function(){return y("bulkAck","ackChannel")}),Qt=k(function(){return y("ReadStateTypes","UnreadSetting")?.ReadStateTypes});function Mt(){const e=(At?.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 vt(){const e=Gt(),t=Qt();if(!e?.bulkAck||t?.CHANNEL==null||!z?.getSelectableChannelIds||!z?.getVocalChannelIds){w.showToast("Couldn't find Discord's read-state action - this may be unavailable on your version.",void 0);return}const n=Mt();if(n.length===0){w.showToast("Nothing to mark as read.",void 0);return}const s=[];for(const i of n){const l=[...z.getSelectableChannelIds(i)??[],...z.getVocalChannelIds(i)??[]];for(const u of l)s.push({channelId:u,readStateType:t.CHANNEL,messageId:Vt?.getChannel?.(u)?.lastMessageId??null})}if(s.length===0){w.showToast("Nothing to mark as read.",void 0);return}e.bulkAck(s),w.showToast(`Marked ${s.length} channel${s.length===1?"":"s"} as read`,void 0)}function Lt(){const e=o.useCallback(function(){const t=Ht();t?.triggerHapticFeedback?.(t.HapticFeedbackTypes.SOFT),vt()},[]);return o.createElement(r.Pressable,{onPress:e,style:jt.outer},o.createElement(r.Image,{source:Pt,style:{width:24,height:24,tintColor:"#80848e"}}))}const jt=r.StyleSheet.create({outer:{width:Me,height:Me,alignItems:"center",justifyContent:"center"}}),Ot=a.findByProps("useStateFromStores"),ve=a.findByStoreName("SortedGuildStore"),_t=k(function(){return y("getRootNavigationRef")}),Le=k(function(){return y("triggerHapticFeedback","HapticFeedbackTypes")}),Ut=k(function(){return y("transitionToGuild")}),zt=k(function(){return I(function(e){return typeof e?.handleCreateJoinGuildPress=="function"})}),Wt=k(function(){return I(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon}),qt=k(function(){return y("colors","unsafe_rawColors")?.unsafe_rawColors}),Xt=a.find(function(e){return e?.QuestDockExternalCoordinationContext}),je=Xt?.QuestDockExternalCoordinationContext,Oe=a.find(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode,W=48,q=6,Jt=12;function Kt(){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),zt()?.handleCreateJoinGuildPress?.()},[]),i=Wt(),l=qt();return o.createElement(r.Pressable,{onPress:s,onPressIn:t,onPressOut:n},o.createElement(r.Animated.View,{style:[X.createJoin,{backgroundColor:l?.GREEN_360,transform:[{scale:e}]}]},i?o.createElement(i,{size:"md",color:l?.WHITE}):o.createElement(r.Text,{style:[X.createJoinFallback,{color:l?.WHITE}]},"+")))}function _e({gestureContext:e}){const t=o.useCallback(function(d){const S=Le();S?.triggerHapticFeedback?.(S.HapticFeedbackTypes.SOFT);const B=Ut();B?.transitionToGuild?B.transitionToGuild(d):_t()?.getRootNavigationRef?.()?.navigate("guilds",{guildId:d})},[]),n=Ot?.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 S=d.nativeEvent.layout.height;i.get()!==S&&i.set(S)},[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"),C=Math.max(3,Math.floor((p-Jt*2+q)/(W+q))),m=C*W+(C-1)*q,b=Math.max(0,(p-m)/2);return o.createElement(r.View,{style:X.alignTop},o.createElement(r.View,{style:[X.grid,{paddingHorizontal:b,gap:q}],onLayout:l},o.createElement(xt,null),n.map(function(d){return d.type==="folder"?o.createElement(It,{key:d.id,node:d,onPick:t}):o.createElement(Fe,{key:d.id,node:d,onPick:t})}),o.createElement(Kt,null),o.createElement(Lt,null)))}const X=r.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16},createJoin:{width:W,height:W,borderRadius:16,alignItems:"center",justifyContent:"center"},createJoinFallback:{fontSize:28,fontWeight:"700",lineHeight:30}});function Yt(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 ae=new Map,ue=[];let J=[],K=!1;function Zt(e,t,n){ae.set(e,{replacement:t,extraProps:n})}function $t(e,t){ue.push({predicate:e,replacement:t})}function Nt(e){if(J.length===0)return;const t=[];for(const n of J){let s=!1;try{s=n.predicate(e)}catch{}if(s)try{n.onDetected(e)}catch{}else t.push(n)}J=t}function Ue(e,t){if(Nt(e),t)for(const{predicate:s,replacement:i}of ue)try{if(s(t))return i?{type:i,props:t}:null}catch{}const n=ae.get(e);if(n)return{type:n.replacement,props:n.extraProps?{...t,...n.extraProps}:t}}function en(e){if(K)return;const t=c.React.createElement;if(!t){console.warn("[createElementIntercept] React.createElement is null, skipping patch");return}const n=function(l,u,...g){const p=Ue(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,K=!0;const s=[],i=Yt(function(){return I(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,C,...m){const b=Ue(p,C);return b===null?null:b?g.call(this,b.type,b.props,...m):g.call(this,p,C,...m)},s.push(function(){l[u]=g}))}});e.push(function(){i.cancel(),K&&(c.React.createElement=t,K=!1),s.forEach(function(l){return l()}),ae.clear(),ue.length=0,J=[]})}const ce="[ServerDrawer]";let de=null;function ze(){return de||(de=I(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),de}function tn(e){const t=I(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 Zt(n,_e,{gestureContext:ze()}),t.type=function(){return c.React.createElement(_e,{gestureContext:ze()})},e.push(function(){t.type=n}),console.log(ce,"PATCH: QuestDockContentExpanded replaced"),!0}function A(e,t){const n=I(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 nn="[ServerDrawer]";function on(e){return $t(function(t){return t?.nativeID==="guilds-bar-view"},null),e.push(function(){}),console.log(nn,"PATCH: guilds-bar-view createElement calls now render nothing"),!0}function rn(e){const t=Ze("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:sn,View:ln}=c.ReactNative;function an({children:e}){return c.React.createElement(sn,{style:{flex:1}},e,c.React.createElement(ln,{style:{height:24}}))}const{View:un,Text:cn}=c.ReactNative;function We({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(cn,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},e))}const{FormSection:qe,FormSwitchRow:Y}=Ye.Forms;function dn(){return N.useProxy(f.storage),c.React.createElement(an,null,c.React.createElement(We,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(Y,{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,Ke()}}),c.React.createElement(Y,{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(qe,{title:"Folders"},c.React.createElement(Y,{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(Y,{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(We,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=[],E;function fn(e,t){try{return t()}catch(n){return $.logger.error(`[ServerDrawer] "${e}" patch threw, skipping: ${n}`),!1}}function Xe(){const e={questDockRender:function(){return $e(h)},questDockBase:function(){return Ne(h)},questDockVisible:function(){return et(h)},mobileQuestDock:function(){return tt(h)},getQuestAsset:function(){return ot(h)},expanded:function(){return tn(h)},collapsed:function(){return A("QuestDockContentCollapsed",h)},enrolledHeader:function(){return A("QuestDockEnrolledHeader",h)},unenrolledHeader:function(){return A("QuestDockUnenrolledHeader",h)},enrolledBody:function(){return A("QuestDockEnrolledBody",h)},unenrolledBody:function(){return A("QuestDockUnenrolledBody",h)},autoCollapseFolders:function(){return rn(h)},...f.storage.hideGuildsBar?{hideGuildsBar:function(){return on(h)}}:{}};en(h);const t=new Set(Object.keys(e)),n=new Set,s=function(){for(const i of t)fn(i,e[i])&&(n.add(i),t.delete(i));t.size===0&&E&&(clearInterval(E),E=void 0)};if(s(),t.size>0){let i=0;E=setInterval(function(){s(),++i>=50&&E&&(clearInterval(E),E=void 0,t.size>0&&$.logger.error(`[ServerDrawer] Gave up waiting on: ${[...t].join(", ")}`))},200)}$.logger.log(`[ServerDrawer] onLoad: applied immediately - ${[...n].join(", ")||"none"}${t.size?`, still waiting on ${[...t].join(", ")}`:""}`)}function Je(){E&&(clearInterval(E),E=void 0);for(const e of h)try{e()}catch{}h=[]}function Ke(){Je(),Xe()}var hn={onLoad:function(){f.storage.hideGuildsBar??=!0,f.storage.showUnreadBadges??=!0,f.storage.autoCollapseFolders??=!1,f.storage.hideFolderIcons??=!1,Xe()},onUnload:function(){return Je()},settings:dn};return Q.default=hn,Q.restart=Ke,Object.defineProperty(Q,"__esModule",{value:!0}),Q})({},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(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); diff --git a/server-drawer/install/manifest.json b/server-drawer/install/manifest.json index 0d96e8e..5e6dbb7 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":"c45df254b0acb1a64f36870d22a10b4f06a5589f1796c21d0d79f7d77791dbaa"} \ 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":"447ec96bfac69e85045d6274e02397593a6faa75bec9a92d62a4ecfe84529809"} \ No newline at end of file