Files
phanpy-cz/assets/main-sgpw-Fwy.js
2025-10-09 15:50:02 +02:00

37 lines
311 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{A as q,y as G,M as lt,u as ae,d as R,s as E,a as se,b as Je,p as yt,c as Ge,q as tt,g as vt,e,k as D,T as h,f as vi,h as xt,i as Gt,j as Ln,l as Te,m as ke,L as Do,C as Xn,n as Oo,o as zo,r as Mn,t as yi,v as Hi,w as bi,x as Qt,z as qn,B as Oe,E as Fo,F as wi,G as ue,H as $n,I as Nn,_ as St,J as Ls,K as su,N as Ms,O as $s,P as Bo,Q as qo,R as at,S as Uo,U as ki,V as Ko,W as bt,X as Ho,Y as jo,Z as Si,$ as Ci,a0 as Pt,a1 as Qe,a2 as Ns,a3 as Yo,a4 as Ps,a5 as Vo,a6 as Go,a7 as an,a8 as Wo,ab as Zo,ac as Jn,ad as Qn,ae as Xo,af as ji,ag as Jo,ah as Qo,ai as ec,aj as _i,ak as Ze,am as tc,an as nc,ao as ic,ap as sc,aq as oc,ar as cc}from"./pwa-viewport-cDxGxYgG.js";import{u as Ii,w as Ue,s as le,o as Yi,a as ac,V as Ds,b as Os,I,C as Ai,M as Ke,c as He,S as hn,d as ge,e as Un,R as Ct,n as st,f as zs,g as qe,A as pt,N as mt,h as rt,i as ft,L as fe,l as Mt,j as rc,k as Fs,m as Nt,p as lu,q as Xe,r as Kn,t as ut,v as Vi,T as Bs,x as it,y as li,z as qs,E as Us,B as We,D as gt,F as je,G as Tt,H as lc,J as dc,K as Ft,O as Ti,P as Ks,Q as uc,U as Zt,W as hc,X as pc,Y as Hn,Z as fc,_ as qt,$ as mc,a0 as gc,a1 as Hs,a2 as vc,a3 as xi,a4 as yc,a5 as bc,a6 as wc,a7 as kc,a8 as Sc,a9 as js,aa as Cc,ab as _c,ac as Gi,ad as Ic,ae as Ac}from"./ScheduledAtField-O5kh-u-d.js";import{ICONS as jt}from"./ICONS-BLqAe1AS.js";var Ys=Tc;function Tc(n,i,o){var s=null,c=null,a=function(){s&&(clearTimeout(s),c=null,s=null)},p=function(){var l=c;a(),l&&l()},d=function(){if(!i)return n.apply(this,arguments);var l=this,r=arguments,u=o&&!s;if(a(),c=function(){n.apply(l,r)},s=setTimeout(function(){if(s=null,!u){var m=c;return c=null,m()}},i),u)return c()};return d.cancel=a,d.flush=p,d}/*!
* swiped-events.js - v@version@
* Pure JavaScript swipe events
* https://github.com/john-doherty/swiped-events
* @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element
* @author John Doherty <www.johndoherty.info>
* @license MIT
*/(function(n,i){"use strict";typeof n.CustomEvent!="function"&&(n.CustomEvent=function(v,y){y=y||{bubbles:!1,cancelable:!1,detail:void 0};var S=i.createEvent("CustomEvent");return S.initCustomEvent(v,y.bubbles,y.cancelable,y.detail),S},n.CustomEvent.prototype=n.Event.prototype),i.addEventListener("touchstart",u,!1),i.addEventListener("touchmove",m,!1),i.addEventListener("touchend",r,!1);var o=null,s=null,c=null,a=null,p=null,d=null,l=0;function r(v){if(d===v.target){var y=parseInt(f(d,"data-swipe-threshold","20"),10),S=f(d,"data-swipe-unit","px"),k=parseInt(f(d,"data-swipe-timeout","500"),10),b=Date.now()-p,g="",_=v.changedTouches||v.touches||[];if(S==="vh"&&(y=Math.round(y/100*i.documentElement.clientHeight)),S==="vw"&&(y=Math.round(y/100*i.documentElement.clientWidth)),Math.abs(c)>Math.abs(a)?Math.abs(c)>y&&b<k&&(c>0?g="swiped-left":g="swiped-right"):Math.abs(a)>y&&b<k&&(a>0?g="swiped-up":g="swiped-down"),g!==""){var w={dir:g.replace(/swiped-/,""),touchType:(_[0]||{}).touchType||"direct",fingers:l,xStart:parseInt(o,10),xEnd:parseInt((_[0]||{}).clientX||-1,10),yStart:parseInt(s,10),yEnd:parseInt((_[0]||{}).clientY||-1,10)};d.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:w})),d.dispatchEvent(new CustomEvent(g,{bubbles:!0,cancelable:!0,detail:w}))}o=null,s=null,p=null}}function u(v){v.target.getAttribute("data-swipe-ignore")!=="true"&&(d=v.target,p=Date.now(),o=v.touches[0].clientX,s=v.touches[0].clientY,c=0,a=0,l=v.touches.length)}function m(v){if(!(!o||!s)){var y=v.touches[0].clientX,S=v.touches[0].clientY;c=o-y,a=s-S}}function f(v,y,S){for(;v&&v!==i.documentElement;){var k=v.getAttribute(y);if(k)return k;v=v.parentNode}return S}})(window,document);function Xt(n=()=>{},i=[]){const o=q(n);G(()=>{o.current=n},[i]),G(()=>{const s=()=>{const c=document.hidden||document.visibilityState==="hidden";o.current(!c)};return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[])}const xc=1e3*3,Wi=2e4,Ec=lt(function({isLoggedIn:i}){const{_:o}=ae(),[s,c]=R(!0),a=q();Xt(r=>{clearTimeout(a.current),r?c(!0):a.current=setTimeout(()=>{c(!1)},Wi)});const p=async(r,u,m)=>{if(E.notificationsLast){const f=r.v1.notifications.list({limit:1,sinceId:E.notificationsLast.id}).values(),{value:v}=await f.next();if(v?.length)if(m)E.notificationsShowNew=!0;else{let y;try{y=(await r.v1.markers.fetch({timeline:"notifications"}))?.notifications?.lastReadId}catch{}y?E.notificationsShowNew=v[0].id!==y:E.notificationsShowNew=!0}}};G(()=>{let r,u,m;if(i&&s){const{masto:f,streaming:v,instance:y}=se();(async()=>{await p(f,y);let S=!1;v&&(u=setTimeout(()=>{(async()=>{try{S=!0,r=v.user.notification.subscribe();for await(const k of r){if(!r||!s)break;k.event==="notification"&&Je(k.payload,y,{skipThreading:!0}),E.notificationsShowNew=!0}}catch{S=!1}S||(m=setInterval(()=>{p(f,y,!0)},Wi))})()},xc))})()}return()=>{r?.unsubscribe?.(),r=null,clearTimeout(u),clearInterval(m)}},[s,i]);const d=q(),l=()=>{d.current=Date.now(),fetch("./version.json").then(r=>r.json()).then(r=>{r&&(E.appVersion=r)}).catch(r=>{})};return Ii(l,s&&1e3*60*30),Xt(r=>{r&&(d.current?Date.now()-d.current>1e3*60*60&&l():l())}),Ue("shift+alt+k",r=>{if(!r.shiftKey||!r.altKey)return;const u=E.settings.cloakMode;E.settings.cloakMode=!u,le({text:o(u?{id:"oguMwa"}:{id:"IXZLPs"})})},{useKey:!0,ignoreEventWhen:r=>r.metaKey||r.ctrlKey}),null}),Rc=yt(async(n,i)=>{const o=n.v1.accounts.$select(i).statuses.list({limit:3,exclude_replies:!0,exclude_reblogs:!0}).values(),{value:s}=await o.next();return s||[]},{maxAge:6e4});function Lc(){const{_:n}=ae(),i=Ge(E),{masto:o}=se(),[s,c]=R(!1),[a,p]=R([]),[d,l]=R(!1),r=q(null),u=q(null),m=i.settings.shortcutsViewMode==="multi-column";function f(k){if(k.key&&k.key.toLowerCase()!=="c")return;if(i.composerState.minimized){E.composerState.minimized=!1,Yi();return}const b=document.querySelectorAll("data.compose-data"),g=!m&&b.length===1?JSON.parse(b[0].value):void 0;k.shiftKey?ac(g)||(E.showCompose=g||!0):(Yi(),E.showCompose=g||!0)}Ue("c, shift+c",f,{useKey:!0,ignoreEventWhen:k=>!!document.querySelector("#modal-container > *")||k.metaKey||k.ctrlKey||k.altKey});const v=Ds(()=>{c(!0)},{threshold:600}),y=tt(async()=>{try{l(!0);const k=vt();if(!k)return;const b=await Rc(o,k);p(b)}catch{}finally{l(!1)}},[o]),S=tt(k=>{Os({replyToStatus:k}),c(!1)},[]);return G(()=>{s&&y()},[y,s]),e(D,{children:[e("button",{ref:r,type:"button",id:"compose-button",onClick:f,onContextMenu:k=>{k.preventDefault(),c(!0)},...v(),class:`${i.composerState.minimized?"min":""} ${i.composerState.publishing?"loading":""} ${i.composerState.publishingError?"error":""}`,children:e(I,{icon:"quill",size:"xl",alt:n({id:"QOhkyl"})})}),e(Ai,{ref:u,state:s?"open":void 0,anchorRef:r,onClose:()=>c(!1),direction:"top",gap:8,unmountOnClose:!0,portal:{target:document.body},boundingBoxPadding:zs(),containerProps:{style:{zIndex:19},onClick:()=>{u.current?.closeMenu?.()}},submenuOpenDelay:600,children:[e(Ke,{to:"/sp",children:[e(I,{icon:"schedule"})," ",e("span",{children:e(h,{id:"+GkIdc"})})]}),e(He,{}),e(hn,{align:"end",direction:"top",shift:-8,disabled:d||a.length===0,label:e(D,{children:[e(I,{icon:"comment"})," ",e("span",{className:"menu-grow",children:e(h,{id:"LwOr4P"})}),d?"…":e(I,{icon:"chevron-right"})]}),children:a.length>0&&a.map(k=>{const b=new Date(k.createdAt),g=Date.now()-b.getTime()<864e5;return e(ge,{onClick:()=>S(k),children:e("small",{children:[e("div",{class:"menu-post-text",children:Un(k)}),e("span",{className:"more-insignificant",children:[g&&e(D,{children:[e(Ct,{datetime:b,format:"micro"})," ",""," "]}),e("time",{className:"created",dateTime:b.toISOString(),title:b.toLocaleString(),children:st(k.createdAt)})]})]})},k.id)})})]})]})}const Mc=lt(function(){const{_:i}=ae(),o=Ge(E);function s(){E.showKeyboardShortcutsHelp=!1}return Ue("?",()=>{E.showKeyboardShortcutsHelp=!0},{useKey:!0,ignoreEventWhen:c=>/\/catchup/i.test(location.hash)||c.metaKey||c.ctrlKey||c.altKey}),!!o.showKeyboardShortcutsHelp&&e(qe,{onClose:s,children:e("div",{id:"keyboard-shortcuts-help-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(h,{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(h,{id:"mzjGX4",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"S5ez7Y"}),keys:e(h,{id:"Fd8FaU",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"VkLESX"}),keys:e("kbd",{children:"."})},{action:i({id:"jsFF8C"}),keys:e(h,{id:"80sOCm",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:e(h,{id:"41gejM",components:{0:e("br",{})}}),keys:e("kbd",{children:"x"})},{action:i({id:"jAj8rv"}),keys:e(h,{id:"evz6c6",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"duF1lx"}),keys:e(h,{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(h,{id:"+Cxvld",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"1pKapz"}),keys:e(h,{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(h,{id:"XpQLJF",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"cqi4Mx"}),keys:e(h,{id:"84WuL2",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"kulphB"}),keys:e(h,{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(h,{id:"v4TbMP",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{})}})}].map(({action:c,className:a,keys:p})=>e("tr",{children:[e("th",{class:a,children:c}),e("td",{children:p})]},c))})})})]})})}),di=new Set,nt=new WeakMap,Ut=new WeakMap,ht=new WeakMap,rn=new WeakMap,ei=new WeakMap,on=new WeakMap,Bt=new WeakMap,$t=new WeakMap,Wt=new WeakSet;let ct,Ei=0,Ri=0;const It="__aa_tgt",ln="__aa_del",Pn="__aa_new",Vs=n=>{const i=Dc(n);i&&i.forEach(o=>Oc(o))},$c=n=>{n.forEach(i=>{i.target===ct&&Nc(),nt.has(i.target)&&Ht(i.target)})};function Gs(n){const i=n.getBoundingClientRect(),o=ct?.clientWidth||0,s=ct?.clientHeight||0;return i.bottom<0||i.top>s||i.right<0||i.left>o}function Li(n){const i=rn.get(n);i?.disconnect();let o=nt.get(n),s=0;const c=5;o||(o=Jt(n),nt.set(n,o));const{offsetWidth:a,offsetHeight:p}=ct,l=[o.top-c,a-(o.left+c+o.width),p-(o.top+c+o.height),o.left-c].map(u=>`${-1*Math.floor(u)}px`).join(" "),r=new IntersectionObserver(()=>{++s>1&&Ht(n)},{root:ct,threshold:1,rootMargin:l});r.observe(n),rn.set(n,r)}function Ht(n,i=!0){clearTimeout($t.get(n));const o=jn(n),s=i?dn(o)?500:o.duration:0;$t.set(n,setTimeout(async()=>{const c=ht.get(n);try{await c?.finished,nt.set(n,Jt(n)),Li(n)}catch{}},s))}function Nc(){clearTimeout($t.get(ct)),$t.set(ct,setTimeout(()=>{di.forEach(n=>Cn(n,i=>Ws(()=>Ht(i))))},100))}function Pc(n){setTimeout(()=>{on.set(n,setInterval(()=>Ws(Ht.bind(null,n)),2e3))},Math.round(2e3*Math.random()))}function Ws(n){typeof requestIdleCallback=="function"?requestIdleCallback(()=>n()):requestAnimationFrame(()=>n())}let _t;const Zs=typeof window<"u"&&"ResizeObserver"in window;Zs&&(ct=document.documentElement,new MutationObserver(Vs),_t=new ResizeObserver($c),window.addEventListener("scroll",()=>{Ri=window.scrollY,Ei=window.scrollX}),_t.observe(ct));function Dc(n){return n.reduce((s,c)=>[...s,...Array.from(c.addedNodes),...Array.from(c.removedNodes)],[]).every(s=>s.nodeName==="#comment")?!1:n.reduce((s,c)=>{if(s===!1)return!1;if(c.target instanceof Element){if(ti(c.target),!s.has(c.target)){s.add(c.target);for(let a=0;a<c.target.children.length;a++){const p=c.target.children.item(a);if(p){if(ln in p)return!1;ti(c.target,p),s.add(p)}}}if(c.removedNodes.length)for(let a=0;a<c.removedNodes.length;a++){const p=c.removedNodes[a];if(ln in p)return!1;p instanceof Element&&(s.add(p),ti(c.target,p),Ut.set(p,[c.previousSibling,c.nextSibling]))}}return s},new Set)}function ti(n,i){!i&&!(It in n)?Object.defineProperty(n,It,{value:n}):i&&!(It in i)&&Object.defineProperty(i,It,{value:n})}function Oc(n){var i,o;const s=n.isConnected,c=nt.has(n);s&&Ut.has(n)&&Ut.delete(n),((i=ht.get(n))===null||i===void 0?void 0:i.playState)!=="finished"&&((o=ht.get(n))===null||o===void 0||o.cancel()),Pn in n?Zi(n):c&&s?Fc(n):c&&!s?Bc(n):Zi(n)}function kt(n){return Number(n.replace(/[^0-9.\-]/g,""))}function zc(n){let i=n.parentElement;for(;i;){if(i.scrollLeft||i.scrollTop)return{x:i.scrollLeft,y:i.scrollTop};i=i.parentElement}return{x:0,y:0}}function Jt(n){const i=n.getBoundingClientRect(),{x:o,y:s}=zc(n);return{top:i.top+s,left:i.left+o,width:i.width,height:i.height}}function Xs(n,i,o){let s=i.width,c=i.height,a=o.width,p=o.height;const d=getComputedStyle(n);if(d.getPropertyValue("box-sizing")==="content-box"){const r=kt(d.paddingTop)+kt(d.paddingBottom)+kt(d.borderTopWidth)+kt(d.borderBottomWidth),u=kt(d.paddingLeft)+kt(d.paddingRight)+kt(d.borderRightWidth)+kt(d.borderLeftWidth);s-=u,a-=u,c-=r,p-=r}return[s,a,c,p].map(Math.round)}function jn(n){return It in n&&Bt.has(n[It])?Bt.get(n[It]):{duration:250,easing:"ease-in-out"}}function Js(n){if(It in n)return n[It]}function Mi(n){const i=Js(n);return i?Wt.has(i):!1}function Cn(n,...i){i.forEach(o=>o(n,Bt.has(n)));for(let o=0;o<n.children.length;o++){const s=n.children.item(o);s&&i.forEach(c=>c(s,Bt.has(s)))}}function $i(n){return Array.isArray(n)?n:[n]}function dn(n){return typeof n=="function"}function Fc(n){const i=nt.get(n),o=Jt(n);if(!Mi(n))return nt.set(n,o);if(Gs(n)){nt.set(n,o),Li(n);return}let s;if(!i)return;const c=jn(n);if(typeof c!="function"){let a=i.left-o.left,p=i.top-o.top;const d=i.left+i.width-(o.left+o.width);i.top+i.height-(o.top+o.height)==0&&(p=0),d==0&&(a=0);const[r,u,m,f]=Xs(n,i,o),v={transform:`translate(${a}px, ${p}px)`},y={transform:"translate(0, 0)"};r!==u&&(v.width=`${r}px`,y.width=`${u}px`),m!==f&&(v.height=`${m}px`,y.height=`${f}px`),s=n.animate([v,y],{duration:c.duration,easing:c.easing})}else{const[a]=$i(c(n,"remain",i,o));s=new Animation(a),s.play()}ht.set(n,s),nt.set(n,o),s.addEventListener("finish",Ht.bind(null,n,!1),{once:!0})}function Zi(n){Pn in n&&delete n[Pn];const i=Jt(n);nt.set(n,i);const o=jn(n);if(!Mi(n))return;if(Gs(n)){Li(n);return}let s;if(typeof o!="function")s=n.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:o.duration*1.5,easing:"ease-in"});else{const[c]=$i(o(n,"add",i));s=new Animation(c),s.play()}ht.set(n,s),s.addEventListener("finish",Ht.bind(null,n,!1),{once:!0})}function Xi(n,i){var o;n.remove(),nt.delete(n),Ut.delete(n),ht.delete(n),(o=rn.get(n))===null||o===void 0||o.disconnect(),setTimeout(()=>{if(ln in n&&delete n[ln],Object.defineProperty(n,Pn,{value:!0,configurable:!0}),i&&n instanceof HTMLElement)for(const s in i)n.style[s]=""},0)}function Bc(n){var i;if(!Ut.has(n)||!nt.has(n))return;const[o,s]=Ut.get(n);Object.defineProperty(n,ln,{value:!0,configurable:!0});const c=window.scrollX,a=window.scrollY;if(s&&s.parentNode&&s.parentNode instanceof Element?s.parentNode.insertBefore(n,s):o&&o.parentNode?o.parentNode.appendChild(n):(i=Js(n))===null||i===void 0||i.appendChild(n),!Mi(n))return Xi(n);const[p,d,l,r]=Uc(n),u=jn(n),m=nt.get(n);(c!==Ei||a!==Ri)&&qc(n,c,a,u);let f,v={position:"absolute",top:`${p}px`,left:`${d}px`,width:`${l}px`,height:`${r}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!dn(u))Object.assign(n.style,v),f=n.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:u.duration,easing:"ease-out"});else{const[y,S]=$i(u(n,"remove",m));S?.styleReset!==!1&&(v=S?.styleReset||v,Object.assign(n.style,v)),f=new Animation(y),f.play()}ht.set(n,f),f.addEventListener("finish",()=>Xi(n,v),{once:!0})}function qc(n,i,o,s){const c=Ei-i,a=Ri-o,p=document.documentElement.style.scrollBehavior;if(getComputedStyle(ct).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+c,window.scrollY+a),!n.parentElement)return;const l=n.parentElement;let r=l.clientHeight,u=l.clientWidth;const m=performance.now();function f(){requestAnimationFrame(()=>{if(!dn(s)){const v=r-l.clientHeight,y=u-l.clientWidth;m+s.duration>performance.now()?(window.scrollTo({left:window.scrollX-y,top:window.scrollY-v}),r=l.clientHeight,u=l.clientWidth,f()):document.documentElement.style.scrollBehavior=p}})}f()}function Uc(n){var i;const o=nt.get(n),[s,,c]=Xs(n,o,Jt(n));let a=n.parentElement;for(;a&&(getComputedStyle(a).position==="static"||a instanceof HTMLBodyElement);)a=a.parentElement;a||(a=document.body);const p=getComputedStyle(a),d=!ht.has(n)||((i=ht.get(n))===null||i===void 0?void 0:i.playState)==="finished"?Jt(a):nt.get(a),l=Math.round(o.top-d.top)-kt(p.borderTopWidth),r=Math.round(o.left-d.left)-kt(p.borderLeftWidth);return[l,r,s,c]}function Qs(n,i={}){if(Zs&&_t&&!(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!dn(i)&&!i.disrespectUserMotionPreference)){Wt.add(n),getComputedStyle(n).position==="static"&&Object.assign(n.style,{position:"relative"}),Cn(n,Ht,Pc,p=>_t?.observe(p)),dn(i)?Bt.set(n,i):Bt.set(n,{duration:250,easing:"ease-in-out",...i});const a=new MutationObserver(Vs);a.observe(n,{childList:!0}),ei.set(n,a),di.add(n)}return Object.freeze({parent:n,enable:()=>{Wt.add(n)},disable:()=>{Wt.delete(n),Cn(n,s=>{const c=ht.get(s);try{c?.cancel()}catch{}ht.delete(s);const a=$t.get(s);a&&clearTimeout(a),$t.delete(s);const p=on.get(s);p&&clearInterval(p),on.delete(s)})},isEnabled:()=>Wt.has(n),destroy:()=>{Wt.delete(n),di.delete(n),Bt.delete(n);const s=ei.get(n);s?.disconnect(),ei.delete(n),Cn(n,c=>{_t?.unobserve(c);const a=ht.get(c);try{a?.cancel()}catch{}ht.delete(c);const p=rn.get(c);p?.disconnect(),rn.delete(c);const d=on.get(c);d&&clearInterval(d),on.delete(c);const l=$t.get(c);l&&clearTimeout(l),$t.delete(c),nt.delete(c),Ut.delete(c)})}})}function Yn(n){const i=q(null),[o,s]=R(),c=a=>{o&&(a?o.enable():o.disable())};return G(()=>{i.current instanceof HTMLElement&&s(Qs(i.current,n||{}))},[]),G(()=>()=>{var a;(a=o?.destroy)===null||a===void 0||a.call(o)},[o]),[i,c]}function Kc(n){return("0"+n.toString(16)).slice(-2)}function Hc(){var n=new Uint32Array(28);return window.crypto.getRandomValues(n),Array.from(n,Kc).join("")}function jc(n){const o=new TextEncoder().encode(n);return window.crypto.subtle.digest("SHA-256",o)}function Yc(n){let i="";const o=new Uint8Array(n),s=o.byteLength;for(var c=0;c<s;c++)i+=String.fromCharCode(o[c]);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function eo(n){const i=await jc(n);return Yc(i)}async function Vc({instanceURL:n}){if(!n)return!1;try{const i=await fetch(`https://${n}/.well-known/oauth-authorization-server`);return!i.ok||i.status!==200?!1:!!(await i.json()).code_challenge_methods_supported?.includes("S256")}catch{return!1}}window.__generateCodeChallenge=eo;const Gc={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{DEV:Wc,PHANPY_CLIENT_NAME:Zc,PHANPY_WEBSITE:Dn}=Gc,Ni="read write follow push",Xc=Dn?Dn.toLowerCase().includes(location.hostname):!1,Jc=location.origin+location.pathname,Vn=Wc||!Xc?Jc:Dn;async function Qc({instanceURL:n}){const i=new URLSearchParams({client_name:Zc,redirect_uris:Vn,scopes:Ni,website:Dn});return await(await fetch(`https://${n}/api/v1/apps`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i.toString()})).json()}async function ea({instanceURL:n,client_id:i,forceLogin:o=!1}){const s=Hc(),c=await eo(s),a=new URLSearchParams({client_id:i,code_challenge_method:"S256",code_challenge:c,redirect_uri:Vn,response_type:"code",scope:Ni});return o&&a.append("force_login",!0),[`https://${n}/oauth/authorize?${a.toString()}`,s]}async function ta({instanceURL:n,client_id:i,forceLogin:o=!1}){const s=new URLSearchParams({client_id:i,scope:Ni,redirect_uri:Vn,response_type:"code"});return o&&s.append("force_login",!0),`https://${n}/oauth/authorize?${s.toString()}`}async function na({instanceURL:n,client_id:i,client_secret:o,code:s,code_verifier:c}){const a=new URLSearchParams({client_id:i,redirect_uri:Vn,grant_type:"authorization_code",code:s});return o&&a.append("client_secret",o),c&&a.append("code_verifier",c),await(await fetch(`https://${n}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString()})).json()}async function ia({instanceURL:n,client_id:i,client_secret:o,token:s}){try{const c=new URLSearchParams({client_id:i,client_secret:o,token:s});return(await fetch(`https://${n}/oauth/revoke`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:c.toString(),keepalive:!0})).ok}catch(c){return console.erro("Error revoking token",c),!1}}const sa=window.matchMedia("(display-mode: standalone)").matches;function oa({onClose:n}){const{_:i}=ae(),{masto:o}=se(),s=vi(),c=vt(),a=s.length>1,[p,d]=xt(r=>r+1,0),[l]=Yn();return e("div",{id:"accounts-container",class:"sheet",tabIndex:"-1",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(h,{id:"bPwFdf"})})}),e("main",{children:e("section",{children:[e("ul",{class:"accounts-list",ref:l,children:s.map((r,u)=>{const m=r.info.id===c,f=u===0;return e("li",{children:[e("div",{children:[a&&e("span",{class:`current ${m?"is-current":""}`,children:e(I,{icon:"check-circle",alt:i({id:"Hp1l6f"})})}),e(pt,{url:r.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(m)try{const v=await o.v1.accounts.$select(r.info.id).fetch();r.info=v,Gt(s),d()}catch{}}}),e(mt,{account:a?{...r.info,acct:/@/.test(r.info.acct)?r.info.acct:`${r.info.acct}@${r.instanceURL}`}:r.info,showAcct:!0,onClick:()=>{m?E.showAccount=`${r.info.username}@${r.instanceURL}`:(Ln(r.info.id),location.reload())}})]}),e("div",{class:"actions",children:[f&&a&&e(D,{children:[e("span",{class:"tag",children:e(h,{id:"ovBPCi"})})," "]}),e(rt,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[a&&e(D,{children:[e(ge,{disabled:m,onClick:()=>{Ln(r.info.id),location.reload()},children:[e(I,{icon:"transfer"})," ",e(h,{id:"3t/Nrv"})]}),!sa&&!m&&e(Ke,{href:`./?account=${r.info.id}`,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(h,{id:"PZgZtY"})})]}),e(He,{})]}),e(ge,{onClick:()=>{E.showAccount=`${r.info.username}@${r.instanceURL}`},children:[e(I,{icon:"user"}),e("span",{children:e(h,{id:"40z2Fm"})})]}),e(He,{}),a&&e(D,{children:[e(ge,{disabled:f,onClick:()=>{s.splice(u,1),s.unshift(r),Gt(s),d()},children:[e(I,{icon:"check-circle"}),e("span",{children:e(h,{id:"PPcets"})})]}),e(ge,{disabled:u<=1,onClick:()=>{s.splice(u,1),s.splice(u-1,0,r),Gt(s),d()},children:[e(I,{icon:"arrow-up"}),e("span",{children:e(h,{id:"QyioBP"})})]}),e(ge,{disabled:u===0||u===s.length-1,onClick:()=>{s.splice(u,1),s.splice(u+1,0,r),Gt(s),d()},children:[e(I,{icon:"arrow-down"}),e("span",{children:e(h,{id:"3Ib6FN"})})]}),e(He,{})]}),e(ft,{subMenu:!0,confirmLabel:e(D,{children:[e(I,{icon:"exit"}),e("span",{children:e(h,{id:"k08LxG",values:{0:r.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),disabled:!m,menuItemClassName:"danger",onClick:async()=>{await ia({instanceURL:r.instanceURL,client_id:r.clientId,client_secret:r.clientSecret,token:r.accessToken}),s.splice(u,1),Gt(s);try{Te.session.get("currentAccount")===r.info.id&&Te.session.del("currentAccount")}catch{}location.href=location.pathname||"/"},children:[e(I,{icon:"exit"}),e("span",{children:e(h,{id:"CXk1bI"})})]}),!!r?.createdAt&&e("div",{class:"footer",children:[e(I,{icon:"account-add"}),e("span",{children:e(h,{id:"+9E7iR",values:{0:st(r.createdAt)},components:{0:e(Ct,{datetime:r.createdAt})}})})]})]})]})]},r.info.id)})}),e("p",{children:e(fe,{to:"/login",class:"button plain2",onClick:n,children:[e(I,{icon:"plus"})," ",e("span",{children:e(h,{id:"Is7/PB"})})]})}),a&&e("p",{children:e("small",{children:e(h,{id:"52x24e",components:{0:e("i",{})}})})})]})})]})}const Pi="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='none'%20d='M0%200h63.994v63.994H0z'/%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",ca={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function Di(){const{i18n:n}=ae(),i=ke(()=>Do.map(o=>{const s=ca[o]||o.replace(/-[a-z]+$/i,""),c=Mt({code:s,locale:o,fallback:Xn.find(p=>p.code===o)?.nativeName}),a=Mt({code:s,locale:n.locale,fallback:Xn.find(p=>p.code===o)?.name});return{code:o,regionlessCode:s,_common:a,native:c}}).sort((o,s)=>{const c=o._common.localeCompare(s._common,n.locale);return c!==0?c:o.code<s.code?-1:o.code>s.code?1:0}),[]);return e("label",{class:"lang-selector",children:["🌐"," ",e("select",{class:"small",value:n.locale||zo,onChange:o=>{Te.local.set("lang",o.target.value),Oo(o.target.value)},children:[i.map(({code:o,regionlessCode:s,native:c})=>{const a=Mt({code:s,locale:n.locale,fallback:Xn.find(d=>d.code===o)?.name});return e("option",{value:o,"data-regionless-code":s,children:!!a&&a!==c?`${c} - ${a}`:c},o)}),void 0]})]})}function Ji(n){const{masto:i}=se();return i.v1.push.subscription.create(n)}function aa(){const{masto:n}=se();return n.v1.push.subscription.fetch()}function ra(n){const{masto:i}=se();return i.v1.push.subscription.update(n)}function la(){const{masto:n}=se();return n.v1.push.subscription.remove()}function Gn(){return"serviceWorker"in navigator&&"PushManager"in window}function da(){return navigator.serviceWorker.getRegistration()}async function Oi(){const n=await da(),i=n?await n.pushManager.getSubscription():void 0;return{registration:n,subscription:i}}function to(n){const i="=".repeat((4-n.length%4)%4),o=`${n}${i}`.replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(o),c=new Uint8Array(s.length);for(let a=0;a<s.length;++a)c[a]=s.charCodeAt(a);return c}async function ua(){if(!Gn())return;const{subscription:n}=await Oi();let i=null;try{i=await aa()}catch(o){if(!/(not found|unknown)/i.test(o.message))throw o}if(i&&n){const o=i.endpoint===n.endpoint,s=Mn(),c=i.serverKey===s;if(!o)throw new Error("Backend subscription endpoint changed");if(!c)throw new Error("Backend subscription key and vapid key changed")}if(n&&!i){const o=Mn();if(o){const{applicationServerKey:s}=n.options,c=to(o).toString(),a=new Uint8Array(s).toString();if(!(c===a))throw await n.unsubscribe(),new Error("Subscription key and vapid key changed")}}return{subscription:n,backendSubscription:i}}async function Qi({data:n,policy:i}){if(!Gn())return;let{registration:o,subscription:s}=await Oi(),c=null;if(s)try{c=await ra({data:n,policy:i})}catch{c=await Ji({subscription:s,data:n,policy:i})}else{const a=Mn();if(!a)throw new Error("No server key found");s=await o.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:to(a)}),c=await Ji({subscription:s,data:n,policy:i})}return{subscription:s,backendSubscription:c}}async function es(){if(!Gn())return;const{subscription:n}=await Oi();n&&(await la(),await n.unsubscribe())}const ha={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},ts=16,Ot=[14,15,16,17,18,19,20],{PHANPY_WEBSITE:ns,PHANPY_PRIVACY_POLICY_URL:pa,PHANPY_TRANSLANG_INSTANCES:fa,PHANPY_IMG_ALT_API_URL:ma,PHANPY_GIPHY_API_KEY:ga}=ha,is=Object.entries(rc.tl).map(([n,i])=>({code:n,name:i})),va="TransLang API";function ya({onClose:n}){const{_:i}=ae(),o=Ge(E),s=Te.local.get("theme")||"auto",c=q(),a=o.settings.contentTranslationTargetLanguage||null,p=Fs(),d=Mt(p),l=Te.local.get("textSize")||ts,[r,u]=R(yi()),{masto:m,authenticated:f,instance:v}=se(),[y,S]=R(Te.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":`${l}px`},children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(h,{id:"Tz0i8g"})})}),e("main",{children:[e("section",{children:e("ul",{children:[e("li",{children:[e("div",{children:e("label",{children:e(h,{id:"aAIQg2"})})}),e("div",{children:e("form",{ref:c,onInput:b=>{b.preventDefault();const _=new FormData(c.current).get("theme"),w=document.documentElement;if(_==="auto"){w.classList.remove("is-light","is-dark");const A=document.querySelector('meta[data-theme-setting="manual"]');A&&(A.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(T=>{T.name="theme-color"})}else{w.classList.toggle("is-light",_==="light"),w.classList.toggle("is-dark",_==="dark");const A=document.querySelector('meta[data-theme-setting="manual"]');A&&(A.name="theme-color",A.content=_==="light"?A.dataset.themeLightColor:A.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(T=>{T.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",_==="auto"?"light dark":_),_==="auto"?Te.local.del("theme"):Te.local.set("theme",_)},children:e("div",{class:"radio-group",children:[e("label",{children:[e("input",{type:"radio",name:"theme",value:"light",defaultChecked:s==="light"}),e("span",{children:e(h,{id:"1njn7W"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:s==="dark"}),e("span",{children:e(h,{id:"pvnfJD"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:s!=="light"&&s!=="dark"}),e("span",{children:e(h,{id:"R9Khdg"})})]})]})})})]}),e("li",{children:[e("div",{children:e("label",{children:e(h,{id:"7r6sCa"})})}),e("div",{class:"range-group",children:[e("span",{style:{fontSize:Ot[0]},children:e(h,{id:"J6ypuD"})})," ",e("input",{type:"range",min:Ot[0],max:Ot[Ot.length-1],step:"1",value:l,list:"sizes",onChange:b=>{const g=parseInt(b.target.value,10);document.documentElement.style.setProperty("--text-size",`${g}px`),g===ts?Te.local.del("textSize"):Te.local.set("textSize",b.target.value)}})," ",e("span",{style:{fontSize:Ot[Ot.length-1]},children:e(h,{id:"J6ypuD"})}),e("datalist",{id:"sizes",children:Ot.map(b=>e("option",{value:b}))})]})]}),e("li",{children:[e("span",{children:[e("label",{children:e(h,{id:"CeJHfb"})}),e("br",{}),e("small",{children:e("a",{href:"https://crowdin.com/project/phanpy",target:"_blank",rel:"noopener",children:e(h,{id:"FFmj1D"})})})]}),e(Di,{})]})]})}),f&&e(D,{children:[e("h3",{children:e(h,{id:"PcoS3v"})}),e("section",{children:e("ul",{children:[e("li",{children:[e("div",{children:e("label",{for:"posting-privacy-field",children:[e(h,{id:"NAjVvt"})," ",e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})]})}),e("div",{children:e("select",{id:"posting-privacy-field",value:r["posting:default:visibility"]||"public",onChange:b=>{const{value:g}=b.target;(async()=>{try{await m.v1.accounts.updateCredentials({source:{privacy:g}});const _={...r,"posting:default:visibility":g};g==="private"&&(_["posting:default:quote_policy"]="nobody"),u(_),Hi(_)}catch{alert(i({id:"Oa+KBY"}))}})()},children:[e("option",{value:"public",children:e(h,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(h,{id:"pPYeIN"})}),e("option",{value:"private",children:e(h,{id:"x5LEuB"})})]})})]}),Nt()&&e("li",{children:[e("div",{children:e("label",{for:"posting-quote-policy-field",children:[e(h,{id:"eKInue"})," ",e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})]})}),e("div",{children:e("select",{id:"posting-quote-policy-field",value:r["posting:default:quote_policy"]||k?"nobody":"public",disabled:k,onChange:b=>{const{value:g}=b.target;(async()=>{try{await m.v1.accounts.updateCredentials({source:{quote_policy:g}}),u({...r,"posting:default:quote_policy":g}),Hi({...r,"posting:default:quote_policy":g})}catch{alert(i({id:"hEe3YR"}))}})()},children:[e("option",{value:"public",disabled:k,children:e(h,{id:"hDWXuG"})}),e("option",{value:"followers",disabled:k,children:e(h,{id:"9Ko+Xp"})}),e("option",{value:"nobody",children:e(h,{id:"+bAQ3S"})})]})})]})]})}),e("p",{class:"section-postnote",children:[e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(h,{id:"xlsg7n",values:{instance:v},components:{0:e("a",{href:`https://${v}/`,target:"_blank",rel:"noopener"})}})})]})]}),e("h3",{children:e(h,{id:"ivdhsq"})}),e("section",{children:e("ul",{children:[e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:o.settings.autoRefresh,onChange:b=>{E.settings.autoRefresh=b.target.checked}})," ",e(h,{id:"0mC0SF"})]})}),e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:o.settings.boostsCarousel,onChange:b=>{E.settings.boostsCarousel=b.target.checked}})," ",e(h,{id:"TSbnoW"})]})}),!!fa&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.contentTranslation,onChange:b=>{const{checked:g}=b.target;E.settings.contentTranslation=g,g||(E.settings.contentTranslationTargetLanguage=null)}})," ",e(h,{id:"0SdaOt"})]}),e("div",{class:`sub-section ${o.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:[e(h,{id:"zXCa9e"})," ",e("select",{value:a||"",disabled:!o.settings.contentTranslation,style:{width:"10em"},onChange:b=>{E.settings.contentTranslationTargetLanguage=b.target.value||null},children:[e("option",{value:"",children:e(h,{id:"jNCSyx",values:{systemTargetLanguageText:d}})}),e("option",{disabled:!0,children:"──────────"}),is.map(b=>{const g=Mt({code:b.code,fallback:b.name}),_=Mt({code:b.code,locale:b.code}),w=_&&g!==_;return e("option",{value:b.code,children:w?`${_} - ${g}`:g})})]})]})}),e("hr",{}),e("div",{class:"checkbox-fieldset",children:[e(h,{id:"cc0NrU",values:{0:o.settings.contentTranslationHideLanguages.length}}),e("div",{class:"checkbox-fields",children:is.map(b=>{const g=Mt({code:b.code,fallback:b.name}),_=Mt({code:b.code,locale:b.code}),w=_&&g!==_;return e("label",{children:[e("input",{type:"checkbox",checked:o.settings.contentTranslationHideLanguages.includes(b.code),onChange:A=>{const{checked:C}=A.target;C?E.settings.contentTranslationHideLanguages.push(b.code):E.settings.contentTranslationHideLanguages=o.settings.contentTranslationHideLanguages.filter(T=>T!==b.code)}})," ",w?e("span",{children:[_," ",e("span",{class:"insignificant ib",children:["- ",g]})]}):g]})})})]}),e("p",{class:"insignificant",children:e("small",{children:e(h,{id:"7I3sDQ",values:{TRANSLATION_API_NAME:va},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:o.settings.contentTranslationAutoInline,disabled:!o.settings.contentTranslation,onChange:b=>{E.settings.contentTranslationAutoInline=b.target.checked}})," ",e(h,{id:"gURvmk"})]}),e("p",{class:"insignificant",children:e("small",{children:e(h,{id:"PbHARL",components:{0:e("b",{})}})})})]})]})]}),!!ga&&f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.composerGIFPicker,onChange:b=>{E.settings.composerGIFPicker=b.target.checked}})," ",e(h,{id:"D7/2jB"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(h,{id:"/CLBTL",components:{0:e("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener"})}})})})]}),!!ma&&f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.mediaAltGenerator,onChange:b=>{E.settings.mediaAltGenerator=b.target.checked}})," ",e(h,{id:"9q5uor"})," ",e(I,{icon:"sparkles2",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(h,{id:"faZ9RI"})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(h,{id:"fHZgvt",components:{0:e("a",{href:"https://github.com/cheeaun/img-alt-api",target:"_blank",rel:"noopener"})}})})})]}),f&&bi()?.mastodon>=2&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.groupedNotificationsAlpha,onChange:b=>{E.settings.groupedNotificationsAlpha=b.target.checked}})," ",e(h,{id:"aGziA/"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(h,{id:"X17jCM"})})})]}),f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.shortcutSettingsCloudImportExport,onChange:b=>{E.settings.shortcutSettingsCloudImportExport=b.target.checked}})," ",e(h,{id:"570qTm"})," ",e(I,{icon:"cloud",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(h,{id:"0tZAhT",components:{0:e("br",{})}})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(h,{id:"fHf1v/"})})})]}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:o.settings.cloakMode,onChange:b=>{E.settings.cloakMode=b.target.checked}})," ",e(h,{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(h,{id:"T/hglb"})})})]}),f&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{E.showDrafts=!0,E.showSettings=!1},children:e(h,{id:"krk5ws"})})})]})}),f&&e(ba,{onClose:n}),e("h3",{children:e(h,{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:Pi,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(),E.showAccount="phanpy@hachyderm.io"},children:"@phanpy"}),e("br",{}),e(h,{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(),E.showAccount="cheeaun@mastodon.social"}})}})]})]}),e("p",{children:[e("a",{href:"https://github.com/sponsors/cheeaun",target:"_blank",rel:"noopener",children:e(h,{id:"O4cLCR"})})," ","·"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener",children:e(h,{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(h,{id:"3ePd3I"})})," ","·"," ",e("a",{href:pa,target:"_blank",rel:"noopener",children:e(h,{id:"LcET2C"})})]}),e("p",{children:[ns&&e(D,{children:[e(h,{id:"pFnMHn",values:{0:ns.replace(/https?:\/\//g,"").replace(/\/$/,"")},components:{0:e("span",{class:"insignificant"})}}),e("br",{})]}),e(h,{id:"6KkH+2",values:{0:e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/1897f38",target:"_blank",rel:"noopener",children:e(Ct,{datetime:new Date("2025-10-09T13:06:44.899Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2025-10-09T13:06:44.899Z".slice(0,10).replace(/-/g,".")}.1897f38`,onClick:b=>{b.target.select();try{navigator.clipboard.writeText(b.target.value),le(i({id:"PiPfua"}))}catch{le(i({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function ba({onClose:n}){const{_:i}=ae();if(!Gn())return null;const{instance:o}=se(),[s,c]=R("default"),a=q(),[p,d]=R(!1),[l,r]=R(!1),u=q();G(()=>{(async()=>{c("loading");try{const{subscription:f,backendSubscription:v}=await ua();if(v?.policy&&v.policy!=="none"){d(!0);const{alerts:y,policy:S}=v;u.current=S;const{elements:k}=a.current,b=k.namedItem("policy");b&&(b.value=S),Object.entries(y).forEach(([g,_])=>{const w=k.namedItem(g);w?.type==="checkbox"&&(w.checked=!!_)})}c("default")}catch(f){/outside.*authorized/i.test(f.message)?r(!0):alert(f?.message||f),c("error")}})()},[]);const m=s==="loading";return e("form",{ref:a,onChange:()=>{setTimeout(()=>{const f=Object.fromEntries(new FormData(a.current)),v=!!f["policy-allow"],y={data:{policy:f.policy,alerts:{mention:!!f.mention,favourite:!!f.favourite,reblog:!!f.reblog,follow:!!f.follow,follow_request:!!f.followRequest,poll:!!f.poll,update:!!f.update,status:!!f.status}}};let S=0;Object.keys(y.data.alerts).forEach(b=>{y.data.alerts[b]?S++:delete y.data.alerts[b]});const k=u.current!==y.data.policy;v&&S>0?k?es().then(()=>{Qi(y)}).catch(b=>{alert(i({id:"I6pdY3"}))}):Qi(y).catch(b=>{alert(i({id:"I6pdY3"}))}):es().catch(b=>{alert(i({id:"q1zFd+"}))})},100)},children:[e("h3",{children:e(h,{id:"WUHLnz"})}),e("section",{children:e("ul",{children:e("li",{children:[e("label",{children:[e("input",{type:"checkbox",disabled:m||l,name:"policy-allow",checked:p,onChange:async f=>{const{checked:v}=f.target;if(v){const y=await Notification.requestPermission();y==="granted"?d(!0):(d(!1),y==="denied"&&alert(i({id:"6LUsk7"})))}else d(!1)}})," ",e(h,{id:"qYNCa1",values:{0:[{value:"all",label:i({id:"+niKJH"})},{value:"followed",label:i({id:"x2NYtp"})},{value:"follower",label:i({id:"PBFNgg"})}].map(f=>e("option",{value:f.value,children:f.label}))},components:{0:e("select",{name:"policy",disabled:m||l||!p})}})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!p,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(f=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:f.value})," ",f.label]})}))})})})}),l&&e("div",{class:"sub-section",children:e("p",{children:e(h,{id:"8d0b8B",components:{0:e(fe,{to:`/login?instance=${o}`,onClick:n}),1:e("b",{})}})})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:e(h,{id:"z96cOX",components:{0:e("b",{})}})})})]})}const ui=()=>{let n=setTimeout(()=>{const i=document.getElementById("columns");if(i){const o=i.querySelector(".deck-container.focus");if(o)o.focus();else{const s=Array.from(i.querySelectorAll(".deck-container")).find(c=>c.getBoundingClientRect().left>=0);s?s.focus():i.querySelector(".deck-container")?.focus?.()}}else{const o=document.querySelectorAll("#modal-container > *");if(o?.length){const p=o[o.length-1],d=p.querySelector('[tabindex="-1"]')||p;if(d){d.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 no(n){if(!n)return;const i=Qt(),o=q(i.pathname);G(()=>{o.current&&i.pathname!==o.current&&n?.()},[i.pathname,n])}function wa({acct:n,instance:i}){let[o,s]=n.split("@");s||(s=i);const c=qn.toASCII(n);return e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",title:c,children:[e("b",{class:"handle-username",children:o}),e("span",{class:"handle-at",children:"@"}),e("b",{class:"handle-server",children:s})]}),e("div",{class:"handle-legend",children:[e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon username"})," ",e(h,{id:"silO9A"})]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," ",e(h,{id:"rZgCpJ"})]})]})]})}const ka=["image/jpeg","image/png","image/gif","image/webp"],ss=ka.join(",");function Sa({name:n,value:i,disabled:o,index:s}){const[c,a]=R(!!i);return e("tr",{children:[e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][name]`,defaultValue:n,disabled:o,maxLength:255,required:c,dir:"auto"})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][value]`,defaultValue:i,disabled:o,maxLength:255,onChange:p=>a(!!p.currentTarget.value),dir:"auto"})})]})}function Ca({onClose:n=()=>{}}){const{_:i}=ae(),{masto:o}=se(),[s,c]=R("loading"),[a,p]=R(null),[d,l]=R(null),[r,u]=R(null);G(()=>{(async()=>{try{const w=await o.v1.accounts.verifyCredentials();p(w),c("default")}catch{c("error")}})()},[]);const{displayName:m,source:f,avatar:v,header:y}=a||{},{note:S,fields:k}=f||{},b=q(null),g=[...v?[{type:"image",url:v}]:[],...r?[{type:"image",url:r}]:[]],_=[...y?[{type:"image",url:y}]:[],...d?[{type:"image",url:d}]:[]];return e("div",{class:"sheet",id:"edit-profile-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(h,{id:"9OpVZg"})})}),e("main",{children:s==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("form",{onSubmit:w=>{w.preventDefault();const A=new FormData(w.target),C=A.get("header"),T=A.get("avatar"),L=A.get("display_name"),M=A.get("note"),H=b.current.querySelectorAll('input[name^="fields_attributes"]'),F=[];H.forEach(U=>{const W=U.name,[Q,V,j]=W.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],K=U.value?U.value.trim():"";V&&j&&K&&(F[V]||(F[V]={}),F[V][j]=K)}),F.forEach(U=>{U.name&&!U.value&&(U.value="")}),(async()=>{try{const U=await o.v1.accounts.updateCredentials({header:C,avatar:T,displayName:L,note:M,fieldsAttributes:F});n?.({state:"success",account:U})}catch(U){alert(U?.message||i({id:"FwMMx0"}))}})()},children:[e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(h,{id:"C5zXYJ"})," ",e("input",{type:"file",name:"header",accept:ss,onChange:w=>{const A=w.target.files[0];if(A){const C=URL.createObjectURL(A);l(C)}}})]}),e("div",{class:"edit-profile-media-field",children:[y?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:_,mediaIndex:0}},children:e("img",{src:y,alt:""})}):e("div",{class:"edit-media"}),d&&e(D,{children:[e(I,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:_,mediaIndex:1}},children:e("img",{src:d,alt:""})})]})]})]}),e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(h,{id:"4XF0BB"})," ",e("input",{type:"file",name:"avatar",accept:ss,onChange:w=>{const A=w.target.files[0];if(A){const C=URL.createObjectURL(A);u(C)}}})]}),e("div",{class:"edit-profile-media-field",children:[v?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:g,mediaIndex:0}},children:e("img",{src:v,alt:""})}):e("div",{class:"edit-media"}),r&&e(D,{children:[e(I,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:g,mediaIndex:1}},children:e("img",{src:r,alt:""})})]})]})]}),e("p",{children:e("label",{children:[e(h,{id:"6YtxFj"})," ",e("input",{type:"text",name:"display_name",defaultValue:m,maxLength:30,disabled:s==="loading",dir:"auto"})]})}),e("p",{children:e("label",{children:[e(h,{id:"E+oKCO"}),e("textarea",{defaultValue:S,name:"note",maxLength:500,rows:"5",disabled:s==="loading",dir:"auto"})]})}),e("p",{children:e(h,{id:"T4I119"})}),e("table",{ref:b,children:[e("thead",{children:e("tr",{children:[e("th",{children:e(h,{id:"87a/t/"})}),e("th",{children:e(h,{id:"4b3oEV"})})]})}),e("tbody",{children:Array.from({length:Math.max(4,k.length)}).map((w,A)=>{const{name:C="",value:T=""}=k[A]||{};return e(Sa,{name:C,value:T,index:A,disabled:s==="loading"},A)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:s==="loading",onClick:()=>{n?.()},children:e(h,{id:"dEgA5A"})}),e("button",{type:"submit",disabled:s==="loading",children:e(h,{id:"tfDRzk"})})]})]})})]})}const _a=80;function Ia({accountID:n,info:i,open:o=!1,onlyOpenIfHasEndorsements:s=!1}){const{masto:c}=se(),a=q(),[p,d]=R("default"),[l,r]=R([]),[u,m]=R({});return G(()=>{Xe("@mastodon/endorsements")&&o&&(async()=>{d("loading");try{const v=await c.v1.accounts.$select(n).endorsements.list({limit:_a});if(!v.length){d("default");return}r(v),d("default"),setTimeout(()=>{a.current.scrollIntoView({behavior:"smooth",block:"nearest"})},300);const y=await Kn(v,u);y&&m(y)}catch{d("error")}})()},[o,n]),(s?o&&l.length>0:o)?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(h,{id:"UIfdY1",values:{0:i.username}})}),p==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):l.length>0?e("ul",{class:`endorsements ${l.length>10?"expanded":""}`,children:l.map(v=>e("li",{children:e(ut,{account:v,showStats:!0,avatarSize:"xxl",relationship:u[v.id]},v.id)}))}):e("p",{class:"ui-state insignificant",children:e(h,{id:"AgkUZa"})})]})})}):null}const io=1e3*60,Aa=24*60*60*1e3,hi=yt(async()=>{const{masto:n}=se(),i=await n.v1.lists.list();return i.sort((o,s)=>o.title.localeCompare(s.title)),i.length&&setTimeout(()=>{Te.account.set("lists",{lists:i,updatedAt:Date.now()})},1),i},{maxAge:io});async function pn(){try{const{lists:n,updatedAt:i}=Te.account.get("lists")||{};return n?.length?(Date.now()-i>Aa&&hi(),n):await hi()}catch{return[]}}const Ta=yt(n=>{const{masto:i}=se();return i.v1.lists.$select(n).fetch()},{maxAge:io});async function so(n){const{lists:i}=Te.account.get("lists")||{};if(i?.length){const o=i.find(s=>s.id===n);if(o)return o}try{return Ta(n)}catch{return null}}async function xa(n){return(await so(n))?.title||""}function Ea(n){const{lists:i}=Te.account.get("lists")||{};i?.length&&(i.push(n),i.sort((o,s)=>o.title.localeCompare(s.title)),Te.account.set("lists",{lists:i,updatedAt:Date.now()}))}function Ra(n){const{lists:i}=Te.account.get("lists")||{};if(i?.length){const o=i.findIndex(s=>s.id===n.id);o!==-1&&(i[o]=n,i.sort((s,c)=>s.title.localeCompare(c.title)),Te.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function La(n){const{lists:i}=Te.account.get("lists")||{};if(i?.length){const o=i.findIndex(s=>s.id===n);o!==-1&&(i.splice(o,1),Te.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function Kt({insignificant:n}){const{_:i}=ae();return e(I,{icon:"filter",size:"xs",class:`list-exclusive-badge ${n?"insignificant":""}`,title:i({id:"FNptcJ"})})}function zi({list:n,onClose:i}){const{_:o}=ae(),{masto:s}=se(),[c,a]=R("default"),p=!!n,d=q(),l=q(),r=q();G(()=>{p&&(d.current.value=n.title,l.current.value=n.repliesPolicy,r.current&&(r.current.checked=n.exclusive))},[p]);const u=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(I,{icon:"x",alt:o({id:"yz7wBu"})})})," ",e("header",{children:e("h2",{children:o(p?{id:"tuhghE"}:{id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:m=>{m.preventDefault();const f=new FormData(m.target),v=f.get("title"),y=f.get("replies_policy"),S=f.get("exclusive")==="on";a("loading"),(async()=>{try{let k;p?k=await s.v1.lists.$select(n.id).update({title:v,replies_policy:y,exclusive:S}):k=await s.v1.lists.create({title:v,replies_policy:y,exclusive:S}),a("default"),i?.({state:"success",list:k}),setTimeout(()=>{p?Ra(k):Ea(k)},1)}catch{a("error"),alert(o(p?{id:"R7ep1i"}:{id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(h,{id:"6YtxFj"})," ",e("input",{ref:d,type:"text",id:"list-title",name:"title",required:!0,disabled:c==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:l,name:"replies_policy",required:!0,disabled:c==="loading",children:[e("option",{value:"list",children:e(h,{id:"ei6pnR"})}),e("option",{value:"followed",children:e(h,{id:"Mr53YX"})}),e("option",{value:"none",children:e(h,{id:"PM7llw"})})]})}),u&&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(Kt,{insignificant:!0})," ",e(h,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:c==="loading",children:o(p?{id:"tfDRzk"}:{id:"hYgDIe"})}),p&&e(ft,{disabled:c==="loading",align:"end",menuItemClassName:"danger",confirmLabel:o({id:"+kQ/cY"}),onClick:()=>{a("loading"),(async()=>{try{await s.v1.lists.$select(n.id).remove(),a("default"),i?.({state:"deleted"}),setTimeout(()=>{La(n.id)},1)}catch{a("error"),alert(o({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:c==="loading",children:e(h,{id:"Jb6/SB"})})})]})]})})]})}function Ma({accountID:n,onClose:i}){const{_:o}=ae(),{masto:s}=se(),[c,a]=R("default"),[p,d]=R([]),[l,r]=R([]),[u,m]=xt(y=>y+1,0);G(()=>{a("loading"),(async()=>{try{const y=await pn();d(y);const S=await s.v1.accounts.$select(n).lists.list();r(S),a("default")}catch{a("error")}})()},[u]);const[f,v]=R(!1);return e("div",{class:"sheet",id:"list-add-remove-container",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(h,{id:"sJ2yQc"})})}),e("main",{children:[p.length>0?e("ul",{class:"list-add-remove",children:p.map(y=>{const S=l.some(k=>k.id===y.id);return e("li",{children:e("button",{type:"button",class:`light ${S?"checked":""}`,disabled:c==="loading",onClick:()=>{a("loading"),(async()=>{try{S?await s.v1.lists.$select(y.id).accounts.remove({accountIds:[n]}):await s.v1.lists.$select(y.id).accounts.create({accountIds:[n]}),m()}catch{a("error"),alert(o(S?{id:"7KnEYa"}:{id:"Tba8uO"}))}})()},children:[e(I,{icon:"check-circle",alt:"☑️"}),e("span",{children:y.title})]})})})}):c==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):c==="error"?e("p",{class:"ui-state",children:e(h,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(h,{id:"/MJ7gZ"})}),e("button",{type:"button",class:"plain2",onClick:()=>v(!0),disabled:c!=="default",children:[e(I,{icon:"plus",size:"l"})," ",e("span",{children:e(h,{id:"Sb2gYF"})})]})]}),f&&e(qe,{onClick:y=>{y.target===y.currentTarget&&v(!1)},children:e(zi,{list:f?.list,onClose:y=>{y.state==="success"&&m(),v(!1)}})})]})}function $a({account:n,note:i,onRelationshipChange:o=()=>{},onClose:s=()=>{}}){const{_:c}=ae(),{masto:a}=se(),[p,d]=R("default"),l=q(null);return G(()=>{let r;return l.current&&!i&&(r=setTimeout(()=>{l.current.focus?.()},100)),()=>{clearTimeout(r)}},[]),e("div",{class:"sheet",id:"private-note-container",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",alt:c({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(h,{id:"DYqYm5",values:{0:n?.username||n?.acct},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:e("form",{onSubmit:r=>{r.preventDefault();const m=new FormData(r.target).get("note");m?.trim()!==i?.trim()&&(d("loading"),(async()=>{try{const f=await a.v1.accounts.$select(n?.id).note.create({comment:m});d("default"),o(f),s()}catch(f){d("error"),alert(f?.message||c({id:"ot8LpF"}))}})())},children:[e("textarea",{ref:l,name:"note",disabled:p==="loading",dir:"auto",children:i}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:p==="loading",onClick:()=>{s?.()},children:e(h,{id:"dEgA5A"})}),e("span",{children:[e(Oe,{abrupt:!0,hidden:p!=="loading"}),e("button",{disabled:p==="loading",type:"submit",children:e(h,{id:"SrwrEj"})})]})]})]})})]})}function Na({note:n,fields:i,onClose:o}){const{_:s}=ae(),c=i?.map(({name:p,value:d})=>`${p}
${Vi(d)}`).join(`
`)||"",a=Vi(n)+(c?`
${c}`:"");return e("div",{class:"sheet",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(h,{id:"9groMz"})})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:a}),e(Bs,{forceTranslate:!0,text:a})]})]})}const Pa=[60*5,60*30,60*60,60*60*6,60*60*24,60*60*24*3,60*60*24*7,60*60*24*30,0],Yt={0:{id:"9ZP9cc"},300:it(5,"minute"),1800:it(30,"minute"),3600:it(1,"hour"),21600:it(6,"hour"),86400:it(1,"day"),259200:it(3,"day"),604800:it(1,"week"),2592e3:it(30,"day")};function Da({info:n,instance:i,standalone:o,authenticated:s,onRelationshipChange:c=()=>{},setShowEditProfile:a=()=>{},showEndorsements:p=!1,renderEndorsements:d=!1,setRenderEndorsements:l=()=>{}}){if(!n)return null;const{_:r,_:u}=ae(),{masto:m,instance:f,authenticated:v}=se(),y=i===f,[S,k]=R("default"),[b,g]=R(null),{id:_,acct:w,url:A,username:C,locked:T,lastStatusAt:L,note:M,fields:H,moved:F}=n,U=q(_),{following:W,showingReblogs:Q,notifying:V,followedBy:j,blocking:K,blockedBy:pe,muting:$,mutingNotifications:ie,requested:Y,domainBlocking:ee,endorsed:he,note:re}=b||{},[J,Ce]=R(null),[ve,ye]=R(!1),Ne=w.includes("@")?w:`${w}@${i}`,Se=Xe("@mastodon/endorsements");G(()=>{if(n){const z=vt();let Ie;(async()=>{if(y&&s)Ie=_;else if(!y&&v){const Ee=n.acct.includes("@");try{const P=await m.v2.search.list({q:Ee?n.acct:`${n.username}@${i}`,type:"accounts",limit:1,resolve:!0});P.accounts.length&&(Ie=P.accounts[0].id,Ce(P.accounts[0]))}catch{}}if(!Ie)return;if(z===Ie){ye(!0);return}U.current=Ie,k("loading");const Me=m.v1.accounts.relationships.fetch({id:[Ie]});try{const Ee=await Me;if(k("default"),Ee.length){const P=Ee[0];g(P),c({relationship:P,currentID:Ie})}}catch{k("error")}})()}},[n,s]),G(()=>{n&&ve&&Fo(n)},[n,ve]);const Ae=S==="loading",[xe,Pe]=R(!1),[ze,Fe]=R(!1),[Ye,oe]=R(!1),[Le,Re]=R([]);return e(D,{children:[e("div",{class:"actions",children:[e("span",{children:[j?e("span",{class:"tag",children:e(h,{id:"p3UO/y"})}):L?e("small",{class:"insignificant",children:e(h,{id:"F3cM1G",values:{0:st(L,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),$&&e("span",{class:"tag danger",children:e(h,{id:"+IJm1Z"})}),K&&e("span",{class:"tag danger",children:e(h,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!re&&e("button",{type:"button",class:"private-note-tag",title:u({id:"zxFxcH"}),onClick:()=>{oe(!0)},dir:"auto",children:e("span",{children:re})}),e(rt,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",disabled:Ae,children:e(I,{icon:"more",size:"l",alt:u({id:"2FYpfJ"})})}),onMenuChange:z=>{W&&z.open&&(async()=>{try{const Ie=await m.v1.accounts.$select(U.current).lists.list();Re(Ie)}catch{}})()},children:[v&&!ve?e(D,{children:[e(ge,{onClick:()=>{Os({draftStatus:{status:`@${J?.acct||w} `}})},children:[e(I,{icon:"at"}),e("span",{children:e(h,{id:"3LkfZu",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(ge,{onClick:()=>{Pe(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(h,{id:"R8mSiS"})})]}),Xe("@mastodon/profile-private-note")&&e(ge,{onClick:()=>{oe(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:u(re?{id:"U+Gokq"}:{id:"VcQzRi"})})]}),W&&!!b&&e(D,{children:[e(ge,{onClick:()=>{k("loading"),(async()=>{try{const z=await m.v1.accounts.$select(U.current).follow({notify:!V});z&&g(z),k("default"),le(z.notifying?u({id:"jL3N0G",values:{username:C}}):u({id:"0h4/9h",values:{username:C}}))}catch(z){alert(z),k("error")}})()},children:[e(I,{icon:"notification"}),e("span",{children:u(V?{id:"osJmEN"}:{id:"I92Z+b"})})]}),e(ge,{onClick:()=>{k("loading"),(async()=>{try{const z=await m.v1.accounts.$select(U.current).follow({reblogs:!Q});z&&g(z),k("default"),le(z.showingReblogs?u({id:"0X2KC8",values:{username:C}}):u({id:"cXWjH0",values:{username:C}}))}catch(z){alert(z),k("error")}})()},children:[e(I,{icon:"rocket"}),e("span",{children:u(Q?{id:"GRUr8d"}:{id:"uREpT3"})})]})]}),Se&&W&&e(ge,{onClick:()=>{k("loading"),(async()=>{try{if(he){const z=await m.v1.accounts.$select(J?.id||_).unpin();g(z),k("default"),le(u({id:"pWFLFk",values:{username:C}}))}else{const z=await m.v1.accounts.$select(J?.id||_).pin();g(z),k("default"),le(u({id:"xhiXaF",values:{username:C}}))}}catch{k("error"),he?le(u({id:"xHq5L2",values:{username:C}})):le(u({id:"Owr/5+",values:{username:C}}))}})()},children:[e(I,{icon:"endorsement"}),u(he?{id:"S9JvjK"}:{id:"UlJ3QN"})]}),p&&Se&&!d&&e(ge,{onClick:()=>l(!0),children:[e(I,{icon:"endorsement"}),e("span",{children:e(h,{id:"Qopbnd"})})]}),W&&e(ge,{onClick:()=>{Fe(!0)},children:[e(I,{icon:"list"}),Le.length?e(D,{children:[e("small",{class:"menu-grow",children:[e(h,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:Le.map(z=>z.title).join(", ")})]}),e("small",{class:"more-insignificant",children:Le.length})]}):e("span",{children:e(h,{id:"sJ2yQc"})})]}),e(He,{})]}):Se&&!d&&e(D,{children:[e(ge,{onClick:()=>l(!0),children:[e(I,{icon:"endorsement"}),"Show featured profiles"]}),e(He,{})]}),e(ge,{onClick:()=>{const z=`@${J?.acct||Ne}`;try{navigator.clipboard.writeText(z),le(u({id:"zJoEwS"}))}catch{le(u({id:"BC0lSD"}))}},children:[e(I,{icon:"copy"}),e("small",{children:[e(h,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",J?.acct||Ne]})]})]}),e(ge,{href:A,target:"_blank",children:[e(I,{icon:"external"}),e("small",{class:"menu-double-lines",children:Oa(A)})]}),e("div",{class:"menu-horizontal",children:[e(ge,{onClick:()=>{try{navigator.clipboard.writeText(A),le(u({id:"edWbV6"}))}catch{le(u({id:"W1ewR0"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(h,{id:"he3ygx"})})]}),navigator?.share&&navigator?.canShare?.({url:A})&&e(ge,{onClick:()=>{try{navigator.share({url:A})}catch{alert(u({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"}),e("span",{children:e(h,{id:"LFKLqp"})})]})]}),!!b&&e(D,{children:[e(He,{}),$?e(ge,{onClick:()=>{k("loading"),(async()=>{try{const z=await m.v1.accounts.$select(J?.id||_).unmute();g(z),k("default"),le(u({id:"B4Xkly",values:{username:C}})),E.reloadGenericAccounts.id="mute",E.reloadGenericAccounts.counter++}catch{k("error")}})()},children:[e(I,{icon:"unmute"}),e("span",{children:e(h,{id:"Q/HUhC",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(hn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(D,{children:[e(I,{icon:"mute"}),e("span",{class:"menu-grow",children:e(h,{id:"xhPEH3",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})}),e("span",{style:{textOverflow:"clip"},children:[e(I,{icon:"time"}),e(I,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:Pa.map(z=>e(ge,{onClick:()=>{k("loading"),(async()=>{try{const Ie=await m.v1.accounts.$select(J?.id||_).mute({duration:z});g(Ie),k("default"),le(u({id:"/plB9m",values:{0:typeof Yt[z]=="function"?Yt[z]():r(Yt[z]),username:C}})),E.reloadGenericAccounts.id="mute",E.reloadGenericAccounts.counter++}catch{k("error"),le(u({id:"vWGBjT",values:{username:C}}))}})()},children:typeof Yt[z]=="function"?Yt[z]():r(Yt[z])}))})}),j&&e(ft,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(D,{children:[e(I,{icon:"user-x"}),e("span",{children:e(h,{id:"unyq2W",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{k("loading"),(async()=>{try{const z=await m.v1.accounts.$select(J?.id||_).removeFromFollowers();g(z),k("default"),le(u({id:"AgkcM/",values:{username:C}})),E.reloadGenericAccounts.id="followers",E.reloadGenericAccounts.counter++}catch{k("error")}})()},children:[e(I,{icon:"user-x"}),e("span",{children:e(h,{id:"VCZ0OT"})})]}),e(ft,{subMenu:!0,confirm:!K,confirmLabel:e(D,{children:[e(I,{icon:"block"}),e("span",{children:e(h,{id:"aforS9",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{k("loading"),(async()=>{try{if(K){const z=await m.v1.accounts.$select(J?.id||_).unblock();g(z),k("default"),le(u({id:"sI9N29",values:{username:C}}))}else{const z=await m.v1.accounts.$select(J?.id||_).block();g(z),k("default"),le(u({id:"uYcYzu",values:{username:C}}))}E.reloadGenericAccounts.id="block",E.reloadGenericAccounts.counter++}catch{k("error"),K?le(u({id:"0tG4wG",values:{username:C}})):le(u({id:"pA+qEx",values:{username:C}}))}})()},children:K?e(D,{children:[e(I,{icon:"unblock"}),e("span",{children:e(h,{id:"/3LJfX",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(D,{children:[e(I,{icon:"block"}),e("span",{children:e(h,{id:"JRswkR",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(ge,{className:"danger",onClick:()=>{E.showReportModal={account:J||n}},children:[e(I,{icon:"flag"}),e("span",{children:e(h,{id:"qTJgpR",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),v&&ve&&o&&Xe("@mastodon/profile-edit")&&e(D,{children:[e(He,{}),e(ge,{onClick:()=>{a(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(h,{id:"9OpVZg"})})]})]}),!1]}),!b&&S==="loading"&&e(Oe,{abrupt:!0}),!!b&&!F&&e(ft,{confirm:W||Y,confirmLabel:e("span",{children:u(Y?{id:"e7qQIH"}:{id:"eYsAQr",values:{0:n.acct||n.username}})}),menuItemClassName:"danger",align:"end",disabled:Ae,onClick:()=>{k("loading"),(async()=>{try{let z;W||Y?z=await m.v1.accounts.$select(U.current).unfollow():z=await m.v1.accounts.$select(U.current).follow(),z&&(g(z),p&&Se&&!d&&z.following&&l("onlyOpenIfHasEndorsements")),k("default")}catch(z){alert(z),k("error")}})()},children:e("button",{type:"button",class:`${W||Y?"light swap":""}`,"data-swap-state":W||Y?"danger":"",disabled:Ae,children:W?e(D,{children:[e("span",{children:e(h,{id:"y6sq5j"})}),e("span",{children:e(h,{id:"HKrBPX"})})]}):Y?e(D,{children:[e("span",{children:e(h,{id:"Yx0Ud8"})}),e("span",{children:e(h,{id:"yTVtKs"})})]}):T?e(D,{children:[e(I,{icon:"lock"})," ",e("span",{children:e(h,{id:"MKEPCY"})})]}):u({id:"MKEPCY"})})})]})]}),!!xe&&e(qe,{onClose:()=>{Pe(!1)},children:e(Na,{note:M,fields:H,onClose:()=>Pe(!1)})}),!!ze&&e(qe,{onClose:()=>{Fe(!1)},children:e(Ma,{accountID:U.current,onClose:()=>Fe(!1)})}),!!Ye&&e(qe,{onClose:()=>{oe(!1)},children:e($a,{account:n,note:re,onRelationshipChange:z=>{g(z)},onClose:()=>oe(!1)})})]})}function Oa(n){if(!n)return;const i=URL.parse(n);if(!i)return;const{host:o,pathname:s}=i,c=s.replace(/\/$/,"").replace(/^\//,"");return e(D,{children:[e("span",{class:"more-insignificant",children:[qn.toUnicode(o),"/"]}),e("wbr",{}),e("span",{children:c})]})}const os=80,oo=1e3*60*10;function za(n,i){return i.v1.accounts.familiarFollowers.fetch({id:[n]})}const Fa=yt(za,{maxAge:oo});async function Ba(n,i){const o=i.v1.accounts.$select(n).statuses.list({limit:20}).values().next(),{value:s}=await o,c={total:s.length,originals:0,replies:0,boosts:0,quotes:0};return s.forEach(a=>{a.reblog?c.boosts++:a.inReplyToId&&a.inReplyToAccountId!==a.account.id?c.replies++:Nt()&&(a.quote?.id||a.quote?.quotedStatus?.id)?c.quotes++:c.originals++}),s.length&&(c.daysSinceLastPost=Math.ceil((Date.now()-Date.parse(s[s.length-1].createdAt))/864e5)),c}const qa=yt(Ba,{maxAge:oo});function co({account:n,fetchAccount:i=()=>{},standalone:o,instance:s,authenticated:c,showEndorsements:a=!1}){const{i18n:p,_:d}=ae(),{masto:l,authenticated:r}=se({instance:s}),{masto:u,instance:m}=se(),[f,v]=R("default"),y=typeof n=="string",[S,k]=R(y?null:n),b=ke(()=>s===m,[s,m]);G(()=>{if(!y){k(n);return}v("loading"),(async()=>{try{const O=await i();E.accounts[`${O.id}@${s}`]=O,k(O),v("default")}catch{k(null),v("error")}})()},[y,n,i]);const{acct:g,avatar:_,avatarStatic:w,bot:A,createdAt:C,displayName:T,emojis:L,fields:M,followersCount:H,followingCount:F,group:U,id:W,lastStatusAt:Q,locked:V,note:j,statusesCount:K,url:pe,username:$,memorial:ie,moved:Y,roles:ee,hideCollections:he}=S||{};let re=!1,{header:J,headerStatic:Ce}=S||{};(!J||/missing\.png$/.test(J))&&_&&!/missing\.png$/.test(_)&&(J=_,re=!0,w&&!/missing\.png$/.test(w)&&(Ce=w));const ve=ke(()=>W===vt(),[W]);G(()=>{const O=!!(S?.id&&S?.username&&S?.acct&&S?.avatar&&S?.avatarStatic&&S?.displayName&&S?.url);if(ve&&s&&O){const de=vi();let _e=!1;de.forEach(me=>{me.info.id===S.id&&me.instanceURL===s&&(me.info=S,_e=!0)}),_e&&Gt(de)}},[ve,S,s]);const ye=wi(pe),[Ne,Se]=R([]),Ae=q(),xe=q([]);async function Pe(O){(O||!Ae.current)&&(Ae.current=l.v1.accounts.$select(W).followers.list({limit:os}).values());const de=await Ae.current.next();if(ve||!b)return de;const{value:_e}=de;let me=[];if(O){let X=[];try{X=await l.v1.accounts.familiarFollowers.fetch({id:[W]})}catch{}xe.current=X?.[0]?.accounts||[],me=[...xe.current,..._e.filter(te=>!xe.current.some(we=>we.id===te.id))]}else _e?.length&&(me=_e.filter(X=>!xe.current.some(te=>te.id===X.id)));return{...de,value:me}}const ze=q();async function Fe(O){return(O||!ze.current)&&(ze.current=l.v1.accounts.$select(W).following.list({limit:os}).values()),await ze.current.next()}const Ye=o?"div":fe,oe=s?`/${s}/a/${W}`:`/a/${W}`,[Le,Re]=R([]),[z,Ie]=R(),[Me,Ee]=R("default"),P=!!z?.total,be=async O=>{try{const de=await Fa(O,u);Re(de[0].accounts.slice(0,Ua))}catch{}},Be=async()=>{if(W){Ee("loading");try{const O=await qa(W,l);Ie(O),Ee("default")}catch{Ee("error")}}},De=tt(({relationship:O,currentID:de})=>{O.following||(be(de),!o&&K>0&&Be())},[o,W,K]),N=tt(O=>{O.id===W&&(k(O),E.accounts[`${O.id}@${s}`]=O)},[W,s]),ce=y&&n&&/^https?:\/\//.test(n),[x,B]=R(!1),[Z,ne]=R(!1);return e(D,{children:[e("div",{tabIndex:"-1",class:`account-container ${f==="loading"?"skeleton":""}`,style:{"--header-color-1":Ne[0],"--header-color-2":Ne[1],"--header-color-3":Ne[2],"--header-color-4":Ne[3]},children:[f==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(h,{id:"44hICK"})}),y?e("p",{children:ce?e("a",{href:n,target:"_blank",rel:"noopener",children:n}):e("code",{class:"insignificant",children:n})}):e("p",{children:e("a",{href:pe,target:"_blank",rel:"noopener",children:[e(h,{id:"Aadw0+"})," ",e(I,{icon:"external"})]})})]}),f==="loading"?e(D,{children:[e("header",{children:e(ut,{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(h,{id:"x5LEuB"})]}),e("div",{children:[e("span",{children:"██"})," ",e(h,{id:"following.stats"})]}),e("div",{children:[e("span",{children:"██"})," ",e(h,{id:"+owNNn"})]})]})]}),e("div",{class:"actions",children:[e("span",{}),e("span",{class:"buttons",children:e("button",{type:"button",class:"plain",disabled:!0,children:e(I,{icon:"more",size:"l",alt:d({id:"2FYpfJ"})})})})]})]})]}):S&&e(D,{children:[!!Y&&e("div",{class:"account-moved",children:[e("p",{children:e(h,{id:"C6cVP/",values:{displayName:T},components:{0:e("b",{})}})}),e(ut,{account:Y,instance:s,onClick:O=>{O.stopPropagation(),E.showAccount=Y}})]}),!!J&&!/missing\.png$/.test(J)&&e("img",{src:J,alt:"",class:`header-banner ${re?"header-is-avatar":""}`,onError:O=>{O.target.crossOrigin?O.target.src!==Ce?O.target.src=Ce:(O.target.removeAttribute("crossorigin"),O.target.src=J):O.target.src!==Ce?O.target.src=Ce:O.target.remove()},crossOrigin:"anonymous",onLoad:O=>{O.target.classList.add("loaded");try{const de=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),_e=de.getContext("2d",{willReadFrequently:!0});de.width=O.target.width,de.height=O.target.height,_e.imageSmoothingEnabled=!1,_e.drawImage(O.target,0,0);const me=10,te=[_e.getImageData(0,0,me,me).data,_e.getImageData(O.target.width-me,0,me,me).data,_e.getImageData(0,O.target.height-me,me,me).data,_e.getImageData(O.target.width-me,O.target.height-me,me,me).data].map(we=>{let $e=0,Ve=0,ot=0,et=0;for(let Rt=0;Rt<we.length;Rt+=4)$e+=we[Rt],Ve+=we[Rt+1],ot+=we[Rt+2],et+=we[Rt+3];const wt=we.length/4;return[$e/wt,Ve/wt,ot/wt,et/wt]}).map(we=>{const[$e,Ve,ot,et]=Ka(we);return`rgba(${$e}, ${Ve}, ${ot}, ${et})`});Se(te)}catch{}}}),e("header",{children:o?e(rt,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(ut,{account:S,instance:s,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(wa,{acct:g,instance:s})}),e(ge,{onClick:()=>{const O=g.includes("@")?`@${g}`:`@${g}@${s}`;try{navigator.clipboard.writeText(O),le(d({id:"zJoEwS"}))}catch{le(d({id:"BC0lSD"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(h,{id:"27x6gl"})})]}),e(ge,{href:pe,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(h,{id:"Bz5hLl"})})]}),e(He,{}),e(ge,{onClick:()=>{E.showMediaModal={mediaAttachments:[{type:"image",url:w}]}},children:[e(I,{icon:"user"}),e("span",{children:e(h,{id:"7WYl2I"})})]}),!!Ce&&!re&&e(ge,{onClick:()=>{E.showMediaModal={mediaAttachments:[{type:"image",url:Ce}]}},children:[e(I,{icon:"media"}),e("span",{children:e(h,{id:"ZNme5R"})})]}),r&&ve&&Xe("@mastodon/profile-edit")&&e(D,{children:[e(He,{}),e(ge,{onClick:()=>{B(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(h,{id:"9OpVZg"})})]})]})]}):e(ut,{account:S,instance:s,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!ie&&e("span",{class:"tag",children:e(h,{id:"prdIOK"})}),!!A&&e("span",{class:"tag",children:[e(I,{icon:"bot"})," ",e(h,{id:"9Vdq+j"})]}),!!U&&e("span",{class:"tag",children:[e(I,{icon:"group"})," ",e(h,{id:"L8fEEm"})]}),e("div",{class:"note",dir:"auto",onClick:qs({instance:m}),dangerouslySetInnerHTML:{__html:li(j,{emojis:L})}}),e("div",{class:"account-metadata-box",children:[M?.length>0&&e("div",{class:"profile-metadata",children:M.map(({name:O,value:de,verifiedAt:_e},me)=>e("div",{class:`profile-field ${_e?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(Us,{text:O,emojis:L})," ",!!_e&&e(I,{icon:"check-circle",size:"s",alt:d({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:li(de,{emojis:L})}})]},O+me))}),e("div",{class:"stats",children:[e(Ye,{tabIndex:0,to:oe,onClick:()=>{setTimeout(()=>{E.showGenericAccounts={id:"followers",heading:d({id:"x5LEuB"}),fetchAccounts:Pe,instance:s,excludeRelationshipAttrs:ve?["followedBy"]:[],blankCopy:he?d({id:"BRV/wh"}):void 0}},0)},children:[!!Le.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:Le.map(O=>e(pt,{url:O.avatarStatic,size:"s",alt:`${O.displayName} @${O.acct}`,squircle:O?.bot}))})}),e(h,{id:"TbttfX",values:{0:We(H),1:We(H),followersCount:H},components:{0:e("span",{title:H}),1:e("span",{title:H})}})]}),e(Ye,{class:"insignificant",tabIndex:0,to:oe,onClick:()=>{setTimeout(()=>{E.showGenericAccounts={heading:d({id:"following.stats"}),fetchAccounts:Fe,instance:s,excludeRelationshipAttrs:ve?["following"]:[],blankCopy:he?d({id:"BRV/wh"}):void 0}},0)},children:[e(h,{id:"SGcIK+",values:{0:We(F),followingCount:F},components:{0:e("span",{title:F})}}),e("br",{})]}),e(Ye,{class:"insignificant",to:oe,children:e(h,{id:"C4x3+X",values:{0:We(K),1:We(K),statusesCount:K},components:{0:e("span",{title:K}),1:e("span",{title:K})}})}),!!C&&e("div",{class:"insignificant",children:e(h,{id:"PCcEFZ",values:{0:st(C,{hideTime:!0})},components:{0:e("time",{datetime:C})}})})]})]}),!!z&&e(Ye,{to:oe,class:"account-metadata-box",children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:P?e("div",{class:"posting-stats",title:Nt()?d({id:"CKHUZ2",values:{0:(z.originals/z.total).toLocaleString(p.locale||void 0,{style:"percent"}),1:(z.replies/z.total).toLocaleString(p.locale||void 0,{style:"percent"}),2:(z.quotes/z.total).toLocaleString(p.locale||void 0,{style:"percent"}),3:(z.boosts/z.total).toLocaleString(p.locale||void 0,{style:"percent"})}}):d({id:"wiuWLe",values:{0:(z.originals/z.total).toLocaleString(p.locale||void 0,{style:"percent"}),1:(z.replies/z.total).toLocaleString(p.locale||void 0,{style:"percent"}),2:(z.boosts/z.total).toLocaleString(p.locale||void 0,{style:"percent"})}}),children:[e("div",{children:z.daysSinceLastPost<365?ue._({id:"oZUtTk",values:{0:z.total,1:z.daysSinceLastPost,2:z.daysSinceLastPost,3:z.daysSinceLastPost,4:z.total,5:z.total,6:z.daysSinceLastPost}}):ue._({id:"JvA7Mo",values:{0:z.total,1:z.total}})}),e("div",{class:"posting-stats-bar",style:{"--originals-percentage":`${z.originals/z.total*100}%`,"--replies-percentage":`${(z.originals+z.replies)/z.total*100}%`,"--quotes-percentage":`${(z.originals+z.replies+z.quotes)/z.total*100}%`}}),e("div",{class:"posting-stats-legends",children:[e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-originals"})," ",e(h,{id:"HxF6Fk"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-replies"})," ",e(h,{id:"N8UzTV"})]})," ",Nt()&&e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-quotes"})," ",e(h,{id:"eWLklq"})]}),e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-boosts"})," ",e(h,{id:"puY2t0"})]})]})]}):e("div",{class:"posting-stats",children:e(h,{id:"vl3XTJ"})})})})}),!Y&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!z,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:Me==="loading",onClick:()=>{Be()},children:[e("div",{class:`posting-stats-bar posting-stats-icon ${Me==="loading"?"loading":""}`,style:Nt()?{"--originals-percentage":"25%","--replies-percentage":"50%","--quotes-percentage":"75%"}:{"--originals-percentage":"33%","--replies-percentage":"66%"}}),e(h,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(Da,{info:S,instance:s,standalone:o,authenticated:c,onRelationshipChange:De,onProfileUpdate:N,setShowEditProfile:B,showEndorsements:a,renderEndorsements:Z,setRenderEndorsements:ne})}),e(Ia,{accountID:W,info:S,open:Z,onlyOpenIfHasEndorsements:Z==="onlyOpenIfHasEndorsements"})]})]}),!!x&&e(qe,{onClose:()=>{B(!1)},children:e(Ca,{onClose:({state:O,account:de}={})=>{B(!1),O==="success"&&de&&N(de)}})})]})}const Ua=3;function Ka([n,i,o]){const s=.2126*n+.7152*i+.0722*o;let c;return s>=220?c=1:s<=50?c=.1:c=s/255,c=Math.min(1,c),[n,i,o,c]}function Ha({account:n,instance:i,onClose:o}){const{_:s}=ae(),{masto:c,instance:a,authenticated:p}=se({instance:i}),d=typeof n=="string";return G(()=>{d||(E.accounts[`${n.id}@${a}`]=n)},[n]),no(o),e("div",{class:"sheet",children:[!!o&&e("button",{type:"button",class:"sheet-close outer",onClick:o,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e(co,{instance:a,authenticated:p,account:n,fetchAccount:async()=>{if(d)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:p?1:11,resolve:p});if(r.accounts.length){const u=r.accounts.find(m=>m.url===n||n.startsWith(m.url));if(u)return u}if(/^https?:\/\/[^/]+\/@[^/]+$/.test(n)){const u=URL.parse(n);if(u){const{hostname:m,pathname:f}=u,v=f.replace(/^\//,"").replace(/\/$/,"")+"@"+m,y=await c.v2.search.list({q:v,type:"accounts",limit:1,resolve:p});if(y.accounts.length)return y.accounts[0]}}}else return n}})]})}function ja({onClose:n}){const{_:i}=ae(),{masto:o}=se(),[s,c]=R("default"),[a,p]=R([]),[d,l]=xt(u=>u+1,0);G(()=>{c("loading"),(async()=>{try{const u=await gt.drafts.keys();if(u.length){const m=$n(),f=u.filter(v=>v.startsWith(m));if(f.length){const v=await gt.drafts.getMany(f);v.sort((y,S)=>Date.parse(S.updatedAt)-Date.parse(y.updatedAt)),p(v)}else p([])}else p([]);c("default")}catch{c("error")}})()},[d]);const r=a?.length>0;return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(h,{id:"krk5ws"})," ",e(Oe,{abrupt:!0,hidden:s!=="loading"})]}),r&&e("div",{class:"insignificant",children:e(h,{id:"Ap/10+"})})]}),e("main",{children:r?e(D,{children:[e("ul",{class:"drafts-list",children:a.map(u=>{const{updatedAt:m,key:f,draftStatus:v,replyTo:y,quote:S}=u,k=new Date(m);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(I,{icon:y?"reply":"quill",size:"s"})," ",e("time",{children:[!!y&&e(D,{children:[e("span",{class:"bidi-isolate",children:["@",y.account.acct]}),e("br",{})]}),st(k)]})]}),e(ft,{confirmLabel:e("span",{children:e(h,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:s==="loading",onClick:()=>{(async()=>{try{await gt.drafts.del(f),l()}catch{alert(i({id:"rEYoku"}))}})()},children:e("button",{type:"button",class:"small light",disabled:s==="loading",children:e(h,{id:"Jb6/SB"})})})]}),e("button",{type:"button",disabled:s==="loading",class:"draft-item",onClick:async()=>{let b,g;if(y?.id||S?.id){if(c("loading"),y)try{b=await o.v1.statuses.$select(y.id).fetch()}catch{alert(i({id:"tMwimH"})),c("default");return}if(S)try{g=await o.v1.statuses.$select(S.id).fetch()}catch{alert(i({id:"2oZ4Iw"})),c("default")}c("default")}window.__COMPOSE__={draftStatus:v,replyToStatus:b,quoteStatus:g},E.showCompose=!0,E.showDrafts=!1},children:e(Ya,{draft:u})})]},m)})}),a.length>1&&e("p",{children:e(ft,{confirmLabel:e("span",{children:e(h,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:s==="loading",onClick:()=>{(async()=>{c("loading");try{await gt.drafts.delMany(a.map(u=>u.key)),c("default"),l()}catch{alert(i({id:"0J4sZq"})),c("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:s==="loading",children:e(h,{id:"hOg+Mt"})})})})]}):e("p",{children:e(h,{id:"8iQ+jk"})})})]})}function Ya({draft:n}){const{_:i}=ae(),{draftStatus:o,replyTo:s,quote:c}=n,{status:a,spoilerText:p,poll:d,mediaAttachments:l}=o,r=d?.options?.length>0,u=l?.length>0,m=!!c?.id,f=r||u||m,v=ke(()=>{if(!u)return;const y=l.find(b=>/image/.test(b.type));if(!y)return;const{file:S}=y;return URL.createObjectURL(S)},[u,l]);return e(D,{children:e("div",{class:"mini-draft",children:[f&&e("div",{class:`mini-draft-aside ${v?"has-image":""}`,style:v?{"--bg-image":`url(${v})`}:{},children:[r&&e(I,{icon:"poll",alt:i({id:"4WUbF1"})}),u&&e("span",{children:[e(I,{icon:"attachment",alt:i({id:"xYilR2"})})," ",e("small",{children:l?.length})]}),m&&e(I,{icon:"quote",alt:i({id:"ZhhOwV"})})]}),e("div",{class:"mini-draft-main",children:[!!p&&e("div",{class:"mini-draft-spoiler",children:p}),!!a&&e("div",{class:"mini-draft-status",children:a})]})]})})}function Va({html:n,url:i,width:o,height:s,onClose:c=()=>{}}){const{_:a}=ae();return e("div",{class:"embed-modal-container",children:[e("div",{class:"top-controls",children:[e("button",{type:"button",class:"light",onClick:()=>c(),children:e(I,{icon:"x",alt:a({id:"yz7wBu"})})}),i&&e("a",{href:i,target:"_blank",rel:"noopener",class:"button plain",children:[e("span",{children:e(h,{id:"4/RpOy"})})," ",e(I,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:n},style:{"--width":o+"px","--height":s+"px","--aspect-ratio":`${o}/${s}`}})]})}function Ga({instance:n,excludeRelationshipAttrs:i=[],postID:o,onClose:s=()=>{},blankCopy:c}){const{_:a}=ae(),{masto:p,instance:d}=se(),l=n?n===d:!0,r=Ge(E),[u,m]=R("default"),[f,v]=R(!1);if(no(s),!r.showGenericAccounts)return null;const{id:y,heading:S,fetchAccounts:k,accounts:b,showReactions:g}=r.showGenericAccounts,[_,w]=R(b?.length?b:[]),[A,C]=R({}),T=async F=>{if(!F?.length||!l)return;const U=await Kn(F,A);U&&C({...A,...U})},L=F=>{k&&(F&&!_?.length&&w([]),m("loading"),(async()=>{try{const{done:U,value:W}=await k(F);if(Array.isArray(W)){if(F){const Q=[];for(let V=0;V<W.length;V++){const j=W[V],K=Q.find((pe,$)=>pe.id===j.id&&V!==$);K?K._types.push(...j._types):Q.push({_types:[],...j})}w(Q)}else w(Q=>{const V=Q;for(const j of W){const K=V.find(pe=>pe.id===j.id);K?K._types.push(...j._types):V.push(j)}return V});v(!U),T(W)}else v(!1);m("default")}catch{m("error")}})())},M=q(!0);G(()=>{_?.length>0?k?(L(!0),M.current=!1):T(_):(L(!0),M.current=!1)},[k]),G(()=>{M.current||r.reloadGenericAccounts?.id===y&&L(!0)},[r.reloadGenericAccounts.counter]);const H=E.statuses[o];return e("div",{id:"generic-accounts-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",alt:a({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:S||a({id:"bPwFdf"})})}),e("main",{children:[H&&e(fe,{to:`/${n||d}/s/${H.id}`,class:"post-preview",children:e(je,{status:H,size:"s",readOnly:!0})}),_.length>0?e(D,{children:[e("ul",{class:"accounts-list",children:_.map(F=>{const U=A[F.id],W=`${F.id}-${F._types?.length||""}`;return e("li",{children:[g&&F._types?.length>0&&e("div",{class:"reactions-block",children:F._types.map(Q=>e(I,{icon:{reblog:"rocket",favourite:"heart"}[Q],class:`${Q}-icon`}))}),e("div",{class:"account-relationships",children:e(ut,{account:F,showStats:!0,relationship:U,excludeRelationshipAttrs:i})})]},W)})}),u==="default"?f?e(Tt,{onChange:F=>{F&&L()},children:e("button",{type:"button",class:"plain block",onClick:()=>L(),children:e(h,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(h,{id:"2EYeAZ"})}):u==="loading"&&e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})})]}):u==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):u==="error"?e("p",{class:"ui-state",children:e(h,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:c||a({id:"10OlfF"})})]})]})}const Wa=140;function Za({alt:n,lang:i,onClose:o}){const{_:s}=ae(),c=Ge(E),[a,p]=R(!1),d=Fs(!0),l=c.settings.contentTranslationHideLanguages||[],r=!!i&&i!==d&&!Nn([i],[d])&&!l.find(u=>i===u||Nn([i],[u]));return G(()=>{const u=n?.length>0&&n?.length<=Wa;r&&u&&p(!0)},[r,n]),e("div",{class:"sheet",tabindex:"-1",children:[!!o&&e("button",{type:"button",class:"sheet-close outer",onClick:o,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:[e("h2",{children:e(h,{id:"5gfDMm"})}),e("div",{class:"header-side",children:e(rt,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(I,{icon:"more",alt:s({id:"2FYpfJ"}),size:"xl"})}),children:[e(ge,{disabled:a,onClick:()=>{p(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(h,{id:"pi8x/S"})})]}),lc&&e(ge,{onClick:()=>{dc(n,i)},children:[e(I,{icon:"speak"}),e("span",{children:e(h,{id:"yIBLq8"})})]})]})})]}),e("main",{lang:i,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:n}),(r||a)&&e(Bs,{forceTranslate:a,sourceLanguage:i,text:n})]})]})}const{min:uu,max:hu}=Math;const ao={};for(let n of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])ao[`[object ${n}]`]=n.toLowerCase();function Xa(n){return ao[Object.prototype.toString.call(n)]||"object"}const en=(n,i=null)=>n.length>=3?Array.prototype.slice.call(n):Xa(n[0])=="object"&&i?i.split("").filter(o=>n[0][o]!==void 0).map(o=>n[0][o]):n[0].slice(0);const{PI:Wn,min:pu,max:fu}=Math;const mu=Wn*2,gu=Wn/3,Ja=Wn/180,Qa=180/Wn;function On(n,i){let o=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(i[0])||(i=i.map(p=>[p]));let s=i[0].length,c=i[0].map((p,d)=>i.map(l=>l[d])),a=n.map(p=>c.map(d=>Array.isArray(p)?p.reduce((l,r,u)=>l+r*(d[u]||0),0):d.reduce((l,r)=>l+r*p,0)));return o===1&&(a=a[0]),s===1?a.map(p=>p[0]):a}const ro={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 ni=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},er=(n,i,o)=>{const{MtxAdaptMa:s,MtxAdaptMaI:c,MtxXYZ2RGB:a,RefWhiteRGB:p,Xn:d,Yn:l,Zn:r}=ro,u=d*s.m00+l*s.m10+r*s.m20,m=d*s.m01+l*s.m11+r*s.m21,f=d*s.m02+l*s.m12+r*s.m22,v=p.X*s.m00+p.Y*s.m10+p.Z*s.m20,y=p.X*s.m01+p.Y*s.m11+p.Z*s.m21,S=p.X*s.m02+p.Y*s.m12+p.Z*s.m22,k=(n*s.m00+i*s.m10+o*s.m20)*(v/u),b=(n*s.m01+i*s.m11+o*s.m21)*(y/m),g=(n*s.m02+i*s.m12+o*s.m22)*(S/f),_=k*c.m00+b*c.m10+g*c.m20,w=k*c.m01+b*c.m11+g*c.m21,A=k*c.m02+b*c.m12+g*c.m22,C=ni(_*a.m00+w*a.m10+A*a.m20),T=ni(_*a.m01+w*a.m11+A*a.m21),L=ni(_*a.m02+w*a.m12+A*a.m22);return[C*255,T*255,L*255]},Fi=(...n)=>{n=en(n,"lab");const[i,o,s,...c]=n,[a,p,d]=tr([i,o,s]),[l,r,u]=er(a,p,d);return[l,r,u,...c.length>0&&c[0]<1?[c[0]]:[]]};function tr(n){var i=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],o=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],s=On(o,n);return On(i,s.map(c=>c**3))}function ii(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 nr=(n,i,o)=>{n=ii(n/255),i=ii(i/255),o=ii(o/255);const{MtxRGB2XYZ:s,MtxAdaptMa:c,MtxAdaptMaI:a,Xn:p,Yn:d,Zn:l,As:r,Bs:u,Cs:m}=ro;let f=n*s.m00+i*s.m10+o*s.m20,v=n*s.m01+i*s.m11+o*s.m21,y=n*s.m02+i*s.m12+o*s.m22;const S=p*c.m00+d*c.m10+l*c.m20,k=p*c.m01+d*c.m11+l*c.m21,b=p*c.m02+d*c.m12+l*c.m22;let g=f*c.m00+v*c.m10+y*c.m20,_=f*c.m01+v*c.m11+y*c.m21,w=f*c.m02+v*c.m12+y*c.m22;return g*=S/r,_*=k/u,w*=b/m,f=g*a.m00+_*a.m10+w*a.m20,v=g*a.m01+_*a.m11+w*a.m21,y=g*a.m02+_*a.m12+w*a.m22,[f,v,y]},Bi=(...n)=>{const[i,o,s,...c]=en(n,"rgb"),a=nr(i,o,s);return[...ir(a),...c.length>0&&c[0]<1?[c[0]]:[]]};function ir(n){const i=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],o=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],s=On(i,n);return On(o,s.map(c=>Math.cbrt(c)))}const{sin:sr,cos:or}=Math,cr=(...n)=>{let[i,o,s]=en(n,"lch");return isNaN(s)&&(s=0),s=s*Ja,[i,or(s)*o,sr(s)*o]},si=(...n)=>{n=en(n,"lch");const[i,o,s,...c]=n,[a,p,d]=cr(i,o,s),[l,r,u]=Fi(a,p,d);return[l,r,u,...c.length>0&&c[0]<1?[c[0]]:[]]},{sqrt:ar,atan2:rr,round:lr}=Math,dr=(...n)=>{const[i,o,s]=en(n,"lab"),c=ar(o*o+s*s);let a=(rr(s,o)*Qa+360)%360;return lr(c*1e4)===0&&(a=Number.NaN),[i,c,a]},ur=(...n)=>{const[i,o,s,...c]=en(n,"rgb"),[a,p,d]=Bi(i,o,s),[l,r,u]=dr(a,p,d);return[l,r,u,...c.length>0&&c[0]<1?[c[0]]:[]]},hr={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:vu}=hr;function lo({mediaAttachments:n,statusID:i,instance:o,lang:s,index:c=0,onClose:a=()=>{}}){const{_:p}=ae(),[d,l]=R("default"),r=q(null),[u,m]=R(c),f=q(null);St(()=>{f.current?.scrollIntoView()},[]);const v=q(i);G(()=>{const w=c*r.current.clientWidth,A=v.current!==i;A&&(v.current=i),r.current.focus(),r.current.scrollTo({left:w*(Ft()?-1:1),behavior:A?"auto":"smooth"})},[c,i]);const[y,S]=R(!0);G(()=>{let w=A=>{a(A,u,n,r)};return r.current&&r.current.addEventListener("swiped-down",w),()=>{r.current&&r.current.removeEventListener("swiped-down",w)}},[u,n]),Ue("esc",w=>{a(w,u,n,r)},{ignoreEventWhen:w=>!!document.querySelector("#modal-container > *")||w.metaKey||w.ctrlKey||w.altKey||w.shiftKey,useKey:!0},[a,u,n]),G(()=>{let w=()=>{const{clientWidth:A,scrollLeft:C}=r.current,T=Math.round(Math.abs(C)/A);m(T)};return r.current&&r.current.addEventListener("scroll",w,{passive:!0}),()=>{r.current&&r.current.removeEventListener("scroll",w)}},[]),G(()=>{let w=setTimeout(()=>{r.current?.focus?.()},100);return()=>clearTimeout(w)},[]);const k=ke(()=>n?.map(w=>{const{blurhash:A}=w;if(A){const C=Ti(A);return ur(C)}return null}),[n]),b=ke(()=>k?.map(w=>w?{light:si([.95,.01,w[2]]),dark:si([.35,.01,w[2]]),default:si([.6,w[1],w[2]])}:null)),g=ke(()=>{const A=100/b.length,C=b.map((M,H)=>{const F=H*A+5,U=(H+1)*A-5;return M?.light&&M?.dark?{light:`
rgb(${M.light?.join(",")}) ${F}%,
rgb(${M.light?.join(",")}) ${U}%
`,dark:`
rgb(${M.dark?.join(",")}) ${F}%,
rgb(${M.dark?.join(",")}) ${U}%
`}:{light:`
transparent ${F}%,
transparent ${U}%
`,dark:`
transparent ${F}%,
transparent ${U}%
`}}),T=C.map(M=>M.light).join(", "),L=C.map(M=>M.dark).join(", ");return{light:T,dark:L}},[b]);let _=q(null);return G(()=>()=>{_.current?.hideToast?.()},[]),St(()=>{const w=b[u];let A,C;if(w){const T=Te.local.get("theme");if(T){const L=`rgb(${w[T].join(",")})`;A=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),A&&(C=A.content,A.content=L)}else{const L=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",M=`rgb(${w[L].join(",")})`;A=document.querySelector(`meta[name="theme-color"][media*="${L}"]`),A&&(C=A.content,A.content=M)}}return()=>{A&&C&&(A.content=C)}},[u,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:w=>{(w.target.classList.contains("carousel-item")||w.target.classList.contains("media")||w.target.classList.contains("media-zoom"))&&a(w,u,n,r)},style:n.length>1?{backgroundAttachment:"local","--accent-gradient-light":g?.light,"--accent-gradient-dark":g?.dark}:{},children:n?.map((w,A)=>{const C=n.length===1?b[A]:null;return e("div",{class:"carousel-item",style:C?{"--accent-color":`rgb(${C.default.join(",")})`,"--accent-light-color":`rgb(${C.light?.join(",")})`,"--accent-dark-color":`rgb(${C.dark?.join(",")})`,"--accent-alpha-color":`rgba(${C.default.join(",")}, 0.4)`}:{},tabindex:"0",ref:A===u?f:null,onClick:T=>{T.target.classList.contains("media")||S(!y)},children:[!!w.description&&e("button",{type:"button",class:"media-alt",hidden:!y,onClick:()=>{E.showMediaAlt={alt:w.description,lang:s}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:s,dir:"auto",children:w.description})]}),e(Ks,{media:w,showOriginal:!0,lang:s})]},w.id)})}),e("div",{class:"carousel-top-controls",hidden:!y,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:w=>a(w,u,n,r),children:e(I,{icon:"x",alt:p({id:"yz7wBu"})})})}),n?.length>1?e("span",{class:"carousel-dots",children:n?.map((w,A)=>e("button",{type:"button",disabled:A===u,class:`carousel-dot ${A===u?"active":""}`,onClick:C=>{C.preventDefault(),C.stopPropagation();const T=r.current.clientWidth*A*(Ft()?-1:1);r.current.focus(),r.current.scrollTo({left:T,behavior:"smooth"})},children:e(I,{icon:"round",size:"s",alt:"⸱"})},w.id))}):e("span",{}),e("span",{children:[e(rt,{overflow:"auto",align:"end",position:"anchor",gap:4,menuClassName:"glass-menu",menuButton:e("button",{type:"button",class:"carousel-button",children:e(I,{icon:"more",alt:p({id:"2FYpfJ"})})}),children:[e(Ke,{href:n[u]?.remoteUrl||n[u]?.url,class:"carousel-button",target:"_blank",title:p({id:"5hXGws"}),children:[e(I,{icon:"popout"}),e("span",{children:e(h,{id:"aDr7Vc"})})]}),!1]})," ",!!i&&e(fe,{to:`${o?`/${o}`:""}/s/${i}${window.matchMedia("(min-width: calc(40em + 350px))").matches?`?media=${u+1}`:""}`,class:"button carousel-button media-post-link",children:[e("span",{class:"button-label",children:[e(h,{id:"ISg5SQ"})," "]}),"»"]})]})]}),n?.length>1&&e("div",{class:"carousel-controls",hidden:!y,children:[e("button",{type:"button",class:"carousel-button",hidden:u===0,onClick:w=>{w.preventDefault(),w.stopPropagation(),r.current.focus(),r.current.scrollTo({left:r.current.clientWidth*(u-1)*(Ft()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-left",alt:p({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:u===n.length-1,onClick:w=>{w.preventDefault(),w.stopPropagation(),r.current.focus(),r.current.scrollTo({left:r.current.clientWidth*(u+1)*(Ft()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-right",alt:p({id:"hXzOVo"})})})]})]})}function pr({url:n,linkText:i,onClose:o}){const{_:s}=ae();if(!n)return null;let c=n;try{const d=URL.parse(n),l=d.protocol,r=d.hostname,u=n.slice(d.origin.length);c=e(D,{children:[l,"//",e("strong",{children:r}),u]})}catch{}const a=()=>{try{navigator.clipboard.writeText(n),le(s({id:"edWbV6"}))}catch{le(s({id:"W1ewR0"}))}},p=()=>{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:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(h,{id:"Gj4mrz"})})}),e("main",{children:[!!i&&e(D,{children:[e("p",{class:"link-text",children:[e(I,{icon:"cursor-hand",size:"xl"})," ",i]}),e("div",{class:"arrow",children:e(I,{icon:"arrow-down"})})]}),e("p",{class:"full-url",children:c})]}),e("footer",{children:[e("button",{type:"button",class:"light",onClick:o,children:e(h,{id:"dEgA5A"})}),e("span",{class:"spacer"}),e("button",{type:"button",class:"plain6",onClick:a,children:e(I,{icon:"copy",alt:s({id:"he3ygx"})})}),navigator.canShare&&navigator.canShare({url:n})&&e("button",{type:"button",class:"plain6",onClick:p,children:e(I,{icon:"share",alt:s({id:"LFKLqp"})})}),e("a",{class:"button",href:n,target:"_blank",rel:"noopener noreferrer",onClick:o,children:e(h,{id:"1TNIig"})})]})]})}const fr=["spam","legal","violation","other"],tn={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 mr(n,i){if(!n.translations||!i)return null;const o=Object.keys(n.translations);if(!o?.length)return null;let s=Nn([i],o,null);if(!s){const c=o.map(a=>a.split(/(?=[A-Z])/).map((d,l)=>l===0?d:d.toLowerCase()).join("-"));s=Nn([i],c,null)}if(s&&s.includes("-")){const[c,a]=s.split("-");s=c+a.charAt(0).toUpperCase()+a.slice(1)}return s}function gr(n,i){return n?.length?i?n.map(o=>{const s=mr(o,i);return{...o,_translatedText:o.translations?.[s]?.text||null}}):n:[]}function vr({account:n,post:i,onClose:o}){const{_:s,_:c,i18n:a}=ae(),{masto:p}=se(),[d,l]=R("default"),[r,u]=n.acct.split("@"),[m,f]=ke(()=>{const{rules:w,domain:A}=Ls();return[gr(w||[],a.locale),A]},[a.locale]),[v,y]=R(null),[S,k]=R(!1),b=q(null),[g,_]=R(!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:d==="loading",onClick:()=>o(),children:e(I,{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(ut,{account:n,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!v&&!tn[v].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[s(tn[v].stampLabel||s(tn[v].label)),e("small",{children:e(h,{id:"2WtL62"})})]},v),e("form",{onSubmit:w=>{w.preventDefault();const A=new FormData(w.target),C=Object.fromEntries(A.entries());let{category:T,comment:L,forward:M}=C;L||(L=void 0),M==="on"&&(M=!0);const H=T==="violation"?Object.entries(C).filter(([U])=>U.startsWith("rule_ids")).map(([U,W])=>W):void 0,F={category:T,comment:L,forward:M,ruleIds:H};l("loading"),(async()=>{try{await p.v1.reports.create({accountId:n.id,statusIds:i?.id?[i.id]:void 0,category:T,comment:L,ruleIds:H,forward:M}),l("success"),le(c(i?{id:"y3ou+8"}:{id:"R9kjEL"})),o()}catch(U){l("error"),le(U?.message||c(i?{id:"+3FjPq"}:{id:"oEQq5w"}))}})()},children:[e("p",{children:c(i?{id:"L9fUm+"}:{id:"rSLkfe"})}),e("section",{class:"report-categories",children:fr.map(w=>w==="violation"&&!m?.length?null:e(D,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:w,required:!0,disabled:d==="loading",onChange:A=>{y(A.target.value),k(A.target.value==="violation")}}),e("span",{children:[s(tn[w].label),"  ",e("small",{class:"ib insignificant",children:s(tn[w].description)})]})]}),w==="violation"&&!!m?.length&&e("div",{class:"shazam-container no-animation",hidden:!S,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:b,children:m.map((A,C)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${C}]`,value:A.id,required:S&&!g,disabled:d==="loading",onChange:T=>{const{checked:L}=T.target;L?_(!0):b.current.querySelectorAll("input:checked").length||_(!1)}}),e("span",{children:A._translatedText||A.text})]},A.id))})})})]},w))}),e("section",{class:"report-comment",children:[e("p",{children:e("label",{for:"report-comment",children:e(h,{id:"ecVtjm"})})}),e("textarea",{maxlength:"1000",rows:"1",name:"comment",id:"report-comment",disabled:d==="loading",required:!i})]}),!!u&&u!==f&&e("section",{children:e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,name:"forward",disabled:d==="loading"})," ",e("span",{children:e(h,{id:"cyjS8M",values:{domain:u},components:{0:e("i",{})}})})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:d==="loading",children:e(h,{id:"4cijjm"})})," ",e("button",{type:"submit",class:"plain2",disabled:d==="loading",onClick:async()=>{try{await p.v1.accounts.$select(n.id).mute(),le(c({id:"/BGBeF",values:{username:r}}))}catch{le(c({id:"v02K7/",values:{username:r}}))}},children:e(h,{id:"caeqw/",components:{0:e("small",{class:"ib"})}})})," ",e("button",{type:"submit",class:"plain2",disabled:d==="loading",onClick:async()=>{try{await p.v1.accounts.$select(n.id).block(),le(c({id:"kjUejn",values:{username:r}}))}catch{le(c({id:"pMcdDp",values:{username:r}}))}},children:e(h,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(Oe,{hidden:d!=="loading"})]})]})]})]})}var _n={exports:{}},yu=_n.exports,cs;function yr(){return cs||(cs=1,function(n){var i=function(){var o=String.fromCharCode,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function p(l,r){if(!a[l]){a[l]={};for(var u=0;u<l.length;u++)a[l][l.charAt(u)]=u}return a[l][r]}var d={compressToBase64:function(l){if(l==null)return"";var r=d._compress(l,6,function(u){return s.charAt(u)});switch(r.length%4){default:case 0:return r;case 1:return r+"===";case 2:return r+"==";case 3:return r+"="}},decompressFromBase64:function(l){return l==null?"":l==""?null:d._decompress(l.length,32,function(r){return p(s,l.charAt(r))})},compressToUTF16:function(l){return l==null?"":d._compress(l,15,function(r){return o(r+32)})+" "},decompressFromUTF16:function(l){return l==null?"":l==""?null:d._decompress(l.length,16384,function(r){return l.charCodeAt(r)-32})},compressToUint8Array:function(l){for(var r=d.compress(l),u=new Uint8Array(r.length*2),m=0,f=r.length;m<f;m++){var v=r.charCodeAt(m);u[m*2]=v>>>8,u[m*2+1]=v%256}return u},decompressFromUint8Array:function(l){if(l==null)return d.decompress(l);for(var r=new Array(l.length/2),u=0,m=r.length;u<m;u++)r[u]=l[u*2]*256+l[u*2+1];var f=[];return r.forEach(function(v){f.push(o(v))}),d.decompress(f.join(""))},compressToEncodedURIComponent:function(l){return l==null?"":d._compress(l,6,function(r){return c.charAt(r)})},decompressFromEncodedURIComponent:function(l){return l==null?"":l==""?null:(l=l.replace(/ /g,"+"),d._decompress(l.length,32,function(r){return p(c,l.charAt(r))}))},compress:function(l){return d._compress(l,16,function(r){return o(r)})},_compress:function(l,r,u){if(l==null)return"";var m,f,v={},y={},S="",k="",b="",g=2,_=3,w=2,A=[],C=0,T=0,L;for(L=0;L<l.length;L+=1)if(S=l.charAt(L),Object.prototype.hasOwnProperty.call(v,S)||(v[S]=_++,y[S]=!0),k=b+S,Object.prototype.hasOwnProperty.call(v,k))b=k;else{if(Object.prototype.hasOwnProperty.call(y,b)){if(b.charCodeAt(0)<256){for(m=0;m<w;m++)C=C<<1,T==r-1?(T=0,A.push(u(C)),C=0):T++;for(f=b.charCodeAt(0),m=0;m<8;m++)C=C<<1|f&1,T==r-1?(T=0,A.push(u(C)),C=0):T++,f=f>>1}else{for(f=1,m=0;m<w;m++)C=C<<1|f,T==r-1?(T=0,A.push(u(C)),C=0):T++,f=0;for(f=b.charCodeAt(0),m=0;m<16;m++)C=C<<1|f&1,T==r-1?(T=0,A.push(u(C)),C=0):T++,f=f>>1}g--,g==0&&(g=Math.pow(2,w),w++),delete y[b]}else for(f=v[b],m=0;m<w;m++)C=C<<1|f&1,T==r-1?(T=0,A.push(u(C)),C=0):T++,f=f>>1;g--,g==0&&(g=Math.pow(2,w),w++),v[k]=_++,b=String(S)}if(b!==""){if(Object.prototype.hasOwnProperty.call(y,b)){if(b.charCodeAt(0)<256){for(m=0;m<w;m++)C=C<<1,T==r-1?(T=0,A.push(u(C)),C=0):T++;for(f=b.charCodeAt(0),m=0;m<8;m++)C=C<<1|f&1,T==r-1?(T=0,A.push(u(C)),C=0):T++,f=f>>1}else{for(f=1,m=0;m<w;m++)C=C<<1|f,T==r-1?(T=0,A.push(u(C)),C=0):T++,f=0;for(f=b.charCodeAt(0),m=0;m<16;m++)C=C<<1|f&1,T==r-1?(T=0,A.push(u(C)),C=0):T++,f=f>>1}g--,g==0&&(g=Math.pow(2,w),w++),delete y[b]}else for(f=v[b],m=0;m<w;m++)C=C<<1|f&1,T==r-1?(T=0,A.push(u(C)),C=0):T++,f=f>>1;g--,g==0&&(g=Math.pow(2,w),w++)}for(f=2,m=0;m<w;m++)C=C<<1|f&1,T==r-1?(T=0,A.push(u(C)),C=0):T++,f=f>>1;for(;;)if(C=C<<1,T==r-1){A.push(u(C));break}else T++;return A.join("")},decompress:function(l){return l==null?"":l==""?null:d._decompress(l.length,32768,function(r){return l.charCodeAt(r)})},_decompress:function(l,r,u){var m=[],f,v=4,y=4,S=3,k="",b=[],g,_,w,A,C,T,L,M={val:u(0),position:r,index:1};for(g=0;g<3;g+=1)m[g]=g;for(w=0,C=Math.pow(2,2),T=1;T!=C;)A=M.val&M.position,M.position>>=1,M.position==0&&(M.position=r,M.val=u(M.index++)),w|=(A>0?1:0)*T,T<<=1;switch(f=w){case 0:for(w=0,C=Math.pow(2,8),T=1;T!=C;)A=M.val&M.position,M.position>>=1,M.position==0&&(M.position=r,M.val=u(M.index++)),w|=(A>0?1:0)*T,T<<=1;L=o(w);break;case 1:for(w=0,C=Math.pow(2,16),T=1;T!=C;)A=M.val&M.position,M.position>>=1,M.position==0&&(M.position=r,M.val=u(M.index++)),w|=(A>0?1:0)*T,T<<=1;L=o(w);break;case 2:return""}for(m[3]=L,_=L,b.push(L);;){if(M.index>l)return"";for(w=0,C=Math.pow(2,S),T=1;T!=C;)A=M.val&M.position,M.position>>=1,M.position==0&&(M.position=r,M.val=u(M.index++)),w|=(A>0?1:0)*T,T<<=1;switch(L=w){case 0:for(w=0,C=Math.pow(2,8),T=1;T!=C;)A=M.val&M.position,M.position>>=1,M.position==0&&(M.position=r,M.val=u(M.index++)),w|=(A>0?1:0)*T,T<<=1;m[y++]=o(w),L=y-1,v--;break;case 1:for(w=0,C=Math.pow(2,16),T=1;T!=C;)A=M.val&M.position,M.position>>=1,M.position==0&&(M.position=r,M.val=u(M.index++)),w|=(A>0?1:0)*T,T<<=1;m[y++]=o(w),L=y-1,v--;break;case 2:return b.join("")}if(v==0&&(v=Math.pow(2,S),S++),m[L])k=m[L];else if(L===y)k=_+_.charAt(0);else return null;b.push(k),m[y++]=_+k.charAt(0),v--,_=k,v==0&&(v=Math.pow(2,S),S++)}}};return d}();n!=null?n.exports=i:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return i})}(_n)),_n.exports}var as=yr();const br="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",wr="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",kr="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",Sr=200,Cr=10;async function zn(){const{masto:n}=se(),i=n.v1.followedTags.list({limit:Sr}).values(),o=[];let s=0;do{const{value:c,done:a}=await i.next();if(a||c?.length===0)break;o.push(...c),s++}while(s<Cr);return o.sort((c,a)=>c.name.localeCompare(a.name)),o.length&&setTimeout(()=>{Te.account.set("followedTags",{tags:o,updatedAt:Date.now()})},1),o}const _r=24*60*60*1e3;async function Ir(){try{const{tags:n,updatedAt:i}=Te.account.get("followedTags")||{};return n?.length?(Date.now()-i>_r&&zn(),n):await zn()}catch{return[]}}const rs=document.createElement("div"),Ar=n=>{if(!n)return[];if(n.indexOf("#")===-1)return[];rs.innerHTML=n;const i=rs.querySelectorAll("a.hashtag");return i.length?Array.from(i).map(o=>o.innerText.trim().replace(/^[^#]*#+/,"")):[]};function In({children:n}){if(typeof n=="string")return n;const[i,o]=R("");return G(()=>{Promise.resolve(n).then(o)},[n]),i}const At=9,Tr=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],uo={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"}},An={list:[{text:{id:"DUMt1y"},name:"id",notRequired:!0}],public:[{text:{id:"OgyJSr"},name:"local",type:"checkbox"},{text:{id:"kyAi7k"},name:"instance",type:"text",placeholder:{id:"7defFj"},notRequired:!0}],trending:[{text:{id:"kyAi7k"},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:"kyAi7k"},name:"instance",type:"text",placeholder:{id:"7defFj"},notRequired:!0}]},xr=yt(async({id:n})=>{const i=await se().masto.v1.accounts.$select(n).fetch();return i.username||i.acct||i.displayName}),Fn={following:{id:"home",title:(n,i)=>i===0?ue._({id:"i0qMbr"}):ue._({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?xa(n):ue._({id:"h16FyT"}),path:({id:n})=>n?`/l/${n}`:"/l",icon:"list",excludeViewMode:({id:n})=>n?[]:["multi-column"]},public:{id:"public",title:({local:n})=>n?ue._({id:"d5zxa4"}):ue._({id:"4ERYY7"}),subtitle:({instance:n})=>n||se().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||se().instance,path:({instance:n})=>`/${n}/trending`,icon:"chart"},search:{id:"search",title:({query:n})=>n?`${n}`:ue._({id:"A1taO8"}),path:({query:n})=>n?`/search?q=${encodeURIComponent(n)}&type=statuses`:"/search",icon:"search",excludeViewMode:({query:n})=>n?[]:["multi-column"]},"account-statuses":{id:"account-statuses",title:xr,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||se().instance,path:({hashtag:n,instance:i,media:o})=>`${i?`/${i}`:""}/t/${n.split(/\s+/).join("+")}${o?"?media=1":""}`,icon:"hashtag"}};function Er({onClose:n}){const{_:i}=ae(),o=Ge(E),{shortcuts:s}=o,[c,a]=R(!1),[p,d]=R(!1),[l]=Yn();return e("div",{id:"shortcuts-settings-container",class:"sheet",tabindex:"-1",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:ue._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(I,{icon:"shortcut"})," ",e(h,{id:"CTqTgr"})," ",e("sup",{style:{fontSize:12,opacity:.5,textTransform:"uppercase"},children:e(h,{id:"A1As8l"})})]})}),e("main",{children:[e("p",{children:e(h,{id:"CIHAsy"})}),e("div",{class:"shortcuts-view-mode",children:[{value:"float-button",label:ue._({id:"qwdOim"}),imgURL:br},{value:"tab-menu-bar",label:ue._({id:"UxBoCm"}),imgURL:kr},{value:"multi-column",label:ue._({id:"uvDfdW"}),imgURL:wr}].map(({value:r,label:u,imgURL:m})=>{const f=o.settings.shortcutsViewMode===r||r==="float-button"&&!o.settings.shortcutsViewMode;return e("label",{class:f?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:r,checked:f,onChange:v=>{E.settings.shortcutsViewMode=v.target.value}})," ",e("img",{src:m,alt:"",width:"80",height:"58"})," ",e("span",{children:u})]},r)})}),s.length>0?e(D,{children:[e("ol",{class:"shortcuts-list",ref:l,children:s.filter(Boolean).map((r,u)=>{const m=Object.values(r).join("-"),{type:f}=r;if(!Fn[f])return null;let{icon:v,title:y,subtitle:S,excludeViewMode:k}=Fn[f];typeof y=="function"?y=y(r,u):y=i(y),typeof S=="function"?S=S(r,u):S=i(S),typeof v=="function"&&(v=v(r,u)),typeof k=="function"&&(k=k(r,u));const b=k?.includes(o.settings.shortcutsViewMode);return e("li",{children:[e(I,{icon:v}),e("span",{class:"shortcut-text",children:[e(In,{children:y}),S&&e(D,{children:[" ",e("small",{class:"ib insignificant",children:S})]}),b&&e("span",{class:"tag",children:e(h,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:u===0,onClick:()=>{const g=Array.from(E.shortcuts);if(u>0){const _=E.shortcuts[u-1];g[u-1]=r,g[u]=_,E.shortcuts=g}},children:e(I,{icon:"arrow-up",alt:ue._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:u===s.length-1,onClick:()=>{const g=Array.from(E.shortcuts);if(u<E.shortcuts.length-1){const _=E.shortcuts[u+1];g[u+1]=r,g[u]=_,E.shortcuts=g}},children:e(I,{icon:"arrow-down",alt:ue._({id:"3Ib6FN"})})}),e("button",{type:"button",class:"plain small",onClick:()=>{a({shortcut:r,shortcutIndex:u})},children:e(I,{icon:"pencil",alt:ue._({id:"ePK91l"})})})]})]},m)})}),s.length===1&&o.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(I,{icon:"info"})," ",e("small",{children:e(h,{id:"3Xq4Zi"})})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:o.settings.shortcutsViewMode==="multi-column"?ue._({id:"3xIN+E"}):ue._({id:"vLxvHT"})}),e("p",{children:e(h,{id:"Fq4zw3",components:{0:e("br",{}),1:e("a",{href:"#",onClick:r=>{r.preventDefault(),E.shortcuts=[{type:"following"},{type:"notifications"}]}})}})})]}),e("p",{class:"insignificant",children:s.length>=At&&(o.settings.shortcutsViewMode==="multi-column"?ue._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:At}}):ue._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:At}}))}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>d(!0),children:e(h,{id:"bgVLbt"})}),e("button",{type:"button",disabled:s.length>=At,onClick:()=>a(!0),children:[e(I,{icon:"plus"})," ",e("span",{children:o.settings.shortcutsViewMode==="multi-column"?ue._({id:"Vh3ADI"}):ue._({id:"9tmn6W"})})]})]})]}),c&&e(qe,{onClick:r=>{r.target===r.currentTarget&&a(!1)},children:e(Rr,{shortcut:c.shortcut,shortcutIndex:c.shortcutIndex,onSubmit:({result:r,mode:u})=>{u==="edit"?E.shortcuts[c.shortcutIndex]=r:E.shortcuts.push(r)},onClose:()=>a(!1)})}),p&&e(qe,{onClick:r=>{r.target===r.currentTarget&&d(!1)},children:e(Lr,{shortcuts:s,onClose:()=>d(!1)})})]})}const ls={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function Rr({onSubmit:n,disabled:i,shortcut:o,shortcutIndex:s,onClose:c}){const{_:a}=ae(),p=!!o,[d,l]=R(o?.type||null),[r,u]=R("default"),[m,f]=R([]),[v,y]=R([]);G(()=>{(async()=>{if(d==="list")try{u("loading");const k=await pn();f(k),u("default")}catch{u("error")}})(),(async()=>{if(d==="hashtag")try{const k=await zn();y(k)}catch{}})()},[d]);const S=q();return G(()=>{if(p&&d&&An[d]){const k=S.current;An[d].forEach(({name:b,type:g})=>{const _=k.querySelector(`[name="${b}"]`);_&&o[b]&&(g==="checkbox"?_.checked=o[b]==="on":_.value=o[b])})}},[p,d]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!c&&e("button",{type:"button",class:"sheet-close",onClick:c,children:e(I,{icon:"x",alt:ue._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:p?ue._({id:"pe1jog"}):ue._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:S,onSubmit:k=>{k.preventDefault();const b=new FormData(k.target),g={};b.forEach((_,w)=>{g[w]=_?.trim(),w==="instance"&&(g[w]=g[w].replace(/^https?:\/\//,"").replace(/\/+$/,""),g[w]=g[w].replace(/^@?[^@]+@/,""))}),g.type&&(n({result:g,mode:p?"edit":"add"}),k.target.reset(),l(null),c?.())},children:[e("p",{children:e("label",{children:[e("span",{children:e(h,{id:"cklVjM"})}),e("select",{required:!0,disabled:i,onChange:k=>{l(k.target.value)},defaultValue:p?o.type:void 0,name:"type",dir:"auto",children:[e("option",{}),Tr.map(k=>e("option",{value:k,children:a(uo[k])}))]})]})}),An[d]?.map?.(({text:k,name:b,type:g,placeholder:_,pattern:w,notRequired:A})=>d==="list"?e("p",{children:e("label",{children:[e("span",{children:e(h,{id:"2BBAbc"})}),e("select",{name:"id",required:!A,disabled:i||r==="loading",defaultValue:p?o.id:void 0,dir:"auto",children:[e("option",{value:""}),m.map(C=>e("option",{value:C.id,children:C.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:a(k)})," ",e("input",{type:g,switch:g==="checkbox"||void 0,name:b,placeholder:a(_),required:g==="text"&&!A,disabled:i,list:d==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:w,dir:"auto"}),d==="hashtag"&&v.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:v.map(C=>e("option",{value:C.name}))})]})})),!!ls[d]&&e("p",{class:"form-note insignificant",children:[e(I,{icon:"info"}),a(ls[d])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:i||r==="loading",children:p?ue._({id:"tfDRzk"}):ue._({id:"m16xKo"})}),p&&e("button",{type:"button",class:"light danger",onClick:()=>{E.shortcuts.splice(s,1),c?.()},children:e(h,{id:"t/YqKh"})})]})]})})]})}function Lr({shortcuts:n,onClose:i}){const{_:o}=ae(),{masto:s}=se(),c=ke(()=>!n||!n.filter(Boolean).length?"":as.compressToEncodedURIComponent(JSON.stringify(n.filter(Boolean))),[n]),[a,p]=R(""),[d,l]=R("default"),r=ke(()=>{if(!a)return l("default"),null;try{const f=JSON.parse(as.decompressFromEncodedURIComponent(a));if(!Array.isArray(f))throw new Error("Not an array");return l("default"),f}catch{try{const v=JSON.parse(a);if(!Array.isArray(v))throw new Error("Not an array");return l("default"),v}catch{return l("error"),null}}},[a]),u=E.shortcuts.length>0,m=q();return e("div",{id:"import-export-container",class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:ue._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(h,{id:"OOa7/5",components:{0:e("small",{class:"ib insignificant"})}})})}),e("main",{tabindex:"-1",children:[e("section",{children:[e("h3",{children:[e(I,{icon:"arrow-down-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(h,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:m,type:"text",name:"import",placeholder:ue._({id:"tBmklN"}),class:"block",onInput:f=>{p(f.target.value)},dir:"auto"}),E.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:d==="cloud-downloading",onClick:async()=>{l("cloud-downloading");const f=vt();le(ue._({id:"HLqLGx"}));try{const y=(await s.v1.accounts.relationships.fetch({id:[f]}))[0];if(y){const{note:S=""}=y;if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(S)){const k=S.match(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/)[1],{v:b,dt:g,data:_}=JSON.parse(k);m.current.value=_,m.current.dispatchEvent(new Event("input"))}}l("default")}catch{l("error"),le(ue._({id:"gCDfX+"}))}},title:ue._({id:"B6cG3J"}),children:[e(I,{icon:"cloud"}),e(I,{icon:"arrow-down"})]})]}),!!r&&Array.isArray(r)&&e(D,{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(f=>e("li",{children:[e("span",{style:{opacity:n.some(v=>Object.keys(v).every(y=>v[y]===f[y]))?1:0},children:"*"}),e("span",{children:[o(uo[f.type]),f.type==="list"&&" ⚠️"," ",An[f.type]?.map?.(({text:v,name:y,type:S})=>f[y]?e(D,{children:[e("span",{class:"tag collapsed insignificant",children:[v,":"," ",S==="checkbox"?f[y]==="on"?"✅":"❌":f[y]]})," "]}):null)]})]}))}),e("p",{children:[e("small",{children:e(h,{id:"o6sElH"})}),e("br",{}),e("small",{children:["⚠️"," ",e(h,{id:"N4z4P/"})]})]})]}),d==="error"&&e("p",{class:"error",children:e("small",{children:["⚠️ ",e(h,{id:"ZhsPEb"})]})}),e("p",{children:[u&&e(D,{children:[e(ft,{confirmLabel:ue._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(h,{id:"nl8sCE"})}),onClick:()=>{const f=r.filter(S=>!E.shortcuts.some(k=>Object.keys(k).every(b=>k[b]===S[b])));if(!f.length){le(ue._({id:"o6L30P"}));return}let v=[...E.shortcuts,...f];const y=v.length>At;y&&(v=v.slice(0,At)),E.shortcuts=v,le(y?ue._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:At}}):ue._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!r,children:e(h,{id:"c89gCv"})})})," "]}),e(ft,{confirmLabel:u?ue._({id:"6ZjzWP"}):ue._({id:"DWumLi"}),menuItemClassName:u?"danger":void 0,onClick:()=>{E.shortcuts=r,le(ue._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!r,children:u?ue._({id:"uIp8WL"}):ue._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(I,{icon:"arrow-up-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(h,{id:"GS+Mus"})})]}),e("p",{children:e("input",{style:{width:"100%"},type:"text",value:c,readOnly:!0,onClick:f=>{if(f.target.value){f.target.select();try{navigator.clipboard.writeText(f.target.value),le(ue._({id:"cWtH+v"}))}catch{le(ue._({id:"yUWyHa"}))}}},dir:"auto"})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!c,onClick:()=>{try{navigator.clipboard.writeText(c),le(ue._({id:"+Kq2vY"}))}catch{le(ue._({id:"tFvxZF"}))}},children:[e(I,{icon:"clipboard"})," ",e("span",{children:e(h,{id:"he3ygx"})})]})," ",navigator?.share&&navigator?.canShare?.({text:c})&&e("button",{type:"button",class:"plain2",disabled:!c,onClick:()=>{try{navigator.share({text:c})}catch{alert(ue._({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"})," ",e("span",{children:e(h,{id:"Z8lGw6"})})]})," ",E.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2",disabled:d==="cloud-uploading",onClick:async()=>{l("cloud-uploading");const f=vt();try{const y=(await s.v1.accounts.relationships.fetch({id:[f]}))[0];if(y){const{note:S=""}=y;let k="";const b=JSON.stringify({v:"1",dt:Date.now(),data:c});/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(S)?k=S.replace(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,`<phanpy-shortcuts-settings>${b}</phanpy-shortcuts-settings>`):k=`${S}
<phanpy-shortcuts-settings>${b}</phanpy-shortcuts-settings>`,le(ue._({id:"9ZYiLz"})),await s.v1.accounts.$select(f).note.create({comment:k}),l("default"),le(ue._({id:"5w02SH"}))}}catch{l("error"),le(ue._({id:"aVsTYo"}))}},title:ue._({id:"gWd6Cu"}),children:[e(I,{icon:"cloud"}),e(I,{icon:"arrow-up"})]})," ",c.length>0&&e("small",{class:"insignificant ib",children:e(h,{id:"IPXOXm",values:{0:c.length}})})]}),!!c&&e("details",{children:[e("summary",{class:"insignificant",children:e("small",{children:e(h,{id:"e5E+WH"})})}),e("textarea",{style:{width:"100%"},rows:10,readOnly:!0,children:JSON.stringify(n.filter(Boolean),null,2)})]})]}),E.settings.shortcutSettingsCloudImportExport&&e("footer",{children:e("p",{children:[e(I,{icon:"cloud"})," ",e(h,{id:"C4T6O/"})]})})]})]})}Ms(E,n=>{for(const[i,o,s,c]of n)/^show/i.test(o)&&!s&&ui()});function Mr(){const{_:n}=ae(),i=Ge(E),o=$s(),s=Qt();return G(()=>{setTimeout(Bo,1e3)},[]),e(D,{children:[!!i.showCompose&&e(qe,{class:`solid ${i.composerState.minimized?"min":""}`,minimized:!!i.composerState.minimized,children:e(qo,{replyToStatus:typeof i.showCompose!="boolean"?i.showCompose.replyToStatus:window.__COMPOSE__?.replyToStatus||null,editStatus:E.showCompose?.editStatus||window.__COMPOSE__?.editStatus||null,draftStatus:E.showCompose?.draftStatus||window.__COMPOSE__?.draftStatus||null,quoteStatus:E.showCompose?.quoteStatus||window.__COMPOSE__?.quoteStatus||null,onClose:c=>{const{newStatus:a,instance:p,type:d,scheduledAt:l}=c||{};E.showCompose=!1,window.__COMPOSE__=null,a&&(E.reloadStatusPage++,l&&E.reloadScheduledPosts++,le({text:{post:n(l?{id:"IrX0sj"}:{id:"aTyHBW"}),reply:n(l?{id:"+38pse"}:{id:"lZdBKl"}),edit:n({id:"a5BN7l"})}[d||"post"],delay:1e3,duration:1e4,onClick:r=>{r.hideToast(),E.prevLocation=s,o(l?"/sp":p?`/${p}/s/${a.id}`:`/s/${a.id}`)}}))}})}),!!i.showSettings&&e(qe,{onClose:()=>{E.showSettings=!1},children:e(ya,{onClose:()=>{E.showSettings=!1}})}),!!i.showAccounts&&e(qe,{onClose:()=>{E.showAccounts=!1},children:e(oa,{onClose:()=>{E.showAccounts=!1}})}),!!i.showAccount&&e(qe,{onClose:()=>{E.showAccount=!1},children:e(Ha,{account:i.showAccount?.account||i.showAccount,instance:i.showAccount?.instance,onClose:({destination:c}={})=>{E.showAccount=!1}})}),!!i.showOpenLink&&e(qe,{onClose:()=>{E.showOpenLink=!1},children:e(pr,{url:i.showOpenLink.url,linkText:i.showOpenLink.linkText,onClose:()=>{E.showOpenLink=!1}})}),!!i.showDrafts&&e(qe,{onClose:()=>{E.showDrafts=!1},children:e(ja,{onClose:()=>E.showDrafts=!1})}),!!i.showMediaModal&&e(qe,{onClick:c=>{(c.target===c.currentTarget||c.target.classList.contains("media"))&&(E.showMediaModal=!1)},children:e(lo,{mediaAttachments:i.showMediaModal.mediaAttachments,instance:i.showMediaModal.instance,index:i.showMediaModal.mediaIndex,statusID:i.showMediaModal.statusID,onClose:()=>{E.showMediaModal=!1}})}),!!i.showShortcutsSettings&&e(qe,{onClose:()=>{E.showShortcutsSettings=!1},children:e(Er,{onClose:()=>E.showShortcutsSettings=!1})}),!!i.showGenericAccounts&&e(qe,{onClose:()=>{E.showGenericAccounts=!1},children:e(Ga,{instance:i.showGenericAccounts.instance,excludeRelationshipAttrs:i.showGenericAccounts.excludeRelationshipAttrs,postID:i.showGenericAccounts.postID,onClose:()=>E.showGenericAccounts=!1,blankCopy:i.showGenericAccounts.blankCopy})}),!!i.showMediaAlt&&e(qe,{onClose:c=>{E.showMediaAlt=!1},children:e(Za,{alt:i.showMediaAlt.alt||i.showMediaAlt,lang:i.showMediaAlt?.lang,onClose:()=>{E.showMediaAlt=!1}})}),!!i.showEmbedModal&&e(qe,{class:"solid",onClose:()=>{E.showEmbedModal=!1},children:e(Va,{html:i.showEmbedModal.html,url:i.showEmbedModal.url,width:i.showEmbedModal.width,height:i.showEmbedModal.height,onClose:()=>{E.showEmbedModal=!1}})}),!!i.showReportModal&&e(qe,{onClose:()=>{E.showReportModal=!1},children:e(vr,{account:i.showReportModal.account,post:i.showReportModal.post,onClose:()=>{E.showReportModal=!1}})})]})}function pi({accountID:n,onChange:i}){const{_:o}=ae(),{masto:s}=se(),[c,a]=R("default"),[p,d]=R(null),[l,r]=R(null),u=l!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:c==="loading"||u,onClick:()=>{a("loading"),d("accept"),(async()=>{try{const m=await s.v1.followRequests.$select(n).authorize();if(!m?.followedBy)throw new Error("Follow request not accepted");r(m),i()}catch{}a("default")})()},children:e(h,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:c==="loading"||u,class:"light danger",onClick:()=>{a("loading"),d("reject"),(async()=>{try{const m=await s.v1.followRequests.$select(n).reject();if(m?.followedBy)throw new Error("Follow request not rejected");r(m),i()}catch{a("default")}})()},children:e(h,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:u&&p?p==="accept"?e(I,{icon:"check-circle",alt:o({id:"bzMKg7"}),class:"follow-accepted"}):e(I,{icon:"x-circle",alt:o({id:"ekCRTP"}),class:"follow-rejected"}):e(Oe,{hidden:c!=="loading"})})]})}const ds={mention:"comment",status:"notification",reblog:"rocket",follow:"follow",follow_request:"follow-add",favourite:"heart",poll:"poll",update:"pencil","admin.signup":"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 us({account:n,emoji:i,emoji_url:o}){let s,c;typeof o=="string"?s=o:(s=o?.url,c=o?.staticUrl);const a=s?e(uc,{url:s,staticUrl:c,alt:i}):i;return e(h,{id:"i5uN6K",values:{account:n,emojiObject:a}})}const oi={status:({account:n})=>e(h,{id:"idiIxW",values:{account:n}}),reblog:({count:n,account:i,postsCount:o,postType:s,components:{Subject:c}})=>e(h,{id:"jkt9P5",values:{0:We(n),1:We(n),count:n,postsCount:o,postType:s,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:o}})=>e(h,{id:"+71G9C",values:{0:We(i),count:i,account:n},components:{0:e(o,{clickable:i>1}),1:e("span",{title:i})}}),follow_request:({account:n})=>e(h,{id:"eh6NHW",values:{account:n}}),favourite:({account:n,count:i,postsCount:o,postType:s,components:{Subject:c}})=>e(h,{id:"RqX1mR",values:{0:We(i),1:We(i),count:i,postsCount:o,postType:s,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:()=>ue._({id:"kIlJaS"}),"poll-self":()=>ue._({id:"kpjzdN"}),"poll-voted":()=>ue._({id:"moT7M8"}),update:({account:n})=>n?e(h,{id:"W+eFn3",values:{account:n}}):ue._({id:"uzt17m"}),"favourite+reblog":({count:n,account:i,postsCount:o,postType:s,components:{Subject:c}})=>e(h,{id:"NunZZQ",values:{0:We(n),1:We(n),count:n,postsCount:o,postType:s,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(h,{id:"pkB7ti",values:{account:n}}),"admin.sign_up":({account:n})=>e(h,{id:"fJCCpx",values:{account:n}}),"admin.report":({account:n,targetAccount:i})=>e(h,{id:"eNfCmq",values:{account:n,targetAccount:i}}),severed_relationships:({name:n})=>e(h,{id:"Xl9v6+",values:{name:n},components:{0:e("i",{})}}),moderation_warning:()=>e("b",{children:e(h,{id:"YqffEv"})}),emoji_reaction:us,"pleroma:emoji_reaction":us,annual_report:({year:n})=>e(h,{id:"INLTzH",values:{year:n}})},$r={account_suspension:({from:n,targetName:i})=>e(h,{id:"uRkcgw",values:{from:n,targetName:i},components:{0:e("i",{}),1:e("i",{})}}),domain_block:({from:n,targetName:i,followersCount:o,followingCount:s})=>e(h,{id:"Q3yArs",values:{from:n,targetName:i,followersCount:o,followingCount:s},components:{0:e("i",{}),1:e("i",{})}}),user_domain_block:({targetName:n,followersCount:i,followingCount:o})=>e(h,{id:"RQKWUa",values:{targetName:n,followersCount:i,followingCount:o},components:{0:e("i",{})}})},Nr={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"}},ci=30;function Pr({notification:n,instance:i,isStatic:o,disableContextMenu:s}){const{_:c}=ae(),{masto:a}=se(),{id:p,status:d,account:l,report:r,event:u,moderation_warning:m,annualReport:f,_ids:v,_accounts:y,_statuses:S,_groupKeys:k,sampleAccounts:b,notificationsCount:g,groupKey:_,_notificationsCount:w,_sampleAccountsCount:A}=n;let{type:C}=n;if((C==="mention"||C==="quote")&&!d)return null;const T=d?.reblog||d,L=T?.id,M=vt(),H=M===l?.id,F=d?.poll?.voted,U=!!d?.inReplyToAccountId&&d?.inReplyToAccountId!==M&&d?.account?.id===M;let W=0,Q=0;if(C==="favourite+reblog"){if(y)for(const ee of y)ee._types?.includes("favourite")&&W++,ee._types?.includes("reblog")&&Q++;!Q&&W&&(C="favourite"),!W&&Q&&(C="reblog")}let V;C==="poll"?V=oi[H?"poll-self":F?"poll-voted":"poll"]:oi[C]?V=oi[C]:V=ue._({id:"ODqZt1",values:{type:C}});const j=({clickable:ee,...he})=>ee?e("b",{tabIndex:"0",onClick:Y,...he}):e("b",{...he}),K=g>0&&g>b?.length,pe=K?"remote":"local";if(typeof V=="function"){const ee=(C==="favourite"||C==="reblog")&&g?K?g:b?.length:y?.length||b?.length||(l?1:0),he=S?.length||(d?1:0);if(C==="admin.report"){const re=r?.targetAccount;re&&(V=V({account:e(mt,{account:l,showAvatar:!0}),targetAccount:e(mt,{account:re,showAvatar:!0})}))}else if(C==="severed_relationships"){const re=u?.targetName;re&&(V=V({name:re}))}else if((C==="emoji_reaction"||C==="pleroma:emoji_reaction")&&n.emoji){const re=n.emoji_url||d?.emojis?.find?.(J=>J?.shortcode===n.emoji.replace(/^:/,"").replace(/:$/,""));V=V({account:e(mt,{account:l,showAvatar:!0}),emoji:n.emoji,emojiURL:re})}else C==="annual_report"?V=V({...n.annualReport}):V=V({account:l?e(mt,{account:l,showAvatar:!0}):b?.[0]&&e(mt,{account:b[0],showAvatar:!0}),count:ee,postsCount:he,postType:U?"reply":"post",components:{Subject:j}})}const $=n.createdAt&&new Date(n.createdAt).toLocaleString(),ie={"favourite+reblog":ue._({id:"+XOeb+"}),favourite:ue._({id:"LQFF6J"}),reblog:ue._({id:"phQpSa"}),follow:ue._({id:"Ih01jh"})}[C]||ue._({id:"bPwFdf"}),Y=()=>{E.showGenericAccounts={heading:ie,accounts:y,showReactions:C==="favourite+reblog",excludeRelationshipAttrs:C==="follow"?["followedBy"]:[],postID:at(L,i)}};if(d?.filtered){const ee=d?.account?.id===M,he=Zt(d.filtered,"notifications");if(!H&&!ee&&he?.action==="hide")return null}return e("div",{class:`notification notification-${C}`,"data-notification-id":v||p,"data-group-key":k?.join(" ")||_,tabIndex:"0",children:[e("div",{class:`notification-type notification-${C}`,title:$,children:C==="favourite+reblog"?e(D,{children:[e(I,{icon:"rocket",size:"xl",alt:C,class:"reblog-icon"}),e(I,{icon:"heart",size:"xl",alt:C,class:"favourite-icon"})]}):e(I,{icon:ds[C]||"notification",size:"xl",alt:C})}),e("div",{class:"notification-content",children:[C!=="mention"&&C!=="quote"&&e(D,{children:[e("p",{children:V}),C==="follow_request"&&e(pi,{accountID:l.id}),C==="severed_relationships"&&e("div",{children:[$r[u.type]({from:i,...u}),e("br",{}),e("a",{href:`https://${i}/severed_relationships`,target:"_blank",rel:"noopener",children:e(h,{id:"YL6Y8P",components:{0:e(I,{icon:"external",size:"s"})}})}),"."]}),C==="moderation_warning"&&!!m&&e("div",{children:[c(Nr[m.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${m.id}`,target:"_blank",rel:"noopener",children:e(h,{id:"YL6Y8P",components:{0:e(I,{icon:"external",size:"s"})}})})]}),C==="annual_report"&&e("div",{children:e(fe,{to:`/annual_report/${f?.year}`,children:e(h,{id:"5PGPvG"})})})]}),y?.length>1&&e("p",{class:"avatars-stack",children:[y.slice(0,ci).map(ee=>e(D,{children:[e("a",{href:ee.url,rel:"noopener",class:"account-avatar-stack",onClick:he=>{he.preventDefault(),E.showAccount=ee},children:[e(pt,{url:ee.avatarStatic,size:y.length<=10?"xxl":y.length<20?"xl":"l",alt:`${ee.displayName} @${ee.acct}`,squircle:ee?.bot},ee.id),C==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:ee._types.map(he=>e(I,{icon:ds[he],size:"s",class:`${he}-icon`}))})]},ee.id)," "]},ee.id)),(C==="favourite+reblog"||C==="favourite"||C==="reblog")&&pe==="remote"?e("button",{type:"button",class:"small plain","data-group-keys":k?.join(" "),onClick:()=>{E.showGenericAccounts={heading:ie,accounts:y,fetchAccounts:async()=>{const ee=await Promise.allSettled(k.map(async re=>{const J=a.v2.notifications.$select(re).accounts.list().values();return[re,(await J.next()).value]})),he=[];for(const re of ee){const[J,Ce]=re.value,ve=/^favourite/.test(J)?"favourite":/^reblog/.test(J)?"reblog":null;if(ve)for(const ye of Ce){const Ne=he.find(Se=>Se.id===ye.id);Ne?Ne._types.push(ve):(ye._types=[ve],he.push(ye))}}return{done:!0,value:he}},showReactions:C==="favourite+reblog",postID:at(L,i)}},children:["+",(C==="favourite"||C==="reblog")&&g-y.length,e(I,{icon:"chevron-down"})]}):e("button",{type:"button",class:"small plain",onClick:Y,children:[y.length>ci&&`+${y.length-ci}`,e(I,{icon:"chevron-down"})]})]}),!y?.length&&b?.length>1&&e("p",{class:"avatars-stack",children:[b.map(ee=>e(D,{children:[e("a",{href:ee.url,rel:"noopener",class:"account-avatar-stack",onClick:he=>{he.preventDefault(),E.showAccount=ee},children:e(pt,{url:ee.avatarStatic,size:"xxl",alt:`${ee.displayName} @${ee.acct}`,squircle:ee?.bot},ee.id)},ee.id)," "]},ee.id)),g>b.length&&e(fe,{to:i?`/${i}/s/${d.id}`:`/s/${d.id}`,class:"button small plain centered",children:["+",g-b.length,e(I,{icon:"chevron-right"})]})]}),S?.length>1&&e("ul",{class:"notification-group-statuses",children:S.map(ee=>e("li",{children:e(hs,{class:`status-link status-type-${C}`,to:i?`/${i}/s/${ee.id}`:`/s/${ee.id}`,children:e(je,{status:ee,size:"s",previewMode:!0,allowContextMenu:!0,allowFilters:!0})})},ee.id))}),d&&(!S?.length||S?.length<=1)&&e(hs,{class:`status-link status-type-${C}`,to:i?`/${i}/s/${L}`:`/s/${L}`,onContextMenu:s?void 0:ee=>{const he=ee.target.querySelector(".status");if(he){if(ee.metaKey)return;ee.preventDefault(),he.dispatchEvent(new MouseEvent("contextmenu",{clientX:ee.clientX,clientY:ee.clientY}))}},children:o?e(je,{status:T,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0}):e(je,{statusID:L,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0})})]})]})}function hs(n){const i=hc();return e(fe,{...n,"data-read-more":ue._({id:"8fZueG"}),ref:i})}const un=lt(Pr,(n,i)=>n.notification?.id===i.notification?.id);"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",n=>{const{type:i,id:o,accessToken:s}=n?.data||{};i==="notification"&&(E.routeNotification={id:o,accessToken:s})});const Dr=lt(function(){const{_:i}=ae();if(!("serviceWorker"in navigator))return null;const o=Ge(E),{routeNotification:s}=o,{id:c,accessToken:a}=s||{},[p,d]=R(!1);St(()=>{if(!c||!a)return;const{instance:r}=se(),{masto:u,instance:m}=se({accessToken:a}),f=r===m,v=a?Uo(a):ki();(async()=>{const y=await u.v1.notifications.$select(c).fetch();if(y&&v){const S=v.instanceURL,{type:k,status:b,account:g}=y,_=!!document.querySelector("#modal-container > *"),w=k==="follow"&&!!g?.id,A=!!g?.id,C=!!b?.id;w&&f?E.showAccount={account:g,instance:S}:_||!f||A&&C?d({id:c,account:v,notification:y,sameInstance:f}):C?location.hash=`/${r}/s/${b.id}`:w?location.hash=`/${r}/a/${g.id}`:location.hash="/notifications"}})()},[c,a]),St(()=>{navigator?.clearAppBadge&&navigator.clearAppBadge()},[]),Xt(r=>{r&&navigator?.clearAppBadge&&navigator.clearAppBadge()});const l=()=>{d(!1),E.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(p){const{id:r,account:u,notification:m,sameInstance:f}=p;return e(qe,{onClick:v=>{v.target===v.currentTarget&&l()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:l,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(h,{id:"5+87Pq"})})}),e("main",{children:[!f&&e("p",{children:e(h,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:v=>{const{target:y}=v;(v.target.tagName==="BUTTON"||v.target.tagName==="A")&&l()},children:e(un,{instance:u.instanceURL,notification:m,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(fe,{to:"/notifications",class:"button light",onClick:l,children:[e("span",{children:e(h,{id:"/WA/tl"})})," ",e(I,{icon:"arrow-right"})]})})]})]})})}return null}),Zn=({limit:n}={})=>{const i=Te.account.get("searchHistory")||[];return n?i.slice(0,n):i},Or=10,Tn=(n,i=null)=>{if(!n?.trim?.())return;const o=Zn(),s=o.findIndex(a=>a.query===n&&a.queryType===i);s!==-1&&o.splice(s,1),o.unshift({query:n.trim(),queryType:i,timestamp:Date.now()});const c=o.slice(0,Or);Te.account.set("searchHistory",c)},zr=(n,i=null)=>{const s=Zn().filter(c=>!(c.query===n&&c.queryType===i));Te.account.set("searchHistory",s)},Fr=()=>{Te.account.set("searchHistory",[])},zt=(n,i,o)=>{let s,c,a;return i==="statuses"?(s=e(h,{id:"o1mMWT",values:{query:n},components:{0:e("q",{})}}),c=`/search?q=${encodeURIComponent(n)}&type=statuses`,a="document"):i==="accounts"?(s=e(h,{id:"cDoNQr",values:{query:n},components:{0:e("q",{})}}),c=`/search?q=${encodeURIComponent(n)}&type=accounts`,a="group"):i==="hashtags"?(s=e(h,{id:"YAZw8D",values:{0:n.replace(/^#/,"")},components:{0:e("mark",{})}}),c=`/${o}/t/${n.replace(/^#/,"")}`,a="hashtag"):(s=e(h,{id:"48oDit",values:{query:n},components:{0:e("small",{class:"insignificant"})}}),c=`/search?q=${encodeURIComponent(n)}`,a="search"),{label:s,to:c,icon:a}},ho=Ko((n,i)=>{const{_:o}=ae(),{instance:s}=se(),[c,a]=bt(),[p,d]=R(!1),[l,r]=R(c.get("q")||""),u=c.get("type"),m=q(null),f=q(null);Ho(i,()=>({setValue:S=>{r(S)},focus:()=>{f.current.focus()},select:()=>{f.current.select()},blur:()=>{f.current.blur()}}));const v=ke(()=>Zn({limit:5}),[n?.hidden]),y=ke(()=>{if(!l)return[];const k=v.filter(g=>g.query===l?!1:g.query.toLowerCase().includes(l.toLowerCase())).slice(0,2).map(g=>({...zt(g.query,g.queryType,s),queryType:g.queryType,isRecentSearch:!0,historyItem:g}));return[{...zt(l,null,s),top:!u&&!/\s/.test(l),hidden:!!u},...k,{...zt(l,"statuses",s),hidden:/^https?:/.test(l),top:/\s/.test(l),queryType:"statuses"},{...zt(l,"hashtags",s),hidden:/^@/.test(l)||/^https?:/.test(l)||/\s/.test(l),top:/^#/.test(l),type:"link",queryType:"hashtags"},{label:e(h,{id:"gEoOUj",values:{query:l},components:{0:e("mark",{})}}),to:`/${l}`,hidden:!/^https?:/.test(l),top:/^https?:/.test(l),type:"link",icon:"arrow-right"},{...zt(l,"accounts",s),queryType:"accounts"}].sort((g,_)=>{if(u){if(g.queryType===u)return-1;if(_.queryType===u)return 1}return g.top&&!_.top?-1:!g.top&&_.top?1:0}).filter(({hidden:g})=>!g)},[l,u,s]);return e("form",{ref:m,class:"search-popover-container",onSubmit:S=>{if(S.preventDefault(),/\/search/.test(location.hash))if(l){const b={q:l};u&&(b.type=u),a(b)}else a({});else l?location.hash=`/search?q=${encodeURIComponent(l)}${u?`&type=${u}`:""}`:location.hash="/search";Tn(l,u),n?.onSubmit?.(S)},children:[e("input",{ref:f,value:l,name:"q",type:"search",placeholder:o({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:S=>{S.target.value||a({})},onInput:S=>{r(S.target.value),d(!0)},onFocus:()=>{d(!0);const S=m.current?.querySelector(".search-popover-item");S&&S.classList.add("focus")},onBlur:()=>{setTimeout(()=>{d(!1)},100),m.current?.querySelector(".search-popover-item.focus")?.classList.remove("focus")},onKeyDown:S=>{const{key:k}=S;switch(k){case"Escape":d(!1);break;case"Down":case"ArrowDown":if(S.preventDefault(),p){const b=m.current.querySelector(".search-popover-item.focus");if(b){let g=b.nextElementSibling;for(;g&&g.hidden;)g=g.nextElementSibling;g&&(g.classList.add("focus"),Array.from(g.parentElement.children).filter(w=>w!==g).forEach(w=>{w.classList.remove("focus")}))}else{const g=m.current.querySelector(".search-popover-item");g&&g.classList.add("focus")}}break;case"Up":case"ArrowUp":if(S.preventDefault(),p){const b=document.querySelector(".search-popover-item.focus");if(b){let g=b.previousElementSibling;for(;g&&g.hidden;)g=g.previousElementSibling;g&&(g.classList.add("focus"),Array.from(g.parentElement.children).filter(w=>w!==g).forEach(w=>{w.classList.remove("focus")}))}else{const g=document.querySelectorAll(".search-popover-item"),_=g[g.length-1];_&&_.classList.add("focus")}}break;case"Enter":if(p){const b=document.querySelector(".search-popover-item.focus");b&&(S.preventDefault(),b.click()),d(!1),n?.onSubmit?.(S)}break}}}),e("div",{class:"search-popover",hidden:!p,children:[!l&&v.length>0&&e("div",{class:"search-popover-recent-searches",children:[e("div",{class:"search-popover-header",children:[e(I,{icon:"history",size:"s"}),e(h,{id:"4R1B1H"})]}),v.map((S,k)=>{const{label:b,to:g,icon:_}=zt(S.query,S.queryType,s);return e(fe,{to:g,class:`search-popover-item ${k===0?"focus":""}`,onClick:w=>{Tn(S.query,S.queryType),n?.onSubmit?.(w)},children:[e(I,{icon:_,class:"more-insignificant"}),e("span",{children:b})]},`${S.query}-${S.queryType}-${S.timestamp}`)}),e(fe,{to:"/search",class:"search-popover-item search-history-see-all",children:[e(I,{icon:"more2",class:"more-insignificant"}),e("span",{children:e(h,{id:"gukqfD"})})]})]}),y.map(({label:S,to:k,icon:b,queryType:g,isRecentSearch:_,historyItem:w},A)=>e(fe,{to:k,class:`search-popover-item ${_?"search-popover-item-recent":""} ${A===0?"focus":""}`,onClick:C=>{_||Tn(l,g),n?.onSubmit?.(C)},children:[e(I,{icon:b,class:"more-insignificant"}),e("span",{children:S})]},_?`recent-${w.query}-${w.queryType}-${w.timestamp}`:`suggestion-${g||"general"}-${A}`))]})]})}),Br=lt(function({onClose:i=()=>{}}){const[o,s]=R(!1),c=q(null);Ue(["Slash","/"],d=>{s(!0),setTimeout(()=>{c.current?.focus?.(),c.current?.select?.()},0)},{useKey:!0,preventDefault:!0,ignoreEventWhen:d=>{const l=/\/search/.test(location.hash),r=!!document.querySelector("#modal-container > *");return l||r||d.metaKey||d.ctrlKey||d.altKey||d.shiftKey}});const a=()=>{s(!1),i()};Ue("esc",d=>{c.current?.blur?.(),a()},{enabled:o,enableOnFormTags:!0,preventDefault:!0,useKey:!0,ignoreEventWhen:d=>d.metaKey||d.ctrlKey||d.altKey||d.shiftKey});const p=!o;return e("div",{id:"search-command-container",hidden:p,onClick:d=>{d.target===d.currentTarget&&a()},children:e(ho,{ref:c,hidden:p,onSubmit:()=>{a()}})})});function qr(){const{_:n,_:i}=ae(),{instance:o}=se(),s=Ge(E),{shortcuts:c,settings:a}=s;if(!c.length)return null;const p=a.shortcutsViewMode==="multi-column"||!a.shortcutsViewMode&&a.shortcutsColumnsMode,d=q(),l=q(),r=q(!1),u=c.map((y,S)=>{const{type:k,...b}=y;if(!Fn[k])return null;let{id:g,path:_,title:w,subtitle:A,icon:C}=Fn[k];return typeof g=="function"&&(g=g(b,S)),typeof _=="function"&&(_=_({...b,instance:b.instance||o},S)),typeof w=="function"?w=w(b,S):w?.id&&(w=i(w)),typeof A=="function"?A=A(b,S):A?.id&&(A=i(A)),typeof C=="function"&&(C=C(b,S)),g==="lists"&&(r.current=!0),{id:g,path:_,title:w,subtitle:A,icon:C}}).filter(Boolean);G(()=>{if(s.settings.shortcutsViewMode==="tab-menu-bar"&&l.current){const y=setTimeout(()=>{const S=l.current?.querySelector(".is-active");S&&S.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},100);return()=>clearTimeout(y)}},[]);const m=$s();Ue(["1","2","3","4","5","6","7","8","9"],y=>{const S=parseInt(y.key,10)-1;if(S<u.length){const{path:k}=u[S];k&&(m(k),d.current?.closeMenu?.())}},{enabled:!p,useKey:!0,ignoreEventWhen:y=>y.metaKey||y.ctrlKey||y.altKey||y.shiftKey});const[f,v]=R([]);return p?null:e("div",{id:"shortcuts",children:s.settings.shortcutsViewMode==="tab-menu-bar"?e("nav",{ref:l,class:"tab-bar",onContextMenu:y=>{y.preventDefault(),E.showShortcutsSettings=!0},children:e("ul",{children:u.map(({id:y,path:S,title:k,subtitle:b,icon:g},_)=>e("li",{children:e(fe,{class:b?"has-subtitle":"",to:S,onClick:w=>{if(w.target.classList.contains("is-active")){w.preventDefault();const A=document.getElementById(`${y}-page`);if(A){A.scrollTop=0;const C=A.querySelector(".updates-button");C&&C.click()}}},children:[e(I,{icon:g,size:"xl"}),e("span",{children:[e(In,{children:k}),b&&e(D,{children:[e("br",{}),e("small",{children:b})]})]})]})},`${_}-${y}-${k}-${b}-${S}`))})}):e(rt,{instanceRef:d,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:y=>{y.open&&r.current&&pn().then(v)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:y=>{y.preventDefault(),E.showShortcutsSettings=!0},onTransitionStart:y=>{try{const{target:S}=y;getComputedStyle(S).pointerEvents==="none"&&d.current?.closeMenu?.()}catch{}},children:e(I,{icon:"shortcut",size:"xl",alt:n({id:"CTqTgr"})})}),children:u.map(({id:y,path:S,title:k,subtitle:b,icon:g},_)=>y==="lists"?e(hn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(D,{children:[e(I,{icon:g,size:"l"}),e("span",{class:"menu-grow",children:e(In,{children:k})}),e(I,{icon:"chevron-right"})]}),children:[e(Ke,{to:"/l",children:e("span",{children:e(h,{id:"BHWx+g"})})}),e(He,{}),f?.map(w=>e(Ke,{to:`/l/${w.id}`,children:e("span",{children:[w.title,w.exclusive&&e(D,{children:[" ",e(Kt,{})]})]})},w.id))]}):e(Ke,{to:S,class:"glass-menu-item",children:[e(I,{icon:g,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(In,{children:k})}),b&&e(D,{children:[" ",e("small",{class:"more-insignificant",children:b})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:_+1})]},`${_}-${y}-${k}-${b}-${S}`))})})}const Ur=lt(qr);function Kr(n){let i=[],o=[],s=0;for(let c=0;c<n.length;c++){const a=n[c];a.reblog&&!a.account?.group?(o.push(a),s++):(i.push(a),s<3&&(s=0))}if(n.length>10&&(o.length>n.length/4||s>=3)){const c=o.map(a=>a.id);if(o.length>n.length*3/4)i=[...i,{id:c,items:o,type:"boosts"}];else{const a=Math.floor(i.length/2);i=[...i.slice(0,a),{id:c,items:o,type:"boosts"},...i.slice(a)]}return i}else return n}function ps(n,i){const o=Te.account.get("boostedStatusIDs")||{},s=n.filter(a=>{if(!a.reblog)return!0;const p=`${i}-${a.reblog.id}`,d=o[p];return d&&d!==a.id?!1:(o[p]=a.id,!0)}),c=Object.keys(o);return c.length>50&&c.slice(0,c.length-50).forEach(a=>{delete o[a]}),Te.account.set("boostedStatusIDs",o),s}function Hr(n,i){const o=[];let s=0;n.forEach(d=>{for(let r=0;r<o.length;r++){if(o[r].find(u=>u.id===d.id))return;if(o[r].find(u=>u.id===d.inReplyToId)||o[r].find(u=>u.inReplyToId===d.id)){o[r].push(d);return}}const l=n.find(r=>r.id===d.inReplyToId);l&&(o[s++]=[d,l])});for(let d=0;d<o.length;d++)for(let l=d+1;l<o.length;l++)o[d].find(u=>o[l].includes(u))&&(o[d]=[...o[d],...o[l]],o[d]=o[d].filter((u,m,f)=>f.findIndex(v=>v.id===u.id)===m),o.splice(l,1),l--);o.forEach(d=>{d.sort((l,r)=>!l.inReplyToId&&!r.inReplyToId?Date.parse(l.createdAt)-Date.parse(r.createdAt):l.inReplyToId===r.id?1:r.inReplyToId===l.id||!l.inReplyToId?-1:r.inReplyToId?Date.parse(l.createdAt)-Date.parse(r.createdAt):1)}),o.forEach(d=>{const l=d[0].account.id;d.forEach(r=>{r.account.id!==l&&(r._differentAuthor=!0)})}),o.length;const c=[],a=[],p=[];return n.forEach(d=>{if(d.reblog){c.push(d);return}for(let l=0;l<o.length;l++)if(o[l].find(r=>r.id===d.id)){if(a.includes(l))return;const r=o[l];r.sort((m,f)=>Date.parse(m.createdAt)-Date.parse(f.createdAt));const u=r[0].account.id;c.push({id:r.map(m=>m.id),items:r,type:r.every(m=>m.account.id===u)?"thread":"conversation"}),a.push(l);return}if(d.inReplyToId&&d.inReplyToAccountId!==d.account.id){const l=at(d.id,i);E.statusReply[l]||p.push({sKey:l,inReplyToId:d.inReplyToId})}c.push(d)}),p?.length&&queueMicrotask(()=>{const{masto:d}=se({instance:i});async function l(){for(let r=0;r<p.length;r++){const{sKey:u,inReplyToId:m}=p[r];try{const f=await jr(m,d);Je(f,i,{skipThreading:!0}),E.statusReply[u]={id:f.id,instance:i},await new Promise(v=>setTimeout(v,1e3))}catch{}}}if(Xe("@mastodon/fetch-multiple-statuses")){const r=p.map(({inReplyToId:u})=>u);(async()=>{try{const u=await d.v1.statuses.list({id:r});if(u?.length)for(const m of u){Je(m,i,{skipThreading:!0});const f=p.find(({inReplyToId:v})=>v===m.id)?.sKey;f&&(E.statusReply[f]={id:m.id,instance:i})}else l()}catch{l()}})()}else l()}),c}const jr=yt((n,i)=>i.v1.statuses.$select(n).fetch());async function po(n,i){const o=await Ir();if(!o.length)return;const{statusFollowedTags:s}=E,c=[];if(n.forEach(a=>{if(a.reblog)return;const{id:p,content:d,tags:l=[]}=a,r=at(p,i);if(s[r]?.length)return;const u=Ar(d);if(!u.length&&!l.length)return;const m=o.reduce((f,v)=>((u.some(y=>y.toLowerCase()===v.name.toLowerCase())||l.some(y=>y.name.toLowerCase()===v.name.toLowerCase()))&&f.push(v.name),f),[]);m.length&&c.push({item:a,sKey:r,followedTags:m})}),c.length){const a=c.map(d=>d.item.account),p=await Kn(a);if(!p)return;c.forEach(d=>{const{item:l,sKey:r,followedTags:u}=d,m=p[l.account.id];m&&!m.following&&(s[r]=u)})}}function Yr(){E.statusFollowedTags={}}function Vr({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:o=1,scrollThresholdStart:s=10,scrollThresholdEnd:c=10,direction:a="vertical",distanceFromStartPx:p,distanceFromEndPx:d}={}){const[l,r]=R(null),[u,m]=R(!1),[f,v]=R(!1),[y,S]=R(!1),[k,b]=R(!1),g=a==="vertical";return St(()=>{const _=n.current;if(!_)return{};let w=g?_.scrollTop:_.scrollLeft;function A(){const{scrollTop:C,scrollLeft:T,scrollHeight:L,scrollWidth:M,clientHeight:H,clientWidth:F}=_,U=g?C:T,W=g?L:M,Q=g?H:F,V=Math.abs(U-w),j=p||Math.min(Q*i,W,U),K=d||Math.min(Q*o,W,W-U-Q);V>=(w<U?c:s)&&(r(w<U?"end":"start"),w=U),m(U<=0),v(U+Q>=W),S(U<=j),b(U+Q>=W-K)}return _.addEventListener("scroll",A,{passive:!0}),()=>_.removeEventListener("scroll",A)},[i,o,s,c]),{scrollDirection:l,reachStart:u,reachEnd:f,nearReachStart:y,nearReachEnd:k,init:()=>{n.current&&n.current.dispatchEvent(new Event("scroll"))}}}function Gr({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:o=1,scrollThresholdStart:s=10,scrollThresholdEnd:c=10,direction:a="vertical",distanceFromStartPx:p,distanceFromEndPx:d,init:l}={},r){if(!r)return;const u=a==="vertical",m=q(null),f=q(null),v=pc(()=>{let y=!1,S=!1,k=!1,b=!1;const g=n.current,{scrollTop:_,scrollLeft:w,scrollHeight:A,scrollWidth:C,clientHeight:T,clientWidth:L}=g,M=u?_:w,H=u?A:C,F=u?T:L,U=M-m.current,W=U>0,Q=W?c:s,V=p||Math.min(F*i,H,M),j=d||Math.min(F*o,H,H-M-F);Math.abs(U)>=Q&&(f.current=W?"end":"start",m.current=M),y=M<=0,S=M+F>=H,k=M<=V,b=M+F>=H-j,r({scrollDirection:f.current,reachStart:y,reachEnd:S,nearReachStart:k,nearReachEnd:b})},500,{leading:!1});return St(()=>{const y=n.current;return y&&(m.current=y[u?"scrollTop":"scrollLeft"],y.addEventListener("scroll",v,{passive:!0})),()=>{y&&y.removeEventListener("scroll",v)}},[]),G(()=>{l&&n.current&&queueMicrotask(()=>{n.current.dispatchEvent(new Event("scroll"))})},[l]),{resetScrollDirection:()=>{f.current=null}}}function Wr({class:n,statusID:i,status:o,instance:s,parent:c,onMediaClick:a}){const{_:p}=ae();let d=at(i,s);const l=Ge(E);if(o||(o=l.statuses[d]||l.statuses[i],d=at(o?.id,s)),!o)return null;const{account:{acct:r,avatar:u,avatarStatic:m,id:f,url:v,displayName:y,username:S,emojis:k,bot:b,group:g},id:_,repliesCount:w,reblogged:A,reblogsCount:C,favourited:T,favouritesCount:L,bookmarked:M,poll:H,muted:F,sensitive:U,spoilerText:W,visibility:Q,language:V,editedAt:j,filtered:K,card:pe,createdAt:$,inReplyToId:ie,inReplyToAccountId:Y,content:ee,mentions:he,mediaAttachments:re,reblog:J,uri:Ce,url:ve,emojis:ye,_deleted:Ne,_pinned:Se}=o;if(!re?.length)return null;const Ae=Ie=>{Ie.shiftKey},xe=ke(()=>vt(),[]),Pe=ke(()=>xe&&xe===f,[f,xe]),ze=jo(Hn),Fe=!Pe&&Zt(K,ze);if(Fe?.action==="hide")return null;const Ye=U,Re=(yi()["reading:expand:media"]?.toLowerCase()||"default")==="show_all",z=c||"div";return re.map((Ie,Me)=>{const Ee=`${d}-${Ie.id}`,P=Fe?.titlesStr;return e(z,{"data-state-post-id":d,onMouseEnter:Ae,"data-spoiler-text":W||(U?p({id:"FKojeB"}):void 0),"data-filtered-text":Fe?p(P?{id:"7FGvtQ",values:{filterTitleStr:P}}:{id:"03Qqf9"}):void 0,class:`
media-post
${Fe?"filtered":""}
${Ye?"has-spoiler":""}
${Re?"show-media":""}
`,children:e(Ks,{class:n,media:Ie,lang:V,to:`/${s}/s/${_}?media-only=${Me+1}`,onClick:a?be=>a(be,Me,Ie,o):void 0})},Ee)})}const fs=lt(Wr);function Zr(n){const{_:i}=ae(),o=Ge(E),{masto:s,instance:c,authenticated:a}=se(),[p,d]=ke(()=>{const _=vi();return[_.find(A=>A.info.id===vt())||_[0],_.length>1]},[]),l=(o.settings.shortcutsViewMode==="multi-column"||!o.settings.shortcutsViewMode&&o.settings.shortcutsColumnsMode)&&!o.shortcuts.find(_=>_.type==="following"),r=Ds(()=>{E.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),u=q(),[m,f]=R(void 0),v=zs([0,0,o.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),y=q();async function S(_){return(_||!y.current)&&(y.current=s.v1.mutes.list({limit:80}).values()),await y.current.next()}const k=q();async function b(_){return(_||!k.current)&&(k.current=s.v1.blocks.list({limit:80}).values()),await k.current.next()}const g=q();return e(D,{children:[e("button",{ref:u,type:"button",class:`button plain nav-menu-button ${d?"with-avatar":""} ${m==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{g.current=Date.now(),f(_=>_?void 0:"open")},onContextMenu:_=>{_.preventDefault(),E.showAccounts=!0},...r(),children:[d&&e(pt,{url:p?.info?.avatar||p?.info?.avatarStatic,size:"l",squircle:p?.info?.bot}),e(I,{icon:"menu",size:d?"s":"l",alt:i({id:"zucql+"})})]}),e(Ai,{menuClassName:"nav-menu",state:m,anchorRef:u,onClose:()=>{f(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-g.current<300}},portal:{target:document.body},...n,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:v,unmountOnClose:!0,children:[!!o.appVersion?.commitHash&&o.appVersion.commitHash!=="1897f38"&&e("div",{class:"top-menu",children:[e(ge,{onClick:()=>{confirm(i({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(I,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(h,{id:"95IFnD"})})]}),e(He,{})]}),e("section",{children:[e(Ke,{to:"/",children:[e(I,{icon:"home",size:"l"})," ",e("span",{children:e(h,{id:"i0qMbr"})})]}),a?e(D,{children:[l&&e(Ke,{to:"/following",children:[e(I,{icon:"following",size:"l"})," ",e("span",{children:e(h,{id:"following.title"})})]}),e(Ke,{to:"/catchup",children:[e(I,{icon:"history2",size:"l"}),e("span",{children:e(h,{id:"xrl8fj"})})]}),Xe("@mastodon/mentions")&&e(Ke,{to:"/mentions",children:[e(I,{icon:"at",size:"l"})," ",e("span",{children:e(h,{id:"/bZzdR"})})]}),e(Ke,{to:"/notifications",children:[e(I,{icon:"notification",size:"l"})," ",e("span",{children:e(h,{id:"iDNBZe"})}),o.notificationsShowNew&&e("sup",{title:i({id:"isRobC"}),style:{opacity:.5},children:[" ","•"]})]}),e(He,{}),p?.info?.id&&e(Ke,{to:`/${c}/a/${p.info.id}`,children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(h,{id:"vERlcd"})})]}),e(Xr,{menuState:m}),e(Ke,{to:"/b",children:[e(I,{icon:"bookmark",size:"l"})," ",e("span",{children:e(h,{id:"7Ff7ia"})})]}),e(hn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(D,{children:[e(I,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(h,{id:"24misb"})}),e(I,{icon:"chevron-right"})]}),children:[e(Ke,{to:"/f",children:[e(I,{icon:"heart",size:"l"})," ",e("span",{children:e(h,{id:"zZOZj7"})})]}),e(Ke,{to:"/fh",children:[e(I,{icon:"hashtag",size:"l"})," ",e("span",{children:e(h,{id:"Xi1/bw"})})]}),e(Ke,{to:"/sp",children:[e(I,{icon:"schedule",size:"l"})," ",e("span",{children:e(h,{id:"+GkIdc"})})]}),e(He,{}),Xe("@mastodon/filters")&&e(Ke,{to:"/ft",children:[e(I,{icon:"filters",size:"l"})," ",e("span",{children:e(h,{id:"cSev+j"})})]}),e(ge,{onClick:()=>{E.showGenericAccounts={id:"mute",heading:i({id:"sOKhEA"}),fetchAccounts:S,excludeRelationshipAttrs:["muting"]}},children:[e(I,{icon:"mute",size:"l"})," ",e("span",{children:e(h,{id:"n1sANU"})})]}),e(ge,{onClick:()=>{E.showGenericAccounts={id:"block",heading:i({id:"nL8nlr"}),fetchAccounts:b,excludeRelationshipAttrs:["blocking"]}},children:[e(I,{icon:"block",size:"l"})," ",e("span",{children:e(h,{id:"r3RRWo"})})]})," "]}),e(He,{}),e(ge,{onClick:()=>{E.showAccounts=!0},children:[e(I,{icon:"group",size:"l"})," ",e("span",{children:e(h,{id:"7e0O8Z"})})]})]}):e(D,{children:[e(He,{}),e(Ke,{to:"/login",children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(h,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(He,{}),e(Ke,{to:"/search",children:[e(I,{icon:"search",size:"l"})," ",e("span",{children:e(h,{id:"A1taO8"})})]}),e(Ke,{to:`/${c}/trending`,children:[e(I,{icon:"chart",size:"l"})," ",e("span",{children:e(h,{id:"4/iCqx"})})]}),e(Ke,{to:`/${c}/p/l`,children:[e(I,{icon:"building",size:"l"})," ",e("span",{children:e(h,{id:"d5zxa4"})})]}),e(Ke,{to:`/${c}/p`,children:[e(I,{icon:"earth",size:"l"})," ",e("span",{children:e(h,{id:"4ERYY7"})})]}),a?e(D,{children:[e(He,{className:"divider-grow"}),e(ge,{onClick:()=>{E.showKeyboardShortcutsHelp=!0},children:[e(I,{icon:"keyboard",size:"l"})," ",e("span",{children:e(h,{id:"77Emn0"})})]}),e(ge,{onClick:()=>{E.showShortcutsSettings=!0},children:[e(I,{icon:"shortcut",size:"l"})," ",e("span",{children:e(h,{id:"8Kudkr"})})]}),e(ge,{onClick:()=>{E.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(h,{id:"uVbUP8"})})]})]}):e(D,{children:[e(He,{}),e(ge,{onClick:()=>{E.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(h,{id:"uVbUP8"})})]})]})]})]})]})}function Xr({menuState:n}){const i=Xe("@mastodon/lists"),[o,s]=R([]);return G(()=>{i&&n==="open"&&pn().then(s)},[n,i]),o.length>0?e(hn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(D,{children:[e(I,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(h,{id:"h16FyT"})}),e(I,{icon:"chevron-right"})]}),children:[e(Ke,{to:"/l",children:e("span",{children:e(h,{id:"BHWx+g"})})}),o?.length>0&&e(D,{children:[e(He,{}),o.map(c=>e(Ke,{to:`/l/${c.id}`,children:e("span",{children:[c.title,c.exclusive&&e(D,{children:[" ",e(Kt,{})]})]})},c.id))]})]}):i&&e(Ke,{to:"/l",children:[e(I,{icon:"list",size:"l"}),e("span",{children:e(h,{id:"h16FyT"})})]})}const Dt=lt(Zr),vn={block:"start",inline:"center",behavior:"smooth"};function Et({title:n,titleComponent:i,id:o,instance:s,emptyText:c,errorText:a,useItemID:p,boostsCarousel:d,fetchItems:l=()=>{},checkForUpdates:r=()=>{},checkForUpdatesInterval:u=15e3,headerStart:m,headerEnd:f,timelineStart:v,refresh:y,view:S,filterContext:k,showFollowedTags:b,showReplyParent:g,clearWhenRefresh:_}){const{_:w}=ae(),A=Ge(E),[C,T]=R([]),[L,M]=R("start"),[H,F]=R(!1),[U,W]=R(!1),[Q,V]=R(!0),j=q();__BENCHMARK.start(`timeline-${o}-load`);const K=ke(()=>Si(),[]),pe=S!=="media",$=q(0),ie=fc(oe=>{W(!1),M("loading"),(async()=>{try{const Le=$.current=Date.now();let{done:Re,value:z}=await l(oe);if(Le!==$.current)return;if(Array.isArray(z)){const[Ie,Me]=z.reduce((Ee,P)=>(P._pinned?Ee[0].push(P):Ee[1].push(P),Ee),[[],[]]);z=Me,pe&&(d&&(z=Kr(z)),z=Hr(z,s)),Ie.length&&(z=Ie.concat(z)),T(oe?z:Ee=>[...Ee,...z]),z.length||(Re=!0),F(!Re)}else F(!1);M("default"),__BENCHMARK.end(`timeline-${o}-load`)}catch{M("error"),oe&&!C.length&&a&&le(a)}finally{ie.cancel()}})()},1e3,{leading:!0}),Y=".timeline-item, .timeline-item-alt",ee=Ue("j, shift+j",(oe,Le)=>{if(oe.shiftKey!==Le.shift)return;const Re=document.activeElement.closest(Y),z=Re?.getBoundingClientRect(),Ie=Array.from(j.current.querySelectorAll(Y)).filter(Me=>!!Me.offsetHeight);if(Re&&z.top<j.current.clientHeight&&z.bottom>0){const Me=Ie.indexOf(Re);let Ee=Ie[Me+1];Le.shift&&(Ee=Ie.find((P,be)=>be>Me&&!P.classList.contains("timeline-item-alt"))),Ee&&(Ee.focus(),Ee.scrollIntoView(vn))}else{const Me=Ie.find(Ee=>{const P=Ee.getBoundingClientRect();return P.top>=44&&P.left>=0});Me&&(Me.focus(),Me.scrollIntoView(vn))}},{useKey:!0,ignoreEventWhen:oe=>oe.metaKey||oe.ctrlKey||oe.altKey}),he=Ue("k, shift+k",(oe,Le)=>{if(oe.shiftKey!==Le.shift)return;const Re=document.activeElement.closest(Y),z=Re?.getBoundingClientRect(),Ie=Array.from(j.current.querySelectorAll(Y)).filter(Me=>!!Me.offsetHeight);if(Re&&z.top<j.current.clientHeight&&z.bottom>0){const Me=Ie.indexOf(Re);let Ee=Ie[Me-1];Le.shift&&(Ee=Ie.findLast((P,be)=>be<Me&&!P.classList.contains("timeline-item-alt"))),Ee&&(Ee.focus(),Ee.scrollIntoView(vn))}else{const Me=Ie.find(Ee=>{const P=Ee.getBoundingClientRect();return P.top>=44&&P.left>=0});Me&&(Me.focus(),Me.scrollIntoView(vn))}},{useKey:!0,ignoreEventWhen:oe=>oe.metaKey||oe.ctrlKey||oe.altKey}),re=Ue(["enter","o"],()=>{const oe=document.activeElement;oe?.matches(Y)&&oe.click()},{useKey:!0,ignoreEventWhen:oe=>oe.metaKey||oe.ctrlKey||oe.altKey||oe.shiftKey}),J=C.length>0&&L!=="loading"&&U,Ce=tt(()=>{J&&ie(!0),j.current?.scrollTo({top:0,behavior:"smooth"})},[ie,J]),ve=Ue(".",Ce,{useKey:!0,ignoreEventWhen:oe=>oe.metaKey||oe.ctrlKey||oe.altKey||oe.shiftKey}),ye=q(),[Ne,Se]=R(!1),Ae=tt(({scrollDirection:oe,nearReachStart:Le,reachStart:Re})=>{if(ye.current){const z=oe==="end"&&!Le;ye.current.hidden=z}Se(Le),Re&&ie(!0)},[Se,ie]),{resetScrollDirection:xe}=Gr({scrollableRef:j,distanceFromEnd:2,scrollThresholdStart:44},Ae);G(()=>{j.current?.scrollTo({top:0}),ie(!0)},[]);const Pe=q(!0);G(()=>{if(Pe.current){Pe.current=!1;return}_&&C?.length&&(ie.cancel?.(),T([])),ie(!0)},[_,y]);const ze=q(S);G(()=>{ze.current!==S&&(ze.current=S,T([]))},[S]);const Fe=tt(async({disableIdleCheck:oe=!1}={})=>{const Le=j.current?getComputedStyle(j.current).pointerEvents==="none":!1;A.settings.autoRefresh&&j.current.scrollTop<16&&(oe||window.__IDLE__)&&!tl()&&!Le?ie(!0):await r()&&W(!0)},[o,ie,r,A.settings.autoRefresh]),Ye=q();return Xt(oe=>{if(oe){const Le=Date.now()-Ye.current;(!Ye.current||Le>1e3*3)&&Fe({disableIdleCheck:!0})}else Ye.current=Date.now();V(oe)},[r,Fe,A.settings.autoRefresh]),Ii(Fe,Q&&!U?u*(Ne?1:2):null),e(Hn.Provider,{value:k,children:e("div",{id:`${o}-page`,class:`deck-container ${K?"deck-container-media-first":""}`,ref:oe=>{j.current=oe,ee.current=oe,he.current=oe,re.current=oe,ve.current=oe},tabIndex:"-1",onClick:oe=>{ye.current&&oe.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{ye.current.hidden=!1,xe()},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:ye,onClick:oe=>{oe.target.closest("a, button")||j.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:oe=>{oe.target.closest("a, button")||ie(!0)},class:L==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Dt,{}),m??e(fe,{to:"/",class:"button plain home-button",children:e(I,{icon:"home",size:"l",alt:w({id:"i0qMbr"})})})]}),n&&(i||e("h1",{children:n})),e("div",{class:"header-side",children:!!f&&f})]}),J&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:Ce,children:[e(I,{icon:"arrow-up"})," ",e(h,{id:"2yr1/p"})]})]}),!!v&&e("div",{class:`timeline-start ${L==="loading"?"loading":""}`,children:v}),C.length?e(D,{children:[e("ul",{class:`timeline ${S?`timeline-${S}`:""}`,children:[C.map(oe=>e(Jr,{status:oe,instance:s,useItemID:p,filterContext:k,view:S,showFollowedTags:b,showReplyParent:g,mediaFirst:K},oe.id+oe?._pinned+S)),H&&L==="loading"&&(S==="media"?null:e(D,{children:[e("li",{style:{height:"20vh"},children:e(je,{skeleton:!0,mediaFirst:K})}),e("li",{style:{height:"25vh"},children:e(je,{skeleton:!0,mediaFirst:K})})]}))]}),L==="default"&&(H?e(Tt,{root:j.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:oe=>{oe&&ie()},children:e("button",{type:"button",class:"plain block",onClick:()=>ie(),style:{marginBlockEnd:"6em"},children:e(h,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(h,{id:"2EYeAZ"})}))]}):L==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((oe,Le)=>S==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(je,{skeleton:!0,mediaFirst:K})},Le))}):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:()=>ie(!C.length),children:e(h,{id:"KDw4GX"})})]})]})})})}const Jr=lt(({status:n,instance:i,useItemID:o,filterContext:s,view:c,showFollowedTags:a,showReplyParent:p,mediaFirst:d})=>{const{_:l}=ae(),{id:r,reblog:u,items:m,type:f,_pinned:v}=n;v&&(o=!1);const y=u?.id||r,S=i?`/${i}/s/${y}`:`/s/${y}`;if(m){let b=qt(m,s),g="";if(f==="boosts"?g=ue._({id:"NuqppG",values:{0:b.length}}):f==="pinned"&&(g=l({id:"GlfmCu"})),f==="boosts"||f==="pinned"){const A=new Set;if(b.sort((C,T)=>{const L=Zt(C.filtered,s),M=Zt(T.filtered,s);return L&&L?.action!=="blur"&&A.add(C.id),M&&M?.action!=="blur"&&A.add(T.id),L&&!M?1:!L&&M?-1:0}),A.size>=2){const T=[],L=[];b.forEach(H=>{A.has(H.id)?L.push(H):T.push(H)});const M=[];for(let H=0;H<L.length;H+=5)M.push({_grouped:!0,posts:L.slice(H,H+5)});b=T.concat(M)}return e("li",{class:"timeline-item-carousel",children:e(Qr,{title:g,class:`${f}-carousel`,children:b.map(C=>{const{id:T,reblog:L,_pinned:M,_grouped:H}=C;if(H)return e("li",{class:"timeline-item-carousel-group",children:C.posts.map(W=>{const{id:Q,reblog:V,_pinned:j}=W,K=V?.id||Q,pe=i?`/${i}/s/${K}`:`/s/${K}`;return j&&(o=!1),e(fe,{class:"status-carousel-link timeline-item-alt",to:pe,children:o?e(je,{statusID:Q,instance:i,size:"s"}):e(je,{status:W,instance:i,size:"s"})})})},T);const F=L?.id||T,U=i?`/${i}/s/${F}`:`/s/${F}`;return M&&(o=!1),e("li",{children:e(fe,{class:"status-carousel-link timeline-item-alt",to:U,children:o?e(je,{statusID:T,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:d}):e(je,{status:C,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:d})})},T)})})},`timeline-${r}`)}const w=b.length>3;return b.map((A,C)=>{const{id:T,_differentAuthor:L}=A,M=i?`/${i}/s/${T}`:`/s/${T}`,H=C>0&&C<b.length-1,F=A.sensitive&&!!A.spoilerText,U=!L&&F&&C>0||w&&H&&(f==="thread"||f==="conversation"&&!L&&!b[C-1]._differentAuthor&&!b[C+1]._differentAuthor),W=C===0,Q=C===b.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${f} timeline-item-container-${W?"start":Q?"end":"middle"} ${L?"timeline-item-diff-author":""}`,children:e(fe,{class:"status-link timeline-item",to:M,children:U?e(el,{status:A,instance:i,filterContext:s}):o?e(je,{statusID:T,instance:i,enableCommentHint:Q,showFollowedTags:a}):e(je,{status:A,instance:i,enableCommentHint:Q,showFollowedTags:a})})},`timeline-${T}`)})}const k=`timeline-${r+v}`;return c==="media"?o?e(fs,{class:"timeline-item",parent:"li",statusID:r,instance:i},k):e(fs,{class:"timeline-item",parent:"li",status:n,instance:i},k):e("li",{children:e(fe,{class:"status-link timeline-item",to:S,children:o?e(je,{statusID:r,instance:i,enableCommentHint:!0,showFollowedTags:a,showReplyParent:p,mediaFirst:d}):e(je,{status:n,instance:i,enableCommentHint:!0,showFollowedTags:a,showReplyParent:p,mediaFirst:d})})},k)},(n,i)=>{const o=(n.status?.id||"").toString(),s=(i.status?.id||"").toString();return o===s&&n.instance===i.instance&&n.view===i.view});function Qr({title:n,class:i,children:o}){const{_:s}=ae(),c=q(),a=q(),p=q(),[d,l]=R(!1);return G(()=>{setTimeout(()=>{l(!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)*(Ft()?1:-1);c.current?.scrollBy({left:r,behavior:"smooth"})},children:e(I,{icon:"chevron-left",alt:s({id:"DHhJ7s"})})})," ",e("button",{ref:p,type:"button",class:"small plain2",onClick:()=>{const r=Math.min(320,c.current?.offsetWidth)*(Ft()?-1:1);c.current?.scrollBy({left:r,behavior:"smooth"})},children:e(I,{icon:"chevron-right",alt:s({id:"hXzOVo"})})})]})]}),e("ul",{ref:c,children:[e(Tt,{class:"status-carousel-beacon",onChange:r=>{a.current&&(a.current.disabled=r)}}),o[0],d&&o.slice(1),e(Tt,{class:"status-carousel-beacon",onChange:r=>{p.current&&(p.current.disabled=r)}})]})]})}function el({status:n,instance:i,filterContext:o}){const{_:s}=ae(),c=Ge(E),{id:a,visibility:p,language:d}=n,l=Un(n),r=at(a,i),u=Zt(n.filtered,o);return e("article",{class:`status compact-thread ${p==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[e("div",{class:"status-thread-badge-container",children:e(mc,{index:c.statusThreadNumber[r]})}),e("div",{class:"content-compact",title:l,lang:d,dir:"auto",children:u&&u?.action!=="blur"?e("b",{class:"status-filtered-badge badge-meta horizontal",title:u?.titlesStr||"",children:u?.titlesStr?e(h,{id:"sr6maL",values:{0:u.titlesStr},components:{0:e("span",{}),1:e("span",{})}}):e("span",{children:e(h,{id:"03Qqf9"})})}):e(D,{children:[l,n.sensitive&&n.spoilerText&&e(D,{children:[" ",e("span",{class:"spoiler-badge",children:e(I,{icon:"eye-close",size:"s",alt:s({id:"gnKo7f"})})})]})]})})]})}function tl(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const Vt=20,qi=1983,ms=`${qi}-01`,nl=Ci(()=>{try{const n=document.createElement("input");return n.setAttribute("type","month"),n.type==="month"}catch{return!1}});async function il(n){const{masto:i}=se({instance:n});return!!(await i.v2.search.list({q:"from:me",type:"statuses",limit:1}))?.statuses?.length}const sl=yt(il);function ol(){const{i18n:n,_:i}=ae(),o=Ge(E),{id:s,...c}=Pt(),[a,p]=bt(),d=a.get("month"),l=!a.get("replies"),r=!!a.get("boosts"),u=a.get("tagged"),m=!!a.get("media"),{masto:f,instance:v,authenticated:y}=se({instance:c.instance}),{masto:S,instance:k}=se(),b=q(),g=[d,l,r,u,m],[_,w]=R(),A=q(0);G(()=>{A.current=0},g);const C=ke(()=>Si(),[]),T=ke(()=>v===k,[v,k]),[L,M]=R(!1);G(()=>{T&&_?.acct&&(async()=>{const re=await sl(v);M(re)})()},[v,T,_?.acct]);async function H(re){const J=/^\d{4}-[01]\d$/.test(d),Ce=d?.split?.("-")?.[0]>=qi;if(J&&Ce){if(!_)return{value:[],done:!0};const[Se,Ae]=d.split("-"),xe=parseInt(Ae,10)-1,Pe=new Date(Se,xe,0),ze=`${Pe.getFullYear()}-${(Pe.getMonth()+1).toString().padStart(2,"0")}-${Pe.getDate().toString().padStart(2,"0")}`,Fe=new Date(Se,xe+1,1),Ye=`${Fe.getFullYear()}-${(Fe.getMonth()+1).toString().padStart(2,"0")}-${Fe.getDate().toString().padStart(2,"0")}`;let oe;re?(oe=Vt+1,A.current=0):(oe=Vt+A.current+1,A.current+=Vt);const Le=await f.v2.search.list({q:`from:${_.acct} after:${ze} before:${Ye}`,type:"statuses",limit:oe,offset:A.current});if(Le?.statuses?.length){const Re=Le.statuses.slice(0,Vt);Re.forEach(Ie=>{Je(Ie,v)});const z=Le.statuses.length<=Vt;return{value:Re,done:z}}else return{value:[],done:!0}}let ve=[];if(re){const{value:Se}=await f.v1.accounts.$select(s).statuses.list({pinned:!0}).values().next();if(Se?.length&&!u&&!m){const Ae=Se.map(xe=>(Je(xe,v),{...xe,_pinned:!0}));if(Ae.length>=3){const xe=Ae.map(Pe=>Pe.id);ve.push({id:xe,items:Ae,type:"pinned"})}else ve.push(...Ae)}}(re||!b.current)&&(b.current=f.v1.accounts.$select(s).statuses.list({limit:Vt,exclude_replies:l,exclude_reblogs:r,only_media:m||void 0,tagged:u}).values());const{value:ye,done:Ne}=await b.current.next();if(ye?.length){if(!Xe("@mastodon/pinned-posts")&&ve.length){let Se=[];ve[0]?.type==="pinned"?Se=ve[0].id:Se=ve.filter(xe=>xe._pinned).map(xe=>xe.id),Se.every(xe=>ye.some(Pe=>Pe.id===xe))&&(ve=[])}ve.push(...ye),ye.forEach(Se=>{Je(Se,v)})}return{value:ve,done:Ne}}const[F,U]=R([]);let W=i({id:"/cKnpj"});if(_?.acct){const re=(/@/.test(_.acct)?"":"@")+_.acct,J=_?.displayName?`${_.displayName} (${re})`:`${re}`;if(!l)W=i({id:"hS1Opy",values:{accountDisplay:J}});else if(r)W=i({id:"A/CX5F",values:{accountDisplay:J}});else if(u)W=i({id:"QQrO94",values:{accountDisplay:J,tagged:u}});else if(m)W=i({id:"NoG5wD",values:{accountDisplay:J}});else if(d){const Ce=new Date(d).toLocaleString(n.locale,{month:"long",year:"numeric"});W=i({id:"8GjLvB",values:{accountDisplay:J,monthYear:Ce}})}else W=J}Qe(W,"/:instance?/a/:id");const Q=tt(()=>rl(s,f),[s,f]);G(()=>{(async()=>{try{const re=await Q();w(re)}catch{}if(!C)try{const re=await f.v1.accounts.$select(s).featuredTags.list();U(re)}catch{}})()},[s,C]);const{displayName:V,acct:j,emojis:K}=_||{},pe=ke(()=>_?.id===vt(),[_?.id]),$=q(),ie=ke(()=>{const re=!l||r||u||m||!!d,J=o.accounts[`${s}@${v}`];return e(D,{children:[e(co,{instance:v,account:J||s,fetchAccount:Q,authenticated:y,standalone:!0,showEndorsements:!0}),!C&&e("div",{class:"filter-bar",ref:$,style:{position:"relative"},children:[re?e(fe,{to:`/${v}/a/${s}`,class:"insignificant filter-clear",title:i({id:"u8JHrO"}),children:e(I,{icon:"x",size:"l",alt:i({id:"xCJdfg"})})},"clear-filters"):e(I,{icon:"filter",class:"insignificant",size:"l",alt:i({id:"cSev+j"})}),e(fe,{to:`/${v}/a/${s}${l?"?replies=1":""}`,onClick:()=>{l&&le(i({id:"PIWNSQ"}))},class:l?"":"is-active",children:e(h,{id:"5BFynH"})}),e(fe,{to:`/${v}/a/${s}${r?"":"?boosts=0"}`,onClick:()=>{r||le(i({id:"Qd13i0"}))},class:r?"is-active":"",children:e(h,{id:"usxQx0"})}),e(fe,{to:`/${v}/a/${s}${m?"":"?media=1"}`,onClick:()=>{m||le(i({id:"rKpfPY"}))},class:m?"is-active":"",children:e(h,{id:"xYilR2"})}),F.map(Ce=>e(fe,{to:`/${v}/a/${s}${u===Ce.name?"":`?tagged=${encodeURIComponent(Ce.name)}`}`,onClick:()=>{u!==Ce.name&&le(i({id:"L+HFfr",values:{0:Ce.name}}))},class:u===Ce.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),Ce.name]})},Ce.id)),L&&(nl()?e("label",{class:`filter-field ${d?"is-active":""}`,children:[e(I,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!_?.acct,value:d||"",min:ms,max:new Date().toISOString().slice(0,7),onInput:Ce=>{const{value:ve,validity:ye}=Ce.currentTarget;if(!ye.valid)return;p(ve?{month:ve}:{});const[Ne,Se]=ve.split("-"),Ae=parseInt(Se,10)-1,xe=new Date(Ne,Ae);le(i({id:"0WUFGD",values:{0:xe.toLocaleString(n.locale,{month:"long",year:"numeric"})}}))}})]}):e(cl,{class:`filter-field ${d?"is-active":""}`,disabled:!_?.acct,value:d||"",min:ms,max:new Date().toISOString().slice(0,7),onInput:Ce=>{const{value:ve,validity:ye}=Ce;ye.valid&&p(ve?{month:ve}:{})}}))]})]})},[s,v,y,F,Q,L,...g]);G(()=>{const re=$.current?.querySelector(".is-active");re&&$.current.scrollTo({behavior:"smooth",left:re.offsetLeft-($.current.offsetWidth-re.offsetWidth)/2})},[F,L,...g]);const Y=ke(()=>_?.url?URL.parse(_.url)?.hostname:null,[_]),he=!!_&&!(v===Y);return e(D,{children:[e(Et,{title:`${_?.acct?"@"+_.acct:i({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(Us,{text:V,emojis:K})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",j]})})]}),id:"account-statuses",instance:v,emptyText:i({id:"+k97fV"}),errorText:i({id:"scd9lw"}),fetchItems:H,useItemID:!0,view:m||C?"media":void 0,boostsCarousel:o.settings.boostsCarousel,timelineStart:ie,refresh:[l,r,u,m,d+_?.acct].toString(),headerEnd:e(rt,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[e(ge,{disabled:!he,onClick:()=>{(async()=>{try{const{masto:re}=se({instance:Y}),J=await re.v1.accounts.lookup({acct:_.acct}),{id:Ce}=J;location.hash=`/${Y}/a/${Ce}`}catch{alert(i({id:"FgdLx0"}))}})()},children:[e(I,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(h,{id:"/JFxxT",values:{0:Y?e(D,{children:[" ","(",e("b",{children:qn.toUnicode(Y)}),")"]}):null}})})]}),!T&&e(ge,{onClick:()=>{(async()=>{try{const re=await S.v1.accounts.lookup({acct:_.acct+"@"+v}),{id:J}=re;location.hash=`/${k}/a/${J}`}catch{alert(i({id:"FgdLx0"}))}})()},children:[e(I,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(h,{id:"HkuyOu",values:{currentInstance:k},components:{0:e("b",{})}})})]})]})},s),j&&!pe&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`@${j} `}})})]})}function cl(n){const{i18n:i}=ae(),{class:o,disabled:s,value:c,min:a,max:p,onInput:d=()=>{}}=n,[l,r]=c?.split("-")||[],u=q(),m=q(),f=(v,y)=>{const[S,k]=a?.split("-")||[],[b,g]=p?.split("-")||[];return!(y<S||y>b||y===S&&v<k||y===b&&v>g)};return e("div",{class:o,children:[e(I,{icon:"month",size:"l"}),e("select",{ref:u,disabled:s,value:r||"",onInput:v=>{const{value:y}=v.currentTarget,S=m.current.value;if(!f(y,S))return{value:"",validity:{valid:!1}};d({value:y?`${S}-${y}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(h,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(v,y)=>e("option",{value:(y+1).toString().padStart(2,"0"),children:new Date(0,y).toLocaleString(i.locale,{month:"long"})},y))]})," ",e("input",{ref:m,type:"number",disabled:s,value:l||new Date().getFullYear(),min:a?.slice(0,4)||qi,max:p?.slice(0,4)||new Date().getFullYear(),onInput:v=>{const{value:y,validity:S}=v.currentTarget,k=u.current.value;if(!S.valid||!f(k,y))return{value:"",validity:{valid:!1}};d({value:y?`${y}-${k}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}function al(n,i){return i.v1.accounts.$select(n).fetch()}const rl=yt(al,{maxAge:30*60*1e3});function ll(){const n=Pt(),{year:i}=n;Qe(i?`Annual Report: ${i}`:"Annual Report");const{masto:o,instance:s}=se(),[c,a]=R(null),[p,d]=R("default");G(()=>{i&&(async()=>{d("loading");const v=await o.v1.annualReports.$select(i).fetch();a(v),d("default")})()},[i]);const{accounts:l,annualReports:r,statuses:u}=c||{},m=r?.find(v=>v.year==i)?.data,f=new Date;return e("div",{id:"annual-report-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"report",children:[e("h1",{children:[i," #Wrapstodon"]}),p==="loading"&&e("p",{children:[e(Oe,{abrupt:!0})," ",e(h,{id:"Pwqkdw"})]}),!!m&&e("dl",{children:Object.entries(m).map(([v,y])=>e(D,{children:[e("dt",{children:v}),e("dd",{class:`report-${v}`,children:Array.isArray(y)?e("table",{children:[e("thead",{children:e("tr",{children:Object.entries(y[0]).map(([S,k])=>e("th",{class:S!=="month"&&typeof k=="number"?"number":"",children:S}))})}),e("tbody",{children:y.map(S=>e("tr",{children:Object.entries(S).map(([k,b])=>e("td",{class:k!=="month"&&typeof b=="number"?"number":"",children:b&&/(accountId)/i.test(k)&&/^(mostRebloggedAccounts|commonlyInteractedWithAccounts)$/i.test(v)?e(mt,{account:l?.find(g=>g.id===b),showAvatar:!0}):k==="month"?f.setMonth(b-1)&&f.toLocaleString(void 0,{month:"long"}):typeof b=="number"?b.toLocaleString():b}))}))})]}):typeof y=="object"?/^(topStatuses)$/i.test(v)?e("dl",{children:Object.entries(y).map(([S,k])=>e(D,{children:[e("dt",{children:S}),e("dd",{children:k&&e(fe,{to:`/${s}/s/${k}`,children:e(je,{status:u?.find(b=>b.id===k),size:"s",readOnly:!0})})})]}))}):e("table",{children:e("tbody",{children:Object.entries(y).map(([S,k])=>e("tr",{children:[e("th",{children:S}),e("td",{class:typeof k=="number"?"number":"",children:k})]}))})}):typeof y=="string"?y:JSON.stringify(y,null,2)})]}))})]}),e("hr",{}),e("p",{style:{textAlign:"center"},children:e(fe,{to:"/",children:e(h,{id:"iWpEwy"})})})]})}const dl=20;function fo(){const{_:n}=ae();Qe(n({id:"7Ff7ia"}),"/b");const{masto:i,instance:o}=se(),s=q();async function c(a){return(a||!s.current)&&(s.current=i.v1.bookmarks.list({limit:dl}).values()),await s.current.next()}return e(Et,{title:n({id:"7Ff7ia"}),id:"bookmarks",emptyText:n({id:"8k2w6G"}),errorText:n({id:"UoL+FC"}),instance:o,fetchItems:c})}const ul=""+new URL("catch-up-O5q5C75Z.png",import.meta.url).href,hl="home",dt=[{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}],pl={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},boosts:{id:"puY2t0"},quotes:{id:"eWLklq"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},fl=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],ml=[null,"account"],gl=Ci(n=>new Intl.DateTimeFormat(n||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function Bn(n){return n?.id||n?.quotedStatus?.id}function vl(){const{i18n:n,_:i,_:o}=ae(),s=gl(n.locale);Qe("Catch-up","/catchup");const{masto:c,instance:a}=se(),[p,d]=bt(),l=p.get("id"),[r,u]=R("start"),[m,f]=R(!1),v=ke(()=>vt(),[]),y=x=>x===v,S=Xe("@pixelfed/home-include-reblogs");async function k({maxCreatedAt:x}){const B=[],Z=c.v1.timelines.home.list({limit:40}),ne=Z.values();e:for(;;)try{S&&Z.params&&(typeof Z.params=="string"?Z.params+="&include_reblogs=true":Z.params.include_reblogs=!0);const O=await ne.next(),{value:de}=O;if(de?.length){await po(de,a);let _e=!1;for(let me=0;me<de.length;me++){const X=de[me],te=Date.parse(X.createdAt);if(!x||te>=x){const $e=!y(X.reblog?.account?.id||X.account.id)&&Zt(X.reblog?.filtered||X.filtered,hl);if($e?.action==="hide")continue;X._filtered=$e;const Ve=at(X.id,a);X._followedTags=E.statusFollowedTags[Ve]?[...E.statusFollowedTags[Ve]]:[],B.push(X),_e=!0}if(!_e)break e}}else break e;await new Promise(_e=>setTimeout(_e,1e3))}catch{break e}return B.forEach(O=>{if(O?.inReplyToId){const de=B.find(_e=>_e.id===O.inReplyToId);de&&!de.inReplyToId&&(de._thread=!0)}}),B}const[b,g]=R([]),_=q(),w=q(),A=ke(()=>$n(),[]),C=tt(async({duration:x}={})=>{const B=Date.now(),Z=x?B-x:null;u("loading");const ne=await k({maxCreatedAt:Z}),O=`${A}-${gc()}`;try{await gt.catchup.set(O,{id:O,posts:ne,count:ne.length,startAt:Z,endAt:B}),d({id:O})}catch{}},[]);G(()=>{l?(async()=>{const x=await gt.catchup.get(l);x&&(x.posts.sort((B,Z)=>B.createdAt>Z.createdAt?1:-1),g(x.posts),u("results"))})():r==="results"&&(g([]),u("start"))},[l]);const[T,L]=xt(x=>x+1,0),[M,H]=R(null),[F,U]=R([]);G(()=>{(async()=>{try{const x=await gt.catchup.keys();if(x.length){const B=$n(),Z=x.filter(ne=>ne.startsWith(`${B}-`));if(Z.length){let ne=await gt.catchup.getMany(Z);ne.sort((me,X)=>X.endAt-me.endAt);let O=ne.slice(0,3),de=ne.slice(3);const _e=O.map(me=>{const{id:X,count:te,startAt:we,endAt:$e}=me;return{id:X,count:te,startAt:we,endAt:$e}});U(_e),H(O[0].endAt),ne=null,O=null,queueMicrotask(()=>{de.length&&gt.catchup.delMany(de.map(me=>me.id)).then(()=>{de=null}).catch(me=>{})});return}}}catch{}U([])})()},[T]),G(()=>{r==="start"&&L()},[r==="start"]);const[W,Q]=ke(()=>{let x=0,B=0,Z=0,ne=0,O=0,de=0,_e=0;const me={};for(const te of b){te._filtered&&te._filtered?.action!=="blur"?(x++,te.__FILTER="filtered"):te.group?(B++,te.__FILTER="groups"):te.reblog?(Z++,te.__FILTER="boosts"):Nt()&&Bn(te.quote)?(ne++,te.__FILTER="quotes"):te._followedTags?.length?(de++,te.__FILTER="followedTags"):te.inReplyToId&&te.inReplyToAccountId!==te.account?.id?(O++,te.__FILTER="replies"):(_e++,te.__FILTER="original");const we=te.reblog||te;if(te.__FILTER!=="filtered"&&we.card?.url&&we.card?.image&&we.card?.type==="link"){const{card:$e,favouritesCount:Ve,reblogsCount:ot}=we;let{url:et}=$e;if(et=et.replace(/\/$/,""),!me[et])me[et]={postID:we.id,card:$e,shared:1,sharers:[te.account],likes:Ve,boosts:ot};else{if(me[et].sharers.find(wt=>wt.id===te.account.id))continue;me[et].shared++,me[et].sharers.push(te.account),me[et].postID!==we.id&&(me[et].likes+=Ve,me[et].boosts+=ot)}}}let X=[];for(const te in me)X.push({url:te,...me[te]});if(X.sort((te,we)=>te.shared>we.shared?-1:te.shared<we.shared?1:te.boosts>we.boosts?-1:te.boosts<we.boosts?1:te.likes>we.likes?-1:te.likes<we.likes?1:te.quotes>we.quotes?-1:te.quotes<we.quotes?1:0),X.length>10)e:for(let te=10;te<X.length;te++){const{shared:we}=X[te];if(we<=1){X=X.slice(0,te);break e}}return[{filtered:x,groups:B,boosts:Z,quotes:ne,replies:O,followedTags:de,original:_e},X]},[b]),[V,j]=R("all"),[K,pe]=R(null),[$,ie]=R(1),[Y,ee]=R("createdAt"),[he,re]=R("asc"),[J,Ce]=R(null),[ve,ye,Ne]=ke(()=>{const x={},B=new Map;let Z=b.filter(O=>{const de=V==="all"||O.__FILTER===V;return de&&(x[O.account.id]=O.account,B.set(O.account.id,(B.get(O.account.id)||0)+1)),de});const ne={};return Z.forEach(O=>{O.reblog&&(ne[O.reblog.id]?(ne[O.reblog.id].__BOOSTERS?ne[O.reblog.id].__BOOSTERS.add(O.account):ne[O.reblog.id].__BOOSTERS=new Set([O.account]),O.__HIDDEN=!0):ne[O.reblog.id]=O)}),K&&B.has(K)&&(Z=Z.filter(O=>O.account.id===K||[...O.__BOOSTERS||[]].find(de=>de.id===K))),[Z,x,Object.fromEntries(B)]},[V,K,b]),Se=ke(()=>{const x={};return ve.forEach(B=>{x[B.id]=B}),x},[ve]),Ae=ke(()=>Object.keys(Ne).sort((x,B)=>Ne[B]-Ne[x]),[Ne]),xe=ke(()=>{const x={};return Ae.forEach((B,Z)=>{x[B]=Z}),ve.filter(B=>!B.__HIDDEN).sort((B,Z)=>{if(J==="account"){const ne=B.account.id,O=Z.account.id,de=x[ne],_e=x[O],me=de-_e;if(me!==0)return me}if(Y!=="createdAt"&&(B=B.reblog||B,Z=Z.reblog||Z,Y!=="density"&&B[Y]===Z[Y]))return B.createdAt>Z.createdAt?1:-1;if(Y==="density"){const ne=gs(B),O=gs(Z);return he==="asc"?ne>O?1:-1:O>ne?1:-1}return he==="asc"?B[Y]>Z[Y]?1:-1:Z[Y]>B[Y]?1:-1})},[ve,Y,he,J,Ae]),Pe=q(null),ze=q(null),Fe=q(!1);G(()=>{b.length>100||Fe.current||ze.current&&(Qs(ze.current,{duration:200}),Fe.current=!0)},[b,ze]);const Ye=b.length>160?"3d":"2d",oe=ke(()=>Ye!=="2d"?null:b.map(x=>{const B=Se[x.id];return e("span",{class:`post-dot ${B?"post-dot-highlight":""}`},x.id)}),[Se]),Le=ke(()=>Ye!=="3d"||!b?.length?null:_l(b,"createdAt",320).map((B,Z)=>e("div",{class:"posts-bin",children:B.map(ne=>{const O=Se[ne.id];return e("span",{class:`post-dot ${O?"post-dot-highlight":""}`},ne.id)})},Z)),[Se]),Re=q(null),z=ke(()=>M?(Date.now()-M)/1e3/60/60:null,[M,$]);G(()=>{if(r!=="results")return;const x=K&&ye[K]?ye[K].username:"",B=he==="asc"?0:1,Z={account:"authors"};let ne=le({duration:5e3,text:o({id:"XKZRZ/",values:{selectedFilterCategory:V,sortBy:Y,sortOrder:he,groupBy:J}})});return()=>{ne?.hideToast?.()}},[r,V,K,Y,he,J,ye]),G(()=>{if(K&&ye[K]){const x=ze.current.querySelector(`[data-author="${K}"]`),B=ze.current?.getBoundingClientRect(),Z=x?.getBoundingClientRect();Z.left<B.left||Z.right>B.right?x.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):Z.top<0&&x.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[K,ye]);const[Ie,Me]=R(!1),Ee=".catchup-list > li > a",P=Ue("j",()=>{const x=document.activeElement.closest(Ee),B=x?.getBoundingClientRect(),Z=Array.from(Re.current.querySelectorAll(Ee));if(x&&B.top<Re.current.clientHeight&&B.bottom>0){const ne=Z.indexOf(x),O=Z[ne+1];O&&(O.focus(),O.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const ne=Z.find(O=>O.getBoundingClientRect().top>=0);ne&&(ne.focus(),ne.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey}),be=Ue("k",()=>{const x=document.activeElement.closest(Ee),B=x?.getBoundingClientRect(),Z=Array.from(Re.current.querySelectorAll(Ee));if(x&&B.top<Re.current.clientHeight&&B.bottom>0){const ne=Z.indexOf(x);let O=Z[ne-1];O&&(O.focus(),O.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const ne=Z.find(O=>{const de=O.getBoundingClientRect();return de.top>=44&&de.left>=0});ne&&(ne.focus(),ne.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey}),Be=Ue("h, l",(x,B)=>{const Z=B.keys[0];if(K){const ne=Ae.indexOf(K);Z==="h"?ne>0&&ne<Ae.length&&(pe(Ae[ne-1]),Re.current?.focus()):Z==="l"&&ne<Ae.length-1&&ne>=0&&(pe(Ae[ne+1]),Re.current?.focus())}else Z==="l"&&(pe(Ae[0]),Re.current?.focus())},{useKey:!0,preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey,enableOnFormTags:["input"]}),De=Ue("esc",()=>{pe(null),Re.current?.focus()},{preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey,enableOnFormTags:["input"],useKey:!0}),N=Ue(".",()=>{Re.current?.scrollTo({top:0,behavior:"smooth"})},{useKey:!0,preventDefault:!0,ignoreEventWhen:x=>x.metaKey||x.ctrlKey||x.altKey||x.shiftKey,enableOnFormTags:["input"]}),ce=tt(x=>{const B=document.activeElement,Z=B?.tagName==="INPUT"&&B.type==="radio";if((x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="ArrowLeft"||x.key==="ArrowRight")&&Z){B.blur();return}},[]);return e("div",{ref:x=>{Re.current=x,P.current=x,be.current=x,Be.current=x,De.current=x,N.current=x},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${r==="loading"?"loading":""}`,onClick:x=>{x.target.closest("a, button")||Re.current?.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Dt,{}),r==="results"&&e(fe,{to:"/catchup",class:"button plain",children:e(I,{icon:"history2",size:"l",alt:o({id:"xrl8fj"})})}),r==="start"&&e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:o({id:"i0qMbr"})})})]}),e("h1",{children:r!=="start"&&e(h,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("div",{class:"header-side",children:r!=="start"&&r!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{Me(!0)},children:e(h,{id:"c3XJ18"})})})]})}),e("main",{onKeyDown:ce,children:[r==="start"&&e("div",{class:"catchup-start",children:[e("h1",{children:e(h,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("details",{children:[e("summary",{children:e(h,{id:"CxKPv6"})}),e("p",{children:e(h,{id:"YMU1CK"})}),e("img",{src:ul,width:"1200",height:"900",alt:o({id:"CeInO2"})}),e("p",{children:e("button",{type:"button",onClick:x=>{x.target.closest("details").open=!1},children:e(h,{id:"2jI8hh"})})})]}),e("p",{children:e(h,{id:"1RfGk7"})}),e("p",{children:e("b",{children:e(h,{id:"OOEonE"})})}),e("div",{class:"catchup-form",children:[e("input",{ref:_,type:"range",value:$,min:dt[0].value,max:dt[dt.length-1].value,step:"1",list:"catchup-ranges",onChange:x=>ie(+x.target.value)})," ",e("span",{style:{width:"8em"},children:[i(dt[$-1].label),e("br",{}),e("small",{class:"insignificant",children:$==dt[dt.length-1].value?o({id:"NMNiaO"}):st(new Date(Date.now()-$*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:dt.map(({label:x,value:B})=>e("option",{value:B,label:i(x)}))})," ",e("button",{type:"button",onClick:()=>{if($<dt[dt.length-1].value){let x;$===dt[dt.length-1].value&&w.current?.checked?x=Date.now()-M:x=$*60*60*1e3,C({duration:x})}else C()},children:e(h,{id:"R0yu2l"})})]}),z&&$>z?e("p",{class:"catchup-info",children:[e(I,{icon:"info"})," ",e(h,{id:"AGyV7s"})]}):$===dt[dt.length-1].value&&M?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:w})," ",e(h,{id:"dDJEHI",values:{0:s.format(new Date(M))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(h,{id:"EAjFM0"})})}),!!F?.length&&e("div",{class:"catchup-prev",children:[e("p",{children:e(h,{id:"Yfb9A8"})}),e("ul",{children:F.map(x=>e("li",{children:[e(fe,{to:`/catchup?id=${x.id}`,children:[e(I,{icon:"history2"})," ",e("span",{children:x.startAt?s.formatRange(new Date(x.startAt),new Date(x.endAt)):`… – ${s.format(new Date(x.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:e(h,{id:"S6XZwv",values:{0:x.count}})})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{if(confirm(o({id:"D9CmP2"}))){let Z=le(o({id:"xJUo4P",values:{0:x.id}}));await gt.catchup.del(x.id),Z?.hideToast?.(),le(o({id:"1dyGG/",values:{0:x.id}})),L()}},children:e(I,{icon:"x",alt:o({id:"t/YqKh"})})})]})]},x.id))}),F.length>=3&&e("p",{children:e("small",{children:e(h,{id:"sXmrl4"})})})]})]}),r==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(Oe,{abrupt:!0}),e("p",{class:"insignificant",children:e(h,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(h,{id:"q9urQO"})})]}),r==="results"&&e(D,{children:[e("div",{class:"catchup-header",children:[b.length>0&&e("p",{children:e("b",{class:"ib",children:s.formatRange(new Date(b[0].createdAt),new Date(b[b.length-1].createdAt))})}),e("aside",{children:[e("button",{hidden:V==="all"&&!K&&Y==="createdAt"&&he==="asc",type:"button",class:"plain4 small",onClick:()=>{j("all"),pe(null),ee("createdAt"),Ce(null),re("asc")},children:e(h,{id:"I9EnzM"})}),Q?.length>0&&e("button",{type:"button",class:"plain small",onClick:()=>f(!m),children:[e(h,{id:"EIZREX"})," ",e(I,{icon:"chevron-down",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]})]})]}),e("div",{class:"shazam-container no-animation",hidden:!m,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"catchup-top-links links-bar",children:Q.map(x=>{const{card:B,shared:Z,sharers:ne,likes:O,boosts:de}=x,{blurhash:_e,title:me,description:X,url:te,image:we,imageDescription:$e,language:Ve,width:ot,height:et,publishedAt:wt}=B,Rt=wi(te);let fn;if(_e){const mn=Ti(_e),gn=Bi(mn);fn=Fi([.6,gn[1],gn[2]])}return e("a",{href:te,target:"_blank",rel:"noopener",class:"link-block",style:fn?{"--accent-color":`rgb(${fn.join(",")})`,"--accent-alpha-color":`rgba(${fn.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:we,alt:$e,width:ot,height:et,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Rt})," ",!!wt&&e(D,{children:"· "}),!!wt&&e(D,{children:e(Ct,{datetime:wt,format:"micro"})})]}),!!me&&e("h1",{class:"title",lang:Ve,dir:"auto",title:me,children:me})]}),!!X&&e("p",{class:"description",lang:Ve,dir:"auto",title:X,children:X}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(h,{id:"bfSr6z",values:{0:ne.map(mn=>{const{avatarStatic:gn,displayName:No}=mn;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:Ki=>{Ki.preventDefault(),Ki.stopPropagation();const{id:Po}=mn;pe(Po),j("all")},children:e(pt,{url:gn,size:"s",alt:No})})})}})})]})]})},te)})})})}),b.length>=5&&(Ye==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:Le}):e("div",{class:"catchup-posts-viz-bar",children:oe})),b.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:V.toLowerCase()==="all",onChange:()=>{j("all")}}),e(h,{id:"N40H+G"})," ",e("span",{class:"count",children:b.length})]}),Object.entries(pl).map(([x,B])=>!!W[x]&&e("label",{class:"filter-cat",title:(W[x]/b.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:V.toLowerCase()===x.toLowerCase(),onChange:()=>{j(x),x==="boosts"&&(ee("reblogsCount"),re("desc"),Ce(null))}}),i(B)," ",e("span",{class:"count",children:W[x]})]},i(B)))]}),b.length>=2&&!!Ne&&e("div",{class:"catchup-filters authors-filters",ref:ze,children:[Ae.map(x=>e("label",{class:"filter-author","data-author":x,children:[e("input",{type:"radio",name:"filter-author",checked:K===x,onChange:()=>{pe(x)},onClick:()=>{K===x&&pe(null)}}),e(pt,{url:ye[x].avatarStatic||ye[x].avatar,size:"xxl",alt:`${ye[x].displayName} (@${ye[x].acct})`})," ",e("span",{class:"count",children:Ne[x]}),e("span",{class:"username",children:ye[x].username})]},`${x}-${Ne[x]}`)),Ae.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(h,{id:"HHtYi7",values:{0:Ae.length}})},"authors-count")]}),b.length>=2&&e("div",{class:"catchup-filters",children:[e("span",{class:"filter-label",children:e(h,{id:"f6Hub0"})})," ",e("fieldset",{class:"radio-field-group",children:fl.map(x=>e("label",{class:"filter-sort",onClick:B=>{Y===x&&(B.preventDefault(),B.stopPropagation(),re(he==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:Y===x,onChange:()=>{ee(x);const B=/(replies|favourites|reblogs|quotes)/.test(x)?"desc":"asc";re(B)}}),{createdAt:o({id:"mYGY3B"}),repliesCount:o({id:"N8UzTV"}),favouritesCount:o({id:"zZOZj7"}),reblogsCount:o({id:"puY2t0"}),quotesCount:o({id:"eWLklq"}),density:o({id:"0tQ7AD"})}[x],Y===x&&(he==="asc"?" ↑":" ↓")]},x))}),e("span",{class:"filter-label",children:e(h,{id:"group.filter"})})," ",e("fieldset",{class:"radio-field-group",children:ml.map(x=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:J===x,onChange:()=>{Ce(x)},disabled:x==="account"&&K}),{account:o({id:"dpqPBg"})}[x]||o({id:"EdQY6l"})]},x||"none"))}),K&&Ae.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{pe(null)},style:{whiteSpace:"nowrap"},children:e(h,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${V||""} ${Y?`catchup-sort-${Y}`:""} ${K&&ye[K]?"catchup-selected-author":""} ${J?`catchup-group-${J}`:""}`,children:xe.map((x,B)=>{const Z=x.reblog?.id||x.id;let ne=!1;return J==="account"&&(Pe.current&&x.account.id!==Pe.current&&B>0&&(ne=!0),Pe.current=x.account.id),e(D,{children:[ne&&e("li",{class:"separator"}),e(bl,{to:`/${a}/s/${Z}`,post:x,root:Re.current})]},`${x.id}-${ne}`)})}),e("footer",{children:ve.length>5&&e("p",{children:[o(V==="boosts"?{id:"eVosYr"}:{id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{Re.current.scrollTop=0},children:e(h,{id:"0MgdN+"})}),"."]})})]})]})]}),Ie&&e(qe,{onClose:()=>Me(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>Me(!1),children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(h,{id:"c3XJ18"})})}),e("main",{children:e("dl",{children:[e("dt",{children:e(h,{id:"EIZREX"})}),e("dd",{children:e(h,{id:"YmGrIy"})}),e("dt",{children:e(h,{id:"coaNtr"})}),e("dd",{children:e(h,{id:"UUrqX1"})}),e("dt",{children:e(h,{id:"ScQBC/"})}),e("dd",{children:e(h,{id:"srocAr"})}),e("dt",{children:e(h,{id:"77Emn0"})}),e("dd",{children:e("table",{children:e("tbody",{children:[e("tr",{children:[e("td",{children:e(h,{id:"Gy9P9T"})}),e("td",{children:e("kbd",{children:"j"})})]}),e("tr",{children:[e("td",{children:e(h,{id:"6XYpYY"})}),e("td",{children:e("kbd",{children:"k"})})]}),e("tr",{children:[e("td",{children:e(h,{id:"f5dduh"})}),e("td",{children:e("kbd",{children:"l"})})]}),e("tr",{children:[e("td",{children:e(h,{id:"rj0vxZ"})}),e("td",{children:e("kbd",{children:"h"})})]}),e("tr",{children:[e("td",{children:e(h,{id:"jsFF8C"})}),e("td",{children:e("kbd",{children:"Enter"})})]}),e("tr",{children:[e("td",{children:e(h,{id:"bUUv3P"})}),e("td",{children:e("kbd",{children:"."})})]})]})})})]})})]})})]})}const yl=lt(function({post:n}){const{id:i,account:o,group:s,reblog:c,quote:a,inReplyToId:p,inReplyToAccountId:d,_followedTags:l,_filtered:r,visibility:u,__BOOSTERS:m}=n,f=p&&d!==o.id,v=!!r&&r?.action!=="blur",y=S=>{S.shiftKey};return e("article",{class:`post-line ${s?"group":c?"reblog":Nt()&&Bn(a)?"quote":l?.length?"followed-tags":""} ${f?"reply-to":""} ${v?"filtered":""} visibility-${u}`,onMouseEnter:y,children:[e("span",{class:"post-author",children:c?e("span",{class:"post-reblog-avatar",children:[e(pt,{url:o.avatarStatic||o.avatar,squircle:o.bot}),m?.size>0?[...m].map(S=>e(pt,{url:S.avatarStatic||S.avatar,squircle:S.bot})):""," ",e(I,{icon:"rocket"})," ",e(mt,{account:c.account,showAvatar:!0})]}):Bn(a)?e("span",{class:"post-quote-avatar",children:[e(pt,{url:o.avatarStatic||o.avatar,squircle:o.bot})," ",e(I,{icon:"quote"})," ",e(mt,{account:a.quotedStatus?.account||a.account,showAvatar:!0})]}):e(mt,{account:o,showAvatar:!0})}),e(Sl,{post:c||n,filterInfo:r}),e("span",{class:"post-meta",children:[e(Cl,{post:c||n})," ",e(Ct,{datetime:new Date(c?.createdAt||n.createdAt),format:"micro"})]})]})},(n,i)=>n?.post?.id===i?.post?.id),bl=({root:n,to:i,...o})=>{const s=q(),[c,a]=R(!1);return G(()=>{const p=new IntersectionObserver(d=>{d[0].isIntersecting&&(queueMicrotask(()=>a(!0)),p.unobserve(s.current))},{root:n,rootMargin:`${Math.max(320,screen.height*.75)}px`});return s.current&&p.observe(s.current),()=>{s.current&&p.unobserve(s.current)}},[]),c?e("li",{children:e(fe,{to:i,children:e(yl,{...o})})}):e("li",{ref:s,style:{height:"4em"}})},wl=8,kl=8;function gs(n){const{spoilerText:i,content:o,poll:s,mediaAttachments:c,card:a}=n,p=s?.options?.length?s.options.reduce((l,r)=>l+r.title,""):"";return(i.length+Hs(o)+p.length)/140+(c?.length?wl*c.length:a?.image?kl:0)}const Lt=48;function Sl({post:n,filterInfo:i}){const{_:o}=ae();let{spoilerText:s,sensitive:c,content:a,emojis:p,poll:d,mediaAttachments:l,card:r,inReplyToId:u,inReplyToAccountId:m,account:f,_thread:v,quote:y}=n;const S=u&&m===f.id||!!v;let k=Nt()&&Bn(y)?y.quotedStatus||y:null;(k?.spoilerText||k?.sensitive)&&(k=null),k?.emojis&&p.push(...k.emojis),!l?.length&&k?.mediaAttachments?.length&&(l=k.mediaAttachments);const g=!!yi()["reading:expand:spoilers"],_=g||!s&&!c&&i?.action!=="blur",w=a?Un(n):"",A=!s||g;return e("div",{class:"post-peek",title:s?"":w,children:[e("span",{class:"post-peek-content",children:[S&&!A&&e(D,{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?o({id:"suKjh3",values:{0:i.titlesStr}}):o({id:"03Qqf9"})}):e(D,{children:[!!s&&e("span",{class:"post-peek-spoiler",children:[e(I,{icon:`${g?"eye-open":"eye-close"}`})," ",s]}),A&&e("div",{class:"post-peek-html",children:[S&&e(D,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(h,{id:"e66y2Z"})})," "]}),!!a&&e("div",{dangerouslySetInnerHTML:{__html:vc(a,p)+(k?.content?`<blockquote class="post-peek-quote">${k.content}</blockquote>`:"")}}),!!d?.options?.length&&d.options.map(C=>e("div",{children:[d.multiple?"▪️":"•"," ",C.title]})),!a&&l?.length===1&&l[0].description&&e(D,{children:[e("span",{class:"post-peek-tag post-peek-alt",children:"ALT"})," ",e("div",{children:l[0].description})]})]})]})]}),(!i||i?.action==="blur")&&e("span",{class:"post-peek-post-content",children:[!!d&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(I,{icon:"poll",size:"s"}),e(h,{id:"4WUbF1"})]}),l?.length?l.map(C=>{const T=C.previewUrl||C.url,L=C.previewRemoteUrl||C.remoteUrl,M=C.meta?.original?C.meta.original.width:C.meta?.small?.width||C.meta?.original?.width,H=C.meta?.original?C.meta.original.height:C.meta?.small?.height||C.meta?.original?.height;return e("span",{class:"post-peek-media",children:{image:(T||L)&&_?e("img",{src:T,width:Lt,height:Lt,alt:C.description,loading:"lazy",onError:F=>{const{src:U}=F.target;U===T&&(F.target.src=L)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(M,H)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(T||L)&&_?e("img",{src:T,width:Lt,height:Lt,alt:C.description,loading:"lazy",onError:F=>{const{src:U}=F.target;U===T&&(F.target.src=L)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(T||L)&&_?e("img",{src:T,width:Lt,height:Lt,alt:C.description,loading:"lazy",onError:F=>{const{src:U}=F.target;U===T&&(F.target.src=L)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[C.type]||null},C.id)}):!!r&&r.image&&_&&e("span",{class:`post-peek-media post-peek-card card-${r.type||""}`,children:r.image?e("img",{src:r.image,width:Lt,height:Lt,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 Cl({post:n}){const{_:i}=ae(),{reblogsCount:o,repliesCount:s,favouritesCount:c,quotesCount:a}=n;return e("span",{class:"post-stats",children:[s>0&&e("span",{class:"post-stat-replies",children:[e(I,{icon:"comment2",size:"s",alt:i({id:"N8UzTV"})})," ",We(s)]}),c>0&&e("span",{class:"post-stat-likes",children:[e(I,{icon:"heart",size:"s",alt:i({id:"zZOZj7"})})," ",We(c)]}),o>0||a>0?e("span",{class:"post-stat-boosts",children:[e(I,{icon:"rocket",size:"s",alt:i({id:"puY2t0"})})," ",o>0||a>0?`${o>0?We(o):""}${o>0&&a>0?"+":""}${a>0?We(a):""}`:We(o)]}):null]})}function _l(n,i,o){const s=n.map(l=>new Date(l[i])),c=s.reduce((l,r)=>r<l?r:l,s[0]),a=s.reduce((l,r)=>r>l?r:l,s[0]),p=Math.min(a.getTime(),Date.now())-c.getTime(),d=Array.from({length:o},()=>[]);return n.forEach(l=>{const r=Date.parse(l[i]);if(r>Date.now())d[d.length-1].push(l);else{const u=(r-c.getTime())/p,m=Math.floor(u*(o-1));d[m].push(l)}}),d}const Il=20;function mo(){const{_:n}=ae();Qe(n({id:"zZOZj7"}),"/favourites");const{masto:i,instance:o}=se(),s=q();async function c(a){return(a||!s.current)&&(s.current=i.v1.favourites.list({limit:Il}).values()),await s.current.next()}return e(Et,{title:n({id:"zZOZj7"}),id:"favourites",emptyText:n({id:"PHIrMr"}),errorText:n({id:"khVljG"}),instance:o,fetchItems:c})}const Al=["home","public","notifications","thread","account"],vs=["thread","account"],Tl={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},xl=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],ai={0:{id:"qqeAJM"},1800:it(30,"minute"),3600:it(1,"hour"),21600:it(6,"hour"),43200:it(12,"hour"),86400:it(24,"hour"),604800:it(7,"day"),2592e3:it(30,"day")};function El(){const{_:n}=ae(),{masto:i}=se();Qe(n({id:"cSev+j"}),"/ft");const[o,s]=R("default"),[c,a]=R(!1),[p,d]=xt(u=>u+1,0),[l,r]=R([]);return G(()=>{s("loading"),(async()=>{try{const u=await i.v2.filters.list();u.sort((m,f)=>m.title.localeCompare(f.title)),u.forEach(m=>{m.keywords?.length&&m.keywords.sort((f,v)=>f.id-v.id)}),r(u),s("default")}catch{s("error")}})()},[p]),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(Dt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(h,{id:"cSev+j"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{a(!0)},children:e(I,{icon:"plus",size:"l",alt:n({id:"yFfBdX"})})})})]})}),e("main",{children:l.length>0?e(D,{children:[e("ul",{class:"filters-list",children:l.map(u=>{const{id:m,title:f,expiresAt:v,keywords:y}=u;return e("li",{children:[e("div",{children:[e("h2",{children:f}),y?.length>0&&e("div",{children:y.map(S=>e(D,{children:[e("span",{class:"tag collapsed insignificant",children:S.wholeWord?`${S.keyword}`:S.keyword})," "]}))}),e("small",{class:"insignificant",children:e(go,{expiresAt:v})})]}),e("button",{type:"button",class:"plain",onClick:()=>{a({filter:u})},children:e(I,{icon:"pencil",size:"l",alt:"Edit filter"})})]},m)})}),l.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(h,{id:"5vzJxv",values:{0:l.length}})})})]}):o==="loading"?e("p",{class:"ui-state",children:e(Oe,{})}):o==="error"?e("p",{class:"ui-state",children:e(h,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(h,{id:"cWIHTt"})})})]}),!!c&&e(qe,{title:n({id:"vCSBPD"}),onClose:()=>{a(!1)},children:e(Ml,{filter:c?.filter,onClose:u=>{u.state==="success"&&d(),a(!1)}})})]})}let Rl=1;const Ll=()=>Rl++;function Ml({filter:n,onClose:i}){const{_:o,_:s}=ae(),{masto:c}=se(),[a,p]=R("default"),d=!!n,{context:l,expiresAt:r,id:u,keywords:m,title:f,filterAction:v}=n||{},y=!!r,S=y&&new Date(r),[k,b]=R(m||[]),g=q(),[_,w]=R([]),[A,C]=R([]),T=k.filter(L=>!_.includes(L.id)&&!A.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(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:s(d?{id:"3mOee6"}:{id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:L=>{L.preventDefault();const M=new FormData(L.target),H=M.get("title"),F=M.getAll("keyword_attributes[][id]"),U=M.getAll("keyword_attributes[][keyword]"),W=[...g.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(pe=>pe.checked),Q=U.map((pe,$)=>({id:F[$]||void 0,keyword:pe,wholeWord:W[$]}));d&&_?.length&&_.forEach(pe=>{Q.push({id:pe,_destroy:!0})});const V=M.getAll("context");let j=M.get("expires_in");const K=M.get("filter_action");!H||!V?.length||(p("loading"),(async()=>{try{let pe;d?(j===""||j===null?y?j=Math.floor((S-Date.now())/1e3):j=null:j==="0"||j===0?j=null:j=+j,pe=await c.v2.filters.$select(u).update({title:H,context:V,expiresIn:j,keywordsAttributes:Q,filterAction:K})):(j=+j||null,pe=await c.v2.filters.create({title:H,context:V,expiresIn:j,keywordsAttributes:Q,filterAction:K})),p("default"),i?.({state:"success",filter:pe})}catch{p("error"),alert(s(d?{id:"H8RP+h"}:{id:"Fr0hAN"}))}})())},children:[e("div",{class:"filter-form-row",children:e("label",{children:[e("b",{children:e(h,{id:"MHrjPM"})}),e("input",{type:"text",name:"title",defaultValue:f,disabled:a==="loading",dir:"auto",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:g,children:[T.length?e("ul",{class:"filter-keywords",children:T.map(L=>{const{id:M,keyword:H,wholeWord:F,_id:U}=L;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:M}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:H,disabled:a==="loading",required:!0,dir:"auto"}),e("div",{class:"filter-keyword-actions",children:[e("label",{children:[e("input",{name:"keyword_attributes[][whole_word]",type:"checkbox",value:M,defaultChecked:F,disabled:a==="loading"})," ",e(h,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:a==="loading",onClick:()=>{M?(_.push(M),w([..._])):U&&(A.push(U),C([...A]))},children:e(I,{icon:"x",alt:s({id:"t/YqKh"})})})]})]},`${M}-${U}`)})}):e("div",{class:"filter-keywords",children:e("div",{class:"insignificant",children:e(h,{id:"SYKm3p"})})}),e("footer",{class:"filter-keywords-footer",children:[e("button",{type:"button",class:"light",onClick:()=>{b([...k,{_id:Ll(),keyword:"",wholeWord:!0}]),setTimeout(()=>{const L=g.current.querySelectorAll('input[type="text"]');L[L.length-1]?.focus?.()},10)},children:e(h,{id:"qn5Dbn"})})," ",T?.length>1&&e("small",{class:"insignificant",children:e(h,{id:"1JZ175",values:{0:T.length}})})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:e(h,{id:"uqf7Yq"})})}),Al.map(L=>e("div",{children:[e("label",{class:vs.includes(L)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:L,defaultChecked:l?l.includes(L):!0,disabled:a==="loading"})," ",o(Tl[L]),vs.includes(L)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(h,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[d&&e(h,{id:"ucJk3m",components:{0:e("b",{}),1:e(go,{expiresAt:r,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:s(d?{id:"BcNdg+"}:{id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:a==="loading",defaultValue:d?void 0:0,children:[d&&e("option",{}),xl.map(L=>e("option",{value:L,children:typeof ai[L]=="function"?ai[L]():o(ai[L])}))]})]}),e("p",{children:[e(h,{id:"blQMpa"}),e("br",{}),bi()?.mastodon>=5&&e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"blur",defaultChecked:v==="blur",disabled:a==="loading"})," ",e(h,{id:"ggxOw9"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:v!=="hide"&&v!=="blur"||!d,disabled:a==="loading"})," ",e(h,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:v==="hide",disabled:a==="loading"})," ",e(h,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:a==="loading",children:s(d?{id:"tfDRzk"}:{id:"hYgDIe"})})," ",e(Oe,{abrupt:!0,hidden:a!=="loading"})]}),d&&e(ft,{disabled:a==="loading",align:"end",menuItemClassName:"danger",confirmLabel:s({id:"BPjyR2"}),onClick:()=>{p("loading"),(async()=>{try{await c.v2.filters.$select(u).remove(),p("default"),i?.({state:"success"})}catch{p("error"),alert(s({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:a==="loading",children:e(h,{id:"Jb6/SB"})})})]})]})})]})}function go({expiresAt:n,showNeverExpires:i}){const{_:o}=ae(),s=!!n,c=s&&new Date(n),a=s&&Date.parse(n)<=Date.now(),[p,d]=xt(l=>l+1,0);return Ii(d,a||3e4),a?o({id:"M1RnFv"}):s?e(h,{id:"urGtsw",components:{0:e(Ct,{datetime:c})}}):i&&o({id:"O1Aswy"})}function $l(){const{_:n}=ae(),{masto:i,instance:o}=se();Qe(n({id:"Xi1/bw"}),"/fh");const[s,c]=R("default"),[a,p]=R([]);return G(()=>{c("loading"),(async()=>{try{const d=await zn();p(d),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(Dt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(h,{id:"Xi1/bw"})}),e("div",{class:"header-side"})]})}),e("main",{children:a.length>0?e(D,{children:[e("ul",{class:"link-list",children:a.map(d=>e("li",{children:e(fe,{to:o?`/${o}/t/${d.name}`:`/t/${d.name}`,children:[e(I,{icon:"hashtag",alt:"#"})," ",e("span",{children:d.name})]})}))}),a.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(h,{id:"2S/uvJ",values:{0:a.length}})})})]}):s==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):s==="error"?e("p",{class:"ui-state",children:e(h,{id:"2AeREO"})}):e("p",{class:"ui-state",children:e(h,{id:"vKsGhk"})})})]})})}const Nl=20;function Ui({title:n,path:i,id:o,...s}){const{_:c}=ae();Qe(n||c({id:"following.title"}),i||"/following");const{masto:a,streaming:p,instance:d,client:l}=se(),[r,u]=R(p),m=Ge(E),f=q(),v=q(),y=q();G(()=>{!p&&l?.onStreamingReady&&l.onStreamingReady(g=>{u(g)})},[l]),__BENCHMARK.end("time-to-following");const S=Xe("@pixelfed/home-include-reblogs");async function k(g){(g||!v.current)&&(__BENCHMARK.start("fetch-home-first"),f.current=a.v1.timelines.home.list({limit:Nl}),v.current=f.current.values()),S&&f.current?.params&&(typeof f.current.params=="string"?f.current.params+="&include_reblogs=true":f.current.params.include_reblogs=!0);const _=await v.current.next();let{value:w}=_;if(w?.length){let A=!1;g&&(w[0].id!==y.current&&(A=!0),y.current=w[0].id),w.forEach(C=>{Je(C,d)}),w=ps(w,d),g&&A&&Yr(),setTimeout(()=>{po(w,d)},100),w.sort((C,T)=>Date.parse(T.createdAt)-Date.parse(C.createdAt))}return __BENCHMARK.end("fetch-home-first"),{..._,value:w}}async function b(){try{const g={limit:5,since_id:y.current};Xe("@pixelfed/home-include-reblogs")&&(g.include_reblogs=!0);const _=await a.v1.timelines.home.list(g).values().next();let{value:w}=_;const A=w[0]?.id===y.current;return!!(w?.length&&!A&&(y.current=w[0].id,w=ps(w,d),w=qt(w,"home"),w.some(C=>!C.reblog)))}catch{return!1}}return G(()=>{let g;return(async()=>{if(r){g=r.user.subscribe();for await(const _ of g){if(!g)break;if(_.event==="status.update"){const w=_.payload;Je(w,d)}else if(_.event==="delete"){const w=_.payload,A=Ns(w,d);A&&(A._deleted=!0)}}}})(),()=>{g?.unsubscribe?.(),g=null}},[r]),e(Et,{title:n||c({id:"following.title"}),id:o||"following",emptyText:c({id:"nJEKbY"}),errorText:c({id:"7QSeK6"}),instance:d,fetchItems:k,checkForUpdates:b,useItemID:!0,boostsCarousel:m.settings.boostsCarousel,...s,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Pl=20,Dl=4,ys=Dl+1;function vo({media:n,columnMode:i,...o}){const{_:s}=ae();let{hashtag:c,...a}=i?{}:Pt();o.hashtag&&(c=o.hashtag);let p=c.trim().split(/[\s+]+/);p.sort(),c=p[0];const[d,l]=bt(),r=n||!!d.get("media"),u=r?"?media=1":"",{masto:m,instance:f,authenticated:v}=se({instance:o?.instance||a.instance}),{masto:y,instance:S,authenticated:k}=se(),b=p.map($=>`#${$}`).join(" "),g=s(f?r?{id:"kH0rA0",values:{hashtagTitle:b,instance:f}}:{id:"IK0zKi",values:{hashtagTitle:b,instance:f}}:r?{id:"hHSI3w",values:{hashtagTitle:b}}:{id:"+ZzjRY",values:{hashtagTitle:b}});Qe(g,"/:instance?/t/:hashtag");const _=q(),w=ke(()=>Si(),[]),A=q(void 0);async function C($){const ie=await m.v1.timelines.tag.$select(c).list({limit:Pl,any:p.slice(1),maxId:$?void 0:A.current,onlyMedia:r?!0:void 0}).values().next();let{value:Y}=ie;return Y?.length&&($&&(_.current=Y[0].id),Y.forEach(ee=>{Je(ee,f,{skipThreading:r||w})}),A.current=Y[Y.length-1].id),{...ie,value:Y}}async function T(){try{const $=await m.v1.timelines.tag.$select(c).list({limit:1,any:p.slice(1),since_id:_.current,onlyMedia:r}).values().next();let{value:ie}=$;const Y=ie[0]?.id===_.current;return ie?.length&&!Y?(ie=qt(ie,"public"),!0):!1}catch{return!1}}const[L,M]=R("default"),[H,F]=R();G(()=>{(async()=>{try{const $=await m.v1.tags.$select(c).fetch();F($)}catch{}})()},[c]);const U=p.length>=ys,[W,Q]=R("default"),[V,j]=R([]),[K,pe]=R(!1);return G(()=>{v&&(async()=>{try{const $=await m.v1.featuredTags.list();j($),pe($.some(ie=>ie.name.toLowerCase()===c.toLowerCase()))}catch{}})()},[]),e(D,{children:[e(Et,{title:g,titleComponent:!!f&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:b}),e("div",{children:f})]}),id:"hashtag",instance:f,emptyText:s({id:"CNSLAW"}),errorText:s({id:"yjj6Ll"}),fetchItems:C,checkForUpdates:T,useItemID:!0,view:r||w?"media":void 0,refresh:r,filterContext:"public",headerEnd:e(rt,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:s({id:"2FYpfJ"})})}),children:[!!H&&p.length===1&&e(D,{children:[e(ft,{subMenu:!0,confirm:H.following,confirmLabel:s({id:"ctJi7k",values:{hashtag:c}}),disabled:L==="loading"||!v,onClick:()=>{M("loading"),H.following?m.v1.tags.$select(c).unfollow().then(()=>{F({...H,following:!1}),le(s({id:"doK/ij",values:{hashtag:c}}))}).catch($=>{alert($)}).finally(()=>{M("default")}):m.v1.tags.$select(c).follow().then(()=>{F({...H,following:!0}),le(s({id:"R9+aEN",values:{hashtag:c}}))}).catch($=>{alert($)}).finally(()=>{M("default")})},children:H.following?e(D,{children:[e(I,{icon:"check-circle"})," ",e("span",{children:e(h,{id:"HOSk7R"})})]}):e(D,{children:[e(I,{icon:"plus"})," ",e("span",{children:e(h,{id:"MKEPCY"})})]})}),e(ge,{type:"checkbox",checked:K,disabled:W==="loading"||!v,onClick:()=>{if(Q("loading"),K){const $=V.find(ie=>ie.name.toLowerCase()===c.toLowerCase()).id;$?m.v1.featuredTags.$select($).remove().then(()=>{pe(!1),le(s({id:"VH+Tf9"})),j(V.filter(ie=>ie.id!==$))}).catch(ie=>{}).finally(()=>{Q("default")}):le(s({id:"3OLv47"}))}else m.v1.featuredTags.create({name:c}).then($=>{pe(!0),le(s({id:"9ra4hn"})),j(V.concat($))}).catch($=>{}).finally(()=>{Q("default")})},children:K?e(D,{children:[e(I,{icon:"check-circle"}),e("span",{children:e(h,{id:"9ra4hn"})})]}):e(D,{children:[e(I,{icon:"check-circle"}),e("span",{children:e(h,{id:"UlJ3QN"})})]})}),e(He,{})]}),!w&&e(D,{children:[e(xi,{className:"plain",children:e(h,{id:"cSev+j"})}),e(ge,{type:"checkbox",checked:!!r,onClick:()=>{r?d.delete("media"):d.set("media","1"),l(d)},children:[e(I,{icon:"check-circle",alt:"☑️"})," ",e("span",{class:"menu-grow",children:e(h,{id:"eK4SL/"})})]}),e(He,{})]}),e(yc,{className:"menu-field",disabled:U,children:({ref:$})=>e("form",{onSubmit:ie=>{ie.preventDefault();const Y=ie.target[0].value?.trim?.();Y&&!p.some(ee=>ee.toLowerCase()===Y.toLowerCase())&&(p.push(Y),p.sort(),location.hash=f?`/${f}/t/${p.join("+")}${u}`:`/t/${p.join("+")}${u}`)},children:[e(I,{icon:"hashtag"}),e("input",{ref:$,type:"text",placeholder:U?ue._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:ys}}):s({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:U,dir:"auto"})]})}),e(bc,{takeOverflow:!0,children:p.map(($,ie)=>e(ge,{disabled:p.length===1,onClick:Y=>{p.splice(ie,1),p.sort(),location.hash=f?`/${f}/t/${p.join("+")}${u}`:`/t/${p.join("+")}${u}`},children:[e(I,{icon:"x",alt:s({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),$]})]},$))}),e(He,{}),e(ge,{disabled:!k,onClick:()=>{if(E.shortcuts.length>=At){alert(ue._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:At}}));return}const $={type:"hashtag",hashtag:p.join(" "),instance:f,media:r?"on":void 0};E.shortcuts.some(Y=>Y.type===$.type&&Y.hashtag.split(/[\s+]+/).sort().join(" ")===$.hashtag.split(/[\s+]+/).sort().join(" ")&&(Y.instance?Y.instance===$.instance:!0)&&(Y.media?!!Y.media==!!$.media:!0))?alert(s({id:"kfeQnS"})):(E.shortcuts.push($),le(s({id:"MIhb91"})))},children:[e(I,{icon:"shortcut"})," ",e("span",{children:e(h,{id:"i02Lq/"})})]}),e(ge,{onClick:()=>{let $=prompt(s({id:"2MQ2cd"}));if(!/\./.test($)){$&&alert(s({id:"7WddtO"}));return}$&&($=$.toLowerCase().trim(),location.hash=`/${$}/t/${p.join("+")}${u}`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(h,{id:"Sq04Yc"})})]}),S!==f&&e(ge,{onClick:()=>{location.hash=`/${S}/t/${p.join("+")}${u}`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(h,{id:"iAzCp4",values:{currentInstance:S},components:{0:e("b",{})}})})]})]})},f+b),!i&&!!p?.length&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`${p.length>1?`
`:" "}${b}`}})})]})}const Ol=20;function yo(n){const{_:i}=ae(),o=Ge(E),{masto:s,instance:c}=se(),a=n?.id||Pt()?.id,p=q(),d=q();async function l(g){(g||!d.current)&&(d.current=s.v1.timelines.list.$select(a).list({limit:Ol}).values());const _=await d.current.next();let{value:w}=_;return w?.length&&(g&&(p.current=w[0].id),w.forEach(A=>{Je(A,c)})),{..._,value:w}}async function r(){try{const g=await s.v1.timelines.list.$select(a).list({limit:1,since_id:p.current});let{value:_}=g;const w=_[0]?.id===p.current;return _?.length&&!w?(_=qt(_,"home"),!0):!1}catch{return!1}}const[u,m]=R([]),[f,v]=R({title:"List"});Qe(f.title,"/l/:id"),G(()=>{(async()=>{try{const g=await so(a);v(g)}catch{}})()},[a]);const[y,S]=R(!1),[k,b]=R(!1);return e(D,{children:[e(Et,{title:f.title,id:"list",emptyText:i({id:"KkDhfU"}),errorText:i({id:"7QSeK6"}),instance:c,fetchItems:l,checkForUpdates:r,useItemID:!0,boostsCarousel:o.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(rt,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(I,{icon:"list",size:"l",alt:i({id:"h16FyT"})}),e(I,{icon:"chevron-down",size:"s"})]}),onMenuChange:g=>{g.open&&pn().then(m)},children:[e(Ke,{to:"/l",children:e("span",{children:e(h,{id:"BHWx+g"})})}),u?.length>0&&e(D,{children:[e(He,{}),u.map(g=>e(Ke,{to:`/l/${g.id}`,children:e("span",{children:[g.title,g.exclusive&&e(D,{children:[" ",e(Kt,{})]})]})},g.id))]})]}),headerEnd:e(rt,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[f?.exclusive&&e(D,{children:[e(xi,{className:"plain",children:[e(Kt,{})," ",e(h,{id:"FNptcJ"})]}),e(He,{})]}),e(ge,{onClick:()=>S({list:f}),children:[e(I,{icon:"pencil",size:"l"}),e("span",{children:e(h,{id:"ePK91l"})})]}),e(ge,{onClick:()=>b(!0),children:[e(I,{icon:"group",size:"l"}),e("span",{children:e(h,{id:"hB02vO"})})]})]})},a),y&&e(qe,{onClick:g=>{g.target===g.currentTarget&&S(!1)},children:e(zi,{list:y?.list,onClose:g=>{g.state==="success"&&g.list?v(g.list):g.state==="deleted"&&(location.hash="/l"),S(!1)}})}),k&&e(qe,{onClick:g=>{g.target===g.currentTarget&&b(!1)},children:e(Fl,{listID:a,onClose:()=>b(!1)})})]})}const zl=40;function Fl({listID:n,onClose:i}){const{_:o}=ae(),{masto:s,instance:c}=se(),[a,p]=R([]),[d,l]=R("default"),[r,u]=R(!1),m=q();async function f(v){u(!1),l("loading"),(async()=>{try{(v||!m.current)&&(m.current=s.v1.lists.$select(n).accounts.list({limit:zl}).values());const y=await m.current.next();let{done:S,value:k}=y;k?.length?(p(v?k:a.concat(k)),u(!S)):u(!1),l("default")}catch{l("error")}})()}return G(()=>{f(!0)},[]),e("div",{class:"sheet",id:"list-manage-members-container",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(h,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[a.map(v=>e("li",{children:[e(ut,{account:v,instance:c}),e(Bl,{account:v,listID:n})]},v.id)),r&&d==="default"&&e(Tt,{as:"li",onChange:v=>v&&f(),children:e("button",{type:"button",class:"light block",onClick:f,children:e(h,{id:"uXRAkV"})})})]})})]})}function Bl({account:n,listID:i}){const{_:o}=ae(),{masto:s}=se(),[c,a]=R("default"),[p,d]=R(!1);return e(ft,{confirm:!p,confirmLabel:e("span",{children:e(h,{id:"j5n9Ry",values:{0:n.username},components:{0:e("span",{class:"bidi-isolate"})}})}),align:"end",menuItemClassName:"danger",onClick:()=>{p?(a("loading"),(async()=>{try{await s.v1.lists.$select(i).accounts.create({accountIds:[n.id]}),a("default"),d(!1)}catch{a("error")}})()):(a("loading"),(async()=>{try{await s.v1.lists.$select(i).accounts.remove({accountIds:[n.id]}),a("default"),d(!0)}catch{a("error")}})())},children:e("button",{type:"button",class:`light ${p?"":"danger"}`,disabled:c==="loading",children:o(p?{id:"m16xKo"}:{id:"MWIaew"})})})}const ql={mention:["account","status"],quote:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]},Ul=["favourite","reblog","follow"],bo=n=>Ul.includes(n);function wo(n){return n.filter(i=>{const{type:o,id:s,createdAt:c}=i;if(!o)return!1;const a=ql[o];return a?.length?a.every(p=>!!i[p]):!0})}function ko(n){if(n?.notificationGroups){const{accounts:i=[],notificationGroups:o=[],statuses:s=[]}=n;return o.map(c=>{const{sampleAccountIds:a,statusId:p}=c,d=a?.map(r=>i.find(u=>u.id===r))||[],l=s?.find(r=>r.id===p)||null;return{...c,sampleAccounts:d,status:l}})}return n}function Kl(n){const i=n.map(p=>{const{latestPageNotificationAt:d,mostRecentNotificationId:l,sampleAccounts:r,notificationsCount:u}=p;return{id:""+l,createdAt:d,account:r[0],...p}}),o={},s=[];for(let p=0;p<i.length;p++){const d=i[p],{type:l,status:r,createdAt:u,notificationsCount:m,sampleAccounts:f,groupKey:v}=d,y=u?new Date(u).toLocaleDateString():"";let S=l;!(m>0&&f?.length>0&&m>f?.length)&&(l==="favourite"||l==="reblog")&&(S="favourite+reblog");const b=`${r?.id}-${S}-${y}`,g=o[b];if(!bo(l))s.push(d);else if(g)f.forEach(_=>{const w=g.sampleAccounts.find(A=>A.id===_.id);w?(w._types.push(l),w._types.sort().reverse()):g.sampleAccounts.push({..._,_types:[l]})}),g.notificationsCount=Math.min(g.notificationsCount,m),g._notificationsCount.push(m),g._sampleAccountsCount.push(f?.length),g._accounts=g.sampleAccounts,g._groupKeys.push(v);else{const _=f.map(w=>({...w,_types:[l]}));o[b]={...d,sampleAccounts:_,type:S,_accounts:_,_groupKeys:v?[v]:[],_notificationsCount:[m],_sampleAccountsCount:[f?.length]},s.push(o[b])}}const c={},a=[];for(let p=0;p<s.length;p++){const d=s[p],{type:l,account:r,_accounts:u,sampleAccounts:m,createdAt:f,groupKey:v}=d,y=f?new Date(f).toLocaleDateString():"",S=m?.length===1||u?.length===1;if((l==="favourite"||l==="reblog"||l==="favourite+reblog")&&S){const k=`${r?.id}-${l}-${y}`,b=c[k];if(b)b._statuses.push(d.status),b._ids+=`-${d.id}`,b._groupKeys.push(v);else{let g=c[k]={...d,type:l,_ids:d.id,_statuses:[d.status],_groupKeys:v?[v]:[]};a.push(g)}}else a.push(d)}return a}function Hl(n){n=wo(n);const i={},o=[];for(let a=0,p=0;a<n.length;a++){const d=n[a],{id:l,status:r,account:u,type:m,createdAt:f}=d,v=f?new Date(f).toLocaleDateString():"";let y=m;(m==="favourite"||m==="reblog")&&(y="favourite+reblog");const S=`${r?.id}-${y}-${v}`,k=i[S];if(!bo(m))o[p++]=d;else if(k?.account){const b=k._accounts.find(g=>g.id===u.id);b?(b._types.push(m),b._types.sort().reverse(),k._ids+=`-${l}`):(u._types=[m],k._accounts.push(u),k._ids+=`-${l}`)}else{u&&(u._types=[m]);let b=i[S]={...d,type:y,_ids:l,_accounts:u?[u]:[]};o[p++]=b}}const s={},c=[];for(let a=0,p=0;a<o.length;a++){const d=o[a],{id:l,account:r,_accounts:u,type:m,createdAt:f}=d,v=f?new Date(f).toLocaleDateString():"";if(m==="favourite+reblog"&&r&&u.length===1){const y=`${r?.id}-${m}-${v}`,S=s[y];if(S)S._statuses.push(d.status),S._ids+=`-${l}`;else{let k=s[y]={...d,type:m,_ids:l,_statuses:[d.status]};c[p++]=k}}else c[p++]=d}return c}const bs=20,jl=new URLSearchParams;function So({columnMode:n,...i}){const{_:o}=ae(),{masto:s,instance:c}=se(),[a]=n?[jl]:bt(),[p,d]=R(null),l=i?.type||a.get("type")||p;Qe(o(l==="private"?{id:"2BApYc"}:{id:"/bZzdR"}),"/mentions");const r=q(),u=q();async function m(g){(g||!r.current)&&(r.current=s.v1.notifications.list({limit:bs,types:["mention"]}).values());const _=await r.current.next();let{value:w}=_;return w?.length&&(w=wo(w),g&&(u.current=w[0].id),w.forEach(({status:A})=>{Je(A,c)})),{..._,value:w?.map(A=>A.status)}}const f=q(),v=q();async function y(g){(g||!f.current)&&(f.current=s.v1.conversations.list({limit:bs}).values());const _=await f.current.next();let{value:w}=_;return w=w?.filter(A=>A.lastStatus),w?.length&&(g&&(v.current=w[0].lastStatus.id),w.forEach(({lastStatus:A})=>{Je(A,c)})),{..._,value:w?.map(A=>A.lastStatus)}}function S(...g){return l==="private"?y(...g):m(...g)}async function k(){if(l==="private")try{const g=await s.v1.conversations.list({limit:1,since_id:v.current}).values().next();let{value:_}=g;const w=_[0]?.id===v.current;return _?.length&&!w?(v.current=_[0].lastStatus.id,!0):!1}catch{return!1}else try{const g=await s.v1.notifications.list({limit:1,types:["mention"],since_id:u.current}).values().next();let{value:_}=g;return _?.length?(u.current=_[0].id,!0):!1}catch{return!1}}const b=ke(()=>e("div",{class:"filter-bar centered",children:[e(fe,{to:"/mentions",class:l?"":"is-active",onClick:g=>{n&&(g.preventDefault(),d(null))},children:e(h,{id:"N40H+G"})}),e(fe,{to:"/mentions?type=private",class:l==="private"?"is-active":"",onClick:g=>{n&&(g.preventDefault(),d("private"))},children:e(h,{id:"zwBp5t"})})]}),[l]);return e(Et,{title:o({id:"/bZzdR"}),id:"mentions",emptyText:o({id:"03jFGT"}),errorText:o({id:"pqR9KF"}),instance:c,fetchItems:S,checkForUpdates:k,useItemID:!0,timelineStart:b,refresh:l,filterContext:"notifications"})}const Yl=80,Vl=20,Gl=new URLSearchParams,yn={block:"center",inline:"center",behavior:"smooth"},Co=Ci(()=>bi()?.mastodon>=2,{maxAge:1e3*60*5});function _o(n={}){const{masto:i}=se();return E.settings.groupedNotificationsAlpha&&Co()?i.v2.notifications.list({limit:Vl,...n}):i.v1.notifications.list({limit:Yl,...n})}function Io(n={}){return _o(n).values()}function Ao(n){return E.settings.groupedNotificationsAlpha&&Co()?Kl(n):Hl(n)}const Wl=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],Zl={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function Xl({columnMode:n}){const{_:i,_:o}=ae();Qe(o({id:"iDNBZe"}),"/notifications");const{masto:s,instance:c}=se(),a=Ge(E),[p,d]=R("default"),[l]=n?[Gl]:bt(),r=l.get("id"),u=l.get("access_token"),[m,f]=R(!1),[v,y]=R(!1),S=q(),{nearReachEnd:k,scrollDirection:b,reachStart:g,nearReachStart:_}=Vr({scrollableRef:S}),w=b==="end"&&!_,[A,C]=R([]),[T,L]=R([]),M=q(),H=q();async function F(P){if((P||!H.current)&&(M.current=_o({excludeTypes:["follow_request"]}),H.current=M.current.values()),/max_id=($|&)/i.test(H.current?.nextParams))return{done:!0};const be=await H.current.next(),Be=ko(be.value);if(Be?.length){Be.forEach(N=>{Je(N.status,c,{skipThreading:!0})});const De=Ao(Be);P?(E.notificationsLast=De[0],E.notifications=De,s.v1.markers.create({notifications:{lastReadId:De[0].id}}).catch(()=>{})):E.notifications.push(...De)}return E.notificationsShowNew=!1,E.notificationsLastFetchTime=Date.now(),be}async function U(){try{return await s.v1.followRequests.list({limit:80})}catch{return[]}}const W=()=>{d("loading"),(async()=>{try{const P=await U();C(P),d("default")}catch{d("error")}})()};async function Q(){try{return await s.v1.announcements.list()}catch{return[]}}const V=Xe("@mastodon/filtered-notifications"),[j,K]=R(!1),[pe,$]=R({});function ie(){return s.v2.notifications.policy.fetch().catch(()=>{})}function Y(){ie().then(P=>{$(P)}).catch(()=>{})}const[ee,he]=R(null);function re(){return s.v1.notifications.requests.list()}const J=P=>{ve(!1),d("loading"),(async()=>{try{const be=F(P);P&&(Q().then(De=>{De.sort((N,ce)=>Date.parse(ce.updatedAt||ce.createdAt)-Date.parse(N.updatedAt||N.createdAt)),L(De)}).catch(()=>{}),U().then(De=>{C(De)}).catch(()=>{}),V&&Y());const{done:Be}=await be;f(!Be),d("default")}catch{d("error")}})()};G(()=>{J(!0)},[]),G(()=>{g&&J(!0)},[g]);const[Ce,ve]=R(!1),ye=tt(({disableIdleCheck:P=!1}={})=>{p!=="loading"&&a.settings.autoRefresh&&S.current?.scrollTop<16&&(P||window.__IDLE__)&&!Jl()&&J(!0)},[a.notificationsShowNew,a.settings.autoRefresh,p]),Ne=q();Xt(P=>{if(P){const be=Date.now()-Ne.current;!Ne.current||be>1e3*3?ye({disableIdleCheck:!0}):Ne.current=Date.now()}});const Se=q(!0);G(()=>{let P=Yo(E,"notificationsShowNew",be=>{if(Se.current){Se.current=!1;return}p!=="loading"&&(be&&ye(),ve(be))});return()=>P?.()},[]);const Ae=new Date,xe=new Date(Ae-24*60*60*1e3);let Pe=new Date;const ze=!a.notifications.some(P=>new Date(P.createdAt).toDateString()===Ae.toDateString()),Fe=q();G(()=>{r&&(E.routeNotification={id:r,accessToken:atob(u)})},[r,u]);const[Ye,oe]=R(null);G(async()=>{const P=new Date;if(P.getMonth()!==11||!Xe("@mastodon/annual-report"))return;let be=Te.account.get("annualReportNotification");if(be){oe(be);return}const Be=Io({types:["annual_report"]});try{be=(await Be.next())?.value?.notificationGroups?.[0],be?.annualReport?.year==P.getFullYear()&&(oe(be),Te.account.set("annualReportNotification",be))}catch{}},[]);const Le=".notification",Re=Ue("j",()=>{const P=document.activeElement.closest(Le),be=P?.getBoundingClientRect(),Be=Array.from(S.current.querySelectorAll(Le));if(P&&be.top<S.current.clientHeight&&be.bottom>0){const De=Be.indexOf(P);let N=Be[De+1];N&&(N.focus(),N.scrollIntoView(yn))}else{const De=Be.find(N=>{const ce=N.getBoundingClientRect();return ce.top>=44&&ce.left>=0});De&&(De.focus(),De.scrollIntoView(yn))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),z=Ue("k",()=>{const P=document.activeElement.closest(Le),be=P?.getBoundingClientRect(),Be=Array.from(S.current.querySelectorAll(Le));if(P&&be.top<S.current.clientHeight&&be.bottom>0){const De=Be.indexOf(P);let N=Be[De-1];N&&(N.focus(),N.scrollIntoView(yn))}else{const De=Be.find(N=>{const ce=N.getBoundingClientRect();return ce.top>=44&&ce.left>=0});De&&(De.focus(),De.scrollIntoView(yn))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),Ie=Ue(["enter","o"],()=>{const be=document.activeElement.closest(Le)?.querySelector(".status-link");be&&be.click()},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),Me=new Date,Ee=ke(()=>st(Me,{forceOpts:{weekday:"long"}}),[Me]);return e("div",{id:"notifications-page",class:"deck-container",ref:P=>{S.current=P,Re.current=P,z.current=P,Ie.current=P},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${v?"only-mentions":""}`,children:[e("header",{hidden:w,onClick:P=>{P.target.closest("a, button")||S.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:P=>{P.target.closest("a, button")||J(!0)},class:p==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Dt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:o({id:"i0qMbr"})})})]}),e("h1",{children:e(h,{id:"iDNBZe"})}),e("div",{class:"header-side",children:V&&e("button",{type:"button",class:"button plain4",onClick:()=>{K(!0)},children:e(I,{icon:"settings",size:"l",alt:o({id:"a/+arl"})})})})]}),Ce&&p!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{J(!0),S.current?.scrollTo({top:0,behavior:"smooth"})},children:[e(I,{icon:"arrow-up"})," ",e(h,{id:"Jy9RU/"})]})]}),T.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(I,{icon:"announce",class:"announcement-icon",size:"l"})," ",e(h,{id:"0whvLM",values:{0:T.length}})," ",e("small",{class:"insignificant",children:c})]}),T.length>1&&e("span",{class:"announcements-nav-buttons",children:T.map((P,be)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{Fe.current?.children[be].scrollIntoView({behavior:"smooth",block:"nearest"})},children:be+1}))})]}),e("ul",{class:`announcements-list-${T.length>1?"multiple":"single"}`,ref:Fe,children:T.map(P=>e("li",{children:e(Ql,{announcement:P})}))})]})})}),A.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(h,{id:"6Fs1Ba"})}),A.length>5?e("details",{children:[e("summary",{children:e(h,{id:"7dHKu4",values:{0:A.length}})}),e("ul",{children:A.map(P=>e("li",{children:[e(ut,{account:P}),e(pi,{accountID:P.id,onChange:()=>{}})]},P.id))})]}):e("ul",{children:A.map(P=>e("li",{children:[e(ut,{account:P}),e(pi,{accountID:P.id,onChange:()=>{}})]},P.id))})]}),V&&pe?.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 P=>{const{open:be}=P.target;if(be){const Be=await re();he(Be)}},children:[e("summary",{children:e(h,{id:"N3Bq0f",values:{0:pe.summary.pendingRequestsCount}})}),ee?ee?.length>0&&e("ul",{children:ee.map(P=>e("li",{children:[e("div",{class:"request-notifcations",children:[!P.lastStatus?.id&&e(ut,{useAvatarStatic:!0,showStats:!0,account:P.account}),P.lastStatus?.id&&e("div",{class:"last-post",children:e(fe,{class:"status-link",to:`/${c}/s/${P.lastStatus.id}`,children:e(je,{status:P.lastStatus,size:"s",readOnly:!0})})}),e(td,{request:P})]}),e(nd,{request:P,onChange:()=>{J(!0)}})]},P.id))}):e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})})]})})})}),Ye&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e(un,{notification:Ye})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:v,onChange:P=>{y(P.target.checked)}})," ",e(h,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:[e(h,{id:"ecUA8p"})," ",e("small",{class:"insignificant bidi-isolate",children:Ee})]}),ze&&e("p",{class:"ui-state insignificant",children:p==="default"?o({id:"KS7iJH"}):e(D,{children:"…"})}),a.notifications.length?e(Hn.Provider,{value:"notifications",children:a.notifications.filter(P=>P.type!=="follow_request").map(P=>{if(v&&P.type!=="mention")return null;const be=new Date(P.createdAt),Be=be.toDateString()!==Pe.toDateString();Be&&(Pe=be);const De=be.toDateString()===xe.toDateString()?o({id:"y/0uwd"}):st(Pe,{hideTime:!0}),N=st(Pe,{forceOpts:{weekday:"long"}});return e(D,{children:[Be&&e("h2",{class:"timeline-header",children:[e("span",{children:De})," ",e("small",{class:"insignificant bidi-isolate",children:N})]}),e(un,{instance:c,notification:P},P._ids||P.id)]},P._ids||P.id)})}):e(D,{children:[p==="loading"&&e(D,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((P,be)=>e("li",{class:"notification skeleton",children:[e("div",{class:"notification-type",children:e(I,{icon:"notification",size:"xl"})}),e("div",{class:"notification-content",children:e("p",{children:"███████████ ████"})})]}))})}),p==="error"&&e("p",{class:"ui-state",children:[e(h,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>J(!0),children:e(h,{id:"KDw4GX"})})]})]}),m&&e(Tt,{onChange:P=>{P&&J()},children:e("button",{type:"button",class:"plain block",disabled:p==="loading",onClick:()=>J(),style:{marginBlockEnd:"6em"},children:p==="loading"?e(Oe,{abrupt:!0}):e(h,{id:"uXRAkV"})})})]}),V&&j&&e(qe,{onClick:P=>{P.target===P.currentTarget&&K(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>K(!1),children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(h,{id:"a/+arl"})})}),e("main",{children:e("form",{onSubmit:P=>{P.preventDefault();const{forNotFollowing:be,forNotFollowers:Be,forNewAccounts:De,forPrivateMentions:N,forLimitedAccounts:ce}=P.target,x={...pe,forNotFollowing:be.value,forNotFollowers:Be.value,forNewAccounts:De.value,forPrivateMentions:N.value,forLimitedAccounts:ce.value};$(x),K(!1),(async()=>{try{await s.v2.notifications.policy.update(x),le(o({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(h,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:Wl.map(P=>{const be=pe[P];return e("div",{children:e("label",{children:[i(Zl[P]),e("select",{name:P,defaultValue:be,class:"small",children:[e("option",{value:"accept",children:e(h,{id:"g3UF2V"})}),e("option",{value:"filter",children:e(h,{id:"o7J4JM"})}),e("option",{value:"drop",children:e(h,{id:"gbbkE7"})})]})]})},P)})}),e("p",{children:e("button",{type:"submit",children:e(h,{id:"tfDRzk"})})})]})})]})})]})}function Jl(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function Ql({announcement:n}){const{instance:i}=se(),{contact:o}=Ls(),s=o?.account,{id:c,content:a,startsAt:p,endsAt:d,published:l,allDay:r,publishedAt:u,updatedAt:m,read:f,mentions:v,statuses:y,tags:S,emojis:k,reactions:b}=n,g=new Date(u),_=st(g),w=new Date(m),A=st(w);return e("div",{class:"announcement-block",children:[e(ut,{account:s}),e("div",{class:"announcement-content",onClick:qs({mentions:v,instance:i}),dangerouslySetInnerHTML:{__html:li(a,{emojis:k})}}),e("p",{class:"insignificant",children:[e("time",{datetime:g.toISOString(),children:st(g)}),m&&A!==_&&e(D,{children:[" ","•"," ",e("span",{class:"ib",children:e(h,{id:"TbFrLc",values:{0:st(w)},components:{0:e("time",{datetime:w.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:b.map(C=>{const{name:T,count:L,me:M,staticUrl:H,url:F}=C;return e("button",{type:"button",class:`plain4 small ${M?"reacted":""}`,children:[F||H?e("img",{src:F||H,alt:T,width:"16",height:"16"}):e("span",{children:T})," ",e("span",{class:"count",children:We(L)})]})})})]})}function ed(n){const{masto:i}=se();return i.v1.notifications.list({accountID:n})}function td({request:n}){const{instance:i}=se(),[o,s]=R("loading"),{account:c,lastStatus:a}=n,[p,d]=R(!1),[l,r]=R([]);function u(){d(!1)}return G(()=>{n?.account?.id&&p&&(s("loading"),(async()=>{const m=await ed(n.account.id);r(m||[]),s("default")})())},[p,n?.account?.id]),e(D,{children:[e("button",{type:"button",class:"plain4 request-notifications-account",onClick:()=>{d(!0)},children:[e(I,{icon:"notification",class:"more-insignificant"})," ",e("small",{children:e(h,{id:"H0wUNM",values:{0:c.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(I,{icon:"chevron-down"})]}),p&&e(qe,{onClick:m=>{m.target===m.currentTarget&&u()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:u,children:e(I,{icon:"x",alt:t`Close`})}),e("header",{children:e("b",{children:e(h,{id:"MXOmPt",values:{0:c.username},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:o==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):l.map(m=>e("div",{class:"notification-peek",onClick:f=>{const{target:v}=f;(f.target.tagName==="BUTTON"||f.target.tagName==="A")&&u()},children:e(un,{instance:i,notification:m,isStatic:!0})}))})]})})]})}function nd({request:n,onChange:i}){const{_:o}=ae(),{masto:s}=se(),[c,a]=R("default"),[p,d]=R(null),l=p!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:c==="loading"||l,onClick:()=>{a("loading"),(async()=>{try{await s.v1.notifications.requests.$select(n.id).accept(),d("accept"),a("default"),i({request:n,state:"accept"}),le(o({id:"ZtBMwU",values:{0:n.account.username}}))}catch{a("error"),le(o({id:"S92JKG"}))}})()},children:e(h,{id:"h7peZQ"})})," ",e("button",{type:"button",disabled:c==="loading"||l,class:"light danger",onClick:()=>{a("loading"),(async()=>{try{await s.v1.notifications.requests.$select(n.id).dismiss(),d("dismiss"),a("default"),i({request:n,state:"dismiss"}),le(o({id:"ibBDry",values:{0:n.account.username}}))}catch{a("error"),le(o({id:"S5aemF"}))}})()},children:e(h,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:c==="loading"?e(Oe,{abrupt:!0}):p==="accept"?e(I,{icon:"check-circle",alt:o({id:"bzMKg7"}),class:"notification-accepted"}):p==="dismiss"&&e(I,{icon:"x-circle",alt:o({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const To=lt(Xl),id=20;function fi({local:n,columnMode:i,...o}){const{_:s}=ae(),c=Ge(E),a=!!n,p=i?{}:Pt(),{masto:d,instance:l}=se({instance:o?.instance||p.instance}),{masto:r,instance:u}=se(),m=s(a?{id:"u96B/B",values:{instance:l}}:{id:"PgVqvd",values:{instance:l}});Qe(m,a?"/:instance?/p/l":"/:instance?/p");const f=q(),v=q();async function y(k){if(k||!v.current){const _={limit:id,local:a||void 0};!a&&Xe("@pixelfed/global-feed")&&(_.remote=!0),v.current=d.v1.timelines.public.list(_).values()}const b=await v.current.next();let{value:g}=b;return g?.length&&(k&&(f.current=g[0].id),g.forEach(_=>{Je(_,l)})),{...b,value:g}}async function S(){try{const k=await d.v1.timelines.public.list({limit:1,local:a,since_id:f.current}).values().next();let{value:b}=k;const g=b[0]?.id===f.current;return b?.length&&!g?(b=qt(b,"public"),!0):!1}catch{return!1}}return e(Et,{title:m,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:s(a?{id:"pJQgQV"}:{id:"cg0I+x"})}),e("div",{children:l})]}),id:"public",instance:l,emptyText:s({id:"BiZJ6G"}),errorText:s({id:"scd9lw"}),fetchItems:y,checkForUpdates:S,useItemID:!0,headerStart:e(D,{}),boostsCarousel:c.settings.boostsCarousel,filterContext:"public",headerEnd:e(rt,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:s({id:"2FYpfJ"})})}),children:[e(ge,{href:a?`/#/${l}/p`:`/#/${l}/p/l`,children:a?e(D,{children:[e(I,{icon:"transfer"})," ",e("span",{children:e(h,{id:"dXMiUw"})})]}):e(D,{children:[e(I,{icon:"transfer"})," ",e("span",{children:e(h,{id:"t2B/we"})})]})}),e(He,{}),e(ge,{onClick:()=>{let k=prompt(s({id:"2MQ2cd"}));if(!/\./.test(k)){k&&alert(s({id:"7WddtO"}));return}k&&(k=k.toLowerCase().trim(),location.hash=a?`/${k}/p/l`:`/${k}/p`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(h,{id:"Sq04Yc"})})]}),u!==l&&e(ge,{onClick:()=>{location.hash=a?`/${u}/p/l`:`/${u}/p`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(h,{id:"iAzCp4",values:{currentInstance:u},components:{0:e("b",{})}})})]})]})},l+a)}function sd({onItemClick:n}){const{_:i}=ae(),{instance:o}=se(),[,s]=xt(l=>l+1,0),c=Zn(),a=()=>{Fr(),le({text:i({id:"hgPsUe"}),delay:1e3}),s()},p=(l,r)=>{zr(l,r),s()},[d]=Yn();return c.length===0?null:e("div",{class:"recent-searches",children:[e("div",{class:"recent-searches-header",children:[e(I,{icon:"history"})," ",e("span",{children:e(h,{id:"4R1B1H"})}),e("span",{class:"spacer"}),e("button",{type:"button",class:"plain4 small",onClick:a,disabled:c.length<=0,children:e("span",{children:e(h,{id:"yYxB17"})})})]}),e("ul",{class:"link-list recent-searches-list",ref:d,children:c.map(l=>{const{label:r,to:u,icon:m}=zt(l.query,l.queryType,o);return e("li",{class:"recent-searches-item",children:[e(fe,{to:u,class:"recent-searches-link",onClick:f=>{Tn(l.query,l.queryType),n?.(f)},children:[e(I,{icon:m,class:"more-insignificant"}),e("span",{class:"recent-searches-label",children:r})]}),e("button",{type:"button",class:"plain4 small",onClick:()=>p(l.query,l.queryType),children:e(I,{icon:"trash",alt:i({id:"xCJdfg"})})})]},`${l.query}-${l.queryType}-${l.timestamp}`)})})]})}const bn=5,ri=40,od=new URLSearchParams,wn={block:"nearest",inline:"center",behavior:"smooth"};function xo({columnMode:n,...i}){const{_:o}=ae(),s=n?{}:Pt(),{masto:c,instance:a,authenticated:p}=se({instance:s.instance}),[d,l]=R("default"),[r]=n?[od]:bt(),u=q(),m=i?.query||r.get("q"),f=n?"statuses":i?.type||r.get("type");let v=o({id:"A1taO8"});if(m)switch(f){case"statuses":v=o({id:"6YeoAt",values:{q:m}});break;case"accounts":v=o({id:"fpgumQ",values:{q:m}});break;case"hashtags":v=o({id:"AuiMZZ",values:{q:m}});break;default:v=o({id:"wr3GZI",values:{q:m}})}Qe(v,"/search");const[y,S]=R(!1),k=q(0);G(()=>{k.current=0},[m,f]);const b=q();St(()=>{b.current?.scrollTo?.(0,0)},[m,f]);const[g,_]=R([]),[w,A]=R([]),[C,T]=R([]);G(()=>{_([]),A([]),T([])},[m]);const L={statuses:g,accounts:w,hashtags:C},M={statuses:_,accounts:A,hashtags:T},[H,F]=R({}),U=async $=>{if(!$?.length)return;const ie=await Kn($,H);ie&&F({...H,...ie})};function W($){$&&(k.current=0),!(!$&&!p)&&(l("loading"),$&&!f&&(_(g.slice(0,bn)),A(w.slice(0,bn)),T(C.slice(0,bn))),(async()=>{const ie={q:m,resolve:p,limit:bn};f&&(ie.limit=ri,ie.type=f,p&&(ie.offset=k.current));try{const Y=await c.v2.search.list(ie);if(f)if($){M[f](Y[f]);const ee=Y[f]?.length;k.current=ri,S(!!ee)}else if(Y[f]?.[0]?.id===L[f]?.[0]?.id)S(!1);else{M[f](he=>[...he,...Y[f]]);const ee=Y[f]?.length;k.current=k.current+ri,S(!!ee)}else _(Y.statuses||[]),A(Y.accounts||[]),T(Y.hashtags||[]),k.current=0,S(!1);U(Y.accounts),l("default")}catch{l("error")}})())}const Q=q();Xt($=>{const ie=b.current?.scrollTop===0;if($&&ie){const Y=Date.now()-Q.current;!Q.current||Y>1e3*3?W(!0):Q.current=Date.now()}}),G(()=>{let $;return u.current?.setValue?.(m||""),m?W(!0):$=setTimeout(()=>{u.current?.focus?.()},150),()=>clearTimeout($)},[m,f,a]),Ue(["Slash","/"],$=>{u.current?.focus?.(),u.current?.select?.()},{useKey:!0,preventDefault:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey});const V=".timeline > li > a, .hashtag-list > li > a",j=Ue("j",()=>{const $=document.activeElement.closest(V),ie=$?.getBoundingClientRect(),Y=Array.from(b.current.querySelectorAll(V));if($&&ie.top<b.current.clientHeight&&ie.bottom>0){const ee=Y.indexOf($);let he=Y[ee+1];he&&(he.focus(),he.scrollIntoView(wn))}else{const ee=Y.find(he=>{const re=he.getBoundingClientRect();return re.top>=44&&re.left>=0});ee&&(ee.focus(),ee.scrollIntoView(wn))}},{useKey:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey}),K=Ue("k",()=>{const $=document.activeElement.closest(V),ie=$?.getBoundingClientRect(),Y=Array.from(b.current.querySelectorAll(V));if($&&ie.top<b.current.clientHeight&&ie.bottom>0){const ee=Y.indexOf($);let he=Y[ee-1];he&&(he.focus(),he.scrollIntoView(wn))}else{const ee=Y.find(he=>{const re=he.getBoundingClientRect();return re.top>=44&&re.left>=0});ee&&(ee.focus(),ee.scrollIntoView(wn))}},{useKey:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey}),[pe]=Yn();return e("div",{id:"search-page",class:"deck-container",tabIndex:"-1",ref:$=>{b.current=$,j.current=$,K.current=$},children:e("div",{class:"timeline-deck deck",children:[e("header",{class:d==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(Dt,{})}),e(ho,{ref:u}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{W(!0)},disabled:d==="loading",children:e(I,{icon:"search",size:"l",alt:o({id:"A1taO8"})})})})]})}),e("main",{children:[!!m&&!n&&e("div",{ref:pe,class:`filter-bar ${d==="loading"?"loading":""}`,children:[!!f&&e(fe,{to:`/search${m?`?q=${encodeURIComponent(m)}`:""}`,children:[e(I,{icon:"chevron-left"})," ",e(h,{id:"N40H+G"})]}),[{label:o({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(m)}&type=accounts`},{label:o({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`},{label:o({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(m)}&type=statuses`}].sort(($,ie)=>$.type===f?-1:ie.type===f?1:0).map($=>e(fe,{to:$.to,children:$.label},$.type))]}),m?e(D,{children:[(!f||f==="accounts")&&e(D,{children:[f!=="accounts"&&e("h2",{class:"timeline-header",children:[e(h,{id:"bPwFdf"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:e(I,{icon:"arrow-right",size:"l",alt:o({id:"V1fa9u"})})})]}),w.length>0?e(D,{children:[e("ul",{class:"timeline flat accounts-list",children:w.map($=>e("li",{children:e(ut,{account:$,instance:a,showStats:!0,relationship:H[$.id]})},$.id))}),f!=="accounts"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:[e(h,{id:"BMmtZ8"})," ",e(I,{icon:"arrow-right"})]})})]}):!f&&(d==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(h,{id:"YYB61U"})}))]}),(!f||f==="hashtags")&&e(D,{children:[f!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(h,{id:"VwUsHI"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:e(I,{icon:"arrow-right",size:"l",alt:o({id:"V1fa9u"})})})]}),C.length>0?e(D,{children:[e("ul",{class:"link-list hashtag-list",children:C.map($=>{const{name:ie,history:Y}=$,ee=Y?.reduce?.((he,re)=>he+ +re.uses,0);return e("li",{children:e(fe,{to:a?`/${a}/t/${ie}`:`/t/${ie}`,children:[e(I,{icon:"hashtag",alt:"#"}),e("span",{children:ie}),!!ee&&e("span",{class:"count",children:We(ee)})]})},`${ie}-${ee}`)})}),f!=="hashtags"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:[e(h,{id:"Nc/W5J"})," ",e(I,{icon:"arrow-right"})]})})]}):!f&&(d==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(h,{id:"4MFM3P"})}))]}),(!f||f==="statuses")&&e(D,{children:[f!=="statuses"&&e("h2",{class:"timeline-header",children:[e(h,{id:"+owNNn"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:e(I,{icon:"arrow-right",size:"l",alt:o({id:"V1fa9u"})})})]}),g.length>0?e(D,{children:[e("ul",{class:"timeline",children:g.map($=>e("li",{children:e(fe,{class:"status-link",to:a?`/${a}/s/${$.id}`:`/s/${$.id}`,children:e(je,{status:$})})},$.id))}),f!=="statuses"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:[e(h,{id:"LYCgej"})," ",e(I,{icon:"arrow-right"})]})})]}):!f&&(d==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(h,{id:"Hzi9AA"})}))]}),!!f&&(d==="default"?y?e(Tt,{onChange:$=>{$&&W()},children:e("button",{type:"button",class:"plain block",onClick:()=>W(),style:{marginBlockEnd:"6em"},children:e(h,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(h,{id:"2EYeAZ"})}):d==="loading"&&e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}))]}):d==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e(D,{children:[e("p",{class:"ui-state insignificant",children:e(h,{id:"fGn1Hk"})}),e(sd,{})]})]})]})})}const cd=20,Eo=10*60*1e3,ad=yt(n=>n.v1.trends.links.list().values().next(),{maxAge:Eo}),rd=yt(n=>n.v1.trends.tags.list().values().next(),{maxAge:Eo});function ld(n){return Xe("@pixelfed/trending")?n.pixelfed.v2.discover.posts.trending.list({range:"daily"}).values():n.v1.trends.statuses.list({limit:cd}).values()}function dd(n,i){return n.v1.timelines.link.list(i).values()}function Ro({columnMode:n,...i}){const{_:o}=ae(),s=Ge(E),c=n?{}:Pt(),{masto:a,instance:p}=se({instance:i?.instance||c.instance}),{masto:d,instance:l}=se(),r=o({id:"cI3UEs",values:{instance:p}});Qe(r,"/:instance?/trending");const u=q(),m=p===l,[f,v]=R([]),[y,S]=R([]),k=q();async function b(Q){if(Q||!k.current){if(k.current=ld(a),Xe("@mastodon/trending-hashtags"))try{const{value:K}=await rd(a);K?.length&&v(K)}catch{}if(Xe("@mastodon/trending-links"))try{const{value:K}=await ad(a,p),pe=K?.filter?.($=>$.type==="link");pe?.length&&S(pe)}catch{}}const V=await k.current.next();let{value:j}=V;return j?.length&&(Q&&(u.current=j[0].id),j.forEach(K=>{Je(K,p)})),{...V,value:j}}const[g,_]=R(!1),w=q(),[A,C]=R(null),T=!!A,L=q(),M=m&&Xe("@mastodon/trending-link-posts");G(()=>{A&&L.current&&L.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[A]);const H=q();async function F(Q){(Q||!w.current)&&(_(!0),w.current=dd(a,{url:A})),H.current=A;const V=await w.current.next();let{value:j}=V;return j?.length&&(j=qt(j,"public"),j.forEach(K=>{Je(K,p)})),H.current===A&&_(!1),{...V,value:j}}async function U(){try{const Q=await a.v1.trends.statuses.list({limit:1}).values().next();let{value:V}=Q;return V=qt(V,"public"),V?.length&&V[0].id!==u.current?(u.current=V[0].id,!0):!1}catch{return!1}}const W=ke(()=>e(D,{children:[!!f.length&&e("div",{class:"filter-bar expandable",children:[e(I,{icon:"chart",class:"insignificant",size:"l"}),f.map((Q,V)=>{const{name:j,history:K}=Q,pe=K.reduce(($,ie)=>$+ +ie.uses,0);return e(fe,{to:`/${p}/t/${j}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),j]}),e("span",{class:"filter-count",children:We(pe)})]},j)})]}),!!y.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(h,{id:"9veeTb"})})}),y.map(Q=>{const{authors:V,authorName:j,authorUrl:K,blurhash:pe,description:$,height:ie,image:Y,imageDescription:ee,language:he,providerName:re,providerUrl:J,publishedAt:Ce,title:ve,url:ye,width:Ne}=Q,Se=V?.[0]?.account?.id?V[0].account:null,Ae=ve.length<30,xe=!!(j||Se),Pe=wi(ye);let ze;if(pe){const Fe=Ti(pe),Ye=Bi(Fe);ze=Fi([.6,Ye[1],Ye[2]])}return e("div",{children:[e("a",{ref:A===ye?L:null,href:ye,target:"_blank",rel:"noopener",class:`link-block ${T?A===ye?"active":"inactive":""}`,style:ze?{"--accent-color":`rgb(${ze.join(",")})`,"--accent-alpha-color":`rgba(${ze.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:Y,alt:ee,width:Ne,height:ie,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Pe})," ",!!Ce&&e(D,{children:"· "}),!!Ce&&e(D,{children:e(Ct,{datetime:Ce,format:"micro"})})]}),!!ve&&e("h1",{class:"title",lang:he,dir:"auto",title:ve,children:ve})]}),!!$&&e("p",{class:`description ${xe&&!Ae?"":"more-lines"}`,lang:he,dir:"auto",title:$,children:$}),xe&&e(D,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(h,{id:"aavdrC",values:{0:Se?e(mt,{account:Se,showAvatar:!0}):K?e("a",{href:K,target:"_blank",rel:"noopener",children:j}):j}})})})]})]})]})}),M&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{C(ye)},disabled:ye===A,children:[e(I,{icon:"comment2"})," ",e("span",{children:e(h,{id:"/bZzdR"})})," ",e(I,{icon:"chevron-down"})]})]},ye)})]}),M&&!!y.length&&e("div",{class:`timeline-header-block ${T?"blended":""}`,children:T?e(D,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:g?e(Oe,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{C(null)},children:e(I,{icon:"x",alt:o({id:"9Q/4xJ"})})})}),e("p",{children:e(h,{id:"BATCqf",values:{0:A.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(h,{id:"Vosm4k"})})})]}),[f,y,A,g]);return e(Et,{title:r,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:e(h,{id:"4/iCqx"})}),e("div",{children:p})]}),id:"trending",instance:p,emptyText:o({id:"6HA9+s"}),errorText:o({id:"scd9lw"}),fetchItems:T?F:b,checkForUpdates:T?void 0:U,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(D,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:"public",timelineStart:W,refresh:A,clearWhenRefresh:!0,view:T?"link-mentions":void 0,headerEnd:e(rt,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:o({id:"2FYpfJ"})})}),children:[e(ge,{onClick:()=>{let Q=prompt(o({id:"2MQ2cd"}));if(!/\./.test(Q)){Q&&alert(o({id:"7WddtO"}));return}Q&&(Q=Q.toLowerCase().trim(),location.hash=`/${Q}/trending`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(h,{id:"Sq04Yc"})})]}),l!==p&&e(ge,{onClick:()=>{location.hash=`/${l}/trending`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(h,{id:"iAzCp4",values:{currentInstance:l},components:{0:e("b",{})}})})]})]})},p)}const ws={block:"nearest",inline:"nearest",behavior:"smooth"};function ud(){const{_:n}=ae();Qe(n({id:"i0qMbr"}),"/");const i=Ge(E),{shortcuts:o}=i,s=o.map(c=>{if(!c)return null;const{type:a,...p}=c,d={following:Ui,notifications:To,list:yo,public:fi,bookmarks:fo,favourites:mo,hashtag:vo,mentions:So,trending:Ro,search:xo}[a];return!d||a==="search"&&!p.query||a==="list"&&!p.id?null:e(d,{...p,columnMode:!0},a+JSON.stringify(p))});return Ue(["1","2","3","4","5","6","7","8","9"],c=>{try{const a=parseInt(c.key,10)-1,p=document.querySelectorAll("#columns > *")[a];p&&(p.focus(),p.scrollIntoView(ws))}catch{}},{useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey}),Ue(["[","]"],(c,a)=>{const p=a.keys[0],d=document.activeElement.closest("#columns > *"),l=Ft(),r=l?"]":"[",u=l?"[":"]";let m;p===r?m=d?d.previousElementSibling:document.querySelectorAll("#columns > *")[0]:p===u&&(m=d?d.nextElementSibling:document.querySelectorAll("#columns > *")[1]),m&&(m.focus(),m.scrollIntoView(ws))},{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(),E.showShortcutsSettings=!0)},onFocus:()=>{const c=document.activeElement.closest("#columns > *");c&&document.querySelectorAll("#columns > *").forEach(a=>{a.classList.toggle("focus",a===c)})},children:s})}function hd(){const{_:n}=ae(),i=Ge(E);return __BENCHMARK.end("time-to-home"),G(()=>{(async()=>{const o=await gt.drafts.keys();if(o.length){const s=$n();o.filter(a=>a.startsWith(s)).length&&(E.showDrafts=!0)}})()},[]),e(D,{children:(i.settings.shortcutsViewMode==="multi-column"||!i.settings.shortcutsViewMode&&i.settings.shortcutsColumnsMode)&&i.shortcuts?.length?e(ud,{}):e(Ui,{title:n({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(pd,{})})})}function pd(){const{_:n}=ae(),i=Ge(E),o=q(),[s,c]=R(void 0);return e(D,{children:[e(fe,{ref:o,to:"/notifications",class:`button plain notifications-button ${i.notificationsShowNew?"has-badge":""} ${s||""}`,onClick:a=>{a.stopPropagation(),window.matchMedia("(min-width: calc(40em))").matches&&(a.preventDefault(),c(p=>p?void 0:"open"))},children:e(I,{icon:"notification",size:"l",alt:n({id:"iDNBZe"})})}),e(md,{state:s,anchorRef:o,onClose:()=>c(void 0)})]})}const fd=5;function md({anchorRef:n,state:i,onClose:o}){const{masto:s,instance:c}=se(),a=Ge(E),[p,d]=R("default"),l=Io();async function r(){const k=await l.next(),b=ko(k.value);if(b?.length){b.forEach(_=>{Je(_.status,c,{skipThreading:!0})});const g=Ao(b);E.notificationsLast=g[0],E.notifications=g,s.v1.markers.create({notifications:{lastReadId:g[0].id}}).catch(()=>{})}return E.notificationsShowNew=!1,E.notificationsLastFetchTime=Date.now(),k}const[u,m]=R(!1);function f(){return s.v1.followRequests.list({limit:1})}function v({skipFollowRequests:k=!1}={}){d("loading"),(async()=>{try{if(await r(),!k){const b=await f();m(!!b?.length)}d("default")}catch{d("error")}})()}const y=q(),S=52;return G(()=>{i==="open"&&(a.notificationsShowNew?y.current?.scrollTop<=S&&v({skipFollowRequests:!0}):v())},[i,a.notificationsShowNew]),e(Ai,{ref:y,menuClassName:"notifications-menu",state:i,anchorRef:n,onClose:o,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(h,{id:"iDNBZe"})})}),e(Hn.Provider,{value:"notifications",children:e("main",{children:a.notifications.length?e(D,{children:a.notifications.slice(0,fd).map(k=>e(un,{instance:c,notification:k,disableContextMenu:!0},k._ids||k.id))}):p==="loading"?e("div",{class:"ui-state",children:e(Oe,{abrupt:!0})}):p==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(h,{id:"5GFQTh"})}),e("p",{children:e("button",{type:"button",onClick:v,children:e(h,{id:"KDw4GX"})})})]})})}),e("footer",{children:[e(fe,{to:"/mentions",class:"button plain",children:[e(I,{icon:"at"})," ",e("span",{children:e(h,{id:"/bZzdR"})})]}),e(fe,{to:"/notifications",class:"button plain2",children:[u?e(h,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(h,{id:"gukqfD"})})," ",e(I,{icon:"arrow-right"})]})]})]})}const gd=lt(hd),vd=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function Lo(n){const i=URL.parse(n);if(!i)return{};const{hostname:o,pathname:s}=i;for(const c of vd){const[,a]=s.match(c)||[];if(a)return{instance:o,id:a}}return{}}function yd(n){const{instance:i,id:o}=Lo(n);return i&&o?`/${i}/s/${o}`:null}function bd(){const i=Qt().pathname.replace(/^\//,""),o=Lo(i),s=o?.instance?`/${o.instance}/s/${o.id}`:null,[c,a]=R("loading");return St(()=>{a("loading"),(async()=>{try{const{instance:p,id:d}=o;if(d){const{masto:l}=se({instance:p});if(await l.v1.statuses.$select(d).fetch()){window.location.hash=s+"?view=full";return}}}catch{}{const{masto:p,instance:d}=se(),l=await p.v2.search.list({q:i,limit:1,resolve:!0});if(l.statuses.length){const r=l.statuses[0];window.location.hash=`/${d}/s/${r.id}?view=full`}else if(l.accounts.length){const r=l.accounts[0];window.location.hash=`/${d}/a/${r.id}`}else s?window.location.hash=s+"?view=full":a("error")}})()},[s]),e("div",{class:"ui-state",tabIndex:"-1",children:[c==="loading"?e(D,{children:[e(Oe,{abrupt:!0}),e("h2",{children:e(h,{id:"RTAr/z"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}):e(D,{children:[e("h2",{children:e(h,{id:"ufzZSJ"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}),e("hr",{}),e("p",{children:e(fe,{to:"/",children:e(h,{id:"iWpEwy"})})})]})}function wd(){const{_:n}=ae();Qe(n({id:"h16FyT"}),"/l");const[i,o]=R("default"),[s,c]=xt(u=>u+1,0),[a,p]=R([]);G(()=>{o("loading"),(async()=>{try{const u=await hi();p(u),o("default")}catch{o("error")}})()},[s]);const[d,l]=R(!1),r=a.some(u=>u.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(Dt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l"})})]}),e("h1",{children:e(h,{id:"h16FyT"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>l(!0),children:e(I,{icon:"plus",size:"l",alt:n({id:"Sb2gYF"})})})})]})}),e("main",{children:a.length>0?e(D,{children:[e("ul",{class:"link-list",children:a.map(u=>e("li",{children:e(fe,{to:`/l/${u.id}`,children:[e(I,{icon:"list"})," ",e("span",{children:[u.title,u.exclusive&&e(D,{children:[" ",e(Kt,{insignificant:!0})]})]})]})}))}),a.length>1&&e("footer",{class:"ui-state",children:[r&&e("p",{children:e("small",{class:"insignificant",children:[e(Kt,{})," ",e(h,{id:"FNptcJ"})]})}),e("p",{children:e("small",{class:"insignificant",children:e(h,{id:"8prZNK",values:{0:a.length}})})})]})]}):i==="loading"?e("p",{class:"ui-state",children:e(Oe,{})}):i==="error"?e("p",{class:"ui-state",children:e(h,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(h,{id:"IvPikw"})})})]}),d&&e(qe,{onClick:u=>{u.target===u.currentTarget&&l(!1)},children:e(zi,{list:d?.list,onClose:u=>{u.state==="success"&&c(),l(!1)}})})]})}const kd=""+new URL("instances-Dd-nff5Z.json",import.meta.url).href,Sd={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:Cd}=Sd;function _d(){const{_:n}=ae();Qe(n({id:"sQia9P"}),"/login");const i=q(),o=Te.local.get("instanceURL"),[s,c]=R("default"),[a]=bt(),p=a.get("instance"),d=a.get("submit"),[l,r]=R(p||o?.toLowerCase()||""),[u,m]=R([]),f=q();G(()=>{(async()=>{try{const w=await(await fetch(kd)).json();m(w),f.current=new wc(w)}catch{}})()},[]);const v=_=>{_&&(async()=>{try{const A=await(await fetch(`https://${_}/.well-known/host-meta`)).text(),M=new DOMParser().parseFromString(A,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),H=URL.parse(M),{host:F}=H;_!==F&&(_=F)}catch{}Te.local.set("instanceURL",_),c("loading");try{let w=Ps(_);(!w||!w.client_id||!w.client_secret)&&(w=await Qc({instanceURL:_}),Vo(_,w));const{client_id:A,client_secret:C}=w,T=await Vc({instanceURL:_}),L=Go(_);if(T)if(A&&C){const[M,H]=await ea({instanceURL:_,client_id:A,forceLogin:L});Te.sessionCookie.set("codeVerifier",H),location.href=M}else alert(n({id:"ZP1FIA"}));else A&&C?location.href=await ta({instanceURL:_,client_id:A,forceLogin:L}):alert(n({id:"ZP1FIA"}));c("default")}catch{c("error")}})()},y=l?l.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,S=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(y)&&!/[\s\/\\@]/.test(y),k=y?f.current?.search(y,{limit:10})?.map(_=>_.item):[],b=S?y:k?.length?k[0]:l?u.find(_=>_.includes(l)):null,g=_=>{_.preventDefault(),v(b)};return d&&G(()=>{v(p||b)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:g,children:[e("h1",{children:[e("img",{src:Pi,alt:"",width:"80",height:"80"}),e("br",{}),e(h,{id:"sQia9P"})]}),e("label",{children:[e("p",{children:e(h,{id:"kyAi7k"})}),e("input",{value:l,required:!0,type:"text",class:"large",id:"instanceURL",ref:i,disabled:s==="loading",autocorrect:"off",autocapitalize:"off",autocomplete:"off",spellCheck:!1,placeholder:n({id:"u3gOdY"}),onInput:_=>{r(_.target.value)},dir:"auto"}),k?.length>0?e("ul",{id:"instances-suggestions",children:k.map((_,w)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{v(_)},children:_})}))}):e("div",{id:"instances-eg",children:e(h,{id:"/OvbEC"})})]}),s==="error"&&e("p",{class:"error",children:e(h,{id:"rmBHZn"})}),e("div",{children:[e("button",{disabled:s==="loading"||!l||!b,children:n(b?{id:"2xahsi",values:{selectedInstanceText:b}}:{id:"xGVfLh"})})," "]}),e(Oe,{hidden:s!=="loading"}),e("hr",{}),!Cd&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(h,{id:"LcOiWS"})})}),e("p",{children:e(fe,{to:"/",children:e(h,{id:"iWpEwy"})})}),e(Di,{})]})})}const Id=40;function Ad(){const{_:n}=ae(),i=Ge(E);Qe(n({id:"+GkIdc"}),"/sp");const{masto:o}=se(),[s,c]=R([]),[a,p]=R("default"),[d,l]=xt(m=>m+1,0),[r,u]=R(!1);return G(l,[i.reloadScheduledPosts]),G(()=>{p("loading"),(async()=>{try{const m=o.v1.scheduledStatuses.list({limit:Id}).values(),f=[];let v;do v=(await m.next()).value,v?.length&&f.push(...v);while(v?.length);c(f)}catch{p("error")}finally{p("default")}})()},[d]),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(Dt,{}),e(fe,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(h,{id:"+GkIdc"})}),e("div",{class:"header-side",children:e(rt,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:n({id:"2FYpfJ"})})}),children:e(ge,{onClick:()=>{l()},children:[e(I,{icon:"refresh",size:"l"}),e("span",{children:e(h,{id:"lCF0wC"})})]})})})]})}),e("main",{children:[s.length?e("ul",{class:"posts-list",children:s.map(m=>{const{id:f,params:v,scheduledAt:y,mediaAttachments:S}=m,{inReplyToId:k,language:b,poll:g,sensitive:_,spoilerText:w,text:A,visibility:C}=v,T={id:f,inReplyToId:k,language:b,mediaAttachments:S,poll:g?{...g,expiresAt:new Date(Date.now()+g.expiresIn*1e3),options:g.options.map(L=>({title:L,votesCount:0}))}:void 0,sensitive:_,spoilerText:w,text:A,visibility:C,content:`<p>${A}</p>`};return e("li",{children:e(Td,{status:T,scheduledAt:y,onClick:()=>{u({post:T,scheduledAt:new Date(y)})}})},f)})}):e("p",{class:"ui-state",children:a==="loading"?e(Oe,{}):n({id:"mZYb1f"})}),r&&e(qe,{onClick:m=>{m.target===m.currentTarget&&u(!1)},children:e(xd,{post:r.post,scheduledAt:r.scheduledAt,onClose:()=>u(!1)})})]})]})})}function Td({status:n,scheduledAt:i,onClick:o}){const s=ke(()=>{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:o,children:[e("div",{class:`post-schedule-meta post-schedule-${s}`,children:[e(I,{icon:s,class:"insignificant"})," ",e("span",{children:e(h,{id:"aEp6lO",values:{0:st(i,{formatOpts:{weekday:"short",second:"numeric"}})},components:{0:e("b",{}),1:e(Ct,{datetime:i}),2:e("small",{})}})})]}),e(je,{status:n,size:"s",previewMode:!0,readOnly:!0})]})}function xd({post:n,scheduledAt:i,onClose:o}){const{masto:s}=se(),{_:c}=ae(),[a,p]=R("default"),[d,l]=R(),r=d&&d.getTime()!==i.getTime(),u=kc(),m=i&&i<=Date.now(),{inReplyToId:f}=n,[v,y]=R(null);return e("div",{id:"scheduled-post-sheet",class:"sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",size:"l",alt:c({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(h,{id:"orjBLU",components:{0:e("b",{}),1:e(Ct,{datetime:i})}}),e("br",{}),e("small",{children:st(i,{formatOpts:{weekday:"short",second:"numeric"}})})]})}),e("main",{tabIndex:"-1",children:[!!v&&e("div",{class:"status-reply",children:e(je,{status:v,size:"s",previewMode:!0,readOnly:!0})}),e(je,{status:n,size:"s",previewMode:!0,readOnly:!0,onMediaClick:(S,k,b,g)=>{S.preventDefault(),E.showMediaModal={mediaAttachments:n.mediaAttachments,mediaIndex:k}}}),e("form",{onSubmit:S=>{S.preventDefault(),p("loading"),(async()=>{try{await s.v1.scheduledStatuses.$select(n.id).update({scheduledAt:d.toISOString()}),le(c({id:"40naR1"})),o(),p("default"),E.reloadScheduledPosts++}catch{p("error"),le(c({id:"ZM3jAs"}))}})()},children:e("footer",{children:[e("div",{class:"row",children:e("span",{children:[e(Sc,{scheduledAt:i,setScheduledAt:S=>{l(S)}})," ",e("small",{class:"ib",children:u})]})}),e("div",{class:"row",children:[e("button",{disabled:!r||a==="loading"||m,children:e(h,{id:"QqW27M"})}),e("span",{class:"grow"}),e(ft,{align:"end",menuItemClassName:"danger",confirmLabel:c({id:"09u3Kk"}),onClick:()=>{p("loading"),(async()=>{try{await se().masto.v1.scheduledStatuses.$select(n.id).remove(),le(c({id:"/zL/Mq"})),o(),p("default"),E.reloadScheduledPosts++}catch{p("error"),le(c({id:"aOh6Md"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:a==="loading"||m,children:e(h,{id:"Jb6/SB"})})})]})]})})]})]})}function Ed(){const{_:n}=ae(),{prevEditedAt:i,nextEditedAt:o,editedAtIndex:s,editHistoryMode:c,editHistoryRef:a,exitEditHistory:p}=js();return c?e("div",{class:"edit-history-controls",children:[e(I,{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||s+1>=a.current.length,children:e(I,{icon:"chevron-left",alt:n({id:"DHhJ7s"})})})," ",a.current.length-s," /"," ",a.current.length," ",e("button",{type:"button",class:"plain4",onClick:()=>{o()},disabled:!c||s<=0,children:e(I,{icon:"chevron-right",alt:n({id:"hXzOVo"})})})]}),e("button",{type:"button",class:"plain3",onClick:()=>{p()},children:e(I,{icon:"exit",alt:n({id:"ydzS9x"})})})]}):null}const Rd={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:ks}=Rd,kn=40,Ld=10,Md=5;let mi={},xn={},En={};function Rn(n){delete xn[n],delete En[n]}const nn={block:"nearest",inline:"center",behavior:"smooth"},Ss=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",Cs=/\/s\//i;function $d(n){const{id:i}=n,{masto:o,instance:s}=se({instance:n.instance}),c=Ge(E),[a,p]=bt(),d=a.get("media"),l=a.get("media-only"),r=parseInt(d||l,10);let u=r>0;const m=a.get("mediaStatusID"),f=Ns(m,s);m&&!f&&(u=!1);const v=u&&!!l,y=at(i,s),[S,k]=R(E.statuses[y]);G(()=>{E.statuses[y]&&k(E.statuses[y])},[y]);const b=ke(()=>{const{prevLocation:C}=E,T=(C?.pathname||"")+(C?.search||""),L=an("/:instance/s/:id",T)||an("/s/:id",T);return!T||L?"/":T},[]);G(()=>{!S&&u&&(async()=>{try{const C=await o.v1.statuses.$select(i).fetch();Je(C,s),k(C)}catch{alert("Unable to load post."),location.hash=b}})()},[u]);const g=m?c.statuses[at(m,s)]?.mediaAttachments:S?.mediaAttachments,_=()=>window.matchMedia("(min-width: calc(40em + 350px))").matches?"large":"small",w=tt(()=>{_()==="small"&&c.prevLocation?history.back():v?location.hash=b:(a.delete("media"),a.delete("mediaStatusID"),p(a))},[v,b,c.prevLocation]),A=tt((C,T,L,M)=>{if(_()==="large"&&!v){w();return}if(u&&document.startViewTransition){const H=L[T],{id:F,blurhash:U,url:W}=H,Q=Cc(F||U||W),j=[...document.querySelectorAll(`.status .media [data-view-transition-name="${Q}"]`)].filter?.(pe=>{const $=pe.getBoundingClientRect();return $.top<window.innerHeight&&$.bottom>0&&$.left<window.innerWidth&&$.right>0}),K=j.length===1?j[0]:j.find(pe=>!!pe.closest(".status-deck"));K?document.startViewTransition(()=>{K.style.viewTransitionName=Q,M?.current&&M.current.querySelectorAll(".media img, .media video")?.forEach($=>{$.style.viewTransitionName=""}),w()}).ready.finally(()=>{K.style.viewTransitionName="",K.dataset.viewTransitioned=Q}):w()}else w()},[u,v]);return G(()=>{let C=setTimeout(()=>{const T=document.querySelector(".carousel");T&&T.focus()},100);return()=>clearTimeout(C)},[v]),G(()=>{const C=document.querySelectorAll(".deck-container");return C.forEach(T=>{T.setAttribute("inert","")}),()=>{C.forEach(T=>{T.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[u?g?.length?e(lo,{mediaAttachments:g,statusID:m||i,instance:s,lang:S?.language,index:r-1,onClose:A}):e("div",{class:"media-modal-container loading",children:e(Oe,{abrupt:!0})}):e(fe,{to:b}),!v&&e(_c,{statusID:i,children:e(Pd,{id:i,instance:n.instance,closeLink:b})})]})}function Nd(n){const{linkable:i,to:o,onClick:s,...c}=n;return i?e(fe,{class:"status-link",to:o,onClick:s,...c}):e("div",{class:"status-focus",tabIndex:0,...c})}function _s(n,i){return Date.parse(n.createdAt)-Date.parse(i.createdAt)}const Is=1e3*60*60*24*30;function Pd({id:n,closeLink:i="/",instance:o}){const{_:s}=ae(),[c,a]=bt(),p=c.get("media"),d=c.get("mediaStatusID"),l=parseInt(p,10)>0,r=q(!E.prevLocation&&(history.length===1||"navigation"in window&&navigation?.entries?.()?.length===1)),[u,m]=R(c.get("view")||r.current?"full":null),f=!!parseInt(c.get("translate")),{masto:v,instance:y}=se({instance:o}),{masto:S,instance:k,authenticated:b}=se(),g=y===k,_=Ge(E),[w,A]=R([]),[C,T]=R("default"),L=q(),M=at(n,y),H=q(0),F=q();G(()=>{F.current?.focus()},[]),G(()=>{const N=Ys(()=>{if(!F.current)return;const{scrollTop:ce}=F.current;C!=="loading"&&(En[n]=ce)},50);return F.current?.addEventListener("scroll",N,{passive:!0}),N(),()=>{N.cancel(),F.current?.removeEventListener("scroll",N)}},[n,C!=="loading"]);const{editHistoryMode:U,initEditHistory:W,editedAtIndex:Q,editHistoryRef:V}=js(),j=q(),K=q(),[pe,$]=R(0),ie=q(null),Y=()=>{if(!ie.current)return;let{ancestors:N,descendants:ce,heroStatus:x}=ie.current;if(U&&ce?.length){const X=V.current[Q],te=Date.parse(X.createdAt),we=V.current[Q-1],$e=we?Date.parse(we.createdAt):null;ce=ce.filter(Ve=>{const ot=Date.parse(Ve.editedAt||Ve.createdAt);return ot>=te&&(!$e||ot<=$e)})}N.sort(_s),ce.sort(_s),H.current=ce?.length||0;const B=new Set;N.forEach(X=>{Je(X,y,{skipThreading:!0}),X.inReplyToId&&!N.find(te=>te.id===X.inReplyToId)&&B.add(X.inReplyToId)});const Z=N.every(X=>X.account.id===x.account.id),ne=[];ce.forEach(X=>{if(Je(X,y,{}),X.inReplyToId&&!ce.find(te=>te.id===X.inReplyToId)&&X.inReplyToId!==x.id&&B.add(X.inReplyToId),X.inReplyToAccountId===X.account.id)ne.push(X);else if(X.inReplyToId===x.id)ne.push(X);else if(!X.inReplyToAccountId&&ne.find(te=>te.id===X.inReplyToId&&te.account.id===x.account.id)&&X.account.id===x.account.id)ne.push(X);else{const te=ce.find(we=>we.id===X.inReplyToId);te&&(te.__replies||(te.__replies=[]),te.__replies.push(X))}}),ne.sort((X,te)=>{const we=x.account.id;return X.account.id===we&&te.account.id!==we?-1:te.account.id===we&&X.account.id!==we?1:0}),B.size;let O=1;function de(X,te){const we=te+1;return we>O&&(O=te),X?.map($e=>({id:$e.id,account:$e.account,repliesCount:$e.repliesCount,content:$e.content,weight:cn($e),level:we,replies:de($e.__replies,we)}))}const _e=ne.map(X=>({id:X.id,account:X.account,accountID:X.account.id,descendant:!0,thread:X.account.id===x.account.id,weight:cn(X),level:1,replies:de(X.__replies,1),createdAt:X.createdAt}));return{allStatuses:[...N.map(X=>({id:X.id,ancestor:!0,isThread:Z,accountID:X.account.id,account:X.account,repliesCount:X.repliesCount,weight:cn(X),createdAt:X.createdAt})),{id:n,accountID:x.account.id,weight:cn(x),createdAt:x.createdAt},..._e],ancestorsIsThread:Z,mappedNestedDescendants:_e}},ee=({reloadHero:N}={})=>{T("loading");let ce;const x=xn[n];if(x){const B=x.filter(Z=>E.statuses[M]);A(B)}else A([{id:n}]);return(async()=>{const B=()=>Gi(()=>v.v1.statuses.$select(n).fetch(),{retries:4}),Z=Gi(()=>v.v1.statuses.$select(n).context.fetch(),{retries:8}),ne=!!_.statuses[M];let O=_.statuses[M];if(!(ne&&!N))try{O=await B(),Je(O,y),await new Promise(de=>{setTimeout(de,100)})}catch{T("error");return}try{const de=await Z,{ancestors:_e}=de;ie.current={...de,heroStatus:O};const{allStatuses:me,ancestorsIsThread:X,mappedNestedDescendants:te}=Y(),we=_e.length&&!X?[]:te.filter(ot=>ot.thread),$e=(X?_e.length:0)+we.length;$e>0&&$e<100&&$($e+1),T("default"),j.current={offsetTop:L.current?.offsetTop,scrollTop:F.current?.scrollTop};const Ve=_e.length||0;Ve>=Se&&Ae(Ve+1),A(me),xn[n]=me,Wo(O,y)}catch{T("error")}})(),K.current=Date.now(),()=>{clearTimeout(ce)}};G(ee,[n,v]),G(()=>{try{const{allStatuses:N}=Y();A(N)}catch{}},[U,Q]);const[he,re]=R(!1);G(()=>{let N=setInterval(()=>{const ce=Date.now();K.current&&ce-K.current>=6e4&&re(!0)},6e4);return()=>{clearInterval(N)}},[]),St(()=>{if(!w.length)return;const N=En[n];if(N)F.current.scrollTop=N;else if(j.current){const ce={offsetTop:L.current?.offsetTop,scrollTop:F.current?.scrollTop},x=ce.offsetTop-j.current.offsetTop+ce.scrollTop;F.current.scrollTop=x}else w.length===1&&(F.current.scrollTop=0);j.current=null},[w]),G(()=>{_.reloadStatusPage<=0||(async()=>{try{const{instanceURL:N}=ki(),ce=`https://${N}/api/v1/statuses/${n}/context`;return await(await caches.open("api")).delete(ce,{ignoreVary:!0}),ee({reloadHero:!0})}catch{}})()},[_.reloadStatusPage]),G(()=>()=>{En={},E.reloadStatusPage=0,xn={},mi={},gi.clear()},[]);const J=_.statuses[M]||_.statuses[n],Ce=ke(()=>{if(!J)return"";const{account:N}=J,ce=document.createElement("div");return ce.innerHTML=N.displayName,ce.innerText.trim()},[J]),ve=ke(()=>{if(!J)return"";let N=Un(J);return N.length>64&&(N=N.slice(0,64)+"…"),N},[J]);Qe(Ce&&ve?`${Ce}: "${ve}"`:s({id:"post.title"}),"/:instance?/s/:id");const ye=ke(()=>{if(!J)return;const{url:N}=J;if(N)return URL.parse(N)?.hostname},[J]),Ne=ke(()=>{if(ye)return ye===y},[ye,y]),[Se,Ae]=R(kn),xe=ke(()=>w.length-Se,[w.length,Se]),Pe=w.some(N=>N.descendant),ze=w.filter(N=>N.ancestor),[Fe,Ye]=R(!0),oe=ke(()=>{if(!L.current||Fe)return null;const{top:N}=L.current.getBoundingClientRect();return N>0?"down":"up"},[Fe]);Ue("esc",()=>{location.hash=i},{enabled:!l,ignoreEventWhen:N=>!!document.querySelector("#modal-container > *")||N.metaKey||N.ctrlKey||N.altKey||N.shiftKey,useKey:!0}),Ue("backspace",()=>{location.hash=i},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),Ue("j",()=>{const N=document.activeElement.closest(".status-link, .status-focus"),ce=N?.getBoundingClientRect(),x=Array.from(F.current.querySelectorAll(Ss));if(N&&ce.top<F.current.clientHeight&&ce.bottom>0){const B=x.indexOf(N);let Z=x[B+1];Z&&(Z.focus(),Z.scrollIntoView(nn))}else{const B=x.find(Z=>{const ne=Z.getBoundingClientRect();return ne.top>=44&&ne.left>=0});B&&(B.focus(),B.scrollIntoView(nn))}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),Ue("k",()=>{const N=document.activeElement.closest(".status-link, .status-focus"),ce=N?.getBoundingClientRect(),x=Array.from(F.current.querySelectorAll(Ss));if(N&&ce.top<F.current.clientHeight&&ce.bottom>0){const B=x.indexOf(N);let Z=x[B-1];Z&&(Z.focus(),Z.scrollIntoView(nn))}else{const B=x.find(Z=>{const ne=Z.getBoundingClientRect();return ne.top>=44&&ne.left>=0});B&&(B.focus(),B.scrollIntoView(nn))}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey}),Ue("x",()=>{const N=document.activeElement.closest(".status-link, .status-focus");if(N){const ce=N.nextElementSibling;ce&&ce.tagName.toLowerCase()==="details"&&(ce.open=!ce.open)}},{useKey:!0,ignoreEventWhen:N=>N.metaKey||N.ctrlKey||N.altKey||N.shiftKey});const[Le,Re]=R(!1),z=q(l?"media+status":"status"),Ie=tt((N,ce,x,B)=>{N.preventDefault(),N.stopPropagation(),a({media:ce+1,mediaStatusID:B.id})},[n]),Me=tt((N,ce)=>{Rn(ce.id)},[]);G(()=>{let N;return d&&l&&(N=setTimeout(()=>{const ce=F.current?.querySelector(`.status-link[href*="/${d}"]`);ce&&ce.scrollIntoView(nn)},400)),()=>{clearTimeout(N)}},[d,l]);const Ee=tt((N,ce)=>{const{id:x,ancestor:B,isThread:Z,descendant:ne,thread:O,replies:de,repliesCount:_e,weight:me,level:X}=N,te=x===n;return e("li",{ref:te?L:null,class:`${B?"ancestor":""} ${ne?"descendant":""} ${O?"thread":""} ${te?"hero":""}`,children:[te?e(D,{children:[e(Tt,{threshold:.1,onChange:$e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Ye($e)})})},class:"status-focus",tabIndex:0,children:e(je,{statusID:x,instance:y,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:f})}),C!=="loading"&&!b?e("div",{class:"post-status-banner",children:[e("p",{children:e(h,{id:"Vyeh4F"})}),e(fe,{to:ks?`/login?instance=${ks}&submit=1`:"/login",class:"button",children:e(h,{id:"sQia9P"})})]}):!g&&e("div",{class:"post-status-banner",children:[e("p",{children:e(h,{id:"j5roNG",values:{instance:y},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:C==="loading",onClick:()=>{T("loading"),(async()=>{try{const $e=await S.v2.search.list({q:J.url,type:"statuses",resolve:!0,limit:1});if($e.statuses.length){const Ve=$e.statuses[0];location.hash=k?`/${k}/s/${Ve.id}`:`/s/${Ve.id}`}else throw new Error("No results")}catch($e){T("default"),alert(s({id:"DnepCE",values:{e:$e}}))}})()},children:[e(I,{icon:"transfer"})," ",e(h,{id:"ejAVrO"})]})]})]}):e(Nd,{linkable:Z||B,to:y?`/${y}/s/${x}`:`/s/${x}`,onClick:()=>{Rn(x)},children:[ce===0&&B?e(Tt,{threshold:.5,onChange:$e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Re($e)})})},children:e(je,{statusID:x,instance:y,withinContext:!0,size:O||B?"m":"s",enableTranslate:!0,onMediaClick:Ie,onStatusLinkClick:Me})}):e(je,{statusID:x,instance:y,withinContext:!0,size:O||B?"m":"s",enableTranslate:!0,onMediaClick:Ie,onStatusLinkClick:Me,showActionsBar:!!ne}),B&&_e>1&&e("div",{class:"replies-link",children:[e(I,{icon:"comment2",alt:s({id:"N8UzTV"})})," ",e("span",{title:_e,children:We(_e)})]})," "]}),ne&&de?.length>0&&e(Mo,{instance:y,replies:de,hasParentThread:O,level:X,accWeight:me,openAll:H.current<Ld,parentLink:{to:y?`/${y}/s/${x}`:`/s/${x}`,onClick:()=>Rn(x)}}),C==="loading"&&te&&!!J?.repliesCount&&!Pe&&e("div",{class:"status-loading",children:e(Oe,{abrupt:J.repliesCount>=3})}),C==="error"&&te&&!!J?.repliesCount&&!Pe&&e("div",{class:"status-error",children:[e(h,{id:"HQJU6W"}),e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{E.reloadStatusPage++},children:e(h,{id:"KDw4GX"})})]})]},x)},[n,y,C,b,g,f,Ie,Me,Pe]),P=ke(()=>{if("navigation"in window&&navigation?.entries){const N=navigation.entries()[navigation.currentEntry.index-1];if(N?.url)return Cs.test(N.url)}return Cs.test(E.prevLocation?.pathname)},[M]),be=ke(()=>{if(!xe)return[];const N=[];function ce(x){N.push(x.id),x.replies&&x.replies.forEach(ce)}return w.slice(Se).forEach(ce),N.map(x=>at(x,y))},[xe,w,Se,y]);function Be(N){if(N<12)return ue._({id:"DqsEm+",values:{months:N}});{const ce=Math.floor(N/12);return ue._({id:"24w+FD",values:{years:ce}})}}const De=ke(()=>{const N=[],ce=w.slice(0,Se);for(let x=0;x<ce.length;x++){const B=ce[x];if(x>0){const Z=ce[x-1],{createdAt:ne,descendant:O,thread:de,id:_e}=B;if(Z?.createdAt&&ne){const me=Date.parse(ne);if(isFinite(me)&&me>Is){const X=Date.parse(Z.createdAt);if(X&&isFinite(X)){const{ancestor:te,id:we}=Z,Ve=~~((me-X)/Is);Ve>0&&N.push(e("li",{style:{"--time-gap-range":Math.min(12,Ve)},class:`time-gap ${te?"ancestor":""} ${O?"descendant":""} ${de?"thread":""}`,children:Be(Ve)},`time-gap-${_e}-${we}`))}}}}N.push(Ee(B,x))}return N},[w,Se,Ee,U,Q]);return G(()=>{let N=setTimeout(()=>{if(!L.current)return;const ce=L.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");ce&&ce.click()},1e3);return()=>clearTimeout(N)},[n]),e(Ic.Provider,{value:pe,children:e("div",{tabIndex:"-1",ref:F,class:`status-deck deck contained ${w.length>1?"padded-bottom":""} ${z.current==="status"&&!r.current?"slide-in":""} ${u?`deck-view-${u}`:""} ${U?"edit-history-mode":""}`,style:U?{"--edit-history-percentage":`${Q/(V.current.length-1)}`}:void 0,onAnimationEnd:N=>{z.current==="status"&&(z.current=null)},children:[e("header",{class:`${C==="loading"?"loading":""}`,onDblClick:N=>{E.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[P&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(I,{icon:"chevron-left",size:"xl",alt:s({id:"iH8pgl"})})}),!Fe&&J&&C!=="loading"?e(D,{children:[e("span",{class:"hero-heading",children:[e(mt,{account:J.account,instance:y,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(Ct,{datetime:J.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:N=>{N.preventDefault(),N.stopPropagation(),L.current.scrollIntoView({behavior:"smooth",block:"start"})},title:s({id:"NCy+Nw"}),children:e(I,{icon:oe==="down"?"arrow-down":"arrow-up"})})]}):e(D,{children:[e(h,{id:"post.title"})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:N=>{N.preventDefault(),N.stopPropagation(),F.current.scrollTo({top:0,behavior:"smooth"})},hidden:!ze.length||Le,title:s({id:"R8CUl0",values:{0:ze.length}}),children:[e(I,{icon:"arrow-up"}),ze.filter((N,ce,x)=>x.findIndex(B=>B.accountID===N.accountID)===ce).slice(0,3).map(N=>e(pt,{url:N.account.avatarStatic||N.account.avatar,alt:N.account.displayName,squircle:N.account?.bot},N.account.id)),ze.length>3&&e(D,{children:[" ",e("span",{class:"insignificant",children:We(ze.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:u==="full"?"":"none"},onClick:()=>{m(null),c.delete("media"),c.delete("media-only"),c.delete("view"),a(c)},title:s({id:"+/xYEI"}),children:e(I,{icon:"layout4",size:"l"})}),he&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{E.reloadStatusPage++,re(!1)},children:e(I,{icon:"refresh",size:"l",alt:s({id:"lCF0wC"})})}),e(rt,{align:"end",portal:{target:F.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(I,{icon:"more",alt:s({id:"2FYpfJ"}),size:"xl"})}),children:[e(ge,{disabled:C==="loading",onClick:()=>{E.reloadStatusPage++},children:[e(I,{icon:"refresh"}),e("span",{children:e(h,{id:"lCF0wC"})})]}),e(ge,{className:"menu-switch-view",onClick:()=>{m(u==="full"?null:"full"),c.delete("media"),c.delete("media-only"),u==="full"?c.delete("view"):c.set("view","full"),a(c)},children:[e(I,{icon:{"":"layout5",full:"layout4"}[u||""]}),e("span",{children:s(u==="full"?{id:"+/xYEI"}:{id:"2LiWsE"})})]}),e(ge,{onClick:()=>{Array.from(F.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(ce=>{ce.click()})},children:[e(I,{icon:"eye-open"})," ",e("span",{children:e(h,{id:"8r8KmB"})})]}),e(He,{}),e(xi,{className:"plain",children:e(h,{id:"Rsjgm0"})}),e(ge,{disabled:!ye||Ne,onClick:()=>{const N=yd(J.url);N?location.hash=N:alert(s({id:"9J6biQ"}))},children:[e(I,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:s(ye?{id:"Kp9SAs",values:{0:qn.toUnicode(ye)}}:{id:"lb07+k"})})]}),e(ge,{disabled:!g||C==="loading"||!J?.editedAt||!H.current,onClick:W,children:[e(I,{icon:"edit"}),e("span",{children:s({id:"OqaQnE"})})]})]}),e(fe,{class:"button plain deck-close",to:i,children:e(I,{icon:"x",size:"xl",alt:s({id:"yz7wBu"})})})]})]})}),e(Ed,{}),w.length&&J?e("ul",{class:`timeline flat contextual grow ${C==="loading"?"loading":""}`,children:[De,xe>0&&e("li",{class:"descendant descendant-more",children:e("button",{type:"button",class:"plain block show-more",disabled:C==="loading",onClick:()=>Ae(N=>N+kn),style:{marginBlockEnd:"6em"},"data-state-post-ids":be.join(" "),children:[e("div",{class:"ib avatars-bunch",children:w.slice(Se,Se+5).map(N=>e(pt,{url:N.account.avatarStatic},N.id))})," ",e("div",{class:"ib",children:[e(h,{id:"uXRAkV"})," ",e("span",{class:"tag",children:xe>kn?`${kn}+`:xe})]})]})})]}):e(D,{children:[C==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(je,{skeleton:!0,size:"l"})})}),C==="error"&&e("p",{class:"ui-state",children:[e(h,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{E.reloadStatusPage++},children:e(h,{id:"KDw4GX"})})]})]})]})})}function Mo({replies:n,instance:i,hasParentThread:o,level:s,accWeight:c,openAll:a,parentLink:p}){const{_:d}=ae(),[l,r]=bt(),u=T=>T.reduce((L,M)=>{const{repliesCount:H,replies:F}=M,U=F?.length||H;return L+U+u(F||[])},0),m=n.length+u(n),f=n.length===m,v=n.map(T=>T.account).filter((T,L,M)=>M.findIndex(H=>H.id===T.id)===L).slice(0,3),y=ke(()=>n?.reduce((T,L)=>T+L?.weight,c),[c,n?.length]);let S=!1;(a||y<=Md||!o&&m===1&&cn(n[0])<2)&&(S=!0);const k=mi[n[0].id],b=tt((T,L,M,H)=>{T.preventDefault(),T.stopPropagation(),r({media:L+1,mediaStatusID:H.id})},[]),g=q();St(()=>{function T(L){L.target.dataset.scrollLeft=L.target.scrollLeft}return g.current?.addEventListener("scroll",T,{passive:!0}),()=>{g.current?.removeEventListener("scroll",T)}},[]);const[_,w]=R(k||S);G(()=>{let T;return!k&&!S&&(T=setTimeout(()=>w(!0),100)),()=>clearTimeout(T)},[k,S]);const A=S?"div":"details",C=A==="details";return e(A,{ref:g,class:"replies",open:C?k||S:void 0,onToggle:C?T=>{const{open:L}=T.target;mi[n[0].id]=L}:void 0,style:{"--comments-level":s},"data-comments-level":s,"data-comments-level-overflow":s>4,children:[!S&&e("summary",{class:"replies-summary",hidden:S,children:[e("span",{class:"avatars",children:v.map(T=>e(pt,{url:T.avatarStatic,title:`${T.displayName} @${T.username}`,squircle:T?.bot},T.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(h,{id:"DOQUen",values:{0:n.length,1:We(n.length)},components:{0:e("span",{title:n.length})}})}),!f&&m>1&&e(D,{children:[" ","·"," ",e("span",{children:e(h,{id:"qSQQSe",values:{0:We(m),totalComments:m},components:{0:e("span",{title:m})}})})]})]}),e(I,{icon:"chevron-down",class:"replies-summary-chevron"}),!!p&&e(fe,{class:"replies-parent-link",to:p.to,onClick:p.onClick,title:d({id:"ZlV82A"}),children:"»"})]}),_&&e("ul",{children:n.map(T=>e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(je,{statusID:T.id,instance:i,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:b,showActionsBar:!0}),!T.replies?.length&&T.repliesCount>0&&e("div",{class:"replies-link",children:[e(I,{icon:"comment2",alt:d({id:"N8UzTV"})})," ",e("span",{title:T.repliesCount,children:We(T.repliesCount)})]})]}),T.replies?.length&&e(Mo,{instance:i,replies:T.replies,level:T.level,accWeight:S?y:T.weight,openAll:a,parentLink:{to:i?`/${i}/s/${T.id}`:`/s/${T.id}`,onClick:()=>{Rn(T.id)}}})]},T.id))})]})}const Dd=140,Od=35,zd=70,Fd=140,gi=new Map;function cn(n){const i=gi.get(n.id);if(i)return i;const{spoilerText:o,content:s,mediaAttachments:c,poll:a,card:p}=n,d=Hs(o+s),l=c?.length?Dd:0,r=(a?.options?.length||0)*Od,u=p&&(c?.length||a?.options?.length)?0:zd,f=(d+l+r+u)/Fd;return gi.set(n.id,f),f}const Bd=lt($d);function qd(){const n=Pt(),{id:i,instance:o}=n;return e(Bd,{id:i,instance:o})}const Ud=""+new URL("boosts-carousel-BiOaNdMT.jpg",import.meta.url).href,Kd=""+new URL("grouped-notifications-DFgwVVj3.jpg",import.meta.url).href,Hd=""+new URL("multi-column-ROck0NVt.jpg",import.meta.url).href,jd=""+new URL("multi-hashtag-timeline-DH5INVHi.jpg",import.meta.url).href,Yd=""+new URL("nested-comments-thread-hv59kZLc.jpg",import.meta.url).href,Vd="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%20102%2028'%3e%3cpath%20fill='none'%20d='M0%200h101.5v27.5H0z'/%3e%3cg%20fill-rule='nonzero'%3e%3cpath%20fill='url(%23a)'%20d='M2.32%2021.85c1.4%200%202.21-.85%202.21-2.3v-4.64H8.5c4.45%200%207.54-2.9%207.54-7.24%200-4.35-2.98-7.24-7.32-7.24h-6.4C.93.43.11%201.28.11%202.73v16.82c0%201.45.82%202.3%202.21%202.3Zm2.21-10.4V3.94h3c2.54%200%204%201.34%204%203.75s-1.47%203.76-4%203.76h-3Z'/%3e%3cpath%20fill='url(%23b)'%20d='M20.52%2021.88c1.25%200%202.13-.76%202.13-2.23v-7.04c0-2.07%201.2-3.49%203.21-3.49%201.95%200%202.95%201.23%202.95%203.25v7.28c0%201.47.89%202.23%202.13%202.23%201.26%200%202.14-.76%202.14-2.23v-8.18c0-3.64-1.99-5.9-5.48-5.9-2.38%200-4.1%201.12-4.93%203.1h-.09V2.3c0-1.38-.78-2.2-2.1-2.2-1.31%200-2.1.82-2.1%202.2v17.34c0%201.47.9%202.23%202.14%202.23Z'/%3e%3cpath%20fill='url(%23c)'%20d='M40.45%2021.82c1.96%200%203.93-.98%204.8-2.65h.1v.8c.08%201.27.89%201.91%202.05%201.91%201.21%200%202.08-.73%202.08-2.15v-8.95c0-3.17-2.63-5.25-6.65-5.25-3.26%200-5.78%201.16-6.5%203.04-.15.32-.23.63-.23.96%200%20.97.75%201.64%201.79%201.64.69%200%201.23-.26%201.7-.79.95-1.23%201.74-1.65%203.04-1.65%201.62%200%202.64.85%202.64%202.31v1.04l-3.95.24c-3.93.23-6.13%201.88-6.13%204.74%200%202.83%202.27%204.76%205.26%204.76Zm1.4-3.09c-1.43%200-2.4-.73-2.4-1.9%200-1.12.91-1.83%202.51-1.95l3.31-.2v1.14c0%201.7-1.54%202.91-3.41%202.91Z'/%3e%3cpath%20fill='url(%23d)'%20d='M54.37%2021.88c1.26%200%202.14-.76%202.14-2.23v-7.09c0-2.03%201.21-3.44%203.13-3.44s2.89%201.17%202.89%203.22v7.31c0%201.47.88%202.23%202.14%202.23%201.24%200%202.13-.76%202.13-2.23v-8.2c0-3.68-1.96-5.87-5.45-5.87-2.41%200-4%201.07-4.83%203.01h-.09v-.87c0-1.35-.85-2.17-2.14-2.17-1.28%200-2.06.82-2.06%202.15v11.95c0%201.47.9%202.23%202.14%202.23Z'/%3e%3cpath%20fill='url(%23e)'%20d='M71.65%2027.17c1.26%200%202.14-.76%202.14-2.23v-6h.09a5.15%205.15%200%200%200%204.88%202.88c3.92%200%206.35-3.05%206.35-8.1%200-5.07-2.44-8.1-6.43-8.1a5.12%205.12%200%200%200-4.86%202.99h-.09v-.85c0-1.45-.88-2.21-2.1-2.21-1.24%200-2.11.76-2.11%202.2v17.2c0%201.46.89%202.22%202.13%202.22Zm5.6-8.8c-2.1%200-3.47-1.8-3.47-4.65%200-2.81%201.37-4.67%203.47-4.67%202.14%200%203.49%201.83%203.49%204.67%200%202.86-1.35%204.66-3.5%204.66Z'/%3e%3cpath%20fill='url(%23f)'%20d='M89.61%2027.39c3.44%200%205.26-1.5%206.73-5.55l4.81-13.1a4%204%200%200%200%20.24-1.26c0-1.13-.85-1.93-2.08-1.93-1.1%200-1.71.51-2.07%201.7l-3.4%2010.9h-.08L90.35%207.28c-.36-1.25-.94-1.73-2.07-1.73-1.26%200-2.21.83-2.21%201.99%200%20.35.09.82.25%201.26l5%2013.21-.21.56c-.52%201.1-1.32%201.42-2.07%201.42l-.75-.01c-.96%200-1.56.54-1.56%201.4%200%201.29%201%202%202.88%202Z'/%3e%3c/g%3e%3cdefs%3e%3cradialGradient%20id='a'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='b'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='c'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='d'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='e'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3cradialGradient%20id='f'%20cx='0'%20cy='0'%20r='1'%20gradientTransform='rotate(28.51%20.06%20.22)%20scale(57.6252)'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23a4bff7'/%3e%3cstop%20offset='1'%20stop-color='%236081e6'/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e",Gd={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:sn,PHANPY_WEBSITE:As,PHANPY_PRIVACY_POLICY_URL:Wd,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Ts}=Gd,xs=As?As.replace(/https?:\/\//g,"").replace(/\/$/,""):null,Es=`${"2025-10-09T13:06:44.899Z".slice(0,10).replace(/-/g,".")}.1897f38`;function $o(){const{_:n}=ae();return Qe(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:Pi,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:Vd,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(h,{id:"Ogtv0V"})}),e("p",{children:e(fe,{to:sn?`/login?instance=${sn}&submit=1`:"/login",class:"button",children:n(sn?{id:"sQia9P"}:{id:"ZLoGls"})})}),sn&&Ts&&e("p",{children:e("a",{href:Ts,class:"button plain5",children:e(h,{id:"e+RpCP"})})}),!sn&&e("p",{class:"insignificant",children:e("small",{children:e(h,{id:"fvAsUK",components:{0:e("br",{})}})})})]}),(xs||Es)&&e("p",{class:"app-site-version",children:e("small",{children:[xs," ",Es]})}),e("p",{children:e(h,{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(),E.showAccount="cheeaun@mastodon.social"}}),2:e("a",{href:Wd,target:"_blank"})}})}),e("div",{children:e(Di,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:Ud,alt:n({id:"S5cYrQ"}),loading:"lazy"}),e("h4",{children:e(h,{id:"Tu+sCN"})}),e("p",{children:e(h,{id:"e2uVlo"})})]}),e("section",{children:[e("img",{src:Yd,alt:n({id:"CGQ27z"}),loading:"lazy"}),e("h4",{children:e(h,{id:"cYE45+"})}),e("p",{children:e(h,{id:"Pc7QKh"})})]}),e("section",{children:[e("img",{src:Kd,alt:n({id:"rnrM7k"}),loading:"lazy"}),e("h4",{children:e(h,{id:"4RRMre"})}),e("p",{children:e(h,{id:"8GMtDr"})})]}),e("section",{children:[e("img",{src:Hd,alt:n({id:"VLKtvP"}),loading:"lazy"}),e("h4",{children:e(h,{id:"pEkad9"})}),e("p",{children:e(h,{id:"t7Py5R"})})]}),e("section",{children:[e("img",{src:jd,alt:n({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(h,{id:"Wi1Ov0"})}),e("p",{children:e(h,{id:"tS2i+h"})})]})]})})]})}const Zd=window.alert;window.__nativeAlert||(window.__nativeAlert=Zd);window.alert=function(n){n instanceof Error&&n?.message&&(n=n.message),typeof n!="string"&&(n=JSON.stringify(n));const i=Ac({text:n,className:"alert",gravity:"top",position:"center",duration:1e4,offset:{y:48},onClick:()=>{i.hideToast()}});i.showToast()};window.__STATES__=E;window.__STATES_STATS__=()=>{const n=["statuses","accounts","spoilers","unfurledLinks","statusQuotes"],i={};n.forEach(c=>{i[c]=Object.keys(E[c]).length});const{statuses:o}=E,s=[];for(const c in o)document.querySelector(`[data-state-post-id~="${c}"], [data-state-post-ids~="${c}"]`)||s.push(c)};setInterval(()=>{if(!window.__IDLE__)return;const{statuses:n,unfurledLinks:i,notifications:o}=E;let s=0;const{instance:c}=se();for(const a in n){if(!window.__IDLE__)break;try{const p=document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`),d=o.some(l=>a===at(l.status?.id,c));if(!p&&!d){delete E.statuses[a],delete E.statusQuotes[a];for(const l in i){const r=i[l];if(at(r.id,r.instance)===a){delete E.unfurledLinks[l];break}}s++}}catch{}}},15*60*1e3);setTimeout(()=>{for(const n in jt)setTimeout(()=>{Array.isArray(jt[n])?jt[n][0]?.():typeof jt[n]=="object"?jt[n].module?.():jt[n]?.()},1)},5e3);(()=>{window.__IDLE__=!0;const n=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],i=()=>{window.__IDLE__=!0},s=Ys(i,3e3),c=()=>{window.__IDLE__=!1,s()};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 Xd=/iPad|iPhone|iPod/.test(navigator.userAgent);Xd&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(document.getElementsByClassName("media-modal-container").length>0)return;const i=Te.local.get("theme");let o;if(i){if(o=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),o){const s=o.content,c=i==="light"?o.dataset.themeLightColorTemp:o.dataset.themeDarkColorTemp;o.content=c||"",setTimeout(()=>{o.content=s},10)}}else{const s=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(o=document.querySelector(`meta[name="theme-color"][media*="${s}"]`),o){const c=o.dataset.content,a=o.dataset.contentTemp;o.content=a||"",setTimeout(()=>{o.content=c},10)}}}});{const n=Te.local.get("theme");if(n){document.documentElement.classList.add(`is-${n}`),document.querySelector('meta[name="color-scheme"]').setAttribute("content",n||"light dark");const o=document.querySelector('meta[data-theme-setting="manual"]');o&&(o.name="theme-color",o.content=n==="light"?o.dataset.themeLightColor:o.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(c=>{c.name=""})}const i=Te.local.get("textSize");i&&document.documentElement.style.setProperty("--text-size",`${i}px`)}Ms(E,n=>{for(const[i,o,s,c]of n){if(o.join(".")==="settings.shortcutsViewMode"){const a=document.getElementById("app");a&&(a.dataset.shortcutsViewMode=E.shortcuts?.length?s:"")}o.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",s)}});const Sn=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(n){},end(n){}};document.body.classList.toggle("exp-tab-bar-v2",Te.local.get("experiments-tabBarV2")??!1);function Jd(){const[n,i]=R(!1),[o,s]=R("loading");__BENCHMARK.start("app-init"),__BENCHMARK.start("time-to-following"),__BENCHMARK.start("time-to-home"),__BENCHMARK.start("time-to-isLoggedIn"),ae(),G(()=>{const a=Te.local.get("instanceURL"),p=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(p){window.history.replaceState({},document.title,window.location.pathname||"/");const{client_id:d,client_secret:l,vapid_key:r}=Ps(a)||{},u=Mn(a)||r,m=Te.sessionCookie.get("codeVerifier");(async()=>{s("loading");const{access_token:f}=await na({instanceURL:a,client_id:d,client_secret:l,code:p,code_verifier:m||void 0});if(f){const v=Zo({instance:a,accessToken:f});await Promise.allSettled([Jn(v),Qn(v,a),Xo(v,a,f,u)]),ji(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,i(!0),s("default")}else s("error");__BENCHMARK.end("app-init")})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;const d=decodeURIComponent((window.location.search.match(/account=([^&]+)/)||[,""])[1]);let l;if(d&&(l=Jo(d),l&&(Ln(l.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),l||(l=ki()),l){Ln(l.info.id);const{client:r}=se({account:l}),{instance:u}=r;ji(),s("loading"),(async()=>{try{Qo()&&ec(u)?(Jn(r),Qn(r,u)):await Promise.allSettled([Jn(r),Qn(r,u)])}catch{}finally{i(!0),s("default"),__BENCHMARK.end("app-init")}})()}else s("default"),__BENCHMARK.end("app-init")}Te.sessionCookie.del("clientID"),Te.sessionCookie.del("clientSecret"),Te.sessionCookie.del("codeVerifier")},[]);let c=Qt();return E.currentLocation=c.pathname,G(ui,[c,n]),/\/https?:/.test(c.pathname)?e(bd,{}):o==="loading"?e(Oe,{id:"loader-root"}):e(D,{children:[e(eu,{isLoggedIn:n}),e(tu,{isLoggedIn:n}),e(_i,{children:e(Ze,{path:"/:instance?/s/:id",element:e(qd,{})})}),n&&e(Lc,{}),n&&e(Ur,{}),e(Mr,{}),n&&e(Dr,{}),e(Ec,{isLoggedIn:n}),e(Br,{onClose:ui}),e(Mc,{})]})}function Qd({isLoggedIn:n}){return n&&__BENCHMARK.end("time-to-isLoggedIn"),n?e(gd,{}):e($o,{})}const eu=lt(({isLoggedIn:n})=>{const i=Qt(),o=ke(()=>{const{pathname:s}=i;return!/^\/(login|welcome|_sandbox)/i.test(s)},[i]);return e(_i,{location:o||i,children:[e(Ze,{path:"/",element:e(Qd,{isLoggedIn:n})}),e(Ze,{path:"/login",element:e(_d,{})}),e(Ze,{path:"/welcome",element:e($o,{})}),void 0]})});function Rs(){return E.prevLocation||null}function tu({isLoggedIn:n}){const i=Qt(),o=q(Rs());return ke(()=>an("/:instance/s/:id",i.pathname)||an("/s/:id",i.pathname),[i.pathname,an])?o.current||(o.current=Rs()):o.current=null,e(_i,{location:o.current||i,children:[n&&e(D,{children:[e(Ze,{path:"/notifications",element:e(To,{})}),e(Ze,{path:"/mentions",element:e(So,{})}),e(Ze,{path:"/following",element:e(Ui,{})}),e(Ze,{path:"/b",element:e(fo,{})}),e(Ze,{path:"/f",element:e(mo,{})}),e(Ze,{path:"/l",children:[e(Ze,{index:!0,element:e(wd,{})}),e(Ze,{path:":id",element:e(yo,{})})]}),e(Ze,{path:"/fh",element:e($l,{})}),e(Ze,{path:"/sp",element:e(Ad,{})}),e(Ze,{path:"/ft",element:e(El,{})}),e(Ze,{path:"/catchup",element:e(vl,{})}),e(Ze,{path:"/annual_report/:year",element:e(ll,{})})]}),e(Ze,{path:"/:instance?/t/:hashtag",element:e(vo,{})}),e(Ze,{path:"/:instance?/a/:id",element:e(ol,{})}),e(Ze,{path:"/:instance?/p",children:[e(Ze,{index:!0,element:e(fi,{})}),e(Ze,{path:"l",element:e(fi,{local:!0})})]}),e(Ze,{path:"/:instance?/trending",element:e(Ro,{})}),e(Ze,{path:"/:instance?/search",element:e(xo,{})})]})}tc();nc();ic(e(sc,{i18n:ue,children:e(oc,{children:e(cc,{children:e(Jd,{})})})}),document.getElementById("app"));setTimeout(()=>{try{Object.keys(localStorage).forEach(n=>{n.startsWith("iconify")&&localStorage.removeItem(n)}),Object.keys(sessionStorage).forEach(n=>{n.startsWith("iconify")&&sessionStorage.removeItem(n)}),localStorage.removeItem("settings:boostsCarousel")}catch{}},5e3);if("serviceWorker"in navigator&&typeof caches<"u"){const i=["icons"];let o=!1;const s=1e4,c=60*60*1e3;async function a(){if(window.__IDLE__)try{const p=await caches.keys();for(const d of p){if(i.includes(d))continue;const l=await caches.open(d),r=await l.keys();if(r.length>50){const u=r.slice(50);for(const m of u)await l.delete(m)}}o=!0}catch{}setTimeout(a,o?c:s)}setTimeout(a,s)}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")};
//# sourceMappingURL=main-sgpw-Fwy.js.map