PageSourceSearch

https://odysseia-forum-webpage.pages.dev/assets/AuthorIdentityLink-BHeJ9PkB.js

js odysseia-forum-webpage.pages.dev collected 2026-10-03 05:29:54 UTC 14,614 bytes, 1 lines download raw bytes

1import{a as e}from"./rolldown-runtime-BYbx6iT9.js";import{c as t,l as n}from"./vendor-motion-DW0UKKg8.js";import{c as r}from"./vendor-react-BhDKfpxm.js";import{a as i,d as a}from"./vendor-query-DQ4Shq_9.js";import{u as o}from"./mascotToast-DQ_Qahoa.js";import{t as s}from"./createLucideIcon-Cs2jVN1f.js";import{c,i as l,l as u,o as d,r as f,s as p,t as m,u as h}from"./useAuthorFollow-Ds3kf6DW.js";import{t as g}from"./file-text-D9p6vXDs.js";import{t as _}from"./message-circle-BNgOvewU.js";import{t as v}from"./LazyImage-DNBjZfQU.js";import{t as y}from"./useUserPreferences-C7hSGuvA.js";import{n as b}from"./channelCategories.private-uIaArjzg.js";import{n as x}from"./dateTime-C05wluRq.js";import{n as S,r as C,t as w}from"./queryKeys--tvk9yDF.js";var T=s(`user-round-x`,[[`path`,{d:`M2 21a8 8 0 0 1 11.873-7`,key:`74fkxq`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`m17 17 5 5`,key:`p7ous7`}],[`path`,{d:`m22 17-5 5`,key:`gqnmv0`}]]),E=e(n(),1),D=e(a(),1),O=300*1e3;function k(e,t={}){return i({queryKey:w.profile(e??``),queryFn:({signal:t})=>S.getAuthorProfile(e,t),enabled:!!e&&(t.enabled??!0),staleTime:O})}function A(e,t){return i({queryKey:w.threads(e??``,{sortMethod:t.sortMethod,channelIds:t.channelIds,page:t.page}),enabled:!!e,queryFn:({signal:n})=>C.search({include_authors:e?[e]:[],author_name:e||void 0,sort_method:t.sortMethod,channel_ids:t.channelIds.length>0?t.channelIds:void 0,limit:48,offset:(t.page-1)*48},n),staleTime:60*1e3})}function j(e,t={}){return i({queryKey:w.recentWorks(e,t.excludeThreadId),queryFn:({signal:n})=>C.search({include_authors:[e],exclude_thread_ids:t.excludeThreadId?[t.excludeThreadId]:void 0,apply_preferences:!0,limit:3,sort_method:`created_desc`},n),enabled:t.enabled??!0,staleTime:O})}var M=t(),N=300,P=180,F=320,I=8,L=10;function R({author:e,currentThreadId:t,initialFollowed:n,panelRef:i,panelStyle:a,close:s,keepOpen:S,closeSoon:C}){let w=r(),O=l(e=>e.setPreviewThreadId),[A,N]=(0,E.useState)(!1),P=(0,E.useRef)(null),{user:F,preferences:I,savePreferences:L,isSaving:R}=y({guildId:b}),{data:z,isLoading:B,isError:V,refetch:H}=j(e.id,{excludeThreadId:t,enabled:!0}),{data:U}=k(e.id,{enabled:!0}),W=m(e.id,{enabled:!!F?.id,initialFollowed:n}),G=W.data,K=f(e.id,G??!1),q=e.display_name||e.global_name||e.name,J=(I?.exclude_authors||[]).map(String),Y=J.includes(String(e.id)),X=z?.results||[];(0,E.useEffect)(()=>{if(!A)return;let e=P.current;!e||e.open||(typeof e.showModal==`function`?e.showModal():e.setAttribute(`open`,``))},[A]);let Z=e=>{s(),O(e)},Q=()=>{s(),w(`/u/${e.id}`)},$=async()=>{if(!F?.id||R)return;let t=String(e.id),n=Y?J.filter(e=>e!==t):Array.from(new Set([...J,t])),r=(I?.include_authors||[]).map(String);try{await L({preferred_channels:I?.preferred_channels||[],exclude_authors:n,include_authors:Y?r:r.filter(e=>e!==t)}),o.success(Y?`已取消屏蔽 ${q}`:`已将 ${q} 加入屏蔽`)}catch{o.error(`偏好保存失败,请稍后再试`)}};return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{ref:i,popover:`manual`,role:`dialog`,"aria-label":`${q} 的其他作品`,style:a,onClick:e=>e.stopPropagation(),onPointerEnter:S,onPointerLeave:A?S:C,onFocus:S,onBlur:A?S:C,className:`od-floating-glass fixed inset-auto z-[9999] m-0 overflow-hidden rounded-2xl border border-(--od-border-strong) p-0 shadow-(--od-shadow-floating) animate-in fade-in zoom-in-95 duration-150`,children:[(0,M.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-(--od-shell-line) px-2 py-2`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:Q,className:`group/author-header flex min-w-0 flex-1 items-center gap-3 px-2 py-1 text-left`,children:[(0,M.jsx)(d,{author:e,className:`h-9 w-9 ring-1 ring-(--od-border-strong)/35 transition-[box-shadow] group-hover/author-header:ring-(--od-accent)`}),(0,M.jsxs)(`span`,{className:`min-w-0`,children:[(0,M.jsx)(`span`,{className:`block truncate text-sm font-semibold text-(--od-text-primary) transition-colors group-hover/author-header:text-(--od-accent)`,children:q}),(0,M.jsxs)(`span`,{className:`block truncate text-[11px] text-(--od-text-tertiary)`,children:[`@`,e.name]}),(0,M.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2.5 text-[10px] text-(--od-text-tertiary)`,children:[(0,M.jsxs)(`span`,{children:[(0,M.jsx)(`strong`,{className:`font-medium text-(--od-text-secondary)`,children:U?.stats.thread_count??`—`}),` `,`作品`]}),(0,M.jsxs)(`span`,{children:[(0,M.jsx)(`strong`,{className:`font-medium text-(--od-text-secondary)`,children:U?.stats.reaction_count??`—`}),` `,`点赞`]}),(0,M.jsxs)(`span`,{children:[(0,M.jsx)(`strong`,{className:`font-medium text-(--od-text-secondary)`,children:U?.stats.reply_count??`—`}),` `,`回复`]})]})]})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>
1{if(W.isError){W.refetch();return}K.mutate()},disabled:!F?.id||!W.isError&&G===void 0||W.isFetching||K.isPending,"aria-pressed":G??!1,"aria-label":W.isError?`重试关注状态`:G?`取消关注作者`:`关注作者`,title:F?.id?W.isError?`关注状态加载失败`:G?`取消关注作者`:`关注作者`:`登录后关注作者`,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-45 ${G?`bg-(--od-accent)/15 text-(--od-accent) hover:bg-(--od-accent)/25`:`text-(--od-text-tertiary) hover:bg-(--od-interactive-hover) hover:text-(--od-accent)`}`,children:W.isFetching||K.isPending?(0,M.jsx)(c,{className:`h-4 w-4 animate-spin`}):G?(0,M.jsx)(h,{className:`h-4 w-4`}):(0,M.jsx)(u,{className:`h-4 w-4`})}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>{Y?$():N(!0)},disabled:!F?.id||R,"aria-pressed":Y,"aria-label":Y?`取消屏蔽作者`:`屏蔽作者`,title:Y?`取消屏蔽作者`:`屏蔽作者`,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-45 ${Y?`bg-rose-500/15 text-rose-400 hover:bg-rose-500/25`:`text-(--od-text-tertiary) hover:bg-(--od-interactive-hover) hover:text-rose-400`}`,children:(0,M.jsx)(T,{className:`h-4 w-4`})})]}),(0,M.jsxs)(`div`,{className:`p-2`,children:[B&&Array.from({length:3}).map((e,t)=>(0,M.jsxs)(`div`,{className:`flex animate-pulse items-center gap-3 rounded-xl p-2`,children:[(0,M.jsx)(`div`,{className:`h-13 w-13 shrink-0 rounded-lg bg-(--od-bg-tertiary)`}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,M.jsx)(`div`,{className:`h-3 w-4/5 rounded bg-(--od-bg-tertiary)`}),(0,M.jsx)(`div`,{className:`h-2.5 w-2/5 rounded bg-(--od-bg-tertiary)`})]})]},t)),V&&(0,M.jsxs)(`div`,{className:`px-3 py-6 text-center`,children:[(0,M.jsx)(`p`,{className:`text-xs text-(--od-text-tertiary)`,children:`作品加载失败`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>void H(),className:`mt-2 text-xs font-medium text-(--od-accent) hover:text-(--od-accent-hover)`,children:`重试`})]}),!B&&!V&&X.length===0&&(0,M.jsx)(`p`,{className:`px-3 py-6 text-center text-xs leading-5 text-(--od-text-tertiary)`,children:`暂未收录该作者的其他作品,或已被偏好设置过滤。`}),!B&&!V&&X.map(e=>{let t=e.thumbnail_urls?.[0];return(0,M.jsxs)(`button`,{type:`button`,onClick:()=>Z(e.thread_id),className:`group flex w-full items-center gap-3 rounded-xl p-2 text-left focus-visible:outline-2 focus-visible:outline-(--od-accent)`,children:[(0,M.jsx)(`span`,{className:`flex h-13 w-13 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-(--od-bg-tertiary)`,children:t?(0,M.jsx)(v,{src:t,alt:``,className:`h-full w-full object-cover transition-transform duration-200 group-hover:scale-105`}):(0,M.jsx)(g,{className:`h-4 w-4 text-(--od-text-tertiary)`})}),(0,M.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`span`,{className:`line-clamp-2 text-xs font-medium leading-4 text-(--od-text-primary) transition-colors group-hover:text-(--od-accent)`,children:e.title}),(0,M.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-3 text-[10px] text-(--od-text-tertiary) transition-colors group-hover:text-(--od-text-secondary)`,children:[(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,M.jsx)(p,{className:`h-3 w-3`}),e.reaction_count]}),(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,M.jsx)(_,{className:`h-3 w-3`}),e.reply_count]}),(0,M.jsx)(`time`,{dateTime:e.created_at,className:`ml-auto whitespace-nowrap`,children:x(e.created_at)})]})]})]},e.thread_id)})]}),(0,M.jsx)(`button`,{type:`button`,onClick:Q,className:`w-full border-t border-(--od-shell-line) px-4 py-2.5 text-center text-xs font-medium text-(--od-accent) transition-colors hover:text-(--od-accent-hover)`,children:`查看全部作品`})]}),A&&(0,D.createPortal)((0,M.jsx)(`dialog`,{ref:P,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`author-block-confirm-title`,className:`fixed inset-0 m-0 flex h-full max-h-none w-full max-w-none items-center justify-center border-0 bg-black/65 p-4 text-(--od-text-primary) backdrop:bg-transparent backdrop-blur-xs`,onCancel:e=>{e.preventDefault(),N(!1)},onKeyDown:e=>{e.key===`Escape`&&e.stopPropagation()},onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.target===e.currentTarget&&N(!1)},children:(0,M.jsxs)(`div`,{className:`od-floating-panel-solid m-auto w-full max-w-sm rounded-2xl border border-(--od-border-strong) p-5 shadow-2xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`span`,{className:`inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-rose-500/15 text-rose-400`,children:(0,M.jsx)(T,{className:`h-5 w-5`})}),(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsx)(`h2`,{id:`author-block-confirm-title`,className:`text-base font-semibold text-(--od-text-primary)`,children:`屏蔽这位作者?`}),(0,M.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-(--od-text-tertiary)`,children:q})]})]}),(0,M.jsx)(`p`,{className:`mt-4 text-sm leading-6 text-(--od-text-secondary)`,children:`屏蔽会永久写入探索偏好。之后广场、搜索和随机发现会尽量排除该作者的作品,你仍可以在偏好设置中取消。`}),(0,M.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>N(!1),className:`rounded-lg px-4 py-2 text-sm font-medium text-(--od-text-secondary) transition-colors hover:bg-(--od-interactive-hover) hover:text-(--od-text-primary)`,children:`取消`}),(0,M.jsx)(`button`,{type:`button`,disabled:R,onClick:()=>{N(!1),$()},className:`rounded-lg bg-rose-500 px-4 py-2 text-sm font-semibold text-white transition-colors hover:bg-rose-600 disabled:pointer-events-none disabled:opacity-55`,children:`确认屏蔽`})]})]})}),document.body)]})}
1function z({author:e,currentThreadId:t,initialFollowed:n,children:r}){let i=(0,E.useRef)(null),a=(0,E.useRef)(null),o=(0,E.useRef)(null),s=(0,E.useRef)(null),[c,l]=(0,E.useState)(!1),[u,d]=(0,E.useState)({}),f=(0,E.useCallback)(()=>{o.current!==null&&(window.clearTimeout(o.current),o.current=null)},[]),p=(0,E.useCallback)(()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null)},[]),m=(0,E.useCallback)(()=>{f(),p(),l(!1)},[p,f]),h=(0,E.useCallback)(()=>{c||(p(),f(),o.current=window.setTimeout(()=>{l(!0),o.current=null},N))},[p,f,c]),g=(0,E.useCallback)(()=>{f(),p(),l(!0)},[p,f]),_=(0,E.useCallback)(()=>{window.requestAnimationFrame(()=>{i.current?.contains(document.activeElement)&&g()})},[g]),v=(0,E.useCallback)(()=>{p()},[p]),y=(0,E.useCallback)(()=>{f(),p(),s.current=window.setTimeout(()=>{let e=document.activeElement;if(e&&i.current?.contains(e)||e&&a.current?.contains(e)){s.current=null;return}l(!1),s.current=null},P)},[p,f]),b=(0,E.useCallback)(()=>{let e=i.current;if(!e)return;let t=e.getBoundingClientRect();if(t.bottom<0||t.top>window.innerHeight){m();return}let n=Math.min(F,window.innerWidth-I*2),r=a.current?.offsetHeight||280,o=t.right+L,s=t.top;o+n>window.innerWidth-I&&(o=t.left-n-L),s+r>window.innerHeight-I&&(s=t.bottom-r);let c=Math.max(I,Math.min(o,window.innerWidth-n-I)),l=Math.max(I,Math.min(s,window.innerHeight-r-I));d({left:c,top:l,width:n});let u=a.current;u&&(u.style.left=`${c}px`,u.style.top=`${l}px`,u.style.width=`${n}px`)},[m]);return(0,E.useEffect)(()=>()=>{f(),p()},[p,f]),(0,E.useEffect)(()=>{if(!c)return;b();let e=a.current;try{e&&!e.matches(`:popover-open`)&&e.showPopover()}catch{}window.addEventListener(`scroll`,b,!0),window.addEventListener(`resize`,b);let t=e=>{e.key===`Escape`&&(m(),i.current?.querySelector(`button, a, [tabindex]`)?.focus())},n=e=>{let t=e.target;i.current?.contains(t)||a.current?.contains(t)||m()};return document.addEventListener(`keydown`,t),document.addEventListener(`pointerdown`,n),()=>{try{e?.matches(`:popover-open`)&&e.hidePopover()}catch{}window.removeEventListener(`scroll`,b,!0),window.removeEventListener(`resize`,b),document.removeEventListener(`keydown`,t),document.removeEventListener(`pointerdown`,n)}},[m,c,b]),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{ref:i,className:`inline-flex min-w-0 max-w-full`,onPointerEnter:e=>{e.pointerType===`mouse`&&h()},onPointerLeave:y,onFocus:_,onBlur:y,children:r}),c&&(0,D.createPortal)((0,M.jsx)(R,{author:e,currentThreadId:t,initialFollowed:n,panelRef:a,panelStyle:u,close:m,keepOpen:v,closeSoon:y}),document.body)]})}function B(e){return e?.display_name||e?.global_name||e?.name||`未知作者`}function V({author:e,currentThreadId:t,viewerFlags:n,showName:i=!0,showAvatar:a=!0,onNavigate:o,fallbackName:s,className:c=``,avatarClassName:l=`h-5 w-5`,nameClassName:u=``}
1){let f=r(),p=e?.id?B(e):s||B(e),m=(0,M.jsxs)(M.Fragment,{children:[a&&(0,M.jsx)(d,{author:e,className:`${l} shrink-0 ring-1 ring-(--od-border-strong)/30 transition-[box-shadow] duration-200 group-hover/author:ring-(--od-accent) group-focus-visible/author:ring-(--od-accent)`}),i&&(0,M.jsx)(`span`,{className:`min-w-0 truncate transition-colors duration-200 group-hover/author:text-(--od-accent) group-focus-visible/author:text-(--od-accent) ${u}`,children:p})]});return e?.id?(0,M.jsx)(z,{author:e,currentThreadId:t,initialFollowed:n===void 0?void 0:n.includes(`followed_author`),children:(0,M.jsx)(`button`,{type:`button`,onClick:t=>{if(t.stopPropagation(),o){o({id:String(e.id),name:p});return}f(`/u/${e.id}`)},onPointerDown:e=>e.stopPropagation(),onPointerUp:e=>e.stopPropagation(),className:`group/author inline-flex min-w-0 items-center gap-1.5 text-(--od-text-tertiary) focus:outline-hidden focus-visible:ring-2 focus-visible:ring-(--od-accent) ${c}`,"aria-label":`查看作者:${p}`,children:m})}):(0,M.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 ${c}`,children:m})}export{A as i,z as n,k as r,V as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.