GitHub 时间格式化

用自定义的日期时间格式替换 GitHub 时间显示(<relative-time>)

当前为 2025-12-24 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name              GitHub Relative Time Format
// @name:zh-CN        GitHub 时间格式化
// @namespace         https://greasyfork.org/zh-CN/scripts/480032-github-relative-time-format
// @version           0.7.0
// @description       replacing GitHub relative timestamps(<relative-time>) with customizable date and time formats
// @description:zh-CN 用自定义的日期时间格式替换 GitHub 时间显示(<relative-time>)
// @author            MuXiu1997 (https://github.com/MuXiu1997)
// @license           MIT
// @homepageURL       https://github.com/MuXiu1997/github-relative-time-format
// @supportURL        https://github.com/MuXiu1997/github-relative-time-format
// @match             https://github.com/**
// @icon              https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant             GM_getValue
// @grant             GM_setValue
// @grant             GM_registerMenuCommand
// @grant             GM_unregisterMenuCommand
// ==/UserScript==
(function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));function l({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}let u=0,d=0,f=0,p,m=[],{link:h,unlink:g,propagate:_,checkDirty:v,shallowPropagate:y}=l({update(e){return e.depsTail===void 0?T(e):w(e)},notify(e){let t=f,n=t;do{var r;if(e.flags&=-3,m[t++]=e,e=(r=e.subs)==null?void 0:r.sub,e===void 0||!(e.flags&2))break}while(!0);for(f=t;n<--t;){let e=m[n];m[n++]=m[t],m[t]=e}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,A(e)):k.call(e)}});function b(e){let t=p;return p=e,t}function x(e){return O.bind({currentValue:e,pendingValue:e,subs:void 0,subsTail:void 0,flags:1})}function S(e){return ee.bind({value:void 0,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:0,getter:e})}function C(e){let t={fn:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:6},n=b(t);n!==void 0&&h(t,n,0);try{t.fn()}finally{p=n,t.flags&=-5}return te.bind(t)}function w(e){++u,e.depsTail=void 0,e.flags=5;let t=b(e);try{let t=e.value;return t!==(e.value=e.getter(t))}finally{p=t,e.flags&=-5,A(e)}}function T(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function E(e){let t=e.flags;if(t&16||t&32&&v(e.deps,e)){++u,e.depsTail=void 0,e.flags=6;let t=b(e);try{e.fn()}finally{p=t,e.flags&=-5,A(e)}}else e.flags=2}function D(){for(;d<f;){let e=m[d];m[d++]=void 0,E(e)}d=0,f=0}function ee(){let e=this.flags;if(e&16||e&32&&(v(this.deps,this)||(this.flags=e&-33,!1))){if(w(this)){let e=this.subs;e!==void 0&&y(e)}}else if(!e){this.flags=5;let e=b(this);try{this.value=this.getter()}finally{p=e,this.flags&=-5}}let t=p;return t!==void 0&&h(this,t,u),this.value}function O(...e){if(e.length){if(this.pendingValue!==(this.pendingValue=e[0])){this.flags=17;let e=this.subs;e!==void 0&&(_(e),D())}}else{if(this.flags&16&&T(this)){let e=this.subs;e!==void 0&&y(e)}let e=p;for(;e!==void 0;){var t;if(e.flags&3){h(this,e,u);break}e=(t=e.subs)==null?void 0:t.sub}return this.currentValue}}function te(){k.call(this)}function k(){this.depsTail=void 0,this.flags=0,A(this);let e=this.subs;e!==void 0&&g(e)}function A(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=g(n,e)}function j(e){"@babel/helpers - typeof";return j=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},j(e)}function M(e,t){if(j(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(j(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ne(e){var t=M(e,`string`);return j(t)==`symbol`?t:t+``}function re(e,t,n){return(t=ne(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?N(Object(n),!0).forEach(function(t){re(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let F={silent:-1/0,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:1/0},I={silent:{level:-1},fatal:{level:F.fatal},error:{level:F.error},warn:{level:F.warn},log:{level:F.log},info:{level:F.info},success:{level:F.success},fail:{level:F.fail},ready:{level:F.info},start:{level:F.info},box:{level:F.info},debug:{level:F.debug},trace:{level:F.trace},verbose:{level:F.verbose}};function L(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function R(e,t,n=`.`,r){if(!L(t))return R(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:L(a)&&L(i[t])?i[t]=R(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function z(e){return(...t)=>t.reduce((t,n)=>R(t,n,``,e),{})}let B=z();function V(e){return Object.prototype.toString.call(e)===`[object Object]`}function H(e){return!(!V(e)||!e.message&&!e.args||e.stack)}let U=!1,W=[];var G=class e{constructor(e={}){let t=e.types||I;for(let n in this.options=B(P(P({},e),{},{defaults:P({},e.defaults),level:K(e.level,t),reporters:[...e.reporters||[]]}),{types:I,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}}),t){let e=P(P({type:n},this.options.defaults),t[n]);this[n]=this._wrapLogFn(e),this[n].raw=this._wrapLogFn(e,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=K(e,this.options.types,this.options.level)}prompt(e,t){if(!this.options.prompt)throw Error(`prompt is not supported!`);return this.options.prompt(e,t)}create(t){let n=new e(P(P({},this.options),t));return this._mockFn&&n.mockTypes(this._mockFn),n}withDefaults(e){return this.create(P(P({},this.options),{},{defaults:P(P({},this.options.defaults),e)}))}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+`:`+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let t=this.options.reporters.indexOf(e);if(t!==-1)return this.options.reporters.splice(t,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console[`__`+e]||(console[`__`+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console[`__`+e]&&(console[e]=console[`__`+e],delete console[`__`+e])}wrapStd(){this._wrapStream(this.options.stdout,`log`),this._wrapStream(this.options.stderr,`log`)}_wrapStream(e,t){e&&(e.__write||(e.__write=e.write),e.write=e=>{this[t].raw(String(e).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){U=!0}resumeLogs(){U=!1;let e=W.splice(0);for(let t of e)t[0]._logFn(t[1],t[2])}mockTypes(e){let t=e||this.options.mockFn;if(this._mockFn=t,typeof t==`function`)for(let e in this.options.types)this[e]=t(e,this.options.types[e])||this[e],this[e].raw=this[e]}_wrapLogFn(e,t){return(...n)=>{if(U){W.push([this,e,n,t]);return}return this._logFn(e,n,t)}}_logFn(e,t,n){if((e.level||0)>this.level)return!1;let r=P(P({date:new Date,args:[]},e),{},{level:K(e.level,this.options.types)});!n&&t.length===1&&H(t[0])?Object.assign(r,t[0]):r.args=[...t],r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split(`
`)),r.args.push(`
`+r.additional.join(`
`)),delete r.additional),r.type=typeof r.type==`string`?r.type.toLowerCase():`log`,r.tag=typeof r.tag==`string`?r.tag:``;let i=(e=!1)=>{let t=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&t>0){let e=[...this._lastLog.object.args];t>1&&e.push(`(repeated ${t} times)`),this._log(P(P({},this._lastLog.object),{},{args:e})),this._lastLog.count=1}e&&(this._lastLog.object=r,this._log(r))};clearTimeout(this._lastLog.timeout);let a=this._lastLog.time&&r.date?r.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=r.date,a<this.options.throttle)try{let e=JSON.stringify([r.type,r.tag,r.args]),t=this._lastLog.serialized===e;if(this._lastLog.serialized=e,t&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(i,this.options.throttle);return}}catch(e){}i(!0)}_log(e){for(let t of this.options.reporters)t.log(e,{options:this.options})}};function K(e,t={},n=3){return e===void 0?n:typeof e==`number`?e:t[e]&&t[e].level!==void 0?t[e].level:n}G.prototype.add=G.prototype.addReporter,G.prototype.remove=G.prototype.removeReporter,G.prototype.clear=G.prototype.removeReporter,G.prototype.withScope=G.prototype.withTag,G.prototype.mock=G.prototype.mockTypes,G.prototype.pause=G.prototype.pauseLogs,G.prototype.resume=G.prototype.resumeLogs;function ie(e={}){return new G(e)}var ae=class{constructor(e){this.options=P({},e),this.defaultColor=`#7f8c8d`,this.levelColorMap={0:`#c0392b`,1:`#f39c12`,3:`#00BCD4`},this.typeColorMap={success:`#2ecc71`}}_getLogFn(e){return e<1?console.__error||console.error:e===1?console.__warn||console.warn:console.__log||console.log}log(e){let t=this._getLogFn(e.level),n=e.type===`log`?``:e.type,r=e.tag||``,i=`
      background: ${this.typeColorMap[e.type]||this.levelColorMap[e.level]||this.defaultColor};
      border-radius: 0.5em;
      color: white;
      font-weight: bold;
      padding: 2px 0.5em;
    `,a=`%c${[r,n].filter(Boolean).join(`:`)}`;typeof e.args[0]==`string`?t(`${a}%c ${e.args[0]}`,i,``,...e.args.slice(1)):t(a,i,...e.args)}};function oe(e={}){return ie(P({reporters:e.reporters||[new ae({})],prompt(e,t={}){return t.type===`confirm`?Promise.resolve(confirm(e)):Promise.resolve(prompt(e))}},e))}let se=oe();function ce(e,t,n){var r,i,a;t===void 0&&(t=50),n===void 0&&(n={});var o=(r=n.isImmediate)!=null&&r,s=(i=n.callback)!=null&&i,c=n.maxWait,l=Date.now(),u=[];function d(){if(c!==void 0){var e=Date.now()-l;if(e+t>=c)return c-e}return t}var f=function(){var t=[].slice.call(arguments),n=this;return new Promise(function(r,i){var c=o&&a===void 0;if(a!==void 0&&clearTimeout(a),a=setTimeout(function(){if(a=void 0,l=Date.now(),!o){var r=e.apply(n,t);s&&s(r),u.forEach(function(e){return(0,e.resolve)(r)}),u=[]}},d()),c){var f=e.apply(n,t);return s&&s(f),r(f)}u.push({resolve:r,reject:i})})};return f.cancel=function(e){a!==void 0&&clearTimeout(a),u.forEach(function(t){return(0,t.reject)(e)}),u=[]},f}var le=`0.7.0`,ue=c(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||(e(t,E,w),e.$i=!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1);let q=se.withDefaults({tag:`GRTF`});function de(e){return e instanceof HTMLElement&&e.tagName===`RELATIVE-TIME`}function J(e){if(!e)return!1;let t=e instanceof Element?e:e.parentElement;if(t!=null&&t.closest(`relative-time`))return!0;let n=e.getRootNode();return n instanceof ShadowRoot&&de(n.host)}function fe(e){return e instanceof Element&&e.getElementsByTagName(`relative-time`).length>0}function pe(e){let t=e.getAttribute(`format`);return t===`duration`||t===`elapsed`}function me(e,t,n){let r=performance.now(),i=e.getAttribute(`datetime`);if(!i)return;let a=(0,ue.default)(i);if(a.isValid()){e.title=a.format(n);try{var o;(o=e.disconnectedCallback)==null||o.call(e);let n=!1;if(e.shadowRoot){let r=a.format(t);e.shadowRoot.innerHTML!==r&&(e.shadowRoot.innerHTML=r,n=!0)}else{let r=a.format(t);e.textContent!==r&&(e.textContent=r,n=!0)}if(n){let t=performance.now()-r;q.debug(`Updated element:`,e,`in ${t.toFixed(3)}ms`)}}catch(t){q.warn(`Error updating element`,e,t)}}}function he(e){try{var t;(t=e.connectedCallback)==null||t.call(e)}catch(t){q.warn(`Error restoring element`,e,t)}}function ge(e,t){let n=performance.now(),r=document.querySelectorAll(`relative-time`);if(r.length===0)return;let i=0;for(let n of r)pe(n)?he(n):(me(n,e,t),i++);let a=performance.now()-n;i>0&&q.debug({type:`success`,message:`Total updated: ${i} elements in ${a.toFixed(3)}ms`})}function Y(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function X(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){Y(a,r,i,o,s,`next`,e)}function s(e){Y(a,r,i,o,s,`throw`,e)}o(void 0)})}}let Z=null;function _e(e,t,n){return Q.apply(this,arguments)}function Q(){return Q=X(function*(e,t,n){Z&&(Z(null),Z=null);let r=document.querySelector(`dialog[data-grtf-modal]`);return r&&(r.close(),r.remove()),new Promise(r=>{var i,a,o;Z=r;let s=document.createElement(`dialog`);s.dataset.grtfModal=``,s.className=`Box Box--overlay d-flex flex-column anim-fade-in fast`,s.style.cssText=`
      width: 448px;
      padding: 0;
      border: 1px solid var(--color-border-default, #30363d);
      border-radius: 6px;
      background-color: var(--bgColor-default, var(--color-canvas-overlay, #161b22));
      color: var(--color-fg-default, #c9d1d9);
      box-shadow: var(--color-shadow-large, 0 8px 24px rgba(1, 4, 9, 0.2));
      position: fixed;
      top: 10%;
      left: 50%;
      transform: translateX(-50%);
      margin: 0;
      display: flex;
    `;let c=n===`boolean`;if(s.innerHTML=`
      <div class="Box-header d-flex flex-items-center">
        <h3 class="Box-title flex-auto">${e}</h3>
        <button class="btn-octicon" type="button" id="modal-close" aria-label="Close">
          <svg aria-hidden="true" height="16" viewBox="0 0 16 16" width="16" fill="currentColor"><path d="M3.72 3.72a.75.75 0 011.06 0L8 6.94l3.22-3.22a.75.75 0 111.06 1.06L9.06 8l3.22 3.22a.75.75 0 11-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 01-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 010-1.06z"></path></svg>
        </button>
      </div>
      <div class="Box-body">
        ${c?`
          <div class="form-checkbox">
            <label>
              <input type="checkbox" id="modal-input" ${t===`true`?`checked`:``}>
              Enable
            </label>
          </div>
          `:`
          <input type="text" id="modal-input" class="form-control input-block" value="${t}" spellcheck="false">
          `}
      </div>
      <div class="Box-footer text-right">
        <button class="btn btn-secondary mr-2" type="button" id="modal-cancel">Cancel</button>
        <button class="btn btn-primary" type="button" id="modal-save">Save</button>
      </div>
    `,!document.getElementById(`grtf-modal-style`)){let e=document.createElement(`style`);e.id=`grtf-modal-style`,e.textContent=`
        dialog[data-grtf-modal]::backdrop {
          background-color: rgba(0, 0, 0, 0.7);
          backdrop-filter: blur(2px);
        }
        dialog[data-grtf-modal] {
          background-color: var(--bgColor-default, var(--color-canvas-overlay, #161b22)) !important;
        }
      `,document.head.appendChild(e)}document.body.appendChild(s),s.showModal();let l=s.querySelector(`#modal-input`),u=()=>{Z=null,s.close(),document.body.removeChild(s)};(i=s.querySelector(`#modal-save`))==null||i.addEventListener(`click`,()=>{let e=c?l.checked?`true`:`false`:l.value,t=r;u(),t(e)}),(a=s.querySelector(`#modal-cancel`))==null||a.addEventListener(`click`,()=>{let e=r;u(),e(null)}),(o=s.querySelector(`#modal-close`))==null||o.addEventListener(`click`,()=>{let e=r;u(),e(null)}),s.addEventListener(`cancel`,()=>{Z=null,document.body.removeChild(s),r(null)}),setTimeout(()=>{c?l.focus():(l.focus(),l.select())},0)})}),Q.apply(this,arguments)}function $(e,t,n,r=`text`){let i=x(typeof GM_getValue<`u`?GM_getValue(e,n):n);return typeof GM_setValue<`u`&&typeof GM_registerMenuCommand<`u`&&(C(()=>{GM_setValue(e,i())}),GM_registerMenuCommand(t,X(function*(){let e=yield _e(t,i(),r);e!==null&&i(e)}))),i}function ve(){let e=$(`DISPLAY_FORMAT`,`Change display format`,`YY-MM-DD HH:mm`),t=$(`TOOLTIP_FORMAT`,`Change tooltip format`,`YYYY-MM-DD HH:mm:ss`),n=$(`DEBUG_LOG`,`Enable debug log`,`false`,`boolean`),r=S(()=>n()===`true`?F.verbose:F.info),i=()=>{ge(e(),t())};C(()=>{i()}),C(()=>{q.level=r()}),q.info(`GitHub Relative Time Format(v${le}) is loaded`);let a=ce(i,100);new MutationObserver(e=>{let t=!1;for(let n of e){let{target:e,type:r}=n;if(r===`attributes`||r===`characterData`){if(J(e)){t=!0;break}}else if(r===`childList`&&(J(e)||fe(e))){t=!0;break}}t&&a()}).observe(document.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeFilter:[`datetime`,`format`]})}ve()})();