import{_ as O}from"./15rOo9Uq.js";import{p as J,e as Q,K as q,q as X,s as Y,f as Z,g as ee,U as te,o as n,c as r,j as B,a as e,b as H,w as x,k as c,F as k,r as b,y as S,V,t as u,L as R,i as L,d as A,S as oe,m,l as g,h as se}from"./BMplCfh_.js";import{u as ne}from"./VxZautWX.js";const ae=J("/logo.svg"),ie={class:"min-h-screen bg-slate-900 text-white flex"},le={class:"flex items-center gap-3 min-w-0"},re={class:"flex-1 px-2 py-4 space-y-2 overflow-y-auto overflow-x-hidden"},de={key:0},ce=["onClick"],ue=["innerHTML"],he={class:"ml-2 mt-1 space-y-1 overflow-hidden transition-all duration-200"},pe=["innerHTML"],ve={class:"whitespace-nowrap overflow-hidden"},ke=["innerHTML"],fe={class:"p-4 border-t border-slate-700 overflow-hidden"},me={class:"flex-1 flex flex-col min-w-0 transition-all duration-300 ease-in-out"},ge={class:"sticky top-0 z-10 bg-slate-800/95 backdrop-blur-sm border-b border-slate-700"},we={class:"flex items-center justify-between h-16 px-4 lg:px-6"},xe={class:"flex items-center gap-3"},be={class:"text-lg font-semibold text-white truncate"},ze={class:"flex items-center gap-3"},Me={class:"flex items-center bg-slate-700/50 rounded-lg p-0.5"},Ce=["onClick"],ye={class:"w-8 h-8 rounded-full bg-indigo-600 flex items-center justify-center text-sm font-bold text-white"},_e={class:"hidden sm:block text-sm text-slate-300"},je={key:0,class:"absolute right-0 mt-2 w-56 bg-slate-800 border border-slate-700 rounded-xl shadow-xl py-1 z-50"},Be={class:"px-4 py-3 border-b border-slate-700"},He={class:"text-sm font-medium text-white"},Se={class:"text-xs text-slate-400 mt-0.5"},Ve={class:"flex-1 p-4 lg:p-6 overflow-auto"},$e=Q({__name:"default",setup(Re){const o=q(),F=X(),h=Y(),C=ne(),{locale:y,locales:G}=Z(),$=m(()=>G.value),P=m(()=>y.value);function T(){const t=se("access_token").value;return t?{Authorization:`Bearer ${t}`}:{}}async function E(s){y.value=s;try{await $fetch("/api/v1/auth/me/language",{method:"PATCH",headers:{...T(),"Content-Type":"application/json"},body:{preferred_language:s}})}catch(t){console.error("[Layout] Failed to persist language preference:",t)}}const a=g(!1),d=g(!1),v=g(!1),z=g(null),f=g(new Set(["Központ"])),_=m(()=>h.userEmail||"Ismeretlen Felhasználó"),W=m(()=>{const s=h.userEmail;return s?s.split("@")[0].split(".").map(t=>t[0]).join("").toUpperCase().slice(0,2):"??"}),K=[{title:"Központ",items:[{path:"/",label:"Dashboard",icon:''}]},{title:"Felhasználók & Partnerek",items:[{label:"Garázsok",icon:'',children:[{path:"/garages",label:"Garázsok listája",icon:''}]},{label:"Felhasználók",icon:'',children:[{path:"/users",label:"Felhasználók listája",icon:''},{path:"/persons",label:"Személyek",icon:''}]}]},{title:"Pénzügyek",items:[{path:"/packages",label:"Csomagok",icon:''}]},{title:"Gamification",items:[{label:"Játékmenet Beállítások",icon:'',children:[{path:"/gamification/point-rules",label:"Pontszabályok",icon:''},{path:"/gamification/levels",label:"Szintek",icon:''},{path:"/gamification/badges",label:"Kitüntetések",icon:''}]},{label:"Események & Szezonok",icon:'',children:[{path:"/gamification/seasons",label:"Szezonok",icon:''},{path:"/gamification/competitions",label:"Versenyek",icon:''}]},{label:"Felhasználói Adatok",icon:'',children:[{path:"/gamification/users",label:"Statisztikák",icon:''},{path:"/gamification/leaderboard",label:"Ranglista",icon:''},{path:"/gamification/ledger",label:"Pontnapló",icon:''}]},{path:"/gamification",label:"Gamification HQ",icon:''},{path:"/gamification/config",label:"Rendszer Konfig",icon:''},{path:"/gamification/parameters",label:"Rendszerparaméterek",icon:''}]},{title:"Rendszer",items:[{path:"/permissions",label:"Jogosultságok",icon:''},{label:"Rendszernaplók",icon:'',children:[{path:"/",label:"Rendszernaplók",icon:''}]}]}],N=m(()=>o.path==="/"?"Dashboard":o.path.startsWith("/permissions")?"Jogosultság Kezelés":o.path.startsWith("/garages")?"Garázsok":o.path.startsWith("/persons")?"Személyek":o.path.startsWith("/users")?"Felhasználók":o.path.startsWith("/logs")?"Rendszernaplók":o.path.startsWith("/packages")?"Csomagok":o.path.startsWith("/gamification")?o.path==="/gamification"?"Gamification HQ":o.path==="/gamification/point-rules"?"Pontszabályok":o.path==="/gamification/levels"?"Szintek":o.path==="/gamification/badges"?"Kitüntetések":o.path==="/gamification/seasons"?"Szezonok":o.path==="/gamification/competitions"?"Versenyek":o.path==="/gamification/users"?"Gamification Felhasználók":o.path.startsWith("/gamification/users/")?"Felhasználó Gamification":o.path==="/gamification/leaderboard"?"Ranglista":o.path==="/gamification/config"?"Rendszer Konfig":o.path==="/gamification/parameters"?"Rendszerparaméterek":o.path==="/gamification/ledger"?"Pontnapló":"Gamification":"Admin Panel");function M(s){return s==="/"?o.path==="/":o.path.startsWith(s)}function U(s){return s.children?s.children.some(t=>M(t.path)):!1}function D(s){f.value.has(s.label)?f.value.delete(s.label):f.value.add(s.label)}function I(){h.logout(),v.value=!1,F.push("/login")}function j(s){z.value&&!z.value.contains(s.target)&&(v.value=!1)}return ee(()=>{document.addEventListener("click",j),C.fetchRegions().then(()=>{h.user?.region_code&&C.setActiveRegion(h.user.region_code)})}),te(()=>{document.removeEventListener("click",j)}),(s,t)=>{const w=O;return n(),r("div",ie,[a.value?(n(),r("div",{key:0,class:"fixed inset-0 bg-black/50 z-20 lg:hidden",onClick:t[0]||(t[0]=l=>a.value=!1)})):B("",!0),e("aside",{class:c(["fixed lg:static inset-y-0 left-0 z-30 flex flex-col bg-slate-800 border-r border-slate-700 transition-all duration-300 ease-in-out overflow-hidden",a.value||!d.value?"w-52":"w-20"])},[H(w,{to:"/",class:"flex items-center h-16 px-4 border-b border-slate-700 overflow-hidden hover:bg-slate-700/50 transition"},{default:x(()=>[e("div",le,[t[8]||(t[8]=e("img",{src:ae,class:"h-8 w-auto flex-shrink-0",alt:"SF Logo"},null,-1)),e("div",{class:c(["transition-all duration-300 ease-in-out overflow-hidden whitespace-nowrap",a.value||!d.value?"opacity-100 max-w-[200px]":"opacity-0 max-w-0"])},[...t[7]||(t[7]=[e("div",{class:"text-sm font-bold text-white leading-tight"},"Service Finder",-1),e("div",{class:"text-[10px] font-semibold uppercase tracking-wider text-indigo-400 leading-tight"},"Admin",-1)])],2)])]),_:1}),e("button",{class:"hidden lg:flex items-center justify-center h-10 mx-2 mt-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition flex-shrink-0",onClick:t[1]||(t[1]=l=>d.value=!d.value)},[(n(),r("svg",{class:c(["w-5 h-5 transition-transform duration-300",{"rotate-180":d.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...t[9]||(t[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"},null,-1)])],2))]),e("nav",re,[(n(),r(k,null,b(K,l=>(n(),r(k,{key:l.title},[S(e("div",{class:"px-3 py-1 text-xs font-semibold uppercase tracking-wider text-slate-500 whitespace-nowrap overflow-hidden"},u(l.title),513),[[V,a.value||!d.value]]),(n(!0),r(k,null,b(l.items,i=>(n(),r(k,{key:i.label},[i.children?(n(),r("div",de,[e("button",{class:c(["flex items-center w-full gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition",U(i)?"bg-indigo-600/20 text-indigo-300":"text-slate-300 hover:bg-slate-700 hover:text-white"]),onClick:p=>D(i)},[e("span",{class:"flex-shrink-0 w-5 h-5",innerHTML:i.icon},null,8,ue),e("span",{class:c(["flex-1 text-left whitespace-nowrap overflow-hidden transition-all duration-300 ease-in-out",a.value||!d.value?"opacity-100 max-w-[200px]":"opacity-0 max-w-0"])},u(i.label),3),(n(),r("svg",{class:c(["w-4 h-4 transition-all duration-300 ease-in-out flex-shrink-0",{"rotate-90":f.value.has(i.label),"opacity-100":a.value||!d.value,"opacity-0":d.value&&!a.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...t[10]||(t[10]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))],10,ce),S(e("div",he,[(n(!0),r(k,null,b(i.children,p=>(n(),R(w,{key:p.path,to:p.path,class:c(["flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition",M(p.path)?"bg-indigo-600 text-white":"text-slate-400 hover:bg-slate-700 hover:text-white"]),onClick:t[2]||(t[2]=Le=>a.value=!1)},{default:x(()=>[e("span",{class:"flex-shrink-0 w-4 h-4",innerHTML:p.icon},null,8,pe),e("span",ve,u(p.label),1)]),_:2},1032,["to","class"]))),128))],512),[[V,f.value.has(i.label)&&(a.value||!d.value)]])])):(n(),R(w,{key:1,to:i.path,class:c(["flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition",M(i.path)?"bg-indigo-600 text-white":"text-slate-300 hover:bg-slate-700 hover:text-white"]),onClick:t[3]||(t[3]=p=>a.value=!1)},{default:x(()=>[e("span",{class:"flex-shrink-0 w-5 h-5",innerHTML:i.icon},null,8,ke),e("span",{class:c(["whitespace-nowrap overflow-hidden transition-all duration-300 ease-in-out",a.value||!d.value?"opacity-100 max-w-[200px]":"opacity-0 max-w-0"])},u(i.label),3)]),_:2},1032,["to","class"]))],64))),128))],64))),64))]),e("div",fe,[e("div",{class:c(["text-xs text-slate-500 whitespace-nowrap transition-all duration-300 ease-in-out",a.value||!d.value?"opacity-100 max-w-[200px]":"opacity-0 max-w-0"])}," ServiceFinder v2.0 ",2)])],2),e("div",me,[e("header",ge,[e("div",we,[e("div",xe,[e("button",{class:"lg:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition",onClick:t[4]||(t[4]=l=>a.value=!0)},[...t[11]||(t[11]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 12h16M4 18h16"})],-1)])]),e("h1",be,u(N.value),1)]),e("div",ze,[e("div",Me,[(n(!0),r(k,null,b($.value,l=>(n(),r("button",{key:l.code,onClick:i=>E(l.code),class:c(["px-2.5 py-1 text-xs font-medium rounded-md transition",P.value===l.code?"bg-indigo-600 text-white shadow-sm":"text-slate-400 hover:text-white"])},u(l.code==="hu"?"HU":"EN"),11,Ce))),128))]),e("div",{class:"relative",ref_key:"dropdownRef",ref:z},[e("button",{class:"flex items-center gap-2 p-1.5 rounded-lg hover:bg-slate-700 transition",onClick:t[5]||(t[5]=l=>v.value=!v.value)},[e("div",ye,u(W.value),1),e("span",_e,u(_.value),1),t[12]||(t[12]=e("svg",{class:"w-4 h-4 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"})],-1))]),v.value?(n(),r("div",je,[e("div",Be,[e("p",He,u(_.value),1),e("p",Se,u(L(h).userRole==="SUPERADMIN"?"Super Administrator":L(h).userRole||"Administrator"),1)]),H(w,{to:"/profile",class:"flex items-center gap-3 px-4 py-2.5 text-sm text-slate-300 hover:bg-slate-700 hover:text-white transition",onClick:t[6]||(t[6]=l=>v.value=!1)},{default:x(()=>[...t[13]||(t[13]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})],-1),A(" Profile Settings ",-1)])]),_:1}),e("button",{class:"flex items-center gap-3 w-full px-4 py-2.5 text-sm text-red-400 hover:bg-slate-700 hover:text-red-300 transition",onClick:I},[...t[14]||(t[14]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})],-1),A(" Sign Out ",-1)])])])):B("",!0)],512)])])]),e("main",Ve,[oe(s.$slots,"default")])])])}}});export{$e as default};