PageSourceSearch

https://cyprusinfo.ai/assets/ArticleDetail-DmnBeztq.js

js cyprusinfo.ai collected 2026-10-05 12:21:27 UTC 33,327 bytes, 1 lines download raw bytes

1import{a as pe,c as l,aD as xe,j as e,ay as at,f as rt,ab as it,ac as nt,ad as lt,ai as Re,ae as ot,af as ct,bi as O,az as dt,aA as R,aC as ut,B as M,aB as Te,a1 as Be,aX as mt,T as ht,V as gt,bk as pt,L as le,aF as K,b0 as Ce,z as xt,bj as Ae,x as oe,y as ce,bd as Ie,be as De,bf as Me,a8 as ft,Z as bt,av as yt,F as jt,b6 as wt,ax as he,bl as vt,bm as Nt,a3 as _t,bn as St}from"./index-Bn9xBJf1.js";import{B as ge}from"./badge-D7QvJndW.js";import{B as Et}from"./Breadcrumbs-DQGtJ0nh.js";import{A as kt}from"./ArticleCard-DaUEUkah.js";import{d as Ct,e as At,f as It,g as Dt}from"./useArticles-DjV8hONH.js";import{S as Mt}from"./SEO-B7ujsmmr.js";import{a as Rt,S as Tt,M as Bt}from"./ShareModal-uvkh4Gin.js";import{b as Lt,c as Ht}from"./schemaMarkup-l1zYug99.js";import"./MindMap-BYrKIbGG.js";import{S as $t}from"./share-2-BetE7M9z.js";import"./twitter-kCmFRkcV.js";import"./external-link-CWu4R1Xp.js";import"./copy-C2XMJKz2.js";const Ut=({article:C,isOpen:T,onClose:W,section:a="articles"})=>{const{t:d,language:c}=pe(),[m,N]=l.useState([]),[H,X]=l.useState(""),[k,Q]=l.useState(!1),[D,A]=l.useState(!1),[de,z]=l.useState(!1),G=l.useRef(null),Z=l.useRef(null),J=l.useRef(null),ee=l.useRef({});l.useEffect(()=>{if(T&&m.length===0){const i={id:Date.now().toString(),type:"bot",content:d("article_ask_ai.welcome","Hello! I'm here to help you with this article. Let me start by providing you with a summary..."),timestamp:new Date};N([i]),ue()}},[T,d]);const te=i=>{const o=ee.current[i];if(!o||!J.current)return;const u=J.current.querySelector("[data-radix-scroll-area-viewport]");if(u){const _=u.getBoundingClientRect(),f=o.getBoundingClientRect().top-_.top+u.scrollTop,j=Math.max(0,f-0);u.scrollTo({top:j,behavior:"smooth"})}},ue=async()=>{A(!0);try{const i=await xe("article-ask-ai",{type:"summary",lang:c,articleSlug:C.slug,section:a}),o=i.text||i.output||i.response||"I apologize, but I couldn't generate a summary at the moment.",u={id:(Date.now()+1).toString(),type:"bot",content:o,timestamp:new Date};N(_=>[..._,u])}catch(i){console.error("Error loading initial summary:",i);const o={id:(Date.now()+1).toString(),type:"bot",content:d("article_ask_ai.summary_error","I apologize, but I couldn't load the summary right now. Feel free to ask me any questions about the article!"),timestamp:new Date};N(u=>[...u,o])}finally{A(!1)}};l.useEffect(()=>{var i;if(m.length>0){const o=m[m.length-1];if(o.type==="user"||k||D)(i=G.current)==null||i.scrollIntoView({behavior:"smooth"});else if(o.type==="bot"&&!k&&!D){let u=null;for(let g=m.length-1;g>=0;g--)if(m[g].type==="user"){u=m[g].id;break}const _=u||o.id;te(_)}}},[m,k,D]),l.useEffect(()=>{T&&setTimeout(()=>{var i;(i=Z.current)==null||i.focus()},100)},[T]);const se=async(i,o)=>{try{const u=await xe("article-ask-ai",{query:i,history:o,articleSlug:C.slug,lang:c,section:a});return u.text||u.output||u.response||"I apologize, but I couldn't process your request at the moment."}catch(u){throw console.error("Error calling article ask AI API:",u),u}},V=async i=>{const o=i||H.trim();if(!o||k)return;Q(!0),X("");const u={id:Date.now().toString(),type:"user",content:o,timestamp:new Date};N(g=>[...g,u]);const _=m.map(g=>({type:g.type,content:g.content})).reverse();try{const g=await se(o,_),f={id:(Date.now()+1).toString(),type:"bot",content:g,timestamp:new Date};N(j=>[...j,f])}catch(g){console.error("Error in handleSendMessage:",g);const f={id:(Date.now()+1).toString(),type:"bot",content:d("article_ask_ai.error.connection","I apologize, but I'm having trouble connecting right now. Please try again later."),timestamp:new Date};N(j=>[...j,f])}finally{Q(!1)}},me=i=>{i.key==="Enter"&&!i.shiftKey&&(i.preventDefault(),V())},Y=i=>{V(i)},ae=l.useMemo(()=>[d("article_ask_ai.starter.key_points","What are the key points?"),d("article_ask_ai.starter.practical_tips","Give me practical tips"),d("article_ask_ai.starter.more_info","Where can I find more information?"),d("article_ask_ai.starter.related_topics","What are related topics?")],[d]),fe=l.memo(({content:i})=>{const{t:o}=pe(),[u,_]=l.useMemo(()=>{const f=i.match(/<propose>(.*?)<\/propose>/);let j=i,B=[];if(f){j=i.replace(/<propose>.*?<\/propose>/,"").trim();const re=/<button>(.*?)<\/button>
1/g;let w;for(;(w=re.exec(f[1]))!==null;)B.push(w[1])}return j=j.replace(/<ExternalLink\s+url="([^"]+)">([^<]+)<\/ExternalLink>/gi,(re,w,ie)=>{const $=/^\+?[\d\s()-]{7,}$/;return w.startsWith("tel:")||$.test(ie)&&!w.match(/^(https?:\/\/|mailto:)/i)?w.startsWith("tel:")||(w="tel:"+w.replace(/\s+/g,"")):w.match(/^(https?:\/\/|mailto:|tel:)/i)||(w="https://"+w),`[${ie}](${w})`}),[j,B]},[i]),g=l.useMemo(()=>({a:({href:f,children:j,...B})=>e.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"text-orange-500 hover:text-orange-600 underline",...B,children:j}),p:({children:f})=>e.jsx("span",{className:"inline",children:f})}),[]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"text-sm prose prose-sm max-w-none prose-headings:text-gray-700 prose-strong:text-gray-600 prose-a:text-orange-500 prose-code:text-gray-600 prose-code:bg-gray-50",children:e.jsx(at,{components:g,children:u})}),_.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-sm font-medium text-gray-700",children:o("article_ask_ai.suggested_questions","You might also want to ask:")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:_.map((f,j)=>e.jsxs("button",{onClick:()=>Y(f),className:"px-3 py-1.5 text-sm bg-gradient-to-r from-orange-100 to-amber-100 hover:from-orange-200 hover:to-amber-200 text-gray-700 rounded-full transition-colors duration-200 shadow-sm hover:shadow flex items-center gap-2 group",children:[e.jsx(rt,{className:"w-4 h-4 text-orange-400 group-hover:text-orange-500"}),f]},j))})]})]})});return e.jsx(it,{open:T,onOpenChange:W,children:e.jsxs(nt,{size:"lg",height:"tall",layout:"flex",className:"p-0",children:[e.jsx(lt,{className:"rounded-t-lg px-6 py-4 border-b bg-gradient-to-r from-orange-50 to-amber-50",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-[#ED8000] to-[#d17200] shadow-lg",children:e.jsx(Re,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx(ot,{className:"text-lg font-semibold bg-gradient-to-r from-[#ED8000] to-[#d17200] bg-clip-text text-transparent",children:d("article_ask_ai.title","Ask & Summarize with AI")}),e.jsx(ct,{className:"text-sm text-gray-600",children:O(C.title,c)})]})]})}),e.jsx(dt,{ref:J,className:"flex-1 px-6 py-4",children:e.jsxs("div",{className:"space-y-4",children:[m.map(i=>e.jsx("div",{ref:o=>{ee.current[i.id]=o},className:R("flex",i.type==="user"?"justify-end":"justify-start"),children:e.jsxs("div",{className:R("max-w-[80%] rounded-2xl px-4 py-3 text-sm",i.type==="user"?"bg-gradient-to-r from-[#ED8000] to-[#d17200] text-white":"bg-gray-100 text-gray-900"),children:[i.type==="bot"?e.jsx(fe,{content:i.content}):e.jsx("p",{className:"whitespace-pre-wrap",children:i.content}),e.jsx("div",{className:R("text-xs mt-1 opacity-70",i.type==="user"?"text-orange-100":"text-gray-500"),children:i.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})},i.id)),D&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-gray-100 rounded-2xl px-4 py-3",children:e.jsxs("div",{className:"flex space-x-1",children:[e.jsx("div",{className:"w-2 h-2 bg-[#ED8000] rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-[#ED8000] rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-[#ED8000] rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})}),k&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-gray-100 rounded-2xl px-4 py-3",children:e.jsxs("div",{className:"flex space-x-1",children:[e.jsx("div",{className:"w-2 h-2 bg-[#ED8000] rounded-full animate-bounce"}),e.jsx("div",{className:"w-2 h-2 bg-[#ED8000] rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),e.jsx("div",{className:"w-2 h-2 bg-[#ED8000] rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]})})}),e.jsx("div",{ref:G})]})}),m.length<=0&&!k&&!D&&e.jsxs("div",{className:"px-6 py-2 border-t bg-gray-50",children:[e.jsx("p",{className:"text-xs text-gray-600 mb-3 font-medium",children:d("article_ask_ai.quick_questions","✨ Quick questions to get started:")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ae.map((i,o)=>e.jsx("button",{onClick:()=>Y(i),className:"text-xs px-3 py-1.5 bg-white border border-gray-200 rounded-full hover:border-orange-300 hover:bg-orange-50 transition-colors",disabled:k||D,children:i},o))})]}),e.jsx("div",{className:"rounded-b-lg px-6 py-4 border-t bg-white",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(ut,{ref:Z,value:H,onChange:X,onKeyPress:me,onRecordingChange:z,placeholder:d("article_ask_ai.input_placeholder","Ask me anything about this article..."),inputClassName:"border-gray-200 focus:border-orange-400 focus:ring-orange-400",disabled:k||D,className:"flex-1"}),e.jsx(M,{onClick:()=>V(),disabled:!H.trim()||k||D||de,className:"bg-gradient-to-r from-[#ED8000] to-[#d17200] hover:from-[#d17200] hover:to-[#b85c00] px-4",children:k?e.jsx(Te,{className:"h-4 w-4 animate-spin"}):e.jsx(Be,{className:"h-4 w-4"})})]})})]})})},Pt=()=>_t().pathname.startsWith("/news")?"news":"articles",qt=C=>C==="news"?"news":"blog",ts=()=>{var we,ve,Ne,_e,Se,Ee,ke;const{id:C,categorySlug:T,articleSlug:W}=mt(),{t:a,language:d}=pe(),c=Pt(),{user:m}=ht(),{toast:N}=gt(),{subscriptionStatus:H,subscribe:X,unsubscribe:k}=pt(),[Q,D]=l.useState(!1),[A,de]=l.useState([]),[z,G]=l.useState(""),[Z,J]=l.useState(!1),[ee,te]=l.useState(!1),[ue,se]=l.useState(!1),[V,me]=l.useState(null),[Y,ae]=l.useState(!1),[fe,i]=l.useState(!1),[o,u]=l.useState(!1),[_,g]=l.useState(""),[f,j]=l.useState(!1),[B,re]=l.useState([]),w=l.useRef(null);l.useEffect(()=>{H.subscribed&&(m!=null&&m.email)&&g(m.email)},[H.subscribed,m==null?void 0:m.email]);const ie=async s=>{if(s.preventDefault(),!_||!_.includes("@")){N({title:"❌ "+a("article.subscribe_error_title","Invalid Email"),description:a("article.subscribe_error_description","Please enter a valid email address."),variant:"destructive"});return}j(!0);try{const n=await X(_);if(n.success)m||N({title:"✅ "+a("article.subscribe_success_title","Successfully Subscribed!"),description:a("article.subscribe_success_description","Thank you for subscribing! Check your email for confirmation."),className:"border-green-200 bg-green-50 text-green-900 shadow-lg",duration:8e3}),g("");else if(n.code==="ALREADY_SUBSCRIBED")N({title:"ℹ️ "+a("article.subscribe_already_title","Already Subscribed"),description:a("article.subscribe_already_description","This email is already subscribed to our newsletter."),className:"border-blue-200 bg-blue-50 text-blue-900 shadow-lg"});else throw new Error(n.error||"Subscription failed")}catch(n){console.error("Subscription error:",n),N({title:"❌ "+a("article.subscribe_error_title","Subscription Failed"),description:a("article.subscribe_error_general","Failed to subscribe. Please try again later."),variant:"destructive"})}finally{j(!1)}},$=l.useRef(new Map),P=l.useRef(null),ne=l.useRef(null),I=l.useRef({css:[],jsHead:[],jsBody:[]}),q=l.useRef(new Set),{data:Le,isLoading:He,error:$e}=Ct(T,W,d,3,!C&&!!T&&!!W,c),{article:Ue,loading:Pe,error:qe}=At(C,!!C,c),t=Le||Ue,Fe=He||Pe,F=$e||qe,{data:Oe=[]}=It(t==null?void 0:t.id,3,!!t,c),{data:ze=""}=Dt(t==null?void 0:t.id,d,!!(t!=null&&t.id),c),U=ze||(typeof(t==null?void 0:t.content)=="str
1ing"?t.content:""),be=t!=null&&t.related&&t.related.length?t.related:Oe;l.useEffect(()=>{(async()=>{try{const n=await fetch("/api/articles/categories");if(n.ok){const r=await n.json();r.success&&re(r.data||[])}}catch(n){console.error("Error fetching article categories:",n)}})()},[]);const Je=s=>{const p=new DOMParser().parseFromString(s,"text/html").querySelectorAll("h1, h2, h3, h4, h5, h6");return Array.from(p).map((b,y)=>{var S;const v=parseInt(b.tagName.charAt(1)),h=((S=b.textContent)==null?void 0:S.trim())||"",x=`heading-${y}`;return b.id=x,{id:x,title:h,level:v}}).filter(b=>b.title.length>0)},Ve=s=>{if(typeof window>"u")return s;const r=new DOMParser().parseFromString(s,"text/html"),p=r.querySelectorAll("h1, h2, h3, h4, h5, h6"),b=r.querySelectorAll("table");return Array.from(p).forEach((y,v)=>{const h=`heading-${v}`;y.id=h}),Array.from(b).forEach(y=>{var h;const v=r.createElement("div");v.className="overflow-x-auto my-4 border border-gray-200 rounded-lg",v.style.cssText="max-width: 100%; -webkit-overflow-scrolling: touch;",y.className=(y.className||"")+" min-w-full divide-y divide-gray-200",y.style.cssText="margin: 0; border-collapse: collapse;",(h=y.parentNode)==null||h.insertBefore(v,y),v.appendChild(y)}),r.body.innerHTML},ye=s=>{if(typeof window>"u")return;const n=document.getElementById(s);if(n){const b=n.getBoundingClientRect().top+window.pageYOffset-160;window.scrollTo({top:b,behavior:"smooth"})}};l.useEffect(()=>{if(U){const s=Je(U);de(s)}},[U]),l.useEffect(()=>{var n;if(P.current&&(P.current.remove(),P.current=null),I.current.css.forEach(r=>r.remove()),I.current.jsHead.forEach(r=>r.remove()),I.current.jsBody.forEach(r=>r.remove()),I.current={css:[],jsHead:[],jsBody:[]},(n=t==null?void 0:t.libraries)!=null&&n.CSS&&t.libraries.CSS.length>0&&t.libraries.CSS.forEach(r=>{if(q.current.has(r))return;const p=document.createElement("link");p.rel="stylesheet",p.href=r,p.setAttribute("data-article-library-css",t.id),p.onerror=()=>console.error("[ArticleDetail] CSS failed to load:",r),document.head.appendChild(p),I.current.css.push(p),q.current.add(r)}),(async()=>{var r,p,b,y;if((p=(r=t==null?void 0:t.libraries)==null?void 0:r.JS)!=null&&p.Head&&t.libraries.JS.Head.length>0&&await new Promise(v=>{const h=async(x,S=0)=>{if(S>=x.length){v();return}const L=x[S];if(q.current.has(L)){h(x,S+1);return}const E=document.createElement("script");E.src=L,E.setAttribute("data-article-library-js-head",t.id),E.onload=()=>{q.current.add(L),h(x,S+1)},E.onerror=()=>{console.error("[ArticleDetail] JS Head failed to load:",L),h(x,S+1)},document.head.appendChild(E),I.current.jsHead.push(E)};h(t.libraries.JS.Head)}),(y=(b=t==null?void 0:t.libraries)==null?void 0:b.JS)!=null&&y.Body&&t.libraries.JS.Body.length>0&&w.current&&await new Promise(v=>{const h=async(x,S=0)=>{if(S>=x.length){v();return}const L=x[S];if(q.current.has(L)){h(x,S+1);return}const E=document.createElement("script");E.src=L,E.setAttribute("data-article-library-js-body",t.id),E.onload=()=>{q.current.add(L),h(x,S+1)},E.onerror=()=>{console.error("[ArticleDetail] JS Body failed to load:",L),h(x,S+1)},document.body.appendChild(E),I.current.jsBody.push(E)};h(t.libraries.JS.Body)}),t!=null&&t.custom_js&&w.current&&!document.querySelector(`script[data-article-custom-js="${t.id}"]`)){const h=t.custom_js.replace(/document\.addEventListener\s*\(\s*['"]DOMContentLoaded['"]\s*,\s*function\s*\([^)]*\)\s*\{([\s\S]*?)\}\s*\)/g,"$1").replace(/document\.addEventListener\s*\(\s*['"]DOMContentLoaded['"]\s*,\s*\([^)]*\)\s*=>\s*\{([\s\S]*?)\}\s*\)/g,"$1"),x=document.createElement("script");x.textContent=h,x.setAttribute("data-article-custom-js",t.id),x.onerror=()=>console.error("[ArticleDetail] Custom JS failed to load for article:",t.id),document.body.appendChild(x),ne.current=x}})(),t!=null&&t.custom_css){const r=document.createElement("style");r.textContent=t.custom_css,r.setAttribute("data-article-custom-css",t.id),document.head.appendChild(r),P.current=r}return()=>{P.current&&(P.current.remove(),P.current=null),ne.current&&(ne.current.remove(),ne.current=null),I.current.css.forEach(r=>
1r.remove()),I.current.jsHead.forEach(r=>r.remove()),I.current.jsBody.forEach(r=>r.remove()),I.current={css:[],jsHead:[],jsBody:[]},q.current.clear()}},[t==null?void 0:t.id,t==null?void 0:t.custom_css,t==null?void 0:t.libraries,t==null?void 0:t.custom_js]);const je=()=>{if($.current.size===0)return;let s=0,n="";if($.current.forEach((r,p)=>{if(r.isIntersecting){const b=r.intersectionRatio;b>s&&(s=b,n=p)}}),n)G(n);else if(typeof window<"u"){let r="",p=1/0;$.current.forEach((b,y)=>{const v=document.getElementById(y);if(v){const h=Math.abs(v.getBoundingClientRect().top);h<p&&(p=h,r=y)}}),r&&G(r)}};l.useEffect(()=>{if(A.length===0)return;const s=new IntersectionObserver(n=>{n.forEach(r=>{$.current.set(r.target.id,r)}),je()},{rootMargin:"-160px 0px -60% 0px",threshold:[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1]});if(A.forEach(n=>{const r=document.getElementById(n.id);r&&s.observe(r)}),typeof window<"u"){const n=Ye(()=>{je()},100);return window.addEventListener("scroll",n),()=>{s.disconnect(),window.removeEventListener("scroll",n),$.current.clear()}}else return()=>{s.disconnect(),$.current.clear()}},[A]);const Ye=(s,n)=>{let r;return function(...b){const y=()=>{clearTimeout(r),s(...b)};clearTimeout(r),r=setTimeout(y,n)}},We=async()=>{if(!U){N({title:a("common.error","Error"),description:a("article_detail.mindmap_no_content","Article content is not available for mindmap generation."),variant:"destructive"});return}ae(!0);try{const s=await xe(St.MINDMAP_GENERATOR,{content:U});if(console.log("Mindmap response:",s),s&&typeof s=="object")me(s),se(!0);else throw new Error("Invalid mindmap response format")}catch(s){console.error("Error generating mindmap:",s),N({title:a("common.error","Error"),description:a("article_detail.mindmap_error","Failed to generate mindmap. Please try again later."),variant:"destructive"})}finally{ae(!1)}};if(Fe)return e.jsx("div",{className:"min-h-screen bg-gray-50",children:e.jsx("div",{className:"container mx-auto px-4 py-8",children:e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-6 bg-gray-200 rounded w-1/2 mb-4"}),e.jsx("div",{className:"h-96 bg-gray-200 rounded mb-8"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4"}),e.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),e.jsx("div",{className:"h-4 bg-gray-200 rounded w-5/6"})]})]})})})});if(F||!t){const s=typeof F=="string"?F:(F==null?void 0:F.message)||"",n=s.includes("Admin access required")||s.includes("Authentication required"),r=C&&!T&&!W;return e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold mb-4",children:n?a("article_detail.access_denied_title","Access Denied"):F?a("article_detail.error_loading","Error Loading Article"):a("article_detail.not_found_title","Article Not Found")}),e.jsx("p",{className:"text-gray-600 mb-4",children:n?r?a("article_detail.id_access_denied","ID-based URLs are restricted to admin users only. Please use the slug-based URL instead."):a("article_detail.access_denied_message","You don't have permission to access this article."):s||a("article_detail.not_found_message","The article you're looking for doesn't exist.")}),e.jsx(M,{asChild:!0,children:e.jsx(le,{to:`/${c==="news"?"news":"blog"}`,children:c==="news"?a("article_detail.back_to_news","Back to news"):a("article_detail.back_to_articles","Back to blog")})})]})})}const Qe=s=>new Date(s).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),Ge=[{label:a("nav.home","Home"),href:"/"},{label:c==="news"?a("nav.news","News"):a("nav.blog","Blog"),href:`/${c==="news"?"news":"blog"}`},...t.categories.length>0?(()=>{const s=t.categories.find(n=>n.is_primary)||t.categories[0];if(s){const n=s.hierarchicalSlug;if(n)return[{label:K(s,a,"article"),href:`/${c==="news"?"news":"blog"}-categories/${n}`}];if(typeof window<"u"&&B.length>0)try{const r=Ce(s,B);if(r)return[{label:K(s,a,"article"),href:`/${c==="news"?"news":"blog"}-categories/${r}`}]}catch(r){console.warn("Failed to build hierarchical path for category:",s,r)}return[{label:K(s,a,"article"),href:`/${c==="news"?"news":"blog"}-categories/${s.slug}`}]}return[]})():[],{label:O(t.title,d)}],{title:Ke,description:Xe,keywords:Ze}=Rt(t,t.seo),et=c==="news"?Lt(t):Ht(t),tt=`/${c==="news"?"news":"blog"}/${((ve=(we=t.categories)==null?void 0:we.find(s=>
1s.is_primary))==null?void 0:ve.slug)||((_e=(Ne=t.categories)==null?void 0:Ne[0])==null?void 0:_e.slug)||"general"}/${t.slug}`,st=t.image||"/images/seo/default-article.jpg";return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(Mt,{title:Ke,description:Xe,keywords:Ze,canonical:tt,image:st,imageAlt:O(t.title,d),type:"article",author:t.author,publishedTime:t.publishedAt,modifiedTime:t.publishedAt,schemaMarkup:et}),e.jsx(Et,{items:Ge}),e.jsx("section",{className:"bg-white",children:e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("div",{className:"flex flex-col items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-full flex justify-center",children:e.jsx(M,{asChild:!0,variant:"ghost",children:e.jsxs(le,{to:`/${c==="news"?"news":"blog"}`,className:"flex items-center gap-2",children:[e.jsx(xt,{className:"h-4 w-4"}),c==="news"?a("article_detail.back_to_news","Back to News"):a("article_detail.back_to_articles","Back to Blog")]})})}),t.categories.length>0&&e.jsxs("div",{className:"flex justify-center flex-wrap gap-2 w-full",children:[t.categories.slice(0,3).map(s=>e.jsx(ge,{className:"bg-cyprus-blue-500",style:{backgroundColor:s.color},children:K(s,a,"article")},s.id)),t.categories.length>3&&e.jsxs(ge,{className:"bg-cyprus-blue-500",children:["+",t.categories.length-3]})]})]}),e.jsx("div",{className:"max-w-4xl mx-auto",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"font-heading text-3xl md:text-5xl font-bold mb-6 text-gray-900",children:O(t.title,d)}),e.jsx("p",{className:"text-lg md:text-xl text-gray-600 max-w-2xl mx-auto",children:Ae(t.excerpt,d)})]})})]})}),e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-8",children:[e.jsx("div",{className:"lg:col-span-3",children:e.jsx(oe,{className:"overflow-hidden",children:e.jsxs(ce,{className:"p-0",children:[t.image&&e.jsx("div",{className:"relative w-full",children:e.jsx("img",{src:t.image,alt:O(t.title,d),className:"w-full h-auto object-contain"})}),e.jsx("div",{className:"p-6 border-b",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(Ie,{children:[e.jsx(De,{src:((Se=t.authorUser)==null?void 0:Se.avatar)||`https://ui-avatars.com/api/?name=${encodeURIComponent(t.author)}&background=3b82f6&color=fff`}),e.jsx(Me,{children:(((Ee=t.authorUser)==null?void 0:Ee.name)||t.author).split(" ").map(s=>s[0]).join("")})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-600 mb-1",children:[e.jsx(ft,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:((ke=t.authorUser)==null?void 0:ke.name)||t.author})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 text-sm text-gray-500",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(bt,{className:"h-4 w-4"}),Qe(t.publishedAt)]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(yt,{className:"h-4 w-4"}),a("article.read_time","{{time}} min read",{time:t.readTime.toString()})]})]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:e.jsxs("button",{onClick:()=>te(!0),className:"relative inline-flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-[#ED8000] to-[#d17200] text-white text-sm font-medium rounded-full hover:from-[#d17200] hover:to-[#b85c00] transition-all duration-300 hover:scale-105 hover:shadow-lg group overflow-hidden flex-shrink-0",children:[e.jsx("div",{className:"absolute inset-0 w-full h-full bg-gradient-to-r from-transparent via-white/20 to-transparent -skew-x-12 animate-shimmer opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),e.jsx(Re,{className:"h-4 w-4 group-hover:animate-pulse"}),e.jsx("span",{className:"relative z-10",children:a("article_detail.ask_ai","Ask & Summarize with AI")})]})})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 justify-between",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>D(!Q),className:"w-full sm:w-auto",children:[e.jsx(jt,{className:R("h-4 w-4",Q&&"fill-red-500 text-red-500")}),a("article_detail.save","Save")]}),e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>J(!0),className:"w-full sm:w-auto",children:[e.jsx($t,{className:"h-4 w-4"}),a("article_detail.share","Share")]})]}),e.jsxs("button",{onClick:We,disabled:Y||!U,className:"relative inline-flex items-center gap-2 px-4 py-2 bg-gradient-to-r from-[#0077b6] to-[#005577] text-white text-sm font-medium rounded-full hover:from-[#005577] hover:to-[#003344] transition-all duration-300 hover:scale-105 hover:shadow-lg group overflow-hidden flex-shrink-0 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",children:[e.jsx("div",{className:"absolute inset-0 w-full h-full bg-gradient-to-r from-transparent via-white/20 to-transparent -skew-x-12 animate-shimmer opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),Y?e.jsx(Te,{className:"h-4 w-4 animate-spin"}):e.jsx(wt,{className:"h-4 w-4 group-hover:animate-pulse"}),e.jsx("span",{className:"relative z-10",children:Y?a("article_detail.generating_mindmap","Generating..."):a("article_detail.view_mindmap","View Mindmap")})]})]})]})}),A.length>0&&e.jsxs("div",{className:"lg:hidden border-b bg-gray-50 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"font-heading font-semibold",children:c=="news"?a("article_detail.in_this_news","In This News"):a("article_detail.in_this_article","In This Blog")}),e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>u(!o),className:"p-1 h-auto",children:e.jsx(he,{className:R("h-4 w-4 transition-transform",o&&"rotate-90")})})]}),e.jsx("div",{className:R("space-y-2 text-sm transition-all duration-300",o?"max-h-none":"max-h-24 overflow-hidden"),children:A.slice(0,o?A.length:3).map(s=>e.jsxs("button",{onClick:()=>ye(s.id),className:R("flex items-center text-left w-full p-2 rounded-md transition-all duration-200 hover:bg-gray-100",s.level>2&&"ml-4",z===s.id?"text-cyprus-blue-600 bg-cyprus-blue-50 font-medium":"text-gray-600 hover:text-cyprus-blue-600"),children:[e.jsx(he,{className:R("h-3 w-3 mr-1 flex-shrink-0 transition-transform",z===s.id&&"rotate-90")}),e.jsx("span",{className:"truncate",children:s.title})]},s.id))})]}),e.jsx("div",{className:"p-6 prose prose-lg max-w-none w-full",children:U?e.jsx("div",{ref:w,dangerouslySetInnerHTML:{__html:Ve(U)},className:"sm:article-content space-y-4 w-full"}):e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-cyprus-blue-600"}),e.jsx("span",{className:"ml-2 text-gray-600",children:a("article_detail.loading_content","Loading content...")})]})}),e.jsxs("div",{className:"p-6 border-t bg-gray-50",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(vt,{className:"h-4 w-4 text-gray-400"}),e.jsxs("span",{className:"text-sm font-medium text-gray-600",children:[a("article_detail.tags","Tags"),":"]})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:t.tags.map(s=>e.jsxs(ge,{variant:"secondary",style:{backgroundColor:s.color+"20",color:s.color},children:["#",Nt(s,a)]},s.id))})]})]})})}),e.jsxs("div",{className:"hidden lg:block space-y-6 sticky top-32 max-h-[calc(100vh-10rem)] overflow-y-auto",children:[m&&m.role==="admin"&&e.jsx(M,{asChild:!0,variant:"outline",className:"w-full",children:e.jsx("a",{href:`/admin?${c==="news"?"editNewsId":"editArticleId"}=${t.id}`,target:"_blank",rel:"noopener noreferrer",children:c==="news"?a("article_detail.edit_news","Edit this News"):a("article_detail.edit_article","Edit this Blog")})}),A.length>0&&e.jsx(oe,{children:e.jsxs(ce,{className:"p-6",children:[e.jsx("h3",{className:"font-heading font-semibold mb-4",children:c=="news"?a("article_detail.in_this_news","In This News"):a("article_detail.in_this_article","In This Blog")}),e.jsx("div",{className:"space-y-2 text-sm",children:A.map(s=>e.jsxs("button",{onClick:()=>ye(s.id),className:R("flex items-center text-left w-full p-2 rounded-md transition-all duration-200 hover:bg-gray-50",s.level>2&&"ml-4",z===s.id?"text-cyprus-blue-600 bg-cyprus-blue-50 font-medium":"text-gray-600 hover:text-cyprus-blue-600"),children:[e.jsx(he,{className:R("h-3 w-3 mr-1 flex-shrink-0 transition-transform",z===s.id&&"rotate-90")}),e.jsx("span",{className:"truncate",children:s.title})]},s.id))})]})}),t.authorUser&&e.jsx(oe,{children:e.jsxs(ce,{className:"p-6 text-center",children:[e.jsxs(Ie,{className:"w-16 h-16 mx-auto mb-4",children:[e.jsx(De,{src:t.authorUser.avatar||`https://ui-avatars.c
1om/api/?name=${encodeURIComponent(t.authorUser.name)}&background=3b82f6&color=fff`}),e.jsx(Me,{children:t.authorUser.name.split(" ").map(s=>s[0]).join("")})]}),e.jsx("h4",{className:"font-semibold mb-2",children:t.authorUser.name}),e.jsx("p",{className:"text-sm text-gray-600 mb-2",children:t.authorUser.bio||a("article_detail.expert_contributor","Expert contributor and Cyprus resident sharing insider knowledge and practical tips.")}),t.authorUser.location&&e.jsxs("p",{className:"text-xs text-gray-500 mb-4",children:["📍 ",t.authorUser.location]}),e.jsx(M,{size:"sm",variant:"outline",className:"w-full",asChild:!0,children:e.jsx(le,{to:`/profile/${t.authorUser.id}`,children:a("article_detail.view_profile","View Profile")})})]})}),e.jsx(oe,{className:"bg-cyprus-blue-50 border-cyprus-blue-200",children:e.jsxs(ce,{className:"p-6 text-center",children:[e.jsx("h3",{className:"font-heading font-semibold mb-2",children:a("article.newsletter.title","Stay Updated")}),e.jsx("p",{className:"text-sm text-gray-600 mb-4",children:a("article.newsletter.description","Get the latest Cyprus guides and tips delivered to your inbox.")}),H.loading?e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-cyprus-blue-500"})}):H.subscribed&&m?e.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:[e.jsxs("p",{className:"text-green-800 text-sm font-medium mb-2",children:["✅ ",a("article.subscribed_title","You're subscribed!")]}),e.jsx("p",{className:"text-green-600 text-xs mb-3",children:a("article.subscribed_description","You'll receive our latest updates and tips about Cyprus.")}),e.jsx("button",{onClick:async()=>{try{const s=await k();if(s.success)N({title:"✅ "+a("article.unsubscribe_success_title","Unsubscribed Successfully"),description:a("article.unsubscribe_success_description","You have been unsubscribed from our newsletter."),className:"border-green-200 bg-green-50 text-green-900 shadow-lg",duration:8e3});else throw new Error(s.error||"Unsubscribe failed")}catch(s){console.error("Unsubscribe error:",s),N({title:"❌ "+a("article.unsubscribe_error_title","Unsubscribe Failed"),description:a("article.unsubscribe_error_description","Failed to unsubscribe. Please try again later."),variant:"destructive"})}},className:"text-xs text-green-700 hover:text-green-800 underline",children:a("article.unsubscribe_link","Unsubscribe")})]}):e.jsx("form",{onSubmit:ie,className:"space-y-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"email",value:_,onChange:s=>g(s.target.value),placeholder:a("article.email_placeholder","Your email address"),className:"flex-1 px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-cyprus-blue-500 focus:border-transparent text-sm",disabled:f,required:!0}),e.jsx(M,{type:"submit",disabled:f,className:"bg-cyprus-blue-500 hover:bg-cyprus-blue-600 disabled:bg-gray-400 disabled:cursor-not-allowed px-4",style:{backgroundColor:"#0077b6"},children:f?e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}):e.jsx(Be,{className:"h-4 w-4"})})]})})]})})]})]}),be.length>0&&e.jsxs("section",{className:"mt-16",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h2",{className:"font-heading text-2xl font-bold",children:a("article_detail.related_articles","Related Articles")}),t.categories.length>0&&(()=>{const s=t.categories.find(r=>r.is_primary)||t.categories[0],n=B.length>0?Ce(s,B):s.slug;return e.jsx(M,{asChild:!0,variant:"outline",children:e.jsx(le,{to:`/${c==="news"?"news":"blog"}-categories/${n}`,children:a("article.view_all_in_category","View All in {{category}}",{category:K(s,a,"article")})})})})()]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:be.map(s=>e.jsx(kt,{article:s,section:qt(c)},s.id))})]}),e.jsx(Tt,{isOpen:Z,onClose:()=>J(!1),url:typeof window<"u"?window.location.href:"",title:O(t.title,d),description:Ae(t.excerpt,d)}),e.jsx(Ut,{article:t,isOpen:ee,onClose:()=>te(!1)}),V&&e.jsx(Bt,{isOpen:ue,onClose:()=>se(!1),data:V,title:`${O(t.title,d)} - Mind Map`,n8nEndpointConfig:{endpoint:"article-ask-ai",data:{type:"query",lang:d,articleSlug:t.slug}}})]})]})};export{ts 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.