From 9b5045019e991b66d24950b1a87c4f4c86ca1681 Mon Sep 17 00:00:00 2001 From: everestmcarthur Date: Sun, 2 Aug 2026 14:36:56 +0000 Subject: [PATCH] deploy: 64d5d02d1b045f1b6e9a3e2ddb07e2a35c7359da --- 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 4081dfc..de17eff 100644 --- a/server-drawer/install/index.js +++ b/server-drawer/install/index.js @@ -1 +1 @@ -(function(L,te,h,c,r,i,ne,D,O,re,Ue){"use strict";function b(e){const t=window?.modules;if(t)for(const n in t){const o=t[n];if(!o?.isInitialized)continue;const s=o.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 b(function(t){return t?.name===e||t?.displayName===e})}function C(...e){return b(function(t){return e.every(function(n){return typeof t?.[n]=="function"})})}function j(e){const t=Object.keys(e);return b(function(n){return t.every(function(o){try{return e[o](n?.[o])}catch{return!1}})})}function E(e){return b(function(t){return typeof t?.getName=="function"&&t.getName.length===0&&t.getName()===e})}function We(e){const t=C("useIsMobileQuestDockRendered");if(!t?.useIsMobileQuestDockRendered)return!1;const n=t.useIsMobileQuestDockRendered;return t.useIsMobileQuestDockRendered=function(...o){return n.apply(this,o),!0},e.push(function(){t.useIsMobileQuestDockRendered=n}),!0}function qe(e){const t=C("useIsMobileQuestDockRenderedBase");if(!t?.useIsMobileQuestDockRenderedBase)return!1;const n=t.useIsMobileQuestDockRenderedBase;return t.useIsMobileQuestDockRenderedBase=function(...o){return n.apply(this,o),!0},e.push(function(){t.useIsMobileQuestDockRenderedBase=n}),!0}function Je(e){const t=C("useIsMobileQuestDockVisibleToUser");if(!t?.useIsMobileQuestDockVisibleToUser)return!1;const n=t.useIsMobileQuestDockVisibleToUser;return t.useIsMobileQuestDockVisibleToUser=function(...o){return n.apply(this,o),!0},e.push(function(){t.useIsMobileQuestDockVisibleToUser=n}),!0}function Xe(e){const t=C("useMobileQuestDock");if(!t?.useMobileQuestDock)return!1;const n=t.useMobileQuestDock;return t.useMobileQuestDock=function(...o){return n.apply(this,o)||{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:"",questBarHero:""},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=C("getQuestAsset");if(!t?.getQuestAsset)return console.log(Ye,"WARN: getQuestAsset not found"),!1;const n=t.getQuestAsset;return t.getQuestAsset=function(...o){try{return n.apply(this,o)}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 o=e();return o!=null&&(t=o,n=!0),o??void 0}}const V=a(function(){return C("useStateFromStores")}),B=a(function(){return j({triggerHapticFeedback:function(e){return typeof e=="function"},HapticFeedbackTypes:function(e){return e?.SOFT!==void 0}})}),oe=a(function(){return j({colors:function(e){return e?.BG_ACCENT!==void 0},unsafe_rawColors:function(e){return e?.WHITE!==void 0}})}),ye=a(function(){return C("bulkAck","ackChannel")}),Ce=a(function(){return j({ReadStateTypes:function(e){return e?.CHANNEL!==void 0},UnreadSetting:function(e){return e?.ALL_MESSAGES!==void 0}})}),Ze=a(function(){return E("GuildStore")});function Ee({id:e,size:t=48}){const n=V(),o=Ze(),s=oe()?.colors,u=n?.useStateFromStores?.([o],function(){return o?.getGuild?.(e)},[e])??null;if(!u)return null;const l=t>=40?16:8;return u.icon?r.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}}):r.createElement(i.View,{style:[we.fallback,{width:t,height:t,borderRadius:l,backgroundColor:s?.BG_ACCENT??"#5865f2"}]},r.createElement(i.Text,{style:[we.letter,{fontSize:Math.max(10,t*.4)}]},u.name?.split(" ").map(function(g){return g[0]}).join("").slice(0,2).toUpperCase()||"?"))}const we=i.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),$e=a(function(){return E("ThemeStore")}),Ne=a(function(){return b(function(e){return e?.default?.internal?.resolveSemanticColor})?.default?.internal?.resolveSemanticColor??b(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 j({TextStyleSheet:function(e){return e?.["text-md/bold"]!==void 0}})?.TextStyleSheet});function U(e,t){return et(e)??t}const x=12,ie=12,ke=42,se=220,Se=4,P=16,z=20,Ie={tension:200,friction:20};function nt({visible:e,items:t,title:n,anchorX:o,anchorY:s,onClose:u}){const l=tt(),g=B(),{width:p,height:S}=i.Dimensions.get("window"),y=(n?ie+20+Se:0)+t.length*ke;let d=o,w=s+48+10;d+se>p-x&&(d=p-se-x),dS-x&&(w=s-y-10),w0?r.createElement(i.View,{style:M.outline},r.createElement(i.View,{style:M.badge},r.createElement(i.Text,{style:M.text},o>99?"99+":String(o)))):s?r.createElement(i.View,{style:M.dotOutline},r.createElement(i.View,{style:M.dot})):null:null}function De({node:e,onPick:t}){const n=r.useRef(null),o=r.useRef(new i.Animated.Value(1)).current,s=function(){return i.Animated.spring(o,{toValue:.85,useNativeDriver:!0}).start()},u=function(){return i.Animated.spring(o,{toValue:1,useNativeDriver:!0}).start()},[l,g]=r.useState({visible:!1,items:[],title:"",x:0,y:0}),p=r.useCallback(function(){const d=e.id,w=st()?.getGuild?.(d);if(!w)return;const H=n.current;if(!H?.measure)return;const A=[{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)}}];H.measure(function(f,I,F,_,G,N){g({visible:!0,items:A,title:w.name,x:G,y:N})})},[e.id]),S=r.useCallback(function(){const d=B();d?.triggerHapticFeedback?.(d.HapticFeedbackTypes.IMPACT_MEDIUM),p()},[p]),y=e.id;return r.createElement(r.Fragment,null,r.createElement(i.Pressable,{onPressIn:s,onPressOut:u,onPress:function(){return t(y)},onLongPress:S,delayLongPress:500},r.createElement(i.View,{ref:n,style:Re.outer,collapsable:!1},r.createElement(i.Animated.View,{style:[Re.icon,{transform:[{scale:o}]}]},r.createElement(Ee,{id:y})),r.createElement(ct,{guildId:y}))),r.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 Re=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 E("ExpandedGuildFolderStore")});function ft(e){const t=V(),n=dt();return t?.useStateFromStores?.([n],function(){const o=n?.getExpandedFolders?.();return o instanceof Set?o.has(e):!1},[e])??!1}const ht=a(function(){return C("toggleGuildFolderExpand")}),gt=a(function(){return E("GuildReadStateStore")}),R=48,le=16,pt=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],Fe=re.getAssetIDByName("FolderIcon");function Te(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function mt({node:e}){const t=V(),n=gt(),o=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 o>0?r.createElement(i.View,{style:ce.outline},r.createElement(i.View,{style:ce.badge},r.createElement(i.Text,{style:ce.text},o>99?"99+":String(o)))):null}function bt({node:e}){ne.useProxy(h.storage);const t=Te(e.color);return r.createElement(i.View,{style:q.outer},r.createElement(i.View,{style:[q.icon,{backgroundColor:t}]},h.storage.hideFolderIcons?r.createElement(i.View,{style:q.plainIcon},r.createElement(i.Image,{source:Fe,style:ae.folderImg,tintColor:"#fff"})):e.children.slice(0,4).map(function(n,o){return r.createElement(i.View,{key:n.id,style:[q.cell,pt[o]]},r.createElement(Ee,{id:n.id,size:le}))})),r.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=r.useRef(new i.Animated.Value(0)).current;return r.useEffect(function(){i.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),r.createElement(i.Animated.View,{style:{opacity:t}},e)}function Ct({node:e,onPick:t}){const n=ft(e.id),o=function(){ht()?.toggleGuildFolderExpand?.(e.id)};return n?r.createElement(r.Fragment,null,r.createElement(i.Pressable,{onPress:o},r.createElement(i.View,{style:[ae.openIcon,{backgroundColor:Te(e.color)}]},r.createElement(i.Image,{source:Fe,style:ae.folderImg,tintColor:"#fff"}))),e.children.map(function(s){return r.createElement(yt,{key:s.id},r.createElement(De,{node:s,onPick:t}))})):r.createElement(i.Pressable,{onPress:o},r.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=re.getAssetIDByName("ChatIcon"),wt=a(function(){return C("selectPrivateChannel")}),kt=a(function(){return ze("SelectedChannelStore")}),St=a(function(){return C("getGuildId")});function It(){const e=B();e?.triggerHapticFeedback?.(e.HapticFeedbackTypes.SOFT);const t=wt();if(t?.selectPrivateChannel){const n=kt()?.getLastSelectedChannelId?.();t.selectPrivateChannel(n)}}function Dt(){const e=V(),t=St(),n=oe()?.colors,o=e?.useStateFromStores?.([t],function(){return t?.getGuildId?.()==null})??!1;return r.createElement(i.Pressable,{onPress:It,style:xe.outer},r.createElement(i.View,{style:[xe.icon,{backgroundColor:o?n?.BG_ACCENT??"#5865f2":"rgba(128,128,128,0.24)"}]},r.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"}}),Ae=48,Rt=re.getAssetIDByName("CheckmarkLargeIcon"),Ft=ye,Tt=a(function(){return Ce()?.ReadStateTypes}),xt=a(function(){return E("SortedGuildStore")}),At=a(function(){return E("GuildChannelStore")}),Vt=a(function(){return E("ChannelStore")});function Bt(){const e=(xt()?.getGuildsTree?.()?.root?.children??[]).filter(function(o){return o?.type!=="root"}),t=[],n=function(o){for(const s of o)s.type==="folder"?n(s.children??[]):s.id!=null&&t.push(String(s.id))};return n(e),t}function Ht(){const e=Ft(),t=Tt(),n=At(),o=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:o?.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 Gt(){const e=r.useCallback(function(){const t=B();t?.triggerHapticFeedback?.(t.HapticFeedbackTypes.SOFT),Ht()},[]);return r.createElement(i.Pressable,{onPress:e,style:Pt.outer},r.createElement(i.Image,{source:Rt,style:{width:24,height:24,tintColor:"#80848e"}}))}const Pt=i.StyleSheet.create({outer:{width:Ae,height:Ae,alignItems:"center",justifyContent:"center"}}),Mt=a(function(){return C("getRootNavigationRef")}),vt=a(function(){return C("transitionToGuild")}),Qt=a(function(){return b(function(e){return typeof e?.handleCreateJoinGuildPress=="function"})}),_t=a(function(){return b(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon}),Lt=a(function(){return b(function(e){return e?.QuestDockExternalCoordinationContext})?.QuestDockExternalCoordinationContext}),Ot=a(function(){return b(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode}),jt=a(function(){return b(function(e){return typeof e?.getName=="function"&&e.getName.length===0&&e.getName()==="SortedGuildStore"})}),X=48,Y=6,Ut=12;function zt(){const e=r.useRef(new i.Animated.Value(1)).current,t=r.useCallback(function(){i.Animated.spring(e,{toValue:.9,useNativeDriver:!0}).start()},[e]),n=r.useCallback(function(){i.Animated.spring(e,{toValue:1,useNativeDriver:!0}).start()},[e]),o=r.useCallback(function(){const l=B();l?.triggerHapticFeedback?.(l.HapticFeedbackTypes.SOFT),Qt()?.handleCreateJoinGuildPress?.()},[]),s=_t(),u=oe()?.unsafe_rawColors;return r.createElement(i.Pressable,{onPress:o,onPressIn:t,onPressOut:n},r.createElement(i.Animated.View,{style:[K.createJoin,{backgroundColor:u?.GREEN_360,transform:[{scale:e}]}]},s?r.createElement(s,{size:"md",color:u?.WHITE}):r.createElement(i.Text,{style:[K.createJoinFallback,{color:u?.WHITE}]},"+")))}function Ve({gestureContext:e}){const t=r.useCallback(function(f){const I=B();I?.triggerHapticFeedback?.(I.HapticFeedbackTypes.SOFT);const F=vt();F?.transitionToGuild?F.transitionToGuild(f):Mt()?.getRootNavigationRef?.()?.navigate("guilds",{guildId:f})},[]),n=V(),o=jt(),s=n?.useStateFromStores?.([o],function(){return(o?.getGuildsTree()?.root?.children||[]).filter(function(f){return f.type!=="root"})})??[],u=e?r.useContext(e):null,l=u?.minExpandedContentHeight,g=r.useCallback(function(f){if(!l)return;const I=f.nativeEvent.layout.height;l.get()!==I&&l.set(I)},[l]),p=Lt(),S=(p?r.useContext(p):null)?.setRestingQuestDockMode,y=u?.questDockWrapperSpecs;r.useEffect(function(){const f=Ot();if(!S||!f||!y)return;const I=i.BackHandler.addEventListener("hardwareBackPress",function(){return(y.get()?.height??56)>80?(S(f.COLLAPSED),!0):!1});return function(){return I.remove()}},[S,y]);const{width:d}=i.Dimensions.get("window"),w=Math.max(3,Math.floor((d-Ut*2+Y)/(X+Y))),H=w*X+(w-1)*Y,A=Math.max(0,(d-H)/2);return r.createElement(i.View,{style:K.alignTop},r.createElement(i.View,{style:[K.grid,{paddingHorizontal:A,gap:Y}],onLayout:g},r.createElement(Dt,null),s.map(function(f){return f.type==="folder"?r.createElement(Ct,{key:f.id,node:f,onPick:t}):r.createElement(De,{key:f.id,node:f,onPick:t})}),r.createElement(zt,null),r.createElement(Gt,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 Wt(e,t,n=100){let o=!1,s;const u=e();return u?(t(u),{cancel(){}}):(s=setInterval(function(){if(o)return;const l=e();l&&(o=!0,clearInterval(s),t(l))},n),{cancel(){o=!0,s&&clearInterval(s)}})}const de=new Map,Be=[];let v=[],Z=!1;function He(e,t,n){de.set(e,{replacement:t,extraProps:n})}function qt(e,t){v.push({predicate:e,onDetected:t})}function Jt(e){if(v.length===0)return;const t=[];for(const n of v){let o=!1;try{o=n.predicate(e)}catch{}if(o)try{n.onDetected(e)}catch{}else t.push(n)}v=t}function Ge(e,t){if(Jt(e),t)for(const{predicate:o,replacement:s}of Be)try{if(o(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 o=[],s=Wt(function(){return b(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,S,...y){const d=Ge(p,S);return d===null?null:d?g.call(this,d.type,d.props,...y):g.call(this,p,S,...y)},o.push(function(){u[l]=g}))}});e.push(function(){s.cancel(),Z&&(c.React.createElement=t,Z=!1),o.forEach(function(u){return u()}),de.clear(),Be.length=0,v=[]})}const fe="[ServerDrawer]";let he=null;function Pe(){return he||(he=b(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),he}function Yt(e){const t=b(function(o){return o?.type?.displayName==="QuestDockContentExpanded"||o?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(fe,"WARN: QuestDockContentExpanded not found (will retry)"),!1;const n=t.type;return He(n,Ve,{gestureContext:Pe()}),t.type=function(){return c.React.createElement(Ve,{gestureContext:Pe()})},e.push(function(){t.type=n}),console.log(fe,"PATCH: QuestDockContentExpanded replaced"),!0}function Q(e,t){const n=b(function(u){return u?.type?.displayName===e||u?.type?.name===e});if(!n?.type)return console.log(fe,`WARN: ${e} not found`),!1;const o=n.type,s=o;return n.type=function(){return null},s&&(Object.defineProperties(n.type,Object.getOwnPropertyDescriptors(s)),n.type.displayName=e),t.push(function(){n.type=o}),!0}const Me="[ServerDrawer]";function Kt(e){if(e)try{let t=null;if(e._internalFiberInstanceHandleDEV)t=e._internalFiberInstanceHandleDEV;else if(e._internalInstanceHandle)t=e._internalInstanceHandle;else if(e.__internalInstanceHandle)t=e.__internalInstanceHandle;else{const s=Object.keys(e).find(function(u){return u.startsWith("__reactFiber$")||u.startsWith("__reactInternalInstance$")});s&&(t=e[s])}if(!t)return;if(t.return===void 0&&t.child===void 0){const s=t.stateNode??t.fiber??t._debugOwner;if(s&&(s.return!==void 0||s.child!==void 0))t=s;else return}let n=t,o=0;for(;n.return&&o<5e3;)n=n.return,o++;window.__keyInspectorFiberRoot=n,window.__keyInspectorFiberSelf=t}catch{}}function Zt(){return r.createElement(i.View,{ref:Kt,style:{width:1,height:1}})}function $t(e){return e?.name==="GuildsBar"||e?.displayName==="GuildsBar"||e?.type?.name==="GuildsBar"||e?.type?.displayName==="GuildsBar"}function Nt(e){return qt($t,function(t){He(t,Zt),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 en(e){const t=E("ExpandedGuildFolderStore");if(!t?.getExpandedFolders)return!1;const n=function({folderId:o}){if(!h.storage.autoCollapseFolders||o==null)return;const s=t.getExpandedFolders();if(!(!(s instanceof Set)||!s.has(o)))for(const u of s)u!==o&&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:tn,View:nn}=c.ReactNative;function rn({children:e}){return c.React.createElement(tn,{style:{flex:1}},e,c.React.createElement(nn,{style:{height:24}}))}const{View:on,Text:sn}=c.ReactNative;function ve({children:e,style:t}){return c.React.createElement(on,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},t]},c.React.createElement(sn,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},e))}const{FormSection:Qe,FormSwitchRow:$}=Ue.Forms;function un(){return ne.useProxy(h.storage),c.React.createElement(rn,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 m=[],k;function ln(e,t){try{return t()}catch(n){return te.logger.error(`[ServerDrawer] "${e}" patch threw, skipping: ${n}`),!1}}function _e(){const e={questDockRender:function(){return We(m)},questDockBase:function(){return qe(m)},questDockVisible:function(){return Je(m)},mobileQuestDock:function(){return Xe(m)},getQuestAsset:function(){return Ke(m)},expanded:function(){return Yt(m)},collapsed:function(){return Q("QuestDockContentCollapsed",m)},enrolledHeader:function(){return Q("QuestDockEnrolledHeader",m)},unenrolledHeader:function(){return Q("QuestDockUnenrolledHeader",m)},enrolledBody:function(){return Q("QuestDockEnrolledBody",m)},unenrolledBody:function(){return Q("QuestDockUnenrolledBody",m)},autoCollapseFolders:function(){return en(m)},...h.storage.hideGuildsBar?{hideGuildsBar:function(){return Nt(m)}}:{}};Xt(m);const t=new Set(Object.keys(e)),n=new Set,o=function(){for(const s of t)ln(s,e[s])&&(n.add(s),t.delete(s));t.size===0&&k&&(clearInterval(k),k=void 0)};if(o(),t.size>0){let s=0;k=setInterval(function(){o(),++s>=50&&k&&(clearInterval(k),k=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 Le(){k&&(clearInterval(k),k=void 0);for(const e of m)try{e()}catch{}m=[]}function Oe(){Le(),_e()}var an={onLoad:function(){h.storage.hideGuildsBar??=!0,h.storage.showUnreadBadges??=!0,h.storage.autoCollapseFolders??=!1,h.storage.hideFolderIcons??=!1,_e()},onUnload:function(){return Le()},settings:un};return L.default=an,L.restart=Oe,Object.defineProperty(L,"__esModule",{value:!0}),L})({},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); +(function(O,te,h,c,r,i,ne,I,M,re,We){"use strict";function m(e){const t=window?.modules;if(t)for(const n in t){const o=t[n];if(!o?.isInitialized)continue;const l=o.publicModule?.exports;if(l)try{if(e(l))return l;if(l.default!=null&&e(l.default))return l.default}catch{}}}function Qe(e){return m(function(t){return t?.name===e||t?.displayName===e})}function x(...e){return m(function(t){return e.every(function(n){return typeof t?.[n]=="function"})})}function z(e){const t=Object.keys(e);return m(function(n){return t.every(function(o){try{return e[o](n?.[o])}catch{return!1}})})}function b(e){return m(function(t){return typeof t?.getName=="function"&&t.getName.length===0&&t.getName()===e})}function qe(e,t,n=100){let o=!1,l;const s=e();return s?(t(s),{cancel(){}}):(l=setInterval(function(){if(o)return;const a=e();a&&(o=!0,clearInterval(l),t(a))},n),{cancel(){o=!0,l&&clearInterval(l)}})}const oe=new Map,Ce=[],ie=[];let G=[],U=!1;function Ee(e,t,n){oe.set(e,{replacement:t,extraProps:n})}function Je(e,t){ie.push({predicate:e,transform:t})}function Xe(e,t){G.push({predicate:e,onDetected:t})}function Ye(e){if(G.length===0)return;const t=[];for(const n of G){let o=!1;try{o=n.predicate(e)}catch{}if(o)try{n.onDetected(e)}catch{}else t.push(n)}G=t}function we(e,t){Ye(e);let n=t;if(n)for(const{predicate:l,transform:s}of ie)try{l(n)&&(n=s(n))}catch{}if(n)for(const{predicate:l,replacement:s}of Ce)try{if(l(n))return s?{type:s,props:n}:null}catch{}const o=oe.get(e);if(o)return{type:o.replacement,props:o.extraProps?{...n,...o.extraProps}:n};if(n!==t)return{type:e,props:n}}function Ke(e){if(U)return;const t=c.React.createElement;if(!t){console.warn("[ServerDrawer] React.createElement is null, skipping patch");return}const n=function(s,a,...g){const p=we(s,a);return p===null?null:p?t.call(c.React,p.type,p.props,...g):t.call(c.React,s,a,...g)};Object.assign(n,t),c.React.createElement=n,U=!0;const o=[],l=qe(function(){return m(function(s){return typeof s?.jsx=="function"&&typeof s?.jsxs=="function"&&"Fragment"in s})},function(s){for(const a of["jsx","jsxs"]){const g=s[a];typeof g=="function"&&(s[a]=function(p,S,...y){const d=we(p,S);return d===null?null:d?g.call(this,d.type,d.props,...y):g.call(this,p,S,...y)},o.push(function(){s[a]=g}))}});e.push(function(){l.cancel(),U&&(c.React.createElement=t,U=!1),o.forEach(function(s){return s()}),oe.clear(),Ce.length=0,ie.length=0,G=[]})}const Ze="[ServerDrawer]";function $e(e){return Je(function(t){const n=t?.value;return!!(n&&typeof n=="object"&&"isRendered"in n&&"isVisibleToUser"in n&&"quest"in n)},function(t){const n=t.value,o=n.quest??Ne();return{...t,value:{...n,isRendered:!0,isVisibleToUser:!0,quest:et(o)}}}),e.push(function(){}),console.log(Ze,"PATCH: watching for the Quest Dock coordination context"),!0}function Ne(){return{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:"",questBarHero:""},features:[]},userStatus:{enrolledAt:"2099-01-01",claimedAt:null},benefits:{rewards:[]},guildId:"0",tasks:[]}}function et(e){const t=e?.config?.assets;if(!t)return e;const n=t.questBarHero,o=t.questBarHeroVideo;return n!=null&&o!=null?e:{...e,config:{...e.config,assets:{...t,questBarHero:n??"",questBarHeroVideo:o??""}}}}function u(e){let t,n=!1;return function(){if(n)return t;const o=e();return o!=null&&(t=o,n=!0),o??void 0}}const A=u(function(){return x("useStateFromStores")}),H=u(function(){return z({triggerHapticFeedback:function(e){return typeof e=="function"},HapticFeedbackTypes:function(e){return e?.SOFT!==void 0}})}),le=u(function(){return z({colors:function(e){return e?.BG_ACCENT!==void 0},unsafe_rawColors:function(e){return e?.WHITE!==void 0}})}),Se=u(function(){return x("bulkAck","ackChannel")}),ke=u(function(){return z({ReadStateTypes:function(e){return e?.CHANNEL!==void 0},UnreadSetting:function(e){return e?.ALL_MESSAGES!==void 0}})}),tt=u(function(){return b("GuildStore")});function Ie({id:e,size:t=48}){const n=A(),o=tt(),l=le()?.colors,s=n?.useStateFromStores?.([o],function(){return o?.getGuild?.(e)},[e])??null;if(!s)return null;const a=t>=40?16:8;return s.icon?r.createElement(i.Image,{source:{uri:`https://cdn.discordapp.com/icons/${s.id}/${s.icon}.png?size=${t*2}`},style:{width:t,height:t,borderRadius:a}}):r.createElement(i.View,{style:[Re.fallback,{width:t,height:t,borderRadius:a,backgroundColor:l?.BG_ACCENT??"#5865f2"}]},r.createElement(i.Text,{style:[Re.letter,{fontSize:Math.max(10,t*.4)}]},s.name?.split(" ").map(function(g){return g[0]}).join("").slice(0,2).toUpperCase()||"?"))}const Re=i.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),nt=u(function(){return b("ThemeStore")}),rt=u(function(){return m(function(e){return e?.default?.internal?.resolveSemanticColor})?.default?.internal?.resolveSemanticColor??m(function(e){return e?.meta?.resolveSemanticColor})?.meta?.resolveSemanticColor});function ot(e,t=nt()?.theme){if(e)try{return rt()?.(t,e)}catch{return}}const it=u(function(){return z({TextStyleSheet:function(e){return e?.["text-md/bold"]!==void 0}})?.TextStyleSheet});function W(e,t){return ot(e)??t}const T=12,se=12,Fe=42,ae=220,De=4,v=16,Q=20,xe={tension:200,friction:20};function lt({visible:e,items:t,title:n,anchorX:o,anchorY:l,onClose:s}){const a=it(),g=H(),{width:p,height:S}=i.Dimensions.get("window"),y=(n?se+20+De:0)+t.length*Fe;let d=o,E=l+48+10;d+ae>p-T&&(d=p-ae-T),dS-T&&(E=l-y-10),E0?r.createElement(i.View,{style:_.outline},r.createElement(i.View,{style:_.badge},r.createElement(i.Text,{style:_.text},o>99?"99+":String(o)))):l?r.createElement(i.View,{style:_.dotOutline},r.createElement(i.View,{style:_.dot})):null:null}function Te({node:e,onPick:t}){const n=r.useRef(null),o=r.useRef(new i.Animated.Value(1)).current,l=function(){return i.Animated.spring(o,{toValue:.85,useNativeDriver:!0}).start()},s=function(){return i.Animated.spring(o,{toValue:1,useNativeDriver:!0}).start()},[a,g]=r.useState({visible:!1,items:[],title:"",x:0,y:0}),p=r.useCallback(function(){const d=e.id,E=ct()?.getGuild?.(d);if(!E)return;const B=n.current;if(!B?.measure)return;const V=[{label:"Mark as Read",action:function(){return ht(d)}},{label:"Copy Server ID",action:function(){c.clipboard.setString(d),I.showToast("Copied server ID",void 0)}}];B.measure(function(f,k,F,j,P,N){g({visible:!0,items:V,title:E.name,x:P,y:N})})},[e.id]),S=r.useCallback(function(){const d=H();d?.triggerHapticFeedback?.(d.HapticFeedbackTypes.IMPACT_MEDIUM),p()},[p]),y=e.id;return r.createElement(r.Fragment,null,r.createElement(i.Pressable,{onPressIn:l,onPressOut:s,onPress:function(){return t(y)},onLongPress:S,delayLongPress:500},r.createElement(i.View,{ref:n,style:Ve.outer,collapsable:!1},r.createElement(i.Animated.View,{style:[Ve.icon,{transform:[{scale:o}]}]},r.createElement(Ie,{id:y})),r.createElement(gt,{guildId:y}))),r.createElement(lt,{visible:a.visible,items:a.items,title:a.title,anchorX:a.x,anchorY:a.y,onClose:function(){return g(function(d){return{...d,visible:!1}})}}))}const Ve=i.StyleSheet.create({outer:{width:q,height:q},icon:{width:q,height:q,borderRadius:16,overflow:"hidden"}}),_=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"}}),pt=u(function(){return b("ExpandedGuildFolderStore")});function mt(e){const t=A(),n=pt();return t?.useStateFromStores?.([n],function(){const o=n?.getExpandedFolders?.();return o instanceof Set?o.has(e):!1},[e])??!1}const yt=u(function(){return x("toggleGuildFolderExpand")}),bt=u(function(){return b("GuildReadStateStore")}),R=48,ce=16,Ct=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],Ae=re.getAssetIDByName("FolderIcon");function He(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function Et({node:e}){const t=A(),n=bt(),o=t?.useStateFromStores?.([n],function(){let l=0;for(const s of e.children)l+=n?.getMentionCount?.(s.id)??0;return l},[e.children])??0;return o>0?r.createElement(i.View,{style:fe.outline},r.createElement(i.View,{style:fe.badge},r.createElement(i.Text,{style:fe.text},o>99?"99+":String(o)))):null}function wt({node:e}){ne.useProxy(h.storage);const t=He(e.color);return r.createElement(i.View,{style:J.outer},r.createElement(i.View,{style:[J.icon,{backgroundColor:t}]},h.storage.hideFolderIcons?r.createElement(i.View,{style:J.plainIcon},r.createElement(i.Image,{source:Ae,style:de.folderImg,tintColor:"#fff"})):e.children.slice(0,4).map(function(n,o){return r.createElement(i.View,{key:n.id,style:[J.cell,Ct[o]]},r.createElement(Ie,{id:n.id,size:ce}))})),r.createElement(Et,{node:e}))}const J=i.StyleSheet.create({outer:{width:R,height:R},icon:{width:R,height:R,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:ce,height:ce,borderRadius:8,overflow:"hidden"},plainIcon:{width:R,height:R,alignItems:"center",justifyContent:"center"}});function St({children:e}){const t=r.useRef(new i.Animated.Value(0)).current;return r.useEffect(function(){i.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),r.createElement(i.Animated.View,{style:{opacity:t}},e)}function kt({node:e,onPick:t}){const n=mt(e.id),o=function(){yt()?.toggleGuildFolderExpand?.(e.id)};return n?r.createElement(r.Fragment,null,r.createElement(i.Pressable,{onPress:o},r.createElement(i.View,{style:[de.openIcon,{backgroundColor:He(e.color)}]},r.createElement(i.Image,{source:Ae,style:de.folderImg,tintColor:"#fff"}))),e.children.map(function(l){return r.createElement(St,{key:l.id},r.createElement(Te,{node:l,onPick:t}))})):r.createElement(i.Pressable,{onPress:o},r.createElement(wt,{node:e}))}const de=i.StyleSheet.create({openIcon:{width:R,height:R,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),fe=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}}),X=48,It=re.getAssetIDByName("ChatIcon"),Rt=u(function(){return x("selectPrivateChannel")}),Ft=u(function(){return Qe("SelectedChannelStore")}),Dt=u(function(){return x("getGuildId")});function xt(){const e=H();e?.triggerHapticFeedback?.(e.HapticFeedbackTypes.SOFT);const t=Rt();if(t?.selectPrivateChannel){const n=Ft()?.getLastSelectedChannelId?.();t.selectPrivateChannel(n)}}function Tt(){const e=A(),t=Dt(),n=le()?.colors,o=e?.useStateFromStores?.([t],function(){return t?.getGuildId?.()==null})??!1;return r.createElement(i.Pressable,{onPress:xt,style:Be.outer},r.createElement(i.View,{style:[Be.icon,{backgroundColor:o?n?.BG_ACCENT??"#5865f2":"rgba(128,128,128,0.24)"}]},r.createElement(i.Image,{source:It,style:{width:24,height:24,tintColor:"#fff"}})))}const Be=i.StyleSheet.create({outer:{width:X,height:X},icon:{width:X,height:X,borderRadius:16,alignItems:"center",justifyContent:"center"}}),Pe=48,Vt=re.getAssetIDByName("CheckmarkLargeIcon"),At=Se,Ht=u(function(){return ke()?.ReadStateTypes}),Bt=u(function(){return b("SortedGuildStore")}),Pt=u(function(){return b("GuildChannelStore")}),Gt=u(function(){return b("ChannelStore")});function vt(){const e=(Bt()?.getGuildsTree?.()?.root?.children??[]).filter(function(o){return o?.type!=="root"}),t=[],n=function(o){for(const l of o)l.type==="folder"?n(l.children??[]):l.id!=null&&t.push(String(l.id))};return n(e),t}function _t(){const e=At(),t=Ht(),n=Pt(),o=Gt();if(!e?.bulkAck||t?.CHANNEL==null||!n?.getSelectableChannelIds||!n?.getVocalChannelIds){I.showToast("Couldn't find Discord's read-state action - this may be unavailable on your version.",void 0);return}const l=vt();if(l.length===0){I.showToast("Nothing to mark as read.",void 0);return}const s=[];for(const a of l){const g=[...n.getSelectableChannelIds(a)??[],...n.getVocalChannelIds(a)??[]];for(const p of g)s.push({channelId:p,readStateType:t.CHANNEL,messageId:o?.getChannel?.(p)?.lastMessageId??null})}if(s.length===0){I.showToast("Nothing to mark as read.",void 0);return}e.bulkAck(s),I.showToast(`Marked ${s.length} channel${s.length===1?"":"s"} as read`,void 0)}function Lt(){const e=r.useCallback(function(){const t=H();t?.triggerHapticFeedback?.(t.HapticFeedbackTypes.SOFT),_t()},[]);return r.createElement(i.Pressable,{onPress:e,style:jt.outer},r.createElement(i.Image,{source:Vt,style:{width:24,height:24,tintColor:"#80848e"}}))}const jt=i.StyleSheet.create({outer:{width:Pe,height:Pe,alignItems:"center",justifyContent:"center"}}),Ot=u(function(){return x("getRootNavigationRef")}),Mt=u(function(){return x("transitionToGuild")}),zt=u(function(){return m(function(e){return typeof e?.handleCreateJoinGuildPress=="function"})}),Ut=u(function(){return m(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon}),Wt=u(function(){return m(function(e){return e?.QuestDockExternalCoordinationContext})?.QuestDockExternalCoordinationContext}),Qt=u(function(){return m(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode}),qt=u(function(){return m(function(e){return typeof e?.getName=="function"&&e.getName.length===0&&e.getName()==="SortedGuildStore"})}),Y=48,K=6,Jt=12;function Xt(){const e=r.useRef(new i.Animated.Value(1)).current,t=r.useCallback(function(){i.Animated.spring(e,{toValue:.9,useNativeDriver:!0}).start()},[e]),n=r.useCallback(function(){i.Animated.spring(e,{toValue:1,useNativeDriver:!0}).start()},[e]),o=r.useCallback(function(){const a=H();a?.triggerHapticFeedback?.(a.HapticFeedbackTypes.SOFT),zt()?.handleCreateJoinGuildPress?.()},[]),l=Ut(),s=le()?.unsafe_rawColors;return r.createElement(i.Pressable,{onPress:o,onPressIn:t,onPressOut:n},r.createElement(i.Animated.View,{style:[Z.createJoin,{backgroundColor:s?.GREEN_360,transform:[{scale:e}]}]},l?r.createElement(l,{size:"md",color:s?.WHITE}):r.createElement(i.Text,{style:[Z.createJoinFallback,{color:s?.WHITE}]},"+")))}function Ge({gestureContext:e}){const t=r.useCallback(function(f){const k=H();k?.triggerHapticFeedback?.(k.HapticFeedbackTypes.SOFT);const F=Mt();F?.transitionToGuild?F.transitionToGuild(f):Ot()?.getRootNavigationRef?.()?.navigate("guilds",{guildId:f})},[]),n=A(),o=qt(),l=n?.useStateFromStores?.([o],function(){return(o?.getGuildsTree()?.root?.children||[]).filter(function(f){return f.type!=="root"})})??[],s=e?r.useContext(e):null,a=s?.minExpandedContentHeight,g=r.useCallback(function(f){if(!a)return;const k=f.nativeEvent.layout.height;a.get()!==k&&a.set(k)},[a]),p=Wt(),S=(p?r.useContext(p):null)?.setRestingQuestDockMode,y=s?.questDockWrapperSpecs;r.useEffect(function(){const f=Qt();if(!S||!f||!y)return;const k=i.BackHandler.addEventListener("hardwareBackPress",function(){return(y.get()?.height??56)>80?(S(f.COLLAPSED),!0):!1});return function(){return k.remove()}},[S,y]);const{width:d}=i.Dimensions.get("window"),E=Math.max(3,Math.floor((d-Jt*2+K)/(Y+K))),B=E*Y+(E-1)*K,V=Math.max(0,(d-B)/2);return r.createElement(i.View,{style:Z.alignTop},r.createElement(i.View,{style:[Z.grid,{paddingHorizontal:V,gap:K}],onLayout:g},r.createElement(Tt,null),l.map(function(f){return f.type==="folder"?r.createElement(kt,{key:f.id,node:f,onPick:t}):r.createElement(Te,{key:f.id,node:f,onPick:t})}),r.createElement(Xt,null),r.createElement(Lt,null)))}const Z=i.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16},createJoin:{width:Y,height:Y,borderRadius:16,alignItems:"center",justifyContent:"center"},createJoinFallback:{fontSize:28,fontWeight:"700",lineHeight:30}}),he="[ServerDrawer]";let ge=null;function ve(){return ge||(ge=m(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),ge}function Yt(e){const t=m(function(o){return o?.type?.displayName==="QuestDockContentExpanded"||o?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(he,"WARN: QuestDockContentExpanded not found (will retry)"),!1;const n=t.type;return Ee(n,Ge,{gestureContext:ve()}),t.type=function(){return c.React.createElement(Ge,{gestureContext:ve()})},e.push(function(){t.type=n}),console.log(he,"PATCH: QuestDockContentExpanded replaced"),!0}function L(e,t){const n=m(function(s){return s?.type?.displayName===e||s?.type?.name===e});if(!n?.type)return console.log(he,`WARN: ${e} not found`),!1;const o=n.type,l=o;return n.type=function(){return null},l&&(Object.defineProperties(n.type,Object.getOwnPropertyDescriptors(l)),n.type.displayName=e),t.push(function(){n.type=o}),!0}const _e="[ServerDrawer]";function Kt(e){if(e)try{let t=null;if(e._internalFiberInstanceHandleDEV)t=e._internalFiberInstanceHandleDEV;else if(e._internalInstanceHandle)t=e._internalInstanceHandle;else if(e.__internalInstanceHandle)t=e.__internalInstanceHandle;else{const l=Object.keys(e).find(function(s){return s.startsWith("__reactFiber$")||s.startsWith("__reactInternalInstance$")});l&&(t=e[l])}if(!t)return;if(t.return===void 0&&t.child===void 0){const l=t.stateNode??t.fiber??t._debugOwner;if(l&&(l.return!==void 0||l.child!==void 0))t=l;else return}let n=t,o=0;for(;n.return&&o<5e3;)n=n.return,o++;window.__keyInspectorFiberRoot=n,window.__keyInspectorFiberSelf=t}catch{}}function Zt(){return r.createElement(i.View,{ref:Kt,style:{width:1,height:1}})}function $t(e){return e?.name==="GuildsBar"||e?.displayName==="GuildsBar"||e?.type?.name==="GuildsBar"||e?.type?.displayName==="GuildsBar"}function Nt(e){return Xe($t,function(t){Ee(t,Zt),console.log(_e,"PATCH: found the real GuildsBar reference, now rendering nothing")}),e.push(function(){}),console.log(_e,"PATCH: watching for the real GuildsBar to appear"),!0}function en(e){const t=b("ExpandedGuildFolderStore");if(!t?.getExpandedFolders)return!1;const n=function({folderId:o}){if(!h.storage.autoCollapseFolders||o==null)return;const l=t.getExpandedFolders();if(!(!(l instanceof Set)||!l.has(o)))for(const s of l)s!==o&&c.FluxDispatcher.dispatch({type:"TOGGLE_GUILD_FOLDER_EXPAND",folderId:s})};return c.FluxDispatcher.subscribe("TOGGLE_GUILD_FOLDER_EXPAND",n),e.push(function(){return c.FluxDispatcher.unsubscribe("TOGGLE_GUILD_FOLDER_EXPAND",n)}),!0}const{ScrollView:tn,View:nn}=c.ReactNative;function rn({children:e}){return c.React.createElement(tn,{style:{flex:1}},e,c.React.createElement(nn,{style:{height:24}}))}const{View:on,Text:ln}=c.ReactNative;function Le({children:e,style:t}){return c.React.createElement(on,{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:je,FormSwitchRow:$}=We.Forms;function sn(){return ne.useProxy(h.storage),c.React.createElement(rn,null,c.React.createElement(Le,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(je,{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,ze()}}),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(je,{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(Le,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 C=[],w;function an(e,t){try{return t()}catch(n){return te.logger.error(`[ServerDrawer] "${e}" patch threw, skipping: ${n}`),!1}}function Oe(){const e={questDockContext:function(){return $e(C)},expanded:function(){return Yt(C)},collapsed:function(){return L("QuestDockContentCollapsed",C)},enrolledHeader:function(){return L("QuestDockEnrolledHeader",C)},unenrolledHeader:function(){return L("QuestDockUnenrolledHeader",C)},enrolledBody:function(){return L("QuestDockEnrolledBody",C)},unenrolledBody:function(){return L("QuestDockUnenrolledBody",C)},autoCollapseFolders:function(){return en(C)},...h.storage.hideGuildsBar?{hideGuildsBar:function(){return Nt(C)}}:{}};Ke(C);const t=new Set(Object.keys(e)),n=new Set,o=function(){for(const l of t)an(l,e[l])&&(n.add(l),t.delete(l));t.size===0&&w&&(clearInterval(w),w=void 0)};if(o(),t.size>0){let l=0;w=setInterval(function(){o(),++l>=50&&w&&(clearInterval(w),w=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 Me(){w&&(clearInterval(w),w=void 0);for(const e of C)try{e()}catch{}C=[]}function ze(){Me(),Oe()}var un={onLoad:function(){h.storage.hideGuildsBar??=!0,h.storage.showUnreadBadges??=!0,h.storage.autoCollapseFolders??=!1,h.storage.hideFolderIcons??=!1,Oe()},onUnload:function(){return Me()},settings:sn};return O.default=un,O.restart=ze,Object.defineProperty(O,"__esModule",{value:!0}),O})({},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 c4bd68c..898f3fc 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":"087c6344213eee035874c9a4880022d71c4d08d12f34f5ea2cf90f53471aef14"} \ 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":"32e3e03958ce0613c21853b5967c3046fa965cc85b2ddd4ca21607d527d05909"} \ No newline at end of file