PageSourceSearch

https://liptov.travel/assets/AppHome-o5xRfFM7.js

js liptov.travel collected 2026-10-02 22:46:12 UTC 116,833 bytes, 44 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AttractionDialog-Bro8XtFm.js","assets/vendor-query-DubqxpgA.js","assets/vendor-react-JyalZ63h.js","assets/dialog-AqgD2a4p.js","assets/index-Du8RN4k6.js","assets/index-Cq5x7r2d.js","assets/vendor-helmet-iYQtFkxu.js","assets/vendor-supabase-Clqdqihj.js","assets/vendor-i18n-B0NrB2NZ.js","assets/index-CWtIgmcG.css","assets/index-CLb5DIrg.js","assets/index-Bl4tXC2P.js","assets/leaflet-DdkpF48y.js","assets/leaflet-Dgihpmma.css"])))=>i.map(i=>d[i]);
2import{c as be,u as U,s as z,B as Ne,b as Be,X as ke,U as Me,G as Bt,_ as jt}from"./index-Cq5x7r2d.js";import{j as e,u as X,b as Ce,c as Ue}from"./vendor-query-DubqxpgA.js";import{r as m,L as R,e as vt,i as Ut}from"./vendor-react-JyalZ63h.js";import{H as Vt}from"./vendor-helmet-iYQtFkxu.js";import{u as Ht,a as Nt,L as Ve,b as Zt,c as He,d as Wt,g as Gt,e as Qt}from"./useLoyalty-DOjWVrB0.js";import{Q as kt}from"./index-CRx4rsgq.js";import{T as at}from"./ticket-DtEf0I34.js";import{C as Ze}from"./copy-BsZLcJZI.js";import{C as We}from"./clock-DACaLg6c.js";import{C as Oe}from"./circle-check-big-C66antMo.js";import{C as rt}from"./circle-x-CXK0Admy.js";import{f as lt}from"./format-Cl33CJ6B.js";import{b as we}from"./sk-DVj0AVo5.js";import{C as W,b as J,c as ee,a as G}from"./card-CajWOyxu.js";import{D as Xt,a as Yt,b as Jt,c as es,f as ts}from"./dialog-AqgD2a4p.js";import{publishedPosts as wt}from"./Blog-BfqjNgs5.js";import{u as ge}from"./use-toast-DlZbtx9q.js";import{categoryColor as qe,CATEGORY_COLORS as Te}from"./AttractionDialog-Bro8XtFm.js";import{S as he}from"./star-EHSbUeJV.js";import{C as Ge}from"./camera-CE7Q8-oP.js";import{L as I}from"./loader-circle-Cl8dtRGn.js";import{L as Ee}from"./leaflet-DdkpF48y.js";import{M as ce}
2from"./map-pin-BSLD79Io.js";import{T as nt}from"./trophy-BAr33afI.js";import{S as Q}from"./sparkles-D4MSolDX.js";import{P as ss}from"./pencil--cYwUk4z.js";import{L as Ae}from"./lock-Briucmha.js";import{P as as}from"./plus-COr61JZG.js";import{u as _t}from"./vendor-i18n-B0NrB2NZ.js";import{M as Le}from"./mail-BP0VodCP.js";import{T as Ct}from"./trash-2-BtQi7Hcx.js";import{P as rs}from"./phone-CIoGEmGF.js";import{C as ls}from"./cake-DjA2OrXH.js";import{E as Fe}from"./eye-D1XcuUcZ.js";import{C as St}from"./check-BgoH1f79.js";import{E as De}from"./eye-off-D2EfLa0C.js";import{S as ot}from"./shield-check-CxFUwy9X.js";import{S as it}from"./shield-BKIVZWFQ.js";import{L as Pt,N as ns}from"./newspaper-B_1BWnw_.js";import{C as de}from"./chevron-right-DnmMq322.js";import{Q as os}from"./qr-code-BkvobK7Q.js";import{C as Qe}from"./calendar-u2lQywef.js";import{u as is}from"./useTranslatedContent-Bp6t7EwA.js";import{B as Ie}from"./badge-C6dCwypT.js";import{S as ue}from"./skeleton-MbScql4h.js";import{G as fe}from"./gift-CtOUVsrp.js";import{P as cs}from"./percent-BSjbGrtD.js";import{f as Xe}from"./formatDistanceToNow-BTHaaAio.js";import{I as ds}from"./info-D56PQON_.js";import{C as ms}from"./circle-alert-C_hldP7B.js";import{S as us}from"./switch-DHGzt30_.js";import{L as xs}from"./label-NhDGlPDt.js";import{a as ps}from"./usePushNotifications-9lNjaaoF.js";import{u as je}from"./index-P2WMUoGb.js";import{B as ct}from"./bell-off-BXsssZnR.js";import{U as zt}from"./users-sFkzdXYV.js";import{u as hs,c as bs,g as gs}from"./wbgt-Cd-HI0OM.js";import{M as fs}from"./mountain-Co0RQ46t.js";import{C as ys}from"./coffee-CBVfyD9-.js";import{W as js}from"./waves-AJhL3zTd.js";import{F as vs}from"./flame-C0vU6RNy.js";import{S as $t}from"./search-BIOzBk52.js";import{S as Ns}from"./share-2-Cl90_irm.js";import{H as Et}from"./house-VQmYmxnM.js";import{C as Lt}from"./compass-D6090IA5.js";import{B as Rt}from"./bookmark-DMXuPPrj.js";import{T as ks}from"./tag-D3I3BCPl.js";import"./vendor-supabase-Clqdqihj.js";import"./index-Du8RN4k6.js";import"./index-CLb5DIrg.js";import"./index-Bl4tXC2P.js";import"./Footer-DBpocLWX.js";import"./heart-CJNbqb3j.js";import"./image-DEUaWW-u.js";import"./PageBreadcrumb-BS3HU8uJ.js";import"./blogLangs-BT6K0gCv.js";import"./arrow-right-COwiAi-v.js";import"./endOfMonth-BbsXCmCm.js";import"./index-DPZU4SyD.js";/**
3 * @license lucide-react v0.462.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const ws=be("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
8 * @license lucide-react v0.462.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const Ke=be("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/**
13 * @license lucide-react v0.462.0 - ISC
14 *
15 * This source code is licensed under the ISC license.
16 * See the LICENSE file in the root directory of this source tree.
17 */const _s=be("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/**
18 * @license lucide-react v0.462.0 - ISC
19 *
20 * This source code is licensed under the ISC license.
21 * See the LICENSE file in the root directory of this source tree.
22 */const Cs=be("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/**
23 * @license lucide-react v0.462.0 - ISC
24 *
25 * This source code is licensed under the ISC license.
26 * See the LICENSE file in the root directory of this source tree.
27 */const At=be("MapPinPlus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]);/**
28 * @license lucide-react v0.462.0 - ISC
29 *
30 * This source code is licensed under the ISC license.
31 * See the LICENSE file in the root directory of this source tree.
32 */const Ss=be("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"}]]),P={bg:"#0E1A14",surface:"#16241C",emerald:"#1F6F4A",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.2)"},dt={pending:{label:"Aktívny",icon:We,tone:P.accent},confirmed:{label:"Potvrdený",icon:Oe,tone:P.accent},used:{label:"Uplatnený",icon:Oe,tone:P.muted},cancelled:{label:"Zrušený",icon:rt,tone:"#ef4444"},expired:{label:"Expirovaný",icon:rt,tone:"#f59e0b"}};function Ps({redemption:t,rewardName:a}){const[s,n]=m.useState(!1),r=dt[t.status]||dt.pending,o=r.icon,i=t.status==="pending"||t.status==="confirmed",u=async()=>{t.redemption_code&&(await navigator.clipboard.writeText(t.redemption_code),n(!0),setTimeout(()=>n(!1),2e3))};return e.jsx("article",{className:`rounded-2xl border overflow-hidden ${i?"":"opacity-60"}`,style:{background:P.surface,borderColor:P.border},children:e.jsxs("div",{className:"p-4",children:[e.jsxs("div",{className:"flex gap-4 items-start",children:[i&&t.redemption_code&&e.jsx("div",{className:"shrink-0 p-2 rounded-lg",style:{background:P.text},children:e.jsx(kt,{value:t.redemption_code,size:96,level:"M",includeMargin:!1,bgColor:P.text,fgColor:P.bg})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"font-bold text-sm leading-tight",style:{color:P.text},children:a||"Odmena"}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider px-2 py-1 rounded-full shrink-0",style:{background:`${r.tone}1f`,color:r.tone,border:`1px solid ${r.tone}40`},children:[e.jsx(o,{className:"w-3 h-3"}),r.label]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"text-xs font-mono px-2 py-0.5 rounded",style:{background:P.bg,color:P.accent,border:`1px solid ${P.border}`},children:t.redemption_code}),i&&e.jsx("button",{onClick:u,"aria-label":"Skopírovať kód",className:"h-6 w-6 inline-flex items-center justify-center rounded transition-colors",style:{color:s?P.accent:P.muted},children:s?e.jsx(ws,{className:"w-3 h-3"}):e.jsx(Ze,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs",style:{color:P.muted},children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-mono font-bold",style:{color:P.accent},children:t.points_spent})," ","bodov"]}),t.valid_until&&e.jsxs("span",{children:["Platí do: ",lt(new Date(t.valid_until),"d. MMM yyyy",{locale:we})]})]}),t.used_at&&e.jsxs("p",{className:"text-xs",style:{color:P.muted},children:["Uplatnené: ",lt(new Date(t.used_at),"d. MMM yyyy HH:mm",{locale:we})]})]})]}),i&&e.jsx("p",{className:"text-xs mt-3 text-center pt-3",style:{color:P.muted,borderTop:`1px solid ${P.border}`},children:"Ukážte tento QR kód obsluhe pri uplatnení odmeny"})]})})}function zs({rewards:t}){const{data:a=[],isLoading:s}=Ht(),n=i=>{var u;return i&&((u=t.find(h=>h.id===i))==null?void 0:u.name)||"Odmena"},r=[...a].sort((i,u)=>{const h=["pending","confirmed"],x=h.includes(i.status),g=h.includes(u.status);
32return x&&!g?-1:!x&&g?1:new Date(u.created_at).getTime()-new Date(i.created_at).getTime()});if(s)return e.jsx("div",{className:"space-y-3",children:[1,2].map(i=>e.jsx("div",{className:"rounded-2xl h-32 animate-pulse border",style:{background:P.surface,borderColor:P.border}},i))});if(r.length===0)return e.jsxs("div",{className:"rounded-2xl border text-center py-12 px-6",style:{background:P.surface,borderColor:P.border},children:[e.jsx(at,{className:"w-12 h-12 mx-auto mb-3",strokeWidth:1.5,style:{color:P.muted}}),e.jsx("p",{style:{color:P.text},children:"Zatiaľ nemáte žiadne kupóny"}),e.jsx("p",{className:"text-sm mt-1",style:{color:P.muted},children:'Uplatnite odmenu v sekcii „Odmeny" a získajte kupón s QR kódom'})]});const o=r.filter(i=>i.status==="pending"||i.status==="confirmed").length;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",style:{color:P.text},children:[e.jsx(at,{className:"w-5 h-5",style:{color:P.accent}}),"Moje kupóny"," ",e.jsxs("span",{className:"text-sm font-normal",style:{color:P.muted},children:["(",o," aktívnych)"]})]}),r.map(i=>e.jsx(Ps,{redemption:i,rewardName:n(i.reward_id)},i.id))]})}function $s(t){return X({queryKey:["special-offers",t],queryFn:async()=>{const a=new Date().toISOString(),{data:s,error:n}=await z.from("special_offers").select("*").eq("is_active",!0).lte("valid_from",a).or(`valid_until.is.null,valid_until.gt.${a}`).order("created_at",{ascending:!1});if(n)throw n;let r=s;return t&&(r=r.filter(o=>o.target_levels.includes(t))),r}})}function Es(){const{user:t}=U();return X({queryKey:["inbox-messages",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:a,error:s}=await z.from("inbox_messages").select("*").eq("user_id",t.id).eq("is_archived",!1).order("created_at",{ascending:!1});if(s)throw s;return a},enabled:!!(t!=null&&t.id)})}function Ft(){const{user:t}=U();return X({queryKey:["unread-messages-count",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return 0;const{count:a,error:s}=await z.from("inbox_messages").select("*",{count:"exact",head:!0}).eq("user_id",t.id).eq("is_read",!1).eq("is_archived",!1);if(s)throw s;return a||0},enabled:!!(t!=null&&t.id)})}function Ls(){const t=Ce(),{user:a}=U();return Ue({mutationFn:async s=>{const{error:n}=await z.from("inbox_messages").update({is_read:!0,read_at:new Date().toISOString()}).eq("id",s);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["inbox-messages",a==null?void 0:a.id]}),t.invalidateQueries({queryKey:["unread-messages-count",a==null?void 0:a.id]})}})}function Rs(){const t=Ce(),{user:a}=U();return Ue({mutationFn:async s=>{const{error:n}=await z.from("inbox_messages").update({is_archived:!0}).eq("id",s);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["inbox-messages",a==null?void 0:a.id]}),t.invalidateQueries({queryKey:["unread-messages-count",a==null?void 0:a.id]})}})}function As(){const t=Ce(),{user:a}=U();return Ue({mutationFn:async({offerId:s,reservationId:n})=>{if(!(a!=null&&a.id))throw new Error("User not authenticated");const{data:r,error:o}=await z.from("offer_redemptions").insert({user_id:a.id,offer_id:s,reservation_id:n}).select().single();if(o)throw o;return r},onSuccess:()=>{t.invalidateQueries({queryKey:["special-offers"]})}})}const _e={info:{icon:ds,color:"text-blue-500",label:"Info"},offer:{icon:fe,color:"text-amber-500",label:"Ponuka"},alert:{icon:ms,color:"text-red-500",label:"Upozornenie"},welcome:{icon:Be,color:"text-green-500",label:"Vitajte"},booking:{icon:Qe,color:"text-purple-500",label:"Rezervácia"}};function Fs({showHeader:t=!0,compact:a=!1,openMessageId:s=null,onOpenMessageHandled:n}){var b;const{data:r=[],isLoading:o}=Es(),{data:i=0}=Ft(),[u,h]=m.useState(null),x=Ls(),g=Rs(),c=m.useRef(null);m.useEffect(()=>{if(!s||o||c.current===s)return;const j=r.find(p=>p.id===s);j&&(c.current=s,h(j),j.is_read||x.mutateAsync(j.id).catch(()=>{}),n==null||n())},[s,r,o,x,n]);const d=async j=>{h(j),j.is_read||await x.mutateAsync(j.id)},f=async j=>{await g.mutateAsync(j),h(null)};return o?e.jsxs(W,{children:[t&&e.jsx(J,{className:"pb-3",children:e.jsxs(ee,{className:"text-lg flex items-center gap-2",children:[e.jsx(Le,{className:"w-5 h-5 text-primary"}),"Správy"]})}),e.jsx(G,{className:"space-y-3",children:[1,2,3].map(j=>e.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg",children:[e.jsx(ue,{className:"w-10 h-10 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(ue,{className:"h-4 w-3/4"}),e.jsx(ue,{className:"h-3 w-1/2"})]})]},j))})]}):r.length===0?e.jsxs(W,{children:[t&&e.jsx(J,{className:"pb-3",children:e.jsxs(ee,{className:"text-lg flex items-center gap-2",children:[e.jsx(Le,{className:"w-5 h-5 text-primary"}),"Správy"]})}),e.jsx(G,{children:e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(Cs,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"Zatiaľ žiadne správy"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(W,{children:[t&&e.jsx(J,{className:"pb-3",children:e.jsxs(ee,{className:"text-lg flex items-center gap-2",children:[e.jsx(Le,{className:"w-5 h-5 text-primary"}),"Správy",i>0&&e.jsxs(Ie,{variant:"destructive",className:"ml-auto",children:[i," nové"]})]})}),e.jsx(G,{className:"space-y-2",children:r.slice(0,a?5:void 0).map(j=>e.jsx(Ms,{message:j,onClick:()=>d(j)},j.id))})]}),e.jsx(Xt,{open:!!u,onOpenChange:()=>h(null),children:e.jsx(Yt,{className:"sm:max-w-lg",children:u&&e.jsxs(e.Fragment,{children:[e.jsxs(Jt,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Ts,{type:u.message_type}),e.jsx(Ie,{variant:"secondary",children:((b=_e[u.message_type])==null?void 0:b.label)||"Správa"})]}),e.jsx(es,{children:u.subject}),e.jsxs(ts,{className:"flex items-center gap-2",children:[u.sender_name||"Naši z Račkovej"," • "," ",Xe(new Date(u.created_at),{addSuffix:!0,locale:we})]})]}),e.jsx("div",{className:"py-4",children:e.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",children:u.message})}),e.jsx("div",{className:"flex justify-end gap-2",children:e.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>f(u.id),className:"gap-2",children:[e.jsx(Ct,{className:"w-4 h-4"}),"Archivovať"]})})]})})})]})}function Ms({message:t,onClick:a}){const s=_e[t.message_type]||_e.info,n=s.icon,r=Xe(new Date(t.created_at),{addSuffix:!0,locale:we});return e.jsxs("button",{onClick:a,className:`w-full flex items-center gap-3 p-3 rounded-lg border text-left transition-colors hover:bg-muted/50 ${t.is_read?"":"bg-primary/5 border-primary/20"}`,children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center ${t.is_read?"bg-muted":"bg-primary/10"}`,children:e.jsx(n,{className:`w-5 h-5 ${s.color}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h4",{className:`text-sm truncate ${t.is_read?"":"font-semibold"}`,children:t.subject}),!t.is_read&&e.jsx("span",{className:"w-2 h-2 bg-primary rounded-full flex-shrink-0"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[t.sender_name||"Naši z Račkovej"," • ",r]})]}),e.jsx(de,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})]})}function Ts({type:t}){const a=_e[t]||_e.info,s=a.icon;return e.jsx(s,{className:`w-5 h-5 ${a.color}`})}const S={bg:"#0E1A14",surface:"#16241C",emerald:"#1F6F4A",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.2)"},Os=2e3,mt=12;async function qs(t){var c;if(t.size>mt*1024*1024)throw new Error(`Obrázok je príliš veľký (max ${mt} MB).`);const a=await createImageBitmap(t);let{width:s,height:n}=a;
32const r=Math.min(1,Os/Math.max(s,n));s=Math.round(s*r),n=Math.round(n*r);const o=document.createElement("canvas");o.width=s,o.height=n,o.getContext("2d").drawImage(a,0,0,s,n),(c=a.close)==null||c.call(a);const h=await(await new Promise((d,f)=>o.toBlob(b=>b?d(b):f(new Error("Encoding failed")),"image/jpeg",.82))).arrayBuffer();let x="";const g=new Uint8Array(h);for(let d=0;d<g.length;d++)x+=String.fromCharCode(g[d]);return{base64:btoa(x),mime:"image/jpeg"}}function Ds({open:t,onClose:a}){const{toast:s}=ge(),n=Ce(),r=m.useRef(null),[o,i]=m.useState(""),[u,h]=m.useState(""),[x,g]=m.useState(""),[c,d]=m.useState(null),[f,b]=m.useState(null),[j,p]=m.useState(null),[$,k]=m.useState(!1),[M,K]=m.useState(!1),[q,A]=m.useState(""),{data:V=[]}=X({queryKey:["attractions-active"],queryFn:async()=>{const{data:v,error:E}=await z.from("attractions").select("id, name").eq("is_active",!0).order("sort_order");if(E)throw E;return v},enabled:t});if(!t)return null;const te=()=>{i(""),h(""),g(""),d(null),b(null),p(null),k(!1),A("")},Y=v=>{b(v),j&&URL.revokeObjectURL(j),p(v?URL.createObjectURL(v):null)},oe=async v=>{if(v.preventDefault(),!o)return s({title:"Vyber atrakciu",variant:"destructive"});if(u.trim().length<1)return s({title:"Vyplň titulok",variant:"destructive"});if(x.trim().length<1)return s({title:"Vyplň popis",variant:"destructive"});if(!$)return s({title:"Potrebujeme tvoj GDPR súhlas",variant:"destructive"});K(!0);try{let E,T;if(f){const ae=await qs(f);E=ae.base64,T=ae.mime}const{data:H,error:se}=await z.functions.invoke("community-submit",{body:{kind:"tip",attraction_id:o,title:u.trim(),body:x.trim(),rating:c,image_base64:E,image_mime:T,gdpr_accepted:!0,honeypot:q}});if(se)throw se;if(H!=null&&H.error)throw new Error(H.error);s({title:"Tip pridaný!",description:"Vidia ho ostatní hostia hneď. (+20 bodov za tvoj tip)"}),te(),n.invalidateQueries({queryKey:["community-posts"]}),n.invalidateQueries({queryKey:["community-stats"]}),a()}catch(E){s({title:"Nepodarilo sa odoslať",description:E.message,variant:"destructive"})}finally{K(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center p-0 sm:p-4",style:{background:"rgba(0,0,0,0.7)"},onClick:a,children:e.jsxs("form",{onSubmit:oe,onClick:v=>v.stopPropagation(),className:"w-full sm:max-w-lg rounded-t-3xl sm:rounded-3xl overflow-hidden max-h-[95vh] flex flex-col",style:{background:S.surface,border:`1px solid ${S.border}`,color:S.text},children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b",style:{borderColor:S.border},children:[e.jsx("h3",{className:"text-lg font-bold",children:"Pridať tip na výlet"}
32),e.jsx("button",{type:"button",onClick:a,className:"p-1 opacity-70 hover:opacity-100",children:e.jsx(ke,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4 text-sm",children:[e.jsx("input",{type:"text",value:q,onChange:v=>A(v.target.value),autoComplete:"off",tabIndex:-1,"aria-hidden":"true",style:{position:"absolute",left:"-9999px",opacity:0,height:0,width:0}}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Atrakcia"}),e.jsxs("select",{value:o,onChange:v=>i(v.target.value),required:!0,className:"w-full rounded-xl px-3 py-2.5 outline-none",style:{background:S.bg,border:`1px solid ${S.border}`,color:S.text},children:[e.jsx("option",{value:"",children:"— vyber atrakciu —"}),V.map(v=>e.jsx("option",{value:v.id,children:v.name},v.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Titulok"}),e.jsx("input",{type:"text",value:u,onChange:v=>h(v.target.value.slice(0,80)),maxLength:80,required:!0,placeholder:"Napr. Východ slnka na Ostrý Roháč",className:"w-full rounded-xl px-3 py-2.5 outline-none",style:{background:S.bg,border:`1px solid ${S.border}`,color:S.text}}),e.jsxs("p",{className:"text-xs mt-1",style:{color:S.muted},children:[u.length,"/80"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Tvoj zážitok / tip"}),e.jsx("textarea",{value:x,onChange:v=>g(v.target.value.slice(0,600)),maxLength:600,required:!0,rows:4,placeholder:"Čo sa oplatí, ako sa pripraviÅ¥, kedy ísť…",className:"w-full rounded-xl px-3 py-2.5 outline-none resize-none",style:{background:S.bg,border:`1px solid ${S.border}`,color:S.text}}),e.jsxs("p",{className:"text-xs mt-1",style:{color:S.muted},children:[x.length,"/600"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Hodnotenie atrakcie (voliteľné)"}),e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(v=>e.jsx("button",{type:"button",onClick:()=>d(c===v?null:v),className:"p-1","aria-label":`${v} hviezd`,children:e.jsx(he,{className:"w-7 h-7",style:{color:c&&c>=v?S.accent:S.muted,fill:c&&c>=v?S.accent:"transparent"}})},v))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Fotka (voliteľné)"}),j?e.jsxs("div",{className:"relative rounded-xl overflow-hidden",style:{background:S.bg},children:[e.jsx("img",{src:j,alt:"",className:"w-full h-48 object-cover"}),e.jsx("button",{type:"button",onClick:()=>Y(null),className:"absolute top-2 right-2 p-1.5 rounded-full",style:{background:"rgba(0,0,0,0.6)",color:S.text},children:e.jsx(ke,{className:"w-4 h-4"})})]}):e.jsxs("button",{type:"button",onClick:()=>{var v;return(v=r.current)==null?void 0:v.click()},className:"w-full rounded-xl py-6 flex flex-col items-center gap-2 transition",style:{background:S.bg,border:`1px dashed ${S.border}`,color:S.muted},children:[e.jsx(Ge,{className:"w-6 h-6",style:{color:S.accent}}),e.jsx("span",{className:"text-sm",children:"VyfotiÅ¥ alebo vybraÅ¥ z galérie"})]}),e.jsx("input",{ref:r,type:"file",accept:"image/jpeg,image/png,image/webp",capture:"environment",onChange:v=>{var E;return Y(((E=v.target.files)==null?void 0:E[0])??null)},className:"hidden"}),e.jsx("p",{className:"text-xs mt-1.5",style:{color:S.muted},children:"Fotka sa pred odoslaním zmenší a EXIF (vrátane GPS) sa odstráni."})]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-xl",style:{background:S.bg,border:`1px solid ${S.border}`},children:[e.jsx("input",{type:"checkbox",checked:$,onChange:v=>k(v.target.checked),className:"mt-0.5 w-4 h-4 accent-current",style:{accentColor:S.accent},required:!0}),e.jsxs("span",{className:"text-xs leading-relaxed",style:{color:S.muted},children:["Potvrdzujem, že mám práva k fotke a súhlas vÅ¡etkých rozpoznateľných osôb na nej. Za obsah zodpovedám ja, prevádzkovateľ ho môže odstrániÅ¥ bez udania dôvodu.",e.jsx("strong",{className:"block mt-1",style:{color:S.text},children:"Recenzie na ubytovanie píšte prosím priamo na Google — táto sekcia je len pre tipy na výlety."})]})]})]}),e.jsxs("div",{className:"p-5 border-t flex gap-3",style:{borderColor:S.border,background:S.surface},children:[e.jsx("button",{type:"button",onClick:a,className:"flex-1 py-3 rounded-full font-bold text-sm",style:{background:S.bg,color:S.text,border:`1px solid ${S.border}`},children:"ZruÅ¡iÅ¥"}),e.jsxs("button",{type:"submit",disabled:M,className:"flex-1 py-3 rounded-full font-bold text-sm flex items-center justify-center gap-2 disabled:opacity-60",style:{background:S.accent,color:S.bg},children:[M&&e.jsx(I,{className:"w-4 h-4 animate-spin"}),"PridaÅ¥ tip"]})]})]})})}const Is=Ee.icon({iconUrl:"https://unpkg.com/[email protected]/dist/images/marker-icon.png",iconRetinaUrl:"https://unpkg.com/[email protected]/dist/images/marker-icon-2x.png",shadowUrl:"https://unpkg.com/[email protected]/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],shadowSize:[41,41]}),ut={lat:49.1142846,lng:19.8009764};function Ks({lat:t,lng:a,onChange:s,accent:n="#C9F24A"}){const r=m.useRef(null),o=m.useRef(null),i=m.useRef(null),[u,h]=m.useState(!1);m.useEffect(()=>{if(!r.current||o.current)return;const g={lat:t??ut.lat,lng:a??ut.lng},c=Ee.map(r.current,{zoomControl:!0}
32).setView([g.lat,g.lng],9);Ee.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap",maxZoom:18}).addTo(c);const d=Ee.marker([g.lat,g.lng],{draggable:!0,icon:Is}).addTo(c);return d.on("dragend",()=>{const f=d.getLatLng();s(+f.lat.toFixed(6),+f.lng.toFixed(6))}),c.on("click",f=>{d.setLatLng(f.latlng),s(+f.latlng.lat.toFixed(6),+f.latlng.lng.toFixed(6))}),o.current=c,i.current=d,(t==null||a==null)&&s(g.lat,g.lng),setTimeout(()=>c.invalidateSize(),100),()=>{c.remove(),o.current=null,i.current=null}},[]),m.useEffect(()=>{if(!o.current||!i.current||t==null||a==null)return;const g=i.current.getLatLng();(Math.abs(g.lat-t)>1e-6||Math.abs(g.lng-a)>1e-6)&&(i.current.setLatLng([t,a]),o.current.setView([t,a],Math.max(o.current.getZoom(),12)))},[t,a]);const x=()=>{navigator.geolocation&&(h(!0),navigator.geolocation.getCurrentPosition(g=>{s(+g.coords.latitude.toFixed(6),+g.coords.longitude.toFixed(6)),h(!1)},()=>h(!1),{enableHighAccuracy:!0,timeout:8e3}))};return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{ref:r,className:"w-full h-56 rounded-xl overflow-hidden",style:{background:"#0E1A14"}}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("button",{type:"button",onClick:x,disabled:u,className:"inline-flex items-center gap-1.5 text-xs px-3 py-1.5 rounded-full disabled:opacity-60",style:{background:n,color:"#0E1A14",fontWeight:600},children:[e.jsx(_s,{className:"w-3.5 h-3.5"}),u?"Hľadám…":"Použiť moju polohu"]}),e.jsx("span",{className:"text-[11px] font-mono opacity-70",children:t!=null&&a!=null?`${t.toFixed(5)}, ${a.toFixed(5)}`:"—"})]}),e.jsx("p",{className:"text-[11px] opacity-60",children:"Ťukni na mapu alebo potiahni značku na presné miesto."})]})}const N={bg:"#0E1A14",surface:"#16241C",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.2)"},Bs=2e3,xt=12;async function Us(t){var c;if(t.size>xt*1024*1024)throw new Error(`Obrázok je príliš veľký (max ${xt} MB).`);const a=await createImageBitmap(t);let{width:s,height:n}=a;const r=Math.min(1,Bs/Math.max(s,n));s=Math.round(s*r),n=Math.round(n*r);const o=document.createElement("canvas");o.width=s,o.height=n,o.getContext("2d").drawImage(a,0,0,s,n),(c=a.close)==null||c.call(a);const h=await(await new Promise((d,f)=>o.toBlob(b=>b?d(b):f(new Error("Encoding failed")),"image/jpeg",.82))).arrayBuffer();let x="";const g=new Uint8Array(h);for(let d=0;d<g.length;d++)x+=String.fromCharCode(g[d]);return{base64:btoa(x),mime:"image/jpeg"}}const Vs=["Tip","Príroda","Kultúra","Šport","Jedlo"],Hs=[{value:"foot",label:"Pešo"},{value:"bike",label:"Bicykel"},{value:"car",label:"Auto"}];function Mt({open:t,onClose:a,edit:s}){const{toast:n}=ge(),r=Ce(),o=m.useRef(null),i=!!s,[u,h]=m.useState((s==null?void 0:s.name)??""),[x,g]=m.useState((s==null?void 0:s.short)??""),[c,d]=m.useState((s==null?void 0:s.category)??"Tip"),[f,b]=m.useState((s==null?void 0:s.mode)??"car"),[j,p]=m.useState((s==null?void 0:s.distance_km)!=null?String(s.distance_km):""),[$,k]=m.useState(null),[M,K]=m.useState(null),[q,A]=m.useState(i),[V,te]=m.useState(!1),[Y,oe]=m.useState(""),[v,E]=m.useState((s==null?void 0:s.lat)??null),[T,H]=m.useState((s==null?void 0:s.lng)??null);if(!t)return null;const se=()=>{h(""),g(""),d("Tip"),b("car"),p(""),k(null),K(null),A(!1),oe(""),E(null),H(null)},ae=_=>{k(_),M&&URL.revokeObjectURL(M),K(_?URL.createObjectURL(_):null)},ye=async _=>{if(_.preventDefault(),u.trim().length<2)return n({title:"Vyplň názov atrakcie",variant:"destructive"});if(x.trim().length<5)return n({title:"Pridaj krátky popis",variant:"destructive"});const D=Number(j);if(!Number.isFinite(D)||D<0)return n({title:"Zadaj vzdialenosť v km",variant:"destructive"});if(v==null||T==null)return n({title:"Pripni polohu na mape",variant:"destructive"});if(!i&&!q)return n({title:"Potrebujeme GDPR súhlas",variant:"destructive"});te(!0);try{if(i&&s){const{data:Z,error:F}=await z.from("attractions").update({name:u.trim(),short:x.trim(),category:c,mode:f,distance_km:D,lat:v,lng:T}).eq("id",s.id).select("id");if(F)throw F;if(!Z||Z.length===0)throw new Error("Túto atrakciu už nie je možné upraviť — je schválená a zverejnená. Napíš nám a radi ju upravíme.");n({title:"Atrakcia upravená"})}else{let Z,F;if($){const Pe=await Us($);Z=Pe.base64,F=Pe.mime}const{data:ie,error:Se}=await z.functions.invoke("community-submit",{body:{kind:"attraction",name:u.trim(),short:x.trim(),category:c,mode:f,distance_km:D,lat:v,lng:T,image_base64:Z,image_mime:F,gdpr_accepted:!0,honeypot:Y}});if(Se)throw Se;if(ie!=null&&ie.error)throw new Error(ie.error);n({title:"Atrakcia odoslaná na schválenie",description:"Ďakujeme! Po kontrole ju uvidia všetci hostia. (+30 bodov)"})}se(),r.invalidateQueries({queryKey:["attractions-active"]}),r.invalidateQueries({queryKey:["community-stats"]}),r.invalidateQueries({queryKey:["my-attractions"]}),a()}catch(Z){n({title:"Nepodarilo sa uložiť",description:Z.message,variant:"destructive"})}finally{te(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center p-0 sm:p-4",style:{background:"rgba(0,0,0,0.7)"},onClick:a,children:e.jsxs("form",{onSubmit:ye,onClick:_=>_.stopPropagation(),className:"w-full sm:max-w-lg rounded-t-3xl sm:rounded-3xl overflow-hidden max-h-[95vh] flex flex-col",style:{background:N.surface,border:`1px solid ${N.border}`,color:N.text},children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b",style:{borderColor:N.border},children:[e.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[e.jsx(At,{className:"w-5 h-5",style:{color:N.accent}}),i?"Upraviť atrakciu":"Pridať novú atrakciu"]}
32),e.jsx("button",{type:"button",onClick:a,className:"p-1 opacity-70 hover:opacity-100",children:e.jsx(ke,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5 space-y-4 text-sm",children:[e.jsx("input",{type:"text",value:Y,onChange:_=>oe(_.target.value),autoComplete:"off",tabIndex:-1,"aria-hidden":"true",style:{position:"absolute",left:"-9999px",opacity:0,height:0,width:0}}),e.jsx("p",{className:"text-xs leading-relaxed",style:{color:N.muted},children:'Nenašiel si v zozname atrakciu, ktorú by si chcel odporučiť? Pridaj ju! Zobrazí sa ostatným hosťom s označením „tip hosťa".'}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Názov atrakcie"}),e.jsx("input",{type:"text",value:u,onChange:_=>h(_.target.value.slice(0,80)),maxLength:80,required:!0,placeholder:"Napr. Spišský hrad",className:"w-full rounded-xl px-3 py-2.5 outline-none",style:{background:N.bg,border:`1px solid ${N.border}`,color:N.text}})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Krátky popis"}),e.jsx("textarea",{value:x,onChange:_=>g(_.target.value.slice(0,300)),maxLength:300,required:!0,rows:3,placeholder:"Čo to je a prečo sa to oplatí navštíviť",className:"w-full rounded-xl px-3 py-2.5 outline-none resize-none",style:{background:N.bg,border:`1px solid ${N.border}`,color:N.text}}),e.jsxs("p",{className:"text-xs mt-1",style:{color:N.muted},children:[x.length,"/300"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Kategória"}),e.jsx("select",{value:c,onChange:_=>d(_.target.value),className:"w-full rounded-xl px-3 py-2.5 outline-none",style:{background:N.bg,border:`1px solid ${N.border}`,color:N.text},children:Vs.map(_=>e.jsx("option",{value:_,children:_},_))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Doprava"}),e.jsx("select",{value:f,onChange:_=>b(_.target.value),className:"w-full rounded-xl px-3 py-2.5 outline-none",style:{background:N.bg,border:`1px solid ${N.border}`,color:N.text},children:Hs.map(_=>e.jsx("option",{value:_.value,children:_.label},_.value))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Vzdialenosť od penziónu (km)"}),e.jsx("input",{type:"number",inputMode:"decimal",min:0,max:500,step:.1,value:j,onChange:_=>p(_.target.value),required:!0,placeholder:"Napr. 75",className:"w-full rounded-xl px-3 py-2.5 outline-none",style:{background:N.bg,border:`1px solid ${N.border}`,color:N.text}})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Pripni polohu na mape"}),e.jsx(Ks,{lat:v,lng:T,onChange:(_,D)=>{E(_),H(D)},accent:N.accent})]}),!i&&e.jsxs("div",{children:[e.jsx("label",{className:"block mb-1.5 font-semibold",children:"Fotka (voliteľné)"}),M?e.jsxs("div",{className:"relative rounded-xl overflow-hidden",style:{background:N.bg},children:[e.jsx("img",{src:M,alt:"",className:"w-full h-48 object-cover"}),e.jsx("button",{type:"button",onClick:()=>ae(null),className:"absolute top-2 right-2 p-1.5 rounded-full",style:{background:"rgba(0,0,0,0.6)",color:N.text},children:e.jsx(ke,{className:"w-4 h-4"})})]}):e.jsxs("button",{type:"button",onClick:()=>{var _;return(_=o.current)==null?void 0:_.click()},className:"w-full rounded-xl py-6 flex flex-col items-center gap-2 transition",style:{background:N.bg,border:`1px dashed ${N.border}`,color:N.muted},children:[e.jsx(Ge,{className:"w-6 h-6",style:{color:N.accent}}),e.jsx("span",{className:"text-sm",children:"Vyfotiť alebo vybrať z galérie"})]}),e.jsx("input",{ref:o,type:"file",accept:"image/jpeg,image/png,image/webp",capture:"environment",onChange:_=>{var D;return ae(((D=_.target.files)==null?void 0:D[0])??null)},className:"hidden"})]}),!i&&e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-xl",style:{background:N.bg,border:`1px solid ${N.border}`},children:[e.jsx("input",{type:"checkbox",checked:q,onChange:_=>A(_.target.checked),className:"mt-0.5 w-4 h-4",style:{accentColor:N.accent},required:!0}),e.jsx("span",{className:"text-xs leading-relaxed",style:{color:N.muted},children:"Potvrdzujem, že mám práva k fotke a súhlas všetkých rozpoznateľných osôb. Za obsah zodpovedám ja, prevádzkovateľ ho môže odstrániť bez udania dôvodu."})]})]}),e.jsxs("div",{className:"p-5 border-t flex gap-3",style:{borderColor:N.border,background:N.surface},children:[e.jsx("button",{type:"button",onClick:a,className:"flex-1 py-3 rounded-full font-bold text-sm",style:{background:N.bg,color:N.text,border:`1px solid ${N.border}`},children:"Zrušiť"}),e.jsxs("button",{type:"submit",disabled:V,className:"flex-1 py-3 rounded-full font-bold text-sm flex items-center justify-center gap-2 disabled:opacity-60",style:{background:N.accent,color:N.bg},children:[V&&e.jsx(I,{className:"w-4 h-4 animate-spin"}),i?"Uložiť zmeny":"Pridať atrakciu"]})]})]})})}const B={bg:"#0E1A14",surface:"#16241C",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.2)"};function re({icon:t,label:a,title:s,meta:n,highlight:r}){return e.jsxs("div",{className:"rounded-2xl p-4 flex flex-col gap-1.5 min-h-[110px]",style:{background:r?`linear-gradient(135deg, ${B.accent}22, ${B.surface})`:B.surface,border:`1px solid ${B.border}`},children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 text-[10px] uppercase tracking-widest font-bold",style:{color:B.accent},children:[t,a]}),e.jsx("div",{className:"font-bold text-base leading-tight",style:{color:B.text},children:s}),n&&e.jsx("div",{className:"text-xs mt-auto",style:{color:B.muted},children:n})]})}function Zs(){const{data:t,isLoading:a}=X({queryKey:["community-stats"],queryFn:async()=>{const{data:n,error:r}=await z.rpc("get_community_stats");if(r)throw r;return n},staleTime:3e5});return a?e.jsx("div",{className:"flex justify-center py-6",children:e.jsx(I,{className:"w-5 h-5 animate-spin",style:{color:B.accent}})}):t&&(t.top_rated||t.most_visited||t.guest_of_month||t.latest)?e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[t!=null&&t.top_rated?e.jsx(re,{icon:e.jsx(he,{className:"w-3 h-3",fill:"
32currentColor"}),label:"Top hodnotené",title:t.top_rated.name,meta:`${t.top_rated.avg_rating} / 5 · ${t.top_rated.rating_count} hodn.`,highlight:!0}):e.jsx(re,{icon:e.jsx(he,{className:"w-3 h-3"}),label:"Top hodnotené",title:"—",meta:"zatiaľ bez hodnotenia"}),t!=null&&t.most_visited?e.jsx(re,{icon:e.jsx(ce,{className:"w-3 h-3"}),label:"Najobľúbenejšie",title:t.most_visited.name,meta:`${t.most_visited.posts_count} tipov od hostí`}):e.jsx(re,{icon:e.jsx(ce,{className:"w-3 h-3"}),label:"Najobľúbenejšie",title:"—",meta:"bez tipov"}),t!=null&&t.guest_of_month?e.jsx(re,{icon:e.jsx(nt,{className:"w-3 h-3"}),label:"Hosť mesiaca",title:`${t.guest_of_month.first_name} ${t.guest_of_month.last_initial}`,meta:`${t.guest_of_month.posts_count} tipov za 30 dní`}):e.jsx(re,{icon:e.jsx(nt,{className:"w-3 h-3"}),label:"Hosť mesiaca",title:"Buď to ty!",meta:"zapni viditeľnosť v profile"}),t!=null&&t.latest?e.jsx(re,{icon:e.jsx(Q,{className:"w-3 h-3"}),label:"Najnovšie",title:t.latest.title,meta:`${t.latest.first_name} · ${t.latest.attraction_name}`}):e.jsx(re,{icon:e.jsx(Q,{className:"w-3 h-3"}),label:"Najnovšie",title:"—",meta:"zatiaľ nič"})]}):e.jsx("div",{className:"rounded-2xl p-5 text-center text-sm",style:{background:B.surface,color:B.muted,border:`1px solid ${B.border}`},children:"Štatistiky komunity sa naplnia, keď pribudnú prvé tipy ✨"})}const L={bg:"#0E1A14",surface:"#16241C",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.2)"};function Ws(){const{user:t}=U(),[a,s]=m.useState(null),{data:n,isLoading:r}=X({queryKey:["my-attractions",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:o,error:i}=await z.from("attractions").select("id, name, short, category, mode, distance_km, lat, lng, is_active, image_url, created_at, moderation_status").eq("source","guest").eq("submitted_by",t.id).order("created_at",{ascending:!1});if(i)throw i;return o||[]},enabled:!!t});return t?r?e.jsx("div",{className:"flex justify-center py-6",children:e.jsx(I,{className:"w-5 h-5 animate-spin",style:{color:L.accent}})}):!n||n.length===0?null:e.jsxs("section",{className:"rounded-[28px] border p-5 sm:p-6",style:{background:L.surface,borderColor:L.border},children:[e.jsxs("header",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-base font-bold flex items-center gap-2",children:[e.jsx(ce,{className:"w-4 h-4",style:{color:L.accent}}),"Moje atrakcie"]}),e.jsxs("span",{className:"text-xs",style:{color:L.muted},children:[n.length," ",n.length===1?"tip":n.length<5?"tipy":"tipov"]})]}),e.jsx("p",{className:"text-xs mb-4",style:{color:L.muted},children:"Atrakcie, ktoré si pridal/a. Upraviť sa dajú, kým čakajú na schválenie. Po zverejnení nám napíš a radi ich upravíme."}),e.jsx("ul",{className:"space-y-2",children:n.map(o=>e.jsxs("li",{className:"flex items-center gap-3 p-3 rounded-2xl",style:{background:L.bg,border:`1px solid ${L.border}`},children:[o.image_url?e.jsx("img",{src:o.image_url,alt:"",className:"w-12 h-12 rounded-lg object-cover shrink-0"}):e.jsx("div",{className:"w-12 h-12 rounded-lg shrink-0 flex items-center justify-center",style:{background:L.surface,color:L.accent},children:e.jsx(ce,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-sm truncate",children:o.name}),e.jsxs("p",{className:"text-[11px] truncate",style:{color:L.muted},children:[o.category," · ",o.distance_km," km · ",o.mode==="foot"?"pešo":o.mode==="bike"?"bicykel":"autom",!o.is_active&&" · skryté"]}),e.jsx("p",{className:"text-[11px] mt-0.5 font-semibold",style:{color:o.moderation_status==="approved"?L.accent:L.muted},children:o.moderation_status==="approved"?"Zverejnené":o.moderation_status==="rejected"?"Zamietnuté":"Čaká na schválenie"})]}),o.moderation_status==="pending"?e.jsxs("button",{type:"button",onClick:()=>s({id:o.id,name:o.name,short:o.short,category:o.category,mode:o.mode,distance_km:Number(o.distance_km),lat:Number(o.lat),lng:Number(o.lng)}
32),className:"shrink-0 inline-flex items-center gap-1.5 text-xs font-bold px-3 py-1.5 rounded-full",style:{background:L.accent,color:L.bg},children:[e.jsx(ss,{className:"w-3.5 h-3.5"}),"Upraviť"]}):null]},o.id))}),e.jsx(Mt,{open:!!a,onClose:()=>s(null),edit:a})]}):null}const w={bg:"#0E1A14",surface:"#16241C",emerald:"#1F6F4A",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.2)"},Gs={explorer:"Explorer",adventurer:"Adventurer",mountaineer:"Mountaineer",legend:"Legend"};function Qs(t){if(!(t!=null&&t.full_name))return"Hosť";const a=t.full_name.trim().split(/\s+/);return a.length===1?a[0]:`${a[0]} ${a[1][0]}.`}function Xs(t){return new Date(t).toLocaleDateString("sk-SK",{day:"numeric",month:"short"})}function Ys({path:t}){const{data:a}=X({queryKey:["community-signed",t],queryFn:async()=>{const{data:s,error:n}=await z.storage.from("community-uploads").createSignedUrl(t,3600);if(n)throw n;return s.signedUrl},staleTime:3e6});return a?e.jsx("img",{src:a,alt:"",loading:"lazy",className:"w-full aspect-[4/3] object-cover"}):e.jsx("div",{className:"w-full aspect-[4/3] animate-pulse",style:{background:w.bg}})}function Js(){const{user:t}=U(),{data:a}=Nt(),[s,n]=m.useState(!1),[r,o]=m.useState(!1),i=((a==null?void 0:a.total_nights)??0)>=1,{data:u=[],isLoading:h}=X({queryKey:["community-posts"],queryFn:async()=>{const{data:x,error:g}=await z.from("community_posts").select("id, title, body, rating, image_path, created_at, user_id, attraction_id").eq("status","approved").order("created_at",{ascending:!1}).limit(30);if(g)throw g;const c=x||[];if(!c.length)return c;const d=[...new Set(c.map(k=>k.attraction_id))],f=[...new Set(c.map(k=>k.user_id))],[b,j]=await Promise.all([z.from("attractions").select("id, name").in("id",d),z.from("profiles").select("user_id, full_name, loyalty_level").in("user_id",f)]),p=new Map((b.data||[]).map(k=>[k.id,k])),$=new Map((j.data||[]).map(k=>[k.user_id,k]));return c.map(k=>({...k,attractions:p.get(k.attraction_id)??null,profiles:$.get(k.user_id)?{full_name:$.get(k.user_id).full_name,loyalty_level:$.get(k.user_id).loyalty_level}:null}))},enabled:!!t});return t?e.jsxs("div",{className:"space-y-5",children:[e.jsx(Zs,{}),e.jsxs("div",{className:"rounded-[28px] border p-6 sm:p-7 relative overflow-hidden",style:{background:w.surface,borderColor:w.border},children:[e.jsx("div",{className:"absolute -top-16 -right-16 w-48 h-48 rounded-full opacity-20",style:{background:`radial-gradient(circle, ${w.accent} 0%, transparent 70%)`}}),e.jsxs("div",{className:"relative",children:[e.jsxs("p",{className:"text-[10px] uppercase tracking-widest font-bold mb-2",style:{color:w.accent},children:[e.jsx(Q,{className:"w-3 h-3 inline-block mr-1"}),"Komunita"]}),e.jsx("h3",{className:"text-2xl font-bold mb-2",children:"Sileáci & Droseráci"}),e.jsxs("p",{className:"text-sm",style:{color:w.muted},children:["Tipy, fotky a recenzie atrakcií od skutočných hostí."," ",e.jsx("strong",{style:{color:w.text},children:"Recenzie na ubytovanie píšte priamo na Google."})]}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-2",children:[e.jsxs("button",{onClick:()=>n(!0),disabled:!i,title:i?"":"Dostupné po prvom pobyte",className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-full font-bold text-sm disabled:opacity-50 disabled:cursor-not-allowed transition",style:{background:w.accent,color:w.bg},children:[e.jsx(as,{className:"w-4 h-4"})," Pridať tip k atrakcii"]}),e.jsxs("button",{onClick:()=>o(!0),disabled:!i,title:i?"Nenašiel si ju? Pridaj novú.":"Dostupné po prvom pobyte",className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-full font-bold text-sm disabled:opacity-50 disabled:cursor-not-allowed transition",style:{background:w.bg,color:w.text,border:`1px solid ${w.border}`},children:[e.jsx(At,{className:"w-4 h-4",style:{color:w.accent}})," Nová atrakcia"]})]}),!i&&e.jsxs("p",{className:"text-xs mt-3",style:{color:w.muted},children:[e.jsx(Ae,{className:"w-3 h-3 inline-block mr-1"}),"Tipy a fotky môžu pridávať hostia po prvom pobyte."]})]})]}),e.jsx(Ws,{}),h?e.jsx("div",{className:"flex justify-center py-10",children:e.jsx(I,{className:"w-6 h-6 animate-spin",style:{color:w.accent}})}):u.length===0?e.jsx("div",{className:"rounded-2xl p-8 text-center text-sm",style:{background:w.surface,color:w.muted,border:`1px solid ${w.border}`},children:"Zatiaľ tu nie sú žiadne tipy. Buď prvý, kto sa podelí."}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:u.map(x=>{var g;return e.jsxs("article",{className:"rounded-2xl overflow-hidden flex flex-col",style:{background:w.surface,border:`1px solid ${w.border}`},children:[x.image_path&&e.jsx(Ys,{path:x.image_path}),e.jsxs("div",{className:"p-4 flex-1 flex flex-col gap-2",children:[x.attractions&&e.jsxs("span",{className:"inline-flex self-start items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",style:{background:w.bg,color:w.accent,border:`1px solid ${w.border}`},children:[e.jsx(ce,{className:"w-3 h-3"})," ",x.attractions.name]}),e.jsx("h4",{className:"font-bold text-base leading-tight",children:x.title}),x.rating&&e.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(c=>e.jsx(he,{className:"w-3.5 h-3.5",style:{color:c<=(x.rating??0)?w.accent:w.muted,fill:c<=(x.rating??0)?w.accent:"transparent"}},c))}),e.jsx("p",{className:"text-sm leading-relaxed line-clamp-4",style:{color:w.muted},children:x.body}),e.jsxs("div",{className:"flex items-center justify-between text-[11px] pt-2 mt-auto border-t",style:{borderColor:w.border,color:w.muted},children:[e.jsxs("span",{className:"font-semibold",style:{color:w.text},children:[Qs(x.profiles),((g=x.profiles)==null?void 0:g.loyalty_level)&&e.jsx("span",{className:"ml-2 px-1.5 py-0.5 rounded text-[9px] uppercase tracking-wider font-bold",style:{background:w.bg,color:w.accent},children:Gs[x.profiles.loyalty_level]||x.profiles.loyalty_level})]}),e.jsx("span",{children:Xs(x.created_at)})]})]})]},x.id)})}),e.jsx(Ds,{open:s,onClose:()=>n(!1)}),e.jsx(Mt,{open:r,onClose:()=>o(!1)})]}):e.jsxs("article",{className:"rounded-[28px] border p-8 text-center",style:{background:w.surface,borderColor:w.border},children:[e.jsx("div",{className:"inline-flex w-16 h-16 items-center justify-center rounded-full mb-4",style:{background:w.bg,color:w.accent},children:e.jsx(Ae,{className:"w-7 h-7"})}),e.jsx("h3",{className:"text-xl font-bold mb-2",children:"Komunita Sileákov & Droserákov"}),e.jsx("p",{className:"text-sm max-w-sm mx-auto mb-5",style:{color:w.muted},children:"Tipy na výlety, fotky z túr a recenzie atrakcií od overených hostí. Prihlás sa pre prístup."}),e.jsx(R,{to:"/prihlasenie",className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-full font-bold text-sm",style:{background:w.accent,color:w.bg},children:"Prihlásiť sa"})]})}const y={bg:"#0E1A14",surface:"#16241C",emerald:"#1F6F4A",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.2)"}
32,ea=[{code:"sk",label:"Slovenčina"},{code:"en",label:"English"},{code:"pl",label:"Polski"},{code:"hu",label:"Magyar"}],me={background:y.bg,border:`1px solid ${y.border}`,color:y.text};function ta({profile:t}){var Ye;const{user:a,signOut:s}=U(),{toast:n}=ge(),{t:r,i18n:o}=_t(),[i,u]=m.useState((t==null?void 0:t.full_name)||""),[h,x]=m.useState((t==null?void 0:t.phone)||""),[g,c]=m.useState((t==null?void 0:t.birth_date)||""),[d,f]=m.useState((t==null?void 0:t.preferred_language)||"sk"),[b,j]=m.useState(!!(t!=null&&t.community_visible)),[p,$]=m.useState(!!(t!=null&&t.marketing_flag)),[k,M]=m.useState((t==null?void 0:t.avatar_url)||null),[K,q]=m.useState(null),[A,V]=m.useState(!1),te=m.useRef(null),[Y,oe]=m.useState(!1),[v,E]=m.useState(!1),[T,H]=m.useState(""),[se,ae]=m.useState(""),[ye,_]=m.useState(!1),[D,Z]=m.useState(!1),[F,ie]=m.useState(null);m.useEffect(()=>{if(!(a!=null&&a.id)){ie(null);return}let C=!1;return z.from("user_roles").select("role").eq("user_id",a.id).in("role",["admin","staff"]).maybeSingle().then(({data:O})=>{C||ie((O==null?void 0:O.role)??null)}),()=>{C=!0}},[a==null?void 0:a.id]),m.useEffect(()=>{t&&(u(t.full_name||""),x(t.phone||""),c(t.birth_date||""),f(t.preferred_language||"sk"),j(!!t.community_visible),$(!!t.marketing_flag),M(t.avatar_url||null))},[t]),m.useEffect(()=>{let C=!1;if(!k){q(null);return}return z.storage.from("avatars").createSignedUrl(k,60*60*24*7).then(({data:O})=>{C||q((O==null?void 0:O.signedUrl)||null)}),()=>{C=!0}},[k]);const Se=async C=>{var tt,st;const O=(tt=C.target.files)==null?void 0:tt[0];if(C.target.value="",!O||!(a!=null&&a.id))return;if(O.size>
325*1024*1024){n({title:r("appProfile.photoTooBig"),variant:"destructive"});return}V(!0);const Kt=((st=O.name.split(".").pop())==null?void 0:st.toLowerCase())||"jpg",ze=`${a.id}/avatar-${Date.now()}.${Kt}`,{error:Je}=await z.storage.from("avatars").upload(ze,O,{cacheControl:"3600",upsert:!0,contentType:O.type});if(Je){V(!1),n({title:r("appProfile.photoError"),description:Je.message,variant:"destructive"});return}k&&k!==ze&&await z.storage.from("avatars").remove([k]).catch(()=>{});const{error:et}=await z.from("profiles").update({avatar_url:ze}).eq("user_id",a.id);if(V(!1),et){n({title:r("appProfile.photoError"),description:et.message,variant:"destructive"});return}M(ze),n({title:r("appProfile.photoUploaded")})},Pe=async()=>{!(a!=null&&a.id)||!k||(V(!0),await z.storage.from("avatars").remove([k]).catch(()=>{}),await z.from("profiles").update({avatar_url:null}).eq("user_id",a.id),M(null),q(null),V(!1))},Dt=async()=>{if(!(a!=null&&a.id))return;oe(!0);const{error:C}=await z.from("profiles").update({full_name:i||null,phone:h||null,birth_date:g||null,preferred_language:d,community_visible:b,marketing_flag:p}).eq("user_id",a.id);oe(!1),C?n({title:r("appProfile.saveError"),description:C.message,variant:"destructive"}):(E(!0),n({title:r("appProfile.savedToast")}),d!==o.language&&o.changeLanguage(d),setTimeout(()=>E(!1),2e3))},It=async()=>{if(T.length<6){n({title:r("appProfile.passwordTooShort"),variant:"destructive"});return}if(T!==se){n({title:r("appProfile.passwordMismatch"),variant:"destructive"});return}Z(!0);const{error:C}=await z.auth.updateUser({password:T});Z(!1),C?n({title:r("appProfile.error"),description:C.message,variant:"destructive"}):(n({title:r("appProfile.passwordChanged")}),H(""),ae(""))};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("section",{className:"rounded-[28px] border p-5 sm:p-6",style:{background:y.surface,borderColor:y.border},children:[e.jsxs("header",{className:"flex items-center gap-4 mb-5",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsxs("button",{type:"button",onClick:()=>{var C;return(C=te.current)==null?void 0:C.click()},disabled:A,className:"w-16 h-16 rounded-full overflow-hidden flex items-center justify-center relative group",style:{background:K?"transparent":`linear-gradient(135deg, ${y.emerald} 0%, ${y.accent} 100%)`,color:y.bg},"aria-label":r(k?"appProfile.changePhoto":"appProfile.uploadPhoto"),children:[K?e.jsx("img",{src:K,alt:"",className:"w-full h-full object-cover"}):e.jsx(Me,{className:"w-8 h-8",strokeWidth:2.5}),e.jsx("span",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition",style:{background:"rgba(14,26,20,0.55)"},children:A?e.jsx(I,{className:"w-5 h-5 animate-spin",style:{color:y.accent}}):e.jsx(Ge,{className:"w-5 h-5",style:{color:y.accent}})})]}),e.jsx("input",{ref:te,type:"file",accept:"image/*",className:"hidden",onChange:Se})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-lg font-bold leading-tight truncate",children:i||((Ye=a==null?void 0:a.email)==null?void 0:Ye.split("@")[0])||"Hosť"}),e.jsxs("p",{className:"text-xs flex items-center gap-1.5 truncate",style:{color:y.muted},children:[e.jsx(Le,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{className:"truncate",children:a==null?void 0:a.email})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1.5",children:[e.jsx("button",{type:"button",onClick:()=>{var C;return(C=te.current)==null?void 0:C.click()},disabled:A,className:"text-[11px] font-semibold uppercase tracking-wider disabled:opacity-50",style:{color:y.accent},children:r(A?"appProfile.uploading":k?"appProfile.changePhoto":"appProfile.uploadPhoto")}),k&&!A&&e.jsxs("button",{type:"button",onClick:Pe,className:"text-[11px] font-semibold uppercase tracking-wider inline-flex items-center gap-1",style:{color:y.muted},children:[e.jsx(Ct,{className:"w-3 h-3"}),r("appProfile.removePhoto")]})]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx($e,{label:r("appProfile.fullName"),children:e.jsx("input",{value:i,onChange:C=>
32u(C.target.value),placeholder:r("appProfile.fullNamePh"),className:"w-full rounded-xl px-3 py-2.5 text-sm outline-none focus:ring-2",style:{...me,"--tw-ring-color":y.accent}})}),e.jsx($e,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(rs,{className:"w-3.5 h-3.5"})," ",r("appProfile.phone")]}),children:e.jsx("input",{type:"tel",value:h,onChange:C=>x(C.target.value),placeholder:"+421 …",className:"w-full rounded-xl px-3 py-2.5 text-sm outline-none focus:ring-2",style:{...me,"--tw-ring-color":y.accent}})}),e.jsx($e,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ls,{className:"w-3.5 h-3.5"})," ",r("appProfile.birthDate")]}),hint:r("appProfile.birthHint"),children:e.jsx("input",{type:"date",value:g||"",onChange:C=>c(C.target.value),className:"w-full rounded-xl px-3 py-2.5 text-sm outline-none focus:ring-2",style:{...me,"--tw-ring-color":y.accent}})}),e.jsx($e,{label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Bt,{className:"w-3.5 h-3.5"})," ",r("appProfile.language")]}),children:e.jsx("select",{value:d,onChange:C=>f(C.target.value),className:"w-full rounded-xl px-3 py-2.5 text-sm outline-none focus:ring-2",style:{...me,"--tw-ring-color":y.accent},children:ea.map(C=>e.jsx("option",{value:C.code,style:{background:y.bg},children:C.label},C.code))})})]}),e.jsxs("div",{className:"space-y-2 mt-5",children:[e.jsx(pt,{icon:e.jsx(Fe,{className:"w-4 h-4"}),title:r("appProfile.communityVisible"),desc:r("appProfile.communityVisibleDesc"),checked:b,onChange:j}),e.jsx(pt,{icon:e.jsx(Ss,{className:"w-4 h-4"}),title:r("appProfile.marketing"),desc:r("appProfile.marketingDesc"),checked:p,onChange:$})]}),e.jsxs("button",{onClick:Dt,disabled:Y,className:"mt-5 w-full sm:w-auto inline-flex items-center justify-center gap-2 px-5 py-2.5 rounded-full font-bold text-sm transition disabled:opacity-60",style:{background:y.accent,color:y.bg},children:[Y?e.jsx(I,{className:"w-4 h-4 animate-spin"}):v?e.jsx(St,{className:"w-4 h-4"}):null,r(Y?"appProfile.saving":v?"appProfile.saved":"appProfile.save")]})]}),e.jsxs("section",{className:"rounded-[28px] border p-5 sm:p-6",style:{background:y.surface,borderColor:y.border},children:[e.jsxs("h3",{className:"text-base font-bold mb-1 flex items-center gap-2",children:[e.jsx(Ae,{className:"w-4 h-4",style:{color:y.accent}})," ",r("appProfile.passwordTitle")]}),e.jsx("p",{className:"text-xs mb-4",style:{color:y.muted},children:r("appProfile.passwordHint")}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:ye?"text":"password",value:T,onChange:C=>H(C.target.value),placeholder:r("appProfile.newPassword"),className:"w-full rounded-xl px-3 py-2.5 pr-10 text-sm outline-none focus:ring-2",style:{...me,"--tw-ring-color":y.accent}}),e.jsx("button",{type:"button",onClick:()=>_(C=>!C),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 opacity-70","aria-label":r("appProfile.showPassword"),children:ye?e.jsx(De,{className:"w-4 h-4"}):e.jsx(Fe,{className:"w-4 h-4"})})]}),e.jsx("input",{type:ye?"text":"password",value:se,onChange:C=>ae(C.target.value),placeholder:r("appProfile.repeatPassword"),className:"w-full rounded-xl px-3 py-2.5 text-sm outline-none focus:ring-2",style:{...me,"--tw-ring-color":y.accent}})]}),e.jsxs("button",{onClick:It,disabled:D||!T||!se,className:"mt-4 inline-flex items-center gap-2 px-4 py-2 rounded-full text-sm font-bold border transition disabled:opacity-50",style:{borderColor:y.accent,color:y.accent,background:"transparent"},children:[D?e.jsx(I,{className:"w-4 h-4 animate-spin"}):e.jsx(Ae,{className:"w-4 h-4"}),r("appProfile.changePassword")]})]}),F&&e.jsxs("section",{className:"rounded-[28px] border p-5 sm:p-6",style:{background:y.surface,borderColor:y.border},children:[e.jsxs("h3",{className:"text-base font-bold mb-1 flex items-center gap-2",children:[F==="admin"?e.jsx(ot,{className:"w-4 h-4",style:{color:y.accent}}):e.jsx(it,{className:"w-4 h-4",style:{color:y.accent}}),F==="admin"?"Owner prístup":"Staff prístup"]}),e.jsx("p",{className:"text-xs mb-4",style:{color:y.muted},children:F==="admin"?"Máte plný prístup do administrácie – guests, marketing, vernostný program, push notifikácie a viac.":"Máte prístup do staff panela – registrácia hostí, body, kupóny."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(R,{to:"/admin",className:"inline-flex items-center gap-2 px-4 py-2 rounded-full text-sm font-bold transition",style:{background:y.accent,color:y.bg},children:[F==="admin"?e.jsx(ot,{className:"w-4 h-4"}):e.jsx(it,{className:"w-4 h-4"}),"Prepnúť do ",F==="admin"?"Owner":"Staff"," panela"]}),F==="admin"&&e.jsxs(e.Fragment,{children:[e.jsx(R,{to:"/admin/guests",className:"inline-flex items-center gap-2 px-4 py-2 rounded-full text-sm font-bold border transition",style:{borderColor:y.accent,color:y.accent,background:"transparent"},children:"Hostia"}),e.jsx(R,{to:"/admin/marketing",className:"inline-flex items-center gap-2 px-4 py-2 rounded-full text-sm font-bold border transition",style:{borderColor:y.accent,color:y.accent,background:"transparent"},children:"Marketing"}),e.jsx(R,{to:"/admin/loyalty-points",className:"inline-flex items-center gap-2 px-4 py-2 rounded-full text-sm font-bold border transition",style:{borderColor:y.accent,color:y.accent,background:"transparent"},children:"Body"})]}),F==="staff"&&e.jsx(R,{to:"/admin/staff-guest-registration",className:"inline-flex items-center gap-2 px-4 py-2 rounded-full text-sm font-bold border transition",style:{borderColor:y.accent,color:y.accent,background:"transparent"},children:"Registrácia hosťa"})]})]}),e.jsx("section",{className:"rounded-[28px] border overflow-hidden",style:{background:y.surface,borderColor:y.border},children:e.jsx(sa,{to:"/komunita",label:r("appProfile.communityLink")})}),e.jsxs("button",{onClick:()=>s(),className:"w-full inline-flex items-center justify-center gap-2 px-5 py-3 rounded-2xl font-bold text-sm border transition",style:{borderColor:y.border,color:y.text,background:y.surface},children:[e.jsx(Pt,{className:"w-4 h-4"})," ",r("appProfile.signOut")]})]})}const $e=({label:t,hint:a,children:s})=>e.jsxs("label",{className:"block space-y-1.5",children:[e.jsx("span",{className:"text-[11px] uppercase tracking-widest font-bold",style:{color:y.muted},children:t}),s,a&&e.jsx("span",{className:"block text-[11px]",style:{color:y.muted},children:a})]}),pt=({icon:t,title:a,desc:s,checked:n,onChange:r})=>e.jsxs("button",{type:"button",onClick:()=>r(!n),className:"w-full flex items-center gap-3 px-4 py-3 rounded-2xl text-left transition",style:{background:y.bg,border:`1px solid ${y.border}`},children:[e.jsx("div",{className:"w-9 h-9 rounded-full flex items-center justify-center shrink-0",style:{background:y.surface,color:y.accent},children:t}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-bold leading-tight",children:a}),e.jsx("p",{className:"text-xs mt-0.5",style:{color:y.muted},children:s})]}),e.jsx("span",{className:"relative w-11 h-6 rounded-full shrink-0 transition",style:{background:n?y.accent:"rgba(245,239,227,0.15)"},children:e.jsx("span",{className:"absolute top-0.5 w-5 h-5 rounded-full transition-all",style:{background:n?y.bg:y.text,left:n?"calc(100% - 22px)":"2px"}})})]}),sa=({to:t,label:a})=>e.jsxs(R,{to:t,className:"flex items-center justify-between px-5 py-4 text-sm hover:opacity-80 transition",children:[e.jsx("span",{children:a}),e.jsx(de,{className:"w-4 h-4 opacity-60"})]});function aa({profile:t}){const[a,s]=m.useState(!1),n=async()=>{const r=t.referral_code||t.tatranska_pass_qr;r&&(await navigator.clipboard.writeText(r),s(!0),setTimeout(()=>s(!1),2e3))};return e.jsx(W,{className:"border-0 shadow-soft overflow-hidden",children:e.jsx(G,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"w-36 h-36 bg-white p-3 rounded-lg shadow-inner mb-4",children:t.tatranska_pass_qr?e.jsx(kt,{value:t.referral_code||t.tatranska_pass_qr,size:120,level:"M",includeMargin:!1}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:e.jsx(os,{className:"w-12 h-12 opacity-30"})})}),e.jsxs("div",{className:"text-center mb-4",children:[e.jsx("p",{className:"font-display font-semibold text-lg",children:t.full_name||"Člen Naši z Račkovej"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:Ve[t.loyalty_level]})]}),e.jsx("div",{className:"w-full p-3 bg-muted rounded-lg",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("code",{className:"text-sm font-mono text-muted-foreground truncate",children:t.referral_code||"Generujem..."}),e.jsx(Ne,{variant:"ghost",size:"icon",className:"shrink-0",onClick:n,children:a?e.jsx(Oe,{className:"w-4 h-4 text-emerald-600"}):e.jsx(Ze,{className:"w-4 h-4"})})]})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center mt-4",children:"Váš odporúčací kód — zdieľajte ho známym a získajte bonusové body za každého nového hosťa."})]})})})}function ra({limit:t=8,showHeader:a=!0}){const{t:s}=_t(),n=wt.slice(0,t);return e.jsxs("div",{className:"-mx-3 sm:-mx-4",children:[a&&e.jsxs("div",{className:"px-4 pb-3 flex items-center gap-2",children:[e.jsx(ns,{className:"w-5 h-5 text-primary"}),e.jsx("h3",{className:"text-lg font-semibold",children:"Blog"})]}),e.jsx("div",{className:"relative pb-1",style:{maskImage:"linear-gradient(to right, transparent, black 4%, black 96%, transparent)",WebkitMaskImage:"linear-gradient(to right, transparent, black 4%, black 96%, transparent)"},children:e.jsx("div",{className:"flex gap-3 px-4 overflow-x-auto snap-x snap-mandatory scroll-smooth",style:{scrollbarWidth:"none",WebkitOverflowScrolling:"touch",touchAction:"pan-x"},onWheel:r=>{const o=r.currentTarget;Math.abs(r.deltaY)>Math.abs(r.deltaX)&&(o.scrollLeft+=r.deltaY)},children:n.map(r=>e.jsxs(R,{to:`/blog/${r.slug}`,className:"shrink-0 w-56 snap-start rounded-xl overflow-hidden border bg-card text-card-foreground transition-transform active:scale-[0.98]",children:[e.jsx("img",{src:r.image,alt:s(r.titleKey,r.titleFallback),className:"w-full aspect-[16/10] object-cover",loading:"lazy"}),e.jsxs("div",{className:"p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[e.jsx("span",{className:"text-[10px] uppercase tracking-wide font-bold text-primary",children:r.category}),e.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[e.jsx(Qe,{className:"w-3 h-3"}),r.date]})]}),e.jsx("h3",{className:"font-semibold text-sm leading-snug line-clamp-2",children:s(r.titleKey,r.titleFallback)}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:s(r.excerptKey,r.excerptFallback)})]})]},r.id))})})]})}function la({userLevel:t,limit:a,showHeader:s=!0}
32){const{data:n=[],isLoading:r}=$s(t),o=a?n.slice(0,a):n;return r?e.jsxs(W,{children:[s&&e.jsx(J,{className:"pb-3",children:e.jsxs(ee,{className:"text-lg flex items-center gap-2",children:[e.jsx(Q,{className:"w-5 h-5 text-amber-500"}),"Špeciálne ponuky"]})}),e.jsx(G,{className:"space-y-4",children:[1,2].map(i=>e.jsxs("div",{className:"p-4 border rounded-xl",children:[e.jsx(ue,{className:"h-5 w-3/4 mb-2"}),e.jsx(ue,{className:"h-4 w-full mb-3"}),e.jsx(ue,{className:"h-8 w-24"})]},i))})]}):o.length===0?e.jsxs(W,{children:[s&&e.jsx(J,{className:"pb-3",children:e.jsxs(ee,{className:"text-lg flex items-center gap-2",children:[e.jsx(Q,{className:"w-5 h-5 text-amber-500"}),"Špeciálne ponuky"]})}),e.jsx(G,{children:e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(fe,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"Momentálne žiadne aktívne ponuky"}),e.jsx("p",{className:"text-sm mt-1",children:"Sledujte notifikácie pre nové ponuky"})]})})]}):e.jsxs(W,{children:[s&&e.jsx(J,{className:"pb-3",children:e.jsxs(ee,{className:"text-lg flex items-center gap-2",children:[e.jsx(Q,{className:"w-5 h-5 text-amber-500"}),"Špeciálne ponuky",o.length>0&&e.jsx(Ie,{variant:"outline",className:"ml-auto text-foreground text-sm px-3 py-0.5",children:"aktívne"})]})}),e.jsx(G,{className:"space-y-4",children:o.map(i=>e.jsx(oa,{offer:i},i.id))})]})}function na(t){const a=t.split(`
33`).map(r=>r.trim()).filter(Boolean),s=[],n=[];for(const r of a){const o=r.match(/^([\p{Emoji}\p{Emoji_Component}\u200d\ufe0f]+)\s*(.+)/u);if(o){const i=o[2].replace(/^[\s:]+/,"").trim();n.push({emoji:o[1],label:i})}else!r.startsWith("Čo potrebujete")&&!r.startsWith("What you need")&&s.push(r)}return{intro:s.join(" "),tags:n}}function oa({offer:t}){const[a,s]=m.useState(!1),{toast:n}=ge(),r=As(),{getTranslated:o}=is(),i=vt(),u=o(t,"description")||t.description,{intro:h,tags:x}=na(u),g=()=>{switch(t.discount_type){case"percentage":return`-${t.discount_value}%`;case"fixed":return`-${t.discount_value}€`;case"points_multiplier":return`${t.discount_value}x body`;default:return""}},c=()=>{switch(t.discount_type){case"points_multiplier":return e.jsx(Q,{className:"w-4 h-4"});default:return e.jsx(cs,{className:"w-4 h-4"})}},d=t.valid_until?Xe(new Date(t.valid_until),{locale:we}):null,f=async()=>{t.promo_code&&(await navigator.clipboard.writeText(t.promo_code),s(!0),n({title:"Kód skopírovaný!",description:`Promo kód ${t.promo_code} je v schránke`}),setTimeout(()=>s(!1),2e3))},b=async()=>{try{await r.mutateAsync({offerId:t.id}),n({title:"Ponuka uplatnená!",description:"Zľava bude aplikovaná pri vašej ďalšej rezervácii."})}catch{n({title:"Chyba",description:"Nepodarilo sa uplatniť ponuku",variant:"destructive"})}};return e.jsxs("div",{className:"relative overflow-hidden border rounded-xl bg-gradient-to-br from-amber-50/50 to-orange-50/30 dark:from-amber-950/20 dark:to-orange-950/10",children:[e.jsxs("div",{className:"absolute top-0 right-0 bg-gradient-to-br from-amber-500 to-orange-500 text-white px-3 py-1 rounded-bl-xl font-bold text-sm flex items-center gap-1",children:[c(),g()]}),e.jsxs("div",{className:"p-4 pt-3",children:[e.jsx("h3",{className:"font-semibold text-base pr-20 mb-1",children:o(t,"title")}),h&&e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:h}),x.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:x.map((j,p)=>e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-md bg-background border border-border text-muted-foreground",children:[e.jsx("span",{children:j.emoji}),e.jsx("span",{children:j.label})]},p))}),d&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground mb-3",children:[e.jsx(We,{className:"w-3.5 h-3.5"}),e.jsxs("span",{children:["Platí ešte ",d]})]}),e.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:t.promo_code?e.jsxs(e.Fragment,{children:[e.jsx(Ne,{variant:"outline",size:"sm",onClick:f,className:"gap-1.5 font-mono text-xs h-8",children:a?e.jsxs(e.Fragment,{children:[e.jsx(St,{className:"w-3.5 h-3.5 text-green-500"}
33),"Skopírované"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"w-3.5 h-3.5"}),t.promo_code]})}),e.jsxs(Ne,{size:"sm",variant:"default",className:"gap-1.5 text-xs h-8",onClick:()=>i("/rezervacia?property=sileo"),children:["Rezervovať",e.jsx(de,{className:"w-3.5 h-3.5"})]})]}):e.jsxs(Ne,{size:"sm",onClick:b,disabled:r.isPending,className:"gap-1.5 text-xs h-8",children:[e.jsx(fe,{className:"w-3.5 h-3.5"}),r.isPending?"Uplatňujem...":"Uplatniť ponuku"]})})]})]})}function ia(){const{isSupported:t,isSubscribed:a,isLoading:s,permission:n,subscribe:r,unsubscribe:o}=ps(),i=async u=>{u?await r()?je.success("Push notifikácie zapnuté",{description:"Budete dostávať upozornenia o nových ponukách a akciách."}):n==="denied"?je.error("Notifikácie sú zablokované",{description:"Povoľte notifikácie v nastaveniach prehliadača."}):je.error("Nepodarilo sa zapnúť notifikácie"):await o()?je.success("Push notifikácie vypnuté"):je.error("Nepodarilo sa vypnúť notifikácie")};return t?e.jsxs("div",{className:"flex items-center gap-3 p-4 bg-muted/50 rounded-lg",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:s?e.jsx(I,{className:"w-5 h-5 text-primary animate-spin"}):a?e.jsx(Be,{className:"w-5 h-5 text-primary"}):e.jsx(ct,{className:"w-5 h-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx(xs,{htmlFor:"push-toggle",className:"text-sm font-medium cursor-pointer",children:"Push notifikácie"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a?"Dostávate upozornenia o ponukách a akciách":"Zapnite pre okamžité upozornenia"})]}),e.jsx(us,{id:"push-toggle",checked:a,onCheckedChange:i,disabled:s})]}):e.jsxs("div",{className:"flex items-center gap-3 p-4 bg-muted/50 rounded-lg",children:[e.jsx(ct,{className:"w-5 h-5 text-muted-foreground"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Push notifikácie"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Váš prehliadač nepodporuje push notifikácie"})]})]})}const ca={stay:{icon:Ke,label:"Pobyt"},spending:{icon:Ke,label:"Útrata"},referral:{icon:zt,label:"Referral"},bonus:{icon:he,label:"Bonus"},redemption:{icon:fe,label:"Uplatnenie"},expired:{icon:We,label:"Expirácia"}};function da({transactions:t,isLoading:a}){return a?e.jsxs(W,{className:"border-0 shadow-soft",children:[e.jsx(J,{children:e.jsx(ee,{className:"text-lg font-display",children:"História bodov"})}),e.jsx(G,{children:e.jsx("div",{className:"space-y-4",children:[...Array(3)].map((s,n)=>e.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[e.jsx("div",{className:"w-10 h-10 bg-muted rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-1/2"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/3"})]}),e.jsx("div",{className:"h-5 bg-muted rounded w-16"})]},n))})})]}):t.length===0?e.jsxs(W,{className:"border-0 shadow-soft",children:[e.jsx(J,{children:e.jsx(ee,{className:"text-lg font-display",children:"História bodov"})}),e.jsx(G,{children:e.jsxs("div",{className:"text-center py-8",children:[e.jsx(Ke,{className:"w-12 h-12 text-muted-foreground/30 mx-auto mb-3",strokeWidth:1.5}),e.jsx("p",{className:"text-muted-foreground",children:"Zatiaľ nemáte žiadne bodové transakcie"}),e.jsx("p",{className:"text-sm text-muted-foreground/70 mt-1",children:"Body získate za pobyty a útratu"})]})})]}):e.jsxs(W,{className:"border-0 shadow-soft",children:[e.jsx(J,{children:e.jsx(ee,{className:"text-lg font-display",children:"História bodov"})}),e.jsx(G,{children:e.jsx("div",{className:"space-y-4",children:t.map(s=>{const r=ca[s.type].icon,o=s.points>0;return e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-lg hover:bg-muted/50 transition-colors",children:[e.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center bg-muted",children:e.jsx(r,{className:"w-5 h-5 text-muted-foreground",strokeWidth:1.5})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-foreground truncate",children:s.description}),e.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(s.created_at).toLocaleDateString("sk-SK",{day:"numeric",month:"long",year:"numeric"})})]}),e.jsxs("div",{className:`font-semibold tabular-nums ${o?"text-primary":"text-muted-foreground"}
33`,children:[o?"+":"",s.points.toLocaleString()]})]},s.id)})})})]})}const Re={bg:"#0E1A14",surface:"#16241C",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.2)"},xe=({children:t})=>e.jsx("h3",{className:"text-[11px] uppercase tracking-[0.18em] font-bold mb-3 px-1",style:{color:Re.accent},children:t}),pe=({children:t})=>e.jsx("div",{className:"dark rounded-[24px] p-3 sm:p-4 border",style:{background:Re.surface,borderColor:Re.border,"--background":"160 28% 9%","--card":"160 28% 11%","--card-foreground":"40 35% 92%","--foreground":"40 35% 92%","--muted":"160 22% 14%","--muted-foreground":"40 15% 65%","--border":"152 56% 28% / 0.25","--primary":"73 87% 62%","--primary-foreground":"160 28% 9%","--accent":"73 87% 62%","--accent-foreground":"160 28% 9%","--popover":"160 28% 11%","--popover-foreground":"40 35% 92%","--input":"160 22% 14%","--ring":"73 87% 62%",color:Re.text},children:t}),ma=({profile:t})=>t?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{children:[e.jsx(xe,{children:"Špeciálne ponuky"}),e.jsx(pe,{children:e.jsx(la,{userLevel:t.loyalty_level,limit:2,showHeader:!1})})]}),e.jsxs("section",{children:[e.jsx(xe,{children:"Blog"}),e.jsx(pe,{children:e.jsx(ra,{limit:5,showHeader:!1})})]})]}):null,ua=()=>{const{data:t=[],isLoading:a}=Zt(20);return e.jsxs("section",{children:[e.jsx(xe,{children:"História bodov"}),e.jsx(pe,{children:e.jsx(da,{transactions:t,isLoading:a})})]})},xa=({profile:t}={})=>e.jsxs("div",{className:"space-y-6",children:[t&&e.jsxs("section",{children:[e.jsx(xe,{children:"Račkova Pass"}),e.jsx(pe,{children:e.jsx(aa,{profile:t})})]}),e.jsxs("section",{"data-inbox-section":!0,children:[e.jsx(xe,{children:"Schránka správ"}),e.jsx(pe,{children:e.jsx(Fs,{showHeader:!1,compact:!0})})]}),e.jsxs("section",{children:[e.jsx(xe,{children:"Push notifikácie"}),e.jsx(pe,{children:e.jsx(ia,{})})]})]}),le={surface:"#16241C",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.25)"},pa={cold:"Chladno",ideal:"Ideálne na turistiku",moderate:"Mierna záťaž",high:"Vysoká záťaž",extreme:"Extrémna záťaž"},ha=()=>{const{current:t,loading:a}=hs(),s=(t==null?void 0:t.temp_c)??null,n=(t==null?void 0:t.humidity)??null,r=bs(s,n,(t==null?void 0:t.solar_wm2)??null,(t==null?void 0:t.wind_kmh)??null),o=r!==null?gs(r):null,i=(t==null?void 0:t.rain_mm_hour)??0;let u=fs,h="Turistika";return i>.2?(u=ys,h="Bar & herňa"):r!==null&&r>25?(u=js,h="Biojazierko"):s!==null&&s<5&&(u=vs,h="Horúca kaďa & sauna"),e.jsx(R,{to:"/app/pocasie",className:"block rounded-[24px] border p-4 transition-colors",style:{background:le.surface,borderColor:le.border,color:le.text},children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold",style:{color:le.muted},children:"Naša meteostanica · naživo"}),e.jsxs("div",{className:"mt-1 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-4xl font-extrabold leading-none",children:[a||s===null?"–":Math.round(s),"°"]}),o&&e.jsx("span",{className:"rounded-full px-2 py-0.5 text-[10px] font-semibold",style:{background:o.color,color:"#08110D"},children:pa[o.key]})]}),e.jsxs("p",{className:"mt-1.5 flex items-center gap-1.5 text-[12px]",style:{color:le.muted},children:[e.jsx(u,{className:"h-3.5 w-3.5",style:{color:le.accent}}),"Dnes odporúčame: ",e.jsx("span",{style:{color:le.text},className:"font-semibold",children:h})]})]}),e.jsx(de,{className:"h-5 w-5 shrink-0",style:{color:le.muted}})]})})},Tt=m.lazy(()=>jt(()=>import("./AttractionDialog-Bro8XtFm.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),l={bg:"#0E1A14",surface:"#16241C",emerald:"#1F6F4A",accent:"#C9F24A",text:"#F5EFE3",muted:"rgba(245,239,227,0.55)",border:"rgba(31,111,74,0.2)"},ba={explorer:"Explorer",adventurer:"Adventurer",mountaineer:"Mountaineer",legend:"Legend"},rl=()=>{var f;const{user:t,loading:a}=U(),{data:s}=Nt(),{data:n=0}
33=Ft(),[r,o]=m.useState("home"),[i,u]=m.useState(!1),[h,x]=Ut();m.useEffect(()=>{const b=h.get("tab");if(b&&["home","objavuj","pobyty","komunita","profil"].includes(b)){o(b);const j=new URLSearchParams(h);j.delete("tab"),x(j,{replace:!0})}},[]),m.useEffect(()=>{const b="zorja-app-fonts";if(document.getElementById(b))return;const j=document.createElement("link");j.id=b,j.rel="stylesheet",j.href="https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700;800&family=Figtree:wght@400;500;600&display=swap",document.head.appendChild(j)},[]);const g=((s==null?void 0:s.full_name)||((f=t==null?void 0:t.email)==null?void 0:f.split("@")[0])||"Hosť").split(" ")[0],c=(s==null?void 0:s.available_points)??0,d=s!=null&&s.loyalty_level?ba[s.loyalty_level]||s.loyalty_level:"Explorer";return e.jsxs(e.Fragment,{children:[e.jsxs(Vt,{children:[e.jsx("title",{children:"Naši z Račkovej — Penzión Sileo & Villa Drosera"}),e.jsx("meta",{name:"robots",content:"noindex,nofollow"}),e.jsx("meta",{name:"theme-color",content:l.bg})]}),e.jsx("style",{children:`
34        .zorja-app { font-family: 'Figtree', system-ui, sans-serif; }
35        .zorja-app h1, .zorja-app h2, .zorja-app h3, .zorja-app .font-display {
36          font-family: 'Outfit', sans-serif;
37        }
38        .zorja-app input { font-family: inherit; }
39        .zorja-app::-webkit-scrollbar { display: none; }
40      `}),e.jsxs("div",{className:"zorja-app min-h-screen flex items-start justify-center lg:items-stretch lg:justify-stretch",style:{background:"#070D0A",color:l.text},children:[e.jsx(_a,{tab:r,onTab:o,firstName:g,points:c,isAuthed:!!t,unread:n}),e.jsxs("div",{className:`
41            w-full min-h-screen flex flex-col relative
42            sm:max-w-[420px] sm:min-h-0 sm:rounded-[48px] sm:overflow-hidden sm:shadow-2xl sm:my-8 sm:border-8
43            lg:max-w-none lg:min-h-screen lg:rounded-none lg:overflow-visible lg:shadow-none lg:my-0 lg:border-0 lg:flex-1
44          `,style:{background:l.bg,borderColor:l.surface},children:[e.jsx(va,{firstName:g,points:c,isAuthed:!!t,unread:n,onSearch:()=>u(!0),onBell:()=>{o("profil"),setTimeout(()=>{var b;(b=document.querySelector("[data-inbox-section]"))==null||b.scrollIntoView({behavior:"smooth",block:"start"})},100)}}),i&&e.jsx(wa,{onClose:()=>u(!1),onPickTab:b=>{o(b),u(!1)}}),e.jsxs("main",{className:"flex-1 px-4 pt-3 pb-28 lg:pb-12 lg:px-10 lg:max-w-6xl lg:mx-auto lg:w-full relative",children:[e.jsx("img",{src:"/assets/rackova-stamp-biela.webp",alt:"","aria-hidden":"true",className:"hidden lg:block pointer-events-none select-none fixed bottom-6 right-6 w-32 h-32 object-contain",style:{opacity:.06,zIndex:0}}),a?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx(I,{className:"w-6 h-6 animate-spin",style:{color:l.accent}})}):e.jsx(ga,{tab:r,isAuthed:!!t,profile:s,firstName:g,points:c,level:d})]}),e.jsx(La,{tab:r,onTab:o,unread:n})]})]})]})},ga=({tab:t,isAuthed:a,profile:s,firstName:n,points:r,level:o})=>t==="objavuj"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(ft,{inlineDetail:!0}),e.jsxs("div",{className:"space-y-4 lg:grid lg:grid-cols-2 lg:gap-6 lg:space-y-0",children:[e.jsx(yt,{}),e.jsx(Ea,{})]})]}):t==="pobyty"?e.jsxs("div",{className:"space-y-6",children:[e.jsx(ya,{profile:s,level:o,points:r}),a&&e.jsx(ua,{})]}):t==="komunita"?e.jsx(Js,{}):t==="profil"?e.jsxs("div",{className:"space-y-6",children:[e.jsx(ta,{profile:s}),a&&e.jsx(xa,{profile:s})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"space-y-4 lg:grid lg:grid-cols-2 lg:gap-6 lg:space-y-0",children:a?e.jsxs(e.Fragment,{children:[e.jsx(za,{firstName:n,points:r,level:o,profile:s}),e.jsx(ft,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ca,{}),e.jsx(yt,{})]})}),e.jsx(ha,{}),a&&e.jsx(ma,{profile:s})]}),fa=({level:t,points:a,totalPoints:s,profileLevelKey:n})=>{const r=Gt(n),o=r?Math.max(0,Qt[r]-s):0;return e.jsx("div",{className:"space-y-4",children:e.jsxs("article",{className:"rounded-[28px] border overflow-hidden",style:{background:l.surface,borderColor:l.border},children:[e.jsxs("div",{className:"relative h-32",children:[e.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:"url('https://htuyfkimeicdotpaalum.supabase.co/storage/v1/object/public/gallery/activities/rackove-plesa.jpg')"}}),e.jsx("div",{className:"absolute inset-0",style:{background:`linear-gradient(180deg, rgba(14,26,20,0.45) 0%, ${l.surface} 100%)`}}),e.jsxs("div",{className:"absolute bottom-4 left-5 right-5 flex items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold mb-1",style:{color:l.accent},children:"Tvoj level"}),e.jsx("h3",{className:"text-2xl font-bold leading-tight",children:t})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold",style:{color:l.muted},children:"Body"}),e.jsx("p",{className:"text-xl font-bold font-mono",style:{color:l.accent},children:a})]})]})]}),r&&e.jsx("div",{className:"px-5 pt-4",children:e.jsxs("div",{className:"rounded-2xl px-4 py-3 text-sm",style:{background:l.bg,border:`1px solid ${l.accent}30`},children:["Chýba ti ",e.jsx("span",{className:"font-bold font-mono",style:{color:l.accent}
44,children:o.toLocaleString("sk-SK")})," bodov do úrovne ",e.jsx("span",{className:"font-bold",children:Ve[r]}),"."]})}),e.jsx("div",{className:"px-5 py-1"})]})})},ya=({profile:t,level:a,points:s})=>{const{toast:n}=ge(),{data:r=[],isLoading:o}=He(),i=Wt(),u=(t==null?void 0:t.loyalty_level)||"explorer",h=(t==null?void 0:t.total_points)??s,x=(t==null?void 0:t.available_points)??s,g=async c=>{if(x<c.points_cost){n({title:"Nedostatok bodov",description:`Chýba ti ešte ${c.points_cost-x} bodov.`,variant:"destructive"});return}try{await i.mutateAsync({rewardId:c.id,pointsCost:c.points_cost}),n({title:"Odmena uplatnená!",description:`${c.name} — kupón nájdeš nižšie s QR kódom.`})}catch{n({title:"Chyba",description:"Nepodarilo sa uplatniť odmenu.",variant:"destructive"})}};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(fa,{level:a,points:x,totalPoints:h,profileLevelKey:u}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-lg font-bold mb-3 px-1",children:"Katalóg odmien"}),e.jsx(ja,{rewards:r,availablePoints:x,userLevel:u,onRedeem:g,isLoading:o,isPending:i.isPending})]}),e.jsx("section",{children:e.jsx(zs,{rewards:r.map(c=>({id:c.id,name:c.name}))})})]})},ht=["explorer","adventurer","mountaineer","legend"],ja=({rewards:t,availablePoints:a,userLevel:s,onRedeem:n,isLoading:r,isPending:o})=>r?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(i=>e.jsx("div",{className:"rounded-2xl h-28 animate-pulse",style:{background:l.surface,border:`1px solid ${l.border}`}},i))}):t.length?e.jsx("div",{className:"space-y-3",children:t.map(i=>{const u=ht.indexOf(s),h=ht.indexOf(i.min_level),x=u>=h,g=a>=i.points_cost,c=x&&g&&!o;return e.jsxs("article",{className:"rounded-2xl overflow-hidden flex",style:{background:l.surface,border:`1px solid ${l.border}`},children:[e.jsx("div",{className:"w-28 sm:w-32 shrink-0 relative",style:{background:l.bg},children:i.image_url?e.jsx("img",{src:i.image_url,alt:i.name,loading:"lazy",className:"absolute inset-0 w-full h-full object-cover"}):e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(fe,{className:"w-7 h-7",style:{color:l.accent}})})}),e.jsxs("div",{className:"flex-1 min-w-0 p-3 sm:p-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h4",{className:"text-sm sm:text-base font-bold leading-tight",children:i.name}),i.description&&e.jsx("p",{className:"text-xs mt-1 line-clamp-2",style:{color:l.muted},children:i.description})]}),e.jsxs("div",{className:"flex items-end justify-between gap-2 mt-auto",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-mono font-bold text-base sm:text-lg",style:{color:l.accent},children:[i.points_cost.toLocaleString("sk-SK"),e.jsx("span",{className:"text-[10px] font-sans font-normal ml-1",style:{color:l.muted},children:"bodov"})]}),i.min_level!=="explorer"&&!x&&e.jsxs("p",{className:"text-[10px] mt-0.5",style:{color:l.muted},children:["od úrovne ",Ve[i.min_level]]})]}),e.jsx("button",{onClick:()=>n(i),disabled:!c,className:"text-xs font-bold px-3 py-2 rounded-full whitespace-nowrap transition",style:{background:c?l.accent:"transparent",color:c?l.bg:l.muted,border:c?"none":`1px solid ${l.border}`,opacity:c?1:.7,cursor:c?"pointer":"not-allowed"},children:x?g?"Uplatniť":"Málo bodov":"Zamknuté"})]})]})]},i.id)})}):e.jsx("div",{className:"rounded-2xl p-6 text-center text-sm",style:{background:l.surface,color:l.muted,border:`1px solid ${l.border}`},children:"Momentálne nie sú k dispozícii žiadne odmeny."}),va=({firstName:t,points:a,isAuthed:s,unread:n,onSearch:r,onBell:o})=>e.jsxs("header",{className:"h-[64px] px-5 lg:px-10 flex items-center justify-between shrink-0 border-b lg:hidden",style:{borderColor:l.border},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:"/assets/rackova-stamp-biela.webp",alt:"Naši z Račkovej",width:36,height:36,className:"w-9 h-9 object-contain shrink-0",style:{filter:`drop-shadow(0 0 8px ${l.accent}40)`}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold",style:{color:l.muted},children:s?"Vitajte":"Račková"}),e.jsx("h2",{className:"text-sm font-bold leading-tight -mt-0.5",children:s?t:"Naši z Račkovej"})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[s&&e.jsx("div",{className:"px-2.5 py-1 rounded-full border flex items-center",style:{background:"rgba(31,111,74,0.2)",borderColor:"rgba(31,111,74,0.3)"},children:e.jsxs("span",{className:"text-[11px] font-bold font-mono",style:{color:l.accent}
44,children:[a.toLocaleString("sk-SK")," b"]})}),e.jsx("button",{"aria-label":"Hľadať",onClick:r,className:"p-2 opacity-80",children:e.jsx($t,{className:"w-5 h-5",strokeWidth:2.5})}),e.jsxs("button",{"aria-label":"Notifikácie",onClick:o,className:"relative p-2 opacity-80",children:[e.jsx(Be,{className:"w-5 h-5",strokeWidth:2.5}),n>0&&e.jsx("span",{className:"absolute top-1.5 right-1.5 w-2 h-2 rounded-full",style:{background:l.accent}})]})]})]}),Na=[{title:"Penzión Sileo",desc:"Ubytovanie v Račkovej doline",to:"/sileo",keywords:"sileo penzion ubytovanie rackova"},{title:"Villa Drosera",desc:"Living lounge a wellness",to:"/drosera",keywords:"drosera villa wellness lounge"},{title:"Rezervácia",desc:"Online rezervácia pobytu",to:"/rezervacia",keywords:"rezervacia booking previo termin"},{title:"Cenník",desc:"Aktuálne ceny pobytov",to:"/cennik",keywords:"cennik cena price pobyt"},{title:"Aktivity v Liptove",desc:"Tipy na výlety a zážitky",to:"/aktivity",keywords:"aktivity vylet liptov turistika"},{title:"Rodiny s deťmi",desc:"Kam s deťmi v Liptove a Tatrách",to:"/rodiny",keywords:"rodiny deti family tatry liptov"},{title:"Firemné eventy",desc:"Teambuildingy a firemné akcie",to:"/firemne-eventy",keywords:"firemne eventy teambuilding firma"},{title:"Svadby",desc:"Svadby v horskom prostredí",to:"/svadby",keywords:"svadba wedding hostina obrad"},{title:"Blog",desc:"Príbehy z Račkovej doliny",to:"/blog",keywords:"blog clanky novinky"},{title:"Galéria",desc:"Fotografie a videá",to:"/galeria",keywords:"galeria foto video"},{title:"Kontakt",desc:"Spojte sa s nami",to:"/kontakt",keywords:"kontakt telefon email adresa"},{title:"Drevuliaci",desc:"Sochy v Račkovej doline",to:"/drevuliaci",keywords:"drevuliaci sochy umenie"}],ka=[{tab:"home",title:"Domov",desc:"Prehľad bodov, mapa, novinky",keywords:"domov dashboard prehlad mapa novinky body"},{tab:"objavuj",title:"Objavuj",desc:"Tipy, atrakcie, blog z Liptova",keywords:"objavuj atrakcie tipy blog liptov rackova"},{tab:"pobyty",title:"Odmeny",desc:"Kupóny, vernostné odmeny, špeciálne ponuky",keywords:"odmeny kupony rewards pobyty ponuky vernost zlavy"},{tab:"komunita",title:"Komunita",desc:"Naši z Račkovej, pridaj tip alebo atrakciu",keywords:"komunita community tipy atrakcia pridaj"},{tab:"profil",title:"Profil",desc:"Účet, notifikácie, história, jazyk",keywords:"profil ucet nastavenia notifikacie historia jazyk fotka"}],wa=({onClose:t,onPickTab:a})=>{const[s,n]=m.useState(""),r=vt(),{data:o=[]}=He(),i=d=>d.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,""),u=d=>{t(),r(d)},h=m.useMemo(()=>{const d=ka.map(p=>({id:`tab-${p.tab}`,group:"Sekcie apky",title:p.title,desc:p.desc,haystack:i(`${p.title} ${p.desc} ${p.keywords}`),onSelect:()=>a(p.tab)})),f=Na.map(p=>({id:`page-${p.to}`,group:"Stránky",title:p.title,desc:p.desc,haystack:i(`${p.title} ${p.desc} ${p.keywords}`),onSelect:()=>u(p.to)})),b=wt.map(p=>({id:`blog-${p.slug}`,group:"Blog",title:p.titleFallback||p.titleKey||p.slug,desc:p.excerptFallback||p.category||"",haystack:i(`${p.titleFallback||""} ${p.excerptFallback||""} ${p.category||""} ${p.slug}`),onSelect:()=>u(`/blog/${p.slug}`)})),j=(o||[]).map(p=>({id:`reward-${p.id}`,group:"Odmeny",title:p.title||p.name||"Odmena",desc:`${p.cost??p.points??""} bodov`,haystack:i(`${p.title||""} ${p.name||""} ${p.description||""}`),onSelect:()=>a("pobyty")}));return[...d,...f,...b,...j]},[o]),x=i(s.trim()),g=x?h.filter(d=>x.split(/\s+/).every(f=>d.haystack.includes(f))).slice(0,30):h.slice(0,12),c=g.reduce((d,f)=>{var b;return(d[b=f.group]||(d[b]=[])).push(f),d},{});return e.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-16 px-4 lg:pt-24",style:{background:"rgba(7,13,10,0.85)",backdropFilter:"blur(8px)"},onClick:t,children:e.jsxs("div",{className:"w-full max-w-lg rounded-3xl border overflow-hidden",style:{background:l.surface,borderColor:l.border},onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 border-b",style:{borderColor:l.border},children:[e.jsx($t,{className:"w-5 h-5 shrink-0",style:{color:l.accent},strokeWidth:2.5}),e.jsx("input",{autoFocus:!0,value:s,onChange:d=>n(d.target.value),placeholder:"Hľadať stránky, blog, odmeny…",className:"flex-1 bg-transparent outline-none text-sm",style:{color:l.text}}),e.jsx("button",{onClick:t,"aria-label":"Zavrieť",className:"p-1 o
44pacity-70 hover:opacity-100",children:e.jsx(ke,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"max-h-[65vh] overflow-y-auto py-2",children:g.length===0?e.jsx("p",{className:"px-4 py-6 text-sm text-center",style:{color:l.muted},children:"Nič nenájdené"}):Object.entries(c).map(([d,f])=>e.jsxs("div",{className:"py-1",children:[e.jsx("div",{className:"px-4 py-1.5 text-[10px] uppercase tracking-wider font-bold",style:{color:l.muted},children:d}),f.map(b=>e.jsxs("button",{onClick:b.onSelect,className:"w-full text-left px-4 py-2.5 hover:bg-white/5 transition flex flex-col",children:[e.jsx("span",{className:"text-sm font-semibold",style:{color:l.text},children:b.title}),b.desc&&e.jsx("span",{className:"text-xs mt-0.5 line-clamp-1",style:{color:l.muted},children:b.desc})]},b.id))]},d))})]})})},_a=({tab:t,onTab:a,firstName:s,points:n,isAuthed:r,unread:o})=>{const{signOut:i}=U(),u=[{id:"home",icon:e.jsx(Et,{className:"w-5 h-5"}),label:"Domov"},{id:"objavuj",icon:e.jsx(Lt,{className:"w-5 h-5"}),label:"Objavuj"},{id:"pobyty",icon:e.jsx(Rt,{className:"w-5 h-5"}),label:"Odmeny"},{id:"komunita",icon:e.jsx(Q,{className:"w-5 h-5"}),label:"Komunita"},{id:"profil",icon:e.jsx(Me,{className:"w-5 h-5"}),label:"Profil"}];return e.jsxs("aside",{className:"hidden lg:flex flex-col w-72 shrink-0 border-r p-6",style:{background:l.bg,borderColor:l.border},children:[e.jsxs(R,{to:"/",className:"flex items-center gap-3 mb-10",children:[e.jsx("img",{src:"/assets/rackova-stamp-biela.webp",alt:"Naši z Račkovej — pečiatka",width:44,height:44,className:"w-11 h-11 object-contain shrink-0",style:{filter:`drop-shadow(0 0 12px ${l.accent}33)`}}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold",style:{color:l.muted},children:"Račková"}),e.jsx("h2",{className:"font-bold text-sm leading-tight",children:"Naši z Račkovej"})]})]}),r&&e.jsxs("div",{className:"rounded-2xl p-4 mb-6 border",style:{background:l.surface,borderColor:l.border},children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold mb-1",style:{color:l.muted},children:"Vitajte späť"}),e.jsx("p",{className:"font-bold text-base mb-2",children:s}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{className:"w-3.5 h-3.5",style:{color:l.accent}}),e.jsxs("span",{className:"font-mono font-bold text-sm",style:{color:l.accent},children:[n.toLocaleString("sk-SK")," b"]})]})]}),e.jsx("nav",{className:"flex-1 space-y-1",children:u.map(h=>{const x=t===h.id;return e.jsxs("button",{onClick:()=>a(h.id),className:"w-full flex items-center gap-3 px-4 py-3 rounded-xl text-left transition-colors",style:{background:x?"rgba(201,242,74,0.12)":"transparent",color:x?l.accent:l.text,opacity:x?1:.7},children:[h.icon,e.jsx("span",{className:"text-sm font-semibold",children:h.label}),h.id==="profil"&&o>0&&e.jsx("span",{className:"ml-auto text-[9px] font-bold px-1.5 py-0.5 rounded-full",style:{background:l.accent,color:l.bg},children:o})]},h.id)})}),r&&e.jsxs("button",{onClick:()=>i(),className:"flex items-center gap-3 px-4 py-3 rounded-xl text-sm opacity-60 hover:opacity-100",children:[e.jsx(Pt,{className:"w-4 h-4"}),"Odhlásiť sa"]})]})},Ca=()=>{const{signIn:t}=U(),{toast:a}=ge(),[s,n]=m.useState(""),[r,o]=m.useState(""),[i,u]=m.useState(!1),[h,x]=m.useState(!1),g=async c=>{if(c.preventDefault(),!s||!r)return;x(!0);const{error:d}=await t(s,r);x(!1),a(d?{title:"Prihlásenie zlyhalo",description:d.message,variant:"destructive"}:{title:"Vitaj späť!"})};return e.jsxs("article",{className:"relative rounded-[28px] overflow-hidden border lg:rounded-3xl",style:{background:l.surface,borderColor:l.border},children:[e.jsxs("div",{className:"relative h-72 lg:h-80",children:[e.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:"url('https://htuyfkimeicdotpaalum.supabase.co/storage/v1/object/public/gallery/activities/rackove-plesa.jpg')"},role:"img","aria-label":"Račkové plesá — horské jazero v Západných Tatrách"}),e.jsx("div",{className:"absolute inset-0",style:{background:`linear-gradient(180deg, rgba(14,26,20,0.15) 0%, rgba(14,26,20,0.55) 65%, ${l.surface} 100%)`}}),e.jsxs("div",{className:"absolute bottom-5 left-5 right-5 flex items-end justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1.5",style:{color:"rgba(245,239,227,0.75)"},children:"Dýchaj. Si doma."}),e.jsxs("h3",{className:"text-[26px] font-bold leading-[1.1]",children:["Hory ťa už",e.jsx("br",{}),"čakajú."]}),e.jsxs("p",{className:"mt-2 text-[12px] font-semibold leading-tight",style:{color:"rgba(245,239,227,0.92)"},children:["Naši z Račkovej",e.jsx("br",{}),e.jsx("span",{style:{color:"rgba(245,239,227,0.7)",fontWeight:500},children:"Penzión Sileo & Villa Drosera"})]})]}),e.jsxs("svg",{viewBox:"0 0 512 512",role:"img","aria-label":"Naši z Račkovej",className:"w-[120px] h-[120px] shrink-0 rotate-[-6deg] pointer-events-none",style:{opacity:.7},children:[e.jsx("title",{children:"Naši z Račkovej"}),e.jsx("defs",{children:e.jsx("filter",{id:"rackova-white-stamp",colorInterpolationFilters:"sRGB",children:e.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  -0.2126 -0.7152 -0.0722 0 1"})})}),e.jsx("image",{href:"/pwa-512x512-maskable.png",width:"512",height:"512",preserveAspectRatio:"xMidYMid meet",filter:"url
44(#rackova-white-stamp)"})]})]})]}),e.jsxs("form",{onSubmit:g,className:"px-5 pb-5 pt-1 flex flex-col gap-2.5",children:[e.jsx(bt,{icon:e.jsx(Me,{className:"w-4 h-4 opacity-60"}),children:e.jsx("input",{type:"email",autoComplete:"email",placeholder:"Email",value:s,onChange:c=>n(c.target.value),className:"bg-transparent flex-1 outline-none text-sm placeholder:opacity-60",style:{color:l.text},required:!0})}),e.jsx(bt,{icon:i?e.jsx(Fe,{className:"w-4 h-4 opacity-60"}):e.jsx(De,{className:"w-4 h-4 opacity-60"}),right:e.jsx("button",{type:"button",onClick:()=>u(c=>!c),className:"opacity-60 hover:opacity-100","aria-label":"Zobraziť heslo",children:i?e.jsx(De,{className:"w-4 h-4"}):e.jsx(Fe,{className:"w-4 h-4"})}),children:e.jsx("input",{type:i?"text":"password",autoComplete:"current-password",placeholder:"Heslo",value:r,onChange:c=>o(c.target.value),className:"bg-transparent flex-1 outline-none text-sm placeholder:opacity-60",style:{color:l.text},required:!0})}),e.jsxs("button",{type:"submit",disabled:h,className:"mt-1 py-3 rounded-2xl font-bold text-sm tracking-wide flex items-center justify-center gap-2 disabled:opacity-60",style:{background:l.accent,color:l.bg},children:[h&&e.jsx(I,{className:"w-4 h-4 animate-spin"}),"PRIHLÁSIŤ SA"]}),e.jsxs("p",{className:"text-center text-xs mt-1",style:{color:l.muted},children:["Nemáš účet?"," ",e.jsx(R,{to:"/prihlasenie",className:"font-semibold",style:{color:l.accent},children:"Registruj sa"})]})]})]})},bt=({icon:t,children:a,right:s})=>e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 rounded-2xl",style:{background:l.bg},children:[t,a,s&&e.jsx("span",{className:"ml-auto",children:s})]}),gt=["explorer","adventurer","mountaineer","legend"];function Ot(){return X({queryKey:["app-attractions"],queryFn:async()=>{const{data:t,error:a}=await z.from("attractions").select("name,short,category,duration,distance_km,mode,image_url,lat,lng,color").eq("is_active",!0).order("sort_order",{ascending:!0});if(a)throw a;return(t||[]).map(s=>({name:s.name,category:s.category||"Tip",distanceKm:Number(s.distance_km)||0,duration:s.duration||"",short:s.short,image:s.image_url||"",coords:{lat:Number(s.lat),lng:Number(s.lng)},mode:s.mode==="car"?"car":"foot",color:s.color||null}))},staleTime:5*60*1e3})}function Sa(t){return X({queryKey:["app-active-offer",t],queryFn:async()=>{const a=new Date().toISOString(),{data:s,error:n}=await z.from("special_offers").select("id, title, description, discount_type, discount_value, promo_code, valid_until, target_levels").eq("is_active",!0).lte("valid_from",a).or(`valid_until.is.null,valid_until.gt.${a}`).order("created_at",{ascending:!1}).limit(10);if(n)throw n;return(s||[]).find(r=>!r.target_levels||r.target_levels.includes(t))||null}})}const Pa=({profile:t})=>{const a=(t==null?void 0:t.loyalty_level)||"explorer",s=(t==null?void 0:t.available_points)??0,{data:n=[]}=He(),{data:r}=Sa(a),{data:o=[]}=Ot(),i=gt.indexOf(a),u=m.useMemo(()=>{const c=n.filter(b=>gt.indexOf(b.min_level)<=i),d=c.filter(b=>b.points_cost>s).sort((b,j)=>b.points_cost-s-(j.points_cost-s))[0];if(d)return{reward:d,affordable:!1};const f=c.sort((b,j)=>b.points_cost-j.points_cost)[0];return f?{reward:f,affordable:!0}:null},[n,s,i]),[h,x]=m.useState(null),g=r?r.discount_type==="percentage"?`-${Number(r.discount_value)} %`:`-${Number(r.discount_value)} €`:null;return e.jsxs(e.Fragment,{children:[u&&e.jsx(R,{to:"/app",className:"block rounded-2xl p-4 border",style:{background:l.bg,borderColor:l.border},children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl shrink-0 flex items-center justify-center overflow-hidden",style:{background:`${l.accent}22`},children:u.reward.image_url?e.jsx("img",{src:u.reward.image_url,alt:"",className:"w-full h-full object-cover"}):e.jsx(fe,{className:"w-5 h-5",style:{color:l.accent}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold",style:{color:l.accent},children:u.affordable?"Môžeš uplatniť":"Odmena na dosah"}),e.jsx("p",{className:"text-sm font-semibold truncate",children:u.reward.name}),u.affordable?e.jsxs("p",{className:"text-[11px] mt-0.5",style:{color:l.muted}
44,children:["Máš ",s.toLocaleString("sk-SK")," / ",u.reward.points_cost.toLocaleString("sk-SK")," bodov"]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-1.5 h-1 rounded-full overflow-hidden",style:{background:l.border},children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(100,s/u.reward.points_cost*100)}%`,background:l.accent}})}),e.jsxs("p",{className:"text-[11px] mt-1",style:{color:l.muted},children:["EÅ¡te ",e.jsxs("span",{style:{color:l.text},children:[(u.reward.points_cost-s).toLocaleString("sk-SK")," bodov"]})]})]})]}),e.jsx(de,{className:"w-4 h-4 opacity-60 shrink-0"})]})}),r&&e.jsx(R,{to:r.promo_code?`/rezervacia?promo=${encodeURIComponent(r.promo_code)}`:"/rezervacia",className:"block rounded-2xl p-4 border",style:{background:`linear-gradient(135deg, ${l.accent}18, ${l.bg})`,borderColor:`${l.accent}55`},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl shrink-0 flex items-center justify-center",style:{background:l.accent,color:l.bg},children:e.jsx(ks,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold",style:{color:l.accent},children:"Ponuka pre teba"}),g&&e.jsx("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded",style:{background:l.accent,color:l.bg},children:g})]}),e.jsx("p",{className:"text-sm font-semibold truncate",children:r.title}),e.jsx("p",{className:"text-[11px] line-clamp-1",style:{color:l.muted},children:r.description})]}),e.jsx(de,{className:"w-4 h-4 opacity-60 shrink-0"})]})}),e.jsxs("div",{className:"rounded-2xl border overflow-hidden",style:{background:l.bg,borderColor:l.border},children:[e.jsx("div",{className:"px-4 pt-3 pb-2",children:e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold",style:{color:l.muted},children:"InÅ¡pirácia z Račkovej"})}),e.jsx("div",{className:"relative pb-4",style:{maskImage:"linear-gradient(to right, transparent, black 4%, black 96%, transparent)",WebkitMaskImage:"linear-gradient(to right, transparent, black 4%, black 96%, transparent)"},children:e.jsx("div",{className:"flex gap-3 px-4 overflow-x-auto snap-x snap-mandatory scroll-smooth",style:{scrollbarWidth:"none",WebkitOverflowScrolling:"touch",touchAction:"pan-x"},onWheel:c=>{const d=c.currentTarget;Math.abs(c.deltaY)>Math.abs(c.deltaX)&&(d.scrollLeft+=c.deltaY)},children:o.map((c,d)=>e.jsxs("button",{type:"button",onClick:()=>x(c),className:"shrink-0 w-44 snap-start rounded-xl overflow-hidden border text-left transition-transform active:scale-[0.98]",style:{background:l.surface,borderColor:l.border,color:l.text},children:[e.jsxs("div",{className:"h-24 bg-cover bg-center relative",style:c.image?{backgroundImage:`url('${c.image}')`}:{background:`linear-gradient(135deg, ${qe(c.category,c.color)}22, ${l.bg})`},children:[!c.image&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(ce,{className:"w-6 h-6",style:{color:qe(c.category,c.color)}})}),e.jsxs("span",{className:"absolute bottom-1.5 right-1.5 inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-bold",style:{background:"rgba(0,0,0,0.65)",color:l.accent},children:[e.jsx(ce,{className:"w-2.5 h-2.5"}),c.distanceKm<1?`${Math.round(c.distanceKm*1e3)} m`:`${c.distanceKm} km`]})]}),e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-xs font-bold leading-tight truncate",children:c.name}),e.jsxs("p",{className:"text-[10px] mt-0.5",style:{color:l.muted},children:[c.category," · ",c.duration]}),e.jsx("p",{className:"text-[10px] mt-1 line-clamp-2",style:{color:l.muted},children:c.short})]})]},`${c.name}-${d}`))})})]}),e.jsx(m.Suspense,{fallback:null,children:e.jsx(Tt,{attraction:h,onClose:()=>x(null)})})]})},za=({firstName:t,points:a,level:s,profile:n})=>e.jsxs("article",{className:"rounded-[28px] overflow-hidden border",style:{background:l.surface,borderColor:l.border},children:[e.jsxs("div",{className:"relative h-44",children:[e.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:"url('https://htuyfkimeicdotpaalum.supabase.co/storage/v1/object/public/gallery/activities/rackove-plesa.jpg')"}}),e.jsx("div",{className:"absolute inset-0",style:{background:`linear-gradient(180deg, rgba(14,26,20,0.4) 0%, ${l.surface} 100%)`}}),e.jsxs("div",{className:"absolute bottom-4 left-5 right-5",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold mb-1",style:{color:l.accent},children:s}),e.jsxs("h3",{className:"text-2xl font-bold leading-tight",children:["Vitaj späť, ",t,"."]})]})]}),e.jsxs("div",{className:"px-5 py-5 space-y-3",children:[e.jsx(Pa,{profile:n}),e.jsxs("div",{className:"rounded-2xl p-4 flex items-center gap-3 border",style:{background:l.bg,borderColor:l.border},children:[e.jsx(Qe,{className:"w-5 h-5 shrink-0",style:{color:l.accent}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold",children:"Žiadna nadchádzajúca rezervácia"}),e.jsx("p",{className:"text-[11px]",style:{color:l.muted},children:"Naplánuj si ďalší pobyt v Račkovej."})]}),e.jsx(R,{to:"/rezervacia",className:"text-[11px] font-bold px-3 py-2 rounded-xl",style:{background:l.accent,color:l.bg},children:"REZERVOVAŤ"})]})]})]}),ne={lat:49.1142846,lng:19.8009764},ft=({inlineDetail:t=!1})=>{const{data:a=[]}=Ot(),[s,n]=m.useState(null),r=m.useRef(null),o=m.useRef(null),i=m.useRef([]),[u,h]=m.useState(!1);m.useEffect(()=>{const d="leaflet-css";if(document.getElementById(d))return;const f=document.createElement("link");f.id=d,f.rel="stylesheet",f.href="https://unpkg.com/[email protected]/dist/leaflet.css",f.crossOrigin="",document.head.appendChild(f)},[]),m.useEffect(()=>{let d=!1,f=null;return(async()=>
44{if(!r.current)return;const b=(await jt(async()=>{const{default:p}=await import("./leaflet-DdkpF48y.js").then($=>$.l);return{default:p}},__vite__mapDeps([12,2,13]))).default;if(d||!r.current)return;f=b.map(r.current,{center:[ne.lat,ne.lng],zoom:14,zoomControl:!0,attributionControl:!0,scrollWheelZoom:!0}),b.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:18,attribution:"© OpenStreetMap"}).addTo(f);const j=b.divIcon({className:"",html:`<div style="width:18px;height:18px;border-radius:50%;background:${l.accent};border:3px solid ${l.bg};box-shadow:0 0 0 2px ${l.accent}99"></div>`,iconSize:[18,18],iconAnchor:[9,9]});b.marker([ne.lat,ne.lng],{icon:j,title:"Penzión Sileo"}).addTo(f).bindTooltip("Penzión Sileo",{direction:"top",offset:[0,-8]}),o.current={map:f,L:b},h(!0)})(),()=>{var b;d=!0,i.current.forEach(j=>{var p;return(p=j.remove)==null?void 0:p.call(j)}),i.current=[],(b=o.current)!=null&&b.map&&(o.current.map.remove(),o.current=null)}},[]),m.useEffect(()=>{if(!u||!o.current)return;const{map:d,L:f}=o.current;i.current.forEach(p=>p.remove()),i.current=[];const b=p=>f.divIcon({className:"",html:`<div style="width:14px;height:14px;border-radius:50%;background:${p};border:2px solid ${l.bg};box-shadow:0 1px 4px rgba(0,0,0,0.6)"></div>`,iconSize:[14,14],iconAnchor:[7,7]}),j=[[ne.lat,ne.lng]];a.forEach(p=>{var q,A;const $=Number((q=p.coords)==null?void 0:q.lat),k=Number((A=p.coords)==null?void 0:A.lng);if(!Number.isFinite($)||!Number.isFinite(k)||$<48.5||$>49.5||k<19||k>21)return;const M=qe(p.category,p.color),K=f.marker([$,k],{icon:b(M),title:p.name}).addTo(d).bindTooltip(`<strong>${p.name}</strong><br/><span style="opacity:0.7">${p.category}</span>`,{direction:"top",offset:[0,-6]}).on("click",()=>n(p));i.current.push(K),j.push([$,k])}),setTimeout(()=>{try{d.invalidateSize()}catch{}j.length>1&&d.fitBounds(j,{padding:[32,32],maxZoom:12})},0)},[u,a]);const x=m.useMemo(()=>{const d=new Set;return a.forEach(f=>{Te[f.category]&&d.add(f.category)}),Object.keys(Te).filter(f=>d.has(f))},[a]),[g,c]=m.useState(!1);return e.jsxs("article",{className:"rounded-[28px] overflow-hidden border flex flex-col lg:h-full",style:{background:l.surface,borderColor:l.border},children:[e.jsxs("div",{className:"flex items-center justify-between px-5 pt-4 pb-2 shrink-0",children:[e.jsx("div",{className:"w-8 h-8"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold",style:{color:l.muted},children:"Mapa"}),e.jsx("h3",{className:"text-sm font-bold leading-tight",children:"Liptov & Tatry"})]}),e.jsx("button",{className:"w-8 h-8 rounded-full flex items-center justify-center",style:{background:l.bg},"aria-label":"Zdieľať",children:e.jsx(Ns,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"mx-4 mt-2 mb-4 rounded-2xl relative overflow-hidden h-64 lg:h-auto lg:flex-1 lg:min-h-[480px]",style:{background:l.bg},children:[e.jsx("div",{ref:r,className:"absolute inset-0",style:{background:l.bg}}),!u&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:e.jsx(I,{className:"w-5 h-5 animate-spin",style:{color:l.accent}})}),u&&x.length>0&&e.jsxs("div",{className:"absolute bottom-2 left-2 z-[400] max-w-[calc(100%-1rem)]",children:[e.jsxs("button",{type:"button",onClick:()=>c(d=>!d),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-full text-[10px] font-bold uppercase tracking-wider sm:hidden",style:{background:`${l.bg}E6`,color:l.text,border:`1px solid ${l.border}`},"aria-expanded":g,children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:l.accent}}),"Legenda"]}),e.jsx("div",{className:`${g?"flex":"hidden"} sm:flex flex-wrap gap-1 mt-1 sm:mt-0 p-1.5 rounded-xl`,style:{background:`${l.bg}E6`,border:`1px solid ${l.border}`,backdropFilter:"blur(6px)"},children:x.map(d=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold whitespace-nowrap",style:{color:l.text},children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:Te[d]}}),d]},d))})]})]}),t&&s&&e.jsx($a,{attraction:s,onClose:()=>n(null)}),!t&&e.jsx(m.Suspense,{fallback:null,children:e.jsx(Tt,{attraction:s,onClose:()=>n(null)})})]})},$a=({attraction:t,onClose:a})=>{const s=m.useMemo(()=>{const r=t.mode==="foot"?"foot_hiking":"car_fast",o=t.mode==="foot"?"outdoor":"basic";return`https://mapy.com/fnc/v1/route?${new URLSearchParams({start:`${ne.lng},${ne.lat}`,end:`${t.coords.lng},${t.coords.lat}`,routeType:r,mapset:o}).toString()}`},[t]),n=t.mode==="foot"?"Navigovať pešo":"Navigovať autom";return e.jsxs("div",{className:"mx-4 mb-4 rounded-2xl overflow-hidden border",style:{background:l.bg,borderColor:l.border},children:[e.jsxs("div",{className:"flex gap-3 p-3",children:[e.jsx("div",{className:"w-20 h-20 rounded-xl bg-cover bg-center shrink-0",style:{backgroundImage:`url('${t.image}')`},role:"img","aria-label":t.name}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h4",{className:"text-sm font-bold leading-tight",children:t.name}),e.jsxs("p",{className:"text-[11px] mt-0.5",style:{color:l.muted},children:[t.category," · ",t.distanceKm," km",t.duration?` · ${t.duration}`:""]})]}),e.jsx("button",{onClick:a,"aria-label":"Zavrieť",className:"w-6 h-6 rounded-full flex items-center justify-center shrink-0",style:{background:l.surface,color:l.text},children:e.jsx("span",{className:"text-xs leading-none",children:"×"})})]}),e.jsx("p",{className:"text-xs mt-1.5 leading-relaxed line-clamp-3",style:{color:l.muted},children:t.short})]})]}),e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"block mx-3 mb-3 py-2.5 rounded-xl text-center text-xs font-bold",style:{background:l.accent,color:l.bg},children:n})]})},qt=({eyebrow:t,title:a,subtitle:s,image:n,rating:r,guestsLabel:o,description:i,href:u,ctaLabel:h="REZERVOVAŤ"})=>e.jsxs("article",{className:"rounded-[28px] overflow-hidden border",style:{background:l.surface,borderColor:l.border},children:[e.jsxs("div",{className:"relative h-44",children:[e.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:`url('${n}')`},role:"img","aria-label":`${a} — ${s}`}),e.jsx("div",{className:"absolute inset-0",style:{background:`linear-gradient(180deg, transparent 50%, ${l.surface} 100%)`}})]}),e.jsxs("div",{className:"px-5 pb-5 -mt-3 relative",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-widest font-bold mb-1",style:{color:l.accent},children:t}),e.jsx("h3",{className:"text-xl font-bold leading-tight mb-2",children:a}),(r||o)&&e.jsxs("div",{className:"flex items-center gap-3 text-xs mb-3",children:[r&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(he,{className:"w-3.5 h-3.5 fill-current",style:{color:l.accent}}),e.jsx("span",{className:"font-bold",children:r})]}),r&&o&&e.jsx("span",{style:{color:l.muted},children:"·"}),o&&e.jsxs("span",{className:"flex items-center gap-1",style:{color:l.muted},children:[e.jsx(zt,{className:"w-3 h-3"})," ",o]})]}),e.jsx("p",{className:"text-xs leading-relaxed mb-4 line-clamp-3",style:{color:l.muted},children:i}),e.jsxs(R,{to:u,className:"w-full py-3 rounded-2xl font-bold text-sm flex items-center justify-center gap-2",style:{background:l.accent,color:l.bg},children:[h,e.jsx(de,{className:"w-4 h-4",strokeWidth:3})]})]})]}),yt=()=>e.jsx(qt,{eyebrow:"Penzión Sileo",title:"Račková dolina",subtitle:"drevený penzión v Západných Tatrách",
44image:"/images/sileo/exterior-summer-new.webp",rating:"9.8",guestsLabel:"1010 hostí",description:"Drevený penzión v srdci Račkovej doliny. Biojazierko, Drevuliaci, ticho rána a vôňa lesa. Tatry na dosah.",href:"/rezervacia"}),Ea=()=>e.jsx(qt,{eyebrow:"Villa Drosera",title:"Pribylina",subtitle:"living lounge pre 20 hostí",image:"https://htuyfkimeicdotpaalum.supabase.co/storage/v1/object/public/gallery/drosera/exterior/medium/20230416_121756-1767978399774.webp",rating:"9.8",guestsLabel:"súkromne pre vašu skupinu",description:"Celá vila len pre vás — 20 lôžok, kuchyňa, gril, ihrisko a pohoda v Pribyline. Ideálne pre rodiny a tímy.",href:"/rezervacia"}),La=({tab:t,onTab:a,unread:s})=>e.jsxs("nav",{className:"fixed bottom-0 left-0 right-0 h-20 backdrop-blur-xl border-t flex items-center justify-around px-4 pb-4 lg:hidden z-40",style:{background:"rgba(14,26,20,0.92)",borderColor:l.border,paddingBottom:"max(1rem, env(safe-area-inset-bottom))"},children:[e.jsx(ve,{icon:e.jsx(Et,{className:"w-5 h-5",fill:t==="home"?"currentColor":"none"}),label:"Domov",active:t==="home",onClick:()=>a("home")}),e.jsx(ve,{icon:e.jsx(Lt,{className:"w-5 h-5"}),label:"Objavuj",active:t==="objavuj",onClick:()=>a("objavuj")}),e.jsx(ve,{icon:e.jsx(Rt,{className:"w-5 h-5"}),label:"Odmeny",active:t==="pobyty",onClick:()=>a("pobyty")}),e.jsx(ve,{icon:e.jsx(Q,{className:"w-5 h-5"}),label:"Komunita",active:t==="komunita",onClick:()=>a("komunita")}),e.jsx(ve,{icon:e.jsx(Me,{className:"w-5 h-5"}),label:"Profil",active:t==="profil",onClick:()=>a("profil"),badge:s})]}),ve=({icon:t,label:a,active:s,onClick:n,badge:r})=>e.jsxs("button",{onClick:n,className:"flex flex-col items-center gap-1 relative",style:{color:s?l.accent:l.text,opacity:s?1:.4},children:[t,e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider",children:a}),r>0&&e.jsx("span",{className:"absolute -top-1 right-1 w-1.5 h-1.5 rounded-full",style:{background:l.accent}})]});export{rl 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.