1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PDFViewerEmbed-4BLsCE7P.js","assets/index--lCEmp1k.js","assets/index-CrvHPplm.css","assets/slider-CqbwTadg.js","assets/index-BdQq_4o_.js","assets/zoom-out-CMXq7Z5t.js","assets/zoom-in-eAQBXNdO.js","assets/minimize-2-BXPUXkFB.js","assets/QuillEditor-CY4PPdw3.js","assets/quill.snow-DtyT7im1.js","assets/isEqual-CvXGQbAQ.js","assets/quill-DZrYvFpI.css"])))=>i.map(i=>d[i]); 2import{q as Me,r as j,s as Ht,t as L,j as e,v as me,C as $t,w as Vs,x as Rt,y as de,z as lr,A as cr,U as da,D as Ke,E as fe,l as q,F as dr,p as N,G as mr,X,I as Dt,J as Tt,K as hr,L as ot,M as ur,N as pr,O as xr,Q as gr,S as Ys,T as W,o as ma,W as B,_ as ha,Y as fr,Z as br,a0 as Qs,a1 as Xs,a2 as nt,a3 as Ws,H as jr,a4 as Oe,a5 as _e,a6 as ke,a7 as Ee,a8 as K,n as D,a9 as vr,aa as yr,ab as Zs,ac as wr,ad as Nr,ae as St,af as it,ag as At,ah as Mt,ai as It,aj as Js,ak as Q}from"./index--lCEmp1k.js";import{P as Cr}from"./Preloader-DtFzaVoX.js";import{J as _r,F as kr,v as Er,C as Sr,A as Pt,E as Ar,a as Mr}from"./figureTableValidator-CIcN_W1N.js";import{A as xe}from"./ArticleContent-CJOm4E6N.js";import{L as Ir,E as Pr}from"./ExpandableImage-CUE_nnJZ.js";import{P as $r,C as Rr,A as Dr,T as Ks}from"./ArticleStatusBadge-BNHzGe7Y.js";import{S as Ye}from"./skeleton-DKURN8et.js";import{A as ea,a as ta,b as sa,c as aa}from"./accordion-DSqhe2P1.js";import{A as Tr}from"./AuthorAffiliationsDialog-DNYnVlwm.js";import{S as Ft,A as Fr}from"./AbstractPopup-gSIZnYbg.js";import{C as zr}from"./select-Cwq1Dss1.js";import{T as zt,a as Lt,b as Se,c as Qe}from"./tabs-BuC0wrSm.js";import{S as Lr}from"./scroll-area-DYZMJPzn.js";import{I as je}from"./image-BsQgpvaD.js";import{Z as Or}from"./zoom-out-CMXq7Z5t.js";import{Z as Ur}from"./zoom-in-eAQBXNdO.js";import{C as Ot}from"./chevron-left-CDoVvEkK.js";import{u as Br}from"./useQuery-Dwx2dTOU.js";import{T as Hr,C as Xe}from"./calendar-D5Sr7TwL.js";import{P as We,a as Ze,b as Je}from"./popover-Dfn0yPZc.js";import{u as ra}from"./s3Upload-Vo86IXqq.js";import{S as re}from"./square-pen-DdhTwjVI.js";import{C as na}from"./copy-BgnZytQC.js";import{R as qr}from"./refresh-cw-BtDVTuc0.js";import{U as ia}from"./upload-DasckoQH.js";import{f as ge}from"./format-Bcgc37xn.js";import"./use-toast-B24a8wxm.js";import"./file-down-EGLGTVDj.js";import"./loader-circle-DTENR54N.js";import"./network-BmyfUUpe.js";import"./share-2-Bdm_gM5n.js";import"./link-zfy96pmu.js";import"./arrow-up-m304MqIM.js";import"./arrow-down-LPh42kM1.js";import"./hover-card-BcWOUeO4.js";import"./index-BdQq_4o_.js";/** 3 * @license lucide-react v0.462.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const Gr=Me("ArrowUpLeft",[["path",{d:"M7 17V7h10",key:"11bw93"}],["path",{d:"M17 17 7 7",key:"2786uv"}]]);/** 8 * @license lucide-react v0.462.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const Vr=Me("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** 13 * @license lucide-react v0.462.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const Yr=Me("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** 18 * @license lucide-react v0.462.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree. 22 */const Qr=Me("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** 23 * @license lucide-react v0.462.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const Xr=Me("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** 28 * @license lucide-react v0.462.0 - ISC 29 * 30 * This source code is licensed under the ISC license. 31 * See the LICENSE file in the root directory of this source tree. 32 */const Wr=Me("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** 33 * @license lucide-react v0.462.0 - ISC 34 * 35 * This source code is licensed under the ISC license. 36 * See the LICENSE file in the root directory of this source tree. 37 */const oa=Me("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]),Zr=async a=>{var h;const m=new _r;m.file("mimetype","application/epub+zip",{compression:"STORE"}
37),m.file("META-INF/container.xml",`<?xml version="1.0" encoding="UTF-8"?> 38<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> 39 <rootfiles> 40 <rootfile full-path="OEBPS/content.opf" media-type="application/oebps-package+xml"/> 41 </rootfiles> 42</container>`);const g=`urn:uuid:${Date.now()}-${Math.random().toString(36).substr(2,9)}`,b=a.authors.map(p=>` <dc:creator opf:role="aut">${p.givenNames?`${p.givenNames} ${p.surname}`:p.surname}</dc:creator>`).join(` 43`),u=`<?xml version="1.0" encoding="UTF-8"?> 44<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="BookId"> 45 <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> 46 <dc:title>${ne(a.title)}</dc:title> 47${b} 48 <dc:language>en</dc:language> 49 <dc:identifier id="BookId">${g}</dc:identifier> 50 <dc:publisher>${ne(a.journal)}</dc:publisher> 51 ${a.publishedDate?`<dc:date>${a.publishedDate}</dc:date>`:""} 52 ${a.doi?`<dc:identifier opf:scheme="DOI">${ne(a.doi)}</dc:identifier>`:""} 53 ${a.abstract?`<dc:description>${ne(a.abstract)}</dc:description>`:""} 54 ${a.keywords?a.keywords.map(p=>`<dc:subject>${ne(p)}</dc:subject>`).join(` 55 `):""} 56 <meta name="cover" content="cover-image"/> 57 </metadata> 58 <manifest> 59 <item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/> 60 <item id="content" href="content.html" media-type="application/xhtml+xml"/> 61 <item id="stylesheet" href="stylesheet.css" media-type="text/css"/> 62 </manifest> 63 <spine toc="ncx"> 64 <itemref idref="content"/> 65 </spine> 66</package>`;m.file("OEBPS/content.opf",u);const S=`<?xml version="1.0" encoding="UTF-8"?> 67<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> 68 <head> 69 <meta name="dtb:uid" content="${g}"/> 70 <meta name="dtb:depth" content="1"/> 71 <meta name="dtb:totalPageCount" content="0"/> 72 <meta name="dtb:maxPageNumber" content="0"/> 73 </head> 74 <docTitle> 75 <text>${ne(a.title)}</text> 76 </docTitle> 77 <navMap> 78 <navPoint id="content" playOrder="1"> 79 <navLabel> 80 <text>Article</text> 81 </navLabel> 82 <content src="content.html"/> 83 </navPoint> 84 </navMap> 85</ncx>`;m.file("OEBPS/toc.ncx",S);const M=a.authors.map(p=>`${p.givenNames?`${p.givenNames} ${p.surname}`:p.surname}${p.affiliation?` (${p.affiliation})`:""}`).join(", "),n=`<?xml version="1.0" encoding="UTF-8"?> 86<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 87<html xmlns="http://www.w3.org/1999/xhtml"> 88<head> 89 <title>${ne(a.title)}</title> 90 <link rel="stylesheet" type="text/css" href="stylesheet.css"/> 91 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 92</head> 93<body> 94 <div class="article"> 95 <h1 class="title">${ne(a.title)}</h1> 96 97 <div class="authors"> 98 <p><strong>Authors:</strong> ${ne(M)}</p> 99 </div> 100 101 <div class="metadata"> 102 <p><strong>Published in:</strong> ${ne(a.journal)}</p> 103 ${a.year?`<p><strong>Year:</strong> ${a.year}</p>`:""} 104 ${a.volume?`<p><strong>Volume:</strong> ${a.volume}</p>`:""} 105 ${a.issue?`<p><strong>Issue:</strong> ${a.issue}</p>`:""} 106 ${a.pages?`<p><strong>Pages:</strong> ${a.pages}</p>`:""} 107 ${a.doi?`<p><strong>DOI:</strong> ${ne(a.doi)}</p>`:""} 108 ${a.publishedDate?`<p><strong>Published:</strong> ${a.publishedDate}</p>`:""} 109 </div> 110 111 ${a.abstract?` 112 <div class="abstract"> 113 <h2>Abstract</h2> 114 <p>${ne(a.abstract)}</p> 115 </div> 116 `:""} 117 118 ${a.keywords&&a.keywords.length>0?` 119 <div class="keywords"> 120 <p><strong>Keywords:</strong> ${a.keywords.map(p=>ne(p)).join(", ")}</p> 121 </div> 122 `:""} 123 124 <div class="content"> 125 ${Jr(a.content)} 126 </div> 127 </div> 128</body> 129</html>`;m.file("OEBPS/content.html",n),m.file("OEBPS/stylesheet.css",` 130body { 131 font-family: Georgia, serif; 132 line-height: 1.6; 133 margin: 1em; 134 color: #000; 135} 136 137.article { 138 max-width: 100%; 139} 140 141.title { 142 font-size: 1.8em; 143 font-weight: bold; 144 margin-bottom: 0.5em; 145 line-height: 1.3; 146 text-align: left; 147} 148 149.authors { 150 margin-bottom: 1em; 151 font-size: 1em; 152} 153 154.metadata { 155 margin-bottom: 1.5em; 156 font-size: 0.9em; 157 border-top: 1px solid #ccc; 158 border-bottom: 1px solid #ccc; 159 padding: 0.5em 0; 160} 161 162.metadata p { 163 margin: 0.3em 0; 164} 165 166.abstract { 167 margin-bottom: 1.5em; 168 background: #f5f5f5; 169 padding: 1em; 170 border-left: 3px solid #333; 171} 172 173.abstract h2 { 174 font-size: 1.2em; 175 margin-top: 0; 176 margin-bottom: 0.5em; 177} 178 179.keywords { 180 margin-bottom: 1.5em; 181 font-size: 0.9em; 182 font-style: italic; 183} 184 185.content { 186 margin-top: 2em; 187} 188 189.content h2 { 190 font-size: 1.4em; 191 margin-top: 1.5em; 192 margin-bottom: 0.5em; 193 page-break-after: avoid; 194} 195 196.content h3 { 197 font-size: 1.2em; 198 margin-top: 1.2em; 199 margin-bottom: 0.4em; 200 page-break-after: avoid; 201} 202 203.content p { 204 margin: 0.8em 0; 205 text-align: justify; 206} 207 208.content ul, .content ol { 209 margin: 1em 0; 210 padding-left: 2em; 211} 212 213.content li { 214 margin: 0.5em 0; 215} 216 217.content table { 218 width: 100%; 219 border-collapse: collapse; 220 margin: 1em 0; 221 font-size: 0.9em; 222} 223 224.content th, .content td { 225 border: 1px solid #ccc; 226 padding: 0.5em; 227 text-align: left; 228} 229 230.content th { 231 background: #f0f0f0; 232 font-weight: bold; 233} 234 235.content blockquote { 236 margin: 1em 2em; 237 padding: 0.5em 1em; 238 border-left: 3px solid #ccc; 239 font-style: italic; 240} 241 242.content pre, .content code { 243 font-family: "Courier New", monospace; 244 background: #f5f5f5; 245 padding: 0.2em 0.4em; 246} 247 248.content pre { 249 padding: 1em; 250 overflow-x: auto; 251} 252 253.references { 254 margin-top: 2em; 255 border-top: 2px solid #333; 256 padding-top: 1em; 257} 258 259.references h2 { 260 font-size: 1.3em; 261 margin-bottom: 1em; 262} 263 264.reference { 265 margin-bottom: 0.8em; 266 font-size: 0.9em; 267} 268 269/* Page breaks */ 270h1, h2, h3 { 271 page-break-after: avoid; 272} 273 274table, figure {
275 page-break-inside: avoid; 276} 277`);const r=await m.generateAsync({type:"blob",mimeType:"application/epub+zip"}),i=`${((h=a.authors[0])==null?void 0:h.surname)||"article"}-${a.year||"unknown"}.epub`;kr.saveAs(r,i)};function ne(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Jr(a){let m=a.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");return m=m.replace(/style="[^"]*"/gi,""),m=m.replace(/ /g," "),m}const Kr=({currentArticleId:a,keywords:m=[],issueId:d,limit:g=3,compact:b=!1})=>{const[u,S]=j.useState([]),[M,n]=j.useState(!0),t=Ht();j.useEffect(()=>{r()},[a,m,d,g]);const r=async()=>{try{let c=L.from("articles").select("id, title, authors, abstract, keywords, doi, custom_url, published_date, metadata").neq("id",a);if(d){const{data:C}=await c.eq("issue_id",d).limit(g);if(C&&C.length>0){S(C),n(!1);return}}if(m.length>0){const{data:C}=await c.overlaps("keywords",m).limit(g);if(C&&C.length>0){S(C),n(!1);return}}const{data:w}=await c.order("published_date",{ascending:!1}).limit(g);S(w||[])}catch(c){console.error("Error fetching related articles:",c),S([])}finally{n(!1)}},i=c=>{t(fe(c)),window.scrollTo({top:0,behavior:"smooth"})},h=c=>c.name?c.name:c.givenNames&&c.surname?`${c.givenNames} ${c.surname}`:c.surname||"Unknown Author",p=c=>!c||c.length===0?"Unknown Authors":c.slice(0,3).map(h).join(", ")+(c.length>3?" et al.":"");return M?b?e.jsx(ea,{type:"single",collapsible:!0,defaultValue:"related",children:e.jsxs(ta,{value:"related",className:"border-border",children:[e.jsx(sa,{className:"px-4 py-3 text-sm font-semibold hover:no-underline",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4"}),"Related Articles"]})}),e.jsx(aa,{className:"px-4 pb-3 space-y-2",children:Array.from({length:g}).map((c,w)=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(Ye,{className:"h-4 w-full"}),e.jsx(Ye,{className:"h-3 w-2/3"})]},w))})]})}):e.jsxs("section",{className:"mb-12",children:[e.jsx("h2",{className:"text-2xl font-bold mb-6 text-foreground",children:"Related Articles"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:Array.from({length:g}).map((c,w)=>e.jsxs($t,{className:"h-full",children:[e.jsxs(Vs,{children:[e.jsx(Ye,{className:"h-6 w-full mb-2"}),e.jsx(Ye,{className:"h-4 w-3/4"})]}),e.jsx(Rt,{children:e.jsx(Ye,{className:"h-16 w-full"})})]},w))})]}):u.length===0?null:b?e.jsx(ea,{type:"single",collapsible:!0,defaultValue:"related",children:e.jsxs(ta,{value:"related",className:"border-border",children:[e.jsx(sa,{className:"px-4 py-3 text-sm font-semibold hover:no-underline",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4"}),"Related Articles"]})}),e.jsx(aa,{className:"px-4 pb-3 space-y-3",children:u.map(c=>e.jsxs("div",{className:"group cursor-pointer hover:bg-accent/50 p-2 rounded-md transition-colors",onClick:()=>i(c),children:[e.jsx("h4",{className:"text-sm font-medium line-clamp-2 group-hover:text-primary transition-colors mb-1",children:c.title}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:p(c.authors)})]},c.id))})]})}):e.jsxs("section",{className:"mb-12",children:[e.jsx("h2",{className:"text-2xl font-bold mb-6 text-foreground",children:"Readers Also Viewed"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:u.map(c=>e.jsxs($t,{className:"group h-full transition-all duration-300 hover:shadow-lg cursor-pointer border-border hover:border-primary/20",onClick:()=>i(c),children:[e.jsxs(Vs,{children:[e.jsx("div",{className:"flex items-start justify-between gap-2 mb-2",children:c.keywords&&c.keywords.length>0&&e.jsx(de,{variant:"secondary",className:"text-xs",children:c.keywords[0]})}),e.jsx(lr,{className:"text-base group-hover:text-primary transition-colors line-clamp-2",children:c.title}),e.jsxs(cr,{className:"flex items-center gap-2 text-xs",children:[e.jsx(da,{className:"h-3 w-3"}),p(c.authors)]})]}),e.jsxs(Rt,{children:[e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3 mb-3",children:c.abstract}),c.published_date&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Ke,{className:"h-3 w-3"}),e.jsx("span",{children:new Date(c.published_date).toLocaleDateString()})]})]})]},c.id))})]})},en=()=>{const[a,m]=j.useState(0);return j.useEffect(()=>{const d=()=>{const g=window.scrollY,b=document.documentElement.scrollHeight-window.innerHeight,u=g/b*100;m(Math.min(u,100))};return window.addEventListener("scroll",d),d(),()=>window.removeEventListener("scroll",d)},[]),e.jsx("div",{className:"fixed bottom-0 left-0 w-full z-50 h-1",children:e.jsx($r,{value:a,className:"h-1 rounded-none"})})},la=({sections:a})=>{const[m,d]=j.useState("");j.useEffect(()=>{const b=new IntersectionObserver(S=>
277{S.forEach(M=>{M.isIntersecting&&d(M.target.id)})},{rootMargin:"-20% 0px -35% 0px",threshold:0});return document.querySelectorAll("article h2[id]").forEach(S=>b.observe(S)),()=>b.disconnect()},[a]);const g=b=>{const u=b.toLowerCase().replace(/\s+/g,"-"),S=document.getElementById(u);if(S){const n=S.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:n-80,behavior:"smooth"})}};return e.jsxs("div",{className:"border border-border rounded-none",children:[e.jsx("div",{className:"px-4 py-3 text-sm font-semibold border-b border-border",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ir,{className:"h-4 w-4"}),"Contents"]})}),e.jsx("nav",{className:"space-y-0.5 px-4 py-3",children:a.map((b,u)=>{const S=b.title.toLowerCase().replace(/\s+/g,"-");return e.jsx("button",{onClick:()=>g(b.title),className:q("w-full text-left text-sm py-2.5 px-3 transition-all flex items-start gap-2 group",m===S?"bg-primary text-primary-foreground font-semibold":"text-muted-foreground hover:bg-secondary/50 hover:text-foreground"),children:e.jsx("span",{className:"flex-1 leading-snug",children:b.title})},b.title)})})]})},tn=({currentArticle:a,maxArticles:m=4})=>{const[d,g]=j.useState([]),[b,u]=j.useState(!0),S=Ht();j.useEffect(()=>{a&&M()},[a]);const M=async()=>{try{const t=a.keywords||[],r=t.map(p=>p.toLowerCase());let i=[];if(t.length>0){const{data:p,error:c}=await L.from("articles").select("id, title, authors, abstract, keywords, doi, custom_url, published_date, issue_id, metadata").overlaps("keywords",t).neq("id",a.id).limit(20);if(c)throw c;i=p||[]}if(i.length<m&&a.issue_id){const{data:p}=await L.from("articles").select("id, title, authors, abstract, keywords, doi, custom_url, published_date, issue_id, metadata").eq("issue_id",a.issue_id).neq("id",a.id).limit(10);if(p){const c=new Set(i.map(w=>w.id));for(const w of p)c.has(w.id)||i.push(w)}}const h=i.map(p=>{const c=(p.keywords||[]).map(_=>_.toLowerCase()),w=r.filter(_=>c.includes(_));let C=w.length*10;if(p.issue_id===a.issue_id&&(C+=5),p.published_date){const _=new Date(p.published_date),$=new Date;$.setFullYear($.getFullYear()-2),_>$&&(C+=2)}return{article:p,score:C,matchingKeywords:w.map(_=>t.find($=>$.toLowerCase()===_)||_)}});h.sort((p,c)=>c.score-p.score),g(h.slice(0,m))}catch(t){console.error("Error fetching similar articles:",t)}finally{u(!1)}},n=t=>!t||t.length===0?"Unknown Author":t.map(r=>`${r.givenNames||""} ${r.surname||""}`.trim()).join(", ");return b||d.length===0?null:e.jsxs("section",{className:"mt-12 border-t border-border/50 pt-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Ft,{className:"h-5 w-5 text-primary"}),e.jsx("h2",{className:"text-3xl font-bold",children:"Recommended For You"})]}),e.jsx("p",{className:"text-muted-foreground",children:"Articles matching your interests based on keywords"})]}),e.jsx("div",{className:"grid md:grid-cols-2 gap-6",children:d.map(({article:t,matchingKeywords:r})=>e.jsx($t,{className:"group cursor-pointer hover:border-primary/50 hover:shadow-lg transition-all duration-300 overflow-hidden border-border/50 bg-gradient-to-br from-card to-card/50",onClick:()=>S(fe(t)),children:e.jsxs(Rt,{className:"p-6",children:[r.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-primary mb-3",children:[e.jsx(Ft,{className:"h-3 w-3"}),e.jsxs("span",{children:[r.length," matching keyword",r.length>1?"s":""]})]}),e.jsx("h3",{className:"text-lg font-semibold mb-3 line-clamp-2 group-hover:text-primary transition-colors",children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-sm text-muted-foreground mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(da,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"line-clamp-1",children:n(t.authors)})]}),t.published_date&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Ke,{className:"h-3.5 w-3.5"}),new Date(t.published_date).toLocaleDateString()]})]}),t.abstract&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3 mb-4 leading-relaxed",children:t.abstract.replace(/<[^>]*>/g,"")}),r.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mb-4",children:r.slice(0,3).map((i,h)=>e.jsx(de,{className:"text-xs bg-primary/10 text-primary border-primary/20",children:i},h))}),e.jsxs("div",{className:"flex items-center text-sm text-primary font-medium group-hover:gap-2 transition-all",children:["Read article",e.jsx(dr,{className:"h-4 w-4 ml-1 group-hover:translate-x-1 transition-transform"})]})]})},t.id))})]})},sn=({onModeChange:a})=>{const[m,d]=j.useState(()=>localStorage.getItem("readingMode")||"default");j.useEffect(()=>{localStorage.setItem("readingMode",m),a==null||a(m);const b=document.querySelector(".article-reading-area");b&&(b.classList.remove("reading-mode-dark","reading-mode-sepia"),m==="dark"?b.classList.add("reading-mode-dark"):m==="sepia"&&b.classList.add("reading-mode-sepia"))},[m,a]);const g=[{id:"default",label:"Light",icon:Wr,bgClass:"bg-background border-border",textClass:"text-foreground"},{id:"dark",label:"Dark",icon:Qr,bgClass:"bg-slate-900 border-slate-700",textClass:"text-slate-100"},{id:"sepia",label:"Sepia",icon:me,bgClass:"bg-amber-50 border-amber-200",textClass:"text-amber-900"}];return e.jsx("div",{className:"flex items-center gap-1 p-1 bg-muted/50 rounded-lg border border-border/30",children:g.map(b=>{const u=b.icon;return e.jsx("button",{onClick:()=>d(b.id),title:b.label,className:q("p-2 rounded-md transition-all",m===b.id?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:e.jsx(u,{className:"h-4 w-4"})},b.id)})})},an=({content:a,abstract:m,wordsPerMinute:d=200})=>{const g=t=>{const r=document.createElement("div");return r.innerHTML=t,r.textContent||r.innerText||""},b=g(a),M=`${g(m)} ${b}`.trim().split(/\s+/).filter(t=>t.length>0).length,n=Math.max(1,Math.ceil(M/d));return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 py-4 px-4 mb-6 bg-muted/30 rounded-lg border border-border/30",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Rr,{className:"h-4 w-4"}),e.jsxs("span",{children:[n," min read"]})]}),e.jsx(sn,{})]})},rn=({sections:a,isVisible:m=!0})=>{const[d,g]=j.useState(""),[b,u]=j.useState(!1),[S,M]=j.useState(!1),[n,t]=j.useState(!1),[r,i]=j.useState(0),[h,p]=j.useState(!0),c=b||S;j.useEffect(()=>{if(a.length>0&&!d){const y=a[0].title.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");g(y)}},[a,d]),j.useEffect(()=>{const y=setTimeout(()=>{const R=new IntersectionObserver(v=>{const I=v.filter(H=>H.isIntersecting);if(I.length>0){const Y=I.reduce((O,be)=>O.boundingClientRect.top<be.boundingClientRect.top?O:be).target;g(Y.id),document.querySelectorAll(".scrollspy-heading-active").forEach(O=>{O.classList.remove("scrollspy-heading-active")}),Y.classList.add("scrollspy-heading-active","scrollspy-heading-pulse"),document.querySelectorAll(".scrollspy-active").forEach(O=>{O.classList.remove("scrollspy-active","scrollspy-entering")});const ee=Y.closest("section")||Y.parentElement;ee&&ee.classList.add("scrollspy-section","scrollspy-active","scrollspy-entering"),setTimeout(()=>{Y.classList.remove("scrollspy-heading-pulse")},2e3)}},{rootMargin:"-10% 0px -70% 0px",threshold:[0,.25,.5,.75,1]}),k=document.querySelectorAll("article h2[id], section h2[id], .prose h2[id]");
277return k.forEach(v=>{v.classList.add("scrollspy-heading-highlight"),R.observe(v)}),()=>{R.disconnect(),k.forEach(v=>{v.classList.remove("scrollspy-heading-highlight","scrollspy-heading-active","scrollspy-heading-pulse");const I=v.closest("section")||v.parentElement;I&&I.classList.remove("scrollspy-section","scrollspy-active","scrollspy-entering")})}},100);return()=>clearTimeout(y)},[a]),j.useEffect(()=>{const y=()=>{const R=window.scrollY,k=document.documentElement.scrollHeight-window.innerHeight,v=R/k*100;i(Math.min(100,Math.max(0,v))),p(R<200)};return y(),window.addEventListener("scroll",y),()=>window.removeEventListener("scroll",y)},[]);const w=y=>{const R=y.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""),k=document.getElementById(R);if(k){const I=k.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:I-100,behavior:"smooth"})}},C=a.findIndex(y=>y.title.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")===d),_=()=>{C>0&&w(a[C-1].title)},$=()=>{C<a.length-1&&w(a[C+1].title)};return!m||a.length===0||h?null:n?e.jsx("div",{className:"fixed left-3 top-1/2 -translate-y-1/2 z-40",children:e.jsx(N,{variant:"outline",size:"icon",onClick:()=>t(!1),className:"h-9 w-9 shadow-md bg-background hover:bg-primary hover:text-primary-foreground transition-colors",children:e.jsx(me,{className:"h-4 w-4"})})}):e.jsx("div",{className:q("fixed left-3 top-1/2 -translate-y-1/2 z-40 transition-all duration-200",c?"w-56":"w-10"),onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),children:e.jsxs("div",{className:"bg-background/98 backdrop-blur-sm border border-border rounded-lg shadow-lg overflow-hidden",children:[e.jsx("div",{className:"h-1 bg-muted/50",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-200",style:{width:`${r}%`}})}),!c&&e.jsxs("div",{className:"flex flex-col items-center py-2 gap-1",children:[e.jsx(N,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:_,disabled:C<=0,children:e.jsx(zr,{className:"h-3 w-3"})}),e.jsx(N,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:$,disabled:C>=a.length-1,children:e.jsx(mr,{className:"h-3 w-3"})})]}),c&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-border/50 bg-muted/20",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(me,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:"Contents"})]}),e.jsx(N,{variant:"ghost",size:"icon",className:"h-5 w-5 hover:bg-destructive/10 hover:text-destructive",onClick:()=>t(!0),children:e.jsx(X,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"max-h-[50vh] overflow-y-auto",children:e.jsx("nav",{className:"p-1.5 space-y-0.5",children:a.map((y,R)=>{const v=y.title.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")===d;return e.jsx("button",{onClick:()=>w(y.title),className:q("w-full text-left py-1.5 px-2 rounded text-xs transition-colors",v?"bg-primary text-primary-foreground font-medium":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:e.jsx("span",{className:"truncate",children:y.title})},y.title)})})})]})]})})},nn=({figures:a,tables:m,isOpen:d,onClose:g,initialTab:b="figures",initialIndex:u=0})=>{const[S,M]=j.useState(b),[n,t]=j.useState(u),[r,i]=j.useState(1),[h,p]=j.useState(!0),c=S==="figures"?a:m,w=c[n];j.useEffect(()=>{d&&(M(b),t(u),i(1))},[d,b,u]);const C=j.useCallback(()=>{t(v=>v>0?v-1:c.length-1),i(1)},[c.length]),_=j.useCallback(()=>{t(v=>v<c.length-1?v+1:0),i(1)},[c.length]);j.useEffect(()=>{if(!d)return;const v=I=>{I.key==="ArrowLeft"&&C(),I.key==="ArrowRight"&&_(),I.key==="Escape"&&g(),(I.key==="+"||I.key==="=")&&i(H=>Math.min(3,H+.25)),I.key==="-"&&i(H=>Math.max(.5,H-.25))};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[d,C,_,g]);const $=v=>{M(v),t(0),i(1)},y=()=>i(v=>Math.min(3,v+.25)),R=()=>i(v=>Math.max(.5,v-.25)),k=()=>{if(S==="figures"&&w){const v=document.createElement("a");v.href=w.imageUrl,v.download=`${w.label.replace(/\s+/g,"_")}.jpg`,v.click()}};
277return d?e.jsx(Dt,{open:d,onOpenChange:g,children:e.jsx(Tt,{className:"max-w-[95vw] max-h-[95vh] w-full h-full p-0 gap-0",children:e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(zt,{value:S,onValueChange:$,children:e.jsxs(Lt,{children:[e.jsxs(Se,{value:"figures",className:"gap-2",children:[e.jsx(je,{className:"h-4 w-4"}),"Figures (",a.length,")"]}),e.jsxs(Se,{value:"tables",className:"gap-2",children:[e.jsx(oa,{className:"h-4 w-4"}),"Tables (",m.length,")"]})]})}),c.length>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:[n+1," of ",c.length]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[S==="figures"&&e.jsxs(e.Fragment,{children:[e.jsx(N,{variant:"outline",size:"icon",onClick:R,disabled:r<=.5,children:e.jsx(Or,{className:"h-4 w-4"})}),e.jsxs("span",{className:"text-sm w-16 text-center",children:[Math.round(r*100),"%"]}),e.jsx(N,{variant:"outline",size:"icon",onClick:y,disabled:r>=3,children:e.jsx(Ur,{className:"h-4 w-4"})}),e.jsx(N,{variant:"outline",size:"icon",onClick:k,children:e.jsx(hr,{className:"h-4 w-4"})})]}),e.jsx(N,{variant:"outline",size:"icon",onClick:()=>p(!h),children:e.jsx(Vr,{className:"h-4 w-4"})}),e.jsx(N,{variant:"ghost",size:"icon",onClick:g,children:e.jsx(X,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx("div",{className:"flex-1 relative flex items-center justify-center p-8 bg-muted/30",children:c.length===0?e.jsxs("div",{className:"text-center text-muted-foreground",children:[e.jsx(je,{className:"h-16 w-16 mx-auto mb-4 opacity-50"}),e.jsxs("p",{children:["No ",S," available"]})]}):e.jsxs(e.Fragment,{children:[c.length>1&&e.jsxs(e.Fragment,{children:[e.jsx(N,{variant:"outline",size:"icon",className:"absolute left-4 top-1/2 -translate-y-1/2 z-10 h-12 w-12 rounded-full shadow-lg",onClick:C,children:e.jsx(Ot,{className:"h-6 w-6"})}),e.jsx(N,{variant:"outline",size:"icon",className:"absolute right-4 top-1/2 -translate-y-1/2 z-10 h-12 w-12 rounded-full shadow-lg",onClick:_,children:e.jsx(ot,{className:"h-6 w-6"})})]}),e.jsx("div",{className:"max-w-full max-h-full overflow-auto",children:S==="figures"?e.jsx("img",{src:w==null?void 0:w.imageUrl,alt:w==null?void 0:w.label,style:{transform:`scale(${r})`,transformOrigin:"center"},className:"max-w-full max-h-[60vh] object-contain transition-transform duration-200"}):e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert p-4 bg-background rounded-lg border",style:{transform:`scale(${r})`,transformOrigin:"top left"},dangerouslySetInnerHTML:{__html:(w==null?void 0:w.html)||""}})})]})}),h&&c.length>0&&e.jsx("div",{className:"w-48 border-l border-border bg-background",children:e.jsx(Lr,{className:"h-full",children:e.jsx("div",{className:"p-2 space-y-2",children:c.map((v,I)=>e.jsxs("button",{onClick:()=>{t(I),i(1)},className:q("w-full p-2 rounded-lg border transition-all",I===n?"border-primary bg-primary/10":"border-transparent hover:bg-muted"),children:[S==="figures"?e.jsx("img",{src:v.imageUrl,alt:v.label,className:"w-full h-20 object-cover rounded"}):e.jsx("div",{className:"h-20 flex items-center justify-center bg-muted rounded",children:e.jsx(oa,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("p",{className:"text-xs font-medium mt-1 truncate",children:v.label})]},v.id||I))})})})]}),w&&e.jsxs("div",{className:"p-4 border-t border-border bg-muted/30",children:[e.jsx("p",{className:"font-semibold text-sm",children:w.label}),w.caption&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:w.caption})]})]})})}):null};function on({articleId:a,onLanguageChange:m,currentLanguage:d}){const{data:g=[]}=Br({queryKey:["article-translations",a],queryFn:async()=>{const{data:u,error:S}=await L.from("article_translations").select("*").eq("article_id",a).order("language_name");if(S)throw S;return u}});if(g.length===0)return null;const b=g.find(u=>u.language_code===d);return e.jsxs(ur,{children:[e.jsx(pr,{asChild:!0,children:e.jsxs(N,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(xr,{className:"h-4 w-4"}),d==="original"?"Original":(b==null?void 0:b.language_name)||"Select Language"]})}),e.jsxs(gr,{align:"end",children:[e.jsxs(Ys,{onClick:()=>m(null),className:"flex items-center justify-between",children:[e.jsx("span",{children:"Original"}),d==="original"&&e.jsx(W,{className:"h-4 w-4 ml-2"})]}),g.map(u=>e.jsxs(Ys,{onClick:()=>m(u),className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:u.language_name}),u.is_machine_translated&&e.jsx(de,{variant:"secondary",className:"text-xs",children:"MT"})]}),d===u.language_code&&e.jsx(W,{className:"h-4 w-4 ml-2"})]},u.id))]})]})}const ln=({article:a,journalName:m,articleUrl:d,translations:g=[]})=>{const b=j.useMemo(()=>{var _,$,y,R,k;const u=a.metadata||{},S=a.authors||[],M=v=>
277v.name?v.name:v.givenNames&&v.surname?`${v.givenNames} ${v.surname}`:v.surname||"Unknown Author",n=v=>{if(!v)return u.first_page;const I=v.match(/^(\d+)/);return I?I[1]:void 0},t=v=>{if(!v)return u.last_page;const I=v.match(/-(\d+)$/);return I?I[1]:void 0},r=S.map(v=>{const I={"@type":"Person",name:M(v)};return v.email&&(I.email=v.email),v.affiliation&&(I.affiliation={"@type":"Organization",name:v.affiliation.replace(/^(\d+(?:,\s*\d+)*)\s*/,"").trim()}),v.orcid&&(I.identifier={"@type":"PropertyValue",propertyID:"ORCID",value:v.orcid}),I}),i={"@context":"https://schema.org","@type":"ScholarlyArticle","@id":a.doi?`https://doi.org/${a.doi}`:d,headline:a.title,name:a.title,abstract:a.abstract||void 0,description:((_=a.abstract)==null?void 0:_.substring(0,300))||void 0,author:r,datePublished:a.published_date||void 0,dateModified:a.revised_date||a.published_date||void 0,dateCreated:(($=u.history)==null?void 0:$.received)||void 0,publisher:{"@type":"Organization",name:m,logo:void 0},isPartOf:{"@type":"PublicationIssue",issueNumber:u.issue||void 0,isPartOf:{"@type":"PublicationVolume",volumeNumber:u.volume||void 0,isPartOf:{"@type":"Periodical","@id":`${window.location.origin}`,name:m,issn:u.issn||void 0,publisher:{"@type":"Organization",name:u.publisher||m}}}},url:d,mainEntityOfPage:{"@type":"WebPage","@id":d},inLanguage:"en",keywords:a.keywords||void 0,wordCount:a.abstract?a.abstract.split(/\s+/).length:void 0,articleSection:u.articleType||"Research Article",pageStart:n(u.pages),pageEnd:t(u.pages),pagination:u.pages||void 0};a.doi&&(i.identifier=[{"@type":"PropertyValue",propertyID:"DOI",value:a.doi}],i.sameAs=[`https://doi.org/${a.doi}`]),a.featured_image_url&&(i.image=a.featured_image_url,i.thumbnailUrl=a.featured_image_url);const h=a.pdf_url?`${d.replace(/\/$/,"")}.pdf`:void 0;if(h){const v={"@type":"MediaObject","@id":h,contentUrl:h,url:h,encodingFormat:"application/pdf",name:`${a.title} (PDF)`};i.encoding=v,i.associatedMedia=v,i.workExample={"@type":"CreativeWork","@id":h,url:h,encodingFormat:"application/pdf",inLanguage:"en"}}(a.google_scholar_citations||a.scopus_citations)&&(i.interactionStatistic=[],a.google_scholar_citations&&i.interactionStatistic.push({"@type":"InteractionCounter",interactionType:"https://schema.org/CiteAction",userInteractionCount:a.google_scholar_citations,description:"Google Scholar citations"})),((y=u.funding)!=null&&y.grants||(R=u.funding)!=null&&R.acknowledgment)&&(i.funder={"@type":"Organization",name:u.funding.grants||u.funding.acknowledgment}),(u.licenseUrl||u.license)&&(i.license=u.licenseUrl||u.license,i.isAccessibleForFree=!0),u.copyright&&(i.copyrightHolder={"@type":"Person",name:u.copyright.replace(/^©\d{4}\s*/,"")},i.copyrightYear=a.published_date?new Date(a.published_date).getFullYear():void 0),g.length>0&&(i.workTranslation=g.filter(v=>v.title||v.abstract).map(v=>({"@type":"ScholarlyArticle",inLanguage:v.language,headline:v.title||a.title,abstract:v.abstract||a.abstract})));const p={"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:window.location.origin},{"@type":"ListItem",position:2,name:"Archives",item:`${window.location.origin}/archives`},u.volume&&{"@type":"ListItem",position:3,name:`Volume ${u.volume}`,item:`${window.location.origin}/archives`},{"@type":"ListItem",position:u.volume?4:3,name:a.title.substring(0,50)+(a.title.length>50?"...":""),item:d}].filter(Boolean)},c=[];
277a.abstract&&[{key:"Background",pattern:/(?:Background|Introduction)[:\s]*([^]*?)(?=(?:Methods|Results|Conclusions?|$))/i},{key:"Methods",pattern:/(?:Methods?|Materials and Methods)[:\s]*([^]*?)(?=(?:Results|Conclusions?|$))/i},{key:"Results",pattern:/Results[:\s]*([^]*?)(?=(?:Conclusions?|Discussion|$))/i},{key:"Conclusions",pattern:/(?:Conclusions?|Discussion)[:\s]*([^]*?)$/i}].forEach(({key:I,pattern:H})=>{var ee,O;const Y=(ee=a.abstract)==null?void 0:ee.match(H);Y&&((O=Y[1])!=null&&O.trim())&&c.push({question:`What are the ${I.toLowerCase()} of this study?`,answer:Y[1].trim()})});const w=c.length>0?{"@context":"https://schema.org","@type":"FAQPage",mainEntity:c.map(v=>({"@type":"Question",name:v.question,acceptedAnswer:{"@type":"Answer",text:v.answer}}))}:null,C={"@context":"https://schema.org","@type":"WebPage","@id":d,url:d,name:a.title,description:((k=a.abstract)==null?void 0:k.substring(0,160))||void 0,isPartOf:{"@type":"WebSite","@id":window.location.origin,name:m,url:window.location.origin},about:{"@id":a.doi?`https://doi.org/${a.doi}`:d},primaryImageOfPage:a.featured_image_url?{"@type":"ImageObject",url:a.featured_image_url}:void 0,datePublished:a.published_date||void 0,dateModified:a.revised_date||a.published_date||void 0,inLanguage:"en",potentialAction:[{"@type":"ReadAction",target:d},h&&{"@type":"DownloadAction",target:h}].filter(Boolean)};return{mainSchema:i,breadcrumbSchema:p,faqSchema:w,webPageSchema:C}},[a,m,d,g]);return e.jsxs(e.Fragment,{children:[e.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(b.mainSchema)}}),e.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(b.breadcrumbSchema)}}),e.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(b.webPageSchema)}}),b.faqSchema&&e.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(b.faqSchema)}})]})},cn=({title:a,doi:m})=>{const{settings:d}=ma(),g=j.useRef(null),b=j.useRef(!1);return j.useEffect(()=>{const S=d==null?void 0:d.trendmd_code;if(!S||!g.current||b.current)return;const M=g.current;M.innerHTML="";const n=document.createElement("div");n.innerHTML=S;const t=Array.from(n.querySelectorAll("script")),r=t.filter(_=>!!_.getAttribute("src")),i=t.filter(_=>!_.getAttribute("src")&&!!_.innerHTML.trim()),h=document.createElement("div");Array.from(n.childNodes).forEach(_=>{_.nodeName!=="SCRIPT"&&h.appendChild(_.cloneNode(!0))}),M.appendChild(h);const p=[];let c=!1;const w=_=>{const $=_.getAttribute("src");return document.querySelector(`script[src="${$}"]`)?Promise.resolve():new Promise((R,k)=>{const v=document.createElement("script");Array.from(_.attributes).forEach(I=>v.setAttribute(I.name,I.value)),v.onload=()=>R(),v.onerror=()=>k(new Error(`Failed to load script: ${$}`)),document.body.appendChild(v),p.push(v)})};return(async()=>{try{for(const $ of r)if(await w($),c)return;if(!(typeof window.TrendMDWidget<"u")&&i.length>0){console.warn("TrendMDWidget not found after loading scripts; skipping inline init."),b.current=!0;return}for(const $ of i){if(c)return;const y=document.createElement("script");Array.from($.attributes).forEach(R=>y.setAttribute(R.name,R.value)),y.text=`try { 278${$.innerHTML} 279} catch (e) { console.warn('TrendMD inline script failed', e); }`,document.body.appendChild(y),p.push(y)}b.current=!0}catch(_){console.warn("TrendMD embed failed to initialize",_)}})(),()=>{c=!0,p.forEach(_=>_.remove())}},[d]),(d==null?void 0:d.trendmd_code)?e.jsx("section",{className:"mt-8 not-prose",children:e.jsx("div",{ref:g,className:"trendmd-container bg-muted/20 rounded-lg border border-border/50 p-6"})}):null};var dn=Object.defineProperty,lt=Object.getOwnPropertySymbols,ua=Object.prototype.hasOwnProperty,pa=Object.prototype.propertyIsEnumerable,ca=(a,m,d)=>m in a?dn(a,m,{enumerable:!0,configurable:!0,writable:!0,value:d}):a[m]=d,Ut=(a,m)=>{for(var d in m||(m={}))ua.call(m,d)&&ca(a,d,m[d]);if(lt)for(var d of lt(m))pa.call(m,d)&&ca(a,d,m[d]);return a},Bt=(a,m)=>{var d={};for(var g in a)ua.call(a,g)&&m.indexOf(g)<0&&(d[g]=a[g]);if(a!=null&<)for(var g of lt(a))m.indexOf(g)<0&&pa.call(a,g)&&(d[g]=a[g]);return d};/** 280 * @license QR Code generator library (TypeScript) 281 * Copyright (c) Project Nayuki. 282 * SPDX-License-Identifier: MIT 283 */var Ae;(a=>{const m=class T{constructor(n,t,r,i){if(this.version=n,this.errorCorrectionLevel=t,this.modules=[],this.isFunction=[],n<T.MIN_VERSION||n>T.MAX_VERSION)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=n*4+17;let h=[];for(let c=0;c<this.size;c++)h.push(!1);for(let c=0;c<this.size;c++)this.modules.push(h.slice()),this.isFunction.push(h.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(r);if(this.drawCodewords(p),i==-1){let c=1e9;for(let w=0;w<8;w++){this.applyMask(w),this.drawFormatBits(w);const C=this.getPenaltyScore();C<c&&(i=w,c=C),this.applyMask(w)}}b(0<=i&&i<=7),this.mask=i,this.applyMask(i),this.drawFormatBits(i),this.isFunction=[]}static encodeText(n,t){const r=a.QrSegment.makeSegments(n);return T.encodeSegments(r,t)}static encodeBinary(n,t){const r=a.QrSegment.makeBytes(n);return T.encodeSegments([r],t)}static encodeSegments(n,t,r=1,i=40,h=-1,p=!0){if(!(T.MIN_VERSION<=r&&r<=i&&i<=T.MAX_VERSION)||h<-1||h>7)throw new RangeError("Invalid value");let c,w;for(c=r;;c++){const y=T.getNumDataCodewords(c,t)*8,R=S.getTotalBits(n,c);if(R<=y){w=R;break}if(c>=i)throw new RangeError("Data too long")}for(const y of[T.Ecc.MEDIUM,T.Ecc.QUARTILE,T.Ecc.HIGH])p&&w<=T.getNumDataCodewords(c,y)*8&&(t=y);let C=[];for(const y of n){d(y.mode.modeBits,4,C),d(y.numChars,y.mode.numCharCountBits(c),C);for(const R of y.getData())C.push(R)}b(C.length==w);const _=T.getNumDataCodewords(c,t)*8;b(C.length<=_),d(0,Math.min(4,_-C.length),C),d(0,(8-C.length%8)%8,C),b(C.length%8==0);for(let y=236;C.length<_;y^=253)d(y,8,C);let $=[];for(;$.length*8<C.length;)$.push(0);
283return C.forEach((y,R)=>$[R>>>3]|=y<<7-(R&7)),new T(c,t,$,h)}getModule(n,t){return 0<=n&&n<this.size&&0<=t&&t<this.size&&this.modules[t][n]}getModules(){return this.modules}drawFunctionPatterns(){for(let r=0;r<this.size;r++)this.setFunctionModule(6,r,r%2==0),this.setFunctionModule(r,6,r%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const n=this.getAlignmentPatternPositions(),t=n.length;for(let r=0;r<t;r++)for(let i=0;i<t;i++)r==0&&i==0||r==0&&i==t-1||r==t-1&&i==0||this.drawAlignmentPattern(n[r],n[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(n){const t=this.errorCorrectionLevel.formatBits<<3|n;let r=t;for(let h=0;h<10;h++)r=r<<1^(r>>>9)*1335;const i=(t<<10|r)^21522;b(i>>>15==0);for(let h=0;h<=5;h++)this.setFunctionModule(8,h,g(i,h));this.setFunctionModule(8,7,g(i,6)),this.setFunctionModule(8,8,g(i,7)),this.setFunctionModule(7,8,g(i,8));for(let h=9;h<15;h++)this.setFunctionModule(14-h,8,g(i,h));for(let h=0;h<8;h++)this.setFunctionModule(this.size-1-h,8,g(i,h));for(let h=8;h<15;h++)this.setFunctionModule(8,this.size-15+h,g(i,h));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let n=this.version;for(let r=0;r<12;r++)n=n<<1^(n>>>11)*7973;const t=this.version<<12|n;b(t>>>18==0);for(let r=0;r<18;r++){const i=g(t,r),h=this.size-11+r%3,p=Math.floor(r/3);this.setFunctionModule(h,p,i),this.setFunctionModule(p,h,i)}}drawFinderPattern(n,t){for(let r=-4;r<=4;r++)for(let i=-4;i<=4;i++){const h=Math.max(Math.abs(i),Math.abs(r)),p=n+i,c=t+r;0<=p&&p<this.size&&0<=c&&c<this.size&&this.setFunctionModule(p,c,h!=2&&h!=4)}}drawAlignmentPattern(n,t){for(let r=-2;r<=2;r++)for(let i=-2;i<=2;i++)this.setFunctionModule(n+i,t+r,Math.max(Math.abs(i),Math.abs(r))!=1)}setFunctionModule(n,t,r){this.modules[t][n]=r,this.isFunction[t][n]=!0}addEccAndInterleave(n){const t=this.version,r=this.errorCorrectionLevel;if(n.length!=T.getNumDataCodewords(t,r))throw new RangeError("Invalid argument");const i=T.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][t],h=T.ECC_CODEWORDS_PER_BLOCK[r.ordinal][t],p=Math.floor(T.getNumRawDataModules(t)/8),c=i-p%i,w=Math.floor(p/i);let C=[];const _=T.reedSolomonComputeDivisor(h);for(let y=0,R=0;y<i;y++){let k=n.slice(R,R+w-h+(y<c?0:1));R+=k.length;const v=T.reedSolomonComputeRemainder(k,_);y<c&&k.push(0),C.push(k.concat(v))}let $=[];for(let y=0;y<C[0].length;y++)C.forEach((R,k)=>{(y!=w-h||k>=c)&&$.push(R[y])});return b($.length==p),$}drawCodewords(n){if(n.length!=Math.floor(T.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let t=0;for(let r=this.size-1;r>=1;r-=2){r==6&&(r=5);for(let i=0;i<this.size;i++)for(let h=0;h<2;h++){const p=r-h,w=(r+1&2)==0?this.size-1-i:i;!this.isFunction[w][p]&&t<n.length*8&&(this.modules[w][p]=g(n[t>>>3],7-(t&7)),t++)}}b(t==n.length*8)}applyMask(n){if(n<0||n>7)throw new RangeError("Mask value out of range");for(let t=0;t<this.size;t++)for(let r=0;r<this.size;r++){let i;switch(n){case 0:i=(r+t)%2==0;break;case 1:i=t%2==0;break;case 2:i=r%3==0;break;case 3:i=(r+t)%3==0;break;case 4:i=(Math.floor(r/3)+Math.floor(t/2))%2==0;break;case 5:i=r*t%2+r*t%3==0;break;case 6:i=(r*t%2+r*t%3)%2==0;break;case 7:i=((r+t)%2+r*t%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[t][r]&&i&&(this.modules[t][r]=!this.modules[t][r])}}getPenaltyScore(){let n=0;for(let h=0;h<this.size;h++){let p=!1,c=0,w=[0,0,0,0,0,0,0];for(let C=0;C<this.size;C++)this.modules[h][C]==p?(c++,c==5?n+=T.PENALTY_N1:c>5&&n++):(this.finderPenaltyAddHistory(c,w),p||(n+=this.finderPenaltyCountPatterns(w)*T.PENALTY_N3),p=this.modules[h][C],c=1);n+=this.finderPenaltyTerminateAndCount(p,c,w)*T.PENALTY_N3}for(let h=0;h<this.size;h++){let p=!1,c=0,w=[0,0,0,0,0,0,0];for(let C=0;C<this.size;C++)this.modules[C][h]==p?(c++,c==5?n+=T.PENALTY_N1:c>5&&n++):(this.finderPenaltyAddHistory(c,w),p||(n+=this.finderPenaltyCountPatterns(w)*T.PENALTY_N3),p=this.modules[C][h],c=1);n+=this.finderPenaltyTerminateAndCount(p,c,w)*T.PENALTY_N3}for(let h=0;h<this.size-1;h++)for(let p=0;p<this.size-1;p++){const c=this.modules[h][p];c==this.modules[h][p+1]&&c==this.modules[h+1][p]&&c==this.modules[h+1][p+1]&&(n+=T.PENALTY_N2)}let t=0;for(const h of this.modules)t=h.reduce((p,c)=>p+(c?1:0),t);const r=this.size*this.size,i=Math.ceil(Math.abs(t*20-r*10)/r)-1;return b(0<=i&&i<=9),n+=i*T.PENALTY_N4,b(0<=n&&n<=2568888),n}getAlignmentPatternPositions(){if(this.version==1)return[];{const n=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(n*2-2))*2;let r=[6];for(let i=this.size-7;r.length<n;i-=t)r.splice(1,0,i);return r}}static getNumRawDataModules(n){if(n<T.MIN_VERSION||n>T.MAX_VERSION)throw new RangeError("Version number out of range");let t=(16*n+128)*n+64;if(n>=2){const r=Math.floor(n/7)+2;t-=(25*r-10)*r-55,n>=7&&(t-=36)}return b(208<=t&&t<=29648),t}static getNumDataCodewords(n,t){return Math.floor(T.getNumRawDataModules(n)/8)-T.ECC_CODEWORDS_PER_BLOCK[t.ordinal][n]*T.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][n]}static reedSolomonComputeDivisor(n){if(n<1||n>255)throw new RangeError("Degree out of range");let t=[];for(let i=0;i<n-1;i++)t.push(0);t.push(1);let r=1;for(let i=0;i<n;i++){for(let h=0;h<t.length;h++)t[h]=T.reedSolomonMultiply(t[h],r),h+1<t.length&&(t[h]^=t[h+1]);r=T.reedSolomonMultiply(r,2)}return t}static reedSolomonComputeRemainder(n,t){let r=t.map(i=>0);for(const i of n){const h=i^r.shift();r.push(0),t.forEach((p,c)=>r[c]^=T.reedSolomonMultiply(p,h))}return r}static reedSolomonMultiply(n,t){if(n>>>8||t>>>8)throw new RangeError("Byte out of range");let r=0;for(let i=7;i>=0;i--)r=r<<1^(r>>>7)*285,r^=(t>>>i&1)*n;return b(r>>>8==0),r}finderPenaltyCountPatterns(n){const t=n[1];b(t<=this.size*3);const r=t>0&&n[2]==t&&n[3]==t*3&&n[4]==t&&n[5]==t;return(r&&n[0]>=t*4&&n[6]>
283=t?1:0)+(r&&n[6]>=t*4&&n[0]>=t?1:0)}finderPenaltyTerminateAndCount(n,t,r){return n&&(this.finderPenaltyAddHistory(t,r),t=0),t+=this.size,this.finderPenaltyAddHistory(t,r),this.finderPenaltyCountPatterns(r)}finderPenaltyAddHistory(n,t){t[0]==0&&(n+=this.size),t.pop(),t.unshift(n)}};m.MIN_VERSION=1,m.MAX_VERSION=40,m.PENALTY_N1=3,m.PENALTY_N2=3,m.PENALTY_N3=40,m.PENALTY_N4=10,m.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],m.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],a.QrCode=m;function d(M,n,t){if(n<0||n>31||M>>>n)throw new RangeError("Value out of range");for(let r=n-1;r>=0;r--)t.push(M>>>r&1)}function g(M,n){return(M>>>n&1)!=0}function b(M){if(!M)throw new Error("Assertion error")}const u=class U{constructor(n,t,r){if(this.mode=n,this.numChars=t,this.bitData=r,t<0)throw new RangeError("Invalid argument");this.bitData=r.slice()}static makeBytes(n){let t=[];for(const r of n)d(r,8,t);return new U(U.Mode.BYTE,n.length,t)}static makeNumeric(n){if(!U.isNumeric(n))throw new RangeError("String contains non-numeric characters");let t=[];for(let r=0;r<n.length;){const i=Math.min(n.length-r,3);d(parseInt(n.substring(r,r+i),10),i*3+1,t),r+=i}return new U(U.Mode.NUMERIC,n.length,t)}static makeAlphanumeric(n){if(!U.isAlphanumeric(n))throw new RangeError("String contains unencodable characters in alphanumeric mode");let t=[],r;for(r=0;r+2<=n.length;r+=2){let i=U.ALPHANUMERIC_CHARSET.indexOf(n.charAt(r))*45;i+=U.ALPHANUMERIC_CHARSET.indexOf(n.charAt(r+1)),d(i,11,t)}return r<n.length&&d(U.ALPHANUMERIC_CHARSET.indexOf(n.charAt(r)),6,t),new U(U.Mode.ALPHANUMERIC,n.length,t)}static makeSegments(n){return n==""?[]:U.isNumeric(n)?[U.makeNumeric(n)]:U.isAlphanumeric(n)?[U.makeAlphanumeric(n)]:[U.makeBytes(U.toUtf8ByteArray(n))]}static makeEci(n){let t=[];if(n<0)throw new RangeError("ECI assignment value out of range");if(n<128)d(n,8,t);else if(n<16384)d(2,2,t),d(n,14,t);else if(n<1e6)d(6,3,t),d(n,21,t);else throw new RangeError("ECI assignment value out of range");return new U(U.Mode.ECI,0,t)}static isNumeric(n){return U.NUMERIC_REGEX.test(n)}static isAlphanumeric(n){return U.ALPHANUMERIC_REGEX.test(n)}getData(){return this.bitData.slice()}static getTotalBits(n,t){let r=0;for(const i of n){const h=i.mode.numCharCountBits(t);if(i.numChars>=1<<h)return 1/0;r+=4+h+i.bitData.length}return r}static toUtf8ByteArray(n){n=encodeURI(n);let t=[];for(let r=0;r<n.length;r++)n.charAt(r)!="%"?t.push(n.charCodeAt(r)):(t.push(parseInt(n.substring(r+1,r+3),16)),r+=2);return t}};u.NUMERIC_REGEX=/^[0-9]*$/,u.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,u.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let S=u;a.QrSegment=u})(Ae||(Ae={}));(a=>{(m=>{const d=class{constructor(b,u){this.ordinal=b,this.formatBits=u}};d.LOW=new d(0,1),d.MEDIUM=new d(1,0),d.QUARTILE=new d(2,3),d.HIGH=new d(3,2),m.Ecc=d})(a.QrCode||(a.QrCode={}))})(Ae||(Ae={}));(a=>{(m=>{const d=class{constructor(b,u){this.modeBits=b,this.numBitsCharCount=u}numCharCountBits(b){return this.numBitsCharCount[Math.floor((b+7)/17)]}};d.NUMERIC=new d(1,[10,12,14]),d.ALPHANUMERIC=new d(2,[9,11,13]),d.BYTE=new d(4,[8,16,16]),d.KANJI=new d(8,[8,10,12]),d.ECI=new d(7,[0,0,0]),m.Mode=d})(a.QrSegment||(a.QrSegment={}))})(Ae||(Ae={}));var Ue=Ae;/** 284 * @license qrcode.react 285 * Copyright (c) Paul O'Shannessy 286 * SPDX-License-Identifier: ISC 287 */var mn={L:Ue.QrCode.Ecc.LOW,M:Ue.QrCode.Ecc.MEDIUM,Q:Ue.QrCode.Ecc.QUARTILE,H:Ue.QrCode.Ecc.HIGH},xa=128,ga="L",fa="#FFFFFF",ba="#000000",ja=!1,va=1,hn=4,un=0,pn=.1;function ya(a,m=0){const d=[];return a.forEach(function(g,b){let u=null;g.forEach(function(S,M){if(!S&&u!==null){d.push(`M${u+m} ${b+m}h${M-u}v1H${u+m}z`),u=null;return}if(M===g.length-1){if(!S)return;u===null?d.push(`M${M+m},${b+m} h1v1H${M+m}z`):d.push(`M${u+m},${b+m} h${M+1-u}v1H${u+m}z`);return}S&&u===null&&(u=M)})}),d.join("")}function wa(a,m){return a.slice().map((d,g)=>g<m.y||g>=m.y+m.h?d:d.map((b,u)=>u<m.x||u>=m.x+m.w?b:!1))}function xn(a,m,d,g){if(g==null)return null;const b=a.length+d*2,u=Math.floor(m*pn),S=b/m,M=(g.width||u)*S,n=(g.height||u)*S,t=g.x==null?a.length/2-M/2:g.x*S,r=g.y==null?a.length/2-n/2:g.y*S,i=g.opacity==null?1:g.opacity;let h=null;if(g.excavate){let c=Math.floor(t),w=Math.floor(r),C=Math.ceil(M+t-c),_=Math.ceil(n+r-w);h={x:c,y:w,w:C,h:_}}const p=g.crossOrigin;return{x:t,y:r,h:n,w:M,excavation:h,opacity:i,crossOrigin:p}}function gn(a,m){return m!=null?Math.max(Math.floor(m),0):a?hn:un}function Na({value:a,level:m,minVersion:d,includeMargin:g,marginSize:b,imageSettings:u,size:S,boostLevel:M}){let n=B.useMemo(()=>{const c=(Array.isArray(a)?a:[a]).reduce((w,C)=>(w.push(...Ue.QrSegment.makeSegments(C)),w),[]);return Ue.QrCode.encodeSegments(c,mn[m],d,void 0,void 0,M)},[a,m,d,M]);const{cells:t,margin:r,numCells:i,calculatedImageSettings:h}=B.useMemo(()=>{let p=n.getModules();const c=gn(g,b),w=p.length+c*2,C=xn(p,S,c,u);return{cells:p,margin:c,numCells:w,calculatedImageSettings:C}},[n,S,u,g,b]);return{qrcode:n,margin:r,cells:t,numCells:i,calculatedImageSettings:h}}var fn=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),bn=B.forwardRef(function(m,d){const g=m,{value:b,size:u=xa,level:S=ga,bgColor:M=fa,fgColor:n=ba,includeMargin:t=ja,minVersion:r=va,boostLevel:i,marginSize:h,imageSettings:p}=g,w=Bt(g,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:C}=w,_=Bt(w,["style"]),$=p==null?void 0:p.src,y=B.useRef(null),R=B.useRef(null),k=B.useCallback(ce=>{y.current=ce,typeof d=="function"?d(ce):d&&(d.current=ce)},[d]),[v,I]=B.useState(!1),{margin:H,cells:Y,numCells:ee,calculatedImageSettings:O}=Na({value:b,level:S,minVersion:r,boostLevel:i,includeMargin:t,marginSize:h,imageSettings:p,size:u});B.useEffect(()=>{if(y.current!=null){const ce=y.current,G=ce.getContext("2d");if(!G)return;let Ie=Y;const ve=R.current,Pe=O!=null&&ve!==null&&ve.complete&&ve.naturalHeight!==0&&ve.naturalWi
287dth!==0;Pe&&O.excavation!=null&&(Ie=wa(Y,O.excavation));const ye=window.devicePixelRatio||1;ce.height=ce.width=u*ye;const $e=u/ee*ye;G.scale($e,$e),G.fillStyle=M,G.fillRect(0,0,ee,ee),G.fillStyle=n,fn?G.fill(new Path2D(ya(Ie,H))):Y.forEach(function(ct,Be){ct.forEach(function(we,He){we&&G.fillRect(He+H,Be+H,1,1)})}),O&&(G.globalAlpha=O.opacity),Pe&&G.drawImage(ve,O.x+H,O.y+H,O.w,O.h)}}),B.useEffect(()=>{I(!1)},[$]);const be=Ut({height:u,width:u},C);let et=null;return $!=null&&(et=B.createElement("img",{src:$,key:$,style:{display:"none"},onLoad:()=>{I(!0)},ref:R,crossOrigin:O==null?void 0:O.crossOrigin})),B.createElement(B.Fragment,null,B.createElement("canvas",Ut({style:be,height:u,width:u,ref:k,role:"img"},_)),et)});bn.displayName="QRCodeCanvas";var Ca=B.forwardRef(function(m,d){const g=m,{value:b,size:u=xa,level:S=ga,bgColor:M=fa,fgColor:n=ba,includeMargin:t=ja,minVersion:r=va,boostLevel:i,title:h,marginSize:p,imageSettings:c}=g,w=Bt(g,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:C,cells:_,numCells:$,calculatedImageSettings:y}=Na({value:b,level:S,minVersion:r,boostLevel:i,includeMargin:t,marginSize:p,imageSettings:c,size:u});let R=_,k=null;c!=null&&y!=null&&(y.excavation!=null&&(R=wa(_,y.excavation)),k=B.createElement("image",{href:c.src,height:y.h,width:y.w,x:y.x+C,y:y.y+C,preserveAspectRatio:"none",opacity:y.opacity,crossOrigin:y.crossOrigin}));const v=ya(R,C);return B.createElement("svg",Ut({height:u,width:u,viewBox:`0 0 ${$} ${$}`,ref:d,role:"img"},w),!!h&&B.createElement("title",null,h),B.createElement("path",{fill:M,d:`M0,0 h${$}v${$}H0z`,shapeRendering:"crispEdges"}),B.createElement("path",{fill:n,d:v,shapeRendering:"crispEdges"}),k)});Ca.displayName="QRCodeSVG";const jn=j.lazy(()=>ha(()=>import("./PDFViewerEmbed-4BLsCE7P.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]))),vn=j.lazy(()=>ha(()=>import("./QuillEditor-CY4PPdw3.js"),__vite__mapDeps([8,1,2,9,10,11]))),ci=()=>{var vs,ys,ws,Ns,Cs,_s,ks,Es,Ss,As,Ms,Is,Ps,$s,Rs,Ds,Ts,Fs,zs,Ls,Os;const{settings:a}=ma(),m=fr(),d=m.volume,g=m.issue,b=m.firstPage,u=m.doi,S=m.inpressCode?`inpress/${m.inpressCode}`:m.customUrl,M=m.inpressCode,n=Ht(),[t,r]=j.useState(null),[i,h]=j.useState(null),[p,c]=j.useState(!0),[w,C]=j.useState(!1),[_,$]=j.useState([]),[y,R]=j.useState(-1),[k,v]=j.useState(!1);j.useState(!1);const[I,H]=j.useState(!1),[Y,ee]=j.useState(!1),[O,be]=j.useState(),[et,ce]=j.useState(!1),[G,Ie]=j.useState(),[ve,Pe]=j.useState(!1),[ye,$e]=j.useState(""),[ct,Be]=j.useState(!1),[we,He]=j.useState(),[_a,dt]=j.useState(!1),[qe,mt]=j.useState(),[ka,ht]=j.useState(!1),[Ge,ut]=j.useState(),[yn,Ea]=j.useState(!1);j.useState();const[qt,pt]=j.useState(!1),[Gt,Vt]=j.useState(""),[Yt,Qt]=j.useState(""),[Xt,Wt]=j.useState(""),[Re,Zt]=j.useState(!1),[Jt,xt]=j.useState(!1),[Kt,es]=j.useState(""),[ts,ss]=j.useState(""),[wn,Sa]=j.useState(!1),[as,Aa]=j.useState(""),[rs,ns]=j.useState(!1);j.useState(!1);const[gt,De]=j.useState(!1),[ie,he]=j.useState([]),[is,ft]=j.useState(!1),[os,ls]=j.useState(""),[cs,bt]=j.useState(!1),[jt,vt]=j.useState(""),[ds,ms]=j.useState(""),[Te,hs]=j.useState(()=>{const s=localStorage.getItem("sidebarConfig");return s?JSON.parse(s):{left:[],right:["metrics","downloads","dimensions","citations","actions"]}}),yt=j.useRef(null),[tt,Ma]=j.useState(0),[Ia,Nn]=j.useState(!0),[Pa,us]=j.useState(!1),[$a,Ra]=j.useState("figures"),[Da,Cn]=j.useState(0),[Ta,ps]=j.useState("original"),[oe,xs]=j.useState(null),Fa=s=>{s?(ps(s.language_code),xs(s)):(ps("original"),xs(null))},wt=(oe==null?void 0:oe.title)||(t==null?void 0:t.title),Fe=(oe==null?void 0:oe.abstract)||(t==null?void 0:t.abstract),st=(oe==null?void 0:oe.keywords)||(t==null?void 0:t.keywords);j.useMemo(()=>{var E,P,z,F,ue,Le;if(!t)return{};const s=t.citations||[],o=t.metadata||{},f=o.body||[],x={},A=[t.abstract||"",t.content||"",...f.map(pe=>pe.content||""),((E=o.additionalSections)==null?void 0:E.acknowledgments)||"",((P=o.additionalSections)==null?void 0:P.authorContributions)||"",((z=o.additionalSections)==null?void 0:z.conflictOfInterest)||"",((F=o.additionalSections)==null?void 0:F.funding)||"",((ue=o.additionalSections)==null?void 0:ue.dataAvailability)||"",((Le=o.additionalSections)==null?void 0:Le.ethicsStatement)||""].join(" ");
287return s.forEach((pe,Us)=>{var Bs;let rt=0;const ar=new RegExp(`\\[${Us+1}\\]|\\[.*?\\b${Us+1}\\b.*?\\]`,"g"),rr=A.match(ar)||[];rt+=rr.length;const nr=new RegExp(`%%XREF_BIBR%%${pe.id}%%`,"g"),ir=A.match(nr)||[];if(rt+=ir.length,pe.authors&&pe.year){const Hs=Et=>Et.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),qs=pe.authors.split(/[,&]|and/i)[0].trim().split(" ").pop()||"",Gs=(Bs=String(pe.year).match(/\d{4}[a-z]?/i))==null?void 0:Bs[0];if(qs.length>2&&Gs)try{const Et=new RegExp(`\\b${Hs(qs)}\\b[^)]*\\(?${Hs(Gs)}`,"gi"),or=A.match(Et)||[];rt+=or.length}catch{}}x[pe.id]=rt}),x},[t]),j.useEffect(()=>{(d&&g&&b||u||S)&&(za(),La())},[d,g,b,u,S]),j.useEffect(()=>{const s=()=>{C(window.scrollY>400)};return window.addEventListener("scroll",s),()=>window.removeEventListener("scroll",s)},[]),j.useEffect(()=>{if(yt.current){const s=yt.current.offsetHeight;Ma(s)}},[t==null?void 0:t.abstract]);const za=async()=>{var s;try{let o=null,f=null;if(d&&g&&b&&(o=await br(d,g,b)),!o&&S){const x=M?[S,M]:[S],A=await L.from("articles").select("*").in("custom_url",x).limit(1);o=((s=A.data)==null?void 0:s[0])??null,f=A.error}if(!o&&!f&&u){let x=null;const{data:A}=await L.from("articles").select("id, doi").like("doi",`%${u}`).limit(10);if(A&&A.length>0&&(x=(A.find(P=>P.doi?Qs(P.doi)===u:!1)||A[0]).id),!x){const{data:E,error:P}=await L.from("articles").select("id, doi").not("doi","is",null).limit(1e4);if(P)throw P;let z=(E==null?void 0:E.find(F=>F.doi?Qs(F.doi)===u:!1))||null;z||(z=(E==null?void 0:E.find(F=>{if(!F.doi)return!1;const ue=F.doi.match(/\d+/g),Le=ue?ue.join(""):"";return(Le.length>6?Le.substring(6):Le)===u}))||null),x=(z==null?void 0:z.id)??null}if(x){const E=await L.from("articles").select("*").eq("id",x).single();o=E.data,f=E.error}}if(f)throw f;if(!o){r(null),c(!1);return}if(u&&!d&&o){const x=fe(o);if(x!=="#"&&!x.includes(`/article/${u}`)){n(x,{replace:!0});return}}if(r(o),o.id&&await L.rpc("increment_article_views",{article_id_param:o.id}),o.issue_id){const{data:x,error:A}=await L.from("issues").select("*").eq("id",o.issue_id).single();!A&&x&&h(x);const{data:E,error:P}=await L.from("articles").select("id, title, doi, custom_url, metadata").eq("issue_id",o.issue_id).order("display_order",{ascending:!0}).order("created_at",{ascending:!0});if(!P&&E){$(E);let z=E.findIndex(F=>F.id===o.id);z<0&&o.custom_url&&(z=E.findIndex(F=>F.custom_url===o.custom_url)),z<0&&o.doi&&(z=E.findIndex(F=>F.doi===o.doi)),z<0&&(z=0),R(z)}}}catch(o){console.error("Error fetching article:",o)}finally{c(!1)}},La=async()=>{try{const{data:{session:s}}=await L.auth.getSession();if(!s){v(!1);return}const{data:o,error:f}=await L.from("user_roles").select("role").eq("user_id",s.user.id).eq("role","admin").single();v(!!o&&!f)}catch(s){console.error("Error checking admin access:",s),v(!1)}},Nt=async s=>{var f;const o=(f=s.target.files)==null?void 0:f[0];if(!(!o||!t)){Zt(!0);try{const x=await ra(o),{error:A}=await L.from("articles").update({graphical_abstract_url:x}).eq("id",t.id);if(A)throw A;r({...t,graphical_abstract_url:x}),D.success("Graphical abstract uploaded successfully")}catch(x){console.error("Error uploading graphical abstract:",x),D.error("Failed to upload graphical abstract")}finally{Zt(!1)}}},gs=async s=>{var f;const o=(f=s.target.files)==null?void 0:f[0];if(!(!o||!i)){H(!0);try{const x=await ra(o),{error:A}=await L.from("issues").update({cover_image_url:x}).eq("id",i.id);if(A)throw A;h({...i,cover_image_url:x}),D.success("Cover image uploaded successfully")}catch(x){console.error("Error uploading cover image:",x),D.error("Failed to upload cover image")}finally{H(!1)}}},Oa=async()=>{if(t)try{const s=parseInt(as)||0,{error:o}=await L.from("articles").update({google_scholar_citations:s}).eq("id",t.id);if(o)throw o;r({...t,google_scholar_citations:s}),Sa(!1),D.success("Google Scholar citations updated")}catch(s){console.error("Error updating citations:",s),D.error("Failed to update citations")}},Ua=async()=>{if(t){ns(!0);try{const{data:s,error:o}=await L.functions.invoke("fetch-citations",{body:{articleId:t.id,doi:t.doi}});if(o)throw o;(s==null?void 0:s.citations)!==void 0?(r({...t,google_scholar_citations:s.citations}),D.success(`Fetched ${s.citations} citations from ${s.source==="crossref"?"Crossref":"Semantic Scholar"}`)):s!=null&&s.error&&D.error(s.error)}catch(s){console.error("Error fetching citations:",s),D.error("Failed to fetch citations")}finally{ns(!1)}}},fs=async()=>
287{if(t)try{const{error:s}=await L.from("articles").update({graphical_abstract_url:null}).eq("id",t.id);if(s)throw s;r({...t,graphical_abstract_url:null}),D.success("Graphical abstract deleted")}catch(s){console.error("Error deleting graphical abstract:",s),D.error("Failed to delete graphical abstract")}},Ba=async()=>{if(!(!O||!t))try{const s=ge(O,"yyyy-MM-dd"),{error:o}=await L.from("articles").update({published_date:s}).eq("id",t.id);if(o)throw o;r({...t,published_date:s}),ee(!1),D.success("Published date updated successfully")}catch(s){console.error("Error updating date:",s),D.error("Failed to update date")}},Ha=async()=>{if(!(!G||!t))try{const s=ge(G,"yyyy-MM-dd"),{error:o}=await L.from("articles").update({revised_date:s}).eq("id",t.id);if(o)throw o;r({...t,revised_date:s}),ce(!1),D.success("Revised date updated successfully")}catch(s){console.error("Error updating revised date:",s),D.error("Failed to update revised date")}},qa=async()=>{if(!(!ye||!t))try{const{error:s}=await L.from("articles").update({doi:ye}).eq("id",t.id);if(s)throw s;r({...t,doi:ye}),Pe(!1),D.success("DOI updated successfully")}catch(s){console.error("Error updating DOI:",s),D.error("Failed to update DOI")}},Ct=async(s,o)=>{if(!(!o||!t))try{const f=ge(o,"yyyy-MM-dd"),x=t.metadata||{},A=x.history||{},E={...x,history:{...A,[s]:f}},{error:P}=await L.from("articles").update({metadata:E}).eq("id",t.id);if(P)throw P;r({...t,metadata:E}),s==="received"&&Be(!1),s==="accepted"&&dt(!1),s==="revised"&&ht(!1),s==="published"&&Ea(!1),D.success(`${s.charAt(0).toUpperCase()+s.slice(1)} date updated successfully`)}catch(f){console.error(`Error updating ${s} date:`,f),D.error(`Failed to update ${s} date`)}},Ga=async()=>{if(t)try{const o={...t.metadata||{},correspondence:{name:Gt,affiliation:Yt,email:Xt}},{error:f}=await L.from("articles").update({metadata:o}).eq("id",t.id);if(f)throw f;r({...t,metadata:o}),pt(!1),D.success("Correspondence updated successfully")}catch(s){console.error("Error updating correspondence:",s),D.error("Failed to update correspondence")}},Va=async()=>{if(t)try{const o={...t.metadata||{},funding:{grants:Kt,acknowledgment:ts}},{error:f}=await L.from("articles").update({metadata:o}).eq("id",t.id);if(f)throw f;r({...t,metadata:o}),xt(!1),D.success("Funding information updated successfully")}catch(s){console.error("Error updating funding:",s),D.error("Failed to update funding information")}},Ya=async()=>{if(t)try{const o={...t.metadata||{},copyright:os,licenseText:ds},{error:f}=await L.from("articles").update({metadata:o}).eq("id",t.id);if(f)throw f;r({...t,metadata:o}),ft(!1),D.success("Copyright and license updated successfully")}catch(s){console.error("Error updating copyright:",s),D.error("Failed to update copyright information")}},Qa=async()=>{if(t)try{const{error:s}=await L.from("articles").update({abstract:jt}).eq("id",t.id);if(s)throw s;r({...t,abstract:jt}),bt(!1),D.success("Abstract updated successfully")}catch(s){console.error("Error updating abstract:",s),D.error("Failed to update abstract")}},Xa=()=>{window.scrollTo({top:0,behavior:"smooth"})},at=s=>{const o=fe(s);n(o),window.scrollTo({top:0,behavior:"smooth"})},Wa=async()=>{var o;if(!t)return;const s=((o=t.download_urls)==null?void 0:o.pdf)||t.pdf_link;s?(t.id&&await L.rpc("increment_article_downloads",{article_id_param:t.id}),window.open(s,"_blank"),D.success("Opening PDF...")):D.error("PDF not available")},Za=()=>{var z;if(!t)return;const s=t.authors||[],o=s.map(F=>`${F.surname}, ${F.givenNames||""}`).join(" and "),f=t.metadata||{},x=`@article{${(z=s[0])==null?void 0:z.surname}${f.year||new Date().getFullYear()}, 288 author = {${o}}, 289 title = {${t.title}}, 290 journal = {${f.journal||""}}, 291 year = {${f.year||new Date().getFullYear()}}, 292 volume = {${f.volume||""}}, 293 number = {${f.issue||""}}, 294 pages = {${f.pages||""}}, 295 doi = {${t.doi||""}} 296}`,A=new Blob([x],{type:"text/plain"}),E=URL.createObjectURL(A),P=document.createElement("a");P.href=E,P.download="citation.bib",document.body.appendChild(P),P.click(),document.body.removeChild(P),URL.revokeObjectURL(E),D.success("BibTeX citation downloaded")},Ja=()=>{var P,z;if(!t)return;const s=t.authors||[],o=t.metadata||{},f=`TY - JOUR 297${s.map(F=>`AU - ${F.surname}, ${F.givenNames||""}`).join(` 298`)} 299TI - ${t.title} 300JO - ${o.journal||""} 301PY - ${o.year||new Date().getFullYear()} 302VL - ${o.volume||""} 303IS - ${o.issue||""} 304SP - ${((P=o.pages)==null?void 0:P.split("-")[0])||""} 305EP - ${((z=o.pages)==null?void 0:z.split("-")[1])||""} 306DO - ${t.doi||""} 307ER - `,x=new Blob([f],{type:"application/x-research-info-systems"}),A=URL.createObjectURL(x),E=document.createElement("a");E.href=A,E.download="citation.ris",document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(A),D.success("RIS citation downloaded")},Ka=()=>
307{if(!t)return;const s=t.authors||[],o=t.metadata||{},f=`%0 Journal Article 308${s.map(P=>`%A ${P.surname}, ${P.givenNames||""}`).join(` 309`)} 310%T ${t.title} 311%J ${o.journal||""} 312%D ${o.year||new Date().getFullYear()} 313%V ${o.volume||""} 314%N ${o.issue||""} 315%P ${o.pages||""} 316%R ${t.doi||""}`,x=new Blob([f],{type:"text/plain"}),A=URL.createObjectURL(x),E=document.createElement("a");E.href=A,E.download="citation.enw",document.body.appendChild(E),E.click(),document.body.removeChild(E),URL.revokeObjectURL(A),D.success("EndNote citation downloaded")},er=async()=>{if(t)try{const s=t.authors||[],o=t.metadata||{};await Zr({title:t.title,authors:s.map(f=>({surname:f.surname,givenNames:f.givenNames,affiliation:f.affiliation})),journal:o.journal||(a==null?void 0:a.journal_name)||"",abstract:t.abstract,content:t.content||"",doi:t.doi,year:o.year||(t.published_date?new Date(t.published_date).getFullYear().toString():void 0),volume:o.volume,issue:o.issue,pages:o.pages,publishedDate:t.published_date,keywords:t.keywords}),D.success("EPUB file downloaded successfully")}catch(s){console.error("Error generating EPUB:",s),D.error("Failed to generate EPUB file")}},Ne=y>0?_[y-1]:null,Ce=y>=0&&y<_.length-1?_[y+1]:null,bs=s=>{if(!s)return"";const o=s.match(/^(\d+)/);return o?o[1]:""},js=s=>{if(!s)return"";const o=s.match(/(\d+)$/);return o?o[1]:""},Ve=(s,o="dd/MM/yyyy")=>{if(!s)return null;const f=new Date(s);if(isNaN(f.getTime()))return null;try{return ge(f,o)}catch{return null}},tr=s=>{let o=[];s.authors&&o.push(e.jsx("span",{children:s.authors},"authors")),s.year&&o.push(e.jsxs("span",{children:[" (",s.year,")."]},"year")),s.title&&(s.doi?o.push(e.jsxs("span",{children:[" ",e.jsx("a",{href:`https://doi.org/${s.doi}`,target:"_blank",rel:"noopener noreferrer",className:"text-foreground hover:text-primary transition-colors underline decoration-primary/30 hover:decoration-primary",children:s.title}),"."]},"title")):o.push(e.jsxs("span",{children:[" ",s.title,"."]},"title"))),s.source&&o.push(e.jsxs("span",{children:[" ",e.jsx("em",{children:s.source})]},"source")),s.volume&&o.push(e.jsxs("span",{children:[", ",e.jsx("em",{children:s.volume})]},"volume")),s.issue&&o.push(e.jsxs("span",{children:["(",s.issue,")"]},"issue")),s.pages&&o.push(e.jsxs("span",{children:[", ",s.pages]},"pages")),o.push(e.jsx("span",{children:"."},"end"));const f=`https://scholar.google.com/scholar?q=${encodeURIComponent(s.title||"")}`;return o.push(e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1.5 opacity-60 group-hover:opacity-100 transition-opacity duration-300",children:[s.doi&&e.jsx("a",{href:`https://doi.org/${s.doi}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider rounded bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300 hover:bg-blue-200 dark:hover:bg-blue-800/50 transition-colors duration-200",children:"DOI"}),s.pmid&&e.jsx("a",{href:`https://pubmed.ncbi.nlm.nih.gov/${s.pmid}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider rounded bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300 hover:bg-emerald-200 dark:hover:bg-emerald-800/50 transition-colors duration-200",children:"PMID"}),e.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider rounded bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 hover:bg-amber-200 dark:hover:bg-amber-800/50 transition-colors duration-200",children:"Google Scholar"})]},"ref-links")),e.jsx(e.Fragment,{children:o})},sr=s=>{let o=[];if(s.authors){const x=s.authors.trim().replace(/\.$/,"");o.push(e.jsx("span",{children:x},"authors"))}s.title&&o.push(e.jsxs("span",{children:[". ",s.title]},"title")),s.source&&o.push(e.jsxs("span",{children:[". ",s.source]},"source")),s.year&&o.push(e.jsxs("span",{children:[" ",s.year]},"year")),s.volume&&o.push(e.jsxs("span",{children:[";",s.volume]},"volume")),s.issue&&o.push(e.jsxs("span",{children:["(",s.issue,")"]},"issue")),s.pages&&o.push(e.jsxs("span",{children:[":",s.pages]},"pages")),o.push(e.jsx("span",{children:"."},"end"));const f=`https://scholar.google.com/scholar?q=${encodeURIComponent(s.title||"")}`;return o.push(e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1.5 opacity-60 group-hover:opacity-100 transition-opacity duration-300",children:[s.doi&&e.jsx("a",{href:`https://doi.org/${s.doi}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider rounded bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300 hover:bg-blue-200 dark:hover:bg-blue-800/50 transition-colors duration-200",children:"DOI"}),s.pmid&&e.jsx("a",{href:`https://pubmed.ncbi.nlm.nih.gov/${s.pmid}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider rounded bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300 hover:bg-emerald-200 dark:hover:bg-emerald-800/50 transition-colors duration-200",children:"PMID"}),e.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider rounded bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300 hover:bg-amber-200 dark:hover:bg-amber-800/50 transition-colors duration-200",children:"Google Scholar"})]},"ref-links")),e.jsx(e.Fragment,{children:o})};if(p)return e.jsx(Cr,{message:"Loading article..."});if(!t)return e.jsxs("div",{className:"min-h-screen flex flex-col bg-gradient-to-b from-secondary/10 to-background",children:[e.jsx(Xs,{}),e.jsx("main",{className:"flex-1 container py-20",children:e.jsxs("div",{className:"max-w-2xl mx-auto text-center space-y-4",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-20 h-20 rounded-full bg-muted mb-4",children:e.jsx(nt,{className:"w-10 h-10 text-muted-foreground"})}),e.jsx("h1",{className:"text-3xl font-bold",children:"Article not found"}),e.jsx("p",{className:"text-muted-foreground",children:"The article you're looking for doesn't exist or has been removed."}),e.jsx(N,{onClick:()=>n("/archives"),size:"lg",className:"mt-6",children:"Browse All Articles"})]})}),e.jsx(Ws,{})]});const te=t.authors||[],se=t.citations||[],l=t.metadata||{},ae=l.referenceStyle||"APA",le=l.journal||(a==null?void 0:a.journal_name),_t=l.articleType||"Research Article",V=l.body||[],Z=V.flatMap(s=>s.figures||[]),J=V.flatMap(s=>s.tables||[]),ze=Er(t.content+" "+V.map(s=>s.content||"").join(" "),V,Z,J),kt=s=>{s&&Ra(s),us(!0)};return e.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[e.jsx(en,{}),e.jsx(rn,{sections:V.map(s=>({title:s.title})),isVisible:Ia&&V.length>0}),e.jsx(nn,{figures:Z,tables:J,isOpen:Pa,onClose:()=>us(!1),initialTab:$a,initialIndex:Da}),e.jsxs(jr,{children:[e.jsxs("title",{children:[t.title," | ",le]}),e.jsx("meta",{name:"description",content:((vs=t.abstract)==null?void 0:vs.substring(0,160))||"Research article"}),e.jsx("link",{rel:"canonical",href:(()=>{var o;const s=l!=null&&l.volume&&(l!=null&&l.issue)&&(l!=null&&l.pages)?`/article/${l.volume}/${l.issue}/${(((o=String(l.pages).match(/^([a-zA-Z]?\d+)/i))==null?void 0:o[1])||"").toLowerCase()}`:window.location.pathname;return`${window.location.origin}${s}`})()}),(a==null?void 0:a.google_scholar_verification)&&e.jsx("meta",{name:"google-site-verification",content:a.google_scholar_verification}),e.jsx("meta",{name:"citation_title",content:t.title}),te.map((s,o)=>e.jsx("meta",{name:"citation_author",content:s.givenNames?`${s.surname}, ${s.givenNames}`:s.surname},`author-${o}`)),te.map((s,o)=>s.affiliation&&e.jsx("meta",{name:"citation_author_institution",content:s.affiliation},`affiliation-${o}`)),te.map((s,o)=>s.email&&e.jsx("meta",{name:"citation_author_email",content:s.email},`email-${o}`)),t.published_date&&e.jsx("meta",{name:"citation_publication_date",content:t.published_date.replace(/-/g,"/")}),t.published_date&&e.jsx("meta",{name:"citation_online_date",content:t.published_date.replace(/-/g,"/")}),e.jsx("meta",{name:"citation_journal_title",content:le}),(l.issn||(a==null?void 0:a.issn))&&e.jsx("meta",{name:"citation_issn",content:l.issn||(a==null?void 0:a.issn)}),(l.publisher||(a==null?void 0:a.publisher_name))&&e.jsx("meta",{name:"citation_publisher",content:l.publisher||(a==null?void 0:a.publisher_name)}),l.volume&&e.jsx("meta",{name:"citation_volume",content:l.volume}),l.issue&&e.jsx("meta",{name:"citation_issue",content:l.issue}),l.pages&&bs(l.pages)&&e.jsx("meta",{name:"citation_firstpage",content:bs(l.pages)}),l.pages&&js(l.pages)&&e.jsx("meta",{name:"citation_lastpage",content:js(l.pages)}),t.pdf_url&&(()=>{var o;const s=l!=null&&l.volume&&(l!=null&&l.issue)&&(l!=null&&l.pages)?`/article/${l.volume}/${l.issue}/${(((o=String(l.pages).match(/^([a-zA-Z]?\d+)/i))==null?void 0:o[1])||"").toLowerCase()}`:window.location.pathname.replace(/\/$/,"");return e.jsx("meta",{name:"citation_pdf_url",content:`${window.location.origin}${s}.pdf`})})(),t.doi&&e.jsx("meta",{name:"citation_doi",content:t.doi}),t.abstract&&e.jsx("meta",{name:"citation_abstract",content:t.abstract}),e.jsx("meta",{name:"citation_public_url",content:window.location.href}),e.jsx("meta",{name:"citation_fulltext_html_url",content:window.location.href}),e.jsx("meta",{name:"citation_abstract_html_url",content:window.location.href}),(ys=t.keywords)==null?void 0:ys.map((s,o)=>e.jsx("meta",{name:"citation_keywords",content:s},`keyword-${o}`)),e.jsx("meta",{name:"citation_language",content:"en"}),e.jsx("meta",{name:"citation_reference",content:"journal"}),e.jsx("meta",{property:"og:title",content:t.title}),e.jsx("meta",{property:"og:description",content:((ws=t.abstract)==null?void 0:ws.substring(0,200))||""}),e.jsx("meta",{property:"og:type",content:"article"}),e.jsx("meta",{property:"og:url",content:window.location.href}),t.featured_image_url&&e.jsx("meta",{property:"og:image",content:t.featured_image_url}),e.jsx("meta",{property:"article:published_time",content:t.published_date?new Date(t.published_date+"T00:00:00Z").toISOString():""}),te.map((s,o)=>e.jsx("meta",{property:"article:author",content:s.givenNames?`${s.givenNames} ${s.surname}`:s.surname},`og-author-${o}`)),(Ns=t.keywords)==null?void 0:Ns.map((s,o)=>e.jsx("meta",{property:"article:tag",content:s},`og-tag-${o}`)),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:title",content:t.title}),e.jsx("meta",{name:"twitter:description",content:((Cs=t.abstract)==null?void 0:Cs.substring(0,200))||""}),t.featured_image_url&&e.jsx("meta",{name:"twitter:image",content:t.featured_image_url}),e.jsx("meta",{name:"robots",content:"index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1"}),e.jsx("meta",{name:"googlebot",content:"index, follow"}),e.jsx("meta",{name:"author",content:te.map(s=>s.givenNames?`${s.givenNames} ${s.surname}`:s.surname).join(", ")}),t.keywords&&e.jsx("meta",{name:"keywords",content:t.keywords.join(", ")}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"ScholarlyArticle",headline:t.title,abstract:t.abstract||"",author:te.map(s=>({"@type":"Person",name:s.givenNames?`${s.givenNames} ${s.surname}`:s.surname,email:s.email||void 0})),datePublished:t.published_date||"",publisher:{"@type":"Organization",name:le},isPartOf:{"@type":"PublicationIssue",issueNumber:l.issue,isPartOf:{"@type":"PublicationVolume",volumeNumber:l.volume,isPartOf:{"@type":"Periodical",name:le}}},identifier:t.doi?`https://doi.org/${t.doi}`:void 0,url:window.location.href,keywords:((_s=t.keywords)==null?void 0:_s.join(", "))||void 0,image:t.featured_image_url||void 0})})]}
316),e.jsx(ln,{article:{id:t.id,title:wt||t.title,abstract:Fe||t.abstract,doi:t.doi,published_date:t.published_date,revised_date:t.revised_date,created_at:t.created_at,keywords:st||t.keywords,featured_image_url:t.featured_image_url,graphical_abstract_url:t.graphical_abstract_url,pdf_url:t.pdf_url,authors:te,google_scholar_citations:t.google_scholar_citations,scopus_citations:t.scopus_citations,metadata:{volume:l.volume,issue:l.issue,pages:l.pages,first_page:l.firstPage,last_page:l.lastPage,issn:l.issn,publisher:l.publisher,copyright:l.copyright,license:l.license,licenseUrl:l.licenseUrl,funding:l.funding,history:l.history,articleType:_t}},journalName:le,articleUrl:window.location.href}),e.jsx(Xs,{}),e.jsx("div",{className:"bg-gradient-to-br from-primary/5 via-accent/5 to-background py-8 border-b border-border/50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"flex gap-6 items-start",children:[e.jsx("div",{className:"flex-1 min-w-0 space-y-4",children:e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[_t&&e.jsxs("div",{className:"relative group",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/20 to-accent/20 blur-sm"}),e.jsx(de,{className:"relative capitalize text-xs font-bold bg-gradient-to-r from-primary to-primary/90 text-primary-foreground px-4 py-1.5 rounded-full uppercase tracking-wider shadow-lg hover:bg-primary-foreground hover:text-primary transition-colors cursor-pointer",children:_t.replace(/-/g," ")})]}),e.jsx(Dr,{status:"published"}),e.jsx("div",{className:"h-4 w-px bg-border"}),e.jsx(de,{variant:"outline",className:"font-semibold px-4 py-1.5 rounded-full text-xs border-2",children:le}),l.volume&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-px bg-border"}),e.jsxs("span",{className:"text-sm text-muted-foreground font-medium",children:["Vol. ",l.volume]})]}),l.issue&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-px bg-border"}),e.jsxs("span",{className:"text-sm text-muted-foreground font-medium",children:["Issue ",l.issue]})]}),((i==null?void 0:i.year)||t.published_date&&new Date(t.published_date).getFullYear())&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-px bg-border"}),e.jsx("span",{className:"text-sm text-muted-foreground font-medium",children:(i==null?void 0:i.year)||new Date(t.published_date).getFullYear()})]}),l.pages&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-px bg-border"}),e.jsxs("span",{className:"text-sm text-muted-foreground font-medium",children:["pp. ",l.pages]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[(t==null?void 0:t.id)&&e.jsx(on,{articleId:t.id,onLanguageChange:Fa,currentLanguage:Ta}),k&&e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>{const s=fe(t);n(`${s}/edit`)},className:"gap-2",children:[e.jsx(re,{className:"h-4 w-4"}),"Edit Article"]})]})]}),oe&&e.jsx("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-blue-500/10 rounded-full w-fit",children:e.jsxs("span",{className:"text-xs font-medium text-blue-600",children:["Viewing in ",oe.language_name,oe.is_machine_translated&&" (Machine Translated)"]})}),e.jsx(Oe,{children:e.jsxs(_e,{children:[e.jsx(ke,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-primary/10 rounded-full w-fit",children:[e.jsx(Yr,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-xs font-medium text-primary",children:"Open Access"})]})}),e.jsx(Ee,{children:e.jsx("p",{children:"Free to read and share"})})]})}),e.jsx("div",{children:e.jsx("h1",{className:"text-4xl leading-relaxed tracking-tight bg-gradient-to-br from-foreground to-foreground/70 bg-clip-text font-extrabold md:text-4xl text-zinc-700",children:wt})}),k&&ze.issues.length>0&&e.jsxs("div",{className:"mt-6 border border-border rounded-lg overflow-hidden bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted border-b border-border",children:[e.jsx("span",{className:"text-sm font-semibold",children:ze.valid?"â ï¸ Warnings":"â Validation Issues"}),e.jsxs(de,{variant:ze.valid?"secondary":"destructive",className:"text-xs",children:[ze.issues.length," issue",ze.issues.length!==1?"s":""]})]}),e.jsx("div",{className:"p-4 space-y-3 max-h-60 overflow-y-auto",children:ze.issues.map((s,o)=>e.jsx("div",{className:q("p-3 rounded-md border",s.type==="error"?"bg-destructive/10 border-destructive/30":"bg-yellow-500/10 border-yellow-500/30"),children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(de,{variant:s.type==="error"?"destructive":"outline",className:"text-xs uppercase shrink-0",children:s.category}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:q("text-sm font-medium",s.type==="error"?"text-destructive":"text-yellow-700 dark:text-yellow-500"),children:s.message}),s.details&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s.details})]})]})},o))})]})]}),e.jsx("div",{className:"mt-8 mb-6 pb-6 border-b-2 border-border/30",children:e.jsx("div",{className:"flex items-start gap-3 text-base",children:e.jsx("div",{className:"flex-1",children:gt&&k?e.jsxs("div",{className:"space-y-3",children:[ie.map((s,o)=>e.jsxs("div",{className:"grid grid-cols-2 gap-2 p-3 border rounded-md bg-muted/20",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Given Names"}),e.jsx(K,{value:s.givenNames||"",onChange:f=>{const x=[...ie];x[o]={...s,givenNames:f.target.value},he(x)},className:"h-8 mt-1"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Surname"}),e.jsx(K,{value:s.surname||"",onChange:f=>{const x=[...ie];x[o]={...s,surname:f.target.value},he(x)},className:"h-8 mt-1"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsxs("label",{className:"text-xs font-medium text-muted-foreground flex items-center gap-1",children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 256 256",className:"text-[#A6CE39]",children:[e.jsx("path",{fill:"currentColor",d:"M256 128c0 70.7-57.3 128-128 128S0 198.7 0 128 57.3 0 128 0s128 57.3 128 128z"}),e.jsx("g",{fill:"white",children:e.jsx("path",{d:"M86.3 186.2H70.9V79.1h15.4v107.1zM108.9 79.1h41.6c39.6 0 57 28.3 57 53.6 0 27.5-21.5 53.6-56.8 53.6h-41.8V79.1zm15.4 93.3h24.5c34.9 0 42.9-26.5 42.9-39.7C191.7 111.2 178 93 148 93h-23.7v79.4zM88.7 56.8c0 5.5-4.5 10.1-10.1 10.1s-10.1-4.6-10.1-10.1c0-5.6 4.5-10.1 10.1-10.1s10.1 4.6 10.1 10.1z"})})]}),"ORCID ID"]}),e.jsx(K,{value:s.orcidId||"",onChange:f=>{const x=[...ie];x[o]={...s,orcidId:f.target.value},he(x)},placeholder:"0000-0000-0000-0000",className:"h-8 mt-1"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Email"}),e.jsx(K,{value:s.email||"",onChange:f=>{const x=[...ie];x[o]={...s,email:f.target.value},he(x)},className:"h-8 mt-1"})]}),e.jsxs("div",{className:"col-span-2",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Affiliation"}),e.jsx(K,{value:s.affiliation||"",onChange:f=>{const x=[...ie];x[o]={...s,affiliation:f.target.value},he(x)},className:"h-8 mt-1"})]})]},o)),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(N,{size:"sm",onClick:async()=>{const{error:s}=await L.from("articles").update({authors:ie}).eq("id",t.id);s?D.error("Failed to update authors"):(D.success("Authors updated successfully"),r({...t,authors:ie}),De(!1))},children:[e.jsx(W,{className:"h-4 w-4 mr-1"}),"Save"]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>{De(!1),he(t.authors||[])},children:[e.jsx(X,{className:"h-4 w-4 mr-1"}),"Cancel"]})]})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Tr,{authors:te}),k&&e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>{he(t.authors||[]),De(!0)},children:e.jsx(re,{className:"h-3 w-3"})})]})})})}),e.jsxs(zt,{defaultValue:"author-info",className:"mb-6",children:[e.jsxs(Lt,{className:"inline-flex h-auto p-0 bg-transparent roun
316ded-none border-b-2 border-border",children:[e.jsx(Se,{value:"author-info",className:"text-sm font-medium px-4 py-3 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:text-primary data-[state=active]:bg-transparent transition-all hover:text-primary/70",children:"Author information"}),e.jsx(Se,{value:"citations",className:"text-sm font-medium px-4 py-3 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:text-primary data-[state=active]:bg-transparent transition-all hover:text-primary/70",children:"Cite this Article"})]}),e.jsxs(Qe,{value:"author-info",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"pb-3 border-b border-border/30 bg-muted/30 p-4 rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Affiliations"}),k&&!gt&&e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>{he(t.authors||[]),De(!0)},className:"h-6",children:e.jsx(re,{className:"h-3 w-3"})})]}),gt&&k?e.jsxs("div",{className:"space-y-3",children:[ie.map((s,o)=>e.jsxs("div",{className:"grid grid-cols-1 gap-2 p-3 border rounded-md bg-background/50",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[s.givenNames," ",s.surname]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Affiliation"}),e.jsx(K,{value:s.affiliation||"",onChange:f=>{const x=[...ie];x[o]={...s,affiliation:f.target.value},he(x)},className:"h-8 mt-1",placeholder:"e.g., 1Department of Chemistry, University..."})]})]},o)),e.jsxs("div",{className:"flex gap-2 mt-3",children:[e.jsxs(N,{size:"sm",onClick:async()=>{const{error:s}=await L.from("articles").update({authors:ie}).eq("id",t.id);s?D.error("Failed to save affiliations"):(D.success("Affiliations updated"),r({...t,authors:ie}),De(!1))},children:[e.jsx(W,{className:"h-3 w-3 mr-1"}),"Save"]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>{De(!1),he(t.authors||[])},children:[e.jsx(X,{className:"h-3 w-3 mr-1"}),"Cancel"]})]})]}):e.jsx("div",{className:"space-y-2",children:(()=>{const s=l==null?void 0:l.affiliations;if(s&&s.length>0){const x=[],A=new Set;return s.forEach(E=>{const P=E.text.match(/^(\d+)/),z=P?P[1]:null,F=E.text.replace(/^(\d+)\s*/,"").replace(/^a\s+/i,"").trim();F&&!A.has(F)&&(A.add(F),x.push({id:z,text:F}))}),x.sort((E,P)=>!E.id&&!P.id?0:E.id?P.id?parseInt(E.id)-parseInt(P.id):-1:1),x.map((E,P)=>e.jsx("div",{id:E.id&&E.id!=="0"?`affiliation-${E.id}`:void 0,className:"text-sm text-muted-foreground scroll-mt-20 target:bg-primary/10",children:e.jsxs("p",{children:[E.id&&E.id!=="0"&&e.jsx("sup",{className:"text-primary font-bold mr-0.5",children:E.id}),e.jsx("span",{children:E.text})]})},P))}const o=[],f=new Set;return te.filter(x=>x.affiliation).forEach(x=>{x.affiliation.split(/,\s*(?=\d)/).forEach(P=>{const z=P.match(/^(\d+)/),F=z?z[1]:null,ue=P.replace(/^(\d+(?:,\s*\d+)*)\s*/,"").replace(/^a\s+/i,"").trim();ue&&!f.has(ue)&&(f.add(ue),o.push({id:F,text:ue}))})}),o.sort((x,A)=>!x.id&&!A.id?0:x.id?A.id?parseInt(x.id)-parseInt(A.id):-1:1),o.map((x,A)=>e.jsx("div",{id:x.id&&x.id!=="0"?`affiliation-${x.id}`:void 0,className:"text-sm text-muted-foreground scroll-mt-20 target:bg-primary/10",children:e.jsxs("p",{children:[x.id&&x.id!=="0"&&e.jsx("sup",{className:"text-primary font-bold mr-0.5",children:x.id}),e.jsx("span",{children:x.text})]})},A))})()})]}),l.correspondence&&e.jsxs("div",{className:"pb-3 border-b border-border/30 p-4 rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Corresponding author"}),k&&!qt&&e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>{var s,o,f;Vt(((s=l.correspondence)==null?void 0:s.name)||""),Qt(((o=l.correspondence)==null?void 0:o.affiliation)||""),Wt(((f=l.correspondence)==null?void 0:f.email)||""),pt(!0)},className:"h-6",children:e.jsx(re,{className:"h-3 w-3"})})]}),qt?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Name"}
316),e.jsx(K,{value:Gt,onChange:s=>Vt(s.target.value),placeholder:"Enter name",className:"h-8"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Affiliation"}),e.jsx(K,{value:Yt,onChange:s=>Qt(s.target.value),placeholder:"Enter affiliation",className:"h-8"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Email"}),e.jsx(K,{type:"email",value:Xt,onChange:s=>Wt(s.target.value),placeholder:"Enter email",className:"h-8"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(N,{size:"sm",onClick:Ga,className:"h-7",children:[e.jsx(W,{className:"h-3 w-3 mr-1"}),"Save"]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>pt(!1),className:"h-7",children:[e.jsx(X,{className:"h-3 w-3 mr-1"}),"Cancel"]})]})]}):e.jsx("div",{className:"space-y-1 text-sm",children:l.correspondence.name&&e.jsxs("div",{children:[e.jsxs("p",{className:"flex items-center gap-2",children:[e.jsx("sup",{className:"text-primary font-bold",children:"*"}),e.jsx("span",{className:"font-bold text-foreground",children:l.correspondence.name}),l.correspondence.email&&e.jsx("a",{href:`mailto:${l.correspondence.email}`,className:"text-primary hover:text-primary/80 transition-colors",title:l.correspondence.email,children:e.jsx(vr,{className:"h-4 w-4"})})]}),l.correspondence.affiliation&&e.jsx("p",{className:"text-muted-foreground",children:l.correspondence.affiliation.replace(/^(\d+(?:,\s*\d+)*)\s*/,"").replace(/^a\s+/i,"")})]})})]}),l.notes&&e.jsxs("div",{className:"pb-3 border-b border-border/30 bg-muted/30 p-4 rounded-lg",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Author Notes"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l.notes})]}),e.jsxs("div",{className:"pb-3 border-b border-border/30 p-4 rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Copyright and License information"}),k&&!is&&e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>{ls(l.copyright||`©${new Date(t.published_date||t.created_at).getFullYear()} Author(s)`),ms(l.licenseText||(a==null?void 0:a.copyright_text)||""),ft(!0)},className:"h-6",children:e.jsx(re,{className:"h-3 w-3"})})]}),is?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Copyright Statement"}),e.jsx(K,{value:os,onChange:s=>ls(s.target.value),placeholder:"©2024 Author(s)",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"License Text"}),e.jsx(Hr,{value:ds,onChange:s=>ms(s.target.value),placeholder:"License information...",className:"min-h-[80px] text-sm"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(N,{size:"sm",onClick:Ya,className:"h-7",children:[e.jsx(W,{className:"h-3 w-3 mr-1"}),"Save"]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>ft(!1),className:"h-7",children:[e.jsx(X,{className:"h-3 w-3 mr-1"}),"Cancel"]})]})]}):e.jsx("div",{className:"space-y-3 text-sm text-muted-foreground",children:e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:"Copyright"}),e.jsx("p",{children:l.copyright||`©${new Date(t.published_date||t.created_at).getFullYear()} Author(s)`}),e.jsx("p",{className:"mt-1",children:l.licenseText||(a==null?void 0:a.copyright_text)||"This is an open access article distributed under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License, which allows others to remix, tweak, and build upon the work non-commercially, as long as the author is credited and the new creations are licensed under the identical terms."})]})})]}),e.jsxs("div",{className:"pb-3 bg-muted/30 p-4 rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Funding Information"}),k&&!Jt&&e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>{var s,o;es(((s=l.funding)==null?void 0:s.grants)||""),ss(((o=l.funding)==null?void 0:o.acknowledgment)||""),xt(!0)},className:"h-6",children:e.jsx(re,{className:"h-3 w-3"})})]}),Jt?e.jsxs("div",{className:"space-y-2 mt-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Grants"}),e.jsx(K,{value:Kt,onChange:s=>es(s.target.value),placeholder:"e.g., NIH Grant R01-123456, NSF Award 7654321",className:"h-8"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Acknowledgment"}),e.jsx(K,{value:ts,onChange:s=>ss(s.target.value),placeholder:"Enter funding acknowledgment",className:"h-8"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(N,{size:"sm",onClick:Va,className:"h-7",children:[e.jsx(W,{className:"h-3 w-3 mr-1"}),"Save"]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>xt(!1),className:"h-7",children:[e.jsx(X,{className:"h-3 w-3 mr-1"}),"Cancel"]})]})]}):e.jsxs("div",{className:"mt-2 space-y-2 text-sm text-muted-foreground",children:[((ks=l.funding)==null?void 0:ks.grants)&&e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:"Grants"}),e.jsx("p",{children:l.funding.grants})]}),((Es=l.funding)==null?void 0:Es.acknowledgment)&&e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-foreground mb-1",children:"Acknowledgment"}),e.jsx("p",{children:l.funding.acknowledgment})]}),!((Ss=l.funding)!=null&&Ss.grants)&&!((As=l.funding)!=null&&As.acknowledgment)&&e.jsx("p",{className:"text-muted-foreground italic",children:"No funding information available"})]})]})]}),e.jsx(Qe,{value:"citations",className:"mt-4",children:e.jsx("div",{className:"max-w-2xl mx-auto",children:e.jsx(Sr,{doi:t.doi,title:t.title,authors:te,journal:(le==null?void 0:le.name)||"",year:t.published_date?new Date(t.published_date).getFullYear().toString():"",volume:(Ms=i==null?void 0:i.volume)==null?void 0:Ms.toString(),issue:(i==null?void 0:i.issue_number_text)||((Is=i==null?void 0:i.issue_number)==null?void 0:Is.toString()),pages:l.pages})})})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-6 text-sm text-muted-foreground",children:[t.published_date&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ke,{className:"h-4 w-4"}),Y&&k?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(We,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(N,{variant:"outline",size:"sm",className:q("h-8 justify-start text-left font-normal",!O&&"text-muted-foreground"),children:O?ge(O,"PPP"):e.jsx("span",{children:"Pick a date"})})}),e.jsx(Je,{className:"w-auto p-0",align:"start",children:e.jsx(Xe,{mode:"single",selected:O,onSelect:be,initialFocus:!0,className:q("p-3 pointer-events-auto")})})]}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:Ba,children:e.jsx(W,{className:"h-4 w-4 text-green-600"})}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>{ee(!1);const s=t.published_date?new Date(t.published_date):void 0;be(s&&!isNaN(s.getTime())?s:void 0)},children:e.jsx(X,{className:"h-4 w-4 text-red-600"})})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:"Published:"}
316),e.jsx("span",{children:Ve(t.published_date,"dd/MM/yyyy")||"Not set"}),k&&e.jsx(N,{size:"icon",variant:"ghost",className:"h-6 w-6",onClick:()=>{ee(!0);const s=t.published_date?new Date(t.published_date):void 0;be(s&&!isNaN(s.getTime())?s:new Date)},children:e.jsx(re,{className:"h-3 w-3"})})]})]}),t.revised_date&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ke,{className:"h-4 w-4"}),et&&k?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(We,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(N,{variant:"outline",size:"sm",className:q("h-8 justify-start text-left font-normal",!G&&"text-muted-foreground"),children:G?ge(G,"PPP"):e.jsx("span",{children:"Pick a date"})})}),e.jsx(Je,{className:"w-auto p-0",align:"start",children:e.jsx(Xe,{mode:"single",selected:G,onSelect:Ie,initialFocus:!0,className:q("p-3 pointer-events-auto")})})]}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:Ha,children:e.jsx(W,{className:"h-4 w-4 text-green-600"})}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>{ce(!1),Ie(t.revised_date?new Date(t.revised_date):void 0)},children:e.jsx(X,{className:"h-4 w-4 text-red-600"})})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:"Revised:"}),e.jsx("span",{children:Ve(t.revised_date,"dd/MM/yyyy")||"Not set"}),k&&e.jsx(N,{size:"icon",variant:"ghost",className:"h-6 w-6",onClick:()=>{ce(!0),Ie(new Date(t.revised_date))},children:e.jsx(re,{className:"h-3 w-3"})})]})]}),t.doi&&(()=>{const o=String(t.doi).replace(/<[^>]+>/g,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim(),f=o.replace(/^https?:\/\/(dx\.)?doi\.org\//i,"");return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4"}),ve&&k?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{value:ye,onChange:x=>$e(x.target.value),className:"h-8 w-64",placeholder:"Enter DOI"}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:qa,children:e.jsx(W,{className:"h-4 w-4 text-green-600"})}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>{Pe(!1),$e(o)},children:e.jsx(X,{className:"h-4 w-4 text-red-600"})})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:"DOI:"}),e.jsx("a",{href:`https://doi.org/${f}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:f}),k&&e.jsx(N,{size:"icon",variant:"ghost",className:"h-6 w-6",onClick:()=>{Pe(!0),$e(o)},children:e.jsx(re,{className:"h-3 w-3"})})]})]})})()]}),t.doi&&(()=>{const s=l!=null&&l.volume&&(l!=null&&l.issue)&&(l!=null&&l.pages)?`/article/${l.volume}/${l.issue}/${yr(String(l.pages))||""}`:null,o=async f=>{try{await navigator.clipboard.writeText(f),D.success("Copied to clipboard")}catch{D.error("Failed to copy")}};return e.jsxs("div",{className:"flex flex-col gap-1 text-xs text-muted-foreground pl-6",children:[s&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:"Permalink:"}),e.jsxs("a",{href:s,className:"text-primary hover:underline break-all",children:[window.location.origin,s]}),e.jsx("button",{onClick:()=>o(`${window.location.origin}${s}`),className:"inline-flex items-center justify-center p-0.5 rounded hover:bg-muted transition-colors shrink-0",title:"Copy link",type:"button",children:e.jsx(na,{className:"h-3 w-3 text-muted-foreground"})})]}),(()=>{const f=s||window.location.pathname.replace(/\/$/,""),x=`${window.location.origin}${f}.pdf`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:"PDF:"}),e.jsx("a",{href:x,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",children:x}),e.jsx("button",{onClick:()=>o(x),className:"inline-flex items-center justify-center p-0.5 rounded hover:bg-muted transition-colors shrink-0",title:"Copy link",type:"button",children:e.jsx(na,{className:"h-3 w-3 text-muted-foreground"})})]})})()]})})(),l.history&&((i==null?void 0:i.show_history_dates)!==!1||k)&&e.jsxs("div",{className:"flex flex-wrap gap-4 text-xs pt-2 opacity-80",children:[(l.history.received||k)&&e.jsx("div",{className:"flex items-center gap-1",children:ct&&k?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Received:"}),e.jsxs(We,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(N,{variant:"outline",size:"sm",className:q("h-6 text-xs justify-start font-normal",!we&&"text-muted-foreground"),children:we?ge(we,"dd/MM/yyyy"):e.jsx("span",{children:"Pick date"})})}),e.jsx(Je,{className:"w-auto p-0",align:"start",children:e.jsx(Xe,{mode:"single",selected:we,onSelect:He,initialFocus:!0,className:q("p-3 pointer-events-auto")})})]}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-5 w-5",onClick:()=>Ct("received",we),children:e.jsx(W,{className:"h-3 w-3 text-green-600"})}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-5 w-5",onClick:()=>{Be(!1);const s=l.history.received?new Date(l.history.received):void 0;He(s&&!isNaN(s.getTime())?s:void 0)},children:e.jsx(X,{className:"h-3 w-3 text-red-600"})})]}):e.jsxs(e.Fragment,{children:[l.history.received?e.jsxs("span",{children:["Received: ",Ve(l.history.received,"dd/MM/yyyy")||"
316Not set"]}):e.jsx("span",{className:"text-muted-foreground",children:"Received: Not set"}),k&&e.jsx(N,{size:"icon",variant:"ghost",className:"h-4 w-4 p-0",onClick:()=>{Be(!0);const s=l.history.received?new Date(l.history.received):void 0;He(s&&!isNaN(s.getTime())?s:new Date)},children:e.jsx(re,{className:"h-2.5 w-2.5"})})]})}),(l.history.revised||k)&&e.jsx("div",{className:"flex items-center gap-1",children:ka&&k?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Revised:"}),e.jsxs(We,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(N,{variant:"outline",size:"sm",className:q("h-6 text-xs justify-start font-normal",!Ge&&"text-muted-foreground"),children:Ge?ge(Ge,"dd/MM/yyyy"):e.jsx("span",{children:"Pick date"})})}),e.jsx(Je,{className:"w-auto p-0",align:"start",children:e.jsx(Xe,{mode:"single",selected:Ge,onSelect:ut,initialFocus:!0,className:q("p-3 pointer-events-auto")})})]}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-5 w-5",onClick:()=>Ct("revised",Ge),children:e.jsx(W,{className:"h-3 w-3 text-green-600"})}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-5 w-5",onClick:()=>{ht(!1);const s=l.history.revised?new Date(l.history.revised):void 0;ut(s&&!isNaN(s.getTime())?s:void 0)},children:e.jsx(X,{className:"h-3 w-3 text-red-600"})})]}):e.jsxs(e.Fragment,{children:[l.history.revised?e.jsxs("span",{children:["Revised: ",Ve(l.history.revised,"dd/MM/yyyy")||"Not set"]}):e.jsx("span",{className:"text-muted-foreground",children:"Revised: Not set"}),k&&e.jsx(N,{size:"icon",variant:"ghost",className:"h-4 w-4 p-0",onClick:()=>{ht(!0);const s=l.history.revised?new Date(l.history.revised):void 0;ut(s&&!isNaN(s.getTime())?s:new Date)},children:e.jsx(re,{className:"h-2.5 w-2.5"})})]})}),(l.history.accepted||k)&&e.jsx("div",{className:"flex items-center gap-1",children:_a&&k?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-medium",children:"Accepted:"}),e.jsxs(We,{children:[e.jsx(Ze,{asChild:!0,children:e.jsx(N,{variant:"outline",size:"sm",className:q("h-6 text-xs justify-start font-normal",!qe&&"text-muted-foreground"),children:qe?ge(qe,"dd/MM/yyyy"):e.jsx("span",{children:"Pick date"})})}),e.jsx(Je,{className:"w-auto p-0",align:"start",children:e.jsx(Xe,{mode:"single",selected:qe,onSelect:mt,initialFocus:!0,className:q("p-3 pointer-events-auto")})})]}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-5 w-5",onClick:()=>Ct("accepted",qe),children:e.jsx(W,{className:"h-3 w-3 text-green-600"})}),e.jsx(N,{size:"icon",variant:"ghost",className:"h-5 w-5",onClick:()=>{dt(!1);const s=l.history.accepted?new Date(l.history.accepted):void 0;mt(s&&!isNaN(s.getTime())?s:void 0)},children:e.jsx(X,{className:"h-3 w-3 text-red-600"})})]}):e.jsxs(e.Fragment,{children:[l.history.accepted?e.jsxs("span",{children:["Accepted: ",Ve(l.history.accepted,"dd/MM/yyyy")||"Not set"]}):e.jsx("span",{className:"text-muted-foreground",children:"Accepted: Not set"}),k&&e.jsx(N,{size:"icon",variant:"ghost",className:"h-4 w-4 p-0",onClick:()=>{dt(!0);const s=l.history.accepted?new Date(l.history.accepted):void 0;mt(s&&!isNaN(s.getTime())?s:new Date)},children:e.jsx(re,{className:"h-2.5 w-2.5"})})]})})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-3 pb-4 border-t border-border/30",children:[t.doi&&e.jsx("a",{href:`https://crossmark.crossref.org/dialog/?doi=${t.doi}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center border border-border rounded-none hover:border-primary/50 hover:bg-secondary transition-all",children:e.jsx("img",{src:"https://crossmark-cdn.crossref.org/widget/v2.0/logos/CROSSMARK_Color_horizontal.svg",alt:"Check for updates",className:"h-8"})}),e.jsx("div",{className:"ml-auto flex items-center gap-2",children:(a==null?void 0:a.show_google_scholar_citations)!==!1&&(t.google_scholar_citations||k)&&e.jsx(e.Fragment,{children:k?e.jsxs(Dt,{children:[e.jsx(Zs,{asChild:!0,children:e.jsx(Oe,{children:e.jsxs(_e,{children:[e.jsx(ke,{asChild:!0,children:e.jsxs("button",{className:"inline-flex items-center gap-2 px-3 py-1.5 border border-border rounded-none hover:border-primary/50 hover:bg-secondary transition-all h-8 group",children:[e.jsx("span",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:"google scholar"}),e.jsx("span",{className:"text-xl font-bold text-primary group-hover:scale-110 transition-transform",children:t.google_scholar_citations||0})]})}),e.jsx(Ee,{children:e.jsx("p",{children:"Click to edit Google Scholar Citations"})})]})})}),e.jsxs(Tt,{children:[e.jsx(wr,{children:e.jsx(Nr,{children:"Manage Google Scholar Citations"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(K,{type:"number",value:as,onChange:s=>Aa(s.target.value),className:"flex-1",placeholder:"0"}),e.jsxs(N,{onClick:Oa,children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),"Save"]})]}),e.jsxs(N,{variant:"outline",className:"w-full",onClick:Ua,disabled:rs||!t.doi,children:[e.jsx(qr,{className:`h-4 w-4 mr-2 ${rs?"animate-spin":""}`}),t.doi?"Fetch Latest Citations":"No DOI Available"]})]})]})]}):e.jsx(Oe,{children:e.jsxs(_e,{children:[e.jsx(ke,{asChild:!0,children:e.jsxs("a",{href:`https://scholar.google.com/scholar?q=${encodeURIComponent(t.doi||t.title)}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 px-3 py-1.5 border border-border rounded-none hover:border-primary/50 hover:bg-secondary transition-all h-8 group",children:[e.jsx("span",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:"google scholar"}),e.jsx("span",{className:"text-xl font-bold text-primary group-hover:scale-110 transition-transform",children:t.google_scholar_citations||0})]})}),e.jsx(Ee,{children:e.jsx("p",{children:"View in Google Scholar"})})]})})})})]})]})}),i&&e.jsx("div",{className:"w-64 shrink-0 hidden xl:block",children:e.jsxs("div",{className:"sticky top-20 space-y-4",children:[(a==null?void 0:a.show_article_navigator)!==!1&&_.length>0&&e.jsxs("div",{className:"bg-gradient-to-br from-primary/5 via-background to-primary/10 border border-border rounded-none shadow-lg overflow-hidden",children:[e.jsx("div",{className:"h-1 bg-muted",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${(y+1)/_.length*100}%`}})}),e.jsxs("div",{className:"p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(Oe,{children:e.jsxs(_e,{children:[e.jsx(ke,{asChild:!0,children:e.jsx(N,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full hover:bg-primary/10 text-foreground hover:text-primary",disabled:y<=0,onClick:()=>
316{if(y>0){const s=_[y-1];window.scrollTo(0,0),n(fe(s))}},children:e.jsx(Ot,{className:"h-4 w-4"})})}),y>0&&e.jsx(Ee,{side:"bottom",className:"max-w-[200px] text-center",children:e.jsx("p",{className:"text-xs line-clamp-2",children:(Ps=_[y-1])==null?void 0:Ps.title})})]})}),e.jsxs(St,{children:[e.jsx(it,{asChild:!0,children:e.jsxs("button",{className:"flex flex-col items-center gap-0.5 px-3 py-1.5 rounded-lg hover:bg-primary/10 transition-colors cursor-pointer group",children:[e.jsx("span",{className:"text-2xl font-bold text-primary group-hover:scale-110 transition-transform",children:y+1}),e.jsxs("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:["of ",_.length," articles"]})]})}),e.jsxs(At,{side:"right",className:"w-80 overflow-y-auto",children:[e.jsx(Mt,{children:e.jsxs(It,{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-5 w-5 text-primary"}),"Issue Contents"]})}),e.jsx("div",{className:"mt-4 space-y-1",children:_.map((s,o)=>e.jsx("button",{className:`w-full text-left py-3 px-3 rounded-lg transition-all ${s.id===(t==null?void 0:t.id)?"bg-primary text-primary-foreground shadow-md":"hover:bg-muted hover:translate-x-1"}`,onClick:()=>{window.scrollTo(0,0),n(fe(s))},children:e.jsxs("div",{className:"flex items-start gap-2 w-full",children:[e.jsx("span",{className:`text-xs font-bold min-w-[1.5rem] h-5 w-5 rounded-full flex items-center justify-center ${s.id===(t==null?void 0:t.id)?"bg-primary-foreground/20":"bg-primary/10 text-primary"}`,children:o+1}),e.jsx("span",{className:"text-sm flex-1 line-clamp-2 leading-tight",children:s.title})]})},s.id))})]})]}),e.jsx(Oe,{children:e.jsxs(_e,{children:[e.jsx(ke,{asChild:!0,children:e.jsx(N,{variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full hover:bg-primary/10 text-foreground hover:text-primary",disabled:y>=_.length-1,onClick:()=>{if(y<_.length-1){const s=_[y+1];window.scrollTo(0,0),n(fe(s))}},children:e.jsx(ot,{className:"h-4 w-4"})})}),y<_.length-1&&e.jsx(Ee,{side:"bottom",className:"max-w-[200px] text-center",children:e.jsx("p",{className:"text-xs line-clamp-2",children:($s=_[y+1])==null?void 0:$s.title})})]})})]}),e.jsxs(St,{children:[e.jsx(it,{asChild:!0,children:e.jsxs("button",{className:"w-full mt-2 text-xs text-primary hover:underline flex items-center justify-center gap-1 py-1",children:[e.jsx(Js,{className:"h-3 w-3"}),"Browse all articles"]})}),e.jsxs(At,{side:"right",className:"w-80 overflow-y-auto",children:[e.jsx(Mt,{children:e.jsxs(It,{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-5 w-5 text-primary"}),"Issue Contents"]})}),e.jsx("div",{className:"mt-4 space-y-1",children:_.map((s,o)=>e.jsx("button",{className:`w-full text-left py-3 px-3 rounded-lg transition-all ${s.id===(t==null?void 0:t.id)?"bg-primary text-primary-foreground shadow-md":"hover:bg-muted hover:translate-x-1"}`,onClick:()=>{window.scrollTo(0,0),n(fe(s))},children:e.jsxs("div",{className:"flex items-start gap-2 w-full",children:[e.jsx("span",{className:`text-xs font-bold min-w-[1.5rem] h-5 w-5 rounded-full flex items-center justify-center ${s.id===(t==null?void 0:t.id)?"bg-primary-foreground/20":"bg-primary/10 text-primary"}`,children:o+1}),e.jsx("span",{className:"text-sm flex-1 line-clamp-2 leading-tight",children:s.title})]})},s.id))})]})]})]})]}),(a==null?void 0:a.show_issue_block)!==!1&&e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-md hover:shadow-lg transition-shadow duration-300 overflow-hidden",children:[i.cover_image_url&&e.jsxs("div",{className:"relative group flex justify-center pt-4 px-4",children:[e.jsx("img",{src:i.cover_image_url,alt:`${i.title} cover`,className:"w-3/4 h-auto object-cover rounded-lg shadow-sm"}),k&&e.jsx("div",{className:"absolute top-6 right-6 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:gs,className:"hidden",disabled:I}),e.jsx("div",{className:"bg-background/90 hover:bg-background p-2 rounded-full shadow-lg backdrop-blur-sm",children:I?e.jsx("div",{className:"animate-spin h-4 w-4 border-2 border-primary border-t-transparent roun
316ded-full"}):e.jsx(ia,{className:"h-4 w-4"})})]})})]}),e.jsx("div",{className:"bg-muted/30 px-4 py-3 border-b border-border",children:e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4 text-primary"}),"Current Issue"]})}),!i.cover_image_url&&k&&e.jsx("div",{className:"p-4 border-b border-border/30",children:e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:gs,className:"hidden",disabled:I}),e.jsx(N,{variant:"outline",size:"sm",className:"w-full",disabled:I,children:I?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin h-4 w-4 border-2 border-primary border-t-transparent rounded-full mr-2"}),"Uploading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"h-4 w-4 mr-2"}),"Upload Cover"]})})]})}),e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsx("h4",{className:"font-bold text-sm text-foreground leading-tight",children:i.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.volume&&(i.issue_number||i.issue_number_text)&&e.jsxs(de,{variant:"secondary",className:"font-semibold text-xs",children:["Vol. ",i.volume,", No. ",i.issue_number_text||i.issue_number]}),i.year&&e.jsx(de,{variant:"outline",className:"font-semibold text-xs",children:i.year}),i.published_date&&e.jsxs(de,{variant:"outline",className:"font-semibold text-xs",children:[e.jsx(Ke,{className:"h-3 w-3 mr-1"}),new Date(i.published_date).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[e.jsxs(N,{variant:"default",size:"sm",className:"w-full font-semibold",onClick:()=>n(`/${i.volume}/${i.issue_number_text||i.issue_number}`),children:[e.jsx(nt,{className:"h-4 w-4 mr-2"}),"View All Articles"]}),e.jsxs(N,{variant:"outline",size:"sm",className:"w-full font-semibold border-2",onClick:()=>n("/archives"),children:[e.jsx(me,{className:"h-4 w-4 mr-2"}),"Browse Archives"]})]})]})]}),(a==null?void 0:a.show_featured_image)!==!1&&t.featured_image_url&&e.jsxs("div",{className:"bg-card border border-border rounded-lg shadow-md overflow-hidden",children:[e.jsx("div",{className:"bg-muted/30 px-4 py-3 border-b border-border",children:e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx(je,{className:"h-4 w-4 text-primary"}),"Featured Image"]})}),e.jsx("div",{className:"p-4",children:e.jsxs(Dt,{children:[e.jsx(Zs,{asChild:!0,children:e.jsx("img",{src:t.featured_image_url,alt:`Featured image for ${t.title}`,className:"w-full h-auto rounded-lg cursor-pointer hover:opacity-90 transition-opacity"})}),e.jsx(Tt,{className:"max-w-4xl max-h-[90vh] overflow-auto",children:e.jsx("img",{src:t.featured_image_url,alt:`Featured image for ${t.title}`,className:"w-full h-auto"})})]})})]})]})})]})})}),e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-[1400px]",children:[e.jsxs("div",{className:`grid grid-cols-1 gap-8 relative ${Te.left.length>0&&Te.right.length>0?"lg:grid-cols-[280px_1fr_360px]":Te.left.length>0?"lg:grid-cols-[280px_1fr]":Te.right.length>0?"lg:grid-cols-[1fr_360px]":"lg:grid-cols-1"}`,children:[Te.left.length>0&&e.jsx("aside",{className:"hidden lg:block self-start",children:e.jsx("div",{className:"sticky top-20 max-h-[calc(100vh-6rem)] overflow-y-auto",children:e.jsx(Pt,{articleId:t.id,sections:V.map(s=>({title:s.title})),doi:t.doi,title:t.title,authors:te,journal:le,year:t.published_date,volume:l.volume,issue:l.issue,pages:l.pages,pdfLink:t.pdf_url,downloadUrls:{pdf:t.pdf_url,supplementary:t.supplementary_url,dataset:t.dataset_url,lens:t.lens_url},currentSidebar:"left",onConfigChange:hs,keywords:st,issueId:t.issue_id,abstract:Fe,content:t.content,publishedDate:t.published_date,scopusCitations:t.scopus_citations,googleScholarCitations:t.google_scholar_citations,figuresCount:Z.length,tablesCount:J.length,onOpenGallery:kt})})}),e.jsxs("article",{className:"prose prose-base dark:prose-invert max-w-none min-w-0 overflow-hidden [&_h2]:text-2xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-6 [&_h2]:tracking-tight [&_p]:text-foreground
316/90 [&_p]:leading-relaxed [&_p]:text-base",children:[(a==null?void 0:a.show_abstract_section)!==!1&&Fe&&e.jsxs(e.Fragment,{children:[e.jsx("section",{className:"mb-8 not-prose relative",children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-border/30 bg-gradient-to-br from-background via-background to-muted/20 shadow-lg",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.03]",style:{backgroundImage:"radial-gradient(circle at 1px 1px, currentColor 1px, transparent 0)",backgroundSize:"24px 24px"}}),e.jsx("div",{className:"absolute top-0 right-0 w-64 h-64 bg-gradient-to-bl from-primary/10 to-transparent rounded-full -translate-y-1/2 translate-x-1/2 blur-3xl"}),e.jsx("div",{className:"absolute bottom-0 left-0 w-48 h-48 bg-gradient-to-tr from-accent/10 to-transparent rounded-full translate-y-1/2 -translate-x-1/2 blur-2xl"}),e.jsx("div",{className:"relative z-10 px-6 md:px-8 pt-6 md:pt-8 pb-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground tracking-tight",children:"Abstract"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Research summary & visual representation"})]}),e.jsx(Fr,{abstract:Fe,title:wt,children:e.jsxs(N,{variant:"outline",size:"sm",className:"gap-2 bg-background/80 backdrop-blur-sm border-border/50 hover:bg-primary hover:text-primary-foreground hover:border-primary hover:shadow-lg hover:shadow-primary/20 transition-all duration-300 group",children:[e.jsx(Ft,{className:"h-4 w-4 group-hover:animate-pulse"}),e.jsx("span",{children:"View Options"}),e.jsx(ot,{className:"h-3 w-3 opacity-60 group-hover:translate-x-0.5 transition-transform"})]})})]})}),e.jsx("div",{className:"relative z-10 px-6 md:px-8",children:e.jsxs(zt,{defaultValue:"text",className:"w-full",children:[e.jsx("div",{className:"flex items-center gap-2 pb-4 overflow-x-auto",children:e.jsxs(Lt,{className:"inline-flex h-auto items-center gap-2 bg-transparent p-0",children:[e.jsxs(Se,{value:"text",className:"relative px-5 py-2.5 rounded-full text-sm font-medium transition-all duration-300 data-[state=inactive]:bg-muted/50 data-[state=inactive]:text-muted-foreground data-[state=inactive]:hover:bg-muted data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-lg data-[state=active]:shadow-primary/30 gap-2 border-0",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{children:"Text"})]}),(a==null?void 0:a.show_graphical_abstract)!==!1&&t.graphical_abstract_url&&e.jsxs(Se,{value:"graphical",className:"relative px-5 py-2.5 rounded-full text-sm font-medium transition-all duration-300 data-[state=inactive]:bg-muted/50 data-[state=inactive]:text-muted-foreground data-[state=inactive]:hover:bg-muted data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-lg data-[state=active]:shadow-primary/30 gap-2 border-0",children:[e.jsx(je,{className:"h-4 w-4"}),e.jsx("span",{children:"Graphical"})]}),t.pdf_url&&e.jsxs(Se,{value:"pdf",className:"relative px-5 py-2.5 rounded-full text-sm font-medium transition-all duration-300 data-[state=inactive]:bg-muted/50 data-[state=inactive]:text-muted-foreground data-[state=inactive]:hover:bg-muted data-[state=active]:bg-primary data-[state=active]:text-primary-foreground data-[state=active]:shadow-lg data-[state=active]:shadow-primary/30 gap-2 border-0",children:[e.jsx(nt,{className:"h-4 w-4"}),e.jsx("span",{children:"PDF"})]})]})}),e.jsx(Qe,{value:"text",className:"mt-0 animate-fade-in pb-6 md:pb-8",children:e.jsxs("div",{className:"bg-background/60 backdrop-blur-sm rounded-xl border border-border/30 p-6 md:p-8 shadow-inner",children:[k&&!cs&&e.jsx("div",{className:"flex items-center justify-end mb-4",children:e.jsxs(N,{variant:"outline",size:"sm",className:"gap-2 rounded-full hover:bg-primary hover:text-primary-foreground transition-all",onClick:()=>{vt(t.abstract||""),bt(!0)},children:[e.jsx(re,{className:"h-4 w-4"}),"Edit Abstract"]})}),cs&&k?e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-background rounded-lg border border-border overflow-hidden [&_.ql-toolbar]:border-b [&_.ql-toolbar]:border-border [&_.ql-toolbar]:bg-muted/50 [&_.ql-container]:border-0 [&_.ql-editor]:min-h-[300px] [&_.ql-editor]:text-foreground [&_.ql-editor]:text-sm [&_.ql-editor]:leading-relaxed",children:e.jsx(j.Suspense,{fallback:e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading editorâ¦"}),children:e.jsx(vn,{theme:"snow",value:jt,onChange:vt,placeholder:"Enter abstract text...",modules:{toolbar:[["bold","italic","underline","strike"],["blockquote"],[{script:"sub"},{script:"super"}],[{list:"ordered"},{list:"bullet"}],["link"],["clean"]]},formats:["bold","italic","underline","strike","blockquote","script","list","bullet","link"]})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(N,{size:"sm",onClick:Qa,className:"gap-2",children:[e.jsx(W,{className:"h-4 w-4"}),"Save"]}),e.jsxs(N,{size:"sm",variant:"outline",onClick:()=>{bt(!1),vt("")},className:"gap-2",children:[e.jsx(X,{className:"h-4 w-4"}),"Cancel"]})]})]}):e.jsx("div",{ref:yt,className:"prose prose-base max-w-none [&_p]:text-foreground
316/90 [&_p]:leading-relaxed [&_p]:text-[15px] [&_strong]:font-bold [&_b]:font-bold [&_h3]:font-bold [&_h4]:font-bold [&_h5]:font-bold [&_h6]:font-bold [&_.abstract-heading]:font-bold",children:e.jsx(xe,{content:Fe,references:se,figures:Z,tables:J,referenceStyle:ae,isAbstract:!0})})]})}),(a==null?void 0:a.show_graphical_abstract)!==!1&&t.graphical_abstract_url&&e.jsxs(Qe,{value:"graphical",className:"mt-0 animate-fade-in pb-6 md:pb-8",children:[k&&e.jsxs("div",{className:"flex items-center justify-end gap-2 mb-4",children:[e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:Nt,className:"hidden"}),e.jsx(N,{variant:"outline",size:"sm",className:"gap-2 rounded-full hover:bg-primary hover:text-primary-foreground transition-all",disabled:Re,asChild:!0,children:e.jsxs("span",{children:[e.jsx(je,{className:"h-4 w-4"}),Re?"Uploading...":"Change"]})})]}),e.jsxs(N,{variant:"outline",size:"sm",className:"gap-2 rounded-full text-destructive hover:bg-destructive hover:text-destructive-foreground transition-all",onClick:fs,children:[e.jsx(Ks,{className:"h-4 w-4"}),"Delete"]})]}),e.jsx("div",{className:"bg-background/60 backdrop-blur-sm rounded-xl border border-border/30 p-6 flex items-center justify-center transition-all duration-300 shadow-inner hover:shadow-lg group",style:{minHeight:tt?`${tt}px`:"300px"},children:e.jsx("img",{src:t.graphical_abstract_url,alt:"Graphical Abstract",className:"w-auto h-auto max-w-full object-contain transition-all duration-500 group-hover:scale-[1.02] rounded-lg",style:{maxHeight:tt?`${tt}px`:"500px"}})})]}),t.pdf_url&&e.jsx(Qe,{value:"pdf",className:"mt-0 animate-fade-in pb-6 md:pb-8",children:e.jsx("div",{className:"rounded-xl overflow-hidden border border-border/30",children:e.jsx(j.Suspense,{fallback:e.jsx("div",{className:"p-8 text-center text-sm text-muted-foreground",children:"Loading PDF viewerâ¦"}),children:e.jsx(jn,{pdfUrl:t.pdf_url,title:t.title||"Article PDF"})})})})]})})]})}),e.jsx(Q,{className:"my-6"})]}),!t.abstract&&(a==null?void 0:a.show_graphical_abstract)!==!1&&t.graphical_abstract_url&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"mb-8 not-prose bg-gradient-to-br from-primary/5 via-primary/3 to-transparent p-5 rounded-none border border-border/30",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Graphical Abstract"}),k&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:Nt,className:"hidden"}),e.jsx(N,{variant:"outline",size:"sm",className:"gap-2",disabled:Re,asChild:!0,children:e.jsxs("span",{children:[e.jsx(je,{className:"h-4 w-4"}),Re?"Uploading...":"Change Image"]})})]}),e.jsxs(N,{variant:"outline",size:"sm",className:"gap-2 text-destructive hover:bg-destructive hover:text-destructive-foreground",onClick:fs,children:[e.jsx(Ks,{className:"h-4 w-4"}),"Delete"]})]})]}),e.jsx("div",{className:"bg-card rounded-none border border-border p-4",children:e.jsx("img",{src:t.graphical_abstract_url,alt:"Graphical Abstract",className:"w-full h-auto max-w-3xl mx-auto"})})]}),e.jsx(Q,{className:"my-6"})]}),!t.abstract&&k&&(a==null?void 0:a.show_graphical_abstract)!==!1&&!t.graphical_abstract_url&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"mb-8 not-prose bg-gradient-to-br from-primary/5 via-primary/3 to-transparent p-5 rounded-none border border-border/30",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Graphical Abstract"}),e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",onChange:Nt,className:"hidden"}),e.jsx(N,{variant:"outline",size:"sm",className:"gap-2",disabled:Re,asChild:!0,children:e.jsxs("span",{children:[e.jsx(ia,{className:"h-4 w-4"}),Re?"Uploading...":"Upload Image"]})})]})]}),e.jsxs("div",{className:"bg-card/50 rounded-none border-2 border-dashed border-border p-8 text-center",children:[e.jsx(je,{className:"h-12 w-12 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-muted-foreground",children:"No graphical abstract uploaded yet"})]})]}),e.jsx(Q,{className:"my-6"})]}),(a==null?void 0:a.show_qr_code)!==!1&&e.jsx("div",{className:"mb-6",children:e.jsxs("section",{className:"not-prose bg-gradient-to-br from-accent/10 via-accent/5 to-transparent p-3 rounded-none border border-accent/20 max-w-md",children:[e.jsx("h3",{className:"text-sm font-bold text-foreground mb-2",children:"Share on Mobile"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-white p-2 rounded-none border border-border",children:e.jsx(Ca,{value:window.location.href,size:80})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Scan to access on mobile"}),e.jsxs(N,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{const s=document.querySelector("svg");if(s){const f=new window.XMLSerializer().serializeToString(s),x=document.createElement("canvas"),A=
316x.getContext("2d"),E=new window.Image;E.onload=()=>{x.width=E.width,x.height=E.height,A==null||A.drawImage(E,0,0),x.toBlob(P=>{if(P){const z=URL.createObjectURL(P),F=document.createElement("a");F.href=z,F.download="article-qr-code.png",F.click(),URL.revokeObjectURL(z)}})},E.src="data:image/svg+xml;base64,"+btoa(f)}},children:[e.jsx(Xr,{className:"h-3 w-3 mr-1"}),"Download"]})]})]})]})}),e.jsx(Q,{className:"my-6"}),t.keywords&&t.keywords.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"mb-8 not-prose",children:[e.jsx("h2",{className:"text-xl font-bold mb-4 text-foreground",children:"Keywords"}),e.jsx("div",{className:"flex flex-wrap gap-3",children:t.keywords.map((s,o)=>e.jsx(de,{variant:"secondary",className:"px-4 py-2 text-sm font-medium hover:bg-primary hover:text-primary-foreground transition-colors cursor-default",children:s},o))})]}),e.jsx(Q,{className:"my-6"})]}),e.jsx(an,{content:t.content||V.map(s=>s.content||"").join(" "),abstract:t.abstract||""}),e.jsx("div",{className:"article-reading-area",children:V.length>0?V.map((s,o)=>e.jsxs("div",{children:[e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{id:s.title.toLowerCase().replace(/\s+/g,"-"),className:"text-2xl font-bold mb-4 text-foreground scroll-mt-20 tracking-tight",children:s.title}),e.jsx("div",{className:"prose prose-base max-w-none [&_p]:text-foreground/90 [&_p]:leading-relaxed [&_h3+p]:mt-2 [&_h4+p]:mt-2 [&_h5+p]:mt-2",children:e.jsx(xe,{content:s.content,references:se,figures:Z,tables:J,referenceStyle:ae})}),s.tables&&s.tables.map((f,x)=>e.jsx(Ar,{id:f.id,html:f.html,caption:f.caption,label:f.label,references:se,referenceStyle:ae,boldCaption:(a==null?void 0:a.bold_figure_table_captions)!==!1},x)),s.figures&&s.figures.map((f,x)=>e.jsx(Pr,{id:f.id,src:f.imageUrl,alt:f.caption,caption:f.caption,label:f.label,references:se,referenceStyle:ae,boldCaption:(a==null?void 0:a.bold_figure_table_captions)!==!1},x))]}),o<V.length-1&&e.jsx(Q,{className:"my-6"})]},o)):t.content&&t.content!==t.abstract&&e.jsx("section",{className:"mb-8 prose prose-base max-w-none [&_p]:text-foreground/90 [&_p]:leading-relaxed",children:e.jsx(xe,{content:t.content,references:se,figures:Z,tables:J,referenceStyle:ae})})}),((Rs=l.additionalSections)==null?void 0:Rs.abbreviations)&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"my-6"}),e.jsxs("section",{className:"mb-8 not-prose bg-gradient-to-br from-accent/5 to-transparent p-6 rounded-lg border border-accent/20",children:[e.jsxs("h2",{className:"text-xl font-bold mb-4 text-foreground tracking-tight flex items-center gap-2",children:[e.jsx(me,{className:"h-5 w-5 text-accent"}),"Abbreviations"]}),e.jsx("div",{className:"text-foreground/90 leading-relaxed space-y-2",children:l.additionalSections.abbreviations.split(";").map((s,o)=>{const f=s.trim();if(!f)return null;const x=f.split(":");return x.length===2?e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("span",{className:"font-bold text-primary min-w-fit",children:[x[0].trim(),":"]}),e.jsx("span",{className:"text-foreground/80",children:x[1].trim()})]},o):e.jsx("div",{className:"text-foreground/80",children:f},o)})})]})]}),((Ds=l.additionalSections)==null?void 0:Ds.acknowledgments)&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"my-8"}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-2xl font-bold mb-4 text-foreground",children:"Acknowledgments"}),e.jsx(xe,{content:l.additionalSections.acknowledgments,references:se,figures:Z,tables:J,referenceStyle:ae})]})]}),((Ts=l.additionalSections)==null?void 0:Ts.authorContributions)&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"my-8"}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-2xl font-bold mb-4 text-foreground",children:"Author Contributions"}),e.jsx(xe,{content:l.additionalSections.authorContributions,references:se,figures:Z,tables:J,referenceStyle:ae})]})]}),((Fs=l.additionalSections)==null?void 0:Fs.conflictOfInterest)&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"my-8"}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-2xl font-bold mb-4 text-foreground",children:"Conflict of Interest"}),e.jsx(xe,{content:l.additionalSections.conflictOfInterest,references:se,figures:Z,tables:J,referenceStyle:ae})]})]}),((zs=l.additionalSections)==null?void 0:zs.funding)&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"my-8"}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-2xl font-bold mb-4 text-foreground",children:"Funding"}),e.jsx(xe,{content:l.additionalSections.funding,references:se,figures:Z,tables:J,referenceStyle:ae})]})]}),((Ls=l.additionalSections)==null?void 0:Ls.dataAvailability)&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"my-8"}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-2xl font-bold mb-4 text-foreground",children:"Data Availability"}),e.jsx(xe,{content:l.additionalSections.dataAvailability,references:se,figures:Z,tables:J,referenceStyle:ae})]})]}),((Os=l.additionalSections)==null?void 0:Os.ethicsStatement)&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"my-8"}),e.jsxs("section",{className:"mb-8",children:[e.jsx("h2",{className:"text-2xl font-bold mb-4 text-foreground",children:"Ethics Statement"}),e.jsx(xe,{content:l.additionalSections.ethicsStatement,references:se,figures:Z,tables:J,referenceStyle:ae})]})]}),se.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Q,{className:"my-6"}),e.jsxs("section",{className:"mb-8 not-prose bg-gradient-to-br from-muted/30 to-transparent p-4 rounded-none border border-border/50",children:[e.jsx("h2",{className:"text-lg font-bold mb-3 text-foreground tracking-tight",children:"References"}),e.jsx("div",{className:"space-y-1",children:se.map((s,o)=>e.jsxs("div",{id:s.id,className:"relative text-foreground scroll-mt-24 hover:bg-secondary/40 p-2 rounded-none transition-all pl-10 text-left group border border-transparent hover:border-border/30",style:{fontFamily:"var(--reference-font, Inter)",fontSize:"var(--reference-font-size, 0.75rem)",fontWeight:"var(--reference-font-we
316ight, 400)",lineHeight:"1.5"},children:[e.jsx("button",{onClick:f=>{f.preventDefault();const x=document.querySelectorAll("[data-ref-ids]");let A=null;x.forEach(E=>{const P=E.getAttribute("data-ref-ids");P&&P.split(",").includes(s.id)&&(A=E)}),A&&(A.scrollIntoView({behavior:"smooth",block:"center"}),A.classList.add("reference-highlight"),setTimeout(()=>{A==null||A.classList.remove("reference-highlight")},3e3))},className:"absolute left-2 top-2 text-primary hover:text-primary/80 transition-all opacity-0 group-hover:opacity-100",title:"Back to citation",children:e.jsx(Gr,{className:"h-4 w-4"})}),ae==="Vancouver"&&e.jsxs("span",{className:"font-bold mr-1",children:[o+1,"."]}),ae==="Vancouver"?sr(s):tr(s)]},o))})]})]}),e.jsx(cn,{title:t.title,doi:t.doi}),(Ne||Ce)&&e.jsxs("div",{className:"mt-12 mb-8",children:[e.jsx(Q,{className:"mb-6"}),e.jsx(Oe,{children:e.jsxs("div",{className:"flex gap-2 justify-between",children:[Ne?e.jsxs(_e,{children:[e.jsx(ke,{asChild:!0,children:e.jsx(N,{variant:"outline",size:"icon",className:"h-10 w-10 hover:bg-primary hover:text-primary-foreground hover:border-primary transition-all group",onClick:()=>at(Ne),children:e.jsx(Ot,{className:"h-5 w-5 group-hover:-translate-x-1 transition-transform"})})}),e.jsxs(Ee,{side:"top",className:"max-w-xs",children:[e.jsx("p",{className:"font-medium",children:"Previous Article"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:Ne.title})]})]}):e.jsx("div",{}),Ce?e.jsxs(_e,{children:[e.jsx(ke,{asChild:!0,children:e.jsx(N,{variant:"outline",size:"icon",className:"h-10 w-10 hover:bg-primary hover:text-primary-foreground hover:border-primary transition-all group",onClick:()=>at(Ce),children:e.jsx(ot,{className:"h-5 w-5 group-hover:translate-x-1 transition-transform"})})}),e.jsxs(Ee,{side:"top",className:"max-w-xs",children:[e.jsx("p",{className:"font-medium",children:"Next Article"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:Ce.title})]})]}):e.jsx("div",{})]})})]})]}),e.jsx("div",{className:"lg:hidden fixed bottom-20 right-6 z-[40] animate-fade-in",children:e.jsxs(St,{children:[e.jsx(it,{asChild:!0,children:e.jsxs(N,{size:"lg",className:"rounded-full shadow-lg hover-scale transition-all duration-200",children:[e.jsx(Js,{className:"h-5 w-5"}),e.jsx("span",{className:"ml-2",children:"Article Tools"})]})}),e.jsxs(At,{side:"right",className:"w-full sm:w-96 overflow-y-auto flex flex-col",children:[e.jsx(Mt,{children:e.jsx(It,{children:"Article Tools & Navigation"})}),e.jsxs("div",{className:"mt-6 space-y-6 flex-1 overflow-y-auto",children:[(a==null?void 0:a.show_table_of_contents)!==!1&&e.jsx("div",{className:"lg:hidden",children:e.jsx(la,{sections:V.map(s=>({title:s.title}))})}),e.jsx(Pt,{articleId:t.id,sections:V.map(s=>({title:s.title})),doi:t.doi,title:t.title,authors:te,journal:le,year:t.published_date,volume:l.volume,issue:l.issue,pages:l.pages,pdfLink:t.pdf_url,downloadUrls:{pdf:t.pdf_url,supplementary:t.supplementary_url,dataset:t.dataset_url,lens:t.lens_url},abstract:t.abstract,content:t.content,publishedDate:t.published_date,scopusCitations:t.scopus_citations,googleScholarCitations:t.google_scholar_citations,figuresCount:Z.length,tablesCount:J.length,onOpenGallery:kt})]}),e.jsx("div",{className:"sticky bottom-0 pt-4 pb-2 bg-background border-t",children:e.jsx(it,{asChild:!0,children:e.jsxs(N,{variant:"outline",className:"w-full gap-2",children:[e.jsx(X,{className:"h-4 w-4"}),"Close Sidebar"]})})})]})]})}),Te.right.length>0&&e.jsx("aside",{className:"hidden lg:block sticky top-24 self-start",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(Pt,{articleId:t.id,sections:V.map(s=>({title:s.title})),doi:t.doi,title:t.title,authors:te,journal:le,year:t.published_date,volume:l.volume,issue:l.issue,pages:l.pages,pdfLink:t.pdf_url,downloadUrls:{pdf:t.pdf_url,supplementary:t.supplementary_url,dataset:t.dataset_url,lens:t.lens_url},currentSidebar:"right",onConfigChange:hs,keywords:st,issueId:t.issue_id,abstract:Fe,content:t.content,publishedDate:t.published_date,scopusCitations:t.scopus_citations,googleScholarCitations:t.google_scholar_citations,figuresCount:Z.length,tablesCount:J.length,onOpenGallery:kt}),(a==null?void 0:a.show_table_of_contents)!==!1&&V.length>0&&e.jsx("div",{className:"mt-3",children:e.jsx(la,{sections:V.map(s=>({title:s.title}))})})]})})]}),(a==null?void 0:a.show_related_articles)!==!1&&e.jsx("div",{className:"mt-16",children:e.jsx(Kr,{currentArticleId:t.id,keywords:st,issueId:t.issue_id})}),e.jsx(tn,{currentArticle:t})]}),e.jsx(Mr,{onPrevious:()=>Ne&&at(Ne),onNext:()=>Ce&&at(Ce),onDownloadPDF:Wa,pdfUrl:t.pdf_url,onDownloadCitationBibTeX:Za,onDownloadCitationRIS:Ja,onDownloadCitationEndNote:Ka,onDownloadEPUB:er,onScrollToTop:Xa,hasPrevious:!!Ne,hasNext:!!Ce,shareUrl:window.location.href,shareTitle:(t==null?void 0:t.t
316itle)||"Article"}),e.jsx(Ws,{})]})};export{ci 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.