import{N as e,St as t,W as n,at as r,c as i,d as a,h as o,l as s,m as c,u as l}from"./runtime-core.esm-bundler-Babufkcf.js";import{t as u}from"./wrappers-BSAd4dc6.js";import{t as d}from"./QIcon-cTVL6ikA.js";import{t as f}from"./QBtn-DkiaKEsC.js";import{$ as p,K as m}from"./index-uCtpzrM3.js";import{t as h}from"./QTooltip-CXcH1X25.js";import{t as g}from"./QBadge-Bh_ovtt9.js";import{r as _,s as v,t as y}from"./syncService-CQzggLWC.js";var b={key:0},x={key:1},S={key:2},C={key:0},w={key:1,class:`text-red-3`},T=m({__name:`SyncStatusBar`,setup(u){let p=_();function m(){p.isOnline&&y.sync()}function v(e){let t=Math.floor((Date.now()-new Date(e))/1e3);return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:`${Math.floor(t/3600)}h ago`}return(u,_)=>(e(),s(f,{flat:``,dense:``,round:``,size:`sm`,onClick:m,loading:r(p).isSyncing},{default:n(()=>[r(p).isOnline?r(p).isSyncing?(e(),s(d,{key:1,name:`sync`,color:`amber-4`,size:`18px`,class:`sync-spin`})):(e(),s(d,{key:2,name:`cloud_done`,color:`green-4`,size:`18px`},{default:n(()=>[r(p).pendingCount>0?(e(),s(g,{key:0,color:`orange`,floating:``,label:r(p).pendingCount},null,8,[`label`])):l(``,!0)]),_:1})):(e(),s(d,{key:0,name:`wifi_off`,color:`red-4`,size:`18px`},{default:n(()=>[r(p).pendingCount>0?(e(),s(g,{key:0,color:`red`,floating:``,label:r(p).pendingCount},null,8,[`label`])):l(``,!0)]),_:1})),o(h,null,{default:n(()=>[r(p).isOnline?r(p).isSyncing?(e(),a(`div`,x,t(u.$t(`Syncing`)),1)):(e(),a(`div`,S,[c(` Online — `+t(r(p).pendingCount)+` pending`,1),_[3]||=i(`br`,null,null,-1),r(p).lastSyncAt?(e(),a(`small`,C,`Last sync: `+t(v(r(p).lastSyncAt)),1)):l(``,!0),r(p).lastError?(e(),a(`small`,w,`Error: `+t(r(p).lastError),1)):l(``,!0),_[4]||=i(`br`,null,null,-1),i(`small`,null,t(u.$t(`ClickToSyncNow`)),1)])):(e(),a(`div`,b,[_[0]||=i(`b`,null,`Offline`,-1),_[1]||=i(`br`,null,null,-1),c(` `+t(r(p).pendingCount)+` change(s) pending sync`,1),_[2]||=i(`br`,null,null,-1),i(`small`,null,t(u.$t(`WillSyncWhenOnline`)),1)]))]),_:1})]),_:1},8,[`loading`]))}},[[`__scopeId`,`data-v-648ccf3f`]]),E=u(({app:e})=>{e.component(`sync-status`,T);let t=localStorage.getItem(`theme_dark`)===`1`,n=localStorage.getItem(`theme_primary`),r=localStorage.getItem(`theme_font`)||`normal`,i=localStorage.getItem(`theme_radius`)||`8px`,a=localStorage.getItem(`theme_sidebar`);n&&document.documentElement.style.setProperty(`--q-primary`,n);let o={small:`13px`,normal:`14px`,large:`16px`};document.documentElement.style.fontSize=o[r]||`14px`,document.documentElement.style.setProperty(`--my-radius`,i),t&&p.set(!0),a===`mini`&&document.body.classList.add(`sidebar-mini`),localStorage.getItem(`theme_motion`)===`off`&&document.documentElement.classList.add(`reduce-motion`);let s=localStorage.getItem(`theme_topbar_from`)||`#123A66`,c=localStorage.getItem(`theme_topbar_to`)||`#0B1626`,l=localStorage.getItem(`theme_sidebar_accent`)||`#C8862D`,u=localStorage.getItem(`theme_sidebar_accent_bg`)||`#FBF0DD`;document.documentElement.style.setProperty(`--topbar-from`,s),document.documentElement.style.setProperty(`--topbar-to`,c),document.documentElement.style.setProperty(`--sidebar-accent`,l),document.documentElement.style.setProperty(`--sidebar-accent-bg`,u),typeof window<`u`&&(y.start(),window.__ariaSync={service:y,db:v})});export{E as default};