30 lines
280 KiB
JavaScript
30 lines
280 KiB
JavaScript
import{A as q,y as ee,h as L,s as A,a as oe,b as Ke,i as g,C as it,u as He,c as e,T as u,d as ge,g as vt,p as $t,e as gn,f as B,j as Je,k as En,L as Xs,l as ke,D as Js,m as Qs,o as Fn,q as Yt,r as kt,t as ot,v as eo,w as Ne,x as bn,z as vi,_ as yt,B as Qi,E as Al,F as es,G as ts,H as to,I as no,J as nt,K as io,M as Zn,N as ht,O as so,P as oo,Q as co,R as Xn,S as Mt,U as We,V as ns,W as is,X as ao,Y as Qt,Z as ro,$ as lo,a0 as Rn,a1 as Ln,a2 as uo,a3 as yi,a4 as ho,a5 as fo,a6 as po,a7 as Jn,a8 as Ye,a9 as mo,aa as go,ab as bo,ac as vo}from"./useTitle-6AJYXxJy.js";import{u as Qn,s as he,a as Be,o as wi,b as yo,I as C,M as Fe,A as lt,N as pt,c as ct,d as ye,e as Ue,f as Ve,g as rt,L as fe,l as Ct,h as ss,t as ki,i as Xe,R as Vt,j as et,p as Gt,k as at,m as os,n as Bn,E as cs,q as Ge,r as ut,v as wo,S as vn,w as _i,T as as,x as dt,y as ei,z as qe,B as wt,C as ko,D as _o,F as Et,G as ti,H as rs,J as So,K as Co,O as Io,P as ls,Q as en,U as To,V as xo,W as ds,X as Ao,Y as Rt,Z as ni,_ as Eo,$ as us,a0 as Ro,a1 as hs,a2 as Lo,a3 as $o,a4 as Mo,a5 as Si,a6 as Do,a7 as Ot}from"./fuse-uYeGZ3ik.js";var fs=No;function No(t,n,i){var s=null,o=null,a=function(){s&&(clearTimeout(s),o=null,s=null)},p=function(){var c=o;a(),c&&c()},r=function(){if(!n)return t.apply(this,arguments);var c=this,l=arguments,m=i&&!s;if(a(),o=function(){t.apply(c,l)},s=setTimeout(function(){if(s=null,!m){var h=o;return o=null,h()}},n),m)return o()};return r.cancel=a,r.flush=p,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 <www.johndoherty.info>
|
||
* @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",m,!1),n.addEventListener("touchmove",h,!1),n.addEventListener("touchend",l,!1);var i=null,s=null,o=null,a=null,p=null,r=null,c=0;function l(d){if(r===d.target){var v=parseInt(f(r,"data-swipe-threshold","20"),10),b=f(r,"data-swipe-unit","px"),w=parseInt(f(r,"data-swipe-timeout","500"),10),k=Date.now()-p,y="",S=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&&k<w&&(o>0?y="swiped-left":y="swiped-right"):Math.abs(a)>v&&k<w&&(a>0?y="swiped-up":y="swiped-down"),y!==""){var _={dir:y.replace(/swiped-/,""),touchType:(S[0]||{}).touchType||"direct",fingers:c,xStart:parseInt(i,10),xEnd:parseInt((S[0]||{}).clientX||-1,10),yStart:parseInt(s,10),yEnd:parseInt((S[0]||{}).clientY||-1,10)};r.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:_})),r.dispatchEvent(new CustomEvent(y,{bubbles:!0,cancelable:!0,detail:_}))}i=null,s=null,p=null}}function m(d){d.target.getAttribute("data-swipe-ignore")!=="true"&&(r=d.target,p=Date.now(),i=d.touches[0].clientX,s=d.touches[0].clientY,o=0,a=0,c=d.touches.length)}function h(d){if(!(!i||!s)){var v=d.touches[0].clientX,b=d.touches[0].clientY;o=i-v,a=s-b}}function f(d,v,b){for(;d&&d!==n.documentElement;){var w=d.getAttribute(v);if(w)return w;d=d.parentNode}return b}})(window,document);function Bt(t=()=>{},n=[]){const i=q(t);ee(()=>{i.current=t},[n]),ee(()=>{const s=()=>{const o=document.hidden||document.visibilityState==="hidden";i.current(!o)};return document.addEventListener("visibilitychange",s),()=>document.removeEventListener("visibilitychange",s)},[])}const Po=1e3*3,Ci=2e4,Oo=it(function({isLoggedIn:n}){const[i,s]=L(!0),o=q();Bt(c=>{clearTimeout(o.current),c?s(!0):o.current=setTimeout(()=>{s(!1)},Ci)});const a=async(c,l,m)=>{var h;if(A.notificationsLast){const f=c.v1.notifications.list({limit:1,sinceId:A.notificationsLast.id}),{value:d}=await f.next();if(d!=null&&d.length)if(m)A.notificationsShowNew=!0;else{let v;try{const b=await c.v1.markers.fetch({timeline:"notifications"});v=(h=b==null?void 0:b.notifications)==null?void 0:h.lastReadId}catch{}v?A.notificationsShowNew=d[0].id!==v:A.notificationsShowNew=!0}}};ee(()=>{let c,l,m;if(n&&i){const{masto:h,streaming:f,instance:d}=oe();(async()=>{await a(h,d);let v=!1;f&&(l=setTimeout(()=>{(async()=>{try{v=!0,c=f.user.notification.subscribe();for await(const b of c){if(!c||!i)break;b.event==="notification"&&Ke(b.payload,d,{skipThreading:!0}),A.notificationsShowNew=!0}}catch{v=!1}v||(m=setInterval(()=>{a(h,d,!0)},Ci))})()},Po))})()}return()=>{var h;(h=c==null?void 0:c.unsubscribe)==null||h.call(c),c=null,clearTimeout(l),clearInterval(m)}},[i,n]);const p=q(),r=()=>{p.current=Date.now(),fetch("./version.json").then(c=>c.json()).then(c=>{c&&(A.appVersion=c)}).catch(c=>{})};return Qn(r,i&&1e3*60*30),Bt(c=>{c&&(p.current?Date.now()-p.current>1e3*60*60&&r():r())}),Be("shift+alt+k",()=>{const c=A.settings.cloakMode;A.settings.cloakMode=!c,he({text:c?g._({id:"oguMwa"}):g._({id:"IXZLPs"})})}),null});function zo(){const t=He(A);function n(i){if(t.composerState.minimized){A.composerState.minimized=!1,wi();return}i.shiftKey?yo()||(A.showCompose=!0):(wi(),A.showCompose=!0)}return Be("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(C,{icon:"quill",size:"xl",alt:g._({id:"QOhkyl"})})})}const Uo=it(function(){const n=He(A);function i(){A.showKeyboardShortcutsHelp=!1}return Be("?, 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(C,{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:"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))})})})]})})}),ps=new Set,tt=new WeakMap,Ht=new WeakMap,Lt=new WeakMap,Hn=new WeakMap,Fo=new WeakMap,qt=new WeakMap,yn=new WeakMap,Xt=new WeakSet;let It,ii=0,si=0;const gt="__aa_tgt",tn="__aa_del",wn="__aa_new",Bo=t=>{const n=Go(t);n&&n.forEach(i=>Ko(i))},Ho=t=>{t.forEach(n=>{n.target===It&&jo(),tt.has(n.target)&&Dt(n.target)})};function qo(t){const n=Hn.get(t);n==null||n.disconnect();let i=tt.get(t),s=0;const o=5;i||(i=jt(t),tt.set(t,i));const{offsetWidth:a,offsetHeight:p}=It,c=[i.top-o,a-(i.left+o+i.width),p-(i.top+o+i.height),i.left-o].map(m=>`${-1*Math.floor(m)}px`).join(" "),l=new IntersectionObserver(()=>{++s>1&&Dt(t)},{root:It,threshold:1,rootMargin:c});l.observe(t),Hn.set(t,l)}function Dt(t){clearTimeout(yn.get(t));const n=Cn(t),i=nn(n)?500:n.duration;yn.set(t,setTimeout(async()=>{const s=Lt.get(t);try{await(s==null?void 0:s.finished),tt.set(t,jt(t)),qo(t)}catch{}},i))}function jo(){clearTimeout(yn.get(It)),yn.set(It,setTimeout(()=>{ps.forEach(t=>vs(t,n=>ms(()=>Dt(n))))},100))}function Yo(t){setTimeout(()=>{Fo.set(t,setInterval(()=>ms(Dt.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function ms(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let qn,Ft;const Vo=typeof window<"u"&&"ResizeObserver"in window;Vo&&(It=document.documentElement,qn=new MutationObserver(Bo),Ft=new ResizeObserver(Ho),window.addEventListener("scroll",()=>{si=window.scrollY,ii=window.scrollX}),Ft.observe(It));function Go(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($n(o.target),!s.has(o.target)){s.add(o.target);for(let a=0;a<o.target.children.length;a++){const p=o.target.children.item(a);if(p){if(tn in p)return!1;$n(o.target,p),s.add(p)}}}if(o.removedNodes.length)for(let a=0;a<o.removedNodes.length;a++){const p=o.removedNodes[a];if(tn in p)return!1;p instanceof Element&&(s.add(p),$n(o.target,p),Ht.set(p,[o.previousSibling,o.nextSibling]))}}return s},new Set)}function $n(t,n){!n&&!(gt in t)?Object.defineProperty(t,gt,{value:t}):n&&!(gt in n)&&Object.defineProperty(n,gt,{value:t})}function Ko(t){var n;const i=t.isConnected,s=tt.has(t);i&&Ht.has(t)&&Ht.delete(t),Lt.has(t)&&((n=Lt.get(t))===null||n===void 0||n.cancel()),wn in t?Ii(t):s&&i?Zo(t):s&&!i?Xo(t):Ii(t)}function ft(t){return Number(t.replace(/[^0-9.\-]/g,""))}function Wo(t){let n=t.parentElement;for(;n;){if(n.scrollLeft||n.scrollTop)return{x:n.scrollLeft,y:n.scrollTop};n=n.parentElement}return{x:0,y:0}}function jt(t){const n=t.getBoundingClientRect(),{x:i,y:s}=Wo(t);return{top:n.top+s,left:n.left+i,width:n.width,height:n.height}}function gs(t,n,i){let s=n.width,o=n.height,a=i.width,p=i.height;const r=getComputedStyle(t);if(r.getPropertyValue("box-sizing")==="content-box"){const l=ft(r.paddingTop)+ft(r.paddingBottom)+ft(r.borderTopWidth)+ft(r.borderBottomWidth),m=ft(r.paddingLeft)+ft(r.paddingRight)+ft(r.borderRightWidth)+ft(r.borderLeftWidth);s-=m,a-=m,o-=l,p-=l}return[s,a,o,p].map(Math.round)}function Cn(t){return gt in t&&qt.has(t[gt])?qt.get(t[gt]):{duration:250,easing:"ease-in-out"}}function bs(t){if(gt in t)return t[gt]}function oi(t){const n=bs(t);return n?Xt.has(n):!1}function vs(t,...n){n.forEach(i=>i(t,qt.has(t)));for(let i=0;i<t.children.length;i++){const s=t.children.item(i);s&&n.forEach(o=>o(s,qt.has(s)))}}function ci(t){return Array.isArray(t)?t:[t]}function nn(t){return typeof t=="function"}function Zo(t){const n=tt.get(t),i=jt(t);if(!oi(t))return tt.set(t,i);let s;if(!n)return;const o=Cn(t);if(typeof o!="function"){const a=n.left-i.left,p=n.top-i.top,[r,c,l,m]=gs(t,n,i),h={transform:`translate(${a}px, ${p}px)`},f={transform:"translate(0, 0)"};r!==c&&(h.width=`${r}px`,f.width=`${c}px`),l!==m&&(h.height=`${l}px`,f.height=`${m}px`),s=t.animate([h,f],{duration:o.duration,easing:o.easing})}else{const[a]=ci(o(t,"remain",n,i));s=new Animation(a),s.play()}Lt.set(t,s),tt.set(t,i),s.addEventListener("finish",Dt.bind(null,t))}function Ii(t){wn in t&&delete t[wn];const n=jt(t);tt.set(t,n);const i=Cn(t);if(!oi(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]=ci(i(t,"add",n));s=new Animation(o),s.play()}Lt.set(t,s),s.addEventListener("finish",Dt.bind(null,t))}function Ti(t,n){var i;t.remove(),tt.delete(t),Ht.delete(t),Lt.delete(t),(i=Hn.get(t))===null||i===void 0||i.disconnect(),setTimeout(()=>{if(tn in t&&delete t[tn],Object.defineProperty(t,wn,{value:!0,configurable:!0}),n&&t instanceof HTMLElement)for(const s in n)t.style[s]=""},0)}function Xo(t){var n;if(!Ht.has(t)||!tt.has(t))return;const[i,s]=Ht.get(t);Object.defineProperty(t,tn,{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=bs(t))===null||n===void 0||n.appendChild(t),!oi(t))return Ti(t);const[p,r,c,l]=Qo(t),m=Cn(t),h=tt.get(t);(o!==ii||a!==si)&&Jo(t,o,a,m);let f,d={position:"absolute",top:`${p}px`,left:`${r}px`,width:`${c}px`,height:`${l}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!nn(m))Object.assign(t.style,d),f=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:m.duration,easing:"ease-out"});else{const[v,b]=ci(m(t,"remove",h));(b==null?void 0:b.styleReset)!==!1&&(d=(b==null?void 0:b.styleReset)||d,Object.assign(t.style,d)),f=new Animation(v),f.play()}Lt.set(t,f),f.addEventListener("finish",Ti.bind(null,t,d))}function Jo(t,n,i,s){const o=ii-n,a=si-i,p=document.documentElement.style.scrollBehavior;if(getComputedStyle(It).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,m=c.clientWidth;const h=performance.now();function f(){requestAnimationFrame(()=>{if(!nn(s)){const d=l-c.clientHeight,v=m-c.clientWidth;h+s.duration>performance.now()?(window.scrollTo({left:window.scrollX-v,top:window.scrollY-d}),l=c.clientHeight,m=c.clientWidth,f()):document.documentElement.style.scrollBehavior=p}})}f()}function Qo(t){const n=tt.get(t),[i,,s]=gs(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),p=tt.get(o)||jt(o),r=Math.round(n.top-p.top)-ft(a.borderTopWidth),c=Math.round(n.left-p.left)-ft(a.borderLeftWidth);return[r,c,i,s]}function ys(t,n={}){return qn&&Ft&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!nn(n)&&!n.disrespectUserMotionPreference||(Xt.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),vs(t,Dt,Yo,o=>Ft==null?void 0:Ft.observe(o)),nn(n)?qt.set(t,n):qt.set(t,{duration:250,easing:"ease-in-out",...n}),qn.observe(t,{childList:!0}),ps.add(t))),Object.freeze({parent:t,enable:()=>{Xt.add(t)},disable:()=>{Xt.delete(t)},isEnabled:()=>Xt.has(t)})}function ai(t){const n=q(null),[i,s]=L(),o=a=>{i&&(a?i.enable():i.disable())};return ee(()=>{n.current instanceof HTMLElement&&s(ys(n.current,t||{}))},[]),[n,o]}const ec=window.matchMedia("(display-mode: standalone)").matches;function tc({onClose:t}){const{masto:n}=oe(),i=ge.local.getJSON("accounts"),s=vt(),o=i.length>1,[a,p]=$t(c=>c+1,0),[r]=ai();return e("div",{id:"accounts-container",class:"sheet",tabIndex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(C,{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 m=c.info.id===s,h=l===0;return e("li",{children:[e("div",{children:[o&&e("span",{class:`current ${m?"is-current":""}`,children:e(C,{icon:"check-circle",alt:g._({id:"Hp1l6f"})})}),e(lt,{url:c.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(m)try{const f=await n.v1.accounts.$select(c.info.id).fetch();c.info=f,ge.local.setJSON("accounts",i),p()}catch{}}}),e(pt,{account:o?{...c.info,acct:/@/.test(c.info.acct)?c.info.acct:`${c.info.acct}@${c.instanceURL}`}:c.info,showAcct:!0,onClick:()=>{m?A.showAccount=`${c.info.username}@${c.instanceURL}`:(gn(c.info.id),location.reload())}})]}),e("div",{class:"actions",children:[h&&o&&e(B,{children:[e("span",{class:"tag",children:e(u,{id:"ovBPCi"})})," "]}),e(ct,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[o&&e(B,{children:[e(ye,{disabled:m,onClick:()=>{gn(c.info.id),location.reload()},children:[e(C,{icon:"transfer"})," ",e(u,{id:"3t/Nrv"})]}),!ec&&!m&&e(Ue,{href:`./?account=${c.info.id}`,target:"_blank",children:[e(C,{icon:"external"}),e("span",{children:e(u,{id:"PZgZtY"})})]}),e(Ve,{})]}),e(ye,{onClick:()=>{A.showAccount=`${c.info.username}@${c.instanceURL}`},children:[e(C,{icon:"user"}),e("span",{children:e(u,{id:"40z2Fm"})})]}),e(Ve,{}),o&&e(ye,{disabled:h,onClick:()=>{i.splice(l,1),i.unshift(c),ge.local.setJSON("accounts",i),p()},children:[e(C,{icon:"check-circle"}),e("span",{children:e(u,{id:"PPcets"})})]}),e(rt,{subMenu:!0,confirmLabel:e(B,{children:[e(C,{icon:"exit"}),e("span",{children:e(u,{id:"k08LxG",values:{0:c.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),disabled:!m,menuItemClassName:"danger",onClick:()=>{i.splice(l,1),ge.local.setJSON("accounts",i),location.href=location.pathname||"/"},children:[e(C,{icon:"exit"}),e("span",{children:e(u,{id:"CXk1bI"})})]})]})]})]},c.info.id)})}),e("p",{children:e(fe,{to:"/login",class:"button plain2",onClick:t,children:[e(C,{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 ri="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",nc={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function li(){const{i18n:t}=Je(),n=ke(()=>Xs.map(i=>{var p,r;const s=nc[i]||i.replace(/-[a-z]+$/i,""),o=Ct({code:s,locale:i,fallback:(p=En.find(c=>c.code===i))==null?void 0:p.nativeName}),a=Ct({code:s,locale:t.locale,fallback:(r=En.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.code<s.code?-1:i.code>s.code?1:0}),[]);return e("label",{class:"lang-selector",children:["🌐"," ",e("select",{class:"small",value:t.locale||Js,onChange:i=>{ge.local.set("lang",i.target.value),Qs(i.target.value)},children:[n.map(({code:i,regionlessCode:s,native:o})=>{var r;const a=Ct({code:s,locale:t.locale,fallback:(r=En.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 xi(t){const{masto:n}=oe();return n.v1.push.subscription.create(t)}function ic(){const{masto:t}=oe();return t.v1.push.subscription.fetch()}function sc(t){const{masto:n}=oe();return n.v1.push.subscription.update(t)}function oc(){const{masto:t}=oe();return t.v1.push.subscription.remove()}function In(){return"serviceWorker"in navigator&&"PushManager"in window}function cc(){return navigator.serviceWorker.getRegistration()}async function di(){const t=await cc(),n=t?await t.pushManager.getSubscription():void 0;return{registration:t,subscription:n}}function ws(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<s.length;++a)o[a]=s.charCodeAt(a);return o}async function ac(){if(!In())return;const{subscription:t}=await di();let n=null;try{n=await ic()}catch(i){if(!/(not found|unknown)/i.test(i.message))throw i}if(n&&t){const i=n.endpoint===t.endpoint,s=Fn(),o=n.serverKey===s;if(!i)throw new Error("Backend subscription endpoint changed");if(!o)throw new Error("Backend subscription key and vapid key changed")}if(t&&!n){const i=Fn();if(i){const{applicationServerKey:s}=t.options,o=ws(i).toString(),a=new Uint8Array(s).toString();if(!(o===a))throw await t.unsubscribe(),new Error("Subscription key and vapid key changed")}}return{subscription:t,backendSubscription:n}}async function Ai({data:t,policy:n}){if(!In())return;let{registration:i,subscription:s}=await di(),o=null;if(s)try{o=await sc({data:t,policy:n})}catch{o=await xi({subscription:s,data:t,policy:n})}else{const a=Fn();if(!a)throw new Error("No server key found");s=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ws(a)}),o=await xi({subscription:s,data:t,policy:n})}return{subscription:s,backendSubscription:o}}async function Ei(){if(!In())return;const{subscription:t}=await di();t&&(await oc(),await t.unsubscribe())}const rc={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"},Ri=16,At=[14,15,16,17,18,19,20],{PHANPY_WEBSITE:Li,PHANPY_PRIVACY_POLICY_URL:lc,PHANPY_IMG_ALT_API_URL:dc,PHANPY_GIPHY_API_KEY:uc}=rc;function hc({onClose:t}){const n=He(A),i=ge.local.get("theme")||"auto",s=q(),o=n.settings.contentTranslationTargetLanguage||null,a=ss(),p=Ct(a),r=ge.local.get("textSize")||Ri,[c,l]=L(ge.account.get("preferences")||{}),{masto:m,authenticated:h,instance:f}=oe();return e("div",{id:"settings-container",class:"sheet",tabIndex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"Tz0i8g"})})}),e("main",{children:[e("section",{children:e("ul",{children:[e("li",{children:[e("div",{children:e("label",{children:e(u,{id:"aAIQg2"})})}),e("div",{children:e("form",{ref:s,onInput:d=>{d.preventDefault();const b=new FormData(s.current).get("theme"),w=document.documentElement;if(b==="auto"){w.classList.remove("is-light","is-dark");const k=document.querySelector('meta[data-theme-setting="manual"]');k&&(k.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(S=>{S.name="theme-color"})}else{w.classList.toggle("is-light",b==="light"),w.classList.toggle("is-dark",b==="dark");const k=document.querySelector('meta[data-theme-setting="manual"]');k&&(k.name="theme-color",k.content=b==="light"?k.dataset.themeLightColor:k.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(S=>{S.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",b==="auto"?"dark light":b),b==="auto"?ge.local.del("theme"):ge.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===Ri?ge.local.del("textSize"):ge.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(li,{})]})]})}),h&&e(B,{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(C,{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 m.v1.accounts.updateCredentials({source:{privacy:v}}),l({...c,"posting:default:visibility":v}),ge.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(C,{icon:"cloud",alt:g._({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(u,{id:"xlsg7n",values:{instance:f},components:{0:e("a",{href:`https://${f}/`,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:p}})}),e("option",{disabled:!0,children:"──────────"}),ki.map(d=>{const v=Ct({code:d.code,fallback:d.name}),b=Ct({code:d.code,locale:d.code}),w=v!==b;return e("option",{value:d.code,children:w?`${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:ki.map(d=>{const v=Ct({code:d.code,fallback:d.name}),b=Ct({code:d.code,locale:d.code}),w=v!==b;return e("label",{children:[e("input",{type:"checkbox",checked:n.settings.contentTranslationHideLanguages.includes(d.code),onChange:k=>{const{checked:y}=k.target;y?A.settings.contentTranslationHideLanguages.push(d.code):A.settings.contentTranslationHideLanguages=n.settings.contentTranslationHideLanguages.filter(S=>S!==d.code)}})," ",w?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",{})}})})})]})]})]}),!!uc&&h&&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"})}})})})]}),!!dc&&h&&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(C,{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"})}})})})]}),h&&Xe("@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"})})})]}),h&&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(C,{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"})})})]}),h&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{A.showDrafts=!0,A.showSettings=!1},children:e(u,{id:"krk5ws"})})})]})}),h&&e(fc,{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:ri,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:lc,target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"LcET2C"})})]}),e("p",{children:[Li&&e(B,{children:[e(u,{id:"pFnMHn",values:{0:Li.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/0a176e2",target:"_blank",rel:"noopener noreferrer",children:e(Vt,{datetime:new Date("2024-10-08T16:03:59.313Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2024-10-08T16:03:59.313Z".slice(0,10).replace(/-/g,".")}.0a176e2`,onClick:d=>{d.target.select();try{navigator.clipboard.writeText(d.target.value),he(g._({id:"PiPfua"}))}catch{he(g._({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function fc({onClose:t}){if(!In())return null;const{instance:n}=oe(),[i,s]=L("default"),o=q(),[a,p]=L(!1),[r,c]=L(!1),l=q();ee(()=>{(async()=>{s("loading");try{const{subscription:h,backendSubscription:f}=await ac();if(f!=null&&f.policy&&f.policy!=="none"){p(!0);const{alerts:d,policy:v}=f;l.current=v;const{elements:b}=o.current,w=b.namedItem("policy");w&&(w.value=v),Object.keys(d).forEach(k=>{const y=b.namedItem(k);(y==null?void 0:y.type)==="checkbox"&&(y.checked=!0)})}s("default")}catch(h){/outside.*authorized/i.test(h.message)?c(!0):alert((h==null?void 0:h.message)||h),s("error")}})()},[]);const m=i==="loading";return e("form",{ref:o,onChange:()=>{setTimeout(()=>{const h=Object.fromEntries(new FormData(o.current)),f=!!h["policy-allow"],d={data:{policy:h.policy,alerts:{mention:!!h.mention,favourite:!!h.favourite,reblog:!!h.reblog,follow:!!h.follow,follow_request:!!h.followRequest,poll:!!h.poll,update:!!h.update,status:!!h.status}}};let v=0;Object.keys(d.data.alerts).forEach(w=>{d.data.alerts[w]?v++:delete d.data.alerts[w]});const b=l.current!==d.data.policy;f&&v>0?b?Ei().then(()=>{Ai(d)}).catch(w=>{alert(g._({id:"I6pdY3"}))}):Ai(d).catch(w=>{alert(g._({id:"I6pdY3"}))}):Ei().catch(w=>{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:m||r,name:"policy-allow",checked:a,onChange:async h=>{const{checked:f}=h.target;if(f){const d=await Notification.requestPermission();d==="granted"?p(!0):(p(!1),d==="denied"&&alert(g._({id:"6LUsk7"})))}else p(!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(h=>e("option",{value:h.value,children:h.label}))},components:{0:e("select",{name:"policy",disabled:m||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(h=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:h.value})," ",h.label]})}))})})})}),r&&e("div",{class:"sub-section",children:e("p",{children:e(u,{id:"8d0b8B",components:{0:e(fe,{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 jn=()=>{let t=setTimeout(()=>{if(!document.getElementById("columns")){const i=document.querySelectorAll("#modal-container > *");if(i!=null&&i.length){const p=i[i.length-1],r=p.querySelector('[tabindex="-1"]')||p;if(r){r.focus();return}}if(document.querySelector(".deck-backdrop"))return;const o=document.querySelectorAll(".deck-container"),a=o[o.length-1];a&&a.tabIndex===-1&&a.focus()}},100);return()=>clearTimeout(t)};function ks(t){if(!t)return;const n=Yt(),i=q(n.pathname);ee(()=>{i.current&&n.pathname!==i.current&&(t==null||t())},[n.pathname,t])}const _s=1e3*60,pc=24*60*60*1e3,Yn=kt(async()=>{const{masto:t}=oe(),n=await t.v1.lists.list();return n.sort((i,s)=>i.title.localeCompare(s.title)),n.length&&setTimeout(()=>{ge.account.set("lists",{lists:n,updatedAt:Date.now()})},1),n},{maxAge:_s});async function sn(){try{const{lists:t,updatedAt:n}=ge.account.get("lists")||{};return t!=null&&t.length?(Date.now()-n>pc&&Yn(),t):await Yn()}catch{return[]}}const mc=kt(t=>{const{masto:n}=oe();return n.v1.lists.$select(t).fetch()},{maxAge:_s});async function Ss(t){const{lists:n}=ge.account.get("lists")||{};if(n!=null&&n.length){const i=n.find(s=>s.id===t);if(i)return i}try{return mc(t)}catch{return null}}async function gc(t){const n=await Ss(t);return(n==null?void 0:n.title)||""}function bc(t){const{lists:n}=ge.account.get("lists")||{};n!=null&&n.length&&(n.push(t),n.sort((i,s)=>i.title.localeCompare(s.title)),ge.account.set("lists",{lists:n,updatedAt:Date.now()}))}function vc(t){const{lists:n}=ge.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)),ge.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function yc(t){const{lists:n}=ge.account.get("lists")||{};if(n!=null&&n.length){const i=n.findIndex(s=>s.id===t);i!==-1&&(n.splice(i,1),ge.account.set("lists",{lists:n,updatedAt:Date.now()}))}}function ui({list:t,onClose:n}){const{masto:i}=oe(),[s,o]=L("default"),a=!!t,p=q(),r=q(),c=q();ee(()=>{a&&(p.current.value=t.title,r.current.value=t.repliesPolicy,c.current&&(c.current.checked=t.exclusive))},[a]);const l=Xe("@mastodon/list-exclusive");return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{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:m=>{m.preventDefault();const h=new FormData(m.target),f=h.get("title"),d=h.get("replies_policy"),v=h.get("exclusive")==="on";o("loading"),(async()=>{try{let b;a?b=await i.v1.lists.$select(t.id).update({title:f,replies_policy:d,exclusive:v}):b=await i.v1.lists.create({title:f,replies_policy:d,exclusive:v}),o("default"),n==null||n({state:"success",list:b}),setTimeout(()=>{a?vc(b):bc(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:p,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(rt,{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(()=>{yc(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 wc=[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:et(5,"minute"),1800:et(30,"minute"),3600:et(1,"hour"),21600:et(6,"hour"),86400:et(1,"day"),259200:et(3,"day"),604800:et(1,"week")},$i=80,Cs=1e3*60*10;function kc(t,n){return n.v1.accounts.familiarFollowers.fetch({id:[t]})}const _c=kt(kc,{maxAge:Cs});async function Sc(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 Cc=kt(Sc,{maxAge:Cs});function Is({account:t,fetchAccount:n=()=>{},standalone:i,instance:s,authenticated:o}){const{i18n:a}=Je(),{masto:p}=oe({instance:s}),{masto:r,instance:c}=oe(),[l,m]=L("default"),h=typeof t=="string",[f,d]=L(h?null:t),v=ke(()=>s===c,[s,c]);ee(()=>{if(!h){d(t);return}m("loading"),(async()=>{try{const W=await n();A.accounts[`${W.id}@${s}`]=W,d(W),m("default")}catch{d(null),m("error")}})()},[h,t,n]);const{acct:b,avatar:w,avatarStatic:k,bot:y,createdAt:S,displayName:_,emojis:T,fields:I,followersCount:x,followingCount:O,group:P,id:$,lastStatusAt:j,locked:Z,note:J,statusesCount:N,url:M,username:z,memorial:V,moved:U,roles:ie,hideCollections:Q}=f||{};let de=!1,{header:Ce,headerStatic:te}=f||{};(!Ce||/missing\.png$/.test(Ce))&&w&&!/missing\.png$/.test(w)&&(Ce=w,de=!0,k&&!/missing\.png$/.test(k)&&(te=k));const be=ke(()=>$===vt(),[$]);ee(()=>{const W=!!(f!=null&&f.id&&(f!=null&&f.username)&&(f!=null&&f.acct)&&(f!=null&&f.avatar)&&(f!=null&&f.avatarStatic)&&(f!=null&&f.displayName)&&(f!=null&&f.url));if(be&&s&&W){const Le=ge.local.getJSON("accounts");let Pe=!1;Le.forEach(R=>{R.info.id===f.id&&R.instanceURL===s&&(R.info=f,Pe=!0)}),Pe&&ge.local.setJSON("accounts",Le)}},[be,f,s]);const K=ke(()=>M?Gt.toUnicode(URL.parse(M).hostname):null,[M]),[ae,ue]=L([]),Ie=q(),Me=q([]);async function Te(W){var Y;(W||!Ie.current)&&(Ie.current=p.v1.accounts.$select($).followers.list({limit:$i}));const Le=await Ie.current.next();if(be||!v)return Le;const{value:Pe}=Le;let R=[];if(W){let se=[];try{se=await p.v1.accounts.familiarFollowers.fetch({id:[$]})}catch{}Me.current=((Y=se==null?void 0:se[0])==null?void 0:Y.accounts)||[],R=[...Me.current,...Pe.filter(H=>!Me.current.some(ne=>ne.id===H.id))]}else Pe!=null&&Pe.length&&(R=Pe.filter(se=>!Me.current.some(H=>H.id===se.id)));return{...Le,value:R}}const Re=q();async function De(W){return(W||!Re.current)&&(Re.current=p.v1.accounts.$select($).following.list({limit:$i})),await Re.current.next()}const we=i?"div":fe,X=s?`/${s}/a/${$}`:`/a/${$}`,[me,xe]=L([]),[le,G]=L(),[pe,D]=L("default"),E=!!(le!=null&&le.total),F=async W=>{try{const Le=await _c(W,r);xe(Le[0].accounts.slice(0,Ic))}catch{}},ce=async()=>{if($){D("loading");try{const W=await Cc($,p);G(W),D("default")}catch{D("error")}}},ve=ot(({relationship:W,currentID:Le})=>{W.following||(F(Le),!i&&N>0&&ce())},[i,$,N]),_e=ot(W=>{W.id===$&&(d(W),A.accounts[`${W.id}@${s}`]=W)},[$,s]);return e("div",{tabIndex:"-1",class:`account-container ${l==="loading"?"skeleton":""}`,style:{"--header-color-1":ae[0],"--header-color-2":ae[1],"--header-color-3":ae[2],"--header-color-4":ae[3]},children:[l==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(u,{id:"44hICK"})}),e("p",{children:e("a",{href:h?t:M,target:"_blank",rel:"noopener noreferrer",children:[e(u,{id:"Aadw0+"})," ",e(C,{icon:"external"})]})})]}),l==="loading"?e(B,{children:[e("header",{children:e(at,{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:"y6sq5j"})]}),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(C,{icon:"more",size:"l",alt:a._({id:"2FYpfJ"})})})})]})]})]}):f&&e(B,{children:[!!U&&e("div",{class:"account-moved",children:[e("p",{children:e(u,{id:"C6cVP/",values:{displayName:_},components:{0:e("b",{})}})}),e(at,{account:U,instance:s,onClick:W=>{W.stopPropagation(),A.showAccount=U}})]}),!!Ce&&!/missing\.png$/.test(Ce)&&e("img",{src:Ce,alt:"",class:`header-banner ${de?"header-is-avatar":""}`,onError:W=>{W.target.crossOrigin?W.target.src!==te?W.target.src=te:(W.target.removeAttribute("crossorigin"),W.target.src=Ce):W.target.src!==te?W.target.src=te:W.target.remove()},crossOrigin:"anonymous",onLoad:W=>{W.target.classList.add("loaded");try{const Le=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),Pe=Le.getContext("2d",{willReadFrequently:!0});Le.width=W.target.width,Le.height=W.target.height,Pe.imageSmoothingEnabled=!1,Pe.drawImage(W.target,0,0);const R=10,se=[Pe.getImageData(0,0,R,R).data,Pe.getImageData(W.target.width-R,0,R,R).data,Pe.getImageData(0,W.target.height-R,R,R).data,Pe.getImageData(W.target.width-R,W.target.height-R,R,R).data].map(H=>{let ne=0,$e=0,Ae=0,Se=0;for(let re=0;re<H.length;re+=4)ne+=H[re],$e+=H[re+1],Ae+=H[re+2],Se+=H[re+3];const Oe=H.length/4;return[ne/Oe,$e/Oe,Ae/Oe,Se/Oe]}).map(H=>{const[ne,$e,Ae,Se]=xc(H);return`rgba(${ne}, ${$e}, ${Ae}, ${Se})`});ue(se)}catch{}}}),e("header",{children:i?e(ct,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(at,{account:f,instance:s,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(Dc,{acct:b,instance:s})}),e(ye,{onClick:()=>{const W=b.includes("@")?`@${b}`:`@${b}@${s}`;try{navigator.clipboard.writeText(W),he(a._({id:"zJoEwS"}))}catch{he(a._({id:"BC0lSD"}))}},children:[e(C,{icon:"link"}),e("span",{children:e(u,{id:"27x6gl"})})]}),e(ye,{href:M,target:"_blank",children:[e(C,{icon:"external"}),e("span",{children:e(u,{id:"Bz5hLl"})})]}),e(Ve,{}),e(Ue,{href:f.avatar,target:"_blank",children:[e(C,{icon:"user"}),e("span",{children:e(u,{id:"7WYl2I"})})]}),e(Ue,{href:f.header,target:"_blank",children:[e(C,{icon:"media"}),e("span",{children:e(u,{id:"ZNme5R"})})]})]}):e(at,{account:f,instance:s,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!V&&e("span",{class:"tag",children:e(u,{id:"prdIOK"})}),!!y&&e("span",{class:"tag",children:[e(C,{icon:"bot"})," ",e(u,{id:"9Vdq+j"})]}),!!P&&e("span",{class:"tag",children:[e(C,{icon:"group"})," ",e(u,{id:"L8fEEm"})]}),ie==null?void 0:ie.map(W=>e("span",{class:"tag",children:[W.name,!!K&&e(B,{children:[" ",e("span",{class:"more-insignificant",children:K})]})]})),e("div",{class:"note",dir:"auto",onClick:os({instance:c}),dangerouslySetInnerHTML:{__html:Bn(J,{emojis:T})}}),e("div",{class:"account-metadata-box",children:[(I==null?void 0:I.length)>0&&e("div",{class:"profile-metadata",children:I.map(({name:W,value:Le,verifiedAt:Pe},R)=>e("div",{class:`profile-field ${Pe?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(cs,{text:W,emojis:T})," ",!!Pe&&e(C,{icon:"check-circle",size:"s",alt:a._({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:Bn(Le,{emojis:T})}})]},W+R))}),e("div",{class:"stats",children:[e(we,{tabIndex:0,to:X,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={id:"followers",heading:a._({id:"x5LEuB"}),fetchAccounts:Te,instance:s,excludeRelationshipAttrs:be?["followedBy"]:[],blankCopy:Q?a._({id:"BRV/wh"}):void 0}},0)},children:[!!me.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:me.map(W=>e(lt,{url:W.avatarStatic,size:"s",alt:`${W.displayName} @${W.acct}`,squircle:W==null?void 0:W.bot}))})}),e("span",{title:x,children:Ge(x)})," ",e(u,{id:"x5LEuB"})]}),e(we,{class:"insignificant",tabIndex:0,to:X,onClick:()=>{setTimeout(()=>{A.showGenericAccounts={heading:a._({id:"y6sq5j"}),fetchAccounts:De,instance:s,excludeRelationshipAttrs:be?["following"]:[],blankCopy:Q?a._({id:"BRV/wh"}):void 0}},0)},children:[e("span",{title:O,children:Ge(O)})," ",e(u,{id:"y6sq5j"}),e("br",{})]}),e(we,{class:"insignificant",to:X,children:[e("span",{title:N,children:Ge(N)})," ",e(u,{id:"+owNNn"})]}),!!S&&e("div",{class:"insignificant",children:e(u,{id:"PCcEFZ",values:{0:ut(S,{hideTime:!0})},components:{0:e("time",{datetime:S})}})})]})]}),!!le&&e(we,{to:X,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"})})})})}),!U&&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:pe==="loading",onClick:()=>{ce()},children:[e("div",{class:`posting-stats-bar posting-stats-icon ${pe==="loading"?"loading":""}`,style:{"--originals-percentage":"33%","--replies-percentage":"66%"}}),e(u,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(Tc,{info:f,instance:s,standalone:i,authenticated:o,onRelationshipChange:ve,onProfileUpdate:_e})})]})]})}const Ic=3;function Tc({info:t,instance:n,standalone:i,authenticated:s,onRelationshipChange:o=()=>{},onProfileUpdate:a=()=>{}}){var le;if(!t)return null;const{_:p}=Je(),{masto:r,instance:c,authenticated:l}=oe(),m=n===c,[h,f]=L("default"),[d,v]=L(null),{id:b,acct:w,url:k,username:y,locked:S,lastStatusAt:_,note:T,fields:I,moved:x}=t,O=q(b),{following:P,showingReblogs:$,notifying:j,followedBy:Z,blocking:J,blockedBy:N,muting:M,mutingNotifications:z,requested:V,domainBlocking:U,endorsed:ie,note:Q}=d||{},[de,Ce]=L(null),[te,be]=L(!1),K=w.includes("@")?w:`${w}@${n}`;ee(()=>{if(t){const G=vt();let pe;(async()=>{if(m&&s)pe=b;else if(!m&&l){const E=t.acct.includes("@");try{const F=await r.v2.search.fetch({q:E?t.acct:`${t.username}@${n}`,type:"accounts",limit:1,resolve:!0});F.accounts.length&&(pe=F.accounts[0].id,Ce(F.accounts[0]))}catch{}}if(!pe)return;if(G===pe){be(!0);return}O.current=pe,f("loading");const D=r.v1.accounts.relationships.fetch({id:[pe]});try{const E=await D;if(f("default"),E.length){const F=E[0];v(F),o({relationship:F,currentID:pe})}}catch{f("error")}})()}},[t,s]),ee(()=>{t&&te&&eo(t)},[t,te]);const ae=h==="loading",[ue,Ie]=L(!1),[Me,Te]=L(!1),[Re,De]=L(!1),[we,X]=L(!1),[me,xe]=L([]);return e(B,{children:[e("div",{class:"actions",children:[e("span",{children:[Z?e("span",{class:"tag",children:e(u,{id:"p3UO/y"})}):_?e("small",{class:"insignificant",children:e(u,{id:"F3cM1G",values:{0:ut(_,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),M&&e("span",{class:"tag danger",children:e(u,{id:"+IJm1Z"})}),J&&e("span",{class:"tag danger",children:e(u,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!Q&&e("button",{type:"button",class:"private-note-tag",title:g._({id:"zxFxcH"}),onClick:()=>{De(!0)},dir:"auto",children:e("span",{children:Q})}),e(ct,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain",disabled:ae,children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),onMenuChange:G=>{P&&G.open&&(async()=>{try{const pe=await r.v1.accounts.$select(O.current).lists.list();xe(pe)}catch{}})()},children:[l&&!te&&e(B,{children:[e(ye,{onClick:()=>{wo({draftStatus:{status:`@${(de==null?void 0:de.acct)||w} `}})},children:[e(C,{icon:"at"}),e("span",{children:e(u,{id:"3LkfZu",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(ye,{onClick:()=>{Ie(!0)},children:[e(C,{icon:"translate"}),e("span",{children:e(u,{id:"R8mSiS"})})]}),Xe("@mastodon/profile-private-note")&&e(ye,{onClick:()=>{De(!0)},children:[e(C,{icon:"pencil"}),e("span",{children:Q?g._({id:"U+Gokq"}):g._({id:"VcQzRi"})})]}),P&&!!d&&e(B,{children:[e(ye,{onClick:()=>{f("loading"),(async()=>{try{const G=await r.v1.accounts.$select(O.current).follow({notify:!j});G&&v(G),f("default"),he(G.notifying?g._({id:"jL3N0G",values:{username:y}}):g._({id:"WBugD/",values:{username:y}}))}catch(G){alert(G),f("error")}})()},children:[e(C,{icon:"notification"}),e("span",{children:j?g._({id:"osJmEN"}):g._({id:"I92Z+b"})})]}),e(ye,{onClick:()=>{f("loading"),(async()=>{try{const G=await r.v1.accounts.$select(O.current).follow({reblogs:!$});G&&v(G),f("default"),he(G.showingReblogs?g._({id:"0X2KC8",values:{username:y}}):g._({id:"cXWjH0",values:{username:y}}))}catch(G){alert(G),f("error")}})()},children:[e(C,{icon:"rocket"}),e("span",{children:$?g._({id:"GRUr8d"}):g._({id:"uREpT3"})})]})]}),P&&e(ye,{onClick:()=>{Te(!0)},children:[e(C,{icon:"list"}),me.length?e(B,{children:[e("small",{class:"menu-grow",children:[e(u,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:me.map(G=>G.title).join(", ")})]}),e("small",{class:"more-insignificant",children:me.length})]}):e("span",{children:e(u,{id:"sJ2yQc"})})]}),e(Ve,{})]}),e(ye,{onClick:()=>{const G=`@${(de==null?void 0:de.acct)||K}`;try{navigator.clipboard.writeText(G),he(g._({id:"zJoEwS"}))}catch{he(g._({id:"BC0lSD"}))}},children:[e(C,{icon:"copy"}),e("small",{children:[e(u,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",(de==null?void 0:de.acct)||K]})]})]}),e(ye,{href:k,target:"_blank",children:[e(C,{icon:"external"}),e("small",{class:"menu-double-lines",children:Ac(k)})]}),e("div",{class:"menu-horizontal",children:[e(ye,{onClick:()=>{try{navigator.clipboard.writeText(k),he(g._({id:"edWbV6"}))}catch{he(g._({id:"W1ewR0"}))}},children:[e(C,{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:k}))&&e(ye,{onClick:()=>{try{navigator.share({url:k})}catch{alert(g._({id:"TtG3Uh"}))}},children:[e(C,{icon:"share"}),e("span",{children:e(u,{id:"LFKLqp"})})]})]}),!!d&&e(B,{children:[e(Ve,{}),M?e(ye,{onClick:()=>{f("loading"),(async()=>{try{const G=await r.v1.accounts.$select((de==null?void 0:de.id)||b).unmute();v(G),f("default"),he(g._({id:"B4Xkly",values:{username:y}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{f("error")}})()},children:[e(C,{icon:"unmute"}),e("span",{children:e(u,{id:"Q/HUhC",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(vn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(B,{children:[e(C,{icon:"mute"}),e("span",{class:"menu-grow",children:e(u,{id:"xhPEH3",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})}),e("span",{style:{textOverflow:"clip"},children:[e(C,{icon:"time"}),e(C,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:wc.map(G=>e(ye,{onClick:()=>{f("loading"),(async()=>{try{const pe=await r.v1.accounts.$select((de==null?void 0:de.id)||b).mute({duration:G});v(pe),f("default"),he(g._({id:"/plB9m",values:{0:typeof zt[G]=="function"?zt[G]():p(zt[G]),username:y}})),A.reloadGenericAccounts.id="mute",A.reloadGenericAccounts.counter++}catch{f("error"),he(g._({id:"vWGBjT",values:{username:y}}))}})()},children:typeof zt[G]=="function"?zt[G]():p(zt[G])}))})}),Z&&e(rt,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(B,{children:[e(C,{icon:"user-x"}),e("span",{children:e(u,{id:"unyq2W",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{f("loading"),(async()=>{try{const G=await r.v1.accounts.$select((de==null?void 0:de.id)||b).removeFromFollowers();v(G),f("default"),he(g._({id:"AgkcM/",values:{username:y}})),A.reloadGenericAccounts.id="followers",A.reloadGenericAccounts.counter++}catch{f("error")}})()},children:[e(C,{icon:"user-x"}),e("span",{children:e(u,{id:"VCZ0OT"})})]}),e(rt,{subMenu:!0,confirm:!J,confirmLabel:e(B,{children:[e(C,{icon:"block"}),e("span",{children:e(u,{id:"aforS9",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{f("loading"),(async()=>{try{if(J){const G=await r.v1.accounts.$select((de==null?void 0:de.id)||b).unblock();v(G),f("default"),he(g._({id:"sI9N29",values:{username:y}}))}else{const G=await r.v1.accounts.$select((de==null?void 0:de.id)||b).block();v(G),f("default"),he(g._({id:"uYcYzu",values:{username:y}}))}A.reloadGenericAccounts.id="block",A.reloadGenericAccounts.counter++}catch{f("error"),J?he(g._({id:"0tG4wG",values:{username:y}})):he(g._({id:"pA+qEx",values:{username:y}}))}})()},children:J?e(B,{children:[e(C,{icon:"unblock"}),e("span",{children:e(u,{id:"/3LJfX",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(B,{children:[e(C,{icon:"block"}),e("span",{children:e(u,{id:"JRswkR",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(ye,{className:"danger",onClick:()=>{A.showReportModal={account:de||t}},children:[e(C,{icon:"flag"}),e("span",{children:e(u,{id:"qTJgpR",values:{username:y},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),l&&te&&i&&Xe("@mastodon/profile-edit")&&e(B,{children:[e(Ve,{}),e(ye,{onClick:()=>{X(!0)},children:[e(C,{icon:"pencil"}),e("span",{children:e(u,{id:"9OpVZg"})})]})]}),!1]}),!d&&h==="loading"&&e(Ne,{abrupt:!0}),!!d&&!x&&e(rt,{confirm:P||V,confirmLabel:e("span",{children:V?g._({id:"e7qQIH"}):g._({id:"eYsAQr",values:{0:t.acct||t.username}})}),menuItemClassName:"danger",align:"end",disabled:ae,onClick:()=>{f("loading"),(async()=>{try{let G;P||V?G=await r.v1.accounts.$select(O.current).unfollow():G=await r.v1.accounts.$select(O.current).follow(),G&&v(G),f("default")}catch(G){alert(G),f("error")}})()},children:e("button",{type:"button",class:`${P||V?"light swap":""}`,"data-swap-state":P||V?"danger":"",disabled:ae,children:P?e(B,{children:[e("span",{children:e(u,{id:"y6sq5j"})}),e("span",{children:e(u,{id:"HKrBPX"})})]}):V?e(B,{children:[e("span",{children:e(u,{id:"Yx0Ud8"})}),e("span",{children:e(u,{id:"yTVtKs"})})]}):S?e(B,{children:[e(C,{icon:"lock"})," ",e("span",{children:e(u,{id:"MKEPCY"})})]}):g._({id:"MKEPCY"})})})]})]}),!!ue&&e(Fe,{onClose:()=>{Ie(!1)},children:e(Ec,{note:T,fields:I,onClose:()=>Ie(!1)})}),!!Me&&e(Fe,{onClose:()=>{Te(!1)},children:e(Rc,{accountID:O.current,onClose:()=>Te(!1)})}),!!Re&&e(Fe,{onClose:()=>{De(!1)},children:e(Lc,{account:t,note:Q,onRelationshipChange:G=>{v(G)},onClose:()=>De(!1)})}),!!we&&e(Fe,{onClose:()=>{X(!1)},children:e($c,{onClose:({state:G,account:pe}={})=>{X(!1),G==="success"&&pe&&a(pe)}})})]})}function xc([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 Ac(t){if(!t)return;const n=URL.parse(t),{host:i,pathname:s}=n,o=s.replace(/\/$/,"").replace(/^\//,"");return e(B,{children:[e("span",{class:"more-insignificant",children:[Gt.toUnicode(i),"/"]}),e("wbr",{}),e("span",{children:o})]})}function Ec({note:t,fields:n,onClose:i}){const s=(n==null?void 0:n.map(({name:a,value:p})=>`${a}
|
||
${_i(p)}`).join(`
|
||
|
||
`))||"",o=_i(t)+(s?`
|
||
|
||
${s}`:"");return e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(C,{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(as,{forceTranslate:!0,text:o})]})]})}function Rc({accountID:t,onClose:n}){const{masto:i}=oe(),[s,o]=L("default"),[a,p]=L([]),[r,c]=L([]),[l,m]=$t(d=>d+1,0);ee(()=>{o("loading"),(async()=>{try{const d=await sn();p(d);const v=await i.v1.accounts.$select(t).lists.list();c(v),o("default")}catch{o("error")}})()},[l]);const[h,f]=L(!1);return e("div",{class:"sheet",id:"list-add-remove-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{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]}),m()}catch{o("error"),alert(v?g._({id:"7KnEYa"}):g._({id:"Tba8uO"}))}})()},children:[e(C,{icon:"check-circle",alt:"☑️"}),e("span",{children:d.title})]})})})}):s==="loading"?e("p",{class:"ui-state",children:e(Ne,{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:()=>f(!0),disabled:s!=="default",children:[e(C,{icon:"plus",size:"l"})," ",e("span",{children:e(u,{id:"Sb2gYF"})})]})]}),h&&e(Fe,{onClick:d=>{d.target===d.currentTarget&&f(!1)},children:e(ui,{list:h==null?void 0:h.list,onClose:d=>{d.state==="success"&&m(),f(!1)}})})]})}function Lc({account:t,note:n,onRelationshipChange:i=()=>{},onClose:s=()=>{}}){const{masto:o}=oe(),[a,p]=L("default"),r=q(null);return ee(()=>{let c;return r.current&&!n&&(c=setTimeout(()=>{var l,m;(m=(l=r.current).focus)==null||m.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(C,{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 m=new FormData(c.target).get("note");(m==null?void 0:m.trim())!==(n==null?void 0:n.trim())&&(p("loading"),(async()=>{try{const h=await o.v1.accounts.$select(t==null?void 0:t.id).note.create({comment:m});p("default"),i(h),s()}catch(h){p("error"),alert((h==null?void 0:h.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(Ne,{abrupt:!0,hidden:a!=="loading"}),e("button",{disabled:a==="loading",type:"submit",children:e(u,{id:"SrwrEj"})})]})]})]})})]})}function $c({onClose:t=()=>{}}){const{masto:n}=oe(),[i,s]=L("loading"),[o,a]=L(null);ee(()=>{(async()=>{try{const h=await n.v1.accounts.verifyCredentials();a(h),s("default")}catch{s("error")}})()},[]);const{displayName:p,source:r}=o||{},{note:c,fields:l}=r||{},m=q(null);return e("div",{class:"sheet",id:"edit-profile-container",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(C,{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(Ne,{abrupt:!0})}):e("form",{onSubmit:h=>{h.preventDefault();const f=new FormData(h.target),d=f.get("display_name"),v=f.get("note"),b=m.current.querySelectorAll('input[name^="fields_attributes"]'),w=[];b.forEach(k=>{const y=k.name,[S,_,T]=y.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],I=k.value?k.value.trim():"";_&&T&&I&&(w[_]||(w[_]={}),w[_][T]=I)}),w.forEach(k=>{k.name&&!k.value&&(k.value="")}),(async()=>{try{const k=await n.v1.accounts.updateCredentials({displayName:d,note:v,fieldsAttributes:w});t==null||t({state:"success",account:k})}catch(k){alert((k==null?void 0:k.message)||g._({id:"FwMMx0"}))}})()},children:[e("p",{children:e("label",{children:[e(u,{id:"6YtxFj"})," ",e("input",{type:"text",name:"display_name",defaultValue:p,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:m,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((h,f)=>{const{name:d="",value:v=""}=l[f]||{};return e(Mc,{name:d,value:v,index:f,disabled:i==="loading"},f)})})]}),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 Mc({name:t,value:n,disabled:i,index:s}){const[o,a]=L(!!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:p=>a(!!p.currentTarget.value),dir:"auto"})})]})}function Dc({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 Nc({account:t,instance:n,onClose:i}){const{masto:s,instance:o,authenticated:a}=oe({instance:n}),p=typeof t=="string";return ee(()=>{p||(A.accounts[`${t.id}@${o}`]=t)},[t]),ks(i),e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close outer",onClick:i,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e(Is,{instance:o,authenticated:a,account:t,fetchAccount:async()=>{if(p)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:m,pathname:h}=l,f=h.replace(/^\//,"").replace(/\/$/,"")+"@"+m,d=await s.v2.search.fetch({q:f,type:"accounts",limit:1,resolve:a});if(d.accounts.length)return d.accounts[0]}}else return t}})]})}function Pc({onClose:t}){const{masto:n}=oe(),[i,s]=L("default"),[o,a]=L([]),[p,r]=$t(l=>l+1,0);ee(()=>{s("loading"),(async()=>{try{const l=await dt.drafts.keys();if(l.length){const m=bn(),h=l.filter(f=>f.startsWith(m));if(h.length){const f=await dt.drafts.getMany(h);f.sort((d,v)=>new Date(v.updatedAt).getTime()-new Date(d.updatedAt).getTime()),a(f)}else a([])}else a([]);s("default")}catch{s("error")}})()},[p]);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(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(u,{id:"krk5ws"})," ",e(Ne,{abrupt:!0,hidden:i!=="loading"})]}),c&&e("div",{class:"insignificant",children:e(u,{id:"Ap/10+"})})]}),e("main",{children:c?e(B,{children:[e("ul",{class:"drafts-list",children:o.map(l=>{const{updatedAt:m,key:h,draftStatus:f,replyTo:d}=l,v=new Date(m);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(C,{icon:d?"reply":"quill",size:"s"})," ",e("time",{children:[!!d&&e(B,{children:[e("span",{class:"bidi-isolate",children:["@",d.account.acct]}),e("br",{})]}),ut(v)]})]}),e(rt,{confirmLabel:e("span",{children:e(u,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:i==="loading",onClick:()=>{(async()=>{try{await dt.drafts.del(h),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:f,replyToStatus:b},A.showCompose=!0,A.showDrafts=!1},children:e(Oc,{draft:l})})]},m)})}),o.length>1&&e("p",{children:e(rt,{confirmLabel:e("span",{children:e(u,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:i==="loading",onClick:()=>{(async()=>{s("loading");try{await dt.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 Oc({draft:t}){var h;const{draftStatus:n,replyTo:i}=t,{status:s,spoilerText:o,poll:a,mediaAttachments:p}=n,r=((h=a==null?void 0:a.options)==null?void 0:h.length)>0,c=(p==null?void 0:p.length)>0,l=r||c,m=ke(()=>{if(!c)return;const f=p.find(b=>/image/.test(b.type));if(!f)return;const{file:d}=f;return URL.createObjectURL(d)},[c,p]);return e(B,{children:e("div",{class:"mini-draft",children:[l&&e("div",{class:`mini-draft-aside ${m?"has-image":""}`,style:m?{"--bg-image":`url(${m})`}:{},children:[r&&e(C,{icon:"poll",alt:g._({id:"4WUbF1"})}),c&&e("span",{children:[e(C,{icon:"attachment",alt:g._({id:"xYilR2"})})," ",e("small",{children:p==null?void 0:p.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 zc({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(C,{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(C,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:t},style:{"--width":i+"px","--height":s+"px","--aspect-ratio":`${i}/${s}`}})]})}function Uc({instance:t,excludeRelationshipAttrs:n=[],postID:i,onClose:s=()=>{},blankCopy:o=g._({id:"10OlfF"})}){const{masto:a,instance:p}=oe(),r=t?t===p:!0,c=He(A),[l,m]=L("default"),[h,f]=L([]),[d,v]=L(!1);if(ks(s),!c.showGenericAccounts)return null;const{id:b,heading:w,fetchAccounts:k,accounts:y,showReactions:S}=c.showGenericAccounts,[_,T]=L({}),I=async $=>{if(!($!=null&&$.length)||!r)return;const j=await ei($,_);j&&T({..._,...j})},x=$=>{k&&($&&f([]),m("loading"),(async()=>{try{const{done:j,value:Z}=await k($);if(Array.isArray(Z)){if($){const J=[];for(let N=0;N<Z.length;N++){const M=Z[N],z=J.find((V,U)=>V.id===M.id&&N!==U);z?z._types.push(...M._types):J.push({_types:[],...M})}f(J)}else f(J=>{const N=J;for(const M of Z){const z=N.find(V=>V.id===M.id);z?z._types.push(...M._types):N.push(M)}return N});v(!j),I(Z)}else v(!1);m("default")}catch{m("error")}})())},O=q(!0);ee(()=>{(y==null?void 0:y.length)>0?(f(y),I(y)):(x(!0),O.current=!1)},[y,k]),ee(()=>{var $;O.current||(($=c.reloadGenericAccounts)==null?void 0:$.id)===b&&x(!0)},[c.reloadGenericAccounts.counter]);const P=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(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:w||g._({id:"bPwFdf"})})}),e("main",{children:[P&&e(fe,{to:`/${t||p}/s/${P.id}`,class:"post-preview",children:e(qe,{status:P,size:"s",readOnly:!0})}),h.length>0?e(B,{children:[e("ul",{class:"accounts-list",children:h.map($=>{var J,N;const j=_[$.id],Z=`${$.id}-${((J=$._types)==null?void 0:J.length)||""}`;return e("li",{children:[S&&((N=$._types)==null?void 0:N.length)>0&&e("div",{class:"reactions-block",children:$._types.map(M=>e(C,{icon:{reblog:"rocket",favourite:"heart"}[M],class:`${M}-icon`}))}),e("div",{class:"account-relationships",children:e(at,{account:$,showStats:!0,relationship:j,excludeRelationshipAttrs:n})})]},Z)})}),l==="default"?d?e(wt,{onChange:$=>{$&&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(Ne,{abrupt:!0})})]}):l==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):l==="error"?e("p",{class:"ui-state",children:e(u,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:o})]})]})}function Fc({alt:t,lang:n,onClose:i}){const s=He(A),[o,a]=L(!1),p=ss(!0),r=s.settings.contentTranslationHideLanguages||[],c=!!n&&n!==p&&!vi([n],[p])&&!r.find(l=>n===l||vi([n],[l]));return e("div",{class:"sheet",tabindex:"-1",children:[!!i&&e("button",{type:"button",class:"sheet-close outer",onClick:i,children:e(C,{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(ct,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(C,{icon:"more",alt:g._({id:"2FYpfJ"}),size:"xl"})}),children:[e(ye,{disabled:o,onClick:()=>{a(!0)},children:[e(C,{icon:"translate"}),e("span",{children:e(u,{id:"pi8x/S"})})]}),ko&&e(ye,{onClick:()=>{_o(t,n)},children:[e(C,{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(as,{forceTranslate:o,sourceLanguage:n,text:t})]})]})}function Mn(t,n,i){return Math.max(Math.min(t,i),n)}const Dn=t=>t>=.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,Nn=t=>t>=.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t;function hi([t,n,i]){t=Dn(t/255),n=Dn(n/255),i=Dn(i/255);var s=.4122214708*t+.5363325363*n+.0514459929*i,o=.2119034982*t+.6806995451*n+.1073969566*i,a=.0883024619*t+.2817188376*n+.6299787005*i;return s=Math.cbrt(s),o=Math.cbrt(o),a=Math.cbrt(a),[s*.2104542553+o*.793617785+a*-.0040720468,s*1.9779984951+o*-2.428592205+a*.4505937099,s*.0259040371+o*.7827717662+a*-.808675766]}function fi([t,n,c]){var s=t+n*.3963377774+c*.2158037573,o=t+n*-.1055613458+c*-.0638541728,a=t+n*-.0894841775+c*-1.291485548;s=s**3,o=o**3,a=a**3;var p=s*4.0767416621+o*-3.3077115913+a*.2309699292,r=s*-1.2684380046+o*2.6097574011+a*-.3413193965,c=s*-.0041960863+o*-.7034186147+a*1.707614701;return p=255*Nn(p),r=255*Nn(r),c=255*Nn(c),p=Mn(p,0,255),r=Mn(r,0,255),c=Mn(c,0,255),p=Math.round(p),r=Math.round(r),c=Math.round(c),[p,r,c]}const Bc={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:Rl}=Bc;function Ts({mediaAttachments:t,statusID:n,instance:i,lang:s,index:o=0,onClose:a=()=>{}}){var y,S;const[p,r]=L("default"),c=q(null),[l,m]=L(o),h=q(null);yt(()=>{var _;(_=h.current)==null||_.scrollIntoView()},[]);const f=q(n);ee(()=>{const _=o*c.current.clientWidth,T=f.current!==n;T&&(f.current=n),c.current.focus(),c.current.scrollTo({left:_*(Et()?-1:1),behavior:T?"auto":"smooth"})},[o,n]);const[d,v]=L(!0);ee(()=>{let _=()=>{a()};return c.current&&c.current.addEventListener("swiped-down",_),()=>{c.current&&c.current.removeEventListener("swiped-down",_)}},[]),Be("esc",a,{ignoreEventWhen:_=>!!document.querySelector("#modal-container > *")},[a]),ee(()=>{let _=()=>{const{clientWidth:T,scrollLeft:I}=c.current,x=Math.round(Math.abs(I)/T);m(x)};return c.current&&c.current.addEventListener("scroll",_,{passive:!0}),()=>{c.current&&c.current.removeEventListener("scroll",_)}},[]),ee(()=>{let _=setTimeout(()=>{var T,I;(I=(T=c.current)==null?void 0:T.focus)==null||I.call(T)},100);return()=>clearTimeout(_)},[]);const b=ke(()=>t==null?void 0:t.map(_=>{const{blurhash:T}=_;if(T){const I=ti(T),x=hi(I);return fi([.6,x[1],x[2]])}return null}),[t]),w=ke(()=>{var I;const T=100/b.length;return((I=b==null?void 0:b.map((x,O)=>{const P=O*T+5,$=(O+1)*T-5;return x?`
|
||
rgba(${x==null?void 0:x.join(",")}, 0.4) ${P}%,
|
||
rgba(${x==null?void 0:x.join(",")}, 0.4) ${$}%
|
||
`:`
|
||
transparent ${P}%,
|
||
transparent ${$}%
|
||
`}))==null?void 0:I.join(", "))||"transparent"},[b]);let k=q(null);return ee(()=>()=>{var _,T;(T=(_=k.current)==null?void 0:_.hideToast)==null||T.call(_)},[]),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:_=>{(_.target.classList.contains("carousel-item")||_.target.classList.contains("media")||_.target.classList.contains("media-zoom"))&&a()},style:t.length>1?{backgroundAttachment:"local",backgroundImage:`linear-gradient(
|
||
to ${Et()?"left":"right"}, ${w})`}:{},children:t==null?void 0:t.map((_,T)=>{const I=t.length===1?b[T]:null;return e("div",{class:"carousel-item",style:I?{"--accent-color":`rgb(${I==null?void 0:I.join(",")})`,"--accent-alpha-color":`rgba(${I==null?void 0:I.join(",")}, 0.4)`}:{},tabindex:"0",ref:T===l?h:null,onClick:x=>{x.target.classList.contains("media")||v(!d)},children:[!!_.description&&e("button",{type:"button",class:"media-alt",hidden:!d,onClick:()=>{A.showMediaAlt={alt:_.description,lang:s}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:s,dir:"auto",children:_.description})]}),e(rs,{media:_,showOriginal:!0,lang:s})]},_.id)})}),e("div",{class:"carousel-top-controls",hidden:!d,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:()=>a(),children:e(C,{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:T===l,class:`carousel-dot ${T===l?"active":""}`,onClick:I=>{I.preventDefault(),I.stopPropagation();const x=c.current.clientWidth*T*(Et()?-1:1);c.current.scrollTo({left:x,behavior:"smooth"}),c.current.focus()},children:e(C,{icon:"round",size:"s",alt:"⸱"})},_.id))}):e("span",{}),e("span",{children:[e(ct,{overflow:"auto",align:"end",position:"anchor",gap:4,menuClassName:"glass-menu",menuButton:e("button",{type:"button",class:"carousel-button",children:e(C,{icon:"more",alt:g._({id:"2FYpfJ"})})}),children:[e(Ue,{href:((y=t[l])==null?void 0:y.remoteUrl)||((S=t[l])==null?void 0:S.url),class:"carousel-button",target:"_blank",title:g._({id:"5hXGws"}),children:[e(C,{icon:"popout"}),e("span",{children:e(u,{id:"aDr7Vc"})})]}),!1]})," ",e(fe,{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:_=>{_.preventDefault(),_.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(l-1)*(Et()?-1:1),behavior:"smooth"})},children:e(C,{icon:"arrow-left",alt:g._({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:l===t.length-1,onClick:_=>{_.preventDefault(),_.stopPropagation(),c.current.focus(),c.current.scrollTo({left:c.current.clientWidth*(l+1)*(Et()?-1:1),behavior:"smooth"})},children:e(C,{icon:"arrow-right",alt:g._({id:"hXzOVo"})})})]})]})}const Hc=[,"spam","legal","violation","other"],Kt={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 qc({account:t,post:n,onClose:i}){const{_:s}=Je(),{masto:o}=oe(),[a,p]=L("default"),[r,c]=t.acct.split("@"),[l,m]=ke(()=>{const{rules:y,domain:S}=Qi();return[y||[],S]}),[h,f]=L(null),[d,v]=L(!1),b=q(null),[w,k]=L(!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(C,{icon:"x",size:"xl",alt:g._({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:n?e(qe,{status:n,size:"s",previewMode:!0}):e(at,{account:t,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!h&&!Kt[h].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[s(Kt[h].stampLabel||s(Kt[h].label)),e("small",{children:e(u,{id:"2WtL62"})})]},h),e("form",{onSubmit:y=>{y.preventDefault();const S=new FormData(y.target),_=Object.fromEntries(S.entries());let{category:T,comment:I,forward:x}=_;I||(I=void 0),x==="on"&&(x=!0);const O=T==="violation"?Object.entries(_).filter(([$])=>$.startsWith("rule_ids")).map(([$,j])=>j):void 0,P={category:T,comment:I,forward:x,ruleIds:O};p("loading"),(async()=>{try{await o.v1.reports.create({accountId:t.id,statusIds:n!=null&&n.id?[n.id]:void 0,category:T,comment:I,ruleIds:O,forward:x}),p("success"),he(n?g._({id:"y3ou+8"}):g._({id:"R9kjEL"})),i()}catch($){p("error"),he(($==null?void 0:$.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:Hc.map(y=>y==="violation"&&!(l!=null&&l.length)?null:e(B,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:y,required:!0,disabled:a==="loading",onChange:S=>{f(S.target.value),v(S.target.value==="violation")}}),e("span",{children:[s(Kt[y].label)," ",e("small",{class:"ib insignificant",children:s(Kt[y].description)})]})]}),y==="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((S,_)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${_}]`,value:S.id,required:d&&!w,disabled:a==="loading",onChange:T=>{const{checked:I}=T.target;I?k(!0):b.current.querySelectorAll("input:checked").length||k(!1)}}),e("span",{children:S.text})]},S.id))})})})]},y))}),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!==m&&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(),he(g._({id:"/BGBeF",values:{username:r}}))}catch{he(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(),he(g._({id:"kjUejn",values:{username:r}}))}catch{he(g._({id:"pMcdDp",values:{username:r}}))}},children:e(u,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(Ne,{hidden:a!=="loading"})]})]})]})]})}var pi={exports:{}},Ll=pi.exports;(function(t){var n=function(){var i=String.fromCharCode,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function p(c,l){if(!a[c]){a[c]={};for(var m=0;m<c.length;m++)a[c][c.charAt(m)]=m}return a[c][l]}var r={compressToBase64:function(c){if(c==null)return"";var l=r._compress(c,6,function(m){return s.charAt(m)});switch(l.length%4){default:case 0:return l;case 1:return l+"===";case 2:return l+"==";case 3:return l+"="}},decompressFromBase64:function(c){return c==null?"":c==""?null:r._decompress(c.length,32,function(l){return p(s,c.charAt(l))})},compressToUTF16:function(c){return c==null?"":r._compress(c,15,function(l){return i(l+32)})+" "},decompressFromUTF16:function(c){return c==null?"":c==""?null:r._decompress(c.length,16384,function(l){return c.charCodeAt(l)-32})},compressToUint8Array:function(c){for(var l=r.compress(c),m=new Uint8Array(l.length*2),h=0,f=l.length;h<f;h++){var d=l.charCodeAt(h);m[h*2]=d>>>8,m[h*2+1]=d%256}return m},decompressFromUint8Array:function(c){if(c==null)return r.decompress(c);for(var l=new Array(c.length/2),m=0,h=l.length;m<h;m++)l[m]=c[m*2]*256+c[m*2+1];var f=[];return l.forEach(function(d){f.push(i(d))}),r.decompress(f.join(""))},compressToEncodedURIComponent:function(c){return c==null?"":r._compress(c,6,function(l){return o.charAt(l)})},decompressFromEncodedURIComponent:function(c){return c==null?"":c==""?null:(c=c.replace(/ /g,"+"),r._decompress(c.length,32,function(l){return p(o,c.charAt(l))}))},compress:function(c){return r._compress(c,16,function(l){return i(l)})},_compress:function(c,l,m){if(c==null)return"";var h,f,d={},v={},b="",w="",k="",y=2,S=3,_=2,T=[],I=0,x=0,O;for(O=0;O<c.length;O+=1)if(b=c.charAt(O),Object.prototype.hasOwnProperty.call(d,b)||(d[b]=S++,v[b]=!0),w=k+b,Object.prototype.hasOwnProperty.call(d,w))k=w;else{if(Object.prototype.hasOwnProperty.call(v,k)){if(k.charCodeAt(0)<256){for(h=0;h<_;h++)I=I<<1,x==l-1?(x=0,T.push(m(I)),I=0):x++;for(f=k.charCodeAt(0),h=0;h<8;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1}else{for(f=1,h=0;h<_;h++)I=I<<1|f,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=0;for(f=k.charCodeAt(0),h=0;h<16;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1}y--,y==0&&(y=Math.pow(2,_),_++),delete v[k]}else for(f=d[k],h=0;h<_;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1;y--,y==0&&(y=Math.pow(2,_),_++),d[w]=S++,k=String(b)}if(k!==""){if(Object.prototype.hasOwnProperty.call(v,k)){if(k.charCodeAt(0)<256){for(h=0;h<_;h++)I=I<<1,x==l-1?(x=0,T.push(m(I)),I=0):x++;for(f=k.charCodeAt(0),h=0;h<8;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1}else{for(f=1,h=0;h<_;h++)I=I<<1|f,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=0;for(f=k.charCodeAt(0),h=0;h<16;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1}y--,y==0&&(y=Math.pow(2,_),_++),delete v[k]}else for(f=d[k],h=0;h<_;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1;y--,y==0&&(y=Math.pow(2,_),_++)}for(f=2,h=0;h<_;h++)I=I<<1|f&1,x==l-1?(x=0,T.push(m(I)),I=0):x++,f=f>>1;for(;;)if(I=I<<1,x==l-1){T.push(m(I));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,m){var h=[],f,d=4,v=4,b=3,w="",k=[],y,S,_,T,I,x,O,P={val:m(0),position:l,index:1};for(y=0;y<3;y+=1)h[y]=y;for(_=0,I=Math.pow(2,2),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),_|=(T>0?1:0)*x,x<<=1;switch(f=_){case 0:for(_=0,I=Math.pow(2,8),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),_|=(T>0?1:0)*x,x<<=1;O=i(_);break;case 1:for(_=0,I=Math.pow(2,16),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),_|=(T>0?1:0)*x,x<<=1;O=i(_);break;case 2:return""}for(h[3]=O,S=O,k.push(O);;){if(P.index>c)return"";for(_=0,I=Math.pow(2,b),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),_|=(T>0?1:0)*x,x<<=1;switch(O=_){case 0:for(_=0,I=Math.pow(2,8),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),_|=(T>0?1:0)*x,x<<=1;h[v++]=i(_),O=v-1,d--;break;case 1:for(_=0,I=Math.pow(2,16),x=1;x!=I;)T=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=m(P.index++)),_|=(T>0?1:0)*x,x<<=1;h[v++]=i(_),O=v-1,d--;break;case 2:return k.join("")}if(d==0&&(d=Math.pow(2,b),b++),h[O])w=h[O];else if(O===v)w=S+S.charAt(0);else return null;k.push(w),h[v++]=S+w.charAt(0),d--,S=w,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})})(pi);var Mi=pi.exports;const jc="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",Yc="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",Vc="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",Gc=200,Kc=10;async function kn(){const{masto:t}=oe(),n=t.v1.followedTags.list({limit:Gc}),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(s<Kc);return i.sort((o,a)=>o.name.localeCompare(a.name)),i.length&&setTimeout(()=>{ge.account.set("followedTags",{tags:i,updatedAt:Date.now()})},1),i}const Wc=24*60*60*1e3;async function Zc(){try{const{tags:t,updatedAt:n}=ge.account.get("followedTags")||{};return t!=null&&t.length?(Date.now()-n>Wc&&kn(),t):await kn()}catch{return[]}}const Di=document.createElement("div"),Xc=t=>{if(!t)return[];if(t.indexOf("#")===-1)return[];Di.innerHTML=t;const n=Di.querySelectorAll("a.hashtag");return n.length?Array.from(n).map(i=>i.innerText.trim().replace(/^[^#]*#+/,"")):[]};function un({children:t}){if(typeof t=="string")return t;const[n,i]=L("");return ee(()=>{Promise.resolve(t).then(i)},[t]),n}const bt=9,Jc=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],xs={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"}},hn={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}]},Qc=kt(async({id:t})=>{const n=await oe().masto.v1.accounts.$select(t).fetch();return n.username||n.acct||n.displayName}),_n={following:{id:"home",title:(t,n)=>n===0?g._({id:"i0qMbr"}):g._({id:"y6sq5j"}),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?gc(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||oe().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||oe().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:Qc,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||oe().instance,path:({hashtag:t,instance:n,media:i})=>`${n?`/${n}`:""}/t/${t.split(/\s+/).join("+")}${i?"?media=1":""}`,icon:"hashtag"}};function ea({onClose:t}){const{_:n}=Je(),i=He(A),{shortcuts:s}=i,[o,a]=L(!1),[p,r]=L(!1),[c]=ai();return e("div",{id:"shortcuts-settings-container",class:"sheet",tabindex:"-1",children:[!!t&&e("button",{type:"button",class:"sheet-close",onClick:t,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(C,{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:jc},{value:"tab-menu-bar",label:g._({id:"UxBoCm"}),imgURL:Vc},{value:"multi-column",label:g._({id:"uvDfdW"}),imgURL:Yc}].map(({value:l,label:m,imgURL:h})=>{const f=i.settings.shortcutsViewMode===l||l==="float-button"&&!i.settings.shortcutsViewMode;return e("label",{class:f?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:l,checked:f,onChange:d=>{A.settings.shortcutsViewMode=d.target.value}})," ",e("img",{src:h,alt:"",width:"80",height:"58"})," ",e("span",{children:m})]},l)})}),s.length>0?e(B,{children:[e("ol",{class:"shortcuts-list",ref:c,children:s.filter(Boolean).map((l,m)=>{const h=Object.values(l).join("-"),{type:f}=l;if(!_n[f])return null;let{icon:d,title:v,subtitle:b,excludeViewMode:w}=_n[f];typeof v=="function"?v=v(l,m):v=n(v),typeof b=="function"?b=b(l,m):b=n(b),typeof d=="function"&&(d=d(l,m)),typeof w=="function"&&(w=w(l,m));const k=w==null?void 0:w.includes(i.settings.shortcutsViewMode);return e("li",{children:[e(C,{icon:d}),e("span",{class:"shortcut-text",children:[e(un,{children:v}),b&&e(B,{children:[" ",e("small",{class:"ib insignificant",children:b})]}),k&&e("span",{class:"tag",children:e(u,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:m===0,onClick:()=>{const y=Array.from(A.shortcuts);if(m>0){const S=A.shortcuts[m-1];y[m-1]=l,y[m]=S,A.shortcuts=y}},children:e(C,{icon:"arrow-up",alt:g._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:m===s.length-1,onClick:()=>{const y=Array.from(A.shortcuts);if(m<A.shortcuts.length-1){const S=A.shortcuts[m+1];y[m+1]=l,y[m]=S,A.shortcuts=y}},children:e(C,{icon:"arrow-down",alt:g._({id:"3Ib6FN"})})}),e("button",{type:"button",class:"plain small",onClick:()=>{a({shortcut:l,shortcutIndex:m})},children:e(C,{icon:"pencil",alt:g._({id:"ePK91l"})})})]})]},h)})}),s.length===1&&i.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(C,{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>=bt&&(i.settings.shortcutsViewMode==="multi-column"?g._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:bt}}):g._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:bt}}))}),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>=bt,onClick:()=>a(!0),children:[e(C,{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:m})=>{m==="edit"?A.shortcuts[o.shortcutIndex]=l:A.shortcuts.push(l)},onClose:()=>a(!1)})}),p&&e(Fe,{onClick:l=>{l.target===l.currentTarget&&r(!1)},children:e(na,{shortcuts:s,onClose:()=>r(!1)})})]})}const Ni={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function ta({onSubmit:t,disabled:n,shortcut:i,shortcutIndex:s,onClose:o}){var w,k;const{_:a}=Je(),p=!!i,[r,c]=L((i==null?void 0:i.type)||null),[l,m]=L("default"),[h,f]=L([]),[d,v]=L([]);ee(()=>{(async()=>{if(r==="list")try{m("loading");const y=await sn();f(y),m("default")}catch{m("error")}})(),(async()=>{if(r==="hashtag")try{const y=await kn();v(y)}catch{}})()},[r]);const b=q();return ee(()=>{if(p&&r&&hn[r]){const y=b.current;hn[r].forEach(({name:S,type:_})=>{const T=y.querySelector(`[name="${S}"]`);T&&i[S]&&(_==="checkbox"?T.checked=i[S]==="on":T.value=i[S])})}},[p,r]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:p?g._({id:"pe1jog"}):g._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:b,onSubmit:y=>{y.preventDefault();const S=new FormData(y.target),_={};S.forEach((T,I)=>{_[I]=T==null?void 0:T.trim(),I==="instance"&&(_[I]=_[I].replace(/^https?:\/\//,"").replace(/\/+$/,""),_[I]=_[I].replace(/^@?[^@]+@/,""))}),_.type&&(t({result:_,mode:p?"edit":"add"}),y.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:y=>{c(y.target.value)},defaultValue:p?i.type:void 0,name:"type",dir:"auto",children:[e("option",{}),Jc.map(y=>e("option",{value:y,children:a(xs[y])}))]})]})}),(k=(w=hn[r])==null?void 0:w.map)==null?void 0:k.call(w,({text:y,name:S,type:_,placeholder:T,pattern:I,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:p?i.id:void 0,dir:"auto",children:[e("option",{value:""}),h.map(O=>e("option",{value:O.id,children:O.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:a(y)})," ",e("input",{type:_,switch:_==="checkbox"||void 0,name:S,placeholder:a(T),required:_==="text"&&!x,disabled:n,list:r==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:I,dir:"auto"}),r==="hashtag"&&d.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:d.map(O=>e("option",{value:O.name}))})]})})),!!Ni[r]&&e("p",{class:"form-note insignificant",children:[e(C,{icon:"info"}),a(Ni[r])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:n||l==="loading",children:p?g._({id:"tfDRzk"}):g._({id:"m16xKo"})}),p&&e("button",{type:"button",class:"light danger",onClick:()=>{A.shortcuts.splice(s,1),o==null||o()},children:e(u,{id:"t/YqKh"})})]})]})})]})}function na({shortcuts:t,onClose:n}){var f;const{_:i}=Je(),{masto:s}=oe(),o=ke(()=>!t||!t.filter(Boolean).length?"":Mi.compressToEncodedURIComponent(JSON.stringify(t.filter(Boolean))),[t]),[a,p]=L(""),[r,c]=L("default"),l=ke(()=>{if(!a)return c("default"),null;try{const d=JSON.parse(Mi.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]),m=A.shortcuts.length>0,h=q();return e("div",{id:"import-export-container",class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{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(C,{icon:"arrow-down-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(u,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:h,type:"text",name:"import",placeholder:g._({id:"tBmklN"}),class:"block",onInput:d=>{p(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=vt();he(g._({id:"HLqLGx"}));try{const b=(await s.v1.accounts.relationships.fetch({id:[d]}))[0];if(b){const{note:w=""}=b;if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)){const k=w.match(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/)[1],{v:y,dt:S,data:_}=JSON.parse(k);h.current.value=_,h.current.dispatchEvent(new Event("input"))}}c("default")}catch{c("error"),he(g._({id:"gCDfX+"}))}},title:g._({id:"B6cG3J"}),children:[e(C,{icon:"cloud"}),e(C,{icon:"arrow-down"})]})]}),!!l&&Array.isArray(l)&&e(B,{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(w=>Object.keys(w).every(k=>w[k]===d[k]))?1:0},children:"*"}),e("span",{children:[i(xs[d.type]),d.type==="list"&&" ⚠️"," ",(b=(v=hn[d.type])==null?void 0:v.map)==null?void 0:b.call(v,({text:w,name:k,type:y})=>d[k]?e(B,{children:[e("span",{class:"tag collapsed insignificant",children:[w,":"," ",y==="checkbox"?d[k]==="on"?"✅":"❌":d[k]]})," "]}):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:[m&&e(B,{children:[e(rt,{confirmLabel:g._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(u,{id:"nl8sCE"})}),onClick:()=>{const d=l.filter(w=>!A.shortcuts.some(k=>Object.keys(k).every(y=>k[y]===w[y])));if(!d.length){he(g._({id:"o6L30P"}));return}let v=[...A.shortcuts,...d];const b=v.length>bt;b&&(v=v.slice(0,bt)),A.shortcuts=v,he(b?g._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:bt}}):g._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:e(u,{id:"c89gCv"})})})," "]}),e(rt,{confirmLabel:m?g._({id:"6ZjzWP"}):g._({id:"DWumLi"}),menuItemClassName:m?"danger":void 0,onClick:()=>{A.shortcuts=l,he(g._({id:"QO9uTx"})),n==null||n()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:m?g._({id:"uIp8WL"}):g._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(C,{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),he(g._({id:"cWtH+v"}))}catch{he(g._({id:"yUWyHa"}))}}},dir:"auto"})}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!o,onClick:()=>{try{navigator.clipboard.writeText(o),he(g._({id:"+Kq2vY"}))}catch{he(g._({id:"tFvxZF"}))}},children:[e(C,{icon:"clipboard"})," ",e("span",{children:e(u,{id:"he3ygx"})})]})," ",(navigator==null?void 0:navigator.share)&&((f=navigator==null?void 0:navigator.canShare)==null?void 0:f.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(C,{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=vt();try{const b=(await s.v1.accounts.relationships.fetch({id:[d]}))[0];if(b){const{note:w=""}=b;let k="";const y=JSON.stringify({v:"1",dt:Date.now(),data:o});/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)?k=w.replace(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,`<phanpy-shortcuts-settings>${y}</phanpy-shortcuts-settings>`):k=`${w}
|
||
|
||
|
||
<phanpy-shortcuts-settings>${y}</phanpy-shortcuts-settings>`,he(g._({id:"9ZYiLz"})),await s.v1.accounts.$select(d).note.create({comment:k}),c("default"),he(g._({id:"5w02SH"}))}}catch{c("error"),he(g._({id:"aVsTYo"}))}},title:g._({id:"gWd6Cu"}),children:[e(C,{icon:"cloud"}),e(C,{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(C,{icon:"cloud"})," ",e(u,{id:"C4T6O/"})]})})]})]})}es(A,t=>{for(const[n,i,s,o]of t)/^show/i.test(i)&&!s&&jn()});function ia(){var s,o,a,p,r,c,l,m;const t=He(A),n=ts(),i=Yt();return ee(()=>{setTimeout(to,1e3)},[]),e(B,{children:[!!t.showCompose&&e(Fe,{class:`solid ${t.composerState.minimized?"min":""}`,minimized:!!t.composerState.minimized,children:e(no,{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:((p=A.showCompose)==null?void 0:p.draftStatus)||((r=window.__COMPOSE__)==null?void 0:r.draftStatus)||null,onClose:h=>{const{newStatus:f,instance:d,type:v}=h||{};A.showCompose=!1,window.__COMPOSE__=null,f&&(A.reloadStatusPage++,he({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/${f.id}`:`/s/${f.id}`)}}))}})}),!!t.showSettings&&e(Fe,{onClose:()=>{A.showSettings=!1},children:e(hc,{onClose:()=>{A.showSettings=!1}})}),!!t.showAccounts&&e(Fe,{onClose:()=>{A.showAccounts=!1},children:e(tc,{onClose:()=>{A.showAccounts=!1}})}),!!t.showAccount&&e(Fe,{onClose:()=>{A.showAccount=!1},children:e(Nc,{account:((c=t.showAccount)==null?void 0:c.account)||t.showAccount,instance:(l=t.showAccount)==null?void 0:l.instance,onClose:({destination:h}={})=>{A.showAccount=!1}})}),!!t.showDrafts&&e(Fe,{onClose:()=>{A.showDrafts=!1},children:e(Pc,{onClose:()=>A.showDrafts=!1})}),!!t.showMediaModal&&e(Fe,{onClick:h=>{(h.target===h.currentTarget||h.target.classList.contains("media"))&&(A.showMediaModal=!1)},children:e(Ts,{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(ea,{onClose:()=>A.showShortcutsSettings=!1})}),!!t.showGenericAccounts&&e(Fe,{onClose:()=>{A.showGenericAccounts=!1},children:e(Uc,{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:h=>{A.showMediaAlt=!1},children:e(Fc,{alt:t.showMediaAlt.alt||t.showMediaAlt,lang:(m=t.showMediaAlt)==null?void 0:m.lang,onClose:()=>{A.showMediaAlt=!1}})}),!!t.showEmbedModal&&e(Fe,{class:"solid",onClose:()=>{A.showEmbedModal=!1},children:e(zc,{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(qc,{account:t.showReportModal.account,post:t.showReportModal.post,onClose:()=>{A.showReportModal=!1}})})]})}function Vn({accountID:t,onChange:n}){const{masto:i}=oe(),[s,o]=L("default"),[a,p]=L(null),[r,c]=L(null),l=r!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:s==="loading"||l,onClick:()=>{o("loading"),p("accept"),(async()=>{try{const m=await i.v1.followRequests.$select(t).authorize();if(!(m!=null&&m.followedBy))throw new Error("Follow request not accepted");c(m),n()}catch{}o("default")})()},children:e(u,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:s==="loading"||l,class:"light danger",onClick:()=>{o("loading"),p("reject"),(async()=>{try{const m=await i.v1.followRequests.$select(t).reject();if(m!=null&&m.followedBy)throw new Error("Follow request not rejected");c(m),n()}catch{o("default")}})()},children:e(u,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:l&&a?a==="accept"?e(C,{icon:"check-circle",alt:g._({id:"bzMKg7"}),class:"follow-accepted"}):e(C,{icon:"x-circle",alt:g._({id:"ekCRTP"}),class:"follow-rejected"}):e(Ne,{hidden:s!=="loading"})})]})}const Pi={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 Oi({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(So,{url:s,staticUrl:o,alt:n}):n;return e(u,{id:"i5uN6K",values:{account:t,emojiObject:a}})}const Pn={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:Ge(t),1:Ge(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:Ge(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:Ge(n),1:Ge(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:Ge(t),1:Ge(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:Oi,"pleroma:emoji_reaction":Oi},sa={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",{})}})},oa={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"}},On=30;function ca({notification:t,instance:n,isStatic:i,disableContextMenu:s}){var ie,Q,de,Ce,te,be;const{_:o}=Je(),{masto:a}=oe(),{id:p,status:r,account:c,report:l,event:m,moderation_warning:h,_ids:f,_accounts:d,_statuses:v,_groupKeys:b,sampleAccounts:w,notificationsCount:k,groupKey:y}=t;let{type:S}=t;if(S==="mention"&&!r)return null;const _=(r==null?void 0:r.reblog)||r,T=_==null?void 0:_.id,I=vt(),x=I===(c==null?void 0:c.id),O=(ie=r==null?void 0:r.poll)==null?void 0:ie.voted,P=!!(r!=null&&r.inReplyToAccountId)&&(r==null?void 0:r.inReplyToAccountId)!==I&&((Q=r==null?void 0:r.account)==null?void 0:Q.id)===I;let $=0,j=0;if(S==="favourite+reblog"){if(d)for(const K of d)(de=K._types)!=null&&de.includes("favourite")&&$++,(Ce=K._types)!=null&&Ce.includes("reblog")&&j++;!j&&$&&(S="favourite"),!$&&j&&(S="reblog")}let Z;S==="poll"?Z=Pn[x?"poll-self":O?"poll-voted":"poll"]:Pn[S]?Z=Pn[S]:Z=g._({id:"ODqZt1",values:{type:S}});const J=({clickable:K,...ae})=>K?e("b",{tabIndex:"0",onClick:z,...ae}):e("b",{...ae});if(typeof Z=="function"){const K=(d==null?void 0:d.length)||(w==null?void 0:w.length)||(c?1:0),ae=(v==null?void 0:v.length)||(r?1:0);if(S==="admin.report"){const ue=l==null?void 0:l.targetAccount;ue&&(Z=Z({account:e(pt,{account:c,showAvatar:!0}),targetAccount:e(pt,{account:ue,showAvatar:!0})}))}else if(S==="severed_relationships"){const ue=m==null?void 0:m.targetName;ue&&(Z=Z({name:ue}))}else if((S==="emoji_reaction"||S==="pleroma:emoji_reaction")&&t.emoji){const ue=t.emoji_url||((be=(te=r==null?void 0:r.emojis)==null?void 0:te.find)==null?void 0:be.call(te,Ie=>(Ie==null?void 0:Ie.shortcode)===t.emoji.replace(/^:/,"").replace(/:$/,"")));Z=Z({account:e(pt,{account:c,showAvatar:!0}),emoji:t.emoji,emojiURL:ue})}else Z=Z({account:c?e(pt,{account:c,showAvatar:!0}):(w==null?void 0:w[0])&&e(pt,{account:w[0],showAvatar:!0}),count:K,postsCount:ae,postType:P?"reply":"post",components:{Subject:J}})}const N=t.createdAt&&new Date(t.createdAt).toLocaleString(),M={"favourite+reblog":g._({id:"+XOeb+"}),favourite:g._({id:"LQFF6J"}),reblog:g._({id:"phQpSa"}),follow:g._({id:"Ih01jh"})}[S]||g._({id:"bPwFdf"}),z=()=>{A.showGenericAccounts={heading:M,accounts:d,showReactions:S==="favourite+reblog",excludeRelationshipAttrs:S==="follow"?["followedBy"]:[],postID:nt(T,n)}},U=k>0&&k>(w==null?void 0:w.length)?"remote":"local";return e("div",{class:`notification notification-${S}`,"data-notification-id":f||p,"data-group-key":(b==null?void 0:b.join(" "))||y,tabIndex:"0",children:[e("div",{class:`notification-type notification-${S}`,title:N,children:S==="favourite+reblog"?e(B,{children:[e(C,{icon:"rocket",size:"xl",alt:S,class:"reblog-icon"}),e(C,{icon:"heart",size:"xl",alt:S,class:"favourite-icon"})]}):e(C,{icon:Pi[S]||"notification",size:"xl",alt:S})}),e("div",{class:"notification-content",children:[S!=="mention"&&e(B,{children:[e("p",{children:Z}),S==="follow_request"&&e(Vn,{accountID:c.id}),S==="severed_relationships"&&e("div",{children:[sa[m.type]({from:n,...m}),e("br",{}),e("a",{href:`https://${n}/severed_relationships`,target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"YL6Y8P",components:{0:e(C,{icon:"external",size:"s"})}})}),"."]}),S==="moderation_warning"&&!!h&&e("div",{children:[o(oa[h.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${h.id}`,target:"_blank",rel:"noopener noreferrer",children:e(u,{id:"YL6Y8P",components:{0:e(C,{icon:"external",size:"s"})}})})]})]}),(d==null?void 0:d.length)>1&&e("p",{class:"avatars-stack",children:[d.slice(0,On).map(K=>e(B,{children:[e("a",{href:K.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:ae=>{ae.preventDefault(),A.showAccount=K},children:[e(lt,{url:K.avatarStatic,size:d.length<=10?"xxl":d.length<20?"xl":"l",alt:`${K.displayName} @${K.acct}`,squircle:K==null?void 0:K.bot},K.id),S==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:K._types.map(ae=>e(C,{icon:Pi[ae],size:"s",class:`${ae}-icon`}))})]},K.id)," "]},K.id)),S==="favourite+reblog"&&U==="remote"?e("button",{type:"button",class:"small plain","data-group-keys":b==null?void 0:b.join(" "),onClick:()=>{A.showGenericAccounts={heading:M,fetchAccounts:async()=>{const K=await Promise.allSettled(b.map(async ue=>{const Ie=a.v2.notifications.$select(ue).accounts.list();return[ue,(await Ie.next()).value]})),ae=[];for(const ue of K){const[Ie,Me]=ue.value,Te=/^favourite/.test(Ie)?"favourite":/^reblog/.test(Ie)?"reblog":null;if(Te)for(const Re of Me){const De=ae.find(we=>we.id===Re.id);De?De._types.push(Te):(Re._types=[Te],ae.push(Re))}}return{done:!0,value:ae}},showReactions:!0,postID:nt(T,n)}},children:e(C,{icon:"chevron-down"})}):e("button",{type:"button",class:"small plain",onClick:z,children:[d.length>On&&`+${d.length-On}`,e(C,{icon:"chevron-down"})]})]}),!(d!=null&&d.length)&&(w==null?void 0:w.length)>1&&e("p",{class:"avatars-stack",children:[w.map(K=>e(B,{children:[e("a",{href:K.url,rel:"noopener noreferrer",class:"account-avatar-stack",onClick:ae=>{ae.preventDefault(),A.showAccount=K},children:e(lt,{url:K.avatarStatic,size:"xxl",alt:`${K.displayName} @${K.acct}`,squircle:K==null?void 0:K.bot},K.id)},K.id)," "]},K.id)),k>w.length&&e(fe,{to:n?`/${n}/s/${r.id}`:`/s/${r.id}`,class:"button small plain centered",children:["+",k-w.length,e(C,{icon:"chevron-right"})]})]}),(v==null?void 0:v.length)>1&&e("ul",{class:"notification-group-statuses",children:v.map(K=>e("li",{children:e(zi,{class:`status-link status-type-${S}`,to:n?`/${n}/s/${K.id}`:`/s/${K.id}`,children:e(qe,{status:K,size:"s",previewMode:!0,allowContextMenu:!0})})},K.id))}),r&&(!(v!=null&&v.length)||(v==null?void 0:v.length)<=1)&&e(zi,{class:`status-link status-type-${S}`,to:n?`/${n}/s/${T}`:`/s/${T}`,onContextMenu:s?void 0:K=>{const ae=K.target.querySelector(".status");if(ae){if(K.metaKey)return;K.preventDefault(),ae.dispatchEvent(new MouseEvent("contextmenu",{clientX:K.clientX,clientY:K.clientY}))}},children:i?e(qe,{status:_,size:"s",readOnly:!0,allowContextMenu:!0}):e(qe,{statusID:T,size:"s",readOnly:!0,allowContextMenu:!0})})]})]})}function zi(t){const n=Co();return e(fe,{...t,"data-read-more":g._({id:"8fZueG"}),ref:n})}const Tn=it(ca,(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 aa=it(function(){if(!("serviceWorker"in navigator))return null;const n=He(A),{routeNotification:i}=n,{id:s,accessToken:o}=i||{},[a,p]=L(!1);yt(()=>{if(!s||!o)return;const{instance:c}=oe(),{masto:l,instance:m}=oe({accessToken:o}),h=c===m,f=o?io(o):Zn();(async()=>{const d=await l.v1.notifications.$select(s).fetch();if(d&&f){const v=f.instanceURL,{type:b,status:w,account:k}=d,y=!!document.querySelector("#modal-container > *"),S=b==="follow"&&!!(k!=null&&k.id),_=!!(k!=null&&k.id),T=!!(w!=null&&w.id);S&&h?A.showAccount={account:k,instance:v}:y||!h||_&&T?p({id:s,account:f,notification:d,sameInstance:h}):T?location.hash=`/${c}/s/${w.id}`:S?location.hash=`/${c}/a/${k.id}`:location.hash="/notifications"}})()},[s,o]),yt(()=>{navigator!=null&&navigator.clearAppBadge&&navigator.clearAppBadge()},[]),Bt(c=>{c&&(navigator!=null&&navigator.clearAppBadge)&&navigator.clearAppBadge()});const r=()=>{p(!1),A.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(a){const{id:c,account:l,notification:m,sameInstance:h}=a;return e(Fe,{onClick:f=>{f.target===f.currentTarget&&r()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:r,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(u,{id:"5+87Pq"})})}),e("main",{children:[!h&&e("p",{children:e(u,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:f=>{const{target:d}=f;(f.target.tagName==="BUTTON"||f.target.tagName==="A")&&r()},children:e(Tn,{instance:l.instanceURL,notification:m,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(fe,{to:"/notifications",class:"button light",onClick:r,children:[e("span",{children:e(u,{id:"/WA/tl"})})," ",e(C,{icon:"arrow-right"})]})})]})]})})}return null}),As=oo((t,n)=>{const{instance:i}=oe(),[s,o]=ht(),[a,p]=L(!1),[r,c]=L(s.get("q")||""),l=s.get("type"),m=q(null),h=q(null);return so(n,()=>({setValue:f=>{c(f)},focus:()=>{h.current.focus()},select:()=>{h.current.select()},blur:()=>{h.current.blur()}})),e("form",{ref:m,class:"search-popover-container",onSubmit:f=>{var v;if(f.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,f)},children:[e("input",{ref:h,value:r,name:"q",type:"search",placeholder:g._({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",onSearch:f=>{f.target.value||o({})},onInput:f=>{c(f.target.value),p(!0)},onFocus:()=>{var f,d;p(!0),(d=(f=m.current)==null?void 0:f.querySelector(".search-popover-item"))==null||d.classList.add("focus")},onBlur:()=>{var f,d;setTimeout(()=>{p(!1)},100),(d=(f=m.current)==null?void 0:f.querySelector(".search-popover-item.focus"))==null||d.classList.remove("focus")},onKeyDown:f=>{var v;const{key:d}=f;switch(d){case"Escape":p(!1);break;case"Down":case"ArrowDown":if(f.preventDefault(),a){const b=m.current.querySelector(".search-popover-item.focus");if(b){let w=b.nextElementSibling;for(;w&&w.hidden;)w=w.nextElementSibling;w&&(w.classList.add("focus"),Array.from(w.parentElement.children).filter(y=>y!==w).forEach(y=>{y.classList.remove("focus")}))}else{const w=m.current.querySelector(".search-popover-item");w&&w.classList.add("focus")}}break;case"Up":case"ArrowUp":if(f.preventDefault(),a){const b=document.querySelector(".search-popover-item.focus");if(b){let w=b.previousElementSibling;for(;w&&w.hidden;)w=w.previousElementSibling;w&&(w.classList.add("focus"),Array.from(w.parentElement.children).filter(y=>y!==w).forEach(y=>{y.classList.remove("focus")}))}else{const w=document.querySelector(".search-popover-item:last-child");w&&w.classList.add("focus")}}break;case"Enter":if(a){const b=document.querySelector(".search-popover-item.focus");b&&(f.preventDefault(),b.click()),p(!1),(v=t==null?void 0:t.onSubmit)==null||v.call(t,f)}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((f,d)=>{if(l){if(f.queryType===l)return-1;if(d.queryType===l)return 1}return f.top&&!d.top?-1:!f.top&&d.top?1:0}).filter(({hidden:f})=>!f).map(({label:f,to:d,icon:v,type:b},w)=>e(fe,{to:d,class:`search-popover-item ${w===0?"focus":""}`,onClick:k=>{var y;(y=t==null?void 0:t.onSubmit)==null||y.call(t,k)},children:[e(C,{icon:v||(b==="link"?"arrow-right":"search"),class:"more-insignificant"}),e("span",{children:f})," "]}))})]})}),ra=it(function({onClose:n=()=>{}}){const[i,s]=L(!1),o=q(null);Be(["Slash","/"],p=>{s(!0),setTimeout(()=>{var r,c,l,m;(c=(r=o.current)==null?void 0:r.focus)==null||c.call(r),(m=(l=o.current)==null?void 0:l.select)==null||m.call(l)},0)},{preventDefault:!0,ignoreEventWhen:p=>{const r=/\/search/.test(location.hash),c=!!document.querySelector("#modal-container > *");return r||c}});const a=()=>{s(!1),n()};return Be("esc",p=>{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:p=>{p.target===p.currentTarget&&a()},children:e(As,{ref:o,onSubmit:()=>{a()}})})});function la(){const{_:t}=Je(),{instance:n}=oe(),i=He(A),{shortcuts:s,settings:o}=i;if(!s.length||o.shortcutsViewMode==="multi-column"||!o.shortcutsViewMode&&o.shortcutsColumnsMode)return null;const a=q(),p=q(!1),r=s.map((h,f)=>{const{type:d,...v}=h;if(!_n[d])return null;let{id:b,path:w,title:k,subtitle:y,icon:S}=_n[d];return typeof b=="function"&&(b=b(v,f)),typeof w=="function"&&(w=w({...v,instance:v.instance||n},f)),typeof k=="function"?k=k(v,f):k=t(k),typeof y=="function"?y=y(v,f):y=t(y),typeof S=="function"&&(S=S(v,f)),b==="lists"&&(p.current=!0),{id:b,path:w,title:k,subtitle:y,icon:S}}).filter(Boolean),c=ts();Be(["1","2","3","4","5","6","7","8","9"],(h,f)=>{var v,b;const d=parseInt(f.keys[0],10)-1;if(d<r.length){const{path:w}=r[d];w&&(c(w),(b=(v=a.current)==null?void 0:v.closeMenu)==null||b.call(v))}});const[l,m]=L([]);return e("div",{id:"shortcuts",children:i.settings.shortcutsViewMode==="tab-menu-bar"?e("nav",{class:"tab-bar",onContextMenu:h=>{h.preventDefault(),A.showShortcutsSettings=!0},children:e("ul",{children:r.map(({id:h,path:f,title:d,subtitle:v,icon:b},w)=>e("li",{children:e(fe,{class:v?"has-subtitle":"",to:f,onClick:k=>{if(k.target.classList.contains("is-active")){k.preventDefault();const y=document.getElementById(`${h}-page`);if(y){y.scrollTop=0;const S=y.querySelector(".updates-button");S&&S.click()}}},children:[e(C,{icon:b,size:"xl",alt:d}),e("span",{children:[e(un,{children:d}),v&&e(B,{children:[e("br",{}),e("small",{children:v})]})]})]})},`${w}-${h}-${d}-${v}-${f}`))})}):e(ct,{instanceRef:a,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:h=>{h.open&&p.current&&sn().then(m)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:h=>{h.preventDefault(),A.showShortcutsSettings=!0},onTransitionStart:h=>{var f,d;try{const{target:v}=h;getComputedStyle(v).pointerEvents==="none"&&((d=(f=a.current)==null?void 0:f.closeMenu)==null||d.call(f))}catch{}},children:e(C,{icon:"shortcut",size:"xl",alt:g._({id:"CTqTgr"})})}),children:r.map(({id:h,path:f,title:d,subtitle:v,icon:b},w)=>h==="lists"?e(vn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(B,{children:[e(C,{icon:b,size:"l"}),e("span",{class:"menu-grow",children:e(un,{children:d})}),e(C,{icon:"chevron-right"})]}),children:[e(Ue,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),e(Ve,{}),l==null?void 0:l.map(k=>e(Ue,{to:`/l/${k.id}`,children:e("span",{children:k.title})},k.id))]}):e(Ue,{to:f,class:"glass-menu-item",children:[e(C,{icon:b,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(un,{children:d})}),v&&e(B,{children:[" ",e("small",{class:"more-insignificant",children:v})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:w+1})]},`${w}-${h}-${d}-${v}-${f}`))})})}const da=it(la);function ua(t){var o;let n=[],i=[],s=0;for(let a=0;a<t.length;a++){const p=t[a];p.reblog&&!((o=p.account)!=null&&o.group)?(i.push(p),s++):(n.push(p),s<3&&(s=0))}if(t.length>10&&(i.length>t.length/4||s>=3)){const a=i.map(p=>p.id);if(i.length>t.length*3/4)n=[...n,{id:a,items:i,type:"boosts"}];else{const p=Math.floor(n.length/2);n=[...n.slice(0,p),{id:a,items:i,type:"boosts"},...n.slice(p)]}return n}else return t}function Ui(t,n){const i=ge.account.get("boostedStatusIDs")||{},s=t.filter(a=>{if(!a.reblog)return!0;const p=`${n}-${a.reblog.id}`,r=i[p];return r&&r!==a.id?!1:(i[p]=a.id,!0)}),o=Object.keys(i);return o.length>50&&o.slice(0,o.length-50).forEach(a=>{delete i[a]}),ge.account.set("boostedStatusIDs",i),s}function ha(t,n){const i=[];let s=0;t.forEach(r=>{for(let l=0;l<i.length;l++){if(i[l].find(m=>m.id===r.id))return;if(i[l].find(m=>m.id===r.inReplyToId)||i[l].find(m=>m.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;r<i.length;r++)for(let c=r+1;c<i.length;c++)i[r].find(m=>i[c].includes(m))&&(i[r]=[...i[r],...i[c]],i[r]=i[r].filter((m,h,f)=>f.findIndex(d=>d.id===m.id)===h),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=[],p=[];return t.forEach(r=>{if(r.reblog){o.push(r);return}for(let c=0;c<i.length;c++)if(i[c].find(l=>l.id===r.id)){if(a.includes(c))return;const l=i[c];l.sort((h,f)=>{const d=new Date(h.createdAt),v=new Date(f.createdAt);return d-v});const m=l[0].account.id;o.push({id:l.map(h=>h.id),items:l,type:l.every(h=>h.account.id===m)?"thread":"conversation"}),a.push(c);return}if(r.inReplyToId&&r.inReplyToAccountId!==r.account.id){const c=nt(r.id,n);A.statusReply[c]||p.push({sKey:c,inReplyToId:r.inReplyToId})}o.push(r)}),p!=null&&p.length&&queueMicrotask(()=>{const{masto:r}=oe({instance:n});async function c(){for(let l=0;l<p.length;l++){const{sKey:m,inReplyToId:h}=p[l];try{const f=await fa(h,r);Ke(f,n,{skipThreading:!0}),A.statusReply[m]={id:f.id,instance:n},await new Promise(d=>setTimeout(d,1e3))}catch{}}}if(Xe("@mastodon/fetch-multiple-statuses")){const l=p.map(({inReplyToId:m})=>m);(async()=>{var m;try{const h=await r.v1.statuses.list({id:l});if(h!=null&&h.length)for(const f of h){Ke(f,n,{skipThreading:!0});const d=(m=p.find(({inReplyToId:v})=>v===f.id))==null?void 0:m.sKey;d&&(A.statusReply[d]={id:f.id,instance:n})}else c()}catch{c()}})()}else c()}),o}const fa=kt((t,n)=>n.v1.statuses.$select(t).fetch());async function Es(t,n){const i=await Zc();if(!i.length)return;const{statusFollowedTags:s}=A,o=[];if(t.forEach(a=>{var f;if(a.reblog)return;const{id:p,content:r,tags:c=[]}=a,l=nt(p,n);if((f=s[l])!=null&&f.length)return;const m=Xc(r);if(!m.length&&!c.length)return;const h=i.reduce((d,v)=>((m.some(b=>b.toLowerCase()===v.name.toLowerCase())||c.some(b=>b.name.toLowerCase()===v.name.toLowerCase()))&&d.push(v.name),d),[]);h.length&&o.push({item:a,sKey:l,followedTags:h})}),o.length){const a=o.map(r=>r.item.account),p=await ei(a);if(!p)return;o.forEach(r=>{const{item:c,sKey:l,followedTags:m}=r,h=p[c.account.id];h&&!h.following&&(s[l]=m)})}}function pa(){A.statusFollowedTags={}}function ma({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:p,distanceFromEndPx:r}={}){const[c,l]=L(null),[m,h]=L(!1),[f,d]=L(!1),[v,b]=L(!1),[w,k]=L(!1),y=a==="vertical";return yt(()=>{const S=t.current;if(!S)return{};let _=y?S.scrollTop:S.scrollLeft;function T(){const{scrollTop:I,scrollLeft:x,scrollHeight:O,scrollWidth:P,clientHeight:$,clientWidth:j}=S,Z=y?I:x,J=y?O:P,N=y?$:j,M=Math.abs(Z-_),z=p||Math.min(N*n,J,Z),V=r||Math.min(N*i,J,J-Z-N);M>=(_<Z?o:s)&&(l(_<Z?"end":"start"),_=Z),h(Z<=0),d(Z+N>=J),b(Z<=z),k(Z+N>=J-V)}return S.addEventListener("scroll",T,{passive:!0}),()=>S.removeEventListener("scroll",T)},[n,i,s,o]),{scrollDirection:c,reachStart:m,reachEnd:f,nearReachStart:v,nearReachEnd:w,init:()=>{t.current&&t.current.dispatchEvent(new Event("scroll"))}}}function ga({scrollableRef:t,distanceFromStart:n=1,distanceFromEnd:i=1,scrollThresholdStart:s=10,scrollThresholdEnd:o=10,direction:a="vertical",distanceFromStartPx:p,distanceFromEndPx:r,init:c}={},l,m){if(!l)return;const h=a==="vertical",f=q(null),d=q(null),v=Io(()=>{let b=!1,w=!1,k=!1,y=!1;const S=t.current,{scrollTop:_,scrollLeft:T,scrollHeight:I,scrollWidth:x,clientHeight:O,clientWidth:P}=S,$=h?_:T,j=h?I:x,Z=h?O:P,J=Math.abs($-f.current),N=p||Math.min(Z*n,j,$),M=r||Math.min(Z*i,j,j-$-Z);J>=(f.current<$?o:s)&&(d.current=f.current<$?"end":"start",f.current=$),b=$<=0,w=$+Z>=j,k=$<=N,y=$+Z>=j-M,l({scrollDirection:d.current,reachStart:b,reachEnd:w,nearReachStart:k,nearReachEnd:y})},500);yt(()=>{const b=t.current;return b?(f.current=b[h?"scrollTop":"scrollLeft"],b.addEventListener("scroll",v,{passive:!0}),()=>b.removeEventListener("scroll",v)):{}},[n,i,s,o,...m]),ee(()=>{c&&t.current&&queueMicrotask(()=>{t.current.dispatchEvent(new Event("scroll"))})},[c])}function ba({class:t,statusID:n,status:i,instance:s,parent:o,onMediaClick:a}){let p=nt(n,s);const r=He(A);if(i||(i=r.statuses[p]||r.statuses[n],p=nt(i==null?void 0:i.id,s)),!i)return null;const{account:{acct:c,avatar:l,avatarStatic:m,id:h,url:f,displayName:d,username:v,emojis:b,bot:w,group:k},id:y,repliesCount:S,reblogged:_,reblogsCount:T,favourited:I,favouritesCount:x,bookmarked:O,poll:P,muted:$,sensitive:j,spoilerText:Z,visibility:J,language:N,editedAt:M,filtered:z,card:V,createdAt:U,inReplyToId:ie,inReplyToAccountId:Q,content:de,mentions:Ce,mediaAttachments:te,reblog:be,uri:K,url:ae,emojis:ue,_deleted:Ie,_pinned:Me}=i;if(!(te!=null&&te.length))return null;const Te=pe=>{pe.shiftKey},Re=ke(()=>vt(),[]),De=ke(()=>Re&&Re===h,[h,Re]),we=co(ls),X=!De&&en(z,we);if((X==null?void 0:X.action)==="hide")return null;const me=j,le=ke(()=>{var D;return((D=(ge.account.get("preferences")||{})["reading:expand:media"])==null?void 0:D.toLowerCase())||"default"},[])==="show_all",G=o||"div";return te.map((pe,D)=>{const E=`${p}-${pe.id}`,F=X==null?void 0:X.titlesStr;return e(G,{"data-state-post-id":p,onMouseEnter:Te,"data-spoiler-text":Z||(j?g._({id:"FKojeB"}):void 0),"data-filtered-text":X?F?g._({id:"7FGvtQ",values:{filterTitleStr:F}}):g._({id:"03Qqf9"}):void 0,class:`
|
||
media-post
|
||
${X?"filtered":""}
|
||
${me?"has-spoiler":""}
|
||
${le?"show-media":""}
|
||
`,children:e(rs,{class:t,media:pe,lang:N,to:`/${s}/s/${y}?media-only=${D+1}`,onClick:a?ce=>a(ce,D,pe,i):void 0})},E)})}const Fi=it(ba);function va(t){var T,I,x,O,P;const n=He(A),{masto:i,instance:s,authenticated:o}=oe(),[a,p]=ke(()=>{const $=ge.local.getJSON("accounts")||[];return[$.find(Z=>Z.info.id===vt())||$[0],$.length>1]},[]),r=(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&!n.shortcuts.find($=>$.type==="following"),c=To(()=>{A.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),l=q(),[m,h]=L(void 0),f=xo([0,0,n.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),d=q();async function v($){return($||!d.current)&&(d.current=i.v1.mutes.list({limit:80})),await d.current.next()}const b=q();async function w($){return($||!b.current)&&(b.current=i.v1.blocks.list({limit:80})),await b.current.next()}const k=Xe("@mastodon/lists"),[y,S]=L([]);ee(()=>{k&&m==="open"&&sn().then(S)},[m==="open"]);const _=q();return e(B,{children:[e("button",{ref:l,type:"button",class:`button plain nav-menu-button ${p?"with-avatar":""} ${m==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{_.current=Date.now(),h($=>$?void 0:"open")},onContextMenu:$=>{$.preventDefault(),A.showAccounts=!0},...c(),children:[p&&e(lt,{url:((T=a==null?void 0:a.info)==null?void 0:T.avatar)||((I=a==null?void 0:a.info)==null?void 0:I.avatarStatic),size:"l",squircle:(x=a==null?void 0:a.info)==null?void 0:x.bot}),e(C,{icon:"menu",size:p?"s":"l",alt:g._({id:"zucql+"})})]}),e(ds,{menuClassName:"nav-menu",state:m,anchorRef:l,onClose:()=>{h(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-_.current<300}},portal:{target:document.body},...t,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:f,unmountOnClose:!0,children:[!!((O=n.appVersion)!=null&&O.commitHash)&&n.appVersion.commitHash!=="0a176e2"&&e("div",{class:"top-menu",children:[e(ye,{onClick:()=>{confirm(g._({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(C,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(u,{id:"95IFnD"})})]}),e(Ve,{})]}),e("section",{children:[e(Ue,{to:"/",children:[e(C,{icon:"home",size:"l"})," ",e("span",{children:e(u,{id:"i0qMbr"})})]}),o?e(B,{children:[r&&e(Ue,{to:"/following",children:[e(C,{icon:"following",size:"l"})," ",e("span",{children:e(u,{id:"y6sq5j"})})]}),e(Ue,{to:"/catchup",children:[e(C,{icon:"history2",size:"l"}),e("span",{children:e(u,{id:"xrl8fj"})})]}),Xe("@mastodon/mentions")&&e(Ue,{to:"/mentions",children:[e(C,{icon:"at",size:"l"})," ",e("span",{children:e(u,{id:"/bZzdR"})})]}),e(Ue,{to:"/notifications",children:[e(C,{icon:"notification",size:"l"})," ",e("span",{children:e(u,{id:"iDNBZe"})}),n.notificationsShowNew&&e("sup",{title:g._({id:"isRobC"}),style:{opacity:.5},children:[" ","•"]})]}),e(Ve,{}),((P=a==null?void 0:a.info)==null?void 0:P.id)&&e(Ue,{to:`/${s}/a/${a.info.id}`,children:[e(C,{icon:"user",size:"l"})," ",e("span",{children:e(u,{id:"vERlcd"})})]}),(y==null?void 0:y.length)>0?e(vn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(B,{children:[e(C,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(u,{id:"h16FyT"})}),e(C,{icon:"chevron-right"})]}),children:[e(Ue,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),(y==null?void 0:y.length)>0&&e(B,{children:[e(Ve,{}),y.map($=>e(Ue,{to:`/l/${$.id}`,children:e("span",{children:$.title})},$.id))]})]}):k&&e(Ue,{to:"/l",children:[e(C,{icon:"list",size:"l"}),e("span",{children:e(u,{id:"h16FyT"})})]}),e(Ue,{to:"/b",children:[e(C,{icon:"bookmark",size:"l"})," ",e("span",{children:e(u,{id:"7Ff7ia"})})]}),e(vn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(B,{children:[e(C,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(u,{id:"24misb"})}),e(C,{icon:"chevron-right"})]}),children:[e(Ue,{to:"/f",children:[e(C,{icon:"heart",size:"l"})," ",e("span",{children:e(u,{id:"zZOZj7"})})]}),e(Ue,{to:"/fh",children:[e(C,{icon:"hashtag",size:"l"})," ",e("span",{children:e(u,{id:"Xi1/bw"})})]}),e(Ve,{}),Xe("@mastodon/filters")&&e(Ue,{to:"/ft",children:[e(C,{icon:"filters",size:"l"})," ",e("span",{children:e(u,{id:"cSev+j"})})]}),e(ye,{onClick:()=>{A.showGenericAccounts={id:"mute",heading:g._({id:"sOKhEA"}),fetchAccounts:v,excludeRelationshipAttrs:["muting"]}},children:[e(C,{icon:"mute",size:"l"})," ",e("span",{children:e(u,{id:"n1sANU"})})]}),e(ye,{onClick:()=>{A.showGenericAccounts={id:"block",heading:g._({id:"nL8nlr"}),fetchAccounts:w,excludeRelationshipAttrs:["blocking"]}},children:[e(C,{icon:"block",size:"l"})," ",e("span",{children:e(u,{id:"r3RRWo"})})]})," "]}),e(Ve,{}),e(ye,{onClick:()=>{A.showAccounts=!0},children:[e(C,{icon:"group",size:"l"})," ",e("span",{children:e(u,{id:"7e0O8Z"})})]})]}):e(B,{children:[e(Ve,{}),e(Ue,{to:"/login",children:[e(C,{icon:"user",size:"l"})," ",e("span",{children:e(u,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(Ve,{}),e(Ue,{to:"/search",children:[e(C,{icon:"search",size:"l"})," ",e("span",{children:e(u,{id:"A1taO8"})})]}),e(Ue,{to:`/${s}/trending`,children:[e(C,{icon:"chart",size:"l"})," ",e("span",{children:e(u,{id:"4/iCqx"})})]}),e(Ue,{to:`/${s}/p/l`,children:[e(C,{icon:"building",size:"l"})," ",e("span",{children:e(u,{id:"d5zxa4"})})]}),e(Ue,{to:`/${s}/p`,children:[e(C,{icon:"earth",size:"l"})," ",e("span",{children:e(u,{id:"4ERYY7"})})]}),o?e(B,{children:[e(Ve,{className:"divider-grow"}),e(ye,{onClick:()=>{A.showKeyboardShortcutsHelp=!0},children:[e(C,{icon:"keyboard",size:"l"})," ",e("span",{children:e(u,{id:"77Emn0"})})]}),e(ye,{onClick:()=>{A.showShortcutsSettings=!0},children:[e(C,{icon:"shortcut",size:"l"})," ",e("span",{children:e(u,{id:"8Kudkr"})})]}),e(ye,{onClick:()=>{A.showSettings=!0},children:[e(C,{icon:"gear",size:"l"})," ",e("span",{children:e(u,{id:"uVbUP8"})})]})]}):e(B,{children:[e(Ve,{}),e(ye,{onClick:()=>{A.showSettings=!0},children:[e(C,{icon:"gear",size:"l"})," ",e("span",{children:e(u,{id:"uVbUP8"})})]})]})]})]})]})}const Nt=it(va),cn={block:"nearest",inline:"center",behavior:"smooth"};function _t({title:t,titleComponent:n,id:i,instance:s,emptyText:o,errorText:a,useItemID:p,boostsCarousel:r,fetchItems:c=()=>{},checkForUpdates:l=()=>{},checkForUpdatesInterval:m=15e3,headerStart:h,headerEnd:f,timelineStart:d,refresh:v,view:b,filterContext:w,showFollowedTags:k,showReplyParent:y,clearWhenRefresh:S}){const _=He(A),[T,I]=L([]),[x,O]=L("start"),[P,$]=L(!1),[j,Z]=L(!1),[J,N]=L(!0),M=q();__BENCHMARK.start(`timeline-${i}-load`);const z=ke(()=>Xn(),[]),V=b!=="media",U=q(0),ie=Ao(X=>{Z(!1),O("loading"),(async()=>{try{const me=U.current=Date.now();let{done:xe,value:le}=await c(X);if(me!==U.current)return;if(Array.isArray(le)){const[G,pe]=le.reduce((D,E)=>(E._pinned?D[0].push(E):D[1].push(E),D),[[],[]]);le=pe,V&&(r&&(le=ua(le)),le=ha(le,s)),G.length&&(le=G.concat(le)),I(X?le:D=>[...D,...le]),le.length||(xe=!0),$(!xe)}else $(!1);O("default"),__BENCHMARK.end(`timeline-${i}-load`)}catch{O("error"),X&&!T.length&&a&&he(a)}finally{ie.cancel()}})()},1e3,{leading:!0}),Q=".timeline-item, .timeline-item-alt",de=Be("j, shift+j",(X,me)=>{const xe=document.activeElement.closest(Q),le=xe==null?void 0:xe.getBoundingClientRect(),G=Array.from(M.current.querySelectorAll(Q));if(xe&&le.top<M.current.clientHeight&&le.bottom>0){const pe=G.indexOf(xe);let D=G[pe+1];me.shift&&(D=G.find((E,F)=>F>pe&&!E.classList.contains("timeline-item-alt"))),D&&(D.focus(),D.scrollIntoView(cn))}else{const pe=G.find(D=>{const E=D.getBoundingClientRect();return E.top>=44&&E.left>=0});pe&&(pe.focus(),pe.scrollIntoView(cn))}}),Ce=Be("k, shift+k",(X,me)=>{const xe=document.activeElement.closest(Q),le=xe==null?void 0:xe.getBoundingClientRect(),G=Array.from(M.current.querySelectorAll(Q));if(xe&&le.top<M.current.clientHeight&&le.bottom>0){const pe=G.indexOf(xe);let D=G[pe-1];me.shift&&(D=G.findLast((E,F)=>F<pe&&!E.classList.contains("timeline-item-alt"))),D&&(D.focus(),D.scrollIntoView(cn))}else{const pe=G.find(D=>{const E=D.getBoundingClientRect();return E.top>=44&&E.left>=0});pe&&(pe.focus(),pe.scrollIntoView(cn))}}),te=Be(["enter","o"],()=>{const X=document.activeElement;X!=null&&X.matches(Q)&&X.click()}),be=T.length>0&&x!=="loading"&&j,K=ot(()=>{var X;be&&ie(!0),(X=M.current)==null||X.scrollTo({top:0,behavior:"smooth"})},[ie,be]),ae=Be(".",K),ue=q(),[Ie,Me]=L(!1);ga({scrollableRef:M,distanceFromEnd:2,scrollThresholdStart:44},({scrollDirection:X,nearReachStart:me,reachStart:xe})=>{if(ue.current){const le=X==="end"&&!me;ue.current.hidden=le}Me(me),xe&&ie(!0)},[]),ee(()=>{var X;(X=M.current)==null||X.scrollTo({top:0}),ie(!0)},[]);const Te=q(!0);ee(()=>{var X;if(Te.current){Te.current=!1;return}S&&(T!=null&&T.length)&&((X=ie.cancel)==null||X.call(ie),I([])),ie(!0)},[S,v]);const Re=q(b);ee(()=>{Re.current!==b&&(Re.current=b,I([]))},[b]);const De=ot(async({disableIdleCheck:X=!1}={})=>{const me=M.current?getComputedStyle(M.current).pointerEvents==="none":!1;_.settings.autoRefresh&&M.current.scrollTop<16&&(X||window.__IDLE__)&&!_a()&&!me?ie(!0):await l()&&Z(!0)},[i,ie,l,_.settings.autoRefresh]),we=q();return Bt(X=>{if(X){const me=Date.now()-we.current;(!we.current||me>1e3*3)&&De({disableIdleCheck:!0})}else we.current=Date.now();N(X)},[l,De,_.settings.autoRefresh]),Qn(De,J&&!j?m*(Ie?1:2):null),e(ls.Provider,{value:w,children:e("div",{id:`${i}-page`,class:`deck-container ${z?"deck-container-media-first":""}`,ref:X=>{M.current=X,de(X),Ce(X),te(X),ae(X)},tabIndex:"-1",onClick:X=>{ue.current&&X.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{ue.current.hidden=!1},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:ue,onClick:X=>{var me;X.target.closest("a, button")||(me=M.current)==null||me.scrollTo({top:0,behavior:"smooth"})},onDblClick:X=>{X.target.closest("a, button")||ie(!0)},class:x==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),h??e(fe,{to:"/",class:"button plain home-button",children:e(C,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),t&&(n||e("h1",{children:t})),e("div",{class:"header-side",children:!!f&&f})]}),be&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:K,children:[e(C,{icon:"arrow-up"})," ",e(u,{id:"2yr1/p"})]})]}),!!d&&e("div",{class:`timeline-start ${x==="loading"?"loading":""}`,children:d}),T.length?e(B,{children:[e("ul",{class:`timeline ${b?`timeline-${b}`:""}`,children:[T.map(X=>e(ya,{status:X,instance:s,useItemID:p,filterContext:w,view:b,showFollowedTags:k,showReplyParent:y,mediaFirst:z},X.id+(X==null?void 0:X._pinned)+b)),P&&x==="loading"&&(b==="media"?null:e(B,{children:[e("li",{style:{height:"20vh"},children:e(qe,{skeleton:!0,mediaFirst:z})}),e("li",{style:{height:"25vh"},children:e(qe,{skeleton:!0,mediaFirst:z})})]}))]}),x==="default"&&(P?e(wt,{root:M.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:X=>{X&&ie()},children:e("button",{type:"button",class:"plain block",onClick:()=>ie(),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((X,me)=>b==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(qe,{skeleton:!0,mediaFirst:z})},me))}):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:()=>ie(!T.length),children:e(u,{id:"KDw4GX"})})]})]})})})}const ya=it(({status:t,instance:n,useItemID:i,filterContext:s,view:o,showFollowedTags:a,showReplyParent:p,mediaFirst:r})=>{const{id:c,reblog:l,items:m,type:h,_pinned:f}=t;f&&(i=!1);const d=(l==null?void 0:l.id)||c,v=n?`/${n}/s/${d}`:`/s/${d}`;if(m){let w=Rt(m,s),k="";if(h==="boosts"?k=g._({id:"NuqppG",values:{0:w.length}}):h==="pinned"&&(k=g._({id:"GlfmCu"})),h==="boosts"||h==="pinned"){const _=new Set;if(w.sort((T,I)=>{const x=en(T.filtered,s),O=en(I.filtered,s);return x&&_.add(T.id),O&&_.add(I.id),x&&!O?1:!x&&O?-1:0}),_.size>=2){const I=[],x=[];w.forEach(P=>{_.has(P.id)?x.push(P):I.push(P)});const O=[];for(let P=0;P<x.length;P+=5)O.push({_grouped:!0,posts:x.slice(P,P+5)});w=I.concat(O)}return e("li",{class:"timeline-item-carousel",children:e(wa,{title:k,class:`${h}-carousel`,children:w.map(T=>{const{id:I,reblog:x,_pinned:O,_grouped:P}=T;if(P)return e("li",{class:"timeline-item-carousel-group",children:T.posts.map(Z=>{const{id:J,reblog:N,_pinned:M}=Z,z=(N==null?void 0:N.id)||J,V=n?`/${n}/s/${z}`:`/s/${z}`;return M&&(i=!1),e(fe,{class:"status-carousel-link timeline-item-alt",to:V,children:i?e(qe,{statusID:J,instance:n,size:"s"}):e(qe,{status:Z,instance:n,size:"s"})})})},I);const $=(x==null?void 0:x.id)||I,j=n?`/${n}/s/${$}`:`/s/${$}`;return O&&(i=!1),e("li",{children:e(fe,{class:"status-carousel-link timeline-item-alt",to:j,children:i?e(qe,{statusID:I,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:r}):e(qe,{status:T,instance:n,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:r})})},I)})})},`timeline-${c}`)}const S=w.length>3;return w.map((_,T)=>{const{id:I,_differentAuthor:x}=_,O=n?`/${n}/s/${I}`:`/s/${I}`,P=T>0&&T<w.length-1,$=_.sensitive&&!!_.spoilerText,j=!x&&$&&T>0||S&&P&&(h==="thread"||h==="conversation"&&!x&&!w[T-1]._differentAuthor&&!w[T+1]._differentAuthor),Z=T===0,J=T===w.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${h} timeline-item-container-${Z?"start":J?"end":"middle"} ${x?"timeline-item-diff-author":""}`,children:e(fe,{class:"status-link timeline-item",to:O,children:j?e(ka,{status:_,instance:n,filterContext:s}):i?e(qe,{statusID:I,instance:n,enableCommentHint:J,showFollowedTags:a}):e(qe,{status:_,instance:n,enableCommentHint:J,showFollowedTags:a})})},`timeline-${I}`)})}const b=`timeline-${c+f}`;return o==="media"?i?e(Fi,{class:"timeline-item",parent:"li",statusID:c,instance:n},b):e(Fi,{class:"timeline-item",parent:"li",status:t,instance:n},b):e("li",{children:e(fe,{class:"status-link timeline-item",to:v,children:i?e(qe,{statusID:c,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:p,mediaFirst:r}):e(qe,{status:t,instance:n,enableCommentHint:!0,showFollowedTags:a,showReplyParent:p,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 wa({title:t,class:n,children:i}){const s=q(),o=q(),a=q(),[p,r]=L(!1);return ee(()=>{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,m;const c=Math.min(320,(l=s.current)==null?void 0:l.offsetWidth)*(Et()?1:-1);(m=s.current)==null||m.scrollBy({left:c,behavior:"smooth"})},children:e(C,{icon:"chevron-left",alt:g._({id:"DHhJ7s"})})})," ",e("button",{ref:a,type:"button",class:"small plain2",onClick:()=>{var l,m;const c=Math.min(320,(l=s.current)==null?void 0:l.offsetWidth)*(Et()?-1:1);(m=s.current)==null||m.scrollBy({left:c,behavior:"smooth"})},children:e(C,{icon:"chevron-right",alt:g._({id:"hXzOVo"})})})]})]}),e("ul",{ref:s,children:[e(wt,{class:"status-carousel-beacon",onChange:c=>{o.current&&(o.current.disabled=c)}}),i[0],p&&i.slice(1),e(wt,{class:"status-carousel-beacon",onChange:c=>{a.current&&(a.current.disabled=c)}})]})]})}function ka({status:t,instance:n,filterContext:i}){const s=He(A),{id:o,visibility:a,language:p}=t,r=ni(t),c=nt(o,n),l=en(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(C,{icon:"thread",size:"s",alt:g._({id:"e66y2Z"})}),s.statusThreadNumber[c]?` ${s.statusThreadNumber[c]}/X`:""]}):e("div",{class:"status-thread-badge",children:e(C,{icon:"thread",size:"s",alt:g._({id:"e66y2Z"})})}),e("div",{class:"content-compact",title:r,lang:p,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(B,{children:[r,t.sensitive&&t.spoilerText&&e(B,{children:[" ",e("span",{class:"spoiler-badge",children:e(C,{icon:"eye-close",size:"s",alt:g._({id:"gnKo7f"})})})]})]})})]})}function _a(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const Ut=20,mi=1983,Bi=`${mi}-01`,Sa=(()=>{try{const t=document.createElement("input");return t.setAttribute("type","month"),t.type==="month"}catch{return!1}})();async function Ca(t){var s;const{masto:n}=oe({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 Ia=kt(Ca);function Ta(){const t=He(A),{id:n,...i}=Mt(),[s,o]=ht(),a=s.get("month"),p=!s.get("replies"),r=!!s.get("boosts"),c=s.get("tagged"),l=!!s.get("media"),{masto:m,instance:h,authenticated:f}=oe({instance:i.instance}),{masto:d,instance:v}=oe(),b=q(),w=[a,p,r,c,l],[k,y]=L(),S=q(0);ee(()=>{S.current=0},w);const _=ke(()=>Xn(),[]),T=ke(()=>h===v,[h,v]),[I,x]=L(!1);ee(()=>{T&&k!=null&&k.acct&&(async()=>{const te=await Ia(h);x(te)})()},[h,T,k==null?void 0:k.acct]);async function O(te){var Me,Te,Re,De;const be=/^\d{4}-[01]\d$/.test(a),K=((Te=(Me=a==null?void 0:a.split)==null?void 0:Me.call(a,"-"))==null?void 0:Te[0])>=mi;if(be&&K){if(!k)return{value:[],done:!0};const[we,X]=a.split("-"),me=parseInt(X,10)-1,xe=new Date(we,me,0),le=`${xe.getFullYear()}-${(xe.getMonth()+1).toString().padStart(2,"0")}-${xe.getDate().toString().padStart(2,"0")}`,G=new Date(we,me+1,1),pe=`${G.getFullYear()}-${(G.getMonth()+1).toString().padStart(2,"0")}-${G.getDate().toString().padStart(2,"0")}`;let D;te?(D=Ut+1,S.current=0):(D=Ut+S.current+1,S.current+=Ut);const E=await m.v2.search.fetch({q:`from:${k.acct} after:${le} before:${pe}`,type:"statuses",limit:D,offset:S.current});if((Re=E==null?void 0:E.statuses)!=null&&Re.length){const F=E.statuses.slice(0,Ut);F.forEach(ve=>{Ke(ve,h)});const ce=E.statuses.length<=Ut;return{value:F,done:ce}}else return{value:[],done:!0}}let ae=[];if(te){const{value:we}=await m.v1.accounts.$select(n).statuses.list({pinned:!0}).next();if(we!=null&&we.length&&!c&&!l){const X=we.map(me=>(Ke(me,h),{...me,_pinned:!0}));if(X.length>=3){const me=X.map(xe=>xe.id);ae.push({id:me,items:X,type:"pinned"})}else ae.push(...X)}}(te||!b.current)&&(b.current=m.v1.accounts.$select(n).statuses.list({limit:Ut,exclude_replies:p,exclude_reblogs:r,only_media:l||void 0,tagged:c}));const{value:ue,done:Ie}=await b.current.next();if(ue!=null&&ue.length){if(ae.length){let we=[];((De=ae[0])==null?void 0:De.type)==="pinned"?we=ae[0].id:we=ae.filter(me=>me._pinned).map(me=>me.id),we.every(me=>ue.some(xe=>xe.id===me))&&(ae=[])}ae.push(...ue),ue.forEach(we=>{Ke(we,h)})}return{value:ae,done:Ie}}const[P,$]=L([]),{i18n:j}=Je();let Z=j._({id:"/cKnpj"});if(k!=null&&k.acct){const te=/@/.test(k.acct)?"":"@"+k.acct,be=k!=null&&k.displayName?`${k.displayName} (${te})`:`${te}`;if(!p)Z=j._({id:"hS1Opy",values:{accountDisplay:be}});else if(r)Z=j._({id:"A/CX5F",values:{accountDisplay:be}});else if(c)Z=j._({id:"QQrO94",values:{accountDisplay:be,tagged:c}});else if(l)Z=j._({id:"NoG5wD",values:{accountDisplay:be}});else if(a){const K=new Date(a).toLocaleString(j.locale,{month:"long",year:"numeric"});Z=j._({id:"8GjLvB",values:{accountDisplay:be,monthYear:K}})}else Z=be}We(Z,"/:instance?/a/:id");const J=q(),N=ot(()=>{const te=J.current||m.v1.accounts.$select(n).fetch();return J.current=te,te},[n,m]);ee(()=>{(async()=>{try{const te=await N();y(te)}catch{}if(!_)try{const te=await m.v1.accounts.$select(n).featuredTags.list();$(te)}catch{}})()},[n,_]);const{displayName:M,acct:z,emojis:V}=k||{},U=q(),ie=ke(()=>{const te=!p||r||c||l||!!a,be=t.accounts[`${n}@${h}`];return e(B,{children:[e(Is,{instance:h,account:be||n,fetchAccount:N,authenticated:f,standalone:!0}),!_&&e("div",{class:"filter-bar",ref:U,style:{position:"relative"},children:[te?e(fe,{to:`/${h}/a/${n}`,class:"insignificant filter-clear",title:j._({id:"u8JHrO"}),children:e(C,{icon:"x",size:"l",alt:j._({id:"xCJdfg"})})},"clear-filters"):e(C,{icon:"filter",class:"insignificant",size:"l",alt:j._({id:"cSev+j"})}),e(fe,{to:`/${h}/a/${n}${p?"?replies=1":""}`,onClick:()=>{p&&he(j._({id:"PIWNSQ"}))},class:p?"":"is-active",children:e(u,{id:"5BFynH"})}),e(fe,{to:`/${h}/a/${n}${r?"":"?boosts=0"}`,onClick:()=>{r||he(j._({id:"Qd13i0"}))},class:r?"is-active":"",children:e(u,{id:"usxQx0"})}),e(fe,{to:`/${h}/a/${n}${l?"":"?media=1"}`,onClick:()=>{l||he(j._({id:"rKpfPY"}))},class:l?"is-active":"",children:e(u,{id:"xYilR2"})}),P.map(K=>e(fe,{to:`/${h}/a/${n}${c===K.name?"":`?tagged=${encodeURIComponent(K.name)}`}`,onClick:()=>{c!==K.name&&he(j._({id:"L+HFfr",values:{0:K.name}}))},class:c===K.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),K.name]})},K.id)),I&&(Sa?e("label",{class:`filter-field ${a?"is-active":""}`,children:[e(C,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!(k!=null&&k.acct),value:a||"",min:Bi,max:new Date().toISOString().slice(0,7),onInput:K=>{const{value:ae,validity:ue}=K.currentTarget;if(!ue.valid)return;o(ae?{month:ae}:{});const[Ie,Me]=ae.split("-"),Te=parseInt(Me,10)-1,Re=new Date(Ie,Te);he(j._({id:"0WUFGD",values:{0:Re.toLocaleString(j.locale,{month:"long",year:"numeric"})}}))}})]}):e(xa,{class:`filter-field ${a?"is-active":""}`,disabled:!(k!=null&&k.acct),value:a||"",min:Bi,max:new Date().toISOString().slice(0,7),onInput:K=>{const{value:ae,validity:ue}=K;ue.valid&&o(ae?{month:ae}:{})}}))]})]})},[n,h,f,P,N,I,...w]);ee(()=>{var be;const te=(be=U.current)==null?void 0:be.querySelector(".is-active");te&&U.current.scrollTo({behavior:"smooth",left:te.offsetLeft-(U.current.offsetWidth-te.offsetWidth)/2})},[P,I,...w]);const Q=ke(()=>k!=null&&k.url?URL.parse(k.url).hostname:null,[k]),Ce=!!k&&!(h===Q);return e(_t,{title:`${k!=null&&k.acct?"@"+k.acct:j._({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(cs,{text:M,emojis:V})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",z]})})]}),id:"account-statuses",instance:h,emptyText:j._({id:"+k97fV"}),errorText:j._({id:"scd9lw"}),fetchItems:O,useItemID:!0,view:l||_?"media":void 0,boostsCarousel:t.settings.boostsCarousel,timelineStart:ie,refresh:[p,r,c,l,a+(k==null?void 0:k.acct)].toString(),headerEnd:e(ct,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:j._({id:"2FYpfJ"})})}),children:[e(ye,{disabled:!Ce,onClick:()=>{(async()=>{try{const{masto:te}=oe({instance:Q}),be=await te.v1.accounts.lookup({acct:k.acct}),{id:K}=be;location.hash=`/${Q}/a/${K}`}catch{alert(j._({id:"FgdLx0"}))}})()},children:[e(C,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"/JFxxT",values:{0:Q?e(B,{children:[" ","(",e("b",{children:Gt.toUnicode(Q)}),")"]}):null}})})]}),!T&&e(ye,{onClick:()=>{(async()=>{try{const te=await d.v1.accounts.lookup({acct:k.acct+"@"+h}),{id:be}=te;location.hash=`/${v}/a/${be}`}catch{alert(j._({id:"FgdLx0"}))}})()},children:[e(C,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"HkuyOu",values:{currentInstance:v},components:{0:e("b",{})}})})]})]})},n)}function xa(t){const{i18n:n}=Je(),{class:i,disabled:s,value:o,min:a,max:p,onInput:r=()=>{}}=t,[c,l]=(o==null?void 0:o.split("-"))||[],m=q(),h=q(),f=(d,v)=>{const[b,w]=(a==null?void 0:a.split("-"))||[],[k,y]=(p==null?void 0:p.split("-"))||[];return!(v<b||v>k||v===b&&d<w||v===k&&d>y)};return e("div",{class:i,children:[e(C,{icon:"month",size:"l"}),e("select",{ref:m,disabled:s,value:l||"",onInput:d=>{const{value:v}=d.currentTarget,b=h.current.value;if(!f(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:h,type:"number",disabled:s,value:c||new Date().getFullYear(),min:(a==null?void 0:a.slice(0,4))||mi,max:(p==null?void 0:p.slice(0,4))||new Date().getFullYear(),onInput:d=>{const{value:v,validity:b}=d.currentTarget,w=m.current.value;if(!b.valid||!f(w,v))return{value:"",validity:{valid:!1}};r({value:v?`${v}-${w}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}const Aa=20;function Rs(){We(g._({id:"7Ff7ia"}),"/bookmarks");const{masto:t,instance:n}=oe(),i=q();async function s(o){return(o||!i.current)&&(i.current=t.v1.bookmarks.list({limit:Aa})),await i.current.next()}return e(_t,{title:g._({id:"7Ff7ia"}),id:"bookmarks",emptyText:g._({id:"8k2w6G"}),errorText:g._({id:"UoL+FC"}),instance:n,fetchItems:s})}const Ea=""+new URL("catch-up-DuauQu-W.png",import.meta.url).href,Ra="home",st=[{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}],La={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},boosts:{id:"puY2t0"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},$a=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],Ma=[null,"account"],Da=ns(t=>new Intl.DateTimeFormat(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function Na(){const{i18n:t,_:n}=Je(),i=Da(t.locale);We("Catch-up","/catchup");const{masto:s,instance:o}=oe(),[a,p]=ht(),r=a.get("id"),[c,l]=L("start"),[m,h]=L(!1),f=ke(()=>vt(),[]),d=R=>R===f,v=Xe("@pixelfed/home-include-reblogs");async function b({maxCreatedAt:R}){var ne,$e,Ae;const Y=R?new Date(R):null,se=[],H=s.v1.timelines.home.list({limit:40});e:for(;;)try{v&&H.nextParams&&(typeof H.nextParams=="string"?H.nextParams+="&include_reblogs=true":H.nextParams.include_reblogs=!0);const Se=await H.next(),{value:Oe}=Se;if(Oe!=null&&Oe.length){await Es(Oe,o);let re=!1;for(let ze=0;ze<Oe.length;ze++){const Ze=Oe[ze],Tt=new Date(Ze.createdAt);if(!Y||Tt>=Y){const je=!d((($e=(ne=Ze.reblog)==null?void 0:ne.account)==null?void 0:$e.id)||Ze.account.id)&&en(((Ae=Ze.reblog)==null?void 0:Ae.filtered)||Ze.filtered,Ra);if((je==null?void 0:je.action)==="hide")continue;Ze._filtered=je;const mt=nt(Ze.id,o);Ze._followedTags=A.statusFollowedTags[mt]?[...A.statusFollowedTags[mt]]:[],se.push(Ze),re=!0}if(!re)break e}}else break e;await new Promise(re=>setTimeout(re,1e3))}catch{break e}return se.forEach(Se=>{if(Se!=null&&Se.inReplyToId){const Oe=se.find(re=>re.id===Se.inReplyToId);Oe&&!Oe.inReplyToId&&(Oe._thread=!0)}}),se}const[w,k]=L([]),y=q(),S=q(),_=ke(()=>bn(),[]),T=ot(async({duration:R}={})=>{const Y=Date.now(),se=R?Y-R:null;l("loading");const H=await b({maxCreatedAt:se}),ne=`${_}-${Eo()}`;try{await dt.catchup.set(ne,{id:ne,posts:H,count:H.length,startAt:se,endAt:Y}),p({id:ne})}catch{}},[]);ee(()=>{r?(async()=>{const R=await dt.catchup.get(r);R&&(R.posts.sort((Y,se)=>Y.createdAt>se.createdAt?1:-1),k(R.posts),l("results"))})():c==="results"&&(k([]),l("start"))},[r]);const[I,x]=$t(R=>R+1,0),[O,P]=L(null),[$,j]=L([]);ee(()=>{(async()=>{try{const R=await dt.catchup.keys();if(R.length){const Y=bn(),se=R.filter(H=>H.startsWith(`${Y}-`));if(se.length){let H=await dt.catchup.getMany(se);H.sort((Se,Oe)=>Oe.endAt-Se.endAt);let ne=H.slice(0,3),$e=H.slice(3);const Ae=ne.map(Se=>{const{id:Oe,count:re,startAt:ze,endAt:Ze}=Se;return{id:Oe,count:re,startAt:ze,endAt:Ze}});j(Ae),P(ne[0].endAt),H=null,ne=null,queueMicrotask(()=>{$e.length&&dt.catchup.delMany($e.map(Se=>Se.id)).then(()=>{$e=null}).catch(Se=>{})});return}}}catch{}j([])})()},[I]),ee(()=>{c==="start"&&x()},[c==="start"]);const[Z,J]=ke(()=>{var Oe,re,ze,Ze,Tt;let R=0,Y=0,se=0,H=0,ne=0,$e=0;const Ae={};for(const Ee of w){Ee._filtered?(R++,Ee.__FILTER="filtered"):Ee.group?(Y++,Ee.__FILTER="groups"):Ee.reblog?(se++,Ee.__FILTER="boosts"):(Oe=Ee._followedTags)!=null&&Oe.length?(ne++,Ee.__FILTER="followedTags"):Ee.inReplyToId&&Ee.inReplyToAccountId!==((re=Ee.account)==null?void 0:re.id)?(H++,Ee.__FILTER="replies"):($e++,Ee.__FILTER="original");const je=Ee.reblog||Ee;if(Ee.__FILTER!=="filtered"&&((ze=je.card)!=null&&ze.url)&&((Ze=je.card)!=null&&Ze.image)&&((Tt=je.card)==null?void 0:Tt.type)==="link"){const{card:mt,favouritesCount:on,reblogsCount:xt}=je;let{url:Qe}=mt;if(Qe=Qe.replace(/\/$/,""),!Ae[Qe])Ae[Qe]={postID:je.id,card:mt,shared:1,sharers:[Ee.account],likes:on,boosts:xt};else{if(Ae[Qe].sharers.find(Pt=>Pt.id===Ee.account.id))continue;Ae[Qe].shared++,Ae[Qe].sharers.push(Ee.account),Ae[Qe].postID!==je.id&&(Ae[Qe].likes+=on,Ae[Qe].boosts+=xt)}}}let Se=[];for(const Ee in Ae)Se.push({url:Ee,...Ae[Ee]});if(Se.sort((Ee,je)=>Ee.shared>je.shared?-1:Ee.shared<je.shared?1:Ee.boosts>je.boosts?-1:Ee.boosts<je.boosts?1:Ee.likes>je.likes?-1:Ee.likes<je.likes?1:0),Se.length>10)e:for(let Ee=10;Ee<Se.length;Ee++){const{shared:je}=Se[Ee];if(je<=1){Se=Se.slice(0,Ee);break e}}return[{filtered:R,groups:Y,boosts:se,replies:H,followedTags:ne,original:$e},Se]},[w]),[N,M]=L("all"),[z,V]=L(null),[U,ie]=L(1),[Q,de]=L("createdAt"),[Ce,te]=L("asc"),[be,K]=L(null),[ae,ue,Ie]=ke(()=>{const R={},Y=new Map;let se=w.filter(ne=>{const $e=N==="all"||ne.__FILTER===N;return $e&&(R[ne.account.id]=ne.account,Y.set(ne.account.id,(Y.get(ne.account.id)||0)+1)),$e});const H={};return se.forEach(ne=>{ne.reblog&&(H[ne.reblog.id]?(H[ne.reblog.id].__BOOSTERS?H[ne.reblog.id].__BOOSTERS.add(ne.account):H[ne.reblog.id].__BOOSTERS=new Set([ne.account]),ne.__HIDDEN=!0):H[ne.reblog.id]=ne)}),z&&Y.has(z)&&(se=se.filter(ne=>ne.account.id===z||[...ne.__BOOSTERS||[]].find($e=>$e.id===z))),[se,R,Object.fromEntries(Y)]},[N,z,w]),Me=ke(()=>{const R={};return ae.forEach(Y=>{R[Y.id]=Y}),R},[ae]),Te=ke(()=>Object.keys(Ie).sort((R,Y)=>Ie[Y]-Ie[R]),[Ie]),Re=ke(()=>{const R={};return Te.forEach((Y,se)=>{R[Y]=se}),ae.filter(Y=>!Y.__HIDDEN).sort((Y,se)=>{if(be==="account"){const H=Y.account.id,ne=se.account.id,$e=R[H],Ae=R[ne],Se=$e-Ae;if(Se!==0)return Se}if(Q!=="createdAt"&&(Y=Y.reblog||Y,se=se.reblog||se,Q!=="density"&&Y[Q]===se[Q]))return Y.createdAt>se.createdAt?1:-1;if(Q==="density"){const H=Hi(Y),ne=Hi(se);return Ce==="asc"?H>ne?1:-1:ne>H?1:-1}return Ce==="asc"?Y[Q]>se[Q]?1:-1:se[Q]>Y[Q]?1:-1})},[ae,Q,Ce,be,Te]),De=q(null),we=q(null),X=q(!1);ee(()=>{w.length>100||X.current||we.current&&(ys(we.current,{duration:200}),X.current=!0)},[w,we]);const me=w.length>160?"3d":"2d",xe=ke(()=>me!=="2d"?null:w.map(R=>{const Y=Me[R.id];return e("span",{class:`post-dot ${Y?"post-dot-highlight":""}`},R.id)}),[Me]),le=ke(()=>me!=="3d"||!(w!=null&&w.length)?null:Ha(w,"createdAt",320).map((Y,se)=>e("div",{class:"posts-bin",children:Y.map(H=>{const ne=Me[H.id];return e("span",{class:`post-dot ${ne?"post-dot-highlight":""}`},H.id)})},se)),[Me]),G=q(null),pe=ke(()=>O?(Date.now()-O)/1e3/60/60:null,[O,U]);ee(()=>{if(c!=="results")return;const R=z&&ue[z]?ue[z].username:"",Y=Ce==="asc"?0:1,se={account:"authors"};let H=he({duration:5e3,text:t._({id:"TLYeLT",values:{selectedFilterCategory:N,sortBy:Q,sortOrder:Ce,groupBy:be}})});return()=>{var ne;(ne=H==null?void 0:H.hideToast)==null||ne.call(H)}},[c,N,z,Q,Ce,be,ue]),ee(()=>{var R;if(z&&ue[z]){const Y=we.current.querySelector(`[data-author="${z}"]`),se=(R=we.current)==null?void 0:R.getBoundingClientRect(),H=Y==null?void 0:Y.getBoundingClientRect();H.left<se.left||H.right>se.right?Y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):H.top<0&&Y.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[z,ue]);const[D,E]=L(!1),F=".catchup-list > li > a",ce=Be("j",()=>{const R=document.activeElement.closest(F),Y=R==null?void 0:R.getBoundingClientRect(),se=Array.from(G.current.querySelectorAll(F));if(R&&Y.top<G.current.clientHeight&&Y.bottom>0){const H=se.indexOf(R),ne=se[H+1];ne&&(ne.focus(),ne.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const H=se.find(ne=>ne.getBoundingClientRect().top>=0);H&&(H.focus(),H.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),ve=Be("k",()=>{const R=document.activeElement.closest(F),Y=R==null?void 0:R.getBoundingClientRect(),se=Array.from(G.current.querySelectorAll(F));if(R&&Y.top<G.current.clientHeight&&Y.bottom>0){const H=se.indexOf(R);let ne=se[H-1];ne&&(ne.focus(),ne.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const H=se.find(ne=>{const $e=ne.getBoundingClientRect();return $e.top>=44&&$e.left>=0});H&&(H.focus(),H.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{preventDefault:!0,ignoreModifiers:!0}),_e=Be("h, l",(R,Y)=>{var H,ne,$e;const se=Y.keys[0];if(z){const Ae=Te.indexOf(z);se==="h"?Ae>0&&Ae<Te.length&&(V(Te[Ae-1]),(H=G.current)==null||H.focus()):se==="l"&&Ae<Te.length-1&&Ae>=0&&(V(Te[Ae+1]),(ne=G.current)==null||ne.focus())}else se==="l"&&(V(Te[0]),($e=G.current)==null||$e.focus())},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),W=Be("esc",()=>{var R;V(null),(R=G.current)==null||R.focus()},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Le=Be(".",()=>{var R;(R=G.current)==null||R.scrollTo({top:0,behavior:"smooth"})},{preventDefault:!0,ignoreModifiers:!0,enableOnFormTags:["input"]}),Pe=ot(R=>{const Y=document.activeElement,se=(Y==null?void 0:Y.tagName)==="INPUT"&&Y.type==="radio";if((R.key==="ArrowDown"||R.key==="ArrowUp"||R.key==="ArrowLeft"||R.key==="ArrowRight")&&se){Y.blur();return}},[]);return e("div",{ref:R=>{G.current=R,ce(R),ve(R),_e(R),W(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 Y;R.target.closest("a, button")||(Y=G.current)==null||Y.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),c==="results"&&e(fe,{to:"/catchup",class:"button plain",children:e(C,{icon:"history2",size:"l",alt:t._({id:"xrl8fj"})})}),c==="start"&&e(fe,{to:"/",class:"button plain",children:e(C,{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:Pe,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:Ea,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:y,type:"range",value:U,min:st[0].value,max:st[st.length-1].value,step:"1",list:"catchup-ranges",onChange:R=>ie(+R.target.value)})," ",e("span",{style:{width:"8em"},children:[n(st[U-1].label),e("br",{}),e("small",{class:"insignificant",children:U==st[st.length-1].value?t._({id:"NMNiaO"}):ut(new Date(Date.now()-U*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:st.map(({label:R,value:Y})=>e("option",{value:Y,label:n(R)}))})," ",e("button",{type:"button",onClick:()=>{var R;if(U<st[st.length-1].value){let Y;U===st[st.length-1].value&&((R=S.current)!=null&&R.checked)?Y=Date.now()-O:Y=U*60*60*1e3,T({duration:Y})}else T()},children:e(u,{id:"R0yu2l"})})]}),pe&&U>pe?e("p",{class:"catchup-info",children:[e(C,{icon:"info"})," ",e(u,{id:"AGyV7s"})]}):U===st[st.length-1].value&&O?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:S})," ",e(u,{id:"dDJEHI",values:{0:i.format(new Date(O))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"EAjFM0"})})}),!!($!=null&&$.length)&&e("div",{class:"catchup-prev",children:[e("p",{children:e(u,{id:"Yfb9A8"})}),e("ul",{children:$.map(R=>e("li",{children:[e(fe,{to:`/catchup?id=${R.id}`,children:[e(C,{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 se;if(confirm(t._({id:"D9CmP2"}))){let H=he(H`Removing Catch-up ${R.id}`);await dt.catchup.del(R.id),(se=H==null?void 0:H.hideToast)==null||se.call(H),he(H`Catch-up ${R.id} removed`),x()}},children:e(C,{icon:"x",alt:t._({id:"t/YqKh"})})})]})]},R.id))}),$.length>=3&&e("p",{children:e("small",{children:e(u,{id:"sXmrl4"})})})]})]}),c==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(Ne,{abrupt:!0}),e("p",{class:"insignificant",children:e(u,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(u,{id:"q9urQO"})})]}),c==="results"&&e(B,{children:[e("div",{class:"catchup-header",children:[w.length>0&&e("p",{children:e("b",{class:"ib",children:i.formatRange(new Date(w[0].createdAt),new Date(w[w.length-1].createdAt))})}),e("aside",{children:[e("button",{hidden:N==="all"&&!z&&Q==="createdAt"&&Ce==="asc",type:"button",class:"plain4 small",onClick:()=>{M("all"),V(null),de("createdAt"),K(null),te("asc")},children:e(u,{id:"I9EnzM"})}),(J==null?void 0:J.length)>0&&e("button",{type:"button",class:"plain small",onClick:()=>h(!m),children:[e(u,{id:"EIZREX"})," ",e(C,{icon:"chevron-down",style:{transform:m?"rotate(180deg)":"rotate(0deg)"}})]})]})]}),e("div",{class:"shazam-container no-animation",hidden:!m,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"catchup-top-links links-bar",children:J.map(R=>{const{card:Y,shared:se,sharers:H,likes:ne,boosts:$e}=R,{blurhash:Ae,title:Se,description:Oe,url:re,image:ze,imageDescription:Ze,language:Tt,width:Ee,height:je,publishedAt:mt}=Y,on=Gt.toUnicode(URL.parse(re).hostname.replace(/^www\./,"").replace(/\/$/,""));let xt;if(Ae){const Qe=ti(Ae),Pt=hi(Qe);xt=fi([.6,Pt[1],Pt[2]])}return e("a",{href:re,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:ze,alt:Ze,width:Ee,height:je,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:on})," ",!!mt&&e(B,{children:"· "}),!!mt&&e(B,{children:e(Vt,{datetime:mt,format:"micro"})})]}),!!Se&&e("h1",{class:"title",lang:Tt,dir:"auto",title:Se,children:Se})]}),!!Oe&&e("p",{class:"description",lang:Tt,dir:"auto",title:Oe,children:Oe}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(u,{id:"bfSr6z",values:{0:H.map(Qe=>{const{avatarStatic:Pt,displayName:Ws}=Qe;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:bi=>{bi.preventDefault(),bi.stopPropagation();const{id:Zs}=Qe;V(Zs),M("all")},children:e(lt,{url:Pt,size:"s",alt:Ws})})})}})})]})]})},re)})})})}),w.length>=5&&(me==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:le}):e("div",{class:"catchup-posts-viz-bar",children:xe})),w.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:N.toLowerCase()==="all",onChange:()=>{M("all")}}),e(u,{id:"N40H+G"})," ",e("span",{class:"count",children:w.length})]}),Object.entries(La).map(([R,Y])=>!!Z[R]&&e("label",{class:"filter-cat",title:(Z[R]/w.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:N.toLowerCase()===R.toLowerCase(),onChange:()=>{M(R),R==="boosts"&&(de("reblogsCount"),te("desc"),K(null))}}),n(Y)," ",e("span",{class:"count",children:Z[R]})]},n(Y)))]}),w.length>=2&&!!Ie&&e("div",{class:"catchup-filters authors-filters",ref:we,children:[Te.map(R=>e("label",{class:"filter-author","data-author":R,children:[e("input",{type:"radio",name:"filter-author",checked:z===R,onChange:()=>{V(R)},onClick:()=>{z===R&&V(null)}}),e(lt,{url:ue[R].avatarStatic||ue[R].avatar,size:"xxl",alt:`${ue[R].displayName} (@${ue[R].acct})`})," ",e("span",{class:"count",children:Ie[R]}),e("span",{class:"username",children:ue[R].username})]},`${R}-${Ie[R]}`)),Te.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(u,{id:"HHtYi7",values:{0:Te.length}})},"authors-count")]}),w.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:$a.map(R=>e("label",{class:"filter-sort",onClick:Y=>{Q===R&&(Y.preventDefault(),Y.stopPropagation(),te(Ce==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:Q===R,onChange:()=>{de(R);const Y=/(replies|favourites|reblogs)/.test(R)?"desc":"asc";te(Y)}}),{createdAt:t._({id:"mYGY3B"}),repliesCount:t._({id:"N8UzTV"}),favouritesCount:t._({id:"zZOZj7"}),reblogsCount:t._({id:"puY2t0"}),density:t._({id:"0tQ7AD"})}[R],Q===R&&(Ce==="asc"?" ↑":" ↓")]},R))}),e("span",{class:"filter-label",children:e(u,{id:"L8fEEm"})})," ",e("fieldset",{class:"radio-field-group",children:Ma.map(R=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:be===R,onChange:()=>{K(R)},disabled:R==="account"&&z}),{account:t._({id:"dpqPBg"})}[R]||t._({id:"EdQY6l"})]},R||"none"))}),z&&Te.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{V(null)},style:{whiteSpace:"nowrap"},children:e(u,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${N||""} ${Q?`catchup-sort-${Q}`:""} ${z&&ue[z]?"catchup-selected-author":""} ${be?`catchup-group-${be}`:""}`,children:Re.map((R,Y)=>{var ne;const se=((ne=R.reblog)==null?void 0:ne.id)||R.id;let H=!1;return be==="account"&&(De.current&&R.account.id!==De.current&&Y>0&&(H=!0),De.current=R.account.id),e(B,{children:[H&&e("li",{class:"separator"}),e(Oa,{to:`/${o}/s/${se}`,post:R,root:G.current})]},`${R.id}-${H}`)})}),e("footer",{children:ae.length>5&&e("p",{children:[N==="boosts"?t._({id:"eVosYr"}):t._({id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{G.current.scrollTop=0},children:e(u,{id:"0MgdN+"})}),"."]})})]})]})]}),D&&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(C,{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 Pa=it(function({post:t}){const{id:n,account:i,group:s,reblog:o,inReplyToId:a,inReplyToAccountId:p,_followedTags:r,_filtered:c,visibility:l,__BOOSTERS:m}=t,h=a&&p!==i.id,f=!!c,d=v=>{v.shiftKey};return e("article",{class:`post-line ${s?"group":o?"reblog":r!=null&&r.length?"followed-tags":""} ${h?"reply-to":""} ${f?"filtered":""} visibility-${l}`,onMouseEnter:d,children:[e("span",{class:"post-author",children:o?e("span",{class:"post-reblog-avatar",children:[e(lt,{url:i.avatarStatic||i.avatar,squircle:i.bot}),(m==null?void 0:m.size)>0?[...m].map(v=>e(lt,{url:v.avatarStatic||v.avatar,squircle:v.bot})):""," ",e(C,{icon:"rocket"})," ",e(pt,{account:o.account,showAvatar:!0})]}):e(pt,{account:i,showAvatar:!0})}),e(Fa,{post:o||t,filterInfo:c}),e("span",{class:"post-meta",children:[e(Ba,{post:o||t})," ",e(Vt,{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)}),Oa=({root:t,to:n,...i})=>{const s=q(),[o,a]=L(!1);return ee(()=>{const p=new IntersectionObserver(r=>{r[0].isIntersecting&&(queueMicrotask(()=>a(!0)),p.unobserve(s.current))},{root:t,rootMargin:`${Math.max(320,screen.height*.75)}px`});return s.current&&p.observe(s.current),()=>{s.current&&p.unobserve(s.current)}},[]),o?e("li",{children:e(fe,{to:n,children:e(Pa,{...i})})}):e("li",{ref:s,style:{height:"4em"}})},za=8,Ua=8;function Hi(t){var c;const{spoilerText:n,content:i,poll:s,mediaAttachments:o,card:a}=t,p=(c=s==null?void 0:s.options)!=null&&c.length?s.options.reduce((l,m)=>l+m.title,""):"";return(n.length+us(i)+p.length)/140+(o!=null&&o.length?za*o.length:a!=null&&a.image?Ua:0)}const St=48;function Fa({post:t,filterInfo:n}){var y;const{spoilerText:i,sensitive:s,content:o,emojis:a,poll:p,mediaAttachments:r,card:c,inReplyToId:l,inReplyToAccountId:m,account:h,_thread:f}=t,d=l&&m===h.id||!!f,v=ke(()=>!!(ge.account.get("preferences")||{})["reading:expand:spoilers"],[]),b=v||!i&&!s,w=o?ni(t):"",k=!i||v;return e("div",{class:"post-peek",title:i?"":w,children:[e("span",{class:"post-peek-content",children:[d&&!k&&e(B,{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(B,{children:[!!i&&e("span",{class:"post-peek-spoiler",children:[e(C,{icon:`${v?"eye-open":"eye-close"}`})," ",i]}),k&&e("div",{class:"post-peek-html",children:[d&&e(B,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(u,{id:"e66y2Z"})})," "]}),!!o&&e("div",{dangerouslySetInnerHTML:{__html:Ro(o,a)}}),!!((y=p==null?void 0:p.options)!=null&&y.length)&&p.options.map(S=>e("div",{children:[p.multiple?"▪️":"•"," ",S.title]})),!o&&(r==null?void 0:r.length)===1&&r[0].description&&e(B,{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:[!!p&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(C,{icon:"poll",size:"s"}),e(u,{id:"4WUbF1"})]}),r!=null&&r.length?r.map(S=>{var O,P,$,j,Z,J,N,M,z,V;const _=S.previewUrl||S.url,T=S.previewRemoteUrl||S.remoteUrl,I=(O=S.meta)!=null&&O.original?S.meta.original.width:(($=(P=S.meta)==null?void 0:P.small)==null?void 0:$.width)||((Z=(j=S.meta)==null?void 0:j.original)==null?void 0:Z.width),x=(J=S.meta)!=null&&J.original?S.meta.original.height:((M=(N=S.meta)==null?void 0:N.small)==null?void 0:M.height)||((V=(z=S.meta)==null?void 0:z.original)==null?void 0:V.height);return e("span",{class:"post-peek-media",children:{image:(_||T)&&b?e("img",{src:_,width:St,height:St,alt:S.description,loading:"lazy",onError:U=>{const{src:ie}=U.target;ie===_&&(U.target.src=T)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(I,x)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(_||T)&&b?e("img",{src:_,width:St,height:St,alt:S.description,loading:"lazy",onError:U=>{const{src:ie}=U.target;ie===_&&(U.target.src=T)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(_||T)&&b?e("img",{src:_,width:St,height:St,alt:S.description,loading:"lazy",onError:U=>{const{src:ie}=U.target;ie===_&&(U.target.src=T)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[S.type]||null},S.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:St,height:St,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 Ba({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(C,{icon:"comment2",size:"s",alt:g._({id:"N8UzTV"})})," ",Ge(i)]}),s>0&&e("span",{class:"post-stat-likes",children:[e(C,{icon:"heart",size:"s",alt:g._({id:"zZOZj7"})})," ",Ge(s)]}),n>0&&e("span",{class:"post-stat-boosts",children:[e(C,{icon:"rocket",size:"s",alt:g._({id:"puY2t0"})})," ",Ge(n)]})]})}function Ha(t,n,i){const s=t.map(c=>new Date(c[n])),o=s.reduce((c,l)=>l<c?l:c,s[0]),p=s.reduce((c,l)=>l>c?l:c,s[0]).getTime()-o.getTime(),r=Array.from({length:i},()=>[]);return t.forEach(c=>{const m=(new Date(c[n]).getTime()-o.getTime())/p,h=Math.floor(m*(i-1));r[h].push(c)}),r}const qa=20;function Ls(){We(g._({id:"zZOZj7"}),"/favourites");const{masto:t,instance:n}=oe(),i=q();async function s(o){return(o||!i.current)&&(i.current=t.v1.favourites.list({limit:qa})),await i.current.next()}return e(_t,{title:g._({id:"zZOZj7"}),id:"favourites",emptyText:g._({id:"PHIrMr"}),errorText:g._({id:"khVljG"}),instance:n,fetchItems:s})}const ja=["home","public","notifications","thread","account"],qi=["notifications","thread","account"],Ya={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},Va=[0,30*60,60*60,6*60*60,12*60*60,60*60*24,60*60*24*7,60*60*24*30],zn={0:{id:"qqeAJM"},1800:et(30,"minute"),3600:et(1,"hour"),21600:et(6,"hour"),43200:et(12,"hour"),86400:et(24,"hour"),604800:et(7,"day"),2592e3:et(30,"day")};function Ga(){const{masto:t}=oe();We(g._({id:"cSev+j"}),"/ft");const[n,i]=L("default"),[s,o]=L(!1),[a,p]=$t(l=>l+1,0),[r,c]=L([]);return ee(()=>{i("loading"),(async()=>{try{const l=await t.v2.filters.list();l.sort((m,h)=>m.title.localeCompare(h.title)),l.forEach(m=>{var h;(h=m.keywords)!=null&&h.length&&m.keywords.sort((f,d)=>f.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(fe,{to:"/",class:"button plain",children:e(C,{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(C,{icon:"plus",size:"l",alt:g._({id:"yFfBdX"})})})})]})}),e("main",{children:r.length>0?e(B,{children:[e("ul",{class:"filters-list",children:r.map(l=>{const{id:m,title:h,expiresAt:f,keywords:d}=l;return e("li",{children:[e("div",{children:[e("h2",{children:h}),(d==null?void 0:d.length)>0&&e("div",{children:d.map(v=>e(B,{children:[e("span",{class:"tag collapsed insignificant",children:v.wholeWord?`“${v.keyword}”`:v.keyword})," "]}))}),e("small",{class:"insignificant",children:e($s,{expiresAt:f})})]}),e("button",{type:"button",class:"plain",onClick:()=>{o({filter:l})},children:e(C,{icon:"pencil",size:"l",alt:"Edit filter"})})]},m)})}),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(Ne,{})}):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(Za,{filter:s==null?void 0:s.filter,onClose:l=>{l.state==="success"&&p(),o(!1)}})})]})}let Ka=1;const Wa=()=>Ka++;function Za({filter:t,onClose:n}){const{_:i}=Je(),{masto:s}=oe(),[o,a]=L("default"),p=!!t,{context:r,expiresAt:c,id:l,keywords:m,title:h,filterAction:f}=t||{},d=!!c,v=d&&new Date(c),[b,w]=L(m||[]),k=q(),[y,S]=L([]),[_,T]=L([]),I=b.filter(x=>!y.includes(x.id)&&!_.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(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:p?g._({id:"3mOee6"}):g._({id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:x=>{x.preventDefault();const O=new FormData(x.target),P=O.get("title"),$=O.getAll("keyword_attributes[][id]"),j=O.getAll("keyword_attributes[][keyword]"),Z=[...k.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(V=>V.checked),J=j.map((V,U)=>({id:$[U]||void 0,keyword:V,wholeWord:Z[U]}));p&&(y!=null&&y.length)&&y.forEach(V=>{J.push({id:V,_destroy:!0})});const N=O.getAll("context");let M=O.get("expires_in");const z=O.get("filter_action");!P||!(N!=null&&N.length)||(a("loading"),(async()=>{try{let V;p?(M===""||M===null?d?M=Math.floor((v-new Date)/1e3):M=null:M==="0"||M===0?M=null:M=+M,V=await s.v2.filters.$select(l).update({title:P,context:N,expiresIn:M,keywordsAttributes:J,filterAction:z})):(M=+M||null,V=await s.v2.filters.create({title:P,context:N,expiresIn:M,keywordsAttributes:J,filterAction:z})),a("default"),n==null||n({state:"success",filter:V})}catch{a("error"),alert(p?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:h,disabled:o==="loading",dir:"auto",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:k,children:[I.length?e("ul",{class:"filter-keywords",children:I.map(x=>{const{id:O,keyword:P,wholeWord:$,_id:j}=x;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:O}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:P,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:O,defaultChecked:$,disabled:o==="loading"})," ",e(u,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:o==="loading",onClick:()=>{O?(y.push(O),S([...y])):j&&(_.push(j),T([..._]))},children:e(C,{icon:"x",alt:g._({id:"t/YqKh"})})})]})]},`${O}-${j}`)})}):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:()=>{w([...b,{_id:Wa(),keyword:"",wholeWord:!0}]),setTimeout(()=>{var O,P;const x=k.current.querySelectorAll('input[type="text"]');(P=(O=x[x.length-1])==null?void 0:O.focus)==null||P.call(O)},10)},children:e(u,{id:"qn5Dbn"})})," ",(I==null?void 0:I.length)>1&&e("small",{class:"insignificant",children:e(u,{id:"1JZ175",values:{0:I.length}})})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:e(u,{id:"uqf7Yq"})})}),ja.map(x=>e("div",{children:[e("label",{class:qi.includes(x)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:x,defaultChecked:r?r.includes(x):!0,disabled:o==="loading"})," ",i(Ya[x]),qi.includes(x)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(u,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[p&&e(u,{id:"ucJk3m",components:{0:e("b",{}),1:e($s,{expiresAt:c,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:p?g._({id:"BcNdg+"}):g._({id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:o==="loading",defaultValue:p?void 0:0,children:[p&&e("option",{}),Va.map(x=>e("option",{value:x,children:typeof zn[x]=="function"?zn[x]():i(zn[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:f==="warn"||!p,disabled:o==="loading"})," ",e(u,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:f==="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:p?g._({id:"tfDRzk"}):g._({id:"hYgDIe"})})," ",e(Ne,{abrupt:!0,hidden:o!=="loading"})]}),p&&e(rt,{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 $s({expiresAt:t,showNeverExpires:n}){const i=!!t,s=i&&new Date(t),o=i&&s<=new Date,[a,p]=$t(r=>r+1,0);return Qn(p,o||3e4),o?g._({id:"M1RnFv"}):i?e(u,{id:"urGtsw",components:{0:e(Vt,{datetime:s})}}):n&&g._({id:"O1Aswy"})}function Xa(){const{masto:t,instance:n}=oe();We(g._({id:"Xi1/bw"}),"/fh");const[i,s]=L("default"),[o,a]=L([]);return ee(()=>{s("loading"),(async()=>{try{const p=await kn();a(p),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(fe,{to:"/",class:"button plain",children:e(C,{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(B,{children:[e("ul",{class:"link-list",children:o.map(p=>e("li",{children:e(fe,{to:n?`/${n}/t/${p.name}`:`/t/${p.name}`,children:[e(C,{icon:"hashtag",alt:"#"})," ",e("span",{children:p.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(Ne,{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 Ja=20;function gi({title:t,path:n,id:i,...s}){We(t||g._({id:"y6sq5j"}),n||"/following");const{masto:o,streaming:a,instance:p}=oe(),r=He(A),c=q(),l=q();__BENCHMARK.end("time-to-following");const m=Xe("@pixelfed/home-include-reblogs");async function h(d){var w;(d||!c.current)&&(__BENCHMARK.start("fetch-home-first"),c.current=o.v1.timelines.home.list({limit:Ja})),m&&((w=c.current)!=null&&w.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 k=!1;d&&(b[0].id!==l.current&&(k=!0),l.current=b[0].id),b.forEach(y=>{Ke(y,p)}),b=Ui(b,p),d&&k&&pa(),Es(b,p),b.sort((y,S)=>{const _=new Date(y.createdAt);return new Date(S.createdAt)-_})}return __BENCHMARK.end("fetch-home-first"),{...v,value:b}}async function f(){var d;try{const v={limit:5,since_id:l.current};Xe("@pixelfed/home-include-reblogs")&&(v.include_reblogs=!0);const b=await o.v1.timelines.home.list(v).next();let{value:w}=b;const k=((d=w[0])==null?void 0:d.id)===l.current;return!!(w!=null&&w.length&&!k&&(l.current=w[0].id,w=Ui(w,p),w=Rt(w,"home"),w.some(y=>!y.reblog)))}catch{return!1}}return ee(()=>{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;Ke(b,p)}else if(v.event==="delete"){const b=v.payload,w=is(b,p);w&&(w._deleted=!0)}}}})(),()=>{var v;(v=d==null?void 0:d.unsubscribe)==null||v.call(d),d=null}},[a]),e(_t,{title:t||g._({id:"y6sq5j"}),id:i||"following",emptyText:g._({id:"nJEKbY"}),errorText:g._({id:"7QSeK6"}),instance:p,fetchItems:h,checkForUpdates:f,useItemID:!0,boostsCarousel:r.settings.boostsCarousel,...s,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Qa=20,er=4,ji=er+1;function Ms({media:t,columnMode:n,...i}){let{hashtag:s,...o}=n?{}:Mt();i.hashtag&&(s=i.hashtag);let a=s.trim().split(/[\s+]+/);a.sort(),s=a[0];const[p,r]=ht(),c=t||!!p.get("media"),l=c?"?media=1":"",{masto:m,instance:h,authenticated:f}=oe({instance:(i==null?void 0:i.instance)||o.instance}),{masto:d,instance:v,authenticated:b}=oe(),w=a.map(U=>`#${U}`).join(" "),k=h?c?g._({id:"kH0rA0",values:{hashtagTitle:w,instance:h}}):g._({id:"IK0zKi",values:{hashtagTitle:w,instance:h}}):c?g._({id:"hHSI3w",values:{hashtagTitle:w}}):g._({id:"+ZzjRY",values:{hashtagTitle:w}});We(k,"/:instance?/t/:hashtag");const y=q(),S=ke(()=>Xn(),[]),_=q(void 0);async function T(U){const ie=await m.v1.timelines.tag.$select(s).list({limit:Qa,any:a.slice(1),maxId:U?void 0:_.current,onlyMedia:c?!0:void 0}).next();let{value:Q}=ie;return Q!=null&&Q.length&&(U&&(y.current=Q[0].id),Q.forEach(de=>{Ke(de,h,{skipThreading:c||S})}),_.current=Q[Q.length-1].id),{...ie,value:Q}}async function I(){var U;try{const ie=await m.v1.timelines.tag.$select(s).list({limit:1,any:a.slice(1),since_id:y.current,onlyMedia:c}).next();let{value:Q}=ie;const de=((U=Q[0])==null?void 0:U.id)===y.current;return Q!=null&&Q.length&&!de?(Q=Rt(Q,"public"),!0):!1}catch{return!1}}const[x,O]=L("default"),[P,$]=L();ee(()=>{(async()=>{try{const U=await m.v1.tags.$select(s).fetch();$(U)}catch{}})()},[s]);const j=a.length>=ji,[Z,J]=L("default"),[N,M]=L([]),[z,V]=L(!1);return ee(()=>{f&&(async()=>{try{const U=await m.v1.featuredTags.list();M(U),V(U.some(ie=>ie.name.toLowerCase()===s.toLowerCase()))}catch{}})()},[]),e(_t,{title:k,titleComponent:!!h&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:w}),e("div",{children:h})]}),id:"hashtag",instance:h,emptyText:g._({id:"CNSLAW"}),errorText:g._({id:"yjj6Ll"}),fetchItems:T,checkForUpdates:I,useItemID:!0,view:c||S?"media":void 0,refresh:c,filterContext:"public",headerEnd:e(ct,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[!!P&&a.length===1&&e(B,{children:[e(rt,{subMenu:!0,confirm:P.following,confirmLabel:g._({id:"ctJi7k",values:{hashtag:s}}),disabled:x==="loading"||!f,onClick:()=>{O("loading"),P.following?m.v1.tags.$select(s).unfollow().then(()=>{$({...P,following:!1}),he(g._({id:"doK/ij",values:{hashtag:s}}))}).catch(U=>{alert(U)}).finally(()=>{O("default")}):m.v1.tags.$select(s).follow().then(()=>{$({...P,following:!0}),he(g._({id:"R9+aEN",values:{hashtag:s}}))}).catch(U=>{alert(U)}).finally(()=>{O("default")})},children:P.following?e(B,{children:[e(C,{icon:"check-circle"})," ",e("span",{children:e(u,{id:"HOSk7R"})})]}):e(B,{children:[e(C,{icon:"plus"})," ",e("span",{children:e(u,{id:"MKEPCY"})})]})}),e(ye,{type:"checkbox",checked:z,disabled:Z==="loading"||!f,onClick:()=>{if(J("loading"),z){const U=N.find(ie=>ie.name.toLowerCase()===s.toLowerCase()).id;U?m.v1.featuredTags.$select(U).remove().then(()=>{V(!1),he(g._({id:"VH+Tf9"})),M(N.filter(ie=>ie.id!==U))}).catch(ie=>{}).finally(()=>{J("default")}):he(g._({id:"3OLv47"}))}else m.v1.featuredTags.create({name:s}).then(U=>{V(!0),he(g._({id:"9ra4hn"})),M(N.concat(U))}).catch(U=>{}).finally(()=>{J("default")})},children:z?e(B,{children:[e(C,{icon:"check-circle"}),e("span",{children:e(u,{id:"9ra4hn"})})]}):e(B,{children:[e(C,{icon:"check-circle"}),e("span",{children:e(u,{id:"UlJ3QN"})})]})}),e(Ve,{})]}),!S&&e(B,{children:[e(hs,{className:"plain",children:e(u,{id:"cSev+j"})}),e(ye,{type:"checkbox",checked:!!c,onClick:()=>{c?p.delete("media"):p.set("media","1"),r(p)},children:[e(C,{icon:"check-circle",alt:"☑️"})," ",e("span",{class:"menu-grow",children:e(u,{id:"eK4SL/"})})]}),e(Ve,{})]}),e(Lo,{className:"menu-field",disabled:j,children:({ref:U})=>e("form",{onSubmit:ie=>{var de,Ce;ie.preventDefault();const Q=(Ce=(de=ie.target[0].value)==null?void 0:de.trim)==null?void 0:Ce.call(de);Q&&!a.some(te=>te.toLowerCase()===Q.toLowerCase())&&(a.push(Q),a.sort(),location.hash=h?`/${h}/t/${a.join("+")}`:`/t/${a.join("+")}${l}`)},children:[e(C,{icon:"hashtag"}),e("input",{ref:U,type:"text",placeholder:j?g._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:ji}}):g._({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:j,dir:"auto"})]})}),e($o,{takeOverflow:!0,children:a.map((U,ie)=>e(ye,{disabled:a.length===1,onClick:Q=>{a.splice(ie,1),a.sort(),location.hash=h?`/${h}/t/${a.join("+")}${l}`:`/t/${a.join("+")}${l}`},children:[e(C,{icon:"x",alt:g._({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),U]})]},U))}),e(Ve,{}),e(ye,{disabled:!b,onClick:()=>{if(A.shortcuts.length>=bt){alert(g._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:bt}}));return}const U={type:"hashtag",hashtag:a.join(" "),instance:h,media:c?"on":void 0};A.shortcuts.some(Q=>Q.type===U.type&&Q.hashtag.split(/[\s+]+/).sort().join(" ")===U.hashtag.split(/[\s+]+/).sort().join(" ")&&(Q.instance?Q.instance===U.instance:!0)&&(Q.media?!!Q.media==!!U.media:!0))?alert(g._({id:"kfeQnS"})):(A.shortcuts.push(U),he(g._({id:"MIhb91"})))},children:[e(C,{icon:"shortcut"})," ",e("span",{children:e(u,{id:"i02Lq/"})})]}),e(ye,{onClick:()=>{let U=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(U)){U&&alert(g._({id:"7WddtO"}));return}U&&(U=U.toLowerCase().trim(),location.hash=`/${U}/t/${a.join("+")}${l}`)},children:[e(C,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),v!==h&&e(ye,{onClick:()=>{location.hash=`/${v}/t/${a.join("+")}${l}`},children:[e(C,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:v},components:{0:e("b",{})}})})]})]})},h+w)}const tr=20;function Ds(t){var k;const n=He(A),{masto:i,instance:s}=oe(),o=(t==null?void 0:t.id)||((k=Mt())==null?void 0:k.id),a=q(),p=q();async function r(y){(y||!p.current)&&(p.current=i.v1.timelines.list.$select(o).list({limit:tr}));const S=await p.current.next();let{value:_}=S;return _!=null&&_.length&&(y&&(a.current=_[0].id),_.forEach(T=>{Ke(T,s)})),{...S,value:_}}async function c(){var y;try{const S=await i.v1.timelines.list.$select(o).list({limit:1,since_id:a.current});let{value:_}=S;const T=((y=_[0])==null?void 0:y.id)===a.current;return _!=null&&_.length&&!T?(_=Rt(_,"home"),!0):!1}catch{return!1}}const[l,m]=L([]);ee(()=>{sn().then(m)},[]);const[h,f]=L({title:"List"});We(h.title,"/l/:id"),ee(()=>{(async()=>{try{const y=await Ss(o);f(y)}catch{}})()},[o]);const[d,v]=L(!1),[b,w]=L(!1);return e(B,{children:[e(_t,{title:h.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(ct,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(C,{icon:"list",size:"l",alt:g._({id:"h16FyT"})}),e(C,{icon:"chevron-down",size:"s"})]}),children:[e(Ue,{to:"/l",children:e("span",{children:e(u,{id:"BHWx+g"})})}),(l==null?void 0:l.length)>0&&e(B,{children:[e(Ve,{}),l.map(y=>e(Ue,{to:`/l/${y.id}`,children:e("span",{children:y.title})},y.id))]})]}),headerEnd:e(ct,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(ye,{onClick:()=>v({list:h}),children:[e(C,{icon:"pencil",size:"l"}),e("span",{children:e(u,{id:"ePK91l"})})]}),e(ye,{onClick:()=>w(!0),children:[e(C,{icon:"group",size:"l"}),e("span",{children:e(u,{id:"hB02vO"})})]})]})},o),d&&e(Fe,{onClick:y=>{y.target===y.currentTarget&&v(!1)},children:e(ui,{list:d==null?void 0:d.list,onClose:y=>{y.state==="success"&&y.list?f(y.list):y.state==="deleted"&&(location.hash="/l"),v(!1)}})}),b&&e(Fe,{onClick:y=>{y.target===y.currentTarget&&w(!1)},children:e(ir,{listID:o,onClose:()=>w(!1)})})]})}const nr=40;function ir({listID:t,onClose:n}){const{masto:i,instance:s}=oe(),[o,a]=L([]),[p,r]=L("default"),[c,l]=L(!1),m=q();async function h(f){l(!1),r("loading"),(async()=>{try{(f||!m.current)&&(m.current=i.v1.lists.$select(t).accounts.list({limit:nr}));const d=await m.current.next();let{done:v,value:b}=d;b!=null&&b.length?(a(f?b:o.concat(b)),l(!v)):l(!1),r("default")}catch{r("error")}})()}return ee(()=>{h(!0)},[]),e("div",{class:"sheet",id:"list-manage-members-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(C,{icon:"x",alt:g._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(u,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[o.map(f=>e("li",{children:[e(at,{account:f,instance:s}),e(sr,{account:f,listID:t})]},f.id)),c&&p==="default"&&e(wt,{as:"li",onChange:f=>f&&h(),children:e("button",{type:"button",class:"light block",onClick:h,children:e(u,{id:"uXRAkV"})})})]})})]})}function sr({account:t,listID:n}){const{masto:i}=oe(),[s,o]=L("default"),[a,p]=L(!1);return e(rt,{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"),p(!1)}catch{o("error")}})()):(o("loading"),(async()=>{try{await i.v1.lists.$select(n).accounts.remove({accountIds:[t.id]}),o("default"),p(!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 or={mention:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]};function Ns(t){return t.filter(n=>{const{type:i,id:s,createdAt:o}=n;if(!i)return!1;const a=or[i];return a!=null&&a.length?a.every(p=>!!n[p]):!0})}function Ps(t){if(t!=null&&t.notificationGroups){const{accounts:n=[],notificationGroups:i=[],statuses:s=[]}=t;return i.map(o=>{const{sampleAccountIds:a,statusId:p}=o,r=(a==null?void 0:a.map(l=>n.find(m=>m.id===l)))||[],c=(s==null?void 0:s.find(l=>l.id===p))||null;return{...o,sampleAccounts:r,status:c}})}return t}function cr(t){const n=t.map(p=>{const{latestPageNotificationAt:r,mostRecentNotificationId:c,sampleAccounts:l,notificationsCount:m}=p;return{id:""+c,createdAt:r,account:l[0],...p}}),i={},s=[];for(let p=0;p<n.length;p++){const r=n[p],{type:c,status:l,createdAt:m,notificationsCount:h,sampleAccounts:f,groupKey:d}=r,v=m?new Date(m).toLocaleDateString():"";let b=c;const w=h>0&&h===(f==null?void 0:f.length);(c==="favourite"||c==="reblog")&&(b="favourite+reblog");const k=`${l==null?void 0:l.id}-${b}-${v}`,y=i[k];if(y)f.forEach(S=>{const _=y.sampleAccounts.find(T=>T.id===S.id);_?(_._types.push(c),_._types.sort().reverse()):y.sampleAccounts.push({...S,_types:[c]})}),y.notificationsCount=Math.min(y.notificationsCount,h),y._notificationsCount.push(h),y._accounts=y.sampleAccounts,y._groupKeys.push(d);else{const S=f.map(_=>({..._,_types:[c]}));i[k]={...r,sampleAccounts:S,type:b,_accounts:S,_groupKeys:d?[d]:[],_notificationsCount:[h]},s.push(i[k])}}const o={},a=[];for(let p=0;p<s.length;p++){const r=s[p],{type:c,account:l,_accounts:m,sampleAccounts:h,createdAt:f,groupKey:d}=r,v=f?new Date(f).toLocaleDateString():"",b=(h==null?void 0:h.length)===1||(m==null?void 0:m.length)===1;if((c==="favourite"||c==="reblog"||c==="favourite+reblog")&&b){const w=`${l==null?void 0:l.id}-${c}-${v}`,k=o[w];if(k)k._statuses.push(r.status),k._ids+=`-${r.id}`,k._groupKeys.push(d);else{let y=o[w]={...r,type:c,_ids:r.id,_statuses:[r.status],_groupKeys:d?[d]:[]};a.push(y)}}else a.push(r)}return a}function ar(t){t=Ns(t);const n={},i=[];for(let a=0,p=0;a<t.length;a++){const r=t[a],{id:c,status:l,account:m,type:h,createdAt:f}=r,d=f?new Date(f).toLocaleDateString():"";let v=h;(h==="favourite"||h==="reblog")&&(v="favourite+reblog");const b=`${l==null?void 0:l.id}-${v}-${d}`,w=n[b];if(v==="follow_request")i[p++]=r;else if(w!=null&&w.account){const k=w._accounts.find(y=>y.id===m.id);k?(k._types.push(h),k._types.sort().reverse(),w._ids+=`-${c}`):(m._types=[h],w._accounts.push(m),w._ids+=`-${c}`)}else{m&&(m._types=[h]);let k=n[b]={...r,type:v,_ids:c,_accounts:m?[m]:[]};i[p++]=k}}const s={},o=[];for(let a=0,p=0;a<i.length;a++){const r=i[a],{id:c,account:l,_accounts:m,type:h,createdAt:f}=r,d=f?new Date(f).toLocaleDateString():"";if(h==="favourite+reblog"&&l&&m.length===1){const v=`${l==null?void 0:l.id}-${h}-${d}`,b=s[v];if(b)b._statuses.push(r.status),b._ids+=`-${c}`;else{let w=s[v]={...r,type:h,_ids:c,_statuses:[r.status]};o[p++]=w}}else o[p++]=r}return o}const Yi=20,rr=new URLSearchParams;function Os({columnMode:t,...n}){const{masto:i,instance:s}=oe(),[o]=t?[rr]:ht(),[a,p]=L(null),r=(n==null?void 0:n.type)||o.get("type")||a;We(r==="private"?g._({id:"2BApYc"}):g._({id:"/bZzdR"}),"/mentions");const c=q(),l=q();async function m(k){(k||!c.current)&&(c.current=i.v1.notifications.list({limit:Yi,types:["mention"]}));const y=await c.current.next();let{value:S}=y;return S!=null&&S.length&&(S=Ns(S),k&&(l.current=S[0].id),S.forEach(({status:_})=>{Ke(_,s)})),{...y,value:S==null?void 0:S.map(_=>_.status)}}const h=q(),f=q();async function d(k){(k||!h.current)&&(h.current=i.v1.conversations.list({limit:Yi}));const y=await h.current.next();let{value:S}=y;return S=S==null?void 0:S.filter(_=>_.lastStatus),S!=null&&S.length&&(k&&(f.current=S[0].lastStatus.id),S.forEach(({lastStatus:_})=>{Ke(_,s)})),{...y,value:S==null?void 0:S.map(_=>_.lastStatus)}}function v(...k){return r==="private"?d(...k):m(...k)}async function b(){var k;if(r==="private")try{const y=await i.v1.conversations.list({limit:1,since_id:f.current}).next();let{value:S}=y;const _=((k=S[0])==null?void 0:k.id)===f.current;return S!=null&&S.length&&!_?(f.current=S[0].lastStatus.id,!0):!1}catch{return!1}else try{const y=await i.v1.notifications.list({limit:1,types:["mention"],since_id:l.current}).next();let{value:S}=y;return S!=null&&S.length?(l.current=S[0].id,!0):!1}catch{return!1}}const w=ke(()=>e("div",{class:"filter-bar centered",children:[e(fe,{to:"/mentions",class:r?"":"is-active",onClick:k=>{t&&(k.preventDefault(),p(null))},children:e(u,{id:"N40H+G"})}),e(fe,{to:"/mentions?type=private",class:r==="private"?"is-active":"",onClick:k=>{t&&(k.preventDefault(),p("private"))},children:e(u,{id:"zwBp5t"})})]}),[r]);return e(_t,{title:g._({id:"/bZzdR"}),id:"mentions",emptyText:g._({id:"03jFGT"}),errorText:g._({id:"pqR9KF"}),instance:s,fetchItems:v,checkForUpdates:b,useItemID:!0,timelineStart:w,refresh:r})}const lr=80,dr=20,ur=new URLSearchParams,an={block:"center",inline:"center",behavior:"smooth"},zs=ns(()=>Xe("@mastodon/grouped-notifications"),{maxAge:1e3*60*5});function Us(t={}){const{masto:n}=oe();return A.settings.groupedNotificationsAlpha&&zs()?n.v2.notifications.list({limit:dr,...t}):n.v1.notifications.list({limit:lr,...t})}function Fs(t){return A.settings.groupedNotificationsAlpha&&zs()?cr(t):ar(t)}const hr=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],fr={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function pr({columnMode:t}){var D;const{_:n}=Je();We(g._({id:"iDNBZe"}),"/notifications");const{masto:i,instance:s}=oe(),o=He(A),[a,p]=L("default"),[r]=t?[ur]:ht(),c=r.get("id"),l=r.get("access_token"),[m,h]=L(!1),[f,d]=L(!1),v=q(),{nearReachEnd:b,scrollDirection:w,reachStart:k,nearReachStart:y}=ma({scrollableRef:v}),S=w==="end"&&!y,[_,T]=L([]),[I,x]=L([]),O=q();async function P(E){var ve;if((E||!O.current)&&(O.current=Us({excludeTypes:["follow_request"]})),/max_id=($|&)/i.test((ve=O.current)==null?void 0:ve.nextParams))return{done:!0};const F=await O.current.next(),ce=Ps(F.value);if(ce!=null&&ce.length){ce.forEach(W=>{Ke(W.status,s,{skipThreading:!0})});const _e=Fs(ce);E?(A.notificationsLast=_e[0],A.notifications=_e,i.v1.markers.create({notifications:{lastReadId:_e[0].id}}).catch(()=>{})):A.notifications.push(..._e)}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),F}async function $(){try{return await i.v1.followRequests.list({limit:80})}catch{return[]}}const j=()=>{p("loading"),(async()=>{try{const E=await $();T(E),p("default")}catch{p("error")}})()};async function Z(){try{return await i.v1.announcements.list()}catch{return[]}}const J=Xe("@mastodon/filtered-notifications"),[N,M]=L(!1),[z,V]=L({});function U(){return i.v2.notifications.policy.fetch().catch(()=>{})}function ie(){U().then(E=>{V(E)}).catch(()=>{})}const[Q,de]=L(null);function Ce(){return i.v1.notifications.requests.list()}const te=E=>{K(!1),p("loading"),(async()=>{try{const F=P(E);E&&(Z().then(ve=>{ve.sort((_e,W)=>{const Le=new Date(_e.updatedAt||_e.createdAt);return new Date(W.updatedAt||W.createdAt)-Le}),x(ve)}).catch(()=>{}),$().then(ve=>{T(ve)}).catch(()=>{}),J&&ie());const{done:ce}=await F;h(!ce),p("default")}catch{p("error")}})()};ee(()=>{te(!0)},[]),ee(()=>{k&&te(!0)},[k]);const[be,K]=L(!1),ae=ot(({disableIdleCheck:E=!1}={})=>{var F;a!=="loading"&&o.settings.autoRefresh&&((F=v.current)==null?void 0:F.scrollTop)<16&&(E||window.__IDLE__)&&!mr()&&te(!0)},[o.notificationsShowNew,o.settings.autoRefresh,a]),ue=q();Bt(E=>{if(E){const F=Date.now()-ue.current;!ue.current||F>1e3*3?ae({disableIdleCheck:!0}):ue.current=Date.now()}});const Ie=q(!0);ee(()=>{let E=ao(A,"notificationsShowNew",F=>{if(Ie.current){Ie.current=!1;return}a!=="loading"&&(F&&ae(),K(F))});return()=>E==null?void 0:E()},[]);const Me=new Date,Te=new Date(Me-24*60*60*1e3);let Re=new Date;const De=!o.notifications.some(E=>new Date(E.createdAt).toDateString()===Me.toDateString()),we=q();ee(()=>{c&&(A.routeNotification={id:c,accessToken:atob(l)})},[c,l]);const X=".notification",me=Be("j",()=>{const E=document.activeElement.closest(X),F=E==null?void 0:E.getBoundingClientRect(),ce=Array.from(v.current.querySelectorAll(X));if(E&&F.top<v.current.clientHeight&&F.bottom>0){const ve=ce.indexOf(E);let _e=ce[ve+1];_e&&(_e.focus(),_e.scrollIntoView(an))}else{const ve=ce.find(_e=>{const W=_e.getBoundingClientRect();return W.top>=44&&W.left>=0});ve&&(ve.focus(),ve.scrollIntoView(an))}}),xe=Be("k",()=>{const E=document.activeElement.closest(X),F=E==null?void 0:E.getBoundingClientRect(),ce=Array.from(v.current.querySelectorAll(X));if(E&&F.top<v.current.clientHeight&&F.bottom>0){const ve=ce.indexOf(E);let _e=ce[ve-1];_e&&(_e.focus(),_e.scrollIntoView(an))}else{const ve=ce.find(_e=>{const W=_e.getBoundingClientRect();return W.top>=44&&W.left>=0});ve&&(ve.focus(),ve.scrollIntoView(an))}}),le=Be(["enter","o"],()=>{const E=document.activeElement.closest(X),F=E==null?void 0:E.querySelector(".status-link");F&&F.click()}),G=new Date,pe=ke(()=>ut(G,{forceOpts:{weekday:"long"}}),[G]);return e("div",{id:"notifications-page",class:"deck-container",ref:E=>{v.current=E,me(E),xe(E),le(E)},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${f?"only-mentions":""}`,children:[e("header",{hidden:S,onClick:E=>{var F;E.target.closest("a, button")||(F=v.current)==null||F.scrollTo({top:0,behavior:"smooth"})},onDblClick:E=>{E.target.closest("a, button")||te(!0)},class:a==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Nt,{}),e(fe,{to:"/",class:"button plain",children:e(C,{icon:"home",size:"l",alt:g._({id:"i0qMbr"})})})]}),e("h1",{children:e(u,{id:"iDNBZe"})}),e("div",{class:"header-side",children:J&&e("button",{type:"button",class:"button plain4",onClick:()=>{M(!0)},children:e(C,{icon:"settings",size:"l",alt:g._({id:"a/+arl"})})})})]}),be&&a!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{var E;te(!0),(E=v.current)==null||E.scrollTo({top:0,behavior:"smooth"})},children:[e(C,{icon:"arrow-up"})," ",e(u,{id:"Jy9RU/"})]})]}),I.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(C,{icon:"announce",class:"announcement-icon",size:"l"})," ",e(u,{id:"0whvLM",values:{0:I.length}})," ",e("small",{class:"insignificant",children:s})]}),I.length>1&&e("span",{class:"announcements-nav-buttons",children:I.map((E,F)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{var ce;(ce=we.current)==null||ce.children[F].scrollIntoView({behavior:"smooth",block:"nearest"})},children:F+1}))})]}),e("ul",{class:`announcements-list-${I.length>1?"multiple":"single"}`,ref:we,children:I.map(E=>e("li",{children:e(gr,{announcement:E})}))})]})})}),_.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(u,{id:"6Fs1Ba"})}),_.length>5?e("details",{children:[e("summary",{children:e(u,{id:"7dHKu4",values:{0:_.length}})}),e("ul",{children:_.map(E=>e("li",{children:[e(at,{account:E}),e(Vn,{accountID:E.id,onChange:()=>{}})]},E.id))})]}):e("ul",{children:_.map(E=>e("li",{children:[e(at,{account:E}),e(Vn,{accountID:E.id,onChange:()=>{}})]},E.id))})]}),J&&((D=z==null?void 0:z.summary)==null?void 0:D.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:F}=E.target;if(F){const ce=await Ce();de(ce)}},children:[e("summary",{children:e(u,{id:"N3Bq0f",values:{0:z.summary.pendingRequestsCount}})}),Q?(Q==null?void 0:Q.length)>0&&e("ul",{children:Q.map(E=>{var F,ce;return e("li",{children:[e("div",{class:"request-notifcations",children:[!((F=E.lastStatus)!=null&&F.id)&&e(at,{useAvatarStatic:!0,showStats:!0,account:E.account}),((ce=E.lastStatus)==null?void 0:ce.id)&&e("div",{class:"last-post",children:e(fe,{class:"status-link",to:`/${s}/s/${E.lastStatus.id}`,children:e(qe,{status:E.lastStatus,size:"s",readOnly:!0})})}),e(vr,{request:E})]}),e(yr,{request:E,onChange:()=>{te(!0)}})]},E.id)})}):e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})})]})})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:f,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:pe})]}),De&&e("p",{class:"ui-state insignificant",children:a==="default"?g._({id:"KS7iJH"}):e(B,{children:"…"})}),o.notifications.length?e(B,{children:o.notifications.filter(E=>E.type!=="follow_request").map(E=>{if(f&&E.type!=="mention")return null;const F=new Date(E.createdAt),ce=F.toDateString()!==Re.toDateString();ce&&(Re=F);const ve=F.toDateString()===Te.toDateString()?g._({id:"y/0uwd"}):ut(Re,{hideTime:!0}),_e=ut(Re,{forceOpts:{weekday:"long"}});return e(B,{children:[ce&&e("h2",{class:"timeline-header",children:[e("span",{children:ve})," ",e("small",{class:"insignificant bidi-isolate",children:_e})]}),e(Tn,{instance:s,notification:E},E._ids||E.id)]},E._ids||E.id)})}):e(B,{children:[a==="loading"&&e(B,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((E,F)=>e("li",{class:"notification skeleton",children:[e("div",{class:"notification-type",children:e(C,{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:()=>te(!0),children:e(u,{id:"KDw4GX"})})]})]}),m&&e(wt,{onChange:E=>{E&&te()},children:e("button",{type:"button",class:"plain block",disabled:a==="loading",onClick:()=>te(),style:{marginBlockEnd:"6em"},children:a==="loading"?e(Ne,{abrupt:!0}):e(u,{id:"uXRAkV"})})})]}),J&&N&&e(Fe,{onClick:E=>{E.target===E.currentTarget&&M(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>M(!1),children:e(C,{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:F,forNotFollowers:ce,forNewAccounts:ve,forPrivateMentions:_e,forLimitedAccounts:W}=E.target,Le={...z,forNotFollowing:F.value,forNotFollowers:ce.value,forNewAccounts:ve.value,forPrivateMentions:_e.value,forLimitedAccounts:W.value};V(Le),M(!1),(async()=>{try{await i.v2.notifications.policy.update(Le),he(g._({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(u,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:hr.map(E=>{const F=z[E];return e("div",{children:e("label",{children:[n(fr[E]),e("select",{name:E,defaultValue:F,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 mr(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function gr({announcement:t}){const{instance:n}=oe(),{contact:i}=Qi(),s=i==null?void 0:i.account,{id:o,content:a,startsAt:p,endsAt:r,published:c,allDay:l,publishedAt:m,updatedAt:h,read:f,mentions:d,statuses:v,tags:b,emojis:w,reactions:k}=t,y=new Date(m),S=ut(y),_=new Date(h),T=ut(_);return e("div",{class:"announcement-block",children:[e(at,{account:s}),e("div",{class:"announcement-content",onClick:os({mentions:d,instance:n}),dangerouslySetInnerHTML:{__html:Bn(a,{emojis:w})}}),e("p",{class:"insignificant",children:[e("time",{datetime:y.toISOString(),children:ut(y)}),h&&T!==S&&e(B,{children:[" ","•"," ",e("span",{class:"ib",children:e(u,{id:"TbFrLc",values:{0:ut(_)},components:{0:e("time",{datetime:_.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:k.map(I=>{const{name:x,count:O,me:P,staticUrl:$,url:j}=I;return e("button",{type:"button",class:`plain4 small ${P?"reacted":""}`,children:[j||$?e("img",{src:j||$,alt:x,width:"16",height:"16"}):e("span",{children:x})," ",e("span",{class:"count",children:Ge(O)})]})})})]})}function br(t){const{masto:n}=oe();return n.v1.notifications.list({accountID:t})}function vr({request:t}){var h;const{instance:n}=oe(),[i,s]=L("loading"),{account:o,lastStatus:a}=t,[p,r]=L(!1),[c,l]=L([]);function m(){r(!1)}return ee(()=>{var f;(f=t==null?void 0:t.account)!=null&&f.id&&p&&(s("loading"),(async()=>{const d=await br(t.account.id);l(d||[]),s("default")})())},[p,(h=t==null?void 0:t.account)==null?void 0:h.id]),e(B,{children:[e("button",{type:"button",class:"plain4 request-notifications-account",onClick:()=>{r(!0)},children:[e(C,{icon:"notification",class:"more-insignificant"})," ",e("small",{children:e(u,{id:"H0wUNM",values:{0:o.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(C,{icon:"chevron-down"})]}),p&&e(Fe,{onClick:f=>{f.target===f.currentTarget&&m()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:m,children:e(C,{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(Ne,{abrupt:!0})}):c.map(f=>e("div",{class:"notification-peek",onClick:d=>{const{target:v}=d;(d.target.tagName==="BUTTON"||d.target.tagName==="A")&&m()},children:e(Tn,{instance:n,notification:f,isStatic:!0})}))})]})})]})}function yr({request:t,onChange:n}){const{masto:i}=oe(),[s,o]=L("default"),[a,p]=L(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(),p("accept"),o("default"),n({request:t,state:"accept"}),he(g._({id:"ZtBMwU",values:{0:t.account.username}}))}catch{o("error"),he(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(),p("dismiss"),o("default"),n({request:t,state:"dismiss"}),he(g._({id:"ibBDry",values:{0:t.account.username}}))}catch{o("error"),he(g._({id:"S5aemF"}))}})()},children:e(u,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:s==="loading"?e(Ne,{abrupt:!0}):a==="accept"?e(C,{icon:"check-circle",alt:g._({id:"bzMKg7"}),class:"notification-accepted"}):a==="dismiss"&&e(C,{icon:"x-circle",alt:g._({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const Bs=it(pr),wr=20;function Gn({local:t,columnMode:n,...i}){const s=He(A),o=!!t,a=n?{}:Mt(),{masto:p,instance:r}=oe({instance:(i==null?void 0:i.instance)||a.instance}),{masto:c,instance:l}=oe(),m=o?g._({id:"u96B/B",values:{instance:r}}):g._({id:"PgVqvd",values:{instance:r}});We(m,o?"/:instance?/p/l":"/:instance?/p");const h=q(),f=q();async function d(b){if(b||!f.current){const y={limit:wr,local:o||void 0};!o&&Xe("@pixelfed/global-feed")&&(y.remote=!0),f.current=p.v1.timelines.public.list(y)}const w=await f.current.next();let{value:k}=w;return k!=null&&k.length&&(b&&(h.current=k[0].id),k.forEach(y=>{Ke(y,r)})),{...w,value:k}}async function v(){var b;try{const w=await p.v1.timelines.public.list({limit:1,local:o,since_id:h.current}).next();let{value:k}=w;const y=((b=k[0])==null?void 0:b.id)===h.current;return k!=null&&k.length&&!y?(k=Rt(k,"public"),!0):!1}catch{return!1}}return e(_t,{title:m,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(B,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:"public",headerEnd:e(ct,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(ye,{href:o?`/#/${r}/p`:`/#/${r}/p/l`,children:o?e(B,{children:[e(C,{icon:"transfer"})," ",e("span",{children:e(u,{id:"dXMiUw"})})]}):e(B,{children:[e(C,{icon:"transfer"})," ",e("span",{children:e(u,{id:"t2B/we"})})]})}),e(Ve,{}),e(ye,{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(C,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),l!==r&&e(ye,{onClick:()=>{location.hash=o?`/${l}/p/l`:`/${l}/p`},children:[e(C,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:l},components:{0:e("b",{})}})})]})]})},r+o)}const rn=5,Un=40,kr=new URLSearchParams;function Hs({columnMode:t,...n}){const i=t?{}:Mt(),{masto:s,instance:o,authenticated:a}=oe({instance:i.instance}),[p,r]=L("default"),[c]=t?[kr]:ht(),l=q(),m=(n==null?void 0:n.query)||c.get("q"),h=t?"statuses":(n==null?void 0:n.type)||c.get("type");let f=g._({id:"A1taO8"});if(m)switch(h){case"statuses":f=g._({id:"6YeoAt",values:{q:m}});break;case"accounts":f=g._({id:"fpgumQ",values:{q:m}});break;case"hashtags":f=g._({id:"AuiMZZ",values:{q:m}});break;default:f=g._({id:"wr3GZI",values:{q:m}})}We(f,"/search");const[d,v]=L(!1),b=q(0);ee(()=>{b.current=0},[m,h]);const w=q();yt(()=>{var N,M;(M=(N=w.current)==null?void 0:N.scrollTo)==null||M.call(N,0,0)},[m,h]);const[k,y]=L([]),[S,_]=L([]),[T,I]=L([]);ee(()=>{y([]),_([]),I([])},[m]);const x={statuses:y,accounts:_,hashtags:I},[O,P]=L({}),$=async N=>{if(!(N!=null&&N.length))return;const M=await ei(N,O);M&&P({...O,...M})};function j(N){N&&(b.current=0),!(!N&&!a)&&(r("loading"),N&&!h&&(y(k.slice(0,rn)),_(S.slice(0,rn)),I(T.slice(0,rn))),(async()=>{var z,V;const M={q:m,resolve:a,limit:rn};h&&(M.limit=Un,M.type=h,a&&(M.offset=b.current));try{const U=await s.v2.search.fetch(M);if(h)if(N){x[h](U[h]);const ie=(z=U[h])==null?void 0:z.length;b.current=Un,v(!!ie)}else{x[h](Q=>[...Q,...U[h]]);const ie=(V=U[h])==null?void 0:V.length;b.current=b.current+Un,v(!!ie)}else y(U.statuses||[]),_(U.accounts||[]),I(U.hashtags||[]),b.current=0,v(!1);$(U.accounts),r("default")}catch{r("error")}})())}const Z=q();Bt(N=>{var z;const M=((z=w.current)==null?void 0:z.scrollTop)===0;if(N&&M){const V=Date.now()-Z.current;!Z.current||V>1e3*3?j(!0):Z.current=Date.now()}}),ee(()=>{var N,M,z,V;(M=(N=l.current)==null?void 0:N.setValue)==null||M.call(N,m||""),m?j(!0):(V=(z=l.current)==null?void 0:z.focus)==null||V.call(z)},[m,h,o]),Be(["/","Slash"],N=>{var M,z,V,U;(z=(M=l.current)==null?void 0:M.focus)==null||z.call(M),(U=(V=l.current)==null?void 0:V.select)==null||U.call(V)},{preventDefault:!0});const[J]=ai();return e("div",{id:"search-page",class:"deck-container",ref:w,children:e("div",{class:"timeline-deck deck",children:[e("header",{class:p==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(Nt,{})}),e(As,{ref:l}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{j(!0)},disabled:p==="loading",children:e(C,{icon:"search",size:"l",alt:g._({id:"A1taO8"})})})})]})}),e("main",{children:[!!m&&!t&&e("div",{ref:J,class:`filter-bar ${p==="loading"?"loading":""}`,children:[!!h&&e(fe,{to:`/search${m?`?q=${encodeURIComponent(m)}`:""}`,children:[e(C,{icon:"chevron-left"})," ",e(u,{id:"N40H+G"})]}),[{label:g._({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(m)}&type=accounts`},{label:g._({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`},{label:g._({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(m)}&type=statuses`}].sort((N,M)=>N.type===h?-1:M.type===h?1:0).map(N=>e(fe,{to:N.to,children:N.label},N.type))]}),m?e(B,{children:[(!h||h==="accounts")&&e(B,{children:[h!=="accounts"&&e("h2",{class:"timeline-header",children:[e(u,{id:"bPwFdf"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:e(C,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),S.length>0?e(B,{children:[e("ul",{class:"timeline flat accounts-list",children:S.map(N=>e("li",{children:e(at,{account:N,instance:o,showStats:!0,relationship:O[N.id]})},N.id))}),h!=="accounts"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=accounts`,children:[e(u,{id:"BMmtZ8"})," ",e(C,{icon:"arrow-right"})]})})]}):!h&&(p==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"YYB61U"})}))]}),(!h||h==="hashtags")&&e(B,{children:[h!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(u,{id:"VwUsHI"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:e(C,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),T.length>0?e(B,{children:[e("ul",{class:"link-list hashtag-list",children:T.map(N=>{var U;const{name:M,history:z}=N,V=(U=z==null?void 0:z.reduce)==null?void 0:U.call(z,(ie,Q)=>ie+ +Q.uses,0);return e("li",{children:e(fe,{to:o?`/${o}/t/${M}`:`/t/${M}`,children:[e(C,{icon:"hashtag",alt:"#"}),e("span",{children:M}),!!V&&e("span",{class:"count",children:Ge(V)})]})},`${M}-${V}`)})}),h!=="hashtags"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=hashtags`,children:[e(u,{id:"Nc/W5J"})," ",e(C,{icon:"arrow-right"})]})})]}):!h&&(p==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"4MFM3P"})}))]}),(!h||h==="statuses")&&e(B,{children:[h!=="statuses"&&e("h2",{class:"timeline-header",children:[e(u,{id:"+owNNn"})," ",e(fe,{to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:e(C,{icon:"arrow-right",size:"l",alt:g._({id:"V1fa9u"})})})]}),k.length>0?e(B,{children:[e("ul",{class:"timeline",children:k.map(N=>e("li",{children:e(fe,{class:"status-link",to:o?`/${o}/s/${N.id}`:`/s/${N.id}`,children:e(qe,{status:N})})},N.id))}),h!=="statuses"&&e("div",{class:"ui-state",children:e(fe,{class:"plain button",to:`/search?q=${encodeURIComponent(m)}&type=statuses`,children:[e(u,{id:"LYCgej"})," ",e(C,{icon:"arrow-right"})]})})]}):!h&&(p==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"Hzi9AA"})}))]}),!!h&&(p==="default"?d?e(wt,{onChange:N=>{N&&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"})}):p==="loading"&&e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}))]}):p==="loading"?e("p",{class:"ui-state",children:e(Ne,{abrupt:!0})}):e("p",{class:"ui-state",children:e(u,{id:"fGn1Hk"})})]})]})})}const _r=20,qs=10*60*1e3,Sr=kt(t=>t.v1.trends.links.list().next(),{maxAge:qs}),Cr=kt(t=>t.v1.trends.tags.list().next(),{maxAge:qs});function Ir(t){return Xe("@pixelfed/trending")?t.pixelfed.v2.discover.posts.trending.list({range:"daily"}):t.v1.trends.statuses.list({limit:_r})}function Tr(t,n){return t.v1.timelines.link.list(n)}function js({columnMode:t,...n}){const i=He(A),s=t?{}:Mt(),{masto:o,instance:a}=oe({instance:(n==null?void 0:n.instance)||s.instance}),{masto:p,instance:r}=oe(),c=g._({id:"cI3UEs",values:{instance:a}});We(c,"/:instance?/trending");const l=q(),m=a===r,[h,f]=L([]),[d,v]=L([]),b=q();async function w(J){var z;if(J||!b.current){if(b.current=Ir(o),Xe("@mastodon/trending-hashtags"))try{const{value:V}=await Cr(o);V!=null&&V.length&&f(V)}catch{}if(Xe("@mastodon/trending-links"))try{const{value:V}=await Sr(o,a),U=(z=V==null?void 0:V.filter)==null?void 0:z.call(V,ie=>ie.type==="link");U!=null&&U.length&&v(U)}catch{}}const N=await b.current.next();let{value:M}=N;return M!=null&&M.length&&(J&&(l.current=M[0].id),M.forEach(V=>{Ke(V,a)})),{...N,value:M}}const[k,y]=L(!1),S=q(),[_,T]=L(null),I=!!_,x=q(),O=m&&Xe("@mastodon/trending-link-posts");ee(()=>{_&&x.current&&x.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[_]);const P=q();async function $(J){(J||!S.current)&&(y(!0),S.current=Tr(o,{url:_})),P.current=_;const N=await S.current.next();let{value:M}=N;return M!=null&&M.length&&(M=Rt(M,"public"),M.forEach(z=>{Ke(z,a)})),P.current===_&&y(!1),{...N,value:M}}async function j(){try{const J=await o.v1.trends.statuses.list({limit:1}).next();let{value:N}=J;return N=Rt(N,"public"),N!=null&&N.length&&N[0].id!==l.current?(l.current=N[0].id,!0):!1}catch{return!1}}const Z=ke(()=>e(B,{children:[!!h.length&&e("div",{class:"filter-bar expandable",children:[e(C,{icon:"chart",class:"insignificant",size:"l"}),h.map((J,N)=>{const{name:M,history:z}=J,V=z.reduce((U,ie)=>U+ +ie.uses,0);return e(fe,{to:`/${a}/t/${M}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),M]}),e("span",{class:"filter-count",children:Ge(V)})]},M)})]}),!!d.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(u,{id:"9veeTb"})})}),d.map(J=>{var X,me;const{authors:N,authorName:M,authorUrl:z,blurhash:V,description:U,height:ie,image:Q,imageDescription:de,language:Ce,providerName:te,providerUrl:be,publishedAt:K,title:ae,url:ue,width:Ie}=J,Me=(me=(X=N==null?void 0:N[0])==null?void 0:X.account)!=null&&me.id?N[0].account:null,Te=ae.length<30,Re=!!(M||Me),De=Gt.toUnicode(URL.parse(ue).hostname.replace(/^www\./,"").replace(/\/$/,""));let we;if(V){const xe=ti(V),le=hi(xe);we=fi([.6,le[1],le[2]])}return e("div",{children:[e("a",{ref:_===ue?x:null,href:ue,target:"_blank",rel:"noopener noreferrer",class:`link-block ${I?_===ue?"active":"inactive":""}`,style:we?{"--accent-color":`rgb(${we.join(",")})`,"--accent-alpha-color":`rgba(${we.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:Q,alt:de,width:Ie,height:ie,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:De})," ",!!K&&e(B,{children:"· "}),!!K&&e(B,{children:e(Vt,{datetime:K,format:"micro"})})]}),!!ae&&e("h1",{class:"title",lang:Ce,dir:"auto",title:ae,children:ae})]}),!!U&&e("p",{class:`description ${Re&&!Te?"":"more-lines"}`,lang:Ce,dir:"auto",title:U,children:U}),Re&&e(B,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(u,{id:"aavdrC",values:{0:Me?e(pt,{account:Me,showAvatar:!0}):z?e("a",{href:z,target:"_blank",rel:"noopener noreferrer",children:M}):M}})})})]})]})]})}),O&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{T(ue)},disabled:ue===_,children:[e(C,{icon:"comment2"})," ",e("span",{children:e(u,{id:"/bZzdR"})})," ",e(C,{icon:"chevron-down"})]})]},ue)})]}),O&&!!d.length&&e("div",{class:`timeline-header-block ${I?"blended":""}`,children:I?e(B,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:k?e(Ne,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{T(null)},children:e(C,{icon:"x",alt:g._({id:"9Q/4xJ"})})})}),e("p",{children:e(u,{id:"BATCqf",values:{0:_.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(u,{id:"Vosm4k"})})})]}),[h,d,_,k]);return e(_t,{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:I?$:w,checkForUpdates:I?void 0:j,checkForUpdatesInterval:5*60*1e3,useItemID:!0,headerStart:e(B,{}),boostsCarousel:i.settings.boostsCarousel,filterContext:"public",timelineStart:Z,refresh:_,clearWhenRefresh:!0,view:I?"link-mentions":void 0,headerEnd:e(ct,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(C,{icon:"more",size:"l",alt:g._({id:"2FYpfJ"})})}),children:[e(ye,{onClick:()=>{let J=prompt(g._({id:"2MQ2cd"}));if(!/\./.test(J)){J&&alert(g._({id:"7WddtO"}));return}J&&(J=J.toLowerCase().trim(),location.hash=`/${J}/trending`)},children:[e(C,{icon:"bus"})," ",e("span",{children:e(u,{id:"Sq04Yc"})})]}),r!==a&&e(ye,{onClick:()=>{location.hash=`/${r}/trending`},children:[e(C,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(u,{id:"iAzCp4",values:{currentInstance:r},components:{0:e("b",{})}})})]})]})},a)}function xr(){We(g._({id:"i0qMbr"}),"/");const t=He(A),{shortcuts:n}=t,i=n.map(s=>{if(!s)return null;const{type:o,...a}=s,p={following:gi,notifications:Bs,list:Ds,public:Gn,bookmarks:Rs,favourites:Ls,hashtag:Ms,mentions:Os,trending:js,search:Hs}[o];return!p||o==="search"&&!a.query||o==="list"&&!a.id?null:e(p,{...a,columnMode:!0},o+JSON.stringify(a))});return Be(["1","2","3","4","5","6","7","8","9"],(s,o)=>{try{const a=parseInt(o.keys[0],10)-1;document.querySelectorAll("#columns > *")[a].focus()}catch{}}),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 Ar(){var i;const{_:t}=Je(),n=He(A);return __BENCHMARK.end("time-to-home"),ee(()=>{(async()=>{const s=await dt.drafts.keys();if(s.length){const o=bn();s.filter(p=>p.startsWith(o)).length&&(A.showDrafts=!0)}})()},[]),e(B,{children:(n.settings.shortcutsViewMode==="multi-column"||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&((i=n.shortcuts)!=null&&i.length)?e(xr,{}):e(gi,{title:t({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(Er,{})})})}function Er(){const t=He(A),n=q(),[i,s]=L(void 0);return e(B,{children:[e(fe,{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(C,{icon:"notification",size:"l",alt:g._({id:"iDNBZe"})})}),e(Lr,{state:i,anchorRef:n,onClose:()=>s(void 0)})]})}const Rr=5;function Lr({anchorRef:t,state:n,onClose:i}){const{masto:s,instance:o}=oe(),a=He(A),[p,r]=L("default"),c=Us();async function l(){const b=await c.next(),w=Ps(b.value);if(w!=null&&w.length){w.forEach(y=>{Ke(y.status,o,{skipThreading:!0})});const k=Fs(w);A.notificationsLast=k[0],A.notifications=k,s.v1.markers.create({notifications:{lastReadId:k[0].id}}).catch(()=>{})}return A.notificationsShowNew=!1,A.notificationsLastFetchTime=Date.now(),b}const[m,h]=L(!1);function f(){return s.v1.followRequests.list({limit:1})}function d(){r("loading"),(async()=>{try{await l();const b=await f();h(!!(b!=null&&b.length)),r("default")}catch{r("error")}})()}ee(()=>{n==="open"&&d()},[n]);const v=q();return e(ds,{ref:v,menuClassName:"notifications-menu",state:n,anchorRef:t,onClose:i,portal:{target:document.body},containerProps:{onClick:()=>{var b,w;(w=(b=v.current)==null?void 0:b.closeMenu)==null||w.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(B,{children:a.notifications.slice(0,Rr).map(b=>e(Tn,{instance:o,notification:b,disableContextMenu:!0},b._ids||b.id))}):p==="loading"?e("div",{class:"ui-state",children:e(Ne,{abrupt:!0})}):p==="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(fe,{to:"/mentions",class:"button plain",children:[e(C,{icon:"at"})," ",e("span",{children:e(u,{id:"/bZzdR"})})]}),e(fe,{to:"/notifications",class:"button plain2",children:[m?e(u,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(u,{id:"gukqfD"})})," ",e(C,{icon:"arrow-right"})]})]})]})}const $r=it(Ar),Mr=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function Ys(t){const{hostname:n,pathname:i}=URL.parse(t);for(const s of Mr){const[,o]=i.match(s)||[];if(o)return{instance:n,id:o}}return{}}function Dr(t){const{instance:n,id:i}=Ys(t);return n&&i?`/${n}/s/${i}`:null}function Nr(){const n=Yt().pathname.replace(/^\//,""),i=Ys(n),s=i!=null&&i.instance?`/${i.instance}/s/${i.id}`:null,[o,a]=L("loading");return yt(()=>{a("loading"),(async()=>{try{const{instance:p,id:r}=i;if(r){const{masto:c}=oe({instance:p});if(await c.v1.statuses.$select(r).fetch()){window.location.hash=s+"?view=full";return}}}catch{}{const{masto:p,instance:r}=oe(),c=await p.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(B,{children:[e(Ne,{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(B,{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(fe,{to:"/",children:e(u,{id:"iWpEwy"})})})]})}function Pr(){We(g._({id:"h16FyT"}),"/l");const[t,n]=L("default"),[i,s]=$t(c=>c+1,0),[o,a]=L([]);ee(()=>{n("loading"),(async()=>{try{const c=await Yn();a(c),n("default")}catch{n("error")}})()},[i]);const[p,r]=L(!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(fe,{to:"/",class:"button plain",children:e(C,{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(C,{icon:"plus",size:"l",alt:g._({id:"Sb2gYF"})})})})]})}),e("main",{children:o.length>0?e(B,{children:[e("ul",{class:"link-list",children:o.map(c=>e("li",{children:e(fe,{to:`/l/${c.id}`,children:e("span",{children:[e(C,{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(Ne,{})}):t==="error"?e("p",{class:"ui-state",children:e(u,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(u,{id:"IvPikw"})})})]}),p&&e(Fe,{onClick:c=>{c.target===c.currentTarget&&r(!1)},children:e(ui,{list:p==null?void 0:p.list,onClose:c=>{c.state==="success"&&s(),r(!1)}})})]})}const Or=""+new URL("instances-CwO9tuGQ.json",import.meta.url).href;function zr(t){return("0"+t.toString(16)).slice(-2)}function Ur(){var t=new Uint32Array(28);return window.crypto.getRandomValues(t),Array.from(t,zr).join("")}function Fr(t){const i=new TextEncoder().encode(t);return window.crypto.subtle.digest("SHA-256",i)}function Br(t){let n="";const i=new Uint8Array(t),s=i.byteLength;for(var o=0;o<s;o++)n+=String.fromCharCode(i[o]);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Vs(t){const n=await Fr(t);return Br(n)}async function Hr({instanceURL:t}){var n;if(!t)return!1;try{const i=await fetch(`https://${t}/.well-known/oauth-authorization-server`);return!i.ok||i.status!==200?!1:!!((n=(await i.json()).code_challenge_methods_supported)!=null&&n.includes("S256"))}catch{return!1}}window.__generateCodeChallenge=Vs;const qr={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"},{DEV:jr,PHANPY_CLIENT_NAME:Yr,PHANPY_WEBSITE:Sn}=qr,xn="read write follow push",Vr=Sn?Sn.toLowerCase().includes(location.hostname):!1,Gr=location.origin+location.pathname,An=jr||!Vr?Gr:Sn;async function Kr({instanceURL:t}){const n=new URLSearchParams({client_name:Yr,redirect_uris:An,scopes:xn,website:Sn});return await(await fetch(`https://${t}/api/v1/apps`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString()})).json()}async function Wr({instanceURL:t,client_id:n}){const i=Ur(),s=await Vs(i),o=new URLSearchParams({client_id:n,code_challenge_method:"S256",code_challenge:s,redirect_uri:An,response_type:"code",scope:xn});return[`https://${t}/oauth/authorize?${o.toString()}`,i]}async function Zr({instanceURL:t,client_id:n}){const i=new URLSearchParams({client_id:n,scope:xn,redirect_uri:An,response_type:"code"});return`https://${t}/oauth/authorize?${i.toString()}`}async function Xr({instanceURL:t,client_id:n,client_secret:i,code:s,code_verifier:o}){const a=new URLSearchParams({client_id:n,redirect_uri:An,grant_type:"authorization_code",code:s,scope:xn});return i&&a.append("client_secret",i),o&&a.append("code_verifier",o),await(await fetch(`https://${t}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString()})).json()}const Jr={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:Qr}=Jr;function el(){var y,S;We("Log in");const t=q(),n=ge.local.get("instanceURL"),[i,s]=L("default"),[o]=ht(),a=o.get("instance"),p=o.get("submit"),[r,c]=L(a||(n==null?void 0:n.toLowerCase())||""),[l,m]=L([]),h=q();ee(()=>{(async()=>{try{const T=await(await fetch(Or)).json();m(T),h.current=new Mo(T)}catch{}})()},[]);const f=_=>{_&&(async()=>{try{const I=await(await fetch(`https://${_}/.well-known/host-meta`)).text(),$=new DOMParser().parseFromString(I,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),j=URL.parse($),{host:Z}=j;_!==Z&&(_=Z)}catch{}ge.local.set("instanceURL",_),s("loading");try{const{client_id:T,client_secret:I,vapid_key:x}=await Kr({instanceURL:_});if(await Hr({instanceURL:_}))if(T&&I){ge.sessionCookie.set("clientID",T),ge.sessionCookie.set("clientSecret",I),ge.sessionCookie.set("vapidKey",x);const[P,$]=await Wr({instanceURL:_,client_id:T});ge.sessionCookie.set("codeVerifier",$),location.href=P}else alert(g._({id:"ZP1FIA"}));else T&&I?(ge.sessionCookie.set("clientID",T),ge.sessionCookie.set("clientSecret",I),ge.sessionCookie.set("vapidKey",x),location.href=await Zr({instanceURL:_,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?(S=(y=h.current)==null?void 0:y.search(d,{limit:10}))==null?void 0:S.map(_=>_.item):[],w=v?d:b!=null&&b.length?b[0]:r?l.find(_=>_.includes(r)):null,k=_=>{_.preventDefault(),f(w)};return p&&ee(()=>{f(a||w)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:k,children:[e("h1",{children:[e("img",{src:ri,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:_=>{c(_.target.value)},dir:"auto"}),(b==null?void 0:b.length)>0?e("ul",{id:"instances-suggestions",children:b.map((_,T)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{f(_)},children:_})}))}):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||!w,children:w?g._({id:"2xahsi",values:{selectedInstanceText:w}}):g._({id:"xGVfLh"})})," "]}),e(Ne,{hidden:i!=="loading"}),e("hr",{}),!Qr&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(u,{id:"LcOiWS"})})}),e("p",{children:e(fe,{to:"/",children:e(u,{id:"iWpEwy"})})}),e(li,{})]})})}const ln=40,tl=10,nl=5;let Kn={},fn={},pn={};function mn(t){delete fn[t],delete pn[t]}const Wt={block:"nearest",inline:"center",behavior:"smooth"},Vi=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",Gi=/\/s\//i;function il(t){var _;const{id:n}=t,{masto:i,instance:s}=oe({instance:t.instance}),o=He(A),[a,p]=ht(),r=a.get("media"),c=a.get("media-only"),l=parseInt(r||c,10);let m=l>0;const h=a.get("mediaStatusID"),f=is(h,s);h&&!f&&(m=!1);const d=m&&!!c,v=nt(n,s),[b,w]=L(A.statuses[v]);ee(()=>{A.statuses[v]&&w(A.statuses[v])},[v]);const k=ke(()=>{const{prevLocation:T}=A,I=((T==null?void 0:T.pathname)||"")+((T==null?void 0:T.search)||""),x=Qt("/:instance/s/:id",I)||Qt("/s/:id",I);return!I||x?"/":I},[]);ee(()=>{!b&&m&&(async()=>{try{const T=await i.v1.statuses.$select(n).fetch();Ke(T,s),w(T)}catch{alert("Unable to load post."),location.hash=k}})()},[m]);const y=h?(_=o.statuses[nt(h,s)])==null?void 0:_.mediaAttachments:b==null?void 0:b.mediaAttachments,S=ot(()=>{!window.matchMedia("(min-width: calc(40em + 350px))").matches&&o.prevLocation?history.back():d?location.hash=k:(a.delete("media"),a.delete("mediaStatusID"),p(a))},[d,k,o.prevLocation]);return ee(()=>{let T=setTimeout(()=>{const I=document.querySelector(".carousel");I&&I.focus()},100);return()=>clearTimeout(T)},[d]),ee(()=>{const T=document.querySelectorAll(".deck-container");return T.forEach(I=>{I.setAttribute("inert","")}),()=>{T.forEach(I=>{I.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[m?y!=null&&y.length?e(Ts,{mediaAttachments:y,statusID:h||n,instance:s,lang:b==null?void 0:b.language,index:l-1,onClose:S}):e("div",{class:"media-modal-container loading",children:e(Ne,{abrupt:!0})}):e(fe,{to:k}),!d&&e(ol,{id:n,instance:t.instance,closeLink:k})]})}function sl(t){const{linkable:n,to:i,onClick:s,...o}=t;return n?e(fe,{class:"status-link",to:i,onClick:s,...o}):e("div",{class:"status-focus",tabIndex:0,...o})}function ol({id:t,closeLink:n="/",instance:i}){var G,pe;const[s,o]=ht(),a=s.get("media"),p=s.get("mediaStatusID"),r=parseInt(a,10)>0,c=q(!A.prevLocation&&(history.length===1||"navigation"in window&&((pe=(G=navigation==null?void 0:navigation.entries)==null?void 0:G.call(navigation))==null?void 0:pe.length)===1)),[l,m]=L(s.get("view")||c.current?"full":null),h=!!parseInt(s.get("translate")),{masto:f,instance:d}=oe({instance:i}),{masto:v,instance:b,authenticated:w}=oe(),k=d===b,y=He(A),[S,_]=L([]),[T,I]=L("default"),x=q(),O=nt(t,d),P=q(0),$=q();ee(()=>{var D;(D=$.current)==null||D.focus()},[]),ee(()=>{var E;const D=fs(()=>{if(!$.current)return;const{scrollTop:F}=$.current;T!=="loading"&&(pn[t]=F)},50);return(E=$.current)==null||E.addEventListener("scroll",D,{passive:!0}),D(),()=>{var F;D.cancel(),(F=$.current)==null||F.removeEventListener("scroll",D)}},[t,T!=="loading"]);const j=q(),Z=q(),J=({reloadHero:D}={})=>{I("loading");let E;const F=fn[t];if(F){const ce=F.filter(ve=>A.statuses[O]);_(ce)}else _([{id:t}]);return(async()=>{var Le,Pe;const ce=()=>Si(()=>f.v1.statuses.$select(t).fetch(),{retries:4}),ve=Si(()=>f.v1.statuses.$select(t).context.fetch(),{retries:8}),_e=!!y.statuses[O];let W=y.statuses[O];if(!(_e&&!D))try{W=await ce(),Ke(W,d),await new Promise(R=>{setTimeout(R,100)})}catch{I("error");return}try{let R=function(re){return re==null?void 0:re.map(ze=>({id:ze.id,account:ze.account,repliesCount:ze.repliesCount,content:ze.content,weight:Jt(ze),replies:R(ze.__replies)}))};const Y=await ve,{ancestors:se,descendants:H}=Y;P.current=(H==null?void 0:H.length)||0;const ne=new Set;se.forEach(re=>{Ke(re,d,{skipThreading:!0}),re.inReplyToId&&!se.find(ze=>ze.id===re.inReplyToId)&&ne.add(re.inReplyToId)});const $e=se.every(re=>re.account.id===W.account.id),Ae=[];H.forEach(re=>{if(Ke(re,d,{skipThreading:!0}),re.inReplyToId&&!H.find(ze=>ze.id===re.inReplyToId)&&re.inReplyToId!==W.id&&ne.add(re.inReplyToId),re.inReplyToAccountId===re.account.id)Ae.push(re);else if(re.inReplyToId===W.id)Ae.push(re);else if(!re.inReplyToAccountId&&Ae.find(ze=>ze.id===re.inReplyToId)&&re.account.id===W.account.id)Ae.push(re);else{const ze=H.find(Ze=>Ze.id===re.inReplyToId);ze&&(ze.__replies||(ze.__replies=[]),ze.__replies.push(re))}}),ne.size;const Se=[...se.map(re=>({id:re.id,ancestor:!0,isThread:$e,accountID:re.account.id,account:re.account,repliesCount:re.repliesCount,weight:Jt(re)})),{id:t,accountID:W.account.id,weight:Jt(W)},...Ae.map(re=>({id:re.id,account:re.account,accountID:re.account.id,descendant:!0,thread:re.account.id===W.account.id,weight:Jt(re),replies:R(re.__replies)}))];I("default"),j.current={offsetTop:(Le=x.current)==null?void 0:Le.offsetTop,scrollTop:(Pe=$.current)==null?void 0:Pe.scrollTop};const Oe=Se.findIndex(re=>re.id===t);Oe>=de&&Ce(Oe+1),_(Se),fn[t]=Se,ro(W,d)}catch{I("error")}})(),Z.current=Date.now(),()=>{clearTimeout(E)}};ee(J,[t,f]);const[N,M]=L(!1);ee(()=>{let D=setInterval(()=>{const E=Date.now();Z.current&&E-Z.current>=6e4&&M(!0)},6e4);return()=>{clearInterval(D)}},[]),yt(()=>{var E,F;if(!S.length)return;const D=pn[t];if(D)$.current.scrollTop=D;else if(j.current){const ce={offsetTop:(E=x.current)==null?void 0:E.offsetTop,scrollTop:(F=$.current)==null?void 0:F.scrollTop},ve=ce.offsetTop-j.current.offsetTop+ce.scrollTop;$.current.scrollTop=ve}else S.length===1&&($.current.scrollTop=0);j.current=null},[S]),ee(()=>{y.reloadStatusPage<=0||(async()=>{try{const{instanceURL:D}=Zn(),E=`https://${D}/api/v1/statuses/${t}/context`;return await(await caches.open("api")).delete(E,{ignoreVary:!0}),J({reloadHero:!0})}catch{}})()},[y.reloadStatusPage]),ee(()=>()=>{pn={},A.reloadStatusPage=0,fn={},Kn={},Wn.clear()},[]);const z=y.statuses[O]||y.statuses[t],V=ke(()=>{if(!z)return"";const{account:D}=z,E=document.createElement("div");return E.innerHTML=D.displayName,E.innerText.trim()},[z]),U=ke(()=>{if(!z)return"";let D=ni(z);return D.length>64&&(D=D.slice(0,64)+"…"),D},[z]);We(V&&U?`${V}: "${U}"`:g._({id:"y28hnO"}),"/:instance?/s/:id");const ie=ke(()=>{if(!z)return;const{url:D}=z;if(D)return URL.parse(D).hostname},[z]),Q=ke(()=>{if(ie)return ie===d},[ie,d]),[de,Ce]=L(ln),te=ke(()=>S.length-de,[S.length,de]),be=S.some(D=>D.descendant),K=S.filter(D=>D.ancestor),[ae,ue]=L(!0),Ie=ke(()=>{if(!x.current||ae)return null;const{top:D}=x.current.getBoundingClientRect();return D>0?"down":"up"},[ae]);Be("esc",()=>{location.hash=n},{enabled:!r,ignoreEventWhen:D=>!!document.querySelector("#modal-container > *")}),Be("backspace",()=>{location.hash=n}),Be("j",()=>{const D=document.activeElement.closest(".status-link, .status-focus"),E=D==null?void 0:D.getBoundingClientRect(),F=Array.from($.current.querySelectorAll(Vi));if(D&&E.top<$.current.clientHeight&&E.bottom>0){const ce=F.indexOf(D);let ve=F[ce+1];ve&&(ve.focus(),ve.scrollIntoView(Wt))}else{const ce=F.find(ve=>{const _e=ve.getBoundingClientRect();return _e.top>=44&&_e.left>=0});ce&&(ce.focus(),ce.scrollIntoView(Wt))}}),Be("k",()=>{const D=document.activeElement.closest(".status-link, .status-focus"),E=D==null?void 0:D.getBoundingClientRect(),F=Array.from($.current.querySelectorAll(Vi));if(D&&E.top<$.current.clientHeight&&E.bottom>0){const ce=F.indexOf(D);let ve=F[ce-1];ve&&(ve.focus(),ve.scrollIntoView(Wt))}else{const ce=F.find(ve=>{const _e=ve.getBoundingClientRect();return _e.top>=44&&_e.left>=0});ce&&(ce.focus(),ce.scrollIntoView(Wt))}}),Be("x",()=>{const D=document.activeElement.closest(".status-link, .status-focus");if(D){const E=D.nextElementSibling;E&&E.tagName.toLowerCase()==="details"&&(E.open=!E.open)}});const[Me,Te]=L(!1),Re=q(r?"media+status":"status"),De=ot((D,E,F,ce)=>{D.preventDefault(),D.stopPropagation(),o({media:E+1,mediaStatusID:ce.id})},[t]),we=ot((D,E)=>{mn(E.id)},[]);ee(()=>{let D;return p&&r&&(D=setTimeout(()=>{var F;const E=(F=$.current)==null?void 0:F.querySelector(`.status-link[href*="/${p}"]`);E&&E.scrollIntoView(Wt)},400)),()=>{clearTimeout(D)}},[p,r]);const X=ot((D,E)=>{const{id:F,ancestor:ce,isThread:ve,descendant:_e,thread:W,replies:Le,repliesCount:Pe,weight:R}=D,Y=F===t;return e("li",{ref:Y?x:null,class:`${ce?"ancestor":""} ${_e?"descendant":""} ${W?"thread":""} ${Y?"hero":""}`,children:[Y?e(B,{children:[e(wt,{threshold:.1,onChange:H=>{queueMicrotask(()=>{requestAnimationFrame(()=>{ue(H)})})},class:"status-focus",tabIndex:0,children:e(qe,{statusID:F,instance:d,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:h})}),T!=="loading"&&!w?e("div",{class:"post-status-banner",children:[e("p",{children:e(u,{id:"Vyeh4F"})}),e(fe,{to:"/login",class:"button",children:e(u,{id:"sQia9P"})})]}):!k&&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:()=>{I("loading"),(async()=>{try{const H=await v.v2.search.fetch({q:z.url,type:"statuses",resolve:!0,limit:1});if(H.statuses.length){const ne=H.statuses[0];location.hash=b?`/${b}/s/${ne.id}`:`/s/${ne.id}`}else throw new Error("No results")}catch(H){I("default"),alert(g._({id:"DnepCE",values:{e:H}}))}})()},children:[e(C,{icon:"transfer"})," ",e(u,{id:"ejAVrO"})]})]})]}):e(sl,{linkable:ve||ce,to:d?`/${d}/s/${F}`:`/s/${F}`,onClick:()=>{mn(F)},children:[E===0&&ce?e(wt,{threshold:.5,onChange:H=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Te(H)})})},children:e(qe,{statusID:F,instance:d,withinContext:!0,size:W||ce?"m":"s",enableTranslate:!0,onMediaClick:De,onStatusLinkClick:we})}):e(qe,{statusID:F,instance:d,withinContext:!0,size:W||ce?"m":"s",enableTranslate:!0,onMediaClick:De,onStatusLinkClick:we,showActionsBar:!!_e}),ce&&Pe>1&&e("div",{class:"replies-link",children:[e(C,{icon:"comment2",alt:g._({id:"N8UzTV"})})," ",e("span",{title:Pe,children:Ge(Pe)})]})," "]}),_e&&(Le==null?void 0:Le.length)>0&&e(Gs,{instance:d,replies:Le,hasParentThread:W,level:1,accWeight:R,openAll:P.current<tl,parentLink:{to:d?`/${d}/s/${F}`:`/s/${F}`,onClick:()=>mn(F)}}),T==="loading"&&Y&&!!(z!=null&&z.repliesCount)&&!be&&e("div",{class:"status-loading",children:e(Ne,{abrupt:z.repliesCount>=3})}),T==="error"&&Y&&!!(z!=null&&z.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"})})]})]},F)},[t,d,T,w,k,h,De,we,be]),me=ke(()=>{var D;if("navigation"in window&&(navigation!=null&&navigation.entries)){const E=navigation.entries()[navigation.currentEntry.index-1];if(E!=null&&E.url)return Gi.test(E.url)}return Gi.test((D=A.prevLocation)==null?void 0:D.pathname)},[O]),xe=ke(()=>{if(!te)return[];const D=[];function E(F){D.push(F.id),F.replies&&F.replies.forEach(E)}return S.slice(de).forEach(E),D.map(F=>nt(F,d))},[te,S,de,d]),le=ke(()=>S.slice(0,de).map(X),[S,de,X]);return ee(()=>{let D=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(D)},[t]),e("div",{tabIndex:"-1",ref:$,class:`status-deck deck contained ${S.length>1?"padded-bottom":""} ${Re.current==="status"&&!c.current?"slide-in":""} ${l?`deck-view-${l}`:""}`,onAnimationEnd:D=>{Re.current==="status"&&(Re.current=null)},children:[e("header",{class:`${T==="loading"?"loading":""}`,onDblClick:D=>{A.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[me&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(C,{icon:"chevron-left",size:"xl",alt:g._({id:"iH8pgl"})})}),!ae&&z&&T!=="loading"?e(B,{children:[e("span",{class:"hero-heading",children:[e(pt,{account:z.account,instance:d,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(Vt,{datetime:z.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:D=>{D.preventDefault(),D.stopPropagation(),x.current.scrollIntoView({behavior:"smooth",block:"start"})},title:g._({id:"NCy+Nw"}),children:e(C,{icon:Ie==="down"?"arrow-down":"arrow-up"})})]}):e(B,{children:["Post"," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:D=>{D.preventDefault(),D.stopPropagation(),$.current.scrollTo({top:0,behavior:"smooth"})},hidden:!K.length||Me,title:g._({id:"R8CUl0",values:{0:K.length}}),children:[e(C,{icon:"arrow-up"}),K.filter((D,E,F)=>F.findIndex(ce=>ce.accountID===D.accountID)===E).slice(0,3).map(D=>e(lt,{url:D.account.avatar,alt:D.account.displayName},D.account.id)),K.length>3&&e(B,{children:[" ",e("span",{class:"insignificant",children:Ge(K.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:l==="full"?"":"none"},onClick:()=>{m(null),s.delete("media"),s.delete("media-only"),s.delete("view"),o(s)},title:g._({id:"+/xYEI"}),children:e(C,{icon:"layout4",size:"l"})}),N&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{A.reloadStatusPage++,M(!1)},children:e(C,{icon:"refresh",size:"l",alt:g._({id:"lCF0wC"})})}),e(ct,{align:"end",portal:{target:$.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(C,{icon:"more",alt:g._({id:"2FYpfJ"}),size:"xl"})}),children:[e(ye,{disabled:T==="loading",onClick:()=>{A.reloadStatusPage++},children:[e(C,{icon:"refresh"}),e("span",{children:e(u,{id:"lCF0wC"})})]}),e(ye,{className:"menu-switch-view",onClick:()=>{m(l==="full"?null:"full"),s.delete("media"),s.delete("media-only"),l==="full"?s.delete("view"):s.set("view","full"),o(s)},children:[e(C,{icon:{"":"layout5",full:"layout4"}[l||""]}),e("span",{children:l==="full"?g._({id:"+/xYEI"}):g._({id:"2LiWsE"})})]}),e(ye,{onClick:()=>{Array.from($.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(E=>{E.click()})},children:[e(C,{icon:"eye-open"})," ",e("span",{children:e(u,{id:"8r8KmB"})})]}),e(Ve,{}),e(hs,{className:"plain",children:e(u,{id:"Rsjgm0"})}),e(ye,{disabled:!ie||Q,onClick:()=>{const D=Dr(z.url);D?location.hash=D:alert(g._({id:"9J6biQ"}))},children:[e(C,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:ie?g._({id:"Kp9SAs",values:{0:Gt.toUnicode(ie)}}):g._({id:"lb07+k"})})]})]}),e(fe,{class:"button plain deck-close",to:n,children:e(C,{icon:"x",size:"xl",alt:g._({id:"yz7wBu"})})})]})]})}),S.length&&z?e("ul",{class:`timeline flat contextual grow ${T==="loading"?"loading":""}`,children:[le,te>0&&e("li",{children:e("button",{type:"button",class:"plain block show-more",disabled:T==="loading",onClick:()=>Ce(D=>D+ln),style:{marginBlockEnd:"6em"},"data-state-post-ids":xe.join(" "),children:[e("div",{class:"ib avatars-bunch",children:S.slice(de,de+5).map(D=>e(lt,{url:D.account.avatarStatic},D.id))})," ",e("div",{class:"ib",children:[e(u,{id:"uXRAkV"})," ",e("span",{class:"tag",children:te>ln?`${ln}+`:te})]})]})})]}):e(B,{children:[T==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(qe,{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 Gs({replies:t,instance:n,hasParentThread:i,level:s,accWeight:o,openAll:a,parentLink:p}){const[r,c]=ht(),l=y=>y.reduce((S,_)=>{const{repliesCount:T,replies:I}=_,x=(I==null?void 0:I.length)||T;return S+x+l(I||[])},0),m=t.length+l(t),h=t.length===m,f=t.map(y=>y.account).filter((y,S,_)=>_.findIndex(T=>T.id===y.id)===S).slice(0,3),d=ke(()=>t==null?void 0:t.reduce((y,S)=>y+(S==null?void 0:S.weight),o),[o,t==null?void 0:t.length]);let v=!1;(a||d<=nl||!i&&m===1&&Jt(t[0])<2)&&(v=!0);const b=Kn[t[0].id],w=ot((y,S,_,T)=>{y.preventDefault(),y.stopPropagation(),c({media:S+1,mediaStatusID:T.id})},[]),k=q();return yt(()=>{var S;function y(_){_.target.dataset.scrollLeft=_.target.scrollLeft}return(S=k.current)==null||S.addEventListener("scroll",y,{passive:!0}),()=>{var _;(_=k.current)==null||_.removeEventListener("scroll",y)}},[]),e("details",{ref:k,class:"replies",open:b||v,onToggle:y=>{const{open:S}=y.target;Kn[t[0].id]=S},style:{"--comments-level":s},"data-comments-level":s,"data-comments-level-overflow":s>4,children:[e("summary",{class:"replies-summary",hidden:v,children:[e("span",{class:"avatars",children:f.map(y=>e(lt,{url:y.avatarStatic,title:`${y.displayName} @${y.username}`,squircle:y==null?void 0:y.bot},y.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(u,{id:"DOQUen",values:{0:t.length,1:Ge(t.length)},components:{0:e("span",{title:t.length})}})}),!h&&m>1&&e(B,{children:[" ","·"," ",e("span",{children:e(u,{id:"qSQQSe",values:{0:Ge(m),totalComments:m},components:{0:e("span",{title:m})}})})]})]}),e(C,{icon:"chevron-down",class:"replies-summary-chevron"}),!!p&&e(fe,{class:"replies-parent-link",to:p.to,onClick:p.onClick,title:g._({id:"ZlV82A"}),children:"»"})]}),e("ul",{children:t.map(y=>{var S,_;return e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(qe,{statusID:y.id,instance:n,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:w,showActionsBar:!0}),!((S=y.replies)!=null&&S.length)&&y.repliesCount>0&&e("div",{class:"replies-link",children:[e(C,{icon:"comment2",alt:g._({id:"N8UzTV"})})," ",e("span",{title:y.repliesCount,children:Ge(y.repliesCount)})]})]}),((_=y.replies)==null?void 0:_.length)&&e(Gs,{instance:n,replies:y.replies,level:s+1,accWeight:v?d:y.weight,openAll:a,parentLink:{to:n?`/${n}/s/${y.id}`:`/s/${y.id}`,onClick:()=>{mn(y.id)}}})]},y.id)})})]})}const cl=140,al=35,rl=70,ll=140,Wn=new Map;function Jt(t){var d,v;const n=Wn.get(t.id);if(n)return n;const{spoilerText:i,content:s,mediaAttachments:o,poll:a,card:p}=t,r=us(i+s),c=o!=null&&o.length?cl:0,l=(((d=a==null?void 0:a.options)==null?void 0:d.length)||0)*al,m=p&&(o!=null&&o.length||(v=a==null?void 0:a.options)!=null&&v.length)?0:rl,f=(r+c+l+m)/ll;return Wn.set(t.id,f),f}const dl=it(il);function ul(){const t=Mt(),{id:n,instance:i}=t;return e(dl,{id:n,instance:i})}const hl=""+new URL("boosts-carousel-YjmjXTE6.jpg",import.meta.url).href,fl=""+new URL("grouped-notifications-xYMFVY91.jpg",import.meta.url).href,pl=""+new URL("multi-column-ETnJNDVb.jpg",import.meta.url).href,ml=""+new URL("multi-hashtag-timeline-x-SDVR4g.jpg",import.meta.url).href,gl=""+new URL("nested-comments-thread-Ib-fZGS3.jpg",import.meta.url).href,bl="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",vl={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:Zt,PHANPY_WEBSITE:Ki,PHANPY_PRIVACY_POLICY_URL:yl,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Wi}=vl,Zi=Ki?Ki.replace(/https?:\/\//g,"").replace(/\/$/,""):null,Xi=`${"2024-10-08T16:03:59.313Z".slice(0,10).replace(/-/g,".")}.0a176e2`;function Ks(){return We(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:ri,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:bl,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(u,{id:"Ogtv0V"})}),e("p",{children:e(fe,{to:Zt?`/login?instance=${Zt}&submit=1`:"/login",class:"button",children:Zt?g._({id:"sQia9P"}):g._({id:"ZLoGls"})})}),Zt&&Wi&&e("p",{children:e("a",{href:Wi,class:"button plain5",children:e(u,{id:"e+RpCP"})})}),!Zt&&e("p",{class:"insignificant",children:e("small",{children:e(u,{id:"fvAsUK",components:{0:e("br",{})}})})})]}),(Zi||Xi)&&e("p",{class:"app-site-version",children:e("small",{children:[Zi," ",Xi]})}),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:yl,target:"_blank"})}})}),e("div",{children:e(li,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:hl,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:gl,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:fl,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:pl,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:ml,alt:g._({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(u,{id:"Wi1Ov0"})}),e("p",{children:e(u,{id:"tS2i+h"})})]})]})})]})}const wl=window.alert;window.__nativeAlert||(window.__nativeAlert=wl);window.alert=function(t){t instanceof Error&&(t!=null&&t.message)&&(t=t.message),typeof t!="string"&&(t=JSON.stringify(t));const n=Do({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}=oe();for(const a in t){if(!window.__IDLE__)break;try{const p=document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`),r=i.some(c=>{var l;return a===nt((l=c.status)==null?void 0:l.id,o)});if(!p&&!r){delete A.statuses[a],delete A.statusQuotes[a];for(const c in n){const l=n[c];if(nt(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,p;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):(p=(a=Ot)[t])==null||p.call(a)},1)},5e3);(()=>{window.__IDLE__=!0;const t=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],n=()=>{window.__IDLE__=!0},s=fs(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"){const t=ge.local.get("theme");let n;if(t){if(n=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),n){const i=n.content,s=t==="light"?n.dataset.themeLightColorTemp:n.dataset.themeDarkColorTemp;n.content=s||"",setTimeout(()=>{n.content=i},10)}}else{const i=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(n=document.querySelector(`meta[name="theme-color"][media*="${i}"]`),n){const s=n.dataset.content,o=n.dataset.contentTemp;n.content=o||"",setTimeout(()=>{n.content=s},10)}}}});{const t=ge.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=ge.local.get("textSize");n&&document.documentElement.style.setProperty("--text-size",`${n}px`)}es(A,t=>{var n;for(const[i,s,o,a]of t){if(s.join(".")==="settings.shortcutsViewMode"){const p=document.getElementById("app");p&&(p.dataset.shortcutsViewMode=(n=A.shortcuts)!=null&&n.length?o:"")}s.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});const dn=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(t){},end(t){}};function _l(){const[t,n]=L(!1),[i,s]=L("loading");__BENCHMARK.start("app-init"),__BENCHMARK.start("time-to-following"),__BENCHMARK.start("time-to-home"),__BENCHMARK.start("time-to-isLoggedIn"),Je(),ee(()=>{const a=ge.local.get("instanceURL"),p=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(p){window.history.replaceState({},document.title,window.location.pathname||"/");const r=ge.sessionCookie.get("clientID"),c=ge.sessionCookie.get("clientSecret"),l=ge.sessionCookie.get("vapidKey"),m=ge.sessionCookie.get("codeVerifier");(async()=>{s("loading");const{access_token:h}=await Xr({instanceURL:a,client_id:r,client_secret:c,code:p,code_verifier:m||void 0});if(h){const f=lo({instance:a,accessToken:h});await Promise.allSettled([Rn(f),Ln(f,a),uo(f,a,h,l)]),yi(),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=ho(r),c&&(gn(c.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),c||(c=Zn()),c){gn(c.info.id);const{client:l}=oe({account:c}),{instance:m}=l;yi(),s("loading"),(async()=>{try{fo()&&po(m)?(Rn(l),Ln(l,m)):await Promise.allSettled([Rn(l),Ln(l,m)])}catch{}finally{n(!0),s("default"),__BENCHMARK.end("app-init")}})()}else s("default"),__BENCHMARK.end("app-init")}ge.sessionCookie.del("clientID"),ge.sessionCookie.del("clientSecret"),ge.sessionCookie.del("codeVerifier")},[]);let o=Yt();return A.currentLocation=o.pathname,ee(jn,[o,t]),/\/https?:/.test(o.pathname)?e(Nr,{}):i==="loading"?e(Ne,{id:"loader-root"}):e(B,{children:[e(Cl,{isLoggedIn:t}),e(Il,{isLoggedIn:t}),e(Jn,{children:e(Ye,{path:"/:instance?/s/:id",element:e(ul,{})})}),t&&e(zo,{}),t&&e(da,{}),e(ia,{}),t&&e(aa,{}),e(Oo,{isLoggedIn:t}),e(ra,{onClose:jn}),e(Uo,{})]})}function Sl({isLoggedIn:t}){return t&&__BENCHMARK.end("time-to-isLoggedIn"),t?e($r,{}):e(Ks,{})}const Cl=it(({isLoggedIn:t})=>{const n=Yt(),i=ke(()=>{const{pathname:s}=n;return!/^\/(login|welcome)/i.test(s)},[n]);return e(Jn,{location:i||n,children:[e(Ye,{path:"/",element:e(Sl,{isLoggedIn:t})}),e(Ye,{path:"/login",element:e(el,{})}),e(Ye,{path:"/welcome",element:e(Ks,{})})]})});function Ji(){return A.prevLocation||null}function Il({isLoggedIn:t}){const n=Yt(),i=q(Ji());return ke(()=>Qt("/:instance/s/:id",n.pathname)||Qt("/s/:id",n.pathname),[n.pathname,Qt])?i.current||(i.current=Ji()):i.current=null,e(Jn,{location:i.current||n,children:[t&&e(B,{children:[e(Ye,{path:"/notifications",element:e(Bs,{})}),e(Ye,{path:"/mentions",element:e(Os,{})}),e(Ye,{path:"/following",element:e(gi,{})}),e(Ye,{path:"/b",element:e(Rs,{})}),e(Ye,{path:"/f",element:e(Ls,{})}),e(Ye,{path:"/l",children:[e(Ye,{index:!0,element:e(Pr,{})}),e(Ye,{path:":id",element:e(Ds,{})})]}),e(Ye,{path:"/fh",element:e(Xa,{})}),e(Ye,{path:"/ft",element:e(Ga,{})}),e(Ye,{path:"/catchup",element:e(Na,{})})]}),e(Ye,{path:"/:instance?/t/:hashtag",element:e(Ms,{})}),e(Ye,{path:"/:instance?/a/:id",element:e(Ta,{})}),e(Ye,{path:"/:instance?/p",children:[e(Ye,{index:!0,element:e(Gn,{})}),e(Ye,{path:"l",element:e(Gn,{local:!0})})]}),e(Ye,{path:"/:instance?/trending",element:e(js,{})}),e(Ye,{path:"/:instance?/search",element:e(Hs,{})})]})}mo();vo(e(go,{i18n:g,children:e(bo,{children:e(_l,{})})}),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 p=await caches.keys();for(const r of p){if(n.includes(r))continue;const c=await caches.open(r),l=await c.keys();if(l.length>50){const m=l.slice(50);for(const h of m)await c.delete(h)}}i=!0}catch{}setTimeout(a,i?o:s)}setTimeout(a,s)}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")};
|
||
//# sourceMappingURL=main-DaGMLi0n.js.map
|