1import{c as st,o as at,u as rt,a as nt,p as ot,r as m,s as n,j as e,T as ve,B as C,L as N,w as P,x as M,F as X,G as it,H as lt,J as dt}from"./index-MoAbC8_9.js";import{O as ct}from"./OwnersLayout-Cd0M3dw8.js";import{f as mt}from"./avatar-Bl5f64JA.js";import{B as ee}from"./badge-BHbYeRgi.js";import{S as te}from"./separator-CQ84aZ0V.js";import{F as ut}from"./ForumNewPostCard-B-1VK3ho.js";import{i as pt,t as se}from"./pollDates-DP2VfLei.js";import{B as ht}from"./breadcrumb-CmKLwRya.js";import{F as xt}from"./file-text-Bif0RP8Y.js";import{M as q,V as K}from"./collapsible-BIxz44zB.js";import{E as ft}from"./euro-Cc6O9qjZ.js";import{U as ae}from"./users-xui-UtA1.js";import{C as re}from"./chart-column-Bo5i9GGE.js";import{C as je}from"./Header-CnJGZ8vQ.js";import{C as Ne}from"./circle-check-7w5_oQMu.js";import{A as ye}from"./arrow-right-QNKB-9eH.js";import{H as gt}from"./history-GAI9mcQt.js";import{I as bt}from"./info-CZr0REZX.js";import"./skeleton-ClxqB572.js";import"./switch-BHj3-8MN.js";import"./index-D9-GACGG.js";import"./house-DjS1WMqx.js";import"./receipt-DnGXta2k.js";import"./building-crte1H4H.js";import"./user-Cvsz7Lm_.js";import"./upload-BH1HltYO.js";import"./piggy-bank-DP-A2O0m.js";import"./landmark-C0TkBs1l.js";import"./flame-wMx8KIS8.js";import"./trending-up-Cg9WFJWB.js";import"./eye-DKrvAixa.js";import"./dialog-DrI7Oddz.js";import"./tabs-5EVsfllK.js";import"./textarea-4z16PwID.js";import"./mountain-BHfTfCFy.js";import"./pen-line-3TShWx6o.js";import"./thumbs-up-jDPlFMTx.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const ke=st("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]),_t=20,ns=()=>{const{user:u}=at(),{t:y,language:s}=rt(),Ce=nt(),{isVisible:Y}=ot(),[Z,Pe]=m.useState([]),[Me,Se]=m.useState(new Set),[Ae,Ee]=m.useState(new Set),[ne,L]=m.useState([]),[I,Te]=m.useState(new Map),[oe,Ve]=m.useState(0),[ze,De]=m.useState(0),[$e,qe]=m.useState(0),[wt,Le]=m.useState(0),[R,ie]=m.useState(null),[le,de]=m.useState(null),[Ie,Re]=m.useState(0),[V,Be]=m.useState(0),[z,B]=m.useState(null),[Fe,J]=m.useState(!0),[Oe,ce]=m.useState(!1),[Ue,He]=m.useState(0);m.useEffect(()=>{if(!u){J(!1);return}let t=!0;return ce(!1),Ke().catch(d=>{console.error("Failed to load owners dashboard:",d),t&&ce(!0)}).finally(()=>{t&&J(!1)}),()=>{t=!1}},[Ue,u==null?void 0:u.id]);const Ke=async()=>{J(!0);const t=new Date;t.setMonth(t.getMonth()-1);const d=`${new Date().getFullYear()}-01-01T00:00:00.000Z`,[v,b,x,f,o,D,F,O,he,xe]=await Promise.all([n.from("polls").select("*").eq("is_active",!0).order("created_at",{ascending:!1}).limit(5),u?n.from("poll_votes_public").select("poll_id").eq("user_id",u.id):Promise.resolve({data:[]}),n.from("forum_threads").select("id, title, title_translated, language, created_at, updated_at, category_id, user_id, forum_categories(name)").eq("is_draft",!1).order("created_at",{ascending:!1}).limit(4),n.from("forum_posts").select("id",{count:"exact",head:!0}).gte("created_at",t.toISOString()),n.from("profiles_public").select("id",{count:"exact",head:!0}).eq("approval_status","approved"),n.from("forum_posts").select("id",{count:"exact",head:!0}),n.from("forum_post_reactions").select("id",{count:"exact",head:!0}).eq("emoji","ð"),n.from("apartments").select("id",{count:"exact",head:!0}).eq("excluded_from_voting",!1),n.from("polls").select("id, title, title_cs, title_en, description, description_cs, description_en, ends_at, is_active, created_at, results_visibility, voting_type").eq("is_active",!1).order("ends_at",{ascending:!1}).limit(1),n.from("polls").select("id",{count:"exact",head:!0}).gte("created_at",d)]),fe=[v.error,b.error,x.error,f.error,o.error,D.error,F.error,O.error,he.error,xe.error].filter(
6Boolean);if(fe.length>0)throw fe[0];const ge=new Date,k=(v.data||[]).filter(i=>i.starts_at&&i.starts_at<=ge.toISOString()&&!pt(i.ends_at,ge)),$=new Set;if((b.data||[]).forEach(i=>$.add(i.poll_id)),Se($),k.sort((i,g)=>{const h=$.has(i.id),p=$.has(g.id);if(h!==p)return h?1:-1;const l=i.ends_at?new Date(i.ends_at).getTime():1/0,_=g.ends_at?new Date(g.ends_at).getTime():1/0;return l-_}),Pe(k),k.length>0){const i=k.map(l=>l.id),{data:g}=await n.from("poll_votes_public").select("poll_id, apartment_code").in("poll_id",i),h=new Map;(g||[]).forEach(l=>{h.has(l.poll_id)||h.set(l.poll_id,new Set),h.get(l.poll_id).add(l.apartment_code)});const p=new Map;h.forEach((l,_)=>p.set(_,l.size)),Te(p)}if(u&&k.length>0){const[i,g,h]=await Promise.all([n.from("apartment_owners").select("apartment_id, apartments!inner(code)").eq("user_id",u.id).eq("is_current",!0),n.from("apartment_owners").select("apartment_id, apartments!inner(code), owner_contacts!inner(user_id)").eq("owner_contacts.user_id",u.id).eq("is_current",!0),n.from("apartment_owners").select("apartment_id, apartments!inner(code), owner_contacts!inner(owner_contact_persons!inner(user_id))").eq("owner_contacts.owner_contact_persons.user_id",u.id).eq("is_current",!0)]),p=new Set;[i.data,g.data,h.data].forEach(_=>{(_||[]).forEach(S=>p.add(S.apartments.code))});const l=Array.from(p);if(l.length>0){const _=k.map(j=>j.id),{data:S}=await n.from("poll_ballots").select("poll_id, apartment_code, user_id, representation_status").in("poll_id",_).in("apartment_code",l).neq("user_id",u.id).in("representation_status",["valid","not_applicable"]),A=new Set;(S||[]).forEach(j=>{$.has(j.poll_id)||A.add(j.poll_id)}),Ee(A)}}Ve(f.count||0),De(o.count||0),qe(D.count||0),Le(F.count||0),Be(O.count||0),Re(xe.count||0);const E=(he.data||[])[0];if(E){const{data:i}=await n.from("poll_votes_public").select("apartment_code").eq("poll_id",E.id),g=new Set((i||[]).map(p=>p.apartment_code)).size,h=O.count||1;if(ie(Math.round(g/h*100)),E.ends_at){const p=(se(E.ends_at)||new Date(E.ends_at)).getTime(),l=_t*864e5;Date.now()-p<=l&&p<=Date.now()?B(E):B(null)}else B(null)}else ie(null),B(null);if(k.length>0){const i=O.count||1,g=[];for(const h of k){const{data:p}=await n.from("poll_votes_public").select("apartment_code").eq("poll_id",h.id),l=new Set((p||[]).map(_=>_.apartment_code)).size;g.push(Math.round(l/i*100))}de(g)}else de(null);const U=x.data||[];if(U.length>0){const i=U.map(a=>a.id),[g,h,p,,l]=await Promise.all([n.from("forum_posts").select("thread_id").in("thread_id",i),n.from("forum_thread_views").select("thread_id, user_id, view_count").in("thread_id",i),n.from("forum_post_reactions").select("post_id, user_id, forum_posts!inner(thread_id)").in("forum_posts.thread_id",i),Promise.resolve(null),n.from("forum_posts").select("id, thread_id, content").in("thread_id",i).order("created_at",{ascending:!0})]),_=new Map;(g.data||[]).forEach(a=>_.set(a.thread_id,(_.get(a.thread_id)||0)+1));const S=new Map,A=new Map;(h.data||[]).forEach(a=>{S.set(a.thread_id,(S.get(a.thread_id)||0)+(a.view_count||1)),a.user_id&&(A.has(a.thread_id)||A.set(a.thread_id,new Set),A.get(a.thread_id).add(a.user_id))});const j=new Map;(l.data||[]).forEach(a=>{j.has(a.thread_id)||j.set(a.thread_id,a.id)});const Ge=new Set(j.values()),W=new Map,T=new Map;(p.data||[]).forEach(a=>{var w;const c=(w=a.forum_posts)==null?void 0:w.thread_id;c&&Ge.has(a.post_id)&&(W.set(c,(W.get(c)||0)+1),T.has(c)||T.set(c,new Set),T.get(c).add(a.user_id))});const Q=new Set(U.map(a=>a.user_id));T.forEach(a=>a.forEach(c=>Q.add(c)));const{data:Xe}=await n.from("profiles_public").select("user_id, first_name, last_name, full_name").in("user_id",Array.from(Q)),et=await mt(Array.from(Q)),be=new Map,_e=new Map;(Xe||[]).forEach(a=>{const c=[a.first_name,a.last_name].filter(Boolean).join(" ")||a.full_name||"";if(c){be.set(a.user_id,c);const w=et.get(a.user_id),H=w!=null&&w.length?w.join(", ")+" â ":"";_e.set(a.user_id,H+c)}});const G=new Map,we=new Map;(l.data||[]).forEach(a=>{var c;if(!G.has(a.thread_id)){G.set(a.thread_id,a.content);const w=(c=a.content)==null?void 0:c.match(/<img[^>]+src=["']([^"']+)["']/);we.set(a.thread_id,w?w[1]:null)}}),L(U.map(a=>{var c,w,H;return{...a,category_name:(c=a.forum_categories)==null?void 0:c.name,post_count:Math.max(0,(_.get(a.id)||0)-1),view_count:S.get(a.id)||0,unique_viewer_count:((w=A.get(a.id))==null?void 0:w.size)||0,like_count:W.get(a.id)||0,like_users:Array.from(T.get(a.id)||[]).map(tt=>_e.get(tt)||"Anonymous"),user_liked:u&&((H=T.get(a.id))==null?void 0:H.has(u.id))||!1,author_name:be.get(a.user_id
6),first_post_content:G.get(a.id)||"",first_post_id:j.get(a.id),image_url:we.get(a.id)||null}}))}else L([])},Ye=async t=>{if(!u)return;const d=t.first_post_id;if(!d)return;const{data:v}=await n.from("profiles").select("full_name").eq("user_id",u.id).maybeSingle(),b=(v==null?void 0:v.full_name)||"Anonymous",{data:x}=await n.from("forum_post_reactions").select("id").eq("post_id",d).eq("user_id",u.id).eq("emoji","ð").maybeSingle();x?(await n.from("forum_post_reactions").delete().eq("id",x.id),L(f=>f.map(o=>o.id===t.id?{...o,like_count:Math.max(0,(o.like_count||1)-1),user_liked:!1,like_users:(o.like_users||[]).filter(D=>D!==b)}:o))):(await n.from("forum_post_reactions").insert({post_id:d,user_id:u.id,emoji:"ð"}),L(f=>f.map(o=>o.id===t.id?{...o,like_count:(o.like_count||0)+1,user_liked:!0,like_users:[...o.like_users||[],b]}:o)))},me=t=>s==="cs"&&t.title_cs?t.title_cs:s==="en"&&t.title_en?t.title_en:t.title,Ze=t=>s==="cs"&&t.description_cs?t.description_cs:s==="en"&&t.description_en?t.description_en:t.description||"",Je=t=>{const d=document.createElement("div");return d.innerHTML=t,d.textContent||d.innerText||""},We=t=>{const d=new Date,b=(se(t)||new Date(t)).getTime()-d.getTime();if(b<=0)return s==="cs"?"UkonÄeno":s==="de"?"Beendet":"Ended";const x=Math.floor(b/(1e3*60*60*24)),f=Math.floor(b%(1e3*60*60*24)/(1e3*60*60)),o=Math.floor(b%(1e3*60*60)/(1e3*60));return s==="cs"?x>0?`zbývá ${x}d ${f}h ${o}min`:`zbývá ${f}h ${o}min`:s==="de"?x>0?`noch ${x}T ${f}Std ${o}Min`:`noch ${f}Std ${o}Min`:x>0?`${x}d ${f}h ${o}min left`:`${f}h ${o}min left`},ue=t=>new Date(t).toLocaleDateString(s==="de"?"de-DE":s==="cs"?"cs-CZ":"en-US",{year:"numeric",month:"long",day:"numeric"}),pe=[{title:y("sidebar.news"),icon:ht,href:"/owners/news",color:"bg-blue-500/10 text-blue-600",badge:null,sectionKey:"news"},{title:y("sidebar.documents"),icon:xt,href:"/owners/documents",color:"bg-green-500/10 text-green-600",badge:null,sectionKey:"documents"},{title:y("sidebar.forum"),icon:q,href:"/owners/forum",color:"bg-orange-500/10 text-orange-600",badge:oe>0?oe:null,sectionKey:"forum"},{title:y("sidebar.costs"),icon:ft,href:"/owners/costs",color:"bg-emerald-500/10 text-emerald-600",badge:null,sectionKey:"costs_dashboard"}].filter(t=>Y(t.sectionKey)),r={activePolls:s==="cs"?"Aktivnà hlasovánÃ":s==="de"?"Aktive Abstimmungen":"Active Polls",quickLinks:s==="cs"?"Rychlé odkazy":s==="de"?"Schnellzugriff":"Quick Links",votingEnds:s==="cs"?"Hlasovánà konÄÃ":s==="de"?"Abstimmung endet":"Voting ends",noActivePolls:s==="cs"?"Žádná aktivnà hlasovánÃ":s==="de"?"Keine aktiven Abstimmungen":"No active polls",voteNow:s==="cs"?"OtevÅÃt hlasovánÃ":s==="de"?"Abstimmung öffnen":"Open voting",goToVoting:s==="cs"?"PÅejÃt k hlasovánÃ":s==="de"?"Zur Abstimmung":"Go to voting",votingInProgress:s==="cs"?"Hlasovánà probÃhá":s==="de"?"Abstimmung läuft":"Voting in progress",voted:s==="cs"?"Hlasováno":s==="de"?"Abgestimmt":"Voted",notVotedBanner:s==="cs"?"JeÅ¡tÄ jste nehlasoval/a. VaÅ¡e úÄast je důležitá pro spoleÄné rozhodnutÃ.":s==="de"?"Sie haben noch nicht abgestimmt. Ihre Teilnahme ist wichtig für gemeinsame Entscheidungen.":"You haven't voted yet. Your participation matters for collective decisions.",participationUnits:s==="cs"?"jednotek":s==="de"?"Einheiten":"units",participationVoted:s==="cs"?"Hlasovalo":s==="de"?"abgestimmt":"voted",recentForum:s==="cs"?"Poslednà pÅÃspÄvky z fóra":s==="de"?"Neueste Forenbeiträge":"Recent Forum Posts",noForumPosts:s==="cs"?"ZatÃm žádné pÅÃspÄvky":s==="de"?"Noch keine Beiträge":"No posts yet",comments:s==="cs"?"komentáÅů":s==="de"?"Kommentare":"comments",coOwnerVotedBanner:s==="cs"?"Za vaÅ¡i jednotku již hlasoval spoluvlastnÃk.":s==="de"?"Für Ihre Einheit hat bereits ein Miteigentümer abgestimmt.":"A co-owner has already voted for your unit.",coOwnerVoted:s==="cs"?"Hlasováno spoluvlastnÃkem":s==="de"?"Vom Miteigentümer abgestimmt":"Voted by co-owner",engagementTitle:s==="cs"?"Na vaÅ¡em názoru záležÃ":s==="de"?"Ihre Meinung zählt":"Your opinion matters",engagementText:s==="cs"?"Bez zapojenà vlastnÃků se vÄci neposunou. Diskuse ve fóru pomáhá hledat spoleÄné ÅeÅ¡enà i dalšà kroky. Každý názor může pomoci lépe pochopit situaci a posunout ji dál.":s==="de"?"Ohne Beteiligung der Eigentümer bewegt sich nichts. Die Diskussion im Forum hilft, gemeinsame Lösungen und nächste Schritte zu finden. Jede Meinung kann helfen, die Situation besser zu verstehe
6n und voranzubringen.":"Without owner participation, things don't move forward. Forum discussions help find shared solutions and next steps. Every opinion can help better understand the situation and move it forward.",engagementCta:s==="cs"?"Zapojit se do diskuse":s==="de"?"An der Diskussion teilnehmen":"Join the discussion",recentlyClosed:s==="cs"?"Nedávno ukonÄené hlasovánÃ":s==="de"?"Kürzlich beendete Abstimmung":"Recently closed poll",endedOn:s==="cs"?"UkonÄeno":s==="de"?"Beendet am":"Ended on",ended:s==="cs"?"UkonÄeno":s==="de"?"Beendet":"Ended",viewDetails:s==="cs"?"VÃce detailů":s==="de"?"Mehr Details":"More details",historicalPolls:s==="cs"?"Historická hlasovánÃ":s==="de"?"Frühere Abstimmungen":"Historical polls",participationLabel:s==="cs"?"ÃÄast":s==="de"?"Beteiligung":"Participation",resultsInDetail:s==="cs"?"Výsledky k dispozici v detailu":s==="de"?"Ergebnisse im Detail verfügbar":"Results available in details"},Qe=()=>e.jsx(P,{className:"border-l-4 border-l-amber-400",children:e.jsx(M,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 rounded-full bg-amber-100 dark:bg-amber-900/30 shrink-0",children:e.jsx(ke,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:r.engagementTitle}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:r.engagementText}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,className:"mt-1",children:e.jsxs(N,{to:"/owners/forum",className:"gap-1.5",children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r.engagementCta]})})]})]})})});return e.jsx(ct,{title:y("dashboard.welcome"),description:y("dashboard.description"),headerContent:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ae,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-foreground",children:ze}),s==="cs"?"Älenů":s==="de"?"Mitglieder":"members"]}),e.jsx(te,{orientation:"vertical",className:"h-4 hidden sm:block"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(q,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-foreground",children:$e}),s==="cs"?"pÅÃspÄvky":s==="de"?"Beiträge":"posts"]}),e.jsx(te,{orientation:"vertical",className:"h-4 hidden sm:block"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(K,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-medium text-foreground",children:Ie}),s==="cs"?"hlasovánà za rok":s==="de"?"Abstimmungen dieses Jahr":"polls this year"]}),R!==null&&!(Z.length>0&&le!==null&&le.length>0)?e.jsxs(e.Fragment,{children:[e.jsx(te,{orientation:"vertical",className:"h-4 hidden sm:block"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(re,{className:"h-4 w-4 text-primary"}),e.jsxs("span",{className:"font-medium text-foreground",children:[R," %"]}),s==="cs"?"úÄast v poslednÃm hlasovánÃ":s==="de"?"Beteiligung letzte Abstimmung":"last poll turnout"]})]}):null]}),isLoading:Fe,children:Oe?e.jsxs("div",{className:"min-h-[40vh] flex flex-col items-center justify-center gap-4 text-center",children:[e.jsx(ve,{className:"h-10 w-10 text-destructive"}),e.jsx("p",{className:"max-w-md text-sm text-muted-foreground",children:s==="cs"?"Data se nepodaÅilo naÄÃst. Zkontrolujte pÅipojenà a zkuste to znovu.":s==="de"?"Die Daten konnten nicht geladen werden. Prüfen Sie die Verbindung und versuchen Sie es erneut.":"The data could not be loaded. Check your connection and try again."}),e.jsx(C,{variant:"outline",onClick:()=>He(t=>t+1),children:s==="cs"?"NaÄÃst znovu":s==="de"?"Erneut laden":"Try again"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"lg:hidden mb-6",children:[e.jsx("h2",{className:"text-lg font-semibold mb-3",children:r.quickLinks}),e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1 -mx-1 px-1 scrollbar-hide",children:pe.map(t=>e.jsx(N,{to:t.href,className:"flex-shrink-0",children:e.jsx(P,{className:"hover:shadow-md transition-shadow cursor-pointer w-[100px]",children:e.jsxs(M,{className:"p-3 flex flex-col items-center text-center gap-1.5",children:[e.jsxs("div",{className:`p-2 rounded-full ${t.color} relative`,children:[e.jsx(t.icon,{className:"h-4 w-4"}),t.badge&&e.jsx("span",{className:"absolute -top-1 -right-1 bg-orange-500 text-white text-[9px] font-bold rounded-full h-4 min-w-4 px-1 flex items-center justify-center",children:t.badge})]}),e.jsx("span",{className:"text-xs font-medium leading-tight",children:t.title})]})})},t.href))})]}),Y("forum")&&e.jsx("div",{className:"lg:hidden mb-6",children:e.jsx(Qe,{})}),e.jsxs("div",{className:"grid lg:grid-cols-[1fr,440px] xl:grid-cols-[1fr,500px] gap-6 lg:gap-8",children:[e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(K,{className:"h-4 w-4 md:h-5 md:w-5 text-primary"}),r.activePolls]}),e.jsx(C,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs(N,{to:"/owners/polls",className:"flex items-center gap-1 text-xs md:text-sm",children:[y("dashboard.viewAll"),e.jsx(je,{className:"h-3.5 w-3.5 md:h-4 md:w-4"})]})})]}),Z.length===0?z?e.jsx(P,{className:"border-l-4 border-l-emerald-500/60 bg-muted/30",children:e.jsxs(M,{className:"p-4 md:p-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[e.jsxs(ee,{variant:"secondary",className:"gap-1 text-[10px]",children:[e.jsx(Ne,{className:"h-3 w-3"}),r.ended]}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:r.recentlyClosed})]}),e.jsx("h4",{className:"font-semibold text-sm text-foreground mb-1.5 line-clamp-2",children:me(z)}),z.ends_at&&e.jsxs("p",{className:"text-xs text-muted-foreground mb-2 flex items-center gap-1.5",children:[e.jsx(X,{className:"h-3 w-3"}),r.endedOn,": ",ue(z.ends_at)]}),R!==null&&e.jsxs("p",{className:"text-xs text-muted-foreground mb-3 flex items-center gap-1.5",children:[e.jsx(re,{className:"h-3 w-3 text-primary"}),r.participationLabel,": ",e.jsxs("span",{className:"font-medium text-foreground",children:[R," %"]})]}),z.results_visibility!=="always"&&e.jsx("p",{className:"text-[11px] italic text-muted-foreground mb-3",children:r.resultsInDetail}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(N,{to:"/owners/polls#archive",className:"gap-1.5",children:[e.jsx(ye,{className:"h-3.5 w-3.5"}),r.viewDetails]})})]})}):e.jsx(P,{children:e.jsxs(M,{className:"p-4 md:p-6 text-center",children:[e.jsx(K,{className:"h-8 w-8 text-muted-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-muted-foreground text-sm mb-3",children:r.noActivePolls}),e.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(N,{to:"/owners/polls#archive",className:"gap-1.5",children:[e.jsx(gt,{className:"h-3.5 w-3.5"}),r.historicalPolls]})})]})}):e.jsx("div",{className:"space-y-3",children:Z.map(t=>{const d=Me.has(t.id),v=Ae.has(t.id),b=Je(Ze(t)),x=d?"border-primary/40 hover:border-primary/60 hover:shadow-lg":v?"border-blue-300/70 bg-blue-50/30 dark:bg-blue-950/10 shadow-md hover:shadow-lg hover:border-blue-400/80":"border-amber-400/70 bg-amber-50/30 dark:bg-amber-950/10 shadow-md hover:shadow-lg hover:border-amber-500/80";return e.jsx(N,{to:"/owners/polls",className:"block",children:e.jsx(P,{className:`group h-full overflow-hidden cursor-pointer transition-all duration-300 ${x}`,children:e.jsxs(M,{className:"flex min-w-0 flex-col overflow-hidden p-3 sm:p-4",children:[e.jsxs("div",{className:"mb-1.5 sm:mb-2 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[e.jsxs("span",{className:"relative flex h-2 w-2 shrink-0",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),t.ends_at&&(()=>{const o=(se(t.ends_at)||new Date(t.ends_at)).getTime()-Date.now(),F=o>0&&o<=24*60*60*1e3?"bg-amber-100 text-amber-900 border-amber-400/70 dark:bg-amber-900/40 dark:text-amber-100 dar
6k:border-amber-600/60 animate-pulse":"bg-primary/10 text-primary border-primary/30 dark:bg-primary/20";return e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] sm:text-xs font-semibold tabular-nums whitespace-nowrap shadow-sm ${F}`,children:[e.jsx(X,{className:"h-3 w-3 sm:h-3.5 sm:w-3.5"}),We(t.ends_at)]})})()]}),d?e.jsxs(ee,{variant:"secondary",className:"shrink-0 gap-1 text-[10px] bg-primary/10 text-primary border-primary/20",children:[e.jsx(Ne,{className:"h-2.5 w-2.5"}),r.voted]}):v?e.jsxs(ee,{variant:"secondary",className:"shrink-0 gap-1 text-[10px] bg-blue-100 text-blue-800 border-blue-200 dark:bg-blue-900/40 dark:text-blue-200 dark:border-blue-700",children:[e.jsx(ae,{className:"h-2.5 w-2.5"}),r.coOwnerVoted]}):e.jsxs("span",{className:"shrink-0 flex items-center gap-1 text-[10px] text-amber-700 dark:text-amber-300 font-medium",children:[e.jsx(K,{className:"h-2.5 w-2.5"}),r.votingInProgress]})]}),!d&&v&&e.jsx("div",{className:"mb-2 sm:mb-3",children:e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-blue-300/50 bg-blue-100/80 dark:bg-blue-900/20 p-2 sm:p-2.5",children:[e.jsx(bt,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 shrink-0 text-blue-600 dark:text-blue-400 mt-0.5"}),e.jsx("span",{className:"text-[11px] sm:text-xs font-medium text-blue-800 dark:text-blue-200",children:r.coOwnerVotedBanner})]})}),!d&&!v&&e.jsxs("div",{className:"mb-2 sm:mb-3 flex flex-col sm:flex-row sm:items-stretch gap-2 sm:gap-3",children:[e.jsxs("div",{className:"flex-1 flex items-start gap-2 rounded-md border border-amber-300/50 bg-amber-100/80 dark:bg-amber-900/20 p-2 sm:p-2.5",children:[e.jsx(ve,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4 shrink-0 text-amber-600 dark:text-amber-400 mt-0.5"}),e.jsx("span",{className:"text-[11px] sm:text-xs font-medium text-amber-800 dark:text-amber-200",children:r.notVotedBanner})]}),e.jsxs(C,{size:"sm",className:"shrink-0 gap-1.5 sm:self-center bg-primary text-primary-foreground hover:bg-background hover:text-foreground hover:border-primary border border-transparent hover:shadow-md active:scale-[0.97] transition-all font-semibold shadow-sm px-3 sm:px-4 h-auto py-1.5 sm:py-2 text-xs sm:text-sm w-full sm:w-auto",children:[e.jsx(ye,{className:"h-3 w-3 sm:h-3.5 sm:w-3.5"}),r.goToVoting]})]}),e.jsx("h4",{className:"mb-1 sm:mb-1.5 break-words font-semibold text-[13px] sm:text-sm text-foreground leading-snug line-clamp-2 group-hover:text-primary transition-colors",children:me(t)}),b&&e.jsx("p",{className:"flex-1 break-words text-[11px] sm:text-xs text-muted-foreground line-clamp-2 sm:line-clamp-3 mb-2 sm:mb-3",children:b}),e.jsxs("div",{className:"mt-auto flex flex-col sm:flex-row sm:items-center sm:justify-between gap-1.5 sm:gap-0 border-t border-border/50 pt-2 sm:pt-2.5 text-[11px] sm:text-xs font-medium text-foreground",children:[t.ends_at&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(X,{className:"h-3 w-3 sm:h-3.5 sm:w-3.5 text-primary"}),r.votingEnds,": ",ue(t.ends_at)]}),e.jsxs("span",{className:"flex items-center gap-2.5 sm:gap-3.5 text-foreground",children:[e.jsxs(it,{children:[e.jsx(lt,{asChild:!0,children:e.jsxs("span",{className:"flex items-center gap-1 text-foreground font-medium cursor-default",children:[e.jsx(re,{className:"h-3 w-3 sm:h-3.5 sm:w-3.5 text-primary"}),V>0?Math.round((I.get(t.id)||0)/V*100):0," %"]})}),e.jsx(dt,{children:s==="cs"?"ÃÄast v aktuálnÄ probÃhajÃcÃm hlasovánÃ":s==="de"?"Beteiligung an der laufenden Abstimmung":"Current poll participation"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ae,{className:"h-3 w-3 sm:h-3.5 sm:w-3.5 text-primary"}),s==="de"?`${I.get(t.id)||0} von ${V} ${r.participationUnits} ${r.participationVoted}`:s==="en"?`${I.get(t.id)||0} of ${V} ${r.participationUnits} ${r.participationVoted}`:`${r.participationVoted} ${I.get(t.id)||0} z ${V} ${r.participationUnits}`]})]})]})]})})},t.id)})})]}),Y("forum")?e.jsx("div",{className:"hidden lg:flex",style:{marginTop:"calc(1.75rem + 0.75rem)"},children:e.jsx(P,{className:"border-l-4 border-l-amber-400 w-full flex flex-col",children:e.jsxs(M,{className:"p-5 flex flex-col flex-1",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"p-2 rounded-full bg-amber-100 dar
6k:bg-amber-900/30 shrink-0",children:e.jsx(ke,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"})}),e.jsx("h3",{className:"text-sm font-semibold pt-1.5",children:r.engagementTitle})]}),e.jsx("p",{className:"text-[13px] text-muted-foreground leading-relaxed mt-4 ml-[2.75rem]",children:r.engagementText}),e.jsx("div",{className:"mt-auto pt-4 ml-[2.75rem]",children:e.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(N,{to:"/owners/forum",className:"gap-1.5",children:[e.jsx(q,{className:"h-3.5 w-3.5"}),r.engagementCta]})})})]})})}):e.jsx("div",{className:"hidden lg:block"}),e.jsxs("section",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(q,{className:"h-4 w-4 md:h-5 md:w-5 text-orange-500"}),r.recentForum]}),e.jsx(C,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs(N,{to:"/owners/forum",className:"flex items-center gap-1 text-xs md:text-sm",children:[y("dashboard.viewAll"),e.jsx(je,{className:"h-3.5 w-3.5 md:h-4 md:w-4"})]})})]}),ne.length===0?e.jsx(P,{children:e.jsx(M,{className:"p-4 md:p-6 text-center text-muted-foreground text-sm",children:r.noForumPosts})}):e.jsx("div",{className:"space-y-3 sm:grid sm:grid-cols-2 sm:gap-3 sm:space-y-0 md:grid-cols-1 md:space-y-3 md:gap-0 md:block lg:grid lg:grid-cols-2 lg:gap-3 lg:space-y-0",children:ne.map(t=>e.jsx(ut,{title:t.title,authorName:t.author_name||"Anonymous",createdAt:t.created_at,categoryName:t.category_name||"",previewText:t.first_post_content||"",replyCount:t.post_count,viewCount:t.view_count,uniqueViewerCount:t.unique_viewer_count,likeCount:t.like_count,likeUsers:t.like_users,userLiked:t.user_liked,onLike:()=>Ye(t),onClick:()=>Ce(`/owners/forum?thread=${t.id}`),imageUrl:t.image_url},t.id))})]}),e.jsxs("section",{className:"hidden lg:block",children:[e.jsx("h2",{className:"text-lg font-semibold mb-3",children:r.quickLinks}),e.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:pe.map(t=>e.jsx(N,{to:t.href,children:e.jsx(P,{className:"hover:shadow-md transition-shadow cursor-pointer h-full relative",children:e.jsxs(M,{className:"p-3 md:p-4 flex flex-col items-center text-center gap-1.5",children:[e.jsxs("div",{className:`p-2.5 rounded-full ${t.color} relative`,children:[e.jsx(t.icon,{className:"h-4 w-4 md:h-5 md:w-5"}),t.badge&&e.jsx("span",{className:"absolute -top-1 -right-1 bg-orange-500 text-white text-[9px] font-bold rounded-full h-4 min-w-4 px-1 flex items-center justify-center",children:t.badge})]}),e.jsx("span",{className:"text-xs md:text-sm font-medium",children:t.title}),t.badge&&e.jsx("span",{className:"text-[10px] text-muted-foreground",children:s==="cs"?`${t.badge} nových za mÄsÃc`:s==="de"?`${t.badge} neue im Monat`:`${t.badge} new this month`})]})})},t.href))})]})]})]})})};export{ns as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.