import{A as e,C as t,D as n,M as r,N as i,O as a,S as o,T as s,_ as c,a as l,b as u,c as d,f,g as p,h as m,i as h,j as g,k as _,m as v,o as y,s as b,u as x,v as S,w as C,x as w,y as T}from"./index-jy40eMQa.js";import{t as E}from"./admin-CqpMrZ_s.js";import{i as D}from"./types-WIP_Oieg.js";var O={class:`user-bookmarks`},k={class:`page-header`},A={class:`search-bar`},j={class:`bookmark-cell`},M=[`src`],N={class:`bookmark-info`},P={class:`title`},F=[`href`],I={class:`tags`},L={class:`pagination`},R=y(u({__name:`UserBookmarksView`,setup(i){let u=h(),y=l(),R=e(!0),z=e([]),B=e(0),V=_({page:1,pageSize:20,search:``}),H=u.params.id;w(()=>{U()});async function U(){R.value=!0;try{let e=await E.getUserBookmarks(H,V);e.success&&e.data&&(z.value=e.data.items,B.value=e.data.total)}finally{R.value=!1}}function W(){V.page=1,U()}function G(e){V.page=e,U()}async function K(e){try{await b.confirm(`确定要删除书签 "${e.title}" 吗？`,`删除确认`,{confirmButtonText:`删除`,cancelButtonText:`取消`,type:`warning`}),(await E.deleteUserBookmark(H,e.id)).success&&(d.success(`删除成功`),U())}catch{}}function q(e){return{[D.Public]:`公开`,[D.Private]:`私密`,[D.Specified]:`指定设备`}[e]||`公开`}function J(e){return e?new Date(e).toLocaleString(`zh-CN`):`-`}return(e,i)=>{let l=C(`ArrowLeft`),u=C(`el-icon`),d=C(`el-button`),h=C(`Search`),_=C(`el-input`),b=C(`el-table-column`),w=C(`el-tag`),E=C(`el-table`),D=C(`el-pagination`),H=s(`loading`);return o(),c(`div`,O,[v(`div`,k,[T(d,{onClick:i[0]||=e=>g(y).back()},{default:n(()=>[T(u,null,{default:n(()=>[T(l)]),_:1}),i[4]||=S(` 返回 `,-1)]),_:1}),i[5]||=v(`h2`,null,`用户书签`,-1)]),v(`div`,A,[T(_,{modelValue:V.search,"onUpdate:modelValue":i[1]||=e=>V.search=e,placeholder:`搜索书签标题或URL`,clearable:``,style:{width:`300px`},onKeyup:x(W,[`enter`])},{prefix:n(()=>[T(u,null,{default:n(()=>[T(h)]),_:1})]),_:1},8,[`modelValue`]),T(d,{type:`primary`,onClick:W},{default:n(()=>[...i[6]||=[S(`搜索`,-1)]]),_:1})]),a((o(),m(E,{data:z.value,class:`bookmark-table`},{default:n(()=>[T(b,{label:`书签`,"min-width":`300`},{default:n(({row:e})=>[v(`div`,j,[e.icon?(o(),c(`img`,{key:0,src:e.icon,class:`favicon`,onError:i[2]||=e=>e.target.style.display=`none`},null,40,M)):p(``,!0),v(`div`,N,[v(`div`,P,r(e.title),1),v(`a`,{href:e.url,target:`_blank`,class:`url`},r(e.url),9,F)])])]),_:1}),T(b,{label:`标签`,width:`200`},{default:n(({row:e})=>[v(`div`,I,[(o(!0),c(f,null,t(e.tags.slice(0,3),e=>(o(),m(w,{key:e,size:`small`,type:`info`},{default:n(()=>[S(r(e),1)]),_:2},1024))),128))])]),_:1}),T(b,{label:`可见性`,width:`100`},{default:n(({row:e})=>[S(r(q(e.visibility)),1)]),_:1}),T(b,{label:`访问次数`,width:`100`,align:`center`,prop:`visitCount`}),T(b,{label:`创建时间`,width:`180`},{default:n(({row:e})=>[S(r(J(e.createdAt)),1)]),_:1}),T(b,{label:`操作`,width:`100`,fixed:`right`},{default:n(({row:e})=>[T(d,{size:`small`,type:`danger`,onClick:t=>K(e)},{default:n(()=>[...i[7]||=[S(` 删除 `,-1)]]),_:1},8,[`onClick`])]),_:1})]),_:1},8,[`data`])),[[H,R.value]]),v(`div`,L,[T(D,{"current-page":V.page,"onUpdate:currentPage":i[3]||=e=>V.page=e,"page-size":V.pageSize,total:B.value,layout:`total, prev, pager, next`,onCurrentChange:G},null,8,[`current-page`,`page-size`,`total`])])])}}}),[[`__scopeId`,`data-v-be59d845`]]);export{R as default};