import{s as e}from"./rolldown-runtime-C5c2KzVm.js";import{$P as t}from"./lucide-C4oWPzu4.js";import{p as n,t as r}from"./utils-Bs-0X7qI.js";import{t as i}from"./src-By3YMe4e.js";import{r as a}from"./bundle-mjs-C4g7ASB5.js";import{n as o,t as s}from"./zh-CN-1C50nlOa.js";import{t as c}from"./formatDistanceToNow-ucqcmK2F.js";var l=n(),u=e(t(),1),d=a(),f={datetime:`YYYY-MM-DD HH:mm:ss`,date:`YYYY-MM-DD`,time:`HH:mm:ss`,relative:`relative`},p={"en-US":o,"zh-CN":s};function m(e){if(e==null)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e==`number`){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}if(typeof e==`string`){let t=e.trim();if(!t)return null;let n=t.replace(` `,`T`),r=new Date(n);if(!Number.isNaN(r.getTime()))return r;let i=new Date(t);return Number.isNaN(i.getTime())?null:i}return null}function h(e){return e<10?`0${e}`:String(e)}function g(e,t){let n={YYYY:String(e.getFullYear()),MM:h(e.getMonth()+1),DD:h(e.getDate()),HH:h(e.getHours()),mm:h(e.getMinutes()),ss:h(e.getSeconds())};return t.replace(/YYYY|MM|DD|HH|mm|ss/g,e=>n[e]??e)}var _=u.forwardRef((e,t)=>{let n=(0,l.c)(19),a,s,u,h,_,v;n[0]===e?(a=n[1],s=n[2],u=n[3],h=n[4],_=n[5],v=n[6]):({value:v,fallback:h,variant:_,format:s,className:a,...u}=e,n[0]=e,n[1]=a,n[2]=s,n[3]=u,n[4]=h,n[5]=_,n[6]=v);let y=h===void 0?`-`:h,b=_===void 0?`datetime`:_,{locale:x}=i(),S;if(n[7]!==x||n[8]!==s||n[9]!==v||n[10]!==b){bb0:{let e=m(v);if(!e){S=null;break bb0}if(b===`relative`&&!s){S=c(e,{addSuffix:!0,locale:p[x]??o});break bb0}S=g(e,s??f[b])}n[7]=x,n[8]=s,n[9]=v,n[10]=b,n[11]=S}else S=n[11];let C=S,w;n[12]===a?w=n[13]:(w=r(`tabular-nums`,a),n[12]=a,n[13]=w);let T=C??y,E;return n[14]!==u||n[15]!==t||n[16]!==w||n[17]!==T?(E=(0,d.jsx)(`span`,{ref:t,className:w,...u,children:T}),n[14]=u,n[15]=t,n[16]=w,n[17]=T,n[18]=E):E=n[18],E});_.displayName=`TimeText`;export{_ as t};