31 lines
350 KiB
JavaScript
31 lines
350 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dom-BT9_JKk_.js","./pwa-viewport-CJ-1bFP1.js","./ScheduledAtField-C2dSuh6f.js","./ICONS-DaAGffIM.js","./year-in-posts-w9jDim8R.js"])))=>i.map(i=>d[i]);
|
||
import{A as B,y as V,M as rt,u as ie,d as R,s as E,a as se,b as Je,p as St,c as Ge,q as st,g as wt,e,k as N,T as p,f as nn,h as $t,i as Ht,j as Un,l as Ce,m as Se,L as yc,C as li,n as vc,o as bc,r as Bn,t as $i,v as as,w as an,x as ei,z as Oe,B as wc,E as kc,F as Mi,G as pe,H as Kn,I as Hn,_ as kt,J as Pi,K as no,N as kh,O as io,P as Di,Q as Sc,R as Cc,S as ht,U as _c,V as Ni,W as Ic,X as Ct,Y as Ac,Z as xc,$ as Oi,a0 as zi,a1 as qt,a2 as et,a3 as so,a4 as oo,a5 as Tc,a6 as co,a7 as Ec,a8 as Rc,a9 as mn,aa as Lc,ab as $c,ac as Mc,ad as di,ae as ui,af as Pc,ag as rs,ah as Dc,ai as Nc,aj as Oc,ak as qi,al as Ze,am as zc,an as qc,ao as Fc,ap as Uc,aq as Bc,ar as Kc,as as Hc}from"./pwa-viewport-CJ-1bFP1.js";import{u as Fi,f as Ke,s as de,o as ls,a as jc,V as ao,b as ro,I,C as Ui,M as Ye,c as Ve,S as kn,d as ye,e as ti,R as xt,n as at,g as lo,h as Fe,A as ut,N as mt,i as ft,j as vt,L as ve,l as Ot,k as Yc,m as uo,p as Vt,q as Ch,r as Qe,t as ni,v as gt,w as ds,T as ho,x as ct,y as ki,z as fo,E as po,B as Xe,D as bt,F as je,G as Lt,H as Vc,J as Gc,K as jt,O as Bi,P as mo,Q as Wc,U as sn,W as Zc,X as Xc,Y as ii,Z as Qc,_ as Gt,$ as Jc,a0 as ea,a1 as go,a2 as ta,a3 as Ki,a4 as na,a5 as ia,a6 as sa,a7 as oa,a8 as ca,a9 as yo,aa,ab as ra,ac as us,ad as la,ae as da}from"./ScheduledAtField-C2dSuh6f.js";import{ICONS as Qt}from"./ICONS-DaAGffIM.js";var vo=ua;function ua(n,i,s){var o=null,c=null,a=function(){o&&(clearTimeout(o),c=null,o=null)},u=function(){var r=c;a(),r&&r()},d=function(){if(!i)return n.apply(this,arguments);var r=this,l=arguments,h=s&&!o;if(a(),c=function(){n.apply(r,l)},o=setTimeout(function(){if(o=null,!h){var f=c;return c=null,f()}},i),h)return c()};return d.cancel=a,d.flush=u,d}(function(n,i){"use strict";typeof n.CustomEvent!="function"&&(n.CustomEvent=function(y,g){g=g||{bubbles:!1,cancelable:!1,detail:void 0};var w=i.createEvent("CustomEvent");return w.initCustomEvent(y,g.bubbles,g.cancelable,g.detail),w},n.CustomEvent.prototype=n.Event.prototype),i.addEventListener("touchstart",h,!1),i.addEventListener("touchmove",f,!1),i.addEventListener("touchend",l,!1);var s=null,o=null,c=null,a=null,u=null,d=null,r=0;function l(y){if(d===y.target){var g=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()-u,v="",_=y.changedTouches||y.touches||[];if(w==="vh"&&(g=Math.round(g/100*i.documentElement.clientHeight)),w==="vw"&&(g=Math.round(g/100*i.documentElement.clientWidth)),Math.abs(c)>Math.abs(a)?Math.abs(c)>g&&b<k&&(c>0?v="swiped-left":v="swiped-right"):Math.abs(a)>g&&b<k&&(a>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,u=null}}function h(y){y.target.getAttribute("data-swipe-ignore")!=="true"&&(d=y.target,u=Date.now(),s=y.touches[0].clientX,o=y.touches[0].clientY,c=0,a=0,r=y.touches.length)}function f(y){if(!(!s||!o)){var g=y.touches[0].clientX,w=y.touches[0].clientY;c=s-g,a=o-w}}function m(y,g,w){for(;y&&y!==i.documentElement;){var k=y.getAttribute(g);if(k)return k;y=y.parentNode}return w}})(window,document);function on(n=()=>{},i=[]){const s=B(n);V(()=>{s.current=n},[i]),V(()=>{const o=()=>{const c=document.hidden||document.visibilityState==="hidden";s.current(!c)};return document.addEventListener("visibilitychange",o),()=>document.removeEventListener("visibilitychange",o)},[])}const ha=1e3*3,hs=2e4,fa=rt(function({isLoggedIn:i}){const{_:s}=ie(),[o,c]=R(!0),a=B();on(l=>{clearTimeout(a.current),l?c(!0):a.current=setTimeout(()=>{c(!1)},hs)});const u=async(l,h,f)=>{if(E.notificationsLast){const m=l.v1.notifications.list({limit:1,sinceId:E.notificationsLast.id}).values(),{value:y}=await m.next();if(y?.length)if(f)E.notificationsShowNew=!0;else{let g;try{g=(await l.v1.markers.fetch({timeline:"notifications"}))?.notifications?.lastReadId}catch{}g?E.notificationsShowNew=y[0].id!==g:E.notificationsShowNew=!0}}};V(()=>{let l,h,f;if(i&&o){const{masto:m,streaming:y,instance:g}=se();(async()=>{await u(m,g);let w=!1;y&&(h=setTimeout(()=>{(async()=>{try{w=!0,l=y.user.notification.subscribe();for await(const k of l){if(!l||!o)break;k.event==="notification"&&Je(k.payload,g,{skipThreading:!0}),E.notificationsShowNew=!0}}catch{w=!1}w||(f=setInterval(()=>{u(m,g,!0)},hs))})()},ha))})()}return()=>{l?.unsubscribe?.(),l=null,clearTimeout(h),clearInterval(f)}},[o,i]);const d=B(),r=()=>{d.current=Date.now(),fetch("./version.json").then(l=>l.json()).then(l=>{l&&(E.appVersion=l)}).catch(l=>{})};return Fi(r,o&&1e3*60*30),on(l=>{l&&(d.current?Date.now()-d.current>1e3*60*60&&r():r())}),Ke("shift+alt+k",l=>{if(!l.shiftKey||!l.altKey)return;const h=E.settings.cloakMode;E.settings.cloakMode=!h,de({text:s(h?{id:"oguMwa"}:{id:"IXZLPs"})})},{useKey:!0,ignoreEventWhen:l=>l.metaKey||l.ctrlKey}),null}),pa=St(async(n,i)=>{const s=n.v1.accounts.$select(i).statuses.list({limit:3,exclude_replies:!0,exclude_reblogs:!0}).values(),{value:o}=await s.next();return o||[]},{expires:6e4});function ma(){const{_:n}=ie(),i=Ge(E),{masto:s}=se(),[o,c]=R(!1),[a,u]=R([]),[d,r]=R(!1),l=B(null),h=B(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,ls();return}const b=document.querySelectorAll("data.compose-data"),v=!f&&b.length===1?JSON.parse(b[0].value):void 0;k.shiftKey?jc(v)||(E.showCompose=v||!0):(ls(),E.showCompose=v||!0)}Ke("c, shift+c",m,{useKey:!0,ignoreEventWhen:k=>!!document.querySelector("#modal-container > *")||k.metaKey||k.ctrlKey||k.altKey});const y=ao(()=>{c(!0)},{threshold:600}),g=st(async()=>{try{r(!0);const k=wt();if(!k)return;const b=await pa(s,k);u(b)}catch{}finally{r(!1)}},[s]),w=st(k=>{ro({replyToStatus:k}),c(!1)},[]);return V(()=>{o&&g()},[g,o]),e(N,{children:[e("button",{ref:l,type:"button",id:"compose-button",onClick:m,onContextMenu:k=>{k.preventDefault(),c(!0)},...y(),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(Ui,{ref:h,state:o?"open":void 0,anchorRef:l,onClose:()=>c(!1),direction:"top",gap:8,unmountOnClose:!0,portal:{target:document.body},boundingBoxPadding:lo(),containerProps:{style:{zIndex:19},onClick:()=>{h.current?.closeMenu?.()}},submenuOpenDelay:600,children:[e(Ye,{to:"/sp",children:[e(I,{icon:"schedule"})," ",e("span",{children:e(p,{id:"+GkIdc"})})]}),e(Ve,{}),e(kn,{align:"end",direction:"top",shift:-8,disabled:d||a.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:a.length>0&&a.map(k=>{const b=new Date(k.createdAt),v=Date.now()-b.getTime()<864e5;return e(ye,{onClick:()=>w(k),children:e("small",{children:[e("div",{class:"menu-post-text",children:ti(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 fs({key1:n,key2:i}){return e(p,{id:"Qh+0sm",values:{key1:n,key2:i},components:{0:e("kbd",{}),1:e("kbd",{})}})}const ga=rt(function(){const{_:i}=ie(),s=Ge(E);function o(){E.showKeyboardShortcutsHelp=!1}return Ke("?",()=>{E.showKeyboardShortcutsHelp=!0},{useKey:!0,ignoreEventWhen:c=>/\/catchup/i.test(location.hash)||c.metaKey||c.ctrlKey||c.altKey}),!!s.showKeyboardShortcutsHelp&&e(Fe,{onClose:o,children:e("div",{id:"keyboard-shortcuts-help-container",class:"sheet",tabindex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:o,children:e(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(fs,{key1:"g",key2:"h"})},{action:i({id:"0YgcH9"}),keys:e(fs,{key1:"g",key2:"n"})}].map(({action:c,className:a,keys:u})=>e("tr",{children:[e("th",{class:a,children:c}),e("td",{children:u})]},c))})})})]})})}),Si=new Set,ot=new WeakMap,Wt=new WeakMap,yt=new WeakMap,gn=new WeakMap,hi=new WeakMap,fn=new WeakMap,Yt=new WeakMap,zt=new WeakMap,tn=new WeakSet;let dt,Hi=0,ji=0;const Et="__aa_tgt",yn="__aa_del",jn="__aa_new",bo=n=>{const i=wa(n);i&&i.forEach(s=>ka(s))},ya=n=>{n.forEach(i=>{i.target===dt&&va(),ot.has(i.target)&&Xt(i.target)})};function wo(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 Yi(n){const i=gn.get(n);i?.disconnect();let s=ot.get(n),o=0;const c=5;s||(s=cn(n),ot.set(n,s));const{offsetWidth:a,offsetHeight:u}=dt,r=[s.top-c,a-(s.left+c+s.width),u-(s.top+c+s.height),s.left-c].map(h=>`${-1*Math.floor(h)}px`).join(" "),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=si(n),o=i?vn(s)?500:s.duration:0;zt.set(n,setTimeout(async()=>{const c=yt.get(n);try{await c?.finished,ot.set(n,cn(n)),Yi(n)}catch{}},o))}function va(){clearTimeout(zt.get(dt)),zt.set(dt,setTimeout(()=>{Si.forEach(n=>$n(n,i=>ko(()=>Xt(i))))},100))}function ba(n){setTimeout(()=>{fn.set(n,setInterval(()=>ko(Xt.bind(null,n)),2e3))},Math.round(2e3*Math.random()))}function ko(n){typeof requestIdleCallback=="function"?requestIdleCallback(()=>n()):requestAnimationFrame(()=>n())}let Tt;const So=typeof window<"u"&&"ResizeObserver"in window;So&&(dt=document.documentElement,new MutationObserver(bo),Tt=new ResizeObserver(ya),window.addEventListener("scroll",()=>{ji=window.scrollY,Hi=window.scrollX}),Tt.observe(dt));function wa(n){return n.reduce((o,c)=>[...o,...Array.from(c.addedNodes),...Array.from(c.removedNodes)],[]).every(o=>o.nodeName==="#comment")?!1:n.reduce((o,c)=>{if(o===!1)return!1;if(c.target instanceof Element){if(fi(c.target),!o.has(c.target)){o.add(c.target);for(let a=0;a<c.target.children.length;a++){const u=c.target.children.item(a);if(u){if(yn in u)return!1;fi(c.target,u),o.add(u)}}}if(c.removedNodes.length)for(let a=0;a<c.removedNodes.length;a++){const u=c.removedNodes[a];if(yn in u)return!1;u instanceof Element&&(o.add(u),fi(c.target,u),Wt.set(u,[c.previousSibling,c.nextSibling]))}}return o},new Set)}function fi(n,i){!i&&!(Et in n)?Object.defineProperty(n,Et,{value:n}):i&&!(Et in i)&&Object.defineProperty(i,Et,{value:n})}function ka(n){var i,s;const o=n.isConnected,c=ot.has(n);o&&Wt.has(n)&&Wt.delete(n),((i=yt.get(n))===null||i===void 0?void 0:i.playState)!=="finished"&&((s=yt.get(n))===null||s===void 0||s.cancel()),jn in n?ps(n):c&&o?Ca(n):c&&!o?_a(n):ps(n)}function At(n){return Number(n.replace(/[^0-9.\-]/g,""))}function Sa(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 cn(n){const i=n.getBoundingClientRect(),{x:s,y:o}=Sa(n);return{top:i.top+o,left:i.left+s,width:i.width,height:i.height}}function Co(n,i,s){let o=i.width,c=i.height,a=s.width,u=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),h=At(d.paddingLeft)+At(d.paddingRight)+At(d.borderRightWidth)+At(d.borderLeftWidth);o-=h,a-=h,c-=l,u-=l}return[o,a,c,u].map(Math.round)}function si(n){return Et in n&&Yt.has(n[Et])?Yt.get(n[Et]):{duration:250,easing:"ease-in-out"}}function _o(n){if(Et in n)return n[Et]}function Vi(n){const i=_o(n);return i?tn.has(i):!1}function $n(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(c=>c(o,Yt.has(o)))}}function Gi(n){return Array.isArray(n)?n:[n]}function vn(n){return typeof n=="function"}function Ca(n){const i=ot.get(n),s=cn(n);if(!Vi(n))return ot.set(n,s);if(wo(n)){ot.set(n,s),Yi(n);return}let o;if(!i)return;const c=si(n);if(typeof c!="function"){let a=i.left-s.left,u=i.top-s.top;const d=i.left+i.width-(s.left+s.width);i.top+i.height-(s.top+s.height)==0&&(u=0),d==0&&(a=0);const[l,h,f,m]=Co(n,i,s),y={transform:`translate(${a}px, ${u}px)`},g={transform:"translate(0, 0)"};l!==h&&(y.width=`${l}px`,g.width=`${h}px`),f!==m&&(y.height=`${f}px`,g.height=`${m}px`),o=n.animate([y,g],{duration:c.duration,easing:c.easing})}else{const[a]=Gi(c(n,"remain",i,s));o=new Animation(a),o.play()}yt.set(n,o),ot.set(n,s),o.addEventListener("finish",Xt.bind(null,n,!1),{once:!0})}function ps(n){jn in n&&delete n[jn];const i=cn(n);ot.set(n,i);const s=si(n);if(!Vi(n))return;if(wo(n)){Yi(n);return}let o;if(typeof s!="function")o=n.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:s.duration*1.5,easing:"ease-in"});else{const[c]=Gi(s(n,"add",i));o=new Animation(c),o.play()}yt.set(n,o),o.addEventListener("finish",Xt.bind(null,n,!1),{once:!0})}function ms(n,i){var s;n.remove(),ot.delete(n),Wt.delete(n),yt.delete(n),(s=gn.get(n))===null||s===void 0||s.disconnect(),setTimeout(()=>{if(yn in n&&delete n[yn],Object.defineProperty(n,jn,{value:!0,configurable:!0}),i&&n instanceof HTMLElement)for(const o in i)n.style[o]=""},0)}function _a(n){var i;if(!Wt.has(n)||!ot.has(n))return;const[s,o]=Wt.get(n);Object.defineProperty(n,yn,{value:!0,configurable:!0});const c=window.scrollX,a=window.scrollY;if(o&&o.parentNode&&o.parentNode instanceof Element?o.parentNode.insertBefore(n,o):s&&s.parentNode?s.parentNode.appendChild(n):(i=_o(n))===null||i===void 0||i.appendChild(n),!Vi(n))return ms(n);const[u,d,r,l]=Aa(n),h=si(n),f=ot.get(n);(c!==Hi||a!==ji)&&Ia(n,c,a,h);let m,y={position:"absolute",top:`${u}px`,left:`${d}px`,width:`${r}px`,height:`${l}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!vn(h))Object.assign(n.style,y),m=n.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:h.duration,easing:"ease-out"});else{const[g,w]=Gi(h(n,"remove",f));w?.styleReset!==!1&&(y=w?.styleReset||y,Object.assign(n.style,y)),m=new Animation(g),m.play()}yt.set(n,m),m.addEventListener("finish",()=>ms(n,y),{once:!0})}function Ia(n,i,s,o){const c=Hi-i,a=ji-s,u=document.documentElement.style.scrollBehavior;if(getComputedStyle(dt).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+c,window.scrollY+a),!n.parentElement)return;const r=n.parentElement;let l=r.clientHeight,h=r.clientWidth;const f=performance.now();function m(){requestAnimationFrame(()=>{if(!vn(o)){const y=l-r.clientHeight,g=h-r.clientWidth;f+o.duration>performance.now()?(window.scrollTo({left:window.scrollX-g,top:window.scrollY-y}),l=r.clientHeight,h=r.clientWidth,m()):document.documentElement.style.scrollBehavior=u}})}m()}function Aa(n){var i;const s=ot.get(n),[o,,c]=Co(n,s,cn(n));let a=n.parentElement;for(;a&&(getComputedStyle(a).position==="static"||a instanceof HTMLBodyElement);)a=a.parentElement;a||(a=document.body);const u=getComputedStyle(a),d=!yt.has(n)||((i=yt.get(n))===null||i===void 0?void 0:i.playState)==="finished"?cn(a):ot.get(a),r=Math.round(s.top-d.top)-At(u.borderTopWidth),l=Math.round(s.left-d.left)-At(u.borderLeftWidth);return[r,l,o,c]}function Io(n,i={}){if(So&&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"}),$n(n,Xt,ba,u=>Tt?.observe(u)),vn(i)?Yt.set(n,i):Yt.set(n,{duration:250,easing:"ease-in-out",...i});const a=new MutationObserver(bo);a.observe(n,{childList:!0}),hi.set(n,a),Si.add(n)}return Object.freeze({parent:n,enable:()=>{tn.add(n)},disable:()=>{tn.delete(n),$n(n,o=>{const c=yt.get(o);try{c?.cancel()}catch{}yt.delete(o);const a=zt.get(o);a&&clearTimeout(a),zt.delete(o);const u=fn.get(o);u&&clearInterval(u),fn.delete(o)})},isEnabled:()=>tn.has(n),destroy:()=>{tn.delete(n),Si.delete(n),Yt.delete(n);const o=hi.get(n);o?.disconnect(),hi.delete(n),$n(n,c=>{Tt?.unobserve(c);const a=yt.get(c);try{a?.cancel()}catch{}yt.delete(c);const u=gn.get(c);u?.disconnect(),gn.delete(c);const d=fn.get(c);d&&clearInterval(d),fn.delete(c);const r=zt.get(c);r&&clearTimeout(r),zt.delete(c),ot.delete(c),Wt.delete(c)})}})}function oi(n){const i=B(null),[s,o]=R(),c=a=>{s&&(a?s.enable():s.disable())};return V(()=>{i.current instanceof HTMLElement&&o(Io(i.current,n||{}))},[]),V(()=>()=>{var a;(a=s?.destroy)===null||a===void 0||a.call(s)},[s]),[i,c]}function xa(n){return("0"+n.toString(16)).slice(-2)}function Ta(){var n=new Uint32Array(28);return window.crypto.getRandomValues(n),Array.from(n,xa).join("")}function Ea(n){const s=new TextEncoder().encode(n);return window.crypto.subtle.digest("SHA-256",s)}function Ra(n){let i="";const s=new Uint8Array(n),o=s.byteLength;for(var c=0;c<o;c++)i+=String.fromCharCode(s[c]);return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ao(n){const i=await Ea(n);return Ra(i)}async function La({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=Ao;const $a={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{DEV:Wi,PHANPY_CLIENT_NAME:Ma,PHANPY_WEBSITE:Yn}=$a,Zi="read write follow push",Pa=Yn?Yn.toLowerCase().includes(location.hostname):!1,Da=location.origin+location.pathname,bn=Wi||!Pa?Da:Yn;async function Na({instanceURL:n}){const i=new URLSearchParams({client_name:Ma,redirect_uris:bn,scopes:Zi,website:Yn||bn});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 Oa({instanceURL:n,client_id:i,forceLogin:s=!1}){const o=Ta(),c=await Ao(o),a=new URLSearchParams({client_id:i,code_challenge_method:"S256",code_challenge:c,redirect_uri:bn,response_type:"code",scope:Zi});return s&&a.append("force_login",!0),[`https://${n}/oauth/authorize?${a.toString()}`,o]}async function za({instanceURL:n,client_id:i,forceLogin:s=!1}){const o=new URLSearchParams({client_id:i,scope:Zi,redirect_uri:bn,response_type:"code"});return s&&o.append("force_login",!0),`https://${n}/oauth/authorize?${o.toString()}`}async function qa({instanceURL:n,client_id:i,client_secret:s,code:o,code_verifier:c}){const a=new URLSearchParams({client_id:i,redirect_uri:bn,grant_type:"authorization_code",code:o});return s&&a.append("client_secret",s),c&&a.append("code_verifier",c),await(await fetch(`https://${n}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString()})).json()}async function Fa({instanceURL:n,client_id:i,client_secret:s,token:o}){try{const c=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:c.toString(),keepalive:!0})).ok}catch{return!1}}const Ua=window.matchMedia("(display-mode: standalone)").matches;function Ba({onClose:n}){const{_:i}=ie(),{masto:s}=se(),o=nn(),c=wt(),a=o.length>1,[u,d]=$t(l=>l+1,0),[r]=oi();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,h)=>{const f=l.info.id===c,m=h===0,y=!l.accessToken;return e("li",{children:[e("div",{children:[a&&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 g=await s.v1.accounts.$select(l.info.id).fetch();l.info=g,Ht(o),d()}catch{}}}),e(mt,{account:a?{...l.info,acct:/@/.test(l.info.acct)?l.info.acct:`${l.info.acct}@${l.instanceURL}`}:l.info,showAcct:!0,onClick:()=>{y?(location.href=`/#/login?instance=${l.instanceURL}`,n()):f?E.showAccount=`${l.info.username}@${l.instanceURL}`:(Un(l.info.id),location.reload())}})]}),e("div",{class:"actions",children:[y&&e("span",{class:"tag",children:e(p,{id:"mxY4xF"})}),m&&a&&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:[a&&e(N,{children:[e(ye,{disabled:f||y,onClick:()=>{Un(l.info.id),location.reload()},children:[e(I,{icon:"transfer"})," ",e(p,{id:"3t/Nrv"})]}),!Ua&&!f&&!y&&e(Ye,{href:`./?account=${l.info.id}`,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(p,{id:"PZgZtY"})})]}),e(Ve,{})]}),e(ye,{onClick:()=>{E.showAccount=`${l.info.username}@${l.instanceURL}`},children:[e(I,{icon:"user"}),e("span",{children:e(p,{id:"40z2Fm"})})]}),e(Ve,{}),a&&e(N,{children:[e(ye,{disabled:m||y,onClick:()=>{o.splice(h,1),o.unshift(l),Ht(o),d()},children:[e(I,{icon:"check-circle"}),e("span",{children:e(p,{id:"PPcets"})})]}),e(ye,{disabled:h<=1,onClick:()=>{o.splice(h,1),o.splice(h-1,0,l),Ht(o),d()},children:[e(I,{icon:"arrow-up"}),e("span",{children:e(p,{id:"QyioBP"})})]}),e(ye,{disabled:h===0||h===o.length-1,onClick:()=>{o.splice(h,1),o.splice(h+1,0,l),Ht(o),d()},children:[e(I,{icon:"arrow-down"}),e("span",{children:e(p,{id:"3Ib6FN"})})]}),e(Ve,{})]}),e(vt,{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||y,menuItemClassName:"danger",onClick:async()=>{await Fa({instanceURL:l.instanceURL,client_id:l.clientId,client_secret:l.clientSecret,token:l.accessToken}),o.splice(h,1),Ht(o);try{Ce.session.get("currentAccount")===l.info.id&&Ce.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(ve,{to:"/login",class:"button plain2",onClick:n,children:[e(I,{icon:"plus"})," ",e("span",{children:e(p,{id:"Is7/PB"})})]})}),a&&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 Xi="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";class Ka extends HTMLElement{connectedCallback(){if(this.button=this.querySelector("button"),window.matchMedia("(display-mode: standalone)").matches){this.button.remove();return}if(!navigator.install){this.button.remove();return}this.button.addEventListener("click",async i=>{await navigator.install()})}}customElements.define("button-install",Ka);const Ha={"zh-CN":"zh-Hans","zh-TW":"zh-Hant","pt-BR":"pt-BR"};function Qi(){const{i18n:n}=ie(),i=Se(()=>yc.map(s=>{const o=Ha[s]||s.replace(/-[a-z]+$/i,""),c=Ot({code:o,locale:s,fallback:li.find(u=>u.code===s)?.nativeName}),a=Ot({code:o,locale:n.locale,fallback:li.find(u=>u.code===s)?.name});return{code:s,regionlessCode:o,_common:a,native:c}}).sort((s,o)=>{const c=s._common.localeCompare(o._common,n.locale);return c!==0?c:s.code<o.code?-1:s.code>o.code?1:0}),[]);return e("label",{class:"lang-selector",children:["🌐"," ",e("select",{class:"small",value:n.locale||bc,onChange:s=>{Ce.local.set("lang",s.target.value),vc(s.target.value)},children:[i.map(({code:s,regionlessCode:o,native:c})=>{const a=Ot({code:o,locale:n.locale,fallback:li.find(d=>d.code===s)?.name});return e("option",{value:s,"data-regionless-code":o,children:!!a&&a!==c?`${c} - ${a}`:c},s)}),void 0]})]})}function gs(n){const{masto:i}=se();return i.v1.push.subscription.create(n)}function ja(){const{masto:n}=se();return n.v1.push.subscription.fetch()}function Ya(n){const{masto:i}=se();return i.v1.push.subscription.update(n)}function Va(){const{masto:n}=se();return n.v1.push.subscription.remove()}function ci(){return"serviceWorker"in navigator&&"PushManager"in window}function Ga(){return navigator.serviceWorker.getRegistration()}async function Ji(){const n=await Ga(),i=n?await n.pushManager.getSubscription():void 0;return{registration:n,subscription:i}}function xo(n){const i="=".repeat((4-n.length%4)%4),s=`${n}${i}`.replace(/-/g,"+").replace(/_/g,"/"),o=window.atob(s),c=new Uint8Array(o.length);for(let a=0;a<o.length;++a)c[a]=o.charCodeAt(a);return c}async function Wa(){if(!ci())return;const{subscription:n}=await Ji();let i=null;try{i=await ja()}catch(s){if(!/(not found|unknown)/i.test(s.message))throw s}if(i&&n){const s=i.endpoint===n.endpoint,o=Bn(),c=i.serverKey===o;if(!s)throw new Error("Backend subscription endpoint changed");if(!c)throw new Error("Backend subscription key and vapid key changed")}if(n&&!i){const s=Bn();if(s){const{applicationServerKey:o}=n.options,c=xo(s).toString(),a=new Uint8Array(o).toString();if(!(c===a))throw await n.unsubscribe(),new Error("Subscription key and vapid key changed")}}return{subscription:n,backendSubscription:i}}async function ys({data:n,policy:i}){if(!ci())return;let{registration:s,subscription:o}=await Ji(),c=null;if(o)try{c=await Ya({data:n,policy:i})}catch{c=await gs({subscription:o,data:n,policy:i})}else{const a=Bn();if(!a)throw new Error("No server key found");o=await s.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:xo(a)}),c=await gs({subscription:o,data:n,policy:i})}return{subscription:o,backendSubscription:c}}async function vs(){if(!ci())return;const{subscription:n}=await Ji();n&&(await Va(),await n.unsubscribe())}const Za={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},bs=16,Ut=[14,15,16,17,18,19,20],{PHANPY_WEBSITE:ws,PHANPY_PRIVACY_POLICY_URL:Xa,PHANPY_TRANSLANG_INSTANCES:Qa,PHANPY_IMG_ALT_API_URL:Ja,PHANPY_GIPHY_API_KEY:er,PHANPY_CLIENT_NAME:tr}=Za,ks=Object.entries(Yc.tl).map(([n,i])=>({code:n,name:i})),nr="TransLang API";function ir({onClose:n}){const{_:i}=ie(),s=Ge(E),o=Ce.local.get("theme")||"auto",c=B(),a=s.settings.contentTranslationTargetLanguage||null,u=uo(),d=Ot(u),r=Ce.local.get("textSize")||bs,[l,h]=R($i()),{masto:f,authenticated:m,instance:y}=se(),[g,w]=R(Ce.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:c,onInput:b=>{b.preventDefault();const _=new FormData(c.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"?Ce.local.del("theme"):Ce.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===bs?Ce.local.del("textSize"):Ce.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(Qi,{})]})]})}),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"),h(_),as(_),de(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};h(_),as(_),de(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:y},components:{0:e("a",{href:`https://${y}/`,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"})]})}),!!Qa&&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:a||"",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:"──────────"}),ks.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:ks.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:nr},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",{})}})})})]})]})]}),!!er&&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"})}})})})]}),!!Ja&&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"})})}),e("li",{children:e(ve,{to:"/yip",onClick:n,class:"button light",children:"Year in Posts"})}),e("li",{children:e("button-install",{children:e("button",{type:"button",class:"light",children:e(p,{id:"vOsY+K",values:{CLIENT_NAME:tr}})})})})]})}),m&&e(sr,{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:Xi,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:Xa,target:"_blank",rel:"noopener",children:e(p,{id:"LcET2C"})})]}),e("p",{children:[ws&&e(N,{children:[e(p,{id:"pFnMHn",values:{0:ws.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/2e1d0c4",target:"_blank",rel:"noopener",children:e(xt,{datetime:new Date("2026-01-07T13:04:22.650Z")})}),")"]})},components:{0:e("span",{class:"insignificant"}),1:e("input",{type:"text",class:"version-string",readOnly:!0,size:"18",value:`${"2026-01-07T13:03:46.000Z".slice(0,10).replace(/-/g,".")}.2e1d0c4`,onClick:b=>{b.target.select();try{navigator.clipboard.writeText(b.target.value),de(i({id:"PiPfua"}))}catch{de(i({id:"gdxreD"}))}}})}})]})]}),void 0]})]})}function sr({onClose:n}){const{_:i}=ie();if(!ci())return null;const{instance:s}=se(),[o,c]=R("default"),a=B(),[u,d]=R(!1),[r,l]=R(!1),h=B();V(()=>{(async()=>{c("loading");try{const{subscription:m,backendSubscription:y}=await Wa();if(y?.policy&&y.policy!=="none"){d(!0);const{alerts:g,policy:w}=y;h.current=w;const{elements:k}=a.current,b=k.namedItem("policy");b&&(b.value=w),Object.entries(g).forEach(([v,_])=>{const S=k.namedItem(v);S?.type==="checkbox"&&(S.checked=!!_)})}c("default")}catch(m){/outside.*authorized/i.test(m.message)?l(!0):alert(m?.message||m),c("error")}})()},[]);const f=o==="loading";return e("form",{ref:a,onChange:()=>{setTimeout(()=>{const m=Object.fromEntries(new FormData(a.current)),y=!!m["policy-allow"],g={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(g.data.alerts).forEach(b=>{g.data.alerts[b]?w++:delete g.data.alerts[b]});const k=h.current!==g.data.policy;y&&w>0?k?vs().then(()=>{ys(g)}).catch(b=>{alert(i({id:"I6pdY3"}))}):ys(g).catch(b=>{alert(i({id:"I6pdY3"}))}):vs().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:u,onChange:async m=>{const{checked:y}=m.target;if(y){const g=await Notification.requestPermission();g==="granted"?d(!0):(d(!1),g==="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||!u})}})]}),e("div",{class:"shazam-container no-animation",style:{width:"100%"},hidden:!u,children:e("div",{class:"shazam-container-inner",children:e("div",{class:"sub-section",children:e("ul",{children:[{value:"mention",label:i({id:"/bZzdR"})},{value:"favourite",label:i({id:"zZOZj7"})},{value:"reblog",label:i({id:"puY2t0"})},{value:"follow",label:i({id:"aaJhcT"})},{value:"followRequest",label:i({id:"6Fs1Ba"})},{value:"poll",label:i({id:"wNExRS"})},{value:"update",label:i({id:"K/EtE6"})},{value:"status",label:i({id:"2yr1/p"})}].map(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(ve,{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 Ci=()=>{let n=setTimeout(()=>{const i=document.getElementById("columns");if(i){const s=i.querySelector(".deck-container.focus");if(s)s.focus();else{const o=Array.from(i.querySelectorAll(".deck-container")).find(c=>c.getBoundingClientRect().left>=0);o?o.focus():i.querySelector(".deck-container")?.focus?.()}}else{const s=document.querySelectorAll("#modal-container > *");if(s?.length){const u=s[s.length-1],d=u.querySelector('[tabindex="-1"]')||u;if(d){d.focus();return}}if(document.querySelector(".deck-backdrop"))return;const c=document.querySelectorAll(".deck-container"),a=c[c.length-1];a&&a.tabIndex===-1&&a.focus()}},100);return()=>clearTimeout(n)};function To(n){if(!n)return;const i=an(),s=B(i.pathname);V(()=>{s.current&&i.pathname!==s.current&&n?.()},[i.pathname,n])}function or({acct:n,instance:i}){let[s,o]=n.split("@");o||(o=i);const c=ei.toASCII(n);return e("div",{class:"handle-info",children:[e("span",{class:"handle-handle",title:c,children:[e("b",{class:"handle-username",children:s}),e("span",{class:"handle-at",children:"@"}),e("b",{class:"handle-server",children:o})]}),e("div",{class:"handle-legend",children:[e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon username"})," ",e(p,{id:"silO9A"})]})," ",e("span",{class:"ib",children:[e("span",{class:"handle-legend-icon server"})," ",e(p,{id:"rZgCpJ"})]})]})]})}const cr=["image/jpeg","image/png","image/gif","image/webp"],Ss=cr.join(",");function ar({name:n,value:i,disabled:s,index:o}){const[c,a]=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:c,dir:"auto",enterKeyHint:"done"})}),e("td",{children:e("input",{type:"text",name:`fields_attributes[${o}][value]`,defaultValue:i,disabled:s,maxLength:255,onChange:u=>a(!!u.currentTarget.value),dir:"auto",enterKeyHint:"done"})})]})}function rr({onClose:n=()=>{}}){const{_:i}=ie(),{masto:s}=se(),[o,c]=R("loading"),[a,u]=R(null),[d,r]=R(null),[l,h]=R(null);V(()=>{(async()=>{try{const S=await s.v1.accounts.verifyCredentials();u(S),c("default")}catch{c("error")}})()},[]);const{displayName:f,source:m,avatar:y,header:g}=a||{},{note:w,fields:k}=m||{},b=B(null),v=[...y?[{type:"image",url:y}]:[],...l?[{type:"image",url:l}]:[]],_=[...g?[{type:"image",url:g}]:[],...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(Oe,{abrupt:!0})}):e("form",{onSubmit:S=>{S.preventDefault();const A=new FormData(S.target),C=A.get("header"),x=A.get("avatar"),L=A.get("display_name"),P=A.get("note"),F=b.current.querySelectorAll('input[name^="fields_attributes"]'),z=[];F.forEach(K=>{const ee=K.name,[te,G,W]=ee.match(/fields_attributes\[(\d+)\]\[(.+)\]/)||[],H=K.value?K.value.trim():"";G&&W&&H&&(z[G]||(z[G]={}),z[G][W]=H)}),z.forEach(K=>{K.name&&!K.value&&(K.value="")}),(async()=>{try{const K=await s.v1.accounts.updateCredentials({header:C,avatar:x,displayName:L,note:P,fieldsAttributes:z});n?.({state:"success",account:K})}catch(K){alert(K?.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:Ss,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:[g?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:_,mediaIndex:0}},children:e("img",{src:g,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:Ss,onChange:S=>{const A=S.target.files[0];if(A){const C=URL.createObjectURL(A);h(C)}}})]}),e("div",{class:"edit-profile-media-field",children:[y?e("div",{class:"edit-media",tabIndex:"0",onClick:()=>{E.showMediaModal={mediaAttachments:v,mediaIndex:0}},children:e("img",{src:y,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(ar,{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 lr=80;function dr({accountID:n,info:i,open:s=!1,onlyOpenIfHasEndorsements:o=!1}){const{masto:c}=se(),a=B(),[u,d]=R("default"),[r,l]=R([]),[h,f]=R({});return V(()=>{Qe("@mastodon/endorsements")&&s&&(async()=>{d("loading");try{const y=await c.v1.accounts.$select(n).endorsements.list({limit:lr});if(!y.length){d("default");return}l(y),d("default"),setTimeout(()=>{a.current.scrollIntoView({behavior:"smooth",block:"nearest"})},300);const g=await ni(y,h);g&&f(g)}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:a,children:[e("h3",{children:e(p,{id:"UIfdY1",values:{0:i.username}})}),u==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):r.length>0?e("ul",{class:`endorsements ${r.length>10?"expanded":""}`,children:r.map(y=>e("li",{children:e(gt,{account:y,showStats:!0,avatarSize:"xxl",relationship:h[y.id]},y.id)}))}):e("p",{class:"ui-state insignificant",children:e(p,{id:"AgkUZa"})})]})})}):null}async function ur(n){const{masto:i}=se({instance:n});return!!(await i.v2.search.list({q:"from:me",type:"statuses",limit:1}))?.statuses?.length}const Eo=St(ur),Ro=1e3*60,hr=1440*60*1e3,_i=St(async()=>{const{masto:n}=se(),i=await n.v1.lists.list();return i.sort((s,o)=>s.title.localeCompare(o.title)),i.length&&setTimeout(()=>{Ce.account.set("lists",{lists:i,updatedAt:Date.now()})},1),i},{expires:Ro});async function Sn(){try{const{lists:n,updatedAt:i}=Ce.account.get("lists")||{};return n?.length?(Date.now()-i>hr&&_i(),n):await _i()}catch{return[]}}const fr=St(n=>{const{masto:i}=se();return i.v1.lists.$select(n).fetch()},{expires:Ro});async function Lo(n){const{lists:i}=Ce.account.get("lists")||{};if(i?.length){const s=i.find(o=>o.id===n);if(s)return s}try{return fr(n)}catch{return null}}async function pr(n){return(await Lo(n))?.title||""}function mr(n){const{lists:i}=Ce.account.get("lists")||{};i?.length&&(i.push(n),i.sort((s,o)=>s.title.localeCompare(o.title)),Ce.account.set("lists",{lists:i,updatedAt:Date.now()}))}function gr(n){const{lists:i}=Ce.account.get("lists")||{};if(i?.length){const s=i.findIndex(o=>o.id===n.id);s!==-1&&(i[s]=n,i.sort((o,c)=>o.title.localeCompare(c.title)),Ce.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function yr(n){const{lists:i}=Ce.account.get("lists")||{};if(i?.length){const s=i.findIndex(o=>o.id===n);s!==-1&&(i.splice(s,1),Ce.account.set("lists",{lists:i,updatedAt:Date.now()}))}}function Zt({insignificant:n}){const{_:i}=ie();return e(I,{icon:"filter",size:"xs",class:`list-exclusive-badge ${n?"insignificant":""}`,title:i({id:"FNptcJ"})})}function es({list:n,onClose:i}){const{_:s}=ie(),{masto:o}=se(),[c,a]=R("default"),u=!!n,d=B(),r=B(),l=B();V(()=>{u&&(d.current.value=n.title,r.current.value=n.repliesPolicy,l.current&&(l.current.checked=n.exclusive))},[u]);const h=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(u?{id:"tuhghE"}:{id:"Sb2gYF"})})}),e("main",{children:e("form",{class:"list-form",onSubmit:f=>{f.preventDefault();const m=new FormData(f.target),y=m.get("title"),g=m.get("replies_policy"),w=m.get("exclusive")==="on";a("loading"),(async()=>{try{let k;u?k=await o.v1.lists.$select(n.id).update({title:y,replies_policy:g,exclusive:w}):k=await o.v1.lists.create({title:y,replies_policy:g,exclusive:w}),a("default"),i?.({state:"success",list:k}),setTimeout(()=>{u?gr(k):mr(k)},1)}catch{a("error"),alert(s(u?{id:"R7ep1i"}:{id:"KPoj8w"}))}})()},children:[e("div",{class:"list-form-row",children:e("label",{for:"list-title",children:[e(p,{id:"6YtxFj"})," ",e("input",{ref:d,type:"text",id:"list-title",name:"title",required:!0,disabled:c==="loading",dir:"auto"})]})}),e("div",{class:"list-form-row",children:e("select",{ref:r,name:"replies_policy",required:!0,disabled:c==="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"})})]})}),h&&e("div",{class:"list-form-row",children:e("label",{class:"label-block",children:[e("input",{ref:l,type:"checkbox",name:"exclusive",disabled:c==="loading"})," ",e(Zt,{insignificant:!0})," ",e(p,{id:"jxxYp0"})]})}),e("div",{class:"list-form-footer",children:[e("button",{type:"submit",disabled:c==="loading",children:s(u?{id:"tfDRzk"}:{id:"hYgDIe"})}),u&&e(vt,{disabled:c==="loading",align:"end",menuItemClassName:"danger",confirmLabel:s({id:"+kQ/cY"}),onClick:()=>{a("loading"),(async()=>{try{await o.v1.lists.$select(n.id).remove(),a("default"),i?.({state:"deleted"}),setTimeout(()=>{yr(n.id)},1)}catch{a("error"),alert(s({id:"tqUaGL"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:c==="loading",children:e(p,{id:"Jb6/SB"})})})]})]})})]})}function vr({accountID:n,onClose:i}){const{_:s}=ie(),{masto:o}=se(),[c,a]=R("default"),[u,d]=R([]),[r,l]=R([]),[h,f]=$t(g=>g+1,0);V(()=>{a("loading"),(async()=>{try{const g=await Sn();d(g);const w=await o.v1.accounts.$select(n).lists.list();l(w),a("default")}catch{a("error")}})()},[h]);const[m,y]=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:[u.length>0?e("ul",{class:"list-add-remove",children:u.map(g=>{const w=r.some(k=>k.id===g.id);return e("li",{children:e("button",{type:"button",class:`light ${w?"checked":""}`,disabled:c==="loading",onClick:()=>{a("loading"),(async()=>{try{w?await o.v1.lists.$select(g.id).accounts.remove({accountIds:[n]}):await o.v1.lists.$select(g.id).accounts.create({accountIds:[n]}),f()}catch{a("error"),alert(s(w?{id:"7KnEYa"}:{id:"Tba8uO"}))}})()},children:[e(I,{icon:"check-circle",alt:"☑️"}),e("span",{children:g.title})]})})})}):c==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):c==="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:()=>y(!0),disabled:c!=="default",children:[e(I,{icon:"plus",size:"l"})," ",e("span",{children:e(p,{id:"Sb2gYF"})})]})]}),m&&e(Fe,{onClick:g=>{g.target===g.currentTarget&&y(!1)},children:e(es,{list:m?.list,onClose:g=>{g.state==="success"&&f(),y(!1)}})})]})}function br({account:n,note:i,onRelationshipChange:s=()=>{},onClose:o=()=>{}}){const{_:c}=ie(),{masto:a}=se(),[u,d]=R("default"),r=B(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:c({id:"yz7wBu"})})}),e("header",{children:[e("b",{children:e(p,{id:"1DBGsz"})})," ",e("small",{class:"insignificant",children:e(p,{id:"XHVHK2"})})]}),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 a.v1.accounts.$select(n?.id).note.create({comment:f});d("default"),s(m),o()}catch(m){d("error"),alert(m?.message||c({id:"ot8LpF"}))}})())},children:[e("textarea",{ref:r,name:"note",disabled:u==="loading",dir:"auto",children:i}),e("footer",{children:[e("button",{type:"button",class:"light",disabled:u==="loading",onClick:()=>{o?.()},children:e(p,{id:"dEgA5A"})}),e("span",{children:[e(Oe,{abrupt:!0,hidden:u!=="loading"}),e("button",{disabled:u==="loading",type:"submit",children:e(p,{id:"SrwrEj"})})]})]})]})})]})}function wr({note:n,fields:i,onClose:s}){const{_:o}=ie(),c=i?.map(({name:u,value:d})=>`${u}
|
||
${ds(d)}`).join(`
|
||
|
||
`)||"",a=ds(n)+(c?`
|
||
|
||
${c}`:"");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:a}),e(ho,{forceTranslate:!0,text:a})]})]})}const kr=[300,1800,3600,3600*6,3600*24,3600*24*3,3600*24*7,3600*24*30,0],Jt={0:{id:"9ZP9cc"},300:ct(5,"minute"),1800:ct(30,"minute"),3600:ct(1,"hour"),21600:ct(6,"hour"),86400:ct(1,"day"),259200:ct(3,"day"),604800:ct(1,"week"),2592e3:ct(30,"day")};function Sr({info:n,instance:i,standalone:s,authenticated:o,onRelationshipChange:c=()=>{},setShowEditProfile:a=()=>{},showEndorsements:u=!1,renderEndorsements:d=!1,setRenderEndorsements:r=()=>{}}){if(!n)return null;const{_:l,_:h}=ie(),{masto:f,instance:m,authenticated:y}=se(),g=i===m,[w,k]=R("default"),[b,v]=R(null),{id:_,acct:S,url:A,username:C,locked:x,lastStatusAt:L,note:P,fields:F,moved:z}=n,K=B(_),{following:ee,showingReblogs:te,notifying:G,followedBy:W,blocking:H,blockedBy:Y,muting:$,mutingNotifications:Q,requested:j,domainBlocking:Z,endorsed:le,note:ne}=b||{},[J,we]=R(null),[be,ke]=R(!1),ze=S.includes("@")?S:`${S}@${i}`,_e=Qe("@mastodon/endorsements");V(()=>{if(n){const M=wt();let ge;(async()=>{if(g&&o)ge=_;else if(!g&&y){const Pe=n.acct.includes("@");try{const D=await f.v2.search.list({q:Pe?n.acct:`${n.username}@${i}`,type:"accounts",limit:1,resolve:!0});D.accounts.length&&(ge=D.accounts[0].id,we(D.accounts[0]))}catch{}}if(!ge)return;if(M===ge){ke(!0);return}K.current=ge,k("loading");const Ne=f.v1.accounts.relationships.fetch({id:[ge]});try{const Pe=await Ne;if(k("default"),Pe.length){const D=Pe[0];v(D),c({relationship:D,currentID:ge})}}catch{k("error")}})()}},[n,o]),V(()=>{n&&be&&wc(n)},[n,be]);const Te=w==="loading",[xe,qe]=R(!1),[Ue,He]=R(!1),[We,ce]=R(!1),[Me,Ie]=R([]),[oe,Be]=R(!1);V(()=>{y&&(async()=>{const M=await Eo(m);Be(M)})()},[m,y]);let{headerStatic:Ee,avatarStatic:Le}=n;return(!Ee||/missing\.png$/.test(Ee))&&Le&&!/missing\.png$/.test(Le)&&(Ee=Le),e(N,{children:[e("div",{class:"actions",children:[e("span",{children:[W?e("span",{class:"tag",children:e(p,{id:"p3UO/y"})}):L?e("small",{class:"insignificant",children:e(p,{id:"F3cM1G",values:{0:at(L,{hideTime:!0})},components:{0:e("span",{class:"ib"})}})}):e("span",{}),$&&e("span",{class:"tag danger",children:e(p,{id:"+IJm1Z"})}),H&&e("span",{class:"tag danger",children:e(p,{id:"32TndD"})})]})," ",e("span",{class:"buttons",children:[!!ne&&e("button",{type:"button",class:"private-note-tag",title:h({id:"1DBGsz"}),onClick:()=>{ce(!0)},dir:"auto",children:e("span",{children:ne})}),y&&be&&e("button",{type:"button",class:"plain",onClick:()=>{E.showQrCodeModal={text:A,arena:Le,backgroundMask:Ee,caption:S.includes("@")?S:`${S}@${i}`,onScannerClick:Ii}},children:e(I,{icon:"qrcode",alt:h({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:Te,children:e(I,{icon:"more2",size:"l",alt:h({id:"2FYpfJ"})})}),onMenuChange:M=>{ee&&M.open&&(async()=>{try{const ge=await f.v1.accounts.$select(K.current).lists.list();Ie(ge)}catch{}})()},children:[y&&!be?e(N,{children:[e(ye,{onClick:()=>{ro({draftStatus:{status:`@${J?.acct||S} `}})},children:[e(I,{icon:"at"}),e("span",{children:e(p,{id:"3LkfZu",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),oe&&e(ye,{onClick:()=>{E.showSearchCommand={query:`from:${S} `}},children:[e(I,{icon:"search"}),e("span",{children:e(p,{id:"LCX3ys",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]}),e(ye,{onClick:()=>{qe(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(p,{id:"R8mSiS"})})]}),Qe("@mastodon/profile-private-note")&&e(ye,{onClick:()=>{ce(!0)},children:[e(I,{icon:"note"}),e("span",{children:h(ne?{id:"+kQy/G"}:{id:"GquPwe"})})]}),ee&&!!b&&e(N,{children:[e(ye,{onClick:()=>{k("loading"),(async()=>{try{const M=await f.v1.accounts.$select(K.current).follow({notify:!G});M&&v(M),k("default"),de(M.notifying?h({id:"jL3N0G",values:{username:C}}):h({id:"0h4/9h",values:{username:C}}))}catch(M){alert(M),k("error")}})()},children:[e(I,{icon:"notification"}),e("span",{children:h(G?{id:"osJmEN"}:{id:"I92Z+b"})})]}),e(ye,{onClick:()=>{k("loading"),(async()=>{try{const M=await f.v1.accounts.$select(K.current).follow({reblogs:!te});M&&v(M),k("default"),de(M.showingReblogs?h({id:"0X2KC8",values:{username:C}}):h({id:"cXWjH0",values:{username:C}}))}catch(M){alert(M),k("error")}})()},children:[e(I,{icon:"rocket"}),e("span",{children:h(te?{id:"GRUr8d"}:{id:"uREpT3"})})]})]}),_e&&ee&&e(ye,{onClick:()=>{k("loading"),(async()=>{try{if(le){const M=await f.v1.accounts.$select(J?.id||_).unpin();v(M),k("default"),de(h({id:"pWFLFk",values:{username:C}}))}else{const M=await f.v1.accounts.$select(J?.id||_).pin();v(M),k("default"),de(h({id:"xhiXaF",values:{username:C}}))}}catch{k("error"),le?de(h({id:"xHq5L2",values:{username:C}})):de(h({id:"Owr/5+",values:{username:C}}))}})()},children:[e(I,{icon:"endorsement"}),h(le?{id:"S9JvjK"}:{id:"UlJ3QN"})]}),u&&_e&&!d&&e(ye,{onClick:()=>r(!0),children:[e(I,{icon:"endorsement"}),e("span",{children:e(p,{id:"Qopbnd"})})]}),ee&&e(ye,{onClick:()=>{He(!0)},children:[e(I,{icon:"list"}),Me.length?e(N,{children:[e("small",{class:"menu-grow",children:[e(p,{id:"sJ2yQc"}),e("br",{}),e("span",{class:"more-insignificant",children:Me.map(M=>M.title).join(", ")})]}),e("small",{class:"more-insignificant",children:Me.length})]}):e("span",{children:e(p,{id:"sJ2yQc"})})]}),e(Ve,{})]}):e(N,{children:[oe&&be&&e(ye,{onClick:()=>{E.showSearchCommand={query:"from:me "}},children:[e(I,{icon:"search"}),e("span",{children:e(p,{id:"BmW9JG"})})]}),_e&&!d&&e(N,{children:e(ye,{onClick:()=>r(!0),children:[e(I,{icon:"endorsement"}),e(p,{id:"Qopbnd"})]})}),(oe&&be||_e&&!d)&&e(Ve,{})]}),e(ye,{onClick:()=>{const M=`@${J?.acct||ze}`;try{navigator.clipboard.writeText(M),de(h({id:"zJoEwS"}))}catch{de(h({id:"BC0lSD"}))}},children:[e(I,{icon:"copy"}),e("small",{children:[e(p,{id:"27x6gl"}),e("br",{}),e("span",{class:"more-insignificant bidi-isolate",children:["@",J?.acct||ze]})]})]}),e(ye,{href:A,target:"_blank",children:[e(I,{icon:"external"}),e("small",{class:"menu-double-lines",children:Cr(A)})]}),e("div",{class:"menu-horizontal",children:[e(ye,{onClick:()=>{try{navigator.clipboard.writeText(A),de(h({id:"edWbV6"}))}catch{de(h({id:"W1ewR0"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(p,{id:"he3ygx"})})]}),navigator?.share&&navigator?.canShare?.({url:A})&&e(ye,{onClick:()=>{try{navigator.share({url:A})}catch{alert(h({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"}),e("span",{children:e(p,{id:"LFKLqp"})})]})]}),e(ye,{onClick:()=>{E.showQrCodeModal={text:A,arena:Le,backgroundMask:Ee,caption:S.includes("@")?S:`${S}@${i}`,onScannerClick:Ii}},children:[e(I,{icon:"qrcode"}),e("span",{children:e(p,{id:"gCX4Z9"})})]}),!!b&&e(N,{children:[e(Ve,{}),$?e(ye,{onClick:()=>{k("loading"),(async()=>{try{const M=await f.v1.accounts.$select(J?.id||_).unmute();v(M),k("default"),de(h({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(kn,{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:kr.map(M=>e(ye,{onClick:()=>{k("loading"),(async()=>{try{const ge=await f.v1.accounts.$select(J?.id||_).mute({duration:M});v(ge),k("default"),de(h({id:"/plB9m",values:{0:typeof Jt[M]=="function"?Jt[M]():l(Jt[M]),username:C}})),E.reloadGenericAccounts.id="mute",E.reloadGenericAccounts.counter++}catch{k("error"),de(h({id:"vWGBjT",values:{username:C}}))}})()},children:typeof Jt[M]=="function"?Jt[M]():l(Jt[M])}))})}),W&&e(vt,{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 M=await f.v1.accounts.$select(J?.id||_).removeFromFollowers();v(M),k("default"),de(h({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(vt,{subMenu:!0,confirm:!H,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(H){const M=await f.v1.accounts.$select(J?.id||_).unblock();v(M),k("default"),de(h({id:"sI9N29",values:{username:C}}))}else{const M=await f.v1.accounts.$select(J?.id||_).block();v(M),k("default"),de(h({id:"uYcYzu",values:{username:C}}))}E.reloadGenericAccounts.id="block",E.reloadGenericAccounts.counter++}catch{k("error"),H?de(h({id:"0tG4wG",values:{username:C}})):de(h({id:"pA+qEx",values:{username:C}}))}})()},children:H?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(ye,{className:"danger",onClick:()=>{E.showReportModal={account:J||n}},children:[e(I,{icon:"flag"}),e("span",{children:e(p,{id:"qTJgpR",values:{username:C},components:{0:e("span",{class:"bidi-isolate"})}})})]})]}),y&&be&&s&&Qe("@mastodon/profile-edit")&&e(N,{children:[e(Ve,{}),e(ye,{onClick:()=>{a(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(p,{id:"9OpVZg"})})]})]}),!1]}),!b&&w==="loading"&&e(Oe,{abrupt:!0}),!!b&&!z&&e(vt,{confirm:ee||j,confirmLabel:e("span",{children:h(j?{id:"e7qQIH"}:{id:"eYsAQr",values:{0:n.acct||n.username}})}),menuItemClassName:"danger",align:"end",disabled:Te,onClick:()=>{k("loading"),(async()=>{try{let M;ee||j?M=await f.v1.accounts.$select(K.current).unfollow():M=await f.v1.accounts.$select(K.current).follow(),M&&(v(M),u&&_e&&!d&&M.following&&r("onlyOpenIfHasEndorsements")),k("default")}catch(M){alert(M),k("error")}})()},children:e("button",{type:"button",class:`${ee||j?"light swap":""}`,"data-swap-state":ee||j?"danger":"",disabled:Te,children:ee?e(N,{children:[e("span",{children:e(p,{id:"y6sq5j"})}),e("span",{children:e(p,{id:"HKrBPX"})})]}):j?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"})})]}):h({id:"MKEPCY"})})})]})]}),!!xe&&e(Fe,{onClose:()=>{qe(!1)},children:e(wr,{note:P,fields:F,onClose:()=>qe(!1)})}),!!Ue&&e(Fe,{onClose:()=>{He(!1)},children:e(vr,{accountID:K.current,onClose:()=>He(!1)})}),!!We&&e(Fe,{onClose:()=>{ce(!1)},children:e(br,{account:n,note:ne,onRelationshipChange:M=>{v(M)},onClose:()=>ce(!1)})})]})}function Cr(n){if(!n)return;const i=URL.parse(n);if(!i)return;const{host:s,pathname:o}=i,c=o.replace(/\/$/,"").replace(/^\//,"");return e(N,{children:[e("span",{class:"more-insignificant",children:[ei.toUnicode(s),"/"]}),e("wbr",{}),e("span",{children:c})]})}const Cs=80,$o=1e3*60*10;function _r(n,i){return i.v1.accounts.familiarFollowers.fetch({id:[n]})}const Ir=St(_r,{expires:$o});async function Ar(n,i){const s=i.v1.accounts.$select(n).statuses.list({limit:20}).values().next(),{value:o}=await s,c={total:o.length,originals:0,replies:0,boosts:0,quotes:0};return o.forEach(a=>{a.reblog?c.boosts++:a.inReplyToId&&a.inReplyToAccountId!==a.account.id?c.replies++:Vt()&&(a.quote?.id||a.quote?.quotedStatus?.id)?c.quotes++:c.originals++}),o.length&&(c.daysSinceLastPost=Math.ceil((Date.now()-Date.parse(o[o.length-1].createdAt))/864e5)),c}const xr=St(Ar,{expires:$o}),Tr=n=>{try{return new URL(n),!0}catch{return!1}},Ii=()=>{E.showQrScannerModal={checkValidity:Tr,actionableText:{id:"73lp8c"},onClose:({text:n}={})=>{n&&(kc(),location.hash=`/${n}`)}}};function Mo({account:n,fetchAccount:i=()=>{},standalone:s,instance:o,authenticated:c,showEndorsements:a=!1}){const{i18n:u,_:d}=ie(),{masto:r,authenticated:l}=se({instance:o}),{masto:h,instance:f}=se(),[m,y]=R("default"),g=typeof n=="string",[w,k]=R(g?null:n),b=Se(()=>o===f,[o,f]);V(()=>{if(!g){k(n);return}y("loading"),(async()=>{try{const O=await i();E.accounts[`${O.id}@${o}`]=O,k(O),y("default")}catch{k(null),y("error")}})()},[g,n,i]);const{acct:v,avatar:_,avatarStatic:S,bot:A,createdAt:C,displayName:x,emojis:L,fields:P,followersCount:F,followingCount:z,group:K,id:ee,lastStatusAt:te,locked:G,note:W,statusesCount:H,url:Y,username:$,memorial:Q,moved:j,roles:Z,hideCollections:le}=w||{};let ne=!1,{header:J,headerStatic:we}=w||{};(!J||/missing\.png$/.test(J))&&_&&!/missing\.png$/.test(_)&&(J=_,ne=!0,S&&!/missing\.png$/.test(S)&&(we=S));const be=Se(()=>ee===wt(),[ee]);V(()=>{const O=!!(w?.id&&w?.username&&w?.acct&&w?.avatar&&w?.avatarStatic&&w?.displayName&&w?.url);if(be&&o&&O){const ue=nn();let Ae=!1;ue.forEach(me=>{me.info.id===w.id&&me.instanceURL===o&&(me.info=w,Ae=!0)}),Ae&&Ht(ue)}},[be,w,o]);const ke=Mi(Y),[ze,_e]=R([]),Te=B(),xe=B([]);async function qe(O){(O||!Te.current)&&(Te.current=r.v1.accounts.$select(ee).followers.list({limit:Cs}).values());const ue=await Te.current.next();if(be||!b)return ue;const{value:Ae}=ue;let me=[];if(O){let Re=[];try{Re=await r.v1.accounts.familiarFollowers.fetch({id:[ee]})}catch{}xe.current=Re?.[0]?.accounts||[],me=[...xe.current,...Ae.filter(U=>!xe.current.some(he=>he.id===U.id))]}else Ae?.length&&(me=Ae.filter(Re=>!xe.current.some(U=>U.id===Re.id)));return{...ue,value:me}}const Ue=B();async function He(O){return(O||!Ue.current)&&(Ue.current=r.v1.accounts.$select(ee).following.list({limit:Cs}).values()),await Ue.current.next()}const We=s?"div":ve,ce=o?`/${o}/a/${ee}`:`/a/${ee}`,[Me,Ie]=R([]),[oe,Be]=R(),[Ee,Le]=R("default"),M=!!oe?.total,ge=async O=>{try{const ue=await Ir(O,h);Ie(ue[0].accounts.slice(0,Er))}catch{}},Ne=async()=>{if(ee){Le("loading");try{const O=await xr(ee,r);Be(O),Le("default")}catch{Le("error")}}},Pe=st(({relationship:O,currentID:ue})=>{O.following||(ge(ue),!s&&H>0&&Ne())},[s,ee,H]),D=st(O=>{O.id===ee&&(k(O),E.accounts[`${O.id}@${o}`]=O)},[ee,o]),re=g&&n&&/^https?:\/\//.test(n),[T,q]=R(!1),[X,ae]=R(!1);return e(N,{children:[e("div",{tabIndex:"-1",class:`account-container ${m==="loading"?"skeleton":""}`,style:{"--header-color-1":ze[0],"--header-color-2":ze[1],"--header-color-3":ze[2],"--header-color-4":ze[3]},children:[m==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(p,{id:"44hICK"})}),g?e("p",{children:re?e("a",{href:n,target:"_blank",rel:"noopener",children:n}):e("code",{class:"insignificant",children:n})}):e("p",{children:e("a",{href:Y,target:"_blank",rel:"noopener",children:[e(p,{id:"Aadw0+"})," ",e(I,{icon:"external"})]})})]}),m==="loading"?e(N,{children:[e("header",{children:e(gt,{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:[!!j&&e("div",{class:"account-moved",children:[e("p",{children:e(p,{id:"C6cVP/",values:{displayName:x},components:{0:e("b",{})}})}),e(gt,{account:j,instance:o,onClick:O=>{O.stopPropagation(),E.showAccount=j}})]}),!!J&&!/missing\.png$/.test(J)&&e("img",{src:J,alt:"",class:`header-banner ${ne?"header-is-avatar":""}`,onError:O=>{O.target.crossOrigin?O.target.src!==we?O.target.src=we:(O.target.removeAttribute("crossorigin"),O.target.src=J):O.target.src!==we?O.target.src=we:O.target.remove()},crossOrigin:"anonymous",onLoad:O=>{O.target.classList.add("loaded");try{const ue=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),Ae=ue.getContext("2d",{willReadFrequently:!0});ue.width=O.target.width,ue.height=O.target.height,Ae.imageSmoothingEnabled=!1,Ae.drawImage(O.target,0,0);const me=10,U=[Ae.getImageData(0,0,me,me).data,Ae.getImageData(O.target.width-me,0,me,me).data,Ae.getImageData(0,O.target.height-me,me,me).data,Ae.getImageData(O.target.width-me,O.target.height-me,me,me).data].map(he=>{let De=0,$e=0,nt=0,tt=0;for(let Pt=0;Pt<he.length;Pt+=4)De+=he[Pt],$e+=he[Pt+1],nt+=he[Pt+2],tt+=he[Pt+3];const _t=he.length/4;return[De/_t,$e/_t,nt/_t,tt/_t]}).map(he=>{const[De,$e,nt,tt]=Rr(he);return`rgba(${De}, ${$e}, ${nt}, ${tt})`});_e(U)}catch{}}}),e("header",{children:s?e(ft,{shift:window.matchMedia("(min-width: calc(40em))").matches?114:64,menuButton:e("div",{children:e(gt,{account:w,instance:o,avatarSize:"xxxl",onClick:()=>{}})}),children:[e("div",{class:"szh-menu__header",children:e(or,{acct:v,instance:o})}),e(ye,{onClick:()=>{const O=v.includes("@")?`@${v}`:`@${v}@${o}`;try{navigator.clipboard.writeText(O),de(d({id:"zJoEwS"}))}catch{de(d({id:"BC0lSD"}))}},children:[e(I,{icon:"link"}),e("span",{children:e(p,{id:"27x6gl"})})]}),e(ye,{onClick:()=>{E.showQrCodeModal={text:Y,arena:S,backgroundMask:we,caption:v.includes("@")?v:`${v}@${o}`,onScannerClick:Ii}},children:[e(I,{icon:"qrcode"}),e("span",{children:e(p,{id:"gCX4Z9"})})]}),e(ye,{href:Y,target:"_blank",children:[e(I,{icon:"external"}),e("span",{children:e(p,{id:"Bz5hLl"})})]}),e(Ve,{}),e(ye,{onClick:()=>{E.showMediaModal={mediaAttachments:[{type:"image",url:S}]}},children:[e(I,{icon:"user"}),e("span",{children:e(p,{id:"7WYl2I"})})]}),!!we&&!ne&&e(ye,{onClick:()=>{E.showMediaModal={mediaAttachments:[{type:"image",url:we}]}},children:[e(I,{icon:"media"}),e("span",{children:e(p,{id:"ZNme5R"})})]}),l&&be&&Qe("@mastodon/profile-edit")&&e(N,{children:[e(Ve,{}),e(ye,{onClick:()=>{q(!0)},children:[e(I,{icon:"pencil"}),e("span",{children:e(p,{id:"9OpVZg"})})]})]})]}):e(gt,{account:w,instance:o,avatarSize:"xxxl",internal:!0})}),e("div",{class:"faux-header-bg","aria-hidden":"true"}),e("main",{children:[!!Q&&e("span",{class:"tag",children:e(p,{id:"prdIOK"})}),!!A&&e("span",{class:"tag",children:[e(I,{icon:"bot"})," ",e(p,{id:"9Vdq+j"})]}),!!K&&e("span",{class:"tag",children:[e(I,{icon:"group"})," ",e(p,{id:"L8fEEm"})]}),e("div",{class:"note",dir:"auto",onClick:fo({instance:f}),dangerouslySetInnerHTML:{__html:ki(W,{emojis:L})}}),e("div",{class:"account-metadata-box",children:[P?.length>0&&e("div",{class:"profile-metadata",children:P.map(({name:O,value:ue,verifiedAt:Ae},me)=>e("div",{class:`profile-field ${Ae?"profile-verified":""}`,dir:"auto",children:[e("b",{children:[e(po,{text:O,emojis:L})," ",!!Ae&&e(I,{icon:"check-circle",size:"s",alt:d({id:"QDEWii"})})]}),e("p",{dangerouslySetInnerHTML:{__html:ki(ue,{emojis:L})}})]},O+me))}),e("div",{class:"stats",children:[e(We,{tabIndex:0,to:ce,onClick:()=>{setTimeout(()=>{E.showGenericAccounts={id:"followers",heading:d({id:"x5LEuB"}),fetchAccounts:qe,instance:o,excludeRelationshipAttrs:be?["followedBy"]:[],blankCopy:le?d({id:"BRV/wh"}):void 0}},0)},children:[!!Me.length&&e("span",{class:"shazam-container-horizontal",children:e("span",{class:"shazam-container-inner stats-avatars-bunch",children:Me.map(O=>e(ut,{url:O.avatarStatic,size:"s",alt:`${O.displayName} @${O.acct}`,squircle:O?.bot}))})}),e(p,{id:"TbttfX",values:{0:Xe(F),1:Xe(F),followersCount:F},components:{0:e("span",{title:F}),1:e("span",{title:F})}})]}),e(We,{class:"insignificant",tabIndex:0,to:ce,onClick:()=>{setTimeout(()=>{E.showGenericAccounts={heading:d({id:"following.stats"}),fetchAccounts:He,instance:o,excludeRelationshipAttrs:be?["following"]:[],blankCopy:le?d({id:"BRV/wh"}):void 0}},0)},children:[e(p,{id:"SGcIK+",values:{0:Xe(z),followingCount:z},components:{0:e("span",{title:z})}}),e("br",{})]}),e(We,{class:"insignificant",to:ce,children:e(p,{id:"C4x3+X",values:{0:Xe(H),1:Xe(H),statusesCount:H},components:{0:e("span",{title:H}),1:e("span",{title:H})}})}),!!C&&e("div",{class:"insignificant",children:e(p,{id:"PCcEFZ",values:{0:at(C,{hideTime:!0})},components:{0:e("time",{datetime:C})}})})]})]}),!!oe&&e(We,{to:ce,class:"account-metadata-box",onClick:void 0,children:e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:M?e("div",{class:"posting-stats",title:Vt()?d({id:"CKHUZ2",values:{0:(oe.originals/oe.total).toLocaleString(u.locale||void 0,{style:"percent"}),1:(oe.replies/oe.total).toLocaleString(u.locale||void 0,{style:"percent"}),2:(oe.quotes/oe.total).toLocaleString(u.locale||void 0,{style:"percent"}),3:(oe.boosts/oe.total).toLocaleString(u.locale||void 0,{style:"percent"})}}):d({id:"wiuWLe",values:{0:(oe.originals/oe.total).toLocaleString(u.locale||void 0,{style:"percent"}),1:(oe.replies/oe.total).toLocaleString(u.locale||void 0,{style:"percent"}),2:(oe.boosts/oe.total).toLocaleString(u.locale||void 0,{style:"percent"})}}),children:[e("div",{children:oe.daysSinceLastPost<365?pe._({id:"oZUtTk",values:{0:oe.total,1:oe.daysSinceLastPost,2:oe.daysSinceLastPost,3:oe.daysSinceLastPost,4:oe.total,5:oe.total,6:oe.daysSinceLastPost}}):pe._({id:"JvA7Mo",values:{0:oe.total,1:oe.total}})}),e("div",{class:"posting-stats-bar",children:[oe.originals>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-originals",style:{"--percentage":`${oe.originals/oe.total*100}%`}}),oe.replies>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-replies",style:{"--percentage":`${oe.replies/oe.total*100}%`}}),oe.quotes>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-quotes",style:{"--percentage":`${oe.quotes/oe.total*100}%`}}),oe.boosts>0&&e("div",{class:"posting-stats-bar-section posting-stats-bar-boosts",style:{"--percentage":`${oe.boosts/oe.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"})})})})}),!j&&e("div",{class:"account-metadata-box",children:e("div",{class:"shazam-container no-animation",hidden:!!oe,children:e("div",{class:"shazam-container-inner",children:e("button",{type:"button",class:"posting-stats-button",disabled:Ee==="loading",onClick:()=>{Ne()},children:[e("div",{class:`posting-stats-icon ${Ee==="loading"?"loading":""}`}),e(p,{id:"PjP87f"})," "]})})})})]}),e("footer",{children:e(Sr,{info:w,instance:o,standalone:s,authenticated:c,onRelationshipChange:Pe,onProfileUpdate:D,setShowEditProfile:q,showEndorsements:a,renderEndorsements:X,setRenderEndorsements:ae})}),e(dr,{accountID:ee,info:w,open:X,onlyOpenIfHasEndorsements:X==="onlyOpenIfHasEndorsements"})]})]}),!!T&&e(Fe,{onClose:()=>{q(!1)},children:e(rr,{onClose:({state:O,account:ue}={})=>{q(!1),O==="success"&&ue&&D(ue)}})})]})}const Er=3;function Rr([n,i,s]){const o=.2126*n+.7152*i+.0722*s;let c;return o>=220?c=1:o<=50?c=.1:c=o/255,c=Math.min(1,c),[n,i,s,c]}function Lr({account:n,instance:i,onClose:s}){const{_:o}=ie(),{masto:c,instance:a,authenticated:u}=se({instance:i}),d=typeof n=="string";return V(()=>{d||(E.accounts[`${n.id}@${a}`]=n)},[n]),To(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(Mo,{instance:a,authenticated:u,account:n,fetchAccount:async()=>{if(d)try{return await c.v1.accounts.lookup({acct:n,skip_webfinger:!1})}catch{const l=await c.v2.search.list({q:n,type:"accounts",limit:u?1:11,resolve:u});if(l.accounts.length){const h=l.accounts.find(f=>f.url===n||n.startsWith(f.url));if(h)return h}if(/^https?:\/\/[^/]+\/@[^/]+$/.test(n)){const h=URL.parse(n);if(h){const{hostname:f,pathname:m}=h,y=m.replace(/^\//,"").replace(/\/$/,"")+"@"+f,g=await c.v2.search.list({q:y,type:"accounts",limit:1,resolve:u});if(g.accounts.length)return g.accounts[0]}}}else return n}})]})}function $r({onClose:n}){const{_:i}=ie(),{masto:s}=se(),[o,c]=R("default"),[a,u]=R([]),[d,r]=$t(h=>h+1,0);V(()=>{c("loading"),(async()=>{try{const h=await bt.drafts.keys();if(h.length){const f=Kn(),m=h.filter(y=>y.startsWith(f));if(m.length){const y=await bt.drafts.getMany(m);y.sort((g,w)=>Date.parse(w.updatedAt)-Date.parse(g.updatedAt)),u(y)}else u([])}else u([]);c("default")}catch{c("error")}})()},[d]);const l=a?.length>0;return e("div",{class:"sheet",children:[!!n&&e("button",{type:"button",class:"sheet-close",onClick:n,children:e(I,{icon:"x",alt:i({id:"yz7wBu"})})}),e("header",{children:[e("h2",{children:[e(p,{id:"krk5ws"})," ",e(Oe,{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:a.map(h=>{const{updatedAt:f,key:m,draftStatus:y,replyTo:g,quote:w}=h,k=new Date(f);return e("li",{children:[e("div",{class:"mini-draft-meta",children:[e("b",{children:[e(I,{icon:g?"reply":"quill",size:"s"})," ",e("time",{children:[!!g&&e(N,{children:[e("span",{class:"bidi-isolate",children:["@",g.account.acct]}),e("br",{})]}),at(k)]})]}),e(vt,{confirmLabel:e("span",{children:e(p,{id:"/W5yFF"})}),menuItemClassName:"danger",align:"end",disabled:o==="loading",onClick:()=>{(async()=>{try{await bt.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(g?.id||w?.id){if(c("loading"),g)try{b=await s.v1.statuses.$select(g.id).fetch()}catch{alert(i({id:"tMwimH"})),c("default");return}if(w)try{v=await s.v1.statuses.$select(w.id).fetch()}catch{alert(i({id:"2oZ4Iw"})),c("default")}c("default")}window.__COMPOSE__={draftStatus:y,replyToStatus:b,quoteStatus:v},E.showCompose=!0,E.showDrafts=!1},children:e(Mr,{draft:h})})]},f)})}),a.length>1&&e("p",{children:e(vt,{confirmLabel:e("span",{children:e(p,{id:"3IakFR"})}),menuItemClassName:"danger",disabled:o==="loading",onClick:()=>{(async()=>{c("loading");try{await bt.drafts.delMany(a.map(h=>h.key)),c("default"),r()}catch{alert(i({id:"0J4sZq"})),c("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 Mr({draft:n}){const{_:i}=ie(),{draftStatus:s,replyTo:o,quote:c}=n,{status:a,spoilerText:u,poll:d,mediaAttachments:r}=s,l=d?.options?.length>0,h=r?.length>0,f=!!c?.id,m=l||h||f,y=Se(()=>{if(!h)return;const g=r.find(b=>/image/.test(b.type));if(!g)return;const{file:w}=g;return URL.createObjectURL(w)},[h,r]);return e(N,{children:e("div",{class:"mini-draft",children:[m&&e("div",{class:`mini-draft-aside ${y?"has-image":""}`,style:y?{"--bg-image":`url(${y})`}:{},children:[l&&e(I,{icon:"poll",alt:i({id:"4WUbF1"})}),h&&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:[!!u&&e("div",{class:"mini-draft-spoiler",children:u}),!!a&&e("div",{class:"mini-draft-status",children:a})]})]})})}function Pr({html:n,url:i,width:s,height:o,onClose:c=()=>{}}){const{_:a}=ie();return e("div",{class:"embed-modal-container",children:[e("div",{class:"top-controls",children:[e("button",{type:"button",class:"light",onClick:()=>c(),children:e(I,{icon:"x",alt:a({id:"yz7wBu"})})}),i&&e("a",{href:i,target:"_blank",rel:"noopener",class:"button plain",children:[e("span",{children:e(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 Dr({instance:n,excludeRelationshipAttrs:i=[],postID:s,onClose:o=()=>{},blankCopy:c}){const{_:a}=ie(),{masto:u,instance:d}=se(),r=n?n===d:!0,l=Ge(E),[h,f]=R("default"),[m,y]=R(!1);if(To(o),!l.showGenericAccounts)return null;const{id:g,heading:w,fetchAccounts:k,accounts:b,showReactions:v}=l.showGenericAccounts,[_,S]=R(b?.length?b:[]),[A,C]=R({}),x=async z=>{if(!z?.length||!r)return;const K=await ni(z,A);K&&C({...A,...K})},L=z=>{k&&(z&&!_?.length&&S([]),f("loading"),(async()=>{try{const{done:K,value:ee}=await k(z);if(Array.isArray(ee)){if(z){const te=[];for(let G=0;G<ee.length;G++){const W=ee[G],H=te.find((Y,$)=>Y.id===W.id&&G!==$);H?H._types.push(...W._types):te.push({_types:[],...W})}S(te)}else S(te=>{const G=te;for(const W of ee){const H=G.find(Y=>Y.id===W.id);H?H._types.push(...W._types):G.push(W)}return G});y(!K),x(ee)}else y(!1);f("default")}catch{f("error")}})())},P=B(!0);V(()=>{_?.length>0?k?(L(!0),P.current=!1):x(_):(L(!0),P.current=!1)},[k]),V(()=>{P.current||l.reloadGenericAccounts?.id===g&&L(!0)},[l.reloadGenericAccounts.counter]);const F=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:a({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:w||a({id:"bPwFdf"})})}),e("main",{children:[F&&e(ve,{to:`/${n||d}/s/${F.id}`,class:"post-preview",children:e(je,{status:F,size:"s",readOnly:!0})}),_.length>0?e(N,{children:[e("ul",{class:"accounts-list",children:_.map(z=>{const K=A[z.id],ee=`${z.id}-${z._types?.length||""}`;return e("li",{children:[v&&z._types?.length>0&&e("div",{class:"reactions-block",children:z._types.map(te=>e(I,{icon:{reblog:"rocket",favourite:"heart"}[te],class:`${te}-icon`}))}),e("div",{class:"account-relationships",children:e(gt,{account:z,showStats:!0,relationship:K,excludeRelationshipAttrs:i})})]},ee)})}),h==="default"?m?e(Lt,{onChange:z=>{z&&L()},children:e("button",{type:"button",class:"plain block",onClick:()=>L(),children:e(p,{id:"uXRAkV"})})}):e("p",{class:"ui-state insignificant",children:e(p,{id:"2EYeAZ"})}):h==="loading"&&e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})})]}):h==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):h==="error"?e("p",{class:"ui-state",children:e(p,{id:"AThL/k"})}):e("p",{class:"ui-state insignificant",children:c||a({id:"10OlfF"})})]})]})}function Nr({accounts:n,onClose:i}){const{_:s}=ie(),o=nn(),{accountsToImport:c}=Se(()=>{if(!n)return{accountsToImport:[]};const f={duplicate:0,new:1};return{accountsToImport:n.map(y=>{const w=o.find(k=>k.info.id===y.info.id&&k.instanceURL===y.instanceURL)?"duplicate":"new";return{...y,__status:w}}).sort((y,g)=>f[y.__status]-f[g.__status])}},[n,o]),[a,u]=R(()=>{const f={};return c.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=>a[m.info.id+m.instanceURL])];Ht(f),i(),E.showImportExportAccounts=!1,E.showAccounts=!0},h=Object.values(a).filter(Boolean).length;return e("div",{id:"import-accounts-selection-container",class:"sheet",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,disabled: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:[c.filter(f=>f.__status!=="duplicate").length>3&&e("div",{class:"accounts-list-header",children:e("label",{class:"account-item",children:[e("input",{type:"checkbox",checked:c.filter(f=>f.__status!=="duplicate").length>0&&c.filter(f=>f.__status!=="duplicate").every(f=>a[f.info.id+f.instanceURL]),onChange:f=>{const m={...a},y=f.target.checked;c.forEach(g=>{g.__status!=="duplicate"&&(m[g.info.id+g.instanceURL]=y)}),u(m)},disabled:d==="importing"}),e("span",{class:"account-info",children:e(p,{id:"wgNoIs"})})]})}),e("ul",{class:"accounts-list",children:c.map(f=>{const m=f.info.id+f.instanceURL,y=a[m],{__status:g}=f;return e("li",{children:e("label",{class:"account-item",children:[e("input",{type:"checkbox",checked:y,onChange:w=>{u({...a,[m]:w.target.checked})},disabled:d==="importing"||g==="duplicate"}),e(ut,{url:f.info.avatarStatic,size:"xl"}),e("div",{class:"account-info",children:e(mt,{account:{...f.info,acct:/@/.test(f.info.acct)?f.info.acct:`${f.info.acct}@${f.instanceURL}`},showAcct:!0})}),e("div",{class:"account-meta",children:g==="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(Oe,{hidden:d!=="importing"}),e("button",{type:"button",disabled:h===0||d==="importing",onClick:l,children:e(p,{id:"0mebiX",values:{selectedCount:h}})})]})]})})]})}function Or({onClose:n}){const{_:i}=ie(),s=nn(),[o,c]=R("default"),[a,u]=R(null),[d,r]=R(!1),l=async()=>{c("exporting");try{const b={accounts:nn().map(L=>{const{accessToken:P,...F}=L;return F}),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{de(i({id:"lpYill"})),c("error")}},h=async w=>{if(w){c("importing");try{const k=await w.text(),v=JSON.parse(k)?.accounts;if(!Array.isArray(v))throw new Error("Invalid backup file");u(v),c("default")}catch{de(i({id:"BEVzjL"})),c("error")}}},f=w=>{const k=w.target.files[0];h(k)};return e("div",{id:"import-export-accounts-container",class:"sheet",onDragOver:w=>{w.preventDefault(),r(!0)},onDragLeave:()=>{r(!1)},onDrop:w=>{w.preventDefault(),r(!1);const k=w.dataTransfer.files[0];h(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"})})})]}),a&&e(Fe,{onClose:()=>{u(null)},children:e(Nr,{accounts:a,onClose:()=>{u(null)}})})]})}const zr=140;function qr({alt:n,lang:i,onClose:s}){const{_:o}=ie(),c=Ge(E),[a,u]=R(!1),d=uo(!0),r=c.settings.contentTranslationHideLanguages||[],l=!!i&&i!==d&&!Hn([i],[d])&&!r.find(h=>i===h||Hn([i],[h]));return V(()=>{const h=n?.length>0&&n?.length<=zr;l&&h&&u(!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(ye,{disabled:a,onClick:()=>{u(!0)},children:[e(I,{icon:"translate"}),e("span",{children:e(p,{id:"pi8x/S"})})]}),Vc&&e(ye,{onClick:()=>{Gc(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||a)&&e(ho,{forceTranslate:a,sourceLanguage:i,text:n})]})]})}const{min:Ih,max:Ah}=Math;const Po={};for(let n of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Po[`[object ${n}]`]=n.toLowerCase();function Fr(n){return Po[Object.prototype.toString.call(n)]||"object"}const rn=(n,i=null)=>n.length>=3?Array.prototype.slice.call(n):Fr(n[0])=="object"&&i?i.split("").filter(s=>n[0][s]!==void 0).map(s=>n[0][s]):n[0].slice(0);const{PI:ai,min:xh,max:Th}=Math;const Eh=ai*2,Rh=ai/3,Ur=ai/180,Br=180/ai;function Vn(n,i){let s=n.length;Array.isArray(n[0])||(n=[n]),Array.isArray(i[0])||(i=i.map(u=>[u]));let o=i[0].length,c=i[0].map((u,d)=>i.map(r=>r[d])),a=n.map(u=>c.map(d=>Array.isArray(u)?u.reduce((r,l,h)=>r+l*(d[h]||0),0):d.reduce((r,l)=>r+l*u,0)));return s===1&&(a=a[0]),o===1?a.map(u=>u[0]):a}const Do={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 pi=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},Kr=(n,i,s)=>{const{MtxAdaptMa:o,MtxAdaptMaI:c,MtxXYZ2RGB:a,RefWhiteRGB:u,Xn:d,Yn:r,Zn:l}=Do,h=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,y=u.X*o.m00+u.Y*o.m10+u.Z*o.m20,g=u.X*o.m01+u.Y*o.m11+u.Z*o.m21,w=u.X*o.m02+u.Y*o.m12+u.Z*o.m22,k=(n*o.m00+i*o.m10+s*o.m20)*(y/h),b=(n*o.m01+i*o.m11+s*o.m21)*(g/f),v=(n*o.m02+i*o.m12+s*o.m22)*(w/m),_=k*c.m00+b*c.m10+v*c.m20,S=k*c.m01+b*c.m11+v*c.m21,A=k*c.m02+b*c.m12+v*c.m22,C=pi(_*a.m00+S*a.m10+A*a.m20),x=pi(_*a.m01+S*a.m11+A*a.m21),L=pi(_*a.m02+S*a.m12+A*a.m22);return[C*255,x*255,L*255]},ts=(...n)=>{n=rn(n,"lab");const[i,s,o,...c]=n,[a,u,d]=Hr([i,s,o]),[r,l,h]=Kr(a,u,d);return[r,l,h,...c.length>0&&c[0]<1?[c[0]]:[]]};function Hr(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=Vn(s,n);return Vn(i,o.map(c=>c**3))}function mi(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 jr=(n,i,s)=>{n=mi(n/255),i=mi(i/255),s=mi(s/255);const{MtxRGB2XYZ:o,MtxAdaptMa:c,MtxAdaptMaI:a,Xn:u,Yn:d,Zn:r,As:l,Bs:h,Cs:f}=Do;let m=n*o.m00+i*o.m10+s*o.m20,y=n*o.m01+i*o.m11+s*o.m21,g=n*o.m02+i*o.m12+s*o.m22;const w=u*c.m00+d*c.m10+r*c.m20,k=u*c.m01+d*c.m11+r*c.m21,b=u*c.m02+d*c.m12+r*c.m22;let v=m*c.m00+y*c.m10+g*c.m20,_=m*c.m01+y*c.m11+g*c.m21,S=m*c.m02+y*c.m12+g*c.m22;return v*=w/l,_*=k/h,S*=b/f,m=v*a.m00+_*a.m10+S*a.m20,y=v*a.m01+_*a.m11+S*a.m21,g=v*a.m02+_*a.m12+S*a.m22,[m,y,g]},ns=(...n)=>{const[i,s,o,...c]=rn(n,"rgb"),a=jr(i,s,o);return[...Yr(a),...c.length>0&&c[0]<1?[c[0]]:[]]};function Yr(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=Vn(i,n);return Vn(s,o.map(c=>Math.cbrt(c)))}const{sin:Vr,cos:Gr}=Math,Wr=(...n)=>{let[i,s,o]=rn(n,"lch");return isNaN(o)&&(o=0),o=o*Ur,[i,Gr(o)*s,Vr(o)*s]},gi=(...n)=>{n=rn(n,"lch");const[i,s,o,...c]=n,[a,u,d]=Wr(i,s,o),[r,l,h]=ts(a,u,d);return[r,l,h,...c.length>0&&c[0]<1?[c[0]]:[]]},{sqrt:Zr,atan2:Xr,round:Qr}=Math,Jr=(...n)=>{const[i,s,o]=rn(n,"lab"),c=Zr(s*s+o*o);let a=(Xr(o,s)*Br+360)%360;return Qr(c*1e4)===0&&(a=Number.NaN),[i,c,a]},el=(...n)=>{const[i,s,o,...c]=rn(n,"rgb"),[a,u,d]=ns(i,s,o),[r,l,h]=Jr(a,u,d);return[r,l,h,...c.length>0&&c[0]<1?[c[0]]:[]]},tl={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_IMG_ALT_API_URL:Lh}=tl;function No({mediaAttachments:n,statusID:i,instance:s,lang:o,index:c=0,onClose:a=()=>{}}){const{_:u}=ie(),[d,r]=R("default"),l=B(null),[h,f]=R(c),m=B(null);kt(()=>{m.current?.scrollIntoView()},[]);const y=B(i);V(()=>{const S=c*l.current.clientWidth,A=y.current!==i;A&&(y.current=i),l.current.focus(),l.current.scrollTo({left:S*(jt()?-1:1),behavior:A?"auto":"smooth"})},[c,i]);const[g,w]=R(!0);V(()=>{let S=A=>{a(A,h,n,l)};return l.current&&l.current.addEventListener("swiped-down",S),()=>{l.current&&l.current.removeEventListener("swiped-down",S)}},[h,n]),Ke("esc",S=>{a(S,h,n,l)},{ignoreEventWhen:S=>!!document.querySelector("#modal-container > *")||S.metaKey||S.ctrlKey||S.altKey||S.shiftKey,useKey:!0},[a,h,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=Se(()=>n?.map(S=>{const{blurhash:A}=S;if(A){const C=Bi(A);return el(C)}return null}),[n]),b=Se(()=>k?.map(S=>S?{light:gi([.95,.01,S[2]]),dark:gi([.35,.01,S[2]]),default:gi([.6,S[1],S[2]])}:null)),v=Se(()=>{const A=100/b.length,C=b.map((P,F)=>{const z=F*A+5,K=(F+1)*A-5;return P?.light&&P?.dark?{light:`
|
||
rgb(${P.light?.join(",")}) ${z}%,
|
||
rgb(${P.light?.join(",")}) ${K}%
|
||
`,dark:`
|
||
rgb(${P.dark?.join(",")}) ${z}%,
|
||
rgb(${P.dark?.join(",")}) ${K}%
|
||
`}:{light:`
|
||
transparent ${z}%,
|
||
transparent ${K}%
|
||
`,dark:`
|
||
transparent ${z}%,
|
||
transparent ${K}%
|
||
`}}),x=C.map(P=>P.light).join(", "),L=C.map(P=>P.dark).join(", ");return{light:x,dark:L}},[b]);let _=B(null);return V(()=>()=>{_.current?.hideToast?.()},[]),kt(()=>{const S=b[h];let A,C;if(S){const x=Ce.local.get("theme");if(x){const L=`rgb(${S[x].join(",")})`;A=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),A&&(C=A.content,A.content=L),document.documentElement.style.setProperty("--meta-theme-color",L)}else{const L=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",P=`rgb(${S[L].join(",")})`;A=document.querySelector(`meta[name="theme-color"][media*="${L}"]`),A&&(C=A.content,A.content=P),document.documentElement.style.setProperty("--meta-theme-color",P)}}return()=>{A&&C&&(A.content=C),document.documentElement.style.removeProperty("--meta-theme-color")}},[h,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"))&&a(S,h,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===h?m:null,onClick:x=>{x.target.classList.contains("media")||w(!g)},children:[!!S.description&&e("button",{type:"button",class:"media-alt",hidden:!g,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(mo,{media:S,showOriginal:!0,lang:o})]},S.id)})}),e("div",{class:"carousel-top-controls",hidden:!g,children:[e("span",{children:e("button",{type:"button",class:"carousel-button",onClick:S=>a(S,h,n,l),children:e(I,{icon:"x",alt:u({id:"yz7wBu"})})})}),n?.length>1?e("span",{class:"carousel-dots",children:n?.map((S,A)=>e("button",{type:"button",disabled:A===h,class:`carousel-dot ${A===h?"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:u({id:"2FYpfJ"})})}),children:[e(Ye,{href:n[h]?.remoteUrl||n[h]?.url,class:"carousel-button",target:"_blank",title:u({id:"5hXGws"}),children:[e(I,{icon:"popout"}),e("span",{children:e(p,{id:"aDr7Vc"})})]}),!1]})," ",!!i&&e(ve,{to:`${s?`/${s}`:""}/s/${i}${window.matchMedia("(min-width: calc(40em + 350px))").matches?`?media=${h+1}`:""}`,class:"button carousel-button media-post-link",children:[e("span",{class:"button-label",children:[e(p,{id:"ISg5SQ"})," "]}),"»"]})]})]}),n?.length>1&&e("div",{class:"carousel-controls",hidden:!g,children:[e("button",{type:"button",class:"carousel-button",hidden:h===0,onClick:S=>{S.preventDefault(),S.stopPropagation(),l.current.focus(),l.current.scrollTo({left:l.current.clientWidth*(h-1)*(jt()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-left",alt:u({id:"DHhJ7s"})})}),e("button",{type:"button",class:"carousel-button",hidden:h===n.length-1,onClick:S=>{S.preventDefault(),S.stopPropagation(),l.current.focus(),l.current.scrollTo({left:l.current.clientWidth*(h+1)*(jt()?-1:1),behavior:"smooth"})},children:e(I,{icon:"arrow-right",alt:u({id:"hXzOVo"})})})]})]})}function nl({url:n,linkText:i,onClose:s}){const{_:o}=ie();if(!n)return null;let c=n;try{const d=URL.parse(n),r=d.protocol,l=d.hostname,h=n.slice(d.origin.length);c=e(N,{children:[r,"//",e("strong",{children:l}),h]})}catch{}const a=()=>{try{navigator.clipboard.writeText(n),de(o({id:"edWbV6"}))}catch{de(o({id:"W1ewR0"}))}},u=()=>{if(navigator.share&&navigator.canShare({url:n}))try{navigator.share({url:n})}catch{}};return e("div",{class:"sheet sheet-modal",id:"open-link-sheet",tabindex:"-1",children:[!!s&&e("button",{type:"button",class:"sheet-close",onClick:s,children:e(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:c})]}),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:a,children:e(I,{icon:"copy",alt:o({id:"he3ygx"})})}),navigator.canShare&&navigator.canShare({url:n})&&e("button",{type:"button",class:"plain6",onClick:u,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 Gn=5,il=3,Wn=11,Oo=40,sl=5,ol=10,ln={newline:10,reset:27};function cl(n){if(!Number.isSafeInteger(n))throw new Error(`integer expected: ${n}`)}function zo(n){if(!Number.isSafeInteger(n)||n<1||n>40)throw new Error(`Invalid version=${n}. Expected number [1..40]`)}function Nt(n,i){return n.toString(2).padStart(i,"0")}function _s(n,i){const s=n%i;return s>=0?s:i+s}function lt(n,i){return new Array(n).fill(i)}function Is(n){let i=0,s=0;for(const a of n)i=Math.max(i,a.length),s+=a.length;const o=new Uint8Array(s);let c=0;for(let a=0;a<i;a++)for(const u of n)a<u.length&&(o[c++]=u[a]);return o}function qo(){let n,i=1/0;return{add(s,o){s>=i||(n=o,i=s)},get:()=>n,score:()=>i}}function As(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(cl(s),s<0||s>=n.length)throw new Error(`Digit index outside alphabet: ${s} (alphabet: ${n.length})`);return n[s]})}}}class pt{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,c=new Array(o);let a;for(const u of s){const d=u.split("").map(r=>{if(r==="X")return!0;if(r===" ")return!1;if(r!=="?")throw new Error(`Bitmap.fromString: unknown symbol=${r}`)});if(a&&d.length!==a)throw new Error(`Bitmap.fromString different row sizes: width=${a} cur=${d.length}`);a=d.length,c.push(d)}return a||(a=0),new pt({height:o,width:a},c)}data;height;width;constructor(i,s){const{height:o,width:c}=pt.size(i);this.data=s||Array.from({length:o},()=>lt(c,void 0)),this.height=o,this.width=c}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=_s(i.x,this.width),i.y=_s(i.y,this.height),i}rect(i,s,o){const{x:c,y:a}=this.xy(i),{height:u,width:d}=pt.size(s,this.size({x:c,y:a}));for(let r=0;r<u;r++)for(let l=0;l<d;l++)this.data[a+r][c+l]=typeof o=="function"?o({x:l,y:r},this.data[a+r][c+l]):o;return this}rectRead(i,s,o){return this.rect(i,s,(c,a)=>(o(c,a),a))}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,c=this.width+2*i,a=lt(i,s),u=Array.from({length:i},()=>lt(c,s));return new pt({height:o,width:c},[...u,...this.data.map(d=>[...a,...d,...a]),...u])}embed(i,s){return this.rect(i,s.size(),({x:o,y:c})=>s.data[c][o])}rectSlice(i,s=this.size()){const o=new pt(pt.size(s,this.size(this.xy(i))));return this.rect(i,s,({x:c,y:a},u)=>o.data[a][c]=u),o}inverse(){const{height:i,width:s}=this;return new pt({height:s,width:i}).rect({x:0,y:0},1/0,({x:c,y:a})=>this.data[c][a])}scale(i){if(!Number.isSafeInteger(i)||i>1024)throw new Error(`invalid scale factor: ${i}`);const{height:s,width:o}=this;return new pt({height:i*s,width:i*o}).rect({x:0,y:0},1/0,({x:a,y:u})=>this.data[Math.floor(u/i)][Math.floor(a/i)])}clone(){return new pt(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 c="";for(let a=0;a<i;a+=2){for(let u=0;u<s;u++){const d=o[a][u],r=a+1>=i?!0:o[a+1][u];!d&&!r?c+="█":!d&&r?c+="▀":d&&!r?c+="▄":d&&r&&(c+=" ")}c+=String.fromCharCode(ln.newline)}return c}toTerm(){const i=String.fromCharCode(ln.reset),s=i+"[0m",o=i+"[1;47m "+s,c=i+"[40m "+s;return this.data.map(a=>a.map(u=>u?c: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="",c;return this.rectRead(0,1/0,(a,u)=>{if(!u)return;const{x:d,y:r}=a;if(!i){s+=`<rect x="${d}" y="${r}" width="1" height="1" />`;return}let l=`M${d} ${r}`;if(c){const f=`m${d-c.x} ${r-c.y}`;f.length<=l.length&&(l=f)}const h=d<10?`H${d}`:"h-1";o+=`${l}h1v1${h}Z`,c=a}),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 c=126,a=[71,73,70,56,55,97,...s,246,0,0,255,255,255,...lt(381,0),44,0,0,0,0,...s,0,7],u=Math.floor(o.length/c);for(let d=0;d<u;d++)a.push(c+1,128,...o.slice(c*d,c*(d+1)).map(r=>+r));return a.push(o.length%c+1,128,...o.slice(u*c).map(d=>+d)),a.push(1,129,0,59),new Uint8Array(a)}toImage(i=!1){const{height:s,width:o}=this.size(),c=new Uint8Array(s*o*(i?3:4));let a=0;for(let u=0;u<s;u++)for(let d=0;d<o;d++){const r=this.data[u][d]?0:255;c[a++]=r,c[a++]=r,c[a++]=r,i||(c[a++]=255)}return{height:s,width:o,data:c}}}const xs=["low","medium","quartile","high"],Ts=["numeric","alphanumeric","byte","kanji","eci"],al=[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],rl={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]},ll={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]},it={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=it.size.encode(n)-i-1,o=s-i,c=Math.ceil(o/28);let a=Math.floor(o/c);a%2?a+=1:o%c*2>=c&&(a+=2);const u=[i];for(let d=1;d<c;d++)u.push(s-(c-d)*a);return u.push(s),u},ECCode:{low:1,medium:0,quartile:3,high:2},formatMask:21522,formatBits(n,i){const s=it.ECCode[n]<<3|i;let o=s;for(let c=0;c<10;c++)o=o<<1^(o>>9)*1335;return(s<<10|o)^it.formatMask},versionBits(n){let i=n;for(let s=0;s<12;s++)i=i<<1^(i>>11)*7973;return n<<12|i},alphabet:{numeric:As("0123456789"),alphanumerc:As("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:")},lengthBits(n,i){return{numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]}[i][it.sizeType(n)]},modeBits:{numeric:"0001",alphanumeric:"0010",byte:"0100",kanji:"1000",eci:"0111"},capacity(n,i){const s=al[n-1],o=rl[i][n-1],c=ll[i][n-1],a=Math.floor(s/c)-o,u=c-s%c;return{words:o,numBlocks:c,shortBlocks:u,blockLen:a,capacity:(s-o*c)*8,total:(o+a)*c+c-u}}},is=[(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],fe={tables:(n=>{const i=lt(256,0),s=lt(256,0);for(let o=0,c=1;o<256;o++)i[o]=c,s[c]=o,c<<=1,c&256&&(c^=n);return{exp:i,log:s}})(285),exp:n=>fe.tables.exp[n],log(n){if(n===0)throw new Error(`GF.log: invalid arg=${n}`);return fe.tables.log[n]%255},mul(n,i){return n===0||i===0?0:fe.tables.exp[(fe.tables.log[n]+fe.tables.log[i])%255]},add:(n,i)=>n^i,pow:(n,i)=>fe.tables.exp[fe.tables.log[n]*i%255],inv(n){if(n===0)throw new Error(`GF.inverse: invalid arg=${n}`);return fe.tables.exp[255-fe.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,fe.polynomial(s)},degree:n=>n.length-1,coefficient:(n,i)=>n[fe.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 c=0;c<i.length;c++)s[o+c]=fe.add(s[o+c],fe.mul(n[o],i[c]));return fe.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]=fe.mul(n[o],i);return fe.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 c=0;c<n.length;c++)o[c]=fe.mul(n[c],s);return fe.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 c=lt(o.length,0),a=o.length-s.length,u=o.slice(0,a);for(let d=0;d<u.length;d++)c[d]=u[d];for(let d=a;d<o.length;d++)c[d]=fe.add(s[d-a],o[d]);return fe.polynomial(c)},remainderPoly(n,i){const s=Array.from(n);for(let o=0;o<n.length-i.length+1;o++){const c=s[o];if(c!==0)for(let a=1;a<i.length;a++)i[a]!==0&&(s[o+a]=fe.add(s[o+a],fe.mul(i[a],c)))}return s.slice(n.length-i.length+1,s.length)},divisorPoly(n){let i=[1];for(let s=0;s<n;s++)i=fe.mulPoly(i,[1,fe.pow(2,s)]);return i},evalPoly(n,i){if(i==0)return fe.coefficient(n,0);let s=n[0];for(let o=1;o<n.length;o++)s=fe.add(fe.mul(i,s),n[o]);return s},euclidian(n,i,s){fe.degree(n)<fe.degree(i)&&([n,i]=[i,n]);let o=n,c=i,a=[0],u=[1];for(;2*fe.degree(c)>=s;){let l=o,h=a;if(o=c,a=u,o[0]===0)throw new Error("rLast[0] === 0");c=l;let f=[0];const m=fe.inv(o[0]);for(;fe.degree(c)>=fe.degree(o)&&c[0]!==0;){const y=fe.degree(c)-fe.degree(o),g=fe.mul(c[0],m);f=fe.addPoly(f,fe.monomial(y,g)),c=fe.addPoly(c,fe.mulPolyMonomial(o,y,g))}if(f=fe.mulPoly(f,a),u=fe.addPoly(f,h),fe.degree(c)>=fe.degree(o))throw new Error(`Division failed r: ${c}, rLast: ${o}`)}const d=fe.coefficient(u,0);if(d==0)throw new Error("sigmaTilde(0) was zero");const r=fe.inv(d);return[fe.mulPolyScalar(u,r),fe.mulPolyScalar(c,r)]}};function dl(n){return{encode(i){const s=fe.divisorPoly(n),o=Array.from(i);return o.push(...s.slice(0,-1).fill(0)),Uint8Array.from(fe.remainderPoly(o,s))},decode(i){const s=i.slice(),o=fe.polynomial(Array.from(i));let c=lt(n,0),a=!1;for(let f=0;f<n;f++){const m=fe.evalPoly(o,fe.exp(f));c[c.length-1-f]=m,m!==0&&(a=!0)}if(!a)return s;c=fe.polynomial(c);const u=fe.monomial(n,1),[d,r]=fe.euclidian(u,c,n),l=lt(fe.degree(d),0);let h=0;for(let f=1;f<256&&h<l.length;f++)fe.evalPoly(d,f)===0&&(l[h++]=fe.inv(f));if(h!==l.length)throw new Error("RS.decode: invalid errors number");for(let f=0;f<l.length;f++){const m=s.length-1-fe.log(l[f]);if(m<0)throw new Error("RS.decode: invalid error location");const y=fe.inv(l[f]);let g=1;for(let w=0;w<l.length;w++)f!==w&&(g=fe.mul(g,fe.add(1,fe.mul(l[w],y))));s[m]=fe.add(s[m],fe.mul(fe.evalPoly(r,y),fe.inv(g)))}return s}}}function Fo(n,i){const{words:s,shortBlocks:o,numBlocks:c,blockLen:a,total:u}=it.capacity(n,i),d=dl(s);return{encode(r){const l=[],h=[];for(let g=0;g<c;g++){const w=g<o,k=a+(w?0:1);l.push(r.subarray(0,k)),h.push(d.encode(r.subarray(0,k))),r=r.subarray(k)}const f=Is(l),m=Is(h),y=new Uint8Array(f.length+m.length);return y.set(f),y.set(m,f.length),y},decode(r){if(r.length!==u)throw new Error(`interleave.decode: len(data)=${r.length}, total=${u}`);const l=[];for(let m=0;m<c;m++){const y=m<o;l.push(new Uint8Array(s+a+(y?0:1)))}let h=0;for(let m=0;m<a;m++)for(let y=0;y<c;y++)l[y][m]=r[h++];for(let m=o;m<c;m++)l[m][a]=r[h++];for(let m=a;m<a+s;m++)for(let y=0;y<c;y++){const g=y<o;l[y][m+(g?0:1)]=r[h++]}const f=[];for(const m of l)f.push(...Array.from(d.decode(m)).slice(0,-s));return Uint8Array.from(f)}}}function Uo(n,i,s,o=!1){const c=it.size.encode(n);let a=new pt(c+2);const u=new pt(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);a=a.embed(0,u).embed({x:-u.width,y:0},u).embed({x:0,y:-u.height},u),a=a.rectSlice(1,c);const d=new pt(1).rect(0,1,!0).border(1,!1).border(1,!0),r=it.alignmentPatterns(n);for(const l of r)for(const h of r)a.data[l][h]===void 0&&a.embed({x:h-2,y:l-2},d);a=a.hLine({x:0,y:6},1/0,({x:l},h)=>h===void 0?l%2==0:h).vLine({x:6,y:0},1/0,({y:l},h)=>h===void 0?l%2==0:h);{const l=it.formatBits(i,s),h=f=>!o&&(l>>f&1)==1;for(let f=0;f<6;f++)a.data[f][8]=h(f);for(let f=6;f<8;f++)a.data[f+1][8]=h(f);for(let f=8;f<15;f++)a.data[c-15+f][8]=h(f);for(let f=0;f<8;f++)a.data[8][c-f-1]=h(f);for(let f=8;f<9;f++)a.data[8][15-f-1+1]=h(f);for(let f=9;f<15;f++)a.data[8][15-f-1]=h(f);a.data[c-8][8]=!o}if(n>=7){const l=it.versionBits(n);for(let h=0;h<18;h+=1){const f=!o&&(l>>h&1)==1,m=Math.floor(h/3),y=h%3+c-8-3;a.data[m][y]=f,a.data[y][m]=f}}return a}function Bo(n,i,s){const o=n.height,c=is[i];let a=-1,u=o-1;for(let d=o-1;d>0;d-=2){for(d==6&&(d=5);;u+=a){for(let r=0;r<2;r+=1){const l=d-r;n.data[u][l]===void 0&&s(l,u,c(l,u))}if(u+a<0||u+a>=o)break}a=-a}}function ul(n){let i="numeric";for(let s of n)if(!it.alphabet.numeric.has(s)&&(i="alphanumeric",!it.alphabet.alphanumerc.has(s)))return"byte";return i}function hl(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Es(n,i,s,o,c=hl){let a="",u=s.length;if(o==="numeric"){const m=it.alphabet.numeric.decode(s.split("")),y=m.length;for(let g=0;g<y-2;g+=3)a+=Nt(m[g]*100+m[g+1]*10+m[g+2],10);y%3===1?a+=Nt(m[y-1],4):y%3===2&&(a+=Nt(m[y-2]*10+m[y-1],7))}else if(o==="alphanumeric"){const m=it.alphabet.alphanumerc.decode(s.split("")),y=m.length;for(let g=0;g<y-1;g+=2)a+=Nt(m[g]*45+m[g+1],11);y%2==1&&(a+=Nt(m[y-1],6))}else if(o==="byte"){const m=c(s);u=m.length,a=Array.from(m).map(y=>Nt(y,8)).join("")}else throw new Error("encode: unsupported type");const{capacity:d}=it.capacity(n,i),r=Nt(u,it.lengthBits(n,o));let l=it.modeBits[o]+r+a;if(l.length>d)throw new Error("Capacity overflow");l+="0".repeat(Math.min(4,Math.max(0,d-l.length))),l.length%8&&(l+="0".repeat(8-l.length%8));const h="1110110000010001";for(let m=0;l.length!==d;m++)l+=h[m%h.length];const f=Uint8Array.from(l.match(/(.{8})/g).map(m=>+`0b${m}`));return Fo(n,i).encode(f)}function Rs(n,i,s,o,c=!1){const a=Uo(n,i,o,c);let u=0;const d=8*s.length;if(Bo(a,o,(r,l,h)=>{let f=!1;u<d&&(f=(s[u>>>3]>>(7-u&7)&1)!==0,u++),a.data[l][r]=f!==h}),u!==d)throw new Error("QR: bytes left after draw");return a}function fl(n){const i=n.length;if(i<=1)return 0;let s=0,o=1,c=n[0];for(let a=1;a<i;a++){const u=n[a];u===c?o++:(o>=Gn&&(s+=o-2),o=1,c=u)}return o>=Gn&&(s+=o-2),s}function pl(n,i,s){if(s<=1)return 0;let o=0,c=1,a=n[0][i];for(let u=1;u<s;u++){const d=n[u][i];d===a?c++:(c>=Gn&&(o+=c-2),c=1,a=d)}return c>=Gn&&(o+=c-2),o}function ml(n){const i=n.length;if(i<Wn)return 0;let s=0;const o=i-Wn;for(let c=0;c<=o;c++){const a=!n[c]&&!n[c+1]&&!n[c+2]&&!n[c+3]&&n[c+4]&&!n[c+5]&&n[c+6]&&n[c+7]&&n[c+8]&&!n[c+9]&&n[c+10],u=n[c]&&!n[c+1]&&n[c+2]&&n[c+3]&&n[c+4]&&!n[c+5]&&n[c+6]&&!n[c+7]&&!n[c+8]&&!n[c+9]&&!n[c+10];(a||u)&&(s+=Oo)}return s}function gl(n,i,s){if(s<Wn)return 0;let o=0;const c=i,a=s-Wn;for(let u=0;u<=a;u++){const d=!n[u][c]&&!n[u+1][c]&&!n[u+2][c]&&!n[u+3][c]&&n[u+4][c]&&!n[u+5][c]&&n[u+6][c]&&n[u+7][c]&&n[u+8][c]&&!n[u+9][c]&&n[u+10][c],r=n[u][c]&&!n[u+1][c]&&n[u+2][c]&&n[u+3][c]&&n[u+4][c]&&!n[u+5][c]&&n[u+6][c]&&!n[u+7][c]&&!n[u+8][c]&&!n[u+9][c]&&!n[u+10][c];(d||r)&&(o+=Oo)}return o}function yl(n){const i=n.data,s=n.width|0,o=n.height|0;if(s===0||o===0)return 0;let c=0;for(let g=0;g<s;g++)c+=fl(i[g]);for(let g=0;g<o;g++)c+=pl(i,g,s);let a=0;const u=s-1,d=o-1;for(let g=0;g<u;g++){const w=i[g],k=i[g+1];for(let b=0;b<d;b++){const v=w[b];v===k[b]&&v===w[b+1]&&v===k[b+1]&&(a+=il)}}let r=0;for(let g=0;g<s;g++)r+=ml(i[g]);for(let g=0;g<o;g++)r+=gl(i,g,s);let l=0;for(let g=0;g<s;g++){const w=i[g];for(let k=0;k<o;k++)w[k]&&l++}const h=s*o,f=l*100/h,m=Math.abs(f-50),y=ol*Math.floor(m/sl);return c+a+r+y}function vl(n,i,s,o){if(o===void 0){const c=qo();for(let a=0;a<is.length;a++)c.add(yl(Rs(n,i,s,a,!0)),a);o=c.get()}if(o===void 0)throw new Error("Cannot find mask");return Rs(n,i,s,o)}function bl(n){if(!xs.includes(n))throw new Error(`Invalid error correction mode=${n}. Expected: ${xs}`)}function wl(n){if(!Ts.includes(n))throw new Error(`Encoding: invalid mode=${n}. Expected: ${Ts}`);if(n==="kanji"||n==="eci")throw new Error(`Encoding: ${n} is not supported (yet?).`)}function kl(n){if(![0,1,2,3,4,5,6,7].includes(n)||!is[n])throw new Error(`Invalid mask=${n}. Expected number [0..7]`)}function Sl(n,i="raw",s={}){const o=s.ecc!==void 0?s.ecc:"medium";bl(o);const c=s.encoding!==void 0?s.encoding:ul(n);wl(c),s.mask!==void 0&&kl(s.mask);let a=s.version,u,d=new Error("Unknown error");if(a!==void 0)zo(a),u=Es(a,o,n,c,s.textEncoder);else for(let h=1;h<=40;h++)try{u=Es(h,o,n,c,s.textEncoder),a=h;break}catch(f){d=f}if(!a||!u)throw d;let r=vl(a,o,u,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 $h={best:qo,bin:Nt,drawTemplate:Uo,fillArr:lt,info:it,interleave:Fo,validateVersion:zo,zigzag:Bo};const Ai=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"),xi=Ai.getContext("2d",{willReadFrequently:!0});xi.imageSmoothingEnabled=!1;function Cl({text:n,arena:i,backgroundMask:s,arenaCircle:o=!0,caption:c}){const a=B(null),[u,d]=R(0),[r,l]=R(!1),[h,f]=R(!1),m=h?!1:o;if(V(()=>{if(c&&a.current){const Y=a.current.offsetHeight;d(Y)}},[c]),V(()=>{if(i){const Y=new Image;Y.crossOrigin="anonymous",Y.onload=()=>{l(!0);try{const{width:$,height:Q}=Y;Ai.width=$,Ai.height=Q,xi.drawImage(Y,0,0);const Z=xi.getImageData(0,0,$,Q).data,le=Z.length/4;let ne=0,J=!1;for(let we=3;we<Z.length;we+=4)if(Z[we]<=128&&ne++,ne/le>.1){J=!0;break}f(J)}catch{f(!1)}},Y.onerror=$=>{l(!0)},Y.src=i}else l(!1)},[i]),!n)return null;const y=Se(()=>Sl(n,"raw",{ecc:"high",border:0,scale:1}),[n]),g=y.length,w=r?Math.ceil(g*.3):0,k=Math.floor((g-w)/2),b=k+w,v=(Y,$)=>{if(Y<0||Y>=g||$<0||$>=g)return!1;if(r&&Y>=k&&Y<b&&$>=k&&$<b)if(o){const Q=(k+b)/2,j=(k+b)/2,Z=w/2,le=Y+.5-Q,ne=$+.5-j;if(Math.sqrt(le*le+ne*ne)<Z)return!1}else return!1;return y[$][Y]},_=(Y,$)=>Y<0||Y>=g||$<0||$>=g?!1:v(Y,$),S=(Y,$)=>Y<7&&$<7||Y>=g-7&&$<7||Y<7&&$>=g-7,A=Se(()=>{let Y="";for(let $=0;$<g;$++)for(let Q=0;Q<g;Q++){if(!_(Q,$)||S(Q,$))continue;const j=Q+.5,Z=$+.5,le=_(Q,$-1)&&!S(Q,$-1),ne=_(Q+1,$)&&!S(Q+1,$),J=_(Q,$+1)&&!S(Q,$+1),we=_(Q-1,$)&&!S(Q-1,$);ne&&(Y+=`M ${j} ${Z} L ${j+1} ${Z} `),J&&(Y+=`M ${j} ${Z} L ${j} ${Z+1} `),!le&&!ne&&!J&&!we&&(Y+=`M ${j} ${Z} L ${j} ${Z} `)}return Y},[g,y,r,k,b,w,m]),C=[{x:0,y:0},{x:g-7,y:0},{x:0,y:g-7}],x=1.1,L=.6,P=1,F=w-P*2,z=k+P,K=k+P,ee=2,te=2,G=g+ee*2,W=g+ee*2+(c?te+u:0),H=G*.25;return e("svg",{class:"qr-code",viewBox:`${-ee} ${-ee} ${G} ${W}`,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:L,ry:L})]}),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:L,ry:L})]}),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(Y=>e("use",{href:"#position-marker-mask",x:Y.x,y:Y.y},`${Y.x}-${Y.y}`))}),r&&m&&e("circle",{cx:z+F/2,cy:K+F/2,r:F/2,fill:"black"}),r&&!o&&e("rect",{x:z,y:K,width:F,height:F,fill:"black"})]}),e("path",{id:"qr-pattern",fill:"currentColor",stroke:"currentColor","stroke-width":"1","stroke-linejoin":"round","stroke-linecap":"round",d:A})]}),e("use",{href:"#qr-pattern"}),e("g",{id:"position-markers",children:C.map(Y=>e("use",{href:"#position-marker",x:Y.x,y:Y.y},`${Y.x}-${Y.y}`))}),s&&e("g",{mask:"url(#qr-pattern-mask)",children:e("image",{href:s,x:-ee-H,y:-ee-H,width:G+H*2,height:G+H*2,preserveAspectRatio:"none",opacity:"0.5",filter:"url(#blur-mask)"})}),i&&r&&e("image",{href:i,x:z,y:K,width:F,height:F,preserveAspectRatio:"xMidYMid slice","clip-path":m?`circle(${F/2}px at ${F/2}px ${F/2}px)`:void 0}),c&&e("foreignObject",{x:0,y:g+te,width:g,height:u,children:e("div",{ref:a,xmlns:"http://www.w3.org/1999/xhtml",class:"qr-code-caption",dangerouslySetInnerHTML:{__html:c}})})]})}const Ko=!!navigator.mediaDevices?.getUserMedia;function _l({text:n,arena:i,backgroundMask:s,caption:o,onClose:c,onScannerClick:a}){const{_:u}=ie();return e("div",{class:"qr-code-modal-container",children:[e("div",{class:"qr-code-modal-controls",children:[Ko&&typeof a=="function"?e("button",{type:"button",class:"plain4",onClick:a,children:e(I,{icon:"scan",alt:u({id:"XDwkfO"})})}):e("span",{}),!!c&&e("button",{type:"button",class:"plain4",onClick:c,children:e(I,{icon:"x",alt:u({id:"yz7wBu"})})})]}),e(Cl,{text:n,arena:i,backgroundMask:s,caption:o}),e("div",{class:"qr-code-text",children:n})]})}const Mn="BarcodeDetector"in window;Mn||setTimeout(()=>{Pi(()=>import("./dom-BT9_JKk_.js"),__vite__mapDeps([0,1,2,3]),import.meta.url).catch(()=>{})},1e3);class Il{constructor(i,s){this.stream=i,this.player=s,this.setStream(i)}setStream(i){this.stream=i;const{player:s}=this;s.setAttribute("autoplay",""),s.setAttribute("muted",""),s.setAttribute("playsinline",""),s.srcObject=i}async listDevices(){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw new Error("Media Devices not supported");return(await navigator.mediaDevices.enumerateDevices()).filter(s=>s.kind==="videoinput").map(s=>({deviceId:s.deviceId,label:s.label||`Camera ${s.deviceId}`}))}async setDevice(i){this.stop();const s=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:i}}});this.setStream(s)}readFrame(i,s=!1){const{player:o}=this;if(s)return i.drawImage(o,o.videoHeight,o.videoWidth);const c=getSize(o);return i.drawImage(o,c.height,c.width)}stop(){for(const i of this.stream.getTracks())i.stop()}}const Al=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 Il(i,n)};function xl({onClose:n,checkValidity:i,actionableText:s}){const{_:o,_:c}=ie(),a=B(null),u=B(null),d=B(null),[r,l]=R(""),[h,f]=R(!0),[m,y]=R("loading");V(()=>{let w;return screen?.orientation?.type&&a.current&&(w=()=>{const k=/landscape/.test(window.screen.orientation.type)?"landscape":"portrait";a.current.classList.toggle("landscape",k==="landscape")},screen.orientation.addEventListener("change",w),w()),()=>{w&&screen?.orientation?.removeEventListener&&screen.orientation.removeEventListener("change",w)}},[]),V(()=>{let w,k,b,v,_;return h&&(async()=>{try{k=await Al(u.current),Mn?v=new BarcodeDetector({formats:["qr_code"]}):(_=await Pi(()=>import("./dom-BT9_JKk_.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=u.current;A&&(A.addEventListener("loadedmetadata",()=>{y("default")}),A.addEventListener("play",()=>{const{videoWidth:C,videoHeight:x}=A;if(C&&x&&(a.current.style.setProperty("--long-dimension",Math.max(C,x)),a.current.style.setProperty("--short-dimension",Math.min(C,x))),Mn){const L=async()=>{try{const z=await v.detect(u.current);z.length>0&&l(z[0].rawValue)}catch{}};let P;const F=()=>{L(),P=requestAnimationFrame(F)};F(),w=()=>cancelAnimationFrame(P)}else{const L=()=>{try{const P=k.readFrame(b,!0);P!=null&&l(P)}catch{}};w=_.frameLoop(L)}}))}catch{y("error"),f(!1)}})(),()=>{w&&w(),k&&k.stop(),b&&b.clear()}},[h]);const g=typeof i=="function"?i(r):!!r;return e("div",{class:"qr-scanner-modal",children:[e("div",{class:"qr-scanner-header",children:[e(Oe,{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:a,class:"qr-scanner-video-container",children:[e("video",{ref:u,playsInline:!0,muted:!0,disablepictureinpicture:!0}),!Mn&&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}),g&&e("button",{type:"button",class:"button plain6",onClick:()=>{n({text:r})},children:s?c(s):e(I,{icon:"arrow-right"})})]})})]})]})}const Tl=["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 El(n,i){if(!n.translations||!i)return null;const s=Object.keys(n.translations);if(!s?.length)return null;let o=Hn([i],s,null);if(!o){const c=s.map(a=>a.split(/(?=[A-Z])/).map((d,r)=>r===0?d:d.toLowerCase()).join("-"));o=Hn([i],c,null)}if(o&&o.includes("-")){const[c,a]=o.split("-");o=c+a.charAt(0).toUpperCase()+a.slice(1)}return o}function Rl(n,i){return n?.length?i?n.map(s=>{const o=El(s,i);return{...s,_translatedText:s.translations?.[o]?.text||null}}):n:[]}function Ll({account:n,post:i,onClose:s}){const{_:o,_:c,i18n:a}=ie(),{masto:u}=se(),[d,r]=R("default"),[l,h]=n.acct.split("@"),[f,m]=Se(()=>{const{rules:S,domain:A}=no();return[Rl(S||[],a.locale),A]},[a.locale]),[y,g]=R(null),[w,k]=R(!1),b=B(null),[v,_]=R(!1);return e("div",{class:"report-modal-container",children:[e("div",{class:"top-controls",children:[e("h1",{children:c(i?{id:"muLhL3"}:{id:"ACul2G",values:{username:l}})}),e("button",{type:"button",class:"plain4 small",disabled:d==="loading",onClick:()=>s(),children:e(I,{icon:"x",size:"xl",alt:c({id:"yz7wBu"})})})]}),e("main",{children:[e("div",{class:"report-preview",children:i?e(je,{status:i,size:"s",previewMode:!0}):e(gt,{account:n,avatarSize:"xxl",useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!y&&!dn[y].excludeStamp&&e("span",{class:"rubber-stamp","aria-hidden":"true",children:[o(dn[y].stampLabel||o(dn[y].label)),e("small",{children:e(p,{id:"2WtL62"})})]},y),e("form",{onSubmit:S=>{S.preventDefault();const A=new FormData(S.target),C=Object.fromEntries(A.entries());let{category:x,comment:L,forward:P}=C;L||(L=void 0),P==="on"&&(P=!0);const F=x==="violation"?Object.entries(C).filter(([K])=>K.startsWith("rule_ids")).map(([K,ee])=>ee):void 0,z={category:x,comment:L,forward:P,ruleIds:F};r("loading"),(async()=>{try{await u.v1.reports.create({accountId:n.id,statusIds:i?.id?[i.id]:void 0,category:x,comment:L,ruleIds:F,forward:P}),r("success"),de(c(i?{id:"y3ou+8"}:{id:"R9kjEL"})),s()}catch(K){r("error"),de(K?.message||c(i?{id:"+3FjPq"}:{id:"oEQq5w"}))}})()},children:[e("p",{children:c(i?{id:"L9fUm+"}:{id:"rSLkfe"})}),e("section",{class:"report-categories",children:Tl.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=>{g(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:L}=x.target;L?_(!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})]}),!!h&&h!==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:h},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 u.v1.accounts.$select(n.id).mute(),de(c({id:"/BGBeF",values:{username:l}}))}catch{de(c({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 u.v1.accounts.$select(n.id).block(),de(c({id:"kjUejn",values:{username:l}}))}catch{de(c({id:"pMcdDp",values:{username:l}}))}},children:e(p,{id:"JybQca",components:{0:e("small",{class:"ib"})}})}),e(Oe,{hidden:d!=="loading"})]})]})]})]})}var Pn={exports:{}},Mh=Pn.exports,Ls;function $l(){return Ls||(Ls=1,(function(n){var i=(function(){var s=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function u(r,l){if(!a[r]){a[r]={};for(var h=0;h<r.length;h++)a[r][r.charAt(h)]=h}return a[r][l]}var d={compressToBase64:function(r){if(r==null)return"";var l=d._compress(r,6,function(h){return o.charAt(h)});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 u(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),h=new Uint8Array(l.length*2),f=0,m=l.length;f<m;f++){var y=l.charCodeAt(f);h[f*2]=y>>>8,h[f*2+1]=y%256}return h},decompressFromUint8Array:function(r){if(r==null)return d.decompress(r);for(var l=new Array(r.length/2),h=0,f=l.length;h<f;h++)l[h]=r[h*2]*256+r[h*2+1];var m=[];return l.forEach(function(y){m.push(s(y))}),d.decompress(m.join(""))},compressToEncodedURIComponent:function(r){return r==null?"":d._compress(r,6,function(l){return c.charAt(l)})},decompressFromEncodedURIComponent:function(r){return r==null?"":r==""?null:(r=r.replace(/ /g,"+"),d._decompress(r.length,32,function(l){return u(c,r.charAt(l))}))},compress:function(r){return d._compress(r,16,function(l){return s(l)})},_compress:function(r,l,h){if(r==null)return"";var f,m,y={},g={},w="",k="",b="",v=2,_=3,S=2,A=[],C=0,x=0,L;for(L=0;L<r.length;L+=1)if(w=r.charAt(L),Object.prototype.hasOwnProperty.call(y,w)||(y[w]=_++,g[w]=!0),k=b+w,Object.prototype.hasOwnProperty.call(y,k))b=k;else{if(Object.prototype.hasOwnProperty.call(g,b)){if(b.charCodeAt(0)<256){for(f=0;f<S;f++)C=C<<1,x==l-1?(x=0,A.push(h(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(h(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(h(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(h(C)),C=0):x++,m=m>>1}v--,v==0&&(v=Math.pow(2,S),S++),delete g[b]}else for(m=y[b],f=0;f<S;f++)C=C<<1|m&1,x==l-1?(x=0,A.push(h(C)),C=0):x++,m=m>>1;v--,v==0&&(v=Math.pow(2,S),S++),y[k]=_++,b=String(w)}if(b!==""){if(Object.prototype.hasOwnProperty.call(g,b)){if(b.charCodeAt(0)<256){for(f=0;f<S;f++)C=C<<1,x==l-1?(x=0,A.push(h(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(h(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(h(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(h(C)),C=0):x++,m=m>>1}v--,v==0&&(v=Math.pow(2,S),S++),delete g[b]}else for(m=y[b],f=0;f<S;f++)C=C<<1|m&1,x==l-1?(x=0,A.push(h(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(h(C)),C=0):x++,m=m>>1;for(;;)if(C=C<<1,x==l-1){A.push(h(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,h){var f=[],m,y=4,g=4,w=3,k="",b=[],v,_,S,A,C,x,L,P={val:h(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=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=h(P.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=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=h(P.index++)),S|=(A>0?1:0)*x,x<<=1;L=s(S);break;case 1:for(S=0,C=Math.pow(2,16),x=1;x!=C;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=h(P.index++)),S|=(A>0?1:0)*x,x<<=1;L=s(S);break;case 2:return""}for(f[3]=L,_=L,b.push(L);;){if(P.index>r)return"";for(S=0,C=Math.pow(2,w),x=1;x!=C;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=h(P.index++)),S|=(A>0?1:0)*x,x<<=1;switch(L=S){case 0:for(S=0,C=Math.pow(2,8),x=1;x!=C;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=h(P.index++)),S|=(A>0?1:0)*x,x<<=1;f[g++]=s(S),L=g-1,y--;break;case 1:for(S=0,C=Math.pow(2,16),x=1;x!=C;)A=P.val&P.position,P.position>>=1,P.position==0&&(P.position=l,P.val=h(P.index++)),S|=(A>0?1:0)*x,x<<=1;f[g++]=s(S),L=g-1,y--;break;case 2:return b.join("")}if(y==0&&(y=Math.pow(2,w),w++),f[L])k=f[L];else if(L===g)k=_+_.charAt(0);else return null;b.push(k),f[g++]=_+k.charAt(0),y--,_=k,y==0&&(y=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})})(Pn)),Pn.exports}var $s=$l();const Ml="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",Pl="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",Dl="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",Nl=200,Ol=10;async function Zn(){const{masto:n}=se(),i=n.v1.followedTags.list({limit:Nl}).values(),s=[];let o=0;do{const{value:c,done:a}=await i.next();if(a||c?.length===0)break;s.push(...c),o++}while(o<Ol);return s.sort((c,a)=>c.name.localeCompare(a.name)),s.length&&setTimeout(()=>{Ce.account.set("followedTags",{tags:s,updatedAt:Date.now()})},1),s}const zl=1440*60*1e3;async function ql(){try{const{tags:n,updatedAt:i}=Ce.account.get("followedTags")||{};return n?.length?(Date.now()-i>zl&&Zn(),n):await Zn()}catch{return[]}}const Ms=document.createElement("div"),Fl=n=>{if(!n)return[];if(n.indexOf("#")===-1)return[];Ms.innerHTML=n;const i=Ms.querySelectorAll("a.hashtag");return i.length?Array.from(i).map(s=>s.innerText.trim().replace(/^[^#]*#+/,"")):[]};function Dn({children:n}){if(typeof n=="string")return n;const[i,s]=R("");return V(()=>{Promise.resolve(n).then(s)},[n]),i}const Rt=9,Ul=["following","mentions","notifications","list","public","trending","search","hashtag","bookmarks","favourites"],Ho={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}]},Bl=St(async({id:n})=>{const i=await se().masto.v1.accounts.$select(n).fetch();return i.username||i.acct||i.displayName}),Xn={following:{id:"home",title:(n,i)=>i===0?pe._({id:"i0qMbr"}):pe._({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?pr(n):pe._({id:"h16FyT"}),path:({id:n})=>n?`/l/${n}`:"/l",icon:"list",excludeViewMode:({id:n})=>n?[]:["multi-column"]},public:{id:"public",title:({local:n})=>n?pe._({id:"d5zxa4"}):pe._({id:"4ERYY7"}),subtitle:({instance:n})=>n||se().instance,path:({local:n,instance:i})=>`/${i}/p${n?"/l":""}`,icon:({local:n})=>n?"building":"earth"},trending:{id:"trending",title:{id:"4/iCqx"},subtitle:({instance:n})=>n||se().instance,path:({instance:n})=>`/${n}/trending`,icon:"chart"},search:{id:"search",title:({query:n})=>n?`“${n}”`:pe._({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:Bl,path:({id:n})=>`/a/${n}`,icon:"user"},bookmarks:{id:"bookmarks",title:{id:"7Ff7ia"},path:"/b",icon:"bookmark"},favourites:{id:"favourites",title:{id:"zZOZj7"},path:"/f",icon:"heart"},hashtag:{id:"hashtag",title:({hashtag:n})=>n,subtitle:({instance:n})=>n||se().instance,path:({hashtag:n,instance:i,media:s})=>`${i?`/${i}`:""}/t/${n.split(/\s+/).join("+")}${s?"?media=1":""}`,icon:"hashtag"}};function Kl({onClose:n}){const{_:i}=ie(),s=Ge(E),{shortcuts:o}=s,[c,a]=R(!1),[u,d]=R(!1),[r]=oi();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:pe._({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:pe._({id:"qwdOim"}),imgURL:Ml},{value:"tab-menu-bar",label:pe._({id:"UxBoCm"}),imgURL:Dl},{value:"multi-column",label:pe._({id:"uvDfdW"}),imgURL:Pl}].map(({value:l,label:h,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:y=>{E.settings.shortcutsViewMode=y.target.value}})," ",e("img",{src:f,alt:"",width:"80",height:"58"})," ",e("span",{children:h})]},l)})}),o.length>0?e(N,{children:[e("ol",{class:"shortcuts-list",ref:r,children:o.filter(Boolean).map((l,h)=>{const f=Object.values(l).join("-"),{type:m}=l;if(!Xn[m])return null;let{icon:y,title:g,subtitle:w,excludeViewMode:k}=Xn[m];typeof g=="function"?g=g(l,h):g=i(g),typeof w=="function"?w=w(l,h):w=i(w),typeof y=="function"&&(y=y(l,h)),typeof k=="function"&&(k=k(l,h));const b=k?.includes(s.settings.shortcutsViewMode);return e("li",{children:[e(I,{icon:y}),e("span",{class:"shortcut-text",children:[e(Dn,{children:g}),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:h===0,onClick:()=>{const v=Array.from(E.shortcuts);if(h>0){const _=E.shortcuts[h-1];v[h-1]=l,v[h]=_,E.shortcuts=v}},children:e(I,{icon:"arrow-up",alt:pe._({id:"QyioBP"})})}),e("button",{type:"button",class:"plain small",disabled:h===o.length-1,onClick:()=>{const v=Array.from(E.shortcuts);if(h<E.shortcuts.length-1){const _=E.shortcuts[h+1];v[h+1]=l,v[h]=_,E.shortcuts=v}},children:e(I,{icon:"arrow-down",alt:pe._({id:"3Ib6FN"})})}),e("button",{type:"button",class:"plain small",onClick:()=>{a({shortcut:l,shortcutIndex:h})},children:e(I,{icon:"pencil",alt:pe._({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"?pe._({id:"3xIN+E"}):pe._({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"?pe._({id:"RqXfsz",values:{SHORTCUTS_LIMIT:Rt}}):pe._({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:()=>a(!0),children:[e(I,{icon:"plus"})," ",e("span",{children:s.settings.shortcutsViewMode==="multi-column"?pe._({id:"Vh3ADI"}):pe._({id:"9tmn6W"})})]})]})]}),c&&e(Fe,{onClick:l=>{l.target===l.currentTarget&&a(!1)},children:e(Hl,{shortcut:c.shortcut,shortcutIndex:c.shortcutIndex,onSubmit:({result:l,mode:h})=>{h==="edit"?E.shortcuts[c.shortcutIndex]=l:E.shortcuts.push(l)},onClose:()=>a(!1)})}),u&&e(Fe,{onClick:l=>{l.target===l.currentTarget&&d(!1)},children:e(jl,{shortcuts:o,onClose:()=>d(!1)})})]})}const Ps={list:{id:"1qL+L+"},search:{id:"dmTmkQ"},hashtag:{id:"E8laYz"}};function Hl({onSubmit:n,disabled:i,shortcut:s,shortcutIndex:o,onClose:c}){const{_:a}=ie(),u=!!s,[d,r]=R(s?.type||null),[l,h]=R("default"),[f,m]=R([]),[y,g]=R([]);V(()=>{(async()=>{if(d==="list")try{h("loading");const k=await Sn();m(k),h("default")}catch{h("error")}})(),(async()=>{if(d==="hashtag")try{const k=await Zn();g(k)}catch{}})()},[d]);const w=B();return V(()=>{if(u&&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])})}},[u,d]),e("div",{id:"shortcut-settings-form",class:"sheet",children:[!!c&&e("button",{type:"button",class:"sheet-close",onClick:c,children:e(I,{icon:"x",alt:pe._({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:u?pe._({id:"pe1jog"}):pe._({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:u?"edit":"add"}),k.target.reset(),r(null),c?.())},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:u?s.type:void 0,name:"type",dir:"auto",children:[e("option",{}),Ul.map(k=>e("option",{value:k,children:a(Ho[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:u?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:a(k)})," ",e("input",{type:v,switch:v==="checkbox"||void 0,name:b,placeholder:a(_),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"&&y.length>0&&e("datalist",{id:"followed-hashtags-datalist",children:y.map(C=>e("option",{value:C.name}))})]})})),!!Ps[d]&&e("p",{class:"form-note insignificant",children:[e(I,{icon:"info"}),a(Ps[d])]}),e("footer",{children:[e("button",{type:"submit",class:"block",disabled:i||l==="loading",children:u?pe._({id:"tfDRzk"}):pe._({id:"m16xKo"})}),u&&e("button",{type:"button",class:"light danger",onClick:()=>{E.shortcuts.splice(o,1),c?.()},children:e(p,{id:"t/YqKh"})})]})]})})]})}function jl({shortcuts:n,onClose:i}){const{_:s}=ie(),{masto:o}=se(),c=Se(()=>!n||!n.filter(Boolean).length?"":$s.compressToEncodedURIComponent(JSON.stringify(n.filter(Boolean))),[n]),[a,u]=R(""),[d,r]=R("default"),l=Se(()=>{if(!a)return r("default"),null;try{const m=JSON.parse($s.decompressFromEncodedURIComponent(a));if(!Array.isArray(m))throw new Error("Not an array");return r("default"),m}catch{try{const y=JSON.parse(a);if(!Array.isArray(y))throw new Error("Not an array");return r("default"),y}catch{return r("error"),null}}},[a]),h=E.shortcuts.length>0,f=B();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:pe._({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:pe._({id:"tBmklN"}),class:"block",onInput:m=>{u(m.target.value)},dir:"auto"}),Ko&&e("button",{type:"button",class:"plain2 small",onClick:()=>{E.showQrScannerModal={onClose:({text:m}={})=>{m&&(u(m),f.current.value=m,f.current.dispatchEvent(new Event("input")))}}},children:e(I,{icon:"scan",alt:pe._({id:"XDwkfO"})})}),E.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:d==="cloud-downloading",onClick:async()=>{r("cloud-downloading");const m=wt();de(pe._({id:"HLqLGx"}));try{const g=(await o.v1.accounts.relationships.fetch({id:[m]}))[0];if(g){const{note:w=""}=g;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"),de(pe._({id:"gCDfX+"}))}},title:pe._({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:["(",a.length," characters)"]})]}),e("ol",{class:"import-settings-list",children:l.map(m=>e("li",{children:[e("span",{style:{opacity:n.some(y=>Object.keys(y).every(g=>{if(!(g in m))return!0;const w=m[g];return w===""||w===null||w===void 0?!0:y[g]===w}))?1:0},children:"*"}),e("span",{children:[s(Ho[m.type]),m.type==="list"&&!!m.id&&" ⚠️"," ",Nn[m.type]?.map?.(({text:y,name:g,type:w})=>m[g]?e(N,{children:[e("span",{class:"tag collapsed insignificant",children:[s(y),":"," ",w==="checkbox"?m[g]==="on"?"✅":"❌":m[g]]})," "]}):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:[h&&e(N,{children:[e(vt,{confirmLabel:pe._({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){de(pe._({id:"o6L30P"}));return}let y=[...E.shortcuts,...m];const g=y.length>Rt;g&&(y=y.slice(0,Rt)),E.shortcuts=y,de(g?pe._({id:"SBmqmC",values:{SHORTCUTS_LIMIT:Rt}}):pe._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:e(p,{id:"c89gCv"})})})," "]}),e(vt,{confirmLabel:h?pe._({id:"6ZjzWP"}):pe._({id:"DWumLi"}),menuItemClassName:h?"danger":void 0,onClick:()=>{E.shortcuts=l,de(pe._({id:"QO9uTx"})),i?.()},children:e("button",{type:"button",class:"plain2",disabled:!l,children:h?pe._({id:"uIp8WL"}):pe._({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:c,readOnly:!0,onClick:m=>{if(m.target.value){m.target.select();try{navigator.clipboard.writeText(m.target.value),de(pe._({id:"cWtH+v"}))}catch{de(pe._({id:"yUWyHa"}))}}},dir:"auto"}),e("button",{type:"button",class:"plain2 small",disabled:!c,onClick:()=>{E.showQrCodeModal={text:c}},children:e(I,{icon:"qrcode",alt:pe._({id:"gCX4Z9"})})}),E.settings.shortcutSettingsCloudImportExport&&e("button",{type:"button",class:"plain2 small",disabled:d==="cloud-uploading",onClick:async()=>{r("cloud-uploading");const m=wt();try{const g=(await o.v1.accounts.relationships.fetch({id:[m]}))[0];if(g){const{note:w=""}=g;let k="";const b=JSON.stringify({v:"1",dt:Date.now(),data:c});/<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>`,de(pe._({id:"9ZYiLz"})),await o.v1.accounts.$select(m).note.create({comment:k}),r("default"),de(pe._({id:"5w02SH"}))}}catch{r("error"),de(pe._({id:"aVsTYo"}))}},title:pe._({id:"gWd6Cu"}),children:[e(I,{icon:"cloud"}),e(I,{icon:"arrow-up",size:"s"})]})]}),e("p",{children:[e("button",{type:"button",class:"plain2",disabled:!c,onClick:()=>{try{navigator.clipboard.writeText(c),de(pe._({id:"+Kq2vY"}))}catch{de(pe._({id:"tFvxZF"}))}},children:[e(I,{icon:"clipboard"})," ",e("span",{children:e(p,{id:"he3ygx"})})]})," ",navigator?.share&&navigator?.canShare?.({text:c})&&e("button",{type:"button",class:"plain2",disabled:!c,onClick:()=>{try{navigator.share({text:c})}catch{alert(pe._({id:"TtG3Uh"}))}},children:[e(I,{icon:"share"})," ",e("span",{children:e(p,{id:"Z8lGw6"})})]})," ",c.length>0&&e("small",{class:"insignificant ib",children:e(p,{id:"IPXOXm",values:{0:c.length}})})]}),!!c&&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/"})]})})]})]})}io(E,n=>{for(const[i,s,o,c]of n)/^show/i.test(s)&&!o&&Ci()});function Yl(){const{_:n}=ie(),i=Ge(E),s=Di(),o=an();return V(()=>{setTimeout(Sc,1e3)},[]),e(N,{children:[!!i.showCompose&&e(Fe,{class:`solid ${i.composerState.minimized?"min":""}`,minimized:!!i.composerState.minimized,children:e(Cc,{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:c=>{const{newStatus:a,instance:u,type:d,scheduledAt:r}=c||{};E.showCompose=!1,window.__COMPOSE__=null,a&&(E.reloadStatusPage++,r&&E.reloadScheduledPosts++,de({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":u?`/${u}/s/${a.id}`:`/s/${a.id}`)}}))}})}),!!i.showSettings&&e(Fe,{onClose:()=>{E.showSettings=!1},children:e(ir,{onClose:()=>{E.showSettings=!1}})}),!!i.showAccounts&&e(Fe,{onClose:()=>{E.showAccounts=!1},children:e(Ba,{onClose:()=>{E.showAccounts=!1}})}),!!i.showAccount&&e(Fe,{onClose:()=>{E.showAccount=!1},children:e(Lr,{account:i.showAccount?.account||i.showAccount,instance:i.showAccount?.instance,onClose:({destination:c}={})=>{E.showAccount=!1}})}),!!i.showOpenLink&&e(Fe,{onClose:()=>{E.showOpenLink=!1},children:e(nl,{url:i.showOpenLink.url,linkText:i.showOpenLink.linkText,onClose:()=>{E.showOpenLink=!1}})}),!!i.showDrafts&&e(Fe,{onClose:()=>{E.showDrafts=!1},children:e($r,{onClose:()=>E.showDrafts=!1})}),!!i.showMediaModal&&e(Fe,{onClick:c=>{(c.target===c.currentTarget||c.target.classList.contains("media"))&&(E.showMediaModal=!1)},children:e(No,{mediaAttachments:i.showMediaModal.mediaAttachments,instance:i.showMediaModal.instance,index:i.showMediaModal.mediaIndex,statusID:i.showMediaModal.statusID,onClose:()=>{E.showMediaModal=!1}})}),!!i.showShortcutsSettings&&e(Fe,{onClose:()=>{E.showShortcutsSettings=!1},children:e(Kl,{onClose:()=>E.showShortcutsSettings=!1})}),!!i.showGenericAccounts&&e(Fe,{onClose:()=>{E.showGenericAccounts=!1},children:e(Dr,{instance:i.showGenericAccounts.instance,excludeRelationshipAttrs:i.showGenericAccounts.excludeRelationshipAttrs,postID:i.showGenericAccounts.postID,onClose:()=>E.showGenericAccounts=!1,blankCopy:i.showGenericAccounts.blankCopy})}),!!i.showMediaAlt&&e(Fe,{onClose:c=>{E.showMediaAlt=!1},children:e(qr,{alt:i.showMediaAlt.alt||i.showMediaAlt,lang:i.showMediaAlt?.lang,onClose:()=>{E.showMediaAlt=!1}})}),!!i.showEmbedModal&&e(Fe,{class:"solid",onClose:()=>{E.showEmbedModal=!1},children:e(Pr,{html:i.showEmbedModal.html,url:i.showEmbedModal.url,width:i.showEmbedModal.width,height:i.showEmbedModal.height,onClose:()=>{E.showEmbedModal=!1}})}),!!i.showReportModal&&e(Fe,{onClose:()=>{E.showReportModal=!1},children:e(Ll,{account:i.showReportModal.account,post:i.showReportModal.post,onClose:()=>{E.showReportModal=!1}})}),!!i.showQrCodeModal&&e(Fe,{class:"solid",onClose:()=>{E.showQrCodeModal=!1},children:e(_l,{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(Fe,{class:"solid",onClose:()=>{E.showQrScannerModal=!1},children:e(xl,{checkValidity:i.showQrScannerModal.checkValidity,actionableText:i.showQrScannerModal.actionableText,onClose:(...c)=>{i.showQrScannerModal.onClose&&i.showQrScannerModal.onClose(...c),E.showQrScannerModal=!1}})}),!!i.showImportExportAccounts&&e(Fe,{onClose:()=>{E.showImportExportAccounts=!1},children:e(Or,{onClose:()=>{E.showImportExportAccounts=!1},exportDisabled:typeof i.showImportExportAccounts=="object"?i.showImportExportAccounts.exportDisabled:!1})})]})}const Vl=rt(function(){const i=Di(),s={useKey:!0,ignoreEventWhen:o=>!!document.querySelector("#modal-container > *")||o.metaKey||o.ctrlKey||o.altKey};return Ke("g>h",()=>i("/"),s),Ke("g>n",()=>i("/notifications"),s),null});function Ti({accountID:n,onChange:i}){const{_:s}=ie(),{masto:o}=se(),[c,a]=R("default"),[u,d]=R(null),[r,l]=R(null),h=r!==null;return e("p",{class:"follow-request-buttons",children:[e("button",{type:"button",disabled:c==="loading"||h,onClick:()=>{a("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{}a("default")})()},children:e(p,{id:"g3UF2V"})})," ",e("button",{type:"button",disabled:c==="loading"||h,class:"light danger",onClick:()=>{a("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{a("default")}})()},children:e(p,{id:"1t/NnN"})}),e("span",{class:"follow-request-states",children:h&&u?u==="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(Oe,{hidden:c!=="loading"})})]})}const Ds={mention:"comment",status:"notification",reblog:"rocket",follow:"follow",follow_request:"follow-add",favourite:"heart",poll:"poll",update:"pencil","admin.signup":"account-edit","admin.report":"account-warning",severed_relationships:"heart-break",moderation_warning:"alert",emoji_reaction:"emoji2","pleroma:emoji_reaction":"emoji2",annual_report:"celebrate",quote:"quote",quoted_update:"pencil"};function Ns({account:n,emoji:i,emoji_url:s}){let o,c;typeof s=="string"?o=s:(o=s?.url,c=s?.staticUrl);const a=o?e(Wc,{url:o,staticUrl:c,alt:i}):i;return e(p,{id:"i5uN6K",values:{account:n,emojiObject:a}})}const yi={status:({account:n})=>e(p,{id:"idiIxW",values:{account:n}}),reblog:({count:n,account:i,postsCount:s,postType:o,components:{Subject:c}})=>e(p,{id:"jkt9P5",values:{0:Xe(n),1:Xe(n),count:n,postsCount:s,postType:o,account:i},components:{0:e(c,{clickable:n>1}),1:e("span",{title:n}),2:e(c,{clickable:n>1}),3:e("span",{title:n})}}),follow:({account:n,count:i,components:{Subject:s}})=>e(p,{id:"+71G9C",values:{0:Xe(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:c}})=>e(p,{id:"RqX1mR",values:{0:Xe(i),1:Xe(i),count:i,postsCount:s,postType:o,account:n},components:{0:e(c,{clickable:i>1}),1:e("span",{title:i}),2:e(c,{clickable:i>1}),3:e("span",{title:i})}}),poll:()=>pe._({id:"kIlJaS"}),"poll-self":()=>pe._({id:"kpjzdN"}),"poll-voted":()=>pe._({id:"moT7M8"}),update:({account:n})=>n?e(p,{id:"W+eFn3",values:{account:n}}):pe._({id:"uzt17m"}),"favourite+reblog":({count:n,account:i,postsCount:s,postType:o,components:{Subject:c}})=>e(p,{id:"NunZZQ",values:{0:Xe(n),1:Xe(n),count:n,postsCount:s,postType:o,account:i},components:{0:e(c,{clickable:n>1}),1:e("span",{title:n}),2:e(c,{clickable:n>1}),3:e("span",{title:n})}}),quoted_update:({account:n})=>e(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:Ns,"pleroma:emoji_reaction":Ns,annual_report:({year:n})=>e(p,{id:"INLTzH",values:{year:n}})},Gl={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",{})}})},Wl={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"}},vi=30;function Zl({notification:n,instance:i,isStatic:s,disableContextMenu:o}){const{_:c}=ie(),{masto:a}=se(),{id:u,status:d,account:r,report:l,event:h,moderation_warning:f,annualReport:m,_ids:y,_accounts:g,_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,L=x?.id,P=wt(),F=P===r?.id,z=d?.poll?.voted,K=!!d?.inReplyToAccountId&&d?.inReplyToAccountId!==P&&d?.account?.id===P;let ee=0,te=0;if(C==="favourite+reblog"){if(g)for(const Z of g)Z._types?.includes("favourite")&&ee++,Z._types?.includes("reblog")&&te++;!te&&ee&&(C="favourite"),!ee&&te&&(C="reblog")}let G;C==="poll"?G=yi[F?"poll-self":z?"poll-voted":"poll"]:yi[C]?G=yi[C]:G=pe._({id:"ODqZt1",values:{type:C}});const W=({clickable:Z,...le})=>Z?e("b",{tabIndex:"0",onClick:j,...le}):e("b",{...le}),H=v>0&&v>b?.length,Y=H?"remote":"local";if(typeof G=="function"){const Z=(C==="favourite"||C==="reblog")&&v?H?v:b?.length:g?.length||b?.length||(r?1:0),le=w?.length||(d?1:0);if(C==="admin.report"){const ne=l?.targetAccount;ne&&(G=G({account:e(mt,{account:r,showAvatar:!0}),targetAccount:e(mt,{account:ne,showAvatar:!0})}))}else if(C==="severed_relationships"){const ne=h?.targetName;ne&&(G=G({name:ne}))}else if((C==="emoji_reaction"||C==="pleroma:emoji_reaction")&&n.emoji){const ne=n.emoji_url||d?.emojis?.find?.(J=>J?.shortcode===n.emoji.replace(/^:/,"").replace(/:$/,""));G=G({account:e(mt,{account:r,showAvatar:!0}),emoji:n.emoji,emojiURL:ne})}else C==="annual_report"?G=G({...n.annualReport}):G=G({account:r?e(mt,{account:r,showAvatar:!0}):b?.[0]&&e(mt,{account:b[0],showAvatar:!0}),count:Z,postsCount:le,postType:K?"reply":"post",components:{Subject:W}})}const $=n.createdAt&&new Date(n.createdAt).toLocaleString(),Q={"favourite+reblog":pe._({id:"+XOeb+"}),favourite:pe._({id:"LQFF6J"}),reblog:pe._({id:"phQpSa"}),follow:pe._({id:"Ih01jh"})}[C]||pe._({id:"bPwFdf"}),j=()=>{E.showGenericAccounts={heading:Q,accounts:g,showReactions:C==="favourite+reblog",excludeRelationshipAttrs:C==="follow"?["followedBy"]:[],postID:ht(L,i)}};if(d?.filtered){const Z=d?.account?.id===P,le=sn(d.filtered,"notifications");if(!F&&!Z&&le?.action==="hide")return null}return e("div",{class:`notification notification-${C}`,"data-notification-id":y||u,"data-group-key":k?.join(" ")||_,tabIndex:"0",children:[e("div",{class:`notification-type notification-${C}`,title:$,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:Ds[C]||"notification",size:"xl",alt:C})}),e("div",{class:"notification-content",children:[C!=="mention"&&C!=="quote"&&e(N,{children:[e("p",{children:G}),C==="follow_request"&&e(Ti,{accountID:r.id}),C==="severed_relationships"&&e("div",{children:[Gl[h.type]({from:i,...h}),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:[c(Wl[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(ve,{to:`/annual_report/${m?.year}`,children:e(p,{id:"5PGPvG"})})})]}),g?.length>1&&e("p",{class:"avatars-stack",children:[g.slice(0,vi).map(Z=>e(N,{children:[e("a",{href:Z.url,rel:"noopener",class:"account-avatar-stack",onClick:le=>{le.preventDefault(),E.showAccount=Z},children:[e(ut,{url:Z.avatarStatic,size:g.length<=10?"xxl":g.length<20?"xl":"l",alt:`${Z.displayName} @${Z.acct}`,squircle:Z?.bot},Z.id),C==="favourite+reblog"&&e("div",{class:"account-sub-icons",children:Z._types.map(le=>e(I,{icon:Ds[le],size:"s",class:`${le}-icon`}))})]},Z.id)," "]},Z.id)),(C==="favourite+reblog"||C==="favourite"||C==="reblog")&&Y==="remote"?e("button",{type:"button",class:"small plain","data-group-keys":k?.join(" "),onClick:()=>{E.showGenericAccounts={heading:Q,accounts:g,fetchAccounts:async()=>{const Z=await Promise.allSettled(k.map(async ne=>{const J=a.v2.notifications.$select(ne).accounts.list().values();return[ne,(await J.next()).value]})),le=[];for(const ne of Z){const[J,we]=ne.value,be=/^favourite/.test(J)?"favourite":/^reblog/.test(J)?"reblog":null;if(be)for(const ke of we){const ze=le.find(_e=>_e.id===ke.id);ze?ze._types.push(be):(ke._types=[be],le.push(ke))}}return{done:!0,value:le}},showReactions:C==="favourite+reblog",postID:ht(L,i)}},children:["+",(C==="favourite"||C==="reblog")&&v-g.length,e(I,{icon:"chevron-down"})]}):e("button",{type:"button",class:"small plain",onClick:j,children:[g.length>vi&&`+${g.length-vi}`,e(I,{icon:"chevron-down"})]})]}),!g?.length&&b?.length>1&&e("p",{class:"avatars-stack",children:[b.map(Z=>e(N,{children:[e("a",{href:Z.url,rel:"noopener",class:"account-avatar-stack",onClick:le=>{le.preventDefault(),E.showAccount=Z},children:e(ut,{url:Z.avatarStatic,size:"xxl",alt:`${Z.displayName} @${Z.acct}`,squircle:Z?.bot},Z.id)},Z.id)," "]},Z.id)),v>b.length&&e(ve,{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(Z=>e("li",{children:e(Os,{class:`status-link status-type-${C}`,to:i?`/${i}/s/${Z.id}`:`/s/${Z.id}`,children:e(je,{status:Z,size:"s",previewMode:!0,allowContextMenu:!0,allowFilters:!0})})},Z.id))}),d&&(!w?.length||w?.length<=1)&&e(Os,{class:`status-link status-type-${C}`,to:i?`/${i}/s/${L}`:`/s/${L}`,onContextMenu:o?void 0:Z=>{const le=Z.target.querySelector(".status");if(le){if(Z.metaKey)return;Z.preventDefault(),le.dispatchEvent(new MouseEvent("contextmenu",{clientX:Z.clientX,clientY:Z.clientY}))}},children:s?e(je,{status:x,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0}):e(je,{statusID:L,size:"s",readOnly:!0,allowContextMenu:!0,allowFilters:!0})})]})]})}function Os(n){const{_:i}=ie(),s=Zc();return e(ve,{...n,"data-read-more":i({id:"8fZueG"}),ref:s})}const wn=rt(Zl,(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 Xl=rt(function(){const{_:i}=ie();if(!("serviceWorker"in navigator))return null;const s=Ge(E),{routeNotification:o}=s,{id:c,accessToken:a}=o||{},[u,d]=R(!1);kt(()=>{if(!c||!a)return;const{instance:l}=se(),{masto:h,instance:f}=se({accessToken:a}),m=l===f,y=a?_c(a):Ni();(async()=>{const g=await h.v1.notifications.$select(c).fetch();if(g&&y){const w=y.instanceURL,{type:k,status:b,account:v}=g,_=!!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:c,account:y,notification:g,sameInstance:m}):C?location.hash=`/${l}/s/${b.id}`:S?location.hash=`/${l}/a/${v.id}`:location.hash="/notifications"}})()},[c,a]),kt(()=>{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(u){const{id:l,account:h,notification:f,sameInstance:m}=u;return e(Fe,{onClick:y=>{y.target===y.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:y=>{const{target:g}=y;(y.target.tagName==="BUTTON"||y.target.tagName==="A")&&r()},children:e(wn,{instance:h.instanceURL,notification:f,isStatic:!0})}),e("div",{style:{textAlign:"end"},children:e(ve,{to:"/notifications",class:"button light",onClick:r,children:[e("span",{children:e(p,{id:"/WA/tl"})})," ",e(I,{icon:"arrow-right"})]})})]})]})})}return null}),ri=({limit:n}={})=>{const i=Ce.account.get("searchHistory")||[];return n?i.slice(0,n):i},Ql=10,On=(n,i=null)=>{if(!n?.trim?.())return;const s=ri(),o=s.findIndex(a=>a.query===n&&a.queryType===i);o!==-1&&s.splice(o,1),s.unshift({query:n.trim(),queryType:i,timestamp:Date.now()});const c=s.slice(0,Ql);Ce.account.set("searchHistory",c)},Jl=(n,i=null)=>{const o=ri().filter(c=>!(c.query===n&&c.queryType===i));Ce.account.set("searchHistory",o)},ed=()=>{Ce.account.set("searchHistory",[])},Kt=(n,i,s)=>{let o,c,a;if(i==="statuses")o=e(p,{id:"o1mMWT",values:{query:n},components:{0:e("q",{})}}),c=`/search?q=${encodeURIComponent(n)}&type=statuses`,a="document";else if(i==="accounts")o=e(p,{id:"cDoNQr",values:{query:n},components:{0:e("q",{})}}),c=`/search?q=${encodeURIComponent(n)}&type=accounts`,a="group";else if(i==="hashtags"){const[,u="#",d=n]=n.match(/^([##])?(.*)$/),r=`${u}${d}`;o=e(p,{id:"mFfcu0",values:{hashtag:r},components:{0:e("mark",{})}}),c=`/${s}/t/${d}`,a="hashtag"}else o=e(p,{id:"48oDit",values:{query:n},components:{0:e("small",{class:"insignificant"})}}),c=`/search?q=${encodeURIComponent(n)}`,a="search";return{label:o,to:c,icon:a}},jo=Ic((n,i)=>{const{_:s}=ie(),{instance:o}=se(),[c,a]=Ct(),[u,d]=R(!1),[r,l]=R(c.get("q")||""),h=c.get("type"),f=B(null),m=B(null);Ac(i,()=>({setValue:w=>{l(w)},focus:()=>{m.current.focus()},select:()=>{m.current.select()},blur:()=>{m.current.blur()}}));const y=Se(()=>ri({limit:5}),[n?.hidden]),g=Se(()=>{if(!r)return[];const k=y.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:!h&&!/\s/.test(r),hidden:!!h},...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(h){if(v.queryType===h)return-1;if(_.queryType===h)return 1}return v.top&&!_.top?-1:!v.top&&_.top?1:0}).filter(({hidden:v})=>!v)},[r,h,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};h&&(b.type=h),a(b)}else a({});else r?location.hash=`/search?q=${encodeURIComponent(r)}${h?`&type=${h}`:""}`:location.hash="/search";On(r,h),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||a({})},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(),u){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(),u){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(u){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:!u,children:[!r&&y.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"})]}),y.map((w,k)=>{const{label:b,to:v,icon:_}=Kt(w.query,w.queryType,o);return e(ve,{to:v,class:`search-popover-item ${k===0?"focus":""}`,onClick:S=>{On(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(ve,{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"})})]})]}),g.map(({label:w,to:k,icon:b,queryType:v,isRecentSearch:_,historyItem:S},A)=>e(ve,{to:k,class:`search-popover-item ${_?"search-popover-item-recent":""} ${A===0?"focus":""}`,onClick:C=>{_||On(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}`))]})]})}),td=rt(function({onClose:i=()=>{}}){const s=Ge(E),[o,c]=R(!1),a=B(null);V(()=>{if(s.showSearchCommand){const{query:r}=s.showSearchCommand;c(!0),setTimeout(()=>{r&&a.current?.setValue?.(r),a.current?.focus?.()},150),E.showSearchCommand=!1}},[s.showSearchCommand]),Ke(["Slash","/"],r=>{c(!0),setTimeout(()=>{a.current?.focus?.(),a.current?.select?.()},0)},{useKey:!0,preventDefault:!0,ignoreEventWhen:r=>{const l=/\/search/.test(location.hash),h=/\/yip/.test(location.hash),f=!!document.querySelector("#modal-container > *");return l||h||f||r.metaKey||r.ctrlKey||r.altKey||r.shiftKey}});const u=()=>{c(!1),i()};Ke("esc",r=>{a.current?.blur?.(),u()},{enabled:o,enableOnFormTags:!0,preventDefault:!0,useKey:!0,ignoreEventWhen:r=>r.metaKey||r.ctrlKey||r.altKey||r.shiftKey});const d=!o;return e("div",{id:"search-command-container",hidden:d,onClick:r=>{r.target===r.currentTarget&&u()},children:e(jo,{ref:a,hidden:d,onSubmit:()=>{u()}})})});function nd(){const{_:n,_:i}=ie(),{instance:s}=se(),o=Ge(E),{shortcuts:c,settings:a}=o;if(!c.length)return null;const u=a.shortcutsViewMode==="multi-column"||!a.shortcutsViewMode&&a.shortcutsColumnsMode,d=B(),r=B(),l=B(!1),h=c.map((g,w)=>{const{type:k,...b}=g;if(!Xn[k])return null;let{id:v,path:_,title:S,subtitle:A,icon:C}=Xn[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 g=setTimeout(()=>{const w=r.current?.querySelector(".is-active");w&&w.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},100);return()=>clearTimeout(g)}},[]);const f=Di();Ke(["1","2","3","4","5","6","7","8","9"],g=>{const w=parseInt(g.key,10)-1;if(w<h.length){const{path:k}=h[w];k&&(f(k),d.current?.closeMenu?.())}},{enabled:!u,useKey:!0,ignoreEventWhen:g=>g.metaKey||g.ctrlKey||g.altKey||g.shiftKey});const[m,y]=R([]);return u?null:e("div",{id:"shortcuts",children:o.settings.shortcutsViewMode==="tab-menu-bar"?e("nav",{ref:r,class:"tab-bar",onContextMenu:g=>{g.preventDefault(),E.showShortcutsSettings=!0},children:e("ul",{children:h.map(({id:g,path:w,title:k,subtitle:b,icon:v},_)=>e("li",{children:e(ve,{class:b?"has-subtitle":"",to:w,onClick:S=>{if(S.target.classList.contains("is-active")){S.preventDefault();const A=document.getElementById(`${g}-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(Dn,{children:k}),b&&e(N,{children:[e("br",{}),e("small",{children:b})]})]})]})},`${_}-${g}-${k}-${b}-${w}`))})}):e(ft,{instanceRef:d,overflow:"auto",viewScroll:"close",menuClassName:"glass-menu shortcuts-menu",gap:8,position:"anchor",onMenuChange:g=>{g.open&&l.current&&Sn().then(y)},menuButton:e("button",{type:"button",id:"shortcuts-button",class:"plain",onContextMenu:g=>{g.preventDefault(),E.showShortcutsSettings=!0},onTransitionStart:g=>{try{const{target:w}=g;getComputedStyle(w).pointerEvents==="none"&&d.current?.closeMenu?.()}catch{}},children:e(I,{icon:"shortcut",size:"xl",alt:n({id:"CTqTgr"})})}),children:h.map(({id:g,path:w,title:k,subtitle:b,icon:v},_)=>g==="lists"?e(kn,{menuClassName:"glass-menu",overflow:"auto",gap:-8,label:e(N,{children:[e(I,{icon:v,size:"l"}),e("span",{class:"menu-grow",children:e(Dn,{children:k})}),e(I,{icon:"chevron-right"})]}),children:[e(Ye,{to:"/l",children:e("span",{children:e(p,{id:"BHWx+g"})})}),e(Ve,{}),m?.map(S=>e(Ye,{to:`/l/${S.id}`,children:e("span",{children:[S.title,S.exclusive&&e(N,{children:[" ",e(Zt,{})]})]})},S.id))]}):e(Ye,{to:w,class:"glass-menu-item",children:[e(I,{icon:v,size:"l"})," ",e("span",{class:"menu-grow",children:[e("span",{children:e(Dn,{children:k})}),b&&e(N,{children:[" ",e("small",{class:"more-insignificant",children:b})]})]}),e("span",{class:"menu-shortcut hide-until-focus-visible",children:_+1})]},`${_}-${g}-${k}-${b}-${w}`))})})}const id=rt(nd);function sd(n){let i=[],s=[],o=0;for(let c=0;c<n.length;c++){const a=n[c];a.reblog&&!a.account?.group?(s.push(a),o++):(i.push(a),o<3&&(o=0))}if(n.length>10&&(s.length>n.length/4||o>=3)){const c=s.map(a=>a.id);if(s.length>n.length*3/4)i=[...i,{id:c,items:s,type:"boosts"}];else{const a=Math.floor(i.length/2);i=[...i.slice(0,a),{id:c,items:s,type:"boosts"},...i.slice(a)]}return i}else return n}function zs(n,i){const s=Ce.account.get("boostedStatusIDs")||{},o=n.filter(a=>{if(!a.reblog)return!0;const u=`${i}-${a.reblog.id}`,d=s[u];return d&&d!==a.id?!1:(s[u]=a.id,!0)}),c=Object.keys(s);return c.length>50&&c.slice(0,c.length-50).forEach(a=>{delete s[a]}),Ce.account.set("boostedStatusIDs",s),o}function od(n,i){const s=[];let o=0;n.forEach(d=>{for(let l=0;l<s.length;l++){if(s[l].find(h=>h.id===d.id))return;if(s[l].find(h=>h.id===d.inReplyToId)||s[l].find(h=>h.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(h=>s[r].includes(h))&&(s[d]=[...s[d],...s[r]],s[d]=s[d].filter((h,f,m)=>m.findIndex(y=>y.id===h.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 c=[],a=[],u=[];return n.forEach(d=>{if(d.reblog){c.push(d);return}for(let r=0;r<s.length;r++)if(s[r].find(l=>l.id===d.id)){if(a.includes(r))return;const l=s[r];l.sort((f,m)=>Date.parse(f.createdAt)-Date.parse(m.createdAt));const h=l[0].account.id;c.push({id:l.map(f=>f.id),items:l,type:l.every(f=>f.account.id===h)?"thread":"conversation"}),a.push(r);return}if(d.inReplyToId&&d.inReplyToAccountId!==d.account.id){const r=ht(d.id,i);E.statusReply[r]||u.push({sKey:r,inReplyToId:d.inReplyToId})}c.push(d)}),u?.length&&queueMicrotask(()=>{const{masto:d}=se({instance:i});async function r(){for(let l=0;l<u.length;l++){const{sKey:h,inReplyToId:f}=u[l];try{const m=await cd(f,d);Je(m,i,{skipThreading:!0}),E.statusReply[h]={id:m.id,instance:i},await new Promise(y=>setTimeout(y,1e3))}catch{}}}if(Qe("@mastodon/fetch-multiple-statuses")){const l=u.map(({inReplyToId:h})=>h);(async()=>{try{const h=await d.v1.statuses.list({id:l});if(h?.length)for(const f of h){Je(f,i,{skipThreading:!0});const m=u.find(({inReplyToId:y})=>y===f.id)?.sKey;m&&(E.statusReply[m]={id:f.id,instance:i})}else r()}catch{r()}})()}else r()}),c}const cd=St((n,i)=>i.v1.statuses.$select(n).fetch());async function Yo(n,i){const s=await ql();if(!s.length)return;const{statusFollowedTags:o}=E,c=[];if(n.forEach(a=>{if(a.reblog)return;const{id:u,content:d,tags:r=[]}=a,l=ht(u,i);if(o[l]?.length)return;const h=Fl(d);if(!h.length&&!r.length)return;const f=s.reduce((m,y)=>((h.some(g=>g.toLowerCase()===y.name.toLowerCase())||r.some(g=>g.name.toLowerCase()===y.name.toLowerCase()))&&m.push(y.name),m),[]);f.length&&c.push({item:a,sKey:l,followedTags:f})}),c.length){const a=c.map(d=>d.item.account),u=await ni(a);if(!u)return;c.forEach(d=>{const{item:r,sKey:l,followedTags:h}=d,f=u[r.account.id];f&&!f.following&&(o[l]=h)})}}function ad(){E.statusFollowedTags={}}function rd({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:s=1,scrollThresholdStart:o=10,scrollThresholdEnd:c=10,direction:a="vertical",distanceFromStartPx:u,distanceFromEndPx:d}={}){const[r,l]=R(null),[h,f]=R(!1),[m,y]=R(!1),[g,w]=R(!1),[k,b]=R(!1),v=a==="vertical";return kt(()=>{const _=n.current;if(!_)return{};let S=v?_.scrollTop:_.scrollLeft;function A(){const{scrollTop:C,scrollLeft:x,scrollHeight:L,scrollWidth:P,clientHeight:F,clientWidth:z}=_,K=v?C:x,ee=v?L:P,te=v?F:z,G=Math.abs(K-S),W=u||Math.min(te*i,ee,K),H=d||Math.min(te*s,ee,ee-K-te);G>=(S<K?c:o)&&(l(S<K?"end":"start"),S=K),f(K<=0),y(K+te>=ee),w(K<=W),b(K+te>=ee-H)}return _.addEventListener("scroll",A,{passive:!0}),()=>_.removeEventListener("scroll",A)},[i,s,o,c]),{scrollDirection:r,reachStart:h,reachEnd:m,nearReachStart:g,nearReachEnd:k,init:()=>{n.current&&n.current.dispatchEvent(new Event("scroll"))}}}function ld({scrollableRef:n,distanceFromStart:i=1,distanceFromEnd:s=1,scrollThresholdStart:o=10,scrollThresholdEnd:c=10,direction:a="vertical",distanceFromStartPx:u,distanceFromEndPx:d,init:r}={},l){if(!l)return;const h=a==="vertical",f=B(null),m=B(null),y=Xc(()=>{let g=!1,w=!1,k=!1,b=!1;const v=n.current,{scrollTop:_,scrollLeft:S,scrollHeight:A,scrollWidth:C,clientHeight:x,clientWidth:L}=v,P=h?_:S,F=h?A:C,z=h?x:L,K=P-f.current,ee=K>0,te=ee?c:o,G=u||Math.min(z*i,F,P),W=d||Math.min(z*s,F,F-P-z);Math.abs(K)>=te&&(m.current=ee?"end":"start",f.current=P),g=P<=0,w=P+z>=F,k=P<=G,b=P+z>=F-W,l({scrollDirection:m.current,reachStart:g,reachEnd:w,nearReachStart:k,nearReachEnd:b})},500,{leading:!1});return kt(()=>{const g=n.current;return g&&(f.current=g[h?"scrollTop":"scrollLeft"],g.addEventListener("scroll",y,{passive:!0})),()=>{g&&g.removeEventListener("scroll",y)}},[]),V(()=>{r&&n.current&&queueMicrotask(()=>{n.current.dispatchEvent(new Event("scroll"))})},[r]),{resetScrollDirection:()=>{m.current=null}}}function dd({class:n,statusID:i,status:s,instance:o,parent:c,onMediaClick:a}){const{_:u}=ie();let d=ht(i,o);const r=Ge(E);if(s||(s=r.statuses[d]||r.statuses[i],d=ht(s?.id,o)),!s)return null;const{account:{acct:l,avatar:h,avatarStatic:f,id:m,url:y,displayName:g,username:w,emojis:k,bot:b,group:v},id:_,repliesCount:S,reblogged:A,reblogsCount:C,favourited:x,favouritesCount:L,bookmarked:P,poll:F,muted:z,sensitive:K,spoilerText:ee,visibility:te,language:G,editedAt:W,filtered:H,card:Y,createdAt:$,inReplyToId:Q,inReplyToAccountId:j,content:Z,mentions:le,mediaAttachments:ne,reblog:J,uri:we,url:be,emojis:ke,_deleted:ze,_pinned:_e}=s;if(!ne?.length)return null;const Te=Be=>{Be.shiftKey},xe=Se(()=>wt(),[]),qe=Se(()=>xe&&xe===m,[m,xe]),Ue=xc(ii),He=!qe&&sn(H,Ue);if(He?.action==="hide")return null;const We=K,Ie=($i()["reading:expand:media"]?.toLowerCase()||"default")==="show_all",oe=c||"div";return ne.map((Be,Ee)=>{const Le=`${d}-${Be.id}`,M=He?.titlesStr;return e(oe,{"data-state-post-id":d,onMouseEnter:Te,"data-spoiler-text":ee||(K?u({id:"FKojeB"}):void 0),"data-filtered-text":He?u(M?{id:"7FGvtQ",values:{filterTitleStr:M}}:{id:"03Qqf9"}):void 0,class:`
|
||
media-post
|
||
${He?"filtered":""}
|
||
${We?"has-spoiler":""}
|
||
${Ie?"show-media":""}
|
||
`,children:e(mo,{class:n,media:Be,lang:G,to:`/${o}/s/${_}?media-only=${Ee+1}`,onClick:a?ge=>a(ge,Ee,Be,s):void 0})},Le)})}const qs=rt(dd);function ud(n){const{_:i}=ie(),s=Ge(E),{masto:o,instance:c,authenticated:a}=se(),[u,d]=Se(()=>{const _=nn();return[_.find(A=>A.info.id===wt())||_[0],_.length>1]},[]),r=(s.settings.shortcutsViewMode==="multi-column"||!s.settings.shortcutsViewMode&&s.settings.shortcutsColumnsMode)&&!s.shortcuts.find(_=>_.type==="following"),l=ao(()=>{E.showAccounts=!0},{threshold:600,detect:"touch",cancelOnMovement:!0}),h=B(),[f,m]=R(void 0),y=lo([0,0,s.settings.shortcutsViewMode==="tab-menu-bar"?50:0,0]),g=B();async function w(_){return(_||!g.current)&&(g.current=o.v1.mutes.list({limit:80}).values()),await g.current.next()}const k=B();async function b(_){return(_||!k.current)&&(k.current=o.v1.blocks.list({limit:80}).values()),await k.current.next()}const v=B();return e(N,{children:[e("button",{ref:h,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:u?.info?.avatar||u?.info?.avatarStatic,size:"l",squircle:u?.info?.bot}),e(I,{icon:"menu",size:d?"s":"l",alt:i({id:"zucql+"})})]}),e(Ui,{menuClassName:"nav-menu",state:f,anchorRef:h,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:y,unmountOnClose:!0,children:[!!s.appVersion?.commitHash&&s.appVersion.commitHash!=="2e1d0c4"&&e("div",{class:"top-menu",children:[e(ye,{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(Ve,{})]}),e("section",{children:[e(Ye,{to:"/",children:[e(I,{icon:"home",size:"l"})," ",e("span",{children:e(p,{id:"i0qMbr"})})]}),a?e(N,{children:[r&&e(Ye,{to:"/following",children:[e(I,{icon:"following",size:"l"})," ",e("span",{children:e(p,{id:"following.title"})})]}),e(Ye,{to:"/catchup",children:[e(I,{icon:"history2",size:"l"}),e("span",{children:e(p,{id:"xrl8fj"})})]}),Qe("@mastodon/mentions")&&e(Ye,{to:"/mentions",children:[e(I,{icon:"at",size:"l"})," ",e("span",{children:e(p,{id:"/bZzdR"})})]}),e(Ye,{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(Ve,{}),u?.info?.id&&e(Ye,{to:`/${c}/a/${u.info.id}`,children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(p,{id:"vERlcd"})})]}),e(hd,{menuState:f}),e(Ye,{to:"/b",children:[e(I,{icon:"bookmark",size:"l"})," ",e("span",{children:e(p,{id:"7Ff7ia"})})]}),e(kn,{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(Ye,{to:"/f",children:[e(I,{icon:"heart",size:"l"})," ",e("span",{children:e(p,{id:"zZOZj7"})})]}),e(Ye,{to:"/fh",children:[e(I,{icon:"hashtag",size:"l"})," ",e("span",{children:e(p,{id:"Xi1/bw"})})]}),e(Ye,{to:"/sp",children:[e(I,{icon:"schedule",size:"l"})," ",e("span",{children:e(p,{id:"+GkIdc"})})]}),e(Ve,{}),Qe("@mastodon/filters")&&e(Ye,{to:"/ft",children:[e(I,{icon:"filters",size:"l"})," ",e("span",{children:e(p,{id:"cSev+j"})})]}),e(ye,{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(ye,{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(Ve,{}),e(ye,{onClick:()=>{E.showAccounts=!0},children:[e(I,{icon:"group",size:"l"})," ",e("span",{children:e(p,{id:"7e0O8Z"})})]})]}):e(N,{children:[e(Ve,{}),e(Ye,{to:"/login",children:[e(I,{icon:"user",size:"l"})," ",e("span",{children:e(p,{id:"sQia9P"})})]})]})]}),e("section",{children:[e(Ve,{}),e(Ye,{to:"/search",children:[e(I,{icon:"search",size:"l"})," ",e("span",{children:e(p,{id:"A1taO8"})})]}),e(Ye,{to:`/${c}/trending`,children:[e(I,{icon:"chart",size:"l"})," ",e("span",{children:e(p,{id:"4/iCqx"})})]}),e(Ye,{to:`/${c}/p/l`,children:[e(I,{icon:"building",size:"l"})," ",e("span",{children:e(p,{id:"d5zxa4"})})]}),e(Ye,{to:`/${c}/p`,children:[e(I,{icon:"earth",size:"l"})," ",e("span",{children:e(p,{id:"4ERYY7"})})]}),a?e(N,{children:[e(Ve,{className:"divider-grow"}),e(ye,{onClick:()=>{E.showKeyboardShortcutsHelp=!0},children:[e(I,{icon:"keyboard",size:"l"})," ",e("span",{children:e(p,{id:"77Emn0"})})]}),e(ye,{onClick:()=>{E.showShortcutsSettings=!0},children:[e(I,{icon:"shortcut",size:"l"})," ",e("span",{children:e(p,{id:"8Kudkr"})})]}),e(ye,{onClick:()=>{E.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(p,{id:"uVbUP8"})})]})]}):e(N,{children:[e(Ve,{}),e(ye,{onClick:()=>{E.showSettings=!0},children:[e(I,{icon:"gear",size:"l"})," ",e("span",{children:e(p,{id:"uVbUP8"})})]})]})]})]})]})}function hd({menuState:n}){const i=Qe("@mastodon/lists"),[s,o]=R([]);return V(()=>{i&&n==="open"&&Sn().then(o)},[n,i]),s.length>0?e(kn,{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(Ye,{to:"/l",children:e("span",{children:e(p,{id:"BHWx+g"})})}),s?.length>0&&e(N,{children:[e(Ve,{}),s.map(c=>e(Ye,{to:`/l/${c.id}`,children:e("span",{children:[c.title,c.exclusive&&e(N,{children:[" ",e(Zt,{})]})]})},c.id))]})]}):i&&e(Ye,{to:"/l",children:[e(I,{icon:"list",size:"l"}),e("span",{children:e(p,{id:"h16FyT"})})]})}const Ft=rt(ud),An={block:"start",inline:"center",behavior:"instant"};function Mt({title:n,titleComponent:i,id:s,instance:o,emptyText:c,errorText:a,useItemID:u,boostsCarousel:d,fetchItems:r=()=>{},checkForUpdates:l=()=>{},checkForUpdatesInterval:h=15e3,headerStart:f,headerEnd:m,timelineStart:y,refresh:g,view:w,filterContext:k,showFollowedTags:b,showReplyParent:v,clearWhenRefresh:_}){const{_:S}=ie(),A=Ge(E),[C,x]=R([]),[L,P]=R("start"),[F,z]=R(!1),[K,ee]=R(!1),[te,G]=R(!0),W=B();__BENCHMARK.start(`timeline-${s}-load`);const H=Se(()=>Oi(),[]),Y=w!=="media",$=B(0),Q=Qc(ce=>{ee(!1),P("loading"),(async()=>{try{const Me=$.current=Date.now();let{done:Ie,value:oe}=await r(ce);if(Me!==$.current)return;if(Array.isArray(oe)){const[Be,Ee]=oe.reduce((Le,M)=>(M._pinned?Le[0].push(M):Le[1].push(M),Le),[[],[]]);oe=Ee,Y&&(d&&(oe=sd(oe)),oe=od(oe,o)),Be.length&&(oe=Be.concat(oe)),x(ce?oe:Le=>[...Le,...oe]),oe.length||(Ie=!0),z(!Ie)}else z(!1);P("default"),__BENCHMARK.end(`timeline-${s}-load`)}catch{P("error"),ce&&!C.length&&a&&de(a)}finally{Q.cancel()}})()},1e3,{leading:!0}),j=".timeline-item, .timeline-item-alt",Z=Ke("j, shift+j",(ce,Me)=>{if(ce.shiftKey!==Me.shift)return;const Ie=document.activeElement.closest(j),oe=Ie?.getBoundingClientRect(),Be=Array.from(W.current.querySelectorAll(j)).filter(Ee=>!!Ee.offsetHeight);if(Ie&&oe.top<W.current.clientHeight&&oe.bottom>0){const Ee=Be.indexOf(Ie);let Le=Be[Ee+1];Me.shift&&(Le=Be.find((M,ge)=>ge>Ee&&!M.classList.contains("timeline-item-alt"))),Le&&(Le.focus(),Le.scrollIntoView(An))}else{const Ee=Be.find(Le=>{const M=Le.getBoundingClientRect();return M.top>=44&&M.left>=0});Ee&&(Ee.focus(),Ee.scrollIntoView(An))}},{useKey:!0,ignoreEventWhen:ce=>ce.metaKey||ce.ctrlKey||ce.altKey}),le=Ke("k, shift+k",(ce,Me)=>{if(ce.shiftKey!==Me.shift)return;const Ie=document.activeElement.closest(j),oe=Ie?.getBoundingClientRect(),Be=Array.from(W.current.querySelectorAll(j)).filter(Ee=>!!Ee.offsetHeight);if(Ie&&oe.top<W.current.clientHeight&&oe.bottom>0){const Ee=Be.indexOf(Ie);let Le=Be[Ee-1];Me.shift&&(Le=Be.findLast((M,ge)=>ge<Ee&&!M.classList.contains("timeline-item-alt"))),Le&&(Le.focus(),Le.scrollIntoView(An))}else{const Ee=Be.find(Le=>{const M=Le.getBoundingClientRect();return M.top>=44&&M.left>=0});Ee&&(Ee.focus(),Ee.scrollIntoView(An))}},{useKey:!0,ignoreEventWhen:ce=>ce.metaKey||ce.ctrlKey||ce.altKey}),ne=Ke(["enter","o"],()=>{const ce=document.activeElement;ce?.matches(j)&&ce.click()},{useKey:!0,ignoreEventWhen:ce=>ce.metaKey||ce.ctrlKey||ce.altKey||ce.shiftKey}),J=C.length>0&&L!=="loading"&&K,we=st(()=>{J&&Q(!0),W.current?.scrollTo({top:0,behavior:"smooth"})},[Q,J]),be=Ke(".",we,{useKey:!0,ignoreEventWhen:ce=>ce.metaKey||ce.ctrlKey||ce.altKey||ce.shiftKey}),ke=B(),[ze,_e]=R(!1),Te=st(({scrollDirection:ce,nearReachStart:Me,reachStart:Ie})=>{if(ke.current){const oe=ce==="end"&&!Me;ke.current.hidden=oe}_e(Me),Ie&&Q(!0)},[_e,Q]),{resetScrollDirection:xe}=ld({scrollableRef:W,distanceFromEnd:2,scrollThresholdStart:44},Te);V(()=>{W.current?.scrollTo({top:0}),Q(!0)},[]);const qe=B(!0);V(()=>{if(qe.current){qe.current=!1;return}_&&C?.length&&(Q.cancel?.(),x([])),Q(!0)},[_,g]);const Ue=B(w);V(()=>{Ue.current!==w&&(Ue.current=w,x([]))},[w]);const He=st(async({disableIdleCheck:ce=!1}={})=>{const Me=W.current?getComputedStyle(W.current).pointerEvents==="none":!1;A.settings.autoRefresh&&W.current.scrollTop<16&&(ce||window.__IDLE__)&&!gd()&&!Me?Q(!0):await l()&&ee(!0)},[s,Q,l,A.settings.autoRefresh]),We=B();return on(ce=>{if(ce){const Me=Date.now()-We.current;(!We.current||Me>1e3*3)&&He({disableIdleCheck:!0})}else We.current=Date.now();G(ce)},[l,He,A.settings.autoRefresh]),Fi(He,te&&!K?h*(ze?1:2):null),e(ii.Provider,{value:k,children:e("div",{id:`${s}-page`,class:`deck-container ${H?"deck-container-media-first":""}`,ref:ce=>{W.current=ce,Z.current=ce,le.current=ce,ne.current=ce,be.current=ce},tabIndex:"-1",onClick:ce=>{ke.current&&ce.target.closest(".timeline-item, .timeline-item-alt")&&setTimeout(()=>{ke.current.hidden=!1,xe()},250)},children:e("div",{class:"timeline-deck deck",children:[e("header",{ref:ke,onClick:ce=>{ce.target.closest("a, button")||W.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:ce=>{ce.target.closest("a, button")||Q(!0)},class:L==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Ft,{}),f??e(ve,{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})]}),J&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:we,children:[e(I,{icon:"arrow-up"})," ",e(p,{id:"2yr1/p"})]})]}),!!y&&e("div",{class:`timeline-start ${L==="loading"?"loading":""}`,children:y}),C.length?e(N,{children:[e("ul",{class:`timeline ${w?`timeline-${w}`:""}`,children:[C.map(ce=>e(fd,{status:ce,instance:o,useItemID:u,filterContext:k,view:w,showFollowedTags:b,showReplyParent:v,mediaFirst:H},ce.id+ce?._pinned+w)),F&&L==="loading"&&(w==="media"?null:e(N,{children:[e("li",{style:{height:"20vh"},children:e(je,{skeleton:!0,mediaFirst:H})}),e("li",{style:{height:"25vh"},children:e(je,{skeleton:!0,mediaFirst:H})})]}))]}),L==="default"&&(F?e(Lt,{root:W.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:ce=>{ce&&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"})}))]}):L==="loading"?e("ul",{class:"timeline",children:Array.from({length:5}).map((ce,Me)=>w==="media"?e("div",{style:{height:"50vh"}}):e("li",{children:e(je,{skeleton:!0,mediaFirst:H})},Me))}):L!=="error"&&L!=="start"&&e("p",{class:"ui-state",children:c}),L==="error"&&e("p",{class:"ui-state",children:[a,e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>Q(!C.length),children:e(p,{id:"KDw4GX"})})]})]})})})}const fd=rt(({status:n,instance:i,useItemID:s,filterContext:o,view:c,showFollowedTags:a,showReplyParent:u,mediaFirst:d})=>{const{_:r}=ie(),{id:l,reblog:h,items:f,type:m,_pinned:y}=n;y&&(s=!1);const g=h?.id||l,w=i?`/${i}/s/${g}`:`/s/${g}`;if(f){let b=Gt(f,o),v="";if(m==="boosts"?v=pe._({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 L=sn(C.filtered,o),P=sn(x.filtered,o);return L&&L?.action!=="blur"&&A.add(C.id),P&&P?.action!=="blur"&&A.add(x.id),L&&!P?1:!L&&P?-1:0}),A.size>=2){const x=[],L=[];b.forEach(F=>{A.has(F.id)?L.push(F):x.push(F)});const P=[];for(let F=0;F<L.length;F+=5)P.push({_grouped:!0,posts:L.slice(F,F+5)});b=x.concat(P)}return e("li",{class:"timeline-item-carousel",children:e(pd,{title:v,class:`${m}-carousel`,children:b.map(C=>{const{id:x,reblog:L,_pinned:P,_grouped:F}=C;if(F)return e("li",{class:"timeline-item-carousel-group",children:C.posts.map(ee=>{const{id:te,reblog:G,_pinned:W}=ee,H=G?.id||te,Y=i?`/${i}/s/${H}`:`/s/${H}`;return W&&(s=!1),e(ve,{class:"status-carousel-link timeline-item-alt",to:Y,children:s?e(je,{statusID:te,instance:i,size:"s"}):e(je,{status:ee,instance:i,size:"s"})})})},x);const z=L?.id||x,K=i?`/${i}/s/${z}`:`/s/${z}`;return P&&(s=!1),e("li",{children:e(ve,{class:"status-carousel-link timeline-item-alt",to:K,children:s?e(je,{statusID:x,instance:i,size:"s",contentTextWeight:!0,enableCommentHint:!0,mediaFirst:d}):e(je,{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:L}=A,P=i?`/${i}/s/${x}`:`/s/${x}`,F=C>0&&C<b.length-1,z=A.sensitive&&!!A.spoilerText,K=!L&&z&&C>0||S&&F&&(m==="thread"||m==="conversation"&&!L&&!b[C-1]._differentAuthor&&!b[C+1]._differentAuthor),ee=C===0,te=C===b.length-1;return e("li",{class:`timeline-item-container timeline-item-container-type-${m} timeline-item-container-${ee?"start":te?"end":"middle"} ${L?"timeline-item-diff-author":""}`,children:e(ve,{class:"status-link timeline-item",to:P,children:K?e(md,{status:A,instance:i,filterContext:o}):s?e(je,{statusID:x,instance:i,enableCommentHint:te,showFollowedTags:a}):e(je,{status:A,instance:i,enableCommentHint:te,showFollowedTags:a})})},`timeline-${x}`)})}const k=`timeline-${l+y}`;return c==="media"?s?e(qs,{class:"timeline-item",parent:"li",statusID:l,instance:i},k):e(qs,{class:"timeline-item",parent:"li",status:n,instance:i},k):e("li",{children:e(ve,{class:"status-link timeline-item",to:w,children:s?e(je,{statusID:l,instance:i,enableCommentHint:!0,showFollowedTags:a,showReplyParent:u,mediaFirst:d}):e(je,{status:n,instance:i,enableCommentHint:!0,showFollowedTags:a,showReplyParent:u,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 pd({title:n,class:i,children:s}){const{_:o}=ie(),c=B(),a=B(),u=B(),[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:a,type:"button",class:"small plain2",onClick:()=>{const l=Math.min(320,c.current?.offsetWidth)*(jt()?1:-1);c.current?.scrollBy({left:l,behavior:"smooth"})},children:e(I,{icon:"chevron-left",alt:o({id:"DHhJ7s"})})})," ",e("button",{ref:u,type:"button",class:"small plain2",onClick:()=>{const l=Math.min(320,c.current?.offsetWidth)*(jt()?-1:1);c.current?.scrollBy({left:l,behavior:"smooth"})},children:e(I,{icon:"chevron-right",alt:o({id:"hXzOVo"})})})]})]}),e("ul",{ref:c,children:[e(Lt,{class:"status-carousel-beacon",onChange:l=>{a.current&&(a.current.disabled=l)}}),s[0],d&&s.slice(1),e(Lt,{class:"status-carousel-beacon",onChange:l=>{u.current&&(u.current.disabled=l)}})]})]})}function md({status:n,instance:i,filterContext:s}){const{_:o}=ie(),c=Ge(E),{id:a,visibility:u,language:d}=n,r=ti(n),l=ht(a,i),h=sn(n.filtered,s);return e("article",{class:`status compact-thread ${u==="direct"?"visibility-direct":""}`,tabindex:"-1",children:[e("div",{class:"status-thread-badge-container",children:e(Jc,{index:c.statusThreadNumber[l]})}),e("div",{class:"content-compact",title:r,lang:d,dir:"auto",children:h&&h?.action!=="blur"?e("b",{class:"status-filtered-badge badge-meta horizontal",title:h?.titlesStr||"",children:h?.titlesStr?e(p,{id:"sr6maL",values:{0:h.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 gd(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}const en=20,ss=1983,Fs=`${ss}-01`,yd=zi(()=>{try{const n=document.createElement("input");return n.setAttribute("type","month"),n.type==="month"}catch{return!1}});function vd(){const{i18n:n,_:i}=ie(),s=Ge(E),{id:o,...c}=qt(),[a,u]=Ct(),d=a.get("month"),r=!a.get("replies"),l=!!a.get("boosts"),h=a.get("tagged"),f=!!a.get("media"),{masto:m,instance:y,authenticated:g}=se({instance:c.instance}),{masto:w,instance:k}=se(),b=B(),v=[d,r,l,h,f],[_,S]=R(),A=B(0);V(()=>{A.current=0},v);const C=Se(()=>Oi(),[]),x=Se(()=>y===k,[y,k]),[L,P]=R(!1);V(()=>{x&&_?.acct&&(async()=>{const ne=await Eo(y);P(ne)})()},[y,x,_?.acct]);async function F(ne){const J=/^\d{4}-[01]\d$/.test(d),we=d?.split?.("-")?.[0]>=ss;if(J&&we){if(!_)return{value:[],done:!0};const[_e,Te]=d.split("-"),xe=parseInt(Te,10)-1,qe=new Date(_e,xe,0),Ue=`${qe.getFullYear()}-${(qe.getMonth()+1).toString().padStart(2,"0")}-${qe.getDate().toString().padStart(2,"0")}`,He=new Date(_e,xe+1,1),We=`${He.getFullYear()}-${(He.getMonth()+1).toString().padStart(2,"0")}-${He.getDate().toString().padStart(2,"0")}`;let ce;ne?(ce=en+1,A.current=0):(ce=en+A.current+1,A.current+=en);const Me=await m.v2.search.list({q:`from:${_.acct} after:${Ue} before:${We}`,type:"statuses",limit:ce,offset:A.current});if(Me?.statuses?.length){const Ie=Me.statuses.slice(0,en);Ie.forEach(Be=>{Je(Be,y)});const oe=Me.statuses.length<=en;return{value:Ie,done:oe}}else return{value:[],done:!0}}let be=[];if(ne){const{value:_e}=await m.v1.accounts.$select(o).statuses.list({pinned:!0}).values().next();if(_e?.length&&!h&&!f){const Te=_e.map(xe=>(Je(xe,y),{...xe,_pinned:!0}));if(Te.length>=3){const xe=Te.map(qe=>qe.id);be.push({id:xe,items:Te,type:"pinned"})}else be.push(...Te)}}(ne||!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:h}).values());const{value:ke,done:ze}=await b.current.next();if(ke?.length){if(!Qe("@mastodon/pinned-posts")&&be.length){let _e=[];be[0]?.type==="pinned"?_e=be[0].id:_e=be.filter(xe=>xe._pinned).map(xe=>xe.id),_e.every(xe=>ke.some(qe=>qe.id===xe))&&(be=[])}be.push(...ke),ke.forEach(_e=>{Je(_e,y)})}return{value:be,done:ze}}const[z,K]=R([]);let ee=i({id:"/cKnpj"});if(_?.acct){const ne=(/@/.test(_.acct)?"":"@")+_.acct,J=_?.displayName?`${_.displayName} (${ne})`:`${ne}`;if(!r)ee=i({id:"hS1Opy",values:{accountDisplay:J}});else if(l)ee=i({id:"A/CX5F",values:{accountDisplay:J}});else if(h)ee=i({id:"QQrO94",values:{accountDisplay:J,tagged:h}});else if(f)ee=i({id:"NoG5wD",values:{accountDisplay:J}});else if(d){const we=new Date(d).toLocaleString(n.locale,{month:"long",year:"numeric"});ee=i({id:"8GjLvB",values:{accountDisplay:J,monthYear:we}})}else ee=J}et(ee,"/:instance?/a/:id");const te=st(()=>kd(o,m),[o,m]);V(()=>{(async()=>{try{const ne=await te();S(ne)}catch{}if(!C)try{const ne=await m.v1.accounts.$select(o).featuredTags.list();K(ne)}catch{}})()},[o,C]);const{displayName:G,acct:W,emojis:H}=_||{},Y=Se(()=>_?.id===wt(),[_?.id]),$=B(),Q=Se(()=>{const ne=!r||l||h||f||!!d,J=s.accounts[`${o}@${y}`];return e(N,{children:[e(Mo,{instance:y,account:J||o,fetchAccount:te,authenticated:g,standalone:!0,showEndorsements:!0}),!C&&e("div",{class:"filter-bar",ref:$,style:{position:"relative"},children:[ne?e(ve,{to:`/${y}/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(ve,{to:`/${y}/a/${o}${r?"?replies=1":""}`,onClick:()=>{r&&de(i({id:"PIWNSQ"}))},class:r?"":"is-active",children:e(p,{id:"5BFynH"})}),e(ve,{to:`/${y}/a/${o}${l?"":"?boosts=0"}`,onClick:()=>{l||de(i({id:"Qd13i0"}))},class:l?"is-active":"",children:e(p,{id:"usxQx0"})}),e(ve,{to:`/${y}/a/${o}${f?"":"?media=1"}`,onClick:()=>{f||de(i({id:"rKpfPY"}))},class:f?"is-active":"",children:e(p,{id:"xYilR2"})}),z.map(we=>e(ve,{to:`/${y}/a/${o}${h===we.name?"":`?tagged=${encodeURIComponent(we.name)}`}`,onClick:()=>{h!==we.name&&de(i({id:"L+HFfr",values:{0:we.name}}))},class:h===we.name?"is-active":"",children:e("span",{children:[e("span",{class:"more-insignificant",children:"#"}),we.name]})},we.id)),L&&e(N,{children:[yd()?e("label",{class:`filter-field ${d?"is-active":""}`,children:[e(I,{icon:"month",size:"l"}),e("input",{type:"month",disabled:!_?.acct,value:d||"",min:Fs,max:new Date().toISOString().slice(0,7),onInput:we=>{const{value:be,validity:ke}=we.currentTarget;if(!ke.valid)return;u(be?{month:be}:{});const[ze,_e]=be.split("-"),Te=parseInt(_e,10)-1,xe=new Date(ze,Te);de(i({id:"0WUFGD",values:{0:xe.toLocaleString(n.locale,{month:"long",year:"numeric"})}}))}})]}):e(bd,{class:`filter-field ${d?"is-active":""}`,disabled:!_?.acct,value:d||"",min:Fs,max:new Date().toISOString().slice(0,7),onInput:we=>{const{value:be,validity:ke}=we;ke.valid&&u(be?{month:be}:{})}}),e("button",{type:"button",class:"filter-field",onClick:()=>{E.showSearchCommand={query:Y?"from:me ":`from:${_?.acct} `}},children:e(I,{icon:"search",size:"l",alt:i(Y?{id:"BmW9JG"}:{id:"h7t/Tx",values:{0:_?.username}})})})]})]})]})},[o,y,g,z,te,L,...v]);V(()=>{const ne=$.current?.querySelector(".is-active");ne&&$.current.scrollTo({behavior:"smooth",left:ne.offsetLeft-($.current.offsetWidth-ne.offsetWidth)/2})},[z,L,...v]);const j=Se(()=>_?.url?URL.parse(_.url)?.hostname:null,[_]),le=!!_&&!(y===j);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(po,{text:G,emojis:H,resolverURL:_?.url})}),e("div",{children:e("span",{class:"bidi-isolate",children:["@",W]})})]}),id:"account-statuses",instance:y,emptyText:i({id:"+k97fV"}),errorText:i({id:"scd9lw"}),fetchItems:F,useItemID:!0,view:f||C?"media":void 0,boostsCarousel:s.settings.boostsCarousel,timelineStart:Q,refresh:[r,l,h,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(ye,{disabled:!le,onClick:()=>{(async()=>{try{const{masto:ne}=se({instance:j}),J=await ne.v1.accounts.lookup({acct:_.acct}),{id:we}=J;location.hash=`/${j}/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:j?e(N,{children:[" ","(",e("b",{children:ei.toUnicode(j)}),")"]}):null}})})]}),!x&&e(ye,{onClick:()=>{(async()=>{try{const ne=await w.v1.accounts.lookup({acct:_.acct+"@"+y}),{id:J}=ne;location.hash=`/${k}/a/${J}`}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),W&&!Y&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`@${W} `}})})]})}function bd(n){const{i18n:i}=ie(),{class:s,disabled:o,value:c,min:a,max:u,onInput:d=()=>{}}=n,[r,l]=c?.split("-")||[],h=B(),f=B(),m=(y,g)=>{const[w,k]=a?.split("-")||[],[b,v]=u?.split("-")||[];return!(g<w||g>b||g===w&&y<k||g===b&&y>v)};return e("div",{class:s,children:[e(I,{icon:"month",size:"l"}),e("select",{ref:h,disabled:o,value:l||"",onInput:y=>{const{value:g}=y.currentTarget,w=f.current.value;if(!m(g,w))return{value:"",validity:{valid:!1}};d({value:g?`${w}-${g}`:"",validity:{valid:!0}})},children:[e("option",{value:"",children:e(p,{id:"HajiZl"})}),e("option",{disabled:!0,children:"-----"}),Array.from({length:12},(y,g)=>e("option",{value:(g+1).toString().padStart(2,"0"),children:new Date(0,g).toLocaleString(i.locale,{month:"long"})},g))]})," ",e("input",{ref:f,type:"number",disabled:o,value:r||new Date().getFullYear(),min:a?.slice(0,4)||ss,max:u?.slice(0,4)||new Date().getFullYear(),onInput:y=>{const{value:g,validity:w}=y.currentTarget,k=h.current.value;if(!w.valid||!m(k,g))return{value:"",validity:{valid:!1}};d({value:g?`${g}-${k}`:"",validity:{valid:!0}})},style:{width:"4.5em"}})]})}function wd(n,i){return i.v1.accounts.$select(n).fetch()}const kd=St(wd,{expires:1800*1e3});function Sd(){const n=qt(),{year:i}=n;et(i?`${i} #Wrapstodon`:"#Wrapstodon","/annual_report/:year");const{masto:s,instance:o}=se(),[c,a]=R(null),[u,d]=R("default");V(()=>{i&&(async()=>{d("loading");const y=await s.v1.annualReports.$select(i).fetch();a(y),d("default")})()},[i]);const{accounts:r,annualReports:l,statuses:h}=c||{},f=l?.find(y=>y.year==i)?.data,m=new Date;return e("div",{id:"annual-report-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:`report ${u==="loading"?"loading-mask":""}`,children:[e("h1",{children:[i," #Wrapstodon"]}),!!f&&e("dl",{children:Object.entries(f).map(([y,g])=>{const w={};return Array.isArray(g)&&g.forEach(k=>{Object.entries(k).forEach(([b,v])=>{typeof v=="number"&&(w[b]=(w[b]||0)+v)})}),e(N,{children:[e("dt",{children:y}),e("dd",{class:`report-${y}`,children:Array.isArray(g)?e("table",{children:[e("thead",{children:e("tr",{children:Object.entries(g[0]).map(([k,b])=>e("th",{class:k!=="month"&&typeof b=="number"?"number":"",children:k}))})}),e("tbody",{children:g.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(y)?r?.find(_=>_.id===v)?e(mt,{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 g=="object"?/^(topStatuses)$/i.test(y)?e("dl",{children:Object.entries(g).map(([k,b])=>e(N,{children:[e("dt",{children:k}),e("dd",{children:b&&e(ve,{to:`/${o}/s/${b}`,children:e(je,{status:h?.find(v=>v.id===b),size:"s",readOnly:!0,showCommentCount:!0})})})]}))}):e("table",{children:e("tbody",{children:Object.entries(g).map(([k,b])=>e("tr",{children:[e("th",{children:k}),e("td",{class:typeof b=="number"?"number":"",children:b})]}))})}):typeof g=="string"?g:JSON.stringify(g,null,2)})]})})})]}),e("hr",{}),e("p",{style:{textAlign:"center"},children:e(ve,{to:"/",children:e(p,{id:"iWpEwy"})})})]})}const Cd=20;function Vo(){const{_:n}=ie();et(n({id:"7Ff7ia"}),"/b");const{masto:i,instance:s}=se(),o=B();async function c(a){return(a||!o.current)&&(o.current=i.v1.bookmarks.list({limit:Cd}).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:c})}const Go=""+new URL("catch-up-O5q5C75Z.png",import.meta.url).href,_d="home",Bt="catchup",It=[{label:{id:"Ov9hfp"},value:1},{label:{id:"tVE2wM"},value:2},{label:{id:"8+HOWa"},value:3},{label:{id:"1o+mEC"},value:4},{label:{id:"dZZ8oA"},value:5},{label:{id:"lpPucp"},value:6},{label:{id:"r9r5X6"},value:7},{label:{id:"I9uBFA"},value:8},{label:{id:"pBYFlb"},value:9},{label:{id:"wvL7OJ"},value:10},{label:{id:"7Vb+qD"},value:11},{label:{id:"VU1Pnd"},value:12},{label:{id:"vpc27K"},value:13,beyond:!0}],Id={original:{id:"HxF6Fk"},replies:{id:"N8UzTV"},quotes:{id:"eWLklq"},boosts:{id:"puY2t0"},followedTags:{id:"lCLRBe"},groups:{id:"zhrjek"},filtered:{id:"03Qqf9"}},Ad=["createdAt","repliesCount","favouritesCount","reblogsCount","density"],xd=[null,"account"],Td=zi(n=>new Intl.DateTimeFormat(n||void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"}));function Qn(n){return n?.id||n?.quotedStatus?.id}function Ed(){const{i18n:n,_:i,_:s}=ie(),o=Td(n.locale);et("Catch-up","/catchup");const{masto:c,instance:a}=se(),[u,d]=Ct(),r=u.get("id"),[l,h]=R("start"),[f,m]=R(!1),y=Se(()=>wt(),[]),g=T=>T===y,w=Qe("@pixelfed/home-include-reblogs");async function k({maxCreatedAt:T}){const q=[],X=c.v1.timelines.home.list({limit:40}),ae=X.values();e:for(;;)try{w&&X.params&&(typeof X.params=="string"?X.params+="&include_reblogs=true":X.params.include_reblogs=!0);const O=await ae.next(),{value:ue}=O;if(ue?.length){await Yo(ue,a);let Ae=!1;for(let me=0;me<ue.length;me++){const Re=ue[me],U=Date.parse(Re.createdAt);if(!T||U>=T){const De=!g(Re.reblog?.account?.id||Re.account.id)&&sn(Re.reblog?.filtered||Re.filtered,_d);if(De?.action==="hide")continue;Re._filtered=De;const $e=ht(Re.id,a);Re._followedTags=E.statusFollowedTags[$e]?[...E.statusFollowedTags[$e]]:[],q.push(Re),Ae=!0}if(!Ae)break e}}else break e;await new Promise(Ae=>setTimeout(Ae,1e3))}catch{break e}return q.forEach(O=>{if(O?.inReplyToId){const ue=q.find(Ae=>Ae.id===O.inReplyToId);ue&&!ue.inReplyToId&&(ue._thread=!0)}}),q}const[b,v]=R([]),_=B(),S=B(),A=Se(()=>Kn(),[]),C=st(async({duration:T}={})=>{const q=Date.now(),X=T?q-T:null;h("loading");const ae=await k({maxCreatedAt:X}),O=`${A}-${ea()}`;try{await bt.catchup.set(O,{id:O,posts:ae,count:ae.length,startAt:X,endAt:q}),d({id:O})}catch{}},[]);V(()=>{r?(async()=>{const T=await bt.catchup.get(r);T&&(T.posts.sort((q,X)=>q.createdAt>X.createdAt?1:-1),v(T.posts),h("results"))})():l==="results"&&(v([]),h("start"))},[r]);const[x,L]=$t(T=>T+1,0),[P,F]=R(null),[z,K]=R([]);V(()=>{const T=new Set(z.map(q=>q.id));for(let q=sessionStorage.length-1;q>=0;q--){const X=sessionStorage.key(q);if(X?.startsWith(`${Bt}-`)){const ae=X.replace(`${Bt}-`,"");T.has(ae)||Ce.session.del(X)}}},[z]),V(()=>{(async()=>{try{const T=await bt.catchup.keys();if(T.length){const q=Kn(),X=T.filter(ae=>ae.startsWith(`${q}-`));if(X.length){let ae=await bt.catchup.getMany(X);ae.sort((me,Re)=>Re.endAt-me.endAt);let O=ae.slice(0,3),ue=ae.slice(3);const Ae=O.map(me=>{const{id:Re,count:U,startAt:he,endAt:De}=me;return{id:Re,count:U,startAt:he,endAt:De}});K(Ae),F(O[0].endAt),ae=null,O=null,queueMicrotask(()=>{ue.length&&bt.catchup.delMany(ue.map(me=>me.id)).then(()=>{ue=null}).catch(me=>{})});return}}}catch{}K([])})()},[x]),V(()=>{l==="start"&&L()},[l==="start"]);const[ee,te]=Se(()=>{let T=0,q=0,X=0,ae=0,O=0,ue=0,Ae=0;const me={};for(const U of b){U._filtered&&U._filtered?.action!=="blur"?(T++,U.__FILTER="filtered"):U.group?(q++,U.__FILTER="groups"):U.reblog?(X++,U.__FILTER="boosts"):Vt()&&Qn(U.quote)?(ae++,U.__FILTER="quotes"):U._followedTags?.length?(ue++,U.__FILTER="followedTags"):U.inReplyToId&&U.inReplyToAccountId!==U.account?.id?(O++,U.__FILTER="replies"):(Ae++,U.__FILTER="original");const he=U.reblog||U;if(U.__FILTER!=="filtered"&&he.card?.url&&he.card?.image&&he.card?.type==="link"){const{card:De,favouritesCount:$e,reblogsCount:nt}=he;let{url:tt}=De;if(tt=tt.replace(/\/$/,""),!me[tt])me[tt]={postID:he.id,card:De,shared:1,sharers:[U.account],likes:$e,boosts:nt};else{if(me[tt].sharers.find(_t=>_t.id===U.account.id))continue;me[tt].shared++,me[tt].sharers.push(U.account),me[tt].postID!==he.id&&(me[tt].likes+=$e,me[tt].boosts+=nt)}}}let Re=[];for(const U in me)Re.push({url:U,...me[U]});if(Re.sort((U,he)=>U.shared>he.shared?-1:U.shared<he.shared?1:U.boosts>he.boosts?-1:U.boosts<he.boosts?1:U.likes>he.likes?-1:U.likes<he.likes?1:U.quotes>he.quotes?-1:U.quotes<he.quotes?1:0),Re.length>10)e:for(let U=10;U<Re.length;U++){const{shared:he}=Re[U];if(he<=1){Re=Re.slice(0,U);break e}}return[{filtered:T,groups:q,boosts:X,quotes:ae,replies:O,followedTags:ue,original:Ae},Re]},[b]),[G,W]=R("all"),[H,Y]=R(null),[$,Q]=R(1),[j,Z]=R("createdAt"),[le,ne]=R("asc"),[J,we]=R(null);V(()=>{if(!r)return;const T=Ce.session.getJSON(`${Bt}-${r}`);T&&(T.selectedFilterCategory!==void 0&&W(T.selectedFilterCategory),T.selectedAuthor!==void 0&&Y(T.selectedAuthor),T.sortBy!==void 0&&Z(T.sortBy),T.sortOrder!==void 0&&ne(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:G,selectedAuthor:H,sortBy:j,sortOrder:le,groupBy:J,showTopLinks:f};Ce.session.setJSON(`${Bt}-${r}`,T)},[r,l,G,H,j,le,J,f]);const[be,ke,ze]=Se(()=>{const T={},q=new Map;let X=b.filter(O=>{const ue=G==="all"||O.__FILTER===G;return ue&&(T[O.account.id]=O.account,q.set(O.account.id,(q.get(O.account.id)||0)+1)),ue});const ae={};return X.forEach(O=>{O.reblog&&(ae[O.reblog.id]?(ae[O.reblog.id].__BOOSTERS?ae[O.reblog.id].__BOOSTERS.add(O.account):ae[O.reblog.id].__BOOSTERS=new Set([O.account]),O.__HIDDEN=!0):ae[O.reblog.id]=O)}),H&&q.has(H)&&(X=X.filter(O=>O.account.id===H||[...O.__BOOSTERS||[]].find(ue=>ue.id===H))),[X,T,Object.fromEntries(q)]},[G,H,b]),_e=Se(()=>{const T={};return be.forEach(q=>{T[q.id]=q}),T},[be]),Te=Se(()=>Object.keys(ze).sort((T,q)=>ze[q]-ze[T]),[ze]),xe=Se(()=>{const T={};return Te.forEach((q,X)=>{T[q]=X}),be.filter(q=>!q.__HIDDEN).sort((q,X)=>{if(J==="account"){const ae=q.account.id,O=X.account.id,ue=T[ae],Ae=T[O],me=ue-Ae;if(me!==0)return me}if(j!=="createdAt"&&(q=q.reblog||q,X=X.reblog||X,j!=="density"&&q[j]===X[j]))return q.createdAt>X.createdAt?1:-1;if(j==="density"){const ae=Us(q),O=Us(X);return le==="asc"?ae>O?1:-1:O>ae?1:-1}return le==="asc"?q[j]>X[j]?1:-1:X[j]>q[j]?1:-1})},[be,j,le,J,Te]),qe=B(null),Ue=B(null),He=B(!1);V(()=>{b.length>100||He.current||Ue.current&&(Io(Ue.current,{duration:200}),He.current=!0)},[b,Ue]);const We=b.length>160?"3d":"2d",ce=Se(()=>We!=="2d"?null:b.map(T=>{const q=_e[T.id];return e("span",{class:`post-dot ${q?"post-dot-highlight":""}`},T.id)}),[_e]),Me=Se(()=>We!=="3d"||!b?.length?null:Nd(b,"createdAt",320).map((q,X)=>e("div",{class:"posts-bin",children:q.map(ae=>{const O=_e[ae.id];return e("span",{class:`post-dot ${O?"post-dot-highlight":""}`},ae.id)})},X)),[_e]),Ie=B(null);kt(()=>{if(!r||l!=="results"||!Ie.current||!xe.length)return;const T=Ce.session.getJSON(`${Bt}-${r}`);if(T?.scrollTop!==void 0&&T.scrollTop>0){const q=setTimeout(()=>{Ie.current&&Ie.current.scrollTo({top:T.scrollTop,behavior:"instant"})},100);return()=>clearTimeout(q)}},[r,l,xe.length]),V(()=>{if(!r||l!=="results"||!Ie.current)return;const T=()=>{if(!Ie.current)return;const X=Ce.session.getJSON(`${Bt}-${r}`)||{};X.scrollTop=Ie.current.scrollTop,Ce.session.setJSON(`${Bt}-${r}`,X)},q=Ie.current;return q.addEventListener("scroll",T,{passive:!0}),()=>{q.removeEventListener("scroll",T)}},[r,l]);const oe=Se(()=>P?(Date.now()-P)/1e3/60/60:null,[P,$]);V(()=>{if(l!=="results")return;const T=H&&ke[H]?ke[H].username:"",q=le==="asc"?0:1,X={account:"authors"};let ae=de({duration:5e3,text:s({id:"XKZRZ/",values:{selectedFilterCategory:G,sortBy:j,sortOrder:le,groupBy:J}})});return()=>{ae?.hideToast?.()}},[l,G,H,j,le,J,ke]),V(()=>{if(H&&ke[H]){const T=Ue.current.querySelector(`[data-author="${H}"]`),q=Ue.current?.getBoundingClientRect(),X=T?.getBoundingClientRect();X.left<q.left||X.right>q.right?T.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"}):X.top<0&&T.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}},[H,ke]);const[Be,Ee]=R(!1),Le=".catchup-list > li > a",M=Ke("j",()=>{const T=document.activeElement.closest(Le),q=T?.getBoundingClientRect(),X=Array.from(Ie.current.querySelectorAll(Le));if(T&&q.top<Ie.current.clientHeight&&q.bottom>0){const ae=X.indexOf(T),O=X[ae+1];O&&(O.focus(),O.scrollIntoView({block:"center",inline:"center",behavior:"instant"}))}else{const ae=X.find(O=>O.getBoundingClientRect().top>=0);ae&&(ae.focus(),ae.scrollIntoView({block:"nearest",inline:"center",behavior:"instant"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey}),ge=Ke("k",()=>{const T=document.activeElement.closest(Le),q=T?.getBoundingClientRect(),X=Array.from(Ie.current.querySelectorAll(Le));if(T&&q.top<Ie.current.clientHeight&&q.bottom>0){const ae=X.indexOf(T);let O=X[ae-1];O&&(O.focus(),O.scrollIntoView({block:"center",inline:"center",behavior:"instant"}))}else{const ae=X.find(O=>{const ue=O.getBoundingClientRect();return ue.top>=44&&ue.left>=0});ae&&(ae.focus(),ae.scrollIntoView({block:"nearest",inline:"center",behavior:"instant"}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey}),Ne=Ke("h, l",(T,q)=>{const X=q.keys[0];if(H){const ae=Te.indexOf(H);X==="h"?ae>0&&ae<Te.length&&(Y(Te[ae-1]),Ie.current?.focus()):X==="l"&&ae<Te.length-1&&ae>=0&&(Y(Te[ae+1]),Ie.current?.focus())}else X==="l"&&(Y(Te[0]),Ie.current?.focus())},{useKey:!0,preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey,enableOnFormTags:["input"]}),Pe=Ke("esc",()=>{Y(null),Ie.current?.focus()},{preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey,enableOnFormTags:["input"],useKey:!0}),D=Ke(".",()=>{Ie.current?.scrollTo({top:0,behavior:"smooth"})},{useKey:!0,preventDefault:!0,ignoreEventWhen:T=>T.metaKey||T.ctrlKey||T.altKey||T.shiftKey,enableOnFormTags:["input"]}),re=st(T=>{const q=document.activeElement,X=q?.tagName==="INPUT"&&q.type==="radio";if((T.key==="ArrowDown"||T.key==="ArrowUp"||T.key==="ArrowLeft"||T.key==="ArrowRight")&&X){q.blur();return}},[]);return e("div",{ref:T=>{Ie.current=T,M.current=T,ge.current=T,Ne.current=T,Pe.current=T,D.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")||Ie.current?.scrollTo({top:0,behavior:"smooth"})},children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Ft,{}),l==="results"&&e(ve,{to:"/catchup",class:"button plain",children:e(I,{icon:"history2",size:"l",alt:s({id:"xrl8fj"})})}),l==="start"&&e(ve,{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:re,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:Go,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:$,min:It[0].value,max:It[It.length-1].value,step:"1",list:"catchup-ranges",onChange:T=>Q(+T.target.value)})," ",e("span",{style:{width:"8em"},children:[i(It[$-1].label),e("br",{}),e("small",{class:"insignificant",children:$==It[It.length-1].value?s({id:"NMNiaO"}):at(new Date(Date.now()-$*60*60*1e3))})]}),e("datalist",{id:"catchup-ranges",children:It.map(({label:T,value:q})=>e("option",{value:q,label:i(T)}))})," ",e("button",{type:"button",onClick:()=>{let T;const q=It.find(X=>X.beyond);$<q.value?T=$*60*60*1e3:S.current?.checked&&(T=Date.now()-P),C({duration:T})},children:e(p,{id:"R0yu2l"})})]}),oe&&$>oe?e("p",{class:"catchup-info",children:[e(I,{icon:"info"})," ",e(p,{id:"AGyV7s"})]}):$===It[It.length-1].value&&P?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(P))}})]})}):null,e("p",{class:"insignificant",children:e("small",{children:e(p,{id:"EAjFM0"})})}),!!z?.length&&e("div",{class:"catchup-prev",children:[e("p",{children:e(p,{id:"Yfb9A8"})}),e("ul",{children:z.map(T=>e("li",{children:[e(ve,{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 X=de(s({id:"xJUo4P",values:{0:T.id}}));await bt.catchup.del(T.id),X?.hideToast?.(),de(s({id:"1dyGG/",values:{0:T.id}})),L()}},children:e(I,{icon:"x",alt:s({id:"t/YqKh"})})})]})]},T.id))}),z.length>=3&&e("p",{children:e("small",{children:e(p,{id:"sXmrl4"})})})]})]}),l==="loading"&&e("div",{class:"ui-state catchup-start",children:[e(Oe,{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:G==="all"&&!H&&j==="createdAt"&&le==="asc",type:"button",class:"plain4 small",onClick:()=>{W("all"),Y(null),Z("createdAt"),we(null),ne("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:q,shared:X,sharers:ae,likes:O,boosts:ue}=T,{blurhash:Ae,title:me,description:Re,url:U,image:he,imageDescription:De,language:$e,width:nt,height:tt,publishedAt:_t}=q,Pt=Mi(U);let Cn;if(Ae){const _n=Bi(Ae),In=ns(_n);Cn=ts([.6,In[1],In[2]])}return e("a",{href:U,target:"_blank",rel:"noopener",class:"link-block",style:Cn?{"--accent-color":`rgb(${Cn.join(",")})`,"--accent-alpha-color":`rgba(${Cn.join(",")}, 0.4)`}:{},children:e("article",{children:[e("figure",{children:e("img",{src:he,alt:De,width:nt,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})," ",!!_t&&e(N,{children:"· "}),!!_t&&e(N,{children:e(xt,{datetime:_t,format:"micro"})})]}),!!me&&e("h1",{class:"title",lang:$e,dir:"auto",title:me,children:me})]}),!!Re&&e("p",{class:"description",lang:$e,dir:"auto",title:Re,children:Re}),e("hr",{}),e("p",{style:{whiteSpace:"nowrap"},children:e(p,{id:"bfSr6z",values:{0:ae.map(_n=>{const{avatarStatic:In,displayName:mc}=_n;return e("button",{type:"button",class:"plain",style:{padding:0},onClick:cs=>{cs.preventDefault(),cs.stopPropagation();const{id:gc}=_n;Y(gc),W("all")},children:e(ut,{url:In,size:"s",alt:mc})})})}})})]})]})},U)})})})}),b.length>=5&&(We==="3d"?e("div",{class:"catchup-posts-viz-time-bar",children:Me}):e("div",{class:"catchup-posts-viz-bar",children:ce})),b.length>=2&&e("div",{class:"catchup-filters",children:[e("label",{class:"filter-cat",children:[e("input",{type:"radio",name:"filter-cat",checked:G.toLowerCase()==="all",onChange:()=>{W("all")}}),e(p,{id:"N40H+G"})," ",e("span",{class:"count",children:b.length})]}),Object.entries(Id).map(([T,q])=>!!ee[T]&&e("label",{class:"filter-cat",title:(ee[T]/b.length*100).toFixed(2)+"%",children:[e("input",{type:"radio",name:"filter-cat",checked:G.toLowerCase()===T.toLowerCase(),onChange:()=>{W(T),T==="boosts"&&(Z("reblogsCount"),ne("desc"),we(null))}}),i(q)," ",e("span",{class:"count",children:ee[T]})]},i(q)))]}),b.length>=2&&!!ze&&e("div",{class:"catchup-filters authors-filters",ref:Ue,children:[Te.map(T=>e("label",{class:"filter-author","data-author":T,children:[e("input",{type:"radio",name:"filter-author",checked:H===T,onChange:()=>{Y(T)},onClick:()=>{H===T&&Y(null)}}),e(ut,{url:ke[T].avatarStatic||ke[T].avatar,size:"xxl",alt:`${ke[T].displayName} (@${ke[T].acct})`})," ",e("span",{class:"count",children:ze[T]}),e("span",{class:"username",children:ke[T].username})]},`${T}-${ze[T]}`)),Te.length>5&&e("small",{style:{whiteSpace:"nowrap",paddingInline:"1em",opacity:.33},children:e(p,{id:"HHtYi7",values:{0:Te.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:Ad.map(T=>e("label",{class:"filter-sort",onClick:q=>{j===T&&(q.preventDefault(),q.stopPropagation(),ne(le==="asc"?"desc":"asc"))},children:[e("input",{type:"radio",name:"filter-sort-cat",checked:j===T,onChange:()=>{Z(T);const q=/(replies|favourites|reblogs|quotes)/.test(T)?"desc":"asc";ne(q)}}),{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],j===T&&(le==="asc"?" ↑":" ↓")]},T))}),e("span",{class:"filter-label",children:e(p,{id:"group.filter"})})," ",e("fieldset",{class:"radio-field-group",children:xd.map(T=>e("label",{class:"filter-group",children:[e("input",{type:"radio",name:"filter-group",checked:J===T,onChange:()=>{we(T)},disabled:T==="account"&&H}),{account:s({id:"dpqPBg"})}[T]||s({id:"EdQY6l"})]},T||"none"))}),H&&Te.length>1?e("button",{type:"button",class:"plain6 small",onClick:()=>{Y(null)},style:{whiteSpace:"nowrap"},children:e(p,{id:"/dlmrZ"})}):null]}),e("ul",{class:`catchup-list catchup-filter-${G||""} ${j?`catchup-sort-${j}`:""} ${H&&ke[H]?"catchup-selected-author":""} ${J?`catchup-group-${J}`:""}`,children:xe.map((T,q)=>{const X=T.reblog?.id||T.id;let ae=!1;return J==="account"&&(qe.current&&T.account.id!==qe.current&&q>0&&(ae=!0),qe.current=T.account.id),e(N,{children:[ae&&e("li",{class:"separator"}),e(Ld,{to:`/${a}/s/${X}`,post:T,root:Ie.current})]},`${T.id}-${ae}`)})}),e("footer",{children:be.length>5&&e("p",{children:[s(G==="boosts"?{id:"eVosYr"}:{id:"rhmyFK"})," ",e("button",{type:"button",class:"textual",onClick:()=>{Ie.current.scrollTop=0},children:e(p,{id:"0MgdN+"})}),"."]})})]})]})]}),Be&&e(Fe,{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 Rd=rt(function({post:n}){const{id:i,account:s,group:o,reblog:c,quote:a,inReplyToId:u,inReplyToAccountId:d,_followedTags:r,_filtered:l,visibility:h,__BOOSTERS:f}=n,m=u&&d!==s.id,y=!!l&&l?.action!=="blur",g=w=>{w.shiftKey};return e("article",{class:`post-line ${o?"group":c?"reblog":Vt()&&Qn(a)?"quote":r?.length?"followed-tags":""} ${m?"reply-to":""} ${y?"filtered":""} visibility-${h}`,onMouseEnter:g,children:[e("span",{class:"post-author",children:c?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(mt,{account:c.account,showAvatar:!0})]}):Qn(a)?e("span",{class:"post-quote-avatar",children:[e(ut,{url:s.avatarStatic||s.avatar,squircle:s.bot})," ",e(I,{icon:"quote"})," ",e(mt,{account:a.quotedStatus?.account||a.account,showAvatar:!0})]}):e(mt,{account:s,showAvatar:!0})}),e(Pd,{post:c||n,filterInfo:l}),e("span",{class:"post-meta",children:[e(Dd,{post:c||n})," ",e(xt,{datetime:new Date(c?.createdAt||n.createdAt),format:"micro"})]})]})},(n,i)=>n?.post?.id===i?.post?.id),Ld=({root:n,to:i,...s})=>{const o=B(),[c,a]=R(!1);return V(()=>{const u=new IntersectionObserver(d=>{d[0].isIntersecting&&(queueMicrotask(()=>a(!0)),u.unobserve(o.current))},{root:n,rootMargin:`${Math.max(320,screen.height*.75)}px`});return o.current&&u.observe(o.current),()=>{o.current&&u.unobserve(o.current)}},[]),c?e("li",{children:e(ve,{to:i,children:e(Rd,{...s})})}):e("li",{ref:o,style:{height:"4em"}})},$d=8,Md=8;function Us(n){const{spoilerText:i,content:s,poll:o,mediaAttachments:c,card:a}=n,u=o?.options?.length?o.options.reduce((r,l)=>r+l.title,""):"";return(i.length+go(s)+u.length)/140+(c?.length?$d*c.length:a?.image?Md:0)}const Dt=48;function Pd({post:n,filterInfo:i}){const{_:s}=ie();let{spoilerText:o,sensitive:c,content:a,emojis:u,poll:d,mediaAttachments:r,card:l,inReplyToId:h,inReplyToAccountId:f,account:m,_thread:y,quote:g}=n;const w=h&&f===m.id||!!y;let k=Vt()&&Qn(g)?g.quotedStatus||g:null;(k?.spoilerText||k?.sensitive)&&(k=null),k?.emojis&&u.push(...k.emojis),!r?.length&&k?.mediaAttachments?.length&&(r=k.mediaAttachments);const v=!!$i()["reading:expand:spoilers"],_=v||!o&&!c&&i?.action!=="blur",S=a?ti(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"})})," "]}),!!a&&e("div",{dangerouslySetInnerHTML:{__html:ta(a,u)+(k?.content?`<blockquote class="post-peek-quote">${k.content}</blockquote>`:"")}}),!!d?.options?.length&&d.options.map(C=>e("div",{children:[d.multiple?"▪️":"•"," ",C.title]})),!a&&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,L=C.previewRemoteUrl||C.remoteUrl,P=C.meta?.original?C.meta.original.width:C.meta?.small?.width||C.meta?.original?.width,F=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||L)&&_?e("img",{src:x,width:Dt,height:Dt,alt:C.description,loading:"lazy",onError:z=>{const{src:K}=z.target;K===x&&L&&x!==L&&(z.target.src=L)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(P,F)/100,5),120)}s`}}):e("span",{class:"post-peek-faux-media",children:"🖼"}),gifv:(x||L)&&_?e("img",{src:x,width:Dt,height:Dt,alt:C.description,loading:"lazy",onError:z=>{const{src:K}=z.target;K===x&&L&&x!==L&&(z.target.src=L)}}):e("span",{class:"post-peek-faux-media",children:"🎞️"}),video:(x||L)&&_?e("img",{src:x,width:Dt,height:Dt,alt:C.description,loading:"lazy",onError:z=>{const{src:K}=z.target;K===x&&L&&x!==L&&(z.target.src=L)}}):e("span",{class:"post-peek-faux-media",children:"📹"}),audio:e("span",{class:"post-peek-faux-media",children:"🎵"})}[C.type]||null},C.id)}):!!l&&l.image&&_&&e("span",{class:`post-peek-media post-peek-card card-${l.type||""}`,children:l.image?e("img",{src:l.image,width:Dt,height:Dt,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 Dd({post:n}){const{_:i}=ie(),{reblogsCount:s,repliesCount:o,favouritesCount:c,quotesCount:a}=n;return e("span",{class:"post-stats",children:[o>0&&e("span",{class:"post-stat-replies",children:[e(I,{icon:"comment2",size:"s",alt:i({id:"N8UzTV"})})," ",Xe(o)]}),c>0&&e("span",{class:"post-stat-likes",children:[e(I,{icon:"heart",size:"s",alt:i({id:"zZOZj7"})})," ",Xe(c)]}),s>0||a>0?e("span",{class:"post-stat-boosts",children:[e(I,{icon:"rocket",size:"s",alt:i({id:"puY2t0"})})," ",s>0||a>0?`${s>0?Xe(s):""}${s>0&&a>0?"+":""}${a>0?Xe(a):""}`:Xe(s)]}):null]})}function Nd(n,i,s){const o=n.map(r=>new Date(r[i])),c=o.reduce((r,l)=>l<r?l:r,o[0]),a=o.reduce((r,l)=>l>r?l:r,o[0]),u=Math.min(a.getTime(),Date.now())-c.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 h=(l-c.getTime())/u,f=Math.floor(h*(s-1));d[f].push(r)}}),d}const Od=20;function Wo(){const{_:n}=ie();et(n({id:"zZOZj7"}),"/favourites");const{masto:i,instance:s}=se(),o=B();async function c(a){return(a||!o.current)&&(o.current=i.v1.favourites.list({limit:Od}).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:c})}const zd=["home","public","notifications","thread","account"],Bs=["thread","account"],qd={home:{id:"Buy2bt"},notifications:{id:"iDNBZe"},public:{id:"RO10dm"},thread:{id:"EnJuK0"},account:{id:"vrQQgz"}},Fd=[0,1800,3600,360*60,720*60,3600*24,3600*24*7,3600*24*30],bi={0:{id:"qqeAJM"},1800:ct(30,"minute"),3600:ct(1,"hour"),21600:ct(6,"hour"),43200:ct(12,"hour"),86400:ct(24,"hour"),604800:ct(7,"day"),2592e3:ct(30,"day")};function Ud(){const{_:n}=ie(),{masto:i}=se();et(n({id:"cSev+j"}),"/ft");const[s,o]=R("default"),[c,a]=R(!1),[u,d]=$t(h=>h+1,0),[r,l]=R([]);return V(()=>{o("loading"),(async()=>{try{const h=await i.v2.filters.list();h.sort((f,m)=>f.title.localeCompare(m.title)),h.forEach(f=>{f.keywords?.length&&f.keywords.sort((m,y)=>m.id-y.id)}),l(h),o("default")}catch{o("error")}})()},[u]),e("div",{id:"filters-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Ft,{}),e(ve,{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:()=>{a(!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(h=>{const{id:f,title:m,expiresAt:y,keywords:g}=h;return e("li",{children:[e("div",{children:[e("h2",{children:m}),g?.length>0&&e("div",{children:g.map(w=>e(N,{children:[e("span",{class:"tag collapsed insignificant",children:w.wholeWord?`“${w.keyword}”`:w.keyword})," "]}))}),e("small",{class:"insignificant",children:e(Zo,{expiresAt:y})})]}),e("button",{type:"button",class:"plain",onClick:()=>{a({filter:h})},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(Oe,{})}):s==="error"?e("p",{class:"ui-state",children:e(p,{id:"qcAUwp"})}):e("p",{class:"ui-state",children:e(p,{id:"cWIHTt"})})})]}),!!c&&e(Fe,{title:n({id:"vCSBPD"}),onClose:()=>{a(!1)},children:e(Hd,{filter:c?.filter,onClose:h=>{h.state==="success"&&d(),a(!1)}})})]})}let Bd=1;const Kd=()=>Bd++;function Hd({filter:n,onClose:i}){const{_:s,_:o}=ie(),{masto:c}=se(),[a,u]=R("default"),d=!!n,{context:r,expiresAt:l,id:h,keywords:f,title:m,filterAction:y}=n||{},g=!!l,w=g&&new Date(l),[k,b]=R(f||[]),v=B(),[_,S]=R([]),[A,C]=R([]),x=k.filter(L=>!_.includes(L.id)&&!A.includes(L._id));return e("div",{class:"sheet",id:"filters-add-edit-modal",children:[!!i&&e("button",{type:"button",class:"sheet-close",onClick:i,children:e(I,{icon:"x",alt:o({id:"yz7wBu"})})}),e("header",{children:e("h2",{children:o(d?{id:"3mOee6"}:{id:"yFfBdX"})})}),e("main",{children:e("form",{onSubmit:L=>{L.preventDefault();const P=new FormData(L.target),F=P.get("title"),z=P.getAll("keyword_attributes[][id]"),K=P.getAll("keyword_attributes[][keyword]"),ee=[...v.current.querySelectorAll('input[name="keyword_attributes[][whole_word]"]')].map(Y=>Y.checked),te=K.map((Y,$)=>({id:z[$]||void 0,keyword:Y,wholeWord:ee[$]}));d&&_?.length&&_.forEach(Y=>{te.push({id:Y,_destroy:!0})});const G=P.getAll("context");let W=P.get("expires_in");const H=P.get("filter_action");!F||!G?.length||(u("loading"),(async()=>{try{let Y;d?(W===""||W===null?g?W=Math.floor((w-Date.now())/1e3):W=null:W==="0"||W===0?W=null:W=+W,Y=await c.v2.filters.$select(h).update({title:F,context:G,expiresIn:W,keywordsAttributes:te,filterAction:H})):(W=+W||null,Y=await c.v2.filters.create({title:F,context:G,expiresIn:W,keywordsAttributes:te,filterAction:H})),u("default"),i?.({state:"success",filter:Y})}catch{u("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:a==="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(L=>{const{id:P,keyword:F,wholeWord:z,_id:K}=L;return e("li",{children:[e("input",{type:"hidden",name:"keyword_attributes[][id]",value:P}),e("input",{name:"keyword_attributes[][keyword]",type:"text",defaultValue:F,disabled:a==="loading",required:!0,dir:"auto",enterKeyHint:"done"}),e("div",{class:"filter-keyword-actions",children:[e("label",{children:[e("input",{name:"keyword_attributes[][whole_word]",type:"checkbox",value:P,defaultChecked:z,disabled:a==="loading"})," ",e(p,{id:"/7UQ7y"})]}),e("button",{type:"button",class:"light danger small",disabled:a==="loading",onClick:()=>{P?(_.push(P),S([..._])):K&&(A.push(K),C([...A]))},children:e(I,{icon:"x",alt:o({id:"t/YqKh"})})})]})]},`${P}-${K}`)})}):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:Kd(),keyword:"",wholeWord:!0}]),setTimeout(()=>{const L=v.current.querySelectorAll('input[type="text"]');L[L.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"})})}),zd.map(L=>e("div",{children:[e("label",{class:Bs.includes(L)?"insignificant":"",children:[e("input",{type:"checkbox",name:"context",value:L,defaultChecked:r?r.includes(L):!0,disabled:a==="loading"})," ",s(qd[L]),Bs.includes(L)?"*":""]})," "]})),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(Zo,{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:a==="loading",defaultValue:d?void 0:0,children:[d&&e("option",{}),Fd.map(L=>e("option",{value:L,children:typeof bi[L]=="function"?bi[L]():s(bi[L])}))]})]}),e("p",{children:[e(p,{id:"blQMpa"}),e("br",{}),so()?.mastodon>=5&&e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"blur",defaultChecked:y==="blur",disabled:a==="loading"})," ",e(p,{id:"ggxOw9"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"warn",defaultChecked:y!=="hide"&&y!=="blur"||!d,disabled:a==="loading"})," ",e(p,{id:"jbreWy"})]})," ",e("label",{class:"ib",children:[e("input",{type:"radio",name:"filter_action",value:"hide",defaultChecked:y==="hide",disabled:a==="loading"})," ",e(p,{id:"zNCBmf"})]})]})]})]}),e("footer",{class:"filter-form-footer",children:[e("span",{children:[e("button",{type:"submit",disabled:a==="loading",children:o(d?{id:"tfDRzk"}:{id:"hYgDIe"})})," ",e(Oe,{abrupt:!0,hidden:a!=="loading"})]}),d&&e(vt,{disabled:a==="loading",align:"end",menuItemClassName:"danger",confirmLabel:o({id:"BPjyR2"}),onClick:()=>{u("loading"),(async()=>{try{await c.v2.filters.$select(h).remove(),u("default"),i?.({state:"success"})}catch{u("error"),alert(o({id:"4Dh9J1"}))}})()},children:e("button",{type:"button",class:"light danger",onClick:()=>{},disabled:a==="loading",children:e(p,{id:"Jb6/SB"})})})]})]})})]})}function Zo({expiresAt:n,showNeverExpires:i}){const{_:s}=ie(),o=!!n,c=o&&new Date(n),a=o&&Date.parse(n)<=Date.now(),[u,d]=$t(r=>r+1,0);return Fi(d,a||3e4),a?s({id:"M1RnFv"}):o?e(p,{id:"urGtsw",components:{0:e(xt,{datetime:c})}}):i&&s({id:"O1Aswy"})}function jd(){const{_:n}=ie(),{masto:i,instance:s}=se();et(n({id:"Xi1/bw"}),"/fh");const[o,c]=R("default"),[a,u]=R([]);return V(()=>{c("loading"),(async()=>{try{const d=await Zn();u(d),c("default")}catch{c("error")}})()},[]),e("div",{id:"followed-hashtags-page",class:"deck-container",tabIndex:"-1",children:e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Ft,{}),e(ve,{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:a.length>0?e(N,{children:[e("ul",{class:"link-list",children:a.map(d=>e("li",{children:e(ve,{to:s?`/${s}/t/${d.name}`:`/t/${d.name}`,children:[e(I,{icon:"hashtag",alt:"#"})," ",e("span",{children:d.name})]})}))}),a.length>1&&e("footer",{class:"ui-state",children:e("small",{class:"insignificant",children:e(p,{id:"2S/uvJ",values:{0:a.length}})})})]}):o==="loading"?e("p",{class:"ui-state",children:e(Oe,{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 Yd=20;function os({title:n,path:i,id:s,...o}){const{_:c}=ie();et(n||c({id:"following.title"}),i||"/following");const{masto:a,streaming:u,instance:d,client:r}=se(),[l,h]=R(u),f=Ge(E),m=B(),y=B(),g=B();V(()=>{!u&&r?.onStreamingReady&&r.onStreamingReady(v=>{h(v)})},[r]),__BENCHMARK.end("time-to-following");const w=Qe("@pixelfed/home-include-reblogs");async function k(v){(v||!y.current)&&(__BENCHMARK.start("fetch-home-first"),m.current=a.v1.timelines.home.list({limit:Yd}),y.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 y.current.next();let{value:S}=_;if(S?.length){let A=!1;v&&(S[0].id!==g.current&&(A=!0),g.current=S[0].id),S.forEach(C=>{Je(C,d)}),S=zs(S,d),v&&A&&ad(),setTimeout(()=>{Yo(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:g.current};Qe("@pixelfed/home-include-reblogs")&&(v.include_reblogs=!0);const _=await a.v1.timelines.home.list(v).values().next();let{value:S}=_;const A=S[0]?.id===g.current;return!!(S?.length&&!A&&(g.current=S[0].id,S=zs(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=oo(S,d);A&&(A._deleted=!0)}}}})(),()=>{v?.unsubscribe?.(),v=null}},[l]),e(Mt,{title:n||c({id:"following.title"}),id:s||"following",emptyText:c({id:"nJEKbY"}),errorText:c({id:"7QSeK6"}),instance:d,fetchItems:k,checkForUpdates:b,useItemID:!0,boostsCarousel:f.settings.boostsCarousel,...o,filterContext:"home",showFollowedTags:!0,showReplyParent:!0})}const Vd=20,Gd=4,Ks=Gd+1;function Xo({media:n,columnMode:i,...s}){const{_:o}=ie();let{hashtag:c,...a}=i?{}:qt();s.hashtag&&(c=s.hashtag);let u=c.trim().split(/[\s+]+/);u.sort(),c=u[0];const[d,r]=Ct(),l=n||!!d.get("media"),h=l?"?media=1":"",{masto:f,instance:m,authenticated:y}=se({instance:s?.instance||a.instance}),{masto:g,instance:w,authenticated:k}=se(),b=u.map($=>`#${$}`).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 _=B(),S=Se(()=>Oi(),[]),A=B(void 0);async function C($){const Q=await f.v1.timelines.tag.$select(c).list({limit:Vd,any:u.slice(1),maxId:$?void 0:A.current,onlyMedia:l?!0:void 0}).values().next();let{value:j}=Q;return j?.length&&($&&(_.current=j[0].id),j.forEach(Z=>{Je(Z,m,{skipThreading:l||S})}),A.current=j[j.length-1].id),{...Q,value:j}}async function x(){try{const $=await f.v1.timelines.tag.$select(c).list({limit:1,any:u.slice(1),since_id:_.current,onlyMedia:l}).values().next();let{value:Q}=$;const j=Q[0]?.id===_.current;return Q?.length&&!j?(Q=Gt(Q,"public"),!0):!1}catch{return!1}}const[L,P]=R("default"),[F,z]=R();V(()=>{(async()=>{try{const $=await f.v1.tags.$select(c).fetch();z($)}catch{}})()},[c]);const K=u.length>=Ks,[ee,te]=R("default"),[G,W]=R([]),[H,Y]=R(!1);return V(()=>{y&&(async()=>{try{const $=await f.v1.featuredTags.list();W($),Y($.some(Q=>Q.name.toLowerCase()===c.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:[!!F&&u.length===1&&e(N,{children:[e(vt,{subMenu:!0,confirm:F.following,confirmLabel:o({id:"ctJi7k",values:{hashtag:c}}),disabled:L==="loading"||!y,onClick:()=>{P("loading"),F.following?f.v1.tags.$select(c).unfollow().then(()=>{z({...F,following:!1}),de(o({id:"doK/ij",values:{hashtag:c}}))}).catch($=>{alert($)}).finally(()=>{P("default")}):f.v1.tags.$select(c).follow().then(()=>{z({...F,following:!0}),de(o({id:"R9+aEN",values:{hashtag:c}}))}).catch($=>{alert($)}).finally(()=>{P("default")})},children:F.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(ye,{type:"checkbox",checked:H,disabled:ee==="loading"||!y,onClick:()=>{if(te("loading"),H){const $=G.find(Q=>Q.name.toLowerCase()===c.toLowerCase()).id;$?f.v1.featuredTags.$select($).remove().then(()=>{Y(!1),de(o({id:"VH+Tf9"})),W(G.filter(Q=>Q.id!==$))}).catch(Q=>{}).finally(()=>{te("default")}):de(o({id:"3OLv47"}))}else f.v1.featuredTags.create({name:c}).then($=>{Y(!0),de(o({id:"9ra4hn"})),W(G.concat($))}).catch($=>{}).finally(()=>{te("default")})},children:H?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(Ve,{})]}),!S&&e(N,{children:[e(Ki,{className:"plain",children:e(p,{id:"cSev+j"})}),e(ye,{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(Ve,{})]}),e(na,{className:"menu-field",disabled:K,children:({ref:$})=>e("form",{onSubmit:Q=>{Q.preventDefault();const j=Q.target[0].value?.trim?.();j&&!u.some(Z=>Z.toLowerCase()===j.toLowerCase())&&(u.push(j),u.sort(),location.hash=m?`/${m}/t/${u.join("+")}${h}`:`/t/${u.join("+")}${h}`)},children:[e(I,{icon:"hashtag"}),e("input",{ref:$,type:"text",placeholder:K?pe._({id:"ouWc/D",values:{TOTAL_TAGS_LIMIT:Ks}}):o({id:"cxL5F9"}),required:!0,autocorrect:"off",autocapitalize:"off",spellCheck:!1,pattern:"[^##][^\\s##]+[^##]",disabled:K,dir:"auto",enterKeyHint:"go"})]})}),e(ia,{takeOverflow:!0,children:u.map(($,Q)=>e(ye,{disabled:u.length===1,onClick:j=>{u.splice(Q,1),u.sort(),location.hash=m?`/${m}/t/${u.join("+")}${h}`:`/t/${u.join("+")}${h}`},children:[e(I,{icon:"x",alt:o({id:"OISAkj"}),class:"danger-icon"}),e("span",{class:"bidi-isolate",children:[e("span",{class:"more-insignificant",children:"#"}),$]})]},$))}),e(Ve,{}),e(ye,{disabled:!k,onClick:()=>{if(E.shortcuts.length>=Rt){alert(pe._({id:"XN1xAY",values:{SHORTCUTS_LIMIT:Rt}}));return}const $={type:"hashtag",hashtag:u.join(" "),instance:m,media:l?"on":void 0};E.shortcuts.some(j=>j.type===$.type&&j.hashtag.split(/[\s+]+/).sort().join(" ")===$.hashtag.split(/[\s+]+/).sort().join(" ")&&(j.instance?j.instance===$.instance:!0)&&(j.media?!!j.media==!!$.media:!0))?alert(o({id:"kfeQnS"})):(E.shortcuts.push($),de(o({id:"MIhb91"})))},children:[e(I,{icon:"shortcut"})," ",e("span",{children:e(p,{id:"i02Lq/"})})]}),e(ye,{onClick:()=>{let $=prompt(o({id:"2MQ2cd"}));if(!/\./.test($)){$&&alert(o({id:"7WddtO"}));return}$&&($=$.toLowerCase().trim(),location.hash=`/${$}/t/${u.join("+")}${h}`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(p,{id:"Sq04Yc"})})]}),w!==m&&e(ye,{onClick:()=>{location.hash=`/${w}/t/${u.join("+")}${h}`},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&&!!u?.length&&e("data",{class:"compose-data",value:JSON.stringify({draftStatus:{status:`${u.length>1?`
|
||
|
||
`:" "}${b}`}})})]})}const Wd=20;function Qo(n){const{_:i}=ie(),s=Ge(E),{masto:o,instance:c}=se(),a=n?.id||qt()?.id,u=B(),d=B();async function r(v){(v||!d.current)&&(d.current=o.v1.timelines.list.$select(a).list({limit:Wd}).values());const _=await d.current.next();let{value:S}=_;return S?.length&&(v&&(u.current=S[0].id),S.forEach(A=>{Je(A,c)})),{..._,value:S}}async function l(){try{const v=await o.v1.timelines.list.$select(a).list({limit:1,since_id:u.current});let{value:_}=v;const S=_[0]?.id===u.current;return _?.length&&!S?(_=Gt(_,"home"),!0):!1}catch{return!1}}const[h,f]=R([]),[m,y]=R({title:"List"});et(m.title,"/l/:id"),V(()=>{(async()=>{try{const v=await Lo(a);y(v)}catch{}})()},[a]);const[g,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:c,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&&Sn().then(f)},children:[e(Ye,{to:"/l",children:e("span",{children:e(p,{id:"BHWx+g"})})}),h?.length>0&&e(N,{children:[e(Ve,{}),h.map(v=>e(Ye,{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(Ki,{className:"plain",children:[e(Zt,{})," ",e(p,{id:"FNptcJ"})]}),e(Ve,{})]}),e(ye,{onClick:()=>w({list:m}),children:[e(I,{icon:"pencil",size:"l"}),e("span",{children:e(p,{id:"ePK91l"})})]}),e(ye,{onClick:()=>b(!0),children:[e(I,{icon:"group",size:"l"}),e("span",{children:e(p,{id:"hB02vO"})})]})]})},a),g&&e(Fe,{onClick:v=>{v.target===v.currentTarget&&w(!1)},children:e(es,{list:g?.list,onClose:v=>{v.state==="success"&&v.list?y(v.list):v.state==="deleted"&&(location.hash="/l"),w(!1)}})}),k&&e(Fe,{onClick:v=>{v.target===v.currentTarget&&b(!1)},children:e(Xd,{listID:a,onClose:()=>b(!1)})})]})}const Zd=40;function Xd({listID:n,onClose:i}){const{_:s}=ie(),{masto:o,instance:c}=se(),[a,u]=R([]),[d,r]=R("default"),[l,h]=R(!1),f=B();async function m(y){h(!1),r("loading"),(async()=>{try{(y||!f.current)&&(f.current=o.v1.lists.$select(n).accounts.list({limit:Zd}).values());const g=await f.current.next();let{done:w,value:k}=g;k?.length?(u(y?k:a.concat(k)),h(!w)):h(!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:[a.map(y=>e("li",{children:[e(gt,{account:y,instance:c}),e(Qd,{account:y,listID:n})]},y.id)),l&&d==="default"&&e(Lt,{as:"li",onChange:y=>y&&m(),children:e("button",{type:"button",class:"light block",onClick:m,children:e(p,{id:"uXRAkV"})})})]})})]})}function Qd({account:n,listID:i}){const{_:s}=ie(),{masto:o}=se(),[c,a]=R("default"),[u,d]=R(!1);return e(vt,{confirm:!u,confirmLabel:e("span",{children:e(p,{id:"j5n9Ry",values:{0:n.username},components:{0:e("span",{class:"bidi-isolate"})}})}),align:"end",menuItemClassName:"danger",onClick:()=>{u?(a("loading"),(async()=>{try{await o.v1.lists.$select(i).accounts.create({accountIds:[n.id]}),a("default"),d(!1)}catch{a("error")}})()):(a("loading"),(async()=>{try{await o.v1.lists.$select(i).accounts.remove({accountIds:[n.id]}),a("default"),d(!0)}catch{a("error")}})())},children:e("button",{type:"button",class:`light ${u?"":"danger"}`,disabled:c==="loading",children:s(u?{id:"m16xKo"}:{id:"MWIaew"})})})}const Jd={mention:["account","status"],quote:["account","status"],status:["account","status"],reblog:["account","status"],follow:["account"],follow_request:["account"],favourite:["account","status"],poll:["status"],update:["status"]},eu=["favourite","reblog","follow"],Jo=n=>eu.includes(n);function ec(n){return n.filter(i=>{const{type:s,id:o,createdAt:c}=i;if(!s)return!1;const a=Jd[s];return a?.length?a.every(u=>!!i[u]):!0})}function tc(n){if(n?.notificationGroups){const{accounts:i=[],notificationGroups:s=[],statuses:o=[]}=n;return s.map(c=>{const{sampleAccountIds:a,statusId:u}=c,d=a?.map(l=>i.find(h=>h.id===l))||[],r=o?.find(l=>l.id===u)||null;return{...c,sampleAccounts:d,status:r}})}return n}function tu(n){const i=n.map(u=>{const{latestPageNotificationAt:d,mostRecentNotificationId:r,sampleAccounts:l,notificationsCount:h}=u;return{id:""+r,createdAt:d,account:l[0],...u}}),s={},o=[];for(let u=0;u<i.length;u++){const d=i[u],{type:r,status:l,createdAt:h,notificationsCount:f,sampleAccounts:m,groupKey:y}=d,g=h?new Date(h).toLocaleDateString():"";let w=r;!(f>0&&m?.length>0&&f>m?.length)&&(r==="favourite"||r==="reblog")&&(w="favourite+reblog");const b=`${l?.id}-${w}-${g}`,v=s[b];if(!Jo(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(y);else{const _=m.map(S=>({...S,_types:[r]}));s[b]={...d,sampleAccounts:_,type:w,_accounts:_,_groupKeys:y?[y]:[],_notificationsCount:[f],_sampleAccountsCount:[m?.length]},o.push(s[b])}}const c={},a=[];for(let u=0;u<o.length;u++){const d=o[u],{type:r,account:l,_accounts:h,sampleAccounts:f,createdAt:m,groupKey:y}=d,g=m?new Date(m).toLocaleDateString():"",w=f?.length===1||h?.length===1;if((r==="favourite"||r==="reblog"||r==="favourite+reblog")&&w){const k=`${l?.id}-${r}-${g}`,b=c[k];if(b)b._statuses.push(d.status),b._ids+=`-${d.id}`,b._groupKeys.push(y);else{let v=c[k]={...d,type:r,_ids:d.id,_statuses:[d.status],_groupKeys:y?[y]:[]};a.push(v)}}else a.push(d)}return a}function nu(n){n=ec(n);const i={},s=[];for(let a=0,u=0;a<n.length;a++){const d=n[a],{id:r,status:l,account:h,type:f,createdAt:m}=d,y=m?new Date(m).toLocaleDateString():"";let g=f;(f==="favourite"||f==="reblog")&&(g="favourite+reblog");const w=`${l?.id}-${g}-${y}`,k=i[w];if(!Jo(f))s[u++]=d;else if(k?.account){const b=k._accounts.find(v=>v.id===h.id);b?(b._types.push(f),b._types.sort().reverse(),k._ids+=`-${r}`):(h._types=[f],k._accounts.push(h),k._ids+=`-${r}`)}else{h&&(h._types=[f]);let b=i[w]={...d,type:g,_ids:r,_accounts:h?[h]:[]};s[u++]=b}}const o={},c=[];for(let a=0,u=0;a<s.length;a++){const d=s[a],{id:r,account:l,_accounts:h,type:f,createdAt:m}=d,y=m?new Date(m).toLocaleDateString():"";if(f==="favourite+reblog"&&l&&h.length===1){const g=`${l?.id}-${f}-${y}`,w=o[g];if(w)w._statuses.push(d.status),w._ids+=`-${r}`;else{let k=o[g]={...d,type:f,_ids:r,_statuses:[d.status]};c[u++]=k}}else c[u++]=d}return c}const Hs=20,iu=new URLSearchParams;function nc({columnMode:n,...i}){const{_:s}=ie(),{masto:o,instance:c}=se(),[a]=n?[iu]:Ct(),[u,d]=R(null),r=i?.type||a.get("type")||u;et(s(r==="private"?{id:"2BApYc"}:{id:"/bZzdR"}),"/mentions");const l=B(),h=B();async function f(v){(v||!l.current)&&(l.current=o.v1.notifications.list({limit:Hs,types:["mention"]}).values());const _=await l.current.next();let{value:S}=_;return S?.length&&(S=ec(S),v&&(h.current=S[0].id),S.forEach(({status:A})=>{Je(A,c)})),{..._,value:S?.map(A=>A.status)}}const m=B(),y=B();async function g(v){(v||!m.current)&&(m.current=o.v1.conversations.list({limit:Hs}).values());const _=await m.current.next();let{value:S}=_;return S=S?.filter(A=>A.lastStatus),S?.length&&(v&&(y.current=S[0].lastStatus.id),S.forEach(({lastStatus:A})=>{Je(A,c)})),{..._,value:S?.map(A=>A.lastStatus)}}function w(...v){return r==="private"?g(...v):f(...v)}async function k(){if(r==="private")try{const v=await o.v1.conversations.list({limit:1,since_id:y.current}).values().next();let{value:_}=v;const S=_[0]?.id===y.current;return _?.length&&!S?(y.current=_[0].lastStatus.id,!0):!1}catch{return!1}else try{const v=await o.v1.notifications.list({limit:1,types:["mention"],since_id:h.current}).values().next();let{value:_}=v;return _?.length?(h.current=_[0].id,!0):!1}catch{return!1}}const b=Se(()=>e("div",{class:"filter-bar centered",children:[e(ve,{to:"/mentions",class:r?"":"is-active",onClick:v=>{n&&(v.preventDefault(),d(null))},children:e(p,{id:"N40H+G"})}),e(ve,{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:c,fetchItems:w,checkForUpdates:k,useItemID:!0,timelineStart:b,refresh:r,filterContext:"notifications"})}const su=80,ou=20,cu=new URLSearchParams,xn={block:"start",inline:"center",behavior:"instant"},ic=zi(()=>so()?.mastodon>=2,{expires:1e3*60*5});function sc(n={}){const{masto:i}=se();return ic()?i.v2.notifications.list({limit:ou,...n}):i.v1.notifications.list({limit:su,...n})}function oc(n={}){return sc(n).values()}function cc(n){return ic()?tu(n):nu(n)}const au=["forNotFollowing","forNotFollowers","forNewAccounts","forPrivateMentions","forLimitedAccounts"],ru={forNotFollowing:{id:"d+hDoa"},forNotFollowers:{id:"oAwuQj"},forNewAccounts:{id:"Srs8u7"},forPrivateMentions:{id:"IDC5Uw"},forLimitedAccounts:{id:"XMGM2e"}};function lu({columnMode:n}){const{_:i,_:s}=ie();et(s({id:"iDNBZe"}),"/notifications");const{masto:o,instance:c}=se(),a=Ge(E),[u,d]=R("default"),[r]=n?[cu]:Ct(),l=r.get("id"),h=r.get("access_token"),[f,m]=R(!1),[y,g]=R(!1),w=B(),{nearReachEnd:k,scrollDirection:b,reachStart:v,nearReachStart:_}=rd({scrollableRef:w}),S=b==="end"&&!_,[A,C]=R([]),[x,L]=R([]),P=B(),F=B();async function z(M){if((M||!F.current)&&(P.current=sc({excludeTypes:["follow_request"]}),F.current=P.current.values()),/max_id=($|&)/i.test(F.current?.nextParams))return{done:!0};const ge=await F.current.next(),Ne=tc(ge.value);if(Ne?.length){Ne.forEach(D=>{Je(D.status,c,{skipThreading:!0})});const Pe=cc(Ne);M?(E.notificationsLast=Pe[0],E.notifications=Pe,o.v1.markers.create({notifications:{lastReadId:Pe[0].id}}).catch(()=>{})):E.notifications.push(...Pe)}return E.notificationsShowNew=!1,E.notificationsLastFetchTime=Date.now(),ge}async function K(){try{return await o.v1.followRequests.list({limit:80})}catch{return[]}}const ee=()=>{d("loading"),(async()=>{try{const M=await K();C(M),d("default")}catch{d("error")}})()};async function te(){try{return await o.v1.announcements.list()}catch{return[]}}const G=Qe("@mastodon/filtered-notifications"),[W,H]=R(!1),[Y,$]=R({});function Q(){return o.v2.notifications.policy.fetch().catch(()=>{})}function j(){Q().then(M=>{$(M)}).catch(()=>{})}const[Z,le]=R(null);function ne(){return o.v1.notifications.requests.list()}const J=M=>{be(!1),d("loading"),(async()=>{try{const ge=z(M);M&&(te().then(Pe=>{Pe.sort((D,re)=>Date.parse(re.updatedAt||re.createdAt)-Date.parse(D.updatedAt||D.createdAt)),L(Pe)}).catch(()=>{}),K().then(Pe=>{C(Pe)}).catch(()=>{}),G&&j());const{done:Ne}=await ge;m(!Ne),d("default")}catch{d("error")}})()};V(()=>{J(!0)},[]),V(()=>{v&&J(!0)},[v]);const[we,be]=R(!1),ke=st(({disableIdleCheck:M=!1}={})=>{u!=="loading"&&a.settings.autoRefresh&&w.current?.scrollTop<16&&(M||window.__IDLE__)&&!du()&&J(!0)},[a.notificationsShowNew,a.settings.autoRefresh,u]),ze=B();on(M=>{if(M){const ge=Date.now()-ze.current;!ze.current||ge>1e3*3?ke({disableIdleCheck:!0}):ze.current=Date.now()}});const _e=B(!0);V(()=>{let M=Tc(E,"notificationsShowNew",ge=>{if(_e.current){_e.current=!1;return}u!=="loading"&&(ge&&ke(),be(ge))});return()=>M?.()},[]);const Te=new Date,xe=new Date(Te-1440*60*1e3);let qe=new Date;const Ue=!a.notifications.some(M=>new Date(M.createdAt).toDateString()===Te.toDateString()),He=B();V(()=>{l&&(E.routeNotification={id:l,accessToken:atob(h)})},[l,h]);const[We,ce]=R(null);V(async()=>{const M=new Date;if(M.getMonth()!==11)return;const ge=M.getFullYear();if(!Qe("@mastodon/annual-report"))return;let Ne=Ce.account.get("annualReportNotification");if(Ne&&Ne?.annualReport?.year==ge){ce(Ne);return}const Pe=oc({types:["annual_report"]});try{Ne=(await Pe.next())?.value?.notificationGroups?.[0],Ne?.annualReport?.year==ge&&(ce(Ne),Ce.account.set("annualReportNotification",Ne))}catch{}},[]);const Me=".notification",Ie=Ke("j",()=>{const M=document.activeElement.closest(Me),ge=M?.getBoundingClientRect(),Ne=Array.from(w.current.querySelectorAll(Me));if(M&&ge.top<w.current.clientHeight&&ge.bottom>0){const Pe=Ne.indexOf(M);let D=Ne[Pe+1];D&&(D.focus(),D.scrollIntoView(xn))}else{const Pe=Ne.find(D=>{const re=D.getBoundingClientRect();return re.top>=44&&re.left>=0});Pe&&(Pe.focus(),Pe.scrollIntoView(xn))}},{useKey:!0,ignoreEventWhen:M=>M.metaKey||M.ctrlKey||M.altKey||M.shiftKey}),oe=Ke("k",()=>{const M=document.activeElement.closest(Me),ge=M?.getBoundingClientRect(),Ne=Array.from(w.current.querySelectorAll(Me));if(M&&ge.top<w.current.clientHeight&&ge.bottom>0){const Pe=Ne.indexOf(M);let D=Ne[Pe-1];D&&(D.focus(),D.scrollIntoView(xn))}else{const Pe=Ne.find(D=>{const re=D.getBoundingClientRect();return re.top>=44&&re.left>=0});Pe&&(Pe.focus(),Pe.scrollIntoView(xn))}},{useKey:!0,ignoreEventWhen:M=>M.metaKey||M.ctrlKey||M.altKey||M.shiftKey}),Be=Ke(["enter","o"],()=>{const ge=document.activeElement.closest(Me)?.querySelector(".status-link");ge&&ge.click()},{useKey:!0,ignoreEventWhen:M=>M.metaKey||M.ctrlKey||M.altKey||M.shiftKey}),Ee=new Date,Le=Se(()=>at(Ee,{forceOpts:{weekday:"long"}}),[Ee]);return e("div",{id:"notifications-page",class:"deck-container",ref:M=>{w.current=M,Ie.current=M,oe.current=M,Be.current=M},tabIndex:"-1",children:[e("div",{class:`timeline-deck deck ${y?"only-mentions":""}`,children:[e("header",{hidden:S,onClick:M=>{M.target.closest("a, button")||w.current?.scrollTo({top:0,behavior:"smooth"})},onDblClick:M=>{M.target.closest("a, button")||J(!0)},class:u==="loading"?"loading":"",children:[e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Ft,{}),e(ve,{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:G&&e("button",{type:"button",class:"button plain4",onClick:()=>{H(!0)},children:e(I,{icon:"settings",size:"l",alt:s({id:"a/+arl"})})})})]}),we&&u!=="loading"&&e("button",{class:"updates-button shiny-pill",type:"button",onClick:()=>{J(!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:c})]}),x.length>1&&e("span",{class:"announcements-nav-buttons",children:x.map((M,ge)=>e("button",{type:"button",class:"plain2 small",onClick:()=>{He.current?.children[ge].scrollIntoView({behavior:"smooth",block:"nearest"})},children:ge+1}))})]}),e("ul",{class:`announcements-list-${x.length>1?"multiple":"single"}`,ref:He,children:x.map(M=>e("li",{children:e(uu,{announcement:M})}))})]})})}),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(M=>e("li",{children:[e(gt,{account:M}),e(Ti,{accountID:M.id,onChange:()=>{}})]},M.id))})]}):e("ul",{children:A.map(M=>e("li",{children:[e(gt,{account:M}),e(Ti,{accountID:M.id,onChange:()=>{}})]},M.id))})]}),G&&Y?.summary?.pendingRequestsCount>0&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e("div",{class:"filtered-notifications",children:e("details",{onToggle:async M=>{const{open:ge}=M.target;if(ge){const Ne=await ne();le(Ne)}},children:[e("summary",{children:e(p,{id:"N3Bq0f",values:{0:Y.summary.pendingRequestsCount}})}),Z?Z?.length>0&&e("ul",{children:Z.map(M=>e("li",{children:[e("div",{class:"request-notifcations",children:[!M.lastStatus?.id&&e(gt,{useAvatarStatic:!0,showStats:!0,account:M.account}),M.lastStatus?.id&&e("div",{class:"last-post",children:e(ve,{class:"status-link",to:`/${c}/s/${M.lastStatus.id}`,children:e(je,{status:M.lastStatus,size:"s",readOnly:!0})})}),e(fu,{request:M})]}),e(pu,{request:M,onChange:()=>{J(!0)}})]},M.id))}):e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})})]})})})}),We&&e("div",{class:"shazam-container",children:e("div",{class:"shazam-container-inner",children:e(wn,{notification:We})})}),e("div",{id:"mentions-option",children:e("label",{children:[e("input",{type:"checkbox",checked:y,onChange:M=>{g(M.target.checked)}})," ",e(p,{id:"0udtPI"})]})}),e("h2",{class:"timeline-header",children:[e(p,{id:"ecUA8p"})," ",e("small",{class:"insignificant bidi-isolate",children:Le})]}),Ue&&e("p",{class:"ui-state insignificant",children:u==="default"?s({id:"KS7iJH"}):e(N,{children:"…"})}),a.notifications.length?e(ii.Provider,{value:"notifications",children:a.notifications.filter(M=>M.type!=="follow_request").map(M=>{if(y&&M.type!=="mention")return null;const ge=new Date(M.createdAt),Ne=ge.toDateString()!==qe.toDateString();Ne&&(qe=ge);const Pe=ge.toDateString()===xe.toDateString()?s({id:"y/0uwd"}):at(qe,{hideTime:!0}),D=at(qe,{forceOpts:{weekday:"long"}});return e(N,{children:[Ne&&e("h2",{class:"timeline-header",children:[e("span",{children:Pe})," ",e("small",{class:"insignificant bidi-isolate",children:D})]}),e(wn,{instance:c,notification:M},M._ids||M.id)]},M._ids||M.id)})}):e(N,{children:[u==="loading"&&e(N,{children:e("ul",{class:"timeline flat",children:Array.from({length:5}).map((M,ge)=>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:"███████████ ████"})})]}))})}),u==="error"&&e("p",{class:"ui-state",children:[e(p,{id:"gjzl8E"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>J(!0),children:e(p,{id:"KDw4GX"})})]})]}),f&&e(Lt,{onChange:M=>{M&&J()},children:e("button",{type:"button",class:"plain block",disabled:u==="loading",onClick:()=>J(),style:{marginBlockEnd:"6em"},children:u==="loading"?e(Oe,{abrupt:!0}):e(p,{id:"uXRAkV"})})})]}),G&&W&&e(Fe,{onClick:M=>{M.target===M.currentTarget&&H(!1)},children:e("div",{class:"sheet",id:"notifications-settings",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>H(!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:M=>{M.preventDefault();const{forNotFollowing:ge,forNotFollowers:Ne,forNewAccounts:Pe,forPrivateMentions:D,forLimitedAccounts:re}=M.target,T={...Y,forNotFollowing:ge.value,forNotFollowers:Ne.value,forNewAccounts:Pe.value,forPrivateMentions:D.value,forLimitedAccounts:re.value};$(T),H(!1),(async()=>{try{await o.v2.notifications.policy.update(T),de(s({id:"4+7X9i"}))}catch{}})()},children:[e("p",{children:e(p,{id:"WrkPTf"})}),e("div",{class:"notification-policy-fields",children:au.map(M=>{const ge=Y[M];return e("div",{children:e("label",{children:[i(ru[M]),e("select",{name:M,defaultValue:ge,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"})})]})]})},M)})}),e("p",{children:e("button",{type:"submit",children:e(p,{id:"tfDRzk"})})})]})})]})})]})}function du(){return!!document.querySelector(".deck-backdrop, #modal-container > *")}function uu({announcement:n}){const{instance:i}=se(),{contact:s}=no(),o=s?.account,{id:c,content:a,startsAt:u,endsAt:d,published:r,allDay:l,publishedAt:h,updatedAt:f,read:m,mentions:y,statuses:g,tags:w,emojis:k,reactions:b}=n,v=new Date(h),_=at(v),S=new Date(f),A=at(S);return e("div",{class:"announcement-block",children:[e(gt,{account:o}),e("div",{class:"announcement-content",onClick:fo({mentions:y,instance:i}),dangerouslySetInnerHTML:{__html:ki(a,{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:L,me:P,staticUrl:F,url:z}=C;return e("button",{type:"button",class:`plain4 small ${P?"reacted":""}`,children:[z||F?e("img",{src:z||F,alt:x,width:"16",height:"16"}):e("span",{children:x})," ",e("span",{class:"count",children:Xe(L)})]})})})]})}function hu(n){const{masto:i}=se();return i.v1.notifications.list({accountID:n})}function fu({request:n}){const{instance:i}=se(),[s,o]=R("loading"),{account:c,lastStatus:a}=n,[u,d]=R(!1),[r,l]=R([]);function h(){d(!1)}return V(()=>{n?.account?.id&&u&&(o("loading"),(async()=>{const f=await hu(n.account.id);l(f||[]),o("default")})())},[u,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:c.username},components:{0:e("span",{class:"bidi-isolate"})}})})," ",e(I,{icon:"chevron-down"})]}),u&&e(Fe,{onClick:f=>{f.target===f.currentTarget&&h()},children:e("div",{class:"sheet",tabIndex:"-1",children:[e("button",{type:"button",class:"sheet-close",onClick:h,children:e(I,{icon:"x",alt:t`Close`})}),e("header",{children:e("b",{children:e(p,{id:"MXOmPt",values:{0:c.username},components:{0:e("span",{class:"bidi-isolate"})}})})}),e("main",{children:s==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):r.map(f=>e("div",{class:"notification-peek",onClick:m=>{const{target:y}=m;(m.target.tagName==="BUTTON"||m.target.tagName==="A")&&h()},children:e(wn,{instance:i,notification:f,isStatic:!0})}))})]})})]})}function pu({request:n,onChange:i}){const{_:s}=ie(),{masto:o}=se(),[c,a]=R("default"),[u,d]=R(null),r=u!==null;return e("p",{class:"notification-request-buttons",children:[e("button",{type:"button",disabled:c==="loading"||r,onClick:()=>{a("loading"),(async()=>{try{await o.v1.notifications.requests.$select(n.id).accept(),d("accept"),a("default"),i({request:n,state:"accept"}),de(s({id:"ZtBMwU",values:{0:n.account.username}}))}catch{a("error"),de(s({id:"S92JKG"}))}})()},children:e(p,{id:"h7peZQ"})})," ",e("button",{type:"button",disabled:c==="loading"||r,class:"light danger",onClick:()=>{a("loading"),(async()=>{try{await o.v1.notifications.requests.$select(n.id).dismiss(),d("dismiss"),a("default"),i({request:n,state:"dismiss"}),de(s({id:"ibBDry",values:{0:n.account.username}}))}catch{a("error"),de(s({id:"S5aemF"}))}})()},children:e(p,{id:"1QfxQT"})}),e("span",{class:"notification-request-states",children:c==="loading"?e(Oe,{abrupt:!0}):u==="accept"?e(I,{icon:"check-circle",alt:s({id:"bzMKg7"}),class:"notification-accepted"}):u==="dismiss"&&e(I,{icon:"x-circle",alt:s({id:"J6hrEy"}),class:"notification-dismissed"})})]})}const ac=rt(lu),mu=20;function Ei({local:n,columnMode:i,...s}){const{_:o}=ie(),c=Ge(E),a=!!n,u=i?{}:qt(),{masto:d,instance:r}=se({instance:s?.instance||u.instance}),{masto:l,instance:h}=se(),f=o(a?{id:"u96B/B",values:{instance:r}}:{id:"PgVqvd",values:{instance:r}});et(f,a?"/:instance?/p/l":"/:instance?/p");const m=B(),y=B();async function g(k){if(k||!y.current){const _={limit:mu,local:a||void 0};!a&&Qe("@pixelfed/global-feed")&&(_.remote=!0),y.current=d.v1.timelines.public.list(_).values()}const b=await y.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:a,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(a?{id:"pJQgQV"}:{id:"cg0I+x"})}),e("div",{children:r})]}),id:"public",instance:r,emptyText:o({id:"BiZJ6G"}),errorText:o({id:"scd9lw"}),fetchItems:g,checkForUpdates:w,useItemID:!0,headerStart:e(N,{}),boostsCarousel:c.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(ye,{href:a?`/#/${r}/p`:`/#/${r}/p/l`,children:a?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(Ve,{}),e(ye,{onClick:()=>{let k=prompt(o({id:"2MQ2cd"}));if(!/\./.test(k)){k&&alert(o({id:"7WddtO"}));return}k&&(k=k.toLowerCase().trim(),location.hash=a?`/${k}/p/l`:`/${k}/p`)},children:[e(I,{icon:"bus"})," ",e("span",{children:e(p,{id:"Sq04Yc"})})]}),h!==r&&e(ye,{onClick:()=>{location.hash=a?`/${h}/p/l`:`/${h}/p`},children:[e(I,{icon:"bus"})," ",e("small",{class:"menu-double-lines",children:e(p,{id:"iAzCp4",values:{currentInstance:h},components:{0:e("b",{})}})})]})]})},r+a)}function gu({onItemClick:n}){const{_:i}=ie(),{instance:s}=se(),[,o]=$t(r=>r+1,0),c=ri(),a=()=>{ed(),de({text:i({id:"hgPsUe"}),delay:1e3}),o()},u=(r,l)=>{Jl(r,l),o()},[d]=oi();return c.length===0?null:e("div",{class:"recent-searches",children:[e("div",{class:"recent-searches-header",children:[e(I,{icon:"history"})," ",e("span",{children:e(p,{id:"4R1B1H"})}),e("span",{class:"spacer"}),e("button",{type:"button",class:"plain4 small",onClick:a,disabled:c.length<=0,children:e("span",{children:e(p,{id:"yYxB17"})})})]}),e("ul",{class:"link-list recent-searches-list",ref:d,children:c.map(r=>{const{label:l,to:h,icon:f}=Kt(r.query,r.queryType,s);return e("li",{class:"recent-searches-item",children:[e(ve,{to:h,class:"recent-searches-link",onClick:m=>{On(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:()=>u(r.query,r.queryType),children:e(I,{icon:"trash",alt:i({id:"xCJdfg"})})})]},`${r.query}-${r.queryType}-${r.timestamp}`)})})]})}const Tn=5,wi=40,yu=new URLSearchParams,En={block:"start",inline:"center",behavior:"instant"};function rc({columnMode:n,...i}){const{_:s}=ie(),o=n?{}:qt(),{masto:c,instance:a,authenticated:u}=se({instance:o.instance}),[d,r]=R("default"),[l]=n?[yu]:Ct(),h=B(),f=i?.query||l.get("q"),m=n?"statuses":i?.type||l.get("type");let y=s({id:"A1taO8"});if(f)switch(m){case"statuses":y=s({id:"6YeoAt",values:{q:f}});break;case"accounts":y=s({id:"fpgumQ",values:{q:f}});break;case"hashtags":y=s({id:"AuiMZZ",values:{q:f}});break;default:y=s({id:"wr3GZI",values:{q:f}})}et(y,"/search");const[g,w]=R(!1),k=B(0);V(()=>{k.current=0},[f,m]);const b=B();kt(()=>{b.current?.scrollTo?.(0,0)},[f,m]);const[v,_]=R([]),[S,A]=R([]),[C,x]=R([]);V(()=>{_([]),A([]),x([])},[f]);const L={statuses:v,accounts:S,hashtags:C},P={statuses:_,accounts:A,hashtags:x},[F,z]=R({}),K=async $=>{if(!$?.length)return;const Q=await ni($,F);Q&&z({...F,...Q})};function ee($){$&&(k.current=0),!(!$&&!u)&&(r("loading"),$&&!m&&(_(v.slice(0,Tn)),A(S.slice(0,Tn)),x(C.slice(0,Tn))),(async()=>{const Q={q:f,resolve:u,limit:Tn};m&&(Q.limit=wi,Q.type=m,u&&(Q.offset=k.current));try{const j=await c.v2.search.list(Q);if(m)if($){P[m](j[m]);const Z=j[m]?.length;k.current=wi,w(!!Z)}else if(j[m]?.[0]?.id===L[m]?.[0]?.id)w(!1);else{P[m](le=>[...le,...j[m]]);const Z=j[m]?.length;k.current=k.current+wi,w(!!Z)}else _(j.statuses||[]),A(j.accounts||[]),x(j.hashtags||[]),k.current=0,w(!1);K(j.accounts),r("default")}catch{r("error")}})())}const te=B();on($=>{const Q=b.current?.scrollTop===0;if($&&Q){const j=Date.now()-te.current;!te.current||j>1e3*3?ee(!0):te.current=Date.now()}}),V(()=>{let $;return h.current?.setValue?.(f||""),f?ee(!0):$=setTimeout(()=>{h.current?.focus?.()},150),()=>clearTimeout($)},[f,m,a]),Ke(["Slash","/"],$=>{h.current?.focus?.(),h.current?.select?.()},{useKey:!0,preventDefault:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey});const G=".timeline > li > a, .hashtag-list > li > a",W=Ke("j",()=>{const $=document.activeElement.closest(G),Q=$?.getBoundingClientRect(),j=Array.from(b.current.querySelectorAll(G));if($&&Q.top<b.current.clientHeight&&Q.bottom>0){const Z=j.indexOf($);let le=j[Z+1];le&&(le.focus(),le.scrollIntoView(En))}else{const Z=j.find(le=>{const ne=le.getBoundingClientRect();return ne.top>=44&&ne.left>=0});Z&&(Z.focus(),Z.scrollIntoView(En))}},{useKey:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey}),H=Ke("k",()=>{const $=document.activeElement.closest(G),Q=$?.getBoundingClientRect(),j=Array.from(b.current.querySelectorAll(G));if($&&Q.top<b.current.clientHeight&&Q.bottom>0){const Z=j.indexOf($);let le=j[Z-1];le&&(le.focus(),le.scrollIntoView(En))}else{const Z=j.find(le=>{const ne=le.getBoundingClientRect();return ne.top>=44&&ne.left>=0});Z&&(Z.focus(),Z.scrollIntoView(En))}},{useKey:!0,ignoreEventWhen:$=>$.metaKey||$.ctrlKey||$.altKey||$.shiftKey}),[Y]=oi();return e("div",{id:"search-page",class:"deck-container",tabIndex:"-1",ref:$=>{b.current=$,W.current=$,H.current=$},children:e("div",{class:"timeline-deck deck",children:[e("header",{class:d==="loading"?"loading":"",children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:e(Ft,{})}),e(jo,{ref:h}),e("div",{class:"header-side",children:e("button",{type:"button",class:"plain",onClick:()=>{ee(!0)},disabled:d==="loading",children:e(I,{icon:"search",size:"l",alt:s({id:"A1taO8"})})})})]})}),e("main",{children:[!!f&&!n&&e("div",{ref:Y,class:`filter-bar ${d==="loading"?"loading":""}`,children:[!!m&&e(ve,{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(($,Q)=>$.type===m?-1:Q.type===m?1:0).map($=>e(ve,{to:$.to,children:$.label},$.type))]}),f?e(N,{children:[(!m||m==="accounts")&&e(N,{children:[m!=="accounts"&&e("h2",{class:"timeline-header",children:[e(p,{id:"bPwFdf"})," ",e(ve,{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($=>e("li",{children:e(gt,{account:$,instance:a,showStats:!0,relationship:F[$.id]})},$.id))}),m!=="accounts"&&e("div",{class:"ui-state",children:e(ve,{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(Oe,{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(ve,{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($=>{const{name:Q,history:j}=$,Z=j?.reduce?.((le,ne)=>le+ +ne.uses,0);return e("li",{children:e(ve,{to:a?`/${a}/t/${Q}`:`/t/${Q}`,children:[e(I,{icon:"hashtag",alt:"#"}),e("span",{children:Q}),!!Z&&e("span",{class:"count",children:Xe(Z)})]})},`${Q}-${Z}`)})}),m!=="hashtags"&&e("div",{class:"ui-state",children:e(ve,{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(Oe,{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(ve,{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($=>e("li",{children:e(ve,{class:"status-link",to:a?`/${a}/s/${$.id}`:`/s/${$.id}`,children:e(je,{status:$})})},$.id))}),m!=="statuses"&&e("div",{class:"ui-state",children:e(ve,{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(Oe,{abrupt:!0})}):e("p",{class:"ui-state",children:e(p,{id:"Hzi9AA"})}))]}),!!m&&(d==="default"?g?e(Lt,{onChange:$=>{$&&ee()},children:e("button",{type:"button",class:"plain block",onClick:()=>ee(),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(Oe,{abrupt:!0})}))]}):d==="loading"?e("p",{class:"ui-state",children:e(Oe,{abrupt:!0})}):e(N,{children:[e("p",{class:"ui-state insignificant",children:e(p,{id:"fGn1Hk"})}),e(gu,{})]})]})]})})}const vu=20,lc=600*1e3,bu=St(n=>n.v1.trends.links.list().values().next(),{expires:lc}),wu=St(n=>n.v1.trends.tags.list().values().next(),{expires:lc});function ku(n){return Qe("@pixelfed/trending")?n.pixelfed.v2.discover.posts.trending.list({range:"daily"}).values():n.v1.trends.statuses.list({limit:vu}).values()}function Su(n,i){return n.v1.timelines.link.list(i).values()}function dc({columnMode:n,...i}){const{_:s}=ie(),o=Ge(E),c=n?{}:qt(),{masto:a,instance:u}=se({instance:i?.instance||c.instance}),{masto:d,instance:r}=se(),l=s({id:"cI3UEs",values:{instance:u}});et(l,"/:instance?/trending");const h=B(),f=u===r,[m,y]=R([]),[g,w]=R([]),k=B();async function b(te){if(te||!k.current){if(k.current=ku(a),Qe("@mastodon/trending-hashtags"))try{const{value:H}=await wu(a);H?.length&&y(H)}catch{}if(Qe("@mastodon/trending-links"))try{const{value:H}=await bu(a,u),Y=H?.filter?.($=>$.type==="link");Y?.length&&w(Y)}catch{}}const G=await k.current.next();let{value:W}=G;return W?.length&&(te&&(h.current=W[0].id),W.forEach(H=>{Je(H,u)})),{...G,value:W}}const[v,_]=R(!1),S=B(),[A,C]=R(null),x=!!A,L=B(),P=f&&Qe("@mastodon/trending-link-posts");V(()=>{A&&L.current&&L.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[A]);const F=B();async function z(te){(te||!S.current)&&(_(!0),S.current=Su(a,{url:A})),F.current=A;const G=await S.current.next();let{value:W}=G;return W?.length&&(W=Gt(W,"public"),W.forEach(H=>{Je(H,u)})),F.current===A&&_(!1),{...G,value:W}}async function K(){try{const te=await a.v1.trends.statuses.list({limit:1}).values().next();let{value:G}=te;return G=Gt(G,"public"),G?.length&&G[0].id!==h.current?(h.current=G[0].id,!0):!1}catch{return!1}}const ee=Se(()=>e(N,{children:[!!m.length&&e("div",{class:"filter-bar expandable",children:[e(I,{icon:"chart",class:"insignificant",size:"l"}),m.map((te,G)=>{const{name:W,history:H}=te,Y=H.reduce(($,Q)=>$+ +Q.uses,0);return e(ve,{to:`/${u}/t/${W}`,children:[e("span",{dir:"auto",children:[e("span",{class:"more-insignificant",children:"#"}),W]}),e("span",{class:"filter-count",children:Xe(Y)})]},W)})]}),!!g.length&&e("div",{class:"links-bar",children:[e("header",{children:e("h3",{children:e(p,{id:"9veeTb"})})}),g.map(te=>{const{authors:G,authorName:W,authorUrl:H,blurhash:Y,description:$,height:Q,image:j,imageDescription:Z,language:le,providerName:ne,providerUrl:J,publishedAt:we,title:be,url:ke,width:ze}=te,_e=G?.[0]?.account?.id?G[0].account:null,Te=be.length<30,xe=!!(W||_e),qe=Mi(ke);let Ue;if(Y){const He=Bi(Y),We=ns(He);Ue=ts([.6,We[1],We[2]])}return e("div",{children:[e("a",{ref:A===ke?L:null,href:ke,target:"_blank",rel:"noopener",class:`link-block ${x?A===ke?"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:j,alt:Z,width:ze,height:Q,loading:"lazy"})}),e("div",{class:"article-body",children:[e("header",{children:[e("div",{class:"article-meta",children:[e("span",{class:"domain",children:qe})," ",!!we&&e(N,{children:"· "}),!!we&&e(N,{children:e(xt,{datetime:we,format:"micro"})})]}),!!be&&e("h1",{class:"title",lang:le,dir:"auto",title:be,children:be})]}),!!$&&e("p",{class:`description ${xe&&!Te?"":"more-lines"}`,lang:le,dir:"auto",title:$,children:$}),xe&&e(N,{children:[e("hr",{}),e("p",{class:"byline",children:e("small",{children:e(p,{id:"aavdrC",values:{0:_e?e(mt,{account:_e,showAvatar:!0}):H?e("a",{href:H,target:"_blank",rel:"noopener",children:W}):W}})})})]})]})]})}),P&&e("button",{type:"button",class:"small plain4 block",onClick:()=>{C(ke)},disabled:ke===A,children:[e(I,{icon:"comment2"})," ",e("span",{children:e(p,{id:"/bZzdR"})})," ",e(I,{icon:"chevron-down"})]})]},ke)})]}),P&&!!g.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(Oe,{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,g,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:u})]}),id:"trending",instance:u,emptyText:s({id:"6HA9+s"}),errorText:s({id:"scd9lw"}),fetchItems:x?z:b,checkForUpdates:x?void 0:K,checkForUpdatesInterval:300*1e3,useItemID:!0,headerStart:e(N,{}),boostsCarousel:o.settings.boostsCarousel,filterContext:"public",timelineStart:ee,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(ye,{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!==u&&e(ye,{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",{})}})})]})]})},u)}const js={block:"nearest",inline:"nearest",behavior:"instant"};function Cu(){const{_:n}=ie();et(n({id:"i0qMbr"}),"/");const i=Ge(E),{shortcuts:s}=i,o=s.map(c=>{if(!c)return null;const{type:a,...u}=c,d={following:os,notifications:ac,list:Qo,public:Ei,bookmarks:Vo,favourites:Wo,hashtag:Xo,mentions:nc,trending:dc,search:rc}[a];return!d||a==="search"&&!u.query||a==="list"&&!u.id?null:e(d,{...u,columnMode:!0},a+JSON.stringify(u))});return Ke(["1","2","3","4","5","6","7","8","9"],c=>{try{const a=parseInt(c.key,10)-1,u=document.querySelectorAll("#columns > *")[a];u&&(u.focus(),u.scrollIntoView(js))}catch{}},{useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey}),Ke(["[","]"],(c,a)=>{const u=a.keys[0],d=document.activeElement.closest("#columns > *"),r=jt(),l=r?"]":"[",h=r?"[":"]";let f;u===l?f=d?d.previousElementSibling:document.querySelectorAll("#columns > *")[0]:u===h&&(f=d?d.nextElementSibling:document.querySelectorAll("#columns > *")[1]),f&&(f.focus(),f.scrollIntoView(js))},{useKey:!0,ignoreEventWhen:c=>c.metaKey||c.ctrlKey||c.altKey||c.shiftKey}),e("div",{id:"columns",onContextMenu:c=>{c.target.closest(".deck > header")&&!c.target.closest("a")&&!c.target.closest("button")&&(c.preventDefault(),E.showShortcutsSettings=!0)},onFocus:()=>{const c=document.activeElement.closest("#columns > *");c&&document.querySelectorAll("#columns > *").forEach(a=>{a.classList.toggle("focus",a===c)})},children:o})}function _u(){const{_:n}=ie(),i=Ge(E);return __BENCHMARK.end("time-to-home"),V(()=>{(async()=>{const s=await bt.drafts.keys();if(s.length){const o=Kn();s.filter(a=>a.startsWith(o)).length&&(E.showDrafts=!0)}})()},[]),e(N,{children:(i.settings.shortcutsViewMode==="multi-column"||!i.settings.shortcutsViewMode&&i.settings.shortcutsColumnsMode)&&i.shortcuts?.length?e(Cu,{}):e(os,{title:n({id:"i0qMbr"}),path:"/",id:"home",headerStart:!1,headerEnd:e(Iu,{})})})}function Iu(){const{_:n}=ie(),i=Ge(E),s=B(),[o,c]=R(void 0);return e(N,{children:[e(ve,{ref:s,to:"/notifications",class:`button plain notifications-button ${i.notificationsShowNew?"has-badge":""} ${o||""}`,onClick:a=>{a.stopPropagation(),window.matchMedia("(min-width: calc(40em))").matches&&(a.preventDefault(),c(u=>u?void 0:"open"))},children:e(I,{icon:"notification",size:"l",alt:n({id:"iDNBZe"})})}),e(xu,{state:o,anchorRef:s,onClose:()=>c(void 0)})]})}const Au=5;function xu({anchorRef:n,state:i,onClose:s}){const{masto:o,instance:c}=se(),a=Ge(E),[u,d]=R("default"),r=oc();async function l(){const k=await r.next(),b=tc(k.value);if(b?.length){b.forEach(_=>{Je(_.status,c,{skipThreading:!0})});const v=cc(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[h,f]=R(!1);function m(){return o.v1.followRequests.list({limit:1})}function y({skipFollowRequests:k=!1}={}){d("loading"),(async()=>{try{if(await l(),!k){const b=await m();f(!!b?.length)}d("default")}catch{d("error")}})()}const g=B(),w=52;return V(()=>{i==="open"&&(a.notificationsShowNew?g.current?.scrollTop<=w&&y({skipFollowRequests:!0}):y())},[i,a.notificationsShowNew]),e(Ui,{ref:g,menuClassName:"notifications-menu",state:i,anchorRef:n,onClose:s,portal:{target:document.body},containerProps:{onClick:()=>{g.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(ii.Provider,{value:"notifications",children:e("main",{children:a.notifications.length?e(N,{children:a.notifications.slice(0,Au).map(k=>e(wn,{instance:c,notification:k,disableContextMenu:!0},k._ids||k.id))}):u==="loading"?e("div",{class:"ui-state",children:e(Oe,{abrupt:!0})}):u==="error"&&e("div",{class:"ui-state",children:[e("p",{children:e(p,{id:"5GFQTh"})}),e("p",{children:e("button",{type:"button",onClick:y,children:e(p,{id:"KDw4GX"})})})]})})}),e("footer",{children:[e(ve,{to:"/mentions",class:"button plain",children:[e(I,{icon:"at"})," ",e("span",{children:e(p,{id:"/bZzdR"})})]}),e(ve,{to:"/notifications",class:"button plain2",children:[h?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 Tu=rt(_u),Eu=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function uc(n){const i=URL.parse(n);if(!i)return{};const{hostname:s,pathname:o}=i;for(const c of Eu){const[,a]=o.match(c)||[];if(a)return{instance:s,id:a}}return{}}function Ru(n){const{instance:i,id:s}=uc(n);return i&&s?`/${i}/s/${s}`:null}function Lu(){const i=an().pathname.replace(/^\//,""),s=uc(i),o=s?.instance?`/${s.instance}/s/${s.id}`:null,[c,a]=R("loading");return kt(()=>{a("loading"),(async()=>{try{const{instance:u,id:d}=s;if(d){const{masto:r}=se({instance:u});if(await r.v1.statuses.$select(d).fetch()){window.location.hash=o+"?view=full";return}}}catch{}{const{masto:u,instance:d}=se(),r=await u.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":a("error")}})()},[o]),e("div",{class:"ui-state",tabIndex:"-1",children:[c==="loading"?e(N,{children:[e(Oe,{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(ve,{to:"/",children:e(p,{id:"iWpEwy"})})})]})}function $u(){const{_:n}=ie();et(n({id:"h16FyT"}),"/l");const[i,s]=R("default"),[o,c]=$t(h=>h+1,0),[a,u]=R([]);V(()=>{s("loading"),(async()=>{try{const h=await _i();u(h),s("default")}catch{s("error")}})()},[o]);const[d,r]=R(!1),l=a.some(h=>h.exclusive);return e("div",{id:"lists-page",class:"deck-container",tabIndex:"-1",children:[e("div",{class:"timeline-deck deck",children:[e("header",{children:e("div",{class:"header-grid",children:[e("div",{class:"header-side",children:[e(Ft,{}),e(ve,{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:a.length>0?e(N,{children:[e("ul",{class:"link-list",children:a.map(h=>e("li",{children:e(ve,{to:`/l/${h.id}`,children:[e(I,{icon:"list"})," ",e("span",{children:[h.title,h.exclusive&&e(N,{children:[" ",e(Zt,{insignificant:!0})]})]})]})}))}),a.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:a.length}})})})]})]}):i==="loading"?e("p",{class:"ui-state",children:e(Oe,{})}):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(Fe,{onClick:h=>{h.target===h.currentTarget&&r(!1)},children:e(es,{list:d?.list,onClose:h=>{h.state==="success"&&c(),r(!1)}})})]})}const Mu=""+new URL("instances-Dd-nff5Z.json",import.meta.url).href;function Pu(n){const i=Math.min(500,Math.floor(window.screen.width*.9)),s=Math.min(600,Math.floor(window.screen.height*.8)),o=`popup,width=${i},height=${s}`;try{const c=window.open(n,"auth-popup",o);return!c||c.closed||typeof c.closed>"u"?null:c}catch{return null}}function Du(n){if(n&&!n.closed)try{n.close()}catch{}}function Nu(n,i,s){let o=!1;const c=d=>{d.origin===window.location.origin&&d.data&&d.data.type==="oauth-callback"&&(o=!0,u(),d.data.code?i(d.data.code):s(new Error("No authorization code received")))};window.addEventListener("message",c);const a=setInterval(()=>{(!n||n.closed)&&(clearInterval(a),o||(o=!0,u(),s(new Error("Popup was closed before authentication completed"))))},500),u=()=>{window.removeEventListener("message",c),clearInterval(a),Du(n)};return u}const Ou={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:zu}=Ou;function qu(){const{_:n}=ie();et(n({id:"sQia9P"}),"/login");const i=B(),s=Ce.local.get("instanceURL"),[o,c]=R("default"),[a]=Ct(),u=a.get("instance"),d=a.get("submit"),[r,l]=R(u||s?.toLowerCase()||""),[h,f]=R([]),m=B();V(()=>{(async()=>{try{const S=await(await fetch(Mu)).json();f(S),m.current=new sa(S)}catch{}})()},[]);const y=_=>{_&&(async()=>{try{const A=await(await fetch(`https://${_}/.well-known/host-meta`)).text(),P=new DOMParser().parseFromString(A,"text/xml").getElementsByTagName("Link")[0].getAttribute("template"),F=URL.parse(P),{host:z}=F;_!==z&&(_=z)}catch{}Ce.local.set("instanceURL",_),c("loading");try{let S=co(_);(!S||!S.client_id||!S.client_secret)&&(S=await Na({instanceURL:_}),Ec(_,S));const{client_id:A,client_secret:C}=S,x=await La({instanceURL:_}),L=Rc(_);let P;if(x&&window.isSecureContext)if(A&&C){const[z,K]=await Oa({instanceURL:_,client_id:A,forceLogin:L});Ce.sessionCookie.set("codeVerifier",K),P=z}else{alert(n({id:"ZP1FIA"})),c("default");return}else if(A&&C)P=await za({instanceURL:_,client_id:A,forceLogin:L});else{alert(n({id:"ZP1FIA"})),c("default");return}const F=Pu(P);F?Nu(F,z=>{const K=`${window.location.origin}${window.location.pathname}?code=${encodeURIComponent(z)}`;window.location.href=K},z=>{c("error")}):location.href=P,c("default")}catch{c("error")}})()},g=r?r.replace(/^https?:\/\//,"").replace(/\/+$/,"").replace(/^@?[^@]+@/,"").trim():null,w=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(g)&&!/[\s\/\\@]/.test(g),k=g?m.current?.search(g,{limit:10})?.map(_=>_.item):[],b=w?g:k?.length?k[0]:r?h.find(_=>_.includes(r)):null,v=_=>{_.preventDefault(),y(b)};return d&&V(()=>{y(u||b)},[]),e("main",{id:"login",style:{textAlign:"center"},children:e("form",{onSubmit:v,children:[e("h1",{children:[e("img",{src:Xi,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:()=>{y(_)},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(Oe,{hidden:o!=="loading"}),e("hr",{}),!zu&&e("p",{children:e("a",{href:"https://joinmastodon.org/servers",target:"_blank",children:e(p,{id:"LcOiWS"})})}),e("p",{children:e(ve,{to:"/",children:e(p,{id:"iWpEwy"})})}),e(Qi,{})]})})}const Fu=40;function Uu(){const{_:n}=ie(),i=Ge(E);et(n({id:"+GkIdc"}),"/sp");const{masto:s}=se(),[o,c]=R([]),[a,u]=R("default"),[d,r]=$t(f=>f+1,0),[l,h]=R(!1);return V(r,[i.reloadScheduledPosts]),V(()=>{u("loading"),(async()=>{try{const f=s.v1.scheduledStatuses.list({limit:Fu}).values(),m=[];let y;do y=(await f.next()).value,y?.length&&m.push(...y);while(y?.length);c(m)}catch{u("error")}finally{u("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(Ft,{}),e(ve,{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(ye,{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:y,scheduledAt:g,mediaAttachments:w}=f,{inReplyToId:k,language:b,poll:v,sensitive:_,spoilerText:S,text:A,visibility:C,quotedStatusId:x,quoteApprovalPolicy:L}=y,P={id:m,inReplyToId:k,language:b,mediaAttachments:w,poll:v?{...v,expiresAt:new Date(Date.now()+v.expiresIn*1e3),options:v.options.map(F=>({title:F,votesCount:0}))}:void 0,sensitive:_,spoilerText:S,text:A,visibility:C,content:`<p>${A}</p>`,quotedStatusId:x,quoteApprovalPolicy:L};return e("li",{children:e(Bu,{status:P,scheduledAt:g,onClick:()=>{h({post:P,scheduledAt:new Date(g)})}})},m)})}):e("p",{class:"ui-state",children:a==="loading"?e(Oe,{}):n({id:"mZYb1f"})}),l&&e(Fe,{onClick:f=>{f.target===f.currentTarget&&h(!1)},children:e(Ku,{post:l.post,scheduledAt:l.scheduledAt,onClose:()=>h(!1)})})]})]})})}function Bu({status:n,scheduledAt:i,onClick:s}){const o=Se(()=>{const c=(Date.parse(i)-Date.now())/36e5;return c<24?"time":c<720?"day":"month"},[i]);return e("button",{type:"button",class:"textual block",onClick:s,children:[e("div",{class:`post-schedule-meta post-schedule-${o}`,children:[e(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(je,{status:n,size:"s",previewMode:!0,readOnly:!0})]})}function Ku({post:n,scheduledAt:i,onClose:s}){const{masto:o,instance:c}=se(),{_:a}=ie(),[u,d]=R("default"),[r,l]=R(),h=r&&r.getTime()!==i.getTime(),f=oa(),m=i&&i<=Date.now(),{inReplyToId:y}=n,[g,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:a({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:[!!g&&e("div",{class:"status-reply",children:e(je,{status:g,size:"s",previewMode:!0,readOnly:!0})}),e(je,{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()}),de(a({id:"40naR1"})),s(),d("default"),E.reloadScheduledPosts++}catch{d("error"),de(a({id:"ZM3jAs"}))}})()},children:e("footer",{children:[e("div",{class:"row",children:e("span",{children:[e(ca,{scheduledAt:i,setScheduledAt:b=>{l(b)}})," ",e("small",{class:"ib",children:f})]})}),e("div",{class:"row",children:[e("button",{disabled:!h||u==="loading"||m,children:e(p,{id:"QqW27M"})}),e("span",{class:"grow"}),e(vt,{align:"end",menuItemClassName:"danger",confirmLabel:a({id:"09u3Kk"}),onClick:()=>{d("loading"),(async()=>{try{await se().masto.v1.scheduledStatuses.$select(n.id).remove(),de(a({id:"/zL/Mq"})),s(),d("default"),E.reloadScheduledPosts++}catch{d("error"),de(a({id:"aOh6Md"}))}})()},children:e("button",{type:"button",class:"light danger",disabled:u==="loading"||m,children:e(p,{id:"Jb6/SB"})})})]})]})})]})]})}function Hu(){const{_:n}=ie(),{prevEditedAt:i,nextEditedAt:s,editedAtIndex:o,editHistoryMode:c,editHistoryRef:a,exitEditHistory:u}=yo();return c?e("div",{class:"edit-history-controls",children:[e(I,{icon:"edit"}),e("b",{class:"edit-history-heading",children:n({id:"HSA2au"})}),e("span",{class:"spacer"}),e("span",{class:"edit-history-pagination",children:[e("button",{type:"button",class:"plain4",onClick:()=>{i()},disabled:!c||o+1>=a.current.length,children:e(I,{icon:"chevron-left",alt:n({id:"DHhJ7s"})})})," ",a.current.length-o," /"," ",a.current.length," ",e("button",{type:"button",class:"plain4",onClick:()=>{s()},disabled:!c||o<=0,children:e(I,{icon:"chevron-right",alt:n({id:"hXzOVo"})})})]}),e("button",{type:"button",class:"plain3",onClick:()=>{u()},children:e(I,{icon:"exit",alt:n({id:"ydzS9x"})})})]}):null}const ju={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:Ys}=ju,Rn=40,Yu=10,Vu=5;let Ri={},zn={},qn={};function Fn(n){delete zn[n],delete qn[n]}const un={block:"nearest",inline:"center",behavior:"instant"},Vs=".status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)",Gs=/\/s\//i;function Gu(n){const{id:i}=n,{masto:s,instance:o}=se({instance:n.instance}),c=Ge(E),[a,u]=Ct(),d=a.get("media"),r=a.get("media-only"),l=parseInt(d||r,10);let h=l>0;const f=a.get("mediaStatusID"),m=oo(f,o);f&&!m&&(h=!1);const y=h&&!!r,g=ht(i,o),[w,k]=R(E.statuses[g]);V(()=>{E.statuses[g]&&k(E.statuses[g])},[g]),V(()=>{if(!w||!w.url)return;const C=document.querySelector('link[rel="canonical"]');let x=null,L;return C?(x=C.href,C.href=w.url):(L=document.createElement("link"),L.rel="canonical",L.href=w.url,document.head.appendChild(L)),()=>{C&&x?C.href=x:L&&document.head.removeChild(L)}},[w?.url]);const b=Se(()=>{const{prevLocation:C}=E,x=(C?.pathname||"")+(C?.search||""),L=mn("/:instance/s/:id",x)||mn("/s/:id",x);return!x||L?"/":x},[]);V(()=>{!w&&h&&(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}})()},[h]);const v=f?c.statuses[ht(f,o)]?.mediaAttachments:w?.mediaAttachments,_=()=>window.matchMedia("(min-width: calc(40em + 350px))").matches?"large":"small",S=st(()=>{_()==="small"&&c.prevLocation?history.back():y?location.hash=b:(a.delete("media"),a.delete("mediaStatusID"),u(a))},[y,b,c.prevLocation]),A=st((C,x,L,P)=>{if(_()==="large"&&!y){S();return}if(h&&document.startViewTransition){const F=L[x],{id:z,blurhash:K,url:ee}=F,te=aa(z||K||ee),W=[...document.querySelectorAll(`.status .media [data-view-transition-name="${te}"]`)].filter?.(Y=>{const $=Y.getBoundingClientRect();return $.top<window.innerHeight&&$.bottom>0&&$.left<window.innerWidth&&$.right>0}),H=W.length===1?W[0]:W.find(Y=>!!Y.closest(".status-deck"));H?document.startViewTransition(()=>{H.style.viewTransitionName=te,P?.current&&P.current.querySelectorAll(".media img, .media video")?.forEach($=>{$.style.viewTransitionName=""}),S()}).ready.finally(()=>{H.style.viewTransitionName="",H.dataset.viewTransitioned=te}):S()}else S()},[h,y]);return V(()=>{let C=setTimeout(()=>{const x=document.querySelector(".carousel");x&&x.focus()},100);return()=>clearTimeout(C)},[y]),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:[h?v?.length?e(No,{mediaAttachments:v,statusID:f||i,instance:o,lang:w?.language,index:l-1,onClose:A}):e("div",{class:"media-modal-container loading",children:e(Oe,{abrupt:!0})}):e(ve,{to:b}),!y&&e(ra,{statusID:i,children:e(Zu,{id:i,instance:n.instance,closeLink:b})})]})}function Wu(n){const{linkable:i,to:s,onClick:o,...c}=n;return i?e(ve,{class:"status-link",to:s,onClick:o,...c}):e("div",{class:"status-focus",tabIndex:0,...c})}function Ws(n,i){return Date.parse(n.createdAt)-Date.parse(i.createdAt)}const Zs=1e3*60*60*24*30;function Zu({id:n,closeLink:i="/",instance:s}){const{_:o}=ie(),[c,a]=Ct(),u=c.get("media"),d=c.get("mediaStatusID"),r=parseInt(u,10)>0,l=B(!E.prevLocation&&(history.length===1||"navigation"in window&&navigation?.entries?.()?.length===1)),[h,f]=R(c.get("view")||l.current?"full":null),m=!!parseInt(c.get("translate")),{masto:y,instance:g}=se({instance:s}),{masto:w,instance:k,authenticated:b}=se(),v=g===k,_=Ge(E),[S,A]=R([]),[C,x]=R("default"),L=B(),P=ht(n,g),F=B(0),z=B();V(()=>{z.current?.focus()},[]),V(()=>{const D=vo(()=>{if(!z.current)return;const{scrollTop:re}=z.current;C!=="loading"&&(qn[n]=re)},50);return z.current?.addEventListener("scroll",D,{passive:!0}),D(),()=>{D.cancel(),z.current?.removeEventListener("scroll",D)}},[n,C!=="loading"]);const{editHistoryMode:K,initEditHistory:ee,editedAtIndex:te,editHistoryRef:G}=yo(),W=B(),H=B(),[Y,$]=R(0),Q=B(null),j=()=>{if(!Q.current)return;let{ancestors:D,descendants:re,heroStatus:T}=Q.current;if(K&&re?.length){const U=G.current[te],he=Date.parse(U.createdAt),De=G.current[te-1],$e=De?Date.parse(De.createdAt):null;re=re.filter(nt=>{const tt=Date.parse(nt.editedAt||nt.createdAt);return tt>=he&&(!$e||tt<=$e)})}D.sort(Ws),re.sort(Ws),F.current=re?.length||0;const q=new Set;D.forEach(U=>{Je(U,g,{skipThreading:!0}),U.inReplyToId&&!D.find(he=>he.id===U.inReplyToId)&&q.add(U.inReplyToId)}),T.inReplyToId&&!D.find(U=>U.id===T.inReplyToId)&&q.add(T.inReplyToId),q.forEach(U=>{const he=D.find(De=>De.inReplyToId===U)||(T.inReplyToId===U?T:null);if(he){const De={id:U,ghost:{inReplyToAccountId:he.inReplyToAccountId}};if(he===T)D.push(De);else{const $e=D.indexOf(he);D.splice($e,0,De)}}});const X=new Set,ae=D.every(U=>U.ghost||U.account.id===T.account.id),O=[];re.forEach(U=>{if(Je(U,g,{}),U.inReplyToId&&!re.find(he=>he.id===U.inReplyToId)&&U.inReplyToId!==T.id&&X.add(U.inReplyToId),U.inReplyToAccountId===U.account.id)O.push(U);else if(U.inReplyToId===T.id)O.push(U);else if(!U.inReplyToAccountId&&O.find(he=>he.id===U.inReplyToId&&he.account.id===T.account.id)&&U.account.id===T.account.id)O.push(U);else{const he=re.find(De=>De.id===U.inReplyToId);he&&(he.__replies||(he.__replies=[]),he.__replies.push(U))}}),O.sort((U,he)=>{const De=T.account.id;return U.account.id===De&&he.account.id!==De?-1:he.account.id===De&&U.account.id!==De?1:0}),X.size;let ue=1;function Ae(U,he){const De=he+1;return De>ue&&(ue=he),U?.map($e=>({id:$e.id,account:$e.account,repliesCount:$e.repliesCount,content:$e.content,weight:pn($e),level:De,replies:Ae($e.__replies,De)}))}const me=O.map(U=>({id:U.id,account:U.account,accountID:U.account.id,descendant:!0,thread:U.account.id===T.account.id,weight:pn(U),level:1,replies:Ae(U.__replies,1),createdAt:U.createdAt}));return{allStatuses:[...D.map(U=>({id:U.id,ancestor:!0,ghost:U.ghost,isThread:ae&&!U.ghost,accountID:U.account?.id,account:U.account,repliesCount:U.repliesCount,weight:U.ghost?0:pn(U),createdAt:U.createdAt})),{id:n,accountID:T.account.id,weight:pn(T),createdAt:T.createdAt},...me],ancestorsIsThread:ae,mappedNestedDescendants:me}},Z=({reloadHero:D}={})=>{x("loading");let re;const T=zn[n];if(T){const q=T.filter(X=>E.statuses[P]);A(q)}else A([{id:n}]);return(async()=>{const q=()=>us(()=>y.v1.statuses.$select(n).fetch(),{retries:4}),X=us(()=>y.v1.statuses.$select(n).context.fetch(),{retries:8}),ae=!!_.statuses[P];let O=_.statuses[P];if(!(ae&&!D))try{O=await q(),Je(O,g),await new Promise(ue=>{setTimeout(ue,100)})}catch{x("error");return}try{const ue=await X,{ancestors:Ae}=ue;Q.current={...ue,heroStatus:O};const{allStatuses:me,ancestorsIsThread:Re,mappedNestedDescendants:U}=j(),he=Ae.length&&!Re?[]:U.filter(nt=>nt.thread),De=(Re?Ae.length:0)+he.length;De>0&&De<100&&$(De+1),x("default"),W.current={offsetTop:L.current?.offsetTop,scrollTop:z.current?.scrollTop};const $e=Ae.length||0;$e>=_e&&Te($e+1),A(me),zn[n]=me,Lc(O,g)}catch{x("error")}})(),H.current=Date.now(),()=>{clearTimeout(re)}};V(Z,[n,y]),V(()=>{try{const{allStatuses:D}=j();A(D)}catch{}},[K,te]);const[le,ne]=R(!1);V(()=>{let D=setInterval(()=>{const re=Date.now();H.current&&re-H.current>=6e4&&ne(!0)},6e4);return()=>{clearInterval(D)}},[]),kt(()=>{if(!S.length)return;const D=qn[n];if(D)z.current.scrollTop=D;else if(W.current){const re={offsetTop:L.current?.offsetTop,scrollTop:z.current?.scrollTop},T=re.offsetTop-W.current.offsetTop+re.scrollTop;z.current.scrollTop=T}else S.length===1&&(z.current.scrollTop=0);W.current=null},[S]),V(()=>{_.reloadStatusPage<=0||(async()=>{try{const{instanceURL:D}=Ni(),re=`https://${D}/api/v1/statuses/${n}/context`;return await(await caches.open("api")).delete(re,{ignoreVary:!0}),Z({reloadHero:!0})}catch{}})()},[_.reloadStatusPage]),V(()=>()=>{qn={},E.reloadStatusPage=0,zn={},Ri={},Li.clear()},[]);const J=_.statuses[P]||_.statuses[n],we=Se(()=>{if(!J)return"";const{account:D}=J,re=document.createElement("div");return re.innerHTML=D.displayName,re.innerText.trim()},[J]),be=Se(()=>{if(!J)return"";let D=ti(J);return D.length>64&&(D=D.slice(0,64)+"…"),D},[J]);et(we&&be?`${we}: "${be}"`:o({id:"post.title"}),"/:instance?/s/:id");const ke=Se(()=>{if(!J)return;const{url:D}=J;if(D)return URL.parse(D)?.hostname},[J]),ze=Se(()=>{if(ke)return ke===g},[ke,g]),[_e,Te]=R(Rn),xe=Se(()=>S.length-_e,[S.length,_e]),qe=S.some(D=>D.descendant),Ue=S.filter(D=>D.ancestor),[He,We]=R(!0),ce=Se(()=>{if(!L.current||He)return null;const{top:D}=L.current.getBoundingClientRect();return D>0?"down":"up"},[He]);Ke("esc",()=>{location.hash=i},{enabled:!r,ignoreEventWhen:D=>!!document.querySelector("#modal-container > *")||D.metaKey||D.ctrlKey||D.altKey||D.shiftKey,useKey:!0}),Ke("backspace",()=>{location.hash=i},{useKey:!0,ignoreEventWhen:D=>D.metaKey||D.ctrlKey||D.altKey||D.shiftKey}),Ke("j",()=>{const D=document.activeElement.closest(".status-link, .status-focus"),re=D?.getBoundingClientRect(),T=Array.from(z.current.querySelectorAll(Vs));if(D&&re.top<z.current.clientHeight&&re.bottom>0){const q=T.indexOf(D);let X=T[q+1];X&&(X.focus(),X.scrollIntoView(un))}else{const q=T.find(X=>{const ae=X.getBoundingClientRect();return ae.top>=44&&ae.left>=0});q&&(q.focus(),q.scrollIntoView(un))}},{useKey:!0,ignoreEventWhen:D=>D.metaKey||D.ctrlKey||D.altKey||D.shiftKey}),Ke("k",()=>{const D=document.activeElement.closest(".status-link, .status-focus"),re=D?.getBoundingClientRect(),T=Array.from(z.current.querySelectorAll(Vs));if(D&&re.top<z.current.clientHeight&&re.bottom>0){const q=T.indexOf(D);let X=T[q-1];X&&(X.focus(),X.scrollIntoView(un))}else{const q=T.find(X=>{const ae=X.getBoundingClientRect();return ae.top>=44&&ae.left>=0});q&&(q.focus(),q.scrollIntoView(un))}},{useKey:!0,ignoreEventWhen:D=>D.metaKey||D.ctrlKey||D.altKey||D.shiftKey}),Ke("x",()=>{const D=document.activeElement.closest(".status-link, .status-focus");if(D){const re=D.nextElementSibling;re&&re.tagName.toLowerCase()==="details"&&(re.open=!re.open)}},{useKey:!0,ignoreEventWhen:D=>D.metaKey||D.ctrlKey||D.altKey||D.shiftKey});const[Me,Ie]=R(!1),oe=B(r?"media+status":"status"),Be=st((D,re,T,q)=>{D.preventDefault(),D.stopPropagation(),a({media:re+1,mediaStatusID:q.id})},[n]),Ee=st((D,re)=>{Fn(re.id)},[]);V(()=>{let D;return d&&r&&(D=setTimeout(()=>{const re=z.current?.querySelector(`.status-link[href*="/${d}"]`);re&&re.scrollIntoView(un)},400)),()=>{clearTimeout(D)}},[d,r]);const Le=st((D,re)=>{const{id:T,ancestor:q,ghost:X,isThread:ae,descendant:O,thread:ue,replies:Ae,repliesCount:me,weight:Re,level:U}=D,he=T===n;return e("li",{ref:he?L:null,class:`${q?"ancestor":""} ${O?"descendant":""} ${ue?"thread":""} ${he?"hero":""}`,children:[he?e(N,{children:[e(Lt,{threshold:.1,onChange:$e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{We($e)})})},class:"status-focus",tabIndex:0,children:e(je,{statusID:T,instance:g,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(ve,{to:Ys?`/login?instance=${Ys}&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:g},components:{0:e("b",{})}})}),e("button",{type:"button",disabled:C==="loading",onClick:()=>{x("loading"),(async()=>{try{const $e=await w.v2.search.list({q:J.url,type:"statuses",resolve:!0,limit:1});if($e.statuses.length){const nt=$e.statuses[0];location.hash=k?`/${k}/s/${nt.id}`:`/s/${nt.id}`}else throw new Error("No results")}catch($e){x("default"),alert(o({id:"DnepCE",values:{e:$e}}))}})()},children:[e(I,{icon:"transfer"})," ",e(p,{id:"ejAVrO"})]})]})]}):e(Wu,{linkable:!X&&(ae||q),to:g?`/${g}/s/${T}`:`/s/${T}`,onClick:()=>{Fn(T)},children:[X?e(je,{statusID:T,instance:g,withinContext:!0,size:"m",ghost:X}):re===0&&q?e(Lt,{threshold:.5,onChange:$e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Ie($e)})})},children:e(je,{statusID:T,instance:g,withinContext:!0,size:ue||q?"m":"s",enableTranslate:!0,onMediaClick:Be,onStatusLinkClick:Ee})}):e(je,{statusID:T,instance:g,withinContext:!0,size:ue||q?"m":"s",enableTranslate:!0,onMediaClick:Be,onStatusLinkClick:Ee,showActionsBar:!!O}),q&&me>1&&e("div",{class:"replies-link",children:[e(I,{icon:"comment2",alt:o({id:"N8UzTV"})})," ",e("span",{title:me,children:Xe(me)})]})," "]}),O&&Ae?.length>0&&e(hc,{instance:g,replies:Ae,hasParentThread:ue,level:U,accWeight:Re,openAll:F.current<Yu,parentLink:{to:g?`/${g}/s/${T}`:`/s/${T}`,onClick:()=>Fn(T)}}),C==="loading"&&he&&!!J?.repliesCount&&!qe&&e("div",{class:"status-loading",children:e(Oe,{abrupt:J.repliesCount>=3})}),C==="error"&&he&&!!J?.repliesCount&&!qe&&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,g,C,b,v,m,Be,Ee,qe]),M=Se(()=>{if("navigation"in window&&navigation?.entries){const D=navigation.entries()[navigation.currentEntry.index-1];if(D?.url)return Gs.test(D.url)}return Gs.test(E.prevLocation?.pathname)},[P]),ge=Se(()=>{if(!xe)return[];const D=[];function re(T){D.push(T.id),T.replies&&T.replies.forEach(re)}return S.slice(_e).forEach(re),D.map(T=>ht(T,g))},[xe,S,_e,g]);function Ne(D){if(D<12)return pe._({id:"DqsEm+",values:{months:D}});{const re=Math.floor(D/12);return pe._({id:"24w+FD",values:{years:re}})}}const Pe=Se(()=>{const D=[],re=S.slice(0,_e);for(let T=0;T<re.length;T++){const q=re[T];if(T>0){const X=re[T-1],{createdAt:ae,descendant:O,thread:ue,id:Ae}=q;if(X?.createdAt&&ae){const me=Date.parse(ae);if(isFinite(me)&&me>Zs){const Re=Date.parse(X.createdAt);if(Re&&isFinite(Re)){const{ancestor:U,id:he}=X,$e=~~((me-Re)/Zs);$e>0&&D.push(e("li",{style:{"--time-gap-range":Math.min(12,$e)},class:`time-gap ${U?"ancestor":""} ${O?"descendant":""} ${ue?"thread":""}`,children:Ne($e)},`time-gap-${Ae}-${he}`))}}}}D.push(Le(q,T))}return D},[S,_e,Le,K,te]);return V(()=>{let D=setTimeout(()=>{if(!L.current)return;const re=L.current.querySelector(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)");re&&re.click()},1e3);return()=>clearTimeout(D)},[n]),e(la.Provider,{value:Y,children:e("div",{tabIndex:"-1",ref:z,class:`status-deck deck contained ${S.length>1?"padded-bottom":""} ${oe.current==="status"&&!l.current?"slide-in":""} ${h?`deck-view-${h}`:""} ${K?"edit-history-mode":""}`,style:K?{"--edit-history-percentage":`${te/(G.current.length-1)}`}:void 0,onAnimationEnd:D=>{oe.current==="status"&&(oe.current=null)},children:[e("header",{class:`${C==="loading"?"loading":""}`,onDblClick:D=>{E.reloadStatusPage++},children:e("div",{class:"header-grid header-grid-2",children:[e("h1",{children:[M&&e("button",{type:"button",class:"plain deck-back",onClick:()=>{history.back()},children:e(I,{icon:"chevron-left",size:"xl",alt:o({id:"iH8pgl"})})}),!He&&J&&C!=="loading"?e(N,{children:[e("span",{class:"hero-heading",children:[e(mt,{account:J.account,instance:g,showAvatar:!0,short:!0})," ",e("span",{class:"insignificant",children:["•"," ",e(xt,{datetime:J.createdAt,format:"micro"})]})]})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:D=>{D.preventDefault(),D.stopPropagation(),L.current.scrollIntoView({behavior:"smooth",block:"start"})},title:o({id:"NCy+Nw"}),children:e(I,{icon:ce==="down"?"arrow-down":"arrow-up"})})]}):e(N,{children:[e(p,{id:"post.title"})," ",e("button",{type:"button",class:"ancestors-indicator light small",onClick:D=>{D.preventDefault(),D.stopPropagation(),z.current.scrollTo({top:0,behavior:"smooth"})},hidden:!Ue.length||Me,title:o({id:"R8CUl0",values:{0:Ue.length}}),children:[e(I,{icon:"arrow-up"}),Ue.filter(D=>!D.ghost).filter((D,re,T)=>T.findIndex(q=>q.accountID===D.accountID)===re).slice(0,3).map(D=>e(ut,{url:D.account.avatarStatic||D.account.avatar,alt:D.account.displayName,squircle:D.account?.bot},D.account.id)),Ue.length>3&&e(N,{children:[" ",e("span",{class:"insignificant",children:Xe(Ue.length)})]})]})]})]}),e("div",{class:"header-side",children:[e("button",{type:"button",class:"plain4 button-switch-view",style:{display:h==="full"?"":"none"},onClick:()=>{f(null),c.delete("media"),c.delete("media-only"),c.delete("view"),a(c)},title:o({id:"+/xYEI"}),children:e(I,{icon:"layout4",size:"l"})}),le&&e("button",{type:"button",class:"plain button-refresh",onClick:()=>{E.reloadStatusPage++,ne(!1)},children:e(I,{icon:"refresh",size:"l",alt:o({id:"lCF0wC"})})}),e(ft,{align:"end",portal:{target:z.current},menuButton:e("button",{type:"button",class:"button plain4",children:e(I,{icon:"more",alt:o({id:"2FYpfJ"}),size:"xl"})}),children:[e(ye,{disabled:C==="loading",onClick:()=>{E.reloadStatusPage++},children:[e(I,{icon:"refresh"}),e("span",{children:e(p,{id:"lCF0wC"})})]}),e(ye,{className:"menu-switch-view",onClick:()=>{f(h==="full"?null:"full"),c.delete("media"),c.delete("media-only"),h==="full"?c.delete("view"):c.set("view","full"),a(c)},children:[e(I,{icon:{"":"layout5",full:"layout4"}[h||""]}),e("span",{children:o(h==="full"?{id:"+/xYEI"}:{id:"2LiWsE"})})]}),e(ye,{onClick:()=>{Array.from(z.current.querySelectorAll(".spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)")).forEach(re=>{re.click()})},children:[e(I,{icon:"eye-open"})," ",e("span",{children:e(p,{id:"8r8KmB"})})]}),e(Ve,{}),e(Ki,{className:"plain",children:e(p,{id:"Rsjgm0"})}),e(ye,{disabled:!ke||ze,onClick:()=>{const D=Ru(J.url);D?location.hash=D:alert(o({id:"9J6biQ"}))},children:[e(I,{icon:"transfer"}),e("small",{class:"menu-double-lines",children:o(ke?{id:"Kp9SAs",values:{0:ei.toUnicode(ke)}}:{id:"lb07+k"})})]}),e(ye,{disabled:!v||C==="loading"||!J?.editedAt||!F.current,onClick:ee,children:[e(I,{icon:"edit"}),e("span",{children:o({id:"OqaQnE"})})]})]}),e(ve,{class:"button plain deck-close",to:i,children:e(I,{icon:"x",size:"xl",alt:o({id:"yz7wBu"})})})]})]})}),e(Hu,{}),S.length&&J?e("ul",{class:`timeline flat contextual grow ${C==="loading"?"loading":""}`,children:[Pe,xe>0&&e("li",{class:"descendant descendant-more",children:e("button",{type:"button",class:"plain block show-more",disabled:C==="loading",onClick:()=>Te(D=>D+Rn),style:{marginBlockEnd:"6em"},"data-state-post-ids":ge.join(" "),children:[e("div",{class:"ib avatars-bunch",children:S.slice(_e,_e+5).map(D=>e(ut,{url:D.account.avatarStatic},D.id))})," ",e("div",{class:"ib",children:[e(p,{id:"uXRAkV"})," ",e("span",{class:"tag",children:xe>Rn?`${Rn}+`:xe})]})]})})]}):e(N,{children:[C==="loading"&&e("ul",{class:"timeline flat contextual grow loading",children:e("li",{children:e(je,{skeleton:!0,size:"l"})})}),C==="error"&&e("p",{class:"ui-state",children:[e(p,{id:"JWxodU"}),e("br",{}),e("br",{}),e("button",{type:"button",onClick:()=>{E.reloadStatusPage++},children:e(p,{id:"KDw4GX"})})]})]})]})})}function hc({replies:n,instance:i,hasParentThread:s,level:o,accWeight:c,openAll:a,parentLink:u}){const{_:d}=ie(),[r,l]=Ct(),h=x=>x.reduce((L,P)=>{const{repliesCount:F,replies:z}=P,K=z?.length||F;return L+K+h(z||[])},0),f=n.length+h(n),m=n.length===f,y=n.map(x=>x.account).filter((x,L,P)=>P.findIndex(F=>F.id===x.id)===L).slice(0,3),g=Se(()=>n?.reduce((x,L)=>x+L?.weight,c),[c,n?.length]);let w=!1;(a||g<=Vu||!s&&f===1&&pn(n[0])<2)&&(w=!0);const k=Ri[n[0].id],b=st((x,L,P,F)=>{x.preventDefault(),x.stopPropagation(),l({media:L+1,mediaStatusID:F.id})},[]),v=B();kt(()=>{function x(L){L.target.dataset.scrollLeft=L.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:L}=x.target;Ri[n[0].id]=L}:void 0,style:{"--comments-level":o},"data-comments-level":o,"data-comments-level-overflow":o>4,children:[!w&&e("summary",{class:"replies-summary",hidden:w,children:[e("span",{class:"avatars",children:y.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:Xe(n.length)},components:{0:e("span",{title:n.length})}})}),!m&&f>1&&e(N,{children:[" ","·"," ",e("span",{children:e(p,{id:"qSQQSe",values:{0:Xe(f),totalComments:f},components:{0:e("span",{title:f})}})})]})]}),e(I,{icon:"chevron-down",class:"replies-summary-chevron"}),!!u&&e(ve,{class:"replies-parent-link",to:u.to,onClick:u.onClick,title:d({id:"ZlV82A"}),children:"»"})]}),_&&e("ul",{children:n.map(x=>e("li",{children:[e("div",{class:"status-focus",tabIndex:0,children:[e(je,{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:Xe(x.repliesCount)})]})]}),x.replies?.length&&e(hc,{instance:i,replies:x.replies,level:x.level,accWeight:w?g:x.weight,openAll:a,parentLink:{to:i?`/${i}/s/${x.id}`:`/s/${x.id}`,onClick:()=>{Fn(x.id)}}})]},x.id))})]})}const Xu=140,Qu=35,Ju=70,eh=140,Li=new Map;function pn(n){const i=Li.get(n.id);if(i)return i;const{spoilerText:s,content:o,mediaAttachments:c,poll:a,card:u}=n,d=go(s+o),r=c?.length?Xu:0,l=(a?.options?.length||0)*Qu,h=u&&(c?.length||a?.options?.length)?0:Ju,m=(d+r+l+h)/eh;return Li.set(n.id,m),m}const th=rt(Gu);function nh(){const n=qt(),{id:i,instance:s}=n;return e(th,{id:i,instance:s})}const ih=""+new URL("boosts-carousel-BiOaNdMT.jpg",import.meta.url).href,sh=""+new URL("multi-column-ROck0NVt.jpg",import.meta.url).href,oh=""+new URL("multi-hashtag-timeline-DH5INVHi.jpg",import.meta.url).href,ch=""+new URL("nested-comments-thread-hv59kZLc.jpg",import.meta.url).href,ah="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",rh={BASE_URL:"./",DEV:!1,MODE:"production",PHANPY_CLIENT_NAME:"Phanpy",PHANPY_PRIVACY_POLICY_URL:"https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD",PHANPY_TRANSLANG_INSTANCES:"translang.phanpy.social",PROD:!0,SSR:!1,VITE_APP_ENV:"production"},{PHANPY_DEFAULT_INSTANCE:hn,PHANPY_WEBSITE:Jn,PHANPY_PRIVACY_POLICY_URL:lh,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Xs}=rh,Qs=Jn?Jn.replace(/https?:\/\//g,"").replace(/\/$/,""):null,dh=Jn?Jn.toLowerCase().includes(location.hostname):!1,Js=`${"2026-01-07T13:03:46.000Z".slice(0,10).replace(/-/g,".")}.2e1d0c4`;function fc(){const{_:n}=ie();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:Xi,alt:"",width:"160",height:"160",style:{aspectRatio:"1/1",marginBlockEnd:-16}}),e("img",{src:ah,alt:"Phanpy",width:"200"})]}),e("p",{class:"desc",children:e(p,{id:"Ogtv0V"})}),e("p",{children:e(ve,{to:hn?`/login?instance=${hn}&submit=1`:"/login",class:"button",children:n(hn?{id:"sQia9P"}:{id:"ZLoGls"})})}),hn&&Xs&&e("p",{children:e("a",{href:Xs,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",{})}})})})]}),(Qs||Js)&&e("p",{class:"app-site-version",children:e("small",{children:[dh?Qs:""," ",Js]})}),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:lh,target:"_blank"})}})}),e("div",{children:e(Qi,{})})]}),e("div",{id:"why-container",children:e("div",{class:"sections",children:[e("section",{children:[e("img",{src:ih,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:Go,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:ch,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:sh,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:oh,alt:n({id:"wOax6E"}),loading:"lazy"}),e("h4",{children:e(p,{id:"Wi1Ov0"})}),e("p",{children:e(p,{id:"tS2i+h"})})]})]})})]})}const uh=window.alert;window.__nativeAlert||(window.__nativeAlert=uh);window.alert=function(n){n instanceof Error&&n?.message&&(n=n.message),typeof n!="string"&&(n=JSON.stringify(n));const i=da({text:n,className:"alert",gravity:"top",position:"center",duration:1e4,offset:{y:48},onClick:()=>{i.hideToast()}});i.showToast()};const hh=$c(()=>Pi(()=>import("./year-in-posts-w9jDim8R.js"),__vite__mapDeps([4,1,2,3]),import.meta.url));window.__STATES__=E;window.__STATES_STATS__=()=>{const n=["statuses","accounts","spoilers","unfurledLinks","statusQuotes"],i={};n.forEach(c=>{i[c]=Object.keys(E[c]).length});const{statuses:s}=E,o=[];for(const c in s)document.querySelector(`[data-state-post-id~="${c}"], [data-state-post-ids~="${c}"]`)||o.push(c)};setInterval(()=>{if(!window.__IDLE__)return;const{statuses:n,unfurledLinks:i,notifications:s}=E;let o=0;const{instance:c}=se();for(const a in n){if(!window.__IDLE__)break;try{const u=document.querySelector(`[data-state-post-id~="${a}"], [data-state-post-ids~="${a}"]`),d=s.some(r=>a===ht(r.status?.id,c));if(!u&&!d){delete E.statuses[a],delete E.statusQuotes[a];for(const r in i){const l=i[r];if(ht(l.id,l.instance)===a){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=vo(i,3e3),c=()=>{window.__IDLE__=!1,o()};n.forEach(a=>{window.addEventListener(a,c,{passive:!0,capture:!0})}),window.addEventListener("blur",i,{passive:!0}),document.documentElement.addEventListener("mouseleave",a=>{!a.relatedTarget&&!a.toElement&&i()},{passive:!0})})();const fh=/iPad|iPhone|iPod/.test(navigator.userAgent);fh&&document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="visible"){if(document.getElementsByClassName("media-modal-container").length>0)return;const i=Ce.local.get("theme");let s;if(i){if(s=document.querySelector('meta[name="theme-color"][data-theme-setting="manual"]'),s){const o=s.content,c=i==="light"?s.dataset.themeLightColorTemp:s.dataset.themeDarkColorTemp;s.content=c||"",setTimeout(()=>{s.content=o},10)}}else{const o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(s=document.querySelector(`meta[name="theme-color"][media*="${o}"]`),s){const c=s.dataset.content,a=s.dataset.contentTemp;s.content=a||"",setTimeout(()=>{s.content=c},10)}}}});{const n=Ce.local.get("theme");if(n){document.documentElement.classList.add(`is-${n}`),document.querySelector('meta[name="color-scheme"]').setAttribute("content",n||"light dark");const s=document.querySelector('meta[data-theme-setting="manual"]');s&&(s.name="theme-color",s.content=n==="light"?s.dataset.themeLightColor:s.dataset.themeDarkColor),document.querySelectorAll('meta[data-theme-setting="auto"]').forEach(c=>{c.name=""})}const i=Ce.local.get("textSize");i&&document.documentElement.style.setProperty("--text-size",`${i}px`)}io(E,n=>{for(const[i,s,o,c]of n){if(s.join(".")==="settings.shortcutsViewMode"){const a=document.getElementById("app");a&&(a.dataset.shortcutsViewMode=E.shortcuts?.length?o:"")}s.join(".")==="settings.cloakMode"&&document.body.classList.toggle("cloak",o)}});const Ln=new Map;window.__BENCH_RESULTS=new Map;window.__BENCHMARK={start(n){},end(n){}};document.body.classList.toggle("exp-tab-bar-v2",Ce.local.get("experiments-tabBarV2")??!1);const eo=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone===!0,ph=3600*1e3;function mh(){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"),ie(),V(()=>{const d=Ce.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:h,client_secret:f,vapid_key:m}=co(d)||{},y=Bn(d)||m,g=Ce.sessionCookie.get("codeVerifier");(async()=>{o("loading");const{access_token:w}=await qa({instanceURL:d,client_id:h,client_secret:f,code:r,code_verifier:g||void 0});if(w){const k=Mc({instance:d,accessToken:w});await Promise.allSettled([di(k),ui(k,d),Pc(k,d,w,y)]),rs(),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 h;if(l&&(h=Dc(l),h&&(Un(h.info.id),window.history.replaceState({},document.title,window.location.pathname||"/"))),h||(h=Ni()),h){Un(h.info.id);const{client:f}=se({account:h}),{instance:m}=f;rs(),o("loading"),(async()=>{try{Nc()&&Oc(m)?(di(f),ui(f,m)):await Promise.allSettled([di(f),ui(f,m)])}catch{}finally{i(!0),o("default"),__BENCHMARK.end("app-init")}})()}else o("default"),__BENCHMARK.end("app-init")}Ce.sessionCookie.del("clientID"),Ce.sessionCookie.del("clientSecret"),Ce.sessionCookie.del("codeVerifier")},[]);let c=an();E.currentLocation=c.pathname,V(Ci,[c,n]);const a=B(!1),u="pwaLastPath";return V(()=>{a.current&&eo&&n&&(pc(c.pathname)?Ce.local.del(u):Ce.local.setJSON(u,{path:c.pathname+c.search,lastAccessed:Date.now()}))},[c.pathname,c.search,n]),V(()=>{if(!(a.current||!(!c.pathname||c.pathname==="/"))&&eo&&n&&s==="default"){const r=Ce.local.getJSON(u);r&&setTimeout(()=>{r?.path&&Date.now()-(r.lastAccessed||0)<ph&&(window.location.hash=r.path),Ce.local.del(u)},300),a.current=!0}},[s,n]),/\/https?:/.test(c.pathname)?e(Lu,{}):s==="loading"?e(Oe,{id:"loader-root"}):e(N,{children:[e(yh,{isLoggedIn:n}),e(vh,{isLoggedIn:n}),e(qi,{children:e(Ze,{path:"/:instance?/s/:id",element:e(nh,{})})}),n&&e(ma,{}),n&&e(id,{}),e(Yl,{}),n&&e(Xl,{}),e(fa,{isLoggedIn:n}),n&&e(Vl,{}),e(td,{onClose:Ci}),e(ga,{})]})}function gh({isLoggedIn:n}){return n&&__BENCHMARK.end("time-to-isLoggedIn"),n?e(Tu,{}):e(fc,{})}function pc(n){return/^\/(login|welcome|_sandbox|_qr-scan)/i.test(n)}const yh=rt(({isLoggedIn:n})=>{const i=an(),s=Se(()=>{const{pathname:o}=i;return!pc(o)},[i]);return e(qi,{location:s||i,children:[e(Ze,{path:"/",element:e(gh,{isLoggedIn:n})}),e(Ze,{path:"/login",element:e(qu,{})}),e(Ze,{path:"/welcome",element:e(fc,{})}),void 0]})});function to(){return E.prevLocation||null}function vh({isLoggedIn:n}){const i=an(),s=B(to());return Se(()=>mn("/:instance/s/:id",i.pathname)||mn("/s/:id",i.pathname),[i.pathname,mn])?s.current||(s.current=to()):s.current=null,e(qi,{location:s.current||i,children:[n&&e(N,{children:[e(Ze,{path:"/notifications",element:e(ac,{})}),e(Ze,{path:"/mentions",element:e(nc,{})}),e(Ze,{path:"/following",element:e(os,{})}),e(Ze,{path:"/b",element:e(Vo,{})}),e(Ze,{path:"/f",element:e(Wo,{})}),e(Ze,{path:"/l",children:[e(Ze,{index:!0,element:e($u,{})}),e(Ze,{path:":id",element:e(Qo,{})})]}),e(Ze,{path:"/fh",element:e(jd,{})}),e(Ze,{path:"/sp",element:e(Uu,{})}),e(Ze,{path:"/ft",element:e(Ud,{})}),e(Ze,{path:"/catchup",element:e(Ed,{})}),e(Ze,{path:"/yip",element:e(zc,{fallback:e("div",{id:"year-in-posts-page",class:"deck-container",tabIndex:"-1",children:e(Oe,{})}),children:e(hh,{})})}),e(Ze,{path:"/annual_report/:year",element:e(Sd,{})})]}),e(Ze,{path:"/:instance?/t/:hashtag",element:e(Xo,{})}),e(Ze,{path:"/:instance?/a/:id",element:e(vd,{})}),e(Ze,{path:"/:instance?/p",children:[e(Ze,{index:!0,element:e(Ei,{})}),e(Ze,{path:"l",element:e(Ei,{local:!0})})]}),e(Ze,{path:"/:instance?/trending",element:e(dc,{})}),e(Ze,{path:"/:instance?/search",element:e(rc,{})})]})}qc();Fc();Uc(e(Bc,{i18n:pe,children:e(Kc,{children:e(Hc,{children:e(mh,{})})})}),document.getElementById("app"));setTimeout(()=>{try{localStorage.removeItem("settings-groupedNotificationsAlpha")}catch{}},5e3);if("serviceWorker"in navigator&&typeof caches<"u"){const i=["icons"];let s=!1;const o=1e4,c=3600*1e3;async function a(){if(window.__IDLE__)try{const u=await caches.keys();for(const d of u){if(i.includes(d))continue;const r=await caches.open(d),l=await r.keys();if(l.length>50){const h=l.slice(50);for(const f of h)await r.delete(f)}}s=!0}catch{}setTimeout(a,s?c:o)}setTimeout(a,o)}window.__CLOAK__=()=>{document.body.classList.toggle("cloak")};export{pt as B,Ft as N,Eo as i,$h as u};
|
||
//# sourceMappingURL=main-0n0W_4XT.js.map
|