PageSourceSearch

https://itibarskoru.com/assets/hesabim-BNn3M0zI.js

js itibarskoru.com collected 2026-09-24 14:46:17 UTC 48,785 bytes, 3 lines download raw bytes

1import{d3 as H,fK as ge,fF as z,e5 as e,aD as k,fz as je,eC as h,dN as ve,eH as ke,eU as Ne,fd as v,fm as L,dJ as we,dP as Te,eb as O,ea as me,a6 as Se,da as Ce,cB as Y,bX as ue,b0 as U,ak as ze,cU as w,bl as D,ay as Ae,dI as Ee,ao as _e,a4 as xe,r as Me,A as Z,fG as K,dH as qe,e7 as Pe,p as Re,c3 as Le,aF as C,bs as De,K as Ie,fw as Ke,ez as J,cH as Fe,ec as $e,fc as P,e4 as Be,bp as Oe,f6 as Ye,t as W,Q as I,cw as Ue,as as _,a5 as He,ca as Ve,aq as Ge,D as Qe,aE as Ze,bQ as Je,dp as We,dn as X,e8 as ee,fb as Xe,dK as ea,am as aa,I as ra,b2 as sa,bV as ta,eY as ia,ft as la,bN as na,q as da,ct as oa,k as ca,ey as ma,cu as ua}from"./index-BMeuYGxl.js";import{a as xa}from"./account-deletion.functions-x2BHdINX.js";import{P as pa}from"./ProfilePolls-DufQuqor.js";import{T as V}from"./trophy-DKuNvESo.js";import{e as pe}from"./export-table-DZ9UrqIT.js";import{AWARD_EVENT as ae}from"./member-activity-B-IMEPtE.js";import{u as ha}from"./useMutation-HvDD6-_X.js";import{l as ba,r as fa,P as ya}from"./PollStatusGuide-BGibahIP.js";import{A as ga}from"./archive-Cy5Pq4-I.js";import{C as ja}from"./chart-column-ZYvoGsOB.js";import{M as va}from"./message-square-lh54crG1.js";import{F as ka}from"./FavoritePollstersPanel-kT_S30CZ.js";import{T as Na,b as wa,c as M,a as q}from"./tabs-DT-bzRBY.js";import{S as re,c as se,d as te,a as ie,b as R,T as Ta}from"./select-Cwv6gvgG.js";import{S as Sa}from"./save-gUBNoKtl.js";import{C as Ca}from"./clock-3-CBrMRMey.js";import{L as za}from"./lock-keyhole-D-gVGmJn.js";import{I as Aa}from"./image-plus-BYKMzIzG.js";import"./list-checks-B0zEU--f.js";const Ea=[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]],_a=H("award",Ea);const Ma=[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]],qa=H("medal",Ma);const Pa=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],le=H("message-square-text",Pa);function Ra(){const r=ge(xa),{data:s}=z({queryKey:["account-deletion-available"],queryFn:()=>r(),staleTime:6e4,retry:!1});return s?e.jsxs("div",{className:"mt-8 border-t border-border pt-5",children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Hesap işlemleri"}),e.jsx(k,{to:"/hesap-sil",className:"inline-flex min-h-11 items-center text-sm text-destructive",children:"Hesabımı sil"})]}):null}function La(){const{member:r}=je(),[s,f]=h.useState(null),p=z({queryKey:["profile-connections",r?.id],queryFn:ve,enabled:!!r,refetchInterval:3e4});async function c(l,n){if(!s){f(l);try{n==="remove"?await ke(l):await Ne(l,n==="accept"),v.success(n==="accept"?"Takip isteği kabul edildi.":n==="remove"?"Takipçi kaldırıldı.":"Takip isteği reddedildi.")}catch(t){v.error(t instanceof Error?t.message:"İşlem tamamlanamadı.")}finally{f(null)}}}return p.isPending?e.jsx("p",{className:"p-4 text-sm",children:"Takip bilgileri yükleniyor…"}):p.isError?e.jsx("button",{className:"p-4 text-sm text-primary",onClick:()=>{p.refetch()},children:"Takip bilgileri alınamadı. Tekrar dene."}):e.jsxs("section",{className:"mb-5 space-y-5 rounded-2xl border border-border bg-card p-5",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"font-semibold",children:["Takip istekleri (",p.data?.requests.length??0,")"]}),!p.data?.requests.length&&e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Bekleyen takip isteği yok."}),p.data?.requests.map(l=>e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-2 border-t border-border pt-3",children:[e.jsx(k,{to:"/profil/$id",params:{id:l.id},search:{},className:"text-sm font-semibold text-primary",children:l.display_name||"Üye"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{disabled:!!s,onClick:()=>{c(l.id,"accept")},className:"rounded-xl bg-primary px-3 py-2 text-sm text-primary-foreground",children:"Kabul et"}),e.jsx("button",{disabled:!!s,onClick:()=>{c(l.id,"decline")},className:"rounded-xl border border-border px-3 py-2 text-sm",children:"Reddet"})]})]},l.id))]}),e.jsxs("details",{children:[e.jsxs("summary",{className:"cursor-pointer font-semibold",children:["Takipçilerin (",p.data?.followers.length??0,")"]}),p.data?.followers.map(l=>e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-border pt-3",children:[e.jsx(k,{to:"/profil/$id",params:{id:l.id},search:{},className:"min-w-0 truncate text-sm text-primary",children:l.display_name||"Üye"}),e.jsx("button",{disabled:!!s,onClick:()=>{c(l.id,"remove")},className:"shrink-0 rounded-xl border border-border px-3 py-2 text-xs",children:"Takipçiyi çıkar"})]},l.id))]})]})}function Da({className:r}){const{user:s}=L(),{data:f,isLoading:p}=z({queryKey:["itibar-member-stats",s?.id],queryFn:()=>we(),staleTime:3e4}),{data:c}=z({queryKey:["itibar-quota",s?.id??null],queryFn:()=>Te(),enabled:!!s,staleTime:6e4}),l=c?.viewerId===s?.id&&c?.unlimited===!0,n=f??Se,t=O(n),u=me(n),j=u.filter(o=>o.earned),m=l?"Sınırsız":Ce(!0,n);
1return e.jsxs("section",{className:w("rounded-3xl border border-border bg-card p-5 sm:p-6",r),"aria-label":"İtibar Elçileri programı",children:[e.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"inline-flex items-center gap-2 text-xs font-bold uppercase tracking-wide text-primary",children:[e.jsx(V,{className:"h-4 w-4","aria-hidden":"true"})," İtibar Elçileri Programı"]}),e.jsxs("h2",{className:"mt-2 text-2xl font-bold text-foreground",children:[e.jsx("span",{"aria-hidden":"true",children:t.level.emoji})," ",t.level.title]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:l?"Hesabında sınırsız itibar sorgulaması etkin.":t.level.perk})]}),e.jsxs("div",{className:"rounded-2xl bg-primary/10 px-4 py-3 text-right",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground",children:"İtibar puanın"}),e.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary",children:t.points})]})]}),p&&e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"İstatistikler yükleniyor…"}),e.jsxs("div",{className:"mt-5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs font-semibold text-muted-foreground",children:[e.jsx("span",{children:t.level.title}),e.jsx("span",{children:t.next?`${t.next.title} için ${t.pointsToNext} puan`:"En üst ünvana ulaştın"})]}),e.jsx("div",{className:"mt-2 h-2 w-full overflow-hidden rounded-full bg-border",role:"progressbar","aria-valuenow":t.percent,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Ünvan ilerlemesi",children:e.jsx("div",{className:"h-full rounded-full bg-primary transition-all",style:{width:`${t.percent}%`}})})]}),e.jsx("dl",{className:"mt-5 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[{label:"Oy",value:n.votes,Icon:Y},{label:"Paylaşım",value:n.shares,Icon:ue},{label:"Anket",value:n.polls,Icon:U},{label:"Günlük sorgu",value:m,Icon:ze}].map(({label:o,value:a,Icon:x})=>e.jsxs("div",{className:"rounded-2xl border border-border bg-background p-3",children:[e.jsxs("dt",{className:"inline-flex items-center gap-1.5 text-xs font-semibold text-muted-foreground",children:[e.jsx(x,{className:"h-3.5 w-3.5 text-primary","aria-hidden":"true"})," ",o]}),e.jsx("dd",{className:"mt-1 text-xl font-bold tabular-nums text-foreground",children:a})]},o))}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("h3",{className:"text-sm font-bold text-foreground",children:["Rozetler ",e.jsxs("span",{className:"text-muted-foreground",children:["(",j.length,"/",u.length,")"]})]}),e.jsx("ul",{className:"mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2",children:u.map(o=>e.jsxs("li",{className:w("flex items-center gap-3 rounded-2xl border p-3",o.earned?"border-primary/40 bg-primary/5":"border-border bg-background opacity-80"),children:[e.jsx("span",{className:"text-2xl","aria-hidden":"true",children:o.emoji}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"truncate text-sm font-bold text-foreground",children:[o.label,o.earned&&e.jsx("span",{className:"ml-1 text-primary",children:"✓"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[o.description," (",Math.min(o.current,o.goal),"/",o.goal,")"]})]})]},o.id))})]}),e.jsxs("div",{className:"mt-6 rounded-2xl border border-primary/25 bg-primary/5 p-4",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:l?"Sınırsız sorgulama hakkın etkin":"Daha fazla sorgu hakkı kazan"}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:l?"Dilediğin kadar sorgulama yapabilirsin. Oy verip paylaşarak rozet ve ünvan kazanmaya devam edebilirsin.":e.jsxs(e.Fragment,{children:["Her yeni ankete oy +",D.perVote," sorgu, her paylaşım +",D.perShare," sorgu, onaylanan her anket önerisi +",D.perPoll," sorgu kazandırır. Günlük üst sınır ",D.memberMax," ","sorgudur."]})}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(k,{to:"/anketler",className:"inline-flex items-center gap-1.5 rounded-full bg-primary px-3 py-1.5 text-xs font-bold text-primary-foreground transition-transform hover:scale-[1.03]",children:[e.jsx(Y,{className:"h-3.5 w-3.5","aria-hidden":"true"})," Anketlere git"]}),e.jsxs(k,{to:"/anket-olustur",className:"inline-flex items-center gap-1.5 rounded-full border border-primary/40 px-3 py-1.5 text-xs font-bold text-primary transition-transform hover:scale-[1.03]",children:[e.jsx(U,{className:"h-3.5 w-3.5","aria-hidden":"true"})," Anket öner"]})]})]}),e.jsxs("details",{className:"mt-4",children:[e.jsx("summary",{className:"cursor-pointer text-xs font-semibold text-primary",children:"Tüm ünvanlar ve puan eşikleri"}),e.jsx("ul",{className:"mt-2 space-y-1 text-xs text-muted-foreground",children:Ae.map(o=>e.jsxs("li",{className:w(o.id===t.level.id&&"font-bold text-foreground"),children:[e.jsx("span",{"aria-hidden":"true",children:o.emoji})," ",o.title," — ",o.minPoints," puan"]},o.id))})]})]})}const Ia={vote:Y,share:ue,poll:U},ne=new Intl.DateTimeFormat("tr-TR",{day:"2-digit",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit",timeZone:"Europe/Istanbul"}),Ka=new Intl.DateTimeFormat("tr-TR",{month:"long",year:"numeric",timeZone:"Europe/Istanbul"});function Fa(r){const s=[...r].sort((n,t)=>n.createdAt.localeCompare(t.createdAt)),f={votes:0,shares:0,polls:0};let p=O(f).level.id;const c=new Set,l=new Map;for(const n of s){n.kind==="vote"?f.votes+=1:n.kind==="share"?f.shares+=1:f.polls+=1;const t=[],u=O(f);u.level.id!==p&&(p=u.level.id,t.push({at:n.createdAt,label:`${u.level.title} ünvanına yükseldin`,kind:"level",emoji:u.level.emoji}));for(const j of me(f))j.earned&&!c.has(j.id)&&(c.add(j.id),t.push({at:n.createdAt,label:`${j.label} rozetini kazandın`,kind:"badge",emoji:j.emoji}));t.length&&l.set(n.id,t)}return l}function $a({className:r}){const{data:s,isLoading:f}=z({queryKey:["itibar-member-history"],queryFn:()=>Ee(),staleTime:3e4}),[p,c]=h.useState("all"),l=s??[],n=h.useMemo(()=>Fa(l),[l]),t=p==="all"?l:l.filter(a=>a.kind===p),u=h.useMemo(()=>{const a={vote:0,share:0,poll:0,points:0,quota:0};for(const x of l)a[x.kind]+=1,a.points+=x.points,a.quota+=x.quota;return a},[l]),j=h.useMemo(()=>{const a=[];for(const x of t){const i=Ka.format(new Date(x.createdAt)),g=a[a.length-1];g&&g.key===i?g.items.push(x):a.push({key:i,label:i,items:[x]})}return a},[t]),m=[{id:"all",label:`Tümü (${l.length})`},{id:"vote",label:`Oylar (${u.vote})`},{id:"share",label:`Paylaşımlar (${u.share})`},{id:"poll",label:`Anketler (${u.poll})`}],o=()=>pe("itibar-puan-gecmisi",[{key:"tarih",label:"Tarih",value:a=>ne.format(new Date(a.createdAt))},{key:"tur",label:"Etkinlik",value:a=>Z[a.kind]},{key:"hedef",label:"Hedef",value:a=>a.targetKey},{key:"puan",label:"Puan",value:a=>a.points},{key:"kota",label:"Kazanılan sorgu hakkı",value:a=>a.quota},{key:"kazanim",label:"Kazanımlar",value:a=>(n.get(a.id)??[]).map(x=>x.label).join(" | ")}],t);
1return e.jsxs("section",{className:w("rounded-3xl border border-border bg-card p-5 sm:p-6",r),"aria-label":"İtibar puanı ve rozet geçmişi",children:[e.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"inline-flex items-center gap-2 text-xs font-bold uppercase tracking-wide text-primary",children:[e.jsx(_e,{className:"h-4 w-4","aria-hidden":"true"})," Puan & rozet geçmişi"]}),e.jsx("h2",{className:"mt-2 text-xl font-bold text-foreground",children:"Kazanımlarının tam dökümü"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("button",{type:"button",onClick:o,disabled:t.length===0,className:"inline-flex items-center gap-1.5 rounded-full border border-border px-3 py-1.5 text-xs font-bold text-foreground transition hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(xe,{className:"h-3.5 w-3.5","aria-hidden":"true"})," CSV indir"]}),e.jsxs(k,{to:"/rozet-kilavuzu",className:"inline-flex items-center gap-1.5 rounded-full border border-primary/40 px-3 py-1.5 text-xs font-bold text-primary transition-transform hover:scale-[1.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(Me,{className:"h-3.5 w-3.5","aria-hidden":"true"})," Rozet kılavuzu"]})]})]}),e.jsx("dl",{className:"mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[{label:"Toplam puan",value:u.points},{label:"Kazanılan ek sorgu",value:u.quota},{label:"Oy",value:u.vote},{label:"Paylaşım",value:u.share}].map(a=>e.jsxs("div",{className:"rounded-2xl bg-muted/50 px-3 py-3",children:[e.jsx("dt",{className:"text-[11px] font-semibold text-muted-foreground",children:a.label}),e.jsx("dd",{className:"text-xl font-bold tabular-nums text-foreground",children:a.value})]},a.label))}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-1.5",role:"group","aria-label":"Geçmiş filtresi",children:m.map(a=>e.jsx("button",{type:"button",onClick:()=>
1c(a.id),"aria-pressed":p===a.id,className:w("rounded-full border px-3 py-1.5 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",p===a.id?"border-primary bg-primary text-primary-foreground":"border-border text-muted-foreground hover:text-foreground"),children:a.label},a.id))}),f?e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Geçmiş yükleniyor…"}):t.length===0?e.jsxs("p",{className:"mt-4 rounded-2xl border border-dashed border-border p-4 text-sm text-muted-foreground",children:["Henüz kayıt yok. Bir ankete oy ver ya da paylaş; her etkinlik burada puanıyla listelenir."," ",e.jsx(k,{to:"/anketler",className:"font-semibold text-primary underline",children:"Anketlere göz at"})]}):e.jsx("div",{className:"mt-4 space-y-5",children:j.map(a=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-xs font-bold uppercase tracking-wide text-muted-foreground",children:a.label}),e.jsx("ol",{className:"space-y-2",children:a.items.map(x=>{const i=Ia[x.kind],g=n.get(x.id)??[];return e.jsxs("li",{className:"rounded-2xl border border-border bg-background/60 p-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:e.jsx(i,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:Z[x.kind]}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:x.kind==="poll"?x.targetKey:e.jsxs(k,{to:"/anket/$slug",params:{slug:x.targetKey},className:"underline hover:text-primary",children:["/anket/",x.targetKey]})}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:e.jsx("time",{dateTime:x.createdAt,children:ne.format(new Date(x.createdAt))})})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsxs("p",{className:"text-sm font-bold tabular-nums text-primary",children:["+",x.points]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["+",x.quota," sorgu"]})]})]}),g.length>0&&e.jsx("ul",{className:"mt-2 space-y-1 border-t border-border pt-2",children:g.map(d=>e.jsxs("li",{className:"inline-flex items-center gap-1.5 rounded-full bg-primary/10 px-2.5 py-1 text-[11px] font-semibold text-primary",children:[d.kind==="level"?e.jsx(V,{className:"h-3 w-3","aria-hidden":"true"}):e.jsx("span",{"aria-hidden":"true",children:d.emoji}),d.label]},d.label))})]},x.id)})})]},a.key))})]})}const de=new Intl.DateTimeFormat("tr-TR",{day:"2-digit",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit",timeZone:"Europe/Istanbul"}),Ba=[{id:"30",label:"Son 30 gün"},{id:"90",label:"Son 3 ay"},{id:"365",label:"Son 1 yıl"},{id:"all",label:"Tümü"}];function Oa({className:r}){const s=K(),{data:f,isLoading:p}=z({queryKey:["itibar-member-awards"],queryFn:()=>qe(),staleTime:2e4});h.useEffect(()=>{const i=()=>{s.invalidateQueries({queryKey:["itibar-member-awards"]})};return window.addEventListener(ae,i),()=>window.removeEventListener(ae,i)},[s]);const c=f??[],l=h.useMemo(()=>c.filter(i=>!i.seen_at),[c]);h.useEffect(()=>{if(l.length===0)return;const i=l.map(d=>d.id),g=setTimeout(()=>{Pe({data:{ids:i}}).then(()=>s.invalidateQueries({queryKey:["itibar-member-awards"]}))},4e3);return()=>clearTimeout(g)},[l,s]);const[n,t]=h.useState("all"),[u,j]=h.useState("all"),m=h.useMemo(()=>{const i=u==="all"?0:Date.now()-Number(u)*24*60*60*1e3;return c.filter(g=>(n==="all"||g.kind===n)&&new Date(g.earned_at).getTime()>=i)},[c,n,u]),o=c.filter(i=>i.kind==="badge").length,a=c.filter(i=>i.kind==="level").length,x=()=>pe("itibar-rozet-unvan-gecmisi",[{key:"tur",label:"Tür",value:i=>i.kind==="level"?"Ünvan":"Rozet"},{key:"ad",label:"Ad",value:i=>i.label},{key:"tarih",label:"Kazanılma tarihi",value:i=>de.format(new Date(i.earned_at))},{key:"puan",label:"O andaki itibar puanı",value:i=>i.points}],m);
1return e.jsxs("section",{className:w("rounded-3xl border border-border bg-card p-5 sm:p-6",r),"aria-label":"Rozet ve ünvan zaman çizelgesi",children:[e.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"inline-flex items-center gap-2 text-xs font-bold uppercase tracking-wide text-primary",children:[e.jsx(V,{className:"h-4 w-4","aria-hidden":"true"})," Kazanım zaman çizelgesi"]}),e.jsx("h2",{className:"mt-2 text-xl font-bold text-foreground",children:"Rozet ve ünvanlarını ne zaman kazandın?"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[a," ünvan · ",o," rozet"]})]}),e.jsxs("button",{type:"button",onClick:x,disabled:m.length===0,className:"inline-flex items-center gap-1.5 rounded-full border border-primary/40 px-3 py-1.5 text-xs font-bold text-primary transition hover:bg-primary/10 disabled:opacity-50",children:[e.jsx(xe,{className:"h-3.5 w-3.5","aria-hidden":"true"})," CSV indir"]})]}),l.length>0&&e.jsxs("p",{role:"status","aria-live":"polite",className:"mt-4 inline-flex items-center gap-2 rounded-2xl border border-primary/40 bg-primary/10 px-3 py-2 text-sm font-semibold text-primary",children:[e.jsx(Re,{className:"h-4 w-4","aria-hidden":"true"}),l.length," yeni kazanım! E-posta bildirimi de gönderildi."]}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-1.5",role:"group","aria-label":"Kazanım türü filtresi",children:[{id:"all",label:`Tümü (${c.length})`},{id:"level",label:`Ünvanlar (${a})`},{id:"badge",label:`Rozetler (${o})`}].map(i=>e.jsx("button",{type:"button",onClick:()=>
1t(i.id),"aria-pressed":n===i.id,className:w("rounded-full border px-3 py-1.5 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",n===i.id?"border-primary bg-primary text-primary-foreground":"border-border text-muted-foreground hover:text-foreground"),children:i.label},i.id))}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",role:"group","aria-label":"Tarih aralığı filtresi",children:Ba.map(i=>e.jsx("button",{type:"button",onClick:()=>j(i.id),"aria-pressed":u===i.id,className:w("rounded-full border px-3 py-1 text-[11px] font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",u===i.id?"border-primary/60 bg-primary/10 text-primary":"border-border text-muted-foreground hover:text-foreground"),children:i.label},i.id))}),p?e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Kazanımlar yükleniyor…"}):m.length===0?e.jsx("p",{className:"mt-4 rounded-2xl border border-dashed border-border p-4 text-sm text-muted-foreground",children:"Bu filtrede kazanım yok. Ankete oy ver veya paylaş; ilk rozetin anında burada görünür."}):e.jsx("ol",{className:"mt-4 space-y-0",children:m.map((i,g)=>e.jsxs("li",{className:"relative flex gap-3 pb-4 pl-1",children:[g<m.length-1&&e.jsx("span",{className:"absolute left-[19px] top-9 h-full w-px bg-border","aria-hidden":"true"}),e.jsx("span",{className:w("z-10 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full border text-base",i.kind==="level"?"border-primary/50 bg-primary/10":"border-border bg-background"),"aria-hidden":"true",children:i.emoji}),e.jsxs("div",{className:"min-w-0 flex-1 rounded-2xl border border-border bg-background/60 p-3",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-2 text-sm font-bold text-foreground",children:[i.kind==="level"?e.jsx(qa,{className:"h-3.5 w-3.5 text-primary","aria-hidden":"true"}):e.jsx(_a,{className:"h-3.5 w-3.5 text-primary","aria-hidden":"true"}),i.label,e.jsx("span",{className:"rounded-full border border-border px-2 py-0.5 text-[10px] font-semibold uppercase text-muted-foreground",children:i.kind==="level"?"ünvan":"rozet"}),!i.seen_at&&e.jsx("span",{className:"rounded-full bg-primary px-2 py-0.5 text-[10px] font-bold text-primary-foreground",children:"yeni"})]}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:[de.format(new Date(i.earned_at))," · o andaki itibar puanı"," ",e.jsx("span",{className:"tabular-nums font-semibold",children:i.points})]})]})]},i.id))})]})}const oe={pending:{text:"Yönetici onayı bekliyor",tone:"border-amber-500/40 bg-amber-500/10 text-amber-600"},approved:{text:"Yayında",tone:"border-emerald-500/40 bg-emerald-500/10 text-emerald-600"},rejected:{text:"Reddedildi",tone:"border-destructive/40 bg-destructive/10 text-destructive"},archived:{text:"Arşivde",tone:"border-border bg-muted text-muted-foreground"}};function ce(r){return new Date(r).toLocaleDateString("tr-TR",{day:"numeric",month:"long",year:"numeric"})}function Ya({poll:r,onRepublish:s,busy:f}){const[p,c]=h.useState(!1),l=oe[r.archived&&r.status==="approved"?"archived":r.status]??oe.pending,n=r.totalVotes;return e.jsxs("li",{className:"rounded-2xl border border-border bg-background p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[r.subject," · ",ce(r.created_at)]}),e.jsx("h4",{className:"mt-1 text-base font-bold leading-snug text-foreground",children:r.question})]}),e.jsx("span",{className:w("shrink-0 rounded-full border px-2.5 py-1 text-[11px] font-bold",l.tone),children:l.text})]}),e.jsxs("details",{className:"mt-2",children:[e.jsx("summary",{className:"cursor-pointer text-xs font-semibold text-primary hover:underline",children:"Onay durumu, gerekçe ve yapılacaklar"}),e.jsx(ya,{className:"mt-2",status:r.status,archived:r.archived,reviewNote:r.review_note,expiresAt:r.expires_at})]}),r.review_note&&e.jsxs("p",{className:"mt-2 rounded-xl border border-border bg-muted/60 p-2 text-xs text-muted-foreground",children:["Yönetici notu: ",r.review_note]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("p",{className:"inline-flex items-center gap-1.5 text-xs font-bold text-foreground",children:[e.jsx(ja,{className:"h-3.5 w-3.5 text-primary","aria-hidden":"true"}
1),n.toLocaleString("tr-TR")," oy · ",r.comments.length," yorum"]}),e.jsx("ul",{className:"mt-2 space-y-1.5",children:r.options.map(t=>{const u=n>0?Math.round(t.vote_count/n*100):0;return e.jsxs("li",{children:[e.jsxs("div",{className:"flex items-center justify-between text-xs font-semibold",children:[e.jsxs("span",{className:"truncate",children:[e.jsxs("span",{"aria-hidden":"true",children:[t.emoji," "]}),t.label]}),e.jsxs("span",{className:"tabular-nums text-muted-foreground",children:[t.vote_count," · %",u]})]}),e.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-border",children:e.jsx("div",{className:"h-full rounded-full bg-primary",style:{width:`${u}%`}})})]},t.id)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>c(t=>!t),"aria-expanded":p,className:"inline-flex items-center gap-1.5 rounded-full border border-border px-3 py-1.5 text-xs font-semibold transition hover:border-primary hover:text-primary",children:[e.jsx(va,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Yorumlar (",r.comments.length,")"]}),e.jsx(k,{to:"/anketlerim/$slug",params:{slug:r.slug},className:"rounded-full bg-primary/10 px-3 py-1.5 text-xs font-bold text-primary transition hover:bg-primary/20",children:"Detay sayfası"}),r.status==="approved"&&!r.archived&&e.jsx(k,{to:"/anket/$slug",params:{slug:r.slug},className:"rounded-full border border-border px-3 py-1.5 text-xs font-semibold transition hover:border-primary hover:text-primary",children:"Anketi gör"}),r.canRequestRepublish&&e.jsxs("button",{type:"button",onClick:()=>s(r),disabled:f,className:"inline-flex items-center gap-1.5 rounded-full bg-primary px-3 py-1.5 text-xs font-bold text-primary-foreground transition hover:opacity-90 disabled:opacity-60",children:[f?e.jsx(C,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}):e.jsx(De,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Yeniden yayın için onay isteği gönder"]}),r.status==="pending"&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":"true"})," Onaylanana kadar yayına alınmaz"]})]}),p&&e.jsxs("ul",{className:"mt-3 space-y-2",children:[r.comments.length===0&&e.jsx("li",{className:"text-xs text-muted-foreground",children:"Bu ankete henüz yorum yapılmadı."}),r.comments.map(t=>e.jsxs("li",{className:"rounded-xl border border-border bg-card p-2.5",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-2 text-[11px] font-semibold text-muted-foreground",children:[t.display_name||"Okur"," · ",ce(t.created_at),t.status!=="approved"&&e.jsx("span",{className:"rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-amber-600",children:"onay bekliyor"})]}),e.jsx("p",{className:"mt-1 text-sm text-foreground",children:t.body})]},t.id))]})]})}function Ua({className:r}){const s=K(),{user:f}=L(),{data:p,isLoading:c}=z({queryKey:["itibar-my-polls",f?.id],queryFn:()=>ba(),enabled:!!f,staleTime:2e4}),[l,n]=h.useState(null),t=ha({mutationFn:m=>fa({data:{pollId:m}}),onSettled:()=>n(null),onSuccess:m=>
1{if(m.ok){v.success("Onay isteği gönderildi",{description:"Anketin yönetici onayından sonra yeniden yayına alınacak."}),s.invalidateQueries({queryKey:["itibar-my-polls"]});return}m.reason==="already_pending"?v.info("Bu anket zaten yönetici onayında."):v.info("Bu anket şu anda yayında.")},onError:m=>v.error("İstek gönderilemedi",{description:m.message})}),u=p?.polls??[],j=p?.activeCount??0;return e.jsxs("section",{className:w("rounded-3xl border border-border bg-card p-5 sm:p-6",r),"aria-label":"Yayınladığım anketler",children:[e.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"inline-flex items-center gap-2 text-xs font-bold uppercase tracking-wide text-primary",children:[e.jsx(ga,{className:"h-4 w-4","aria-hidden":"true"})," Anketlerim"]}),e.jsx("h2",{className:"mt-2 text-2xl font-bold text-foreground",children:"Yayınladığım anketler"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Geçmiş anketlerinin oy dağılımını ve yorumlarını buradan takip et. Arşive kalkan bir anket yalnızca yönetici onayıyla yeniden yayına alınır."})]}),e.jsxs("div",{className:"rounded-2xl bg-primary/10 px-4 py-3 text-right",children:[e.jsxs("p",{className:"inline-flex items-center gap-1.5 text-xs font-semibold text-muted-foreground",children:[e.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":"true"})," Yayın hakkın"]}),e.jsx("p",{className:"text-2xl font-bold tabular-nums text-primary",children:"Sınırsız"}),e.jsxs("p",{className:"mt-1 max-w-[16rem] text-[11px] text-muted-foreground",children:[j," normal anketin yayında veya incelemede. Oluşturma ve yeniden yayınlama hakkın sınırsız; acil anket kuralları ayrıdır."]})]})]}),c?e.jsxs("p",{className:"mt-5 inline-flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(C,{className:"h-4 w-4 animate-spin","aria-hidden":"true"})," Anketlerin yükleniyor…"]}):u.length===0?e.jsxs("p",{className:"mt-5 text-sm text-muted-foreground",children:["Henüz anket yayınlamadın."," ",e.jsx(k,{to:"/anket-olustur",className:"font-semibold text-primary underline",children:"İlk anketini oluştur"}),"."]}):e.jsx("ul",{className:"mt-5 space-y-3",children:u.map(m=>e.jsx(Ya,{poll:m,busy:l===m.id,onRepublish:o=>{n(o.id),t.mutate(o.id)}},m.id))})]})}function Ha(){const{user:r,profile:s,isAdmin:f,refreshProfile:p}=L(),c=K(),l=Ke({resolver:Fe($e(f)),defaultValues:J(s??{})}),{register:n,control:t,handleSubmit:u,reset:j,formState:{errors:m,isDirty:o,isSubmitting:a}}=l,x=h.useRef(null);h.useEffect(()=>{s&&(x.current!==s.id||!o)&&(j(J(s)),x.current=s.id)},[s,j,o]);const i=u(async d=>{if(!r){v.error("Kaydetmek için tekrar giriş yap.");return}try{const{data:b,error:N}=await P.auth.getUser();if(N||b.user?.id!==r.id)throw new Error("Oturumun değişti. Lütfen tekrar giriş yap.");const{data:A,error:T}=await P.from("profiles").update({...d,birth_date:d.birth_date||null}).eq("id",r.id).select("id").single();if(Be(T)){l.setError("display_name",{message:Oe},{shouldFocus:!0});return}if(T||!A)throw new Error("Profilin kaydedilemedi. Bağlantını kontrol edip tekrar dene.");await p(),j(d),Ye(),await Promise.all(["interest-recommendations","social-feed","urgent-polls","poll-detail","poll-results"].map(E=>c.invalidateQueries({queryKey:[E]}))),v.success("Profilin güncellendi",{description:d.interests.length?"Anket önerilerin ilgi alanlarına göre yenilendi.":void 0})}catch(b){v.error("Kaydedilemedi",{description:b instanceof Error?b.message:"Lütfen tekrar dene."})}}),g=d=>d?e.jsx("p",{role:"alert",className:"mt-1 text-sm text-destructive",children:d}):null;return s?e.jsx("form",{onSubmit:i,noValidate:!0,className:"member-profile-form",children:e.jsxs("fieldset",{disabled:a||!s,className:"min-w-0 space-y-7",children:[e.jsxs("section",{"aria-labelledby":"profile-privacy-heading",className:"rounded-2xl border border-border bg-card p-4",children:[e.jsx("h2",{id:"profile-privacy-heading",className:"text-base font-semibold",children:"Profil gizliliği"}),e.jsx(I,{name:"is_private",control:t,render:({field:d})=>e.jsx("div",{role:"radiogroup","aria-label":"Profil görünürlüğü",className:"mt-3 grid grid-cols-2 gap-3",children:[{value:!1,label:"Herkese açık"},{value:!0,label:"Gizli profil"}].map(b=>e.jsxs("label",{className:`flex cursor-pointer items-center gap-2 rounded-xl border p-3 text-sm ${!!d.value===b.value?"border-primary bg-primary/10":"border-border"}`,children:[e.jsx("input",{type:"radio",checked:!!d.value===b.value,onChange:()=>d.onChange(b.value),name:"profile-privacy"}),b.label]},b.label))})}),e.jsx("p",{className:"mt-3 text-xs leading-relaxed text-muted-foreground",children:"Gizli profilde anketlerin ve yeniden paylaşımların yalnızca onaylı takipçilerine görünür. Yeni takip isteklerini Takip bölümünden yönetebilirsin. Mevcut takipçilerin korunur; kullanıcı adın ve avatarın görünür kalır."})]}),e.jsxs("section",{"aria-labelledby":"personal-details-heading",children:[e.jsxs("h2",{id:"personal-details-heading",className:"member-profile-section-title",children:[e.jsx(Ue,{"aria-hidden":!0})," Seni tanıyalım"]}),e.jsx("p",{className:"mb-5 text-sm leading-relaxed text-muted-foreground",children:"Kullanıcı adın dışında tüm alanlar isteğe bağlı. Kişisel bilgilerin ve hesap bağlantıların yalnızca sana görünür."}),e.jsxs("div",{className:"member-profile-grid",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"profile-name",children:"Kullanıcı adın"}),e.jsx(_,{id:"profile-name",autoComplete:"nickname",maxLength:50,"aria-invalid":!!m.display_name,...n("display_name")}),g(m.display_name?.message)]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"profile-email",children:"E-posta"}),e.jsx(_,{id:"profile-email",type:"email",value:r?.email??"",disabled:!0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"profile-birth-date",children:"Doğum tarihi"}),e.jsx(_,{id:"profile-birth-date",type:"date",autoComplete:"bday",min:"1900-01-01",max:new Date().toISOString().slice(0,10),"aria-invalid":!!m.birth_date,...n("birth_date")}),g(m.birth_date?.message)]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"profile-gender",children:"Cinsiyet"}),e.jsx(I,{name:"gender",control:t,render:({field:d})=>e.jsxs(re,{value:d.value||"unset",onValueChange:b=>d.onChange(b==="unset"?"":b),children:[e.jsx(se,{id:"profile-gender",ref:d.ref,onBlur:d.onBlur,children:e.jsx(te,{})}),e.jsxs(ie,{children:[e.jsx(R,{value:"unset",children:"Belirtmek istemiyorum"}),e.jsx(R,{value:"kadin",children:"Kadın"}),e.jsx(R,{value:"erkek",children:"Erkek"}),e.jsx(R,{value:"diger",children:"Diğer"})]})]})}),g(m.gender?.message)]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"profile-education",children:"Eğitim durumu"}),e.jsx(I,{name:"education",control:t,render:({field:d})=>e.jsxs(re,{value:d.value||"unset",onValueChange:b=>d.onChange(b==="unset"?"":b),children:[e.jsx(se,{id:"profile-education",ref:d.ref,onBlur:d.onBlur,children:e.jsx(te,{})}),e.jsx(ie,{children:He.map(([b,N])=>e.jsx(R,{value:b||"unset",children:N},b))})]})}),g(m.education?.message)]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"profile-city",children:"Yaşadığın şehir"}),e.jsx(_,{id:"profile-city",autoComplete:"address-level2",placeholder:"Örn. Muğla",maxLength:80,...n("city")}),g(m.city?.message)]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("label",{htmlFor:"profile-occupation",children:"Meslek"}),e.jsx(_,{id:"profile-occupation",autoComplete:"organization-title",placeholder:"Ne işle uğraşıyorsun?",maxLength:100,...n("occupation")}),g(m.occupation?.message)]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx("label",{htmlFor:"profile-bio",children:"Hakkımda"}),e.jsx(Ta,{id:"profile-bio",placeholder:"Kendinden kısaca bahset.",rows:3,maxLength:400,...n("bio")}),g(m.bio?.message)]})]})]}),e.jsxs("section",{id:"ilgi-alanlari",className:"scroll-mt-28","aria-labelledby":"interests-heading",children:[e.jsxs("h2",{id:"interests-heading",className:"member-profile-section-title",children:[e.jsx(Ve,{"aria-hidden":!0})," İlgi alanların"]}),e.jsx("p",{className:"mb-4 text-sm leading-relaxed text-muted-foreground",children:"Merak ettiğin konuları seç. Akıştaki “Sana özel” bölümünde bu konularla eşleşen anketleri gör."}),e.jsx(I,{name:"interests",control:t,render:({field:d})=>e.jsx("div",{className:"member-interest-grid",children:Ge.map(b=>{const N=d.value.includes(b.id);return e.jsxs("label",{className:"member-interest-option","data-selected":N,children:[e.jsx(Qe,{checked:N,onCheckedChange:A=>d.onChange(A?[...d.value,b.id]:d.value.filter(T=>T!==b.id))}
1),e.jsx("span",{"aria-hidden":!0,children:b.emoji}),e.jsx("span",{children:b.label})]},b.id)})})}),g(m.interests?.message)]}),e.jsxs("section",{"aria-labelledby":"social-links-heading",children:[e.jsxs("h2",{id:"social-links-heading",className:"member-profile-section-title",children:[e.jsx(Ze,{"aria-hidden":!0})," Sosyal medya hesapların"]}),e.jsx("p",{className:"mb-4 text-sm leading-relaxed text-muted-foreground",children:"Profil bağlantını veya @kullanıcıadını ekle. Kullanmadığın alanları boş bırakabilirsin."}),e.jsx("div",{className:"member-profile-grid",children:Je.map(({id:d,label:b,host:N})=>e.jsxs("div",{children:[e.jsx("label",{htmlFor:`profile-social-${d}`,children:b}),e.jsx(_,{id:`profile-social-${d}`,type:"text",inputMode:"url",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,placeholder:d==="website"?"https://ornek.com":`${N}/${d==="linkedin"?"in/":""}profilin`,maxLength:400,"aria-invalid":!!m.social_links?.[d],...n(`social_links.${d}`)}),g(m.social_links?.[d]?.message)]},d))})]}),e.jsxs("div",{className:"member-profile-save",children:[e.jsxs(W,{type:"submit",disabled:a||!o,className:"min-h-12 rounded-xl px-6",children:[a?e.jsx(C,{className:"animate-spin","aria-hidden":!0}):e.jsx(Sa,{"aria-hidden":!0}),a?"Kaydediliyor…":"Değişiklikleri kaydet"]}),e.jsx(k,{to:"/",search:{akis:"sana-ozel"},className:"inline-flex min-h-11 items-center text-sm font-semibold text-primary",children:"Anket önerilerime git →"})]})]})}):e.jsxs("div",{role:"status",className:"mt-6 space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Profil bilgilerin henüz yüklenemedi."}),e.jsx(W,{variant:"outline",onClick:()=>{p()},children:"Tekrar yükle"})]})}function Va({reportUser:r}={}){const{user:s,profile:f}=L(),p=K(),[c,l]=h.useState(null),[n,t]=h.useState([]),[u,j]=h.useState(r?`Kullanıcı bildirimi: https://itibarskoru.com/profil/${r}
2
3Bildirim nedeni: `:""),[m,o]=h.useState(!0),[a,x]=h.useState(!1),[i,g]=h.useState(!1),[d,b]=h.useState(""),N=h.useRef(null),A=h.useRef(null),T=h.useCallback(()=>{requestAnimationFrame(()=>{const y=N.current;y&&(y.scrollTop=y.scrollHeight)})},[]),E=h.useCallback(async()=>{s&&await p.invalidateQueries({queryKey:["support-menu-thread",s.id]})},[p,s]),F=h.useCallback(async()=>{if(l(null),t([]),g(!1),!s){o(!1);return}o(!0);try{const y=await We(s.id);if(l(y),!y)return;const S=await X(y.id);t(S),y.unread_for_user>0&&(await ee(y.id,"user"),await E()),T()}catch{g(!0)}finally{o(!1)}},[E,T,s]);h.useEffect(()=>{F()},[F]),h.useEffect(()=>{if(!(!c||c.status!=="open"))return Xe(c.id,y=>{t(S=>S.some($=>$.id===y.id)?S:[...S,y]),y.sender==="admin"&&(ee(c.id,"user").then(E).catch(()=>{}),b("Destek ekibinden yeni bir yanıt geldi.")),T()})},[E,T,c]);const G=h.useCallback(async()=>{if(!s)throw new Error("Oturum bulunamadı");const y=await ea({userId:s.id,displayName:f?.display_name??s.email?.split("@")[0]??"Üye",email:s.email??null,subject:"Destek talebi"});return l(y),y},[f?.display_name,s]),he=async()=>{if(!a){x(!0);try{const y=await G();t(await X(y.id)),b("Yeni destek talebi hazır."),requestAnimationFrame(()=>A.current?.focus())}catch{v.error("Yeni destek talebi açılamadı",{description:"Lütfen bağlantını kontrol edip tekrar dene."})}finally{x(!1)}}},be=async y=>{y.preventDefault();const S=u.trim();if(!(!s||!S||a||c?.status==="closed")){x(!0);try{const $=c??await G(),Q=await ia($.id,"user",S);t(B=>B.some(ye=>ye.id===Q.id)?B:[...B,Q]),j(""),b("Mesajın destek ekibine iletildi."),v.success("Mesajın destek ekibine iletildi"),T()}catch{v.error("Mesaj gönderilemedi",{description:"Mesajın kaydedilemedi. Lütfen kısa bir süre sonra tekrar dene."})}finally{x(!1)}}},fe=c?c.status==="closed"?"Sonuçlandı":"Görüşme açık":"Yeni talep";return e.jsxs("section",{className:"member-support-center","aria-labelledby":"member-support-heading",children:[e.jsxs("div",{className:"member-support-overview",children:[e.jsxs("p",{className:"member-support-eyebrow",children:[e.jsx(aa,{"aria-hidden":!0})," Üye desteği"]}),e.jsx("h2",{id:"member-support-heading",children:"Destek Merkezi"}),e.jsx("p",{className:"member-support-lead",children:"Hesabın, profilin, anketlerin veya itibar sorgulamalarıyla ilgili mesajını ilet. Yanıtları güvenle burada takip et."}),e.jsxs("div",{className:"member-support-assurances","aria-label":"Destek bilgileri",children:[e.jsxs("div",{children:[e.jsx(Ca,{"aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("strong",{children:"Planlı ger
3i dönüş"}),"Genellikle 24 saat içinde yanıt"]})]}),e.jsxs("div",{children:[e.jsx(za,{"aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("strong",{children:"Özel görüşme"}),"Yalnızca sen ve yetkili destek ekibi görür"]})]}),e.jsxs("div",{children:[e.jsx(ra,{"aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("strong",{children:"Tek noktadan takip"}),"Mesajların ve yanıtların bu alanda kalır"]})]})]})]}),e.jsxs("div",{className:"member-support-conversation",children:[e.jsxs("header",{className:"member-support-conversation-header",children:[e.jsx("span",{className:"member-support-conversation-icon",children:e.jsx(le,{"aria-hidden":!0})}),e.jsxs("div",{children:[e.jsx("h3",{children:"Destek görüşmen"}),e.jsx("p",{children:"Mesajlarını destek ekibimiz yanıtlar."})]}),e.jsx("span",{className:"member-support-status","data-status":c?.status??"new",children:fe})]}),e.jsx("p",{role:"status","aria-live":"polite",className:"sr-only",children:d}),e.jsx("div",{ref:N,className:"member-support-messages",role:"log","aria-live":"polite","aria-relevant":"additions","aria-busy":m,children:m?e.jsxs("div",{className:"member-support-state",role:"status",children:[e.jsx(C,{className:"animate-spin","aria-hidden":!0}),e.jsx("p",{children:"Mesajlar yükleniyor…"})]}):i?e.jsxs("div",{className:"member-support-state",role:"alert",children:[e.jsx("p",{children:"Destek görüşmen şu anda yüklenemedi."}),e.jsx("button",{type:"button",onClick:()=>{F()},children:"Tekrar dene"})]}):n.length===0?e.jsxs("div",{className:"member-support-state",children:[e.jsx(le,{"aria-hidden":!0}),e.jsx("h3",{children:"Nasıl yardımcı olabiliriz?"}),e.jsx("p",{children:"Yardım istediğin konuyu ve karşılaştığın durumu ayrıntılarıyla yazabilirsin."})]}):n.map(y=>e.jsxs("article",{className:"member-support-message","data-sender":y.sender,children:[e.jsx("p",{className:"member-support-message-sender",children:y.sender==="admin"?"Destek ekibi":"Sen"}),e.jsx("p",{className:"member-support-message-body",children:y.body}),e.jsx("time",{dateTime:y.created_at,children:new Date(y.created_at).toLocaleString("tr-TR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})})]},y.id))}),c?.status==="closed"?e.jsxs("div",{className:"member-support-closed",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Bu görüşme sonuçlandı."}),e.jsx("p",{children:"Farklı bir konuda yardıma ihtiyacın varsa yeni bir talep başlatabilirsin."})]}),e.jsxs("button",{type:"button",onClick:()=>{he()},disabled:a,children:[a?e.jsx(C,{className:"animate-spin","aria-hidden":!0}):e.jsx(sa,{"aria-hidden":!0}),"Yeni talep"]})]}):e.jsxs("form",{onSubmit:be,className:"member-support-compose",children:[e.jsx("label",{htmlFor:"member-support-message",children:"Mesajın"}),e.jsx("textarea",{ref:A,id:"member-support-message",value:u,onChange:y=>j(y.target.value),maxLength:2e3,rows:4,placeholder:"Yardım almak istediğin konuyu yaz…",disabled:a||m||i||!s}),e.jsxs("div",{children:[e.jsxs("span",{"aria-live":"polite",children:[u.length,"/2000"]}),e.jsxs("button",{type:"submit",disabled:a||!u.trim()||m||i,children:[a?e.jsx(C,{className:"animate-spin","aria-hidden":!0}):e.jsx(ta,{"aria-hidden":!0}),a?"Gönderiliyor…":"Mesajı gönder"]})]})]})]})]})}function xr(){const{user:r,profile:s,refreshProfile:f}=L(),p=la(),[c,l]=h.useState(!1),n=na.useSearch(),[t,u]=h.useState(n.tab??"polls");h.useEffect(()=>u(n.tab??"polls"),[n.tab]);const j=async o=>{if(!(!r||c)){l(!0);try{const{data:a,error:x}=await P.from("profiles").update({avatar_url:o}).eq("id",r.id).select("id").single();if(x||!a)throw new Error("Avatar kaydedilemedi. Lütfen tekrar dene.");await f(),v.success("Avatar güncellendi")}catch(a){v.error(a instanceof Error?a.message:"Avatar kaydedilemedi.")}finally{l(!1)}}},m=async o=>{if(r){l(!0);try{const a=await ma(o,ua.avatar),x=`${r.id}/avatar-${Date.now()}.webp`,{error:i}=await P.storage.from("avatars").upload(x,a,{contentType:"image/webp",upsert:!1,cacheControl:"3600"});if(i)throw new Error(i.message);const{data:g}=P.storage.from("avatars").getPublicUrl(x),{error:d}=await P.from("profiles").update({avatar_url:g.publicUrl}).eq("id",r.id);if(d)throw new Error(d.message);v.success("Avatar güncellendi"),await f()}catch(a){v.error("Avatar yüklenemedi",{description:a instanceof Error?a.message:"Başka bir fotoğraf dene."})}finally{l(!1)}}};return e.jsxs("section",{className:"social-profile",children:[e.jsx("div",{className:"social-profile-cover",children:e.jsx("span",{children:"FİKRİN BURADA DEĞERLİ."})}),e.jsxs("div",{className:"social-profile-identity",children:[e.jsx("span",{className:"social-profile-avatar",children:s?.avatar_url?e.jsx("img",{src:s.avatar_url,alt:""}):(s?.display_name||"Üye").slice(0,2).toLocaleUpperCase("tr-TR")}),e.jsx("button",{type:"button",onClick:()=>u("profile"),className:"rounded-xl border border-border bg-card px-4 py-3 text-sm font-semibold",children:"Profili düzenle"})]}),e.jsxs("div",{className:"social-profile-info",children:[e.jsx("h1",{children:s?.display_name||"Profilim"}),e.jsx("p",{children:"Anketlerin, takip ettiklerin ve katkıların bir arada."}),r&&e.jsx(k,{to:"/profil/$id",params:{id:r.id},search:{},className:"mt-3 inline-flex min-h-11 items-center text-sm font-semibold text-primary",children:"Profilimi görüntüle →"}),e.jsxs(k,{to:"/takip",className:"mt-3 inline-flex min-h-11 items-center text-sm font-semibold text-primary",children:[p.length," kişi takip ediliyor"]})]}),e.jsxs(Na,{value:t,onValueChange:u,children:[e.jsxs(wa,{className:"social-profile-tabs",children:[e.jsx(M,{value:"polls",children:"Anketlerim"}),e.jsx(M,{value:"reposts",children:"Yeniden paylaşımlar"}),e.jsx(M,{value:"following",children:"Takip"}),e.jsx(M,{value:"profile",children:"Profil"}),e.jsx(M,{value:"activity",children:"Katkılarım"}),e.jsx(M,{value:"support",children:"Destek"})]}),e.jsxs(q,{value:"polls",children:[e.jsx(Ua,{}),e.jsx(k,{to:"/anket-taslaklarim",className:"mt-5 inline-flex min-h-11 items-center font-semibold text-primary",children:"Anket taslaklarımı aç →"})]}),e.jsx(q,{value:"reposts",children:r&&e.jsx(pa,{userId:r.id,mode:"reposts",name:s?.display_name||"Sen"})}),e.jsxs(q,{value:"following",children:[e.jsx(La,{}),e.jsx(da,{}),e.jsx(ka,{})]}),e.jsx(q,{value:"profile",children:e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-5",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"inline-flex h-16 w-16 items-center justify-center overflow-hidden rounded-full bg-primary text-lg font-medium text-primary-foreground",children:s?.avatar_url?e.jsx("img",{src:s.avatar_url,alt:s.display_name,className:"h-full w-full object-cover"}):(s?.display_name??"U").slice(0,2).toUpperCase()}),e.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-2 rounded-full border border-border bg-background px-4 py-2 text-sm hover:border-primary/40 hover:text-primary transition",children:[c?e.jsx(C,{className:"h-4 w-4 animate-spin"}):e.jsx(Aa,{className:"h-4 w-4"}),c?"Yükleniyor…":"Avatarı değiştir",e.jsx("input",{type:"file",disabled:c,accept:oa,className:"hidden",onChange:o=>{const a=o.target.files?.[0];o.currentTarget.value="",a&&m(a)}})]})]}),e.jsxs("div",{className:"mt-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-semibold",children:"Hazır avatarlar"}),e.jsx(ca,{value:s?.avatar_url??"",currentAvatar:s?.avatar_url,onChange:o=>{j(o)},disabled:c,id:"profile-avatar"})]}),e.jsx(Ha,{},r?.id),e.jsx(Ra,{})]})}),e.jsxs(q,{value:"activity",children:[e.jsx(Da,{}),e.jsx(Oa,{className:"mt-6"}),e.jsx($a,{className:"mt-6"})]}),e.jsx(q,{value:"support",children:e.jsx(Va,{reportUser:n.reportUser},n.reportUser??"support")})]})]})}export{xr as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.