const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dom-DChi-NQM.js","./pwa-viewport-DMWn8mqY.js","./ScheduledAtField-C0npnZJs.js","./ICONS-Byf2mPeO.js","./mock-home-CPV8RpqJ.js","./year-in-posts-DuNF_0LH.js"])))=>i.map(i=>d[i]); import{Q as Oc,u as e,x as yo,A as j,y as G,M as ut,a as ce,d as $,s as R,b as oe,c as Je,p as It,e as We,q as nt,g as dt,k as B,T as m,f as rn,h as Et,i as qt,j as ke,l as Jn,m as xe,L as zc,C as Ci,n as qc,o as Bc,r as ei,t as Vi,v as bs,w as en,z as hi,B as qe,E as Fc,F as Uc,G as Yi,H as he,I as ti,J as ni,_ as _t,K as fi,N as vo,O as Hh,P as ln,R as bo,S as Wi,U as Kc,V as Hc,W as pt,X as jc,Y as Vc,Z as xt,$ as Yc,a0 as Gi,a1 as Zi,a2 as Ut,a3 as et,a4 as wo,a5 as ko,a6 as Wc,a7 as So,a8 as Gc,a9 as Zc,aa as _n,ab as Xc,ac as Qc,ad as Co,ae as Jc,af as _i,ag as Ii,ah as ea,ai as ws,aj as ta,ak as na,al as ia,am as Xi,an as Ge,ao as _o,ap as sa,aq as oa,ar as ca,as as aa,at as ra,au as la,av as da}from"./pwa-viewport-DMWn8mqY.js";import{u as Qi,f as He,s as le,o as ks,a as ua,V as ii,b as Io,I as _,C as pi,M as Ve,c as Ye,S as Rn,d as ye,e as mi,R as Rt,n as rt,g as Ji,h as Fe,A as lt,N as yt,i as mt,j as ft,L as pe,l as Bt,k as ha,m as xo,p as Gt,q as fa,r as Vh,t as Xe,v as dn,w as vt,x as Ss,T as Ao,y as at,z as Di,B as To,E as Eo,D as Ke,F as Ct,G as je,H as Dt,J as pa,K as ma,O as Yt,P as es,Q as Ro,U as ga,W as Zt,X as ya,Y as va,Z as gi,_ as ba,$ as Xt,a0 as wa,a1 as ka,a2 as Lo,a3 as Sa,a4 as ts,a5 as Ca,a6 as _a,a7 as Ia,a8 as xa,a9 as Aa,aa as $o,ab as Ta,ac as Ea,ad as Cs,ae as Ra,af as La}from"./ScheduledAtField-C0npnZJs.js";import{ICONS as sn}from"./ICONS-Byf2mPeO.js";var Mo=$a;function $a(n,i,s){var o=null,c=null,a=function(){o&&(clearTimeout(o),c=null,o=null)},u=function(){var d=c;a(),d&&d()},l=function(){if(!i)return n.apply(this,arguments);var d=this,r=arguments,h=s&&!o;if(a(),c=function(){n.apply(d,r)},o=setTimeout(function(){if(o=null,!h){var f=c;return c=null,f()}},i),h)return c()};return l.cancel=a,l.flush=u,l}(function(n,i){"use strict";typeof n.CustomEvent!="function"&&(n.CustomEvent=function(g,y){y=y||{bubbles:!1,cancelable:!1,detail:void 0};var w=i.createEvent("CustomEvent");return w.initCustomEvent(g,y.bubbles,y.cancelable,y.detail),w},n.CustomEvent.prototype=n.Event.prototype),i.addEventListener("touchstart",h,!1),i.addEventListener("touchmove",f,!1),i.addEventListener("touchend",r,!1);var s=null,o=null,c=null,a=null,u=null,l=null,d=0;function r(g){if(l===g.target){var y=parseInt(p(l,"data-swipe-threshold","20"),10),w=p(l,"data-swipe-unit","px"),k=parseInt(p(l,"data-swipe-timeout","500"),10),b=Date.now()-u,S="",x=g.changedTouches||g.touches||[];if(w==="vh"&&(y=Math.round(y/100*i.documentElement.clientHeight)),w==="vw"&&(y=Math.round(y/100*i.documentElement.clientWidth)),Math.abs(c)>Math.abs(a)?Math.abs(c)>y&&b0?S="swiped-left":S="swiped-right"):Math.abs(a)>y&&b0?S="swiped-up":S="swiped-down"),S!==""){var C={dir:S.replace(/swiped-/,""),touchType:(x[0]||{}).touchType||"direct",fingers:d,xStart:parseInt(s,10),xEnd:parseInt((x[0]||{}).clientX||-1,10),yStart:parseInt(o,10),yEnd:parseInt((x[0]||{}).clientY||-1,10)};l.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:C})),l.dispatchEvent(new CustomEvent(S,{bubbles:!0,cancelable:!0,detail:C}))}s=null,o=null,u=null}}function h(g){g.target.getAttribute("data-swipe-ignore")!=="true"&&(l=g.target,u=Date.now(),s=g.touches[0].clientX,o=g.touches[0].clientY,c=0,a=0,d=g.touches.length)}function f(g){if(!(!s||!o)){var y=g.touches[0].clientX,w=g.touches[0].clientY;c=s-y,a=o-w}}function p(g,y,w){for(;g&&g!==i.documentElement;){var k=g.getAttribute(y);if(k)return k;g=g.parentNode}return w}})(window,document);const Po=Oc(!1);function Ma({children:n,value:i}){return e(Po.Provider,{value:i,children:n})}function yi(){return yo(Po)}function un(n=()=>{},i=[]){const s=j(n);G(()=>{s.current=n},[i]),G(()=>{const o=()=>{const c=document.hidden||document.visibilityState==="hidden";s.current(!c)};return document.addEventListener("visibilitychange",o),()=>document.removeEventListener("visibilitychange",o)},[])}const Pa=1e3*3,_s=2e4,Da=ut(function(){const i=yi(),{_:s}=ce(),[o,c]=$(!0),a=j();un(r=>{clearTimeout(a.current),r?c(!0):a.current=setTimeout(()=>{c(!1)},_s)});const u=async(r,h,f)=>{if(R.notificationsLast){const p=r.v1.notifications.list({limit:1,sinceId:R.notificationsLast.id}).values(),{value:g}=await p.next();if(g?.length)if(f)R.notificationsShowNew=!0;else{let y;try{y=(await r.v1.markers.fetch({timeline:"notifications"}))?.notifications?.lastReadId}catch{}y?R.notificationsShowNew=g[0].id!==y:R.notificationsShowNew=!0}}};G(()=>{let r,h,f;if(i&&o){const{masto:p,streaming:g,instance:y}=oe();(async()=>{await u(p,y);let w=!1;g&&(h=setTimeout(()=>{(async()=>{try{w=!0,r=g.user.notification.subscribe();for await(const k of r){if(!r||!o)break;k.event==="notification"&&Je(k.payload,y,{skipThreading:!0}),R.notificationsShowNew=!0}}catch{w=!1}w||(f=setInterval(()=>{u(p,y,!0)},_s))})()},Pa))})()}return()=>{r?.unsubscribe?.(),r=null,clearTimeout(h),clearInterval(f)}},[o,i]);const l=j(),d=()=>{l.current=Date.now(),fetch("./version.json").then(r=>r.json()).then(r=>{r&&(R.appVersion=r)}).catch(r=>{})};return Qi(d,o&&1e3*60*30),un(r=>{r&&(l.current?Date.now()-l.current>1e3*60*60&&d():d())}),He("shift+alt+k",r=>{if(!r.shiftKey||!r.altKey)return;const h=R.settings.cloakMode;R.settings.cloakMode=!h,le({text:s(h?{id:"oguMwa"}:{id:"IXZLPs"})})},{ignoreEventWhen:r=>r.metaKey||r.ctrlKey}),null}),Na=It(async(n,i)=>{const s=n.v1.accounts.$select(i).statuses.list({limit:3,exclude_replies:!0,exclude_reblogs:!0}).values(),{value:o}=await s.next();return o||[]},{expires:6e4});function Oa(){const{_:n}=ce(),i=We(R),{masto:s}=oe(),[o,c]=$(!1),[a,u]=$([]),[l,d]=$(!1),r=j(null),h=j(null),f=i.settings.shortcutsViewMode==="multi-column";function p(k){if(k.key&&k.key.toLowerCase()!=="c")return;if(i.composerState.minimized){R.composerState.minimized=!1,ks();return}const b=document.querySelectorAll("data.compose-data"),S=!f&&b.length===1?JSON.parse(b[0].value):void 0;k.shiftKey?ua(S)||(R.showCompose=S||!0):(ks(),R.showCompose=S||!0)}He("c, shift+c",p,{useKey:!0,ignoreEventWhen:k=>!!document.querySelector("#modal-container > *")||k.metaKey||k.ctrlKey||k.altKey});const g=ii(()=>{c(!0)},{threshold:600}),y=nt(async()=>{try{d(!0);const k=dt();if(!k)return;const b=await Na(s,k);u(b)}catch{}finally{d(!1)}},[s]),w=nt(k=>{Io({replyToStatus:k}),c(!1)},[]);return G(()=>{o&&y()},[y,o]),e(B,{children:[e("button",{ref:r,type:"button",id:"compose-button",onClick:p,onContextMenu:k=>{k.preventDefault(),c(!0)},...g(),class:`${i.composerState.minimized?"min":""} ${i.composerState.publishing?"loading":""} ${i.composerState.publishingError?"error":""}`,children:e(_,{icon:"quill",size:"xl",alt:n({id:"QOhkyl"})})}),e(pi,{ref:h,state:o?"open":void 0,anchorRef:r,onClose:()=>c(!1),direction:"top",gap:8,unmountOnClose:!0,portal:{target:document.body},boundingBoxPadding:Ji(),containerProps:{style:{zIndex:19},onClick:()=>{h.current?.closeMenu?.()}},submenuOpenDelay:600,children:[e(Ve,{to:"/sp",children:[e(_,{icon:"schedule"})," ",e("span",{children:e(m,{id:"+GkIdc"})})]}),e(Ye,{}),e(Rn,{align:"end",direction:"top",shift:-8,disabled:l||a.length===0,label:e(B,{children:[e(_,{icon:"comment"})," ",e("span",{className:"menu-grow",children:e(m,{id:"LwOr4P"})}),l?"…":e(_,{icon:"chevron-right"})]}),children:a.length>0&&a.map(k=>{const b=new Date(k.createdAt),S=Date.now()-b.getTime()<864e5;return e(ye,{onClick:()=>w(k),children:e("small",{children:[e("div",{class:"menu-post-text",children:mi(k)}),e("span",{className:"more-insignificant",children:[S&&e(B,{children:[e(Rt,{datetime:b,format:"micro"})," ","‒"," "]}),e("time",{className:"created",dateTime:b.toISOString(),title:b.toLocaleString(),children:rt(k.createdAt)})]})]})},k.id)})})]})]})}function mn({key1:n,key2:i}){return e(m,{id:"Qh+0sm",values:{key1:n,key2:i},components:{0:e("kbd",{}),1:e("kbd",{})}})}const za=ut(function(){const{_:i}=ce(),s=We(R);function o(){R.showKeyboardShortcutsHelp=!1}return He("?",()=>{R.showKeyboardShortcutsHelp=!0},{useKey:!0,ignoreModifiers:!0,ignoreEventWhen:c=>/\/catchup/i.test(location.hash)||c.metaKey||c.ctrlKey||c.altKey}),!!s.showKeyboardShortcutsHelp&&e(Fe,{onClose:o,children:e("div",{id:"keyboard-shortcuts-help-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:o,children:e(_,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(m,{id:"77Emn0"})})}),e("main",{children:e("table",{children:e("tbody",{children:[{action:i({id:"ulXSNi"}),keys:e("kbd",{children:"?"})},{action:i({id:"Gy9P9T"}),keys:e("kbd",{children:"j"})},{action:i({id:"6XYpYY"}),keys:e("kbd",{children:"k"})},{action:i({id:"DYowFe"}),keys:e(m,{id:"mzjGX4",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"S5ez7Y"}),keys:e(m,{id:"Fd8FaU",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"VkLESX"}),keys:e("kbd",{children:"."})},{action:i({id:"jsFF8C"}),keys:e("kbd",{children:"Enter"})},{action:i({id:"9VPqHP"}),keys:e("kbd",{children:"o"})},{action:e(m,{id:"41gejM",components:{0:e("br",{})}}),keys:e("kbd",{children:"x"})},{action:i({id:"jAj8rv"}),keys:e(m,{id:"evz6c6",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"duF1lx"}),keys:e(m,{id:"nhpsIN",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"YrR3Co"}),keys:e("kbd",{children:"]"})},{action:i({id:"noxAFR"}),keys:e("kbd",{children:"["})},{action:i({id:"AIa/f7"}),keys:e("kbd",{children:"c"})},{action:i({id:"snPx8X"}),className:"insignificant",keys:e(m,{id:"+Cxvld",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"1pKapz"}),keys:e(m,{id:"py67WT",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{}),3:e("kbd",{})}})},{action:i({id:"A1taO8"}),keys:e("kbd",{children:"/"})},{action:i({id:"ImOQa9"}),keys:e("kbd",{children:"r"})},{action:i({id:"KFs8c6"}),className:"insignificant",keys:e(m,{id:"XpQLJF",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"cqi4Mx"}),keys:e(m,{id:"84WuL2",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"kulphB"}),keys:e(m,{id:"yrz6Ck",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"ZhhOwV"}),keys:e("kbd",{children:"q"})},{action:i({id:"PZlHt8"}),keys:e("kbd",{children:"d"})},{action:i({id:"C7ujRh"}),keys:e(m,{id:"v4TbMP",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{})}})},{action:i({id:"UmuIdg"}),keys:e(mn,{key1:"g",key2:"h"})},{action:i({id:"0YgcH9"}),keys:e(mn,{key1:"g",key2:"n"})},{action:i({id:"mT57+Q"}),keys:e(mn,{key1:"g",key2:"s"})},{action:i({id:"T1/8PL"}),keys:e(mn,{key1:"g",key2:"p"})},{action:i({id:"29r697"}),keys:e(mn,{key1:"g",key2:"b"})}].map(({action:c,className:a,keys:u})=>e("tr",{children:[e("th",{class:a,children:c}),e("td",{children:u})]},c))})})})]})})}),Ni=new Set,ot=new WeakMap,Qt=new WeakMap,bt=new WeakMap,In=new WeakMap,xi=new WeakMap,Sn=new WeakMap,Wt=new WeakMap,Ft=new WeakMap,an=new WeakSet;let ht,ns=0,is=0;const Mt="__aa_tgt",xn="__aa_del",si="__aa_new",Do=n=>{const i=Ua(n);i&&i.forEach(s=>Ka(s))},qa=n=>{n.forEach(i=>{i.target===ht&&Ba(),ot.has(i.target)&&tn(i.target)})};function No(n){const i=n.getBoundingClientRect(),s=ht?.clientWidth||0,o=ht?.clientHeight||0;return i.bottom<0||i.top>o||i.right<0||i.left>s}function ss(n){const i=In.get(n);i?.disconnect();let s=ot.get(n),o=0;const c=5;s||(s=hn(n),ot.set(n,s));const{offsetWidth:a,offsetHeight:u}=ht,d=[s.top-c,a-(s.left+c+s.width),u-(s.top+c+s.height),s.left-c].map(h=>`${-1*Math.floor(h)}px`).join(" "),r=new IntersectionObserver(()=>{++o>1&&tn(n)},{root:ht,threshold:1,rootMargin:d});r.observe(n),In.set(n,r)}function tn(n,i=!0){clearTimeout(Ft.get(n));const s=vi(n),o=i?An(s)?500:s.duration:0;Ft.set(n,setTimeout(async()=>{const c=bt.get(n);try{await c?.finished,ot.set(n,hn(n)),ss(n)}catch{}},o))}function Ba(){clearTimeout(Ft.get(ht)),Ft.set(ht,setTimeout(()=>{Ni.forEach(n=>Un(n,i=>Oo(()=>tn(i))))},100))}function Fa(n){setTimeout(()=>{Sn.set(n,setInterval(()=>Oo(tn.bind(null,n)),2e3))},Math.round(2e3*Math.random()))}function Oo(n){typeof requestIdleCallback=="function"?requestIdleCallback(()=>n()):requestAnimationFrame(()=>n())}let $t;const zo=typeof window<"u"&&"ResizeObserver"in window;zo&&(ht=document.documentElement,new MutationObserver(Do),$t=new ResizeObserver(qa),window.addEventListener("scroll",()=>{is=window.scrollY,ns=window.scrollX}),$t.observe(ht));function Ua(n){return n.reduce((o,c)=>[...o,...Array.from(c.addedNodes),...Array.from(c.removedNodes)],[]).every(o=>o.nodeName==="#comment")?!1:n.reduce((o,c)=>{if(o===!1)return!1;if(c.target instanceof Element){if(Ai(c.target),!o.has(c.target)){o.add(c.target);for(let a=0;as(n,Wt.has(n)));for(let s=0;sc(o,Wt.has(o)))}}function cs(n){return Array.isArray(n)?n:[n]}function An(n){return typeof n=="function"}function ja(n){const i=ot.get(n),s=hn(n);if(!os(n))return ot.set(n,s);if(No(n)){ot.set(n,s),ss(n);return}let o;if(!i)return;const c=vi(n);if(typeof c!="function"){let a=i.left-s.left,u=i.top-s.top;const l=i.left+i.width-(s.left+s.width);i.top+i.height-(s.top+s.height)==0&&(u=0),l==0&&(a=0);const[r,h,f,p]=qo(n,i,s),g={transform:`translate(${a}px, ${u}px)`},y={transform:"translate(0, 0)"};r!==h&&(g.width=`${r}px`,y.width=`${h}px`),f!==p&&(g.height=`${f}px`,y.height=`${p}px`),o=n.animate([g,y],{duration:c.duration,easing:c.easing})}else{const[a]=cs(c(n,"remain",i,s));o=new Animation(a),o.play()}bt.set(n,o),ot.set(n,s),o.addEventListener("finish",tn.bind(null,n,!1),{once:!0})}function Is(n){si in n&&delete n[si];const i=hn(n);ot.set(n,i);const s=vi(n);if(!os(n))return;if(No(n)){ss(n);return}let o;if(typeof s!="function")o=n.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:s.duration*1.5,easing:"ease-in"});else{const[c]=cs(s(n,"add",i));o=new Animation(c),o.play()}bt.set(n,o),o.addEventListener("finish",tn.bind(null,n,!1),{once:!0})}function xs(n,i){var s;n.remove(),ot.delete(n),Qt.delete(n),bt.delete(n),(s=In.get(n))===null||s===void 0||s.disconnect(),setTimeout(()=>{if(xn in n&&delete n[xn],Object.defineProperty(n,si,{value:!0,configurable:!0}),i&&n instanceof HTMLElement)for(const o in i)n.style[o]=""},0)}function Va(n){var i;if(!Qt.has(n)||!ot.has(n))return;const[s,o]=Qt.get(n);Object.defineProperty(n,xn,{value:!0,configurable:!0});const c=window.scrollX,a=window.scrollY;if(o&&o.parentNode&&o.parentNode instanceof Element?o.parentNode.insertBefore(n,o):s&&s.parentNode?s.parentNode.appendChild(n):(i=Bo(n))===null||i===void 0||i.appendChild(n),!os(n))return xs(n);const[u,l,d,r]=Wa(n),h=vi(n),f=ot.get(n);(c!==ns||a!==is)&&Ya(n,c,a,h);let p,g={position:"absolute",top:`${u}px`,left:`${l}px`,width:`${d}px`,height:`${r}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!An(h))Object.assign(n.style,g),p=n.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:h.duration,easing:"ease-out"});else{const[y,w]=cs(h(n,"remove",f));w?.styleReset!==!1&&(g=w?.styleReset||g,Object.assign(n.style,g)),p=new Animation(y),p.play()}bt.set(n,p),p.addEventListener("finish",()=>xs(n,g),{once:!0})}function Ya(n,i,s,o){const c=ns-i,a=is-s,u=document.documentElement.style.scrollBehavior;if(getComputedStyle(ht).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+c,window.scrollY+a),!n.parentElement)return;const d=n.parentElement;let r=d.clientHeight,h=d.clientWidth;const f=performance.now();function p(){requestAnimationFrame(()=>{if(!An(o)){const g=r-d.clientHeight,y=h-d.clientWidth;f+o.duration>performance.now()?(window.scrollTo({left:window.scrollX-y,top:window.scrollY-g}),r=d.clientHeight,h=d.clientWidth,p()):document.documentElement.style.scrollBehavior=u}})}p()}function Wa(n){var i;const s=ot.get(n),[o,,c]=qo(n,s,hn(n));let a=n.parentElement;for(;a&&(getComputedStyle(a).position==="static"||a instanceof HTMLBodyElement);)a=a.parentElement;a||(a=document.body);const u=getComputedStyle(a),l=!bt.has(n)||((i=bt.get(n))===null||i===void 0?void 0:i.playState)==="finished"?hn(a):ot.get(a),d=Math.round(s.top-l.top)-Tt(u.borderTopWidth),r=Math.round(s.left-l.left)-Tt(u.borderLeftWidth);return[d,r,o,c]}function Fo(n,i={}){if(zo&&$t&&!(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!An(i)&&!i.disrespectUserMotionPreference)){an.add(n),getComputedStyle(n).position==="static"&&Object.assign(n.style,{position:"relative"}),Un(n,tn,Fa,u=>$t?.observe(u)),An(i)?Wt.set(n,i):Wt.set(n,{duration:250,easing:"ease-in-out",...i});const a=new MutationObserver(Do);a.observe(n,{childList:!0}),xi.set(n,a),Ni.add(n)}return Object.freeze({parent:n,enable:()=>{an.add(n)},disable:()=>{an.delete(n),Un(n,o=>{const c=bt.get(o);try{c?.cancel()}catch{}bt.delete(o);const a=Ft.get(o);a&&clearTimeout(a),Ft.delete(o);const u=Sn.get(o);u&&clearInterval(u),Sn.delete(o)})},isEnabled:()=>an.has(n),destroy:()=>{an.delete(n),Ni.delete(n),Wt.delete(n);const o=xi.get(n);o?.disconnect(),xi.delete(n),Un(n,c=>{$t?.unobserve(c);const a=bt.get(c);try{a?.cancel()}catch{}bt.delete(c);const u=In.get(c);u?.disconnect(),In.delete(c);const l=Sn.get(c);l&&clearInterval(l),Sn.delete(c);const d=Ft.get(c);d&&clearTimeout(d),Ft.delete(c),ot.delete(c),Qt.delete(c)})}})}function bi(n){const i=j(null),[s,o]=$(),c=a=>{s&&(a?s.enable():s.disable())};return G(()=>{i.current instanceof HTMLElement&&o(Fo(i.current,n||{}))},[]),G(()=>()=>{var a;(a=s?.destroy)===null||a===void 0||a.call(s)},[s]),[i,c]}function Ga(n){return("0"+n.toString(16)).slice(-2)}function Za(){var n=new Uint32Array(28);return window.crypto.getRandomValues(n),Array.from(n,Ga).join("")}function Xa(n){const s=new TextEncoder().encode(n);return window.crypto.subtle.digest("SHA-256",s)}function Qa(n){let i="";const s=new Uint8Array(n),o=s.byteLength;for(var c=0;c1,[u,l]=Et(r=>r+1,0),[d]=bi();return e("div",{id:"accounts-container",class:"sheet",tabIndex:"-1",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(_,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(m,{id:"bPwFdf"})})}),e("main",{children:e("section",{children:[e("ul",{class:"accounts-list",ref:d,children:o.map((r,h)=>{const f=r.info.id===c,p=h===0,g=!r.accessToken,y=()=>{o.splice(h,1),qt(o);try{ke.session.get("currentAccount")===r.info.id&&ke.session.del("currentAccount")}catch{}},w=async()=>{await rr({instanceURL:r.instanceURL,client_id:r.clientId,client_secret:r.clientSecret,token:r.accessToken})};return e("li",{children:[e("div",{children:[a&&e("span",{class:`current ${f?"is-current":""}`,children:e(_,{icon:"check-circle",alt:i({id:"Hp1l6f"})})}),e(lt,{url:r.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(f)try{const k=await s.v1.accounts.$select(r.info.id).fetch();r.info=k,qt(o),l()}catch{}}}),e(yt,{account:a?{...r.info,acct:/@/.test(r.info.acct)?r.info.acct:`${r.info.acct}@${r.instanceURL}`}:r.info,showAcct:!0,onClick:()=>{g?(location.href=`/#/login?instance=${r.instanceURL}`,n()):f?R.showAccount=`${r.info.username}@${r.instanceURL}`:(Jn(r.info.id),location.reload())}})]}),e("div",{class:"actions",children:[g&&e("span",{class:"tag",children:e(m,{id:"mxY4xF"})}),p&&a&&e(B,{children:[e("span",{class:"tag",children:e(m,{id:"ovBPCi"})})," "]}),e(mt,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(_,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[a&&e(B,{children:[e(ye,{disabled:f||g,onClick:()=>{Jn(r.info.id),location.reload()},children:[e(_,{icon:"transfer"})," ",e(m,{id:"3t/Nrv"})]}),!lr&&!f&&!g&&e(Ve,{href:`./?account=${r.info.id}`,target:"_blank",children:[e(_,{icon:"external"}),e("span",{children:e(m,{id:"PZgZtY"})})]}),e(Ye,{})]}),e(ye,{onClick:()=>{R.showAccount=`${r.info.username}@${r.instanceURL}`},children:[e(_,{icon:"user"}),e("span",{children:e(m,{id:"40z2Fm"})})]}),e(Ye,{}),a&&e(B,{children:[e(ye,{disabled:p||g,onClick:()=>{o.splice(h,1),o.unshift(r),qt(o),l()},children:[e(_,{icon:"check-circle"}),e("span",{children:e(m,{id:"PPcets"})})]}),e(ye,{disabled:h<=1,onClick:()=>{o.splice(h,1),o.splice(h-1,0,r),qt(o),l()},children:[e(_,{icon:"arrow-up"}),e("span",{children:e(m,{id:"QyioBP"})})]}),e(ye,{disabled:h===0||h===o.length-1,onClick:()=>{o.splice(h,1),o.splice(h+1,0,r),qt(o),l()},children:[e(_,{icon:"arrow-down"}),e("span",{children:e(m,{id:"3Ib6FN"})})]}),e(Ye,{})]}),g?e(ft,{subMenu:!0,confirmLabel:e(B,{children:[e(_,{icon:"x"}),e("span",{children:e(m,{id:"yyX15r",values:{0:r.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),menuItemClassName:"danger",onClick:()=>{y(),l()},children:[e(_,{icon:"x"}),e("span",{children:e(m,{id:"9OzDUH"})})]}):e(ft,{subMenu:!0,confirmLabel:e(B,{children:[e(_,{icon:"exit"}),e("span",{children:e(m,{id:"k08LxG",values:{0:r.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),menuItemClassName:"danger",onClick:async()=>{await w(),delete r.accessToken,qt(o),l()},menuExtras:e(ye,{className:"danger",onClick:async()=>{await w(),y(),location.href=location.pathname||"/"},children:[e(_,{icon:"x"}),e("span",{children:e(m,{id:"A3GDG1",values:{0:r.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),children:[e(_,{icon:"exit"}),e("span",{children:e(m,{id:"CXk1bI"})})]}),!!r?.createdAt&&e("div",{class:"footer",children:[e(_,{icon:"account-add"}),e("span",{children:e(m,{id:"+9E7iR",values:{0:rt(r.createdAt)},components:{0:e(Rt,{datetime:r.createdAt})}})})]})]})]})]},r.info.id)})}),e("p",{children:e(pe,{to:"/login",class:"button plain2",onClick:n,children:[e(_,{icon:"plus"})," ",e("span",{children:e(m,{id:"Is7/PB"})})]})}),a&&e("p",{children:e("small",{children:e(m,{id:"52x24e",components:{0:e("i",{})}})})}),e("p",{children:e("button",{type:"button",class:"light",onClick:()=>R.showImportExportAccounts=!0,children:e(m,{id:"bgVLbt"})})})]})})]})}const ls="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20clip-rule='evenodd'%20viewBox='0%200%2064%2064'%3e%3cpath%20fill='%23a4bff7'%20d='M37.774%2011.471c14.639%203.752%2019.034%2016.557%2015.889%2031.304-.696%203.261-2.563%206.661-6.356%208.693-3.204%201.717-8.07%202.537-15.338.55l-9.634-2.404C11.651%2046.992%208.378%2038.733%2010.027%2031.823c3.627-15.201%2015.543-23.48%2027.747-20.352Z'/%3e%3cpath%20fill='%23d8e7fe'%20d='M36.76%2015.429c12.289%203.15%2015.547%2014.114%2012.907%2026.493-.947%204.44-4.937%209.365-16.664%206.143l-9.684-2.417c-7.854-1.923-10.53-7.8-9.318-12.877%203.016-12.639%2012.611-19.943%2022.759-17.342Z'/%3e%3cpath%20fill='%236081e6'%20d='M27.471%2024.991c-1.457-.698-7.229%203.213-7.663%208.926-.182%202.39%204.55%203.237%205.071-.169.725-4.743%203.715-8.218%202.592-8.757Zm10.746%202.005c-2.083.327-.382%205.901-.595%2010.727-.123%202.8%204.388%203.464%204.703%202.011%201.098-5.073-2.066-13.058-4.108-12.738Z'/%3e%3c/svg%3e";class ur extends HTMLElement{connectedCallback(){if(this.button=this.querySelector("button"),window.matchMedia("(display-mode: standalone)").matches){this.button.remove();return}if(!navigator.install){this.button.remove();return}this.button.addEventListener("click",async i=>{await navigator.install()})}}customElements.define("button-install",ur);const hr={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function ds(){const{i18n:n}=ce(),i=xe(()=>zc.map(s=>{const o=hr[s]||s.replace(/-[a-z]+$/i,""),c=Bt({code:o,locale:s,fallback:Ci.find(u=>u.code===s)?.nativeName}),a=Bt({code:o,locale:n.locale,fallback:Ci.find(u=>u.code===s)?.name});return{code:s,regionlessCode:o,_common:a,native:c}}).sort((s,o)=>{const c=s._common.localeCompare(o._common,n.locale);return c!==0?c:s.codeo.code?1:0}),[]);return e("label",{class:"lang-selector",children:["🌐"," ",e("select",{class:"small",value:n.locale||Bc,onChange:s=>{ke.local.set("lang",s.target.value),qc(s.target.value)},children:[i.map(({code:s,regionlessCode:o,native:c})=>{const a=Bt({code:o,locale:n.locale,fallback:Ci.find(l=>l.code===s)?.name});return e("option",{value:s,"data-regionless-code":o,children:!!a&&a!==c?`${c} - ${a}`:c},s)}),void 0]})]})}function As(n){const{masto:i}=oe();return i.v1.push.subscription.create(n)}function fr(){const{masto:n}=oe();return n.v1.push.subscription.fetch()}function pr(n){const{masto:i}=oe();return i.v1.push.subscription.update(n)}function mr(){const{masto:n}=oe();return n.v1.push.subscription.remove()}function wi(){return"serviceWorker"in navigator&&"PushManager"in window}function gr(){return navigator.serviceWorker.getRegistration()}async function us(){const n=await gr(),i=n?await n.pushManager.getSubscription():void 0;return{registration:n,subscription:i}}function Ko(n){const i="=".repeat((4-n.length%4)%4),s=`${n}${i}`.replace(/-/g,"+").replace(/_/g,"/"),o=window.atob(s),c=new Uint8Array(o.length);for(let a=0;a({code:n,name:i})),_r="TransLang API";function Ir({onClose:n}){const{_:i}=ce(),s=We(R),o=ke.local.get("theme")||"auto",c=j(),a=s.settings.contentTranslationTargetLanguage||null,u=xo(),l=Bt(u),d=ke.local.get("textSize")||Kn,[r,h]=$(Vi()),{masto:f,authenticated:p,instance:g}=oe(),[y,w]=$(ke.local.get("experiments-tabBarV2")??!1),k=r["posting:default:visibility"]==="private";return e("div",{id:"settings-container",class:"sheet",tabIndex:"-1",style:{"--current-text-size":`${d}px`},children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(_,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(m,{id:"Tz0i8g"})})}),e("main",{children:[e("section",{children:e("ul",{children:[e("li",{children:[e("div",{children:e("label",{children:e(m,{id:"aAIQg2"})})}),e("div",{children:e("form",{ref:c,onInput:b=>{b.preventDefault();const x=new FormData(c.current).get("theme"),C=document.documentElement;if(x==="auto"){C.classList.remove("is-light","is-dark");const T=document.querySelector('meta[data-theme-setting="manual"]');T&&(T.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(I=>{I.name="theme-color"})}else{C.classList.toggle("is-light",x==="light"),C.classList.toggle("is-dark",x==="dark");const T=document.querySelector('meta[data-theme-setting="manual"]');T&&(T.name="theme-color",T.content=x==="light"?T.dataset.themeLightColor:T.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(I=>{I.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",x==="auto"?"light dark":x),x==="auto"?ke.local.del("theme"):ke.local.set("theme",x)},children:e("div",{class:"radio-group",children:[e("label",{children:[e("input",{type:"radio",name:"theme",value:"light",defaultChecked:o==="light"}),e("span",{children:e(m,{id:"1njn7W"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:o==="dark"}),e("span",{children:e(m,{id:"pvnfJD"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:o!=="light"&&o!=="dark"}),e("span",{children:e(m,{id:"R9Khdg"})})]})]})})})]}),e("li",{children:[e("div",{children:e("label",{children:e(m,{id:"7r6sCa"})})}),e(xr,{currentTextSize:d})]}),e("li",{children:[e("span",{children:[e("label",{children:e(m,{id:"CeJHfb"})})," ",e("small",{children:e("a",{href:"https://crowdin.com/project/phanpy",target:"_blank",rel:"noopener",children:e(m,{id:"FFmj1D"})})})]}),e(ds,{})]})]})}),p&&e(B,{children:[e("h3",{children:e(m,{id:"PcoS3v"})}),e("section",{children:e("ul",{children:[e("li",{children:[e("label",{for:"posting-privacy-field",children:[e(m,{id:"NAjVvt"})," ",e(_,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})]}),e("select",{id:"posting-privacy-field",value:r["posting:default:visibility"]||"public",onChange:b=>{const{value:S}=b.target;(async()=>{try{await f.v1.accounts.updateCredentials({source:{privacy:S}});const x={...r,"posting:default:visibility":S};S==="private"&&(x["posting:default:quote_policy"]="nobody"),h(x),bs(x),le(i({id:"4uflEE"}))}catch{alert(i({id:"hFs2qq"}))}})()},children:[e("option",{value:"public",children:e(m,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(m,{id:"pPYeIN"})}),e("option",{value:"private",children:e(m,{id:"x5LEuB"})})]})]}),Gt()&&e("li",{children:[e("label",{for:"posting-quote-policy-field",children:[e(m,{id:"eKInue"})," ",e(_,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})]}),e("select",{id:"posting-quote-policy-field",value:k?"nobody":r["posting:default:quote_policy"]||"public",disabled:k,onChange:b=>{const{value:S}=b.target;(async()=>{try{await f.v1.accounts.updateCredentials({source:{quote_policy:S}});const x={...r,"posting:default:quote_policy":S};h(x),bs(x),le(i({id:"3P1r1z"}))}catch{alert(i({id:"hEe3YR"}))}})()},children:[e("option",{value:"public",disabled:k,children:e(m,{id:"hDWXuG"})}),e("option",{value:"followers",disabled:k,children:e(m,{id:"9Ko+Xp"})}),e("option",{value:"nobody",children:e(m,{id:"+bAQ3S"})})]})]})]})}),e("p",{class:"section-postnote",children:[e(_,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(m,{id:"cR6K65",values:{instance:g},components:{0:e("a",{href:`https://${g}/`,target:"_blank",rel:"noopener"})}})})]})]}),e("h3",{children:e(m,{id:"ivdhsq"})}),e("section",{children:e("ul",{children:[e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:s.settings.autoRefresh,onChange:b=>{R.settings.autoRefresh=b.target.checked}})," ",e(m,{id:"0mC0SF"})]})}),e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:s.settings.boostsCarousel,onChange:b=>{R.settings.boostsCarousel=b.target.checked}})," ",e(m,{id:"TSbnoW"})]})}),!!wr&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.contentTranslation,onChange:b=>{const{checked:S}=b.target;R.settings.contentTranslation=S,S||(R.settings.contentTranslationTargetLanguage=null)}})," ",e(m,{id:"0SdaOt"})]}),e("div",{class:`sub-section ${s.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:[e(m,{id:"zXCa9e"})," ",e("select",{value:a||"",disabled:!s.settings.contentTranslation,style:{width:"10em"},onChange:b=>{R.settings.contentTranslationTargetLanguage=b.target.value||null},children:[e("option",{value:"",children:e(m,{id:"jNCSyx",values:{systemTargetLanguageText:l}})}),e("option",{disabled:!0,children:"──────────"}),Ls.map(b=>{const S=Bt({code:b.code,fallback:b.name}),x=Bt({code:b.code,locale:b.code}),C=x&&S!==x;return e("option",{value:b.code,children:C?`${x} - ${S}`:S})})]})]})}),e("hr",{}),e("div",{class:"checkbox-fieldset",children:[e(m,{id:"cc0NrU",values:{0:s.settings.contentTranslationHideLanguages.length}}),e("div",{class:"checkbox-fields",children:Ls.map(b=>{const S=Bt({code:b.code,fallback:b.name}),x=Bt({code:b.code,locale:b.code}),C=x&&S!==x;return e("label",{children:[e("input",{type:"checkbox",checked:s.settings.contentTranslationHideLanguages.includes(b.code),onChange:T=>{const{checked:v}=T.target;v?R.settings.contentTranslationHideLanguages.push(b.code):R.settings.contentTranslationHideLanguages=s.settings.contentTranslationHideLanguages.filter(I=>I!==b.code)}})," ",C?e("span",{children:[x," ",e("span",{class:"insignificant ib",children:["- ",S]})]}):S]})})})]}),e("p",{class:"insignificant",children:e("small",{children:e(m,{id:"7I3sDQ",values:{TRANSLATION_API_NAME:_r},components:{0:e("a",{href:"https://github.com/cheeaun/translang-api",target:"_blank",rel:"noopener"})}})})}),e("hr",{}),e("div",{children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.contentTranslationAutoInline,disabled:!s.settings.contentTranslation,onChange:b=>{R.settings.contentTranslationAutoInline=b.target.checked}})," ",e(m,{id:"gURvmk"})]}),e("p",{class:"insignificant",children:e("small",{children:e(m,{id:"PbHARL",components:{0:e("b",{})}})})})]})]})]}),!!Sr&&p&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.composerGIFPicker,onChange:b=>{R.settings.composerGIFPicker=b.target.checked}})," ",e(m,{id:"D7/2jB"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(m,{id:"/CLBTL",components:{0:e("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener"})}})})})]}),!!kr&&p&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.mediaAltGenerator,onChange:b=>{R.settings.mediaAltGenerator=b.target.checked}})," ",e(m,{id:"9q5uor"})," ",e(_,{icon:"sparkles2",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(m,{id:"faZ9RI"})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(m,{id:"fHZgvt",components:{0:e("a",{href:"https://github.com/cheeaun/img-alt-api",target:"_blank",rel:"noopener"})}})})})]}),p&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.shortcutSettingsCloudImportExport,onChange:b=>{R.settings.shortcutSettingsCloudImportExport=b.target.checked}})," ",e(m,{id:"570qTm"})," ",e(_,{icon:"cloud",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(m,{id:"0tZAhT",components:{0:e("br",{})}})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(m,{id:"Iq3FHt"})})})]}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.cloakMode,onChange:b=>{R.settings.cloakMode=b.target.checked}})," ",e(m,{id:"lxYe+I",components:{0:e("span",{class:"insignificant"}),1:e("samp",{}),2:e("samp",{})}})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(m,{id:"T/hglb"})})})]}),p&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{R.showDrafts=!0,R.showSettings=!1},children:e(m,{id:"krk5ws"})})}),e("li",{children:e(pe,{to:"/yip",onClick:n,class:"button light",children:"Year in Posts"})}),e("li",{children:e("button-install",{children:e("button",{type:"button",class:"light",children:e(m,{id:"vOsY+K",values:{CLIENT_NAME:Cr}})})})})]})}),p&&e(Ar,{onClose:n}),e("h3",{children:e(m,{id:"uyJsf6"})}),e("section",{children:[e("div",{style:{display:"flex",flexWrap:"wrap",gap:8,lineHeight:1.25,alignItems:"center",marginTop:8},children:[e("img",{src:ls,alt:"",width:"64",height:"64",style:{aspectRatio:"1/1",verticalAlign:"middle",background:"#b7cdf9",borderRadius:12}}),e("div",{children:[e("b",{children:"Phanpy"})," ",e("a",{href:"https://hachyderm.io/@phanpy",rel:"noopener",onClick:b=>{b.preventDefault(),R.showAccount="phanpy@hachyderm.io"},children:"@phanpy"}),e("br",{}),e(m,{id:"AZ2EoP",components:{0:e("a",{href:"https://github.com/cheeaun/phanpy",target:"_blank",rel:"noopener"}),1:e("a",{href:"https://mastodon.social/@cheeaun",rel:"noopener",onClick:b=>{b.preventDefault(),R.showAccount="cheeaun@mastodon.social"}})}})]})]}),e("p",{children:[e("a",{href:"https://github.com/sponsors/cheeaun",target:"_blank",rel:"noopener",children:e(m,{id:"O4cLCR"})})," ","·"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener",children:e(m,{id:"Ng063n"})})," ","·"," ",e("a",{href:"https://patreon.com/cheeaun",target:"_blank",rel:"noopener",children:"Patreon"})," ","·"," ",e("a",{href:"https://github.com/cheeaun/phanpy/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener",children:e(m,{id:"3ePd3I"})})," ","·"," ",e("a",{href:br,target:"_blank",rel:"noopener",children:e(m,{id:"LcET2C"})})]}),e("p",{children:[Rs&&e(B,{children:[e(m,{id:"pFnMHn",values:{0:Rs.replace(/https?:\/\//g,"").replace(/\/$/,"")},components:{0:e("span",{class:"insignificant"})}}),e("br",{})]}),e(m,{id:"6KkH+2",values:{0:e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/48b2cf7",target:"_blank",rel:"noopener",children:e(Rt,{datetime:new Date("2026-02-24T14:54:34.686Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2026-02-24T14:53:54.000Z".slice(0,10).replace(/-/g,".")}.48b2cf7`,onClick:b=>{b.target.select();try{navigator.clipboard.writeText(b.target.value),le(i({id:"PiPfua"}))}catch{le(i({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function xr({currentTextSize:n}){const i=j(null),[s,o]=$(n),[c]=fa(s,1e3);return G(()=>{document.documentElement.style.setProperty("--text-size",`${c}px`),c===Kn?ke.local.del("textSize"):ke.local.set("textSize",c)},[c]),e("div",{class:`text-size-control ${s!==c?"loading":""}`,children:[e("button",{type:"button",style:{fontSize:$n},class:`small light ${s===Kn?"default-size":""}`,disabled:s===$n,onClick:()=>{o(Math.max($n,s-1))},children:e(m,{id:"J6ypuD"})})," ",e("input",{ref:i,type:"range",min:$n,max:Mn,step:"1",value:s,list:"sizes",onChange:a=>{const u=parseInt(a.target.value,10);o(u)}})," ",e("button",{type:"button",style:{fontSize:Mn},class:`small light ${s===Kn?"default-size":""}`,disabled:s===Mn,onClick:()=>{o(Math.min(Mn,s+1))},children:e(m,{id:"J6ypuD"})}),e("datalist",{id:"sizes",children:ci.map(a=>e("option",{value:a}))})]})}function Ar({onClose:n}){const{_:i}=ce();if(!wi())return null;const{instance:s}=oe(),[o,c]=$("default"),a=j(),[u,l]=$(!1),[d,r]=$(!1),h=j();G(()=>{(async()=>{c("loading");try{const{subscription:p,backendSubscription:g}=await yr();if(g?.policy&&g.policy!=="none"){l(!0);const{alerts:y,policy:w}=g;h.current=w;const{elements:k}=a.current,b=k.namedItem("policy");b&&(b.value=w),Object.entries(y).forEach(([S,x])=>{const C=k.namedItem(S);C?.type==="checkbox"&&(C.checked=!!x)})}c("default")}catch(p){/outside.*authorized/i.test(p.message)?r(!0):alert(p?.message||p),c("error")}})()},[]);const f=o==="loading";return e("form",{ref:a,onChange:()=>{setTimeout(()=>{const p=Object.fromEntries(new FormData(a.current)),g=!!p["policy-allow"],y={data:{policy:p.policy,alerts:{mention:!!p.mention,favourite:!!p.favourite,reblog:!!p.reblog,follow:!!p.follow,follow_request:!!p.followRequest,poll:!!p.poll,update:!!p.update,status:!!p.status}}};let w=0;Object.keys(y.data.alerts).forEach(b=>{y.data.alerts[b]?w++:delete y.data.alerts[b]});const k=h.current!==y.data.policy;g&&w>0?k?Es().then(()=>{Ts(y)}).catch(b=>{alert(i({id:"I6pdY3"}))}):Ts(y).catch(b=>{alert(i({id:"I6pdY3"}))}):Es().catch(b=>{alert(i({id:"q1zFd+"}))})},100)},children:[e("h3",{children:e(m,{id:"WUHLnz"})}),e("section",{children:e("ul",{children:e("li",{children:[e("label",{children:[e("input",{type:"checkbox",disabled:f||d,name:"policy-allow",checked:u,onChange:async p=>{const{checked:g}=p.target;if(g){const y=await Notification.requestPermission();y==="granted"?l(!0):(l(!1),y==="denied"&&alert(i({id:"6LUsk7"})))}else l(!1)}})," ",e(m,{id:"qYNCa1",values:{0:[{value:"all",label:i({id:"+niKJH"})},{value:"followed",label:i({id:"x2NYtp"})},{value:"follower",label:i({id:"PBFNgg"})}].map(p=>e("option",{value:p.value,children:p.label}))},components:{0:e("select",{name:"policy",disabled:f||d||!u})}})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!u,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"sub-section",children:e("ul",{children:[{value:"mention",label:i({id:"/bZzdR"})},{value:"favourite",label:i({id:"zZOZj7"})},{value:"reblog",label:i({id:"puY2t0"})},{value:"follow",label:i({id:"aaJhcT"})},{value:"followRequest",label:i({id:"6Fs1Ba"})},{value:"poll",label:i({id:"wNExRS"})},{value:"update",label:i({id:"K/EtE6"})},{value:"status",label:i({id:"2yr1/p"})}].map(p=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:p.value})," ",p.label]})}))})})})}),d&&e("div",{class:"sub-section",children:e("p",{children:e(m,{id:"8d0b8B",components:{0:e(pe,{to:`/login?instance=${s}`,onClick:n}),1:e("b",{})}})})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:e(m,{id:"z96cOX",components:{0:e("b",{})}})})})]})}const Oi=()=>{let n=setTimeout(()=>{const i=document.getElementById("columns");if(i){const s=i.querySelector(".deck-container.focus");if(s)s.focus();else{const o=Array.from(i.querySelectorAll(".deck-container")).find(c=>c.getBoundingClientRect().left>=0);o?o.focus():i.querySelector(".deck-container")?.focus?.()}}else{const s=document.querySelectorAll("#modal-container > *");if(s?.length){const u=s[s.length-1],l=u.querySelector('[tabindex="-1"]')||u;if(l){l.focus();return}}if(document.querySelector(".deck-backdrop"))return;const c=document.querySelectorAll(".deck-container"),a=c[c.length-1];a&&a.tabIndex===-1&&a.focus()}},100);return()=>clearTimeout(n)};function Ho(n){if(!n)return;const i=en(),s=j(i.pathname);G(()=>{s.current&&i.pathname!==s.current&&n?.()},[i.pathname,n])}function Tr({acct:n,instance:i}){let[s,o]=n.split("@");o||(o=i);const c=hi.toASCII(n);return e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",title:c,children:[e("b",{class:"handle-username",children:s}),e("span",{class:"handle-at",children:"@"}),e("b",{class:"handle-server",children:o})]}),e("div",{class:"handle-legend",children:[e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon username"})," ",e(m,{id:"silO9A"})]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," ",e(m,{id:"rZgCpJ"})]})]})]})}const Er=["image/jpeg","image/png","image/gif","image/webp"],$s=Er.join(",");function Rr({name:n,value:i,disabled:s,index:o}){const[c,a]=$(!!i);return e("tr",{children:[e("td",{children:e("input",{type:"text",name:`fields_attributes[${o}][name]`,defaultValue:n,disabled:s,maxLength:255,required:c,dir:"auto",enterKeyHint:"done"})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${o}][value]`,defaultValue:i,disabled:s,maxLength:255,onChange:u=>a(!!u.currentTarget.value),dir:"auto",enterKeyHint:"done"})})]})}function Lr({onClose:n=()=>{}}){const{_:i}=ce(),{masto:s}=oe(),[o,c]=$("loading"),[a,u]=$(null),[l,d]=$(null),[r,h]=$(null);G(()=>{(async()=>{try{const C=await s.v1.accounts.verifyCredentials();u(C),c("default")}catch{c("error")}})()},[]);const{displayName:f,source:p,avatar:g,header:y}=a||{},{note:w,fields:k}=p||{},b=j(null),S=[...g?[{type:"image",url:g}]:[],...r?[{type:"image",url:r}]:[]],x=[...y?[{type:"image",url:y}]:[],...l?[{type:"image",url:l}]:[]];return e("div",{class:"sheet",id:"edit-profile-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(_,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(m,{id:"9OpVZg"})})}),e("main",{children:o==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):e("form",{onSubmit:C=>{C.preventDefault();const T=new FormData(C.target),v=T.get("header"),I=T.get("avatar"),L=T.get("display_name"),E=T.get("note"),F=b.current.querySelectorAll('input[name^="fields_attributes"]'),O=[];F.forEach(H=>{const Q=H.name,[re,Z,J]=Q.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],Y=H.value?H.value.trim():"";Z&&J&&Y&&(O[Z]||(O[Z]={}),O[Z][J]=Y)}),O.forEach(H=>{H.name&&!H.value&&(H.value="")}),(async()=>{try{const H=await s.v1.accounts.updateCredentials({header:v,avatar:I,displayName:L,note:E,fieldsAttributes:O});n?.({state:"success",account:H})}catch(H){alert(H?.message||i({id:"FwMMx0"}))}})()},children:[e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(m,{id:"C5zXYJ"})," ",e("input",{type:"file",name:"header",accept:$s,onChange:C=>{const T=C.target.files[0];if(T){const v=URL.createObjectURL(T);d(v)}}})]}),e("div",{class:"edit-profile-media-field",children:[y?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{R.showMediaModal={mediaAttachments:x,mediaIndex:0}},children:e("img",{src:y,alt:""})}):e("div",{class:"edit-media"}),l&&e(B,{children:[e(_,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{R.showMediaModal={mediaAttachments:x,mediaIndex:1}},children:e("img",{src:l,alt:""})})]})]})]}),e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(m,{id:"4XF0BB"})," ",e("input",{type:"file",name:"avatar",accept:$s,onChange:C=>{const T=C.target.files[0];if(T){const v=URL.createObjectURL(T);h(v)}}})]}),e("div",{class:"edit-profile-media-field",children:[g?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{R.showMediaModal={mediaAttachments:S,mediaIndex:0}},children:e("img",{src:g,alt:""})}):e("div",{class:"edit-media"}),r&&e(B,{children:[e(_,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{R.showMediaModal={mediaAttachments:S,mediaIndex:1}},children:e("img",{src:r,alt:""})})]})]})]}),e("p",{children:e("label",{children:[e(m,{id:"6YtxFj"})," ",e("input",{type:"text",name:"display_name",defaultValue:f,maxLength:30,disabled:o==="loading",dir:"auto",enterKeyHint:"done"})]})}),e("p",{children:e("label",{children:[e(m,{id:"E+oKCO"}),e("textarea",{defaultValue:w,name:"note",maxLength:500,rows:"5",disabled:o==="loading",dir:"auto"})]})}),e("p",{children:e(m,{id:"T4I119"})}),e("table",{ref:b,children:[e("thead",{children:e("tr",{children:[e("th",{children:e(m,{id:"87a/t/"})}),e("th",{children:e(m,{id:"4b3oEV"})})]})}),e("tbody",{children:Array.from({length:Math.max(4,k.length)}).map((C,T)=>{const{name:v="",value:I=""}=k[T]||{};return e(Rr,{name:v,value:I,index:T,disabled:o==="loading"},T)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:o==="loading",onClick:()=>{n?.()},children:e(m,{id:"dEgA5A"})}),e("button",{type:"submit",disabled:o==="loading",children:e(m,{id:"tfDRzk"})})]})]})})]})}const $r=80;function Mr({accountID:n,info:i,open:s=!1,onlyOpenIfHasEndorsements:o=!1}){const{masto:c}=oe(),a=j(),[u,l]=$("default"),[d,r]=$([]),[h,f]=$({});return G(()=>{Xe("@mastodon/endorsements")&&s&&(async()=>{l("loading");try{const g=await c.v1.accounts.$select(n).endorsements.list({limit:$r});if(!g.length){l("default");return}r(g),l("default"),setTimeout(()=>{a.current.scrollIntoView({behavior:"smooth",block:"nearest"})},300);const y=await dn(g,h);y&&f(y)}catch{l("error")}})()},[s,n]),(o?s&&d.length>0:s)?e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"endorsements-container",ref:a,children:[e("h3",{children:e(m,{id:"UIfdY1",values:{0:i.username}})}),u==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):d.length>0?e("ul",{class:`endorsements ${d.length>10?"expanded":""}`,children:d.map(g=>e("li",{children:e(vt,{account:g,showStats:!0,avatarSize:"xxl",relationship:h[g.id]},g.id)}))}):e("p",{class:"ui-state insignificant",children:e(m,{id:"AgkUZa"})})]})})}):null}async function Pr(n){const{masto:i}=oe({instance:n});return!!(await i.v2.search.list({q:"from:me",type:"statuses",limit:1}))?.statuses?.length}const jo=It(Pr),Vo=1e3*60,Dr=1440*60*1e3,zi=It(async()=>{const{masto:n}=oe(),i=await n.v1.lists.list();return i.sort((s,o)=>s.title.localeCompare(o.title)),i.length&&setTimeout(()=>{ke.account.set("lists",{lists:i,updatedAt:Date.now()})},1),i},{expires:Vo});async function fn(){try{const{lists:n,updatedAt:i}=ke.account.get("lists")||{};return n?.length?(Date.now()-i>Dr&&zi(),n):await zi()}catch{return[]}}const Nr=It(n=>{const{masto:i}=oe();return i.v1.lists.$select(n).fetch()},{expires:Vo});async function Yo(n){const{lists:i}=ke.account.get("lists")||{};if(i?.length){const s=i.find(o=>o.id===n);if(s)return s}try{return Nr(n)}catch{return null}}async function Or(n){return(await Yo(n))?.title||""}function zr(n){const{lists:i}=ke.account.get("lists")||{};i?.length&&(i.push(n),i.sort((s,o)=>s.title.localeCompare(o.title)),ke.account.set("lists",{lists:i,updatedAt:Date.now()}))}function qr(n){const{lists:i}=ke.account.get("lists")||{};if(i?.length){const s=i.findIndex(o=>o.id===n.id);s!==-1&&(i[s]=n,i.sort((o,c)=>o.title.localeCompare(c.title)),ke.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function Br(n){const{lists:i}=ke.account.get("lists")||{};if(i?.length){const s=i.findIndex(o=>o.id===n);s!==-1&&(i.splice(s,1),ke.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function Jt({insignificant:n}){const{_:i}=ce();return e(_,{icon:"filter",size:"xs",class:`list-exclusive-badge ${n?"insignificant":""}`,title:i({id:"FNptcJ"})})}function hs({list:n,onClose:i}){const{_:s}=ce(),{masto:o}=oe(),[c,a]=$("default"),u=!!n,l=j(),d=j(),r=j();G(()=>{u&&(l.current.value=n.title,d.current.value=n.repliesPolicy,r.current&&(r.current.checked=n.exclusive))},[u]);const h=Xe("@mastodon/list-exclusive")||Xe("@gotosocial/list-exclusive");return e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(_,{icon:"x",alt:s({id:"yz7wBu"})})})," ",e("header",{children:e("h2",{children:s(u?{id:"tuhghE"}:{id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:f=>{f.preventDefault();const p=new FormData(f.target),g=p.get("title"),y=p.get("replies_policy"),w=p.get("exclusive")==="on";a("loading"),(async()=>{try{let k;u?k=await o.v1.lists.$select(n.id).update({title:g,replies_policy:y,exclusive:w}):k=await o.v1.lists.create({title:g,replies_policy:y,exclusive:w}),a("default"),i?.({state:"success",list:k}),setTimeout(()=>{u?qr(k):zr(k)},1)}catch{a("error"),alert(s(u?{id:"R7ep1i"}:{id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(m,{id:"6YtxFj"})," ",e("input",{ref:l,type:"text",id:"list-title",name:"title",required:!0,disabled:c==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:d,name:"replies_policy",required:!0,disabled:c==="loading",children:[e("option",{value:"list",children:e(m,{id:"ei6pnR"})}),e("option",{value:"followed",children:e(m,{id:"Mr53YX"})}),e("option",{value:"none",children:e(m,{id:"PM7llw"})})]})}),h&&e("div",{class:"list-form-row",children:e("label",{class:"label-block",children:[e("input",{ref:r,type:"checkbox",name:"exclusive",disabled:c==="loading"})," ",e(Jt,{insignificant:!0})," ",e(m,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:c==="loading",children:s(u?{id:"tfDRzk"}:{id:"hYgDIe"})}),u&&e(ft,{disabled:c==="loading",align:"end",menuItemClassName:"danger",confirmLabel:s({id:"+kQ/cY"}),onClick:()=>{a("loading"),(async()=>{try{await o.v1.lists.$select(n.id).remove(),a("default"),i?.({state:"deleted"}),setTimeout(()=>{Br(n.id)},1)}catch{a("error"),alert(s({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:c==="loading",children:e(m,{id:"Jb6/SB"})})})]})]})})]})}function Fr({accountID:n,onClose:i}){const{_:s}=ce(),{masto:o}=oe(),[c,a]=$("default"),[u,l]=$([]),[d,r]=$([]),[h,f]=Et(y=>y+1,0);G(()=>{a("loading"),(async()=>{try{const y=await fn();l(y);const w=await o.v1.accounts.$select(n).lists.list();r(w),a("default")}catch{a("error")}})()},[h]);const[p,g]=$(!1);return e("div",{class:"sheet",id:"list-add-remove-container",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(_,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(m,{id:"sJ2yQc"})})}),e("main",{children:[u.length>0?e("ul",{class:"list-add-remove",children:u.map(y=>{const w=d.some(k=>k.id===y.id);return e("li",{children:e("button",{type:"button",class:`light ${w?"checked":""}`,disabled:c==="loading",onClick:()=>{a("loading"),(async()=>{try{w?await o.v1.lists.$select(y.id).accounts.remove({accountIds:[n]}):await o.v1.lists.$select(y.id).accounts.create({accountIds:[n]}),f()}catch{a("error"),alert(s(w?{id:"7KnEYa"}:{id:"Tba8uO"}))}})()},children:[e(_,{icon:"check-circle",alt:"☑️"}),e("span",{children:y.title})]})})})}):c==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):c==="error"?e("p",{class:"ui-state",children:e(m,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(m,{id:"/MJ7gZ"})}),e("button",{type:"button",class:"plain2",onClick:()=>g(!0),disabled:c!=="default",children:[e(_,{icon:"plus",size:"l"})," ",e("span",{children:e(m,{id:"Sb2gYF"})})]})]}),p&&e(Fe,{onClick:y=>{y.target===y.currentTarget&&g(!1)},children:e(hs,{list:p?.list,onClose:y=>{y.state==="success"&&f(),g(!1)}})})]})}function Ur({account:n,note:i,onRelationshipChange:s=()=>{},onClose:o=()=>{}}){const{_:c}=ce(),{masto:a}=oe(),[u,l]=$("default"),d=j(null);return G(()=>{let r;return d.current&&!i&&(r=setTimeout(()=>{d.current.focus?.()},100)),()=>{clearTimeout(r)}},[]),e("div",{class:"sheet",id:"private-note-container",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(_,{icon:"x",alt:c({id:"yz7wBu"})})}),e("header",{children:[e("b",{children:e(m,{id:"1DBGsz"})})," ",e("small",{class:"insignificant",children:e(m,{id:"XHVHK2"})})]}),e("main",{children:e("form",{onSubmit:r=>{r.preventDefault();const f=new FormData(r.target).get("note");f?.trim()!==i?.trim()&&(l("loading"),(async()=>{try{const p=await a.v1.accounts.$select(n?.id).note.create({comment:f});l("default"),s(p),o()}catch(p){l("error"),alert(p?.message||c({id:"ot8LpF"}))}})())},children:[e("textarea",{ref:d,name:"note",disabled:u==="loading",dir:"auto",children:i}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:u==="loading",onClick:()=>{o?.()},children:e(m,{id:"dEgA5A"})}),e("span",{children:[e(qe,{abrupt:!0,hidden:u!=="loading"}),e("button",{disabled:u==="loading",type:"submit",children:e(m,{id:"SrwrEj"})})]})]})]})})]})}function Kr({note:n,fields:i,onClose:s}){const{_:o}=ce(),c=i?.map(({name:u,value:l})=>`${u} ${Ss(l)}`).join(` `)||"",a=Ss(n)+(c?` ${c}`:"");return e("div",{class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(_,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(m,{id:"9groMz"})})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:a}),e(Ao,{forceTranslate:!0,text:a})]})]})}const Hr=[300,1800,3600,3600*6,3600*24,3600*24*3,3600*24*7,3600*24*30,0],on={0:{id:"9ZP9cc"},300:at(5,"minute"),1800:at(30,"minute"),3600:at(1,"hour"),21600:at(6,"hour"),86400:at(1,"day"),259200:at(3,"day"),604800:at(1,"week"),2592e3:at(30,"day")};function jr({info:n,instance:i,standalone:s,authenticated:o,onRelationshipChange:c=()=>{},setShowEditProfile:a=()=>{},showEndorsements:u=!1,renderEndorsements:l=!1,setRenderEndorsements:d=()=>{}}){if(!n)return null;const{_:r,_:h}=ce(),{masto:f,instance:p,authenticated:g}=oe(),y=i===p,[w,k]=$("default"),[b,S]=$(null),{id:x,acct:C,url:T,username:v,locked:I,lastStatusAt:L,note:E,fields:F,moved:O}=n,H=j(x),{following:Q,showingReblogs:re,notifying:Z,followedBy:J,blocking:Y,blockedBy:W,muting:N,mutingNotifications:te,requested:ee,domainBlocking:me,endorsed:be,note:q}=b||{},[V,fe]=$(null),[_e,Pe]=$(!1),Oe=C.includes("@")?C:`${C}@${i}`,ae=Xe("@mastodon/endorsements");G(()=>{if(n){const ne=dt();let Ue;(async()=>{if(y&&o)Ue=x;else if(!y&&g){const st=n.acct.includes("@");try{const P=await f.v2.search.list({q:st?n.acct:`${n.username}@${i}`,type:"accounts",limit:1,resolve:!0});P.accounts.length&&(Ue=P.accounts[0].id,fe(P.accounts[0]))}catch{}}if(!Ue)return;if(ne===Ue){Pe(!0);return}H.current=Ue,k("loading");const wt=f.v1.accounts.relationships.fetch({id:[Ue]});try{const st=await wt;if(k("default"),st.length){const P=st[0];S(P),c({relationship:P,currentID:Ue})}}catch{k("error")}})()}},[n,o]),G(()=>{n&&_e&&Fc(n)},[n,_e]);const Se=w==="loading",[ge,Re]=$(!1),[Ne,Be]=$(!1),[ze,ie]=$(!1),[Ie,Ce]=$([]),[se,De]=$(!1);G(()=>{g&&(async()=>{const ne=await jo(p);De(ne)})()},[p,g]);let{headerStatic:$e,avatarStatic:Ae}=n;return(!$e||/missing\.png$/.test($e))&&Ae&&!/missing\.png$/.test(Ae)&&($e=Ae),e(B,{children:[e("div",{class:"actions",children:[e("span",{children:[J?e("span",{class:"tag",children:e(m,{id:"p3UO/y"})}):L?e("small",{class:"insignificant",children:e(m,{id:"F3cM1G",values:{0:rt(L,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),N&&e("span",{class:"tag danger",children:e(m,{id:"+IJm1Z"})}),Y&&e("span",{class:"tag danger",children:e(m,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!q&&e("button",{type:"button",class:"private-note-tag",title:h({id:"1DBGsz"}),onClick:()=>{ie(!0)},dir:"auto",children:e("span",{children:q})}),g&&_e&&e("button",{type:"button",class:"plain",onClick:()=>{R.showQrCodeModal={text:T,arena:Ae,backgroundMask:$e,caption:C.includes("@")?C:`${C}@${i}`,onScannerClick:qi}},children:e(_,{icon:"qrcode",alt:h({id:"gCX4Z9"})})}),e(mt,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain4",disabled:Se,children:e(_,{icon:"more2",size:"l",alt:h({id:"2FYpfJ"})})}),onMenuChange:ne=>{Q&&ne.open&&(async()=>{try{const Ue=await f.v1.accounts.$select(H.current).lists.list();Ce(Ue)}catch{}})()},children:[g&&!_e?e(B,{children:[e(ye,{onClick:()=>{Io({draftStatus:{status:`@${V?.acct||C} `}})},children:[e(_,{icon:"at"}),e("span",{children:e(m,{id:"3LkfZu",values:{username:v},components:{0:e("span",{class:"bidi-isolate"})}})})]}),se&&e(ye,{onClick:()=>{R.showSearchCommand={query:`from:${C} `}},children:[e(_,{icon:"search"}),e("span",{children:e(m,{id:"LCX3ys",values:{username:v},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(ye,{onClick:()=>{Re(!0)},children:[e(_,{icon:"translate"}),e("span",{children:e(m,{id:"R8mSiS"})})]}),Xe("@mastodon/profile-private-note")&&e(ye,{onClick:()=>{ie(!0)},children:[e(_,{icon:"note"}),e("span",{children:h(q?{id:"+kQy/G"}:{id:"GquPwe"})})]}),Q&&!!b&&e(B,{children:[e(ye,{onClick:()=>{k("loading"),(async()=>{try{const ne=await f.v1.accounts.$select(H.current).follow({notify:!Z});ne&&S(ne),k("default"),le(ne.notifying?h({id:"jL3N0G",values:{username:v}}):h({id:"0h4/9h",values:{username:v}}))}catch(ne){alert(ne),k("error")}})()},children:[e(_,{icon:"notification"}),e("span",{children:h(Z?{id:"osJmEN"}:{id:"I92Z+b"})})]}),e(ye,{onClick:()=>{k("loading"),(async()=>{try{const ne=await f.v1.accounts.$select(H.current).follow({reblogs:!re});ne&&S(ne),k("default"),le(ne.showingReblogs?h({id:"0X2KC8",values:{username:v}}):h({id:"cXWjH0",values:{username:v}}))}catch(ne){alert(ne),k("error")}})()},children:[e(_,{icon:"rocket"}),e("span",{children:h(re?{id:"GRUr8d"}:{id:"uREpT3"})})]})]}),ae&&Q&&e(ye,{onClick:()=>{k("loading"),(async()=>{try{if(be){const ne=await f.v1.accounts.$select(V?.id||x).unpin();S(ne),k("default"),le(h({id:"pWFLFk",values:{username:v}}))}else{const ne=await f.v1.accounts.$select(V?.id||x).pin();S(ne),k("default"),le(h({id:"xhiXaF",values:{username:v}}))}}catch{k("error"),be?le(h({id:"xHq5L2",values:{username:v}})):le(h({id:"Owr/5+",values:{username:v}}))}})()},children:[e(_,{icon:"endorsement"}),h(be?{id:"S9JvjK"}:{id:"UlJ3QN"})]}),u&&ae&&!l&&e(ye,{onClick:()=>d(!0),children:[e(_,{icon:"endorsement"}),e("span",{children:e(m,{id:"Qopbnd"})})]}),Q&&e(ye,{onClick:()=>{Be(!0)},children:[e(_,{icon:"list"}),Ie.length?e(B,{children:[e("small",{class:"menu-grow",children:[e(m,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:Ie.map(ne=>ne.title).join(", ")})]}),e("small",{class:"more-insignificant",children:Ie.length})]}):e("span",{children:e(m,{id:"sJ2yQc"})})]}),e(Ye,{})]}):e(B,{children:[se&&_e&&e(ye,{onClick:()=>{R.showSearchCommand={query:"from:me "}},children:[e(_,{icon:"search"}),e("span",{children:e(m,{id:"BmW9JG"})})]}),ae&&!l&&e(B,{children:e(ye,{onClick:()=>d(!0),children:[e(_,{icon:"endorsement"}),e(m,{id:"Qopbnd"})]})}),(se&&_e||ae&&!l)&&e(Ye,{})]}),e(ye,{onClick:()=>{const ne=`@${V?.acct||Oe}`;try{navigator.clipboard.writeText(ne),le(h({id:"zJoEwS"}))}catch{le(h({id:"BC0lSD"}))}},children:[e(_,{icon:"copy"}),e("small",{children:[e(m,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",V?.acct||Oe]})]})]}),e(ye,{href:T,target:"_blank",children:[e(_,{icon:"external"}),e("small",{class:"menu-double-lines",children:Vr(T)})]}),e("div",{class:"menu-horizontal",children:[e(ye,{onClick:()=>{try{navigator.clipboard.writeText(T),le(h({id:"edWbV6"}))}catch{le(h({id:"W1ewR0"}))}},children:[e(_,{icon:"link"}),e("span",{children:e(m,{id:"he3ygx"})})]}),navigator?.share&&navigator?.canShare?.({url:T})&&e(ye,{onClick:()=>{try{navigator.share({url:T})}catch{alert(h({id:"TtG3Uh"}))}},children:[e(_,{icon:"share"}),e("span",{children:e(m,{id:"LFKLqp"})})]})]}),e(ye,{onClick:()=>{R.showQrCodeModal={text:T,arena:Ae,backgroundMask:$e,caption:C.includes("@")?C:`${C}@${i}`,onScannerClick:qi}},children:[e(_,{icon:"qrcode"}),e("span",{children:e(m,{id:"gCX4Z9"})})]}),!!b&&e(B,{children:[e(Ye,{}),N?e(ye,{onClick:()=>{k("loading"),(async()=>{try{const ne=await f.v1.accounts.$select(V?.id||x).unmute();S(ne),k("default"),le(h({id:"B4Xkly",values:{username:v}})),R.reloadGenericAccounts.id="mute",R.reloadGenericAccounts.counter++}catch{k("error")}})()},children:[e(_,{icon:"unmute"}),e("span",{children:e(m,{id:"Q/HUhC",values:{username:v},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(Rn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(B,{children:[e(_,{icon:"mute"}),e("span",{class:"menu-grow",children:e(m,{id:"xhPEH3",values:{username:v},components:{0:e("span",{class:"bidi-isolate"})}})}),e("span",{style:{textOverflow:"clip"},children:[e(_,{icon:"time"}),e(_,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:Hr.map(ne=>e(ye,{onClick:()=>{k("loading"),(async()=>{try{const Ue=await f.v1.accounts.$select(V?.id||x).mute({duration:ne});S(Ue),k("default"),le(h({id:"/plB9m",values:{0:typeof on[ne]=="function"?on[ne]():r(on[ne]),username:v}})),R.reloadGenericAccounts.id="mute",R.reloadGenericAccounts.counter++}catch{k("error"),le(h({id:"vWGBjT",values:{username:v}}))}})()},children:typeof on[ne]=="function"?on[ne]():r(on[ne])}))})}),J&&e(ft,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(B,{children:[e(_,{icon:"user-x"}),e("span",{children:e(m,{id:"unyq2W",values:{username:v},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{k("loading"),(async()=>{try{const ne=await f.v1.accounts.$select(V?.id||x).removeFromFollowers();S(ne),k("default"),le(h({id:"AgkcM/",values:{username:v}})),R.reloadGenericAccounts.id="followers",R.reloadGenericAccounts.counter++}catch{k("error")}})()},children:[e(_,{icon:"user-x"}),e("span",{children:e(m,{id:"VCZ0OT"})})]}),e(ft,{subMenu:!0,confirm:!Y,confirmLabel:e(B,{children:[e(_,{icon:"block"}),e("span",{children:e(m,{id:"aforS9",values:{username:v},components:{0:e("span",{class:"bidi-isolate"})}})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{k("loading"),(async()=>{try{if(Y){const ne=await f.v1.accounts.$select(V?.id||x).unblock();S(ne),k("default"),le(h({id:"sI9N29",values:{username:v}}))}else{const ne=await f.v1.accounts.$select(V?.id||x).block();S(ne),k("default"),le(h({id:"uYcYzu",values:{username:v}}))}R.reloadGenericAccounts.id="block",R.reloadGenericAccounts.counter++}catch{k("error"),Y?le(h({id:"0tG4wG",values:{username:v}})):le(h({id:"pA+qEx",values:{username:v}}))}})()},children:Y?e(B,{children:[e(_,{icon:"unblock"}),e("span",{children:e(m,{id:"/3LJfX",values:{username:v},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(B,{children:[e(_,{icon:"block"}),e("span",{children:e(m,{id:"JRswkR",values:{username:v},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(ye,{className:"danger",onClick:()=>{R.showReportModal={account:V||n}},children:[e(_,{icon:"flag"}),e("span",{children:e(m,{id:"qTJgpR",values:{username:v},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),g&&_e&&s&&Xe("@mastodon/profile-edit")&&e(B,{children:[e(Ye,{}),e(ye,{onClick:()=>{a(!0)},children:[e(_,{icon:"pencil"}),e("span",{children:e(m,{id:"9OpVZg"})})]})]}),!1]}),!b&&w==="loading"&&e(qe,{abrupt:!0}),!!b&&!O&&e(ft,{confirm:Q||ee,confirmLabel:e("span",{children:h(ee?{id:"e7qQIH"}:{id:"eYsAQr",values:{0:n.acct||n.username}})}),menuItemClassName:"danger",align:"end",disabled:Se,onClick:()=>{k("loading"),(async()=>{try{let ne;Q||ee?ne=await f.v1.accounts.$select(H.current).unfollow():ne=await f.v1.accounts.$select(H.current).follow(),ne&&(S(ne),u&&ae&&!l&&ne.following&&d("onlyOpenIfHasEndorsements")),k("default")}catch(ne){alert(ne),k("error")}})()},children:e("button",{type:"button",class:`${Q||ee?"light swap":""}`,"data-swap-state":Q||ee?"danger":"",disabled:Se,children:Q?e(B,{children:[e("span",{children:e(m,{id:"y6sq5j"})}),e("span",{children:e(m,{id:"HKrBPX"})})]}):ee?e(B,{children:[e("span",{children:e(m,{id:"Yx0Ud8"})}),e("span",{children:e(m,{id:"yTVtKs"})})]}):I?e(B,{children:[e(_,{icon:"lock"})," ",e("span",{children:e(m,{id:"MKEPCY"})})]}):h({id:"MKEPCY"})})})]})]}),!!ge&&e(Fe,{onClose:()=>{Re(!1)},children:e(Kr,{note:E,fields:F,onClose:()=>Re(!1)})}),!!Ne&&e(Fe,{onClose:()=>{Be(!1)},children:e(Fr,{accountID:H.current,onClose:()=>Be(!1)})}),!!ze&&e(Fe,{onClose:()=>{ie(!1)},children:e(Ur,{account:n,note:q,onRelationshipChange:ne=>{S(ne)},onClose:()=>ie(!1)})})]})}function Vr(n){if(!n)return;const i=URL.parse(n);if(!i)return;const{host:s,pathname:o}=i,c=o.replace(/\/$/,"").replace(/^\//,"");return e(B,{children:[e("span",{class:"more-insignificant",children:[hi.toUnicode(s),"/"]}),e("wbr",{}),e("span",{children:c})]})}const Ms=80,Wo=1e3*60*10;function Yr(n,i){return i.v1.accounts.familiarFollowers.fetch({id:[n]})}const Wr=It(Yr,{expires:Wo});async function Gr(n,i){const s=i.v1.accounts.$select(n).statuses.list({limit:20}).values().next(),{value:o}=await s,c={total:o.length,originals:0,replies:0,boosts:0,quotes:0};return o.forEach(a=>{a.reblog?c.boosts++:a.inReplyToId&&a.inReplyToAccountId!==a.account.id?c.replies++:Gt()&&(a.quote?.id||a.quote?.quotedStatus?.id)?c.quotes++:c.originals++}),o.length&&(c.daysSinceLastPost=Math.ceil((Date.now()-Date.parse(o[o.length-1].createdAt))/864e5)),c}const Zr=It(Gr,{expires:Wo}),Xr=n=>{try{return new URL(n),!0}catch{return!1}},qi=()=>{R.showQrScannerModal={checkValidity:Xr,actionableText:{id:"73lp8c"},onClose:({text:n}={})=>{n&&(Uc(),location.hash=`/${n}`)}}};function Go({account:n,fetchAccount:i=()=>{},standalone:s,instance:o,authenticated:c,showEndorsements:a=!1}){const{i18n:u,_:l}=ce(),{masto:d,authenticated:r}=oe({instance:o}),{masto:h,instance:f}=oe(),[p,g]=$("default"),y=typeof n=="string",[w,k]=$(y?null:n),b=xe(()=>o===f,[o,f]);G(()=>{if(!y){k(n);return}g("loading"),(async()=>{try{const z=await i();R.accounts[`${z.id}@${o}`]=z,k(z),g("default")}catch{k(null),g("error")}})()},[y,n,i]);const{acct:S,avatar:x,avatarStatic:C,bot:T,createdAt:v,displayName:I,emojis:L,fields:E,followersCount:F,followingCount:O,group:H,id:Q,lastStatusAt:re,locked:Z,note:J,statusesCount:Y,url:W,username:N,memorial:te,moved:ee,roles:me,hideCollections:be}=w||{};let q=!1,{header:V,headerStatic:fe}=w||{};(!V||/missing\.png$/.test(V))&&x&&!/missing\.png$/.test(x)&&(V=x,q=!0,C&&!/missing\.png$/.test(C)&&(fe=C));const _e=xe(()=>Q===dt(),[Q]);G(()=>{const z=!!(w?.id&&w?.username&&w?.acct&&w?.avatar&&w?.avatarStatic&&w?.displayName&&w?.url);if(_e&&o&&z){const de=rn();let Me=!1;de.forEach(we=>{we.info.id===w.id&&we.instanceURL===o&&(we.info=w,Me=!0)}),Me&&qt(de)}},[_e,w,o]);const Pe=Yi(W),[Oe,ae]=$([]),Se=j(),ge=j([]);async function Re(z){(z||!Se.current)&&(Se.current=d.v1.accounts.$select(Q).followers.list({limit:Ms}).values());const de=await Se.current.next();if(_e||!b)return de;const{value:Me}=de;let we=[];if(z){let Ee=[];try{Ee=await d.v1.accounts.familiarFollowers.fetch({id:[Q]})}catch{}ge.current=Ee?.[0]?.accounts||[],we=[...ge.current,...Me.filter(U=>!ge.current.some(ve=>ve.id===U.id))]}else Me?.length&&(we=Me.filter(Ee=>!ge.current.some(U=>U.id===Ee.id)));return{...de,value:we}}const Ne=j();async function Be(z){return(z||!Ne.current)&&(Ne.current=d.v1.accounts.$select(Q).following.list({limit:Ms}).values()),await Ne.current.next()}const ze=s?"div":pe,ie=o?`/${o}/a/${Q}`:`/a/${Q}`,[Ie,Ce]=$([]),[se,De]=$(),[$e,Ae]=$("default"),ne=!!se?.total,Ue=async z=>{try{const de=await Wr(z,h);Ce(de[0].accounts.slice(0,Qr))}catch{}},wt=async()=>{if(Q){Ae("loading");try{const z=await Zr(Q,d);De(z),Ae("default")}catch{Ae("error")}}},st=nt(({relationship:z,currentID:de})=>{z.following||(Ue(de),!s&&Y>0&&wt())},[s,Q,Y]),P=nt(z=>{z.id===Q&&(k(z),R.accounts[`${z.id}@${o}`]=z)},[Q,o]),M=y&&n&&/^https?:\/\//.test(n),[A,D]=$(!1),[K,X]=$(!1);return e(B,{children:[e("div",{tabIndex:"-1",class:`account-container ${p==="loading"?"skeleton":""}`,style:{"--header-color-1":Oe[0],"--header-color-2":Oe[1],"--header-color-3":Oe[2],"--header-color-4":Oe[3]},children:[p==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(m,{id:"44hICK"})}),y?e("p",{children:M?e("a",{href:n,target:"_blank",rel:"noopener",children:n}):e("code",{class:"insignificant",children:n})}):e("p",{children:e("a",{href:W,target:"_blank",rel:"noopener",children:[e(m,{id:"Aadw0+"})," ",e(_,{icon:"external"})]})})]}),p==="loading"?e(B,{children:[e("header",{children:e(vt,{avatarSize:"xxxl",skeleton:!0})}),e("main",{children:[e("div",{class:"note",children:[e("p",{children:"███████ ████ ████"}),e("p",{children:"████ ████████ ██████ █████████ ████ ██"})]}),e("div",{class:"account-metadata-box",children:[e("div",{class:"profile-metadata",children:[e("div",{class:"profile-field",children:[e("b",{class:"more-insignificant",children:"███"}),e("p",{children:"██████"})]}),e("div",{class:"profile-field",children:[e("b",{class:"more-insignificant",children:"████"}),e("p",{children:"███████████"})]})]}),e("div",{class:"stats",children:[e("div",{children:[e("span",{children:"██"})," ██████"]}),e("div",{children:[e("span",{children:"██"})," ██████"]}),e("div",{children:[e("span",{children:"██"})," █████"]})]})]}),e("div",{class:"actions",children:[e("span",{}),e("span",{class:"buttons",children:e("button",{type:"button",class:"plain4",disabled:!0,children:e(_,{icon:"more2",size:"l"})})})]})]})]}):w&&e(B,{children:[!!ee&&e("div",{class:"account-moved",children:[e("p",{children:e(m,{id:"C6cVP/",values:{displayName:I},components:{0:e("b",{})}})}),e(vt,{account:ee,instance:o,onClick:z=>{z.stopPropagation(),R.showAccount=ee}})]}),!!V&&!/missing\.png$/.test(V)&&e("img",{src:V,alt:"",class:`header-banner ${q?"header-is-avatar":""}`,onError:z=>{z.target.crossOrigin?z.target.src!==fe?z.target.src=fe:(z.target.removeAttribute("crossorigin"),z.target.src=V):z.target.src!==fe?z.target.src=fe:z.target.remove()},crossOrigin:"anonymous",onLoad:z=>{z.target.classList.add("loaded");const{width:de,height:Me}=z.target;z.target.style.setProperty("--anim-duration",`${Math.min(Math.max(Math.max(de,Me)/25,10),120)}s`);try{const we=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),Ee=we.getContext("2d",{willReadFrequently:!0});we.width=de,we.height=Me,Ee.imageSmoothingEnabled=!1,Ee.drawImage(z.target,0,0);const U=10,Le=[Ee.getImageData(0,0,U,U).data,Ee.getImageData(z.target.width-U,0,U,U).data,Ee.getImageData(0,z.target.height-U,U,U).data,Ee.getImageData(z.target.width-U,z.target.height-U,U,U).data].map(Te=>{let Qe=0,Ze=0,tt=0,nn=0;for(let kt=0;kt{const[Qe,Ze,tt,nn]=Jr(Te);return`rgba(${Qe}, ${Ze}, ${tt}, ${nn})`});ae(Le)}catch{}}}),e("header",{children:s?e(mt,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(vt,{account:w,instance:o,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(Tr,{acct:S,instance:o})}),e(ye,{onClick:()=>{const z=S.includes("@")?`@${S}`:`@${S}@${o}`;try{navigator.clipboard.writeText(z),le(l({id:"zJoEwS"}))}catch{le(l({id:"BC0lSD"}))}},children:[e(_,{icon:"link"}),e("span",{children:e(m,{id:"27x6gl"})})]}),e(ye,{onClick:()=>{R.showQrCodeModal={text:W,arena:C,backgroundMask:fe,caption:S.includes("@")?S:`${S}@${o}`,onScannerClick:qi}},children:[e(_,{icon:"qrcode"}),e("span",{children:e(m,{id:"gCX4Z9"})})]}),e(ye,{href:W,target:"_blank",children:[e(_,{icon:"external"}),e("span",{children:e(m,{id:"Bz5hLl"})})]}),e(Ye,{}),e(ye,{onClick:()=>{R.showMediaModal={mediaAttachments:[{type:"image",url:C}]}},children:[e(_,{icon:"user"}),e("span",{children:e(m,{id:"7WYl2I"})})]}),!!fe&&!q&&e(ye,{onClick:()=>{R.showMediaModal={mediaAttachments:[{type:"image",url:fe}]}},children:[e(_,{icon:"media"}),e("span",{children:e(m,{id:"ZNme5R"})})]}),r&&_e&&Xe("@mastodon/profile-edit")&&e(B,{children:[e(Ye,{}),e(ye,{onClick:()=>{D(!0)},children:[e(_,{icon:"pencil"}),e("span",{children:e(m,{id:"9OpVZg"})})]})]})]}):e(vt,{account:w,instance:o,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!te&&e("span",{class:"tag",children:e(m,{id:"prdIOK"})}),!!T&&e("span",{class:"tag",children:[e(_,{icon:"bot"})," ",e(m,{id:"9Vdq+j"})]}),!!H&&e("span",{class:"tag",children:[e(_,{icon:"group"})," ",e(m,{id:"L8fEEm"})]}),e("div",{class:"note",dir:"auto",onClick:To({instance:f}),dangerouslySetInnerHTML:{__html:Di(J,{emojis:L})}}),e("div",{class:"account-metadata-box",children:[E?.length>0&&e("div",{class:"profile-metadata",children:E.map(({name:z,value:de,verifiedAt:Me},we)=>e("div",{class:`profile-field ${Me?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(Eo,{text:z,emojis:L})," ",!!Me&&e(_,{icon:"check-circle",size:"s",alt:l({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:Di(de,{emojis:L})}})]},z+we))}),e("div",{class:"stats",children:[e(ze,{tabIndex:0,to:ie,onClick:()=>{setTimeout(()=>{R.showGenericAccounts={id:"followers",heading:l({id:"x5LEuB"}),fetchAccounts:Re,instance:o,excludeRelationshipAttrs:_e?["followedBy"]:[],blankCopy:be?l({id:"BRV/wh"}):void 0}},0)},children:[!!Ie.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:Ie.map(z=>e(lt,{url:z.avatarStatic,size:"s",alt:`${z.displayName} @${z.acct}`,squircle:z?.bot}))})}),e(m,{id:"TbttfX",values:{0:Ke(F),1:Ke(F),followersCount:F},components:{0:e("span",{title:F}),1:e("span",{title:F})}})]}),e(ze,{class:"insignificant",tabIndex:0,to:ie,onClick:()=>{setTimeout(()=>{R.showGenericAccounts={heading:l({id:"following.stats"}),fetchAccounts:Be,instance:o,excludeRelationshipAttrs:_e?["following"]:[],blankCopy:be?l({id:"BRV/wh"}):void 0}},0)},children:[e(m,{id:"SGcIK+",values:{0:Ke(O),followingCount:O},components:{0:e("span",{title:O})}}),e("br",{})]}),e(ze,{class:"insignificant",to:ie,children:e(m,{id:"C4x3+X",values:{0:Ke(Y),1:Ke(Y),statusesCount:Y},components:{0:e("span",{title:Y}),1:e("span",{title:Y})}})}),!!v&&e("div",{class:"insignificant",children:e(m,{id:"PCcEFZ",values:{0:rt(v,{hideTime:!0})},components:{0:e("time",{datetime:v})}})})]})]}),!!se&&e(ze,{to:ie,class:"account-metadata-box",onClick:void 0,children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:ne?e("div",{class:"posting-stats",title:Gt()?l({id:"CKHUZ2",values:{0:(se.originals/se.total).toLocaleString(u.locale||void 0,{style:"percent"}),1:(se.replies/se.total).toLocaleString(u.locale||void 0,{style:"percent"}),2:(se.quotes/se.total).toLocaleString(u.locale||void 0,{style:"percent"}),3:(se.boosts/se.total).toLocaleString(u.locale||void 0,{style:"percent"})}}):l({id:"wiuWLe",values:{0:(se.originals/se.total).toLocaleString(u.locale||void 0,{style:"percent"}),1:(se.replies/se.total).toLocaleString(u.locale||void 0,{style:"percent"}),2:(se.boosts/se.total).toLocaleString(u.locale||void 0,{style:"percent"})}}),children:[e("div",{children:se.daysSinceLastPost<365?he._({id:"oZUtTk",values:{0:se.total,1:se.daysSinceLastPost,2:se.daysSinceLastPost,3:se.daysSinceLastPost,4:se.total,5:se.total,6:se.daysSinceLastPost}}):he._({id:"JvA7Mo",values:{0:se.total,1:se.total}})}),e("div",{class:"posting-stats-bar",children:[se.originals>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-originals",style:{"--percentage":`${se.originals/se.total*100}%`}}),se.replies>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-replies",style:{"--percentage":`${se.replies/se.total*100}%`}}),se.quotes>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-quotes",style:{"--percentage":`${se.quotes/se.total*100}%`}}),se.boosts>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-boosts",style:{"--percentage":`${se.boosts/se.total*100}%`}})]}),e("div",{class:"posting-stats-legends",children:[e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-originals"})," ",e(m,{id:"HxF6Fk"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-replies"})," ",e(m,{id:"N8UzTV"})]})," ",Gt()&&e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-quotes"})," ",e(m,{id:"eWLklq"})]}),e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-boosts"})," ",e(m,{id:"puY2t0"})]})]})]}):e("div",{class:"posting-stats",children:e(m,{id:"vl3XTJ"})})})})}),!ee&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!se,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:$e==="loading",onClick:()=>{wt()},children:[e("div",{class:`posting-stats-icon ${$e==="loading"?"loading":""}`}),e(m,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(jr,{info:w,instance:o,standalone:s,authenticated:c,onRelationshipChange:st,onProfileUpdate:P,setShowEditProfile:D,showEndorsements:a,renderEndorsements:K,setRenderEndorsements:X})}),e(Mr,{accountID:Q,info:w,open:K,onlyOpenIfHasEndorsements:K==="onlyOpenIfHasEndorsements"})]})]}),!!A&&e(Fe,{onClose:()=>{D(!1)},children:e(Lr,{onClose:({state:z,account:de}={})=>{D(!1),z==="success"&&de&&P(de)}})})]})}const Qr=3;function Jr([n,i,s]){const o=.2126*n+.7152*i+.0722*s;let c;return o>=220?c=1:o<=50?c=.1:c=o/255,c=Math.min(1,c),[n,i,s,c]}function el({account:n,instance:i,onClose:s}){const{_:o}=ce(),{masto:c,instance:a,authenticated:u}=oe({instance:i}),l=typeof n=="string";return G(()=>{l||(R.accounts[`${n.id}@${a}`]=n)},[n]),Ho(s),e("div",{class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close outer",onClick:s,children:e(_,{icon:"x",alt:o({id:"yz7wBu"})})}),e(Go,{instance:a,authenticated:u,account:n,fetchAccount:async()=>{if(l)try{return await c.v1.accounts.lookup({acct:n,skip_webfinger:!1})}catch{const r=await c.v2.search.list({q:n,type:"accounts",limit:u?1:11,resolve:u});if(r.accounts.length){const h=r.accounts.find(f=>f.url===n||n.startsWith(f.url));if(h)return h}if(/^https?:\/\/[^/]+\/@[^/]+$/.test(n)){const h=URL.parse(n);if(h){const{hostname:f,pathname:p}=h,g=p.replace(/^\//,"").replace(/\/$/,"")+"@"+f,y=await c.v2.search.list({q:g,type:"accounts",limit:1,resolve:u});if(y.accounts.length)return y.accounts[0]}}}else return n}})]})}function tl({onClose:n}){const{_:i}=ce(),{masto:s}=oe(),[o,c]=$("default"),[a,u]=$([]),[l,d]=Et(h=>h+1,0);G(()=>{c("loading"),(async()=>{try{const h=await Ct.drafts.keys();if(h.length){const f=ti(),p=h.filter(g=>g.startsWith(f));if(p.length){const g=await Ct.drafts.getMany(p);g.sort((y,w)=>Date.parse(w.updatedAt)-Date.parse(y.updatedAt)),u(g)}else u([])}else u([]);c("default")}catch{c("error")}})()},[l]);const r=a?.length>0;return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(_,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(m,{id:"krk5ws"})," ",e(qe,{abrupt:!0,hidden:o!=="loading"})]}),r&&e("div",{class:"insignificant",children:e(m,{id:"Ap/10+"})})]}),e("main",{children:r?e(B,{children:[e("ul",{class:"drafts-list",children:a.map(h=>{const{updatedAt:f,key:p,draftStatus:g,replyTo:y,quote:w}=h,k=new Date(f);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(_,{icon:y?"reply":"quill",size:"s"})," ",e("time",{children:[!!y&&e(B,{children:[e("span",{class:"bidi-isolate",children:["@",y.account.acct]}),e("br",{})]}),rt(k)]})]}),e(ft,{confirmLabel:e("span",{children:e(m,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:o==="loading",onClick:()=>{(async()=>{try{await Ct.drafts.del(p),d()}catch{alert(i({id:"rEYoku"}))}})()},children:e("button",{type:"button",class:"small light",disabled:o==="loading",children:e(m,{id:"Jb6/SB"})})})]}),e("button",{type:"button",disabled:o==="loading",class:"draft-item",onClick:async()=>{let b,S;if(y?.id||w?.id){if(c("loading"),y)try{b=await s.v1.statuses.$select(y.id).fetch()}catch{alert(i({id:"tMwimH"})),c("default");return}if(w)try{S=await s.v1.statuses.$select(w.id).fetch()}catch{alert(i({id:"2oZ4Iw"})),c("default")}c("default")}window.__COMPOSE__={draftStatus:g,replyToStatus:b,quoteStatus:S},R.showCompose=!0,R.showDrafts=!1},children:e(nl,{draft:h})})]},f)})}),a.length>1&&e("p",{children:e(ft,{confirmLabel:e("span",{children:e(m,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:o==="loading",onClick:()=>{(async()=>{c("loading");try{await Ct.drafts.delMany(a.map(h=>h.key)),c("default"),d()}catch{alert(i({id:"0J4sZq"})),c("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:o==="loading",children:e(m,{id:"hOg+Mt"})})})})]}):e("p",{children:e(m,{id:"8iQ+jk"})})})]})}function nl({draft:n}){const{_:i}=ce(),{draftStatus:s,replyTo:o,quote:c}=n,{status:a,spoilerText:u,poll:l,mediaAttachments:d}=s,r=l?.options?.length>0,h=d?.length>0,f=!!c?.id,p=r||h||f,g=xe(()=>{if(!h)return;const y=d.find(b=>/image/.test(b.type));if(!y)return;const{file:w}=y;return URL.createObjectURL(w)},[h,d]);return e(B,{children:e("div",{class:"mini-draft",children:[p&&e("div",{class:`mini-draft-aside ${g?"has-image":""}`,style:g?{"--bg-image":`url(${g})`}:{},children:[r&&e(_,{icon:"poll",alt:i({id:"4WUbF1"})}),h&&e("span",{children:[e(_,{icon:"attachment",alt:i({id:"xYilR2"})})," ",e("small",{children:d?.length})]}),f&&e(_,{icon:"quote",alt:i({id:"ZhhOwV"})})]}),e("div",{class:"mini-draft-main",children:[!!u&&e("div",{class:"mini-draft-spoiler",children:u}),!!a&&e("div",{class:"mini-draft-status",children:a})]})]})})}function il({html:n,url:i,width:s,height:o,onClose:c=()=>{}}){const{_:a}=ce();return e("div",{class:"embed-modal-container",children:[e("div",{class:"top-controls",children:[e("button",{type:"button",class:"light",onClick:()=>c(),children:e(_,{icon:"x",alt:a({id:"yz7wBu"})})}),i&&e("a",{href:i,target:"_blank",rel:"noopener",class:"button plain",children:[e("span",{children:e(m,{id:"4/RpOy"})})," ",e(_,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:n},style:{"--width":s+"px","--height":o+"px","--aspect-ratio":`${s}/${o}`}})]})}function sl({instance:n,excludeRelationshipAttrs:i=[],postID:s,onClose:o=()=>{},blankCopy:c}){const{_:a}=ce(),{masto:u,instance:l}=oe(),d=n?n===l:!0,r=We(R),[h,f]=$("default"),[p,g]=$(!1);if(Ho(o),!r.showGenericAccounts)return null;const{id:y,heading:w,fetchAccounts:k,accounts:b,showReactions:S}=r.showGenericAccounts,[x,C]=$(b?.length?b:[]),[T,v]=$({}),I=async O=>{if(!O?.length||!d)return;const H=await dn(O,T);H&&v({...T,...H})},L=O=>{k&&(O&&!x?.length&&C([]),f("loading"),(async()=>{try{const{done:H,value:Q}=await k(O);if(Array.isArray(Q)){if(O){const re=[];for(let Z=0;ZW.id===J.id&&Z!==N);Y?Y._types.push(...J._types):re.push({_types:[],...J})}C(re)}else C(re=>{const Z=re;for(const J of Q){const Y=Z.find(W=>W.id===J.id);Y?Y._types.push(...J._types):Z.push(J)}return Z});g(!H),I(Q)}else g(!1);f("default")}catch{f("error")}})())},E=j(!0);G(()=>{x?.length>0?k?(L(!0),E.current=!1):I(x):(L(!0),E.current=!1)},[k]),G(()=>{E.current||r.reloadGenericAccounts?.id===y&&L(!0)},[r.reloadGenericAccounts.counter]);const F=R.statuses[s];return e("div",{id:"generic-accounts-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:o,children:e(_,{icon:"x",alt:a({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:w||a({id:"bPwFdf"})})}),e("main",{children:[F&&e(pe,{to:`/${n||l}/s/${F.id}`,class:"post-preview",children:e(je,{status:F,size:"s",readOnly:!0})}),x.length>0?e(B,{children:[e("ul",{class:"accounts-list",children:x.map(O=>{const H=T[O.id],Q=`${O.id}-${O._types?.length||""}`;return e("li",{children:[S&&O._types?.length>0&&e("div",{class:"reactions-block",children:O._types.map(re=>e(_,{icon:{reblog:"rocket",favourite:"heart"}[re],class:`${re}-icon`}))}),e("div",{class:"account-relationships",children:e(vt,{account:O,showStats:!0,relationship:H,excludeRelationshipAttrs:i})})]},Q)})}),h==="default"?p?e(Dt,{onChange:O=>{O&&L()},children:e("button",{type:"button",class:"plain block",onClick:()=>L(),children:e(m,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(m,{id:"2EYeAZ"})}):h==="loading"&&e("p",{class:"ui-state",children:e(qe,{abrupt:!0})})]}):h==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):h==="error"?e("p",{class:"ui-state",children:e(m,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:c||a({id:"10OlfF"})})]})]})}function ol({accounts:n,onClose:i}){const{_:s}=ce(),o=rn(),{accountsToImport:c}=xe(()=>{if(!n)return{accountsToImport:[]};const f={duplicate:0,new:1};return{accountsToImport:n.map(g=>{const w=o.find(k=>k.info.id===g.info.id&&k.instanceURL===g.instanceURL)?"duplicate":"new";return{...g,__status:w}}).sort((g,y)=>f[g.__status]-f[y.__status])}},[n,o]),[a,u]=$(()=>{const f={};return c.forEach(p=>{p.__status==="duplicate"?f[p.info.id+p.instanceURL]=!1:f[p.info.id+p.instanceURL]=!0}),f}),[l,d]=$("default"),r=()=>{d("importing");const f=[...o,...n.filter(p=>a[p.info.id+p.instanceURL])];qt(f),i(),R.showImportExportAccounts=!1,R.showAccounts=!0},h=Object.values(a).filter(Boolean).length;return e("div",{id:"import-accounts-selection-container",class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,disabled:l==="importing",children:e(_,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(m,{id:"jiFPsN"})})}),e("main",{children:e("div",{class:"import-selection",children:[c.filter(f=>f.__status!=="duplicate").length>3&&e("div",{class:"accounts-list-header",children:e("label",{class:"account-item",children:[e("input",{type:"checkbox",checked:c.filter(f=>f.__status!=="duplicate").length>0&&c.filter(f=>f.__status!=="duplicate").every(f=>a[f.info.id+f.instanceURL]),onChange:f=>{const p={...a},g=f.target.checked;c.forEach(y=>{y.__status!=="duplicate"&&(p[y.info.id+y.instanceURL]=g)}),u(p)},disabled:l==="importing"}),e("span",{class:"account-info",children:e(m,{id:"wgNoIs"})})]})}),e("ul",{class:"accounts-list",children:c.map(f=>{const p=f.info.id+f.instanceURL,g=a[p],{__status:y}=f;return e("li",{children:e("label",{class:"account-item",children:[e("input",{type:"checkbox",checked:g,onChange:w=>{u({...a,[p]:w.target.checked})},disabled:l==="importing"||y==="duplicate"}),e(lt,{url:f.info.avatarStatic,size:"xl"}),e("div",{class:"account-info",children:e(yt,{account:{...f.info,acct:/@/.test(f.info.acct)?f.info.acct:`${f.info.acct}@${f.instanceURL}`},showAcct:!0})}),e("div",{class:"account-meta",children:y==="duplicate"&&e("span",{class:"tag collapsed",children:e(m,{id:"5Lvp3B"})})})]})},p)})}),e("footer",{children:[e("button",{type:"button",class:"light",onClick:i,disabled:l==="importing",children:e(m,{id:"dEgA5A"})}),e(qe,{hidden:l!=="importing"}),e("button",{type:"button",disabled:h===0||l==="importing",onClick:r,children:e(m,{id:"0mebiX",values:{selectedCount:h}})})]})]})})]})}function cl({onClose:n}){const{_:i}=ce(),s=rn(),[o,c]=$("default"),[a,u]=$(null),[l,d]=$(!1),r=async()=>{c("exporting");try{const b={accounts:rn().map(L=>{const{accessToken:E,...F}=L;return F}),createdAt:Date.now()},S=JSON.stringify(b),x=new Blob([S],{type:"application/json"}),C=URL.createObjectURL(x),T=document.createElement("a");T.href=C;const v=new Date,I=`${v.getFullYear()}-${String(v.getMonth()+1).padStart(2,"0")}-${String(v.getDate()).padStart(2,"0")}_${String(v.getHours()).padStart(2,"0")}-${String(v.getMinutes()).padStart(2,"0")}`;T.download=`accounts-${I}.phanpy.json`,T.click(),URL.revokeObjectURL(C),n()}catch{le(i({id:"lpYill"})),c("error")}},h=async w=>{if(w){c("importing");try{const k=await w.text(),S=JSON.parse(k)?.accounts;if(!Array.isArray(S))throw new Error("Invalid backup file");u(S),c("default")}catch{le(i({id:"BEVzjL"})),c("error")}}},f=w=>{const k=w.target.files[0];h(k)};return e("div",{id:"import-export-accounts-container",class:"sheet",onDragOver:w=>{w.preventDefault(),d(!0)},onDragLeave:()=>{d(!1)},onDrop:w=>{w.preventDefault(),d(!1);const k=w.dataTransfer.files[0];h(k)},children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(_,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(m,{id:"k30qb8",components:{0:e("small",{class:"ib insignificant"})}})})}),e("main",{children:[e("section",{children:[e("label",{class:`section-button button-import button plain4 ${l?"drag-over":""}`,tabindex:"0",children:[e(_,{icon:"arrow-down-circle",size:"xxl"}),e("b",{children:e(m,{id:"l3s5ri"})}),e("input",{type:"file",accept:".json",onChange:f,disabled:o==="importing",style:{display:"none"}}),e("div",{children:e("small",{class:"insignificant",children:e(m,{id:"SdA74G"})})})]})," ",e("button",{type:"button",class:"section-button button-export plain4",onClick:r,disabled:o==="exporting"||s.length===0,children:[e(_,{icon:"arrow-up-circle",size:"xxl"}),e("b",{children:e(m,{id:"GS+Mus"})}),e("div",{children:e("small",{class:"insignificant",children:e(m,{id:"A7kMZX",values:{0:s.length}})})})]})]}),e("p",{class:"insignificant",children:e("small",{children:e(m,{id:"R+Pgtr"})})})]}),a&&e(Fe,{onClose:()=>{u(null)},children:e(ol,{accounts:a,onClose:()=>{u(null)}})})]})}const al=140;function rl({alt:n,lang:i,onClose:s}){const{_:o}=ce(),c=We(R),[a,u]=$(!1),l=xo(!0),d=c.settings.contentTranslationHideLanguages||[],r=!!i&&i!==l&&!ni([i],[l])&&!d.find(h=>i===h||ni([i],[h]));return G(()=>{const h=n?.length>0&&n?.length<=al;r&&h&&u(!0)},[r,n]),e("div",{class:"sheet",tabindex:"-1",children:[!!s&&e("button",{type:"button",class:"sheet-close outer",onClick:s,children:e(_,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:[e("h2",{children:e(m,{id:"5gfDMm"})}),e("div",{class:"header-side",children:e(mt,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(_,{icon:"more",alt:o({id:"2FYpfJ"}),size:"xl"})}),children:[e(ye,{disabled:a,onClick:()=>{u(!0)},children:[e(_,{icon:"translate"}),e("span",{children:e(m,{id:"pi8x/S"})})]}),pa&&e(ye,{onClick:()=>{ma(n,i)},children:[e(_,{icon:"speak"}),e("span",{children:e(m,{id:"yIBLq8"})})]})]})})]}),e("main",{lang:i,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:n}),(r||a)&&e(Ao,{forceTranslate:a,sourceLanguage:i,text:n})]})]})}const{min:Wh,max:Gh}=Math;const Zo={};for(let n of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Zo[`[object ${n}]`]=n.toLowerCase();function ll(n){return Zo[Object.prototype.toString.call(n)]||"object"}const pn=(n,i=null)=>n.length>=3?Array.prototype.slice.call(n):ll(n[0])=="object"&&i?i.split("").filter(s=>n[0][s]!==void 0).map(s=>n[0][s]):n[0].slice(0);const{PI:ki,min:Zh,max:Xh}=Math;const Qh=ki*2,Jh=ki/3,dl=ki/180,ul=180/ki;function ai(n,i){let s=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(i[0])||(i=i.map(u=>[u]));let o=i[0].length,c=i[0].map((u,l)=>i.map(d=>d[l])),a=n.map(u=>c.map(l=>Array.isArray(u)?u.reduce((d,r,h)=>d+r*(l[h]||0),0):l.reduce((d,r)=>d+r*u,0)));return s===1&&(a=a[0]),o===1?a.map(u=>u[0]):a}const Xo={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}};const Ti=n=>{const i=Math.sign(n);return n=Math.abs(n),(n<=.0031308?n*12.92:1.055*Math.pow(n,1/2.4)-.055)*i},hl=(n,i,s)=>{const{MtxAdaptMa:o,MtxAdaptMaI:c,MtxXYZ2RGB:a,RefWhiteRGB:u,Xn:l,Yn:d,Zn:r}=Xo,h=l*o.m00+d*o.m10+r*o.m20,f=l*o.m01+d*o.m11+r*o.m21,p=l*o.m02+d*o.m12+r*o.m22,g=u.X*o.m00+u.Y*o.m10+u.Z*o.m20,y=u.X*o.m01+u.Y*o.m11+u.Z*o.m21,w=u.X*o.m02+u.Y*o.m12+u.Z*o.m22,k=(n*o.m00+i*o.m10+s*o.m20)*(g/h),b=(n*o.m01+i*o.m11+s*o.m21)*(y/f),S=(n*o.m02+i*o.m12+s*o.m22)*(w/p),x=k*c.m00+b*c.m10+S*c.m20,C=k*c.m01+b*c.m11+S*c.m21,T=k*c.m02+b*c.m12+S*c.m22,v=Ti(x*a.m00+C*a.m10+T*a.m20),I=Ti(x*a.m01+C*a.m11+T*a.m21),L=Ti(x*a.m02+C*a.m12+T*a.m22);return[v*255,I*255,L*255]},fs=(...n)=>{n=pn(n,"lab");const[i,s,o,...c]=n,[a,u,l]=fl([i,s,o]),[d,r,h]=hl(a,u,l);return[d,r,h,...c.length>0&&c[0]<1?[c[0]]:[]]};function fl(n){var i=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],s=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],o=ai(s,n);return ai(i,o.map(c=>c**3))}function Ei(n){const i=Math.sign(n);return n=Math.abs(n),(n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4))*i}const pl=(n,i,s)=>{n=Ei(n/255),i=Ei(i/255),s=Ei(s/255);const{MtxRGB2XYZ:o,MtxAdaptMa:c,MtxAdaptMaI:a,Xn:u,Yn:l,Zn:d,As:r,Bs:h,Cs:f}=Xo;let p=n*o.m00+i*o.m10+s*o.m20,g=n*o.m01+i*o.m11+s*o.m21,y=n*o.m02+i*o.m12+s*o.m22;const w=u*c.m00+l*c.m10+d*c.m20,k=u*c.m01+l*c.m11+d*c.m21,b=u*c.m02+l*c.m12+d*c.m22;let S=p*c.m00+g*c.m10+y*c.m20,x=p*c.m01+g*c.m11+y*c.m21,C=p*c.m02+g*c.m12+y*c.m22;return S*=w/r,x*=k/h,C*=b/f,p=S*a.m00+x*a.m10+C*a.m20,g=S*a.m01+x*a.m11+C*a.m21,y=S*a.m02+x*a.m12+C*a.m22,[p,g,y]},ps=(...n)=>{const[i,s,o,...c]=pn(n,"rgb"),a=pl(i,s,o);return[...ml(a),...c.length>0&&c[0]<1?[c[0]]:[]]};function ml(n){const i=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],s=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],o=ai(i,n);return ai(s,o.map(c=>Math.cbrt(c)))}const{sin:gl,cos:yl}=Math,vl=(...n)=>{let[i,s,o]=pn(n,"lch");return isNaN(o)&&(o=0),o=o*dl,[i,yl(o)*s,gl(o)*s]},Ri=(...n)=>{n=pn(n,"lch");const[i,s,o,...c]=n,[a,u,l]=vl(i,s,o),[d,r,h]=fs(a,u,l);return[d,r,h,...c.length>0&&c[0]<1?[c[0]]:[]]},{sqrt:bl,atan2:wl,round:kl}=Math,Sl=(...n)=>{const[i,s,o]=pn(n,"lab"),c=bl(s*s+o*o);let a=(wl(o,s)*ul+360)%360;return kl(c*1e4)===0&&(a=Number.NaN),[i,c,a]},Cl=(...n)=>{const[i,s,o,...c]=pn(n,"rgb"),[a,u,l]=ps(i,s,o),[d,r,h]=Sl(a,u,l);return[d,r,h,...c.length>0&&c[0]<1?[c[0]]:[]]},_l={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:ef}=_l;function Qo({mediaAttachments:n,statusID:i,instance:s,lang:o,index:c=0,onClose:a=()=>{}}){const{_:u}=ce(),[l,d]=$("default"),r=j(null),[h,f]=$(c),p=j(null);_t(()=>{p.current?.scrollIntoView()},[]);const g=j(i);G(()=>{const C=c*r.current.clientWidth,T=g.current!==i;T&&(g.current=i),r.current.focus(),r.current.scrollTo({left:C*(Yt()?-1:1),behavior:T?"auto":"smooth"})},[c,i]);const[y,w]=$(!0);G(()=>{let C=T=>{a(T,h,n,r)};return r.current&&r.current.addEventListener("swiped-down",C),()=>{r.current&&r.current.removeEventListener("swiped-down",C)}},[h,n]),He("esc",C=>{a(C,h,n,r)},{ignoreEventWhen:C=>!!document.querySelector("#modal-container > *")||C.metaKey||C.ctrlKey||C.altKey||C.shiftKey,useKey:!0},[a,h,n]),G(()=>{let C=()=>{const{clientWidth:T,scrollLeft:v}=r.current,I=Math.round(Math.abs(v)/T);f(I)};return r.current&&r.current.addEventListener("scroll",C,{passive:!0}),()=>{r.current&&r.current.removeEventListener("scroll",C)}},[]),G(()=>{let C=setTimeout(()=>{r.current?.focus?.()},100);return()=>clearTimeout(C)},[]);const k=xe(()=>n?.map(C=>{const{blurhash:T}=C;if(T){const v=es(T);return Cl(v)}return null}),[n]),b=xe(()=>k?.map(C=>C?{light:Ri([.95,.01,C[2]]),dark:Ri([.35,.01,C[2]]),default:Ri([.6,C[1],C[2]])}:null)),S=xe(()=>{const T=100/b.length,v=b.map((E,F)=>{const O=F*T+5,H=(F+1)*T-5;return E?.light&&E?.dark?{light:` rgb(${E.light?.join(",")}) ${O}%, rgb(${E.light?.join(",")}) ${H}% `,dark:` rgb(${E.dark?.join(",")}) ${O}%, rgb(${E.dark?.join(",")}) ${H}% `}:{light:` transparent ${O}%, transparent ${H}% `,dark:` transparent ${O}%, transparent ${H}% `}}),I=v.map(E=>E.light).join(", "),L=v.map(E=>E.dark).join(", ");return{light:I,dark:L}},[b]);let x=j(null);return G(()=>()=>{x.current?.hideToast?.()},[]),_t(()=>{const C=b[h];let T,v;if(C){const I=ke.local.get("theme");if(I){const L=`rgb(${C[I].join(",")})`;T=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),T&&(v=T.content,T.content=L),document.documentElement.style.setProperty("--meta-theme-color",L)}else{const L=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",E=`rgb(${C[L].join(",")})`;T=document.querySelector(`meta[name="theme-color"][media*="${L}"]`),T&&(v=T.content,T.content=E),document.documentElement.style.setProperty("--meta-theme-color",E)}}return()=>{T&&v&&(T.content=v),document.documentElement.style.removeProperty("--meta-theme-color")}},[h,b]),e("div",{class:`media-modal-container media-modal-count-${n?.length}`,children:[e("div",{ref:r,tabIndex:"0","data-swipe-threshold":"44",class:"carousel",onClick:C=>{(C.target.classList.contains("carousel-item")||C.target.classList.contains("media")||C.target.classList.contains("media-zoom"))&&a(C,h,n,r)},style:n.length>1?{backgroundAttachment:"local","--accent-gradient-light":S?.light,"--accent-gradient-dark":S?.dark}:{},children:n?.map((C,T)=>{const v=n.length===1?b[T]:null;return e("div",{class:"carousel-item",style:v?{"--accent-color":`rgb(${v.default.join(",")})`,"--accent-light-color":`rgb(${v.light?.join(",")})`,"--accent-dark-color":`rgb(${v.dark?.join(",")})`,"--accent-alpha-color":`rgba(${v.default.join(",")}, 0.4)`}:{},tabindex:"0",ref:T===h?p:null,onClick:I=>{I.target.classList.contains("media")||w(!y)},children:[!!C.description&&e("button",{type:"button",class:"media-alt",hidden:!y,onClick:()=>{R.showMediaAlt={alt:C.description,lang:o}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:o,dir:"auto",children:C.description})]}),e(Ro,{media:C,showOriginal:!0,lang:o})]},C.id)})}),e("div",{class:"carousel-top-controls",hidden:!y,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:C=>a(C,h,n,r),children:e(_,{icon:"x",alt:u({id:"yz7wBu"})})})}),n?.length>1?e("span",{class:"carousel-dots",children:n?.map((C,T)=>e("button",{type:"button",disabled:T===h,class:`carousel-dot ${T===h?"active":""}`,onClick:v=>{v.preventDefault(),v.stopPropagation();const I=r.current.clientWidth*T*(Yt()?-1:1);r.current.focus(),r.current.scrollTo({left:I,behavior:"smooth"})},children:e(_,{icon:"round",size:"s",alt:"⸱"})},C.id))}):e("span",{}),e("span",{children:[e(mt,{overflow:"auto",align:"end",position:"anchor",gap:4,menuClassName:"glass-menu",menuButton:e("button",{type:"button",class:"carousel-button",children:e(_,{icon:"more2",alt:u({id:"2FYpfJ"})})}),children:[e(Ve,{href:n[h]?.remoteUrl||n[h]?.url,class:"carousel-button",target:"_blank",title:u({id:"5hXGws"}),children:[e(_,{icon:"popout"}),e("span",{children:e(m,{id:"aDr7Vc"})})]}),!1]})," ",!!i&&e(pe,{to:`${s?`/${s}`:""}/s/${i}${window.matchMedia("(min-width: calc(40em + 350px))").matches?`?media=${h+1}`:""}`,class:"button carousel-button media-post-link",children:[e("span",{class:"button-label",children:[e(m,{id:"ISg5SQ"})," "]}),"»"]})]})]}),n?.length>1&&e("div",{class:"carousel-controls",hidden:!y,children:[e("button",{type:"button",class:"carousel-button",hidden:h===0,onClick:C=>{C.preventDefault(),C.stopPropagation(),r.current.focus(),r.current.scrollTo({left:r.current.clientWidth*(h-1)*(Yt()?-1:1),behavior:"smooth"})},children:e(_,{icon:"arrow-left",alt:u({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:h===n.length-1,onClick:C=>{C.preventDefault(),C.stopPropagation(),r.current.focus(),r.current.scrollTo({left:r.current.clientWidth*(h+1)*(Yt()?-1:1),behavior:"smooth"})},children:e(_,{icon:"arrow-right",alt:u({id:"hXzOVo"})})})]})]})}function Il({url:n,linkText:i,onClose:s}){const{_:o}=ce();if(!n)return null;let c=n;try{const l=URL.parse(n),d=l.protocol,r=l.hostname,h=n.slice(l.origin.length);c=e(B,{children:[d,"//",e("strong",{children:r}),h]})}catch{}const a=()=>{try{navigator.clipboard.writeText(n),le(o({id:"edWbV6"}))}catch{le(o({id:"W1ewR0"}))}},u=()=>{if(navigator.share&&navigator.canShare({url:n}))try{navigator.share({url:n})}catch{}};return e("div",{class:"sheet sheet-modal",id:"open-link-sheet",tabindex:"-1",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(_,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(m,{id:"Gj4mrz"})})}),e("main",{children:[!!i&&e(B,{children:[e("p",{class:"link-text",children:[e(_,{icon:"cursor-hand",size:"xl"})," ",i]}),e("div",{class:"arrow",children:e(_,{icon:"arrow-down"})})]}),e("p",{class:"full-url",children:c})]}),e("footer",{children:[e("button",{type:"button",class:"light",onClick:s,children:e(m,{id:"dEgA5A"})}),e("span",{class:"spacer"}),e("button",{type:"button",class:"plain6",onClick:a,children:e(_,{icon:"copy",alt:o({id:"he3ygx"})})}),navigator.canShare&&navigator.canShare({url:n})&&e("button",{type:"button",class:"plain6",onClick:u,children:e(_,{icon:"share",alt:o({id:"LFKLqp"})})}),e("a",{class:"button",href:n,target:"_blank",rel:"noopener noreferrer",onClick:s,children:e(m,{id:"1TNIig"})})]})]})}const gn={newline:10,reset:27};function xl(n){if(!Number.isSafeInteger(n))throw new Error(`integer expected: ${n}`)}function Jo(n){if(!Number.isSafeInteger(n)||n<1||n>40)throw new Error(`Invalid version=${n}. Expected number [1..40]`)}function zt(n,i){return n.toString(2).padStart(i,"0")}function Ps(n,i){const s=n%i;return s>=0?s:i+s}function St(n,i){return new Array(n).fill(i)}function Hn(n){return n=n-(n>>>1&1431655765),n=(n&858993459)+(n>>>2&858993459),(n+(n>>>4)&252645135)*16843009>>>24}function Ds(n){let i=0,s=0;for(const a of n)i=Math.max(i,a.length),s+=a.length;const o=new Uint8Array(s);let c=0;for(let a=0;a=i||(n=o,i=s)},get:()=>n,score:()=>i}}function Ns(n){return{has:i=>n.includes(i),decode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="string")throw new Error("alphabet.decode input should be array of strings");return i.map(s=>{if(typeof s!="string")throw new Error(`alphabet.decode: not string element=${s}`);const o=n.indexOf(s);if(o===-1)throw new Error(`Unknown letter: "${s}". Allowed: ${n}`);return o})},encode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return i.map(s=>{if(xl(s),s<0||s>=n.length)throw new Error(`Digit index outside alphabet: ${s} (alphabet: ${n.length})`);return n[s]})}}}function Os(n){if(n.length!==32)throw new Error("expects 32 element matrix");const i=[1431655765,858993459,252645135,16711935,65535];for(let s=0;s<5;s++){const o=i[s]>>>0,c=1<>>0,f=n[r]>>>0,p=(h>>>c^f)&o;n[d]=(h^p<>>0,n[r]=(f^p)>>>0}}}const yn=n=>1<<(n&31)>>>0,Ht=(n,i)=>i===0?0:i===32?4294967295:(1<>>0;class ct{static size(i,s){if(typeof i=="number"&&(i={height:i,width:i}),!Number.isSafeInteger(i.height)&&i.height!==1/0)throw new Error(`Bitmap: invalid height=${i.height} (${typeof i.height})`);if(!Number.isSafeInteger(i.width)&&i.width!==1/0)throw new Error(`Bitmap: invalid width=${i.width} (${typeof i.width})`);return s!==void 0&&(i={width:Math.min(i.width,s.width),height:Math.min(i.height,s.height)}),i}static fromString(i){i=i.replace(/^\n+/g,"").replace(/\n+$/g,"");const s=i.split(String.fromCharCode(gn.newline)),o=s.length;let c;const a=[];for(const u of s){const l=u.split("").map(d=>{if(d==="X")return!0;if(d===" ")return!1;if(d!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${d}`)});if(c!==void 0&&l.length!==c)throw new Error(`Bitmap.fromString different row sizes: width=${c} cur=${l.length}`);c=l.length,a.push(l)}return c===void 0&&(c=0),new ct({height:o,width:c},a)}defined;value;tailMask;words;fullWords;height;width;constructor(i,s){const{height:o,width:c}=ct.size(i);if(this.height=o,this.width=c,this.tailMask=Ht(0,c&31||32),this.words=Math.ceil(c/32)|0,this.fullWords=Math.floor(c/32)|0,this.value=new Uint32Array(this.words*o),this.defined=new Uint32Array(this.value.length),s){if(s.length!==o)throw new Error(`Bitmap: data height mismatch: exp=${o} got=${s.length}`);for(let a=0;a>>5)}bitIndex(i,s){return{word:this.wordIndex(i,s),bit:i&31}}isDefined(i,s){const o=this.wordIndex(i,s),c=yn(i);return(this.defined[o]&c)!==0}get(i,s){const o=this.wordIndex(i,s),c=yn(i);return(this.value[o]&c)!==0}maskWord(i,s,o){const{defined:c,value:a}=this;c[i]|=s,a[i]=a[i]&~s|-o&s}set(i,s,o){o!==void 0&&this.maskWord(this.wordIndex(i,s),yn(i),o)}fillRectConst(i,s,o,c,a){if(o<=0||c<=0||a===void 0)return;const{value:u,defined:l,words:d}=this,r=i>>>5,h=i+o-1>>>5,f=i&31,p=i+o-1&31;for(let g=0;g{let w=0,k=r[h];for(let b=0;b{const y=d[r];for(let w=0;w>>S|T<<32-S)>>>0:C,I=Ht(k,x),L=(v&Ht(0,x))<>>0;d[w]|=I,l[w]=l[w]&~I|L,g+=x}}return this}rectSlice(i,s=this.size()){const{x:o,y:c}=this.xy(i),{height:a,width:u}=ct.size(s,this.size({x:o,y:c})),l=new ct({height:a,width:u});return this.rectRead({x:o,y:c},{height:a,width:u},(d,r)=>{this.isDefined(o+d.x,c+d.y)&&l.set(d.x,d.y,r)}),l}transpose(){const{height:i,width:s,value:o,defined:c,words:a}=this,u=new ct({height:s,width:i}),{words:l,value:d,defined:r,tailMask:h}=u,f=new Uint32Array(32),p=new Uint32Array(32);for(let g=0;g=s)break;const S=u.wordIndex(g,b),x=g>>>5===l-1?h:4294967295;d[S]=f[k]&x,r[S]=p[k]&x}}return u}negate(){const i=this.defined.length;for(let s=0;s1024)throw new Error(`invalid scale factor: ${i}`);const{height:s,width:o}=this;return new ct({height:i*s,width:i*o}).rect({x:0,y:0},1/0,({x:a,y:u})=>this.get(a/i|0,u/i|0))}clone(){const i=new ct(this.size());return i.defined.set(this.defined),i.value.set(this.value),i}assertDrawn(){const{height:i,width:s,defined:o,tailMask:c,fullWords:a,words:u}=this;if(!(!i||!s))for(let l=0;l=32)throw new Error("wrong patternLen");const c=(1<>>y&1)&c,!(h*32+y+1=this.height)return 0;const c=this.wordIndex(0,i)|0,a=this.wordIndex(0,i+1)|0,l=(s&31)===0?2147483647:Ht(0,s-1&31);let d=0;for(let r=0;r>>0,g=r+1>>0:0,y=~(h^(h>>>1|(g&1)<<31)>>>0)>>>0,w=r+1>>0:0,k=~(f^(f>>>1|(w&1)<<31)>>>0)>>>0;let b=(p&y&k)>>>0;r===o-1&&(b&=l),d+=Hn(b)}return d}toString(){const i=String.fromCharCode(gn.newline);let s="";for(let o=0;onew Array(this.width));for(let s=0;s=i?!0:this.get(a,c+1);!u&&!l?o+="█":!u&&l?o+="▀":u&&!l?o+="▄":u&&l&&(o+=" ")}o+=String.fromCharCode(gn.newline)}return o}toTerm(){const i=String.fromCharCode(gn.reset),s=i+"[0m",o=i+"[1;47m "+s,c=i+"[40m "+s,a=String.fromCharCode(gn.newline);let u="";for(let l=0;l`,o="",c;return this.rectRead(0,1/0,(a,u)=>{if(!u)return;const{x:l,y:d}=a;if(!i){s+=``;return}let r=`M${l} ${d}`;if(c){const f=`m${l-c.x} ${d-c.y}`;f.length<=r.length&&(r=f)}const h=l<10?`H${l}`:"h-1";o+=`${r}h1v1${h}Z`,c=a}),i&&(s+=``),s+="",s}toGIF(){const i=l=>[l&255,l>>>8&255],s=[...i(this.width),...i(this.height)],o=[];this.rectRead(0,1/0,(l,d)=>o.push(+(d===!0)));const c=126,a=[71,73,70,56,55,97,...s,246,0,0,255,255,255,...St(381,0),44,0,0,0,0,...s,0,7],u=Math.floor(o.length/c);for(let l=0;l+d));return a.push(o.length%c+1,128,...o.slice(u*c).map(l=>+l)),a.push(1,129,0,59),new Uint8Array(a)}toImage(i=!1){const{height:s,width:o}=this.size(),c=new Uint8Array(s*o*(i?3:4));let a=0;for(let u=0;u21+4*(n-1),decode:n=>(n-17)/4},sizeType:n=>Math.floor((n+7)/17),alignmentPatterns(n){if(n===1)return[];const i=6,s=it.size.encode(n)-i-1,o=s-i,c=Math.ceil(o/28);let a=Math.floor(o/c);a%2?a+=1:o%c*2>=c&&(a+=2);const u=[i];for(let l=1;l>9)*1335;return(s<<10|o)^it.formatMask},versionBits(n){let i=n;for(let s=0;s<12;s++)i=i<<1^(i>>11)*7973;return n<<12|i},alphabet:{numeric:Ns("0123456789"),alphanumerc:Ns("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits(n,i){return{numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]}[i][it.sizeType(n)]},modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(n,i){const s=Al[n-1],o=Tl[i][n-1],c=El[i][n-1],a=Math.floor(s/c)-o,u=c-s%c;return{words:o,numBlocks:c,shortBlocks:u,blockLen:a,capacity:(s-o*c)*8,total:(o+a)*c+c-u}}},ms=[(n,i)=>(n+i)%2==0,(n,i)=>i%2==0,(n,i)=>n%3==0,(n,i)=>(n+i)%3==0,(n,i)=>(Math.floor(i/2)+Math.floor(n/3))%2==0,(n,i)=>n*i%2+n*i%3==0,(n,i)=>(n*i%2+n*i%3)%2==0,(n,i)=>((n+i)%2+n*i%3)%2==0],ue={tables:(n=>{const i=St(256,0),s=St(256,0);for(let o=0,c=1;o<256;o++)i[o]=c,s[c]=o,c<<=1,c&256&&(c^=n);return{exp:i,log:s}})(285),exp:n=>ue.tables.exp[n],log(n){if(n===0)throw new Error(`GF.log: invalid arg=${n}`);return ue.tables.log[n]%255},mul(n,i){return n===0||i===0?0:ue.tables.exp[(ue.tables.log[n]+ue.tables.log[i])%255]},add:(n,i)=>n^i,pow:(n,i)=>ue.tables.exp[ue.tables.log[n]*i%255],inv(n){if(n===0)throw new Error(`GF.inverse: invalid arg=${n}`);return ue.tables.exp[255-ue.tables.log[n]]},polynomial(n){if(n.length==0)throw new Error("GF.polymomial: invalid length");if(n[0]!==0)return n;let i=0;for(;in.length-1,coefficient:(n,i)=>n[ue.degree(n)-i],mulPoly(n,i){if(n[0]===0||i[0]===0)return[0];const s=St(n.length+i.length-1,0);for(let o=0;oo.length&&([s,o]=[o,s]);let c=St(o.length,0),a=o.length-s.length,u=o.slice(0,a);for(let l=0;l=s;){let r=o,h=a;if(o=c,a=u,o[0]===0)throw new Error("rLast[0] === 0");c=r;let f=[0];const p=ue.inv(o[0]);for(;ue.degree(c)>=ue.degree(o)&&c[0]!==0;){const g=ue.degree(c)-ue.degree(o),y=ue.mul(c[0],p);f=ue.addPoly(f,ue.monomial(g,y)),c=ue.addPoly(c,ue.mulPolyMonomial(o,g,y))}if(f=ue.mulPoly(f,a),u=ue.addPoly(f,h),ue.degree(c)>=ue.degree(o))throw new Error(`Division failed r: ${c}, rLast: ${o}`)}const l=ue.coefficient(u,0);if(l==0)throw new Error("sigmaTilde(0) was zero");const d=ue.inv(l);return[ue.mulPolyScalar(u,d),ue.mulPolyScalar(c,d)]}};function Rl(n){return{encode(i){const s=ue.divisorPoly(n),o=Array.from(i);return o.push(...s.slice(0,-1).fill(0)),Uint8Array.from(ue.remainderPoly(o,s))},decode(i){const s=i.slice(),o=ue.polynomial(Array.from(i));let c=St(n,0),a=!1;for(let f=0;fa.isDefined(r,6)?void 0:r%2==0).vLine({x:6,y:0},1/0,({y:r})=>a.isDefined(6,r)?void 0:r%2==0);{const r=it.formatBits(i,s),h=f=>!o&&(r>>f&1)==1;for(let f=0;f<6;f++)a.set(8,f,h(f));for(let f=6;f<8;f++)a.set(8,f+1,h(f));for(let f=8;f<15;f++)a.set(8,c-15+f,h(f));for(let f=0;f<8;f++)a.set(c-f-1,8,h(f));for(let f=8;f<9;f++)a.set(15-f-1+1,8,h(f));for(let f=9;f<15;f++)a.set(15-f-1,8,h(f));a.set(8,c-8,!o)}if(n>=7){const r=it.versionBits(n);for(let h=0;h<18;h+=1){const f=!o&&(r>>h&1)==1,p=Math.floor(h/3),g=h%3+c-8-3;a.set(g,p,f),a.set(p,g,f)}}return a}function ic(n,i,s){const o=n.height,c=ms[i];let a=-1,u=o-1;for(let l=o-1;l>0;l-=2){for(l==6&&(l=5);;u+=a){for(let d=0;d<2;d+=1){const r=l-d;n.isDefined(r,u)||s(r,u,c(r,u))}if(u+a<0||u+a>=o)break}a=-a}}function Ll(n){let i="numeric";for(let s of n)if(!it.alphabet.numeric.has(s)&&(i="alphanumeric",!it.alphabet.alphanumerc.has(s)))return"byte";return i}function $l(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Bs(n,i,s,o,c=$l){let a="",u=s.length;if(o==="numeric"){const p=it.alphabet.numeric.decode(s.split("")),g=p.length;for(let y=0;yzt(g,8)).join("")}else throw new Error("encode: unsupported type");const{capacity:l}=it.capacity(n,i),d=zt(u,it.lengthBits(n,o));let r=it.modeBits[o]+d+a;if(r.length>l)throw new Error("Capacity overflow");r+="0".repeat(Math.min(4,Math.max(0,l-r.length))),r.length%8&&(r+="0".repeat(8-r.length%8));const h="1110110000010001";for(let p=0;r.length!==l;p++)r+=h[p%h.length];const f=Uint8Array.from(r.match(/(.{8})/g).map(p=>+`0b${p}`));return tc(n,i).encode(f)}function Fs(n,i,s,o,c=!1){const a=nc(n,i,o,c);let u=0;const l=8*s.length;if(ic(a,o,(d,r,h)=>{let f=!1;u>>3]>>(7-u&7)&1)!==0,u++),a.set(d,r,f!==h)}),u!==l)throw new Error("QR: bytes left after draw");return a}const sc=n=>{const i=n.map(s=>s?"1":"0").join("");return{len:i.length,n:+`0b${i}`}},oc=[!0,!1,!0,!0,!0,!1,!0],cc=[!1,!1,!1,!1],Pn=sc([...oc,...cc]),Us=sc([...cc,...oc]);function Ml(n){const{width:i,height:s}=n,o=n.transpose();let c=0;for(let h=0;h{f>=5&&(c+=3+(f-5))});for(let h=0;h{f>=5&&(c+=3+(f-5))});let a=0;for(let h=0;h{if(c&&a.current){const W=a.current.offsetHeight;l(W)}},[c]),G(()=>{if(i){const W=new Image;W.crossOrigin="anonymous",W.onload=()=>{r(!0);try{const{width:N,height:te}=W;Bi.width=N,Bi.height=te,Fi.drawImage(W,0,0);const me=Fi.getImageData(0,0,N,te).data,be=me.length/4;let q=0,V=!1;for(let fe=3;fe.1){V=!0;break}f(V)}catch{f(!1)}},W.onerror=N=>{r(!0)},W.src=i}else r(!1)},[i]),!n)return null;const g=xe(()=>zl(n,"raw",{ecc:"high",border:0,scale:1}),[n]),y=g.length,w=d?Math.ceil(y*.3):0,k=Math.floor((y-w)/2),b=k+w,S=(W,N)=>{if(W<0||W>=y||N<0||N>=y)return!1;if(d&&W>=k&&W=k&&NW<0||W>=y||N<0||N>=y?!1:S(W,N),C=(W,N)=>W<7&&N<7||W>=y-7&&N<7||W<7&&N>=y-7,T=xe(()=>{let W="";for(let N=0;Ne("use",{href:"#position-marker-mask",x:W.x,y:W.y},`${W.x}-${W.y}`))}),d&&p&&e("circle",{cx:O+F/2,cy:H+F/2,r:F/2,fill:"black"}),d&&!o&&e("rect",{x:O,y:H,width:F,height:F,fill:"black"})]}),e("path",{id:"qr-pattern",fill:"currentColor",stroke:"currentColor","stroke-width":"1","stroke-linejoin":"round","stroke-linecap":"round",d:T})]}),e("use",{href:"#qr-pattern"}),e("g",{id:"position-markers",children:v.map(W=>e("use",{href:"#position-marker",x:W.x,y:W.y},`${W.x}-${W.y}`))}),s&&e("g",{mask:"url(#qr-pattern-mask)",children:e("image",{href:s,x:-Q-Y,y:-Q-Y,width:Z+Y*2,height:Z+Y*2,preserveAspectRatio:"none",opacity:"0.5",filter:"url(#blur-mask)"})}),i&&d&&e("image",{href:i,x:O,y:H,width:F,height:F,preserveAspectRatio:"xMidYMid slice","clip-path":p?`circle(${F/2}px at ${F/2}px ${F/2}px)`:void 0}),c&&e("foreignObject",{x:0,y:y+re,width:y,height:u,children:e("div",{ref:a,xmlns:"http://www.w3.org/1999/xhtml",class:"qr-code-caption",dangerouslySetInnerHTML:{__html:c}})})]})}const ac=!!navigator.mediaDevices?.getUserMedia;function Bl({text:n,arena:i,backgroundMask:s,caption:o,onClose:c,onScannerClick:a}){const{_:u}=ce();return e("div",{class:"qr-code-modal-container",children:[e("div",{class:"qr-code-modal-controls",children:[ac&&typeof a=="function"?e("button",{type:"button",class:"plain4",onClick:a,children:e(_,{icon:"scan",alt:u({id:"XDwkfO"})})}):e("span",{}),!!c&&e("button",{type:"button",class:"plain4",onClick:c,children:e(_,{icon:"x",alt:u({id:"yz7wBu"})})})]}),e(ql,{text:n,arena:i,backgroundMask:s,caption:o}),e("div",{class:"qr-code-text",children:n})]})}const jn="BarcodeDetector"in window;jn||setTimeout(()=>{fi(()=>import("./dom-DChi-NQM.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).catch(()=>{})},1e3);class Fl{constructor(i,s){this.stream=i,this.player=s,this.setStream(i)}setStream(i){this.stream=i;const{player:s}=this;s.setAttribute("autoplay",""),s.setAttribute("muted",""),s.setAttribute("playsinline",""),s.srcObject=i}async listDevices(){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw new Error("Media Devices not supported");return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="videoinput").map(s=>({deviceId:s.deviceId,label:s.label||`Camera ${s.deviceId}`}))}async setDevice(i){this.stop();const s=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:i}}});this.setStream(s)}readFrame(i,s=!1){const{player:o}=this;if(s)return i.drawImage(o,o.videoHeight,o.videoWidth);const c=getSize(o);return i.drawImage(o,c.height,c.width)}stop(){for(const i of this.stream.getTracks())i.stop()}}const Ul=async n=>{if(navigator.permissions?.query)try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",()=>{})}catch{}const i=await navigator.mediaDevices.getUserMedia({video:{height:{ideal:720},width:{ideal:1280},facingMode:"environment"}});return new Fl(i,n)};function Kl({onClose:n,checkValidity:i,actionableText:s}){const{_:o,_:c}=ce(),a=j(null),u=j(null),l=j(null),[d,r]=$(""),[h,f]=$(!0),[p,g]=$("loading");G(()=>{let w;return screen?.orientation?.type&&a.current&&(w=()=>{const k=/landscape/.test(window.screen.orientation.type)?"landscape":"portrait";a.current.classList.toggle("landscape",k==="landscape")},screen.orientation.addEventListener("change",w),w()),()=>{w&&screen?.orientation?.removeEventListener&&screen.orientation.removeEventListener("change",w)}},[]),G(()=>{let w,k,b,S,x;return h&&(async()=>{try{k=await Ul(u.current),jn?S=new BarcodeDetector({formats:["qr_code"]}):(x=await fi(()=>import("./dom-DChi-NQM.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),b=new x.QRCanvas({overlay:l.current},{cropToSquare:!1,overlayMainColor:"transparent",overlayFinderColor:"rgba(255, 0, 255, 0.5)"}));const T=u.current;T&&(T.addEventListener("loadedmetadata",()=>{g("default")}),T.addEventListener("play",()=>{const{videoWidth:v,videoHeight:I}=T;if(v&&I&&(a.current.style.setProperty("--long-dimension",Math.max(v,I)),a.current.style.setProperty("--short-dimension",Math.min(v,I))),jn){const L=async()=>{try{const O=await S.detect(u.current);O.length>0&&r(O[0].rawValue)}catch{}};let E;const F=()=>{L(),E=requestAnimationFrame(F)};F(),w=()=>cancelAnimationFrame(E)}else{const L=()=>{try{const E=k.readFrame(b,!0);E!=null&&r(E)}catch{}};w=x.frameLoop(L)}}))}catch{g("error"),f(!1)}})(),()=>{w&&w(),k&&k.stop(),b&&b.clear()}},[h]);const y=typeof i=="function"?i(d):!!d;return e("div",{class:"qr-scanner-modal",children:[e("div",{class:"qr-scanner-header",children:[e(qe,{abrupt:!0,hidden:p!=="loading"}),e("button",{type:"button",class:"plain4",onClick:n,children:e(_,{icon:"x",alt:o({id:"yz7wBu"})})})]}),p==="error"?e("div",{class:"ui-state",children:e("p",{children:e(m,{id:"08IojR"})})}):e(B,{children:[e("div",{ref:a,class:"qr-scanner-video-container",children:[e("video",{ref:u,playsInline:!0,muted:!0,disablepictureinpicture:!0}),!jn&&e("canvas",{ref:l,class:"qr-scanner-canvas"}),e("svg",{class:"qr-scanner-corner-hint",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid meet",children:[e("path",{d:"M 25 10 L 15 10 Q 10 10 10 15 L 10 25",stroke:"currentColor","stroke-width":"2",fill:"none","stroke-linecap":"round"}),e("path",{d:"M 75 10 L 85 10 Q 90 10 90 15 L 90 25",stroke:"currentColor","stroke-width":"2",fill:"none","stroke-linecap":"round"}),e("path",{d:"M 25 90 L 15 90 Q 10 90 10 85 L 10 75",stroke:"currentColor","stroke-width":"2",fill:"none","stroke-linecap":"round"}),e("path",{d:"M 75 90 L 85 90 Q 90 90 90 85 L 90 75",stroke:"currentColor","stroke-width":"2",fill:"none","stroke-linecap":"round"})]})]}),e("div",{class:"qr-scanner-result",children:!!d&&e(B,{children:[e("p",{class:"qr-scanner-text",children:d}),y&&e("button",{type:"button",class:"button plain6",onClick:()=>{n({text:d})},children:s?c(s):e(_,{icon:"arrow-right"})})]})})]})]})}const Hl=["spam","legal","violation","other"],vn={spam:{label:{id:"t8dIOP"},description:{id:"csQin/"}},legal:{label:{id:"IjKdHM"},description:{id:"e6tGFu"}},violation:{label:{id:"KPFHM2"},description:{id:"fpotTF"},stampLabel:{id:"iuLUuH"}},other:{label:{id:"/IX/7x"},description:{id:"kxiG8g"},excludeStamp:!0}};function jl(n,i){if(!n.translations||!i)return null;const s=Object.keys(n.translations);if(!s?.length)return null;let o=ni([i],s,null);if(!o){const c=s.map(a=>a.split(/(?=[A-Z])/).map((l,d)=>d===0?l:l.toLowerCase()).join("-"));o=ni([i],c,null)}if(o&&o.includes("-")){const[c,a]=o.split("-");o=c+a.charAt(0).toUpperCase()+a.slice(1)}return o}function Vl(n,i){return n?.length?i?n.map(s=>{const o=jl(s,i);return{...s,_translatedText:s.translations?.[o]?.text||null}}):n:[]}function Yl({account:n,post:i,onClose:s}){const{_:o,_:c,i18n:a}=ce(),{masto:u}=oe(),[l,d]=$("default"),[r,h]=n.acct.split("@"),[f,p]=xe(()=>{const{rules:C,domain:T}=vo();return[Vl(C||[],a.locale),T]},[a.locale]),[g,y]=$(null),[w,k]=$(!1),b=j(null),[S,x]=$(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:c(i?{id:"muLhL3"}:{id:"ACul2G",values:{username:r}})}),e("button",{type:"button",class:"plain4 small",disabled:l==="loading",onClick:()=>s(),children:e(_,{icon:"x",size:"xl",alt:c({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:i?e(je,{status:i,size:"s",previewMode:!0}):e(vt,{account:n,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!g&&!vn[g].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[o(vn[g].stampLabel||o(vn[g].label)),e("small",{children:e(m,{id:"2WtL62"})})]},g),e("form",{onSubmit:C=>{C.preventDefault();const T=new FormData(C.target),v=Object.fromEntries(T.entries());let{category:I,comment:L,forward:E}=v;L||(L=void 0),E==="on"&&(E=!0);const F=I==="violation"?Object.entries(v).filter(([H])=>H.startsWith("rule_ids")).map(([H,Q])=>Q):void 0,O={category:I,comment:L,forward:E,ruleIds:F};d("loading"),(async()=>{try{await u.v1.reports.create({accountId:n.id,statusIds:i?.id?[i.id]:void 0,category:I,comment:L,ruleIds:F,forward:E}),d("success"),le(c(i?{id:"y3ou+8"}:{id:"R9kjEL"})),s()}catch(H){d("error"),le(H?.message||c(i?{id:"+3FjPq"}:{id:"oEQq5w"}))}})()},children:[e("p",{children:c(i?{id:"L9fUm+"}:{id:"rSLkfe"})}),e("section",{class:"report-categories",children:Hl.map(C=>C==="violation"&&!f?.length?null:e(B,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:C,required:!0,disabled:l==="loading",onChange:T=>{y(T.target.value),k(T.target.value==="violation")}}),e("span",{children:[o(vn[C].label),"  ",e("small",{class:"ib insignificant",children:o(vn[C].description)})]})]}),C==="violation"&&!!f?.length&&e("div",{class:"shazam-container no-animation",hidden:!w,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:b,children:f.map((T,v)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${v}]`,value:T.id,required:w&&!S,disabled:l==="loading",onChange:I=>{const{checked:L}=I.target;L?x(!0):b.current.querySelectorAll("input:checked").length||x(!1)}}),e("span",{children:T._translatedText||T.text})]},T.id))})})})]},C))}),e("section",{class:"report-comment",children:[e("p",{children:e("label",{for:"report-comment",children:e(m,{id:"ecVtjm"})})}),e("textarea",{maxlength:"1000",rows:"1",name:"comment",id:"report-comment",disabled:l==="loading",required:!i})]}),!!h&&h!==p&&e("section",{children:e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,name:"forward",disabled:l==="loading"})," ",e("span",{children:e(m,{id:"cyjS8M",values:{domain:h},components:{0:e("i",{})}})})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:l==="loading",children:e(m,{id:"4cijjm"})})," ",e("button",{type:"submit",class:"plain2",disabled:l==="loading",onClick:async()=>{try{await u.v1.accounts.$select(n.id).mute(),le(c({id:"/BGBeF",values:{username:r}}))}catch{le(c({id:"v02K7/",values:{username:r}}))}},children:e(m,{id:"caeqw/",components:{0:e("small",{class:"ib"})}})})," ",e("button",{type:"submit",class:"plain2",disabled:l==="loading",onClick:async()=>{try{await u.v1.accounts.$select(n.id).block(),le(c({id:"kjUejn",values:{username:r}}))}catch{le(c({id:"pMcdDp",values:{username:r}}))}},children:e(m,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(qe,{hidden:l!=="loading"})]})]})]})]})}var Vn={exports:{}},nf=Vn.exports,Ks;function Wl(){return Ks||(Ks=1,(function(n){var i=(function(){var s=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function u(d,r){if(!a[d]){a[d]={};for(var h=0;h>>8,h[f*2+1]=g%256}return h},decompressFromUint8Array:function(d){if(d==null)return l.decompress(d);for(var r=new Array(d.length/2),h=0,f=r.length;h>1}else{for(p=1,f=0;f>1}S--,S==0&&(S=Math.pow(2,C),C++),delete y[b]}else for(p=g[b],f=0;f>1;S--,S==0&&(S=Math.pow(2,C),C++),g[k]=x++,b=String(w)}if(b!==""){if(Object.prototype.hasOwnProperty.call(y,b)){if(b.charCodeAt(0)<256){for(f=0;f>1}else{for(p=1,f=0;f>1}S--,S==0&&(S=Math.pow(2,C),C++),delete y[b]}else for(p=g[b],f=0;f>1;S--,S==0&&(S=Math.pow(2,C),C++)}for(p=2,f=0;f>1;for(;;)if(v=v<<1,I==r-1){T.push(h(v));break}else I++;return T.join("")},decompress:function(d){return d==null?"":d==""?null:l._decompress(d.length,32768,function(r){return d.charCodeAt(r)})},_decompress:function(d,r,h){var f=[],p,g=4,y=4,w=3,k="",b=[],S,x,C,T,v,I,L,E={val:h(0),position:r,index:1};for(S=0;S<3;S+=1)f[S]=S;for(C=0,v=Math.pow(2,2),I=1;I!=v;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=r,E.val=h(E.index++)),C|=(T>0?1:0)*I,I<<=1;switch(p=C){case 0:for(C=0,v=Math.pow(2,8),I=1;I!=v;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=r,E.val=h(E.index++)),C|=(T>0?1:0)*I,I<<=1;L=s(C);break;case 1:for(C=0,v=Math.pow(2,16),I=1;I!=v;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=r,E.val=h(E.index++)),C|=(T>0?1:0)*I,I<<=1;L=s(C);break;case 2:return""}for(f[3]=L,x=L,b.push(L);;){if(E.index>d)return"";for(C=0,v=Math.pow(2,w),I=1;I!=v;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=r,E.val=h(E.index++)),C|=(T>0?1:0)*I,I<<=1;switch(L=C){case 0:for(C=0,v=Math.pow(2,8),I=1;I!=v;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=r,E.val=h(E.index++)),C|=(T>0?1:0)*I,I<<=1;f[y++]=s(C),L=y-1,g--;break;case 1:for(C=0,v=Math.pow(2,16),I=1;I!=v;)T=E.val&E.position,E.position>>=1,E.position==0&&(E.position=r,E.val=h(E.index++)),C|=(T>0?1:0)*I,I<<=1;f[y++]=s(C),L=y-1,g--;break;case 2:return b.join("")}if(g==0&&(g=Math.pow(2,w),w++),f[L])k=f[L];else if(L===y)k=x+x.charAt(0);else return null;b.push(k),f[y++]=x+k.charAt(0),g--,x=k,g==0&&(g=Math.pow(2,w),w++)}}};return l})();n!=null?n.exports=i:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return i})})(Vn)),Vn.exports}var Hs=Wl();const Gl="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2084%2062'%3e%3crect%20width='64'%20height='48'%20x='18'%20y='2'%20fill='%23fff'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3crect%20width='32'%20height='48'%20x='2'%20y='12'%20fill='%23fff'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3cpath%20fill='%234169E1'%20d='M14%2052a4%204%200%201%201-8%200%204%204%200%200%201%208%200Zm64-42a4%204%200%201%201-8%200%204%204%200%200%201%208%200Z'/%3e%3c/svg%3e",Zl="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2082%2062'%3e%3crect%20width='78'%20height='58'%20x='2'%20y='2'%20fill='%23999'%20fill-opacity='.3'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3crect%20width='18'%20height='46'%20x='8'%20y='8'%20fill='%23fff'%20stroke='%23999'%20stroke-width='2'%20rx='1'/%3e%3crect%20width='18'%20height='46'%20x='32'%20y='8'%20fill='%23fff'%20stroke='%23999'%20stroke-width='2'%20rx='1'/%3e%3crect%20width='18'%20height='46'%20x='56'%20y='8'%20fill='%23fff'%20stroke='%23999'%20stroke-width='2'%20rx='1'/%3e%3c/svg%3e",Xl="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2084%2062'%3e%3crect%20width='64'%20height='48'%20x='18'%20y='2'%20fill='%23fff'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3cpath%20fill='%23999'%20fill-opacity='.3'%20d='M19%203h62v10H19z'/%3e%3cpath%20stroke='%234169E1'%20stroke-width='2'%20d='M43%208a2%202%200%201%201-4%200%202%202%200%200%201%204%200Z'/%3e%3cpath%20stroke='%23999'%20stroke-width='2'%20d='M52%208a2%202%200%201%201-4%200%202%202%200%200%201%204%200Zm9%200a2%202%200%201%201-4%200%202%202%200%200%201%204%200Z'/%3e%3crect%20width='32'%20height='48'%20x='2'%20y='12'%20fill='%23fff'%20stroke='%23999'%20stroke-width='3'%20rx='4'/%3e%3cpath%20fill='%23999'%20fill-opacity='.3'%20d='M3%2049h30v10H3z'/%3e%3cpath%20stroke='%234169E1'%20stroke-width='2'%20d='M11%2054a2%202%200%201%201-4%200%202%202%200%200%201%204%200Z'/%3e%3cpath%20stroke='%23999'%20stroke-width='2'%20d='M20%2054a2%202%200%201%201-4%200%202%202%200%200%201%204%200Zm9%200a2%202%200%201%201-4%200%202%202%200%200%201%204%200Z'/%3e%3c/svg%3e",Ql=200,Jl=10;async function ri(){const{masto:n}=oe(),i=n.v1.followedTags.list({limit:Ql}).values(),s=[];let o=0;do{const{value:c,done:a}=await i.next();if(a||c?.length===0)break;s.push(...c),o++}while(oc.name.localeCompare(a.name)),s.length&&setTimeout(()=>{ke.account.set("followedTags",{tags:s,updatedAt:Date.now()})},1),s}const ed=1440*60*1e3;async function td(){try{const{tags:n,updatedAt:i}=ke.account.get("followedTags")||{};return n?.length?(Date.now()-i>ed&&ri(),n):await ri()}catch{return[]}}const js=document.createElement("div"),nd=n=>{if(!n)return[];if(n.indexOf("#")===-1)return[];js.innerHTML=n;const i=js.querySelectorAll("a.hashtag");return i.length?Array.from(i).map(s=>s.innerText.trim().replace(/^[^#]*#+/,"")):[]};function Yn({children:n}){if(typeof n=="string")return n;const[i,s]=$("");return G(()=>{Promise.resolve(n).then(s)},[n]),i}const Pt=9,id=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites","profile"],rc={following:{id:"7ZJHdw"},notifications:{id:"iDNBZe"},list:{id:"h16FyT"},public:{id:"tXgQpk"},search:{id:"A1taO8"},"account-statuses":{id:"AeXO77"},bookmarks:{id:"7Ff7ia"},favourites:{id:"zZOZj7"},hashtag:{id:"GP8RLS"},trending:{id:"4/iCqx"},mentions:{id:"/bZzdR"},profile:{id:"vERlcd"}},Wn={list:[{text:{id:"DUMt1y"},name:"id",notRequired:!0}],public:[{text:{id:"OgyJSr"},name:"local",type:"checkbox"},{text:{id:"sGH11W"},name:"instance",type:"text",placeholder:{id:"7defFj"},notRequired:!0}],trending:[{text:{id:"sGH11W"},name:"instance",type:"text",placeholder:{id:"7defFj"},notRequired:!0}],search:[{text:{id:"dmloPh"},name:"query",type:"text",placeholder:{id:"UHDQDE"},notRequired:!0}],"account-statuses":[{text:"@",name:"id",type:"text",placeholder:"cheeaun@mastodon.social"}],hashtag:[{text:"#",name:"hashtag",type:"text",placeholder:{id:"a6oTWs"},pattern:"[^#]+"},{text:{id:"eK4SL/"},name:"media",type:"checkbox"},{text:{id:"sGH11W"},name:"instance",type:"text",placeholder:{id:"7defFj"},notRequired:!0}]},sd=It(async({id:n})=>{const i=await oe().masto.v1.accounts.$select(n).fetch();return i.username||i.acct||i.displayName}),li={following:{id:"home",title:(n,i)=>i===0?he._({id:"i0qMbr"}):he._({id:"following.title"}),path:"/",icon:"home"},mentions:{id:"mentions",title:{id:"/bZzdR"},path:"/mentions",icon:"at"},notifications:{id:"notifications",title:{id:"iDNBZe"},path:"/notifications",icon:"notification"},list:{id:({id:n})=>n?"list":"lists",title:({id:n})=>n?Or(n):he._({id:"h16FyT"}),path:({id:n})=>n?`/l/${n}`:"/l",icon:"list",excludeViewMode:({id:n})=>n?[]:["multi-column"]},public:{id:"public",title:({local:n})=>n?he._({id:"d5zxa4"}):he._({id:"4ERYY7"}),subtitle:({instance:n})=>n||oe().instance,path:({local:n,instance:i})=>`/${i}/p${n?"/l":""}`,icon:({local:n})=>n?"building":"earth"},trending:{id:"trending",title:{id:"4/iCqx"},subtitle:({instance:n})=>n||oe().instance,path:({instance:n})=>`/${n}/trending`,icon:"chart"},search:{id:"search",title:({query:n})=>n?`“${n}”`:he._({id:"A1taO8"}),path:({query:n})=>n?`/search?q=${encodeURIComponent(n)}&type=statuses`:"/search",icon:"search",excludeViewMode:({query:n})=>n?[]:["multi-column"]},profile:{id:"profile",title:{id:"vERlcd"},path:()=>`/a/${dt()}?replies=1`,icon:"user",altIcon:()=>{const n=ln();return{url:n?.info?.avatarStatic||n?.info?.avatar,type:"avatar"}}},"account-statuses":{id:"account-statuses",title:sd,path:({id:n})=>`/a/${n}`,icon:"user"},bookmarks:{id:"bookmarks",title:{id:"7Ff7ia"},path:"/b",icon:"bookmark"},favourites:{id:"favourites",title:{id:"zZOZj7"},path:"/f",icon:"heart"},hashtag:{id:"hashtag",title:({hashtag:n})=>n,subtitle:({instance:n})=>n||oe().instance,path:({hashtag:n,instance:i,media:s})=>`${i?`/${i}`:""}/t/${n.split(/\s+/).join("+")}${s?"?media=1":""}`,icon:"hashtag"}};function od({onClose:n}){const{_:i}=ce(),s=We(R),{shortcuts:o}=s,[c,a]=$(!1),[u,l]=$(!1),[d]=bi();return e("div",{id:"shortcuts-settings-container",class:"sheet",tabindex:"-1",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(_,{icon:"x",alt:he._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(_,{icon:"shortcut"})," ",e(m,{id:"CTqTgr"})," ",e("sup",{style:{fontSize:12,opacity:.5,textTransform:"uppercase"},children:e(m,{id:"A1As8l"})})]})}),e("main",{children:[e("p",{children:e(m,{id:"CIHAsy"})}),e("div",{class:"shortcuts-view-mode",children:[{value:"float-button",label:he._({id:"qwdOim"}),imgURL:Gl},{value:"tab-menu-bar",label:he._({id:"UxBoCm"}),imgURL:Xl},{value:"multi-column",label:he._({id:"uvDfdW"}),imgURL:Zl}].map(({value:r,label:h,imgURL:f})=>{const p=s.settings.shortcutsViewMode===r||r==="float-button"&&!s.settings.shortcutsViewMode;return e("label",{class:p?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:r,checked:p,onChange:g=>{R.settings.shortcutsViewMode=g.target.value}})," ",e("img",{src:f,alt:"",width:"80",height:"58"})," ",e("span",{children:h})]},r)})}),o.length>0?e(B,{children:[e("ol",{class:"shortcuts-list",ref:d,children:o.filter(Boolean).map((r,h)=>{const f=Object.values(r).join("-"),{type:p}=r;if(!li[p])return null;let{icon:g,title:y,subtitle:w,excludeViewMode:k}=li[p];typeof y=="function"?y=y(r,h):y=i(y),typeof w=="function"?w=w(r,h):w=i(w),typeof g=="function"&&(g=g(r,h)),typeof k=="function"&&(k=k(r,h));const b=k?.includes(s.settings.shortcutsViewMode);return e("li",{children:[e(_,{icon:g}),e("span",{class:"shortcut-text",children:[e(Yn,{children:y}),w&&e(B,{children:[" ",e("small",{class:"ib insignificant",children:w})]}),b&&e("span",{class:"tag",children:e(m,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:h===0,onClick:()=>{const S=Array.from(R.shortcuts);if(h>0){const x=R.shortcuts[h-1];S[h-1]=r,S[h]=x,R.shortcuts=S}},children:e(_,{icon:"arrow-up",alt:he._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:h===o.length-1,onClick:()=>{const S=Array.from(R.shortcuts);if(h{a({shortcut:r,shortcutIndex:h})},children:e(_,{icon:"pencil",alt:he._({id:"ePK91l"})})})]})]},f)})}),o.length===1&&s.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(_,{icon:"info"})," ",e("small",{children:e(m,{id:"3Xq4Zi"})})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:s.settings.shortcutsViewMode==="multi-column"?he._({id:"3xIN+E"}):he._({id:"vLxvHT"})}),e("p",{children:e(m,{id:"Fq4zw3",components:{0:e("br",{}),1:e("a",{href:"#",onClick:r=>{r.preventDefault(),R.shortcuts=[{type:"following"},{type:"notifications"}]}})}})})]}),e("p",{class:"insignificant",children:o.length>=Pt&&(s.settings.shortcutsViewMode==="multi-column"?he._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:Pt}}):he._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:Pt}}))}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>l(!0),children:e(m,{id:"bgVLbt"})}),e("button",{type:"button",disabled:o.length>=Pt,onClick:()=>a(!0),children:[e(_,{icon:"plus"})," ",e("span",{children:s.settings.shortcutsViewMode==="multi-column"?he._({id:"Vh3ADI"}):he._({id:"9tmn6W"})})]})]})]}),c&&e(Fe,{onClick:r=>{r.target===r.currentTarget&&a(!1)},children:e(cd,{shortcut:c.shortcut,shortcutIndex:c.shortcutIndex,onSubmit:({result:r,mode:h})=>{h==="edit"?R.shortcuts[c.shortcutIndex]=r:R.shortcuts.push(r)},onClose:()=>a(!1)})}),u&&e(Fe,{onClick:r=>{r.target===r.currentTarget&&l(!1)},children:e(ad,{shortcuts:o,onClose:()=>l(!1)})})]})}const Vs={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function cd({onSubmit:n,disabled:i,shortcut:s,shortcutIndex:o,onClose:c}){const{_:a}=ce(),u=!!s,[l,d]=$(s?.type||null),[r,h]=$("default"),[f,p]=$([]),[g,y]=$([]);G(()=>{(async()=>{if(l==="list")try{h("loading");const k=await fn();p(k),h("default")}catch{h("error")}})(),(async()=>{if(l==="hashtag")try{const k=await ri();y(k)}catch{}})()},[l]);const w=j();return G(()=>{if(u&&l&&Wn[l]){const k=w.current;Wn[l].forEach(({name:b,type:S})=>{const x=k.querySelector(`[name="${b}"]`);x&&s[b]&&(S==="checkbox"?x.checked=s[b]==="on":x.value=s[b])})}},[u,l]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!c&&e("button",{type:"button",class:"sheet-close",onClick:c,children:e(_,{icon:"x",alt:he._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:u?he._({id:"pe1jog"}):he._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:w,onSubmit:k=>{k.preventDefault();const b=new FormData(k.target),S={};b.forEach((x,C)=>{S[C]=x?.trim(),C==="instance"&&(S[C]=S[C].replace(/^https?:\/\//,"").replace(/\/+$/,""),S[C]=S[C].replace(/^@?[^@]+@/,""))}),S.type&&(n({result:S,mode:u?"edit":"add"}),k.target.reset(),d(null),c?.())},children:[e("p",{children:e("label",{children:[e("span",{children:e(m,{id:"cklVjM"})}),e("select",{required:!0,disabled:i,onChange:k=>{d(k.target.value)},defaultValue:u?s.type:void 0,name:"type",dir:"auto",children:[e("option",{}),id.map(k=>e("option",{value:k,children:a(rc[k])}))]})]})}),Wn[l]?.map?.(({text:k,name:b,type:S,placeholder:x,pattern:C,notRequired:T})=>l==="list"?e("p",{children:e("label",{children:[e("span",{children:e(m,{id:"2BBAbc"})}),e("select",{name:"id",required:!T,disabled:i||r==="loading",defaultValue:u?s.id:void 0,dir:"auto",children:[e("option",{value:""}),f.map(v=>e("option",{value:v.id,children:v.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:a(k)})," ",e("input",{type:S,switch:S==="checkbox"||void 0,name:b,placeholder:a(x),required:S==="text"&&!T,disabled:i,list:l==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:C,dir:"auto"}),l==="hashtag"&&g.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:g.map(v=>e("option",{value:v.name}))})]})})),!!Vs[l]&&e("p",{class:"form-note insignificant",children:[e(_,{icon:"info"}),a(Vs[l])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:i||r==="loading",children:u?he._({id:"tfDRzk"}):he._({id:"m16xKo"})}),u&&e("button",{type:"button",class:"light danger",onClick:()=>{R.shortcuts.splice(o,1),c?.()},children:e(m,{id:"t/YqKh"})})]})]})})]})}function ad({shortcuts:n,onClose:i}){const{_:s}=ce(),{masto:o}=oe(),c=xe(()=>!n||!n.filter(Boolean).length?"":Hs.compressToEncodedURIComponent(JSON.stringify(n.filter(Boolean))),[n]),[a,u]=$(""),[l,d]=$("default"),r=xe(()=>{if(!a)return d("default"),null;try{const p=JSON.parse(Hs.decompressFromEncodedURIComponent(a));if(!Array.isArray(p))throw new Error("Not an array");return d("default"),p}catch{try{const g=JSON.parse(a);if(!Array.isArray(g))throw new Error("Not an array");return d("default"),g}catch{return d("error"),null}}},[a]),h=R.shortcuts.length>0,f=j();return e("div",{id:"import-export-container",class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(_,{icon:"x",alt:he._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(m,{id:"OOa7/5",components:{0:e("small",{class:"ib insignificant"})}})})}),e("main",{tabindex:"-1",children:[e("section",{children:[e("h3",{children:[e(_,{icon:"arrow-down-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(m,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:f,type:"text",name:"import",placeholder:he._({id:"tBmklN"}),class:"block",onInput:p=>{u(p.target.value)},dir:"auto"}),ac&&e("button",{type:"button",class:"plain2 small",onClick:()=>{R.showQrScannerModal={onClose:({text:p}={})=>{p&&(u(p),f.current.value=p,f.current.dispatchEvent(new Event("input")))}}},children:e(_,{icon:"scan",alt:he._({id:"XDwkfO"})})}),R.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:l==="cloud-downloading",onClick:async()=>{d("cloud-downloading");const p=dt();le(he._({id:"jFdM/T"}));try{const y=(await o.v1.accounts.relationships.fetch({id:[p]}))[0];if(y){const{note:w=""}=y;if(/(.*)<\/phanpy-shortcuts-settings>/.test(w)){const k=w.match(/(.*)<\/phanpy-shortcuts-settings>/)[1],{v:b,dt:S,data:x}=JSON.parse(k);f.current.value=x,f.current.dispatchEvent(new Event("input"))}}d("default")}catch{d("error"),le(he._({id:"gCDfX+"}))}},title:he._({id:"5I1YZO"}),children:[e(_,{icon:"cloud"}),e(_,{icon:"arrow-down",size:"s"})]})]}),!!r&&Array.isArray(r)&&e(B,{children:[e("p",{children:[e("b",{children:r.length})," shortcut",r.length>1?"s":""," ",e("small",{class:"insignificant",children:["(",a.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:r.map(p=>e("li",{children:[e("span",{style:{opacity:n.some(g=>Object.keys(g).every(y=>{if(!(y in p))return!0;const w=p[y];return w===""||w===null||w===void 0?!0:g[y]===w}))?1:0},children:"*"}),e("span",{children:[s(rc[p.type]),p.type==="list"&&!!p.id&&" ⚠️"," ",Wn[p.type]?.map?.(({text:g,name:y,type:w})=>p[y]?e(B,{children:[e("span",{class:"tag collapsed insignificant",children:[s(g),":"," ",w==="checkbox"?p[y]==="on"?"✅":"❌":p[y]]})," "]}):null)]})]}))}),e("p",{children:[e("small",{children:e(m,{id:"o6sElH"})}),e("br",{}),e("small",{children:["⚠️"," ",e(m,{id:"N4z4P/"})]})]})]}),l==="error"&&e("p",{class:"error",children:e("small",{children:["⚠️ ",e(m,{id:"ZhsPEb"})]})}),e("p",{children:[h&&e(B,{children:[e(ft,{confirmLabel:he._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(m,{id:"nl8sCE"})}),onClick:()=>{const p=r.filter(w=>!R.shortcuts.some(k=>Object.keys(k).every(b=>k[b]===w[b])));if(!p.length){le(he._({id:"o6L30P"}));return}let g=[...R.shortcuts,...p];const y=g.length>Pt;y&&(g=g.slice(0,Pt)),R.shortcuts=g,le(y?he._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:Pt}}):he._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!r,children:e(m,{id:"c89gCv"})})})," "]}),e(ft,{confirmLabel:h?he._({id:"6ZjzWP"}):he._({id:"DWumLi"}),menuItemClassName:h?"danger":void 0,onClick:()=>{R.shortcuts=r,le(he._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!r,children:h?he._({id:"uIp8WL"}):he._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(_,{icon:"arrow-up-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(m,{id:"GS+Mus"})})]}),e("p",{class:"field-button",children:[e("input",{style:{width:"100%"},type:"text",value:c,readOnly:!0,onClick:p=>{if(p.target.value){p.target.select();try{navigator.clipboard.writeText(p.target.value),le(he._({id:"cWtH+v"}))}catch{le(he._({id:"yUWyHa"}))}}},dir:"auto"}),e("button",{type:"button",class:"plain2 small",disabled:!c,onClick:()=>{R.showQrCodeModal={text:c}},children:e(_,{icon:"qrcode",alt:he._({id:"gCX4Z9"})})}),R.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:l==="cloud-uploading",onClick:async()=>{d("cloud-uploading");const p=dt();try{const y=(await o.v1.accounts.relationships.fetch({id:[p]}))[0];if(y){const{note:w=""}=y;let k="";const b=JSON.stringify({v:"1",dt:Date.now(),data:c});/(.*)<\/phanpy-shortcuts-settings>/.test(w)?k=w.replace(/(.*)<\/phanpy-shortcuts-settings>/,`${b}`):k=`${w} ${b}`,le(he._({id:"fVybCv"})),await o.v1.accounts.$select(p).note.create({comment:k}),d("default"),le(he._({id:"5w02SH"}))}}catch{d("error"),le(he._({id:"aVsTYo"}))}},title:he._({id:"oivBcO"}),children:[e(_,{icon:"cloud"}),e(_,{icon:"arrow-up",size:"s"})]})]}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!c,onClick:()=>{try{navigator.clipboard.writeText(c),le(he._({id:"+Kq2vY"}))}catch{le(he._({id:"tFvxZF"}))}},children:[e(_,{icon:"clipboard"})," ",e("span",{children:e(m,{id:"he3ygx"})})]})," ",navigator?.share&&navigator?.canShare?.({text:c})&&e("button",{type:"button",class:"plain2",disabled:!c,onClick:()=>{try{navigator.share({text:c})}catch{alert(he._({id:"TtG3Uh"}))}},children:[e(_,{icon:"share"})," ",e("span",{children:e(m,{id:"Z8lGw6"})})]})," ",c.length>0&&e("small",{class:"insignificant ib",children:e(m,{id:"IPXOXm",values:{0:c.length}})})]}),!!c&&e("details",{children:[e("summary",{class:"insignificant",children:e("small",{children:e(m,{id:"e5E+WH"})})}),e("textarea",{style:{width:"100%"},rows:10,readOnly:!0,children:JSON.stringify(n.filter(Boolean),null,2)})]})]}),R.settings.shortcutSettingsCloudImportExport&&e("footer",{children:e("p",{children:[e(_,{icon:"cloud"})," ",e(m,{id:"Cxr3Kn"})]})})]})]})}bo(R,n=>{for(const[i,s,o,c]of n)/^show/i.test(s)&&!o&&Oi()});function rd(){const{_:n}=ce(),i=We(R),s=Wi(),o=en(),c=yi();return G(()=>{setTimeout(Kc,1e3)},[]),e(B,{children:[c&&!!i.showCompose&&e(Fe,{class:`solid ${i.composerState.minimized?"min":""}`,minimized:!!i.composerState.minimized,children:e(Hc,{replyToStatus:typeof i.showCompose!="boolean"?i.showCompose.replyToStatus:window.__COMPOSE__?.replyToStatus||null,replyMode:R.showCompose?.replyMode||window.__COMPOSE__?.replyMode||"all",editStatus:R.showCompose?.editStatus||window.__COMPOSE__?.editStatus||null,draftStatus:R.showCompose?.draftStatus||window.__COMPOSE__?.draftStatus||null,quoteStatus:R.showCompose?.quoteStatus||window.__COMPOSE__?.quoteStatus||null,sharedData:window.__SHARED_DATA__||null,onClose:a=>{const{newStatus:u,instance:l,type:d,scheduledAt:r}=a||{};R.showCompose=!1,window.__COMPOSE__=null,window.__SHARED_DATA__=null,u&&(R.reloadStatusPage++,r&&R.reloadScheduledPosts++,le({text:{post:n(r?{id:"IrX0sj"}:{id:"aTyHBW"}),reply:n(r?{id:"+38pse"}:{id:"lZdBKl"}),edit:n({id:"a5BN7l"})}[d||"post"],delay:1e3,duration:1e4,onClick:h=>{h.hideToast(),R.prevLocation=o,s(r?"/sp":l?`/${l}/s/${u.id}`:`/s/${u.id}`)}}))}})}),c&&!!i.showSettings&&e(Fe,{onClose:()=>{R.showSettings=!1},children:e(Ir,{onClose:()=>{R.showSettings=!1}})}),c&&!!i.showAccounts&&e(Fe,{onClose:()=>{R.showAccounts=!1},children:e(dr,{onClose:()=>{R.showAccounts=!1}})}),!!i.showAccount&&e(Fe,{onClose:()=>{R.showAccount=!1},children:e(el,{account:i.showAccount?.account||i.showAccount,instance:i.showAccount?.instance,onClose:({destination:a}={})=>{R.showAccount=!1}})}),!!i.showOpenLink&&e(Fe,{onClose:()=>{R.showOpenLink=!1},children:e(Il,{url:i.showOpenLink.url,linkText:i.showOpenLink.linkText,onClose:()=>{R.showOpenLink=!1}})}),c&&!!i.showDrafts&&e(Fe,{onClose:()=>{R.showDrafts=!1},children:e(tl,{onClose:()=>R.showDrafts=!1})}),!!i.showMediaModal&&e(Fe,{onClick:a=>{(a.target===a.currentTarget||a.target.classList.contains("media"))&&(R.showMediaModal=!1)},children:e(Qo,{mediaAttachments:i.showMediaModal.mediaAttachments,instance:i.showMediaModal.instance,index:i.showMediaModal.mediaIndex,statusID:i.showMediaModal.statusID,onClose:()=>{R.showMediaModal=!1}})}),c&&!!i.showShortcutsSettings&&e(Fe,{onClose:()=>{R.showShortcutsSettings=!1},children:e(od,{onClose:()=>R.showShortcutsSettings=!1})}),!!i.showGenericAccounts&&e(Fe,{onClose:()=>{R.showGenericAccounts=!1},children:e(sl,{instance:i.showGenericAccounts.instance,excludeRelationshipAttrs:i.showGenericAccounts.excludeRelationshipAttrs,postID:i.showGenericAccounts.postID,onClose:()=>R.showGenericAccounts=!1,blankCopy:i.showGenericAccounts.blankCopy})}),!!i.showMediaAlt&&e(Fe,{onClose:a=>{R.showMediaAlt=!1},children:e(rl,{alt:i.showMediaAlt.alt||i.showMediaAlt,lang:i.showMediaAlt?.lang,onClose:()=>{R.showMediaAlt=!1}})}),!!i.showEmbedModal&&e(Fe,{class:"solid",onClose:()=>{R.showEmbedModal=!1},children:e(il,{html:i.showEmbedModal.html,url:i.showEmbedModal.url,width:i.showEmbedModal.width,height:i.showEmbedModal.height,onClose:()=>{R.showEmbedModal=!1}})}),c&&!!i.showReportModal&&e(Fe,{onClose:()=>{R.showReportModal=!1},children:e(Yl,{account:i.showReportModal.account,post:i.showReportModal.post,onClose:()=>{R.showReportModal=!1}})}),!!i.showQrCodeModal&&e(Fe,{class:"solid",onClose:()=>{R.showQrCodeModal=!1},children:e(Bl,{text:i.showQrCodeModal.text,arena:i.showQrCodeModal.arena,backgroundMask:i.showQrCodeModal.backgroundMask,caption:i.showQrCodeModal.caption,onClose:()=>{R.showQrCodeModal=!1},onScannerClick:i.showQrCodeModal.onScannerClick})}),!!i.showQrScannerModal&&e(Fe,{class:"solid",onClose:()=>{R.showQrScannerModal=!1},children:e(Kl,{checkValidity:i.showQrScannerModal.checkValidity,actionableText:i.showQrScannerModal.actionableText,onClose:(...a)=>{i.showQrScannerModal.onClose&&i.showQrScannerModal.onClose(...a),R.showQrScannerModal=!1}})}),c&&!!i.showImportExportAccounts&&e(Fe,{onClose:()=>{R.showImportExportAccounts=!1},children:e(cl,{onClose:()=>{R.showImportExportAccounts=!1},exportDisabled:typeof i.showImportExportAccounts=="object"?i.showImportExportAccounts.exportDisabled:!1})})]})}const bn=(n,i)=>{He(`g>${n}`,s=>{document.querySelector("#modal-container > *")||s.metaKey||s.ctrlKey||s.altKey||i(s)},{useKey:!0})},ld=ut(function(){const i=Wi();return bn("h",()=>i("/")),bn("n",()=>i("/notifications")),bn("s",()=>{R.showSettings=!0}),bn("p",()=>{const s=ln();if(s){const{instanceURL:o}=s,{id:c}=s.info;i(`/${o}/a/${c}`)}}),bn("b",()=>i("/b")),null});function Ui({accountID:n,onChange:i}){const{_:s}=ce(),{masto:o}=oe(),[c,a]=$("default"),[u,l]=$(null),[d,r]=$(null),h=d!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:c==="loading"||h,onClick:()=>{a("loading"),l("accept"),(async()=>{try{const f=await o.v1.followRequests.$select(n).authorize();if(!f?.followedBy)throw new Error("Follow request not accepted");r(f),i()}catch{}a("default")})()},children:e(m,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:c==="loading"||h,class:"light danger",onClick:()=>{a("loading"),l("reject"),(async()=>{try{const f=await o.v1.followRequests.$select(n).reject();if(f?.followedBy)throw new Error("Follow request not rejected");r(f),i()}catch{a("default")}})()},children:e(m,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:h&&u?u==="accept"?e(_,{icon:"check-circle",alt:s({id:"bzMKg7"}),class:"follow-accepted"}):e(_,{icon:"x-circle",alt:s({id:"ekCRTP"}),class:"follow-rejected"}):e(qe,{hidden:c!=="loading"})})]})}const Ys={mention:"comment",status:"notification",reblog:"rocket",follow:"follow",follow_request:"follow-add",favourite:"heart",poll:"poll",update:"pencil","admin.sign_up":"account-edit","admin.report":"account-warning",severed_relationships:"heart-break",moderation_warning:"alert",emoji_reaction:"emoji2","pleroma:emoji_reaction":"emoji2",annual_report:"celebrate",quote:"quote",quoted_update:"pencil"};function Ws({account:n,emoji:i,emojiURL:s}){let o,c;typeof s=="string"?o=s:(o=s?.url,c=s?.staticUrl);const a=o?e(ga,{url:o,staticUrl:c,alt:i}):i;return e(m,{id:"i5uN6K",values:{account:n,emojiObject:a}})}const Li={status:({account:n})=>e(m,{id:"idiIxW",values:{account:n}}),reblog:({count:n,account:i,postsCount:s,postType:o,components:{Subject:c}})=>e(m,{id:"jkt9P5",values:{0:Ke(n),1:Ke(n),count:n,postsCount:s,postType:o,account:i},components:{0:e(c,{clickable:n>1}),1:e("span",{title:n}),2:e(c,{clickable:n>1}),3:e("span",{title:n})}}),follow:({account:n,count:i,components:{Subject:s}})=>e(m,{id:"+71G9C",values:{0:Ke(i),count:i,account:n},components:{0:e(s,{clickable:i>1}),1:e("span",{title:i})}}),follow_request:({account:n})=>e(m,{id:"eh6NHW",values:{account:n}}),favourite:({account:n,count:i,postsCount:s,postType:o,components:{Subject:c}})=>e(m,{id:"RqX1mR",values:{0:Ke(i),1:Ke(i),count:i,postsCount:s,postType:o,account:n},components:{0:e(c,{clickable:i>1}),1:e("span",{title:i}),2:e(c,{clickable:i>1}),3:e("span",{title:i})}}),poll:()=>he._({id:"kIlJaS"}),"poll-self":()=>he._({id:"kpjzdN"}),"poll-voted":()=>he._({id:"moT7M8"}),update:({account:n})=>n?e(m,{id:"W+eFn3",values:{account:n}}):he._({id:"uzt17m"}),"favourite+reblog":({count:n,account:i,postsCount:s,postType:o,components:{Subject:c}})=>e(m,{id:"NunZZQ",values:{0:Ke(n),1:Ke(n),count:n,postsCount:s,postType:o,account:i},components:{0:e(c,{clickable:n>1}),1:e("span",{title:n}),2:e(c,{clickable:n>1}),3:e("span",{title:n})}}),quoted_update:({account:n})=>e(m,{id:"pkB7ti",values:{account:n}}),"admin.sign_up":({account:n,count:i,components:{Subject:s}})=>e(m,{id:"eDkKRi",values:{0:Ke(i),count:i,account:n},components:{0:e(s,{clickable:i>1}),1:e("span",{title:i})}}),"admin.report":({account:n,targetAccount:i})=>e(m,{id:"eNfCmq",values:{account:n,targetAccount:i}}),severed_relationships:({name:n})=>e(m,{id:"Xl9v6+",values:{name:n},components:{0:e("i",{})}}),moderation_warning:()=>e("b",{children:e(m,{id:"YqffEv"})}),emoji_reaction:Ws,"pleroma:emoji_reaction":Ws,annual_report:({year:n})=>e(m,{id:"INLTzH",values:{year:n}})},dd={account_suspension:({from:n,targetName:i})=>e(m,{id:"uRkcgw",values:{from:n,targetName:i},components:{0:e("i",{}),1:e("i",{})}}),domain_block:({from:n,targetName:i,followersCount:s,followingCount:o})=>e(m,{id:"Q3yArs",values:{from:n,targetName:i,followersCount:s,followingCount:o},components:{0:e("i",{}),1:e("i",{})}}),user_domain_block:({targetName:n,followersCount:i,followingCount:s})=>e(m,{id:"RQKWUa",values:{targetName:n,followersCount:i,followingCount:s},components:{0:e("i",{})}})},ud={none:{id:"ipnHrn"},disable:{id:"jw0eSZ"},mark_statuses_as_sensitive:{id:"v9jO+F"},delete_statuses:{id:"raUMBQ"},sensitive:{id:"w2OpMr"},silence:{id:"mlycBx"},suspend:{id:"Fz4lZ1"}},$i=30;function hd({notification:n,instance:i,isStatic:s,disableContextMenu:o}){const{_:c}=ce(),{masto:a}=oe(),{id:u,status:l,account:d,report:r,event:h,moderation_warning:f,annualReport:p,_ids:g,_accounts:y,_statuses:w,_groupKeys:k,sampleAccounts:b,notificationsCount:S,groupKey:x,_notificationsCount:C,_sampleAccountsCount:T}=n;let{type:v}=n;if((v==="mention"||v==="quote")&&!l)return null;const I=l?.reblog||l,L=I?.id,E=dt(),F=E===d?.id,O=l?.poll?.voted,H=!!l?.inReplyToAccountId&&l?.inReplyToAccountId!==E&&l?.account?.id===E;let Q=0,re=0;if(v==="favourite+reblog"){if(y)for(const q of y)q._types?.includes("favourite")&&Q++,q._types?.includes("reblog")&&re++;!re&&Q&&(v="favourite"),!Q&&re&&(v="reblog")}let Z;v==="poll"?Z=Li[F?"poll-self":O?"poll-voted":"poll"]:Li[v]?Z=Li[v]:Z=he._({id:"ODqZt1",values:{type:v}});const J=({clickable:q,...V})=>q?e("b",{tabIndex:"0",onClick:me,...V}):e("b",{...V}),Y=S>0&&S>b?.length,W=Y?"remote":"local";if(typeof Z=="function"){const q=(v==="favourite"||v==="reblog"||v==="admin.sign_up")&&S?Y?S:b?.length:y?.length||b?.length||(d?1:0),V=w?.length||(l?1:0);if(v==="admin.report"){const fe=r?.targetAccount;fe&&(Z=Z({account:e(yt,{account:d,showAvatar:!0}),targetAccount:e(yt,{account:fe,showAvatar:!0})}))}else if(v==="severed_relationships"){const fe=h?.targetName;fe&&(Z=Z({name:fe}))}else if((v==="emoji_reaction"||v==="pleroma:emoji_reaction")&&n.emoji){const fe=n.emoji_url||l?.emojis?.find?.(_e=>_e?.shortcode===n.emoji.replace(/^:/,"").replace(/:$/,""));Z=Z({account:e(yt,{account:d,showAvatar:!0}),emoji:n.emoji,emojiURL:fe})}else v==="annual_report"?Z=Z({...n.annualReport}):Z=Z({account:d?e(yt,{account:d,showAvatar:!0}):b?.[0]&&e(yt,{account:b[0],showAvatar:!0}),count:q,postsCount:V,postType:H?"reply":"post",components:{Subject:J}})}const N=n.createdAt&&new Date(n.createdAt).toLocaleString(),te={"favourite+reblog":he._({id:"+XOeb+"}),favourite:he._({id:"LQFF6J"}),reblog:he._({id:"phQpSa"}),follow:he._({id:"Ih01jh"})}[v]||he._({id:"bPwFdf"}),ee=(v==="favourite+reblog"||v==="favourite"||v==="reblog"||v==="admin.sign_up")&&W==="remote",me=()=>{ee?R.showGenericAccounts={heading:te,accounts:y,fetchAccounts:async()=>{const q=await Promise.allSettled(k.map(async fe=>{const _e=a.v2.notifications.$select(fe).accounts.list().values();return[fe,(await _e.next()).value]})),V=[];for(const fe of q){const[_e,Pe]=fe.value,Oe=/^favourite/.test(_e)?"favourite":/^reblog/.test(_e)?"reblog":null;for(const ae of Pe){const Se=V.find(ge=>ge.id===ae.id);Se&&Oe?Se._types.push(Oe):(Oe&&(ae._types=[Oe]),V.push(ae))}}return{done:!0,value:V}},showReactions:v==="favourite+reblog",postID:pt(L,i)}:R.showGenericAccounts={heading:te,accounts:y,showReactions:v==="favourite+reblog",excludeRelationshipAttrs:v==="follow"?["followedBy"]:[],postID:pt(L,i)}};if(l?.filtered){const q=l?.account?.id===E,V=Zt(l.filtered,"notifications");if(!F&&!q&&V?.action==="hide")return null}const be=q=>{q.shiftKey};return e("div",{class:`notification notification-${v}`,"data-notification-id":g||u,"data-group-key":k?.join(" ")||x,tabIndex:"0",onMouseEnter:be,children:[e("div",{class:`notification-type notification-${v}`,title:N,children:v==="favourite+reblog"?e(B,{children:[e(_,{icon:"rocket",size:"xl",alt:v,class:"reblog-icon"}),e(_,{icon:"heart",size:"xl",alt:v,class:"favourite-icon"})]}):v==="mention+quote"?e(B,{children:[e(_,{icon:"comment",size:"xl",alt:v,class:"mention-icon"}),e(_,{icon:"quote",size:"xl",alt:v,class:"quote-icon"})]}):e(_,{icon:Ys[v]||"notification",size:"xl",alt:v})}),e("div",{class:"notification-content",children:[v!=="mention"&&v!=="quote"&&v!=="mention+quote"&&e(B,{children:[e("p",{children:Z}),v==="follow_request"&&e(Ui,{accountID:d.id}),v==="severed_relationships"&&e("div",{children:[dd[h.type]({from:i,...h}),e("br",{}),e("a",{href:`https://${i}/severed_relationships`,target:"_blank",rel:"noopener",children:e(m,{id:"YL6Y8P",components:{0:e(_,{icon:"external",size:"s"})}})}),"."]}),v==="moderation_warning"&&!!f&&e("div",{children:[c(ud[f.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${f.id}`,target:"_blank",rel:"noopener",children:e(m,{id:"YL6Y8P",components:{0:e(_,{icon:"external",size:"s"})}})})]}),v==="annual_report"&&e("div",{children:e(pe,{to:`/annual_report/${p?.year}`,children:e(m,{id:"5PGPvG"})})})]}),y?.length>1&&e("p",{class:"avatars-stack",children:[y.slice(0,$i).map(q=>e(B,{children:[e("a",{href:q.url,rel:"noopener",class:"account-avatar-stack",onClick:V=>{V.preventDefault(),R.showAccount=q},children:[e(lt,{url:q.avatarStatic,size:y.length<=10?"xxl":y.length<20?"xl":"l",alt:`${q.displayName} @${q.acct}`,squircle:q?.bot},q.id),v==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:q._types.map(V=>e(_,{icon:Ys[V],size:"s",class:`${V}-icon`}))})]},q.id)," "]},q.id)),ee?e("button",{type:"button",class:"small plain","data-group-keys":k?.join(" "),onClick:me,children:["+",(v==="favourite"||v==="reblog"||v==="admin.sign_up")&&S-y.length,e(_,{icon:"chevron-down"})]}):e("button",{type:"button",class:"small plain",onClick:me,children:[y.length>$i&&`+${y.length-$i}`,e(_,{icon:"chevron-down"})]})]}),!y?.length&&b?.length>1&&e("p",{class:"avatars-stack",children:[b.map(q=>e(B,{children:[e("a",{href:q.url,rel:"noopener",class:"account-avatar-stack",onClick:V=>{V.preventDefault(),R.showAccount=q},children:e(lt,{url:q.avatarStatic,size:"xxl",alt:`${q.displayName} @${q.acct}`,squircle:q?.bot},q.id)},q.id)," "]},q.id)),S>b.length&&l?.id&&e(pe,{to:i?`/${i}/s/${l.id}`:`/s/${l.id}`,class:"button small plain centered",children:["+",S-b.length,e(_,{icon:"chevron-right"})]})]}),w?.length>1&&e("ul",{class:"notification-group-statuses",children:w.map(q=>e("li",{children:e(Gs,{class:`status-link status-type-${v}`,to:i?`/${i}/s/${q.id}`:`/s/${q.id}`,children:e(je,{status:q,size:"s",previewMode:!0,allowContextMenu:!0,allowFilters:!0})})},q.id))}),l&&(!w?.length||w?.length<=1)&&e(Gs,{class:`status-link status-type-${v}`,to:i?`/${i}/s/${L}`:`/s/${L}`,onContextMenu:o?void 0:q=>{const V=q.target.querySelector(".status");if(V){if(q.metaKey)return;q.preventDefault(),V.dispatchEvent(new MouseEvent("contextmenu",{clientX:q.clientX,clientY:q.clientY}))}},children:s?e(je,{status:I,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0}):e(je,{statusID:L,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0})})]})]})}function Gs(n){const{_:i}=ce(),s=ya();return e(pe,{...n,"data-read-more":i({id:"8fZueG"}),ref:s})}const En=ut(hd,(n,i)=>n.notification?.id===i.notification?.id);"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",n=>{const{type:i,id:s,accessToken:o}=n?.data||{};i==="notification"&&(R.routeNotification={id:s,accessToken:o})});const fd=ut(function(){const{_:i}=ce();if(!("serviceWorker"in navigator))return null;const s=We(R),{routeNotification:o}=s,{id:c,accessToken:a}=o||{},[u,l]=$(!1);_t(()=>{if(!c||!a)return;const{instance:r}=oe(),{masto:h,instance:f}=oe({accessToken:a}),p=r===f,g=a?jc(a):ln();(async()=>{const y=await h.v1.notifications.$select(c).fetch();if(y&&g){const w=g.instanceURL,{type:k,status:b,account:S}=y,x=!!document.querySelector("#modal-container > *"),C=k==="follow"&&!!S?.id,T=!!S?.id,v=!!b?.id;C&&p?R.showAccount={account:S,instance:w}:x||!p||T&&v?l({id:c,account:g,notification:y,sameInstance:p}):v?location.hash=`/${r}/s/${b.id}`:C?location.hash=`/${r}/a/${S.id}`:location.hash="/notifications"}})()},[c,a]),_t(()=>{navigator?.clearAppBadge&&navigator.clearAppBadge()},[]),un(r=>{r&&navigator?.clearAppBadge&&navigator.clearAppBadge()});const d=()=>{l(!1),R.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(u){const{id:r,account:h,notification:f,sameInstance:p}=u;return e(Fe,{onClick:g=>{g.target===g.currentTarget&&d()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:d,children:e(_,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(m,{id:"5+87Pq"})})}),e("main",{children:[!p&&e("p",{children:e(m,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:g=>{const{target:y}=g;(g.target.tagName==="BUTTON"||g.target.tagName==="A")&&d()},children:e(En,{instance:h.instanceURL,notification:f,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(pe,{to:"/notifications",class:"button light",onClick:d,children:[e("span",{children:e(m,{id:"/WA/tl"})})," ",e(_,{icon:"arrow-right"})]})})]})]})})}return null}),Si=({limit:n}={})=>{const i=ke.account.get("searchHistory")||[];return n?i.slice(0,n):i},pd=10,Gn=(n,i=null)=>{if(!n?.trim?.())return;const s=Si(),o=s.findIndex(a=>a.query===n&&a.queryType===i);o!==-1&&s.splice(o,1),s.unshift({query:n.trim(),queryType:i,timestamp:Date.now()});const c=s.slice(0,pd);ke.account.set("searchHistory",c)},md=(n,i=null)=>{const o=Si().filter(c=>!(c.query===n&&c.queryType===i));ke.account.set("searchHistory",o)},gd=()=>{ke.account.set("searchHistory",[])},Vt=(n,i,s)=>{let o,c,a;if(i==="statuses")o=e(m,{id:"o1mMWT",values:{query:n},components:{0:e("q",{})}}),c=`/search?q=${encodeURIComponent(n)}&type=statuses`,a="document";else if(i==="accounts")o=e(m,{id:"cDoNQr",values:{query:n},components:{0:e("q",{})}}),c=`/search?q=${encodeURIComponent(n)}&type=accounts`,a="group";else if(i==="hashtags"){const[,u="#",l=n]=n.match(/^([##])?(.*)$/),d=`${u}${l}`;o=e(m,{id:"mFfcu0",values:{hashtag:d},components:{0:e("mark",{})}}),c=`/${s}/t/${l}`,a="hashtag"}else o=e(m,{id:"48oDit",values:{query:n},components:{0:e("small",{class:"insignificant"})}}),c=`/search?q=${encodeURIComponent(n)}`,a="search";return{label:o,to:c,icon:a}},lc=Vc((n,i)=>{const{_:s}=ce(),{instance:o}=oe(),[c,a]=xt(),[u,l]=$(!1),[d,r]=$(c.get("q")||""),h=c.get("type"),f=j(null),p=j(null);Yc(i,()=>({setValue:w=>{r(w)},focus:()=>{p.current.focus()},select:()=>{p.current.select()},blur:()=>{p.current.blur()}}));const g=xe(()=>Si({limit:5}),[n?.hidden]),y=xe(()=>{if(!d)return[];const k=g.filter(S=>S.query===d?!1:S.query.toLowerCase().includes(d.toLowerCase())).slice(0,2).map(S=>({...Vt(S.query,S.queryType,o),queryType:S.queryType,isRecentSearch:!0,historyItem:S}));return[{...Vt(d,null,o),top:!h&&!/\s/.test(d),hidden:!!h},...k,{...Vt(d,"statuses",o),hidden:/^https?:/.test(d),top:/\s/.test(d),queryType:"statuses"},{...Vt(d,"hashtags",o),hidden:/^[@@]/.test(d)||/^https?:/.test(d)||/\s/.test(d),top:/^[##]/.test(d),type:"link",queryType:"hashtags"},{label:e(m,{id:"gEoOUj",values:{query:d},components:{0:e("mark",{})}}),to:`/${d}`,hidden:!/^https?:/.test(d),top:/^https?:/.test(d),type:"link",icon:"arrow-right"},{...Vt(d,"accounts",o),queryType:"accounts"}].sort((S,x)=>{if(h){if(S.queryType===h)return-1;if(x.queryType===h)return 1}return S.top&&!x.top?-1:!S.top&&x.top?1:0}).filter(({hidden:S})=>!S)},[d,h,o]);return e("form",{ref:f,class:"search-popover-container",onSubmit:w=>{if(w.preventDefault(),/\/search/.test(location.hash))if(d){const b={q:d};h&&(b.type=h),a(b)}else a({});else d?location.hash=`/search?q=${encodeURIComponent(d)}${h?`&type=${h}`:""}`:location.hash="/search";Gn(d,h),n?.onSubmit?.(w)},children:[e("input",{ref:p,value:d,name:"q",type:"search",placeholder:s({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",enterKeyHint:"search",onSearch:w=>{w.target.value||a({})},onInput:w=>{r(w.target.value),l(!0)},onFocus:()=>{l(!0);const w=f.current?.querySelector(".search-popover-item");w&&w.classList.add("focus")},onBlur:()=>{setTimeout(()=>{l(!1)},100),f.current?.querySelector(".search-popover-item.focus")?.classList.remove("focus")},onKeyDown:w=>{const{key:k}=w;switch(k){case"Escape":l(!1);break;case"Down":case"ArrowDown":if(w.preventDefault(),u){const b=f.current.querySelector(".search-popover-item.focus");if(b){let S=b.nextElementSibling;for(;S&&S.hidden;)S=S.nextElementSibling;S&&(S.classList.add("focus"),Array.from(S.parentElement.children).filter(C=>C!==S).forEach(C=>{C.classList.remove("focus")}))}else{const S=f.current.querySelector(".search-popover-item");S&&S.classList.add("focus")}}break;case"Up":case"ArrowUp":if(w.preventDefault(),u){const b=document.querySelector(".search-popover-item.focus");if(b){let S=b.previousElementSibling;for(;S&&S.hidden;)S=S.previousElementSibling;S&&(S.classList.add("focus"),Array.from(S.parentElement.children).filter(C=>C!==S).forEach(C=>{C.classList.remove("focus")}))}else{const S=document.querySelectorAll(".search-popover-item"),x=S[S.length-1];x&&x.classList.add("focus")}}break;case"Enter":if(u){const b=document.querySelector(".search-popover-item.focus");b&&(w.preventDefault(),b.click()),l(!1),n?.onSubmit?.(w)}break}}}),e("div",{class:"search-popover",hidden:!u,children:[!d&&g.length>0&&e("div",{class:"search-popover-recent-searches",children:[e("div",{class:"search-popover-header",children:[e(_,{icon:"history",size:"s"}),e(m,{id:"4R1B1H"})]}),g.map((w,k)=>{const{label:b,to:S,icon:x}=Vt(w.query,w.queryType,o);return e(pe,{to:S,class:`search-popover-item ${k===0?"focus":""}`,onClick:C=>{Gn(w.query,w.queryType),n?.onSubmit?.(C)},children:[e(_,{icon:x,class:"more-insignificant"}),e("span",{children:b})]},`${w.query}-${w.queryType}-${w.timestamp}`)}),e(pe,{to:"/search",class:"search-popover-item search-history-see-all",children:[e(_,{icon:"more2",class:"more-insignificant"}),e("span",{children:e(m,{id:"gukqfD"})})]})]}),y.map(({label:w,to:k,icon:b,queryType:S,isRecentSearch:x,historyItem:C},T)=>e(pe,{to:k,class:`search-popover-item ${x?"search-popover-item-recent":""} ${T===0?"focus":""}`,onClick:v=>{x||Gn(d,S),n?.onSubmit?.(v)},children:[e(_,{icon:b,class:"more-insignificant"}),e("span",{children:w})]},x?`recent-${C.query}-${C.queryType}-${C.timestamp}`:`suggestion-${S||"general"}-${T}`))]})]})}),yd=ut(function({onClose:i=()=>{}}){const s=We(R),[o,c]=$(!1),a=j(null);G(()=>{if(s.showSearchCommand){const{query:d}=s.showSearchCommand;c(!0),setTimeout(()=>{d&&a.current?.setValue?.(d),a.current?.focus?.()},150),R.showSearchCommand=!1}},[s.showSearchCommand]),He(["Slash","/"],d=>{c(!0),setTimeout(()=>{a.current?.focus?.(),a.current?.select?.()},0)},{useKey:!0,preventDefault:!0,ignoreEventWhen:d=>{const r=/\/search/.test(location.hash),h=/\/yip/.test(location.hash),f=!!document.querySelector("#modal-container > *");return r||h||f||d.metaKey||d.ctrlKey||d.altKey||d.shiftKey}});const u=()=>{c(!1),i()};He("esc",d=>{a.current?.blur?.(),u()},{enabled:o,enableOnFormTags:!0,preventDefault:!0,useKey:!0,ignoreEventWhen:d=>d.metaKey||d.ctrlKey||d.altKey||d.shiftKey});const l=!o;return e("div",{id:"search-command-container",hidden:l,onClick:d=>{d.target===d.currentTarget&&u()},children:e(lc,{ref:a,hidden:l,onSubmit:()=>{u()}})})});function Zs({lists:n}){return e(B,{children:[e(Ve,{to:"/l",children:e("span",{children:e(m,{id:"BHWx+g"})})}),e(Ye,{}),n?.map(i=>e(Ve,{to:`/l/${i.id}`,children:e("span",{children:[i.title,i.exclusive&&e(B,{children:[" ",e(Jt,{})]})]})},i.id))]})}function vd(){const{_:n,_:i}=ce(),{instance:s}=oe(),o=We(R),{shortcuts:c,settings:a}=o;if(!c.length)return null;const u=a.shortcutsViewMode==="multi-column"||!a.shortcutsViewMode&&a.shortcutsColumnsMode,l=j(),d=j(),r=j(!1),h=c.map((C,T)=>{const{type:v,...I}=C;if(!li[v])return null;let{id:L,path:E,title:F,subtitle:O,icon:H,altIcon:Q}=li[v];return typeof L=="function"&&(L=L(I,T)),typeof E=="function"&&(E=E({...I,instance:I.instance||s},T)),typeof F=="function"?F=F(I,T):F?.id&&(F=i(F)),typeof O=="function"?O=O(I,T):O?.id&&(O=i(O)),typeof H=="function"&&(H=H(I,T)),typeof Q=="function"&&(Q=Q(I,T)),L==="lists"&&(r.current=!0),{id:L,path:E,title:F,subtitle:O,icon:H,altIcon:Q}}).filter(Boolean);G(()=>{if(o.settings.shortcutsViewMode==="tab-menu-bar"&&d.current){const C=setTimeout(()=>{const T=d.current?.querySelector(".is-active");T&&T.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},100);return()=>clearTimeout(C)}},[]);const f=Wi();He(["1","2","3","4","5","6","7","8","9"],C=>{const T=parseInt(C.key,10)-1;if(TC.metaKey||C.ctrlKey||C.altKey||C.shiftKey});const[p,g]=$([]),y=j(),w=j(),[k,b]=$(void 0);G(()=>{k==="open"&&fn().then(g)},[k]);const S=ii(()=>{b("open")},{threshold:600,detect:"touch",cancelOnMovement:!0}),x=ii(()=>{R.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0});return u?null:e("div",{id:"shortcuts",children:o.settings.shortcutsViewMode==="tab-menu-bar"?e(B,{children:[e("nav",{ref:d,class:"tab-bar",onContextMenu:C=>{C.preventDefault(),R.showShortcutsSettings=!0},children:e("ul",{children:h.map(({id:C,path:T,title:v,subtitle:I,icon:L,altIcon:E},F)=>{const O=C==="lists"?{ref:w,onContextMenu(H){H.preventDefault(),H.stopPropagation(),b("open")},...S()}:C==="profile"?{onContextMenu(H){H.preventDefault(),H.stopPropagation(),R.showAccounts=!0},...x()}:{};return e("li",{children:e(pe,{class:I?"has-subtitle":"",to:T,onClick:H=>{if(H.target.classList.contains("is-active")){H.preventDefault();const Q=document.getElementById(`${C}-page`);if(Q){Q.scrollTop=0;const re=Q.querySelector(".updates-button");re&&re.click()}}},...O,children:[E?.url?E?.type==="avatar"?e(lt,{staticUrl:E.url,size:"l"}):e("img",{src:E.url,alt:"",class:"shortcut-icon",loading:"lazy",decoding:"async",fetchPriority:"low"}):e(_,{icon:L,size:"xl"}),e("span",{children:[e(Yn,{children:v}),I&&e(B,{children:[e("br",{}),e("small",{children:I})]})]})]})},`${F}-${C}-${v}-${I}-${T}`)})})}),e(pi,{ref:y,state:k,anchorRef:w,onClose:()=>{b(void 0)},overflow:"auto",viewScroll:"close",gap:4,boundingBoxPadding:Ji(),portal:{target:document.body},children:e(Zs,{lists:p})})]}):e(mt,{instanceRef:l,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:C=>{C.open&&r.current&&fn().then(g)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:C=>{C.preventDefault(),R.showShortcutsSettings=!0},onTransitionStart:C=>{try{const{target:T}=C;getComputedStyle(T).pointerEvents==="none"&&l.current?.closeMenu?.()}catch{}},children:e(_,{icon:"shortcut",size:"xl",alt:n({id:"CTqTgr"})})}),children:h.map(({id:C,path:T,title:v,subtitle:I,icon:L},E)=>C==="lists"?e(Rn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(B,{children:[e(_,{icon:L,size:"l"}),e("span",{class:"menu-grow",children:e(Yn,{children:v})}),e(_,{icon:"chevron-right"})]}),children:e(Zs,{lists:p})}):e(Ve,{to:T,class:"glass-menu-item",children:[e(_,{icon:L,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(Yn,{children:v})}),I&&e(B,{children:[" ",e("small",{class:"more-insignificant",children:I})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:E+1})]},`${E}-${C}-${v}-${I}-${T}`))})})}const bd=ut(vd);const Xs=80;function wd({account:n,instance:i}){const{_:s}=ce();if(!n)return null;const{followersCount:o,followingCount:c,statusesCount:a,id:u,hideCollections:l}=n,d=i?`/${i}/a/${u}`:`/a/${u}`,{masto:r}=oe({instance:i}),h=j();async function f(y){return u?((y||!h.current)&&(h.current=r.v1.accounts.$select(u).followers.list({limit:Xs}).values()),await h.current.next()):{value:[],done:!0}}const p=j();async function g(y){return u?((y||!p.current)&&(p.current=r.v1.accounts.$select(u).following.list({limit:Xs}).values()),await p.current.next()):{value:[],done:!0}}return e("div",{class:"account-container mini",children:e("div",{class:"account-metadata-box",children:e("div",{class:"stats",children:[e("div",{tabIndex:0,onClick:()=>{setTimeout(()=>{R.showGenericAccounts={id:"followers",heading:s({id:"x5LEuB"}),fetchAccounts:f,instance:i,blankCopy:l?s({id:"BRV/wh"}):void 0}},0)},children:e(m,{id:"TbttfX",values:{0:Ke(o),1:Ke(o),followersCount:o},components:{0:e("span",{title:o}),1:e("span",{title:o})}})}),e("div",{class:"insignificant",tabIndex:0,onClick:()=>{setTimeout(()=>{R.showGenericAccounts={heading:s({id:"following.stats"}),fetchAccounts:g,instance:i,blankCopy:l?s({id:"BRV/wh"}):void 0}},0)},children:e(m,{id:"SGcIK+",values:{0:Ke(c),followingCount:c},components:{0:e("span",{title:c})}})}),e(pe,{class:"insignificant",to:d,children:e(m,{id:"C4x3+X",values:{0:Ke(a),1:Ke(a),statusesCount:a},components:{0:e("span",{title:a}),1:e("span",{title:a})}})})]})})})}function kd(n){let i=[],s=[],o=0;for(let c=0;c10&&(s.length>n.length/4||o>=3)){const c=s.map(a=>a.id);if(s.length>n.length*3/4)i=[...i,{id:c,items:s,type:"boosts"}];else{const a=Math.floor(i.length/2);i=[...i.slice(0,a),{id:c,items:s,type:"boosts"},...i.slice(a)]}return i}else return n}function Qs(n,i){const s=ke.account.get("boostedStatusIDs")||{},o=n.filter(a=>{if(!a.reblog)return!0;const u=`${i}-${a.reblog.id}`,l=s[u];return l&&l!==a.id?!1:(s[u]=a.id,!0)}),c=Object.keys(s);return c.length>50&&c.slice(0,c.length-50).forEach(a=>{delete s[a]}),ke.account.set("boostedStatusIDs",s),o}function Sd(n,i){if(!i)return n;const s=dt();return n.filter(o=>{if(!o?.filtered)return!0;const c=o?.account?.id===s,a=Zt(o.filtered,i);return!(!c&&a?.action==="hide")})}function Cd(n,i){const s=[];let o=0;n.forEach(l=>{for(let r=0;rh.id===l.id))return;if(s[r].find(h=>h.id===l.inReplyToId)||s[r].find(h=>h.inReplyToId===l.id)){s[r].push(l);return}}const d=n.find(r=>r.id===l.inReplyToId);d&&(s[o++]=[l,d])});for(let l=0;ls[d].includes(h))&&(s[l]=[...s[l],...s[d]],s[l]=s[l].filter((h,f,p)=>p.findIndex(g=>g.id===h.id)===f),s.splice(d,1),d--);s.forEach(l=>{l.sort((d,r)=>!d.inReplyToId&&!r.inReplyToId?Date.parse(d.createdAt)-Date.parse(r.createdAt):d.inReplyToId===r.id?1:r.inReplyToId===d.id||!d.inReplyToId?-1:r.inReplyToId?Date.parse(d.createdAt)-Date.parse(r.createdAt):1)}),s.forEach(l=>{const d=l[0].account.id;l.forEach(r=>{r.account.id!==d&&(r._differentAuthor=!0)})}),s.length;const c=[],a=[],u=[];return n.forEach(l=>{if(l.reblog){c.push(l);return}for(let d=0;dr.id===l.id)){if(a.includes(d))return;const r=s[d];r.sort((f,p)=>Date.parse(f.createdAt)-Date.parse(p.createdAt));const h=r[0].account.id;c.push({id:r.map(f=>f.id),items:r,type:r.every(f=>f.account.id===h)?"thread":"conversation"}),a.push(d);return}if(l.inReplyToId&&l.inReplyToAccountId!==l.account.id){const d=pt(l.id,i);R.statusReply[d]||u.push({sKey:d,inReplyToId:l.inReplyToId})}c.push(l)}),u?.length&&queueMicrotask(()=>{const{masto:l}=oe({instance:i});async function d(){for(let r=0;rsetTimeout(g,1e3))}catch{}}}if(Xe("@mastodon/fetch-multiple-statuses")){const r=u.map(({inReplyToId:h})=>h);(async()=>{try{const h=await l.v1.statuses.list({id:r});if(h?.length)for(const f of h){Je(f,i,{skipThreading:!0});const p=u.find(({inReplyToId:g})=>g===f.id)?.sKey;p&&(R.statusReply[p]={id:f.id,instance:i})}else d()}catch{d()}})()}else d()}),c}const _d=It((n,i)=>i.v1.statuses.$select(n).fetch());async function dc(n,i){const s=await td();if(!s.length)return;const{statusFollowedTags:o}=R,c=[];if(n.forEach(a=>{if(a.reblog)return;const{id:u,content:l,tags:d=[]}=a,r=pt(u,i);if(o[r]?.length)return;const h=nd(l);if(!h.length&&!d.length)return;const f=s.reduce((p,g)=>((h.some(y=>y.toLowerCase()===g.name.toLowerCase())||d.some(y=>y.name.toLowerCase()===g.name.toLowerCase()))&&p.push(g.name),p),[]);f.length&&c.push({item:a,sKey:r,followedTags:f})}),c.length){const a=c.map(l=>l.item.account),u=await dn(a);if(!u)return;c.forEach(l=>{const{item:d,sKey:r,followedTags:h}=l,f=u[d.account.id];f&&!f.following&&(o[r]=h)})}}function Id(){R.statusFollowedTags={}}function xd({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:s=1,scrollThresholdStart:o=10,scrollThresholdEnd:c=10,direction:a="vertical",distanceFromStartPx:u,distanceFromEndPx:l}={}){const[d,r]=$(null),[h,f]=$(!1),[p,g]=$(!1),[y,w]=$(!1),[k,b]=$(!1),S=a==="vertical";return _t(()=>{const x=n.current;if(!x)return{};let C=S?x.scrollTop:x.scrollLeft;function T(){const{scrollTop:v,scrollLeft:I,scrollHeight:L,scrollWidth:E,clientHeight:F,clientWidth:O}=x,H=S?v:I,Q=S?L:E,re=S?F:O,Z=Math.abs(H-C),J=u||Math.min(re*i,Q,H),Y=l||Math.min(re*s,Q,Q-H-re);Z>=(C=Q),w(H<=J),b(H+re>=Q-Y)}return x.addEventListener("scroll",T,{passive:!0}),()=>x.removeEventListener("scroll",T)},[i,s,o,c]),{scrollDirection:d,reachStart:h,reachEnd:p,nearReachStart:y,nearReachEnd:k,init:()=>{n.current&&n.current.dispatchEvent(new Event("scroll"))}}}function Ad({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:s=1,scrollThresholdStart:o=10,scrollThresholdEnd:c=10,direction:a="vertical",distanceFromStartPx:u,distanceFromEndPx:l,init:d}={},r){if(!r)return;const h=a==="vertical",f=j(null),p=j(null),g=va(()=>{let y=!1,w=!1,k=!1,b=!1;const S=n.current,{scrollTop:x,scrollLeft:C,scrollHeight:T,scrollWidth:v,clientHeight:I,clientWidth:L}=S,E=h?x:C,F=h?T:v,O=h?I:L,H=E-f.current,Q=H>0,re=Q?c:o,Z=u||Math.min(O*i,F,E),J=l||Math.min(O*s,F,F-E-O);Math.abs(H)>=re&&(p.current=Q?"end":"start",f.current=E),y=E<=0,w=E+O>=F,k=E<=Z,b=E+O>=F-J,r({scrollDirection:p.current,reachStart:y,reachEnd:w,nearReachStart:k,nearReachEnd:b})},500,{leading:!1});return _t(()=>{const y=n.current;return y&&(f.current=y[h?"scrollTop":"scrollLeft"],y.addEventListener("scroll",g,{passive:!0})),()=>{y&&y.removeEventListener("scroll",g)}},[]),G(()=>{d&&n.current&&queueMicrotask(()=>{n.current.dispatchEvent(new Event("scroll"))})},[d]),{resetScrollDirection:()=>{p.current=null}}}function Td({class:n,statusID:i,status:s,instance:o,parent:c,onMediaClick:a}){const{_:u}=ce();let l=pt(i,o);const d=We(R);if(s||(s=d.statuses[l]||d.statuses[i],l=pt(s?.id,o)),!s)return null;const{account:{acct:r,avatar:h,avatarStatic:f,id:p,url:g,displayName:y,username:w,emojis:k,bot:b,group:S},id:x,repliesCount:C,reblogged:T,reblogsCount:v,favourited:I,favouritesCount:L,bookmarked:E,poll:F,muted:O,sensitive:H,spoilerText:Q,visibility:re,language:Z,editedAt:J,filtered:Y,card:W,createdAt:N,inReplyToId:te,inReplyToAccountId:ee,content:me,mentions:be,mediaAttachments:q,reblog:V,uri:fe,url:_e,emojis:Pe,_deleted:Oe,_pinned:ae}=s;if(!q?.length)return null;const Se=De=>{De.shiftKey},ge=xe(()=>dt(),[]),Re=xe(()=>ge&&ge===p,[p,ge]),Ne=yo(gi),Be=!Re&&Zt(Y,Ne);if(Be?.action==="hide")return null;const ze=H,Ce=(Vi()["reading:expand:media"]?.toLowerCase()||"default")==="show_all",se=c||"div";return q.map((De,$e)=>{const Ae=`${l}-${De.id}`,ne=Be?.titlesStr;return e(se,{"data-state-post-id":l,onMouseEnter:Se,"data-spoiler-text":Q||(H?u({id:"FKojeB"}):void 0),"data-filtered-text":Be?u(ne?{id:"7FGvtQ",values:{filterTitleStr:ne}}:{id:"03Qqf9"}):void 0,class:` media-post ${Be?"filtered":""} ${ze?"has-spoiler":""} ${Ce?"show-media":""} `,children:e(Ro,{class:n,media:De,lang:Z,to:`/${o}/s/${x}?media-only=${$e+1}`,onClick:a?Ue=>a(Ue,$e,De,s):void 0})},Ae)})}const Js=ut(Td);function Ed(n){const{_:i}=ce(),s=We(R),{masto:o,instance:c,authenticated:a}=oe(),[u,l]=xe(()=>{const T=rn();return[T.find(I=>I.info.id===dt())||T[0],T.length>1]},[]),d=s.settings.shortcutsViewMode==="tab-menu-bar"&&s.shortcuts.some(T=>T.type==="profile"),r=l&&!d,h=(s.settings.shortcutsViewMode==="multi-column"||!s.settings.shortcutsViewMode&&s.settings.shortcutsColumnsMode)&&!s.shortcuts.find(T=>T.type==="following"),f=ii(()=>{R.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),p=j(),[g,y]=$(void 0),w=Ji([0,0,s.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),k=j();async function b(T){return(T||!k.current)&&(k.current=o.v1.mutes.list({limit:80}).values()),await k.current.next()}const S=j();async function x(T){return(T||!S.current)&&(S.current=o.v1.blocks.list({limit:80}).values()),await S.current.next()}const C=j();return e(B,{children:[e("button",{ref:p,type:"button",class:`button plain nav-menu-button ${r?"with-avatar":""} ${g==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{C.current=Date.now(),y(T=>T?void 0:"open")},onContextMenu:T=>{T.preventDefault(),R.showAccounts=!0},...f(),children:[r&&e(lt,{url:u?.info?.avatar||u?.info?.avatarStatic,size:"l",squircle:u?.info?.bot}),e(_,{icon:"menu",size:r?"s":"l",alt:i({id:"zucql+"})})]}),e(pi,{menuClassName:"nav-menu",state:g,anchorRef:p,onClose:()=>{y(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-C.current<300}},portal:{target:document.body},...n,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:w,unmountOnClose:!0,children:[!!s.appVersion?.commitHash&&s.appVersion.commitHash!=="48b2cf7"&&e("div",{class:"top-menu",children:[e(ye,{onClick:()=>{confirm(i({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(_,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(m,{id:"95IFnD"})})]}),e(Ye,{})]}),e("section",{children:[e(Ve,{to:"/",children:[e(_,{icon:"home",size:"l"})," ",e("span",{children:e(m,{id:"i0qMbr"})})]}),a?e(B,{children:[h&&e(Ve,{to:"/following",children:[e(_,{icon:"following",size:"l"})," ",e("span",{children:e(m,{id:"following.title"})})]}),e(Ve,{to:"/catchup",children:[e(_,{icon:"history2",size:"l"}),e("span",{children:e(m,{id:"xrl8fj"})})]}),Xe("@mastodon/mentions")&&e(Ve,{to:"/mentions",children:[e(_,{icon:"at",size:"l"})," ",e("span",{children:e(m,{id:"/bZzdR"})})]}),e(Ve,{to:"/notifications",children:[e(_,{icon:"notification",size:"l"})," ",e("span",{children:e(m,{id:"iDNBZe"})}),s.notificationsShowNew&&e("sup",{title:i({id:"isRobC"}),style:{opacity:.5},children:[" ","•"]})]}),e(Ye,{}),u?.info?.id&&e(Ve,{to:`/${c}/a/${u.info.id}`,children:[e(_,{icon:"user",size:"l"})," ",e("span",{children:e(m,{id:"vERlcd"})})]}),e(Rd,{menuState:g}),e(Ve,{to:"/b",children:[e(_,{icon:"bookmark",size:"l"})," ",e("span",{children:e(m,{id:"7Ff7ia"})})]}),e(Rn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(B,{children:[e(_,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(m,{id:"24misb"})}),e(_,{icon:"chevron-right"})]}),children:[e(Ve,{to:"/f",children:[e(_,{icon:"heart",size:"l"})," ",e("span",{children:e(m,{id:"zZOZj7"})})]}),e(Ve,{to:"/fh",children:[e(_,{icon:"hashtag",size:"l"})," ",e("span",{children:e(m,{id:"Xi1/bw"})})]}),e(Ve,{to:"/sp",children:[e(_,{icon:"schedule",size:"l"})," ",e("span",{children:e(m,{id:"+GkIdc"})})]}),e(Ye,{}),Xe("@mastodon/filters")&&e(Ve,{to:"/ft",children:[e(_,{icon:"filters",size:"l"})," ",e("span",{children:e(m,{id:"cSev+j"})})]}),e(ye,{onClick:()=>{R.showGenericAccounts={id:"mute",heading:i({id:"sOKhEA"}),fetchAccounts:b,excludeRelationshipAttrs:["muting"]}},children:[e(_,{icon:"mute",size:"l"})," ",e("span",{children:e(m,{id:"n1sANU"})})]}),e(ye,{onClick:()=>{R.showGenericAccounts={id:"block",heading:i({id:"nL8nlr"}),fetchAccounts:x,excludeRelationshipAttrs:["blocking"]}},children:[e(_,{icon:"block",size:"l"})," ",e("span",{children:e(m,{id:"r3RRWo"})})]})," "]}),e(Ye,{}),e(ye,{onClick:()=>{R.showAccounts=!0},children:[e(_,{icon:"group",size:"l"})," ",e("span",{children:e(m,{id:"7e0O8Z"})})]})]}):e(B,{children:[e(Ye,{}),e(Ve,{to:"/login",children:[e(_,{icon:"user",size:"l"})," ",e("span",{children:e(m,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(Ye,{}),e(Ve,{to:"/search",children:[e(_,{icon:"search",size:"l"})," ",e("span",{children:e(m,{id:"A1taO8"})})]}),e(Ve,{to:`/${c}/trending`,children:[e(_,{icon:"chart",size:"l"})," ",e("span",{children:e(m,{id:"4/iCqx"})})]}),e(Ve,{to:`/${c}/p/l`,children:[e(_,{icon:"building",size:"l"})," ",e("span",{children:e(m,{id:"d5zxa4"})})]}),e(Ve,{to:`/${c}/p`,children:[e(_,{icon:"earth",size:"l"})," ",e("span",{children:e(m,{id:"4ERYY7"})})]}),a?e(B,{children:[e(Ye,{className:"divider-grow"}),e(ye,{onClick:()=>{R.showKeyboardShortcutsHelp=!0},children:[e(_,{icon:"keyboard",size:"l"})," ",e("span",{children:e(m,{id:"77Emn0"})})]}),e(ye,{onClick:()=>{R.showShortcutsSettings=!0},children:[e(_,{icon:"shortcut",size:"l"})," ",e("span",{children:e(m,{id:"8Kudkr"})})]}),e(ye,{onClick:()=>{R.showSettings=!0},children:[e(_,{icon:"gear",size:"l"})," ",e("span",{children:e(m,{id:"uVbUP8"})})]})]}):e(B,{children:[e(Ye,{}),e(ye,{onClick:()=>{R.showSettings=!0},children:[e(_,{icon:"gear",size:"l"})," ",e("span",{children:e(m,{id:"uVbUP8"})})]})]})]})]})]})}function Rd({menuState:n}){const i=Xe("@mastodon/lists"),[s,o]=$([]);return G(()=>{i&&n==="open"&&fn().then(o)},[n,i]),s.length>0?e(Rn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(B,{children:[e(_,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(m,{id:"h16FyT"})}),e(_,{icon:"chevron-right"})]}),children:[e(Ve,{to:"/l",children:e("span",{children:e(m,{id:"BHWx+g"})})}),s?.length>0&&e(B,{children:[e(Ye,{}),s.map(c=>e(Ve,{to:`/l/${c.id}`,children:e("span",{children:[c.title,c.exclusive&&e(B,{children:[" ",e(Jt,{})]})]})},c.id))]})]}):i&&e(Ve,{to:"/l",children:[e(_,{icon:"list",size:"l"}),e("span",{children:e(m,{id:"h16FyT"})})]})}const Kt=ut(Ed),Dn={block:"start",inline:"center",behavior:"instant"};function Nt({title:n,titleComponent:i,id:s,instance:o,emptyText:c,errorText:a,useItemID:u,boostsCarousel:l,fetchItems:d=()=>{},checkForUpdates:r=()=>{},checkForUpdatesInterval:h=15e3,headerStart:f,headerEnd:p,timelineStart:g,refresh:y,view:w,filterContext:k,showFollowedTags:b,showReplyParent:S,clearWhenRefresh:x}){const{_:C}=ce(),T=We(R),[v,I]=$([]),[L,E]=$("start"),[F,O]=$(!1),[H,Q]=$(!1),[re,Z]=$(!0),J=j();__BENCHMARK.start(`timeline-${s}-load`);const Y=xe(()=>Gi(),[]),W=w!=="media",N=j(0),te=ba(ie=>{Q(!1),E("loading"),(async()=>{try{const Ie=N.current=Date.now();let{done:Ce,value:se}=await d(ie);if(Ie!==N.current)return;if(Array.isArray(se)){const[De,$e]=se.reduce((Ae,ne)=>(ne._pinned?Ae[0].push(ne):Ae[1].push(ne),Ae),[[],[]]);se=$e,se=Sd(se,k),W&&(l&&(se=kd(se)),se=Cd(se,o)),De.length&&(se=De.concat(se)),I(ie?se:Ae=>[...Ae,...se]),se.length||(Ce=!0),O(!Ce)}else O(!1);E("default"),__BENCHMARK.end(`timeline-${s}-load`)}catch{E("error"),ie&&!v.length&&a&&le(a)}finally{te.cancel()}})()},1e3,{leading:!0}),ee=".timeline-item, .timeline-item-alt",me=He("j, shift+j",(ie,Ie)=>{if(ie.shiftKey!==Ie.shift)return;const Ce=document.activeElement.closest(ee),se=Ce?.getBoundingClientRect(),De=Array.from(J.current.querySelectorAll(ee)).filter($e=>!!$e.offsetHeight);if(Ce&&se.top0){const $e=De.indexOf(Ce);let Ae=De[$e+1];Ie.shift&&(Ae=De.find((ne,Ue)=>Ue>$e&&!ne.classList.contains("timeline-item-alt"))),Ae&&(Ae.focus(),Ae.scrollIntoView(Dn))}else{const $e=De.find(Ae=>{const ne=Ae.getBoundingClientRect();return ne.top>=44&&ne.left>=0});$e&&($e.focus(),$e.scrollIntoView(Dn))}},{useKey:!0,ignoreEventWhen:ie=>ie.metaKey||ie.ctrlKey||ie.altKey}),be=He("k, shift+k",(ie,Ie)=>{if(ie.shiftKey!==Ie.shift)return;const Ce=document.activeElement.closest(ee),se=Ce?.getBoundingClientRect(),De=Array.from(J.current.querySelectorAll(ee)).filter($e=>!!$e.offsetHeight);if(Ce&&se.top0){const $e=De.indexOf(Ce);let Ae=De[$e-1];Ie.shift&&(Ae=De.findLast((ne,Ue)=>Ue<$e&&!ne.classList.contains("timeline-item-alt"))),Ae&&(Ae.focus(),Ae.scrollIntoView(Dn))}else{const $e=De.find(Ae=>{const ne=Ae.getBoundingClientRect();return ne.top>=44&&ne.left>=0});$e&&($e.focus(),$e.scrollIntoView(Dn))}},{useKey:!0,ignoreEventWhen:ie=>ie.metaKey||ie.ctrlKey||ie.altKey}),q=He(["enter","o"],(ie,Ie)=>{const Ce=document.activeElement;if(Ce?.matches(ee))if(Ie.keys.join("")==="o"){const De=Ce.querySelector("a.media:not(.status-card a.media)");if(De){const $e=De.getAttribute("href");if(/media\-only=/i.test($e)){const Ae=$e.replace(/media\-only=/i,"media=");setTimeout(()=>{location.hash=Ae},100)}else De.click()}else Ce.click()}else Ce.click()},{useKey:!0,ignoreEventWhen:ie=>ie.metaKey||ie.ctrlKey||ie.altKey||ie.shiftKey}),V=v.length>0&&L!=="loading"&&H,fe=nt(()=>{V&&te(!0),J.current?.scrollTo({top:0,behavior:"smooth"})},[te,V]),_e=He(".",fe,{useKey:!0,ignoreEventWhen:ie=>ie.metaKey||ie.ctrlKey||ie.altKey||ie.shiftKey}),Pe=j(),[Oe,ae]=$(!1),Se=nt(({scrollDirection:ie,nearReachStart:Ie,reachStart:Ce})=>{if(Pe.current){const se=ie==="end"&&!Ie;Pe.current.hidden=se}ae(Ie),Ce&&te(!0)},[ae,te]),{resetScrollDirection:ge}=Ad({scrollableRef:J,distanceFromEnd:2,scrollThresholdStart:44},Se);G(()=>{J.current?.scrollTo({top:0}),te(!0)},[]);const Re=j(!0);G(()=>{if(Re.current){Re.current=!1;return}x&&v?.length&&(te.cancel?.(),I([])),te(!0)},[x,y]);const Ne=j(w);G(()=>{Ne.current!==w&&(Ne.current=w,I([]))},[w]);const Be=nt(async({disableIdleCheck:ie=!1}={})=>{const Ie=J.current?getComputedStyle(J.current).pointerEvents==="none":!1;T.settings.autoRefresh&&J.current.scrollTop<16&&(ie||window.__IDLE__)&&!Pd()&&!Ie?te(!0):await r()&&Q(!0)},[s,te,r,T.settings.autoRefresh]),ze=j();return un(ie=>{if(ie){const Ie=Date.now()-ze.current;(!ze.current||Ie>1e3*3)&&Be({disableIdleCheck:!0})}else ze.current=Date.now();Z(ie)},[r,Be,T.settings.autoRefresh]),Qi(Be,re&&!H?h*(Oe?1:2):null),e(gi.Provider,{value:k,children:e("div",{id:`${s}-page`,class:`deck-container ${Y?"deck-container-media-first":""}`,ref:ie=>{J.current=ie,me.current=ie,be.current=ie,q.current=ie,_e.current=ie},tabIndex:"-1",onClick:ie=>{Pe.current&&ie.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{Pe.current.hidden=!1,ge()},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:Pe,onClick:ie=>{ie.target.closest("a, button")||J.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:ie=>{ie.target.closest("a, button")||te(!0)},class:L==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Kt,{}),f??e(pe,{to:"/",class:"button plain home-button",children:e(_,{icon:"home",size:"l",alt:C({id:"i0qMbr"})})})]}),n&&(i||e("h1",{children:n})),e("div",{class:"header-side",children:!!p&&p})]}),V&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:fe,children:[e(_,{icon:"arrow-up"})," ",e(m,{id:"2yr1/p"})]})]}),!!g&&e("div",{class:`timeline-start ${L==="loading"?"loading":""}`,children:g}),v.length?e(B,{children:[e("ul",{class:`timeline ${w?`timeline-${w}`:""}`,children:[v.map(ie=>e(Ld,{status:ie,instance:o,useItemID:u,filterContext:k,view:w,showFollowedTags:b,showReplyParent:S,mediaFirst:Y},ie.id+ie?._pinned+w)),F&&L==="loading"&&(w==="media"?null:e(B,{children:[e("li",{style:{height:"20vh"},children:e(je,{skeleton:!0,mediaFirst:Y})}),e("li",{style:{height:"25vh"},children:e(je,{skeleton:!0,mediaFirst:Y})})]}))]}),L==="default"&&(F?e(Dt,{root:J.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:ie=>{ie&&te()},children:e("button",{type:"button",class:"plain block",onClick:()=>te(),style:{marginBlockEnd:"6em"},children:e(m,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(m,{id:"2EYeAZ"})}))]}):L==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((ie,Ie)=>w==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(je,{skeleton:!0,mediaFirst:Y})},Ie))}):L!=="error"&&L!=="start"&&e("p",{class:"ui-state",children:c}),L==="error"&&e("p",{class:"ui-state",children:[a,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>te(!v.length),children:e(m,{id:"KDw4GX"})})]})]})})})}const Ld=ut(({status:n,instance:i,useItemID:s,filterContext:o,view:c,showFollowedTags:a,showReplyParent:u,mediaFirst:l})=>{const{_:d}=ce(),{id:r,reblog:h,items:f,type:p,_pinned:g}=n;g&&(s=!1);const y=h?.id||r,w=i?`/${i}/s/${y}`:`/s/${y}`;if(f){let b=Xt(f,o),S="";if(p==="boosts"?S=he._({id:"NuqppG",values:{0:b.length}}):p==="pinned"&&(S=d({id:"GlfmCu"})),p==="boosts"||p==="pinned"){const T=new Set;if(b.sort((v,I)=>{const L=Zt(v.filtered,o),E=Zt(I.filtered,o);return L&&L?.action!=="blur"&&T.add(v.id),E&&E?.action!=="blur"&&T.add(I.id),L&&!E?1:!L&&E?-1:0}),T.size>=2){const I=[],L=[];b.forEach(F=>{T.has(F.id)?L.push(F):I.push(F)});const E=[];for(let F=0;F{const{id:I,reblog:L,_pinned:E,_grouped:F}=v;if(F)return e("li",{class:"timeline-item-carousel-group",children:v.posts.map(Q=>{const{id:re,reblog:Z,_pinned:J}=Q,Y=Z?.id||re,W=i?`/${i}/s/${Y}`:`/s/${Y}`;return J&&(s=!1),e(pe,{class:"status-carousel-link timeline-item-alt",to:W,children:s?e(je,{statusID:re,instance:i,size:"s"}):e(je,{status:Q,instance:i,size:"s"})})})},I);const O=L?.id||I,H=i?`/${i}/s/${O}`:`/s/${O}`;return E&&(s=!1),e("li",{children:e(pe,{class:"status-carousel-link timeline-item-alt",to:H,children:s?e(je,{statusID:I,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:l}):e(je,{status:v,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:l})})},I)})})},`timeline-${r}`)}const C=b.length>3;return b.map((T,v)=>{const{id:I,_differentAuthor:L}=T,E=i?`/${i}/s/${I}`:`/s/${I}`,F=v>0&&v0||C&&F&&(p==="thread"||p==="conversation"&&!L&&!b[v-1]._differentAuthor&&!b[v+1]._differentAuthor),Q=v===0,re=v===b.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${p} timeline-item-container-${Q?"start":re?"end":"middle"} ${L?"timeline-item-diff-author":""}`,children:e(pe,{class:"status-link timeline-item",to:E,children:H?e(Md,{status:T,instance:i,filterContext:o}):s?e(je,{statusID:I,instance:i,enableCommentHint:re,showFollowedTags:a}):e(je,{status:T,instance:i,enableCommentHint:re,showFollowedTags:a})})},`timeline-${I}`)})}const k=`timeline-${r+g}`;return c==="media"?s?e(Js,{class:"timeline-item",parent:"li",statusID:r,instance:i},k):e(Js,{class:"timeline-item",parent:"li",status:n,instance:i},k):e("li",{children:e(pe,{class:"status-link timeline-item",to:w,children:s?e(je,{statusID:r,instance:i,enableCommentHint:!0,showFollowedTags:a,showReplyParent:u,mediaFirst:l}):e(je,{status:n,instance:i,enableCommentHint:!0,showFollowedTags:a,showReplyParent:u,mediaFirst:l})})},k)},(n,i)=>{const s=(n.status?.id||"").toString(),o=(i.status?.id||"").toString();return s===o&&n.instance===i.instance&&n.view===i.view});function $d({title:n,class:i,children:s}){const{_:o}=ce(),c=j(),a=j(),u=j(),[l,d]=$(!1);return G(()=>{setTimeout(()=>{d(!0)},1)},[]),e("div",{class:`status-carousel ${i}`,children:[e("header",{children:[e("h3",{children:n}),e("span",{children:[e("button",{ref:a,type:"button",class:"small plain2",onClick:()=>{const r=Math.min(320,c.current?.offsetWidth)*(Yt()?1:-1);c.current?.scrollBy({left:r,behavior:"smooth"})},children:e(_,{icon:"chevron-left",alt:o({id:"DHhJ7s"})})})," ",e("button",{ref:u,type:"button",class:"small plain2",onClick:()=>{const r=Math.min(320,c.current?.offsetWidth)*(Yt()?-1:1);c.current?.scrollBy({left:r,behavior:"smooth"})},children:e(_,{icon:"chevron-right",alt:o({id:"hXzOVo"})})})]})]}),e("ul",{ref:c,children:[e(Dt,{class:"status-carousel-beacon",onChange:r=>{a.current&&(a.current.disabled=r)}}),s[0],l&&s.slice(1),e(Dt,{class:"status-carousel-beacon",onChange:r=>{u.current&&(u.current.disabled=r)}})]})]})}function Md({status:n,instance:i,filterContext:s}){const{_:o}=ce(),c=We(R),{id:a,visibility:u,language:l}=n,d=mi(n),r=pt(a,i),h=Zt(n.filtered,s);return e("article",{class:`status compact-thread ${u==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[e("div",{class:"status-thread-badge-container",children:e(wa,{index:c.statusThreadNumber[r]})}),e("div",{class:"content-compact",title:d,lang:l,dir:"auto",children:h&&h?.action!=="blur"?e("b",{class:"status-filtered-badge badge-meta horizontal",title:h?.titlesStr||"",children:h?.titlesStr?e(m,{id:"sr6maL",values:{0:h.titlesStr},components:{0:e("span",{}),1:e("span",{})}}):e("span",{children:e(m,{id:"03Qqf9"})})}):e(B,{children:[d,n.sensitive&&n.spoilerText&&e(B,{children:[" ",e("span",{class:"spoiler-badge",children:e(_,{icon:"eye-close",size:"s",alt:o({id:"gnKo7f"})})})]})]})})]})}function Pd(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const cn=20,gs=1983,eo=`${gs}-01`,Dd=Zi(()=>{try{const n=document.createElement("input");return n.setAttribute("type","month"),n.type==="month"}catch{return!1}});function uc({columnMode:n,...i}){const{i18n:s,_:o}=ce(),c=We(R),{id:a,...u}=n?{id:i.id}:Ut(),l=j(new URLSearchParams({replies:1})),[,d]=Et(ae=>ae+1,0),r=nt(ae=>{const Se=l.current;typeof ae=="function"?ae(Se):Object.entries(ae).forEach(([ge,Re])=>{Re?Se.set(ge,Re):Se.delete(ge)}),d()},[]),[h,f]=n?[l.current,r]:xt(),p=nt((ae,Se)=>{f(ge=>{Array.from(ge.keys()).forEach(Re=>{ge.delete(Re)}),Se!==void 0&&ge.set(ae,Se)})},[f]),g=h.get("month"),y=!h.get("replies"),w=!!h.get("boosts"),k=h.get("tagged"),b=!!h.get("media"),{masto:S,instance:x,authenticated:C}=oe({instance:u?.instance}),{masto:T,instance:v}=oe(),I=j(),L=[g,y,w,k,b],[E,F]=$(),O=j(0);G(()=>{O.current=0},L);const H=xe(()=>Gi(),[]),Q=xe(()=>x===v,[x,v]),[re,Z]=$(!1);G(()=>{Q&&E?.acct&&(async()=>{const ae=await jo(x);Z(ae)})()},[x,Q,E?.acct]);async function J(ae){const Se=/^\d{4}-[01]\d$/.test(g),ge=g?.split?.("-")?.[0]>=gs;if(Se&&ge){if(!E)return{value:[],done:!0};const[ze,ie]=g.split("-"),Ie=parseInt(ie,10)-1,Ce=new Date(ze,Ie,0),se=`${Ce.getFullYear()}-${(Ce.getMonth()+1).toString().padStart(2,"0")}-${Ce.getDate().toString().padStart(2,"0")}`,De=new Date(ze,Ie+1,1),$e=`${De.getFullYear()}-${(De.getMonth()+1).toString().padStart(2,"0")}-${De.getDate().toString().padStart(2,"0")}`;let Ae;ae?(Ae=cn+1,O.current=0):(Ae=cn+O.current+1,O.current+=cn);const ne=await S.v2.search.list({q:`from:${E.acct} after:${se} before:${$e}`,type:"statuses",limit:Ae,offset:O.current});if(ne?.statuses?.length){const Ue=ne.statuses.slice(0,cn);Ue.forEach(st=>{Je(st,x)});const wt=ne.statuses.length<=cn;return{value:Ue,done:wt}}else return{value:[],done:!0}}let Re=[];if(ae&&!n){const{value:ze}=await S.v1.accounts.$select(a).statuses.list({pinned:!0}).values().next();if(ze?.length&&!k&&!b){const ie=ze.map(Ie=>(Je(Ie,x),{...Ie,_pinned:!0}));if(ie.length>=3){const Ie=ie.map(Ce=>Ce.id);Re.push({id:Ie,items:ie,type:"pinned"})}else Re.push(...ie)}}(ae||!I.current)&&(I.current=S.v1.accounts.$select(a).statuses.list({limit:cn,exclude_replies:y,exclude_reblogs:w,only_media:b||void 0,tagged:k}).values());const{value:Ne,done:Be}=await I.current.next();if(Ne?.length){if(!Xe("@mastodon/pinned-posts")&&Re.length){let ze=[];Re[0]?.type==="pinned"?ze=Re[0].id:ze=Re.filter(Ie=>Ie._pinned).map(Ie=>Ie.id),ze.every(Ie=>Ne.some(Ce=>Ce.id===Ie))&&(Re=[])}Re.push(...Ne),Ne.forEach(ze=>{Je(ze,x)})}return{value:Re,done:Be}}const[Y,W]=$([]);let N=o({id:"/cKnpj"});if(E?.acct){const ae=(/@/.test(E.acct)?"":"@")+E.acct,Se=E?.displayName?`${E.displayName} (${ae})`:`${ae}`;if(!y)N=o({id:"hS1Opy",values:{accountDisplay:Se}});else if(w)N=o({id:"A/CX5F",values:{accountDisplay:Se}});else if(k)N=o({id:"QQrO94",values:{accountDisplay:Se,tagged:k}});else if(b)N=o({id:"NoG5wD",values:{accountDisplay:Se}});else if(g){const ge=new Date(g).toLocaleString(s.locale,{month:"long",year:"numeric"});N=o({id:"8GjLvB",values:{accountDisplay:Se,monthYear:ge}})}else N=Se}et(N,"/:instance?/a/:id");const te=nt(()=>zd(a,S),[a,S]);G(()=>{(async()=>{try{const ae=await te();F(ae)}catch{}if(!H)try{const ae=await S.v1.accounts.$select(a).featuredTags.list();W(ae)}catch{}})()},[a,H]);const{displayName:ee,acct:me,emojis:be}=E||{},q=xe(()=>E?.id===dt(),[E?.id]),V=j(),fe=xe(()=>{const ae=!y||w||k||b||!!g,Se=c.accounts[`${a}@${x}`];return e(B,{children:[n?e(wd,{account:E,instance:x}):e(Go,{instance:x,account:Se||a,fetchAccount:te,authenticated:C,standalone:!0,showEndorsements:!0}),!H&&e("div",{class:"filter-bar",ref:V,style:{position:"relative"},children:[ae?e(pe,{to:`/${x}/a/${a}`,class:"insignificant filter-clear",title:o({id:"u8JHrO"}),onClick:ge=>{n&&(ge.preventDefault(),p())},children:e(_,{icon:"x",size:"l",alt:o({id:"xCJdfg"})})},"clear-filters"):e(_,{icon:"filter",class:"insignificant",size:"l",alt:o({id:"cSev+j"})}),e(pe,{to:`/${x}/a/${a}${y?"?replies=1":""}`,onClick:ge=>{n&&(ge.preventDefault(),y?p("replies","1"):p()),y&&le(o({id:"PIWNSQ"}))},class:y?"":"is-active",children:e(m,{id:"5BFynH"})}),e(pe,{to:`/${x}/a/${a}${w?"":"?boosts=0"}`,onClick:ge=>{n&&(ge.preventDefault(),w?p():p("boosts","0")),w||le(o({id:"Qd13i0"}))},class:w?"is-active":"",children:e(m,{id:"usxQx0"})}),e(pe,{to:`/${x}/a/${a}${b?"":"?media=1"}`,onClick:ge=>{n&&(ge.preventDefault(),b?p():p("media","1")),b||le(o({id:"rKpfPY"}))},class:b?"is-active":"",children:e(m,{id:"xYilR2"})}),Y.map(ge=>e(pe,{to:`/${x}/a/${a}${k===ge.name?"":`?tagged=${encodeURIComponent(ge.name)}`}`,onClick:Re=>{n&&(Re.preventDefault(),k!==ge.name?p("tagged",ge.name):p()),k!==ge.name&&le(o({id:"L+HFfr",values:{0:ge.name}}))},class:k===ge.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),ge.name]})},ge.id)),re&&!n&&e(B,{children:[Dd()?e("label",{class:`filter-field ${g?"is-active":""}`,children:[e(_,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!E?.acct,value:g||"",min:eo,max:new Date().toISOString().slice(0,7),onInput:ge=>{const{value:Re,validity:Ne}=ge.currentTarget;if(!Ne.valid)return;f(Re?{month:Re}:{});const[Be,ze]=Re.split("-"),ie=parseInt(ze,10)-1,Ie=new Date(Be,ie);le(o({id:"0WUFGD",values:{0:Ie.toLocaleString(s.locale,{month:"long",year:"numeric"})}}))}})]}):e(Nd,{class:`filter-field ${g?"is-active":""}`,disabled:!E?.acct,value:g||"",min:eo,max:new Date().toISOString().slice(0,7),onInput:ge=>{const{value:Re,validity:Ne}=ge;Ne.valid&&f(Re?{month:Re}:{})}}),e("button",{type:"button",class:"filter-field",onClick:()=>{R.showSearchCommand={query:q?"from:me ":`from:${E?.acct} `}},children:e(_,{icon:"search",size:"l",alt:o(q?{id:"BmW9JG"}:{id:"h7t/Tx",values:{0:E?.username}})})})]})]})]})},[a,x,C,Y,te,re,...L]);G(()=>{const ae=V.current?.querySelector(".is-active");ae&&V.current.scrollTo({behavior:"smooth",left:ae.offsetLeft-(V.current.offsetWidth-ae.offsetWidth)/2})},[Y,re,...L]);const _e=xe(()=>E?.url?URL.parse(E.url)?.hostname:null,[E]),Oe=!!E&&!(x===_e);return e(B,{children:[e(Nt,{title:`${E?.acct?"@"+E.acct:o({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(Eo,{text:ee,emojis:be,resolverURL:E?.url})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",me]})})]}),id:"account-statuses",instance:x,emptyText:o({id:"+k97fV"}),errorText:o({id:"scd9lw"}),fetchItems:J,useItemID:!0,view:b||H?"media":void 0,boostsCarousel:!q&&c.settings.boostsCarousel,timelineStart:fe,refresh:[y,w,k,b,g+E?.acct].toString(),headerEnd:e(mt,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(_,{icon:"more",size:"l",alt:o({id:"2FYpfJ"})})}),children:[e(ye,{disabled:!Oe,onClick:()=>{(async()=>{try{const{masto:ae}=oe({instance:_e}),Se=await ae.v1.accounts.lookup({acct:E.acct}),{id:ge}=Se;location.hash=`/${_e}/a/${ge}`}catch{alert(o({id:"FgdLx0"}))}})()},children:[e(_,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(m,{id:"6GZBJp",values:{0:_e?e(B,{children:[" ","(",e("b",{children:hi.toUnicode(_e)}),")"]}):null}})})]}),!Q&&e(ye,{onClick:()=>{(async()=>{try{const ae=await T.v1.accounts.lookup({acct:E.acct+"@"+x}),{id:Se}=ae;location.hash=`/${v}/a/${Se}`}catch{alert(o({id:"FgdLx0"}))}})()},children:[e(_,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(m,{id:"SiegcM",values:{currentInstance:v},components:{0:e("b",{})}})})]})]})},a),me&&!q&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`@${me} `}})})]})}function Nd(n){const{i18n:i}=ce(),{class:s,disabled:o,value:c,min:a,max:u,onInput:l=()=>{}}=n,[d,r]=c?.split("-")||[],h=j(),f=j(),p=(g,y)=>{const[w,k]=a?.split("-")||[],[b,S]=u?.split("-")||[];return!(yb||y===w&&gS)};return e("div",{class:s,children:[e(_,{icon:"month",size:"l"}),e("select",{ref:h,disabled:o,value:r||"",onInput:g=>{const{value:y}=g.currentTarget,w=f.current.value;if(!p(y,w))return{value:"",validity:{valid:!1}};l({value:y?`${w}-${y}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(m,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(g,y)=>e("option",{value:(y+1).toString().padStart(2,"0"),children:new Date(0,y).toLocaleString(i.locale,{month:"long"})},y))]})," ",e("input",{ref:f,type:"number",disabled:o,value:d||new Date().getFullYear(),min:a?.slice(0,4)||gs,max:u?.slice(0,4)||new Date().getFullYear(),onInput:g=>{const{value:y,validity:w}=g.currentTarget,k=h.current.value;if(!w.valid||!p(k,y))return{value:"",validity:{valid:!1}};l({value:y?`${y}-${k}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}function Od(n,i){return i.v1.accounts.$select(n).fetch()}const zd=It(Od,{expires:1800*1e3});function qd(){const n=Ut(),{year:i}=n;et(i?`${i} #Wrapstodon`:"#Wrapstodon","/annual_report/:year");const{masto:s,instance:o}=oe(),[c,a]=$(null),[u,l]=$("default");G(()=>{i&&(async()=>{l("loading");const g=await s.v1.annualReports.$select(i).fetch();a(g),l("default")})()},[i]);const{accounts:d,annualReports:r,statuses:h}=c||{},f=r?.find(g=>g.year==i)?.data,p=new Date;return e("div",{id:"annual-report-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:`report ${u==="loading"?"loading-mask":""}`,children:[e("h1",{children:[i," #Wrapstodon"]}),!!f&&e("dl",{children:Object.entries(f).map(([g,y])=>{const w={};return Array.isArray(y)&&y.forEach(k=>{Object.entries(k).forEach(([b,S])=>{typeof S=="number"&&(w[b]=(w[b]||0)+S)})}),e(B,{children:[e("dt",{children:g}),e("dd",{class:`report-${g}`,children:Array.isArray(y)?e("table",{children:[e("thead",{children:e("tr",{children:Object.entries(y[0]).map(([k,b])=>e("th",{class:k!=="month"&&typeof b=="number"?"number":"",children:k}))})}),e("tbody",{children:y.map(k=>e("tr",{children:Object.entries(k).map(([b,S])=>e("td",{class:b!=="month"&&typeof S=="number"?"number":"",style:{"--percentage":typeof S=="number"?`${S/w[b]*100}%`:0},children:S&&/(accountId)/i.test(b)&&/^(mostRebloggedAccounts|commonlyInteractedWithAccounts)$/i.test(g)?d?.find(x=>x.id===S)?e(yt,{account:d?.find(x=>x.id===S),showAvatar:!0}):"👻":b==="month"?p.setMonth(S-1)&&p.toLocaleString(void 0,{month:"long"}):typeof S=="number"?S.toLocaleString():S}))}))})]}):typeof y=="object"?/^(topStatuses)$/i.test(g)?e("dl",{children:Object.entries(y).map(([k,b])=>e(B,{children:[e("dt",{children:k}),e("dd",{children:b&&e(pe,{to:`/${o}/s/${b}`,children:e(je,{status:h?.find(S=>S.id===b),size:"s",readOnly:!0,showCommentCount:!0})})})]}))}):e("table",{children:e("tbody",{children:Object.entries(y).map(([k,b])=>e("tr",{children:[e("th",{children:k}),e("td",{class:typeof b=="number"?"number":"",children:b})]}))})}):typeof y=="string"?y:JSON.stringify(y,null,2)})]})})})]}),e("hr",{}),e("p",{style:{textAlign:"center"},children:e(pe,{to:"/",children:e(m,{id:"iWpEwy"})})})]})}const Bd=20;function hc(){const{_:n}=ce();et(n({id:"7Ff7ia"}),"/b");const{masto:i,instance:s}=oe(),o=j();async function c(a){return(a||!o.current)&&(o.current=i.v1.bookmarks.list({limit:Bd}).values()),await o.current.next()}return e(Nt,{title:n({id:"7Ff7ia"}),id:"bookmarks",emptyText:n({id:"8k2w6G"}),errorText:n({id:"UoL+FC"}),instance:s,fetchItems:c})}const fc=""+new URL("catch-up-O5q5C75Z.png",import.meta.url).href,Fd="home",jt="catchup",At=[{label:{id:"Ov9hfp"},value:1},{label:{id:"tVE2wM"},value:2},{label:{id:"8+HOWa"},value:3},{label:{id:"1o+mEC"},value:4},{label:{id:"dZZ8oA"},value:5},{label:{id:"lpPucp"},value:6},{label:{id:"r9r5X6"},value:7},{label:{id:"I9uBFA"},value:8},{label:{id:"pBYFlb"},value:9},{label:{id:"wvL7OJ"},value:10},{label:{id:"7Vb+qD"},value:11},{label:{id:"VU1Pnd"},value:12},{label:{id:"vpc27K"},value:13,beyond:!0}],Ud={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},quotes:{id:"eWLklq"},boosts:{id:"puY2t0"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},Kd=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],Hd=[null,"account"],jd=Zi(n=>new Intl.DateTimeFormat(n||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function di(n){return n?.id||n?.quotedStatus?.id}function Vd(){const{i18n:n,_:i,_:s}=ce(),o=jd(n.locale);et("Catch-up","/catchup");const{masto:c,instance:a}=oe(),[u,l]=xt(),d=u.get("id"),[r,h]=$("start"),[f,p]=$(!1),g=xe(()=>dt(),[]),y=A=>A===g,w=Xe("@pixelfed/home-include-reblogs");async function k({maxCreatedAt:A}){const D=[],K=c.v1.timelines.home.list({limit:40}),X=K.values();e:for(;;)try{w&&K.params&&(typeof K.params=="string"?K.params+="&include_reblogs=true":K.params.include_reblogs=!0);const z=await X.next(),{value:de}=z;if(de?.length){await dc(de,a);let Me=!1;for(let we=0;we=A){const Le=!y(Ee.reblog?.account?.id||Ee.account.id)&&Zt(Ee.reblog?.filtered||Ee.filtered,Fd);if(Le?.action==="hide")continue;Ee._filtered=Le;const Te=pt(Ee.id,a);Ee._followedTags=R.statusFollowedTags[Te]?[...R.statusFollowedTags[Te]]:[],D.push(Ee),Me=!0}if(!Me)break e}}else break e;await new Promise(Me=>setTimeout(Me,1e3))}catch{break e}return D.forEach(z=>{if(z?.inReplyToId){const de=D.find(Me=>Me.id===z.inReplyToId);de&&!de.inReplyToId&&(de._thread=!0)}}),D}const[b,S]=$([]),x=j(),C=j(),T=xe(()=>ti(),[]),v=nt(async({duration:A}={})=>{const D=Date.now(),K=A?D-A:null;h("loading");const X=await k({maxCreatedAt:K}),z=`${T}-${ka()}`;try{await Ct.catchup.set(z,{id:z,posts:X,count:X.length,startAt:K,endAt:D}),l({id:z})}catch{}},[]);G(()=>{d?(async()=>{const A=await Ct.catchup.get(d);A&&(A.posts.sort((D,K)=>D.createdAt>K.createdAt?1:-1),S(A.posts),h("results"))})():r==="results"&&(S([]),h("start"))},[d]);const[I,L]=Et(A=>A+1,0),[E,F]=$(null),[O,H]=$([]);G(()=>{const A=new Set(O.map(D=>D.id));for(let D=sessionStorage.length-1;D>=0;D--){const K=sessionStorage.key(D);if(K?.startsWith(`${jt}-`)){const X=K.replace(`${jt}-`,"");A.has(X)||ke.session.del(K)}}},[O]),G(()=>{(async()=>{try{const A=await Ct.catchup.keys();if(A.length){const D=ti(),K=A.filter(X=>X.startsWith(`${D}-`));if(K.length){let X=await Ct.catchup.getMany(K);X.sort((we,Ee)=>Ee.endAt-we.endAt);let z=X.slice(0,3),de=X.slice(3);const Me=z.map(we=>{const{id:Ee,count:U,startAt:ve,endAt:Le}=we;return{id:Ee,count:U,startAt:ve,endAt:Le}});H(Me),F(z[0].endAt),X=null,z=null,queueMicrotask(()=>{de.length&&Ct.catchup.delMany(de.map(we=>we.id)).then(()=>{de=null}).catch(we=>{})});return}}}catch{}H([])})()},[I]),G(()=>{r==="start"&&L()},[r==="start"]);const[Q,re]=xe(()=>{let A=0,D=0,K=0,X=0,z=0,de=0,Me=0;const we={};for(const U of b){U._filtered&&U._filtered?.action!=="blur"?(A++,U.__FILTER="filtered"):U.group?(D++,U.__FILTER="groups"):U.reblog?(K++,U.__FILTER="boosts"):Gt()&&di(U.quote)?(X++,U.__FILTER="quotes"):U._followedTags?.length?(de++,U.__FILTER="followedTags"):U.inReplyToId&&U.inReplyToAccountId!==U.account?.id?(z++,U.__FILTER="replies"):(Me++,U.__FILTER="original");const ve=U.reblog||U;if(U.__FILTER!=="filtered"&&ve.card?.url&&ve.card?.image&&ve.card?.type==="link"){const{card:Le,favouritesCount:Te,reblogsCount:Qe}=ve;let{url:Ze}=Le;if(Ze=Ze.replace(/\/$/,""),!we[Ze])we[Ze]={postID:ve.id,card:Le,shared:1,sharers:[U.account],likes:Te,boosts:Qe};else{if(we[Ze].sharers.find(tt=>tt.id===U.account.id))continue;we[Ze].shared++,we[Ze].sharers.push(U.account),we[Ze].postID!==ve.id&&(we[Ze].likes+=Te,we[Ze].boosts+=Qe)}}}let Ee=[];for(const U in we)Ee.push({url:U,...we[U]});if(Ee.sort((U,ve)=>U.shared>ve.shared?-1:U.sharedve.boosts?-1:U.boostsve.likes?-1:U.likesve.quotes?-1:U.quotes10)e:for(let U=10;U{if(!d)return;const A=ke.session.getJSON(`${jt}-${d}`);A&&(A.selectedFilterCategory!==void 0&&J(A.selectedFilterCategory),A.selectedAuthor!==void 0&&W(A.selectedAuthor),A.sortBy!==void 0&&me(A.sortBy),A.sortOrder!==void 0&&q(A.sortOrder),A.groupBy!==void 0&&fe(A.groupBy),A.showTopLinks!==void 0&&p(A.showTopLinks))},[d]),G(()=>{if(!d||r!=="results")return;const A={selectedFilterCategory:Z,selectedAuthor:Y,sortBy:ee,sortOrder:be,groupBy:V,showTopLinks:f};ke.session.setJSON(`${jt}-${d}`,A)},[d,r,Z,Y,ee,be,V,f]);const[_e,Pe,Oe]=xe(()=>{const A={},D=new Map;let K=b.filter(z=>{const de=Z==="all"||z.__FILTER===Z;return de&&(A[z.account.id]=z.account,D.set(z.account.id,(D.get(z.account.id)||0)+1)),de});const X={};return K.forEach(z=>{z.reblog&&(X[z.reblog.id]?(X[z.reblog.id].__BOOSTERS?X[z.reblog.id].__BOOSTERS.add(z.account):X[z.reblog.id].__BOOSTERS=new Set([z.account]),z.__HIDDEN=!0):X[z.reblog.id]=z)}),Y&&D.has(Y)&&(K=K.filter(z=>z.account.id===Y||[...z.__BOOSTERS||[]].find(de=>de.id===Y))),[K,A,Object.fromEntries(D)]},[Z,Y,b]),ae=xe(()=>{const A={};return _e.forEach(D=>{A[D.id]=D}),A},[_e]),Se=xe(()=>Object.keys(Oe).sort((A,D)=>Oe[D]-Oe[A]),[Oe]),ge=xe(()=>{const A={};return Se.forEach((D,K)=>{A[D]=K}),_e.filter(D=>!D.__HIDDEN).sort((D,K)=>{if(V==="account"){const X=D.account.id,z=K.account.id,de=A[X],Me=A[z],we=de-Me;if(we!==0)return we}if(ee!=="createdAt"&&(D=D.reblog||D,K=K.reblog||K,ee!=="density"&&D[ee]===K[ee]))return D.createdAt>K.createdAt?1:-1;if(ee==="density"){const X=to(D),z=to(K);return be==="asc"?X>z?1:-1:z>X?1:-1}return be==="asc"?D[ee]>K[ee]?1:-1:K[ee]>D[ee]?1:-1})},[_e,ee,be,V,Se]),Re=j(null),Ne=j(null),Be=j(!1);G(()=>{b.length>100||Be.current||Ne.current&&(Fo(Ne.current,{duration:200}),Be.current=!0)},[b,Ne]);const ze=b.length>160?"3d":"2d",ie=xe(()=>ze!=="2d"?null:b.map(A=>{const D=ae[A.id];return e("span",{class:`post-dot ${D?"post-dot-highlight":""}`},A.id)}),[ae]),Ie=xe(()=>ze!=="3d"||!b?.length?null:Jd(b,"createdAt",320).map((D,K)=>e("div",{class:"posts-bin",children:D.map(X=>{const z=ae[X.id];return e("span",{class:`post-dot ${z?"post-dot-highlight":""}`},X.id)})},K)),[ae]),Ce=j(null);_t(()=>{if(!d||r!=="results"||!Ce.current||!ge.length)return;const A=ke.session.getJSON(`${jt}-${d}`);if(A?.scrollTop!==void 0&&A.scrollTop>0){const D=setTimeout(()=>{Ce.current&&Ce.current.scrollTo({top:A.scrollTop,behavior:"instant"})},100);return()=>clearTimeout(D)}},[d,r,ge.length]),G(()=>{if(!d||r!=="results"||!Ce.current)return;const A=()=>{if(!Ce.current)return;const K=ke.session.getJSON(`${jt}-${d}`)||{};K.scrollTop=Ce.current.scrollTop,ke.session.setJSON(`${jt}-${d}`,K)},D=Ce.current;return D.addEventListener("scroll",A,{passive:!0}),()=>{D.removeEventListener("scroll",A)}},[d,r]);const se=xe(()=>E?(Date.now()-E)/1e3/60/60:null,[E,N]);G(()=>{if(r!=="results")return;const A=Y&&Pe[Y]?Pe[Y].username:"",D=be==="asc"?0:1,K={account:"authors"};let X=le({duration:5e3,text:s({id:"XKZRZ/",values:{selectedFilterCategory:Z,sortBy:ee,sortOrder:be,groupBy:V}})});return()=>{X?.hideToast?.()}},[r,Z,Y,ee,be,V,Pe]),G(()=>{if(Y&&Pe[Y]){const A=Ne.current.querySelector(`[data-author="${Y}"]`),D=Ne.current?.getBoundingClientRect(),K=A?.getBoundingClientRect();K.leftD.right?A.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):K.top<0&&A.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[Y,Pe]);const[De,$e]=$(!1),Ae=".catchup-list > li > a",ne=He("j",()=>{const A=document.activeElement.closest(Ae),D=A?.getBoundingClientRect(),K=Array.from(Ce.current.querySelectorAll(Ae));if(A&&D.top0){const X=K.indexOf(A),z=K[X+1];z&&(z.focus(),z.scrollIntoView({block:"center",inline:"center",behavior:"instant"}))}else{const X=K.find(z=>z.getBoundingClientRect().top>=0);X&&(X.focus(),X.scrollIntoView({block:"nearest",inline:"center",behavior:"instant"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:A=>A.metaKey||A.ctrlKey||A.altKey||A.shiftKey}),Ue=He("k",()=>{const A=document.activeElement.closest(Ae),D=A?.getBoundingClientRect(),K=Array.from(Ce.current.querySelectorAll(Ae));if(A&&D.top0){const X=K.indexOf(A);let z=K[X-1];z&&(z.focus(),z.scrollIntoView({block:"center",inline:"center",behavior:"instant"}))}else{const X=K.find(z=>{const de=z.getBoundingClientRect();return de.top>=44&&de.left>=0});X&&(X.focus(),X.scrollIntoView({block:"nearest",inline:"center",behavior:"instant"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:A=>A.metaKey||A.ctrlKey||A.altKey||A.shiftKey}),wt=He("h, l",(A,D)=>{const K=D.keys[0];if(Y){const X=Se.indexOf(Y);K==="h"?X>0&&X=0&&(W(Se[X+1]),Ce.current?.focus())}else K==="l"&&(W(Se[0]),Ce.current?.focus())},{useKey:!0,preventDefault:!0,ignoreEventWhen:A=>A.metaKey||A.ctrlKey||A.altKey||A.shiftKey,enableOnFormTags:["input"]}),st=He("esc",()=>{W(null),Ce.current?.focus()},{preventDefault:!0,ignoreEventWhen:A=>A.metaKey||A.ctrlKey||A.altKey||A.shiftKey,enableOnFormTags:["input"],useKey:!0}),P=He(".",()=>{Ce.current?.scrollTo({top:0,behavior:"smooth"})},{useKey:!0,preventDefault:!0,ignoreEventWhen:A=>A.metaKey||A.ctrlKey||A.altKey||A.shiftKey,enableOnFormTags:["input"]}),M=nt(A=>{const D=document.activeElement,K=D?.tagName==="INPUT"&&D.type==="radio";if((A.key==="ArrowDown"||A.key==="ArrowUp"||A.key==="ArrowLeft"||A.key==="ArrowRight")&&K){D.blur();return}},[]);return e("div",{ref:A=>{Ce.current=A,ne.current=A,Ue.current=A,wt.current=A,st.current=A,P.current=A},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${r==="loading"?"loading":""}`,onClick:A=>{A.target.closest("a, button")||Ce.current?.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Kt,{}),r==="results"&&e(pe,{to:"/catchup",class:"button plain",children:e(_,{icon:"history2",size:"l",alt:s({id:"xrl8fj"})})}),r==="start"&&e(pe,{to:"/",class:"button plain",children:e(_,{icon:"home",size:"l",alt:s({id:"i0qMbr"})})})]}),e("h1",{children:r!=="start"&&e(m,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("div",{class:"header-side",children:r!=="start"&&r!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{$e(!0)},children:e(m,{id:"c3XJ18"})})})]})}),e("main",{onKeyDown:M,children:[r==="start"&&e("div",{class:"catchup-start",children:[e("h1",{children:e(m,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("details",{children:[e("summary",{children:e(m,{id:"CxKPv6"})}),e("p",{children:e(m,{id:"YMU1CK"})}),e("img",{src:fc,width:"1200",height:"900",alt:s({id:"CeInO2"})}),e("p",{children:e("button",{type:"button",onClick:A=>{A.target.closest("details").open=!1},children:e(m,{id:"2jI8hh"})})})]}),e("p",{children:e(m,{id:"1RfGk7"})}),e("p",{children:e("b",{children:e(m,{id:"OOEonE"})})}),e("div",{class:"catchup-form",children:[e("input",{ref:x,type:"range",value:N,min:At[0].value,max:At[At.length-1].value,step:"1",list:"catchup-ranges",onChange:A=>te(+A.target.value)})," ",e("span",{style:{width:"8em"},children:[i(At[N-1].label),e("br",{}),e("small",{class:"insignificant",children:N==At[At.length-1].value?s({id:"NMNiaO"}):rt(new Date(Date.now()-N*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:At.map(({label:A,value:D})=>e("option",{value:D,label:i(A)}))})," ",e("button",{type:"button",onClick:()=>{let A;const D=At.find(K=>K.beyond);Nse?e("p",{class:"catchup-info",children:[e(_,{icon:"info"})," ",e(m,{id:"AGyV7s"})]}):N===At[At.length-1].value&&E?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:C})," ",e(m,{id:"dDJEHI",values:{0:o.format(new Date(E))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(m,{id:"1atgyZ"})})}),!!O?.length&&e("div",{class:"catchup-prev",children:[e("p",{children:e(m,{id:"Yfb9A8"})}),e("ul",{children:O.map(A=>e("li",{children:[e(pe,{to:`/catchup?id=${A.id}`,children:[e(_,{icon:"history2"})," ",e("span",{children:A.startAt?o.formatRange(new Date(A.startAt),new Date(A.endAt)):`… – ${o.format(new Date(A.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:e(m,{id:"S6XZwv",values:{0:A.count}})})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{if(confirm(s({id:"D9CmP2"}))){let K=le(s({id:"xJUo4P",values:{0:A.id}}));await Ct.catchup.del(A.id),K?.hideToast?.(),le(s({id:"1dyGG/",values:{0:A.id}})),L()}},children:e(_,{icon:"x",alt:s({id:"t/YqKh"})})})]})]},A.id))}),O.length>=3&&e("p",{children:e("small",{children:e(m,{id:"sXmrl4"})})})]})]}),r==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(qe,{abrupt:!0}),e("p",{class:"insignificant",children:e(m,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(m,{id:"q9urQO"})})]}),r==="results"&&e(B,{children:[e("div",{class:"catchup-header",children:[b.length>0&&e("p",{children:e("b",{class:"ib",children:o.formatRange(new Date(b[0].createdAt),new Date(b[b.length-1].createdAt))})}),e("aside",{children:[e("button",{hidden:Z==="all"&&!Y&&ee==="createdAt"&&be==="asc",type:"button",class:"plain4 small",onClick:()=>{J("all"),W(null),me("createdAt"),fe(null),q("asc")},children:e(m,{id:"I9EnzM"})}),re?.length>0&&e("button",{type:"button",class:"plain small",onClick:()=>p(!f),children:[e(m,{id:"EIZREX"})," ",e(_,{icon:"chevron-down",style:{transform:f?"rotate(180deg)":"rotate(0deg)"}})]})]})]}),e("div",{class:"shazam-container no-animation",hidden:!f,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"catchup-top-links links-bar",children:re.map(A=>{const{card:D,shared:K,sharers:X,likes:z,boosts:de}=A,{blurhash:Me,title:we,description:Ee,url:U,image:ve,imageDescription:Le,language:Te,width:Qe,height:Ze,publishedAt:tt}=D,nn=Yi(U);let Lt;if(Me){const kt=es(Me),Ln=ps(kt);Lt=fs([.6,Ln[1],Ln[2]])}return e("a",{href:U,target:"_blank",rel:"noopener",class:"link-block",style:Lt?{"--accent-color":`rgb(${Lt.join(",")})`,"--accent-alpha-color":`rgba(${Lt.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:ve,alt:Le,width:Qe,height:Ze,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:nn})," ",!!tt&&e(B,{children:"· "}),!!tt&&e(B,{children:e(Rt,{datetime:tt,format:"micro"})})]}),!!we&&e("h1",{class:"title",lang:Te,dir:"auto",title:we,children:we})]}),!!Ee&&e("p",{class:"description",lang:Te,dir:"auto",title:Ee,children:Ee}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(m,{id:"bfSr6z",values:{0:X.map(kt=>{const{avatarStatic:Ln,displayName:Dc}=kt;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:vs=>{vs.preventDefault(),vs.stopPropagation();const{id:Nc}=kt;W(Nc),J("all")},children:e(lt,{url:Ln,size:"s",alt:Dc})})})}})})]})]})},U)})})})}),b.length>=5&&(ze==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:Ie}):e("div",{class:"catchup-posts-viz-bar",children:ie})),b.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:Z.toLowerCase()==="all",onChange:()=>{J("all")}}),e(m,{id:"N40H+G"})," ",e("span",{class:"count",children:b.length})]}),Object.entries(Ud).map(([A,D])=>!!Q[A]&&e("label",{class:"filter-cat",title:(Q[A]/b.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:Z.toLowerCase()===A.toLowerCase(),onChange:()=>{J(A),A==="boosts"&&(me("reblogsCount"),q("desc"),fe(null))}}),i(D)," ",e("span",{class:"count",children:Q[A]})]},i(D)))]}),b.length>=2&&!!Oe&&e("div",{class:"catchup-filters authors-filters",ref:Ne,children:[Se.map(A=>e("label",{class:"filter-author","data-author":A,children:[e("input",{type:"radio",name:"filter-author",checked:Y===A,onChange:()=>{W(A)},onClick:()=>{Y===A&&W(null)}}),e(lt,{url:Pe[A].avatarStatic||Pe[A].avatar,size:"xxl",alt:`${Pe[A].displayName} (@${Pe[A].acct})`})," ",e("span",{class:"count",children:Oe[A]}),e("span",{class:"username",children:Pe[A].username})]},`${A}-${Oe[A]}`)),Se.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(m,{id:"HHtYi7",values:{0:Se.length}})},"authors-count")]}),b.length>=2&&e("div",{class:"catchup-filters",children:[e("span",{class:"filter-label",children:e(m,{id:"f6Hub0"})})," ",e("fieldset",{class:"radio-field-group",children:Kd.map(A=>e("label",{class:"filter-sort",onClick:D=>{ee===A&&(D.preventDefault(),D.stopPropagation(),q(be==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:ee===A,onChange:()=>{me(A);const D=/(replies|favourites|reblogs|quotes)/.test(A)?"desc":"asc";q(D)}}),{createdAt:s({id:"mYGY3B"}),repliesCount:s({id:"N8UzTV"}),favouritesCount:s({id:"zZOZj7"}),reblogsCount:s({id:"puY2t0"}),quotesCount:s({id:"eWLklq"}),density:s({id:"0tQ7AD"})}[A],ee===A&&(be==="asc"?" ↑":" ↓")]},A))}),e("span",{class:"filter-label",children:e(m,{id:"group.filter"})})," ",e("fieldset",{class:"radio-field-group",children:Hd.map(A=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:V===A,onChange:()=>{fe(A)},disabled:A==="account"&&Y}),{account:s({id:"dpqPBg"})}[A]||s({id:"EdQY6l"})]},A||"none"))}),Y&&Se.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{W(null)},style:{whiteSpace:"nowrap"},children:e(m,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${Z||""} ${ee?`catchup-sort-${ee}`:""} ${Y&&Pe[Y]?"catchup-selected-author":""} ${V?`catchup-group-${V}`:""}`,children:ge.map((A,D)=>{const K=A.reblog?.id||A.id;let X=!1;return V==="account"&&(Re.current&&A.account.id!==Re.current&&D>0&&(X=!0),Re.current=A.account.id),e(B,{children:[X&&e("li",{class:"separator"}),e(Wd,{to:`/${a}/s/${K}`,post:A,root:Ce.current})]},`${A.id}-${X}`)})}),e("footer",{children:_e.length>5&&e("p",{children:[s(Z==="boosts"?{id:"eVosYr"}:{id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{Ce.current.scrollTop=0},children:e(m,{id:"0MgdN+"})}),"."]})})]})]})]}),De&&e(Fe,{onClose:()=>$e(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>$e(!1),children:e(_,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(m,{id:"c3XJ18"})})}),e("main",{children:e("dl",{children:[e("dt",{children:e(m,{id:"EIZREX"})}),e("dd",{children:e(m,{id:"YmGrIy"})}),e("dt",{children:e(m,{id:"coaNtr"})}),e("dd",{children:e(m,{id:"UUrqX1"})}),e("dt",{children:e(m,{id:"ScQBC/"})}),e("dd",{children:e(m,{id:"srocAr"})}),e("dt",{children:e(m,{id:"77Emn0"})}),e("dd",{children:e("table",{children:e("tbody",{children:[e("tr",{children:[e("td",{children:e(m,{id:"Gy9P9T"})}),e("td",{children:e("kbd",{children:"j"})})]}),e("tr",{children:[e("td",{children:e(m,{id:"6XYpYY"})}),e("td",{children:e("kbd",{children:"k"})})]}),e("tr",{children:[e("td",{children:e(m,{id:"f5dduh"})}),e("td",{children:e("kbd",{children:"l"})})]}),e("tr",{children:[e("td",{children:e(m,{id:"rj0vxZ"})}),e("td",{children:e("kbd",{children:"h"})})]}),e("tr",{children:[e("td",{children:e(m,{id:"jsFF8C"})}),e("td",{children:e("kbd",{children:"Enter"})})]}),e("tr",{children:[e("td",{children:e(m,{id:"bUUv3P"})}),e("td",{children:e("kbd",{children:"."})})]})]})})})]})})]})})]})}const Yd=ut(function({post:n}){const{id:i,account:s,group:o,reblog:c,quote:a,inReplyToId:u,inReplyToAccountId:l,_followedTags:d,_filtered:r,visibility:h,__BOOSTERS:f}=n,p=u&&l!==s.id,g=!!r&&r?.action!=="blur",y=w=>{w.shiftKey};return e("article",{class:`post-line ${o?"group":c?"reblog":Gt()&&di(a)?"quote":d?.length?"followed-tags":""} ${p?"reply-to":""} ${g?"filtered":""} visibility-${h}`,onMouseEnter:y,children:[e("span",{class:"post-author",children:c?e("span",{class:"post-reblog-avatar",children:[e(lt,{url:s.avatarStatic||s.avatar,squircle:s.bot}),f?.size>0?[...f].map(w=>e(lt,{url:w.avatarStatic||w.avatar,squircle:w.bot})):""," ",e(_,{icon:"rocket"})," ",e(yt,{account:c.account,showAvatar:!0})]}):di(a)?e("span",{class:"post-quote-avatar",children:[e(lt,{url:s.avatarStatic||s.avatar,squircle:s.bot})," ",e(_,{icon:"quote"})," ",e(yt,{account:a.quotedStatus?.account||a.account,showAvatar:!0})]}):e(yt,{account:s,showAvatar:!0})}),e(Xd,{post:c||n,filterInfo:r}),e("span",{class:"post-meta",children:[e(Qd,{post:c||n})," ",e(Rt,{datetime:new Date(c?.createdAt||n.createdAt),format:"micro"})]})]})},(n,i)=>n?.post?.id===i?.post?.id),Wd=({root:n,to:i,...s})=>{const o=j(),[c,a]=$(!1);return G(()=>{const u=new IntersectionObserver(l=>{l[0].isIntersecting&&(queueMicrotask(()=>a(!0)),u.unobserve(o.current))},{root:n,rootMargin:`${Math.max(320,screen.height*.75)}px`});return o.current&&u.observe(o.current),()=>{o.current&&u.unobserve(o.current)}},[]),c?e("li",{children:e(pe,{to:i,children:e(Yd,{...s})})}):e("li",{ref:o,style:{height:"4em"}})},Gd=8,Zd=8;function to(n){const{spoilerText:i,content:s,poll:o,mediaAttachments:c,card:a}=n,u=o?.options?.length?o.options.reduce((d,r)=>d+r.title,""):"";return(i.length+Lo(s)+u.length)/140+(c?.length?Gd*c.length:a?.image?Zd:0)}const Ot=48;function Xd({post:n,filterInfo:i}){const{_:s}=ce();let{spoilerText:o,sensitive:c,content:a,emojis:u,poll:l,mediaAttachments:d,card:r,inReplyToId:h,inReplyToAccountId:f,account:p,_thread:g,quote:y}=n;const w=h&&f===p.id||!!g;let k=Gt()&&di(y)?y.quotedStatus||y:null;(k?.spoilerText||k?.sensitive)&&(k=null),k?.emojis&&u.push(...k.emojis),!d?.length&&k?.mediaAttachments?.length&&(d=k.mediaAttachments);const S=!!Vi()["reading:expand:spoilers"],x=S||!o&&!c&&i?.action!=="blur",C=a?mi(n):"",T=!o||S;return e("div",{class:"post-peek",title:o?"":C,children:[e("span",{class:"post-peek-content",children:[w&&!T&&e(B,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),i&&i?.action!=="blur"?e("span",{class:"post-peek-filtered",children:i?.titlesStr?s({id:"suKjh3",values:{0:i.titlesStr}}):s({id:"03Qqf9"})}):e(B,{children:[!!o&&e("span",{class:"post-peek-spoiler",children:[e(_,{icon:`${S?"eye-open":"eye-close"}`})," ",o]}),T&&e("div",{class:"post-peek-html",children:[w&&e(B,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(m,{id:"e66y2Z"})})," "]}),!!a&&e("div",{dangerouslySetInnerHTML:{__html:Sa(a,u)+(k?.content?`
${k.content}
`:"")}}),!!l?.options?.length&&l.options.map(v=>e("div",{children:[l.multiple?"▪️":"•"," ",v.title]})),!a&&d?.length===1&&d[0].description&&e(B,{children:[e("span",{class:"post-peek-tag post-peek-alt",children:"ALT"})," ",e("div",{children:d[0].description})]})]})]})]}),(!i||i?.action==="blur")&&e("span",{class:"post-peek-post-content",children:[!!l&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(_,{icon:"poll",size:"s"}),e(m,{id:"4WUbF1"})]}),d?.length?d.map(v=>{const I=v.previewUrl||v.url,L=v.previewRemoteUrl||v.remoteUrl,E=v.meta?.original?v.meta.original.width:v.meta?.small?.width||v.meta?.original?.width,F=v.meta?.original?v.meta.original.height:v.meta?.small?.height||v.meta?.original?.height;return e("span",{class:"post-peek-media",children:{image:(I||L)&&x?e("img",{src:I,width:Ot,height:Ot,alt:v.description,loading:"lazy",onError:O=>{const{src:H}=O.target;H===I&&L&&I!==L&&(O.target.src=L)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(E,F)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(I||L)&&x?e("img",{src:I,width:Ot,height:Ot,alt:v.description,loading:"lazy",onError:O=>{const{src:H}=O.target;H===I&&L&&I!==L&&(O.target.src=L)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(I||L)&&x?e("img",{src:I,width:Ot,height:Ot,alt:v.description,loading:"lazy",onError:O=>{const{src:H}=O.target;H===I&&L&&I!==L&&(O.target.src=L)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[v.type]||null},v.id)}):!!r&&r.image&&x&&e("span",{class:`post-peek-media post-peek-card card-${r.type||""}`,children:r.image?e("img",{src:r.image,width:Ot,height:Ot,alt:r.title||r.description||r.imageDescription,loading:"lazy",style:{"--anim-duration":r.width&&r.height&&`${Math.min(Math.max(Math.max(r.width,r.height)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🔗"})})]})]})}function Qd({post:n}){const{_:i}=ce(),{reblogsCount:s,repliesCount:o,favouritesCount:c,quotesCount:a}=n;return e("span",{class:"post-stats",children:[o>0&&e("span",{class:"post-stat-replies",children:[e(_,{icon:"comment2",size:"s",alt:i({id:"N8UzTV"})})," ",Ke(o)]}),c>0&&e("span",{class:"post-stat-likes",children:[e(_,{icon:"heart",size:"s",alt:i({id:"zZOZj7"})})," ",Ke(c)]}),s>0||a>0?e("span",{class:"post-stat-boosts",children:[e(_,{icon:"rocket",size:"s",alt:i({id:"puY2t0"})})," ",s>0||a>0?`${s>0?Ke(s):""}${s>0&&a>0?"+":""}${a>0?Ke(a):""}`:Ke(s)]}):null]})}function Jd(n,i,s){const o=n.map(d=>new Date(d[i])),c=o.reduce((d,r)=>rr>d?r:d,o[0]),u=Math.min(a.getTime(),Date.now())-c.getTime(),l=Array.from({length:s},()=>[]);return n.forEach(d=>{const r=Date.parse(d[i]);if(r>Date.now())l[l.length-1].push(d);else{const h=(r-c.getTime())/u,f=Math.floor(h*(s-1));l[f].push(d)}}),l}const eu=20;function pc(){const{_:n}=ce();et(n({id:"zZOZj7"}),"/favourites");const{masto:i,instance:s}=oe(),o=j();async function c(a){return(a||!o.current)&&(o.current=i.v1.favourites.list({limit:eu}).values()),await o.current.next()}return e(Nt,{title:n({id:"zZOZj7"}),id:"favourites",emptyText:n({id:"PHIrMr"}),errorText:n({id:"khVljG"}),instance:s,fetchItems:c})}const tu=["home","public","notifications","thread","account"],no=["thread","account"],nu={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},iu=[0,1800,3600,360*60,720*60,3600*24,3600*24*7,3600*24*30],Mi={0:{id:"qqeAJM"},1800:at(30,"minute"),3600:at(1,"hour"),21600:at(6,"hour"),43200:at(12,"hour"),86400:at(24,"hour"),604800:at(7,"day"),2592e3:at(30,"day")};function su(){const{_:n}=ce(),{masto:i}=oe();et(n({id:"cSev+j"}),"/ft");const[s,o]=$("default"),[c,a]=$(!1),[u,l]=Et(h=>h+1,0),[d,r]=$([]);return G(()=>{o("loading"),(async()=>{try{const h=await i.v2.filters.list();h.sort((f,p)=>f.title.localeCompare(p.title)),h.forEach(f=>{f.keywords?.length&&f.keywords.sort((p,g)=>p.id-g.id)}),r(h),o("default")}catch{o("error")}})()},[u]),e("div",{id:"filters-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Kt,{}),e(pe,{to:"/",class:"button plain",children:e(_,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(m,{id:"cSev+j"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{a(!0)},children:e(_,{icon:"plus",size:"l",alt:n({id:"yFfBdX"})})})})]})}),e("main",{children:d.length>0?e(B,{children:[e("ul",{class:"filters-list",children:d.map(h=>{const{id:f,title:p,expiresAt:g,keywords:y}=h;return e("li",{children:[e("div",{children:[e("h2",{children:p}),y?.length>0&&e("div",{children:y.map(w=>e(B,{children:[e("span",{class:"tag collapsed insignificant",children:w.wholeWord?`“${w.keyword}”`:w.keyword})," "]}))}),e("small",{class:"insignificant",children:e(mc,{expiresAt:g})})]}),e("button",{type:"button",class:"plain",onClick:()=>{a({filter:h})},children:e(_,{icon:"pencil",size:"l",alt:"Edit filter"})})]},f)})}),d.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(m,{id:"5vzJxv",values:{0:d.length}})})})]}):s==="loading"?e("p",{class:"ui-state",children:e(qe,{})}):s==="error"?e("p",{class:"ui-state",children:e(m,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(m,{id:"cWIHTt"})})})]}),!!c&&e(Fe,{title:n({id:"vCSBPD"}),onClose:()=>{a(!1)},children:e(au,{filter:c?.filter,onClose:h=>{h.state==="success"&&l(),a(!1)}})})]})}let ou=1;const cu=()=>ou++;function au({filter:n,onClose:i}){const{_:s,_:o}=ce(),{masto:c}=oe(),[a,u]=$("default"),l=!!n,{context:d,expiresAt:r,id:h,keywords:f,title:p,filterAction:g}=n||{},y=!!r,w=y&&new Date(r),[k,b]=$(f||[]),S=j(),[x,C]=$([]),[T,v]=$([]),I=k.filter(L=>!x.includes(L.id)&&!T.includes(L._id));return e("div",{class:"sheet",id:"filters-add-edit-modal",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(_,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:o(l?{id:"3mOee6"}:{id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:L=>{L.preventDefault();const E=new FormData(L.target),F=E.get("title"),O=E.getAll("keyword_attributes[][id]"),H=E.getAll("keyword_attributes[][keyword]"),Q=[...S.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(W=>W.checked),re=H.map((W,N)=>({id:O[N]||void 0,keyword:W,wholeWord:Q[N]}));l&&x?.length&&x.forEach(W=>{re.push({id:W,_destroy:!0})});const Z=E.getAll("context");let J=E.get("expires_in");const Y=E.get("filter_action");!F||!Z?.length||(u("loading"),(async()=>{try{let W;l?(J===""||J===null?y?J=Math.floor((w-Date.now())/1e3):J=null:J==="0"||J===0?J=null:J=+J,W=await c.v2.filters.$select(h).update({title:F,context:Z,expiresIn:J,keywordsAttributes:re,filterAction:Y})):(J=+J||null,W=await c.v2.filters.create({title:F,context:Z,expiresIn:J,keywordsAttributes:re,filterAction:Y})),u("default"),i?.({state:"success",filter:W})}catch{u("error"),alert(o(l?{id:"H8RP+h"}:{id:"Fr0hAN"}))}})())},children:[e("div",{class:"filter-form-row",children:e("label",{children:[e("b",{children:e(m,{id:"MHrjPM"})}),e("input",{type:"text",name:"title",defaultValue:p,disabled:a==="loading",dir:"auto",enterKeyHint:"done",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:S,children:[I.length?e("ul",{class:"filter-keywords",children:I.map(L=>{const{id:E,keyword:F,wholeWord:O,_id:H}=L;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:E}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:F,disabled:a==="loading",required:!0,dir:"auto",enterKeyHint:"done"}),e("div",{class:"filter-keyword-actions",children:[e("label",{children:[e("input",{name:"keyword_attributes[][whole_word]",type:"checkbox",value:E,defaultChecked:O,disabled:a==="loading"})," ",e(m,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:a==="loading",onClick:()=>{E?(x.push(E),C([...x])):H&&(T.push(H),v([...T]))},children:e(_,{icon:"x",alt:o({id:"t/YqKh"})})})]})]},`${E}-${H}`)})}):e("div",{class:"filter-keywords",children:e("div",{class:"insignificant",children:e(m,{id:"SYKm3p"})})}),e("footer",{class:"filter-keywords-footer",children:[e("button",{type:"button",class:"light",onClick:()=>{b([...k,{_id:cu(),keyword:"",wholeWord:!0}]),setTimeout(()=>{const L=S.current.querySelectorAll('input[type="text"]');L[L.length-1]?.focus?.()},10)},children:e(m,{id:"qn5Dbn"})})," ",I?.length>1&&e("small",{class:"insignificant",children:e(m,{id:"1JZ175",values:{0:I.length}})})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:e(m,{id:"uqf7Yq"})})}),tu.map(L=>e("div",{children:[e("label",{class:no.includes(L)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:L,defaultChecked:d?d.includes(L):!0,disabled:a==="loading"})," ",s(nu[L]),no.includes(L)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(m,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[l&&e(m,{id:"ucJk3m",components:{0:e("b",{}),1:e(mc,{expiresAt:r,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:o(l?{id:"BcNdg+"}:{id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:a==="loading",defaultValue:l?void 0:0,children:[l&&e("option",{}),iu.map(L=>e("option",{value:L,children:typeof Mi[L]=="function"?Mi[L]():s(Mi[L])}))]})]}),e("p",{children:[e(m,{id:"blQMpa"}),e("br",{}),wo()?.mastodon>=5&&e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"blur",defaultChecked:g==="blur",disabled:a==="loading"})," ",e(m,{id:"ggxOw9"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:g!=="hide"&&g!=="blur"||!l,disabled:a==="loading"})," ",e(m,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:g==="hide",disabled:a==="loading"})," ",e(m,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:a==="loading",children:o(l?{id:"tfDRzk"}:{id:"hYgDIe"})})," ",e(qe,{abrupt:!0,hidden:a!=="loading"})]}),l&&e(ft,{disabled:a==="loading",align:"end",menuItemClassName:"danger",confirmLabel:o({id:"BPjyR2"}),onClick:()=>{u("loading"),(async()=>{try{await c.v2.filters.$select(h).remove(),u("default"),i?.({state:"success"})}catch{u("error"),alert(o({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:a==="loading",children:e(m,{id:"Jb6/SB"})})})]})]})})]})}function mc({expiresAt:n,showNeverExpires:i}){const{_:s}=ce(),o=!!n,c=o&&new Date(n),a=o&&Date.parse(n)<=Date.now(),[u,l]=Et(d=>d+1,0);return Qi(l,a||3e4),a?s({id:"M1RnFv"}):o?e(m,{id:"urGtsw",components:{0:e(Rt,{datetime:c})}}):i&&s({id:"O1Aswy"})}function ru(){const{_:n}=ce(),{masto:i,instance:s}=oe();et(n({id:"Xi1/bw"}),"/fh");const[o,c]=$("default"),[a,u]=$([]);return G(()=>{c("loading"),(async()=>{try{const l=await ri();u(l),c("default")}catch{c("error")}})()},[]),e("div",{id:"followed-hashtags-page",class:"deck-container",tabIndex:"-1",children:e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Kt,{}),e(pe,{to:"/",class:"button plain",children:e(_,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(m,{id:"Xi1/bw"})}),e("div",{class:"header-side"})]})}),e("main",{children:a.length>0?e(B,{children:[e("ul",{class:"link-list",children:a.map(l=>e("li",{children:e(pe,{to:s?`/${s}/t/${l.name}`:`/t/${l.name}`,children:[e(_,{icon:"hashtag",alt:"#"})," ",e("span",{children:l.name})]})}))}),a.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(m,{id:"2S/uvJ",values:{0:a.length}})})})]}):o==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):o==="error"?e("p",{class:"ui-state",children:e(m,{id:"2AeREO"})}):e("p",{class:"ui-state",children:e(m,{id:"vKsGhk"})})})]})})}const lu=20;function ys({title:n,path:i,id:s,...o}){const{_:c}=ce();et(n||c({id:"following.title"}),i||"/following");const{masto:a,streaming:u,instance:l,client:d}=oe(),[r,h]=$(u),f=We(R),p=j(),g=j(),y=j();G(()=>{!u&&d?.onStreamingReady&&d.onStreamingReady(S=>{h(S)})},[d]),__BENCHMARK.end("time-to-following");const w=Xe("@pixelfed/home-include-reblogs");async function k(S){(S||!g.current)&&(__BENCHMARK.start("fetch-home-first"),p.current=a.v1.timelines.home.list({limit:lu}),g.current=p.current.values()),w&&p.current?.params&&(typeof p.current.params=="string"?p.current.params+="&include_reblogs=true":p.current.params.include_reblogs=!0);const x=await g.current.next();let{value:C}=x;if(C?.length){let T=!1;S&&(C[0].id!==y.current&&(T=!0),y.current=C[0].id),C.forEach(v=>{Je(v,l)}),C=Qs(C,l),S&&T&&Id(),setTimeout(()=>{dc(C,l)},100),C.sort((v,I)=>Date.parse(I.createdAt)-Date.parse(v.createdAt))}return __BENCHMARK.end("fetch-home-first"),{...x,value:C}}async function b(){try{const S={limit:5,since_id:y.current};Xe("@pixelfed/home-include-reblogs")&&(S.include_reblogs=!0);const x=await a.v1.timelines.home.list(S).values().next();let{value:C}=x;const T=C[0]?.id===y.current;return!!(C?.length&&!T&&(y.current=C[0].id,C=Qs(C,l),C=Xt(C,"home"),C.some(v=>!v.reblog)))}catch{return!1}}return G(()=>{let S;return(async()=>{if(r){S=r.user.subscribe();for await(const x of S){if(!S)break;if(x.event==="status.update"){const C=x.payload;Je(C,l)}else if(x.event==="delete"){const C=x.payload,T=ko(C,l);T&&(T._deleted=!0)}}}})(),()=>{S?.unsubscribe?.(),S=null}},[r]),e(Nt,{title:n||c({id:"following.title"}),id:s||"following",emptyText:c({id:"nJEKbY"}),errorText:c({id:"7QSeK6"}),instance:l,fetchItems:k,checkForUpdates:b,useItemID:!0,boostsCarousel:f.settings.boostsCarousel,...o,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const du={"disabled.example.com":"disabled","authenticated.example.com":"authenticated"};async function io(n,i){const s=ke.local.getJSON("instances")||{};let o=s[i?.toLowerCase()];if(!o?.configuration?.timelinesAccess){const a=await n.v2.instance.fetch().catch(()=>null);a&&(o=a,s[i?.toLowerCase()]=a,ke.local.setJSON("instances",s))}return o}async function gc({feed:n,feedType:i,feeds:s,instance:o}){const{masto:c,instance:a}=oe({instance:o}),u=o||a;try{const l=du[u?.toLowerCase()];if(s){if(l){const p={};return s.forEach(({feed:g,feedType:y})=>{p[`${g}_${y}`]=l}),p}const h=await io(c,u),f={};return s.forEach(({feed:p,feedType:g})=>{f[`${p}_${g}`]=h?.configuration?.timelinesAccess?.[p]?.[g]||"public"}),f}return l||(await io(c,u))?.configuration?.timelinesAccess?.[n]?.[i]||"public"}catch{return s?{}:"public"}}const uu=20,hu=4,so=hu+1;function yc({media:n,columnMode:i,...s}){const{_:o}=ce();let{hashtag:c,...a}=i?{}:Ut();s.hashtag&&(c=s.hashtag);let u=c.trim().split(/[\s+]+/);u.sort(),c=u[0];const[l,d]=xt(),r=n||!!l.get("media"),h=r?"?media=1":"",{masto:f,instance:p,authenticated:g}=oe({instance:s?.instance||a.instance}),{masto:y,instance:w,authenticated:k}=oe(),b=u.map(q=>`#${q}`).join(" "),S=o(p?r?{id:"kH0rA0",values:{hashtagTitle:b,instance:p}}:{id:"IK0zKi",values:{hashtagTitle:b,instance:p}}:r?{id:"hHSI3w",values:{hashtagTitle:b}}:{id:"+ZzjRY",values:{hashtagTitle:b}});et(S,"/:instance?/t/:hashtag");const x=j(),C=xe(()=>Gi(),[]),[T,v]=$(null),I=T==="disabled",E=T==="authenticated"&&!g,F=j(void 0);async function O(q){const V=await gc({feed:"hashtagFeeds",feedType:"local",instance:p});if(v(V),V==="disabled"||V==="authenticated"&&!g)return{done:!0,value:[]};const fe=await f.v1.timelines.tag.$select(c).list({limit:uu,any:u.slice(1),maxId:q?void 0:F.current,onlyMedia:r?!0:void 0}).values().next();let{value:_e}=fe;return _e?.length&&(q&&(x.current=_e[0].id),_e.forEach(Pe=>{Je(Pe,p,{skipThreading:r||C})}),F.current=_e[_e.length-1].id),{...fe,value:_e}}async function H(){try{const q=await f.v1.timelines.tag.$select(c).list({limit:1,any:u.slice(1),since_id:x.current,onlyMedia:r}).values().next();let{value:V}=q;const fe=V[0]?.id===x.current;return V?.length&&!fe?(V=Xt(V,"public"),!0):!1}catch{return!1}}const[Q,re]=$("default"),[Z,J]=$();G(()=>{(async()=>{try{const q=await f.v1.tags.$select(c).fetch();J(q)}catch{}})()},[c]);const Y=u.length>=so,[W,N]=$("default"),[te,ee]=$([]),[me,be]=$(!1);return G(()=>{g&&(async()=>{try{const q=await f.v1.featuredTags.list();ee(q),be(q.some(V=>V.name.toLowerCase()===c.toLowerCase()))}catch{}})()},[]),e(B,{children:[e(Nt,{title:S,titleComponent:!!p&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:b}),e("div",{children:p})]}),id:"hashtag",instance:p,emptyText:o(I?{id:"qbE/m4"}:E?{id:"aqJggz"}:{id:"CNSLAW"}),errorText:o({id:"yjj6Ll"}),fetchItems:O,checkForUpdates:H,useItemID:!0,view:r||C?"media":void 0,refresh:r,filterContext:"public",headerEnd:e(mt,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(_,{icon:"more",size:"l",alt:o({id:"2FYpfJ"})})}),children:[!!Z&&u.length===1&&e(B,{children:[e(ft,{subMenu:!0,confirm:Z.following,confirmLabel:o({id:"ctJi7k",values:{hashtag:c}}),disabled:Q==="loading"||!g,onClick:()=>{re("loading"),Z.following?f.v1.tags.$select(c).unfollow().then(()=>{J({...Z,following:!1}),le(o({id:"doK/ij",values:{hashtag:c}}))}).catch(q=>{alert(q)}).finally(()=>{re("default")}):f.v1.tags.$select(c).follow().then(()=>{J({...Z,following:!0}),le(o({id:"R9+aEN",values:{hashtag:c}}))}).catch(q=>{alert(q)}).finally(()=>{re("default")})},children:Z.following?e(B,{children:[e(_,{icon:"check-circle"})," ",e("span",{children:e(m,{id:"HOSk7R"})})]}):e(B,{children:[e(_,{icon:"plus"})," ",e("span",{children:e(m,{id:"MKEPCY"})})]})}),e(ye,{type:"checkbox",checked:me,disabled:W==="loading"||!g,onClick:()=>{if(N("loading"),me){const q=te.find(V=>V.name.toLowerCase()===c.toLowerCase()).id;q?f.v1.featuredTags.$select(q).remove().then(()=>{be(!1),le(o({id:"VH+Tf9"})),ee(te.filter(V=>V.id!==q))}).catch(V=>{}).finally(()=>{N("default")}):le(o({id:"3OLv47"}))}else f.v1.featuredTags.create({name:c}).then(q=>{be(!0),le(o({id:"9ra4hn"})),ee(te.concat(q))}).catch(q=>{}).finally(()=>{N("default")})},children:me?e(B,{children:[e(_,{icon:"check-circle"}),e("span",{children:e(m,{id:"9ra4hn"})})]}):e(B,{children:[e(_,{icon:"check-circle"}),e("span",{children:e(m,{id:"UlJ3QN"})})]})}),e(Ye,{})]}),!C&&e(B,{children:[e(ts,{className:"plain",children:e(m,{id:"cSev+j"})}),e(ye,{type:"checkbox",checked:!!r,onClick:()=>{r?l.delete("media"):l.set("media","1"),d(l)},children:[e(_,{icon:"check-circle",alt:"☑️"})," ",e("span",{class:"menu-grow",children:e(m,{id:"eK4SL/"})})]}),e(Ye,{})]}),e(Ca,{className:"menu-field",disabled:Y,children:({ref:q})=>e("form",{onSubmit:V=>{V.preventDefault();const fe=V.target[0].value?.trim?.();fe&&!u.some(_e=>_e.toLowerCase()===fe.toLowerCase())&&(u.push(fe),u.sort(),location.hash=p?`/${p}/t/${u.join("+")}${h}`:`/t/${u.join("+")}${h}`)},children:[e(_,{icon:"hashtag"}),e("input",{ref:q,type:"text",placeholder:Y?he._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:so}}):o({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^##][^\\s##]+[^##]",disabled:Y,dir:"auto",enterKeyHint:"go"})]})}),e(_a,{takeOverflow:!0,children:u.map((q,V)=>e(ye,{disabled:u.length===1,onClick:fe=>{u.splice(V,1),u.sort(),location.hash=p?`/${p}/t/${u.join("+")}${h}`:`/t/${u.join("+")}${h}`},children:[e(_,{icon:"x",alt:o({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),q]})]},q))}),e(Ye,{}),e(ye,{disabled:!k,onClick:()=>{if(R.shortcuts.length>=Pt){alert(he._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:Pt}}));return}const q={type:"hashtag",hashtag:u.join(" "),instance:p,media:r?"on":void 0};R.shortcuts.some(fe=>fe.type===q.type&&fe.hashtag.split(/[\s+]+/).sort().join(" ")===q.hashtag.split(/[\s+]+/).sort().join(" ")&&(fe.instance?fe.instance===q.instance:!0)&&(fe.media?!!fe.media==!!q.media:!0))?alert(o({id:"kfeQnS"})):(R.shortcuts.push(q),le(o({id:"MIhb91"})))},children:[e(_,{icon:"shortcut"})," ",e("span",{children:e(m,{id:"i02Lq/"})})]}),e(ye,{onClick:()=>{let q=prompt(o({id:"4CZnNE"}));if(!/\./.test(q)){q&&alert(o({id:"Q5COHO"}));return}q&&(q=q.toLowerCase().trim(),location.hash=`/${q}/t/${u.join("+")}${h}`)},children:[e(_,{icon:"bus"})," ",e("span",{children:e(m,{id:"kesYbo"})})]}),w!==p&&e(ye,{onClick:()=>{location.hash=`/${w}/t/${u.join("+")}${h}`},children:[e(_,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(m,{id:"/AfxaA",values:{currentInstance:w},components:{0:e("b",{})}})})]})]})},p+b),!i&&!!u?.length&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`${u.length>1?` `:" "}${b}`}})})]})}const fu=20;function vc(n){const{_:i}=ce(),s=We(R),{masto:o,instance:c}=oe(),a=n?.id||Ut()?.id,u=j(),l=j();async function d(S){(S||!l.current)&&(l.current=o.v1.timelines.list.$select(a).list({limit:fu}).values());const x=await l.current.next();let{value:C}=x;return C?.length&&(S&&(u.current=C[0].id),C.forEach(T=>{Je(T,c)})),{...x,value:C}}async function r(){try{const S=await o.v1.timelines.list.$select(a).list({limit:1,since_id:u.current});let{value:x}=S;const C=x[0]?.id===u.current;return x?.length&&!C?(x=Xt(x,"home"),!0):!1}catch{return!1}}const[h,f]=$([]),[p,g]=$({title:"List"});et(p.title,"/l/:id"),G(()=>{(async()=>{try{const S=await Yo(a);g(S)}catch{}})()},[a]);const[y,w]=$(!1),[k,b]=$(!1);return e(B,{children:[e(Nt,{title:p.title,id:"list",emptyText:i({id:"KkDhfU"}),errorText:i({id:"7QSeK6"}),instance:c,fetchItems:d,checkForUpdates:r,useItemID:!0,boostsCarousel:s.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(mt,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(_,{icon:"list",size:"l",alt:i({id:"h16FyT"})}),e(_,{icon:"chevron-down",size:"s"})]}),onMenuChange:S=>{S.open&&fn().then(f)},children:[e(Ve,{to:"/l",children:e("span",{children:e(m,{id:"BHWx+g"})})}),h?.length>0&&e(B,{children:[e(Ye,{}),h.map(S=>e(Ve,{to:`/l/${S.id}`,children:e("span",{children:[S.title,S.exclusive&&e(B,{children:[" ",e(Jt,{})]})]})},S.id))]})]}),headerEnd:e(mt,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(_,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[p?.exclusive&&e(B,{children:[e(ts,{className:"plain",children:[e(Jt,{})," ",e(m,{id:"FNptcJ"})]}),e(Ye,{})]}),e(ye,{onClick:()=>w({list:p}),children:[e(_,{icon:"pencil",size:"l"}),e("span",{children:e(m,{id:"ePK91l"})})]}),e(ye,{onClick:()=>b(!0),children:[e(_,{icon:"group",size:"l"}),e("span",{children:e(m,{id:"hB02vO"})})]})]})},a),y&&e(Fe,{onClick:S=>{S.target===S.currentTarget&&w(!1)},children:e(hs,{list:y?.list,onClose:S=>{S.state==="success"&&S.list?g(S.list):S.state==="deleted"&&(location.hash="/l"),w(!1)}})}),k&&e(Fe,{onClick:S=>{S.target===S.currentTarget&&b(!1)},children:e(mu,{listID:a,onClose:()=>b(!1)})})]})}const pu=40;function mu({listID:n,onClose:i}){const{_:s}=ce(),{masto:o,instance:c}=oe(),[a,u]=$([]),[l,d]=$("default"),[r,h]=$(!1),f=j();async function p(g){h(!1),d("loading"),(async()=>{try{(g||!f.current)&&(f.current=o.v1.lists.$select(n).accounts.list({limit:pu}).values());const y=await f.current.next();let{done:w,value:k}=y;k?.length?(u(g?k:a.concat(k)),h(!w)):h(!1),d("default")}catch{d("error")}})()}return G(()=>{p(!0)},[]),e("div",{class:"sheet",id:"list-manage-members-container",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(_,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(m,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[a.map(g=>e("li",{children:[e(vt,{account:g,instance:c}),e(gu,{account:g,listID:n})]},g.id)),r&&l==="default"&&e(Dt,{as:"li",onChange:g=>g&&p(),children:e("button",{type:"button",class:"light block",onClick:p,children:e(m,{id:"uXRAkV"})})})]})})]})}function gu({account:n,listID:i}){const{_:s}=ce(),{masto:o}=oe(),[c,a]=$("default"),[u,l]=$(!1);return e(ft,{confirm:!u,confirmLabel:e("span",{children:e(m,{id:"j5n9Ry",values:{0:n.username},components:{0:e("span",{class:"bidi-isolate"})}})}),align:"end",menuItemClassName:"danger",onClick:()=>{u?(a("loading"),(async()=>{try{await o.v1.lists.$select(i).accounts.create({accountIds:[n.id]}),a("default"),l(!1)}catch{a("error")}})()):(a("loading"),(async()=>{try{await o.v1.lists.$select(i).accounts.remove({accountIds:[n.id]}),a("default"),l(!0)}catch{a("error")}})())},children:e("button",{type:"button",class:`light ${u?"":"danger"}`,disabled:c==="loading",children:s(u?{id:"m16xKo"}:{id:"MWIaew"})})})}const yu={mention:["account","status"],quote:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]},vu=["favourite","reblog","follow","admin.sign_up"],bc=n=>vu.includes(n);function wc(n){return n.filter(i=>{const{type:s,id:o,createdAt:c}=i;if(!s)return!1;const a=yu[s];return a?.length?a.every(u=>!!i[u]):!0})}function kc(n){if(n?.notificationGroups){const{accounts:i=[],notificationGroups:s=[],statuses:o=[]}=n;return s.map(c=>{const{sampleAccountIds:a,statusId:u}=c,l=a?.map(r=>i.find(h=>h.id===r))||[],d=o?.find(r=>r.id===u)||null;return{...c,sampleAccounts:l,status:d}})}return n}function bu(n){const i=n.map(u=>{const{latestPageNotificationAt:l,mostRecentNotificationId:d,sampleAccounts:r,notificationsCount:h}=u;return{id:""+d,createdAt:l,account:r[0],...u}}),s={},o=[];for(let u=0;u0&&p?.length>0&&f>p?.length)&&(d==="favourite"||d==="reblog")&&(w="favourite+reblog");const b=`${r?.id}-${w}-${y}`,S=s[b];if(bc(d))if(S)p.forEach(x=>{const C=S.sampleAccounts.find(T=>T.id===x.id);C?(C._types.push(d),C._types.sort().reverse()):S.sampleAccounts.push({...x,_types:[d]})}),S.notificationsCount=Math.min(S.notificationsCount,f),S._notificationsCount.push(f),S._sampleAccountsCount.push(p?.length),S._accounts=S.sampleAccounts,g&&S._groupKeys.push(g);else{const x=p.map(C=>({...C,_types:[d]}));s[b]={...l,sampleAccounts:x,type:w,_accounts:x,_groupKeys:g?[g]:[],_notificationsCount:[f],_sampleAccountsCount:[p?.length]},o.push(s[b])}else{if((d==="mention"||d==="quote")&&r?.id){const x=o.find(C=>(d==="quote"&&C.type==="mention"||d==="mention"&&C.type==="quote")&&C.status?.id===r.id);if(x){x.type="mention+quote";continue}}o.push(l)}}const c={},a=[];for(let u=0;uS.id===h.id);b?(b._types.push(f),b._types.sort().reverse(),k._ids+=`-${d}`):(h._types=[f],k._accounts.push(h),k._ids+=`-${d}`)}else{h&&(h._types=[f]);let b=i[w]={...l,type:y,_ids:d,_accounts:h?[h]:[]};s[u++]=b}}const o={},c=[];for(let a=0,u=0;a{const E=L.account?.id;return!E||E===I?!1:f.current[E]?.following===!0})}async function w(v){(v||!p.current)&&(p.current=o.v1.notifications.list({limit:oo,types:["mention"]}).values());const I=await p.current.next();let{value:L}=I;if(L?.length){L=wc(L),v&&(g.current=L[0].id),L.forEach(({status:F})=>{Je(F,c)});let E=L.map(F=>F.status);if(r&&E?.length){const F=E.map(H=>H.account),O=await dn(F,f.current);O&&(f.current={...f.current,...O}),E=y(E)}return{...I,value:E}}return{...I,value:L?.map(E=>E.status)}}const k=j(),b=j();async function S(v){(v||!k.current)&&(k.current=o.v1.conversations.list({limit:oo}).values());const I=await k.current.next();let{value:L}=I;if(L=L?.filter(E=>E.lastStatus),L?.length){v&&(b.current=L[0].lastStatus.id),L.forEach(({lastStatus:F})=>{Je(F,c)});let E=L.map(F=>F.lastStatus);if(r&&E?.length){const F=E.map(H=>H.account),O=await dn(F,f.current);O&&(f.current={...f.current,...O}),E=y(E)}return{...I,value:E}}return{...I,value:L?.map(E=>E.lastStatus)}}function x(...v){return d==="private"?S(...v):w(...v)}async function C(){if(d==="private")try{const v=await o.v1.conversations.list({limit:1,since_id:b.current}).values().next();let{value:I}=v;const L=I[0]?.id===b.current;return I?.length&&!L?(b.current=I[0].lastStatus.id,!0):!1}catch{return!1}else try{const v=await o.v1.notifications.list({limit:1,types:["mention"],since_id:g.current}).values().next();let{value:I}=v;return I?.length?(g.current=I[0].id,!0):!1}catch{return!1}}const T=xe(()=>e(B,{children:[e("div",{id:"followings-option",children:e("label",{children:[e("input",{type:"checkbox",checked:r,onChange:v=>{h(v.target.checked)}})," ",e(m,{id:"h4JxWH"})]})}),e("div",{class:"filter-bar",children:[e(pe,{to:"/mentions",class:d?"":"is-active",onClick:v=>{n&&(v.preventDefault(),l(null))},children:e(m,{id:"N40H+G"})}),e(pe,{to:"/mentions?type=private",class:d==="private"?"is-active":"",onClick:v=>{n&&(v.preventDefault(),l("private"))},children:e(m,{id:"zwBp5t"})})]})]}),[d,r]);return e(Nt,{title:s({id:"/bZzdR"}),id:"mentions",emptyText:s({id:"03jFGT"}),errorText:s({id:"pqR9KF"}),instance:c,fetchItems:x,checkForUpdates:C,useItemID:!0,timelineStart:T,refresh:`${d}-${r}`,filterContext:"notifications"})}const Su=80,Cu=20,_u=new URLSearchParams,Nn={block:"start",inline:"center",behavior:"instant"},Cc=Zi(()=>wo()?.mastodon>=2,{expires:1e3*60*5});function _c(n={}){const{masto:i}=oe();return Cc()?i.v2.notifications.list({limit:Cu,...n}):i.v1.notifications.list({limit:Su,...n})}function Ic(n={}){return _c(n).values()}function xc(n){return Cc()?bu(n):wu(n)}const Iu=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],xu={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function Au({columnMode:n}){const{_:i,_:s}=ce();et(s({id:"iDNBZe"}),"/notifications");const{masto:o,instance:c}=oe(),a=We(R),[u,l]=$("default"),[d]=n?[_u]:xt(),r=d.get("id"),h=d.get("access_token"),[f,p]=$(!1),[g,y]=$(!1),[w,k]=$(!1),[b,S]=$(!1),x=j(),{nearReachEnd:C,scrollDirection:T,reachStart:v,nearReachStart:I}=xd({scrollableRef:x}),L=T==="end"&&!I,[E,F]=$([]),[O,H]=$([]),Q=j(),re=j();async function Z(M){if((M||!re.current)&&(Q.current=_c({excludeTypes:["follow_request"]}),re.current=Q.current.values()),/max_id=($|&)/i.test(re.current?.nextParams))return{done:!0};const A=await re.current.next(),D=kc(A.value);if(D?.length){D.forEach(X=>{Je(X.status,c,{skipThreading:!0})});const K=xc(D);M?(R.notificationsLast=K[0],R.notifications=K,o.v1.markers.create({notifications:{lastReadId:K[0].id}}).catch(()=>{}),Oe(K)):R.notifications.push(...K)}return R.notificationsShowNew=!1,R.notificationsLastFetchTime=Date.now(),A}async function J(){try{return await o.v1.followRequests.list({limit:80})}catch{return[]}}const Y=()=>{l("loading"),(async()=>{try{const M=await J();F(M),l("default")}catch{l("error")}})()};async function W(){try{return await o.v1.announcements.list()}catch{return[]}}const N=Xe("@mastodon/filtered-notifications"),[te,ee]=$(!1),[me,be]=$({});function q(){return o.v2.notifications.policy.fetch().catch(()=>{})}function V(){q().then(M=>{be(M)}).catch(()=>{})}const[fe,_e]=$(null);function Pe(){return o.v1.notifications.requests.list()}const Oe=M=>{if(w)return;const A=M.length,D=M.reduce((Le,Te)=>Le+(Te.notificationsCount||1),0),K=M.filter(Le=>Le.type==="mention").length,X={},z={};M.forEach(Le=>{const{createdAt:Te,notificationsCount:Qe,type:Ze}=Le,tt=new Date(Te).toDateString();z[tt]=(z[tt]||0)+(Qe||1),Ze==="mention"&&(X[tt]=(X[tt]||0)+1)});const Me=(A>0?K/A:0)<.33,we=Object.values(X).some(Le=>Le>30),Ee=M.some(Le=>Le.notificationsCount>30),U={};let ve=!1;for(const Le of M){const{createdAt:Te,notificationsCount:Qe}=Le,tt=new Date(Te).toISOString().slice(0,13);if(U[tt]=(U[tt]||0)+(Qe||1),U[tt]>30){ve=!0;break}}k(Me||we||Ee||ve),S(Date.now())},ae=M=>{ge(!1),l("loading"),(async()=>{try{const A=Z(M);M&&(W().then(K=>{K.sort((X,z)=>Date.parse(z.updatedAt||z.createdAt)-Date.parse(X.updatedAt||X.createdAt)),H(K)}).catch(()=>{}),J().then(K=>{F(K)}).catch(()=>{}),N&&V());const{done:D}=await A;p(!D),l("default")}catch{l("error")}})()};G(()=>{ae(!0)},[]),G(()=>{v&&ae(!0)},[v]);const[Se,ge]=$(!1),Re=nt(({disableIdleCheck:M=!1}={})=>{u!=="loading"&&a.settings.autoRefresh&&x.current?.scrollTop<16&&(M||window.__IDLE__)&&!Tu()&&ae(!0)},[a.notificationsShowNew,a.settings.autoRefresh,u]),Ne=j();un(M=>{if(M){const A=Date.now()-Ne.current;!Ne.current||A>1e3*3?Re({disableIdleCheck:!0}):Ne.current=Date.now()}});const Be=j(!0);G(()=>{let M=Wc(R,"notificationsShowNew",A=>{if(Be.current){Be.current=!1;return}u!=="loading"&&(A&&Re(),ge(A))});return()=>M?.()},[]);const ze=new Date,ie=new Date(ze-1440*60*1e3);let Ie=new Date;const Ce=!a.notifications.some(M=>new Date(M.createdAt).toDateString()===ze.toDateString()),se=j();G(()=>{r&&(R.routeNotification={id:r,accessToken:atob(h)})},[r,h]);const[De,$e]=$(null);G(async()=>{const M=new Date;if(M.getMonth()!==11)return;const A=M.getFullYear();if(!Xe("@mastodon/annual-report"))return;let D=ke.account.get("annualReportNotification");if(D&&D?.annualReport?.year==A){$e(D);return}const K=Ic({types:["annual_report"]});try{D=(await K.next())?.value?.notificationGroups?.[0],D?.annualReport?.year==A&&($e(D),ke.account.set("annualReportNotification",D))}catch{}},[]);const Ae=".notification",ne=He("j",()=>{const M=document.activeElement.closest(Ae),A=M?.getBoundingClientRect(),D=Array.from(x.current.querySelectorAll(Ae));if(M&&A.top0){const K=D.indexOf(M);let X=D[K+1];X&&(X.focus(),X.scrollIntoView(Nn))}else{const K=D.find(X=>{const z=X.getBoundingClientRect();return z.top>=44&&z.left>=0});K&&(K.focus(),K.scrollIntoView(Nn))}},{useKey:!0,ignoreEventWhen:M=>M.metaKey||M.ctrlKey||M.altKey||M.shiftKey}),Ue=He("k",()=>{const M=document.activeElement.closest(Ae),A=M?.getBoundingClientRect(),D=Array.from(x.current.querySelectorAll(Ae));if(M&&A.top0){const K=D.indexOf(M);let X=D[K-1];X&&(X.focus(),X.scrollIntoView(Nn))}else{const K=D.find(X=>{const z=X.getBoundingClientRect();return z.top>=44&&z.left>=0});K&&(K.focus(),K.scrollIntoView(Nn))}},{useKey:!0,ignoreEventWhen:M=>M.metaKey||M.ctrlKey||M.altKey||M.shiftKey}),wt=He(["enter","o"],()=>{const A=document.activeElement.closest(Ae)?.querySelector(".status-link");A&&A.click()},{useKey:!0,ignoreEventWhen:M=>M.metaKey||M.ctrlKey||M.altKey||M.shiftKey}),st=new Date,P=xe(()=>rt(st,{forceOpts:{weekday:"long"}}),[st]);return e("div",{id:"notifications-page",class:"deck-container",ref:M=>{x.current=M,ne.current=M,Ue.current=M,wt.current=M},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${g?"only-mentions":""}`,children:[e("header",{hidden:L,onClick:M=>{M.target.closest("a, button")||x.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:M=>{M.target.closest("a, button")||ae(!0)},class:u==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Kt,{}),e(pe,{to:"/",class:"button plain",children:e(_,{icon:"home",size:"l",alt:s({id:"i0qMbr"})})})]}),e("h1",{children:e(m,{id:"iDNBZe"})}),e("div",{class:"header-side",children:N&&e("button",{type:"button",class:"button plain4",onClick:()=>{ee(!0)},children:e(_,{icon:"settings",size:"l",alt:s({id:"a/+arl"})})})})]}),Se&&u!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{ae(!0),x.current?.scrollTo({top:0,behavior:"smooth"})},children:[e(_,{icon:"arrow-up"})," ",e(m,{id:"Jy9RU/"})]})]}),O.length>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("details",{class:"announcements",children:[e("summary",{children:[e("span",{children:[e(_,{icon:"announce",class:"announcement-icon",size:"l"})," ",e(m,{id:"0whvLM",values:{0:O.length}})," ",e("small",{class:"insignificant",children:c})]}),O.length>1&&e("span",{class:"announcements-nav-buttons",children:O.map((M,A)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{se.current?.children[A].scrollIntoView({behavior:"smooth",block:"nearest"})},children:A+1}))})]}),e("ul",{class:`announcements-list-${O.length>1?"multiple":"single"}`,ref:se,children:O.map(M=>e("li",{children:e(Eu,{announcement:M})}))})]})})}),E.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(m,{id:"6Fs1Ba"})}),E.length>5?e("details",{children:[e("summary",{children:e(m,{id:"7dHKu4",values:{0:E.length}})}),e("ul",{children:E.map(M=>e("li",{children:[e(vt,{account:M}),e(Ui,{accountID:M.id,onChange:()=>{}})]},M.id))})]}):e("ul",{children:E.map(M=>e("li",{children:[e(vt,{account:M}),e(Ui,{accountID:M.id,onChange:()=>{}})]},M.id))})]}),N&&me?.summary?.pendingRequestsCount>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"filtered-notifications",children:e("details",{onToggle:async M=>{const{open:A}=M.target;if(A){const D=await Pe();_e(D)}},children:[e("summary",{children:e(m,{id:"N3Bq0f",values:{0:me.summary.pendingRequestsCount}})}),fe?fe?.length>0&&e("ul",{children:fe.map(M=>e("li",{children:[e("div",{class:"request-notifcations",children:[!M.lastStatus?.id&&e(vt,{useAvatarStatic:!0,showStats:!0,account:M.account}),M.lastStatus?.id&&e("div",{class:"last-post",children:e(pe,{class:"status-link",to:`/${c}/s/${M.lastStatus.id}`,children:e(je,{status:M.lastStatus,size:"s",readOnly:!0})})}),e(Lu,{request:M})]}),e($u,{request:M,onChange:()=>{ae(!0)}})]},M.id))}):e("p",{class:"ui-state",children:e(qe,{abrupt:!0})})]})})})}),De&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e(En,{notification:De})})}),!!b&&e("div",{id:"mentions-option",children:w?e(pe,{to:"/mentions",class:"button plain",children:[e(_,{icon:"at"})," ",e("span",{children:e(m,{id:"/bZzdR"})})," ",e(_,{icon:"arrow-right",class:"more-insignificant"})]}):e("label",{children:[e("input",{type:"checkbox",checked:g,onChange:M=>{y(M.target.checked)}})," ",e(m,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:[e(m,{id:"ecUA8p"})," ",e("small",{class:"insignificant bidi-isolate",children:P})]}),Ce&&e("p",{class:"ui-state insignificant",children:u==="default"?s({id:"KS7iJH"}):e(B,{children:"…"})}),a.notifications.length?e(gi.Provider,{value:"notifications",children:a.notifications.filter(M=>M.type!=="follow_request").map(M=>{if(g&&M.type!=="mention")return null;const A=new Date(M.createdAt),D=A.toDateString()!==Ie.toDateString();D&&(Ie=A);const K=A.toDateString()===ie.toDateString()?s({id:"y/0uwd"}):rt(Ie,{hideTime:!0}),X=rt(Ie,{forceOpts:{weekday:"long"}});return e(B,{children:[D&&e("h2",{class:"timeline-header",children:[e("span",{children:K})," ",e("small",{class:"insignificant bidi-isolate",children:X})]}),e(En,{instance:c,notification:M},M._ids||M.id)]},M._ids||M.id)})}):e(B,{children:[u==="loading"&&e(B,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((M,A)=>e("li",{class:"notification skeleton",children:[e("div",{class:"notification-type",children:e(_,{icon:"notification",size:"xl"})}),e("div",{class:"notification-content",children:e("p",{children:"███████████ ████"})})]}))})}),u==="error"&&e("p",{class:"ui-state",children:[e(m,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>ae(!0),children:e(m,{id:"KDw4GX"})})]})]}),f&&e(Dt,{onChange:M=>{M&&ae()},children:e("button",{type:"button",class:"plain block",disabled:u==="loading",onClick:()=>ae(),style:{marginBlockEnd:"6em"},children:u==="loading"?e(qe,{abrupt:!0}):e(m,{id:"uXRAkV"})})})]}),N&&te&&e(Fe,{onClick:M=>{M.target===M.currentTarget&&ee(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>ee(!1),children:e(_,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(m,{id:"a/+arl"})})}),e("main",{children:e("form",{onSubmit:M=>{M.preventDefault();const{forNotFollowing:A,forNotFollowers:D,forNewAccounts:K,forPrivateMentions:X,forLimitedAccounts:z}=M.target,de={...me,forNotFollowing:A.value,forNotFollowers:D.value,forNewAccounts:K.value,forPrivateMentions:X.value,forLimitedAccounts:z.value};be(de),ee(!1),(async()=>{try{await o.v2.notifications.policy.update(de),le(s({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(m,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:Iu.map(M=>{const A=me[M];return e("div",{children:e("label",{children:[i(xu[M]),e("select",{name:M,defaultValue:A,class:"small",children:[e("option",{value:"accept",children:e(m,{id:"g3UF2V"})}),e("option",{value:"filter",children:e(m,{id:"o7J4JM"})}),e("option",{value:"drop",children:e(m,{id:"gbbkE7"})})]})]})},M)})}),e("p",{children:e("button",{type:"submit",children:e(m,{id:"tfDRzk"})})})]})})]})})]})}function Tu(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function Eu({announcement:n}){const{instance:i}=oe(),{contact:s}=vo(),o=s?.account,{id:c,content:a,startsAt:u,endsAt:l,published:d,allDay:r,publishedAt:h,updatedAt:f,read:p,mentions:g,statuses:y,tags:w,emojis:k,reactions:b}=n,S=new Date(h),x=rt(S),C=new Date(f),T=rt(C);return e("div",{class:"announcement-block",children:[e(vt,{account:o}),e("div",{class:"announcement-content",onClick:To({mentions:g,instance:i}),dangerouslySetInnerHTML:{__html:Di(a,{emojis:k})}}),e("p",{class:"insignificant",children:[e("time",{datetime:S.toISOString(),children:rt(S)}),f&&T!==x&&e(B,{children:[" ","•"," ",e("span",{class:"ib",children:e(m,{id:"TbFrLc",values:{0:rt(C)},components:{0:e("time",{datetime:C.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:b.map(v=>{const{name:I,count:L,me:E,staticUrl:F,url:O}=v;return e("button",{type:"button",class:`plain4 small ${E?"reacted":""}`,children:[O||F?e("img",{src:O||F,alt:I,width:"16",height:"16"}):e("span",{children:I})," ",e("span",{class:"count",children:Ke(L)})]})})})]})}function Ru(n){const{masto:i}=oe();return i.v1.notifications.list({accountID:n})}function Lu({request:n}){const{instance:i}=oe(),[s,o]=$("loading"),{account:c,lastStatus:a}=n,[u,l]=$(!1),[d,r]=$([]);function h(){l(!1)}return G(()=>{n?.account?.id&&u&&(o("loading"),(async()=>{const f=await Ru(n.account.id);r(f||[]),o("default")})())},[u,n?.account?.id]),e(B,{children:[e("button",{type:"button",class:"plain4 request-notifications-account",onClick:()=>{l(!0)},children:[e(_,{icon:"notification",class:"more-insignificant"})," ",e("small",{children:e(m,{id:"H0wUNM",values:{0:c.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(_,{icon:"chevron-down"})]}),u&&e(Fe,{onClick:f=>{f.target===f.currentTarget&&h()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:h,children:e(_,{icon:"x",alt:t`Close`})}),e("header",{children:e("b",{children:e(m,{id:"MXOmPt",values:{0:c.username},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:s==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):d.map(f=>e("div",{class:"notification-peek",onClick:p=>{const{target:g}=p;(p.target.tagName==="BUTTON"||p.target.tagName==="A")&&h()},children:e(En,{instance:i,notification:f,isStatic:!0})}))})]})})]})}function $u({request:n,onChange:i}){const{_:s}=ce(),{masto:o}=oe(),[c,a]=$("default"),[u,l]=$(null),d=u!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:c==="loading"||d,onClick:()=>{a("loading"),(async()=>{try{await o.v1.notifications.requests.$select(n.id).accept(),l("accept"),a("default"),i({request:n,state:"accept"}),le(s({id:"ZtBMwU",values:{0:n.account.username}}))}catch{a("error"),le(s({id:"S92JKG"}))}})()},children:e(m,{id:"h7peZQ"})})," ",e("button",{type:"button",disabled:c==="loading"||d,class:"light danger",onClick:()=>{a("loading"),(async()=>{try{await o.v1.notifications.requests.$select(n.id).dismiss(),l("dismiss"),a("default"),i({request:n,state:"dismiss"}),le(s({id:"ibBDry",values:{0:n.account.username}}))}catch{a("error"),le(s({id:"S5aemF"}))}})()},children:e(m,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:c==="loading"?e(qe,{abrupt:!0}):u==="accept"?e(_,{icon:"check-circle",alt:s({id:"bzMKg7"}),class:"notification-accepted"}):u==="dismiss"&&e(_,{icon:"x-circle",alt:s({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const Ac=ut(Au),Mu=20;function Ki({local:n,columnMode:i,...s}){const{_:o}=ce(),c=We(R),a=!!n,u=i?{}:Ut(),{masto:l,authenticated:d,instance:r}=oe({instance:s?.instance||u.instance}),{instance:h}=oe(),f=o(a?{id:"u96B/B",values:{instance:r}}:{id:"PgVqvd",values:{instance:r}});et(f,a?"/:instance?/p/l":"/:instance?/p");const p=j(),[g,y]=$(null),w=g==="disabled",b=g==="authenticated"&&!d,S=j();async function x(T){if(T||!S.current){const L=await gc({feed:"liveFeeds",feedType:a?"local":"remote",instance:r});if(y(L),L==="disabled"||L==="authenticated"&&!d)return{done:!0,value:[]};const E={limit:Mu,local:a||void 0};!a&&Xe("@pixelfed/global-feed")&&(E.remote=!0),S.current=l.v1.timelines.public.list(E).values()}const v=await S.current.next();let{value:I}=v;return I?.length&&(T&&(p.current=I[0].id),I.forEach(L=>{Je(L,r)})),{...v,value:I}}async function C(){if(w||b)return!1;try{const T=await l.v1.timelines.public.list({limit:1,local:a,since_id:p.current}).values().next();let{value:v}=T;const I=v[0]?.id===p.current;return v?.length&&!I?(v=Xt(v,"public"),!0):!1}catch{return!1}}return e(Nt,{title:f,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:o(a?{id:"pJQgQV"}:{id:"cg0I+x"})}),e("div",{children:r})]}),id:"public",instance:r,emptyText:o(w?{id:"qbE/m4"}:b?{id:"aqJggz"}:{id:"BiZJ6G"}),errorText:o({id:"scd9lw"}),fetchItems:x,checkForUpdates:C,useItemID:!0,headerStart:e(B,{}),boostsCarousel:c.settings.boostsCarousel,filterContext:"public",headerEnd:e(mt,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(_,{icon:"more",size:"l",alt:o({id:"2FYpfJ"})})}),children:[e(ye,{href:a?`/#/${r}/p`:`/#/${r}/p/l`,children:a?e(B,{children:[e(_,{icon:"transfer"})," ",e("span",{children:e(m,{id:"dXMiUw"})})]}):e(B,{children:[e(_,{icon:"transfer"})," ",e("span",{children:e(m,{id:"t2B/we"})})]})}),e(Ye,{}),e(ye,{onClick:()=>{let T=prompt(o({id:"4CZnNE"}));if(!/\./.test(T)){T&&alert(o({id:"Q5COHO"}));return}T&&(T=T.toLowerCase().trim(),location.hash=a?`/${T}/p/l`:`/${T}/p`)},children:[e(_,{icon:"bus"})," ",e("span",{children:e(m,{id:"kesYbo"})})]}),h!==r&&e(ye,{onClick:()=>{location.hash=a?`/${h}/p/l`:`/${h}/p`},children:[e(_,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(m,{id:"/AfxaA",values:{currentInstance:h},components:{0:e("b",{})}})})]})]})},r+a)}function Pu({onItemClick:n}){const{_:i}=ce(),{instance:s}=oe(),[,o]=Et(d=>d+1,0),c=Si(),a=()=>{gd(),le({text:i({id:"hgPsUe"}),delay:1e3}),o()},u=(d,r)=>{md(d,r),o()},[l]=bi();return c.length===0?null:e("div",{class:"recent-searches",children:[e("div",{class:"recent-searches-header",children:[e(_,{icon:"history"})," ",e("span",{children:e(m,{id:"4R1B1H"})}),e("span",{class:"spacer"}),e("button",{type:"button",class:"plain4 small",onClick:a,disabled:c.length<=0,children:e("span",{children:e(m,{id:"yYxB17"})})})]}),e("ul",{class:"link-list recent-searches-list",ref:l,children:c.map(d=>{const{label:r,to:h,icon:f}=Vt(d.query,d.queryType,s);return e("li",{class:"recent-searches-item",children:[e(pe,{to:h,class:"recent-searches-link",onClick:p=>{Gn(d.query,d.queryType),n?.(p)},children:[e(_,{icon:f,class:"more-insignificant"}),e("span",{class:"recent-searches-label",children:r})]}),e("button",{type:"button",class:"plain4 small",onClick:()=>u(d.query,d.queryType),children:e(_,{icon:"trash",alt:i({id:"xCJdfg"})})})]},`${d.query}-${d.queryType}-${d.timestamp}`)})})]})}const On=5,Pi=40,Du=new URLSearchParams,zn={block:"start",inline:"center",behavior:"instant"};function Tc({columnMode:n,...i}){const{_:s}=ce(),o=n?{}:Ut(),{masto:c,instance:a,authenticated:u}=oe({instance:o.instance}),[l,d]=$("default"),[r]=n?[Du]:xt(),h=j(),f=i?.query||r.get("q"),p=n?"statuses":i?.type||r.get("type");let g=s({id:"A1taO8"});if(f)switch(p){case"statuses":g=s({id:"6YeoAt",values:{q:f}});break;case"accounts":g=s({id:"fpgumQ",values:{q:f}});break;case"hashtags":g=s({id:"AuiMZZ",values:{q:f}});break;default:g=s({id:"wr3GZI",values:{q:f}})}et(g,"/search");const[y,w]=$(!1),k=j(0);G(()=>{k.current=0},[f,p]);const b=j();_t(()=>{b.current?.scrollTo?.(0,0)},[f,p]);const[S,x]=$([]),[C,T]=$([]),[v,I]=$([]);G(()=>{x([]),T([]),I([])},[f]);const L={statuses:S,accounts:C,hashtags:v},E={statuses:x,accounts:T,hashtags:I},[F,O]=$({}),H=async N=>{if(!N?.length)return;const te=await dn(N,F);te&&O({...F,...te})};function Q(N){N&&(k.current=0),!(!N&&!u)&&(d("loading"),N&&!p&&(x(S.slice(0,On)),T(C.slice(0,On)),I(v.slice(0,On))),(async()=>{const te={q:f,resolve:u,limit:On};p&&(te.limit=Pi,te.type=p,u&&(te.offset=k.current));try{const ee=await c.v2.search.list(te);if(p)if(N){E[p](ee[p]);const me=ee[p]?.length;k.current=Pi,w(!!me)}else if(ee[p]?.[0]?.id===L[p]?.[0]?.id)w(!1);else{E[p](be=>[...be,...ee[p]]);const me=ee[p]?.length;k.current=k.current+Pi,w(!!me)}else x(ee.statuses||[]),T(ee.accounts||[]),I(ee.hashtags||[]),k.current=0,w(!1);H(ee.accounts),d("default")}catch{d("error")}})())}const re=j();un(N=>{const te=b.current?.scrollTop===0;if(N&&te){const ee=Date.now()-re.current;!re.current||ee>1e3*3?Q(!0):re.current=Date.now()}}),G(()=>{let N;return h.current?.setValue?.(f||""),f?Q(!0):N=setTimeout(()=>{h.current?.focus?.()},150),()=>clearTimeout(N)},[f,p,a]),He(["Slash","/"],N=>{h.current?.focus?.(),h.current?.select?.()},{useKey:!0,preventDefault:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey});const Z=".timeline > li > a, .hashtag-list > li > a",J=He("j",()=>{const N=document.activeElement.closest(Z),te=N?.getBoundingClientRect(),ee=Array.from(b.current.querySelectorAll(Z));if(N&&te.top0){const me=ee.indexOf(N);let be=ee[me+1];be&&(be.focus(),be.scrollIntoView(zn))}else{const me=ee.find(be=>{const q=be.getBoundingClientRect();return q.top>=44&&q.left>=0});me&&(me.focus(),me.scrollIntoView(zn))}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),Y=He("k",()=>{const N=document.activeElement.closest(Z),te=N?.getBoundingClientRect(),ee=Array.from(b.current.querySelectorAll(Z));if(N&&te.top0){const me=ee.indexOf(N);let be=ee[me-1];be&&(be.focus(),be.scrollIntoView(zn))}else{const me=ee.find(be=>{const q=be.getBoundingClientRect();return q.top>=44&&q.left>=0});me&&(me.focus(),me.scrollIntoView(zn))}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),[W]=bi();return e("div",{id:"search-page",class:"deck-container",tabIndex:"-1",ref:N=>{b.current=N,J.current=N,Y.current=N},children:e("div",{class:"timeline-deck deck",children:[e("header",{class:l==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(Kt,{})}),e(lc,{ref:h}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{Q(!0)},disabled:l==="loading",children:e(_,{icon:"search",size:"l",alt:s({id:"A1taO8"})})})})]})}),e("main",{children:[!!f&&!n&&e("div",{ref:W,class:`filter-bar ${l==="loading"?"loading":""}`,children:[!!p&&e(pe,{to:`/search${f?`?q=${encodeURIComponent(f)}`:""}`,children:[e(_,{icon:"chevron-left"})," ",e(m,{id:"N40H+G"})]}),[{label:s({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(f)}&type=accounts`},{label:s({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(f)}&type=hashtags`},{label:s({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(f)}&type=statuses`}].sort((N,te)=>N.type===p?-1:te.type===p?1:0).map(N=>e(pe,{to:N.to,children:N.label},N.type))]}),f?e(B,{children:[(!p||p==="accounts")&&e(B,{children:[p!=="accounts"&&e("h2",{class:"timeline-header",children:[e(m,{id:"bPwFdf"})," ",e(pe,{to:`/search?q=${encodeURIComponent(f)}&type=accounts`,children:e(_,{icon:"arrow-right",size:"l",alt:s({id:"V1fa9u"})})})]}),C.length>0?e(B,{children:[e("ul",{class:"timeline flat accounts-list",children:C.map(N=>e("li",{children:e(vt,{account:N,instance:a,showStats:!0,relationship:F[N.id]})},N.id))}),p!=="accounts"&&e("div",{class:"ui-state",children:e(pe,{class:"plain button",to:`/search?q=${encodeURIComponent(f)}&type=accounts`,children:[e(m,{id:"BMmtZ8"})," ",e(_,{icon:"arrow-right"})]})})]}):!p&&(l==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(m,{id:"YYB61U"})}))]}),(!p||p==="hashtags")&&e(B,{children:[p!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(m,{id:"VwUsHI"})," ",e(pe,{to:`/search?q=${encodeURIComponent(f)}&type=hashtags`,children:e(_,{icon:"arrow-right",size:"l",alt:s({id:"V1fa9u"})})})]}),v.length>0?e(B,{children:[e("ul",{class:"link-list hashtag-list",children:v.map(N=>{const{name:te,history:ee}=N,me=ee?.reduce?.((be,q)=>be+ +q.uses,0);return e("li",{children:e(pe,{to:a?`/${a}/t/${te}`:`/t/${te}`,children:[e(_,{icon:"hashtag",alt:"#"}),e("span",{children:te}),!!me&&e("span",{class:"count",children:Ke(me)})]})},`${te}-${me}`)})}),p!=="hashtags"&&e("div",{class:"ui-state",children:e(pe,{class:"plain button",to:`/search?q=${encodeURIComponent(f)}&type=hashtags`,children:[e(m,{id:"Nc/W5J"})," ",e(_,{icon:"arrow-right"})]})})]}):!p&&(l==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(m,{id:"4MFM3P"})}))]}),(!p||p==="statuses")&&e(B,{children:[p!=="statuses"&&e("h2",{class:"timeline-header",children:[e(m,{id:"+owNNn"})," ",e(pe,{to:`/search?q=${encodeURIComponent(f)}&type=statuses`,children:e(_,{icon:"arrow-right",size:"l",alt:s({id:"V1fa9u"})})})]}),S.length>0?e(B,{children:[e("ul",{class:"timeline",children:S.map(N=>e("li",{children:e(pe,{class:"status-link",to:a?`/${a}/s/${N.id}`:`/s/${N.id}`,children:e(je,{status:N})})},N.id))}),p!=="statuses"&&e("div",{class:"ui-state",children:e(pe,{class:"plain button",to:`/search?q=${encodeURIComponent(f)}&type=statuses`,children:[e(m,{id:"LYCgej"})," ",e(_,{icon:"arrow-right"})]})})]}):!p&&(l==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(m,{id:"Hzi9AA"})}))]}),!!p&&(l==="default"?y?e(Dt,{onChange:N=>{N&&Q()},children:e("button",{type:"button",class:"plain block",onClick:()=>Q(),style:{marginBlockEnd:"6em"},children:e(m,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(m,{id:"2EYeAZ"})}):l==="loading"&&e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}))]}):l==="loading"?e("p",{class:"ui-state",children:e(qe,{abrupt:!0})}):e(B,{children:[e("p",{class:"ui-state insignificant",children:e(m,{id:"fGn1Hk"})}),e(Pu,{})]})]})]})})}const Nu=20,Ec=600*1e3,Ou=It(n=>n.v1.trends.links.list().values().next(),{expires:Ec}),zu=It(n=>n.v1.trends.tags.list().values().next(),{expires:Ec});function qu(n){return Xe("@pixelfed/trending")?n.pixelfed.v2.discover.posts.trending.list({range:"daily"}).values():n.v1.trends.statuses.list({limit:Nu}).values()}function Bu(n,i){return n.v1.timelines.link.list(i).values()}function Rc({columnMode:n,...i}){const{_:s}=ce(),o=We(R),c=n?{}:Ut(),{masto:a,instance:u,authenticated:l}=oe({instance:i?.instance||c.instance}),{masto:d,instance:r}=oe(),h=s({id:"cI3UEs",values:{instance:u}});et(h,"/:instance?/trending");const f=j(),p=u===r,[g,y]=$([]),[w,k]=$([]),b=j();async function S(Z){if(Z||!b.current){if(b.current=qu(a),Xe("@mastodon/trending-hashtags"))try{const{value:W}=await zu(a);W?.length&&y(W)}catch{}if(Xe("@mastodon/trending-links"))try{const{value:W}=await Ou(a,u),N=W?.filter?.(te=>te.type==="link");N?.length&&k(N)}catch{}}const J=await b.current.next();let{value:Y}=J;return Y?.length&&(Z&&(f.current=Y[0].id),Y.forEach(W=>{Je(W,u)})),{...J,value:Y}}const[x,C]=$(!1),T=j(),[v,I]=$(null),L=!!v,E=j(),F=p&&Xe("@mastodon/trending-link-posts");G(()=>{v&&E.current&&E.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[v]);const O=j();async function H(Z){(Z||!T.current)&&(C(!0),T.current=Bu(a,{url:v})),O.current=v;const J=await T.current.next();let{value:Y}=J;return Y?.length&&(Y=Xt(Y,"public"),Y.forEach(W=>{Je(W,u)})),O.current===v&&C(!1),{...J,value:Y}}async function Q(){try{const Z=await a.v1.trends.statuses.list({limit:1}).values().next();let{value:J}=Z;return J=Xt(J,"public"),J?.length&&J[0].id!==f.current?(f.current=J[0].id,!0):!1}catch{return!1}}const re=xe(()=>e(B,{children:[!!g.length&&e("div",{class:"filter-bar expandable",children:[e(_,{icon:"chart",class:"insignificant",size:"l"}),g.map((Z,J)=>{const{name:Y,history:W}=Z,N=W.reduce((te,ee)=>te+ +ee.uses,0);return e(pe,{to:`/${u}/t/${Y}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),Y]}),e("span",{class:"filter-count",children:Ke(N)})]},Y)})]}),!!w.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(m,{id:"9veeTb"})})}),w.map(Z=>{const{authors:J,authorName:Y,authorUrl:W,blurhash:N,description:te,height:ee,image:me,imageDescription:be,language:q,providerName:V,providerUrl:fe,publishedAt:_e,title:Pe,url:Oe,width:ae}=Z,Se=J?.[0]?.account?.id?J[0].account:null,ge=Pe.length<30,Re=!!(Y||Se),Ne=Yi(Oe);let Be;if(N){const ze=es(N),ie=ps(ze);Be=fs([.6,ie[1],ie[2]])}return e("div",{children:[e("a",{ref:v===Oe?E:null,href:Oe,target:"_blank",rel:"noopener",class:`link-block ${L?v===Oe?"active":"inactive":""}`,style:Be?{"--accent-color":`rgb(${Be.join(",")})`,"--accent-alpha-color":`rgba(${Be.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:me,alt:be,width:ae,height:ee,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Ne})," ",!!_e&&e(B,{children:"· "}),!!_e&&e(B,{children:e(Rt,{datetime:_e,format:"micro"})})]}),!!Pe&&e("h1",{class:"title",lang:q,dir:"auto",title:Pe,children:Pe})]}),!!te&&e("p",{class:`description ${Re&&!ge?"":"more-lines"}`,lang:q,dir:"auto",title:te,children:te}),Re&&e(B,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(m,{id:"aavdrC",values:{0:Se?e(yt,{account:Se,showAvatar:!0}):W?e("a",{href:W,target:"_blank",rel:"noopener",children:Y}):Y}})})})]})]})]})}),F&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{I(Oe)},disabled:Oe===v,children:[e(_,{icon:"comment2"})," ",e("span",{children:e(m,{id:"/bZzdR"})})," ",e(_,{icon:"chevron-down"})]})]},Oe)})]}),F&&!!w.length&&e("div",{class:`timeline-header-block ${L?"blended":""}`,children:L?e(B,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:x?e(qe,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{I(null)},children:e(_,{icon:"x",alt:s({id:"9Q/4xJ"})})})}),e("p",{children:e(m,{id:"BATCqf",values:{0:v.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(m,{id:"Vosm4k"})})})]}),[g,w,v,x]);return e(Nt,{title:h,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:e(m,{id:"4/iCqx"})}),e("div",{children:u})]}),id:"trending",instance:u,emptyText:s({id:"6HA9+s"}),errorText:s({id:"scd9lw"}),fetchItems:L?H:S,checkForUpdates:L?void 0:Q,checkForUpdatesInterval:300*1e3,useItemID:!0,headerStart:e(B,{}),boostsCarousel:o.settings.boostsCarousel,filterContext:"public",timelineStart:re,refresh:v,clearWhenRefresh:!0,view:L?"link-mentions":void 0,headerEnd:e(mt,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(_,{icon:"more",size:"l",alt:s({id:"2FYpfJ"})})}),children:[e(ye,{onClick:()=>{let Z=prompt(s({id:"4CZnNE"}));if(!/\./.test(Z)){Z&&alert(s({id:"Q5COHO"}));return}Z&&(Z=Z.toLowerCase().trim(),location.hash=`/${Z}/trending`)},children:[e(_,{icon:"bus"})," ",e("span",{children:e(m,{id:"kesYbo"})})]}),r!==u&&e(ye,{onClick:()=>{location.hash=`/${r}/trending`},children:[e(_,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(m,{id:"/AfxaA",values:{currentInstance:r},components:{0:e("b",{})}})})]})]})},u)}const co={block:"nearest",inline:"nearest",behavior:"instant"};function Fu(){const{_:n}=ce();et(n({id:"i0qMbr"}),"/");const i=We(R),{shortcuts:s}=i,o=s.map(c=>{if(!c)return null;const{type:a,...u}=c,l={following:ys,notifications:Ac,list:vc,public:Ki,bookmarks:hc,favourites:pc,hashtag:yc,mentions:Sc,trending:Rc,search:Tc,profile:uc}[a];return!l||a==="search"&&!u.query||a==="list"&&!u.id?null:(a==="profile"&&(u.id=dt()),e(l,{...u,columnMode:!0},a+JSON.stringify(u)))});return He(["1","2","3","4","5","6","7","8","9"],c=>{try{const a=parseInt(c.key,10)-1,u=document.querySelectorAll("#columns > *")[a];u&&(u.focus(),u.scrollIntoView(co))}catch{}},{useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey}),He(["[","]"],(c,a)=>{const u=a.keys[0],l=document.activeElement.closest("#columns > *"),d=Yt(),r=d?"]":"[",h=d?"[":"]";let f;u===r?f=l?l.previousElementSibling:document.querySelectorAll("#columns > *")[0]:u===h&&(f=l?l.nextElementSibling:document.querySelectorAll("#columns > *")[1]),f&&(f.focus(),f.scrollIntoView(co))},{useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey}),e("div",{id:"columns",onContextMenu:c=>{c.target.closest(".deck > header")&&!c.target.closest("a")&&!c.target.closest("button")&&(c.preventDefault(),R.showShortcutsSettings=!0)},onFocus:()=>{const c=document.activeElement.closest("#columns > *");c&&document.querySelectorAll("#columns > *").forEach(a=>{a.classList.toggle("focus",a===c)})},children:o})}function Uu(){const{_:n}=ce(),i=We(R);return __BENCHMARK.end("time-to-home"),G(()=>{(async()=>{const s=await Ct.drafts.keys();if(s.length){const o=ti();s.filter(a=>a.startsWith(o)).length&&(R.showDrafts=!0)}})()},[]),e(B,{children:(i.settings.shortcutsViewMode==="multi-column"||!i.settings.shortcutsViewMode&&i.settings.shortcutsColumnsMode)&&i.shortcuts?.length?e(Fu,{}):e(ys,{title:n({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(Ku,{})})})}function Ku(){const{_:n}=ce(),i=We(R),s=j(),[o,c]=$(void 0);return e(B,{children:[e(pe,{ref:s,to:"/notifications",class:`button plain notifications-button ${i.notificationsShowNew?"has-badge":""} ${o||""}`,onClick:a=>{a.stopPropagation(),window.matchMedia("(min-width: calc(40em))").matches&&(a.preventDefault(),c(u=>u?void 0:"open"))},children:e(_,{icon:"notification",size:"l",alt:n({id:"iDNBZe"})})}),e(ju,{state:o,anchorRef:s,onClose:()=>c(void 0)})]})}const Hu=5;function ju({anchorRef:n,state:i,onClose:s}){const{masto:o,instance:c}=oe(),a=We(R),[u,l]=$("default"),d=Ic();async function r(){const k=await d.next(),b=kc(k.value);if(b?.length){b.forEach(x=>{Je(x.status,c,{skipThreading:!0})});const S=xc(b);R.notificationsLast=S[0],R.notifications=S,o.v1.markers.create({notifications:{lastReadId:S[0].id}}).catch(()=>{})}return R.notificationsShowNew=!1,R.notificationsLastFetchTime=Date.now(),k}const[h,f]=$(!1);function p(){return o.v1.followRequests.list({limit:1})}function g({skipFollowRequests:k=!1}={}){l("loading"),(async()=>{try{if(await r(),!k){const b=await p();f(!!b?.length)}l("default")}catch{l("error")}})()}const y=j(),w=52;return G(()=>{i==="open"&&(a.notificationsShowNew?y.current?.scrollTop<=w&&g({skipFollowRequests:!0}):g())},[i,a.notificationsShowNew]),e(pi,{ref:y,menuClassName:"notifications-menu",state:i,anchorRef:n,onClose:s,portal:{target:document.body},containerProps:{onClick:()=>{y.current?.closeMenu?.()}},overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:"8 8 8 8",children:[e("header",{children:e("h2",{children:e(m,{id:"iDNBZe"})})}),e(gi.Provider,{value:"notifications",children:e("main",{children:a.notifications.length?e(B,{children:a.notifications.slice(0,Hu).map(k=>e(En,{instance:c,notification:k,disableContextMenu:!0},k._ids||k.id))}):u==="loading"?e("div",{class:"ui-state",children:e(qe,{abrupt:!0})}):u==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(m,{id:"5GFQTh"})}),e("p",{children:e("button",{type:"button",onClick:g,children:e(m,{id:"KDw4GX"})})})]})})}),e("footer",{children:[e(pe,{to:"/mentions",class:"button plain",children:[e(_,{icon:"at"})," ",e("span",{children:e(m,{id:"/bZzdR"})})]}),e(pe,{to:"/notifications",class:"button plain2",children:[h?e(m,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(m,{id:"gukqfD"})})," ",e(_,{icon:"arrow-right"})]})]})]})}const Vu=ut(Uu),Yu=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function Lc(n){const i=URL.parse(n);if(!i)return{};const{hostname:s,pathname:o}=i;for(const c of Yu){const[,a]=o.match(c)||[];if(a)return{instance:s,id:a}}return{}}function Wu(n){const{instance:i,id:s}=Lc(n);return i&&s?`/${i}/s/${s}`:null}function Gu(){const i=en().pathname.replace(/^\//,""),s=Lc(i),o=s?.instance?`/${s.instance}/s/${s.id}`:null,[c,a]=$("loading");return _t(()=>{a("loading"),(async()=>{try{const{instance:u,id:l}=s;if(l){const{masto:d}=oe({instance:u});if(await d.v1.statuses.$select(l).fetch()){window.location.hash=o+"?view=full";return}}}catch{}{const{masto:u,instance:l}=oe(),d=await u.v2.search.list({q:i,limit:1,resolve:!0});if(d.statuses.length){const r=d.statuses[0];window.location.hash=`/${l}/s/${r.id}?view=full`}else if(d.accounts.length){const r=d.accounts[0];window.location.hash=`/${l}/a/${r.id}`}else o?window.location.hash=o+"?view=full":a("error")}})()},[o]),e("div",{class:"ui-state",tabIndex:"-1",children:[c==="loading"?e(B,{children:[e(qe,{abrupt:!0}),e("h2",{children:e(m,{id:"RTAr/z"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}):e(B,{children:[e("h2",{children:e(m,{id:"ufzZSJ"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}),e("hr",{}),e("p",{children:e(pe,{to:"/",children:e(m,{id:"iWpEwy"})})})]})}function Zu(){const{_:n}=ce();et(n({id:"h16FyT"}),"/l");const[i,s]=$("default"),[o,c]=Et(h=>h+1,0),[a,u]=$([]);G(()=>{s("loading"),(async()=>{try{const h=await zi();u(h),s("default")}catch{s("error")}})()},[o]);const[l,d]=$(!1),r=a.some(h=>h.exclusive);return e("div",{id:"lists-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Kt,{}),e(pe,{to:"/",class:"button plain",children:e(_,{icon:"home",size:"l"})})]}),e("h1",{children:e(m,{id:"h16FyT"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>d(!0),children:e(_,{icon:"plus",size:"l",alt:n({id:"Sb2gYF"})})})})]})}),e("main",{children:a.length>0?e(B,{children:[e("ul",{class:"link-list",children:a.map(h=>e("li",{children:e(pe,{to:`/l/${h.id}`,children:[e(_,{icon:"list"})," ",e("span",{children:[h.title,h.exclusive&&e(B,{children:[" ",e(Jt,{insignificant:!0})]})]})]})}))}),a.length>1&&e("footer",{class:"ui-state",children:[r&&e("p",{children:e("small",{class:"insignificant",children:[e(Jt,{})," ",e(m,{id:"FNptcJ"})]})}),e("p",{children:e("small",{class:"insignificant",children:e(m,{id:"8prZNK",values:{0:a.length}})})})]})]}):i==="loading"?e("p",{class:"ui-state",children:e(qe,{})}):i==="error"?e("p",{class:"ui-state",children:e(m,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(m,{id:"IvPikw"})})})]}),l&&e(Fe,{onClick:h=>{h.target===h.currentTarget&&d(!1)},children:e(hs,{list:l?.list,onClose:h=>{h.state==="success"&&c(),d(!1)}})})]})}const Xu=""+new URL("instances-Dd-nff5Z.json",import.meta.url).href;function Qu(n){const i=Math.min(500,Math.floor(window.screen.width*.9)),s=Math.min(600,Math.floor(window.screen.height*.8)),o=`popup,width=${i},height=${s}`;try{const c=window.open(n,"auth-popup",o);return!c||c.closed||typeof c.closed>"u"?null:c}catch{return null}}function Ju(n){if(n&&!n.closed)try{n.close()}catch{}}function eh(n,i,s){let o=!1;const c=l=>{l.origin===window.location.origin&&l.data&&l.data.type==="oauth-callback"&&(o=!0,u(),l.data.code?i(l.data.code):s(new Error("No authorization code received")))};window.addEventListener("message",c);const a=setInterval(()=>{(!n||n.closed)&&(clearInterval(a),o||(o=!0,u(),s(new Error("Popup was closed before authentication completed"))))},500),u=()=>{window.removeEventListener("message",c),clearInterval(a),Ju(n)};return u}const th={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:nh}=th;function ih(){const{_:n}=ce();et(n({id:"sQia9P"}),"/login");const i=j(),s=ke.local.get("instanceURL"),[o,c]=$("default"),[a]=xt(),u=a.get("instance"),l=a.get("submit"),[d,r]=$(u||s?.toLowerCase()||""),[h,f]=$([]),p=j();G(()=>{(async()=>{try{const C=await(await fetch(Xu)).json();f(C),p.current=new Ia(C)}catch{}})()},[]);const g=x=>{x&&(async()=>{try{const T=await(await fetch(`https://${x}/.well-known/host-meta`)).text(),E=new DOMParser().parseFromString(T,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),F=URL.parse(E),{host:O}=F;x!==O&&(x=O)}catch{}ke.local.set("instanceURL",x),c("loading");try{let C=So(x);(!C||!C.client_id||!C.client_secret)&&(C=await sr({instanceURL:x}),Gc(x,C));const{client_id:T,client_secret:v}=C,I=await Ja({instanceURL:x}),L=Zc(x);let E;if(I&&window.isSecureContext)if(T&&v){const[O,H]=await or({instanceURL:x,client_id:T,forceLogin:L});ke.sessionCookie.set("codeVerifier",H),E=O}else{alert(n({id:"ZP1FIA"})),c("default");return}else if(T&&v)E=await cr({instanceURL:x,client_id:T,forceLogin:L});else{alert(n({id:"ZP1FIA"})),c("default");return}const F=Qu(E);F?eh(F,O=>{const H=`${window.location.origin}${window.location.pathname}?code=${encodeURIComponent(O)}`;window.location.href=H},O=>{c("error")}):location.href=E,c("default")}catch{c("error")}})()},y=d?d.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,w=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(y)&&!/[\s\/\\@]/.test(y),k=y?p.current?.search(y,{limit:10})?.map(x=>x.item):[],b=w?y:k?.length?k[0]:d?h.find(x=>x.includes(d)):null,S=x=>{x.preventDefault(),g(b)};return l&&G(()=>{g(u||b)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:S,children:[e("h1",{children:[e("img",{src:ls,alt:"",width:"80",height:"80"}),e("br",{}),e(m,{id:"sQia9P"})]}),e("label",{children:[e("p",{children:e(m,{id:"sGH11W"})}),e("input",{value:d,required:!0,type:"text",class:"large",id:"instanceURL",ref:i,disabled:o==="loading",autocorrect:"off",autocapitalize:"off",autocomplete:"off",spellCheck:!1,placeholder:n({id:"0hbkwr"}),enterKeyHint:"go",onInput:x=>{r(x.target.value)},dir:"auto"}),k?.length>0?e("ul",{id:"instances-suggestions",children:k.map((x,C)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{g(x)},children:x})}))}):e("div",{id:"instances-eg",children:e(m,{id:"/OvbEC"})})]}),o==="error"&&e("p",{class:"error",children:e(m,{id:"yCXori"})}),e("div",{children:[e("button",{disabled:o==="loading"||!d||!b,children:n(b?{id:"2xahsi",values:{selectedInstanceText:b}}:{id:"xGVfLh"})})," "]}),e(qe,{hidden:o!=="loading"}),e("hr",{}),!nh&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(m,{id:"LcOiWS"})})}),e("p",{children:e(pe,{to:"/",children:e(m,{id:"iWpEwy"})})}),e(ds,{})]})})}const sh=40;function oh(){const{_:n}=ce(),i=We(R);et(n({id:"+GkIdc"}),"/sp");const{masto:s}=oe(),[o,c]=$([]),[a,u]=$("default"),[l,d]=Et(f=>f+1,0),[r,h]=$(!1);return G(d,[i.reloadScheduledPosts]),G(()=>{u("loading"),(async()=>{try{const f=s.v1.scheduledStatuses.list({limit:sh}).values(),p=[];let g;do g=(await f.next()).value,g?.length&&p.push(...g);while(g?.length);c(p)}catch{u("error")}finally{u("default")}})()},[l]),e("div",{id:"scheduled-posts-page",class:"deck-container",tabIndex:"-1",children:e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Kt,{}),e(pe,{to:"/",class:"button plain",children:e(_,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(m,{id:"+GkIdc"})}),e("div",{class:"header-side",children:e(mt,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(_,{icon:"more",size:"l",alt:n({id:"2FYpfJ"})})}),children:e(ye,{onClick:()=>{d()},children:[e(_,{icon:"refresh",size:"l"}),e("span",{children:e(m,{id:"lCF0wC"})})]})})})]})}),e("main",{children:[o.length?e("ul",{class:"posts-list",children:o.map(f=>{const{id:p,params:g,scheduledAt:y,mediaAttachments:w}=f,{inReplyToId:k,language:b,poll:S,sensitive:x,spoilerText:C,text:T,visibility:v,quotedStatusId:I,quoteApprovalPolicy:L}=g,E={id:p,inReplyToId:k,language:b,mediaAttachments:w,poll:S?{...S,expiresAt:new Date(Date.now()+S.expiresIn*1e3),options:S.options.map(F=>({title:F,votesCount:0}))}:void 0,sensitive:x,spoilerText:C,text:T,visibility:v,content:`

${T}

`,quotedStatusId:I,quoteApprovalPolicy:L};return e("li",{children:e(ch,{status:E,scheduledAt:y,onClick:()=>{h({post:E,scheduledAt:new Date(y)})}})},p)})}):e("p",{class:"ui-state",children:a==="loading"?e(qe,{}):n({id:"mZYb1f"})}),r&&e(Fe,{onClick:f=>{f.target===f.currentTarget&&h(!1)},children:e(ah,{post:r.post,scheduledAt:r.scheduledAt,onClose:()=>h(!1)})})]})]})})}function ch({status:n,scheduledAt:i,onClick:s}){const o=xe(()=>{const c=(Date.parse(i)-Date.now())/36e5;return c<24?"time":c<720?"day":"month"},[i]);return e("button",{type:"button",class:"textual block",onClick:s,children:[e("div",{class:`post-schedule-meta post-schedule-${o}`,children:[e(_,{icon:o,class:"insignificant"})," ",e("span",{children:e(m,{id:"aEp6lO",values:{0:rt(i,{formatOpts:{weekday:"short",second:"numeric"}})},components:{0:e("b",{}),1:e(Rt,{datetime:i}),2:e("small",{})}})})]}),e(je,{status:n,size:"s",previewMode:!0,readOnly:!0})]})}function ah({post:n,scheduledAt:i,onClose:s}){const{masto:o,instance:c}=oe(),{_:a}=ce(),[u,l]=$("default"),[d,r]=$(),h=d&&d.getTime()!==i.getTime(),f=xa(),p=i&&i<=Date.now(),{inReplyToId:g}=n,[y,w]=$(null),{quotedStatusId:k}=n;return e("div",{id:"scheduled-post-sheet",class:"sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(_,{icon:"x",size:"l",alt:a({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(m,{id:"orjBLU",components:{0:e("b",{}),1:e(Rt,{datetime:i})}}),e("br",{}),e("small",{children:rt(i,{formatOpts:{weekday:"short",second:"numeric"}})})]})}),e("main",{tabIndex:"-1",children:[!!y&&e("div",{class:"status-reply",children:e(je,{status:y,size:"s",previewMode:!0,readOnly:!0})}),e(je,{status:n,size:"s",previewMode:!0,readOnly:!0,onMediaClick:(b,S,x,C)=>{b.preventDefault(),R.showMediaModal={mediaAttachments:n.mediaAttachments,mediaIndex:S}}}),e("form",{onSubmit:b=>{b.preventDefault(),l("loading"),(async()=>{try{await o.v1.scheduledStatuses.$select(n.id).update({scheduledAt:d.toISOString()}),le(a({id:"40naR1"})),s(),l("default"),R.reloadScheduledPosts++}catch{l("error"),le(a({id:"ZM3jAs"}))}})()},children:e("footer",{children:[e("div",{class:"row",children:e("span",{children:[e(Aa,{scheduledAt:i,setScheduledAt:b=>{r(b)}})," ",e("small",{class:"ib",children:f})]})}),e("div",{class:"row",children:[e("button",{disabled:!h||u==="loading"||p,children:e(m,{id:"QqW27M"})}),e("span",{class:"grow"}),e(ft,{align:"end",menuItemClassName:"danger",confirmLabel:a({id:"09u3Kk"}),onClick:()=>{l("loading"),(async()=>{try{await oe().masto.v1.scheduledStatuses.$select(n.id).remove(),le(a({id:"/zL/Mq"})),s(),l("default"),R.reloadScheduledPosts++}catch{l("error"),le(a({id:"aOh6Md"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:u==="loading"||p,children:e(m,{id:"Jb6/SB"})})})]})]})})]})]})}function rh(){const{_:n}=ce(),{prevEditedAt:i,nextEditedAt:s,editedAtIndex:o,editHistoryMode:c,editHistoryRef:a,exitEditHistory:u}=$o();return c?e("div",{class:"edit-history-controls",children:[e(_,{icon:"edit"}),e("b",{class:"edit-history-heading",children:n({id:"HSA2au"})}),e("span",{class:"spacer"}),e("span",{class:"edit-history-pagination",children:[e("button",{type:"button",class:"plain4",onClick:()=>{i()},disabled:!c||o+1>=a.current.length,children:e(_,{icon:"chevron-left",alt:n({id:"DHhJ7s"})})})," ",a.current.length-o," /"," ",a.current.length," ",e("button",{type:"button",class:"plain4",onClick:()=>{s()},disabled:!c||o<=0,children:e(_,{icon:"chevron-right",alt:n({id:"hXzOVo"})})})]}),e("button",{type:"button",class:"plain3",onClick:()=>{u()},children:e(_,{icon:"exit",alt:n({id:"ydzS9x"})})})]}):null}const lh={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:ao}=lh,qn=40,dh=10,uh=5;let Hi={},Zn={},Xn={};function Qn(n){delete Zn[n],delete Xn[n]}const wn={block:"nearest",inline:"center",behavior:"instant"},ro=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",lo=/\/s\//i;function hh(n){const{id:i}=n,{masto:s,instance:o}=oe({instance:n.instance}),c=We(R),[a,u]=xt(),l=a.get("media"),d=a.get("media-only"),r=parseInt(l||d,10);let h=r>0;const f=a.get("mediaStatusID"),p=ko(f,o);f&&!p&&(h=!1);const g=h&&!!d,y=pt(i,o),[w,k]=$(R.statuses[y]);G(()=>{R.statuses[y]&&k(R.statuses[y])},[y]),G(()=>{if(!w||!w.url)return;const v=document.querySelector('link[rel="canonical"]');let I=null,L;return v?(I=v.href,v.href=w.url):(L=document.createElement("link"),L.rel="canonical",L.href=w.url,document.head.appendChild(L)),()=>{v&&I?v.href=I:L&&document.head.removeChild(L)}},[w?.url]);const b=xe(()=>{const{prevLocation:v}=R,I=(v?.pathname||"")+(v?.search||""),L=_n("/:instance/s/:id",I)||_n("/s/:id",I);return!I||L?"/":I},[]);G(()=>{!w&&h&&(async()=>{try{const v=await s.v1.statuses.$select(i).fetch();Je(v,o),k(v)}catch{alert("Unable to load post."),location.hash=b}})()},[h]);const S=f?c.statuses[pt(f,o)]?.mediaAttachments:w?.mediaAttachments,x=()=>window.matchMedia("(min-width: calc(40em + 350px))").matches?"large":"small",C=nt(()=>{x()==="small"&&c.prevLocation?history.back():g?location.hash=b:(a.delete("media"),a.delete("mediaStatusID"),u(a))},[g,b,c.prevLocation]),T=nt((v,I,L,E)=>{if(x()==="large"&&!g){C();return}if(h&&document.startViewTransition){const F=L[I],{id:O,blurhash:H,url:Q}=F,re=Ta(O||H||Q),J=[...document.querySelectorAll(`.status .media [data-view-transition-name="${re}"]`)].filter?.(W=>{const N=W.getBoundingClientRect();return N.top0&&N.left0}),Y=J.length===1?J[0]:J.find(W=>!!W.closest(".status-deck"));Y?document.startViewTransition(()=>{Y.style.viewTransitionName=re,E?.current&&E.current.querySelectorAll(".media img, .media video")?.forEach(N=>{N.style.viewTransitionName=""}),C()}).ready.finally(()=>{Y.style.viewTransitionName="",Y.dataset.viewTransitioned=re}):C()}else C()},[h,g]);return G(()=>{let v=setTimeout(()=>{const I=document.querySelector(".carousel");I&&I.focus()},100);return()=>clearTimeout(v)},[g]),G(()=>{const v=document.querySelectorAll(".deck-container");return v.forEach(I=>{I.setAttribute("inert","")}),()=>{v.forEach(I=>{I.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[h?S?.length?e(Qo,{mediaAttachments:S,statusID:f||i,instance:o,lang:w?.language,index:r-1,onClose:T}):e("div",{class:"media-modal-container loading",children:e(qe,{abrupt:!0})}):e(pe,{to:b}),!g&&e(Ea,{statusID:i,children:e(ph,{id:i,instance:n.instance,closeLink:b})})]})}function fh(n){const{linkable:i,to:s,onClick:o,...c}=n;return i?e(pe,{class:"status-link",to:s,onClick:o,...c}):e("div",{class:"status-focus",tabIndex:0,...c})}function uo(n,i){return Date.parse(n.createdAt)-Date.parse(i.createdAt)}const ho=1e3*60*60*24*30;function ph({id:n,closeLink:i="/",instance:s}){const{_:o}=ce(),[c,a]=xt(),u=c.get("media"),l=c.get("mediaStatusID"),d=parseInt(u,10)>0,r=j(!R.prevLocation&&(history.length===1||"navigation"in window&&navigation?.entries?.()?.length===1)),[h,f]=$(c.get("view")||r.current?"full":null),p=!!parseInt(c.get("translate")),{masto:g,instance:y}=oe({instance:s}),{masto:w,instance:k,authenticated:b}=oe(),S=y===k,x=We(R),[C,T]=$([]),[v,I]=$("default"),L=j(),E=pt(n,y),F=j(0),O=j();G(()=>{O.current?.focus()},[]),G(()=>{const P=Mo(()=>{if(!O.current)return;const{scrollTop:M}=O.current;v!=="loading"&&(Xn[n]=M)},50);return O.current?.addEventListener("scroll",P,{passive:!0}),P(),()=>{P.cancel(),O.current?.removeEventListener("scroll",P)}},[n,v!=="loading"]);const{editHistoryMode:H,initEditHistory:Q,editedAtIndex:re,editHistoryRef:Z}=$o(),J=j(),Y=j(),[W,N]=$(0),te=j(null),ee=()=>{if(!te.current)return;let{ancestors:P,descendants:M,heroStatus:A}=te.current;if(H&&M?.length){const U=Z.current[re],ve=Date.parse(U.createdAt),Le=Z.current[re-1],Te=Le?Date.parse(Le.createdAt):null;M=M.filter(Qe=>{const Ze=Date.parse(Qe.editedAt||Qe.createdAt);return Ze>=ve&&(!Te||Ze<=Te)})}P.sort(uo),M.sort(uo),F.current=M?.length||0;const D=new Set;P.forEach(U=>{Je(U,y,{skipThreading:!0}),U.inReplyToId&&!P.find(ve=>ve.id===U.inReplyToId)&&D.add(U.inReplyToId)}),A.inReplyToId&&!P.find(U=>U.id===A.inReplyToId)&&D.add(A.inReplyToId),D.forEach(U=>{const ve=P.find(Le=>Le.inReplyToId===U)||(A.inReplyToId===U?A:null);if(ve){const Le={id:U,ghost:{inReplyToAccountId:ve.inReplyToAccountId}};if(ve===A)P.push(Le);else{const Te=P.indexOf(ve);P.splice(Te,0,Le)}}});const K=new Set,X=P.every(U=>U.ghost||U.account.id===A.account.id),z=[];M.forEach(U=>{if(Je(U,y,{}),U.inReplyToId&&!M.find(ve=>ve.id===U.inReplyToId)&&U.inReplyToId!==A.id&&K.add(U.inReplyToId),U.inReplyToAccountId===U.account.id)z.push(U);else if(U.inReplyToId===A.id)z.push(U);else if(!U.inReplyToAccountId&&z.find(ve=>ve.id===U.inReplyToId&&ve.account.id===A.account.id)&&U.account.id===A.account.id)z.push(U);else{const ve=M.find(Le=>Le.id===U.inReplyToId);ve&&(ve.__replies||(ve.__replies=[]),ve.__replies.push(U))}}),z.sort((U,ve)=>{const Le=A.account.id;return U.account.id===Le&&ve.account.id!==Le?-1:ve.account.id===Le&&U.account.id!==Le?1:0}),K.size;let de=1;function Me(U,ve){const Le=ve+1;return Le>de&&(de=ve),U?.map(Te=>({id:Te.id,account:Te.account,repliesCount:Te.repliesCount,content:Te.content,weight:Cn(Te),level:Le,replies:Me(Te.__replies,Le)}))}const we=z.map(U=>({id:U.id,account:U.account,accountID:U.account.id,descendant:!0,thread:U.account.id===A.account.id,weight:Cn(U),level:1,replies:Me(U.__replies,1),createdAt:U.createdAt}));return{allStatuses:[...P.map(U=>({id:U.id,ancestor:!0,ghost:U.ghost,isThread:X&&!U.ghost,accountID:U.account?.id,account:U.account,repliesCount:U.repliesCount,weight:U.ghost?0:Cn(U),createdAt:U.createdAt})),{id:n,accountID:A.account.id,weight:Cn(A),createdAt:A.createdAt},...we],ancestorsIsThread:X,mappedNestedDescendants:we}},me=({reloadHero:P}={})=>{I("loading");let M;const A=Zn[n];if(A){const D=A.filter(K=>R.statuses[E]);T(D)}else T([{id:n}]);return(async()=>{const D=()=>Cs(()=>g.v1.statuses.$select(n).fetch(),{retries:4}),K=Cs(()=>g.v1.statuses.$select(n).context.fetch(),{retries:8}),X=!!x.statuses[E];let z=x.statuses[E];if(!(X&&!P))try{z=await D(),Je(z,y),await new Promise(de=>{setTimeout(de,100)})}catch{I("error");return}try{const de=await K,{ancestors:Me}=de;te.current={...de,heroStatus:z};const{allStatuses:we,ancestorsIsThread:Ee,mappedNestedDescendants:U}=ee(),ve=Me.length&&!Ee?[]:U.filter(Qe=>Qe.thread),Le=(Ee?Me.length:0)+ve.length;Le>0&&Le<100&&N(Le+1),I("default"),J.current={offsetTop:L.current?.offsetTop,scrollTop:O.current?.scrollTop};const Te=Me.length||0;Te>=ae&&Se(Te+1),T(we),Zn[n]=we,Xc(z,y)}catch{I("error")}})(),Y.current=Date.now(),()=>{clearTimeout(M)}};G(me,[n,g]),G(()=>{try{const{allStatuses:P}=ee();T(P)}catch{}},[H,re]);const[be,q]=$(!1);G(()=>{let P=setInterval(()=>{const M=Date.now();Y.current&&M-Y.current>=6e4&&q(!0)},6e4);return()=>{clearInterval(P)}},[]),_t(()=>{if(!C.length)return;const P=Xn[n];if(P)O.current.scrollTop=P;else if(J.current){const M={offsetTop:L.current?.offsetTop,scrollTop:O.current?.scrollTop},A=M.offsetTop-J.current.offsetTop+M.scrollTop;O.current.scrollTop=A}else C.length===1&&(O.current.scrollTop=0);J.current=null},[C]),G(()=>{x.reloadStatusPage<=0||(async()=>{try{const{instanceURL:P}=ln(),M=`https://${P}/api/v1/statuses/${n}/context`;return await(await caches.open("api")).delete(M,{ignoreVary:!0}),me({reloadHero:!0})}catch{}})()},[x.reloadStatusPage]),G(()=>()=>{Xn={},R.reloadStatusPage=0,Zn={},Hi={},ji.clear()},[]);const V=x.statuses[E]||x.statuses[n],fe=xe(()=>{if(!V)return"";const{account:P}=V,M=document.createElement("div");return M.innerHTML=P.displayName,M.innerText.trim()},[V]),_e=xe(()=>{if(!V)return"";let P=mi(V);return P.length>64&&(P=P.slice(0,64)+"…"),P},[V]);et(fe&&_e?`${fe}: "${_e}"`:o({id:"post.title"}),"/:instance?/s/:id");const Pe=xe(()=>{if(!V)return;const{url:P}=V;if(P)return URL.parse(P)?.hostname},[V]),Oe=xe(()=>{if(Pe)return Pe===y},[Pe,y]),[ae,Se]=$(qn),ge=xe(()=>C.length-ae,[C.length,ae]),Re=C.some(P=>P.descendant),Ne=C.filter(P=>P.ancestor),[Be,ze]=$(!0),ie=xe(()=>{if(!L.current||Be)return null;const{top:P}=L.current.getBoundingClientRect();return P>0?"down":"up"},[Be]);He("esc",()=>{location.hash=i},{enabled:!d,ignoreEventWhen:P=>!!document.querySelector("#modal-container > *")||P.metaKey||P.ctrlKey||P.altKey||P.shiftKey,useKey:!0}),He("backspace",()=>{location.hash=i},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),He("j",()=>{const P=document.activeElement.closest(".status-link, .status-focus"),M=P?.getBoundingClientRect(),A=Array.from(O.current.querySelectorAll(ro));if(P&&M.top0){const D=A.indexOf(P);let K=A[D+1];K&&(K.focus(),K.scrollIntoView(wn))}else{const D=A.find(K=>{const X=K.getBoundingClientRect();return X.top>=44&&X.left>=0});D&&(D.focus(),D.scrollIntoView(wn))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),He("k",()=>{const P=document.activeElement.closest(".status-link, .status-focus"),M=P?.getBoundingClientRect(),A=Array.from(O.current.querySelectorAll(ro));if(P&&M.top0){const D=A.indexOf(P);let K=A[D-1];K&&(K.focus(),K.scrollIntoView(wn))}else{const D=A.find(K=>{const X=K.getBoundingClientRect();return X.top>=44&&X.left>=0});D&&(D.focus(),D.scrollIntoView(wn))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),He("x",()=>{const P=document.activeElement.closest(".status-link, .status-focus");if(P){const M=P.nextElementSibling;M&&M.tagName.toLowerCase()==="details"&&(M.open=!M.open)}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),He("o",()=>{const P=document.activeElement.closest(".status-link, .status-focus");if(P){const M=P.querySelector("a.media:not(.status-card a.media)");M&&M.click()}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey});const[Ie,Ce]=$(!1),se=j(d?"media+status":"status"),De=nt((P,M,A,D)=>{P.preventDefault(),P.stopPropagation(),a({media:M+1,mediaStatusID:D.id})},[n]),$e=nt((P,M)=>{Qn(M.id)},[]);G(()=>{let P;return l&&d&&(P=setTimeout(()=>{const M=O.current?.querySelector(`.status-link[href*="/${l}"]`);M&&M.scrollIntoView(wn)},400)),()=>{clearTimeout(P)}},[l,d]);const Ae=nt((P,M)=>{const{id:A,ancestor:D,ghost:K,isThread:X,descendant:z,thread:de,replies:Me,repliesCount:we,weight:Ee,level:U}=P,ve=A===n;return e("li",{ref:ve?L:null,class:`${D?"ancestor":""} ${z?"descendant":""} ${de?"thread":""} ${ve?"hero":""}`,children:[ve?e(B,{children:[e(Dt,{threshold:.1,onChange:Te=>{queueMicrotask(()=>{requestAnimationFrame(()=>{ze(Te)})})},class:"status-focus",tabIndex:0,children:e(je,{statusID:A,instance:y,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:p})}),v!=="loading"&&!b?e("div",{class:"post-status-banner",children:[e("p",{children:e(m,{id:"Vyeh4F"})}),e(pe,{to:ao?`/login?instance=${ao}&submit=1`:"/login",class:"button",children:e(m,{id:"sQia9P"})})]}):!S&&e("div",{class:"post-status-banner",children:[e("p",{children:e(m,{id:"BrLbQp",values:{instance:y},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:v==="loading",onClick:()=>{I("loading"),(async()=>{try{const Te=await w.v2.search.list({q:V.url,type:"statuses",resolve:!0,limit:1});if(Te.statuses.length){const Qe=Te.statuses[0];location.hash=k?`/${k}/s/${Qe.id}`:`/s/${Qe.id}`}else throw new Error("No results")}catch(Te){I("default"),alert(o({id:"DnepCE",values:{e:Te}}))}})()},children:[e(_,{icon:"transfer"})," ",e(m,{id:"jtQUzv"})]})]})]}):e(fh,{linkable:!K&&(X||D),to:y?`/${y}/s/${A}`:`/s/${A}`,onClick:()=>{Qn(A)},children:[K?e(je,{statusID:A,instance:y,withinContext:!0,size:"m",ghost:K}):M===0&&D?e(Dt,{threshold:.5,onChange:Te=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Ce(Te)})})},children:e(je,{statusID:A,instance:y,withinContext:!0,size:de||D?"m":"s",enableTranslate:!0,onMediaClick:De,onStatusLinkClick:$e})}):e(je,{statusID:A,instance:y,withinContext:!0,size:de||D?"m":"s",enableTranslate:!0,onMediaClick:De,onStatusLinkClick:$e,showActionsBar:!!z}),D&&we>1&&e("div",{class:"replies-link",children:[e(_,{icon:"comment2",alt:o({id:"N8UzTV"})})," ",e("span",{title:we,children:Ke(we)})]})," "]}),z&&Me?.length>0&&e($c,{instance:y,replies:Me,hasParentThread:de,level:U,accWeight:Ee,openAll:F.currentQn(A)}}),v==="loading"&&ve&&!!V?.repliesCount&&!Re&&e("div",{class:"status-loading",children:e(qe,{abrupt:V.repliesCount>=3})}),v==="error"&&ve&&!!V?.repliesCount&&!Re&&e("div",{class:"status-error",children:[e(m,{id:"HQJU6W"}),e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{R.reloadStatusPage++},children:e(m,{id:"KDw4GX"})})]})]},A)},[n,y,v,b,S,p,De,$e,Re]),ne=xe(()=>{if("navigation"in window&&navigation?.entries){const P=navigation.entries()[navigation.currentEntry.index-1];if(P?.url)return lo.test(P.url)}return lo.test(R.prevLocation?.pathname)},[E]),Ue=xe(()=>{if(!ge)return[];const P=[];function M(A){P.push(A.id),A.replies&&A.replies.forEach(M)}return C.slice(ae).forEach(M),P.map(A=>pt(A,y))},[ge,C,ae,y]);function wt(P){if(P<12)return he._({id:"DqsEm+",values:{months:P}});{const M=Math.floor(P/12);return he._({id:"24w+FD",values:{years:M}})}}const st=xe(()=>{const P=[],M=C.slice(0,ae);for(let A=0;A0){const K=M[A-1],{createdAt:X,descendant:z,thread:de,id:Me}=D;if(K?.createdAt&&X){const we=Date.parse(X);if(isFinite(we)&&we>ho){const Ee=Date.parse(K.createdAt);if(Ee&&isFinite(Ee)){const{ancestor:U,id:ve}=K,Te=~~((we-Ee)/ho);Te>0&&P.push(e("li",{style:{"--time-gap-range":Math.min(12,Te)},class:`time-gap ${U?"ancestor":""} ${z?"descendant":""} ${de?"thread":""}`,children:wt(Te)},`time-gap-${Me}-${ve}`))}}}}P.push(Ae(D,A))}return P},[C,ae,Ae,H,re]);return G(()=>{let P=setTimeout(()=>{if(!L.current)return;const M=L.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");M&&M.click()},1e3);return()=>clearTimeout(P)},[n]),e(Ra.Provider,{value:W,children:e("div",{tabIndex:"-1",ref:O,class:`status-deck deck contained ${C.length>1?"padded-bottom":""} ${se.current==="status"&&!r.current?"slide-in":""} ${h?`deck-view-${h}`:""} ${H?"edit-history-mode":""}`,style:H?{"--edit-history-percentage":`${re/(Z.current.length-1)}`}:void 0,onAnimationEnd:P=>{se.current==="status"&&(se.current=null)},children:[e("header",{class:`${v==="loading"?"loading":""}`,onDblClick:P=>{R.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[ne&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(_,{icon:"chevron-left",size:"xl",alt:o({id:"iH8pgl"})})}),!Be&&V&&v!=="loading"?e(B,{children:[e("span",{class:"hero-heading",children:[e(yt,{account:V.account,instance:y,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(Rt,{datetime:V.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:P=>{P.preventDefault(),P.stopPropagation(),L.current.scrollIntoView({behavior:"smooth",block:"start"})},title:o({id:"NCy+Nw"}),children:e(_,{icon:ie==="down"?"arrow-down":"arrow-up"})})]}):e(B,{children:[e(m,{id:"post.title"})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:P=>{P.preventDefault(),P.stopPropagation(),O.current.scrollTo({top:0,behavior:"smooth"})},hidden:!Ne.length||Ie,title:o({id:"R8CUl0",values:{0:Ne.length}}),children:[e(_,{icon:"arrow-up"}),Ne.filter(P=>!P.ghost).filter((P,M,A)=>A.findIndex(D=>D.accountID===P.accountID)===M).slice(0,3).map(P=>e(lt,{url:P.account.avatarStatic||P.account.avatar,alt:P.account.displayName,squircle:P.account?.bot},P.account.id)),Ne.length>3&&e(B,{children:[" ",e("span",{class:"insignificant",children:Ke(Ne.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:h==="full"?"":"none"},onClick:()=>{f(null),c.delete("media"),c.delete("media-only"),c.delete("view"),a(c)},title:o({id:"+/xYEI"}),children:e(_,{icon:"layout4",size:"l"})}),be&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{R.reloadStatusPage++,q(!1)},children:e(_,{icon:"refresh",size:"l",alt:o({id:"lCF0wC"})})}),e(mt,{align:"end",portal:{target:O.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(_,{icon:"more",alt:o({id:"2FYpfJ"}),size:"xl"})}),children:[e(ye,{disabled:v==="loading",onClick:()=>{R.reloadStatusPage++},children:[e(_,{icon:"refresh"}),e("span",{children:e(m,{id:"lCF0wC"})})]}),e(ye,{className:"menu-switch-view",onClick:()=>{f(h==="full"?null:"full"),c.delete("media"),c.delete("media-only"),h==="full"?c.delete("view"):c.set("view","full"),a(c)},children:[e(_,{icon:{"":"layout5",full:"layout4"}[h||""]}),e("span",{children:o(h==="full"?{id:"+/xYEI"}:{id:"2LiWsE"})})]}),e(ye,{onClick:()=>{Array.from(O.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(M=>{M.click()})},children:[e(_,{icon:"eye-open"})," ",e("span",{children:e(m,{id:"8r8KmB"})})]}),e(Ye,{}),e(ts,{className:"plain",children:e(m,{id:"Rsjgm0"})}),e(ye,{disabled:!Pe||Oe,onClick:()=>{const P=Wu(V.url);P?location.hash=P:alert(o({id:"9J6biQ"}))},children:[e(_,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:o(Pe?{id:"yi60j9",values:{0:hi.toUnicode(Pe)}}:{id:"rWTcqf"})})]}),e(ye,{disabled:!S||v==="loading"||!V?.editedAt||!F.current,onClick:Q,children:[e(_,{icon:"edit"}),e("span",{children:o({id:"OqaQnE"})})]})]}),e(pe,{class:"button plain deck-close",to:i,children:e(_,{icon:"x",size:"xl",alt:o({id:"yz7wBu"})})})]})]})}),e(rh,{}),C.length&&V?e("ul",{class:`timeline flat contextual grow ${v==="loading"?"loading":""}`,children:[st,ge>0&&e("li",{class:"descendant descendant-more",children:e("button",{type:"button",class:"plain block show-more",disabled:v==="loading",onClick:()=>Se(P=>P+qn),style:{marginBlockEnd:"6em"},"data-state-post-ids":Ue.join(" "),children:[e("div",{class:"ib avatars-bunch",children:C.slice(ae,ae+5).map(P=>e(lt,{url:P.account.avatarStatic},P.id))})," ",e("div",{class:"ib",children:[e(m,{id:"uXRAkV"})," ",e("span",{class:"tag",children:ge>qn?`${qn}+`:ge})]})]})})]}):e(B,{children:[v==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(je,{skeleton:!0,size:"l"})})}),v==="error"&&e("p",{class:"ui-state",children:[e(m,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{R.reloadStatusPage++},children:e(m,{id:"KDw4GX"})})]})]})]})})}function $c({replies:n,instance:i,hasParentThread:s,level:o,accWeight:c,openAll:a,parentLink:u}){const{_:l}=ce(),[d,r]=xt(),h=I=>I.reduce((L,E)=>{const{repliesCount:F,replies:O}=E,H=O?.length||F;return L+H+h(O||[])},0),f=n.length+h(n),p=n.length===f,g=n.map(I=>I.account).filter((I,L,E)=>E.findIndex(F=>F.id===I.id)===L).slice(0,3),y=xe(()=>n?.reduce((I,L)=>I+L?.weight,c),[c,n?.length]);let w=!1;(a||y<=uh||!s&&f===1&&Cn(n[0])<2)&&(w=!0);const k=Hi[n[0].id],b=nt((I,L,E,F)=>{I.preventDefault(),I.stopPropagation(),r({media:L+1,mediaStatusID:F.id})},[]),S=j();_t(()=>{function I(L){L.target.dataset.scrollLeft=L.target.scrollLeft}return S.current?.addEventListener("scroll",I,{passive:!0}),()=>{S.current?.removeEventListener("scroll",I)}},[]);const[x,C]=$(k||w);G(()=>{let I;return!k&&!w&&(I=setTimeout(()=>C(!0),100)),()=>clearTimeout(I)},[k,w]);const T=w?"div":"details",v=T==="details";return e(T,{ref:S,class:"replies",open:v?k||w:void 0,onToggle:v?I=>{const{open:L}=I.target;Hi[n[0].id]=L}:void 0,style:{"--comments-level":o},"data-comments-level":o,"data-comments-level-overflow":o>4,children:[!w&&e("summary",{class:"replies-summary",hidden:w,children:[e("span",{class:"avatars",children:g.map(I=>e(lt,{url:I.avatarStatic,title:`${I.displayName} @${I.username}`,squircle:I?.bot},I.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(m,{id:"DOQUen",values:{0:n.length,1:Ke(n.length)},components:{0:e("span",{title:n.length})}})}),!p&&f>1&&e(B,{children:[" ","·"," ",e("span",{children:e(m,{id:"qSQQSe",values:{0:Ke(f),totalComments:f},components:{0:e("span",{title:f})}})})]})]}),e(_,{icon:"chevron-down",class:"replies-summary-chevron"}),!!u&&e(pe,{class:"replies-parent-link",to:u.to,onClick:u.onClick,title:l({id:"ZlV82A"}),children:"»"})]}),x&&e("ul",{children:n.map(I=>e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(je,{statusID:I.id,instance:i,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:b,showActionsBar:!0}),!I.replies?.length&&I.repliesCount>0&&e("div",{class:"replies-link",children:[e(_,{icon:"comment2",alt:l({id:"N8UzTV"})})," ",e("span",{title:I.repliesCount,children:Ke(I.repliesCount)})]})]}),I.replies?.length&&e($c,{instance:i,replies:I.replies,level:I.level,accWeight:w?y:I.weight,openAll:a,parentLink:{to:i?`/${i}/s/${I.id}`:`/s/${I.id}`,onClick:()=>{Qn(I.id)}}})]},I.id))})]})}const mh=140,gh=35,yh=70,vh=140,ji=new Map;function Cn(n){const i=ji.get(n.id);if(i)return i;const{spoilerText:s,content:o,mediaAttachments:c,poll:a,card:u}=n,l=Lo(s+o),d=c?.length?mh:0,r=(a?.options?.length||0)*gh,h=u&&(c?.length||a?.options?.length)?0:yh,p=(l+d+r+h)/vh;return ji.set(n.id,p),p}const bh=ut(hh);function wh(){const n=Ut(),{id:i,instance:s}=n;return e(bh,{id:i,instance:s})}const kh=""+new URL("boosts-carousel-BiOaNdMT.jpg",import.meta.url).href,Sh=""+new URL("multi-column-ROck0NVt.jpg",import.meta.url).href,Ch=""+new URL("multi-hashtag-timeline-DH5INVHi.jpg",import.meta.url).href,_h=""+new URL("nested-comments-thread-hv59kZLc.jpg",import.meta.url).href,Ih="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2093%2027'%3e%3cpath%20fill='%2382a0ef'%20d='M1.96%2021.31c1.26%200%201.99-.79%201.99-2.14v-4.86h3.79c4.29%200%207-2.45%207-6.58%200-3.96-2.68-6.56-6.84-6.56H2.85c-2.07%200-2.86.81-2.86%202.89v15.12c0%201.35.72%202.14%201.96%202.14Zm1.99-10.08v-6.9h3.46c2.17%200%203.4%201.26%203.4%203.46%200%202.55-1.25%203.44-4.32%203.44zm26.04%207.96v-8.41c0-3.38-1.93-5.41-5.17-5.41-2.21%200-4.12%201.23-4.64%202.99h-.19V2.13c0-1.36-.69-2.14-1.92-2.14-1.25%200-1.93.78-1.93%202.14v17.05c0%201.36.69%202.12%201.92%202.12s1.93-.76%201.93-2.12v-6.67c0-2.39%201.3-3.9%203.28-3.9%201.8%200%202.86%201.16%202.86%203.19v7.37c0%201.36.69%202.12%201.93%202.12%201.23%200%201.93-.78%201.93-2.12Zm10.95%200h.19v.54c.12%201.01.79%201.58%201.82%201.58%201.2%200%201.88-.75%201.88-2.07v-8.5c0-3.44-2.29-5.38-6.36-5.38q-2.53.01-3.98.81c-1.36.69-1.99%201.61-1.99%202.52%200%20.79.53%201.36%201.38%201.36.63%200%201.04-.16%201.48-.51a4%204%200%200%201%202.87-1.22c1.77%200%202.75.82%202.75%202.39v1.27h-3.69c-3.53%200-5.65%201.77-5.65%204.64%200%202.83%202.05%204.73%205.08%204.73%201.9%200%203.44-.79%204.23-2.18Zm-5.48-2.78c0-1.27.94-2.04%202.52-2.04h2.99v1.61c0%201.46-1.3%202.61-2.97%202.61-1.51%200-2.53-.89-2.53-2.18Zm25.55%202.79v-8.45c0-3.41-1.88-5.38-5.19-5.38-2.29%200-4.03%201.14-4.63%202.99H51v-.95c-.04-1.25-.72-1.93-1.88-1.93-1.17%200-1.9.79-1.9%202.07V19.2c0%201.36.7%202.12%201.93%202.12s1.93-.76%201.93-2.12v-6.67c0-2.42%201.26-3.9%203.27-3.9%201.79%200%202.8%201.14%202.8%203.18v7.38c0%201.36.69%202.12%201.93%202.12%201.23%200%201.92-.75%201.92-2.11Zm6.36%205.37V18.8h.19c.69%201.64%202.29%202.58%204.41%202.58%203.65%200%205.84-2.61%205.84-6.93V12.3c0-4.32-2.17-6.91-5.79-6.91-2.18%200-3.9%201.04-4.53%202.71h-.19v-.75c-.09-1.2-.76-1.86-1.9-1.86-1.22%200-1.89.76-1.89%202.14v16.95c0%201.36.69%202.12%201.92%202.12%201.25%200%201.93-.76%201.93-2.12Zm0-10.06v-2.07c0-2.49%201.25-3.97%203.27-3.97%202.07%200%203.24%201.52%203.24%204.2v1.41c0%202.67-1.17%204.2-3.21%204.2-1.98%200-3.3-1.49-3.3-3.78ZM78.73%2025q0%20.62.42%201.04c.45.44%201.25.67%202.26.67%203.12%200%204.92-1.44%206.14-4.92l4.67-13.4c.16-.45.22-.76.22-1.05%200-1.04-.78-1.8-1.83-1.8q-1.5-.01-1.98%201.85l-3.05%2010.59h-.16L82.4%207.39q-.46-1.86-2.01-1.85c-1.1%200-1.9.78-1.9%201.82q-.02.42.19%201.04l4.57%2012.96c0%20.1-.15.75-.19.83-.32%201-1.05%201.64-1.93%201.64-.44%200-.7-.07-1.01-.07-.83%200-1.39.53-1.39%201.25Z'/%3e%3c/svg%3e",xh=""+new URL("home-mobile-dark@2x-Dc-J8-SM.png",import.meta.url).href,Ah=""+new URL("home-mobile-light@2x-Bd3fod8m.png",import.meta.url).href,Th=""+new URL("home-tablet-dark@2x-BgcNI8le.png",import.meta.url).href,Eh=""+new URL("home-tablet-light@2x-BW2RV9T6.png",import.meta.url).href,Rh={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:kn,PHANPY_WEBSITE:ui,PHANPY_PRIVACY_POLICY_URL:Lh,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:fo}=Rh,po=ui?ui.replace(/https?:\/\//g,"").replace(/\/$/,""):null,$h=ui?ui.toLowerCase().includes(location.hostname):!1,mo=`${"2026-02-24T14:53:54.000Z".slice(0,10).replace(/-/g,".")}.48b2cf7`;function Mc(){const{_:n}=ce();return et(null,["/","/welcome"]),e("main",{id:"welcome",children:[e("div",{class:"hero-container",children:e("div",{class:"hero-content",children:[e("h1",{children:[e("img",{src:ls,alt:"",width:"100",height:"100"}),e("img",{src:Ih,alt:"Phanpy",width:"180",height:"52"})]}),e("p",{class:"desc",children:e(m,{id:"Ogtv0V"})}),e("p",{children:e(pe,{to:kn?`/login?instance=${kn}&submit=1`:"/login",class:"button plain6",children:n(kn?{id:"sQia9P"}:{id:"ZLoGls"})})}),kn&&fo&&e("p",{children:e("a",{href:fo,class:"button plain5",children:e(m,{id:"e+RpCP"})})}),!kn&&e("p",{class:"insignificant",children:e("small",{children:e(m,{id:"fvAsUK",components:{0:e("br",{})}})})})]})}),e("div",{id:"device-showcase",children:[e("div",{class:"device mobile",children:e("div",{class:"device-frame",children:e("picture",{children:[e("source",{srcSet:xh,media:"(prefers-color-scheme: dark)"}),e("img",{src:Ah,alt:n({id:"LVd2Ia"}),width:"375",height:"812",loading:"lazy"})]})})}),e("div",{class:"device tablet",children:e("div",{class:"device-frame",children:e("picture",{children:[e("source",{srcSet:Th,media:"(prefers-color-scheme: dark)"}),e("img",{src:Eh,alt:n({id:"6XjvUL"}),width:"768",height:"1024",loading:"lazy"})]})})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:kh,alt:n({id:"S5cYrQ"}),width:"400",height:"303",loading:"lazy"}),e("div",{children:[e("h4",{children:e(m,{id:"Tu+sCN"})}),e("p",{children:e(m,{id:"e2uVlo"})})]})]}),e("section",{children:[e("img",{src:fc,alt:n({id:"LUnwPh"}),width:"600",height:"450",loading:"lazy"}),e("div",{children:[e("h4",{children:e(m,{id:"xrl8fj"})}),e("p",{children:e(m,{id:"1lGm1k"})})]})]}),e("section",{children:[e("img",{src:_h,alt:n({id:"CGQ27z"}),width:"400",height:"474",loading:"lazy"}),e("div",{children:[e("h4",{children:e(m,{id:"cYE45+"})}),e("p",{children:e(m,{id:"Pc7QKh"})})]})]}),e("section",{children:[e("img",{src:Sh,alt:n({id:"VLKtvP"}),width:"400",height:"209",loading:"lazy"}),e("div",{children:[e("h4",{children:e(m,{id:"pEkad9"})}),e("p",{children:e(m,{id:"t7Py5R"})})]})]}),e("section",{children:[e("img",{src:Ch,alt:n({id:"wOax6E"}),width:"400",height:"196",loading:"lazy"}),e("div",{children:[e("h4",{children:e(m,{id:"Wi1Ov0"})}),e("p",{children:e(m,{id:"tS2i+h"})})]})]})]})}),e("footer",{children:[(po||mo)&&e("p",{class:"app-site-version",children:e("small",{children:[$h?po:""," ",mo]})}),e("p",{children:e(m,{id:"BskFI2",components:{0:e("a",{href:"https://github.com/cheeaun/phanpy",target:"_blank"}),1:e("a",{href:"https://mastodon.social/@cheeaun",target:"_blank",onClick:i=>{i.preventDefault(),R.showAccount="cheeaun@mastodon.social"}}),2:e("a",{href:Lh,target:"_blank"})}})}),e("div",{children:e(ds,{})})]})]})}const Mh=window.alert;window.__nativeAlert||(window.__nativeAlert=Mh);window.alert=function(n){n instanceof Error&&n?.message&&(n=n.message),typeof n!="string"&&(n=JSON.stringify(n));const i=La({text:n,className:"alert",gravity:"top",position:"center",duration:1e4,offset:{y:48},onClick:()=>{i.hideToast()}});i.showToast()};Qc(!0);const Ph=Co(()=>fi(()=>import("./mock-home-CPV8RpqJ.js"),__vite__mapDeps([4,1,2,3]),import.meta.url)),Dh=Co(()=>fi(()=>import("./year-in-posts-DuNF_0LH.js"),__vite__mapDeps([5,1,2,3]),import.meta.url));window.__STATES__=R;window.__STATES_STATS__=()=>{const n=["statuses","accounts","spoilers","unfurledLinks","statusQuotes"],i={};n.forEach(c=>{i[c]=Object.keys(R[c]).length});const{statuses:s}=R,o=[];for(const c in s)document.querySelector(`[data-state-post-id~="${c}"], [data-state-post-ids~="${c}"]`)||o.push(c)};setInterval(()=>{if(!window.__IDLE__)return;const{statuses:n,unfurledLinks:i,notifications:s}=R;let o=0;const{instance:c}=oe();for(const a in n){if(!window.__IDLE__)break;try{const u=document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`),l=s.some(d=>a===pt(d.status?.id,c));if(!u&&!l){delete R.statuses[a],delete R.statusQuotes[a];for(const d in i){const r=i[d];if(pt(r.id,r.instance)===a){delete R.unfurledLinks[d];break}}o++}}catch{}}},900*1e3);setTimeout(()=>{for(const n in sn)setTimeout(()=>{Array.isArray(sn[n])?sn[n][0]?.():typeof sn[n]=="object"?sn[n].module?.():sn[n]?.()},1)},5e3);(()=>{window.__IDLE__=!0;const n=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],i=()=>{window.__IDLE__=!0},o=Mo(i,3e3),c=()=>{window.__IDLE__=!1,o()};n.forEach(a=>{window.addEventListener(a,c,{passive:!0,capture:!0})}),window.addEventListener("blur",i,{passive:!0}),document.documentElement.addEventListener("mouseleave",a=>{!a.relatedTarget&&!a.toElement&&i()},{passive:!0})})();const Nh=/iPad|iPhone|iPod/.test(navigator.userAgent);Nh&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(document.getElementsByClassName("media-modal-container").length>0)return;const i=ke.local.get("theme");let s;if(i){if(s=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),s){const o=s.content,c=i==="light"?s.dataset.themeLightColorTemp:s.dataset.themeDarkColorTemp;s.content=c||"",setTimeout(()=>{s.content=o},10)}}else{const o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(s=document.querySelector(`meta[name="theme-color"][media*="${o}"]`),s){const c=s.dataset.content,a=s.dataset.contentTemp;s.content=a||"",setTimeout(()=>{s.content=c},10)}}}});{const n=ke.local.get("theme");if(n){document.documentElement.classList.add(`is-${n}`),document.querySelector('meta[name="color-scheme"]').setAttribute("content",n||"light dark");const s=document.querySelector('meta[data-theme-setting="manual"]');s&&(s.name="theme-color",s.content=n==="light"?s.dataset.themeLightColor:s.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(c=>{c.name=""})}const i=ke.local.get("textSize");i&&document.documentElement.style.setProperty("--text-size",`${i}px`)}bo(R,n=>{for(const[i,s,o,c]of n){if(s.join(".")==="settings.shortcutsViewMode"){const a=document.getElementById("app");a&&(a.dataset.shortcutsViewMode=R.shortcuts?.length?o:"")}s.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});const Bn=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(n){},end(n){}};document.body.classList.toggle("exp-tab-bar-v2",ke.local.get("experiments-tabBarV2")??!1);const Fn=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0,Oh=3600*1e3;function zh(){const[n,i]=$(()=>!!ln()),[s,o]=$("loading");__BENCHMARK.start("app-init"),__BENCHMARK.start("time-to-following"),__BENCHMARK.start("time-to-home"),__BENCHMARK.start("time-to-isLoggedIn"),ce(),G(()=>{const l=ke.local.get("instanceURL"),d=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(d){if(window.opener&&!window.opener.closed){try{window.opener.postMessage({type:"oauth-callback",code:d},window.location.origin),setTimeout(()=>{window.close()},100)}catch{window.close()}return}window.history.replaceState({},document.title,window.location.pathname||"/");const{client_id:h,client_secret:f,vapid_key:p}=So(l)||{},g=ei(l)||p,y=ke.sessionCookie.get("codeVerifier");(async()=>{o("loading");const{access_token:w}=await ar({instanceURL:l,client_id:h,client_secret:f,code:d,code_verifier:y||void 0});if(w){const k=Jc({instance:l,accessToken:w});await Promise.allSettled([_i(k),Ii(k,l),ea(k,l,w,g)]),ws(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,i(!0),o("default");const b=ke.session.get("loginRedirect");b&&(ke.session.del("loginRedirect"),window.location.hash=b)}else o("error");__BENCHMARK.end("app-init")})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;const r=decodeURIComponent((window.location.search.match(/account=([^&]+)/)||[,""])[1]);let h;if(r&&(h=ta(r),h&&(Jn(h.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),h||(h=ln()),h){Jn(h.info.id);const{client:f}=oe({account:h}),{instance:p}=f;ws(),o("loading"),(async()=>{try{na()&&ia(p)?(_i(f),Ii(f,p)):await Promise.allSettled([_i(f),Ii(f,p)])}catch{}finally{i(!0),o("default"),__BENCHMARK.end("app-init")}})()}else o("default"),__BENCHMARK.end("app-init")}ke.sessionCookie.del("clientID"),ke.sessionCookie.del("clientSecret"),ke.sessionCookie.del("codeVerifier")},[]);let c=en();R.currentLocation=c.pathname,G(Oi,[c,n]);const a=j(!1),u="pwaLastPath";return G(()=>{a.current&&Fn&&n&&(Pc(c.pathname)?ke.local.del(u):ke.local.setJSON(u,{path:c.pathname+c.search,lastAccessed:Date.now()}))},[c.pathname,c.search,n]),G(()=>{if(!(a.current||!(!c.pathname||c.pathname==="/"))&&Fn&&n&&s==="default"){const d=ke.local.getJSON(u);d&&setTimeout(()=>{d?.path&&Date.now()-(d.lastAccessed||0){"serviceWorker"in navigator&&Fn&&s==="default"&&navigator.serviceWorker.getRegistration().then(function(l){l&&l.active&&l.active.postMessage({type:"client-ready"})}).catch(function(l){})},[Fn,s]),/\/https?:/.test(c.pathname)?e(Gu,{}):s==="loading"?e(qe,{id:"loader-root"}):e(Ma,{value:n,children:[e(Bh,{}),e(Fh,{}),e(Xi,{children:e(Ge,{path:"/:instance?/s/:id",element:e(wh,{})})}),n&&e(Oa,{}),n&&e(bd,{}),e(rd,{}),n&&e(fd,{}),e(Da,{}),n&&e(ld,{}),e(yd,{onClose:Oi}),e(za,{})]})}function qh(){const n=yi();return n&&__BENCHMARK.end("time-to-isLoggedIn"),n?e(Vu,{}):e(Mc,{})}function Pc(n){return/^\/(login|welcome|_sandbox|_qr-scan|_mock)/i.test(n)}const Bh=ut(()=>{const n=en(),i=xe(()=>{const{pathname:s}=n;return!Pc(s)},[n]);return e(Xi,{location:i||n,children:[e(Ge,{path:"/",element:e(qh,{})}),e(Ge,{path:"/login",element:e(ih,{})}),e(Ge,{path:"/welcome",element:e(Mc,{})}),e(Ge,{path:"/_mock/home",element:e(_o,{children:e(Ph,{})})}),void 0]})});function gt({children:n}){const i=yi(),s=en();if(!i){const o=s.pathname+s.search;return ke.session.set("loginRedirect",o),e(sa,{to:"/login",replace:!0})}return n}function go(){return R.prevLocation||null}function Fh(){const n=en(),i=j(go()),s=xe(()=>_n("/:instance/s/:id",n.pathname)||_n("/s/:id",n.pathname),[n.pathname,_n]);return G(()=>{s?R.prevLocation&&ke.session.setJSON("prevLocation",{pathname:R.prevLocation.pathname,search:R.prevLocation.search}):(R.prevLocation&&(R.prevLocation=null),ke.session.del("prevLocation"))},[s]),s?i.current||(i.current=go()):i.current=null,e(Xi,{location:i.current||n,children:[e(Ge,{path:"/notifications",element:e(gt,{children:e(Ac,{})})}),e(Ge,{path:"/mentions",element:e(gt,{children:e(Sc,{})})}),e(Ge,{path:"/following",element:e(gt,{children:e(ys,{})})}),e(Ge,{path:"/b",element:e(gt,{children:e(hc,{})})}),e(Ge,{path:"/f",element:e(gt,{children:e(pc,{})})}),e(Ge,{path:"/l",children:[e(Ge,{index:!0,element:e(gt,{children:e(Zu,{})})}),e(Ge,{path:":id",element:e(gt,{children:e(vc,{})})})]}),e(Ge,{path:"/fh",element:e(gt,{children:e(ru,{})})}),e(Ge,{path:"/sp",element:e(gt,{children:e(oh,{})})}),e(Ge,{path:"/ft",element:e(gt,{children:e(su,{})})}),e(Ge,{path:"/catchup",element:e(gt,{children:e(Vd,{})})}),e(Ge,{path:"/yip",element:e(gt,{children:e(_o,{fallback:e("div",{id:"year-in-posts-page",class:"deck-container",tabIndex:"-1",children:e(qe,{})}),children:e(Dh,{})})})}),e(Ge,{path:"/annual_report/:year",element:e(gt,{children:e(qd,{})})}),e(Ge,{path:"/:instance?/t/:hashtag",element:e(yc,{})}),e(Ge,{path:"/:instance?/a/:id",element:e(uc,{})}),e(Ge,{path:"/:instance?/p",children:[e(Ge,{index:!0,element:e(Ki,{})}),e(Ge,{path:"l",element:e(Ki,{local:!0})})]}),e(Ge,{path:"/:instance?/trending",element:e(Rc,{})}),e(Ge,{path:"/:instance?/search",element:e(Tc,{})})]})}oa();ca();aa(e(ra,{i18n:he,children:e(la,{children:e(da,{children:e(zh,{})})})}),document.getElementById("app"));setTimeout(()=>{try{localStorage.removeItem("settings-groupedNotificationsAlpha")}catch{}},5e3);if("serviceWorker"in navigator&&typeof caches<"u"){const i=["icons"];let s=!1;const o=1e4,c=3600*1e3;async function a(){if(window.__IDLE__)try{const u=await caches.keys();for(const l of u){if(i.includes(l))continue;const d=await caches.open(l),r=await d.keys();if(r.length>50){const h=r.slice(50);for(const f of h)await d.delete(f)}}s=!0}catch{}setTimeout(a,s?c:o)}setTimeout(a,o)}if("serviceWorker"in navigator){let n=function(i){if(!i)return null;const s=[];return i.title&&s.push(i.title),i.text&&s.push(i.text),i.url&&s.push(i.url),{initialText:s.join(` `),files:i.files||[]}};navigator.serviceWorker.addEventListener("message",i=>{const{data:s,action:o}=i.data||{};if(o==="compose-with-shared-data"){const c=n(s);c&&(window.__SHARED_DATA__=c,R.showCompose=!0)}})}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")};export{ct as B,Oa as C,Kt as N,bd as S,jo as i,tf as u}; //# sourceMappingURL=main-D3CNzg9q.js.map