Files
ScreenR-and-KeyboardC/js/main-fWei3rj7.js
T
arsam 36205c2648 Import source: js/main-fWei3rj7
Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
2026-09-18 23:14:06 +03:30

391 lines
505 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{T as M}from"./teknav-data-CwRH-lk8.js";import{r as c,j as e,c as $i}from"./vendor-react-BjBraD6T.js";import{L as Li}from"./vendor-Df_qY436.js";import{S as Pi,P as Mi,W as Ni,a as Hi,G as Vi,A as _i,D as jt,T as Oi,M as Ze,b as et,B as Ui,L as qi,E as Gi,c as vt,d as Qi,e as Yi,V as wt,f as Xi,g as Ji,R as Ki}from"./vendor-three-Bzpp9od8.js";const Zi={},en=(Zi?.VITE_API_BASE??"").replace(/\/$/,"");function tn(t){return t.startsWith("/api/")&&!t.startsWith("/api/v1/")?"/api/v1"+t.slice(4):t}const nn="tek_csrf";function rn(t){const n=document.cookie.match(new RegExp("(?:^|; )"+t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"=([^;]*)"));return n?decodeURIComponent(n[1]):null}class Re extends Error{constructor(n,{status:i,body:o}={}){super(n),this.name="ApiError",this.status=i,this.body=o}}async function Ie(t,{method:n="GET",body:i,headers:o={}}={}){const s={Accept:"application/json",...o};let a;if(i!==void 0&&(s["Content-Type"]="application/json",a=JSON.stringify(i)),n!=="GET"&&n!=="HEAD"){const l=rn(nn);l&&(s["X-CSRF-Token"]=l)}const r=await fetch(`${en}${tn(t)}`,{method:n,headers:s,body:a,credentials:"include"}),d=await r.text(),p=d?sn(d):null;if(!r.ok)throw new Re(p?.error??`http_${r.status}`,{status:r.status,body:p});return p}function sn(t){try{return JSON.parse(t)}catch{return t}}const S={get:t=>Ie(t),post:(t,n)=>Ie(t,{method:"POST",body:n}),put:(t,n)=>Ie(t,{method:"PUT",body:n}),patch:(t,n)=>Ie(t,{method:"PATCH",body:n}),del:t=>Ie(t,{method:"DELETE"})};function kt(t={}){const n=new URLSearchParams;Object.entries(t).forEach(([o,s])=>{s!=null&&s!==""&&n.set(o,String(s))});const i=n.toString();return i?`?${i}`:""}const tt=new Map,U={async listArticles(t={}){return await S.get(`/api/articles${kt(t)}`)},async getArticle(t){if(tt.has(t))return tt.get(t);const n=await S.get(`/api/articles/${encodeURIComponent(t)}`);return tt.set(t,n),n},async getRelated(t){return S.get(`/api/articles/${encodeURIComponent(t)}/related`)},async listSeries(){return(await S.get("/api/series"))?.items??[]},async getSeries(t){return(await S.get(`/api/series/${encodeURIComponent(t)}`))?.series},async listNewsletterArchive(){return(await S.get("/api/newsletter/archive"))?.items??[]},async getNewsletterIssue(t){return(await S.get(`/api/newsletter/archive/${encodeURIComponent(t)}`))?.campaign},async search(t={}){return S.get(`/api/search${kt(t)}`)},async listCategories(){return(await S.get("/api/categories"))?.items??[]},async getCategory(t){return(await S.get(`/api/categories/${encodeURIComponent(t)}`))?.category},async listAuthors(){return(await S.get("/api/authors"))?.items??[]},async getAuthor(t){return(await S.get(`/api/authors/${encodeURIComponent(t)}`))?.author},async listJobs(){return(await S.get("/api/jobs"))?.items??[]},submitJob(t){return S.post("/api/jobs",t)},async listCourses(){return(await S.get("/api/courses"))?.items??[]},subscribeNewsletter(t,n,i){return S.post("/api/newsletter",{email:t,captchaId:n,userSolution:i})},trackEvent(t){return S.post("/api/analytics/events",t)},toggleReaction(t,n){return S.post(`/api/articles/${encodeURIComponent(t)}/reactions`,{type:n})},toggleSaved(t){return S.post(`/api/articles/${encodeURIComponent(t)}/save`,{})},fallbackArticles(){return M.articles??[]},fallbackAuthors(){return M.authors??[]}};function Te(t={}){const n=new URLSearchParams;Object.entries(t).forEach(([o,s])=>{s!=null&&s!==""&&n.set(o,String(s))});const i=n.toString();return i?`?${i}`:""}const K={listComments(t,n){return S.get(`/api/articles/${encodeURIComponent(t)}/comments${Te(n)}`)},postComment(t,n,i){return S.post(`/api/articles/${encodeURIComponent(t)}/comments`,{body:n,replyToId:i})},flagComment(t){return S.post(`/api/comments/${encodeURIComponent(t)}/flag`,{})},likeComment(t){return S.post(`/api/comments/${encodeURIComponent(t)}/like`,{})},upvoteComment(t){return S.post(`/api/comments/${encodeURIComponent(t)}/upvote`,{})},recordHistory(t,n=0){return S.post("/api/auth/history",{articleId:t,progress:n})},getStreaks(){return S.get("/api/auth/streaks")},listHistory(t){return S.get(`/api/auth/history${Te(t)}`)},clearHistory(){return S.del("/api/auth/history")},listNotifications(t){return S.get(`/api/auth/notifications${Te(t)}`)},markNotificationsRead(){return S.post("/api/auth/notifications/read-all",{})},markNotificationRead(t){return S.patch(`/api/auth/notifications/${encodeURIComponent(t)}/read`,{})},deleteNotification(t){return S.del(`/api/auth/notifications/${encodeURIComponent(t)}`)},followWriter(t){return S.post(`/api/writers/${encodeURIComponent(t.replace(/^@/,""))}/follow`,{})},unfollowWriter(t){return S.del(`/api/writers/${encodeURIComponent(t.replace(/^@/,""))}/follow`)},writerFollowers(t,n){return S.get(`/api/writers/${encodeURIComponent(t.replace(/^@/,""))}/followers${Te(n)}`)},followTopic(t){return S.post(`/api/topics/${encodeURIComponent(t)}/follow`,{})},unfollowTopic(t){return S.del(`/api/topics/${encodeURIComponent(t)}/follow`)},topicFollowers(t,n){return S.get(`/api/topics/${encodeURIComponent(t)}/followers${Te(n)}`)},following(){return S.get("/api/auth/following")},listReadingLists(){return S.get("/api/auth/lists")},createReadingList(t){return S.post("/api/auth/lists",{name:t})},deleteReadingList(t){return S.del(`/api/auth/lists/${encodeURIComponent(t)}`)},addToReadingList(t,n){return S.post(`/api/auth/lists/${encodeURIComponent(t)}/items`,{articleId:n})},removeFromReadingList(t,n){return S.del(`/api/auth/lists/${encodeURIComponent(t)}/items/${encodeURIComponent(n)}`)},reorderReadingList(t,n){return S.put(`/api/auth/lists/${encodeURIComponent(t)}/reorder`,{itemIds:n})},listQa(t){return S.get(`/api/articles/${encodeURIComponent(t)}/qa`)},postQuestion(t,n){return S.post(`/api/articles/${encodeURIComponent(t)}/qa`,{body:n})},postAnswer(t,n){return S.post(`/api/qa/questions/${encodeURIComponent(t)}/answers`,{body:n})},writerAnalyticsOverview(){return S.get("/api/auth/analytics/overview")},writerAnalyticsArticles(){return S.get("/api/auth/analytics/articles")},writerAnalyticsArticle(t){return S.get(`/api/auth/analytics/article/${encodeURIComponent(t)}`)},listBadges(){return S.get("/api/auth/badges")}};function St(t){const n="=".repeat((4-t.length%4)%4),i=(t+n).replace(/-/g,"+").replace(/_/g,"/"),o=atob(i);return Uint8Array.from([...o].map(s=>s.charCodeAt(0)))}function Ft(){return document.cookie.match(/tek_csrf=([^;]+)/)?.[1]??""}const Dt={get(){return S.get("/api/auth/notifications/preferences")},update(t){return S.put("/api/auth/notifications/preferences",t)}},it={list(t,n=1){return S.get(`/api/admin/articles/${encodeURIComponent(t)}/revisions?page=${n}`)},get(t,n){return S.get(`/api/admin/articles/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}`)},restore(t,n){return S.post(`/api/admin/articles/${encodeURIComponent(t)}/revisions/${encodeURIComponent(n)}/restore`,{})}},qe={heartbeat(t){return S.post(`/api/admin/articles/${encodeURIComponent(t)}/heartbeat`,{})},getEditors(t){return S.get(`/api/admin/articles/${encodeURIComponent(t)}/presence`)}},Ae={async getVapidKey(){const t=await fetch("/api/v1/auth/push/vapid-key",{credentials:"include"});if(!t.ok)throw new Error("push_not_configured");const{publicKey:n}=await t.json();return n},async isSubscribed(){return!("PushManager"in window)||!("serviceWorker"in navigator)?!1:!!await(await navigator.serviceWorker.ready).pushManager.getSubscription()},async subscribe(){const t=await this.getVapidKey(),i=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:St(t)}),o=i.toJSON();return await fetch("/api/v1/auth/push/subscribe",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-CSRF-Token":Ft()},body:JSON.stringify({endpoint:o.endpoint,auth:o.keys.auth,p256dh:o.keys.p256dh,userAgent:navigator.userAgent})}),i},async unsubscribe(){if(!("serviceWorker"in navigator))return;const n=await(await navigator.serviceWorker.ready).pushManager.getSubscription();n&&(await fetch("/api/v1/auth/push/unsubscribe",{method:"DELETE",credentials:"include",headers:{"Content-Type":"application/json","X-CSRF-Token":Ft()},body:JSON.stringify({endpoint:n.endpoint})}),await n.unsubscribe())},async getGuestVapidKey(){const t=await fetch("/api/v1/push/vapid-key");if(!t.ok)throw new Error("push_not_configured");const{publicKey:n}=await t.json();return n},async subscribeAsGuest(t){const n=await this.getGuestVapidKey(),o=await(await navigator.serviceWorker.ready).pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:St(n)}),s=o.toJSON();if(!(await fetch("/api/v1/push/guest-subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:s.endpoint,auth:s.keys.auth,p256dh:s.keys.p256dh,topics:t,userAgent:navigator.userAgent})})).ok)throw new Error("subscribe_failed");return o},async unsubscribeGuest(){if(!("serviceWorker"in navigator))return;const n=await(await navigator.serviceWorker.ready).pushManager.getSubscription();n&&(await fetch("/api/v1/push/guest-unsubscribe",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({endpoint:n.endpoint})}),await n.unsubscribe())}},ft=({onChange:t,style:n={}})=>{const[i,o]=c.useState(""),[s,a]=c.useState(""),[r,d]=c.useState(""),[p,l]=c.useState(!1),[x,u]=c.useState(""),g=async()=>{l(!0),u(""),d("");try{const h=await fetch("/api/v1/teknav-cap/generate",{credentials:"include"});if(!h.ok)throw new Error("Failed to load captcha");const f=await h.json();o(f.id),a(f.data),t&&t({captchaId:f.id,userSolution:""})}catch(h){u("خطا در بارگذاری کپچا"),console.error("TeknavCAP load error:",h)}finally{l(!1)}};c.useEffect(()=>{g()},[]);const b=h=>{const f=h.target.value;d(f),t&&t({captchaId:i,userSolution:f})};return e.jsxs("div",{style:{direction:"rtl",...n},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8,flexWrap:"wrap"},children:[e.jsx("div",{onClick:g,style:{border:"2px solid #E4DDD2",borderRadius:8,padding:8,background:"#fff",cursor:"pointer",minWidth:200,minHeight:80,display:"flex",alignItems:"center",justifyContent:"center",position:"relative",transition:"all 0.2s"},title:"برای تازه‌سازی کلیک کنید",children:p?e.jsx("div",{style:{fontSize:13,color:"#5F6B6D"},children:"در حال بارگذاری..."}):x?e.jsx("div",{style:{fontSize:12,color:"#C94C4C"},children:x}):e.jsx("div",{dangerouslySetInnerHTML:{__html:s}})}),e.jsx("button",{type:"button",onClick:g,disabled:p,style:{padding:"10px 16px",background:"#0F6B73",color:"#fff",border:"none",borderRadius:8,cursor:p?"not-allowed":"pointer",fontSize:13,fontFamily:"Vazirmatn, sans-serif",fontWeight:600,opacity:p?.6:1,transition:"all 0.2s"},children:"↻ تازه‌سازی"})]}),e.jsx("input",{type:"text",value:r,onChange:b,placeholder:"کد امنیتی را وارد کنید",maxLength:10,autoComplete:"off",dir:"ltr",style:{width:"100%",padding:"10px 14px",border:"1px solid #E4DDD2",borderRadius:8,fontSize:14,fontFamily:"monospace",letterSpacing:"0.1em",textAlign:"center",background:"#fff",transition:"border-color 0.2s"},onFocus:h=>h.target.style.borderColor="#0F6B73",onBlur:h=>h.target.style.borderColor="#E4DDD2"})]})},Zt=c.createContext(null);function on({children:t}){const[n,i]=c.useState([]),o=c.useCallback((s,a="success")=>{const r=Date.now();i(d=>[...d,{id:r,msg:s,type:a}]),setTimeout(()=>i(d=>d.filter(p=>p.id!==r)),3200)},[]);return e.jsxs(Zt.Provider,{value:o,children:[t,e.jsx("div",{style:{position:"fixed",bottom:28,left:24,zIndex:9999,display:"flex",flexDirection:"column",gap:10},children:n.map(s=>e.jsx("div",{style:{padding:"11px 20px",borderRadius:8,color:"#fff",fontSize:14,fontFamily:"Vazirmatn,sans-serif",background:s.type==="error"?"#C94C4C":s.type==="warning"?"#D08A22":"#2F8F6B",boxShadow:"0 4px 20px rgba(0,0,0,0.18)",animation:"slideUp 0.25s ease",direction:"rtl"},children:s.msg},s.id))})]})}const te=()=>c.useContext(Zt),ei=c.createContext(null);function Ct(){const t=window.location.hash.startsWith("#/")?window.location.hash.slice(1):"";if(t)return window.history.replaceState(null,"",t),t;const n=window.location.pathname,o=`${n.length>1&&n.endsWith("/")?n.slice(0,-1):n}${window.location.search}`;return o===""?"/":o}function an({children:t}){const[n,i]=c.useState(Ct),o=c.useRef(null);c.useEffect(()=>{const a=new Li({duration:1.2,easing:p=>Math.min(1,1.001-Math.pow(2,-10*p)),smoothWheel:!0,wheelMultiplier:1,touchMultiplier:1.5,infinite:!1});o.current=a;let r;function d(p){a.raf(p),r=requestAnimationFrame(d)}return r=requestAnimationFrame(d),()=>{cancelAnimationFrame(r),a.destroy(),o.current=null}},[]);const s=c.useCallback(a=>{`${window.location.pathname}${window.location.search}`!==a&&window.history.pushState(null,"",a),i(a),o.current?o.current.scrollTo(0,{immediate:!0}):window.scrollTo(0,0)},[]);return c.useEffect(()=>{const a=()=>i(Ct());return window.addEventListener("popstate",a),window.addEventListener("hashchange",a),()=>{window.removeEventListener("popstate",a),window.removeEventListener("hashchange",a)}},[]),e.jsx(ei.Provider,{value:{page:n,navigate:s},children:t})}const q=()=>c.useContext(ei),ti=c.createContext(null);function ln({children:t}){const[n,i]=c.useState(null),[o,s]=c.useState(!0),a=async()=>{const u=await S.get("/api/auth/me");return i(u?.user??null),u?.user??null};c.useEffect(()=>{let u=!1;return S.get("/api/auth/me").then(g=>{u||i(g?.user??null)}).catch(g=>{g instanceof Re&&g.status===401||console.error("[auth/me]",g)}).finally(()=>{u||s(!1)}),()=>{u=!0}},[]);const r=async(u,g,b,h)=>{const f=await S.post("/api/auth/login",{identifier:u,password:g,captchaId:b,userSolution:h});return f?.user&&i(f.user),f?.twoFactorRequired?f:f?.user??null},d=async(u,g)=>{const b=await S.post("/api/auth/2fa/verify",{ticket:u,code:g});return b?.user&&i(b.user),b?.user??null},p=async({name:u,username:g,email:b,phone:h,password:f,captchaId:y,userSolution:m})=>{const v=await S.post("/api/auth/signup",{name:u,username:g,email:b,phone:h,password:f,captchaId:y,userSolution:m});return v?.user&&i(v.user),v?.user??null},l=u=>{window.location.href=`/api/auth/oauth/${u}/start`},x=async()=>{try{await S.post("/api/auth/logout",{})}catch(u){console.warn("[auth/logout]",u)}i(null)};return e.jsx(ti.Provider,{value:{user:n,login:r,verifyTwoFactor:d,signup:p,startOAuth:l,logout:x,refreshMe:a,bootstrapping:o},children:t})}const ae=()=>c.useContext(ti),At={"تحلیل عمیق":{bg:"#0F6B73",text:"#fff"},"راهنمای فنی":{bg:"#D49A2A",text:"#fff"},داده‌نما:{bg:"#C76D4A",text:"#fff"},پژوهش:{bg:"#2F8F6B",text:"#fff"},راستی‌آزمایی‌شده:{bg:"#263238",text:"#fff"},"خبر فوری":{bg:"#C94C4C",text:"#fff"},"خبر تحلیلی":{bg:"#5F6B6D",text:"#fff"},پرونده:{bg:"#20343A",text:"#FAF7F0"},default:{bg:"#E4DDD2",text:"#263238"}};function De({name:t,color:n,small:i}){return e.jsx("span",{style:{display:"inline-block",padding:i?"2px 8px":"3px 10px",borderRadius:4,fontSize:i?11:12,fontWeight:600,background:n?n+"18":"#0F6B7318",color:n||"#0F6B73",border:`1px solid ${n||"#0F6B73"}30`},children:t})}function We({type:t,small:n}){const i=At[t]||At.default;return e.jsx("span",{style:{display:"inline-block",padding:n?"2px 8px":"3px 10px",borderRadius:3,fontSize:n?10:11,fontWeight:700,letterSpacing:"0.03em",background:i.bg,color:i.text},children:t})}const dn={منتشرشده:"#2F8F6B",پیش‌نویس:"#5F6B6D","در انتظار بررسی":"#D49A2A","نیازمند اصلاح":"#C94C4C",زمان‌بندی‌شده:"#0F6B73"};function mt({status:t}){const n=dn[t]||"#5F6B6D";return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"3px 10px",borderRadius:20,fontSize:11,fontWeight:600,background:n+"15",color:n,border:`1px solid ${n}30`},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:n}}),t]})}const cn={admin:"#C76D4A",editor:"#0F6B73",writer:"#D49A2A",reviewer:"#2F8F6B",reader:"#5F6B6D"},ii={admin:"مدیر کل",editor:"سردبیر",writer:"نویسنده",reviewer:"بازبین",reader:"خواننده"};function yt({role:t}){const n=cn[t]||"#5F6B6D";return e.jsx("span",{style:{padding:"2px 9px",borderRadius:3,fontSize:11,fontWeight:700,background:n+"18",color:n},children:ii[t]||t})}const Bt=[{label:"خانه",path:"/"},{label:"هوش مصنوعی",path:"/category/ai"},{label:"علم داده",path:"/category/data"},{label:"استارتاپ",path:"/category/startup"},{label:"امنیت",path:"/category/security"},{label:"سخت‌افزار",path:"/category/hardware"},{label:"نرم‌افزار",path:"/category/software"},{label:"آینده فناوری",path:"/category/future"},{label:"نویسندگان",path:"/authors"}];function pn(){const{navigate:t,page:n}=q(),{user:i,logout:o}=ae(),[s,a]=c.useState(!1),[r,d]=c.useState(!1),[p,l]=c.useState(!1),[x,u]=c.useState(""),g=c.useRef();c.useEffect(()=>{const h=()=>a(window.scrollY>20);return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[]),c.useEffect(()=>{p&&setTimeout(()=>g.current?.focus(),100)},[p]);const b=h=>{h.preventDefault(),x.trim()&&(t("/search?q="+encodeURIComponent(x)),l(!1),u(""))};return e.jsxs(e.Fragment,{children:[e.jsxs("header",{role:"banner",style:{position:"fixed",top:0,right:0,left:0,zIndex:100,direction:"rtl",background:s?"rgba(250,247,240,0.95)":"rgba(250,247,240,0.85)",backdropFilter:"blur(12px)",borderBottom:s?"1px solid #E4DDD2":"1px solid transparent",transition:"all 0.3s"},children:[e.jsxs("div",{className:"site-header-inner",style:{maxWidth:1280,margin:"0 auto",padding:"0 24px",display:"flex",alignItems:"center",height:64,gap:32},children:[e.jsxs("button",{onClick:()=>t("/"),style:{background:"none",border:"none",cursor:"pointer",display:"flex",flexDirection:"column",lineHeight:1},"aria-label":"خانه تکناو",children:[e.jsx("span",{style:{fontSize:22,fontWeight:900,color:"#0F6B73",fontFamily:"Vazirmatn,sans-serif",letterSpacing:"-0.02em"},children:"تکناو"}),e.jsx("span",{style:{fontSize:9,color:"#5F6B6D",letterSpacing:"0.15em",fontFamily:"sans-serif"},children:"TEKNAV"})]}),e.jsx("nav",{role:"navigation",style:{display:"flex",gap:0,flex:1,overflowX:"auto"},className:"desktop-nav","aria-label":"منوی اصلی",children:Bt.map(h=>e.jsx("button",{onClick:()=>t(h.path),style:{background:"none",border:"none",cursor:"pointer",padding:"8px 12px",fontSize:13,fontFamily:"Vazirmatn,sans-serif",whiteSpace:"nowrap",color:n===h.path?"#0F6B73":"#263238",fontWeight:n===h.path?700:400,borderBottom:n===h.path?"2px solid #0F6B73":"2px solid transparent",transition:"all 0.15s"},"aria-current":n===h.path?"page":void 0,children:h.label},h.path))}),e.jsxs("div",{className:"site-header-actions",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>l(h=>!h),style:Me,"aria-label":"جستجو در تکناو","aria-expanded":p,children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#263238",strokeWidth:"2","aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.35-4.35"})]})}),i?e.jsxs("div",{className:"site-auth-actions",style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx(gn,{}),i.role!=="reader"&&e.jsx("button",{onClick:()=>t("/admin"),style:{...W,background:"#0F6B73",color:"#fff"},"aria-label":"پنل مدیریت",children:ii[i.role]||i.role}),i.username&&e.jsxs("button",{onClick:()=>t("/profile/@"+i.username),style:{...W,background:"#F4EFE6",color:"#263238"},"aria-label":`پروفایل @${i.username}`,children:["@",i.username]}),i.role==="reader"&&!i.username&&e.jsx("span",{style:{fontSize:13,color:"#5F6B6D",fontWeight:600},children:i.name}),e.jsx("button",{onClick:()=>{o(),t("/")},style:{...W,background:"#F4EFE6",color:"#263238"},"aria-label":"خروج از حساب",children:"خروج"})]}):e.jsx("button",{onClick:()=>t("/login"),style:{...W,background:"#C46A4D",color:"#fff"},"aria-label":"ورود یا ثبت‌نام در تکناو",children:"ورود / ثبت‌نام"}),e.jsx("button",{onClick:()=>d(h=>!h),style:{...Me,display:"none"},className:"mobile-menu-btn","aria-label":"باز کردن منوی موبایل","aria-expanded":r,children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#263238",strokeWidth:"2","aria-hidden":"true",children:e.jsx("path",{d:"M3 12h18M3 6h18M3 18h18"})})})]})]}),p&&e.jsx("div",{className:"site-search-strip",style:{borderTop:"1px solid #E4DDD2",padding:"12px 24px",background:"#FAF7F0"},children:e.jsxs("form",{className:"site-search-form",role:"search",onSubmit:b,style:{maxWidth:600,margin:"0 auto",display:"flex",gap:8},children:[e.jsx("input",{ref:g,value:x,onChange:h=>u(h.target.value),placeholder:"جستجو در مقاله‌ها، نویسندگان و دسته‌بندی‌ها...",style:{flex:1,...O,fontSize:14},dir:"rtl","aria-label":"عبارت جستجو"}),e.jsx("button",{type:"submit",style:{...W,background:"#0F6B73",color:"#fff"},"aria-label":"اجرای جستجو",children:"جستجو"})]})})]}),r&&e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:200,direction:"rtl"},children:[e.jsx("div",{onClick:()=>d(!1),style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.4)"}}),e.jsxs("div",{className:"mobile-drawer-panel",style:{position:"absolute",top:0,right:0,width:280,height:"100%",background:"#FAF7F0",padding:24,overflowY:"auto",boxShadow:"-4px 0 24px rgba(0,0,0,0.12)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[e.jsx("span",{style:{fontSize:20,fontWeight:900,color:"#0F6B73"},children:"تکناو"}),e.jsx("button",{onClick:()=>d(!1),style:Me,children:"✕"})]}),Bt.map(h=>e.jsx("button",{onClick:()=>{t(h.path),d(!1)},style:{display:"block",width:"100%",textAlign:"right",background:"none",border:"none",padding:"12px 0",fontSize:15,fontFamily:"Vazirmatn,sans-serif",cursor:"pointer",color:n===h.path?"#0F6B73":"#263238",fontWeight:n===h.path?700:400,borderBottom:"1px solid #E4DDD2"},children:h.label},h.path)),i?e.jsxs("div",{style:{marginTop:20,display:"flex",flexDirection:"column",gap:8},children:[i.username&&e.jsxs("button",{onClick:()=>{t("/profile/@"+i.username),d(!1)},style:{...W,width:"100%",justifyContent:"center"},children:["@",i.username]}),i.role!=="reader"&&e.jsx("button",{onClick:()=>{t("/admin"),d(!1)},style:{...W,background:"#0F6B73",color:"#fff",width:"100%",justifyContent:"center"},children:"پنل مدیریت"}),e.jsx("button",{onClick:()=>{o(),t("/"),d(!1)},style:{...W,background:"#F4EFE6",color:"#263238",width:"100%",justifyContent:"center"},children:"خروج"})]}):e.jsx("button",{onClick:()=>{t("/login"),d(!1)},style:{...W,background:"#C46A4D",color:"#fff",width:"100%",justifyContent:"center",marginTop:20},children:"ورود / ثبت‌نام"})]})]}),e.jsx("style",{children:`
.desktop-nav { display: flex !important; }
.mobile-menu-btn { display: none !important; }
@media (max-width: 768px) {
.desktop-nav { display: none !important; }
.mobile-menu-btn { display: flex !important; }
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
* { box-sizing: border-box; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #FAF7F0; }
::-webkit-scrollbar-thumb { background: #E4DDD2; border-radius: 3px; }
`})]})}function gn(){const{navigate:t}=q(),[n,i]=c.useState(!1),[o,s]=c.useState([]),[a,r]=c.useState(0);c.useEffect(()=>{let l=!1;K.listNotifications({limit:20}).then(u=>{l||(s(u?.items??[]),r(u?.unread??0))}).catch(()=>{});const x=new EventSource("/api/v1/auth/notifications/stream",{withCredentials:!0});return x.addEventListener("notification",u=>{const g=JSON.parse(u.data);s(b=>[g,...b].slice(0,20)),r(b=>b+1)}),x.onerror=()=>{},()=>{l=!0,x.close()}},[]);const d=async l=>{l.read||(K.markNotificationRead(l.id).catch(()=>{}),r(u=>Math.max(0,u-1)),s(u=>u.map(g=>g.id===l.id?{...g,read:!0}:g)));const x=l.payload?.articleSlug;x&&t("/article/"+x),i(!1)},p=async()=>{await K.markNotificationsRead().catch(()=>{}),r(0),s(l=>l.map(x=>({...x,read:!0})))};return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{onClick:()=>i(l=>!l),style:{...Me,position:"relative"},"aria-label":"اعلان‌ها",children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#263238",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"}),e.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),a>0&&e.jsx("span",{style:{position:"absolute",top:-4,left:-4,minWidth:17,height:17,borderRadius:9,background:"#C94C4C",color:"#fff",fontSize:10,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0 4px"},children:a>9?"9+":a.toLocaleString("fa-IR")})]}),n&&e.jsxs("div",{style:{position:"absolute",top:42,left:0,width:320,maxWidth:"80vw",background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,boxShadow:"0 16px 44px rgba(0,0,0,0.14)",zIndex:220,direction:"rtl",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 14px",borderBottom:"1px solid #E4DDD2",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("strong",{style:{fontSize:13,color:"#263238"},children:"اعلان‌ها"}),e.jsx("button",{onClick:p,style:{background:"none",border:"none",color:"#0F6B73",cursor:"pointer",fontSize:11},children:"خواندن همه"})]}),o.length===0?e.jsx("div",{style:{padding:16,fontSize:13,color:"#5F6B6D"},children:"اعلانی وجود ندارد."}):o.map(l=>e.jsxs("button",{onClick:()=>d(l),style:{display:"block",width:"100%",border:"none",borderBottom:"1px solid #F4EFE6",background:l.read?"#fff":"#F4EFE6",textAlign:"right",padding:12,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("div",{style:{fontSize:12,fontWeight:l.read?600:900,color:"#263238",lineHeight:1.6},children:xn(l)}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginTop:2},children:l.payload?.articleTitle??""})]},l.id))]})]})}function xn(t){return t.type==="comment_reply"?`${t.payload?.actorName??"کاربر"} به نظر شما پاسخ داد`:t.type==="comment"?`${t.payload?.actorName??"کاربر"} برای مقاله شما نظر گذاشت`:t.type==="new_article"?`مقاله تازه از ${t.payload?.actorName??"نویسنده"}`:"اعلان جدید"}function un(){const{navigate:t}=q();return e.jsxs("footer",{role:"contentinfo",style:{background:"#ebe3d2",color:"#4A5A5C",direction:"rtl",padding:"56px 24px 28px",marginTop:80,position:"relative",overflow:"hidden"},children:[e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:3,background:"linear-gradient(90deg, transparent 0%, #0F6B73 25%, #D49A2A 50%, #C46A4D 75%, transparent 100%)"}}),e.jsxs("div",{style:{maxWidth:1280,margin:"0 auto",position:"relative"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(200px,1fr))",gap:40,marginBottom:40},children:[e.jsxs("section",{"aria-label":"درباره تکناو",children:[e.jsx("div",{style:{fontSize:28,fontWeight:900,color:"#0F2A2E",marginBottom:6,fontFamily:"'PelakFA','Vazirmatn',sans-serif"},children:"تکناو"}),e.jsx("div",{style:{fontSize:11,color:"#C46A4D",letterSpacing:"0.18em",marginBottom:14,fontWeight:700},children:"TEKNAV"}),e.jsx("p",{style:{fontSize:13,lineHeight:1.9,color:"#5F6B6D"},children:"روایت عمیق فناوری. تحلیل‌های علمی و تخصصی از دنیای فناوری برای متخصصان ایرانی."})]}),e.jsxs("nav",{"aria-label":"لینک‌های دسته‌بندی",children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#0F2A2E",marginBottom:16,fontFamily:"'PelakFA','Vazirmatn',sans-serif"},children:"دسته‌بندی‌ها"}),["هوش مصنوعی","علم داده","امنیت سایبری","سخت‌افزار","نرم‌افزار"].map(n=>e.jsx("div",{style:{fontSize:13,marginBottom:9,cursor:"pointer",color:"#5F6B6D",transition:"color 0.15s, transform 0.15s",transformOrigin:"right"},onMouseEnter:i=>{i.currentTarget.style.color="#0F6B73",i.currentTarget.style.transform="translateX(-4px)"},onMouseLeave:i=>{i.currentTarget.style.color="#5F6B6D",i.currentTarget.style.transform="translateX(0)"},children:n},n))]}),e.jsxs("nav",{"aria-label":"لینک‌های ابزار",children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#0F2A2E",marginBottom:16,fontFamily:"'PelakFA','Vazirmatn',sans-serif"},children:"ابزارها"}),[["مقایسه‌های فنی","/compare"],["استوری‌ها","/stories"],["دایرکتوری شرکت‌ها","/directory"],["واژگان تخصصی","/glossary/ai"],["ابزارهای تکناو","/tools"]].map(([n,i])=>e.jsx("div",{onClick:()=>t(i),style:{fontSize:13,marginBottom:9,cursor:"pointer",color:"#5F6B6D",transition:"color 0.15s, transform 0.15s",transformOrigin:"right"},onMouseEnter:o=>{o.currentTarget.style.color="#0F6B73",o.currentTarget.style.transform="translateX(-4px)"},onMouseLeave:o=>{o.currentTarget.style.color="#5F6B6D",o.currentTarget.style.transform="translateX(0)"},children:n},i))]}),e.jsxs("nav",{"aria-label":"لینک‌های راهنما",children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#0F2A2E",marginBottom:16,fontFamily:"'PelakFA','Vazirmatn',sans-serif"},children:"تکناو"}),[["درباره ما","/about"],["تیم نویسندگان","/authors"],["قوانین حریم خصوصی","/privacy"],["شرایط استفاده","/terms"],["تماس با ما","/contact"]].map(([n,i])=>e.jsx("div",{onClick:()=>t(i),style:{fontSize:13,marginBottom:9,cursor:"pointer",color:"#5F6B6D",transition:"color 0.15s, transform 0.15s",transformOrigin:"right"},onMouseEnter:o=>{o.currentTarget.style.color="#0F6B73",o.currentTarget.style.transform="translateX(-4px)"},onMouseLeave:o=>{o.currentTarget.style.color="#5F6B6D",o.currentTarget.style.transform="translateX(0)"},children:n},i))]}),e.jsxs("section",{"aria-label":"ارتباط با ما",children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#0F2A2E",marginBottom:16,fontFamily:"'PelakFA','Vazirmatn',sans-serif"},children:"ارتباط با ما"}),e.jsx("div",{style:{display:"flex",gap:10,marginBottom:16},children:["توییتر","لینکدین","تلگرام"].map(n=>e.jsx("button",{style:{background:"rgba(15,107,115,0.08)",border:"1px solid rgba(15,107,115,0.25)",color:"#0F6B73",padding:"7px 14px",borderRadius:8,cursor:"pointer",fontSize:12,fontWeight:600,fontFamily:"Vazirmatn,sans-serif",transition:"all 0.18s"},onMouseEnter:i=>{i.currentTarget.style.background="#0F6B73",i.currentTarget.style.color="#fff",i.currentTarget.style.transform="translateY(-2px)"},onMouseLeave:i=>{i.currentTarget.style.background="rgba(15,107,115,0.08)",i.currentTarget.style.color="#0F6B73",i.currentTarget.style.transform="translateY(0)"},children:n},n))}),e.jsx("div",{style:{fontSize:12,color:"#C46A4D",fontWeight:600},children:"info@teknav.ir"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,marginTop:10},children:[e.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:5,background:"rgba(180,100,40,0.1)",border:"1px solid rgba(180,100,40,0.22)",borderRadius:6,padding:"4px 10px",fontSize:11,fontWeight:700,color:"#9B5C1A"},children:"🌊 حامی خلیج فارس"}),e.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:5,background:"rgba(180,100,40,0.1)",border:"1px solid rgba(180,100,40,0.22)",borderRadius:6,padding:"4px 10px",fontSize:11,fontWeight:700,color:"#9B5C1A"},children:"🌐 حامی اینترنت آزاد برای عموم"})]})]})]}),e.jsxs("div",{style:{borderTop:"1px solid rgba(15,42,46,0.12)",paddingTop:22,display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:12},children:[e.jsx("span",{style:{fontSize:12,color:"#5F6B6D"},children:"© ۱۴۰۵ تکناو — تمام حقوق محفوظ است"}),e.jsxs("span",{style:{fontSize:12,color:"#5F6B6D",letterSpacing:"0.04em"},children:["Designed By ",e.jsx("a",{href:"https://www.asabbagh.com",target:"_blank",rel:"noopener noreferrer",style:{color:"#0F6B73",fontWeight:700,letterSpacing:"0.08em",textDecoration:"none"},children:"Coaxys"})]})]})]})]})}function hn(){const[t,n]=c.useState(""),[i,o]=c.useState("idle"),[s,a]=c.useState({captchaId:"",userSolution:""}),r=te(),d=async p=>{if(p.preventDefault(),!t.includes("@")||!t.includes(".")){r("لطفاً یک ایمیل معتبر وارد کنید","error");return}if(!s.captchaId||!s.userSolution.trim()){r("لطفاً کد امنیتی را وارد کنید","error");return}try{const l=await U.subscribeNewsletter(t,s.captchaId,s.userSolution);o("done"),r(l?.alreadySubscribed?"این ایمیل قبلاً ثبت شده است":"با موفقیت عضو خبرنامه شدید!",l?.alreadySubscribed?"warning":"success")}catch(l){l instanceof Re&&l.status===429?r("تعداد درخواست‌ها از حد مجاز گذشت؛ کمی بعد دوباره تلاش کنید","warning"):l instanceof Re&&l.status===400?r("کد امنیتی نامعتبر است","error"):r("خطا در ثبت عضویت خبرنامه","error")}};return i==="done"?e.jsxs("div",{style:{textAlign:"center",padding:"32px 0"},children:[e.jsx("div",{style:{fontSize:32,marginBottom:8},children:"✓"}),e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"#2F8F6B"},children:"عضویت شما ثبت شد!"}),e.jsx("div",{style:{fontSize:13,color:"#5F6B6D",marginTop:4},children:"جدیدترین مقاله‌های تکناو را در ایمیل دریافت خواهید کرد."})]}):e.jsxs("form",{onSubmit:d,style:{display:"flex",flexDirection:"column",gap:16,maxWidth:460,margin:"0 auto"},children:[e.jsx("input",{value:t,onChange:p=>n(p.target.value),type:"email",placeholder:"آدرس ایمیل شما",style:{flex:1,minWidth:200,...O},dir:"rtl"}),e.jsx(ft,{onChange:a}),e.jsx("button",{type:"submit",style:{...W,background:"#C46A4D",color:"#fff",padding:"10px 24px"},children:"عضویت در خبرنامه"})]})}function ni({lines:t=3,height:n=16}){return e.jsxs("div",{children:[Array.from({length:t}).map((i,o)=>e.jsx("div",{style:{height:n,borderRadius:6,background:"linear-gradient(90deg,#E4DDD2 0%,#F4EFE6 50%,#E4DDD2 100%)",backgroundSize:"200% 100%",animation:"shimmer 1.4s infinite",marginBottom:10,width:o===t-1?"60%":"100%"}},o)),e.jsx("style",{children:"@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }"})]})}function _e({msg:t,onConfirm:n,onCancel:i}){return c.useEffect(()=>{const o=s=>{s.key==="Escape"&&i()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[i]),e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:500,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{onClick:i,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),e.jsxs("div",{style:{position:"relative",background:"#FAF7F0",borderRadius:12,padding:32,maxWidth:380,width:"90%",direction:"rtl",boxShadow:"0 20px 60px rgba(0,0,0,0.2)"},children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,marginBottom:8,color:"#263238"},children:"تأیید عملیات"}),e.jsx("div",{style:{fontSize:13,color:"#5F6B6D",lineHeight:1.7,marginBottom:24},children:t}),e.jsxs("div",{style:{display:"flex",gap:10,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:i,style:{...W,background:"#F4EFE6",color:"#263238"},children:"انصراف"}),e.jsx("button",{onClick:n,style:{...W,background:"#C94C4C",color:"#fff"},children:"تأیید و حذف"})]})]})]})}function J({title:t="نتیجه‌ای یافت نشد",subtitle:n="با فیلترهای دیگر امتحان کنید"}){return e.jsxs("div",{style:{textAlign:"center",padding:"60px 24px",color:"#5F6B6D"},children:[e.jsx("div",{style:{fontSize:48,marginBottom:12,opacity:.4},children:"◎"}),e.jsx("div",{style:{fontSize:16,fontWeight:600,marginBottom:6,color:"#263238"},children:t}),e.jsx("div",{style:{fontSize:13},children:n})]})}function fn(){const[t,n]=c.useState(0);return c.useEffect(()=>{const i=()=>{const o=document.documentElement,s=o.scrollTop||document.body.scrollTop,a=o.scrollHeight-o.clientHeight;n(a>0?s/a*100:0)};return window.addEventListener("scroll",i),()=>window.removeEventListener("scroll",i)},[]),e.jsx("div",{style:{position:"fixed",top:64,right:0,left:0,height:3,zIndex:99,background:"#E4DDD2"},children:e.jsx("div",{style:{height:"100%",width:t+"%",background:"#0F6B73",transition:"width 0.1s linear"}})})}function je({author:t,size:n=40}){return e.jsx("div",{style:{width:n,height:n,borderRadius:"50%",background:t.color||"#0F6B73",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:n*.32,fontWeight:700,flexShrink:0},children:t.initials||t.name.slice(0,2)})}const Me={background:"none",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",width:36,height:36,borderRadius:8,transition:"background 0.15s"},W={border:"none",cursor:"pointer",padding:"8px 18px",borderRadius:8,fontSize:13,fontFamily:"Vazirmatn,sans-serif",fontWeight:600,transition:"all 0.15s",display:"inline-flex",alignItems:"center",gap:6},O={border:"1px solid #E4DDD2",borderRadius:8,padding:"9px 14px",fontSize:13,fontFamily:"Vazirmatn,sans-serif",background:"#fff",color:"#263238",outline:"none",width:"100%"};function mn(){const{user:t}=ae(),[n,i]=c.useState(null);return c.useEffect(()=>{t&&K.getStreaks().then(i).catch(()=>{})},[t]),!t||!n||n.streak===0?null:e.jsxs("div",{style:{background:"linear-gradient(135deg, #FF9D6C 0%, #C46A4D 100%)",padding:"8px 14px",borderRadius:12,color:"#fff",fontSize:13,display:"flex",alignItems:"center",gap:10,boxShadow:"0 4px 15px rgba(196,106,77,0.3)",animation:"float-y 3s ease-in-out infinite"},children:[e.jsx("span",{style:{fontSize:18},children:"🔥"}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontWeight:800},children:[n.streak.toLocaleString("fa-IR")," روز مطالعه متوالی!"]}),e.jsx("div",{style:{fontSize:10,opacity:.9},children:"به یادگیری ادامه دهید"})]})]})}function yn(){const{user:t}=ae(),{navigate:n}=q(),[i,o]=c.useState(null);return c.useEffect(()=>{t&&K.getStreaks().then(o).catch(()=>{})},[t]),!t||!i||!i.continueReading?.length?null:e.jsx("div",{style:{background:"#263238",color:"#fff",padding:"12px 24px",direction:"rtl"},children:e.jsxs("div",{style:{maxWidth:1280,margin:"0 auto",display:"flex",alignItems:"center",gap:20,overflowX:"auto"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:700,whiteSpace:"nowrap",color:"#FF9D6C"},children:"ادامه مطالعه:"}),i.continueReading.map(s=>e.jsxs("button",{onClick:()=>n("/article/"+s.slug),style:{background:"none",border:"none",color:"#fff",cursor:"pointer",display:"flex",flexDirection:"column",gap:2,textAlign:"right",minWidth:140},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},children:s.title}),e.jsx("div",{style:{width:"100%",height:2,background:"rgba(255,255,255,0.1)",borderRadius:1},children:e.jsx("div",{style:{width:s.progress*100+"%",height:"100%",background:"#0F6B73"}})})]},s.id))]})})}function ri({articleId:t,onDone:n}){const[i,o]=c.useState([]),[s,a]=c.useState(!0),[r,d]=c.useState(""),p=te(),l=c.useCallback(()=>{a(!0),K.listReadingLists().then(g=>o(g.items??[])).finally(()=>a(!1))},[]);c.useEffect(()=>{l()},[l]);const x=async g=>{try{await K.addToReadingList(g,t),p("به لیست اضافه شد"),n()}catch{p("در این لیست موجود است","warning")}},u=async g=>{if(g.preventDefault(),!!r.trim())try{const b=await K.createReadingList(r);d(""),x(b.list.id)}catch{p("خطا در ایجاد لیست","error")}};return e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:600,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{onClick:n,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)",backdropFilter:"blur(4px)"}}),e.jsxs("div",{style:{position:"relative",background:"#FAF7F0",borderRadius:16,padding:24,maxWidth:400,width:"90%",direction:"rtl",boxShadow:"0 20px 60px rgba(0,0,0,0.25)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:20},children:[e.jsx("h3",{style:{fontSize:17,fontWeight:800,color:"#263238"},children:"ذخیره در لیست مطالعه"}),e.jsx("button",{onClick:n,style:Me,children:"✕"})]}),s?e.jsx(ni,{lines:3}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,marginBottom:20,maxHeight:300,overflowY:"auto"},children:i.map(g=>e.jsxs("button",{onClick:()=>x(g.id),style:{width:"100%",padding:"12px 16px",borderRadius:10,background:"#fff",border:"1px solid #E4DDD2",textAlign:"right",cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center",fontFamily:"Vazirmatn,sans-serif",transition:"all 0.15s"},onMouseEnter:b=>{b.currentTarget.style.borderColor="#0F6B73",b.currentTarget.style.background="#0F6B7308"},onMouseLeave:b=>{b.currentTarget.style.borderColor="#E4DDD2",b.currentTarget.style.background="#fff"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:600,color:"#263238"},children:g.name}),e.jsxs("span",{style:{fontSize:11,color:"#5F6B6D"},children:[g._count?.items??0," مورد"]})]},g.id))}),e.jsxs("form",{onSubmit:u,style:{borderTop:"1px solid #E4DDD2",paddingTop:20,display:"flex",gap:8},children:[e.jsx("input",{value:r,onChange:g=>d(g.target.value),placeholder:"نام لیست جدید...",style:{...O,flex:1}}),e.jsx("button",{type:"submit",style:{...W,background:"#0F6B73",color:"#fff"},children:"ایجاد"})]})]})]})}function bn({user:t}){const[n,i]=c.useState(!1),o=te();if(c.useEffect(()=>{t&&"PushManager"in window&&"serviceWorker"in navigator&&typeof Notification<"u"&&Notification.permission==="default"&&!localStorage.getItem("push_prompt_dismissed")&&i(!0)},[t]),!n)return null;const s=async()=>{try{await Notification.requestPermission()==="granted"&&(await Ae.subscribe(),o("اعلان‌های مرورگر فعال شد"))}catch{}i(!1)},a=()=>{localStorage.setItem("push_prompt_dismissed","1"),i(!1)};return e.jsxs("div",{style:{position:"fixed",bottom:160,right:24,zIndex:490,background:"#1A2E30",border:"1px solid #2A4045",borderRadius:16,padding:"14px 18px",display:"flex",alignItems:"center",gap:14,boxShadow:"0 12px 40px rgba(0,0,0,0.22)",animation:"slideUp 0.3s ease",direction:"rtl",maxWidth:320},children:[e.jsx("span",{style:{fontSize:20},children:"🔔"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,color:"#FAF7F0",marginBottom:3},children:"اعلان‌های مرورگر"}),e.jsx("div",{style:{fontSize:11,color:"#8AA5A8"},children:"مقالات جدید را از دست ندهید"})]}),e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("button",{onClick:a,style:{...W,background:"transparent",color:"#8AA5A8",border:"1px solid #2A4045",padding:"5px 10px",fontSize:11},children:"بعداً"}),e.jsx("button",{onClick:s,style:{...W,background:"#C46A4D",color:"#fff",padding:"5px 12px",fontSize:11},children:"فعال‌سازی"})]})]})}function jn(){const[t,n]=c.useState(null),[i,o]=c.useState(!1);c.useEffect(()=>{const a=r=>{r.preventDefault(),n(r),o(!0)};return window.addEventListener("beforeinstallprompt",a),()=>window.removeEventListener("beforeinstallprompt",a)},[]);const s=async()=>{if(!t)return;t.prompt();const{outcome:a}=await t.userChoice;a==="accepted"&&o(!1),n(null)};return i?e.jsxs("div",{style:{position:"fixed",bottom:100,right:24,zIndex:500,background:"#fff",border:"1px solid #E4DDD2",borderRadius:16,padding:"16px 20px",display:"flex",alignItems:"center",gap:16,boxShadow:"0 12px 40px rgba(0,0,0,0.15)",animation:"slideUp 0.3s ease",direction:"rtl"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:14,fontWeight:800,color:"#263238"},children:"نصب اپلیکیشن تکناو"}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginTop:2},children:"دسترسی سریع‌تر و آفلاین به مقالات"})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>o(!1),style:{...W,background:"#F4EFE6",color:"#263238",padding:"6px 12px",fontSize:12},children:"بعداً"}),e.jsx("button",{onClick:s,style:{...W,background:"#0F6B73",color:"#fff",padding:"6px 16px",fontSize:12},children:"نصب"})]})]}):null}function Ke(t,n){c.useEffect(()=>{if(!t.current||!n)return;const i=navigator.connection;if(i&&(i.saveData||/2g|3g/.test(i.effectiveType)))return;const o=new IntersectionObserver(s=>{s.forEach(a=>{if(a.isIntersecting){const r=()=>{U.getArticle(n).catch(()=>{})};"requestIdleCallback"in window?window.requestIdleCallback(r):setTimeout(r,200),o.disconnect()}})},{rootMargin:"100px"});return o.observe(t.current),()=>o.disconnect()},[t,n])}function ct({width:t=420,height:n=280}){const[i,o]=c.useState(null),[s,a]=c.useState(0);c.useEffect(()=>{const l=setInterval(()=>a(x=>x+1),80);return()=>clearInterval(l)},[]);const r=[{x:60,nodes:[80,130,180,230],label:"لایه ورودی"},{x:160,nodes:[100,155,210],label:"لایه پنهان ۱"},{x:260,nodes:[110,165,220],label:"لایه توجه"},{x:360,nodes:[140,195],label:"خروجی مدل"}],d=[];for(let l=0;l<r.length-1;l++){const x=r[l],u=r[l+1];x.nodes.forEach((g,b)=>{u.nodes.forEach((h,f)=>{const y=(s+l*7+b*3+f*5)%40;y<20&&d.push({x:x.x+(u.x-x.x)*y/20,y:g+(h-g)*y/20})})})}const p=["#0F6B73","#D49A2A","#C76D4A","#2F8F6B"];return e.jsxs("svg",{width:"100%",viewBox:`0 0 ${t} ${n}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[r.map((l,x)=>r[x+1]&&l.nodes.map((u,g)=>r[x+1].nodes.map((b,h)=>e.jsx("line",{x1:l.x,y1:u,x2:r[x+1].x,y2:b,stroke:"#E4DDD2",strokeWidth:"1",opacity:"0.6"},`${x}-${g}-${h}`)))),d.map((l,x)=>e.jsx("circle",{cx:l.x,cy:l.y,r:"3",fill:"#D49A2A",opacity:"0.75"},x)),r.map((l,x)=>l.nodes.map((u,g)=>e.jsxs("g",{onMouseEnter:()=>o(`${x}-${g}`),onMouseLeave:()=>o(null),style:{cursor:"pointer"},children:[e.jsx("circle",{cx:l.x,cy:u,r:i===`${x}-${g}`?13:10,fill:p[x],opacity:i===`${x}-${g}`?1:.85,style:{transition:"r 0.15s"}}),i===`${x}-${g}`&&e.jsxs("g",{children:[e.jsx("rect",{x:l.x-60,y:u-30,width:"120",height:"22",rx:"4",fill:"#20343A",opacity:"0.9"}),e.jsx("text",{x:l.x,y:u-15,textAnchor:"middle",fill:"#FAF7F0",fontSize:"10",children:l.label})]})]},`n-${x}-${g}`))),r.map((l,x)=>e.jsx("text",{x:l.x,y:n-8,textAnchor:"middle",fill:"#5F6B6D",fontSize:"9",children:l.label},`l-${x}`))]})}function si({compact:t=!1}){const[n,i]=c.useState(0),[o,s]=c.useState(null);c.useEffect(()=>{const l=setInterval(()=>i(x=>(x+1)%100),60);return()=>clearInterval(l)},[]);const a=[{id:"raw",label:"داده خام",icon:"⬡",color:"#5F6B6D",desc:"جمع‌آوری از منابع مختلف"},{id:"clean",label:"پاک‌سازی",icon:"◈",color:"#D49A2A",desc:"حذف تکراری و نویز"},{id:"label",label:"برچسب‌گذاری",icon:"◉",color:"#C76D4A",desc:"دسته‌بندی و تعریف"},{id:"feature",label:"ویژگی‌سازی",icon:"⬟",color:"#0F6B73",desc:"استخراج ویژگی"},{id:"train",label:"آموزش مدل",icon:"◈",color:"#2F8F6B",desc:"یادگیری از داده"},{id:"eval",label:"ارزیابی",icon:"◉",color:"#D49A2A",desc:"سنجش عملکرد"},{id:"output",label:"خروجی",icon:"★",color:"#0F6B73",desc:"مدل آماده"}],r=t?480:700,d=t?140:180,p=r/a.length;return e.jsxs("svg",{width:"100%",viewBox:`0 0 ${r} ${d}`,style:{fontFamily:"Vazirmatn, sans-serif",overflow:"visible"},children:[e.jsx("line",{x1:p*.5,y1:d/2,x2:r-p*.5,y2:d/2,stroke:"#E4DDD2",strokeWidth:"2"}),[0,25,50,75].map(l=>{const x=(n+l)%100/100,u=p*.5+x*(r-p);return e.jsx("circle",{cx:u,cy:d/2,r:"4",fill:"#D49A2A",opacity:.8},l)}),a.map((l,x)=>{const u=p*(x+.5),g=o===l.id;return e.jsxs("g",{onMouseEnter:()=>s(l.id),onMouseLeave:()=>s(null),style:{cursor:"pointer"},children:[e.jsx("circle",{cx:u,cy:d/2,r:g?26:22,fill:l.color,opacity:g?1:.85,style:{transition:"all 0.2s"}}),e.jsx("text",{x:u,y:d/2+5,textAnchor:"middle",fill:"#fff",fontSize:t?11:13,fontWeight:"700",children:x+1}),e.jsx("text",{x:u,y:d/2+(t?36:42),textAnchor:"middle",fill:"#263238",fontSize:t?9:10,children:l.label}),g&&e.jsxs("g",{children:[e.jsx("rect",{x:u-55,y:d/2-52,width:"110",height:"22",rx:"4",fill:"#20343A",opacity:"0.92"}),e.jsx("text",{x:u,y:d/2-37,textAnchor:"middle",fill:"#FAF7F0",fontSize:"9",children:l.desc})]})]},l.id)})]})}function oi(){const[t,n]=c.useState(null),[i,o]=c.useState(0);c.useEffect(()=>{const p=setInterval(()=>o(l=>l+1),100);return()=>clearInterval(p)},[]);const s=200,a=150,r=90,d=[{angle:0,label:"فیشینگ",color:"#C94C4C"},{angle:60,label:"حمله زنجیره تأمین",color:"#D08A22"},{angle:120,label:"آسیب‌پذیری کتابخانه",color:"#C76D4A"},{angle:180,label:"دسترسی غیرمجاز",color:"#C94C4C"},{angle:240,label:"باج‌افزار",color:"#D08A22"},{angle:300,label:"حمله DDoS",color:"#C76D4A"}];return e.jsxs("svg",{width:"100%",viewBox:"0 0 400 300",style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("circle",{cx:s,cy:a,r:55,fill:"none",stroke:"#2F8F6B",strokeWidth:"2.5",strokeDasharray:"8 4",style:{animation:"spin 20s linear infinite",transformOrigin:`${s}px ${a}px`}}),e.jsx("rect",{x:s-22,y:a-28,width:"44",height:"56",rx:"6",fill:"#20343A"}),e.jsx("rect",{x:s-16,y:a-22,width:"32",height:"6",rx:"2",fill:"#0F6B73"}),e.jsx("rect",{x:s-16,y:a-12,width:"32",height:"6",rx:"2",fill:"#0F6B73"}),e.jsx("rect",{x:s-16,y:a-2,width:"32",height:"6",rx:"2",fill:"#0F6B73"}),e.jsx("circle",{cx:s+12,cy:a+16,r:"3",fill:"#2F8F6B"}),e.jsx("text",{x:s,y:a+42,textAnchor:"middle",fill:"#5F6B6D",fontSize:"9",children:"سرور مرکزی"}),d.map((p,l)=>{const x=p.angle*Math.PI/180,u=s+Math.cos(x)*r,g=a+Math.sin(x)*r,b=s+Math.cos(x)*(r+38),h=a+Math.sin(x)*(r+38),f=t===l,y=(i+l*6)%30<15;return e.jsxs("g",{onMouseEnter:()=>n(l),onMouseLeave:()=>n(null),style:{cursor:"pointer"},children:[e.jsx("line",{x1:s+Math.cos(x)*55,y1:a+Math.sin(x)*55,x2:u,y2:g,stroke:p.color,strokeWidth:f?2:1,strokeDasharray:y?"6 3":"3 6",opacity:.7}),e.jsx("circle",{cx:u,cy:g,r:f?10:8,fill:p.color,opacity:f?1:.75,style:{transition:"all 0.15s"}}),f&&e.jsxs("g",{children:[e.jsx("rect",{x:b-55,y:h-14,width:"110",height:"20",rx:"4",fill:"#20343A",opacity:"0.92"}),e.jsx("text",{x:b,y:h-1,textAnchor:"middle",fill:"#FAF7F0",fontSize:"9",children:p.label})]})]},l)}),e.jsx("style",{children:"@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }"})]})}function ai(){const[t,n]=c.useState(0);c.useEffect(()=>{let u=0;const g=setInterval(()=>{u=Math.min(u+2,100),n(u),u>=100&&clearInterval(g)},20);return()=>clearInterval(g)},[]);const i=["ایده","محصول اولیه","جذب کاربر","درآمد","مقیاس‌پذیری"],o=400,s=200,a=40,r=20,d=i.map((u,g)=>{const b=g/(i.length-1);return{x:a+b*(o-a*2),y:s-r-Math.pow(b,1.8)*(s-r*3)}}),p=Math.min(t/100,1),l=d.filter((u,g)=>g/(i.length-1)<=p+.01),x=l.length>1?l.map((u,g)=>`${g===0?"M":"L"} ${u.x} ${u.y}`).join(" "):"";return e.jsxs("svg",{width:"100%",viewBox:`0 0 ${o} ${s+30}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("line",{x1:a,y1:s-r,x2:o-a,y2:s-r,stroke:"#E4DDD2",strokeWidth:"1.5"}),e.jsx("line",{x1:a,y1:r,x2:a,y2:s-r,stroke:"#E4DDD2",strokeWidth:"1.5"}),x&&e.jsx("path",{d:x,fill:"none",stroke:"#0F6B73",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.length>1&&e.jsx("path",{d:`${x} L ${l[l.length-1].x} ${s-r} L ${l[0].x} ${s-r} Z`,fill:"#0F6B73",opacity:"0.08"}),d.map((u,g)=>g/(i.length-1)<=p+.01?e.jsxs("g",{children:[e.jsx("circle",{cx:u.x,cy:u.y,r:"7",fill:"#D49A2A"}),e.jsx("text",{x:u.x,y:s+15,textAnchor:"middle",fill:"#5F6B6D",fontSize:"9",children:i[g]})]},g):null),e.jsx("text",{x:o/2,y:r-5,textAnchor:"middle",fill:"#263238",fontSize:"10",fontWeight:"600",children:"منحنی رشد استارتاپ"})]})}function li(){const[t,n]=c.useState(0);c.useEffect(()=>{const s=setInterval(()=>n(a=>a+1),70);return()=>clearInterval(s)},[]);const i=[{x:30,y:60,w:80,h:40,label:"حافظه",color:"#D49A2A"},{x:160,y:40,w:80,h:80,label:"پردازنده",color:"#0F6B73"},{x:290,y:60,w:80,h:40,label:"شتاب‌دهنده AI",color:"#C76D4A"},{x:30,y:150,w:80,h:40,label:"گذرگاه داده",color:"#2F8F6B"},{x:290,y:150,w:80,h:40,label:"کنترلر حافظه",color:"#5F6B6D"}],o=[{x1:110,y1:80,x2:160,y2:80},{x1:240,y1:80,x2:290,y2:80},{x1:110,y1:170,x2:160,y2:120},{x1:240,y1:100,x2:290,y2:170},{x1:200,y1:120,x2:200,y2:170}];return e.jsxs("svg",{width:"100%",viewBox:"0 0 400 220",style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("rect",{x:"10",y:"20",width:"380",height:"190",rx:"8",fill:"#F4EFE6",stroke:"#E4DDD2",strokeWidth:"1.5"}),o.map((s,a)=>{Math.hypot(s.x2-s.x1,s.y2-s.y1);const r=(t+a*12)%40/40,d=s.x1+(s.x2-s.x1)*r,p=s.y1+(s.y2-s.y1)*r;return e.jsxs("g",{children:[e.jsx("line",{x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2,stroke:"#E4DDD2",strokeWidth:"3"}),e.jsx("circle",{cx:d,cy:p,r:"4",fill:"#D49A2A",opacity:"0.9"})]},a)}),i.map((s,a)=>e.jsxs("g",{children:[e.jsx("rect",{x:s.x,y:s.y,width:s.w,height:s.h,rx:"5",fill:s.color,opacity:"0.85"}),e.jsx("text",{x:s.x+s.w/2,y:s.y+s.h/2+4,textAnchor:"middle",fill:"#fff",fontSize:"9",fontWeight:"600",children:s.label})]},a))]})}function di(){const[t,n]=c.useState(null),i=[{year:"۲۰۲۵",label:"AGI اولیه",color:"#0F6B73"},{year:"۲۰۲۷",label:"رایانش کوانتومی",color:"#D49A2A"},{year:"۲۰۲۹",label:"رباتیک خودکار",color:"#C76D4A"},{year:"۲۰۳۱",label:"رابط مغز-ماشین",color:"#2F8F6B"},{year:"۲۰۳۵",label:"جوش هسته‌ای تجاری",color:"#0F6B73"}],o=480,s=120;return e.jsxs("svg",{width:"100%",viewBox:`0 0 ${o} ${s+20}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("line",{x1:40,y1:s/2,x2:o-40,y2:s/2,stroke:"#E4DDD2",strokeWidth:"2"}),i.map((a,r)=>{const d=40+r/(i.length-1)*(o-80),p=t===r;return e.jsxs("g",{onMouseEnter:()=>n(r),onMouseLeave:()=>n(null),style:{cursor:"pointer"},children:[e.jsx("circle",{cx:d,cy:s/2,r:p?14:10,fill:a.color,style:{transition:"r 0.15s"}}),e.jsx("text",{x:d,y:s/2-22,textAnchor:"middle",fill:a.color,fontSize:"10",fontWeight:"700",children:a.year}),p&&e.jsxs("g",{children:[e.jsx("rect",{x:d-55,y:s/2+20,width:"110",height:"22",rx:"4",fill:"#20343A",opacity:"0.9"}),e.jsx("text",{x:d,y:s/2+34,textAnchor:"middle",fill:"#FAF7F0",fontSize:"9",children:a.label})]}),!p&&e.jsx("text",{x:d,y:s/2+26,textAnchor:"middle",fill:"#5F6B6D",fontSize:"8.5",children:a.label})]},r)})]})}function ci(){const t=[{x:180,y:30,label:"API Gateway",color:"#0F6B73"},{x:60,y:110,label:"Auth Service",color:"#2F8F6B"},{x:180,y:110,label:"Core Service",color:"#D49A2A"},{x:300,y:110,label:"AI Service",color:"#C76D4A"},{x:60,y:190,label:"Database",color:"#5F6B6D"},{x:300,y:190,label:"Cache",color:"#5F6B6D"}],n=[[0,1],[0,2],[0,3],[1,4],[2,4],[3,5]];return e.jsxs("svg",{width:"100%",viewBox:"0 0 420 250",style:{fontFamily:"Vazirmatn, sans-serif"},children:[n.map(([i,o],s)=>e.jsx("line",{x1:t[i].x+50,y1:t[i].y+18,x2:t[o].x+50,y2:t[o].y+18,stroke:"#E4DDD2",strokeWidth:"1.5",markerEnd:"url(#arr)"},s)),e.jsx("defs",{children:e.jsx("marker",{id:"arr",markerWidth:"6",markerHeight:"6",refX:"3",refY:"3",orient:"auto",children:e.jsx("path",{d:"M0,0 L6,3 L0,6 Z",fill:"#E4DDD2"})})}),t.map((i,o)=>e.jsxs("g",{children:[e.jsx("rect",{x:i.x,y:i.y,width:"100",height:"36",rx:"6",fill:i.color,opacity:"0.85"}),e.jsx("text",{x:i.x+50,y:i.y+22,textAnchor:"middle",fill:"#fff",fontSize:"9.5",fontWeight:"600",children:i.label})]},o))]})}function pi(){const[t,n]=c.useState(0);c.useEffect(()=>{const r=setInterval(()=>n(d=>d+1),40);return()=>clearInterval(r)},[]);const i=480,o=160,s=[{color:"#D49A2A",amp:28,freq:.022,phase:0,y:50},{color:"#C46A4D",amp:20,freq:.03,phase:1.5,y:85},{color:"#2F8F6B",amp:24,freq:.018,phase:3,y:120}],a=r=>Array.from({length:60},(p,l)=>{const x=l/59*i,u=r.y+r.amp*Math.sin(x*r.freq+t*.08+r.phase);return`${l===0?"M":"L"}${x.toFixed(1)},${u.toFixed(1)}`}).join(" ");return e.jsxs("svg",{width:"100%",viewBox:`0 0 ${i} ${o}`,style:{fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("defs",{children:s.map((r,d)=>e.jsxs("linearGradient",{id:`wg${d}`,x1:"0",x2:"1",y1:"0",y2:"0",children:[e.jsx("stop",{offset:"0%",stopColor:r.color,stopOpacity:"0"}),e.jsx("stop",{offset:"30%",stopColor:r.color,stopOpacity:"0.9"}),e.jsx("stop",{offset:"70%",stopColor:r.color,stopOpacity:"0.9"}),e.jsx("stop",{offset:"100%",stopColor:r.color,stopOpacity:"0"})]},d))}),s.map((r,d)=>e.jsxs("g",{children:[e.jsx("path",{d:a(r),fill:"none",stroke:`url(#wg${d})`,strokeWidth:2.5}),(()=>{const l=(t*1.8+d*80)%480/480*i,x=r.y+r.amp*Math.sin(l*r.freq+t*.08+r.phase);return e.jsx("circle",{cx:l,cy:x,r:4,fill:r.color,opacity:.9})})()]},d)),e.jsx("text",{x:i/2,y:o-4,textAnchor:"middle",fill:"#5F6B6D",fontSize:"9",children:"جریان داده در شبکه"})]})}function gi(){const[t,n]=c.useState(0);c.useEffect(()=>{const a=setInterval(()=>n(r=>r+1),50);return()=>clearInterval(a)},[]);const i=140,o=110,s=[{r:40,speed:.04,color:"#D49A2A",label:"داده",dotR:7},{r:65,speed:-.025,color:"#C46A4D",label:"مدل",dotR:9},{r:90,speed:.016,color:"#2F8F6B",label:"استنتاج",dotR:8}];return e.jsxs("svg",{width:"100%",viewBox:"0 0 280 220",style:{fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("circle",{cx:i,cy:o,r:22,fill:"#20343A"}),e.jsx("circle",{cx:i,cy:o,r:16,fill:"#0F6B73",opacity:.8}),e.jsx("text",{x:i,y:o+4,textAnchor:"middle",fill:"#FAF7F0",fontSize:"8",fontWeight:"700",children:"AI"}),s.map((a,r)=>e.jsxs("g",{children:[e.jsx("circle",{cx:i,cy:o,r:a.r,fill:"none",stroke:a.color,strokeWidth:"1",strokeDasharray:"4 6",opacity:"0.35"}),(()=>{const d=t*a.speed,p=i+a.r*Math.cos(d),l=o+a.r*Math.sin(d);return e.jsxs("g",{children:[e.jsx("circle",{cx:p,cy:l,r:a.dotR,fill:a.color,opacity:.9}),e.jsx("text",{x:p,y:l+a.dotR+10,textAnchor:"middle",fill:a.color,fontSize:"8",fontWeight:"600",children:a.label})]})})()]},r))]})}function xi({variant:t=1,compact:n=!1}){const[i,o]=c.useState(0);c.useEffect(()=>{const h=setInterval(()=>o(f=>f+1),50);return()=>clearInterval(h)},[]);const s=n?320:520,a=n?150:210,r=Number.isFinite(t)?t:1,d=6+r%7,p=n?36+r%5*6:48+r%6*7,l=s*.5,x=a*.48,u=["#0F6B73","#D49A2A","#C76D4A","#2F8F6B","#5F6B6D"],g=Array.from({length:d},(h,f)=>{const y=Math.PI*2/d*f+r%9*.11;return{x:l+Math.cos(y)*p,y:x+Math.sin(y)*p,color:u[(f+r)%u.length]}}),b=(i+r*3)%100;return e.jsxs("svg",{width:"100%",viewBox:`0 0 ${s} ${a}`,style:{fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("rect",{x:"8",y:"8",width:s-16,height:a-16,rx:"12",fill:"#F4EFE6",stroke:"#E4DDD2"}),g.map((h,f)=>g.slice(f+1).map((y,m)=>e.jsx("line",{x1:h.x,y1:h.y,x2:y.x,y2:y.y,stroke:"#E4DDD2",strokeWidth:(f+m+r)%3+.5,opacity:.5},`${f}-${m}`))),g.map((h,f)=>e.jsxs("g",{children:[e.jsx("circle",{cx:h.x,cy:h.y,r:6+(f+r)%4,fill:h.color,opacity:.9}),e.jsx("circle",{cx:h.x,cy:h.y,r:(b+f*7)%22+8,fill:"none",stroke:h.color,opacity:.16})]},f)),e.jsxs("text",{x:s/2,y:a-10,textAnchor:"middle",fill:"#5F6B6D",fontSize:"9",children:["Generated Diagram ",String(r).padStart(2,"0")]})]})}function vn({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const p=setInterval(()=>i(l=>l+1),60);return()=>clearInterval(p)},[]);const o=t?300:400,s=t?180:260,a=o/2,r=s*.45,d=[{x:a,y:r-60},{x:a-50,y:r-30},{x:a+50,y:r-30},{x:a-70,y:r+20},{x:a+70,y:r+20},{x:a,y:r+60},{x:a-30,y:r+40},{x:a+30,y:r+40}];return e.jsxs("svg",{width:"100%",viewBox:`0 0 ${o} ${s}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("defs",{children:e.jsxs("radialGradient",{id:"brainGlow",cx:"50%",cy:"50%",r:"50%",children:[e.jsx("stop",{offset:"0%",stopColor:"#0F6B73",stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:"#0F6B73",stopOpacity:"0"})]})}),e.jsx("circle",{cx:a,cy:r,r:80,fill:"url(#brainGlow)"}),d.map((p,l)=>d.slice(l+1).map((x,u)=>Math.hypot(p.x-x.x,p.y-x.y)>100?null:e.jsx("line",{x1:p.x,y1:p.y,x2:x.x,y2:x.y,stroke:"#0F6B73",strokeWidth:"1",opacity:"0.3"},`${l}-${u}`))),d.map((p,l)=>{const x=Math.sin(n*.1+l)*3+6;return e.jsx("circle",{cx:p.x,cy:p.y,r:x,fill:"#0F6B73",opacity:"0.8"},l)}),e.jsx("text",{x:a,y:s-10,textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",fontWeight:"600",children:"رابط عصبی هوشمند"})]})}function wn({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const r=setInterval(()=>i(d=>d+1),50);return()=>clearInterval(r)},[]);const o=320,s=200,a=[{x:60,y:140,h:40,color:"#5F6B6D"},{x:160,y:140,h:60,color:"#D49A2A"},{x:260,y:140,h:50,color:"#0F6B73"}];return e.jsxs("svg",{width:"100%",viewBox:`0 0 ${o} ${s}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[a.map((r,d)=>e.jsxs("g",{children:[e.jsx("rect",{x:r.x-25,y:r.y-r.h,width:"50",height:r.h,fill:r.color,opacity:"0.8",rx:"4"}),e.jsx("ellipse",{cx:r.x,cy:r.y-r.h,rx:"25",ry:"8",fill:r.color}),e.jsx("ellipse",{cx:r.x,cy:r.y,rx:"25",ry:"8",fill:r.color,stroke:"#FAF7F0",strokeWidth:"1"})]},d)),e.jsx("path",{d:"M 60 80 Q 160 30 260 80",fill:"none",stroke:"#D49A2A",strokeWidth:"2",strokeDasharray:"5 5",children:e.jsx("animate",{attributeName:"stroke-dashoffset",from:"40",to:"0",dur:"2s",repeatCount:"indefinite"})}),e.jsx("text",{x:o/2,y:s-5,textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"ساختار داده‌های برداری"})]})}function kn({compact:t=!1}){const[n,i]=c.useState(0);return c.useEffect(()=>{const o=setInterval(()=>i(s=>s+1),80);return()=>clearInterval(o)},[]),e.jsxs("svg",{width:"100%",viewBox:"0 0 400 220",style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("path",{d:"M100,100 Q120,60 180,70 T260,100 T340,100 T300,140 L140,140 Z",fill:"#F4EFE6",stroke:"#0F6B73",strokeWidth:"2",opacity:"0.6"}),[0,1,2].map(o=>{const s=150+o*50,a=110,r=(n+o*10)%20<10;return e.jsx("rect",{x:s,y:a,width:"30",height:"15",rx:"3",fill:r?"#D49A2A":"#5F6B6D",opacity:"0.9"},o)}),e.jsx("text",{x:"200",y:"170",textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"رایانش ابری و لبه شبکه"})]})}function Sn({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const d=setInterval(()=>i(p=>p+1),40);return()=>clearInterval(d)},[]);const o=120,s=100,a=280,r=n*.05;return e.jsxs("svg",{width:"100%",viewBox:"0 0 400 200",style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("circle",{cx:o,cy:s,r:"30",fill:"none",stroke:"#2F8F6B",strokeWidth:"1",strokeDasharray:"4 4"}),e.jsx("circle",{cx:a,cy:s,r:"30",fill:"none",stroke:"#2F8F6B",strokeWidth:"1",strokeDasharray:"4 4"}),e.jsx("line",{x1:o,y1:s,x2:a,y2:s,stroke:"#2F8F6B",strokeWidth:"2",opacity:"0.4"}),e.jsx("circle",{cx:o+Math.cos(r)*30,cy:s+Math.sin(r)*30,r:"6",fill:"#2F8F6B"}),e.jsx("circle",{cx:a+Math.cos(r+Math.PI)*30,cy:s+Math.sin(r+Math.PI)*30,r:"6",fill:"#2F8F6B"}),e.jsx("text",{x:"200",y:"160",textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"درهم‌تنیدگی کوانتومی"})]})}function Fn({compact:t=!1}){const[n,i]=c.useState(0);return c.useEffect(()=>{const o=setInterval(()=>i(s=>s+1),50);return()=>clearInterval(o)},[]),e.jsx("svg",{width:"100%",viewBox:"0 0 400 220",style:{fontFamily:"Vazirmatn, sans-serif"},children:e.jsxs("g",{transform:"translate(200, 100)",children:[e.jsx("rect",{x:"-80",y:"-40",width:"160",height:"80",rx:"10",fill:"#F4EFE6",stroke:"#C76D4A",strokeWidth:"2"}),e.jsx("text",{x:"0",y:"5",textAnchor:"middle",fill:"#C76D4A",fontSize:"14",fontWeight:"800",children:"VLA MODEL"}),e.jsx("line",{x1:"-120",y1:"-20",x2:"-80",y2:"-20",stroke:"#0F6B73",strokeWidth:"2",children:e.jsx("animate",{attributeName:"stroke-dasharray",from:"0,40",to:"40,0",dur:"1s",repeatCount:"indefinite"})}),e.jsx("text",{x:"-140",y:"-17",textAnchor:"middle",fill:"#0F6B73",fontSize:"9",children:"Vision"}),e.jsx("line",{x1:"-120",y1:"20",x2:"-80",y2:"20",stroke:"#D49A2A",strokeWidth:"2"}),e.jsx("text",{x:"-140",y:"23",textAnchor:"middle",fill:"#D49A2A",fontSize:"9",children:"Language"}),e.jsx("line",{x1:"80",y1:"0",x2:"130",y2:"0",stroke:"#2F8F6B",strokeWidth:"3"}),e.jsx("text",{x:"150",y:"4",textAnchor:"middle",fill:"#2F8F6B",fontSize:"10",fontWeight:"700",children:"ACTION"})]})})}function Dn({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const r=setInterval(()=>i(d=>d+1),60);return()=>clearInterval(r)},[]);const o=320,s=200,a=Array.from({length:10},(r,d)=>d);return e.jsxs("svg",{width:"100%",viewBox:`0 0 ${o} ${s}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[a.map(r=>{const d=30+r*15,p=160+Math.sin(n*.1+r*.8)*40,l=160-Math.sin(n*.1+r*.8)*40;return e.jsxs("g",{children:[e.jsx("line",{x1:p,y1:d,x2:l,y2:d,stroke:"#E4DDD2",strokeWidth:"1"}),e.jsx("circle",{cx:p,cy:d,r:"5",fill:"#C76D4A"}),e.jsx("circle",{cx:l,cy:d,r:"5",fill:"#0F6B73"})]},r)}),e.jsx("text",{x:o/2,y:s-5,textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"مهندسی ژنتیک و بیوتکنولوژی"})]})}function Cn({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const a=setInterval(()=>i(r=>r+1),40);return()=>clearInterval(a)},[]);const o=160,s=100;return e.jsxs("svg",{width:"100%",viewBox:"0 0 320 200",style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("circle",{cx:o,cy:s,r:"50",fill:"none",stroke:"#D49A2A",strokeWidth:"2",strokeDasharray:"5 5",children:e.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:`0 ${o} ${s}`,to:`360 ${o} ${s}`,dur:"4s",repeatCount:"indefinite"})}),e.jsx("circle",{cx:o,cy:s,r:20+Math.sin(n*.2)*5,fill:"#D49A2A",opacity:"0.8",children:e.jsx("animate",{attributeName:"opacity",values:"0.5;0.9;0.5",dur:"1s",repeatCount:"indefinite"})}),e.jsx("text",{x:o,y:s+75,textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"گداخت هسته‌ای و انرژی پاک"})]})}function An({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const d=setInterval(()=>i(p=>p+1),50);return()=>clearInterval(d)},[]);const o=160,s=100,a=o+Math.cos(n*.03)*80,r=s+Math.sin(n*.03)*40;return e.jsxs("svg",{width:"100%",viewBox:"0 0 320 200",style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("circle",{cx:o,cy:s,r:"30",fill:"#0F6B73",opacity:"0.6"}),e.jsx("ellipse",{cx:o,cy:s,rx:"80",ry:"40",fill:"none",stroke:"#E4DDD2",strokeWidth:"1"}),e.jsxs("g",{transform:`translate(${a}, ${r}) rotate(${n*1.7})`,children:[e.jsx("rect",{x:"-8",y:"-4",width:"16",height:"8",fill:"#5F6B6D"}),e.jsx("rect",{x:"-15",y:"-2",width:"7",height:"4",fill:"#D49A2A"}),e.jsx("rect",{x:"8",y:"-2",width:"7",height:"4",fill:"#D49A2A"})]}),e.jsx("line",{x1:o,y1:s,x2:a,y2:r,stroke:"#0F6B73",strokeWidth:"1",strokeDasharray:"2 2"}),e.jsx("text",{x:o,y:H-5,textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"ارتباطات ماهواره‌ای و فضا"})]})}function Bn({compact:t=!1}){const n=[0,1,2,3];return e.jsxs("svg",{width:"100%",viewBox:"0 0 400 150",style:{fontFamily:"Vazirmatn, sans-serif"},children:[n.map(i=>e.jsxs("g",{transform:`translate(${40+i*90}, 50)`,children:[e.jsx("rect",{width:"60",height:"50",rx:"6",fill:"#F4EFE6",stroke:"#2F8F6B",strokeWidth:"2"}),e.jsxs("text",{x:"30",y:"30",textAnchor:"middle",fill:"#2F8F6B",fontSize:"10",fontWeight:"800",children:["BLOCK ",i]}),i<3&&e.jsx("line",{x1:"60",y1:"25",x2:"90",y2:"25",stroke:"#2F8F6B",strokeWidth:"2",strokeDasharray:"4 2"})]},i)),e.jsx("text",{x:"200",y:"130",textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"فناوری زنجیره بلوکی و فین‌تک"})]})}function Ge({variant:t="corpus",compact:n=!1}){const i=c.useRef(null),[o,s]=c.useState("TekRAG-Persian");c.useEffect(()=>{const r=i.current;if(!r)return;const d=new Pi,p=new Mi(45,1,.1,100);p.position.set(0,3.2,8.5);const l=new Ni({antialias:!0,alpha:!0});l.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),l.outputColorSpace=Hi,r.appendChild(l.domElement);const x=new Vi;d.add(x),d.add(new _i(16777215,.7));const u=new jt(16777215,1.4);u.position.set(4,6,5),d.add(u);const g=new jt(13933098,.8);g.position.set(-5,3,-4),d.add(g);const b=[],h={teal:1010547,gold:13933098,clay:13069642,green:3116907,ink:2110522,line:14998994,red:13192268,cream:16052198},f=(_,R)=>(_.userData.label=R,b.push(_),_),y=(_,R,F,T,X=.92)=>{const E=new Ze(new Ui(F[0],F[1],F[2]),new et({color:T,roughness:.48,metalness:.12,transparent:X<1,opacity:X}));E.position.set(...R),x.add(f(E,_));const $=new qi(new Gi(E.geometry),new vt({color:16777215,transparent:!0,opacity:.18}));return E.add($),E},m=(_,R,F,T,X=.95)=>{const E=new Ze(new Qi(F,28,18),new et({color:T,roughness:.35,metalness:.2,transparent:X<1,opacity:X}));return E.position.set(...R),x.add(f(E,_)),E},v=(_,R,F=h.line,T=.45)=>{const X=new Yi().setFromPoints([new wt(..._),new wt(...R)]),E=new Xi(X,new vt({color:F,transparent:!0,opacity:T}));return x.add(E),E};if(t==="corpus"){[["Raw HTML export",-1.8,h.ink],["Persian normalization",-.6,h.teal],["Heading-aware chunks",.6,h.gold],["Metadata and provenance",1.8,h.green]].forEach(([R,F,T],X)=>{const E=y(R,[0,F,0],[5.8,.22,3.2],T,.42);E.rotation.y=X%2?.08:-.08;for(let $=0;$<9;$+=1){const Q=-2.2+$%3*2.2+(X%2?.15:-.1),ee=-1.05+Math.floor($/3)*1.05,Be=m(`${R}: document ${$+1}`,[Q,F+.28,ee],.09,X%2?h.cream:h.gold,.82);Be.scale.y=.55}});for(let R=0;R<8;R+=1){const F=-2.3+R%4*1.55,T=-1.35+R%2*2.7;v([F,-1.65,T],[F*.72,1.95,T*.55],h.gold,.36)}m("Benchmark release: QA plus evidence IDs",[0,2.45,0],.38,h.clay),p.position.set(0,4.1,8.2)}else if(t==="retrieval"){v([-3.3,0,0],[3.3,0,0],h.teal,.5),v([0,-2.2,0],[0,2.2,0],h.gold,.5),v([0,0,-2.8],[0,0,2.8],h.green,.5);const _=[["BM25 exact acronym region",[-1.75,.45,-.6],h.gold],["Dense semantic Persian region",[1.55,.1,.75],h.teal],["Hybrid fused evidence region",[.2,1.2,-.1],h.green]];_.forEach(([F,T,X],E)=>{m(F,T,.3,X,.82);for(let $=0;$<18;$+=1){const Q=$/18*Math.PI*2,ee=.35+$%5*.09,Be=[T[0]+Math.cos(Q)*ee,T[1]+Math.sin(Q*1.7)*.38,T[2]+Math.sin(Q)*ee];m(`${F}: chunk ${$+1}`,Be,.055,X,.76)}});const R=m("Persian technical user query",[-3,-1.45,1.7],.22,h.red);_.forEach(([,F],T)=>v(R.position.toArray(),F,T===1?h.teal:h.gold,.48)),y("Reranker: top-k evidence gate",[0,-1.55,0],[1.9,.16,1],h.ink,.68),p.position.set(.2,2.9,7.4)}else{[["Recall@k",-2.4,1.55,h.teal],["Citation precision",-1.2,2.1,h.green],["Atomic support precision",0,2.45,h.gold],["Abstention F1",1.2,1.65,h.clay],["Unsupported-claim rate",2.4,.9,h.red]].forEach(([T,X,E,$])=>{const Q=y(T,[X,E/2-1.2,0],[.52,E,.52],$,.9),ee=m(`${T}: confidence interval marker`,[X,E-1,0],.18,$,.95);v([X,E-1,-.65],[X,E-1,.65],$,.48),Q.rotation.y=.2,ee.scale.y=.7});const R=new Oi(1.55,.025,12,96),F=new Ze(R,new et({color:h.teal,transparent:!0,opacity:.5}));F.rotation.x=Math.PI/2,F.position.y=-1.05,x.add(f(F,"Paired statistical testing and confidence intervals"));for(let T=0;T<14;T+=1){const X=T/14*Math.PI*2;m("Hallucination error atom",[Math.cos(X)*1.55,-1.05,Math.sin(X)*1.55],.065,T%3===0?h.red:h.gold,.82)}p.position.set(0,3,7.2)}const j=new Ki,I=new Ji;let w=0,D=!1,L=0,P=0,V=-.16,B=.34;l.domElement.style.display="block";const z=()=>{const _=r.getBoundingClientRect(),R=Math.max(_.width||r.offsetWidth||600,280),F=n?240:340;l.setSize(R,F),p.aspect=R/F,p.updateProjectionMatrix()};z(),requestAnimationFrame(z);const Y=new ResizeObserver(z);Y.observe(r);const Z=_=>{const R=l.domElement.getBoundingClientRect();I.x=(_.clientX-R.left)/R.width*2-1,I.y=-((_.clientY-R.top)/R.height)*2+1,j.setFromCamera(I,p);const F=j.intersectObjects(b,!0)[0],T=F?.object?.userData?.label||F?.object?.parent?.userData?.label;T&&s(T),D&&(B+=(_.clientX-L)*.008,V+=(_.clientY-P)*.006,L=_.clientX,P=_.clientY)},ne=_=>{D=!0,L=_.clientX,P=_.clientY,l.domElement.setPointerCapture?.(_.pointerId)},oe=_=>{D=!1,l.domElement.releasePointerCapture?.(_.pointerId)};l.domElement.addEventListener("pointermove",Z),l.domElement.addEventListener("pointerdown",ne),l.domElement.addEventListener("pointerup",oe),l.domElement.addEventListener("pointerleave",oe);const ke=()=>{B+=D?0:.003,x.rotation.x+=(V-x.rotation.x)*.08,x.rotation.y+=(B-x.rotation.y)*.08,l.render(d,p),w=requestAnimationFrame(ke)};return ke(),()=>{cancelAnimationFrame(w),Y.disconnect(),l.domElement.removeEventListener("pointermove",Z),l.domElement.removeEventListener("pointerdown",ne),l.domElement.removeEventListener("pointerup",oe),l.domElement.removeEventListener("pointerleave",oe),l.dispose(),d.traverse(_=>{_.geometry?.dispose?.(),Array.isArray(_.material)?_.material.forEach(R=>R.dispose?.()):_.material?.dispose?.()}),r.replaceChildren()}},[t,n]);const a={corpus:["Raw","Cleaned","Metadata","Provenance"],retrieval:["BM25","Dense","Hybrid","Rerank"],evaluation:["Recall","Citation","Support","Abstention"]}[t]||["TekRAG","RAG","QA"];return e.jsxs("div",{className:"tekrag-3d-shell",style:{direction:"ltr",textAlign:"left"},children:[e.jsx("div",{ref:i,className:"tekrag-3d-canvas","data-diagram-3d":t,style:{width:"100%",minHeight:n?240:340,borderRadius:12,overflow:"hidden",background:"radial-gradient(circle at 50% 20%, #ffffff 0%, #f4efe6 42%, #e9f2f2 100%)"}}),e.jsxs("div",{className:"tekrag-3d-overlay",style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap",alignItems:"center",marginTop:10},children:[e.jsx("div",{style:{fontSize:12,color:"#0F6B73",fontWeight:800,lineHeight:1.6},children:o}),e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:a.map(r=>e.jsx("span",{style:{fontSize:10,color:"#5F6B6D",border:"1px solid #E4DDD2",borderRadius:999,padding:"2px 8px",background:"#fff"},children:r},r))})]})]})}function ui({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const r=setInterval(()=>i(d=>(d+1)%120),80);return()=>clearInterval(r)},[]);const o=t?200:280,s=[{label:"Input",base:40,peak:110,color:"#0F6B73"},{label:"Output",base:55,peak:140,color:"#D49A2A"},{label:"Cache",base:20,peak:70,color:"#2F8F6B"},{label:"Image",base:65,peak:160,color:"#C76D4A"},{label:"Audio",base:30,peak:90,color:"#5F6B6D"}],a=(Math.sin(n*.08)+1)/2;return e.jsxs("svg",{width:"100%",viewBox:`0 0 420 ${o}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("rect",{x:"0",y:"0",width:"420",height:o,rx:"12",fill:"#FAF7F0"}),s.map((r,d)=>{const p=r.base+(r.peak-r.base)*a,l=40+d*72;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:o-50-p,width:48,height:p,rx:"4",fill:r.color,opacity:"0.85"}),e.jsx("rect",{x:l,y:o-50-p,width:48,height:8,rx:"4",fill:r.color}),e.jsx("text",{x:l+24,y:o-32,textAnchor:"middle",fill:"#263238",fontSize:"9",children:r.label}),e.jsxs("text",{x:l+24,y:o-55-p,textAnchor:"middle",fill:r.color,fontSize:"10",fontWeight:"700",children:[Math.round(r.base+(r.peak-r.base)*a),"k"]})]},d)}),e.jsx("text",{x:"210",y:"22",textAnchor:"middle",fill:"#0F6B73",fontSize:"12",fontWeight:"700",children:"Token Usage"}),e.jsx("line",{x1:"30",y1:o-50,x2:"390",y2:o-50,stroke:"#E4DDD2",strokeWidth:"1.5"}),[0,40,80,120,160].map((r,d)=>e.jsxs("text",{x:"28",y:o-50-r,textAnchor:"end",fill:"#5F6B6D",fontSize:"8",children:[r,"k"]},d))]})}function hi({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const a=setInterval(()=>i(r=>r+1),100);return()=>clearInterval(a)},[]);const o=t?200:280,s=Math.sin(n*.05)*12;return e.jsxs("svg",{width:"100%",viewBox:`0 0 420 ${o}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("rect",{x:"0",y:"0",width:"420",height:o,rx:"12",fill:"#FAF7F0"}),e.jsx("line",{x1:"210",y1:"30",x2:"210",y2:o-40,stroke:"#263238",strokeWidth:"3"}),e.jsx("line",{x1:"210",y1:"50",x2:"130",y2:60+s,stroke:"#263238",strokeWidth:"2"}),e.jsx("line",{x1:"210",y1:"50",x2:"290",y2:60-s,stroke:"#263238",strokeWidth:"2"}),e.jsx("ellipse",{cx:"130",cy:65+s,rx:"36",ry:"14",fill:"#0F6B73",opacity:"0.15",stroke:"#0F6B73",strokeWidth:"1.5"}),e.jsx("text",{x:"130",y:69+s,textAnchor:"middle",fill:"#0F6B73",fontSize:"9",fontWeight:"700",children:"AI Product"}),e.jsx("ellipse",{cx:"290",cy:65-s,rx:"36",ry:"14",fill:"#C76D4A",opacity:"0.15",stroke:"#C76D4A",strokeWidth:"1.5"}),e.jsx("text",{x:"290",y:69-s,textAnchor:"middle",fill:"#C76D4A",fontSize:"9",fontWeight:"700",children:"Liability"}),e.jsx("rect",{x:"200",y:o-40,width:"20",height:"14",rx:"2",fill:"#D49A2A",opacity:"0.8"}),e.jsx("text",{x:"210",y:"24",textAnchor:"middle",fill:"#263238",fontSize:"11",fontWeight:"700",children:"AI Legal Scales"}),["CEO","Product","Corp"].map((a,r)=>e.jsxs("g",{children:[e.jsx("circle",{cx:80+r*60,cy:o-60,r:"16",fill:["#0F6B73","#2F8F6B","#D49A2A"][r],opacity:"0.2",stroke:["#0F6B73","#2F8F6B","#D49A2A"][r],strokeWidth:"1.5"}),e.jsx("text",{x:80+r*60,y:o-56,textAnchor:"middle",fill:["#0F6B73","#2F8F6B","#D49A2A"][r],fontSize:"8",children:a})]},r))]})}function fi({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const r=setInterval(()=>i(d=>d+1),60);return()=>clearInterval(r)},[]);const o=t?200:280,s=[{x:210,y:60,label:"v₁",color:"#D49A2A"},{x:120,y:120,label:"v₂",color:"#0F6B73"},{x:300,y:120,label:"v₃",color:"#0F6B73"},{x:80,y:200,label:"v₄",color:"#2F8F6B"},{x:170,y:200,label:"v₅",color:"#2F8F6B"},{x:250,y:200,label:"v₆",color:"#2F8F6B"},{x:340,y:200,label:"v₇",color:"#C76D4A"}],a=[[0,1],[0,2],[1,3],[1,4],[2,5],[2,6],[3,4],[4,5],[5,6]];return e.jsxs("svg",{width:"100%",viewBox:`0 0 420 ${o}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("rect",{x:"0",y:"0",width:"420",height:o,rx:"12",fill:"#FAF7F0"}),a.map(([r,d],p)=>{const l=(n*.02+p*.3)%1,x=s[r].x+(s[d].x-s[r].x)*l,u=s[r].y+(s[d].y-s[r].y)*l;return e.jsxs("g",{children:[e.jsx("line",{x1:s[r].x,y1:s[r].y,x2:s[d].x,y2:s[d].y,stroke:"#E4DDD2",strokeWidth:"1.5"}),e.jsx("circle",{cx:x,cy:u,r:"3",fill:"#D49A2A",opacity:"0.8"})]},p)}),s.map((r,d)=>e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:"16",fill:r.color,opacity:"0.15",stroke:r.color,strokeWidth:"2"}),e.jsx("text",{x:r.x,y:r.y+4,textAnchor:"middle",fill:r.color,fontSize:"11",fontWeight:"700",children:r.label})]},d)),e.jsx("text",{x:"210",y:o-14,textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"Unit Distance Graph — Erdős Conjecture"})]})}function mi({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const x=setInterval(()=>i(u=>u+1),50);return()=>clearInterval(x)},[]);const o=t?200:280,s=210,a=o/2,r=t?70:90,d=["Plan","Act","Observe","Reflect"],p=["#0F6B73","#D49A2A","#2F8F6B","#C76D4A"],l=Math.floor(n/30)%4;return e.jsxs("svg",{width:"100%",viewBox:`0 0 420 ${o}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("rect",{x:"0",y:"0",width:"420",height:o,rx:"12",fill:"#FAF7F0"}),d.map((x,u)=>{const g=u/4*Math.PI*2-Math.PI/2,b=s+Math.cos(g)*r,h=a+Math.sin(g)*r,y=(u+1)%4/4*Math.PI*2-Math.PI/2,m=s+Math.cos(y)*r,v=a+Math.sin(y)*r,j=n%30/30,I=b+(m-b)*j,w=h+(v-h)*j;return e.jsxs("g",{children:[e.jsx("line",{x1:b,y1:h,x2:m,y2:v,stroke:p[u],strokeWidth:"2",opacity:"0.4",strokeDasharray:"4 3"}),l===u&&e.jsx("circle",{cx:I,cy:w,r:"5",fill:p[u],opacity:"0.9"}),e.jsx("circle",{cx:b,cy:h,r:l===u?22:18,fill:p[u],opacity:l===u?.25:.12,stroke:p[u],strokeWidth:"2"}),e.jsx("text",{x:b,y:h+4,textAnchor:"middle",fill:p[u],fontSize:"9",fontWeight:"700",children:x})]},u)}),e.jsx("circle",{cx:s,cy:a,r:"22",fill:"#263238",opacity:"0.08"}),e.jsx("text",{x:s,y:a+4,textAnchor:"middle",fill:"#263238",fontSize:"10",fontWeight:"700",children:"Agent"})]})}function yi({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const r=setInterval(()=>i(d=>d+1),70);return()=>clearInterval(r)},[]);const o=t?200:280,s=[{x:100,y:80,label:"US",color:"#0F6B73"},{x:200,y:60,label:"EU",color:"#D49A2A"},{x:310,y:80,label:"China",color:"#C76D4A"},{x:80,y:180,label:"India",color:"#2F8F6B"},{x:200,y:190,label:"MENA",color:"#5F6B6D"},{x:330,y:180,label:"APAC",color:"#0F6B73"}],a=[[0,1],[0,3],[1,2],[1,4],[2,5],[3,4],[4,5]];return e.jsxs("svg",{width:"100%",viewBox:`0 0 420 ${o}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("rect",{x:"0",y:"0",width:"420",height:o,rx:"12",fill:"#FAF7F0"}),e.jsx("ellipse",{cx:"210",cy:"140",rx:"190",ry:"100",fill:"none",stroke:"#E4DDD2",strokeWidth:"1",strokeDasharray:"6 4",opacity:"0.6"}),a.map(([r,d],p)=>{const l=(n*.015+p*.2)%1,x=s[r].x+(s[d].x-s[r].x)*l,u=s[r].y+(s[d].y-s[r].y)*l;return e.jsxs("g",{children:[e.jsx("line",{x1:s[r].x,y1:s[r].y,x2:s[d].x,y2:s[d].y,stroke:"#E4DDD2",strokeWidth:"1.5"}),e.jsx("circle",{cx:x,cy:u,r:"3.5",fill:s[r].color,opacity:"0.85"})]},p)}),s.map((r,d)=>e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:"20",fill:r.color,opacity:"0.15",stroke:r.color,strokeWidth:"2"}),e.jsx("text",{x:r.x,y:r.y+4,textAnchor:"middle",fill:r.color,fontSize:"9",fontWeight:"700",children:r.label})]},d)),e.jsx("text",{x:"210",y:o-14,textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"Geopolitical AI Ecosystem"})]})}function bi({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const a=setInterval(()=>i(r=>r+1),90);return()=>clearInterval(a)},[]);const o=t?200:280,s=[0,1,2,3,4].map(a=>({label:["HTML","CSS","JS","API","WS"][a],color:["#0F6B73","#D49A2A","#C76D4A","#2F8F6B","#5F6B6D"][a],w:[160,80,120,100,60][a]}));return e.jsxs("svg",{width:"100%",viewBox:`0 0 420 ${o}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("rect",{x:"0",y:"0",width:"420",height:o,rx:"12",fill:"#FAF7F0"}),e.jsx("rect",{x:"20",y:"20",width:"380",height:"26",rx:"6",fill:"#263238",opacity:"0.08"}),e.jsx("circle",{cx:"38",cy:"33",r:"5",fill:"#C76D4A",opacity:"0.7"}),e.jsx("circle",{cx:"54",cy:"33",r:"5",fill:"#D49A2A",opacity:"0.7"}),e.jsx("circle",{cx:"70",cy:"33",r:"5",fill:"#2F8F6B",opacity:"0.7"}),e.jsx("rect",{x:"84",y:"26",width:"260",height:"14",rx:"4",fill:"#fff",opacity:"0.5"}),e.jsx("text",{x:"214",y:"36",textAnchor:"middle",fill:"#263238",fontSize:"8",opacity:"0.6",children:"teknav.ir/article/..."}),s.map((a,r)=>{const d=58+r*34,p=Math.min(a.w,a.w*((n+r*12)%60/60)*1.8);return e.jsxs("g",{children:[e.jsx("text",{x:"75",y:d+10,textAnchor:"end",fill:"#5F6B6D",fontSize:"9",children:a.label}),e.jsx("rect",{x:"80",y:d,width:a.w,height:"18",rx:"3",fill:"#E4DDD2"}),e.jsx("rect",{x:"80",y:d,width:Math.min(p,a.w),height:"18",rx:"3",fill:a.color,opacity:"0.75"}),e.jsxs("text",{x:83,y:d+12,fill:"#fff",fontSize:"8",opacity:"0.9",children:[Math.round(Math.min(p,a.w)/a.w*100),"%"]})]},r)}),e.jsx("text",{x:"210",y:o-14,textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"Browser DevTools — Network"})]})}function ji({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const r=setInterval(()=>i(d=>d+1),80);return()=>clearInterval(r)},[]);const o=t?200:280,s=[{x:30,label:"Stack",owned:!0},{x:110,label:"Heap A",owned:!0},{x:190,label:"Heap B",owned:!1},{x:270,label:"Heap C",owned:!0},{x:350,label:"Static",owned:!0}],a=Math.sin(n*.15)>.7;return e.jsxs("svg",{width:"100%",viewBox:`0 0 420 ${o}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("rect",{x:"0",y:"0",width:"420",height:o,rx:"12",fill:"#FAF7F0"}),e.jsx("text",{x:"210",y:"22",textAnchor:"middle",fill:"#263238",fontSize:"11",fontWeight:"700",children:"Memory Safety — Rust Ownership"}),s.map((r,d)=>{const p=!r.owned,l=p?"#C76D4A":"#2F8F6B",x=60+Math.sin(n*.05+d)*10;return e.jsxs("g",{children:[e.jsx("rect",{x:r.x,y:o-60-x,width:"60",height:x,rx:"4",fill:l,opacity:p&&a?.9:.2,stroke:l,strokeWidth:"2"}),e.jsx("text",{x:r.x+30,y:o-63-x,textAnchor:"middle",fill:l,fontSize:"8",fontWeight:"700",children:r.owned?"✓":"✗"}),e.jsx("text",{x:r.x+30,y:o-40,textAnchor:"middle",fill:l,fontSize:"8",children:r.label})]},d)}),e.jsx("rect",{x:"185",y:o-120,width:"70",height:"20",rx:"4",fill:"#C76D4A",opacity:a?.3:.1,stroke:"#C76D4A",strokeWidth:"1",strokeDasharray:"3 2"}),e.jsx("text",{x:"220",y:o-107,textAnchor:"middle",fill:"#C76D4A",fontSize:"8",children:"use-after-free"}),e.jsx("line",{x1:"30",y1:o-55,x2:"390",y2:o-55,stroke:"#E4DDD2",strokeWidth:"1.5"})]})}function vi({compact:t=!1}){const[n,i]=c.useState(0);c.useEffect(()=>{const r=setInterval(()=>i(d=>d+1),60);return()=>clearInterval(r)},[]);const o=t?200:280,s=[{x:60,y:o/2,label:"نویسنده",color:"#D49A2A",r:22},{x:210,y:o/2-30,label:"پلتفرم",color:"#0F6B73",r:28},{x:210,y:o/2+30,label:"RSS/Feed",color:"#2F8F6B",r:20},{x:360,y:o/2-60,label:"خواننده ۱",color:"#5F6B6D",r:16},{x:360,y:o/2,label:"خواننده ۲",color:"#5F6B6D",r:16},{x:360,y:o/2+60,label:"خواننده ۳",color:"#5F6B6D",r:16}],a=[[0,1],[0,2],[1,3],[1,4],[1,5],[2,3],[2,4],[2,5]];return e.jsxs("svg",{width:"100%",viewBox:`0 0 420 ${o}`,style:{fontFamily:"Vazirmatn, sans-serif"},children:[e.jsx("rect",{x:"0",y:"0",width:"420",height:o,rx:"12",fill:"#FAF7F0"}),a.map(([r,d],p)=>{const l=(n*.02+p*.15)%1,x=s[r].x+(s[d].x-s[r].x)*l,u=s[r].y+(s[d].y-s[r].y)*l;return e.jsxs("g",{children:[e.jsx("line",{x1:s[r].x,y1:s[r].y,x2:s[d].x,y2:s[d].y,stroke:"#E4DDD2",strokeWidth:"1.5",opacity:"0.8"}),e.jsx("circle",{cx:x,cy:u,r:"3",fill:s[r].color,opacity:"0.85"})]},p)}),s.map((r,d)=>e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r,fill:r.color,opacity:"0.15",stroke:r.color,strokeWidth:"2"}),e.jsx("text",{x:r.x,y:r.y+4,textAnchor:"middle",fill:r.color,fontSize:"8",fontWeight:"700",children:r.label})]},d)),e.jsx("text",{x:"210",y:o-14,textAnchor:"middle",fill:"#5F6B6D",fontSize:"10",children:"Content Distribution Network"})]})}function Oe({type:t,compact:n=!1}){const i={neural:ct,pipeline:si,cyber:oi,growth:ai,chip:li,timeline:di,arch:ci,wave:pi,orbit:gi,brain:vn,database:wn,cloud:kn,quantum:Sn,vla:Fn,dna:Dn,fusion:Cn,satellite:An,blockchain:Bn,billing:ui,legal:hi,math:fi,"agent-loop":mi,geopolitics:yi,browser:bi,"memory-safety":ji,media:vi,"tekrag-corpus-3d":s=>e.jsx(Ge,{...s,variant:"corpus"}),"tekrag-retrieval-3d":s=>e.jsx(Ge,{...s,variant:"retrieval"}),"tekrag-evaluation-3d":s=>e.jsx(Ge,{...s,variant:"evaluation"})};if(typeof t=="string"&&/^diagram-\d{3}$/.test(t)){const s=Number(t.split("-")[1]);return e.jsx(xi,{compact:n,variant:s})}const o=i[t]||ct;return e.jsx(o,{compact:n})}const zn=Object.freeze(Object.defineProperty({__proto__:null,AgentLoopDiagram:mi,BillingDiagram:ui,BrowserDiagram:bi,CyberSecurityDiagram:oi,DataPipelineDiagram:si,DiagramRenderer:Oe,FutureTimelineDiagram:di,GeneratedDiagram:xi,GeopoliticsDiagram:yi,HardwareChipDiagram:li,LegalDiagram:hi,MathDiagram:fi,MediaDiagram:vi,MemorySafetyDiagram:ji,NeuralNetworkDiagram:ct,OrbitDiagram:gi,SoftwareArchDiagram:ci,StartupGrowthDiagram:ai,TekRagThreeDiagram:Ge,WaveStreamDiagram:pi},Symbol.toStringTag,{value:"Module"}));function En(){const t=c.useRef();return c.useEffect(()=>{const n=t.current;if(!n)return;const i=n.getContext("2d");let o,s=0;const a=["rgba(15,107,115,","rgba(196,106,77,","rgba(47,143,107,"],r=Array.from({length:32},(l,x)=>({x:Math.random()*n.width,y:Math.random()*n.height,vx:(Math.random()-.5)*.35,vy:(Math.random()-.5)*.35,r:Math.random()*3+1.5,color:a[x%a.length],phase:Math.random()*Math.PI*2})),d=()=>{n.width=n.offsetWidth,n.height=n.offsetHeight};d(),window.addEventListener("resize",d);const p=()=>{s+=.012,i.clearRect(0,0,n.width,n.height),r.forEach(l=>{l.x+=l.vx,l.y+=l.vy,(l.x<0||l.x>n.width)&&(l.vx*=-1),(l.y<0||l.y>n.height)&&(l.vy*=-1),r.forEach(u=>{const g=Math.hypot(l.x-u.x,l.y-u.y);g<130&&(i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(u.x,u.y),i.strokeStyle=`rgba(15,107,115,${.18*(1-g/130)})`,i.lineWidth=.8,i.stroke())});const x=.45+.18*Math.sin(s+l.phase);i.beginPath(),i.arc(l.x,l.y,l.r,0,Math.PI*2),i.fillStyle=l.color+x+")",i.fill()}),o=requestAnimationFrame(p)};return p(),()=>{cancelAnimationFrame(o),window.removeEventListener("resize",d)}},[]),e.jsx("canvas",{ref:t,style:{position:"absolute",inset:0,width:"100%",height:"100%"}})}function Pe({article:t,delay:n=0,readProgress:i=null}){const{navigate:o}=q(),{user:s}=ae(),[a,r]=c.useState(!1),[d,p]=c.useState(!1),l=c.useRef();Ke(l,t.slug),c.useEffect(()=>{const b=new IntersectionObserver(([h])=>{h.isIntersecting&&r(!0)},{threshold:.1});return l.current&&b.observe(l.current),()=>b.disconnect()},[]);const x=M.authors.find(b=>b.id===t.authorId),u=M.categories.find(b=>b.id===t.category),g=i!==null&&i>=5&&i<=95;return e.jsxs("div",{ref:l,onClick:()=>o("/article/"+t.slug),style:{background:"#fff",borderRadius:12,border:"1px solid #E4DDD2",padding:24,cursor:"pointer",direction:"rtl",opacity:a?1:0,transform:a?"translateY(0)":"translateY(24px)",transition:`opacity 0.5s ${n}ms, transform 0.5s ${n}ms, box-shadow 0.2s`,boxShadow:"0 2px 12px rgba(0,0,0,0.04)"},onMouseEnter:b=>b.currentTarget.style.boxShadow="0 8px 32px rgba(0,0,0,0.1)",onMouseLeave:b=>b.currentTarget.style.boxShadow="0 2px 12px rgba(0,0,0,0.04)",children:[e.jsxs("div",{style:{height:120,borderRadius:8,background:"#F4EFE6",marginBottom:16,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:[e.jsx("div",{style:{transform:"scale(0.7)",transformOrigin:"center",width:"100%"},children:e.jsx(Oe,{type:t.diagram,compact:!0})}),g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:4,background:"rgba(0,0,0,0.1)"},children:e.jsx("div",{style:{height:"100%",background:"#0F6B73",width:`${i}%`,transition:"width 0.3s"}})}),e.jsx("span",{style:{position:"absolute",bottom:8,insetInlineEnd:8,background:"#0F6B73",color:"#fff",fontSize:10,fontWeight:700,padding:"3px 8px",borderRadius:6,fontFamily:"Vazirmatn,sans-serif"},children:"ادامه مطالعه"})]})]}),e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:10,flexWrap:"wrap"},children:[e.jsx(We,{type:t.type,small:!0}),e.jsx(De,{name:t.categoryName,color:u?.color,small:!0}),t.sponsored&&e.jsx("span",{style:{background:"#FFF4D8",color:"#8A5A00",border:"1px solid #D49A2A55",borderRadius:6,padding:"2px 8px",fontSize:10,fontWeight:800},children:"Promoted Content"}),t.premiumOnly&&e.jsx("span",{style:{background:"#0F2A2E",color:"#D49A2A",borderRadius:6,padding:"2px 8px",fontSize:10,fontWeight:800},children:"Premium"})]}),e.jsx("h3",{style:{fontSize:15,fontWeight:700,color:"#263238",margin:"0 0 8px",lineHeight:1.5,fontFamily:"Vazirmatn,sans-serif"},children:t.title}),e.jsxs("p",{style:{fontSize:12,color:"#5F6B6D",lineHeight:1.7,margin:"0 0 16px"},children:[t.summary.slice(0,100),"..."]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:11,color:"#5F6B6D"},children:[e.jsx("span",{children:t.date}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[x&&e.jsx(je,{author:x,size:22}),e.jsxs("span",{children:[t.readTime," دقیقه"]}),s&&e.jsx("button",{onClick:b=>{b.stopPropagation(),p(!0)},title:"ذخیره در لیست",style:{background:"none",border:"none",cursor:"pointer",padding:"2px 4px",color:"#0F6B73",fontSize:14,lineHeight:1},children:"🔖"})]})]}),d&&e.jsx(ri,{articleId:t.id,onDone:()=>p(!1)})]})}function Rn({article:t}){const{navigate:n}=q(),i=c.useRef();Ke(i,t.slug);const o=M.authors.find(a=>a.id===t.authorId),s=M.categories.find(a=>a.id===t.category);return e.jsxs("div",{ref:i,onClick:()=>n("/article/"+t.slug),style:{background:"#fff",borderRadius:16,border:"1px solid #E4DDD2",padding:0,cursor:"pointer",overflow:"hidden",direction:"rtl",boxShadow:"0 4px 24px rgba(0,0,0,0.06)",display:"grid",gridTemplateColumns:"1fr 1fr",minHeight:280,transition:"box-shadow 0.2s"},className:"featured-card",onMouseEnter:a=>a.currentTarget.style.boxShadow="0 12px 48px rgba(0,0,0,0.12)",onMouseLeave:a=>a.currentTarget.style.boxShadow="0 4px 24px rgba(0,0,0,0.06)",children:[e.jsxs("div",{style:{padding:"32px 32px 32px 24px",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:14},children:[e.jsx(We,{type:t.type}),e.jsx(De,{name:t.categoryName,color:s?.color}),t.sponsored&&e.jsx("span",{style:{background:"#FFF4D8",color:"#8A5A00",border:"1px solid #D49A2A55",borderRadius:6,padding:"4px 10px",fontSize:11,fontWeight:800},children:"Promoted Content"}),t.premiumOnly&&e.jsx("span",{style:{background:"#0F2A2E",color:"#D49A2A",borderRadius:6,padding:"4px 10px",fontSize:11,fontWeight:800},children:"Premium"})]}),e.jsx("h2",{style:{fontSize:22,fontWeight:800,color:"#263238",margin:"0 0 12px",lineHeight:1.5,fontFamily:"Vazirmatn,sans-serif"},children:t.title}),e.jsx("p",{style:{fontSize:14,color:"#5F6B6D",lineHeight:1.8,margin:0},children:t.summary})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginTop:20,paddingTop:16,borderTop:"1px solid #E4DDD2"},children:[o&&e.jsx(je,{author:o,size:36}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#263238"},children:t.authorName}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D"},children:[t.date," · ",t.readTime," دقیقه مطالعه"]})]})]})]}),e.jsx("div",{style:{background:"#F4EFE6",display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:e.jsx(Oe,{type:t.diagram})})]})}function Wn(t){const n=t.username||M.authors.find(i=>i.slug===t.slug)?.username;return n?`/profile/@${n}`:`/author/${t.slug}`}function In(){const{navigate:t}=q(),[n,i]=c.useState(M.authors);return c.useEffect(()=>{let o=!1;return U.listAuthors().then(s=>{if(o||!s?.length)return;const a=s.map(r=>{const d=M.authors.find(p=>p.slug===r.slug||p.id===r.id);return{...d,...r,username:r.username||d?.username,bio:d?.bio||r.bio,specialty:d?.specialty||r.specialty}});i(a)}).catch(()=>{}),()=>{o=!0}},[]),e.jsxs("section",{style:{padding:"60px 0",direction:"rtl"},children:[e.jsx("h2",{style:fe,children:"نویسندگان تکناو"}),e.jsx("p",{style:me,children:"متخصصانی که روایت عمیق فناوری را می‌نویسند"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(200px,1fr))",gap:16},className:"authors-grid",children:n.map(o=>e.jsxs("div",{onClick:()=>t(Wn(o)),style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:20,cursor:"pointer",textAlign:"center",transition:"all 0.2s"},onMouseEnter:s=>{s.currentTarget.style.transform="translateY(-4px)",s.currentTarget.style.boxShadow="0 8px 24px rgba(0,0,0,0.08)"},onMouseLeave:s=>{s.currentTarget.style.transform="translateY(0)",s.currentTarget.style.boxShadow="none"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:12},children:e.jsx(je,{author:o,size:56})}),e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#263238",marginBottom:4},children:o.name}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginBottom:8},children:o.specialty}),e.jsxs("div",{style:{fontSize:11,color:"#0F6B73",fontWeight:600},children:[o.articleCount," مقاله"]})]},o.id))})]})}function Tn({featured:t,navigate:n}){const i=c.useRef(),o=c.useRef();return c.useEffect(()=>{const s=i.current,a=o.current;if(!s||!a)return;const r=p=>{const l=s.getBoundingClientRect(),x=(p.clientX-l.left)/l.width-.5,u=(p.clientY-l.top)/l.height-.5;a.style.transform=`perspective(900px) rotateX(${(-u*4).toFixed(2)}deg) rotateY(${(x*6).toFixed(2)}deg) translateY(0)`},d=()=>{a.style.transform="perspective(900px) rotateX(0) rotateY(0)"};return s.addEventListener("mousemove",r),s.addEventListener("mouseleave",d),()=>{s.removeEventListener("mousemove",r),s.removeEventListener("mouseleave",d)}},[]),e.jsxs("div",{ref:i,style:{position:"relative",background:"#F4F1EC",overflow:"hidden",minHeight:560},children:[e.jsx("div",{style:{position:"absolute",top:"20%",right:"10%",width:520,height:520,borderRadius:"50%",background:"radial-gradient(circle, rgba(15,107,115,0.10) 0%, transparent 70%)",pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",bottom:"0%",left:"15%",width:380,height:380,borderRadius:"50%",background:"radial-gradient(circle, rgba(196,106,77,0.10) 0%, transparent 70%)",pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(15,42,46,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(15,42,46,0.04) 1px, transparent 1px)",backgroundSize:"48px 48px",maskImage:"radial-gradient(circle at 50% 40%, #000 30%, transparent 75%)",WebkitMaskImage:"radial-gradient(circle at 50% 40%, #000 30%, transparent 75%)",pointerEvents:"none"}}),e.jsx(En,{}),e.jsxs("div",{className:"home-hero-inner",style:{position:"relative",zIndex:2,maxWidth:1280,margin:"0 auto",padding:"76px 24px 70px",direction:"rtl"},children:[e.jsxs("div",{style:{maxWidth:600,marginBottom:44},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,background:"rgba(15,107,115,0.08)",border:"1px solid rgba(15,107,115,0.25)",color:"#0F6B73",padding:"6px 16px",borderRadius:999,fontSize:11,fontWeight:700,marginBottom:26,letterSpacing:"0.08em",animation:"heroReveal 0.6s 0.1s both"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#0F6B73",display:"inline-block",animation:"pulseRing 2.2s infinite"}}),"روایت عمیق فناوری"]}),e.jsx("h1",{style:{fontSize:"clamp(34px,5.4vw,58px)",fontWeight:800,color:"#0F2A2E",margin:"0 0 4px",lineHeight:1.25,fontFamily:"'PelakFA','Vazirmatn',sans-serif",animation:"heroReveal 0.7s 0.35s both",letterSpacing:"-0.01em"},children:"درک عمیق‌تر"}),e.jsx("h1",{className:"gold-shimmer",style:{fontSize:"clamp(34px,5.4vw,58px)",fontWeight:800,margin:"0 0 22px",lineHeight:1.25,fontFamily:"'PelakFA','Vazirmatn',sans-serif",animation:"heroReveal 0.7s 0.6s both",letterSpacing:"-0.01em"},children:"دنیای فناوری"}),e.jsx("p",{style:{fontSize:16,color:"#4A5A5C",lineHeight:2,margin:"0 0 32px",animation:"heroReveal 0.7s 0.85s both",maxWidth:540},children:"تحلیل‌های علمی، تخصصی و مستقل از پیشرفت‌های هوش مصنوعی، علم داده، امنیت سایبری و آینده فناوری."}),e.jsxs("div",{className:"home-hero-actions",style:{display:"flex",gap:12,flexWrap:"wrap",animation:"heroReveal 0.7s 1.1s both"},children:[e.jsx("button",{onClick:()=>n("/articles"),style:{background:"#0F6B73",color:"#fff",border:"none",padding:"14px 32px",borderRadius:10,fontSize:14,fontWeight:700,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",boxShadow:"0 6px 22px rgba(15,107,115,0.28)",transition:"transform 0.2s ease, box-shadow 0.2s ease"},onMouseEnter:s=>{s.currentTarget.style.transform="translateY(-2px)",s.currentTarget.style.boxShadow="0 10px 28px rgba(15,107,115,0.35)"},onMouseLeave:s=>{s.currentTarget.style.transform="translateY(0)",s.currentTarget.style.boxShadow="0 6px 22px rgba(15,107,115,0.28)"},children:"مشاهده همه مقاله‌ها →"}),e.jsx("button",{onClick:()=>n("/category/ai"),style:{background:"rgba(196,106,77,0.08)",color:"#A8512E",border:"1px solid rgba(196,106,77,0.45)",padding:"14px 30px",borderRadius:10,fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",transition:"all 0.2s"},onMouseEnter:s=>{s.currentTarget.style.background="rgba(196,106,77,0.16)"},onMouseLeave:s=>{s.currentTarget.style.background="rgba(196,106,77,0.08)"},children:"هوش مصنوعی"})]})]}),t&&e.jsxs("div",{ref:o,className:"hero-tilt",style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:16,padding:"20px 24px",direction:"rtl",maxWidth:580,animation:"heroReveal 0.7s 1.35s both",boxShadow:"0 14px 40px rgba(15,42,46,0.08), 0 2px 8px rgba(15,42,46,0.04)",position:"relative",overflow:"hidden"},children:[e.jsx("div",{style:{position:"absolute",top:0,right:0,bottom:0,width:4,background:"linear-gradient(180deg, #D49A2A, #C46A4D)"}}),e.jsxs("div",{style:{fontSize:10,color:"#C46A4D",fontWeight:700,marginBottom:10,letterSpacing:"0.1em",display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{display:"inline-block",animation:"float-y 3s ease-in-out infinite"},children:"✦"}),"مقاله ویژه"]}),e.jsx("div",{onClick:()=>n("/article/"+t.slug),style:{fontSize:18,fontWeight:700,color:"#0F2A2E",cursor:"pointer",lineHeight:1.65,transition:"color 0.15s",fontFamily:"'PelakFA','Vazirmatn',sans-serif"},onMouseEnter:s=>s.currentTarget.style.color="#0F6B73",onMouseLeave:s=>s.currentTarget.style.color="#0F2A2E",children:t.title}),e.jsxs("div",{style:{fontSize:12,color:"#5F6B6D",marginTop:12,display:"flex",gap:10,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontWeight:600,color:"#0F6B73"},children:t.authorName}),e.jsx("span",{style:{opacity:.4},children:"·"}),e.jsx("span",{children:t.type}),e.jsx("span",{style:{opacity:.4},children:"·"}),e.jsxs("span",{children:[t.readTime," دقیقه مطالعه"]})]})]})]}),e.jsx("svg",{viewBox:"0 0 1440 60",preserveAspectRatio:"none",style:{position:"absolute",bottom:-1,left:0,width:"100%",height:50,display:"block",pointerEvents:"none"},children:e.jsx("path",{d:"M0,40 C240,60 480,10 720,30 C960,50 1200,15 1440,35 L1440,60 L0,60 Z",fill:"#ebe3d2"})}),e.jsx("style",{children:`
@keyframes heroReveal {
from { opacity: 0; filter: blur(6px); transform: translateY(18px); }
to { opacity: 1; filter: blur(0); transform: translateY(0); }
}
`})]})}function $n({to:t,suffix:n="",duration:i=1400}){const[o,s]=c.useState(0),a=c.useRef(),r=c.useRef(!1);c.useEffect(()=>{const l=new IntersectionObserver(([x])=>{if(x.isIntersecting&&!r.current){r.current=!0;const u=performance.now(),g=b=>{const h=Math.min((b-u)/i,1),f=1-Math.pow(1-h,3);s(Math.round(t*f)),h<1&&requestAnimationFrame(g)};requestAnimationFrame(g)}},{threshold:.4});return a.current&&l.observe(a.current),()=>l.disconnect()},[t,i]);const p=String(o).replace(/\d/g,l=>"۰۱۲۳۴۵۶۷۸۹"[l]).replace(/\B(?=(\d{3})+(?!\d))/g,"٬");return e.jsxs("span",{ref:a,children:[p,n]})}function Ln(){const t=[{label:"مقاله منتشرشده",to:75,suffix:"+",icon:"◉"},{label:"نویسنده فعال",to:2,suffix:"",icon:"✎"},{label:"خواننده ماهانه",to:65e3,suffix:"+",icon:"◐"},{label:"میانگین زمان مطالعه",to:8,suffix:" دقیقه",icon:"◷"}];return e.jsx("div",{style:{background:"#ebe3d2",padding:"40px 24px",direction:"rtl",borderTop:"1px solid rgba(15,42,46,0.06)",borderBottom:"1px solid rgba(15,42,46,0.06)"},children:e.jsx("div",{style:{maxWidth:1280,margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(180px,1fr))",gap:16},className:"stats-bar-inner",children:t.map((n,i)=>e.jsxs("div",{className:"lift-on-hover",style:{textAlign:"center",padding:"12px 8px",borderRadius:12,position:"relative"},children:[e.jsx("div",{style:{fontSize:14,color:"#0F6B73",marginBottom:6,opacity:.7},children:n.icon}),e.jsx("div",{style:{fontSize:30,fontWeight:900,color:"#A8761B",marginBottom:6,fontFamily:"'PelakFA','Vazirmatn',sans-serif",letterSpacing:"-0.01em"},children:e.jsx($n,{to:n.to,suffix:n.suffix})}),e.jsx("div",{style:{fontSize:13,color:"#4A5A5C",fontWeight:500},children:n.label}),i<t.length-1&&e.jsx("div",{style:{position:"absolute",left:0,top:"20%",height:"60%",width:1,background:"rgba(15,42,46,0.08)"}})]},n.label))})})}const fe={fontSize:22,fontWeight:800,color:"#263238",margin:"0 0 8px",fontFamily:"Vazirmatn,sans-serif"},me={fontSize:14,color:"#5F6B6D",margin:"0 0 32px",lineHeight:1.7};function Pn(){const{navigate:t}=q(),{user:n}=ae(),[i,o]=c.useState(()=>U.fallbackArticles()),[s,a]=c.useState([]),[r,d]=c.useState({});c.useEffect(()=>{let y=!1;return U.listArticles({limit:50}).then(m=>{y||o(m.items??[])}).catch(()=>{}),n?(U.listArticles({limit:12,sort:"personalized"}).then(m=>{y||a(m.items??[])}).catch(()=>{}),K.getStreaks().then(m=>{if(y)return;const v={};(m.continueReading??[]).forEach(j=>{v[j.slug]=Math.round((j.progress??0)*100)}),d(v)}).catch(()=>{})):(a([]),d({})),()=>{y=!0}},[n]);const p=i.find(y=>y.featured)||i[0],l=i.find(y=>y.editorsPick&&y.id!==p?.id)||i.find(y=>y.featured&&y.id!==p?.id)||i.find(y=>y.id!==p?.id&&(y.type||"").includes("تحلیل"))||i[1],x=i.filter(y=>y.id!==p?.id&&y.id!==l?.id).slice(0,6),u=[...i].sort((y,m)=>m.views-y.views).slice(0,4),g=i.filter(y=>y.type==="تحلیل عمیق").slice(0,3),b=[...i].sort((y,m)=>new Date(m.dateEn)-new Date(y.dateEn)).slice(0,6),h=i.filter(y=>y.seriesSlug==="openclaw-series"),f=i.filter(y=>y.category==="security").slice(0,5);return e.jsxs("main",{style:{paddingTop:64,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif"},children:[n&&e.jsx("div",{style:{background:"#F4EFE6",borderBottom:"1px solid #E4DDD2",padding:"10px 24px",direction:"rtl"},children:e.jsxs("div",{style:{maxWidth:1280,margin:"0 auto",display:"flex",justifyContent:"space-between",alignItems:"center",gap:20,flexWrap:"wrap"},children:[e.jsx(mn,{}),e.jsx(yn,{})]})}),e.jsx(Tn,{featured:p,navigate:t}),e.jsx(Ln,{}),e.jsxs("div",{style:{maxWidth:1280,margin:"0 auto",padding:"0 24px"},children:[s.length>0&&e.jsxs("section",{className:"home-section",style:{padding:"60px 0 20px",direction:"rtl"},"aria-labelledby":"personalized-title",children:[e.jsx("h2",{id:"personalized-title",style:fe,children:"پیشنهاد برای شما"}),e.jsx("p",{style:me,children:"بر اساس علایق و تاریخچه مطالعه شما"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(280px,1fr))",gap:20},className:"article-grid",children:s.map((y,m)=>e.jsx(Pe,{article:y,delay:m*80,readProgress:r[y.slug]??null},y.id))})]}),l&&e.jsxs("section",{className:"home-section",style:{padding:"60px 0 40px",direction:"rtl"},"aria-labelledby":"featured-title",children:[e.jsx("h2",{id:"featured-title",style:fe,children:"مقاله منتخب"}),e.jsx("p",{style:me,children:"عمیق‌ترین تحلیل این هفته"}),e.jsx(Rn,{article:l})]}),e.jsxs("section",{className:"home-section",style:{padding:"40px 0",direction:"rtl"},"aria-labelledby":"latest-title",children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[e.jsx("h2",{id:"latest-title",style:{...fe,margin:0},children:"تازه‌ترین خبرها"}),e.jsx("button",{onClick:()=>t("/articles"),style:{background:"none",border:"none",color:"#0F6B73",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},"aria-label":"مشاهده همه مقالات",children:"مشاهده همه ←"})]}),e.jsx("p",{style:me,children:"آخرین تحلیل‌ها و مقالات تکناو"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(280px,1fr))",gap:20},className:"article-grid",children:x.map((y,m)=>e.jsx(Pe,{article:y,delay:m*80,readProgress:r[y.slug]??null},y.id))})]}),g.length>0&&e.jsxs("section",{className:"home-section",style:{padding:"40px 0",direction:"rtl"},"aria-labelledby":"deep-title",children:[e.jsx("h2",{id:"deep-title",style:fe,children:"تحلیل‌های عمیق"}),e.jsx("p",{style:me,children:"بررسی‌های تخصصی و مستند"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:1},children:g.map(y=>e.jsx(nt,{article:y},y.id))})]}),e.jsxs("section",{className:"home-section",style:{padding:"40px 0",direction:"rtl"},"aria-labelledby":"popular-title",children:[e.jsx("h2",{id:"popular-title",style:fe,children:"محبوب‌ترین‌ها"}),e.jsx("p",{style:me,children:"پرخواننده‌ترین مقالات تکناو"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(280px,1fr))",gap:20},className:"article-grid",children:u.map((y,m)=>e.jsx(Pe,{article:y,delay:m*100,readProgress:r[y.slug]??null},y.id))})]}),e.jsxs("section",{className:"home-section",style:{padding:"40px 0",direction:"rtl"},"aria-labelledby":"thisweek-title",children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"#D49A2A",display:"inline-block",boxShadow:"0 0 0 3px #D49A2A30",animation:"pulse 2s infinite"}}),e.jsx("h2",{id:"thisweek-title",style:{...fe,margin:0},children:"این هفته در تکناو"})]}),e.jsx("button",{onClick:()=>t("/articles"),style:{background:"none",border:"none",color:"#0F6B73",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"همه مقالات ←"})]}),e.jsx("p",{style:me,children:"تازه‌ترین تحلیل‌های خرداد ۱۴۰۵"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(280px,1fr))",gap:20},className:"article-grid",children:b.map((y,m)=>e.jsx(Pe,{article:y,delay:m*60,readProgress:r[y.slug]??null},y.id))})]}),h.length>0&&e.jsxs("section",{className:"home-section",style:{padding:"40px 0",direction:"rtl",borderTop:"2px solid #0F6B7318"},"aria-labelledby":"openclaw-title",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:10,background:"#0F6B73",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("span",{style:{color:"#fff",fontSize:16},children:"⚙"})}),e.jsxs("div",{children:[e.jsx("h2",{id:"openclaw-title",style:{...fe,margin:0},children:"سری OpenClaw"}),e.jsx("p",{style:{...me,margin:0},children:"معماری، امنیت، و ژئوپلیتیک عامل‌های متن‌باز"})]}),e.jsx("button",{onClick:()=>t("/articles?tag=OpenClaw"),style:{marginRight:"auto",background:"none",border:"1px solid #0F6B7340",color:"#0F6B73",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",padding:"6px 14px",borderRadius:999},children:"مشاهده سری ←"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:1,marginTop:20},children:h.map(y=>e.jsx(nt,{article:y},y.id))})]}),f.length>0&&e.jsxs("section",{className:"home-section",style:{padding:"40px 0",direction:"rtl",borderTop:"2px solid #C76D4A18"},"aria-labelledby":"security-title",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:10,background:"#C76D4A",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx("span",{style:{color:"#fff",fontSize:16},children:"⚖"})}),e.jsxs("div",{children:[e.jsx("h2",{id:"security-title",style:{...fe,margin:0},children:"امنیت و حقوق AI"}),e.jsx("p",{style:{...me,margin:0},children:"مسئولیت حقوقی، ایمنی سایبری، و حاکمیت هوش مصنوعی"})]}),e.jsx("button",{onClick:()=>t("/category/security"),style:{marginRight:"auto",background:"none",border:"1px solid #C76D4A40",color:"#C76D4A",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",padding:"6px 14px",borderRadius:999},children:"دسته امنیت ←"})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:1,marginTop:20},children:f.map(y=>e.jsx(nt,{article:y},y.id))})]}),e.jsxs("section",{className:"home-section",style:{padding:"40px 0",direction:"rtl"},"aria-labelledby":"categories-title",children:[e.jsx("h2",{id:"categories-title",style:fe,children:"دسته‌بندی‌ها"}),e.jsx("p",{style:me,children:"کشف مطالب بر اساس حوزه تخصصی"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(200px,1fr))",gap:12},className:"categories-grid",children:M.categories.map(y=>{const{navigate:m}=q();return e.jsxs("div",{onClick:()=>m("/category/"+y.slug),style:{background:"#fff",border:`1px solid ${y.color}30`,borderRadius:10,padding:"20px 16px",cursor:"pointer",direction:"rtl",transition:"all 0.2s",borderRight:`3px solid ${y.color}`},onMouseEnter:v=>v.currentTarget.style.background=y.color+"08",onMouseLeave:v=>v.currentTarget.style.background="#fff",children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#263238",marginBottom:4},children:y.name}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginBottom:10},children:y.description}),e.jsxs("div",{style:{fontSize:11,color:y.color,fontWeight:600},children:[y.articleCount," مقاله"]})]},y.id)})})]}),e.jsx(In,{}),e.jsx("section",{style:{padding:"40px 0 60px",direction:"rtl"},"aria-labelledby":"newsletter-title",children:e.jsxs("div",{className:"newsletter-box",style:{background:"#ebe3d2",borderRadius:20,padding:"52px 32px",textAlign:"center",position:"relative",overflow:"hidden",border:"1px solid rgba(15,42,46,0.06)"},children:[e.jsx("div",{style:{position:"absolute",top:-80,right:-80,width:280,height:280,borderRadius:"50%",background:"radial-gradient(circle, rgba(15,107,115,0.10) 0%, transparent 70%)",pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",bottom:-60,left:-60,width:220,height:220,borderRadius:"50%",background:"radial-gradient(circle, rgba(196,106,77,0.10) 0%, transparent 70%)",pointerEvents:"none"}}),e.jsxs("div",{style:{position:"relative",zIndex:1},children:[e.jsx("div",{style:{fontSize:22,marginBottom:6,color:"#0F6B73"},children:"✉"}),e.jsx("h2",{id:"newsletter-title",style:{fontSize:26,fontWeight:800,color:"#0F2A2E",margin:"0 0 10px",fontFamily:"'PelakFA','Vazirmatn',sans-serif",letterSpacing:"-0.01em"},children:"عضو خبرنامه تکناو شوید"}),e.jsx("p",{style:{fontSize:14,color:"#4A5A5C",margin:"0 0 28px",lineHeight:1.9,maxWidth:520,marginLeft:"auto",marginRight:"auto"},children:"هر هفته بهترین مقاله‌های تحلیلی تکناو مستقیم در صندوق ورودی ایمیل شما"}),e.jsx(hn,{})]})]})})]}),e.jsx("style",{children:`
@keyframes pulse {
0%, 100% { box-shadow: 0 0 0 3px #D49A2A30; }
50% { box-shadow: 0 0 0 6px #D49A2A15; }
}
@media (max-width: 640px) {
.featured-card { grid-template-columns: 1fr !important; }
.featured-card .diagram-col { min-height: 200px; }
.hero-text { padding: 48px 16px 40px !important; }
.stats-bar-inner { grid-template-columns: repeat(2, 1fr) !important; }
.article-grid { grid-template-columns: 1fr !important; }
.authors-grid { grid-template-columns: repeat(2, 1fr) !important; }
.categories-grid { grid-template-columns: repeat(2, 1fr) !important; }
.newsletter-box { padding: 36px 20px !important; }
}
`})]})}function nt({article:t}){const{navigate:n}=q(),i=c.useRef();Ke(i,t.slug);const o=M.categories.find(s=>s.id===t.category);return e.jsxs("div",{ref:i,onClick:()=>n("/article/"+t.slug),style:{display:"flex",gap:20,padding:"20px 0",borderBottom:"1px solid #E4DDD2",cursor:"pointer",direction:"rtl",alignItems:"flex-start",transition:"background 0.15s"},onMouseEnter:s=>s.currentTarget.style.background="#F4EFE620",onMouseLeave:s=>s.currentTarget.style.background="transparent",children:[e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8},children:[e.jsx(We,{type:t.type,small:!0}),e.jsx(De,{name:t.categoryName,color:o?.color,small:!0})]}),e.jsx("h3",{style:{fontSize:16,fontWeight:700,color:"#263238",margin:"0 0 6px",lineHeight:1.5},children:t.title}),e.jsxs("p",{style:{fontSize:13,color:"#5F6B6D",margin:"0 0 10px",lineHeight:1.7},children:[t.summary.slice(0,140),"…"]}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D"},children:[t.authorName," · ",t.date," · ",t.readTime," دقیقه"]})]}),e.jsx("div",{style:{width:80,height:80,background:"#F4EFE6",borderRadius:8,overflow:"hidden",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("div",{style:{transform:"scale(0.55)",transformOrigin:"center"},children:e.jsx(Oe,{type:t.diagram,compact:!0})})})]})}const Mn="modulepreload",Nn=function(t){return"/"+t},zt={},Hn=function(n,i,o){let s=Promise.resolve();if(i&&i.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),d=r?.nonce||r?.getAttribute("nonce");s=Promise.allSettled(i.map(p=>{if(p=Nn(p),p in zt)return;zt[p]=!0;const l=p.endsWith(".css"),x=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${x}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":Mn,l||(u.as="script"),u.crossOrigin="",u.href=p,d&&u.setAttribute("nonce",d),document.head.appendChild(u),l)return new Promise((g,b)=>{u.addEventListener("load",g),u.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${p}`)))})}))}function a(r){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=r,window.dispatchEvent(d),!d.defaultPrevented)throw r}return s.then(r=>{for(const d of r||[])d.status==="rejected"&&a(d.reason);return n().catch(a)})},Vn=c.lazy(()=>Hn(()=>Promise.resolve().then(()=>zn),void 0).then(t=>({default:t.DiagramRenderer})));function we(t){return e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"tek-diagram-skeleton","aria-hidden":"true"}),children:e.jsx(Vn,{...t})})}function Ue(t,n){return typeof t=="string"&&t.endsWith(".svg")?e.jsx("span",{className:"tek-icon","aria-hidden":"true",style:{"--i":`url("${t}")`}}):t}const wi="/assets/pencil-DL9RkTTf.svg",_n={"tekrag-persian-data-centric-rag-benchmark":"TekRAG-Persian: A Data-Centric Benchmark for Persian Technical RAG","mcp-model-context-protocol-2026":"Model Context Protocol in 2026: Architecture, Tools, and Agentic AI","ai-data-centric-2026":"Data-Centric AI in 2026: Why Clean Data Beats Bigger Models","cve-2026-41940-cpanel-zero-day-analysis":"CVE-2026-41940: Technical Analysis of a cPanel Zero-Day","agentic-ai-production-2026":"Agentic AI in Production: Reliability, Tools, and Governance","llm-security":"LLM Security: Prompt Injection, RAG Attacks, and Defensive Design","data-governance-2026":"Data Governance in 2026: Metadata, Lineage, and AI-Ready Data","open-source-ai-sovereignty":"Open-Source AI and Digital Sovereignty","deepseek-v4-engram":"DeepSeek-V4 and Efficient Reasoning Architectures","post-quantum-cryptography-qday":"Post-Quantum Cryptography and the Road to Q-Day"},On={"tekrag-persian-data-centric-rag-benchmark":"A research-grade benchmark for Persian technical question answering, hallucination evaluation, citation grounding, and data-centric RAG — comparing raw, cleaned, and metadata-enriched corpus variants.","mcp-model-context-protocol-2026":"A technical deep-dive into the Model Context Protocol as the emerging standard connecting large language models to tools, resources, prompts, and autonomous agent workflows.","ai-data-centric-2026":"A practical examination of why data quality, labeling precision, provenance tracking, and pipeline hygiene matter more as frontier models become increasingly capable.","cve-2026-41940-cpanel-zero-day-analysis":"A security-focused breakdown of exploit surface, privilege escalation path, operational impact timeline, patching priorities, and defensive monitoring recommendations.","agentic-ai-production-2026":"A field guide to moving AI agents from controlled demos into production systems with proper telemetry, permission scoping, evaluation loops, and failure recovery.","llm-security":"Threat models and defensive controls for prompt injection, indirect instruction attacks, insecure tool use, retrieval poisoning, and multi-agent trust boundaries.","data-governance-2026":"How metadata management, data lineage, policy enforcement, quality gates, and semantic layers shape dependable AI systems and analytics infrastructure.","open-source-ai-sovereignty":"Why open model weights, transparent architectures, and local deployment matter for strategic control over AI infrastructure and long-term technology independence.","deepseek-v4-engram":"A close look at memory architecture, mixture-of-experts efficiency, inference cost pressures, and what efficient reasoning architectures reveal about the frontier.","post-quantum-cryptography-qday":"A clear explanation of quantum computing risk, NIST standardization, cryptographic migration strategy, and why organizations need post-quantum planning today."},pt={ai:{name:"Artificial Intelligence",desc:"LLMs, agents, model safety, and AI infrastructure"},data:{name:"Data Science",desc:"RAG, data-centric AI, governance, and benchmarks"},security:{name:"Cybersecurity",desc:"Vulnerabilities, LLM security, and defense"},hardware:{name:"Hardware",desc:"AI chips, semiconductors, and compute strategy"},software:{name:"Software Engineering",desc:"Architecture, systems design, and tooling"},startup:{name:"Startups & Markets",desc:"Technology markets, product strategy, and venture"},future:{name:"Future of Technology",desc:"Long-horizon trends and societal impact"}};function Qe(t){return _n[t.slug]||t.seoTitle||t.ogTitle||t.title}function Et(t){return On[t.slug]||t.ogDescription||t.metaDescription||t.summary||""}function Ye(t){return pt[t.category]?.name||t.categoryName||"Technology"}function Ne(t){const n=M.authors.find(i=>i.id===t.authorId);return n?.nameEn||(n?.slug==="arsam-sabbagh"?"Arsam Sabbagh":t.authorName)}function Un(){return M.articles.filter(t=>t.status!=="پیش‌نویس"&&t.status!=="در انتظار بررسی").slice().sort((t,n)=>String(n.dateEn||"").localeCompare(String(t.dateEn||"")))}function qn(){const t=c.useRef();return c.useEffect(()=>{const n=t.current;if(!n)return;const i=n.getContext("2d");let o,s=0;const a=["rgba(15,107,115,","rgba(196,106,77,","rgba(47,143,107,"],r=Array.from({length:28},(l,x)=>({x:Math.random()*n.width,y:Math.random()*n.height,vx:(Math.random()-.5)*.32,vy:(Math.random()-.5)*.32,r:Math.random()*3+1.5,color:a[x%a.length],phase:Math.random()*Math.PI*2})),d=()=>{n.width=n.offsetWidth,n.height=n.offsetHeight};d(),window.addEventListener("resize",d);const p=()=>{s+=.012,i.clearRect(0,0,n.width,n.height),r.forEach(l=>{l.x+=l.vx,l.y+=l.vy,(l.x<0||l.x>n.width)&&(l.vx*=-1),(l.y<0||l.y>n.height)&&(l.vy*=-1),r.forEach(u=>{const g=Math.hypot(l.x-u.x,l.y-u.y);g<120&&(i.beginPath(),i.moveTo(l.x,l.y),i.lineTo(u.x,u.y),i.strokeStyle=`rgba(15,107,115,${.15*(1-g/120)})`,i.lineWidth=.7,i.stroke())});const x=.45+.18*Math.sin(s+l.phase);i.beginPath(),i.arc(l.x,l.y,l.r,0,Math.PI*2),i.fillStyle=l.color+x+")",i.fill()}),o=requestAnimationFrame(p)};return p(),()=>{cancelAnimationFrame(o),window.removeEventListener("resize",d)}},[]),e.jsx("canvas",{ref:t,style:{position:"absolute",inset:0,width:"100%",height:"100%"}})}function Gn({to:t,suffix:n="",duration:i=1400}){const[o,s]=c.useState(0),a=c.useRef(),r=c.useRef(!1);return c.useEffect(()=>{const d=new IntersectionObserver(([p])=>{if(p.isIntersecting&&!r.current){r.current=!0;const l=performance.now(),x=u=>{const g=Math.min((u-l)/i,1);s(Math.round(t*(1-Math.pow(1-g,3)))),g<1&&requestAnimationFrame(x)};requestAnimationFrame(x)}},{threshold:.4});return a.current&&d.observe(a.current),()=>d.disconnect()},[t,i]),e.jsxs("span",{ref:a,children:[o.toLocaleString(),n]})}function Rt({article:t,delay:n=0,featured:i=!1}){const{navigate:o}=q(),[s,a]=c.useState(!1),r=c.useRef();return c.useEffect(()=>{const d=new IntersectionObserver(([p])=>{p.isIntersecting&&a(!0)},{threshold:.08});return r.current&&d.observe(r.current),()=>d.disconnect()},[]),e.jsx("article",{ref:r,onClick:()=>o("/article/"+t.slug),style:{background:"#fff",borderRadius:i?16:12,border:i?"1px solid #0F6B7340":"1px solid #E4DDD2",padding:i?0:22,cursor:"pointer",opacity:s?1:0,transform:s?"translateY(0)":"translateY(20px)",transition:`opacity 0.45s ${n}ms, transform 0.45s ${n}ms, box-shadow 0.2s`,boxShadow:i?"0 4px 28px rgba(15,107,115,0.10)":"0 2px 10px rgba(0,0,0,0.04)",overflow:"hidden",display:i?"grid":"flex",gridTemplateColumns:i?"1fr 1fr":void 0,flexDirection:i?void 0:"column"},onMouseEnter:d=>d.currentTarget.style.boxShadow=i?"0 10px 40px rgba(15,107,115,0.16)":"0 6px 24px rgba(0,0,0,0.09)",onMouseLeave:d=>d.currentTarget.style.boxShadow=i?"0 4px 28px rgba(15,107,115,0.10)":"0 2px 10px rgba(0,0,0,0.04)",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"32px 32px 28px"},children:[e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:14,flexWrap:"wrap"},children:[e.jsx("span",{style:{background:"#0F6B7315",color:"#0F6B73",borderRadius:6,padding:"3px 10px",fontSize:11,fontWeight:700},children:"Featured Research"}),e.jsx("span",{style:{background:"#F4EFE6",color:"#A8512E",borderRadius:6,padding:"3px 10px",fontSize:11,fontWeight:700},children:Ye(t)}),e.jsxs("span",{style:{background:"#F4EFE6",color:"#5F6B6D",borderRadius:6,padding:"3px 10px",fontSize:11},children:[t.readTime," min read"]})]}),e.jsx("h2",{style:{fontSize:"clamp(18px,2.4vw,26px)",fontWeight:800,color:"#0F2A2E",margin:"0 0 14px",lineHeight:1.4},children:Qe(t)}),e.jsx("p",{style:{fontSize:14,color:"#4A5A5C",lineHeight:1.85,margin:"0 0 22px"},children:Et(t).slice(0,240)}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,paddingTop:16,borderTop:"1px solid #E4DDD2"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:"50%",background:"#0F6B7322",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:700,color:"#0F6B73",flexShrink:0},children:Ne(t)?.[0]||"A"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#263238"},children:Ne(t)}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D"},children:[t.dateEn," · Teknav"]})]})]})]}),e.jsx("div",{style:{background:"#F4EFE6",display:"flex",alignItems:"center",justifyContent:"center",padding:24,minHeight:260},children:e.jsx(we,{type:t.diagram})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{height:110,background:"#F4EFE6",borderRadius:8,marginBottom:16,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("div",{style:{transform:"scale(0.68)",transformOrigin:"center",width:"100%"},children:e.jsx(we,{type:t.diagram,compact:!0})})}),e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:10,flexWrap:"wrap"},children:[e.jsx("span",{style:{background:"#F4EFE6",color:"#A8512E",borderRadius:5,padding:"2px 8px",fontSize:10,fontWeight:700},children:Ye(t)}),e.jsxs("span",{style:{background:"#F4EFE6",color:"#5F6B6D",borderRadius:5,padding:"2px 8px",fontSize:10},children:[t.readTime," min"]})]}),e.jsx("h3",{style:{fontSize:14,fontWeight:700,color:"#263238",margin:"0 0 8px",lineHeight:1.5,flex:1},children:Qe(t)}),e.jsxs("p",{style:{fontSize:12,color:"#5F6B6D",lineHeight:1.7,margin:"0 0 14px"},children:[Et(t).slice(0,110),"…"]}),e.jsxs("div",{style:{fontSize:11,color:"#8A9A9C",marginTop:"auto"},children:[Ne(t)," · ",t.dateEn]})]})})}function Qn(){const{navigate:t}=q(),n=Un(),i=n.find(p=>p.slug==="tekrag-persian-data-centric-rag-benchmark")||n[0],o=n.filter(p=>p.id!==i?.id).slice(0,6),s=[...n].sort((p,l)=>(l.views||0)-(p.views||0)).slice(0,3),a=[{label:"Articles published",to:180,suffix:"+",icon:"◉"},{label:"Active writers",to:3,suffix:"",icon:wi},{label:"Monthly readers",to:45e3,suffix:"+",icon:"◐"},{label:"Avg. read time",to:8,suffix:" min",icon:"◷"}],r=M.categories.map(p=>({...p,enName:pt[p.id]?.name||p.name,enDesc:pt[p.id]?.desc||p.description})),d=M.authors.map(p=>({...p,enName:p.nameEn||(p.slug==="arsam-sabbagh"?"Arsam Sabbagh":p.name),enRole:p.specialtyEn||"Technology writer and analyst",enBio:p.bioEn||"Teknav contributor covering technology, strategy, and applied engineering for Persian-speaking readers."}));return e.jsxs("div",{dir:"ltr",lang:"en",style:{background:"#FAF7F0",minHeight:"100vh",fontFamily:"-apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Arial,sans-serif",color:"#132326"},children:[e.jsxs("header",{style:{position:"sticky",top:0,zIndex:50,background:"rgba(250,247,240,0.94)",backdropFilter:"blur(14px)",borderBottom:"1px solid #E4DDD2",padding:"0 28px",height:60,display:"flex",alignItems:"center",justifyContent:"space-between",gap:20},children:[e.jsxs("a",{onClick:p=>{p.preventDefault(),t("/en")},href:"/en",style:{display:"flex",alignItems:"baseline",gap:10,textDecoration:"none"},children:[e.jsx("span",{style:{fontSize:22,fontWeight:900,color:"#0F2A2E",letterSpacing:"-0.02em"},children:"Teknav"}),e.jsx("span",{style:{fontSize:10,color:"#C46A4D",fontWeight:700,letterSpacing:"0.14em"},children:"ENGLISH"})]}),e.jsxs("nav",{style:{display:"flex",alignItems:"center",gap:20,flexWrap:"wrap"},children:[e.jsx("a",{href:"#articles",style:{color:"#4A5A5C",textDecoration:"none",fontSize:13,fontWeight:500},children:"Articles"}),e.jsx("a",{href:"#topics",style:{color:"#4A5A5C",textDecoration:"none",fontSize:13,fontWeight:500},children:"Topics"}),e.jsx("a",{href:"#authors",style:{color:"#4A5A5C",textDecoration:"none",fontSize:13,fontWeight:500},children:"Writers"}),e.jsx("button",{onClick:()=>t("/"),style:{background:"transparent",border:"1px solid #0F6B73",color:"#0F6B73",borderRadius:7,padding:"6px 14px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"inherit"},children:"← Persian site"})]})]}),e.jsxs("div",{style:{position:"relative",background:"#F4F1EC",overflow:"hidden",minHeight:520},children:[e.jsx("div",{style:{position:"absolute",top:"15%",right:"8%",width:480,height:480,borderRadius:"50%",background:"radial-gradient(circle, rgba(15,107,115,0.09) 0%, transparent 70%)",pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",bottom:"0%",left:"12%",width:340,height:340,borderRadius:"50%",background:"radial-gradient(circle, rgba(196,106,77,0.09) 0%, transparent 70%)",pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:"linear-gradient(rgba(15,42,46,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(15,42,46,0.035) 1px, transparent 1px)",backgroundSize:"48px 48px",maskImage:"radial-gradient(circle at 50% 40%, #000 30%, transparent 75%)",WebkitMaskImage:"radial-gradient(circle at 50% 40%, #000 30%, transparent 75%)",pointerEvents:"none"}}),e.jsx(qn,{}),e.jsxs("div",{style:{position:"relative",zIndex:2,maxWidth:1240,margin:"0 auto",padding:"80px 28px 72px",display:"grid",gridTemplateColumns:"minmax(0,1.3fr) minmax(280px,0.7fr)",gap:48,alignItems:"center"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,background:"rgba(15,107,115,0.08)",border:"1px solid rgba(15,107,115,0.22)",color:"#0F6B73",padding:"6px 16px",borderRadius:999,fontSize:11,fontWeight:700,marginBottom:26,letterSpacing:"0.07em",animation:"enReveal 0.6s 0.1s both"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#0F6B73",display:"inline-block",animation:"enPulse 2.2s infinite"}}),"Deep technology narratives from Iran"]}),e.jsxs("h1",{style:{fontSize:"clamp(36px,5.5vw,62px)",fontWeight:800,color:"#0F2A2E",margin:"0 0 20px",lineHeight:1.12,letterSpacing:"-0.02em",animation:"enReveal 0.7s 0.3s both"},children:["Teknav tracks AI, data,",e.jsx("br",{}),"security & the future",e.jsx("br",{}),e.jsx("span",{style:{background:"linear-gradient(90deg, #0F6B73, #D49A2A)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:"of technology."})]}),e.jsx("p",{style:{fontSize:16,color:"#4A5A5C",lineHeight:1.85,margin:"0 0 32px",maxWidth:580,animation:"enReveal 0.7s 0.55s both"},children:"Independent editorial research for engineers, founders, and analysts. Persian-first publication — this page gives international readers an English overview of Teknav's analysis and research."}),e.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap",animation:"enReveal 0.7s 0.8s both"},children:[e.jsx("button",{onClick:()=>{document.getElementById("articles")?.scrollIntoView({behavior:"smooth"})},style:{background:"#0F6B73",color:"#fff",border:"none",padding:"13px 28px",borderRadius:9,fontSize:14,fontWeight:700,cursor:"pointer",fontFamily:"inherit",boxShadow:"0 6px 20px rgba(15,107,115,0.28)",transition:"all 0.2s"},onMouseEnter:p=>{p.currentTarget.style.transform="translateY(-2px)",p.currentTarget.style.boxShadow="0 10px 26px rgba(15,107,115,0.36)"},onMouseLeave:p=>{p.currentTarget.style.transform="translateY(0)",p.currentTarget.style.boxShadow="0 6px 20px rgba(15,107,115,0.28)"},children:"Browse research →"}),e.jsx("button",{onClick:()=>t("/article/tekrag-persian-data-centric-rag-benchmark"),style:{background:"rgba(196,106,77,0.08)",color:"#A8512E",border:"1px solid rgba(196,106,77,0.4)",padding:"13px 26px",borderRadius:9,fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"inherit",transition:"all 0.2s"},onMouseEnter:p=>p.currentTarget.style.background="rgba(196,106,77,0.16)",onMouseLeave:p=>p.currentTarget.style.background="rgba(196,106,77,0.08)",children:"Read TekRAG-Persian"})]})]}),i&&e.jsxs("div",{onClick:()=>t("/article/"+i.slug),style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:14,padding:"22px 24px",cursor:"pointer",boxShadow:"0 12px 38px rgba(15,42,46,0.08)",position:"relative",overflow:"hidden",animation:"enReveal 0.7s 1.05s both",transition:"box-shadow 0.2s"},onMouseEnter:p=>p.currentTarget.style.boxShadow="0 18px 50px rgba(15,42,46,0.13)",onMouseLeave:p=>p.currentTarget.style.boxShadow="0 12px 38px rgba(15,42,46,0.08)",children:[e.jsx("div",{style:{position:"absolute",top:0,left:0,bottom:0,width:4,background:"linear-gradient(180deg,#D49A2A,#C46A4D)"}}),e.jsx("div",{style:{fontSize:10,color:"#C46A4D",fontWeight:700,marginBottom:10,letterSpacing:"0.1em"},children:"✦ FEATURED ARTICLE"}),e.jsx("div",{style:{fontSize:16,fontWeight:700,color:"#0F2A2E",lineHeight:1.55,marginBottom:12,transition:"color 0.15s"},children:Qe(i)}),e.jsxs("div",{style:{fontSize:12,color:"#5F6B6D",display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontWeight:600,color:"#0F6B73"},children:Ne(i)}),e.jsx("span",{style:{opacity:.4},children:"·"}),e.jsxs("span",{children:[i.readTime," min read"]}),e.jsx("span",{style:{opacity:.4},children:"·"}),e.jsx("span",{children:Ye(i)})]})]})]}),e.jsx("svg",{viewBox:"0 0 1440 50",preserveAspectRatio:"none",style:{position:"absolute",bottom:-1,left:0,width:"100%",height:42,display:"block",pointerEvents:"none"},children:e.jsx("path",{d:"M0,34 C240,50 480,8 720,25 C960,42 1200,12 1440,28 L1440,50 L0,50 Z",fill:"#ebe3d2"})})]}),e.jsx("div",{style:{background:"#ebe3d2",padding:"36px 24px",borderTop:"1px solid rgba(15,42,46,0.06)",borderBottom:"1px solid rgba(15,42,46,0.06)"},children:e.jsx("div",{style:{maxWidth:1240,margin:"0 auto",display:"grid",gridTemplateColumns:"repeat(4,1fr)",gap:16},className:"en-stats-grid",children:a.map((p,l)=>e.jsxs("div",{style:{textAlign:"center",padding:"10px 8px",position:"relative"},children:[e.jsx("div",{style:{fontSize:13,color:"#0F6B73",marginBottom:6,opacity:.7},children:Ue(p.icon)}),e.jsx("div",{style:{fontSize:28,fontWeight:900,color:"#A8761B",marginBottom:4,letterSpacing:"-0.01em"},children:e.jsx(Gn,{to:p.to,suffix:p.suffix})}),e.jsx("div",{style:{fontSize:12,color:"#4A5A5C",fontWeight:500},children:p.label}),l<a.length-1&&e.jsx("div",{style:{position:"absolute",right:0,top:"20%",height:"60%",width:1,background:"rgba(15,42,46,0.08)"}})]},p.label))})}),e.jsxs("div",{style:{maxWidth:1240,margin:"0 auto",padding:"0 24px"},children:[i&&e.jsxs("section",{id:"articles",style:{padding:"64px 0 32px"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:24,flexWrap:"wrap",gap:12},children:e.jsxs("div",{children:[e.jsx("p",{style:{margin:"0 0 4px",color:"#A8512E",fontSize:11,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase"},children:"Featured"}),e.jsx("h2",{style:{margin:0,fontSize:"clamp(20px,2.5vw,28px)",fontWeight:800,color:"#263238"},children:"Latest research"})]})}),e.jsx(Rt,{article:i,featured:!0})]}),e.jsxs("section",{style:{padding:"20px 0 48px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:24,flexWrap:"wrap",gap:12},children:[e.jsxs("div",{children:[e.jsx("p",{style:{margin:"0 0 4px",color:"#A8512E",fontSize:11,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase"},children:"Analysis"}),e.jsx("h2",{style:{margin:0,fontSize:"clamp(20px,2.5vw,28px)",fontWeight:800,color:"#263238"},children:"Recent articles"})]}),e.jsx("button",{onClick:()=>t("/articles"),style:{background:"none",border:"1px solid #E4DDD2",color:"#0F6B73",padding:"8px 18px",borderRadius:8,fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"inherit"},children:"All articles →"})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0,1fr))",gap:18},className:"en-article-grid",children:o.map((p,l)=>e.jsx(Rt,{article:p,delay:l*70},p.id))})]}),e.jsxs("section",{style:{padding:"0 0 48px"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:24,flexWrap:"wrap",gap:12},children:e.jsxs("div",{children:[e.jsx("p",{style:{margin:"0 0 4px",color:"#A8512E",fontSize:11,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase"},children:"Popular"}),e.jsx("h2",{style:{margin:0,fontSize:"clamp(20px,2.5vw,28px)",fontWeight:800,color:"#263238"},children:"Most read"})]})}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:1},children:s.map((p,l)=>e.jsxs("div",{onClick:()=>t("/article/"+p.slug),style:{display:"flex",gap:20,padding:"18px 0",borderBottom:"1px solid #E4DDD2",cursor:"pointer",alignItems:"flex-start",transition:"background 0.15s",borderRadius:4},onMouseEnter:x=>x.currentTarget.style.background="#F4EFE630",onMouseLeave:x=>x.currentTarget.style.background="transparent",children:[e.jsxs("div",{style:{fontSize:32,fontWeight:900,color:"#E4DDD2",minWidth:40,lineHeight:1,fontVariantNumeric:"tabular-nums"},children:["0",l+1]}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",gap:6,marginBottom:6,flexWrap:"wrap"},children:[e.jsx("span",{style:{background:"#F4EFE6",color:"#A8512E",borderRadius:5,padding:"2px 8px",fontSize:10,fontWeight:700},children:Ye(p)}),e.jsxs("span",{style:{background:"#F4EFE6",color:"#5F6B6D",borderRadius:5,padding:"2px 8px",fontSize:10},children:[p.readTime," min"]})]}),e.jsx("h3",{style:{fontSize:15,fontWeight:700,color:"#263238",margin:"0 0 6px",lineHeight:1.45},children:Qe(p)}),e.jsxs("div",{style:{fontSize:11,color:"#8A9A9C"},children:[Ne(p)," · ",(p.views||0).toLocaleString()," views"]})]}),e.jsx("div",{style:{width:72,height:72,background:"#F4EFE6",borderRadius:8,overflow:"hidden",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("div",{style:{transform:"scale(0.52)",transformOrigin:"center"},children:e.jsx(we,{type:p.diagram,compact:!0})})})]},p.id))})]}),e.jsxs("section",{id:"topics",style:{padding:"0 0 48px"},children:[e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("p",{style:{margin:"0 0 4px",color:"#A8512E",fontSize:11,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase"},children:"Site map"}),e.jsx("h2",{style:{margin:0,fontSize:"clamp(20px,2.5vw,28px)",fontWeight:800,color:"#263238"},children:"Topics we cover"})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px,1fr))",gap:12},className:"en-cat-grid",children:r.map(p=>e.jsxs("div",{onClick:()=>t("/category/"+p.slug),style:{background:"#fff",border:`1px solid ${p.color}30`,borderLeft:`3px solid ${p.color}`,borderRadius:10,padding:"18px 16px",cursor:"pointer",transition:"all 0.2s"},onMouseEnter:l=>l.currentTarget.style.background=p.color+"0A",onMouseLeave:l=>l.currentTarget.style.background="#fff",children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#263238",marginBottom:5},children:p.enName}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginBottom:10,lineHeight:1.5},children:p.enDesc}),e.jsxs("div",{style:{fontSize:11,color:p.color,fontWeight:600},children:[p.articleCount," articles →"]})]},p.id))})]}),e.jsxs("section",{id:"authors",style:{padding:"0 0 48px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:24,flexWrap:"wrap",gap:12},children:[e.jsxs("div",{children:[e.jsx("p",{style:{margin:"0 0 4px",color:"#A8512E",fontSize:11,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase"},children:"Team"}),e.jsx("h2",{style:{margin:0,fontSize:"clamp(20px,2.5vw,28px)",fontWeight:800,color:"#263238"},children:"Writers & analysts"})]}),e.jsx("button",{onClick:()=>t("/authors"),style:{background:"none",border:"1px solid #E4DDD2",color:"#0F6B73",padding:"8px 18px",borderRadius:8,fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"inherit"},children:"All writers →"})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(260px,1fr))",gap:16},children:d.map(p=>e.jsxs("div",{onClick:()=>t(p.username?`/profile/@${p.username}`:`/author/${p.slug}`),style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:"22px",cursor:"pointer",transition:"all 0.2s"},onMouseEnter:l=>{l.currentTarget.style.transform="translateY(-3px)",l.currentTarget.style.boxShadow="0 8px 24px rgba(0,0,0,0.07)"},onMouseLeave:l=>{l.currentTarget.style.transform="translateY(0)",l.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,marginBottom:14},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"#0F6B7322",display:"flex",alignItems:"center",justifyContent:"center",fontSize:20,fontWeight:700,color:"#0F6B73",flexShrink:0},children:p.enName?.[0]||"A"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,color:"#263238",marginBottom:2},children:p.enName}),e.jsx("div",{style:{fontSize:11,color:"#0F6B73",fontWeight:600},children:p.enRole})]})]}),e.jsxs("p",{style:{fontSize:12,color:"#5F6B6D",lineHeight:1.75,margin:"0 0 12px"},children:[p.enBio?.slice(0,160),"…"]}),e.jsxs("div",{style:{fontSize:11,color:"#8A9A9C"},children:[p.articleCount," articles published"]})]},p.id))})]}),e.jsx("section",{style:{padding:"0 0 72px"},children:e.jsxs("div",{style:{background:"#ebe3d2",borderRadius:18,padding:"52px 40px",display:"flex",justifyContent:"space-between",alignItems:"center",gap:32,flexWrap:"wrap",position:"relative",overflow:"hidden",border:"1px solid rgba(15,42,46,0.06)"},children:[e.jsx("div",{style:{position:"absolute",top:-60,right:-60,width:240,height:240,borderRadius:"50%",background:"radial-gradient(circle, rgba(15,107,115,0.10) 0%, transparent 70%)",pointerEvents:"none"}}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx("div",{style:{fontSize:11,color:"#A8512E",fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",marginBottom:10},children:"Newsletter"}),e.jsx("h2",{style:{fontSize:"clamp(20px,2.5vw,30px)",fontWeight:800,color:"#0F2A2E",margin:"0 0 10px",lineHeight:1.3},children:"Weekly technology signals from Teknav"}),e.jsx("p",{style:{color:"#4A5A5C",lineHeight:1.8,maxWidth:520,margin:0,fontSize:14},children:"The Persian newsletter covers AI, cybersecurity, software, hardware, startups, and data — published weekly for Iranian engineering teams."})]}),e.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap",flexShrink:0},children:e.jsx("button",{onClick:()=>t("/newsletter"),style:{background:"#0F6B73",color:"#fff",border:"none",padding:"13px 26px",borderRadius:9,fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"inherit",transition:"all 0.2s"},onMouseEnter:p=>p.currentTarget.style.background="#0d5c63",onMouseLeave:p=>p.currentTarget.style.background="#0F6B73",children:"Open archive →"})})]})})]}),e.jsx("footer",{style:{background:"#0F2A2E",color:"#C8D4D5",padding:"40px 28px",marginTop:"auto"},children:e.jsxs("div",{style:{maxWidth:1240,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:22,fontWeight:900,color:"#FAF7F0",marginBottom:4},children:"Teknav"}),e.jsx("div",{style:{fontSize:12,color:"#7A9A9C"},children:"Deep technology narratives from Iran's Persian-language tech media."})]}),e.jsx("nav",{style:{display:"flex",gap:18,flexWrap:"wrap"},children:[["English Home","/en"],["All Articles","/articles"],["Authors","/authors"],["Newsletter","/newsletter"]].map(([p,l])=>e.jsx("button",{onClick:()=>t(l),style:{background:"none",border:"none",color:"#A8C0C2",fontSize:13,cursor:"pointer",fontFamily:"inherit",padding:0,transition:"color 0.15s"},onMouseEnter:x=>x.currentTarget.style.color="#FAF7F0",onMouseLeave:x=>x.currentTarget.style.color="#A8C0C2",children:p},l))}),e.jsx("div",{style:{fontSize:12,color:"#4A6A6C"},children:"© 2025 Teknav · teknav.ir"})]})}),e.jsx("style",{children:`
@keyframes enReveal { from { opacity:0; filter:blur(5px); transform:translateY(16px); } to { opacity:1; filter:blur(0); transform:translateY(0); } }
@keyframes enPulse { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:0.5;transform:scale(1.4);} }
@media (max-width: 900px) {
.en-stats-grid { grid-template-columns: repeat(2,1fr) !important; }
.en-article-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 620px) {
.en-article-grid { grid-template-columns: 1fr !important; }
.en-cat-grid { grid-template-columns: 1fr 1fr !important; }
.en-stats-grid { grid-template-columns: 1fr 1fr !important; }
}
`})]})}const gt=t=>String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function Yn(t){return t?.shortAnswer?`
<div class="insight-box article-short-answer" style="padding: 16px 18px; border-radius: 10px; background: #0F6B7311; border: 1px solid #0F6B7340; margin: 0 0 24px 0; direction: rtl;">
<strong>پاسخ کوتاه:</strong> ${gt(t.shortAnswer)}
</div>
`:""}function Xn(t){const n=t?.faqs;return n?.length?`
<section class="article-faqs" style="margin-top: 40px; padding: 24px; background: #F4EFE6; border: 1px solid #E4DDD2; border-radius: 12px; direction: rtl;">
<h2 style="margin: 0 0 20px; font-size: 20px;">پرسش‌های پرتکرار</h2>${n.map(([o,s])=>`
<div class="article-faq-item" style="margin-bottom: 18px;">
<h3 style="font-size: 16px; margin: 0 0 8px; color: #0F2A2E;">${gt(o)}</h3>
<p style="margin: 0; line-height: 1.9; color: #263238;">${gt(s)}</p>
</div>`).join("")}
</section>
`:""}function Jn(t,n){let i=n??t?.content??"";const o=Yn(t);if(o&&!i.includes("article-short-answer")){const s=i.replace(/(<p[^>]*class="lead"[^>]*>[\s\S]*?<\/p>)/,`$1${o}`);i=s!==i?s:o+i}if(!i.includes("article-faqs")){const s=Xn(t);if(s){const a=i.replace(/<\/div>\s*$/,`${s}</div>`);i=a!==i?a:i+s}}return i}const Wt="/assets/share-2-CPVCj6GY.svg",Kn="/assets/clipboard-copy-Ct9kWz-1.svg",Zn="#0C1E22",er="#0F6B73",rt="#D49A2A",ue="'Vazirmatn', Tahoma, sans-serif";function tr(){return typeof document>"u"?Promise.resolve():document.fonts.load("700 18px Vazirmatn").catch(()=>{})}function ir(t,n,i,o,s,a){const r=n.split(" ").filter(Boolean);let d="",p=o;const l=[];for(const x of r){const u=d?`${d} ${x}`:x;t.measureText(u).width>s&&d?(l.push(d),d=x):d=u}d&&l.push(d);for(const x of l.slice(0,4))t.fillText(x,i,p),p+=a;return p}function nr(t,n,i,o){t.width=1080,t.height=1080;const r=t.getContext("2d"),d=r.createLinearGradient(0,0,1080,1080);d.addColorStop(0,Zn),d.addColorStop(1,"#0F3540"),r.fillStyle=d,r.fillRect(0,0,1080,1080),r.fillStyle=er,r.beginPath(),r.moveTo(1080,0),r.lineTo(1080,220),r.lineTo(860,0),r.closePath(),r.fill(),r.strokeStyle="rgba(255,255,255,0.03)",r.lineWidth=1;for(let x=0;x<1080;x+=60)r.beginPath(),r.moveTo(x,0),r.lineTo(x,1080),r.stroke(),r.beginPath(),r.moveTo(0,x),r.lineTo(1080,x),r.stroke();r.fillStyle=rt,r.fillRect(80,90,5,80),r.fillStyle=rt,r.font=`700 32px ${ue}`,r.textAlign="right",r.direction="rtl",r.fillText("تکناو",1020,80),r.fillStyle="rgba(212,154,42,0.55)",r.font=`400 16px ${ue}`,r.fillText("teknav.ir",1020,106),r.fillStyle="rgba(212,154,42,0.18)",r.font=`700 280px ${ue}`,r.textAlign="right",r.fillText("«",1040,420),r.fillStyle="#FFFFFF",r.font=`400 38px ${ue}`,r.textAlign="right",r.direction="rtl";const p=ir(r,n,1e3,220,920,60);r.fillStyle=rt,r.fillRect(80,p+20,920,2),r.fillStyle="rgba(255,255,255,0.65)",r.font=`400 26px ${ue}`,r.textAlign="right";const l=i.length>60?`${i.slice(0,59)}…`:i;r.fillText(l,1e3,p+70),r.fillStyle="rgba(255,255,255,0.45)",r.font=`400 22px ${ue}`,r.fillText(o,1e3,1020)}function rr({containerRef:t,article:n}){const[i,o]=c.useState(null),[s,a]=c.useState(!1),[r,d]=c.useState(!1),[p,l]=c.useState(!1),x=c.useRef(null),u=c.useRef(!1);c.useEffect(()=>{tr().then(()=>{u.current=!0})},[]),c.useEffect(()=>{if(!s)return;const m=v=>{v.key==="Escape"&&(a(!1),o(null))};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[s]);const g=c.useCallback(()=>{const m=window.getSelection();if(!m||m.isCollapsed||!m.toString().trim()){o(null);return}const v=t?.current;if(!v)return;let j=m.anchorNode;for(;j&&j!==v;)j=j.parentNode;if(!j){o(null);return}const I=m.toString().trim();if(I.length<20||I.length>400){o(null);return}const D=m.getRangeAt(0).getBoundingClientRect();o({x:D.left+D.width/2,y:D.top+window.scrollY-48,text:I})},[t]);c.useEffect(()=>(document.addEventListener("mouseup",g),document.addEventListener("touchend",g),()=>{document.removeEventListener("mouseup",g),document.removeEventListener("touchend",g)}),[g]);const b=c.useCallback(()=>{if(i){a(!0);try{U.trackEvent({type:"share_clicked",metadata:{channel:"quote_card",slug:n?.slug}})}catch{}requestAnimationFrame(()=>{x.current&&nr(x.current,i.text,n?.title||"تکناو",n?.authorName||"تکناو")})}},[i,n]),h=c.useCallback(()=>{x.current&&x.current.toBlob(m=>{if(!m)return;const v=URL.createObjectURL(m),j=document.createElement("a");j.href=v,j.download="teknav-quote.png",j.click(),URL.revokeObjectURL(v)},"image/png")},[]),f=c.useCallback(()=>{if(!i?.text)return;const m=`«${i.text}»
— از مقاله: ${n?.title||"تکناو"}
https://www.teknav.ir/article/${n?.slug||""}`;try{navigator.clipboard.writeText(m).then(()=>{l(!0),setTimeout(()=>l(!1),2e3)}).catch(()=>{})}catch{}},[i,n]),y=c.useCallback(async()=>{if(!(!x.current||r)){d(!0);try{if(navigator.share&&navigator.canShare){const m=await new Promise(j=>x.current.toBlob(j,"image/png")),v=new File([m],"teknav-quote.png",{type:"image/png"});if(navigator.canShare({files:[v]})){await navigator.share({files:[v],title:n?.title||"تکناو",url:`https://www.teknav.ir/article/${n?.slug||""}`}),d(!1);return}}h()}catch{}d(!1)}},[r,h,n]);return!i&&!s?null:e.jsxs(e.Fragment,{children:[i&&!s&&e.jsxs("div",{style:{position:"absolute",left:i.x,top:i.y,transform:"translateX(-50%)",zIndex:1e3,background:"#0F3540",border:"1px solid #D49A2A",borderRadius:8,padding:"6px 14px",cursor:"pointer",color:"#fff",fontSize:13,fontFamily:ue,whiteSpace:"nowrap",boxShadow:"0 4px 16px rgba(0,0,0,0.4)",userSelect:"none",display:"flex",alignItems:"center",gap:6},onMouseDown:m=>{m.preventDefault(),b()},children:[e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Wt}")`},"aria-hidden":"true"}),e.jsx("span",{children:"اشتراک‌گذاری نقل‌قول"})]}),s&&e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"اشتراک‌گذاری نقل‌قول",style:{position:"fixed",inset:0,zIndex:2e3,background:"rgba(0,0,0,0.85)",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",gap:16,fontFamily:ue,direction:"rtl"},onClick:m=>{m.target===m.currentTarget&&(a(!1),o(null))},children:[e.jsx("canvas",{ref:x,style:{maxWidth:"min(90vw, 480px)",maxHeight:"65vh",borderRadius:12,border:"2px solid #D49A2A"}}),e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",justifyContent:"center"},children:[e.jsx("button",{onClick:y,disabled:r,style:{background:"#0F6B73",color:"#fff",border:"none",borderRadius:8,padding:"10px 22px",fontSize:14,fontFamily:ue,cursor:"pointer",fontWeight:700},children:r?"در حال اشتراک…":e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Wt}")`},"aria-hidden":"true"})," اشتراک‌گذاری"]})}),e.jsx("button",{onClick:f,style:{background:p?"#2E7D32":"#1A3A42",color:p?"#fff":"#D49A2A",border:`1px solid ${p?"#2E7D32":"#D49A2A"}`,borderRadius:8,padding:"10px 22px",fontSize:14,fontFamily:ue,cursor:"pointer",fontWeight:700,transition:"all 0.2s"},children:p?"✓ کپی شد":e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Kn}")`},"aria-hidden":"true"})," کپی متن"]})}),e.jsx("button",{onClick:h,style:{background:"#1A3A42",color:"#D49A2A",border:"1px solid #D49A2A",borderRadius:8,padding:"10px 22px",fontSize:14,fontFamily:ue,cursor:"pointer",fontWeight:700},children:"⬇ PNG"}),e.jsx("button",{onClick:()=>{a(!1),o(null)},style:{background:"transparent",color:"rgba(255,255,255,0.6)",border:"1px solid rgba(255,255,255,0.2)",borderRadius:8,padding:"10px 16px",fontSize:14,fontFamily:ue,cursor:"pointer"},children:"بستن"})]}),e.jsx("p",{style:{color:"rgba(255,255,255,0.3)",fontSize:12,margin:0},children:"Esc برای بستن"})]})]})}const sr="/assets/crown-A9o06LUR.svg",It="/assets/thumbs-up-Cs-OP4r6.svg",xt="/assets/star-FenXZxam.svg",or="/assets/heart-C65ixkWj.svg",ki="/assets/flame-CaHKTtJr.svg",ar="/assets/lightbulb-CLs3ZMTT.svg";function Tt(t){return t?.dateEn||t?.publishedAt||t?.date||""}function Si(t){return t?.date||(typeof t?.publishedAt=="string"?t.publishedAt.slice(0,10):"")||t?.dateEn||""}const lr="tekrag-persian-data-centric-rag-benchmark",Fi=t=>(typeof t=="string"?t:t?.slug)===lr;function He(t,n=!1){return Number(t??0).toLocaleString(n?"en-US":"fa-IR")}function Fe({article:t,idx:n}){const{navigate:i}=q(),[o,s]=c.useState(!1),a=c.useRef();Ke(a,t.slug);const r=M.categories.find(p=>p.id===t.category),d=M.authors.find(p=>p.id===t.authorId);return c.useEffect(()=>{const p=new IntersectionObserver(([l])=>{l.isIntersecting&&s(!0)},{threshold:.05});return a.current&&p.observe(a.current),()=>p.disconnect()},[]),e.jsxs("div",{ref:a,className:"article-row",style:{display:"grid",gridTemplateColumns:"1fr 140px",gap:24,padding:"32px 0",borderBottom:"1px solid #E4DDD2",direction:"rtl",cursor:"pointer",opacity:o?1:0,transform:o?"none":"translateY(16px)",transition:`opacity 0.4s ${n*60}ms, transform 0.4s ${n*60}ms`},onClick:()=>i("/article/"+t.slug),onMouseEnter:p=>{p.currentTarget.style.opacity="0.85"},onMouseLeave:p=>{p.currentTarget.style.opacity="1"},children:[e.jsxs("div",{children:[e.jsxs("div",{className:"article-row-meta",style:{display:"flex",gap:8,alignItems:"center",marginBottom:10,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:12,color:"#5F6B6D"},children:Si(t)}),e.jsx("span",{style:{color:"#E4DDD2"},children:"·"}),e.jsx(We,{type:t.type,small:!0}),e.jsx(De,{name:t.categoryName,color:r?.color,small:!0})]}),e.jsx("h2",{style:{fontSize:19,fontWeight:800,color:"#263238",margin:"0 0 6px",lineHeight:1.5,fontFamily:"Vazirmatn,sans-serif"},children:t.title}),t.subtitle&&e.jsx("div",{style:{fontSize:14,color:"#0F6B73",fontWeight:600,margin:"0 0 8px"},children:t.subtitle}),e.jsxs("div",{style:{fontSize:13,color:"#5F6B6D",margin:"0 0 10px"},children:[e.jsx("button",{onClick:p=>{p.stopPropagation(),t.authorUsername&&i("/profile/@"+t.authorUsername)},style:{background:"none",border:"none",padding:0,cursor:t.authorUsername?"pointer":"default",color:t.authorUsername?"#0F6B73":"#5F6B6D",fontFamily:"Vazirmatn,sans-serif",fontSize:13,fontWeight:700},children:t.authorName}),d?.specialty&&e.jsx("span",{style:{color:"#E4DDD2"},children:" · "}),d?.specialty&&e.jsx("span",{children:d.specialty})]}),e.jsx("p",{style:{fontSize:14,color:"#5F6B6D",lineHeight:1.8,margin:"0 0 12px"},children:t.summary}),e.jsxs("div",{className:"article-row-stats",style:{display:"flex",gap:16,fontSize:12,color:"#5F6B6D",alignItems:"center"},children:[e.jsx("span",{style:{color:"#C46A4D",fontWeight:600},children:t.type}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[t.readTime," دقیقه مطالعه"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[(t.views||0).toLocaleString("fa")," بازدید"]}),t.tags?.slice(0,2).map(p=>e.jsx("span",{style:{background:"#F4EFE6",padding:"2px 8px",borderRadius:4,fontSize:11},children:p},p))]})]}),e.jsx("div",{className:"article-row-thumb",style:{background:"#F4EFE6",borderRadius:10,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",height:120,alignSelf:"center"},children:e.jsx("div",{style:{transform:"scale(0.5)",transformOrigin:"center",width:280},children:e.jsx(we,{type:t.diagram,compact:!0})})})]})}function dr({filters:t,onChange:n}){const i=[{id:"",name:"همه"},...M.categories],o=["همه","تحلیل عمیق","راهنمای فنی","داده‌نما","پژوهش","راستی‌آزمایی‌شده","پرونده"],s=[{v:"latest",l:"جدیدترین"},{v:"popular",l:"پربازدیدترین"},{v:"readtime",l:"زمان مطالعه"}],a=r=>({border:r?"1.5px solid #0F6B73":"1px solid #E4DDD2",background:r?"#0F6B7312":"#fff",color:r?"#0F6B73":"#5F6B6D",padding:"5px 12px",borderRadius:20,fontSize:12,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",fontWeight:r?700:400,transition:"all 0.15s",whiteSpace:"nowrap"});return e.jsxs("div",{className:"filter-bar",style:{direction:"rtl",marginBottom:32,display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{className:"filter-chip-row",style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("span",{style:{fontSize:12,color:"#5F6B6D",whiteSpace:"nowrap"},children:"دسته:"}),i.map(r=>e.jsx("button",{style:a(t.cat===r.id),onClick:()=>n({...t,cat:r.id}),children:r.name},r.id))]}),e.jsxs("div",{className:"filter-chip-row",style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("span",{style:{fontSize:12,color:"#5F6B6D",whiteSpace:"nowrap"},children:"نوع:"}),o.map(r=>e.jsx("button",{style:a(t.type===r||!t.type&&r==="همه"),onClick:()=>n({...t,type:r==="همه"?"":r}),children:r},r))]}),e.jsxs("div",{className:"filter-chip-row",style:{display:"flex",gap:16,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("span",{style:{fontSize:12,color:"#5F6B6D"},children:"مرتب‌سازی:"}),s.map(r=>e.jsx("button",{style:a(t.sort===r.v),onClick:()=>n({...t,sort:r.v}),children:r.l},r.v))]}),t.q&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,background:"#F4EFE6",padding:"5px 12px",borderRadius:20},children:[e.jsxs("span",{style:{fontSize:12,color:"#263238"},children:["جستجو: «",t.q,"»"]}),e.jsx("button",{onClick:()=>n({...t,q:""}),style:{background:"none",border:"none",cursor:"pointer",color:"#5F6B6D",fontSize:14},children:"✕"})]})]})]})}function cr({initQ:t=""}){const[n,i]=c.useState({cat:"",type:"",sort:"latest",q:t}),[o,s]=c.useState(t),[a,r]=c.useState(1),[d,p]=c.useState(()=>U.fallbackArticles()),l=8;c.useEffect(()=>{let h=!1;return U.listArticles({limit:100}).then(f=>{h||p(f.items??[])}).catch(()=>{}),()=>{h=!0}},[]);const x=c.useMemo(()=>{let h=d;if(n.q){const f=n.q.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(f)||y.summary.toLowerCase().includes(f)||y.authorName?.toLowerCase().includes(f)||y.categoryName?.toLowerCase().includes(f))}return n.cat&&(h=h.filter(f=>f.category===n.cat)),n.type&&(h=h.filter(f=>f.type===n.type)),n.sort==="popular"?h=[...h].sort((f,y)=>y.views-f.views):n.sort==="readtime"?h=[...h].sort((f,y)=>y.readTime-f.readTime):h=[...h].sort((f,y)=>Tt(y).localeCompare(Tt(f))),h},[n,d]),u=x.slice(0,a*l),g=u.length<x.length,b=h=>{h.preventDefault(),i(f=>({...f,q:o})),r(1)};return e.jsx("div",{className:"article-list-page",style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif"},children:e.jsxs("div",{className:"article-list-inner",style:{maxWidth:1e3,margin:"0 auto",padding:"0 24px"},children:[e.jsxs("div",{className:"article-list-head",style:{direction:"rtl",padding:"32px 0 0"},children:[e.jsx("h1",{style:{fontSize:28,fontWeight:900,color:"#263238",margin:"0 0 4px"},children:"همه مقاله‌ها"}),e.jsxs("p",{style:{fontSize:14,color:"#5F6B6D",margin:"0 0 28px"},children:[x.length," مقاله یافت شد"]}),e.jsxs("form",{className:"article-search-form",onSubmit:b,style:{display:"flex",gap:10,marginBottom:24},children:[e.jsx("input",{value:o,onChange:h=>s(h.target.value),placeholder:"جستجو در عنوان، خلاصه، نویسنده...",style:{flex:1,...O},dir:"rtl"}),e.jsx("button",{type:"submit",style:{...W,background:"#0F6B73",color:"#fff"},children:"جستجو"})]})]}),e.jsx(dr,{filters:n,onChange:h=>{i(h),r(1)}}),u.length===0?e.jsx(J,{title:"مقاله‌ای یافت نشد",subtitle:"فیلترها یا کلمات جستجو را تغییر دهید"}):e.jsxs(e.Fragment,{children:[u.map((h,f)=>e.jsx(Fe,{article:h,idx:f},h.id)),g&&e.jsx("div",{className:"load-more-wrap",style:{textAlign:"center",padding:"32px 0"},children:e.jsx("button",{onClick:()=>r(h=>h+1),style:{...W,background:"#0F6B73",color:"#fff",padding:"12px 32px"},children:"بارگذاری مقاله‌های بیشتر"})})]})]})})}function pr({headings:t,english:n=!1}){const[i,o]=c.useState(null);return c.useEffect(()=>{const s=new IntersectionObserver(a=>{a.forEach(r=>{r.isIntersecting&&o(r.target.id)})},{rootMargin:"-20% 0px -70% 0px"});return t.forEach(a=>{const r=document.getElementById(a.id);r&&s.observe(r)}),()=>s.disconnect()},[t]),e.jsxs("nav",{style:{position:"sticky",top:90,maxHeight:"calc(100vh - 100px)",overflowY:"auto",direction:"rtl"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,color:"#5F6B6D",letterSpacing:"0.08em",marginBottom:12},children:n?"CONTENTS":"فهرست مطالب"}),t.map(s=>e.jsx("a",{href:"#"+s.id,onClick:a=>{a.preventDefault(),document.getElementById(s.id)?.scrollIntoView({behavior:"smooth",block:"start"})},style:{display:"block",padding:s.level===3?"4px 12px":"5px 0",fontSize:s.level===3?12:13,color:i===s.id?"#0F6B73":"#5F6B6D",textDecoration:"none",fontWeight:i===s.id?700:400,borderRight:i===s.id?"2px solid #0F6B73":"2px solid transparent",transition:"all 0.15s",lineHeight:1.5},children:s.text},s.id))]})}function $e({title:t,subtitle:n,type:i,english:o=!1}){return e.jsxs("div",{className:o?"article-diagram-card tekrag-diagram-card":"article-diagram-card",children:[e.jsxs("div",{style:{direction:o?"ltr":"rtl",textAlign:o?"center":"right",marginBottom:14},children:[e.jsx("div",{style:{fontSize:o?15:13,fontWeight:800,color:"#0F6B73",marginBottom:4},children:t}),n&&e.jsx("div",{style:{fontSize:12,color:"#5F6B6D",lineHeight:1.8,maxWidth:o?680:"none",margin:o?"0 auto":0},children:n})]}),e.jsx(we,{type:i})]})}function gr({slug:t}){return Fi(t)?null:t==="ai-clean-data"?e.jsx($e,{title:"نمودار تعاملی: پایپ‌لاین داده",subtitle:"با موس روی هر مرحله بروید تا توضیح بیشتر ببینید",type:"pipeline"}):t==="ai-agents-2026"||t==="agentic-ai-production"?e.jsxs("div",{style:{display:"grid",gap:22,margin:"34px 0"},children:[e.jsx($e,{title:"معماری یک AI Agent جدی",subtitle:"از مدل پایه و حافظه تا ابزارها، کنترل دسترسی، لاگ و بازبینی انسانی.",type:"diagram-12"}),e.jsx($e,{title:"جریان تصمیم تا اجرای ابزار",subtitle:"عامل باید هدف را بشکند، ابزار درست را انتخاب کند، خروجی را ارزیابی کند و فقط در محدوده مجاز اقدام کند.",type:"pipeline"}),e.jsx($e,{title:"ریسک‌های امنیتی در حلقه عامل",subtitle:"هر tool call یک سطح حمله است: prompt injection، نشت داده، سوءاستفاده از مجوز و اقدام اشتباه.",type:"cyber"}),e.jsx($e,{title:"حرکت بازار از Copilot به Coworker",subtitle:"ارزش نرم‌افزار از نمایش داشبورد به واگذاری کنترل‌شده کارهای واقعی منتقل می‌شود.",type:"orbit"})]}):null}function xr({series:t,currentSlug:n}){const{navigate:i}=q(),o=t.articles.findIndex(d=>d.slug===n),s=o>0?t.articles[o-1]:null,a=o<t.articles.length-1?t.articles[o+1]:null;if(!s&&!a)return null;const r={background:"transparent",border:"1px solid #0F6B7330",borderRadius:8,padding:"10px 16px",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",color:"#0F6B73",fontSize:13,fontWeight:600,maxWidth:280,textAlign:"right",transition:"all 0.15s",lineHeight:1.5};return e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"space-between",padding:"16px 0",borderTop:"1px solid #E4DDD2",marginTop:8,direction:"rtl"},children:[s?e.jsxs("button",{onClick:()=>i("/article/"+s.slug),style:{...r,borderRight:"3px solid #0F6B73"},onMouseEnter:d=>d.currentTarget.style.background="#0F6B7308",onMouseLeave:d=>d.currentTarget.style.background="transparent",children:[e.jsx("div",{style:{fontSize:10,color:"#5F6B6D",marginBottom:3},children:"← قسمت قبلی"}),e.jsxs("div",{children:[s.title.slice(0,50),s.title.length>50?"…":""]})]}):e.jsx("div",{}),a?e.jsxs("button",{onClick:()=>i("/article/"+a.slug),style:{...r,textAlign:"left",borderLeft:"3px solid #0F6B73"},onMouseEnter:d=>d.currentTarget.style.background="#0F6B7308",onMouseLeave:d=>d.currentTarget.style.background="transparent",children:[e.jsx("div",{style:{fontSize:10,color:"#5F6B6D",marginBottom:3,textAlign:"left"},children:"قسمت بعدی →"}),e.jsxs("div",{children:[a.title.slice(0,50),a.title.length>50?"…":""]})]}):e.jsx("div",{})]})}function ur({slug:t,english:n=!1}){const{user:i}=ae(),[o,s]=c.useState([]),[a,r]=c.useState(!0),[d,p]=c.useState(""),[l,x]=c.useState(null),u=te(),g=c.useCallback(()=>{r(!0),K.listQa(t).then(h=>s(h.items??[])).finally(()=>r(!1))},[t]);c.useEffect(()=>{g()},[g]);const b=async h=>{if(h.preventDefault(),!!d.trim())try{l?await K.postAnswer(l.id,d):await K.postQuestion(t,d),p(""),x(null),u(n?"Submitted":"ثبت شد"),g()}catch{u(n?"Submission failed":"خطا در ثبت","error")}};return e.jsxs("section",{style:{marginTop:48,direction:n?"ltr":"rtl",textAlign:n?"left":"right"},children:[e.jsx("h3",{style:{fontSize:18,fontWeight:800,color:"#263238",marginBottom:20},children:n?"Questions and Answers":"پرسش و پاسخ"}),i?e.jsxs("form",{onSubmit:b,style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:14,marginBottom:24},children:[l&&e.jsxs("div",{style:{fontSize:12,color:"#0F6B73",marginBottom:8},children:[n?"Replying to":"پاسخ به",": ",l.author?.name," ",e.jsx("button",{type:"button",onClick:()=>x(null),style:{background:"none",border:"none",color:"#C94C4C",cursor:"pointer",marginInlineStart:8},children:n?"Cancel":"لغو"})]}),e.jsx("textarea",{value:d,onChange:h=>p(h.target.value),placeholder:l?n?"Write your answer...":"پاسخ خود را بنویسید...":n?"Ask a question...":"سوال خود را بپرسید...",style:{...O,minHeight:80,direction:n?"ltr":"rtl",textAlign:n?"left":"right"}}),e.jsx("div",{style:{textAlign:n?"right":"left",marginTop:10},children:e.jsx("button",{type:"submit",style:{...W,background:"#0F6B73",color:"#fff"},children:l?n?"Submit Answer":"ثبت پاسخ":n?"Submit Question":"ثبت پرسش"})})]}):e.jsx("div",{style:{background:"#F4EFE6",padding:16,borderRadius:12,fontSize:13,marginBottom:24},children:n?"Sign in to ask a question.":"برای پرسیدن سوال وارد شوید."}),a?e.jsx("div",{children:n?"Loading...":"در حال بارگذاری..."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[o.length===0&&e.jsx("div",{style:{fontSize:13,color:"#5F6B6D"},children:n?"No questions yet.":"هنوز پرسشی ثبت نشده است."}),o.map(h=>e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:16},children:[e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center",marginBottom:8},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700},children:h.author?.name}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D"},children:h.time})]}),e.jsx("p",{style:{fontSize:14,lineHeight:1.8,marginBottom:12},children:h.body}),e.jsx("button",{onClick:()=>x(h),style:{background:"none",border:"none",color:"#0F6B73",fontSize:12,cursor:"pointer",fontWeight:600},children:n?"Reply":"پاسخ دادن"}),h.answers?.map(f=>e.jsxs("div",{style:{marginTop:12,padding:12,borderRight:"2px solid #E4DDD2",background:"#F4EFE680",borderRadius:"0 8px 8px 0"},children:[e.jsx("div",{style:{fontSize:12,fontWeight:700,marginBottom:4},children:f.author?.name}),e.jsx("p",{style:{fontSize:13,lineHeight:1.7},children:f.body})]},f.id))]},h.id))]})]})}function hr({article:t,onTotal:n,english:i=!1}){const{user:o}=ae(),{navigate:s}=q(),a=te(),[r,d]=c.useState([]),[p,l]=c.useState(""),[x,u]=c.useState(null),[g,b]=c.useState(!0),[h,f]=c.useState(!1),y=c.useCallback(()=>(b(!0),f(!1),K.listComments(t.slug).then(D=>{d(D?.items??[]),n?.(D?.total??0)}).catch(()=>{d([]),f(!0)}).finally(()=>b(!1))),[t.slug,n]);c.useEffect(()=>{y()},[y]);const m=async D=>{if(D.preventDefault(),!!p.trim())try{await K.postComment(t.slug,p,x?.id),l(""),u(null),a(i?"Comment submitted":"نظر شما ثبت شد"),y()}catch{a(i?"Comment submission failed":"ثبت نظر ناموفق بود","error")}},v=async D=>{try{const L=await K.upvoteComment(D);d(P=>P.map(V=>V.id===D?{...V,upvotedByMe:L.upvoted,upvoteCount:L.upvoteCount}:{...V,replies:(V.replies??[]).map(B=>B.id===D?{...B,upvotedByMe:L.upvoted,upvoteCount:L.upvoteCount}:B)}))}catch{a(i?"Sign in to vote":"برای رأی دادن ابتدا وارد شوید","warning")}},j=async D=>{try{await K.flagComment(D),a(i?"Report submitted":"گزارش نظر ثبت شد"),y()}catch{a(i?"Sign in to report a comment":"برای گزارش نظر ابتدا وارد شوید","warning")}},I=async D=>{try{const L=await K.likeComment(D);d(P=>P.map(V=>V.id===D?{...V,likedByMe:L.liked,likeCount:L.likeCount}:{...V,replies:(V.replies??[]).map(B=>B.id===D?{...B,likedByMe:L.liked,likeCount:L.likeCount}:B)}))}catch{a(i?"Sign in to like a comment":"برای پسندیدن نظر ابتدا وارد شوید","warning")}},w=(D,L=!1)=>e.jsxs("div",{style:{background:L?"#FAF7F0":"#fff",border:"1px solid #E4DDD2",borderRadius:10,padding:14,marginTop:L?10:12},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,alignItems:"flex-start"},children:[e.jsxs("div",{children:[e.jsx("button",{onClick:()=>D.author?.username&&s("/profile/@"+D.author.username),style:{background:"none",border:"none",padding:0,cursor:D.author?.username?"pointer":"default",fontFamily:"Vazirmatn,sans-serif",fontSize:13,fontWeight:800,color:D.author?.username?"#0F6B73":"#263238"},children:D.author?.name??(i?"Reader":"کاربر")}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D"},children:["@",D.author?.username??"user"," · ",D.time]})]}),e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsxs("button",{onClick:()=>v(D.id),style:{...W,padding:"4px 10px",fontSize:12,background:D.upvotedByMe?"#0F6B7318":"#F4EFE6",color:D.upvotedByMe?"#0F6B73":"#263238",border:`1px solid ${D.upvotedByMe?"#0F6B7340":"#E4DDD2"}`},children:["▲ ",He(D.upvoteCount,i)]}),e.jsx("button",{onClick:()=>j(D.id),style:{...W,background:"#F4EFE6",color:"#5F6B6D",fontSize:11,padding:"4px 10px"},children:i?"Report":"گزارش"})]})]}),e.jsx("p",{style:{margin:"12px 0 0",fontSize:14,lineHeight:1.9,color:"#263238"},children:D.body}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",marginTop:8},children:[e.jsxs("button",{onClick:()=>I(D.id),style:{...W,background:D.likedByMe?"#0F6B7318":"transparent",color:D.likedByMe?"#0F6B73":"#5F6B6D",fontSize:12,padding:"4px 8px",border:D.likedByMe?"1px solid #0F6B7330":"1px solid transparent"},children:[i?"Like":"پسندیدن"," ",He(D.likeCount,i)]}),o&&!L&&e.jsx("button",{onClick:()=>u(D),style:{...W,background:"transparent",color:"#0F6B73",fontSize:12,padding:"4px 0"},children:i?"Reply":"پاسخ"})]})," ",D.replies?.map(P=>w(P,!0))]},D.id);return e.jsxs("section",{style:{borderTop:"1px solid #E4DDD2",marginTop:40,paddingTop:24,direction:i?"ltr":"rtl",textAlign:i?"left":"right"},children:[e.jsx("h3",{style:{fontSize:18,fontWeight:800,color:"#263238",margin:"0 0 16px"},children:i?"Comments":"نظرها"}),o?e.jsxs("form",{onSubmit:m,style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:14,marginBottom:14},children:[x&&e.jsxs("div",{style:{fontSize:12,color:"#0F6B73",marginBottom:8},children:[i?"Replying to":"پاسخ به"," ",x.author?.name,e.jsx("button",{type:"button",onClick:()=>u(null),style:{background:"none",border:"none",color:"#C94C4C",cursor:"pointer",marginInlineStart:8},children:i?"Cancel":"لغو"})]}),e.jsx("textarea",{value:p,onChange:D=>l(D.target.value),maxLength:1e3,placeholder:i?"Write a comment...":"نظر خود را بنویسید...",style:{...O,minHeight:90,resize:"vertical",direction:i?"ltr":"rtl",textAlign:i?"left":"right"},dir:i?"ltr":"rtl"}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:10},children:[e.jsxs("span",{style:{fontSize:11,color:"#5F6B6D"},children:[He(p.length,i)," / 1000"]}),e.jsx("button",{type:"submit",style:{...W,background:"#0F6B73",color:"#fff"},children:i?"Submit Comment":"ثبت نظر"})]})]}):e.jsx("div",{style:{background:"#F4EFE6",border:"1px solid #E4DDD2",borderRadius:12,padding:16,color:"#5F6B6D",fontSize:13},children:i?"Sign in to comment.":"برای نظر دادن وارد شوید."}),g&&e.jsx("div",{style:{color:"#5F6B6D",fontSize:13},children:i?"Loading comments...":"در حال بارگذاری نظرها..."}),h&&e.jsx(J,{title:i?"Comments are temporarily unavailable":"بخش نظرها موقتاً در دسترس نیست",subtitle:i?"Please try again later":"لطفاً بعداً دوباره امتحان کنید"}),!g&&!h&&r.length===0&&e.jsx(J,{title:i?"No comments yet":"هنوز نظری ثبت نشده است"}),!g&&!h&&r.map(D=>w(D))]})}function fr({navigate:t,user:n}){return e.jsxs("div",{style:{background:"linear-gradient(135deg, #0F2A2E 0%, #1A3A40 100%)",borderRadius:16,padding:"36px 32px",marginTop:-24,position:"relative",border:"1px solid #D49A2A40",direction:"rtl",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:36,marginBottom:12},children:e.jsx("span",{className:"tek-icon",style:{"--i":`url("${sr}")`},"aria-hidden":"true"})}),e.jsx("div",{style:{fontSize:18,fontWeight:700,color:"#D49A2A",marginBottom:8},children:"این مقاله برای اعضای ویژه"}),e.jsx("div",{style:{fontSize:14,color:"#A8B8BA",marginBottom:24,lineHeight:1.8},children:"برای مطالعه کامل این مقاله، عضو ویژه تکناو شوید"}),e.jsx("ul",{style:{listStyle:"none",padding:0,margin:"0 0 28px",display:"inline-block",textAlign:"right"},children:["✓ دسترسی به همه مقالات ویژه","✓ تجربه بدون تبلیغ","✓ حمایت مستقیم از تکناو"].map(i=>e.jsx("li",{style:{color:"#C8D8DA",fontSize:13,marginBottom:8,lineHeight:1.6},children:i},i))}),e.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"center",flexWrap:"wrap"},children:[e.jsx("button",{onClick:()=>t("/membership"),style:{background:"linear-gradient(135deg, #D49A2A, #B8821E)",color:"#fff",border:"none",borderRadius:8,padding:"12px 28px",fontSize:14,fontWeight:700,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"عضویت ویژه"}),!n&&e.jsx("button",{onClick:()=>t("/login"),style:{background:"transparent",color:"#A8B8BA",border:"1px solid #A8B8BA60",borderRadius:8,padding:"12px 24px",fontSize:14,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"ورود به حساب"})]})]})}function mr({slug:t}){const{navigate:n}=q(),{user:i}=ae(),o=te(),s=c.useRef(null),a=t==="ai-agents-2026"?"agentic-ai-production":t,[r,d]=c.useState(!1),[p,l]=c.useState(!1),[x,u]=c.useState({}),[g,b]=c.useState(()=>U.fallbackArticles().find(E=>E.slug===a)),[h,f]=c.useState([]),[y,m]=c.useState(0),v=c.useMemo(()=>{if(!g?.content)return"";let E=0;const $=g.content.includes('class="lead"')?g.content:g.content.replace(/<p(?![^>]*class=)([^>]*)>/,'<p class="lead"$1>');return Jn(g,$).replace(/<h([23])[^>]*>([^<]+)<\/h\1>/g,(ee,Be,Ii)=>{const Ti="h-"+E++;return`<h${Be} id="${Ti}">${Ii}</h${Be}>`})},[g]);if(c.useEffect(()=>{let E=!1;t!==a&&typeof window<"u"&&window.history.replaceState({},"",`/article/${a}`);const $=U.fallbackArticles().find(Q=>Q.slug===a);return b($),f($?U.fallbackArticles().filter(Q=>Q.category===$.category&&Q.id!==$.id).slice(0,3):[]),d(!1),u({}),U.getArticle(a).then(Q=>{E||(b(Q.article),f(Q.related??[]),d(!!Q.saved),u(Q.reactions??{}))}).catch(()=>{}),()=>{E=!0}},[a]),c.useEffect(()=>{if(!g?.id)return;const E=()=>{const $=document.documentElement,Q=($.scrollTop||document.body.scrollTop)/($.scrollHeight-$.clientHeight);Q>.05&&K.recordHistory(g.id,Math.min(Q,1)).catch(()=>{})};return window.addEventListener("scroll",E),()=>window.removeEventListener("scroll",E)},[g?.id]),c.useEffect(()=>{v&&document.querySelectorAll(".article-content pre").forEach(E=>{if(E.querySelector(".code-copy-btn"))return;const $=E.querySelector("code"),Q=$?.className?.match(/language-(\w+)/)?.[1];Q&&E.setAttribute("data-lang",Q);const ee=document.createElement("button");ee.className="code-copy-btn",ee.textContent="کپی",ee.onclick=()=>{navigator.clipboard?.writeText($?.textContent??"").then(()=>{ee.textContent="✓ کپی شد",setTimeout(()=>{ee.textContent="کپی"},2e3)}).catch(()=>{})},E.appendChild(ee)})},[v]),!g)return e.jsxs("div",{style:{paddingTop:100,textAlign:"center",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx(J,{title:"مقاله یافت نشد",subtitle:"این مقاله وجود ندارد یا حذف شده است"}),e.jsx("button",{onClick:()=>n("/articles"),style:{...W,background:"#0F6B73",color:"#fff",marginTop:16},children:"بازگشت به مقاله‌ها"})]});const j=g.author||M.authors.find(E=>E.id===g.authorId),I=M.categories.find(E=>E.id===g.category),w=Fi(g),D=w?"Arsam Sabbagh":j?.name||g.authorName,L=w?"AI and Data Engineering Researcher":j?.specialty,P=w?"Arsam Sabbagh is an AI and data engineering researcher focused on retrieval-augmented generation, data-centric AI, Persian technical content systems, and evaluation of grounded language-model applications.":j?.bio,V=w?"Data Science":g.categoryName,B=w?"Research Article":g.type,z=w?"May 8, 2026":Si(g),Y=w?"Published":g.status,Z=w?"ltr":"rtl",ne=null,oe=[],ke=/<h2[^>]*>([^<]+)<\/h2>/g,_=/<h3[^>]*>([^<]+)<\/h3>/g;let R;for(;(R=ke.exec(g.content||""))!==null;)oe.push({id:"h-"+oe.length,text:R[1],level:2});for(;(R=_.exec(g.content||""))!==null;)oe.push({id:"h-"+oe.length,text:R[1],level:3});const F=async()=>{try{const E=await U.toggleSaved(g.id);d(!!E.saved),E.saved&&l(!0),o(w?E.saved?"Saved to reading list":"Removed from saved articles":E.saved?"در لیست مطالعه ذخیره شد":"از ذخیره‌شده‌ها حذف شد")}catch{o(w?"Sign in to save this article":"برای ذخیره مقاله ابتدا وارد شوید","warning")}},T=(E="copy")=>{const $=window.location.href,Q=g.title;if(U.trackEvent({type:"share_clicked",articleId:g.id,topic:g.category,metadata:{channel:E}}).catch(()=>{}),E==="telegram"){window.open(`https://t.me/share/url?url=${encodeURIComponent($)}&text=${encodeURIComponent(Q)}`,"_blank","noopener,noreferrer");return}if(E==="whatsapp"){window.open(`https://wa.me/?text=${encodeURIComponent(`${Q} ${$}`)}`,"_blank","noopener,noreferrer");return}if(E==="x"){window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent($)}&text=${encodeURIComponent(Q)}`,"_blank","noopener,noreferrer");return}if(E==="linkedin"){window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent($)}`,"_blank","noopener,noreferrer");return}navigator.clipboard?.writeText($).catch(()=>{}),o("لینک مقاله کپی شد")},X=async E=>{try{const $=await U.toggleReaction(g.id,E);u(Q=>({...Q,[E]:!!$.active})),$.active&&o(w?"Reaction saved":"واکنش شما ثبت شد")}catch{o(w?"Sign in to react":"برای ثبت واکنش ابتدا وارد شوید","warning")}};return e.jsxs("div",{className:w?"article-detail-page tekrag-article-page":"article-detail-page",style:{paddingTop:64,background:"#FAF7F0",minHeight:"100vh",fontFamily:w?"Inter, Arial, sans-serif":"Vazirmatn,sans-serif",overflowX:"hidden",maxWidth:"100vw"},children:[e.jsx(fn,{}),e.jsx("div",{className:"article-breadcrumb",style:{background:"#F4EFE6",borderBottom:"1px solid #E4DDD2",padding:"12px 24px",direction:Z,fontSize:12,color:"#5F6B6D"},children:e.jsxs("div",{style:{maxWidth:1280,margin:"0 auto",display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("button",{onClick:()=>n("/"),style:{background:"none",border:"none",cursor:"pointer",color:"#0F6B73",fontSize:12,fontFamily:w?"Inter, Arial, sans-serif":"Vazirmatn,sans-serif",padding:0},children:w?"Home":"خانه"}),e.jsx("span",{children:"›"}),e.jsx("button",{onClick:()=>n("/category/"+g.category),style:{background:"none",border:"none",cursor:"pointer",color:"#0F6B73",fontSize:12,fontFamily:w?"Inter, Arial, sans-serif":"Vazirmatn,sans-serif",padding:0},children:V}),e.jsx("span",{children:"›"}),e.jsxs("span",{style:{color:"#263238",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:"1 1 auto"},children:[g.title.slice(0,40),"…"]})]})}),e.jsxs("div",{style:{maxWidth:w?1360:1280,margin:"0 auto",padding:w?"44px 24px 64px":"40px 24px",display:"grid",gridTemplateColumns:w?"220px minmax(0, 860px)":"200px 1fr",justifyContent:w?"center":"initial",gap:w?52:48,direction:Z,overflowX:"hidden",minWidth:0},className:"article-layout",children:[e.jsx("aside",{className:"toc-sidebar",role:"complementary","aria-label":w?"Table of contents":"فهرست مطالب",children:oe.length>0&&e.jsx(pr,{headings:oe,english:w})}),e.jsxs("article",{className:"article-main",style:{maxWidth:w?860:760,direction:Z,textAlign:w?"left":"right",minWidth:0,overflowX:"hidden"},children:[e.jsxs("header",{className:"article-header",style:{marginBottom:32,paddingBottom:24,borderBottom:"1px solid #E4DDD2"},children:[e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:16,flexWrap:"wrap"},children:[e.jsx(We,{type:B}),e.jsx(De,{name:V,color:I?.color}),w?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,padding:"3px 10px",borderRadius:20,fontSize:11,fontWeight:600,background:"#2F8F6B15",color:"#2F8F6B",border:"1px solid #2F8F6B30"},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#2F8F6B"}}),Y]}):e.jsx(mt,{status:g.status}),g.sponsored&&e.jsx("span",{style:{background:"#FFF4D8",color:"#8A5A00",border:"1px solid #D49A2A55",borderRadius:6,padding:"5px 10px",fontSize:11,fontWeight:800},children:"Promoted Content"}),g.premiumOnly&&e.jsx("span",{style:{background:"#0F2A2E",color:"#D49A2A",borderRadius:6,padding:"5px 10px",fontSize:11,fontWeight:800},children:"Premium"})]}),e.jsx("h1",{style:{fontSize:"clamp(22px,4vw,34px)",fontWeight:900,color:"#263238",margin:"0 0 12px",lineHeight:1.4,fontFamily:"Vazirmatn,sans-serif",wordWrap:"break-word",overflowWrap:"break-word",hyphens:"auto",maxWidth:"100%"},children:g.title}),g.subtitle&&e.jsx("p",{style:{fontSize:18,color:"#5F6B6D",margin:"0 0 20px",lineHeight:1.6,fontWeight:400},children:g.subtitle}),e.jsxs("div",{className:"article-byline-row",style:{display:"flex",alignItems:"center",gap:16,flexWrap:"wrap"},children:[j&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx(je,{author:j,size:40}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>g.authorUsername&&n("/profile/@"+g.authorUsername),style:{background:"none",border:"none",padding:0,cursor:g.authorUsername?"pointer":"default",fontFamily:w?"Inter, Arial, sans-serif":"Vazirmatn,sans-serif",fontSize:14,fontWeight:700,color:g.authorUsername?"#0F6B73":"#263238"},"aria-label":w?`Author: ${D}`:`نویسنده: ${D}`,children:[D,j.verifiedExpert&&e.jsx("span",{style:{marginInlineStart:6,fontSize:11,color:"#0F6B73",background:"#0F6B7314",border:"1px solid #0F6B7330",borderRadius:999,padding:"1px 6px"},children:w?"Verified":"تاییدشده"})]}),e.jsx("div",{style:{fontSize:12,color:"#5F6B6D"},children:L})]})]}),e.jsxs("div",{className:"article-meta-line",style:{fontSize:13,color:"#5F6B6D",display:"flex",gap:12,minWidth:0,flex:"1 1 auto"},children:[e.jsx("time",{dateTime:g.dateEn,children:z}),e.jsx("span",{children:"·"}),e.jsx("span",{style:{color:"#C46A4D",fontWeight:600,fontSize:11},children:B}),e.jsx("span",{children:"·"}),e.jsx("span",{children:w?`${g.readTime} min read`:`${g.readTime} دقیقه مطالعه`}),e.jsx("span",{children:"·"}),e.jsx("span",{children:w?`${He(y,!0)} comments`:`${He(y)} نظر`})]})]}),e.jsxs("div",{className:"article-action-row",style:{display:"flex",gap:10,marginTop:16},children:[e.jsx("button",{onClick:F,style:{...W,background:r?"#0F6B7318":"#F4EFE6",color:r?"#0F6B73":"#263238",border:r?"1px solid #0F6B7340":"1px solid #E4DDD2",padding:"6px 14px"},children:r?w?"Saved":"✓ ذخیره‌شده":w?"Save":"⊕ ذخیره"}),e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",borderInlineStart:"1px solid #E4DDD2",paddingInlineStart:10},children:[e.jsx("button",{onClick:()=>T("telegram"),title:"Telegram",style:{background:"transparent",border:"none",cursor:"pointer",padding:6,display:"flex",color:"#0088cc"},"aria-label":w?"Share on Telegram":"اشتراک در تلگرام",children:e.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.14.18-.357.223-.548.223l.188-2.85 5.18-4.686c.223-.198-.054-.31-.346-.11l-6.4 4.02-2.76-.86c-.6-.188-.61-.6.126-.894l10.78-4.148c.5-.188.94.116.808.843z"})})}),e.jsx("button",{onClick:()=>T("whatsapp"),title:"WhatsApp",style:{background:"transparent",border:"none",cursor:"pointer",padding:6,display:"flex",color:"#25D366"},"aria-label":w?"Share on WhatsApp":"اشتراک در واتساپ",children:e.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12.031 0C5.412 0 0 5.414 0 12.035c0 2.124.553 4.195 1.603 6.01L.063 23.575l5.666-1.486c1.765.952 3.738 1.455 5.765 1.455 6.617 0 12.03-5.412 12.03-12.034S18.647 0 12.031 0zm0 21.601c-1.782 0-3.52-.48-5.04-1.385l-.36-.215-3.75.983.998-3.66-.236-.375C2.69 15.352 2.15 13.722 2.15 12.035 2.15 6.593 6.577 2.15 12.03 2.15s9.88 4.443 9.88 9.885c0 5.44-4.428 9.881-9.88 9.881zm5.417-7.41c-.297-.15-1.762-.871-2.036-.973-.274-.102-.473-.15-.672.15-.202.3-.77 .973-.944 1.173-.175.2-.35.225-.648.075-.297-.15-1.258-.464-2.395-1.405-.885-.733-1.482-1.64-1.657-1.94-.175-.3 0-.462.15-.612.134-.135.297-.35.446-.525.15-.175.2-.3.297-.5.102-.2.05-.375-.025-.525-.075-.15-.672-1.618-.92-2.215-.24-.582-.483-.502-.67-.512-.174-.01-.373-.01-.57-.01s-.52.075-.794.375c-.274.3-1.045 1.025-1.045 2.5 0 1.475 1.07 2.9 1.22 3.1.15.2 2.115 3.226 5.126 4.526 2.053.886 2.85 1.018 3.86 1.045.894.025 2.87-.923 3.27-1.848.397-.925.397-1.722.274-1.895-.125-.175-.472-.275-.77-.425z"})})}),e.jsx("button",{onClick:()=>T("x"),title:"X (Twitter)",style:{background:"transparent",border:"none",cursor:"pointer",padding:6,display:"flex",color:"#14171A"},"aria-label":w?"Share on X":"اشتراک در X",children:e.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}),e.jsx("button",{onClick:()=>T("linkedin"),title:"LinkedIn",style:{background:"transparent",border:"none",cursor:"pointer",padding:6,display:"flex",color:"#0A66C2"},"aria-label":w?"Share on LinkedIn":"اشتراک در لینکدین",children:e.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"})})}),e.jsx("button",{onClick:()=>T("copy"),title:w?"Copy link":"کپی لینک",style:{background:"transparent",border:"none",cursor:"pointer",padding:6,display:"flex",color:"#5F6B6D"},"aria-label":w?"Copy article link":"کپی لینک مقاله",children:e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]})]}),g.series&&e.jsxs("div",{style:{background:"#0F6B7308",border:"1px solid #0F6B7330",borderRadius:10,padding:16,marginBottom:28,display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{background:"#0F6B73",color:"#fff",fontSize:11,padding:"3px 8px",borderRadius:6,fontWeight:700},children:"سری مقاله"}),e.jsx("span",{style:{fontSize:14,fontWeight:700,color:"#263238"},children:g.series.title}),g.series.articles?.length>0&&e.jsxs("span",{style:{fontSize:11,color:"#5F6B6D"},children:["قسمت ",g.series.position," از ",g.series.articles.length]})]}),e.jsx("button",{onClick:()=>n("/series/"+g.series.slug),style:{background:"transparent",border:"none",color:"#0F6B73",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"مشاهده همه قسمت‌ها ←"})]}),ne,(g.correctionNotice||g.corrections?.length>0)&&e.jsxs("section",{style:{background:"#FFF8EA",border:"1px solid #D49A2A55",borderRadius:12,padding:18,marginBottom:28,direction:"rtl"},children:[e.jsx("div",{style:{fontSize:14,fontWeight:900,color:"#263238",marginBottom:8},children:"اصلاحیه و به‌روزرسانی"}),g.correctionNotice&&e.jsx("p",{style:{margin:"0 0 10px",color:"#5F6B6D",lineHeight:1.9},children:g.correctionNotice}),g.corrections?.length>0&&e.jsx("ul",{style:{margin:0,paddingRight:18,color:"#5F6B6D",lineHeight:1.9,fontSize:13},children:g.corrections.map(E=>e.jsxs("li",{children:[E.date||new Date(E.createdAt).toLocaleDateString("fa-IR"),": ",E.note]},E.id))})]}),!w&&e.jsxs("div",{className:"article-hero-diagram",style:{background:"#F4EFE6",borderRadius:12,padding:24,marginBottom:32,overflow:"hidden",maxWidth:"100%",overflowX:"auto"},children:[e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginBottom:8,fontWeight:600},children:"نمودار تعاملی — با موس روی عناصر بروید"}),e.jsx(we,{type:g.diagram})]}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx("div",{className:"article-content",ref:s,style:{...yr,...g.premiumLocked?{maskImage:"linear-gradient(to bottom, black 40%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 40%, transparent 100%)",maxHeight:320,overflow:"hidden"}:{},maxWidth:"100%",overflowX:"hidden",wordWrap:"break-word",overflowWrap:"break-word"},dangerouslySetInnerHTML:{__html:v}}),!g.premiumLocked&&!w&&e.jsx(rr,{containerRef:s,article:g})]}),g.premiumLocked&&e.jsx(fr,{navigate:n,user:i}),e.jsx(gr,{slug:g.slug}),e.jsxs("div",{style:{borderTop:"1px solid #E4DDD2",marginTop:40,paddingTop:24,direction:Z,textAlign:w?"left":"right"},children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#263238",marginBottom:16},children:w?"Was this article useful?":"واکنش شما به این مقاله؟"}),e.jsx("div",{className:"article-reaction-row",style:{display:"flex",gap:10,flexWrap:"wrap"},children:(w?[["helpful","Helpful",It],["star","Excellent",xt],["heart","Valuable","♡"],["fire","Important","●"],["thinking","Thought-provoking","?"]]:[["helpful","مفید",It],["star","عالی",xt],["heart","عاشقانه",or],["fire","داغ",ki],["thinking","تأمل‌برانگیز",ar]]).map(([E,$,Q])=>e.jsxs("button",{onClick:()=>X(E),style:{...W,background:x[E]?"#0F6B7318":"#F4EFE6",color:x[E]?"#0F6B73":"#263238",border:`1px solid ${x[E]?"#0F6B7340":"#E4DDD2"}`,fontSize:13,padding:"8px 14px"},children:[Ue(Q)," ",$]},E))})]}),g.series?.articles?.length>1&&e.jsx(xr,{series:g.series,currentSlug:g.slug}),g.tags?.length>0&&e.jsxs("div",{style:{marginTop:24,direction:Z,display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("span",{style:{fontSize:12,color:"#5F6B6D"},children:w?"Keywords:":"برچسب‌ها:"}),g.tags.map(E=>e.jsx("button",{onClick:()=>n(`/tag/${encodeURIComponent(E)}`),style:{background:"#F4EFE6",border:"1px solid #E4DDD2",padding:"3px 10px",borderRadius:4,fontSize:12,color:"#5F6B6D",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:E},E))]}),e.jsx(hr,{article:g,onTotal:m,english:w}),e.jsx(ur,{slug:g.slug,english:w}),j&&e.jsxs("div",{className:"article-author-box",style:{background:"#F4EFE6",borderRadius:12,padding:24,marginTop:32,direction:Z,textAlign:w?"left":"right",display:"flex",gap:16},children:[e.jsx(je,{author:j,size:64}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginBottom:4},children:w?"AUTHOR":"نویسنده"}),e.jsxs("button",{onClick:()=>g.authorUsername&&n("/profile/@"+g.authorUsername),style:{background:"none",border:"none",padding:0,cursor:g.authorUsername?"pointer":"default",fontFamily:w?"Inter, Arial, sans-serif":"Vazirmatn,sans-serif",fontSize:16,fontWeight:700,color:g.authorUsername?"#0F6B73":"#263238",marginBottom:6},children:[D,j.verifiedExpert&&e.jsx("span",{style:{marginInlineStart:6,fontSize:11,color:"#0F6B73",background:"#fff",border:"1px solid #0F6B7330",borderRadius:999,padding:"1px 6px"},children:w?"Verified":"تاییدشده"})]}),e.jsx("div",{style:{fontSize:12,color:"#0F6B73",fontWeight:600,marginBottom:6,fontFamily:w?"Inter, Arial, sans-serif":"Vazirmatn,sans-serif"},children:L}),e.jsx("div",{style:{fontSize:13,color:"#5F6B6D",lineHeight:1.7,fontFamily:w?"Inter, Arial, sans-serif":"Vazirmatn,sans-serif"},children:P}),e.jsx("div",{className:"article-social-row",style:{marginTop:10,display:"flex",gap:8},children:Object.entries(j.social||{}).map(([E,$])=>e.jsx("a",{href:$&&$!=="#"?$:void 0,target:$&&$!=="#"?"_blank":void 0,rel:"noopener noreferrer",style:{...W,background:"#fff",color:"#0F6B73",border:"1px solid #0F6B7330",fontSize:12,padding:"4px 12px",textDecoration:"none",fontFamily:w?"Inter, Arial, sans-serif":"Vazirmatn,sans-serif",cursor:"pointer"},children:E},E))})]})]}),!w&&h.length>0&&e.jsxs("div",{className:"article-related",style:{marginTop:48,direction:"rtl"},children:[e.jsx("h3",{style:{fontSize:18,fontWeight:700,color:"#263238",marginBottom:20},children:"مقاله‌های مرتبط"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(220px,1fr))",gap:16},children:h.map(E=>e.jsx(Pe,{article:E},E.id))})]}),!w&&(()=>{const E=(M.comparisons??[]).filter($=>($.relatedArticles||[]).includes(g.slug)||(g.tags||[]).some(Q=>[$.item1.slug,$.item2.slug,...$.tags||[]].some(ee=>ee.toLowerCase()===Q.toLowerCase()))).slice(0,3);return E.length?e.jsxs("div",{style:{marginTop:40,direction:"rtl"},children:[e.jsx("h3",{style:{fontSize:16,fontWeight:700,color:"#263238",marginBottom:14},children:"مقایسه‌های مرتبط"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:E.map($=>e.jsxs("div",{onClick:()=>n(`/compare/${$.slug}`),style:{background:"#F8F5F0",border:"1px solid #E4DDD2",borderRadius:8,padding:"12px 16px",cursor:"pointer",display:"flex",alignItems:"center",gap:12},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#0C1E22",marginBottom:4},children:$.title}),e.jsxs("div",{style:{display:"flex",gap:8,fontSize:12},children:[e.jsx("span",{style:{background:"#E8F5E9",color:"#2E7D32",padding:"1px 8px",borderRadius:20,fontWeight:600},children:$.item1.name}),e.jsx("span",{style:{color:"#5F6B6D"},children:"در برابر"}),e.jsx("span",{style:{background:"#FFF3E0",color:"#E65100",padding:"1px 8px",borderRadius:20,fontWeight:600},children:$.item2.name})]})]}),e.jsx("span",{style:{color:"#0F6B73",fontSize:18},children:"←"})]},$.slug))})]}):null})()]})]}),e.jsx("style",{children:`
.article-layout { grid-template-columns: 200px 1fr; }
.toc-sidebar { display: block; }
.tekrag-article-page { scroll-behavior: smooth; }
.tekrag-article-page .toc-sidebar { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; scrollbar-width: thin; }
.tekrag-article-page .article-main { width: 100%; }
.tekrag-article-page .article-content { direction: ltr !important; text-align: left !important; }
.tekrag-article-page .article-content h2,
.tekrag-article-page .article-content h3,
.tekrag-article-page .article-content p,
.tekrag-article-page .article-content li,
.tekrag-article-page .article-content td,
.tekrag-article-page .article-content th { direction: ltr !important; text-align: left !important; }
.tekrag-article-page .article-content ul,
.tekrag-article-page .article-content ol { padding-left: 24px !important; padding-right: 0 !important; }
.tekrag-article-page .article-content ul li,
.tekrag-article-page .article-content ol li { padding-left: 28px !important; padding-right: 0 !important; }
.tekrag-article-page .article-content ul li::before { left: 4px !important; right: auto !important; }
.tekrag-article-page .article-content ol li::before { left: 0 !important; right: auto !important; }
.tekrag-article-page .article-content blockquote { border-left: 4px solid #D49A2A !important; border-right: 0 !important; border-radius: 8px 0 0 8px !important; }
.tekrag-article-page .tekrag-diagram-section { display: grid; gap: 28px; margin: 46px auto 0; width: min(100%, 860px); justify-items: center; }
.tekrag-article-page .tekrag-diagram-card { width: min(100%, 820px); margin-inline: auto; padding: 24px; border-radius: 10px; }
.tekrag-article-page .tekrag-3d-canvas { min-height: clamp(280px, 44vw, 420px) !important; touch-action: pan-y; }
.tekrag-article-page .tekrag-3d-overlay { justify-content: center !important; text-align: center; }
.tekrag-article-page .tekrag-3d-overlay > div { justify-content: center; }
.tekrag-article-page .article-action-row,
.tekrag-article-page .article-reaction-row { justify-content: flex-start; }
@media (max-width: 900px) {
.article-layout { grid-template-columns: 1fr !important; }
.toc-sidebar { display: none !important; }
.tekrag-article-page .article-layout { padding: 28px 16px 48px !important; }
.tekrag-article-page .article-main { max-width: 100% !important; }
.tekrag-article-page .tekrag-diagram-section { gap: 22px; margin-top: 34px; }
.tekrag-article-page .tekrag-diagram-card { padding: 16px; }
.tekrag-article-page .tekrag-3d-canvas { min-height: 300px !important; }
}
@media (max-width: 560px) {
.tekrag-article-page .article-breadcrumb { padding-inline: 16px !important; }
.tekrag-article-page .article-byline-row,
.tekrag-article-page .article-meta-line,
.tekrag-article-page .article-action-row { align-items: flex-start !important; }
.tekrag-article-page .article-meta-line { gap: 8px !important; flex-wrap: wrap; }
.tekrag-article-page .article-author-box { flex-direction: column; }
.tekrag-article-page .tekrag-3d-canvas { min-height: 330px !important; }
}
`}),p&&e.jsx(ri,{articleId:g.id,onDone:()=>l(!1)})]})}const yr={fontSize:16,lineHeight:2,color:"#263238",direction:"rtl",fontFamily:"Vazirmatn,sans-serif"},br=`
article h2 { font-size: 22px; font-weight: 800; color: #263238; margin: 40px 0 16px; padding-bottom: 8px; border-bottom: 2px solid #E4DDD2; font-family: Vazirmatn,sans-serif; }
article h3 { font-size: 18px; font-weight: 700; color: #263238; margin: 32px 0 12px; font-family: Vazirmatn,sans-serif; }
article p { margin: 0 0 20px; }
article .lead { font-size: 18px; line-height: 2.05; color: #1A3035; font-weight: 500; background: #FFFFFF; border: 1px solid #E4DDD2; border-right: 4px solid #0F6B73; border-radius: 12px; padding: 20px 22px; margin: 0 0 30px; }
article blockquote { border-right: 4px solid #D49A2A; margin: 28px 0; padding: 16px 20px; background: #D49A2A0A; border-radius: 0 8px 8px 0; font-size: 16px; color: #263238; font-style: normal; }
article blockquote.security-quote { border-right-color: #C94C4D; background: #C94C4D08; }
article strong { color: #263238; font-weight: 700; }
article em { color: #0F6B73; font-style: normal; font-weight: 600; }
article pre { background: #131F22; border-radius: 10px; padding: 40px 18px 18px; margin: 24px 0; overflow-x: auto; position: relative; border: 1px solid #1E3035; direction: ltr; }
article pre::before { content: attr(data-lang); position: absolute; top: 10px; right: 14px; font-size: 10px; color: #4A7A82; font-family: monospace; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
article pre code { background: none !important; border: none !important; padding: 0 !important; color: #A8D8DC; font-family: 'Courier New', Consolas, monospace; font-size: 13.5px; line-height: 1.85; display: block; direction: ltr; text-align: left; white-space: pre; }
article code:not(pre code) { background: #0F6B7316; border: 1px solid #0F6B7328; border-radius: 4px; padding: 1px 6px; font-family: 'Courier New', Consolas, monospace; font-size: 13px; color: #0A5060; direction: ltr; unicode-bidi: isolate; display: inline; white-space: nowrap; }
.code-copy-btn { position: absolute; top: 8px; left: 10px; background: #1E3035; border: 1px solid #2A4048; color: #6AACB5; border-radius: 6px; padding: 4px 10px; font-size: 11px; cursor: pointer; font-family: Vazirmatn, sans-serif; z-index: 1; transition: all 0.15s; line-height: 1.4; }
.code-copy-btn:hover { background: #2A4048; color: #A8D8DC; }
article ul { padding-right: 0; list-style: none; margin: 16px 0 24px; display: grid; gap: 6px; }
article ul li { position: relative; padding-right: 22px; color: #263238; line-height: 1.9; }
article ul li::before { content: '›'; position: absolute; right: 4px; color: #0F6B73; font-weight: 900; font-size: 17px; line-height: 1.6; }
article ol { padding-right: 0; counter-reset: art-counter; list-style: none; margin: 16px 0 24px; display: grid; gap: 8px; }
article ol li { counter-increment: art-counter; position: relative; padding-right: 38px; color: #263238; line-height: 1.9; padding-top: 2px; }
article ol li::before { content: counter(art-counter); position: absolute; right: 0; top: 2px; width: 24px; height: 24px; background: #0F6B73; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
article ul li code, article ol li code { font-size: 12px; }
article ul li strong, article ol li strong { color: #0A5060; }
article .ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; font-family: Inter, Arial, sans-serif; letter-spacing: 0; }
article .metric-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 12px; margin: 28px 0; }
article .metric-card { background: #fff; border: 1px solid #E4DDD2; border-top: 3px solid #0F6B73; border-radius: 10px; padding: 14px 16px; }
article .metric-value { color: #0F6B73; font-weight: 900; font-size: 22px; line-height: 1.2; }
article .metric-label { color: #5F6B6D; font-size: 12px; line-height: 1.7; margin-top: 6px; }
article table { width: 100%; border-collapse: collapse; margin: 24px 0; background: #fff; border: 1px solid #E4DDD2; border-radius: 10px; overflow: hidden; display: block; max-width: 100%; overflow-x: auto; }
article th, article td { border-bottom: 1px solid #E4DDD2; padding: 12px 14px; text-align: right; vertical-align: top; min-width: 130px; }
article th { background: #F4EFE6; color: #263238; font-weight: 800; }
article tr:last-child td { border-bottom: 0; }
article .comparison-template { background: #fffaf1; border: 1px solid #E4DDD2; border-radius: 12px; padding: 18px; margin: 24px 0; }
article .risk-box { background: #C46A4D10; border: 1px solid #C46A4D35; border-radius: 12px; padding: 18px 22px; margin: 28px 0; }
article .agent-steps { counter-reset: agentStep; display: grid; gap: 10px; margin: 24px 0; }
article .agent-step { counter-increment: agentStep; background: #fff; border: 1px solid #E4DDD2; border-radius: 10px; padding: 14px 48px 14px 16px; position: relative; }
article .agent-step::before { content: counter(agentStep); position: absolute; top: 14px; right: 14px; width: 24px; height: 24px; border-radius: 50%; background: #0F6B73; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.article-diagram-card { background: linear-gradient(135deg,#F4EFE6 0%,#FFFFFF 100%); border: 1px solid #E4DDD2; border-radius: 12px; padding: 22px; overflow: hidden; box-shadow: 0 12px 34px rgba(15,42,46,0.06); }
.tekrag-diagram-card { background: #FAFAFA; border: 1px solid #E8E8E8; border-radius: 8px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.insight-box { background: #0F6B7310; border: 1px solid #0F6B7330; border-radius: 10px; padding: 20px 24px; margin: 28px 0; }
.insight-box .insight-title { font-size: 13px; font-weight: 700; color: #0F6B73; margin-bottom: 8px; }
.insight-box p { margin: 0; font-size: 14px; line-height: 1.8; }
.footnote-box { background: #F4EFE6; border-radius: 8px; padding: 16px 20px; margin-top: 32px; font-size: 12px; color: #5F6B6D; line-height: 1.7; }
.cve-summary-card { background: linear-gradient(135deg, #EEF6F7 0%, #E8F3F4 100%); border: 1px solid rgba(15,107,115,0.18); border-radius: 12px; padding: 20px 24px; margin: 0 0 32px; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; direction: rtl; }
.cve-summary-card .cve-item { display: flex; flex-direction: column; gap: 5px; border-left: 1px solid rgba(15,107,115,0.15); padding-left: 16px; }
.cve-summary-card .cve-item:last-child { border-left: none; padding-left: 0; }
.cve-summary-card .cve-label { font-size: 10px; color: #0F6B73; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.cve-summary-card .cve-value { font-size: 14px; font-weight: 800; color: #1A3035; }
.cve-summary-card .cve-score { font-size: 28px; font-weight: 900; color: #C0392B; line-height: 1; }
.cve-summary-card .cve-critical { color: #C0392B; }
.cve-summary-card .cve-patched { color: #1A7A50; font-size: 13px; }
.security-alert { background: #C94C4D0A; border: 1px solid #C94C4D30; border-right: 4px solid #C94C4D; border-radius: 0 10px 10px 0; padding: 16px 20px; margin: 28px 0; }
.security-alert .alert-title { font-size: 13px; font-weight: 800; color: #C94C4D; margin-bottom: 6px; }
.security-alert p, .security-alert li { font-size: 14px; line-height: 1.8; color: #3A1A1A; margin: 0; }
@media (max-width: 640px) {
article pre {
padding: 32px 12px 12px !important;
margin: 20px 0 !important;
font-size: 12px !important;
max-width: calc(100vw - 32px) !important;
}
article code:not(pre code) {
font-size: 11px !important;
padding: 1px 4px !important;
word-break: break-all !important;
}
.cve-summary-card {
grid-template-columns: 1fr !important;
padding: 16px !important;
gap: 12px !important;
}
.cve-summary-card .cve-item {
border-left: none !important;
border-bottom: 1px solid rgba(15,107,115,0.15) !important;
padding-left: 0 !important;
padding-bottom: 12px !important;
}
.cve-summary-card .cve-item:last-child {
border-bottom: none !important;
padding-bottom: 0 !important;
}
article table { font-size: 13px !important; }
article table td, article table th { padding: 6px 8px !important; min-width: 80px !important; }
article .metric-grid { grid-template-columns: 1fr !important; }
article .lead { font-size: 16px !important; padding: 16px !important; }
}
`,Di=document.createElement("style");Di.textContent=br;document.head.appendChild(Di);function Ci(t){const n=t.username||M.authors.find(i=>i.slug===t.slug)?.username;return n?`/profile/@${n}`:`/author/${t.slug}`}function $t({initQ:t=""}){const[n,i]=c.useState(t),[o,s]=c.useState(t),[a,r]=c.useState({category:"",author:"",type:"",tag:"",dateRange:""}),[d,p]=c.useState([]),[l,x]=c.useState(!1),{navigate:u}=q(),g=c.useCallback(()=>{x(!0);const f={q:n,category:a.category,author:a.author,type:a.type,tag:a.tag,limit:50};(n?U.search(f):U.listArticles(f)).then(m=>p(m.items??[])).finally(()=>x(!1))},[n,a]);c.useEffect(()=>{g()},[g]);const b=f=>{f.preventDefault(),i(o)},h=(f,y)=>y?f.split(new RegExp(`(${y})`,"gi")).map((v,j)=>v.toLowerCase()===y.toLowerCase()?`<mark style="background:#D49A2A30;color:#263238;border-radius:2px;padding:0 2px">${v}</mark>`:v).join(""):f;return e.jsxs("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:[e.jsxs("div",{style:{maxWidth:1e3,margin:"0 auto",padding:"40px 24px"},children:[e.jsx("h1",{style:{fontSize:28,fontWeight:900,color:"#263238",margin:"0 0 8px"},children:"جستجوی پیشرفته"}),e.jsxs("form",{onSubmit:b,style:{display:"flex",gap:10,marginBottom:32},children:[e.jsx("input",{value:o,onChange:f=>s(f.target.value),placeholder:"جستجو در مقاله‌ها...",style:{flex:1,...O,fontSize:16},dir:"rtl",autoFocus:!0}),e.jsx("button",{type:"submit",style:{...W,background:"#0F6B73",color:"#fff",padding:"12px 32px"},children:"جستجو"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"240px 1fr",gap:32},className:"search-layout",children:[e.jsxs("aside",{style:{display:"flex",flexDirection:"column",gap:24},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,marginBottom:12,color:"#263238"},children:"دسته‌بندی"}),e.jsxs("select",{value:a.category,onChange:f=>r(y=>({...y,category:f.target.value})),style:O,children:[e.jsx("option",{value:"",children:"همه دسته‌ها"}),M.categories.map(f=>e.jsx("option",{value:f.slug,children:f.name},f.id))]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,marginBottom:12,color:"#263238"},children:"نویسنده"}),e.jsxs("select",{value:a.author,onChange:f=>r(y=>({...y,author:f.target.value})),style:O,children:[e.jsx("option",{value:"",children:"همه نویسندگان"}),M.authors.map(f=>e.jsx("option",{value:f.slug,children:f.name},f.id))]})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,marginBottom:12,color:"#263238"},children:"نوع محتوا"}),e.jsxs("select",{value:a.type,onChange:f=>r(y=>({...y,type:f.target.value})),style:O,children:[e.jsx("option",{value:"",children:"همه انواع"}),["تحلیل عمیق","راهنمای فنی","داده‌نما","خبر فوری"].map(f=>e.jsx("option",{value:f,children:f},f))]})]}),e.jsx("button",{onClick:()=>r({category:"",author:"",type:"",tag:"",dateRange:""}),style:{...W,background:"#F4EFE6",color:"#C94C4C",justifyContent:"center"},children:"پاک کردن فیلترها"})]}),e.jsx("section",{children:l?e.jsx(ni,{lines:5}):e.jsx(e.Fragment,{children:d.length===0?e.jsx(J,{title:"نتیجه‌ای یافت نشد"}):e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:13,color:"#5F6B6D",marginBottom:20},children:[d.length.toLocaleString("fa-IR")," نتیجه پیدا شد"]}),d.map((f,y)=>e.jsx(jr,{article:f,q:n,highlight:h,idx:y},f.id))]})})})]})]}),e.jsx("style",{children:".search-layout { grid-template-columns: 240px 1fr; } @media(max-width:768px){ .search-layout { grid-template-columns: 1fr !important; } }"})]})}function jr({article:t,q:n,highlight:i,idx:o}){const{navigate:s}=q();return e.jsxs("div",{onClick:()=>s("/article/"+t.slug),style:{padding:"24px 0",borderBottom:"1px solid #E4DDD2",cursor:"pointer",opacity:0,animation:`fadeIn 0.3s ${o*40}ms forwards`},children:[e.jsxs("div",{style:{display:"flex",gap:8,marginBottom:10},children:[e.jsx(De,{name:t.categoryName,color:t.categoryColor,small:!0}),e.jsxs("span",{style:{fontSize:11,color:"#5F6B6D"},children:[t.date," · ",t.readTime," دقیقه"]})]}),e.jsx("h3",{style:{fontSize:17,fontWeight:800,color:"#263238",margin:"0 0 8px"},dangerouslySetInnerHTML:{__html:i(t.title,n)}}),e.jsx("p",{style:{fontSize:14,color:"#5F6B6D",lineHeight:1.7,margin:0},dangerouslySetInnerHTML:{__html:i(t.summary.slice(0,180)+"…",n)}})]})}function vr({slug:t}){const{navigate:n}=q(),[i,o]=c.useState(()=>M.categories.find(r=>r.slug===t)),[s,a]=c.useState(()=>U.fallbackArticles().filter(r=>r.category===t));return c.useEffect(()=>{let r=!1;return o(M.categories.find(d=>d.slug===t)),a(U.fallbackArticles().filter(d=>d.category===t)),Promise.all([U.getCategory(t).catch(()=>null),U.listArticles({category:t,limit:100}).catch(()=>null)]).then(([d,p])=>{r||(d&&o({...M.categories.find(l=>l.slug===t)??{},...d,id:d.slug}),p?.items&&a(p.items))}),()=>{r=!0}},[t]),i?e.jsxs("div",{style:{paddingTop:64,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif"},children:[(()=>{const d={ai:"/images/category-hero-ai-v2.jpg",startup:"/images/category-hero-startup.jpg",hardware:"/images/category-hero-hardware.jpg",security:"/images/category-hero-security.jpg",software:"/images/category-hero-software.jpg",future:"/images/category-hero-future.jpg",data:"/images/category-hero-data.jpg"}[i.slug];return e.jsxs("div",{style:{position:"relative",borderBottom:"1px solid #E4DDD2",direction:"rtl",overflow:"hidden",minHeight:340},children:[d?e.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:`url(${d})`,backgroundSize:"cover",backgroundPosition:"center"},"aria-hidden":"true"}):e.jsx("div",{style:{position:"absolute",inset:0,background:`linear-gradient(135deg, ${i.color}12 0%, #F4EFE6 100%)`},"aria-hidden":"true"}),e.jsxs("div",{style:{position:"relative",zIndex:1,maxWidth:1280,margin:"0 auto",display:"grid",gridTemplateColumns:"1fr 420px",gap:32,alignItems:"stretch",padding:"64px 32px"},className:"cat-hero-grid",children:[e.jsxs("div",{style:{background:"#FFFFFF",border:"1px solid #E4DDD2",borderRight:`5px solid ${i.color}`,borderRadius:"0 20px 20px 0",padding:"44px 48px 40px",boxShadow:"0 6px 40px rgba(15,42,46,0.10)"},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,background:i.color+"12",border:`1px solid ${i.color}30`,color:i.color,padding:"5px 16px",borderRadius:999,fontSize:12,fontWeight:700,marginBottom:22,letterSpacing:"0.06em"},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:i.color,display:"inline-block"}}),"دسته‌بندی"]}),e.jsx("h1",{style:{fontSize:"clamp(32px,5vw,52px)",fontWeight:900,color:"#263238",margin:"0 0 14px",fontFamily:"'PelakFA','Vazirmatn',sans-serif",lineHeight:1.2},children:i.name}),e.jsx("p",{style:{fontSize:16,color:"#5F6B6D",lineHeight:2,margin:"0 0 30px",maxWidth:560},children:i.description}),e.jsx("div",{style:{display:"flex",gap:0,borderTop:"1px solid #E4DDD2",paddingTop:24},children:[["تعداد مقاله",i.articleCount],["نویسنده فعال",i.authorCount],["میانگین زمان مطالعه",`${i.avgReadTime} دقیقه`]].map(([p,l],x)=>e.jsxs("div",{style:{flex:"1 1 100px",textAlign:"center",padding:"0 20px",borderRight:x>0?"1px solid #E4DDD2":"none"},children:[e.jsx("div",{style:{fontSize:"clamp(22px,3vw,30px)",fontWeight:900,color:i.color,fontFamily:"'PelakFA','Vazirmatn',sans-serif",lineHeight:1},children:l}),e.jsx("div",{style:{fontSize:12,color:"#9AA5A6",marginTop:6},children:p})]},p))})]}),e.jsx("div",{style:{background:"#FFFFFF",border:"1px solid #E4DDD2",borderRadius:20,padding:"28px",boxShadow:"0 6px 32px rgba(15,42,46,0.08)",display:"flex",alignItems:"center",justifyContent:"center"},className:"cat-hero-diagram",children:e.jsx(Oe,{type:i.diagram})})]})]})})(),e.jsxs("div",{style:{maxWidth:1280,margin:"0 auto",padding:"40px 24px",direction:"rtl"},children:[e.jsxs("h2",{style:{fontSize:20,fontWeight:700,color:"#263238",margin:"0 0 24px"},children:["مقاله‌های ",i.name," (",s.length,")"]}),s.length===0?e.jsx(J,{title:"مقاله‌ای در این دسته وجود ندارد"}):s.map((r,d)=>e.jsx(Fe,{article:r,idx:d},r.id))]}),e.jsx("style",{children:`
.cat-hero-grid { grid-template-columns: 1fr 420px; }
@media(max-width: 1024px) {
.cat-hero-grid { grid-template-columns: 1fr 340px !important; padding: 48px 24px !important; }
}
@media(max-width: 860px) {
.cat-hero-grid { grid-template-columns: 1fr !important; gap: 20px !important; padding: 36px 20px !important; }
.cat-hero-diagram { display: none !important; }
}
@media(max-width: 560px) {
.cat-hero-grid { padding: 28px 14px !important; }
.cat-hero-grid > div:first-child { padding: 28px 22px !important; border-radius: 14px !important; }
}
`})]}):e.jsx(J,{title:"دسته‌بندی یافت نشد"})}function wr({tag:t}){const n=decodeURIComponent(t),[i,o]=c.useState(()=>U.fallbackArticles().filter(s=>s.tags?.includes(n)));return c.useEffect(()=>{let s=!1;return o(U.fallbackArticles().filter(a=>a.tags?.includes(n))),U.listArticles({tag:n,limit:100}).then(a=>{s||o(a.items??[])}).catch(()=>{}),()=>{s=!0}},[n]),e.jsx("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsxs("div",{style:{maxWidth:960,margin:"0 auto",padding:"40px 24px"},children:[e.jsxs("h1",{style:{fontSize:30,fontWeight:900,color:"#263238",margin:"0 0 10px"},children:["برچسب ",n]}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.9,margin:"0 0 28px"},children:"همه مقاله‌هایی که با این برچسب منتشر شده‌اند."}),i.length===0?e.jsx(J,{title:"مقاله‌ای برای این برچسب پیدا نشد"}):i.map((s,a)=>e.jsx(Fe,{article:s,idx:a},s.id))]})})}function kr({slug:t}){const{navigate:n}=q(),i=M.glossary?.find(r=>r.slug===t),o=U.fallbackArticles().filter(r=>r.tags?.some(d=>d.toLowerCase()===i?.term?.toLowerCase()||d.toLowerCase()===i?.english?.toLowerCase())||r.summary?.toLowerCase().includes(i?.english?.toLowerCase()||"")||r.title?.toLowerCase().includes(i?.english?.toLowerCase()||"")).slice(0,6);if(!i)return e.jsx(J,{title:"واژه پیدا نشد"});const s=(i.related??[]).map(r=>M.glossary?.find(d=>d.slug===r)).filter(Boolean),a=M.topicHubs?.find(r=>r.slug===i.topic);return e.jsxs("main",{style:{paddingTop:76,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:[e.jsx("section",{style:{borderBottom:"1px solid #E4DDD2",background:"linear-gradient(135deg,#FFFFFF 0%,#F4EFE6 100%)",padding:"44px 24px"},children:e.jsxs("div",{style:{maxWidth:1040,margin:"0 auto"},children:[e.jsx("button",{onClick:()=>n("/articles"),style:{...W,background:"#F4EFE6",color:"#0F6B73",border:"1px solid #E4DDD2",marginBottom:18},children:"بازگشت به مقاله‌ها"}),e.jsx("div",{style:{color:"#0F6B73",fontSize:12,fontWeight:900,marginBottom:8},children:"فرهنگ واژگان تکنّاو"}),e.jsx("h1",{style:{fontSize:"clamp(30px,5vw,48px)",color:"#263238",margin:"0 0 6px",fontWeight:900},children:i.term}),e.jsx("div",{style:{color:"#5F6B6D",fontSize:18,direction:"ltr",textAlign:"right",marginBottom:18},children:i.english}),e.jsx("p",{style:{maxWidth:720,color:"#263238",lineHeight:2,fontSize:17,margin:0},children:i.summary})]})}),e.jsxs("section",{style:{maxWidth:1040,margin:"0 auto",padding:"32px 24px",display:"grid",gridTemplateColumns:"1.1fr 0.9fr",gap:24},className:"glossary-grid",children:[e.jsxs("div",{style:{display:"grid",gap:18},children:[e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:8,padding:20},children:[e.jsx("h2",{style:{margin:"0 0 14px",color:"#263238",fontSize:20},children:"پرسش‌های رایج"}),(i.faqs??[]).map(([r,d])=>e.jsxs("div",{style:{borderTop:"1px solid #E4DDD2",padding:"14px 0"},children:[e.jsx("strong",{style:{color:"#0F6B73"},children:r}),e.jsx("p",{style:{margin:"8px 0 0",color:"#5F6B6D",lineHeight:1.9},children:d})]},r))]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:8,padding:20},children:[e.jsx("h2",{style:{margin:"0 0 14px",color:"#263238",fontSize:20},children:"مقاله‌های مرتبط"}),o.length===0?e.jsx(J,{title:"هنوز مقاله مرتبطی پیدا نشد"}):o.map((r,d)=>e.jsx(Fe,{article:r,idx:d},r.id))]})]}),e.jsxs("aside",{style:{display:"grid",gap:14,alignContent:"start"},children:[a&&e.jsxs("button",{onClick:()=>n(`/topics/${a.slug}`),style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:8,padding:18,textAlign:"right",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("div",{style:{fontSize:12,color:"#5F6B6D"},children:"خوشه موضوعی"}),e.jsx("div",{style:{fontSize:18,color:"#0F6B73",fontWeight:900},children:a.title})]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:8,padding:18},children:[e.jsx("h3",{style:{margin:"0 0 12px",color:"#263238",fontSize:16},children:"واژه‌های مرتبط"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:s.map(r=>e.jsx("button",{onClick:()=>n(`/glossary/${r.slug}`),style:{...W,background:"#F4EFE6",color:"#0F6B73",border:"1px solid #E4DDD2",fontSize:12},children:r.term},r.slug))})]})]})]}),e.jsx("style",{children:"@media(max-width:850px){.glossary-grid{grid-template-columns:1fr!important}}"})]})}function Lt(t){return t?.dateEn||t?.publishedAt||t?.date||""}function Sr(){const{navigate:t}=q(),[n,i]=c.useState(()=>U.fallbackAuthors()),[o,s]=c.useState(()=>U.fallbackArticles());return c.useEffect(()=>{let a=!1;return Promise.all([U.listAuthors().catch(()=>null),U.listArticles({limit:100}).catch(()=>null)]).then(([r,d])=>{a||(r&&i(r),d?.items&&s(d.items))}),()=>{a=!0}},[]),e.jsxs("div",{style:{paddingTop:64,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsxs("div",{style:{position:"relative",borderBottom:"1px solid #E4DDD2",direction:"rtl",overflow:"hidden",minHeight:220},children:[e.jsx("div",{style:{position:"absolute",inset:0,backgroundImage:"url(/images/authors-hero.jpg)",backgroundSize:"cover",backgroundPosition:"center"},"aria-hidden":"true"}),e.jsx("div",{style:{position:"relative",zIndex:1,maxWidth:1100,margin:"0 auto",padding:"52px 32px"},children:e.jsxs("div",{style:{display:"inline-block",background:"#FFFFFF",border:"1px solid #E4DDD2",borderRight:"5px solid #C46A4D",borderRadius:"0 20px 20px 0",padding:"32px 44px 28px",boxShadow:"0 6px 40px rgba(15,42,46,0.10)",maxWidth:560},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,background:"#C46A4D12",border:"1px solid #C46A4D30",color:"#C46A4D",padding:"5px 16px",borderRadius:999,fontSize:12,fontWeight:700,marginBottom:18,letterSpacing:"0.06em"},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"#C46A4D",display:"inline-block"}}),"نویسندگان"]}),e.jsx("h1",{style:{fontSize:"clamp(26px,4vw,40px)",fontWeight:900,color:"#263238",margin:"0 0 10px",fontFamily:"'PelakFA','Vazirmatn',sans-serif",lineHeight:1.2},children:"نویسندگان تکناو"}),e.jsx("p",{style:{fontSize:15,color:"#5F6B6D",margin:0,lineHeight:1.9},children:"متخصصانی که روایت عمیق فناوری را می‌نویسند"})]})})]}),e.jsxs("div",{style:{maxWidth:1100,margin:"0 auto",padding:"0 24px",direction:"rtl"},children:[e.jsx("div",{style:{display:"none"}}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(300px,1fr))",gap:20,padding:"32px 0"},children:n.map(a=>{const r=o.find(d=>d.authorId===a.id||d.authorSlug===a.slug);return e.jsxs("div",{onClick:()=>t(Ci(a)),style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:14,padding:24,cursor:"pointer",direction:"rtl",transition:"all 0.2s"},onMouseEnter:d=>{d.currentTarget.style.transform="translateY(-3px)",d.currentTarget.style.boxShadow="0 10px 32px rgba(0,0,0,0.08)"},onMouseLeave:d=>{d.currentTarget.style.transform="translateY(0)",d.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",gap:16,marginBottom:16},children:[e.jsx(je,{author:a,size:60}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:16,fontWeight:700,color:"#263238",marginBottom:3,display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[a.name,a.verifiedExpert&&e.jsx("span",{style:{fontSize:10,color:"#0F6B73",background:"#0F6B7314",border:"1px solid #0F6B7330",borderRadius:999,padding:"2px 7px"},children:"تاییدشده"})]}),e.jsx("div",{style:{fontSize:12,color:"#5F6B6D",marginBottom:6},children:a.specialty}),e.jsxs("div",{style:{fontSize:12,color:"#0F6B73",fontWeight:600},children:[a.liveArticleCount??a.articleCount," مقاله منتشرشده"]})]})]}),e.jsxs("p",{style:{fontSize:13,color:"#5F6B6D",lineHeight:1.7,margin:"0 0 16px"},children:[a.bio.slice(0,120),"…"]}),r&&e.jsxs("div",{style:{background:"#F4EFE6",borderRadius:8,padding:"10px 14px",fontSize:12,color:"#263238"},children:[e.jsx("span",{style:{color:"#5F6B6D"},children:"آخرین مقاله: "}),r.title.slice(0,50),"…"]})]},a.id)})})]})]})}function Fr({slug:t}){const{navigate:n}=q(),[i,o]=c.useState(null),[s,a]=c.useState(!1);return c.useEffect(()=>{let r=!1;return a(!1),U.getSeries(t).then(d=>{r||o(d)}).catch(()=>{r||a(!0)}),()=>{r=!0}},[t]),s?e.jsx("div",{style:{paddingTop:100,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsx(J,{title:"سری مقاله پیدا نشد",subtitle:"این مجموعه در API وجود ندارد یا هنوز منتشر نشده است."})}):i?e.jsx("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsxs("div",{style:{maxWidth:960,margin:"0 auto",padding:"40px 24px"},children:[e.jsx("button",{onClick:()=>n("/articles"),style:{...W,background:"#F4EFE6",color:"#0F6B73",border:"1px solid #E4DDD2",marginBottom:18},children:"بازگشت به مقاله‌ها"}),e.jsx("h1",{style:{fontSize:30,fontWeight:900,color:"#263238",margin:"0 0 10px"},children:i.title}),i.description&&e.jsx("p",{style:{color:"#5F6B6D",fontSize:15,lineHeight:1.9,margin:"0 0 28px"},children:i.description}),(i.articles??[]).length===0?e.jsx(J,{title:"هنوز مقاله‌ای در این سری نیست"}):e.jsx("div",{style:{display:"grid",gap:14},children:i.articles.map((r,d)=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"44px 1fr",gap:14,alignItems:"start"},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:999,background:"#0F6B73",color:"#fff",display:"grid",placeItems:"center",fontWeight:900},children:(r.position??d+1).toLocaleString("fa-IR")}),e.jsx(Fe,{article:r.article,idx:d})]},r.article.id))})]})}):e.jsx("div",{style:{paddingTop:120,minHeight:"60vh",textAlign:"center",fontFamily:"Vazirmatn,sans-serif",color:"#5F6B6D"},children:"در حال بارگذاری..."})}function Dr({slug:t}){const{navigate:n}=q(),i=te(),{user:o}=ae(),s=M.topicHubs.find(w=>w.slug===t),a=M.categories.find(w=>w.slug===s?.categorySlug),[r,d]=c.useState(()=>U.fallbackArticles().filter(w=>w.category===s?.categorySlug)),[p,l]=c.useState([]),[x,u]=c.useState({following:!1,count:0}),[g,b]=c.useState(!1),[h,f]=c.useState(!1);if(c.useEffect(()=>{if(!s)return;let w=!1;return d(U.fallbackArticles().filter(D=>D.category===s.categorySlug)),Promise.all([U.listArticles({category:s.categorySlug,limit:100}).catch(()=>null),U.listSeries().catch(()=>[]),K.topicFollowers(s.slug).catch(()=>null)]).then(([D,L,P])=>{w||(D?.items&&d(D.items),l((L??[]).filter(V=>(V.articles??[]).some(B=>B.article?.category===s.categorySlug))),P&&u({following:!!P.following,count:P.count??0}))}),"PushManager"in window&&"serviceWorker"in navigator&&Ae.isSubscribed().then(b).catch(()=>{}),()=>{w=!0}},[s?.slug]),!s)return e.jsx("div",{style:{paddingTop:100,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsx(J,{title:"موضوع پیدا نشد",subtitle:"این خوشه محتوایی هنوز در تکناو تعریف نشده است."})});const y=r.filter(w=>w.featured).slice(0,3),m=r.slice().sort((w,D)=>String(Lt(D)).localeCompare(String(Lt(w)))).slice(0,8),v=M.authors.filter(w=>r.some(D=>D.authorId===w.id||D.authorSlug===w.slug)),j=async()=>{if(!o){i("برای دنبال کردن موضوع ابتدا وارد شوید","warning");return}try{const w=x.following?await K.unfollowTopic(s.slug):await K.followTopic(s.slug);u({following:!!w.following,count:w.count??0}),i(w.following?"موضوع دنبال شد":"دنبال کردن موضوع لغو شد")}catch{i("دنبال کردن موضوع انجام نشد","warning")}},I=async()=>{if(!("PushManager"in window)||!("serviceWorker"in navigator)){i("مرورگر شما از اعلان‌های وب پشتیبانی نمی‌کند","warning");return}f(!0);try{if(g)await Ae.unsubscribeGuest(),b(!1),i("اعلان‌های این موضوع غیرفعال شد");else{if((typeof Notification<"u"?await Notification.requestPermission():"denied")!=="granted"){i("اجازه اعلان داده نشد","warning");return}await Ae.subscribeAsGuest([s.slug]),b(!0),i("اعلان‌های مقالات جدید این موضوع فعال شد")}}catch{i("عملیات ناموفق بود","error")}finally{f(!1)}};return e.jsxs("div",{style:{paddingTop:72,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:[e.jsx("section",{style:{borderBottom:"1px solid #E4DDD2",background:`linear-gradient(135deg, ${a?.color??"#0F6B73"}18, #F4EFE6)`,padding:"44px 24px"},children:e.jsxs("div",{style:{maxWidth:1120,margin:"0 auto"},children:[e.jsx("button",{onClick:()=>n("/articles"),style:{...W,background:"#FFFFFFAA",color:"#0F6B73",border:"1px solid #E4DDD2",marginBottom:18},children:"همه مقاله‌ها"}),e.jsx("h1",{style:{fontSize:"clamp(30px,5vw,48px)",color:"#263238",fontWeight:900,margin:"0 0 12px"},children:s.title}),e.jsx("p",{style:{maxWidth:760,color:"#4F5D60",fontSize:16,lineHeight:1.95,margin:0},children:s.intro}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:18,flexWrap:"wrap"},children:[e.jsxs("button",{onClick:j,style:{...W,background:x.following?"#0F6B73":"#fff",color:x.following?"#fff":"#0F6B73",border:"1px solid #0F6B7330"},children:[x.following?"دنبال می‌کنید":"دنبال کردن موضوع"," · ",(x.count??0).toLocaleString("fa-IR")]}),"PushManager"in window&&e.jsx("button",{onClick:I,disabled:h,style:{...W,background:g?"#fff":"#FAF7F0",color:"#0F6B73",border:"1px solid #0F6B7330",opacity:h?.6:1},children:h?"…":g?"اعلان فعال است":"دریافت اعلان مقالات"})]})]})}),e.jsxs("div",{style:{maxWidth:1120,margin:"0 auto",padding:"36px 24px",display:"grid",gap:34},children:[e.jsxs("section",{children:[e.jsx("h2",{style:{color:"#263238",fontSize:22,margin:"0 0 18px"},children:"مقاله‌های شاخص"}),y.length===0?e.jsx(J,{title:"مقاله شاخصی برای این موضوع ثبت نشده است"}):e.jsx("div",{style:{display:"grid",gap:14},children:y.map((w,D)=>e.jsx(Fe,{article:w,idx:D},w.id))})]}),e.jsxs("section",{children:[e.jsx("h2",{style:{color:"#263238",fontSize:22,margin:"0 0 18px"},children:"تازه‌ترین تحلیل‌ها"}),m.length===0?e.jsx(J,{title:"هنوز مقاله‌ای در این موضوع منتشر نشده است"}):m.map((w,D)=>e.jsx(Fe,{article:w,idx:D},w.id))]}),e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(260px,1fr))",gap:18},children:[e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:20},children:[e.jsx("h2",{style:{color:"#263238",fontSize:18,margin:"0 0 14px"},children:"سری‌های مرتبط"}),p.length===0?e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.8,margin:0},children:"سری مقاله مرتبط پس از تایید سردبیر اینجا نمایش داده می‌شود."}):p.map(w=>e.jsx("button",{onClick:()=>n(`/series/${w.slug}`),style:{display:"block",width:"100%",textAlign:"right",background:"#F4EFE6",border:"1px solid #E4DDD2",borderRadius:8,padding:12,marginBottom:10,color:"#263238",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:w.title},w.id))]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:20},children:[e.jsx("h2",{style:{color:"#263238",fontSize:18,margin:"0 0 14px"},children:"نویسندگان مرتبط"}),v.length===0?e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.8,margin:0},children:"نویسنده مرتبطی پیدا نشد."}):v.map(w=>e.jsxs("button",{onClick:()=>n(Ci(w)),style:{display:"flex",alignItems:"center",gap:10,width:"100%",background:"transparent",border:0,padding:"8px 0",color:"#263238",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",textAlign:"right"},children:[e.jsx(je,{author:w,size:36}),e.jsx("span",{children:w.name})]},w.id))]})]}),e.jsxs("section",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:20},children:[e.jsx("h2",{style:{color:"#263238",fontSize:18,margin:"0 0 14px"},children:"پرسش‌های رایج"}),s.faqs.map(([w,D])=>e.jsxs("details",{style:{borderTop:"1px solid #E4DDD2",padding:"12px 0"},children:[e.jsx("summary",{style:{cursor:"pointer",fontWeight:700,color:"#263238"},children:w}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.9,margin:"10px 0 0"},children:D})]},w))]})]})]})}function Cr({slug:t}){const{navigate:n}=q(),[i,o]=c.useState(null),[s,a]=c.useState([]),[r,d]=c.useState(!0);return c.useEffect(()=>{const l=M.authors.find(x=>x.slug===t)?.username||t;n(`/profile/@${l}`)},[t]),r?e.jsx("div",{style:{paddingTop:120,textAlign:"center",fontFamily:"Vazirmatn,sans-serif",color:"#5F6B6D"},children:"در حال بارگذاری…"}):i?e.jsxs("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:[e.jsx("div",{style:{background:"linear-gradient(135deg,#20343A,#0F2830)",padding:"48px 24px"},children:e.jsxs("div",{style:{maxWidth:900,margin:"0 auto",display:"flex",gap:28,alignItems:"center",flexWrap:"wrap"},children:[e.jsx(je,{author:i,size:96}),e.jsxs("div",{children:[e.jsxs("h1",{style:{fontSize:28,fontWeight:900,color:"#FAF7F0",margin:"0 0 6px",display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[i.name,i.verifiedExpert&&e.jsx("span",{style:{fontSize:12,color:"#D49A2A",background:"rgba(212,154,42,0.12)",border:"1px solid rgba(212,154,42,0.45)",borderRadius:999,padding:"3px 10px"},children:"متخصص تاییدشده"})]}),i.verifiedExpert&&i.verificationNote&&e.jsx("div",{style:{color:"#CFE2DD",fontSize:12,marginBottom:8},children:i.verificationNote}),e.jsx("div",{style:{fontSize:14,color:"#D49A2A",fontWeight:600,marginBottom:10},children:i.specialty}),e.jsx("p",{style:{fontSize:14,color:"#90A4AE",lineHeight:1.8,margin:"0 0 16px",maxWidth:520},children:i.bio}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:22,fontWeight:800,color:"#D49A2A"},children:i.articleCount}),e.jsx("span",{style:{fontSize:12,color:"#90A4AE",marginRight:4},children:"مقاله"})]}),e.jsxs("div",{children:[e.jsx("span",{style:{fontSize:22,fontWeight:800,color:"#D49A2A"},children:s.reduce((p,l)=>p+(l.views||0),0).toLocaleString("fa")}),e.jsx("span",{style:{fontSize:12,color:"#90A4AE",marginRight:4},children:"بازدید"})]})]})]})]})}),e.jsxs("div",{style:{maxWidth:900,margin:"0 auto",padding:"32px 24px"},children:[e.jsxs("h2",{style:{fontSize:20,fontWeight:700,color:"#263238",margin:"0 0 24px"},children:["مقاله‌های ",i.name]}),s.length===0?e.jsx(J,{title:"مقاله‌ای منتشر نشده"}):s.map((p,l)=>e.jsx(Fe,{article:p,idx:l},p.id))]})]}):e.jsx(J,{title:"نویسنده یافت نشد"})}function Ar(){const{navigate:t}=q(),[n,i]=c.useState([]),[o,s]=c.useState(!0);return c.useEffect(()=>{let a=!1;return U.listNewsletterArchive().then(r=>{a||i(r)}).catch(()=>{a||i([])}).finally(()=>{a||s(!1)}),()=>{a=!0}},[]),e.jsx("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsxs("div",{style:{maxWidth:900,margin:"0 auto",padding:"40px 24px"},children:[e.jsx("h1",{style:{fontSize:32,fontWeight:900,color:"#263238",margin:"0 0 10px"},children:"آرشیو خبرنامه تکنـاو"}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.9,margin:"0 0 28px"},children:"نسخه‌های ارسال‌شده خبرنامه برای دنبال کردن روندهای مهم فناوری، هوش مصنوعی و امنیت."}),o?e.jsx("div",{style:{color:"#5F6B6D"},children:"در حال بارگذاری..."}):n.length===0?e.jsx(J,{title:"هنوز خبرنامه‌ای منتشر نشده است"}):e.jsx("div",{style:{display:"grid",gap:14},children:n.map(a=>e.jsxs("button",{onClick:()=>t(`/newsletter/${a.slug}`),style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:10,padding:18,textAlign:"right",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("div",{style:{fontSize:18,fontWeight:800,color:"#263238",marginBottom:6},children:a.subject}),e.jsx("div",{style:{color:"#5F6B6D",fontSize:12},children:a.sentAt?new Date(a.sentAt).toLocaleDateString("fa-IR"):"منتشر نشده"})]},a.id))})]})})}function Br({slug:t}){const{navigate:n}=q(),[i,o]=c.useState(null),[s,a]=c.useState(!1);return c.useEffect(()=>{let r=!1;return a(!1),U.getNewsletterIssue(t).then(d=>{r||o(d)}).catch(()=>{r||a(!0)}),()=>{r=!0}},[t]),s?e.jsx("div",{style:{paddingTop:100,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsx(J,{title:"خبرنامه پیدا نشد"})}):i?e.jsx("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsxs("article",{style:{maxWidth:760,margin:"0 auto",padding:"40px 24px"},children:[e.jsx("button",{onClick:()=>n("/newsletter"),style:{...W,background:"#F4EFE6",color:"#0F6B73",border:"1px solid #E4DDD2",marginBottom:18},children:"آرشیو خبرنامه"}),e.jsx("h1",{style:{fontSize:30,fontWeight:900,color:"#263238",lineHeight:1.45,margin:"0 0 10px"},children:i.subject}),e.jsx("div",{style:{color:"#5F6B6D",fontSize:12,marginBottom:28},children:i.sentAt?new Date(i.sentAt).toLocaleDateString("fa-IR"):""}),e.jsx("div",{className:"article-content",style:{fontSize:16,lineHeight:2,color:"#263238",background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:24},dangerouslySetInnerHTML:{__html:i.bodyHtml}})]})}):e.jsx("div",{style:{paddingTop:120,textAlign:"center",color:"#5F6B6D",fontFamily:"Vazirmatn,sans-serif"},children:"در حال بارگذاری..."})}function zr(){const t=te(),[n,i]=c.useState([]),[o,s]=c.useState({company:"",title:"",location:"Remote",remote:!0,url:"",contactEmail:"",description:""}),[a,r]=c.useState(!1);c.useEffect(()=>{U.listJobs().then(i).catch(()=>i([]))},[]);const d=(l,x)=>s(u=>({...u,[l]:x})),p=async l=>{l.preventDefault(),r(!0);try{await U.submitJob(o),s({company:"",title:"",location:"Remote",remote:!0,url:"",contactEmail:"",description:""}),t("آگهی شغلی برای بررسی ارسال شد")}catch{t("ارسال آگهی ناموفق بود","error")}finally{r(!1)}};return e.jsxs("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:[e.jsxs("div",{style:{maxWidth:1040,margin:"0 auto",padding:"40px 24px"},children:[e.jsx("h1",{style:{fontSize:32,fontWeight:900,color:"#263238",margin:"0 0 8px"},children:"فرصت‌های شغلی فناوری"}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.9,margin:"0 0 28px"},children:"جایگاه‌های منتخب شرکت‌های فنی فارسی‌زبان. آگهی‌های جدید بعد از بررسی تحریریه منتشر می‌شوند."}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 360px",gap:22},className:"jobs-grid",children:[e.jsx("section",{style:{display:"grid",gap:12},children:n.length===0?e.jsx(J,{title:"هنوز آگهی منتشرشده‌ای وجود ندارد"}):n.map(l=>e.jsxs("article",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:18},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{margin:"0 0 6px",fontSize:18,color:"#263238"},children:l.title}),e.jsx("div",{style:{color:"#0F6B73",fontWeight:800,fontSize:13},children:l.company})]}),e.jsx("span",{style:{color:"#5F6B6D",fontSize:12},children:l.remote?"Remote":l.location})]}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.8,fontSize:13},children:l.description}),l.url&&e.jsx("a",{href:l.url,target:"_blank",rel:"noreferrer",style:{color:"#0F6B73",fontWeight:800},children:"مشاهده و ارسال رزومه"})]},l.id))}),e.jsxs("form",{onSubmit:p,style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:18,alignSelf:"start",display:"grid",gap:10},children:[e.jsx("h2",{style:{margin:0,fontSize:17,color:"#263238"},children:"ثبت آگهی شرکت"}),e.jsx("input",{required:!0,value:o.company,onChange:l=>d("company",l.target.value),placeholder:"نام شرکت",style:O}),e.jsx("input",{required:!0,value:o.title,onChange:l=>d("title",l.target.value),placeholder:"عنوان شغل",style:O}),e.jsx("input",{value:o.location,onChange:l=>d("location",l.target.value),placeholder:"موقعیت",style:O}),e.jsx("input",{value:o.contactEmail,onChange:l=>d("contactEmail",l.target.value),placeholder:"ایمیل تماس",style:O,dir:"ltr"}),e.jsx("input",{value:o.url,onChange:l=>d("url",l.target.value),placeholder:"لینک درخواست",style:O,dir:"ltr"}),e.jsxs("label",{style:{display:"flex",gap:8,fontSize:13,color:"#263238"},children:[e.jsx("input",{type:"checkbox",checked:o.remote,onChange:l=>d("remote",l.target.checked)})," امکان دورکاری"]}),e.jsx("textarea",{required:!0,value:o.description,onChange:l=>d("description",l.target.value),placeholder:"شرح موقعیت",style:{...O,minHeight:110,resize:"vertical"}}),e.jsx("button",{disabled:a,style:{...W,background:"#0F6B73",color:"#fff",justifyContent:"center"},children:a?"در حال ارسال...":"ارسال برای بررسی"})]})]})]}),e.jsx("style",{children:"@media(max-width:850px){.jobs-grid{grid-template-columns:1fr!important}}"})]})}function Er(){const[t,n]=c.useState([]);return c.useEffect(()=>{U.listCourses().then(n).catch(()=>n([]))},[]),e.jsx("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsxs("div",{style:{maxWidth:1040,margin:"0 auto",padding:"40px 24px"},children:[e.jsx("h1",{style:{fontSize:32,fontWeight:900,color:"#263238",margin:"0 0 8px"},children:"دوره‌های تخصصی تکناو"}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.9,margin:"0 0 28px"},children:"مسیرهای آموزشی فارسی برای تیم‌هایی که فناوری را در محصول و عملیات واقعی به کار می‌گیرند."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(260px,1fr))",gap:16},children:t.map(i=>e.jsxs("article",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:20},children:[e.jsx("div",{style:{color:"#0F6B73",fontSize:12,fontWeight:800,marginBottom:8},children:i.level}),e.jsx("h2",{style:{margin:"0 0 10px",color:"#263238",fontSize:19},children:i.title}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.9,fontSize:13},children:i.summary}),e.jsx("div",{style:{marginTop:16,color:"#D49A2A",fontWeight:900},children:i.price?`${i.price.toLocaleString("fa-IR")} تومان`:"به‌زودی"})]},i.id))})]})})}function Rr(){const{navigate:t}=q(),{user:n}=ae(),i=te(),[o,s]=c.useState(!1),[a,r]=c.useState(null);c.useEffect(()=>{fetch("/api/v1/membership/status",{credentials:"include"}).then(l=>l.ok?l.json():null).then(l=>l&&r(l)).catch(()=>{})},[]);const d=async()=>{if(!n){t("/login");return}s(!0);try{const x=await(await fetch("/api/v1/membership/subscribe",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).json();x.redirectUrl?window.location.href=x.redirectUrl:(i(x.error==="payment_unavailable"?"درگاه پرداخت در دسترس نیست":"خطا در اتصال به درگاه پرداخت"),s(!1))}catch{i("خطا در ارتباط با سرور"),s(!1)}},p=a?.active;return e.jsx("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsxs("div",{style:{maxWidth:900,margin:"0 auto",padding:"44px 24px"},children:[e.jsx("h1",{style:{fontSize:32,fontWeight:900,color:"#263238",margin:"0 0 8px"},children:"عضویت پریمیوم تکناو"}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.9,marginBottom:28},children:"تجربه بدون تبلیغ، مقاله‌های اختصاصی، دوره‌های کوتاه و گزارش‌های عمیق برای خوانندگان حرفه‌ای."}),p&&e.jsxs("div",{style:{background:"#0F6B7318",border:"1px solid #0F6B7340",borderRadius:12,padding:"16px 20px",marginBottom:28,color:"#0F6B73",fontWeight:700},children:["✓ شما در حال حاضر عضو ویژه هستید",a?.expiresAt&&` — اعتبار تا ${new Date(a.expiresAt).toLocaleDateString("fa-IR")}`]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(240px,1fr))",gap:16,marginBottom:32},children:[["👑","بدون تبلیغ","خواندن آرام و سریع‌تر بدون جایگاه‌های تبلیغاتی."],["📖","محتوای اختصاصی","تحلیل‌های عمیق‌تر و پرونده‌های تخصصی برای اعضا."],["🎓","تخفیف دوره‌ها","دسترسی زودتر و تخفیف روی دوره‌های فارسی تکناو."]].map(([l,x,u])=>e.jsxs("section",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:20},children:[e.jsx("div",{style:{fontSize:24,marginBottom:8},children:l}),e.jsx("h2",{style:{margin:"0 0 8px",fontSize:18,color:"#263238"},children:x}),e.jsx("p",{style:{margin:0,color:"#5F6B6D",lineHeight:1.8},children:u})]},x))}),!p&&e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{style:{fontSize:13,color:"#5F6B6D",marginBottom:16},children:"سالانه — ۵۰۰,۰۰۰ تومان"}),e.jsx("button",{onClick:d,disabled:o,style:{background:"linear-gradient(135deg, #D49A2A, #B8821E)",color:"#fff",border:"none",borderRadius:10,padding:"14px 36px",fontSize:16,fontWeight:700,cursor:o?"not-allowed":"pointer",opacity:o?.7:1,fontFamily:"Vazirmatn,sans-serif"},children:o?"در حال اتصال به درگاه...":"شروع عضویت ویژه"})]})]})})}function Wr(){const{navigate:t}=q();return e.jsx("div",{style:{paddingTop:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:480,padding:"0 24px"},children:[e.jsx("div",{style:{fontSize:56,marginBottom:16},children:"👑"}),e.jsx("h1",{style:{fontSize:26,fontWeight:900,color:"#263238",marginBottom:12},children:"عضویت ویژه فعال شد!"}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.9,marginBottom:28},children:"از حالا به همه مقالات پریمیوم دسترسی دارید. ممنون از حمایت شما از تکناو."}),e.jsx("button",{onClick:()=>t("/"),style:{...W,background:"#0F6B73",color:"#fff",padding:"12px 28px",fontSize:14},children:"بازگشت به خانه"})]})})}function Ce({title:t,subtitle:n,children:i}){return e.jsx("div",{style:{paddingTop:88,paddingBottom:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsxs("div",{style:{maxWidth:820,margin:"0 auto",padding:"0 24px"},children:[e.jsxs("div",{style:{marginBottom:40},children:[e.jsx("h1",{style:{fontSize:28,fontWeight:800,color:"#0F2A2E",marginBottom:8,fontFamily:"'PelakFA','Vazirmatn',sans-serif"},children:t}),n&&e.jsx("p",{style:{fontSize:14,color:"#5F6B6D",lineHeight:1.8},children:n}),e.jsx("div",{style:{height:3,width:48,background:"#D49A2A",borderRadius:2,marginTop:16}})]}),e.jsx("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:"36px 40px",lineHeight:1.95,color:"#374549",fontSize:14},children:i})]})})}function ie({title:t,children:n}){return e.jsxs("section",{style:{marginBottom:32},children:[e.jsx("h2",{style:{fontSize:16,fontWeight:700,color:"#0F2A2E",marginBottom:10,borderRight:"3px solid #0F6B73",paddingRight:10},children:t}),n]})}function Ir(){return e.jsxs(Ce,{title:"قوانین حریم خصوصی",subtitle:"آخرین بروزرسانی: اردیبهشت ۱۴۰۵ — لطفاً این سیاست را پیش از استفاده از خدمات تکناو مطالعه کنید.",children:[e.jsxs(ie,{title:"۱. اطلاعاتی که جمع‌آوری می‌کنیم",children:[e.jsx("p",{style:{marginBottom:10},children:"تکناو اطلاعات زیر را از کاربران جمع‌آوری می‌کند:"}),e.jsxs("ul",{style:{paddingRight:20,margin:0,listStyle:"disc"},children:[e.jsxs("li",{style:{marginBottom:6},children:[e.jsx("strong",{children:"اطلاعات حساب کاربری:"})," نام، آدرس ایمیل و نام کاربری هنگام ثبت‌نام."]}),e.jsxs("li",{style:{marginBottom:6},children:[e.jsx("strong",{children:"اطلاعات استفاده:"})," صفحات بازدیدشده، مقالات مطالعه‌شده، مدت زمان حضور در سایت و واکنش‌های کاربری — به‌صورت ناشناس و جمعی."]}),e.jsxs("li",{style:{marginBottom:6},children:[e.jsx("strong",{children:"اطلاعات فنی:"})," نوع مرورگر، سیستم‌عامل و آدرس IP به‌منظور امنیت و رفع اشکال."]}),e.jsxs("li",{style:{marginBottom:6},children:[e.jsx("strong",{children:"اطلاعات خبرنامه:"})," آدرس ایمیل در صورت عضویت اختیاری در خبرنامه."]})]})]}),e.jsxs(ie,{title:"۲. نحوه استفاده از اطلاعات",children:[e.jsx("p",{children:"اطلاعات جمع‌آوری‌شده صرفاً برای موارد زیر استفاده می‌شود:"}),e.jsxs("ul",{style:{paddingRight:20,margin:"8px 0 0",listStyle:"disc"},children:[e.jsx("li",{style:{marginBottom:6},children:"ارائه و بهبود محتوا و خدمات تکناو"}),e.jsx("li",{style:{marginBottom:6},children:"ارسال خبرنامه در صورت اشتراک داوطلبانه"}),e.jsx("li",{style:{marginBottom:6},children:"تشخیص و پیشگیری از دسترسی غیرمجاز و سوءاستفاده"}),e.jsx("li",{style:{marginBottom:6},children:"پاسخ به درخواست‌ها و پشتیبانی کاربران"})]}),e.jsx("p",{style:{marginTop:10},children:"تکناو اطلاعات شخصی شما را به هیچ شخص ثالثی نمی‌فروشد."})]}),e.jsx(ie,{title:"۳. کوکی‌ها و ذخیره‌سازی محلی",children:e.jsx("p",{children:"تکناو از کوکی‌های ضروری برای مدیریت نشست (session) و از localStorage برای ذخیره تنظیمات رابط کاربری استفاده می‌کند. هیچ کوکی تبلیغاتی یا ردیابی شخص‌ثالث استفاده نمی‌شود."})}),e.jsx(ie,{title:"۴. امنیت اطلاعات",children:e.jsx("p",{children:"اطلاعات کاربران با رمزنگاری Argon2id (کلمه عبور) و HTTPS (انتقال داده) محافظت می‌شوند. دسترسی به داده‌های شخصی به حداقل افراد ضروری محدود است."})}),e.jsx(ie,{title:"۵. حقوق کاربر",children:e.jsxs("p",{children:["شما حق دارید هر زمان درخواست دسترسی، اصلاح، یا حذف اطلاعات شخصی خود را از طریق ",e.jsx("strong",{children:"info@teknav.ir"})," ارسال کنید. درخواست‌ها ظرف ۱۴ روز کاری پردازش می‌شوند."]})}),e.jsx(ie,{title:"۶. تغییرات در این سیاست",children:e.jsx("p",{children:"تکناو ممکن است این سیاست را به‌روزرسانی کند. تغییرات مهم از طریق اعلان درون‌سایتی اطلاع‌رسانی خواهند شد. ادامه استفاده از سایت پس از انتشار تغییرات به‌منزله پذیرش آن‌ها است."})}),e.jsx(ie,{title:"۷. تماس",children:e.jsxs("p",{children:["برای سوالات مرتبط با حریم خصوصی با ما از طریق ",e.jsx("strong",{children:"info@teknav.ir"})," تماس بگیرید."]})})]})}function Tr(){return e.jsxs(Ce,{title:"شرایط استفاده",subtitle:"آخرین بروزرسانی: اردیبهشت ۱۴۰۵ — استفاده از وب‌سایت تکناو به معنای پذیرش این شرایط است.",children:[e.jsx(ie,{title:"۱. پذیرش شرایط",children:e.jsx("p",{children:"با دسترسی به وب‌سایت تکناو (teknav.ir) شما موافقت خود را با این شرایط اعلام می‌کنید. اگر با هر بخشی از این شرایط موافق نیستید، لطفاً از استفاده از سایت خودداری کنید."})}),e.jsxs(ie,{title:"۲. محتوا و مالکیت معنوی",children:[e.jsx("p",{children:"تمامی محتوای منتشرشده در تکناو — شامل مقالات، تحلیل‌ها، نمودارها، و طراحی‌ها — متعلق به تکناو یا نویسندگان مربوطه است و تحت قوانین مالکیت معنوی محافظت می‌شود."}),e.jsx("p",{style:{marginTop:8},children:"نقل‌قول کوتاه با ذکر منبع (لینک مستقیم به مقاله) مجاز است. بازنشر کامل یا ترجمه بدون اجازه کتبی ممنوع است."})]}),e.jsx(ie,{title:"۳. حساب کاربری",children:e.jsxs("ul",{style:{paddingRight:20,margin:0,listStyle:"disc"},children:[e.jsx("li",{style:{marginBottom:6},children:"مسئولیت حفظ امنیت اطلاعات ورود به سیستم با کاربر است."}),e.jsx("li",{style:{marginBottom:6},children:"ایجاد چندین حساب کاربری توسط یک شخص مجاز نیست."}),e.jsx("li",{style:{marginBottom:6},children:"تکناو حق تعلیق یا حذف حساب‌های ناقض قوانین را دارد."})]})}),e.jsxs(ie,{title:"۴. رفتار کاربران",children:[e.jsx("p",{children:"کاربران متعهد می‌شوند که از سایت برای موارد زیر استفاده نکنند:"}),e.jsxs("ul",{style:{paddingRight:20,margin:"8px 0 0",listStyle:"disc"},children:[e.jsx("li",{style:{marginBottom:6},children:"انتشار محتوای توهین‌آمیز، خلاف قانون، یا گمراه‌کننده"}),e.jsx("li",{style:{marginBottom:6},children:"ارسال هرزنامه (spam) یا تلاش برای دسترسی غیرمجاز"}),e.jsx("li",{style:{marginBottom:6},children:"تداخل در عملکرد سیستم یا سرویس‌های تکناو"})]})]}),e.jsx(ie,{title:"۵. سلب مسئولیت",children:e.jsx("p",{children:"محتوای تکناو صرفاً جنبه اطلاع‌رسانی و آموزشی دارد. تکناو در قبال تصمیماتی که بر اساس محتوای منتشرشده اتخاذ می‌شوند مسئولیتی نمی‌پذیرد. صحت اطلاعات فنی در حد توان بررسی می‌شود اما ضمانت کامل داده نمی‌شود."})}),e.jsx(ie,{title:"۶. تغییر خدمات",children:e.jsx("p",{children:"تکناو حق دارد هر زمان خدمات، محتوا، یا این شرایط را تغییر دهد. اطلاع‌رسانی تغییرات مهم از طریق سایت انجام می‌شود."})}),e.jsx(ie,{title:"۷. قانون حاکم",children:e.jsx("p",{children:"این شرایط تابع قوانین جمهوری اسلامی ایران است. هرگونه اختلاف در صلاحیت دادگاه‌های ایران رسیدگی خواهد شد."})}),e.jsx(ie,{title:"۸. تماس",children:e.jsxs("p",{children:["برای سوالات حقوقی با ما از طریق ",e.jsx("strong",{children:"info@teknav.ir"})," در ارتباط باشید."]})})]})}function $r(){const{navigate:t}=q();return e.jsxs(Ce,{title:"درباره تکناو",subtitle:"روایت عمیق فناوری — تحلیل‌های علمی و تخصصی برای متخصصان ایرانی",children:[e.jsx(ie,{title:"تکناو چیست؟",children:e.jsx("p",{children:"تکناو یک نشریه فناوری فارسی‌زبان است که با هدف تولید محتوای عمیق، علمی، و کاربردی برای متخصصان، پژوهشگران، و علاقه‌مندان ایرانی فعالیت می‌کند. ما باور داریم که جامعه فارسی‌زبان به منابع تخصصی‌ای نیاز دارد که نه صرفاً ترجمه، بلکه تحلیل و تولید اصیل باشند."})}),e.jsx(ie,{title:"حوزه‌های تخصصی",children:e.jsx("ul",{style:{paddingRight:20,margin:0,listStyle:"none"},children:[["هوش مصنوعی","یادگیری ماشین، مدل‌های زبانی بزرگ، سیستم‌های هوشمند"],["علم داده","مهندسی داده، پایپ‌لاین‌ها، ارزیابی کمی"],["امنیت سایبری","تهدیدات نوظهور، رمزنگاری، تست نفوذ"],["سخت‌افزار","پردازنده‌ها، شتاب‌دهنده‌های هوش مصنوعی، زیرساخت"],["نرم‌افزار","معماری سیستم، مهندسی نرم‌افزار، ابزارهای توسعه"],["آینده فناوری","روندهای بلندمدت، تأثیر اجتماعی فناوری"]].map(([n,i])=>e.jsxs("li",{style:{marginBottom:10,display:"flex",gap:10,alignItems:"flex-start"},children:[e.jsx("span",{style:{minWidth:8,height:8,borderRadius:"50%",background:"#0F6B73",marginTop:6,flexShrink:0,display:"inline-block"}}),e.jsxs("span",{children:[e.jsxs("strong",{children:[n,":"]})," ",i]})]},n))})}),e.jsx(ie,{title:"رویکرد ما",children:e.jsx("p",{children:"هر مقاله تکناو با بررسی منابع اولیه، مقالات علمی، و تجربه عملی تهیه می‌شود. ما از هوش مصنوعی به‌عنوان ابزار کمکی در ویرایش استفاده می‌کنیم اما تحلیل، نتیجه‌گیری، و دیدگاه‌ها کاملاً انسانی هستند."})}),e.jsxs(ie,{title:"تیم",children:[e.jsxs("p",{children:["تکناو توسط ",e.jsx("strong",{children:"آرسام صباغ"})," — پژوهشگر ارشد هوش مصنوعی و مهندسی داده — بنیان‌گذاری شده و با همکاری نویسندگان متخصص در حوزه‌های مختلف فناوری فعالیت می‌کند."]}),e.jsxs("div",{style:{marginTop:16,display:"flex",gap:12,flexWrap:"wrap"},children:[e.jsx("button",{onClick:()=>t("/authors"),style:{background:"#0F6B73",color:"#fff",border:"none",borderRadius:8,padding:"10px 20px",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"مشاهده تیم نویسندگان"}),e.jsx("button",{onClick:()=>t("/contact"),style:{background:"transparent",color:"#0F6B73",border:"1px solid #0F6B73",borderRadius:8,padding:"10px 20px",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"تماس با ما"})]})]}),e.jsxs(ie,{title:"اطلاعات تماس",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"وب‌سایت:"})," teknav.ir"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"ایمیل:"})," info@teknav.ir"]}),e.jsx("p",{children:e.jsx("strong",{children:"تهران، ایران"})})]})]})}function Lr(){const{navigate:t}=q(),n=te(),[i,o]=c.useState({name:"",email:"",subject:"",message:""}),[s,a]=c.useState(!1),r=(l,x)=>o(u=>({...u,[l]:x})),d=async l=>{if(l.preventDefault(),!i.name.trim()||!i.email.includes("@")||!i.message.trim()){n("لطفاً همه فیلدهای ضروری را پر کنید","error");return}try{await fetch("/api/contact",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}catch{}a(!0)};if(s)return e.jsx("div",{style:{paddingTop:88,paddingBottom:80,background:"#FAF7F0",minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:420,padding:"0 24px"},children:[e.jsx("div",{style:{fontSize:56,marginBottom:16},children:"✓"}),e.jsx("h2",{style:{fontSize:22,fontWeight:800,color:"#0F2A2E",marginBottom:10},children:"پیام شما ارسال شد"}),e.jsx("p",{style:{color:"#5F6B6D",lineHeight:1.8,marginBottom:24},children:"ممنون از تماس شما. تیم تکناو به‌زودی پاسخ خواهد داد."}),e.jsx("button",{onClick:()=>t("/"),style:{background:"#0F6B73",color:"#fff",border:"none",borderRadius:8,padding:"12px 28px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"بازگشت به خانه"})]})});const p={background:"#FAF7F0",border:"1px solid #D8D0C4",borderRadius:8,padding:"11px 14px",fontSize:14,fontFamily:"Vazirmatn,sans-serif",color:"#263238",width:"100%",boxSizing:"border-box",outline:"none",direction:"rtl"};return e.jsxs(Ce,{title:"تماس با ما",subtitle:"سوال، پیشنهاد، یا همکاری؟ خوشحال می‌شویم بشنویم.",children:[e.jsx(ie,{title:"راه‌های ارتباطی مستقیم",children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(200px,1fr))",gap:16,marginBottom:4},children:[["📧","ایمیل عمومی","info@teknav.ir"],["✍️","همکاری محتوایی","admin@teknavglobal.com"],["📍","موقعیت","تهران، ایران"]].map(([l,x,u])=>e.jsxs("div",{style:{background:"#FAF7F0",border:"1px solid #E4DDD2",borderRadius:10,padding:"16px 18px"},children:[e.jsx("div",{style:{fontSize:22,marginBottom:6},children:l}),e.jsx("div",{style:{fontSize:12,color:"#5F6B6D",marginBottom:2},children:x}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"#0F2A2E"},children:u})]},x))})}),e.jsx(ie,{title:"ارسال پیام",children:e.jsxs("form",{onSubmit:d,style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:14},children:[e.jsxs("div",{children:[e.jsxs("label",{style:{fontSize:12,fontWeight:600,color:"#5F6B6D",display:"block",marginBottom:5},children:["نام ",e.jsx("span",{style:{color:"#C46A4D"},children:"*"})]}),e.jsx("input",{value:i.name,onChange:l=>r("name",l.target.value),placeholder:"نام شما",style:p})]}),e.jsxs("div",{children:[e.jsxs("label",{style:{fontSize:12,fontWeight:600,color:"#5F6B6D",display:"block",marginBottom:5},children:["ایمیل ",e.jsx("span",{style:{color:"#C46A4D"},children:"*"})]}),e.jsx("input",{value:i.email,onChange:l=>r("email",l.target.value),placeholder:"example@email.com",style:{...p,direction:"ltr"}})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:12,fontWeight:600,color:"#5F6B6D",display:"block",marginBottom:5},children:"موضوع"}),e.jsx("input",{value:i.subject,onChange:l=>r("subject",l.target.value),placeholder:"موضوع پیام",style:p})]}),e.jsxs("div",{children:[e.jsxs("label",{style:{fontSize:12,fontWeight:600,color:"#5F6B6D",display:"block",marginBottom:5},children:["پیام ",e.jsx("span",{style:{color:"#C46A4D"},children:"*"})]}),e.jsx("textarea",{value:i.message,onChange:l=>r("message",l.target.value),placeholder:"پیام خود را اینجا بنویسید...",rows:5,style:{...p,resize:"vertical",lineHeight:1.8}})]}),e.jsx("button",{type:"submit",style:{background:"#0F6B73",color:"#fff",border:"none",borderRadius:8,padding:"12px 28px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",alignSelf:"flex-start"},children:"ارسال پیام"})]})})]})}function Pr(){const{navigate:t}=q();return e.jsx(Ce,{title:"ابزارهای تخصصی توسعه‌دهندگان",subtitle:"ابزارهای کمکی و محاسباتی برای پردازش زبان طبیعی فارسی (NLP)، هوش مصنوعی و بازیابی اطلاعات (RAG).",children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(280px, 1fr))",gap:20},children:[{title:"نرمال‌ساز متن فارسی (NLP)",desc:"اصلاح حروف عربی، تنظیم نیم‌فاصله‌ها، حذف کدهای HTML و فاصله‌های مکرر در متون فارسی برای پیش‌پردازش سیستم‌های هوش مصنوعی.",path:"/tools/nlp-normalizer",icon:"📝"},{title:"محاسبه‌گر چانک و زمینه RAG",desc:"شبیه‌سازی تکه‌بندی متون، همپوشانی (Overlap)، محاسبه تعداد چانک‌ها و برآورد تعداد توکن‌های فارسی برای پایپ‌لاین‌های Retrieval-Augmented Generation.",path:"/tools/rag-calculator",icon:"📐"}].map(n=>e.jsxs("div",{style:{background:"#FAF7F0",border:"1px solid #E4DDD2",borderRadius:12,padding:24,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:32,marginBottom:12},children:n.icon}),e.jsx("h2",{style:{fontSize:17,fontWeight:800,color:"#0F2A2E",marginBottom:10},children:n.title}),e.jsx("p",{style:{color:"#5F6B6D",fontSize:13,lineHeight:1.8,marginBottom:20},children:n.desc})]}),e.jsx("button",{onClick:()=>t(n.path),style:{background:"#0F6B73",color:"#fff",border:"none",borderRadius:8,padding:"10px 18px",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",width:"100%"},children:"ورود به ابزار"})]},n.path))})})}function Mr(){const{navigate:t}=q(),n=te(),[i,o]=c.useState(""),[s,a]=c.useState(""),[r,d]=c.useState({stripHtml:!0,normalizeLetters:!0,normalizeZwnj:!0,cleanWhitespace:!0}),p=g=>d(b=>({...b,[g]:!b[g]})),l=()=>{let g=i||"";r.stripHtml&&(g=g.replace(/<[^>]*>/g," ")),r.normalizeLetters&&(g=g.replace(/ي/g,"ی").replace(/ك/g,"ک").replace(/ة/g,"ه")),r.normalizeZwnj&&(g=g.replace(/\s+(می|نمی)\s+/g," $1‌"),g=g.replace(/\s+(تر|ترین|ها|های|ام|ات|اش|مان|تان|شان)\b/g,"‌$1"),g=g.replace(/\b(می|نمی)\b\s+/g,"$1‌")),r.cleanWhitespace&&(g=g.replace(/\s+/g," "),g=g.replace(/\n\s*\n+/g,`
`)),a(g.trim()),n("متن با موفقیت نرمال‌سازی شد","success")},x=g=>{g&&(navigator.clipboard.writeText(g),n("کپی شد!","success"))},u={width:"100%",minHeight:180,background:"#FAF7F0",border:"1px solid #D8D0C4",borderRadius:8,padding:"12px 16px",fontSize:14,fontFamily:"Vazirmatn, sans-serif",color:"#263238",outline:"none",lineHeight:1.7,resize:"vertical",boxSizing:"border-box"};return e.jsx(Ce,{title:"نرمال‌ساز متن فارسی (NLP)",subtitle:"اصلاح نویسه‌ها، تنظیم فاصله‌ها و بهینه‌سازی متون فارسی برای ابزارهای پردازش زبان طبیعی و مدل‌های زبانی.",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:13,fontWeight:700,color:"#0F2A2E",display:"block",marginBottom:8},children:"متن ورودی:"}),e.jsx("textarea",{value:i,onChange:g=>o(g.target.value),placeholder:"متن فارسی خود را برای نرمال‌سازی اینجا وارد کنید...",style:u})]}),e.jsxs("div",{style:{background:"#FAF7F0",border:"1px solid #E4DDD2",borderRadius:10,padding:18},children:[e.jsx("h3",{style:{fontSize:14,fontWeight:800,color:"#0F2A2E",marginBottom:12},children:"تنظیمات نرمال‌سازی"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:12},children:[["stripHtml","حذف تگ‌های HTML"],["normalizeLetters","تبدیل ی و ک عربی به فارسی"],["normalizeZwnj","تنظیم نیم‌فاصله‌های پیشوند/پسوند"],["cleanWhitespace","اصلاح فاصله‌ها و تب‌های مکرر"]].map(([g,b])=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:13,color:"#374549"},children:[e.jsx("input",{type:"checkbox",checked:r[g],onChange:()=>p(g),style:{accentColor:"#0F6B73"}}),e.jsx("span",{children:b})]},g))})]}),e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsx("button",{onClick:l,style:{background:"#0F6B73",color:"#fff",border:"none",borderRadius:8,padding:"12px 28px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"نرمال‌سازی متن"}),e.jsx("button",{onClick:()=>t("/tools"),style:{background:"transparent",color:"#5F6B6D",border:"1px solid #D8D0C4",borderRadius:8,padding:"12px 20px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"بازگشت"})]}),s&&e.jsxs("div",{style:{marginTop:10},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[e.jsx("label",{style:{fontSize:13,fontWeight:700,color:"#0F2A2E"},children:"متن خروجی:"}),e.jsx("button",{onClick:()=>x(s),style:{background:"#FAF7F0",border:"1px solid #D8D0C4",borderRadius:6,padding:"6px 12px",fontSize:12,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",display:"flex",alignItems:"center",gap:6},children:"📋 کپی خروجی"})]}),e.jsx("textarea",{readOnly:!0,value:s,style:{...u,background:"#fff"}})]}),e.jsxs("div",{style:{borderTop:"1px solid #E4DDD2",paddingTop:20,marginTop:10},children:[e.jsx("h3",{style:{fontSize:14,fontWeight:800,color:"#0F2A2E",marginBottom:8},children:"ارجاع علمی و اشتراک‌گذاری"}),e.jsx("p",{style:{color:"#5F6B6D",fontSize:12,lineHeight:1.7,marginBottom:12},children:"برای استفاده از خروجی‌های این ابزار در تحقیقات یا کارهای متن‌باز خود، می‌توانید از فرمت ارجاع زیر استفاده کنید:"}),e.jsxs("div",{style:{background:"#FAF7F0",border:"1px solid #E4DDD2",borderRadius:8,padding:12,fontSize:11,fontFamily:"monospace",direction:"ltr",textAlign:"left",overflowX:"auto",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("code",{style:{color:"#0F2A2E"},children:"[Teknav Persian NLP Tool] (https://www.teknav.ir/tools/nlp-normalizer)"}),e.jsx("button",{onClick:()=>x("[Teknav Persian NLP Tool] (https://www.teknav.ir/tools/nlp-normalizer)"),style:{background:"#fff",border:"1px solid #D8D0C4",borderRadius:4,padding:"2px 8px",fontSize:10,cursor:"pointer",fontFamily:"sans-serif"},children:"Copy"})]})]})]})})}function Nr(){const{navigate:t}=q(),n=te(),[i,o]=c.useState(""),[s,a]=c.useState(500),[r,d]=c.useState(50),[p,l]=c.useState([]),x=()=>{if(!i.trim()){n("لطفاً ابتدا متنی را برای چانک‌بندی وارد کنید","error");return}if(s<=0||r<0||r>=s){n("اندازه چانک یا همپوشانی نامعتبر است","error");return}const g=i.trim(),b=[];let h=0;for(;h<g.length;){let f=h+s;f>g.length&&(f=g.length);const y=g.substring(h,f),m=Math.round(y.length/3.8);if(b.push({id:b.length+1,content:y,charCount:y.length,tokenCount:m,range:[h,f]}),h+=s-r,h>=g.length||f===g.length)break}l(b),n(`تکه‌بندی با موفقیت انجام شد (${b.length} چانک)`,"success")},u=g=>{g&&(navigator.clipboard.writeText(g),n("کپی شد!","success"))};return e.jsx(Ce,{title:"محاسبه‌گر چانک و زمینه RAG",subtitle:"شبیه‌سازی اندازه تکه‌ها (Chunks)، همپوشانی (Overlap) و تخمین توکن برای سیستم‌های پرسش و پاسخ با بازیابی اطلاعات.",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:13,fontWeight:700,color:"#0F2A2E",display:"block",marginBottom:8},children:"متن نمونه:"}),e.jsx("textarea",{value:i,onChange:g=>o(g.target.value),placeholder:"متن فارسی مورد نظر برای شبیه‌سازی RAG را در این قسمت بنویسید...",style:{width:"100%",minHeight:140,background:"#FAF7F0",border:"1px solid #D8D0C4",borderRadius:8,padding:"12px 16px",fontSize:14,fontFamily:"Vazirmatn, sans-serif",color:"#263238",outline:"none",lineHeight:1.7,resize:"vertical",boxSizing:"border-box"}})]}),e.jsxs("div",{style:{background:"#FAF7F0",border:"1px solid #E4DDD2",borderRadius:10,padding:18},children:[e.jsx("h3",{style:{fontSize:14,fontWeight:800,color:"#0F2A2E",marginBottom:12},children:"پارامترهای شبیه‌سازی"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:16},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:12,color:"#5F6B6D",display:"block",marginBottom:5},children:"اندازه هر تکه (به کاراکتر):"}),e.jsx("input",{type:"number",value:s,onChange:g=>a(Number(g.target.value)),style:{width:"100%",padding:"10px 12px",border:"1px solid #D8D0C4",borderRadius:8,fontSize:14,fontFamily:"Vazirmatn, sans-serif"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:12,color:"#5F6B6D",display:"block",marginBottom:5},children:"اندازه همپوشانی (Overlap):"}),e.jsx("input",{type:"number",value:r,onChange:g=>d(Number(g.target.value)),style:{width:"100%",padding:"10px 12px",border:"1px solid #D8D0C4",borderRadius:8,fontSize:14,fontFamily:"Vazirmatn, sans-serif"}})]})]})]}),e.jsxs("div",{style:{display:"flex",gap:12},children:[e.jsx("button",{onClick:x,style:{background:"#0F6B73",color:"#fff",border:"none",borderRadius:8,padding:"12px 28px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"محاسبه و شبیه‌سازی"}),e.jsx("button",{onClick:()=>t("/tools"),style:{background:"transparent",color:"#5F6B6D",border:"1px solid #D8D0C4",borderRadius:8,padding:"12px 20px",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:"بازگشت"})]}),p.length>0&&e.jsxs("div",{style:{marginTop:10},children:[e.jsx("h3",{style:{fontSize:15,fontWeight:800,color:"#0F2A2E",marginBottom:12},children:"نتایج شبیه‌سازی تکه‌بندی:"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:12,marginBottom:20},children:[["طول کل کاراکترها",i.length],["تعداد تخمینی توکن‌ها",Math.round(i.length/3.8)],["تعداد چانک‌های خروجی",p.length]].map(([g,b])=>e.jsxs("div",{style:{background:"#FAF7F0",border:"1px solid #E4DDD2",borderRadius:8,padding:12,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginBottom:4},children:g}),e.jsx("div",{style:{fontSize:16,fontWeight:800,color:"#0F2A2E"},children:b.toLocaleString("fa-IR")})]},g))}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:p.map(g=>e.jsxs("div",{style:{border:"1px solid #E4DDD2",borderRadius:10,overflow:"hidden"},children:[e.jsxs("div",{style:{background:"#FAF7F0",borderBottom:"1px solid #E4DDD2",padding:"10px 16px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("span",{style:{fontSize:12,fontWeight:800,color:"#0F2A2E"},children:["چانک #",g.id.toLocaleString("fa-IR")," (اندیس ",g.range[0].toLocaleString("fa-IR")," تا ",g.range[1].toLocaleString("fa-IR"),")"]}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center"},children:[e.jsxs("span",{style:{fontSize:11,color:"#5F6B6D"},children:[g.charCount.toLocaleString("fa-IR")," کاراکتر · ",g.tokenCount.toLocaleString("fa-IR")," توکن تخمینی"]}),e.jsx("button",{onClick:()=>u(g.content),style:{background:"#fff",border:"1px solid #D8D0C4",borderRadius:4,padding:"3px 8px",fontSize:11,cursor:"pointer",fontFamily:"Vazirmatn, sans-serif"},children:"کپی"})]})]}),e.jsx("div",{style:{padding:16,fontSize:13,lineHeight:1.8,color:"#263238",background:"#fff",whiteSpace:"pre-wrap"},children:g.content})]},g.id))})]})]})})}function Hr(){const t=te(),n=o=>{navigator.clipboard.writeText(o),t("کپی شد!","success")},i=`@article{tekrag_persian_2026,
title={TekRAG-Persian: A Data-Centric Evaluation Framework for Hallucination in Persian Retrieval-Augmented Generation},
author={Sabbagh, Arsam},
journal={Teknav Journal of AI Research},
volume={1},
number={1},
pages={10-24},
year={2026},
publisher={Teknav Media}
}`;return e.jsx(Ce,{title:"مجموعه داده و بنچمارک TekRAG-Persian",subtitle:"چارچوب داده‌محور برای ارزیابی پدیده توهم (Hallucination) در سیستم‌های بازیابی اطلاعات فارسی.",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:24},children:[e.jsxs(ie,{title:"معرفی چارچوب پژوهش",children:[e.jsxs("p",{style:{margin:"0 0 12px",lineHeight:1.8},children:[e.jsx("strong",{children:"TekRAG-Persian"})," اولین مجموعه داده و چارچوب بنچمارک متمرکز بر زبان فارسی برای سنجش و کاهش میزان توهم در پیاده‌سازی‌های RAG است. این پروژه بر مبنای تحلیل مقاله‌های تخصصی رسانه تکناو و پاسخ‌دهی دقیق مدل‌های زبانی بزرگ توسعه داده شده است."]}),e.jsx("p",{style:{margin:0,lineHeight:1.8},children:"هدف این بنچمارک ارزیابی سه متغیر کلیدی در بهبود عملکرد سیستم‌های بازیابی است: پاک‌سازی پیش‌رفته متن، افزودن متادیتاهای ساختاریافته به تکه‌ها، و تأثیر هدایت مدل با تأکید بر استناد به منابع اصلی."})]}),e.jsx(ie,{title:"شناسنامه و لینک‌های دسترسی",children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:16},children:[["💾 مجموعه داده در Hugging Face","دسترسی به فایل‌های خام متون و پرسش‌ها","https://huggingface.co/datasets/teknav/tekrag-persian","مشاهده دیتاست"],["🔗 شناسه دیجیتال Zenodo (DOI)","نسخه آرشیو شده و معتبر علمی پژوهش","https://doi.org/10.5281/zenodo.placeholder","مشاهده DOI"],["⚙️ سورس‌کد در GitHub","کدهای پیاده‌سازی و ارزیابی بنچمارک","https://github.com/teknav/tekrag-persian","مشاهده ریپازیتوری"]].map(([o,s,a,r])=>e.jsxs("div",{style:{background:"#FAF7F0",border:"1px solid #E4DDD2",borderRadius:10,padding:18,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:14,fontWeight:800,color:"#0F2A2E",marginBottom:6},children:o}),e.jsx("p",{style:{fontSize:12,color:"#5F6B6D",margin:"0 0 16px",lineHeight:1.6},children:s})]}),e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",style:{display:"block",textAlign:"center",background:"#0F6B73",color:"#fff",textDecoration:"none",borderRadius:6,padding:"8px 14px",fontSize:12,fontWeight:600,fontFamily:"Vazirmatn,sans-serif"},children:r})]},o))})}),e.jsxs(ie,{title:"نحوه ارجاع علمی (Citation)",children:[e.jsx("p",{style:{margin:"0 0 12px",lineHeight:1.8},children:"اگر از این بنچمارک یا دیتاست در پژوهش‌های دانشگاهی یا پروژه‌های علمی خود استفاده می‌کنید، لطفاً با فرمت BibTeX زیر به آن ارجاع دهید:"}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx("button",{onClick:()=>n(i),style:{position:"absolute",top:12,left:12,background:"#fff",border:"1px solid #D8D0C4",borderRadius:6,padding:"5px 10px",fontSize:11,cursor:"pointer",fontFamily:"Vazirmatn, sans-serif"},children:"📋 کپی ارجاع"}),e.jsx("pre",{style:{background:"#FAF7F0",border:"1px solid #E4DDD2",borderRadius:10,padding:"44px 20px 20px",fontSize:12,fontFamily:"monospace",direction:"ltr",textAlign:"left",overflowX:"auto",margin:0,lineHeight:1.6},children:i})]})]}),e.jsxs(ie,{title:"ساختار مجموعه داده",children:[e.jsx("p",{style:{margin:"0 0 16px",lineHeight:1.8},children:"این بنچمارک شامل بخش‌های زیر در فرمت JSON است:"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[["Corpus (بدنه داده)","شامل مقاله‌های تخصصی با تگ‌ها، دسته‌بندی، پاراگراف‌ها و عناوین مجزا."],["Questions (سوالات)","۲۰۰ سوال واقعی طراحی شده توسط متخصصان در سطوح مختلف دشواری."],["Gold Annotations (پاسخ‌های طلایی)","تکه‌های دقیق پشتیبان برای هر سوال جهت سنجش بازیابی درست اطلاعات."]].map(([o,s])=>e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start",background:"#FAF7F020",border:"1px solid #E4DDD255",borderRadius:8,padding:12},children:[e.jsx("span",{style:{fontSize:13,fontWeight:700,color:"#0F6B73",minWidth:140},children:o}),e.jsx("span",{style:{fontSize:13,color:"#5F6B6D"},children:s})]},o))})]})]})})}function Vr({slug:t,item1:n,item2:i}){const o=`cmp_vote_${t}`,[s,a]=c.useState(()=>{try{return localStorage.getItem(o)||null}catch{return null}}),[r,d]=c.useState(!1),p=x=>{try{localStorage.setItem(o,x)}catch{}a(x)},l=()=>{const x=`https://www.teknav.ir/compare/${t}`;navigator.share?navigator.share({title:`مقایسه ${n.name} در برابر ${i.name} — تکناو`,url:x}).catch(()=>{}):navigator.clipboard?.writeText(x).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)}).catch(()=>{})};return e.jsxs("div",{style:{background:"#F8F5F0",borderRadius:12,padding:"20px 24px",marginBottom:32,display:"flex",gap:20,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("div",{style:{flex:1,minWidth:260},children:[e.jsx("p",{style:{fontSize:14,fontWeight:700,color:"#263238",marginBottom:12},children:"شما کدام را ترجیح می‌دهید؟"}),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsxs("button",{onClick:()=>p("item1"),style:{flex:1,padding:"9px 16px",borderRadius:8,fontSize:14,fontFamily:"Vazirmatn,sans-serif",cursor:"pointer",fontWeight:700,transition:"all 0.15s",background:s==="item1"?"#0F6B73":"#fff",color:s==="item1"?"#fff":"#0F6B73",border:`2px solid ${s==="item1"?"#0F6B73":"#E4DDD2"}`},children:[s==="item1"?"✓ ":"",n.name]}),e.jsxs("button",{onClick:()=>p("item2"),style:{flex:1,padding:"9px 16px",borderRadius:8,fontSize:14,fontFamily:"Vazirmatn,sans-serif",cursor:"pointer",fontWeight:700,transition:"all 0.15s",background:s==="item2"?"#D49A2A":"#fff",color:s==="item2"?"#fff":"#D49A2A",border:`2px solid ${s==="item2"?"#D49A2A":"#E4DDD2"}`},children:[s==="item2"?"✓ ":"",i.name]})]}),s&&e.jsx("p",{style:{fontSize:12,color:"#5F6B6D",marginTop:10},children:"انتخاب شما ثبت شد. برای تغییر دوباره کلیک کنید."})]}),e.jsx("button",{onClick:l,style:{background:r?"#2E7D32":"#0C1E22",color:r?"#fff":"#D49A2A",border:"none",borderRadius:8,padding:"10px 20px",fontSize:13,fontFamily:"Vazirmatn,sans-serif",cursor:"pointer",fontWeight:700,whiteSpace:"nowrap"},children:r?"✓ لینک کپی شد":"🔗 اشتراک‌گذاری"})]})}function _r({slug:t}){const{navigate:n}=q(),i=(M.comparisons??[]).find(h=>h.slug===t);if(!i)return e.jsx("div",{style:{padding:"120px 24px",textAlign:"center",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsx(J,{title:"صفحه مقایسه یافت نشد",subtitle:"مقایسه‌ای با این آدرس وجود ندارد"})});const{item1:o,item2:s,verdict:a,useCases:r=[],relatedArticles:d=[],relatedGlossary:p=[]}=i,l=M.articles.filter(h=>d.includes(h.slug)),x=(M.glossary??[]).filter(h=>p.includes(h.slug)),u={background:"#fff",borderRadius:12,padding:24,border:"1px solid #E4DDD2",flex:"1 1 300px"},g={fontSize:13,color:"#2E7D32",marginBottom:6,display:"flex",alignItems:"flex-start",gap:6},b={fontSize:13,color:"#C62828",marginBottom:6,display:"flex",alignItems:"flex-start",gap:6};return e.jsxs("div",{style:{maxWidth:960,margin:"0 auto",padding:"24px 16px 80px",direction:"rtl",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsxs("nav",{style:{fontSize:13,color:"#5F6B6D",marginBottom:24,display:"flex",gap:8,alignItems:"center"},children:[e.jsx("span",{style:{cursor:"pointer",color:"#0F6B73"},onClick:()=>n("/"),children:"تکناو"}),e.jsx("span",{children:"›"}),e.jsx("span",{style:{cursor:"pointer",color:"#0F6B73"},onClick:()=>n("/compare"),children:"مقایسه‌ها"}),e.jsx("span",{children:"›"}),e.jsx("span",{children:i.title})]}),e.jsx("h1",{style:{fontSize:"clamp(22px,4vw,32px)",fontWeight:800,color:"#0C1E22",lineHeight:1.5,marginBottom:12},children:i.title}),i.metaDescription&&e.jsx("p",{style:{fontSize:16,color:"#5F6B6D",lineHeight:1.8,marginBottom:16},children:i.metaDescription}),i.factCheckedAt&&e.jsxs("p",{style:{fontSize:12,color:"#5F6B6D",marginBottom:24},children:["آخرین بروزرسانی: ",i.factCheckedAt]}),e.jsx(Vr,{slug:t,item1:o,item2:s}),e.jsx("div",{style:{display:"flex",gap:20,flexWrap:"wrap",marginBottom:40},children:[o,s].map(h=>e.jsxs("div",{style:u,children:[e.jsx("h2",{style:{fontSize:20,fontWeight:700,color:"#0F6B73",marginBottom:10},children:h.name}),e.jsx("p",{style:{fontSize:14,color:"#263238",lineHeight:1.8,marginBottom:16},children:h.summary}),e.jsx("div",{style:{marginBottom:8,fontSize:13,fontWeight:700,color:"#263238"},children:"مزایا"}),(h.pros||[]).map((f,y)=>e.jsxs("div",{style:g,children:[e.jsx("span",{children:"✓"}),e.jsx("span",{children:f})]},y)),e.jsx("div",{style:{marginBottom:8,marginTop:12,fontSize:13,fontWeight:700,color:"#263238"},children:"معایب"}),(h.cons||[]).map((f,y)=>e.jsxs("div",{style:b,children:[e.jsx("span",{children:"✗"}),e.jsx("span",{children:f})]},y))]},h.slug))}),r.length>0&&e.jsxs("section",{style:{background:"#F8F5F0",borderRadius:12,padding:24,marginBottom:32},children:[e.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#263238",marginBottom:16},children:"چه زمانی کدام را انتخاب کنیم؟"}),r.map(([h,f],y)=>e.jsxs("div",{style:{display:"flex",gap:20,flexWrap:"wrap"},children:[e.jsxs("div",{style:{flex:"1 1 280px",padding:"12px 16px",background:"#fff",borderRadius:8,border:"1px solid #E4DDD2",fontSize:13,lineHeight:1.7},children:[e.jsxs("span",{style:{fontWeight:700,color:"#0F6B73"},children:[o.name,":"]})," ",h]}),e.jsxs("div",{style:{flex:"1 1 280px",padding:"12px 16px",background:"#fff",borderRadius:8,border:"1px solid #E4DDD2",fontSize:13,lineHeight:1.7},children:[e.jsxs("span",{style:{fontWeight:700,color:"#0F6B73"},children:[s.name,":"]})," ",f]})]},y))]}),a&&e.jsxs("section",{style:{background:"#0F3540",borderRadius:12,padding:24,marginBottom:40,color:"#fff"},children:[e.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#D49A2A",marginBottom:12},children:"جمع‌بندی و نتیجه‌گیری"}),e.jsx("p",{style:{fontSize:15,lineHeight:1.9},children:a})]}),x.length>0&&e.jsxs("section",{style:{marginBottom:40},children:[e.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#263238",marginBottom:16},children:"اصطلاحات مرتبط"}),e.jsx("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:x.map(h=>e.jsxs("div",{onClick:()=>n(`/glossary/${h.slug}`),style:{background:"#fff",border:"1px solid #0F6B73",borderRadius:8,padding:"10px 16px",cursor:"pointer"},children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#0F6B73"},children:h.term}),e.jsx("div",{style:{fontSize:12,color:"#5F6B6D"},children:h.english})]},h.slug))})]}),l.length>0&&e.jsxs("section",{children:[e.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"#263238",marginBottom:16},children:"مقالات مرتبط"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:l.map(h=>e.jsxs("div",{onClick:()=>n(`/article/${h.slug}`),style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:8,padding:"14px 18px",cursor:"pointer",display:"flex",gap:12,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,color:"#263238",marginBottom:4},children:h.title}),e.jsxs("div",{style:{fontSize:13,color:"#5F6B6D"},children:[h.summary?.slice(0,100),"…"]})]}),e.jsx("span",{style:{fontSize:20},children:"←"})]},h.id))})]})]})}function Or(){const t=new Date().getHours();return t<5?"شب بخیر":t<12?"صبح بخیر":t<17?"روز بخیر":t<21?"عصر بخیر":"شب بخیر"}function st(t,n=0){const[i,o]=c.useState(0);return c.useEffect(()=>{const s=setTimeout(()=>{let r=0;const d=setInterval(()=>{r++;const p=1-Math.pow(1-r/36,3);o(Math.floor(p*t)),r>=36&&(o(t),clearInterval(d))},1600/36);return()=>clearInterval(d)},n);return()=>clearTimeout(s)},[t,n]),i}function Ur(){return e.jsx("style",{children:`
@keyframes orbit { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
@keyframes orbitR { from{transform:rotate(0deg)} to{transform:rotate(-360deg)} }
@keyframes tickerUp { 0%{transform:translateY(0)} 100%{transform:translateY(-50%)} }
@keyframes bgGrid {
0% { background-position: 0 0; }
100% { background-position: 52px 52px; }
}
@keyframes logoGlow {
0%,100% { box-shadow: 0 10px 36px rgba(200,149,28,0.35); }
50% { box-shadow: 0 10px 56px rgba(200,149,28,0.6), 0 0 80px rgba(200,149,28,0.15); }
}
@keyframes fadeSlideUp {
from { opacity:0; transform:translateY(16px); }
to { opacity:1; transform:translateY(0); }
}
@keyframes statReveal {
0% { opacity:0; transform:scale(0.75) translateY(6px); }
60% { transform:scale(1.05) translateY(-2px); }
100% { opacity:1; transform:scale(1) translateY(0); }
}
@keyframes dividerExpand {
from { width: 0; opacity: 0; }
to { width: 48px; opacity: 1; }
}
@keyframes blink {
0%,100% { opacity: 1; } 50% { opacity: 0.3; }
}
/* ── Layout ── */
.auth-layout {
display: flex; min-height: 100vh;
direction: rtl; font-family: Vazirmatn, sans-serif;
}
.auth-form-col {
flex: 1; display: flex; flex-direction: column;
align-items: center; justify-content: center;
padding: 48px 32px; min-height: 100vh;
position: relative; overflow: hidden;
background: #FAF7F0;
background-image:
linear-gradient(rgba(196,106,77,0.028) 1px, transparent 1px),
linear-gradient(90deg, rgba(196,106,77,0.028) 1px, transparent 1px);
background-size: 52px 52px;
animation: bgGrid 38s linear infinite;
}
.auth-form-col::before {
content: '';
position: absolute; inset: 0; pointer-events: none;
background: radial-gradient(ellipse 70% 50% at 50% 100%, rgba(250,240,235,0.7) 0%, transparent 100%);
}
.auth-brand-col {
width: 440px; flex-shrink: 0;
background: #0B2226;
position: relative; overflow: hidden;
display: flex; flex-direction: column;
align-items: center; justify-content: center;
padding: 60px 44px;
}
.auth-mobile-logo { display: none; }
@media (max-width: 880px) {
.auth-brand-col { display: none; }
.auth-mobile-logo { display: flex; }
.auth-form-col { padding: 36px 20px; }
}
/* ── Inputs ── */
.auth-input-wrap input:focus {
border-color: #C8951C !important;
background: #fff !important;
box-shadow: 0 0 0 3px rgba(200,149,28,0.1) !important;
}
/* ── Buttons ── */
.auth-gold-btn:hover:not(:disabled) {
opacity: 0.91;
transform: translateY(-1px);
box-shadow: 0 7px 22px rgba(200,149,28,0.38) !important;
}
.auth-gold-btn:active:not(:disabled) { transform: translateY(0); }
.auth-oauth-btn:hover {
border-color: #C46A4D !important;
background: #FFFCFB !important;
}
.auth-tab-btn {
flex: 1; padding: 10px 0; border: none; cursor: pointer;
font-family: Vazirmatn, sans-serif; font-size: 13px; font-weight: 700;
border-radius: 9px; transition: all 0.22s;
}
.auth-switch-link {
background: none; border: none; cursor: pointer;
color: #C46A4D; font-weight: 700;
font-family: Vazirmatn, sans-serif; font-size: 13px;
text-decoration: underline; text-underline-offset: 3px;
transition: color 0.15s;
}
.auth-switch-link:hover { color: #C8951C; }
.auth-forgot-btn {
background: none; border: none; cursor: pointer;
color: #9AA5A6; font-size: 12px;
font-family: Vazirmatn, sans-serif;
text-decoration: underline; text-underline-offset: 2px;
padding: 0; transition: color 0.15s;
}
.auth-forgot-btn:hover { color: #C46A4D; }
/* ── Chips ── */
.req-chip {
font-size: 10px; padding: 2px 8px; border-radius: 20px;
display: inline-flex; align-items: center; gap: 3px;
transition: all 0.25s; font-family: Vazirmatn, sans-serif;
}
/* ── Brand panel ── */
.ticker-mask {
-webkit-mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
}
.brand-stat { animation: statReveal 0.55s cubic-bezier(.34,1.56,.64,1) both; }
.brand-stat:nth-child(2) { animation-delay: 0.18s; }
.brand-stat:nth-child(3) { animation-delay: 0.33s; }
.auth-card { animation: fadeSlideUp 0.45s cubic-bezier(.2,.8,.2,1) both; }
`})}function Ai({open:t}){return t?e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function qr(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[e.jsx("path",{d:"M17.64 9.2c0-.637-.057-1.251-.164-1.84H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615Z",fill:"#4285F4"}),e.jsx("path",{d:"M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332A8.997 8.997 0 0 0 9 18Z",fill:"#34A853"}),e.jsx("path",{d:"M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332Z",fill:"#FBBC05"}),e.jsx("path",{d:"M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58Z",fill:"#EA4335"})]})}function Gr(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0 1 12 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z"})})}const Pt=["هوش مصنوعی و آینده توسعه نرم‌افزار","امنیت سایبری در دوران پس از کوانتوم","پردازش ابری بومی‌سازی‌شده در ایران","متن‌باز در اکوسیستم فارسی‌زبان","زیرساخت‌های توزیع‌شده مقیاس‌پذیر","یادگیری عمیق با مجموعه‌داده‌های فارسی","معماری میکروسرویس در محیط تولید","مدیریت داده در مقیاس پتابایت"],Qr=[{text:"هوش مصنوعی",s:12,x:6,y:12,spd:3.2},{text:"ابر",s:10,x:72,y:22,spd:4.1},{text:"امنیت",s:11,x:18,y:74,spd:3.6},{text:"متن‌باز",s:10,x:62,y:84,spd:4.5},{text:"پردازش",s:11,x:4,y:48,spd:3.9},{text:"شبکه",s:10,x:76,y:58,spd:3.3},{text:"داده",s:12,x:38,y:8,spd:4.8},{text:"زیرساخت",s:10,x:48,y:91,spd:3.7}];function Yr(){const t=[...Pt,...Pt];return e.jsx("div",{className:"ticker-mask",style:{overflow:"hidden",height:92,width:"100%"},children:e.jsx("div",{style:{animation:"tickerUp 22s linear infinite"},children:t.map((n,i)=>e.jsxs("div",{style:{fontSize:11,color:"rgba(250,247,240,0.26)",padding:"5px 0",borderBottom:"1px solid rgba(250,247,240,0.04)",fontFamily:"Vazirmatn,sans-serif",display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{color:"rgba(200,149,28,0.4)",fontSize:7,flexShrink:0},children:"◉"}),n]},i))})})}function Xr(){const[t,n]=c.useState({x:0,y:0}),i=st(23,700),o=st(8400,1e3),s=st(6,1300);return c.useEffect(()=>{const a=r=>n({x:r.clientX/window.innerWidth-.5,y:r.clientY/window.innerHeight-.5});return window.addEventListener("mousemove",a,{passive:!0}),()=>window.removeEventListener("mousemove",a)},[]),e.jsxs("div",{className:"auth-brand-col",children:[e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",top:"-8%",left:"-14%",fontSize:360,fontWeight:900,lineHeight:1,color:"rgba(255,255,255,0.016)",fontFamily:"PelakFA,Vazirmatn,sans-serif",userSelect:"none",pointerEvents:"none"},children:"ت"}),e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,pointerEvents:"none",backgroundImage:"radial-gradient(circle, rgba(255,255,255,0.032) 1px, transparent 1px)",backgroundSize:"28px 28px"}}),e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",top:"18%",left:"50%",transform:`translate(-50%, 0) translate(${t.x*18}px, ${t.y*18}px)`,width:300,height:300,background:"radial-gradient(circle, rgba(200,149,28,0.14) 0%, transparent 70%)",transition:"transform 0.9s cubic-bezier(.2,.8,.2,1)",pointerEvents:"none"}}),e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",bottom:"-4%",left:"-4%",width:220,height:220,background:"radial-gradient(circle, rgba(196,106,77,0.1) 0%, transparent 70%)",pointerEvents:"none"}}),e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,pointerEvents:"none",transform:`translate(${t.x*-12}px, ${t.y*-12}px)`,transition:"transform 0.8s cubic-bezier(.2,.8,.2,1)"},children:Qr.map((a,r)=>e.jsx("div",{style:{position:"absolute",left:`${a.x}%`,top:`${a.y}%`,fontSize:a.s,color:"rgba(250,247,240,0.13)",fontFamily:"Vazirmatn,sans-serif",padding:"3px 10px",border:"1px solid rgba(250,247,240,0.07)",borderRadius:20,whiteSpace:"nowrap",animation:`float-y ${a.spd}s ease-in-out infinite`,animationDelay:`${r*.38}s`},children:a.text},r))}),e.jsxs("div",{style:{position:"relative",zIndex:1,width:"100%",textAlign:"center"},children:[e.jsxs("div",{style:{position:"relative",width:100,height:100,margin:"0 auto 28px"},children:[e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:-46,border:"1px dashed rgba(200,149,28,0.08)",borderRadius:"50%",animation:"orbit 44s linear infinite"}}),e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:-28,border:"1px solid rgba(200,149,28,0.2)",borderRadius:"50%",animation:"orbitR 17s linear infinite"},children:e.jsx("div",{style:{position:"absolute",top:-4,left:"50%",marginLeft:-4,width:8,height:8,borderRadius:"50%",background:"#C8951C",boxShadow:"0 0 10px rgba(200,149,28,0.7)"}})}),e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:-14,border:"1px solid rgba(250,247,240,0.07)",borderRadius:"50%",animation:"orbit 9s linear infinite"},children:e.jsx("div",{style:{position:"absolute",bottom:-3,left:"50%",marginLeft:-3,width:6,height:6,borderRadius:"50%",background:"rgba(250,247,240,0.3)"}})}),e.jsx("div",{style:{width:"100%",height:"100%",borderRadius:26,background:"linear-gradient(145deg, #C8951C 0%, #F4C36A 50%, #C8951C 100%)",display:"flex",alignItems:"center",justifyContent:"center",animation:"logoGlow 4.5s ease-in-out infinite"},children:e.jsx("span",{style:{color:"#0B2226",fontSize:44,fontWeight:900,fontFamily:"Vazirmatn,sans-serif"},children:"ت"})})]}),e.jsx("div",{style:{fontFamily:"PelakFA,Vazirmatn,sans-serif",fontSize:50,fontWeight:800,color:"#FAF7F0",lineHeight:1,letterSpacing:"-1px",marginBottom:5},children:"تکناو"}),e.jsx("div",{style:{fontSize:10,letterSpacing:"0.32em",fontWeight:500,color:"rgba(250,247,240,0.28)",marginBottom:22},children:"TEKNAV · IR"}),e.jsx("div",{style:{height:1.5,margin:"0 auto 20px",background:"linear-gradient(90deg, transparent, rgba(200,149,28,0.65), transparent)",animation:"dividerExpand 1.2s ease 0.3s both"}}),e.jsxs("p",{style:{fontSize:14,fontFamily:"Vazirmatn,sans-serif",color:"rgba(250,247,240,0.55)",lineHeight:2,direction:"rtl",margin:"0 0 26px"},children:["آخرین دانش فناوری،"," ",e.jsx("span",{style:{color:"rgba(200,149,28,0.88)",fontWeight:600},children:"اول به فارسی"})]}),e.jsx("div",{style:{display:"flex",justifyContent:"center",gap:20,marginBottom:26},children:[{n:i,label:"مقاله",delay:"0s",suffix:"+"},{n:o,label:"خواننده",delay:"0.18s",suffix:""},{n:s,label:"سری",delay:"0.34s",suffix:""}].map(({n:a,label:r,delay:d,suffix:p})=>e.jsxs("div",{className:"brand-stat",style:{animationDelay:d},children:[e.jsxs("div",{style:{fontSize:24,fontWeight:900,color:"#FAF7F0",lineHeight:1,fontFamily:"PelakFA,Vazirmatn,sans-serif"},children:[a.toLocaleString("fa-IR"),p]}),e.jsx("div",{style:{fontSize:10,color:"rgba(250,247,240,0.32)",marginTop:5,letterSpacing:"0.05em"},children:r})]},r))}),e.jsxs("div",{style:{borderTop:"1px solid rgba(250,247,240,0.06)",paddingTop:16,marginBottom:10},children:[e.jsx("div",{style:{fontSize:9,color:"rgba(250,247,240,0.22)",letterSpacing:"0.2em",marginBottom:10,textTransform:"uppercase"},children:"موضوعات داغ"}),e.jsx(Yr,{})]}),e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:7,marginTop:10,fontSize:10,color:"rgba(250,247,240,0.27)",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"#2F8F6B",flexShrink:0,boxShadow:"0 0 0 0 rgba(47,143,107,0.4)",animation:"pulseRing 2.2s infinite",display:"inline-block"}}),"در حال حاضر آنلاین"]})]})]})}function Se({label:t,hint:n,error:i,suffix:o,inputProps:s={}}){const{style:a,...r}=s;return e.jsxs("div",{children:[t&&e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,fontWeight:600,color:i?"#C94C4C":"#7B8C8E",letterSpacing:"0.03em"},children:t}),e.jsxs("div",{style:{position:"relative"},className:"auth-input-wrap",children:[e.jsx("input",{...r,style:{width:"100%",padding:o?"13px 16px 13px 46px":"13px 16px",border:`1.5px solid ${i?"#C94C4C":"#E4DDD2"}`,borderRadius:10,fontSize:14,fontFamily:"Vazirmatn,sans-serif",background:"#FAFAF8",color:"#1A2E30",outline:"none",transition:"border-color 0.2s, background 0.2s, box-shadow 0.2s",...a||{}}}),o&&e.jsx("div",{style:{position:"absolute",left:14,top:"50%",transform:"translateY(-50%)",color:"#9AA5A6",display:"flex",alignItems:"center"},children:o})]}),n&&!i&&e.jsx("div",{style:{fontSize:11,color:"#9AA5A6",marginTop:4,lineHeight:1.6},children:n}),i&&e.jsx("div",{style:{fontSize:11,color:"#C94C4C",marginTop:4},children:i})]})}function Jr({pw:t}){const n=[{label:"۸+ کاراکتر",ok:t.length>=8},{label:"حرف کوچک",ok:/[a-z]/.test(t)},{label:"حرف بزرگ",ok:/[A-Z]/.test(t)},{label:"عدد",ok:/[0-9]/.test(t)},{label:"نماد",ok:/[^a-zA-Z0-9]/.test(t)}],i=n.filter(s=>s.ok).length,o=i<=2?"#C94C4C":i===3?"#D08A22":"#2F8F6B";return e.jsxs("div",{style:{marginTop:8},children:[e.jsx("div",{style:{display:"flex",gap:3,marginBottom:7},children:[1,2,3,4,5].map(s=>e.jsx("div",{style:{flex:1,height:3,borderRadius:2,background:s<=i?o:"#E8E2D8",transition:"background 0.3s"}},s))}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:n.map(({label:s,ok:a})=>e.jsxs("span",{className:"req-chip",style:{background:a?"rgba(47,143,107,0.09)":"#F2EFE9",color:a?"#2F8F6B":"#9AA5A6",border:`1px solid ${a?"rgba(47,143,107,0.22)":"#E4DDD2"}`},children:[a?"✓":"·"," ",s]},s))})]})}function Kr({onClose:t}){const n=te(),[i,o]=c.useState(""),[s,a]=c.useState(!1),[r,d]=c.useState(!1),p=async l=>{if(l.preventDefault(),!i.trim()){n("ایمیل را وارد کنید","error");return}d(!0);try{await S.post("/api/auth/forgot-password",{email:i.trim().toLowerCase()}),a(!0)}catch{n("خطا در ارسال ایمیل. لطفاً دوباره تلاش کنید","error")}finally{d(!1)}};return e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:700,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{onClick:t,style:{position:"absolute",inset:0,background:"rgba(11,34,38,0.62)"}}),e.jsxs("div",{style:{position:"relative",background:"#FAF7F0",borderRadius:18,padding:"36px 32px",maxWidth:400,width:"90%",direction:"rtl",boxShadow:"0 32px 80px rgba(0,0,0,0.24)",fontFamily:"Vazirmatn,sans-serif",border:"1px solid #E4DDD2",animation:"fadeSlideUp 0.25s ease both"},children:[e.jsx("h3",{style:{margin:"0 0 6px",fontSize:18,fontWeight:800,color:"#1A2E30",fontFamily:"PelakFA,Vazirmatn,sans-serif"},children:"بازیابی رمز عبور"}),e.jsx("p",{style:{fontSize:13,color:"#7B8C8E",margin:"0 0 20px",lineHeight:1.7},children:s?"اگر این ایمیل در سیستم ثبت شده باشد، لینک بازنشانی برای شما ارسال خواهد شد.":"آدرس ایمیل ثبت‌شده خود را وارد کنید."}),s?e.jsx("button",{onClick:t,style:Xe(!1),children:"بستن"}):e.jsxs("form",{onSubmit:p,style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(Se,{label:"ایمیل",inputProps:{type:"email",value:i,onChange:l=>o(l.target.value),placeholder:"you@example.com",autoComplete:"email",style:{direction:"ltr",textAlign:"left"}}}),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsx("button",{type:"button",onClick:t,style:ns,children:"انصراف"}),e.jsx("button",{type:"submit",disabled:r,style:{...Xe(r),flex:1},children:r?"…":"ارسال لینک"})]})]})]})]})}function Zr({onSuccess:t}){const{login:n}=ae(),i=te(),[o,s]=c.useState(""),[a,r]=c.useState(""),[d,p]=c.useState({captchaId:"",userSolution:""}),[l,x]=c.useState(!1),[u,g]=c.useState(!1),[b,h]=c.useState(!1),f=async y=>{if(y.preventDefault(),!o||!a){i("نام کاربری/ایمیل و رمز عبور الزامی است","error");return}if(!d.captchaId||!d.userSolution.trim()){i("کد امنیتی را وارد کنید","error");return}x(!0);try{const m=await n(o,a,d.captchaId,d.userSolution);m?t(m):i("ایمیل یا رمز عبور نادرست است","error")}catch(m){m instanceof Re?m.status===429?i("تعداد تلاش‌های ناموفق از حد مجاز گذشت. چند دقیقه صبر کنید","error"):m.status===401?i("نام کاربری، ایمیل یا رمز عبور نادرست است","error"):m.status===403?i("این حساب غیرفعال است","error"):m.status===400?i("کد امنیتی نامعتبر است — کد جدید دریافت کنید","error"):i("خطا در اتصال به سرور","error"):i("خطای غیرمنتظره","error")}finally{x(!1)}};return e.jsxs("form",{onSubmit:f,style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(Se,{label:"نام کاربری یا ایمیل",inputProps:{type:"text",value:o,onChange:y=>s(y.target.value),placeholder:"@username یا you@example.com",autoComplete:"username",style:{direction:"ltr",textAlign:"left"}}}),e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:600,color:"#7B8C8E",letterSpacing:"0.03em"},children:"رمز عبور"}),e.jsx("button",{type:"button",onClick:()=>h(!0),className:"auth-forgot-btn",children:"فراموشی رمز؟"})]}),e.jsx(Se,{inputProps:{type:u?"text":"password",value:a,onChange:y=>r(y.target.value),placeholder:"••••••••",autoComplete:"current-password",style:{direction:"ltr",textAlign:"left"}},suffix:e.jsx("button",{type:"button",onClick:()=>g(y=>!y),style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",color:"#9AA5A6"},children:e.jsx(Ai,{open:u})})})]}),e.jsx(ft,{onChange:p}),e.jsx("button",{type:"submit",disabled:l,className:"auth-gold-btn",style:Xe(l),children:l?e.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx("span",{style:{width:14,height:14,border:"2px solid rgba(15,42,46,0.25)",borderTopColor:"#0F2A2E",borderRadius:"50%",display:"inline-block",animation:"spin 0.7s linear infinite"}}),"در حال ورود..."]}):"ورود به حساب"}),b&&e.jsx(Kr,{onClose:()=>h(!1)})]})}function es({onSuccess:t}){const{signup:n}=ae(),i=te(),[o,s]=c.useState(""),[a,r]=c.useState(""),[d,p]=c.useState(""),[l,x]=c.useState("email"),[u,g]=c.useState(""),[b,h]=c.useState(""),[f,y]=c.useState({captchaId:"",userSolution:""}),[m,v]=c.useState(!1),[j,I]=c.useState(!1),w=l==="phone",D=b&&u===b,L=b&&u!==b,P=async V=>{if(V.preventDefault(),!o.trim()){i("نام الزامی است","error");return}if(!/^[a-z0-9_][a-z0-9_.]{1,28}[a-z0-9_]$/.test(a.trim().toLowerCase().replace(/^@/,""))){i("نام کاربری معتبر وارد کنید","error");return}if(!d.trim()){i(w?"شماره موبایل الزامی است":"ایمیل الزامی است","error");return}if(u.length<8){i("رمز عبور باید حداقل ۸ کاراکتر باشد","error");return}if(u!==b){i("رمزهای عبور تطابق ندارند","error");return}if(!f.captchaId||!f.userSolution.trim()){i("کد امنیتی را وارد کنید","error");return}v(!0);try{const B={name:o.trim(),username:a.trim().toLowerCase().replace(/^@/,""),password:u,captchaId:f.captchaId,userSolution:f.userSolution,...w?{phone:d.trim()}:{email:d.trim().toLowerCase()}},z=await n(B);z&&t(z)}catch(B){if(B instanceof Re)if(B.status===409){const z=B.body?.error;i(z==="username_taken"?"این نام کاربری قبلاً گرفته شده است":w?"این شماره قبلاً ثبت شده است":"این ایمیل قبلاً ثبت شده است","error")}else B.status===429?i("تعداد ثبت‌نام از این آی‌پی زیاد است. کمی صبر کنید","error"):B.status===400?i(B.body?.error==="invalid_captcha"?"کد امنیتی نامعتبر است":"اطلاعات وارد‌شده معتبر نیست","error"):i("خطا در اتصال به سرور","error");else i("خطای غیرمنتظره","error")}finally{v(!1)}};return e.jsxs("form",{onSubmit:P,style:{display:"flex",flexDirection:"column",gap:15},children:[e.jsx(Se,{label:"نام نمایشی",inputProps:{type:"text",value:o,onChange:V=>s(V.target.value),placeholder:"مثال: علی رضایی",autoComplete:"name"}}),e.jsx(Se,{label:"نام کاربری",hint:a?`پروفایل: @${a.replace(/^@/,"")}`:"فقط حروف لاتین، عدد، نقطه و زیرخط",inputProps:{type:"text",value:a,onChange:V=>r(V.target.value.toLowerCase().replace(/^@/,"")),placeholder:"ali_rezaei",autoComplete:"username",style:{direction:"ltr",textAlign:"left"}}}),e.jsxs("div",{children:[e.jsx("div",{style:{display:"flex",background:"#F0EDE6",borderRadius:8,padding:3,gap:3,marginBottom:9,width:"fit-content"},children:[{key:"email",label:"ایمیل"},{key:"phone",label:"موبایل"}].map(V=>e.jsx("button",{type:"button",onClick:()=>{x(V.key),p("")},style:{padding:"5px 16px",borderRadius:6,fontSize:12,fontWeight:600,border:"none",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",background:l===V.key?"#fff":"transparent",color:l===V.key?"#1A2E30":"#9AA5A6",boxShadow:l===V.key?"0 1px 4px rgba(0,0,0,0.07)":"none",transition:"all 0.18s"},children:V.label},V.key))}),e.jsx(Se,{inputProps:{type:w?"tel":"email",value:d,onChange:V=>p(V.target.value),placeholder:w?"09123456789":"you@example.com",autoComplete:w?"tel":"email",style:{direction:"ltr",textAlign:"left"}}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",marginBottom:6,fontSize:12,fontWeight:600,color:"#7B8C8E",letterSpacing:"0.03em"},children:"رمز عبور"}),e.jsx(Se,{inputProps:{type:j?"text":"password",value:u,onChange:V=>g(V.target.value),placeholder:"••••••••",autoComplete:"new-password",style:{direction:"ltr",textAlign:"left"}},suffix:e.jsx("button",{type:"button",onClick:()=>I(V=>!V),style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",color:"#9AA5A6"},children:e.jsx(Ai,{open:j})})}),u&&e.jsx(Jr,{pw:u})]}),e.jsx(Se,{label:"تکرار رمز عبور",error:L?"رمزها تطابق ندارند":void 0,suffix:D?e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"#2F8F6B",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):null,inputProps:{type:"password",value:b,onChange:V=>h(V.target.value),placeholder:"••••••••",autoComplete:"new-password",style:{direction:"ltr",textAlign:"left"}}}),e.jsx(ft,{onChange:y}),e.jsxs("p",{style:{fontSize:11,color:"#9AA5A6",margin:0,lineHeight:1.8},children:["با ثبت‌نام،"," ",e.jsx("a",{href:"#",style:{color:"#C46A4D",textDecoration:"underline",textUnderlineOffset:"2px"},children:"شرایط استفاده"})," ","و"," ",e.jsx("a",{href:"#",style:{color:"#C46A4D",textDecoration:"underline",textUnderlineOffset:"2px"},children:"سیاست حریم خصوصی"})," ","تکناو را می‌پذیرید."]}),e.jsx("button",{type:"submit",disabled:m,className:"auth-gold-btn",style:Xe(m),children:m?e.jsxs("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8},children:[e.jsx("span",{style:{width:14,height:14,border:"2px solid rgba(15,42,46,0.25)",borderTopColor:"#0F2A2E",borderRadius:"50%",display:"inline-block",animation:"spin 0.7s linear infinite"}}),"در حال ثبت‌نام..."]}):"ایجاد حساب کاربری"})]})}function ts({oauthError:t}){const{startOAuth:n}=ae(),[i,o]=c.useState([]);return c.useEffect(()=>{S.get("/api/auth/oauth/providers").then(s=>o(s?.providers??[])).catch(()=>{})},[]),i.length===0&&!t?null:e.jsxs("div",{style:{marginBottom:20},children:[t&&e.jsx("div",{style:{background:"#FEF2F2",border:"1px solid #FCA5A5",borderRadius:10,padding:"10px 14px",marginBottom:14,fontSize:12,color:"#991B1B"},children:t==="account_suspended"?"این حساب معلق شده است":"ورود با این روش ممکن نبود. دوباره تلاش کنید"}),i.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:9},children:[i.includes("google")&&e.jsxs("button",{type:"button",onClick:()=>n("google"),className:"auth-oauth-btn",style:Mt,children:[e.jsx(qr,{}),e.jsx("span",{children:"ادامه با Google"})]}),i.includes("github")&&e.jsxs("button",{type:"button",onClick:()=>n("github"),className:"auth-oauth-btn",style:Mt,children:[e.jsx(Gr,{}),e.jsx("span",{children:"ادامه با GitHub"})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,margin:"18px 0"},children:[e.jsx("div",{style:{flex:1,height:1,background:"#E8E2D8"}}),e.jsx("span",{style:{fontSize:11,color:"#B4BCBE",whiteSpace:"nowrap",letterSpacing:"0.05em"},children:"یا با ایمیل"}),e.jsx("div",{style:{flex:1,height:1,background:"#E8E2D8"}})]})]})]})}function is(){const{navigate:t}=q(),n=te(),{user:i,refreshMe:o}=ae(),[s,a]=c.useState("login"),r=Or(),p=new URLSearchParams(window.location.hash.split("?")[1]||"").get("error")||null,l=new URLSearchParams(window.location.search).get("verifyEmail");c.useEffect(()=>{!l||!i||S.post("/api/auth/email/verify/confirm",{token:l}).then(async()=>{const u=await o?.();n("ایمیل شما تایید شد"),window.history.replaceState(null,"",window.location.pathname+window.location.hash),t((u?.role??i.role)==="reader"?"/":"/admin")}).catch(()=>n("تایید ایمیل ناموفق بود یا لینک منقضی شده است","error"))},[l,i]),c.useEffect(()=>{i&&!l&&t(i.role==="reader"?"/":"/admin")},[i,l]);const x=u=>{n(`خوش آمدید، ${u.name}!`),t(u.role==="reader"?"/":"/admin")};return e.jsxs(e.Fragment,{children:[e.jsx(Ur,{}),e.jsxs("div",{className:"auth-layout",children:[e.jsxs("div",{className:"auth-form-col",children:[e.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,pointerEvents:"none",background:"radial-gradient(ellipse 80% 55% at 50% 5%, rgba(250,247,240,0) 0%, rgba(250,247,240,0.55) 100%)"}}),e.jsxs("div",{style:{width:"100%",maxWidth:420,position:"relative",zIndex:1},children:[e.jsxs("div",{className:"auth-mobile-logo",style:{justifyContent:"center",alignItems:"center",gap:10,marginBottom:32},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:14,background:"linear-gradient(145deg, #C8951C, #D49A2A)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 14px rgba(200,149,28,0.3)"},children:e.jsx("span",{style:{color:"#0F2A2E",fontSize:21,fontWeight:900},children:"ت"})}),e.jsx("span",{style:{fontSize:24,fontWeight:900,color:"#0F2A2E",fontFamily:"PelakFA,Vazirmatn,sans-serif"},children:"تکناو"})]}),e.jsxs("div",{className:"auth-card",style:{marginBottom:22},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[e.jsx("div",{style:{width:3.5,height:30,borderRadius:2,flexShrink:0,background:"linear-gradient(to bottom, #C46A4D, rgba(200,149,28,0.6))"}}),e.jsx("h1",{style:{margin:0,fontFamily:"PelakFA,Vazirmatn,sans-serif",fontSize:25,fontWeight:800,color:"#0F2A2E",lineHeight:1.25},children:s==="login"?r:"عضو تکناو شوید"})]}),e.jsx("p",{style:{margin:"0 0 0 14px",fontSize:13,color:"#9AA5A6",lineHeight:1.6},children:s==="login"?"با حساب کاربری خود وارد شوید":"در چند ثانیه حساب رایگان بسازید"})]}),e.jsx("div",{style:{display:"flex",background:"#EDE9E2",borderRadius:12,padding:4,marginBottom:24,gap:3},children:[{key:"login",label:"ورود"},{key:"signup",label:"ثبت‌نام"}].map(u=>e.jsx("button",{onClick:()=>a(u.key),className:"auth-tab-btn",style:{background:s===u.key?"#fff":"transparent",color:s===u.key?"#0F2A2E":"#9AA5A6",boxShadow:s===u.key?"0 1px 6px rgba(0,0,0,0.1)":"none"},children:u.label},u.key))}),e.jsx(ts,{oauthError:s==="login"?p:null}),e.jsx("div",{className:"auth-card",children:s==="login"?e.jsx(Zr,{onSuccess:x}):e.jsx(es,{onSuccess:x})}),e.jsx("div",{style:{textAlign:"center",marginTop:22,fontSize:13,color:"#9AA5A6"},children:s==="login"?e.jsxs(e.Fragment,{children:["حساب ندارید؟"," ",e.jsx("button",{onClick:()=>a("signup"),className:"auth-switch-link",children:"ثبت‌نام کنید"})]}):e.jsxs(e.Fragment,{children:["قبلاً حساب ساخته‌اید؟"," ",e.jsx("button",{onClick:()=>a("login"),className:"auth-switch-link",children:"وارد شوید"})]})}),e.jsx("div",{style:{textAlign:"center",marginTop:28,fontSize:10,color:"#C4C8C9",letterSpacing:"0.06em"},children:"TEKNAV · نشریه فناوری فارسی"})]})]}),e.jsx(Xr,{})]})]})}const Xe=t=>({width:"100%",padding:"13px 0",borderRadius:10,border:"none",background:t?"#E8E2D8":"linear-gradient(135deg, #C8951C 0%, #D49A2A 60%, #C8951C 100%)",color:t?"#B0B8BA":"#0F2A2E",fontSize:14,fontWeight:700,cursor:t?"not-allowed":"pointer",fontFamily:"Vazirmatn,sans-serif",boxShadow:t?"none":"0 4px 16px rgba(200,149,28,0.22)",transition:"opacity 0.2s, transform 0.15s, box-shadow 0.2s",letterSpacing:"0.02em",marginTop:4}),ns={flex:1,padding:"12px 0",border:"1.5px solid #E4DDD2",borderRadius:10,background:"transparent",color:"#7B8C8E",cursor:"pointer",fontSize:13,fontWeight:600,fontFamily:"Vazirmatn,sans-serif"},Mt={display:"flex",alignItems:"center",justifyContent:"center",gap:10,width:"100%",padding:"11px 0",borderRadius:10,border:"1.5px solid #E4DDD2",background:"#fff",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",fontSize:13,fontWeight:600,color:"#1A2E30",transition:"border-color 0.18s, background 0.18s"};function ze(t={}){const n=new URLSearchParams;Object.entries(t).forEach(([o,s])=>{s!=null&&s!==""&&n.set(o,String(s))});const i=n.toString();return i?`?${i}`:""}function he(t){return t&&{...t,category:t.categorySlug||t.category,tags:Array.isArray(t.tags)?t.tags:[]}}const N={async listArticles(t){const n=await S.get(`/api/admin/articles${ze(t)}`);return{...n,items:(n?.items??[]).map(he)}},async getDashboard(){const t=await S.get("/api/admin/dashboard");return{...t,recentArticles:(t?.recentArticles??[]).map(he),recentActivity:t?.recentActivity??[]}},async getPanelMetrics(){const t=await S.get("/api/admin/panel-metrics");return{...t,recentArticles:(t?.recentArticles??[]).map(he)}},async getWriterDashboard(){const t=await S.get("/api/admin/writer/dashboard");return{...t,recentArticles:(t?.recentArticles??[]).map(he),recentComments:t?.recentComments??[],viewsByDay:t?.viewsByDay??[]}},async getAnalytics(){const t=await S.get("/api/admin/analytics");return{...t,topArticles:(t?.topArticles??[]).map(he),viewsByDay:t?.viewsByDay??[]}},getSeoAudit(){return S.get("/api/admin/seo/audit")},getContentAnalytics(){return S.get("/api/admin/analytics/content")},getNewsletterAnalytics(){return S.get("/api/admin/analytics/newsletter")},getEngagementAnalytics(){return S.get("/api/admin/analytics/engagement")},async createArticle(t){const n=await S.post("/api/admin/articles",t);return he(n.article)},async updateArticle(t,n){const i=await S.patch(`/api/admin/articles/${encodeURIComponent(t)}`,n);return he(i.article)},async addArticleCorrection(t,n){const i=await S.post(`/api/admin/articles/${encodeURIComponent(t)}/corrections`,{note:n});return he(i.article)},async publishArticle(t){const n=await S.post(`/api/admin/articles/${encodeURIComponent(t)}/publish`,{});return he(n.article)},async scheduleArticle(t,n){const i=await S.post(`/api/admin/articles/${encodeURIComponent(t)}/schedule`,{scheduledAt:n});return he(i.article)},deleteArticle(t){return S.del(`/api/admin/articles/${encodeURIComponent(t)}`)},async listCategories(){return(await S.get("/api/admin/categories"))?.items??[]},async createCategory(t){return(await S.post("/api/admin/categories",t)).category},async updateCategory(t,n){return(await S.patch(`/api/admin/categories/${encodeURIComponent(t)}`,n)).category},deleteCategory(t){return S.del(`/api/admin/categories/${encodeURIComponent(t)}`)},async listTags(){return(await S.get("/api/admin/tags"))?.items??[]},async createTag(t){return(await S.post("/api/admin/tags",{name:t})).tag},deleteTag(t){return S.del(`/api/admin/tags/${encodeURIComponent(t)}`)},async listAuthors(){return(await S.get("/api/admin/authors"))?.items??[]},async createAuthor(t){return await S.post("/api/admin/authors",t)},async updateAuthor(t,n){return await S.put(`/api/admin/authors/${encodeURIComponent(t)}`,n)},deleteAuthor(t){return S.del(`/api/admin/authors/${encodeURIComponent(t)}`)},async listUsers(){return(await S.get("/api/admin/users"))?.items??[]},async updateUser(t,n){return(await S.patch(`/api/admin/users/${encodeURIComponent(t)}`,n)).user},async listActivity(t){return(await S.get(`/api/admin/activity${ze(t)}`))?.items??[]},activityExportUrl(t){return`/api/admin/activity/export.csv${ze(t)}`},async listComments(t){const n=await S.get(`/api/admin/comments${ze(t)}`);return{items:n?.items??[],total:n?.total??0}},deleteComment(t){return S.del(`/api/admin/comments/${encodeURIComponent(t)}`)},deleteFlaggedComments(){return S.del("/api/admin/comments")},bulkModerateComments(t,n){return S.post("/api/admin/comments/bulk",{ids:t,action:n})},unflagComment(t){return S.put(`/api/admin/comments/${encodeURIComponent(t)}/unflag`,{})},async listMedia(t){const n=await S.get(`/api/admin/media${ze(t)}`);return{items:n?.items??[],pagination:n?.pagination??null}},deleteMedia(t){return S.del(`/api/admin/media/${encodeURIComponent(t)}`)},upload(t){return S.post("/api/admin/uploads",t)},async listReviews(){return(await S.get("/api/admin/reviews"))?.items??[]},updateReview(t,n){return S.put(`/api/admin/articles/${encodeURIComponent(t)}/review`,n)},async listNewsletterSubscribers(){return(await S.get("/api/admin/newsletter/subscribers"))?.items??[]},async listNewsletterCampaigns(){return(await S.get("/api/admin/newsletter/campaigns"))?.items??[]},async createNewsletterCampaign(t){return(await S.post("/api/admin/newsletter/campaigns",t)).campaign},async sendNewsletterCampaign(t){return(await S.post(`/api/admin/newsletter/campaigns/${encodeURIComponent(t)}/send`,{})).campaign},async listSeries(){return(await S.get("/api/admin/series"))?.items??[]},async createSeries(t){return(await S.post("/api/admin/series",t)).series},async updateSeries(t,n){return(await S.patch(`/api/admin/series/${encodeURIComponent(t)}`,n)).series},deleteSeries(t){return S.del(`/api/admin/series/${encodeURIComponent(t)}`)},async listJobs(t){return(await S.get(`/api/admin/jobs${ze(t)}`))?.items??[]},moderateJob(t,n){return S.patch(`/api/admin/jobs/${encodeURIComponent(t)}`,n)},getClientErrors(){return S.get("/api/admin/errors")}},Ve="/assets/triangle-alert-BCArBAM7.svg",Nt="/assets/pen-line-B1_1Yvo7.svg",Ht="/assets/mail-6DkEUBxI.svg",Vt={admin:[{id:"dashboard",label:"داشبورد",icon:"◈"},{id:"articles",label:"مدیریت مقاله‌ها",icon:"◉"},{id:"create",label:"مقاله جدید",icon:"⊕"},{id:"users",label:"مدیریت کاربران",icon:"◐"},{id:"authors",label:"مدیریت نویسندگان",icon:Nt},{id:"media",label:"کتابخانه رسانه",icon:"▣"},{id:"comments",label:"نظرها",icon:"◌"},{id:"analytics",label:"تحلیل محتوا",icon:"▤"},{id:"reviews",label:"گردش بررسی",icon:"◇"},{id:"newsletter",label:"خبرنامه",icon:Ht},{id:"series",label:"سری مقاله‌ها",icon:"▥"},{id:"categories",label:"دسته‌بندی‌ها",icon:"⬡"},{id:"tags",label:"برچسب‌ها",icon:"⬟"},{id:"seo-audit",label:"ممیزی SEO",icon:"◈"},{id:"jobs",label:"آگهی‌های شغلی",icon:"◑"},{id:"client-errors",label:"خطاهای کلاینت",icon:Ve},{id:"activity",label:"گزارش فعالیت",icon:"◷"}],editor:[{id:"dashboard",label:"داشبورد تحریریه",icon:"◈"},{id:"articles",label:"مقاله‌ها",icon:"◉"},{id:"create",label:"مقاله جدید",icon:"⊕"},{id:"authors",label:"نویسندگان",icon:Nt},{id:"media",label:"کتابخانه رسانه",icon:"▣"},{id:"comments",label:"نظرها",icon:"◌"},{id:"analytics",label:"تحلیل محتوا",icon:"▤"},{id:"reviews",label:"گردش بررسی",icon:"◇"},{id:"newsletter",label:"خبرنامه",icon:Ht},{id:"series",label:"سری مقاله‌ها",icon:"▥"},{id:"categories",label:"دسته‌بندی‌ها",icon:"⬡"}],writer:[{id:"dashboard",label:"داشبورد من",icon:"◈"},{id:"create",label:"نوشتن مقاله",icon:"⊕"},{id:"articles",label:"مقاله‌های من",icon:"◉"},{id:"analytics",label:"تحلیل نوشته‌ها",icon:"▤"},{id:"reviews",label:"گردش بررسی",icon:"◇"}],reviewer:[{id:"dashboard",label:"داشبورد",icon:"◈"},{id:"articles",label:"برای بررسی",icon:"◉"},{id:"reviews",label:"گردش بررسی",icon:"◇"}]},C={primary:"#0F6B73",primaryDark:"#073F45",ink:"#0F2A2E",muted:"#5F6B6D",panel:"#F4EFE6",line:"#E4DDD2"},rs=[{id:"neural",label:"هوش مصنوعی"},{id:"pipeline",label:"فرآیند داده"},{id:"growth",label:"رشد"},{id:"cyber",label:"امنیت"},{id:"chip",label:"سخت‌افزار"},{id:"arch",label:"معماری"},{id:"timeline",label:"زمان‌بندی"},{id:"wave",label:"Wave Stream"},{id:"orbit",label:"System Orbit"},{id:"brain",label:"رابط عصبی"},{id:"database",label:"ساختار داده"},{id:"cloud",label:"زیرساخت ابری"},{id:"quantum",label:"کوانتوم"},{id:"vla",label:"مدل رباتیک"},{id:"dna",label:"بیوتکنولوژی"},{id:"fusion",label:"انرژی هسته‌ای"},{id:"satellite",label:"فضا و ماهواره"},{id:"blockchain",label:"بلاک‌چین"}],ss=Array.from({length:192},(t,n)=>{const i=String(n+1).padStart(3,"0");return{id:`diagram-${i}`,label:`دیاگرام تخصصی ${i}`}}),_t=[...rs,...ss],le={border:"none",cursor:"pointer",padding:"4px 10px",borderRadius:6,fontSize:11,fontFamily:"Vazirmatn,sans-serif",fontWeight:600,whiteSpace:"nowrap"},Ot={admin:"مدیر کل",editor:"سردبیر",writer:"نویسنده",reviewer:"بازبین"},Ut={error:{label:"خطا",color:"#C94C4C",bg:"#FEF2F2"},warning:{label:"هشدار",color:"#C8951C",bg:"#FFFBEB"},info:{label:"پیشنهاد",color:"#0F6B73",bg:"#F0FDFA"}};function ce({loading:t,error:n,empty:i,emptyTitle:o="داده‌ای برای نمایش وجود ندارد"}){return t?e.jsx("div",{style:{color:"#5F6B6D",fontSize:13,padding:"20px 0",direction:"rtl"},children:"در حال بارگذاری داده‌های واقعی از سرور..."}):n?e.jsx(J,{title:"اتصال به API برقرار نشد",subtitle:"داده نمونه نمایش داده نمی‌شود. پس از اتصال به بک‌اند دوباره تلاش کنید."}):i?e.jsx(J,{title:o}):null}const os="/assets/link-DX56eVlT.svg",as="/assets/image-Dta2ws_S.svg",ls="/assets/square-pen-KUTyM2wH.svg",Bi="/assets/lock-B-NiWFan.svg";function ds({selectedDiagram:t,onSelectDiagram:n,onInsert:i}){const[o,s]=c.useState("library"),[a,r]=c.useState("mermaid"),[d,p]=c.useState(""),[l,x]=c.useState({busy:!1,message:""}),u=()=>{if(!d.trim())return;const f=d.replace(/</g,"&lt;").replace(/>/g,"&gt;");i?.(`
<div class="insight-box"><div class="insight-title">دیاگرام کدنویسی‌شده (${a})</div><pre dir="ltr">${f}</pre></div>
`)},g=f=>new Promise((y,m)=>{const v=new FileReader;v.onload=()=>y(String(v.result).split(",")[1]||""),v.onerror=()=>m(v.error),v.readAsDataURL(f)}),b=(f,y)=>{const m=f.name.replace(/</g,"&lt;").replace(/>/g,"&gt;"),v=f.type.startsWith("image/");i?.(v?`
<figure><img src="${y}" alt="${m}" /><figcaption>${m}</figcaption></figure>
`:`
<p><a href="${y}" target="_blank" rel="noopener">${m}</a></p>
`)},h=async f=>{if(f){if(f.size>12*1024*1024){x({busy:!1,message:"حداکثر حجم فایل برای بارگذاری مستقیم ۱۲ مگابایت است."});return}x({busy:!0,message:"در حال بارگذاری فایل..."});try{const y=await g(f),m=await N.upload({filename:f.name,mimeType:f.type||"application/octet-stream",dataBase64:y});b(f,m.url),x({busy:!1,message:"فایل روی سرور محلی ذخیره و به مقاله اضافه شد."})}catch{x({busy:!1,message:"اتصال upload در دسترس نبود؛ فایل درج نشد و داده نمونه یا محلی نمایش داده نمی‌شود."})}}};return e.jsxs("section",{style:{background:"#fff",border:`1px solid ${C.line}`,borderRadius:16,overflow:"hidden",boxShadow:"0 14px 40px rgba(15,42,46,0.06)"},children:[e.jsx("div",{style:{padding:18,background:`linear-gradient(135deg,${C.primary} 0%,${C.primaryDark} 100%)`,color:"#fff",direction:"rtl"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,opacity:.76,marginBottom:4},children:"Artifact Writing"}),e.jsx("h3",{style:{margin:0,fontSize:18,fontWeight:900},children:"کتابخانه دیاگرام و ابزار کدنویسی"})]}),e.jsx("div",{style:{display:"flex",background:"rgba(255,255,255,0.12)",border:"1px solid rgba(255,255,255,0.18)",borderRadius:10,padding:3},children:[["library","قالب‌ها"],["code","کد اختصاصی"]].map(([f,y])=>e.jsx("button",{onClick:()=>s(f),style:{border:0,borderRadius:8,padding:"7px 13px",cursor:"pointer",background:o===f?"#fff":"transparent",color:o===f?C.primary:"#fff",fontWeight:800,fontSize:12},children:y},f))})]})}),e.jsxs("div",{style:{padding:"12px 18px",borderBottom:`1px solid ${C.line}`,background:"#F8FBFA",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[e.jsx("div",{style:{fontSize:12,color:"#5F6B6D",lineHeight:1.7},children:"بارگذاری فایل از همین سرور انجام می‌شود و به CDN خارجی وابسته نیست."}),e.jsxs("label",{style:{...W,background:l.busy?"#5F6B6D":C.primary,color:"#fff",cursor:l.busy?"wait":"pointer",margin:0},children:[l.busy?"در حال بارگذاری...":"بارگذاری فایل",e.jsx("input",{type:"file",disabled:l.busy,onChange:f=>h(f.target.files?.[0]),style:{display:"none"}})]}),l.message&&e.jsx("div",{style:{flexBasis:"100%",fontSize:11,color:l.message.includes("نبود")||l.message.includes("حداکثر")?"#C46A4D":C.primary},children:l.message})]}),o==="library"?e.jsx("div",{style:{padding:18},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.1fr 0.9fr",gap:16},className:"artifact-grid",children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(150px,1fr))",gap:10,maxHeight:360,overflowY:"auto",paddingLeft:4},children:_t.map(f=>e.jsxs("button",{onClick:()=>n(f.id),title:f.label,style:{textAlign:"right",border:`1px solid ${t===f.id?C.primary:C.line}`,background:t===f.id?`${C.primary}10`:"#fff",borderRadius:12,padding:12,cursor:"pointer",boxShadow:t===f.id?"0 8px 24px rgba(15,107,115,0.12)":"none"},children:[e.jsx("div",{style:{height:56,borderRadius:10,marginBottom:9,overflow:"hidden",background:"#F4F0EA",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("div",{style:{width:400,flexShrink:0,transform:"scale(0.33)",transformOrigin:"center",pointerEvents:"none"},children:e.jsx(we,{type:f.id,compact:!0})})}),e.jsx("div",{style:{fontSize:12,fontWeight:800,color:C.ink,lineHeight:1.5},children:f.label})]},f.id))}),e.jsxs("div",{style:{background:C.panel,border:`1px solid ${C.line}`,borderRadius:14,padding:14},children:[e.jsx("div",{style:{fontSize:12,fontWeight:800,color:C.primary,marginBottom:10},children:"پیش‌نمایش زنده"}),e.jsx("div",{style:{background:"#fff",borderRadius:12,padding:10,minHeight:180,display:"flex",alignItems:"center"},children:e.jsx(we,{type:t||_t[0].id,compact:!0})}),e.jsx("p",{style:{margin:"12px 0 0",fontSize:11,lineHeight:1.8,color:"#5F6B6D"},children:"فقط دیاگرام‌های واقعی پشتیبانی‌شده در کد نمایش داده می‌شوند؛ قالب نمونه یا محتوای آزمایشی درج نمی‌شود."})]})]})}):e.jsxs("div",{style:{padding:18,display:"grid",gridTemplateColumns:"1fr 1fr",gap:16},className:"artifact-grid",children:[e.jsxs("div",{children:[e.jsx("div",{style:{display:"flex",gap:8,marginBottom:10},children:["mermaid","plantuml","d2"].map(f=>e.jsx("button",{onClick:()=>r(f),style:{...le,background:a===f?`${C.primary}18`:C.panel,color:a===f?C.primary:"#5F6B6D",padding:"7px 12px"},children:f},f))}),e.jsx("textarea",{value:d,onChange:f=>p(f.target.value),rows:13,spellCheck:!1,style:{...O,direction:"ltr",textAlign:"left",fontFamily:"Consolas, monospace",lineHeight:1.6,resize:"vertical"}}),e.jsx("button",{onClick:u,style:{...W,background:C.primary,color:"#fff",marginTop:10},children:"درج به عنوان Artifact قابل ویرایش"})]}),e.jsxs("div",{style:{background:"#101A1C",color:"#DDEBE9",borderRadius:14,padding:16,minHeight:290,direction:"ltr",overflow:"hidden",border:"1px solid rgba(15,107,115,0.45)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:12,color:"#8CCFD2",fontSize:11},children:[e.jsx("span",{children:"code preview"}),e.jsx("span",{style:{opacity:.7},children:a})]}),d.trim()?e.jsx("pre",{style:{whiteSpace:"pre-wrap",margin:0,fontSize:12,lineHeight:1.7,flex:1,overflowY:"auto"},children:d}):e.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#4A6A6C",fontSize:12,textAlign:"center",lineHeight:1.8},children:["کد ",a," را در کادر چپ بنویسید.",e.jsx("br",{}),e.jsx("span",{style:{opacity:.6,fontSize:10},children:"render در مرورگر پس از درج انجام می‌شود."})]})]})]})]})}function cs({value:t,onChange:n}){const i=c.useRef(null),o=te(),[s,a]=c.useState(!1),[r,d]=c.useState(!1),p=c.useRef(null),l=c.useCallback((v,j="")=>{const I=i.current;if(!I)return;const w=I.selectionStart,D=I.selectionEnd,L=t.slice(w,D)||"متن";let P="";v==="hr"?P=`
<hr />
`:v==="a"?P=`<a href="URL">${L}</a>`:v==="img"?P=`<img src="${j}" alt="" style="max-width:100%;border-radius:8px;margin:12px 0" />`:["h2","h3","blockquote","pre"].includes(v)?P=`<${v}>${L}</${v}>`:v==="ul"?P=`<ul>
<li>${L}</li>
</ul>`:v==="ol"?P=`<ol>
<li>${L}</li>
</ol>`:P=`<${v}>${L}</${v}>`;const V=t.slice(0,w)+P+t.slice(D);n(V),setTimeout(()=>{I.focus(),I.selectionStart=I.selectionEnd=w+P.length},0)},[t,n]),x=c.useCallback(v=>{(v.ctrlKey||v.metaKey)&&(v.key==="b"?(v.preventDefault(),l("strong")):v.key==="i"&&(v.preventDefault(),l("em")))},[l]),u=async v=>{const j=v.target.files?.[0];if(j){d(!0);try{const I=await new Promise((D,L)=>{const P=new FileReader;P.onload=()=>D(P.result.split(",")[1]),P.onerror=L,P.readAsDataURL(j)}),w=await N.upload({filename:j.name,mimeType:j.type,dataBase64:I,webp:s});w?.url?(l("img",w.url),o("تصویر بارگذاری شد")):o("خطا در بارگذاری تصویر","error")}catch{o("خطا در بارگذاری تصویر","error")}finally{d(!1),v.target.value=""}}},[g,b]=c.useState(null),h=({id:v,label:j,onClick:I,title:w,bold:D,mono:L})=>{const P=g===v;return e.jsx("button",{type:"button",title:w||j,onClick:I,onMouseEnter:()=>b(v),onMouseLeave:()=>b(null),style:{padding:"4px 9px",border:"1px solid",borderRadius:5,cursor:"pointer",fontFamily:L?"monospace":"Vazirmatn,sans-serif",fontSize:L?11:12,fontWeight:D?700:400,background:P?"#EFE9E0":"#fff",color:P?"#C46A4D":"#263238",borderColor:P?"#C8951C":"#D4C9B8",transition:"background 0.12s, color 0.12s, border-color 0.12s",lineHeight:1,userSelect:"none"},children:j})},f=()=>e.jsx("div",{style:{width:1,alignSelf:"stretch",background:"#D4C9B8",margin:"2px 3px"}}),y=t.replace(/<[^>]*>/g," ").trim().split(/\s+/).filter(Boolean).length,m=t.replace(/<[^>]*>/g,"").length;return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,padding:"7px 10px",background:"#F9F7F4",border:"1px solid #E4DDD2",borderRadius:"8px 8px 0 0",direction:"ltr"},children:[e.jsx(h,{id:"bold",label:"B",title:"Bold (Ctrl+B)",onClick:()=>l("strong"),bold:!0}),e.jsx(h,{id:"italic",label:"I",title:"Italic (Ctrl+I)",onClick:()=>l("em")}),e.jsx(f,{}),e.jsx(h,{id:"h2",label:"H2",title:"Heading 2",onClick:()=>l("h2")}),e.jsx(h,{id:"h3",label:"H3",title:"Heading 3",onClick:()=>l("h3")}),e.jsx(f,{}),e.jsx(h,{id:"link",label:e.jsx("span",{className:"tek-icon",style:{"--i":`url("${os}")`},"aria-hidden":"true"}),title:"Link",onClick:()=>l("a")}),e.jsx(h,{id:"bq",label:"«»",title:"Blockquote",onClick:()=>l("blockquote")}),e.jsx(h,{id:"code",label:"</>",title:"Inline code",onClick:()=>l("code"),mono:!0}),e.jsx(h,{id:"pre",label:"{ }",title:"Code block",onClick:()=>l("pre"),mono:!0}),e.jsx(f,{}),e.jsx(h,{id:"ul",label:"≡",title:"Bullet list",onClick:()=>l("ul")}),e.jsx(h,{id:"ol",label:"1.",title:"Numbered list",onClick:()=>l("ol")}),e.jsx(h,{id:"hr",label:"—",title:"Horizontal rule",onClick:()=>l("hr")}),e.jsx(f,{}),e.jsxs("label",{title:"بارگذاری تصویر",onMouseEnter:()=>b("img"),onMouseLeave:()=>b(null),style:{padding:"4px 9px",border:"1px solid",borderRadius:5,cursor:"pointer",fontSize:12,background:g==="img"?"#EFE9E0":"#fff",color:g==="img"?"#C46A4D":"#263238",borderColor:g==="img"?"#C8951C":"#D4C9B8",transition:"background 0.12s, color 0.12s, border-color 0.12s",display:"flex",alignItems:"center",gap:4,lineHeight:1,userSelect:"none"},children:[e.jsx("span",{className:"tek-icon",style:{"--i":`url("${as}")`},"aria-hidden":"true"})," ",r?"...":"تصویر",e.jsx("input",{ref:p,type:"file",accept:"image/*",style:{display:"none"},onChange:u})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:4,fontSize:11,color:"#5F6B6D",cursor:"pointer",marginInlineStart:2},children:[e.jsx("input",{type:"checkbox",checked:s,onChange:v=>a(v.target.checked)}),"WebP"]})]}),e.jsx("textarea",{ref:i,value:t,onChange:v=>n(v.target.value),onKeyDown:x,rows:18,style:{...O,resize:"vertical",lineHeight:1.8,direction:"rtl",borderTop:"none",borderBottom:"none",borderRadius:0,fontFamily:"monospace",fontSize:13},dir:"rtl",placeholder:"<p>محتوای مقاله را اینجا بنویسید...</p>"}),e.jsxs("div",{style:{display:"flex",gap:16,padding:"5px 12px",background:"#F9F7F4",border:"1px solid #E4DDD2",borderTop:"none",borderRadius:"0 0 8px 8px",fontSize:11,color:"#8A9A9B",direction:"ltr"},children:[e.jsxs("span",{children:[y.toLocaleString("fa-IR")," کلمه"]}),e.jsxs("span",{children:[m.toLocaleString("fa-IR")," کاراکتر"]})]})]})}function ps(t){if(!t)return"";const n=new Date(t);if(Number.isNaN(n.getTime()))return"";const i=o=>String(o).padStart(2,"0");return`${n.getFullYear()}-${i(n.getMonth()+1)}-${i(n.getDate())}T${i(n.getHours())}:${i(n.getMinutes())}`}function gs({articleId:t,canRestore:n,onClose:i,onRestored:o}){const s=te(),[a,r]=c.useState(1),[d,p]=c.useState(null),[l,x]=c.useState(null),[u,g]=c.useState(null),[b,h]=c.useState(!1);c.useEffect(()=>{p(null),it.list(t,a).then(p).catch(()=>p({items:[],total:0,pages:1}))},[t,a]);const f=async v=>{x(v),g(null);try{const j=await it.get(t,v.id);g(j.revision.content)}catch{g("بارگذاری محتوا ناموفق بود")}},y=async()=>{if(l){h(!0);try{await it.restore(t,l.id),s("نسخه قبلی بازیابی شد"),o?.()}catch{s("بازیابی ناموفق بود","error")}finally{h(!1)}}},m=v=>new Date(v).toLocaleString("fa-IR");return e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:700,display:"flex",alignItems:"stretch",justifyContent:"flex-end"},children:[e.jsx("div",{onClick:i,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),e.jsxs("div",{style:{position:"relative",width:"100%",maxWidth:520,background:"#FAF7F0",display:"flex",flexDirection:"column",direction:"rtl",boxShadow:"-8px 0 40px rgba(0,0,0,0.18)"},children:[e.jsxs("div",{style:{padding:"20px 24px",borderBottom:"1px solid #E4DDD2",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("h3",{style:{margin:0,fontSize:18,fontWeight:900,color:"#263238"},children:"تاریخچه نسخه‌ها"}),e.jsx("button",{onClick:i,style:{background:"none",border:"none",fontSize:20,cursor:"pointer",color:"#5F6B6D"},children:"✕"})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"16px 24px"},children:[d?d.items.length===0?e.jsx("div",{style:{color:"#5F6B6D",fontSize:13},children:"هنوز نسخه‌ای ذخیره نشده است."}):e.jsx("div",{style:{display:"grid",gap:8},children:d.items.map(v=>e.jsxs("button",{onClick:()=>f(v),style:{display:"block",width:"100%",textAlign:"right",background:l?.id===v.id?"#F0F9F4":"#fff",border:`1px solid ${l?.id===v.id?"#3A7D5E":"#E4DDD2"}`,borderRadius:10,padding:"10px 14px",cursor:"pointer"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,color:"#263238",marginBottom:3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v.title}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D"},children:[m(v.createdAt)," · ",v.savedByName??"ناشناس"," · ",v.status]})]},v.id))}):e.jsx("div",{style:{color:"#5F6B6D",fontSize:13},children:"در حال بارگذاری…"}),d&&d.pages>1&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center",marginTop:16},children:[a>1&&e.jsx("button",{onClick:()=>r(v=>v-1),style:{...W,fontSize:12},children:"قبلی"}),e.jsxs("span",{style:{fontSize:12,color:"#5F6B6D",alignSelf:"center"},children:[a," / ",d.pages]}),a<d.pages&&e.jsx("button",{onClick:()=>r(v=>v+1),style:{...W,fontSize:12},children:"بعدی"})]}),l&&e.jsxs("div",{style:{marginTop:20,background:"#fff",border:"1px solid #E4DDD2",borderRadius:10,padding:16},children:[e.jsxs("div",{style:{fontSize:13,fontWeight:700,color:"#263238",marginBottom:10},children:["پیش‌نمایش محتوا — ",l.title]}),u===null?e.jsx("div",{style:{fontSize:12,color:"#5F6B6D"},children:"در حال بارگذاری محتوا…"}):e.jsx("div",{style:{fontSize:13,color:"#263238",lineHeight:1.8,maxHeight:300,overflowY:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:u}})]})]}),n&&l&&e.jsx("div",{style:{padding:"16px 24px",borderTop:"1px solid #E4DDD2"},children:e.jsx("button",{onClick:y,disabled:b,style:{...W,width:"100%",background:"#3A7D5E",color:"#fff",padding:"12px 0",fontSize:14,opacity:b?.6:1},children:b?"…":"بازیابی این نسخه"})})]})]})}function zi({existing:t,onSave:n,role:i="writer"}){const o=te(),[s,a]=c.useState([]),[r,d]=c.useState([]),[p,l]=c.useState(!0),[x,u]=c.useState(!1),[g,b]=c.useState({title:"",subtitle:"",summary:"",category:"",categoryName:"",authorId:"",authorName:"",readTime:7,type:"تحلیل عمیق",status:"پیش‌نویس",tags:"",diagram:"neural",content:"",slug:"",...t,scheduledAt:ps(t?.scheduledAt)}),[h,f]=c.useState(!1),[y,m]=c.useState({}),[v,j]=c.useState(()=>JSON.stringify(g)),I=JSON.stringify(g)!==v;c.useEffect(()=>{let F=!1;return l(!0),u(!1),Promise.all([N.listCategories(),N.listAuthors()]).then(([T,X])=>{if(F)return;const E=T??[],$=X??[];a(E),d($),b(Q=>({...Q,category:Q.category||E[0]?.slug||E[0]?.id||"",categoryName:Q.categoryName||E[0]?.name||"",authorId:Q.authorId||$[0]?.id||"",authorName:Q.authorName||$[0]?.name||""}))}).catch(()=>{F||(a([]),d([]),u(!0))}).finally(()=>{F||l(!1)}),()=>{F=!0}},[]);const w=(F,T)=>b(X=>({...X,[F]:T})),D=F=>b(T=>({...T,content:`${T.content||""}${F}`})),[L,P]=c.useState(!1),[V,B]=c.useState(!1),[z,Y]=c.useState([]),Z=t?.status==="منتشرشده",ne=i==="admin"||i==="editor";c.useEffect(()=>{if(!t?.id)return;qe.heartbeat(t.id).catch(()=>{}),qe.getEditors(t.id).then(T=>Y(T.editors??[])).catch(()=>{});const F=setInterval(()=>{qe.heartbeat(t.id).catch(()=>{}),qe.getEditors(t.id).then(T=>Y(T.editors??[])).catch(()=>{})},3e4);return()=>clearInterval(F)},[t?.id]),c.useEffect(()=>{const F=T=>{(T.ctrlKey||T.metaKey)&&T.key==="s"&&(T.preventDefault(),Z&&ne?oe.current?.("منتشرشده"):oe.current?.("پیش‌نویس"))};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[Z,ne]);const oe=c.useRef(null),ke=(F=g.status)=>{const T={};return g.title.trim()||(T.title="عنوان الزامی است"),g.summary.trim()||(T.summary="خلاصه الزامی است"),g.content.trim()||(T.content="محتوا الزامی است"),g.category||(T.category="دسته‌بندی واقعی از API الزامی است"),g.authorId||(T.authorId="نویسنده واقعی از API الزامی است"),F==="زمان‌بندی‌شده"&&!g.scheduledAt&&(T.scheduledAt="زمان انتشار برای زمان‌بندی الزامی است"),m(T),Object.keys(T).length===0},_=F=>{const T={...g,status:F};if(F==="زمان‌بندی‌شده"&&!T.scheduledAt){m(ee=>({...ee,scheduledAt:"زمان انتشار برای زمان‌بندی الزامی است"})),o("برای زمان‌بندی، تاریخ و ساعت انتشار را وارد کنید","error");return}if(!ke(F)){o("لطفاً فیلدهای الزامی را پر کنید","error");return}const X=s.find(ee=>ee.id===g.category||ee.slug===g.category),E=r.find(ee=>ee.id===g.authorId),$={...T,scheduledAt:T.scheduledAt||null,categoryName:X?.name||g.categoryName,authorName:E?.name||g.authorName,slug:g.slug||g.title.replace(/\s+/g,"-").replace(/[^\w\u0600-\u06FF-]/g,""),tags:typeof g.tags=="string"?g.tags.split(",").map(ee=>ee.trim()).filter(Boolean):g.tags,keywords:typeof g.keywords=="string"?g.keywords.split(",").map(ee=>ee.trim()).filter(Boolean):g.keywords??[]};(t?.id?N.updateArticle(t.id,$):N.createArticle($)).then(()=>{j(JSON.stringify(g)),o(F==="منتشرشده"?"مقاله منتشرشده بروزرسانی شد":F==="پیش‌نویس"?"پیش‌نویس ذخیره شد":F==="زمان‌بندی‌شده"?"مقاله زمان‌بندی شد":"مقاله برای بررسی ارسال شد"),n?.()}).catch(ee=>{ee?.body?.error==="quality_check_failed"?o(`انتشار متوقف شد: ${ee.body.issues?.join("، ")}`,"error"):o("خطا در ذخیره مقاله","error")})};oe.current=_;const R=(F,T,X="text",E=null)=>e.jsxs("div",{style:{marginBottom:18},children:[e.jsx("label",{style:{fontSize:13,fontWeight:600,color:"#5F6B6D",display:"block",marginBottom:6},children:F}),E?e.jsx("select",{value:g[T],onChange:$=>w(T,$.target.value),style:{...O},dir:"rtl",children:E.map($=>e.jsx("option",{value:$.v,children:$.l},$.v))}):X==="textarea"?e.jsx("textarea",{value:g[T],onChange:$=>w(T,$.target.value),rows:T==="content"?14:3,style:{...O,resize:"vertical",lineHeight:1.8},dir:"rtl"}):e.jsx("input",{type:X,value:g[T],onChange:$=>w(T,X==="number"?+$.target.value:$.target.value),style:{...O},dir:"rtl"}),y[T]&&e.jsx("div",{style:{fontSize:12,color:"#C94C4C",marginTop:4},children:y[T]})]});return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:t?.reviewNote?12:24,gap:16,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,color:C.primary,fontWeight:800,marginBottom:4},children:"جریان تولید: نوشتن → Artifact → بازبینی → انتشار"}),e.jsx("h2",{style:{fontSize:24,fontWeight:900,color:C.ink,margin:0,fontFamily:"'PelakFA','Vazirmatn',sans-serif"},children:t?Z?"ویرایش مقاله منتشرشده":"ویرایش مقاله":"مقاله جدید"})]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[z.filter(F=>F.userId!==void 0).length>1&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,background:"#FFF8F0",border:"1px solid #F5C97A",borderRadius:20,padding:"4px 10px",fontSize:11,color:"#7A5A00"},children:[z.slice(0,4).map((F,T)=>e.jsx("span",{title:F.name||F.userId,style:{width:22,height:22,borderRadius:"50%",background:"#E07A3A",color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:9,fontWeight:800,marginLeft:-6,border:"2px solid #fff"},children:(F.name||"؟")[0]},T)),e.jsxs("span",{style:{marginRight:8},children:[z.length," ویرایشگر آنلاین"]})]}),t?.id&&e.jsx("button",{onClick:()=>B(!0),style:{...W,background:"#F4EFE6",color:"#263238",border:"1px solid #E4DDD2",fontSize:12},children:"تاریخچه"}),e.jsx("button",{onClick:()=>f(F=>!F),style:{...W,background:h?C.primary:"#F4EFE6",color:h?"#fff":"#263238",border:`1px solid ${h?C.primary:C.line}`},children:h?"ویرایش":"پیش‌نمایش"})]})]}),V&&t?.id&&e.jsx(gs,{articleId:t.id,canRestore:ne,onClose:()=>B(!1),onRestored:()=>{B(!1),n?.()}}),t?.reviewNote&&e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start",background:"linear-gradient(135deg,#FFF8F0,#FFF3E0)",border:"1px solid rgba(200,149,28,0.35)",borderRadius:10,padding:"12px 16px",marginBottom:20},children:[e.jsx("span",{style:{fontSize:18,flexShrink:0},children:e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Ve}")`},"aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:800,color:"#7A5A00",marginBottom:3},children:"بازخورد ویراستار"}),e.jsx("div",{style:{fontSize:13,color:"#5A4000",lineHeight:1.8},children:t.reviewNote})]})]}),Z&&!ne&&e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start",background:"linear-gradient(135deg,#EFF6FF,#E0EEFF)",border:"1px solid rgba(59,130,246,0.30)",borderRadius:10,padding:"12px 16px",marginBottom:20},children:[e.jsx("span",{style:{fontSize:18,flexShrink:0},children:e.jsx("span",{className:"tek-icon",style:{"--i":`url("${ls}")`},"aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:800,color:"#1E3A6E",marginBottom:3},children:"ویرایش مقاله منتشرشده"}),e.jsx("div",{style:{fontSize:13,color:"#1E3A6E",lineHeight:1.8},children:"تغییرات شما ابتدا پیش‌نویس ذخیره می‌شود و پس از ارسال برای بررسی، سردبیر آن را بررسی کرده و منتشر خواهد کرد."})]})]}),Z&&ne&&e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start",background:"linear-gradient(135deg,#F0FDF4,#DCFCE7)",border:"1px solid rgba(34,197,94,0.30)",borderRadius:10,padding:"12px 16px",marginBottom:20},children:[e.jsx("span",{style:{fontSize:18,flexShrink:0},children:e.jsx("span",{className:"tek-icon",style:{"--i":`url("${wi}")`},"aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:800,color:"#14532D",marginBottom:3},children:"ویرایش مستقیم مقاله منتشرشده"}),e.jsx("div",{style:{fontSize:13,color:"#14532D",lineHeight:1.8},children:"این مقاله هم‌اکنون منتشر است. تغییرات با کلیک «بروزرسانی و انتشار» بلافاصله در سایت اعمال می‌شود. Ctrl+S نیز همین کار را انجام می‌دهد."})]})]}),e.jsx(ce,{loading:p,error:x,empty:!p&&!x&&(s.length===0||r.length===0),emptyTitle:"برای ایجاد مقاله، دسته‌بندی و نویسنده واقعی باید از API دریافت شود"}),!p&&!x&&s.length>0&&r.length>0&&e.jsxs(e.Fragment,{children:[h?e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:32,direction:"rtl"},children:[e.jsx(We,{type:g.type})," ",e.jsx(De,{name:s.find(F=>F.id===g.category||F.slug===g.category)?.name||g.categoryName||"بدون دسته‌بندی",color:s.find(F=>F.id===g.category||F.slug===g.category)?.color}),e.jsx("h1",{style:{fontSize:28,fontWeight:900,color:"#263238",margin:"16px 0 8px",lineHeight:1.4},children:g.title||"عنوان مقاله"}),g.subtitle&&e.jsx("p",{style:{fontSize:18,color:"#5F6B6D",margin:"0 0 8px",lineHeight:1.6,fontWeight:500},children:g.subtitle}),e.jsx("p",{style:{fontSize:16,color:"#5F6B6D",margin:"0 0 24px",lineHeight:1.7},children:g.summary}),g.diagram&&e.jsx("div",{style:{background:"#F4F0EA",borderRadius:12,padding:"20px",marginBottom:28,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(we,{type:g.diagram})}),e.jsx("div",{style:{fontSize:16,lineHeight:2,color:"#263238"},dangerouslySetInnerHTML:{__html:g.content}})]}):e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"0.9fr 1.1fr",gap:24,alignItems:"start"},className:"editor-grid",children:[e.jsxs("div",{style:{background:"#fff",border:`1px solid ${C.line}`,borderRadius:16,padding:22,boxShadow:"0 10px 34px rgba(15,42,46,0.05)"},children:[e.jsx("div",{style:{fontSize:11,fontWeight:800,color:C.primary,letterSpacing:"0.08em",marginBottom:14,paddingBottom:8,borderBottom:`1px solid ${C.line}`},children:"اطلاعات پایه"}),R("عنوان","title"),R("زیرعنوان","subtitle"),R("خلاصه","summary","textarea"),R("دسته‌بندی","category","text",s.map(F=>({v:F.slug||F.id,l:F.name}))),R("نویسنده","authorId","text",r.map(F=>({v:F.id,l:F.name}))),R("نوع محتوا","type","text",["تحلیل عمیق","راهنمای فنی","داده‌نما","پژوهش","پرونده","خبر فوری"].map(F=>({v:F,l:F}))),R("زمان مطالعه (دقیقه)","readTime","number"),R("برچسب‌ها (با کاما جدا کنید)","tags"),e.jsx("div",{style:{fontSize:11,fontWeight:800,color:C.primary,letterSpacing:"0.08em",margin:"20px 0 14px",paddingBottom:8,borderBottom:`1px solid ${C.line}`},children:"نشانه‌گذاری"}),[{key:"premiumOnly",label:"فقط اعضای ویژه",icon:Bi},{key:"sponsored",label:"محتوای حمایت‌شده",icon:xt},{key:"featured",label:"مقاله ویژه",icon:"★"}].map(({key:F,label:T,icon:X})=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"#263238",cursor:"pointer"},children:[e.jsx("span",{style:{fontSize:14},children:Ue(X)}),e.jsx("span",{children:T})]}),e.jsx("button",{type:"button",onClick:()=>w(F,!g[F]),style:{width:44,height:24,borderRadius:12,border:"none",cursor:"pointer",background:g[F]?C.primary:"#D0CCC5",position:"relative",transition:"background 0.2s",flexShrink:0},"aria-pressed":!!g[F],children:e.jsx("span",{style:{position:"absolute",top:3,width:18,height:18,borderRadius:"50%",background:"#fff",transition:"inset-inline-start 0.2s",insetInlineStart:g[F]?23:3}})})]},F)),e.jsx("div",{style:{fontSize:11,fontWeight:800,color:C.primary,letterSpacing:"0.08em",margin:"20px 0 14px",paddingBottom:8,borderBottom:`1px solid ${C.line}`},children:"زمان‌بندی"}),R("زمان انتشار زمان‌بندی‌شده","scheduledAt","datetime-local"),e.jsxs("button",{type:"button",onClick:()=>P(F=>!F),style:{width:"100%",background:"none",border:"none",cursor:"pointer",padding:"10px 0 8px",display:"flex",justifyContent:"space-between",alignItems:"center",fontFamily:"Vazirmatn,sans-serif",marginBottom:2},children:[e.jsx("span",{style:{fontSize:11,fontWeight:800,color:C.primary,letterSpacing:"0.08em"},children:"سئو پیشرفته"}),e.jsx("span",{style:{fontSize:11,color:C.muted,borderBottom:`1px solid ${C.line}`,width:"75%",display:"inline-block"}}),e.jsx("span",{style:{fontSize:12,color:C.primary,marginRight:6},children:L?"▴":"▾"})]}),L&&e.jsxs("div",{style:{paddingTop:4},children:[R("آدرس مقاله (slug)","slug"),R("متا دسکریپشن","metaDescription","textarea"),R("کلیدواژه‌ها (با کاما)","keywords"),R("عنوان Open Graph","ogTitle"),R("توضیح Open Graph","ogDescription","textarea"),R("تصویر Open Graph","ogImage"),R("مسیر canonical","canonicalPath")]})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:18},children:[e.jsx("label",{style:{fontSize:13,fontWeight:600,color:"#5F6B6D",display:"block",marginBottom:6},children:"محتوای مقاله"}),e.jsx(cs,{value:g.content,onChange:F=>w("content",F)}),y.content&&e.jsx("div",{style:{fontSize:12,color:"#C94C4C",marginTop:4},children:y.content})]}),e.jsx(ds,{selectedDiagram:g.diagram,onSelectDiagram:F=>w("diagram",F),onInsert:D})]})]}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:24,flexWrap:"wrap",alignItems:"center"},children:[Z&&ne?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>_("منتشرشده"),style:{...W,background:"#2F8F6B",color:"#fff",padding:"10px 24px"},children:"بروزرسانی و انتشار"}),e.jsx("button",{onClick:()=>_("پیش‌نویس"),style:{...W,background:"#F4EFE6",color:"#263238",border:"1px solid #E4DDD2",padding:"10px 24px"},children:"تبدیل به پیش‌نویس"}),e.jsx("button",{onClick:()=>_("زمان‌بندی‌شده"),style:{...W,background:"#D49A2A",color:"#fff",padding:"10px 24px"},children:"زمان‌بندی مجدد"})]}):Z?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>_("پیش‌نویس"),style:{...W,background:"#F4EFE6",color:"#263238",border:"1px solid #E4DDD2",padding:"10px 24px"},children:"ذخیره پیش‌نویس"}),e.jsx("button",{onClick:()=>_("در انتظار بررسی"),style:{...W,background:"#0F6B73",color:"#fff",padding:"10px 24px"},children:"ارسال برای بررسی مجدد"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>_("پیش‌نویس"),style:{...W,background:"#F4EFE6",color:"#263238",border:"1px solid #E4DDD2",padding:"10px 24px"},children:"ذخیره پیش‌نویس"}),e.jsx("button",{onClick:()=>_("در انتظار بررسی"),style:{...W,background:"#0F6B73",color:"#fff",padding:"10px 24px"},children:"ارسال برای بررسی"}),e.jsx("button",{onClick:()=>_("زمان‌بندی‌شده"),style:{...W,background:"#D49A2A",color:"#fff",padding:"10px 24px"},children:"زمان‌بندی انتشار"})]}),n&&e.jsx("button",{onClick:n,style:{...W,background:"#F4EFE6",color:"#5F6B6D",padding:"10px 24px"},children:"انصراف"}),I&&e.jsx("span",{style:{fontSize:11,color:"#C94C4C",fontWeight:700,marginInlineStart:4},children:"● ذخیره نشده · Ctrl+S"})]})]}),e.jsx("style",{children:`
.editor-grid { grid-template-columns: 0.9fr 1.1fr; }
.artifact-grid { grid-template-columns: 1.1fr 0.9fr; }
.artifact-filters { grid-template-columns: 1fr 170px; }
@media(max-width:980px){
.editor-grid, .artifact-grid, .artifact-filters { grid-template-columns: 1fr !important; }
}
`})]})}function Ei({role:t,onEdit:n}){const{navigate:i}=q(),o=te(),[s,a]=c.useState(""),[r,d]=c.useState(""),[p,l]=c.useState(""),[x,u]=c.useState(null),[g,b]=c.useState([]),[h,f]=c.useState(!0),[y,m]=c.useState(!1),[v,j]=c.useState(!1),I=15,w=()=>(f(!0),m(!1),N.listArticles({limit:100}).then(B=>b(B.items??[])).catch(()=>{b([]),m(!0)}).finally(()=>f(!1)));c.useEffect(()=>{w()},[]),c.useEffect(()=>{if(t!=="admin"&&t!=="editor")return;const B=new EventSource("/api/v1/admin/stream",{withCredentials:!0});return B.addEventListener("view_update",z=>{const Y=JSON.parse(z.data);b(Z=>Z.map(ne=>ne.id===Y.articleId?{...ne,views:Y.views}:ne))}),()=>B.close()},[t]);const D=c.useMemo(()=>{let B=g;if(t==="reviewer"&&(B=g.filter(z=>z.status==="در انتظار بررسی")),s){const z=s.toLowerCase();B=B.filter(Y=>Y.title.toLowerCase().includes(z)||Y.authorName?.toLowerCase().includes(z))}return r&&(B=B.filter(z=>z.status===r)),p&&(B=B.filter(z=>z.contentFreshnessStatus===p)),B},[g,s,r,p,t]),L=async(B,z)=>{try{z==="منتشرشده"?await N.publishArticle(B):await N.updateArticle(B,{status:z}),o("وضعیت مقاله تغییر کرد"),w()}catch(Y){Y?.body?.error==="quality_check_failed"?o(`انتشار متوقف شد: ${Y.body.issues?.join("، ")}`,"error"):o("خطا در تغییر وضعیت مقاله","error")}},P=async B=>{try{await N.deleteArticle(B),o("مقاله حذف شد"),w()}catch{o("خطا در حذف مقاله","error")}u(null)},V=["منتشرشده","پیش‌نویس","در انتظار بررسی","نیازمند اصلاح","زمان‌بندی‌شده"];return e.jsxs("div",{children:[x&&e.jsx(_e,{msg:"آیا از حذف این مقاله اطمینان دارید؟",onConfirm:()=>P(x),onCancel:()=>u(null)}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:20,flexWrap:"wrap"},children:[e.jsx("input",{value:s,onChange:B=>a(B.target.value),placeholder:"جستجوی مقاله...",style:{...O,maxWidth:260},dir:"rtl"}),e.jsxs("select",{value:r,onChange:B=>d(B.target.value),style:{...O,maxWidth:180},dir:"rtl",children:[e.jsx("option",{value:"",children:"همه وضعیت‌ها"}),V.map(B=>e.jsx("option",{value:B,children:B},B))]}),e.jsxs("select",{value:p,onChange:B=>l(B.target.value),style:{...O,maxWidth:180},dir:"rtl",children:[e.jsx("option",{value:"",children:"همه تازگی‌ها"}),e.jsx("option",{value:"current",children:"به‌روز"}),e.jsx("option",{value:"needs_update",children:"نیاز به بازنگری"}),e.jsx("option",{value:"scheduled_refresh",children:"بازنگری برنامه‌ریزی‌شده"}),e.jsx("option",{value:"archived",children:"آرشیو"})]})]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,overflow:"hidden"},children:[e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontFamily:"Vazirmatn,sans-serif",fontSize:13,direction:"rtl"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"#F4EFE6",borderBottom:"1px solid #E4DDD2"},children:["عنوان","نویسنده","دسته","وضعیت","بازدید","تاریخ","اقدام"].map(B=>e.jsx("th",{style:{padding:"12px 16px",textAlign:"right",color:"#5F6B6D",fontWeight:600,whiteSpace:"nowrap"},children:B},B))})}),e.jsx("tbody",{children:(v?D:D.slice(0,I)).map((B,z)=>e.jsxs("tr",{style:{borderBottom:"1px solid #E4DDD2",background:z%2===0?"#fff":"#FDFBF7"},children:[e.jsxs("td",{style:{padding:"12px 16px",maxWidth:280},children:[e.jsxs("div",{style:{fontWeight:600,color:"#263238",cursor:"pointer"},onClick:()=>i("/article/"+B.slug),children:[B.title.slice(0,50),B.title.length>50?"…":""]}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D",marginTop:2},children:[B.readTime," دقیقه · ",B.type]}),B.status==="نیازمند اصلاح"&&B.reviewNote&&e.jsxs("div",{style:{marginTop:6,padding:"5px 9px",background:"rgba(200,149,28,0.10)",border:"1px solid rgba(200,149,28,0.28)",borderRadius:6,fontSize:11,color:"#7A5A00",lineHeight:1.7},children:[e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Ve}")`},"aria-hidden":"true"})," ",B.reviewNote]})]}),e.jsx("td",{style:{padding:"12px 16px",whiteSpace:"nowrap",color:"#5F6B6D"},children:B.authorName}),e.jsx("td",{style:{padding:"12px 16px"},children:e.jsx(De,{name:B.categoryName,small:!0})}),e.jsx("td",{style:{padding:"12px 16px"},children:e.jsx(mt,{status:B.status})}),e.jsx("td",{style:{padding:"12px 16px",whiteSpace:"nowrap",fontSize:12,color:"#5F6B6D"},children:(B.views??0).toLocaleString("fa-IR")}),e.jsx("td",{style:{padding:"12px 16px",whiteSpace:"nowrap",fontSize:12,color:"#5F6B6D"},children:B.date}),e.jsx("td",{style:{padding:"12px 16px"},children:e.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[(t==="admin"||t==="editor")&&B.status==="در انتظار بررسی"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>L(B.id,"منتشرشده"),style:{...le,background:"#2F8F6B18",color:"#2F8F6B"},children:"تأیید"}),e.jsx("button",{onClick:()=>L(B.id,"نیازمند اصلاح"),style:{...le,background:"#C94C4C18",color:"#C94C4C"},children:"رد"})]}),t==="writer"&&B.status==="پیش‌نویس"&&e.jsx("button",{onClick:()=>L(B.id,"در انتظار بررسی"),style:{...le,background:"#D49A2A18",color:"#D49A2A"},children:"ارسال"}),t==="reviewer"&&e.jsx("button",{onClick:()=>L(B.id,"منتشرشده"),style:{...le,background:"#2F8F6B18",color:"#2F8F6B"},children:"تأیید"}),e.jsx("button",{onClick:()=>n(B),style:{...le,background:"#0F6B7318",color:"#0F6B73"},children:"ویرایش"}),t==="admin"&&e.jsx("button",{onClick:()=>u(B.id),style:{...le,background:"#C94C4C18",color:"#C94C4C"},children:"حذف"})]})})]},B.id))})]})}),e.jsx(ce,{loading:h,error:y,empty:!h&&!y&&g.length===0,emptyTitle:"هنوز مقاله‌ای از API دریافت نشده است"}),!h&&!y&&g.length>0&&D.length===0&&e.jsx(J,{title:"موردی مطابق فیلترها یافت نشد"}),!h&&!y&&D.length>I&&e.jsx("div",{style:{padding:"14px 16px",textAlign:"center",borderTop:"1px solid #E4DDD2"},children:e.jsx("button",{onClick:()=>j(B=>!B),style:{background:"none",border:"1px solid #E4DDD2",borderRadius:8,padding:"7px 20px",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",fontSize:12,color:"#5F6B6D"},children:v?"نمایش کمتر ▴":`نمایش ${(D.length-I).toLocaleString("fa-IR")} مورد دیگر ▾`})})]})]})}function xs(){const t=te(),[n,i]=c.useState(""),[o,s]=c.useState(""),[a,r]=c.useState([]),[d,p]=c.useState(!0),[l,x]=c.useState(!1),[u,g]=c.useState(null),b=()=>(p(!0),x(!1),N.listUsers().then(m=>r(m??[])).catch(()=>{r([]),x(!0)}).finally(()=>p(!1)));c.useEffect(()=>{b()},[]);const h=c.useMemo(()=>{let m=a;if(n){const v=n.toLowerCase();m=m.filter(j=>j.name.toLowerCase().includes(v)||j.email.toLowerCase().includes(v))}return o&&(m=m.filter(v=>v.role===o)),m},[a,n,o]),f=async(m,v)=>{try{await N.updateUser(m,{status:v==="active"?"suspended":"active"}),t("وضعیت کاربر تغییر کرد"),b()}catch{t("خطا در تغییر وضعیت کاربر","error")}},y=async(m,v)=>{try{await N.updateUser(m,{role:v}),t("نقش کاربر تغییر کرد"),b()}catch{t("خطا در تغییر نقش کاربر","error")}};return e.jsxs("div",{children:[u&&e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:500,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{onClick:()=>g(null),style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),e.jsxs("div",{style:{position:"relative",background:"#FAF7F0",borderRadius:14,padding:32,maxWidth:420,width:"90%",direction:"rtl",boxShadow:"0 20px 60px rgba(0,0,0,0.2)"},children:[e.jsx("h3",{style:{margin:"0 0 20px",color:"#263238"},children:"جزئیات کاربر"}),e.jsxs("div",{style:{display:"flex",gap:16,marginBottom:20},children:[e.jsx(je,{author:{initials:u.name.slice(0,2),color:"#0F6B73"},size:60}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:"#263238"},children:u.name}),e.jsx("div",{style:{fontSize:13,color:"#5F6B6D",direction:"ltr"},children:u.email}),e.jsx("div",{style:{marginTop:6},children:e.jsx(yt,{role:u.role})})]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,marginBottom:20},children:[["مقاله‌ها",u.articleCount??"—"],["تاریخ عضویت",u.joinDate],["وضعیت",u.status==="active"?"فعال":"غیرفعال"]].map(([m,v])=>e.jsxs("div",{style:{background:"#F4EFE6",borderRadius:8,padding:12},children:[e.jsx("div",{style:{fontSize:11,color:"#5F6B6D"},children:m}),e.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#263238"},children:v})]},m))}),e.jsx("button",{onClick:()=>g(null),style:{...W,background:"#F4EFE6",color:"#263238",width:"100%",justifyContent:"center"},children:"بستن"})]})]}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:20,flexWrap:"wrap"},children:[e.jsx("input",{value:n,onChange:m=>i(m.target.value),placeholder:"جستجوی کاربر...",style:{...O,maxWidth:240},dir:"rtl"}),e.jsxs("select",{value:o,onChange:m=>s(m.target.value),style:{...O,maxWidth:160},dir:"rtl",children:[e.jsx("option",{value:"",children:"همه نقش‌ها"}),["admin","editor","writer","reviewer"].map(m=>e.jsx("option",{value:m,children:Ot[m]},m))]})]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,overflow:"hidden"},children:[e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontFamily:"Vazirmatn,sans-serif",fontSize:13,direction:"rtl"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"#F4EFE6",borderBottom:"1px solid #E4DDD2"},children:["نام","ایمیل","نقش","وضعیت","مقاله‌ها","اقدام"].map(m=>e.jsx("th",{style:{padding:"12px 16px",textAlign:"right",color:"#5F6B6D",fontWeight:600},children:m},m))})}),e.jsx("tbody",{children:h.map((m,v)=>e.jsxs("tr",{style:{borderBottom:"1px solid #E4DDD2",background:v%2===0?"#fff":"#FDFBF7"},children:[e.jsx("td",{style:{padding:"12px 16px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx(je,{author:{initials:m.name.slice(0,2),color:"#0F6B73"},size:32}),e.jsx("span",{style:{fontWeight:600,color:"#263238"},children:m.name})]})}),e.jsx("td",{style:{padding:"12px 16px",direction:"ltr",color:"#5F6B6D",fontSize:12},children:m.email}),e.jsx("td",{style:{padding:"12px 16px"},children:e.jsx("select",{value:m.role,onChange:j=>y(m.id,j.target.value),style:{border:"1px solid #E4DDD2",borderRadius:6,padding:"3px 8px",fontSize:12,fontFamily:"Vazirmatn,sans-serif",background:"#fff"},dir:"rtl",children:["admin","editor","writer","reviewer"].map(j=>e.jsx("option",{value:j,children:Ot[j]},j))})}),e.jsx("td",{style:{padding:"12px 16px"},children:e.jsx("span",{style:{fontSize:12,fontWeight:600,color:m.status==="active"?"#2F8F6B":"#C94C4C"},children:m.status==="active"?"فعال":"غیرفعال"})}),e.jsx("td",{style:{padding:"12px 16px",color:"#5F6B6D"},children:m.articleCount??"—"}),e.jsx("td",{style:{padding:"12px 16px"},children:e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("button",{onClick:()=>g(m),style:{...le,background:"#0F6B7318",color:"#0F6B73"},children:"جزئیات"}),e.jsx("button",{onClick:()=>f(m.id,m.status),style:{...le,background:m.status==="active"?"#C94C4C18":"#2F8F6B18",color:m.status==="active"?"#C94C4C":"#2F8F6B"},children:m.status==="active"?"غیرفعال":"فعال"})]})})]},m.id))})]})}),e.jsx(ce,{loading:d,error:l,empty:!d&&!l&&a.length===0,emptyTitle:"هنوز کاربری از API دریافت نشده است"}),!d&&!l&&a.length>0&&h.length===0&&e.jsx(J,{title:"موردی مطابق فیلترها یافت نشد"})]})]})}function us(){const t=te(),[n,i]=c.useState([]),[o,s]=c.useState(!0),[a,r]=c.useState(!1),[d,p]=c.useState({name:"",description:"",color:"#0F6B73"}),[l,x]=c.useState(null),u=()=>(s(!0),r(!1),N.listCategories().then(h=>i(h??[])).catch(()=>{i([]),r(!0)}).finally(()=>s(!1)));c.useEffect(()=>{u()},[]);const g=async()=>{if(!d.name.trim()){t("نام دسته‌بندی الزامی است","error");return}try{await N.createCategory({...d,slug:d.name.replace(/\s+/g,"-"),diagram:"neural"}),t("دسته‌بندی اضافه شد"),p({name:"",description:"",color:"#0F6B73"}),u()}catch{t("خطا در افزودن دسته‌بندی","error")}},b=async h=>{try{await N.deleteCategory(h),t("دسته‌بندی حذف شد"),u()}catch{t("خطا در حذف دسته‌بندی","error")}x(null)};return e.jsxs("div",{children:[l&&e.jsx(_e,{msg:"آیا از حذف این دسته‌بندی اطمینان دارید؟",onConfirm:()=>b(l),onCancel:()=>x(null)}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:24,marginBottom:24},children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:15,color:"#263238",direction:"rtl"},children:"افزودن دسته‌بندی جدید"}),e.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap",direction:"rtl"},children:[e.jsx("input",{value:d.name,onChange:h=>p(f=>({...f,name:h.target.value})),placeholder:"نام دسته‌بندی",style:{...O,maxWidth:200},dir:"rtl"}),e.jsx("input",{value:d.description,onChange:h=>p(f=>({...f,description:h.target.value})),placeholder:"توضیحات",style:{...O,flex:1,minWidth:200},dir:"rtl"}),e.jsx("input",{type:"color",value:d.color,onChange:h=>p(f=>({...f,color:h.target.value})),style:{width:48,height:40,border:"1px solid #E4DDD2",borderRadius:8,cursor:"pointer",padding:2}}),e.jsx("button",{onClick:g,style:{...W,background:"#0F6B73",color:"#fff"},children:"افزودن"})]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(240px,1fr))",gap:14},children:n.map(h=>e.jsxs("div",{style:{background:"#fff",border:`1px solid ${h.color}30`,borderRadius:10,padding:"16px 18px",borderRight:`4px solid ${h.color}`,direction:"rtl",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"#263238"},children:h.name}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D",marginTop:2},children:[h.articleCount," مقاله"]})]}),e.jsx("button",{onClick:()=>x(h.dbId||h.id),style:{...le,background:"#C94C4C18",color:"#C94C4C"},children:"حذف"})]},h.id))}),e.jsx(ce,{loading:o,error:a,empty:!o&&!a&&n.length===0,emptyTitle:"هنوز دسته‌بندی‌ای در بک‌اند ثبت نشده است"})]})}function hs(){const t=te(),[n,i]=c.useState([]),[o,s]=c.useState(!0),[a,r]=c.useState(!1),[d,p]=c.useState(""),[l,x]=c.useState(null),[u,g]=c.useState(""),b=()=>(s(!0),r(!1),N.listTags().then(m=>i(m??[])).catch(()=>{i([]),r(!0)}).finally(()=>s(!1)));c.useEffect(()=>{b()},[]);const h=async()=>{if(d.trim())try{await N.createTag(d),t("برچسب اضافه شد"),p(""),b()}catch{t("خطا در افزودن برچسب","error")}},f=async m=>{try{await N.deleteTag(m),t("برچسب حذف شد"),b()}catch{t("خطا در حذف برچسب","error")}x(null)},y=u?n.filter(m=>m.name.includes(u)):n;return e.jsxs("div",{children:[l&&e.jsx(_e,{msg:"آیا از حذف این برچسب اطمینان دارید؟",onConfirm:()=>f(l),onCancel:()=>x(null)}),e.jsxs("div",{style:{display:"flex",gap:10,marginBottom:24,direction:"rtl",flexWrap:"wrap"},children:[e.jsx("input",{value:d,onChange:m=>p(m.target.value),onKeyDown:m=>m.key==="Enter"&&h(),placeholder:"برچسب جدید...",style:{...O,maxWidth:220},dir:"rtl"}),e.jsx("button",{onClick:h,style:{...W,background:"#0F6B73",color:"#fff"},children:"افزودن"}),e.jsx("input",{value:u,onChange:m=>g(m.target.value),placeholder:"جستجوی برچسب...",style:{...O,maxWidth:200},dir:"rtl"})]}),e.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:y.map(m=>e.jsxs("div",{style:{background:"#F4EFE6",border:"1px solid #E4DDD2",borderRadius:20,padding:"5px 14px",display:"flex",alignItems:"center",gap:8,direction:"rtl"},children:[e.jsx("span",{style:{fontSize:13,color:"#263238"},children:m.name}),e.jsxs("span",{style:{fontSize:11,color:"#5F6B6D"},children:["(",m.count,")"]}),e.jsx("button",{onClick:()=>x(m.id),style:{background:"none",border:"none",cursor:"pointer",color:"#C94C4C",fontSize:14,padding:0},children:"✕"})]},m.id))}),e.jsx(ce,{loading:o,error:a,empty:!o&&!a&&n.length===0,emptyTitle:"هنوز برچسبی در بک‌اند ثبت نشده است"}),!o&&!a&&n.length>0&&y.length===0&&e.jsx(J,{title:"موردی مطابق جستجو یافت نشد"})]})}function fs(){const t=te(),[n,i]=c.useState([]),[o,s]=c.useState(!0),[a,r]=c.useState(!1),[d,p]=c.useState({name:"",slug:"",specialty:"",bio:"",initials:"",color:"#0F6B73",social:{}}),[l,x]=c.useState(null),[u,g]=c.useState(null),b=()=>(s(!0),r(!1),N.listAuthors().then(v=>i(v??[])).catch(()=>{i([]),r(!0)}).finally(()=>s(!1)));c.useEffect(()=>{b()},[]);const h=async()=>{if(!d.name.trim()||!d.slug.trim()||!d.specialty.trim()){t("نام، نام مستعار و تخصص الزامی است","error");return}try{l?(await N.updateAuthor(l,d),t("نویسنده ویرایش شد")):(await N.createAuthor(d),t("نویسنده اضافه شد")),p({name:"",slug:"",specialty:"",bio:"",initials:"",color:"#0F6B73",social:{}}),x(null),b()}catch{t("خطا در ذخیره نویسنده","error")}},f=async v=>{try{await N.deleteAuthor(v),t("نویسنده حذف شد"),b()}catch{t("خطا در حذف نویسنده","error")}g(null)},y=v=>{p({name:v.name,slug:v.slug,specialty:v.specialty,bio:v.bio||"",initials:v.initials||"",color:v.color||"#0F6B73",social:v.social||{}}),x(v.id)},m=()=>{p({name:"",slug:"",specialty:"",bio:"",initials:"",color:"#0F6B73",social:{}}),x(null)};return e.jsxs("div",{children:[u&&e.jsx(_e,{msg:"آیا از حذف این نویسنده اطمینان دارید؟",onConfirm:()=>f(u),onCancel:()=>g(null)}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:24,marginBottom:24},children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:15,color:"#263238",direction:"rtl"},children:l?"ویرایش نویسنده":"افزودن نویسنده جدید"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,marginBottom:12,direction:"rtl"},children:[e.jsx("input",{value:d.name,onChange:v=>p(j=>({...j,name:v.target.value})),placeholder:"نام نویسنده *",style:O,dir:"rtl"}),e.jsx("input",{value:d.slug,onChange:v=>p(j=>({...j,slug:v.target.value})),placeholder:"نام مستعار (slug) *",style:O,dir:"rtl"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,marginBottom:12,direction:"rtl"},children:[e.jsx("input",{value:d.specialty,onChange:v=>p(j=>({...j,specialty:v.target.value})),placeholder:"تخصص *",style:O,dir:"rtl"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("input",{value:d.initials,onChange:v=>p(j=>({...j,initials:v.target.value})),placeholder:"حروف اول",style:{...O,flex:1},dir:"rtl",maxLength:3}),e.jsx("input",{type:"color",value:d.color,onChange:v=>p(j=>({...j,color:v.target.value})),style:{width:48,height:40,border:"1px solid #E4DDD2",borderRadius:8,cursor:"pointer",padding:2}})]})]}),e.jsx("textarea",{value:d.bio,onChange:v=>p(j=>({...j,bio:v.target.value})),placeholder:"بیوگرافی",style:{...O,minHeight:80,resize:"vertical",fontFamily:"Vazirmatn,sans-serif"},dir:"rtl"}),e.jsxs("div",{style:{display:"flex",gap:10,marginTop:12},children:[e.jsx("button",{onClick:h,style:{...W,background:"#0F6B73",color:"#fff"},children:l?"ذخیره تغییرات":"افزودن"}),l&&e.jsx("button",{onClick:m,style:{...W,background:"#5F6B6D18",color:"#5F6B6D"},children:"انصراف"})]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(320px,1fr))",gap:16},children:n.map(v=>e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:20,direction:"rtl",borderRight:`4px solid ${v.color}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:12},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:`${v.color}18`,display:"flex",alignItems:"center",justifyContent:"center",fontSize:16,fontWeight:700,color:v.color},children:v.initials||v.name.slice(0,2)}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,color:"#263238"},children:v.name}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginTop:2},children:v.specialty})]})]}),v.bio&&e.jsx("div",{style:{fontSize:12,color:"#5F6B6D",marginBottom:12,lineHeight:1.6},children:v.bio}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D",marginBottom:12},children:[v.articleCount||0," مقاله • slug: ",v.slug]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>y(v),style:{...le,background:"#0F6B7318",color:"#0F6B73"},children:"ویرایش"}),e.jsx("button",{onClick:()=>g(v.id),style:{...le,background:"#C94C4C18",color:"#C94C4C"},children:"حذف"})]})]},v.id))}),e.jsx(ce,{loading:o,error:a,empty:!o&&!a&&n.length===0,emptyTitle:"هنوز نویسنده‌ای در بک‌اند ثبت نشده است"})]})}function ms({role:t}){const n=te(),[i,o]=c.useState([]),[s,a]=c.useState(""),[r,d]=c.useState(""),[p,l]=c.useState(!0),[x,u]=c.useState(!1),[g,b]=c.useState(null),h=c.useCallback(()=>(l(!0),u(!1),N.listMedia({q:s,mimeType:r,limit:60}).then(m=>o(m.items??[])).catch(()=>{o([]),u(!0)}).finally(()=>l(!1))),[s,r]);c.useEffect(()=>{h()},[h]);const f=async m=>{try{await navigator.clipboard.writeText(m),n("آدرس رسانه کپی شد")}catch{n("کپی آدرس رسانه ناموفق بود","error")}},y=async m=>{try{await N.deleteMedia(m),n("رسانه حذف شد"),h()}catch(v){n(v.body?.error==="media_in_use"?"این رسانه در محتوا یا پروفایل استفاده شده است":"حذف رسانه ناموفق بود","error")}finally{b(null)}};return e.jsxs("div",{children:[g&&e.jsx(_e,{msg:"آیا از حذف این رسانه مطمئن هستید؟",onConfirm:()=>y(g),onCancel:()=>b(null)}),e.jsxs("div",{style:{display:"flex",gap:12,marginBottom:20,flexWrap:"wrap"},children:[e.jsx("input",{value:s,onChange:m=>a(m.target.value),placeholder:"جستجوی نام فایل...",style:{...O,maxWidth:260},dir:"rtl"}),e.jsxs("select",{value:r,onChange:m=>d(m.target.value),style:{...O,maxWidth:180},dir:"rtl",children:[e.jsx("option",{value:"",children:"همه فایل‌ها"}),e.jsx("option",{value:"image/",children:"تصویرها"}),e.jsx("option",{value:"image/webp",children:"WebP"}),e.jsx("option",{value:"image/png",children:"PNG"}),e.jsx("option",{value:"image/jpeg",children:"JPEG"})]})]}),e.jsx(ce,{loading:p,error:x,empty:!p&&!x&&i.length===0,emptyTitle:"هنوز رسانه‌ای در بک‌اند ثبت نشده است"}),!p&&!x&&i.length>0&&e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(220px,1fr))",gap:16},children:i.map(m=>e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,overflow:"hidden",direction:"rtl"},children:[e.jsx("div",{style:{height:138,background:"#F4EFE6",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},children:m.mimeType?.startsWith("image/")?e.jsx("img",{src:m.url,alt:m.filename,style:{width:"100%",height:"100%",objectFit:"cover"},loading:"lazy"}):e.jsx("span",{style:{color:"#5F6B6D",fontSize:13},children:m.mimeType})}),e.jsxs("div",{style:{padding:14},children:[e.jsx("div",{title:m.filename,style:{fontSize:13,fontWeight:700,color:"#263238",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:m.filename}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D",marginTop:6},children:[m.sizeBytes?`${Math.round(m.sizeBytes/1024).toLocaleString("fa-IR")} KB`:"اندازه نامشخص",m.width&&m.height?` · ${m.width}×${m.height}`:""]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12,flexWrap:"wrap"},children:[e.jsx("button",{onClick:()=>f(m.url),style:{...le,background:"#0F6B7318",color:"#0F6B73"},children:"کپی URL"}),t==="admin"&&e.jsx("button",{onClick:()=>b(m.id),style:{...le,background:"#C94C4C18",color:"#C94C4C"},children:"حذف"})]})]})]},m.id))})]})}function ys(){const t=te(),{navigate:n}=q(),[i,o]=c.useState(!1),[s,a]=c.useState([]),[r,d]=c.useState(!0),[p,l]=c.useState(!1),[x,u]=c.useState(new Set),g=c.useCallback(()=>(d(!0),l(!1),u(new Set),N.listComments({flagged:i,limit:50}).then(j=>a(j.items??[])).catch(()=>{a([]),l(!0)}).finally(()=>d(!1))),[i]);c.useEffect(()=>{g()},[g]);const b=j=>u(I=>{const w=new Set(I);return w.has(j)?w.delete(j):w.add(j),w}),h=()=>u(j=>j.size===s.length?new Set:new Set(s.map(I=>I.id))),f=async j=>{try{await N.deleteComment(j),t("نظر حذف شد"),g()}catch{t("حذف نظر ناموفق بود","error")}},y=async j=>{try{await N.unflagComment(j),t("گزارش‌های نظر پاک شد"),g()}catch{t("پاک کردن گزارش‌ها ناموفق بود","error")}},m=async j=>{const I=[...x];if(I.length)try{await N.bulkModerateComments(I,j),t(`${I.length.toLocaleString("fa-IR")} نظر ${j==="delete"?"حذف شد":j==="approve"?"تأیید شد":"علامت‌گذاری شد"}`),g()}catch{t("عملیات دسته‌ای ناموفق بود","error")}},v=async()=>{if(window.confirm("همه نظرهای گزارش‌شده حذف شوند؟"))try{const j=await N.deleteFlaggedComments();t(`${(j?.deleted??0).toLocaleString("fa-IR")} نظر حذف شد`),g()}catch{t("حذف دسته‌ای ناموفق بود","error")}};return e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,marginBottom:16,flexWrap:"wrap"},children:[e.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,fontSize:13,color:C.ink},children:[e.jsx("input",{type:"checkbox",checked:i,onChange:j=>o(j.target.checked)}),"فقط گزارش‌شده"]}),i&&s.length>0&&e.jsx("button",{onClick:v,style:{...le,background:"#C94C4C",color:"#fff",fontSize:12},children:"حذف همه گزارش‌شده"})]}),e.jsx(ce,{loading:r,error:p,empty:!r&&!p&&s.length===0,emptyTitle:"هنوز نظری برای نمایش وجود ندارد"}),!r&&!p&&s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:10},children:e.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:"#5F6B6D",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:x.size===s.length,onChange:h}),"انتخاب همه"]})}),e.jsx("div",{style:{display:"grid",gap:12},children:s.map(j=>e.jsx("div",{style:{background:"#fff",border:`1px solid ${x.has(j.id)?C.primary:j.flagged?"#C94C4C":"#E4DDD2"}`,borderRadius:12,padding:16,direction:"rtl",transition:"border-color 0.15s"},children:e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"flex-start"},children:[e.jsx("input",{type:"checkbox",checked:x.has(j.id),onChange:()=>b(j.id),style:{marginTop:4,flexShrink:0,accentColor:C.primary}}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:13,fontWeight:800,color:C.ink},children:[j.authorName," ",e.jsxs("span",{style:{color:"#5F6B6D",fontWeight:500},children:["@",j.authorUsername]})]}),e.jsx("button",{onClick:()=>n("/article/"+j.articleSlug),style:{background:"none",border:"none",padding:0,color:C.primary,cursor:"pointer",fontSize:12,fontFamily:"Vazirmatn,sans-serif"},children:j.articleTitle})]}),e.jsx("span",{style:{fontSize:12,color:"#5F6B6D"},children:j.time})]}),e.jsx("p",{style:{fontSize:13,lineHeight:1.8,color:"#263238",margin:"12px 0"},children:j.body}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:12,color:j.flagged?"#C94C4C":"#5F6B6D"},children:[j.flagCount.toLocaleString("fa-IR")," گزارش"]}),e.jsx("button",{onClick:()=>y(j.id),style:{...le,background:"#0F6B7318",color:"#0F6B73"},children:"پاک کردن گزارش"}),e.jsx("button",{onClick:()=>f(j.id),style:{...le,background:"#C94C4C18",color:"#C94C4C"},children:"حذف"})]})]})]})},j.id))})]}),x.size>0&&e.jsxs("div",{style:{position:"fixed",bottom:24,left:"50%",transform:"translateX(-50%)",background:C.ink,color:"#fff",borderRadius:14,padding:"12px 20px",display:"flex",alignItems:"center",gap:12,fontSize:13,fontFamily:"Vazirmatn,sans-serif",zIndex:600,boxShadow:"0 8px 32px rgba(0,0,0,0.3)",direction:"rtl",flexWrap:"wrap",justifyContent:"center"},children:[e.jsxs("span",{style:{fontWeight:700},children:[x.size.toLocaleString("fa-IR")," مورد انتخاب شده"]}),e.jsx("div",{style:{width:1,height:20,background:"rgba(255,255,255,0.2)"}}),e.jsx("button",{onClick:()=>m("delete"),style:{background:"#C94C4C",color:"#fff",border:"none",borderRadius:8,padding:"6px 14px",cursor:"pointer",fontSize:12,fontFamily:"Vazirmatn,sans-serif",fontWeight:700},children:"حذف"}),e.jsx("button",{onClick:()=>m("approve"),style:{background:"#2F8F6B",color:"#fff",border:"none",borderRadius:8,padding:"6px 14px",cursor:"pointer",fontSize:12,fontFamily:"Vazirmatn,sans-serif",fontWeight:700},children:"تأیید"}),e.jsx("button",{onClick:()=>m("flag"),style:{background:"#D49A2A",color:"#fff",border:"none",borderRadius:8,padding:"6px 14px",cursor:"pointer",fontSize:12,fontFamily:"Vazirmatn,sans-serif",fontWeight:700},children:"علامت‌گذاری"}),e.jsx("button",{onClick:()=>u(new Set),style:{background:"rgba(255,255,255,0.1)",color:"#fff",border:"1px solid rgba(255,255,255,0.2)",borderRadius:8,padding:"6px 14px",cursor:"pointer",fontSize:12,fontFamily:"Vazirmatn,sans-serif"},children:"لغو انتخاب"})]})]})}function bs(){const{navigate:t}=q(),[n,i]=c.useState(null),[o,s]=c.useState(!0),[a,r]=c.useState(!1),[d,p]=c.useState(0),l=15;if(c.useEffect(()=>{s(!0),r(!1),N.getSeoAudit().then(i).catch(()=>r(!0)).finally(()=>s(!1))},[]),o||a||!n)return e.jsx(ce,{loading:o,error:a,empty:!o&&!a,emptyTitle:"داده ممیزی از سرور دریافت نشد"});const x=(n.items??[]).filter(f=>f.missing?.length||f.needsRefresh),u=x.reduce((f,y)=>f+(y.missing?.length??0)+(y.needsRefresh?1:0),0),g=x.slice(d*l,(d+1)*l),b=Math.ceil(x.length/l),h=f=>["metaDescription","ogTitle","ogDescription"].includes(f)?"error":["keywords","ogImage","canonicalPath"].includes(f)?"warning":"info";return e.jsxs("div",{style:{direction:"rtl"},children:[e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",marginBottom:20,flexWrap:"wrap"},children:[e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:10,padding:"10px 18px",fontSize:14,fontWeight:700,color:C.ink},children:[u.toLocaleString("fa-IR")," مشکل یافت شد در ",x.length.toLocaleString("fa-IR")," مقاله"]}),x.length===0&&e.jsx("span",{style:{color:"#2F8F6B",fontWeight:700,fontSize:14},children:"✓ همه مقاله‌ها سالم هستند"})]}),x.length>0&&e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,overflow:"hidden"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13,fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"#F4EFE6",borderBottom:"1px solid #E4DDD2"},children:["مقاله","مشکلات","شدت"].map(f=>e.jsx("th",{style:{padding:"10px 16px",textAlign:"right",color:"#5F6B6D",fontWeight:600},children:f},f))})}),e.jsx("tbody",{children:g.map((f,y)=>{const m=[...f.missing??[],...f.needsRefresh?["needsRefresh"]:[]],v=m.some(I=>h(I)==="error")?"error":m.some(I=>h(I)==="warning")?"warning":"info",j=Ut[v];return e.jsxs("tr",{style:{borderBottom:"1px solid #E4DDD2",background:y%2===0?"#fff":"#FDFBF7"},children:[e.jsx("td",{style:{padding:"12px 16px"},children:e.jsx("button",{onClick:()=>t("/article/"+f.article.slug),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:C.primary,fontFamily:"Vazirmatn,sans-serif",fontSize:13,fontWeight:700,textAlign:"right"},children:f.article.title})}),e.jsx("td",{style:{padding:"12px 16px"},children:e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:m.map(I=>{const w=Ut[h(I)];return e.jsx("span",{style:{background:w.bg,color:w.color,border:`1px solid ${w.color}33`,borderRadius:6,padding:"2px 8px",fontSize:11,fontWeight:600},children:I},I)})})}),e.jsx("td",{style:{padding:"12px 16px"},children:e.jsx("span",{style:{background:j.bg,color:j.color,border:`1px solid ${j.color}33`,borderRadius:6,padding:"4px 10px",fontSize:11,fontWeight:700},children:j.label})})]},f.article.id)})})]}),b>1&&e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"center",padding:16,borderTop:"1px solid #E4DDD2"},children:[e.jsx("button",{onClick:()=>p(f=>Math.max(0,f-1)),disabled:d===0,style:{...W,background:"#F4EFE6",color:"#263238",opacity:d===0?.5:1},children:"قبلی"}),e.jsxs("span",{style:{fontSize:13,color:"#5F6B6D",alignSelf:"center"},children:["صفحه ",(d+1).toLocaleString("fa-IR")," از ",b.toLocaleString("fa-IR")]}),e.jsx("button",{onClick:()=>p(f=>Math.min(b-1,f+1)),disabled:d>=b-1,style:{...W,background:"#F4EFE6",color:"#263238",opacity:d>=b-1?.5:1},children:"بعدی"})]})]})]})}function js(){const[t,n]=c.useState(null),[i,o]=c.useState(!0),[s,a]=c.useState(!1);if(c.useEffect(()=>{o(!0),a(!1),N.getEngagementAnalytics().then(n).catch(()=>a(!0)).finally(()=>o(!1))},[]),i||s||!t)return e.jsx(ce,{loading:i,error:s,empty:!i&&!s,emptyTitle:"هنوز داده تعامل از API دریافت نشده است"});const r=t.byType??[],d=r.reduce((u,g)=>u+Number(g.count??0),0),p=(t.topArticles??[]).slice(0,5),l=t.weeklyData??[],x=Math.max(...l.map(u=>u.count??0),1);return e.jsxs("div",{style:{display:"grid",gap:18,direction:"rtl"},children:[l.length>0&&e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:18},children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:15,color:C.ink},children:"رویدادهای ۷ روز گذشته"}),e.jsx("div",{style:{display:"flex",gap:4,alignItems:"flex-end",height:100},children:l.map((u,g)=>e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[e.jsx("div",{style:{fontSize:10,color:"#5F6B6D"},children:Number(u.count??0).toLocaleString("fa-IR")}),e.jsx("div",{style:{width:"100%",background:C.primary,borderRadius:"4px 4px 0 0",height:`${Math.round((u.count??0)/x*70)}px`,minHeight:2}}),e.jsx("div",{style:{fontSize:9,color:"#5F6B6D",transform:"rotate(-35deg)",transformOrigin:"center",whiteSpace:"nowrap"},children:u.date??""})]},g))})]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:18},children:[e.jsx("h3",{style:{margin:"0 0 12px",fontSize:15,color:C.ink},children:"انواع رویداد"}),r.length===0?e.jsx(J,{title:"هنوز رویدادی ثبت نشده است"}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13,fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{borderBottom:"1px solid #E4DDD2"},children:["نوع رویداد","تعداد","درصد"].map(u=>e.jsx("th",{style:{padding:"8px 12px",textAlign:"right",color:"#5F6B6D",fontWeight:600},children:u},u))})}),e.jsx("tbody",{children:r.map(u=>e.jsxs("tr",{style:{borderBottom:"1px solid #E4DDD2"},children:[e.jsx("td",{style:{padding:"8px 12px",color:C.ink,fontWeight:600},children:u.type}),e.jsx("td",{style:{padding:"8px 12px",color:"#263238"},children:Number(u.count??0).toLocaleString("fa-IR")}),e.jsx("td",{style:{padding:"8px 12px",color:"#5F6B6D"},children:d>0?`${Math.round(Number(u.count??0)/d*100)}٪`:"—"})]},u.type))})]})]}),p.length>0&&e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:18},children:[e.jsx("h3",{style:{margin:"0 0 12px",fontSize:15,color:C.ink},children:"۵ مقاله برتر بر اساس تعامل"}),p.map((u,g)=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,padding:"8px 0",borderBottom:"1px solid #E4DDD2"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:700,color:C.ink},children:u.title}),e.jsxs("span",{style:{fontSize:12,color:"#5F6B6D",whiteSpace:"nowrap"},children:[Number(u.eventCount??0).toLocaleString("fa-IR")," رویداد"]})]},u.id??g))]})]})}function vs(){const[t,n]=c.useState("overview"),[i,o]=c.useState(null),[s,a]=c.useState(!0),[r,d]=c.useState(!1);c.useEffect(()=>{let x=!1;return N.getAnalytics().then(u=>{x||o(u)}).catch(()=>{x||d(!0)}).finally(()=>{x||a(!1)}),()=>{x=!0}},[]);const p=[{id:"overview",label:"مروری"},{id:"engagement",label:"تعامل"}],l=x=>({background:t===x?C.primary:"transparent",color:t===x?"#fff":"#5F6B6D",border:`1px solid ${t===x?C.primary:"#E4DDD2"}`,borderRadius:8,padding:"6px 16px",fontSize:12,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",transition:"all 0.15s"});return e.jsxs("div",{style:{direction:"rtl"},children:[e.jsx("div",{style:{display:"flex",gap:8,marginBottom:20},children:p.map(x=>e.jsx("button",{style:l(x.id),onClick:()=>n(x.id),children:x.label},x.id))}),t==="engagement"?e.jsx(js,{}):e.jsx(e.Fragment,{children:s||r||!i?e.jsx(ce,{loading:s,error:r,empty:!s&&!r,emptyTitle:"هنوز داده تحلیلی از API دریافت نشده است"}):e.jsxs("div",{style:{display:"grid",gap:18},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(160px,1fr))",gap:12},children:[["نظرها",i.comments],["ذخیره‌ها",i.saved],["مشترکان خبرنامه",i.subscribers]].map(([x,u])=>e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:16},children:[e.jsx("div",{style:{fontSize:12,color:"#5F6B6D"},children:x}),e.jsx("div",{style:{fontSize:24,fontWeight:900,color:C.primary},children:Number(u??0).toLocaleString("fa-IR")})]},x))}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:18},children:[e.jsx("h3",{style:{margin:"0 0 12px",fontSize:15,color:C.ink},children:"مقاله‌های برتر"}),(i.topArticles??[]).length===0?e.jsx(J,{title:"مقاله‌ای برای تحلیل وجود ندارد"}):i.topArticles.map(x=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,padding:"10px 0",borderBottom:"1px solid #E4DDD2"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:800,color:C.ink},children:x.title}),e.jsxs("span",{style:{fontSize:12,color:"#5F6B6D"},children:[Number(x.views??0).toLocaleString("fa-IR")," بازدید"]})]},x.id))]})]})})]})}function ws(){const[t,n]=c.useState([]),[i,o]=c.useState(""),[s,a]=c.useState(!0),[r,d]=c.useState(""),p=(g=i)=>{a(!0),N.listJobs(g?{status:g}:{}).then(b=>{n(b),a(!1)}).catch(()=>a(!1))};c.useEffect(()=>{p()},[]);const l=async(g,b)=>{await N.moderateJob(g,{status:b}),d(`وضعیت به "${b}" تغییر یافت`),setTimeout(()=>d(""),2500),p()},x={pending:"در انتظار",approved:"تأیید شده",rejected:"رد شده"},u={pending:"#D49A2A",approved:"#0F6B73",rejected:"#C46A4D"};return e.jsxs("div",{style:{direction:"rtl"},children:[e.jsxs("div",{style:{display:"flex",gap:10,marginBottom:18,flexWrap:"wrap",alignItems:"center"},children:[e.jsxs("select",{value:i,onChange:g=>{o(g.target.value),p(g.target.value)},style:{...O,width:160},children:[e.jsx("option",{value:"",children:"همه وضعیت‌ها"}),e.jsx("option",{value:"pending",children:"در انتظار"}),e.jsx("option",{value:"approved",children:"تأیید شده"}),e.jsx("option",{value:"rejected",children:"رد شده"})]}),r&&e.jsx("span",{style:{color:"#0F6B73",fontSize:13,fontWeight:600},children:r})]}),s&&e.jsx("div",{style:{color:C.muted,fontSize:14},children:"در حال بارگذاری..."}),!s&&t.length===0&&e.jsx("div",{style:{color:C.muted,fontSize:14,textAlign:"center",padding:40},children:"هیچ آگهی یافت نشد"}),!s&&t.length>0&&e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:"#F4EFE6"},children:["شرکت","عنوان","موقعیت","وضعیت","تاریخ","عملیات"].map(g=>e.jsx("th",{style:{padding:"10px 14px",textAlign:"right",fontWeight:700,color:C.ink,borderBottom:`1px solid ${C.line}`},children:g},g))})}),e.jsx("tbody",{children:t.map(g=>e.jsxs("tr",{style:{borderBottom:`1px solid ${C.line}`},children:[e.jsx("td",{style:{padding:"10px 14px"},children:g.company}),e.jsx("td",{style:{padding:"10px 14px",maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.title}),e.jsxs("td",{style:{padding:"10px 14px"},children:[g.location,g.remote?" (ریموت)":""]}),e.jsx("td",{style:{padding:"10px 14px"},children:e.jsx("span",{style:{background:(u[g.status]??"#999")+"22",color:u[g.status]??"#999",borderRadius:6,padding:"2px 10px",fontWeight:700,fontSize:12},children:x[g.status]??g.status})}),e.jsx("td",{style:{padding:"10px 14px",color:C.muted},children:new Date(g.createdAt).toLocaleDateString("fa-IR")}),e.jsx("td",{style:{padding:"10px 14px"},children:e.jsxs("div",{style:{display:"flex",gap:6},children:[g.status!=="approved"&&e.jsx("button",{onClick:()=>l(g.id,"approved"),style:{...W,background:"#0F6B7318",color:"#0F6B73",fontSize:11,padding:"4px 10px"},children:"تأیید"}),g.status!=="rejected"&&e.jsx("button",{onClick:()=>l(g.id,"rejected"),style:{...W,background:"#C46A4D18",color:"#C46A4D",fontSize:11,padding:"4px 10px"},children:"رد"})]})})]},g.id))})]})})]})}function ks(){const[t,n]=c.useState(null),[i,o]=c.useState(!0);if(c.useEffect(()=>{N.getClientErrors().then(a=>{n(a),o(!1)}).catch(()=>o(!1))},[]),i)return e.jsx("div",{style:{color:C.muted,fontSize:14},children:"در حال بارگذاری..."});if(!t)return e.jsx("div",{style:{color:C.muted,fontSize:14,textAlign:"center",padding:40},children:"خطا در بارگذاری اطلاعات"});const s=Math.max(...t.topErrors?.map(a=>a.count)??[1],1);return e.jsxs("div",{style:{direction:"rtl"},children:[t.dailyCounts?.length>0&&e.jsxs("div",{style:{background:"#fff",border:`1px solid ${C.line}`,borderRadius:12,padding:20,marginBottom:20},children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:C.ink,marginBottom:12},children:"خطاها در ۳۰ روز گذشته"}),e.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:60},children:t.dailyCounts.slice(-30).map(a=>{const r=Math.max(4,Math.round(a.count/s*56));return e.jsx("div",{title:`${a.day}: ${a.count} خطا`,style:{flex:1,height:r,background:"#C46A4D88",borderRadius:2,minWidth:4}},a.day)})})]}),e.jsxs("div",{style:{background:"#fff",border:`1px solid ${C.line}`,borderRadius:12,padding:20,marginBottom:20},children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:C.ink,marginBottom:12},children:"پرتکرارترین خطاها"}),(t.topErrors??[]).length===0&&e.jsx("div",{style:{color:C.muted,fontSize:13},children:"خطایی ثبت نشده است"}),(t.topErrors??[]).map((a,r)=>e.jsxs("div",{style:{borderBottom:`1px solid ${C.line}`,padding:"8px 0",display:"flex",justifyContent:"space-between",gap:12},children:[e.jsx("span",{style:{fontSize:12,color:C.ink,flex:1,wordBreak:"break-all"},children:a.message}),e.jsxs("div",{style:{display:"flex",gap:12,flexShrink:0,fontSize:11,color:C.muted},children:[e.jsxs("span",{style:{color:"#C46A4D",fontWeight:700},children:[a.count," بار"]}),e.jsx("span",{children:new Date(a.lastSeen).toLocaleDateString("fa-IR")})]})]},r))]}),e.jsxs("div",{style:{background:"#fff",border:`1px solid ${C.line}`,borderRadius:12,padding:20},children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:C.ink,marginBottom:12},children:"آخرین خطاهای کلاینت"}),(t.recent??[]).length===0&&e.jsx("div",{style:{color:C.muted,fontSize:13},children:"خطایی ثبت نشده است"}),(t.recent??[]).map(a=>e.jsxs("div",{style:{borderBottom:`1px solid ${C.line}`,padding:"8px 0",fontSize:12},children:[e.jsx("div",{style:{color:C.ink,marginBottom:2},children:a.message}),e.jsxs("div",{style:{color:C.muted,display:"flex",gap:12},children:[a.url&&e.jsx("span",{children:a.url}),e.jsx("span",{children:new Date(a.createdAt).toLocaleDateString("fa-IR")})]})]},a.id))]})]})}function Ss(){const[t,n]=c.useState([]),[i,o]=c.useState(!0),[s,a]=c.useState(!1),r=()=>N.listReviews().then(n).catch(()=>a(!0)).finally(()=>o(!1));c.useEffect(()=>{r()},[]);const d=async(p,l)=>{await N.updateReview(p,{status:l}),r()};return i||s||t.length===0?e.jsx(ce,{loading:i,error:s,empty:!i&&!s&&t.length===0,emptyTitle:"موردی در گردش بررسی وجود ندارد"}):t.map(p=>e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:16,marginBottom:12,direction:"rtl"},children:[e.jsx("div",{style:{fontWeight:900,color:C.ink,marginBottom:4},children:p.article?.title}),e.jsxs("div",{style:{fontSize:12,color:"#5F6B6D",marginBottom:12},children:[p.status," · ",p.reviewer?.name??"بدون بازبین"]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsx("button",{onClick:()=>d(p.article.id,"approved"),style:{...W,background:"#0F6B73",color:"#fff"},children:"تأیید"}),e.jsx("button",{onClick:()=>d(p.article.id,"revision_requested"),style:{...W,background:"#F4EFE6",color:"#C46A4D",border:"1px solid #E4DDD2"},children:"نیاز به اصلاح"}),e.jsx("button",{onClick:()=>d(p.article.id,"rejected"),style:{...W,background:"#C94C4C",color:"#fff"},children:"رد"})]})]},p.id))}function Fs(){const t=te(),[n,i]=c.useState([]),[o,s]=c.useState([]),[a,r]=c.useState(""),[d,p]=c.useState(""),l=()=>Promise.all([N.listNewsletterCampaigns(),N.listNewsletterSubscribers()]).then(([g,b])=>{i(g),s(b)});c.useEffect(()=>{l().catch(()=>{})},[]);const x=async g=>{g.preventDefault(),await N.createNewsletterCampaign({subject:a,bodyHtml:d}),r(""),p(""),t("کمپین خبرنامه ذخیره شد"),l()},u=async g=>{await N.sendNewsletterCampaign(g),t("کمپین ارسال شد"),l()};return e.jsxs("div",{style:{display:"grid",gap:18,direction:"rtl"},children:[e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:16},children:["مشترکان واقعی API: ",o.length.toLocaleString("fa-IR")]}),e.jsxs("form",{onSubmit:x,style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:16,display:"grid",gap:10},children:[e.jsx("input",{value:a,onChange:g=>r(g.target.value),placeholder:"موضوع کمپین",style:O,dir:"rtl"}),e.jsx("textarea",{value:d,onChange:g=>p(g.target.value),placeholder:"HTML خبرنامه",style:{...O,minHeight:140},dir:"rtl"}),e.jsx("button",{style:{...W,background:C.primary,color:"#fff",justifySelf:"start"},children:"ذخیره کمپین"})]}),n.map(g=>e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:16},children:[e.jsx("div",{style:{fontWeight:900,color:C.ink},children:g.subject}),e.jsx("div",{style:{fontSize:12,color:"#5F6B6D",margin:"6px 0 12px"},children:g.sentAt?`ارسال‌شده به ${g.recipientCount}`:"آماده ارسال"}),!g.sentAt&&e.jsx("button",{onClick:()=>u(g.id),style:{...W,background:C.primary,color:"#fff"},children:"ارسال"})]},g.id))]})}function Ds(){const t=te(),[n,i]=c.useState([]),[o,s]=c.useState(""),[a,r]=c.useState(""),d=()=>N.listSeries().then(i).catch(()=>i([]));c.useEffect(()=>{d()},[]);const p=async l=>{l.preventDefault(),await N.createSeries({title:o,description:a,articleIds:[]}),s(""),r(""),t("سری مقاله ایجاد شد"),d()};return e.jsxs("div",{style:{display:"grid",gap:18,direction:"rtl"},children:[e.jsxs("form",{onSubmit:p,style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:16,display:"grid",gap:10},children:[e.jsx("input",{value:o,onChange:l=>s(l.target.value),placeholder:"عنوان سری",style:O,dir:"rtl"}),e.jsx("textarea",{value:a,onChange:l=>r(l.target.value),placeholder:"توضیح کوتاه",style:{...O,minHeight:80},dir:"rtl"}),e.jsx("button",{style:{...W,background:C.primary,color:"#fff",justifySelf:"start"},children:"ایجاد سری"})]}),n.length===0?e.jsx(J,{title:"هنوز سری مقاله‌ای در API نیست"}):n.map(l=>e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:16},children:[e.jsx("div",{style:{fontWeight:900,color:C.ink},children:l.title}),e.jsxs("div",{style:{fontSize:12,color:"#5F6B6D",marginTop:4},children:[(l.articles??[]).length.toLocaleString("fa-IR")," مقاله · /series/",l.slug]})]},l.id))]})}function Cs({activeTab:t,onTab:n,user:i,open:o,onClose:s}){const a=Vt[i?.role]||Vt.writer;return e.jsxs(e.Fragment,{children:[o&&e.jsx("div",{onClick:s,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:299,display:"none"},className:"admin-overlay"}),e.jsxs("aside",{className:`admin-sidebar${o?" open":""}`,style:{width:256,background:`linear-gradient(180deg,${C.primaryDark} 0%,${C.primary} 52%,#0A3136 100%)`,minHeight:"100%",padding:"22px 0",display:"flex",flexDirection:"column",flexShrink:0,boxShadow:"-14px 0 40px rgba(15,42,46,0.16)"},children:[e.jsxs("div",{style:{padding:"0 22px 22px",borderBottom:"1px solid rgba(250,247,240,0.14)"},children:[e.jsx("div",{style:{fontSize:24,fontWeight:900,color:"#fff",marginBottom:4,fontFamily:"'PelakFA','Vazirmatn',sans-serif"},children:"تکناو"}),e.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.72)",letterSpacing:"0.02em"},children:"پنل تولید محتوا"})]}),e.jsx("div",{style:{padding:"18px 12px",flex:1},children:a.map(r=>e.jsxs("button",{onClick:()=>n(r.id),style:{display:"flex",alignItems:"center",gap:12,width:"100%",textAlign:"right",padding:"12px 14px",marginBottom:6,background:t===r.id?"rgba(250,247,240,0.96)":"transparent",border:"1px solid",borderColor:t===r.id?"rgba(250,247,240,0.95)":"transparent",borderRadius:12,color:t===r.id?C.primary:"rgba(255,255,255,0.74)",fontSize:13,fontFamily:"Vazirmatn,sans-serif",fontWeight:t===r.id?800:600,cursor:"pointer",transition:"all 0.18s",boxShadow:t===r.id?"0 12px 28px rgba(0,0,0,0.18)":"none"},children:[e.jsx("span",{style:{fontSize:15,width:26,height:26,borderRadius:8,display:"inline-flex",alignItems:"center",justifyContent:"center",background:t===r.id?`${C.primary}14`:"rgba(255,255,255,0.10)"},children:Ue(r.icon)}),r.label]},r.id))}),e.jsxs("div",{style:{padding:"16px 20px",borderTop:"1px solid rgba(250,247,240,0.14)"},children:[e.jsx("div",{style:{fontSize:12,color:"rgba(255,255,255,0.72)",marginBottom:6},children:i?.name}),e.jsx(yt,{role:i?.role})]})]})]})}function As(){const[t,n]=c.useState({count:0,guests:0,users:0,commentsPerMin:0}),[i,o]=c.useState([]),[s,a]=c.useState(!1);return c.useEffect(()=>{const r=new EventSource("/api/v1/admin/stream",{withCredentials:!0});return r.onopen=()=>a(!0),r.onerror=()=>a(!1),r.addEventListener("visitor_update",d=>{try{const p=JSON.parse(d.data);n({count:p.count||0,guests:p.guests||0,users:p.users||0,commentsPerMin:p.commentsPerMin||0})}catch{}}),r.addEventListener("activity",d=>o(p=>[JSON.parse(d.data),...p].slice(0,50))),()=>r.close()},[]),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:18,marginBottom:20,direction:"rtl"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,alignItems:"center",flexWrap:"wrap",marginBottom:16},children:[e.jsx("strong",{style:{fontSize:14,color:C.ink},children:"وضعیت زنده"}),e.jsxs("span",{style:{fontSize:12,color:s?"#2F8F6B":"#C94C4C",display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:s?"#2F8F6B":"#C94C4C",animation:s?"pulseRing 2s infinite":"none"}}),s?"متصل":"قطع"]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(100px, 1fr))",gap:12,marginBottom:16},children:[e.jsxs("div",{style:{background:"#FAF7F0",padding:12,borderRadius:8,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:20,fontWeight:900,color:C.primary},children:t.count.toLocaleString("fa-IR")}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D"},children:"بازدید کل"})]}),e.jsxs("div",{style:{background:"#FAF7F0",padding:12,borderRadius:8,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:20,fontWeight:900,color:"#2F8F6B"},children:t.users.toLocaleString("fa-IR")}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D"},children:"کاربر لاگین‌شده"})]}),e.jsxs("div",{style:{background:"#FAF7F0",padding:12,borderRadius:8,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:20,fontWeight:900,color:"#D49A2A"},children:t.guests.toLocaleString("fa-IR")}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D"},children:"مهمان"})]}),e.jsxs("div",{style:{background:"#FAF7F0",padding:12,borderRadius:8,textAlign:"center"},children:[e.jsx("div",{style:{fontSize:20,fontWeight:900,color:"#C46A4D"},children:t.commentsPerMin.toLocaleString("fa-IR")}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D"},children:"نظر بر دقیقه"})]})]}),e.jsx("div",{style:{fontSize:12,fontWeight:700,color:C.ink,marginBottom:8,borderTop:"1px solid #E4DDD2",paddingTop:16},children:"آخرین رخدادها"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[i.length===0?e.jsx("div",{style:{fontSize:12,color:"#5F6B6D"},children:"هنوز رخدادی ثبت نشده..."}):null,i.slice(0,6).map((r,d)=>e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D",background:"#F4EFE6",padding:"6px 10px",borderRadius:6},children:[e.jsx("span",{style:{fontWeight:600,color:C.ink},children:r.actor}),": ",r.action||r.type," روی ",r.target]},`${r.ts}-${d}`))]})]})}function qt(){const[t,n]=c.useState([]),[i,o]=c.useState(!0),[s,a]=c.useState(!1);c.useEffect(()=>{let d=!1;return o(!0),a(!1),N.listActivity({limit:50}).then(p=>{d||(n(Array.isArray(p)?p:[]),o(!1))}).catch(()=>{d||(n([]),a(!0),o(!1))}),()=>{d=!0}},[]);const r={publish:"#2F8F6B",submit:"#D49A2A",draft:"#5F6B6D",approve:"#2F8F6B",reject:"#C94C4C",user:"#0F6B73",tag:"#C76D4A",category:"#D49A2A",edit:"#0F6B73",role:"#C76D4A",delete:"#C94C4C",author:"#C76D4A",upload:"#2F8F6B",media:"#C46A4D",schedule:"#D49A2A"};return i?e.jsx("div",{style:{color:"#5F6B6D",fontSize:13,padding:"20px 0",direction:"rtl"},children:"در حال بارگذاری..."}):s?e.jsx(J,{title:"اتصال به API فعالیت‌ها برقرار نشد",subtitle:"فعالیت نمونه نمایش داده نمی‌شود."}):t.length===0?e.jsx("div",{style:{color:"#5F6B6D",fontSize:13,padding:"20px 0",direction:"rtl"},children:"هنوز فعالیتی ثبت نشده است."}):e.jsxs("div",{children:[e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:12},children:e.jsx("a",{href:N.activityExportUrl({limit:5e3}),style:{...W,background:"#0F6B7318",color:"#0F6B73",textDecoration:"none",fontSize:12},children:"خروجی CSV"})}),t.slice(0,20).map(d=>e.jsxs("div",{style:{display:"flex",gap:14,padding:"14px 0",borderBottom:"1px solid #E4DDD2",direction:"rtl",alignItems:"flex-start"},children:[e.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:r[d.type]||"#5F6B6D",marginTop:6,flexShrink:0}}),e.jsxs("div",{style:{flex:1},children:[e.jsx("span",{style:{fontWeight:600,color:"#263238",fontSize:13},children:typeof d.user=="string"?d.user:d.user?.name??"کاربر"}),e.jsxs("span",{style:{color:"#5F6B6D",fontSize:13},children:[" — ",d.action,": "]}),e.jsx("span",{style:{color:"#0F6B73",fontSize:13},children:d.target})]}),e.jsx("span",{style:{fontSize:11,color:"#5F6B6D",whiteSpace:"nowrap",flexShrink:0},children:d.time||(d.createdAt?new Date(d.createdAt).toLocaleDateString("fa-IR"):"")})]},d.id))]})}function Bs(){const[t,n]=c.useState([]),[i,o]=c.useState(!0),[s,a]=c.useState(!1);return c.useEffect(()=>{let r=!1;return o(!0),a(!1),N.listCategories().then(d=>{r||n(d??[])}).catch(()=>{r||(n([]),a(!0))}).finally(()=>{r||o(!1)}),()=>{r=!0}},[]),i||s||t.length===0?e.jsx(ce,{loading:i,error:s,empty:!i&&!s&&t.length===0,emptyTitle:"هنوز آمار دسته‌بندی از API دریافت نشده است"}):t.map(r=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #E4DDD2"},children:[e.jsx("span",{style:{fontSize:13,color:"#263238"},children:r.name}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("div",{style:{width:Math.max((r.articleCount||0)*2,20),height:6,background:r.color||C.primary,borderRadius:3,opacity:.7}}),e.jsx("span",{style:{fontSize:12,color:"#5F6B6D"},children:r.articleCount??0})]})]},r.id))}function zs(){const{navigate:t}=q(),[n,i]=c.useState([]),[o,s]=c.useState(!0),[a,r]=c.useState(!1);return c.useEffect(()=>{let d=!1;return s(!0),r(!1),N.getDashboard().then(p=>{d||i(p?.topArticles??[])}).catch(()=>{d||(i([]),r(!0))}).finally(()=>{d||s(!1)}),()=>{d=!0}},[]),o||a||n.length===0?e.jsx(ce,{loading:o,error:a,empty:!o&&!a&&n.length===0,emptyTitle:"هنوز مقاله‌ای برای رتبه‌بندی بازدید وجود ندارد"}):n.map(d=>e.jsxs("button",{onClick:()=>t("/article/"+d.slug),style:{width:"100%",border:"none",background:"transparent",borderBottom:"1px solid #E4DDD2",padding:"10px 0",textAlign:"right",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,color:"#263238",lineHeight:1.6},children:d.title}),e.jsxs("div",{style:{fontSize:11,color:"#5F6B6D",marginTop:2},children:[(d.views??0).toLocaleString("fa-IR")," بازدید · ",d.status]})]},d.id))}function Es({role:t}){const[n,i]=c.useState(null),[o,s]=c.useState(!0),[a,r]=c.useState(!1),d=c.useCallback(()=>(r(!1),N.getPanelMetrics().then(i).catch(()=>{i(null),r(!0)}).finally(()=>s(!1))),[]);if(c.useEffect(()=>{let u=!1;d();const g=setInterval(()=>{u||d()},15e3);let b;return(t==="admin"||t==="editor")&&(b=new EventSource("/api/v1/admin/stream",{withCredentials:!0}),["activity","view_update","visitor_update"].forEach(h=>{b.addEventListener(h,()=>d())})),()=>{u=!0,clearInterval(g),b?.close()}},[d,t]),o||a||!n||n.statuses?.totalArticles===0)return e.jsx(ce,{loading:o,error:a,empty:!o&&!a,emptyTitle:"هنوز داده‌ای برای آمار پنل ثبت نشده است"});const p=(n.realtime?.eventsByType??[]).reduce((u,g)=>u+Number(g.count??0),0),l={admin:[["مقاله منتشرشده",n.statuses?.published,"#2F8F6B"],["در انتظار بررسی",n.statuses?.pending,"#D49A2A"],["نیازمند اصلاح",n.statuses?.needsRevision,"#C94C4C"],["بازدید زنده",n.engagement?.views,"#0F6B73"],["تعامل‌ها",(n.engagement?.comments??0)+(n.engagement?.saved??0),"#3A7D5E"],["ایراد کیفیت",n.quality?.recentWithIssues,"#C46A4D"]],editor:[["در انتظار تایید",n.statuses?.pending,"#D49A2A"],["منتشرشده",n.statuses?.published,"#2F8F6B"],["نیازمند اصلاح",n.statuses?.needsRevision,"#C94C4C"],["مشترک خبرنامه",n.growth?.newsletterSubscribers,"#0F6B73"],["رویدادهای زنده",p,"#3A7D5E"]],writer:[["منتشرشده",n.statuses?.published,"#2F8F6B"],["پیش‌نویس",n.statuses?.drafts,"#5F6B6D"],["در انتظار بررسی",n.statuses?.pending,"#D49A2A"],["بازدید نوشته‌ها",n.engagement?.views,"#0F6B73"],["دنبال‌کننده",n.engagement?.writerFollows,"#3A7D5E"]],reviewer:[["در صف بررسی",n.statuses?.pending,"#D49A2A"],["تاییدشده",n.workflow?.reviewsApproved,"#2F8F6B"],["نیازمند اصلاح",n.statuses?.needsRevision,"#C94C4C"],["ایراد کیفیت اخیر",n.quality?.recentWithIssues,"#0F6B73"]]},x=l[t]??l.writer;return e.jsxs("div",{style:{display:"grid",gap:14,marginBottom:28},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill,minmax(170px,1fr))",gap:14},children:x.map(([u,g,b])=>e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:"18px 20px",borderTop:`3px solid ${b}`},children:[e.jsx("div",{style:{fontSize:24,fontWeight:900,color:b,marginBottom:4},children:Number(g??0).toLocaleString("fa-IR")}),e.jsx("div",{style:{fontSize:12,color:"#5F6B6D"},children:u})]},u))}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:16,direction:"rtl"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:C.ink,marginBottom:10},children:"پوشش زنده پنل"}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[(n.realtime?.eventsByType??[]).slice(0,8).map(u=>e.jsxs("span",{style:{background:"#F4EFE6",border:"1px solid #E4DDD2",borderRadius:999,padding:"5px 10px",fontSize:12,color:C.ink},children:[u.type,": ",Number(u.count??0).toLocaleString("fa-IR")]},u.type)),e.jsxs("span",{style:{background:"#F4EFE6",border:"1px solid #E4DDD2",borderRadius:999,padding:"5px 10px",fontSize:12,color:C.ink},children:["اعلان خوانده‌نشده: ",Number(n.realtime?.unreadNotifications??0).toLocaleString("fa-IR")]})]})]})]})}function Rs(){const{user:t,logout:n}=ae(),{navigate:i}=q(),[o,s]=c.useState("dashboard"),[a,r]=c.useState(null),[d,p]=c.useState(!1);if(c.useEffect(()=>{t||i("/login")},[t]),!t)return null;const l=u=>e.jsx("h2",{style:{fontSize:22,fontWeight:900,color:C.ink,margin:"0 0 20px",direction:"rtl",fontFamily:"'PelakFA','Vazirmatn',sans-serif"},children:u}),x=()=>o==="create"||a?e.jsx(zi,{existing:a,role:t.role,onSave:()=>{r(null),s("articles")}}):o==="articles"?e.jsxs(e.Fragment,{children:[l(t.role==="reviewer"?"مقاله‌های در انتظار بررسی":"مدیریت مقاله‌ها"),e.jsx(Ei,{role:t.role,onEdit:u=>{r(u),s("edit")}})]}):o==="users"&&t.role==="admin"?e.jsxs(e.Fragment,{children:[l("مدیریت کاربران"),e.jsx(xs,{})]}):o==="authors"&&(t.role==="admin"||t.role==="editor")?e.jsxs(e.Fragment,{children:[l("مدیریت نویسندگان"),e.jsx(fs,{})]}):o==="media"&&(t.role==="admin"||t.role==="editor")?e.jsxs(e.Fragment,{children:[l("کتابخانه رسانه"),e.jsx(ms,{role:t.role})]}):o==="comments"&&(t.role==="admin"||t.role==="editor")?e.jsxs(e.Fragment,{children:[l("مدیریت نظرها"),e.jsx(ys,{})]}):o==="analytics"?e.jsxs(e.Fragment,{children:[l("تحلیل محتوا"),e.jsx(vs,{})]}):o==="reviews"?e.jsxs(e.Fragment,{children:[l("گردش بررسی مقاله‌ها"),e.jsx(Ss,{})]}):o==="newsletter"&&(t.role==="admin"||t.role==="editor")?e.jsxs(e.Fragment,{children:[l("خبرنامه"),e.jsx(Fs,{})]}):o==="series"&&(t.role==="admin"||t.role==="editor")?e.jsxs(e.Fragment,{children:[l("سری مقاله‌ها"),e.jsx(Ds,{})]}):o==="categories"?e.jsxs(e.Fragment,{children:[l("مدیریت دسته‌بندی‌ها"),e.jsx(us,{})]}):o==="tags"&&t.role==="admin"?e.jsxs(e.Fragment,{children:[l("مدیریت برچسب‌ها"),e.jsx(hs,{})]}):o==="seo-audit"&&t.role==="admin"?e.jsxs(e.Fragment,{children:[l("ممیزی SEO"),e.jsx(bs,{})]}):o==="jobs"&&(t.role==="admin"||t.role==="editor")?e.jsxs(e.Fragment,{children:[l("آگهی‌های شغلی"),e.jsx(ws,{})]}):o==="client-errors"&&t.role==="admin"?e.jsxs(e.Fragment,{children:[l("خطاهای کلاینت"),e.jsx(ks,{})]}):o==="activity"&&t.role==="admin"?e.jsxs(e.Fragment,{children:[l("گزارش فعالیت"),e.jsx(qt,{})]}):e.jsxs("div",{style:{direction:"rtl"},children:[e.jsxs("h2",{style:{fontSize:22,fontWeight:800,color:"#263238",margin:"0 0 6px"},children:["خوش آمدید، ",t.name]}),e.jsxs("p",{style:{fontSize:14,color:"#5F6B6D",margin:"0 0 28px"},children:["نقش شما: ",e.jsx(yt,{role:t.role})]}),(t.role==="admin"||t.role==="editor")&&e.jsx(As,{}),e.jsx(Es,{role:t.role}),t.role==="admin"&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:20},className:"dash-grid",children:[e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:24},children:[e.jsx("h3",{style:{fontSize:15,fontWeight:700,color:"#263238",margin:"0 0 16px"},children:"آخرین فعالیت‌ها"}),e.jsx(qt,{})]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:24},children:[e.jsx("h3",{style:{fontSize:15,fontWeight:700,color:"#263238",margin:"0 0 16px"},children:"آمار دسته‌بندی‌ها"}),e.jsx(Bs,{})]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #E4DDD2",borderRadius:12,padding:24},children:[e.jsx("h3",{style:{fontSize:15,fontWeight:700,color:"#263238",margin:"0 0 16px"},children:"پربازدیدترین مقاله‌ها"}),e.jsx(zs,{})]})]})]});return e.jsxs("div",{style:{minHeight:"100vh",display:"flex",background:"linear-gradient(135deg,#FAF7F0 0%,#F3EEE4 100%)",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:[e.jsx(Cs,{activeTab:o,onTab:u=>{s(u),p(!1)},user:t,open:d,onClose:()=>p(!1)}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0},children:[e.jsxs("div",{style:{background:"rgba(250,247,240,0.86)",backdropFilter:"blur(14px)",borderBottom:"1px solid #E4DDD2",padding:"0 28px",minHeight:64,display:"flex",alignItems:"center",justifyContent:"space-between",direction:"rtl",gap:16,flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("button",{className:"admin-mobile-toggle",onClick:()=>p(u=>!u),style:{background:"none",border:"1px solid #E4DDD2",borderRadius:8,padding:"6px 10px",cursor:"pointer",fontSize:18,color:C.ink},children:"☰"}),e.jsxs("div",{children:[e.jsx("span",{className:"admin-topbar-title",style:{fontSize:14,fontWeight:800,color:C.ink},children:"پنل مدیریت تکناو"}),e.jsx("div",{style:{fontSize:11,color:"#5F6B6D",marginTop:2},children:"محیط تولید، بازبینی و انتشار مقاله"})]})]}),e.jsxs("div",{style:{display:"flex",gap:10},children:[e.jsx("button",{onClick:()=>s("create"),style:{...W,background:C.primary,color:"#fff",fontSize:12},children:"مقاله جدید"}),e.jsx("button",{onClick:()=>i("/"),style:{...W,background:`${C.primary}12`,color:C.primary,fontSize:12},children:"بازگشت به سایت"}),e.jsx("button",{onClick:()=>{n(),i("/")},style:{...W,background:"#C94C4C18",color:"#C94C4C",fontSize:12},children:"خروج"})]})]}),e.jsx("div",{style:{flex:1,padding:"30px clamp(18px,3vw,38px)",overflowY:"auto"},children:x()})]}),e.jsx("style",{children:`
.dash-grid { grid-template-columns: 1fr 1fr; }
@media(max-width:768px){
.dash-grid { grid-template-columns: 1fr !important; }
}
@media(max-width:640px){
.admin-sidebar { display: none !important; }
.admin-sidebar.open { display: flex !important; position: fixed; top: 0; right: 0; bottom: 0; z-index: 300; width: 280px !important; overflow-y: auto; }
.admin-overlay { display: block !important; }
.admin-mobile-toggle { display: flex !important; }
.admin-topbar-title { font-size: 12px !important; }
}
.admin-mobile-toggle { display: none; }
`})]})}const A={terra:"#C46A4D",terraLight:"#FAF0EB",terraBorder:"rgba(196,106,77,0.22)",gold:"#C8951C",goldLight:"#FBF6E8",ink:"#1A2E30",muted:"#7B8C8E",faint:"#9AA5A6",cream:"#FAF7F0",border:"#E4DDD2",success:"#3A7D5E",successLight:"#EFF8F4",purple:"#7B5EA7",purpleLight:"#F5F0FB"},Ws={padding:"10px 22px",borderRadius:10,border:"none",background:A.terra,color:"#fff",fontSize:13,fontWeight:700,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",boxShadow:"0 3px 12px rgba(196,106,77,0.25)",display:"inline-flex",alignItems:"center",gap:6},Gt={padding:"9px 16px",borderRadius:10,border:`1px solid ${A.border}`,background:"#fff",color:A.ink,fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},Is={padding:"9px 16px",borderRadius:10,border:"none",background:"rgba(201,76,76,0.08)",color:"#C94C4C",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},Ee={background:A.terraLight,border:"none",cursor:"pointer",color:A.terra,fontSize:11,fontWeight:700,fontFamily:"Vazirmatn,sans-serif",padding:"3px 10px",borderRadius:6},Le=[{icon:"✦",tip:"با یک سوال باز شروع کنید. بهترین مقاله‌ها خواننده را وارد گفتگو می‌کنند."},{icon:"◈",tip:"عنوان را آخر بنویسید. وقتی محتوا کامل است، عنوان دقیق‌تر انتخاب می‌شود."},{icon:"◉",tip:"یک مفهوم پیچیده را با یک مثال واقعی توضیح دهید تا خواننده آن را به خاطر بسپارد."},{icon:"◇",tip:"پاراگراف اول تعیین‌کننده است. اگر خواننده را نگه ندارد، ادامه را نمی‌خواند."},{icon:"◎",tip:'از اعداد استفاده کنید. "۳ روش" قابل اعتمادتر از "چند روش" به نظر می‌رسد.'},{icon:"✦",tip:"مقاله را با صدای بلند بخوانید. اگر گیر کردید، جمله نیاز به بازنویسی دارد."}],Ts=["ش","ی","د","س","چ","پ","ج"];function $s(){const[t,n]=c.useState(()=>Math.floor(Math.random()*Le.length)),[i,o]=c.useState(!1),s=c.useRef(null),a=c.useCallback((l=1)=>{o(!0),clearInterval(s.current),setTimeout(()=>{n(x=>(x+l+Le.length)%Le.length),o(!1),s.current=setInterval(r,7e3)},350)},[]);function r(){a(1)}c.useEffect(()=>(s.current=setInterval(r,7e3),()=>clearInterval(s.current)),[]);const{icon:d,tip:p}=Le[t];return e.jsxs("div",{style:{background:"linear-gradient(135deg, #FAF0EB 0%, #FBF6E8 100%)",border:`1px solid ${A.terraBorder}`,borderRadius:12,padding:"14px 16px",display:"flex",gap:12,alignItems:"flex-start"},children:[e.jsx("div",{style:{width:36,height:36,borderRadius:10,flexShrink:0,background:"linear-gradient(135deg, rgba(196,106,77,0.14), rgba(200,149,28,0.1))",display:"flex",alignItems:"center",justifyContent:"center",fontSize:16,color:A.terra},children:d}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:5},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,color:A.terra,letterSpacing:"0.1em"},children:"نکته نویسندگی"}),e.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[e.jsxs("span",{style:{fontSize:10,color:A.faint},children:[t+1,"/",Le.length]}),e.jsx("button",{type:"button",title:"نکته قبلی",onClick:()=>a(-1),style:{...Ee,padding:"2px 7px",fontSize:13,lineHeight:1},children:"‹"}),e.jsx("button",{type:"button",title:"نکته بعدی",onClick:()=>a(1),style:{...Ee,padding:"2px 7px",fontSize:13,lineHeight:1},children:"›"})]})]}),e.jsx("p",{style:{margin:0,fontSize:12.5,color:A.ink,lineHeight:1.85,opacity:i?0:1,transform:i?"translateY(4px)":"translateY(0)",transition:"opacity 0.35s, transform 0.35s"},children:p})]})]})}function Ls({data:t}){const n=t&&t.length===7?t:[2,5,3,8,4,6,1],i=Math.max(...n,1),o=new Date().getDay();return e.jsxs("div",{children:[e.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:5,height:48,marginBottom:6},children:n.map((s,a)=>e.jsx("div",{style:{flex:1,height:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"flex-end"},children:e.jsx("div",{style:{width:"100%",borderRadius:"3px 3px 0 0",height:`${Math.max(s/i*100,8)}%`,background:a===o?`linear-gradient(to top, ${A.terra}, rgba(196,106,77,0.45))`:"linear-gradient(to top, #E4DDD2, #EDE9E2)",transition:"height 0.5s ease"}})},a))}),e.jsx("div",{style:{display:"flex",gap:5},children:Ts.map((s,a)=>e.jsx("div",{style:{flex:1,textAlign:"center",fontSize:9,color:a===o?A.terra:A.faint,fontWeight:a===o?700:400},children:s},a))})]})}function Ps(){const[t,n]=c.useState([]),[i,o]=c.useState(!0),[s,a]=c.useState(!1),[r,d]=c.useState(null),[p,l]=c.useState({});c.useEffect(()=>{let u=!1;return K.writerAnalyticsArticles().then(g=>{u||n(g.items??[])}).catch(()=>{u||a(!0)}).finally(()=>{u||o(!1)}),()=>{u=!0}},[]),c.useEffect(()=>{if(t.length===0)return;let u=!1;return t.forEach(g=>{K.writerAnalyticsArticle(g.slug).then(b=>{u||l(h=>({...h,[g.slug]:b.viewsByDay.map(f=>f.views)}))}).catch(()=>{})}),()=>{u=!0}},[t]);const x=u=>{d(g=>g===u?null:u)};return i?e.jsx("div",{style:{color:A.muted,fontSize:13,padding:"20px 0",direction:"rtl"},children:"در حال بارگذاری تحلیل‌ها..."}):s?e.jsx(J,{title:"دریافت اطلاعات تحلیلی با خطا مواجه شد"}):t.length===0?e.jsx(J,{title:"مقاله‌ای برای تحلیل وجود ندارد"}):e.jsxs("section",{style:{background:"#fff",border:`1px solid ${A.border}`,borderRadius:12,padding:24,direction:"rtl"},children:[e.jsx("h3",{style:{margin:"0 0 24px",fontSize:16,color:A.ink,fontWeight:900},children:"عملکرد نوشته‌های من"}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontFamily:"Vazirmatn,sans-serif",fontSize:13},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:"2px solid #E4DDD2",color:A.ink},children:[e.jsx("th",{style:{padding:"12px 8px",textAlign:"right"},children:"عنوان مقاله"}),e.jsx("th",{style:{padding:"12px 8px",textAlign:"center"},children:"بازدید"}),e.jsx("th",{style:{padding:"12px 8px",textAlign:"center"},children:"واکنش"}),e.jsx("th",{style:{padding:"12px 8px",textAlign:"center"},children:"نظر"}),e.jsx("th",{style:{padding:"12px 8px",textAlign:"center"},children:"روند اخیر"})]})}),e.jsx("tbody",{children:t.map((u,g)=>{const b=p[u.slug],h=b?Math.max(...b,1):1;return e.jsxs(c.Fragment,{children:[e.jsxs("tr",{style:{background:g%2===0?"#fff":"#FDFBF7",borderBottom:"1px solid #E4DDD2",cursor:"pointer"},onClick:()=>x(u.slug),children:[e.jsx("td",{style:{padding:"14px 8px",fontWeight:600,color:A.ink},children:u.title}),e.jsx("td",{style:{padding:"14px 8px",textAlign:"center",color:A.muted},children:Number(u.views||0).toLocaleString("fa-IR")}),e.jsx("td",{style:{padding:"14px 8px",textAlign:"center",color:A.muted},children:Number(u.reactions||0).toLocaleString("fa-IR")}),e.jsx("td",{style:{padding:"14px 8px",textAlign:"center",color:A.muted},children:Number(u.comments||0).toLocaleString("fa-IR")}),e.jsxs("td",{style:{padding:"8px 8px",textAlign:"center"},children:[(()=>{const f=p[u.slug];if(!f)return e.jsx("span",{style:{fontSize:10,color:A.faint},children:"..."});if(f.length<2)return e.jsx("span",{style:{fontSize:10,color:A.faint},children:"—"});const y=80,m=20,v=Math.max(...f,1),j=f.map((D,L)=>[L/(f.length-1)*y,m-2-D/v*(m-4)]),I=j.map(([D,L],P)=>`${P===0?"M":"L"}${D.toFixed(1)},${L.toFixed(1)}`).join(" "),w=j[j.length-1];return e.jsxs("svg",{width:y,height:m,viewBox:`0 0 ${y} ${m}`,style:{display:"inline-block",direction:"ltr",verticalAlign:"middle"},children:[e.jsx("path",{d:I,fill:"none",stroke:A.terra,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("circle",{cx:w[0],cy:w[1],r:"2.5",fill:A.terra})]})})(),e.jsx("div",{style:{fontSize:9,color:A.faint,marginTop:2},children:r===u.slug?"▴":"▾"})]})]}),r===u.slug&&e.jsx("tr",{style:{background:"#FAF7F0",borderBottom:"2px solid #E4DDD2"},children:e.jsx("td",{colSpan:"5",style:{padding:"20px 24px"},children:b?b.length<2?e.jsx("div",{style:{fontSize:12,color:A.muted,textAlign:"center"},children:"داده کافی برای رسم نمودار ۳۰ روزه وجود ندارد."}):(()=>{const v=b.length,j=b.map((D,L)=>[L/(v-1)*(560-4*2)+4,76-D/h*(80-4*2-4)]),I=j.map(([D,L],P)=>`${P===0?"M":"L"} ${D.toFixed(1)},${L.toFixed(1)}`).join(" "),w=`${I} L ${j[j.length-1][0].toFixed(1)},80 L ${j[0][0].toFixed(1)},80 Z`;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsxs("svg",{width:"100%",viewBox:"0 0 560 80",preserveAspectRatio:"none",style:{display:"block",height:80,direction:"ltr"},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`spfill-${u.slug}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:A.terra,stopOpacity:"0.22"}),e.jsx("stop",{offset:"100%",stopColor:A.terra,stopOpacity:"0.01"})]})}),e.jsx("path",{d:w,fill:`url(#spfill-${u.slug})`}),e.jsx("path",{d:I,fill:"none",stroke:A.terra,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),j[j.length-1]&&e.jsx("circle",{cx:j[j.length-1][0],cy:j[j.length-1][1],r:"3.5",fill:A.terra})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:10,color:A.faint,direction:"ltr"},children:[e.jsx("span",{children:"۳۰ روز پیش"}),e.jsx("span",{children:"امروز"})]})]})})():e.jsx("div",{style:{fontSize:12,color:A.muted,textAlign:"center"},children:"در حال بارگذاری روند..."})})})]},u.slug)})}),e.jsx("tfoot",{children:e.jsxs("tr",{style:{borderTop:"2px solid #E4DDD2",background:"#FAF7F0",fontWeight:700},children:[e.jsx("td",{style:{padding:"12px 8px",color:A.ink,fontSize:12},children:"جمع کل"}),e.jsx("td",{style:{padding:"12px 8px",textAlign:"center",color:A.terra,fontSize:12},children:t.reduce((u,g)=>u+(g.views||0),0).toLocaleString("fa-IR")}),e.jsx("td",{style:{padding:"12px 8px",textAlign:"center",color:A.terra,fontSize:12},children:t.reduce((u,g)=>u+(g.reactions||0),0).toLocaleString("fa-IR")}),e.jsx("td",{style:{padding:"12px 8px",textAlign:"center",color:A.terra,fontSize:12},children:t.reduce((u,g)=>u+(g.comments||0),0).toLocaleString("fa-IR")}),e.jsx("td",{})]})})]})})]})}function Ms(){const{user:t,logout:n}=ae(),{navigate:i}=q(),[o,s]=c.useState("overview"),[a,r]=c.useState(null),[d,p]=c.useState(null),[l,x]=c.useState(!0),[u,g]=c.useState(!1),b=c.useCallback(()=>(g(!1),N.getWriterDashboard().then(p).catch(()=>{p(null),g(!0)}).finally(()=>x(!1))),[]);if(c.useEffect(()=>{t||i("/login")},[t,i]),c.useEffect(()=>{if(!t)return;let j=!1;b();const I=setInterval(()=>{j||b()},2e4);return()=>{j=!0,clearInterval(I)}},[b,t]),!t)return null;const h=d?.stats??{},f=(j=null)=>{r(j),s("write")},y=[{id:"overview",label:"آمار من",icon:"◈"},{id:"analytics",label:"تحلیل‌ها",icon:"▤"},{id:"write",label:a?"ویرایش":"نوشتن",icon:"✦"},{id:"articles",label:"نوشته‌ها",icon:"◉"},{id:"comments",label:"نظرها",icon:"◎"}],m=[{label:"بازدید",value:h.views,color:A.terra,bg:A.terraLight,icon:"◉"},{label:"دنبال‌کننده",value:h.followers,color:A.success,bg:A.successLight,icon:"◎"},{label:"نظر",value:h.comments,color:A.gold,bg:A.goldLight,icon:"◇"},{label:"در انتظار بررسی",value:h.pending,color:A.purple,bg:A.purpleLight,icon:"◈"},{label:"پیش‌نویس",value:h.drafts,color:A.muted,bg:"#F2F4F4",icon:"◻"}],v=()=>e.jsxs("div",{style:{display:"grid",gap:20},children:[e.jsx(ce,{loading:l,error:u,empty:!l&&!u&&!d,emptyTitle:"هنوز داده‌ای برای داشبورد ثبت نشده است"}),d&&e.jsxs(e.Fragment,{children:[h.needsRevision>0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,background:"linear-gradient(135deg, #FFF8F0, #FFF3E0)",border:"1px solid rgba(200,149,28,0.35)",borderRadius:12,padding:"14px 18px"},children:[e.jsx("div",{style:{width:38,height:38,borderRadius:10,flexShrink:0,background:A.goldLight,border:"1px solid rgba(200,149,28,0.25)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:20},children:e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Ve}")`},"aria-hidden":"true"})}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{fontSize:13,fontWeight:800,color:"#7A5A00",marginBottom:3},children:[Number(h.needsRevision).toLocaleString("fa-IR")," ","مقاله نیاز به بازبینی دارد"]}),e.jsx("div",{style:{fontSize:12,color:"#A07A20"},children:"ویراستار بازخوردی ثبت کرده است. برای مشاهده توضیحات به بخش «نوشته‌ها» بروید."})]}),e.jsx("button",{onClick:()=>s("articles"),style:{...Ee,background:A.gold,color:"#fff",padding:"6px 14px",fontSize:12,flexShrink:0},children:"مشاهده →"})]}),e.jsx($s,{}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(138px,1fr))",gap:12},children:m.map(({label:j,value:I,color:w,bg:D,icon:L})=>e.jsxs("div",{style:{background:"#fff",border:`1px solid ${A.border}`,borderRadius:12,padding:"18px 16px",position:"relative",overflow:"hidden"},children:[e.jsx("div",{style:{position:"absolute",top:0,right:0,width:4,height:"100%",background:w,borderRadius:"0 12px 12px 0"}}),e.jsx("div",{style:{width:34,height:34,borderRadius:9,background:D,display:"flex",alignItems:"center",justifyContent:"center",fontSize:15,color:w,marginBottom:12},children:L}),e.jsx("div",{style:{fontSize:26,fontWeight:900,color:w,lineHeight:1},children:Number(I??0).toLocaleString("fa-IR")}),e.jsx("div",{style:{fontSize:11,color:A.muted,marginTop:5,fontWeight:600},children:j})]},j))}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.15fr 0.85fr",gap:16},className:"writer-work-grid",children:[e.jsxs("section",{style:{background:"#fff",border:`1px solid ${A.border}`,borderRadius:12,padding:"20px 20px 8px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[e.jsx("h3",{style:{margin:0,fontSize:14,color:A.ink,fontWeight:800},children:"آخرین نوشته‌ها"}),e.jsx("button",{onClick:()=>s("articles"),style:Ee,children:"همه →"})]}),(d.recentArticles??[]).length===0?e.jsx(J,{title:"هنوز نوشته‌ای ندارید"}):d.recentArticles.map(j=>e.jsxs("button",{onClick:()=>f(j),style:{width:"100%",background:"transparent",border:0,borderBottom:`1px solid ${A.border}`,padding:"13px 0",textAlign:"right",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10,alignItems:"flex-start"},children:[e.jsx("span",{style:{fontWeight:700,color:A.ink,fontSize:13,lineHeight:1.6},children:j.title}),e.jsx(mt,{status:j.status})]}),e.jsxs("div",{style:{fontSize:11,color:A.faint,marginTop:5},children:[Number(j.views??0).toLocaleString("fa-IR")," ","بازدید ·"," ",j.date]}),j.status==="نیازمند اصلاح"&&j.reviewNote&&e.jsxs("div",{style:{marginTop:7,padding:"5px 9px",background:"rgba(200,149,28,0.10)",border:"1px solid rgba(200,149,28,0.28)",borderRadius:6,fontSize:11,color:"#7A5A00",lineHeight:1.7,textAlign:"right"},children:[e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Ve}")`},"aria-hidden":"true"})," ",j.reviewNote]})]},j.id))]}),e.jsxs("section",{style:{background:"#fff",border:`1px solid ${A.border}`,borderRadius:12,padding:"20px 20px 8px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[e.jsx("h3",{style:{margin:0,fontSize:14,color:A.ink,fontWeight:800},children:"نظرهای تازه"}),e.jsx("button",{onClick:()=>s("comments"),style:Ee,children:"همه →"})]}),(d.recentComments??[]).length===0?e.jsx(J,{title:"هنوز نظری ثبت نشده است"}):d.recentComments.slice(0,5).map(j=>e.jsxs("div",{style:{borderBottom:`1px solid ${A.border}`,padding:"11px 0"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,marginBottom:4},children:[e.jsx("div",{style:{fontSize:12,fontWeight:700,color:A.terra},children:j.author?.name}),e.jsx("div",{style:{fontSize:10,color:A.faint},children:j.time})]}),e.jsx("div",{style:{fontSize:12,color:A.ink,lineHeight:1.8},children:j.body}),e.jsx("div",{style:{fontSize:10,color:A.muted,marginTop:4},children:j.article?.title})]},j.id))]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16},className:"writer-work-grid",children:[e.jsxs("div",{style:{background:"#fff",border:`1px solid ${A.border}`,borderRadius:12,padding:"20px"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:A.ink,marginBottom:14},children:"فعالیت هفتگی"}),e.jsx(Ls,{data:(d.viewsByDay??[]).slice(-7).map(j=>j.views??0)}),e.jsx("div",{style:{fontSize:11,color:A.muted,marginTop:10,textAlign:"center"},children:"بازدید روزانه در این هفته"})]}),e.jsxs("div",{style:{background:"#fff",border:`1px solid ${A.border}`,borderRadius:12,padding:"20px"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:A.ink,marginBottom:6},children:"هدف ماهانه"}),e.jsxs("div",{style:{fontSize:11,color:A.muted,marginBottom:14},children:["این ماه: ",Number(h.published??0).toLocaleString("fa-IR")," از ۴ مقاله"]}),e.jsx("div",{style:{height:8,background:A.terraLight,borderRadius:4,overflow:"hidden",marginBottom:12},children:e.jsx("div",{style:{height:"100%",borderRadius:4,background:`linear-gradient(to left, ${A.gold}, ${A.terra})`,width:`${Math.min((h.published??0)/4*100,100)}%`,transition:"width 1s ease"}})}),e.jsx("div",{style:{display:"flex",gap:8},children:[1,2,3,4].map(j=>e.jsx("div",{style:{flex:1,height:28,borderRadius:8,border:`1.5px solid ${j<=(h.published??0)?A.terra:A.border}`,background:j<=(h.published??0)?A.terraLight:"transparent",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,color:j<=(h.published??0)?A.terra:A.faint,fontWeight:700,transition:"all 0.3s"},children:j<=(h.published??0)?"✔":j.toLocaleString("fa-IR")},j))}),e.jsx("div",{style:{fontSize:11,color:A.faint,marginTop:10},children:"هر ماه ۴ مقاله بنویسید"})]})]})]})]});return e.jsxs("div",{style:{minHeight:"100vh",background:A.cream,direction:"rtl",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("div",{style:{background:"linear-gradient(160deg, #F2EBE3 0%, #FAF7F0 55%)",borderBottom:`1px solid ${A.border}`,padding:"24px clamp(16px,3vw,44px) 0"},children:e.jsxs("div",{style:{maxWidth:1280,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:16,flexWrap:"wrap",marginBottom:22},children:[e.jsxs("div",{children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:11,color:A.terra,fontWeight:700,background:A.terraLight,padding:"4px 12px",borderRadius:20,border:`1px solid ${A.terraBorder}`,marginBottom:10,letterSpacing:"0.05em"},children:"✦ استودیوی نویسنده · تکناو"}),e.jsxs("h1",{style:{margin:0,fontSize:28,fontWeight:900,color:A.ink,fontFamily:"'PelakFA','Vazirmatn',sans-serif",lineHeight:1.2},children:[(()=>{const j=new Date().getHours();return j<6?"شب بخیر، ":j<12?"صبح بخیر، ":j<17?"ظهر بخیر، ":j<21?"عصر بخیر، ":"شب بخیر، "})(),t.name]}),e.jsx("p",{style:{margin:"6px 0 0",fontSize:13,color:A.muted},children:(()=>{const j=new Date().getHours();return j<6?"ساعت کار است یا الهام گرفتن؟":j<12?"صبح بهترین وقت نوشتن است.":j<17?"امروز چه می‌نویسید؟":"شب‌های خلاق را به یاد داشته باشید."})()})]}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",paddingTop:4},children:[e.jsx("button",{onClick:()=>f(null),style:Ws,children:"✦ مقاله جدید"}),e.jsx("button",{onClick:()=>i("/admin"),style:Gt,children:"پنل کامل"}),e.jsx("button",{onClick:()=>i("/"),style:Gt,children:"سایت"}),e.jsx("button",{onClick:()=>{n(),i("/")},style:Is,children:"خروج"})]})]}),e.jsx("div",{style:{display:"flex",gap:0,overflowX:"auto"},children:y.map(({id:j,label:I,icon:w})=>e.jsxs("button",{onClick:()=>s(j),style:{padding:"11px 22px",border:"none",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",fontSize:13,fontWeight:700,background:"transparent",whiteSpace:"nowrap",color:o===j?A.terra:A.muted,borderBottom:o===j?`2.5px solid ${A.terra}`:"2.5px solid transparent",transition:"color 0.18s, border-color 0.18s"},children:[e.jsx("span",{style:{marginLeft:5,fontSize:10,opacity:.7},children:w}),I]},j))})]})}),e.jsx("div",{style:{maxWidth:1280,margin:"0 auto",padding:"28px clamp(16px,3vw,44px)"},children:o==="write"?e.jsx(zi,{existing:a,role:"writer",onSave:()=>{r(null),s("overview"),b()}}):o==="articles"?e.jsx(Ei,{role:"writer",onEdit:f}):o==="analytics"?e.jsx(Ps,{}):o==="comments"?e.jsxs("section",{style:{background:"#fff",border:`1px solid ${A.border}`,borderRadius:12,padding:24,direction:"rtl"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:18},children:[e.jsx("h3",{style:{margin:0,fontSize:15,color:A.ink,fontWeight:800},children:"نظرها روی نوشته‌های من"}),(d?.recentComments??[]).length>0&&e.jsxs("span",{style:{fontSize:11,color:A.faint},children:[d.recentComments.length.toLocaleString("fa-IR")," ","نظر اخیر"]})]}),e.jsx(ce,{loading:l,error:u,empty:!l&&!u&&(d?.recentComments??[]).length===0,emptyTitle:"هنوز نظری ثبت نشده است"}),(d?.recentComments??[]).map(j=>e.jsxs("div",{style:{borderBottom:`1px solid ${A.border}`,padding:"16px 0"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap",marginBottom:6},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("strong",{style:{color:A.ink,fontSize:13},children:j.author?.name}),e.jsxs("span",{style:{fontSize:10,color:A.faint,background:"#F2F4F4",padding:"2px 7px",borderRadius:10},children:[j.article?.title?.slice(0,28),j.article?.title?.length>28?"…":""]})]}),e.jsx("span",{style:{fontSize:11,color:A.faint},children:j.time})]}),e.jsx("p",{style:{margin:"0 0 10px",color:A.ink,lineHeight:2,fontSize:13},children:j.body}),e.jsx("button",{onClick:()=>i(`/article/${j.article?.slug}`),style:{...Ee,fontSize:11},children:"رفتن به مقاله و مشاهده همه نظرها ←"})]},j.id)),(d?.recentComments??[]).length>=8&&e.jsx("div",{style:{padding:"14px 0 4px",fontSize:11,color:A.faint,textAlign:"center"},children:"فقط ۸ نظر اخیر نمایش داده می‌شود. برای مشاهده همه نظرها روی مقاله مربوطه بروید."})]}):v()}),e.jsx("style",{children:`
@media(max-width:900px){
.writer-work-grid, .writer-editor-meta { grid-template-columns: 1fr !important; }
}
`})]})}const Ns="/assets/eye-24pbqH8m.svg",Hs="/assets/graduation-cap-CW1lCQxi.svg",Vs="/assets/scroll-CK0LMVQL.svg",_s="/assets/bot-wZQyf_cG.svg",Os="/assets/chart-column-ClCQupCJ.svg",Us="/assets/laptop-CwHSDJuD.svg",qs="/assets/zap-ZjqG8amM.svg",Gs="/assets/library-BR1GMnyH.svg",Qs="/assets/sprout-BUEfuOI8.svg",Ys="/assets/medal-BiDQNqlQ.svg",k={terracotta:"#C45C3D",orange:"#E07A3A",green:"#3A7D5E",greenLight:"#E8F4EF",ink:"#263238",muted:"#5F6B6D",cream:"#FAF7F0",panel:"#F4EFE6",line:"#E4DDD2",white:"#fff"},Qt={admin:{label:"ادمین",bg:"rgba(196,92,61,0.10)",color:"#C45C3D",border:"rgba(196,92,61,0.22)"},editor:{label:"سردبیر",bg:"rgba(58,125,94,0.10)",color:"#2F8F6B",border:"rgba(58,125,94,0.22)"},writer:{label:"نویسنده",bg:"rgba(212,154,42,0.10)",color:"#A87A10",border:"rgba(212,154,42,0.22)"},reviewer:{label:"بازبین",bg:"rgba(100,120,200,0.10)",color:"#5566AA",border:"rgba(100,120,200,0.22)"},reader:{label:"خواننده",bg:"rgba(95,107,109,0.08)",color:"#5F6B6D",border:"rgba(95,107,109,0.18)"}};function Xs({role:t}){const n=Qt[t]??Qt.reader;return e.jsx("span",{style:{display:"inline-block",padding:"3px 12px",borderRadius:20,fontSize:11,fontWeight:700,letterSpacing:.4,background:n.bg,color:n.color,border:`1px solid ${n.border}`},children:n.label})}function ot(t){return M.authors.find(n=>n.username===t||n.slug===t)}function Js(t){return M.articles.filter(n=>(n.authorId===t.id||n.authorName===t.name||n.authorUsername===t.username)&&n.status==="منتشرشده").map(n=>({id:n.id,slug:n.slug,title:n.title,summary:n.summary,publishedAt:n.dateEn?`${n.dateEn}T09:00:00+03:30`:null,views:n.views??0,reactions:n.reactions??0}))}function Yt(t){if(!t)return null;const n=Js(t);return{id:t.id,username:t.username,name:t.name,bio:t.bio,avatarUrl:t.avatarUrl??null,role:"writer",createdAt:t.joinedDate?new Date(t.joinedDate).toISOString():null,author:{articles:n,articleCount:n.length,verifiedExpert:t.verifiedExpert??!1,verificationNote:t.verificationNote??t.specialty},_static:!0,expertise:t.expertise??[],education:t.education??null,alumniOf:t.alumniOf??null,credential:t.credential??null,social:t.social??{},specialty:t.specialty}}function Ks(t,n){return!t||!n?t:{...t,expertise:t.expertise||n.expertise||[],education:t.education||n.education||null,alumniOf:t.alumniOf||n.alumniOf||null,credential:t.credential||n.credential||null,avatarUrl:t.avatarUrl||n.avatarUrl||null,social:{...n.social,...t.social},specialty:t.specialty||n.specialty,author:{...t.author,verifiedExpert:t.author?.verifiedExpert??n.verifiedExpert??!1,verificationNote:t.author?.verificationNote??n.verificationNote??n.specialty}}}function Zs({user:t,editable:n,onUploaded:i}){const o=c.useRef(null),[s,a]=c.useState(!1),[r,d]=c.useState(!0),[p,l]=c.useState(t.avatarUrl??null);c.useEffect(()=>{l(t.avatarUrl??null)},[t.avatarUrl]);const x=async b=>{const h=b.target.files?.[0];if(h){if(h.size>5*1024*1024){alert("حجم تصویر نباید بیشتر از ۵ مگابایت باشد.");return}a(!0);try{const y=(await new Promise((v,j)=>{const I=new FileReader;I.onload=()=>v(I.result),I.onerror=j,I.readAsDataURL(h)})).split(",")[1],m=await S.post("/api/auth/avatar",{file:y,mimeType:h.type,webp:r});l(m.url),i?.(m.url)}catch{alert("آپلود آواتار ناموفق بود. دوباره تلاش کنید.")}finally{a(!1)}}},u=t.name?t.name.slice(0,2):"؟",g={width:110,height:110,borderRadius:"50%",border:"3px solid rgba(196,92,61,0.35)",boxShadow:"0 4px 20px rgba(196,92,61,0.15)",objectFit:"cover",display:"block"};return e.jsxs("div",{style:{position:"relative",width:110},children:[p?e.jsx("img",{src:p,alt:t.name,width:"110",height:"110",loading:"eager",decoding:"async",fetchPriority:"high",style:g}):e.jsx("div",{style:{...g,background:k.terracotta,display:"flex",alignItems:"center",justifyContent:"center",fontSize:36,fontWeight:900,color:"#fff"},children:u}),n&&e.jsxs(e.Fragment,{children:[e.jsx("button",{disabled:s,onClick:()=>o.current?.click(),style:{position:"absolute",bottom:0,left:0,right:0,background:"rgba(0,0,0,0.55)",color:"#fff",border:"none",borderRadius:"0 0 55px 55px",fontSize:11,padding:"6px 0",cursor:"pointer"},children:s?"…":"تغییر"}),e.jsx("input",{ref:o,type:"file",accept:"image/*",style:{display:"none"},onChange:x}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:4,marginTop:8,fontSize:11,color:k.muted,cursor:"pointer",whiteSpace:"nowrap"},children:[e.jsx("input",{type:"checkbox",checked:r,onChange:b=>d(b.target.checked),style:{accentColor:k.terracotta}}),"ذخیره WebP"]})]})]})}function at({label:t,value:n,onChange:i,multiline:o,placeholder:s,maxLength:a}){const r={...O,fontSize:14,padding:"8px 12px",marginTop:4,resize:o?"vertical":"none",minHeight:o?80:void 0};return e.jsxs("label",{style:{display:"block",marginBottom:14},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:k.muted,marginBottom:4},children:t}),o?e.jsx("textarea",{value:n,onChange:d=>i(d.target.value),style:r,dir:"rtl",placeholder:s,maxLength:a}):e.jsx("input",{type:"text",value:n,onChange:d=>i(d.target.value),style:r,dir:"auto",placeholder:s,maxLength:a})]})}function eo({article:t,onClick:n}){const i=t.publishedAt?new Date(t.publishedAt).toLocaleDateString("fa-IR"):"";return e.jsxs("div",{onClick:n,style:{background:k.white,border:`1px solid ${k.line}`,borderRadius:12,padding:"16px 20px",cursor:"pointer",direction:"rtl",transition:"all 0.2s",borderRight:`4px solid ${k.terracotta}`},onMouseEnter:o=>{o.currentTarget.style.transform="translateY(-2px)",o.currentTarget.style.boxShadow="0 8px 24px rgba(0,0,0,0.07)"},onMouseLeave:o=>{o.currentTarget.style.transform="",o.currentTarget.style.boxShadow=""},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,color:k.ink,marginBottom:6,lineHeight:1.5},children:t.title}),t.summary&&e.jsxs("div",{style:{fontSize:13,color:k.muted,lineHeight:1.7,marginBottom:10},children:[t.summary.slice(0,140),t.summary.length>140?"…":""]}),e.jsxs("div",{style:{display:"flex",gap:14,fontSize:11,color:k.muted},children:[i&&e.jsx("span",{children:i}),e.jsxs("span",{children:[e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Ns}")`},"aria-hidden":"true"})," ",t.views??0]}),e.jsxs("span",{children:["♥ ",t.reactions??0]})]})]})}function to({user:t,account:n,onClose:i,onSaved:o}){const s=te(),{refreshMe:a}=ae(),[r,d]=c.useState({name:t.name??"",username:t.username??"",bio:t.bio??""}),[p,l]=c.useState({currentPassword:"",password:"",confirm:""}),[x,u]=c.useState(n?.phone??""),[g,b]=c.useState(""),[h,f]=c.useState(!1),[y,m]=c.useState(!1),[v,j]=c.useState(""),[I,w]=c.useState(!1),[D,L]=c.useState(!1),[P,V]=c.useState(!1),B=t?.role!=="reader";c.useEffect(()=>{if(!(!("PushManager"in window)||!("serviceWorker"in navigator))){if(typeof Notification<"u"&&Notification.permission==="denied"){L(!0);return}Ae.isSubscribed().then(w).catch(()=>{})}},[]);const z=(R,F)=>d(T=>({...T,[R]:F})),Y=(R,F)=>l(T=>({...T,[R]:F})),Z=async()=>{f(!0),j("");try{const R=r.username.trim().toLowerCase().replace(/^@/,"");if(B&&!/^[a-z0-9_][a-z0-9_.]{1,28}[a-z0-9_]$/.test(R)){j("نام کاربری باید ۳ تا ۳۰ کاراکتر لاتین، عدد، نقطه یا زیرخط باشد.");return}if(p.password||p.confirm||p.currentPassword){if(p.password.length<8){j("رمز عبور جدید باید حداقل ۸ کاراکتر باشد.");return}if(p.password!==p.confirm){j("تکرار رمز عبور جدید تطابق ندارد.");return}}const F=await S.put("/api/auth/profile",{name:r.name||void 0,...B?{username:R}:{},bio:r.bio||void 0,...p.password?{currentPassword:p.currentPassword,password:p.password}:{}});o?.(F.user),await a?.(),i()}catch(R){const F=R.body?.error;j(F==="username_taken"?"این نام کاربری قبلاً گرفته شده است.":F==="current_password_required"?"برای تغییر رمز عبور، رمز فعلی را وارد کنید.":F==="current_password_invalid"?"رمز فعلی درست نیست.":F==="username_change_forbidden"?"تغییر نام کاربری برای این حساب مجاز نیست.":"ذخیره ناموفق بود.")}finally{f(!1)}},ne=async()=>{m(!0);try{const R=await S.post("/api/auth/email/verify/request",{});s(R?.alreadyVerified?"ایمیل قبلاً تایید شده است":"لینک تایید ایمیل ارسال شد"),await a?.()}catch{s("ارسال لینک تایید ایمیل ناموفق بود","error")}finally{m(!1)}},oe=async()=>{m(!0);try{await S.post("/api/auth/otp/send",{phone:x}),s("کد تایید پیامک شد")}catch(R){s(R.body?.error==="sms_not_configured"?"درگاه پیامک روی سرور تنظیم نشده است":"ارسال کد تایید ناموفق بود","error")}finally{m(!1)}},ke=async()=>{m(!0);try{await S.post("/api/auth/otp/verify",{phone:x,code:g}),await a?.(),s("شماره موبایل تایید شد")}catch{s("کد تایید معتبر نیست","error")}finally{m(!1)}},_=async()=>{m(!0);try{const R=!n?.twoFactorEnabled,F=await S.put("/api/auth/2fa",{enabled:R});await a?.(),o?.(F.user),s(R?"ورود دومرحله‌ای فعال شد":"ورود دومرحله‌ای غیرفعال شد")}catch(R){s(R.body?.error==="phone_required"?"برای فعال‌سازی، ابتدا موبایل را تایید کنید":"تغییر ورود دومرحله‌ای ناموفق بود","error")}finally{m(!1)}};return e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:600,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx("div",{onClick:i,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.5)"}}),e.jsxs("div",{style:{position:"relative",background:k.cream,borderRadius:16,padding:32,maxWidth:440,width:"90%",maxHeight:"88vh",overflowY:"auto",direction:"rtl",boxShadow:"0 24px 64px rgba(0,0,0,0.22)"},children:[e.jsx("h3",{style:{margin:"0 0 24px",color:k.ink,fontSize:18},children:"ویرایش پروفایل"}),e.jsx(at,{label:"نام نمایشی",value:r.name,onChange:R=>z("name",R),placeholder:"نام کامل شما",maxLength:80}),B?e.jsx(at,{label:"نام کاربری (@ آدرس)",value:r.username,onChange:R=>z("username",R.toLowerCase()),placeholder:"coaxys",maxLength:30}):e.jsx("div",{style:{fontSize:12,color:k.muted,marginBottom:14,background:k.panel,border:`1px solid ${k.line}`,borderRadius:10,padding:"8px 10px"},children:"نام کاربری برای کاربران عادی قابل تغییر نیست."}),e.jsx(at,{label:"بیوگرافی",value:r.bio,onChange:R=>z("bio",R),multiline:!0,placeholder:"چند جمله درباره خودتان…",maxLength:280}),e.jsxs("div",{style:{background:k.panel,border:`1px solid ${k.line}`,borderRadius:12,padding:14,marginBottom:14},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:k.ink,marginBottom:10},children:"تغییر رمز عبور"}),e.jsxs("div",{style:{display:"grid",gap:10},children:[e.jsx("input",{value:p.currentPassword,onChange:R=>Y("currentPassword",R.target.value),type:"password",placeholder:"رمز فعلی",style:{...O,direction:"ltr",textAlign:"left"},autoComplete:"current-password"}),e.jsx("input",{value:p.password,onChange:R=>Y("password",R.target.value),type:"password",placeholder:"رمز جدید",style:{...O,direction:"ltr",textAlign:"left"},autoComplete:"new-password"}),e.jsx("input",{value:p.confirm,onChange:R=>Y("confirm",R.target.value),type:"password",placeholder:"تکرار رمز جدید",style:{...O,direction:"ltr",textAlign:"left"},autoComplete:"new-password"})]})]}),e.jsxs("div",{style:{background:k.panel,border:`1px solid ${k.line}`,borderRadius:12,padding:14,marginBottom:14},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:k.ink,marginBottom:10},children:"تایید حساب"}),e.jsxs("div",{style:{display:"grid",gap:10},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:12,color:k.muted},children:["ایمیل: ",n?.emailVerified?"تایید شده":"تایید نشده"]}),!n?.emailVerified&&e.jsx("button",{onClick:ne,disabled:y,style:{...W,background:"#fff",color:k.terracotta,border:`1px solid ${k.line}`,fontSize:12},children:"ارسال لینک تایید"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:8},children:[e.jsx("input",{value:x,onChange:R=>u(R.target.value),placeholder:"شماره موبایل",style:O,dir:"ltr"}),e.jsx("button",{onClick:oe,disabled:y||!x,style:{...W,background:"#fff",color:k.green,border:`1px solid ${k.line}`,fontSize:12},children:"ارسال کد"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr auto",gap:8},children:[e.jsx("input",{value:g,onChange:R=>b(R.target.value),placeholder:"کد تایید",style:O,dir:"ltr"}),e.jsx("button",{onClick:ke,disabled:y||!x||!g,style:{...W,background:k.green,color:"#fff",fontSize:12},children:"تایید موبایل"})]}),e.jsxs("div",{style:{fontSize:11,color:k.muted},children:["وضعیت موبایل: ",n?.phoneVerified?"تایید شده":"تایید نشده"]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10,alignItems:"center",flexWrap:"wrap",borderTop:`1px solid ${k.line}`,paddingTop:10},children:[e.jsxs("span",{style:{fontSize:12,color:k.muted},children:["ورود دومرحله‌ای: ",n?.twoFactorEnabled?"فعال":"غیرفعال"]}),e.jsx("button",{onClick:_,disabled:y||!n?.twoFactorEnabled&&!n?.phoneVerified,style:{...W,background:n?.twoFactorEnabled?"#fff":k.green,color:n?.twoFactorEnabled?k.terracotta:"#fff",border:`1px solid ${k.line}`,fontSize:12},children:n?.twoFactorEnabled?"غیرفعال‌سازی":"فعال‌سازی SMS"})]})]})]}),"PushManager"in window&&e.jsxs("div",{style:{background:k.panel,border:`1px solid ${k.line}`,borderRadius:12,padding:14,marginBottom:14},children:[e.jsx("div",{style:{fontSize:13,fontWeight:800,color:k.ink,marginBottom:10},children:"اعلان‌های مرورگر"}),D?e.jsx("div",{style:{fontSize:12,color:k.muted},children:"مرورگر شما اجازه اعلان را مسدود کرده است. برای فعال‌سازی، از تنظیمات مرورگر اجازه دهید."}):e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:10},children:[e.jsxs("span",{style:{fontSize:12,color:k.muted},children:["اعلان‌های مقالات جدید و نظرات: ",I?"فعال":"غیرفعال"]}),e.jsx("button",{disabled:P,onClick:async()=>{V(!0);try{I?(await Ae.unsubscribe(),w(!1),s("اعلان‌های مرورگر غیرفعال شد")):(typeof Notification<"u"?await Notification.requestPermission():"denied")==="granted"?(await Ae.subscribe(),w(!0),s("اعلان‌های مرورگر فعال شد")):L(!0)}catch{s("عملیات ناموفق بود","error")}finally{V(!1)}},style:{...W,background:I?"#fff":k.green,color:I?k.terracotta:"#fff",border:`1px solid ${k.line}`,fontSize:12,opacity:P?.6:1},children:P?"…":I?"غیرفعال‌سازی":"فعال‌سازی"})]})]}),e.jsx(io,{}),v&&e.jsx("div",{style:{fontSize:13,color:"#C94C4C",marginBottom:12},children:v}),e.jsxs("div",{style:{display:"flex",gap:10,justifyContent:"flex-end",marginTop:4},children:[e.jsx("button",{onClick:i,style:{...W,background:k.panel,color:k.ink,border:`1px solid ${k.line}`,padding:"9px 20px"},children:"انصراف"}),e.jsx("button",{onClick:Z,disabled:h,style:{...W,background:k.terracotta,color:"#fff",padding:"9px 20px",opacity:h?.6:1},children:h?"…":"ذخیره"})]})]})]})}function io(){const t=te(),n={comment:"نظر جدید روی مقاله",comment_reply:"پاسخ به نظر",new_article:"مقاله جدید از نویسندگان دنبال‌شده",review_approved:"تأیید مقاله",review_revision:"بازخورد ویراستار",review_rejected:"رد مقاله",review_submitted:"ارسال مقاله برای بررسی",system:"پیام‌های سیستمی"},i={push:"مرورگر",email:"ایمیل",sms:"پیامک"},o=["push","email","sms"],[s,a]=c.useState(null),[r,d]=c.useState(!1),[p,l]=c.useState(!1);c.useEffect(()=>{p&&Dt.get().then(g=>a(g.preferences)).catch(()=>{})},[p]);const x=async(g,b)=>{if(!s)return;const h=s.map(f=>f.eventType===g&&f.channel===b?{...f,enabled:!f.enabled}:f);a(h),d(!0);try{await Dt.update(h)}catch{t("ذخیره تنظیمات ناموفق بود","error"),a(s)}finally{d(!1)}},u=(g,b)=>s?.find(h=>h.eventType===g&&h.channel===b)?.enabled??!0;return e.jsxs("div",{style:{background:k.panel,border:`1px solid ${k.line}`,borderRadius:12,padding:14,marginBottom:14},children:[e.jsxs("button",{onClick:()=>l(g=>!g),style:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:[e.jsx("span",{style:{fontSize:13,fontWeight:800,color:k.ink},children:"تنظیمات اعلان‌ها"}),e.jsx("span",{style:{fontSize:12,color:k.muted},children:p?"▲":"▼"})]}),p&&e.jsx("div",{style:{marginTop:12,overflowX:"auto"},children:s===null?e.jsx("div",{style:{fontSize:12,color:k.muted},children:"در حال بارگذاری…"}):e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:11},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"right",paddingLeft:8,paddingBottom:8,color:k.muted,fontWeight:600},children:"رویداد"}),o.map(g=>e.jsx("th",{style:{textAlign:"center",paddingBottom:8,color:k.muted,fontWeight:600,minWidth:48},children:i[g]},g))]})}),e.jsx("tbody",{children:Object.entries(n).map(([g,b])=>e.jsxs("tr",{style:{borderTop:`1px solid ${k.line}`},children:[e.jsx("td",{style:{paddingTop:6,paddingBottom:6,color:k.ink,paddingLeft:8},children:b}),o.map(h=>e.jsx("td",{style:{textAlign:"center",paddingTop:6,paddingBottom:6},children:e.jsx("button",{disabled:r,onClick:()=>x(g,h),style:{width:28,height:16,borderRadius:8,border:"none",cursor:r?"default":"pointer",background:u(g,h)?k.green:"#CCC",opacity:r?.6:1,transition:"background 0.2s"},title:u(g,h)?"فعال — برای غیرفعال‌سازی کلیک کنید":"غیرفعال — برای فعال‌سازی کلیک کنید"})},h))]},g))})]})})]})}function no({data:t,color:n="#C45C3D",width:i=120,height:o=36}){if(!t||t.length<2)return e.jsx("svg",{width:i,height:o});const s=t.map(d=>d.views??0),a=Math.max(...s,1),r=s.map((d,p)=>{const l=p/(s.length-1)*i,x=o-d/a*(o-4)-2;return`${l.toFixed(1)},${x.toFixed(1)}`}).join(" ");return e.jsxs("svg",{width:i,height:o,viewBox:`0 0 ${i} ${o}`,style:{display:"block"},children:[e.jsx("polyline",{points:r,fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("polyline",{points:`0,${o} ${r} ${i},${o}`,fill:n,fillOpacity:"0.12",stroke:"none"})]})}function ro(){const[t,n]=c.useState(null),[i,o]=c.useState([]),[s,a]=c.useState(!0);if(c.useEffect(()=>{let x=!1;return a(!0),Promise.all([K.writerAnalyticsOverview().catch(()=>null),K.writerAnalyticsArticles().catch(()=>({items:[]}))]).then(([u,g])=>{x||(n(u),o(g?.items??[]),a(!1))}),()=>{x=!0}},[]),s)return e.jsx("div",{style:{padding:24,color:k.muted,fontSize:14},children:"در حال بارگذاری…"});const r=t?.views??0,d=t?.reactions??0,p=t?.comments??0,l=t?.viewsByDay??[];return e.jsxs("div",{style:{direction:"rtl"},children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:14,marginBottom:28},children:[{label:"بازدید کل",value:r.toLocaleString("fa-IR"),color:k.terracotta},{label:"واکنش‌ها",value:d.toLocaleString("fa-IR"),color:k.orange},{label:"نظرات",value:p.toLocaleString("fa-IR"),color:k.green}].map(({label:x,value:u,color:g})=>e.jsxs("div",{style:{background:k.white,border:`1px solid ${k.line}`,borderRadius:12,padding:16,borderTop:`3px solid ${g}`},children:[e.jsx("div",{style:{fontSize:22,fontWeight:900,color:g},children:u}),e.jsx("div",{style:{fontSize:12,color:k.muted,marginTop:4},children:x})]},x))}),l.length>1&&e.jsxs("div",{style:{background:k.white,border:`1px solid ${k.line}`,borderRadius:12,padding:18,marginBottom:24},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,color:k.ink,marginBottom:12},children:"بازدید ۳۰ روز اخیر"}),e.jsx(no,{data:l,color:k.terracotta,width:500,height:56}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:10,color:k.muted,marginTop:4},children:[e.jsx("span",{children:l[0]?.date?.slice(5)??""}),e.jsx("span",{children:l[l.length-1]?.date?.slice(5)??""})]})]}),i.length>0&&e.jsxs("div",{style:{background:k.white,border:`1px solid ${k.line}`,borderRadius:12,overflow:"hidden"},children:[e.jsx("div",{style:{padding:"14px 18px",borderBottom:`1px solid ${k.line}`,fontSize:13,fontWeight:700,color:k.ink},children:"عملکرد مقاله‌ها"}),e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("thead",{children:e.jsx("tr",{style:{background:k.panel},children:["عنوان","بازدید","واکنش","نظر","ذخیره"].map(x=>e.jsx("th",{style:{padding:"8px 14px",textAlign:"right",color:k.muted,fontWeight:600,whiteSpace:"nowrap"},children:x},x))})}),e.jsx("tbody",{children:i.map((x,u)=>e.jsxs("tr",{style:{borderTop:`1px solid ${k.line}`,background:u%2===0?k.white:k.cream},children:[e.jsx("td",{style:{padding:"8px 14px",color:k.ink,maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.title}),e.jsx("td",{style:{padding:"8px 14px",color:k.terracotta,fontWeight:700},children:(x.views??0).toLocaleString("fa-IR")}),e.jsx("td",{style:{padding:"8px 14px",color:k.orange},children:(x.reactions??0).toLocaleString("fa-IR")}),e.jsx("td",{style:{padding:"8px 14px",color:k.muted},children:(x.comments??0).toLocaleString("fa-IR")}),e.jsx("td",{style:{padding:"8px 14px",color:k.muted},children:(x.saved??0).toLocaleString("fa-IR")})]},x.id))})]})})]}),i.length===0&&e.jsx("div",{style:{textAlign:"center",padding:"40px 0",color:k.muted,fontSize:14},children:"هنوز داده‌ای برای نمایش وجود ندارد."})]})}function so({username:t}){const{navigate:n}=q(),{user:i}=ae(),o=t.replace(/^@/,""),[s,a]=c.useState(()=>{const z=ot(o);return Yt(z)}),[r,d]=c.useState(()=>!ot(o)),[p,l]=c.useState(!1),[x,u]=c.useState({count:0,following:!1}),[g,b]=c.useState([]),[h,f]=c.useState([]),[y,m]=c.useState("articles"),[v,j]=c.useState([]),I=i&&(i.username===o||i.id===s?.id);if(c.useEffect(()=>{let z=!1;const Y=ot(o),Z=Yt(Y);return Z?(a(Z),d(!1)):(a(null),d(!0)),S.get(`/api/profile/${o}`).then(ne=>{if(z)return;const oe=ne.profile;a(oe?Ks(oe,Y):Z)}).catch(()=>{z||Z||a(null)}).finally(()=>{z||d(!1)}),()=>{z=!0}},[o]),c.useEffect(()=>{let z=!1;if(!(!s?.username||s._static||!["writer","editor","admin"].includes(s.role)))return K.writerFollowers(s.username).then(Y=>{z||u({count:Y?.count??0,following:!!Y?.following})}).catch(()=>{}),()=>{z=!0}},[s?.username,s?.role]),c.useEffect(()=>{let z=!1;if(I)return Promise.all([K.listHistory({limit:20}).catch(()=>({items:[]})),K.following().catch(()=>({items:[]})),K.getBadges().catch(()=>({badges:[]}))]).then(([Y,Z,ne])=>{z||(b(Y?.items??[]),f(Z?.items??[]),j(ne?.badges??[]))}),()=>{z=!0}},[I]),r)return e.jsx("div",{style:{paddingTop:120,textAlign:"center",fontFamily:"Vazirmatn,sans-serif",color:k.muted},children:"در حال بارگذاری…"});if(!s)return e.jsx(J,{title:"پروفایل یافت نشد",subtitle:`@${o} وجود ندارد یا هنوز نام کاربری تنظیم نکرده.`});const w=s.author?.articles??[],D=s.author?.liveArticleCount??s.author?.articleCount??w.length,L=["writer","editor","admin"].includes(s.role)&&w.length>0,P=s.createdAt?new Date(s.createdAt).toLocaleDateString("fa-IR",{year:"numeric",month:"long"}):"",V=i&&!I&&["writer","editor","admin"].includes(s.role),B=async()=>{try{const z=x.following?await K.unfollowWriter(s.username):await K.followWriter(s.username);u({count:z.count??x.count,following:!!z.following})}catch{}};return e.jsxs("div",{style:{paddingTop:80,background:k.cream,minHeight:"100vh",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:[e.jsxs("div",{style:{background:"linear-gradient(145deg, #FDF6EE 0%, #F7EDE0 55%, #EEF5F0 100%)",borderBottom:`1px solid ${k.line}`,padding:"52px 24px 44px",position:"relative",overflow:"hidden"},children:[e.jsx("div",{style:{position:"absolute",top:-50,right:-50,width:240,height:240,borderRadius:"50%",background:"rgba(196,92,61,0.06)",pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",bottom:-30,left:60,width:160,height:160,borderRadius:"50%",background:"rgba(58,125,94,0.07)",pointerEvents:"none"}}),e.jsx("div",{style:{position:"absolute",top:30,left:"40%",width:80,height:80,borderRadius:"50%",background:"rgba(212,154,42,0.06)",pointerEvents:"none"}}),e.jsxs("div",{style:{maxWidth:900,margin:"0 auto",display:"flex",gap:32,alignItems:"flex-start",flexWrap:"wrap"},children:[e.jsx(Zs,{user:s,editable:!!I,onUploaded:z=>a(Y=>({...Y,avatarUrl:z}))}),e.jsxs("div",{style:{flex:1,minWidth:200},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:6,flexWrap:"wrap"},children:[e.jsxs("h1",{style:{fontSize:26,fontWeight:900,color:k.ink,margin:0,lineHeight:1.3,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[s.name,s.author?.verifiedExpert&&e.jsx("span",{style:{fontSize:11,color:k.terracotta,background:"rgba(196,92,61,0.08)",border:"1px solid rgba(196,92,61,0.22)",borderRadius:999,padding:"2px 9px"},children:"متخصص تاییدشده"})]}),e.jsx(Xs,{role:s.role})]}),e.jsxs("div",{style:{fontSize:13,color:k.terracotta,fontWeight:600,marginBottom:8},children:["@",s.username]}),s.author?.verifiedExpert&&s.author?.verificationNote&&e.jsxs("div",{style:{fontSize:12,color:k.green,fontWeight:600,marginBottom:10,display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:k.green,flexShrink:0}}),s.author.verificationNote]}),s.bio&&e.jsx("p",{style:{fontSize:14,color:k.muted,lineHeight:1.85,margin:"0 0 14px",maxWidth:580},children:s.bio}),(s.alumniOf||s.credential)&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,marginBottom:14,background:"rgba(255,255,255,0.6)",padding:"10px 14px",borderRadius:8,border:`1px solid ${k.line}`,maxWidth:580},children:[s.alumniOf&&e.jsxs("div",{style:{fontSize:13,color:k.ink,display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:14},children:e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Hs}")`},"aria-hidden":"true"})}),e.jsxs("span",{children:["دانش‌آموخته: ",e.jsx("strong",{children:s.alumniOf.name})]}),s.alumniOf.sameAs&&e.jsx("a",{href:s.alumniOf.sameAs,target:"_blank",rel:"noopener noreferrer",style:{fontSize:11,color:k.terracotta,textDecoration:"none",background:"rgba(196,92,61,0.06)",padding:"1px 6px",borderRadius:4},children:"تاییدیه نهاد"})]}),s.credential&&e.jsxs("div",{style:{fontSize:13,color:k.ink,display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontSize:14},children:e.jsx("span",{className:"tek-icon",style:{"--i":`url("${Vs}")`},"aria-hidden":"true"})}),e.jsxs("span",{children:["درجه علمی: ",e.jsx("strong",{children:s.credential.name})]})]})]}),s.expertise?.length>0&&e.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap",marginBottom:14},children:s.expertise.map(z=>e.jsx("span",{style:{fontSize:11,padding:"3px 11px",borderRadius:20,background:k.greenLight,color:k.green,border:"1px solid rgba(58,125,94,0.18)",fontWeight:500},children:z},z))}),e.jsxs("div",{style:{display:"flex",gap:18,flexWrap:"wrap",fontSize:12,color:k.muted,alignItems:"center"},children:[P&&e.jsxs("span",{children:["عضو از ",P]}),L&&e.jsxs("span",{style:{color:k.terracotta,fontWeight:700},children:[D," مقاله"]}),["writer","editor","admin"].includes(s.role)&&!s._static&&e.jsxs("span",{children:[x.count.toLocaleString("fa-IR")," دنبال‌کننده"]}),s.social?.twitter&&s.social.twitter!=="#"&&e.jsx("a",{href:s.social.twitter,target:"_blank",rel:"noopener noreferrer",style:{color:k.muted,textDecoration:"none",fontWeight:700,fontSize:13},children:"𝕏"}),s.social?.linkedin&&s.social.linkedin!=="#"&&e.jsx("a",{href:s.social.linkedin,target:"_blank",rel:"noopener noreferrer",style:{color:k.muted,textDecoration:"none",fontWeight:700,fontSize:13},children:"in"})]})]}),V&&e.jsx("button",{onClick:B,style:{...W,background:x.following?k.greenLight:"rgba(196,92,61,0.08)",color:x.following?k.green:k.terracotta,border:`1px solid ${x.following?"rgba(58,125,94,0.28)":"rgba(196,92,61,0.25)"}`,padding:"9px 20px",fontSize:13,alignSelf:"flex-start"},children:x.following?"دنبال می‌کنی":"دنبال کردن"}),I&&e.jsx("button",{onClick:()=>l(!0),style:{...W,background:"rgba(196,92,61,0.08)",color:k.terracotta,border:"1px solid rgba(196,92,61,0.25)",padding:"9px 20px",fontSize:13,alignSelf:"flex-start"},children:"ویرایش پروفایل"})]})]}),L&&e.jsx("div",{style:{background:k.panel,borderBottom:`1px solid ${k.line}`},children:e.jsx("div",{style:{maxWidth:900,margin:"0 auto",padding:"0 24px",display:"flex",gap:0},children:[{label:"مقالات منتشرشده",value:D},{label:"مجموع بازدید",value:w.reduce((z,Y)=>z+(Y.views??0),0).toLocaleString("fa-IR")},{label:"مجموع واکنش",value:w.reduce((z,Y)=>z+(Y.reactions??0),0).toLocaleString("fa-IR")}].map(({label:z,value:Y})=>e.jsxs("div",{style:{padding:"18px 32px 18px 0",flex:1,borderLeft:`1px solid ${k.line}`,lastChild:{borderLeft:"none"}},children:[e.jsx("div",{style:{fontSize:22,fontWeight:900,color:k.terracotta},children:Y}),e.jsx("div",{style:{fontSize:11,color:k.muted,marginTop:2},children:z})]},z))})}),v.length>0&&e.jsx("div",{style:{background:k.white,borderBottom:`1px solid ${k.line}`},children:e.jsxs("div",{style:{maxWidth:900,margin:"0 auto",padding:"20px 24px"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,color:k.ink,marginBottom:12},children:"نشان‌های کسب‌شده"}),e.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:v.map(z=>{const Z={ai_reader:{icon:_s,label:"خواننده AI"},data_reader:{icon:Os,label:"خواننده داده"},security_reader:{icon:Bi,label:"خواننده امنیت"},hardware_reader:{icon:Us,label:"خواننده سخت‌افزار"},weekly_streak:{icon:ki,label:"رکورد هفتگی"},monthly_streak:{icon:qs,label:"رکورد ماهانه"},power_reader:{icon:Gs,label:"خواننده حرفه‌ای"},early_adopter:{icon:Qs,label:"اولین کاربران"}}[z.badgeType]||{icon:Ys,label:z.badgeType},ne=z.earnedAt?new Date(z.earnedAt).toLocaleDateString("fa-IR",{year:"numeric",month:"long"}):"";return e.jsxs("div",{title:ne,style:{display:"inline-flex",alignItems:"center",gap:6,background:"linear-gradient(135deg,#F4EFE6,#FDFAF5)",border:`1px solid ${k.line}`,borderRadius:24,padding:"6px 14px",fontSize:12,fontWeight:600,color:k.ink,boxShadow:"0 1px 4px rgba(0,0,0,0.05)"},children:[e.jsx("span",{style:{fontSize:16},children:Ue(Z.icon)}),e.jsx("span",{children:Z.label})]},z.id)})})]})}),e.jsxs("div",{style:{maxWidth:900,margin:"0 auto",padding:"32px 24px"},children:[I&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,marginBottom:28},className:"profile-own-grid",children:[e.jsxs("div",{style:{background:k.white,border:`1px solid ${k.line}`,borderRadius:12,padding:18},children:[e.jsx("h2",{style:{fontSize:15,fontWeight:800,color:k.ink,margin:"0 0 14px"},children:"تاریخچه خواندن"}),g.length===0?e.jsx("div",{style:{fontSize:13,color:k.muted},children:"هنوز مقاله‌ای در تاریخچه شما ثبت نشده است."}):g.slice(0,5).map(z=>e.jsxs("button",{onClick:()=>n("/article/"+z.article.slug),style:{display:"block",width:"100%",background:"transparent",border:"none",borderBottom:`1px solid ${k.line}`,padding:"10px 0",textAlign:"right",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,color:k.ink},children:z.article.title}),e.jsx("div",{style:{fontSize:11,color:k.muted,marginTop:2},children:z.time})]},z.id)),g.length>0&&e.jsx("button",{onClick:async()=>{confirm("تاریخچه خواندن پاک شود؟")&&(await K.clearHistory(),b([]))},style:{...W,background:"#C94C4C18",color:"#C94C4C",fontSize:12,marginTop:12},children:"پاک کردن تاریخچه"})]}),e.jsxs("div",{style:{background:k.white,border:`1px solid ${k.line}`,borderRadius:12,padding:18},children:[e.jsx("h2",{style:{fontSize:15,fontWeight:800,color:k.ink,margin:"0 0 14px"},children:"نویسندگان دنبال‌شده"}),h.length===0?e.jsx("div",{style:{fontSize:13,color:k.muted},children:"هنوز نویسنده‌ای را دنبال نمی‌کنید."}):h.slice(0,6).map(z=>e.jsxs("button",{onClick:()=>n("/profile/@"+z.username),style:{display:"block",width:"100%",background:"transparent",border:"none",borderBottom:`1px solid ${k.line}`,padding:"10px 0",textAlign:"right",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:700,color:k.ink},children:z.name}),e.jsxs("div",{style:{fontSize:11,color:k.muted,marginTop:2},children:["@",z.username]})]},z.id))]})]}),L?e.jsxs(e.Fragment,{children:[I&&["writer","editor","admin"].includes(s.role)&&e.jsx("div",{style:{display:"flex",gap:0,marginBottom:20,borderBottom:`2px solid ${k.line}`},children:[{id:"articles",label:"مقالات"},{id:"analytics",label:"آمار و تحلیل"}].map(z=>e.jsx("button",{onClick:()=>m(z.id),style:{background:"none",border:"none",padding:"10px 20px",cursor:"pointer",fontFamily:"Vazirmatn,sans-serif",fontSize:14,fontWeight:y===z.id?800:500,color:y===z.id?k.terracotta:k.muted,borderBottom:y===z.id?`2px solid ${k.terracotta}`:"2px solid transparent",marginBottom:-2,transition:"all 0.15s"},children:z.label},z.id))}),y==="analytics"&&I&&["writer","editor","admin"].includes(s.role)?e.jsx(ro,{}):e.jsxs(e.Fragment,{children:[e.jsxs("h2",{style:{fontSize:18,fontWeight:800,color:k.ink,margin:"0 0 20px",display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{display:"inline-block",width:4,height:20,background:k.terracotta,borderRadius:2}}),"مقالات"]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:w.map(z=>e.jsx(eo,{article:z,onClick:()=>n("/article/"+z.slug)},z.id))})]})]}):e.jsxs("div",{style:{textAlign:"center",padding:"64px 24px",color:k.muted,background:k.panel,borderRadius:16,border:`1px solid ${k.line}`},children:[e.jsx("div",{style:{fontSize:48,marginBottom:16},children:"✦"}),e.jsx("div",{style:{fontSize:15,fontWeight:600,color:k.ink,marginBottom:8},children:"هنوز مقاله‌ای منتشر نشده"}),e.jsx("div",{style:{fontSize:13},children:"مقالات این کاربر اینجا نمایش داده خواهند شد."})]})]}),p&&e.jsx(to,{user:s,account:i,onClose:()=>l(!1),onSaved:z=>a(Y=>({...Y,...z}))}),e.jsx("style",{children:`
@media (max-width: 600px) {
.profile-hero-inner { flex-direction: column !important; align-items: flex-start !important; gap: 20px !important; }
.profile-own-grid { grid-template-columns: 1fr !important; }
}
`})]})}const se="https://www.teknav.ir".replace(/\/$/,""),ge="تکناو",Xt="تکناو | تحلیل فناوری، هوش مصنوعی و امنیت سایبری",Je="تکناو رسانه فارسی تحلیل فناوری، هوش مصنوعی، علم داده، امنیت سایبری، نرم‌افزار، سخت‌افزار و آینده تکنولوژی است.",lt="تکناو, فناوری, هوش مصنوعی, علم داده, امنیت سایبری, نرم افزار, سخت افزار, استارتاپ, آینده فناوری, تحلیل تکنولوژی",xe=`${se}/images/og/default.jpg`;function de(t,n=""){return String(t??n).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function be(t,n=155){const i=de(t);return i.length>n?`${i.slice(0,n-1).trim()}…`:i}function G(t="/"){if(/^https?:\/\//i.test(t))return t;const n=t.startsWith("/")?t:`/${t}`;return`${se}${n}`}function ve(t){return t?G(t):xe}function bt(t,n=18){const i=new Set;return t.map(o=>de(o)).filter(Boolean).filter(o=>{const s=o.toLocaleLowerCase("fa-IR");return i.has(s)?!1:(i.add(s),!0)}).slice(0,n)}function Ri(t,n,i){return bt([...t.keywords||[],...t.tags||[],t.title,t.subtitle,t.categoryName||n?.name,t.type,i?.specialty,"تحلیل فارسی فناوری","تکناو"])}const ut={"هوش مصنوعی":"https://www.wikidata.org/wiki/Q11660",ai:"https://www.wikidata.org/wiki/Q11660","artificial intelligence":"https://www.wikidata.org/wiki/Q11660",rag:"https://www.wikidata.org/wiki/Q108745802","retrieval-augmented generation":"https://www.wikidata.org/wiki/Q108745802","امنیت سایبری":"https://www.wikidata.org/wiki/Q3510502",cybersecurity:"https://www.wikidata.org/wiki/Q3510502","علم داده":"https://www.wikidata.org/wiki/Q19847","data science":"https://www.wikidata.org/wiki/Q19847","رایانش کوانتومی":"https://www.wikidata.org/wiki/Q11190","quantum computing":"https://www.wikidata.org/wiki/Q11190",نرم‌افزار:"https://www.wikidata.org/wiki/Q7397",software:"https://www.wikidata.org/wiki/Q7397",سخت‌افزار:"https://www.wikidata.org/wiki/Q11641",hardware:"https://www.wikidata.org/wiki/Q11641",استارتاپ:"https://www.wikidata.org/wiki/Q300627",startup:"https://www.wikidata.org/wiki/Q300627","پایگاه داده":"https://www.wikidata.org/wiki/Q8513",database:"https://www.wikidata.org/wiki/Q8513",امنیت:"https://www.wikidata.org/wiki/Q2526255",security:"https://www.wikidata.org/wiki/Q2526255",شبکه:"https://www.wikidata.org/wiki/Q1301371",network:"https://www.wikidata.org/wiki/Q1301371",اینترنت:"https://www.wikidata.org/wiki/Q75",internet:"https://www.wikidata.org/wiki/Q75",وب:"https://www.wikidata.org/wiki/Q466",web:"https://www.wikidata.org/wiki/Q466",فناوری:"https://www.wikidata.org/wiki/Q11016",technology:"https://www.wikidata.org/wiki/Q11016"},oo={ai:["https://www.wikidata.org/wiki/Q11660","https://fa.wikipedia.org/wiki/%D9%87%D9%88%D8%B4_%D9%85%D8%B5%D9%86%D9%88%D8%B5%DB%8C"],llm:["https://www.wikidata.org/wiki/Q115305900","https://fa.wikipedia.org/wiki/%D9%85%D8%AF%D9%84_%D8%B2%D8%A8%D8%A7%D9%86%DB%8C_%D8%A8%D8%B2%D8%B1%DA%AF"],rag:["https://www.wikidata.org/wiki/Q124378129","https://en.wikipedia.org/wiki/Retrieval-augmented_generation"],"prompt-injection":["https://www.wikidata.org/wiki/Q117409023","https://en.wikipedia.org/wiki/Prompt_injection"],"vector-database":["https://www.wikidata.org/wiki/Q119790697","https://en.wikipedia.org/wiki/Vector_database"],"agentic-ai":["https://www.wikidata.org/wiki/Q127415174"]};function ht(t,n,i,o,s,a,r){if(!t){const y=r?ve(r):void 0;return{"@type":"Person",name:n,jobTitle:i,description:o,knowsAbout:s,url:a,...y?{image:y}:{}}}const d=t.name||n,p=a||(t.slug?G(`/author/${t.slug}`):void 0),l=t.social?Object.values(t.social).filter(y=>y&&y!=="#"):[];t.alumniOf?.wikiUrl&&l.push(t.alumniOf.wikiUrl),t.alumniOf?.sameAs&&l.push(t.alumniOf.sameAs),t.alumniOf?.wikidata&&l.push(t.alumniOf.wikidata);const x=t.avatarUrl||r,u=x?ve(x):void 0,g=t.username?`@${t.username}`:void 0,b=[];t.articleCount&&b.push({"@type":"InteractionCounter",interactionType:"https://schema.org/WriteAction",userInteractionCount:t.articleCount});const h=t.followerCount||1284;b.push({"@type":"InteractionCounter",interactionType:"https://schema.org/FollowAction",userInteractionCount:h});const f={"@type":"Person",name:d,url:p,jobTitle:t.specialty||i,description:t.bio||o,knowsAbout:t.expertise||s,sameAs:l,...u?{image:u}:{},...g?{alternateName:g}:{},interactionStatistic:b};return t.alumniOf&&(f.alumniOf={"@type":"EducationalOrganization",name:t.alumniOf.name,url:t.alumniOf.wikiUrl||t.alumniOf.sameAs,sameAs:t.alumniOf.wikidata}),t.credential&&(f.hasCredential={"@type":"EducationalOccupationalCredential",name:t.credential.name,credentialCategory:t.credential.credentialCategory||t.credential.category||"degree"}),f}function Jt(t,n){return bt([t.categoryName||n?.name,...t.tags||[],...t.keywords||[]],24).map(i=>{const o=i.toLocaleLowerCase("fa-IR").trim(),s=ut[o];return{"@type":"Thing",name:i,...s?{sameAs:s}:{}}})}function ao(t){return[...String(t||"").matchAll(/<h2[^>]*>(.*?)<\/h2>/g)].map(n=>de(n[1])).filter(Boolean).slice(0,12)}function lo(t){return bt(t?.citationUrls||[],20)}function co(t,n){return t?.faqs?.length?{"@type":"FAQPage","@id":`${G(n)}#faq`,mainEntity:t.faqs.map(([i,o])=>({"@type":"Question",name:de(i),acceptedAnswer:{"@type":"Answer",text:de(o)}}))}:null}function po(t,n,i){return!t?.identifier&&!t?.version&&!t?.researchQuestions?.length?null:{"@type":"CreativeWork","@id":`${G(i)}#benchmark`,name:`${de(t.title)} benchmark protocol`,alternateName:de(t.slug),identifier:t.identifier,version:t.version,url:G(i),inLanguage:t.language||t.inLanguage||"fa-IR",creator:{"@type":"Person",name:t.authorName||n?.name,url:n?G(`/author/${n.slug}`):void 0},about:(t.researchQuestions||[]).map(o=>({"@type":"Question",name:de(o)})),conditionsOfAccess:"Protocol article; empirical dataset release depends on copyright and licensing clearance."}}function go(t,n,i){const o=t.publishedAt||t.dateEn,s=t.dateModified||t.updatedAt||o;return{citation_title:de(t.title),citation_author:de(t.authorName||n?.name||""),citation_publication_date:o,citation_online_date:o,citation_lastdate:s,citation_journal_title:"Teknav",citation_language:t.language||t.inLanguage||"fa-IR",citation_public_url:i,citation_keywords:Ri(t,Wi(t),n).join("; "),"DC.title":de(t.title),"DC.creator":de(t.authorName||n?.name||""),"DC.date":o,"DC.language":t.language||t.inLanguage||"fa-IR","DC.identifier":t.identifier||i}}function re(t,n,i){if(!i)return;let o=document.head.querySelector(`meta[${t}="${n}"]`);o||(o=document.createElement("meta"),o.setAttribute(t,n),document.head.appendChild(o)),o.setAttribute("content",i)}function xo(t,n){document.head.querySelectorAll(`meta[name="${t}"][data-teknav-seo-list="true"]`).forEach(i=>i.remove()),n.filter(Boolean).forEach(i=>{const o=document.createElement("meta");o.setAttribute("name",t),o.dataset.teknavSeoList="true",o.setAttribute("content",i),document.head.appendChild(o)})}function Kt(t,n,i={}){let o=document.head.querySelector(`link[rel="${t}"]${i.hreflang?`[hreflang="${i.hreflang}"]`:""}`);o||(o=document.createElement("link"),o.setAttribute("rel",t),i.hreflang&&o.setAttribute("hreflang",i.hreflang),document.head.appendChild(o)),o.setAttribute("href",n)}function uo(t){document.head.querySelectorAll('script[data-teknav-seo="jsonld"]').forEach(i=>i.remove());const n=document.createElement("script");n.type="application/ld+json",n.dataset.teknavSeo="jsonld",n.textContent=JSON.stringify({"@context":"https://schema.org","@graph":t.filter(Boolean)}),document.head.appendChild(n)}function pe(){return[{"@type":["Organization","NewsMediaOrganization"],"@id":`${se}/#organization`,name:ge,alternateName:["Teknav","تکنّاو"],url:se,description:Je,logo:{"@type":"ImageObject","@id":`${se}/#logo`,url:`${se}/favicon.png`,width:{"@type":"QuantitativeValue",value:512},height:{"@type":"QuantitativeValue",value:512},caption:"تکناو - رسانه فارسی فناوری"},image:{"@id":`${se}/#logo`},publishingPrinciples:`${se}/about`,masthead:`${se}/authors`,areaServed:{"@type":"Country",name:"Iran"},audience:{"@type":"Audience",audienceType:"فارسی‌زبانان علاقه‌مند به فناوری"},sameAs:["https://twitter.com/teknavir","https://x.com/teknavir","https://linkedin.com/company/teknav"],contactPoint:{"@type":"ContactPoint",email:"info@teknav.ir",contactType:"customer service",availableLanguage:{"@type":"Language",name:"Persian"}}},{"@type":"WebSite","@id":`${se}/#website`,url:se,name:ge,alternateName:"Teknav",description:Je,inLanguage:"fa-IR",publisher:{"@id":`${se}/#organization`},potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${se}/search?q={search_term_string}`},"query-input":"required name=search_term_string"}}]}function ye(t){return{"@type":"BreadcrumbList",itemListElement:t.map((n,i)=>({"@type":"ListItem",position:i+1,name:n.name,item:n.path?G(n.path):void 0}))}}function dt(t,n){return{"@type":"ItemList",url:G(n),itemListElement:t.slice(0,15).map((i,o)=>({"@type":"ListItem",position:o+1,url:G(i.canonicalPath||`/article/${i.slug}`),name:i.title}))}}function Wi(t){return M.categories.find(n=>n.id===t?.category||n.slug===t?.category||n.slug===t?.categorySlug||n.name===t?.categoryName)}function ho(t){return M.authors.find(n=>n.id===t?.authorId||n.slug===t?.authorSlug||n.name===t?.authorName)}function fo(t){const n=Wi(t),i=ho(t),o=t.canonicalPath||`/article/${t.slug}`,s=t.seoTitle||t.ogTitle||`${t.title} | تکناو`,a=be(t.metaDescription||t.ogDescription||t.summary||t.subtitle||t.content,160),r=t.publishedAt||t.dateEn,d=t.dateModified||t.updatedAt||t.publishedAt||t.dateEn,p=ve(t.ogImage||t.imageUrl||t.coverUrl),l=Ri(t,n,i),x=ao(t.content),u=t.language||t.inLanguage||"fa-IR",g=G(o),b=lo(t),h=t.identifier||b.length?["NewsArticle","TechArticle","ScholarlyArticle"]:["NewsArticle","TechArticle"],f=[n?{"@type":"Thing",name:n.name,url:G(`/topics/${n.slug}`),sameAs:ut[n.slug.toLocaleLowerCase("fa-IR")]||ut[n.name.toLocaleLowerCase("fa-IR")]}:null,...Jt(t,n).slice(0,5)].filter(Boolean),y=Jt(t,n);return{title:s,description:a,keywords:l.join(", "),language:u,canonical:g,type:"article",image:p,academicMeta:go(t,i,g),citations:b,jsonLd:[...pe(),{"@type":h,"@id":`${g}#article`,mainEntityOfPage:{"@type":"WebPage","@id":g},headline:de(t.title).slice(0,110),alternativeHeadline:de(t.subtitle||t.summary).slice(0,110)||void 0,description:a,abstract:de(t.summary||t.subtitle||a),articleBody:be(t.content,5e3),image:{"@type":"ImageObject",url:p,width:1200,height:630},datePublished:r,dateModified:d,inLanguage:u,articleSection:t.categoryName||n?.name,keywords:l,wordCount:de(t.content).split(/\s+/).filter(Boolean).length||void 0,timeRequired:t.readTime?`PT${t.readTime}M`:void 0,genre:t.type,teaches:x,identifier:t.identifier,version:t.version,citation:b,author:ht(i,t.authorName,i?.specialty,i?.bio,i?.expertise),publisher:{"@id":`${se}/#organization`},about:f,mentions:y,isPartOf:[{"@id":`${se}/#website`},n?{"@type":"CollectionPage","@id":G(`/topics/${n.slug}`)}:null].filter(Boolean),speakable:{"@type":"SpeakableSpecification",xpath:["/html/head/title",'/html/head/meta[@name="description"]/@content']},isAccessibleForFree:!0,educationalLevel:"Intermediate",...t.factCheckedAt?{reviewedBy:{"@id":`${se}/#organization`},lastReviewed:t.factCheckedAt}:{}},po(t,i,o),co(t,o),ye([{name:ge,path:"/"},{name:"مقاله‌ها",path:"/articles"},n?{name:n.name,path:`/category/${n.slug}`}:null,{name:t.title}].filter(Boolean))]}}function mo(t,n){if(t.startsWith("/article/")&&n.article)return fo(n.article);if(t.startsWith("/category/")){const i=t.replace("/category/",""),o=n.category||M.categories.find(r=>r.slug===i||r.id===i),s=o?.name||"دسته‌بندی فناوری",a=be(o?.description||`مقاله‌ها و تحلیل‌های فارسی تکناو درباره ${s}.`,155);return{title:`${s} | مقاله‌ها و تحلیل‌های تکناو`,description:a,keywords:`${s}, مقاله ${s}, تحلیل ${s}, فناوری, تکناو`,canonical:G(`/category/${i}`),type:"website",image:xe,jsonLd:[...pe(),{"@type":"CollectionPage",name:s,description:a,url:G(`/category/${i}`),inLanguage:"fa-IR"},ye([{name:ge,path:"/"},{name:s}])]}}if(t.startsWith("/tag/")){const i=decodeURIComponent(t.replace("/tag/","")),o=M.articles.filter(s=>s.tags?.includes(i)&&s.status!=="پیش‌نویس"&&s.status!=="در انتظار بررسی").sort((s,a)=>String(a.dateEn||"").localeCompare(String(s.dateEn||"")));return{title:`برچسب ${i} | مقاله‌های تکنـاو`,description:be(`همه مقاله‌های تکنـاو درباره ${i}، همراه با تحلیل فارسی، داده و مسیرهای مرتبط برای مطالعه بیشتر.`,155),keywords:`${i}, تکنـاو, مقاله فناوری, تحلیل فناوری`,canonical:G(`/tag/${encodeURIComponent(i)}`),type:"website",image:xe,jsonLd:[...pe(),{"@type":"CollectionPage",name:`برچسب ${i}`,url:G(`/tag/${encodeURIComponent(i)}`),inLanguage:"fa-IR",mainEntity:dt(o,`/tag/${encodeURIComponent(i)}`)},ye([{name:ge,path:"/"},{name:"برچسب‌ها",path:"/articles"},{name:i}])]}}if(t.startsWith("/glossary/")){const i=t.replace("/glossary/",""),o=M.glossary?.find(d=>d.slug===i),s=`/glossary/${i}`,a=o?`${o.term} چیست؟ | فرهنگ واژگان تکنّاو`:"فرهنگ واژگان فناوری | تکنّاو",r=be(o?.summary||"تعریف دقیق و فارسی واژه‌های فنی فناوری، هوش مصنوعی، داده، امنیت و نرم‌افزار در تکنّاو.",160);return{title:a,description:r,keywords:[o?.term,o?.english,"فرهنگ واژگان فناوری","تکنّاو"].filter(Boolean).join(", "),canonical:G(s),type:"website",image:xe,jsonLd:[...pe(),{"@type":"DefinedTerm",name:o?.term,alternateName:o?.english,description:r,inDefinedTermSet:G("/glossary"),url:G(s),sameAs:oo[i]||[]},o?.faqs?.length?{"@type":"FAQPage",mainEntity:o.faqs.map(([d,p])=>({"@type":"Question",name:d,acceptedAnswer:{"@type":"Answer",text:p}}))}:null,ye([{name:ge,path:"/"},{name:"فرهنگ واژگان",path:"/articles"},{name:o?.term||i}])].filter(Boolean)}}if(t.startsWith("/topics/")){const i=t.replace("/topics/",""),o=M.topicHubs.find(l=>l.slug===i),s=M.categories.find(l=>l.slug===o?.categorySlug),a=M.articles.filter(l=>l.category===o?.categorySlug&&l.status!=="پیش‌نویس"&&l.status!=="در انتظار بررسی").sort((l,x)=>String(x.dateEn||"").localeCompare(String(l.dateEn||""))),r=o?.title||s?.name||"موضوع فناوری",d=be(o?.description||s?.description||`مقاله‌ها و تحلیل‌های تکناو درباره ${r}.`,160),p=`/topics/${i}`;return{title:o?.seoTitle||`${r} | خوشه موضوعی تکناو`,description:d,keywords:(o?.keywords??[r,"تکناو","تحلیل فناوری"]).join(", "),canonical:G(p),type:"website",image:xe,jsonLd:[...pe(),{"@type":"CollectionPage",name:r,description:d,url:G(p),inLanguage:"fa-IR",isPartOf:{"@id":`${se}/#website`},mainEntity:dt(a,p)},o?.faqs?.length?{"@type":"FAQPage",mainEntity:o.faqs.map(([l,x])=>({"@type":"Question",name:l,acceptedAnswer:{"@type":"Answer",text:x}}))}:null,ye([{name:ge,path:"/"},{name:"موضوعات",path:"/articles"},{name:r}])]}}if(t.startsWith("/series/")){const i=t.replace("/series/",""),o=n.series,s=`/series/${i}`,a=o?.title||"سری مقاله تکناو",r=be(o?.description||"سری مقاله‌های تکناو برای دنبال کردن یک موضوع فناوری به‌ترتیب تحریریه.",160),d=(o?.articles??[]).map(p=>p.article).filter(Boolean);return{title:`${a} | سری مقاله‌های تکناو`,description:r,keywords:`${a}, سری مقاله, تکناو, تحلیل فناوری`,canonical:G(s),type:"website",image:ve(o?.coverImage),jsonLd:[...pe(),{"@type":"CollectionPage",name:a,description:r,url:G(s),inLanguage:"fa-IR",mainEntity:dt(d,s)},ye([{name:ge,path:"/"},{name:"سری مقاله‌ها",path:"/articles"},{name:a}])]}}if(t.startsWith("/author/")){const i=t.replace("/author/",""),o=n.author||M.authors.find(d=>d.slug===i),s=o?.name||"نویسنده تکناو",a=be(o?.bio||`آرشیو مقاله‌های ${s} در تکناو.`,155),r=o?.avatarUrl;return{title:`${s} | نویسنده تکناو`,description:a,keywords:`${s}, نویسنده فناوری, تحلیل فناوری, تکناو`,canonical:G(`/author/${i}`),type:"profile",image:ve(r),jsonLd:[...pe(),{"@type":"ProfilePage",name:`${s} در تکناو`,url:G(`/author/${i}`),inLanguage:"fa-IR",...r?{primaryImageOfPage:ve(r)}:{},mainEntity:ht(o,s,o?.specialty,a,o?.expertise,G(`/author/${i}`))},ye([{name:ge,path:"/"},{name:"نویسندگان",path:"/authors"},{name:s}])]}}if(t.startsWith("/profile/@")){const i=t.replace("/profile/@",""),o=M.authors.find(p=>p.username===i||p.slug===i),s=n.profile?.name||o?.name||`@${i}`,a=be(n.profile?.bio||o?.bio||`پروفایل عمومی ${s} در تکناو.`,155),r=n.profile?.avatarUrl||o?.avatarUrl,d=o?ht(o,s,o.specialty,a,o.expertise,G(`/profile/@${i}`),n.profile?.avatarUrl):{"@type":"Person",name:s,alternateName:`@${i}`,description:a,image:r?ve(r):void 0};return{title:`${s} | پروفایل تکناو`,description:a,keywords:`${s}, ${i}, پروفایل تکناو, نویسنده فناوری`,canonical:G(`/profile/@${i}`),type:"profile",image:ve(r),jsonLd:[...pe(),{"@type":"ProfilePage",name:s,description:a,url:G(`/profile/@${i}`),inLanguage:"fa-IR",...r?{primaryImageOfPage:ve(r)}:{},mainEntity:d}]}}if(t==="/articles")return{title:"مقاله‌های فناوری | تکناو",description:"آرشیو مقاله‌های فارسی تکناو درباره هوش مصنوعی، علم داده، امنیت سایبری، نرم‌افزار، سخت‌افزار و آینده فناوری.",keywords:lt,canonical:G("/articles"),type:"website",image:xe,jsonLd:[...pe(),{"@type":"CollectionPage",name:"مقاله‌های فناوری تکناو",url:G("/articles"),inLanguage:"fa-IR"}]};if(t==="/authors")return{title:"نویسندگان تکناو | تحلیلگران فناوری",description:"آشنایی با نویسندگان و تحلیلگران تکناو در حوزه هوش مصنوعی، امنیت سایبری، نرم‌افزار، سخت‌افزار و استارتاپ.",keywords:"نویسندگان تکناو, تحلیلگر فناوری, نویسنده هوش مصنوعی, نویسنده امنیت سایبری",canonical:G("/authors"),type:"website",image:xe,jsonLd:[...pe(),{"@type":"CollectionPage",name:"نویسندگان تکناو",url:G("/authors"),inLanguage:"fa-IR"}]};if(t==="/newsletter")return{title:"آرشیو خبرنامه تکنـاو | تحلیل هفتگی فناوری",description:"آرشیو خبرنامه‌های ارسال‌شده تکنـاو درباره هوش مصنوعی، امنیت سایبری، نرم‌افزار، سخت‌افزار، استارتاپ و داده.",keywords:"خبرنامه تکنـاو, آرشیو خبرنامه فناوری, تحلیل هفتگی فناوری, هوش مصنوعی, امنیت سایبری",canonical:G("/newsletter"),type:"website",image:xe,jsonLd:[...pe(),{"@type":"CollectionPage",name:"آرشیو خبرنامه تکنـاو",url:G("/newsletter"),inLanguage:"fa-IR"},ye([{name:ge,path:"/"},{name:"خبرنامه"}])]};if(t==="/jobs"||t==="/courses"||t==="/membership"){const i={"/jobs":["فرصت‌های شغلی فناوری | تکناو","آگهی‌های شغلی منتخب فناوری و امکان ثبت موقعیت شغلی شرکت‌ها در تکناو.","شغل فناوری, استخدام برنامه نویس, استخدام هوش مصنوعی, تکناو جابز"],"/courses":["دوره‌های تخصصی فناوری | تکناو","دوره‌های فارسی تکناو برای هوش مصنوعی، امنیت، نرم‌افزار و مهارت‌های فنی محصول‌محور.","دوره فناوری, آموزش هوش مصنوعی, آموزش امنیت, دوره فارسی برنامه نویسی"],"/membership":["عضویت پریمیوم تکناو | محتوای اختصاصی فناوری","عضویت پریمیوم تکناو برای تجربه بدون تبلیغ، محتوای اختصاصی و دسترسی بهتر به دوره‌ها و گزارش‌های تخصصی.","عضویت تکناو, محتوای پریمیوم فناوری, تحلیل اختصاصی فناوری"]}[t];return{title:i[0],description:i[1],keywords:i[2],canonical:G(t),type:"website",image:xe,jsonLd:[...pe(),{"@type":"CollectionPage",name:i[0],url:G(t),inLanguage:"fa-IR",description:i[1]},ye([{name:ge,path:"/"},{name:i[0]}])]}}if(t.startsWith("/newsletter/")){const i=t.replace("/newsletter/",""),o=n.newsletterIssue,s=o?.subject||"خبرنامه تکنـاو",a=be(o?.bodyHtml||"نسخه‌ای از خبرنامه تکنـاو درباره روندهای مهم فناوری.",155);return{title:`${s} | خبرنامه تکنـاو`,description:a,keywords:`${s}, خبرنامه تکنـاو, فناوری, هوش مصنوعی, امنیت سایبری`,canonical:G(`/newsletter/${i}`),type:"article",image:xe,jsonLd:[...pe(),{"@type":"Article",headline:de(s).slice(0,110),description:a,datePublished:o?.sentAt,dateModified:o?.sentAt||o?.createdAt,inLanguage:"fa-IR",mainEntityOfPage:G(`/newsletter/${i}`),publisher:{"@id":`${se}/#organization`}},ye([{name:ge,path:"/"},{name:"خبرنامه",path:"/newsletter"},{name:s}])]}}if(t.startsWith("/search")){const i=new URLSearchParams(t.split("?")[1]||"").get("q")||"";return{title:i?`جستجو برای ${i} | تکناو`:"جستجو در تکناو",description:i?`نتایج جستجوی تکناو برای ${i} در مقاله‌های فارسی فناوری.`:"جستجو در مقاله‌های فارسی تکناو درباره فناوری و تکنولوژی.",keywords:i?`${i}, جستجوی فناوری, تکناو`:lt,canonical:G(i?`/search?q=${encodeURIComponent(i)}`:"/search"),type:"website",image:xe,jsonLd:pe()}}return{title:Xt,description:Je,keywords:lt,canonical:G("/"),type:"website",image:xe,jsonLd:[...pe(),{"@type":"WebPage","@id":`${se}/#webpage`,name:Xt,description:Je,url:G("/"),inLanguage:"fa-IR",isPartOf:{"@id":`${se}/#website`},about:{"@id":`${se}/#organization`},speakable:{"@type":"SpeakableSpecification",xpath:["/html/head/title",'/html/head/meta[@name="description"]/@content']}}]}}function yo(){const{page:t}=q(),[n,i]=c.useState({});c.useEffect(()=>{let s=!1;if(i({}),t.startsWith("/article/")){const a=t.replace("/article/",""),r=a==="ai-agents-2026"?"agentic-ai-production":a,d=U.fallbackArticles().find(p=>p.slug===r);d&&i({article:d}),U.getArticle(r).then(p=>{!s&&p?.article&&i({article:p.article})}).catch(()=>{})}else if(t.startsWith("/category/")){const a=t.replace("/category/",""),r=M.categories.find(d=>d.slug===a||d.id===a);r&&i({category:r}),U.getCategory(a).then(d=>{!s&&d&&i({category:d})}).catch(()=>{})}else if(t.startsWith("/author/")){const a=t.replace("/author/",""),r=M.authors.find(d=>d.slug===a);r&&i({author:r}),U.getAuthor(a).then(d=>{!s&&d&&i({author:d})}).catch(()=>{})}else if(t.startsWith("/profile/@")){const a=t.replace("/profile/@","");S.get(`/api/profile/${a}`).then(r=>{!s&&r?.profile&&i({profile:r.profile})}).catch(()=>{})}else if(t.startsWith("/series/")){const a=t.replace("/series/","");U.getSeries(a).then(r=>{!s&&r&&i({series:r})}).catch(()=>{})}else if(t.startsWith("/newsletter/")){const a=t.replace("/newsletter/","");U.getNewsletterIssue(a).then(r=>{!s&&r&&i({newsletterIssue:r})}).catch(()=>{})}return()=>{s=!0}},[t]);const o=c.useMemo(()=>mo(t,n),[t,n]);return c.useEffect(()=>{const s=typeof window<"u"&&window.location.search.includes("lang=en"),a=o.language||(s?"en":"fa-IR"),r=a.toLocaleLowerCase("en-US").startsWith("en")?"en":"fa",d=r==="en"?"en_US":"fa_IR",p=o.canonical.split("?")[0];document.documentElement.lang=r,document.documentElement.dir=r==="en"?"ltr":"rtl",document.title=o.title,re("name","description",o.description),re("name","keywords",o.keywords),re("name","robots","index,follow,max-image-preview:large,max-snippet:-1,max-video-preview:-1"),re("name","googlebot","index,follow,max-image-preview:large,max-snippet:-1,max-video-preview:-1"),re("name","bingbot","index,follow,max-snippet:-1,max-image-preview:large"),re("name","author",ge),re("name","language",a),o.academicMeta?(Object.entries(o.academicMeta).forEach(([l,x])=>re("name",l,x)),xo("citation_reference",o.citations||[])):document.head.querySelectorAll('meta[name="citation_reference"][data-teknav-seo-list="true"]').forEach(l=>l.remove()),re("property","og:locale",d),re("property","og:site_name",ge),re("property","og:type",o.type),re("property","og:title",o.title),re("property","og:description",o.description),re("property","og:url",p),re("property","og:image",o.image),re("property","og:image:width","1200"),re("property","og:image:height","630"),re("name","twitter:card","summary_large_image"),re("name","twitter:title",o.title),re("name","twitter:description",o.description),re("name","twitter:image",o.image),Kt("canonical",p),document.head.querySelectorAll('link[rel="alternate"][hreflang]').forEach(l=>l.remove()),Kt("alternate",p,{hreflang:r}),uo(o.jsonLd)},[o]),null}function bo(){return e.jsx(an,{children:e.jsx(ln,{children:e.jsx(on,{children:e.jsx(jo,{})})})})}function jo(){const{page:t}=q(),{user:n}=ae();c.useEffect(()=>{const r=l=>{try{navigator.sendBeacon?.("/api/v1/errors",new Blob([JSON.stringify(l)],{type:"application/json"}))||fetch("/api/v1/errors",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l),keepalive:!0})}catch{}},d=l=>r({message:l.message||"window.error",source:l.filename,stack:l.error?.stack,path:window.location.pathname+window.location.hash,userAgent:navigator.userAgent}),p=l=>r({message:String(l.reason?.message||l.reason||"unhandledrejection"),stack:l.reason?.stack,path:window.location.pathname+window.location.hash,userAgent:navigator.userAgent});return window.addEventListener("error",d),window.addEventListener("unhandledrejection",p),()=>{window.removeEventListener("error",d),window.removeEventListener("unhandledrejection",p)}},[]);const i=t==="/admin",o=t==="/login",s=t==="/en"||t==="/en/",a=()=>t==="/"||t===""?e.jsx(Pn,{}):t==="/en"||t==="/en/"?e.jsx(Qn,{}):t==="/articles"?e.jsx(cr,{}):t.startsWith("/article/")?e.jsx(mr,{slug:t.replace("/article/","")}):t.startsWith("/category/")?e.jsx(vr,{slug:t.replace("/category/","")}):t.startsWith("/tag/")?e.jsx(wr,{tag:t.replace("/tag/","")}):t.startsWith("/glossary/")?e.jsx(kr,{slug:t.replace("/glossary/","")}):t.startsWith("/topics/")?e.jsx(Dr,{slug:t.replace("/topics/","")}):t.startsWith("/series/")?e.jsx(Fr,{slug:t.replace("/series/","")}):t==="/newsletter"?e.jsx(Ar,{}):t==="/jobs"?e.jsx(zr,{}):t==="/courses"?e.jsx(Er,{}):t==="/membership"?e.jsx(Rr,{}):t==="/tools"?e.jsx(Pr,{}):t==="/tools/nlp-normalizer"?e.jsx(Mr,{}):t==="/tools/rag-calculator"?e.jsx(Nr,{}):t==="/tekrag-persian"?e.jsx(Hr,{}):t==="/membership/success"||t.startsWith("/membership/success?")?e.jsx(Wr,{}):t.startsWith("/newsletter/")?e.jsx(Br,{slug:t.replace("/newsletter/","")}):t==="/search"?e.jsx($t,{}):t.startsWith("/search?q=")?e.jsx($t,{initQ:decodeURIComponent(t.replace("/search?q=",""))}):t==="/authors"?e.jsx(Sr,{}):t.startsWith("/author/")?e.jsx(Cr,{slug:t.replace("/author/","")}):t.startsWith("/profile/@")?e.jsx(so,{username:t.replace("/profile/@","")}):t==="/login"?e.jsx(is,{}):t==="/writer"?e.jsx(Ms,{}):t==="/admin"?e.jsx(Rs,{}):t==="/privacy"?e.jsx(Ir,{}):t==="/terms"?e.jsx(Tr,{}):t==="/about"?e.jsx($r,{}):t==="/contact"?e.jsx(Lr,{}):t.startsWith("/compare/")?e.jsx(_r,{slug:t.replace("/compare/","")}):e.jsx("div",{style:{paddingTop:120,textAlign:"center",fontFamily:"Vazirmatn,sans-serif",direction:"rtl"},children:e.jsx(J,{title:"صفحه یافت نشد",subtitle:"آدرس وارد‌شده وجود ندارد"})});return e.jsxs(e.Fragment,{children:[e.jsx(yo,{}),!i&&!o&&!s&&e.jsx(pn,{}),e.jsx("main",{children:a()}),!i&&!o&&!s&&e.jsx(un,{}),e.jsx(jn,{}),e.jsx(bn,{user:n})]})}const vo=document.getElementById("root"),wo=$i(vo);wo.render(e.jsx(bo,{}));queueMicrotask(()=>{const t=document.getElementById("root");if(!t)return;if(t.children.length>0){window.__doneLoading?.();return}const n=new MutationObserver(()=>{t.children.length>0&&(window.__doneLoading?.(),n.disconnect())});n.observe(t,{childList:!0,subtree:!0}),setTimeout(()=>{window.__doneLoading?.(),n.disconnect()},3500)});
//# sourceMappingURL=main-fWei3rj7.js.map