import{_ as $,a as L,b as T,c as D}from"./BfPjfeWt.js";import{_ as I}from"./CgXve9qO.js";import{_ as V}from"./DxB0DKYp.js";import{u as C}from"./BZ7f31ti.js";import{u as F,q as H,c as i,b as _,a as e,t as o,e as t,w as m,F as R,r as S,l as p,o as a,d as k,I as j}from"./BKiFavna.js";import{u as q}from"./BOqT4ZDK.js";import{_ as M}from"./DlAUqK2U.js";import"./DKzHUNYh.js";const U={"data-theme":"light"},A={id:"main-content",role:"main"},E={class:"container"},P={class:"page-header"},Y={class:"page-title"},z={class:"breadcrumb"},G={key:0,class:"auth-prompt"},J={key:1},K={key:0,class:"loading-box"},O={key:1,class:"empty-box"},Q={key:2},W={class:"result-count"},X={class:"posts-grid"},Z={class:"post-thumb"},ee=["src","alt"],te={key:1,class:"post-emoji"},se={class:"post-body"},oe={class:"post-cat"},ne={class:"post-title"},ae={class:"post-meta"},ie={__name:"bookmarks",setup(le){const{lang:s}=F(),{api:f,user:u,fetchMe:g}=C(),c=p([]),b=p(!1),h=r=>r?new Date(r).toLocaleDateString(s.value==="bn"?"bn-BD":"en-US",{year:"numeric",month:"short",day:"numeric"}):"",v=async()=>{if(u.value){b.value=!0;try{const r=await f.get("/bookmarks");c.value=r.data.bookmarks||[]}catch{c.value=[]}finally{b.value=!1}}};return H(async()=>{u.value||await g(),await v()}),q(()=>({title:s.value==="bn"?"সংরক্ষিত সংবাদ — নিউজভার্স":"Bookmarks — NewsVerse"})),(r,l)=>{const y=$,w=L,B=T,x=I,d=V,N=D;return a(),i("div",U,[_(y),_(w),_(B),_(x),e("main",A,[e("div",E,[e("div",P,[e("h1",Y,"🔖 "+o(t(s)==="bn"?"সংরক্ষিত সংবাদ":"Bookmarks"),1),e("div",z,[_(d,{to:"/"},{default:m(()=>[k(o(t(s)==="bn"?"হোম":"Home"),1)]),_:1}),l[0]||(l[0]=e("span",null," › ",-1)),e("span",null,o(t(s)==="bn"?"সংরক্ষিত":"Bookmarks"),1)])]),t(u)?(a(),i("div",J,[t(b)?(a(),i("div",K,[l[2]||(l[2]=e("div",{class:"loader"},null,-1)),e("p",null,o(t(s)==="bn"?"লোড হচ্ছে...":"Loading..."),1)])):t(c).length===0?(a(),i("div",O,[l[3]||(l[3]=e("div",{class:"empty-icon"},"📭",-1)),e("h2",null,o(t(s)==="bn"?"কোনো সংরক্ষিত সংবাদ নেই":"No Bookmarks Yet"),1),e("p",null,o(t(s)==="bn"?"পছন্দের সংবাদে বুকমার্ক আইকনে ক্লিক করে সেভ করুন।":"Click the bookmark icon on any news to save it here."),1),_(d,{to:"/",class:"btn-home"},{default:m(()=>[k(o(t(s)==="bn"?"সংবাদ পড়ুন":"Read News"),1)]),_:1})])):(a(),i("div",Q,[e("p",W,o(t(s)==="bn"?`${t(c).length}টি সংবাদ সংরক্ষিত আছে`:`${t(c).length} bookmark(s)`),1),e("div",X,[(a(!0),i(R,null,S(t(c),n=>(a(),j(d,{key:n.id,to:`/news/${encodeURIComponent(t(s)==="bn"?n.slug_bn:n.slug_en||n.slug_bn)}`,class:"post-card"},{default:m(()=>[e("div",Z,[n.featured_image?(a(),i("img",{key:0,src:n.featured_image,alt:n.title_bn},null,8,ee)):(a(),i("span",te,o(n.emoji||"📰"),1))]),e("div",se,[e("span",oe,o(t(s)==="bn"?n.category_name_bn:n.category_name_en),1),e("h2",ne,o(t(s)==="bn"?n.title_bn:n.title_en||n.title_bn),1),e("div",ae,[e("span",null,"📅 "+o(h(n.published_at)),1),e("span",null,"🔖 "+o(h(n.bookmarked_at)),1)])])]),_:2},1032,["to"]))),128))])]))])):(a(),i("div",G,[l[1]||(l[1]=e("div",{class:"auth-icon"},"🔒",-1)),e("h2",null,o(t(s)==="bn"?"লগইন প্রয়োজন":"Login Required"),1),e("p",null,o(t(s)==="bn"?"সংরক্ষিত সংবাদ দেখতে লগইন করুন।":"Please login to view your bookmarks."),1),_(d,{to:"/login",class:"btn-login"},{default:m(()=>[k(o(t(s)==="bn"?"লগইন করুন":"Login"),1)]),_:1})]))])]),_(N)])}}},he=M(ie,[["__scopeId","data-v-46f21772"]]);export{he as default};
