Files
phanpy-cz/assets/main-COIelIo0.js
2025-11-28 11:44:18 +01:00

31 lines
348 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dom-BnEjxmqU.js","./pwa-viewport-Bz1GOnQv.js","./ScheduledAtField-Dw49_KZ-.js","./ICONS-BJuc0WJ2.js"])))=>i.map(i=>d[i]);
import{A as U,y as V,M as ct,u as re,d as R,s as E,a as ce,b as Je,p as Ct,c as We,q as it,g as kt,e,k as N,T as p,f as nn,h as $t,i as Ht,j as qn,l as Ie,m as _e,L as fa,C as ai,n as pa,o as ma,r as Un,t as Ei,v as ns,w as cn,x as Zn,z as De,B as ga,E as ya,F as Ri,G as me,H as Fn,I as Kn,_ as St,J as Js,K as eo,N as ah,O as to,P as Li,Q as va,R as ba,S as ht,U as wa,V as $i,W as ka,X as _t,Y as Sa,Z as Ca,$ as Mi,a0 as Pi,a1 as Bt,a2 as et,a3 as no,a4 as io,a5 as _a,a6 as so,a7 as Ia,a8 as Aa,a9 as mn,aa as xa,ac as Ta,ad as ci,ae as ri,af as Ea,ag as is,ah as Ra,ai as La,aj as $a,ak as Ni,al as Xe,an as Ma,ao as Pa,ap as Na,aq as Da,ar as Oa,as as za}from"./pwa-viewport-Bz1GOnQv.js";import{u as Di,f as Fe,s as he,o as ss,a as Ba,V as oo,b as ao,I,C as Oi,M as He,c as je,S as wn,d as ve,e as Xn,R as xt,n as at,g as co,h as qe,A as ut,N as gt,i as ft,j as bt,L as ge,l as Ot,k as qa,m as ro,p as Vt,q as dh,r as Qe,t as Qn,v as yt,w as os,T as lo,x as ot,y as vi,z as uo,E as ho,B as Ze,D as wt,F as Ye,G as Lt,H as Ua,J as Fa,K as jt,O as zi,P as fo,Q as Ka,U as sn,W as Ha,X as ja,Y as Jn,Z as Ya,_ as Gt,$ as Va,a0 as Ga,a1 as po,a2 as Wa,a3 as Bi,a4 as Za,a5 as Xa,a6 as Qa,a7 as Ja,a8 as ec,a9 as mo,aa as tc,ab as nc,ac as as,ad as ic,ae as sc}from"./ScheduledAtField-Dw49_KZ-.js";import{ICONS as Qt}from"./ICONS-BJuc0WJ2.js";var go=oc;function oc(n,i,s){var o=null,a=null,c=function(){o&&(clearTimeout(o),a=null,o=null)},h=function(){var r=a;c(),r&&r()},d=function(){if(!i)return n.apply(this,arguments);var r=this,l=arguments,u=s&&!o;if(c(),a=function(){n.apply(r,l)},o=setTimeout(function(){if(o=null,!u){var f=a;return a=null,f()}},i),u)return a()};return d.cancel=c,d.flush=h,d}(function(n,i){"use strict";typeof n.CustomEvent!="function"&&(n.CustomEvent=function(g,y){y=y||{bubbles:!1,cancelable:!1,detail:void 0};var w=i.createEvent("CustomEvent");return w.initCustomEvent(g,y.bubbles,y.cancelable,y.detail),w},n.CustomEvent.prototype=n.Event.prototype),i.addEventListener("touchstart",u,!1),i.addEventListener("touchmove",f,!1),i.addEventListener("touchend",l,!1);var s=null,o=null,a=null,c=null,h=null,d=null,r=0;function l(g){if(d===g.target){var y=parseInt(m(d,"data-swipe-threshold","20"),10),w=m(d,"data-swipe-unit","px"),k=parseInt(m(d,"data-swipe-timeout","500"),10),b=Date.now()-h,v="",_=g.changedTouches||g.touches||[];if(w==="vh"&&(y=Math.round(y/100*i.documentElement.clientHeight)),w==="vw"&&(y=Math.round(y/100*i.documentElement.clientWidth)),Math.abs(a)>Math.abs(c)?Math.abs(a)>y&&b<k&&(a>0?v="swiped-left":v="swiped-right"):Math.abs(c)>y&&b<k&&(c>0?v="swiped-up":v="swiped-down"),v!==""){var S={dir:v.replace(/swiped-/,""),touchType:(_[0]||{}).touchType||"direct",fingers:r,xStart:parseInt(s,10),xEnd:parseInt((_[0]||{}).clientX||-1,10),yStart:parseInt(o,10),yEnd:parseInt((_[0]||{}).clientY||-1,10)};d.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:S})),d.dispatchEvent(new CustomEvent(v,{bubbles:!0,cancelable:!0,detail:S}))}s=null,o=null,h=null}}function u(g){g.target.getAttribute("data-swipe-ignore")!=="true"&&(d=g.target,h=Date.now(),s=g.touches[0].clientX,o=g.touches[0].clientY,a=0,c=0,r=g.touches.length)}function f(g){if(!(!s||!o)){var y=g.touches[0].clientX,w=g.touches[0].clientY;a=s-y,c=o-w}}function m(g,y,w){for(;g&&g!==i.documentElement;){var k=g.getAttribute(y);if(k)return k;g=g.parentNode}return w}})(window,document);function on(n=()=>{},i=[]){const s=U(n);V(()=>{s.current=n},[i]),V(()=>{const o=()=>{const a=document.hidden||document.visibilityState==="hidden";s.current(!a)};return document.addEventListener("visibilitychange",o),()=>document.removeEventListener("visibilitychange",o)},[])}const ac=1e3*3,cs=2e4,cc=ct(function({isLoggedIn:i}){const{_:s}=re(),[o,a]=R(!0),c=U();on(l=>{clearTimeout(c.current),l?a(!0):c.current=setTimeout(()=>{a(!1)},cs)});const h=async(l,u,f)=>{if(E.notificationsLast){const m=l.v1.notifications.list({limit:1,sinceId:E.notificationsLast.id}).values(),{value:g}=await m.next();if(g?.length)if(f)E.notificationsShowNew=!0;else{let y;try{y=(await l.v1.markers.fetch({timeline:"notifications"}))?.notifications?.lastReadId}catch{}y?E.notificationsShowNew=g[0].id!==y:E.notificationsShowNew=!0}}};V(()=>{let l,u,f;if(i&&o){const{masto:m,streaming:g,instance:y}=ce();(async()=>{await h(m,y);let w=!1;g&&(u=setTimeout(()=>{(async()=>{try{w=!0,l=g.user.notification.subscribe();for await(const k of l){if(!l||!o)break;k.event==="notification"&&Je(k.payload,y,{skipThreading:!0}),E.notificationsShowNew=!0}}catch{w=!1}w||(f=setInterval(()=>{h(m,y,!0)},cs))})()},ac))})()}return()=>{l?.unsubscribe?.(),l=null,clearTimeout(u),clearInterval(f)}},[o,i]);const d=U(),r=()=>{d.current=Date.now(),fetch("./version.json").then(l=>l.json()).then(l=>{l&&(E.appVersion=l)}).catch(l=>{})};return Di(r,o&&1e3*60*30),on(l=>{l&&(d.current?Date.now()-d.current>1e3*60*60&&r():r())}),Fe("shift+alt+k",l=>{if(!l.shiftKey||!l.altKey)return;const u=E.settings.cloakMode;E.settings.cloakMode=!u,he({text:s(u?{id:"oguMwa"}:{id:"IXZLPs"})})},{useKey:!0,ignoreEventWhen:l=>l.metaKey||l.ctrlKey}),null}),rc=Ct(async(n,i)=>{const s=n.v1.accounts.$select(i).statuses.list({limit:3,exclude_replies:!0,exclude_reblogs:!0}).values(),{value:o}=await s.next();return o||[]},{maxAge:6e4});function lc(){const{_:n}=re(),i=We(E),{masto:s}=ce(),[o,a]=R(!1),[c,h]=R([]),[d,r]=R(!1),l=U(null),u=U(null),f=i.settings.shortcutsViewMode==="multi-column";function m(k){if(k.key&&k.key.toLowerCase()!=="c")return;if(i.composerState.minimized){E.composerState.minimized=!1,ss();return}const b=document.querySelectorAll("data.compose-data"),v=!f&&b.length===1?JSON.parse(b[0].value):void 0;k.shiftKey?Ba(v)||(E.showCompose=v||!0):(ss(),E.showCompose=v||!0)}Fe("c, shift+c",m,{useKey:!0,ignoreEventWhen:k=>!!document.querySelector("#modal-container > *")||k.metaKey||k.ctrlKey||k.altKey});const g=oo(()=>{a(!0)},{threshold:600}),y=it(async()=>{try{r(!0);const k=kt();if(!k)return;const b=await rc(s,k);h(b)}catch{}finally{r(!1)}},[s]),w=it(k=>{ao({replyToStatus:k}),a(!1)},[]);return V(()=>{o&&y()},[y,o]),e(N,{children:[e("button",{ref:l,type:"button",id:"compose-button",onClick:m,onContextMenu:k=>{k.preventDefault(),a(!0)},...g(),class:`${i.composerState.minimized?"min":""} ${i.composerState.publishing?"loading":""} ${i.composerState.publishingError?"error":""}`,children:e(I,{icon:"quill",size:"xl",alt:n({id:"QOhkyl"})})}),e(Oi,{ref:u,state:o?"open":void 0,anchorRef:l,onClose:()=>a(!1),direction:"top",gap:8,unmountOnClose:!0,portal:{target:document.body},boundingBoxPadding:co(),containerProps:{style:{zIndex:19},onClick:()=>{u.current?.closeMenu?.()}},submenuOpenDelay:600,children:[e(He,{to:"/sp",children:[e(I,{icon:"schedule"})," ",e("span",{children:e(p,{id:"+GkIdc"})})]}),e(je,{}),e(wn,{align:"end",direction:"top",shift:-8,disabled:d||c.length===0,label:e(N,{children:[e(I,{icon:"comment"})," ",e("span",{className:"menu-grow",children:e(p,{id:"LwOr4P"})}),d?"…":e(I,{icon:"chevron-right"})]}),children:c.length>0&&c.map(k=>{const b=new Date(k.createdAt),v=Date.now()-b.getTime()<864e5;return e(ve,{onClick:()=>w(k),children:e("small",{children:[e("div",{class:"menu-post-text",children:Xn(k)}),e("span",{className:"more-insignificant",children:[v&&e(N,{children:[e(xt,{datetime:b,format:"micro"})," ",""," "]}),e("time",{className:"created",dateTime:b.toISOString(),title:b.toLocaleString(),children:at(k.createdAt)})]})]})},k.id)})})]})]})}function rs({key1:n,key2:i}){return e(p,{id:"Qh+0sm",values:{key1:n,key2:i},components:{0:e("kbd",{}),1:e("kbd",{})}})}const dc=ct(function(){const{_:i}=re(),s=We(E);function o(){E.showKeyboardShortcutsHelp=!1}return Fe("?",()=>{E.showKeyboardShortcutsHelp=!0},{useKey:!0,ignoreEventWhen:a=>/\/catchup/i.test(location.hash)||a.metaKey||a.ctrlKey||a.altKey}),!!s.showKeyboardShortcutsHelp&&e(qe,{onClose:o,children:e("div",{id:"keyboard-shortcuts-help-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(p,{id:"77Emn0"})})}),e("main",{children:e("table",{children:e("tbody",{children:[{action:i({id:"ulXSNi"}),keys:e("kbd",{children:"?"})},{action:i({id:"Gy9P9T"}),keys:e("kbd",{children:"j"})},{action:i({id:"6XYpYY"}),keys:e("kbd",{children:"k"})},{action:i({id:"DYowFe"}),keys:e(p,{id:"mzjGX4",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"S5ez7Y"}),keys:e(p,{id:"Fd8FaU",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"VkLESX"}),keys:e("kbd",{children:"."})},{action:i({id:"jsFF8C"}),keys:e(p,{id:"80sOCm",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:e(p,{id:"41gejM",components:{0:e("br",{})}}),keys:e("kbd",{children:"x"})},{action:i({id:"jAj8rv"}),keys:e(p,{id:"evz6c6",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"duF1lx"}),keys:e(p,{id:"nhpsIN",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"YrR3Co"}),keys:e("kbd",{children:"]"})},{action:i({id:"noxAFR"}),keys:e("kbd",{children:"["})},{action:i({id:"AIa/f7"}),keys:e("kbd",{children:"c"})},{action:i({id:"snPx8X"}),className:"insignificant",keys:e(p,{id:"+Cxvld",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"1pKapz"}),keys:e(p,{id:"py67WT",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{}),3:e("kbd",{})}})},{action:i({id:"A1taO8"}),keys:e("kbd",{children:"/"})},{action:i({id:"ImOQa9"}),keys:e("kbd",{children:"r"})},{action:i({id:"KFs8c6"}),className:"insignificant",keys:e(p,{id:"XpQLJF",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"cqi4Mx"}),keys:e(p,{id:"84WuL2",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"kulphB"}),keys:e(p,{id:"yrz6Ck",components:{0:e("kbd",{}),1:e("kbd",{})}})},{action:i({id:"ZhhOwV"}),keys:e("kbd",{children:"q"})},{action:i({id:"PZlHt8"}),keys:e("kbd",{children:"d"})},{action:i({id:"C7ujRh"}),keys:e(p,{id:"v4TbMP",components:{0:e("kbd",{}),1:e("kbd",{}),2:e("kbd",{})}})},{action:i({id:"UmuIdg"}),keys:e(rs,{key1:"g",key2:"h"})},{action:i({id:"0YgcH9"}),keys:e(rs,{key1:"g",key2:"n"})}].map(({action:a,className:c,keys:h})=>e("tr",{children:[e("th",{class:c,children:a}),e("td",{children:h})]},a))})})})]})})}),bi=new Set,st=new WeakMap,Wt=new WeakMap,vt=new WeakMap,gn=new WeakMap,li=new WeakMap,fn=new WeakMap,Yt=new WeakMap,zt=new WeakMap,tn=new WeakSet;let dt,qi=0,Ui=0;const Et="__aa_tgt",yn="__aa_del",Hn="__aa_new",yo=n=>{const i=pc(n);i&&i.forEach(s=>mc(s))},uc=n=>{n.forEach(i=>{i.target===dt&&hc(),st.has(i.target)&&Xt(i.target)})};function vo(n){const i=n.getBoundingClientRect(),s=dt?.clientWidth||0,o=dt?.clientHeight||0;return i.bottom<0||i.top>o||i.right<0||i.left>s}function Fi(n){const i=gn.get(n);i?.disconnect();let s=st.get(n),o=0;const a=5;s||(s=an(n),st.set(n,s));const{offsetWidth:c,offsetHeight:h}=dt,r=[s.top-a,c-(s.left+a+s.width),h-(s.top+a+s.height),s.left-a].map(u=>`${-1*Math.floor(u)}px`).join(" "),l=new IntersectionObserver(()=>{++o>1&&Xt(n)},{root:dt,threshold:1,rootMargin:r});l.observe(n),gn.set(n,l)}function Xt(n,i=!0){clearTimeout(zt.get(n));const s=ei(n),o=i?vn(s)?500:s.duration:0;zt.set(n,setTimeout(async()=>{const a=vt.get(n);try{await a?.finished,st.set(n,an(n)),Fi(n)}catch{}},o))}function hc(){clearTimeout(zt.get(dt)),zt.set(dt,setTimeout(()=>{bi.forEach(n=>Ln(n,i=>bo(()=>Xt(i))))},100))}function fc(n){setTimeout(()=>{fn.set(n,setInterval(()=>bo(Xt.bind(null,n)),2e3))},Math.round(2e3*Math.random()))}function bo(n){typeof requestIdleCallback=="function"?requestIdleCallback(()=>n()):requestAnimationFrame(()=>n())}let Tt;const wo=typeof window<"u"&&"ResizeObserver"in window;wo&&(dt=document.documentElement,new MutationObserver(yo),Tt=new ResizeObserver(uc),window.addEventListener("scroll",()=>{Ui=window.scrollY,qi=window.scrollX}),Tt.observe(dt));function pc(n){return n.reduce((o,a)=>[...o,...Array.from(a.addedNodes),...Array.from(a.removedNodes)],[]).every(o=>o.nodeName==="#comment")?!1:n.reduce((o,a)=>{if(o===!1)return!1;if(a.target instanceof Element){if(di(a.target),!o.has(a.target)){o.add(a.target);for(let c=0;c<a.target.children.length;c++){const h=a.target.children.item(c);if(h){if(yn in h)return!1;di(a.target,h),o.add(h)}}}if(a.removedNodes.length)for(let c=0;c<a.removedNodes.length;c++){const h=a.removedNodes[c];if(yn in h)return!1;h instanceof Element&&(o.add(h),di(a.target,h),Wt.set(h,[a.previousSibling,a.nextSibling]))}}return o},new Set)}function di(n,i){!i&&!(Et in n)?Object.defineProperty(n,Et,{value:n}):i&&!(Et in i)&&Object.defineProperty(i,Et,{value:n})}function mc(n){var i,s;const o=n.isConnected,a=st.has(n);o&&Wt.has(n)&&Wt.delete(n),((i=vt.get(n))===null||i===void 0?void 0:i.playState)!=="finished"&&((s=vt.get(n))===null||s===void 0||s.cancel()),Hn in n?ls(n):a&&o?yc(n):a&&!o?vc(n):ls(n)}function At(n){return Number(n.replace(/[^0-9.\-]/g,""))}function gc(n){let i=n.parentElement;for(;i;){if(i.scrollLeft||i.scrollTop)return{x:i.scrollLeft,y:i.scrollTop};i=i.parentElement}return{x:0,y:0}}function an(n){const i=n.getBoundingClientRect(),{x:s,y:o}=gc(n);return{top:i.top+o,left:i.left+s,width:i.width,height:i.height}}function ko(n,i,s){let o=i.width,a=i.height,c=s.width,h=s.height;const d=getComputedStyle(n);if(d.getPropertyValue("box-sizing")==="content-box"){const l=At(d.paddingTop)+At(d.paddingBottom)+At(d.borderTopWidth)+At(d.borderBottomWidth),u=At(d.paddingLeft)+At(d.paddingRight)+At(d.borderRightWidth)+At(d.borderLeftWidth);o-=u,c-=u,a-=l,h-=l}return[o,c,a,h].map(Math.round)}function ei(n){return Et in n&&Yt.has(n[Et])?Yt.get(n[Et]):{duration:250,easing:"ease-in-out"}}function So(n){if(Et in n)return n[Et]}function Ki(n){const i=So(n);return i?tn.has(i):!1}function Ln(n,...i){i.forEach(s=>s(n,Yt.has(n)));for(let s=0;s<n.children.length;s++){const o=n.children.item(s);o&&i.forEach(a=>a(o,Yt.has(o)))}}function Hi(n){return Array.isArray(n)?n:[n]}function vn(n){return typeof n=="function"}function yc(n){const i=st.get(n),s=an(n);if(!Ki(n))return st.set(n,s);if(vo(n)){st.set(n,s),Fi(n);return}let o;if(!i)return;const a=ei(n);if(typeof a!="function"){let c=i.left-s.left,h=i.top-s.top;const d=i.left+i.width-(s.left+s.width);i.top+i.height-(s.top+s.height)==0&&(h=0),d==0&&(c=0);const[l,u,f,m]=ko(n,i,s),g={transform:`translate(${c}px, ${h}px)`},y={transform:"translate(0, 0)"};l!==u&&(g.width=`${l}px`,y.width=`${u}px`),f!==m&&(g.height=`${f}px`,y.height=`${m}px`),o=n.animate([g,y],{duration:a.duration,easing:a.easing})}else{const[c]=Hi(a(n,"remain",i,s));o=new Animation(c),o.play()}vt.set(n,o),st.set(n,s),o.addEventListener("finish",Xt.bind(null,n,!1),{once:!0})}function ls(n){Hn in n&&delete n[Hn];const i=an(n);st.set(n,i);const s=ei(n);if(!Ki(n))return;if(vo(n)){Fi(n);return}let o;if(typeof s!="function")o=n.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:s.duration*1.5,easing:"ease-in"});else{const[a]=Hi(s(n,"add",i));o=new Animation(a),o.play()}vt.set(n,o),o.addEventListener("finish",Xt.bind(null,n,!1),{once:!0})}function ds(n,i){var s;n.remove(),st.delete(n),Wt.delete(n),vt.delete(n),(s=gn.get(n))===null||s===void 0||s.disconnect(),setTimeout(()=>{if(yn in n&&delete n[yn],Object.defineProperty(n,Hn,{value:!0,configurable:!0}),i&&n instanceof HTMLElement)for(const o in i)n.style[o]=""},0)}function vc(n){var i;if(!Wt.has(n)||!st.has(n))return;const[s,o]=Wt.get(n);Object.defineProperty(n,yn,{value:!0,configurable:!0});const a=window.scrollX,c=window.scrollY;if(o&&o.parentNode&&o.parentNode instanceof Element?o.parentNode.insertBefore(n,o):s&&s.parentNode?s.parentNode.appendChild(n):(i=So(n))===null||i===void 0||i.appendChild(n),!Ki(n))return ds(n);const[h,d,r,l]=wc(n),u=ei(n),f=st.get(n);(a!==qi||c!==Ui)&&bc(n,a,c,u);let m,g={position:"absolute",top:`${h}px`,left:`${d}px`,width:`${r}px`,height:`${l}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!vn(u))Object.assign(n.style,g),m=n.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:u.duration,easing:"ease-out"});else{const[y,w]=Hi(u(n,"remove",f));w?.styleReset!==!1&&(g=w?.styleReset||g,Object.assign(n.style,g)),m=new Animation(y),m.play()}vt.set(n,m),m.addEventListener("finish",()=>ds(n,g),{once:!0})}function bc(n,i,s,o){const a=qi-i,c=Ui-s,h=document.documentElement.style.scrollBehavior;if(getComputedStyle(dt).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+a,window.scrollY+c),!n.parentElement)return;const r=n.parentElement;let l=r.clientHeight,u=r.clientWidth;const f=performance.now();function m(){requestAnimationFrame(()=>{if(!vn(o)){const g=l-r.clientHeight,y=u-r.clientWidth;f+o.duration>performance.now()?(window.scrollTo({left:window.scrollX-y,top:window.scrollY-g}),l=r.clientHeight,u=r.clientWidth,m()):document.documentElement.style.scrollBehavior=h}})}m()}function wc(n){var i;const s=st.get(n),[o,,a]=ko(n,s,an(n));let c=n.parentElement;for(;c&&(getComputedStyle(c).position==="static"||c instanceof HTMLBodyElement);)c=c.parentElement;c||(c=document.body);const h=getComputedStyle(c),d=!vt.has(n)||((i=vt.get(n))===null||i===void 0?void 0:i.playState)==="finished"?an(c):st.get(c),r=Math.round(s.top-d.top)-At(h.borderTopWidth),l=Math.round(s.left-d.left)-At(h.borderLeftWidth);return[r,l,o,a]}function Co(n,i={}){if(wo&&Tt&&!(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!vn(i)&&!i.disrespectUserMotionPreference)){tn.add(n),getComputedStyle(n).position==="static"&&Object.assign(n.style,{position:"relative"}),Ln(n,Xt,fc,h=>Tt?.observe(h)),vn(i)?Yt.set(n,i):Yt.set(n,{duration:250,easing:"ease-in-out",...i});const c=new MutationObserver(yo);c.observe(n,{childList:!0}),li.set(n,c),bi.add(n)}return Object.freeze({parent:n,enable:()=>{tn.add(n)},disable:()=>{tn.delete(n),Ln(n,o=>{const a=vt.get(o);try{a?.cancel()}catch{}vt.delete(o);const c=zt.get(o);c&&clearTimeout(c),zt.delete(o);const h=fn.get(o);h&&clearInterval(h),fn.delete(o)})},isEnabled:()=>tn.has(n),destroy:()=>{tn.delete(n),bi.delete(n),Yt.delete(n);const o=li.get(n);o?.disconnect(),li.delete(n),Ln(n,a=>{Tt?.unobserve(a);const c=vt.get(a);try{c?.cancel()}catch{}vt.delete(a);const h=gn.get(a);h?.disconnect(),gn.delete(a);const d=fn.get(a);d&&clearInterval(d),fn.delete(a);const r=zt.get(a);r&&clearTimeout(r),zt.delete(a),st.delete(a),Wt.delete(a)})}})}function ti(n){const i=U(null),[s,o]=R(),a=c=>{s&&(c?s.enable():s.disable())};return V(()=>{i.current instanceof HTMLElement&&o(Co(i.current,n||{}))},[]),V(()=>()=>{var c;(c=s?.destroy)===null||c===void 0||c.call(s)},[s]),[i,a]}function kc(n){return("0"+n.toString(16)).slice(-2)}function Sc(){var n=new Uint32Array(28);return window.crypto.getRandomValues(n),Array.from(n,kc).join("")}function Cc(n){const s=new TextEncoder().encode(n);return window.crypto.subtle.digest("SHA-256",s)}function _c(n){let i="";const s=new Uint8Array(n),o=s.byteLength;for(var a=0;a<o;a++)i+=String.fromCharCode(s[a]);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function _o(n){const i=await Cc(n);return _c(i)}async function Ic({instanceURL:n}){if(!n)return!1;try{const i=await fetch(`https://${n}/.well-known/oauth-authorization-server`);return!i.ok||i.status!==200?!1:!!(await i.json()).code_challenge_methods_supported?.includes("S256")}catch{return!1}}window.__generateCodeChallenge=_o;const Ac={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{DEV:xc,PHANPY_CLIENT_NAME:Tc,PHANPY_WEBSITE:jn}=Ac,ji="read write follow push",Ec=jn?jn.toLowerCase().includes(location.hostname):!1,Rc=location.origin+location.pathname,ni=xc||!Ec?Rc:jn;async function Lc({instanceURL:n}){const i=new URLSearchParams({client_name:Tc,redirect_uris:ni,scopes:ji,website:jn});return await(await fetch(`https://${n}/api/v1/apps`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i.toString()})).json()}async function $c({instanceURL:n,client_id:i,forceLogin:s=!1}){const o=Sc(),a=await _o(o),c=new URLSearchParams({client_id:i,code_challenge_method:"S256",code_challenge:a,redirect_uri:ni,response_type:"code",scope:ji});return s&&c.append("force_login",!0),[`https://${n}/oauth/authorize?${c.toString()}`,o]}async function Mc({instanceURL:n,client_id:i,forceLogin:s=!1}){const o=new URLSearchParams({client_id:i,scope:ji,redirect_uri:ni,response_type:"code"});return s&&o.append("force_login",!0),`https://${n}/oauth/authorize?${o.toString()}`}async function Pc({instanceURL:n,client_id:i,client_secret:s,code:o,code_verifier:a}){const c=new URLSearchParams({client_id:i,redirect_uri:ni,grant_type:"authorization_code",code:o});return s&&c.append("client_secret",s),a&&c.append("code_verifier",a),await(await fetch(`https://${n}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:c.toString()})).json()}async function Nc({instanceURL:n,client_id:i,client_secret:s,token:o}){try{const a=new URLSearchParams({client_id:i,client_secret:s,token:o});return(await fetch(`https://${n}/oauth/revoke`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString(),keepalive:!0})).ok}catch(a){return console.erro("Error revoking token",a),!1}}const Dc=window.matchMedia("(display-mode: standalone)").matches;function Oc({onClose:n}){const{_:i}=re(),{masto:s}=ce(),o=nn(),a=kt(),c=o.length>1,[h,d]=$t(l=>l+1,0),[r]=ti();return e("div",{id:"accounts-container",class:"sheet",tabIndex:"-1",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(p,{id:"bPwFdf"})})}),e("main",{children:e("section",{children:[e("ul",{class:"accounts-list",ref:r,children:o.map((l,u)=>{const f=l.info.id===a,m=u===0,g=!l.accessToken;return e("li",{children:[e("div",{children:[c&&e("span",{class:`current ${f?"is-current":""}`,children:e(I,{icon:"check-circle",alt:i({id:"Hp1l6f"})})}),e(ut,{url:l.info.avatarStatic,size:"xxl",onDblClick:async()=>{if(f)try{const y=await s.v1.accounts.$select(l.info.id).fetch();l.info=y,Ht(o),d()}catch{}}}),e(gt,{account:c?{...l.info,acct:/@/.test(l.info.acct)?l.info.acct:`${l.info.acct}@${l.instanceURL}`}:l.info,showAcct:!0,onClick:()=>{g?(location.href=`/#/login?instance=${l.instanceURL}`,n()):f?E.showAccount=`${l.info.username}@${l.instanceURL}`:(qn(l.info.id),location.reload())}})]}),e("div",{class:"actions",children:[g&&e("span",{class:"tag",children:e(p,{id:"mxY4xF"})}),m&&c&&e(N,{children:[e("span",{class:"tag",children:e(p,{id:"ovBPCi"})})," "]}),e(ft,{align:"end",menuButton:e("button",{type:"button",class:"plain more-button",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[c&&e(N,{children:[e(ve,{disabled:f||g,onClick:()=>{qn(l.info.id),location.reload()},children:[e(I,{icon:"transfer"})," ",e(p,{id:"3t/Nrv"})]}),!Dc&&!f&&!g&&e(He,{href:`./?account=${l.info.id}`,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(p,{id:"PZgZtY"})})]}),e(je,{})]}),e(ve,{onClick:()=>{E.showAccount=`${l.info.username}@${l.instanceURL}`},children:[e(I,{icon:"user"}),e("span",{children:e(p,{id:"40z2Fm"})})]}),e(je,{}),c&&e(N,{children:[e(ve,{disabled:m||g,onClick:()=>{o.splice(u,1),o.unshift(l),Ht(o),d()},children:[e(I,{icon:"check-circle"}),e("span",{children:e(p,{id:"PPcets"})})]}),e(ve,{disabled:u<=1,onClick:()=>{o.splice(u,1),o.splice(u-1,0,l),Ht(o),d()},children:[e(I,{icon:"arrow-up"}),e("span",{children:e(p,{id:"QyioBP"})})]}),e(ve,{disabled:u===0||u===o.length-1,onClick:()=>{o.splice(u,1),o.splice(u+1,0,l),Ht(o),d()},children:[e(I,{icon:"arrow-down"}),e("span",{children:e(p,{id:"3Ib6FN"})})]}),e(je,{})]}),e(bt,{subMenu:!0,confirmLabel:e(N,{children:[e(I,{icon:"exit"}),e("span",{children:e(p,{id:"k08LxG",values:{0:l.info.acct},components:{0:e("span",{class:"bidi-isolate"})}})})]}),disabled:!f||g,menuItemClassName:"danger",onClick:async()=>{await Nc({instanceURL:l.instanceURL,client_id:l.clientId,client_secret:l.clientSecret,token:l.accessToken}),o.splice(u,1),Ht(o);try{Ie.session.get("currentAccount")===l.info.id&&Ie.session.del("currentAccount")}catch{}location.href=location.pathname||"/"},children:[e(I,{icon:"exit"}),e("span",{children:e(p,{id:"CXk1bI"})})]}),!!l?.createdAt&&e("div",{class:"footer",children:[e(I,{icon:"account-add"}),e("span",{children:e(p,{id:"+9E7iR",values:{0:at(l.createdAt)},components:{0:e(xt,{datetime:l.createdAt})}})})]})]})]})]},l.info.id)})}),e("p",{children:e(ge,{to:"/login",class:"button plain2",onClick:n,children:[e(I,{icon:"plus"})," ",e("span",{children:e(p,{id:"Is7/PB"})})]})}),c&&e("p",{children:e("small",{children:e(p,{id:"52x24e",components:{0:e("i",{})}})})}),e("p",{children:e("button",{type:"button",class:"light",onClick:()=>E.showImportExportAccounts=!0,children:e(p,{id:"bgVLbt"})})})]})})]})}const Yi="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",zc={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function Vi(){const{i18n:n}=re(),i=_e(()=>fa.map(s=>{const o=zc[s]||s.replace(/-[a-z]+$/i,""),a=Ot({code:o,locale:s,fallback:ai.find(h=>h.code===s)?.nativeName}),c=Ot({code:o,locale:n.locale,fallback:ai.find(h=>h.code===s)?.name});return{code:s,regionlessCode:o,_common:c,native:a}}).sort((s,o)=>{const a=s._common.localeCompare(o._common,n.locale);return a!==0?a:s.code<o.code?-1:s.code>o.code?1:0}),[]);return e("label",{class:"lang-selector",children:["🌐"," ",e("select",{class:"small",value:n.locale||ma,onChange:s=>{Ie.local.set("lang",s.target.value),pa(s.target.value)},children:[i.map(({code:s,regionlessCode:o,native:a})=>{const c=Ot({code:o,locale:n.locale,fallback:ai.find(d=>d.code===s)?.name});return e("option",{value:s,"data-regionless-code":o,children:!!c&&c!==a?`${a} - ${c}`:a},s)}),void 0]})]})}function us(n){const{masto:i}=ce();return i.v1.push.subscription.create(n)}function Bc(){const{masto:n}=ce();return n.v1.push.subscription.fetch()}function qc(n){const{masto:i}=ce();return i.v1.push.subscription.update(n)}function Uc(){const{masto:n}=ce();return n.v1.push.subscription.remove()}function ii(){return"serviceWorker"in navigator&&"PushManager"in window}function Fc(){return navigator.serviceWorker.getRegistration()}async function Gi(){const n=await Fc(),i=n?await n.pushManager.getSubscription():void 0;return{registration:n,subscription:i}}function Io(n){const i="=".repeat((4-n.length%4)%4),s=`${n}${i}`.replace(/-/g,"+").replace(/_/g,"/"),o=window.atob(s),a=new Uint8Array(o.length);for(let c=0;c<o.length;++c)a[c]=o.charCodeAt(c);return a}async function Kc(){if(!ii())return;const{subscription:n}=await Gi();let i=null;try{i=await Bc()}catch(s){if(!/(not found|unknown)/i.test(s.message))throw s}if(i&&n){const s=i.endpoint===n.endpoint,o=Un(),a=i.serverKey===o;if(!s)throw new Error("Backend subscription endpoint changed");if(!a)throw new Error("Backend subscription key and vapid key changed")}if(n&&!i){const s=Un();if(s){const{applicationServerKey:o}=n.options,a=Io(s).toString(),c=new Uint8Array(o).toString();if(!(a===c))throw await n.unsubscribe(),new Error("Subscription key and vapid key changed")}}return{subscription:n,backendSubscription:i}}async function hs({data:n,policy:i}){if(!ii())return;let{registration:s,subscription:o}=await Gi(),a=null;if(o)try{a=await qc({data:n,policy:i})}catch{a=await us({subscription:o,data:n,policy:i})}else{const c=Un();if(!c)throw new Error("No server key found");o=await s.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Io(c)}),a=await us({subscription:o,data:n,policy:i})}return{subscription:o,backendSubscription:a}}async function fs(){if(!ii())return;const{subscription:n}=await Gi();n&&(await Uc(),await n.unsubscribe())}const Hc={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},ps=16,Ut=[14,15,16,17,18,19,20],{PHANPY_WEBSITE:ms,PHANPY_PRIVACY_POLICY_URL:jc,PHANPY_TRANSLANG_INSTANCES:Yc,PHANPY_IMG_ALT_API_URL:Vc,PHANPY_GIPHY_API_KEY:Gc}=Hc,gs=Object.entries(qa.tl).map(([n,i])=>({code:n,name:i})),Wc="TransLang API";function Zc({onClose:n}){const{_:i}=re(),s=We(E),o=Ie.local.get("theme")||"auto",a=U(),c=s.settings.contentTranslationTargetLanguage||null,h=ro(),d=Ot(h),r=Ie.local.get("textSize")||ps,[l,u]=R(Ei()),{masto:f,authenticated:m,instance:g}=ce(),[y,w]=R(Ie.local.get("experiments-tabBarV2")??!1),k=l["posting:default:visibility"]==="private";return e("div",{id:"settings-container",class:"sheet",tabIndex:"-1",style:{"--current-text-size":`${r}px`},children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(p,{id:"Tz0i8g"})})}),e("main",{children:[e("section",{children:e("ul",{children:[e("li",{children:[e("div",{children:e("label",{children:e(p,{id:"aAIQg2"})})}),e("div",{children:e("form",{ref:a,onInput:b=>{b.preventDefault();const _=new FormData(a.current).get("theme"),S=document.documentElement;if(_==="auto"){S.classList.remove("is-light","is-dark");const A=document.querySelector('meta[data-theme-setting="manual"]');A&&(A.name=""),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(x=>{x.name="theme-color"})}else{S.classList.toggle("is-light",_==="light"),S.classList.toggle("is-dark",_==="dark");const A=document.querySelector('meta[data-theme-setting="manual"]');A&&(A.name="theme-color",A.content=_==="light"?A.dataset.themeLightColor:A.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(x=>{x.name=""})}document.querySelector('meta[name="color-scheme"]').setAttribute("content",_==="auto"?"light dark":_),_==="auto"?Ie.local.del("theme"):Ie.local.set("theme",_)},children:e("div",{class:"radio-group",children:[e("label",{children:[e("input",{type:"radio",name:"theme",value:"light",defaultChecked:o==="light"}),e("span",{children:e(p,{id:"1njn7W"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"dark",defaultChecked:o==="dark"}),e("span",{children:e(p,{id:"pvnfJD"})})]}),e("label",{children:[e("input",{type:"radio",name:"theme",value:"auto",defaultChecked:o!=="light"&&o!=="dark"}),e("span",{children:e(p,{id:"R9Khdg"})})]})]})})})]}),e("li",{children:[e("div",{children:e("label",{children:e(p,{id:"7r6sCa"})})}),e("div",{class:"range-group",children:[e("span",{style:{fontSize:Ut[0]},children:e(p,{id:"J6ypuD"})})," ",e("input",{type:"range",min:Ut[0],max:Ut[Ut.length-1],step:"1",value:r,list:"sizes",onChange:b=>{const v=parseInt(b.target.value,10);document.documentElement.style.setProperty("--text-size",`${v}px`),v===ps?Ie.local.del("textSize"):Ie.local.set("textSize",b.target.value)}})," ",e("span",{style:{fontSize:Ut[Ut.length-1]},children:e(p,{id:"J6ypuD"})}),e("datalist",{id:"sizes",children:Ut.map(b=>e("option",{value:b}))})]})]}),e("li",{children:[e("span",{children:[e("label",{children:e(p,{id:"CeJHfb"})})," ",e("small",{children:e("a",{href:"https://crowdin.com/project/phanpy",target:"_blank",rel:"noopener",children:e(p,{id:"FFmj1D"})})})]}),e(Vi,{})]})]})}),m&&e(N,{children:[e("h3",{children:e(p,{id:"PcoS3v"})}),e("section",{children:e("ul",{children:[e("li",{children:[e("label",{for:"posting-privacy-field",children:[e(p,{id:"NAjVvt"})," ",e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})]}),e("select",{id:"posting-privacy-field",value:l["posting:default:visibility"]||"public",onChange:b=>{const{value:v}=b.target;(async()=>{try{await f.v1.accounts.updateCredentials({source:{privacy:v}});const _={...l,"posting:default:visibility":v};v==="private"&&(_["posting:default:quote_policy"]="nobody"),u(_),ns(_),he(i({id:"4uflEE"}))}catch{alert(i({id:"hFs2qq"}))}})()},children:[e("option",{value:"public",children:e(p,{id:"7d1a0d"})}),e("option",{value:"unlisted",children:e(p,{id:"pPYeIN"})}),e("option",{value:"private",children:e(p,{id:"x5LEuB"})})]})]}),Vt()&&e("li",{children:[e("label",{for:"posting-quote-policy-field",children:[e(p,{id:"eKInue"})," ",e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})]}),e("select",{id:"posting-quote-policy-field",value:k?"nobody":l["posting:default:quote_policy"]||"public",disabled:k,onChange:b=>{const{value:v}=b.target;(async()=>{try{await f.v1.accounts.updateCredentials({source:{quote_policy:v}});const _={...l,"posting:default:quote_policy":v};u(_),ns(_),he(i({id:"3P1r1z"}))}catch{alert(i({id:"hEe3YR"}))}})()},children:[e("option",{value:"public",disabled:k,children:e(p,{id:"hDWXuG"})}),e("option",{value:"followers",disabled:k,children:e(p,{id:"9Ko+Xp"})}),e("option",{value:"nobody",children:e(p,{id:"+bAQ3S"})})]})]})]})}),e("p",{class:"section-postnote",children:[e(I,{icon:"cloud",alt:i({id:"N2FcBE"}),class:"synced-icon"})," ",e("small",{children:e(p,{id:"xlsg7n",values:{instance:g},components:{0:e("a",{href:`https://${g}/`,target:"_blank",rel:"noopener"})}})})]})]}),e("h3",{children:e(p,{id:"ivdhsq"})}),e("section",{children:e("ul",{children:[e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:s.settings.autoRefresh,onChange:b=>{E.settings.autoRefresh=b.target.checked}})," ",e(p,{id:"0mC0SF"})]})}),e("li",{class:"block",children:e("label",{children:[e("input",{type:"checkbox",checked:s.settings.boostsCarousel,onChange:b=>{E.settings.boostsCarousel=b.target.checked}})," ",e(p,{id:"TSbnoW"})]})}),!!Yc&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.contentTranslation,onChange:b=>{const{checked:v}=b.target;E.settings.contentTranslation=v,v||(E.settings.contentTranslationTargetLanguage=null)}})," ",e(p,{id:"0SdaOt"})]}),e("div",{class:`sub-section ${s.settings.contentTranslation?"":"more-insignificant"}`,children:[e("div",{children:e("label",{children:[e(p,{id:"zXCa9e"})," ",e("select",{value:c||"",disabled:!s.settings.contentTranslation,style:{width:"10em"},onChange:b=>{E.settings.contentTranslationTargetLanguage=b.target.value||null},children:[e("option",{value:"",children:e(p,{id:"jNCSyx",values:{systemTargetLanguageText:d}})}),e("option",{disabled:!0,children:"──────────"}),gs.map(b=>{const v=Ot({code:b.code,fallback:b.name}),_=Ot({code:b.code,locale:b.code}),S=_&&v!==_;return e("option",{value:b.code,children:S?`${_} - ${v}`:v})})]})]})}),e("hr",{}),e("div",{class:"checkbox-fieldset",children:[e(p,{id:"cc0NrU",values:{0:s.settings.contentTranslationHideLanguages.length}}),e("div",{class:"checkbox-fields",children:gs.map(b=>{const v=Ot({code:b.code,fallback:b.name}),_=Ot({code:b.code,locale:b.code}),S=_&&v!==_;return e("label",{children:[e("input",{type:"checkbox",checked:s.settings.contentTranslationHideLanguages.includes(b.code),onChange:A=>{const{checked:C}=A.target;C?E.settings.contentTranslationHideLanguages.push(b.code):E.settings.contentTranslationHideLanguages=s.settings.contentTranslationHideLanguages.filter(x=>x!==b.code)}})," ",S?e("span",{children:[_," ",e("span",{class:"insignificant ib",children:["- ",v]})]}):v]})})})]}),e("p",{class:"insignificant",children:e("small",{children:e(p,{id:"7I3sDQ",values:{TRANSLATION_API_NAME:Wc},components:{0:e("a",{href:"https://github.com/cheeaun/translang-api",target:"_blank",rel:"noopener"})}})})}),e("hr",{}),e("div",{children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.contentTranslationAutoInline,disabled:!s.settings.contentTranslation,onChange:b=>{E.settings.contentTranslationAutoInline=b.target.checked}})," ",e(p,{id:"gURvmk"})]}),e("p",{class:"insignificant",children:e("small",{children:e(p,{id:"PbHARL",components:{0:e("b",{})}})})})]})]})]}),!!Gc&&m&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.composerGIFPicker,onChange:b=>{E.settings.composerGIFPicker=b.target.checked}})," ",e(p,{id:"D7/2jB"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(p,{id:"/CLBTL",components:{0:e("a",{href:"https://developers.giphy.com/",target:"_blank",rel:"noopener"})}})})})]}),!!Vc&&m&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.mediaAltGenerator,onChange:b=>{E.settings.mediaAltGenerator=b.target.checked}})," ",e(p,{id:"9q5uor"})," ",e(I,{icon:"sparkles2",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(p,{id:"faZ9RI"})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(p,{id:"fHZgvt",components:{0:e("a",{href:"https://github.com/cheeaun/img-alt-api",target:"_blank",rel:"noopener"})}})})})]}),m&&e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.shortcutSettingsCloudImportExport,onChange:b=>{E.settings.shortcutSettingsCloudImportExport=b.target.checked}})," ",e(p,{id:"570qTm"})," ",e(I,{icon:"cloud",class:"more-insignificant"})]}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(p,{id:"0tZAhT",components:{0:e("br",{})}})})}),e("div",{class:"sub-section insignificant",children:e("small",{children:e(p,{id:"fHf1v/"})})})]}),e("li",{class:"block",children:[e("label",{children:[e("input",{type:"checkbox",checked:s.settings.cloakMode,onChange:b=>{E.settings.cloakMode=b.target.checked}})," ",e(p,{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(p,{id:"T/hglb"})})})]}),m&&e("li",{children:e("button",{type:"button",class:"light",onClick:()=>{E.showDrafts=!0,E.showSettings=!1},children:e(p,{id:"krk5ws"})})})]})}),m&&e(Xc,{onClose:n}),e("h3",{children:e(p,{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:Yi,alt:"",width:"64",height:"64",style:{aspectRatio:"1/1",verticalAlign:"middle",background:"#b7cdf9",borderRadius:12}}),e("div",{children:[e("b",{children:"Phanpy"})," ",e("a",{href:"https://hachyderm.io/@phanpy",rel:"noopener",onClick:b=>{b.preventDefault(),E.showAccount="phanpy@hachyderm.io"},children:"@phanpy"}),e("br",{}),e(p,{id:"AZ2EoP",components:{0:e("a",{href:"https://github.com/cheeaun/phanpy",target:"_blank",rel:"noopener"}),1:e("a",{href:"https://mastodon.social/@cheeaun",rel:"noopener",onClick:b=>{b.preventDefault(),E.showAccount="cheeaun@mastodon.social"}})}})]})]}),e("p",{children:[e("a",{href:"https://github.com/sponsors/cheeaun",target:"_blank",rel:"noopener",children:e(p,{id:"O4cLCR"})})," ","·"," ",e("a",{href:"https://www.buymeacoffee.com/cheeaun",target:"_blank",rel:"noopener",children:e(p,{id:"Ng063n"})})," ","·"," ",e("a",{href:"https://patreon.com/cheeaun",target:"_blank",rel:"noopener",children:"Patreon"})," ","·"," ",e("a",{href:"https://github.com/cheeaun/phanpy/blob/main/CHANGELOG.md",target:"_blank",rel:"noopener",children:e(p,{id:"3ePd3I"})})," ","·"," ",e("a",{href:jc,target:"_blank",rel:"noopener",children:e(p,{id:"LcET2C"})})]}),e("p",{children:[ms&&e(N,{children:[e(p,{id:"pFnMHn",values:{0:ms.replace(/https?:\/\//g,"").replace(/\/$/,"")},components:{0:e("span",{class:"insignificant"})}}),e("br",{})]}),e(p,{id:"6KkH+2",values:{0:e("span",{class:"ib insignificant",children:["(",e("a",{href:"https://github.com/cheeaun/phanpy/commit/ac85274",target:"_blank",rel:"noopener",children:e(xt,{datetime:new Date("2025-11-26T11:55:22.227Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2025-11-26T11:54:40.000Z".slice(0,10).replace(/-/g,".")}.ac85274`,onClick:b=>{b.target.select();try{navigator.clipboard.writeText(b.target.value),he(i({id:"PiPfua"}))}catch{he(i({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function Xc({onClose:n}){const{_:i}=re();if(!ii())return null;const{instance:s}=ce(),[o,a]=R("default"),c=U(),[h,d]=R(!1),[r,l]=R(!1),u=U();V(()=>{(async()=>{a("loading");try{const{subscription:m,backendSubscription:g}=await Kc();if(g?.policy&&g.policy!=="none"){d(!0);const{alerts:y,policy:w}=g;u.current=w;const{elements:k}=c.current,b=k.namedItem("policy");b&&(b.value=w),Object.entries(y).forEach(([v,_])=>{const S=k.namedItem(v);S?.type==="checkbox"&&(S.checked=!!_)})}a("default")}catch(m){/outside.*authorized/i.test(m.message)?l(!0):alert(m?.message||m),a("error")}})()},[]);const f=o==="loading";return e("form",{ref:c,onChange:()=>{setTimeout(()=>{const m=Object.fromEntries(new FormData(c.current)),g=!!m["policy-allow"],y={data:{policy:m.policy,alerts:{mention:!!m.mention,favourite:!!m.favourite,reblog:!!m.reblog,follow:!!m.follow,follow_request:!!m.followRequest,poll:!!m.poll,update:!!m.update,status:!!m.status}}};let w=0;Object.keys(y.data.alerts).forEach(b=>{y.data.alerts[b]?w++:delete y.data.alerts[b]});const k=u.current!==y.data.policy;g&&w>0?k?fs().then(()=>{hs(y)}).catch(b=>{alert(i({id:"I6pdY3"}))}):hs(y).catch(b=>{alert(i({id:"I6pdY3"}))}):fs().catch(b=>{alert(i({id:"q1zFd+"}))})},100)},children:[e("h3",{children:e(p,{id:"WUHLnz"})}),e("section",{children:e("ul",{children:e("li",{children:[e("label",{children:[e("input",{type:"checkbox",disabled:f||r,name:"policy-allow",checked:h,onChange:async m=>{const{checked:g}=m.target;if(g){const y=await Notification.requestPermission();y==="granted"?d(!0):(d(!1),y==="denied"&&alert(i({id:"6LUsk7"})))}else d(!1)}})," ",e(p,{id:"qYNCa1",values:{0:[{value:"all",label:i({id:"+niKJH"})},{value:"followed",label:i({id:"x2NYtp"})},{value:"follower",label:i({id:"PBFNgg"})}].map(m=>e("option",{value:m.value,children:m.label}))},components:{0:e("select",{name:"policy",disabled:f||r||!h})}})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!h,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"sub-section",children:e("ul",{children:[{value:"mention",label:i({id:"/bZzdR"})},{value:"favourite",label:i({id:"zZOZj7"})},{value:"reblog",label:i({id:"puY2t0"})},{value:"follow",label:i({id:"aaJhcT"})},{value:"followRequest",label:i({id:"6Fs1Ba"})},{value:"poll",label:i({id:"wNExRS"})},{value:"update",label:i({id:"K/EtE6"})},{value:"status",label:i({id:"2yr1/p"})}].map(m=>e("li",{children:e("label",{children:[e("input",{type:"checkbox",name:m.value})," ",m.label]})}))})})})}),r&&e("div",{class:"sub-section",children:e("p",{children:e(p,{id:"8d0b8B",components:{0:e(ge,{to:`/login?instance=${s}`,onClick:n}),1:e("b",{})}})})})]})})}),e("p",{class:"section-postnote",children:e("small",{children:e(p,{id:"z96cOX",components:{0:e("b",{})}})})})]})}const wi=()=>{let n=setTimeout(()=>{const i=document.getElementById("columns");if(i){const s=i.querySelector(".deck-container.focus");if(s)s.focus();else{const o=Array.from(i.querySelectorAll(".deck-container")).find(a=>a.getBoundingClientRect().left>=0);o?o.focus():i.querySelector(".deck-container")?.focus?.()}}else{const s=document.querySelectorAll("#modal-container > *");if(s?.length){const h=s[s.length-1],d=h.querySelector('[tabindex="-1"]')||h;if(d){d.focus();return}}if(document.querySelector(".deck-backdrop"))return;const a=document.querySelectorAll(".deck-container"),c=a[a.length-1];c&&c.tabIndex===-1&&c.focus()}},100);return()=>clearTimeout(n)};function Ao(n){if(!n)return;const i=cn(),s=U(i.pathname);V(()=>{s.current&&i.pathname!==s.current&&n?.()},[i.pathname,n])}function Qc({acct:n,instance:i}){let[s,o]=n.split("@");o||(o=i);const a=Zn.toASCII(n);return e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",title:a,children:[e("b",{class:"handle-username",children:s}),e("span",{class:"handle-at",children:"@"}),e("b",{class:"handle-server",children:o})]}),e("div",{class:"handle-legend",children:[e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon username"})," ",e(p,{id:"silO9A"})]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," ",e(p,{id:"rZgCpJ"})]})]})]})}const Jc=["image/jpeg","image/png","image/gif","image/webp"],ys=Jc.join(",");function er({name:n,value:i,disabled:s,index:o}){const[a,c]=R(!!i);return e("tr",{children:[e("td",{children:e("input",{type:"text",name:`fields_attributes[${o}][name]`,defaultValue:n,disabled:s,maxLength:255,required:a,dir:"auto",enterKeyHint:"done"})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${o}][value]`,defaultValue:i,disabled:s,maxLength:255,onChange:h=>c(!!h.currentTarget.value),dir:"auto",enterKeyHint:"done"})})]})}function tr({onClose:n=()=>{}}){const{_:i}=re(),{masto:s}=ce(),[o,a]=R("loading"),[c,h]=R(null),[d,r]=R(null),[l,u]=R(null);V(()=>{(async()=>{try{const S=await s.v1.accounts.verifyCredentials();h(S),a("default")}catch{a("error")}})()},[]);const{displayName:f,source:m,avatar:g,header:y}=c||{},{note:w,fields:k}=m||{},b=U(null),v=[...g?[{type:"image",url:g}]:[],...l?[{type:"image",url:l}]:[]],_=[...y?[{type:"image",url:y}]:[],...d?[{type:"image",url:d}]:[]];return e("div",{class:"sheet",id:"edit-profile-container",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(p,{id:"9OpVZg"})})}),e("main",{children:o==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):e("form",{onSubmit:S=>{S.preventDefault();const A=new FormData(S.target),C=A.get("header"),x=A.get("avatar"),M=A.get("display_name"),$=A.get("note"),q=b.current.querySelectorAll('input[name^="fields_attributes"]'),D=[];q.forEach(F=>{const Q=F.name,[te,Y,G]=Q.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],K=F.value?F.value.trim():"";Y&&G&&K&&(D[Y]||(D[Y]={}),D[Y][G]=K)}),D.forEach(F=>{F.name&&!F.value&&(F.value="")}),(async()=>{try{const F=await s.v1.accounts.updateCredentials({header:C,avatar:x,displayName:M,note:$,fieldsAttributes:D});n?.({state:"success",account:F})}catch(F){alert(F?.message||i({id:"FwMMx0"}))}})()},children:[e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(p,{id:"C5zXYJ"})," ",e("input",{type:"file",name:"header",accept:ys,onChange:S=>{const A=S.target.files[0];if(A){const C=URL.createObjectURL(A);r(C)}}})]}),e("div",{class:"edit-profile-media-field",children:[y?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:_,mediaIndex:0}},children:e("img",{src:y,alt:""})}):e("div",{class:"edit-media"}),d&&e(N,{children:[e(I,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:_,mediaIndex:1}},children:e("img",{src:d,alt:""})})]})]})]}),e("div",{class:"edit-profile-media-container",children:[e("label",{children:[e(p,{id:"4XF0BB"})," ",e("input",{type:"file",name:"avatar",accept:ys,onChange:S=>{const A=S.target.files[0];if(A){const C=URL.createObjectURL(A);u(C)}}})]}),e("div",{class:"edit-profile-media-field",children:[g?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:v,mediaIndex:0}},children:e("img",{src:g,alt:""})}):e("div",{class:"edit-media"}),l&&e(N,{children:[e(I,{icon:"arrow-right"}),e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:v,mediaIndex:1}},children:e("img",{src:l,alt:""})})]})]})]}),e("p",{children:e("label",{children:[e(p,{id:"6YtxFj"})," ",e("input",{type:"text",name:"display_name",defaultValue:f,maxLength:30,disabled:o==="loading",dir:"auto",enterKeyHint:"done"})]})}),e("p",{children:e("label",{children:[e(p,{id:"E+oKCO"}),e("textarea",{defaultValue:w,name:"note",maxLength:500,rows:"5",disabled:o==="loading",dir:"auto"})]})}),e("p",{children:e(p,{id:"T4I119"})}),e("table",{ref:b,children:[e("thead",{children:e("tr",{children:[e("th",{children:e(p,{id:"87a/t/"})}),e("th",{children:e(p,{id:"4b3oEV"})})]})}),e("tbody",{children:Array.from({length:Math.max(4,k.length)}).map((S,A)=>{const{name:C="",value:x=""}=k[A]||{};return e(er,{name:C,value:x,index:A,disabled:o==="loading"},A)})})]}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:o==="loading",onClick:()=>{n?.()},children:e(p,{id:"dEgA5A"})}),e("button",{type:"submit",disabled:o==="loading",children:e(p,{id:"tfDRzk"})})]})]})})]})}const nr=80;function ir({accountID:n,info:i,open:s=!1,onlyOpenIfHasEndorsements:o=!1}){const{masto:a}=ce(),c=U(),[h,d]=R("default"),[r,l]=R([]),[u,f]=R({});return V(()=>{Qe("@mastodon/endorsements")&&s&&(async()=>{d("loading");try{const g=await a.v1.accounts.$select(n).endorsements.list({limit:nr});if(!g.length){d("default");return}l(g),d("default"),setTimeout(()=>{c.current.scrollIntoView({behavior:"smooth",block:"nearest"})},300);const y=await Qn(g,u);y&&f(y)}catch{d("error")}})()},[s,n]),(o?s&&r.length>0:s)?e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"endorsements-container",ref:c,children:[e("h3",{children:e(p,{id:"UIfdY1",values:{0:i.username}})}),h==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):r.length>0?e("ul",{class:`endorsements ${r.length>10?"expanded":""}`,children:r.map(g=>e("li",{children:e(yt,{account:g,showStats:!0,avatarSize:"xxl",relationship:u[g.id]},g.id)}))}):e("p",{class:"ui-state insignificant",children:e(p,{id:"AgkUZa"})})]})})}):null}const xo=1e3*60,sr=1440*60*1e3,ki=Ct(async()=>{const{masto:n}=ce(),i=await n.v1.lists.list();return i.sort((s,o)=>s.title.localeCompare(o.title)),i.length&&setTimeout(()=>{Ie.account.set("lists",{lists:i,updatedAt:Date.now()})},1),i},{maxAge:xo});async function kn(){try{const{lists:n,updatedAt:i}=Ie.account.get("lists")||{};return n?.length?(Date.now()-i>sr&&ki(),n):await ki()}catch{return[]}}const or=Ct(n=>{const{masto:i}=ce();return i.v1.lists.$select(n).fetch()},{maxAge:xo});async function To(n){const{lists:i}=Ie.account.get("lists")||{};if(i?.length){const s=i.find(o=>o.id===n);if(s)return s}try{return or(n)}catch{return null}}async function ar(n){return(await To(n))?.title||""}function cr(n){const{lists:i}=Ie.account.get("lists")||{};i?.length&&(i.push(n),i.sort((s,o)=>s.title.localeCompare(o.title)),Ie.account.set("lists",{lists:i,updatedAt:Date.now()}))}function rr(n){const{lists:i}=Ie.account.get("lists")||{};if(i?.length){const s=i.findIndex(o=>o.id===n.id);s!==-1&&(i[s]=n,i.sort((o,a)=>o.title.localeCompare(a.title)),Ie.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function lr(n){const{lists:i}=Ie.account.get("lists")||{};if(i?.length){const s=i.findIndex(o=>o.id===n);s!==-1&&(i.splice(s,1),Ie.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function Zt({insignificant:n}){const{_:i}=re();return e(I,{icon:"filter",size:"xs",class:`list-exclusive-badge ${n?"insignificant":""}`,title:i({id:"FNptcJ"})})}function Wi({list:n,onClose:i}){const{_:s}=re(),{masto:o}=ce(),[a,c]=R("default"),h=!!n,d=U(),r=U(),l=U();V(()=>{h&&(d.current.value=n.title,r.current.value=n.repliesPolicy,l.current&&(l.current.checked=n.exclusive))},[h]);const u=Qe("@mastodon/list-exclusive")||Qe("@gotosocial/list-exclusive");return e("div",{class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})})," ",e("header",{children:e("h2",{children:s(h?{id:"tuhghE"}:{id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:f=>{f.preventDefault();const m=new FormData(f.target),g=m.get("title"),y=m.get("replies_policy"),w=m.get("exclusive")==="on";c("loading"),(async()=>{try{let k;h?k=await o.v1.lists.$select(n.id).update({title:g,replies_policy:y,exclusive:w}):k=await o.v1.lists.create({title:g,replies_policy:y,exclusive:w}),c("default"),i?.({state:"success",list:k}),setTimeout(()=>{h?rr(k):cr(k)},1)}catch{c("error"),alert(s(h?{id:"R7ep1i"}:{id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(p,{id:"6YtxFj"})," ",e("input",{ref:d,type:"text",id:"list-title",name:"title",required:!0,disabled:a==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:r,name:"replies_policy",required:!0,disabled:a==="loading",children:[e("option",{value:"list",children:e(p,{id:"ei6pnR"})}),e("option",{value:"followed",children:e(p,{id:"Mr53YX"})}),e("option",{value:"none",children:e(p,{id:"PM7llw"})})]})}),u&&e("div",{class:"list-form-row",children:e("label",{class:"label-block",children:[e("input",{ref:l,type:"checkbox",name:"exclusive",disabled:a==="loading"})," ",e(Zt,{insignificant:!0})," ",e(p,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:a==="loading",children:s(h?{id:"tfDRzk"}:{id:"hYgDIe"})}),h&&e(bt,{disabled:a==="loading",align:"end",menuItemClassName:"danger",confirmLabel:s({id:"+kQ/cY"}),onClick:()=>{c("loading"),(async()=>{try{await o.v1.lists.$select(n.id).remove(),c("default"),i?.({state:"deleted"}),setTimeout(()=>{lr(n.id)},1)}catch{c("error"),alert(s({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:a==="loading",children:e(p,{id:"Jb6/SB"})})})]})]})})]})}function dr({accountID:n,onClose:i}){const{_:s}=re(),{masto:o}=ce(),[a,c]=R("default"),[h,d]=R([]),[r,l]=R([]),[u,f]=$t(y=>y+1,0);V(()=>{c("loading"),(async()=>{try{const y=await kn();d(y);const w=await o.v1.accounts.$select(n).lists.list();l(w),c("default")}catch{c("error")}})()},[u]);const[m,g]=R(!1);return e("div",{class:"sheet",id:"list-add-remove-container",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(p,{id:"sJ2yQc"})})}),e("main",{children:[h.length>0?e("ul",{class:"list-add-remove",children:h.map(y=>{const w=r.some(k=>k.id===y.id);return e("li",{children:e("button",{type:"button",class:`light ${w?"checked":""}`,disabled:a==="loading",onClick:()=>{c("loading"),(async()=>{try{w?await o.v1.lists.$select(y.id).accounts.remove({accountIds:[n]}):await o.v1.lists.$select(y.id).accounts.create({accountIds:[n]}),f()}catch{c("error"),alert(s(w?{id:"7KnEYa"}:{id:"Tba8uO"}))}})()},children:[e(I,{icon:"check-circle",alt:"☑️"}),e("span",{children:y.title})]})})})}):a==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):a==="error"?e("p",{class:"ui-state",children:e(p,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(p,{id:"/MJ7gZ"})}),e("button",{type:"button",class:"plain2",onClick:()=>g(!0),disabled:a!=="default",children:[e(I,{icon:"plus",size:"l"})," ",e("span",{children:e(p,{id:"Sb2gYF"})})]})]}),m&&e(qe,{onClick:y=>{y.target===y.currentTarget&&g(!1)},children:e(Wi,{list:m?.list,onClose:y=>{y.state==="success"&&f(),g(!1)}})})]})}function ur({account:n,note:i,onRelationshipChange:s=()=>{},onClose:o=()=>{}}){const{_:a}=re(),{masto:c}=ce(),[h,d]=R("default"),r=U(null);return V(()=>{let l;return r.current&&!i&&(l=setTimeout(()=>{r.current.focus?.()},100)),()=>{clearTimeout(l)}},[]),e("div",{class:"sheet",id:"private-note-container",children:[!!o&&e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:a({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(p,{id:"DYqYm5",values:{0:n?.username||n?.acct},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:e("form",{onSubmit:l=>{l.preventDefault();const f=new FormData(l.target).get("note");f?.trim()!==i?.trim()&&(d("loading"),(async()=>{try{const m=await c.v1.accounts.$select(n?.id).note.create({comment:f});d("default"),s(m),o()}catch(m){d("error"),alert(m?.message||a({id:"ot8LpF"}))}})())},children:[e("textarea",{ref:r,name:"note",disabled:h==="loading",dir:"auto",children:i}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:h==="loading",onClick:()=>{o?.()},children:e(p,{id:"dEgA5A"})}),e("span",{children:[e(De,{abrupt:!0,hidden:h!=="loading"}),e("button",{disabled:h==="loading",type:"submit",children:e(p,{id:"SrwrEj"})})]})]})]})})]})}function hr({note:n,fields:i,onClose:s}){const{_:o}=re(),a=i?.map(({name:h,value:d})=>`${h}
${os(d)}`).join(`
`)||"",c=os(n)+(a?`
${a}`:"");return e("div",{class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(p,{id:"9groMz"})})}),e("main",{children:[e("p",{style:{whiteSpace:"pre-wrap"},children:c}),e(lo,{forceTranslate:!0,text:c})]})]})}const fr=[300,1800,3600,3600*6,3600*24,3600*24*3,3600*24*7,3600*24*30,0],Jt={0:{id:"9ZP9cc"},300:ot(5,"minute"),1800:ot(30,"minute"),3600:ot(1,"hour"),21600:ot(6,"hour"),86400:ot(1,"day"),259200:ot(3,"day"),604800:ot(1,"week"),2592e3:ot(30,"day")};function pr({info:n,instance:i,standalone:s,authenticated:o,onRelationshipChange:a=()=>{},setShowEditProfile:c=()=>{},showEndorsements:h=!1,renderEndorsements:d=!1,setRenderEndorsements:r=()=>{}}){if(!n)return null;const{_:l,_:u}=re(),{masto:f,instance:m,authenticated:g}=ce(),y=i===m,[w,k]=R("default"),[b,v]=R(null),{id:_,acct:S,url:A,username:C,locked:x,lastStatusAt:M,note:$,fields:q,moved:D}=n,F=U(_),{following:Q,showingReblogs:te,notifying:Y,followedBy:G,blocking:K,blockedBy:j,muting:L,mutingNotifications:Z,requested:H,domainBlocking:W,endorsed:de,note:se}=b||{},[X,we]=R(null),[ke,Se]=R(!1),Oe=S.includes("@")?S:`${S}@${i}`,xe=Qe("@mastodon/endorsements");V(()=>{if(n){const ee=kt();let Ae;(async()=>{if(y&&o)Ae=_;else if(!y&&g){const be=n.acct.includes("@");try{const Pe=await f.v2.search.list({q:be?n.acct:`${n.username}@${i}`,type:"accounts",limit:1,resolve:!0});Pe.accounts.length&&(Ae=Pe.accounts[0].id,we(Pe.accounts[0]))}catch{}}if(!Ae)return;if(ee===Ae){Se(!0);return}F.current=Ae,k("loading");const O=f.v1.accounts.relationships.fetch({id:[Ae]});try{const be=await O;if(k("default"),be.length){const Pe=be[0];v(Pe),a({relationship:Pe,currentID:Ae})}}catch{k("error")}})()}},[n,o]),V(()=>{n&&ke&&ga(n)},[n,ke]);const Le=w==="loading",[Re,ze]=R(!1),[Ue,Ke]=R(!1),[Ve,le]=R(!1),[$e,Te]=R([]);let{headerStatic:ae,avatarStatic:Ne}=n;return(!ae||/missing\.png$/.test(ae))&&Ne&&!/missing\.png$/.test(Ne)&&(ae=Ne),e(N,{children:[e("div",{class:"actions",children:[e("span",{children:[G?e("span",{class:"tag",children:e(p,{id:"p3UO/y"})}):M?e("small",{class:"insignificant",children:e(p,{id:"F3cM1G",values:{0:at(M,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),L&&e("span",{class:"tag danger",children:e(p,{id:"+IJm1Z"})}),K&&e("span",{class:"tag danger",children:e(p,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!se&&e("button",{type:"button",class:"private-note-tag",title:u({id:"zxFxcH"}),onClick:()=>{le(!0)},dir:"auto",children:e("span",{children:se})}),g&&ke&&e("button",{type:"button",class:"plain",onClick:()=>{E.showQrCodeModal={text:A,arena:Ne,backgroundMask:ae,caption:S.includes("@")?S:`${S}@${i}`,onScannerClick:Si}},children:e(I,{icon:"qrcode",alt:u({id:"gCX4Z9"})})}),e(ft,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",class:"plain4",disabled:Le,children:e(I,{icon:"more2",size:"l",alt:u({id:"2FYpfJ"})})}),onMenuChange:ee=>{Q&&ee.open&&(async()=>{try{const Ae=await f.v1.accounts.$select(F.current).lists.list();Te(Ae)}catch{}})()},children:[g&&!ke?e(N,{children:[e(ve,{onClick:()=>{ao({draftStatus:{status:`@${X?.acct||S} `}})},children:[e(I,{icon:"at"}),e("span",{children:e(p,{id:"3LkfZu",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(ve,{onClick:()=>{ze(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(p,{id:"R8mSiS"})})]}),Qe("@mastodon/profile-private-note")&&e(ve,{onClick:()=>{le(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:u(se?{id:"U+Gokq"}:{id:"VcQzRi"})})]}),Q&&!!b&&e(N,{children:[e(ve,{onClick:()=>{k("loading"),(async()=>{try{const ee=await f.v1.accounts.$select(F.current).follow({notify:!Y});ee&&v(ee),k("default"),he(ee.notifying?u({id:"jL3N0G",values:{username:C}}):u({id:"0h4/9h",values:{username:C}}))}catch(ee){alert(ee),k("error")}})()},children:[e(I,{icon:"notification"}),e("span",{children:u(Y?{id:"osJmEN"}:{id:"I92Z+b"})})]}),e(ve,{onClick:()=>{k("loading"),(async()=>{try{const ee=await f.v1.accounts.$select(F.current).follow({reblogs:!te});ee&&v(ee),k("default"),he(ee.showingReblogs?u({id:"0X2KC8",values:{username:C}}):u({id:"cXWjH0",values:{username:C}}))}catch(ee){alert(ee),k("error")}})()},children:[e(I,{icon:"rocket"}),e("span",{children:u(te?{id:"GRUr8d"}:{id:"uREpT3"})})]})]}),xe&&Q&&e(ve,{onClick:()=>{k("loading"),(async()=>{try{if(de){const ee=await f.v1.accounts.$select(X?.id||_).unpin();v(ee),k("default"),he(u({id:"pWFLFk",values:{username:C}}))}else{const ee=await f.v1.accounts.$select(X?.id||_).pin();v(ee),k("default"),he(u({id:"xhiXaF",values:{username:C}}))}}catch{k("error"),de?he(u({id:"xHq5L2",values:{username:C}})):he(u({id:"Owr/5+",values:{username:C}}))}})()},children:[e(I,{icon:"endorsement"}),u(de?{id:"S9JvjK"}:{id:"UlJ3QN"})]}),h&&xe&&!d&&e(ve,{onClick:()=>r(!0),children:[e(I,{icon:"endorsement"}),e("span",{children:e(p,{id:"Qopbnd"})})]}),Q&&e(ve,{onClick:()=>{Ke(!0)},children:[e(I,{icon:"list"}),$e.length?e(N,{children:[e("small",{class:"menu-grow",children:[e(p,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:$e.map(ee=>ee.title).join(", ")})]}),e("small",{class:"more-insignificant",children:$e.length})]}):e("span",{children:e(p,{id:"sJ2yQc"})})]}),e(je,{})]}):xe&&!d&&e(N,{children:[e(ve,{onClick:()=>r(!0),children:[e(I,{icon:"endorsement"}),e(p,{id:"Qopbnd"})]}),e(je,{})]}),e(ve,{onClick:()=>{const ee=`@${X?.acct||Oe}`;try{navigator.clipboard.writeText(ee),he(u({id:"zJoEwS"}))}catch{he(u({id:"BC0lSD"}))}},children:[e(I,{icon:"copy"}),e("small",{children:[e(p,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",X?.acct||Oe]})]})]}),e(ve,{href:A,target:"_blank",children:[e(I,{icon:"external"}),e("small",{class:"menu-double-lines",children:mr(A)})]}),e("div",{class:"menu-horizontal",children:[e(ve,{onClick:()=>{try{navigator.clipboard.writeText(A),he(u({id:"edWbV6"}))}catch{he(u({id:"W1ewR0"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(p,{id:"he3ygx"})})]}),navigator?.share&&navigator?.canShare?.({url:A})&&e(ve,{onClick:()=>{try{navigator.share({url:A})}catch{alert(u({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"}),e("span",{children:e(p,{id:"LFKLqp"})})]})]}),e(ve,{onClick:()=>{E.showQrCodeModal={text:A,arena:Ne,backgroundMask:ae,caption:S.includes("@")?S:`${S}@${i}`,onScannerClick:Si}},children:[e(I,{icon:"qrcode"}),e("span",{children:e(p,{id:"gCX4Z9"})})]}),!!b&&e(N,{children:[e(je,{}),L?e(ve,{onClick:()=>{k("loading"),(async()=>{try{const ee=await f.v1.accounts.$select(X?.id||_).unmute();v(ee),k("default"),he(u({id:"B4Xkly",values:{username:C}})),E.reloadGenericAccounts.id="mute",E.reloadGenericAccounts.counter++}catch{k("error")}})()},children:[e(I,{icon:"unmute"}),e("span",{children:e(p,{id:"Q/HUhC",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(wn,{menuClassName:"menu-blur",openTrigger:"clickOnly",direction:"bottom",overflow:"auto",shift:16,label:e(N,{children:[e(I,{icon:"mute"}),e("span",{class:"menu-grow",children:e(p,{id:"xhPEH3",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})}),e("span",{style:{textOverflow:"clip"},children:[e(I,{icon:"time"}),e(I,{icon:"chevron-right"})]})]}),children:e("div",{class:"menu-wrap",children:fr.map(ee=>e(ve,{onClick:()=>{k("loading"),(async()=>{try{const Ae=await f.v1.accounts.$select(X?.id||_).mute({duration:ee});v(Ae),k("default"),he(u({id:"/plB9m",values:{0:typeof Jt[ee]=="function"?Jt[ee]():l(Jt[ee]),username:C}})),E.reloadGenericAccounts.id="mute",E.reloadGenericAccounts.counter++}catch{k("error"),he(u({id:"vWGBjT",values:{username:C}}))}})()},children:typeof Jt[ee]=="function"?Jt[ee]():l(Jt[ee])}))})}),G&&e(bt,{subMenu:!0,menuItemClassName:"danger",confirmLabel:e(N,{children:[e(I,{icon:"user-x"}),e("span",{children:e(p,{id:"unyq2W",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),onClick:()=>{k("loading"),(async()=>{try{const ee=await f.v1.accounts.$select(X?.id||_).removeFromFollowers();v(ee),k("default"),he(u({id:"AgkcM/",values:{username:C}})),E.reloadGenericAccounts.id="followers",E.reloadGenericAccounts.counter++}catch{k("error")}})()},children:[e(I,{icon:"user-x"}),e("span",{children:e(p,{id:"VCZ0OT"})})]}),e(bt,{subMenu:!0,confirm:!K,confirmLabel:e(N,{children:[e(I,{icon:"block"}),e("span",{children:e(p,{id:"aforS9",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),itemProps:{className:"danger"},menuItemClassName:"danger",onClick:()=>{k("loading"),(async()=>{try{if(K){const ee=await f.v1.accounts.$select(X?.id||_).unblock();v(ee),k("default"),he(u({id:"sI9N29",values:{username:C}}))}else{const ee=await f.v1.accounts.$select(X?.id||_).block();v(ee),k("default"),he(u({id:"uYcYzu",values:{username:C}}))}E.reloadGenericAccounts.id="block",E.reloadGenericAccounts.counter++}catch{k("error"),K?he(u({id:"0tG4wG",values:{username:C}})):he(u({id:"pA+qEx",values:{username:C}}))}})()},children:K?e(N,{children:[e(I,{icon:"unblock"}),e("span",{children:e(p,{id:"/3LJfX",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}):e(N,{children:[e(I,{icon:"block"}),e("span",{children:e(p,{id:"JRswkR",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]})}),e(ve,{className:"danger",onClick:()=>{E.showReportModal={account:X||n}},children:[e(I,{icon:"flag"}),e("span",{children:e(p,{id:"qTJgpR",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),g&&ke&&s&&Qe("@mastodon/profile-edit")&&e(N,{children:[e(je,{}),e(ve,{onClick:()=>{c(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(p,{id:"9OpVZg"})})]})]}),!1]}),!b&&w==="loading"&&e(De,{abrupt:!0}),!!b&&!D&&e(bt,{confirm:Q||H,confirmLabel:e("span",{children:u(H?{id:"e7qQIH"}:{id:"eYsAQr",values:{0:n.acct||n.username}})}),menuItemClassName:"danger",align:"end",disabled:Le,onClick:()=>{k("loading"),(async()=>{try{let ee;Q||H?ee=await f.v1.accounts.$select(F.current).unfollow():ee=await f.v1.accounts.$select(F.current).follow(),ee&&(v(ee),h&&xe&&!d&&ee.following&&r("onlyOpenIfHasEndorsements")),k("default")}catch(ee){alert(ee),k("error")}})()},children:e("button",{type:"button",class:`${Q||H?"light swap":""}`,"data-swap-state":Q||H?"danger":"",disabled:Le,children:Q?e(N,{children:[e("span",{children:e(p,{id:"y6sq5j"})}),e("span",{children:e(p,{id:"HKrBPX"})})]}):H?e(N,{children:[e("span",{children:e(p,{id:"Yx0Ud8"})}),e("span",{children:e(p,{id:"yTVtKs"})})]}):x?e(N,{children:[e(I,{icon:"lock"})," ",e("span",{children:e(p,{id:"MKEPCY"})})]}):u({id:"MKEPCY"})})})]})]}),!!Re&&e(qe,{onClose:()=>{ze(!1)},children:e(hr,{note:$,fields:q,onClose:()=>ze(!1)})}),!!Ue&&e(qe,{onClose:()=>{Ke(!1)},children:e(dr,{accountID:F.current,onClose:()=>Ke(!1)})}),!!Ve&&e(qe,{onClose:()=>{le(!1)},children:e(ur,{account:n,note:se,onRelationshipChange:ee=>{v(ee)},onClose:()=>le(!1)})})]})}function mr(n){if(!n)return;const i=URL.parse(n);if(!i)return;const{host:s,pathname:o}=i,a=o.replace(/\/$/,"").replace(/^\//,"");return e(N,{children:[e("span",{class:"more-insignificant",children:[Zn.toUnicode(s),"/"]}),e("wbr",{}),e("span",{children:a})]})}const vs=80,Eo=1e3*60*10;function gr(n,i){return i.v1.accounts.familiarFollowers.fetch({id:[n]})}const yr=Ct(gr,{maxAge:Eo});async function vr(n,i){const s=i.v1.accounts.$select(n).statuses.list({limit:20}).values().next(),{value:o}=await s,a={total:o.length,originals:0,replies:0,boosts:0,quotes:0};return o.forEach(c=>{c.reblog?a.boosts++:c.inReplyToId&&c.inReplyToAccountId!==c.account.id?a.replies++:Vt()&&(c.quote?.id||c.quote?.quotedStatus?.id)?a.quotes++:a.originals++}),o.length&&(a.daysSinceLastPost=Math.ceil((Date.now()-Date.parse(o[o.length-1].createdAt))/864e5)),a}const br=Ct(vr,{maxAge:Eo}),wr=n=>{try{return new URL(n),!0}catch{return!1}},Si=()=>{E.showQrScannerModal={checkValidity:wr,actionableText:{id:"73lp8c"},onClose:({text:n}={})=>{n&&(ya(),location.hash=`/${n}`)}}};function Ro({account:n,fetchAccount:i=()=>{},standalone:s,instance:o,authenticated:a,showEndorsements:c=!1}){const{i18n:h,_:d}=re(),{masto:r,authenticated:l}=ce({instance:o}),{masto:u,instance:f}=ce(),[m,g]=R("default"),y=typeof n=="string",[w,k]=R(y?null:n),b=_e(()=>o===f,[o,f]);V(()=>{if(!y){k(n);return}g("loading"),(async()=>{try{const z=await i();E.accounts[`${z.id}@${o}`]=z,k(z),g("default")}catch{k(null),g("error")}})()},[y,n,i]);const{acct:v,avatar:_,avatarStatic:S,bot:A,createdAt:C,displayName:x,emojis:M,fields:$,followersCount:q,followingCount:D,group:F,id:Q,lastStatusAt:te,locked:Y,note:G,statusesCount:K,url:j,username:L,memorial:Z,moved:H,roles:W,hideCollections:de}=w||{};let se=!1,{header:X,headerStatic:we}=w||{};(!X||/missing\.png$/.test(X))&&_&&!/missing\.png$/.test(_)&&(X=_,se=!0,S&&!/missing\.png$/.test(S)&&(we=S));const ke=_e(()=>Q===kt(),[Q]);V(()=>{const z=!!(w?.id&&w?.username&&w?.acct&&w?.avatar&&w?.avatarStatic&&w?.displayName&&w?.url);if(ke&&o&&z){const fe=nn();let Ee=!1;fe.forEach(ye=>{ye.info.id===w.id&&ye.instanceURL===o&&(ye.info=w,Ee=!0)}),Ee&&Ht(fe)}},[ke,w,o]);const Se=Ri(j),[Oe,xe]=R([]),Le=U(),Re=U([]);async function ze(z){(z||!Le.current)&&(Le.current=r.v1.accounts.$select(Q).followers.list({limit:vs}).values());const fe=await Le.current.next();if(ke||!b)return fe;const{value:Ee}=fe;let ye=[];if(z){let ne=[];try{ne=await r.v1.accounts.familiarFollowers.fetch({id:[Q]})}catch{}Re.current=ne?.[0]?.accounts||[],ye=[...Re.current,...Ee.filter(ie=>!Re.current.some(Ce=>Ce.id===ie.id))]}else Ee?.length&&(ye=Ee.filter(ne=>!Re.current.some(ie=>ie.id===ne.id)));return{...fe,value:ye}}const Ue=U();async function Ke(z){return(z||!Ue.current)&&(Ue.current=r.v1.accounts.$select(Q).following.list({limit:vs}).values()),await Ue.current.next()}const Ve=s?"div":ge,le=o?`/${o}/a/${Q}`:`/a/${Q}`,[$e,Te]=R([]),[ae,Ne]=R(),[ee,Ae]=R("default"),O=!!ae?.total,be=async z=>{try{const fe=await yr(z,u);Te(fe[0].accounts.slice(0,kr))}catch{}},Pe=async()=>{if(Q){Ae("loading");try{const z=await br(Q,r);Ne(z),Ae("default")}catch{Ae("error")}}},Be=it(({relationship:z,currentID:fe})=>{z.following||(be(fe),!s&&K>0&&Pe())},[s,Q,K]),P=it(z=>{z.id===Q&&(k(z),E.accounts[`${z.id}@${o}`]=z)},[Q,o]),ue=y&&n&&/^https?:\/\//.test(n),[T,B]=R(!1),[J,oe]=R(!1);return e(N,{children:[e("div",{tabIndex:"-1",class:`account-container ${m==="loading"?"skeleton":""}`,style:{"--header-color-1":Oe[0],"--header-color-2":Oe[1],"--header-color-3":Oe[2],"--header-color-4":Oe[3]},children:[m==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(p,{id:"44hICK"})}),y?e("p",{children:ue?e("a",{href:n,target:"_blank",rel:"noopener",children:n}):e("code",{class:"insignificant",children:n})}):e("p",{children:e("a",{href:j,target:"_blank",rel:"noopener",children:[e(p,{id:"Aadw0+"})," ",e(I,{icon:"external"})]})})]}),m==="loading"?e(N,{children:[e("header",{children:e(yt,{avatarSize:"xxxl",skeleton:!0})}),e("main",{children:[e("div",{class:"note",children:[e("p",{children:"███████ ████ ████"}),e("p",{children:"████ ████████ ██████ █████████ ████ ██"})]}),e("div",{class:"account-metadata-box",children:[e("div",{class:"profile-metadata",children:[e("div",{class:"profile-field",children:[e("b",{class:"more-insignificant",children:"███"}),e("p",{children:"██████"})]}),e("div",{class:"profile-field",children:[e("b",{class:"more-insignificant",children:"████"}),e("p",{children:"███████████"})]})]}),e("div",{class:"stats",children:[e("div",{children:[e("span",{children:"██"})," ██████"]}),e("div",{children:[e("span",{children:"██"})," ██████"]}),e("div",{children:[e("span",{children:"██"})," █████"]})]})]}),e("div",{class:"actions",children:[e("span",{}),e("span",{class:"buttons",children:e("button",{type:"button",class:"plain4",disabled:!0,children:e(I,{icon:"more2",size:"l"})})})]})]})]}):w&&e(N,{children:[!!H&&e("div",{class:"account-moved",children:[e("p",{children:e(p,{id:"C6cVP/",values:{displayName:x},components:{0:e("b",{})}})}),e(yt,{account:H,instance:o,onClick:z=>{z.stopPropagation(),E.showAccount=H}})]}),!!X&&!/missing\.png$/.test(X)&&e("img",{src:X,alt:"",class:`header-banner ${se?"header-is-avatar":""}`,onError:z=>{z.target.crossOrigin?z.target.src!==we?z.target.src=we:(z.target.removeAttribute("crossorigin"),z.target.src=X):z.target.src!==we?z.target.src=we:z.target.remove()},crossOrigin:"anonymous",onLoad:z=>{z.target.classList.add("loaded");try{const fe=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),Ee=fe.getContext("2d",{willReadFrequently:!0});fe.width=z.target.width,fe.height=z.target.height,Ee.imageSmoothingEnabled=!1,Ee.drawImage(z.target,0,0);const ye=10,ie=[Ee.getImageData(0,0,ye,ye).data,Ee.getImageData(z.target.width-ye,0,ye,ye).data,Ee.getImageData(0,z.target.height-ye,ye,ye).data,Ee.getImageData(z.target.width-ye,z.target.height-ye,ye,ye).data].map(Ce=>{let Me=0,Ge=0,rt=0,tt=0;for(let Pt=0;Pt<Ce.length;Pt+=4)Me+=Ce[Pt],Ge+=Ce[Pt+1],rt+=Ce[Pt+2],tt+=Ce[Pt+3];const It=Ce.length/4;return[Me/It,Ge/It,rt/It,tt/It]}).map(Ce=>{const[Me,Ge,rt,tt]=Sr(Ce);return`rgba(${Me}, ${Ge}, ${rt}, ${tt})`});xe(ie)}catch{}}}),e("header",{children:s?e(ft,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(yt,{account:w,instance:o,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(Qc,{acct:v,instance:o})}),e(ve,{onClick:()=>{const z=v.includes("@")?`@${v}`:`@${v}@${o}`;try{navigator.clipboard.writeText(z),he(d({id:"zJoEwS"}))}catch{he(d({id:"BC0lSD"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(p,{id:"27x6gl"})})]}),e(ve,{onClick:()=>{E.showQrCodeModal={text:j,arena:S,backgroundMask:we,caption:v.includes("@")?v:`${v}@${o}`,onScannerClick:Si}},children:[e(I,{icon:"qrcode"}),e("span",{children:e(p,{id:"gCX4Z9"})})]}),e(ve,{href:j,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(p,{id:"Bz5hLl"})})]}),e(je,{}),e(ve,{onClick:()=>{E.showMediaModal={mediaAttachments:[{type:"image",url:S}]}},children:[e(I,{icon:"user"}),e("span",{children:e(p,{id:"7WYl2I"})})]}),!!we&&!se&&e(ve,{onClick:()=>{E.showMediaModal={mediaAttachments:[{type:"image",url:we}]}},children:[e(I,{icon:"media"}),e("span",{children:e(p,{id:"ZNme5R"})})]}),l&&ke&&Qe("@mastodon/profile-edit")&&e(N,{children:[e(je,{}),e(ve,{onClick:()=>{B(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(p,{id:"9OpVZg"})})]})]})]}):e(yt,{account:w,instance:o,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!Z&&e("span",{class:"tag",children:e(p,{id:"prdIOK"})}),!!A&&e("span",{class:"tag",children:[e(I,{icon:"bot"})," ",e(p,{id:"9Vdq+j"})]}),!!F&&e("span",{class:"tag",children:[e(I,{icon:"group"})," ",e(p,{id:"L8fEEm"})]}),e("div",{class:"note",dir:"auto",onClick:uo({instance:f}),dangerouslySetInnerHTML:{__html:vi(G,{emojis:M})}}),e("div",{class:"account-metadata-box",children:[$?.length>0&&e("div",{class:"profile-metadata",children:$.map(({name:z,value:fe,verifiedAt:Ee},ye)=>e("div",{class:`profile-field ${Ee?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(ho,{text:z,emojis:M})," ",!!Ee&&e(I,{icon:"check-circle",size:"s",alt:d({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:vi(fe,{emojis:M})}})]},z+ye))}),e("div",{class:"stats",children:[e(Ve,{tabIndex:0,to:le,onClick:()=>{setTimeout(()=>{E.showGenericAccounts={id:"followers",heading:d({id:"x5LEuB"}),fetchAccounts:ze,instance:o,excludeRelationshipAttrs:ke?["followedBy"]:[],blankCopy:de?d({id:"BRV/wh"}):void 0}},0)},children:[!!$e.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:$e.map(z=>e(ut,{url:z.avatarStatic,size:"s",alt:`${z.displayName} @${z.acct}`,squircle:z?.bot}))})}),e(p,{id:"TbttfX",values:{0:Ze(q),1:Ze(q),followersCount:q},components:{0:e("span",{title:q}),1:e("span",{title:q})}})]}),e(Ve,{class:"insignificant",tabIndex:0,to:le,onClick:()=>{setTimeout(()=>{E.showGenericAccounts={heading:d({id:"following.stats"}),fetchAccounts:Ke,instance:o,excludeRelationshipAttrs:ke?["following"]:[],blankCopy:de?d({id:"BRV/wh"}):void 0}},0)},children:[e(p,{id:"SGcIK+",values:{0:Ze(D),followingCount:D},components:{0:e("span",{title:D})}}),e("br",{})]}),e(Ve,{class:"insignificant",to:le,children:e(p,{id:"C4x3+X",values:{0:Ze(K),1:Ze(K),statusesCount:K},components:{0:e("span",{title:K}),1:e("span",{title:K})}})}),!!C&&e("div",{class:"insignificant",children:e(p,{id:"PCcEFZ",values:{0:at(C,{hideTime:!0})},components:{0:e("time",{datetime:C})}})})]})]}),!!ae&&e(Ve,{to:le,class:"account-metadata-box",onClick:void 0,children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:O?e("div",{class:"posting-stats",title:Vt()?d({id:"CKHUZ2",values:{0:(ae.originals/ae.total).toLocaleString(h.locale||void 0,{style:"percent"}),1:(ae.replies/ae.total).toLocaleString(h.locale||void 0,{style:"percent"}),2:(ae.quotes/ae.total).toLocaleString(h.locale||void 0,{style:"percent"}),3:(ae.boosts/ae.total).toLocaleString(h.locale||void 0,{style:"percent"})}}):d({id:"wiuWLe",values:{0:(ae.originals/ae.total).toLocaleString(h.locale||void 0,{style:"percent"}),1:(ae.replies/ae.total).toLocaleString(h.locale||void 0,{style:"percent"}),2:(ae.boosts/ae.total).toLocaleString(h.locale||void 0,{style:"percent"})}}),children:[e("div",{children:ae.daysSinceLastPost<365?me._({id:"oZUtTk",values:{0:ae.total,1:ae.daysSinceLastPost,2:ae.daysSinceLastPost,3:ae.daysSinceLastPost,4:ae.total,5:ae.total,6:ae.daysSinceLastPost}}):me._({id:"JvA7Mo",values:{0:ae.total,1:ae.total}})}),e("div",{class:"posting-stats-bar",children:[ae.originals>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-originals",style:{"--percentage":`${ae.originals/ae.total*100}%`}}),ae.replies>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-replies",style:{"--percentage":`${ae.replies/ae.total*100}%`}}),ae.quotes>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-quotes",style:{"--percentage":`${ae.quotes/ae.total*100}%`}}),ae.boosts>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-boosts",style:{"--percentage":`${ae.boosts/ae.total*100}%`}})]}),e("div",{class:"posting-stats-legends",children:[e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-originals"})," ",e(p,{id:"HxF6Fk"})]})," ",e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-replies"})," ",e(p,{id:"N8UzTV"})]})," ",Vt()&&e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-quotes"})," ",e(p,{id:"eWLklq"})]}),e("span",{class:"ib",children:[e("span",{class:"posting-stats-legend-item posting-stats-bar-boosts"})," ",e(p,{id:"puY2t0"})]})]})]}):e("div",{class:"posting-stats",children:e(p,{id:"vl3XTJ"})})})})}),!H&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!ae,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:ee==="loading",onClick:()=>{Pe()},children:[e("div",{class:`posting-stats-icon ${ee==="loading"?"loading":""}`}),e(p,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(pr,{info:w,instance:o,standalone:s,authenticated:a,onRelationshipChange:Be,onProfileUpdate:P,setShowEditProfile:B,showEndorsements:c,renderEndorsements:J,setRenderEndorsements:oe})}),e(ir,{accountID:Q,info:w,open:J,onlyOpenIfHasEndorsements:J==="onlyOpenIfHasEndorsements"})]})]}),!!T&&e(qe,{onClose:()=>{B(!1)},children:e(tr,{onClose:({state:z,account:fe}={})=>{B(!1),z==="success"&&fe&&P(fe)}})})]})}const kr=3;function Sr([n,i,s]){const o=.2126*n+.7152*i+.0722*s;let a;return o>=220?a=1:o<=50?a=.1:a=o/255,a=Math.min(1,a),[n,i,s,a]}function Cr({account:n,instance:i,onClose:s}){const{_:o}=re(),{masto:a,instance:c,authenticated:h}=ce({instance:i}),d=typeof n=="string";return V(()=>{d||(E.accounts[`${n.id}@${c}`]=n)},[n]),Ao(s),e("div",{class:"sheet",children:[!!s&&e("button",{type:"button",class:"sheet-close outer",onClick:s,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e(Ro,{instance:c,authenticated:h,account:n,fetchAccount:async()=>{if(d)try{return await a.v1.accounts.lookup({acct:n,skip_webfinger:!1})}catch{const l=await a.v2.search.list({q:n,type:"accounts",limit:h?1:11,resolve:h});if(l.accounts.length){const u=l.accounts.find(f=>f.url===n||n.startsWith(f.url));if(u)return u}if(/^https?:\/\/[^/]+\/@[^/]+$/.test(n)){const u=URL.parse(n);if(u){const{hostname:f,pathname:m}=u,g=m.replace(/^\//,"").replace(/\/$/,"")+"@"+f,y=await a.v2.search.list({q:g,type:"accounts",limit:1,resolve:h});if(y.accounts.length)return y.accounts[0]}}}else return n}})]})}function _r({onClose:n}){const{_:i}=re(),{masto:s}=ce(),[o,a]=R("default"),[c,h]=R([]),[d,r]=$t(u=>u+1,0);V(()=>{a("loading"),(async()=>{try{const u=await wt.drafts.keys();if(u.length){const f=Fn(),m=u.filter(g=>g.startsWith(f));if(m.length){const g=await wt.drafts.getMany(m);g.sort((y,w)=>Date.parse(w.updatedAt)-Date.parse(y.updatedAt)),h(g)}else h([])}else h([]);a("default")}catch{a("error")}})()},[d]);const l=c?.length>0;return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(p,{id:"krk5ws"})," ",e(De,{abrupt:!0,hidden:o!=="loading"})]}),l&&e("div",{class:"insignificant",children:e(p,{id:"Ap/10+"})})]}),e("main",{children:l?e(N,{children:[e("ul",{class:"drafts-list",children:c.map(u=>{const{updatedAt:f,key:m,draftStatus:g,replyTo:y,quote:w}=u,k=new Date(f);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(I,{icon:y?"reply":"quill",size:"s"})," ",e("time",{children:[!!y&&e(N,{children:[e("span",{class:"bidi-isolate",children:["@",y.account.acct]}),e("br",{})]}),at(k)]})]}),e(bt,{confirmLabel:e("span",{children:e(p,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:o==="loading",onClick:()=>{(async()=>{try{await wt.drafts.del(m),r()}catch{alert(i({id:"rEYoku"}))}})()},children:e("button",{type:"button",class:"small light",disabled:o==="loading",children:e(p,{id:"Jb6/SB"})})})]}),e("button",{type:"button",disabled:o==="loading",class:"draft-item",onClick:async()=>{let b,v;if(y?.id||w?.id){if(a("loading"),y)try{b=await s.v1.statuses.$select(y.id).fetch()}catch{alert(i({id:"tMwimH"})),a("default");return}if(w)try{v=await s.v1.statuses.$select(w.id).fetch()}catch{alert(i({id:"2oZ4Iw"})),a("default")}a("default")}window.__COMPOSE__={draftStatus:g,replyToStatus:b,quoteStatus:v},E.showCompose=!0,E.showDrafts=!1},children:e(Ir,{draft:u})})]},f)})}),c.length>1&&e("p",{children:e(bt,{confirmLabel:e("span",{children:e(p,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:o==="loading",onClick:()=>{(async()=>{a("loading");try{await wt.drafts.delMany(c.map(u=>u.key)),a("default"),r()}catch{alert(i({id:"0J4sZq"})),a("error")}})()},children:e("button",{type:"button",class:"light danger",disabled:o==="loading",children:e(p,{id:"hOg+Mt"})})})})]}):e("p",{children:e(p,{id:"8iQ+jk"})})})]})}function Ir({draft:n}){const{_:i}=re(),{draftStatus:s,replyTo:o,quote:a}=n,{status:c,spoilerText:h,poll:d,mediaAttachments:r}=s,l=d?.options?.length>0,u=r?.length>0,f=!!a?.id,m=l||u||f,g=_e(()=>{if(!u)return;const y=r.find(b=>/image/.test(b.type));if(!y)return;const{file:w}=y;return URL.createObjectURL(w)},[u,r]);return e(N,{children:e("div",{class:"mini-draft",children:[m&&e("div",{class:`mini-draft-aside ${g?"has-image":""}`,style:g?{"--bg-image":`url(${g})`}:{},children:[l&&e(I,{icon:"poll",alt:i({id:"4WUbF1"})}),u&&e("span",{children:[e(I,{icon:"attachment",alt:i({id:"xYilR2"})})," ",e("small",{children:r?.length})]}),f&&e(I,{icon:"quote",alt:i({id:"ZhhOwV"})})]}),e("div",{class:"mini-draft-main",children:[!!h&&e("div",{class:"mini-draft-spoiler",children:h}),!!c&&e("div",{class:"mini-draft-status",children:c})]})]})})}function Ar({html:n,url:i,width:s,height:o,onClose:a=()=>{}}){const{_:c}=re();return e("div",{class:"embed-modal-container",children:[e("div",{class:"top-controls",children:[e("button",{type:"button",class:"light",onClick:()=>a(),children:e(I,{icon:"x",alt:c({id:"yz7wBu"})})}),i&&e("a",{href:i,target:"_blank",rel:"noopener",class:"button plain",children:[e("span",{children:e(p,{id:"4/RpOy"})})," ",e(I,{icon:"external"})]})]}),e("div",{class:"embed-content",dangerouslySetInnerHTML:{__html:n},style:{"--width":s+"px","--height":o+"px","--aspect-ratio":`${s}/${o}`}})]})}function xr({instance:n,excludeRelationshipAttrs:i=[],postID:s,onClose:o=()=>{},blankCopy:a}){const{_:c}=re(),{masto:h,instance:d}=ce(),r=n?n===d:!0,l=We(E),[u,f]=R("default"),[m,g]=R(!1);if(Ao(o),!l.showGenericAccounts)return null;const{id:y,heading:w,fetchAccounts:k,accounts:b,showReactions:v}=l.showGenericAccounts,[_,S]=R(b?.length?b:[]),[A,C]=R({}),x=async D=>{if(!D?.length||!r)return;const F=await Qn(D,A);F&&C({...A,...F})},M=D=>{k&&(D&&!_?.length&&S([]),f("loading"),(async()=>{try{const{done:F,value:Q}=await k(D);if(Array.isArray(Q)){if(D){const te=[];for(let Y=0;Y<Q.length;Y++){const G=Q[Y],K=te.find((j,L)=>j.id===G.id&&Y!==L);K?K._types.push(...G._types):te.push({_types:[],...G})}S(te)}else S(te=>{const Y=te;for(const G of Q){const K=Y.find(j=>j.id===G.id);K?K._types.push(...G._types):Y.push(G)}return Y});g(!F),x(Q)}else g(!1);f("default")}catch{f("error")}})())},$=U(!0);V(()=>{_?.length>0?k?(M(!0),$.current=!1):x(_):(M(!0),$.current=!1)},[k]),V(()=>{$.current||l.reloadGenericAccounts?.id===y&&M(!0)},[l.reloadGenericAccounts.counter]);const q=E.statuses[s];return e("div",{id:"generic-accounts-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:o,children:e(I,{icon:"x",alt:c({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:w||c({id:"bPwFdf"})})}),e("main",{children:[q&&e(ge,{to:`/${n||d}/s/${q.id}`,class:"post-preview",children:e(Ye,{status:q,size:"s",readOnly:!0})}),_.length>0?e(N,{children:[e("ul",{class:"accounts-list",children:_.map(D=>{const F=A[D.id],Q=`${D.id}-${D._types?.length||""}`;return e("li",{children:[v&&D._types?.length>0&&e("div",{class:"reactions-block",children:D._types.map(te=>e(I,{icon:{reblog:"rocket",favourite:"heart"}[te],class:`${te}-icon`}))}),e("div",{class:"account-relationships",children:e(yt,{account:D,showStats:!0,relationship:F,excludeRelationshipAttrs:i})})]},Q)})}),u==="default"?m?e(Lt,{onChange:D=>{D&&M()},children:e("button",{type:"button",class:"plain block",onClick:()=>M(),children:e(p,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(p,{id:"2EYeAZ"})}):u==="loading"&&e("p",{class:"ui-state",children:e(De,{abrupt:!0})})]}):u==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):u==="error"?e("p",{class:"ui-state",children:e(p,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:a||c({id:"10OlfF"})})]})]})}function Tr({accounts:n,onClose:i}){const{_:s}=re(),o=nn(),{accountsToImport:a}=_e(()=>{if(!n)return{accountsToImport:[]};const f={duplicate:0,new:1};return{accountsToImport:n.map(g=>{const w=o.find(k=>k.info.id===g.info.id&&k.instanceURL===g.instanceURL)?"duplicate":"new";return{...g,__status:w}}).sort((g,y)=>f[g.__status]-f[y.__status])}},[n,o]),[c,h]=R(()=>{const f={};return a.forEach(m=>{m.__status==="duplicate"?f[m.info.id+m.instanceURL]=!1:f[m.info.id+m.instanceURL]=!0}),f}),[d,r]=R("default"),l=()=>{r("importing");const f=[...o,...n.filter(m=>c[m.info.id+m.instanceURL])];Ht(f),i(),E.showImportExportAccounts=!1,E.showAccounts=!0},u=Object.values(c).filter(Boolean).length;return e("div",{id:"import-accounts-selection-container",class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,disabled:d==="importing",children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(p,{id:"jiFPsN"})})}),e("main",{children:e("div",{class:"import-selection",children:[a.filter(f=>f.__status!=="duplicate").length>3&&e("div",{class:"accounts-list-header",children:e("label",{class:"account-item",children:[e("input",{type:"checkbox",checked:a.filter(f=>f.__status!=="duplicate").length>0&&a.filter(f=>f.__status!=="duplicate").every(f=>c[f.info.id+f.instanceURL]),onChange:f=>{const m={...c},g=f.target.checked;a.forEach(y=>{y.__status!=="duplicate"&&(m[y.info.id+y.instanceURL]=g)}),h(m)},disabled:d==="importing"}),e("span",{class:"account-info",children:e(p,{id:"wgNoIs"})})]})}),e("ul",{class:"accounts-list",children:a.map(f=>{const m=f.info.id+f.instanceURL,g=c[m],{__status:y}=f;return e("li",{children:e("label",{class:"account-item",children:[e("input",{type:"checkbox",checked:g,onChange:w=>{h({...c,[m]:w.target.checked})},disabled:d==="importing"||y==="duplicate"}),e(ut,{url:f.info.avatarStatic,size:"xl"}),e("div",{class:"account-info",children:e(gt,{account:{...f.info,acct:/@/.test(f.info.acct)?f.info.acct:`${f.info.acct}@${f.instanceURL}`},showAcct:!0})}),e("div",{class:"account-meta",children:y==="duplicate"&&e("span",{class:"tag collapsed",children:e(p,{id:"5Lvp3B"})})})]})},m)})}),e("footer",{children:[e("button",{type:"button",class:"light",onClick:i,disabled:d==="importing",children:e(p,{id:"dEgA5A"})}),e(De,{hidden:d!=="importing"}),e("button",{type:"button",disabled:u===0||d==="importing",onClick:l,children:e(p,{id:"0mebiX",values:{selectedCount:u}})})]})]})})]})}function Er({onClose:n}){const{_:i}=re(),s=nn(),[o,a]=R("default"),[c,h]=R(null),[d,r]=R(!1),l=async()=>{a("exporting");try{const b={accounts:nn().map(M=>{const{accessToken:$,...q}=M;return q}),createdAt:Date.now()},v=JSON.stringify(b),_=new Blob([v],{type:"application/json"}),S=URL.createObjectURL(_),A=document.createElement("a");A.href=S;const C=new Date,x=`${C.getFullYear()}-${String(C.getMonth()+1).padStart(2,"0")}-${String(C.getDate()).padStart(2,"0")}_${String(C.getHours()).padStart(2,"0")}-${String(C.getMinutes()).padStart(2,"0")}`;A.download=`accounts-${x}.phanpy.json`,A.click(),URL.revokeObjectURL(S),n()}catch{he(i({id:"lpYill"})),a("error")}},u=async w=>{if(w){a("importing");try{const k=await w.text(),v=JSON.parse(k)?.accounts;if(!Array.isArray(v))throw new Error("Invalid backup file");h(v),a("default")}catch{he(i({id:"BEVzjL"})),a("error")}}},f=w=>{const k=w.target.files[0];u(k)};return e("div",{id:"import-export-accounts-container",class:"sheet",onDragOver:w=>{w.preventDefault(),r(!0)},onDragLeave:()=>{r(!1)},onDrop:w=>{w.preventDefault(),r(!1);const k=w.dataTransfer.files[0];u(k)},children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(p,{id:"k30qb8",components:{0:e("small",{class:"ib insignificant"})}})})}),e("main",{children:[e("section",{children:[e("label",{class:`section-button button-import button plain4 ${d?"drag-over":""}`,tabindex:"0",children:[e(I,{icon:"arrow-down-circle",size:"xxl"}),e("b",{children:e(p,{id:"l3s5ri"})}),e("input",{type:"file",accept:".json",onChange:f,disabled:o==="importing",style:{display:"none"}}),e("div",{children:e("small",{class:"insignificant",children:e(p,{id:"SdA74G"})})})]})," ",e("button",{type:"button",class:"section-button button-export plain4",onClick:l,disabled:o==="exporting"||s.length===0,children:[e(I,{icon:"arrow-up-circle",size:"xxl"}),e("b",{children:e(p,{id:"GS+Mus"})}),e("div",{children:e("small",{class:"insignificant",children:e(p,{id:"A7kMZX",values:{0:s.length}})})})]})]}),e("p",{class:"insignificant",children:e("small",{children:e(p,{id:"R+Pgtr"})})})]}),c&&e(qe,{onClose:()=>{h(null)},children:e(Tr,{accounts:c,onClose:()=>{h(null)}})})]})}const Rr=140;function Lr({alt:n,lang:i,onClose:s}){const{_:o}=re(),a=We(E),[c,h]=R(!1),d=ro(!0),r=a.settings.contentTranslationHideLanguages||[],l=!!i&&i!==d&&!Kn([i],[d])&&!r.find(u=>i===u||Kn([i],[u]));return V(()=>{const u=n?.length>0&&n?.length<=Rr;l&&u&&h(!0)},[l,n]),e("div",{class:"sheet",tabindex:"-1",children:[!!s&&e("button",{type:"button",class:"sheet-close outer",onClick:s,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:[e("h2",{children:e(p,{id:"5gfDMm"})}),e("div",{class:"header-side",children:e(ft,{align:"end",menuButton:e("button",{type:"button",class:"plain4",children:e(I,{icon:"more",alt:o({id:"2FYpfJ"}),size:"xl"})}),children:[e(ve,{disabled:c,onClick:()=>{h(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(p,{id:"pi8x/S"})})]}),Ua&&e(ve,{onClick:()=>{Fa(n,i)},children:[e(I,{icon:"speak"}),e("span",{children:e(p,{id:"yIBLq8"})})]})]})})]}),e("main",{lang:i,dir:"auto",children:[e("p",{style:{whiteSpace:"pre-wrap",textWrap:"pretty"},children:n}),(l||c)&&e(lo,{forceTranslate:c,sourceLanguage:i,text:n})]})]})}const{min:hh,max:fh}=Math;const Lo={};for(let n of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Lo[`[object ${n}]`]=n.toLowerCase();function $r(n){return Lo[Object.prototype.toString.call(n)]||"object"}const rn=(n,i=null)=>n.length>=3?Array.prototype.slice.call(n):$r(n[0])=="object"&&i?i.split("").filter(s=>n[0][s]!==void 0).map(s=>n[0][s]):n[0].slice(0);const{PI:si,min:ph,max:mh}=Math;const gh=si*2,yh=si/3,Mr=si/180,Pr=180/si;function Yn(n,i){let s=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(i[0])||(i=i.map(h=>[h]));let o=i[0].length,a=i[0].map((h,d)=>i.map(r=>r[d])),c=n.map(h=>a.map(d=>Array.isArray(h)?h.reduce((r,l,u)=>r+l*(d[u]||0),0):d.reduce((r,l)=>r+l*h,0)));return s===1&&(c=c[0]),o===1?c.map(h=>h[0]):c}const $o={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}};const ui=n=>{const i=Math.sign(n);return n=Math.abs(n),(n<=.0031308?n*12.92:1.055*Math.pow(n,1/2.4)-.055)*i},Nr=(n,i,s)=>{const{MtxAdaptMa:o,MtxAdaptMaI:a,MtxXYZ2RGB:c,RefWhiteRGB:h,Xn:d,Yn:r,Zn:l}=$o,u=d*o.m00+r*o.m10+l*o.m20,f=d*o.m01+r*o.m11+l*o.m21,m=d*o.m02+r*o.m12+l*o.m22,g=h.X*o.m00+h.Y*o.m10+h.Z*o.m20,y=h.X*o.m01+h.Y*o.m11+h.Z*o.m21,w=h.X*o.m02+h.Y*o.m12+h.Z*o.m22,k=(n*o.m00+i*o.m10+s*o.m20)*(g/u),b=(n*o.m01+i*o.m11+s*o.m21)*(y/f),v=(n*o.m02+i*o.m12+s*o.m22)*(w/m),_=k*a.m00+b*a.m10+v*a.m20,S=k*a.m01+b*a.m11+v*a.m21,A=k*a.m02+b*a.m12+v*a.m22,C=ui(_*c.m00+S*c.m10+A*c.m20),x=ui(_*c.m01+S*c.m11+A*c.m21),M=ui(_*c.m02+S*c.m12+A*c.m22);return[C*255,x*255,M*255]},Zi=(...n)=>{n=rn(n,"lab");const[i,s,o,...a]=n,[c,h,d]=Dr([i,s,o]),[r,l,u]=Nr(c,h,d);return[r,l,u,...a.length>0&&a[0]<1?[a[0]]:[]]};function Dr(n){var i=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],s=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],o=Yn(s,n);return Yn(i,o.map(a=>a**3))}function hi(n){const i=Math.sign(n);return n=Math.abs(n),(n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4))*i}const Or=(n,i,s)=>{n=hi(n/255),i=hi(i/255),s=hi(s/255);const{MtxRGB2XYZ:o,MtxAdaptMa:a,MtxAdaptMaI:c,Xn:h,Yn:d,Zn:r,As:l,Bs:u,Cs:f}=$o;let m=n*o.m00+i*o.m10+s*o.m20,g=n*o.m01+i*o.m11+s*o.m21,y=n*o.m02+i*o.m12+s*o.m22;const w=h*a.m00+d*a.m10+r*a.m20,k=h*a.m01+d*a.m11+r*a.m21,b=h*a.m02+d*a.m12+r*a.m22;let v=m*a.m00+g*a.m10+y*a.m20,_=m*a.m01+g*a.m11+y*a.m21,S=m*a.m02+g*a.m12+y*a.m22;return v*=w/l,_*=k/u,S*=b/f,m=v*c.m00+_*c.m10+S*c.m20,g=v*c.m01+_*c.m11+S*c.m21,y=v*c.m02+_*c.m12+S*c.m22,[m,g,y]},Xi=(...n)=>{const[i,s,o,...a]=rn(n,"rgb"),c=Or(i,s,o);return[...zr(c),...a.length>0&&a[0]<1?[a[0]]:[]]};function zr(n){const i=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],s=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],o=Yn(i,n);return Yn(s,o.map(a=>Math.cbrt(a)))}const{sin:Br,cos:qr}=Math,Ur=(...n)=>{let[i,s,o]=rn(n,"lch");return isNaN(o)&&(o=0),o=o*Mr,[i,qr(o)*s,Br(o)*s]},fi=(...n)=>{n=rn(n,"lch");const[i,s,o,...a]=n,[c,h,d]=Ur(i,s,o),[r,l,u]=Zi(c,h,d);return[r,l,u,...a.length>0&&a[0]<1?[a[0]]:[]]},{sqrt:Fr,atan2:Kr,round:Hr}=Math,jr=(...n)=>{const[i,s,o]=rn(n,"lab"),a=Fr(s*s+o*o);let c=(Kr(o,s)*Pr+360)%360;return Hr(a*1e4)===0&&(c=Number.NaN),[i,a,c]},Yr=(...n)=>{const[i,s,o,...a]=rn(n,"rgb"),[c,h,d]=Xi(i,s,o),[r,l,u]=jr(c,h,d);return[r,l,u,...a.length>0&&a[0]<1?[a[0]]:[]]},Vr={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:vh}=Vr;function Mo({mediaAttachments:n,statusID:i,instance:s,lang:o,index:a=0,onClose:c=()=>{}}){const{_:h}=re(),[d,r]=R("default"),l=U(null),[u,f]=R(a),m=U(null);St(()=>{m.current?.scrollIntoView()},[]);const g=U(i);V(()=>{const S=a*l.current.clientWidth,A=g.current!==i;A&&(g.current=i),l.current.focus(),l.current.scrollTo({left:S*(jt()?-1:1),behavior:A?"auto":"smooth"})},[a,i]);const[y,w]=R(!0);V(()=>{let S=A=>{c(A,u,n,l)};return l.current&&l.current.addEventListener("swiped-down",S),()=>{l.current&&l.current.removeEventListener("swiped-down",S)}},[u,n]),Fe("esc",S=>{c(S,u,n,l)},{ignoreEventWhen:S=>!!document.querySelector("#modal-container > *")||S.metaKey||S.ctrlKey||S.altKey||S.shiftKey,useKey:!0},[c,u,n]),V(()=>{let S=()=>{const{clientWidth:A,scrollLeft:C}=l.current,x=Math.round(Math.abs(C)/A);f(x)};return l.current&&l.current.addEventListener("scroll",S,{passive:!0}),()=>{l.current&&l.current.removeEventListener("scroll",S)}},[]),V(()=>{let S=setTimeout(()=>{l.current?.focus?.()},100);return()=>clearTimeout(S)},[]);const k=_e(()=>n?.map(S=>{const{blurhash:A}=S;if(A){const C=zi(A);return Yr(C)}return null}),[n]),b=_e(()=>k?.map(S=>S?{light:fi([.95,.01,S[2]]),dark:fi([.35,.01,S[2]]),default:fi([.6,S[1],S[2]])}:null)),v=_e(()=>{const A=100/b.length,C=b.map(($,q)=>{const D=q*A+5,F=(q+1)*A-5;return $?.light&&$?.dark?{light:`
rgb(${$.light?.join(",")}) ${D}%,
rgb(${$.light?.join(",")}) ${F}%
`,dark:`
rgb(${$.dark?.join(",")}) ${D}%,
rgb(${$.dark?.join(",")}) ${F}%
`}:{light:`
transparent ${D}%,
transparent ${F}%
`,dark:`
transparent ${D}%,
transparent ${F}%
`}}),x=C.map($=>$.light).join(", "),M=C.map($=>$.dark).join(", ");return{light:x,dark:M}},[b]);let _=U(null);return V(()=>()=>{_.current?.hideToast?.()},[]),St(()=>{const S=b[u];let A,C;if(S){const x=Ie.local.get("theme");if(x){const M=`rgb(${S[x].join(",")})`;A=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),A&&(C=A.content,A.content=M)}else{const M=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",$=`rgb(${S[M].join(",")})`;A=document.querySelector(`meta[name="theme-color"][media*="${M}"]`),A&&(C=A.content,A.content=$)}}return()=>{A&&C&&(A.content=C)}},[u,b]),e("div",{class:`media-modal-container media-modal-count-${n?.length}`,children:[e("div",{ref:l,tabIndex:"0","data-swipe-threshold":"44",class:"carousel",onClick:S=>{(S.target.classList.contains("carousel-item")||S.target.classList.contains("media")||S.target.classList.contains("media-zoom"))&&c(S,u,n,l)},style:n.length>1?{backgroundAttachment:"local","--accent-gradient-light":v?.light,"--accent-gradient-dark":v?.dark}:{},children:n?.map((S,A)=>{const C=n.length===1?b[A]:null;return e("div",{class:"carousel-item",style:C?{"--accent-color":`rgb(${C.default.join(",")})`,"--accent-light-color":`rgb(${C.light?.join(",")})`,"--accent-dark-color":`rgb(${C.dark?.join(",")})`,"--accent-alpha-color":`rgba(${C.default.join(",")}, 0.4)`}:{},tabindex:"0",ref:A===u?m:null,onClick:x=>{x.target.classList.contains("media")||w(!y)},children:[!!S.description&&e("button",{type:"button",class:"media-alt",hidden:!y,onClick:()=>{E.showMediaAlt={alt:S.description,lang:o}},children:[e("span",{class:"alt-badge",children:"ALT"}),e("span",{class:"media-alt-desc",lang:o,dir:"auto",children:S.description})]}),e(fo,{media:S,showOriginal:!0,lang:o})]},S.id)})}),e("div",{class:"carousel-top-controls",hidden:!y,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:S=>c(S,u,n,l),children:e(I,{icon:"x",alt:h({id:"yz7wBu"})})})}),n?.length>1?e("span",{class:"carousel-dots",children:n?.map((S,A)=>e("button",{type:"button",disabled:A===u,class:`carousel-dot ${A===u?"active":""}`,onClick:C=>{C.preventDefault(),C.stopPropagation();const x=l.current.clientWidth*A*(jt()?-1:1);l.current.focus(),l.current.scrollTo({left:x,behavior:"smooth"})},children:e(I,{icon:"round",size:"s",alt:"⸱"})},S.id))}):e("span",{}),e("span",{children:[e(ft,{overflow:"auto",align:"end",position:"anchor",gap:4,menuClassName:"glass-menu",menuButton:e("button",{type:"button",class:"carousel-button",children:e(I,{icon:"more2",alt:h({id:"2FYpfJ"})})}),children:[e(He,{href:n[u]?.remoteUrl||n[u]?.url,class:"carousel-button",target:"_blank",title:h({id:"5hXGws"}),children:[e(I,{icon:"popout"}),e("span",{children:e(p,{id:"aDr7Vc"})})]}),!1]})," ",!!i&&e(ge,{to:`${s?`/${s}`:""}/s/${i}${window.matchMedia("(min-width: calc(40em + 350px))").matches?`?media=${u+1}`:""}`,class:"button carousel-button media-post-link",children:[e("span",{class:"button-label",children:[e(p,{id:"ISg5SQ"})," "]}),"»"]})]})]}),n?.length>1&&e("div",{class:"carousel-controls",hidden:!y,children:[e("button",{type:"button",class:"carousel-button",hidden:u===0,onClick:S=>{S.preventDefault(),S.stopPropagation(),l.current.focus(),l.current.scrollTo({left:l.current.clientWidth*(u-1)*(jt()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-left",alt:h({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:u===n.length-1,onClick:S=>{S.preventDefault(),S.stopPropagation(),l.current.focus(),l.current.scrollTo({left:l.current.clientWidth*(u+1)*(jt()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-right",alt:h({id:"hXzOVo"})})})]})]})}function Gr({url:n,linkText:i,onClose:s}){const{_:o}=re();if(!n)return null;let a=n;try{const d=URL.parse(n),r=d.protocol,l=d.hostname,u=n.slice(d.origin.length);a=e(N,{children:[r,"//",e("strong",{children:l}),u]})}catch{}const c=()=>{try{navigator.clipboard.writeText(n),he(o({id:"edWbV6"}))}catch{he(o({id:"W1ewR0"}))}},h=()=>{if(navigator.share&&navigator.canShare({url:n}))try{navigator.share({url:n})}catch{}};return e("div",{class:"sheet sheet-modal",id:"open-link-sheet",tabindex:"-1",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{class:"header-grid",children:e("h2",{children:e(p,{id:"Gj4mrz"})})}),e("main",{children:[!!i&&e(N,{children:[e("p",{class:"link-text",children:[e(I,{icon:"cursor-hand",size:"xl"})," ",i]}),e("div",{class:"arrow",children:e(I,{icon:"arrow-down"})})]}),e("p",{class:"full-url",children:a})]}),e("footer",{children:[e("button",{type:"button",class:"light",onClick:s,children:e(p,{id:"dEgA5A"})}),e("span",{class:"spacer"}),e("button",{type:"button",class:"plain6",onClick:c,children:e(I,{icon:"copy",alt:o({id:"he3ygx"})})}),navigator.canShare&&navigator.canShare({url:n})&&e("button",{type:"button",class:"plain6",onClick:h,children:e(I,{icon:"share",alt:o({id:"LFKLqp"})})}),e("a",{class:"button",href:n,target:"_blank",rel:"noopener noreferrer",onClick:s,children:e(p,{id:"1TNIig"})})]})]})}const ln={newline:10,reset:27};function Wr(n){if(!Number.isSafeInteger(n))throw new Error(`integer expected: ${n}`)}function Po(n){if(!Number.isSafeInteger(n)||n<1||n>40)throw new Error(`Invalid version=${n}. Expected number [1..40]`)}function Dt(n,i){return n.toString(2).padStart(i,"0")}function bs(n,i){const s=n%i;return s>=0?s:i+s}function lt(n,i){return new Array(n).fill(i)}function ws(...n){let i=0;for(const o of n)i=Math.max(i,o.length);const s=[];for(let o=0;o<i;o++)for(const a of n)o>=a.length||s.push(a[o]);return new Uint8Array(s)}function ks(n,i,s){if(s<0||s+i.length>n.length)return!1;for(let o=0;o<i.length;o++)if(i[o]!==n[s+o])return!1;return!0}function No(){let n,i=1/0;return{add(s,o){s>=i||(n=o,i=s)},get:()=>n,score:()=>i}}function Ss(n){return{has:i=>n.includes(i),decode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="string")throw new Error("alphabet.decode input should be array of strings");return i.map(s=>{if(typeof s!="string")throw new Error(`alphabet.decode: not string element=${s}`);const o=n.indexOf(s);if(o===-1)throw new Error(`Unknown letter: "${s}". Allowed: ${n}`);return o})},encode:i=>{if(!Array.isArray(i)||i.length&&typeof i[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return i.map(s=>{if(Wr(s),s<0||s>=n.length)throw new Error(`Digit index outside alphabet: ${s} (alphabet: ${n.length})`);return n[s]})}}}class mt{static size(i,s){if(typeof i=="number"&&(i={height:i,width:i}),!Number.isSafeInteger(i.height)&&i.height!==1/0)throw new Error(`Bitmap: invalid height=${i.height} (${typeof i.height})`);if(!Number.isSafeInteger(i.width)&&i.width!==1/0)throw new Error(`Bitmap: invalid width=${i.width} (${typeof i.width})`);return s!==void 0&&(i={width:Math.min(i.width,s.width),height:Math.min(i.height,s.height)}),i}static fromString(i){i=i.replace(/^\n+/g,"").replace(/\n+$/g,"");const s=i.split(String.fromCharCode(ln.newline)),o=s.length,a=new Array(o);let c;for(const h of s){const d=h.split("").map(r=>{if(r==="X")return!0;if(r===" ")return!1;if(r!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${r}`)});if(c&&d.length!==c)throw new Error(`Bitmap.fromString different row sizes: width=${c} cur=${d.length}`);c=d.length,a.push(d)}return c||(c=0),new mt({height:o,width:c},a)}data;height;width;constructor(i,s){const{height:o,width:a}=mt.size(i);this.data=s||Array.from({length:o},()=>lt(a,void 0)),this.height=o,this.width=a}point(i){return this.data[i.y][i.x]}isInside(i){return 0<=i.x&&i.x<this.width&&0<=i.y&&i.y<this.height}size(i){if(!i)return{height:this.height,width:this.width};const{x:s,y:o}=this.xy(i);return{height:this.height-o,width:this.width-s}}xy(i){if(typeof i=="number"&&(i={x:i,y:i}),!Number.isSafeInteger(i.x))throw new Error(`Bitmap: invalid x=${i.x}`);if(!Number.isSafeInteger(i.y))throw new Error(`Bitmap: invalid y=${i.y}`);return i.x=bs(i.x,this.width),i.y=bs(i.y,this.height),i}rect(i,s,o){const{x:a,y:c}=this.xy(i),{height:h,width:d}=mt.size(s,this.size({x:a,y:c}));for(let r=0;r<h;r++)for(let l=0;l<d;l++)this.data[c+r][a+l]=typeof o=="function"?o({x:l,y:r},this.data[c+r][a+l]):o;return this}rectRead(i,s,o){return this.rect(i,s,(a,c)=>(o(a,c),c))}hLine(i,s,o){return this.rect(i,{width:s,height:1},o)}vLine(i,s,o){return this.rect(i,{width:1,height:s},o)}border(i=2,s){const o=this.height+2*i,a=this.width+2*i,c=lt(i,s),h=Array.from({length:i},()=>lt(a,s));return new mt({height:o,width:a},[...h,...this.data.map(d=>[...c,...d,...c]),...h])}embed(i,s){return this.rect(i,s.size(),({x:o,y:a})=>s.data[a][o])}rectSlice(i,s=this.size()){const o=new mt(mt.size(s,this.size(this.xy(i))));return this.rect(i,s,({x:a,y:c},h)=>o.data[c][a]=h),o}inverse(){const{height:i,width:s}=this;return new mt({height:s,width:i}).rect({x:0,y:0},1/0,({x:a,y:c})=>this.data[a][c])}scale(i){if(!Number.isSafeInteger(i)||i>1024)throw new Error(`invalid scale factor: ${i}`);const{height:s,width:o}=this;return new mt({height:i*s,width:i*o}).rect({x:0,y:0},1/0,({x:c,y:h})=>this.data[Math.floor(h/i)][Math.floor(c/i)])}clone(){return new mt(this.size()).rect({x:0,y:0},this.size(),({x:s,y:o})=>this.data[o][s])}assertDrawn(){this.rectRead(0,1/0,(i,s)=>{if(typeof s!="boolean")throw new Error(`Invalid color type=${typeof s}`)})}toString(){return this.data.map(i=>i.map(s=>s===void 0?"?":s?"X":" ").join("")).join(String.fromCharCode(ln.newline))}toASCII(){const{height:i,width:s,data:o}=this;let a="";for(let c=0;c<i;c+=2){for(let h=0;h<s;h++){const d=o[c][h],r=c+1>=i?!0:o[c+1][h];!d&&!r?a+="█":!d&&r?a+="▀":d&&!r?a+="▄":d&&r&&(a+=" ")}a+=String.fromCharCode(ln.newline)}return a}toTerm(){const i=String.fromCharCode(ln.reset),s=i+"[0m",o=i+"[1;47m "+s,a=i+"[40m "+s;return this.data.map(c=>c.map(h=>h?a:o).join("")).join(String.fromCharCode(ln.newline))}toSVG(i=!0){let s=`<svg viewBox="0 0 ${this.width} ${this.height}" xmlns="http://www.w3.org/2000/svg">`,o="",a;return this.rectRead(0,1/0,(c,h)=>{if(!h)return;const{x:d,y:r}=c;if(!i){s+=`<rect x="${d}" y="${r}" width="1" height="1" />`;return}let l=`M${d} ${r}`;if(a){const f=`m${d-a.x} ${r-a.y}`;f.length<=l.length&&(l=f)}const u=d<10?`H${d}`:"h-1";o+=`${l}h1v1${u}Z`,a=c}),i&&(s+=`<path d="${o}"/>`),s+="</svg>",s}toGIF(){const i=d=>[d&255,d>>>8&255],s=[...i(this.width),...i(this.height)],o=[];this.rectRead(0,1/0,(d,r)=>o.push(+(r===!0)));const a=126,c=[71,73,70,56,55,97,...s,246,0,0,255,255,255,...lt(381,0),44,0,0,0,0,...s,0,7],h=Math.floor(o.length/a);for(let d=0;d<h;d++)c.push(a+1,128,...o.slice(a*d,a*(d+1)).map(r=>+r));return c.push(o.length%a+1,128,...o.slice(h*a).map(d=>+d)),c.push(1,129,0,59),new Uint8Array(c)}toImage(i=!1){const{height:s,width:o}=this.size(),a=new Uint8Array(s*o*(i?3:4));let c=0;for(let h=0;h<s;h++)for(let d=0;d<o;d++){const r=this.data[h][d]?0:255;a[c++]=r,a[c++]=r,a[c++]=r,i||(a[c++]=255)}return{height:s,width:o,data:a}}}const Cs=["low","medium","quartile","high"],_s=["numeric","alphanumeric","byte","kanji","eci"],Zr=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],Xr={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},Qr={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},nt={size:{encode:n=>21+4*(n-1),decode:n=>(n-17)/4},sizeType:n=>Math.floor((n+7)/17),alignmentPatterns(n){if(n===1)return[];const i=6,s=nt.size.encode(n)-i-1,o=s-i,a=Math.ceil(o/28);let c=Math.floor(o/a);c%2?c+=1:o%a*2>=a&&(c+=2);const h=[i];for(let d=1;d<a;d++)h.push(s-(a-d)*c);return h.push(s),h},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(n,i){const s=nt.ECCode[n]<<3|i;let o=s;for(let a=0;a<10;a++)o=o<<1^(o>>9)*1335;return(s<<10|o)^nt.formatMask},versionBits(n){let i=n;for(let s=0;s<12;s++)i=i<<1^(i>>11)*7973;return n<<12|i},alphabet:{numeric:Ss("0123456789"),alphanumerc:Ss("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits(n,i){return{numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]}[i][nt.sizeType(n)]},modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(n,i){const s=Zr[n-1],o=Xr[i][n-1],a=Qr[i][n-1],c=Math.floor(s/a)-o,h=a-s%a;return{words:o,numBlocks:a,shortBlocks:h,blockLen:c,capacity:(s-o*a)*8,total:(o+c)*a+a-h}}},Qi=[(n,i)=>(n+i)%2==0,(n,i)=>i%2==0,(n,i)=>n%3==0,(n,i)=>(n+i)%3==0,(n,i)=>(Math.floor(i/2)+Math.floor(n/3))%2==0,(n,i)=>n*i%2+n*i%3==0,(n,i)=>(n*i%2+n*i%3)%2==0,(n,i)=>((n+i)%2+n*i%3)%2==0],pe={tables:(n=>{const i=lt(256,0),s=lt(256,0);for(let o=0,a=1;o<256;o++)i[o]=a,s[a]=o,a<<=1,a&256&&(a^=n);return{exp:i,log:s}})(285),exp:n=>pe.tables.exp[n],log(n){if(n===0)throw new Error(`GF.log: invalid arg=${n}`);return pe.tables.log[n]%255},mul(n,i){return n===0||i===0?0:pe.tables.exp[(pe.tables.log[n]+pe.tables.log[i])%255]},add:(n,i)=>n^i,pow:(n,i)=>pe.tables.exp[pe.tables.log[n]*i%255],inv(n){if(n===0)throw new Error(`GF.inverse: invalid arg=${n}`);return pe.tables.exp[255-pe.tables.log[n]]},polynomial(n){if(n.length==0)throw new Error("GF.polymomial: invalid length");if(n[0]!==0)return n;let i=0;for(;i<n.length-1&&n[i]==0;i++);return n.slice(i)},monomial(n,i){if(n<0)throw new Error(`GF.monomial: invalid degree=${n}`);if(i==0)return[0];let s=lt(n+1,0);return s[0]=i,pe.polynomial(s)},degree:n=>n.length-1,coefficient:(n,i)=>n[pe.degree(n)-i],mulPoly(n,i){if(n[0]===0||i[0]===0)return[0];const s=lt(n.length+i.length-1,0);for(let o=0;o<n.length;o++)for(let a=0;a<i.length;a++)s[o+a]=pe.add(s[o+a],pe.mul(n[o],i[a]));return pe.polynomial(s)},mulPolyScalar(n,i){if(i==0)return[0];if(i==1)return n;const s=lt(n.length,0);for(let o=0;o<n.length;o++)s[o]=pe.mul(n[o],i);return pe.polynomial(s)},mulPolyMonomial(n,i,s){if(i<0)throw new Error("GF.mulPolyMonomial: invalid degree");if(s==0)return[0];const o=lt(n.length+i,0);for(let a=0;a<n.length;a++)o[a]=pe.mul(n[a],s);return pe.polynomial(o)},addPoly(n,i){if(n[0]===0)return i;if(i[0]===0)return n;let s=n,o=i;s.length>o.length&&([s,o]=[o,s]);let a=lt(o.length,0),c=o.length-s.length,h=o.slice(0,c);for(let d=0;d<h.length;d++)a[d]=h[d];for(let d=c;d<o.length;d++)a[d]=pe.add(s[d-c],o[d]);return pe.polynomial(a)},remainderPoly(n,i){const s=Array.from(n);for(let o=0;o<n.length-i.length+1;o++){const a=s[o];if(a!==0)for(let c=1;c<i.length;c++)i[c]!==0&&(s[o+c]=pe.add(s[o+c],pe.mul(i[c],a)))}return s.slice(n.length-i.length+1,s.length)},divisorPoly(n){let i=[1];for(let s=0;s<n;s++)i=pe.mulPoly(i,[1,pe.pow(2,s)]);return i},evalPoly(n,i){if(i==0)return pe.coefficient(n,0);let s=n[0];for(let o=1;o<n.length;o++)s=pe.add(pe.mul(i,s),n[o]);return s},euclidian(n,i,s){pe.degree(n)<pe.degree(i)&&([n,i]=[i,n]);let o=n,a=i,c=[0],h=[1];for(;2*pe.degree(a)>=s;){let l=o,u=c;if(o=a,c=h,o[0]===0)throw new Error("rLast[0] === 0");a=l;let f=[0];const m=pe.inv(o[0]);for(;pe.degree(a)>=pe.degree(o)&&a[0]!==0;){const g=pe.degree(a)-pe.degree(o),y=pe.mul(a[0],m);f=pe.addPoly(f,pe.monomial(g,y)),a=pe.addPoly(a,pe.mulPolyMonomial(o,g,y))}if(f=pe.mulPoly(f,c),h=pe.addPoly(f,u),pe.degree(a)>=pe.degree(o))throw new Error(`Division failed r: ${a}, rLast: ${o}`)}const d=pe.coefficient(h,0);if(d==0)throw new Error("sigmaTilde(0) was zero");const r=pe.inv(d);return[pe.mulPolyScalar(h,r),pe.mulPolyScalar(a,r)]}};function Jr(n){return{encode(i){const s=pe.divisorPoly(n),o=Array.from(i);return o.push(...s.slice(0,-1).fill(0)),Uint8Array.from(pe.remainderPoly(o,s))},decode(i){const s=i.slice(),o=pe.polynomial(Array.from(i));let a=lt(n,0),c=!1;for(let f=0;f<n;f++){const m=pe.evalPoly(o,pe.exp(f));a[a.length-1-f]=m,m!==0&&(c=!0)}if(!c)return s;a=pe.polynomial(a);const h=pe.monomial(n,1),[d,r]=pe.euclidian(h,a,n),l=lt(pe.degree(d),0);let u=0;for(let f=1;f<256&&u<l.length;f++)pe.evalPoly(d,f)===0&&(l[u++]=pe.inv(f));if(u!==l.length)throw new Error("RS.decode: invalid errors number");for(let f=0;f<l.length;f++){const m=s.length-1-pe.log(l[f]);if(m<0)throw new Error("RS.decode: invalid error location");const g=pe.inv(l[f]);let y=1;for(let w=0;w<l.length;w++)f!==w&&(y=pe.mul(y,pe.add(1,pe.mul(l[w],g))));s[m]=pe.add(s[m],pe.mul(pe.evalPoly(r,g),pe.inv(y)))}return s}}}function Do(n,i){const{words:s,shortBlocks:o,numBlocks:a,blockLen:c,total:h}=nt.capacity(n,i),d=Jr(s);return{encode(r){const l=[],u=[];for(let y=0;y<a;y++){const w=y<o,k=c+(w?0:1);l.push(r.subarray(0,k)),u.push(d.encode(r.subarray(0,k))),r=r.subarray(k)}const f=ws(...l),m=ws(...u),g=new Uint8Array(f.length+m.length);return g.set(f),g.set(m,f.length),g},decode(r){if(r.length!==h)throw new Error(`interleave.decode: len(data)=${r.length}, total=${h}`);const l=[];for(let m=0;m<a;m++){const g=m<o;l.push(new Uint8Array(s+c+(g?0:1)))}let u=0;for(let m=0;m<c;m++)for(let g=0;g<a;g++)l[g][m]=r[u++];for(let m=o;m<a;m++)l[m][c]=r[u++];for(let m=c;m<c+s;m++)for(let g=0;g<a;g++){const y=g<o;l[g][m+(y?0:1)]=r[u++]}const f=[];for(const m of l)f.push(...Array.from(d.decode(m)).slice(0,-s));return Uint8Array.from(f)}}}function Oo(n,i,s,o=!1){const a=nt.size.encode(n);let c=new mt(a+2);const h=new mt(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);c=c.embed(0,h).embed({x:-h.width,y:0},h).embed({x:0,y:-h.height},h),c=c.rectSlice(1,a);const d=new mt(1).rect(0,1,!0).border(1,!1).border(1,!0),r=nt.alignmentPatterns(n);for(const l of r)for(const u of r)c.data[l][u]===void 0&&c.embed({x:u-2,y:l-2},d);c=c.hLine({x:0,y:6},1/0,({x:l},u)=>u===void 0?l%2==0:u).vLine({x:6,y:0},1/0,({y:l},u)=>u===void 0?l%2==0:u);{const l=nt.formatBits(i,s),u=f=>!o&&(l>>f&1)==1;for(let f=0;f<6;f++)c.data[f][8]=u(f);for(let f=6;f<8;f++)c.data[f+1][8]=u(f);for(let f=8;f<15;f++)c.data[a-15+f][8]=u(f);for(let f=0;f<8;f++)c.data[8][a-f-1]=u(f);for(let f=8;f<9;f++)c.data[8][15-f-1+1]=u(f);for(let f=9;f<15;f++)c.data[8][15-f-1]=u(f);c.data[a-8][8]=!o}if(n>=7){const l=nt.versionBits(n);for(let u=0;u<18;u+=1){const f=!o&&(l>>u&1)==1,m=Math.floor(u/3),g=u%3+a-8-3;c.data[m][g]=f,c.data[g][m]=f}}return c}function zo(n,i,s){const o=n.height,a=Qi[i];let c=-1,h=o-1;for(let d=o-1;d>0;d-=2){for(d==6&&(d=5);;h+=c){for(let r=0;r<2;r+=1){const l=d-r;n.data[h][l]===void 0&&s(l,h,a(l,h))}if(h+c<0||h+c>=o)break}c=-c}}function el(n){let i="numeric";for(let s of n)if(!nt.alphabet.numeric.has(s)&&(i="alphanumeric",!nt.alphabet.alphanumerc.has(s)))return"byte";return i}function tl(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Is(n,i,s,o){let a="",c=s.length;if(o==="numeric"){const f=nt.alphabet.numeric.decode(s.split("")),m=f.length;for(let g=0;g<m-2;g+=3)a+=Dt(f[g]*100+f[g+1]*10+f[g+2],10);m%3===1?a+=Dt(f[m-1],4):m%3===2&&(a+=Dt(f[m-2]*10+f[m-1],7))}else if(o==="alphanumeric"){const f=nt.alphabet.alphanumerc.decode(s.split("")),m=f.length;for(let g=0;g<m-1;g+=2)a+=Dt(f[g]*45+f[g+1],11);m%2==1&&(a+=Dt(f[m-1],6))}else if(o==="byte"){const f=tl(s);c=f.length,a=Array.from(f).map(m=>Dt(m,8)).join("")}else throw new Error("encode: unsupported type");const{capacity:h}=nt.capacity(n,i),d=Dt(c,nt.lengthBits(n,o));let r=nt.modeBits[o]+d+a;if(r.length>h)throw new Error("Capacity overflow");r+="0".repeat(Math.min(4,Math.max(0,h-r.length))),r.length%8&&(r+="0".repeat(8-r.length%8));const l="1110110000010001";for(let f=0;r.length!==h;f++)r+=l[f%l.length];const u=Uint8Array.from(r.match(/(.{8})/g).map(f=>+`0b${f}`));return Do(n,i).encode(u)}function As(n,i,s,o,a=!1){const c=Oo(n,i,o,a);let h=0;const d=8*s.length;if(zo(c,o,(r,l,u)=>{let f=!1;h<d&&(f=(s[h>>>3]>>(7-h&7)&1)!==0,h++),c.data[l][r]=f!==u}),h!==d)throw new Error("QR: bytes left after draw");return c}function nl(n){const i=n.inverse(),s=g=>{let y=0;for(let w=0,k=1,b=void 0;w<g.length;w++)b===g[w]&&(k++,w!==g.length-1)||(k>=5&&(y+=3+(k-5)),b=g[w],k=1);return y};let o=0;n.data.forEach(g=>o+=s(g)),i.data.forEach(g=>o+=s(g));let a=0,c=n.data;const h=n.width-1,d=n.height-1;for(let g=0;g<h;g++)for(let y=0;y<d;y++){const w=g+1,k=y+1;c[g][y]===c[w][y]&&c[w][y]===c[g][k]&&c[w][y]===c[w][k]&&(a+=3)}const r=g=>{const y=[!0,!1,!0,!0,!0,!1,!0],w=[!1,!1,!1,!1],k=[...y,...w],b=[...w,...y];let v=0;for(let _=0;_<g.length;_++)ks(g,k,_)&&(v+=40),ks(g,b,_)&&(v+=40);return v};let l=0;for(const g of n.data)l+=r(g);for(const g of i.data)l+=r(g);let u=0;n.rectRead(0,1/0,(g,y)=>u+=y?1:0);const f=u/(n.height*n.width)*100,m=10*Math.floor(Math.abs(f-50)/5);return o+a+l+m}function il(n,i,s,o){if(o===void 0){const a=No();for(let c=0;c<Qi.length;c++)a.add(nl(As(n,i,s,c,!0)),c);o=a.get()}if(o===void 0)throw new Error("Cannot find mask");return As(n,i,s,o)}function sl(n){if(!Cs.includes(n))throw new Error(`Invalid error correction mode=${n}. Expected: ${Cs}`)}function ol(n){if(!_s.includes(n))throw new Error(`Encoding: invalid mode=${n}. Expected: ${_s}`);if(n==="kanji"||n==="eci")throw new Error(`Encoding: ${n} is not supported (yet?).`)}function al(n){if(![0,1,2,3,4,5,6,7].includes(n)||!Qi[n])throw new Error(`Invalid mask=${n}. Expected number [0..7]`)}function cl(n,i="raw",s={}){const o=s.ecc!==void 0?s.ecc:"medium";sl(o);const a=s.encoding!==void 0?s.encoding:el(n);ol(a),s.mask!==void 0&&al(s.mask);let c=s.version,h,d=new Error("Unknown error");if(c!==void 0)Po(c),h=Is(c,o,n,a);else for(let u=1;u<=40;u++)try{h=Is(u,o,n,a),c=u;break}catch(f){d=f}if(!c||!h)throw d;let r=il(c,o,h,s.mask);r.assertDrawn();const l=s.border===void 0?2:s.border;if(!Number.isSafeInteger(l))throw new Error(`invalid border type=${typeof l}`);if(r=r.border(l,!1),s.scale!==void 0&&(r=r.scale(s.scale)),i==="raw")return r.data;if(i==="ascii")return r.toASCII();if(i==="svg")return r.toSVG(s.optimize);if(i==="gif")return r.toGIF();if(i==="term")return r.toTerm();throw new Error(`Unknown output: ${i}`)}const bh={best:No,bin:Dt,drawTemplate:Oo,fillArr:lt,info:nt,interleave:Do,validateVersion:Po,zigzag:zo};const Ci=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),_i=Ci.getContext("2d",{willReadFrequently:!0});_i.imageSmoothingEnabled=!1;function rl({text:n,arena:i,backgroundMask:s,arenaCircle:o=!0,caption:a}){const c=U(null),[h,d]=R(0),[r,l]=R(!1),[u,f]=R(!1),m=u?!1:o;if(V(()=>{if(a&&c.current){const j=c.current.offsetHeight;d(j)}},[a]),V(()=>{if(i){const j=new Image;j.crossOrigin="anonymous",j.onload=()=>{l(!0);try{const{width:L,height:Z}=j;Ci.width=L,Ci.height=Z,_i.drawImage(j,0,0);const W=_i.getImageData(0,0,L,Z).data,de=W.length/4;let se=0,X=!1;for(let we=3;we<W.length;we+=4)if(W[we]<=128&&se++,se/de>.1){X=!0;break}f(X)}catch{f(!1)}},j.onerror=L=>{l(!0)},j.src=i}else l(!1)},[i]),!n)return null;const g=_e(()=>cl(n,"raw",{ecc:"high",border:0,scale:1}),[n]),y=g.length,w=r?Math.ceil(y*.3):0,k=Math.floor((y-w)/2),b=k+w,v=(j,L)=>{if(j<0||j>=y||L<0||L>=y)return!1;if(r&&j>=k&&j<b&&L>=k&&L<b)if(o){const Z=(k+b)/2,H=(k+b)/2,W=w/2,de=j+.5-Z,se=L+.5-H;if(Math.sqrt(de*de+se*se)<W)return!1}else return!1;return g[L][j]},_=(j,L)=>j<0||j>=y||L<0||L>=y?!1:v(j,L),S=(j,L)=>j<7&&L<7||j>=y-7&&L<7||j<7&&L>=y-7,A=_e(()=>{let j="";for(let L=0;L<y;L++)for(let Z=0;Z<y;Z++){if(!_(Z,L)||S(Z,L))continue;const H=Z+.5,W=L+.5,de=_(Z,L-1)&&!S(Z,L-1),se=_(Z+1,L)&&!S(Z+1,L),X=_(Z,L+1)&&!S(Z,L+1),we=_(Z-1,L)&&!S(Z-1,L);se&&(j+=`M ${H} ${W} L ${H+1} ${W} `),X&&(j+=`M ${H} ${W} L ${H} ${W+1} `),!de&&!se&&!X&&!we&&(j+=`M ${H} ${W} L ${H} ${W} `)}return j},[y,g,r,k,b,w,m]),C=[{x:0,y:0},{x:y-7,y:0},{x:0,y:y-7}],x=1.1,M=.6,$=1,q=w-$*2,D=k+$,F=k+$,Q=2,te=2,Y=y+Q*2,G=y+Q*2+(a?te+h:0),K=Y*.25;return e("svg",{class:"qr-code",viewBox:`${-Q} ${-Q} ${Y} ${G}`,xmlns:"http://www.w3.org/2000/svg","shape-rendering":"geometricPrecision",children:[e("defs",{children:[e("g",{id:"position-marker",children:[e("rect",{x:"0.5",y:"0.5",width:"6",height:"6",fill:"none",stroke:"currentColor","stroke-width":"1",rx:x,ry:x}),e("rect",{x:"2",y:"2",width:"3",height:"3",fill:"currentColor",rx:M,ry:M})]}),e("g",{id:"position-marker-mask",children:[e("rect",{x:"0.5",y:"0.5",width:"6",height:"6",fill:"none",stroke:"white","stroke-width":"1",rx:x,ry:x}),e("rect",{x:"2",y:"2",width:"3",height:"3",fill:"white",rx:M,ry:M})]}),s&&e("filter",{id:"blur-mask",children:[e("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"2"}),e("feColorMatrix",{type:"saturate",values:"2"}),e("feComponentTransfer",{children:[e("feFuncR",{type:"linear",slope:"1.2",intercept:"0.3"}),e("feFuncG",{type:"linear",slope:"1.2",intercept:"0.3"}),e("feFuncB",{type:"linear",slope:"1.2",intercept:"0.3"})]})]}),s&&e("mask",{id:"qr-pattern-mask",children:[e("path",{fill:"white",stroke:"white","stroke-width":"1","stroke-linejoin":"round","stroke-linecap":"round",d:A}),e("g",{id:"position-markers-mask",children:C.map(j=>e("use",{href:"#position-marker-mask",x:j.x,y:j.y},`${j.x}-${j.y}`))}),r&&m&&e("circle",{cx:D+q/2,cy:F+q/2,r:q/2,fill:"black"}),r&&!o&&e("rect",{x:D,y:F,width:q,height:q,fill:"black"})]}),e("path",{id:"qr-pattern",fill:"currentColor",stroke:"currentColor","stroke-width":"1","stroke-linejoin":"round","stroke-linecap":"round",d:A})]}),e("use",{href:"#qr-pattern"}),e("g",{id:"position-markers",children:C.map(j=>e("use",{href:"#position-marker",x:j.x,y:j.y},`${j.x}-${j.y}`))}),s&&e("g",{mask:"url(#qr-pattern-mask)",children:e("image",{href:s,x:-Q-K,y:-Q-K,width:Y+K*2,height:Y+K*2,preserveAspectRatio:"none",opacity:"0.5",filter:"url(#blur-mask)"})}),i&&r&&e("image",{href:i,x:D,y:F,width:q,height:q,preserveAspectRatio:"xMidYMid slice","clip-path":m?`circle(${q/2}px at ${q/2}px ${q/2}px)`:void 0}),a&&e("foreignObject",{x:0,y:y+te,width:y,height:h,children:e("div",{ref:c,xmlns:"http://www.w3.org/1999/xhtml",class:"qr-code-caption",dangerouslySetInnerHTML:{__html:a}})})]})}const Bo=!!navigator.mediaDevices?.getUserMedia;function ll({text:n,arena:i,backgroundMask:s,caption:o,onClose:a,onScannerClick:c}){const{_:h}=re();return e("div",{class:"qr-code-modal-container",children:[e("div",{class:"qr-code-modal-controls",children:[Bo&&typeof c=="function"?e("button",{type:"button",class:"plain4",onClick:c,children:e(I,{icon:"scan",alt:h({id:"XDwkfO"})})}):e("span",{}),!!a&&e("button",{type:"button",class:"plain4",onClick:a,children:e(I,{icon:"x",alt:h({id:"yz7wBu"})})})]}),e(rl,{text:n,arena:i,backgroundMask:s,caption:o}),e("div",{class:"qr-code-text",children:n})]})}const $n="BarcodeDetector"in window;$n||setTimeout(()=>{Js(()=>import("./dom-BnEjxmqU.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).catch(()=>{})},1e3);class dl{constructor(i,s){this.stream=i,this.player=s,this.setStream(i)}setStream(i){this.stream=i;const{player:s}=this;s.setAttribute("autoplay",""),s.setAttribute("muted",""),s.setAttribute("playsinline",""),s.srcObject=i}async listDevices(){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw new Error("Media Devices not supported");return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="videoinput").map(s=>({deviceId:s.deviceId,label:s.label||`Camera ${s.deviceId}`}))}async setDevice(i){this.stop();const s=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:i}}});this.setStream(s)}readFrame(i,s=!1){const{player:o}=this;if(s)return i.drawImage(o,o.videoHeight,o.videoWidth);const a=getSize(o);return i.drawImage(o,a.height,a.width)}stop(){for(const i of this.stream.getTracks())i.stop()}}const ul=async n=>{if(navigator.permissions?.query)try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",()=>{})}catch{}const i=await navigator.mediaDevices.getUserMedia({video:{height:{ideal:720},width:{ideal:1280},facingMode:"environment"}});return new dl(i,n)};function hl({onClose:n,checkValidity:i,actionableText:s}){const{_:o,_:a}=re(),c=U(null),h=U(null),d=U(null),[r,l]=R(""),[u,f]=R(!0),[m,g]=R("loading");V(()=>{let w;return screen?.orientation?.type&&c.current&&(w=()=>{const k=/landscape/.test(window.screen.orientation.type)?"landscape":"portrait";c.current.classList.toggle("landscape",k==="landscape")},screen.orientation.addEventListener("change",w),w()),()=>{w&&screen?.orientation?.removeEventListener&&screen.orientation.removeEventListener("change",w)}},[]),V(()=>{let w,k,b,v,_;return u&&(async()=>{try{k=await ul(h.current),$n?v=new BarcodeDetector({formats:["qr_code"]}):(_=await Js(()=>import("./dom-BnEjxmqU.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),b=new _.QRCanvas({overlay:d.current},{cropToSquare:!1,overlayMainColor:"transparent",overlayFinderColor:"rgba(255, 0, 255, 0.5)"}));const A=h.current;A&&(A.addEventListener("loadedmetadata",()=>{g("default")}),A.addEventListener("play",()=>{const{videoWidth:C,videoHeight:x}=A;if(C&&x&&(c.current.style.setProperty("--long-dimension",Math.max(C,x)),c.current.style.setProperty("--short-dimension",Math.min(C,x))),$n){const M=async()=>{try{const D=await v.detect(h.current);D.length>0&&l(D[0].rawValue)}catch{}};let $;const q=()=>{M(),$=requestAnimationFrame(q)};q(),w=()=>cancelAnimationFrame($)}else{const M=()=>{try{const $=k.readFrame(b,!0);$!=null&&l($)}catch{}};w=_.frameLoop(M)}}))}catch{g("error"),f(!1)}})(),()=>{w&&w(),k&&k.stop(),b&&b.clear()}},[u]);const y=typeof i=="function"?i(r):!!r;return e("div",{class:"qr-scanner-modal",children:[e("div",{class:"qr-scanner-header",children:[e(De,{abrupt:!0,hidden:m!=="loading"}),e("button",{type:"button",class:"plain4",onClick:n,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})})]}),m==="error"?e("div",{class:"ui-state",children:e("p",{children:e(p,{id:"08IojR"})})}):e(N,{children:[e("div",{ref:c,class:"qr-scanner-video-container",children:[e("video",{ref:h,playsInline:!0,muted:!0,disablepictureinpicture:!0}),!$n&&e("canvas",{ref:d,class:"qr-scanner-canvas"}),e("svg",{class:"qr-scanner-corner-hint",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid meet",children:[e("path",{d:"M 25 10 L 15 10 Q 10 10 10 15 L 10 25",stroke:"currentColor","stroke-width":"2",fill:"none","stroke-linecap":"round"}),e("path",{d:"M 75 10 L 85 10 Q 90 10 90 15 L 90 25",stroke:"currentColor","stroke-width":"2",fill:"none","stroke-linecap":"round"}),e("path",{d:"M 25 90 L 15 90 Q 10 90 10 85 L 10 75",stroke:"currentColor","stroke-width":"2",fill:"none","stroke-linecap":"round"}),e("path",{d:"M 75 90 L 85 90 Q 90 90 90 85 L 90 75",stroke:"currentColor","stroke-width":"2",fill:"none","stroke-linecap":"round"})]})]}),e("div",{class:"qr-scanner-result",children:!!r&&e(N,{children:[e("p",{class:"qr-scanner-text",children:r}),y&&e("button",{type:"button",class:"button plain6",onClick:()=>{n({text:r})},children:s?a(s):e(I,{icon:"arrow-right"})})]})})]})]})}const fl=["spam","legal","violation","other"],dn={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 pl(n,i){if(!n.translations||!i)return null;const s=Object.keys(n.translations);if(!s?.length)return null;let o=Kn([i],s,null);if(!o){const a=s.map(c=>c.split(/(?=[A-Z])/).map((d,r)=>r===0?d:d.toLowerCase()).join("-"));o=Kn([i],a,null)}if(o&&o.includes("-")){const[a,c]=o.split("-");o=a+c.charAt(0).toUpperCase()+c.slice(1)}return o}function ml(n,i){return n?.length?i?n.map(s=>{const o=pl(s,i);return{...s,_translatedText:s.translations?.[o]?.text||null}}):n:[]}function gl({account:n,post:i,onClose:s}){const{_:o,_:a,i18n:c}=re(),{masto:h}=ce(),[d,r]=R("default"),[l,u]=n.acct.split("@"),[f,m]=_e(()=>{const{rules:S,domain:A}=eo();return[ml(S||[],c.locale),A]},[c.locale]),[g,y]=R(null),[w,k]=R(!1),b=U(null),[v,_]=R(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:a(i?{id:"muLhL3"}:{id:"ACul2G",values:{username:l}})}),e("button",{type:"button",class:"plain4 small",disabled:d==="loading",onClick:()=>s(),children:e(I,{icon:"x",size:"xl",alt:a({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:i?e(Ye,{status:i,size:"s",previewMode:!0}):e(yt,{account:n,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!g&&!dn[g].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[o(dn[g].stampLabel||o(dn[g].label)),e("small",{children:e(p,{id:"2WtL62"})})]},g),e("form",{onSubmit:S=>{S.preventDefault();const A=new FormData(S.target),C=Object.fromEntries(A.entries());let{category:x,comment:M,forward:$}=C;M||(M=void 0),$==="on"&&($=!0);const q=x==="violation"?Object.entries(C).filter(([F])=>F.startsWith("rule_ids")).map(([F,Q])=>Q):void 0,D={category:x,comment:M,forward:$,ruleIds:q};r("loading"),(async()=>{try{await h.v1.reports.create({accountId:n.id,statusIds:i?.id?[i.id]:void 0,category:x,comment:M,ruleIds:q,forward:$}),r("success"),he(a(i?{id:"y3ou+8"}:{id:"R9kjEL"})),s()}catch(F){r("error"),he(F?.message||a(i?{id:"+3FjPq"}:{id:"oEQq5w"}))}})()},children:[e("p",{children:a(i?{id:"L9fUm+"}:{id:"rSLkfe"})}),e("section",{class:"report-categories",children:fl.map(S=>S==="violation"&&!f?.length?null:e(N,{children:[e("label",{class:"report-category",children:[e("input",{type:"radio",name:"category",value:S,required:!0,disabled:d==="loading",onChange:A=>{y(A.target.value),k(A.target.value==="violation")}}),e("span",{children:[o(dn[S].label),"  ",e("small",{class:"ib insignificant",children:o(dn[S].description)})]})]}),S==="violation"&&!!f?.length&&e("div",{class:"shazam-container no-animation",hidden:!w,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"report-rules",ref:b,children:f.map((A,C)=>e("label",{class:"report-rule",children:[e("input",{type:"checkbox",name:`rule_ids[${C}]`,value:A.id,required:w&&!v,disabled:d==="loading",onChange:x=>{const{checked:M}=x.target;M?_(!0):b.current.querySelectorAll("input:checked").length||_(!1)}}),e("span",{children:A._translatedText||A.text})]},A.id))})})})]},S))}),e("section",{class:"report-comment",children:[e("p",{children:e("label",{for:"report-comment",children:e(p,{id:"ecVtjm"})})}),e("textarea",{maxlength:"1000",rows:"1",name:"comment",id:"report-comment",disabled:d==="loading",required:!i})]}),!!u&&u!==m&&e("section",{children:e("p",{children:e("label",{children:[e("input",{type:"checkbox",switch:!0,name:"forward",disabled:d==="loading"})," ",e("span",{children:e(p,{id:"cyjS8M",values:{domain:u},components:{0:e("i",{})}})})]})})}),e("footer",{children:[e("button",{type:"submit",disabled:d==="loading",children:e(p,{id:"4cijjm"})})," ",e("button",{type:"submit",class:"plain2",disabled:d==="loading",onClick:async()=>{try{await h.v1.accounts.$select(n.id).mute(),he(a({id:"/BGBeF",values:{username:l}}))}catch{he(a({id:"v02K7/",values:{username:l}}))}},children:e(p,{id:"caeqw/",components:{0:e("small",{class:"ib"})}})})," ",e("button",{type:"submit",class:"plain2",disabled:d==="loading",onClick:async()=>{try{await h.v1.accounts.$select(n.id).block(),he(a({id:"kjUejn",values:{username:l}}))}catch{he(a({id:"pMcdDp",values:{username:l}}))}},children:e(p,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(De,{hidden:d!=="loading"})]})]})]})]})}var Mn={exports:{}},wh=Mn.exports,xs;function yl(){return xs||(xs=1,(function(n){var i=(function(){var s=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",c={};function h(r,l){if(!c[r]){c[r]={};for(var u=0;u<r.length;u++)c[r][r.charAt(u)]=u}return c[r][l]}var d={compressToBase64:function(r){if(r==null)return"";var l=d._compress(r,6,function(u){return o.charAt(u)});switch(l.length%4){default:case 0:return l;case 1:return l+"===";case 2:return l+"==";case 3:return l+"="}},decompressFromBase64:function(r){return r==null?"":r==""?null:d._decompress(r.length,32,function(l){return h(o,r.charAt(l))})},compressToUTF16:function(r){return r==null?"":d._compress(r,15,function(l){return s(l+32)})+" "},decompressFromUTF16:function(r){return r==null?"":r==""?null:d._decompress(r.length,16384,function(l){return r.charCodeAt(l)-32})},compressToUint8Array:function(r){for(var l=d.compress(r),u=new Uint8Array(l.length*2),f=0,m=l.length;f<m;f++){var g=l.charCodeAt(f);u[f*2]=g>>>8,u[f*2+1]=g%256}return u},decompressFromUint8Array:function(r){if(r==null)return d.decompress(r);for(var l=new Array(r.length/2),u=0,f=l.length;u<f;u++)l[u]=r[u*2]*256+r[u*2+1];var m=[];return l.forEach(function(g){m.push(s(g))}),d.decompress(m.join(""))},compressToEncodedURIComponent:function(r){return r==null?"":d._compress(r,6,function(l){return a.charAt(l)})},decompressFromEncodedURIComponent:function(r){return r==null?"":r==""?null:(r=r.replace(/ /g,"+"),d._decompress(r.length,32,function(l){return h(a,r.charAt(l))}))},compress:function(r){return d._compress(r,16,function(l){return s(l)})},_compress:function(r,l,u){if(r==null)return"";var f,m,g={},y={},w="",k="",b="",v=2,_=3,S=2,A=[],C=0,x=0,M;for(M=0;M<r.length;M+=1)if(w=r.charAt(M),Object.prototype.hasOwnProperty.call(g,w)||(g[w]=_++,y[w]=!0),k=b+w,Object.prototype.hasOwnProperty.call(g,k))b=k;else{if(Object.prototype.hasOwnProperty.call(y,b)){if(b.charCodeAt(0)<256){for(f=0;f<S;f++)C=C<<1,x==l-1?(x=0,A.push(u(C)),C=0):x++;for(m=b.charCodeAt(0),f=0;f<8;f++)C=C<<1|m&1,x==l-1?(x=0,A.push(u(C)),C=0):x++,m=m>>1}else{for(m=1,f=0;f<S;f++)C=C<<1|m,x==l-1?(x=0,A.push(u(C)),C=0):x++,m=0;for(m=b.charCodeAt(0),f=0;f<16;f++)C=C<<1|m&1,x==l-1?(x=0,A.push(u(C)),C=0):x++,m=m>>1}v--,v==0&&(v=Math.pow(2,S),S++),delete y[b]}else for(m=g[b],f=0;f<S;f++)C=C<<1|m&1,x==l-1?(x=0,A.push(u(C)),C=0):x++,m=m>>1;v--,v==0&&(v=Math.pow(2,S),S++),g[k]=_++,b=String(w)}if(b!==""){if(Object.prototype.hasOwnProperty.call(y,b)){if(b.charCodeAt(0)<256){for(f=0;f<S;f++)C=C<<1,x==l-1?(x=0,A.push(u(C)),C=0):x++;for(m=b.charCodeAt(0),f=0;f<8;f++)C=C<<1|m&1,x==l-1?(x=0,A.push(u(C)),C=0):x++,m=m>>1}else{for(m=1,f=0;f<S;f++)C=C<<1|m,x==l-1?(x=0,A.push(u(C)),C=0):x++,m=0;for(m=b.charCodeAt(0),f=0;f<16;f++)C=C<<1|m&1,x==l-1?(x=0,A.push(u(C)),C=0):x++,m=m>>1}v--,v==0&&(v=Math.pow(2,S),S++),delete y[b]}else for(m=g[b],f=0;f<S;f++)C=C<<1|m&1,x==l-1?(x=0,A.push(u(C)),C=0):x++,m=m>>1;v--,v==0&&(v=Math.pow(2,S),S++)}for(m=2,f=0;f<S;f++)C=C<<1|m&1,x==l-1?(x=0,A.push(u(C)),C=0):x++,m=m>>1;for(;;)if(C=C<<1,x==l-1){A.push(u(C));break}else x++;return A.join("")},decompress:function(r){return r==null?"":r==""?null:d._decompress(r.length,32768,function(l){return r.charCodeAt(l)})},_decompress:function(r,l,u){var f=[],m,g=4,y=4,w=3,k="",b=[],v,_,S,A,C,x,M,$={val:u(0),position:l,index:1};for(v=0;v<3;v+=1)f[v]=v;for(S=0,C=Math.pow(2,2),x=1;x!=C;)A=$.val&$.position,$.position>>=1,$.position==0&&($.position=l,$.val=u($.index++)),S|=(A>0?1:0)*x,x<<=1;switch(m=S){case 0:for(S=0,C=Math.pow(2,8),x=1;x!=C;)A=$.val&$.position,$.position>>=1,$.position==0&&($.position=l,$.val=u($.index++)),S|=(A>0?1:0)*x,x<<=1;M=s(S);break;case 1:for(S=0,C=Math.pow(2,16),x=1;x!=C;)A=$.val&$.position,$.position>>=1,$.position==0&&($.position=l,$.val=u($.index++)),S|=(A>0?1:0)*x,x<<=1;M=s(S);break;case 2:return""}for(f[3]=M,_=M,b.push(M);;){if($.index>r)return"";for(S=0,C=Math.pow(2,w),x=1;x!=C;)A=$.val&$.position,$.position>>=1,$.position==0&&($.position=l,$.val=u($.index++)),S|=(A>0?1:0)*x,x<<=1;switch(M=S){case 0:for(S=0,C=Math.pow(2,8),x=1;x!=C;)A=$.val&$.position,$.position>>=1,$.position==0&&($.position=l,$.val=u($.index++)),S|=(A>0?1:0)*x,x<<=1;f[y++]=s(S),M=y-1,g--;break;case 1:for(S=0,C=Math.pow(2,16),x=1;x!=C;)A=$.val&$.position,$.position>>=1,$.position==0&&($.position=l,$.val=u($.index++)),S|=(A>0?1:0)*x,x<<=1;f[y++]=s(S),M=y-1,g--;break;case 2:return b.join("")}if(g==0&&(g=Math.pow(2,w),w++),f[M])k=f[M];else if(M===y)k=_+_.charAt(0);else return null;b.push(k),f[y++]=_+k.charAt(0),g--,_=k,g==0&&(g=Math.pow(2,w),w++)}}};return d})();n!=null?n.exports=i:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return i})})(Mn)),Mn.exports}var Ts=yl();const vl="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",bl="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",wl="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",kl=200,Sl=10;async function Vn(){const{masto:n}=ce(),i=n.v1.followedTags.list({limit:kl}).values(),s=[];let o=0;do{const{value:a,done:c}=await i.next();if(c||a?.length===0)break;s.push(...a),o++}while(o<Sl);return s.sort((a,c)=>a.name.localeCompare(c.name)),s.length&&setTimeout(()=>{Ie.account.set("followedTags",{tags:s,updatedAt:Date.now()})},1),s}const Cl=1440*60*1e3;async function _l(){try{const{tags:n,updatedAt:i}=Ie.account.get("followedTags")||{};return n?.length?(Date.now()-i>Cl&&Vn(),n):await Vn()}catch{return[]}}const Es=document.createElement("div"),Il=n=>{if(!n)return[];if(n.indexOf("#")===-1)return[];Es.innerHTML=n;const i=Es.querySelectorAll("a.hashtag");return i.length?Array.from(i).map(s=>s.innerText.trim().replace(/^[^#]*#+/,"")):[]};function Pn({children:n}){if(typeof n=="string")return n;const[i,s]=R("");return V(()=>{Promise.resolve(n).then(s)},[n]),i}const Rt=9,Al=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],qo={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"}},Nn={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}]},xl=Ct(async({id:n})=>{const i=await ce().masto.v1.accounts.$select(n).fetch();return i.username||i.acct||i.displayName}),Gn={following:{id:"home",title:(n,i)=>i===0?me._({id:"i0qMbr"}):me._({id:"following.title"}),path:"/",icon:"home"},mentions:{id:"mentions",title:{id:"/bZzdR"},path:"/mentions",icon:"at"},notifications:{id:"notifications",title:{id:"iDNBZe"},path:"/notifications",icon:"notification"},list:{id:({id:n})=>n?"list":"lists",title:({id:n})=>n?ar(n):me._({id:"h16FyT"}),path:({id:n})=>n?`/l/${n}`:"/l",icon:"list",excludeViewMode:({id:n})=>n?[]:["multi-column"]},public:{id:"public",title:({local:n})=>n?me._({id:"d5zxa4"}):me._({id:"4ERYY7"}),subtitle:({instance:n})=>n||ce().instance,path:({local:n,instance:i})=>`/${i}/p${n?"/l":""}`,icon:({local:n})=>n?"building":"earth"},trending:{id:"trending",title:{id:"4/iCqx"},subtitle:({instance:n})=>n||ce().instance,path:({instance:n})=>`/${n}/trending`,icon:"chart"},search:{id:"search",title:({query:n})=>n?`${n}`:me._({id:"A1taO8"}),path:({query:n})=>n?`/search?q=${encodeURIComponent(n)}&type=statuses`:"/search",icon:"search",excludeViewMode:({query:n})=>n?[]:["multi-column"]},"account-statuses":{id:"account-statuses",title:xl,path:({id:n})=>`/a/${n}`,icon:"user"},bookmarks:{id:"bookmarks",title:{id:"7Ff7ia"},path:"/b",icon:"bookmark"},favourites:{id:"favourites",title:{id:"zZOZj7"},path:"/f",icon:"heart"},hashtag:{id:"hashtag",title:({hashtag:n})=>n,subtitle:({instance:n})=>n||ce().instance,path:({hashtag:n,instance:i,media:s})=>`${i?`/${i}`:""}/t/${n.split(/\s+/).join("+")}${s?"?media=1":""}`,icon:"hashtag"}};function Tl({onClose:n}){const{_:i}=re(),s=We(E),{shortcuts:o}=s,[a,c]=R(!1),[h,d]=R(!1),[r]=ti();return e("div",{id:"shortcuts-settings-container",class:"sheet",tabindex:"-1",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:me._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(I,{icon:"shortcut"})," ",e(p,{id:"CTqTgr"})," ",e("sup",{style:{fontSize:12,opacity:.5,textTransform:"uppercase"},children:e(p,{id:"A1As8l"})})]})}),e("main",{children:[e("p",{children:e(p,{id:"CIHAsy"})}),e("div",{class:"shortcuts-view-mode",children:[{value:"float-button",label:me._({id:"qwdOim"}),imgURL:vl},{value:"tab-menu-bar",label:me._({id:"UxBoCm"}),imgURL:wl},{value:"multi-column",label:me._({id:"uvDfdW"}),imgURL:bl}].map(({value:l,label:u,imgURL:f})=>{const m=s.settings.shortcutsViewMode===l||l==="float-button"&&!s.settings.shortcutsViewMode;return e("label",{class:m?"checked":"",children:[e("input",{type:"radio",name:"shortcuts-view-mode",value:l,checked:m,onChange:g=>{E.settings.shortcutsViewMode=g.target.value}})," ",e("img",{src:f,alt:"",width:"80",height:"58"})," ",e("span",{children:u})]},l)})}),o.length>0?e(N,{children:[e("ol",{class:"shortcuts-list",ref:r,children:o.filter(Boolean).map((l,u)=>{const f=Object.values(l).join("-"),{type:m}=l;if(!Gn[m])return null;let{icon:g,title:y,subtitle:w,excludeViewMode:k}=Gn[m];typeof y=="function"?y=y(l,u):y=i(y),typeof w=="function"?w=w(l,u):w=i(w),typeof g=="function"&&(g=g(l,u)),typeof k=="function"&&(k=k(l,u));const b=k?.includes(s.settings.shortcutsViewMode);return e("li",{children:[e(I,{icon:g}),e("span",{class:"shortcut-text",children:[e(Pn,{children:y}),w&&e(N,{children:[" ",e("small",{class:"ib insignificant",children:w})]}),b&&e("span",{class:"tag",children:e(p,{id:"5KJFnN"})})]}),e("span",{class:"shortcut-actions",children:[e("button",{type:"button",class:"plain small",disabled:u===0,onClick:()=>{const v=Array.from(E.shortcuts);if(u>0){const _=E.shortcuts[u-1];v[u-1]=l,v[u]=_,E.shortcuts=v}},children:e(I,{icon:"arrow-up",alt:me._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:u===o.length-1,onClick:()=>{const v=Array.from(E.shortcuts);if(u<E.shortcuts.length-1){const _=E.shortcuts[u+1];v[u+1]=l,v[u]=_,E.shortcuts=v}},children:e(I,{icon:"arrow-down",alt:me._({id:"3Ib6FN"})})}),e("button",{type:"button",class:"plain small",onClick:()=>{c({shortcut:l,shortcutIndex:u})},children:e(I,{icon:"pencil",alt:me._({id:"ePK91l"})})})]})]},f)})}),o.length===1&&s.settings.shortcutsViewMode!=="float-button"&&e("div",{class:"ui-state insignificant",children:[e(I,{icon:"info"})," ",e("small",{children:e(p,{id:"3Xq4Zi"})})]})]}):e("div",{class:"ui-state insignificant",children:[e("p",{children:s.settings.shortcutsViewMode==="multi-column"?me._({id:"3xIN+E"}):me._({id:"vLxvHT"})}),e("p",{children:e(p,{id:"Fq4zw3",components:{0:e("br",{}),1:e("a",{href:"#",onClick:l=>{l.preventDefault(),E.shortcuts=[{type:"following"},{type:"notifications"}]}})}})})]}),e("p",{class:"insignificant",children:o.length>=Rt&&(s.settings.shortcutsViewMode==="multi-column"?me._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:Rt}}):me._({id:"EVRO/o",values:{SHORTCUTS_LIMIT:Rt}}))}),e("p",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e("button",{type:"button",class:"light",onClick:()=>d(!0),children:e(p,{id:"bgVLbt"})}),e("button",{type:"button",disabled:o.length>=Rt,onClick:()=>c(!0),children:[e(I,{icon:"plus"})," ",e("span",{children:s.settings.shortcutsViewMode==="multi-column"?me._({id:"Vh3ADI"}):me._({id:"9tmn6W"})})]})]})]}),a&&e(qe,{onClick:l=>{l.target===l.currentTarget&&c(!1)},children:e(El,{shortcut:a.shortcut,shortcutIndex:a.shortcutIndex,onSubmit:({result:l,mode:u})=>{u==="edit"?E.shortcuts[a.shortcutIndex]=l:E.shortcuts.push(l)},onClose:()=>c(!1)})}),h&&e(qe,{onClick:l=>{l.target===l.currentTarget&&d(!1)},children:e(Rl,{shortcuts:o,onClose:()=>d(!1)})})]})}const Rs={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function El({onSubmit:n,disabled:i,shortcut:s,shortcutIndex:o,onClose:a}){const{_:c}=re(),h=!!s,[d,r]=R(s?.type||null),[l,u]=R("default"),[f,m]=R([]),[g,y]=R([]);V(()=>{(async()=>{if(d==="list")try{u("loading");const k=await kn();m(k),u("default")}catch{u("error")}})(),(async()=>{if(d==="hashtag")try{const k=await Vn();y(k)}catch{}})()},[d]);const w=U();return V(()=>{if(h&&d&&Nn[d]){const k=w.current;Nn[d].forEach(({name:b,type:v})=>{const _=k.querySelector(`[name="${b}"]`);_&&s[b]&&(v==="checkbox"?_.checked=s[b]==="on":_.value=s[b])})}},[h,d]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!a&&e("button",{type:"button",class:"sheet-close",onClick:a,children:e(I,{icon:"x",alt:me._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:h?me._({id:"pe1jog"}):me._({id:"Lsxpe5"})})}),e("main",{tabindex:"-1",children:e("form",{ref:w,onSubmit:k=>{k.preventDefault();const b=new FormData(k.target),v={};b.forEach((_,S)=>{v[S]=_?.trim(),S==="instance"&&(v[S]=v[S].replace(/^https?:\/\//,"").replace(/\/+$/,""),v[S]=v[S].replace(/^@?[^@]+@/,""))}),v.type&&(n({result:v,mode:h?"edit":"add"}),k.target.reset(),r(null),a?.())},children:[e("p",{children:e("label",{children:[e("span",{children:e(p,{id:"cklVjM"})}),e("select",{required:!0,disabled:i,onChange:k=>{r(k.target.value)},defaultValue:h?s.type:void 0,name:"type",dir:"auto",children:[e("option",{}),Al.map(k=>e("option",{value:k,children:c(qo[k])}))]})]})}),Nn[d]?.map?.(({text:k,name:b,type:v,placeholder:_,pattern:S,notRequired:A})=>d==="list"?e("p",{children:e("label",{children:[e("span",{children:e(p,{id:"2BBAbc"})}),e("select",{name:"id",required:!A,disabled:i||l==="loading",defaultValue:h?s.id:void 0,dir:"auto",children:[e("option",{value:""}),f.map(C=>e("option",{value:C.id,children:C.title}))]})]})}):e("p",{children:e("label",{children:[e("span",{children:c(k)})," ",e("input",{type:v,switch:v==="checkbox"||void 0,name:b,placeholder:c(_),required:v==="text"&&!A,disabled:i,list:d==="hashtag"?"followed-hashtags-datalist":null,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:S,dir:"auto"}),d==="hashtag"&&g.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:g.map(C=>e("option",{value:C.name}))})]})})),!!Rs[d]&&e("p",{class:"form-note insignificant",children:[e(I,{icon:"info"}),c(Rs[d])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:i||l==="loading",children:h?me._({id:"tfDRzk"}):me._({id:"m16xKo"})}),h&&e("button",{type:"button",class:"light danger",onClick:()=>{E.shortcuts.splice(o,1),a?.()},children:e(p,{id:"t/YqKh"})})]})]})})]})}function Rl({shortcuts:n,onClose:i}){const{_:s}=re(),{masto:o}=ce(),a=_e(()=>!n||!n.filter(Boolean).length?"":Ts.compressToEncodedURIComponent(JSON.stringify(n.filter(Boolean))),[n]),[c,h]=R(""),[d,r]=R("default"),l=_e(()=>{if(!c)return r("default"),null;try{const m=JSON.parse(Ts.decompressFromEncodedURIComponent(c));if(!Array.isArray(m))throw new Error("Not an array");return r("default"),m}catch{try{const g=JSON.parse(c);if(!Array.isArray(g))throw new Error("Not an array");return r("default"),g}catch{return r("error"),null}}},[c]),u=E.shortcuts.length>0,f=U();return e("div",{id:"import-export-container",class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:me._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(p,{id:"OOa7/5",components:{0:e("small",{class:"ib insignificant"})}})})}),e("main",{tabindex:"-1",children:[e("section",{children:[e("h3",{children:[e(I,{icon:"arrow-down-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(p,{id:"l3s5ri"})})]}),e("p",{class:"field-button",children:[e("input",{ref:f,type:"text",name:"import",placeholder:me._({id:"tBmklN"}),class:"block",onInput:m=>{h(m.target.value)},dir:"auto"}),Bo&&e("button",{type:"button",class:"plain2 small",onClick:()=>{E.showQrScannerModal={onClose:({text:m}={})=>{m&&(h(m),f.current.value=m,f.current.dispatchEvent(new Event("input")))}}},children:e(I,{icon:"scan",alt:me._({id:"XDwkfO"})})}),E.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:d==="cloud-downloading",onClick:async()=>{r("cloud-downloading");const m=kt();he(me._({id:"HLqLGx"}));try{const y=(await o.v1.accounts.relationships.fetch({id:[m]}))[0];if(y){const{note:w=""}=y;if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)){const k=w.match(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/)[1],{v:b,dt:v,data:_}=JSON.parse(k);f.current.value=_,f.current.dispatchEvent(new Event("input"))}}r("default")}catch{r("error"),he(me._({id:"gCDfX+"}))}},title:me._({id:"B6cG3J"}),children:[e(I,{icon:"cloud"}),e(I,{icon:"arrow-down",size:"s"})]})]}),!!l&&Array.isArray(l)&&e(N,{children:[e("p",{children:[e("b",{children:l.length})," shortcut",l.length>1?"s":""," ",e("small",{class:"insignificant",children:["(",c.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:l.map(m=>e("li",{children:[e("span",{style:{opacity:n.some(g=>Object.keys(g).every(y=>{if(!(y in m))return!0;const w=m[y];return w===""||w===null||w===void 0?!0:g[y]===w}))?1:0},children:"*"}),e("span",{children:[s(qo[m.type]),m.type==="list"&&!!m.id&&" ⚠️"," ",Nn[m.type]?.map?.(({text:g,name:y,type:w})=>m[y]?e(N,{children:[e("span",{class:"tag collapsed insignificant",children:[s(g),":"," ",w==="checkbox"?m[y]==="on"?"✅":"❌":m[y]]})," "]}):null)]})]}))}),e("p",{children:[e("small",{children:e(p,{id:"o6sElH"})}),e("br",{}),e("small",{children:["⚠️"," ",e(p,{id:"N4z4P/"})]})]})]}),d==="error"&&e("p",{class:"error",children:e("small",{children:["⚠️ ",e(p,{id:"ZhsPEb"})]})}),e("p",{children:[u&&e(N,{children:[e(bt,{confirmLabel:me._({id:"6MzUUU"}),menuFooter:e("div",{class:"footer",children:e(p,{id:"nl8sCE"})}),onClick:()=>{const m=l.filter(w=>!E.shortcuts.some(k=>Object.keys(k).every(b=>k[b]===w[b])));if(!m.length){he(me._({id:"o6L30P"}));return}let g=[...E.shortcuts,...m];const y=g.length>Rt;y&&(g=g.slice(0,Rt)),E.shortcuts=g,he(y?me._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:Rt}}):me._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:e(p,{id:"c89gCv"})})})," "]}),e(bt,{confirmLabel:u?me._({id:"6ZjzWP"}):me._({id:"DWumLi"}),menuItemClassName:u?"danger":void 0,onClick:()=>{E.shortcuts=l,he(me._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:u?me._({id:"uIp8WL"}):me._({id:"Sjnlwj"})})})]})]}),e("section",{children:[e("h3",{children:[e(I,{icon:"arrow-up-circle",size:"l",class:"insignificant"})," ",e("span",{children:e(p,{id:"GS+Mus"})})]}),e("p",{class:"field-button",children:[e("input",{style:{width:"100%"},type:"text",value:a,readOnly:!0,onClick:m=>{if(m.target.value){m.target.select();try{navigator.clipboard.writeText(m.target.value),he(me._({id:"cWtH+v"}))}catch{he(me._({id:"yUWyHa"}))}}},dir:"auto"}),e("button",{type:"button",class:"plain2 small",disabled:!a,onClick:()=>{E.showQrCodeModal={text:a}},children:e(I,{icon:"qrcode",alt:me._({id:"gCX4Z9"})})}),E.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:d==="cloud-uploading",onClick:async()=>{r("cloud-uploading");const m=kt();try{const y=(await o.v1.accounts.relationships.fetch({id:[m]}))[0];if(y){const{note:w=""}=y;let k="";const b=JSON.stringify({v:"1",dt:Date.now(),data:a});/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(w)?k=w.replace(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,`<phanpy-shortcuts-settings>${b}</phanpy-shortcuts-settings>`):k=`${w}
<phanpy-shortcuts-settings>${b}</phanpy-shortcuts-settings>`,he(me._({id:"9ZYiLz"})),await o.v1.accounts.$select(m).note.create({comment:k}),r("default"),he(me._({id:"5w02SH"}))}}catch{r("error"),he(me._({id:"aVsTYo"}))}},title:me._({id:"gWd6Cu"}),children:[e(I,{icon:"cloud"}),e(I,{icon:"arrow-up",size:"s"})]})]}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!a,onClick:()=>{try{navigator.clipboard.writeText(a),he(me._({id:"+Kq2vY"}))}catch{he(me._({id:"tFvxZF"}))}},children:[e(I,{icon:"clipboard"})," ",e("span",{children:e(p,{id:"he3ygx"})})]})," ",navigator?.share&&navigator?.canShare?.({text:a})&&e("button",{type:"button",class:"plain2",disabled:!a,onClick:()=>{try{navigator.share({text:a})}catch{alert(me._({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"})," ",e("span",{children:e(p,{id:"Z8lGw6"})})]})," ",a.length>0&&e("small",{class:"insignificant ib",children:e(p,{id:"IPXOXm",values:{0:a.length}})})]}),!!a&&e("details",{children:[e("summary",{class:"insignificant",children:e("small",{children:e(p,{id:"e5E+WH"})})}),e("textarea",{style:{width:"100%"},rows:10,readOnly:!0,children:JSON.stringify(n.filter(Boolean),null,2)})]})]}),E.settings.shortcutSettingsCloudImportExport&&e("footer",{children:e("p",{children:[e(I,{icon:"cloud"})," ",e(p,{id:"C4T6O/"})]})})]})]})}to(E,n=>{for(const[i,s,o,a]of n)/^show/i.test(s)&&!o&&wi()});function Ll(){const{_:n}=re(),i=We(E),s=Li(),o=cn();return V(()=>{setTimeout(va,1e3)},[]),e(N,{children:[!!i.showCompose&&e(qe,{class:`solid ${i.composerState.minimized?"min":""}`,minimized:!!i.composerState.minimized,children:e(ba,{replyToStatus:typeof i.showCompose!="boolean"?i.showCompose.replyToStatus:window.__COMPOSE__?.replyToStatus||null,replyMode:E.showCompose?.replyMode||window.__COMPOSE__?.replyMode||"all",editStatus:E.showCompose?.editStatus||window.__COMPOSE__?.editStatus||null,draftStatus:E.showCompose?.draftStatus||window.__COMPOSE__?.draftStatus||null,quoteStatus:E.showCompose?.quoteStatus||window.__COMPOSE__?.quoteStatus||null,onClose:a=>{const{newStatus:c,instance:h,type:d,scheduledAt:r}=a||{};E.showCompose=!1,window.__COMPOSE__=null,c&&(E.reloadStatusPage++,r&&E.reloadScheduledPosts++,he({text:{post:n(r?{id:"IrX0sj"}:{id:"aTyHBW"}),reply:n(r?{id:"+38pse"}:{id:"lZdBKl"}),edit:n({id:"a5BN7l"})}[d||"post"],delay:1e3,duration:1e4,onClick:l=>{l.hideToast(),E.prevLocation=o,s(r?"/sp":h?`/${h}/s/${c.id}`:`/s/${c.id}`)}}))}})}),!!i.showSettings&&e(qe,{onClose:()=>{E.showSettings=!1},children:e(Zc,{onClose:()=>{E.showSettings=!1}})}),!!i.showAccounts&&e(qe,{onClose:()=>{E.showAccounts=!1},children:e(Oc,{onClose:()=>{E.showAccounts=!1}})}),!!i.showAccount&&e(qe,{onClose:()=>{E.showAccount=!1},children:e(Cr,{account:i.showAccount?.account||i.showAccount,instance:i.showAccount?.instance,onClose:({destination:a}={})=>{E.showAccount=!1}})}),!!i.showOpenLink&&e(qe,{onClose:()=>{E.showOpenLink=!1},children:e(Gr,{url:i.showOpenLink.url,linkText:i.showOpenLink.linkText,onClose:()=>{E.showOpenLink=!1}})}),!!i.showDrafts&&e(qe,{onClose:()=>{E.showDrafts=!1},children:e(_r,{onClose:()=>E.showDrafts=!1})}),!!i.showMediaModal&&e(qe,{onClick:a=>{(a.target===a.currentTarget||a.target.classList.contains("media"))&&(E.showMediaModal=!1)},children:e(Mo,{mediaAttachments:i.showMediaModal.mediaAttachments,instance:i.showMediaModal.instance,index:i.showMediaModal.mediaIndex,statusID:i.showMediaModal.statusID,onClose:()=>{E.showMediaModal=!1}})}),!!i.showShortcutsSettings&&e(qe,{onClose:()=>{E.showShortcutsSettings=!1},children:e(Tl,{onClose:()=>E.showShortcutsSettings=!1})}),!!i.showGenericAccounts&&e(qe,{onClose:()=>{E.showGenericAccounts=!1},children:e(xr,{instance:i.showGenericAccounts.instance,excludeRelationshipAttrs:i.showGenericAccounts.excludeRelationshipAttrs,postID:i.showGenericAccounts.postID,onClose:()=>E.showGenericAccounts=!1,blankCopy:i.showGenericAccounts.blankCopy})}),!!i.showMediaAlt&&e(qe,{onClose:a=>{E.showMediaAlt=!1},children:e(Lr,{alt:i.showMediaAlt.alt||i.showMediaAlt,lang:i.showMediaAlt?.lang,onClose:()=>{E.showMediaAlt=!1}})}),!!i.showEmbedModal&&e(qe,{class:"solid",onClose:()=>{E.showEmbedModal=!1},children:e(Ar,{html:i.showEmbedModal.html,url:i.showEmbedModal.url,width:i.showEmbedModal.width,height:i.showEmbedModal.height,onClose:()=>{E.showEmbedModal=!1}})}),!!i.showReportModal&&e(qe,{onClose:()=>{E.showReportModal=!1},children:e(gl,{account:i.showReportModal.account,post:i.showReportModal.post,onClose:()=>{E.showReportModal=!1}})}),!!i.showQrCodeModal&&e(qe,{class:"solid",onClose:()=>{E.showQrCodeModal=!1},children:e(ll,{text:i.showQrCodeModal.text,arena:i.showQrCodeModal.arena,backgroundMask:i.showQrCodeModal.backgroundMask,caption:i.showQrCodeModal.caption,onClose:()=>{E.showQrCodeModal=!1},onScannerClick:i.showQrCodeModal.onScannerClick})}),!!i.showQrScannerModal&&e(qe,{class:"solid",onClose:()=>{E.showQrScannerModal=!1},children:e(hl,{checkValidity:i.showQrScannerModal.checkValidity,actionableText:i.showQrScannerModal.actionableText,onClose:(...a)=>{i.showQrScannerModal.onClose&&i.showQrScannerModal.onClose(...a),E.showQrScannerModal=!1}})}),!!i.showImportExportAccounts&&e(qe,{onClose:()=>{E.showImportExportAccounts=!1},children:e(Er,{onClose:()=>{E.showImportExportAccounts=!1},exportDisabled:typeof i.showImportExportAccounts=="object"?i.showImportExportAccounts.exportDisabled:!1})})]})}const $l=ct(function(){const i=Li(),s={useKey:!0,ignoreEventWhen:o=>!!document.querySelector("#modal-container > *")||o.metaKey||o.ctrlKey||o.altKey};return Fe("g>h",()=>i("/"),s),Fe("g>n",()=>i("/notifications"),s),null});function Ii({accountID:n,onChange:i}){const{_:s}=re(),{masto:o}=ce(),[a,c]=R("default"),[h,d]=R(null),[r,l]=R(null),u=r!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:a==="loading"||u,onClick:()=>{c("loading"),d("accept"),(async()=>{try{const f=await o.v1.followRequests.$select(n).authorize();if(!f?.followedBy)throw new Error("Follow request not accepted");l(f),i()}catch{}c("default")})()},children:e(p,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:a==="loading"||u,class:"light danger",onClick:()=>{c("loading"),d("reject"),(async()=>{try{const f=await o.v1.followRequests.$select(n).reject();if(f?.followedBy)throw new Error("Follow request not rejected");l(f),i()}catch{c("default")}})()},children:e(p,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:u&&h?h==="accept"?e(I,{icon:"check-circle",alt:s({id:"bzMKg7"}),class:"follow-accepted"}):e(I,{icon:"x-circle",alt:s({id:"ekCRTP"}),class:"follow-rejected"}):e(De,{hidden:a!=="loading"})})]})}const Ls={mention:"comment",status:"notification",reblog:"rocket",follow:"follow",follow_request:"follow-add",favourite:"heart",poll:"poll",update:"pencil","admin.signup":"account-edit","admin.report":"account-warning",severed_relationships:"heart-break",moderation_warning:"alert",emoji_reaction:"emoji2","pleroma:emoji_reaction":"emoji2",annual_report:"celebrate",quote:"quote",quoted_update:"pencil"};function $s({account:n,emoji:i,emoji_url:s}){let o,a;typeof s=="string"?o=s:(o=s?.url,a=s?.staticUrl);const c=o?e(Ka,{url:o,staticUrl:a,alt:i}):i;return e(p,{id:"i5uN6K",values:{account:n,emojiObject:c}})}const pi={status:({account:n})=>e(p,{id:"idiIxW",values:{account:n}}),reblog:({count:n,account:i,postsCount:s,postType:o,components:{Subject:a}})=>e(p,{id:"jkt9P5",values:{0:Ze(n),1:Ze(n),count:n,postsCount:s,postType:o,account:i},components:{0:e(a,{clickable:n>1}),1:e("span",{title:n}),2:e(a,{clickable:n>1}),3:e("span",{title:n})}}),follow:({account:n,count:i,components:{Subject:s}})=>e(p,{id:"+71G9C",values:{0:Ze(i),count:i,account:n},components:{0:e(s,{clickable:i>1}),1:e("span",{title:i})}}),follow_request:({account:n})=>e(p,{id:"eh6NHW",values:{account:n}}),favourite:({account:n,count:i,postsCount:s,postType:o,components:{Subject:a}})=>e(p,{id:"RqX1mR",values:{0:Ze(i),1:Ze(i),count:i,postsCount:s,postType:o,account:n},components:{0:e(a,{clickable:i>1}),1:e("span",{title:i}),2:e(a,{clickable:i>1}),3:e("span",{title:i})}}),poll:()=>me._({id:"kIlJaS"}),"poll-self":()=>me._({id:"kpjzdN"}),"poll-voted":()=>me._({id:"moT7M8"}),update:({account:n})=>n?e(p,{id:"W+eFn3",values:{account:n}}):me._({id:"uzt17m"}),"favourite+reblog":({count:n,account:i,postsCount:s,postType:o,components:{Subject:a}})=>e(p,{id:"NunZZQ",values:{0:Ze(n),1:Ze(n),count:n,postsCount:s,postType:o,account:i},components:{0:e(a,{clickable:n>1}),1:e("span",{title:n}),2:e(a,{clickable:n>1}),3:e("span",{title:n})}}),quoted_update:({account:n})=>e(p,{id:"pkB7ti",values:{account:n}}),"admin.sign_up":({account:n})=>e(p,{id:"fJCCpx",values:{account:n}}),"admin.report":({account:n,targetAccount:i})=>e(p,{id:"eNfCmq",values:{account:n,targetAccount:i}}),severed_relationships:({name:n})=>e(p,{id:"Xl9v6+",values:{name:n},components:{0:e("i",{})}}),moderation_warning:()=>e("b",{children:e(p,{id:"YqffEv"})}),emoji_reaction:$s,"pleroma:emoji_reaction":$s,annual_report:({year:n})=>e(p,{id:"INLTzH",values:{year:n}})},Ml={account_suspension:({from:n,targetName:i})=>e(p,{id:"uRkcgw",values:{from:n,targetName:i},components:{0:e("i",{}),1:e("i",{})}}),domain_block:({from:n,targetName:i,followersCount:s,followingCount:o})=>e(p,{id:"Q3yArs",values:{from:n,targetName:i,followersCount:s,followingCount:o},components:{0:e("i",{}),1:e("i",{})}}),user_domain_block:({targetName:n,followersCount:i,followingCount:s})=>e(p,{id:"RQKWUa",values:{targetName:n,followersCount:i,followingCount:s},components:{0:e("i",{})}})},Pl={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"}},mi=30;function Nl({notification:n,instance:i,isStatic:s,disableContextMenu:o}){const{_:a}=re(),{masto:c}=ce(),{id:h,status:d,account:r,report:l,event:u,moderation_warning:f,annualReport:m,_ids:g,_accounts:y,_statuses:w,_groupKeys:k,sampleAccounts:b,notificationsCount:v,groupKey:_,_notificationsCount:S,_sampleAccountsCount:A}=n;let{type:C}=n;if((C==="mention"||C==="quote")&&!d)return null;const x=d?.reblog||d,M=x?.id,$=kt(),q=$===r?.id,D=d?.poll?.voted,F=!!d?.inReplyToAccountId&&d?.inReplyToAccountId!==$&&d?.account?.id===$;let Q=0,te=0;if(C==="favourite+reblog"){if(y)for(const W of y)W._types?.includes("favourite")&&Q++,W._types?.includes("reblog")&&te++;!te&&Q&&(C="favourite"),!Q&&te&&(C="reblog")}let Y;C==="poll"?Y=pi[q?"poll-self":D?"poll-voted":"poll"]:pi[C]?Y=pi[C]:Y=me._({id:"ODqZt1",values:{type:C}});const G=({clickable:W,...de})=>W?e("b",{tabIndex:"0",onClick:H,...de}):e("b",{...de}),K=v>0&&v>b?.length,j=K?"remote":"local";if(typeof Y=="function"){const W=(C==="favourite"||C==="reblog")&&v?K?v:b?.length:y?.length||b?.length||(r?1:0),de=w?.length||(d?1:0);if(C==="admin.report"){const se=l?.targetAccount;se&&(Y=Y({account:e(gt,{account:r,showAvatar:!0}),targetAccount:e(gt,{account:se,showAvatar:!0})}))}else if(C==="severed_relationships"){const se=u?.targetName;se&&(Y=Y({name:se}))}else if((C==="emoji_reaction"||C==="pleroma:emoji_reaction")&&n.emoji){const se=n.emoji_url||d?.emojis?.find?.(X=>X?.shortcode===n.emoji.replace(/^:/,"").replace(/:$/,""));Y=Y({account:e(gt,{account:r,showAvatar:!0}),emoji:n.emoji,emojiURL:se})}else C==="annual_report"?Y=Y({...n.annualReport}):Y=Y({account:r?e(gt,{account:r,showAvatar:!0}):b?.[0]&&e(gt,{account:b[0],showAvatar:!0}),count:W,postsCount:de,postType:F?"reply":"post",components:{Subject:G}})}const L=n.createdAt&&new Date(n.createdAt).toLocaleString(),Z={"favourite+reblog":me._({id:"+XOeb+"}),favourite:me._({id:"LQFF6J"}),reblog:me._({id:"phQpSa"}),follow:me._({id:"Ih01jh"})}[C]||me._({id:"bPwFdf"}),H=()=>{E.showGenericAccounts={heading:Z,accounts:y,showReactions:C==="favourite+reblog",excludeRelationshipAttrs:C==="follow"?["followedBy"]:[],postID:ht(M,i)}};if(d?.filtered){const W=d?.account?.id===$,de=sn(d.filtered,"notifications");if(!q&&!W&&de?.action==="hide")return null}return e("div",{class:`notification notification-${C}`,"data-notification-id":g||h,"data-group-key":k?.join(" ")||_,tabIndex:"0",children:[e("div",{class:`notification-type notification-${C}`,title:L,children:C==="favourite+reblog"?e(N,{children:[e(I,{icon:"rocket",size:"xl",alt:C,class:"reblog-icon"}),e(I,{icon:"heart",size:"xl",alt:C,class:"favourite-icon"})]}):e(I,{icon:Ls[C]||"notification",size:"xl",alt:C})}),e("div",{class:"notification-content",children:[C!=="mention"&&C!=="quote"&&e(N,{children:[e("p",{children:Y}),C==="follow_request"&&e(Ii,{accountID:r.id}),C==="severed_relationships"&&e("div",{children:[Ml[u.type]({from:i,...u}),e("br",{}),e("a",{href:`https://${i}/severed_relationships`,target:"_blank",rel:"noopener",children:e(p,{id:"YL6Y8P",components:{0:e(I,{icon:"external",size:"s"})}})}),"."]}),C==="moderation_warning"&&!!f&&e("div",{children:[a(Pl[f.action]()),e("br",{}),e("a",{href:`/disputes/strikes/${f.id}`,target:"_blank",rel:"noopener",children:e(p,{id:"YL6Y8P",components:{0:e(I,{icon:"external",size:"s"})}})})]}),C==="annual_report"&&e("div",{children:e(ge,{to:`/annual_report/${m?.year}`,children:e(p,{id:"5PGPvG"})})})]}),y?.length>1&&e("p",{class:"avatars-stack",children:[y.slice(0,mi).map(W=>e(N,{children:[e("a",{href:W.url,rel:"noopener",class:"account-avatar-stack",onClick:de=>{de.preventDefault(),E.showAccount=W},children:[e(ut,{url:W.avatarStatic,size:y.length<=10?"xxl":y.length<20?"xl":"l",alt:`${W.displayName} @${W.acct}`,squircle:W?.bot},W.id),C==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:W._types.map(de=>e(I,{icon:Ls[de],size:"s",class:`${de}-icon`}))})]},W.id)," "]},W.id)),(C==="favourite+reblog"||C==="favourite"||C==="reblog")&&j==="remote"?e("button",{type:"button",class:"small plain","data-group-keys":k?.join(" "),onClick:()=>{E.showGenericAccounts={heading:Z,accounts:y,fetchAccounts:async()=>{const W=await Promise.allSettled(k.map(async se=>{const X=c.v2.notifications.$select(se).accounts.list().values();return[se,(await X.next()).value]})),de=[];for(const se of W){const[X,we]=se.value,ke=/^favourite/.test(X)?"favourite":/^reblog/.test(X)?"reblog":null;if(ke)for(const Se of we){const Oe=de.find(xe=>xe.id===Se.id);Oe?Oe._types.push(ke):(Se._types=[ke],de.push(Se))}}return{done:!0,value:de}},showReactions:C==="favourite+reblog",postID:ht(M,i)}},children:["+",(C==="favourite"||C==="reblog")&&v-y.length,e(I,{icon:"chevron-down"})]}):e("button",{type:"button",class:"small plain",onClick:H,children:[y.length>mi&&`+${y.length-mi}`,e(I,{icon:"chevron-down"})]})]}),!y?.length&&b?.length>1&&e("p",{class:"avatars-stack",children:[b.map(W=>e(N,{children:[e("a",{href:W.url,rel:"noopener",class:"account-avatar-stack",onClick:de=>{de.preventDefault(),E.showAccount=W},children:e(ut,{url:W.avatarStatic,size:"xxl",alt:`${W.displayName} @${W.acct}`,squircle:W?.bot},W.id)},W.id)," "]},W.id)),v>b.length&&e(ge,{to:i?`/${i}/s/${d.id}`:`/s/${d.id}`,class:"button small plain centered",children:["+",v-b.length,e(I,{icon:"chevron-right"})]})]}),w?.length>1&&e("ul",{class:"notification-group-statuses",children:w.map(W=>e("li",{children:e(Ms,{class:`status-link status-type-${C}`,to:i?`/${i}/s/${W.id}`:`/s/${W.id}`,children:e(Ye,{status:W,size:"s",previewMode:!0,allowContextMenu:!0,allowFilters:!0})})},W.id))}),d&&(!w?.length||w?.length<=1)&&e(Ms,{class:`status-link status-type-${C}`,to:i?`/${i}/s/${M}`:`/s/${M}`,onContextMenu:o?void 0:W=>{const de=W.target.querySelector(".status");if(de){if(W.metaKey)return;W.preventDefault(),de.dispatchEvent(new MouseEvent("contextmenu",{clientX:W.clientX,clientY:W.clientY}))}},children:s?e(Ye,{status:x,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0}):e(Ye,{statusID:M,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0})})]})]})}function Ms(n){const i=Ha();return e(ge,{...n,"data-read-more":me._({id:"8fZueG"}),ref:i})}const bn=ct(Nl,(n,i)=>n.notification?.id===i.notification?.id);"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",n=>{const{type:i,id:s,accessToken:o}=n?.data||{};i==="notification"&&(E.routeNotification={id:s,accessToken:o})});const Dl=ct(function(){const{_:i}=re();if(!("serviceWorker"in navigator))return null;const s=We(E),{routeNotification:o}=s,{id:a,accessToken:c}=o||{},[h,d]=R(!1);St(()=>{if(!a||!c)return;const{instance:l}=ce(),{masto:u,instance:f}=ce({accessToken:c}),m=l===f,g=c?wa(c):$i();(async()=>{const y=await u.v1.notifications.$select(a).fetch();if(y&&g){const w=g.instanceURL,{type:k,status:b,account:v}=y,_=!!document.querySelector("#modal-container > *"),S=k==="follow"&&!!v?.id,A=!!v?.id,C=!!b?.id;S&&m?E.showAccount={account:v,instance:w}:_||!m||A&&C?d({id:a,account:g,notification:y,sameInstance:m}):C?location.hash=`/${l}/s/${b.id}`:S?location.hash=`/${l}/a/${v.id}`:location.hash="/notifications"}})()},[a,c]),St(()=>{navigator?.clearAppBadge&&navigator.clearAppBadge()},[]),on(l=>{l&&navigator?.clearAppBadge&&navigator.clearAppBadge()});const r=()=>{d(!1),E.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash="/notifications")};if(h){const{id:l,account:u,notification:f,sameInstance:m}=h;return e(qe,{onClick:g=>{g.target===g.currentTarget&&r()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:r,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:e("b",{children:e(p,{id:"5+87Pq"})})}),e("main",{children:[!m&&e("p",{children:e(p,{id:"k9N0Xk"})}),e("div",{class:"notification-peek",onClick:g=>{const{target:y}=g;(g.target.tagName==="BUTTON"||g.target.tagName==="A")&&r()},children:e(bn,{instance:u.instanceURL,notification:f,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(ge,{to:"/notifications",class:"button light",onClick:r,children:[e("span",{children:e(p,{id:"/WA/tl"})})," ",e(I,{icon:"arrow-right"})]})})]})]})})}return null}),oi=({limit:n}={})=>{const i=Ie.account.get("searchHistory")||[];return n?i.slice(0,n):i},Ol=10,Dn=(n,i=null)=>{if(!n?.trim?.())return;const s=oi(),o=s.findIndex(c=>c.query===n&&c.queryType===i);o!==-1&&s.splice(o,1),s.unshift({query:n.trim(),queryType:i,timestamp:Date.now()});const a=s.slice(0,Ol);Ie.account.set("searchHistory",a)},zl=(n,i=null)=>{const o=oi().filter(a=>!(a.query===n&&a.queryType===i));Ie.account.set("searchHistory",o)},Bl=()=>{Ie.account.set("searchHistory",[])},Kt=(n,i,s)=>{let o,a,c;if(i==="statuses")o=e(p,{id:"o1mMWT",values:{query:n},components:{0:e("q",{})}}),a=`/search?q=${encodeURIComponent(n)}&type=statuses`,c="document";else if(i==="accounts")o=e(p,{id:"cDoNQr",values:{query:n},components:{0:e("q",{})}}),a=`/search?q=${encodeURIComponent(n)}&type=accounts`,c="group";else if(i==="hashtags"){const[,h="#",d=n]=n.match(/^([#])?(.*)$/),r=`${h}${d}`;o=e(p,{id:"mFfcu0",values:{hashtag:r},components:{0:e("mark",{})}}),a=`/${s}/t/${d}`,c="hashtag"}else o=e(p,{id:"48oDit",values:{query:n},components:{0:e("small",{class:"insignificant"})}}),a=`/search?q=${encodeURIComponent(n)}`,c="search";return{label:o,to:a,icon:c}},Uo=ka((n,i)=>{const{_:s}=re(),{instance:o}=ce(),[a,c]=_t(),[h,d]=R(!1),[r,l]=R(a.get("q")||""),u=a.get("type"),f=U(null),m=U(null);Sa(i,()=>({setValue:w=>{l(w)},focus:()=>{m.current.focus()},select:()=>{m.current.select()},blur:()=>{m.current.blur()}}));const g=_e(()=>oi({limit:5}),[n?.hidden]),y=_e(()=>{if(!r)return[];const k=g.filter(v=>v.query===r?!1:v.query.toLowerCase().includes(r.toLowerCase())).slice(0,2).map(v=>({...Kt(v.query,v.queryType,o),queryType:v.queryType,isRecentSearch:!0,historyItem:v}));return[{...Kt(r,null,o),top:!u&&!/\s/.test(r),hidden:!!u},...k,{...Kt(r,"statuses",o),hidden:/^https?:/.test(r),top:/\s/.test(r),queryType:"statuses"},{...Kt(r,"hashtags",o),hidden:/^[@]/.test(r)||/^https?:/.test(r)||/\s/.test(r),top:/^[#]/.test(r),type:"link",queryType:"hashtags"},{label:e(p,{id:"gEoOUj",values:{query:r},components:{0:e("mark",{})}}),to:`/${r}`,hidden:!/^https?:/.test(r),top:/^https?:/.test(r),type:"link",icon:"arrow-right"},{...Kt(r,"accounts",o),queryType:"accounts"}].sort((v,_)=>{if(u){if(v.queryType===u)return-1;if(_.queryType===u)return 1}return v.top&&!_.top?-1:!v.top&&_.top?1:0}).filter(({hidden:v})=>!v)},[r,u,o]);return e("form",{ref:f,class:"search-popover-container",onSubmit:w=>{if(w.preventDefault(),/\/search/.test(location.hash))if(r){const b={q:r};u&&(b.type=u),c(b)}else c({});else r?location.hash=`/search?q=${encodeURIComponent(r)}${u?`&type=${u}`:""}`:location.hash="/search";Dn(r,u),n?.onSubmit?.(w)},children:[e("input",{ref:m,value:r,name:"q",type:"search",placeholder:s({id:"A1taO8"}),dir:"auto",autocomplete:"off",autocorrect:"off",autocapitalize:"off",spellCheck:"false",enterKeyHint:"search",onSearch:w=>{w.target.value||c({})},onInput:w=>{l(w.target.value),d(!0)},onFocus:()=>{d(!0);const w=f.current?.querySelector(".search-popover-item");w&&w.classList.add("focus")},onBlur:()=>{setTimeout(()=>{d(!1)},100),f.current?.querySelector(".search-popover-item.focus")?.classList.remove("focus")},onKeyDown:w=>{const{key:k}=w;switch(k){case"Escape":d(!1);break;case"Down":case"ArrowDown":if(w.preventDefault(),h){const b=f.current.querySelector(".search-popover-item.focus");if(b){let v=b.nextElementSibling;for(;v&&v.hidden;)v=v.nextElementSibling;v&&(v.classList.add("focus"),Array.from(v.parentElement.children).filter(S=>S!==v).forEach(S=>{S.classList.remove("focus")}))}else{const v=f.current.querySelector(".search-popover-item");v&&v.classList.add("focus")}}break;case"Up":case"ArrowUp":if(w.preventDefault(),h){const b=document.querySelector(".search-popover-item.focus");if(b){let v=b.previousElementSibling;for(;v&&v.hidden;)v=v.previousElementSibling;v&&(v.classList.add("focus"),Array.from(v.parentElement.children).filter(S=>S!==v).forEach(S=>{S.classList.remove("focus")}))}else{const v=document.querySelectorAll(".search-popover-item"),_=v[v.length-1];_&&_.classList.add("focus")}}break;case"Enter":if(h){const b=document.querySelector(".search-popover-item.focus");b&&(w.preventDefault(),b.click()),d(!1),n?.onSubmit?.(w)}break}}}),e("div",{class:"search-popover",hidden:!h,children:[!r&&g.length>0&&e("div",{class:"search-popover-recent-searches",children:[e("div",{class:"search-popover-header",children:[e(I,{icon:"history",size:"s"}),e(p,{id:"4R1B1H"})]}),g.map((w,k)=>{const{label:b,to:v,icon:_}=Kt(w.query,w.queryType,o);return e(ge,{to:v,class:`search-popover-item ${k===0?"focus":""}`,onClick:S=>{Dn(w.query,w.queryType),n?.onSubmit?.(S)},children:[e(I,{icon:_,class:"more-insignificant"}),e("span",{children:b})]},`${w.query}-${w.queryType}-${w.timestamp}`)}),e(ge,{to:"/search",class:"search-popover-item search-history-see-all",children:[e(I,{icon:"more2",class:"more-insignificant"}),e("span",{children:e(p,{id:"gukqfD"})})]})]}),y.map(({label:w,to:k,icon:b,queryType:v,isRecentSearch:_,historyItem:S},A)=>e(ge,{to:k,class:`search-popover-item ${_?"search-popover-item-recent":""} ${A===0?"focus":""}`,onClick:C=>{_||Dn(r,v),n?.onSubmit?.(C)},children:[e(I,{icon:b,class:"more-insignificant"}),e("span",{children:w})]},_?`recent-${S.query}-${S.queryType}-${S.timestamp}`:`suggestion-${v||"general"}-${A}`))]})]})}),ql=ct(function({onClose:i=()=>{}}){const[s,o]=R(!1),a=U(null);Fe(["Slash","/"],d=>{o(!0),setTimeout(()=>{a.current?.focus?.(),a.current?.select?.()},0)},{useKey:!0,preventDefault:!0,ignoreEventWhen:d=>{const r=/\/search/.test(location.hash),l=!!document.querySelector("#modal-container > *");return r||l||d.metaKey||d.ctrlKey||d.altKey||d.shiftKey}});const c=()=>{o(!1),i()};Fe("esc",d=>{a.current?.blur?.(),c()},{enabled:s,enableOnFormTags:!0,preventDefault:!0,useKey:!0,ignoreEventWhen:d=>d.metaKey||d.ctrlKey||d.altKey||d.shiftKey});const h=!s;return e("div",{id:"search-command-container",hidden:h,onClick:d=>{d.target===d.currentTarget&&c()},children:e(Uo,{ref:a,hidden:h,onSubmit:()=>{c()}})})});function Ul(){const{_:n,_:i}=re(),{instance:s}=ce(),o=We(E),{shortcuts:a,settings:c}=o;if(!a.length)return null;const h=c.shortcutsViewMode==="multi-column"||!c.shortcutsViewMode&&c.shortcutsColumnsMode,d=U(),r=U(),l=U(!1),u=a.map((y,w)=>{const{type:k,...b}=y;if(!Gn[k])return null;let{id:v,path:_,title:S,subtitle:A,icon:C}=Gn[k];return typeof v=="function"&&(v=v(b,w)),typeof _=="function"&&(_=_({...b,instance:b.instance||s},w)),typeof S=="function"?S=S(b,w):S?.id&&(S=i(S)),typeof A=="function"?A=A(b,w):A?.id&&(A=i(A)),typeof C=="function"&&(C=C(b,w)),v==="lists"&&(l.current=!0),{id:v,path:_,title:S,subtitle:A,icon:C}}).filter(Boolean);V(()=>{if(o.settings.shortcutsViewMode==="tab-menu-bar"&&r.current){const y=setTimeout(()=>{const w=r.current?.querySelector(".is-active");w&&w.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},100);return()=>clearTimeout(y)}},[]);const f=Li();Fe(["1","2","3","4","5","6","7","8","9"],y=>{const w=parseInt(y.key,10)-1;if(w<u.length){const{path:k}=u[w];k&&(f(k),d.current?.closeMenu?.())}},{enabled:!h,useKey:!0,ignoreEventWhen:y=>y.metaKey||y.ctrlKey||y.altKey||y.shiftKey});const[m,g]=R([]);return h?null:e("div",{id:"shortcuts",children:o.settings.shortcutsViewMode==="tab-menu-bar"?e("nav",{ref:r,class:"tab-bar",onContextMenu:y=>{y.preventDefault(),E.showShortcutsSettings=!0},children:e("ul",{children:u.map(({id:y,path:w,title:k,subtitle:b,icon:v},_)=>e("li",{children:e(ge,{class:b?"has-subtitle":"",to:w,onClick:S=>{if(S.target.classList.contains("is-active")){S.preventDefault();const A=document.getElementById(`${y}-page`);if(A){A.scrollTop=0;const C=A.querySelector(".updates-button");C&&C.click()}}},children:[e(I,{icon:v,size:"xl"}),e("span",{children:[e(Pn,{children:k}),b&&e(N,{children:[e("br",{}),e("small",{children:b})]})]})]})},`${_}-${y}-${k}-${b}-${w}`))})}):e(ft,{instanceRef:d,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:y=>{y.open&&l.current&&kn().then(g)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:y=>{y.preventDefault(),E.showShortcutsSettings=!0},onTransitionStart:y=>{try{const{target:w}=y;getComputedStyle(w).pointerEvents==="none"&&d.current?.closeMenu?.()}catch{}},children:e(I,{icon:"shortcut",size:"xl",alt:n({id:"CTqTgr"})})}),children:u.map(({id:y,path:w,title:k,subtitle:b,icon:v},_)=>y==="lists"?e(wn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(N,{children:[e(I,{icon:v,size:"l"}),e("span",{class:"menu-grow",children:e(Pn,{children:k})}),e(I,{icon:"chevron-right"})]}),children:[e(He,{to:"/l",children:e("span",{children:e(p,{id:"BHWx+g"})})}),e(je,{}),m?.map(S=>e(He,{to:`/l/${S.id}`,children:e("span",{children:[S.title,S.exclusive&&e(N,{children:[" ",e(Zt,{})]})]})},S.id))]}):e(He,{to:w,class:"glass-menu-item",children:[e(I,{icon:v,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(Pn,{children:k})}),b&&e(N,{children:[" ",e("small",{class:"more-insignificant",children:b})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:_+1})]},`${_}-${y}-${k}-${b}-${w}`))})})}const Fl=ct(Ul);function Kl(n){let i=[],s=[],o=0;for(let a=0;a<n.length;a++){const c=n[a];c.reblog&&!c.account?.group?(s.push(c),o++):(i.push(c),o<3&&(o=0))}if(n.length>10&&(s.length>n.length/4||o>=3)){const a=s.map(c=>c.id);if(s.length>n.length*3/4)i=[...i,{id:a,items:s,type:"boosts"}];else{const c=Math.floor(i.length/2);i=[...i.slice(0,c),{id:a,items:s,type:"boosts"},...i.slice(c)]}return i}else return n}function Ps(n,i){const s=Ie.account.get("boostedStatusIDs")||{},o=n.filter(c=>{if(!c.reblog)return!0;const h=`${i}-${c.reblog.id}`,d=s[h];return d&&d!==c.id?!1:(s[h]=c.id,!0)}),a=Object.keys(s);return a.length>50&&a.slice(0,a.length-50).forEach(c=>{delete s[c]}),Ie.account.set("boostedStatusIDs",s),o}function Hl(n,i){const s=[];let o=0;n.forEach(d=>{for(let l=0;l<s.length;l++){if(s[l].find(u=>u.id===d.id))return;if(s[l].find(u=>u.id===d.inReplyToId)||s[l].find(u=>u.inReplyToId===d.id)){s[l].push(d);return}}const r=n.find(l=>l.id===d.inReplyToId);r&&(s[o++]=[d,r])});for(let d=0;d<s.length;d++)for(let r=d+1;r<s.length;r++)s[d].find(u=>s[r].includes(u))&&(s[d]=[...s[d],...s[r]],s[d]=s[d].filter((u,f,m)=>m.findIndex(g=>g.id===u.id)===f),s.splice(r,1),r--);s.forEach(d=>{d.sort((r,l)=>!r.inReplyToId&&!l.inReplyToId?Date.parse(r.createdAt)-Date.parse(l.createdAt):r.inReplyToId===l.id?1:l.inReplyToId===r.id||!r.inReplyToId?-1:l.inReplyToId?Date.parse(r.createdAt)-Date.parse(l.createdAt):1)}),s.forEach(d=>{const r=d[0].account.id;d.forEach(l=>{l.account.id!==r&&(l._differentAuthor=!0)})}),s.length;const a=[],c=[],h=[];return n.forEach(d=>{if(d.reblog){a.push(d);return}for(let r=0;r<s.length;r++)if(s[r].find(l=>l.id===d.id)){if(c.includes(r))return;const l=s[r];l.sort((f,m)=>Date.parse(f.createdAt)-Date.parse(m.createdAt));const u=l[0].account.id;a.push({id:l.map(f=>f.id),items:l,type:l.every(f=>f.account.id===u)?"thread":"conversation"}),c.push(r);return}if(d.inReplyToId&&d.inReplyToAccountId!==d.account.id){const r=ht(d.id,i);E.statusReply[r]||h.push({sKey:r,inReplyToId:d.inReplyToId})}a.push(d)}),h?.length&&queueMicrotask(()=>{const{masto:d}=ce({instance:i});async function r(){for(let l=0;l<h.length;l++){const{sKey:u,inReplyToId:f}=h[l];try{const m=await jl(f,d);Je(m,i,{skipThreading:!0}),E.statusReply[u]={id:m.id,instance:i},await new Promise(g=>setTimeout(g,1e3))}catch{}}}if(Qe("@mastodon/fetch-multiple-statuses")){const l=h.map(({inReplyToId:u})=>u);(async()=>{try{const u=await d.v1.statuses.list({id:l});if(u?.length)for(const f of u){Je(f,i,{skipThreading:!0});const m=h.find(({inReplyToId:g})=>g===f.id)?.sKey;m&&(E.statusReply[m]={id:f.id,instance:i})}else r()}catch{r()}})()}else r()}),a}const jl=Ct((n,i)=>i.v1.statuses.$select(n).fetch());async function Fo(n,i){const s=await _l();if(!s.length)return;const{statusFollowedTags:o}=E,a=[];if(n.forEach(c=>{if(c.reblog)return;const{id:h,content:d,tags:r=[]}=c,l=ht(h,i);if(o[l]?.length)return;const u=Il(d);if(!u.length&&!r.length)return;const f=s.reduce((m,g)=>((u.some(y=>y.toLowerCase()===g.name.toLowerCase())||r.some(y=>y.name.toLowerCase()===g.name.toLowerCase()))&&m.push(g.name),m),[]);f.length&&a.push({item:c,sKey:l,followedTags:f})}),a.length){const c=a.map(d=>d.item.account),h=await Qn(c);if(!h)return;a.forEach(d=>{const{item:r,sKey:l,followedTags:u}=d,f=h[r.account.id];f&&!f.following&&(o[l]=u)})}}function Yl(){E.statusFollowedTags={}}function Vl({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:s=1,scrollThresholdStart:o=10,scrollThresholdEnd:a=10,direction:c="vertical",distanceFromStartPx:h,distanceFromEndPx:d}={}){const[r,l]=R(null),[u,f]=R(!1),[m,g]=R(!1),[y,w]=R(!1),[k,b]=R(!1),v=c==="vertical";return St(()=>{const _=n.current;if(!_)return{};let S=v?_.scrollTop:_.scrollLeft;function A(){const{scrollTop:C,scrollLeft:x,scrollHeight:M,scrollWidth:$,clientHeight:q,clientWidth:D}=_,F=v?C:x,Q=v?M:$,te=v?q:D,Y=Math.abs(F-S),G=h||Math.min(te*i,Q,F),K=d||Math.min(te*s,Q,Q-F-te);Y>=(S<F?a:o)&&(l(S<F?"end":"start"),S=F),f(F<=0),g(F+te>=Q),w(F<=G),b(F+te>=Q-K)}return _.addEventListener("scroll",A,{passive:!0}),()=>_.removeEventListener("scroll",A)},[i,s,o,a]),{scrollDirection:r,reachStart:u,reachEnd:m,nearReachStart:y,nearReachEnd:k,init:()=>{n.current&&n.current.dispatchEvent(new Event("scroll"))}}}function Gl({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:s=1,scrollThresholdStart:o=10,scrollThresholdEnd:a=10,direction:c="vertical",distanceFromStartPx:h,distanceFromEndPx:d,init:r}={},l){if(!l)return;const u=c==="vertical",f=U(null),m=U(null),g=ja(()=>{let y=!1,w=!1,k=!1,b=!1;const v=n.current,{scrollTop:_,scrollLeft:S,scrollHeight:A,scrollWidth:C,clientHeight:x,clientWidth:M}=v,$=u?_:S,q=u?A:C,D=u?x:M,F=$-f.current,Q=F>0,te=Q?a:o,Y=h||Math.min(D*i,q,$),G=d||Math.min(D*s,q,q-$-D);Math.abs(F)>=te&&(m.current=Q?"end":"start",f.current=$),y=$<=0,w=$+D>=q,k=$<=Y,b=$+D>=q-G,l({scrollDirection:m.current,reachStart:y,reachEnd:w,nearReachStart:k,nearReachEnd:b})},500,{leading:!1});return St(()=>{const y=n.current;return y&&(f.current=y[u?"scrollTop":"scrollLeft"],y.addEventListener("scroll",g,{passive:!0})),()=>{y&&y.removeEventListener("scroll",g)}},[]),V(()=>{r&&n.current&&queueMicrotask(()=>{n.current.dispatchEvent(new Event("scroll"))})},[r]),{resetScrollDirection:()=>{m.current=null}}}function Wl({class:n,statusID:i,status:s,instance:o,parent:a,onMediaClick:c}){const{_:h}=re();let d=ht(i,o);const r=We(E);if(s||(s=r.statuses[d]||r.statuses[i],d=ht(s?.id,o)),!s)return null;const{account:{acct:l,avatar:u,avatarStatic:f,id:m,url:g,displayName:y,username:w,emojis:k,bot:b,group:v},id:_,repliesCount:S,reblogged:A,reblogsCount:C,favourited:x,favouritesCount:M,bookmarked:$,poll:q,muted:D,sensitive:F,spoilerText:Q,visibility:te,language:Y,editedAt:G,filtered:K,card:j,createdAt:L,inReplyToId:Z,inReplyToAccountId:H,content:W,mentions:de,mediaAttachments:se,reblog:X,uri:we,url:ke,emojis:Se,_deleted:Oe,_pinned:xe}=s;if(!se?.length)return null;const Le=Ne=>{Ne.shiftKey},Re=_e(()=>kt(),[]),ze=_e(()=>Re&&Re===m,[m,Re]),Ue=Ca(Jn),Ke=!ze&&sn(K,Ue);if(Ke?.action==="hide")return null;const Ve=F,Te=(Ei()["reading:expand:media"]?.toLowerCase()||"default")==="show_all",ae=a||"div";return se.map((Ne,ee)=>{const Ae=`${d}-${Ne.id}`,O=Ke?.titlesStr;return e(ae,{"data-state-post-id":d,onMouseEnter:Le,"data-spoiler-text":Q||(F?h({id:"FKojeB"}):void 0),"data-filtered-text":Ke?h(O?{id:"7FGvtQ",values:{filterTitleStr:O}}:{id:"03Qqf9"}):void 0,class:`
media-post
${Ke?"filtered":""}
${Ve?"has-spoiler":""}
${Te?"show-media":""}
`,children:e(fo,{class:n,media:Ne,lang:Y,to:`/${o}/s/${_}?media-only=${ee+1}`,onClick:c?be=>c(be,ee,Ne,s):void 0})},Ae)})}const Ns=ct(Wl);function Zl(n){const{_:i}=re(),s=We(E),{masto:o,instance:a,authenticated:c}=ce(),[h,d]=_e(()=>{const _=nn();return[_.find(A=>A.info.id===kt())||_[0],_.length>1]},[]),r=(s.settings.shortcutsViewMode==="multi-column"||!s.settings.shortcutsViewMode&&s.settings.shortcutsColumnsMode)&&!s.shortcuts.find(_=>_.type==="following"),l=oo(()=>{E.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),u=U(),[f,m]=R(void 0),g=co([0,0,s.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),y=U();async function w(_){return(_||!y.current)&&(y.current=o.v1.mutes.list({limit:80}).values()),await y.current.next()}const k=U();async function b(_){return(_||!k.current)&&(k.current=o.v1.blocks.list({limit:80}).values()),await k.current.next()}const v=U();return e(N,{children:[e("button",{ref:u,type:"button",class:`button plain nav-menu-button ${d?"with-avatar":""} ${f==="open"?"active":""}`,style:{position:"relative"},onClick:()=>{v.current=Date.now(),m(_=>_?void 0:"open")},onContextMenu:_=>{_.preventDefault(),E.showAccounts=!0},...l(),children:[d&&e(ut,{url:h?.info?.avatar||h?.info?.avatarStatic,size:"l",squircle:h?.info?.bot}),e(I,{icon:"menu",size:d?"s":"l",alt:i({id:"zucql+"})})]}),e(Oi,{menuClassName:"nav-menu",state:f,anchorRef:u,onClose:()=>{m(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-v.current<300}},portal:{target:document.body},...n,overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:g,unmountOnClose:!0,children:[!!s.appVersion?.commitHash&&s.appVersion.commitHash!=="ac85274"&&e("div",{class:"top-menu",children:[e(ve,{onClick:()=>{confirm(i({id:"Djbaby"}))&&(async()=>{try{location.reload()}catch{}})()},children:[e(I,{icon:"sparkles",class:"sparkle-icon",size:"l"})," ",e("span",{children:e(p,{id:"95IFnD"})})]}),e(je,{})]}),e("section",{children:[e(He,{to:"/",children:[e(I,{icon:"home",size:"l"})," ",e("span",{children:e(p,{id:"i0qMbr"})})]}),c?e(N,{children:[r&&e(He,{to:"/following",children:[e(I,{icon:"following",size:"l"})," ",e("span",{children:e(p,{id:"following.title"})})]}),e(He,{to:"/catchup",children:[e(I,{icon:"history2",size:"l"}),e("span",{children:e(p,{id:"xrl8fj"})})]}),Qe("@mastodon/mentions")&&e(He,{to:"/mentions",children:[e(I,{icon:"at",size:"l"})," ",e("span",{children:e(p,{id:"/bZzdR"})})]}),e(He,{to:"/notifications",children:[e(I,{icon:"notification",size:"l"})," ",e("span",{children:e(p,{id:"iDNBZe"})}),s.notificationsShowNew&&e("sup",{title:i({id:"isRobC"}),style:{opacity:.5},children:[" ","•"]})]}),e(je,{}),h?.info?.id&&e(He,{to:`/${a}/a/${h.info.id}`,children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(p,{id:"vERlcd"})})]}),e(Xl,{menuState:f}),e(He,{to:"/b",children:[e(I,{icon:"bookmark",size:"l"})," ",e("span",{children:e(p,{id:"7Ff7ia"})})]}),e(wn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(N,{children:[e(I,{icon:"more",size:"l"}),e("span",{class:"menu-grow",children:e(p,{id:"24misb"})}),e(I,{icon:"chevron-right"})]}),children:[e(He,{to:"/f",children:[e(I,{icon:"heart",size:"l"})," ",e("span",{children:e(p,{id:"zZOZj7"})})]}),e(He,{to:"/fh",children:[e(I,{icon:"hashtag",size:"l"})," ",e("span",{children:e(p,{id:"Xi1/bw"})})]}),e(He,{to:"/sp",children:[e(I,{icon:"schedule",size:"l"})," ",e("span",{children:e(p,{id:"+GkIdc"})})]}),e(je,{}),Qe("@mastodon/filters")&&e(He,{to:"/ft",children:[e(I,{icon:"filters",size:"l"})," ",e("span",{children:e(p,{id:"cSev+j"})})]}),e(ve,{onClick:()=>{E.showGenericAccounts={id:"mute",heading:i({id:"sOKhEA"}),fetchAccounts:w,excludeRelationshipAttrs:["muting"]}},children:[e(I,{icon:"mute",size:"l"})," ",e("span",{children:e(p,{id:"n1sANU"})})]}),e(ve,{onClick:()=>{E.showGenericAccounts={id:"block",heading:i({id:"nL8nlr"}),fetchAccounts:b,excludeRelationshipAttrs:["blocking"]}},children:[e(I,{icon:"block",size:"l"})," ",e("span",{children:e(p,{id:"r3RRWo"})})]})," "]}),e(je,{}),e(ve,{onClick:()=>{E.showAccounts=!0},children:[e(I,{icon:"group",size:"l"})," ",e("span",{children:e(p,{id:"7e0O8Z"})})]})]}):e(N,{children:[e(je,{}),e(He,{to:"/login",children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(p,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(je,{}),e(He,{to:"/search",children:[e(I,{icon:"search",size:"l"})," ",e("span",{children:e(p,{id:"A1taO8"})})]}),e(He,{to:`/${a}/trending`,children:[e(I,{icon:"chart",size:"l"})," ",e("span",{children:e(p,{id:"4/iCqx"})})]}),e(He,{to:`/${a}/p/l`,children:[e(I,{icon:"building",size:"l"})," ",e("span",{children:e(p,{id:"d5zxa4"})})]}),e(He,{to:`/${a}/p`,children:[e(I,{icon:"earth",size:"l"})," ",e("span",{children:e(p,{id:"4ERYY7"})})]}),c?e(N,{children:[e(je,{className:"divider-grow"}),e(ve,{onClick:()=>{E.showKeyboardShortcutsHelp=!0},children:[e(I,{icon:"keyboard",size:"l"})," ",e("span",{children:e(p,{id:"77Emn0"})})]}),e(ve,{onClick:()=>{E.showShortcutsSettings=!0},children:[e(I,{icon:"shortcut",size:"l"})," ",e("span",{children:e(p,{id:"8Kudkr"})})]}),e(ve,{onClick:()=>{E.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(p,{id:"uVbUP8"})})]})]}):e(N,{children:[e(je,{}),e(ve,{onClick:()=>{E.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(p,{id:"uVbUP8"})})]})]})]})]})]})}function Xl({menuState:n}){const i=Qe("@mastodon/lists"),[s,o]=R([]);return V(()=>{i&&n==="open"&&kn().then(o)},[n,i]),s.length>0?e(wn,{menuClassName:"nav-submenu",overflow:"auto",gap:-8,label:e(N,{children:[e(I,{icon:"list",size:"l"}),e("span",{class:"menu-grow",children:e(p,{id:"h16FyT"})}),e(I,{icon:"chevron-right"})]}),children:[e(He,{to:"/l",children:e("span",{children:e(p,{id:"BHWx+g"})})}),s?.length>0&&e(N,{children:[e(je,{}),s.map(a=>e(He,{to:`/l/${a.id}`,children:e("span",{children:[a.title,a.exclusive&&e(N,{children:[" ",e(Zt,{})]})]})},a.id))]})]}):i&&e(He,{to:"/l",children:[e(I,{icon:"list",size:"l"}),e("span",{children:e(p,{id:"h16FyT"})})]})}const qt=ct(Zl),In={block:"start",inline:"center",behavior:"smooth"};function Mt({title:n,titleComponent:i,id:s,instance:o,emptyText:a,errorText:c,useItemID:h,boostsCarousel:d,fetchItems:r=()=>{},checkForUpdates:l=()=>{},checkForUpdatesInterval:u=15e3,headerStart:f,headerEnd:m,timelineStart:g,refresh:y,view:w,filterContext:k,showFollowedTags:b,showReplyParent:v,clearWhenRefresh:_}){const{_:S}=re(),A=We(E),[C,x]=R([]),[M,$]=R("start"),[q,D]=R(!1),[F,Q]=R(!1),[te,Y]=R(!0),G=U();__BENCHMARK.start(`timeline-${s}-load`);const K=_e(()=>Mi(),[]),j=w!=="media",L=U(0),Z=Ya(le=>{Q(!1),$("loading"),(async()=>{try{const $e=L.current=Date.now();let{done:Te,value:ae}=await r(le);if($e!==L.current)return;if(Array.isArray(ae)){const[Ne,ee]=ae.reduce((Ae,O)=>(O._pinned?Ae[0].push(O):Ae[1].push(O),Ae),[[],[]]);ae=ee,j&&(d&&(ae=Kl(ae)),ae=Hl(ae,o)),Ne.length&&(ae=Ne.concat(ae)),x(le?ae:Ae=>[...Ae,...ae]),ae.length||(Te=!0),D(!Te)}else D(!1);$("default"),__BENCHMARK.end(`timeline-${s}-load`)}catch{$("error"),le&&!C.length&&c&&he(c)}finally{Z.cancel()}})()},1e3,{leading:!0}),H=".timeline-item, .timeline-item-alt",W=Fe("j, shift+j",(le,$e)=>{if(le.shiftKey!==$e.shift)return;const Te=document.activeElement.closest(H),ae=Te?.getBoundingClientRect(),Ne=Array.from(G.current.querySelectorAll(H)).filter(ee=>!!ee.offsetHeight);if(Te&&ae.top<G.current.clientHeight&&ae.bottom>0){const ee=Ne.indexOf(Te);let Ae=Ne[ee+1];$e.shift&&(Ae=Ne.find((O,be)=>be>ee&&!O.classList.contains("timeline-item-alt"))),Ae&&(Ae.focus(),Ae.scrollIntoView(In))}else{const ee=Ne.find(Ae=>{const O=Ae.getBoundingClientRect();return O.top>=44&&O.left>=0});ee&&(ee.focus(),ee.scrollIntoView(In))}},{useKey:!0,ignoreEventWhen:le=>le.metaKey||le.ctrlKey||le.altKey}),de=Fe("k, shift+k",(le,$e)=>{if(le.shiftKey!==$e.shift)return;const Te=document.activeElement.closest(H),ae=Te?.getBoundingClientRect(),Ne=Array.from(G.current.querySelectorAll(H)).filter(ee=>!!ee.offsetHeight);if(Te&&ae.top<G.current.clientHeight&&ae.bottom>0){const ee=Ne.indexOf(Te);let Ae=Ne[ee-1];$e.shift&&(Ae=Ne.findLast((O,be)=>be<ee&&!O.classList.contains("timeline-item-alt"))),Ae&&(Ae.focus(),Ae.scrollIntoView(In))}else{const ee=Ne.find(Ae=>{const O=Ae.getBoundingClientRect();return O.top>=44&&O.left>=0});ee&&(ee.focus(),ee.scrollIntoView(In))}},{useKey:!0,ignoreEventWhen:le=>le.metaKey||le.ctrlKey||le.altKey}),se=Fe(["enter","o"],()=>{const le=document.activeElement;le?.matches(H)&&le.click()},{useKey:!0,ignoreEventWhen:le=>le.metaKey||le.ctrlKey||le.altKey||le.shiftKey}),X=C.length>0&&M!=="loading"&&F,we=it(()=>{X&&Z(!0),G.current?.scrollTo({top:0,behavior:"smooth"})},[Z,X]),ke=Fe(".",we,{useKey:!0,ignoreEventWhen:le=>le.metaKey||le.ctrlKey||le.altKey||le.shiftKey}),Se=U(),[Oe,xe]=R(!1),Le=it(({scrollDirection:le,nearReachStart:$e,reachStart:Te})=>{if(Se.current){const ae=le==="end"&&!$e;Se.current.hidden=ae}xe($e),Te&&Z(!0)},[xe,Z]),{resetScrollDirection:Re}=Gl({scrollableRef:G,distanceFromEnd:2,scrollThresholdStart:44},Le);V(()=>{G.current?.scrollTo({top:0}),Z(!0)},[]);const ze=U(!0);V(()=>{if(ze.current){ze.current=!1;return}_&&C?.length&&(Z.cancel?.(),x([])),Z(!0)},[_,y]);const Ue=U(w);V(()=>{Ue.current!==w&&(Ue.current=w,x([]))},[w]);const Ke=it(async({disableIdleCheck:le=!1}={})=>{const $e=G.current?getComputedStyle(G.current).pointerEvents==="none":!1;A.settings.autoRefresh&&G.current.scrollTop<16&&(le||window.__IDLE__)&&!td()&&!$e?Z(!0):await l()&&Q(!0)},[s,Z,l,A.settings.autoRefresh]),Ve=U();return on(le=>{if(le){const $e=Date.now()-Ve.current;(!Ve.current||$e>1e3*3)&&Ke({disableIdleCheck:!0})}else Ve.current=Date.now();Y(le)},[l,Ke,A.settings.autoRefresh]),Di(Ke,te&&!F?u*(Oe?1:2):null),e(Jn.Provider,{value:k,children:e("div",{id:`${s}-page`,class:`deck-container ${K?"deck-container-media-first":""}`,ref:le=>{G.current=le,W.current=le,de.current=le,se.current=le,ke.current=le},tabIndex:"-1",onClick:le=>{Se.current&&le.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{Se.current.hidden=!1,Re()},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:Se,onClick:le=>{le.target.closest("a, button")||G.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:le=>{le.target.closest("a, button")||Z(!0)},class:M==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(qt,{}),f??e(ge,{to:"/",class:"button plain home-button",children:e(I,{icon:"home",size:"l",alt:S({id:"i0qMbr"})})})]}),n&&(i||e("h1",{children:n})),e("div",{class:"header-side",children:!!m&&m})]}),X&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:we,children:[e(I,{icon:"arrow-up"})," ",e(p,{id:"2yr1/p"})]})]}),!!g&&e("div",{class:`timeline-start ${M==="loading"?"loading":""}`,children:g}),C.length?e(N,{children:[e("ul",{class:`timeline ${w?`timeline-${w}`:""}`,children:[C.map(le=>e(Ql,{status:le,instance:o,useItemID:h,filterContext:k,view:w,showFollowedTags:b,showReplyParent:v,mediaFirst:K},le.id+le?._pinned+w)),q&&M==="loading"&&(w==="media"?null:e(N,{children:[e("li",{style:{height:"20vh"},children:e(Ye,{skeleton:!0,mediaFirst:K})}),e("li",{style:{height:"25vh"},children:e(Ye,{skeleton:!0,mediaFirst:K})})]}))]}),M==="default"&&(q?e(Lt,{root:G.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:le=>{le&&Z()},children:e("button",{type:"button",class:"plain block",onClick:()=>Z(),style:{marginBlockEnd:"6em"},children:e(p,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(p,{id:"2EYeAZ"})}))]}):M==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((le,$e)=>w==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(Ye,{skeleton:!0,mediaFirst:K})},$e))}):M!=="error"&&M!=="start"&&e("p",{class:"ui-state",children:a}),M==="error"&&e("p",{class:"ui-state",children:[c,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>Z(!C.length),children:e(p,{id:"KDw4GX"})})]})]})})})}const Ql=ct(({status:n,instance:i,useItemID:s,filterContext:o,view:a,showFollowedTags:c,showReplyParent:h,mediaFirst:d})=>{const{_:r}=re(),{id:l,reblog:u,items:f,type:m,_pinned:g}=n;g&&(s=!1);const y=u?.id||l,w=i?`/${i}/s/${y}`:`/s/${y}`;if(f){let b=Gt(f,o),v="";if(m==="boosts"?v=me._({id:"NuqppG",values:{0:b.length}}):m==="pinned"&&(v=r({id:"GlfmCu"})),m==="boosts"||m==="pinned"){const A=new Set;if(b.sort((C,x)=>{const M=sn(C.filtered,o),$=sn(x.filtered,o);return M&&M?.action!=="blur"&&A.add(C.id),$&&$?.action!=="blur"&&A.add(x.id),M&&!$?1:!M&&$?-1:0}),A.size>=2){const x=[],M=[];b.forEach(q=>{A.has(q.id)?M.push(q):x.push(q)});const $=[];for(let q=0;q<M.length;q+=5)$.push({_grouped:!0,posts:M.slice(q,q+5)});b=x.concat($)}return e("li",{class:"timeline-item-carousel",children:e(Jl,{title:v,class:`${m}-carousel`,children:b.map(C=>{const{id:x,reblog:M,_pinned:$,_grouped:q}=C;if(q)return e("li",{class:"timeline-item-carousel-group",children:C.posts.map(Q=>{const{id:te,reblog:Y,_pinned:G}=Q,K=Y?.id||te,j=i?`/${i}/s/${K}`:`/s/${K}`;return G&&(s=!1),e(ge,{class:"status-carousel-link timeline-item-alt",to:j,children:s?e(Ye,{statusID:te,instance:i,size:"s"}):e(Ye,{status:Q,instance:i,size:"s"})})})},x);const D=M?.id||x,F=i?`/${i}/s/${D}`:`/s/${D}`;return $&&(s=!1),e("li",{children:e(ge,{class:"status-carousel-link timeline-item-alt",to:F,children:s?e(Ye,{statusID:x,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:d}):e(Ye,{status:C,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:d})})},x)})})},`timeline-${l}`)}const S=b.length>3;return b.map((A,C)=>{const{id:x,_differentAuthor:M}=A,$=i?`/${i}/s/${x}`:`/s/${x}`,q=C>0&&C<b.length-1,D=A.sensitive&&!!A.spoilerText,F=!M&&D&&C>0||S&&q&&(m==="thread"||m==="conversation"&&!M&&!b[C-1]._differentAuthor&&!b[C+1]._differentAuthor),Q=C===0,te=C===b.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${m} timeline-item-container-${Q?"start":te?"end":"middle"} ${M?"timeline-item-diff-author":""}`,children:e(ge,{class:"status-link timeline-item",to:$,children:F?e(ed,{status:A,instance:i,filterContext:o}):s?e(Ye,{statusID:x,instance:i,enableCommentHint:te,showFollowedTags:c}):e(Ye,{status:A,instance:i,enableCommentHint:te,showFollowedTags:c})})},`timeline-${x}`)})}const k=`timeline-${l+g}`;return a==="media"?s?e(Ns,{class:"timeline-item",parent:"li",statusID:l,instance:i},k):e(Ns,{class:"timeline-item",parent:"li",status:n,instance:i},k):e("li",{children:e(ge,{class:"status-link timeline-item",to:w,children:s?e(Ye,{statusID:l,instance:i,enableCommentHint:!0,showFollowedTags:c,showReplyParent:h,mediaFirst:d}):e(Ye,{status:n,instance:i,enableCommentHint:!0,showFollowedTags:c,showReplyParent:h,mediaFirst:d})})},k)},(n,i)=>{const s=(n.status?.id||"").toString(),o=(i.status?.id||"").toString();return s===o&&n.instance===i.instance&&n.view===i.view});function Jl({title:n,class:i,children:s}){const{_:o}=re(),a=U(),c=U(),h=U(),[d,r]=R(!1);return V(()=>{setTimeout(()=>{r(!0)},1)},[]),e("div",{class:`status-carousel ${i}`,children:[e("header",{children:[e("h3",{children:n}),e("span",{children:[e("button",{ref:c,type:"button",class:"small plain2",onClick:()=>{const l=Math.min(320,a.current?.offsetWidth)*(jt()?1:-1);a.current?.scrollBy({left:l,behavior:"smooth"})},children:e(I,{icon:"chevron-left",alt:o({id:"DHhJ7s"})})})," ",e("button",{ref:h,type:"button",class:"small plain2",onClick:()=>{const l=Math.min(320,a.current?.offsetWidth)*(jt()?-1:1);a.current?.scrollBy({left:l,behavior:"smooth"})},children:e(I,{icon:"chevron-right",alt:o({id:"hXzOVo"})})})]})]}),e("ul",{ref:a,children:[e(Lt,{class:"status-carousel-beacon",onChange:l=>{c.current&&(c.current.disabled=l)}}),s[0],d&&s.slice(1),e(Lt,{class:"status-carousel-beacon",onChange:l=>{h.current&&(h.current.disabled=l)}})]})]})}function ed({status:n,instance:i,filterContext:s}){const{_:o}=re(),a=We(E),{id:c,visibility:h,language:d}=n,r=Xn(n),l=ht(c,i),u=sn(n.filtered,s);return e("article",{class:`status compact-thread ${h==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[e("div",{class:"status-thread-badge-container",children:e(Va,{index:a.statusThreadNumber[l]})}),e("div",{class:"content-compact",title:r,lang:d,dir:"auto",children:u&&u?.action!=="blur"?e("b",{class:"status-filtered-badge badge-meta horizontal",title:u?.titlesStr||"",children:u?.titlesStr?e(p,{id:"sr6maL",values:{0:u.titlesStr},components:{0:e("span",{}),1:e("span",{})}}):e("span",{children:e(p,{id:"03Qqf9"})})}):e(N,{children:[r,n.sensitive&&n.spoilerText&&e(N,{children:[" ",e("span",{class:"spoiler-badge",children:e(I,{icon:"eye-close",size:"s",alt:o({id:"gnKo7f"})})})]})]})})]})}function td(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const en=20,Ji=1983,Ds=`${Ji}-01`,nd=Pi(()=>{try{const n=document.createElement("input");return n.setAttribute("type","month"),n.type==="month"}catch{return!1}});async function id(n){const{masto:i}=ce({instance:n});return!!(await i.v2.search.list({q:"from:me",type:"statuses",limit:1}))?.statuses?.length}const sd=Ct(id);function od(){const{i18n:n,_:i}=re(),s=We(E),{id:o,...a}=Bt(),[c,h]=_t(),d=c.get("month"),r=!c.get("replies"),l=!!c.get("boosts"),u=c.get("tagged"),f=!!c.get("media"),{masto:m,instance:g,authenticated:y}=ce({instance:a.instance}),{masto:w,instance:k}=ce(),b=U(),v=[d,r,l,u,f],[_,S]=R(),A=U(0);V(()=>{A.current=0},v);const C=_e(()=>Mi(),[]),x=_e(()=>g===k,[g,k]),[M,$]=R(!1);V(()=>{x&&_?.acct&&(async()=>{const se=await sd(g);$(se)})()},[g,x,_?.acct]);async function q(se){const X=/^\d{4}-[01]\d$/.test(d),we=d?.split?.("-")?.[0]>=Ji;if(X&&we){if(!_)return{value:[],done:!0};const[xe,Le]=d.split("-"),Re=parseInt(Le,10)-1,ze=new Date(xe,Re,0),Ue=`${ze.getFullYear()}-${(ze.getMonth()+1).toString().padStart(2,"0")}-${ze.getDate().toString().padStart(2,"0")}`,Ke=new Date(xe,Re+1,1),Ve=`${Ke.getFullYear()}-${(Ke.getMonth()+1).toString().padStart(2,"0")}-${Ke.getDate().toString().padStart(2,"0")}`;let le;se?(le=en+1,A.current=0):(le=en+A.current+1,A.current+=en);const $e=await m.v2.search.list({q:`from:${_.acct} after:${Ue} before:${Ve}`,type:"statuses",limit:le,offset:A.current});if($e?.statuses?.length){const Te=$e.statuses.slice(0,en);Te.forEach(Ne=>{Je(Ne,g)});const ae=$e.statuses.length<=en;return{value:Te,done:ae}}else return{value:[],done:!0}}let ke=[];if(se){const{value:xe}=await m.v1.accounts.$select(o).statuses.list({pinned:!0}).values().next();if(xe?.length&&!u&&!f){const Le=xe.map(Re=>(Je(Re,g),{...Re,_pinned:!0}));if(Le.length>=3){const Re=Le.map(ze=>ze.id);ke.push({id:Re,items:Le,type:"pinned"})}else ke.push(...Le)}}(se||!b.current)&&(b.current=m.v1.accounts.$select(o).statuses.list({limit:en,exclude_replies:r,exclude_reblogs:l,only_media:f||void 0,tagged:u}).values());const{value:Se,done:Oe}=await b.current.next();if(Se?.length){if(!Qe("@mastodon/pinned-posts")&&ke.length){let xe=[];ke[0]?.type==="pinned"?xe=ke[0].id:xe=ke.filter(Re=>Re._pinned).map(Re=>Re.id),xe.every(Re=>Se.some(ze=>ze.id===Re))&&(ke=[])}ke.push(...Se),Se.forEach(xe=>{Je(xe,g)})}return{value:ke,done:Oe}}const[D,F]=R([]);let Q=i({id:"/cKnpj"});if(_?.acct){const se=(/@/.test(_.acct)?"":"@")+_.acct,X=_?.displayName?`${_.displayName} (${se})`:`${se}`;if(!r)Q=i({id:"hS1Opy",values:{accountDisplay:X}});else if(l)Q=i({id:"A/CX5F",values:{accountDisplay:X}});else if(u)Q=i({id:"QQrO94",values:{accountDisplay:X,tagged:u}});else if(f)Q=i({id:"NoG5wD",values:{accountDisplay:X}});else if(d){const we=new Date(d).toLocaleString(n.locale,{month:"long",year:"numeric"});Q=i({id:"8GjLvB",values:{accountDisplay:X,monthYear:we}})}else Q=X}et(Q,"/:instance?/a/:id");const te=it(()=>rd(o,m),[o,m]);V(()=>{(async()=>{try{const se=await te();S(se)}catch{}if(!C)try{const se=await m.v1.accounts.$select(o).featuredTags.list();F(se)}catch{}})()},[o,C]);const{displayName:Y,acct:G,emojis:K}=_||{},j=_e(()=>_?.id===kt(),[_?.id]),L=U(),Z=_e(()=>{const se=!r||l||u||f||!!d,X=s.accounts[`${o}@${g}`];return e(N,{children:[e(Ro,{instance:g,account:X||o,fetchAccount:te,authenticated:y,standalone:!0,showEndorsements:!0}),!C&&e("div",{class:"filter-bar",ref:L,style:{position:"relative"},children:[se?e(ge,{to:`/${g}/a/${o}`,class:"insignificant filter-clear",title:i({id:"u8JHrO"}),children:e(I,{icon:"x",size:"l",alt:i({id:"xCJdfg"})})},"clear-filters"):e(I,{icon:"filter",class:"insignificant",size:"l",alt:i({id:"cSev+j"})}),e(ge,{to:`/${g}/a/${o}${r?"?replies=1":""}`,onClick:()=>{r&&he(i({id:"PIWNSQ"}))},class:r?"":"is-active",children:e(p,{id:"5BFynH"})}),e(ge,{to:`/${g}/a/${o}${l?"":"?boosts=0"}`,onClick:()=>{l||he(i({id:"Qd13i0"}))},class:l?"is-active":"",children:e(p,{id:"usxQx0"})}),e(ge,{to:`/${g}/a/${o}${f?"":"?media=1"}`,onClick:()=>{f||he(i({id:"rKpfPY"}))},class:f?"is-active":"",children:e(p,{id:"xYilR2"})}),D.map(we=>e(ge,{to:`/${g}/a/${o}${u===we.name?"":`?tagged=${encodeURIComponent(we.name)}`}`,onClick:()=>{u!==we.name&&he(i({id:"L+HFfr",values:{0:we.name}}))},class:u===we.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),we.name]})},we.id)),M&&(nd()?e("label",{class:`filter-field ${d?"is-active":""}`,children:[e(I,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!_?.acct,value:d||"",min:Ds,max:new Date().toISOString().slice(0,7),onInput:we=>{const{value:ke,validity:Se}=we.currentTarget;if(!Se.valid)return;h(ke?{month:ke}:{});const[Oe,xe]=ke.split("-"),Le=parseInt(xe,10)-1,Re=new Date(Oe,Le);he(i({id:"0WUFGD",values:{0:Re.toLocaleString(n.locale,{month:"long",year:"numeric"})}}))}})]}):e(ad,{class:`filter-field ${d?"is-active":""}`,disabled:!_?.acct,value:d||"",min:Ds,max:new Date().toISOString().slice(0,7),onInput:we=>{const{value:ke,validity:Se}=we;Se.valid&&h(ke?{month:ke}:{})}}))]})]})},[o,g,y,D,te,M,...v]);V(()=>{const se=L.current?.querySelector(".is-active");se&&L.current.scrollTo({behavior:"smooth",left:se.offsetLeft-(L.current.offsetWidth-se.offsetWidth)/2})},[D,M,...v]);const H=_e(()=>_?.url?URL.parse(_.url)?.hostname:null,[_]),de=!!_&&!(g===H);return e(N,{children:[e(Mt,{title:`${_?.acct?"@"+_.acct:i({id:"+owNNn"})}`,titleComponent:e("h1",{class:"header-double-lines header-account",children:[e("b",{children:e(ho,{text:Y,emojis:K,resolverURL:_?.url})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",G]})})]}),id:"account-statuses",instance:g,emptyText:i({id:"+k97fV"}),errorText:i({id:"scd9lw"}),fetchItems:q,useItemID:!0,view:f||C?"media":void 0,boostsCarousel:s.settings.boostsCarousel,timelineStart:Z,refresh:[r,l,u,f,d+_?.acct].toString(),headerEnd:e(ft,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[e(ve,{disabled:!de,onClick:()=>{(async()=>{try{const{masto:se}=ce({instance:H}),X=await se.v1.accounts.lookup({acct:_.acct}),{id:we}=X;location.hash=`/${H}/a/${we}`}catch{alert(i({id:"FgdLx0"}))}})()},children:[e(I,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(p,{id:"/JFxxT",values:{0:H?e(N,{children:[" ","(",e("b",{children:Zn.toUnicode(H)}),")"]}):null}})})]}),!x&&e(ve,{onClick:()=>{(async()=>{try{const se=await w.v1.accounts.lookup({acct:_.acct+"@"+g}),{id:X}=se;location.hash=`/${k}/a/${X}`}catch{alert(i({id:"FgdLx0"}))}})()},children:[e(I,{icon:"transfer"})," ",e("small",{class:"menu-double-lines",children:e(p,{id:"HkuyOu",values:{currentInstance:k},components:{0:e("b",{})}})})]})]})},o),G&&!j&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`@${G} `}})})]})}function ad(n){const{i18n:i}=re(),{class:s,disabled:o,value:a,min:c,max:h,onInput:d=()=>{}}=n,[r,l]=a?.split("-")||[],u=U(),f=U(),m=(g,y)=>{const[w,k]=c?.split("-")||[],[b,v]=h?.split("-")||[];return!(y<w||y>b||y===w&&g<k||y===b&&g>v)};return e("div",{class:s,children:[e(I,{icon:"month",size:"l"}),e("select",{ref:u,disabled:o,value:l||"",onInput:g=>{const{value:y}=g.currentTarget,w=f.current.value;if(!m(y,w))return{value:"",validity:{valid:!1}};d({value:y?`${w}-${y}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(p,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(g,y)=>e("option",{value:(y+1).toString().padStart(2,"0"),children:new Date(0,y).toLocaleString(i.locale,{month:"long"})},y))]})," ",e("input",{ref:f,type:"number",disabled:o,value:r||new Date().getFullYear(),min:c?.slice(0,4)||Ji,max:h?.slice(0,4)||new Date().getFullYear(),onInput:g=>{const{value:y,validity:w}=g.currentTarget,k=u.current.value;if(!w.valid||!m(k,y))return{value:"",validity:{valid:!1}};d({value:y?`${y}-${k}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}function cd(n,i){return i.v1.accounts.$select(n).fetch()}const rd=Ct(cd,{maxAge:1800*1e3});function ld(){const n=Bt(),{year:i}=n;et(i?`${i} #Wrapstodon`:"#Wrapstodon","/annual_report/:year");const{masto:s,instance:o}=ce(),[a,c]=R(null),[h,d]=R("default");V(()=>{i&&(async()=>{d("loading");const g=await s.v1.annualReports.$select(i).fetch();c(g),d("default")})()},[i]);const{accounts:r,annualReports:l,statuses:u}=a||{},f=l?.find(g=>g.year==i)?.data,m=new Date;return e("div",{id:"annual-report-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:`report ${h==="loading"?"loading-mask":""}`,children:[e("h1",{children:[i," #Wrapstodon"]}),!!f&&e("dl",{children:Object.entries(f).map(([g,y])=>{const w={};return Array.isArray(y)&&y.forEach(k=>{Object.entries(k).forEach(([b,v])=>{typeof v=="number"&&(w[b]=(w[b]||0)+v)})}),e(N,{children:[e("dt",{children:g}),e("dd",{class:`report-${g}`,children:Array.isArray(y)?e("table",{children:[e("thead",{children:e("tr",{children:Object.entries(y[0]).map(([k,b])=>e("th",{class:k!=="month"&&typeof b=="number"?"number":"",children:k}))})}),e("tbody",{children:y.map(k=>e("tr",{children:Object.entries(k).map(([b,v])=>e("td",{class:b!=="month"&&typeof v=="number"?"number":"",style:{"--percentage":typeof v=="number"?`${v/w[b]*100}%`:0},children:v&&/(accountId)/i.test(b)&&/^(mostRebloggedAccounts|commonlyInteractedWithAccounts)$/i.test(g)?r?.find(_=>_.id===v)?e(gt,{account:r?.find(_=>_.id===v),showAvatar:!0}):"👻":b==="month"?m.setMonth(v-1)&&m.toLocaleString(void 0,{month:"long"}):typeof v=="number"?v.toLocaleString():v}))}))})]}):typeof y=="object"?/^(topStatuses)$/i.test(g)?e("dl",{children:Object.entries(y).map(([k,b])=>e(N,{children:[e("dt",{children:k}),e("dd",{children:b&&e(ge,{to:`/${o}/s/${b}`,children:e(Ye,{status:u?.find(v=>v.id===b),size:"s",readOnly:!0,showCommentCount:!0})})})]}))}):e("table",{children:e("tbody",{children:Object.entries(y).map(([k,b])=>e("tr",{children:[e("th",{children:k}),e("td",{class:typeof b=="number"?"number":"",children:b})]}))})}):typeof y=="string"?y:JSON.stringify(y,null,2)})]})})})]}),e("hr",{}),e("p",{style:{textAlign:"center"},children:e(ge,{to:"/",children:e(p,{id:"iWpEwy"})})})]})}const dd=20;function Ko(){const{_:n}=re();et(n({id:"7Ff7ia"}),"/b");const{masto:i,instance:s}=ce(),o=U();async function a(c){return(c||!o.current)&&(o.current=i.v1.bookmarks.list({limit:dd}).values()),await o.current.next()}return e(Mt,{title:n({id:"7Ff7ia"}),id:"bookmarks",emptyText:n({id:"8k2w6G"}),errorText:n({id:"UoL+FC"}),instance:s,fetchItems:a})}const Ho=""+new URL("catch-up-O5q5C75Z.png",import.meta.url).href,ud="home",Ft="catchup",pt=[{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}],hd={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},quotes:{id:"eWLklq"},boosts:{id:"puY2t0"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},fd=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],pd=[null,"account"],md=Pi(n=>new Intl.DateTimeFormat(n||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function Wn(n){return n?.id||n?.quotedStatus?.id}function gd(){const{i18n:n,_:i,_:s}=re(),o=md(n.locale);et("Catch-up","/catchup");const{masto:a,instance:c}=ce(),[h,d]=_t(),r=h.get("id"),[l,u]=R("start"),[f,m]=R(!1),g=_e(()=>kt(),[]),y=T=>T===g,w=Qe("@pixelfed/home-include-reblogs");async function k({maxCreatedAt:T}){const B=[],J=a.v1.timelines.home.list({limit:40}),oe=J.values();e:for(;;)try{w&&J.params&&(typeof J.params=="string"?J.params+="&include_reblogs=true":J.params.include_reblogs=!0);const z=await oe.next(),{value:fe}=z;if(fe?.length){await Fo(fe,c);let Ee=!1;for(let ye=0;ye<fe.length;ye++){const ne=fe[ye],ie=Date.parse(ne.createdAt);if(!T||ie>=T){const Me=!y(ne.reblog?.account?.id||ne.account.id)&&sn(ne.reblog?.filtered||ne.filtered,ud);if(Me?.action==="hide")continue;ne._filtered=Me;const Ge=ht(ne.id,c);ne._followedTags=E.statusFollowedTags[Ge]?[...E.statusFollowedTags[Ge]]:[],B.push(ne),Ee=!0}if(!Ee)break e}}else break e;await new Promise(Ee=>setTimeout(Ee,1e3))}catch{break e}return B.forEach(z=>{if(z?.inReplyToId){const fe=B.find(Ee=>Ee.id===z.inReplyToId);fe&&!fe.inReplyToId&&(fe._thread=!0)}}),B}const[b,v]=R([]),_=U(),S=U(),A=_e(()=>Fn(),[]),C=it(async({duration:T}={})=>{const B=Date.now(),J=T?B-T:null;u("loading");const oe=await k({maxCreatedAt:J}),z=`${A}-${Ga()}`;try{await wt.catchup.set(z,{id:z,posts:oe,count:oe.length,startAt:J,endAt:B}),d({id:z})}catch{}},[]);V(()=>{r?(async()=>{const T=await wt.catchup.get(r);T&&(T.posts.sort((B,J)=>B.createdAt>J.createdAt?1:-1),v(T.posts),u("results"))})():l==="results"&&(v([]),u("start"))},[r]);const[x,M]=$t(T=>T+1,0),[$,q]=R(null),[D,F]=R([]);V(()=>{const T=new Set(D.map(B=>B.id));for(let B=sessionStorage.length-1;B>=0;B--){const J=sessionStorage.key(B);if(J?.startsWith(`${Ft}-`)){const oe=J.replace(`${Ft}-`,"");T.has(oe)||Ie.session.del(J)}}},[D]),V(()=>{(async()=>{try{const T=await wt.catchup.keys();if(T.length){const B=Fn(),J=T.filter(oe=>oe.startsWith(`${B}-`));if(J.length){let oe=await wt.catchup.getMany(J);oe.sort((ye,ne)=>ne.endAt-ye.endAt);let z=oe.slice(0,3),fe=oe.slice(3);const Ee=z.map(ye=>{const{id:ne,count:ie,startAt:Ce,endAt:Me}=ye;return{id:ne,count:ie,startAt:Ce,endAt:Me}});F(Ee),q(z[0].endAt),oe=null,z=null,queueMicrotask(()=>{fe.length&&wt.catchup.delMany(fe.map(ye=>ye.id)).then(()=>{fe=null}).catch(ye=>{})});return}}}catch{}F([])})()},[x]),V(()=>{l==="start"&&M()},[l==="start"]);const[Q,te]=_e(()=>{let T=0,B=0,J=0,oe=0,z=0,fe=0,Ee=0;const ye={};for(const ie of b){ie._filtered&&ie._filtered?.action!=="blur"?(T++,ie.__FILTER="filtered"):ie.group?(B++,ie.__FILTER="groups"):ie.reblog?(J++,ie.__FILTER="boosts"):Vt()&&Wn(ie.quote)?(oe++,ie.__FILTER="quotes"):ie._followedTags?.length?(fe++,ie.__FILTER="followedTags"):ie.inReplyToId&&ie.inReplyToAccountId!==ie.account?.id?(z++,ie.__FILTER="replies"):(Ee++,ie.__FILTER="original");const Ce=ie.reblog||ie;if(ie.__FILTER!=="filtered"&&Ce.card?.url&&Ce.card?.image&&Ce.card?.type==="link"){const{card:Me,favouritesCount:Ge,reblogsCount:rt}=Ce;let{url:tt}=Me;if(tt=tt.replace(/\/$/,""),!ye[tt])ye[tt]={postID:Ce.id,card:Me,shared:1,sharers:[ie.account],likes:Ge,boosts:rt};else{if(ye[tt].sharers.find(It=>It.id===ie.account.id))continue;ye[tt].shared++,ye[tt].sharers.push(ie.account),ye[tt].postID!==Ce.id&&(ye[tt].likes+=Ge,ye[tt].boosts+=rt)}}}let ne=[];for(const ie in ye)ne.push({url:ie,...ye[ie]});if(ne.sort((ie,Ce)=>ie.shared>Ce.shared?-1:ie.shared<Ce.shared?1:ie.boosts>Ce.boosts?-1:ie.boosts<Ce.boosts?1:ie.likes>Ce.likes?-1:ie.likes<Ce.likes?1:ie.quotes>Ce.quotes?-1:ie.quotes<Ce.quotes?1:0),ne.length>10)e:for(let ie=10;ie<ne.length;ie++){const{shared:Ce}=ne[ie];if(Ce<=1){ne=ne.slice(0,ie);break e}}return[{filtered:T,groups:B,boosts:J,quotes:oe,replies:z,followedTags:fe,original:Ee},ne]},[b]),[Y,G]=R("all"),[K,j]=R(null),[L,Z]=R(1),[H,W]=R("createdAt"),[de,se]=R("asc"),[X,we]=R(null);V(()=>{if(!r)return;const T=Ie.session.getJSON(`${Ft}-${r}`);T&&(T.selectedFilterCategory!==void 0&&G(T.selectedFilterCategory),T.selectedAuthor!==void 0&&j(T.selectedAuthor),T.sortBy!==void 0&&W(T.sortBy),T.sortOrder!==void 0&&se(T.sortOrder),T.groupBy!==void 0&&we(T.groupBy),T.showTopLinks!==void 0&&m(T.showTopLinks))},[r]),V(()=>{if(!r||l!=="results")return;const T={selectedFilterCategory:Y,selectedAuthor:K,sortBy:H,sortOrder:de,groupBy:X,showTopLinks:f};Ie.session.setJSON(`${Ft}-${r}`,T)},[r,l,Y,K,H,de,X,f]);const[ke,Se,Oe]=_e(()=>{const T={},B=new Map;let J=b.filter(z=>{const fe=Y==="all"||z.__FILTER===Y;return fe&&(T[z.account.id]=z.account,B.set(z.account.id,(B.get(z.account.id)||0)+1)),fe});const oe={};return J.forEach(z=>{z.reblog&&(oe[z.reblog.id]?(oe[z.reblog.id].__BOOSTERS?oe[z.reblog.id].__BOOSTERS.add(z.account):oe[z.reblog.id].__BOOSTERS=new Set([z.account]),z.__HIDDEN=!0):oe[z.reblog.id]=z)}),K&&B.has(K)&&(J=J.filter(z=>z.account.id===K||[...z.__BOOSTERS||[]].find(fe=>fe.id===K))),[J,T,Object.fromEntries(B)]},[Y,K,b]),xe=_e(()=>{const T={};return ke.forEach(B=>{T[B.id]=B}),T},[ke]),Le=_e(()=>Object.keys(Oe).sort((T,B)=>Oe[B]-Oe[T]),[Oe]),Re=_e(()=>{const T={};return Le.forEach((B,J)=>{T[B]=J}),ke.filter(B=>!B.__HIDDEN).sort((B,J)=>{if(X==="account"){const oe=B.account.id,z=J.account.id,fe=T[oe],Ee=T[z],ye=fe-Ee;if(ye!==0)return ye}if(H!=="createdAt"&&(B=B.reblog||B,J=J.reblog||J,H!=="density"&&B[H]===J[H]))return B.createdAt>J.createdAt?1:-1;if(H==="density"){const oe=Os(B),z=Os(J);return de==="asc"?oe>z?1:-1:z>oe?1:-1}return de==="asc"?B[H]>J[H]?1:-1:J[H]>B[H]?1:-1})},[ke,H,de,X,Le]),ze=U(null),Ue=U(null),Ke=U(!1);V(()=>{b.length>100||Ke.current||Ue.current&&(Co(Ue.current,{duration:200}),Ke.current=!0)},[b,Ue]);const Ve=b.length>160?"3d":"2d",le=_e(()=>Ve!=="2d"?null:b.map(T=>{const B=xe[T.id];return e("span",{class:`post-dot ${B?"post-dot-highlight":""}`},T.id)}),[xe]),$e=_e(()=>Ve!=="3d"||!b?.length?null:Cd(b,"createdAt",320).map((B,J)=>e("div",{class:"posts-bin",children:B.map(oe=>{const z=xe[oe.id];return e("span",{class:`post-dot ${z?"post-dot-highlight":""}`},oe.id)})},J)),[xe]),Te=U(null);St(()=>{if(!r||l!=="results"||!Te.current||!Re.length)return;const T=Ie.session.getJSON(`${Ft}-${r}`);if(T?.scrollTop!==void 0&&T.scrollTop>0){const B=setTimeout(()=>{Te.current&&Te.current.scrollTo({top:T.scrollTop,behavior:"instant"})},100);return()=>clearTimeout(B)}},[r,l,Re.length]),V(()=>{if(!r||l!=="results"||!Te.current)return;const T=()=>{if(!Te.current)return;const J=Ie.session.getJSON(`${Ft}-${r}`)||{};J.scrollTop=Te.current.scrollTop,Ie.session.setJSON(`${Ft}-${r}`,J)},B=Te.current;return B.addEventListener("scroll",T,{passive:!0}),()=>{B.removeEventListener("scroll",T)}},[r,l]);const ae=_e(()=>$?(Date.now()-$)/1e3/60/60:null,[$,L]);V(()=>{if(l!=="results")return;const T=K&&Se[K]?Se[K].username:"",B=de==="asc"?0:1,J={account:"authors"};let oe=he({duration:5e3,text:s({id:"XKZRZ/",values:{selectedFilterCategory:Y,sortBy:H,sortOrder:de,groupBy:X}})});return()=>{oe?.hideToast?.()}},[l,Y,K,H,de,X,Se]),V(()=>{if(K&&Se[K]){const T=Ue.current.querySelector(`[data-author="${K}"]`),B=Ue.current?.getBoundingClientRect(),J=T?.getBoundingClientRect();J.left<B.left||J.right>B.right?T.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):J.top<0&&T.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[K,Se]);const[Ne,ee]=R(!1),Ae=".catchup-list > li > a",O=Fe("j",()=>{const T=document.activeElement.closest(Ae),B=T?.getBoundingClientRect(),J=Array.from(Te.current.querySelectorAll(Ae));if(T&&B.top<Te.current.clientHeight&&B.bottom>0){const oe=J.indexOf(T),z=J[oe+1];z&&(z.focus(),z.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const oe=J.find(z=>z.getBoundingClientRect().top>=0);oe&&(oe.focus(),oe.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey}),be=Fe("k",()=>{const T=document.activeElement.closest(Ae),B=T?.getBoundingClientRect(),J=Array.from(Te.current.querySelectorAll(Ae));if(T&&B.top<Te.current.clientHeight&&B.bottom>0){const oe=J.indexOf(T);let z=J[oe-1];z&&(z.focus(),z.scrollIntoView({block:"center",inline:"center",behavior:"smooth"}))}else{const oe=J.find(z=>{const fe=z.getBoundingClientRect();return fe.top>=44&&fe.left>=0});oe&&(oe.focus(),oe.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey}),Pe=Fe("h, l",(T,B)=>{const J=B.keys[0];if(K){const oe=Le.indexOf(K);J==="h"?oe>0&&oe<Le.length&&(j(Le[oe-1]),Te.current?.focus()):J==="l"&&oe<Le.length-1&&oe>=0&&(j(Le[oe+1]),Te.current?.focus())}else J==="l"&&(j(Le[0]),Te.current?.focus())},{useKey:!0,preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey,enableOnFormTags:["input"]}),Be=Fe("esc",()=>{j(null),Te.current?.focus()},{preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey,enableOnFormTags:["input"],useKey:!0}),P=Fe(".",()=>{Te.current?.scrollTo({top:0,behavior:"smooth"})},{useKey:!0,preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey,enableOnFormTags:["input"]}),ue=it(T=>{const B=document.activeElement,J=B?.tagName==="INPUT"&&B.type==="radio";if((T.key==="ArrowDown"||T.key==="ArrowUp"||T.key==="ArrowLeft"||T.key==="ArrowRight")&&J){B.blur();return}},[]);return e("div",{ref:T=>{Te.current=T,O.current=T,be.current=T,Pe.current=T,Be.current=T,P.current=T},id:"catchup-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck wide",children:[e("header",{class:`${l==="loading"?"loading":""}`,onClick:T=>{T.target.closest("a, button")||Te.current?.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(qt,{}),l==="results"&&e(ge,{to:"/catchup",class:"button plain",children:e(I,{icon:"history2",size:"l",alt:s({id:"xrl8fj"})})}),l==="start"&&e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:s({id:"i0qMbr"})})})]}),e("h1",{children:l!=="start"&&e(p,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("div",{class:"header-side",children:l!=="start"&&l!=="loading"&&e("button",{type:"button",class:"plain",onClick:()=>{ee(!0)},children:e(p,{id:"c3XJ18"})})})]})}),e("main",{onKeyDown:ue,children:[l==="start"&&e("div",{class:"catchup-start",children:[e("h1",{children:e(p,{id:"wyL/3/",components:{0:e("sup",{})}})}),e("details",{children:[e("summary",{children:e(p,{id:"CxKPv6"})}),e("p",{children:e(p,{id:"YMU1CK"})}),e("img",{src:Ho,width:"1200",height:"900",alt:s({id:"CeInO2"})}),e("p",{children:e("button",{type:"button",onClick:T=>{T.target.closest("details").open=!1},children:e(p,{id:"2jI8hh"})})})]}),e("p",{children:e(p,{id:"1RfGk7"})}),e("p",{children:e("b",{children:e(p,{id:"OOEonE"})})}),e("div",{class:"catchup-form",children:[e("input",{ref:_,type:"range",value:L,min:pt[0].value,max:pt[pt.length-1].value,step:"1",list:"catchup-ranges",onChange:T=>Z(+T.target.value)})," ",e("span",{style:{width:"8em"},children:[i(pt[L-1].label),e("br",{}),e("small",{class:"insignificant",children:L==pt[pt.length-1].value?s({id:"NMNiaO"}):at(new Date(Date.now()-L*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:pt.map(({label:T,value:B})=>e("option",{value:B,label:i(T)}))})," ",e("button",{type:"button",onClick:()=>{if(L<pt[pt.length-1].value){let T;L===pt[pt.length-1].value&&S.current?.checked?T=Date.now()-$:T=L*60*60*1e3,C({duration:T})}else C()},children:e(p,{id:"R0yu2l"})})]}),ae&&L>ae?e("p",{class:"catchup-info",children:[e(I,{icon:"info"})," ",e(p,{id:"AGyV7s"})]}):L===pt[pt.length-1].value&&$?e("p",{class:"catchup-info",children:e("label",{children:[e("input",{type:"checkbox",switch:!0,checked:!0,ref:S})," ",e(p,{id:"dDJEHI",values:{0:o.format(new Date($))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(p,{id:"EAjFM0"})})}),!!D?.length&&e("div",{class:"catchup-prev",children:[e("p",{children:e(p,{id:"Yfb9A8"})}),e("ul",{children:D.map(T=>e("li",{children:[e(ge,{to:`/catchup?id=${T.id}`,children:[e(I,{icon:"history2"})," ",e("span",{children:T.startAt?o.formatRange(new Date(T.startAt),new Date(T.endAt)):`… – ${o.format(new Date(T.endAt))}`})]})," ",e("span",{children:[e("small",{class:"ib insignificant",children:e(p,{id:"S6XZwv",values:{0:T.count}})})," ",e("button",{type:"button",class:"light danger small",onClick:async()=>{if(confirm(s({id:"D9CmP2"}))){let J=he(s({id:"xJUo4P",values:{0:T.id}}));await wt.catchup.del(T.id),J?.hideToast?.(),he(s({id:"1dyGG/",values:{0:T.id}})),M()}},children:e(I,{icon:"x",alt:s({id:"t/YqKh"})})})]})]},T.id))}),D.length>=3&&e("p",{children:e("small",{children:e(p,{id:"sXmrl4"})})})]})]}),l==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(De,{abrupt:!0}),e("p",{class:"insignificant",children:e(p,{id:"rbUTzD"})}),e("p",{class:"insignificant",children:e(p,{id:"q9urQO"})})]}),l==="results"&&e(N,{children:[e("div",{class:"catchup-header",children:[b.length>0&&e("p",{children:e("b",{class:"ib",children:o.formatRange(new Date(b[0].createdAt),new Date(b[b.length-1].createdAt))})}),e("aside",{children:[e("button",{hidden:Y==="all"&&!K&&H==="createdAt"&&de==="asc",type:"button",class:"plain4 small",onClick:()=>{G("all"),j(null),W("createdAt"),we(null),se("asc")},children:e(p,{id:"I9EnzM"})}),te?.length>0&&e("button",{type:"button",class:"plain small",onClick:()=>m(!f),children:[e(p,{id:"EIZREX"})," ",e(I,{icon:"chevron-down",style:{transform:f?"rotate(180deg)":"rotate(0deg)"}})]})]})]}),e("div",{class:"shazam-container no-animation",hidden:!f,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"catchup-top-links links-bar",children:te.map(T=>{const{card:B,shared:J,sharers:oe,likes:z,boosts:fe}=T,{blurhash:Ee,title:ye,description:ne,url:ie,image:Ce,imageDescription:Me,language:Ge,width:rt,height:tt,publishedAt:It}=B,Pt=Ri(ie);let Sn;if(Ee){const Cn=zi(Ee),_n=Xi(Cn);Sn=Zi([.6,_n[1],_n[2]])}return e("a",{href:ie,target:"_blank",rel:"noopener",class:"link-block",style:Sn?{"--accent-color":`rgb(${Sn.join(",")})`,"--accent-alpha-color":`rgba(${Sn.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:Ce,alt:Me,width:rt,height:tt,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:Pt})," ",!!It&&e(N,{children:"· "}),!!It&&e(N,{children:e(xt,{datetime:It,format:"micro"})})]}),!!ye&&e("h1",{class:"title",lang:Ge,dir:"auto",title:ye,children:ye})]}),!!ne&&e("p",{class:"description",lang:Ge,dir:"auto",title:ne,children:ne}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(p,{id:"bfSr6z",values:{0:oe.map(Cn=>{const{avatarStatic:_n,displayName:ua}=Cn;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:ts=>{ts.preventDefault(),ts.stopPropagation();const{id:ha}=Cn;j(ha),G("all")},children:e(ut,{url:_n,size:"s",alt:ua})})})}})})]})]})},ie)})})})}),b.length>=5&&(Ve==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:$e}):e("div",{class:"catchup-posts-viz-bar",children:le})),b.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:Y.toLowerCase()==="all",onChange:()=>{G("all")}}),e(p,{id:"N40H+G"})," ",e("span",{class:"count",children:b.length})]}),Object.entries(hd).map(([T,B])=>!!Q[T]&&e("label",{class:"filter-cat",title:(Q[T]/b.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:Y.toLowerCase()===T.toLowerCase(),onChange:()=>{G(T),T==="boosts"&&(W("reblogsCount"),se("desc"),we(null))}}),i(B)," ",e("span",{class:"count",children:Q[T]})]},i(B)))]}),b.length>=2&&!!Oe&&e("div",{class:"catchup-filters authors-filters",ref:Ue,children:[Le.map(T=>e("label",{class:"filter-author","data-author":T,children:[e("input",{type:"radio",name:"filter-author",checked:K===T,onChange:()=>{j(T)},onClick:()=>{K===T&&j(null)}}),e(ut,{url:Se[T].avatarStatic||Se[T].avatar,size:"xxl",alt:`${Se[T].displayName} (@${Se[T].acct})`})," ",e("span",{class:"count",children:Oe[T]}),e("span",{class:"username",children:Se[T].username})]},`${T}-${Oe[T]}`)),Le.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(p,{id:"HHtYi7",values:{0:Le.length}})},"authors-count")]}),b.length>=2&&e("div",{class:"catchup-filters",children:[e("span",{class:"filter-label",children:e(p,{id:"f6Hub0"})})," ",e("fieldset",{class:"radio-field-group",children:fd.map(T=>e("label",{class:"filter-sort",onClick:B=>{H===T&&(B.preventDefault(),B.stopPropagation(),se(de==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:H===T,onChange:()=>{W(T);const B=/(replies|favourites|reblogs|quotes)/.test(T)?"desc":"asc";se(B)}}),{createdAt:s({id:"mYGY3B"}),repliesCount:s({id:"N8UzTV"}),favouritesCount:s({id:"zZOZj7"}),reblogsCount:s({id:"puY2t0"}),quotesCount:s({id:"eWLklq"}),density:s({id:"0tQ7AD"})}[T],H===T&&(de==="asc"?" ↑":" ↓")]},T))}),e("span",{class:"filter-label",children:e(p,{id:"group.filter"})})," ",e("fieldset",{class:"radio-field-group",children:pd.map(T=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:X===T,onChange:()=>{we(T)},disabled:T==="account"&&K}),{account:s({id:"dpqPBg"})}[T]||s({id:"EdQY6l"})]},T||"none"))}),K&&Le.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{j(null)},style:{whiteSpace:"nowrap"},children:e(p,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${Y||""} ${H?`catchup-sort-${H}`:""} ${K&&Se[K]?"catchup-selected-author":""} ${X?`catchup-group-${X}`:""}`,children:Re.map((T,B)=>{const J=T.reblog?.id||T.id;let oe=!1;return X==="account"&&(ze.current&&T.account.id!==ze.current&&B>0&&(oe=!0),ze.current=T.account.id),e(N,{children:[oe&&e("li",{class:"separator"}),e(vd,{to:`/${c}/s/${J}`,post:T,root:Te.current})]},`${T.id}-${oe}`)})}),e("footer",{children:ke.length>5&&e("p",{children:[s(Y==="boosts"?{id:"eVosYr"}:{id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{Te.current.scrollTop=0},children:e(p,{id:"0MgdN+"})}),"."]})})]})]})]}),Ne&&e(qe,{onClose:()=>ee(!1),children:e("div",{class:"sheet",id:"catchup-help-sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>ee(!1),children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(p,{id:"c3XJ18"})})}),e("main",{children:e("dl",{children:[e("dt",{children:e(p,{id:"EIZREX"})}),e("dd",{children:e(p,{id:"YmGrIy"})}),e("dt",{children:e(p,{id:"coaNtr"})}),e("dd",{children:e(p,{id:"UUrqX1"})}),e("dt",{children:e(p,{id:"ScQBC/"})}),e("dd",{children:e(p,{id:"srocAr"})}),e("dt",{children:e(p,{id:"77Emn0"})}),e("dd",{children:e("table",{children:e("tbody",{children:[e("tr",{children:[e("td",{children:e(p,{id:"Gy9P9T"})}),e("td",{children:e("kbd",{children:"j"})})]}),e("tr",{children:[e("td",{children:e(p,{id:"6XYpYY"})}),e("td",{children:e("kbd",{children:"k"})})]}),e("tr",{children:[e("td",{children:e(p,{id:"f5dduh"})}),e("td",{children:e("kbd",{children:"l"})})]}),e("tr",{children:[e("td",{children:e(p,{id:"rj0vxZ"})}),e("td",{children:e("kbd",{children:"h"})})]}),e("tr",{children:[e("td",{children:e(p,{id:"jsFF8C"})}),e("td",{children:e("kbd",{children:"Enter"})})]}),e("tr",{children:[e("td",{children:e(p,{id:"bUUv3P"})}),e("td",{children:e("kbd",{children:"."})})]})]})})})]})})]})})]})}const yd=ct(function({post:n}){const{id:i,account:s,group:o,reblog:a,quote:c,inReplyToId:h,inReplyToAccountId:d,_followedTags:r,_filtered:l,visibility:u,__BOOSTERS:f}=n,m=h&&d!==s.id,g=!!l&&l?.action!=="blur",y=w=>{w.shiftKey};return e("article",{class:`post-line ${o?"group":a?"reblog":Vt()&&Wn(c)?"quote":r?.length?"followed-tags":""} ${m?"reply-to":""} ${g?"filtered":""} visibility-${u}`,onMouseEnter:y,children:[e("span",{class:"post-author",children:a?e("span",{class:"post-reblog-avatar",children:[e(ut,{url:s.avatarStatic||s.avatar,squircle:s.bot}),f?.size>0?[...f].map(w=>e(ut,{url:w.avatarStatic||w.avatar,squircle:w.bot})):""," ",e(I,{icon:"rocket"})," ",e(gt,{account:a.account,showAvatar:!0})]}):Wn(c)?e("span",{class:"post-quote-avatar",children:[e(ut,{url:s.avatarStatic||s.avatar,squircle:s.bot})," ",e(I,{icon:"quote"})," ",e(gt,{account:c.quotedStatus?.account||c.account,showAvatar:!0})]}):e(gt,{account:s,showAvatar:!0})}),e(kd,{post:a||n,filterInfo:l}),e("span",{class:"post-meta",children:[e(Sd,{post:a||n})," ",e(xt,{datetime:new Date(a?.createdAt||n.createdAt),format:"micro"})]})]})},(n,i)=>n?.post?.id===i?.post?.id),vd=({root:n,to:i,...s})=>{const o=U(),[a,c]=R(!1);return V(()=>{const h=new IntersectionObserver(d=>{d[0].isIntersecting&&(queueMicrotask(()=>c(!0)),h.unobserve(o.current))},{root:n,rootMargin:`${Math.max(320,screen.height*.75)}px`});return o.current&&h.observe(o.current),()=>{o.current&&h.unobserve(o.current)}},[]),a?e("li",{children:e(ge,{to:i,children:e(yd,{...s})})}):e("li",{ref:o,style:{height:"4em"}})},bd=8,wd=8;function Os(n){const{spoilerText:i,content:s,poll:o,mediaAttachments:a,card:c}=n,h=o?.options?.length?o.options.reduce((r,l)=>r+l.title,""):"";return(i.length+po(s)+h.length)/140+(a?.length?bd*a.length:c?.image?wd:0)}const Nt=48;function kd({post:n,filterInfo:i}){const{_:s}=re();let{spoilerText:o,sensitive:a,content:c,emojis:h,poll:d,mediaAttachments:r,card:l,inReplyToId:u,inReplyToAccountId:f,account:m,_thread:g,quote:y}=n;const w=u&&f===m.id||!!g;let k=Vt()&&Wn(y)?y.quotedStatus||y:null;(k?.spoilerText||k?.sensitive)&&(k=null),k?.emojis&&h.push(...k.emojis),!r?.length&&k?.mediaAttachments?.length&&(r=k.mediaAttachments);const v=!!Ei()["reading:expand:spoilers"],_=v||!o&&!a&&i?.action!=="blur",S=c?Xn(n):"",A=!o||v;return e("div",{class:"post-peek",title:o?"":S,children:[e("span",{class:"post-peek-content",children:[w&&!A&&e(N,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:"Thread"})," "]}),i&&i?.action!=="blur"?e("span",{class:"post-peek-filtered",children:i?.titlesStr?s({id:"suKjh3",values:{0:i.titlesStr}}):s({id:"03Qqf9"})}):e(N,{children:[!!o&&e("span",{class:"post-peek-spoiler",children:[e(I,{icon:`${v?"eye-open":"eye-close"}`})," ",o]}),A&&e("div",{class:"post-peek-html",children:[w&&e(N,{children:[e("span",{class:"post-peek-tag post-peek-thread",children:e(p,{id:"e66y2Z"})})," "]}),!!c&&e("div",{dangerouslySetInnerHTML:{__html:Wa(c,h)+(k?.content?`<blockquote class="post-peek-quote">${k.content}</blockquote>`:"")}}),!!d?.options?.length&&d.options.map(C=>e("div",{children:[d.multiple?"▪️":"•"," ",C.title]})),!c&&r?.length===1&&r[0].description&&e(N,{children:[e("span",{class:"post-peek-tag post-peek-alt",children:"ALT"})," ",e("div",{children:r[0].description})]})]})]})]}),(!i||i?.action==="blur")&&e("span",{class:"post-peek-post-content",children:[!!d&&e("span",{class:"post-peek-tag post-peek-poll",children:[e(I,{icon:"poll",size:"s"}),e(p,{id:"4WUbF1"})]}),r?.length?r.map(C=>{const x=C.previewUrl||C.url,M=C.previewRemoteUrl||C.remoteUrl,$=C.meta?.original?C.meta.original.width:C.meta?.small?.width||C.meta?.original?.width,q=C.meta?.original?C.meta.original.height:C.meta?.small?.height||C.meta?.original?.height;return e("span",{class:"post-peek-media",children:{image:(x||M)&&_?e("img",{src:x,width:Nt,height:Nt,alt:C.description,loading:"lazy",onError:D=>{const{src:F}=D.target;F===x&&M&&x!==M&&(D.target.src=M)},style:{"--anim-duration":`${Math.min(Math.max(Math.max($,q)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(x||M)&&_?e("img",{src:x,width:Nt,height:Nt,alt:C.description,loading:"lazy",onError:D=>{const{src:F}=D.target;F===x&&M&&x!==M&&(D.target.src=M)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(x||M)&&_?e("img",{src:x,width:Nt,height:Nt,alt:C.description,loading:"lazy",onError:D=>{const{src:F}=D.target;F===x&&M&&x!==M&&(D.target.src=M)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[C.type]||null},C.id)}):!!l&&l.image&&_&&e("span",{class:`post-peek-media post-peek-card card-${l.type||""}`,children:l.image?e("img",{src:l.image,width:Nt,height:Nt,alt:l.title||l.description||l.imageDescription,loading:"lazy",style:{"--anim-duration":l.width&&l.height&&`${Math.min(Math.max(Math.max(l.width,l.height)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🔗"})})]})]})}function Sd({post:n}){const{_:i}=re(),{reblogsCount:s,repliesCount:o,favouritesCount:a,quotesCount:c}=n;return e("span",{class:"post-stats",children:[o>0&&e("span",{class:"post-stat-replies",children:[e(I,{icon:"comment2",size:"s",alt:i({id:"N8UzTV"})})," ",Ze(o)]}),a>0&&e("span",{class:"post-stat-likes",children:[e(I,{icon:"heart",size:"s",alt:i({id:"zZOZj7"})})," ",Ze(a)]}),s>0||c>0?e("span",{class:"post-stat-boosts",children:[e(I,{icon:"rocket",size:"s",alt:i({id:"puY2t0"})})," ",s>0||c>0?`${s>0?Ze(s):""}${s>0&&c>0?"+":""}${c>0?Ze(c):""}`:Ze(s)]}):null]})}function Cd(n,i,s){const o=n.map(r=>new Date(r[i])),a=o.reduce((r,l)=>l<r?l:r,o[0]),c=o.reduce((r,l)=>l>r?l:r,o[0]),h=Math.min(c.getTime(),Date.now())-a.getTime(),d=Array.from({length:s},()=>[]);return n.forEach(r=>{const l=Date.parse(r[i]);if(l>Date.now())d[d.length-1].push(r);else{const u=(l-a.getTime())/h,f=Math.floor(u*(s-1));d[f].push(r)}}),d}const _d=20;function jo(){const{_:n}=re();et(n({id:"zZOZj7"}),"/favourites");const{masto:i,instance:s}=ce(),o=U();async function a(c){return(c||!o.current)&&(o.current=i.v1.favourites.list({limit:_d}).values()),await o.current.next()}return e(Mt,{title:n({id:"zZOZj7"}),id:"favourites",emptyText:n({id:"PHIrMr"}),errorText:n({id:"khVljG"}),instance:s,fetchItems:a})}const Id=["home","public","notifications","thread","account"],zs=["thread","account"],Ad={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},xd=[0,1800,3600,360*60,720*60,3600*24,3600*24*7,3600*24*30],gi={0:{id:"qqeAJM"},1800:ot(30,"minute"),3600:ot(1,"hour"),21600:ot(6,"hour"),43200:ot(12,"hour"),86400:ot(24,"hour"),604800:ot(7,"day"),2592e3:ot(30,"day")};function Td(){const{_:n}=re(),{masto:i}=ce();et(n({id:"cSev+j"}),"/ft");const[s,o]=R("default"),[a,c]=R(!1),[h,d]=$t(u=>u+1,0),[r,l]=R([]);return V(()=>{o("loading"),(async()=>{try{const u=await i.v2.filters.list();u.sort((f,m)=>f.title.localeCompare(m.title)),u.forEach(f=>{f.keywords?.length&&f.keywords.sort((m,g)=>m.id-g.id)}),l(u),o("default")}catch{o("error")}})()},[h]),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(qt,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(p,{id:"cSev+j"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{c(!0)},children:e(I,{icon:"plus",size:"l",alt:n({id:"yFfBdX"})})})})]})}),e("main",{children:r.length>0?e(N,{children:[e("ul",{class:"filters-list",children:r.map(u=>{const{id:f,title:m,expiresAt:g,keywords:y}=u;return e("li",{children:[e("div",{children:[e("h2",{children:m}),y?.length>0&&e("div",{children:y.map(w=>e(N,{children:[e("span",{class:"tag collapsed insignificant",children:w.wholeWord?`${w.keyword}`:w.keyword})," "]}))}),e("small",{class:"insignificant",children:e(Yo,{expiresAt:g})})]}),e("button",{type:"button",class:"plain",onClick:()=>{c({filter:u})},children:e(I,{icon:"pencil",size:"l",alt:"Edit filter"})})]},f)})}),r.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(p,{id:"5vzJxv",values:{0:r.length}})})})]}):s==="loading"?e("p",{class:"ui-state",children:e(De,{})}):s==="error"?e("p",{class:"ui-state",children:e(p,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(p,{id:"cWIHTt"})})})]}),!!a&&e(qe,{title:n({id:"vCSBPD"}),onClose:()=>{c(!1)},children:e(Ld,{filter:a?.filter,onClose:u=>{u.state==="success"&&d(),c(!1)}})})]})}let Ed=1;const Rd=()=>Ed++;function Ld({filter:n,onClose:i}){const{_:s,_:o}=re(),{masto:a}=ce(),[c,h]=R("default"),d=!!n,{context:r,expiresAt:l,id:u,keywords:f,title:m,filterAction:g}=n||{},y=!!l,w=y&&new Date(l),[k,b]=R(f||[]),v=U(),[_,S]=R([]),[A,C]=R([]),x=k.filter(M=>!_.includes(M.id)&&!A.includes(M._id));return e("div",{class:"sheet",id:"filters-add-edit-modal",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:o(d?{id:"3mOee6"}:{id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:M=>{M.preventDefault();const $=new FormData(M.target),q=$.get("title"),D=$.getAll("keyword_attributes[][id]"),F=$.getAll("keyword_attributes[][keyword]"),Q=[...v.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(j=>j.checked),te=F.map((j,L)=>({id:D[L]||void 0,keyword:j,wholeWord:Q[L]}));d&&_?.length&&_.forEach(j=>{te.push({id:j,_destroy:!0})});const Y=$.getAll("context");let G=$.get("expires_in");const K=$.get("filter_action");!q||!Y?.length||(h("loading"),(async()=>{try{let j;d?(G===""||G===null?y?G=Math.floor((w-Date.now())/1e3):G=null:G==="0"||G===0?G=null:G=+G,j=await a.v2.filters.$select(u).update({title:q,context:Y,expiresIn:G,keywordsAttributes:te,filterAction:K})):(G=+G||null,j=await a.v2.filters.create({title:q,context:Y,expiresIn:G,keywordsAttributes:te,filterAction:K})),h("default"),i?.({state:"success",filter:j})}catch{h("error"),alert(o(d?{id:"H8RP+h"}:{id:"Fr0hAN"}))}})())},children:[e("div",{class:"filter-form-row",children:e("label",{children:[e("b",{children:e(p,{id:"MHrjPM"})}),e("input",{type:"text",name:"title",defaultValue:m,disabled:c==="loading",dir:"auto",enterKeyHint:"done",required:!0})]})}),e("div",{class:"filter-form-keywords",ref:v,children:[x.length?e("ul",{class:"filter-keywords",children:x.map(M=>{const{id:$,keyword:q,wholeWord:D,_id:F}=M;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:$}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:q,disabled:c==="loading",required:!0,dir:"auto",enterKeyHint:"done"}),e("div",{class:"filter-keyword-actions",children:[e("label",{children:[e("input",{name:"keyword_attributes[][whole_word]",type:"checkbox",value:$,defaultChecked:D,disabled:c==="loading"})," ",e(p,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:c==="loading",onClick:()=>{$?(_.push($),S([..._])):F&&(A.push(F),C([...A]))},children:e(I,{icon:"x",alt:o({id:"t/YqKh"})})})]})]},`${$}-${F}`)})}):e("div",{class:"filter-keywords",children:e("div",{class:"insignificant",children:e(p,{id:"SYKm3p"})})}),e("footer",{class:"filter-keywords-footer",children:[e("button",{type:"button",class:"light",onClick:()=>{b([...k,{_id:Rd(),keyword:"",wholeWord:!0}]),setTimeout(()=>{const M=v.current.querySelectorAll('input[type="text"]');M[M.length-1]?.focus?.()},10)},children:e(p,{id:"qn5Dbn"})})," ",x?.length>1&&e("small",{class:"insignificant",children:e(p,{id:"1JZ175",values:{0:x.length}})})]})]}),e("div",{class:"filter-form-cols",children:[e("div",{class:"filter-form-col",children:[e("div",{children:e("b",{children:e(p,{id:"uqf7Yq"})})}),Id.map(M=>e("div",{children:[e("label",{class:zs.includes(M)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:M,defaultChecked:r?r.includes(M):!0,disabled:c==="loading"})," ",s(Ad[M]),zs.includes(M)?"*":""]})," "]})),e("p",{children:e("small",{class:"insignificant",children:e(p,{id:"m0G499"})})})]}),e("div",{class:"filter-form-col",children:[d&&e(p,{id:"ucJk3m",components:{0:e("b",{}),1:e(Yo,{expiresAt:l,showNeverExpires:!0})}}),e("div",{children:[e("label",{for:"filters-expires_in",children:o(d?{id:"BcNdg+"}:{id:"agO/T/"})}),e("select",{id:"filters-expires_in",name:"expires_in",disabled:c==="loading",defaultValue:d?void 0:0,children:[d&&e("option",{}),xd.map(M=>e("option",{value:M,children:typeof gi[M]=="function"?gi[M]():s(gi[M])}))]})]}),e("p",{children:[e(p,{id:"blQMpa"}),e("br",{}),no()?.mastodon>=5&&e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"blur",defaultChecked:g==="blur",disabled:c==="loading"})," ",e(p,{id:"ggxOw9"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:g!=="hide"&&g!=="blur"||!d,disabled:c==="loading"})," ",e(p,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:g==="hide",disabled:c==="loading"})," ",e(p,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:c==="loading",children:o(d?{id:"tfDRzk"}:{id:"hYgDIe"})})," ",e(De,{abrupt:!0,hidden:c!=="loading"})]}),d&&e(bt,{disabled:c==="loading",align:"end",menuItemClassName:"danger",confirmLabel:o({id:"BPjyR2"}),onClick:()=>{h("loading"),(async()=>{try{await a.v2.filters.$select(u).remove(),h("default"),i?.({state:"success"})}catch{h("error"),alert(o({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:c==="loading",children:e(p,{id:"Jb6/SB"})})})]})]})})]})}function Yo({expiresAt:n,showNeverExpires:i}){const{_:s}=re(),o=!!n,a=o&&new Date(n),c=o&&Date.parse(n)<=Date.now(),[h,d]=$t(r=>r+1,0);return Di(d,c||3e4),c?s({id:"M1RnFv"}):o?e(p,{id:"urGtsw",components:{0:e(xt,{datetime:a})}}):i&&s({id:"O1Aswy"})}function $d(){const{_:n}=re(),{masto:i,instance:s}=ce();et(n({id:"Xi1/bw"}),"/fh");const[o,a]=R("default"),[c,h]=R([]);return V(()=>{a("loading"),(async()=>{try{const d=await Vn();h(d),a("default")}catch{a("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(qt,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(p,{id:"Xi1/bw"})}),e("div",{class:"header-side"})]})}),e("main",{children:c.length>0?e(N,{children:[e("ul",{class:"link-list",children:c.map(d=>e("li",{children:e(ge,{to:s?`/${s}/t/${d.name}`:`/t/${d.name}`,children:[e(I,{icon:"hashtag",alt:"#"})," ",e("span",{children:d.name})]})}))}),c.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(p,{id:"2S/uvJ",values:{0:c.length}})})})]}):o==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):o==="error"?e("p",{class:"ui-state",children:e(p,{id:"2AeREO"})}):e("p",{class:"ui-state",children:e(p,{id:"vKsGhk"})})})]})})}const Md=20;function es({title:n,path:i,id:s,...o}){const{_:a}=re();et(n||a({id:"following.title"}),i||"/following");const{masto:c,streaming:h,instance:d,client:r}=ce(),[l,u]=R(h),f=We(E),m=U(),g=U(),y=U();V(()=>{!h&&r?.onStreamingReady&&r.onStreamingReady(v=>{u(v)})},[r]),__BENCHMARK.end("time-to-following");const w=Qe("@pixelfed/home-include-reblogs");async function k(v){(v||!g.current)&&(__BENCHMARK.start("fetch-home-first"),m.current=c.v1.timelines.home.list({limit:Md}),g.current=m.current.values()),w&&m.current?.params&&(typeof m.current.params=="string"?m.current.params+="&include_reblogs=true":m.current.params.include_reblogs=!0);const _=await g.current.next();let{value:S}=_;if(S?.length){let A=!1;v&&(S[0].id!==y.current&&(A=!0),y.current=S[0].id),S.forEach(C=>{Je(C,d)}),S=Ps(S,d),v&&A&&Yl(),setTimeout(()=>{Fo(S,d)},100),S.sort((C,x)=>Date.parse(x.createdAt)-Date.parse(C.createdAt))}return __BENCHMARK.end("fetch-home-first"),{..._,value:S}}async function b(){try{const v={limit:5,since_id:y.current};Qe("@pixelfed/home-include-reblogs")&&(v.include_reblogs=!0);const _=await c.v1.timelines.home.list(v).values().next();let{value:S}=_;const A=S[0]?.id===y.current;return!!(S?.length&&!A&&(y.current=S[0].id,S=Ps(S,d),S=Gt(S,"home"),S.some(C=>!C.reblog)))}catch{return!1}}return V(()=>{let v;return(async()=>{if(l){v=l.user.subscribe();for await(const _ of v){if(!v)break;if(_.event==="status.update"){const S=_.payload;Je(S,d)}else if(_.event==="delete"){const S=_.payload,A=io(S,d);A&&(A._deleted=!0)}}}})(),()=>{v?.unsubscribe?.(),v=null}},[l]),e(Mt,{title:n||a({id:"following.title"}),id:s||"following",emptyText:a({id:"nJEKbY"}),errorText:a({id:"7QSeK6"}),instance:d,fetchItems:k,checkForUpdates:b,useItemID:!0,boostsCarousel:f.settings.boostsCarousel,...o,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Pd=20,Nd=4,Bs=Nd+1;function Vo({media:n,columnMode:i,...s}){const{_:o}=re();let{hashtag:a,...c}=i?{}:Bt();s.hashtag&&(a=s.hashtag);let h=a.trim().split(/[\s+]+/);h.sort(),a=h[0];const[d,r]=_t(),l=n||!!d.get("media"),u=l?"?media=1":"",{masto:f,instance:m,authenticated:g}=ce({instance:s?.instance||c.instance}),{masto:y,instance:w,authenticated:k}=ce(),b=h.map(L=>`#${L}`).join(" "),v=o(m?l?{id:"kH0rA0",values:{hashtagTitle:b,instance:m}}:{id:"IK0zKi",values:{hashtagTitle:b,instance:m}}:l?{id:"hHSI3w",values:{hashtagTitle:b}}:{id:"+ZzjRY",values:{hashtagTitle:b}});et(v,"/:instance?/t/:hashtag");const _=U(),S=_e(()=>Mi(),[]),A=U(void 0);async function C(L){const Z=await f.v1.timelines.tag.$select(a).list({limit:Pd,any:h.slice(1),maxId:L?void 0:A.current,onlyMedia:l?!0:void 0}).values().next();let{value:H}=Z;return H?.length&&(L&&(_.current=H[0].id),H.forEach(W=>{Je(W,m,{skipThreading:l||S})}),A.current=H[H.length-1].id),{...Z,value:H}}async function x(){try{const L=await f.v1.timelines.tag.$select(a).list({limit:1,any:h.slice(1),since_id:_.current,onlyMedia:l}).values().next();let{value:Z}=L;const H=Z[0]?.id===_.current;return Z?.length&&!H?(Z=Gt(Z,"public"),!0):!1}catch{return!1}}const[M,$]=R("default"),[q,D]=R();V(()=>{(async()=>{try{const L=await f.v1.tags.$select(a).fetch();D(L)}catch{}})()},[a]);const F=h.length>=Bs,[Q,te]=R("default"),[Y,G]=R([]),[K,j]=R(!1);return V(()=>{g&&(async()=>{try{const L=await f.v1.featuredTags.list();G(L),j(L.some(Z=>Z.name.toLowerCase()===a.toLowerCase()))}catch{}})()},[]),e(N,{children:[e(Mt,{title:v,titleComponent:!!m&&e("h1",{class:"header-double-lines",children:[e("b",{dir:"auto",children:b}),e("div",{children:m})]}),id:"hashtag",instance:m,emptyText:o({id:"CNSLAW"}),errorText:o({id:"yjj6Ll"}),fetchItems:C,checkForUpdates:x,useItemID:!0,view:l||S?"media":void 0,refresh:l,filterContext:"public",headerEnd:e(ft,{portal:!0,setDownOverflow:!0,overflow:"auto",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:o({id:"2FYpfJ"})})}),children:[!!q&&h.length===1&&e(N,{children:[e(bt,{subMenu:!0,confirm:q.following,confirmLabel:o({id:"ctJi7k",values:{hashtag:a}}),disabled:M==="loading"||!g,onClick:()=>{$("loading"),q.following?f.v1.tags.$select(a).unfollow().then(()=>{D({...q,following:!1}),he(o({id:"doK/ij",values:{hashtag:a}}))}).catch(L=>{alert(L)}).finally(()=>{$("default")}):f.v1.tags.$select(a).follow().then(()=>{D({...q,following:!0}),he(o({id:"R9+aEN",values:{hashtag:a}}))}).catch(L=>{alert(L)}).finally(()=>{$("default")})},children:q.following?e(N,{children:[e(I,{icon:"check-circle"})," ",e("span",{children:e(p,{id:"HOSk7R"})})]}):e(N,{children:[e(I,{icon:"plus"})," ",e("span",{children:e(p,{id:"MKEPCY"})})]})}),e(ve,{type:"checkbox",checked:K,disabled:Q==="loading"||!g,onClick:()=>{if(te("loading"),K){const L=Y.find(Z=>Z.name.toLowerCase()===a.toLowerCase()).id;L?f.v1.featuredTags.$select(L).remove().then(()=>{j(!1),he(o({id:"VH+Tf9"})),G(Y.filter(Z=>Z.id!==L))}).catch(Z=>{}).finally(()=>{te("default")}):he(o({id:"3OLv47"}))}else f.v1.featuredTags.create({name:a}).then(L=>{j(!0),he(o({id:"9ra4hn"})),G(Y.concat(L))}).catch(L=>{}).finally(()=>{te("default")})},children:K?e(N,{children:[e(I,{icon:"check-circle"}),e("span",{children:e(p,{id:"9ra4hn"})})]}):e(N,{children:[e(I,{icon:"check-circle"}),e("span",{children:e(p,{id:"UlJ3QN"})})]})}),e(je,{})]}),!S&&e(N,{children:[e(Bi,{className:"plain",children:e(p,{id:"cSev+j"})}),e(ve,{type:"checkbox",checked:!!l,onClick:()=>{l?d.delete("media"):d.set("media","1"),r(d)},children:[e(I,{icon:"check-circle",alt:"☑️"})," ",e("span",{class:"menu-grow",children:e(p,{id:"eK4SL/"})})]}),e(je,{})]}),e(Za,{className:"menu-field",disabled:F,children:({ref:L})=>e("form",{onSubmit:Z=>{Z.preventDefault();const H=Z.target[0].value?.trim?.();H&&!h.some(W=>W.toLowerCase()===H.toLowerCase())&&(h.push(H),h.sort(),location.hash=m?`/${m}/t/${h.join("+")}${u}`:`/t/${h.join("+")}${u}`)},children:[e(I,{icon:"hashtag"}),e("input",{ref:L,type:"text",placeholder:F?me._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:Bs}}):o({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^#][^\\s#]+[^#]",disabled:F,dir:"auto",enterKeyHint:"go"})]})}),e(Xa,{takeOverflow:!0,children:h.map((L,Z)=>e(ve,{disabled:h.length===1,onClick:H=>{h.splice(Z,1),h.sort(),location.hash=m?`/${m}/t/${h.join("+")}${u}`:`/t/${h.join("+")}${u}`},children:[e(I,{icon:"x",alt:o({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),L]})]},L))}),e(je,{}),e(ve,{disabled:!k,onClick:()=>{if(E.shortcuts.length>=Rt){alert(me._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:Rt}}));return}const L={type:"hashtag",hashtag:h.join(" "),instance:m,media:l?"on":void 0};E.shortcuts.some(H=>H.type===L.type&&H.hashtag.split(/[\s+]+/).sort().join(" ")===L.hashtag.split(/[\s+]+/).sort().join(" ")&&(H.instance?H.instance===L.instance:!0)&&(H.media?!!H.media==!!L.media:!0))?alert(o({id:"kfeQnS"})):(E.shortcuts.push(L),he(o({id:"MIhb91"})))},children:[e(I,{icon:"shortcut"})," ",e("span",{children:e(p,{id:"i02Lq/"})})]}),e(ve,{onClick:()=>{let L=prompt(o({id:"2MQ2cd"}));if(!/\./.test(L)){L&&alert(o({id:"7WddtO"}));return}L&&(L=L.toLowerCase().trim(),location.hash=`/${L}/t/${h.join("+")}${u}`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(p,{id:"Sq04Yc"})})]}),w!==m&&e(ve,{onClick:()=>{location.hash=`/${w}/t/${h.join("+")}${u}`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(p,{id:"iAzCp4",values:{currentInstance:w},components:{0:e("b",{})}})})]})]})},m+b),!i&&!!h?.length&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`${h.length>1?`
`:" "}${b}`}})})]})}const Dd=20;function Go(n){const{_:i}=re(),s=We(E),{masto:o,instance:a}=ce(),c=n?.id||Bt()?.id,h=U(),d=U();async function r(v){(v||!d.current)&&(d.current=o.v1.timelines.list.$select(c).list({limit:Dd}).values());const _=await d.current.next();let{value:S}=_;return S?.length&&(v&&(h.current=S[0].id),S.forEach(A=>{Je(A,a)})),{..._,value:S}}async function l(){try{const v=await o.v1.timelines.list.$select(c).list({limit:1,since_id:h.current});let{value:_}=v;const S=_[0]?.id===h.current;return _?.length&&!S?(_=Gt(_,"home"),!0):!1}catch{return!1}}const[u,f]=R([]),[m,g]=R({title:"List"});et(m.title,"/l/:id"),V(()=>{(async()=>{try{const v=await To(c);g(v)}catch{}})()},[c]);const[y,w]=R(!1),[k,b]=R(!1);return e(N,{children:[e(Mt,{title:m.title,id:"list",emptyText:i({id:"KkDhfU"}),errorText:i({id:"7QSeK6"}),instance:a,fetchItems:r,checkForUpdates:l,useItemID:!0,boostsCarousel:s.settings.boostsCarousel,filterContext:"home",showReplyParent:!0,headerStart:e(ft,{overflow:"auto",menuButton:e("button",{type:"button",class:"plain",children:[e(I,{icon:"list",size:"l",alt:i({id:"h16FyT"})}),e(I,{icon:"chevron-down",size:"s"})]}),onMenuChange:v=>{v.open&&kn().then(f)},children:[e(He,{to:"/l",children:e("span",{children:e(p,{id:"BHWx+g"})})}),u?.length>0&&e(N,{children:[e(je,{}),u.map(v=>e(He,{to:`/l/${v.id}`,children:e("span",{children:[v.title,v.exclusive&&e(N,{children:[" ",e(Zt,{})]})]})},v.id))]})]}),headerEnd:e(ft,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:i({id:"2FYpfJ"})})}),children:[m?.exclusive&&e(N,{children:[e(Bi,{className:"plain",children:[e(Zt,{})," ",e(p,{id:"FNptcJ"})]}),e(je,{})]}),e(ve,{onClick:()=>w({list:m}),children:[e(I,{icon:"pencil",size:"l"}),e("span",{children:e(p,{id:"ePK91l"})})]}),e(ve,{onClick:()=>b(!0),children:[e(I,{icon:"group",size:"l"}),e("span",{children:e(p,{id:"hB02vO"})})]})]})},c),y&&e(qe,{onClick:v=>{v.target===v.currentTarget&&w(!1)},children:e(Wi,{list:y?.list,onClose:v=>{v.state==="success"&&v.list?g(v.list):v.state==="deleted"&&(location.hash="/l"),w(!1)}})}),k&&e(qe,{onClick:v=>{v.target===v.currentTarget&&b(!1)},children:e(zd,{listID:c,onClose:()=>b(!1)})})]})}const Od=40;function zd({listID:n,onClose:i}){const{_:s}=re(),{masto:o,instance:a}=ce(),[c,h]=R([]),[d,r]=R("default"),[l,u]=R(!1),f=U();async function m(g){u(!1),r("loading"),(async()=>{try{(g||!f.current)&&(f.current=o.v1.lists.$select(n).accounts.list({limit:Od}).values());const y=await f.current.next();let{done:w,value:k}=y;k?.length?(h(g?k:c.concat(k)),u(!w)):u(!1),r("default")}catch{r("error")}})()}return V(()=>{m(!0)},[]),e("div",{class:"sheet",id:"list-manage-members-container",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(p,{id:"hB02vO"})})}),e("main",{children:e("ul",{children:[c.map(g=>e("li",{children:[e(yt,{account:g,instance:a}),e(Bd,{account:g,listID:n})]},g.id)),l&&d==="default"&&e(Lt,{as:"li",onChange:g=>g&&m(),children:e("button",{type:"button",class:"light block",onClick:m,children:e(p,{id:"uXRAkV"})})})]})})]})}function Bd({account:n,listID:i}){const{_:s}=re(),{masto:o}=ce(),[a,c]=R("default"),[h,d]=R(!1);return e(bt,{confirm:!h,confirmLabel:e("span",{children:e(p,{id:"j5n9Ry",values:{0:n.username},components:{0:e("span",{class:"bidi-isolate"})}})}),align:"end",menuItemClassName:"danger",onClick:()=>{h?(c("loading"),(async()=>{try{await o.v1.lists.$select(i).accounts.create({accountIds:[n.id]}),c("default"),d(!1)}catch{c("error")}})()):(c("loading"),(async()=>{try{await o.v1.lists.$select(i).accounts.remove({accountIds:[n.id]}),c("default"),d(!0)}catch{c("error")}})())},children:e("button",{type:"button",class:`light ${h?"":"danger"}`,disabled:a==="loading",children:s(h?{id:"m16xKo"}:{id:"MWIaew"})})})}const qd={mention:["account","status"],quote:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]},Ud=["favourite","reblog","follow"],Wo=n=>Ud.includes(n);function Zo(n){return n.filter(i=>{const{type:s,id:o,createdAt:a}=i;if(!s)return!1;const c=qd[s];return c?.length?c.every(h=>!!i[h]):!0})}function Xo(n){if(n?.notificationGroups){const{accounts:i=[],notificationGroups:s=[],statuses:o=[]}=n;return s.map(a=>{const{sampleAccountIds:c,statusId:h}=a,d=c?.map(l=>i.find(u=>u.id===l))||[],r=o?.find(l=>l.id===h)||null;return{...a,sampleAccounts:d,status:r}})}return n}function Fd(n){const i=n.map(h=>{const{latestPageNotificationAt:d,mostRecentNotificationId:r,sampleAccounts:l,notificationsCount:u}=h;return{id:""+r,createdAt:d,account:l[0],...h}}),s={},o=[];for(let h=0;h<i.length;h++){const d=i[h],{type:r,status:l,createdAt:u,notificationsCount:f,sampleAccounts:m,groupKey:g}=d,y=u?new Date(u).toLocaleDateString():"";let w=r;!(f>0&&m?.length>0&&f>m?.length)&&(r==="favourite"||r==="reblog")&&(w="favourite+reblog");const b=`${l?.id}-${w}-${y}`,v=s[b];if(!Wo(r))o.push(d);else if(v)m.forEach(_=>{const S=v.sampleAccounts.find(A=>A.id===_.id);S?(S._types.push(r),S._types.sort().reverse()):v.sampleAccounts.push({..._,_types:[r]})}),v.notificationsCount=Math.min(v.notificationsCount,f),v._notificationsCount.push(f),v._sampleAccountsCount.push(m?.length),v._accounts=v.sampleAccounts,v._groupKeys.push(g);else{const _=m.map(S=>({...S,_types:[r]}));s[b]={...d,sampleAccounts:_,type:w,_accounts:_,_groupKeys:g?[g]:[],_notificationsCount:[f],_sampleAccountsCount:[m?.length]},o.push(s[b])}}const a={},c=[];for(let h=0;h<o.length;h++){const d=o[h],{type:r,account:l,_accounts:u,sampleAccounts:f,createdAt:m,groupKey:g}=d,y=m?new Date(m).toLocaleDateString():"",w=f?.length===1||u?.length===1;if((r==="favourite"||r==="reblog"||r==="favourite+reblog")&&w){const k=`${l?.id}-${r}-${y}`,b=a[k];if(b)b._statuses.push(d.status),b._ids+=`-${d.id}`,b._groupKeys.push(g);else{let v=a[k]={...d,type:r,_ids:d.id,_statuses:[d.status],_groupKeys:g?[g]:[]};c.push(v)}}else c.push(d)}return c}function Kd(n){n=Zo(n);const i={},s=[];for(let c=0,h=0;c<n.length;c++){const d=n[c],{id:r,status:l,account:u,type:f,createdAt:m}=d,g=m?new Date(m).toLocaleDateString():"";let y=f;(f==="favourite"||f==="reblog")&&(y="favourite+reblog");const w=`${l?.id}-${y}-${g}`,k=i[w];if(!Wo(f))s[h++]=d;else if(k?.account){const b=k._accounts.find(v=>v.id===u.id);b?(b._types.push(f),b._types.sort().reverse(),k._ids+=`-${r}`):(u._types=[f],k._accounts.push(u),k._ids+=`-${r}`)}else{u&&(u._types=[f]);let b=i[w]={...d,type:y,_ids:r,_accounts:u?[u]:[]};s[h++]=b}}const o={},a=[];for(let c=0,h=0;c<s.length;c++){const d=s[c],{id:r,account:l,_accounts:u,type:f,createdAt:m}=d,g=m?new Date(m).toLocaleDateString():"";if(f==="favourite+reblog"&&l&&u.length===1){const y=`${l?.id}-${f}-${g}`,w=o[y];if(w)w._statuses.push(d.status),w._ids+=`-${r}`;else{let k=o[y]={...d,type:f,_ids:r,_statuses:[d.status]};a[h++]=k}}else a[h++]=d}return a}const qs=20,Hd=new URLSearchParams;function Qo({columnMode:n,...i}){const{_:s}=re(),{masto:o,instance:a}=ce(),[c]=n?[Hd]:_t(),[h,d]=R(null),r=i?.type||c.get("type")||h;et(s(r==="private"?{id:"2BApYc"}:{id:"/bZzdR"}),"/mentions");const l=U(),u=U();async function f(v){(v||!l.current)&&(l.current=o.v1.notifications.list({limit:qs,types:["mention"]}).values());const _=await l.current.next();let{value:S}=_;return S?.length&&(S=Zo(S),v&&(u.current=S[0].id),S.forEach(({status:A})=>{Je(A,a)})),{..._,value:S?.map(A=>A.status)}}const m=U(),g=U();async function y(v){(v||!m.current)&&(m.current=o.v1.conversations.list({limit:qs}).values());const _=await m.current.next();let{value:S}=_;return S=S?.filter(A=>A.lastStatus),S?.length&&(v&&(g.current=S[0].lastStatus.id),S.forEach(({lastStatus:A})=>{Je(A,a)})),{..._,value:S?.map(A=>A.lastStatus)}}function w(...v){return r==="private"?y(...v):f(...v)}async function k(){if(r==="private")try{const v=await o.v1.conversations.list({limit:1,since_id:g.current}).values().next();let{value:_}=v;const S=_[0]?.id===g.current;return _?.length&&!S?(g.current=_[0].lastStatus.id,!0):!1}catch{return!1}else try{const v=await o.v1.notifications.list({limit:1,types:["mention"],since_id:u.current}).values().next();let{value:_}=v;return _?.length?(u.current=_[0].id,!0):!1}catch{return!1}}const b=_e(()=>e("div",{class:"filter-bar centered",children:[e(ge,{to:"/mentions",class:r?"":"is-active",onClick:v=>{n&&(v.preventDefault(),d(null))},children:e(p,{id:"N40H+G"})}),e(ge,{to:"/mentions?type=private",class:r==="private"?"is-active":"",onClick:v=>{n&&(v.preventDefault(),d("private"))},children:e(p,{id:"zwBp5t"})})]}),[r]);return e(Mt,{title:s({id:"/bZzdR"}),id:"mentions",emptyText:s({id:"03jFGT"}),errorText:s({id:"pqR9KF"}),instance:a,fetchItems:w,checkForUpdates:k,useItemID:!0,timelineStart:b,refresh:r,filterContext:"notifications"})}const jd=80,Yd=20,Vd=new URLSearchParams,An={block:"center",inline:"center",behavior:"smooth"},Jo=Pi(()=>no()?.mastodon>=2,{maxAge:1e3*60*5});function ea(n={}){const{masto:i}=ce();return Jo()?i.v2.notifications.list({limit:Yd,...n}):i.v1.notifications.list({limit:jd,...n})}function ta(n={}){return ea(n).values()}function na(n){return Jo()?Fd(n):Kd(n)}const Gd=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],Wd={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function Zd({columnMode:n}){const{_:i,_:s}=re();et(s({id:"iDNBZe"}),"/notifications");const{masto:o,instance:a}=ce(),c=We(E),[h,d]=R("default"),[r]=n?[Vd]:_t(),l=r.get("id"),u=r.get("access_token"),[f,m]=R(!1),[g,y]=R(!1),w=U(),{nearReachEnd:k,scrollDirection:b,reachStart:v,nearReachStart:_}=Vl({scrollableRef:w}),S=b==="end"&&!_,[A,C]=R([]),[x,M]=R([]),$=U(),q=U();async function D(O){if((O||!q.current)&&($.current=ea({excludeTypes:["follow_request"]}),q.current=$.current.values()),/max_id=($|&)/i.test(q.current?.nextParams))return{done:!0};const be=await q.current.next(),Pe=Xo(be.value);if(Pe?.length){Pe.forEach(P=>{Je(P.status,a,{skipThreading:!0})});const Be=na(Pe);O?(E.notificationsLast=Be[0],E.notifications=Be,o.v1.markers.create({notifications:{lastReadId:Be[0].id}}).catch(()=>{})):E.notifications.push(...Be)}return E.notificationsShowNew=!1,E.notificationsLastFetchTime=Date.now(),be}async function F(){try{return await o.v1.followRequests.list({limit:80})}catch{return[]}}const Q=()=>{d("loading"),(async()=>{try{const O=await F();C(O),d("default")}catch{d("error")}})()};async function te(){try{return await o.v1.announcements.list()}catch{return[]}}const Y=Qe("@mastodon/filtered-notifications"),[G,K]=R(!1),[j,L]=R({});function Z(){return o.v2.notifications.policy.fetch().catch(()=>{})}function H(){Z().then(O=>{L(O)}).catch(()=>{})}const[W,de]=R(null);function se(){return o.v1.notifications.requests.list()}const X=O=>{ke(!1),d("loading"),(async()=>{try{const be=D(O);O&&(te().then(Be=>{Be.sort((P,ue)=>Date.parse(ue.updatedAt||ue.createdAt)-Date.parse(P.updatedAt||P.createdAt)),M(Be)}).catch(()=>{}),F().then(Be=>{C(Be)}).catch(()=>{}),Y&&H());const{done:Pe}=await be;m(!Pe),d("default")}catch{d("error")}})()};V(()=>{X(!0)},[]),V(()=>{v&&X(!0)},[v]);const[we,ke]=R(!1),Se=it(({disableIdleCheck:O=!1}={})=>{h!=="loading"&&c.settings.autoRefresh&&w.current?.scrollTop<16&&(O||window.__IDLE__)&&!Xd()&&X(!0)},[c.notificationsShowNew,c.settings.autoRefresh,h]),Oe=U();on(O=>{if(O){const be=Date.now()-Oe.current;!Oe.current||be>1e3*3?Se({disableIdleCheck:!0}):Oe.current=Date.now()}});const xe=U(!0);V(()=>{let O=_a(E,"notificationsShowNew",be=>{if(xe.current){xe.current=!1;return}h!=="loading"&&(be&&Se(),ke(be))});return()=>O?.()},[]);const Le=new Date,Re=new Date(Le-1440*60*1e3);let ze=new Date;const Ue=!c.notifications.some(O=>new Date(O.createdAt).toDateString()===Le.toDateString()),Ke=U();V(()=>{l&&(E.routeNotification={id:l,accessToken:atob(u)})},[l,u]);const[Ve,le]=R(null);V(async()=>{const O=new Date;if(O.getMonth()!==11||!Qe("@mastodon/annual-report"))return;let be=Ie.account.get("annualReportNotification");if(be){le(be);return}const Pe=ta({types:["annual_report"]});try{be=(await Pe.next())?.value?.notificationGroups?.[0],be?.annualReport?.year==O.getFullYear()&&(le(be),Ie.account.set("annualReportNotification",be))}catch{}},[]);const $e=".notification",Te=Fe("j",()=>{const O=document.activeElement.closest($e),be=O?.getBoundingClientRect(),Pe=Array.from(w.current.querySelectorAll($e));if(O&&be.top<w.current.clientHeight&&be.bottom>0){const Be=Pe.indexOf(O);let P=Pe[Be+1];P&&(P.focus(),P.scrollIntoView(An))}else{const Be=Pe.find(P=>{const ue=P.getBoundingClientRect();return ue.top>=44&&ue.left>=0});Be&&(Be.focus(),Be.scrollIntoView(An))}},{useKey:!0,ignoreEventWhen:O=>O.metaKey||O.ctrlKey||O.altKey||O.shiftKey}),ae=Fe("k",()=>{const O=document.activeElement.closest($e),be=O?.getBoundingClientRect(),Pe=Array.from(w.current.querySelectorAll($e));if(O&&be.top<w.current.clientHeight&&be.bottom>0){const Be=Pe.indexOf(O);let P=Pe[Be-1];P&&(P.focus(),P.scrollIntoView(An))}else{const Be=Pe.find(P=>{const ue=P.getBoundingClientRect();return ue.top>=44&&ue.left>=0});Be&&(Be.focus(),Be.scrollIntoView(An))}},{useKey:!0,ignoreEventWhen:O=>O.metaKey||O.ctrlKey||O.altKey||O.shiftKey}),Ne=Fe(["enter","o"],()=>{const be=document.activeElement.closest($e)?.querySelector(".status-link");be&&be.click()},{useKey:!0,ignoreEventWhen:O=>O.metaKey||O.ctrlKey||O.altKey||O.shiftKey}),ee=new Date,Ae=_e(()=>at(ee,{forceOpts:{weekday:"long"}}),[ee]);return e("div",{id:"notifications-page",class:"deck-container",ref:O=>{w.current=O,Te.current=O,ae.current=O,Ne.current=O},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${g?"only-mentions":""}`,children:[e("header",{hidden:S,onClick:O=>{O.target.closest("a, button")||w.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:O=>{O.target.closest("a, button")||X(!0)},class:h==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(qt,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:s({id:"i0qMbr"})})})]}),e("h1",{children:e(p,{id:"iDNBZe"})}),e("div",{class:"header-side",children:Y&&e("button",{type:"button",class:"button plain4",onClick:()=>{K(!0)},children:e(I,{icon:"settings",size:"l",alt:s({id:"a/+arl"})})})})]}),we&&h!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{X(!0),w.current?.scrollTo({top:0,behavior:"smooth"})},children:[e(I,{icon:"arrow-up"})," ",e(p,{id:"Jy9RU/"})]})]}),x.length>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("details",{class:"announcements",children:[e("summary",{children:[e("span",{children:[e(I,{icon:"announce",class:"announcement-icon",size:"l"})," ",e(p,{id:"0whvLM",values:{0:x.length}})," ",e("small",{class:"insignificant",children:a})]}),x.length>1&&e("span",{class:"announcements-nav-buttons",children:x.map((O,be)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{Ke.current?.children[be].scrollIntoView({behavior:"smooth",block:"nearest"})},children:be+1}))})]}),e("ul",{class:`announcements-list-${x.length>1?"multiple":"single"}`,ref:Ke,children:x.map(O=>e("li",{children:e(Qd,{announcement:O})}))})]})})}),A.length>0&&e("div",{class:"follow-requests",children:[e("h2",{class:"timeline-header",children:e(p,{id:"6Fs1Ba"})}),A.length>5?e("details",{children:[e("summary",{children:e(p,{id:"7dHKu4",values:{0:A.length}})}),e("ul",{children:A.map(O=>e("li",{children:[e(yt,{account:O}),e(Ii,{accountID:O.id,onChange:()=>{}})]},O.id))})]}):e("ul",{children:A.map(O=>e("li",{children:[e(yt,{account:O}),e(Ii,{accountID:O.id,onChange:()=>{}})]},O.id))})]}),Y&&j?.summary?.pendingRequestsCount>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"filtered-notifications",children:e("details",{onToggle:async O=>{const{open:be}=O.target;if(be){const Pe=await se();de(Pe)}},children:[e("summary",{children:e(p,{id:"N3Bq0f",values:{0:j.summary.pendingRequestsCount}})}),W?W?.length>0&&e("ul",{children:W.map(O=>e("li",{children:[e("div",{class:"request-notifcations",children:[!O.lastStatus?.id&&e(yt,{useAvatarStatic:!0,showStats:!0,account:O.account}),O.lastStatus?.id&&e("div",{class:"last-post",children:e(ge,{class:"status-link",to:`/${a}/s/${O.lastStatus.id}`,children:e(Ye,{status:O.lastStatus,size:"s",readOnly:!0})})}),e(eu,{request:O})]}),e(tu,{request:O,onChange:()=>{X(!0)}})]},O.id))}):e("p",{class:"ui-state",children:e(De,{abrupt:!0})})]})})})}),Ve&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e(bn,{notification:Ve})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:g,onChange:O=>{y(O.target.checked)}})," ",e(p,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:[e(p,{id:"ecUA8p"})," ",e("small",{class:"insignificant bidi-isolate",children:Ae})]}),Ue&&e("p",{class:"ui-state insignificant",children:h==="default"?s({id:"KS7iJH"}):e(N,{children:"…"})}),c.notifications.length?e(Jn.Provider,{value:"notifications",children:c.notifications.filter(O=>O.type!=="follow_request").map(O=>{if(g&&O.type!=="mention")return null;const be=new Date(O.createdAt),Pe=be.toDateString()!==ze.toDateString();Pe&&(ze=be);const Be=be.toDateString()===Re.toDateString()?s({id:"y/0uwd"}):at(ze,{hideTime:!0}),P=at(ze,{forceOpts:{weekday:"long"}});return e(N,{children:[Pe&&e("h2",{class:"timeline-header",children:[e("span",{children:Be})," ",e("small",{class:"insignificant bidi-isolate",children:P})]}),e(bn,{instance:a,notification:O},O._ids||O.id)]},O._ids||O.id)})}):e(N,{children:[h==="loading"&&e(N,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((O,be)=>e("li",{class:"notification skeleton",children:[e("div",{class:"notification-type",children:e(I,{icon:"notification",size:"xl"})}),e("div",{class:"notification-content",children:e("p",{children:"███████████ ████"})})]}))})}),h==="error"&&e("p",{class:"ui-state",children:[e(p,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>X(!0),children:e(p,{id:"KDw4GX"})})]})]}),f&&e(Lt,{onChange:O=>{O&&X()},children:e("button",{type:"button",class:"plain block",disabled:h==="loading",onClick:()=>X(),style:{marginBlockEnd:"6em"},children:h==="loading"?e(De,{abrupt:!0}):e(p,{id:"uXRAkV"})})})]}),Y&&G&&e(qe,{onClick:O=>{O.target===O.currentTarget&&K(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>K(!1),children:e(I,{icon:"x",alt:s({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:e(p,{id:"a/+arl"})})}),e("main",{children:e("form",{onSubmit:O=>{O.preventDefault();const{forNotFollowing:be,forNotFollowers:Pe,forNewAccounts:Be,forPrivateMentions:P,forLimitedAccounts:ue}=O.target,T={...j,forNotFollowing:be.value,forNotFollowers:Pe.value,forNewAccounts:Be.value,forPrivateMentions:P.value,forLimitedAccounts:ue.value};L(T),K(!1),(async()=>{try{await o.v2.notifications.policy.update(T),he(s({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(p,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:Gd.map(O=>{const be=j[O];return e("div",{children:e("label",{children:[i(Wd[O]),e("select",{name:O,defaultValue:be,class:"small",children:[e("option",{value:"accept",children:e(p,{id:"g3UF2V"})}),e("option",{value:"filter",children:e(p,{id:"o7J4JM"})}),e("option",{value:"drop",children:e(p,{id:"gbbkE7"})})]})]})},O)})}),e("p",{children:e("button",{type:"submit",children:e(p,{id:"tfDRzk"})})})]})})]})})]})}function Xd(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function Qd({announcement:n}){const{instance:i}=ce(),{contact:s}=eo(),o=s?.account,{id:a,content:c,startsAt:h,endsAt:d,published:r,allDay:l,publishedAt:u,updatedAt:f,read:m,mentions:g,statuses:y,tags:w,emojis:k,reactions:b}=n,v=new Date(u),_=at(v),S=new Date(f),A=at(S);return e("div",{class:"announcement-block",children:[e(yt,{account:o}),e("div",{class:"announcement-content",onClick:uo({mentions:g,instance:i}),dangerouslySetInnerHTML:{__html:vi(c,{emojis:k})}}),e("p",{class:"insignificant",children:[e("time",{datetime:v.toISOString(),children:at(v)}),f&&A!==_&&e(N,{children:[" ","•"," ",e("span",{class:"ib",children:e(p,{id:"TbFrLc",values:{0:at(S)},components:{0:e("time",{datetime:S.toISOString()})}})})]})]}),e("div",{class:"announcement-reactions",hidden:!0,children:b.map(C=>{const{name:x,count:M,me:$,staticUrl:q,url:D}=C;return e("button",{type:"button",class:`plain4 small ${$?"reacted":""}`,children:[D||q?e("img",{src:D||q,alt:x,width:"16",height:"16"}):e("span",{children:x})," ",e("span",{class:"count",children:Ze(M)})]})})})]})}function Jd(n){const{masto:i}=ce();return i.v1.notifications.list({accountID:n})}function eu({request:n}){const{instance:i}=ce(),[s,o]=R("loading"),{account:a,lastStatus:c}=n,[h,d]=R(!1),[r,l]=R([]);function u(){d(!1)}return V(()=>{n?.account?.id&&h&&(o("loading"),(async()=>{const f=await Jd(n.account.id);l(f||[]),o("default")})())},[h,n?.account?.id]),e(N,{children:[e("button",{type:"button",class:"plain4 request-notifications-account",onClick:()=>{d(!0)},children:[e(I,{icon:"notification",class:"more-insignificant"})," ",e("small",{children:e(p,{id:"H0wUNM",values:{0:a.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(I,{icon:"chevron-down"})]}),h&&e(qe,{onClick:f=>{f.target===f.currentTarget&&u()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:u,children:e(I,{icon:"x",alt:t`Close`})}),e("header",{children:e("b",{children:e(p,{id:"MXOmPt",values:{0:a.username},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:s==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):r.map(f=>e("div",{class:"notification-peek",onClick:m=>{const{target:g}=m;(m.target.tagName==="BUTTON"||m.target.tagName==="A")&&u()},children:e(bn,{instance:i,notification:f,isStatic:!0})}))})]})})]})}function tu({request:n,onChange:i}){const{_:s}=re(),{masto:o}=ce(),[a,c]=R("default"),[h,d]=R(null),r=h!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:a==="loading"||r,onClick:()=>{c("loading"),(async()=>{try{await o.v1.notifications.requests.$select(n.id).accept(),d("accept"),c("default"),i({request:n,state:"accept"}),he(s({id:"ZtBMwU",values:{0:n.account.username}}))}catch{c("error"),he(s({id:"S92JKG"}))}})()},children:e(p,{id:"h7peZQ"})})," ",e("button",{type:"button",disabled:a==="loading"||r,class:"light danger",onClick:()=>{c("loading"),(async()=>{try{await o.v1.notifications.requests.$select(n.id).dismiss(),d("dismiss"),c("default"),i({request:n,state:"dismiss"}),he(s({id:"ibBDry",values:{0:n.account.username}}))}catch{c("error"),he(s({id:"S5aemF"}))}})()},children:e(p,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:a==="loading"?e(De,{abrupt:!0}):h==="accept"?e(I,{icon:"check-circle",alt:s({id:"bzMKg7"}),class:"notification-accepted"}):h==="dismiss"&&e(I,{icon:"x-circle",alt:s({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const ia=ct(Zd),nu=20;function Ai({local:n,columnMode:i,...s}){const{_:o}=re(),a=We(E),c=!!n,h=i?{}:Bt(),{masto:d,instance:r}=ce({instance:s?.instance||h.instance}),{masto:l,instance:u}=ce(),f=o(c?{id:"u96B/B",values:{instance:r}}:{id:"PgVqvd",values:{instance:r}});et(f,c?"/:instance?/p/l":"/:instance?/p");const m=U(),g=U();async function y(k){if(k||!g.current){const _={limit:nu,local:c||void 0};!c&&Qe("@pixelfed/global-feed")&&(_.remote=!0),g.current=d.v1.timelines.public.list(_).values()}const b=await g.current.next();let{value:v}=b;return v?.length&&(k&&(m.current=v[0].id),v.forEach(_=>{Je(_,r)})),{...b,value:v}}async function w(){try{const k=await d.v1.timelines.public.list({limit:1,local:c,since_id:m.current}).values().next();let{value:b}=k;const v=b[0]?.id===m.current;return b?.length&&!v?(b=Gt(b,"public"),!0):!1}catch{return!1}}return e(Mt,{title:f,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:o(c?{id:"pJQgQV"}:{id:"cg0I+x"})}),e("div",{children:r})]}),id:"public",instance:r,emptyText:o({id:"BiZJ6G"}),errorText:o({id:"scd9lw"}),fetchItems:y,checkForUpdates:w,useItemID:!0,headerStart:e(N,{}),boostsCarousel:a.settings.boostsCarousel,filterContext:"public",headerEnd:e(ft,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:o({id:"2FYpfJ"})})}),children:[e(ve,{href:c?`/#/${r}/p`:`/#/${r}/p/l`,children:c?e(N,{children:[e(I,{icon:"transfer"})," ",e("span",{children:e(p,{id:"dXMiUw"})})]}):e(N,{children:[e(I,{icon:"transfer"})," ",e("span",{children:e(p,{id:"t2B/we"})})]})}),e(je,{}),e(ve,{onClick:()=>{let k=prompt(o({id:"2MQ2cd"}));if(!/\./.test(k)){k&&alert(o({id:"7WddtO"}));return}k&&(k=k.toLowerCase().trim(),location.hash=c?`/${k}/p/l`:`/${k}/p`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(p,{id:"Sq04Yc"})})]}),u!==r&&e(ve,{onClick:()=>{location.hash=c?`/${u}/p/l`:`/${u}/p`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(p,{id:"iAzCp4",values:{currentInstance:u},components:{0:e("b",{})}})})]})]})},r+c)}function iu({onItemClick:n}){const{_:i}=re(),{instance:s}=ce(),[,o]=$t(r=>r+1,0),a=oi(),c=()=>{Bl(),he({text:i({id:"hgPsUe"}),delay:1e3}),o()},h=(r,l)=>{zl(r,l),o()},[d]=ti();return a.length===0?null:e("div",{class:"recent-searches",children:[e("div",{class:"recent-searches-header",children:[e(I,{icon:"history"})," ",e("span",{children:e(p,{id:"4R1B1H"})}),e("span",{class:"spacer"}),e("button",{type:"button",class:"plain4 small",onClick:c,disabled:a.length<=0,children:e("span",{children:e(p,{id:"yYxB17"})})})]}),e("ul",{class:"link-list recent-searches-list",ref:d,children:a.map(r=>{const{label:l,to:u,icon:f}=Kt(r.query,r.queryType,s);return e("li",{class:"recent-searches-item",children:[e(ge,{to:u,class:"recent-searches-link",onClick:m=>{Dn(r.query,r.queryType),n?.(m)},children:[e(I,{icon:f,class:"more-insignificant"}),e("span",{class:"recent-searches-label",children:l})]}),e("button",{type:"button",class:"plain4 small",onClick:()=>h(r.query,r.queryType),children:e(I,{icon:"trash",alt:i({id:"xCJdfg"})})})]},`${r.query}-${r.queryType}-${r.timestamp}`)})})]})}const xn=5,yi=40,su=new URLSearchParams,Tn={block:"nearest",inline:"center",behavior:"smooth"};function sa({columnMode:n,...i}){const{_:s}=re(),o=n?{}:Bt(),{masto:a,instance:c,authenticated:h}=ce({instance:o.instance}),[d,r]=R("default"),[l]=n?[su]:_t(),u=U(),f=i?.query||l.get("q"),m=n?"statuses":i?.type||l.get("type");let g=s({id:"A1taO8"});if(f)switch(m){case"statuses":g=s({id:"6YeoAt",values:{q:f}});break;case"accounts":g=s({id:"fpgumQ",values:{q:f}});break;case"hashtags":g=s({id:"AuiMZZ",values:{q:f}});break;default:g=s({id:"wr3GZI",values:{q:f}})}et(g,"/search");const[y,w]=R(!1),k=U(0);V(()=>{k.current=0},[f,m]);const b=U();St(()=>{b.current?.scrollTo?.(0,0)},[f,m]);const[v,_]=R([]),[S,A]=R([]),[C,x]=R([]);V(()=>{_([]),A([]),x([])},[f]);const M={statuses:v,accounts:S,hashtags:C},$={statuses:_,accounts:A,hashtags:x},[q,D]=R({}),F=async L=>{if(!L?.length)return;const Z=await Qn(L,q);Z&&D({...q,...Z})};function Q(L){L&&(k.current=0),!(!L&&!h)&&(r("loading"),L&&!m&&(_(v.slice(0,xn)),A(S.slice(0,xn)),x(C.slice(0,xn))),(async()=>{const Z={q:f,resolve:h,limit:xn};m&&(Z.limit=yi,Z.type=m,h&&(Z.offset=k.current));try{const H=await a.v2.search.list(Z);if(m)if(L){$[m](H[m]);const W=H[m]?.length;k.current=yi,w(!!W)}else if(H[m]?.[0]?.id===M[m]?.[0]?.id)w(!1);else{$[m](de=>[...de,...H[m]]);const W=H[m]?.length;k.current=k.current+yi,w(!!W)}else _(H.statuses||[]),A(H.accounts||[]),x(H.hashtags||[]),k.current=0,w(!1);F(H.accounts),r("default")}catch{r("error")}})())}const te=U();on(L=>{const Z=b.current?.scrollTop===0;if(L&&Z){const H=Date.now()-te.current;!te.current||H>1e3*3?Q(!0):te.current=Date.now()}}),V(()=>{let L;return u.current?.setValue?.(f||""),f?Q(!0):L=setTimeout(()=>{u.current?.focus?.()},150),()=>clearTimeout(L)},[f,m,c]),Fe(["Slash","/"],L=>{u.current?.focus?.(),u.current?.select?.()},{useKey:!0,preventDefault:!0,ignoreEventWhen:L=>L.metaKey||L.ctrlKey||L.altKey||L.shiftKey});const Y=".timeline > li > a, .hashtag-list > li > a",G=Fe("j",()=>{const L=document.activeElement.closest(Y),Z=L?.getBoundingClientRect(),H=Array.from(b.current.querySelectorAll(Y));if(L&&Z.top<b.current.clientHeight&&Z.bottom>0){const W=H.indexOf(L);let de=H[W+1];de&&(de.focus(),de.scrollIntoView(Tn))}else{const W=H.find(de=>{const se=de.getBoundingClientRect();return se.top>=44&&se.left>=0});W&&(W.focus(),W.scrollIntoView(Tn))}},{useKey:!0,ignoreEventWhen:L=>L.metaKey||L.ctrlKey||L.altKey||L.shiftKey}),K=Fe("k",()=>{const L=document.activeElement.closest(Y),Z=L?.getBoundingClientRect(),H=Array.from(b.current.querySelectorAll(Y));if(L&&Z.top<b.current.clientHeight&&Z.bottom>0){const W=H.indexOf(L);let de=H[W-1];de&&(de.focus(),de.scrollIntoView(Tn))}else{const W=H.find(de=>{const se=de.getBoundingClientRect();return se.top>=44&&se.left>=0});W&&(W.focus(),W.scrollIntoView(Tn))}},{useKey:!0,ignoreEventWhen:L=>L.metaKey||L.ctrlKey||L.altKey||L.shiftKey}),[j]=ti();return e("div",{id:"search-page",class:"deck-container",tabIndex:"-1",ref:L=>{b.current=L,G.current=L,K.current=L},children:e("div",{class:"timeline-deck deck",children:[e("header",{class:d==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(qt,{})}),e(Uo,{ref:u}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{Q(!0)},disabled:d==="loading",children:e(I,{icon:"search",size:"l",alt:s({id:"A1taO8"})})})})]})}),e("main",{children:[!!f&&!n&&e("div",{ref:j,class:`filter-bar ${d==="loading"?"loading":""}`,children:[!!m&&e(ge,{to:`/search${f?`?q=${encodeURIComponent(f)}`:""}`,children:[e(I,{icon:"chevron-left"})," ",e(p,{id:"N40H+G"})]}),[{label:s({id:"bPwFdf"}),type:"accounts",to:`/search?q=${encodeURIComponent(f)}&type=accounts`},{label:s({id:"VwUsHI"}),type:"hashtags",to:`/search?q=${encodeURIComponent(f)}&type=hashtags`},{label:s({id:"+owNNn"}),type:"statuses",to:`/search?q=${encodeURIComponent(f)}&type=statuses`}].sort((L,Z)=>L.type===m?-1:Z.type===m?1:0).map(L=>e(ge,{to:L.to,children:L.label},L.type))]}),f?e(N,{children:[(!m||m==="accounts")&&e(N,{children:[m!=="accounts"&&e("h2",{class:"timeline-header",children:[e(p,{id:"bPwFdf"})," ",e(ge,{to:`/search?q=${encodeURIComponent(f)}&type=accounts`,children:e(I,{icon:"arrow-right",size:"l",alt:s({id:"V1fa9u"})})})]}),S.length>0?e(N,{children:[e("ul",{class:"timeline flat accounts-list",children:S.map(L=>e("li",{children:e(yt,{account:L,instance:c,showStats:!0,relationship:q[L.id]})},L.id))}),m!=="accounts"&&e("div",{class:"ui-state",children:e(ge,{class:"plain button",to:`/search?q=${encodeURIComponent(f)}&type=accounts`,children:[e(p,{id:"BMmtZ8"})," ",e(I,{icon:"arrow-right"})]})})]}):!m&&(d==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):e("p",{class:"ui-state",children:e(p,{id:"YYB61U"})}))]}),(!m||m==="hashtags")&&e(N,{children:[m!=="hashtags"&&e("h2",{class:"timeline-header",children:[e(p,{id:"VwUsHI"})," ",e(ge,{to:`/search?q=${encodeURIComponent(f)}&type=hashtags`,children:e(I,{icon:"arrow-right",size:"l",alt:s({id:"V1fa9u"})})})]}),C.length>0?e(N,{children:[e("ul",{class:"link-list hashtag-list",children:C.map(L=>{const{name:Z,history:H}=L,W=H?.reduce?.((de,se)=>de+ +se.uses,0);return e("li",{children:e(ge,{to:c?`/${c}/t/${Z}`:`/t/${Z}`,children:[e(I,{icon:"hashtag",alt:"#"}),e("span",{children:Z}),!!W&&e("span",{class:"count",children:Ze(W)})]})},`${Z}-${W}`)})}),m!=="hashtags"&&e("div",{class:"ui-state",children:e(ge,{class:"plain button",to:`/search?q=${encodeURIComponent(f)}&type=hashtags`,children:[e(p,{id:"Nc/W5J"})," ",e(I,{icon:"arrow-right"})]})})]}):!m&&(d==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):e("p",{class:"ui-state",children:e(p,{id:"4MFM3P"})}))]}),(!m||m==="statuses")&&e(N,{children:[m!=="statuses"&&e("h2",{class:"timeline-header",children:[e(p,{id:"+owNNn"})," ",e(ge,{to:`/search?q=${encodeURIComponent(f)}&type=statuses`,children:e(I,{icon:"arrow-right",size:"l",alt:s({id:"V1fa9u"})})})]}),v.length>0?e(N,{children:[e("ul",{class:"timeline",children:v.map(L=>e("li",{children:e(ge,{class:"status-link",to:c?`/${c}/s/${L.id}`:`/s/${L.id}`,children:e(Ye,{status:L})})},L.id))}),m!=="statuses"&&e("div",{class:"ui-state",children:e(ge,{class:"plain button",to:`/search?q=${encodeURIComponent(f)}&type=statuses`,children:[e(p,{id:"LYCgej"})," ",e(I,{icon:"arrow-right"})]})})]}):!m&&(d==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):e("p",{class:"ui-state",children:e(p,{id:"Hzi9AA"})}))]}),!!m&&(d==="default"?y?e(Lt,{onChange:L=>{L&&Q()},children:e("button",{type:"button",class:"plain block",onClick:()=>Q(),style:{marginBlockEnd:"6em"},children:e(p,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(p,{id:"2EYeAZ"})}):d==="loading"&&e("p",{class:"ui-state",children:e(De,{abrupt:!0})}))]}):d==="loading"?e("p",{class:"ui-state",children:e(De,{abrupt:!0})}):e(N,{children:[e("p",{class:"ui-state insignificant",children:e(p,{id:"fGn1Hk"})}),e(iu,{})]})]})]})})}const ou=20,oa=600*1e3,au=Ct(n=>n.v1.trends.links.list().values().next(),{maxAge:oa}),cu=Ct(n=>n.v1.trends.tags.list().values().next(),{maxAge:oa});function ru(n){return Qe("@pixelfed/trending")?n.pixelfed.v2.discover.posts.trending.list({range:"daily"}).values():n.v1.trends.statuses.list({limit:ou}).values()}function lu(n,i){return n.v1.timelines.link.list(i).values()}function aa({columnMode:n,...i}){const{_:s}=re(),o=We(E),a=n?{}:Bt(),{masto:c,instance:h}=ce({instance:i?.instance||a.instance}),{masto:d,instance:r}=ce(),l=s({id:"cI3UEs",values:{instance:h}});et(l,"/:instance?/trending");const u=U(),f=h===r,[m,g]=R([]),[y,w]=R([]),k=U();async function b(te){if(te||!k.current){if(k.current=ru(c),Qe("@mastodon/trending-hashtags"))try{const{value:K}=await cu(c);K?.length&&g(K)}catch{}if(Qe("@mastodon/trending-links"))try{const{value:K}=await au(c,h),j=K?.filter?.(L=>L.type==="link");j?.length&&w(j)}catch{}}const Y=await k.current.next();let{value:G}=Y;return G?.length&&(te&&(u.current=G[0].id),G.forEach(K=>{Je(K,h)})),{...Y,value:G}}const[v,_]=R(!1),S=U(),[A,C]=R(null),x=!!A,M=U(),$=f&&Qe("@mastodon/trending-link-posts");V(()=>{A&&M.current&&M.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[A]);const q=U();async function D(te){(te||!S.current)&&(_(!0),S.current=lu(c,{url:A})),q.current=A;const Y=await S.current.next();let{value:G}=Y;return G?.length&&(G=Gt(G,"public"),G.forEach(K=>{Je(K,h)})),q.current===A&&_(!1),{...Y,value:G}}async function F(){try{const te=await c.v1.trends.statuses.list({limit:1}).values().next();let{value:Y}=te;return Y=Gt(Y,"public"),Y?.length&&Y[0].id!==u.current?(u.current=Y[0].id,!0):!1}catch{return!1}}const Q=_e(()=>e(N,{children:[!!m.length&&e("div",{class:"filter-bar expandable",children:[e(I,{icon:"chart",class:"insignificant",size:"l"}),m.map((te,Y)=>{const{name:G,history:K}=te,j=K.reduce((L,Z)=>L+ +Z.uses,0);return e(ge,{to:`/${h}/t/${G}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),G]}),e("span",{class:"filter-count",children:Ze(j)})]},G)})]}),!!y.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(p,{id:"9veeTb"})})}),y.map(te=>{const{authors:Y,authorName:G,authorUrl:K,blurhash:j,description:L,height:Z,image:H,imageDescription:W,language:de,providerName:se,providerUrl:X,publishedAt:we,title:ke,url:Se,width:Oe}=te,xe=Y?.[0]?.account?.id?Y[0].account:null,Le=ke.length<30,Re=!!(G||xe),ze=Ri(Se);let Ue;if(j){const Ke=zi(j),Ve=Xi(Ke);Ue=Zi([.6,Ve[1],Ve[2]])}return e("div",{children:[e("a",{ref:A===Se?M:null,href:Se,target:"_blank",rel:"noopener",class:`link-block ${x?A===Se?"active":"inactive":""}`,style:Ue?{"--accent-color":`rgb(${Ue.join(",")})`,"--accent-alpha-color":`rgba(${Ue.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:H,alt:W,width:Oe,height:Z,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:ze})," ",!!we&&e(N,{children:"· "}),!!we&&e(N,{children:e(xt,{datetime:we,format:"micro"})})]}),!!ke&&e("h1",{class:"title",lang:de,dir:"auto",title:ke,children:ke})]}),!!L&&e("p",{class:`description ${Re&&!Le?"":"more-lines"}`,lang:de,dir:"auto",title:L,children:L}),Re&&e(N,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(p,{id:"aavdrC",values:{0:xe?e(gt,{account:xe,showAvatar:!0}):K?e("a",{href:K,target:"_blank",rel:"noopener",children:G}):G}})})})]})]})]})}),$&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{C(Se)},disabled:Se===A,children:[e(I,{icon:"comment2"})," ",e("span",{children:e(p,{id:"/bZzdR"})})," ",e(I,{icon:"chevron-down"})]})]},Se)})]}),$&&!!y.length&&e("div",{class:`timeline-header-block ${x?"blended":""}`,children:x?e(N,{children:[e("div",{style:{width:50,flexShrink:0,textAlign:"center"},children:v?e(De,{abrupt:!0}):e("button",{type:"button",class:"light",onClick:()=>{C(null)},children:e(I,{icon:"x",alt:s({id:"9Q/4xJ"})})})}),e("p",{children:e(p,{id:"BATCqf",values:{0:A.replace(/^https?:\/\/(www\.)?/i,"").replace(/\/$/,"")},components:{0:e("span",{class:"link-text"})}})})]}):e("p",{class:"insignificant",children:e(p,{id:"Vosm4k"})})})]}),[m,y,A,v]);return e(Mt,{title:l,titleComponent:e("h1",{class:"header-double-lines",children:[e("b",{children:e(p,{id:"4/iCqx"})}),e("div",{children:h})]}),id:"trending",instance:h,emptyText:s({id:"6HA9+s"}),errorText:s({id:"scd9lw"}),fetchItems:x?D:b,checkForUpdates:x?void 0:F,checkForUpdatesInterval:300*1e3,useItemID:!0,headerStart:e(N,{}),boostsCarousel:o.settings.boostsCarousel,filterContext:"public",timelineStart:Q,refresh:A,clearWhenRefresh:!0,view:x?"link-mentions":void 0,headerEnd:e(ft,{portal:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:s({id:"2FYpfJ"})})}),children:[e(ve,{onClick:()=>{let te=prompt(s({id:"2MQ2cd"}));if(!/\./.test(te)){te&&alert(s({id:"7WddtO"}));return}te&&(te=te.toLowerCase().trim(),location.hash=`/${te}/trending`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(p,{id:"Sq04Yc"})})]}),r!==h&&e(ve,{onClick:()=>{location.hash=`/${r}/trending`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(p,{id:"iAzCp4",values:{currentInstance:r},components:{0:e("b",{})}})})]})]})},h)}const Us={block:"nearest",inline:"nearest",behavior:"smooth"};function du(){const{_:n}=re();et(n({id:"i0qMbr"}),"/");const i=We(E),{shortcuts:s}=i,o=s.map(a=>{if(!a)return null;const{type:c,...h}=a,d={following:es,notifications:ia,list:Go,public:Ai,bookmarks:Ko,favourites:jo,hashtag:Vo,mentions:Qo,trending:aa,search:sa}[c];return!d||c==="search"&&!h.query||c==="list"&&!h.id?null:e(d,{...h,columnMode:!0},c+JSON.stringify(h))});return Fe(["1","2","3","4","5","6","7","8","9"],a=>{try{const c=parseInt(a.key,10)-1,h=document.querySelectorAll("#columns > *")[c];h&&(h.focus(),h.scrollIntoView(Us))}catch{}},{useKey:!0,ignoreEventWhen:a=>a.metaKey||a.ctrlKey||a.altKey||a.shiftKey}),Fe(["[","]"],(a,c)=>{const h=c.keys[0],d=document.activeElement.closest("#columns > *"),r=jt(),l=r?"]":"[",u=r?"[":"]";let f;h===l?f=d?d.previousElementSibling:document.querySelectorAll("#columns > *")[0]:h===u&&(f=d?d.nextElementSibling:document.querySelectorAll("#columns > *")[1]),f&&(f.focus(),f.scrollIntoView(Us))},{useKey:!0,ignoreEventWhen:a=>a.metaKey||a.ctrlKey||a.altKey||a.shiftKey}),e("div",{id:"columns",onContextMenu:a=>{a.target.closest(".deck > header")&&!a.target.closest("a")&&!a.target.closest("button")&&(a.preventDefault(),E.showShortcutsSettings=!0)},onFocus:()=>{const a=document.activeElement.closest("#columns > *");a&&document.querySelectorAll("#columns > *").forEach(c=>{c.classList.toggle("focus",c===a)})},children:o})}function uu(){const{_:n}=re(),i=We(E);return __BENCHMARK.end("time-to-home"),V(()=>{(async()=>{const s=await wt.drafts.keys();if(s.length){const o=Fn();s.filter(c=>c.startsWith(o)).length&&(E.showDrafts=!0)}})()},[]),e(N,{children:(i.settings.shortcutsViewMode==="multi-column"||!i.settings.shortcutsViewMode&&i.settings.shortcutsColumnsMode)&&i.shortcuts?.length?e(du,{}):e(es,{title:n({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(hu,{})})})}function hu(){const{_:n}=re(),i=We(E),s=U(),[o,a]=R(void 0);return e(N,{children:[e(ge,{ref:s,to:"/notifications",class:`button plain notifications-button ${i.notificationsShowNew?"has-badge":""} ${o||""}`,onClick:c=>{c.stopPropagation(),window.matchMedia("(min-width: calc(40em))").matches&&(c.preventDefault(),a(h=>h?void 0:"open"))},children:e(I,{icon:"notification",size:"l",alt:n({id:"iDNBZe"})})}),e(pu,{state:o,anchorRef:s,onClose:()=>a(void 0)})]})}const fu=5;function pu({anchorRef:n,state:i,onClose:s}){const{masto:o,instance:a}=ce(),c=We(E),[h,d]=R("default"),r=ta();async function l(){const k=await r.next(),b=Xo(k.value);if(b?.length){b.forEach(_=>{Je(_.status,a,{skipThreading:!0})});const v=na(b);E.notificationsLast=v[0],E.notifications=v,o.v1.markers.create({notifications:{lastReadId:v[0].id}}).catch(()=>{})}return E.notificationsShowNew=!1,E.notificationsLastFetchTime=Date.now(),k}const[u,f]=R(!1);function m(){return o.v1.followRequests.list({limit:1})}function g({skipFollowRequests:k=!1}={}){d("loading"),(async()=>{try{if(await l(),!k){const b=await m();f(!!b?.length)}d("default")}catch{d("error")}})()}const y=U(),w=52;return V(()=>{i==="open"&&(c.notificationsShowNew?y.current?.scrollTop<=w&&g({skipFollowRequests:!0}):g())},[i,c.notificationsShowNew]),e(Oi,{ref:y,menuClassName:"notifications-menu",state:i,anchorRef:n,onClose:s,portal:{target:document.body},containerProps:{onClick:()=>{y.current?.closeMenu?.()}},overflow:"auto",viewScroll:"close",position:"anchor",align:"center",boundingBoxPadding:"8 8 8 8",children:[e("header",{children:e("h2",{children:e(p,{id:"iDNBZe"})})}),e(Jn.Provider,{value:"notifications",children:e("main",{children:c.notifications.length?e(N,{children:c.notifications.slice(0,fu).map(k=>e(bn,{instance:a,notification:k,disableContextMenu:!0},k._ids||k.id))}):h==="loading"?e("div",{class:"ui-state",children:e(De,{abrupt:!0})}):h==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(p,{id:"5GFQTh"})}),e("p",{children:e("button",{type:"button",onClick:g,children:e(p,{id:"KDw4GX"})})})]})})}),e("footer",{children:[e(ge,{to:"/mentions",class:"button plain",children:[e(I,{icon:"at"})," ",e("span",{children:e(p,{id:"/bZzdR"})})]}),e(ge,{to:"/notifications",class:"button plain2",children:[u?e(p,{id:"OdVhdR",components:{0:e("span",{class:"tag collapsed"}),1:e("span",{})}}):e("b",{children:e(p,{id:"gukqfD"})})," ",e(I,{icon:"arrow-right"})]})]})]})}const mu=ct(uu),gu=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function ca(n){const i=URL.parse(n);if(!i)return{};const{hostname:s,pathname:o}=i;for(const a of gu){const[,c]=o.match(a)||[];if(c)return{instance:s,id:c}}return{}}function yu(n){const{instance:i,id:s}=ca(n);return i&&s?`/${i}/s/${s}`:null}function vu(){const i=cn().pathname.replace(/^\//,""),s=ca(i),o=s?.instance?`/${s.instance}/s/${s.id}`:null,[a,c]=R("loading");return St(()=>{c("loading"),(async()=>{try{const{instance:h,id:d}=s;if(d){const{masto:r}=ce({instance:h});if(await r.v1.statuses.$select(d).fetch()){window.location.hash=o+"?view=full";return}}}catch{}{const{masto:h,instance:d}=ce(),r=await h.v2.search.list({q:i,limit:1,resolve:!0});if(r.statuses.length){const l=r.statuses[0];window.location.hash=`/${d}/s/${l.id}?view=full`}else if(r.accounts.length){const l=r.accounts[0];window.location.hash=`/${d}/a/${l.id}`}else o?window.location.hash=o+"?view=full":c("error")}})()},[o]),e("div",{class:"ui-state",tabIndex:"-1",children:[a==="loading"?e(N,{children:[e(De,{abrupt:!0}),e("h2",{children:e(p,{id:"RTAr/z"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}):e(N,{children:[e("h2",{children:e(p,{id:"ufzZSJ"})}),e("p",{children:e("a",{href:i,target:"_blank",rel:"noopener",children:i})})]}),e("hr",{}),e("p",{children:e(ge,{to:"/",children:e(p,{id:"iWpEwy"})})})]})}function bu(){const{_:n}=re();et(n({id:"h16FyT"}),"/l");const[i,s]=R("default"),[o,a]=$t(u=>u+1,0),[c,h]=R([]);V(()=>{s("loading"),(async()=>{try{const u=await ki();h(u),s("default")}catch{s("error")}})()},[o]);const[d,r]=R(!1),l=c.some(u=>u.exclusive);return e("div",{id:"lists-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(qt,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l"})})]}),e("h1",{children:e(p,{id:"h16FyT"})}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>r(!0),children:e(I,{icon:"plus",size:"l",alt:n({id:"Sb2gYF"})})})})]})}),e("main",{children:c.length>0?e(N,{children:[e("ul",{class:"link-list",children:c.map(u=>e("li",{children:e(ge,{to:`/l/${u.id}`,children:[e(I,{icon:"list"})," ",e("span",{children:[u.title,u.exclusive&&e(N,{children:[" ",e(Zt,{insignificant:!0})]})]})]})}))}),c.length>1&&e("footer",{class:"ui-state",children:[l&&e("p",{children:e("small",{class:"insignificant",children:[e(Zt,{})," ",e(p,{id:"FNptcJ"})]})}),e("p",{children:e("small",{class:"insignificant",children:e(p,{id:"8prZNK",values:{0:c.length}})})})]})]}):i==="loading"?e("p",{class:"ui-state",children:e(De,{})}):i==="error"?e("p",{class:"ui-state",children:e(p,{id:"v/l5uA"})}):e("p",{class:"ui-state",children:e(p,{id:"IvPikw"})})})]}),d&&e(qe,{onClick:u=>{u.target===u.currentTarget&&r(!1)},children:e(Wi,{list:d?.list,onClose:u=>{u.state==="success"&&a(),r(!1)}})})]})}const wu=""+new URL("instances-Dd-nff5Z.json",import.meta.url).href;function ku(n){const i=Math.min(500,Math.floor(window.screen.width*.9)),s=Math.min(600,Math.floor(window.screen.height*.8)),o=`popup,width=${i},height=${s}`;try{const a=window.open(n,"auth-popup",o);return!a||a.closed||typeof a.closed>"u"?null:a}catch{return null}}function Su(n){if(n&&!n.closed)try{n.close()}catch{}}function Cu(n,i,s){let o=!1;const a=d=>{d.origin===window.location.origin&&d.data&&d.data.type==="oauth-callback"&&(o=!0,h(),d.data.code?i(d.data.code):s(new Error("No authorization code received")))};window.addEventListener("message",a);const c=setInterval(()=>{(!n||n.closed)&&(clearInterval(c),o||(o=!0,h(),s(new Error("Popup was closed before authentication completed"))))},500),h=()=>{window.removeEventListener("message",a),clearInterval(c),Su(n)};return h}const _u={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:Iu}=_u;function Au(){const{_:n}=re();et(n({id:"sQia9P"}),"/login");const i=U(),s=Ie.local.get("instanceURL"),[o,a]=R("default"),[c]=_t(),h=c.get("instance"),d=c.get("submit"),[r,l]=R(h||s?.toLowerCase()||""),[u,f]=R([]),m=U();V(()=>{(async()=>{try{const S=await(await fetch(wu)).json();f(S),m.current=new Qa(S)}catch{}})()},[]);const g=_=>{_&&(async()=>{try{const A=await(await fetch(`https://${_}/.well-known/host-meta`)).text(),$=new DOMParser().parseFromString(A,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),q=URL.parse($),{host:D}=q;_!==D&&(_=D)}catch{}Ie.local.set("instanceURL",_),a("loading");try{let S=so(_);(!S||!S.client_id||!S.client_secret)&&(S=await Lc({instanceURL:_}),Ia(_,S));const{client_id:A,client_secret:C}=S,x=await Ic({instanceURL:_}),M=Aa(_);let $;if(x&&window.isSecureContext)if(A&&C){const[D,F]=await $c({instanceURL:_,client_id:A,forceLogin:M});Ie.sessionCookie.set("codeVerifier",F),$=D}else{alert(n({id:"ZP1FIA"})),a("default");return}else if(A&&C)$=await Mc({instanceURL:_,client_id:A,forceLogin:M});else{alert(n({id:"ZP1FIA"})),a("default");return}const q=ku($);q?Cu(q,D=>{const F=`${window.location.origin}${window.location.pathname}?code=${encodeURIComponent(D)}`;window.location.href=F},D=>{a("error")}):location.href=$,a("default")}catch{a("error")}})()},y=r?r.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,w=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(y)&&!/[\s\/\\@]/.test(y),k=y?m.current?.search(y,{limit:10})?.map(_=>_.item):[],b=w?y:k?.length?k[0]:r?u.find(_=>_.includes(r)):null,v=_=>{_.preventDefault(),g(b)};return d&&V(()=>{g(h||b)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:v,children:[e("h1",{children:[e("img",{src:Yi,alt:"",width:"80",height:"80"}),e("br",{}),e(p,{id:"sQia9P"})]}),e("label",{children:[e("p",{children:e(p,{id:"kyAi7k"})}),e("input",{value:r,required:!0,type:"text",class:"large",id:"instanceURL",ref:i,disabled:o==="loading",autocorrect:"off",autocapitalize:"off",autocomplete:"off",spellCheck:!1,placeholder:n({id:"u3gOdY"}),enterKeyHint:"go",onInput:_=>{l(_.target.value)},dir:"auto"}),k?.length>0?e("ul",{id:"instances-suggestions",children:k.map((_,S)=>e("li",{children:e("button",{type:"button",class:"plain5",onClick:()=>{g(_)},children:_})}))}):e("div",{id:"instances-eg",children:e(p,{id:"/OvbEC"})})]}),o==="error"&&e("p",{class:"error",children:e(p,{id:"rmBHZn"})}),e("div",{children:[e("button",{disabled:o==="loading"||!r||!b,children:n(b?{id:"2xahsi",values:{selectedInstanceText:b}}:{id:"xGVfLh"})})," "]}),e(De,{hidden:o!=="loading"}),e("hr",{}),!Iu&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(p,{id:"LcOiWS"})})}),e("p",{children:e(ge,{to:"/",children:e(p,{id:"iWpEwy"})})}),e(Vi,{})]})})}const xu=40;function Tu(){const{_:n}=re(),i=We(E);et(n({id:"+GkIdc"}),"/sp");const{masto:s}=ce(),[o,a]=R([]),[c,h]=R("default"),[d,r]=$t(f=>f+1,0),[l,u]=R(!1);return V(r,[i.reloadScheduledPosts]),V(()=>{h("loading"),(async()=>{try{const f=s.v1.scheduledStatuses.list({limit:xu}).values(),m=[];let g;do g=(await f.next()).value,g?.length&&m.push(...g);while(g?.length);a(m)}catch{h("error")}finally{h("default")}})()},[d]),e("div",{id:"scheduled-posts-page",class:"deck-container",tabIndex:"-1",children:e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(qt,{}),e(ge,{to:"/",class:"button plain",children:e(I,{icon:"home",size:"l",alt:n({id:"i0qMbr"})})})]}),e("h1",{children:e(p,{id:"+GkIdc"})}),e("div",{class:"header-side",children:e(ft,{portal:!0,setDownOverflow:!0,overflow:"auto",viewScroll:"close",position:"anchor",menuButton:e("button",{type:"button",class:"plain",children:e(I,{icon:"more",size:"l",alt:n({id:"2FYpfJ"})})}),children:e(ve,{onClick:()=>{r()},children:[e(I,{icon:"refresh",size:"l"}),e("span",{children:e(p,{id:"lCF0wC"})})]})})})]})}),e("main",{children:[o.length?e("ul",{class:"posts-list",children:o.map(f=>{const{id:m,params:g,scheduledAt:y,mediaAttachments:w}=f,{inReplyToId:k,language:b,poll:v,sensitive:_,spoilerText:S,text:A,visibility:C,quotedStatusId:x,quoteApprovalPolicy:M}=g,$={id:m,inReplyToId:k,language:b,mediaAttachments:w,poll:v?{...v,expiresAt:new Date(Date.now()+v.expiresIn*1e3),options:v.options.map(q=>({title:q,votesCount:0}))}:void 0,sensitive:_,spoilerText:S,text:A,visibility:C,content:`<p>${A}</p>`,quotedStatusId:x,quoteApprovalPolicy:M};return e("li",{children:e(Eu,{status:$,scheduledAt:y,onClick:()=>{u({post:$,scheduledAt:new Date(y)})}})},m)})}):e("p",{class:"ui-state",children:c==="loading"?e(De,{}):n({id:"mZYb1f"})}),l&&e(qe,{onClick:f=>{f.target===f.currentTarget&&u(!1)},children:e(Ru,{post:l.post,scheduledAt:l.scheduledAt,onClose:()=>u(!1)})})]})]})})}function Eu({status:n,scheduledAt:i,onClick:s}){const o=_e(()=>{const a=(Date.parse(i)-Date.now())/36e5;return a<24?"time":a<720?"day":"month"},[i]);return e("button",{type:"button",class:"textual block",onClick:s,children:[e("div",{class:`post-schedule-meta post-schedule-${o}`,children:[e(I,{icon:o,class:"insignificant"})," ",e("span",{children:e(p,{id:"aEp6lO",values:{0:at(i,{formatOpts:{weekday:"short",second:"numeric"}})},components:{0:e("b",{}),1:e(xt,{datetime:i}),2:e("small",{})}})})]}),e(Ye,{status:n,size:"s",previewMode:!0,readOnly:!0})]})}function Ru({post:n,scheduledAt:i,onClose:s}){const{masto:o,instance:a}=ce(),{_:c}=re(),[h,d]=R("default"),[r,l]=R(),u=r&&r.getTime()!==i.getTime(),f=Ja(),m=i&&i<=Date.now(),{inReplyToId:g}=n,[y,w]=R(null),{quotedStatusId:k}=n;return e("div",{id:"scheduled-post-sheet",class:"sheet",children:[e("button",{type:"button",class:"sheet-close",onClick:s,children:e(I,{icon:"x",size:"l",alt:c({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:[e(p,{id:"orjBLU",components:{0:e("b",{}),1:e(xt,{datetime:i})}}),e("br",{}),e("small",{children:at(i,{formatOpts:{weekday:"short",second:"numeric"}})})]})}),e("main",{tabIndex:"-1",children:[!!y&&e("div",{class:"status-reply",children:e(Ye,{status:y,size:"s",previewMode:!0,readOnly:!0})}),e(Ye,{status:n,size:"s",previewMode:!0,readOnly:!0,onMediaClick:(b,v,_,S)=>{b.preventDefault(),E.showMediaModal={mediaAttachments:n.mediaAttachments,mediaIndex:v}}}),e("form",{onSubmit:b=>{b.preventDefault(),d("loading"),(async()=>{try{await o.v1.scheduledStatuses.$select(n.id).update({scheduledAt:r.toISOString()}),he(c({id:"40naR1"})),s(),d("default"),E.reloadScheduledPosts++}catch{d("error"),he(c({id:"ZM3jAs"}))}})()},children:e("footer",{children:[e("div",{class:"row",children:e("span",{children:[e(ec,{scheduledAt:i,setScheduledAt:b=>{l(b)}})," ",e("small",{class:"ib",children:f})]})}),e("div",{class:"row",children:[e("button",{disabled:!u||h==="loading"||m,children:e(p,{id:"QqW27M"})}),e("span",{class:"grow"}),e(bt,{align:"end",menuItemClassName:"danger",confirmLabel:c({id:"09u3Kk"}),onClick:()=>{d("loading"),(async()=>{try{await ce().masto.v1.scheduledStatuses.$select(n.id).remove(),he(c({id:"/zL/Mq"})),s(),d("default"),E.reloadScheduledPosts++}catch{d("error"),he(c({id:"aOh6Md"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:h==="loading"||m,children:e(p,{id:"Jb6/SB"})})})]})]})})]})]})}function Lu(){const{_:n}=re(),{prevEditedAt:i,nextEditedAt:s,editedAtIndex:o,editHistoryMode:a,editHistoryRef:c,exitEditHistory:h}=mo();return a?e("div",{class:"edit-history-controls",children:[e(I,{icon:"edit"}),e("b",{class:"edit-history-heading",children:n({id:"HSA2au"})}),e("span",{class:"spacer"}),e("span",{class:"edit-history-pagination",children:[e("button",{type:"button",class:"plain4",onClick:()=>{i()},disabled:!a||o+1>=c.current.length,children:e(I,{icon:"chevron-left",alt:n({id:"DHhJ7s"})})})," ",c.current.length-o," /"," ",c.current.length," ",e("button",{type:"button",class:"plain4",onClick:()=>{s()},disabled:!a||o<=0,children:e(I,{icon:"chevron-right",alt:n({id:"hXzOVo"})})})]}),e("button",{type:"button",class:"plain3",onClick:()=>{h()},children:e(I,{icon:"exit",alt:n({id:"ydzS9x"})})})]}):null}const $u={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:Fs}=$u,En=40,Mu=10,Pu=5;let xi={},On={},zn={};function Bn(n){delete On[n],delete zn[n]}const un={block:"nearest",inline:"center",behavior:"smooth"},Ks=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",Hs=/\/s\//i;function Nu(n){const{id:i}=n,{masto:s,instance:o}=ce({instance:n.instance}),a=We(E),[c,h]=_t(),d=c.get("media"),r=c.get("media-only"),l=parseInt(d||r,10);let u=l>0;const f=c.get("mediaStatusID"),m=io(f,o);f&&!m&&(u=!1);const g=u&&!!r,y=ht(i,o),[w,k]=R(E.statuses[y]);V(()=>{E.statuses[y]&&k(E.statuses[y])},[y]);const b=_e(()=>{const{prevLocation:C}=E,x=(C?.pathname||"")+(C?.search||""),M=mn("/:instance/s/:id",x)||mn("/s/:id",x);return!x||M?"/":x},[]);V(()=>{!w&&u&&(async()=>{try{const C=await s.v1.statuses.$select(i).fetch();Je(C,o),k(C)}catch{alert("Unable to load post."),location.hash=b}})()},[u]);const v=f?a.statuses[ht(f,o)]?.mediaAttachments:w?.mediaAttachments,_=()=>window.matchMedia("(min-width: calc(40em + 350px))").matches?"large":"small",S=it(()=>{_()==="small"&&a.prevLocation?history.back():g?location.hash=b:(c.delete("media"),c.delete("mediaStatusID"),h(c))},[g,b,a.prevLocation]),A=it((C,x,M,$)=>{if(_()==="large"&&!g){S();return}if(u&&document.startViewTransition){const q=M[x],{id:D,blurhash:F,url:Q}=q,te=tc(D||F||Q),G=[...document.querySelectorAll(`.status .media [data-view-transition-name="${te}"]`)].filter?.(j=>{const L=j.getBoundingClientRect();return L.top<window.innerHeight&&L.bottom>0&&L.left<window.innerWidth&&L.right>0}),K=G.length===1?G[0]:G.find(j=>!!j.closest(".status-deck"));K?document.startViewTransition(()=>{K.style.viewTransitionName=te,$?.current&&$.current.querySelectorAll(".media img, .media video")?.forEach(L=>{L.style.viewTransitionName=""}),S()}).ready.finally(()=>{K.style.viewTransitionName="",K.dataset.viewTransitioned=te}):S()}else S()},[u,g]);return V(()=>{let C=setTimeout(()=>{const x=document.querySelector(".carousel");x&&x.focus()},100);return()=>clearTimeout(C)},[g]),V(()=>{const C=document.querySelectorAll(".deck-container");return C.forEach(x=>{x.setAttribute("inert","")}),()=>{C.forEach(x=>{x.removeAttribute("inert")})}},[]),e("div",{class:"deck-backdrop",children:[u?v?.length?e(Mo,{mediaAttachments:v,statusID:f||i,instance:o,lang:w?.language,index:l-1,onClose:A}):e("div",{class:"media-modal-container loading",children:e(De,{abrupt:!0})}):e(ge,{to:b}),!g&&e(nc,{statusID:i,children:e(Ou,{id:i,instance:n.instance,closeLink:b})})]})}function Du(n){const{linkable:i,to:s,onClick:o,...a}=n;return i?e(ge,{class:"status-link",to:s,onClick:o,...a}):e("div",{class:"status-focus",tabIndex:0,...a})}function js(n,i){return Date.parse(n.createdAt)-Date.parse(i.createdAt)}const Ys=1e3*60*60*24*30;function Ou({id:n,closeLink:i="/",instance:s}){const{_:o}=re(),[a,c]=_t(),h=a.get("media"),d=a.get("mediaStatusID"),r=parseInt(h,10)>0,l=U(!E.prevLocation&&(history.length===1||"navigation"in window&&navigation?.entries?.()?.length===1)),[u,f]=R(a.get("view")||l.current?"full":null),m=!!parseInt(a.get("translate")),{masto:g,instance:y}=ce({instance:s}),{masto:w,instance:k,authenticated:b}=ce(),v=y===k,_=We(E),[S,A]=R([]),[C,x]=R("default"),M=U(),$=ht(n,y),q=U(0),D=U();V(()=>{D.current?.focus()},[]),V(()=>{const P=go(()=>{if(!D.current)return;const{scrollTop:ue}=D.current;C!=="loading"&&(zn[n]=ue)},50);return D.current?.addEventListener("scroll",P,{passive:!0}),P(),()=>{P.cancel(),D.current?.removeEventListener("scroll",P)}},[n,C!=="loading"]);const{editHistoryMode:F,initEditHistory:Q,editedAtIndex:te,editHistoryRef:Y}=mo(),G=U(),K=U(),[j,L]=R(0),Z=U(null),H=()=>{if(!Z.current)return;let{ancestors:P,descendants:ue,heroStatus:T}=Z.current;if(F&&ue?.length){const ne=Y.current[te],ie=Date.parse(ne.createdAt),Ce=Y.current[te-1],Me=Ce?Date.parse(Ce.createdAt):null;ue=ue.filter(Ge=>{const rt=Date.parse(Ge.editedAt||Ge.createdAt);return rt>=ie&&(!Me||rt<=Me)})}P.sort(js),ue.sort(js),q.current=ue?.length||0;const B=new Set;P.forEach(ne=>{Je(ne,y,{skipThreading:!0}),ne.inReplyToId&&!P.find(ie=>ie.id===ne.inReplyToId)&&B.add(ne.inReplyToId)});const J=P.every(ne=>ne.account.id===T.account.id),oe=[];ue.forEach(ne=>{if(Je(ne,y,{}),ne.inReplyToId&&!ue.find(ie=>ie.id===ne.inReplyToId)&&ne.inReplyToId!==T.id&&B.add(ne.inReplyToId),ne.inReplyToAccountId===ne.account.id)oe.push(ne);else if(ne.inReplyToId===T.id)oe.push(ne);else if(!ne.inReplyToAccountId&&oe.find(ie=>ie.id===ne.inReplyToId&&ie.account.id===T.account.id)&&ne.account.id===T.account.id)oe.push(ne);else{const ie=ue.find(Ce=>Ce.id===ne.inReplyToId);ie&&(ie.__replies||(ie.__replies=[]),ie.__replies.push(ne))}}),oe.sort((ne,ie)=>{const Ce=T.account.id;return ne.account.id===Ce&&ie.account.id!==Ce?-1:ie.account.id===Ce&&ne.account.id!==Ce?1:0}),B.size;let z=1;function fe(ne,ie){const Ce=ie+1;return Ce>z&&(z=ie),ne?.map(Me=>({id:Me.id,account:Me.account,repliesCount:Me.repliesCount,content:Me.content,weight:pn(Me),level:Ce,replies:fe(Me.__replies,Ce)}))}const Ee=oe.map(ne=>({id:ne.id,account:ne.account,accountID:ne.account.id,descendant:!0,thread:ne.account.id===T.account.id,weight:pn(ne),level:1,replies:fe(ne.__replies,1),createdAt:ne.createdAt}));return{allStatuses:[...P.map(ne=>({id:ne.id,ancestor:!0,isThread:J,accountID:ne.account.id,account:ne.account,repliesCount:ne.repliesCount,weight:pn(ne),createdAt:ne.createdAt})),{id:n,accountID:T.account.id,weight:pn(T),createdAt:T.createdAt},...Ee],ancestorsIsThread:J,mappedNestedDescendants:Ee}},W=({reloadHero:P}={})=>{x("loading");let ue;const T=On[n];if(T){const B=T.filter(J=>E.statuses[$]);A(B)}else A([{id:n}]);return(async()=>{const B=()=>as(()=>g.v1.statuses.$select(n).fetch(),{retries:4}),J=as(()=>g.v1.statuses.$select(n).context.fetch(),{retries:8}),oe=!!_.statuses[$];let z=_.statuses[$];if(!(oe&&!P))try{z=await B(),Je(z,y),await new Promise(fe=>{setTimeout(fe,100)})}catch{x("error");return}try{const fe=await J,{ancestors:Ee}=fe;Z.current={...fe,heroStatus:z};const{allStatuses:ye,ancestorsIsThread:ne,mappedNestedDescendants:ie}=H(),Ce=Ee.length&&!ne?[]:ie.filter(rt=>rt.thread),Me=(ne?Ee.length:0)+Ce.length;Me>0&&Me<100&&L(Me+1),x("default"),G.current={offsetTop:M.current?.offsetTop,scrollTop:D.current?.scrollTop};const Ge=Ee.length||0;Ge>=xe&&Le(Ge+1),A(ye),On[n]=ye,xa(z,y)}catch{x("error")}})(),K.current=Date.now(),()=>{clearTimeout(ue)}};V(W,[n,g]),V(()=>{try{const{allStatuses:P}=H();A(P)}catch{}},[F,te]);const[de,se]=R(!1);V(()=>{let P=setInterval(()=>{const ue=Date.now();K.current&&ue-K.current>=6e4&&se(!0)},6e4);return()=>{clearInterval(P)}},[]),St(()=>{if(!S.length)return;const P=zn[n];if(P)D.current.scrollTop=P;else if(G.current){const ue={offsetTop:M.current?.offsetTop,scrollTop:D.current?.scrollTop},T=ue.offsetTop-G.current.offsetTop+ue.scrollTop;D.current.scrollTop=T}else S.length===1&&(D.current.scrollTop=0);G.current=null},[S]),V(()=>{_.reloadStatusPage<=0||(async()=>{try{const{instanceURL:P}=$i(),ue=`https://${P}/api/v1/statuses/${n}/context`;return await(await caches.open("api")).delete(ue,{ignoreVary:!0}),W({reloadHero:!0})}catch{}})()},[_.reloadStatusPage]),V(()=>()=>{zn={},E.reloadStatusPage=0,On={},xi={},Ti.clear()},[]);const X=_.statuses[$]||_.statuses[n],we=_e(()=>{if(!X)return"";const{account:P}=X,ue=document.createElement("div");return ue.innerHTML=P.displayName,ue.innerText.trim()},[X]),ke=_e(()=>{if(!X)return"";let P=Xn(X);return P.length>64&&(P=P.slice(0,64)+"…"),P},[X]);et(we&&ke?`${we}: "${ke}"`:o({id:"post.title"}),"/:instance?/s/:id");const Se=_e(()=>{if(!X)return;const{url:P}=X;if(P)return URL.parse(P)?.hostname},[X]),Oe=_e(()=>{if(Se)return Se===y},[Se,y]),[xe,Le]=R(En),Re=_e(()=>S.length-xe,[S.length,xe]),ze=S.some(P=>P.descendant),Ue=S.filter(P=>P.ancestor),[Ke,Ve]=R(!0),le=_e(()=>{if(!M.current||Ke)return null;const{top:P}=M.current.getBoundingClientRect();return P>0?"down":"up"},[Ke]);Fe("esc",()=>{location.hash=i},{enabled:!r,ignoreEventWhen:P=>!!document.querySelector("#modal-container > *")||P.metaKey||P.ctrlKey||P.altKey||P.shiftKey,useKey:!0}),Fe("backspace",()=>{location.hash=i},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),Fe("j",()=>{const P=document.activeElement.closest(".status-link, .status-focus"),ue=P?.getBoundingClientRect(),T=Array.from(D.current.querySelectorAll(Ks));if(P&&ue.top<D.current.clientHeight&&ue.bottom>0){const B=T.indexOf(P);let J=T[B+1];J&&(J.focus(),J.scrollIntoView(un))}else{const B=T.find(J=>{const oe=J.getBoundingClientRect();return oe.top>=44&&oe.left>=0});B&&(B.focus(),B.scrollIntoView(un))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),Fe("k",()=>{const P=document.activeElement.closest(".status-link, .status-focus"),ue=P?.getBoundingClientRect(),T=Array.from(D.current.querySelectorAll(Ks));if(P&&ue.top<D.current.clientHeight&&ue.bottom>0){const B=T.indexOf(P);let J=T[B-1];J&&(J.focus(),J.scrollIntoView(un))}else{const B=T.find(J=>{const oe=J.getBoundingClientRect();return oe.top>=44&&oe.left>=0});B&&(B.focus(),B.scrollIntoView(un))}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey}),Fe("x",()=>{const P=document.activeElement.closest(".status-link, .status-focus");if(P){const ue=P.nextElementSibling;ue&&ue.tagName.toLowerCase()==="details"&&(ue.open=!ue.open)}},{useKey:!0,ignoreEventWhen:P=>P.metaKey||P.ctrlKey||P.altKey||P.shiftKey});const[$e,Te]=R(!1),ae=U(r?"media+status":"status"),Ne=it((P,ue,T,B)=>{P.preventDefault(),P.stopPropagation(),c({media:ue+1,mediaStatusID:B.id})},[n]),ee=it((P,ue)=>{Bn(ue.id)},[]);V(()=>{let P;return d&&r&&(P=setTimeout(()=>{const ue=D.current?.querySelector(`.status-link[href*="/${d}"]`);ue&&ue.scrollIntoView(un)},400)),()=>{clearTimeout(P)}},[d,r]);const Ae=it((P,ue)=>{const{id:T,ancestor:B,isThread:J,descendant:oe,thread:z,replies:fe,repliesCount:Ee,weight:ye,level:ne}=P,ie=T===n;return e("li",{ref:ie?M:null,class:`${B?"ancestor":""} ${oe?"descendant":""} ${z?"thread":""} ${ie?"hero":""}`,children:[ie?e(N,{children:[e(Lt,{threshold:.1,onChange:Me=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Ve(Me)})})},class:"status-focus",tabIndex:0,children:e(Ye,{statusID:T,instance:y,withinContext:!0,size:"l",enableTranslate:!0,forceTranslate:m})}),C!=="loading"&&!b?e("div",{class:"post-status-banner",children:[e("p",{children:e(p,{id:"Vyeh4F"})}),e(ge,{to:Fs?`/login?instance=${Fs}&submit=1`:"/login",class:"button",children:e(p,{id:"sQia9P"})})]}):!v&&e("div",{class:"post-status-banner",children:[e("p",{children:e(p,{id:"j5roNG",values:{instance:y},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:C==="loading",onClick:()=>{x("loading"),(async()=>{try{const Me=await w.v2.search.list({q:X.url,type:"statuses",resolve:!0,limit:1});if(Me.statuses.length){const Ge=Me.statuses[0];location.hash=k?`/${k}/s/${Ge.id}`:`/s/${Ge.id}`}else throw new Error("No results")}catch(Me){x("default"),alert(o({id:"DnepCE",values:{e:Me}}))}})()},children:[e(I,{icon:"transfer"})," ",e(p,{id:"ejAVrO"})]})]})]}):e(Du,{linkable:J||B,to:y?`/${y}/s/${T}`:`/s/${T}`,onClick:()=>{Bn(T)},children:[ue===0&&B?e(Lt,{threshold:.5,onChange:Me=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Te(Me)})})},children:e(Ye,{statusID:T,instance:y,withinContext:!0,size:z||B?"m":"s",enableTranslate:!0,onMediaClick:Ne,onStatusLinkClick:ee})}):e(Ye,{statusID:T,instance:y,withinContext:!0,size:z||B?"m":"s",enableTranslate:!0,onMediaClick:Ne,onStatusLinkClick:ee,showActionsBar:!!oe}),B&&Ee>1&&e("div",{class:"replies-link",children:[e(I,{icon:"comment2",alt:o({id:"N8UzTV"})})," ",e("span",{title:Ee,children:Ze(Ee)})]})," "]}),oe&&fe?.length>0&&e(ra,{instance:y,replies:fe,hasParentThread:z,level:ne,accWeight:ye,openAll:q.current<Mu,parentLink:{to:y?`/${y}/s/${T}`:`/s/${T}`,onClick:()=>Bn(T)}}),C==="loading"&&ie&&!!X?.repliesCount&&!ze&&e("div",{class:"status-loading",children:e(De,{abrupt:X.repliesCount>=3})}),C==="error"&&ie&&!!X?.repliesCount&&!ze&&e("div",{class:"status-error",children:[e(p,{id:"HQJU6W"}),e("br",{}),e("button",{type:"button",class:"plain",onClick:()=>{E.reloadStatusPage++},children:e(p,{id:"KDw4GX"})})]})]},T)},[n,y,C,b,v,m,Ne,ee,ze]),O=_e(()=>{if("navigation"in window&&navigation?.entries){const P=navigation.entries()[navigation.currentEntry.index-1];if(P?.url)return Hs.test(P.url)}return Hs.test(E.prevLocation?.pathname)},[$]),be=_e(()=>{if(!Re)return[];const P=[];function ue(T){P.push(T.id),T.replies&&T.replies.forEach(ue)}return S.slice(xe).forEach(ue),P.map(T=>ht(T,y))},[Re,S,xe,y]);function Pe(P){if(P<12)return me._({id:"DqsEm+",values:{months:P}});{const ue=Math.floor(P/12);return me._({id:"24w+FD",values:{years:ue}})}}const Be=_e(()=>{const P=[],ue=S.slice(0,xe);for(let T=0;T<ue.length;T++){const B=ue[T];if(T>0){const J=ue[T-1],{createdAt:oe,descendant:z,thread:fe,id:Ee}=B;if(J?.createdAt&&oe){const ye=Date.parse(oe);if(isFinite(ye)&&ye>Ys){const ne=Date.parse(J.createdAt);if(ne&&isFinite(ne)){const{ancestor:ie,id:Ce}=J,Ge=~~((ye-ne)/Ys);Ge>0&&P.push(e("li",{style:{"--time-gap-range":Math.min(12,Ge)},class:`time-gap ${ie?"ancestor":""} ${z?"descendant":""} ${fe?"thread":""}`,children:Pe(Ge)},`time-gap-${Ee}-${Ce}`))}}}}P.push(Ae(B,T))}return P},[S,xe,Ae,F,te]);return V(()=>{let P=setTimeout(()=>{if(!M.current)return;const ue=M.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");ue&&ue.click()},1e3);return()=>clearTimeout(P)},[n]),e(ic.Provider,{value:j,children:e("div",{tabIndex:"-1",ref:D,class:`status-deck deck contained ${S.length>1?"padded-bottom":""} ${ae.current==="status"&&!l.current?"slide-in":""} ${u?`deck-view-${u}`:""} ${F?"edit-history-mode":""}`,style:F?{"--edit-history-percentage":`${te/(Y.current.length-1)}`}:void 0,onAnimationEnd:P=>{ae.current==="status"&&(ae.current=null)},children:[e("header",{class:`${C==="loading"?"loading":""}`,onDblClick:P=>{E.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[O&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(I,{icon:"chevron-left",size:"xl",alt:o({id:"iH8pgl"})})}),!Ke&&X&&C!=="loading"?e(N,{children:[e("span",{class:"hero-heading",children:[e(gt,{account:X.account,instance:y,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(xt,{datetime:X.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:P=>{P.preventDefault(),P.stopPropagation(),M.current.scrollIntoView({behavior:"smooth",block:"start"})},title:o({id:"NCy+Nw"}),children:e(I,{icon:le==="down"?"arrow-down":"arrow-up"})})]}):e(N,{children:[e(p,{id:"post.title"})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:P=>{P.preventDefault(),P.stopPropagation(),D.current.scrollTo({top:0,behavior:"smooth"})},hidden:!Ue.length||$e,title:o({id:"R8CUl0",values:{0:Ue.length}}),children:[e(I,{icon:"arrow-up"}),Ue.filter((P,ue,T)=>T.findIndex(B=>B.accountID===P.accountID)===ue).slice(0,3).map(P=>e(ut,{url:P.account.avatarStatic||P.account.avatar,alt:P.account.displayName,squircle:P.account?.bot},P.account.id)),Ue.length>3&&e(N,{children:[" ",e("span",{class:"insignificant",children:Ze(Ue.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:u==="full"?"":"none"},onClick:()=>{f(null),a.delete("media"),a.delete("media-only"),a.delete("view"),c(a)},title:o({id:"+/xYEI"}),children:e(I,{icon:"layout4",size:"l"})}),de&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{E.reloadStatusPage++,se(!1)},children:e(I,{icon:"refresh",size:"l",alt:o({id:"lCF0wC"})})}),e(ft,{align:"end",portal:{target:D.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(I,{icon:"more",alt:o({id:"2FYpfJ"}),size:"xl"})}),children:[e(ve,{disabled:C==="loading",onClick:()=>{E.reloadStatusPage++},children:[e(I,{icon:"refresh"}),e("span",{children:e(p,{id:"lCF0wC"})})]}),e(ve,{className:"menu-switch-view",onClick:()=>{f(u==="full"?null:"full"),a.delete("media"),a.delete("media-only"),u==="full"?a.delete("view"):a.set("view","full"),c(a)},children:[e(I,{icon:{"":"layout5",full:"layout4"}[u||""]}),e("span",{children:o(u==="full"?{id:"+/xYEI"}:{id:"2LiWsE"})})]}),e(ve,{onClick:()=>{Array.from(D.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(ue=>{ue.click()})},children:[e(I,{icon:"eye-open"})," ",e("span",{children:e(p,{id:"8r8KmB"})})]}),e(je,{}),e(Bi,{className:"plain",children:e(p,{id:"Rsjgm0"})}),e(ve,{disabled:!Se||Oe,onClick:()=>{const P=yu(X.url);P?location.hash=P:alert(o({id:"9J6biQ"}))},children:[e(I,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:o(Se?{id:"Kp9SAs",values:{0:Zn.toUnicode(Se)}}:{id:"lb07+k"})})]}),e(ve,{disabled:!v||C==="loading"||!X?.editedAt||!q.current,onClick:Q,children:[e(I,{icon:"edit"}),e("span",{children:o({id:"OqaQnE"})})]})]}),e(ge,{class:"button plain deck-close",to:i,children:e(I,{icon:"x",size:"xl",alt:o({id:"yz7wBu"})})})]})]})}),e(Lu,{}),S.length&&X?e("ul",{class:`timeline flat contextual grow ${C==="loading"?"loading":""}`,children:[Be,Re>0&&e("li",{class:"descendant descendant-more",children:e("button",{type:"button",class:"plain block show-more",disabled:C==="loading",onClick:()=>Le(P=>P+En),style:{marginBlockEnd:"6em"},"data-state-post-ids":be.join(" "),children:[e("div",{class:"ib avatars-bunch",children:S.slice(xe,xe+5).map(P=>e(ut,{url:P.account.avatarStatic},P.id))})," ",e("div",{class:"ib",children:[e(p,{id:"uXRAkV"})," ",e("span",{class:"tag",children:Re>En?`${En}+`:Re})]})]})})]}):e(N,{children:[C==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(Ye,{skeleton:!0,size:"l"})})}),C==="error"&&e("p",{class:"ui-state",children:[e(p,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{E.reloadStatusPage++},children:e(p,{id:"KDw4GX"})})]})]})]})})}function ra({replies:n,instance:i,hasParentThread:s,level:o,accWeight:a,openAll:c,parentLink:h}){const{_:d}=re(),[r,l]=_t(),u=x=>x.reduce((M,$)=>{const{repliesCount:q,replies:D}=$,F=D?.length||q;return M+F+u(D||[])},0),f=n.length+u(n),m=n.length===f,g=n.map(x=>x.account).filter((x,M,$)=>$.findIndex(q=>q.id===x.id)===M).slice(0,3),y=_e(()=>n?.reduce((x,M)=>x+M?.weight,a),[a,n?.length]);let w=!1;(c||y<=Pu||!s&&f===1&&pn(n[0])<2)&&(w=!0);const k=xi[n[0].id],b=it((x,M,$,q)=>{x.preventDefault(),x.stopPropagation(),l({media:M+1,mediaStatusID:q.id})},[]),v=U();St(()=>{function x(M){M.target.dataset.scrollLeft=M.target.scrollLeft}return v.current?.addEventListener("scroll",x,{passive:!0}),()=>{v.current?.removeEventListener("scroll",x)}},[]);const[_,S]=R(k||w);V(()=>{let x;return!k&&!w&&(x=setTimeout(()=>S(!0),100)),()=>clearTimeout(x)},[k,w]);const A=w?"div":"details",C=A==="details";return e(A,{ref:v,class:"replies",open:C?k||w:void 0,onToggle:C?x=>{const{open:M}=x.target;xi[n[0].id]=M}:void 0,style:{"--comments-level":o},"data-comments-level":o,"data-comments-level-overflow":o>4,children:[!w&&e("summary",{class:"replies-summary",hidden:w,children:[e("span",{class:"avatars",children:g.map(x=>e(ut,{url:x.avatarStatic,title:`${x.displayName} @${x.username}`,squircle:x?.bot},x.id))}),e("span",{class:"replies-counts",children:[e("b",{children:e(p,{id:"DOQUen",values:{0:n.length,1:Ze(n.length)},components:{0:e("span",{title:n.length})}})}),!m&&f>1&&e(N,{children:[" ","·"," ",e("span",{children:e(p,{id:"qSQQSe",values:{0:Ze(f),totalComments:f},components:{0:e("span",{title:f})}})})]})]}),e(I,{icon:"chevron-down",class:"replies-summary-chevron"}),!!h&&e(ge,{class:"replies-parent-link",to:h.to,onClick:h.onClick,title:d({id:"ZlV82A"}),children:"»"})]}),_&&e("ul",{children:n.map(x=>e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(Ye,{statusID:x.id,instance:i,withinContext:!0,size:"s",enableTranslate:!0,onMediaClick:b,showActionsBar:!0}),!x.replies?.length&&x.repliesCount>0&&e("div",{class:"replies-link",children:[e(I,{icon:"comment2",alt:d({id:"N8UzTV"})})," ",e("span",{title:x.repliesCount,children:Ze(x.repliesCount)})]})]}),x.replies?.length&&e(ra,{instance:i,replies:x.replies,level:x.level,accWeight:w?y:x.weight,openAll:c,parentLink:{to:i?`/${i}/s/${x.id}`:`/s/${x.id}`,onClick:()=>{Bn(x.id)}}})]},x.id))})]})}const zu=140,Bu=35,qu=70,Uu=140,Ti=new Map;function pn(n){const i=Ti.get(n.id);if(i)return i;const{spoilerText:s,content:o,mediaAttachments:a,poll:c,card:h}=n,d=po(s+o),r=a?.length?zu:0,l=(c?.options?.length||0)*Bu,u=h&&(a?.length||c?.options?.length)?0:qu,m=(d+r+l+u)/Uu;return Ti.set(n.id,m),m}const Fu=ct(Nu);function Ku(){const n=Bt(),{id:i,instance:s}=n;return e(Fu,{id:i,instance:s})}const Hu=""+new URL("boosts-carousel-BiOaNdMT.jpg",import.meta.url).href,ju=""+new URL("multi-column-ROck0NVt.jpg",import.meta.url).href,Yu=""+new URL("multi-hashtag-timeline-DH5INVHi.jpg",import.meta.url).href,Vu=""+new URL("nested-comments-thread-hv59kZLc.jpg",import.meta.url).href,Gu="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",Wu={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_LINGVA_INSTANCES:"lingva.phanpy.social lingva.lunar.icu lingva.garudalinux.org translate.plausibility.cloud",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PHANPY_WEBSITE:"https://phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:hn,PHANPY_WEBSITE:Vs,PHANPY_PRIVACY_POLICY_URL:Zu,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Gs}=Wu,Ws=Vs?Vs.replace(/https?:\/\//g,"").replace(/\/$/,""):null,Zs=`${"2025-11-26T11:54:40.000Z".slice(0,10).replace(/-/g,".")}.ac85274`;function la(){const{_:n}=re();return et(null,["/","/welcome"]),e("main",{id:"welcome",children:[e("div",{class:"hero-container",children:[e("div",{class:"hero-content",children:[e("h1",{children:[e("img",{src:Yi,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:Gu,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(p,{id:"Ogtv0V"})}),e("p",{children:e(ge,{to:hn?`/login?instance=${hn}&submit=1`:"/login",class:"button",children:n(hn?{id:"sQia9P"}:{id:"ZLoGls"})})}),hn&&Gs&&e("p",{children:e("a",{href:Gs,class:"button plain5",children:e(p,{id:"e+RpCP"})})}),!hn&&e("p",{class:"insignificant",children:e("small",{children:e(p,{id:"fvAsUK",components:{0:e("br",{})}})})})]}),(Ws||Zs)&&e("p",{class:"app-site-version",children:e("small",{children:[Ws," ",Zs]})}),e("p",{children:e(p,{id:"BskFI2",components:{0:e("a",{href:"https://github.com/cheeaun/phanpy",target:"_blank"}),1:e("a",{href:"https://mastodon.social/@cheeaun",target:"_blank",onClick:i=>{i.preventDefault(),E.showAccount="cheeaun@mastodon.social"}}),2:e("a",{href:Zu,target:"_blank"})}})}),e("div",{children:e(Vi,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:Hu,alt:n({id:"S5cYrQ"}),loading:"lazy"}),e("h4",{children:e(p,{id:"Tu+sCN"})}),e("p",{children:e(p,{id:"e2uVlo"})})]}),e("section",{children:[e("img",{src:Ho,alt:n({id:"LUnwPh"}),loading:"lazy"}),e("h4",{children:e(p,{id:"xrl8fj"})}),e("p",{children:e(p,{id:"1lGm1k"})})]}),e("section",{children:[e("img",{src:Vu,alt:n({id:"CGQ27z"}),loading:"lazy"}),e("h4",{children:e(p,{id:"cYE45+"})}),e("p",{children:e(p,{id:"Pc7QKh"})})]}),e("section",{children:[e("img",{src:ju,alt:n({id:"VLKtvP"}),loading:"lazy"}),e("h4",{children:e(p,{id:"pEkad9"})}),e("p",{children:e(p,{id:"t7Py5R"})})]}),e("section",{children:[e("img",{src:Yu,alt:n({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(p,{id:"Wi1Ov0"})}),e("p",{children:e(p,{id:"tS2i+h"})})]})]})})]})}const Xu=window.alert;window.__nativeAlert||(window.__nativeAlert=Xu);window.alert=function(n){n instanceof Error&&n?.message&&(n=n.message),typeof n!="string"&&(n=JSON.stringify(n));const i=sc({text:n,className:"alert",gravity:"top",position:"center",duration:1e4,offset:{y:48},onClick:()=>{i.hideToast()}});i.showToast()};window.__STATES__=E;window.__STATES_STATS__=()=>{const n=["statuses","accounts","spoilers","unfurledLinks","statusQuotes"],i={};n.forEach(a=>{i[a]=Object.keys(E[a]).length});const{statuses:s}=E,o=[];for(const a in s)document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`)||o.push(a)};setInterval(()=>{if(!window.__IDLE__)return;const{statuses:n,unfurledLinks:i,notifications:s}=E;let o=0;const{instance:a}=ce();for(const c in n){if(!window.__IDLE__)break;try{const h=document.querySelector(`[data-state-post-id~="${c}"], [data-state-post-ids~="${c}"]`),d=s.some(r=>c===ht(r.status?.id,a));if(!h&&!d){delete E.statuses[c],delete E.statusQuotes[c];for(const r in i){const l=i[r];if(ht(l.id,l.instance)===c){delete E.unfurledLinks[r];break}}o++}}catch{}}},900*1e3);setTimeout(()=>{for(const n in Qt)setTimeout(()=>{Array.isArray(Qt[n])?Qt[n][0]?.():typeof Qt[n]=="object"?Qt[n].module?.():Qt[n]?.()},1)},5e3);(()=>{window.__IDLE__=!0;const n=["mousemove","mousedown","resize","keydown","touchstart","pointerdown","pointermove","wheel"],i=()=>{window.__IDLE__=!0},o=go(i,3e3),a=()=>{window.__IDLE__=!1,o()};n.forEach(c=>{window.addEventListener(c,a,{passive:!0,capture:!0})}),window.addEventListener("blur",i,{passive:!0}),document.documentElement.addEventListener("mouseleave",c=>{!c.relatedTarget&&!c.toElement&&i()},{passive:!0})})();const Qu=/iPad|iPhone|iPod/.test(navigator.userAgent);Qu&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(document.getElementsByClassName("media-modal-container").length>0)return;const i=Ie.local.get("theme");let s;if(i){if(s=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),s){const o=s.content,a=i==="light"?s.dataset.themeLightColorTemp:s.dataset.themeDarkColorTemp;s.content=a||"",setTimeout(()=>{s.content=o},10)}}else{const o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(s=document.querySelector(`meta[name="theme-color"][media*="${o}"]`),s){const a=s.dataset.content,c=s.dataset.contentTemp;s.content=c||"",setTimeout(()=>{s.content=a},10)}}}});{const n=Ie.local.get("theme");if(n){document.documentElement.classList.add(`is-${n}`),document.querySelector('meta[name="color-scheme"]').setAttribute("content",n||"light dark");const s=document.querySelector('meta[data-theme-setting="manual"]');s&&(s.name="theme-color",s.content=n==="light"?s.dataset.themeLightColor:s.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(a=>{a.name=""})}const i=Ie.local.get("textSize");i&&document.documentElement.style.setProperty("--text-size",`${i}px`)}to(E,n=>{for(const[i,s,o,a]of n){if(s.join(".")==="settings.shortcutsViewMode"){const c=document.getElementById("app");c&&(c.dataset.shortcutsViewMode=E.shortcuts?.length?o:"")}s.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});const Rn=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(n){},end(n){}};document.body.classList.toggle("exp-tab-bar-v2",Ie.local.get("experiments-tabBarV2")??!1);const Xs=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0,Ju=7200*1e3;function eh(){const[n,i]=R(!1),[s,o]=R("loading");__BENCHMARK.start("app-init"),__BENCHMARK.start("time-to-following"),__BENCHMARK.start("time-to-home"),__BENCHMARK.start("time-to-isLoggedIn"),re(),V(()=>{const d=Ie.local.get("instanceURL"),r=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,""])[1]);if(r){if(window.opener&&!window.opener.closed){try{window.opener.postMessage({type:"oauth-callback",code:r},window.location.origin),setTimeout(()=>{window.close()},100)}catch{window.close()}return}window.history.replaceState({},document.title,window.location.pathname||"/");const{client_id:u,client_secret:f,vapid_key:m}=so(d)||{},g=Un(d)||m,y=Ie.sessionCookie.get("codeVerifier");(async()=>{o("loading");const{access_token:w}=await Pc({instanceURL:d,client_id:u,client_secret:f,code:r,code_verifier:y||void 0});if(w){const k=Ta({instance:d,accessToken:w});await Promise.allSettled([ci(k),ri(k,d),Ea(k,d,w,g)]),is(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,i(!0),o("default")}else o("error");__BENCHMARK.end("app-init")})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;const l=decodeURIComponent((window.location.search.match(/account=([^&]+)/)||[,""])[1]);let u;if(l&&(u=Ra(l),u&&(qn(u.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),u||(u=$i()),u){qn(u.info.id);const{client:f}=ce({account:u}),{instance:m}=f;is(),o("loading"),(async()=>{try{La()&&$a(m)?(ci(f),ri(f,m)):await Promise.allSettled([ci(f),ri(f,m)])}catch{}finally{i(!0),o("default"),__BENCHMARK.end("app-init")}})()}else o("default"),__BENCHMARK.end("app-init")}Ie.sessionCookie.del("clientID"),Ie.sessionCookie.del("clientSecret"),Ie.sessionCookie.del("codeVerifier")},[]);let a=cn();E.currentLocation=a.pathname,V(wi,[a,n]);const c=U(!1),h="pwaLastPath";return V(()=>{c.current&&Xs&&n&&(da(a.pathname)?Ie.local.del(h):Ie.local.setJSON(h,{path:a.pathname+a.search,lastAccessed:Date.now()}))},[a.pathname,a.search,n]),V(()=>{if(!(c.current||!(!a.pathname||a.pathname==="/"))&&Xs&&n&&s==="default"){const r=Ie.local.getJSON(h);r&&setTimeout(()=>{r?.path&&Date.now()-(r.lastAccessed||0)<Ju&&(window.location.hash=r.path),Ie.local.del(h)},300),c.current=!0}},[s,n]),/\/https?:/.test(a.pathname)?e(vu,{}):s==="loading"?e(De,{id:"loader-root"}):e(N,{children:[e(nh,{isLoggedIn:n}),e(ih,{isLoggedIn:n}),e(Ni,{children:e(Xe,{path:"/:instance?/s/:id",element:e(Ku,{})})}),n&&e(lc,{}),n&&e(Fl,{}),e(Ll,{}),n&&e(Dl,{}),e(cc,{isLoggedIn:n}),n&&e($l,{}),e(ql,{onClose:wi}),e(dc,{})]})}function th({isLoggedIn:n}){return n&&__BENCHMARK.end("time-to-isLoggedIn"),n?e(mu,{}):e(la,{})}function da(n){return/^\/(login|welcome|_sandbox|_qr-scan)/i.test(n)}const nh=ct(({isLoggedIn:n})=>{const i=cn(),s=_e(()=>{const{pathname:o}=i;return!da(o)},[i]);return e(Ni,{location:s||i,children:[e(Xe,{path:"/",element:e(th,{isLoggedIn:n})}),e(Xe,{path:"/login",element:e(Au,{})}),e(Xe,{path:"/welcome",element:e(la,{})}),void 0]})});function Qs(){return E.prevLocation||null}function ih({isLoggedIn:n}){const i=cn(),s=U(Qs());return _e(()=>mn("/:instance/s/:id",i.pathname)||mn("/s/:id",i.pathname),[i.pathname,mn])?s.current||(s.current=Qs()):s.current=null,e(Ni,{location:s.current||i,children:[n&&e(N,{children:[e(Xe,{path:"/notifications",element:e(ia,{})}),e(Xe,{path:"/mentions",element:e(Qo,{})}),e(Xe,{path:"/following",element:e(es,{})}),e(Xe,{path:"/b",element:e(Ko,{})}),e(Xe,{path:"/f",element:e(jo,{})}),e(Xe,{path:"/l",children:[e(Xe,{index:!0,element:e(bu,{})}),e(Xe,{path:":id",element:e(Go,{})})]}),e(Xe,{path:"/fh",element:e($d,{})}),e(Xe,{path:"/sp",element:e(Tu,{})}),e(Xe,{path:"/ft",element:e(Td,{})}),e(Xe,{path:"/catchup",element:e(gd,{})}),e(Xe,{path:"/annual_report/:year",element:e(ld,{})})]}),e(Xe,{path:"/:instance?/t/:hashtag",element:e(Vo,{})}),e(Xe,{path:"/:instance?/a/:id",element:e(od,{})}),e(Xe,{path:"/:instance?/p",children:[e(Xe,{index:!0,element:e(Ai,{})}),e(Xe,{path:"l",element:e(Ai,{local:!0})})]}),e(Xe,{path:"/:instance?/trending",element:e(aa,{})}),e(Xe,{path:"/:instance?/search",element:e(sa,{})})]})}Ma();Pa();Na(e(Da,{i18n:me,children:e(Oa,{children:e(za,{children:e(eh,{})})})}),document.getElementById("app"));setTimeout(()=>{try{localStorage.removeItem("settings-groupedNotificationsAlpha")}catch{}},5e3);if("serviceWorker"in navigator&&typeof caches<"u"){const i=["icons"];let s=!1;const o=1e4,a=3600*1e3;async function c(){if(window.__IDLE__)try{const h=await caches.keys();for(const d of h){if(i.includes(d))continue;const r=await caches.open(d),l=await r.keys();if(l.length>50){const u=l.slice(50);for(const f of u)await r.delete(f)}}s=!0}catch{}setTimeout(c,s?a:o)}setTimeout(c,o)}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")};export{mt as B,bh as u};
//# sourceMappingURL=main-COIelIo0.js.map