import{B as N,e as Q,_ as L,y as Z,b as M,s as P,c as ee,m as F,d as te,i as H}from"./CJ3Pvzvs.js";import{_ as se}from"./B82URuPQ.js";import{d as k,g as $,o as i,b as m,f as h,w as D,a as s,u as a,t as d,m as v,c as x,F as C,n as q,j as ie,q as w,r as E,k as ne,D as le,e as j,s as z}from"./3LwgCWkS.js";import{a as ae}from"./L7O7UxXI.js";import{u as J}from"./g-9Gx0R_.js";import{_ as oe}from"./BTWky2G2.js";const re=["innerHTML"],ce={key:0,class:"ms-3 py-1 px-2 bg-gray-200 text-xs rounded-lg"},R=k({__name:"Head",props:{item:{type:Object,required:!0}},setup(e){const l=N(),t=e,c=$(()=>{const _=t.item.pdfUrl;return`pdf/articles/${t.item.articleId}/${_}`}),o=$(()=>t.item.articleType=="Other"||t.item.articleType=="DiÄŸer"?!0:t.item.isOnlyPdf),u=$(()=>o.value?c.value:l(`/articles/${t.item.slug}/doi/${t.item.articleId}`)),y=$(()=>{if(o.value)return"_blank"});return(_,r)=>{const p=Q,f=se;return i(),m(C,null,[h(p,{to:a(u),class:"font-semibold text-gray-700 hover:text-sky-600",target:a(y)},{default:D(()=>[s("span",{innerHTML:e.item.title},null,8,re),a(o)?(i(),m("span",ce,d(_.$t("pdfArticle")),1)):v("",!0)]),_:1},8,["to","target"]),e.item.authors?(i(),x(f,{key:0,authors:e.item.authors,class:"my-4 px-3"},null,8,["authors"])):v("",!0)],64)}}}),X=k({__name:"Button",props:{url:{type:String},target:{type:String},icon:{type:String},iconClass:{type:String},label:{type:String}},setup(e){return(l,t)=>{const c=L,o=Z;return i(),x(o,{to:e.url,target:e.target},{default:D(()=>[e.icon?(i(),x(c,{key:0,name:e.icon,class:q(e.iconClass)},null,8,["name","class"])):v("",!0),ie(l.$slots,"default",{},()=>[w(d(e.label),1)])]),_:3},8,["to","target"])}}}),ue={class:"flex items-center text-gray-600 text-xs font-normal gap-1"},me={class:"flex-1 flex items-center gap-5"},de={key:0},pe={class:"font-semibold"},fe={key:1},ye={class:"font-semibold"},_e={key:2},ve={class:"font-semibold"},be={key:3},ge={class:"font-semibold"},he=k({__name:"Dates",props:{item:{type:Object,required:!0}},setup(e){return(l,t)=>{var o,u,y,_,r;const c=L;return i(),m("div",ue,[h(c,{name:"fa6-solid:calendar-days"}),s("div",me,[e.item.receivedDate?(i(),m("div",de,[w(d(l.$t("receivedDate"))+": ",1),s("span",pe,d((o=e.item)==null?void 0:o.receivedDate),1)])):v("",!0),e.item.acceptedDate?(i(),m("div",fe,[w(d(l.$t("acceptedDate"))+": ",1),s("span",ye,d((u=e.item)==null?void 0:u.acceptedDate),1)])):v("",!0),e.item.onlineDate?(i(),m("div",_e,[w(d(l.$t("onlineDate"))+": ",1),s("span",ve,d((y=e.item)==null?void 0:y.onlineDate),1)])):v("",!0),(_=e.item)!=null&&_.publishDate?(i(),m("div",be,[w(d(l.$t("publishDate"))+": ",1),s("span",ge,d((r=e.item)==null?void 0:r.publishDate),1)])):v("",!0)])])}}}),$e={class:"shadow-lg bg-white absolute z-30 -top-[61px] -left-[1px] w-full border border-gray-100 rounded-lg p-6 md:px-7"},xe={class:"absolute right-3 top-3"},Ie={class:"md:flex gap-6 items-center text-xs font-medium text-gray-500 mb-1 mt-4"},ke={class:"mt-2 md:mt-0"},we={class:"my-3"},Ae={class:"flex justify-end items-center gap-2 mt-3"},De={class:"border-t pt-4 quickviewabstract"},Ce={key:0,class:"flex items-center justify-center"},Te={class:"text-gray-500 ms-2 text-sm"},Pe={key:1},qe=k({__name:"QuickView",props:{item:{type:Object,required:!0}},setup(e){const l=N(),t=E(!0),{id:c,currentIssueId:o,abbreviation:u}=M(),{issue:y,currentIssue:_}=P(J()),r=e,p=$(()=>o==r.item.issueId?_.value:y.value),f=ee(),{articleId:b,abstract:I,abbreviation:A}=P(f),{locale:O}=F();ne(async()=>{(b.value??void 0)!==r.item.articleId&&(f.reset(),await $fetch(`/api/${c}/articles/${r.item.articleId}`,{query:{lang:O.value}}).then(n=>{n&&f.setArticle(n)})),t.value=!1});const S=$(()=>{var n,g,T;return`${u} ${(n=p.value)==null?void 0:n.year};${(g=p.value)==null?void 0:g.volume}(${(T=p.value)==null?void 0:T.issueNumber}):${r.item.startPage}-${r.item.endPage}`}),V=$(()=>l(`/articles/${r.item.slug}/doi/${r.item.articleId}`));return(n,g)=>{const T=L,G=R,K=he,U=X,W=ae;return i(),m("div",null,[s("div",{class:"fixed z-20 w-full h-full inset-0 bg-black bg-opacity-35",onClick:g[0]||(g[0]=B=>n.$emit("close-quick-view"))}),(i(),x(le,{appear:"",key:e.item.articleId,"enter-active-class":"transition-opacity duration-300","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-150","leave-from-class":"opacity-100","leave-to-class":"opacity-50"},{default:D(()=>{var B;return[s("div",$e,[s("div",xe,[s("button",{onClick:g[1]||(g[1]=Y=>n.$emit("close-quick-view"))},[h(T,{name:"material-symbols:close",class:"text-gray-500 cursor-pointer"})])]),s("div",Ie,[s("div",null,d(a(A)??a(S)),1),s("div",ke,"DOI: "+d((B=e.item)==null?void 0:B.doi),1)]),h(G,{item:e.item},null,8,["item"]),s("div",we,[h(K,{item:e.item},null,8,["item"]),s("div",Ae,[h(U,{onClick:g[2]||(g[2]=Y=>("useCitePanel"in n?n.useCitePanel:a(te))().open()),class:"btn-article-item text-blue-600",icon:"bi:chat-left-quote","icon-class":"me-2 w-4 h-4",label:n.$t("cite")},null,8,["label"]),h(U,{to:a(V),class:"btn-article-item text-yellow-600",icon:"ph:file-html-duotone","icon-class":"me-1 text-lg",label:n.$t("fullText")},null,8,["to","label"])])]),s("div",De,[a(t)?(i(),m("div",Ce,[g[3]||(g[3]=s("svg",{class:"animate-spin h-5 w-5 text-cyan-500",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[s("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),s("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1)),s("span",Te,d(n.$t("loadingAbstract"))+"... ",1)])):(i(),m("div",Pe,[a(I)?(i(),x(W,{key:0,section:a(I)},null,8,["section"])):v("",!0)]))])])]}),_:1}))])}}}),Le={class:"px-3 md:px-7"},Oe={class:"flex items-center gap-2 justify-end"},Se=k({__name:"Index",props:{item:{type:Object,required:!0}},setup(e){const l=N(),t=e,c=$(()=>t.item.articleType!="Other"&&!t.item.isOnlyPdf&&t.item.hasAbstract),o=$(()=>{const r=t.item.pdfUrl;return`pdf/articles/${t.item.articleId}/${r}`}),u=E(!1),y=$(()=>t.item.articleType=="Other"||t.item.articleType=="DiÄŸer"?!0:t.item.isOnlyPdf),_=$(()=>y.value?o.value:l(`/articles/${t.item.slug}/doi/${t.item.articleId}`));return(r,p)=>{const f=R,b=X,I=qe;return i(),m(C,null,[s("div",Le,[h(f,{item:e.item},null,8,["item"]),s("div",Oe,[a(c)?(i(),x(b,{key:0,onClick:p[0]||(p[0]=A=>u.value=!0),class:"btn-article-item text-gray-600",icon:"ic:twotone-visibility","icon-class":"me-1 text-rose-400 text-lg",label:r.$t("quickView")},null,8,["label"])):v("",!0),a(y)?v("",!0):(i(),x(b,{key:1,to:a(_),class:"btn-article-item text-yellow-600",icon:"ph:file-html-duotone","icon-class":"me-1 text-lg",label:r.$t("fullText")},null,8,["to","label"])),a(y)?(i(),x(b,{key:2,to:a(o),class:"btn-article-item text-gray-600",icon:"material-symbols:cloud-download-rounded","icon-class":"me-1",label:"PDF",target:"_blank"},null,8,["to"])):v("",!0)])]),a(u)?(i(),x(I,{key:0,item:e.item,onCloseQuickView:p[1]||(p[1]=A=>u.value=!1),class:""},null,8,["item"])):v("",!0)],64)}}}),Ve={class:"relative"},Be=k({__name:"Index",props:{articles:{type:Array,required:!0}},setup(e){return(l,t)=>{const c=Se;return i(!0),m(C,null,j(e.articles,(o,u)=>(i(),m("div",{class:q([u===e.articles.length-1?"":"border-b",u===0&&e.articles.length>1?"pt-0 pb-10":"py-10",e.articles.length===1?"py-0 pt-0 pb-5":""])},[s("div",Ve,[h(c,{item:o},null,8,["item"])])],2))),256)}}}),je={key:0},Ne={class:"py-10 px-4 text-gray-400 fw-bold text-sm"},Ue={class:"text-xs text-gray-500 bg-primary-100 rounded-full px-2 py-1 ms-1"},Je=k({__name:"Issue",props:{issueId:{type:String,required:!0}},async setup(e){let l,t;const c=e,o=J(),{id:u,currentIssueId:y}=P(M()),{locale:_}=F(),{currentIssue:r,issue:p,articles:f}=P(o);if(c.issueId==y.value)if(console.log("show current issue articles"),r.value)console.log("set current issue articles"),o.setArticles(r.value.articles);else{console.log("fetch current issue articles");const{data:b}=([l,t]=z(()=>H("currentissue",()=>$fetch(`/api/${u.value}/issues/${y.value}`,{query:{lang:_.value}}))),l=await l,t(),l);b.value&&o.setCurrentIssue(b.value)}else if(!p.value||p.value.id!==c.issueId){console.log("fetch issue articles",c.issueId);const{data:b}=([l,t]=z(()=>H(c.issueId,()=>$fetch(`/api/${u.value}/issues/${c.issueId}`,{query:{lang:_.value}}),"$86TVcomIXi")),l=await l,t(),l);b.value&&o.setIssue(b.value)}else console.log("set issue articles"),o.setArticles(p.value.articles);return(b,I)=>{const A=L,O=Q,S=Be,V=oe;return a(f)?(i(),m("div",je,[s("div",{class:q(["hidden md:flex gap-4 mb-4 overflow-x-auto",a(f).length<=5?"":"scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-gray-100"])},[(i(!0),m(C,null,j(a(f),n=>(i(),x(O,{key:n.articleType,to:`#section-${n.articleType}`,class:q(["rounded-lg border border-gray-100 text-center hover:bg-primary-100",a(f).length>5?"w-1/5 flex-shrink-0":` w-full w-1/${a(f).length}`])},{default:D(()=>[s("div",Ne,[h(A,{name:n.icon,class:"text-4xl mb-2"},null,8,["name"]),s("div",null,[w(d(n.articleType)+" ",1),s("span",Ue,d(n.articles.length),1)]),I[0]||(I[0]=s("div",{class:"mt-2"},null,-1))])]),_:2},1032,["to","class"]))),128))],2),(i(!0),m(C,null,j(a(f),n=>(i(),x(V,{title:n.articleType,class:"mb-5",id:`section-${n.articleType}`,"is-sticky":!0},{body:D(()=>[h(S,{articles:n.articles},null,8,["articles"])]),_:2},1032,["title","id"]))),256))])):v("",!0)}}});export{Je as _};