3 lines
6.6 KiB
JavaScript
3 lines
6.6 KiB
JavaScript
import{w as k,j as g,av as G,u as L}from"./main-CiAhdYQG.js";const V="_badge_1t12g_8",J={badge:V},$t=({children:e,kind:t="default",className:n})=>{const r=k(J.badge,n);return g.jsx(G,{as:"span",size:"sm",weight:"medium",className:r,"data-kind":t,children:e})},X=365.2425,K=6048e5,P=864e5,_=6e4,T=36e5,U=3600,tt=60,N=U*24,et=N*7,z=N*X,W=z/12,nt=W*3,b=Symbol.for("constructDateFrom");function w(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&b in e?e[b](t):e instanceof Date?new e.constructor(t):new Date(t)}function l(e,t){return w(e,e)}let rt={};function st(){return rt}function Y(e,t){const n=st(),r=n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=l(e),a=s.getDay(),o=(a<r?7:0)+a-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function p(e){const t=l(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function d(e,...t){const n=w.bind(null,e||t.find(r=>typeof r=="object"));return t.map(n)}function C(e,t){const n=l(e);return n.setHours(0,0,0,0),n}function S(e,t,n){const[r,s]=d(n?.in,e,t),a=C(r),o=C(s),c=+a-p(a),i=+o-p(o);return Math.round((c-i)/P)}function at(e,t,n){const[r,s]=d(n?.in,e,t),a=r.getFullYear()-s.getFullYear(),o=r.getMonth()-s.getMonth();return a*12+o}function v(e,t){const n=l(e);return Math.trunc(n.getMonth()/3)+1}function x(e,t,n){const[r,s]=d(n?.in,e,t),a=r.getFullYear()-s.getFullYear(),o=v(r)-v(s);return a*4+o}function ot(e,t,n){const[r,s]=d(n?.in,e,t),a=Y(r),o=Y(s),c=+a-p(a),i=+o-p(o);return Math.round((c-i)/K)}function $(e,t,n){const[r,s]=d(n?.in,e,t);return r.getFullYear()-s.getFullYear()}function O(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function j(e,t,n){const[r,s]=d(n?.in,e,t),a=(+r-+s)/T;return O(n?.roundingMethod)(a)}function R(e,t){return+l(e)-+l(t)}function it(e,t,n){const r=R(e,t)/_;return O(n?.roundingMethod)(r)}function M(e,t,n){const r=R(e,t)/1e3;return O(n?.roundingMethod)(r)}function f(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}function ct(e,t){const n=l(e);if(isNaN(+n))throw new RangeError("Invalid time value");let r="",s="";const a="-",o=":";{const c=f(n.getDate(),2),i=f(n.getMonth()+1,2);r=`${f(n.getFullYear(),4)}${a}${i}${a}${c}`}{const c=n.getTimezoneOffset();if(c!==0){const F=Math.abs(c),Q=f(Math.trunc(F/60),2),B=f(F%60,2);s=`${c<0?"+":"-"}${Q}:${B}`}else s="Z";const i=f(n.getHours(),2),u=f(n.getMinutes(),2),m=f(n.getSeconds(),2),A=r===""?"":"T",q=[i,u,m].join(o);r=`${r}${A}${q}${s}`}return r}function ut(e,t,n){let r;return lt(t)?r=t:n=t,new Intl.DateTimeFormat(n?.locale,r).format(l(e))}function lt(e){return e!==void 0&&!("locale"in e)}function ft(e,t,n){let r=0,s;const[a,o]=d(n?.in,e,t);{const i=M(a,o);Math.abs(i)<tt?(r=M(a,o),s="second"):Math.abs(i)<U?(r=it(a,o),s="minute"):Math.abs(i)<N&&Math.abs(S(a,o))<1?(r=j(a,o),s="hour"):Math.abs(i)<et&&(r=S(a,o))&&Math.abs(r)<7?s="day":Math.abs(i)<W?(r=ot(a,o),s="week"):Math.abs(i)<nt?(r=at(a,o),s="month"):Math.abs(i)<z&&x(a,o)<4?(r=x(a,o),s="quarter"):(r=$(a,o),s="year")}return new Intl.RelativeTimeFormat(n?.locale,{numeric:"auto",...n}).format(r,s)}function I(e,t){const n=()=>w(t?.in,NaN),s=gt(e);let a;if(s.date){const u=ht(s.date,2);a=pt(u.restDateString,u.year)}if(!a||isNaN(+a))return n();const o=+a;let c=0,i;if(s.time&&(c=Mt(s.time),isNaN(c)))return n();if(s.timezone){if(i=yt(s.timezone),isNaN(i))return n()}else{const u=new Date(o+c),m=l(0);return m.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),m.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),m}return l(o+c+i)}const h={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},dt=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,mt=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Dt=/^([+-])(\d{2})(?::?(\d{2}))?$/;function gt(e){const t={},n=e.split(h.dateTimeDelimiter);let r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],h.timeZoneDelimiter.test(t.date)&&(t.date=e.split(h.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){const s=h.timezone.exec(r);s?(t.time=r.replace(s[1],""),t.timezone=s[1]):t.time=r}return t}function ht(e,t){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};const s=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?s:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function pt(e,t){if(t===null)return new Date(NaN);const n=e.match(dt);if(!n)return new Date(NaN);const r=!!n[4],s=D(n[1]),a=D(n[2])-1,o=D(n[3]),c=D(n[4]),i=D(n[5])-1;if(r)return wt(t,c,i)?It(t,c,i):new Date(NaN);{const u=new Date(0);return!Tt(t,a,o)||!Nt(t,s)?new Date(NaN):(u.setUTCFullYear(t,a,Math.max(s,o)),u)}}function D(e){return e?parseInt(e):1}function Mt(e){const t=e.match(mt);if(!t)return NaN;const n=y(t[1]),r=y(t[2]),s=y(t[3]);return Ot(n,r,s)?n*T+r*_+s*1e3:NaN}function y(e){return e&&parseFloat(e.replace(",","."))||0}function yt(e){if(e==="Z")return 0;const t=e.match(Dt);if(!t)return 0;const n=t[1]==="+"?-1:1,r=parseInt(t[2]),s=t[3]&&parseInt(t[3])||0;return Ft(r,s)?n*(r*T+s*_):NaN}function It(e,t,n){const r=new Date(0);r.setUTCFullYear(e,0,4);const s=r.getUTCDay()||7,a=(t-1)*7+n+1-s;return r.setUTCDate(r.getUTCDate()+a),r}const _t=[31,null,31,30,31,30,31,31,30,31,30,31];function H(e){return e%400===0||e%4===0&&e%100!==0}function Tt(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(_t[t]||(H(e)?29:28))}function Nt(e,t){return t>=1&&t<=(H(e)?366:365)}function wt(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Ot(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Ft(e,t){return t>=0&&t<=59}const Z=e=>ut(e,{year:"numeric",month:"short",day:"numeric",weekday:"short",hour:"numeric",minute:"numeric"}),E=(e,t)=>Math.abs(j(t,e,{roundingMethod:"round"}))>1?Z(e):ft(e,t),kt=({datetime:e,now:t,className:n})=>{const r=typeof e=="string"?I(e):e,a=E(r,t||new Date);return g.jsx("time",{className:n,dateTime:ct(r),children:a})},bt="_active_1y6r4_8",Yt={active:bt},Ct=180,St=3600*24*90,Ut=({lastActive:e,now:t,className:n})=>{const{t:r}=L(),s=typeof e=="string"?I(e):e,a=t?typeof t=="string"?I(t):t:new Date,o=Z(s);if(M(a,s)<=Ct)return g.jsx("span",{title:o,className:k(Yt.active,n),children:r("frontend.last_active.active_now")});if(M(a,s)>St)return g.jsx("span",{title:o,className:n,children:r("frontend.last_active.inactive_90_days")});const c=E(s,a);return g.jsx("span",{title:o,className:n,children:r("frontend.last_active.active_date",{relativeDate:c})})};export{$t as B,kt as D,Ut as L,I as p};
|
|
//# sourceMappingURL=LastActive-D4SP35FS.js.map
|