1import{C as e,D as t,E as n,F as r,J as i,K as a,M as o,N as s,O as c,T as l,U as u,W as d,Z as f,ct as p,it as m,k as h,lt as g,n as _,st as v,ut as y}from"./vendor-vue-Bu-KQjoC.js";import{Z as b,st as x}from"./index-BE2-dWra.js";import{t as S}from"./useWindowWidth-BPOgIc3r.js";import{a as C,i as w,n as T,o as E,t as D}from"./seigaApi-CaS7khpJ.js";var O=[`href`],k=[`src`,`alt`],A={key:1,class:`flex aspect-[4/3] items-center justify-center text-[12px] text-muted`},j={class:`absolute left-1 top-1 z-10 flex flex-col items-start gap-0.5`},M={key:0,class:`inline-flex items-center gap-0.5 rounded-sm bg-hall px-1.5 py-0.5 text-[11px] font-bold text-white`},N={key:1,class:`inline-flex items-center rounded-sm bg-black/65 px-1.5 py-0.5 text-[11px] font-bold text-white`},P={key:2,class:`absolute bottom-1 left-1 inline-flex max-w-[calc(100%-0.5rem)] items-center gap-0.5 rounded-sm bg-black/60 px-1.5 py-0.5 text-[11px] font-bold text-white`},F={class:`truncate`},I={key:3,class:`absolute bottom-1 right-1 rounded-sm bg-black/60 px-1.5 py-0.5 text-[11px] font-bold text-white`},L={class:`p-2`},R={class:`line-clamp-2 text-[15px] leading-snug text-primary group-hover:text-accent`},z=r({__name:`SeigaCard`,props:{item:{}},setup(e){let t=e,{t:r}=_(),a=x(),u=l(()=>E(t.item.sid)),f=l(()=>C(t.item)),m=l(()=>{let{width:e,height:n}=t.item;if(e&&n&&e>0&&n>0)return{aspectRatio:`${e} / ${n}`}}),b=l(()=>!!m.value),S=l(()=>t.item.title||r(`seiga.untitled`,{sid:t.item.sid}));function T(e){if(e.button!==0&&e.button!==1)return;let n=a.activeAccount?.token;n&&w(t.item.sid,n)}return(t,a)=>{let l=i(`MaterialIcon`);return d(),h(`a`,{href:u.value,target:`_blank`,rel:`noopener noreferrer`,class:`group block overflow-hidden rounded-[var(--radius-default)] border border-border bg-surface no-underline transition-shadow hover:shadow-md`,onClick:T,onAuxclick:T},[n(`div`,{class:`relative overflow-hidden bg-reader`,style:g(m.value)},[f.value?(d(),h(`img`,{key:0,src:f.value,alt:S.value,loading:`lazy`,class:p([`feed-cover-zoom block w-full`,[b.value?`h-full object-cover`:`h-auto`,e.item.isGore===1?`scale-105 blur-md`:``]])},null,10,k)):(d(),h(`div`,A,y(v(r)(`seiga.noPreview`)),1)),n(`div`,j,[e.item.isHall===1?(d(),h(`span`,M,[s(l,{name:`workspace_premium`,variant:`filled`,size:12}),o(` `+y(v(r)(`seiga.badgeHall`)),1)])):c(``,!0),e.item.isAi===1?(d(),h(`span`,N,y(v(r)(`seiga.badgeAi`)),1)):c(``,!0)]),e.item.collection?(d(),h(`span`,P,[s(l,{name:`collections_bookmark`,size:12}),n(`span`,F,y(e.item.collection),1)])):c(``,!0),e.item.pageCount>1?(d(),h(`span`,I,y(e.item.pageCount)+`P `,1)):c(``,!0)],4),n(`div`,L,[n(`h3`,R,y(S.value),1)])],40,O)}}}),B={class:`animate-pulse overflow-hidden rounded-[var(--radius-default)] border border-border bg-surface`},V=r({__name:`SeigaCardSkeleton`,props:{ratio:{}},setup(e){return(t,r)=>(d(),h(`div`,B,[n(`div`,{class:`home-skeleton-cover bg-reader`,style:g({aspectRatio:e.ratio||`4 / 3`})},null,4),r[0]||(r[0]=n(`div`,{class:`space-y-1.5 p-2`},[n(`div`,{class:`home-skeleton-line h-4 w-full rounded-sm bg-elevated`}),n(`div`,{class:`home-skeleton-line h-3 w-3/5 rounded-sm bg-elevated`})],-1))]))}}),H=`page:seiga`,U=.08;function W(e){return e.width&&e.height&&e.width>0?e.height/e.width+U:.83}function G(){let{t:e}=_(),t=x(),n=b(),{windowWidth:r}=S(),i=n.getPageState(H),a=m(i?.items??[]),o=m(i?.offset??0),s=m(!1),c=m(!1),d=m(i?.hasMore??!0),p=m(null),h=m(!!(i?.hasFetched&&a.value.length>0)),g=m(null),v=m(!1),y=m(void 0),C=l(()=>t.isReady?t.activeAccount?.token??null:null),w=l(()=>r.value>=1024?4:r.value>=768?3:2),E=l(()=>{let e=Math.max(1,w.value),t=Array.from({length:e},()=>[]),n=Array(e).fill(0);for(let r of a.value){let i=0;for(let t=1;t<e;t++)n[t]<n[i]&&(i=t);t[i].push(r),n[i]+=W(r)}return t});function D(){n.setPageState(H,{items:a.value,offset:o.value,hasMore:d.value,hasFetched:h.value})}f([a,o,d,h],D);async function O(t,n){if(!v.value){v.value=!0;try{t===0?s.value=!0:c.value=!0,p.value=null;let r=await T(t,C.value,e(`seiga.fetchFailed`));if(!r.ok){p.value=r.message,n||(a.value=[]);return}a.value=n?[...a.value,...r.list]:r.list,o.value=t+r.list.length,d.value=r.list.length===20,h.value=!0}catch{p.value=e(`seiga.fetchFailed`),n||(a.value=[])}finally{v.value=!1,s.value=!1,c.value=!1}}}function k(){v.value=!1,a.value=[],o.value=0,d.value=!0,O(0,!1)}f(()=>[t.isReady,C.value],([e,t])=>
1{if(!e)return;let n=y.value;if(n===void 0){y.value=t,t&&a.value.length>0&&(h.value=!1);return}n!==t&&(y.value=t,h.value=!1)}),f(()=>[t.isReady,h.value],([e,t])=>{e&&(t||k())},{immediate:!0});function A(){v.value||c.value||s.value||!d.value||O(o.value,!0)}let j=null;return f(()=>[g.value,d.value,s.value,c.value,a.value.length],([e,t,n,r],i,o)=>{j?.disconnect(),!(!t||n||r||!e||a.value.length===0)&&(j=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&A()},{threshold:.1,rootMargin:`0px 0px 400px 0px`}),j.observe(e),o(()=>j?.disconnect()))},{flush:`post`}),u(()=>{j?.disconnect()}),{items:a,loading:s,loadingMore:c,hasMore:d,error:p,columnCount:w,assignedColumns:E,loadMoreRef:g,loadMore:A}}var K={class:`space-y-4`},q={class:`flex items-baseline justify-between gap-2 border-b border-border pb-2`},J={class:`min-w-0`},Y={class:`text-base font-bold text-primary`},X={class:`mt-0.5 text-[13px] text-muted`},Z=[`href`],Q={key:0,class:`border border-danger/30 bg-danger/10 px-3 py-2 text-[13px] text-danger`},$={key:1,class:`flex items-start gap-2`},ee={key:2,class:`py-16 text-center`},te={class:`text-[13px] text-muted`},ne={class:`flex items-start gap-2`},re=[`disabled`],ie={key:1,class:`text-xs text-muted`},ae=r({__name:`SeigaView`,setup(r){let{t:l}=_(),{items:u,loading:f,loadingMore:p,hasMore:m,error:g,columnCount:b,assignedColumns:x,loadMoreRef:S,loadMore:C}=G(),w=[`4 / 3`,`3 / 4`,`1 / 1`,`5 / 4`];return(r,_)=>{let T=i(`MaterialIcon`);return d(),h(`div`,K,[n(`div`,q,[n(`div`,J,[n(`h1`,Y,y(v(l)(`seiga.title`)),1),n(`p`,X,y(v(l)(`seiga.desc`)),1)]),n(`a`,{href:v(D),target:`_blank`,rel:`noopener noreferrer`,class:`inline-flex shrink-0 items-center gap-1 text-[13px] text-accent no-underline hover:underline`},[o(y(v(l)(`seiga.openSite`))+` `,1),s(T,{name:`open_in_new`,size:14})],8,Z)]),v(g)?(d(),h(`p`,Q,y(v(g)),1)):c(``,!0),v(f)&&v(u).length===0?(d(),h(`div`,$,[(d(!0),h(e,null,a(v(b),t=>(d(),h(`div`,{key:t,class:`flex min-w-0 flex-1 flex-col gap-2`},[(d(),h(e,null,a(3,e=>s(V,{key:e,ratio:w[(t+e)%w.length]},null,8,[`ratio`])),64))]))),128))])):!v(f)&&v(u).length===0?(d(),h(`div`,ee,[n(`p`,te,y(v(l)(`seiga.empty`)),1)])):(d(),h(e,{key:3},[n(`div`,ne,[(d(!0),h(e,null,a(v(x),(n,r)=>(d(),h(`div`,{key:r,class:`flex min-w-0 flex-1 flex-col gap-2`},[(d(!0),h(e,null,a(n,e=>(d(),t(z,{key:e.sid,item:e},null,8,[`item`]))),128))]))),128))]),v(u).length>0?(d(),h(`div`,{key:0,ref_key:`loadMoreRef`,ref:S,class:`flex justify-center pb-2 pt-4`},[v(m)?(d(),h(`button`,{key:0,type:`button`,class:`nico-btn border border-border bg-base px-4 text-[13px] text-primary disabled:cursor-not-allowed disabled:opacity-50`,disabled:v(p),onClick:_[0]||(_[0]=(...e)=>v(C)&&v(C)(...e))},y(v(p)?v(l)(`seiga.loadingMore`):v(l)(`seiga.loadMore`)),9,re)):(d(),h(`span`,ie,y(v(l)(`seiga.noMore`)),1))],512)):c(``,!0)],64))])}}});export{ae as default};
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.