import{A as Y,y as se,h as M,s as A,a as ce,b as We,i as g,C as st,u as qe,c as e,T as u,d as me,g as wt,p as Mt,e as vn,f as U,j as Qe,k as $n,L as ao,l as ke,D as ro,m as lo,o as Yn,q as Vt,r as _t,t as ct,v as uo,w as Pe,x as yn,z as _i,_ as gt,B as cs,E as td,F as as,G as rs,H as ho,I as fo,J as it,K as po,M as ei,N as ft,O as mo,P as go,Q as bo,R as ti,S as $t,U as Xe,V as ls,W as ds,X as vo,Y as tn,Z as yo,$ as wo,a0 as Dn,a1 as Nn,a2 as ko,a3 as Si,a4 as _o,a5 as So,a6 as Co,a7 as ni,a8 as Ve,a9 as Io,aa as To,ab as xo,ac as Ao}from"./useTitle-i_dVJKRH.js";import{u as ii,s as de,a as Ue,o as Ci,b as Eo,I as S,M as Fe,A as dt,N as mt,c as at,d as we,e as Be,f as Ge,g as lt,L as ue,l as It,h as us,t as Ii,i as Ze,R as Gt,p as id,j as tt,k as Kt,m as rt,n as hs,q as jn,E as fs,r as Ke,v as ht,w as Ro,S as wn,x as Ti,T as ps,y as ut,z as si,B as Ye,C as kt,D as Lo,F as Mo,G as Et,H as oi,J as ms,K as $o,O as Ft,P as Do,Q as No,U as gs,V as Po,W as Oo,X as bs,Y as zo,Z as Rt,_ as ci,$ as Uo,a0 as vs,a1 as Bo,a2 as ys,a3 as Fo,a4 as Ho,a5 as qo,a6 as xi,a7 as Yo,a8 as Ot}from"./fuse-QSdEypyG.js";var ws=jo;function jo(t,n,i){var s=null,o=null,a=function(){s&&(clearTimeout(s),o=null,s=null)},h=function(){var c=o;a(),c&&c()},r=function(){if(!n)return t.apply(this,arguments);var c=this,l=arguments,p=i&&!s;if(a(),o=function(){t.apply(c,l)},s=setTimeout(function(){if(s=null,!p){var f=o;return o=null,f()}},n),p)return o()};return r.cancel=a,r.flush=h,r}/*! * 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 * @license MIT */(function(t,n){"use strict";typeof t.CustomEvent!="function"&&(t.CustomEvent=function(d,v){v=v||{bubbles:!1,cancelable:!1,detail:void 0};var b=n.createEvent("CustomEvent");return b.initCustomEvent(d,v.bubbles,v.cancelable,v.detail),b},t.CustomEvent.prototype=t.Event.prototype),n.addEventListener("touchstart",p,!1),n.addEventListener("touchmove",f,!1),n.addEventListener("touchend",l,!1);var i=null,s=null,o=null,a=null,h=null,r=null,c=0;function l(d){if(r===d.target){var v=parseInt(m(r,"data-swipe-threshold","20"),10),b=m(r,"data-swipe-unit","px"),y=parseInt(m(r,"data-swipe-timeout","500"),10),w=Date.now()-h,k="",C=d.changedTouches||d.touches||[];if(b==="vh"&&(v=Math.round(v/100*n.documentElement.clientHeight)),b==="vw"&&(v=Math.round(v/100*n.documentElement.clientWidth)),Math.abs(o)>Math.abs(a)?Math.abs(o)>v&&w0?k="swiped-left":k="swiped-right"):Math.abs(a)>v&&w0?k="swiped-up":k="swiped-down"),k!==""){var I={dir:k.replace(/swiped-/,""),touchType:(C[0]||{}).touchType||"direct",fingers:c,xStart:parseInt(i,10),xEnd:parseInt((C[0]||{}).clientX||-1,10),yStart:parseInt(s,10),yEnd:parseInt((C[0]||{}).clientY||-1,10)};r.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:I})),r.dispatchEvent(new CustomEvent(k,{bubbles:!0,cancelable:!0,detail:I}))}i=null,s=null,h=null}}function p(d){d.target.getAttribute("data-swipe-ignore")!=="true"&&(r=d.target,h=Date.now(),i=d.touches[0].clientX,s=d.touches[0].clientY,o=0,a=0,c=d.touches.length)}function f(d){if(!(!i||!s)){var v=d.touches[0].clientX,b=d.touches[0].clientY;o=i-v,a=s-b}}function m(d,v,b){for(;d&&d!==n.documentElement;){var y=d.getAttribute(v);if(y)return y;d=d.parentNode}return b}})(window,document);function Ht(t=()=>{},n=[]){const i=Y(t);se(()=>{i.current=t},[n]),se(()=>{const s=()=>{const o=document.hidden||document.visibilityState==="hidden";i.current(!o)};return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[])}const Vo=1e3*3,Ai=2e4,Go=st(function({isLoggedIn:n}){const[i,s]=M(!0),o=Y();Ht(c=>{clearTimeout(o.current),c?s(!0):o.current=setTimeout(()=>{s(!1)},Ai)});const a=async(c,l,p)=>{var f;if(A.notificationsLast){const m=c.v1.notifications.list({limit:1,sinceId:A.notificationsLast.id}),{value:d}=await m.next();if(d!=null&&d.length)if(p)A.notificationsShowNew=!0;else{let v;try{const b=await c.v1.markers.fetch({timeline:"notifications"});v=(f=b==null?void 0:b.notifications)==null?void 0:f.lastReadId}catch{}v?A.notificationsShowNew=d[0].id!==v:A.notificationsShowNew=!0}}};se(()=>{let c,l,p;if(n&&i){const{masto:f,streaming:m,instance:d}=ce();(async()=>{await a(f,d);let v=!1;m&&(l=setTimeout(()=>{(async()=>{try{v=!0,c=m.user.notification.subscribe();for await(const b of c){if(!c||!i)break;b.event==="notification"&&We(b.payload,d,{skipThreading:!0}),A.notificationsShowNew=!0}}catch{v=!1}v||(p=setInterval(()=>{a(f,d,!0)},Ai))})()},Vo))})()}return()=>{var f;(f=c==null?void 0:c.unsubscribe)==null||f.call(c),c=null,clearTimeout(l),clearInterval(p)}},[i,n]);const h=Y(),r=()=>{h.current=Date.now(),fetch("./version.json").then(c=>c.json()).then(c=>{c&&(A.appVersion=c)}).catch(c=>{})};return ii(r,i&&1e3*60*30),Ht(c=>{c&&(h.current?Date.now()-h.current>1e3*60*60&&r():r())}),Ue("shift+alt+k",()=>{const c=A.settings.cloakMode;A.settings.cloakMode=!c,de({text:c?g._({id:"oguMwa"}):g._({id:"IXZLPs"})})}),null});function Ko(){const t=qe(A);function n(i){if(t.composerState.minimized){A.composerState.minimized=!1,Ci();return}i.shiftKey?Eo()||(A.showCompose=!0):(Ci(),A.showCompose=!0)}return Ue("c, shift+c",n,{ignoreEventWhen:i=>!!document.querySelector("#modal-container > *")}),e("button",{type:"button",id:"compose-button",onClick:n,class:`${t.composerState.minimized?"min":""} ${t.composerState.publishing?"loading":""} ${t.composerState.publishingError?"error":""}`,children:e(S,{icon:"quill",size:"xl",alt:g._({id:"QOhkyl"})})})}const Wo=st(function(){const n=qe(A);function i(){A.showKeyboardShortcutsHelp=!1}return Ue("?, shift+?, shift+slash",s=>{A.showKeyboardShortcutsHelp=!0},{ignoreEventWhen:s=>!!document.querySelector("#modal-container > *")}),!!n.showKeyboardShortcutsHelp&&e(Fe,{onClose:i,children:e("div",{id:"keyboard-shortcuts-help-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:i,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"77Emn0"})})}),e("main",{children:e("table",{children:e("tbody",{children:[{action:g._({id:"ulXSNi"}),keys:e("kbd",{children:"?"})},{action:g._({id:"Gy9P9T"}),keys:e("kbd",{children:"j"})},{action:g._({id:"6XYpYY"}),keys:e("kbd",{children:"k"})},{action:g._({id:"DYowFe"}),keys:e(u,{id:"mzjGX4",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"S5ez7Y"}),keys:e(u,{id:"Fd8FaU",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"VkLESX"}),keys:e("kbd",{children:"."})},{action:g._({id:"jsFF8C"}),keys:e(u,{id:"80sOCm",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:e(u,{id:"41gejM",components:{0:e("br",{})}}),keys:e("kbd",{children:"x"})},{action:g._({id:"jAj8rv"}),keys:e(u,{id:"evz6c6",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"duF1lx"}),keys:e(u,{id:"nhpsIN",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"YrR3Co"}),keys:e("kbd",{children:"]"})},{action:g._({id:"noxAFR"}),keys:e("kbd",{children:"["})},{action:g._({id:"AIa/f7"}),keys:e("kbd",{children:"c"})},{action:g._({id:"snPx8X"}),className:"insignificant",keys:e(u,{id:"+Cxvld",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"1pKapz"}),keys:e(u,{id:"py67WT",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{}),3:e("kbd",{})}})},{action:g._({id:"A1taO8"}),keys:e("kbd",{children:"/"})},{action:g._({id:"ImOQa9"}),keys:e("kbd",{children:"r"})},{action:g._({id:"KFs8c6"}),className:"insignificant",keys:e(u,{id:"XpQLJF",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"cqi4Mx"}),keys:e(u,{id:"84WuL2",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"kulphB"}),keys:e(u,{id:"yrz6Ck",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:g._({id:"PZlHt8"}),keys:e("kbd",{children:"d"})},{action:g._({id:"C7ujRh"}),keys:e(u,{id:"v4TbMP",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{})}})}].map(({action:s,className:o,keys:a})=>e("tr",{children:[e("th",{class:o,children:s}),e("td",{children:a})]},s))})})})]})})}),ks=new Set,nt=new WeakMap,qt=new WeakMap,Lt=new WeakMap,Vn=new WeakMap,Zo=new WeakMap,Yt=new WeakMap,kn=new WeakMap,Qt=new WeakSet;let Tt,ai=0,ri=0;const vt="__aa_tgt",nn="__aa_del",_n="__aa_new",Xo=t=>{const n=ic(t);n&&n.forEach(i=>sc(i))},Jo=t=>{t.forEach(n=>{n.target===Tt&&ec(),nt.has(n.target)&&Dt(n.target)})};function Qo(t){const n=Vn.get(t);n==null||n.disconnect();let i=nt.get(t),s=0;const o=5;i||(i=jt(t),nt.set(t,i));const{offsetWidth:a,offsetHeight:h}=Tt,c=[i.top-o,a-(i.left+o+i.width),h-(i.top+o+i.height),i.left-o].map(p=>`${-1*Math.floor(p)}px`).join(" "),l=new IntersectionObserver(()=>{++s>1&&Dt(t)},{root:Tt,threshold:1,rootMargin:c});l.observe(t),Vn.set(t,l)}function Dt(t){clearTimeout(kn.get(t));const n=xn(t),i=sn(n)?500:n.duration;kn.set(t,setTimeout(async()=>{const s=Lt.get(t);try{await(s==null?void 0:s.finished),nt.set(t,jt(t)),Qo(t)}catch{}},i))}function ec(){clearTimeout(kn.get(Tt)),kn.set(Tt,setTimeout(()=>{ks.forEach(t=>Is(t,n=>_s(()=>Dt(n))))},100))}function tc(t){setTimeout(()=>{Zo.set(t,setInterval(()=>_s(Dt.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function _s(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let Gn,Bt;const nc=typeof window<"u"&&"ResizeObserver"in window;nc&&(Tt=document.documentElement,Gn=new MutationObserver(Xo),Bt=new ResizeObserver(Jo),window.addEventListener("scroll",()=>{ri=window.scrollY,ai=window.scrollX}),Bt.observe(Tt));function ic(t){return t.reduce((s,o)=>[...s,...Array.from(o.addedNodes),...Array.from(o.removedNodes)],[]).every(s=>s.nodeName==="#comment")?!1:t.reduce((s,o)=>{if(s===!1)return!1;if(o.target instanceof Element){if(Pn(o.target),!s.has(o.target)){s.add(o.target);for(let a=0;ai(t,Yt.has(t)));for(let i=0;io(s,Yt.has(s)))}}function di(t){return Array.isArray(t)?t:[t]}function sn(t){return typeof t=="function"}function cc(t){const n=nt.get(t),i=jt(t);if(!li(t))return nt.set(t,i);let s;if(!n)return;const o=xn(t);if(typeof o!="function"){const a=n.left-i.left,h=n.top-i.top,[r,c,l,p]=Ss(t,n,i),f={transform:`translate(${a}px, ${h}px)`},m={transform:"translate(0, 0)"};r!==c&&(f.width=`${r}px`,m.width=`${c}px`),l!==p&&(f.height=`${l}px`,m.height=`${p}px`),s=t.animate([f,m],{duration:o.duration,easing:o.easing})}else{const[a]=di(o(t,"remain",n,i));s=new Animation(a),s.play()}Lt.set(t,s),nt.set(t,i),s.addEventListener("finish",Dt.bind(null,t))}function Ei(t){_n in t&&delete t[_n];const n=jt(t);nt.set(t,n);const i=xn(t);if(!li(t))return;let s;if(typeof i!="function")s=t.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:i.duration*1.5,easing:"ease-in"});else{const[o]=di(i(t,"add",n));s=new Animation(o),s.play()}Lt.set(t,s),s.addEventListener("finish",Dt.bind(null,t))}function Ri(t,n){var i;t.remove(),nt.delete(t),qt.delete(t),Lt.delete(t),(i=Vn.get(t))===null||i===void 0||i.disconnect(),setTimeout(()=>{if(nn in t&&delete t[nn],Object.defineProperty(t,_n,{value:!0,configurable:!0}),n&&t instanceof HTMLElement)for(const s in n)t.style[s]=""},0)}function ac(t){var n;if(!qt.has(t)||!nt.has(t))return;const[i,s]=qt.get(t);Object.defineProperty(t,nn,{value:!0,configurable:!0});const o=window.scrollX,a=window.scrollY;if(s&&s.parentNode&&s.parentNode instanceof Element?s.parentNode.insertBefore(t,s):i&&i.parentNode?i.parentNode.appendChild(t):(n=Cs(t))===null||n===void 0||n.appendChild(t),!li(t))return Ri(t);const[h,r,c,l]=lc(t),p=xn(t),f=nt.get(t);(o!==ai||a!==ri)&&rc(t,o,a,p);let m,d={position:"absolute",top:`${h}px`,left:`${r}px`,width:`${c}px`,height:`${l}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!sn(p))Object.assign(t.style,d),m=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:p.duration,easing:"ease-out"});else{const[v,b]=di(p(t,"remove",f));(b==null?void 0:b.styleReset)!==!1&&(d=(b==null?void 0:b.styleReset)||d,Object.assign(t.style,d)),m=new Animation(v),m.play()}Lt.set(t,m),m.addEventListener("finish",Ri.bind(null,t,d))}function rc(t,n,i,s){const o=ai-n,a=ri-i,h=document.documentElement.style.scrollBehavior;if(getComputedStyle(Tt).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+o,window.scrollY+a),!t.parentElement)return;const c=t.parentElement;let l=c.clientHeight,p=c.clientWidth;const f=performance.now();function m(){requestAnimationFrame(()=>{if(!sn(s)){const d=l-c.clientHeight,v=p-c.clientWidth;f+s.duration>performance.now()?(window.scrollTo({left:window.scrollX-v,top:window.scrollY-d}),l=c.clientHeight,p=c.clientWidth,m()):document.documentElement.style.scrollBehavior=h}})}m()}function lc(t){const n=nt.get(t),[i,,s]=Ss(t,n,jt(t));let o=t.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const a=getComputedStyle(o),h=nt.get(o)||jt(o),r=Math.round(n.top-h.top)-pt(a.borderTopWidth),c=Math.round(n.left-h.left)-pt(a.borderLeftWidth);return[r,c,i,s]}function Ts(t,n={}){return Gn&&Bt&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!sn(n)&&!n.disrespectUserMotionPreference||(Qt.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),Is(t,Dt,tc,o=>Bt==null?void 0:Bt.observe(o)),sn(n)?Yt.set(t,n):Yt.set(t,{duration:250,easing:"ease-in-out",...n}),Gn.observe(t,{childList:!0}),ks.add(t))),Object.freeze({parent:t,enable:()=>{Qt.add(t)},disable:()=>{Qt.delete(t)},isEnabled:()=>Qt.has(t)})}function ui(t){const n=Y(null),[i,s]=M(),o=a=>{i&&(a?i.enable():i.disable())};return se(()=>{n.current instanceof HTMLElement&&s(Ts(n.current,t||{}))},[]),[n,o]}const dc=window.matchMedia("(display-mode: standalone)").matches;function uc({onClose:t}){const{masto:n}=ce(),i=me.local.getJSON("accounts"),s=wt(),o=i.length>1,[a,h]=Mt(c=>c+1,0),[r]=ui();return e("div",{id:"accounts-container",class:"sheet",tabIndex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(u,{id:"bPwFdf"})})}),e("main",{children:e("section",{children:[e("ul",{class:"accounts-list",ref:r,children:i.map((c,l)=>{const p=c.info.id===s,f=l===0;return e("li",{children:[e("div",{children:[o&&e("span",{class:`current ${p?"is-current":""}`,children:e(S,{icon:"check-circle",alt:g._({id:"Hp1l6f"})})}),e(dt,{url:c.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(p)try{const m=await n.v1.accounts.$select(c.info.id).fetch();c.info=m,me.local.setJSON("accounts",i),h()}catch{}}}),e(mt,{account:o?{...c.info,acct:/@/.test(c.info.acct)?c.info.acct:`${c.info.acct}@${c.instanceURL}`}:c.info,showAcct:!0,onClick:()=>{p?A.showAccount=`${c.info.username}@${c.instanceURL}`:(vn(c.info.id),location.reload())}})]}),e("div",{class:"actions",children:[f&&o&&e(U,{children:[e("span",{class:"tag",children:e(u,{id:"ovBPCi"})})," "]}),e(at,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[o&&e(U,{children:[e(we,{disabled:p,onClick:()=>{vn(c.info.id),location.reload()},children:[e(S,{icon:"transfer"})," ",e(u,{id:"3t/Nrv"})]}),!dc&&!p&&e(Be,{href:`./?account=${c.info.id}`,target:"_blank",children:[e(S,{icon:"external"}),e("span",{children:e(u,{id:"PZgZtY"})})]}),e(Ge,{})]}),e(we,{onClick:()=>{A.showAccount=`${c.info.username}@${c.instanceURL}`},children:[e(S,{icon:"user"}),e("span",{children:e(u,{id:"40z2Fm"})})]}),e(Ge,{}),o&&e(we,{disabled:f,onClick:()=>{i.splice(l,1),i.unshift(c),me.local.setJSON("accounts",i),h()},children:[e(S,{icon:"check-circle"}),e("span",{children:e(u,{id:"PPcets"})})]}),e(lt,{subMenu:!0,confirmLabel:e(U,{children:[e(S,{icon:"exit"}),e("span",{children:e(u,{id:"k08LxG",values:{0:c.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),disabled:!p,menuItemClassName:"danger",onClick:()=>{i.splice(l,1),me.local.setJSON("accounts",i),location.href=location.pathname||"/"},children:[e(S,{icon:"exit"}),e("span",{children:e(u,{id:"CXk1bI"})})]})]})]})]},c.info.id)})}),e("p",{children:e(ue,{to:"/login",class:"button plain2",onClick:t,children:[e(S,{icon:"plus"})," ",e("span",{children:e(u,{id:"Is7/PB"})})]})}),o&&e("p",{children:e("small",{children:e(u,{id:"52x24e",components:{0:e("i",{})}})})})]})})]})}const hi="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",hc={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function fi(){const{i18n:t}=Qe(),n=ke(()=>ao.map(i=>{var h,r;const s=hc[i]||i.replace(/-[a-z]+$/i,""),o=It({code:s,locale:i,fallback:(h=$n.find(c=>c.code===i))==null?void 0:h.nativeName}),a=It({code:s,locale:t.locale,fallback:(r=$n.find(c=>c.code===i))==null?void 0:r.name});return{code:i,regionlessCode:s,_common:a,native:o}}).sort((i,s)=>{const o=i._common.localeCompare(s._common,t.locale);return o!==0?o:i.codes.code?1:0}),[]);return e("label",{class:"lang-selector",children:["๐ŸŒ"," ",e("select",{class:"small",value:t.locale||ro,onChange:i=>{me.local.set("lang",i.target.value),lo(i.target.value)},children:[n.map(({code:i,regionlessCode:s,native:o})=>{var r;const a=It({code:s,locale:t.locale,fallback:(r=$n.find(c=>c.code===i))==null?void 0:r.name});return e("option",{value:i,"data-regionless-code":s,children:!!a&&a!==o?`${o} - ${a}`:o},i)}),void 0]})]})}function Li(t){const{masto:n}=ce();return n.v1.push.subscription.create(t)}function fc(){const{masto:t}=ce();return t.v1.push.subscription.fetch()}function pc(t){const{masto:n}=ce();return n.v1.push.subscription.update(t)}function mc(){const{masto:t}=ce();return t.v1.push.subscription.remove()}function An(){return"serviceWorker"in navigator&&"PushManager"in window}function gc(){return navigator.serviceWorker.getRegistration()}async function pi(){const t=await gc(),n=t?await t.pushManager.getSubscription():void 0;return{registration:t,subscription:n}}function xs(t){const n="=".repeat((4-t.length%4)%4),i=`${t}${n}`.replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(i),o=new Uint8Array(s.length);for(let a=0;a{d.preventDefault();const b=new FormData(s.current).get("theme"),y=document.documentElement;if(b==="auto"){y.classList.remove("is-light","is-dark");const w=document.querySelector('meta[data-theme-setting="manual"]');w&&(w.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(C=>{C.name="theme-color"})}else{y.classList.toggle("is-light",b==="light"),y.classList.toggle("is-dark",b==="dark");const w=document.querySelector('meta[data-theme-setting="manual"]');w&&(w.name="theme-color",w.content=b==="light"?w.dataset.themeLightColor:w.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(C=>{C.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",b==="auto"?"dark light":b),b==="auto"?me.local.del("theme"):me.local.set("theme",b)},children:e("div",{class:"radio-group",children:[e("label",{children:[e("input",{type:"radio",name:"theme",value:"light",defaultChecked:i==="light"}),e("span",{children:e(u,{id:"1njn7W"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:i==="dark"}),e("span",{children:e(u,{id:"pvnfJD"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:i!=="light"&&i!=="dark"}),e("span",{children:e(u,{id:"R9Khdg"})})]})]})})})]}),e("li",{children:[e("div",{children:e("label",{children:e(u,{id:"7r6sCa"})})}),e("div",{class:"range-group",children:[e("span",{style:{fontSize:At[0]},children:e(u,{id:"J6ypuD"})})," ",e("input",{type:"range",min:At[0],max:At[At.length-1],step:"1",value:r,list:"sizes",onChange:d=>{const v=parseInt(d.target.value,10);document.documentElement.style.setProperty("--text-size",`${v}px`),v===Di?me.local.del("textSize"):me.local.set("textSize",d.target.value)}})," ",e("span",{style:{fontSize:At[At.length-1]},children:e(u,{id:"J6ypuD"})}),e("datalist",{id:"sizes",children:At.map(d=>e("option",{value:d}))})]})]}),e("li",{children:[e("span",{children:[e("label",{children:e(u,{id:"CeJHfb"})}),e("br",{}),e("small",{children:e("a",{href:"https://crowdin.com/project/phanpy",target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"FFmj1D"})})})]}),e(fi,{})]})]})}),f&&e(U,{children:[e("h3",{children:e(u,{id:"PcoS3v"})}),e("section",{children:e("ul",{children:e("li",{children:[e("div",{children:e("label",{for:"posting-privacy-field",children:[e(u,{id:"NAjVvt"})," ",e(S,{icon:"cloud",alt:g._({id:"N2FcBE"}),class:"synced-icon"})]})}),e("div",{children:e("select",{id:"posting-privacy-field",value:c["posting:default:visibility"]||"public",onChange:d=>{const{value:v}=d.target;(async()=>{try{await p.v1.accounts.updateCredentials({source:{privacy:v}}),l({...c,"posting:default:visibility":v}),me.account.set("preferences",{...c,"posting:default:visibility":v})}catch{alert(g._({id:"Oa+KBY"}))}})()},children:[e("option",{value:"public",children:e(u,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(u,{id:"WDcQq9"})}),e("option",{value:"private",children:e(u,{id:"o34OrG"})})]})})]})})}),e("p",{class:"section-postnote",children:[e(S,{icon:"cloud",alt:g._({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(u,{id:"xlsg7n",values:{instance:m},components:{0:e("a",{href:`https://${m}/`,target:"_blank",rel:"noopener noreferrer"})}})})]})]}),e("h3",{children:e(u,{id:"ivdhsq"})}),e("section",{children:e("ul",{children:[e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:n.settings.autoRefresh,onChange:d=>{A.settings.autoRefresh=d.target.checked}})," ",e(u,{id:"0mC0SF"})]})}),e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:n.settings.boostsCarousel,onChange:d=>{A.settings.boostsCarousel=d.target.checked}})," ",e(u,{id:"TSbnoW"})]})}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslation,onChange:d=>{const{checked:v}=d.target;A.settings.contentTranslation=v,v||(A.settings.contentTranslationTargetLanguage=null)}})," ",e(u,{id:"0SdaOt"})]}),e("div",{class:`sub-section ${n.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:[e(u,{id:"rJ8YHs"})," ",e("select",{value:o||"",disabled:!n.settings.contentTranslation,style:{width:"10em"},onChange:d=>{A.settings.contentTranslationTargetLanguage=d.target.value||null},children:[e("option",{value:"",children:e(u,{id:"jNCSyx",values:{systemTargetLanguageText:h}})}),e("option",{disabled:!0,children:"โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€"}),Ii.map(d=>{const v=It({code:d.code,fallback:d.name}),b=It({code:d.code,locale:d.code}),y=v!==b;return e("option",{value:d.code,children:y?`${b} - ${v}`:v})})]})]})}),e("hr",{}),e("div",{class:"checkbox-fieldset",children:[e(u,{id:"cc0NrU",values:{0:n.settings.contentTranslationHideLanguages.length}}),e("div",{class:"checkbox-fields",children:Ii.map(d=>{const v=It({code:d.code,fallback:d.name}),b=It({code:d.code,locale:d.code}),y=v!==b;return e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslationHideLanguages.includes(d.code),onChange:w=>{const{checked:k}=w.target;k?A.settings.contentTranslationHideLanguages.push(d.code):A.settings.contentTranslationHideLanguages=n.settings.contentTranslationHideLanguages.filter(C=>C!==d.code)}})," ",y?e("span",{children:[b," ",e("span",{class:"insignificant",children:["- ",v]})]}):v]})})})]}),e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"xpF+wU",components:{0:e("a",{href:"https://github.com/cheeaun/lingva-api",target:"_blank",rel:"noopener noreferrer"}),1:e("a",{href:"https://github.com/thedaviddelta/lingva-translate",target:"_blank",rel:"noopener noreferrer"})}})})}),e("hr",{}),e("div",{children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslationAutoInline,disabled:!n.settings.contentTranslation,onChange:d=>{A.settings.contentTranslationAutoInline=d.target.checked}})," ",e(u,{id:"gURvmk"})]}),e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"PbHARL",components:{0:e("b",{})}})})})]})]})]}),!!kc&&f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.composerGIFPicker,onChange:d=>{A.settings.composerGIFPicker=d.target.checked}})," ",e(u,{id:"D7/2jB"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"/CLBTL",components:{0:e("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener noreferrer"})}})})})]}),!!wc&&f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.mediaAltGenerator,onChange:d=>{A.settings.mediaAltGenerator=d.target.checked}})," ",e(u,{id:"9q5uor"})," ",e(S,{icon:"sparkles2",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"faZ9RI"})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"fHZgvt",components:{0:e("a",{href:"https://github.com/cheeaun/img-alt-api",target:"_blank",rel:"noopener noreferrer"})}})})})]}),f&&Ze("@mastodon/grouped-notifications")&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.groupedNotificationsAlpha,onChange:d=>{A.settings.groupedNotificationsAlpha=d.target.checked}})," ",e(u,{id:"aGziA/"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"X17jCM"})})})]}),f&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.shortcutSettingsCloudImportExport,onChange:d=>{A.settings.shortcutSettingsCloudImportExport=d.target.checked}})," ",e(u,{id:"570qTm"})," ",e(S,{icon:"cloud",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"0tZAhT",components:{0:e("br",{})}})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(u,{id:"fHf1v/"})})})]}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:n.settings.cloakMode,onChange:d=>{A.settings.cloakMode=d.target.checked}})," ",e(u,{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(u,{id:"T/hglb"})})})]}),f&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{A.showDrafts=!0,A.showSettings=!1},children:e(u,{id:"krk5ws"})})})]})}),f&&e(Sc,{onClose:t}),e("h3",{children:e(u,{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:hi,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 noreferrer",onClick:d=>{d.preventDefault(),A.showAccount="phanpy@hachyderm.io"},children:"@phanpy"}),e("br",{}),e(u,{id:"AZ2EoP",components:{0:e("a",{href:"https://github.com/cheeaun/phanpy",target:"_blank",rel:"noopener noreferrer"}),1:e("a",{href:"https://mastodon.social/@cheeaun",rel:"noopener noreferrer",onClick:d=>{d.preventDefault(),A.showAccount="cheeaun@mastodon.social"}})}})]})]}),e("p",{children:[e("a",{href:"https://github.com/sponsors/cheeaun",target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"O4cLCR"})})," ","ยท"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"Ng063n"})})," ","ยท"," ",e("a",{href:"https://patreon.com/cheeaun",target:"_blank",rel:"noopener noreferrer",children:"Patreon"})," ","ยท"," ",e("a",{href:yc,target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"LcET2C"})})]}),e("p",{children:[Ni&&e(U,{children:[e(u,{id:"pFnMHn",values:{0:Ni.replace(/https?:\/\//g,"").replace(/\/$/,"")},components:{0:e("span",{class:"insignificant"})}}),e("br",{})]}),e(u,{id:"6KkH+2",values:{0:e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/5a4082e",target:"_blank",rel:"noopener noreferrer",children:e(Gt,{datetime:new Date("2024-11-13T10:12:51.024Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2024-11-13T10:12:51.024Z".slice(0,10).replace(/-/g,".")}.5a4082e`,onClick:d=>{d.target.select();try{navigator.clipboard.writeText(d.target.value),de(g._({id:"PiPfua"}))}catch{de(g._({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function Sc({onClose:t}){if(!An())return null;const{instance:n}=ce(),[i,s]=M("default"),o=Y(),[a,h]=M(!1),[r,c]=M(!1),l=Y();se(()=>{(async()=>{s("loading");try{const{subscription:f,backendSubscription:m}=await bc();if(m!=null&&m.policy&&m.policy!=="none"){h(!0);const{alerts:d,policy:v}=m;l.current=v;const{elements:b}=o.current,y=b.namedItem("policy");y&&(y.value=v),Object.keys(d).forEach(w=>{const k=b.namedItem(w);(k==null?void 0:k.type)==="checkbox"&&(k.checked=!0)})}s("default")}catch(f){/outside.*authorized/i.test(f.message)?c(!0):alert((f==null?void 0:f.message)||f),s("error")}})()},[]);const p=i==="loading";return e("form",{ref:o,onChange:()=>{setTimeout(()=>{const f=Object.fromEntries(new FormData(o.current)),m=!!f["policy-allow"],d={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 v=0;Object.keys(d.data.alerts).forEach(y=>{d.data.alerts[y]?v++:delete d.data.alerts[y]});const b=l.current!==d.data.policy;m&&v>0?b?$i().then(()=>{Mi(d)}).catch(y=>{alert(g._({id:"I6pdY3"}))}):Mi(d).catch(y=>{alert(g._({id:"I6pdY3"}))}):$i().catch(y=>{alert(g._({id:"q1zFd+"}))})},100)},children:[e("h3",{children:e(u,{id:"WUHLnz"})}),e("section",{children:e("ul",{children:e("li",{children:[e("label",{children:[e("input",{type:"checkbox",disabled:p||r,name:"policy-allow",checked:a,onChange:async f=>{const{checked:m}=f.target;if(m){const d=await Notification.requestPermission();d==="granted"?h(!0):(h(!1),d==="denied"&&alert(g._({id:"6LUsk7"})))}else h(!1)}})," ",e(u,{id:"qYNCa1",values:{0:[{value:"all",label:g._({id:"+niKJH"})},{value:"followed",label:g._({id:"x2NYtp"})},{value:"follower",label:g._({id:"PBFNgg"})}].map(f=>e("option",{value:f.value,children:f.label}))},components:{0:e("select",{name:"policy",disabled:p||r||!a})}})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!a,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"sub-section",children:e("ul",{children:[{value:"mention",label:g._({id:"/bZzdR"})},{value:"favourite",label:g._({id:"zZOZj7"})},{value:"reblog",label:g._({id:"puY2t0"})},{value:"follow",label:g._({id:"aaJhcT"})},{value:"followRequest",label:g._({id:"6Fs1Ba"})},{value:"poll",label:g._({id:"wNExRS"})},{value:"update",label:g._({id:"K/EtE6"})},{value:"status",label:g._({id:"2yr1/p"})}].map(f=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:f.value})," ",f.label]})}))})})})}),r&&e("div",{class:"sub-section",children:e("p",{children:e(u,{id:"8d0b8B",components:{0:e(ue,{to:`/login?instance=${n}`,onClick:t}),1:e("b",{})}})})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:e(u,{id:"z96cOX",components:{0:e("b",{})}})})})]})}const Kn=()=>{let t=setTimeout(()=>{var i,s;const n=document.getElementById("columns");if(n)(s=(i=n.querySelector(".deck-container"))==null?void 0:i.focus)==null||s.call(i);else{const o=document.querySelectorAll("#modal-container > *");if(o!=null&&o.length){const c=o[o.length-1],l=c.querySelector('[tabindex="-1"]')||c;if(l){l.focus();return}}if(document.querySelector(".deck-backdrop"))return;const h=document.querySelectorAll(".deck-container"),r=h[h.length-1];r&&r.tabIndex===-1&&r.focus()}},100);return()=>clearTimeout(t)};function As(t){if(!t)return;const n=Vt(),i=Y(n.pathname);se(()=>{i.current&&n.pathname!==i.current&&(t==null||t())},[n.pathname,t])}const Es=1e3*60,Cc=24*60*60*1e3,Wn=_t(async()=>{const{masto:t}=ce(),n=await t.v1.lists.list();return n.sort((i,s)=>i.title.localeCompare(s.title)),n.length&&setTimeout(()=>{me.account.set("lists",{lists:n,updatedAt:Date.now()})},1),n},{maxAge:Es});async function on(){try{const{lists:t,updatedAt:n}=me.account.get("lists")||{};return t!=null&&t.length?(Date.now()-n>Cc&&Wn(),t):await Wn()}catch{return[]}}const Ic=_t(t=>{const{masto:n}=ce();return n.v1.lists.$select(t).fetch()},{maxAge:Es});async function Rs(t){const{lists:n}=me.account.get("lists")||{};if(n!=null&&n.length){const i=n.find(s=>s.id===t);if(i)return i}try{return Ic(t)}catch{return null}}async function Tc(t){const n=await Rs(t);return(n==null?void 0:n.title)||""}function xc(t){const{lists:n}=me.account.get("lists")||{};n!=null&&n.length&&(n.push(t),n.sort((i,s)=>i.title.localeCompare(s.title)),me.account.set("lists",{lists:n,updatedAt:Date.now()}))}function Ac(t){const{lists:n}=me.account.get("lists")||{};if(n!=null&&n.length){const i=n.findIndex(s=>s.id===t.id);i!==-1&&(n[i]=t,n.sort((s,o)=>s.title.localeCompare(o.title)),me.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function Ec(t){const{lists:n}=me.account.get("lists")||{};if(n!=null&&n.length){const i=n.findIndex(s=>s.id===t);i!==-1&&(n.splice(i,1),me.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function mi({list:t,onClose:n}){const{masto:i}=ce(),[s,o]=M("default"),a=!!t,h=Y(),r=Y(),c=Y();se(()=>{a&&(h.current.value=t.title,r.current.value=t.repliesPolicy,c.current&&(c.current.checked=t.exclusive))},[a]);const l=Ze("@mastodon/list-exclusive")||Ze("@gotosocial/list-exclusive");return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})})," ",e("header",{children:e("h2",{children:a?g._({id:"tuhghE"}):g._({id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:p=>{p.preventDefault();const f=new FormData(p.target),m=f.get("title"),d=f.get("replies_policy"),v=f.get("exclusive")==="on";o("loading"),(async()=>{try{let b;a?b=await i.v1.lists.$select(t.id).update({title:m,replies_policy:d,exclusive:v}):b=await i.v1.lists.create({title:m,replies_policy:d,exclusive:v}),o("default"),n==null||n({state:"success",list:b}),setTimeout(()=>{a?Ac(b):xc(b)},1)}catch{o("error"),alert(a?g._({id:"R7ep1i"}):g._({id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(u,{id:"6YtxFj"})," ",e("input",{ref:h,type:"text",id:"list-title",name:"title",required:!0,disabled:s==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:r,name:"replies_policy",required:!0,disabled:s==="loading",children:[e("option",{value:"list",children:e(u,{id:"ei6pnR"})}),e("option",{value:"followed",children:e(u,{id:"Mr53YX"})}),e("option",{value:"none",children:e(u,{id:"PM7llw"})})]})}),l&&e("div",{class:"list-form-row",children:e("label",{class:"label-block",children:[e("input",{ref:c,type:"checkbox",name:"exclusive",disabled:s==="loading"})," ",e(u,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:s==="loading",children:a?g._({id:"tfDRzk"}):g._({id:"hYgDIe"})}),a&&e(lt,{disabled:s==="loading",align:"end",menuItemClassName:"danger",confirmLabel:g._({id:"+kQ/cY"}),onClick:()=>{o("loading"),(async()=>{try{await i.v1.lists.$select(t.id).remove(),o("default"),n==null||n({state:"deleted"}),setTimeout(()=>{Ec(t.id)},1)}catch{o("error"),alert(g._({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:s==="loading",children:e(u,{id:"Jb6/SB"})})})]})]})})]})}const Rc=[60*5,60*30,60*60,60*60*6,60*60*24,60*60*24*3,60*60*24*7,0],zt={0:{id:"9ZP9cc"},300:tt(5,"minute"),1800:tt(30,"minute"),3600:tt(1,"hour"),21600:tt(6,"hour"),86400:tt(1,"day"),259200:tt(3,"day"),604800:tt(1,"week")},Pi=80,Ls=1e3*60*10;function Lc(t,n){return n.v1.accounts.familiarFollowers.fetch({id:[t]})}const Mc=_t(Lc,{maxAge:Ls});async function $c(t,n){const i=n.v1.accounts.$select(t).statuses.list({limit:20}).next(),{value:s}=await i,o={total:s.length,originals:0,replies:0,boosts:0};return s.forEach(a=>{a.reblog?o.boosts++:a.inReplyToId&&a.inReplyToAccountId!==a.account.id?o.replies++:o.originals++}),s.length&&(o.daysSinceLastPost=Math.ceil((Date.now()-new Date(s[s.length-1].createdAt))/864e5)),o}const Dc=_t($c,{maxAge:Ls});function Ms({account:t,fetchAccount:n=()=>{},standalone:i,instance:s,authenticated:o}){const{i18n:a}=Qe(),{masto:h}=ce({instance:s}),{masto:r,instance:c}=ce(),[l,p]=M("default"),f=typeof t=="string",[m,d]=M(f?null:t),v=ke(()=>s===c,[s,c]);se(()=>{if(!f){d(t);return}p("loading"),(async()=>{try{const J=await n();A.accounts[`${J.id}@${s}`]=J,d(J),p("default")}catch{d(null),p("error")}})()},[f,t,n]);const{acct:b,avatar:y,avatarStatic:w,bot:k,createdAt:C,displayName:I,emojis:T,fields:_,followersCount:x,followingCount:$,group:D,id:L,lastStatusAt:q,locked:V,note:W,statusesCount:Z,url:F,username:H,memorial:N,moved:P,roles:j,hideCollections:B}=m||{};let ee=!1,{header:ge,headerStatic:ie}=m||{};(!ge||/missing\.png$/.test(ge))&&y&&!/missing\.png$/.test(y)&&(ge=y,ee=!0,w&&!/missing\.png$/.test(w)&&(ie=w));const be=ke(()=>L===wt(),[L]);se(()=>{const J=!!(m!=null&&m.id&&(m!=null&&m.username)&&(m!=null&&m.acct)&&(m!=null&&m.avatar)&&(m!=null&&m.avatarStatic)&&(m!=null&&m.displayName)&&(m!=null&&m.url));if(be&&s&&J){const Me=me.local.getJSON("accounts");let Oe=!1;Me.forEach(R=>{R.info.id===m.id&&R.instanceURL===s&&(R.info=m,Oe=!0)}),Oe&&me.local.setJSON("accounts",Me)}},[be,m,s]);const _e=ke(()=>F?Kt.toUnicode(URL.parse(F).hostname):null,[F]),[G,ae]=M([]),Ce=Y(),Ee=Y([]);async function Re(J){var Q;(J||!Ce.current)&&(Ce.current=h.v1.accounts.$select(L).followers.list({limit:Pi}));const Me=await Ce.current.next();if(be||!v)return Me;const{value:Oe}=Me;let R=[];if(J){let oe=[];try{oe=await h.v1.accounts.familiarFollowers.fetch({id:[L]})}catch{}Ee.current=((Q=oe==null?void 0:oe[0])==null?void 0:Q.accounts)||[],R=[...Ee.current,...Oe.filter(K=>!Ee.current.some(ne=>ne.id===K.id))]}else Oe!=null&&Oe.length&&(R=Oe.filter(oe=>!Ee.current.some(K=>K.id===oe.id)));return{...Me,value:R}}const Le=Y();async function Ne(J){return(J||!Le.current)&&(Le.current=h.v1.accounts.$select(L).following.list({limit:Pi})),await Le.current.next()}const ve=i?"div":ue,te=s?`/${s}/a/${L}`:`/a/${L}`,[pe,xe]=M([]),[le,X]=M(),[fe,O]=M("default"),E=!!(le!=null&&le.total),z=async J=>{try{const Me=await Mc(J,r);xe(Me[0].accounts.slice(0,Nc))}catch{}},re=async()=>{if(L){O("loading");try{const J=await Dc(L,h);X(J),O("default")}catch{O("error")}}},ye=ct(({relationship:J,currentID:Me})=>{J.following||(z(Me),!i&&Z>0&&re())},[i,L,Z]),Ie=ct(J=>{J.id===L&&(d(J),A.accounts[`${J.id}@${s}`]=J)},[L,s]);return e("div",{tabIndex:"-1",class:`account-container ${l==="loading"?"skeleton":""}`,style:{"--header-color-1":G[0],"--header-color-2":G[1],"--header-color-3":G[2],"--header-color-4":G[3]},children:[l==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(u,{id:"44hICK"})}),e("p",{children:e("a",{href:f?t:F,target:"_blank",rel:"noopener noreferrer",children:[e(u,{id:"Aadw0+"})," ",e(S,{icon:"external"})]})})]}),l==="loading"?e(U,{children:[e("header",{children:e(rt,{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(u,{id:"x5LEuB"})]}),e("div",{children:[e("span",{children:"โ–ˆโ–ˆ"})," ",e(u,{id:"following.stats"})]}),e("div",{children:[e("span",{children:"โ–ˆโ–ˆ"})," ",e(u,{id:"+owNNn"})]})]})]}),e("div",{class:"actions",children:[e("span",{}),e("span",{class:"buttons",children:e("button",{type:"button",class:"plain",disabled:!0,children:e(S,{icon:"more",size:"l",alt:a._({id:"2FYpfJ"})})})})]})]})]}):m&&e(U,{children:[!!P&&e("div",{class:"account-moved",children:[e("p",{children:e(u,{id:"C6cVP/",values:{displayName:I},components:{0:e("b",{})}})}),e(rt,{account:P,instance:s,onClick:J=>{J.stopPropagation(),A.showAccount=P}})]}),!!ge&&!/missing\.png$/.test(ge)&&e("img",{src:ge,alt:"",class:`header-banner ${ee?"header-is-avatar":""}`,onError:J=>{J.target.crossOrigin?J.target.src!==ie?J.target.src=ie:(J.target.removeAttribute("crossorigin"),J.target.src=ge):J.target.src!==ie?J.target.src=ie:J.target.remove()},crossOrigin:"anonymous",onLoad:J=>{J.target.classList.add("loaded");try{const Me=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),Oe=Me.getContext("2d",{willReadFrequently:!0});Me.width=J.target.width,Me.height=J.target.height,Oe.imageSmoothingEnabled=!1,Oe.drawImage(J.target,0,0);const R=10,oe=[Oe.getImageData(0,0,R,R).data,Oe.getImageData(J.target.width-R,0,R,R).data,Oe.getImageData(0,J.target.height-R,R,R).data,Oe.getImageData(J.target.width-R,J.target.height-R,R,R).data].map(K=>{let ne=0,$e=0,Te=0,Ae=0;for(let He=0;He{const[ne,$e,Te,Ae]=Oc(K);return`rgba(${ne}, ${$e}, ${Te}, ${Ae})`});ae(oe)}catch{}}}),e("header",{children:i?e(at,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(rt,{account:m,instance:s,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(Yc,{acct:b,instance:s})}),e(we,{onClick:()=>{const J=b.includes("@")?`@${b}`:`@${b}@${s}`;try{navigator.clipboard.writeText(J),de(a._({id:"zJoEwS"}))}catch{de(a._({id:"BC0lSD"}))}},children:[e(S,{icon:"link"}),e("span",{children:e(u,{id:"27x6gl"})})]}),e(we,{href:F,target:"_blank",children:[e(S,{icon:"external"}),e("span",{children:e(u,{id:"Bz5hLl"})})]}),e(Ge,{}),e(Be,{href:m.avatar,target:"_blank",children:[e(S,{icon:"user"}),e("span",{children:e(u,{id:"7WYl2I"})})]}),e(Be,{href:m.header,target:"_blank",children:[e(S,{icon:"media"}),e("span",{children:e(u,{id:"ZNme5R"})})]})]}):e(rt,{account:m,instance:s,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!N&&e("span",{class:"tag",children:e(u,{id:"prdIOK"})}),!!k&&e("span",{class:"tag",children:[e(S,{icon:"bot"})," ",e(u,{id:"9Vdq+j"})]}),!!D&&e("span",{class:"tag",children:[e(S,{icon:"group"})," ",e(u,{id:"L8fEEm"})]}),j==null?void 0:j.map(J=>e("span",{class:"tag",children:[J.name,!!_e&&e(U,{children:[" ",e("span",{class:"more-insignificant",children:_e})]})]})),e("div",{class:"note",dir:"auto",onClick:hs({instance:c}),dangerouslySetInnerHTML:{__html:jn(W,{emojis:T})}}),e("div",{class:"account-metadata-box",children:[(_==null?void 0:_.length)>0&&e("div",{class:"profile-metadata",children:_.map(({name:J,value:Me,verifiedAt:Oe},R)=>e("div",{class:`profile-field ${Oe?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(fs,{text:J,emojis:T})," ",!!Oe&&e(S,{icon:"check-circle",size:"s",alt:a._({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:jn(Me,{emojis:T})}})]},J+R))}),e("div",{class:"stats",children:[e(ve,{tabIndex:0,to:te,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={id:"followers",heading:a._({id:"x5LEuB"}),fetchAccounts:Re,instance:s,excludeRelationshipAttrs:be?["followedBy"]:[],blankCopy:B?a._({id:"BRV/wh"}):void 0}},0)},children:[!!pe.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:pe.map(J=>e(dt,{url:J.avatarStatic,size:"s",alt:`${J.displayName} @${J.acct}`,squircle:J==null?void 0:J.bot}))})}),e("span",{title:x,children:Ke(x)})," ",e(u,{id:"x5LEuB"})]}),e(ve,{class:"insignificant",tabIndex:0,to:te,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={heading:a._({id:"following.stats"}),fetchAccounts:Ne,instance:s,excludeRelationshipAttrs:be?["following"]:[],blankCopy:B?a._({id:"BRV/wh"}):void 0}},0)},children:[e("span",{title:$,children:Ke($)})," ",e(u,{id:"following.stats"}),e("br",{})]}),e(ve,{class:"insignificant",to:te,children:[e("span",{title:Z,children:Ke(Z)})," ",e(u,{id:"+owNNn"})]}),!!C&&e("div",{class:"insignificant",children:e(u,{id:"PCcEFZ",values:{0:ht(C,{hideTime:!0})},components:{0:e("time",{datetime:C})}})})]})]}),!!le&&e(ve,{to:te,class:"account-metadata-box",children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:E?e("div",{class:"posting-stats",title:a._({id:"wiuWLe",values:{0:(le.originals/le.total).toLocaleString(a.locale||void 0,{style:"percent"}),1:(le.replies/le.total).toLocaleString(a.locale||void 0,{style:"percent"}),2:(le.boosts/le.total).toLocaleString(a.locale||void 0,{style:"percent"})}}),children:[e("div",{children:le.daysSinceLastPost<365?a._({id:"oZUtTk",values:{0:le.total,1:le.daysSinceLastPost,2:le.daysSinceLastPost,3:le.daysSinceLastPost,4:le.total,5:le.total,6:le.daysSinceLastPost}}):a._({id:"JvA7Mo",values:{0:le.total,1:le.total}})}),e("div",{class:"posting-stats-bar",style:{"--originals-percentage":`${le.originals/le.total*100}%`,"--replies-percentage":`${(le.originals+le.replies)/le.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(u,{id:"HxF6Fk"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-replies"})," ",e(u,{id:"N8UzTV"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-legend-item-boosts"})," ",e(u,{id:"puY2t0"})]})]})]}):e("div",{class:"posting-stats",children:e(u,{id:"vl3XTJ"})})})})}),!P&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!le,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:fe==="loading",onClick:()=>{re()},children:[e("div",{class:`posting-stats-bar posting-stats-icon ${fe==="loading"?"loading":""}`,style:{"--originals-percentage":"33%","--replies-percentage":"66%"}}),e(u,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(Pc,{info:m,instance:s,standalone:i,authenticated:o,onRelationshipChange:ye,onProfileUpdate:Ie})})]})]})}const Nc=3;function Pc({info:t,instance:n,standalone:i,authenticated:s,onRelationshipChange:o=()=>{},onProfileUpdate:a=()=>{}}){var le;if(!t)return null;const{_:h}=Qe(),{masto:r,instance:c,authenticated:l}=ce(),p=n===c,[f,m]=M("default"),[d,v]=M(null),{id:b,acct:y,url:w,username:k,locked:C,lastStatusAt:I,note:T,fields:_,moved:x}=t,$=Y(b),{following:D,showingReblogs:L,notifying:q,followedBy:V,blocking:W,blockedBy:Z,muting:F,mutingNotifications:H,requested:N,domainBlocking:P,endorsed:j,note:B}=d||{},[ee,ge]=M(null),[ie,be]=M(!1),_e=y.includes("@")?y:`${y}@${n}`;se(()=>{if(t){const X=wt();let fe;(async()=>{if(p&&s)fe=b;else if(!p&&l){const E=t.acct.includes("@");try{const z=await r.v2.search.fetch({q:E?t.acct:`${t.username}@${n}`,type:"accounts",limit:1,resolve:!0});z.accounts.length&&(fe=z.accounts[0].id,ge(z.accounts[0]))}catch{}}if(!fe)return;if(X===fe){be(!0);return}$.current=fe,m("loading");const O=r.v1.accounts.relationships.fetch({id:[fe]});try{const E=await O;if(m("default"),E.length){const z=E[0];v(z),o({relationship:z,currentID:fe})}}catch{m("error")}})()}},[t,s]),se(()=>{t&&ie&&uo(t)},[t,ie]);const G=f==="loading",[ae,Ce]=M(!1),[Ee,Re]=M(!1),[Le,Ne]=M(!1),[ve,te]=M(!1),[pe,xe]=M([]);return e(U,{children:[e("div",{class:"actions",children:[e("span",{children:[V?e("span",{class:"tag",children:e(u,{id:"p3UO/y"})}):I?e("small",{class:"insignificant",children:e(u,{id:"F3cM1G",values:{0:ht(I,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),F&&e("span",{class:"tag danger",children:e(u,{id:"+IJm1Z"})}),W&&e("span",{class:"tag danger",children:e(u,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!B&&e("button",{type:"button",class:"private-note-tag",title:g._({id:"zxFxcH"}),onClick:()=>{Ne(!0)},dir:"auto",children:e("span",{children:B})}),e(at,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",disabled:G,children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),onMenuChange:X=>{D&&X.open&&(async()=>{try{const fe=await r.v1.accounts.$select($.current).lists.list();xe(fe)}catch{}})()},children:[l&&!ie&&e(U,{children:[e(we,{onClick:()=>{Ro({draftStatus:{status:`@${(ee==null?void 0:ee.acct)||y} `}})},children:[e(S,{icon:"at"}),e("span",{children:e(u,{id:"3LkfZu",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(we,{onClick:()=>{Ce(!0)},children:[e(S,{icon:"translate"}),e("span",{children:e(u,{id:"R8mSiS"})})]}),Ze("@mastodon/profile-private-note")&&e(we,{onClick:()=>{Ne(!0)},children:[e(S,{icon:"pencil"}),e("span",{children:B?g._({id:"U+Gokq"}):g._({id:"VcQzRi"})})]}),D&&!!d&&e(U,{children:[e(we,{onClick:()=>{m("loading"),(async()=>{try{const X=await r.v1.accounts.$select($.current).follow({notify:!q});X&&v(X),m("default"),de(X.notifying?g._({id:"jL3N0G",values:{username:k}}):g._({id:"WBugD/",values:{username:k}}))}catch(X){alert(X),m("error")}})()},children:[e(S,{icon:"notification"}),e("span",{children:q?g._({id:"osJmEN"}):g._({id:"I92Z+b"})})]}),e(we,{onClick:()=>{m("loading"),(async()=>{try{const X=await r.v1.accounts.$select($.current).follow({reblogs:!L});X&&v(X),m("default"),de(X.showingReblogs?g._({id:"0X2KC8",values:{username:k}}):g._({id:"cXWjH0",values:{username:k}}))}catch(X){alert(X),m("error")}})()},children:[e(S,{icon:"rocket"}),e("span",{children:L?g._({id:"GRUr8d"}):g._({id:"uREpT3"})})]})]}),D&&e(we,{onClick:()=>{Re(!0)},children:[e(S,{icon:"list"}),pe.length?e(U,{children:[e("small",{class:"menu-grow",children:[e(u,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:pe.map(X=>X.title).join(", ")})]}),e("small",{class:"more-insignificant",children:pe.length})]}):e("span",{children:e(u,{id:"sJ2yQc"})})]}),e(Ge,{})]}),e(we,{onClick:()=>{const X=`@${(ee==null?void 0:ee.acct)||_e}`;try{navigator.clipboard.writeText(X),de(g._({id:"zJoEwS"}))}catch{de(g._({id:"BC0lSD"}))}},children:[e(S,{icon:"copy"}),e("small",{children:[e(u,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",(ee==null?void 0:ee.acct)||_e]})]})]}),e(we,{href:w,target:"_blank",children:[e(S,{icon:"external"}),e("small",{class:"menu-double-lines",children:zc(w)})]}),e("div",{class:"menu-horizontal",children:[e(we,{onClick:()=>{try{navigator.clipboard.writeText(w),de(g._({id:"edWbV6"}))}catch{de(g._({id:"W1ewR0"}))}},children:[e(S,{icon:"link"}),e("span",{children:e(u,{id:"he3ygx"})})]}),(navigator==null?void 0:navigator.share)&&((le=navigator==null?void 0:navigator.canShare)==null?void 0:le.call(navigator,{url:w}))&&e(we,{onClick:()=>{try{navigator.share({url:w})}catch{alert(g._({id:"TtG3Uh"}))}},children:[e(S,{icon:"share"}),e("span",{children:e(u,{id:"LFKLqp"})})]})]}),!!d&&e(U,{children:[e(Ge,{}),F?e(we,{onClick:()=>{m("loading"),(async()=>{try{const X=await r.v1.accounts.$select((ee==null?void 0:ee.id)||b).unmute();v(X),m("default"),de(g._({id:"B4Xkly",values:{username:k}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{m("error")}})()},children:[e(S,{icon:"unmute"}),e("span",{children:e(u,{id:"Q/HUhC",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(wn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(U,{children:[e(S,{icon:"mute"}),e("span",{class:"menu-grow",children:e(u,{id:"xhPEH3",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})}),e("span",{style:{textOverflow:"clip"},children:[e(S,{icon:"time"}),e(S,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:Rc.map(X=>e(we,{onClick:()=>{m("loading"),(async()=>{try{const fe=await r.v1.accounts.$select((ee==null?void 0:ee.id)||b).mute({duration:X});v(fe),m("default"),de(g._({id:"/plB9m",values:{0:typeof zt[X]=="function"?zt[X]():h(zt[X]),username:k}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{m("error"),de(g._({id:"vWGBjT",values:{username:k}}))}})()},children:typeof zt[X]=="function"?zt[X]():h(zt[X])}))})}),V&&e(lt,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(U,{children:[e(S,{icon:"user-x"}),e("span",{children:e(u,{id:"unyq2W",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{m("loading"),(async()=>{try{const X=await r.v1.accounts.$select((ee==null?void 0:ee.id)||b).removeFromFollowers();v(X),m("default"),de(g._({id:"AgkcM/",values:{username:k}})),A.reloadGenericAccounts.id="followers",A.reloadGenericAccounts.counter++}catch{m("error")}})()},children:[e(S,{icon:"user-x"}),e("span",{children:e(u,{id:"VCZ0OT"})})]}),e(lt,{subMenu:!0,confirm:!W,confirmLabel:e(U,{children:[e(S,{icon:"block"}),e("span",{children:e(u,{id:"aforS9",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{m("loading"),(async()=>{try{if(W){const X=await r.v1.accounts.$select((ee==null?void 0:ee.id)||b).unblock();v(X),m("default"),de(g._({id:"sI9N29",values:{username:k}}))}else{const X=await r.v1.accounts.$select((ee==null?void 0:ee.id)||b).block();v(X),m("default"),de(g._({id:"uYcYzu",values:{username:k}}))}A.reloadGenericAccounts.id="block",A.reloadGenericAccounts.counter++}catch{m("error"),W?de(g._({id:"0tG4wG",values:{username:k}})):de(g._({id:"pA+qEx",values:{username:k}}))}})()},children:W?e(U,{children:[e(S,{icon:"unblock"}),e("span",{children:e(u,{id:"/3LJfX",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(U,{children:[e(S,{icon:"block"}),e("span",{children:e(u,{id:"JRswkR",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(we,{className:"danger",onClick:()=>{A.showReportModal={account:ee||t}},children:[e(S,{icon:"flag"}),e("span",{children:e(u,{id:"qTJgpR",values:{username:k},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),l&&ie&&i&&Ze("@mastodon/profile-edit")&&e(U,{children:[e(Ge,{}),e(we,{onClick:()=>{te(!0)},children:[e(S,{icon:"pencil"}),e("span",{children:e(u,{id:"9OpVZg"})})]})]}),!1]}),!d&&f==="loading"&&e(Pe,{abrupt:!0}),!!d&&!x&&e(lt,{confirm:D||N,confirmLabel:e("span",{children:N?g._({id:"e7qQIH"}):g._({id:"eYsAQr",values:{0:t.acct||t.username}})}),menuItemClassName:"danger",align:"end",disabled:G,onClick:()=>{m("loading"),(async()=>{try{let X;D||N?X=await r.v1.accounts.$select($.current).unfollow():X=await r.v1.accounts.$select($.current).follow(),X&&v(X),m("default")}catch(X){alert(X),m("error")}})()},children:e("button",{type:"button",class:`${D||N?"light swap":""}`,"data-swap-state":D||N?"danger":"",disabled:G,children:D?e(U,{children:[e("span",{children:e(u,{id:"y6sq5j"})}),e("span",{children:e(u,{id:"HKrBPX"})})]}):N?e(U,{children:[e("span",{children:e(u,{id:"Yx0Ud8"})}),e("span",{children:e(u,{id:"yTVtKs"})})]}):C?e(U,{children:[e(S,{icon:"lock"})," ",e("span",{children:e(u,{id:"MKEPCY"})})]}):g._({id:"MKEPCY"})})})]})]}),!!ae&&e(Fe,{onClose:()=>{Ce(!1)},children:e(Uc,{note:T,fields:_,onClose:()=>Ce(!1)})}),!!Ee&&e(Fe,{onClose:()=>{Re(!1)},children:e(Bc,{accountID:$.current,onClose:()=>Re(!1)})}),!!Le&&e(Fe,{onClose:()=>{Ne(!1)},children:e(Fc,{account:t,note:B,onRelationshipChange:X=>{v(X)},onClose:()=>Ne(!1)})}),!!ve&&e(Fe,{onClose:()=>{te(!1)},children:e(Hc,{onClose:({state:X,account:fe}={})=>{te(!1),X==="success"&&fe&&a(fe)}})})]})}function Oc([t,n,i]){const s=.2126*t+.7152*n+.0722*i;let o;return s>=220?o=1:s<=50?o=.1:o=s/255,o=Math.min(1,o),[t,n,i,o]}function zc(t){if(!t)return;const n=URL.parse(t),{host:i,pathname:s}=n,o=s.replace(/\/$/,"").replace(/^\//,"");return e(U,{children:[e("span",{class:"more-insignificant",children:[Kt.toUnicode(i),"/"]}),e("wbr",{}),e("span",{children:o})]})}function Uc({note:t,fields:n,onClose:i}){const s=(n==null?void 0:n.map(({name:a,value:h})=>`${a} ${Ti(h)}`).join(` `))||"",o=Ti(t)+(s?` ${s}`:"");return e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"9groMz"})})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:o}),e(ps,{forceTranslate:!0,text:o})]})]})}function Bc({accountID:t,onClose:n}){const{masto:i}=ce(),[s,o]=M("default"),[a,h]=M([]),[r,c]=M([]),[l,p]=Mt(d=>d+1,0);se(()=>{o("loading"),(async()=>{try{const d=await on();h(d);const v=await i.v1.accounts.$select(t).lists.list();c(v),o("default")}catch{o("error")}})()},[l]);const[f,m]=M(!1);return e("div",{class:"sheet",id:"list-add-remove-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"sJ2yQc"})})}),e("main",{children:[a.length>0?e("ul",{class:"list-add-remove",children:a.map(d=>{const v=r.some(b=>b.id===d.id);return e("li",{children:e("button",{type:"button",class:`light ${v?"checked":""}`,disabled:s==="loading",onClick:()=>{o("loading"),(async()=>{try{v?await i.v1.lists.$select(d.id).accounts.remove({accountIds:[t]}):await i.v1.lists.$select(d.id).accounts.create({accountIds:[t]}),p()}catch{o("error"),alert(v?g._({id:"7KnEYa"}):g._({id:"Tba8uO"}))}})()},children:[e(S,{icon:"check-circle",alt:"โ˜‘๏ธ"}),e("span",{children:d.title})]})})})}):s==="loading"?e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}):s==="error"?e("p",{class:"ui-state",children:e(u,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(u,{id:"/MJ7gZ"})}),e("button",{type:"button",class:"plain2",onClick:()=>m(!0),disabled:s!=="default",children:[e(S,{icon:"plus",size:"l"})," ",e("span",{children:e(u,{id:"Sb2gYF"})})]})]}),f&&e(Fe,{onClick:d=>{d.target===d.currentTarget&&m(!1)},children:e(mi,{list:f==null?void 0:f.list,onClose:d=>{d.state==="success"&&p(),m(!1)}})})]})}function Fc({account:t,note:n,onRelationshipChange:i=()=>{},onClose:s=()=>{}}){const{masto:o}=ce(),[a,h]=M("default"),r=Y(null);return se(()=>{let c;return r.current&&!n&&(c=setTimeout(()=>{var l,p;(p=(l=r.current).focus)==null||p.call(l)},100)),()=>{clearTimeout(c)}},[]),e("div",{class:"sheet",id:"private-note-container",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"DYqYm5",values:{0:(t==null?void 0:t.username)||(t==null?void 0:t.acct)},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:e("form",{onSubmit:c=>{c.preventDefault();const p=new FormData(c.target).get("note");(p==null?void 0:p.trim())!==(n==null?void 0:n.trim())&&(h("loading"),(async()=>{try{const f=await o.v1.accounts.$select(t==null?void 0:t.id).note.create({comment:p});h("default"),i(f),s()}catch(f){h("error"),alert((f==null?void 0:f.message)||g._({id:"ot8LpF"}))}})())},children:[e("textarea",{ref:r,name:"note",disabled:a==="loading",dir:"auto",children:n}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:a==="loading",onClick:()=>{s==null||s()},children:e(u,{id:"dEgA5A"})}),e("span",{children:[e(Pe,{abrupt:!0,hidden:a!=="loading"}),e("button",{disabled:a==="loading",type:"submit",children:e(u,{id:"SrwrEj"})})]})]})]})})]})}function Hc({onClose:t=()=>{}}){const{masto:n}=ce(),[i,s]=M("loading"),[o,a]=M(null);se(()=>{(async()=>{try{const f=await n.v1.accounts.verifyCredentials();a(f),s("default")}catch{s("error")}})()},[]);const{displayName:h,source:r}=o||{},{note:c,fields:l}=r||{},p=Y(null);return e("div",{class:"sheet",id:"edit-profile-container",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"9OpVZg"})})}),e("main",{children:i==="loading"?e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}):e("form",{onSubmit:f=>{f.preventDefault();const m=new FormData(f.target),d=m.get("display_name"),v=m.get("note"),b=p.current.querySelectorAll('input[name^="fields_attributes"]'),y=[];b.forEach(w=>{const k=w.name,[C,I,T]=k.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],_=w.value?w.value.trim():"";I&&T&&_&&(y[I]||(y[I]={}),y[I][T]=_)}),y.forEach(w=>{w.name&&!w.value&&(w.value="")}),(async()=>{try{const w=await n.v1.accounts.updateCredentials({displayName:d,note:v,fieldsAttributes:y});t==null||t({state:"success",account:w})}catch(w){alert((w==null?void 0:w.message)||g._({id:"FwMMx0"}))}})()},children:[e("p",{children:e("label",{children:[e(u,{id:"6YtxFj"})," ",e("input",{type:"text",name:"display_name",defaultValue:h,maxLength:30,disabled:i==="loading",dir:"auto"})]})}),e("p",{children:e("label",{children:[e(u,{id:"E+oKCO"}),e("textarea",{defaultValue:c,name:"note",maxLength:500,rows:"5",disabled:i==="loading",dir:"auto"})]})}),e("p",{children:e(u,{id:"T4I119"})}),e("table",{ref:p,children:[e("thead",{children:e("tr",{children:[e("th",{children:e(u,{id:"87a/t/"})}),e("th",{children:e(u,{id:"4b3oEV"})})]})}),e("tbody",{children:Array.from({length:Math.max(4,l.length)}).map((f,m)=>{const{name:d="",value:v=""}=l[m]||{};return e(qc,{name:d,value:v,index:m,disabled:i==="loading"},m)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:i==="loading",onClick:()=>{t==null||t()},children:e(u,{id:"dEgA5A"})}),e("button",{type:"submit",disabled:i==="loading",children:e(u,{id:"tfDRzk"})})]})]})})]})}function qc({name:t,value:n,disabled:i,index:s}){const[o,a]=M(!!n);return e("tr",{children:[e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][name]`,defaultValue:t,disabled:i,maxLength:255,required:o,dir:"auto"})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${s}][value]`,defaultValue:n,disabled:i,maxLength:255,onChange:h=>a(!!h.currentTarget.value),dir:"auto"})})]})}function Yc({acct:t,instance:n}){let[i,s]=t.split("@");return s||(s=n),e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",children:[e("b",{class:"handle-username",children:i}),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(u,{id:"silO9A"})]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," ",e(u,{id:"rZgCpJ"})]})]})]})}function jc({account:t,instance:n,onClose:i}){const{masto:s,instance:o,authenticated:a}=ce({instance:n}),h=typeof t=="string";return se(()=>{h||(A.accounts[`${t.id}@${o}`]=t)},[t]),As(i),e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close outer",onClick:i,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e(Ms,{instance:o,authenticated:a,account:t,fetchAccount:async()=>{if(h)try{return await s.v1.accounts.lookup({acct:t,skip_webfinger:!1})}catch{const c=await s.v2.search.fetch({q:t,type:"accounts",limit:1,resolve:a});if(c.accounts.length)return c.accounts[0];if(/https?:\/\/[^/]+\/@/.test(t)){const l=URL.parse(t),{hostname:p,pathname:f}=l,m=f.replace(/^\//,"").replace(/\/$/,"")+"@"+p,d=await s.v2.search.fetch({q:m,type:"accounts",limit:1,resolve:a});if(d.accounts.length)return d.accounts[0]}}else return t}})]})}function Vc({onClose:t}){const{masto:n}=ce(),[i,s]=M("default"),[o,a]=M([]),[h,r]=Mt(l=>l+1,0);se(()=>{s("loading"),(async()=>{try{const l=await ut.drafts.keys();if(l.length){const p=yn(),f=l.filter(m=>m.startsWith(p));if(f.length){const m=await ut.drafts.getMany(f);m.sort((d,v)=>new Date(v.updatedAt).getTime()-new Date(d.updatedAt).getTime()),a(m)}else a([])}else a([]);s("default")}catch{s("error")}})()},[h]);const c=(o==null?void 0:o.length)>0;return e("div",{class:"sheet",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(u,{id:"krk5ws"})," ",e(Pe,{abrupt:!0,hidden:i!=="loading"})]}),c&&e("div",{class:"insignificant",children:e(u,{id:"Ap/10+"})})]}),e("main",{children:c?e(U,{children:[e("ul",{class:"drafts-list",children:o.map(l=>{const{updatedAt:p,key:f,draftStatus:m,replyTo:d}=l,v=new Date(p);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(S,{icon:d?"reply":"quill",size:"s"})," ",e("time",{children:[!!d&&e(U,{children:[e("span",{class:"bidi-isolate",children:["@",d.account.acct]}),e("br",{})]}),ht(v)]})]}),e(lt,{confirmLabel:e("span",{children:e(u,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:i==="loading",onClick:()=>{(async()=>{try{await ut.drafts.del(f),r()}catch{alert(g._({id:"rEYoku"}))}})()},children:e("button",{type:"button",class:"small light",disabled:i==="loading",children:e(u,{id:"Jb6/SB"})})})]}),e("button",{type:"button",disabled:i==="loading",class:"draft-item",onClick:async()=>{let b;if(d){s("loading");try{b=await n.v1.statuses.$select(d.id).fetch()}catch{alert(g._({id:"tMwimH"})),s("default");return}s("default")}window.__COMPOSE__={draftStatus:m,replyToStatus:b},A.showCompose=!0,A.showDrafts=!1},children:e(Gc,{draft:l})})]},p)})}),o.length>1&&e("p",{children:e(lt,{confirmLabel:e("span",{children:e(u,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:i==="loading",onClick:()=>{(async()=>{s("loading");try{await ut.drafts.delMany(o.map(l=>l.key)),s("default"),r()}catch{alert(g._({id:"0J4sZq"})),s("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:i==="loading",children:e(u,{id:"hOg+Mt"})})})})]}):e("p",{children:e(u,{id:"8iQ+jk"})})})]})}function Gc({draft:t}){var f;const{draftStatus:n,replyTo:i}=t,{status:s,spoilerText:o,poll:a,mediaAttachments:h}=n,r=((f=a==null?void 0:a.options)==null?void 0:f.length)>0,c=(h==null?void 0:h.length)>0,l=r||c,p=ke(()=>{if(!c)return;const m=h.find(b=>/image/.test(b.type));if(!m)return;const{file:d}=m;return URL.createObjectURL(d)},[c,h]);return e(U,{children:e("div",{class:"mini-draft",children:[l&&e("div",{class:`mini-draft-aside ${p?"has-image":""}`,style:p?{"--bg-image":`url(${p})`}:{},children:[r&&e(S,{icon:"poll",alt:g._({id:"4WUbF1"})}),c&&e("span",{children:[e(S,{icon:"attachment",alt:g._({id:"xYilR2"})})," ",e("small",{children:h==null?void 0:h.length})]})]}),e("div",{class:"mini-draft-main",children:[!!o&&e("div",{class:"mini-draft-spoiler",children:o}),!!s&&e("div",{class:"mini-draft-status",children:s})]})]})})}function Kc({html:t,url:n,width:i,height:s,onClose:o=()=>{}}){return e("div",{class:"embed-modal-container",children:[e("div",{class:"top-controls",children:[e("button",{type:"button",class:"light",onClick:()=>o(),children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),n&&e("a",{href:n,target:"_blank",rel:"noopener noreferrer",class:"button plain",children:[e("span",{children:e(u,{id:"4/RpOy"})})," ",e(S,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:t},style:{"--width":i+"px","--height":s+"px","--aspect-ratio":`${i}/${s}`}})]})}function Wc({instance:t,excludeRelationshipAttrs:n=[],postID:i,onClose:s=()=>{},blankCopy:o=g._({id:"10OlfF"})}){const{masto:a,instance:h}=ce(),r=t?t===h:!0,c=qe(A),[l,p]=M("default"),[f,m]=M([]),[d,v]=M(!1);if(As(s),!c.showGenericAccounts)return null;const{id:b,heading:y,fetchAccounts:w,accounts:k,showReactions:C}=c.showGenericAccounts,[I,T]=M({}),_=async L=>{if(!(L!=null&&L.length)||!r)return;const q=await si(L,I);q&&T({...I,...q})},x=L=>{w&&(L&&m([]),p("loading"),(async()=>{try{const{done:q,value:V}=await w(L);if(Array.isArray(V)){if(L){const W=[];for(let Z=0;ZN.id===F.id&&Z!==P);H?H._types.push(...F._types):W.push({_types:[],...F})}m(W)}else m(W=>{const Z=W;for(const F of V){const H=Z.find(N=>N.id===F.id);H?H._types.push(...F._types):Z.push(F)}return Z});v(!q),_(V)}else v(!1);p("default")}catch{p("error")}})())},$=Y(!0);se(()=>{(k==null?void 0:k.length)>0?(m(k),_(k)):(x(!0),$.current=!1)},[k,w]),se(()=>{var L;$.current||((L=c.reloadGenericAccounts)==null?void 0:L.id)===b&&x(!0)},[c.reloadGenericAccounts.counter]);const D=A.statuses[i];return e("div",{id:"generic-accounts-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:y||g._({id:"bPwFdf"})})}),e("main",{children:[D&&e(ue,{to:`/${t||h}/s/${D.id}`,class:"post-preview",children:e(Ye,{status:D,size:"s",readOnly:!0})}),f.length>0?e(U,{children:[e("ul",{class:"accounts-list",children:f.map(L=>{var W,Z;const q=I[L.id],V=`${L.id}-${((W=L._types)==null?void 0:W.length)||""}`;return e("li",{children:[C&&((Z=L._types)==null?void 0:Z.length)>0&&e("div",{class:"reactions-block",children:L._types.map(F=>e(S,{icon:{reblog:"rocket",favourite:"heart"}[F],class:`${F}-icon`}))}),e("div",{class:"account-relationships",children:e(rt,{account:L,showStats:!0,relationship:q,excludeRelationshipAttrs:n})})]},V)})}),l==="default"?d?e(kt,{onChange:L=>{L&&x()},children:e("button",{type:"button",class:"plain block",onClick:()=>x(),children:e(u,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(u,{id:"2EYeAZ"})}):l==="loading"&&e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})})]}):l==="loading"?e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}):l==="error"?e("p",{class:"ui-state",children:e(u,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:o})]})]})}function Zc({alt:t,lang:n,onClose:i}){const s=qe(A),[o,a]=M(!1),h=us(!0),r=s.settings.contentTranslationHideLanguages||[],c=!!n&&n!==h&&!_i([n],[h])&&!r.find(l=>n===l||_i([n],[l]));return e("div",{class:"sheet",tabindex:"-1",children:[!!i&&e("button",{type:"button",class:"sheet-close outer",onClick:i,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:[e("h2",{children:e(u,{id:"5gfDMm"})}),e("div",{class:"header-side",children:e(at,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(S,{icon:"more",alt:g._({id:"2FYpfJ"}),size:"xl"})}),children:[e(we,{disabled:o,onClick:()=>{a(!0)},children:[e(S,{icon:"translate"}),e("span",{children:e(u,{id:"pi8x/S"})})]}),Lo&&e(we,{onClick:()=>{Mo(t,n)},children:[e(S,{icon:"speak"}),e("span",{children:e(u,{id:"yIBLq8"})})]})]})})]}),e("main",{lang:n,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:t}),(c||o)&&e(ps,{forceTranslate:o,sourceLanguage:n,text:t})]})]})}const{min:sd,max:od}=Math;const $s={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])$s[`[object ${t}]`]=t.toLowerCase();function Xc(t){return $s[Object.prototype.toString.call(t)]||"object"}const Wt=(t,n=null)=>t.length>=3?Array.prototype.slice.call(t):Xc(t[0])=="object"&&n?n.split("").filter(i=>t[0][i]!==void 0).map(i=>t[0][i]):t[0].slice(0);const{PI:En,min:cd,max:ad}=Math;const rd=En*2,ld=En/3,Jc=En/180,Qc=180/En;function Sn(t,n){let i=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(n[0])||(n=n.map(h=>[h]));let s=n[0].length,o=n[0].map((h,r)=>n.map(c=>c[r])),a=t.map(h=>o.map(r=>Array.isArray(h)?h.reduce((c,l,p)=>c+l*(r[p]||0),0):r.reduce((c,l)=>c+l*h,0)));return i===1&&(a=a[0]),s===1?a.map(h=>h[0]):a}const Ds={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 On=t=>{const n=Math.sign(t);return t=Math.abs(t),(t<=.0031308?t*12.92:1.055*Math.pow(t,1/2.4)-.055)*n},ea=(t,n,i)=>{const{MtxAdaptMa:s,MtxAdaptMaI:o,MtxXYZ2RGB:a,RefWhiteRGB:h,Xn:r,Yn:c,Zn:l}=Ds,p=r*s.m00+c*s.m10+l*s.m20,f=r*s.m01+c*s.m11+l*s.m21,m=r*s.m02+c*s.m12+l*s.m22,d=h.X*s.m00+h.Y*s.m10+h.Z*s.m20,v=h.X*s.m01+h.Y*s.m11+h.Z*s.m21,b=h.X*s.m02+h.Y*s.m12+h.Z*s.m22,y=(t*s.m00+n*s.m10+i*s.m20)*(d/p),w=(t*s.m01+n*s.m11+i*s.m21)*(v/f),k=(t*s.m02+n*s.m12+i*s.m22)*(b/m),C=y*o.m00+w*o.m10+k*o.m20,I=y*o.m01+w*o.m11+k*o.m21,T=y*o.m02+w*o.m12+k*o.m22,_=On(C*a.m00+I*a.m10+T*a.m20),x=On(C*a.m01+I*a.m11+T*a.m21),$=On(C*a.m02+I*a.m12+T*a.m22);return[_*255,x*255,$*255]},gi=(...t)=>{t=Wt(t,"lab");const[n,i,s,...o]=t,[a,h,r]=ta([n,i,s]),[c,l,p]=ea(a,h,r);return[c,l,p,...o.length>0&&o[0]<1?[o[0]]:[]]};function ta(t){var n=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],i=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],s=Sn(i,t);return Sn(n,s.map(o=>o**3))}function zn(t){const n=Math.sign(t);return t=Math.abs(t),(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*n}const na=(t,n,i)=>{t=zn(t/255),n=zn(n/255),i=zn(i/255);const{MtxRGB2XYZ:s,MtxAdaptMa:o,MtxAdaptMaI:a,Xn:h,Yn:r,Zn:c,As:l,Bs:p,Cs:f}=Ds;let m=t*s.m00+n*s.m10+i*s.m20,d=t*s.m01+n*s.m11+i*s.m21,v=t*s.m02+n*s.m12+i*s.m22;const b=h*o.m00+r*o.m10+c*o.m20,y=h*o.m01+r*o.m11+c*o.m21,w=h*o.m02+r*o.m12+c*o.m22;let k=m*o.m00+d*o.m10+v*o.m20,C=m*o.m01+d*o.m11+v*o.m21,I=m*o.m02+d*o.m12+v*o.m22;return k*=b/l,C*=y/p,I*=w/f,m=k*a.m00+C*a.m10+I*a.m20,d=k*a.m01+C*a.m11+I*a.m21,v=k*a.m02+C*a.m12+I*a.m22,[m,d,v]},bi=(...t)=>{const[n,i,s,...o]=Wt(t,"rgb"),a=na(n,i,s);return[...ia(a),...o.length>0&&o[0]<1?[o[0]]:[]]};function ia(t){const n=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],i=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],s=Sn(n,t);return Sn(i,s.map(o=>Math.cbrt(o)))}const{sin:sa,cos:oa}=Math,ca=(...t)=>{let[n,i,s]=Wt(t,"lch");return isNaN(s)&&(s=0),s=s*Jc,[n,oa(s)*i,sa(s)*i]},Un=(...t)=>{t=Wt(t,"lch");const[n,i,s,...o]=t,[a,h,r]=ca(n,i,s),[c,l,p]=gi(a,h,r);return[c,l,p,...o.length>0&&o[0]<1?[o[0]]:[]]},{sqrt:aa,atan2:ra,round:la}=Math,da=(...t)=>{const[n,i,s]=Wt(t,"lab"),o=aa(i*i+s*s);let a=(ra(s,i)*Qc+360)%360;return la(o*1e4)===0&&(a=Number.NaN),[n,o,a]},ua=(...t)=>{const[n,i,s,...o]=Wt(t,"rgb"),[a,h,r]=bi(n,i,s),[c,l,p]=da(a,h,r);return[c,l,p,...o.length>0&&o[0]<1?[o[0]]:[]]},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_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:dd}=ha;function Ns({mediaAttachments:t,statusID:n,instance:i,lang:s,index:o=0,onClose:a=()=>{}}){var C,I;const[h,r]=M("default"),c=Y(null),[l,p]=M(o),f=Y(null);gt(()=>{var T;(T=f.current)==null||T.scrollIntoView()},[]);const m=Y(n);se(()=>{const T=o*c.current.clientWidth,_=m.current!==n;_&&(m.current=n),c.current.focus(),c.current.scrollTo({left:T*(Et()?-1:1),behavior:_?"auto":"smooth"})},[o,n]);const[d,v]=M(!0);se(()=>{let T=()=>{a()};return c.current&&c.current.addEventListener("swiped-down",T),()=>{c.current&&c.current.removeEventListener("swiped-down",T)}},[]),Ue("esc",a,{ignoreEventWhen:T=>!!document.querySelector("#modal-container > *")},[a]),se(()=>{let T=()=>{const{clientWidth:_,scrollLeft:x}=c.current,$=Math.round(Math.abs(x)/_);p($)};return c.current&&c.current.addEventListener("scroll",T,{passive:!0}),()=>{c.current&&c.current.removeEventListener("scroll",T)}},[]),se(()=>{let T=setTimeout(()=>{var _,x;(x=(_=c.current)==null?void 0:_.focus)==null||x.call(_)},100);return()=>clearTimeout(T)},[]);const b=ke(()=>t==null?void 0:t.map(T=>{const{blurhash:_}=T;if(_){const x=oi(_);return ua(x)}return null}),[t]),y=ke(()=>b==null?void 0:b.map(T=>T?{light:Un([.95,.01,T[2]]),dark:Un([.35,.01,T[2]]),default:Un([.6,T[1],T[2]])}:{})),w=ke(()=>{const _=100/y.length,x=y.map((L,q)=>{var Z,F,H,N;const V=q*_+5,W=(q+1)*_-5;return L!=null&&L.light&&(L!=null&&L.dark)?{light:` rgb(${(Z=L.light)==null?void 0:Z.join(",")}) ${V}%, rgb(${(F=L.light)==null?void 0:F.join(",")}) ${W}% `,dark:` rgb(${(H=L.dark)==null?void 0:H.join(",")}) ${V}%, rgb(${(N=L.dark)==null?void 0:N.join(",")}) ${W}% `}:{light:` transparent ${V}%, transparent ${W}% `,dark:` transparent ${V}%, transparent ${W}% `}}),$=x.map(L=>L.light).join(", "),D=x.map(L=>L.dark).join(", ");return{light:$,dark:D}},[y]);let k=Y(null);return se(()=>()=>{var T,_;(_=(T=k.current)==null?void 0:T.hideToast)==null||_.call(T)},[]),gt(()=>{const T=y[l];let _,x;if(T){const $=me.local.get("theme");if($){const D=`rgb(${T[$].join(",")})`;_=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),_&&(x=_.content,_.content=D)}else{const D=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",L=`rgb(${T[D].join(",")})`;_=document.querySelector(`meta[name="theme-color"][media*="${D}"]`),_&&(x=_.content,_.content=L)}}return()=>{_&&x&&(_.content=x)}},[l,y]),e("div",{class:`media-modal-container media-modal-count-${t==null?void 0:t.length}`,children:[e("div",{ref:c,tabIndex:"0","data-swipe-threshold":"44",class:"carousel",onClick:T=>{(T.target.classList.contains("carousel-item")||T.target.classList.contains("media")||T.target.classList.contains("media-zoom"))&&a()},style:t.length>1?{backgroundAttachment:"local","--accent-gradient-light":w==null?void 0:w.light,"--accent-gradient-dark":w==null?void 0:w.dark}:{},children:t==null?void 0:t.map((T,_)=>{var $,D;const x=t.length===1?y[_]:null;return e("div",{class:"carousel-item",style:x?{"--accent-color":`rgb(${x.default.join(",")})`,"--accent-light-color":`rgb(${($=x.light)==null?void 0:$.join(",")})`,"--accent-dark-color":`rgb(${(D=x.dark)==null?void 0:D.join(",")})`,"--accent-alpha-color":`rgba(${x.default.join(",")}, 0.4)`}:{},tabindex:"0",ref:_===l?f:null,onClick:L=>{L.target.classList.contains("media")||v(!d)},children:[!!T.description&&e("button",{type:"button",class:"media-alt",hidden:!d,onClick:()=>{A.showMediaAlt={alt:T.description,lang:s}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:s,dir:"auto",children:T.description})]}),e(ms,{media:T,showOriginal:!0,lang:s})]},T.id)})}),e("div",{class:"carousel-top-controls",hidden:!d,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:()=>a(),children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})})}),(t==null?void 0:t.length)>1?e("span",{class:"carousel-dots",children:t==null?void 0:t.map((T,_)=>e("button",{type:"button",disabled:_===l,class:`carousel-dot ${_===l?"active":""}`,onClick:x=>{x.preventDefault(),x.stopPropagation();const $=c.current.clientWidth*_*(Et()?-1:1);c.current.focus(),c.current.scrollTo({left:$,behavior:"smooth"})},children:e(S,{icon:"round",size:"s",alt:"โธฑ"})},T.id))}):e("span",{}),e("span",{children:[e(at,{overflow:"auto",align:"end",position:"anchor",gap:4,menuClassName:"glass-menu",menuButton:e("button",{type:"button",class:"carousel-button",children:e(S,{icon:"more",alt:g._({id:"2FYpfJ"})})}),children:[e(Be,{href:((C=t[l])==null?void 0:C.remoteUrl)||((I=t[l])==null?void 0:I.url),class:"carousel-button",target:"_blank",title:g._({id:"5hXGws"}),children:[e(S,{icon:"popout"}),e("span",{children:e(u,{id:"aDr7Vc"})})]}),!1]})," ",e(ue,{to:`${i?`/${i}`:""}/s/${n}${window.matchMedia("(min-width: calc(40em + 350px))").matches?`?media=${l+1}`:""}`,class:"button carousel-button media-post-link",children:[e("span",{class:"button-label",children:[e(u,{id:"ISg5SQ"})," "]}),"ยป"]})]})]}),(t==null?void 0:t.length)>1&&e("div",{class:"carousel-controls",hidden:!d,children:[e("button",{type:"button",class:"carousel-button",hidden:l===0,onClick:T=>{T.preventDefault(),T.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(l-1)*(Et()?-1:1),behavior:"smooth"})},children:e(S,{icon:"arrow-left",alt:g._({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:l===t.length-1,onClick:T=>{T.preventDefault(),T.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(l+1)*(Et()?-1:1),behavior:"smooth"})},children:e(S,{icon:"arrow-right",alt:g._({id:"hXzOVo"})})})]})]})}const fa=[,"spam","legal","violation","other"],Zt={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 pa({account:t,post:n,onClose:i}){const{_:s}=Qe(),{masto:o}=ce(),[a,h]=M("default"),[r,c]=t.acct.split("@"),[l,p]=ke(()=>{const{rules:k,domain:C}=cs();return[k||[],C]}),[f,m]=M(null),[d,v]=M(!1),b=Y(null),[y,w]=M(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:n?g._({id:"muLhL3"}):g._({id:"ACul2G",values:{username:r}})}),e("button",{type:"button",class:"plain4 small",disabled:a==="loading",onClick:()=>i(),children:e(S,{icon:"x",size:"xl",alt:g._({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:n?e(Ye,{status:n,size:"s",previewMode:!0}):e(rt,{account:t,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!f&&!Zt[f].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[s(Zt[f].stampLabel||s(Zt[f].label)),e("small",{children:e(u,{id:"2WtL62"})})]},f),e("form",{onSubmit:k=>{k.preventDefault();const C=new FormData(k.target),I=Object.fromEntries(C.entries());let{category:T,comment:_,forward:x}=I;_||(_=void 0),x==="on"&&(x=!0);const $=T==="violation"?Object.entries(I).filter(([L])=>L.startsWith("rule_ids")).map(([L,q])=>q):void 0,D={category:T,comment:_,forward:x,ruleIds:$};h("loading"),(async()=>{try{await o.v1.reports.create({accountId:t.id,statusIds:n!=null&&n.id?[n.id]:void 0,category:T,comment:_,ruleIds:$,forward:x}),h("success"),de(n?g._({id:"y3ou+8"}):g._({id:"R9kjEL"})),i()}catch(L){h("error"),de((L==null?void 0:L.message)||(n?g._({id:"+3FjPq"}):g._({id:"oEQq5w"})))}})()},children:[e("p",{children:n?g._({id:"L9fUm+"}):g._({id:"rSLkfe"})}),e("section",{class:"report-categories",children:fa.map(k=>k==="violation"&&!(l!=null&&l.length)?null:e(U,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:k,required:!0,disabled:a==="loading",onChange:C=>{m(C.target.value),v(C.target.value==="violation")}}),e("span",{children:[s(Zt[k].label)," ย ",e("small",{class:"ib insignificant",children:s(Zt[k].description)})]})]}),k==="violation"&&!!(l!=null&&l.length)&&e("div",{class:"shazam-container no-animation",hidden:!d,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:b,children:l.map((C,I)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${I}]`,value:C.id,required:d&&!y,disabled:a==="loading",onChange:T=>{const{checked:_}=T.target;_?w(!0):b.current.querySelectorAll("input:checked").length||w(!1)}}),e("span",{children:C.text})]},C.id))})})})]},k))}),e("section",{class:"report-comment",children:[e("p",{children:e("label",{for:"report-comment",children:e(u,{id:"ecVtjm"})})}),e("textarea",{maxlength:"1000",rows:"1",name:"comment",id:"report-comment",disabled:a==="loading",required:!n})]}),!!c&&c!==p&&e("section",{children:e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,name:"forward",disabled:a==="loading"})," ",e("span",{children:e(u,{id:"cyjS8M",values:{domain:c},components:{0:e("i",{})}})})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:a==="loading",children:e(u,{id:"4cijjm"})})," ",e("button",{type:"submit",class:"plain2",disabled:a==="loading",onClick:async()=>{try{await o.v1.accounts.$select(t.id).mute(),de(g._({id:"/BGBeF",values:{username:r}}))}catch{de(g._({id:"v02K7/",values:{username:r}}))}},children:e(u,{id:"caeqw/",components:{0:e("small",{class:"ib"})}})})," ",e("button",{type:"submit",class:"plain2",disabled:a==="loading",onClick:async()=>{try{await o.v1.accounts.$select(t.id).block(),de(g._({id:"kjUejn",values:{username:r}}))}catch{de(g._({id:"pMcdDp",values:{username:r}}))}},children:e(u,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(Pe,{hidden:a!=="loading"})]})]})]})]})}var vi={exports:{}},ud=vi.exports;(function(t){var n=function(){var i=String.fromCharCode,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function h(c,l){if(!a[c]){a[c]={};for(var p=0;p>>8,p[f*2+1]=d%256}return p},decompressFromUint8Array:function(c){if(c==null)return r.decompress(c);for(var l=new Array(c.length/2),p=0,f=l.length;p>1}else{for(m=1,f=0;f>1}k--,k==0&&(k=Math.pow(2,I),I++),delete v[w]}else for(m=d[w],f=0;f>1;k--,k==0&&(k=Math.pow(2,I),I++),d[y]=C++,w=String(b)}if(w!==""){if(Object.prototype.hasOwnProperty.call(v,w)){if(w.charCodeAt(0)<256){for(f=0;f>1}else{for(m=1,f=0;f>1}k--,k==0&&(k=Math.pow(2,I),I++),delete v[w]}else for(m=d[w],f=0;f>1;k--,k==0&&(k=Math.pow(2,I),I++)}for(m=2,f=0;f>1;for(;;)if(_=_<<1,x==l-1){T.push(p(_));break}else x++;return T.join("")},decompress:function(c){return c==null?"":c==""?null:r._decompress(c.length,32768,function(l){return c.charCodeAt(l)})},_decompress:function(c,l,p){var f=[],m,d=4,v=4,b=3,y="",w=[],k,C,I,T,_,x,$,D={val:p(0),position:l,index:1};for(k=0;k<3;k+=1)f[k]=k;for(I=0,_=Math.pow(2,2),x=1;x!=_;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=p(D.index++)),I|=(T>0?1:0)*x,x<<=1;switch(m=I){case 0:for(I=0,_=Math.pow(2,8),x=1;x!=_;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=p(D.index++)),I|=(T>0?1:0)*x,x<<=1;$=i(I);break;case 1:for(I=0,_=Math.pow(2,16),x=1;x!=_;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=p(D.index++)),I|=(T>0?1:0)*x,x<<=1;$=i(I);break;case 2:return""}for(f[3]=$,C=$,w.push($);;){if(D.index>c)return"";for(I=0,_=Math.pow(2,b),x=1;x!=_;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=p(D.index++)),I|=(T>0?1:0)*x,x<<=1;switch($=I){case 0:for(I=0,_=Math.pow(2,8),x=1;x!=_;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=p(D.index++)),I|=(T>0?1:0)*x,x<<=1;f[v++]=i(I),$=v-1,d--;break;case 1:for(I=0,_=Math.pow(2,16),x=1;x!=_;)T=D.val&D.position,D.position>>=1,D.position==0&&(D.position=l,D.val=p(D.index++)),I|=(T>0?1:0)*x,x<<=1;f[v++]=i(I),$=v-1,d--;break;case 2:return w.join("")}if(d==0&&(d=Math.pow(2,b),b++),f[$])y=f[$];else if($===v)y=C+C.charAt(0);else return null;w.push(y),f[v++]=C+y.charAt(0),d--,C=y,d==0&&(d=Math.pow(2,b),b++)}}};return r}();t!=null?t.exports=n:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return n})})(vi);var Oi=vi.exports;const ma="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",ga="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",ba="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",va=200,ya=10;async function Cn(){const{masto:t}=ce(),n=t.v1.followedTags.list({limit:va}),i=[];let s=0;do{const{value:o,done:a}=await n.next();if(a||(o==null?void 0:o.length)===0)break;i.push(...o),s++}while(so.name.localeCompare(a.name)),i.length&&setTimeout(()=>{me.account.set("followedTags",{tags:i,updatedAt:Date.now()})},1),i}const wa=24*60*60*1e3;async function ka(){try{const{tags:t,updatedAt:n}=me.account.get("followedTags")||{};return t!=null&&t.length?(Date.now()-n>wa&&Cn(),t):await Cn()}catch{return[]}}const zi=document.createElement("div"),_a=t=>{if(!t)return[];if(t.indexOf("#")===-1)return[];zi.innerHTML=t;const n=zi.querySelectorAll("a.hashtag");return n.length?Array.from(n).map(i=>i.innerText.trim().replace(/^[^#]*#+/,"")):[]};function fn({children:t}){if(typeof t=="string")return t;const[n,i]=M("");return se(()=>{Promise.resolve(t).then(i)},[t]),n}const yt=9,Sa=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],Ps={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"}},pn={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}]},Ca=_t(async({id:t})=>{const n=await ce().masto.v1.accounts.$select(t).fetch();return n.username||n.acct||n.displayName}),In={following:{id:"home",title:(t,n)=>n===0?g._({id:"i0qMbr"}):g._({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:t})=>t?"list":"lists",title:({id:t})=>t?Tc(t):g._({id:"h16FyT"}),path:({id:t})=>t?`/l/${t}`:"/l",icon:"list",excludeViewMode:({id:t})=>t?[]:["multi-column"]},public:{id:"public",title:({local:t})=>t?g._({id:"d5zxa4"}):g._({id:"4ERYY7"}),subtitle:({instance:t})=>t||ce().instance,path:({local:t,instance:n})=>`/${n}/p${t?"/l":""}`,icon:({local:t})=>t?"building":"earth"},trending:{id:"trending",title:{id:"4/iCqx"},subtitle:({instance:t})=>t||ce().instance,path:({instance:t})=>`/${t}/trending`,icon:"chart"},search:{id:"search",title:({query:t})=>t?`โ€œ${t}โ€`:g._({id:"A1taO8"}),path:({query:t})=>t?`/search?q=${encodeURIComponent(t)}&type=statuses`:"/search",icon:"search",excludeViewMode:({query:t})=>t?[]:["multi-column"]},"account-statuses":{id:"account-statuses",title:Ca,path:({id:t})=>`/a/${t}`,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:t})=>t,subtitle:({instance:t})=>t||ce().instance,path:({hashtag:t,instance:n,media:i})=>`${n?`/${n}`:""}/t/${t.split(/\s+/).join("+")}${i?"?media=1":""}`,icon:"hashtag"}};function Ia({onClose:t}){const{_:n}=Qe(),i=qe(A),{shortcuts:s}=i,[o,a]=M(!1),[h,r]=M(!1),[c]=ui();return e("div",{id:"shortcuts-settings-container",class:"sheet",tabindex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(S,{icon:"shortcut"})," ",e(u,{id:"CTqTgr"})," ",e("sup",{style:{fontSize:12,opacity:.5,textTransform:"uppercase"},children:e(u,{id:"A1As8l"})})]})}),e("main",{children:[e("p",{children:e(u,{id:"CIHAsy"})}),e("div",{class:"shortcuts-view-mode",children:[{value:"float-button",label:g._({id:"qwdOim"}),imgURL:ma},{value:"tab-menu-bar",label:g._({id:"UxBoCm"}),imgURL:ba},{value:"multi-column",label:g._({id:"uvDfdW"}),imgURL:ga}].map(({value:l,label:p,imgURL:f})=>{const m=i.settings.shortcutsViewMode===l||l==="float-button"&&!i.settings.shortcutsViewMode;return e("label",{class:m?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:l,checked:m,onChange:d=>{A.settings.shortcutsViewMode=d.target.value}})," ",e("img",{src:f,alt:"",width:"80",height:"58"})," ",e("span",{children:p})]},l)})}),s.length>0?e(U,{children:[e("ol",{class:"shortcuts-list",ref:c,children:s.filter(Boolean).map((l,p)=>{const f=Object.values(l).join("-"),{type:m}=l;if(!In[m])return null;let{icon:d,title:v,subtitle:b,excludeViewMode:y}=In[m];typeof v=="function"?v=v(l,p):v=n(v),typeof b=="function"?b=b(l,p):b=n(b),typeof d=="function"&&(d=d(l,p)),typeof y=="function"&&(y=y(l,p));const w=y==null?void 0:y.includes(i.settings.shortcutsViewMode);return e("li",{children:[e(S,{icon:d}),e("span",{class:"shortcut-text",children:[e(fn,{children:v}),b&&e(U,{children:[" ",e("small",{class:"ib insignificant",children:b})]}),w&&e("span",{class:"tag",children:e(u,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:p===0,onClick:()=>{const k=Array.from(A.shortcuts);if(p>0){const C=A.shortcuts[p-1];k[p-1]=l,k[p]=C,A.shortcuts=k}},children:e(S,{icon:"arrow-up",alt:g._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:p===s.length-1,onClick:()=>{const k=Array.from(A.shortcuts);if(p{a({shortcut:l,shortcutIndex:p})},children:e(S,{icon:"pencil",alt:g._({id:"ePK91l"})})})]})]},f)})}),s.length===1&&i.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(S,{icon:"info"})," ",e("small",{children:e(u,{id:"3Xq4Zi"})})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:i.settings.shortcutsViewMode==="multi-column"?g._({id:"3xIN+E"}):g._({id:"vLxvHT"})}),e("p",{children:e(u,{id:"Fq4zw3",components:{0:e("br",{}),1:e("a",{href:"#",onClick:l=>{l.preventDefault(),A.shortcuts=[{type:"following"},{type:"notifications"}]}})}})})]}),e("p",{class:"insignificant",children:s.length>=yt&&(i.settings.shortcutsViewMode==="multi-column"?g._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:yt}}):g._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:yt}}))}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>r(!0),children:e(u,{id:"bgVLbt"})}),e("button",{type:"button",disabled:s.length>=yt,onClick:()=>a(!0),children:[e(S,{icon:"plus"})," ",e("span",{children:i.settings.shortcutsViewMode==="multi-column"?g._({id:"Vh3ADI"}):g._({id:"9tmn6W"})})]})]})]}),o&&e(Fe,{onClick:l=>{l.target===l.currentTarget&&a(!1)},children:e(Ta,{shortcut:o.shortcut,shortcutIndex:o.shortcutIndex,onSubmit:({result:l,mode:p})=>{p==="edit"?A.shortcuts[o.shortcutIndex]=l:A.shortcuts.push(l)},onClose:()=>a(!1)})}),h&&e(Fe,{onClick:l=>{l.target===l.currentTarget&&r(!1)},children:e(xa,{shortcuts:s,onClose:()=>r(!1)})})]})}const Ui={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function Ta({onSubmit:t,disabled:n,shortcut:i,shortcutIndex:s,onClose:o}){var y,w;const{_:a}=Qe(),h=!!i,[r,c]=M((i==null?void 0:i.type)||null),[l,p]=M("default"),[f,m]=M([]),[d,v]=M([]);se(()=>{(async()=>{if(r==="list")try{p("loading");const k=await on();m(k),p("default")}catch{p("error")}})(),(async()=>{if(r==="hashtag")try{const k=await Cn();v(k)}catch{}})()},[r]);const b=Y();return se(()=>{if(h&&r&&pn[r]){const k=b.current;pn[r].forEach(({name:C,type:I})=>{const T=k.querySelector(`[name="${C}"]`);T&&i[C]&&(I==="checkbox"?T.checked=i[C]==="on":T.value=i[C])})}},[h,r]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:h?g._({id:"pe1jog"}):g._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:b,onSubmit:k=>{k.preventDefault();const C=new FormData(k.target),I={};C.forEach((T,_)=>{I[_]=T==null?void 0:T.trim(),_==="instance"&&(I[_]=I[_].replace(/^https?:\/\//,"").replace(/\/+$/,""),I[_]=I[_].replace(/^@?[^@]+@/,""))}),I.type&&(t({result:I,mode:h?"edit":"add"}),k.target.reset(),c(null),o==null||o())},children:[e("p",{children:e("label",{children:[e("span",{children:e(u,{id:"cklVjM"})}),e("select",{required:!0,disabled:n,onChange:k=>{c(k.target.value)},defaultValue:h?i.type:void 0,name:"type",dir:"auto",children:[e("option",{}),Sa.map(k=>e("option",{value:k,children:a(Ps[k])}))]})]})}),(w=(y=pn[r])==null?void 0:y.map)==null?void 0:w.call(y,({text:k,name:C,type:I,placeholder:T,pattern:_,notRequired:x})=>r==="list"?e("p",{children:e("label",{children:[e("span",{children:e(u,{id:"2BBAbc"})}),e("select",{name:"id",required:!x,disabled:n||l==="loading",defaultValue:h?i.id:void 0,dir:"auto",children:[e("option",{value:""}),f.map($=>e("option",{value:$.id,children:$.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:a(k)})," ",e("input",{type:I,switch:I==="checkbox"||void 0,name:C,placeholder:a(T),required:I==="text"&&!x,disabled:n,list:r==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:_,dir:"auto"}),r==="hashtag"&&d.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:d.map($=>e("option",{value:$.name}))})]})})),!!Ui[r]&&e("p",{class:"form-note insignificant",children:[e(S,{icon:"info"}),a(Ui[r])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:n||l==="loading",children:h?g._({id:"tfDRzk"}):g._({id:"m16xKo"})}),h&&e("button",{type:"button",class:"light danger",onClick:()=>{A.shortcuts.splice(s,1),o==null||o()},children:e(u,{id:"t/YqKh"})})]})]})})]})}function xa({shortcuts:t,onClose:n}){var m;const{_:i}=Qe(),{masto:s}=ce(),o=ke(()=>!t||!t.filter(Boolean).length?"":Oi.compressToEncodedURIComponent(JSON.stringify(t.filter(Boolean))),[t]),[a,h]=M(""),[r,c]=M("default"),l=ke(()=>{if(!a)return c("default"),null;try{const d=JSON.parse(Oi.decompressFromEncodedURIComponent(a));if(!Array.isArray(d))throw new Error("Not an array");return c("default"),d}catch{try{const v=JSON.parse(a);if(!Array.isArray(v))throw new Error("Not an array");return c("default"),v}catch{return c("error"),null}}},[a]),p=A.shortcuts.length>0,f=Y();return e("div",{id:"import-export-container",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"OOa7/5",components:{0:e("small",{class:"ib insignificant"})}})})}),e("main",{tabindex:"-1",children:[e("section",{children:[e("h3",{children:[e(S,{icon:"arrow-down-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(u,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:f,type:"text",name:"import",placeholder:g._({id:"tBmklN"}),class:"block",onInput:d=>{h(d.target.value)},dir:"auto"}),A.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:r==="cloud-downloading",onClick:async()=>{c("cloud-downloading");const d=wt();de(g._({id:"HLqLGx"}));try{const b=(await s.v1.accounts.relationships.fetch({id:[d]}))[0];if(b){const{note:y=""}=b;if(/(.*)<\/phanpy-shortcuts-settings>/.test(y)){const w=y.match(/(.*)<\/phanpy-shortcuts-settings>/)[1],{v:k,dt:C,data:I}=JSON.parse(w);f.current.value=I,f.current.dispatchEvent(new Event("input"))}}c("default")}catch{c("error"),de(g._({id:"gCDfX+"}))}},title:g._({id:"B6cG3J"}),children:[e(S,{icon:"cloud"}),e(S,{icon:"arrow-down"})]})]}),!!l&&Array.isArray(l)&&e(U,{children:[e("p",{children:[e("b",{children:l.length})," shortcut",l.length>1?"s":""," ",e("small",{class:"insignificant",children:["(",a.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:l.map(d=>{var v,b;return e("li",{children:[e("span",{style:{opacity:t.some(y=>Object.keys(y).every(w=>y[w]===d[w]))?1:0},children:"*"}),e("span",{children:[i(Ps[d.type]),d.type==="list"&&" โš ๏ธ"," ",(b=(v=pn[d.type])==null?void 0:v.map)==null?void 0:b.call(v,({text:y,name:w,type:k})=>d[w]?e(U,{children:[e("span",{class:"tag collapsed insignificant",children:[y,":"," ",k==="checkbox"?d[w]==="on"?"โœ…":"โŒ":d[w]]})," "]}):null)]})]})})}),e("p",{children:[e("small",{children:e(u,{id:"o6sElH"})}),e("br",{}),e("small",{children:["โš ๏ธ"," ",e(u,{id:"N4z4P/"})]})]})]}),r==="error"&&e("p",{class:"error",children:e("small",{children:["โš ๏ธ ",e(u,{id:"ZhsPEb"})]})}),e("p",{children:[p&&e(U,{children:[e(lt,{confirmLabel:g._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(u,{id:"nl8sCE"})}),onClick:()=>{const d=l.filter(y=>!A.shortcuts.some(w=>Object.keys(w).every(k=>w[k]===y[k])));if(!d.length){de(g._({id:"o6L30P"}));return}let v=[...A.shortcuts,...d];const b=v.length>yt;b&&(v=v.slice(0,yt)),A.shortcuts=v,de(b?g._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:yt}}):g._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:e(u,{id:"c89gCv"})})})," "]}),e(lt,{confirmLabel:p?g._({id:"6ZjzWP"}):g._({id:"DWumLi"}),menuItemClassName:p?"danger":void 0,onClick:()=>{A.shortcuts=l,de(g._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:p?g._({id:"uIp8WL"}):g._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(S,{icon:"arrow-up-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(u,{id:"GS+Mus"})})]}),e("p",{children:e("input",{style:{width:"100%"},type:"text",value:o,readOnly:!0,onClick:d=>{if(d.target.value){d.target.select();try{navigator.clipboard.writeText(d.target.value),de(g._({id:"cWtH+v"}))}catch{de(g._({id:"yUWyHa"}))}}},dir:"auto"})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!o,onClick:()=>{try{navigator.clipboard.writeText(o),de(g._({id:"+Kq2vY"}))}catch{de(g._({id:"tFvxZF"}))}},children:[e(S,{icon:"clipboard"})," ",e("span",{children:e(u,{id:"he3ygx"})})]})," ",(navigator==null?void 0:navigator.share)&&((m=navigator==null?void 0:navigator.canShare)==null?void 0:m.call(navigator,{text:o}))&&e("button",{type:"button",class:"plain2",disabled:!o,onClick:()=>{try{navigator.share({text:o})}catch{alert(g._({id:"TtG3Uh"}))}},children:[e(S,{icon:"share"})," ",e("span",{children:e(u,{id:"Z8lGw6"})})]})," ",A.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2",disabled:r==="cloud-uploading",onClick:async()=>{c("cloud-uploading");const d=wt();try{const b=(await s.v1.accounts.relationships.fetch({id:[d]}))[0];if(b){const{note:y=""}=b;let w="";const k=JSON.stringify({v:"1",dt:Date.now(),data:o});/(.*)<\/phanpy-shortcuts-settings>/.test(y)?w=y.replace(/(.*)<\/phanpy-shortcuts-settings>/,`${k}`):w=`${y} ${k}`,de(g._({id:"9ZYiLz"})),await s.v1.accounts.$select(d).note.create({comment:w}),c("default"),de(g._({id:"5w02SH"}))}}catch{c("error"),de(g._({id:"aVsTYo"}))}},title:g._({id:"gWd6Cu"}),children:[e(S,{icon:"cloud"}),e(S,{icon:"arrow-up"})]})," ",o.length>0&&e("small",{class:"insignificant ib",children:e(u,{id:"IPXOXm",values:{0:o.length}})})]}),!!o&&e("details",{children:[e("summary",{class:"insignificant",children:e("small",{children:e(u,{id:"e5E+WH"})})}),e("textarea",{style:{width:"100%"},rows:10,readOnly:!0,children:JSON.stringify(t.filter(Boolean),null,2)})]})]}),A.settings.shortcutSettingsCloudImportExport&&e("footer",{children:e("p",{children:[e(S,{icon:"cloud"})," ",e(u,{id:"C4T6O/"})]})})]})]})}as(A,t=>{for(const[n,i,s,o]of t)/^show/i.test(i)&&!s&&Kn()});function Aa(){var s,o,a,h,r,c,l,p;const t=qe(A),n=rs(),i=Vt();return se(()=>{setTimeout(ho,1e3)},[]),e(U,{children:[!!t.showCompose&&e(Fe,{class:`solid ${t.composerState.minimized?"min":""}`,minimized:!!t.composerState.minimized,children:e(fo,{replyToStatus:typeof t.showCompose!="boolean"?t.showCompose.replyToStatus:((s=window.__COMPOSE__)==null?void 0:s.replyToStatus)||null,editStatus:((o=A.showCompose)==null?void 0:o.editStatus)||((a=window.__COMPOSE__)==null?void 0:a.editStatus)||null,draftStatus:((h=A.showCompose)==null?void 0:h.draftStatus)||((r=window.__COMPOSE__)==null?void 0:r.draftStatus)||null,onClose:f=>{const{newStatus:m,instance:d,type:v}=f||{};A.showCompose=!1,window.__COMPOSE__=null,m&&(A.reloadStatusPage++,de({text:{post:g._({id:"aTyHBW"}),reply:g._({id:"lZdBKl"}),edit:g._({id:"a5BN7l"})}[v||"post"],delay:1e3,duration:1e4,onClick:b=>{b.hideToast(),A.prevLocation=i,n(d?`/${d}/s/${m.id}`:`/s/${m.id}`)}}))}})}),!!t.showSettings&&e(Fe,{onClose:()=>{A.showSettings=!1},children:e(_c,{onClose:()=>{A.showSettings=!1}})}),!!t.showAccounts&&e(Fe,{onClose:()=>{A.showAccounts=!1},children:e(uc,{onClose:()=>{A.showAccounts=!1}})}),!!t.showAccount&&e(Fe,{onClose:()=>{A.showAccount=!1},children:e(jc,{account:((c=t.showAccount)==null?void 0:c.account)||t.showAccount,instance:(l=t.showAccount)==null?void 0:l.instance,onClose:({destination:f}={})=>{A.showAccount=!1}})}),!!t.showDrafts&&e(Fe,{onClose:()=>{A.showDrafts=!1},children:e(Vc,{onClose:()=>A.showDrafts=!1})}),!!t.showMediaModal&&e(Fe,{onClick:f=>{(f.target===f.currentTarget||f.target.classList.contains("media"))&&(A.showMediaModal=!1)},children:e(Ns,{mediaAttachments:t.showMediaModal.mediaAttachments,instance:t.showMediaModal.instance,index:t.showMediaModal.index,statusID:t.showMediaModal.statusID,onClose:()=>{A.showMediaModal=!1}})}),!!t.showShortcutsSettings&&e(Fe,{onClose:()=>{A.showShortcutsSettings=!1},children:e(Ia,{onClose:()=>A.showShortcutsSettings=!1})}),!!t.showGenericAccounts&&e(Fe,{onClose:()=>{A.showGenericAccounts=!1},children:e(Wc,{instance:t.showGenericAccounts.instance,excludeRelationshipAttrs:t.showGenericAccounts.excludeRelationshipAttrs,postID:t.showGenericAccounts.postID,onClose:()=>A.showGenericAccounts=!1,blankCopy:t.showGenericAccounts.blankCopy})}),!!t.showMediaAlt&&e(Fe,{onClose:f=>{A.showMediaAlt=!1},children:e(Zc,{alt:t.showMediaAlt.alt||t.showMediaAlt,lang:(p=t.showMediaAlt)==null?void 0:p.lang,onClose:()=>{A.showMediaAlt=!1}})}),!!t.showEmbedModal&&e(Fe,{class:"solid",onClose:()=>{A.showEmbedModal=!1},children:e(Kc,{html:t.showEmbedModal.html,url:t.showEmbedModal.url,width:t.showEmbedModal.width,height:t.showEmbedModal.height,onClose:()=>{A.showEmbedModal=!1}})}),!!t.showReportModal&&e(Fe,{onClose:()=>{A.showReportModal=!1},children:e(pa,{account:t.showReportModal.account,post:t.showReportModal.post,onClose:()=>{A.showReportModal=!1}})})]})}function Zn({accountID:t,onChange:n}){const{masto:i}=ce(),[s,o]=M("default"),[a,h]=M(null),[r,c]=M(null),l=r!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:s==="loading"||l,onClick:()=>{o("loading"),h("accept"),(async()=>{try{const p=await i.v1.followRequests.$select(t).authorize();if(!(p!=null&&p.followedBy))throw new Error("Follow request not accepted");c(p),n()}catch{}o("default")})()},children:e(u,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:s==="loading"||l,class:"light danger",onClick:()=>{o("loading"),h("reject"),(async()=>{try{const p=await i.v1.followRequests.$select(t).reject();if(p!=null&&p.followedBy)throw new Error("Follow request not rejected");c(p),n()}catch{o("default")}})()},children:e(u,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:l&&a?a==="accept"?e(S,{icon:"check-circle",alt:g._({id:"bzMKg7"}),class:"follow-accepted"}):e(S,{icon:"x-circle",alt:g._({id:"ekCRTP"}),class:"follow-rejected"}):e(Pe,{hidden:s!=="loading"})})]})}const Bi={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"};function Fi({account:t,emoji:n,emoji_url:i}){let s,o;typeof i=="string"?s=i:(s=i==null?void 0:i.url,o=i==null?void 0:i.staticUrl);const a=s?e($o,{url:s,staticUrl:o,alt:n}):n;return e(u,{id:"i5uN6K",values:{account:t,emojiObject:a}})}const Bn={status:({account:t})=>e(u,{id:"idiIxW",values:{account:t}}),reblog:({count:t,account:n,postsCount:i,postType:s,components:{Subject:o}})=>e(u,{id:"jkt9P5",values:{0:Ke(t),1:Ke(t),count:t,postsCount:i,postType:s,account:n},components:{0:e(o,{clickable:t>1}),1:e("span",{title:t}),2:e(o,{clickable:t>1}),3:e("span",{title:t})}}),follow:({account:t,count:n,components:{Subject:i}})=>e(u,{id:"+71G9C",values:{0:Ke(n),count:n,account:t},components:{0:e(i,{clickable:n>1}),1:e("span",{title:n})}}),follow_request:({account:t})=>e(u,{id:"eh6NHW",values:{account:t}}),favourite:({account:t,count:n,postsCount:i,postType:s,components:{Subject:o}})=>e(u,{id:"RqX1mR",values:{0:Ke(n),1:Ke(n),count:n,postsCount:i,postType:s,account:t},components:{0:e(o,{clickable:n>1}),1:e("span",{title:n}),2:e(o,{clickable:n>1}),3:e("span",{title:n})}}),poll:()=>g._({id:"kIlJaS"}),"poll-self":()=>g._({id:"kpjzdN"}),"poll-voted":()=>g._({id:"moT7M8"}),update:()=>g._({id:"uzt17m"}),"favourite+reblog":({count:t,account:n,postsCount:i,postType:s,components:{Subject:o}})=>e(u,{id:"NunZZQ",values:{0:Ke(t),1:Ke(t),count:t,postsCount:i,postType:s,account:n},components:{0:e(o,{clickable:t>1}),1:e("span",{title:t}),2:e(o,{clickable:t>1}),3:e("span",{title:t})}}),"admin.sign_up":({account:t})=>e(u,{id:"fJCCpx",values:{account:t}}),"admin.report":({account:t,targetAccount:n})=>e(u,{id:"eNfCmq",values:{account:t,targetAccount:n}}),severed_relationships:({name:t})=>e(u,{id:"Xl9v6+",values:{name:t},components:{0:e("i",{})}}),moderation_warning:()=>e("b",{children:e(u,{id:"YqffEv"})}),emoji_reaction:Fi,"pleroma:emoji_reaction":Fi},Ea={account_suspension:({from:t,targetName:n})=>e(u,{id:"uRkcgw",values:{from:t,targetName:n},components:{0:e("i",{}),1:e("i",{})}}),domain_block:({from:t,targetName:n,followersCount:i,followingCount:s})=>e(u,{id:"Q3yArs",values:{from:t,targetName:n,followersCount:i,followingCount:s},components:{0:e("i",{}),1:e("i",{})}}),user_domain_block:({targetName:t,followersCount:n,followingCount:i})=>e(u,{id:"RQKWUa",values:{targetName:t,followersCount:n,followingCount:i},components:{0:e("i",{})}})},Ra={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"}},Fn=30;function La({notification:t,instance:n,isStatic:i,disableContextMenu:s}){var j,B,ee,ge,ie,be,_e;const{_:o}=Qe(),{masto:a}=ce(),{id:h,status:r,account:c,report:l,event:p,moderation_warning:f,_ids:m,_accounts:d,_statuses:v,_groupKeys:b,sampleAccounts:y,notificationsCount:w,groupKey:k}=t;let{type:C}=t;if(C==="mention"&&!r)return null;const I=(r==null?void 0:r.reblog)||r,T=I==null?void 0:I.id,_=wt(),x=_===(c==null?void 0:c.id),$=(j=r==null?void 0:r.poll)==null?void 0:j.voted,D=!!(r!=null&&r.inReplyToAccountId)&&(r==null?void 0:r.inReplyToAccountId)!==_&&((B=r==null?void 0:r.account)==null?void 0:B.id)===_;let L=0,q=0;if(C==="favourite+reblog"){if(d)for(const G of d)(ee=G._types)!=null&&ee.includes("favourite")&&L++,(ge=G._types)!=null&&ge.includes("reblog")&&q++;!q&&L&&(C="favourite"),!L&&q&&(C="reblog")}let V;C==="poll"?V=Bn[x?"poll-self":$?"poll-voted":"poll"]:Bn[C]?V=Bn[C]:V=g._({id:"ODqZt1",values:{type:C}});const W=({clickable:G,...ae})=>G?e("b",{tabIndex:"0",onClick:H,...ae}):e("b",{...ae});if(typeof V=="function"){const G=(d==null?void 0:d.length)||(y==null?void 0:y.length)||(c?1:0),ae=(v==null?void 0:v.length)||(r?1:0);if(C==="admin.report"){const Ce=l==null?void 0:l.targetAccount;Ce&&(V=V({account:e(mt,{account:c,showAvatar:!0}),targetAccount:e(mt,{account:Ce,showAvatar:!0})}))}else if(C==="severed_relationships"){const Ce=p==null?void 0:p.targetName;Ce&&(V=V({name:Ce}))}else if((C==="emoji_reaction"||C==="pleroma:emoji_reaction")&&t.emoji){const Ce=t.emoji_url||((be=(ie=r==null?void 0:r.emojis)==null?void 0:ie.find)==null?void 0:be.call(ie,Ee=>(Ee==null?void 0:Ee.shortcode)===t.emoji.replace(/^:/,"").replace(/:$/,"")));V=V({account:e(mt,{account:c,showAvatar:!0}),emoji:t.emoji,emojiURL:Ce})}else V=V({account:c?e(mt,{account:c,showAvatar:!0}):(y==null?void 0:y[0])&&e(mt,{account:y[0],showAvatar:!0}),count:G,postsCount:ae,postType:D?"reply":"post",components:{Subject:W}})}const Z=t.createdAt&&new Date(t.createdAt).toLocaleString(),F={"favourite+reblog":g._({id:"+XOeb+"}),favourite:g._({id:"LQFF6J"}),reblog:g._({id:"phQpSa"}),follow:g._({id:"Ih01jh"})}[C]||g._({id:"bPwFdf"}),H=()=>{A.showGenericAccounts={heading:F,accounts:d,showReactions:C==="favourite+reblog",excludeRelationshipAttrs:C==="follow"?["followedBy"]:[],postID:it(T,n)}},P=w>0&&w>(y==null?void 0:y.length)?"remote":"local";if(r!=null&&r.filtered){const G=((_e=r==null?void 0:r.account)==null?void 0:_e.id)===_,ae=Ft(r.filtered,"notifications");if(!x&&!G&&(ae==null?void 0:ae.action)==="hide")return null}return e("div",{class:`notification notification-${C}`,"data-notification-id":m||h,"data-group-key":(b==null?void 0:b.join(" "))||k,tabIndex:"0",children:[e("div",{class:`notification-type notification-${C}`,title:Z,children:C==="favourite+reblog"?e(U,{children:[e(S,{icon:"rocket",size:"xl",alt:C,class:"reblog-icon"}),e(S,{icon:"heart",size:"xl",alt:C,class:"favourite-icon"})]}):e(S,{icon:Bi[C]||"notification",size:"xl",alt:C})}),e("div",{class:"notification-content",children:[C!=="mention"&&e(U,{children:[e("p",{children:V}),C==="follow_request"&&e(Zn,{accountID:c.id}),C==="severed_relationships"&&e("div",{children:[Ea[p.type]({from:n,...p}),e("br",{}),e("a",{href:`https://${n}/severed_relationships`,target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"YL6Y8P",components:{0:e(S,{icon:"external",size:"s"})}})}),"."]}),C==="moderation_warning"&&!!f&&e("div",{children:[o(Ra[f.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${f.id}`,target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"YL6Y8P",components:{0:e(S,{icon:"external",size:"s"})}})})]})]}),(d==null?void 0:d.length)>1&&e("p",{class:"avatars-stack",children:[d.slice(0,Fn).map(G=>e(U,{children:[e("a",{href:G.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:ae=>{ae.preventDefault(),A.showAccount=G},children:[e(dt,{url:G.avatarStatic,size:d.length<=10?"xxl":d.length<20?"xl":"l",alt:`${G.displayName} @${G.acct}`,squircle:G==null?void 0:G.bot},G.id),C==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:G._types.map(ae=>e(S,{icon:Bi[ae],size:"s",class:`${ae}-icon`}))})]},G.id)," "]},G.id)),C==="favourite+reblog"&&P==="remote"?e("button",{type:"button",class:"small plain","data-group-keys":b==null?void 0:b.join(" "),onClick:()=>{A.showGenericAccounts={heading:F,fetchAccounts:async()=>{const G=await Promise.allSettled(b.map(async Ce=>{const Ee=a.v2.notifications.$select(Ce).accounts.list();return[Ce,(await Ee.next()).value]})),ae=[];for(const Ce of G){const[Ee,Re]=Ce.value,Le=/^favourite/.test(Ee)?"favourite":/^reblog/.test(Ee)?"reblog":null;if(Le)for(const Ne of Re){const ve=ae.find(te=>te.id===Ne.id);ve?ve._types.push(Le):(Ne._types=[Le],ae.push(Ne))}}return{done:!0,value:ae}},showReactions:!0,postID:it(T,n)}},children:e(S,{icon:"chevron-down"})}):e("button",{type:"button",class:"small plain",onClick:H,children:[d.length>Fn&&`+${d.length-Fn}`,e(S,{icon:"chevron-down"})]})]}),!(d!=null&&d.length)&&(y==null?void 0:y.length)>1&&e("p",{class:"avatars-stack",children:[y.map(G=>e(U,{children:[e("a",{href:G.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:ae=>{ae.preventDefault(),A.showAccount=G},children:e(dt,{url:G.avatarStatic,size:"xxl",alt:`${G.displayName} @${G.acct}`,squircle:G==null?void 0:G.bot},G.id)},G.id)," "]},G.id)),w>y.length&&e(ue,{to:n?`/${n}/s/${r.id}`:`/s/${r.id}`,class:"button small plain centered",children:["+",w-y.length,e(S,{icon:"chevron-right"})]})]}),(v==null?void 0:v.length)>1&&e("ul",{class:"notification-group-statuses",children:v.map(G=>e("li",{children:e(Hi,{class:`status-link status-type-${C}`,to:n?`/${n}/s/${G.id}`:`/s/${G.id}`,children:e(Ye,{status:G,size:"s",previewMode:!0,allowContextMenu:!0})})},G.id))}),r&&(!(v!=null&&v.length)||(v==null?void 0:v.length)<=1)&&e(Hi,{class:`status-link status-type-${C}`,to:n?`/${n}/s/${T}`:`/s/${T}`,onContextMenu:s?void 0:G=>{const ae=G.target.querySelector(".status");if(ae){if(G.metaKey)return;G.preventDefault(),ae.dispatchEvent(new MouseEvent("contextmenu",{clientX:G.clientX,clientY:G.clientY}))}},children:i?e(Ye,{status:I,size:"s",readOnly:!0,allowContextMenu:!0}):e(Ye,{statusID:T,size:"s",readOnly:!0,allowContextMenu:!0})})]})]})}function Hi(t){const n=Do();return e(ue,{...t,"data-read-more":g._({id:"8fZueG"}),ref:n})}const Rn=st(La,(t,n)=>{var i,s;return((i=t.notification)==null?void 0:i.id)===((s=n.notification)==null?void 0:s.id)});"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",t=>{const{type:n,id:i,accessToken:s}=(t==null?void 0:t.data)||{};n==="notification"&&(A.routeNotification={id:i,accessToken:s})});const Ma=st(function(){if(!("serviceWorker"in navigator))return null;const n=qe(A),{routeNotification:i}=n,{id:s,accessToken:o}=i||{},[a,h]=M(!1);gt(()=>{if(!s||!o)return;const{instance:c}=ce(),{masto:l,instance:p}=ce({accessToken:o}),f=c===p,m=o?po(o):ei();(async()=>{const d=await l.v1.notifications.$select(s).fetch();if(d&&m){const v=m.instanceURL,{type:b,status:y,account:w}=d,k=!!document.querySelector("#modal-container > *"),C=b==="follow"&&!!(w!=null&&w.id),I=!!(w!=null&&w.id),T=!!(y!=null&&y.id);C&&f?A.showAccount={account:w,instance:v}:k||!f||I&&T?h({id:s,account:m,notification:d,sameInstance:f}):T?location.hash=`/${c}/s/${y.id}`:C?location.hash=`/${c}/a/${w.id}`:location.hash="/notifications"}})()},[s,o]),gt(()=>{navigator!=null&&navigator.clearAppBadge&&navigator.clearAppBadge()},[]),Ht(c=>{c&&(navigator!=null&&navigator.clearAppBadge)&&navigator.clearAppBadge()});const r=()=>{h(!1),A.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(a){const{id:c,account:l,notification:p,sameInstance:f}=a;return e(Fe,{onClick:m=>{m.target===m.currentTarget&&r()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:r,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"5+87Pq"})})}),e("main",{children:[!f&&e("p",{children:e(u,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:m=>{const{target:d}=m;(m.target.tagName==="BUTTON"||m.target.tagName==="A")&&r()},children:e(Rn,{instance:l.instanceURL,notification:p,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(ue,{to:"/notifications",class:"button light",onClick:r,children:[e("span",{children:e(u,{id:"/WA/tl"})})," ",e(S,{icon:"arrow-right"})]})})]})]})})}return null}),Os=go((t,n)=>{const{instance:i}=ce(),[s,o]=ft(),[a,h]=M(!1),[r,c]=M(s.get("q")||""),l=s.get("type"),p=Y(null),f=Y(null);return mo(n,()=>({setValue:m=>{c(m)},focus:()=>{f.current.focus()},select:()=>{f.current.select()},blur:()=>{f.current.blur()}})),e("form",{ref:p,class:"search-popover-container",onSubmit:m=>{var v;if(m.preventDefault(),/\/search/.test(location.hash))if(r){const b={q:r};l&&(b.type=l),o(b)}else o({});else r?location.hash=`/search?q=${encodeURIComponent(r)}${l?`&type=${l}`:""}`:location.hash="/search";(v=t==null?void 0:t.onSubmit)==null||v.call(t,m)},children:[e("input",{ref:f,value:r,name:"q",type:"search",placeholder:g._({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:m=>{m.target.value||o({})},onInput:m=>{c(m.target.value),h(!0)},onFocus:()=>{var m,d;h(!0),(d=(m=p.current)==null?void 0:m.querySelector(".search-popover-item"))==null||d.classList.add("focus")},onBlur:()=>{var m,d;setTimeout(()=>{h(!1)},100),(d=(m=p.current)==null?void 0:m.querySelector(".search-popover-item.focus"))==null||d.classList.remove("focus")},onKeyDown:m=>{var v;const{key:d}=m;switch(d){case"Escape":h(!1);break;case"Down":case"ArrowDown":if(m.preventDefault(),a){const b=p.current.querySelector(".search-popover-item.focus");if(b){let y=b.nextElementSibling;for(;y&&y.hidden;)y=y.nextElementSibling;y&&(y.classList.add("focus"),Array.from(y.parentElement.children).filter(k=>k!==y).forEach(k=>{k.classList.remove("focus")}))}else{const y=p.current.querySelector(".search-popover-item");y&&y.classList.add("focus")}}break;case"Up":case"ArrowUp":if(m.preventDefault(),a){const b=document.querySelector(".search-popover-item.focus");if(b){let y=b.previousElementSibling;for(;y&&y.hidden;)y=y.previousElementSibling;y&&(y.classList.add("focus"),Array.from(y.parentElement.children).filter(k=>k!==y).forEach(k=>{k.classList.remove("focus")}))}else{const y=document.querySelector(".search-popover-item:last-child");y&&y.classList.add("focus")}}break;case"Enter":if(a){const b=document.querySelector(".search-popover-item.focus");b&&(m.preventDefault(),b.click()),h(!1),(v=t==null?void 0:t.onSubmit)==null||v.call(t,m)}break}}}),e("div",{class:"search-popover",hidden:!a||!r,children:!!r&&[{label:e(u,{id:"48oDit",values:{query:r},components:{0:e("small",{class:"insignificant"})}}),to:`/search?q=${encodeURIComponent(r)}`,top:!l&&!/\s/.test(r),hidden:!!l},{label:e(u,{id:"o1mMWT",values:{query:r},components:{0:e("q",{})}}),to:`/search?q=${encodeURIComponent(r)}&type=statuses`,hidden:/^https?:/.test(r),top:/\s/.test(r),icon:"document",queryType:"statuses"},{label:e(u,{id:"YAZw8D",values:{0:r.replace(/^#/,"")},components:{0:e("mark",{})}}),to:`/${i}/t/${r.replace(/^#/,"")}`,hidden:/^@/.test(r)||/^https?:/.test(r)||/\s/.test(r),top:/^#/.test(r),type:"link",icon:"hashtag",queryType:"hashtags"},{label:e(u,{id:"gEoOUj",values:{query:r},components:{0:e("mark",{})}}),to:`/${r}`,hidden:!/^https?:/.test(r),top:/^https?:/.test(r),type:"link"},{label:e(u,{id:"cDoNQr",values:{query:r},components:{0:e("q",{})}}),to:`/search?q=${encodeURIComponent(r)}&type=accounts`,icon:"group",queryType:"accounts"}].sort((m,d)=>{if(l){if(m.queryType===l)return-1;if(d.queryType===l)return 1}return m.top&&!d.top?-1:!m.top&&d.top?1:0}).filter(({hidden:m})=>!m).map(({label:m,to:d,icon:v,type:b},y)=>e(ue,{to:d,class:`search-popover-item ${y===0?"focus":""}`,onClick:w=>{var k;(k=t==null?void 0:t.onSubmit)==null||k.call(t,w)},children:[e(S,{icon:v||(b==="link"?"arrow-right":"search"),class:"more-insignificant"}),e("span",{children:m})," "]}))})]})}),$a=st(function({onClose:n=()=>{}}){const[i,s]=M(!1),o=Y(null);Ue(["Slash","/"],h=>{s(!0),setTimeout(()=>{var r,c,l,p;(c=(r=o.current)==null?void 0:r.focus)==null||c.call(r),(p=(l=o.current)==null?void 0:l.select)==null||p.call(l)},0)},{preventDefault:!0,ignoreEventWhen:h=>{const r=/\/search/.test(location.hash),c=!!document.querySelector("#modal-container > *");return r||c}});const a=()=>{s(!1),n()};return Ue("esc",h=>{var r,c;(c=(r=o.current)==null?void 0:r.blur)==null||c.call(r),a()},{enabled:i,enableOnFormTags:!0,preventDefault:!0}),e("div",{id:"search-command-container",hidden:!i,onClick:h=>{h.target===h.currentTarget&&a()},children:e(Os,{ref:o,onSubmit:()=>{a()}})})});function Da(){const{_:t}=Qe(),{instance:n}=ce(),i=qe(A),{shortcuts:s,settings:o}=i;if(!s.length)return null;const a=o.shortcutsViewMode==="multi-column"||!o.shortcutsViewMode&&o.shortcutsColumnsMode;if(a)return null;const h=Y(),r=Y(!1),c=s.map((m,d)=>{const{type:v,...b}=m;if(!In[v])return null;let{id:y,path:w,title:k,subtitle:C,icon:I}=In[v];return typeof y=="function"&&(y=y(b,d)),typeof w=="function"&&(w=w({...b,instance:b.instance||n},d)),typeof k=="function"?k=k(b,d):k=t(k),typeof C=="function"?C=C(b,d):C=t(C),typeof I=="function"&&(I=I(b,d)),y==="lists"&&(r.current=!0),{id:y,path:w,title:k,subtitle:C,icon:I}}).filter(Boolean),l=rs();Ue(["1","2","3","4","5","6","7","8","9"],(m,d)=>{var b,y;const v=parseInt(d.keys[0],10)-1;if(v{m.preventDefault(),A.showShortcutsSettings=!0},children:e("ul",{children:c.map(({id:m,path:d,title:v,subtitle:b,icon:y},w)=>e("li",{children:e(ue,{class:b?"has-subtitle":"",to:d,onClick:k=>{if(k.target.classList.contains("is-active")){k.preventDefault();const C=document.getElementById(`${m}-page`);if(C){C.scrollTop=0;const I=C.querySelector(".updates-button");I&&I.click()}}},children:[e(S,{icon:y,size:"xl",alt:v}),e("span",{children:[e(fn,{children:v}),b&&e(U,{children:[e("br",{}),e("small",{children:b})]})]})]})},`${w}-${m}-${v}-${b}-${d}`))})}):e(at,{instanceRef:h,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:m=>{m.open&&r.current&&on().then(f)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:m=>{m.preventDefault(),A.showShortcutsSettings=!0},onTransitionStart:m=>{var d,v;try{const{target:b}=m;getComputedStyle(b).pointerEvents==="none"&&((v=(d=h.current)==null?void 0:d.closeMenu)==null||v.call(d))}catch{}},children:e(S,{icon:"shortcut",size:"xl",alt:g._({id:"CTqTgr"})})}),children:c.map(({id:m,path:d,title:v,subtitle:b,icon:y},w)=>m==="lists"?e(wn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(U,{children:[e(S,{icon:y,size:"l"}),e("span",{class:"menu-grow",children:e(fn,{children:v})}),e(S,{icon:"chevron-right"})]}),children:[e(Be,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),e(Ge,{}),p==null?void 0:p.map(k=>e(Be,{to:`/l/${k.id}`,children:e("span",{children:k.title})},k.id))]}):e(Be,{to:d,class:"glass-menu-item",children:[e(S,{icon:y,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(fn,{children:v})}),b&&e(U,{children:[" ",e("small",{class:"more-insignificant",children:b})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:w+1})]},`${w}-${m}-${v}-${b}-${d}`))})})}const Na=st(Da);function Pa(t){var o;let n=[],i=[],s=0;for(let a=0;a10&&(i.length>t.length/4||s>=3)){const a=i.map(h=>h.id);if(i.length>t.length*3/4)n=[...n,{id:a,items:i,type:"boosts"}];else{const h=Math.floor(n.length/2);n=[...n.slice(0,h),{id:a,items:i,type:"boosts"},...n.slice(h)]}return n}else return t}function qi(t,n){const i=me.account.get("boostedStatusIDs")||{},s=t.filter(a=>{if(!a.reblog)return!0;const h=`${n}-${a.reblog.id}`,r=i[h];return r&&r!==a.id?!1:(i[h]=a.id,!0)}),o=Object.keys(i);return o.length>50&&o.slice(0,o.length-50).forEach(a=>{delete i[a]}),me.account.set("boostedStatusIDs",i),s}function Oa(t,n){const i=[];let s=0;t.forEach(r=>{for(let l=0;lp.id===r.id))return;if(i[l].find(p=>p.id===r.inReplyToId)||i[l].find(p=>p.inReplyToId===r.id)){i[l].push(r);return}}const c=t.find(l=>l.id===r.inReplyToId);c&&(i[s++]=[r,c])});for(let r=0;ri[c].includes(p))&&(i[r]=[...i[r],...i[c]],i[r]=i[r].filter((p,f,m)=>m.findIndex(d=>d.id===p.id)===f),i.splice(c,1),c--);i.forEach(r=>{r.sort((c,l)=>!c.inReplyToId&&!l.inReplyToId?new Date(c.createdAt)-new Date(l.createdAt):c.inReplyToId===l.id?1:l.inReplyToId===c.id||!c.inReplyToId?-1:l.inReplyToId?new Date(c.createdAt)-new Date(l.createdAt):1)}),i.forEach(r=>{const c=r[0].account.id;r.forEach(l=>{l.account.id!==c&&(l._differentAuthor=!0)})}),i.length;const o=[],a=[],h=[];return t.forEach(r=>{if(r.reblog){o.push(r);return}for(let c=0;cl.id===r.id)){if(a.includes(c))return;const l=i[c];l.sort((f,m)=>{const d=new Date(f.createdAt),v=new Date(m.createdAt);return d-v});const p=l[0].account.id;o.push({id:l.map(f=>f.id),items:l,type:l.every(f=>f.account.id===p)?"thread":"conversation"}),a.push(c);return}if(r.inReplyToId&&r.inReplyToAccountId!==r.account.id){const c=it(r.id,n);A.statusReply[c]||h.push({sKey:c,inReplyToId:r.inReplyToId})}o.push(r)}),h!=null&&h.length&&queueMicrotask(()=>{const{masto:r}=ce({instance:n});async function c(){for(let l=0;lsetTimeout(d,1e3))}catch{}}}if(Ze("@mastodon/fetch-multiple-statuses")){const l=h.map(({inReplyToId:p})=>p);(async()=>{var p;try{const f=await r.v1.statuses.list({id:l});if(f!=null&&f.length)for(const m of f){We(m,n,{skipThreading:!0});const d=(p=h.find(({inReplyToId:v})=>v===m.id))==null?void 0:p.sKey;d&&(A.statusReply[d]={id:m.id,instance:n})}else c()}catch{c()}})()}else c()}),o}const za=_t((t,n)=>n.v1.statuses.$select(t).fetch());async function zs(t,n){const i=await ka();if(!i.length)return;const{statusFollowedTags:s}=A,o=[];if(t.forEach(a=>{var m;if(a.reblog)return;const{id:h,content:r,tags:c=[]}=a,l=it(h,n);if((m=s[l])!=null&&m.length)return;const p=_a(r);if(!p.length&&!c.length)return;const f=i.reduce((d,v)=>((p.some(b=>b.toLowerCase()===v.name.toLowerCase())||c.some(b=>b.name.toLowerCase()===v.name.toLowerCase()))&&d.push(v.name),d),[]);f.length&&o.push({item:a,sKey:l,followedTags:f})}),o.length){const a=o.map(r=>r.item.account),h=await si(a);if(!h)return;o.forEach(r=>{const{item:c,sKey:l,followedTags:p}=r,f=h[c.account.id];f&&!f.following&&(s[l]=p)})}}function Ua(){A.statusFollowedTags={}}function Ba({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:h,distanceFromEndPx:r}={}){const[c,l]=M(null),[p,f]=M(!1),[m,d]=M(!1),[v,b]=M(!1),[y,w]=M(!1),k=a==="vertical";return gt(()=>{const C=t.current;if(!C)return{};let I=k?C.scrollTop:C.scrollLeft;function T(){const{scrollTop:_,scrollLeft:x,scrollHeight:$,scrollWidth:D,clientHeight:L,clientWidth:q}=C,V=k?_:x,W=k?$:D,Z=k?L:q,F=Math.abs(V-I),H=h||Math.min(Z*n,W,V),N=r||Math.min(Z*i,W,W-V-Z);F>=(I=W),b(V<=H),w(V+Z>=W-N)}return C.addEventListener("scroll",T,{passive:!0}),()=>C.removeEventListener("scroll",T)},[n,i,s,o]),{scrollDirection:c,reachStart:p,reachEnd:m,nearReachStart:v,nearReachEnd:y,init:()=>{t.current&&t.current.dispatchEvent(new Event("scroll"))}}}function Fa({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:h,distanceFromEndPx:r,init:c}={},l,p){if(!l)return;const f=a==="vertical",m=Y(null),d=Y(null),v=No(()=>{let b=!1,y=!1,w=!1,k=!1;const C=t.current,{scrollTop:I,scrollLeft:T,scrollHeight:_,scrollWidth:x,clientHeight:$,clientWidth:D}=C,L=f?I:T,q=f?_:x,V=f?$:D,W=Math.abs(L-m.current),Z=h||Math.min(V*n,q,L),F=r||Math.min(V*i,q,q-L-V);W>=(m.current=q,w=L<=Z,k=L+V>=q-F,l({scrollDirection:d.current,reachStart:b,reachEnd:y,nearReachStart:w,nearReachEnd:k})},500);gt(()=>{const b=t.current;return b?(m.current=b[f?"scrollTop":"scrollLeft"],b.addEventListener("scroll",v,{passive:!0}),()=>b.removeEventListener("scroll",v)):{}},[n,i,s,o,...p]),se(()=>{c&&t.current&&queueMicrotask(()=>{t.current.dispatchEvent(new Event("scroll"))})},[c])}function Ha({class:t,statusID:n,status:i,instance:s,parent:o,onMediaClick:a}){let h=it(n,s);const r=qe(A);if(i||(i=r.statuses[h]||r.statuses[n],h=it(i==null?void 0:i.id,s)),!i)return null;const{account:{acct:c,avatar:l,avatarStatic:p,id:f,url:m,displayName:d,username:v,emojis:b,bot:y,group:w},id:k,repliesCount:C,reblogged:I,reblogsCount:T,favourited:_,favouritesCount:x,bookmarked:$,poll:D,muted:L,sensitive:q,spoilerText:V,visibility:W,language:Z,editedAt:F,filtered:H,card:N,createdAt:P,inReplyToId:j,inReplyToAccountId:B,content:ee,mentions:ge,mediaAttachments:ie,reblog:be,uri:_e,url:G,emojis:ae,_deleted:Ce,_pinned:Ee}=i;if(!(ie!=null&&ie.length))return null;const Re=fe=>{fe.shiftKey},Le=ke(()=>wt(),[]),Ne=ke(()=>Le&&Le===f,[f,Le]),ve=bo(gs),te=!Ne&&Ft(H,ve);if((te==null?void 0:te.action)==="hide")return null;const pe=q,le=ke(()=>{var O;return((O=(me.account.get("preferences")||{})["reading:expand:media"])==null?void 0:O.toLowerCase())||"default"},[])==="show_all",X=o||"div";return ie.map((fe,O)=>{const E=`${h}-${fe.id}`,z=te==null?void 0:te.titlesStr;return e(X,{"data-state-post-id":h,onMouseEnter:Re,"data-spoiler-text":V||(q?g._({id:"FKojeB"}):void 0),"data-filtered-text":te?z?g._({id:"7FGvtQ",values:{filterTitleStr:z}}):g._({id:"03Qqf9"}):void 0,class:` media-post ${te?"filtered":""} ${pe?"has-spoiler":""} ${le?"show-media":""} `,children:e(ms,{class:t,media:fe,lang:Z,to:`/${s}/s/${k}?media-only=${O+1}`,onClick:a?re=>a(re,O,fe,i):void 0})},E)})}const Yi=st(Ha);function qa(t){var T,_,x,$,D;const n=qe(A),{masto:i,instance:s,authenticated:o}=ce(),[a,h]=ke(()=>{const L=me.local.getJSON("accounts")||[];return[L.find(V=>V.info.id===wt())||L[0],L.length>1]},[]),r=(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&!n.shortcuts.find(L=>L.type==="following"),c=Po(()=>{A.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),l=Y(),[p,f]=M(void 0),m=Oo([0,0,n.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),d=Y();async function v(L){return(L||!d.current)&&(d.current=i.v1.mutes.list({limit:80})),await d.current.next()}const b=Y();async function y(L){return(L||!b.current)&&(b.current=i.v1.blocks.list({limit:80})),await b.current.next()}const w=Ze("@mastodon/lists"),[k,C]=M([]);se(()=>{w&&p==="open"&&on().then(C)},[p==="open"]);const I=Y();return e(U,{children:[e("button",{ref:l,type:"button",class:`button plain nav-menu-button ${h?"with-avatar":""} ${p==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{I.current=Date.now(),f(L=>L?void 0:"open")},onContextMenu:L=>{L.preventDefault(),A.showAccounts=!0},...c(),children:[h&&e(dt,{url:((T=a==null?void 0:a.info)==null?void 0:T.avatar)||((_=a==null?void 0:a.info)==null?void 0:_.avatarStatic),size:"l",squircle:(x=a==null?void 0:a.info)==null?void 0:x.bot}),e(S,{icon:"menu",size:h?"s":"l",alt:g._({id:"zucql+"})})]}),e(bs,{menuClassName:"nav-menu",state:p,anchorRef:l,onClose:()=>{f(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-I.current<300}},portal:{target:document.body},...t,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:m,unmountOnClose:!0,children:[!!(($=n.appVersion)!=null&&$.commitHash)&&n.appVersion.commitHash!=="5a4082e"&&e("div",{class:"top-menu",children:[e(we,{onClick:()=>{confirm(g._({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(S,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(u,{id:"95IFnD"})})]}),e(Ge,{})]}),e("section",{children:[e(Be,{to:"/",children:[e(S,{icon:"home",size:"l"})," ",e("span",{children:e(u,{id:"i0qMbr"})})]}),o?e(U,{children:[r&&e(Be,{to:"/following",children:[e(S,{icon:"following",size:"l"})," ",e("span",{children:e(u,{id:"following.title"})})]}),e(Be,{to:"/catchup",children:[e(S,{icon:"history2",size:"l"}),e("span",{children:e(u,{id:"xrl8fj"})})]}),Ze("@mastodon/mentions")&&e(Be,{to:"/mentions",children:[e(S,{icon:"at",size:"l"})," ",e("span",{children:e(u,{id:"/bZzdR"})})]}),e(Be,{to:"/notifications",children:[e(S,{icon:"notification",size:"l"})," ",e("span",{children:e(u,{id:"iDNBZe"})}),n.notificationsShowNew&&e("sup",{title:g._({id:"isRobC"}),style:{opacity:.5},children:[" ","โ€ข"]})]}),e(Ge,{}),((D=a==null?void 0:a.info)==null?void 0:D.id)&&e(Be,{to:`/${s}/a/${a.info.id}`,children:[e(S,{icon:"user",size:"l"})," ",e("span",{children:e(u,{id:"vERlcd"})})]}),(k==null?void 0:k.length)>0?e(wn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(U,{children:[e(S,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(u,{id:"h16FyT"})}),e(S,{icon:"chevron-right"})]}),children:[e(Be,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),(k==null?void 0:k.length)>0&&e(U,{children:[e(Ge,{}),k.map(L=>e(Be,{to:`/l/${L.id}`,children:e("span",{children:L.title})},L.id))]})]}):w&&e(Be,{to:"/l",children:[e(S,{icon:"list",size:"l"}),e("span",{children:e(u,{id:"h16FyT"})})]}),e(Be,{to:"/b",children:[e(S,{icon:"bookmark",size:"l"})," ",e("span",{children:e(u,{id:"7Ff7ia"})})]}),e(wn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(U,{children:[e(S,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(u,{id:"24misb"})}),e(S,{icon:"chevron-right"})]}),children:[e(Be,{to:"/f",children:[e(S,{icon:"heart",size:"l"})," ",e("span",{children:e(u,{id:"zZOZj7"})})]}),e(Be,{to:"/fh",children:[e(S,{icon:"hashtag",size:"l"})," ",e("span",{children:e(u,{id:"Xi1/bw"})})]}),e(Ge,{}),Ze("@mastodon/filters")&&e(Be,{to:"/ft",children:[e(S,{icon:"filters",size:"l"})," ",e("span",{children:e(u,{id:"cSev+j"})})]}),e(we,{onClick:()=>{A.showGenericAccounts={id:"mute",heading:g._({id:"sOKhEA"}),fetchAccounts:v,excludeRelationshipAttrs:["muting"]}},children:[e(S,{icon:"mute",size:"l"})," ",e("span",{children:e(u,{id:"n1sANU"})})]}),e(we,{onClick:()=>{A.showGenericAccounts={id:"block",heading:g._({id:"nL8nlr"}),fetchAccounts:y,excludeRelationshipAttrs:["blocking"]}},children:[e(S,{icon:"block",size:"l"})," ",e("span",{children:e(u,{id:"r3RRWo"})})]})," "]}),e(Ge,{}),e(we,{onClick:()=>{A.showAccounts=!0},children:[e(S,{icon:"group",size:"l"})," ",e("span",{children:e(u,{id:"7e0O8Z"})})]})]}):e(U,{children:[e(Ge,{}),e(Be,{to:"/login",children:[e(S,{icon:"user",size:"l"})," ",e("span",{children:e(u,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(Ge,{}),e(Be,{to:"/search",children:[e(S,{icon:"search",size:"l"})," ",e("span",{children:e(u,{id:"A1taO8"})})]}),e(Be,{to:`/${s}/trending`,children:[e(S,{icon:"chart",size:"l"})," ",e("span",{children:e(u,{id:"4/iCqx"})})]}),e(Be,{to:`/${s}/p/l`,children:[e(S,{icon:"building",size:"l"})," ",e("span",{children:e(u,{id:"d5zxa4"})})]}),e(Be,{to:`/${s}/p`,children:[e(S,{icon:"earth",size:"l"})," ",e("span",{children:e(u,{id:"4ERYY7"})})]}),o?e(U,{children:[e(Ge,{className:"divider-grow"}),e(we,{onClick:()=>{A.showKeyboardShortcutsHelp=!0},children:[e(S,{icon:"keyboard",size:"l"})," ",e("span",{children:e(u,{id:"77Emn0"})})]}),e(we,{onClick:()=>{A.showShortcutsSettings=!0},children:[e(S,{icon:"shortcut",size:"l"})," ",e("span",{children:e(u,{id:"8Kudkr"})})]}),e(we,{onClick:()=>{A.showSettings=!0},children:[e(S,{icon:"gear",size:"l"})," ",e("span",{children:e(u,{id:"uVbUP8"})})]})]}):e(U,{children:[e(Ge,{}),e(we,{onClick:()=>{A.showSettings=!0},children:[e(S,{icon:"gear",size:"l"})," ",e("span",{children:e(u,{id:"uVbUP8"})})]})]})]})]})]})}const Nt=st(qa),an={block:"nearest",inline:"center",behavior:"smooth"};function St({title:t,titleComponent:n,id:i,instance:s,emptyText:o,errorText:a,useItemID:h,boostsCarousel:r,fetchItems:c=()=>{},checkForUpdates:l=()=>{},checkForUpdatesInterval:p=15e3,headerStart:f,headerEnd:m,timelineStart:d,refresh:v,view:b,filterContext:y,showFollowedTags:w,showReplyParent:k,clearWhenRefresh:C}){const I=qe(A),[T,_]=M([]),[x,$]=M("start"),[D,L]=M(!1),[q,V]=M(!1),[W,Z]=M(!0),F=Y();__BENCHMARK.start(`timeline-${i}-load`);const H=ke(()=>ti(),[]),N=b!=="media",P=Y(0),j=zo(te=>{V(!1),$("loading"),(async()=>{try{const pe=P.current=Date.now();let{done:xe,value:le}=await c(te);if(pe!==P.current)return;if(Array.isArray(le)){const[X,fe]=le.reduce((O,E)=>(E._pinned?O[0].push(E):O[1].push(E),O),[[],[]]);le=fe,N&&(r&&(le=Pa(le)),le=Oa(le,s)),X.length&&(le=X.concat(le)),_(te?le:O=>[...O,...le]),le.length||(xe=!0),L(!xe)}else L(!1);$("default"),__BENCHMARK.end(`timeline-${i}-load`)}catch{$("error"),te&&!T.length&&a&&de(a)}finally{j.cancel()}})()},1e3,{leading:!0}),B=".timeline-item, .timeline-item-alt",ee=Ue("j, shift+j",(te,pe)=>{const xe=document.activeElement.closest(B),le=xe==null?void 0:xe.getBoundingClientRect(),X=Array.from(F.current.querySelectorAll(B));if(xe&&le.top0){const fe=X.indexOf(xe);let O=X[fe+1];pe.shift&&(O=X.find((E,z)=>z>fe&&!E.classList.contains("timeline-item-alt"))),O&&(O.focus(),O.scrollIntoView(an))}else{const fe=X.find(O=>{const E=O.getBoundingClientRect();return E.top>=44&&E.left>=0});fe&&(fe.focus(),fe.scrollIntoView(an))}}),ge=Ue("k, shift+k",(te,pe)=>{const xe=document.activeElement.closest(B),le=xe==null?void 0:xe.getBoundingClientRect(),X=Array.from(F.current.querySelectorAll(B));if(xe&&le.top0){const fe=X.indexOf(xe);let O=X[fe-1];pe.shift&&(O=X.findLast((E,z)=>z{const E=O.getBoundingClientRect();return E.top>=44&&E.left>=0});fe&&(fe.focus(),fe.scrollIntoView(an))}}),ie=Ue(["enter","o"],()=>{const te=document.activeElement;te!=null&&te.matches(B)&&te.click()}),be=T.length>0&&x!=="loading"&&q,_e=ct(()=>{var te;be&&j(!0),(te=F.current)==null||te.scrollTo({top:0,behavior:"smooth"})},[j,be]),G=Ue(".",_e),ae=Y(),[Ce,Ee]=M(!1);Fa({scrollableRef:F,distanceFromEnd:2,scrollThresholdStart:44},({scrollDirection:te,nearReachStart:pe,reachStart:xe})=>{if(ae.current){const le=te==="end"&&!pe;ae.current.hidden=le}Ee(pe),xe&&j(!0)},[]),se(()=>{var te;(te=F.current)==null||te.scrollTo({top:0}),j(!0)},[]);const Re=Y(!0);se(()=>{var te;if(Re.current){Re.current=!1;return}C&&(T!=null&&T.length)&&((te=j.cancel)==null||te.call(j),_([])),j(!0)},[C,v]);const Le=Y(b);se(()=>{Le.current!==b&&(Le.current=b,_([]))},[b]);const Ne=ct(async({disableIdleCheck:te=!1}={})=>{const pe=F.current?getComputedStyle(F.current).pointerEvents==="none":!1;I.settings.autoRefresh&&F.current.scrollTop<16&&(te||window.__IDLE__)&&!Ga()&&!pe?j(!0):await l()&&V(!0)},[i,j,l,I.settings.autoRefresh]),ve=Y();return Ht(te=>{if(te){const pe=Date.now()-ve.current;(!ve.current||pe>1e3*3)&&Ne({disableIdleCheck:!0})}else ve.current=Date.now();Z(te)},[l,Ne,I.settings.autoRefresh]),ii(Ne,W&&!q?p*(Ce?1:2):null),e(gs.Provider,{value:y,children:e("div",{id:`${i}-page`,class:`deck-container ${H?"deck-container-media-first":""}`,ref:te=>{F.current=te,ee(te),ge(te),ie(te),G(te)},tabIndex:"-1",onClick:te=>{ae.current&&te.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{ae.current.hidden=!1},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:ae,onClick:te=>{var pe;te.target.closest("a, button")||(pe=F.current)==null||pe.scrollTo({top:0,behavior:"smooth"})},onDblClick:te=>{te.target.closest("a, button")||j(!0)},class:x==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),f??e(ue,{to:"/",class:"button plain home-button",children:e(S,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),t&&(n||e("h1",{children:t})),e("div",{class:"header-side",children:!!m&&m})]}),be&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:_e,children:[e(S,{icon:"arrow-up"})," ",e(u,{id:"2yr1/p"})]})]}),!!d&&e("div",{class:`timeline-start ${x==="loading"?"loading":""}`,children:d}),T.length?e(U,{children:[e("ul",{class:`timeline ${b?`timeline-${b}`:""}`,children:[T.map(te=>e(Ya,{status:te,instance:s,useItemID:h,filterContext:y,view:b,showFollowedTags:w,showReplyParent:k,mediaFirst:H},te.id+(te==null?void 0:te._pinned)+b)),D&&x==="loading"&&(b==="media"?null:e(U,{children:[e("li",{style:{height:"20vh"},children:e(Ye,{skeleton:!0,mediaFirst:H})}),e("li",{style:{height:"25vh"},children:e(Ye,{skeleton:!0,mediaFirst:H})})]}))]}),x==="default"&&(D?e(kt,{root:F.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:te=>{te&&j()},children:e("button",{type:"button",class:"plain block",onClick:()=>j(),style:{marginBlockEnd:"6em"},children:e(u,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(u,{id:"2EYeAZ"})}))]}):x==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((te,pe)=>b==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(Ye,{skeleton:!0,mediaFirst:H})},pe))}):x!=="error"&&x!=="start"&&e("p",{class:"ui-state",children:o}),x==="error"&&e("p",{class:"ui-state",children:[a,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>j(!T.length),children:e(u,{id:"KDw4GX"})})]})]})})})}const Ya=st(({status:t,instance:n,useItemID:i,filterContext:s,view:o,showFollowedTags:a,showReplyParent:h,mediaFirst:r})=>{const{id:c,reblog:l,items:p,type:f,_pinned:m}=t;m&&(i=!1);const d=(l==null?void 0:l.id)||c,v=n?`/${n}/s/${d}`:`/s/${d}`;if(p){let y=Rt(p,s),w="";if(f==="boosts"?w=g._({id:"NuqppG",values:{0:y.length}}):f==="pinned"&&(w=g._({id:"GlfmCu"})),f==="boosts"||f==="pinned"){const I=new Set;if(y.sort((T,_)=>{const x=Ft(T.filtered,s),$=Ft(_.filtered,s);return x&&I.add(T.id),$&&I.add(_.id),x&&!$?1:!x&&$?-1:0}),I.size>=2){const _=[],x=[];y.forEach(D=>{I.has(D.id)?x.push(D):_.push(D)});const $=[];for(let D=0;D{const{id:_,reblog:x,_pinned:$,_grouped:D}=T;if(D)return e("li",{class:"timeline-item-carousel-group",children:T.posts.map(V=>{const{id:W,reblog:Z,_pinned:F}=V,H=(Z==null?void 0:Z.id)||W,N=n?`/${n}/s/${H}`:`/s/${H}`;return F&&(i=!1),e(ue,{class:"status-carousel-link timeline-item-alt",to:N,children:i?e(Ye,{statusID:W,instance:n,size:"s"}):e(Ye,{status:V,instance:n,size:"s"})})})},_);const L=(x==null?void 0:x.id)||_,q=n?`/${n}/s/${L}`:`/s/${L}`;return $&&(i=!1),e("li",{children:e(ue,{class:"status-carousel-link timeline-item-alt",to:q,children:i?e(Ye,{statusID:_,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:r}):e(Ye,{status:T,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:r})})},_)})})},`timeline-${c}`)}const C=y.length>3;return y.map((I,T)=>{const{id:_,_differentAuthor:x}=I,$=n?`/${n}/s/${_}`:`/s/${_}`,D=T>0&&T0||C&&D&&(f==="thread"||f==="conversation"&&!x&&!y[T-1]._differentAuthor&&!y[T+1]._differentAuthor),V=T===0,W=T===y.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${f} timeline-item-container-${V?"start":W?"end":"middle"} ${x?"timeline-item-diff-author":""}`,children:e(ue,{class:"status-link timeline-item",to:$,children:q?e(Va,{status:I,instance:n,filterContext:s}):i?e(Ye,{statusID:_,instance:n,enableCommentHint:W,showFollowedTags:a}):e(Ye,{status:I,instance:n,enableCommentHint:W,showFollowedTags:a})})},`timeline-${_}`)})}const b=`timeline-${c+m}`;return o==="media"?i?e(Yi,{class:"timeline-item",parent:"li",statusID:c,instance:n},b):e(Yi,{class:"timeline-item",parent:"li",status:t,instance:n},b):e("li",{children:e(ue,{class:"status-link timeline-item",to:v,children:i?e(Ye,{statusID:c,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:h,mediaFirst:r}):e(Ye,{status:t,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:h,mediaFirst:r})})},b)},(t,n)=>{var o,a;const i=(((o=t.status)==null?void 0:o.id)||"").toString(),s=(((a=n.status)==null?void 0:a.id)||"").toString();return i===s&&t.instance===n.instance&&t.view===n.view});function ja({title:t,class:n,children:i}){const s=Y(),o=Y(),a=Y(),[h,r]=M(!1);return se(()=>{setTimeout(()=>{r(!0)},1)},[]),e("div",{class:`status-carousel ${n}`,children:[e("header",{children:[e("h3",{children:t}),e("span",{children:[e("button",{ref:o,type:"button",class:"small plain2",onClick:()=>{var l,p;const c=Math.min(320,(l=s.current)==null?void 0:l.offsetWidth)*(Et()?1:-1);(p=s.current)==null||p.scrollBy({left:c,behavior:"smooth"})},children:e(S,{icon:"chevron-left",alt:g._({id:"DHhJ7s"})})})," ",e("button",{ref:a,type:"button",class:"small plain2",onClick:()=>{var l,p;const c=Math.min(320,(l=s.current)==null?void 0:l.offsetWidth)*(Et()?-1:1);(p=s.current)==null||p.scrollBy({left:c,behavior:"smooth"})},children:e(S,{icon:"chevron-right",alt:g._({id:"hXzOVo"})})})]})]}),e("ul",{ref:s,children:[e(kt,{class:"status-carousel-beacon",onChange:c=>{o.current&&(o.current.disabled=c)}}),i[0],h&&i.slice(1),e(kt,{class:"status-carousel-beacon",onChange:c=>{a.current&&(a.current.disabled=c)}})]})]})}function Va({status:t,instance:n,filterContext:i}){const s=qe(A),{id:o,visibility:a,language:h}=t,r=ci(t),c=it(o,n),l=Ft(t.filtered,i);return e("article",{class:`status compact-thread ${a==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[s.statusThreadNumber[c]?e("div",{class:"status-thread-badge",children:[e(S,{icon:"thread",size:"s",alt:g._({id:"e66y2Z"})}),s.statusThreadNumber[c]?` ${s.statusThreadNumber[c]}/X`:""]}):e("div",{class:"status-thread-badge",children:e(S,{icon:"thread",size:"s",alt:g._({id:"e66y2Z"})})}),e("div",{class:"content-compact",title:r,lang:h,dir:"auto",children:l?e("b",{class:"status-filtered-badge badge-meta horizontal",title:(l==null?void 0:l.titlesStr)||"",children:l!=null&&l.titlesStr?e(u,{id:"sr6maL",values:{0:l.titlesStr},components:{0:e("span",{}),1:e("span",{})}}):e("span",{children:e(u,{id:"03Qqf9"})})}):e(U,{children:[r,t.sensitive&&t.spoilerText&&e(U,{children:[" ",e("span",{class:"spoiler-badge",children:e(S,{icon:"eye-close",size:"s",alt:g._({id:"gnKo7f"})})})]})]})})]})}function Ga(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const Ut=20,yi=1983,ji=`${yi}-01`,Ka=(()=>{try{const t=document.createElement("input");return t.setAttribute("type","month"),t.type==="month"}catch{return!1}})();async function Wa(t){var s;const{masto:n}=ce({instance:t}),i=await n.v2.search.fetch({q:"from:me",type:"statuses",limit:1});return!!((s=i==null?void 0:i.statuses)!=null&&s.length)}const Za=_t(Wa);function Xa(){const t=qe(A),{id:n,...i}=$t(),[s,o]=ft(),a=s.get("month"),h=!s.get("replies"),r=!!s.get("boosts"),c=s.get("tagged"),l=!!s.get("media"),{masto:p,instance:f,authenticated:m}=ce({instance:i.instance}),{masto:d,instance:v}=ce(),b=Y(),y=[a,h,r,c,l],[w,k]=M(),C=Y(0);se(()=>{C.current=0},y);const I=ke(()=>ti(),[]),T=ke(()=>f===v,[f,v]),[_,x]=M(!1);se(()=>{T&&w!=null&&w.acct&&(async()=>{const ie=await Za(f);x(ie)})()},[f,T,w==null?void 0:w.acct]);async function $(ie){var Ee,Re,Le,Ne;const be=/^\d{4}-[01]\d$/.test(a),_e=((Re=(Ee=a==null?void 0:a.split)==null?void 0:Ee.call(a,"-"))==null?void 0:Re[0])>=yi;if(be&&_e){if(!w)return{value:[],done:!0};const[ve,te]=a.split("-"),pe=parseInt(te,10)-1,xe=new Date(ve,pe,0),le=`${xe.getFullYear()}-${(xe.getMonth()+1).toString().padStart(2,"0")}-${xe.getDate().toString().padStart(2,"0")}`,X=new Date(ve,pe+1,1),fe=`${X.getFullYear()}-${(X.getMonth()+1).toString().padStart(2,"0")}-${X.getDate().toString().padStart(2,"0")}`;let O;ie?(O=Ut+1,C.current=0):(O=Ut+C.current+1,C.current+=Ut);const E=await p.v2.search.fetch({q:`from:${w.acct} after:${le} before:${fe}`,type:"statuses",limit:O,offset:C.current});if((Le=E==null?void 0:E.statuses)!=null&&Le.length){const z=E.statuses.slice(0,Ut);z.forEach(ye=>{We(ye,f)});const re=E.statuses.length<=Ut;return{value:z,done:re}}else return{value:[],done:!0}}let G=[];if(ie){const{value:ve}=await p.v1.accounts.$select(n).statuses.list({pinned:!0}).next();if(ve!=null&&ve.length&&!c&&!l){const te=ve.map(pe=>(We(pe,f),{...pe,_pinned:!0}));if(te.length>=3){const pe=te.map(xe=>xe.id);G.push({id:pe,items:te,type:"pinned"})}else G.push(...te)}}(ie||!b.current)&&(b.current=p.v1.accounts.$select(n).statuses.list({limit:Ut,exclude_replies:h,exclude_reblogs:r,only_media:l||void 0,tagged:c}));const{value:ae,done:Ce}=await b.current.next();if(ae!=null&&ae.length){if(G.length){let ve=[];((Ne=G[0])==null?void 0:Ne.type)==="pinned"?ve=G[0].id:ve=G.filter(pe=>pe._pinned).map(pe=>pe.id),ve.every(pe=>ae.some(xe=>xe.id===pe))&&(G=[])}G.push(...ae),ae.forEach(ve=>{We(ve,f)})}return{value:G,done:Ce}}const[D,L]=M([]),{i18n:q}=Qe();let V=q._({id:"/cKnpj"});if(w!=null&&w.acct){const ie=(/@/.test(w.acct)?"":"@")+w.acct,be=w!=null&&w.displayName?`${w.displayName} (${ie})`:`${ie}`;if(!h)V=q._({id:"hS1Opy",values:{accountDisplay:be}});else if(r)V=q._({id:"A/CX5F",values:{accountDisplay:be}});else if(c)V=q._({id:"QQrO94",values:{accountDisplay:be,tagged:c}});else if(l)V=q._({id:"NoG5wD",values:{accountDisplay:be}});else if(a){const _e=new Date(a).toLocaleString(q.locale,{month:"long",year:"numeric"});V=q._({id:"8GjLvB",values:{accountDisplay:be,monthYear:_e}})}else V=be}Xe(V,"/:instance?/a/:id");const W=Y(),Z=ct(()=>{const ie=W.current||p.v1.accounts.$select(n).fetch();return W.current=ie,ie},[n,p]);se(()=>{(async()=>{try{const ie=await Z();k(ie)}catch{}if(!I)try{const ie=await p.v1.accounts.$select(n).featuredTags.list();L(ie)}catch{}})()},[n,I]);const{displayName:F,acct:H,emojis:N}=w||{},P=Y(),j=ke(()=>{const ie=!h||r||c||l||!!a,be=t.accounts[`${n}@${f}`];return e(U,{children:[e(Ms,{instance:f,account:be||n,fetchAccount:Z,authenticated:m,standalone:!0}),!I&&e("div",{class:"filter-bar",ref:P,style:{position:"relative"},children:[ie?e(ue,{to:`/${f}/a/${n}`,class:"insignificant filter-clear",title:q._({id:"u8JHrO"}),children:e(S,{icon:"x",size:"l",alt:q._({id:"xCJdfg"})})},"clear-filters"):e(S,{icon:"filter",class:"insignificant",size:"l",alt:q._({id:"cSev+j"})}),e(ue,{to:`/${f}/a/${n}${h?"?replies=1":""}`,onClick:()=>{h&&de(q._({id:"PIWNSQ"}))},class:h?"":"is-active",children:e(u,{id:"5BFynH"})}),e(ue,{to:`/${f}/a/${n}${r?"":"?boosts=0"}`,onClick:()=>{r||de(q._({id:"Qd13i0"}))},class:r?"is-active":"",children:e(u,{id:"usxQx0"})}),e(ue,{to:`/${f}/a/${n}${l?"":"?media=1"}`,onClick:()=>{l||de(q._({id:"rKpfPY"}))},class:l?"is-active":"",children:e(u,{id:"xYilR2"})}),D.map(_e=>e(ue,{to:`/${f}/a/${n}${c===_e.name?"":`?tagged=${encodeURIComponent(_e.name)}`}`,onClick:()=>{c!==_e.name&&de(q._({id:"L+HFfr",values:{0:_e.name}}))},class:c===_e.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),_e.name]})},_e.id)),_&&(Ka?e("label",{class:`filter-field ${a?"is-active":""}`,children:[e(S,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!(w!=null&&w.acct),value:a||"",min:ji,max:new Date().toISOString().slice(0,7),onInput:_e=>{const{value:G,validity:ae}=_e.currentTarget;if(!ae.valid)return;o(G?{month:G}:{});const[Ce,Ee]=G.split("-"),Re=parseInt(Ee,10)-1,Le=new Date(Ce,Re);de(q._({id:"0WUFGD",values:{0:Le.toLocaleString(q.locale,{month:"long",year:"numeric"})}}))}})]}):e(Ja,{class:`filter-field ${a?"is-active":""}`,disabled:!(w!=null&&w.acct),value:a||"",min:ji,max:new Date().toISOString().slice(0,7),onInput:_e=>{const{value:G,validity:ae}=_e;ae.valid&&o(G?{month:G}:{})}}))]})]})},[n,f,m,D,Z,_,...y]);se(()=>{var be;const ie=(be=P.current)==null?void 0:be.querySelector(".is-active");ie&&P.current.scrollTo({behavior:"smooth",left:ie.offsetLeft-(P.current.offsetWidth-ie.offsetWidth)/2})},[D,_,...y]);const B=ke(()=>w!=null&&w.url?URL.parse(w.url).hostname:null,[w]),ge=!!w&&!(f===B);return e(St,{title:`${w!=null&&w.acct?"@"+w.acct:q._({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(fs,{text:F,emojis:N})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",H]})})]}),id:"account-statuses",instance:f,emptyText:q._({id:"+k97fV"}),errorText:q._({id:"scd9lw"}),fetchItems:$,useItemID:!0,view:l||I?"media":void 0,boostsCarousel:t.settings.boostsCarousel,timelineStart:j,refresh:[h,r,c,l,a+(w==null?void 0:w.acct)].toString(),headerEnd:e(at,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:q._({id:"2FYpfJ"})})}),children:[e(we,{disabled:!ge,onClick:()=>{(async()=>{try{const{masto:ie}=ce({instance:B}),be=await ie.v1.accounts.lookup({acct:w.acct}),{id:_e}=be;location.hash=`/${B}/a/${_e}`}catch{alert(q._({id:"FgdLx0"}))}})()},children:[e(S,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"/JFxxT",values:{0:B?e(U,{children:[" ","(",e("b",{children:Kt.toUnicode(B)}),")"]}):null}})})]}),!T&&e(we,{onClick:()=>{(async()=>{try{const ie=await d.v1.accounts.lookup({acct:w.acct+"@"+f}),{id:be}=ie;location.hash=`/${v}/a/${be}`}catch{alert(q._({id:"FgdLx0"}))}})()},children:[e(S,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"HkuyOu",values:{currentInstance:v},components:{0:e("b",{})}})})]})]})},n)}function Ja(t){const{i18n:n}=Qe(),{class:i,disabled:s,value:o,min:a,max:h,onInput:r=()=>{}}=t,[c,l]=(o==null?void 0:o.split("-"))||[],p=Y(),f=Y(),m=(d,v)=>{const[b,y]=(a==null?void 0:a.split("-"))||[],[w,k]=(h==null?void 0:h.split("-"))||[];return!(vw||v===b&&dk)};return e("div",{class:i,children:[e(S,{icon:"month",size:"l"}),e("select",{ref:p,disabled:s,value:l||"",onInput:d=>{const{value:v}=d.currentTarget,b=f.current.value;if(!m(v,b))return{value:"",validity:{valid:!1}};r({value:v?`${b}-${v}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(u,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(d,v)=>e("option",{value:(v+1).toString().padStart(2,"0"),children:new Date(0,v).toLocaleString(n.locale,{month:"long"})},v))]})," ",e("input",{ref:f,type:"number",disabled:s,value:c||new Date().getFullYear(),min:(a==null?void 0:a.slice(0,4))||yi,max:(h==null?void 0:h.slice(0,4))||new Date().getFullYear(),onInput:d=>{const{value:v,validity:b}=d.currentTarget,y=p.current.value;if(!b.valid||!m(y,v))return{value:"",validity:{valid:!1}};r({value:v?`${v}-${y}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}const Qa=20;function Us(){Xe(g._({id:"7Ff7ia"}),"/bookmarks");const{masto:t,instance:n}=ce(),i=Y();async function s(o){return(o||!i.current)&&(i.current=t.v1.bookmarks.list({limit:Qa})),await i.current.next()}return e(St,{title:g._({id:"7Ff7ia"}),id:"bookmarks",emptyText:g._({id:"8k2w6G"}),errorText:g._({id:"UoL+FC"}),instance:n,fetchItems:s})}const er=""+new URL("catch-up-DuauQu-W.png",import.meta.url).href,tr="home",ot=[{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}],nr={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},boosts:{id:"puY2t0"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},ir=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],sr=[null,"account"],or=ls(t=>new Intl.DateTimeFormat(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function cr(){const{i18n:t,_:n}=Qe(),i=or(t.locale);Xe("Catch-up","/catchup");const{masto:s,instance:o}=ce(),[a,h]=ft(),r=a.get("id"),[c,l]=M("start"),[p,f]=M(!1),m=ke(()=>wt(),[]),d=R=>R===m,v=Ze("@pixelfed/home-include-reblogs");async function b({maxCreatedAt:R}){var ne,$e,Te;const Q=R?new Date(R):null,oe=[],K=s.v1.timelines.home.list({limit:40});e:for(;;)try{v&&K.nextParams&&(typeof K.nextParams=="string"?K.nextParams+="&include_reblogs=true":K.nextParams.include_reblogs=!0);const Ae=await K.next(),{value:ze}=Ae;if(ze!=null&&ze.length){await zs(ze,o);let He=!1;for(let he=0;he=Q){const je=!d((($e=(ne=De.reblog)==null?void 0:ne.account)==null?void 0:$e.id)||De.account.id)&&Ft(((Te=De.reblog)==null?void 0:Te.filtered)||De.filtered,tr);if((je==null?void 0:je.action)==="hide")continue;De._filtered=je;const bt=it(De.id,o);De._followedTags=A.statusFollowedTags[bt]?[...A.statusFollowedTags[bt]]:[],oe.push(De),He=!0}if(!He)break e}}else break e;await new Promise(He=>setTimeout(He,1e3))}catch{break e}return oe.forEach(Ae=>{if(Ae!=null&&Ae.inReplyToId){const ze=oe.find(He=>He.id===Ae.inReplyToId);ze&&!ze.inReplyToId&&(ze._thread=!0)}}),oe}const[y,w]=M([]),k=Y(),C=Y(),I=ke(()=>yn(),[]),T=ct(async({duration:R}={})=>{const Q=Date.now(),oe=R?Q-R:null;l("loading");const K=await b({maxCreatedAt:oe}),ne=`${I}-${Uo()}`;try{await ut.catchup.set(ne,{id:ne,posts:K,count:K.length,startAt:oe,endAt:Q}),h({id:ne})}catch{}},[]);se(()=>{r?(async()=>{const R=await ut.catchup.get(r);R&&(R.posts.sort((Q,oe)=>Q.createdAt>oe.createdAt?1:-1),w(R.posts),l("results"))})():c==="results"&&(w([]),l("start"))},[r]);const[_,x]=Mt(R=>R+1,0),[$,D]=M(null),[L,q]=M([]);se(()=>{(async()=>{try{const R=await ut.catchup.keys();if(R.length){const Q=yn(),oe=R.filter(K=>K.startsWith(`${Q}-`));if(oe.length){let K=await ut.catchup.getMany(oe);K.sort((Ae,ze)=>ze.endAt-Ae.endAt);let ne=K.slice(0,3),$e=K.slice(3);const Te=ne.map(Ae=>{const{id:ze,count:He,startAt:he,endAt:De}=Ae;return{id:ze,count:He,startAt:he,endAt:De}});q(Te),D(ne[0].endAt),K=null,ne=null,queueMicrotask(()=>{$e.length&&ut.catchup.delMany($e.map(Ae=>Ae.id)).then(()=>{$e=null}).catch(Ae=>{})});return}}}catch{}q([])})()},[_]),se(()=>{c==="start"&&x()},[c==="start"]);const[V,W]=ke(()=>{var ze,He,he,De,Je;let R=0,Q=0,oe=0,K=0,ne=0,$e=0;const Te={};for(const Se of y){Se._filtered?(R++,Se.__FILTER="filtered"):Se.group?(Q++,Se.__FILTER="groups"):Se.reblog?(oe++,Se.__FILTER="boosts"):(ze=Se._followedTags)!=null&&ze.length?(ne++,Se.__FILTER="followedTags"):Se.inReplyToId&&Se.inReplyToAccountId!==((He=Se.account)==null?void 0:He.id)?(K++,Se.__FILTER="replies"):($e++,Se.__FILTER="original");const je=Se.reblog||Se;if(Se.__FILTER!=="filtered"&&((he=je.card)!=null&&he.url)&&((De=je.card)!=null&&De.image)&&((Je=je.card)==null?void 0:Je.type)==="link"){const{card:bt,favouritesCount:cn,reblogsCount:xt}=je;let{url:et}=bt;if(et=et.replace(/\/$/,""),!Te[et])Te[et]={postID:je.id,card:bt,shared:1,sharers:[Se.account],likes:cn,boosts:xt};else{if(Te[et].sharers.find(Pt=>Pt.id===Se.account.id))continue;Te[et].shared++,Te[et].sharers.push(Se.account),Te[et].postID!==je.id&&(Te[et].likes+=cn,Te[et].boosts+=xt)}}}let Ae=[];for(const Se in Te)Ae.push({url:Se,...Te[Se]});if(Ae.sort((Se,je)=>Se.shared>je.shared?-1:Se.sharedje.boosts?-1:Se.boostsje.likes?-1:Se.likes10)e:for(let Se=10;Se{const R={},Q=new Map;let oe=y.filter(ne=>{const $e=Z==="all"||ne.__FILTER===Z;return $e&&(R[ne.account.id]=ne.account,Q.set(ne.account.id,(Q.get(ne.account.id)||0)+1)),$e});const K={};return oe.forEach(ne=>{ne.reblog&&(K[ne.reblog.id]?(K[ne.reblog.id].__BOOSTERS?K[ne.reblog.id].__BOOSTERS.add(ne.account):K[ne.reblog.id].__BOOSTERS=new Set([ne.account]),ne.__HIDDEN=!0):K[ne.reblog.id]=ne)}),H&&Q.has(H)&&(oe=oe.filter(ne=>ne.account.id===H||[...ne.__BOOSTERS||[]].find($e=>$e.id===H))),[oe,R,Object.fromEntries(Q)]},[Z,H,y]),Ee=ke(()=>{const R={};return G.forEach(Q=>{R[Q.id]=Q}),R},[G]),Re=ke(()=>Object.keys(Ce).sort((R,Q)=>Ce[Q]-Ce[R]),[Ce]),Le=ke(()=>{const R={};return Re.forEach((Q,oe)=>{R[Q]=oe}),G.filter(Q=>!Q.__HIDDEN).sort((Q,oe)=>{if(be==="account"){const K=Q.account.id,ne=oe.account.id,$e=R[K],Te=R[ne],Ae=$e-Te;if(Ae!==0)return Ae}if(B!=="createdAt"&&(Q=Q.reblog||Q,oe=oe.reblog||oe,B!=="density"&&Q[B]===oe[B]))return Q.createdAt>oe.createdAt?1:-1;if(B==="density"){const K=Vi(Q),ne=Vi(oe);return ge==="asc"?K>ne?1:-1:ne>K?1:-1}return ge==="asc"?Q[B]>oe[B]?1:-1:oe[B]>Q[B]?1:-1})},[G,B,ge,be,Re]),Ne=Y(null),ve=Y(null),te=Y(!1);se(()=>{y.length>100||te.current||ve.current&&(Ts(ve.current,{duration:200}),te.current=!0)},[y,ve]);const pe=y.length>160?"3d":"2d",xe=ke(()=>pe!=="2d"?null:y.map(R=>{const Q=Ee[R.id];return e("span",{class:`post-dot ${Q?"post-dot-highlight":""}`},R.id)}),[Ee]),le=ke(()=>pe!=="3d"||!(y!=null&&y.length)?null:fr(y,"createdAt",320).map((Q,oe)=>e("div",{class:"posts-bin",children:Q.map(K=>{const ne=Ee[K.id];return e("span",{class:`post-dot ${ne?"post-dot-highlight":""}`},K.id)})},oe)),[Ee]),X=Y(null),fe=ke(()=>$?(Date.now()-$)/1e3/60/60:null,[$,P]);se(()=>{if(c!=="results")return;const R=H&&ae[H]?ae[H].username:"",Q=ge==="asc"?0:1,oe={account:"authors"};let K=de({duration:5e3,text:t._({id:"TLYeLT",values:{selectedFilterCategory:Z,sortBy:B,sortOrder:ge,groupBy:be}})});return()=>{var ne;(ne=K==null?void 0:K.hideToast)==null||ne.call(K)}},[c,Z,H,B,ge,be,ae]),se(()=>{var R;if(H&&ae[H]){const Q=ve.current.querySelector(`[data-author="${H}"]`),oe=(R=ve.current)==null?void 0:R.getBoundingClientRect(),K=Q==null?void 0:Q.getBoundingClientRect();K.leftoe.right?Q.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):K.top<0&&Q.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[H,ae]);const[O,E]=M(!1),z=".catchup-list > li > a",re=Ue("j",()=>{const R=document.activeElement.closest(z),Q=R==null?void 0:R.getBoundingClientRect(),oe=Array.from(X.current.querySelectorAll(z));if(R&&Q.top0){const K=oe.indexOf(R),ne=oe[K+1];ne&&(ne.focus(),ne.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const K=oe.find(ne=>ne.getBoundingClientRect().top>=0);K&&(K.focus(),K.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),ye=Ue("k",()=>{const R=document.activeElement.closest(z),Q=R==null?void 0:R.getBoundingClientRect(),oe=Array.from(X.current.querySelectorAll(z));if(R&&Q.top0){const K=oe.indexOf(R);let ne=oe[K-1];ne&&(ne.focus(),ne.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const K=oe.find(ne=>{const $e=ne.getBoundingClientRect();return $e.top>=44&&$e.left>=0});K&&(K.focus(),K.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),Ie=Ue("h, l",(R,Q)=>{var K,ne,$e;const oe=Q.keys[0];if(H){const Te=Re.indexOf(H);oe==="h"?Te>0&&Te=0&&(N(Re[Te+1]),(ne=X.current)==null||ne.focus())}else oe==="l"&&(N(Re[0]),($e=X.current)==null||$e.focus())},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),J=Ue("esc",()=>{var R;N(null),(R=X.current)==null||R.focus()},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Me=Ue(".",()=>{var R;(R=X.current)==null||R.scrollTo({top:0,behavior:"smooth"})},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Oe=ct(R=>{const Q=document.activeElement,oe=(Q==null?void 0:Q.tagName)==="INPUT"&&Q.type==="radio";if((R.key==="ArrowDown"||R.key==="ArrowUp"||R.key==="ArrowLeft"||R.key==="ArrowRight")&&oe){Q.blur();return}},[]);return e("div",{ref:R=>{X.current=R,re(R),ye(R),Ie(R),J(R)},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${c==="loading"?"loading":""}`,onClick:R=>{var Q;R.target.closest("a, button")||(Q=X.current)==null||Q.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),c==="results"&&e(ue,{to:"/catchup",class:"button plain",children:e(S,{icon:"history2",size:"l",alt:t._({id:"xrl8fj"})})}),c==="start"&&e(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l",alt:t._({id:"i0qMbr"})})})]}),e("h1",{children:c!=="start"&&e(u,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("div",{class:"header-side",children:c!=="start"&&c!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{E(!0)},children:e(u,{id:"c3XJ18"})})})]})}),e("main",{onKeyDown:Oe,children:[c==="start"&&e("div",{class:"catchup-start",children:[e("h1",{children:e(u,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("details",{children:[e("summary",{children:e(u,{id:"CxKPv6"})}),e("p",{children:e(u,{id:"YMU1CK"})}),e("img",{src:er,width:"1200",height:"900",alt:t._({id:"CeInO2"})}),e("p",{children:e("button",{type:"button",onClick:R=>{R.target.closest("details").open=!1},children:e(u,{id:"2jI8hh"})})})]}),e("p",{children:e(u,{id:"1RfGk7"})}),e("p",{children:e("b",{children:e(u,{id:"OOEonE"})})}),e("div",{class:"catchup-form",children:[e("input",{ref:k,type:"range",value:P,min:ot[0].value,max:ot[ot.length-1].value,step:"1",list:"catchup-ranges",onChange:R=>j(+R.target.value)})," ",e("span",{style:{width:"8em"},children:[n(ot[P-1].label),e("br",{}),e("small",{class:"insignificant",children:P==ot[ot.length-1].value?t._({id:"NMNiaO"}):ht(new Date(Date.now()-P*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:ot.map(({label:R,value:Q})=>e("option",{value:Q,label:n(R)}))})," ",e("button",{type:"button",onClick:()=>{var R;if(Pfe?e("p",{class:"catchup-info",children:[e(S,{icon:"info"})," ",e(u,{id:"AGyV7s"})]}):P===ot[ot.length-1].value&&$?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:C})," ",e(u,{id:"dDJEHI",values:{0:i.format(new Date($))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"EAjFM0"})})}),!!(L!=null&&L.length)&&e("div",{class:"catchup-prev",children:[e("p",{children:e(u,{id:"Yfb9A8"})}),e("ul",{children:L.map(R=>e("li",{children:[e(ue,{to:`/catchup?id=${R.id}`,children:[e(S,{icon:"history2"})," ",e("span",{children:R.startAt?i.formatRange(new Date(R.startAt),new Date(R.endAt)):`โ€ฆโ€‰โ€“โ€‰${i.format(new Date(R.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:e(u,{id:"S6XZwv",values:{0:R.count}})})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{var oe;if(confirm(t._({id:"D9CmP2"}))){let K=de(t._({id:"xJUo4P",values:{0:R.id}}));await ut.catchup.del(R.id),(oe=K==null?void 0:K.hideToast)==null||oe.call(K),de(t._({id:"1dyGG/",values:{0:R.id}})),x()}},children:e(S,{icon:"x",alt:t._({id:"t/YqKh"})})})]})]},R.id))}),L.length>=3&&e("p",{children:e("small",{children:e(u,{id:"sXmrl4"})})})]})]}),c==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(Pe,{abrupt:!0}),e("p",{class:"insignificant",children:e(u,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(u,{id:"q9urQO"})})]}),c==="results"&&e(U,{children:[e("div",{class:"catchup-header",children:[y.length>0&&e("p",{children:e("b",{class:"ib",children:i.formatRange(new Date(y[0].createdAt),new Date(y[y.length-1].createdAt))})}),e("aside",{children:[e("button",{hidden:Z==="all"&&!H&&B==="createdAt"&&ge==="asc",type:"button",class:"plain4 small",onClick:()=>{F("all"),N(null),ee("createdAt"),_e(null),ie("asc")},children:e(u,{id:"I9EnzM"})}),(W==null?void 0:W.length)>0&&e("button",{type:"button",class:"plain small",onClick:()=>f(!p),children:[e(u,{id:"EIZREX"})," ",e(S,{icon:"chevron-down",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]})]})]}),e("div",{class:"shazam-container no-animation",hidden:!p,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"catchup-top-links links-bar",children:W.map(R=>{const{card:Q,shared:oe,sharers:K,likes:ne,boosts:$e}=R,{blurhash:Te,title:Ae,description:ze,url:He,image:he,imageDescription:De,language:Je,width:Se,height:je,publishedAt:bt}=Q,cn=Kt.toUnicode(URL.parse(He).hostname.replace(/^www\./,"").replace(/\/$/,""));let xt;if(Te){const et=oi(Te),Pt=bi(et);xt=gi([.6,Pt[1],Pt[2]])}return e("a",{href:He,target:"_blank",rel:"noopener noreferrer",class:"link-block",style:xt?{"--accent-color":`rgb(${xt.join(",")})`,"--accent-alpha-color":`rgba(${xt.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:he,alt:De,width:Se,height:je,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:cn})," ",!!bt&&e(U,{children:"ยท "}),!!bt&&e(U,{children:e(Gt,{datetime:bt,format:"micro"})})]}),!!Ae&&e("h1",{class:"title",lang:Je,dir:"auto",title:Ae,children:Ae})]}),!!ze&&e("p",{class:"description",lang:Je,dir:"auto",title:ze,children:ze}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(u,{id:"bfSr6z",values:{0:K.map(et=>{const{avatarStatic:Pt,displayName:oo}=et;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:ki=>{ki.preventDefault(),ki.stopPropagation();const{id:co}=et;N(co),F("all")},children:e(dt,{url:Pt,size:"s",alt:oo})})})}})})]})]})},He)})})})}),y.length>=5&&(pe==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:le}):e("div",{class:"catchup-posts-viz-bar",children:xe})),y.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:Z.toLowerCase()==="all",onChange:()=>{F("all")}}),e(u,{id:"N40H+G"})," ",e("span",{class:"count",children:y.length})]}),Object.entries(nr).map(([R,Q])=>!!V[R]&&e("label",{class:"filter-cat",title:(V[R]/y.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:Z.toLowerCase()===R.toLowerCase(),onChange:()=>{F(R),R==="boosts"&&(ee("reblogsCount"),ie("desc"),_e(null))}}),n(Q)," ",e("span",{class:"count",children:V[R]})]},n(Q)))]}),y.length>=2&&!!Ce&&e("div",{class:"catchup-filters authors-filters",ref:ve,children:[Re.map(R=>e("label",{class:"filter-author","data-author":R,children:[e("input",{type:"radio",name:"filter-author",checked:H===R,onChange:()=>{N(R)},onClick:()=>{H===R&&N(null)}}),e(dt,{url:ae[R].avatarStatic||ae[R].avatar,size:"xxl",alt:`${ae[R].displayName} (@${ae[R].acct})`})," ",e("span",{class:"count",children:Ce[R]}),e("span",{class:"username",children:ae[R].username})]},`${R}-${Ce[R]}`)),Re.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(u,{id:"HHtYi7",values:{0:Re.length}})},"authors-count")]}),y.length>=2&&e("div",{class:"catchup-filters",children:[e("span",{class:"filter-label",children:e(u,{id:"f6Hub0"})})," ",e("fieldset",{class:"radio-field-group",children:ir.map(R=>e("label",{class:"filter-sort",onClick:Q=>{B===R&&(Q.preventDefault(),Q.stopPropagation(),ie(ge==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:B===R,onChange:()=>{ee(R);const Q=/(replies|favourites|reblogs)/.test(R)?"desc":"asc";ie(Q)}}),{createdAt:t._({id:"mYGY3B"}),repliesCount:t._({id:"N8UzTV"}),favouritesCount:t._({id:"zZOZj7"}),reblogsCount:t._({id:"puY2t0"}),density:t._({id:"0tQ7AD"})}[R],B===R&&(ge==="asc"?" โ†‘":" โ†“")]},R))}),e("span",{class:"filter-label",children:e(u,{id:"group.filter"})})," ",e("fieldset",{class:"radio-field-group",children:sr.map(R=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:be===R,onChange:()=>{_e(R)},disabled:R==="account"&&H}),{account:t._({id:"dpqPBg"})}[R]||t._({id:"EdQY6l"})]},R||"none"))}),H&&Re.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{N(null)},style:{whiteSpace:"nowrap"},children:e(u,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${Z||""} ${B?`catchup-sort-${B}`:""} ${H&&ae[H]?"catchup-selected-author":""} ${be?`catchup-group-${be}`:""}`,children:Le.map((R,Q)=>{var ne;const oe=((ne=R.reblog)==null?void 0:ne.id)||R.id;let K=!1;return be==="account"&&(Ne.current&&R.account.id!==Ne.current&&Q>0&&(K=!0),Ne.current=R.account.id),e(U,{children:[K&&e("li",{class:"separator"}),e(rr,{to:`/${o}/s/${oe}`,post:R,root:X.current})]},`${R.id}-${K}`)})}),e("footer",{children:G.length>5&&e("p",{children:[Z==="boosts"?t._({id:"eVosYr"}):t._({id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{X.current.scrollTop=0},children:e(u,{id:"0MgdN+"})}),"."]})})]})]})]}),O&&e(Fe,{onClose:()=>E(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>E(!1),children:e(S,{icon:"x",alt:t._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"c3XJ18"})})}),e("main",{children:e("dl",{children:[e("dt",{children:e(u,{id:"EIZREX"})}),e("dd",{children:e(u,{id:"YmGrIy"})}),e("dt",{children:e(u,{id:"coaNtr"})}),e("dd",{children:e(u,{id:"UUrqX1"})}),e("dt",{children:e(u,{id:"ScQBC/"})}),e("dd",{children:e(u,{id:"srocAr"})}),e("dt",{children:e(u,{id:"77Emn0"})}),e("dd",{children:e("table",{children:e("tbody",{children:[e("tr",{children:[e("td",{children:e(u,{id:"Gy9P9T"})}),e("td",{children:e("kbd",{children:"j"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"6XYpYY"})}),e("td",{children:e("kbd",{children:"k"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"f5dduh"})}),e("td",{children:e("kbd",{children:"l"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"rj0vxZ"})}),e("td",{children:e("kbd",{children:"h"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"jsFF8C"})}),e("td",{children:e("kbd",{children:"Enter"})})]}),e("tr",{children:[e("td",{children:e(u,{id:"bUUv3P"})}),e("td",{children:e("kbd",{children:"."})})]})]})})})]})})]})})]})}const ar=st(function({post:t}){const{id:n,account:i,group:s,reblog:o,inReplyToId:a,inReplyToAccountId:h,_followedTags:r,_filtered:c,visibility:l,__BOOSTERS:p}=t,f=a&&h!==i.id,m=!!c,d=v=>{v.shiftKey};return e("article",{class:`post-line ${s?"group":o?"reblog":r!=null&&r.length?"followed-tags":""} ${f?"reply-to":""} ${m?"filtered":""} visibility-${l}`,onMouseEnter:d,children:[e("span",{class:"post-author",children:o?e("span",{class:"post-reblog-avatar",children:[e(dt,{url:i.avatarStatic||i.avatar,squircle:i.bot}),(p==null?void 0:p.size)>0?[...p].map(v=>e(dt,{url:v.avatarStatic||v.avatar,squircle:v.bot})):""," ",e(S,{icon:"rocket"})," ",e(mt,{account:o.account,showAvatar:!0})]}):e(mt,{account:i,showAvatar:!0})}),e(ur,{post:o||t,filterInfo:c}),e("span",{class:"post-meta",children:[e(hr,{post:o||t})," ",e(Gt,{datetime:new Date((o==null?void 0:o.createdAt)||t.createdAt),format:"micro"})]})]})},(t,n)=>{var i,s;return((i=t==null?void 0:t.post)==null?void 0:i.id)===((s=n==null?void 0:n.post)==null?void 0:s.id)}),rr=({root:t,to:n,...i})=>{const s=Y(),[o,a]=M(!1);return se(()=>{const h=new IntersectionObserver(r=>{r[0].isIntersecting&&(queueMicrotask(()=>a(!0)),h.unobserve(s.current))},{root:t,rootMargin:`${Math.max(320,screen.height*.75)}px`});return s.current&&h.observe(s.current),()=>{s.current&&h.unobserve(s.current)}},[]),o?e("li",{children:e(ue,{to:n,children:e(ar,{...i})})}):e("li",{ref:s,style:{height:"4em"}})},lr=8,dr=8;function Vi(t){var c;const{spoilerText:n,content:i,poll:s,mediaAttachments:o,card:a}=t,h=(c=s==null?void 0:s.options)!=null&&c.length?s.options.reduce((l,p)=>l+p.title,""):"";return(n.length+vs(i)+h.length)/140+(o!=null&&o.length?lr*o.length:a!=null&&a.image?dr:0)}const Ct=48;function ur({post:t,filterInfo:n}){var k;const{spoilerText:i,sensitive:s,content:o,emojis:a,poll:h,mediaAttachments:r,card:c,inReplyToId:l,inReplyToAccountId:p,account:f,_thread:m}=t,d=l&&p===f.id||!!m,v=ke(()=>!!(me.account.get("preferences")||{})["reading:expand:spoilers"],[]),b=v||!i&&!s,y=o?ci(t):"",w=!i||v;return e("div",{class:"post-peek",title:i?"":y,children:[e("span",{class:"post-peek-content",children:[d&&!w&&e(U,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),n?e("span",{class:"post-peek-filtered",children:n!=null&&n.titlesStr?g._({id:"suKjh3",values:{0:n.titlesStr}}):g._({id:"03Qqf9"})}):e(U,{children:[!!i&&e("span",{class:"post-peek-spoiler",children:[e(S,{icon:`${v?"eye-open":"eye-close"}`})," ",i]}),w&&e("div",{class:"post-peek-html",children:[d&&e(U,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(u,{id:"e66y2Z"})})," "]}),!!o&&e("div",{dangerouslySetInnerHTML:{__html:Bo(o,a)}}),!!((k=h==null?void 0:h.options)!=null&&k.length)&&h.options.map(C=>e("div",{children:[h.multiple?"โ–ช๏ธ":"โ€ข"," ",C.title]})),!o&&(r==null?void 0:r.length)===1&&r[0].description&&e(U,{children:[e("span",{class:"post-peek-tag post-peek-alt",children:"ALT"})," ",e("div",{children:r[0].description})]})]})]})]}),!n&&e("span",{class:"post-peek-post-content",children:[!!h&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(S,{icon:"poll",size:"s"}),e(u,{id:"4WUbF1"})]}),r!=null&&r.length?r.map(C=>{var $,D,L,q,V,W,Z,F,H,N;const I=C.previewUrl||C.url,T=C.previewRemoteUrl||C.remoteUrl,_=($=C.meta)!=null&&$.original?C.meta.original.width:((L=(D=C.meta)==null?void 0:D.small)==null?void 0:L.width)||((V=(q=C.meta)==null?void 0:q.original)==null?void 0:V.width),x=(W=C.meta)!=null&&W.original?C.meta.original.height:((F=(Z=C.meta)==null?void 0:Z.small)==null?void 0:F.height)||((N=(H=C.meta)==null?void 0:H.original)==null?void 0:N.height);return e("span",{class:"post-peek-media",children:{image:(I||T)&&b?e("img",{src:I,width:Ct,height:Ct,alt:C.description,loading:"lazy",onError:P=>{const{src:j}=P.target;j===I&&(P.target.src=T)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(_,x)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"๐Ÿ–ผ"}),gifv:(I||T)&&b?e("img",{src:I,width:Ct,height:Ct,alt:C.description,loading:"lazy",onError:P=>{const{src:j}=P.target;j===I&&(P.target.src=T)}}):e("span",{class:"post-peek-faux-media",children:"๐ŸŽž๏ธ"}),video:(I||T)&&b?e("img",{src:I,width:Ct,height:Ct,alt:C.description,loading:"lazy",onError:P=>{const{src:j}=P.target;j===I&&(P.target.src=T)}}):e("span",{class:"post-peek-faux-media",children:"๐Ÿ“น"}),audio:e("span",{class:"post-peek-faux-media",children:"๐ŸŽต"})}[C.type]||null},C.id)}):!!c&&c.image&&b&&e("span",{class:`post-peek-media post-peek-card card-${c.type||""}`,children:c.image?e("img",{src:c.image,width:Ct,height:Ct,alt:c.title||c.description||c.imageDescription,loading:"lazy",style:{"--anim-duration":c.width&&c.height&&`${Math.min(Math.max(Math.max(c.width,c.height)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"๐Ÿ”—"})})]})]})}function hr({post:t}){const{reblogsCount:n,repliesCount:i,favouritesCount:s}=t;return e("span",{class:"post-stats",children:[i>0&&e("span",{class:"post-stat-replies",children:[e(S,{icon:"comment2",size:"s",alt:g._({id:"N8UzTV"})})," ",Ke(i)]}),s>0&&e("span",{class:"post-stat-likes",children:[e(S,{icon:"heart",size:"s",alt:g._({id:"zZOZj7"})})," ",Ke(s)]}),n>0&&e("span",{class:"post-stat-boosts",children:[e(S,{icon:"rocket",size:"s",alt:g._({id:"puY2t0"})})," ",Ke(n)]})]})}function fr(t,n,i){const s=t.map(c=>new Date(c[n])),o=s.reduce((c,l)=>ll>c?l:c,s[0]).getTime()-o.getTime(),r=Array.from({length:i},()=>[]);return t.forEach(c=>{const p=(new Date(c[n]).getTime()-o.getTime())/h,f=Math.floor(p*(i-1));r[f].push(c)}),r}const pr=20;function Bs(){Xe(g._({id:"zZOZj7"}),"/favourites");const{masto:t,instance:n}=ce(),i=Y();async function s(o){return(o||!i.current)&&(i.current=t.v1.favourites.list({limit:pr})),await i.current.next()}return e(St,{title:g._({id:"zZOZj7"}),id:"favourites",emptyText:g._({id:"PHIrMr"}),errorText:g._({id:"khVljG"}),instance:n,fetchItems:s})}const mr=["home","public","notifications","thread","account"],Gi=["notifications","thread","account"],gr={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},br=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],Hn={0:{id:"qqeAJM"},1800:tt(30,"minute"),3600:tt(1,"hour"),21600:tt(6,"hour"),43200:tt(12,"hour"),86400:tt(24,"hour"),604800:tt(7,"day"),2592e3:tt(30,"day")};function vr(){const{masto:t}=ce();Xe(g._({id:"cSev+j"}),"/ft");const[n,i]=M("default"),[s,o]=M(!1),[a,h]=Mt(l=>l+1,0),[r,c]=M([]);return se(()=>{i("loading"),(async()=>{try{const l=await t.v2.filters.list();l.sort((p,f)=>p.title.localeCompare(f.title)),l.forEach(p=>{var f;(f=p.keywords)!=null&&f.length&&p.keywords.sort((m,d)=>m.id-d.id)}),c(l),i("default")}catch{i("error")}})()},[a]),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(Nt,{}),e(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"cSev+j"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{o(!0)},children:e(S,{icon:"plus",size:"l",alt:g._({id:"yFfBdX"})})})})]})}),e("main",{children:r.length>0?e(U,{children:[e("ul",{class:"filters-list",children:r.map(l=>{const{id:p,title:f,expiresAt:m,keywords:d}=l;return e("li",{children:[e("div",{children:[e("h2",{children:f}),(d==null?void 0:d.length)>0&&e("div",{children:d.map(v=>e(U,{children:[e("span",{class:"tag collapsed insignificant",children:v.wholeWord?`โ€œ${v.keyword}โ€`:v.keyword})," "]}))}),e("small",{class:"insignificant",children:e(Fs,{expiresAt:m})})]}),e("button",{type:"button",class:"plain",onClick:()=>{o({filter:l})},children:e(S,{icon:"pencil",size:"l",alt:"Edit filter"})})]},p)})}),r.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(u,{id:"5vzJxv",values:{0:r.length}})})})]}):n==="loading"?e("p",{class:"ui-state",children:e(Pe,{})}):n==="error"?e("p",{class:"ui-state",children:e(u,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(u,{id:"cWIHTt"})})})]}),!!s&&e(Fe,{title:g._({id:"vCSBPD"}),onClose:()=>{o(!1)},children:e(kr,{filter:s==null?void 0:s.filter,onClose:l=>{l.state==="success"&&h(),o(!1)}})})]})}let yr=1;const wr=()=>yr++;function kr({filter:t,onClose:n}){const{_:i}=Qe(),{masto:s}=ce(),[o,a]=M("default"),h=!!t,{context:r,expiresAt:c,id:l,keywords:p,title:f,filterAction:m}=t||{},d=!!c,v=d&&new Date(c),[b,y]=M(p||[]),w=Y(),[k,C]=M([]),[I,T]=M([]),_=b.filter(x=>!k.includes(x.id)&&!I.includes(x._id));return e("div",{class:"sheet",id:"filters-add-edit-modal",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:h?g._({id:"3mOee6"}):g._({id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:x=>{x.preventDefault();const $=new FormData(x.target),D=$.get("title"),L=$.getAll("keyword_attributes[][id]"),q=$.getAll("keyword_attributes[][keyword]"),V=[...w.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(N=>N.checked),W=q.map((N,P)=>({id:L[P]||void 0,keyword:N,wholeWord:V[P]}));h&&(k!=null&&k.length)&&k.forEach(N=>{W.push({id:N,_destroy:!0})});const Z=$.getAll("context");let F=$.get("expires_in");const H=$.get("filter_action");!D||!(Z!=null&&Z.length)||(a("loading"),(async()=>{try{let N;h?(F===""||F===null?d?F=Math.floor((v-new Date)/1e3):F=null:F==="0"||F===0?F=null:F=+F,N=await s.v2.filters.$select(l).update({title:D,context:Z,expiresIn:F,keywordsAttributes:W,filterAction:H})):(F=+F||null,N=await s.v2.filters.create({title:D,context:Z,expiresIn:F,keywordsAttributes:W,filterAction:H})),a("default"),n==null||n({state:"success",filter:N})}catch{a("error"),alert(h?g._({id:"H8RP+h"}):g._({id:"Fr0hAN"}))}})())},children:[e("div",{class:"filter-form-row",children:e("label",{children:[e("b",{children:e(u,{id:"MHrjPM"})}),e("input",{type:"text",name:"title",defaultValue:f,disabled:o==="loading",dir:"auto",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:w,children:[_.length?e("ul",{class:"filter-keywords",children:_.map(x=>{const{id:$,keyword:D,wholeWord:L,_id:q}=x;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:$}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:D,disabled:o==="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:$,defaultChecked:L,disabled:o==="loading"})," ",e(u,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:o==="loading",onClick:()=>{$?(k.push($),C([...k])):q&&(I.push(q),T([...I]))},children:e(S,{icon:"x",alt:g._({id:"t/YqKh"})})})]})]},`${$}-${q}`)})}):e("div",{class:"filter-keywords",children:e("div",{class:"insignificant",children:e(u,{id:"SYKm3p"})})}),e("footer",{class:"filter-keywords-footer",children:[e("button",{type:"button",class:"light",onClick:()=>{y([...b,{_id:wr(),keyword:"",wholeWord:!0}]),setTimeout(()=>{var $,D;const x=w.current.querySelectorAll('input[type="text"]');(D=($=x[x.length-1])==null?void 0:$.focus)==null||D.call($)},10)},children:e(u,{id:"qn5Dbn"})})," ",(_==null?void 0:_.length)>1&&e("small",{class:"insignificant",children:e(u,{id:"1JZ175",values:{0:_.length}})})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:e(u,{id:"uqf7Yq"})})}),mr.map(x=>e("div",{children:[e("label",{class:Gi.includes(x)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:x,defaultChecked:r?r.includes(x):!0,disabled:o==="loading"})," ",i(gr[x]),Gi.includes(x)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(u,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[h&&e(u,{id:"ucJk3m",components:{0:e("b",{}),1:e(Fs,{expiresAt:c,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:h?g._({id:"BcNdg+"}):g._({id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:o==="loading",defaultValue:h?void 0:0,children:[h&&e("option",{}),br.map(x=>e("option",{value:x,children:typeof Hn[x]=="function"?Hn[x]():i(Hn[x])}))]})]}),e("p",{children:[e(u,{id:"blQMpa"}),e("br",{}),e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:m==="warn"||!h,disabled:o==="loading"})," ",e(u,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:m==="hide",disabled:o==="loading"})," ",e(u,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:o==="loading",children:h?g._({id:"tfDRzk"}):g._({id:"hYgDIe"})})," ",e(Pe,{abrupt:!0,hidden:o!=="loading"})]}),h&&e(lt,{disabled:o==="loading",align:"end",menuItemClassName:"danger",confirmLabel:g._({id:"BPjyR2"}),onClick:()=>{a("loading"),(async()=>{try{await s.v2.filters.$select(l).remove(),a("default"),n==null||n({state:"success"})}catch{a("error"),alert(g._({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:o==="loading",children:e(u,{id:"Jb6/SB"})})})]})]})})]})}function Fs({expiresAt:t,showNeverExpires:n}){const i=!!t,s=i&&new Date(t),o=i&&s<=new Date,[a,h]=Mt(r=>r+1,0);return ii(h,o||3e4),o?g._({id:"M1RnFv"}):i?e(u,{id:"urGtsw",components:{0:e(Gt,{datetime:s})}}):n&&g._({id:"O1Aswy"})}function _r(){const{masto:t,instance:n}=ce();Xe(g._({id:"Xi1/bw"}),"/fh");const[i,s]=M("default"),[o,a]=M([]);return se(()=>{s("loading"),(async()=>{try{const h=await Cn();a(h),s("default")}catch{s("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(Nt,{}),e(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"Xi1/bw"})}),e("div",{class:"header-side"})]})}),e("main",{children:o.length>0?e(U,{children:[e("ul",{class:"link-list",children:o.map(h=>e("li",{children:e(ue,{to:n?`/${n}/t/${h.name}`:`/t/${h.name}`,children:[e(S,{icon:"hashtag",alt:"#"})," ",e("span",{children:h.name})]})}))}),o.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(u,{id:"2S/uvJ",values:{0:o.length}})})})]}):i==="loading"?e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}):i==="error"?e("p",{class:"ui-state",children:e(u,{id:"2AeREO"})}):e("p",{class:"ui-state",children:e(u,{id:"vKsGhk"})})})]})})}const Sr=20;function wi({title:t,path:n,id:i,...s}){Xe(t||g._({id:"following.title"}),n||"/following");const{masto:o,streaming:a,instance:h}=ce(),r=qe(A),c=Y(),l=Y();__BENCHMARK.end("time-to-following");const p=Ze("@pixelfed/home-include-reblogs");async function f(d){var y;(d||!c.current)&&(__BENCHMARK.start("fetch-home-first"),c.current=o.v1.timelines.home.list({limit:Sr})),p&&((y=c.current)!=null&&y.nextParams)&&(typeof c.current.nextParams=="string"?c.current.nextParams+="&include_reblogs=true":c.current.nextParams.include_reblogs=!0);const v=await c.current.next();let{value:b}=v;if(b!=null&&b.length){let w=!1;d&&(b[0].id!==l.current&&(w=!0),l.current=b[0].id),b.forEach(k=>{We(k,h)}),b=qi(b,h),d&&w&&Ua(),zs(b,h),b.sort((k,C)=>{const I=new Date(k.createdAt);return new Date(C.createdAt)-I})}return __BENCHMARK.end("fetch-home-first"),{...v,value:b}}async function m(){var d;try{const v={limit:5,since_id:l.current};Ze("@pixelfed/home-include-reblogs")&&(v.include_reblogs=!0);const b=await o.v1.timelines.home.list(v).next();let{value:y}=b;const w=((d=y[0])==null?void 0:d.id)===l.current;return!!(y!=null&&y.length&&!w&&(l.current=y[0].id,y=qi(y,h),y=Rt(y,"home"),y.some(k=>!k.reblog)))}catch{return!1}}return se(()=>{let d;return(async()=>{if(a){d=a.user.subscribe();for await(const v of d){if(!d)break;if(v.event==="status.update"){const b=v.payload;We(b,h)}else if(v.event==="delete"){const b=v.payload,y=ds(b,h);y&&(y._deleted=!0)}}}})(),()=>{var v;(v=d==null?void 0:d.unsubscribe)==null||v.call(d),d=null}},[a]),e(St,{title:t||g._({id:"following.title"}),id:i||"following",emptyText:g._({id:"nJEKbY"}),errorText:g._({id:"7QSeK6"}),instance:h,fetchItems:f,checkForUpdates:m,useItemID:!0,boostsCarousel:r.settings.boostsCarousel,...s,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Cr=20,Ir=4,Ki=Ir+1;function Hs({media:t,columnMode:n,...i}){let{hashtag:s,...o}=n?{}:$t();i.hashtag&&(s=i.hashtag);let a=s.trim().split(/[\s+]+/);a.sort(),s=a[0];const[h,r]=ft(),c=t||!!h.get("media"),l=c?"?media=1":"",{masto:p,instance:f,authenticated:m}=ce({instance:(i==null?void 0:i.instance)||o.instance}),{masto:d,instance:v,authenticated:b}=ce(),y=a.map(P=>`#${P}`).join(" "),w=f?c?g._({id:"kH0rA0",values:{hashtagTitle:y,instance:f}}):g._({id:"IK0zKi",values:{hashtagTitle:y,instance:f}}):c?g._({id:"hHSI3w",values:{hashtagTitle:y}}):g._({id:"+ZzjRY",values:{hashtagTitle:y}});Xe(w,"/:instance?/t/:hashtag");const k=Y(),C=ke(()=>ti(),[]),I=Y(void 0);async function T(P){const j=await p.v1.timelines.tag.$select(s).list({limit:Cr,any:a.slice(1),maxId:P?void 0:I.current,onlyMedia:c?!0:void 0}).next();let{value:B}=j;return B!=null&&B.length&&(P&&(k.current=B[0].id),B.forEach(ee=>{We(ee,f,{skipThreading:c||C})}),I.current=B[B.length-1].id),{...j,value:B}}async function _(){var P;try{const j=await p.v1.timelines.tag.$select(s).list({limit:1,any:a.slice(1),since_id:k.current,onlyMedia:c}).next();let{value:B}=j;const ee=((P=B[0])==null?void 0:P.id)===k.current;return B!=null&&B.length&&!ee?(B=Rt(B,"public"),!0):!1}catch{return!1}}const[x,$]=M("default"),[D,L]=M();se(()=>{(async()=>{try{const P=await p.v1.tags.$select(s).fetch();L(P)}catch{}})()},[s]);const q=a.length>=Ki,[V,W]=M("default"),[Z,F]=M([]),[H,N]=M(!1);return se(()=>{m&&(async()=>{try{const P=await p.v1.featuredTags.list();F(P),N(P.some(j=>j.name.toLowerCase()===s.toLowerCase()))}catch{}})()},[]),e(St,{title:w,titleComponent:!!f&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:y}),e("div",{children:f})]}),id:"hashtag",instance:f,emptyText:g._({id:"CNSLAW"}),errorText:g._({id:"yjj6Ll"}),fetchItems:T,checkForUpdates:_,useItemID:!0,view:c||C?"media":void 0,refresh:c,filterContext:"public",headerEnd:e(at,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[!!D&&a.length===1&&e(U,{children:[e(lt,{subMenu:!0,confirm:D.following,confirmLabel:g._({id:"ctJi7k",values:{hashtag:s}}),disabled:x==="loading"||!m,onClick:()=>{$("loading"),D.following?p.v1.tags.$select(s).unfollow().then(()=>{L({...D,following:!1}),de(g._({id:"doK/ij",values:{hashtag:s}}))}).catch(P=>{alert(P)}).finally(()=>{$("default")}):p.v1.tags.$select(s).follow().then(()=>{L({...D,following:!0}),de(g._({id:"R9+aEN",values:{hashtag:s}}))}).catch(P=>{alert(P)}).finally(()=>{$("default")})},children:D.following?e(U,{children:[e(S,{icon:"check-circle"})," ",e("span",{children:e(u,{id:"HOSk7R"})})]}):e(U,{children:[e(S,{icon:"plus"})," ",e("span",{children:e(u,{id:"MKEPCY"})})]})}),e(we,{type:"checkbox",checked:H,disabled:V==="loading"||!m,onClick:()=>{if(W("loading"),H){const P=Z.find(j=>j.name.toLowerCase()===s.toLowerCase()).id;P?p.v1.featuredTags.$select(P).remove().then(()=>{N(!1),de(g._({id:"VH+Tf9"})),F(Z.filter(j=>j.id!==P))}).catch(j=>{}).finally(()=>{W("default")}):de(g._({id:"3OLv47"}))}else p.v1.featuredTags.create({name:s}).then(P=>{N(!0),de(g._({id:"9ra4hn"})),F(Z.concat(P))}).catch(P=>{}).finally(()=>{W("default")})},children:H?e(U,{children:[e(S,{icon:"check-circle"}),e("span",{children:e(u,{id:"9ra4hn"})})]}):e(U,{children:[e(S,{icon:"check-circle"}),e("span",{children:e(u,{id:"UlJ3QN"})})]})}),e(Ge,{})]}),!C&&e(U,{children:[e(ys,{className:"plain",children:e(u,{id:"cSev+j"})}),e(we,{type:"checkbox",checked:!!c,onClick:()=>{c?h.delete("media"):h.set("media","1"),r(h)},children:[e(S,{icon:"check-circle",alt:"โ˜‘๏ธ"})," ",e("span",{class:"menu-grow",children:e(u,{id:"eK4SL/"})})]}),e(Ge,{})]}),e(Fo,{className:"menu-field",disabled:q,children:({ref:P})=>e("form",{onSubmit:j=>{var ee,ge;j.preventDefault();const B=(ge=(ee=j.target[0].value)==null?void 0:ee.trim)==null?void 0:ge.call(ee);B&&!a.some(ie=>ie.toLowerCase()===B.toLowerCase())&&(a.push(B),a.sort(),location.hash=f?`/${f}/t/${a.join("+")}`:`/t/${a.join("+")}${l}`)},children:[e(S,{icon:"hashtag"}),e("input",{ref:P,type:"text",placeholder:q?g._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:Ki}}):g._({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:q,dir:"auto"})]})}),e(Ho,{takeOverflow:!0,children:a.map((P,j)=>e(we,{disabled:a.length===1,onClick:B=>{a.splice(j,1),a.sort(),location.hash=f?`/${f}/t/${a.join("+")}${l}`:`/t/${a.join("+")}${l}`},children:[e(S,{icon:"x",alt:g._({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),P]})]},P))}),e(Ge,{}),e(we,{disabled:!b,onClick:()=>{if(A.shortcuts.length>=yt){alert(g._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:yt}}));return}const P={type:"hashtag",hashtag:a.join(" "),instance:f,media:c?"on":void 0};A.shortcuts.some(B=>B.type===P.type&&B.hashtag.split(/[\s+]+/).sort().join(" ")===P.hashtag.split(/[\s+]+/).sort().join(" ")&&(B.instance?B.instance===P.instance:!0)&&(B.media?!!B.media==!!P.media:!0))?alert(g._({id:"kfeQnS"})):(A.shortcuts.push(P),de(g._({id:"MIhb91"})))},children:[e(S,{icon:"shortcut"})," ",e("span",{children:e(u,{id:"i02Lq/"})})]}),e(we,{onClick:()=>{let P=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(P)){P&&alert(g._({id:"7WddtO"}));return}P&&(P=P.toLowerCase().trim(),location.hash=`/${P}/t/${a.join("+")}${l}`)},children:[e(S,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),v!==f&&e(we,{onClick:()=>{location.hash=`/${v}/t/${a.join("+")}${l}`},children:[e(S,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:v},components:{0:e("b",{})}})})]})]})},f+y)}const Tr=20;function qs(t){var w;const n=qe(A),{masto:i,instance:s}=ce(),o=(t==null?void 0:t.id)||((w=$t())==null?void 0:w.id),a=Y(),h=Y();async function r(k){(k||!h.current)&&(h.current=i.v1.timelines.list.$select(o).list({limit:Tr}));const C=await h.current.next();let{value:I}=C;return I!=null&&I.length&&(k&&(a.current=I[0].id),I.forEach(T=>{We(T,s)})),{...C,value:I}}async function c(){var k;try{const C=await i.v1.timelines.list.$select(o).list({limit:1,since_id:a.current});let{value:I}=C;const T=((k=I[0])==null?void 0:k.id)===a.current;return I!=null&&I.length&&!T?(I=Rt(I,"home"),!0):!1}catch{return!1}}const[l,p]=M([]);se(()=>{on().then(p)},[]);const[f,m]=M({title:"List"});Xe(f.title,"/l/:id"),se(()=>{(async()=>{try{const k=await Rs(o);m(k)}catch{}})()},[o]);const[d,v]=M(!1),[b,y]=M(!1);return e(U,{children:[e(St,{title:f.title,id:"list",emptyText:g._({id:"KkDhfU"}),errorText:g._({id:"7QSeK6"}),instance:s,fetchItems:r,checkForUpdates:c,useItemID:!0,boostsCarousel:n.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(at,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(S,{icon:"list",size:"l",alt:g._({id:"h16FyT"})}),e(S,{icon:"chevron-down",size:"s"})]}),children:[e(Be,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),(l==null?void 0:l.length)>0&&e(U,{children:[e(Ge,{}),l.map(k=>e(Be,{to:`/l/${k.id}`,children:e("span",{children:k.title})},k.id))]})]}),headerEnd:e(at,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(we,{onClick:()=>v({list:f}),children:[e(S,{icon:"pencil",size:"l"}),e("span",{children:e(u,{id:"ePK91l"})})]}),e(we,{onClick:()=>y(!0),children:[e(S,{icon:"group",size:"l"}),e("span",{children:e(u,{id:"hB02vO"})})]})]})},o),d&&e(Fe,{onClick:k=>{k.target===k.currentTarget&&v(!1)},children:e(mi,{list:d==null?void 0:d.list,onClose:k=>{k.state==="success"&&k.list?m(k.list):k.state==="deleted"&&(location.hash="/l"),v(!1)}})}),b&&e(Fe,{onClick:k=>{k.target===k.currentTarget&&y(!1)},children:e(Ar,{listID:o,onClose:()=>y(!1)})})]})}const xr=40;function Ar({listID:t,onClose:n}){const{masto:i,instance:s}=ce(),[o,a]=M([]),[h,r]=M("default"),[c,l]=M(!1),p=Y();async function f(m){l(!1),r("loading"),(async()=>{try{(m||!p.current)&&(p.current=i.v1.lists.$select(t).accounts.list({limit:xr}));const d=await p.current.next();let{done:v,value:b}=d;b!=null&&b.length?(a(m?b:o.concat(b)),l(!v)):l(!1),r("default")}catch{r("error")}})()}return se(()=>{f(!0)},[]),e("div",{class:"sheet",id:"list-manage-members-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[o.map(m=>e("li",{children:[e(rt,{account:m,instance:s}),e(Er,{account:m,listID:t})]},m.id)),c&&h==="default"&&e(kt,{as:"li",onChange:m=>m&&f(),children:e("button",{type:"button",class:"light block",onClick:f,children:e(u,{id:"uXRAkV"})})})]})})]})}function Er({account:t,listID:n}){const{masto:i}=ce(),[s,o]=M("default"),[a,h]=M(!1);return e(lt,{confirm:!a,confirmLabel:e("span",{children:e(u,{id:"j5n9Ry",values:{0:t.username},components:{0:e("span",{class:"bidi-isolate"})}})}),align:"end",menuItemClassName:"danger",onClick:()=>{a?(o("loading"),(async()=>{try{await i.v1.lists.$select(n).accounts.create({accountIds:[t.id]}),o("default"),h(!1)}catch{o("error")}})()):(o("loading"),(async()=>{try{await i.v1.lists.$select(n).accounts.remove({accountIds:[t.id]}),o("default"),h(!0)}catch{o("error")}})())},children:e("button",{type:"button",class:`light ${a?"":"danger"}`,disabled:s==="loading",children:a?g._({id:"m16xKo"}):g._({id:"MWIaew"})})})}const Rr={mention:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]},Lr=["favourite","reblog","follow"],Ys=t=>Lr.includes(t);function js(t){return t.filter(n=>{const{type:i,id:s,createdAt:o}=n;if(!i)return!1;const a=Rr[i];return a!=null&&a.length?a.every(h=>!!n[h]):!0})}function Vs(t){if(t!=null&&t.notificationGroups){const{accounts:n=[],notificationGroups:i=[],statuses:s=[]}=t;return i.map(o=>{const{sampleAccountIds:a,statusId:h}=o,r=(a==null?void 0:a.map(l=>n.find(p=>p.id===l)))||[],c=(s==null?void 0:s.find(l=>l.id===h))||null;return{...o,sampleAccounts:r,status:c}})}return t}function Mr(t){const n=t.map(h=>{const{latestPageNotificationAt:r,mostRecentNotificationId:c,sampleAccounts:l,notificationsCount:p}=h;return{id:""+c,createdAt:r,account:l[0],...h}}),i={},s=[];for(let h=0;h0&&(m==null||m.length),(c==="favourite"||c==="reblog")&&(b="favourite+reblog");const y=`${l==null?void 0:l.id}-${b}-${v}`,w=i[y];if(!Ys(c))s.push(r);else if(w)m.forEach(k=>{const C=w.sampleAccounts.find(I=>I.id===k.id);C?(C._types.push(c),C._types.sort().reverse()):w.sampleAccounts.push({...k,_types:[c]})}),w.notificationsCount=Math.min(w.notificationsCount,f),w._notificationsCount.push(f),w._accounts=w.sampleAccounts,w._groupKeys.push(d);else{const k=m.map(C=>({...C,_types:[c]}));i[y]={...r,sampleAccounts:k,type:b,_accounts:k,_groupKeys:d?[d]:[],_notificationsCount:[f]},s.push(i[y])}}const o={},a=[];for(let h=0;hk.id===p.id);w?(w._types.push(f),w._types.sort().reverse(),y._ids+=`-${c}`):(p._types=[f],y._accounts.push(p),y._ids+=`-${c}`)}else{p&&(p._types=[f]);let w=n[b]={...r,type:v,_ids:c,_accounts:p?[p]:[]};i[h++]=w}}const s={},o=[];for(let a=0,h=0;a{We(I,s)})),{...k,value:C==null?void 0:C.map(I=>I.status)}}const f=Y(),m=Y();async function d(w){(w||!f.current)&&(f.current=i.v1.conversations.list({limit:Wi}));const k=await f.current.next();let{value:C}=k;return C=C==null?void 0:C.filter(I=>I.lastStatus),C!=null&&C.length&&(w&&(m.current=C[0].lastStatus.id),C.forEach(({lastStatus:I})=>{We(I,s)})),{...k,value:C==null?void 0:C.map(I=>I.lastStatus)}}function v(...w){return r==="private"?d(...w):p(...w)}async function b(){var w;if(r==="private")try{const k=await i.v1.conversations.list({limit:1,since_id:m.current}).next();let{value:C}=k;const I=((w=C[0])==null?void 0:w.id)===m.current;return C!=null&&C.length&&!I?(m.current=C[0].lastStatus.id,!0):!1}catch{return!1}else try{const k=await i.v1.notifications.list({limit:1,types:["mention"],since_id:l.current}).next();let{value:C}=k;return C!=null&&C.length?(l.current=C[0].id,!0):!1}catch{return!1}}const y=ke(()=>e("div",{class:"filter-bar centered",children:[e(ue,{to:"/mentions",class:r?"":"is-active",onClick:w=>{t&&(w.preventDefault(),h(null))},children:e(u,{id:"N40H+G"})}),e(ue,{to:"/mentions?type=private",class:r==="private"?"is-active":"",onClick:w=>{t&&(w.preventDefault(),h("private"))},children:e(u,{id:"zwBp5t"})})]}),[r]);return e(St,{title:g._({id:"/bZzdR"}),id:"mentions",emptyText:g._({id:"03jFGT"}),errorText:g._({id:"pqR9KF"}),instance:s,fetchItems:v,checkForUpdates:b,useItemID:!0,timelineStart:y,refresh:r})}const Nr=80,Pr=20,Or=new URLSearchParams,rn={block:"center",inline:"center",behavior:"smooth"},Ks=ls(()=>Ze("@mastodon/grouped-notifications"),{maxAge:1e3*60*5});function Ws(t={}){const{masto:n}=ce();return A.settings.groupedNotificationsAlpha&&Ks()?n.v2.notifications.list({limit:Pr,...t}):n.v1.notifications.list({limit:Nr,...t})}function Zs(t){return A.settings.groupedNotificationsAlpha&&Ks()?Mr(t):$r(t)}const zr=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],Ur={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function Br({columnMode:t}){var O;const{_:n}=Qe();Xe(g._({id:"iDNBZe"}),"/notifications");const{masto:i,instance:s}=ce(),o=qe(A),[a,h]=M("default"),[r]=t?[Or]:ft(),c=r.get("id"),l=r.get("access_token"),[p,f]=M(!1),[m,d]=M(!1),v=Y(),{nearReachEnd:b,scrollDirection:y,reachStart:w,nearReachStart:k}=Ba({scrollableRef:v}),C=y==="end"&&!k,[I,T]=M([]),[_,x]=M([]),$=Y();async function D(E){var ye;if((E||!$.current)&&($.current=Ws({excludeTypes:["follow_request"]})),/max_id=($|&)/i.test((ye=$.current)==null?void 0:ye.nextParams))return{done:!0};const z=await $.current.next(),re=Vs(z.value);if(re!=null&&re.length){re.forEach(J=>{We(J.status,s,{skipThreading:!0})});const Ie=Zs(re);E?(A.notificationsLast=Ie[0],A.notifications=Ie,i.v1.markers.create({notifications:{lastReadId:Ie[0].id}}).catch(()=>{})):A.notifications.push(...Ie)}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),z}async function L(){try{return await i.v1.followRequests.list({limit:80})}catch{return[]}}const q=()=>{h("loading"),(async()=>{try{const E=await L();T(E),h("default")}catch{h("error")}})()};async function V(){try{return await i.v1.announcements.list()}catch{return[]}}const W=Ze("@mastodon/filtered-notifications"),[Z,F]=M(!1),[H,N]=M({});function P(){return i.v2.notifications.policy.fetch().catch(()=>{})}function j(){P().then(E=>{N(E)}).catch(()=>{})}const[B,ee]=M(null);function ge(){return i.v1.notifications.requests.list()}const ie=E=>{_e(!1),h("loading"),(async()=>{try{const z=D(E);E&&(V().then(ye=>{ye.sort((Ie,J)=>{const Me=new Date(Ie.updatedAt||Ie.createdAt);return new Date(J.updatedAt||J.createdAt)-Me}),x(ye)}).catch(()=>{}),L().then(ye=>{T(ye)}).catch(()=>{}),W&&j());const{done:re}=await z;f(!re),h("default")}catch{h("error")}})()};se(()=>{ie(!0)},[]),se(()=>{w&&ie(!0)},[w]);const[be,_e]=M(!1),G=ct(({disableIdleCheck:E=!1}={})=>{var z;a!=="loading"&&o.settings.autoRefresh&&((z=v.current)==null?void 0:z.scrollTop)<16&&(E||window.__IDLE__)&&!Fr()&&ie(!0)},[o.notificationsShowNew,o.settings.autoRefresh,a]),ae=Y();Ht(E=>{if(E){const z=Date.now()-ae.current;!ae.current||z>1e3*3?G({disableIdleCheck:!0}):ae.current=Date.now()}});const Ce=Y(!0);se(()=>{let E=vo(A,"notificationsShowNew",z=>{if(Ce.current){Ce.current=!1;return}a!=="loading"&&(z&&G(),_e(z))});return()=>E==null?void 0:E()},[]);const Ee=new Date,Re=new Date(Ee-24*60*60*1e3);let Le=new Date;const Ne=!o.notifications.some(E=>new Date(E.createdAt).toDateString()===Ee.toDateString()),ve=Y();se(()=>{c&&(A.routeNotification={id:c,accessToken:atob(l)})},[c,l]);const te=".notification",pe=Ue("j",()=>{const E=document.activeElement.closest(te),z=E==null?void 0:E.getBoundingClientRect(),re=Array.from(v.current.querySelectorAll(te));if(E&&z.top0){const ye=re.indexOf(E);let Ie=re[ye+1];Ie&&(Ie.focus(),Ie.scrollIntoView(rn))}else{const ye=re.find(Ie=>{const J=Ie.getBoundingClientRect();return J.top>=44&&J.left>=0});ye&&(ye.focus(),ye.scrollIntoView(rn))}}),xe=Ue("k",()=>{const E=document.activeElement.closest(te),z=E==null?void 0:E.getBoundingClientRect(),re=Array.from(v.current.querySelectorAll(te));if(E&&z.top0){const ye=re.indexOf(E);let Ie=re[ye-1];Ie&&(Ie.focus(),Ie.scrollIntoView(rn))}else{const ye=re.find(Ie=>{const J=Ie.getBoundingClientRect();return J.top>=44&&J.left>=0});ye&&(ye.focus(),ye.scrollIntoView(rn))}}),le=Ue(["enter","o"],()=>{const E=document.activeElement.closest(te),z=E==null?void 0:E.querySelector(".status-link");z&&z.click()}),X=new Date,fe=ke(()=>ht(X,{forceOpts:{weekday:"long"}}),[X]);return e("div",{id:"notifications-page",class:"deck-container",ref:E=>{v.current=E,pe(E),xe(E),le(E)},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${m?"only-mentions":""}`,children:[e("header",{hidden:C,onClick:E=>{var z;E.target.closest("a, button")||(z=v.current)==null||z.scrollTo({top:0,behavior:"smooth"})},onDblClick:E=>{E.target.closest("a, button")||ie(!0)},class:a==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),e(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"iDNBZe"})}),e("div",{class:"header-side",children:W&&e("button",{type:"button",class:"button plain4",onClick:()=>{F(!0)},children:e(S,{icon:"settings",size:"l",alt:g._({id:"a/+arl"})})})})]}),be&&a!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{var E;ie(!0),(E=v.current)==null||E.scrollTo({top:0,behavior:"smooth"})},children:[e(S,{icon:"arrow-up"})," ",e(u,{id:"Jy9RU/"})]})]}),_.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(S,{icon:"announce",class:"announcement-icon",size:"l"})," ",e(u,{id:"0whvLM",values:{0:_.length}})," ",e("small",{class:"insignificant",children:s})]}),_.length>1&&e("span",{class:"announcements-nav-buttons",children:_.map((E,z)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{var re;(re=ve.current)==null||re.children[z].scrollIntoView({behavior:"smooth",block:"nearest"})},children:z+1}))})]}),e("ul",{class:`announcements-list-${_.length>1?"multiple":"single"}`,ref:ve,children:_.map(E=>e("li",{children:e(Hr,{announcement:E})}))})]})})}),I.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(u,{id:"6Fs1Ba"})}),I.length>5?e("details",{children:[e("summary",{children:e(u,{id:"7dHKu4",values:{0:I.length}})}),e("ul",{children:I.map(E=>e("li",{children:[e(rt,{account:E}),e(Zn,{accountID:E.id,onChange:()=>{}})]},E.id))})]}):e("ul",{children:I.map(E=>e("li",{children:[e(rt,{account:E}),e(Zn,{accountID:E.id,onChange:()=>{}})]},E.id))})]}),W&&((O=H==null?void 0:H.summary)==null?void 0:O.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 E=>{const{open:z}=E.target;if(z){const re=await ge();ee(re)}},children:[e("summary",{children:e(u,{id:"N3Bq0f",values:{0:H.summary.pendingRequestsCount}})}),B?(B==null?void 0:B.length)>0&&e("ul",{children:B.map(E=>{var z,re;return e("li",{children:[e("div",{class:"request-notifcations",children:[!((z=E.lastStatus)!=null&&z.id)&&e(rt,{useAvatarStatic:!0,showStats:!0,account:E.account}),((re=E.lastStatus)==null?void 0:re.id)&&e("div",{class:"last-post",children:e(ue,{class:"status-link",to:`/${s}/s/${E.lastStatus.id}`,children:e(Ye,{status:E.lastStatus,size:"s",readOnly:!0})})}),e(Yr,{request:E})]}),e(jr,{request:E,onChange:()=>{ie(!0)}})]},E.id)})}):e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})})]})})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:m,onChange:E=>{d(E.target.checked)}})," ",e(u,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:[e(u,{id:"ecUA8p"})," ",e("small",{class:"insignificant bidi-isolate",children:fe})]}),Ne&&e("p",{class:"ui-state insignificant",children:a==="default"?g._({id:"KS7iJH"}):e(U,{children:"โ€ฆ"})}),o.notifications.length?e(U,{children:o.notifications.filter(E=>E.type!=="follow_request").map(E=>{if(m&&E.type!=="mention")return null;const z=new Date(E.createdAt),re=z.toDateString()!==Le.toDateString();re&&(Le=z);const ye=z.toDateString()===Re.toDateString()?g._({id:"y/0uwd"}):ht(Le,{hideTime:!0}),Ie=ht(Le,{forceOpts:{weekday:"long"}});return e(U,{children:[re&&e("h2",{class:"timeline-header",children:[e("span",{children:ye})," ",e("small",{class:"insignificant bidi-isolate",children:Ie})]}),e(Rn,{instance:s,notification:E},E._ids||E.id)]},E._ids||E.id)})}):e(U,{children:[a==="loading"&&e(U,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((E,z)=>e("li",{class:"notification skeleton",children:[e("div",{class:"notification-type",children:e(S,{icon:"notification",size:"xl"})}),e("div",{class:"notification-content",children:e("p",{children:"โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆ"})})]}))})}),a==="error"&&e("p",{class:"ui-state",children:[e(u,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>ie(!0),children:e(u,{id:"KDw4GX"})})]})]}),p&&e(kt,{onChange:E=>{E&&ie()},children:e("button",{type:"button",class:"plain block",disabled:a==="loading",onClick:()=>ie(),style:{marginBlockEnd:"6em"},children:a==="loading"?e(Pe,{abrupt:!0}):e(u,{id:"uXRAkV"})})})]}),W&&Z&&e(Fe,{onClick:E=>{E.target===E.currentTarget&&F(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>F(!1),children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"a/+arl"})})}),e("main",{children:e("form",{onSubmit:E=>{E.preventDefault();const{forNotFollowing:z,forNotFollowers:re,forNewAccounts:ye,forPrivateMentions:Ie,forLimitedAccounts:J}=E.target,Me={...H,forNotFollowing:z.value,forNotFollowers:re.value,forNewAccounts:ye.value,forPrivateMentions:Ie.value,forLimitedAccounts:J.value};N(Me),F(!1),(async()=>{try{await i.v2.notifications.policy.update(Me),de(g._({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(u,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:zr.map(E=>{const z=H[E];return e("div",{children:e("label",{children:[n(Ur[E]),e("select",{name:E,defaultValue:z,class:"small",children:[e("option",{value:"accept",children:e(u,{id:"g3UF2V"})}),e("option",{value:"filter",children:e(u,{id:"o7J4JM"})}),e("option",{value:"drop",children:e(u,{id:"gbbkE7"})})]})]})},E)})}),e("p",{children:e("button",{type:"submit",children:e(u,{id:"tfDRzk"})})})]})})]})})]})}function Fr(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function Hr({announcement:t}){const{instance:n}=ce(),{contact:i}=cs(),s=i==null?void 0:i.account,{id:o,content:a,startsAt:h,endsAt:r,published:c,allDay:l,publishedAt:p,updatedAt:f,read:m,mentions:d,statuses:v,tags:b,emojis:y,reactions:w}=t,k=new Date(p),C=ht(k),I=new Date(f),T=ht(I);return e("div",{class:"announcement-block",children:[e(rt,{account:s}),e("div",{class:"announcement-content",onClick:hs({mentions:d,instance:n}),dangerouslySetInnerHTML:{__html:jn(a,{emojis:y})}}),e("p",{class:"insignificant",children:[e("time",{datetime:k.toISOString(),children:ht(k)}),f&&T!==C&&e(U,{children:[" ","โ€ข"," ",e("span",{class:"ib",children:e(u,{id:"TbFrLc",values:{0:ht(I)},components:{0:e("time",{datetime:I.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:w.map(_=>{const{name:x,count:$,me:D,staticUrl:L,url:q}=_;return e("button",{type:"button",class:`plain4 small ${D?"reacted":""}`,children:[q||L?e("img",{src:q||L,alt:x,width:"16",height:"16"}):e("span",{children:x})," ",e("span",{class:"count",children:Ke($)})]})})})]})}function qr(t){const{masto:n}=ce();return n.v1.notifications.list({accountID:t})}function Yr({request:t}){var f;const{instance:n}=ce(),[i,s]=M("loading"),{account:o,lastStatus:a}=t,[h,r]=M(!1),[c,l]=M([]);function p(){r(!1)}return se(()=>{var m;(m=t==null?void 0:t.account)!=null&&m.id&&h&&(s("loading"),(async()=>{const d=await qr(t.account.id);l(d||[]),s("default")})())},[h,(f=t==null?void 0:t.account)==null?void 0:f.id]),e(U,{children:[e("button",{type:"button",class:"plain4 request-notifications-account",onClick:()=>{r(!0)},children:[e(S,{icon:"notification",class:"more-insignificant"})," ",e("small",{children:e(u,{id:"H0wUNM",values:{0:o.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(S,{icon:"chevron-down"})]}),h&&e(Fe,{onClick:m=>{m.target===m.currentTarget&&p()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:p,children:e(S,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"MXOmPt",values:{0:o.username},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:i==="loading"?e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}):c.map(m=>e("div",{class:"notification-peek",onClick:d=>{const{target:v}=d;(d.target.tagName==="BUTTON"||d.target.tagName==="A")&&p()},children:e(Rn,{instance:n,notification:m,isStatic:!0})}))})]})})]})}function jr({request:t,onChange:n}){const{masto:i}=ce(),[s,o]=M("default"),[a,h]=M(null),r=a!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:s==="loading"||r,onClick:()=>{o("loading"),(async()=>{try{await i.v1.notifications.requests.$select(t.id).accept(),h("accept"),o("default"),n({request:t,state:"accept"}),de(g._({id:"ZtBMwU",values:{0:t.account.username}}))}catch{o("error"),de(g._({id:"S92JKG"}))}})()},children:e(u,{id:"h7peZQ"})})," ",e("button",{type:"button",disabled:s==="loading"||r,class:"light danger",onClick:()=>{o("loading"),(async()=>{try{await i.v1.notifications.requests.$select(t.id).dismiss(),h("dismiss"),o("default"),n({request:t,state:"dismiss"}),de(g._({id:"ibBDry",values:{0:t.account.username}}))}catch{o("error"),de(g._({id:"S5aemF"}))}})()},children:e(u,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:s==="loading"?e(Pe,{abrupt:!0}):a==="accept"?e(S,{icon:"check-circle",alt:g._({id:"bzMKg7"}),class:"notification-accepted"}):a==="dismiss"&&e(S,{icon:"x-circle",alt:g._({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const Xs=st(Br),Vr=20;function Xn({local:t,columnMode:n,...i}){const s=qe(A),o=!!t,a=n?{}:$t(),{masto:h,instance:r}=ce({instance:(i==null?void 0:i.instance)||a.instance}),{masto:c,instance:l}=ce(),p=o?g._({id:"u96B/B",values:{instance:r}}):g._({id:"PgVqvd",values:{instance:r}});Xe(p,o?"/:instance?/p/l":"/:instance?/p");const f=Y(),m=Y();async function d(b){if(b||!m.current){const k={limit:Vr,local:o||void 0};!o&&Ze("@pixelfed/global-feed")&&(k.remote=!0),m.current=h.v1.timelines.public.list(k)}const y=await m.current.next();let{value:w}=y;return w!=null&&w.length&&(b&&(f.current=w[0].id),w.forEach(k=>{We(k,r)})),{...y,value:w}}async function v(){var b;try{const y=await h.v1.timelines.public.list({limit:1,local:o,since_id:f.current}).next();let{value:w}=y;const k=((b=w[0])==null?void 0:b.id)===f.current;return w!=null&&w.length&&!k?(w=Rt(w,"public"),!0):!1}catch{return!1}}return e(St,{title:p,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:o?g._({id:"pJQgQV"}):g._({id:"cg0I+x"})}),e("div",{children:r})]}),id:"public",instance:r,emptyText:g._({id:"BiZJ6G"}),errorText:g._({id:"scd9lw"}),fetchItems:d,checkForUpdates:v,useItemID:!0,headerStart:e(U,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:"public",headerEnd:e(at,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(we,{href:o?`/#/${r}/p`:`/#/${r}/p/l`,children:o?e(U,{children:[e(S,{icon:"transfer"})," ",e("span",{children:e(u,{id:"dXMiUw"})})]}):e(U,{children:[e(S,{icon:"transfer"})," ",e("span",{children:e(u,{id:"t2B/we"})})]})}),e(Ge,{}),e(we,{onClick:()=>{let b=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(b)){b&&alert(g._({id:"7WddtO"}));return}b&&(b=b.toLowerCase().trim(),location.hash=o?`/${b}/p/l`:`/${b}/p`)},children:[e(S,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),l!==r&&e(we,{onClick:()=>{location.hash=o?`/${l}/p/l`:`/${l}/p`},children:[e(S,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:l},components:{0:e("b",{})}})})]})]})},r+o)}const ln=5,qn=40,Gr=new URLSearchParams,dn={block:"nearest",inline:"center",behavior:"smooth"};function Js({columnMode:t,...n}){const i=t?{}:$t(),{masto:s,instance:o,authenticated:a}=ce({instance:i.instance}),[h,r]=M("default"),[c]=t?[Gr]:ft(),l=Y(),p=(n==null?void 0:n.query)||c.get("q"),f=t?"statuses":(n==null?void 0:n.type)||c.get("type");let m=g._({id:"A1taO8"});if(p)switch(f){case"statuses":m=g._({id:"6YeoAt",values:{q:p}});break;case"accounts":m=g._({id:"fpgumQ",values:{q:p}});break;case"hashtags":m=g._({id:"AuiMZZ",values:{q:p}});break;default:m=g._({id:"wr3GZI",values:{q:p}})}Xe(m,"/search");const[d,v]=M(!1),b=Y(0);se(()=>{b.current=0},[p,f]);const y=Y();gt(()=>{var N,P;(P=(N=y.current)==null?void 0:N.scrollTo)==null||P.call(N,0,0)},[p,f]);const[w,k]=M([]),[C,I]=M([]),[T,_]=M([]);se(()=>{k([]),I([]),_([])},[p]);const x={statuses:k,accounts:I,hashtags:_},[$,D]=M({}),L=async N=>{if(!(N!=null&&N.length))return;const P=await si(N,$);P&&D({...$,...P})};function q(N){N&&(b.current=0),!(!N&&!a)&&(r("loading"),N&&!f&&(k(w.slice(0,ln)),I(C.slice(0,ln)),_(T.slice(0,ln))),(async()=>{var j,B;const P={q:p,resolve:a,limit:ln};f&&(P.limit=qn,P.type=f,a&&(P.offset=b.current));try{const ee=await s.v2.search.fetch(P);if(f)if(N){x[f](ee[f]);const ge=(j=ee[f])==null?void 0:j.length;b.current=qn,v(!!ge)}else{x[f](ie=>[...ie,...ee[f]]);const ge=(B=ee[f])==null?void 0:B.length;b.current=b.current+qn,v(!!ge)}else k(ee.statuses||[]),I(ee.accounts||[]),_(ee.hashtags||[]),b.current=0,v(!1);L(ee.accounts),r("default")}catch{r("error")}})())}const V=Y();Ht(N=>{var j;const P=((j=y.current)==null?void 0:j.scrollTop)===0;if(N&&P){const B=Date.now()-V.current;!V.current||B>1e3*3?q(!0):V.current=Date.now()}}),se(()=>{var N,P,j,B;(P=(N=l.current)==null?void 0:N.setValue)==null||P.call(N,p||""),p?q(!0):(B=(j=l.current)==null?void 0:j.focus)==null||B.call(j)},[p,f,o]),Ue(["/","Slash"],N=>{var P,j,B,ee;(j=(P=l.current)==null?void 0:P.focus)==null||j.call(P),(ee=(B=l.current)==null?void 0:B.select)==null||ee.call(B)},{preventDefault:!0});const W=".timeline > li > a, .hashtag-list > li > a",Z=Ue("j",()=>{const N=document.activeElement.closest(W),P=N==null?void 0:N.getBoundingClientRect(),j=Array.from(y.current.querySelectorAll(W));if(N&&P.top0){const B=j.indexOf(N);let ee=j[B+1];ee&&(ee.focus(),ee.scrollIntoView(dn))}else{const B=j.find(ee=>{const ge=ee.getBoundingClientRect();return ge.top>=44&&ge.left>=0});B&&(B.focus(),B.scrollIntoView(dn))}}),F=Ue("k",()=>{const N=document.activeElement.closest(W),P=N==null?void 0:N.getBoundingClientRect(),j=Array.from(y.current.querySelectorAll(W));if(N&&P.top0){const B=j.indexOf(N);let ee=j[B-1];ee&&(ee.focus(),ee.scrollIntoView(dn))}else{const B=j.find(ee=>{const ge=ee.getBoundingClientRect();return ge.top>=44&&ge.left>=0});B&&(B.focus(),B.scrollIntoView(dn))}}),[H]=ui();return e("div",{id:"search-page",class:"deck-container",tabIndex:"-1",ref:N=>{y.current=N,Z(N),F(N)},children:e("div",{class:"timeline-deck deck",children:[e("header",{class:h==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(Nt,{})}),e(Os,{ref:l}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{q(!0)},disabled:h==="loading",children:e(S,{icon:"search",size:"l",alt:g._({id:"A1taO8"})})})})]})}),e("main",{children:[!!p&&!t&&e("div",{ref:H,class:`filter-bar ${h==="loading"?"loading":""}`,children:[!!f&&e(ue,{to:`/search${p?`?q=${encodeURIComponent(p)}`:""}`,children:[e(S,{icon:"chevron-left"})," ",e(u,{id:"N40H+G"})]}),[{label:g._({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(p)}&type=accounts`},{label:g._({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(p)}&type=hashtags`},{label:g._({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(p)}&type=statuses`}].sort((N,P)=>N.type===f?-1:P.type===f?1:0).map(N=>e(ue,{to:N.to,children:N.label},N.type))]}),p?e(U,{children:[(!f||f==="accounts")&&e(U,{children:[f!=="accounts"&&e("h2",{class:"timeline-header",children:[e(u,{id:"bPwFdf"})," ",e(ue,{to:`/search?q=${encodeURIComponent(p)}&type=accounts`,children:e(S,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),C.length>0?e(U,{children:[e("ul",{class:"timeline flat accounts-list",children:C.map(N=>e("li",{children:e(rt,{account:N,instance:o,showStats:!0,relationship:$[N.id]})},N.id))}),f!=="accounts"&&e("div",{class:"ui-state",children:e(ue,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=accounts`,children:[e(u,{id:"BMmtZ8"})," ",e(S,{icon:"arrow-right"})]})})]}):!f&&(h==="loading"?e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"YYB61U"})}))]}),(!f||f==="hashtags")&&e(U,{children:[f!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(u,{id:"VwUsHI"})," ",e(ue,{to:`/search?q=${encodeURIComponent(p)}&type=hashtags`,children:e(S,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),T.length>0?e(U,{children:[e("ul",{class:"link-list hashtag-list",children:T.map(N=>{var ee;const{name:P,history:j}=N,B=(ee=j==null?void 0:j.reduce)==null?void 0:ee.call(j,(ge,ie)=>ge+ +ie.uses,0);return e("li",{children:e(ue,{to:o?`/${o}/t/${P}`:`/t/${P}`,children:[e(S,{icon:"hashtag",alt:"#"}),e("span",{children:P}),!!B&&e("span",{class:"count",children:Ke(B)})]})},`${P}-${B}`)})}),f!=="hashtags"&&e("div",{class:"ui-state",children:e(ue,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=hashtags`,children:[e(u,{id:"Nc/W5J"})," ",e(S,{icon:"arrow-right"})]})})]}):!f&&(h==="loading"?e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"4MFM3P"})}))]}),(!f||f==="statuses")&&e(U,{children:[f!=="statuses"&&e("h2",{class:"timeline-header",children:[e(u,{id:"+owNNn"})," ",e(ue,{to:`/search?q=${encodeURIComponent(p)}&type=statuses`,children:e(S,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),w.length>0?e(U,{children:[e("ul",{class:"timeline",children:w.map(N=>e("li",{children:e(ue,{class:"status-link",to:o?`/${o}/s/${N.id}`:`/s/${N.id}`,children:e(Ye,{status:N})})},N.id))}),f!=="statuses"&&e("div",{class:"ui-state",children:e(ue,{class:"plain button",to:`/search?q=${encodeURIComponent(p)}&type=statuses`,children:[e(u,{id:"LYCgej"})," ",e(S,{icon:"arrow-right"})]})})]}):!f&&(h==="loading"?e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"Hzi9AA"})}))]}),!!f&&(h==="default"?d?e(kt,{onChange:N=>{N&&q()},children:e("button",{type:"button",class:"plain block",onClick:()=>q(),style:{marginBlockEnd:"6em"},children:e(u,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(u,{id:"2EYeAZ"})}):h==="loading"&&e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}))]}):h==="loading"?e("p",{class:"ui-state",children:e(Pe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"fGn1Hk"})})]})]})})}const Kr=20,Qs=10*60*1e3,Wr=_t(t=>t.v1.trends.links.list().next(),{maxAge:Qs}),Zr=_t(t=>t.v1.trends.tags.list().next(),{maxAge:Qs});function Xr(t){return Ze("@pixelfed/trending")?t.pixelfed.v2.discover.posts.trending.list({range:"daily"}):t.v1.trends.statuses.list({limit:Kr})}function Jr(t,n){return t.v1.timelines.link.list(n)}function eo({columnMode:t,...n}){const i=qe(A),s=t?{}:$t(),{masto:o,instance:a}=ce({instance:(n==null?void 0:n.instance)||s.instance}),{masto:h,instance:r}=ce(),c=g._({id:"cI3UEs",values:{instance:a}});Xe(c,"/:instance?/trending");const l=Y(),p=a===r,[f,m]=M([]),[d,v]=M([]),b=Y();async function y(W){var H;if(W||!b.current){if(b.current=Xr(o),Ze("@mastodon/trending-hashtags"))try{const{value:N}=await Zr(o);N!=null&&N.length&&m(N)}catch{}if(Ze("@mastodon/trending-links"))try{const{value:N}=await Wr(o,a),P=(H=N==null?void 0:N.filter)==null?void 0:H.call(N,j=>j.type==="link");P!=null&&P.length&&v(P)}catch{}}const Z=await b.current.next();let{value:F}=Z;return F!=null&&F.length&&(W&&(l.current=F[0].id),F.forEach(N=>{We(N,a)})),{...Z,value:F}}const[w,k]=M(!1),C=Y(),[I,T]=M(null),_=!!I,x=Y(),$=p&&Ze("@mastodon/trending-link-posts");se(()=>{I&&x.current&&x.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[I]);const D=Y();async function L(W){(W||!C.current)&&(k(!0),C.current=Jr(o,{url:I})),D.current=I;const Z=await C.current.next();let{value:F}=Z;return F!=null&&F.length&&(F=Rt(F,"public"),F.forEach(H=>{We(H,a)})),D.current===I&&k(!1),{...Z,value:F}}async function q(){try{const W=await o.v1.trends.statuses.list({limit:1}).next();let{value:Z}=W;return Z=Rt(Z,"public"),Z!=null&&Z.length&&Z[0].id!==l.current?(l.current=Z[0].id,!0):!1}catch{return!1}}const V=ke(()=>e(U,{children:[!!f.length&&e("div",{class:"filter-bar expandable",children:[e(S,{icon:"chart",class:"insignificant",size:"l"}),f.map((W,Z)=>{const{name:F,history:H}=W,N=H.reduce((P,j)=>P+ +j.uses,0);return e(ue,{to:`/${a}/t/${F}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),F]}),e("span",{class:"filter-count",children:Ke(N)})]},F)})]}),!!d.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(u,{id:"9veeTb"})})}),d.map(W=>{var te,pe;const{authors:Z,authorName:F,authorUrl:H,blurhash:N,description:P,height:j,image:B,imageDescription:ee,language:ge,providerName:ie,providerUrl:be,publishedAt:_e,title:G,url:ae,width:Ce}=W,Ee=(pe=(te=Z==null?void 0:Z[0])==null?void 0:te.account)!=null&&pe.id?Z[0].account:null,Re=G.length<30,Le=!!(F||Ee),Ne=Kt.toUnicode(URL.parse(ae).hostname.replace(/^www\./,"").replace(/\/$/,""));let ve;if(N){const xe=oi(N),le=bi(xe);ve=gi([.6,le[1],le[2]])}return e("div",{children:[e("a",{ref:I===ae?x:null,href:ae,target:"_blank",rel:"noopener noreferrer",class:`link-block ${_?I===ae?"active":"inactive":""}`,style:ve?{"--accent-color":`rgb(${ve.join(",")})`,"--accent-alpha-color":`rgba(${ve.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:B,alt:ee,width:Ce,height:j,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Ne})," ",!!_e&&e(U,{children:"ยท "}),!!_e&&e(U,{children:e(Gt,{datetime:_e,format:"micro"})})]}),!!G&&e("h1",{class:"title",lang:ge,dir:"auto",title:G,children:G})]}),!!P&&e("p",{class:`description ${Le&&!Re?"":"more-lines"}`,lang:ge,dir:"auto",title:P,children:P}),Le&&e(U,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(u,{id:"aavdrC",values:{0:Ee?e(mt,{account:Ee,showAvatar:!0}):H?e("a",{href:H,target:"_blank",rel:"noopener noreferrer",children:F}):F}})})})]})]})]})}),$&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{T(ae)},disabled:ae===I,children:[e(S,{icon:"comment2"})," ",e("span",{children:e(u,{id:"/bZzdR"})})," ",e(S,{icon:"chevron-down"})]})]},ae)})]}),$&&!!d.length&&e("div",{class:`timeline-header-block ${_?"blended":""}`,children:_?e(U,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:w?e(Pe,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{T(null)},children:e(S,{icon:"x",alt:g._({id:"9Q/4xJ"})})})}),e("p",{children:e(u,{id:"BATCqf",values:{0:I.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(u,{id:"Vosm4k"})})})]}),[f,d,I,w]);return e(St,{title:c,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:e(u,{id:"4/iCqx"})}),e("div",{children:a})]}),id:"trending",instance:a,emptyText:g._({id:"6HA9+s"}),errorText:g._({id:"scd9lw"}),fetchItems:_?L:y,checkForUpdates:_?void 0:q,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(U,{}),boostsCarousel:i.settings.boostsCarousel,filterContext:"public",timelineStart:V,refresh:I,clearWhenRefresh:!0,view:_?"link-mentions":void 0,headerEnd:e(at,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(S,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(we,{onClick:()=>{let W=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(W)){W&&alert(g._({id:"7WddtO"}));return}W&&(W=W.toLowerCase().trim(),location.hash=`/${W}/trending`)},children:[e(S,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),r!==a&&e(we,{onClick:()=>{location.hash=`/${r}/trending`},children:[e(S,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:r},components:{0:e("b",{})}})})]})]})},a)}const Zi={block:"nearest",inline:"nearest",behavior:"smooth"};function Qr(){Xe(g._({id:"i0qMbr"}),"/");const t=qe(A),{shortcuts:n}=t,i=n.map(s=>{if(!s)return null;const{type:o,...a}=s,h={following:wi,notifications:Xs,list:qs,public:Xn,bookmarks:Us,favourites:Bs,hashtag:Hs,mentions:Gs,trending:eo,search:Js}[o];return!h||o==="search"&&!a.query||o==="list"&&!a.id?null:e(h,{...a,columnMode:!0},o+JSON.stringify(a))});return Ue(["1","2","3","4","5","6","7","8","9"],(s,o)=>{try{const a=parseInt(o.keys[0],10)-1,h=document.querySelectorAll("#columns > *")[a];h&&(h.focus(),h.scrollIntoView(Zi))}catch{}}),Ue(["[","]"],(s,o)=>{const a=o.keys[0],h=document.activeElement.closest("#columns > *"),r=Et(),c=r?"]":"[",l=r?"[":"]";let p;a===c?p=h?h.previousElementSibling:document.querySelectorAll("#columns > *")[0]:a===l&&(p=h?h.nextElementSibling:document.querySelectorAll("#columns > *")[1]),p&&(p.focus(),p.scrollIntoView(Zi))}),e("div",{id:"columns",onContextMenu:s=>{s.target.closest(".deck > header")&&!s.target.closest("a")&&!s.target.closest("button")&&(s.preventDefault(),A.showShortcutsSettings=!0)},children:i})}function el(){var i;const{_:t}=Qe(),n=qe(A);return __BENCHMARK.end("time-to-home"),se(()=>{(async()=>{const s=await ut.drafts.keys();if(s.length){const o=yn();s.filter(h=>h.startsWith(o)).length&&(A.showDrafts=!0)}})()},[]),e(U,{children:(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&((i=n.shortcuts)!=null&&i.length)?e(Qr,{}):e(wi,{title:t({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(tl,{})})})}function tl(){const t=qe(A),n=Y(),[i,s]=M(void 0);return e(U,{children:[e(ue,{ref:n,to:"/notifications",class:`button plain notifications-button ${t.notificationsShowNew?"has-badge":""} ${i||""}`,onClick:o=>{o.stopPropagation(),window.matchMedia("(min-width: calc(40em))").matches&&(o.preventDefault(),s(a=>a?void 0:"open"))},children:e(S,{icon:"notification",size:"l",alt:g._({id:"iDNBZe"})})}),e(il,{state:i,anchorRef:n,onClose:()=>s(void 0)})]})}const nl=5;function il({anchorRef:t,state:n,onClose:i}){const{masto:s,instance:o}=ce(),a=qe(A),[h,r]=M("default"),c=Ws();async function l(){const b=await c.next(),y=Vs(b.value);if(y!=null&&y.length){y.forEach(k=>{We(k.status,o,{skipThreading:!0})});const w=Zs(y);A.notificationsLast=w[0],A.notifications=w,s.v1.markers.create({notifications:{lastReadId:w[0].id}}).catch(()=>{})}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),b}const[p,f]=M(!1);function m(){return s.v1.followRequests.list({limit:1})}function d(){r("loading"),(async()=>{try{await l();const b=await m();f(!!(b!=null&&b.length)),r("default")}catch{r("error")}})()}se(()=>{n==="open"&&d()},[n]);const v=Y();return e(bs,{ref:v,menuClassName:"notifications-menu",state:n,anchorRef:t,onClose:i,portal:{target:document.body},containerProps:{onClick:()=>{var b,y;(y=(b=v.current)==null?void 0:b.closeMenu)==null||y.call(b)}},overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:"8 8 8 8",children:[e("header",{children:e("h2",{children:e(u,{id:"iDNBZe"})})}),e("main",{children:a.notifications.length?e(U,{children:a.notifications.slice(0,nl).map(b=>e(Rn,{instance:o,notification:b,disableContextMenu:!0},b._ids||b.id))}):h==="loading"?e("div",{class:"ui-state",children:e(Pe,{abrupt:!0})}):h==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(u,{id:"5GFQTh"})}),e("p",{children:e("button",{type:"button",onClick:d,children:e(u,{id:"KDw4GX"})})})]})}),e("footer",{children:[e(ue,{to:"/mentions",class:"button plain",children:[e(S,{icon:"at"})," ",e("span",{children:e(u,{id:"/bZzdR"})})]}),e(ue,{to:"/notifications",class:"button plain2",children:[p?e(u,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(u,{id:"gukqfD"})})," ",e(S,{icon:"arrow-right"})]})]})]})}const sl=st(el),ol=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function to(t){const{hostname:n,pathname:i}=URL.parse(t);for(const s of ol){const[,o]=i.match(s)||[];if(o)return{instance:n,id:o}}return{}}function cl(t){const{instance:n,id:i}=to(t);return n&&i?`/${n}/s/${i}`:null}function al(){const n=Vt().pathname.replace(/^\//,""),i=to(n),s=i!=null&&i.instance?`/${i.instance}/s/${i.id}`:null,[o,a]=M("loading");return gt(()=>{a("loading"),(async()=>{try{const{instance:h,id:r}=i;if(r){const{masto:c}=ce({instance:h});if(await c.v1.statuses.$select(r).fetch()){window.location.hash=s+"?view=full";return}}}catch{}{const{masto:h,instance:r}=ce(),c=await h.v2.search.fetch({q:n,limit:1,resolve:!0});if(c.statuses.length){const l=c.statuses[0];window.location.hash=`/${r}/s/${l.id}?view=full`}else if(c.accounts.length){const l=c.accounts[0];window.location.hash=`/${r}/a/${l.id}`}else s?window.location.hash=s+"?view=full":a("error")}})()},[s]),e("div",{class:"ui-state",tabIndex:"-1",children:[o==="loading"?e(U,{children:[e(Pe,{abrupt:!0}),e("h2",{children:e(u,{id:"RTAr/z"})}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}):e(U,{children:[e("h2",{children:e(u,{id:"ufzZSJ"})}),e("p",{children:e("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:n})})]}),e("hr",{}),e("p",{children:e(ue,{to:"/",children:e(u,{id:"iWpEwy"})})})]})}function rl(){Xe(g._({id:"h16FyT"}),"/l");const[t,n]=M("default"),[i,s]=Mt(c=>c+1,0),[o,a]=M([]);se(()=>{n("loading"),(async()=>{try{const c=await Wn();a(c),n("default")}catch{n("error")}})()},[i]);const[h,r]=M(!1);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(Nt,{}),e(ue,{to:"/",class:"button plain",children:e(S,{icon:"home",size:"l"})})]}),e("h1",{children:e(u,{id:"h16FyT"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>r(!0),children:e(S,{icon:"plus",size:"l",alt:g._({id:"Sb2gYF"})})})})]})}),e("main",{children:o.length>0?e(U,{children:[e("ul",{class:"link-list",children:o.map(c=>e("li",{children:e(ue,{to:`/l/${c.id}`,children:e("span",{children:[e(S,{icon:"list"})," ",e("span",{children:c.title})]})})}))}),o.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(u,{id:"8prZNK",values:{0:o.length}})})})]}):t==="loading"?e("p",{class:"ui-state",children:e(Pe,{})}):t==="error"?e("p",{class:"ui-state",children:e(u,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(u,{id:"IvPikw"})})})]}),h&&e(Fe,{onClick:c=>{c.target===c.currentTarget&&r(!1)},children:e(mi,{list:h==null?void 0:h.list,onClose:c=>{c.state==="success"&&s(),r(!1)}})})]})}const ll=""+new URL("instances-CwO9tuGQ.json",import.meta.url).href;function dl(t){return("0"+t.toString(16)).slice(-2)}function ul(){var t=new Uint32Array(28);return window.crypto.getRandomValues(t),Array.from(t,dl).join("")}function hl(t){const i=new TextEncoder().encode(t);return window.crypto.subtle.digest("SHA-256",i)}function fl(t){let n="";const i=new Uint8Array(t),s=i.byteLength;for(var o=0;o{(async()=>{try{const T=await(await fetch(ll)).json();p(T),f.current=new qo(T)}catch{}})()},[]);const m=I=>{I&&(async()=>{try{const _=await(await fetch(`https://${I}/.well-known/host-meta`)).text(),L=new DOMParser().parseFromString(_,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),q=URL.parse(L),{host:V}=q;I!==V&&(I=V)}catch{}me.local.set("instanceURL",I),s("loading");try{const{client_id:T,client_secret:_,vapid_key:x}=await wl({instanceURL:I});if(await pl({instanceURL:I}))if(T&&_){me.sessionCookie.set("clientID",T),me.sessionCookie.set("clientSecret",_),me.sessionCookie.set("vapidKey",x);const[D,L]=await kl({instanceURL:I,client_id:T});me.sessionCookie.set("codeVerifier",L),location.href=D}else alert(g._({id:"ZP1FIA"}));else T&&_?(me.sessionCookie.set("clientID",T),me.sessionCookie.set("clientSecret",_),me.sessionCookie.set("vapidKey",x),location.href=await _l({instanceURL:I,client_id:T})):alert(g._({id:"ZP1FIA"}));s("default")}catch{s("error")}})()},d=r?r.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,v=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(d)&&!/[\s\/\\@]/.test(d),b=d?(C=(k=f.current)==null?void 0:k.search(d,{limit:10}))==null?void 0:C.map(I=>I.item):[],y=v?d:b!=null&&b.length?b[0]:r?l.find(I=>I.includes(r)):null,w=I=>{I.preventDefault(),m(y)};return h&&se(()=>{m(a||y)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:w,children:[e("h1",{children:[e("img",{src:hi,alt:"",width:"80",height:"80"}),e("br",{}),e(u,{id:"sQia9P"})]}),e("label",{children:[e("p",{children:e(u,{id:"kyAi7k"})}),e("input",{value:r,required:!0,type:"text",class:"large",id:"instanceURL",ref:t,disabled:i==="loading",autocorrect:"off",autocapitalize:"off",autocomplete:"off",spellCheck:!1,placeholder:g._({id:"u3gOdY"}),onInput:I=>{c(I.target.value)},dir:"auto"}),(b==null?void 0:b.length)>0?e("ul",{id:"instances-suggestions",children:b.map((I,T)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{m(I)},children:I})}))}):e("div",{id:"instances-eg",children:e(u,{id:"/OvbEC"})})]}),i==="error"&&e("p",{class:"error",children:e(u,{id:"rmBHZn"})}),e("div",{children:[e("button",{disabled:i==="loading"||!r||!y,children:y?g._({id:"2xahsi",values:{selectedInstanceText:y}}):g._({id:"xGVfLh"})})," "]}),e(Pe,{hidden:i!=="loading"}),e("hr",{}),!Il&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(u,{id:"LcOiWS"})})}),e("p",{children:e(ue,{to:"/",children:e(u,{id:"iWpEwy"})})}),e(fi,{})]})})}const xl={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_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:Xi}=xl,un=40,Al=10,El=5;let Jn={},mn={},gn={};function bn(t){delete mn[t],delete gn[t]}const Xt={block:"nearest",inline:"center",behavior:"smooth"},Ji=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",Qi=/\/s\//i;function Rl(t){var I;const{id:n}=t,{masto:i,instance:s}=ce({instance:t.instance}),o=qe(A),[a,h]=ft(),r=a.get("media"),c=a.get("media-only"),l=parseInt(r||c,10);let p=l>0;const f=a.get("mediaStatusID"),m=ds(f,s);f&&!m&&(p=!1);const d=p&&!!c,v=it(n,s),[b,y]=M(A.statuses[v]);se(()=>{A.statuses[v]&&y(A.statuses[v])},[v]);const w=ke(()=>{const{prevLocation:T}=A,_=((T==null?void 0:T.pathname)||"")+((T==null?void 0:T.search)||""),x=tn("/:instance/s/:id",_)||tn("/s/:id",_);return!_||x?"/":_},[]);se(()=>{!b&&p&&(async()=>{try{const T=await i.v1.statuses.$select(n).fetch();We(T,s),y(T)}catch{alert("Unable to load post."),location.hash=w}})()},[p]);const k=f?(I=o.statuses[it(f,s)])==null?void 0:I.mediaAttachments:b==null?void 0:b.mediaAttachments,C=ct(()=>{!window.matchMedia("(min-width: calc(40em + 350px))").matches&&o.prevLocation?history.back():d?location.hash=w:(a.delete("media"),a.delete("mediaStatusID"),h(a))},[d,w,o.prevLocation]);return se(()=>{let T=setTimeout(()=>{const _=document.querySelector(".carousel");_&&_.focus()},100);return()=>clearTimeout(T)},[d]),se(()=>{const T=document.querySelectorAll(".deck-container");return T.forEach(_=>{_.setAttribute("inert","")}),()=>{T.forEach(_=>{_.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[p?k!=null&&k.length?e(Ns,{mediaAttachments:k,statusID:f||n,instance:s,lang:b==null?void 0:b.language,index:l-1,onClose:C}):e("div",{class:"media-modal-container loading",children:e(Pe,{abrupt:!0})}):e(ue,{to:w}),!d&&e(Ml,{id:n,instance:t.instance,closeLink:w})]})}function Ll(t){const{linkable:n,to:i,onClick:s,...o}=t;return n?e(ue,{class:"status-link",to:i,onClick:s,...o}):e("div",{class:"status-focus",tabIndex:0,...o})}function es(t,n){return new Date(n.created_at)-new Date(t.created_at)}function Ml({id:t,closeLink:n="/",instance:i}){var X,fe;const[s,o]=ft(),a=s.get("media"),h=s.get("mediaStatusID"),r=parseInt(a,10)>0,c=Y(!A.prevLocation&&(history.length===1||"navigation"in window&&((fe=(X=navigation==null?void 0:navigation.entries)==null?void 0:X.call(navigation))==null?void 0:fe.length)===1)),[l,p]=M(s.get("view")||c.current?"full":null),f=!!parseInt(s.get("translate")),{masto:m,instance:d}=ce({instance:i}),{masto:v,instance:b,authenticated:y}=ce(),w=d===b,k=qe(A),[C,I]=M([]),[T,_]=M("default"),x=Y(),$=it(t,d),D=Y(0),L=Y();se(()=>{var O;(O=L.current)==null||O.focus()},[]),se(()=>{var E;const O=ws(()=>{if(!L.current)return;const{scrollTop:z}=L.current;T!=="loading"&&(gn[t]=z)},50);return(E=L.current)==null||E.addEventListener("scroll",O,{passive:!0}),O(),()=>{var z;O.cancel(),(z=L.current)==null||z.removeEventListener("scroll",O)}},[t,T!=="loading"]);const q=Y(),V=Y(),W=({reloadHero:O}={})=>{_("loading");let E;const z=mn[t];if(z){const re=z.filter(ye=>A.statuses[$]);I(re)}else I([{id:t}]);return(async()=>{var Me,Oe;const re=()=>xi(()=>m.v1.statuses.$select(t).fetch(),{retries:4}),ye=xi(()=>m.v1.statuses.$select(t).context.fetch(),{retries:8}),Ie=!!k.statuses[$];let J=k.statuses[$];if(!(Ie&&!O))try{J=await re(),We(J,d),await new Promise(R=>{setTimeout(R,100)})}catch{_("error");return}try{let R=function(he,De){const Je=De+1;return Je>Ae&&(Ae=De),he==null?void 0:he.map(Se=>({id:Se.id,account:Se.account,repliesCount:Se.repliesCount,content:Se.content,weight:en(Se),level:Je,replies:R(Se.__replies,Je)}))};const Q=await ye,{ancestors:oe,descendants:K}=Q;oe.sort(es),K.sort(es),D.current=(K==null?void 0:K.length)||0;const ne=new Set;oe.forEach(he=>{We(he,d,{skipThreading:!0}),he.inReplyToId&&!oe.find(De=>De.id===he.inReplyToId)&&ne.add(he.inReplyToId)});const $e=oe.every(he=>he.account.id===J.account.id),Te=[];K.forEach(he=>{if(We(he,d,{skipThreading:!0}),he.inReplyToId&&!K.find(De=>De.id===he.inReplyToId)&&he.inReplyToId!==J.id&&ne.add(he.inReplyToId),he.inReplyToAccountId===he.account.id)Te.push(he);else if(he.inReplyToId===J.id)Te.push(he);else if(!he.inReplyToAccountId&&Te.find(De=>De.id===he.inReplyToId&&De.account.id===J.account.id)&&he.account.id===J.account.id)Te.push(he);else{const De=K.find(Je=>Je.id===he.inReplyToId);De&&(De.__replies||(De.__replies=[]),De.__replies.push(he))}}),Te.sort((he,De)=>{const Je=J.account.id;return he.account.id===Je&&De.account.id!==Je?-1:De.account.id===Je&&he.account.id!==Je?1:0}),ne.size;let Ae=1;const ze=[...oe.map(he=>({id:he.id,ancestor:!0,isThread:$e,accountID:he.account.id,account:he.account,repliesCount:he.repliesCount,weight:en(he)})),{id:t,accountID:J.account.id,weight:en(J)},...Te.map(he=>({id:he.id,account:he.account,accountID:he.account.id,descendant:!0,thread:he.account.id===J.account.id,weight:en(he),level:1,replies:R(he.__replies,1)}))];_("default"),q.current={offsetTop:(Me=x.current)==null?void 0:Me.offsetTop,scrollTop:(Oe=L.current)==null?void 0:Oe.scrollTop};const He=oe.length||0;He>=ee&&ge(He+1),I(ze),mn[t]=ze,yo(J,d)}catch{_("error")}})(),V.current=Date.now(),()=>{clearTimeout(E)}};se(W,[t,m]);const[Z,F]=M(!1);se(()=>{let O=setInterval(()=>{const E=Date.now();V.current&&E-V.current>=6e4&&F(!0)},6e4);return()=>{clearInterval(O)}},[]),gt(()=>{var E,z;if(!C.length)return;const O=gn[t];if(O)L.current.scrollTop=O;else if(q.current){const re={offsetTop:(E=x.current)==null?void 0:E.offsetTop,scrollTop:(z=L.current)==null?void 0:z.scrollTop},ye=re.offsetTop-q.current.offsetTop+re.scrollTop;L.current.scrollTop=ye}else C.length===1&&(L.current.scrollTop=0);q.current=null},[C]),se(()=>{k.reloadStatusPage<=0||(async()=>{try{const{instanceURL:O}=ei(),E=`https://${O}/api/v1/statuses/${t}/context`;return await(await caches.open("api")).delete(E,{ignoreVary:!0}),W({reloadHero:!0})}catch{}})()},[k.reloadStatusPage]),se(()=>()=>{gn={},A.reloadStatusPage=0,mn={},Jn={},Qn.clear()},[]);const H=k.statuses[$]||k.statuses[t],N=ke(()=>{if(!H)return"";const{account:O}=H,E=document.createElement("div");return E.innerHTML=O.displayName,E.innerText.trim()},[H]),P=ke(()=>{if(!H)return"";let O=ci(H);return O.length>64&&(O=O.slice(0,64)+"โ€ฆ"),O},[H]);Xe(N&&P?`${N}: "${P}"`:g._({id:"post.title"}),"/:instance?/s/:id");const j=ke(()=>{if(!H)return;const{url:O}=H;if(O)return URL.parse(O).hostname},[H]),B=ke(()=>{if(j)return j===d},[j,d]),[ee,ge]=M(un),ie=ke(()=>C.length-ee,[C.length,ee]),be=C.some(O=>O.descendant),_e=C.filter(O=>O.ancestor),[G,ae]=M(!0),Ce=ke(()=>{if(!x.current||G)return null;const{top:O}=x.current.getBoundingClientRect();return O>0?"down":"up"},[G]);Ue("esc",()=>{location.hash=n},{enabled:!r,ignoreEventWhen:O=>!!document.querySelector("#modal-container > *")}),Ue("backspace",()=>{location.hash=n}),Ue("j",()=>{const O=document.activeElement.closest(".status-link, .status-focus"),E=O==null?void 0:O.getBoundingClientRect(),z=Array.from(L.current.querySelectorAll(Ji));if(O&&E.top0){const re=z.indexOf(O);let ye=z[re+1];ye&&(ye.focus(),ye.scrollIntoView(Xt))}else{const re=z.find(ye=>{const Ie=ye.getBoundingClientRect();return Ie.top>=44&&Ie.left>=0});re&&(re.focus(),re.scrollIntoView(Xt))}}),Ue("k",()=>{const O=document.activeElement.closest(".status-link, .status-focus"),E=O==null?void 0:O.getBoundingClientRect(),z=Array.from(L.current.querySelectorAll(Ji));if(O&&E.top0){const re=z.indexOf(O);let ye=z[re-1];ye&&(ye.focus(),ye.scrollIntoView(Xt))}else{const re=z.find(ye=>{const Ie=ye.getBoundingClientRect();return Ie.top>=44&&Ie.left>=0});re&&(re.focus(),re.scrollIntoView(Xt))}}),Ue("x",()=>{const O=document.activeElement.closest(".status-link, .status-focus");if(O){const E=O.nextElementSibling;E&&E.tagName.toLowerCase()==="details"&&(E.open=!E.open)}});const[Ee,Re]=M(!1),Le=Y(r?"media+status":"status"),Ne=ct((O,E,z,re)=>{O.preventDefault(),O.stopPropagation(),o({media:E+1,mediaStatusID:re.id})},[t]),ve=ct((O,E)=>{bn(E.id)},[]);se(()=>{let O;return h&&r&&(O=setTimeout(()=>{var z;const E=(z=L.current)==null?void 0:z.querySelector(`.status-link[href*="/${h}"]`);E&&E.scrollIntoView(Xt)},400)),()=>{clearTimeout(O)}},[h,r]);const te=ct((O,E)=>{const{id:z,ancestor:re,isThread:ye,descendant:Ie,thread:J,replies:Me,repliesCount:Oe,weight:R,level:Q}=O,oe=z===t;return e("li",{ref:oe?x:null,class:`${re?"ancestor":""} ${Ie?"descendant":""} ${J?"thread":""} ${oe?"hero":""}`,children:[oe?e(U,{children:[e(kt,{threshold:.1,onChange:ne=>{queueMicrotask(()=>{requestAnimationFrame(()=>{ae(ne)})})},class:"status-focus",tabIndex:0,children:e(Ye,{statusID:z,instance:d,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:f})}),T!=="loading"&&!y?e("div",{class:"post-status-banner",children:[e("p",{children:e(u,{id:"Vyeh4F"})}),e(ue,{to:Xi?`/login?instance=${Xi}&submit=1`:"/login",class:"button",children:e(u,{id:"sQia9P"})})]}):!w&&e("div",{class:"post-status-banner",children:[e("p",{children:e(u,{id:"j5roNG",values:{instance:d},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:T==="loading",onClick:()=>{_("loading"),(async()=>{try{const ne=await v.v2.search.fetch({q:H.url,type:"statuses",resolve:!0,limit:1});if(ne.statuses.length){const $e=ne.statuses[0];location.hash=b?`/${b}/s/${$e.id}`:`/s/${$e.id}`}else throw new Error("No results")}catch(ne){_("default"),alert(g._({id:"DnepCE",values:{e:ne}}))}})()},children:[e(S,{icon:"transfer"})," ",e(u,{id:"ejAVrO"})]})]})]}):e(Ll,{linkable:ye||re,to:d?`/${d}/s/${z}`:`/s/${z}`,onClick:()=>{bn(z)},children:[E===0&&re?e(kt,{threshold:.5,onChange:ne=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Re(ne)})})},children:e(Ye,{statusID:z,instance:d,withinContext:!0,size:J||re?"m":"s",enableTranslate:!0,onMediaClick:Ne,onStatusLinkClick:ve})}):e(Ye,{statusID:z,instance:d,withinContext:!0,size:J||re?"m":"s",enableTranslate:!0,onMediaClick:Ne,onStatusLinkClick:ve,showActionsBar:!!Ie}),re&&Oe>1&&e("div",{class:"replies-link",children:[e(S,{icon:"comment2",alt:g._({id:"N8UzTV"})})," ",e("span",{title:Oe,children:Ke(Oe)})]})," "]}),Ie&&(Me==null?void 0:Me.length)>0&&e(io,{instance:d,replies:Me,hasParentThread:J,level:Q,accWeight:R,openAll:D.currentbn(z)}}),T==="loading"&&oe&&!!(H!=null&&H.repliesCount)&&!be&&e("div",{class:"status-loading",children:e(Pe,{abrupt:H.repliesCount>=3})}),T==="error"&&oe&&!!(H!=null&&H.repliesCount)&&!be&&e("div",{class:"status-error",children:[e(u,{id:"HQJU6W"}),e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{A.reloadStatusPage++},children:e(u,{id:"KDw4GX"})})]})]},z)},[t,d,T,y,w,f,Ne,ve,be]),pe=ke(()=>{var O;if("navigation"in window&&(navigation!=null&&navigation.entries)){const E=navigation.entries()[navigation.currentEntry.index-1];if(E!=null&&E.url)return Qi.test(E.url)}return Qi.test((O=A.prevLocation)==null?void 0:O.pathname)},[$]),xe=ke(()=>{if(!ie)return[];const O=[];function E(z){O.push(z.id),z.replies&&z.replies.forEach(E)}return C.slice(ee).forEach(E),O.map(z=>it(z,d))},[ie,C,ee,d]),le=ke(()=>C.slice(0,ee).map(te),[C,ee,te]);return se(()=>{let O=setTimeout(()=>{if(!x.current)return;const E=x.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");E&&E.click()},1e3);return()=>clearTimeout(O)},[t]),e("div",{tabIndex:"-1",ref:L,class:`status-deck deck contained ${C.length>1?"padded-bottom":""} ${Le.current==="status"&&!c.current?"slide-in":""} ${l?`deck-view-${l}`:""}`,onAnimationEnd:O=>{Le.current==="status"&&(Le.current=null)},children:[e("header",{class:`${T==="loading"?"loading":""}`,onDblClick:O=>{A.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[pe&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(S,{icon:"chevron-left",size:"xl",alt:g._({id:"iH8pgl"})})}),!G&&H&&T!=="loading"?e(U,{children:[e("span",{class:"hero-heading",children:[e(mt,{account:H.account,instance:d,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["โ€ข"," ",e(Gt,{datetime:H.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:O=>{O.preventDefault(),O.stopPropagation(),x.current.scrollIntoView({behavior:"smooth",block:"start"})},title:g._({id:"NCy+Nw"}),children:e(S,{icon:Ce==="down"?"arrow-down":"arrow-up"})})]}):e(U,{children:[e(u,{id:"post.title"})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:O=>{O.preventDefault(),O.stopPropagation(),L.current.scrollTo({top:0,behavior:"smooth"})},hidden:!_e.length||Ee,title:g._({id:"R8CUl0",values:{0:_e.length}}),children:[e(S,{icon:"arrow-up"}),_e.filter((O,E,z)=>z.findIndex(re=>re.accountID===O.accountID)===E).slice(0,3).map(O=>e(dt,{url:O.account.avatar,alt:O.account.displayName},O.account.id)),_e.length>3&&e(U,{children:[" ",e("span",{class:"insignificant",children:Ke(_e.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:l==="full"?"":"none"},onClick:()=>{p(null),s.delete("media"),s.delete("media-only"),s.delete("view"),o(s)},title:g._({id:"+/xYEI"}),children:e(S,{icon:"layout4",size:"l"})}),Z&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{A.reloadStatusPage++,F(!1)},children:e(S,{icon:"refresh",size:"l",alt:g._({id:"lCF0wC"})})}),e(at,{align:"end",portal:{target:L.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(S,{icon:"more",alt:g._({id:"2FYpfJ"}),size:"xl"})}),children:[e(we,{disabled:T==="loading",onClick:()=>{A.reloadStatusPage++},children:[e(S,{icon:"refresh"}),e("span",{children:e(u,{id:"lCF0wC"})})]}),e(we,{className:"menu-switch-view",onClick:()=>{p(l==="full"?null:"full"),s.delete("media"),s.delete("media-only"),l==="full"?s.delete("view"):s.set("view","full"),o(s)},children:[e(S,{icon:{"":"layout5",full:"layout4"}[l||""]}),e("span",{children:l==="full"?g._({id:"+/xYEI"}):g._({id:"2LiWsE"})})]}),e(we,{onClick:()=>{Array.from(L.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(E=>{E.click()})},children:[e(S,{icon:"eye-open"})," ",e("span",{children:e(u,{id:"8r8KmB"})})]}),e(Ge,{}),e(ys,{className:"plain",children:e(u,{id:"Rsjgm0"})}),e(we,{disabled:!j||B,onClick:()=>{const O=cl(H.url);O?location.hash=O:alert(g._({id:"9J6biQ"}))},children:[e(S,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:j?g._({id:"Kp9SAs",values:{0:Kt.toUnicode(j)}}):g._({id:"lb07+k"})})]})]}),e(ue,{class:"button plain deck-close",to:n,children:e(S,{icon:"x",size:"xl",alt:g._({id:"yz7wBu"})})})]})]})}),C.length&&H?e("ul",{class:`timeline flat contextual grow ${T==="loading"?"loading":""}`,children:[le,ie>0&&e("li",{children:e("button",{type:"button",class:"plain block show-more",disabled:T==="loading",onClick:()=>ge(O=>O+un),style:{marginBlockEnd:"6em"},"data-state-post-ids":xe.join(" "),children:[e("div",{class:"ib avatars-bunch",children:C.slice(ee,ee+5).map(O=>e(dt,{url:O.account.avatarStatic},O.id))})," ",e("div",{class:"ib",children:[e(u,{id:"uXRAkV"})," ",e("span",{class:"tag",children:ie>un?`${un}+`:ie})]})]})})]}):e(U,{children:[T==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(Ye,{skeleton:!0,size:"l"})})}),T==="error"&&e("p",{class:"ui-state",children:[e(u,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{A.reloadStatusPage++},children:e(u,{id:"KDw4GX"})})]})]})]})}function io({replies:t,instance:n,hasParentThread:i,level:s,accWeight:o,openAll:a,parentLink:h}){const[r,c]=ft(),l=_=>_.reduce((x,$)=>{const{repliesCount:D,replies:L}=$,q=(L==null?void 0:L.length)||D;return x+q+l(L||[])},0),p=t.length+l(t),f=t.length===p,m=t.map(_=>_.account).filter((_,x,$)=>$.findIndex(D=>D.id===_.id)===x).slice(0,3),d=ke(()=>t==null?void 0:t.reduce((_,x)=>_+(x==null?void 0:x.weight),o),[o,t==null?void 0:t.length]);let v=!1;(a||d<=El||!i&&p===1&&en(t[0])<2)&&(v=!0);const b=Jn[t[0].id],y=ct((_,x,$,D)=>{_.preventDefault(),_.stopPropagation(),c({media:x+1,mediaStatusID:D.id})},[]),w=Y();gt(()=>{var x;function _($){$.target.dataset.scrollLeft=$.target.scrollLeft}return(x=w.current)==null||x.addEventListener("scroll",_,{passive:!0}),()=>{var $;($=w.current)==null||$.removeEventListener("scroll",_)}},[]);const[k,C]=M(b||v);se(()=>{let _;return!b&&!v&&(_=setTimeout(()=>C(!0),100)),()=>clearTimeout(_)},[b,v]);const I=v?"div":"details",T=I==="details";return e(I,{ref:w,class:"replies",open:T?b||v:void 0,onToggle:T?_=>{const{open:x}=_.target;Jn[t[0].id]=x}:void 0,style:{"--comments-level":s},"data-comments-level":s,"data-comments-level-overflow":s>4,children:[!v&&e("summary",{class:"replies-summary",hidden:v,children:[e("span",{class:"avatars",children:m.map(_=>e(dt,{url:_.avatarStatic,title:`${_.displayName} @${_.username}`,squircle:_==null?void 0:_.bot},_.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(u,{id:"DOQUen",values:{0:t.length,1:Ke(t.length)},components:{0:e("span",{title:t.length})}})}),!f&&p>1&&e(U,{children:[" ","ยท"," ",e("span",{children:e(u,{id:"qSQQSe",values:{0:Ke(p),totalComments:p},components:{0:e("span",{title:p})}})})]})]}),e(S,{icon:"chevron-down",class:"replies-summary-chevron"}),!!h&&e(ue,{class:"replies-parent-link",to:h.to,onClick:h.onClick,title:g._({id:"ZlV82A"}),children:"ยป"})]}),k&&e("ul",{children:t.map(_=>{var x,$;return e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(Ye,{statusID:_.id,instance:n,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:y,showActionsBar:!0}),!((x=_.replies)!=null&&x.length)&&_.repliesCount>0&&e("div",{class:"replies-link",children:[e(S,{icon:"comment2",alt:g._({id:"N8UzTV"})})," ",e("span",{title:_.repliesCount,children:Ke(_.repliesCount)})]})]}),(($=_.replies)==null?void 0:$.length)&&e(io,{instance:n,replies:_.replies,level:_.level,accWeight:v?d:_.weight,openAll:a,parentLink:{to:n?`/${n}/s/${_.id}`:`/s/${_.id}`,onClick:()=>{bn(_.id)}}})]},_.id)})})]})}const $l=140,Dl=35,Nl=70,Pl=140,Qn=new Map;function en(t){var d,v;const n=Qn.get(t.id);if(n)return n;const{spoilerText:i,content:s,mediaAttachments:o,poll:a,card:h}=t,r=vs(i+s),c=o!=null&&o.length?$l:0,l=(((d=a==null?void 0:a.options)==null?void 0:d.length)||0)*Dl,p=h&&(o!=null&&o.length||(v=a==null?void 0:a.options)!=null&&v.length)?0:Nl,m=(r+c+l+p)/Pl;return Qn.set(t.id,m),m}const Ol=st(Rl);function zl(){const t=$t(),{id:n,instance:i}=t;return e(Ol,{id:n,instance:i})}const Ul=""+new URL("boosts-carousel-YjmjXTE6.jpg",import.meta.url).href,Bl=""+new URL("grouped-notifications-xYMFVY91.jpg",import.meta.url).href,Fl=""+new URL("multi-column-ETnJNDVb.jpg",import.meta.url).href,Hl=""+new URL("multi-hashtag-timeline-x-SDVR4g.jpg",import.meta.url).href,ql=""+new URL("nested-comments-thread-Ib-fZGS3.jpg",import.meta.url).href,Yl="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",jl={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_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:Jt,PHANPY_WEBSITE:ts,PHANPY_PRIVACY_POLICY_URL:Vl,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:ns}=jl,is=ts?ts.replace(/https?:\/\//g,"").replace(/\/$/,""):null,ss=`${"2024-11-13T10:12:51.024Z".slice(0,10).replace(/-/g,".")}.5a4082e`;function so(){return Xe(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:hi,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:Yl,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(u,{id:"Ogtv0V"})}),e("p",{children:e(ue,{to:Jt?`/login?instance=${Jt}&submit=1`:"/login",class:"button",children:Jt?g._({id:"sQia9P"}):g._({id:"ZLoGls"})})}),Jt&&ns&&e("p",{children:e("a",{href:ns,class:"button plain5",children:e(u,{id:"e+RpCP"})})}),!Jt&&e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"fvAsUK",components:{0:e("br",{})}})})})]}),(is||ss)&&e("p",{class:"app-site-version",children:e("small",{children:[is," ",ss]})}),e("p",{children:e(u,{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:t=>{t.preventDefault(),A.showAccount="cheeaun@mastodon.social"}}),2:e("a",{href:Vl,target:"_blank"})}})}),e("div",{children:e(fi,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:Ul,alt:g._({id:"S5cYrQ"}),loading:"lazy"}),e("h4",{children:e(u,{id:"Tu+sCN"})}),e("p",{children:e(u,{id:"e2uVlo"})})]}),e("section",{children:[e("img",{src:ql,alt:g._({id:"CGQ27z"}),loading:"lazy"}),e("h4",{children:e(u,{id:"cYE45+"})}),e("p",{children:e(u,{id:"Pc7QKh"})})]}),e("section",{children:[e("img",{src:Bl,alt:g._({id:"rnrM7k"}),loading:"lazy"}),e("h4",{children:e(u,{id:"4RRMre"})}),e("p",{children:e(u,{id:"8GMtDr"})})]}),e("section",{children:[e("img",{src:Fl,alt:g._({id:"VLKtvP"}),loading:"lazy"}),e("h4",{children:e(u,{id:"pEkad9"})}),e("p",{children:e(u,{id:"t7Py5R"})})]}),e("section",{children:[e("img",{src:Hl,alt:g._({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(u,{id:"Wi1Ov0"})}),e("p",{children:e(u,{id:"tS2i+h"})})]})]})})]})}const Gl=window.alert;window.__nativeAlert||(window.__nativeAlert=Gl);window.alert=function(t){t instanceof Error&&(t!=null&&t.message)&&(t=t.message),typeof t!="string"&&(t=JSON.stringify(t));const n=Yo({text:t,className:"alert",gravity:"top",position:"center",duration:1e4,offset:{y:48},onClick:()=>{n.hideToast()}});n.showToast()};window.__STATES__=A;window.__STATES_STATS__=()=>{const t=["statuses","accounts","spoilers","unfurledLinks","statusQuotes"],n={};t.forEach(o=>{n[o]=Object.keys(A[o]).length});const{statuses:i}=A,s=[];for(const o in i)document.querySelector(`[data-state-post-id~="${o}"], [data-state-post-ids~="${o}"]`)||s.push(o)};setInterval(()=>{if(!window.__IDLE__)return;const{statuses:t,unfurledLinks:n,notifications:i}=A;let s=0;const{instance:o}=ce();for(const a in t){if(!window.__IDLE__)break;try{const h=document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`),r=i.some(c=>{var l;return a===it((l=c.status)==null?void 0:l.id,o)});if(!h&&!r){delete A.statuses[a],delete A.statusQuotes[a];for(const c in n){const l=n[c];if(it(l.id,l.instance)===a){delete A.unfurledLinks[c];break}}s++}}catch{}}},15*60*1e3);setTimeout(()=>{for(const t in Ot)setTimeout(()=>{var n,i,s,o,a,h;Array.isArray(Ot[t])?(i=(n=Ot[t])[0])==null||i.call(n):typeof Ot[t]=="object"?(o=(s=Ot[t]).module)==null||o.call(s):(h=(a=Ot)[t])==null||h.call(a)},1)},5e3);(()=>{window.__IDLE__=!0;const t=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],n=()=>{window.__IDLE__=!0},s=ws(n,3e3),o=()=>{window.__IDLE__=!1,s()};t.forEach(a=>{window.addEventListener(a,o,{passive:!0,capture:!0})}),window.addEventListener("blur",n,{passive:!0}),document.documentElement.addEventListener("mouseleave",a=>{!a.relatedTarget&&!a.toElement&&n()},{passive:!0})})();const Kl=/iPad|iPhone|iPod/.test(navigator.userAgent);Kl&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(document.getElementsByClassName("media-modal-container").length>0)return;const n=me.local.get("theme");let i;if(n){if(i=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),i){const s=i.content,o=n==="light"?i.dataset.themeLightColorTemp:i.dataset.themeDarkColorTemp;i.content=o||"",setTimeout(()=>{i.content=s},10)}}else{const s=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(i=document.querySelector(`meta[name="theme-color"][media*="${s}"]`),i){const o=i.dataset.content,a=i.dataset.contentTemp;i.content=a||"",setTimeout(()=>{i.content=o},10)}}}});{const t=me.local.get("theme");if(t){document.documentElement.classList.add(`is-${t}`),document.querySelector('meta[name="color-scheme"]').setAttribute("content",t||"dark light");const i=document.querySelector('meta[data-theme-setting="manual"]');i&&(i.name="theme-color",i.content=t==="light"?i.dataset.themeLightColor:i.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(o=>{o.name=""})}const n=me.local.get("textSize");n&&document.documentElement.style.setProperty("--text-size",`${n}px`)}as(A,t=>{var n;for(const[i,s,o,a]of t){if(s.join(".")==="settings.shortcutsViewMode"){const h=document.getElementById("app");h&&(h.dataset.shortcutsViewMode=(n=A.shortcuts)!=null&&n.length?o:"")}s.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});const hn=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(t){},end(t){}};function Wl(){const[t,n]=M(!1),[i,s]=M("loading");__BENCHMARK.start("app-init"),__BENCHMARK.start("time-to-following"),__BENCHMARK.start("time-to-home"),__BENCHMARK.start("time-to-isLoggedIn"),Qe(),se(()=>{const a=me.local.get("instanceURL"),h=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(h){window.history.replaceState({},document.title,window.location.pathname||"/");const r=me.sessionCookie.get("clientID"),c=me.sessionCookie.get("clientSecret"),l=me.sessionCookie.get("vapidKey"),p=me.sessionCookie.get("codeVerifier");(async()=>{s("loading");const{access_token:f}=await Sl({instanceURL:a,client_id:r,client_secret:c,code:h,code_verifier:p||void 0});if(f){const m=wo({instance:a,accessToken:f});await Promise.allSettled([Dn(m),Nn(m,a),ko(m,a,f,l)]),Si(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,n(!0),s("default")}else s("error");__BENCHMARK.end("app-init")})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;const r=decodeURIComponent((window.location.search.match(/account=([^&]+)/)||[,""])[1]);let c;if(r&&(c=_o(r),c&&(vn(c.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),c||(c=ei()),c){vn(c.info.id);const{client:l}=ce({account:c}),{instance:p}=l;Si(),s("loading"),(async()=>{try{So()&&Co(p)?(Dn(l),Nn(l,p)):await Promise.allSettled([Dn(l),Nn(l,p)])}catch{}finally{n(!0),s("default"),__BENCHMARK.end("app-init")}})()}else s("default"),__BENCHMARK.end("app-init")}me.sessionCookie.del("clientID"),me.sessionCookie.del("clientSecret"),me.sessionCookie.del("codeVerifier")},[]);let o=Vt();return A.currentLocation=o.pathname,se(Kn,[o,t]),/\/https?:/.test(o.pathname)?e(al,{}):i==="loading"?e(Pe,{id:"loader-root"}):e(U,{children:[e(Xl,{isLoggedIn:t}),e(Jl,{isLoggedIn:t}),e(ni,{children:e(Ve,{path:"/:instance?/s/:id",element:e(zl,{})})}),t&&e(Ko,{}),t&&e(Na,{}),e(Aa,{}),t&&e(Ma,{}),e(Go,{isLoggedIn:t}),e($a,{onClose:Kn}),e(Wo,{})]})}function Zl({isLoggedIn:t}){return t&&__BENCHMARK.end("time-to-isLoggedIn"),t?e(sl,{}):e(so,{})}const Xl=st(({isLoggedIn:t})=>{const n=Vt(),i=ke(()=>{const{pathname:s}=n;return!/^\/(login|welcome)/i.test(s)},[n]);return e(ni,{location:i||n,children:[e(Ve,{path:"/",element:e(Zl,{isLoggedIn:t})}),e(Ve,{path:"/login",element:e(Tl,{})}),e(Ve,{path:"/welcome",element:e(so,{})})]})});function os(){return A.prevLocation||null}function Jl({isLoggedIn:t}){const n=Vt(),i=Y(os());return ke(()=>tn("/:instance/s/:id",n.pathname)||tn("/s/:id",n.pathname),[n.pathname,tn])?i.current||(i.current=os()):i.current=null,e(ni,{location:i.current||n,children:[t&&e(U,{children:[e(Ve,{path:"/notifications",element:e(Xs,{})}),e(Ve,{path:"/mentions",element:e(Gs,{})}),e(Ve,{path:"/following",element:e(wi,{})}),e(Ve,{path:"/b",element:e(Us,{})}),e(Ve,{path:"/f",element:e(Bs,{})}),e(Ve,{path:"/l",children:[e(Ve,{index:!0,element:e(rl,{})}),e(Ve,{path:":id",element:e(qs,{})})]}),e(Ve,{path:"/fh",element:e(_r,{})}),e(Ve,{path:"/ft",element:e(vr,{})}),e(Ve,{path:"/catchup",element:e(cr,{})})]}),e(Ve,{path:"/:instance?/t/:hashtag",element:e(Hs,{})}),e(Ve,{path:"/:instance?/a/:id",element:e(Xa,{})}),e(Ve,{path:"/:instance?/p",children:[e(Ve,{index:!0,element:e(Xn,{})}),e(Ve,{path:"l",element:e(Xn,{local:!0})})]}),e(Ve,{path:"/:instance?/trending",element:e(eo,{})}),e(Ve,{path:"/:instance?/search",element:e(Js,{})})]})}Io();Ao(e(To,{i18n:g,children:e(xo,{children:e(Wl,{})})}),document.getElementById("app"));setTimeout(()=>{try{Object.keys(localStorage).forEach(t=>{t.startsWith("iconify")&&localStorage.removeItem(t)}),Object.keys(sessionStorage).forEach(t=>{t.startsWith("iconify")&&sessionStorage.removeItem(t)}),localStorage.removeItem("settings:boostsCarousel")}catch{}},5e3);if("serviceWorker"in navigator&&typeof caches<"u"){const n=["icons"];let i=!1;const s=1e4,o=60*60*1e3;async function a(){if(window.__IDLE__)try{const h=await caches.keys();for(const r of h){if(n.includes(r))continue;const c=await caches.open(r),l=await c.keys();if(l.length>50){const p=l.slice(50);for(const f of p)await c.delete(f)}}i=!0}catch{}setTimeout(a,i?o:s)}setTimeout(a,s)}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")}; //# sourceMappingURL=main-Oquos95D.js.map