phanpy/assets/useTitle-zvzl1Hla.js

64 lines
135 KiB
JavaScript
Raw Normal View History

import{K as Ya,L as Ja,D as Za,O as ca,P as la,Q as Xa,U as Qa,v as ua,i as eo,_ as Q,p as fe,h as Z,a as e,u as Ve,V as to,e as no,N as da,W as ao,X as oo,M as Te,Y as io,S as ro,g as W,w as pn,Z as so,$ as gt,a0 as co,a1 as lo,a2 as uo,a3 as mo,B as ho,a4 as po,a5 as fo,a6 as go,a7 as vo,a8 as bo,a9 as yo,aa as _o,ab as ko,ac as wo,ad as ma,ae as xo,f as ha,af as Eo,T as pa,F as $e,y as mn,ag as zn,r as To,b as yt,q as Lo,o as Ao,d as Xt,J as fa,C as Co,ah as Fo,ai as Nn,aj as So,ak as Bn,al as $o,m as Po,x as Vn}from"./vendor--8C7Txey.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const c of r.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function a(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(o){if(o.ep)return;o.ep=!0;const r=a(o);fetch(o.href,r)}})();function ga(t){const n=O.local.getJSON("accounts")||[];return n.find(a=>a.info.id===t)||n[0]}function Io(t){return(O.local.getJSON("accounts")||[]).find(a=>a.accessToken===t)}function Ro(t){return(O.local.getJSON("accounts")||[]).find(a=>a.instanceURL===t)}function Ot(){window.__IGNORE_GET_ACCOUNT_ERROR__;const t=O.session.get("currentAccount");return ga(t)}function $t(){const t=Ot(),{instanceURL:n,info:{id:a}}=t;return`${a}@${n}`}function Do(t){const n=O.local.getJSON("accounts")||[],a=n.find(s=>s.info.id===t.info.id);a?(a.info=t.info,a.instanceURL=t.instanceURL,a.accessToken=t.accessToken,a.vapidKey=t.vapidKey):n.push(t),O.local.setJSON("accounts",n),O.session.set("currentAccount",t.info.id)}function wr(t){const n=O.local.getJSON("accounts")||[],a=n.find(s=>s.info.id===t.id);a&&(a.info.displayName!==t.displayName||a.info.avatar!==t.avatar||a.info.avatar_static!==t.avatar_static)&&(a.info={...a.info,...t},O.local.setJSON("accounts",n))}let Qt=null;function va(){if(Qt)return Qt;try{const t=Ot(),n=O.local.getJSON("instances"),a=t.instanceURL.toLowerCase();return Qt=n[a]}catch(t){return alert(`Failed to load instance configuration. Please try again.
${t}`),O.local.del("instances"),location.reload(),{}}}function Mo(t){const{configuration:n,maxMediaAttachments:a,maxTootChars:s,pleroma:o,pollLimits:r}=t,c=(n==null?void 0:n.statuses)||{};a&&(c.maxMediaAttachments??(c.maxMediaAttachments=a)),s&&(c.maxCharacters??(c.maxCharacters=s));const l=(n==null?void 0:n.polls)||{};return r&&(l.maxCharactersPerOption??(l.maxCharactersPerOption=r.maxOptionChars),l.maxExpiration??(l.maxExpiration=r.maxExpiration),l.maxOptions??(l.maxOptions=r.maxOptions),l.minExpiration??(l.minExpiration=r.minExpiration)),{...n,statuses:c,polls:l}}function Oo(){const t=va();return Mo(t)}const je={get:t=>{try{return localStorage.getItem(t)}catch{return null}},getJSON:t=>{try{return JSON.parse(je.get(t))}catch{return null}},set:(t,n)=>{try{return localStorage.setItem(t,n)}catch{return null}},setJSON:(t,n)=>{try{return je.set(t,JSON.stringify(n))}catch{return null}},del:t=>{try{return localStorage.removeItem(t)}catch{return null}}},hn={get:t=>{try{return sessionStorage.getItem(t)}catch{return null}},getJSON:t=>{try{return JSON.parse(hn.get(t))}catch{return null}},set:(t,n)=>{try{return sessionStorage.setItem(t,n)}catch{return null}},setJSON:(t,n)=>{try{return hn.set(t,JSON.stringify(n))}catch{return null}},del:t=>{try{return sessionStorage.removeItem(t)}catch{return null}}},zo={get:t=>{try{return je.getJSON(t)[$t()]}catch{return null}},set:(t,n)=>{try{const a=je.getJSON(t)||{};return a[$t()]=n,je.setJSON(t,a)}catch{return null}},del:t=>{try{const n=je.getJSON(t)||{};return delete n[$t()],je.setJSON(t,n)}catch{return null}}},O={local:je,session:hn,account:zo},Pt="mastodon.social",Rt={},Pe={};window.__ACCOUNT_APIS__=Pe;let ge;function Ne({instance:t,accessToken:n}){/^https?:\/\//.test(t)&&(t=t.replace(/^https?:\/\//,"").replace(/\/+$/,"").toLowerCase());const a=t?`https://${t}`:`https://${Pt}`,o={masto:Ya({url:a,accessToken:n,timeout:3e4}),instance:t,accessToken:n};return Rt[t]=o,Pe[t]||(Pe[t]={}),n&&(Pe[t][n]=o),o}async function xr(t,n){const{masto:a,accessToken:s}=t;let o;try{o=await a.v2.instance.fetch()}catch{}if(!o)try{o=await a.v1.instance.fetch()}catch{}if(!o)return;const{uri:r,urls:{streamingApi:c}={},domain:l,configuration:{urls:{streaming:m}={}}={}}=o,f=O.local.getJSON("instances")||{};if((r||l)&&(f[(l||r).replace(/^https?:\/\//,"").replace(/\/+$/,"").toLowerCase()]=o),n&&(f[n.toLowerCase()]=o),O.local.setJSON("instances",f),"WebSocket"in window&&(c||m)){const p=Ja({streamingApiUrl:m||c,accessToken:s,implementation:WebSocket});t.streaming=p}}async function Er(t,n,a,s){const{masto:o}=t,r=await o.v1.accounts.verifyCredentials();O.session.set("currentAccount",r.id),Do({info:r,instanceURL:n.toLowerCase(),accessToken:a,vapidKey:s})}async function Tr(t){try{const{masto:n}=t,a=await n.v1.preferences.fetch();O.account.set("preferences",a)}catch{}}function Ke({instance:t,accessToken:n,accountID:a,account:s}={}){var m,f,d,p,h;if(t&&(t=t.toLowerCase().trim()),t&&n){const g=((m=Pe[t])==null?void 0:m[n])||Ne({instance:t,accessToken:n}),{masto:_,streaming:b}=g;return{masto:_,streaming:b,client:g,authenticated:!0,instance:t}}if(n)for(const g in Pe)if(Pe[g][n]){const _=Pe[g][n],{masto:b,streaming:y}=_;return{masto:b,streaming:y,client:_,authenticated:!0,instance:g}}else{const _=Io(n);if(_){const b=_.accessToken,y=_.instanceURL.toLowerCase().trim(),v=Ne({instance:y,accessToken:b}),{masto:x,streaming:L}=v;return{masto:x,streaming:L,client:v,authenticated:!0,instance:y}}else throw new Error("Access token not found")}if(s||a)if(s=s||ga(a),s){const g=s.accessToken,_=s.instanceURL.toLowerCase().trim(),b=((f=Pe[_])==null?void 0:f[g])||Ne({instance:_,accessToken:g}),{masto:y,streaming:v}=b;return{masto:y,streaming:v,client:b,authenticated:!0,instance:_}}else throw new Error(`Account ${a} not found`);const o=Ot();if(t){if((ge==null?void 0:ge.instance)===t)return{masto:ge.masto,streaming:ge.streaming,client:ge,authenticated:!0,instance:t};if((o==null?void 0:o.instanceURL)===t){const{accessToken:x}=o;return ge=((d=Pe[t])==null?void 0:d[x])||Ne({instance:t,accessToken:x}),{masto:ge.masto,streaming:ge.streaming,client:ge,aut
`)),p.innerHTML=`<code>${d.innerHTML.trim()}</code>`,d.replaceWith(p)}),l&&[...r.querySelectorAll("p")].filter(p=>/^```/g.test(p.innerText)).forEach(p=>{const h=[p];let g=!1,_=p;for(;_.nextElementSibling;){const b=_.nextElementSibling;if(b&&b.tagName==="P")if(/```$/g.test(b.innerText)){h.push(b),g=!0;break}else h.push(b);else break;_=b}if(g){const b=document.createElement("pre");h.forEach(v=>{v.querySelectorAll("br").forEach(x=>x.replaceWith(`
`))});const y=h.map(v=>v.innerHTML).join(`
`);b.innerHTML=`<code tabindex="0">${y}</code>`,p.replaceWith(b),h.forEach(v=>v.remove())}}),o.includes("`")&&(m=an(r),m.forEach(f=>{let d=f.nodeValue.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");/`[^`]+`/g.test(d)&&(d=d.replaceAll(/(`[^]+?`)/g,"<code>$1</code>")),tt.innerHTML=d,f.replaceWith(...tt.childNodes)})),/twitter\.com/i.test(o)&&(m=an(r,{rejectFilter:["A"]}),m.forEach(f=>{let d=f.nodeValue.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");/@[a-zA-Z0-9_]+@twitter\.com/g.test(d)&&(d=d.replaceAll(/(@([a-zA-Z0-9_]+)@twitter\.com)/g,'<a href="https://twitter.com/$2" rel="nofollow noopener noreferrer" target="_blank">$1</a>')),tt.innerHTML=d,f.replaceWith(...tt.childNodes)})),o.includes("#")){let f=null;const d=[...r.querySelectorAll("p")].filter((p,h)=>{let g=0;for(let _=0;_<p.childNodes.length;_++){const b=p.childNodes[_];if(b.nodeType===Node.TEXT_NODE){if(b.textContent.trim()!=="")return!1}else if(b.tagName!=="BR")if(b.tagName==="A"){const y=b.textContent.trim();if(!y||!y.startsWith("#"))return!1;g++}else return!1}if(g>3||g>1&&f&&h===f+1)return f=h,!0});d!=null&&d.length&&d.forEach(p=>{p.classList.add("hashtag-stuffing"),p.title=p.innerText})}return s&&queueMicrotask(()=>s(r)),o=r.innerHTML,o}const Aa=qe(ui),di=["STYLE","IMG","VIDEO","AUDIO","AREA","MAP","TRACK","EMBED","IFRAME","OBJECT","PICTURE","PORTAL","SOURCE","SVG","MATH","CANVAS","NOSCRIPT","SCRIPT","INPUT","OPTION","TEXTAREA","SLOT","TEMPLATE"],mi=Object.fromEntries(di.map(t=>[t,!0]));function an(t,n={}){var c;const a=[],s=Object.assign({},mi,(c=n.rejectFilter)==null?void 0:c.reduce((l,m)=>(l[m]=!0,l),{})),o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(l){return s[l.parentNode.nodeName]?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}},!1);let r;for(;r=o.nextNode();)a.push(r);return a}const on=document.createElement("div");function hi(t){return t?(on.innerHTML=t.replace(/<\/p>/g,`</p>
`).replace(/<\/li>/g,`</li>
`),on.querySelectorAll("br").forEach(n=>{n.replaceWith(`
`)}),on.innerText.replace(/[\r\n]{3,}/g,`
`).trim()):""}const vn=qe(hi);function pi(t){const{mentions:n=[],instance:a,previewMode:s,statusURL:o}=t||{};return r=>{var d,p;let{target:c}=r;if(c=c.closest("a"),!c||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.which===2)return;const l=(d=c.previousSibling)==null?void 0:d.textContent,m=l==null?void 0:l.endsWith("@"),f=c.innerText.startsWith("@");if(c.classList.contains("u-url")&&f||m&&!f){const h=(c.querySelector("span")||c).innerText.trim(),g=h.replace(/^@/,""),_=c.getAttribute("href"),b=n.find(y=>y.username===g||y.acct===g||y.url===_);if(b)r.preventDefault(),r.stopPropagation(),M.showAccount={account:b.acct,instance:a};else if(!/^http/i.test(h)){r.preventDefault(),r.stopPropagation();const y=c.getAttribute("href");M.showAccount={account:y,instance:a}}}else if(!s){const h=l==null?void 0:l.endsWith("#");if(c.classList.contains("hashtag")||h){r.preventDefault(),r.stopPropagation();const g=c.innerText.replace(/^#/,"").trim(),_=a?`#/${a}/t/${g}`:`#/t/${g}`;location.hash=_}else(p=M.unfurledLinks[c.href])!=null&&p.url&&o!==c.href&&(r.preventDefault(),r.stopPropagation(),M.prevLocation={pathname:location.hash.replace(/^#/,"")},location.hash=`#${M.unfurledLinks[c.href].url}`)}}}const{locale:fi}=new Intl.DateTimeFormat().resolvedOptions(),gi=t=>{const{dateYear:n,hideTime:a,formatOpts:s}=t||{},o=new Date().getFullYear();return Intl.DateTimeFormat(fi,{year:n===o?void 0:"numeric",month:"short",day:"numeric",hour:a?void 0:"numeric",minute:a?void 0:"numeric",...s})},vi=qe(gi);function Mt(t,n){return t instanceof Date||(t=new Date(t)),vi({dateYear:t.getFullYear(),...n}).format(t)}const{locale:bi}=Intl.NumberFormat().resolvedOptions(),He=Intl.NumberFormat(bi,{notation:"compact"}).format;function yi({skeleton:t,account:n,avatarSize:a="xl",useAvatarStatic:s=!1,instance:o,external:r,internal:c,onClick:l,showActivity:m=!1,showStats:f=!1,accountInstance:d,hideDisplayName:p=!1,relationship:h={},excludeRelationshipAttrs:g=[]}){if(t)return e("div",{class:"account-block skeleton",children:[e(Qe,{size:a}),e("span",{children:[e("b",{children:"████████"}),e("br",{}),e("span",{class:"account-block-acct",children:"@██████"})]})]});if(!n)return null;const{id:_,acct:b,avatar:y,avatarStatic:v,displayName:x,username:L,emojis:S,url:w,statusesCount:P,lastStatusAt:C,bot:N,fields:Y,note:B,group:R,followersCount:V}=n;let[U,be,le]=b.match(/([^@]+)(@.+)/i)||[,b];d&&(le=`@${d}`);const ve=Y==null?void 0:Y.find(j=>!!j.verifiedAt&&!!j.value),A={};for(const j in h)g.includes(j)||(A[j]=h[j]);const oe=A.following||A.followedBy||A.requested;return e("a",{class:"account-block",href:w,target:r?"_blank":null,title:`@${b}`,onClick:j=>{if(!r){if(j.preventDefault(),l)return l(j);c?location.hash=`/${o}/a/${_}`:M.showAccount={account:n,instance:o}}},children:[e(Qe,{url:s?v:y||v,size:a,squircle:N}),e("span",{class:"account-block-content",children:[!p&&e(W,{children:x?e("b",{children:e(vt,{text:x,emojis:S})}):e("b",{children:L})})," ",e("span",{class:"account-block-acct",children:["@",be,e("wbr",{}),le]}),m&&e(W,{children:[e("br",{}),e("small",{class:"last-status-at insignificant",children:["Posts: ",P,!!C&&e(W,{children:[" ","· Last posted:"," ",Mt(C,{hideTime:!0})]})]})]}),f&&e("div",{class:"account-block-stats",children:[N&&e(W,{children:e("span",{class:"tag collapsed",children:[e(T,{icon:"bot"})," Automated"]})}),!!R&&e(W,{children:e("span",{class:"tag collapsed",children:[e(T,{icon:"group"})," Group"]})}),oe&&e("div",{class:"shazam-container-horizontal",children:e("div",{class:"shazam-container-inner",children:A.following&&A.followedBy?e("span",{class:"tag minimal",children:"Mutual"}):A.requested?e("span",{class:"tag minimal",children:"Requested"}):A.following?e("span",{class:"tag minimal",children:"Following"}):A.followedBy?e("span",{class:"tag minimal",children:"Follows you"}):null})},h.id),!!V&&e("span",{class:"ib",children:[He(V)," ",V===1?"follower":"followers"]}),!!ve&&e("span",{class:"verified-field",children:[e(T,{icon:"check-circle",size:"s"})," ",e("span",{dangerouslySetInnerHTML:{__html:Aa(ve.value,{emojis:S})}})]})]})]})]})}cons
<video
src="${b}"
poster="${g}"
width="${S}"
height="${w}"
data-orientation="${N}"
preload="auto"
autoplay
muted="${ie}"
${ie?"":"controls"}
playsinline
loop="${ee}"
${ie?'ondblclick="this.paused ? this.play() : this.pause()"':""}
${ie&&ke?"ontimeupdate=\"this.closest('.media-gif') && this.closest('.media-gif').style.setProperty('--progress', `${~~((this.currentTime / this.duration) * 100)}%`)\"":""}
></video>
`;return e(ce,{children:e(A,{class:`media ${t} media-${ie?"gif":"video"} ${Ee?"media-contain":""} ${he?"media-hover-animate":""}`,"data-orientation":N,"data-formatted-duration":o?void 0:Ce,"data-label":ie&&!o&&!Ee?"GIF":"","data-has-alt":!te,style:!o&&xe,onClick:ne=>{if(he)try{B.current.pause()}catch{}m(ne)},onMouseEnter:()=>{if(he)try{B.current.play()}catch{}},onMouseLeave:()=>{if(he)try{B.current.pause()}catch{}},onFocus:()=>{if(he)try{B.current.play()}catch{}},onBlur:()=>{if(he)try{B.current.pause()}catch{}},children:[o||Ee?ie&&o?e(zn,{...ve,enabled:!0,children:e("div",{ref:V,dangerouslySetInnerHTML:{__html:Fe}})}):e("div",{class:"video-container",dangerouslySetInnerHTML:{__html:Fe}}):ie?e("video",{ref:B,src:b,poster:g,width:S,height:w,"data-orientation":N,preload:"auto",playsinline:!0,loop:!0,muted:!0,onTimeUpdate:ke?ne=>{const{target:we}=ne,ot=we==null?void 0:we.closest(".media-gif");if(ot){const Re=we.currentTime/we.duration*100;ot.style.setProperty("--progress",`${Re}%`)}}:void 0}):e(W,{children:[e("img",{src:g,alt:te?"":d,width:S,height:w,"data-orientation":N,loading:"lazy"}),e("div",{class:"media-play",children:e(T,{icon:"play",size:"xl"})})]}),!o&&!te&&e(un,{alt:d,lang:s,index:l})]})})}else if(y==="audio"){const G=ea(v.duration);return e(ce,{children:e(A,{class:`media media-audio ${t}`,"data-formatted-duration":o?void 0:G,"data-has-alt":!te,onClick:m,style:!o&&xe,children:[o?e("audio",{src:_||b,preload:"none",controls:!0,autoplay:!0}):g?e("img",{src:g,alt:te?"":d,width:S,height:w,"data-orientation":N,loading:"lazy"}):null,!o&&e(W,{children:[e("div",{class:"media-play",children:e(T,{icon:"play",size:"xl"})}),!te&&e(un,{alt:d,lang:s,index:l})]})]})})}}function Xn(t){return e(To,{children:({ref:n,closeMenu:a})=>e(at,{...t,ref:n,onClick:({detail:s})=>a(s===0?"Enter":void 0)})})}const Bi=280,Vi=140;function ji(t,n){return n.v1.accounts.$select(t).fetch()}const Ui=zt(ji),pt={public:"Public",unlisted:"Unlisted",private:"Followers only",direct:"Private mention"},Hi=window.ontouchstart!==void 0&&/iPad|iPhone|iPod/.test(navigator.userAgent),Qn=80;function Ki(t){var n;return(n=t==null?void 0:t.options)!=null&&n.length?`📊:
${t.options.map(a=>`- ${a.title}${a.votesCount>=0?` (${a.votesCount})`:""}`).join(`
`)}`:""}function dn(t){const{spoilerText:n,content:a,poll:s}=t;return(n?`${n}
`:"")+vn(a)+Ki(s)}function Xe({statusID:t,status:n,instance:a,size:s="m",contentTextWeight:o,readOnly:r,enableCommentHint:c,withinContext:l,skeleton:m,enableTranslate:f,forceTranslate:d,previewMode:p,onMediaClick:h,quoted:g,onStatusLinkClick:_=()=>{},showFollowedTags:b}){var In,Rn,Dn;if(m)return e("div",{class:"status skeleton",children:[e(Qe,{size:"xxl"}),e("div",{class:"container",children:[e("div",{class:"meta",children:"███ ████████"}),e("div",{class:"content-container",children:e("div",{class:"content",children:e("p",{children:"████ ████████"})})})]})]});const{masto:y,instance:v,authenticated:x}=Ke({instance:a}),{instance:L}=Ke(),S=v===L;let w=Me(t||(n==null?void 0:n.id),v);const P=yt(M);if(n||(n=P.statuses[w]||P.statuses[t],w=Me(n==null?void 0:n.id,v)),!n)return null;const{account:{acct:C,avatar:N,avatarStatic:Y,id:B,url:R,displayName:V,username:U,emojis:be,bot:le,group:ve},id:A,repliesCount:oe,reblogged:j,reblogsCount:K,favourited:de,favouritesCount:me,bookmarked:ye,poll:se,muted:Ie,sensitive:xe,spoilerText:_e,visibility:te,language:ce,editedAt:G,filtered:ie,card:ee,createdAt:Ce,inReplyToId:he,inReplyToAccountId:Ee,content:ke,mentions:Fe,mediaAttachments:ne,reblog:we,uri:ot,url:Re,emojis:et,tags:E,_deleted:F,_pinned:D}=n,$=$e(()=>O.session.get("currentAccount"),[]),J=$e(()=>$&&$===B,[B,$]),q=Lo(Pi),z=!J&&!r&&!p&&$a(ie,q);if((z==null?void 0:z.action)==="hide")return null;const H=u=>{u.shiftKey};if(s!=="l"&&z)return e(Ji,{status:n,filterInfo:z,instance:v,containerProps:{onMouseEnter:H},showFollowedTags:!0});const re=new Date(Ce),Le=new Date(G);let Oe=Fe==null?void 0:Fe.find(u=>u.id===Ee);!Oe&&Ee===A&&(Oe={url:R,username:U,displayName:V});const[Se,We]=Z(Oe);if(!l&&!Se&&Ee){const u=M.accounts[Ee];u?We(u):Ui(Ee,y).then(I=>{We(I),M.accounts[I.id]=I}).catch(I=>{})}const _t=Ee===$||(Fe==null?void 0:Fe.find(u=>u.id===$)),Ge=$e(()=>!!(O.account.get("preferences")||{})["reading:expand:spoilers"],[]),kt=$e(()=>(O.account.get("preferences")||{})["reading:expand:media"]||"default",[]),ze=p||Ge||!!P.spoilers[A],it=p||kt==="show_all"||!!P.spoilersMedia[A];if(we)return ve?e("div",{"data-state-post-id":w,class:"status-group",onMouseEnter:H,children:[e("div",{class:"status-pre-meta",children:[e(T,{icon:"group",size:"l",alt:"Group"})," ",e(mt,{account:n.account,instance:v,showAvatar:!0})]}),e(Xe,{status:t?null:we,statusID:t?we.id:null,instance:v,size:s,contentTextWeight:o,readOnly:r})]}):e("div",{"data-state-post-id":w,class:"status-reblog",onMouseEnter:H,children:[e("div",{class:"status-pre-meta",children:[e(T,{icon:"rocket",size:"l"})," ",e(mt,{account:n.account,instance:v,showAvatar:!0})," ",e("span",{children:"boosted"})]}),e(Xe,{status:t?null:we,statusID:t?we.id:null,instance:v,size:s,contentTextWeight:o,readOnly:r,enableCommentHint:!0})]});if(b&&((In=P.statusFollowedTags[w])!=null&&In.length))return e("div",{"data-state-post-id":w,class:"status-followed-tags",onMouseEnter:H,children:[e("div",{class:"status-pre-meta",children:[e(T,{icon:"hashtag",size:"l"})," ",P.statusFollowedTags[w].slice(0,3).map(u=>e(at,{to:v?`/${v}/t/${u}`:`/t/${u}`,class:"status-followed-tag-item",children:u},u))]}),e(Xe,{status:t?null:n,statusID:t?n.id:null,instance:v,size:s,contentTextWeight:o,readOnly:r,enableCommentHint:!0})]});const ue=s==="l",[Vt,Da]=Z(d),yn=La(!0),Ma=P.settings.contentTranslationHideLanguages||[],{contentTranslation:jt,contentTranslationAutoInline:_n}=P.settings;jt||(f=!1);const kn=$e(()=>{if(!jt||!_n||r||l&&!ue||p||_e||xe||se||ee||ne!=null&&ne.length)return!1;const u=ln(ke);return u>0&&u<=Vi},[jt,_n,r,l,ue,p,_e,xe,se,ee,ne,ke]),[Ut,wt]=Z(!1),Oa=It(),za=It(),Na=It(),wn="Read more →",Ht=Q(null),rt="Sorry, your current logged-in instance can't interact with this post from another instance.",xn=pa(()=>Math.max(Math.round((_e.length+ln(ke))/140)||1,1),[_e,ke]),En=Mt(re),Tn=G&&Mt(Le);let st=x&&te!=="direct"&&te!=="private";te==="private"&&J&&(st=!0);const Kt=u=>{var I;if(!S||!x)return alert(rt);(u!=null&&u.shiftKey||(I=u==null?void 0:u.syntheticEvent)!=null&&I.shiftKey)&&ka({replyToStatus:
Some media have no descriptions.`),!confirm(u))return!1}if(M.statuses[w]={...n,reblogged:!j,reblogsCount:K+(j?-1:1)},j){const u=await y.v1.statuses.$select(A).unreblog();return De(u,v),!0}else{const u=await y.v1.statuses.$select(A).reblog();return De(u,v),!0}}catch{return M.statuses[w]=n,!1}},Wt=async()=>{if(!S||!x)return alert(rt),!1;try{if(M.statuses[w]={...n,reblogged:!j,reblogsCount:K+(j?-1:1)},j){const u=await y.v1.statuses.$select(A).unreblog();return De(u,v),!0}else{const u=await y.v1.statuses.$select(A).reblog();return De(u,v),!0}}catch{return M.statuses[w]=n,!1}},Gt=async()=>{if(!S||!x)return alert(rt);try{if(M.statuses[w]={...n,favourited:!de,favouritesCount:me+(de?-1:1)},de){const u=await y.v1.statuses.$select(A).unfavourite();De(u,v)}else{const u=await y.v1.statuses.$select(A).favourite();De(u,v)}}catch{M.statuses[w]=n}},Yt=async()=>{if(!S||!x)return alert(rt);try{if(M.statuses[w]={...n,bookmarked:!ye},ye){const u=await y.v1.statuses.$select(A).unbookmark();De(u,v)}else{const u=await y.v1.statuses.$select(A).bookmark();De(u,v)}}catch{M.statuses[w]=n}},Ln=!!ce&&ce!==yn&&!Dt([ce],[yn])&&!Ma.find(u=>ce===u||Dt([ce],[u])),An=Q(),Cn=Q();async function Ba(u){var pe,Ye,Mn,On;u&&(An.current=y.v1.statuses.$select(t).rebloggedBy.list({limit:Qn}),Cn.current=y.v1.statuses.$select(t).favouritedBy.list({limit:Qn}));const[{value:I},{value:X}]=await Promise.allSettled([An.current.next(),Cn.current.next()]);if((pe=I.value)!=null&&pe.length||(Ye=X.value)!=null&&Ye.length){const Zt=[];return(Mn=I.value)!=null&&Mn.length&&Zt.push(...I.value.map(lt=>(lt._types=["reblog"],lt))),(On=X.value)!=null&&On.length&&Zt.push(...X.value.map(lt=>(lt._types=["favourite"],lt))),{value:Zt,done:I.done&&X.done}}return{value:[],done:!0}}const _r=Q(),Fn=e(W,{children:[!ue&&e(W,{children:[e(Ao,{children:[e("span",{class:"ib",children:[e(T,{icon:nt[te],size:"s"})," ",e("span",{children:pt[te]})]})," ",e("span",{class:"ib",children:[oe>0&&e("span",{children:[e(T,{icon:"comment2",alt:"Replies",size:"s"})," ",e("span",{children:He(oe)})]})," ",K>0&&e("span",{children:[e(T,{icon:"rocket",alt:"Boosts",size:"s"})," ",e("span",{children:He(K)})]})," ",me>0&&e("span",{children:[e(T,{icon:"heart",alt:"Likes",size:"s"})," ",e("span",{children:He(me)})]})]}),e("br",{}),En]}),e(Xn,{to:v?`/${v}/s/${A}`:`/s/${A}`,onClick:u=>{_(u,n)},children:[e(T,{icon:"arrow-right"}),e("span",{children:["View post by @",U||C]})]})]}),!!G&&e(Te,{onClick:()=>{wt(A)},children:[e(T,{icon:"history"}),e("span",{children:["Show Edit History",e("br",{}),e("small",{class:"more-insignificant",children:["Edited: ",Tn]})]})]}),(!ue||!!G)&&e(Xt,{}),ue&&e(Te,{onClick:()=>{M.showGenericAccounts={heading:"Boosted/Liked by…",fetchAccounts:Ba,instance:v,showReactions:!0}},children:[e(T,{icon:"react"}),e("span",{children:["Boosted/Liked by",e("span",{class:"more-insignificant",children:"…"})]})]}),!ue&&S&&e(W,{children:[e("div",{class:"menu-horizontal",children:[e(tn,{subMenu:!0,confirmLabel:e(W,{children:[e(T,{icon:"rocket"}),e("span",{children:j?"Unboost?":"Boost to everyone?"})]}),menuFooter:qt&&!j&&e("div",{class:"footer",children:[e(T,{icon:"alert"}),"Some media have no descriptions."]}),disabled:!st,onClick:async()=>{try{const u=await Wt();!ue&&u&&Ae(j?`Unboosted @${U||C}'s post`:`Boosted @${U||C}'s post`)}catch{}},children:[e(T,{icon:"rocket",style:{color:j&&"var(--reblog-color)"}}),e("span",{children:j?"Unboost":"Boost…"})]}),e(Te,{onClick:()=>{try{Gt(),ue||Ae(de?`Unliked @${U||C}'s post`:`Liked @${U||C}'s post`)}catch{}},children:[e(T,{icon:"heart",style:{color:de&&"var(--favourite-color)"}}),e("span",{children:de?"Unlike":"Like"})]})]}),e("div",{class:"menu-horizontal",children:[e(Te,{onClick:Kt,children:[e(T,{icon:"reply"}),e("span",{children:"Reply"})]}),e(Te,{onClick:()=>{try{Yt(),ue||Ae(ye?`Unbookmarked @${U||C}'s post`:`Bookmarked @${U||C}'s post`)}catch{}},children:[e(T,{icon:"bookmark",style:{color:ye&&"var(--link-color)"}}),e("span",{children:ye?"Unbookmark":"Bookmark"})]})]})]}),f?e("div",{class:ht?"menu-horizontal":"",children:[e(Te,{disabled:Vt,onClick:()=>{Da(!0)
<li role="option" data-value="${Be(B)}">
<img src="${Be(R)}" width="16" height="16" alt="" loading="lazy" />
:${Be(B)}:
</li>`}),Ue.innerHTML=N,S(Promise.resolve({matched:C.length>0,fragment:Ue}));return}const P={"@":"accounts","#":"hashtags"}[L];S(new Promise(C=>{c({type:P,q:w,limit:5}).then(Y=>{if(w!==d.current)return;const B=Y[P]||Y;let R="";B.forEach(V=>{var de;const{name:U,avatarStatic:be,displayName:le,username:ve,acct:A,emojis:oe,history:j}=V,K=gn(le,oe);if(A)R+=`
<li role="option" data-value="${Be(A)}">
<span class="avatar">
<img src="${Be(be)}" width="16" height="16" alt="" loading="lazy" />
</span>
<span>
<b>${K||ve}</b>
<br>@${Be(A)}
</span>
</li>
`;else{const me=(de=j==null?void 0:j.reduce)==null?void 0:de.call(j,(ye,se)=>ye+ +se.uses,0);R+=`
<li role="option" data-value="${Be(U)}">
<span class="grow">#<b>${Be(U)}</b></span>
${me?`<span class="count">${He(me)}</span>`:""}
</li>
`}Ue.innerHTML=R}),C({matched:B.length>0,fragment:Ue})})}))},f.current.addEventListener("text-expander-change",b),y=x=>{const{key:L,item:S}=x.detail;L===":"?x.detail.value=`:${S.dataset.value}:`:x.detail.value=`${L}${S.dataset.value}`},f.current.addEventListener("text-expander-value",y),v=x=>{const{input:L}=x.detail;if(o(L.value),n.current){const S=new Event("input",{bubbles:!0});n.current.dispatchEvent(S)}},f.current.addEventListener("text-expander-committed",v)),()=>{f.current&&(f.current.removeEventListener("text-expander-change",b),f.current.removeEventListener("text-expander-value",y),f.current.removeEventListener("text-expander-committed",v))}},[]),fe(()=>{const b=n.current;if(!b)return;new ResizeObserver(()=>{if(f.current){const{height:v}=b.getBoundingClientRect();f.current.style.height=v+"px"}}).observe(b)},[]);const p=Q(0),h=Q(),g=ma(b=>{var x;if(!h.current)return;if(p.current>3){h.current.innerHTML="",h.current=null,(x=g==null?void 0:g.cancel)==null||x.call(g);return}let y,v;p.current<=3&&(y=Date.now()),h.current.innerHTML=dr(b,{maxCharacters:r})+`
`,p.current<=3&&(v=Date.now()),y&&v&&v-y>50&&p.current++},500);return e("text-expander",{ref:f,keys:"@ # :",class:"compose-field-container",children:[e("textarea",{class:"compose-field",autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",rows:"6",cols:"50",...l,ref:n,name:"status",value:s,onKeyDown:b=>{const{key:y,target:v}=b;if(y==="Enter")try{const{value:x,selectionStart:L}=v,w=x.slice(0,L).split(`
`).slice(-1)[0];if(w&&/^\s*(-|\d+\.)\s/.test(w)){const[P,C,N,Y,B]=w.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(B){b.preventDefault();const[R]=N.match(/\d+/)||[],V=R?`${+R+1}.`:"-",U=`
${C}${V}${Y}`;v.setRangeText(U,L,L);const be=L+U.length;v.setSelectionRange(be,be)}else{const R=L-w.length;v.setRangeText("",R,L)}ia(v),v.dispatchEvent(new Event("input"))}}catch{}h.current&&(h.current.scrollTop=v.scrollTop)},onInput:b=>{var x;const{target:y}=b,v=y.value;o(v),ia(y),(x=t.onInput)==null||x.call(t,b),g(v)},style:{width:"100%",height:"4em"},onScroll:b=>{if(h.current){const{scrollTop:y}=b.target;h.current.scrollTop=y}}}),e("div",{ref:h,class:"compose-highlight","aria-hidden":"true"})]})});function hr({maxCharacters:t=500,hidden:n}){const s=yt(M).composerCharacterCount,o=t-s;return n?e("meter",{class:"donut",hidden:!0}):e("meter",{class:`donut ${o<=-10?"explode":o<=0?"danger":o<=20?"warning":""}`,value:s,max:t,"data-left":o,title:`${o}/${t}`,style:{"--percentage":s/t*100}})}function pr({attachment:t,disabled:n,lang:a,onDescriptionChange:s=()=>{},onRemove:o=()=>{}}){const[r,c]=Z("default"),l=Ca("@mastodon/edit-media-attributes"),{type:m,id:f,file:d}=t,p=$e(()=>d?URL.createObjectURL(d):t.url,[d,t.url]),[h,g]=Z(t.description),[_,b]=m.split("/"),y=Po(s,250),[v,x]=Z(!1),L=Q(null);fe(()=>{let P;return v&&L.current&&(P=setTimeout(()=>{L.current.focus()},100)),()=>{clearTimeout(P)}},[v]);const S=e(W,{children:f&&!l?e("div",{class:"media-desc",children:[e("span",{class:"tag",children:"Uploaded"}),e("p",{title:h,children:t.description||e("i",{children:"No description"})})]}):e("textarea",{ref:L,value:h||"",lang:a,placeholder:{image:"Image description",video:"Video description",audio:"Audio description"}[_],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:n||r==="loading",class:r==="loading"?"loading":"",maxlength:"1500",onInput:P=>{const{value:C}=P.target;g(C),y(C)}})}),w=Q(null);return fe(()=>()=>{var P,C;(C=(P=w.current)==null?void 0:P.hideToast)==null||C.call(P)},[]),e(W,{children:[e("div",{class:"media-attachment",children:[e("div",{class:"media-preview",tabIndex:"0",onClick:()=>{x(!0)},children:_==="image"?e("img",{src:p,alt:""}):_==="video"||_==="gifv"?e("video",{src:p,playsinline:!0,muted:!0}):_==="audio"?e("audio",{src:p,controls:!0}):null}),S,e("div",{class:"media-aside",children:e("button",{type:"button",class:"plain close-button",disabled:n,onClick:o,children:e(T,{icon:"x"})})})]}),v&&e(Nt,{class:"light",onClick:P=>{P.target===P.currentTarget&&x(!1)},children:e("div",{id:"media-sheet",class:"sheet sheet-max",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>{x(!1)},children:e(T,{icon:"x"})}),e("header",{children:e("h2",{children:{image:"Edit image description",video:"Edit video description",audio:"Edit audio description"}[_]})}),e("main",{tabIndex:"-1",children:[e("div",{class:"media-preview",children:_==="image"?e("img",{src:p,alt:""}):_==="video"||_==="gifv"?e("video",{src:p,playsinline:!0,controls:!0}):_==="audio"?e("audio",{src:p,controls:!0}):null}),e("div",{class:"media-form",children:[S,e("footer",{children:[_==="image"&&/^(png|jpe?g|gif|webp)$/i.test(b)&&!!M.settings.mediaAltGenerator&&!!na&&e(fn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",title:"More",class:"plain",children:e(T,{icon:"more",size:"l",alt:"More"})}),children:e(Te,{disabled:r==="loading",onClick:()=>{c("loading"),w.current=Ae({text:"Generating description. Please wait...",duration:-1}),async function(){var P,C;try{const N=new FormData;N.append("image",d);const Y=await fetch(na,{method:"POST",body:N}).then(B=>B.json());g(Y.description)}catch{Ae("Failed to generate description")}finally{c("default"),(C=(P=w.current)==null?void 0:P.hideToast)==null||C.call(P)}}()},children:[e(T,{icon:"sparkles2"}),e("span",{children:"Generate description…"})]})}),e("button",{type:"button",class:"light block",onClick:()=>{x(!1)},disabled:r==="loading",children:"Done"})]})]})]})]})})]})}function fr({lang:t,poll:n,disabled:a,onInput:s=()=>{},maxOptions:o,maxExpiration:r,minExpiration:c,maxCharactersPerOption:l}){const{options:m,expiresIn:f,multiple:d}=n;return e("div",{class:`poll
//# sourceMappingURL=useTitle-zvzl1Hla.js.map
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}