import{r as s}from"./redux-1.0.63-Df-eBzJn.js";import{g as m,d as l}from"./Languages-1.0.63-DsTK0dJK.js";import{u as L,a as j}from"./hooks-1.0.63-CWs3kTdT.js";import{l as u,C as i,cR as g}from"./lib-1.0.63-DJZPtMem.js";const I=()=>{const a=L(t=>t.locales.dayjsLocalizationImported);return u.debug("dayjsImported",a),a};var c=!1;const x=a=>{const t=j(),[r,d]=s.useState("en"),[n,o]=s.useState(!0),p=I(),e=s.useMemo(()=>m((a==null?void 0:a.code)??i.defaultLanguage.code).dayjs,[a]);return s.useEffect(()=>{if(e===r){o(!1);return}(async()=>{if(l.includes(e)){d(e),o(!1);return}if(!c)try{u.debug("loading "+e),c=!0,o(!0),l.push(e),t(g({lang:e})),d(e)}catch(y){console.error(`Failed to load dayjs locale '${e}':`,y),d("en")}finally{o(!1),c=!1}})()},[a,r,n,p]),{dayjsLang:r,dayjsIsLoading:n,getDateLocale:f=>i.defaultLanguage.dayjs}};export{x as u};
