const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Users-CZAd7D4u.js","assets/vendor-animation-0s3FMHwK.js","assets/vendor-react-BVs3cwbi.js","assets/Forbidden-D25jV3Oq.js","assets/vendor-utils-Dyr8OjFr.js","assets/Attendance-BX-dOcwX.js","assets/attendanceHelpers-D6sLEw0q.js","assets/AttendanceHistory-DJsZH1vb.js","assets/AttendanceAdmin-BBu3ja4e.js","assets/AttendanceBalances-D7Vbcgsx.js","assets/AttendanceCreate-DDroVeLa.js","assets/LeaveRequests-B1Bzu0Vj.js","assets/LeaveApproval-UIYMMi6c.js","assets/AttendanceLocation-CkLbDDD5.js","assets/Trips-DEgmESht.js","assets/TripsHistory-Cfxm8t74.js","assets/TripsAdmin-BdFHuk3D.js","assets/Vehicles-YMg1_LP9.js","assets/Offers-BGVfho9c.js","assets/useListData-DYVKBrr4.js","assets/Pagination-B1sbY6V7.js","assets/OfferDetail-AW7tQQUQ.js","assets/useSortableList-CgbuKaxB.js","assets/RichEditor-Bfur5pi6.js","assets/RichEditor-7oN3-GhD.css","assets/OffersCustomers-DiVbk3p5.js","assets/OffersTemplates-CqsoE1IJ.js","assets/CompanySettings-COuXybi5.js","assets/Orders-DntV4Wip.js","assets/OrderDetail-DwmW9kwS.js","assets/Projects-BMQPua4N.js","assets/ProjectCreate-k3l1K_1G.js","assets/ProjectDetail-CDPrOXSn.js","assets/Invoices-C5K7WgpF.js","assets/InvoiceCreate-C7cM8-ZE.js","assets/InvoiceDetail-kr1EuIML.js","assets/Settings-DCrSiXXN.js","assets/AuditLog-BM2lpFlW.js","assets/NotFound-Cm3yLPlV.js"])))=>i.map(i=>d[i]); var ha=Object.defineProperty;var va=(r,o,t)=>o in r?ha(r,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[o]=t;var Yn=(r,o,t)=>va(r,typeof o!="symbol"?o+"":o,t);import{j as s,m as Q,A as Ie}from"./vendor-animation-0s3FMHwK.js";import{a as Nr,r as v,u as Mr,N as ya,b as hn,O as ga,R as Er,c as x,d as xa,L as Qe,e as Pr,f as B,B as ba}from"./vendor-react-BVs3cwbi.js";import{i as pe,a as be,b as ke,g as Y,c as De,d as X,e as G,f as ht,h as re,j as ka,p as wa,t as Tr,k as ct,l as vt,m as It,n as Wn,o as zn,s as Sn,q as Or,r as yt,u as Ar,v as Cn,w as Rr,x as Lr,y as Tt,z as Ot,A as At,B as _a,C as ft,D as Se,E as Fe,F as de,G as Da,H as Ye,I as se,J as Ce,K as me,L as ja,M as Sa,N as vn,O as Bn,P as Ca,Q as Na,R as Ft,S as Ir,T as Yt,U as Wt,V as Fr,W as yn,X as Ke,Y as Ue,Z as Ma,_ as Ea,$ as Pa,a0 as Ta,a1 as Oa,a2 as Aa,a3 as Ra,a4 as Hn,a5 as en,a6 as at,a7 as ot,a8 as La}from"./vendor-utils-Dyr8OjFr.js";(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))e(n);new MutationObserver(n=>{for(const a of n)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&e(i)}).observe(document,{childList:!0,subtree:!0});function t(n){const a={};return n.integrity&&(a.integrity=n.integrity),n.referrerPolicy&&(a.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?a.credentials="include":n.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function e(n){if(n.ep)return;n.ep=!0;const a=t(n);fetch(n.href,a)}})();var gn={},Vn=Nr;gn.createRoot=Vn.createRoot,gn.hydrateRoot=Vn.hydrateRoot;const Ia="modulepreload",Fa=function(r){return"/"+r},$n={},K=function(o,t,e){let n=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=i?.nonce||i?.getAttribute("nonce");n=Promise.allSettled(t.map(c=>{if(c=Fa(c),c in $n)return;$n[c]=!0;const u=c.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":Ia,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((m,f)=>{d.addEventListener("load",m),d.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return n.then(i=>{for(const l of i||[])l.status==="rejected"&&a(l.reason);return o().catch(a)})};let xn=!1,bn=!1,dt=null,kn=null,Dt=null;const Ya=()=>xn?(xn=!1,!0):!1,wn=()=>{xn=!0},Wa=()=>bn?(bn=!1,!0):!1,za=()=>{bn=!0},Ba=r=>{dt=r},Ha=r=>{kn=r},ae=async(r,o={})=>{let t=null;try{t=dt?dt():null}catch{}const e={...o.headers};!e["Content-Type"]&&!(o.body instanceof FormData)&&(e["Content-Type"]="application/json"),t&&(e.Authorization=`Bearer ${t}`);let n=await fetch(r,{...o,headers:e,credentials:"include"});if(n.status===401&&kn)try{Dt||(Dt=kn().finally(()=>{Dt=null})),await Dt?(t=dt?dt():null,t&&(e.Authorization=`Bearer ${t}`),n=await fetch(r,{...o,headers:e,credentials:"include"})):wn()}catch{wn()}return n},Me="/api/admin",Yr=v.createContext(null),Wr=v.createContext(null);function Ee(r){return r?{...r,fullName:r.full_name??r.fullName,roleDisplay:r.role_display??r.roleDisplay,isAdmin:r.is_admin??r.isAdmin,totpEnabled:r.totp_enabled??r.totpEnabled,require2FA:r.require_2fa??r.require2FA}:null}let st=null,He=null,ce=null,it=!1;function Va({children:r}){const[o,t]=v.useState(ce),[e,n]=v.useState(!it),[a,i]=v.useState(null),l=v.useRef(null);v.useEffect(()=>{ce=o},[o]);const c=v.useCallback(()=>He&&Date.now()>He-3e4?null:st,[]),u=v.useCallback((D,b)=>{if(st=D,He=D?Date.now()+b*1e3:null,l.current&&(clearTimeout(l.current),l.current=null),D&&b>60){const w=(b-60)*1e3;l.current=setTimeout(()=>{p()},w)}},[]),p=v.useCallback(async()=>{try{const b=await(await fetch(`${Me}/refresh.php`,{method:"POST",credentials:"include"})).json();return b.success&&b.data?.access_token?(u(b.data.access_token,b.data.expires_in),t(Ee(b.data.user)),!0):(st=null,He=null,t(null),ce=null,wn(),!1)}catch{return!1}},[u]),d=v.useCallback(async()=>{try{const D=c(),b={"Content-Type":"application/json"};D&&(b.Authorization=`Bearer ${D}`);const w=await fetch(`${Me}/session.php`,{method:"GET",credentials:"include",headers:b});if(w.status===429||w.status>=500)return!!ce;const S=await w.json();return S.success&&S.data?.authenticated?(S.data.access_token&&u(S.data.access_token,S.data.expires_in),t(Ee(S.data.user)),ce=Ee(S.data.user),!0):(t(null),ce=null,st=null,He=null,!1)}catch{return!!ce}finally{n(!1),it=!0}},[c,u]);v.useEffect(()=>{Ba(c),Ha(p)},[c,p]),v.useEffect(()=>(d(),()=>{l.current&&clearTimeout(l.current)}),[d]);const m=v.useCallback(async(D,b,w=!1)=>{i(null);try{const N=await(await fetch(`${Me}/login.php`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({username:D,password:b,remember:w})})).json();return N.success?N.data?.requires_2fa?{success:!1,requires2FA:!0,loginToken:N.data.login_token,remember:w}:(u(N.data.access_token,N.data.expires_in),t(Ee(N.data.user)),ce=Ee(N.data.user),it=!0,{success:!0}):(i(N.error),{success:!1,error:N.error})}catch{const S="Chyba připojení. Zkontrolujte prosím připojení k internetu a zkuste to znovu.";return i(S),{success:!1,error:S}}},[u]),f=v.useCallback(async(D,b,w=!1,S=!1)=>{i(null);try{const T=await(await fetch(`${Me}/totp.php?action=${S?"backup_verify":"verify"}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({login_token:D,code:b,remember:w})})).json();return T.success?(u(T.data.access_token,T.data.expires_in),t(Ee(T.data.user)),ce=Ee(T.data.user),it=!0,{success:!0}):(i(T.error),{success:!1,error:T.error})}catch{const N="Chyba připojení. Zkontrolujte prosím připojení k internetu a zkuste to znovu.";return i(N),{success:!1,error:N}}},[u]),h=v.useCallback(async()=>{try{const D=c();await fetch(`${Me}/logout.php`,{method:"POST",headers:{"Content-Type":"application/json",...D&&{Authorization:`Bearer ${D}`}},credentials:"include"})}catch{}finally{st=null,He=null,t(null),ce=null,it=!1,l.current&&(clearTimeout(l.current),l.current=null)}},[c]),y=v.useCallback(async(D,b={})=>{let w=c();!w&&o&&await p()&&(w=c());const S={"Content-Type":"application/json",...b.headers};w&&(S.Authorization=`Bearer ${w}`);const N=await fetch(`${Me}${D}`,{...b,headers:S,credentials:"include"});return N.status===401&&o&&await p()?(w=c(),S.Authorization=`Bearer ${w}`,fetch(`${Me}${D}`,{...b,headers:S,credentials:"include"})):N},[c,p,o]),g=v.useCallback(D=>{t(b=>b?{...b,...D}:null)},[]),k=v.useCallback(D=>o?o.isAdmin?!0:(o.permissions||[]).includes(D):!1,[o]),_=v.useMemo(()=>o?.permissions||[],[o]),j=v.useMemo(()=>({user:o,loading:e,error:a,isAuthenticated:!!o,isAdmin:o?.isAdmin||!1,permissions:_,hasPermission:k}),[o,e,a,_,k]),C=v.useMemo(()=>({login:m,verify2FA:f,logout:h,checkSession:d,getAccessToken:c,apiRequest:y,silentRefresh:p,updateUser:g}),[m,f,h,d,c,y,p,g]);return s.jsx(Wr.Provider,{value:C,children:s.jsx(Yr.Provider,{value:j,children:r})})}function tt(){const r=v.useContext(Yr),o=v.useContext(Wr);if(!r||!o)throw new Error("useAuth must be used within an AuthProvider");return{...r,...o}}const zr=v.createContext(null),Br=v.createContext(null);function $a({children:r}){const[o,t]=v.useState([]),e=v.useCallback(l=>{t(c=>c.filter(u=>u.id!==l))},[]),n=v.useRef(0),a=v.useCallback((l,c="success",u=4e3)=>{const p=`${Date.now()}-${n.current++}`;return t(d=>[...d,{id:p,message:l,type:c}]),u>0&&setTimeout(()=>{e(p)},u),p},[e]),i=v.useMemo(()=>({addAlert:a,removeAlert:e,success:(l,c)=>a(l,"success",c),error:(l,c)=>a(l,"error",c),warning:(l,c)=>a(l,"warning",c),info:(l,c)=>a(l,"info",c)}),[a,e]);return s.jsx(zr.Provider,{value:i,children:s.jsx(Br.Provider,{value:{alerts:o,removeAlert:e},children:r})})}function xt(){const r=v.useContext(zr);if(!r)throw new Error("useAlert must be used within an AlertProvider");return r}function Ka(){const r=v.useContext(Br);if(!r)throw new Error("useAlertState must be used within an AlertProvider");return r}class Ua extends v.Component{constructor(){super(...arguments);Yn(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,e){}render(){return this.state.hasError?s.jsxs("div",{className:"admin-empty-state",style:{minHeight:"60vh",justifyContent:"center"},children:[s.jsx("div",{className:"admin-empty-icon",style:{width:80,height:80,marginBottom:"1.5rem"},children:s.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),s.jsx("p",{className:"mb-2",children:"Něco se pokazilo při načítání stránky."}),!1,s.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[s.jsx("a",{href:"/",className:"admin-btn admin-btn-secondary",children:"Zpět na Dashboard"}),s.jsx("button",{onClick:()=>window.location.reload(),className:"admin-btn admin-btn-primary",children:"Načíst znovu"})]})]}):this.props.children}}const Hr=v.createContext(),Qa="boha_cookie_consent";function Kn(){return document.cookie.split(";").some(r=>r.trim()===`${Qa}=accepted`)}function Za({children:r}){const[o,t]=v.useState(()=>typeof window<"u"&&Kn()&&localStorage.getItem("boha-theme")||"dark");v.useEffect(()=>{document.documentElement.setAttribute("data-theme",o),Kn()&&localStorage.setItem("boha-theme",o);const n=o==="dark"?"#12121a":"#ffffff";document.querySelector('meta[name="theme-color"]')?.setAttribute("content",n)},[o]);const e=()=>{t(n=>n==="dark"?"light":"dark")};return s.jsx(Hr.Provider,{value:{theme:o,toggleTheme:e},children:r})}function Nn(){const r=v.useContext(Hr);if(!r)throw new Error("useTheme must be used within a ThemeProvider");return r}let mt=0;function Vr(r){let o=r.target;for(;o&&o!==document.body;){if(o.scrollHeight>o.clientHeight){const e=window.getComputedStyle(o).overflowY;if(e==="auto"||e==="scroll")return}o=o.parentElement}r.preventDefault()}function qa(){if(mt===0){const r=window.innerWidth-document.documentElement.clientWidth;document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden",document.addEventListener("touchmove",Vr,{passive:!1}),r>0&&(document.body.style.paddingRight=`${r}px`)}mt++}function Xa(){mt--,mt<=0&&(mt=0,document.documentElement.style.overflow="",document.body.style.overflow="",document.body.style.paddingRight="",document.removeEventListener("touchmove",Vr))}function ze(r){v.useEffect(()=>{if(r)return qa(),()=>Xa()},[r])}const Ga=[{label:"Přehled",items:[{path:"/",label:"Přehled",end:!0,icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),s.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),s.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"}),s.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"})]})}]},{label:"Docházka",items:[{path:"/attendance",label:"Záznam",permission:"attendance.record",end:!0,icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"9"}),s.jsx("polyline",{points:"12 7 12 12 15 15"})]})},{path:"/attendance/history",label:"Moje historie",permission:"attendance.history",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"12 8 12 12 14 14"}),s.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})},{path:"/attendance/requests",label:"Žádosti",permission:"attendance.record",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),s.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]})},{path:"/attendance/approval",label:"Schvalování",permission:"attendance.approve",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M9 12l2 2 4-4"}),s.jsx("circle",{cx:"12",cy:"12",r:"10"})]})},{path:"/attendance/admin",label:"Správa",permission:"attendance.admin",matchPrefix:"/attendance/admin",matchAlso:["/attendance/create","/attendance/location"],icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),s.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),s.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),s.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),s.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),s.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),s.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),s.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),s.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]})},{path:"/attendance/balances",label:"Správa bilancí",permission:"attendance.balances",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),s.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),s.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})}]},{label:"Kniha jízd",items:[{path:"/trips",label:"Záznam",permission:"trips.record",end:!0,icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"5",cy:"18",r:"3"}),s.jsx("circle",{cx:"19",cy:"18",r:"3"}),s.jsx("path",{d:"M5 18V12L8 5h8l3 7v6"}),s.jsx("path",{d:"M10 18h4"})]})},{path:"/trips/history",label:"Moje historie",permission:"trips.history",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"12 8 12 12 14 14"}),s.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})},{path:"/trips/admin",label:"Správa",permission:"trips.admin",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),s.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),s.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),s.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),s.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),s.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),s.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),s.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),s.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]})},{path:"/vehicles",label:"Vozidla",permission:"trips.vehicles",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"1",y:"3",width:"15",height:"13",rx:"2"}),s.jsx("path",{d:"M16 8h4l3 3v5h-7V8z"}),s.jsx("circle",{cx:"5.5",cy:"18.5",r:"2.5"}),s.jsx("circle",{cx:"18.5",cy:"18.5",r:"2.5"})]})}]},{label:"Administrativa",items:[{path:"/offers",label:"Nabídky",permission:"offers.view",matchPrefix:"/offers",matchExclude:["/offers/customers","/offers/templates"],icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"})]})},{path:"/orders",label:"Objednávky",permission:"orders.view",matchPrefix:"/orders",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"}),s.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),s.jsx("path",{d:"M16 10a4 4 0 0 1-8 0"})]})},{path:"/invoices",label:"Faktury",permission:"invoices.view",matchPrefix:"/invoices",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),s.jsx("path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})]})},{path:"/projects",label:"Projekty",permission:"projects.view",matchPrefix:"/projects",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),s.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),s.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})},{path:"/offers/customers",label:"Zákazníci",permission:"offers.view",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"9",cy:"7",r:"4"}),s.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),s.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})},{path:"/company/settings",label:"Firma",permission:"offers.settings",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),s.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]})}]},{label:"Systém",items:[{path:"/users",label:"Uživatelé",permission:"users.view",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"9",cy:"7",r:"4"}),s.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),s.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})},{path:"/settings",label:"Nastavení",permission:["settings.roles","settings.security"],icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"3"}),s.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]})},{path:"/audit-log",label:"Audit log",permission:"settings.audit",icon:s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),s.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),s.jsx("polyline",{points:"10 9 9 9 8 9"})]})}]}];function Ja({isOpen:r,onClose:o,onLogout:t}){const{user:e,hasPermission:n}=tt(),{theme:a}=Nn(),i=Mr(),l=p=>{if(p.matchPrefix){let d=i.pathname.startsWith(p.matchPrefix);return d&&p.matchExclude&&(d=!p.matchExclude.some(m=>i.pathname.startsWith(m))),d}return p.end?i.pathname===p.path:i.pathname.startsWith(p.path)},c=p=>p.permission?Array.isArray(p.permission)?p.permission.some(d=>n(d)):n(p.permission):!0,u=Ga.map(p=>({...p,items:p.items.filter(c)})).filter(p=>p.items.length>0);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:`admin-sidebar-overlay${r?" open":""}`,onClick:o}),s.jsxs("aside",{className:`admin-sidebar${r?" open":""}`,children:[s.jsxs("div",{className:"admin-sidebar-header",children:[s.jsx("img",{src:a==="dark"?"/images/logo-dark.png":"/images/logo-light.png",alt:"Logo",className:"admin-sidebar-logo"}),s.jsx("button",{onClick:o,className:"admin-sidebar-close","aria-label":"Zavřít menu",children:s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),s.jsx("nav",{className:"admin-sidebar-nav",children:u.map(p=>s.jsxs("div",{className:"admin-nav-section",children:[s.jsx("div",{className:"admin-nav-label",children:p.label}),p.items.map(d=>s.jsxs(ya,{to:d.path,end:d.end,onClick:o,className:()=>{let m=l(d);return!m&&d.matchAlso&&(m=d.matchAlso.some(f=>i.pathname.startsWith(f))),`admin-nav-item${m?" active":""}`},children:[d.icon,d.label]},d.path))]},p.label))}),s.jsxs("div",{className:"admin-sidebar-footer",children:[s.jsxs("div",{className:"admin-user-chip",children:[s.jsx("div",{className:"admin-user-avatar",children:e?.fullName?.charAt(0)||e?.username?.charAt(0)||"U"}),s.jsxs("div",{className:"admin-user-details",children:[s.jsx("div",{className:"admin-user-name",children:e?.fullName||e?.username}),s.jsx("div",{className:"admin-user-role",children:e?.roleDisplay||e?.role})]})]}),s.jsxs("button",{onClick:t,className:"admin-logout-btn","aria-label":"Odhlásit se",children:[s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),s.jsx("polyline",{points:"16 17 21 12 16 7"}),s.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]}),"Odhlásit se"]})]})]})]})}function eo(r){const o=v.useCallback(t=>{const e=t.target.tagName,n=e==="INPUT"||e==="TEXTAREA"||e==="SELECT"||t.target.isContentEditable;for(const a of r){if(a.when===!1)continue;const i=a.ctrl?t.ctrlKey||t.metaKey:!(t.ctrlKey||t.metaKey),l=a.shift?t.shiftKey:!t.shiftKey,c=a.alt?t.altKey:!t.altKey;if(t.key.toLowerCase()===a.key.toLowerCase()&&i&&l&&c){if(n&&t.key!=="Escape")continue;t.preventDefault(),a.handler(t);return}}},[r]);v.useEffect(()=>(window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)),[o])}const to=[{keys:"?",description:"Zobrazit klávesové zkratky"},{keys:"Ctrl + N",description:"Nový záznam"},{keys:"Ctrl + S",description:"Uložit"},{keys:"Escape",description:"Zavřít modal / zrušit"},{keys:"/",description:"Hledat"}];function no(){const[r,o]=v.useState(!1);return eo([{key:"?",shift:!0,handler:()=>o(t=>!t)},{key:"Escape",handler:()=>o(!1),when:r}]),r?s.jsx("div",{className:"admin-modal-overlay",onClick:()=>o(!1),children:s.jsxs("div",{className:"admin-modal",style:{maxWidth:420},onClick:t=>t.stopPropagation(),children:[s.jsxs("div",{className:"admin-modal-header",children:[s.jsx("h3",{children:"Klávesové zkratky"}),s.jsx("button",{className:"admin-modal-close",onClick:()=>o(!1),children:s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),s.jsx("div",{className:"admin-modal-body",children:s.jsx("table",{className:"admin-table",style:{minWidth:"auto"},children:s.jsx("tbody",{children:to.map(t=>s.jsxs("tr",{children:[s.jsx("td",{style:{width:120},children:s.jsx("kbd",{className:"admin-kbd",children:t.keys})}),s.jsx("td",{children:t.description})]},t.keys))})})})]})}):null}function ro(){const{isAuthenticated:r,loading:o,checkSession:t,user:e,logout:n}=tt(),{theme:a,toggleTheme:i}=Nn(),[l,c]=v.useState(!1),[u,p]=v.useState(!1),d=Mr();v.useEffect(()=>{t()},[d.pathname,t]);const m=v.useCallback(()=>{p(!0),c(!1),za(),setTimeout(()=>n(),400)},[n]);return ze(l),o?s.jsx("div",{className:"admin-layout",children:s.jsx("div",{className:"admin-loading",style:{width:"100%"},children:s.jsx("div",{className:"admin-spinner"})})}):r?e?.require2FA&&!e?.totpEnabled&&d.pathname!=="/"?s.jsx(hn,{to:"/",replace:!0}):s.jsxs(Q.div,{className:"admin-layout",initial:{opacity:0,scale:.97},animate:u?{scale:1.5,opacity:0,filter:"blur(12px)"}:{scale:1,opacity:1,filter:"none"},transition:{duration:u?.5:.35,ease:[.4,0,.2,1]},children:[s.jsx(Ja,{isOpen:l,onClose:()=>c(!1),onLogout:m}),s.jsxs("div",{className:"admin-main",children:[s.jsxs("header",{className:"admin-header",children:[s.jsx("button",{onClick:()=>c(!0),className:"admin-menu-btn","aria-label":"Otevřít menu",children:s.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),s.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),s.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),s.jsx("div",{className:"flex-1"}),s.jsxs("button",{onClick:i,className:"admin-header-theme-btn",title:a==="dark"?"Světlý režim":"Tmavý režim","aria-label":a==="dark"?"Světlý režim":"Tmavý režim",children:[s.jsx("span",{className:`admin-theme-icon ${a==="light"?"visible":""}`,children:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"5"}),s.jsx("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"})]})}),s.jsx("span",{className:`admin-theme-icon ${a==="dark"?"visible":""}`,children:s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})})]})]}),s.jsx("main",{className:"admin-content",children:s.jsx(ga,{})})]}),s.jsx(no,{})]}):s.jsx(hn,{to:"/login",replace:!0})}const ao={success:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),s.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),error:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),s.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),warning:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),info:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),s.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})};function oo(){const{alerts:r,removeAlert:o}=Ka();return s.jsx("div",{className:"admin-alert-container",role:"status","aria-live":"polite",children:s.jsx(Ie,{children:r.map(t=>s.jsxs(Q.div,{className:`admin-toast admin-toast-${t.type}`,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:20,scale:.95},transition:{duration:.2},children:[s.jsx("span",{className:"admin-toast-icon",children:ao[t.type]}),s.jsx("span",{className:"admin-toast-message",children:t.message}),s.jsx("button",{className:"admin-toast-close",onClick:()=>o(t.id),"aria-label":"Zavřít",children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},t.id))})})}function tn({label:r,error:o,required:t,className:e,style:n,children:a}){const i=`admin-form-group${o?" has-error":""}${e?` ${e}`:""}`;return s.jsxs("div",{className:i,style:n,children:[s.jsx("label",{className:`admin-form-label${t?" required":""}`,children:r}),a,o&&s.jsx("span",{className:"admin-form-error",children:o})]})}function so(){const{login:r,verify2FA:o,isAuthenticated:t,loading:e}=tt(),n=xt(),{theme:a,toggleTheme:i}=Nn(),[l,c]=v.useState(""),[u,p]=v.useState(""),[d,m]=v.useState(!1),[f,h]=v.useState(!1),[y,g]=v.useState(!1),[k,_]=v.useState(!1),[j,C]=v.useState(!1),[D,b]=v.useState(null),[w,S]=v.useState(""),[N,A]=v.useState(!1),T=v.useRef(null);if(v.useEffect(()=>{Ya()?n.warning("Vaše relace vypršela. Přihlaste se prosím znovu."):Wa()&&n.success("Byli jste úspěšně odhlášeni.")},[]),v.useEffect(()=>{j&&T.current&&T.current.focus()},[j,N]),e)return s.jsx("div",{className:"admin-login",children:s.jsx("div",{className:"admin-loading",children:s.jsx("div",{className:"admin-spinner"})})});if(t&&!k)return s.jsx(hn,{to:"/",replace:!0});const P=async L=>{L.preventDefault(),h(!0);const R=await r(l,u,d);R.requires2FA?(b(R.loginToken),C(!0),S(""),h(!1)):R.success?(n.success("Úspěšně přihlášeno"),_(!0),setTimeout(()=>_(!1),400)):(n.error(R.error),g(!0),setTimeout(()=>g(!1),500),h(!1))},E=async L=>{if(L.preventDefault(),!w.trim())return;h(!0);const R=await o(D,w.trim(),d,N);R.success?(n.success("Úspěšně přihlášeno"),_(!0),setTimeout(()=>_(!1),400)):(n.error(R.error),g(!0),setTimeout(()=>g(!1),500),S(""),T.current&&T.current.focus(),h(!1))},O=()=>{C(!1),b(null),S(""),A(!1)};return s.jsxs(Q.div,{className:"admin-login",initial:{opacity:0,scale:.97},animate:k?{scale:1.5,opacity:0,filter:"blur(12px)"}:{scale:1,opacity:1,filter:"none"},transition:k?{duration:.5,ease:[.4,0,.2,1]}:{duration:.35,ease:[.4,0,.2,1]},children:[s.jsx("div",{className:"bg-orb bg-orb-1"}),s.jsx("div",{className:"bg-orb bg-orb-2"}),s.jsxs("button",{onClick:i,className:"admin-login-theme-btn",title:a==="dark"?"Světlý režim":"Tmavý režim",children:[s.jsx("span",{className:`admin-theme-icon ${a==="light"?"visible":""}`,children:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"5"}),s.jsx("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"})]})}),s.jsx("span",{className:`admin-theme-icon ${a==="dark"?"visible":""}`,children:s.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})})]}),s.jsx(Ie,{mode:"wait",children:j?s.jsxs(Q.div,{className:"admin-login-card",initial:{opacity:0,y:30},animate:y?{opacity:1,y:0,x:[0,-12,12,-8,8,-4,4,0]}:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:y?{x:{duration:.5,ease:"easeOut"}}:{duration:.3},children:[s.jsxs("div",{className:"admin-login-header",children:[s.jsx("div",{className:"admin-login-2fa-icon",children:s.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[s.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),s.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),s.jsx("h1",{className:"admin-login-title",children:"Dvoufaktorové ověření"}),s.jsx("p",{className:"admin-login-subtitle",children:N?"Zadejte jeden ze záložních kódů":"Zadejte 6místný kód z autentizační aplikace"})]}),s.jsxs("form",{onSubmit:E,className:"admin-form",children:[s.jsx(tn,{label:N?"Záložní kód":"Ověřovací kód",children:s.jsx("input",{ref:T,id:"totp-code",type:"text",inputMode:N?"text":"numeric",pattern:N?void 0:"[0-9]*",maxLength:N?8:6,value:w,onChange:L=>{const R=N?L.target.value:L.target.value.replace(/\D/g,"");S(R)},required:!0,autoComplete:"one-time-code",className:"admin-form-input",placeholder:N?"XXXXXXXX":"000000",style:N?{}:{textAlign:"center",fontSize:"1.5rem",letterSpacing:"0.5rem",fontFamily:"monospace"}})}),s.jsx("button",{type:"submit",disabled:f,className:"admin-btn admin-btn-primary",style:{width:"100%"},children:f?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"admin-spinner",style:{width:20,height:20,borderWidth:2}}),"Ověřování..."]}):"Ověřit"})]}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",marginTop:"0.5rem"},children:[s.jsx("button",{onClick:()=>{A(!N),S("")},className:"admin-back-link",style:{border:"none",background:"none",cursor:"pointer"},children:N?"Použít autentizační aplikaci":"Použít záložní kód"}),s.jsx("button",{onClick:O,className:"admin-back-link",style:{border:"none",background:"none",cursor:"pointer"},children:"← Zpět na přihlášení"})]})]},"2fa"):s.jsxs(Q.div,{className:"admin-login-card",initial:{opacity:0,y:30},animate:y?{opacity:1,y:0,x:[0,-12,12,-8,8,-4,4,0]}:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:y?{x:{duration:.5,ease:"easeOut"}}:{duration:.3},children:[s.jsxs("div",{className:"admin-login-header",children:[s.jsx("img",{src:a==="dark"?"/images/logo-dark.png":"/images/logo-light.png",alt:"Logo",className:"admin-login-logo"}),s.jsx("h1",{className:"admin-login-title",children:"Interní systém"}),s.jsx("p",{className:"admin-login-subtitle",children:"Přihlaste se ke svému účtu"})]}),s.jsxs("form",{onSubmit:P,className:"admin-form",children:[s.jsx(tn,{label:"Uživatelské jméno nebo e-mail",children:s.jsx("input",{id:"username",type:"text",value:l,onChange:L=>c(L.target.value),required:!0,autoComplete:"username",className:"admin-form-input",placeholder:"Zadejte uživatelské jméno"})}),s.jsx(tn,{label:"Heslo",children:s.jsx("input",{id:"password",type:"password",value:u,onChange:L=>p(L.target.value),required:!0,autoComplete:"current-password",className:"admin-form-input",placeholder:"Zadejte heslo"})}),s.jsxs("label",{className:"admin-form-checkbox",children:[s.jsx("input",{type:"checkbox",checked:d,onChange:L=>m(L.target.checked)}),s.jsx("span",{children:"Zapamatovat si mě"})]}),s.jsx("button",{type:"submit",disabled:f,className:"admin-btn admin-btn-primary",style:{width:"100%"},children:f?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"admin-spinner",style:{width:20,height:20,borderWidth:2}}),"Přihlašování..."]}):"Přihlásit se"})]})]},"login")})]})}const io={vacation:"Dovolená",sick:"Nemoc",holiday:"Svátek",unpaid:"Neplacené volno"},Un={in:"dash-status-in",away:"dash-status-away",out:"dash-status-out",leave:"dash-status-leave"},lo={in:"Přítomen",away:"Přestávka",out:"Nepřihlášen",leave:"Nepřítomen"},co={user:"Uživatel",attendance:"Docházka",leave_request:"Žádost o nepřítomnost",offers_quotation:"Nabídka",offers_customer:"Zákazník",offers_item_template:"Šablona položky",offers_scope_template:"Šablona rozsahu",offers_settings:"Nastavení nabídek",orders_order:"Objednávka",invoices_invoice:"Faktura",projects_project:"Projekt",role:"Role",trips:"Jízda",vehicles:"Vozidlo",bank_account:"Bankovní účet"};function uo(){const r=new Date,o=["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"],t=["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],e=o[r.getDay()],n=new Date(r.getFullYear(),0,1),a=Math.ceil(((r.getTime()-n.getTime())/864e5+n.getDay()+1)/7);return`${e}, ${r.getDate()}. ${t[r.getMonth()]} ${r.getFullYear()} · Týden ${a}`}function po(r){return{create:"success",update:"info",delete:"danger",login:"accent"}[r]||"muted"}function fo(r){const o=new Date(r),t=new Date,e=t.getTime()-o.getTime();return e<6e4?"Právě teď":e<36e5?`${Math.floor(e/6e4)} min`:o.toDateString()===t.toDateString()?o.toLocaleTimeString("cs-CZ",{hour:"2-digit",minute:"2-digit"}):o.toLocaleDateString("cs-CZ",{day:"2-digit",month:"2-digit"})}function mo(r){return new Date(r).toLocaleDateString("cs-CZ",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"})}function nn(r,o){const t=Number(r)||0;switch(o){case"EUR":return`${t.toLocaleString("cs-CZ",{minimumFractionDigits:2,maximumFractionDigits:2})} €`;case"USD":return`$${t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`;case"CZK":return`${t.toLocaleString("cs-CZ",{minimumFractionDigits:2,maximumFractionDigits:2})} Kč`;case"GBP":return`£${t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`;default:return`${t.toFixed(2)} ${o}`}}function ec(r){return r?new Date(r).toLocaleDateString("cs-CZ"):"—"}function ho(r){return new Intl.NumberFormat("cs-CZ").format(Number(r)||0)}function tc(r,o,t,e){return r===1?o:r>=2&&r<=4?t:e}function vo(r){const o=[];return r?.attendance&&o.push({label:"Přítomní dnes",value:`${r.attendance.present_today}`,sub:`/ ${r.attendance.total_active}`,color:"success",footer:r.attendance.on_leave>0?`${r.attendance.on_leave} nepřítomných`:null}),r?.offers&&o.push({label:"Otevřené nabídky",value:`${r.offers.open_count}`,color:"info",footer:r.offers.created_this_month>0?`${r.offers.created_this_month} tento měsíc`:null}),r?.invoices&&o.push(yo(r.invoices)),r?.leave_pending&&o.push({label:"Žádosti o volno",value:`${r.leave_pending.count}`,color:"danger",footer:r.leave_pending.count>0?"čeká na schválení":null}),o}function yo(r){const o=r.revenue_this_month||[],t=o.some(u=>u.currency!=="CZK"),e=t&&r.revenue_czk!==null&&r.revenue_czk!==void 0,n=o.length>0?o.map(u=>nn(u.amount,u.currency)).join(" · "):"0 Kč",a=e?nn(r.revenue_czk,"CZK"):n,i=t&&o.length>0?o.map(u=>nn(u.amount,u.currency)).join(" · "):null,l=r.unpaid_count>0?`${r.unpaid_count} neuhrazených`:null,c=[i,l].filter(Boolean);return{label:"Tržby (měsíc)",value:a,color:"warning",footer:c.length>0?c.join(" · "):null}}const go={4:"dash-kpi-4",3:"dash-kpi-3",2:"dash-kpi-2",1:"dash-kpi-1"};function xo({dashData:r}){const o=vo(r);if(o.length===0)return null;const t=go[Math.min(o.length,4)]||"dash-kpi-4";return s.jsx(Q.div,{className:`dash-kpi-grid ${t}`,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.1},children:o.map(e=>s.jsxs("div",{className:`admin-stat-card ${e.color}`,children:[s.jsx("div",{className:"admin-stat-label",children:e.label}),s.jsxs("div",{className:"admin-stat-value admin-mono",children:[e.value,e.sub&&s.jsx("small",{className:"text-muted",style:{fontSize:"0.75em",fontWeight:500,marginLeft:"0.25rem"},children:e.sub})]}),e.footer&&s.jsx("div",{className:"admin-stat-footer",children:e.footer})]},e.label))})}function $r(r){var o,t,e="";if(typeof r=="string"||typeof r=="number")e+=r;else if(typeof r=="object")if(Array.isArray(r)){var n=r.length;for(o=0;o"u"?!1:r instanceof ShadowRoot||r instanceof oe(r).ShadowRoot}function bt(r){const{overflow:o,overflowX:t,overflowY:e,display:n}=le(r);return/auto|scroll|overlay|hidden|clip/.test(o+e+t)&&n!=="inline"&&n!=="contents"}function bo(r){return/^(table|td|th)$/.test(nt(r))}function Qt(r){try{if(r.matches(":popover-open"))return!0}catch{}try{return r.matches(":modal")}catch{return!1}}const ko=/transform|translate|scale|rotate|perspective|filter/,wo=/paint|layout|strict|content/,Pe=r=>!!r&&r!=="none";let rn;function Mn(r){const o=ee(r)?le(r):r;return Pe(o.transform)||Pe(o.translate)||Pe(o.scale)||Pe(o.rotate)||Pe(o.perspective)||!En()&&(Pe(o.backdropFilter)||Pe(o.filter))||ko.test(o.willChange||"")||wo.test(o.contain||"")}function _o(r){let o=Ne(r);for(;_e(o)&&!Xe(o);){if(Mn(o))return o;if(Qt(o))return null;o=Ne(o)}return null}function En(){return rn==null&&(rn=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),rn}function Xe(r){return/^(html|body|#document)$/.test(nt(r))}function le(r){return oe(r).getComputedStyle(r)}function Zt(r){return ee(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function Ne(r){if(nt(r)==="html")return r;const o=r.assignedSlot||r.parentNode||Qn(r)&&r.host||ve(r);return Qn(o)?o.host:o}function Ur(r){const o=Ne(r);return Xe(o)?r.ownerDocument?r.ownerDocument.body:r.body:_e(o)&&bt(o)?o:Ur(o)}function gt(r,o,t){var e;o===void 0&&(o=[]),t===void 0&&(t=!0);const n=Ur(r),a=n===((e=r.ownerDocument)==null?void 0:e.body),i=oe(n);if(a){const l=_n(i);return o.concat(i,i.visualViewport||[],bt(n)?n:[],l&&t?gt(l):[])}else return o.concat(n,gt(n,[],t))}function _n(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}const Ge=Math.min,We=Math.max,zt=Math.round,jt=Math.floor,he=r=>({x:r,y:r}),Do={left:"right",right:"left",bottom:"top",top:"bottom"};function jo(r,o,t){return We(r,Ge(o,t))}function qt(r,o){return typeof r=="function"?r(o):r}function Je(r){return r.split("-")[0]}function kt(r){return r.split("-")[1]}function So(r){return r==="x"?"y":"x"}function Pn(r){return r==="y"?"height":"width"}function Ae(r){const o=r[0];return o==="t"||o==="b"?"y":"x"}function Tn(r){return So(Ae(r))}function Co(r,o,t){t===void 0&&(t=!1);const e=kt(r),n=Tn(r),a=Pn(n);let i=n==="x"?e===(t?"end":"start")?"right":"left":e==="start"?"bottom":"top";return o.reference[a]>o.floating[a]&&(i=Bt(i)),[i,Bt(i)]}function No(r){const o=Bt(r);return[Dn(r),o,Dn(o)]}function Dn(r){return r.includes("start")?r.replace("start","end"):r.replace("end","start")}const Zn=["left","right"],qn=["right","left"],Mo=["top","bottom"],Eo=["bottom","top"];function Po(r,o,t){switch(r){case"top":case"bottom":return t?o?qn:Zn:o?Zn:qn;case"left":case"right":return o?Mo:Eo;default:return[]}}function To(r,o,t,e){const n=kt(r);let a=Po(Je(r),t==="start",e);return n&&(a=a.map(i=>i+"-"+n),o&&(a=a.concat(a.map(Dn)))),a}function Bt(r){const o=Je(r);return Do[o]+r.slice(o.length)}function Oo(r){return{top:0,right:0,bottom:0,left:0,...r}}function Qr(r){return typeof r!="number"?Oo(r):{top:r,right:r,bottom:r,left:r}}function Ht(r){const{x:o,y:t,width:e,height:n}=r;return{width:e,height:n,top:t,left:o,right:o+e,bottom:t+n,x:o,y:t}}var Ao=typeof document<"u",Ro=function(){},Vt=Ao?v.useLayoutEffect:Ro;const Lo={...Er},Io=Lo.useInsertionEffect,Fo=Io||(r=>r());function Yo(r){const o=v.useRef(()=>{});return Fo(()=>{o.current=r}),v.useCallback(function(){for(var t=arguments.length,e=new Array(t),n=0;n{const{placement:e="bottom",strategy:n="absolute",middleware:a=[],platform:i}=t,l=i.detectOverflow?i:{...i,detectOverflow:Wo},c=await(i.isRTL==null?void 0:i.isRTL(o));let u=await i.getElementRects({reference:r,floating:o,strategy:n}),{x:p,y:d}=Xn(u,e,c),m=e,f=0;const h={};for(let y=0;y({name:"arrow",options:r,async fn(o){const{x:t,y:e,placement:n,rects:a,platform:i,elements:l,middlewareData:c}=o,{element:u,padding:p=0}=qt(r,o)||{};if(u==null)return{};const d=Qr(p),m={x:t,y:e},f=Tn(n),h=Pn(f),y=await i.getDimensions(u),g=f==="y",k=g?"top":"left",_=g?"bottom":"right",j=g?"clientHeight":"clientWidth",C=a.reference[h]+a.reference[f]-m[f]-a.floating[h],D=m[f]-a.reference[f],b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let w=b?b[j]:0;(!w||!await(i.isElement==null?void 0:i.isElement(b)))&&(w=l.floating[j]||a.floating[h]);const S=C/2-D/2,N=w/2-y[h]/2-1,A=Ge(d[k],N),T=Ge(d[_],N),P=A,E=w-y[h]-T,O=w/2-y[h]/2+S,L=jo(P,O,E),R=!c.arrow&&kt(n)!=null&&O!==L&&a.reference[h]/2-(OO<=0)){var T,P;const O=(((T=a.flip)==null?void 0:T.index)||0)+1,L=w[O];if(L&&(!(d==="alignment"?_!==Ae(L):!1)||A.every(V=>Ae(V.placement)===_?V.overflows[0]>0:!0)))return{data:{index:O,overflows:A},reset:{placement:L}};let R=(P=A.filter(I=>I.overflows[0]<=0).sort((I,V)=>I.overflows[1]-V.overflows[1])[0])==null?void 0:P.placement;if(!R)switch(f){case"bestFit":{var E;const I=(E=A.filter(V=>{if(b){const z=Ae(V.placement);return z===_||z==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(z=>z>0).reduce((z,$)=>z+$,0)]).sort((V,z)=>V[1]-z[1])[0])==null?void 0:E[0];I&&(R=I);break}case"initialPlacement":R=l;break}if(n!==R)return{reset:{placement:R}}}return{}}}},$o=new Set(["left","top"]);async function Ko(r,o){const{placement:t,platform:e,elements:n}=r,a=await(e.isRTL==null?void 0:e.isRTL(n.floating)),i=Je(t),l=kt(t),c=Ae(t)==="y",u=$o.has(i)?-1:1,p=a&&c?-1:1,d=qt(o,r);let{mainAxis:m,crossAxis:f,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof h=="number"&&(f=l==="end"?h*-1:h),c?{x:f*p,y:m*u}:{x:m*u,y:f*p}}const Uo=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(o){var t,e;const{x:n,y:a,placement:i,middlewareData:l}=o,c=await Ko(o,r);return i===((t=l.offset)==null?void 0:t.placement)&&(e=l.arrow)!=null&&e.alignmentOffset?{}:{x:n+c.x,y:a+c.y,data:{...c,placement:i}}}}};function Zr(r){const o=le(r);let t=parseFloat(o.width)||0,e=parseFloat(o.height)||0;const n=_e(r),a=n?r.offsetWidth:t,i=n?r.offsetHeight:e,l=zt(t)!==a||zt(e)!==i;return l&&(t=a,e=i),{width:t,height:e,$:l}}function On(r){return ee(r)?r:r.contextElement}function Ze(r){const o=On(r);if(!_e(o))return he(1);const t=o.getBoundingClientRect(),{width:e,height:n,$:a}=Zr(o);let i=(a?zt(t.width):t.width)/e,l=(a?zt(t.height):t.height)/n;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Qo=he(0);function qr(r){const o=oe(r);return!En()||!o.visualViewport?Qo:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function Zo(r,o,t){return o===void 0&&(o=!1),!t||o&&t!==oe(r)?!1:o}function Be(r,o,t,e){o===void 0&&(o=!1),t===void 0&&(t=!1);const n=r.getBoundingClientRect(),a=On(r);let i=he(1);o&&(e?ee(e)&&(i=Ze(e)):i=Ze(r));const l=Zo(a,t,e)?qr(a):he(0);let c=(n.left+l.x)/i.x,u=(n.top+l.y)/i.y,p=n.width/i.x,d=n.height/i.y;if(a){const m=oe(a),f=e&&ee(e)?oe(e):e;let h=m,y=_n(h);for(;y&&e&&f!==h;){const g=Ze(y),k=y.getBoundingClientRect(),_=le(y),j=k.left+(y.clientLeft+parseFloat(_.paddingLeft))*g.x,C=k.top+(y.clientTop+parseFloat(_.paddingTop))*g.y;c*=g.x,u*=g.y,p*=g.x,d*=g.y,c+=j,u+=C,h=oe(y),y=_n(h)}}return Ht({width:p,height:d,x:c,y:u})}function Xt(r,o){const t=Zt(r).scrollLeft;return o?o.left+t:Be(ve(r)).left+t}function Xr(r,o){const t=r.getBoundingClientRect(),e=t.left+o.scrollLeft-Xt(r,t),n=t.top+o.scrollTop;return{x:e,y:n}}function qo(r){let{elements:o,rect:t,offsetParent:e,strategy:n}=r;const a=n==="fixed",i=ve(e),l=o?Qt(o.floating):!1;if(e===i||l&&a)return t;let c={scrollLeft:0,scrollTop:0},u=he(1);const p=he(0),d=_e(e);if((d||!d&&!a)&&((nt(e)!=="body"||bt(i))&&(c=Zt(e)),d)){const f=Be(e);u=Ze(e),p.x=f.x+e.clientLeft,p.y=f.y+e.clientTop}const m=i&&!d&&!a?Xr(i,c):he(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-c.scrollLeft*u.x+p.x+m.x,y:t.y*u.y-c.scrollTop*u.y+p.y+m.y}}function Xo(r){return Array.from(r.getClientRects())}function Go(r){const o=ve(r),t=Zt(r),e=r.ownerDocument.body,n=We(o.scrollWidth,o.clientWidth,e.scrollWidth,e.clientWidth),a=We(o.scrollHeight,o.clientHeight,e.scrollHeight,e.clientHeight);let i=-t.scrollLeft+Xt(r);const l=-t.scrollTop;return le(e).direction==="rtl"&&(i+=We(o.clientWidth,e.clientWidth)-n),{width:n,height:a,x:i,y:l}}const Gn=25;function Jo(r,o){const t=oe(r),e=ve(r),n=t.visualViewport;let a=e.clientWidth,i=e.clientHeight,l=0,c=0;if(n){a=n.width,i=n.height;const p=En();(!p||p&&o==="fixed")&&(l=n.offsetLeft,c=n.offsetTop)}const u=Xt(e);if(u<=0){const p=e.ownerDocument,d=p.body,m=getComputedStyle(d),f=p.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(e.clientWidth-d.clientWidth-f);h<=Gn&&(a-=h)}else u<=Gn&&(a+=u);return{width:a,height:i,x:l,y:c}}function es(r,o){const t=Be(r,!0,o==="fixed"),e=t.top+r.clientTop,n=t.left+r.clientLeft,a=_e(r)?Ze(r):he(1),i=r.clientWidth*a.x,l=r.clientHeight*a.y,c=n*a.x,u=e*a.y;return{width:i,height:l,x:c,y:u}}function Jn(r,o,t){let e;if(o==="viewport")e=Jo(r,t);else if(o==="document")e=Go(ve(r));else if(ee(o))e=es(o,t);else{const n=qr(r);e={x:o.x-n.x,y:o.y-n.y,width:o.width,height:o.height}}return Ht(e)}function Gr(r,o){const t=Ne(r);return t===o||!ee(t)||Xe(t)?!1:le(t).position==="fixed"||Gr(t,o)}function ts(r,o){const t=o.get(r);if(t)return t;let e=gt(r,[],!1).filter(l=>ee(l)&&nt(l)!=="body"),n=null;const a=le(r).position==="fixed";let i=a?Ne(r):r;for(;ee(i)&&!Xe(i);){const l=le(i),c=Mn(i);!c&&l.position==="fixed"&&(n=null),(a?!c&&!n:!c&&l.position==="static"&&!!n&&(n.position==="absolute"||n.position==="fixed")||bt(i)&&!c&&Gr(r,i))?e=e.filter(p=>p!==i):n=l,i=Ne(i)}return o.set(r,e),e}function ns(r){let{element:o,boundary:t,rootBoundary:e,strategy:n}=r;const i=[...t==="clippingAncestors"?Qt(o)?[]:ts(o,this._c):[].concat(t),e],l=Jn(o,i[0],n);let c=l.top,u=l.right,p=l.bottom,d=l.left;for(let m=1;m{i(!1,1e-7)},1e3)}w===1&&!ea(u,r.getBoundingClientRect())&&i(),C=!1}try{t=new IntersectionObserver(D,{...j,root:n.ownerDocument})}catch{t=new IntersectionObserver(D,j)}t.observe(r)}return i(!0),a}function cs(r,o,t,e){e===void 0&&(e={});const{ancestorScroll:n=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=e,u=On(r),p=n||a?[...u?gt(u):[],...o?gt(o):[]]:[];p.forEach(k=>{n&&k.addEventListener("scroll",t,{passive:!0}),a&&k.addEventListener("resize",t)});const d=u&&l?ls(u,t):null;let m=-1,f=null;i&&(f=new ResizeObserver(k=>{let[_]=k;_&&_.target===u&&f&&o&&(f.unobserve(o),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var j;(j=f)==null||j.observe(o)})),t()}),u&&!c&&f.observe(u),o&&f.observe(o));let h,y=c?Be(r):null;c&&g();function g(){const k=Be(r);y&&!ea(y,k)&&t(),y=k,h=requestAnimationFrame(g)}return t(),()=>{var k;p.forEach(_=>{n&&_.removeEventListener("scroll",t),a&&_.removeEventListener("resize",t)}),d?.(),(k=f)==null||k.disconnect(),f=null,c&&cancelAnimationFrame(h)}}const ds=Uo,us=Vo,tr=Ho,ps=(r,o,t)=>{const e=new Map,n={platform:is,...t},a={...n.platform,_c:e};return Bo(r,o,{...n,platform:a})};var fs=typeof document<"u",ms=function(){},Rt=fs?v.useLayoutEffect:ms;function $t(r,o){if(r===o)return!0;if(typeof r!=typeof o)return!1;if(typeof r=="function"&&r.toString()===o.toString())return!0;let t,e,n;if(r&&o&&typeof r=="object"){if(Array.isArray(r)){if(t=r.length,t!==o.length)return!1;for(e=t;e--!==0;)if(!$t(r[e],o[e]))return!1;return!0}if(n=Object.keys(r),t=n.length,t!==Object.keys(o).length)return!1;for(e=t;e--!==0;)if(!{}.hasOwnProperty.call(o,n[e]))return!1;for(e=t;e--!==0;){const a=n[e];if(!(a==="_owner"&&r.$$typeof)&&!$t(r[a],o[a]))return!1}return!0}return r!==r&&o!==o}function ta(r){return typeof window>"u"?1:(r.ownerDocument.defaultView||window).devicePixelRatio||1}function nr(r,o){const t=ta(r);return Math.round(o*t)/t}function on(r){const o=v.useRef(r);return Rt(()=>{o.current=r}),o}function hs(r){r===void 0&&(r={});const{placement:o="bottom",strategy:t="absolute",middleware:e=[],platform:n,elements:{reference:a,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=r,[p,d]=v.useState({x:0,y:0,strategy:t,placement:o,middlewareData:{},isPositioned:!1}),[m,f]=v.useState(e);$t(m,e)||f(e);const[h,y]=v.useState(null),[g,k]=v.useState(null),_=v.useCallback(V=>{V!==b.current&&(b.current=V,y(V))},[]),j=v.useCallback(V=>{V!==w.current&&(w.current=V,k(V))},[]),C=a||h,D=i||g,b=v.useRef(null),w=v.useRef(null),S=v.useRef(p),N=c!=null,A=on(c),T=on(n),P=on(u),E=v.useCallback(()=>{if(!b.current||!w.current)return;const V={placement:o,strategy:t,middleware:m};T.current&&(V.platform=T.current),ps(b.current,w.current,V).then(z=>{const $={...z,isPositioned:P.current!==!1};O.current&&!$t(S.current,$)&&(S.current=$,Nr.flushSync(()=>{d($)}))})},[m,o,t,T,P]);Rt(()=>{u===!1&&S.current.isPositioned&&(S.current.isPositioned=!1,d(V=>({...V,isPositioned:!1})))},[u]);const O=v.useRef(!1);Rt(()=>(O.current=!0,()=>{O.current=!1}),[]),Rt(()=>{if(C&&(b.current=C),D&&(w.current=D),C&&D){if(A.current)return A.current(C,D,E);E()}},[C,D,E,A,N]);const L=v.useMemo(()=>({reference:b,floating:w,setReference:_,setFloating:j}),[_,j]),R=v.useMemo(()=>({reference:C,floating:D}),[C,D]),I=v.useMemo(()=>{const V={position:t,left:0,top:0};if(!R.floating)return V;const z=nr(R.floating,p.x),$=nr(R.floating,p.y);return l?{...V,transform:"translate("+z+"px, "+$+"px)",...ta(R.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:z,top:$}},[t,l,R.floating,p.x,p.y]);return v.useMemo(()=>({...p,update:E,refs:L,elements:R,floatingStyles:I}),[p,E,L,R,I])}const vs=r=>{function o(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:r,fn(t){const{element:e,padding:n}=typeof r=="function"?r(t):r;return e&&o(e)?e.current!=null?tr({element:e.current,padding:n}).fn(t):{}:e?tr({element:e,padding:n}).fn(t):{}}}},ys=(r,o)=>{const t=ds(r);return{name:t.name,fn:t.fn,options:[r,o]}},gs=(r,o)=>{const t=us(r);return{name:t.name,fn:t.fn,options:[r,o]}},xs=(r,o)=>{const t=vs(r);return{name:t.name,fn:t.fn,options:[r,o]}},bs={...Er};let rr=!1,ks=0;const ar=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ks++;function ws(){const[r,o]=v.useState(()=>rr?ar():void 0);return Vt(()=>{r==null&&o(ar())},[]),v.useEffect(()=>{rr=!0},[]),r}const _s=bs.useId,na=_s||ws,Ds=v.forwardRef(function(o,t){const{context:{placement:e,elements:{floating:n},middlewareData:{arrow:a,shift:i}},width:l=14,height:c=7,tipRadius:u=0,strokeWidth:p=0,staticOffset:d,stroke:m,d:f,style:{transform:h,...y}={},...g}=o,k=na(),[_,j]=v.useState(!1);if(Vt(()=>{if(!n)return;le(n).direction==="rtl"&&j(!0)},[n]),!n)return null;const[C,D]=e.split("-"),b=C==="top"||C==="bottom";let w=d;(b&&i!=null&&i.x||!b&&i!=null&&i.y)&&(w=null);const S=p*2,N=S/2,A=l/2*(u/-8+1),T=c/2*u/4,P=!!f,E=w&&D==="end"?"bottom":"top";let O=w&&D==="end"?"right":"left";w&&_&&(O=D==="end"?"left":"right");const L=a?.x!=null?w||a.x:"",R=a?.y!=null?w||a.y:"",I=f||"M0,0"+(" H"+l)+(" L"+(l-A)+","+(c-T))+(" Q"+l/2+","+c+" "+A+","+(c-T))+" Z",V={top:P?"rotate(180deg)":"",left:P?"rotate(90deg)":"rotate(-90deg)",bottom:P?"":"rotate(180deg)",right:P?"rotate(-90deg)":"rotate(90deg)"}[C];return s.jsxs("svg",{...g,"aria-hidden":!0,ref:t,width:P?l:l+S,height:l,viewBox:"0 0 "+l+" "+(c>l?c:l),style:{position:"absolute",pointerEvents:"none",[O]:L,[E]:R,[C]:b||P?"100%":"calc(100% - "+S/2+"px)",transform:[V,h].filter(z=>!!z).join(" "),...y},children:[S>0&&s.jsx("path",{clipPath:"url(#"+k+")",fill:"none",stroke:m,strokeWidth:S+(f?0:1),d:I}),s.jsx("path",{stroke:S&&!f?g.fill:"none",d:I}),s.jsx("clipPath",{id:k,children:s.jsx("rect",{x:-N,y:N*(P?-1:1),width:l+S,height:l})})]})});function js(){const r=new Map;return{emit(o,t){var e;(e=r.get(o))==null||e.forEach(n=>n(t))},on(o,t){r.has(o)||r.set(o,new Set),r.get(o).add(t)},off(o,t){var e;(e=r.get(o))==null||e.delete(t)}}}const Ss=v.createContext(null),Cs=v.createContext(null),Ns=()=>{var r;return((r=v.useContext(Ss))==null?void 0:r.id)||null},Ms=()=>v.useContext(Cs);function Es(r){const{open:o=!1,onOpenChange:t,elements:e}=r,n=na(),a=v.useRef({}),[i]=v.useState(()=>js()),l=Ns()!=null,[c,u]=v.useState(e.reference),p=Yo((f,h,y)=>{a.current.openEvent=f?h:void 0,i.emit("openchange",{open:f,event:h,reason:y,nested:l}),t?.(f,h,y)}),d=v.useMemo(()=>({setPositionReference:u}),[]),m=v.useMemo(()=>({reference:c||e.reference||null,floating:e.floating||null,domReference:e.reference}),[c,e.reference,e.floating]);return v.useMemo(()=>({dataRef:a,open:o,onOpenChange:p,elements:m,events:i,floatingId:n,refs:d}),[o,p,m,i,n,d])}function Ps(r){r===void 0&&(r={});const{nodeId:o}=r,t=Es({...r,elements:{reference:null,floating:null,...r.elements}}),e=r.rootContext||t,n=e.elements,[a,i]=v.useState(null),[l,c]=v.useState(null),p=n?.domReference||a,d=v.useRef(null),m=Ms();Vt(()=>{p&&(d.current=p)},[p]);const f=hs({...r,elements:{...n,...l&&{reference:l}}}),h=v.useCallback(j=>{const C=ee(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;c(C),f.refs.setReference(C)},[f.refs]),y=v.useCallback(j=>{(ee(j)||j===null)&&(d.current=j,i(j)),(ee(f.refs.reference.current)||f.refs.reference.current===null||j!==null&&!ee(j))&&f.refs.setReference(j)},[f.refs]),g=v.useMemo(()=>({...f.refs,setReference:y,setPositionReference:h,domReference:d}),[f.refs,y,h]),k=v.useMemo(()=>({...f.elements,domReference:p}),[f.elements,p]),_=v.useMemo(()=>({...f,...e,refs:g,elements:k,nodeId:o}),[f,g,k,o,e]);return Vt(()=>{e.dataRef.current.floatingContext=_;const j=m?.nodesRef.current.find(C=>C.id===o);j&&(j.context=_)}),v.useMemo(()=>({...f,context:_,refs:g,elements:k}),[f,g,k,_])}/*! react-datepicker v9.1.0 https://github.com/Hacker0x01/react-datepicker Released under the MIT License. */var jn=function(o,t){return jn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])},jn(o,t)};function q(r,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");jn(r,o);function t(){this.constructor=r}r.prototype=o===null?Object.create(o):(t.prototype=o.prototype,new t)}var F=function(){return F=Object.assign||function(t){for(var e,n=1,a=arguments.length;n=8){var d=new Date(r);if(vt(d))return d}return null}function As(r,o){if(o===void 0&&(o=H()),!r)return null;var t=r.match(/\b(1\d{3}|2\d{3})\b/);if(!t||!t[1])return null;var e=parseInt(t[1],10),n=r.match(/(?:^|[/\-\s])?(0?[1-9]|1[0-2])(?:[/\-\s]|$)/),a=n&&n[1]?parseInt(n[1],10)-1:o.getMonth();return new Date(e,a,1)}function ne(r){return vt(r)}function Re(r){return r==null?null:ke(r)&&vt(r)?r:null}function U(r,o,t){if(t==="en")return ft(r,o,{useAdditionalWeekYearTokens:!0,useAdditionalDayOfYearTokens:!0});var e=t?et(t):void 0;return t&&!e&&console.warn('A locale object was not found for the provided string ["'.concat(t,'"].')),e=e||et(Rn()),ft(r,o,{locale:e,useAdditionalWeekYearTokens:!0,useAdditionalDayOfYearTokens:!0})}function te(r,o){var t=o.dateFormat,e=o.locale,n=Array.isArray(t)&&t.length>0?t[0]:t;return r&&U(r,n,e)||""}var aa=" - ";function Rs(r,o,t){if(!r&&!o)return"";var e=r?te(r,t):"",n=o?te(o,t):"",a=t.rangeSeparator||aa;return"".concat(e).concat(a).concat(n)}function Ls(r,o){if(!r?.length)return"";var t=r[0]?te(r[0],o):"";if(r.length===1)return t;if(r.length===2&&r[1]){var e=te(r[1],o);return"".concat(t,", ").concat(e)}var n=r.length-1;return"".concat(t," (+").concat(n,")")}function ge(r,o){var t=o.hour,e=t===void 0?0:t,n=o.minute,a=n===void 0?0:n,i=o.second,l=i===void 0?0:i;return Tt(Ot(At(r,l),a),e)}function Is(r){return Aa(r)}function Fs(r,o){return U(r,"ddd",o)}function ut(r){return Sn(r)}function je(r,o,t){var e=et(o||Rn());return Na(r,{locale:e,weekStartsOn:t})}function we(r){return Lr(r)}function pt(r){return Cn(r)}function ir(r){return Pa(r)}function lr(){return Sn(H())}function cr(r){return Or(r)}function Ys(r){return Ma(r)}function Ws(r){return Rr(r)}function ue(r,o){return r&&o?ja(r,o):!r&&!o}function J(r,o){return r&&o?Sa(r,o):!r&&!o}function Kt(r,o){return r&&o?Ea(r,o):!r&&!o}function W(r,o){return r&&o?_a(r,o):!r&&!o}function Le(r,o){return r&&o?ka(r,o):!r&&!o}function Oe(r,o,t){var e,n=Sn(o),a=Or(t);try{e=yt(r,{start:n,end:a})}catch{e=!1}return e}function zs(r,o){var t=An();t.__localeData__||(t.__localeData__={}),t.__localeData__[r]=o}function Rn(){var r=An();return r.__localeId__}function et(r){if(typeof r=="string"){var o=An();return o.__localeData__?o.__localeData__[r]:void 0}else return r}function Bs(r,o,t){return o(U(r,"EEEE",t))}function Hs(r,o){return U(r,"EEEEEE",o)}function Vs(r,o){return U(r,"EEE",o)}function Ln(r,o){return U(se(H(),r),"LLLL",o)}function oa(r,o){return U(se(H(),r),"LLL",o)}function $s(r,o){return U(Ke(H(),r),"QQQ",o)}function ie(r,o){var t=o===void 0?{}:o,e=t.minDate,n=t.maxDate,a=t.excludeDates,i=t.excludeDateIntervals,l=t.includeDates,c=t.includeDateIntervals,u=t.filterDate,p=t.disabled;return p?!0:_t(r,{minDate:e,maxDate:n})||a&&a.some(function(d){return d instanceof Date?W(r,d):W(r,d.date)})||i&&i.some(function(d){var m=d.start,f=d.end;return yt(r,{start:m,end:f})})||l&&!l.some(function(d){return W(r,d)})||c&&!c.some(function(d){var m=d.start,f=d.end;return yt(r,{start:m,end:f})})||u&&!u(H(r))||!1}function In(r,o){var t=o===void 0?{}:o,e=t.excludeDates,n=t.excludeDateIntervals;return n&&n.length>0?n.some(function(a){var i=a.start,l=a.end;return yt(r,{start:i,end:l})}):e&&e.some(function(a){var i;return a instanceof Date?W(r,a):W(r,(i=a.date)!==null&&i!==void 0?i:new Date)})||!1}function sa(r,o){var t=o===void 0?{}:o,e=t.minDate,n=t.maxDate,a=t.excludeDates,i=t.includeDates,l=t.filterDate;return _t(r,{minDate:e?Lr(e):void 0,maxDate:n?Rr(n):void 0})||a?.some(function(c){return J(r,c instanceof Date?c:c.date)})||i&&!i.some(function(c){return J(r,c)})||l&&!l(H(r))||!1}function Ct(r,o,t,e){var n=Y(r),a=re(r),i=Y(o),l=re(o),c=Y(e);return n===i&&n===c?a<=t&&t<=l:n=t||cn:!1}function Ks(r,o){var t=o===void 0?{}:o,e=t.minDate,n=t.maxDate,a=t.excludeDates,i=t.includeDates;return _t(r,{minDate:e,maxDate:n})||a&&a.some(function(l){return J(l instanceof Date?l:l.date,r)})||i&&!i.some(function(l){return J(l,r)})||!1}function Nt(r,o){var t=o===void 0?{}:o,e=t.minDate,n=t.maxDate,a=t.excludeDates,i=t.includeDates,l=t.filterDate,c=t.disabled;return c?!0:_t(r,{minDate:e,maxDate:n})||a?.some(function(u){return Kt(r,u instanceof Date?u:u.date)})||i&&!i.some(function(u){return Kt(r,u)})||l&&!l(H(r))||!1}function Mt(r,o,t){if(!o||!t||!vt(o)||!vt(t))return!1;var e=Y(o),n=Y(t);return e<=r&&n>=r}function Lt(r,o){var t=o===void 0?{}:o,e=t.minDate,n=t.maxDate,a=t.excludeDates,i=t.includeDates,l=t.filterDate,c=t.disabled;if(c)return!0;var u=new Date(r,0,1);return _t(u,{minDate:e?Cn(e):void 0,maxDate:n?Ar(n):void 0})||a?.some(function(p){return ue(u,p instanceof Date?p:p.date)})||i&&!i.some(function(p){return ue(u,p)})||l&&!l(H(u))||!1}function Et(r,o,t,e){var n=Y(r),a=Ue(r),i=Y(o),l=Ue(o),c=Y(e);return n===i&&n===c?a<=t&&t<=l:n=t||cn:!1}function _t(r,o){var t,e=o===void 0?{}:o,n=e.minDate,a=e.maxDate;return(t=n&&It(r,n)<0||a&&It(r,a)>0)!==null&&t!==void 0?t:!1}function dr(r,o){return o.some(function(t){return G(t)===G(r)&&X(t)===X(r)&&De(t)===De(r)})}function ur(r,o){var t=o===void 0?{}:o,e=t.excludeTimes,n=t.includeTimes,a=t.filterTime;return e&&dr(r,e)||n&&!dr(r,n)||a&&!a(r)||!1}function pr(r,o){var t=o.minTime,e=o.maxTime;if(!t||!e)throw new Error("Both minTime and maxTime props required");var n=H();n=Tt(n,G(r)),n=Ot(n,X(r)),n=At(n,De(r));var a=H();a=Tt(a,G(t)),a=Ot(a,X(t)),a=At(a,De(t));var i=H();i=Tt(i,G(e)),i=Ot(i,X(e)),i=At(i,De(e));var l;try{l=!yt(n,{start:a,end:i})}catch{l=!1}return l}function fr(r,o){var t=o===void 0?{}:o,e=t.minDate,n=t.includeDates,a=Fe(r,1);return e&&Ft(e,a)>0||n&&n.every(function(i){return Ft(i,a)>0})||!1}function mr(r,o){var t=o===void 0?{}:o,e=t.maxDate,n=t.includeDates,a=Se(r,1);return e&&Ft(a,e)>0||n&&n.every(function(i){return Ft(a,i)>0})||!1}function Us(r,o){var t=o===void 0?{}:o,e=t.minDate,n=t.includeDates,a=Cn(r),i=Ir(a);return e&&Yt(e,i)>0||n&&n.every(function(l){return Yt(l,i)>0})||!1}function Qs(r,o){var t=o===void 0?{}:o,e=t.maxDate,n=t.includeDates,a=Ar(r),i=Fr(a,1);return e&&Yt(i,e)>0||n&&n.every(function(l){return Yt(i,l)>0})||!1}function hr(r,o){var t=o===void 0?{}:o,e=t.minDate,n=t.includeDates,a=Ce(r,1);return e&&Wt(e,a)>0||n&&n.every(function(i){return Wt(i,a)>0})||!1}function Zs(r,o){var t=o===void 0?{}:o,e=t.minDate,n=t.yearItemNumber,a=n===void 0?wt:n,i=pt(Ce(r,a)),l=xe(i,a).endPeriod,c=e&&Y(e);return c&&c>l||!1}function vr(r,o){var t=o===void 0?{}:o,e=t.maxDate,n=t.includeDates,a=me(r,1);return e&&Wt(a,e)>0||n&&n.every(function(i){return Wt(a,i)>0})||!1}function qs(r,o){var t=o===void 0?{}:o,e=t.maxDate,n=t.yearItemNumber,a=n===void 0?wt:n,i=me(r,a),l=xe(i,a).startPeriod,c=e&&Y(e);return c&&c=0});return Wn(e)}else return t?Wn(t):o}function la(r){var o=r.maxDate,t=r.includeDates;if(t&&o){var e=t.filter(function(n){return It(n,o)<=0});return zn(e)}else return t?zn(t):o}function yr(r,o){var t;r===void 0&&(r=[]),o===void 0&&(o="react-datepicker__day--highlighted");for(var e=new Map,n=0,a=r.length;n=ai,f=!n&&!t.isWeekInMonth(l);if(m||f)if(t.props.peekNextMonth)i=!0;else break}return e},t.onMonthClick=function(e,n){var a=t.isMonthDisabledForLabelDate(n),i=a.isDisabled,l=a.labelDate;i||t.handleDayClick(we(l),e)},t.onMonthMouseEnter=function(e){var n=t.isMonthDisabledForLabelDate(e),a=n.isDisabled,i=n.labelDate;a||t.handleDayMouseEnter(we(i))},t.handleMonthNavigation=function(e,n){var a,i,l,c;(i=(a=t.props).setPreSelection)===null||i===void 0||i.call(a,n),(c=(l=t.MONTH_REFS[e])===null||l===void 0?void 0:l.current)===null||c===void 0||c.focus()},t.handleKeyboardNavigation=function(e,n,a){var i,l=t.props,c=l.selected,u=l.preSelection,p=l.setPreSelection,d=l.minDate,m=l.maxDate,f=l.showFourColumnMonthYearPicker,h=l.showTwoColumnMonthYearPicker;if(u){var y=br(f,h),g=t.getVerticalOffset(y),k=(i=cn[y])===null||i===void 0?void 0:i.grid,_=function(w,S,N){var A,T,P=S,E=N;switch(w){case M.ArrowRight:P=Se(S,Pt),E=N===11?0:N+Pt;break;case M.ArrowLeft:P=Fe(S,Pt),E=N===0?11:N-Pt;break;case M.ArrowUp:P=Fe(S,g),E=!((A=k?.[0])===null||A===void 0)&&A.includes(N)?N+12-g:N-g;break;case M.ArrowDown:P=Se(S,g),E=!((T=k?.[k.length-1])===null||T===void 0)&&T.includes(N)?N-12+g:N+g;break}return{newCalculatedDate:P,newCalculatedMonth:E}},j=function(w,S,N){for(var A=40,T=w,P=!1,E=0,O=_(T,S,N),L=O.newCalculatedDate,R=O.newCalculatedMonth;!P;){if(E>=A){L=S,R=N;break}if(d&&Lm){T=M.ArrowLeft;var I=_(T,L,R);L=I.newCalculatedDate,R=I.newCalculatedMonth}if(Ks(L,t.props)){var I=_(T,L,R);L=I.newCalculatedDate,R=I.newCalculatedMonth}else P=!0;E++}return{newCalculatedDate:L,newCalculatedMonth:R}};if(n===M.Enter){t.isMonthDisabled(a)||(t.onMonthClick(e,a),p?.(c));return}var C=j(n,u,a),D=C.newCalculatedDate,b=C.newCalculatedMonth;switch(n){case M.ArrowRight:case M.ArrowLeft:case M.ArrowUp:case M.ArrowDown:t.handleMonthNavigation(b,D);break}}},t.getVerticalOffset=function(e){var n,a;return(a=(n=cn[e])===null||n===void 0?void 0:n.verticalNavigationOffset)!==null&&a!==void 0?a:0},t.onMonthKeyDown=function(e,n){var a=t.props,i=a.disabledKeyboardNavigation,l=a.handleOnMonthKeyDown,c=e.key;c!==M.Tab&&e.preventDefault(),i||t.handleKeyboardNavigation(e,c,n),l&&l(e)},t.onQuarterClick=function(e,n){var a=Ke(t.props.day,n);Nt(a,t.props)||t.handleDayClick(ir(a),e)},t.onQuarterMouseEnter=function(e){var n=Ke(t.props.day,e);Nt(n,t.props)||t.handleDayMouseEnter(ir(n))},t.handleQuarterNavigation=function(e,n){var a,i,l,c;t.isDisabled(n)||t.isExcluded(n)||((i=(a=t.props).setPreSelection)===null||i===void 0||i.call(a,n),(c=(l=t.QUARTER_REFS[e-1])===null||l===void 0?void 0:l.current)===null||c===void 0||c.focus())},t.onQuarterKeyDown=function(e,n){var a,i,l=e.key;if(!t.props.disabledKeyboardNavigation)switch(l){case M.Enter:t.onQuarterClick(e,n),(i=(a=t.props).setPreSelection)===null||i===void 0||i.call(a,t.props.selected);break;case M.ArrowRight:if(!t.props.preSelection)break;t.handleQuarterNavigation(n===4?1:n+1,Fr(t.props.preSelection,1));break;case M.ArrowLeft:if(!t.props.preSelection)break;t.handleQuarterNavigation(n===1?4:n-1,Ir(t.props.preSelection));break}},t.isMonthDisabledForLabelDate=function(e){var n,a=t.props,i=a.day,l=a.disabled,c=a.minDate,u=a.maxDate,p=a.excludeDates,d=a.includeDates,m=se(i,e);return l?{isDisabled:!0,labelDate:se(i,e)}:{isDisabled:(n=(c||u||p||d)&&sa(m,t.props))!==null&&n!==void 0?n:!1,labelDate:m}},t.isMonthDisabled=function(e){var n=t.isMonthDisabledForLabelDate(e).isDisabled;return n},t.getMonthClassNames=function(e){var n=t.props,a=n.day,i=n.startDate,l=n.endDate,c=n.preSelection,u=n.monthClassName,p=u?u(se(a,e)):void 0,d=t.getSelection();return Z("react-datepicker__month-text","react-datepicker__month-".concat(e),p,{"react-datepicker__month-text--disabled":t.isMonthDisabled(e),"react-datepicker__month-text--selected":d?t.isSelectMonthInList(a,e,d):void 0,"react-datepicker__month-text--keyboard-selected":!t.props.disabledKeyboardNavigation&&c&&t.isSelectedMonth(a,e,c)&&!t.isMonthSelected()&&!t.isMonthDisabled(e),"react-datepicker__month-text--in-selecting-range":t.isInSelectingRangeMonth(e),"react-datepicker__month-text--in-range":i&&l?Ct(i,l,e,a):void 0,"react-datepicker__month-text--range-start":t.isRangeStartMonth(e),"react-datepicker__month-text--range-end":t.isRangeEndMonth(e),"react-datepicker__month-text--selecting-range-start":t.isSelectingMonthRangeStart(e),"react-datepicker__month-text--selecting-range-end":t.isSelectingMonthRangeEnd(e),"react-datepicker__month-text--today":t.isCurrentMonth(a,e)})},t.getTabIndex=function(e){if(t.props.preSelection==null)return"-1";var n=re(t.props.preSelection),a=t.isMonthDisabledForLabelDate(n).isDisabled,i=e===n&&!(a||t.props.disabledKeyboardNavigation)?"0":"-1";return i},t.getQuarterTabIndex=function(e){if(t.props.preSelection==null)return"-1";var n=Ue(t.props.preSelection),a=Nt(t.props.day,t.props),i=e===n&&!(a||t.props.disabledKeyboardNavigation)?"0":"-1";return i},t.getAriaLabel=function(e){var n=t.props,a=n.chooseDayAriaLabelPrefix,i=a===void 0?"Choose":a,l=n.disabledDayAriaLabelPrefix,c=l===void 0?"Not available":l,u=n.day,p=n.locale,d=se(u,e),m=t.isDisabled(d)||t.isExcluded(d)?c:i;return"".concat(m," ").concat(U(d,"MMMM yyyy",p))},t.getQuarterClassNames=function(e){var n=t.props,a=n.day,i=n.startDate,l=n.endDate,c=n.minDate,u=n.maxDate,p=n.excludeDates,d=n.includeDates,m=n.filterDate,f=n.preSelection,h=n.disabledKeyboardNavigation,y=n.disabled,g=(c||u||p||d||m||y)&&Nt(Ke(a,e),t.props),k=t.getSelection();return Z("react-datepicker__quarter-text","react-datepicker__quarter-".concat(e),{"react-datepicker__quarter-text--disabled":g,"react-datepicker__quarter-text--selected":k?t.isSelectQuarterInList(a,e,k):void 0,"react-datepicker__quarter-text--keyboard-selected":!h&&f&&t.isSelectedQuarter(a,e,f)&&!t.isQuarterSelected()&&!g,"react-datepicker__quarter-text--in-selecting-range":t.isInSelectingRangeQuarter(e),"react-datepicker__quarter-text--in-range":i&&l?Et(i,l,e,a):void 0,"react-datepicker__quarter-text--range-start":t.isRangeStartQuarter(e),"react-datepicker__quarter-text--range-end":t.isRangeEndQuarter(e),"react-datepicker__quarter-text--today":t.isCurrentQuarter(a,e)})},t.getMonthContent=function(e){var n=t.props,a=n.showFullMonthYearPicker,i=n.renderMonthContent,l=n.locale,c=n.day,u=oa(e,l),p=Ln(e,l);return i?i(e,u,p,c):a?p:u},t.getQuarterContent=function(e){var n,a=t.props,i=a.renderQuarterContent,l=a.locale,c=$s(e,l);return(n=i?.(e,c))!==null&&n!==void 0?n:c},t.renderMonths=function(){var e,n=t.props,a=n.showTwoColumnMonthYearPicker,i=n.showFourColumnMonthYearPicker,l=n.day,c=n.selected,u=(e=cn[br(i,a)])===null||e===void 0?void 0:e.grid;return u?.map(function(p,d){return x.createElement("div",{className:"react-datepicker__month-wrapper",key:d},p.map(function(m,f){return x.createElement("div",{ref:t.MONTH_REFS[m],key:f,onClick:function(h){t.onMonthClick(h,m)},onKeyDown:function(h){da(h)&&(h.preventDefault(),h.key=M.Enter),t.onMonthKeyDown(h,m)},onMouseEnter:t.props.usePointerEvent?void 0:function(){return t.onMonthMouseEnter(m)},onPointerEnter:t.props.usePointerEvent?function(){return t.onMonthMouseEnter(m)}:void 0,tabIndex:Number(t.getTabIndex(m)),className:t.getMonthClassNames(m),"aria-disabled":t.isMonthDisabled(m),role:"option","aria-label":t.getAriaLabel(m),"aria-current":t.isCurrentMonth(l,m)?"date":void 0,"aria-selected":c?t.isSelectedMonth(l,m,c):void 0},t.getMonthContent(m))}))})},t.renderQuarters=function(){var e=t.props,n=e.day,a=e.selected,i=[1,2,3,4];return x.createElement("div",{className:"react-datepicker__quarter-wrapper"},i.map(function(l,c){return x.createElement("div",{key:c,ref:t.QUARTER_REFS[c],role:"option",onClick:function(u){t.onQuarterClick(u,l)},onKeyDown:function(u){t.onQuarterKeyDown(u,l)},onMouseEnter:t.props.usePointerEvent?void 0:function(){return t.onQuarterMouseEnter(l)},onPointerEnter:t.props.usePointerEvent?function(){return t.onQuarterMouseEnter(l)}:void 0,className:t.getQuarterClassNames(l),"aria-selected":a?t.isSelectedQuarter(n,l,a):void 0,tabIndex:Number(t.getQuarterTabIndex(l)),"aria-current":t.isCurrentQuarter(n,l)?"date":void 0},t.getQuarterContent(l))}))},t.getClassNames=function(){var e=t.props,n=e.selectingDate,a=e.selectsStart,i=e.selectsEnd,l=e.showMonthYearPicker,c=e.showQuarterYearPicker,u=e.showWeekPicker;return Z("react-datepicker__month",{"react-datepicker__month--selecting-range":n&&(a||i)},{"react-datepicker__monthPicker":l},{"react-datepicker__quarterPicker":c},{"react-datepicker__weekPicker":u})},t}return o.prototype.getSelection=function(){var t=this.props,e=t.selected,n=t.selectedDates,a=t.selectsMultiple;if(a)return n;if(e)return[e]},o.prototype.render=function(){var t=this.props,e=t.showMonthYearPicker,n=t.showQuarterYearPicker,a=t.day,i=t.ariaLabelPrefix,l=i===void 0?"Month ":i,c=l?l.trim()+" ":"",u=ne(a)?"".concat(c).concat(U(a,"MMMM, yyyy",this.props.locale)):"",p=e||n;return p?x.createElement("div",{className:this.getClassNames(),onMouseLeave:this.props.usePointerEvent?void 0:this.handleMouseLeave,onPointerLeave:this.props.usePointerEvent?this.handleMouseLeave:void 0,"aria-label":u,role:"listbox"},e?this.renderMonths():this.renderQuarters()):x.createElement("div",{role:"table"},this.props.dayNamesHeader&&x.createElement("div",{role:"rowgroup"},this.props.dayNamesHeader),this.props.monthHeader&&x.createElement("div",{role:"rowgroup"},this.props.monthHeader),x.createElement("div",{className:this.getClassNames(),onMouseLeave:this.props.usePointerEvent?void 0:this.handleMouseLeave,onPointerLeave:this.props.usePointerEvent?this.handleMouseLeave:void 0,"aria-label":u,role:"rowgroup"},this.renderWeeks()),this.props.monthFooter&&x.createElement("div",{role:"rowgroup"},this.props.monthFooter))},o}(v.Component),si=function(r){q(o,r);function o(){var t=r!==null&&r.apply(this,arguments)||this;return t.monthOptionButtonsRef={},t.isSelectedMonth=function(e){return t.props.month===e},t.handleOptionKeyDown=function(e,n){var a;switch(n.key){case"Enter":n.preventDefault(),t.onChange(e);break;case"Escape":n.preventDefault(),t.props.onCancel();break;case"ArrowUp":case"ArrowDown":{n.preventDefault();var i=(e+(n.key==="ArrowUp"?-1:1)+t.props.monthNames.length)%t.props.monthNames.length;(a=t.monthOptionButtonsRef[i])===null||a===void 0||a.focus();break}}},t.renderOptions=function(){return t.monthOptionButtonsRef={},t.props.monthNames.map(function(e,n){return x.createElement("div",{ref:function(a){t.monthOptionButtonsRef[n]=a,t.isSelectedMonth(n)&&a?.focus()},role:"button",tabIndex:0,className:t.isSelectedMonth(n)?"react-datepicker__month-option react-datepicker__month-option--selected_month":"react-datepicker__month-option",key:e,onClick:t.onChange.bind(t,n),onKeyDown:t.handleOptionKeyDown.bind(t,n),"aria-selected":t.isSelectedMonth(n)?"true":void 0},t.isSelectedMonth(n)?x.createElement("span",{className:"react-datepicker__month-option--selected"},"✓"):"",e)})},t.onChange=function(e){return t.props.onChange(e)},t.handleClickOutside=function(){return t.props.onCancel()},t}return o.prototype.render=function(){return x.createElement(Gt,{className:"react-datepicker__month-dropdown",onClickOutside:this.handleClickOutside},this.renderOptions())},o}(v.Component),ii=function(r){q(o,r);function o(){var t=r!==null&&r.apply(this,arguments)||this;return t.state={dropdownVisible:!1},t.renderSelectOptions=function(e){return e.map(function(n,a){return x.createElement("option",{key:n,value:a},n)})},t.renderSelectMode=function(e){return x.createElement("select",{value:t.props.month,className:"react-datepicker__month-select",onChange:function(n){return t.onChange(parseInt(n.target.value))}},t.renderSelectOptions(e))},t.renderReadView=function(e,n){return x.createElement("button",{key:"read",type:"button",style:{visibility:e?"visible":"hidden"},className:"react-datepicker__month-read-view",onClick:t.toggleDropdown},x.createElement("span",{className:"react-datepicker__month-read-view--down-arrow"}),x.createElement("span",{className:"react-datepicker__month-read-view--selected-month"},n[t.props.month]))},t.renderDropdown=function(e){return x.createElement(si,F({key:"dropdown"},t.props,{monthNames:e,onChange:t.onChange,onCancel:t.toggleDropdown}))},t.renderScrollMode=function(e){var n=t.state.dropdownVisible,a=[t.renderReadView(!n,e)];return n&&a.unshift(t.renderDropdown(e)),a},t.onChange=function(e){t.toggleDropdown(),e!==t.props.month&&t.props.onChange(e)},t.toggleDropdown=function(){return t.setState({dropdownVisible:!t.state.dropdownVisible})},t}return o.prototype.render=function(){var t=this,e=[0,1,2,3,4,5,6,7,8,9,10,11].map(this.props.useShortMonthInDropdown?function(a){return oa(a,t.props.locale)}:function(a){return Ln(a,t.props.locale)}),n;switch(this.props.dropdownMode){case"scroll":n=this.renderScrollMode(e);break;case"select":n=this.renderSelectMode(e);break}return x.createElement("div",{className:"react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--".concat(this.props.dropdownMode)},n)},o}(v.Component),kr=5;function li(r,o,t){for(var e=[],n=r??Ce(t,kr),a=o??me(t,kr),i=we(n),l=we(a);!be(i,l);)e.push(H(i)),i=Se(i,1);return e}var ci=function(r){q(o,r);function o(t){var e=r.call(this,t)||this;return e.renderOptions=function(){return e.state.monthYearsList.map(function(n){var a=yn(n),i=ue(e.props.date,n)&&J(e.props.date,n);return x.createElement("div",{className:i?"react-datepicker__month-year-option--selected_month-year":"react-datepicker__month-year-option",key:a,onClick:e.onChange.bind(e,a),"aria-selected":i?"true":void 0},i?x.createElement("span",{className:"react-datepicker__month-year-option--selected"},"✓"):"",U(n,e.props.dateFormat,e.props.locale))})},e.onChange=function(n){return e.props.onChange(n)},e.handleClickOutside=function(){e.props.onCancel()},e.state={monthYearsList:li(e.props.minDate,e.props.maxDate,e.props.date)},e}return o.prototype.render=function(){var t=Z({"react-datepicker__month-year-dropdown":!0,"react-datepicker__month-year-dropdown--scrollable":this.props.scrollableMonthYearDropdown});return x.createElement(Gt,{className:t,onClickOutside:this.handleClickOutside},this.renderOptions())},o}(v.Component),wr=5,di=function(r){q(o,r);function o(){var t=r!==null&&r.apply(this,arguments)||this;return t.state={dropdownVisible:!1},t.renderSelectOptions=function(){for(var e,n,a=(e=t.props.minDate)!==null&&e!==void 0?e:Ce(t.props.date,wr),i=(n=t.props.maxDate)!==null&&n!==void 0?n:me(t.props.date,wr),l=we(a),c=we(i),u=[];!be(l,c);){var p=yn(l);u.push(x.createElement("option",{key:p,value:p},U(l,t.props.dateFormat,t.props.locale))),l=Se(l,1)}return u},t.onSelectChange=function(e){t.onChange(parseInt(e.target.value))},t.renderSelectMode=function(){return x.createElement("select",{value:yn(we(t.props.date)),className:"react-datepicker__month-year-select",onChange:t.onSelectChange},t.renderSelectOptions())},t.renderReadView=function(e){var n=U(t.props.date,t.props.dateFormat,t.props.locale);return x.createElement("div",{key:"read",style:{visibility:e?"visible":"hidden"},className:"react-datepicker__month-year-read-view",onClick:t.toggleDropdown},x.createElement("span",{className:"react-datepicker__month-year-read-view--down-arrow"}),x.createElement("span",{className:"react-datepicker__month-year-read-view--selected-month-year"},n))},t.renderDropdown=function(){return x.createElement(ci,F({key:"dropdown"},t.props,{onChange:t.onChange,onCancel:t.toggleDropdown}))},t.renderScrollMode=function(){var e=t.state.dropdownVisible,n=[t.renderReadView(!e)];return e&&n.unshift(t.renderDropdown()),n},t.onChange=function(e){t.toggleDropdown();var n=H(e);ue(t.props.date,n)&&J(t.props.date,n)||t.props.onChange(n)},t.toggleDropdown=function(){return t.setState({dropdownVisible:!t.state.dropdownVisible})},t}return o.prototype.render=function(){var t;switch(this.props.dropdownMode){case"scroll":t=this.renderScrollMode();break;case"select":t=this.renderSelectMode();break}return x.createElement("div",{className:"react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--".concat(this.props.dropdownMode)},t)},o}(v.Component),ui=function(r){q(o,r);function o(){var t=r!==null&&r.apply(this,arguments)||this;return t.state={height:null},t.scrollToTheSelectedTime=function(){requestAnimationFrame(function(){var e,n,a;t.list&&(t.list.scrollTop=(a=t.centerLi&&o.calcCenterPosition(t.props.monthRef?t.props.monthRef.clientHeight-((n=(e=t.header)===null||e===void 0?void 0:e.clientHeight)!==null&&n!==void 0?n:0):t.list.clientHeight,t.centerLi))!==null&&a!==void 0?a:0)})},t.handleClick=function(e){var n,a;(t.props.minTime||t.props.maxTime)&&pr(e,t.props)||(t.props.excludeTimes||t.props.includeTimes||t.props.filterTime)&&ur(e,t.props)||(a=(n=t.props).onChange)===null||a===void 0||a.call(n,e)},t.isSelectedTime=function(e){var n=Re(t.props.selected);return n&&ca(n,e)},t.isDisabledTime=function(e){return(t.props.minTime||t.props.maxTime)&&pr(e,t.props)||(t.props.excludeTimes||t.props.includeTimes||t.props.filterTime)&&ur(e,t.props)},t.liClasses=function(e){var n,a=["react-datepicker__time-list-item",t.props.timeClassName?t.props.timeClassName(e):void 0];return t.isSelectedTime(e)&&a.push("react-datepicker__time-list-item--selected"),t.isDisabledTime(e)&&a.push("react-datepicker__time-list-item--disabled"),t.props.injectTimes&&(G(e)*3600+X(e)*60+De(e))%(((n=t.props.intervals)!==null&&n!==void 0?n:o.defaultProps.intervals)*60)!==0&&a.push("react-datepicker__time-list-item--injected"),a.join(" ")},t.handleOnKeyDown=function(e,n){var a,i;e.key===M.Space&&(e.preventDefault(),e.key=M.Enter),(e.key===M.ArrowUp||e.key===M.ArrowLeft)&&e.target instanceof HTMLElement&&e.target.previousSibling&&(e.preventDefault(),e.target.previousSibling instanceof HTMLElement&&e.target.previousSibling.focus()),(e.key===M.ArrowDown||e.key===M.ArrowRight)&&e.target instanceof HTMLElement&&e.target.nextSibling&&(e.preventDefault(),e.target.nextSibling instanceof HTMLElement&&e.target.nextSibling.focus()),e.key===M.Enter&&t.handleClick(n),(i=(a=t.props).handleOnKeyDown)===null||i===void 0||i.call(a,e)},t.renderTimes=function(){for(var e,n=[],a=typeof t.props.format=="string"?t.props.format:"p",i=(e=t.props.intervals)!==null&&e!==void 0?e:o.defaultProps.intervals,l=Re(t.props.selected)||Re(t.props.openToDate)||H(),c=ut(l),u=t.props.injectTimes&&t.props.injectTimes.sort(function(g,k){return g.getTime()-k.getTime()}),p=60*ei(l),d=p/i,m=0;m=m?e.updateFocusOnPaginate(Math.abs(m-(n-f))):(u=(c=e.YEAR_REFS[n-f])===null||c===void 0?void 0:c.current)===null||u===void 0||u.focus())}},e.isSameDay=function(n,a){return W(n,a)},e.isCurrentYear=function(n){return n===Y(H())},e.isRangeStart=function(n){return e.props.startDate&&e.props.endDate&&ue(de(H(),n),e.props.startDate)},e.isRangeEnd=function(n){return e.props.startDate&&e.props.endDate&&ue(de(H(),n),e.props.endDate)},e.isInRange=function(n){return Mt(n,e.props.startDate,e.props.endDate)},e.isInSelectingRange=function(n){var a=e.props,i=a.selectsStart,l=a.selectsEnd,c=a.selectsRange,u=a.startDate,p=a.endDate;return!(i||l||c)||!e.selectingDate()?!1:i&&p?Mt(n,e.selectingDate(),p):l&&u||c&&u&&!p?Mt(n,u,e.selectingDate()):!1},e.isSelectingRangeStart=function(n){var a;if(!e.isInSelectingRange(n))return!1;var i=e.props,l=i.startDate,c=i.selectsStart,u=de(H(),n);return c?ue(u,(a=e.selectingDate())!==null&&a!==void 0?a:null):ue(u,l??null)},e.isSelectingRangeEnd=function(n){var a;if(!e.isInSelectingRange(n))return!1;var i=e.props,l=i.endDate,c=i.selectsEnd,u=i.selectsRange,p=de(H(),n);return c||u?ue(p,(a=e.selectingDate())!==null&&a!==void 0?a:null):ue(p,l??null)},e.isKeyboardSelected=function(n){if(!(e.props.disabledKeyboardNavigation||e.props.date===void 0||e.props.preSelection==null)){var a=e.props,i=a.minDate,l=a.maxDate,c=a.excludeDates,u=a.includeDates,p=a.filterDate,d=a.selected,m=pt(de(e.props.date,n)),f=(i||l||c||u||p)&&Lt(n,e.props),h=!!d&&W(m,pt(d)),y=W(m,pt(e.props.preSelection));return!e.props.inline&&!h&&y&&!f}},e.isSelectedYear=function(n){var a=e.props,i=a.selectsMultiple,l=a.selected,c=a.selectedDates;return i?c?.some(function(u){return n===Y(u)}):!!l&&n===Y(l)},e.onYearClick=function(n,a){var i=e.props.date;i!==void 0&&e.handleYearClick(pt(de(i,a)),n)},e.onYearKeyDown=function(n,a){var i,l,c=n.key,u=e.props,p=u.date,d=u.yearItemNumber,m=u.handleOnKeyDown;if(c!==M.Tab&&n.preventDefault(),!e.props.disabledKeyboardNavigation)switch(c){case M.Enter:if(e.props.selected==null)break;e.onYearClick(n,a),(l=(i=e.props).setPreSelection)===null||l===void 0||l.call(i,e.props.selected);break;case M.ArrowRight:if(e.props.preSelection==null)break;e.handleYearNavigation(a+1,me(e.props.preSelection,1));break;case M.ArrowLeft:if(e.props.preSelection==null)break;e.handleYearNavigation(a-1,Ce(e.props.preSelection,1));break;case M.ArrowUp:{if(p===void 0||d===void 0||e.props.preSelection==null)break;var f=xe(p,d).startPeriod,h=_r,y=a-h;if(y=f&&ak){var g=d%h;a<=k&&a>k-g?h=g:h+=g,y=a+h}e.handleYearNavigation(y,me(e.props.preSelection,h));break}}m&&m(n)},e.getYearClassNames=function(n){var a=e.props,i=a.date,l=a.disabled,c=a.minDate,u=a.maxDate,p=a.excludeDates,d=a.includeDates,m=a.filterDate,f=a.yearClassName;return Z("react-datepicker__year-text","react-datepicker__year-".concat(n),i?f?.(de(i,n)):void 0,{"react-datepicker__year-text--selected":e.isSelectedYear(n),"react-datepicker__year-text--disabled":(c||u||p||d||m||l)&&Lt(n,e.props),"react-datepicker__year-text--keyboard-selected":e.isKeyboardSelected(n),"react-datepicker__year-text--range-start":e.isRangeStart(n),"react-datepicker__year-text--range-end":e.isRangeEnd(n),"react-datepicker__year-text--in-range":e.isInRange(n),"react-datepicker__year-text--in-selecting-range":e.isInSelectingRange(n),"react-datepicker__year-text--selecting-range-start":e.isSelectingRangeStart(n),"react-datepicker__year-text--selecting-range-end":e.isSelectingRangeEnd(n),"react-datepicker__year-text--today":e.isCurrentYear(n)})},e.getYearTabIndex=function(n){if(e.props.disabledKeyboardNavigation||e.props.preSelection==null)return"-1";var a=Y(e.props.preSelection),i=Lt(n,e.props);return n===a&&!i?"0":"-1"},e.getYearContent=function(n){return e.props.renderYearContent?e.props.renderYearContent(n):n},e}return o.prototype.render=function(){var t=this,e=[],n=this.props,a=n.date,i=n.yearItemNumber,l=n.onYearMouseEnter,c=n.onYearMouseLeave;if(a===void 0)return null;for(var u=xe(a,i),p=u.startPeriod,d=u.endPeriod,m=function(y){e.push(x.createElement("div",{ref:f.YEAR_REFS[y-p],onClick:function(g){t.onYearClick(g,y)},onKeyDown:function(g){da(g)&&(g.preventDefault(),g.key=M.Enter),t.onYearKeyDown(g,y)},tabIndex:Number(f.getYearTabIndex(y)),className:f.getYearClassNames(y),onMouseEnter:f.props.usePointerEvent?void 0:function(g){return l(g,y)},onPointerEnter:f.props.usePointerEvent?function(g){return l(g,y)}:void 0,onMouseLeave:f.props.usePointerEvent?void 0:function(g){return c(g,y)},onPointerLeave:f.props.usePointerEvent?function(g){return c(g,y)}:void 0,key:y,"aria-current":f.isCurrentYear(y)?"date":void 0},f.getYearContent(y)))},f=this,h=p;h<=d;h++)m(h);return x.createElement("div",{className:"react-datepicker__year"},x.createElement("div",{className:"react-datepicker__year-wrapper",onMouseLeave:this.props.usePointerEvent?void 0:this.props.clearSelectingDate,onPointerLeave:this.props.usePointerEvent?this.props.clearSelectingDate:void 0},e))},o}(v.Component);function fi(r,o,t,e){for(var n=[],a=0;a<2*o+1;a++){var i=r+o-a,l=!0;t&&(l=Y(t)<=i),e&&l&&(l=Y(e)>=i),l&&n.push(i)}return n}var mi=function(r){q(o,r);function o(t){var e=r.call(this,t)||this;e.yearOptionButtonsRef={},e.handleOptionKeyDown=function(l,c){var u;switch(c.key){case"Enter":c.preventDefault(),e.onChange(l);break;case"Escape":c.preventDefault(),e.props.onCancel();break;case"ArrowUp":case"ArrowDown":{c.preventDefault();var p=l+(c.key==="ArrowUp"?1:-1);e.yearOptionButtonsRef[p]&&((u=e.yearOptionButtonsRef[p])===null||u===void 0||u.focus());break}}},e.renderOptions=function(){e.yearOptionButtonsRef={};var l=e.props.year,c=e.state.yearsList.map(function(d){return x.createElement("div",{ref:function(m){e.yearOptionButtonsRef[d]=m,d===l&&m?.focus()},role:"button",tabIndex:0,className:l===d?"react-datepicker__year-option react-datepicker__year-option--selected_year":"react-datepicker__year-option",key:d,onClick:e.onChange.bind(e,d),onKeyDown:e.handleOptionKeyDown.bind(e,d),"aria-selected":l===d?"true":void 0},l===d?x.createElement("span",{className:"react-datepicker__year-option--selected"},"✓"):"",d)}),u=e.props.minDate?Y(e.props.minDate):null,p=e.props.maxDate?Y(e.props.maxDate):null;return(!p||!e.state.yearsList.find(function(d){return d===p}))&&c.unshift(x.createElement("div",{className:"react-datepicker__year-option",key:"upcoming",onClick:e.incrementYears},x.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming"}))),(!u||!e.state.yearsList.find(function(d){return d===u}))&&c.push(x.createElement("div",{className:"react-datepicker__year-option",key:"previous",onClick:e.decrementYears},x.createElement("a",{className:"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous"}))),c},e.onChange=function(l){e.props.onChange(l)},e.handleClickOutside=function(){e.props.onCancel()},e.shiftYears=function(l){var c=e.state.yearsList.map(function(u){return u+l});e.setState({yearsList:c})},e.incrementYears=function(){return e.shiftYears(1)},e.decrementYears=function(){return e.shiftYears(-1)};var n=t.yearDropdownItemNumber,a=t.scrollableYearDropdown,i=n||(a?10:5);return e.state={yearsList:fi(e.props.year,i,e.props.minDate,e.props.maxDate)},e.dropdownRef=v.createRef(),e}return o.prototype.componentDidMount=function(){var t=this.dropdownRef.current;if(t){var e=t.children?Array.from(t.children):null,n=e?e.find(function(a){return a.ariaSelected}):null;t.scrollTop=n&&n instanceof HTMLElement?n.offsetTop+(n.clientHeight-t.clientHeight)/2:(t.scrollHeight-t.clientHeight)/2}},o.prototype.render=function(){var t=Z({"react-datepicker__year-dropdown":!0,"react-datepicker__year-dropdown--scrollable":this.props.scrollableYearDropdown});return x.createElement(Gt,{className:t,containerRef:this.dropdownRef,onClickOutside:this.handleClickOutside},this.renderOptions())},o}(v.Component),hi=function(r){q(o,r);function o(){var t=r!==null&&r.apply(this,arguments)||this;return t.state={dropdownVisible:!1},t.renderSelectOptions=function(){for(var e=t.props.minDate?Y(t.props.minDate):1900,n=t.props.maxDate?Y(t.props.maxDate):2100,a=[],i=e;i<=n;i++)a.push(x.createElement("option",{key:i,value:i},i));return a},t.onSelectChange=function(e){t.onChange(parseInt(e.target.value))},t.renderSelectMode=function(){return x.createElement("select",{value:t.props.year,className:"react-datepicker__year-select",onChange:t.onSelectChange},t.renderSelectOptions())},t.renderReadView=function(e){return x.createElement("button",{key:"read",type:"button",style:{visibility:e?"visible":"hidden"},className:"react-datepicker__year-read-view",onClick:t.toggleDropdown},x.createElement("span",{className:"react-datepicker__year-read-view--down-arrow"}),x.createElement("span",{className:"react-datepicker__year-read-view--selected-year"},t.props.year))},t.renderDropdown=function(){return x.createElement(mi,F({key:"dropdown"},t.props,{onChange:t.onChange,onCancel:t.toggleDropdown}))},t.renderScrollMode=function(){var e=t.state.dropdownVisible,n=[t.renderReadView(!e)];return e&&n.unshift(t.renderDropdown()),n},t.onChange=function(e){t.toggleDropdown(),e!==t.props.year&&t.props.onChange(e)},t.toggleDropdown=function(e){t.setState({dropdownVisible:!t.state.dropdownVisible},function(){t.props.adjustDateOnChange&&t.handleYearChange(t.props.date,e)})},t.handleYearChange=function(e,n){var a;(a=t.onSelect)===null||a===void 0||a.call(t,e,n),t.setOpen()},t.onSelect=function(e,n){var a,i;(i=(a=t.props).onSelect)===null||i===void 0||i.call(a,e,n)},t.setOpen=function(){var e,n;(n=(e=t.props).setOpen)===null||n===void 0||n.call(e,!0)},t}return o.prototype.render=function(){var t;switch(this.props.dropdownMode){case"scroll":t=this.renderScrollMode();break;case"select":t=this.renderSelectMode();break}return x.createElement("div",{className:"react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--".concat(this.props.dropdownMode)},t)},o}(v.Component),vi=["react-datepicker__year-select","react-datepicker__month-select","react-datepicker__month-year-select"],ua="react-datepicker-ignore-onclickoutside",yi=function(r){var o=(r.className||"").split(/\s+/);return vi.some(function(t){return o.indexOf(t)>=0})},gi=function(r){q(o,r);function o(t){var e=r.call(this,t)||this;return e.monthContainer=void 0,e.handleClickOutside=function(n){e.props.onClickOutside(n)},e.setClickOutsideRef=function(){return e.containerRef.current},e.handleDropdownFocus=function(n){var a,i;yi(n.target)&&((i=(a=e.props).onDropdownFocus)===null||i===void 0||i.call(a,n))},e.getDateInView=function(){var n=e.props,a=n.preSelection,i=n.selected,l=n.openToDate,c=ia(e.props),u=la(e.props),p=H(),d=l||i||a;return d||(c&&pe(p,c)?c:u&&be(p,u)?u:p)},e.increaseMonth=function(){e.setState(function(n){var a=n.date;return{date:Se(a,1)}},function(){return e.handleMonthChange(e.state.date)})},e.decreaseMonth=function(){e.setState(function(n){var a=n.date;return{date:Fe(a,1)}},function(){return e.handleMonthChange(e.state.date)})},e.handleDayClick=function(n,a,i){e.props.onSelect(n,a,i),e.props.setPreSelection&&e.props.setPreSelection(n)},e.handleDayMouseEnter=function(n){e.setState({selectingDate:n}),e.props.onDayMouseEnter&&e.props.onDayMouseEnter(n)},e.handleMonthMouseLeave=function(){e.setState({selectingDate:void 0}),e.props.onMonthMouseLeave&&e.props.onMonthMouseLeave()},e.handleYearMouseEnter=function(n,a){e.setState({selectingDate:de(H(),a)}),e.props.onYearMouseEnter&&e.props.onYearMouseEnter(n,a)},e.handleYearMouseLeave=function(n,a){e.props.onYearMouseLeave&&e.props.onYearMouseLeave(n,a)},e.handleYearChange=function(n){var a,i,l,c;(i=(a=e.props).onYearChange)===null||i===void 0||i.call(a,n),e.setState({isRenderAriaLiveMessage:!0}),e.props.adjustDateOnChange&&(e.props.onSelect(n),(c=(l=e.props).setOpen)===null||c===void 0||c.call(l,!0)),e.props.setPreSelection&&e.props.setPreSelection(n)},e.getEnabledPreSelectionDateForMonth=function(n){if(!ie(n,e.props))return n;for(var a=we(n),i=Ws(n),l=Da(i,a),c=null,u=0;u<=l;u++){var p=Ye(a,u);if(!ie(p,e.props)){c=p;break}}return c},e.handleMonthChange=function(n){var a,i,l,c=(a=e.getEnabledPreSelectionDateForMonth(n))!==null&&a!==void 0?a:n;e.handleCustomMonthChange(c),e.props.adjustDateOnChange&&(e.props.onSelect(c),(l=(i=e.props).setOpen)===null||l===void 0||l.call(i,!0)),e.props.setPreSelection&&e.props.setPreSelection(c)},e.handleCustomMonthChange=function(n){var a,i;(i=(a=e.props).onMonthChange)===null||i===void 0||i.call(a,n),e.setState({isRenderAriaLiveMessage:!0})},e.handleMonthYearChange=function(n){e.handleYearChange(n),e.handleMonthChange(n)},e.changeYear=function(n){e.setState(function(a){var i=a.date;return{date:de(i,Number(n))}},function(){return e.handleYearChange(e.state.date)})},e.changeMonth=function(n){e.setState(function(a){var i=a.date;return{date:se(i,Number(n))}},function(){var a,i;e.handleMonthChange(e.state.date),(i=(a=e.props).onMonthSelectedInChange)===null||i===void 0||i.call(a,0)})},e.changeMonthYear=function(n){e.setState(function(a){var i=a.date;return{date:de(se(i,re(n)),Y(n))}},function(){return e.handleMonthYearChange(e.state.date)})},e.header=function(n,a){if(n===void 0&&(n=e.state.date),a===void 0&&(a=0),!ne(n))return[];var i=e.props.disabled,l=je(n,e.props.locale,e.props.calendarStartDay),c=[];return e.props.showWeekNumbers&&c.push(x.createElement("div",{key:"W",className:"react-datepicker__day-name ".concat(i?"react-datepicker__day-name--disabled":""),role:"columnheader"},x.createElement("span",{className:"react-datepicker__sr-only"},"Week number"),x.createElement("span",{"aria-hidden":"true"},e.props.weekLabel||"#"))),c.concat([0,1,2,3,4,5,6].map(function(u){var p=Ye(l,u),d=e.formatWeekday(p,e.props.locale),m=U(p,"EEEE",e.props.locale),f=e.props.weekDayClassName?e.props.weekDayClassName(p):void 0;if(e.props.renderCustomDayName){var h=e.props.renderCustomDayName({day:p,shortName:d,fullName:m,locale:e.props.locale,customDayNameCount:a});return x.createElement("div",{key:u,role:"columnheader",className:Z("react-datepicker__day-name",f,i?"react-datepicker__day-name--disabled":"")},h)}return x.createElement("div",{key:u,role:"columnheader",className:Z("react-datepicker__day-name",f,i?"react-datepicker__day-name--disabled":"")},x.createElement("span",{className:"react-datepicker__sr-only"},m),x.createElement("span",{"aria-hidden":"true"},d))}))},e.formatWeekday=function(n,a){return e.props.formatWeekDay?Bs(n,e.props.formatWeekDay,a):e.props.useWeekdaysShort?Vs(n,a):Hs(n,a)},e.decreaseYear=function(){e.setState(function(n){var a,i=n.date;return{date:Ce(i,e.props.showYearPicker?(a=e.props.yearItemNumber)!==null&&a!==void 0?a:o.defaultProps.yearItemNumber:1)}},function(){return e.handleYearChange(e.state.date)})},e.clearSelectingDate=function(){e.setState({selectingDate:void 0})},e.renderPreviousButton=function(){var n,a,i;if(!e.props.renderCustomHeader){var l=(n=e.props.monthsShown)!==null&&n!==void 0?n:o.defaultProps.monthsShown,c=e.props.showPreviousMonths?l-1:0,u=(a=e.props.monthSelectedIn)!==null&&a!==void 0?a:c,p=Fe(e.state.date,u),d;switch(!0){case e.props.disabled:d=!0;break;case e.props.showMonthYearPicker:d=hr(e.state.date,e.props);break;case e.props.showYearPicker:d=Zs(e.state.date,e.props);break;case e.props.showQuarterYearPicker:d=Us(e.state.date,e.props);break;default:d=fr(p,e.props);break}if(!(!((i=e.props.forceShowMonthNavigation)!==null&&i!==void 0?i:o.defaultProps.forceShowMonthNavigation)&&!e.props.showDisabledMonthNavigation&&d||e.props.showTimeSelectOnly)){var m=["react-datepicker__navigation-icon","react-datepicker__navigation-icon--previous"],f=["react-datepicker__navigation","react-datepicker__navigation--previous"],h=e.decreaseMonth;(e.props.showMonthYearPicker||e.props.showQuarterYearPicker||e.props.showYearPicker)&&(h=e.decreaseYear),d&&e.props.showDisabledMonthNavigation&&(f.push("react-datepicker__navigation--previous--disabled"),h=void 0);var y=e.props.showMonthYearPicker||e.props.showQuarterYearPicker||e.props.showYearPicker,g=e.props,k=g.previousMonthButtonLabel,_=k===void 0?o.defaultProps.previousMonthButtonLabel:k,j=g.previousYearButtonLabel,C=j===void 0?o.defaultProps.previousYearButtonLabel:j,D=e.props,b=D.previousMonthAriaLabel,w=b===void 0?typeof _=="string"?_:"Previous Month":b,S=D.previousYearAriaLabel,N=S===void 0?typeof C=="string"?C:"Previous Year":S;return x.createElement("button",{type:"button",className:f.join(" "),onClick:h,onKeyDown:e.props.handleOnKeyDown,"aria-label":y?N:w},x.createElement("span",{className:m.join(" ")},y?C:_))}}},e.increaseYear=function(){e.setState(function(n){var a,i=n.date;return{date:me(i,e.props.showYearPicker?(a=e.props.yearItemNumber)!==null&&a!==void 0?a:o.defaultProps.yearItemNumber:1)}},function(){return e.handleYearChange(e.state.date)})},e.renderNextButton=function(){var n;if(!e.props.renderCustomHeader){var a;switch(!0){case e.props.disabled:a=!0;break;case e.props.showMonthYearPicker:a=vr(e.state.date,e.props);break;case e.props.showYearPicker:a=qs(e.state.date,e.props);break;case e.props.showQuarterYearPicker:a=Qs(e.state.date,e.props);break;default:a=mr(e.state.date,e.props);break}if(!(!((n=e.props.forceShowMonthNavigation)!==null&&n!==void 0?n:o.defaultProps.forceShowMonthNavigation)&&!e.props.showDisabledMonthNavigation&&a||e.props.showTimeSelectOnly)){var i=["react-datepicker__navigation","react-datepicker__navigation--next"],l=["react-datepicker__navigation-icon","react-datepicker__navigation-icon--next"];e.props.showTimeSelect&&i.push("react-datepicker__navigation--next--with-time"),e.props.todayButton&&i.push("react-datepicker__navigation--next--with-today-button");var c=e.increaseMonth;(e.props.showMonthYearPicker||e.props.showQuarterYearPicker||e.props.showYearPicker)&&(c=e.increaseYear),a&&e.props.showDisabledMonthNavigation&&(i.push("react-datepicker__navigation--next--disabled"),c=void 0);var u=e.props.showMonthYearPicker||e.props.showQuarterYearPicker||e.props.showYearPicker,p=e.props,d=p.nextMonthButtonLabel,m=d===void 0?o.defaultProps.nextMonthButtonLabel:d,f=p.nextYearButtonLabel,h=f===void 0?o.defaultProps.nextYearButtonLabel:f,y=e.props,g=y.nextMonthAriaLabel,k=g===void 0?typeof m=="string"?m:"Next Month":g,_=y.nextYearAriaLabel,j=_===void 0?typeof h=="string"?h:"Next Year":_;return x.createElement("button",{type:"button",className:i.join(" "),onClick:c,onKeyDown:e.props.handleOnKeyDown,"aria-label":u?j:k},x.createElement("span",{className:l.join(" ")},u?h:m))}}},e.renderCurrentMonth=function(n){n===void 0&&(n=e.state.date);var a=["react-datepicker__current-month"];return e.props.showYearDropdown&&a.push("react-datepicker__current-month--hasYearDropdown"),e.props.showMonthDropdown&&a.push("react-datepicker__current-month--hasMonthDropdown"),e.props.showMonthYearDropdown&&a.push("react-datepicker__current-month--hasMonthYearDropdown"),x.createElement("h2",{className:a.join(" ")},ne(n)?U(n,e.props.dateFormat,e.props.locale):"")},e.renderYearDropdown=function(n){if(n===void 0&&(n=!1),!(!e.props.showYearDropdown||n))return x.createElement(hi,F({},o.defaultProps,e.props,{date:e.state.date,onChange:e.changeYear,year:Y(e.state.date)}))},e.renderMonthDropdown=function(n){if(n===void 0&&(n=!1),!(!e.props.showMonthDropdown||n))return x.createElement(ii,F({},o.defaultProps,e.props,{month:re(e.state.date),onChange:e.changeMonth}))},e.renderMonthYearDropdown=function(n){if(n===void 0&&(n=!1),!(!e.props.showMonthYearDropdown||n))return x.createElement(di,F({},o.defaultProps,e.props,{date:e.state.date,onChange:e.changeMonthYear}))},e.handleTodayButtonClick=function(n){e.props.onSelect(lr(),n),e.props.setPreSelection&&e.props.setPreSelection(lr())},e.renderTodayButton=function(){if(!(!e.props.todayButton||e.props.showTimeSelectOnly))return x.createElement("div",{className:"react-datepicker__today-button",onClick:e.handleTodayButtonClick},e.props.todayButton)},e.renderDayNamesHeader=function(n,a){return a===void 0&&(a=0),x.createElement("div",{className:"react-datepicker__day-names",role:"row"},e.header(n,a))},e.renderDefaultHeader=function(n){var a=n.monthDate,i=n.i,l=x.createElement("div",{className:Z("react-datepicker__header",{"react-datepicker__header--has-time-select":e.props.showTimeSelect,"react-datepicker__header--middle":e.props.monthHeaderPosition==="middle","react-datepicker__header--bottom":e.props.monthHeaderPosition==="bottom"})},e.renderCurrentMonth(a),x.createElement("div",{className:"react-datepicker__header__dropdown react-datepicker__header__dropdown--".concat(e.props.dropdownMode),onFocus:e.handleDropdownFocus},e.renderMonthDropdown(i!==0),e.renderMonthYearDropdown(i!==0),e.renderYearDropdown(i!==0)));return e.props.monthHeaderPosition==="top"?l:x.createElement("div",{className:"react-datepicker__header-wrapper"},e.renderPreviousButton()||null,e.renderNextButton()||null,l)},e.renderCustomHeader=function(n){var a,i,l=n.monthDate,c=n.i;if(e.props.showTimeSelect&&!e.state.monthContainer||e.props.showTimeSelectOnly)return null;var u=e.props,p=u.showYearPicker,d=u.yearItemNumber,m;if(p){var f=xe(l,d),h=f.startPeriod,y=f.endPeriod;m={startYear:h,endYear:y}}var g=fr(e.state.date,e.props),k=mr(e.state.date,e.props),_=hr(e.state.date,e.props),j=vr(e.state.date,e.props);return x.createElement("div",{className:"react-datepicker__header react-datepicker__header--custom",onFocus:e.props.onDropdownFocus},(i=(a=e.props).renderCustomHeader)===null||i===void 0?void 0:i.call(a,F(F(F({},e.state),p&&{visibleYearsRange:m}),{customHeaderCount:c,monthDate:l,changeMonth:e.changeMonth,changeYear:e.changeYear,decreaseMonth:e.decreaseMonth,increaseMonth:e.increaseMonth,decreaseYear:e.decreaseYear,increaseYear:e.increaseYear,prevMonthButtonDisabled:g,nextMonthButtonDisabled:k,prevYearButtonDisabled:_,nextYearButtonDisabled:j})))},e.renderYearHeader=function(n){var a=n.monthDate,i=e.props,l=i.showYearPicker,c=i.yearItemNumber,u=c===void 0?o.defaultProps.yearItemNumber:c,p=xe(a,u),d=p.startPeriod,m=p.endPeriod;return x.createElement("div",{className:"react-datepicker__header react-datepicker-year-header"},l?"".concat(d," - ").concat(m):Y(a))},e.renderHeader=function(n){var a=n.monthDate,i=n.i,l=i===void 0?0:i,c={monthDate:a,i:l};switch(!0){case e.props.renderCustomHeader!==void 0:return e.renderCustomHeader(c);case(e.props.showMonthYearPicker||e.props.showQuarterYearPicker||e.props.showYearPicker):return e.renderYearHeader(c);default:return e.renderDefaultHeader(c)}},e.renderMonths=function(){var n,a;if(!(e.props.showTimeSelectOnly||e.props.showYearPicker)){for(var i=[],l=(n=e.props.monthsShown)!==null&&n!==void 0?n:o.defaultProps.monthsShown,c=e.props.showPreviousMonths?l-1:0,u=e.props.showMonthYearPicker||e.props.showQuarterYearPicker?me(e.state.date,c):Fe(e.state.date,c),p=(a=e.props.monthSelectedIn)!==null&&a!==void 0?a:c,d=0;d0;i.push(x.createElement("div",{key:h,ref:function(k){e.monthContainer=k??void 0},className:"react-datepicker__month-container"},e.props.monthHeaderPosition==="top"&&e.renderHeader({monthDate:f,i:d}),x.createElement(oi,F({},o.defaultProps,e.props,{containerRef:e.containerRef,ariaLabelPrefix:e.props.monthAriaLabelPrefix,day:f,onDayClick:e.handleDayClick,handleOnKeyDown:e.props.handleOnDayKeyDown,handleOnMonthKeyDown:e.props.handleOnKeyDown,onDayMouseEnter:e.handleDayMouseEnter,onMouseLeave:e.handleMonthMouseLeave,orderInDisplay:d,selectingDate:e.state.selectingDate,monthShowsDuplicateDaysEnd:y,monthShowsDuplicateDaysStart:g,dayNamesHeader:e.renderDayNamesHeader(f,d),monthHeader:e.props.monthHeaderPosition==="middle"?e.renderHeader({monthDate:f,i:d}):void 0,monthFooter:e.props.monthHeaderPosition==="bottom"?e.renderHeader({monthDate:f,i:d}):void 0}))))}return i}},e.renderYears=function(){if(!e.props.showTimeSelectOnly&&e.props.showYearPicker)return x.createElement("div",{className:"react-datepicker__year--container"},e.renderHeader({monthDate:e.state.date}),x.createElement(pi,F({},o.defaultProps,e.props,{selectingDate:e.state.selectingDate,date:e.state.date,onDayClick:e.handleDayClick,clearSelectingDate:e.clearSelectingDate,onYearMouseEnter:e.handleYearMouseEnter,onYearMouseLeave:e.handleYearMouseLeave})))},e.renderTimeSection=function(){if(e.props.showTimeSelect&&(e.state.monthContainer||e.props.showTimeSelectOnly))return x.createElement(ui,F({},o.defaultProps,e.props,{onChange:e.props.onTimeChange,format:e.props.timeFormat,intervals:e.props.timeIntervals,monthRef:e.state.monthContainer}))},e.renderInputTimeSection=function(){var n,a;if(e.props.showTimeInput){if(e.props.selectsRange){var i=e.props,l=i.startDate,c=i.endDate,u=l?new Date(l):void 0,p=u&&ne(u)&&!!l,d=p?"".concat(Ve(u.getHours()),":").concat(Ve(u.getMinutes())):"",m=c?new Date(c):void 0,f=m&&ne(m)&&!!c,h=f?"".concat(Ve(m.getHours()),":").concat(Ve(m.getMinutes())):"";return x.createElement(x.Fragment,null,x.createElement(ln,F({},o.defaultProps,e.props,{date:u,timeString:d,onChange:function(_){var j,C;(C=(j=e.props).onTimeChange)===null||C===void 0||C.call(j,_,"start")},timeInputLabel:((n=e.props.timeInputLabel)!==null&&n!==void 0?n:"Time")+" (Start)"})),x.createElement(ln,F({},o.defaultProps,e.props,{date:m,timeString:h,onChange:function(_){var j,C;(C=(j=e.props).onTimeChange)===null||C===void 0||C.call(j,_,"end")},timeInputLabel:((a=e.props.timeInputLabel)!==null&&a!==void 0?a:"Time")+" (End)"})))}var y=e.props.selected?new Date(e.props.selected):void 0,g=y&&ne(y)&&!!e.props.selected,k=g?"".concat(Ve(y.getHours()),":").concat(Ve(y.getMinutes())):"";return x.createElement(ln,F({},o.defaultProps,e.props,{date:y,timeString:k,onChange:function(_){var j,C;(C=(j=e.props).onTimeChange)===null||C===void 0||C.call(j,_)}}))}},e.renderAriaLiveRegion=function(){var n;if(!ne(e.state.date))return x.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"});var a=xe(e.state.date,(n=e.props.yearItemNumber)!==null&&n!==void 0?n:o.defaultProps.yearItemNumber),i=a.startPeriod,l=a.endPeriod,c;return e.props.showYearPicker?c="".concat(i," - ").concat(l):e.props.showMonthYearPicker||e.props.showQuarterYearPicker?c=Y(e.state.date):c="".concat(Ln(re(e.state.date),e.props.locale)," ").concat(Y(e.state.date)),x.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"},e.state.isRenderAriaLiveMessage&&c)},e.renderChildren=function(){if(e.props.children)return x.createElement("div",{className:"react-datepicker__children-container"},e.props.children)},e.containerRef=v.createRef(),e.state={date:e.getDateInView(),selectingDate:void 0,monthContainer:void 0,isRenderAriaLiveMessage:!1},e}return Object.defineProperty(o,"defaultProps",{get:function(){return{monthsShown:1,forceShowMonthNavigation:!1,outsideClickIgnoreClass:ua,timeCaption:"Time",previousYearButtonLabel:"Previous Year",nextYearButtonLabel:"Next Year",previousMonthButtonLabel:"Previous Month",nextMonthButtonLabel:"Next Month",yearItemNumber:wt,monthHeaderPosition:"top"}},enumerable:!1,configurable:!0}),o.prototype.componentDidMount=function(){var t=this;this.props.showTimeSelect&&(this.assignMonthContainer=function(){t.setState({monthContainer:t.monthContainer})}())},o.prototype.componentDidUpdate=function(t){var e=this;if(this.props.preSelection&&ne(this.props.preSelection)&&(!W(this.props.preSelection,t.preSelection)||this.props.monthSelectedIn!==t.monthSelectedIn)){var n=!J(this.state.date,this.props.preSelection);this.setState({date:this.props.preSelection},function(){return n&&e.handleCustomMonthChange(e.state.date)})}else this.props.openToDate&&!W(this.props.openToDate,t.openToDate)&&this.setState({date:this.props.openToDate})},o.prototype.render=function(){var t=this.props.container||Ts;return x.createElement(Gt,{onClickOutside:this.handleClickOutside,style:{display:"contents"},ignoreClass:this.props.outsideClickIgnoreClass},x.createElement("div",{style:{display:"contents"},ref:this.containerRef},x.createElement(t,{className:Z("react-datepicker",this.props.className,{"react-datepicker--time-only":this.props.showTimeSelectOnly}),showTime:this.props.showTimeSelect||this.props.showTimeInput,showTimeSelectOnly:this.props.showTimeSelectOnly,inline:this.props.inline},this.renderAriaLiveRegion(),this.props.monthHeaderPosition==="top"&&this.renderPreviousButton(),this.props.monthHeaderPosition==="top"&&this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.renderChildren())))},o}(v.Component),xi=function(r){var o=r.icon,t=r.className,e=t===void 0?"":t,n=r.onClick,a="react-datepicker__calendar-icon";if(typeof o=="string")return x.createElement("i",{className:"".concat(a," ").concat(o," ").concat(e),"aria-hidden":"true",onClick:n});if(x.isValidElement(o)){var i=o;return x.cloneElement(i,{className:"".concat(i.props.className||""," ").concat(a," ").concat(e),onClick:function(l){typeof i.props.onClick=="function"&&i.props.onClick(l),typeof n=="function"&&n(l)}})}return x.createElement("svg",{className:"".concat(a," ").concat(e),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",onClick:n},x.createElement("path",{d:"M96 32V64H48C21.5 64 0 85.5 0 112v48H448V112c0-26.5-21.5-48-48-48H352V32c0-17.7-14.3-32-32-32s-32 14.3-32 32V64H160V32c0-17.7-14.3-32-32-32S96 14.3 96 32zM448 192H0V464c0 26.5 21.5 48 48 48H400c26.5 0 48-21.5 48-48V192z"}))},pa=function(r){q(o,r);function o(t){var e=r.call(this,t)||this;return e.portalRoot=null,e.el=document.createElement("div"),e}return o.prototype.componentDidMount=function(){this.portalRoot=(this.props.portalHost||document).getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement("div"),this.portalRoot.setAttribute("id",this.props.portalId),(this.props.portalHost||document.body).appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)},o.prototype.componentWillUnmount=function(){this.portalRoot&&this.portalRoot.removeChild(this.el)},o.prototype.render=function(){return xa.createPortal(this.props.children,this.el)},o}(v.Component),bi="[tabindex], a, button, input, select, textarea",ki=function(r){return(r instanceof HTMLAnchorElement||!r.disabled)&&r.tabIndex!==-1},fa=function(r){q(o,r);function o(t){var e=r.call(this,t)||this;return e.getTabChildren=function(){var n;return Array.prototype.slice.call((n=e.tabLoopRef.current)===null||n===void 0?void 0:n.querySelectorAll(bi),1,-1).filter(ki)},e.handleFocusStart=function(){var n=e.getTabChildren();n&&n.length>1&&n[n.length-1].focus()},e.handleFocusEnd=function(){var n=e.getTabChildren();n&&n.length>1&&n[0].focus()},e.tabLoopRef=v.createRef(),e}return o.prototype.render=function(){var t;return((t=this.props.enableTabLoop)!==null&&t!==void 0?t:o.defaultProps.enableTabLoop)?x.createElement("div",{className:"react-datepicker__tab-loop",ref:this.tabLoopRef},x.createElement("div",{className:"react-datepicker__tab-loop__start",tabIndex:0,onFocus:this.handleFocusStart}),this.props.children,x.createElement("div",{className:"react-datepicker__tab-loop__end",tabIndex:0,onFocus:this.handleFocusEnd})):this.props.children},o.defaultProps={enableTabLoop:!0},o}(v.Component);function wi(r){function o(t){var e,n=typeof t.hidePopper=="boolean"?t.hidePopper:!0,a=v.useRef(null),i=Ps(F({open:!n,whileElementsMounted:cs,placement:t.popperPlacement,middleware:fe([gs({padding:15}),ys(10),xs({element:a})],(e=t.popperModifiers)!==null&&e!==void 0?e:[],!0)},t.popperProps)),l=F(F({},t),{hidePopper:n,popperProps:F(F({},i),{arrowRef:a})});return x.createElement(r,F({},l))}return o.displayName="withFloating(".concat(r.displayName||r.name||"Component",")"),o}var _i=function(r){var o=r.className,t=r.wrapperClassName,e=r.hidePopper,n=e===void 0?!0:e,a=r.popperComponent,i=r.targetComponent,l=r.enableTabLoop,c=r.popperOnKeyDown,u=r.portalId,p=r.portalHost,d=r.popperProps,m=r.showArrow,f=r.popperTargetRef,h=r.monthHeaderPosition;v.useEffect(function(){f?.current&&d.refs.setPositionReference(f.current)},[f,d.refs]);var y=void 0;if(!n){var g=Z("react-datepicker-popper",!m&&"react-datepicker-popper-offset",h==="middle"&&"react-datepicker-popper--header-middle",h==="bottom"&&"react-datepicker-popper--header-bottom",o);y=x.createElement(fa,{enableTabLoop:l},x.createElement("div",{ref:d.refs.setFloating,style:d.floatingStyles,className:g,"data-placement":d.placement,onKeyDown:c},a,m&&x.createElement(Ds,{ref:d.arrowRef,context:d.context,fill:"currentColor",strokeWidth:1,height:8,width:16,style:{transform:"translateY(-1px)"},className:"react-datepicker__triangle"})))}r.popperContainer&&(y=v.createElement(r.popperContainer,{},y)),u&&!n&&(y=x.createElement(pa,{portalId:u,portalHost:p},y));var k=Z("react-datepicker-wrapper",t);return x.createElement(x.Fragment,null,x.createElement("div",{ref:d.refs.setReference,className:k},i),y)},Di=wi(_i);function Dr(r,o){return r&&o?re(r)!==re(o)||Y(r)!==Y(o):r!==o}var dn="Date input not valid.",un=function(r){q(o,r);function o(t){var e=r.call(this,t)||this;return e.calendar=null,e.input=null,e.getPreSelection=function(){var n=e.props.timeZone,a=e.props.openToDate?e.props.openToDate:e.props.selectsEnd&&e.props.startDate?e.props.startDate:e.props.selectsStart&&e.props.endDate?e.props.endDate:H();return n?sr(a,n):a},e.modifyHolidays=function(){var n;return(n=e.props.holidays)===null||n===void 0?void 0:n.reduce(function(a,i){var l=Te(i.date,"yyyy-MM-dd",void 0,!1);return l?fe(fe([],a,!0),[F(F({},i),{date:l})],!1):a},[])},e.calcInitialState=function(){var n=e.props.timeZone,a=e.getPreSelection(),i=ia(e.props),l=la(e.props),c=i&&pe(a,ut(i))?i:l&&be(a,cr(l))?l:a,u=e.props.selectsRange?e.props.startDate:e.props.selected;return u&&n&&(u=sr(u,n)),{open:e.props.startOpen||!1,preventFocus:!1,inputValue:null,preSelection:u??c,highlightDates:yr(e.props.highlightDates),focused:!1,shouldFocusDayInline:!1,isRenderAriaLiveMessage:!1,wasHidden:!1}},e.getInputValue=function(){var n,a=e.props,i=a.locale,l=a.startDate,c=a.endDate,u=a.rangeSeparator,p=a.selected,d=a.selectedDates,m=a.selectsMultiple,f=a.selectsRange,h=a.formatMultipleDates,y=a.value,g=(n=e.props.dateFormat)!==null&&n!==void 0?n:o.defaultProps.dateFormat,k=e.state.inputValue;if(typeof y=="string")return y;if(typeof k=="string")return k;if(f)return Rs(l,c,{dateFormat:g,locale:i,rangeSeparator:u});if(m){if(h){var _=function(j){return te(j,{dateFormat:g,locale:i})};return h(d??[],_)}return Ls(d??[],{dateFormat:g,locale:i})}return te(p,{dateFormat:g,locale:i})},e.resetHiddenStatus=function(){e.setState(F(F({},e.state),{wasHidden:!1}))},e.setHiddenStatus=function(){e.setState(F(F({},e.state),{wasHidden:!0}))},e.setHiddenStateOnVisibilityHidden=function(){document.visibilityState==="hidden"&&e.setHiddenStatus()},e.clearPreventFocusTimeout=function(){e.preventFocusTimeout&&clearTimeout(e.preventFocusTimeout)},e.setFocus=function(){var n,a;(a=(n=e.input)===null||n===void 0?void 0:n.focus)===null||a===void 0||a.call(n,{preventScroll:!0})},e.setBlur=function(){var n,a;(a=(n=e.input)===null||n===void 0?void 0:n.blur)===null||a===void 0||a.call(n),e.cancelFocusInput()},e.deferBlur=function(){requestAnimationFrame(function(){e.setBlur()})},e.setOpen=function(n,a){a===void 0&&(a=!1),e.setState({open:n,preSelection:n&&e.state.open?e.state.preSelection:e.calcInitialState().preSelection,lastPreSelectChange:pn},function(){n||e.setState(function(i){return{focused:a?i.focused:!1}},function(){!a&&e.deferBlur(),e.setState({inputValue:null})})})},e.inputOk=function(){return ke(e.state.preSelection)},e.isCalendarOpen=function(){return e.props.open===void 0?e.state.open&&!e.props.disabled&&!e.props.readOnly:e.props.open},e.handleFocus=function(n){var a,i,l=e.state.wasHidden,c=l?e.state.open:!0;l&&e.resetHiddenStatus(),e.state.preventFocus||((i=(a=e.props).onFocus)===null||i===void 0||i.call(a,n),c&&!e.props.preventOpenOnFocus&&!e.props.readOnly&&e.setOpen(!0)),e.setState({focused:!0})},e.sendFocusBackToInput=function(){e.preventFocusTimeout&&e.clearPreventFocusTimeout(),e.setState({preventFocus:!0},function(){e.preventFocusTimeout=setTimeout(function(){e.setFocus(),e.setState({preventFocus:!1})})})},e.cancelFocusInput=function(){clearTimeout(e.inputFocusTimeout),e.inputFocusTimeout=void 0},e.deferFocusInput=function(){e.cancelFocusInput(),e.inputFocusTimeout=setTimeout(function(){return e.setFocus()},1)},e.handleDropdownFocus=function(){e.cancelFocusInput()},e.resetInputValue=function(){e.setState(F(F({},e.state),{inputValue:null}))},e.handleBlur=function(n){var a,i;(!e.state.open||e.props.withPortal||e.props.showTimeInput)&&((i=(a=e.props).onBlur)===null||i===void 0||i.call(a,n));var l=e.state.inputValue;if(typeof l=="string"&&l.length>0){var c=/[a-zA-Z0-9]/.test(l);!c&&e.props.selected&&e.setSelected(null,void 0,!0)}e.resetInputValue(),e.state.open&&e.props.open===!1&&e.setOpen(!1),e.setState({focused:!1})},e.handleCalendarClickOutside=function(n){var a,i;(i=(a=e.props).onClickOutside)===null||i===void 0||i.call(a,n),!e.props.inline&&!n.defaultPrevented&&e.setOpen(!1),e.props.withPortal&&n.preventDefault()},e.handleChange=function(){for(var n,a,i,l,c,u,p,d,m=[],f=0;f=E){I=P;break}m&&If&&(O=M.ArrowLeft,I=ie(f,e.props)?S(O,I):f),ie(I,e.props)?((O===M.PageUp||O===M.Home)&&(O=M.ArrowRight),(O===M.PageDown||O===M.End)&&(O=M.ArrowLeft),I=S(O,I)):L=!0,R++}return I};if(D===M.Enter){n.preventDefault(),e.handleSelect(w,n),!g&&e.setPreSelection(w);return}else if(D===M.Escape){n.preventDefault(),e.setOpen(!1),e.inputOk()||(c=(l=e.props).onInputError)===null||c===void 0||c.call(l,{code:1,msg:dn});return}var A=null;switch(D){case M.ArrowLeft:case M.ArrowRight:case M.ArrowUp:case M.ArrowDown:case M.PageUp:case M.PageDown:case M.Home:case M.End:A=N(D,w);break}if(!A){(p=(u=e.props).onInputError)===null||p===void 0||p.call(u,{code:1,msg:dn});return}n.preventDefault(),e.setState({lastPreSelectChange:pn}),j&&e.setSelected(A),e.setPreSelection(A),C&&e.setState({shouldFocusDayInline:!0})}},e.onPopperKeyDown=function(n){var a=n.key;a===M.Escape&&(n.preventDefault(),e.sendFocusBackToInput(),e.setOpen(!1))},e.onClearClick=function(n){n&&n.preventDefault&&n.preventDefault(),e.sendFocusBackToInput();var a=e.props,i=a.selectsRange,l=a.onChange;l?.(i?[null,null]:null,n),e.setState({inputValue:null})},e.clear=function(){e.onClearClick()},e.onScroll=function(n){typeof e.props.closeOnScroll=="boolean"&&e.props.closeOnScroll?(n.target===document||n.target===document.documentElement||n.target===document.body)&&e.setOpen(!1):typeof e.props.closeOnScroll=="function"&&e.props.closeOnScroll(n)&&e.setOpen(!1)},e.handleMonthSelectedInChange=function(n){e.setState({monthSelectedIn:n})},e.renderCalendar=function(){var n,a;return!e.props.inline&&!e.isCalendarOpen()?null:x.createElement(gi,F({showMonthYearDropdown:void 0,ref:function(i){e.calendar=i}},e.props,e.state,{setOpen:e.setOpen,dateFormat:(n=e.props.dateFormatCalendar)!==null&&n!==void 0?n:o.defaultProps.dateFormatCalendar,onSelect:e.handleSelect,onClickOutside:e.handleCalendarClickOutside,holidays:Gs(e.modifyHolidays()),outsideClickIgnoreClass:e.props.outsideClickIgnoreClass,onDropdownFocus:e.handleDropdownFocus,onTimeChange:e.handleTimeChange,className:e.props.calendarClassName,container:e.props.calendarContainer,handleOnKeyDown:e.props.onKeyDown,handleOnDayKeyDown:e.onDayKeyDown,setPreSelection:e.setPreSelection,dropdownMode:(a=e.props.dropdownMode)!==null&&a!==void 0?a:o.defaultProps.dropdownMode,onMonthSelectedInChange:e.handleMonthSelectedInChange}),e.props.children)},e.renderAriaLiveRegion=function(){var n,a=e.props.locale,i=(n=e.props.dateFormat)!==null&&n!==void 0?n:o.defaultProps.dateFormat,l=e.props.showTimeInput||e.props.showTimeSelect,c=l?"PPPPp":"PPPP",u;return e.props.selectsRange?u="Selected start date: ".concat(te(e.props.startDate,{dateFormat:c,locale:a}),". ").concat(e.props.endDate?"End date: "+te(e.props.endDate,{dateFormat:c,locale:a}):""):e.props.showTimeSelectOnly?u="Selected time: ".concat(te(e.props.selected,{dateFormat:i,locale:a})):e.props.showYearPicker?u="Selected year: ".concat(te(e.props.selected,{dateFormat:"yyyy",locale:a})):e.props.showMonthYearPicker?u="Selected month: ".concat(te(e.props.selected,{dateFormat:"MMMM yyyy",locale:a})):e.props.showQuarterYearPicker?u="Selected quarter: ".concat(te(e.props.selected,{dateFormat:"yyyy, QQQ",locale:a})):u="Selected date: ".concat(te(e.props.selected,{dateFormat:c,locale:a})),x.createElement("span",{role:"alert","aria-live":"polite",className:"react-datepicker__aria-live"},u)},e.renderDateInput=function(){var n,a,i,l,c,u,p,d=Z(e.props.className,(n={},n[e.props.outsideClickIgnoreClass||o.defaultProps.outsideClickIgnoreClass]=e.state.open,n)),m=e.props.customInput||x.createElement("input",{type:"text"}),f=e.props.customInputRef||"ref",h={},y=(i=e.props["aria-describedby"])!==null&&i!==void 0?i:e.props.ariaDescribedBy,g=(l=e.props["aria-invalid"])!==null&&l!==void 0?l:e.props.ariaInvalid,k=(c=e.props["aria-label"])!==null&&c!==void 0?c:e.props.ariaLabel,_=(u=e.props["aria-labelledby"])!==null&&u!==void 0?u:e.props.ariaLabelledBy,j=(p=e.props["aria-required"])!==null&&p!==void 0?p:e.props.ariaRequired;return y!=null&&(h["aria-describedby"]=y),g!=null&&(h["aria-invalid"]=g),k!=null&&(h["aria-label"]=k),_!=null&&(h["aria-labelledby"]=_),j!=null&&(h["aria-required"]=j),v.cloneElement(m,F((a={},a[f]=function(C){e.input=C},a.value=e.getInputValue(),a.onBlur=e.handleBlur,a.onChange=e.handleChange,a.onClick=e.onInputClick,a.onFocus=e.handleFocus,a.onKeyDown=e.onInputKeyDown,a.id=e.props.id,a.name=e.props.name,a.form=e.props.form,a.autoFocus=e.props.autoFocus,a.placeholder=e.props.placeholderText,a.disabled=e.props.disabled,a.autoComplete=e.props.autoComplete,a.className=Z(m.props.className,d),a.title=e.props.title,a.readOnly=e.props.readOnly,a.required=e.props.required,a.tabIndex=e.props.tabIndex,a),h))},e.renderClearButton=function(){var n=e.props,a=n.isClearable,i=n.disabled,l=n.selected,c=n.startDate,u=n.endDate,p=n.clearButtonTitle,d=n.clearButtonClassName,m=d===void 0?"":d,f=n.ariaLabelClose,h=f===void 0?"Close":f,y=n.selectedDates,g=n.readOnly;return a&&!g&&(l!=null||c!=null||u!=null||y?.length)?x.createElement("button",{type:"button",className:Z("react-datepicker__close-icon",m,{"react-datepicker__close-icon--disabled":i}),disabled:i,"aria-label":h,onClick:e.onClearClick,title:p,tabIndex:-1}):null},e.state=e.calcInitialState(),e.preventFocusTimeout=void 0,e}return Object.defineProperty(o,"defaultProps",{get:function(){return{allowSameDay:!1,dateFormat:"MM/dd/yyyy",dateFormatCalendar:"LLLL yyyy",disabled:!1,disabledKeyboardNavigation:!1,dropdownMode:"scroll",preventOpenOnFocus:!1,monthsShown:1,outsideClickIgnoreClass:ua,readOnly:!1,rangeSeparator:aa,withPortal:!1,selectsDisabledDaysInRange:!1,shouldCloseOnSelect:!0,showTimeSelect:!1,showTimeInput:!1,showPreviousMonths:!1,showMonthYearPicker:!1,showFullMonthYearPicker:!1,showTwoColumnMonthYearPicker:!1,showFourColumnMonthYearPicker:!1,showYearPicker:!1,showQuarterYearPicker:!1,showWeekPicker:!1,strictParsing:!1,swapRange:!1,timeIntervals:30,timeCaption:"Time",previousMonthAriaLabel:"Previous Month",previousMonthButtonLabel:"Previous Month",nextMonthAriaLabel:"Next Month",nextMonthButtonLabel:"Next Month",previousYearAriaLabel:"Previous Year",previousYearButtonLabel:"Previous Year",nextYearAriaLabel:"Next Year",nextYearButtonLabel:"Next Year",timeInputLabel:"Time",enableTabLoop:!0,yearItemNumber:wt,focusSelectedMonth:!1,showPopperArrow:!0,excludeScrollbar:!0,customTimeInput:null,calendarStartDay:void 0,toggleCalendarOnIconClick:!1,usePointerEvent:!1}},enumerable:!1,configurable:!0}),o.prototype.componentDidMount=function(){window.addEventListener("scroll",this.onScroll,!0),document.addEventListener("visibilitychange",this.setHiddenStateOnVisibilityHidden)},o.prototype.componentDidUpdate=function(t,e){var n,a,i,l;this.props.selectsRange&&Dr(t.startDate,this.props.startDate)?this.setPreSelection(this.props.startDate):Dr(t.selected,this.props.selected)&&this.setPreSelection(this.props.selected),this.state.monthSelectedIn!==void 0&&t.monthsShown!==this.props.monthsShown&&this.setState({monthSelectedIn:0}),this.props.selectsRange&&e.open===!1&&this.state.open===!0&&this.state.monthSelectedIn!==0&&this.setState({monthSelectedIn:0}),t.highlightDates!==this.props.highlightDates&&this.setState({highlightDates:yr(this.props.highlightDates)}),!e.focused&&!Le(t.selected,this.props.selected)&&this.setState({inputValue:null}),e.open!==this.state.open&&(e.open===!1&&this.state.open===!0&&((a=(n=this.props).onCalendarOpen)===null||a===void 0||a.call(n)),e.open===!0&&this.state.open===!1&&((l=(i=this.props).onCalendarClose)===null||l===void 0||l.call(i)))},o.prototype.componentWillUnmount=function(){this.clearPreventFocusTimeout(),window.removeEventListener("scroll",this.onScroll,!0),document.removeEventListener("visibilitychange",this.setHiddenStateOnVisibilityHidden)},o.prototype.renderInputContainer=function(){var t=this.props,e=t.showIcon,n=t.icon,a=t.calendarIconClassname,i=t.calendarIconClassName,l=t.toggleCalendarOnIconClick,c=this.state.open;return a&&console.warn("calendarIconClassname props is deprecated. should use calendarIconClassName props."),x.createElement("div",{className:"react-datepicker__input-container".concat(e?" react-datepicker__view-calendar-icon":"")},e&&x.createElement(xi,F({icon:n,className:Z(i,!i&&a,c&&"react-datepicker-ignore-onclickoutside")},l?{onClick:this.toggleCalendar}:null)),this.state.isRenderAriaLiveMessage&&this.renderAriaLiveRegion(),this.renderDateInput(),this.renderClearButton())},o.prototype.render=function(){var t=this.renderCalendar();if(this.props.inline)return t;if(this.props.withPortal){var e=this.state.open?x.createElement(fa,{enableTabLoop:this.props.enableTabLoop},x.createElement("div",{className:"react-datepicker__portal",tabIndex:-1,onKeyDown:this.onPortalKeyDown},t)):null;return this.state.open&&this.props.portalId&&(e=x.createElement(pa,F({portalId:this.props.portalId},this.props),e)),x.createElement(x.Fragment,null,this.renderInputContainer(),e)}return x.createElement(Di,F({},this.props,{className:this.props.popperClassName,hidePopper:!this.isCalendarOpen(),targetComponent:this.renderInputContainer(),popperComponent:t,popperOnKeyDown:this.onPopperKeyDown,showArrow:this.props.showPopperArrow,monthHeaderPosition:this.props.monthHeaderPosition}))},o}(v.Component),ji="input",pn="navigate";const Si={lessThanXSeconds:{one:{regular:"méně než 1 sekunda",past:"před méně než 1 sekundou",future:"za méně než 1 sekundu"},few:{regular:"méně než {{count}} sekundy",past:"před méně než {{count}} sekundami",future:"za méně než {{count}} sekundy"},many:{regular:"méně než {{count}} sekund",past:"před méně než {{count}} sekundami",future:"za méně než {{count}} sekund"}},xSeconds:{one:{regular:"1 sekunda",past:"před 1 sekundou",future:"za 1 sekundu"},few:{regular:"{{count}} sekundy",past:"před {{count}} sekundami",future:"za {{count}} sekundy"},many:{regular:"{{count}} sekund",past:"před {{count}} sekundami",future:"za {{count}} sekund"}},halfAMinute:{type:"other",other:{regular:"půl minuty",past:"před půl minutou",future:"za půl minuty"}},lessThanXMinutes:{one:{regular:"méně než 1 minuta",past:"před méně než 1 minutou",future:"za méně než 1 minutu"},few:{regular:"méně než {{count}} minuty",past:"před méně než {{count}} minutami",future:"za méně než {{count}} minuty"},many:{regular:"méně než {{count}} minut",past:"před méně než {{count}} minutami",future:"za méně než {{count}} minut"}},xMinutes:{one:{regular:"1 minuta",past:"před 1 minutou",future:"za 1 minutu"},few:{regular:"{{count}} minuty",past:"před {{count}} minutami",future:"za {{count}} minuty"},many:{regular:"{{count}} minut",past:"před {{count}} minutami",future:"za {{count}} minut"}},aboutXHours:{one:{regular:"přibližně 1 hodina",past:"přibližně před 1 hodinou",future:"přibližně za 1 hodinu"},few:{regular:"přibližně {{count}} hodiny",past:"přibližně před {{count}} hodinami",future:"přibližně za {{count}} hodiny"},many:{regular:"přibližně {{count}} hodin",past:"přibližně před {{count}} hodinami",future:"přibližně za {{count}} hodin"}},xHours:{one:{regular:"1 hodina",past:"před 1 hodinou",future:"za 1 hodinu"},few:{regular:"{{count}} hodiny",past:"před {{count}} hodinami",future:"za {{count}} hodiny"},many:{regular:"{{count}} hodin",past:"před {{count}} hodinami",future:"za {{count}} hodin"}},xDays:{one:{regular:"1 den",past:"před 1 dnem",future:"za 1 den"},few:{regular:"{{count}} dny",past:"před {{count}} dny",future:"za {{count}} dny"},many:{regular:"{{count}} dní",past:"před {{count}} dny",future:"za {{count}} dní"}},aboutXWeeks:{one:{regular:"přibližně 1 týden",past:"přibližně před 1 týdnem",future:"přibližně za 1 týden"},few:{regular:"přibližně {{count}} týdny",past:"přibližně před {{count}} týdny",future:"přibližně za {{count}} týdny"},many:{regular:"přibližně {{count}} týdnů",past:"přibližně před {{count}} týdny",future:"přibližně za {{count}} týdnů"}},xWeeks:{one:{regular:"1 týden",past:"před 1 týdnem",future:"za 1 týden"},few:{regular:"{{count}} týdny",past:"před {{count}} týdny",future:"za {{count}} týdny"},many:{regular:"{{count}} týdnů",past:"před {{count}} týdny",future:"za {{count}} týdnů"}},aboutXMonths:{one:{regular:"přibližně 1 měsíc",past:"přibližně před 1 měsícem",future:"přibližně za 1 měsíc"},few:{regular:"přibližně {{count}} měsíce",past:"přibližně před {{count}} měsíci",future:"přibližně za {{count}} měsíce"},many:{regular:"přibližně {{count}} měsíců",past:"přibližně před {{count}} měsíci",future:"přibližně za {{count}} měsíců"}},xMonths:{one:{regular:"1 měsíc",past:"před 1 měsícem",future:"za 1 měsíc"},few:{regular:"{{count}} měsíce",past:"před {{count}} měsíci",future:"za {{count}} měsíce"},many:{regular:"{{count}} měsíců",past:"před {{count}} měsíci",future:"za {{count}} měsíců"}},aboutXYears:{one:{regular:"přibližně 1 rok",past:"přibližně před 1 rokem",future:"přibližně za 1 rok"},few:{regular:"přibližně {{count}} roky",past:"přibližně před {{count}} roky",future:"přibližně za {{count}} roky"},many:{regular:"přibližně {{count}} roků",past:"přibližně před {{count}} roky",future:"přibližně za {{count}} roků"}},xYears:{one:{regular:"1 rok",past:"před 1 rokem",future:"za 1 rok"},few:{regular:"{{count}} roky",past:"před {{count}} roky",future:"za {{count}} roky"},many:{regular:"{{count}} roků",past:"před {{count}} roky",future:"za {{count}} roků"}},overXYears:{one:{regular:"více než 1 rok",past:"před více než 1 rokem",future:"za více než 1 rok"},few:{regular:"více než {{count}} roky",past:"před více než {{count}} roky",future:"za více než {{count}} roky"},many:{regular:"více než {{count}} roků",past:"před více než {{count}} roky",future:"za více než {{count}} roků"}},almostXYears:{one:{regular:"skoro 1 rok",past:"skoro před 1 rokem",future:"skoro za 1 rok"},few:{regular:"skoro {{count}} roky",past:"skoro před {{count}} roky",future:"skoro za {{count}} roky"},many:{regular:"skoro {{count}} roků",past:"skoro před {{count}} roky",future:"skoro za {{count}} roků"}}},Ci=(r,o,t)=>{let e;const n=Si[r];n.type==="other"?e=n.other:o===1?e=n.one:o>1&&o<5?e=n.few:e=n.many;const a=t?.addSuffix===!0,i=t?.comparison;let l;return a&&i===-1?l=e.past:a&&i===1?l=e.future:l=e.regular,l.replace("{{count}}",String(o))},Ni={full:"EEEE, d. MMMM yyyy",long:"d. MMMM yyyy",medium:"d. M. yyyy",short:"dd.MM.yyyy"},Mi={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},Ei={full:"{{date}} 'v' {{time}}",long:"{{date}} 'v' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Pi={date:en({formats:Ni,defaultWidth:"full"}),time:en({formats:Mi,defaultWidth:"full"}),dateTime:en({formats:Ei,defaultWidth:"full"})},Ti=["neděli","pondělí","úterý","středu","čtvrtek","pátek","sobotu"],Oi={lastWeek:"'poslední' eeee 've' p",yesterday:"'včera v' p",today:"'dnes v' p",tomorrow:"'zítra v' p",nextWeek:r=>{const o=r.getDay();return"'v "+Ti[o]+" o' p"},other:"P"},Ai=(r,o)=>{const t=Oi[r];return typeof t=="function"?t(o):t},Ri={narrow:["př. n. l.","n. l."],abbreviated:["př. n. l.","n. l."],wide:["před naším letopočtem","našeho letopočtu"]},Li={narrow:["1","2","3","4"],abbreviated:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"],wide:["1. čtvrtletí","2. čtvrtletí","3. čtvrtletí","4. čtvrtletí"]},Ii={narrow:["L","Ú","B","D","K","Č","Č","S","Z","Ř","L","P"],abbreviated:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],wide:["leden","únor","březen","duben","květen","červen","červenec","srpen","září","říjen","listopad","prosinec"]},Fi={narrow:["L","Ú","B","D","K","Č","Č","S","Z","Ř","L","P"],abbreviated:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],wide:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"]},Yi={narrow:["ne","po","út","st","čt","pá","so"],short:["ne","po","út","st","čt","pá","so"],abbreviated:["ned","pon","úte","stř","čtv","pát","sob"],wide:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"]},Wi={narrow:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},abbreviated:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},wide:{am:"dopoledne",pm:"odpoledne",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"}},zi={narrow:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},abbreviated:{am:"dop.",pm:"odp.",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"},wide:{am:"dopoledne",pm:"odpoledne",midnight:"půlnoc",noon:"poledne",morning:"ráno",afternoon:"odpoledne",evening:"večer",night:"noc"}},Bi=(r,o)=>Number(r)+".",Hi={ordinalNumber:Bi,era:at({values:Ri,defaultWidth:"wide"}),quarter:at({values:Li,defaultWidth:"wide",argumentCallback:r=>r-1}),month:at({values:Ii,defaultWidth:"wide",formattingValues:Fi,defaultFormattingWidth:"wide"}),day:at({values:Yi,defaultWidth:"wide"}),dayPeriod:at({values:Wi,defaultWidth:"wide",formattingValues:zi,defaultFormattingWidth:"wide"})},Vi=/^(\d+)\.?/i,$i=/\d+/i,Ki={narrow:/^(p[řr](\.|ed) Kr\.|p[řr](\.|ed) n\. l\.|po Kr\.|n\. l\.)/i,abbreviated:/^(p[řr](\.|ed) Kr\.|p[řr](\.|ed) n\. l\.|po Kr\.|n\. l\.)/i,wide:/^(p[řr](\.|ed) Kristem|p[řr](\.|ed) na[šs][íi]m letopo[čc]tem|po Kristu|na[šs]eho letopo[čc]tu)/i},Ui={any:[/^p[řr]/i,/^(po|n)/i]},Qi={narrow:/^[1234]/i,abbreviated:/^[1234]\. [čc]tvrtlet[íi]/i,wide:/^[1234]\. [čc]tvrtlet[íi]/i},Zi={any:[/1/i,/2/i,/3/i,/4/i]},qi={narrow:/^[lúubdkčcszřrlp]/i,abbreviated:/^(led|[úu]no|b[řr]e|dub|kv[ěe]|[čc]vn|[čc]vc|srp|z[áa][řr]|[řr][íi]j|lis|pro)/i,wide:/^(leden|ledna|[úu]nora?|b[řr]ezen|b[řr]ezna|duben|dubna|kv[ěe]ten|kv[ěe]tna|[čc]erven(ec|ce)?|[čc]ervna|srpen|srpna|z[áa][řr][íi]|[řr][íi]jen|[řr][íi]jna|listopad(a|u)?|prosinec|prosince)/i},Xi={narrow:[/^l/i,/^[úu]/i,/^b/i,/^d/i,/^k/i,/^[čc]/i,/^[čc]/i,/^s/i,/^z/i,/^[řr]/i,/^l/i,/^p/i],any:[/^led/i,/^[úu]n/i,/^b[řr]e/i,/^dub/i,/^kv[ěe]/i,/^[čc]vn|[čc]erven(?!\w)|[čc]ervna/i,/^[čc]vc|[čc]erven(ec|ce)/i,/^srp/i,/^z[áa][řr]/i,/^[řr][íi]j/i,/^lis/i,/^pro/i]},Gi={narrow:/^[npuúsčps]/i,short:/^(ne|po|[úu]t|st|[čc]t|p[áa]|so)/i,abbreviated:/^(ned|pon|[úu]te|st[rř]|[čc]tv|p[áa]t|sob)/i,wide:/^(ned[ěe]le|pond[ěe]l[íi]|[úu]ter[ýy]|st[řr]eda|[čc]tvrtek|p[áa]tek|sobota)/i},Ji={narrow:[/^n/i,/^p/i,/^[úu]/i,/^s/i,/^[čc]/i,/^p/i,/^s/i],any:[/^ne/i,/^po/i,/^[úu]t/i,/^st/i,/^[čc]t/i,/^p[áa]/i,/^so/i]},el={any:/^dopoledne|dop\.?|odpoledne|odp\.?|p[ůu]lnoc|poledne|r[áa]no|odpoledne|ve[čc]er|(v )?noci?/i},tl={any:{am:/^dop/i,pm:/^odp/i,midnight:/^p[ůu]lnoc/i,noon:/^poledne/i,morning:/r[áa]no/i,afternoon:/odpoledne/i,evening:/ve[čc]er/i,night:/noc/i}},nl={ordinalNumber:La({matchPattern:Vi,parsePattern:$i,valueCallback:r=>parseInt(r,10)}),era:ot({matchPatterns:Ki,defaultMatchWidth:"wide",parsePatterns:Ui,defaultParseWidth:"any"}),quarter:ot({matchPatterns:Qi,defaultMatchWidth:"wide",parsePatterns:Zi,defaultParseWidth:"any",valueCallback:r=>r+1}),month:ot({matchPatterns:qi,defaultMatchWidth:"wide",parsePatterns:Xi,defaultParseWidth:"any"}),day:ot({matchPatterns:Gi,defaultMatchWidth:"wide",parsePatterns:Ji,defaultParseWidth:"any"}),dayPeriod:ot({matchPatterns:el,defaultMatchWidth:"any",parsePatterns:tl,defaultParseWidth:"any"})},rl={code:"cs",formatDistance:Ci,formatLong:Pi,formatRelative:Ai,localize:Hi,match:nl,options:{weekStartsOn:1,firstWeekContainsDate:4}};zs("cs",rl);if(typeof document<"u"&&!document.getElementById("datepicker-portal")){const r=document.createElement("div");r.id="datepicker-portal",document.body.appendChild(r)}const al=()=>typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0),ol=v.forwardRef(({value:r,onClick:o,onChange:t,placeholder:e,required:n,readOnly:a,disabled:i},l)=>s.jsx("input",{className:"admin-form-input",onClick:o,onChange:t,value:r,placeholder:e,ref:l,required:n,readOnly:a,disabled:i,autoComplete:"off"})),sl={month:"month",time:"time"};function il({mode:r,value:o,onChange:t,required:e,minDate:n,maxDate:a,disabled:i}){const l=sl[r]||"date";return s.jsx("input",{type:l,lang:"cs",value:o||"",onChange:c=>t(c.target.value),className:"admin-form-input",required:e,disabled:i,min:n||void 0,max:a||void 0})}function ll({mode:r="date",value:o,onChange:t,required:e,minDate:n,maxDate:a,...i}){if(v.useMemo(()=>al(),[]))return s.jsx(il,{mode:r,value:o,onChange:t,required:e,minDate:n,maxDate:a,disabled:i.disabled});const c=m=>{if(!m)return null;try{if(r==="date")return ct(m,"yyyy-MM-dd",new Date);if(r==="time"){const[f,h]=m.split(":"),y=new Date;return y.setHours(parseInt(f,10),parseInt(h,10),0,0),y}if(r==="month")return ct(m,"yyyy-MM",new Date)}catch{return null}return null},u=m=>{if(!m){t("");return}r==="date"?t(ft(m,"yyyy-MM-dd")):r==="time"?t(ft(m,"HH:mm")):r==="month"&&t(ft(m,"yyyy-MM"))},p=m=>{if(m){if(m instanceof Date)return m;try{if(r==="date")return ct(m,"yyyy-MM-dd",new Date);if(r==="month")return ct(m,"yyyy-MM",new Date)}catch{return}}},d={selected:c(o),onChange:u,locale:"cs",customInput:s.jsx(ol,{required:e}),minDate:p(n),maxDate:p(a),popperPlacement:"bottom-start",portalId:"datepicker-portal",...i};return r==="time"?s.jsx(un,{...d,showTimeSelect:!0,showTimeSelectOnly:!0,timeIntervals:5,timeCaption:"Čas",dateFormat:"HH:mm",timeFormat:"HH:mm"}):r==="month"?s.jsx(un,{...d,showMonthYearPicker:!0,dateFormat:"MM/yyyy"}):s.jsx(un,{...d,dateFormat:"dd.MM.yyyy"})}const fn="/api/admin";function cl({dashData:r,punching:o,onPunch:t}){const{hasPermission:e}=tt(),n=xt(),[a,i]=v.useState(!1),[l,c]=v.useState(!1),[u,p]=v.useState([]),[d,m]=v.useState({vehicle_id:"",trip_date:"",start_km:"",end_km:"",route_from:"",route_to:"",is_business:1,notes:""}),[f,h]=v.useState({});ze(a);const y=async()=>{m({vehicle_id:"",trip_date:new Date().toISOString().split("T")[0],start_km:"",end_km:"",route_from:"",route_to:"",is_business:1,notes:""}),h({}),i(!0);try{const w=await(await ae(`${fn}/trips.php?action=active_vehicles`)).json();w.success&&p(w.data.vehicles||[])}catch{}},g=async b=>{if(m(w=>({...w,vehicle_id:b})),!!b)try{const S=await(await ae(`${fn}/trips.php?action=last_km&vehicle_id=${b}`)).json();S.success&&m(N=>({...N,start_km:S.data.last_km}))}catch{}},k=async()=>{const b={};if(d.vehicle_id||(b.vehicle_id="Vyberte vozidlo"),d.trip_date||(b.trip_date="Zadejte datum"),d.start_km||(b.start_km="Zadejte počáteční km"),d.end_km||(b.end_km="Zadejte konečný km"),d.start_km&&d.end_km&&parseInt(d.end_km)<=parseInt(d.start_km)&&(b.end_km="Musí být větší než počáteční"),d.route_from||(b.route_from="Zadejte místo odjezdu"),d.route_to||(b.route_to="Zadejte místo příjezdu"),h(b),!(Object.keys(b).length>0)){c(!0);try{const S=await(await ae(`${fn}/trips.php`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)})).json();S.success?(i(!1),n.success(S.message)):n.error(S.error)}catch{n.error("Chyba připojení")}finally{c(!1)}}},_=()=>{const b=parseInt(d.start_km)||0,w=parseInt(d.end_km)||0;return w>b?w-b:0},j=r?.my_shift?.has_ongoing,C=j?"Zaznamenat odchod":"Zaznamenat příchod",D=[];return e("attendance.record")&&D.push({label:o?"Odesílám...":C,color:j?"danger":"success",icon:j?s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),s.jsx("polyline",{points:"16 17 21 12 16 7"}),s.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]}):s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M9 12l2 2 4-4"}),s.jsx("circle",{cx:"12",cy:"12",r:"10"})]}),onClick:t,disabled:o}),e("offers.create")&&D.push({label:"Nová nabídka",path:"/offers/new",color:"info",icon:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"})]})}),e("trips.record")&&D.push({label:"Přidat jízdu",color:"warning",icon:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"1",y:"3",width:"15",height:"13",rx:"2"}),s.jsx("circle",{cx:"8.5",cy:"16",r:"2.5"}),s.jsx("circle",{cx:"18.5",cy:"16",r:"2.5"}),s.jsx("path",{d:"M16 8h4l3 5v3h-7"})]}),onClick:y}),e("invoices.create")&&D.push({label:"Vystavit fakturu",path:"/invoices/new",color:"danger",icon:s.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("path",{d:"M12 1v22M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6"})})}),s.jsxs(s.Fragment,{children:[s.jsx(Q.div,{className:"dash-quick-actions",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.15},children:D.map(b=>b.onClick?s.jsxs("button",{onClick:b.onClick,disabled:b.disabled,className:`dash-quick-btn dash-quick-btn-${b.color}`,children:[b.icon,s.jsx("span",{children:b.label})]},b.label):s.jsxs(Qe,{to:b.path,className:`dash-quick-btn dash-quick-btn-${b.color}`,children:[b.icon,s.jsx("span",{children:b.label})]},b.label))}),s.jsx(Ie,{children:a&&s.jsxs(Q.div,{className:"admin-modal-overlay",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[s.jsx("div",{className:"admin-modal-backdrop",onClick:()=>i(!1)}),s.jsxs(Q.div,{className:"admin-modal admin-modal-lg",initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},children:[s.jsx("div",{className:"admin-modal-header",children:s.jsx("h2",{className:"admin-modal-title",children:"Přidat jízdu"})}),s.jsx("div",{className:"admin-modal-body",children:s.jsxs("div",{className:"admin-form",children:[s.jsxs("div",{className:"admin-form-row",children:[s.jsxs("div",{className:`admin-form-group${f.vehicle_id?" has-error":""}`,children:[s.jsx("label",{className:"admin-form-label required",children:"Vozidlo"}),s.jsxs("select",{value:d.vehicle_id,onChange:b=>{g(b.target.value),h(w=>({...w,vehicle_id:void 0}))},className:"admin-form-select",children:[s.jsx("option",{value:"",children:"Vyberte vozidlo"}),u.map(b=>s.jsxs("option",{value:b.id,children:[b.spz," - ",b.name]},b.id))]}),f.vehicle_id&&s.jsx("span",{className:"admin-form-error",children:f.vehicle_id})]}),s.jsxs("div",{className:`admin-form-group${f.trip_date?" has-error":""}`,children:[s.jsx("label",{className:"admin-form-label required",children:"Datum jízdy"}),s.jsx(ll,{mode:"date",value:d.trip_date,onChange:b=>{m(w=>({...w,trip_date:b})),h(w=>({...w,trip_date:void 0}))}}),f.trip_date&&s.jsx("span",{className:"admin-form-error",children:f.trip_date})]})]}),s.jsxs("div",{className:"admin-form-row admin-form-row-3",children:[s.jsxs("div",{className:`admin-form-group${f.start_km?" has-error":""}`,children:[s.jsx("label",{className:"admin-form-label required",children:"Počáteční stav km"}),s.jsx("input",{type:"number",inputMode:"numeric",value:d.start_km,onChange:b=>{m(w=>({...w,start_km:b.target.value})),h(w=>({...w,start_km:void 0}))},className:"admin-form-input",min:"0"}),f.start_km&&s.jsx("span",{className:"admin-form-error",children:f.start_km})]}),s.jsxs("div",{className:`admin-form-group${f.end_km?" has-error":""}`,children:[s.jsx("label",{className:"admin-form-label required",children:"Konečný stav km"}),s.jsx("input",{type:"number",inputMode:"numeric",value:d.end_km,onChange:b=>{m(w=>({...w,end_km:b.target.value})),h(w=>({...w,end_km:void 0}))},className:"admin-form-input",min:"0"}),f.end_km&&s.jsx("span",{className:"admin-form-error",children:f.end_km})]}),s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"Vzdálenost"}),s.jsx("input",{type:"text",value:`${ho(_())} km`,className:"admin-form-input",readOnly:!0,disabled:!0})]})]}),s.jsxs("div",{className:"admin-form-row",children:[s.jsxs("div",{className:`admin-form-group${f.route_from?" has-error":""}`,children:[s.jsx("label",{className:"admin-form-label required",children:"Místo odjezdu"}),s.jsx("input",{type:"text",value:d.route_from,onChange:b=>{m(w=>({...w,route_from:b.target.value})),h(w=>({...w,route_from:void 0}))},className:"admin-form-input",placeholder:"Např. Praha"}),f.route_from&&s.jsx("span",{className:"admin-form-error",children:f.route_from})]}),s.jsxs("div",{className:`admin-form-group${f.route_to?" has-error":""}`,children:[s.jsx("label",{className:"admin-form-label required",children:"Místo příjezdu"}),s.jsx("input",{type:"text",value:d.route_to,onChange:b=>{m(w=>({...w,route_to:b.target.value})),h(w=>({...w,route_to:void 0}))},className:"admin-form-input",placeholder:"Např. Brno"}),f.route_to&&s.jsx("span",{className:"admin-form-error",children:f.route_to})]})]}),s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"Typ jízdy"}),s.jsxs("select",{value:d.is_business,onChange:b=>m(w=>({...w,is_business:parseInt(b.target.value)})),className:"admin-form-select",children:[s.jsx("option",{value:1,children:"Služební"}),s.jsx("option",{value:0,children:"Soukromá"})]})]}),s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"Poznámky"}),s.jsx("textarea",{value:d.notes,onChange:b=>m(w=>({...w,notes:b.target.value})),className:"admin-form-textarea",rows:2,placeholder:"Volitelné poznámky..."})]})]})}),s.jsxs("div",{className:"admin-modal-footer",children:[s.jsx("button",{type:"button",onClick:()=>i(!1),className:"admin-btn admin-btn-secondary",disabled:l,children:"Zrušit"}),s.jsx("button",{type:"button",onClick:k,className:"admin-btn admin-btn-primary",disabled:l,children:l?"Ukládám...":"Uložit"})]})]})]})})]})}function dl(r){switch(r){case"create":return s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]});case"update":return s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"delete":return s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]});case"login":return s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"}),s.jsx("polyline",{points:"10 17 15 12 10 7"}),s.jsx("line",{x1:"15",y1:"12",x2:"3",y2:"12"})]});default:return s.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),s.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}}function ul({activities:r}){return r?s.jsxs("div",{className:"admin-card dash-activity-card",children:[s.jsxs("div",{className:"admin-card-header flex-between",children:[s.jsx("h2",{className:"admin-card-title",children:"Audit log"}),s.jsx(Qe,{to:"/audit-log",className:"admin-btn admin-btn-primary admin-btn-sm",children:"Detail →"})]}),s.jsx("div",{className:"admin-card-body",style:{padding:0},children:r.map(o=>s.jsxs("div",{className:"dash-activity-row",children:[s.jsx("div",{className:`dash-activity-icon ${po(o.action)}`,children:dl(o.action)}),s.jsxs("div",{className:"dash-activity-main",children:[s.jsx("div",{className:"dash-activity-text",children:o.description}),s.jsxs("div",{className:"dash-activity-sub",children:[o.username||"Systém"," · ",co[o.entity_type]||o.entity_type]})]}),s.jsx("div",{className:"dash-activity-time admin-mono",children:fo(o.created_at)})]},o.id))})]}):null}function pl({attendance:r}){return r?s.jsxs("div",{className:"admin-card dash-attendance-card",children:[s.jsxs("div",{className:"admin-card-header flex-between",children:[s.jsx("h2",{className:"admin-card-title",children:"Docházka dnes"}),s.jsx(Qe,{to:"/attendance/admin",className:"admin-btn admin-btn-primary admin-btn-sm",children:"Detail →"})]}),s.jsx("div",{className:"admin-card-body",style:{padding:0},children:r.users.map((o,t)=>s.jsxs("div",{className:"dash-presence-row",children:[s.jsx("div",{className:`dash-presence-avatar ${Un[o.status]}`,children:o.initials||"?"}),s.jsx("div",{className:"dash-presence-name",children:o.name}),s.jsxs("div",{className:"dash-presence-end",children:[s.jsx("span",{className:`dash-presence-label ${Un[o.status]}`,children:o.status==="leave"?io[o.leave_type]||"Nepřítomen":lo[o.status]}),o.arrived_at&&s.jsx("span",{className:"admin-mono dash-presence-time",children:o.arrived_at})]})]},`${o.user_id}-${t}`))})]}):null}const fl="/api/admin";function ml({totpEnabled:r,totpLoading:o,totpSubmitting:t,onStart2FASetup:e,onConfirm2FA:n,onDisable2FA:a,totpSecret:i,totpQrUri:l,totpCode:c,setTotpCode:u,backupCodes:p,setBackupCodes:d,show2FASetup:m,setShow2FASetup:f,show2FADisable:h,setShow2FADisable:y,disableCode:g,setDisableCode:k}){const{user:_,updateUser:j}=tt(),C=xt(),D=v.useRef(null),[b,w]=v.useState(!1),[S,N]=v.useState({username:"",email:"",password:"",first_name:"",last_name:""});ze(b);const A=()=>{const E=(_?.fullName||"").split(" ");N({username:_?.username||"",email:_?.email||"",password:"",first_name:E[0]||"",last_name:E.slice(1).join(" ")||""}),w(!0)},T=async E=>{E?.preventDefault();const O={...S};try{const R=await(await ae(`${fl}/profile.php`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(O)})).json();R.success?(j({username:O.username,email:O.email,fullName:`${O.first_name} ${O.last_name}`.trim()}),w(!1),await new Promise(I=>setTimeout(I,300)),C.success("Profil byl upraven")):C.error(R.error||"Nepodařilo se uložit profil")}catch{C.error("Chyba připojení")}};function P(){return o?"Načítání...":r?"Aktivní":"Neaktivní"}return s.jsxs(s.Fragment,{children:[s.jsxs(Q.div,{className:"admin-card",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.25},children:[s.jsxs("div",{className:"admin-card-header flex-between",children:[s.jsx("h2",{className:"admin-card-title",children:"Váš účet"}),s.jsxs("button",{onClick:A,className:"admin-btn admin-btn-secondary admin-btn-sm",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),s.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Upravit"]})]}),s.jsxs("div",{className:"admin-card-body",children:[s.jsxs("div",{className:"dash-profile-grid",children:[s.jsxs("div",{className:"dash-profile-item",children:[s.jsx("span",{className:"dash-profile-label",children:"Uživatel"}),s.jsx("span",{className:"dash-profile-value",children:_?.username})]}),s.jsxs("div",{className:"dash-profile-item",children:[s.jsx("span",{className:"dash-profile-label",children:"E-mail"}),s.jsx("span",{className:"dash-profile-value",children:_?.email})]}),s.jsxs("div",{className:"dash-profile-item",children:[s.jsx("span",{className:"dash-profile-label",children:"Jméno"}),s.jsx("span",{className:"dash-profile-value",children:_?.fullName})]}),s.jsxs("div",{className:"dash-profile-item",children:[s.jsx("span",{className:"dash-profile-label",children:"Role"}),s.jsx("span",{className:"dash-profile-value",children:_?.roleDisplay||_?.role})]})]}),s.jsx("div",{style:{borderTop:"1px solid var(--border-color)",marginTop:"1rem",paddingTop:"1rem"},children:s.jsxs("div",{className:"flex-between",children:[s.jsxs("div",{className:"flex-row-gap",children:[s.jsx("div",{style:{width:36,height:36,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:r?"var(--success-light)":"rgba(var(--text-secondary-rgb, 107, 114, 128), 0.1)",color:r?"var(--success)":"var(--text-secondary)"},children:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),s.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})}),s.jsxs("div",{children:[s.jsx("div",{style:{fontWeight:500,fontSize:"0.875rem"},children:"Dvoufaktorové ověření (2FA)"}),s.jsx("div",{className:r?"text-success":"text-secondary",style:{fontSize:"0.75rem"},children:P()})]})]}),!o&&(r?s.jsx("button",{onClick:()=>{k(""),y(!0)},className:"admin-btn admin-btn-primary admin-btn-sm",children:"Deaktivovat"}):s.jsx("button",{onClick:e,disabled:t,className:"admin-btn admin-btn-primary admin-btn-sm",children:t?"Generuji...":"Aktivovat"}))]})})]})]}),s.jsx(Ie,{children:b&&s.jsxs(Q.div,{className:"admin-modal-overlay",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[s.jsx("div",{className:"admin-modal-backdrop",onClick:()=>w(!1)}),s.jsxs(Q.div,{className:"admin-modal",initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},children:[s.jsx("div",{className:"admin-modal-header",children:s.jsx("h2",{className:"admin-modal-title",children:"Upravit profil"})}),s.jsx("div",{className:"admin-modal-body",children:s.jsxs("div",{className:"admin-form",children:[s.jsxs("div",{className:"admin-form-row",children:[s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"Jméno"}),s.jsx("input",{type:"text",value:S.first_name,onChange:E=>N({...S,first_name:E.target.value}),required:!0,className:"admin-form-input"})]}),s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"Příjmení"}),s.jsx("input",{type:"text",value:S.last_name,onChange:E=>N({...S,last_name:E.target.value}),required:!0,className:"admin-form-input"})]})]}),s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"Uživatelské jméno"}),s.jsx("input",{type:"text",value:S.username,onChange:E=>N({...S,username:E.target.value}),required:!0,className:"admin-form-input"})]}),s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"E-mail"}),s.jsx("input",{type:"email",value:S.email,onChange:E=>N({...S,email:E.target.value}),required:!0,className:"admin-form-input"})]}),s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"Nové heslo (ponechte prázdné pro zachování stávajícího)"}),s.jsx("input",{type:"password",value:S.password,onChange:E=>N({...S,password:E.target.value}),className:"admin-form-input"})]})]})}),s.jsxs("div",{className:"admin-modal-footer",children:[s.jsx("button",{type:"button",onClick:()=>w(!1),className:"admin-btn admin-btn-secondary",children:"Zrušit"}),s.jsx("button",{type:"button",onClick:T,className:"admin-btn admin-btn-primary",children:"Uložit změny"})]})]})]})}),s.jsx(Ie,{children:m&&s.jsxs(Q.div,{className:"admin-modal-overlay",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[s.jsx("div",{className:"admin-modal-backdrop",onClick:()=>{p||f(!1)}}),s.jsxs(Q.div,{className:"admin-modal",initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},children:[s.jsx("div",{className:"admin-modal-header",children:s.jsx("h2",{className:"admin-modal-title",children:p?"Záložní kódy":"Nastavení 2FA"})}),s.jsx("div",{className:"admin-modal-body",children:p?s.jsxs("div",{children:[s.jsxs("div",{className:"admin-role-locked-notice mb-4",children:[s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),"Uložte si tyto kódy na bezpečné místo. Každý kód lze použít pouze jednou. Po zavření tohoto okna je již neuvidíte."]}),s.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"0.5rem",padding:"1rem",background:"var(--bg-secondary)",borderRadius:"0.5rem",fontFamily:"monospace",fontSize:"1rem"},children:p.map(E=>s.jsx("div",{style:{padding:"0.25rem 0.5rem",textAlign:"center",color:"var(--text-primary)"},children:E},E))}),s.jsx("div",{style:{marginTop:"0.75rem"},children:s.jsxs("button",{onClick:()=>{navigator.clipboard?.writeText(p.join(` `)),C.success("Kódy zkopírovány")},className:"admin-btn admin-btn-secondary admin-btn-sm",children:[s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Kopírovat kódy"]})})]}):s.jsxs("div",{children:[s.jsx("p",{className:"text-secondary",style:{fontSize:"0.875rem",marginBottom:"1rem"},children:"Naskenujte QR kód v autentizační aplikaci (Google Authenticator, Authy, Microsoft Authenticator apod.)"}),l&&s.jsx("div",{style:{textAlign:"center",marginBottom:"1rem"},children:s.jsx("canvas",{ref:E=>{E&&l&&K(async()=>{const{renderQR:O}=await import("./qrcode-CBP_ltkV.js");return{renderQR:O}},[]).then(({renderQR:O})=>O(E,l))},style:{width:200,height:200,borderRadius:"0.5rem",border:"1px solid var(--border-color)"}})}),i&&s.jsxs("div",{className:"mb-4",children:[s.jsx("label",{className:"admin-form-label",style:{fontSize:"0.75rem"},children:"Nebo zadejte klíč ručně:"}),s.jsxs("div",{style:{padding:"0.5rem 0.75rem",background:"var(--bg-secondary)",borderRadius:"0.375rem",fontFamily:"monospace",fontSize:"0.875rem",wordBreak:"break-all",color:"var(--text-primary)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.5rem"},children:[s.jsx("span",{children:i}),s.jsx("button",{onClick:()=>{navigator.clipboard?.writeText(i),C.success("Klíč zkopírován")},className:"admin-btn-icon",title:"Kopírovat","aria-label":"Kopírovat",style:{flexShrink:0},children:s.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]}),s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"Ověřovací kód z aplikace"}),s.jsx("input",{ref:D,type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:6,value:c,onChange:E=>u(E.target.value.replace(/\D/g,"")),placeholder:"000000",className:"admin-form-input",style:{textAlign:"center",fontSize:"1.25rem",letterSpacing:"0.4rem",fontFamily:"monospace"},onKeyDown:E=>{E.key==="Enter"&&c.length===6&&n()}})]})]})}),s.jsx("div",{className:"admin-modal-footer",children:p?s.jsx("button",{onClick:()=>{f(!1),d(null)},className:"admin-btn admin-btn-primary",children:"Rozumím, uložil jsem si kódy"}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>f(!1),className:"admin-btn admin-btn-secondary",disabled:t,children:"Zrušit"}),s.jsx("button",{onClick:n,className:"admin-btn admin-btn-primary",disabled:t||c.length!==6,children:t?"Ověřuji...":"Aktivovat 2FA"})]})})]})]})}),s.jsx(Ie,{children:h&&s.jsxs(Q.div,{className:"admin-modal-overlay",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[s.jsx("div",{className:"admin-modal-backdrop",onClick:()=>y(!1)}),s.jsxs(Q.div,{className:"admin-modal",initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},children:[s.jsx("div",{className:"admin-modal-header",children:s.jsx("h2",{className:"admin-modal-title",children:"Deaktivovat 2FA"})}),s.jsxs("div",{className:"admin-modal-body",children:[s.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"0.875rem",marginBottom:"1rem"},children:"Pro deaktivaci dvoufaktorového ověření zadejte aktuální kód z autentizační aplikace."}),s.jsxs("div",{className:"admin-form-group",children:[s.jsx("label",{className:"admin-form-label",children:"Ověřovací kód"}),s.jsx("input",{type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:6,value:g,onChange:E=>k(E.target.value.replace(/\D/g,"")),placeholder:"000000",className:"admin-form-input",style:{textAlign:"center",fontSize:"1.25rem",letterSpacing:"0.4rem",fontFamily:"monospace"},onKeyDown:E=>{E.key==="Enter"&&g.length===6&&a()},autoFocus:!0})]})]}),s.jsxs("div",{className:"admin-modal-footer",children:[s.jsx("button",{onClick:()=>y(!1),className:"admin-btn admin-btn-secondary",disabled:t,children:"Zrušit"}),s.jsx("button",{onClick:a,className:"admin-btn admin-btn-primary",disabled:t||g.length!==6,children:t?"Deaktivuji...":"Deaktivovat 2FA"})]})]})]})})]})}const jr='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function hl(r){const o=v.useRef(null);return v.useEffect(()=>{if(!r||!o.current)return;const t=o.current,e=document.activeElement,n=t.querySelectorAll(jr);n.length>0&&n[0].focus();const a=i=>{if(i.key!=="Tab")return;const l=t.querySelectorAll(jr);if(l.length===0)return;const c=l[0],u=l[l.length-1];i.shiftKey&&document.activeElement===c?(i.preventDefault(),u.focus()):!i.shiftKey&&document.activeElement===u&&(i.preventDefault(),c.focus())};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a),e&&typeof e.focus=="function"&&e.focus()}},[r]),o}function Sr({isOpen:r,onClose:o,onConfirm:t,title:e="Potvrdit akci",message:n="Opravdu chcete provést tuto akci?",confirmText:a="Potvrdit",cancelText:i="Zrušit",type:l="danger",loading:c=!1}){ze(r);const u=hl(r);if(v.useEffect(()=>{if(!r)return;const d=m=>{m.key==="Escape"&&o()};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[r,o]),!r)return null;const p={danger:s.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),s.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),s.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]}),warning:s.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),info:s.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),s.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),default:s.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})};return s.jsx(Ie,{children:r&&s.jsxs(Q.div,{className:"admin-modal-overlay",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[s.jsx("div",{className:"admin-modal-backdrop",onClick:o}),s.jsxs(Q.div,{ref:u,className:"admin-modal admin-confirm-modal",role:"alertdialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2},children:[s.jsxs("div",{className:"admin-modal-body admin-confirm-content",children:[s.jsx("div",{className:`admin-confirm-icon admin-confirm-icon-${l}`,children:p[l]}),s.jsx("h2",{id:"confirm-modal-title",className:"admin-confirm-title",children:e}),s.jsx("p",{className:"admin-confirm-message",children:n})]}),s.jsxs("div",{className:"admin-modal-footer",children:[s.jsx("button",{type:"button",onClick:o,className:"admin-btn admin-btn-secondary",disabled:c,children:i}),s.jsx("button",{type:"button",onClick:t,disabled:c,className:"admin-btn admin-btn-primary",children:c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"admin-spinner admin-spinner-sm"}),"Zpracování..."]}):a})]})]})]})})}const mn="/api/admin";function vl(r){switch(r){case"smartphone":return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2",ry:"2"}),s.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"18"})]});case"tablet":return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",ry:"2"}),s.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"18"})]});default:return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),s.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),s.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}}function yl(){const r=xt(),[o,t]=v.useState([]),[e,n]=v.useState(!0),[a,i]=v.useState({isOpen:!1,session:null}),[l,c]=v.useState(!1),[u,p]=v.useState(!1);ze(l);const d=v.useCallback(async()=>{try{const y=await(await ae(`${mn}/sessions.php`)).json();y.success&&t(y.data.sessions||[])}catch{}finally{n(!1)}},[]);v.useEffect(()=>{d()},[d]);const m=async()=>{if(!a.session)return;const h=a.session.id;p(!0);try{const g=await(await ae(`${mn}/sessions.php?id=${h}`,{method:"DELETE"})).json();g.success?(i({isOpen:!1,session:null}),t(k=>k.filter(_=>_.id!==h)),r.success("Relace byla ukončena")):r.error(g.error||"Nepodařilo se ukončit relaci")}catch{r.error("Chyba připojení")}finally{p(!1)}},f=async()=>{p(!0);try{const y=await(await ae(`${mn}/sessions.php?action=all`,{method:"DELETE"})).json();y.success?(c(!1),t(g=>g.filter(k=>k.is_current)),r.success(y.message||"Ostatní relace byly ukončeny")):r.error(y.error||"Nepodařilo se ukončit relace")}catch{r.error("Chyba připojení")}finally{p(!1)}};return s.jsxs(s.Fragment,{children:[s.jsxs(Q.div,{className:"admin-card",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.3},children:[s.jsxs("div",{className:"admin-card-header",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[s.jsx("h2",{className:"admin-card-title",children:"Přihlášená zařízení"}),o.filter(h=>!h.is_current).length>0&&s.jsx("button",{onClick:()=>c(!0),className:"admin-btn admin-btn-secondary admin-btn-sm",children:"Odhlásit ostatní"})]}),s.jsxs("div",{className:"admin-card-body",style:{padding:0},children:[e&&s.jsx("div",{className:"admin-skeleton",style:{padding:"1rem",gap:"1rem"},children:[0,1,2].map(h=>s.jsxs("div",{className:"admin-skeleton-row",children:[s.jsx("div",{className:"admin-skeleton-line circle"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"admin-skeleton-line w-1/2",style:{marginBottom:"0.5rem"}}),s.jsx("div",{className:"admin-skeleton-line w-1/3",style:{height:"10px"}})]})]},h))}),!e&&o.length===0&&s.jsx("div",{className:"text-secondary",style:{padding:"1.5rem",textAlign:"center",fontSize:"0.875rem"},children:"Žádné aktivní relace"}),!e&&o.length>0&&s.jsx("div",{className:"sessions-list",children:o.map(h=>s.jsxs("div",{className:`session-item ${h.is_current?"session-item-current":""}`,children:[s.jsx("div",{className:"session-icon",children:vl(h.device_info?.icon)}),s.jsxs("div",{className:"session-info",children:[s.jsxs("div",{className:"session-device",children:[h.device_info?.browser," na ",h.device_info?.os,h.is_current&&s.jsx("span",{className:"admin-badge admin-badge-success",style:{marginLeft:"0.5rem"},children:"Aktuální"})]}),s.jsxs("div",{className:"session-meta",children:[s.jsx("span",{children:h.ip_address}),s.jsx("span",{className:"session-meta-separator",children:"|"}),s.jsx("span",{children:mo(h.created_at)})]})]}),s.jsx("div",{className:"session-actions",children:!h.is_current&&s.jsx("button",{onClick:()=>i({isOpen:!0,session:h}),className:"admin-btn-icon danger",title:"Ukončit relaci","aria-label":"Ukončit relaci",children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),s.jsx("polyline",{points:"16 17 21 12 16 7"}),s.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})})})]},h.id))})]})]}),s.jsx(Sr,{isOpen:a.isOpen,onClose:()=>i({isOpen:!1,session:null}),onConfirm:m,title:"Ukončit relaci",message:`Opravdu chcete ukončit relaci na zařízení "${a.session?.device_info?.browser} na ${a.session?.device_info?.os}"? Toto zařízení bude odhlášeno.`,confirmText:"Ukončit",cancelText:"Zrušit",type:"danger",loading:u}),s.jsx(Sr,{isOpen:l,onClose:()=>c(!1),onConfirm:f,title:"Odhlásit ostatní zařízení",message:"Opravdu chcete ukončit všechny ostatní relace? Budete odhlášeni ze všech zařízení kromě tohoto.",confirmText:"Odhlásit vše",cancelText:"Zrušit",type:"warning",loading:u})]})}const $e="/api/admin";function gl(){const{user:r,updateUser:o}=tt(),t=xt(),[e,n]=v.useState(null),[a,i]=v.useState(!0),[l,c]=v.useState(!1),[u,p]=v.useState(!1),[d,m]=v.useState(!0),[f,h]=v.useState(!1),[y,g]=v.useState(!1),[k,_]=v.useState(null),[j,C]=v.useState(null),[D,b]=v.useState(""),[w,S]=v.useState(!1),[N,A]=v.useState(null),[T,P]=v.useState("");ze(f),ze(y);const E=v.useCallback(async()=>{try{const $=await(await ae(`${$e}/dashboard.php`)).json();$.success!==!1&&n($)}catch{}finally{i(!1)}},[]);v.useEffect(()=>{E()},[E]);const O=v.useCallback(async()=>{try{const $=await(await ae(`${$e}/totp.php?action=status`)).json();$.success&&p($.data.totp_enabled)}catch{}finally{m(!1)}},[]);v.useEffect(()=>{O()},[O]);const L=()=>{const z=e?.my_shift?.has_ongoing?"departure":"arrival";c(!0);const $=async(Jt={})=>{try{const rt=await(await ae(`${$e}/attendance.php`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({punch_action:z,...Jt})})).json();rt.success?(t.success(rt.message),E()):t.error(rt.error)}catch{t.error("Chyba připojení")}finally{c(!1)}};if(!navigator.geolocation){$({});return}navigator.geolocation.getCurrentPosition(Jt=>{const{latitude:Fn,longitude:rt,accuracy:ma}=Jt.coords;$({latitude:Fn,longitude:rt,accuracy:ma,address:""})},()=>$({}),{enableHighAccuracy:!0,timeout:1e4,maximumAge:6e4})},R=async()=>{S(!0);try{const $=await(await ae(`${$e}/totp.php?action=setup`,{method:"POST"})).json();$.success?(_($.data.secret),C($.data.qr_uri),b(""),A(null),h(!0)):t.error($.error||"Nepodařilo se vygenerovat 2FA klíč")}catch{t.error("Chyba připojení")}finally{S(!1)}},I=async()=>{if(D.trim()){S(!0);try{const $=await(await ae(`${$e}/totp.php?action=enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:D.trim()})})).json();$.success?(p(!0),A($.data.backup_codes),_(null),C(null),o({totpEnabled:!0}),t.success("2FA bylo aktivováno")):(t.error($.error||"Neplatný kód"),b(""))}catch{t.error("Chyba připojení")}finally{S(!1)}}},V=async()=>{if(T.trim()){S(!0);try{const $=await(await ae(`${$e}/totp.php?action=disable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:T.trim()})})).json();$.success?(p(!1),g(!1),P(""),o({totpEnabled:!1}),t.success("2FA bylo deaktivováno")):(t.error($.error||"Neplatný kód"),P(""))}catch{t.error("Chyba připojení")}finally{S(!1)}}};return s.jsxs("div",{className:"dash",children:[s.jsx(Q.div,{className:"admin-page-header",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},children:s.jsxs("div",{children:[s.jsxs("h1",{className:"admin-page-title",children:["Vítejte zpět, ",r?.fullName||r?.username]}),s.jsx("p",{className:"admin-page-subtitle",children:uo()})]})}),r?.require2FA&&!r?.totpEnabled&&s.jsx(Q.div,{className:"admin-card",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.1},style:{border:"2px solid var(--danger)",background:"var(--danger-light)"},children:s.jsxs("div",{className:"admin-card-body",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",flexWrap:"wrap"},children:[s.jsxs("div",{className:"flex-row-gap",children:[s.jsx("div",{style:{width:40,height:40,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--danger-light)",color:"var(--danger)",flexShrink:0},children:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),s.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),s.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),s.jsxs("div",{children:[s.jsx("div",{className:"fw-600",children:"Dvoufaktorové ověření je povinné"}),s.jsx("div",{className:"text-secondary",style:{fontSize:"0.875rem"},children:"Administrátor vyžaduje aktivaci 2FA. Dokud ji neaktivujete, nemáte přístup k ostatním sekcím systému."})]})]}),s.jsx("button",{onClick:R,disabled:w,className:"admin-btn admin-btn-primary",style:{flexShrink:0},children:w?"Generuji...":"Aktivovat 2FA nyní"})]})}),a&&s.jsxs("div",{className:"admin-skeleton",style:{padding:0,gap:"1.25rem"},children:[s.jsx("div",{className:"dash-kpi-grid dash-kpi-4",children:[0,1,2,3].map(z=>s.jsx("div",{className:"admin-skeleton-line h-24",style:{borderRadius:"10px"}},z))}),s.jsx("div",{className:"dash-quick-actions",children:[0,1,2,3].map(z=>s.jsx("div",{className:"admin-skeleton-line",style:{height:"52px",borderRadius:"10px"}},z))}),s.jsxs("div",{className:"dash-main-grid",children:[s.jsx("div",{className:"admin-skeleton-line",style:{height:"320px",borderRadius:"10px"}}),s.jsx("div",{className:"admin-skeleton-line",style:{height:"320px",borderRadius:"10px"}}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.25rem"},children:[s.jsx("div",{className:"admin-skeleton-line",style:{height:"150px",borderRadius:"10px"}}),s.jsx("div",{className:"admin-skeleton-line",style:{height:"150px",borderRadius:"10px"}})]})]}),s.jsxs("div",{className:"dash-bottom",children:[s.jsx("div",{className:"admin-skeleton-line",style:{height:"200px",borderRadius:"10px"}}),s.jsx("div",{className:"admin-skeleton-line",style:{height:"200px",borderRadius:"10px"}})]})]}),!a&&s.jsx(xo,{dashData:e}),!a&&s.jsx(cl,{dashData:e,punching:l,onPunch:L}),!a&&s.jsxs(Q.div,{className:"dash-main-grid",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.2},children:[s.jsx(ul,{activities:e?.recent_activity}),s.jsx(pl,{attendance:e?.attendance}),s.jsxs("div",{className:"dash-right-col",children:[e?.projects&&s.jsxs("div",{className:"admin-card",children:[s.jsxs("div",{className:"admin-card-header flex-between",children:[s.jsx("h2",{className:"admin-card-title",children:"Aktivní projekty"}),s.jsx(Qe,{to:"/projects",className:"admin-btn admin-btn-primary admin-btn-sm",children:"Vše →"})]}),s.jsxs("div",{className:"admin-card-body",style:{padding:0},children:[e.projects.active_projects.length===0&&s.jsx("div",{className:"dash-empty-row",children:"Žádné aktivní projekty"}),e.projects.active_projects.map(z=>s.jsxs(Qe,{to:`/projects/${z.id}`,className:"dash-project-row",children:[s.jsx("div",{className:"dash-project-name",children:z.name}),z.customer_name&&s.jsx("div",{className:"dash-project-customer",children:z.customer_name})]},z.id))]})]}),e?.offers&&s.jsxs("div",{className:"admin-card",children:[s.jsxs("div",{className:"admin-card-header flex-between",children:[s.jsx("h2",{className:"admin-card-title",children:"Nabídky"}),s.jsx(Qe,{to:"/offers",className:"admin-btn admin-btn-primary admin-btn-sm",children:"Zobrazit →"})]}),s.jsxs("div",{className:"admin-card-body",style:{padding:0},children:[s.jsxs("div",{className:"dash-stat-row",children:[s.jsx("span",{children:"Otevřené"}),s.jsx("span",{className:"admin-badge admin-badge-info",children:e.offers.open_count})]}),s.jsxs("div",{className:"dash-stat-row",children:[s.jsx("span",{children:"Převedené na objednávku"}),s.jsx("span",{className:"admin-badge admin-badge-success",children:e.offers.converted_count})]}),s.jsxs("div",{className:"dash-stat-row",children:[s.jsx("span",{children:"Prošlé"}),s.jsx("span",{className:"admin-badge admin-badge-warning",children:e.offers.expired_count})]})]})]})]})]}),!a&&s.jsxs("div",{className:"dash-bottom",children:[s.jsx(ml,{totpEnabled:u,totpLoading:d,totpSubmitting:w,onStart2FASetup:R,onConfirm2FA:I,onDisable2FA:V,totpSecret:k,totpQrUri:j,totpCode:D,setTotpCode:b,backupCodes:N,setBackupCodes:A,show2FASetup:f,setShow2FASetup:h,show2FADisable:y,setShow2FADisable:g,disableCode:T,setDisableCode:P}),s.jsx(yl,{})]})]})}const xl=v.lazy(()=>K(()=>import("./Users-CZAd7D4u.js"),__vite__mapDeps([0,1,2,3,4]))),bl=v.lazy(()=>K(()=>import("./Attendance-BX-dOcwX.js"),__vite__mapDeps([5,1,2,6,3,4]))),kl=v.lazy(()=>K(()=>import("./AttendanceHistory-DJsZH1vb.js"),__vite__mapDeps([7,1,2,4,3,6]))),wl=v.lazy(()=>K(()=>import("./AttendanceAdmin-BBu3ja4e.js"),__vite__mapDeps([8,1,2,3,6,4]))),_l=v.lazy(()=>K(()=>import("./AttendanceBalances-D7Vbcgsx.js"),__vite__mapDeps([9,1,2,3,4]))),Dl=v.lazy(()=>K(()=>import("./AttendanceCreate-DDroVeLa.js"),__vite__mapDeps([10,1,2,3,4]))),jl=v.lazy(()=>K(()=>import("./LeaveRequests-B1Bzu0Vj.js"),__vite__mapDeps([11,1,2,3,6,4]))),Sl=v.lazy(()=>K(()=>import("./LeaveApproval-UIYMMi6c.js"),__vite__mapDeps([12,1,2,6,3,4]))),Cl=v.lazy(()=>K(()=>import("./AttendanceLocation-CkLbDDD5.js"),__vite__mapDeps([13,1,2,3,6,4]))),Nl=v.lazy(()=>K(()=>import("./Trips-DEgmESht.js"),__vite__mapDeps([14,1,2,3,6,4]))),Ml=v.lazy(()=>K(()=>import("./TripsHistory-Cfxm8t74.js"),__vite__mapDeps([15,1,2,3,6,4]))),El=v.lazy(()=>K(()=>import("./TripsAdmin-BdFHuk3D.js"),__vite__mapDeps([16,1,2,4,3,6]))),Pl=v.lazy(()=>K(()=>import("./Vehicles-YMg1_LP9.js"),__vite__mapDeps([17,1,2,3,4]))),Tl=v.lazy(()=>K(()=>import("./Offers-BGVfho9c.js"),__vite__mapDeps([18,1,2,3,19,20,4]))),Cr=v.lazy(()=>K(()=>import("./OfferDetail-AW7tQQUQ.js"),__vite__mapDeps([21,1,2,3,22,4,23,24]))),Ol=v.lazy(()=>K(()=>import("./OffersCustomers-DiVbk3p5.js"),__vite__mapDeps([25,1,2,3,4]))),Al=v.lazy(()=>K(()=>import("./OffersTemplates-CqsoE1IJ.js"),__vite__mapDeps([26,1,2,3,23,24,4]))),Rl=v.lazy(()=>K(()=>import("./CompanySettings-COuXybi5.js"),__vite__mapDeps([27,1,2,3,4]))),Ll=v.lazy(()=>K(()=>import("./Orders-DntV4Wip.js"),__vite__mapDeps([28,1,2,3,19,20,4]))),Il=v.lazy(()=>K(()=>import("./OrderDetail-DwmW9kwS.js"),__vite__mapDeps([29,1,2,4,3]))),Fl=v.lazy(()=>K(()=>import("./Projects-BMQPua4N.js"),__vite__mapDeps([30,1,2,3,19,20,4]))),Yl=v.lazy(()=>K(()=>import("./ProjectCreate-k3l1K_1G.js"),__vite__mapDeps([31,1,2,3,4]))),Wl=v.lazy(()=>K(()=>import("./ProjectDetail-CDPrOXSn.js"),__vite__mapDeps([32,1,2,3,4]))),zl=v.lazy(()=>K(()=>import("./Invoices-C5K7WgpF.js"),__vite__mapDeps([33,1,2,3,19,20,4]))),Bl=v.lazy(()=>K(()=>import("./InvoiceCreate-C7cM8-ZE.js"),__vite__mapDeps([34,1,2,3,22,4]))),Hl=v.lazy(()=>K(()=>import("./InvoiceDetail-kr1EuIML.js"),__vite__mapDeps([35,1,2,3,4]))),Vl=v.lazy(()=>K(()=>import("./Settings-DCrSiXXN.js"),__vite__mapDeps([36,1,2,4]))),$l=v.lazy(()=>K(()=>import("./AuditLog-BM2lpFlW.js"),__vite__mapDeps([37,1,2,3,20,4]))),Kl=v.lazy(()=>K(()=>import("./NotFound-Cm3yLPlV.js"),__vite__mapDeps([38,1,2])));function Ul(){return s.jsx(Va,{children:s.jsxs($a,{children:[s.jsx(oo,{}),s.jsx(Ua,{children:s.jsx(v.Suspense,{fallback:s.jsx("div",{className:"admin-loading",children:s.jsx("div",{className:"admin-spinner"})}),children:s.jsxs(Pr,{children:[s.jsx(B,{path:"login",element:s.jsx(so,{})}),s.jsxs(B,{element:s.jsx(ro,{}),children:[s.jsx(B,{index:!0,element:s.jsx(gl,{})}),s.jsx(B,{path:"users",element:s.jsx(xl,{})}),s.jsx(B,{path:"attendance",element:s.jsx(bl,{})}),s.jsx(B,{path:"attendance/history",element:s.jsx(kl,{})}),s.jsx(B,{path:"attendance/admin",element:s.jsx(wl,{})}),s.jsx(B,{path:"attendance/balances",element:s.jsx(_l,{})}),s.jsx(B,{path:"attendance/requests",element:s.jsx(jl,{})}),s.jsx(B,{path:"attendance/approval",element:s.jsx(Sl,{})}),s.jsx(B,{path:"attendance/create",element:s.jsx(Dl,{})}),s.jsx(B,{path:"attendance/location/:id",element:s.jsx(Cl,{})}),s.jsx(B,{path:"trips",element:s.jsx(Nl,{})}),s.jsx(B,{path:"trips/history",element:s.jsx(Ml,{})}),s.jsx(B,{path:"trips/admin",element:s.jsx(El,{})}),s.jsx(B,{path:"vehicles",element:s.jsx(Pl,{})}),s.jsx(B,{path:"offers",element:s.jsx(Tl,{})}),s.jsx(B,{path:"offers/new",element:s.jsx(Cr,{})}),s.jsx(B,{path:"offers/:id",element:s.jsx(Cr,{})}),s.jsx(B,{path:"offers/customers",element:s.jsx(Ol,{})}),s.jsx(B,{path:"offers/templates",element:s.jsx(Al,{})}),s.jsx(B,{path:"company/settings",element:s.jsx(Rl,{})}),s.jsx(B,{path:"orders",element:s.jsx(Ll,{})}),s.jsx(B,{path:"orders/:id",element:s.jsx(Il,{})}),s.jsx(B,{path:"projects",element:s.jsx(Fl,{})}),s.jsx(B,{path:"projects/new",element:s.jsx(Yl,{})}),s.jsx(B,{path:"projects/:id",element:s.jsx(Wl,{})}),s.jsx(B,{path:"invoices",element:s.jsx(zl,{})}),s.jsx(B,{path:"invoices/new",element:s.jsx(Bl,{})}),s.jsx(B,{path:"invoices/:id",element:s.jsx(Hl,{})}),s.jsx(B,{path:"settings",element:s.jsx(Vl,{})}),s.jsx(B,{path:"audit-log",element:s.jsx($l,{})})]}),s.jsx(B,{path:"*",element:s.jsx(Kl,{})})]})})})]})})}function Ql(){return s.jsx("div",{style:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-primary)"},children:s.jsx("div",{className:"admin-spinner"})})}function Zl(){return s.jsx(v.Suspense,{fallback:s.jsx(Ql,{}),children:s.jsx(Pr,{children:s.jsx(B,{path:"/*",element:s.jsx(Ul,{})})})})}gn.createRoot(document.getElementById("root")).render(s.jsx(x.StrictMode,{children:s.jsx(ba,{future:{v7_startTransition:!0,v7_relativeSplatPath:!0},children:s.jsx(Za,{children:s.jsx(Zl,{})})})}));export{ll as A,Sr as C,tn as F,K as _,xt as a,ze as b,ae as c,tc as d,ec as e,ho as f,nn as g,tt as u};