PageSourceSearch

https://cenextra.org/assets/date-utils-BF0wB-Vu.js

js cenextra.org collected 2026-10-07 20:48:55 UTC 22,529 bytes, 2 lines download raw bytes

1var t=Object.defineProperty,e=Object.defineProperties,n=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,i=(e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;const u=6048e5,s=43200,c=Symbol.for("constructDateFrom");function l(t,e){return"function"==typeof t?t(e):t&&"object"==typeof t&&c in t?t[c](e):t instanceof Date?new t.constructor(e):new Date(e)}function d(t,e){return l(e||t,t)}let h={};function f(){return h}function m(t,e){var n,r,a,o,i,u,s,c;const l=f(),h=null!=(c=null!=(s=null!=(o=null!=(a=null==e?void 0:e.weekStartsOn)?a:null==(r=null==(n=null==e?void 0:e.locale)?void 0:n.options)?void 0:r.weekStartsOn)?o:l.weekStartsOn)?s:null==(u=null==(i=l.locale)?void 0:i.options)?void 0:u.weekStartsOn)?c:0,m=d(t,null==e?void 0:e.in),g=m.getDay(),w=(g<h?7:0)+g-h;return m.setDate(m.getDate()-w),m.setHours(0,0,0,0),m}function g(t,u){return m(t,(s=((t,e)=>{for(var n in e||(e={}))a.call(e,n)&&i(t,n,e[n]);if(r)for(var n of r(e))o.call(e,n)&&i(t,n,e[n]);return t})({},u),e(s,n({weekStartsOn:1}))));var s}function w(t,e){const n=d(t,null==e?void 0:e.in),r=n.getFullYear(),a=l(n,0);a.setFullYear(r+1,0,4),a.setHours(0,0,0,0);const o=g(a),i=l(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const u=g(i);return n.getTime()>=o.getTime()?r+1:n.getTime()>=u.getTime()?r:r-1}function b(t){const e=d(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}
1function v(t,...e){const n=l.bind(null,t||e.find(t=>"object"==typeof t));return e.map(n)}function y(t,e){const n=d(t,null==e?void 0:e.in);return n.setHours(0,0,0,0),n}function p(t,e){const n=+d(t)-+d(e);return n<0?-1:n>0?1:n}function M(t,e){return+d(t)-+d(e)}function x(t,e,n){const[r,a,o]=v(null==n?void 0:n.in,t,t,e),i=p(a,o),u=Math.abs(function(t,e){const[n,r]=v(void 0,t,e);return 12*(n.getFullYear()-r.getFullYear())+(n.getMonth()-r.getMonth())}(a,o));if(u<1)return 0;1===a.getMonth()&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-i*u);let s=p(a,o)===-i;(function(t,e){const n=d(t,null==e?void 0:e.in);return+function(t,e){const n=d(t,null==e?void 0:e.in);return n.setHours(23,59,59,999),n}(n,e)===+function(t,e){const n=d(t,null==e?void 0:e.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}(n,e)})(r)&&1===u&&1===p(r,o)&&(s=!1);const c=i*(u-+s);return 0===c?0:c}const D={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function P(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const k={date:P({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:P({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:P({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},S={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function W(t){return(e,n)=>{let r;if("formatting"===((null==n?void 0:n.context)?String(n.context):"standalone")&&t.formattingValues){const e=t.defaultFormattingWidth||t.defaultWidth,a=(null==n?void 0:n.width)?String(n.width):e;r=t.formattingValues[a]||t.formattingValues[e]}else{const e=t.defaultWidth,a=(null==n?void 0:n.width)?String(n.width):t.defaultWidth;r=t.values[a]||t.values[e]}return r[t.argumentCallback?t.argumentCallback(e):e]}}function Y(t){return(e,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=e.match(a);if(!o)return null;const i=o[0],u=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],s=Array.isArray(u)?function(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}(u,t=>t.test(i)):function(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}(u,t=>t.test(i));let c;return c=t.valueCallback?t.valueCallback(s):s,c=n.valueCallback?n.valueCallback(c):c,{value:c,rest:e.slice(i.length)}}}var T;const O={code:"en-US",formatDistance:(t,e,n)=>{let r;const a=D[t];return r="string"==typeof a?a:1===e?a.one:a.other.replace("{{count}}",e.toString()),(null==n?void 0:n.addSuffix)?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:k,formatRelative:(t,e,n,r)=>S[t],localize:{ordinalNumber:(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:W({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:W({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:t=>t-1}),month:W({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:W({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
1ay","Saturday"]},defaultWidth:"wide"}),dayPeriod:W({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(T={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:t=>parseInt(t,10)},(t,e={})=>{const n=t.match(T.matchPattern);if(!n)return null;const r=n[0],a=t.match(T.parsePattern);if(!a)return null;let o=T.valueCallback?T.valueCallback(a[0]):a[0];return o=e.valueCallback?e.valueCallback(o):o,{value:o,rest:t.slice(r.length)}}),era:Y({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Y({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:t=>t+1}),month:Y({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Y({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Y({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function C(t,e){var n,r,a,o,i,u,s,c;const h=d(t,null==e?void 0:e.in),g=h.getFullYear(),w=f(),b=null!=(c=null!=(s=null!=(o=null!=(a=null==e?void 0:e.firstWeekContainsDate)?a:null==(r=null==(n=null==e?void 0:e.locale)?void 0:n.options)?void 0:r.firstWeekContainsDate)?o:w.firstWeekContainsDate)?s:null==(u=null==(i=w.locale)?void 0:i.options)?void 0:u.firstWeekContainsDate)?c:1,v=l((null==e?void 0:e.in)||t,0);v.setFullYear(g+1,0,b),v.setHours(0,0,0,0);const y=m(v,e),p=l((null==e?void 0:e.in)||t,0);p.setFullYear(g,0,b),p.setHours(0,0,0,0);const M=m(p,e);return+h>=+y?g+1:+h>=+M?g:g-1}function F(t,e){return(t<0?"-":"")+Math.abs(t).toString().padStart(e,"0")}const H={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return F("yy"===e?r%100:r,e.length)},M(t,e){const n=t.getMonth();return"M"===e?String(n+1):F(n+1,2)},d:(t,e)=>F(t.getDate(),e.length),a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(t,e)=>F(t.getHours()%12||12,e.length),H:(t,e)=>F(t.getHours(),e.length),m:(t,e)=>F(t.getMinutes(),e.length),s:(t,e)=>F(t.getSeconds(),e.length),S(t,e){const n=e.length,r=t.getMilliseconds();return F(Math.trunc(r*Math.pow(10,n-3)),e.length)}},q={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if("yo"===e){const e=t.getFullYear(),r=e>0?e:1-e;return n.ordinalNumber(r,{unit:"year"})}return H.y(t,e)},Y:function(t,e,n,r){const a=C(t,r),o=a>0?a:1-a;return"YY"===e?F(o%100,2):"Yo"===e?n.ordinalNumber(o,{unit:"year"}):F(o,e.length)},R:function(t,e){return F(w(t),e.length)},u:function(t,e){return F(t.getFullYear(),e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return F(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return F(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return H.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return F(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const a=function(t,e){const n=d(t,null==e?void 0:e.in),r=+m(n,e)-+function(t,e){var n,r,a,o,i,u,s,c;const d=f(),h=null!=(c=null!=(s=null!=(o=null!=(a=null==e?void 0:e.firstWeekContainsDate)?a:null==(r=null==(n=null==e?void 0:e.locale)?void 0:n.options)?void 0:r.firstWeekContainsDate)?o:d.firstWeekContainsDate)?s:null==(u=null==(i=d.locale)?void 0:i.options)?void 0:u.firstWeekContainsDate)?c:1,g=C(t,e),w=l((null==e?void 0:e.in)||t,0);return w.setFullYear(g,0,h),w.setHours(0,0,0,0),m(w,e)}(n,e);return Math.round(r/u)+1}(t,r);return"wo"===e?n.ordinalNumber(a,{unit:"week"}):F(a,e.length)},I:function(t,e,n){const r=function(t,e){const n=d(t,null==e?void 0:e.in),r=+g(n)-+function(t){const e=w(t,void 0),n=l(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),g(n)}(n);return Math.round(r/u)+1}(t);return"Io"===e?n.ordinalNumber(r,{unit:"week"}):F(r,e.length)},d:function(t,e,n){return"do"===e?n.ordinalNumber(t.getDate(),{unit:"date"}):H.d(t,e)},D:function(t,e,n){const r=function(t,e){const n=d(t,null==e?void 0:e.in),r=function(t,e){const[n,r]=v(void 0,t,e),a=y(n),o=y(r),i=+a-b(a),u=+o-b(o);return Math.round((i-u)/864e5)}(n,function(t){const e=d(t,void 0);return e.setFullYear(e.getFullYear(),0,1),e.setHours(0,0,0,0),e}(n));return r+1}(t);return"Do"===e?n.ordinalNumber(r,{unit:"dayOfYear"}):F(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const a=t.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return F(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const a=t.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return F(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),a=0===r?7:r;switch(e){case"i":return String(a);case"ii":return F(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let a;switch(a=12===r?"noon":0===r?"midnight":r/12>
1=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let a;switch(a=r>=17?"evening":r>=12?"afternoon":r>=4?"morning":"night",e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if("ho"===e){let e=t.getHours()%12;return 0===e&&(e=12),n.ordinalNumber(e,{unit:"hour"})}return H.h(t,e)},H:function(t,e,n){return"Ho"===e?n.ordinalNumber(t.getHours(),{unit:"hour"}):H.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return"Ko"===e?n.ordinalNumber(r,{unit:"hour"}):F(r,e.length)},k:function(t,e,n){let r=t.getHours();return 0===r&&(r=24),"ko"===e?n.ordinalNumber(r,{unit:"hour"}):F(r,e.length)},m:function(t,e,n){return"mo"===e?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):H.m(t,e)},s:function(t,e,n){return"so"===e?n.ordinalNumber(t.getSeconds(),{unit:"second"}):H.s(t,e)},S:function(t,e){return H.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(0===r)return"Z";switch(e){case"X":return j(r);case"XXXX":case"XX":return E(r);default:return E(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return j(r);case"xxxx":case"xx":return E(r);default:return E(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+N(r,":");default:return"GMT"+E(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+N(r,":");default:return"GMT"+E(r,":")}},t:function(t,e,n){return F(Math.trunc(+t/1e3),e.length)},T:function(t,e,n){return F(+t,e.length)}};function N(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),o=r%60;return 0===o?n+String(a):n+String(a)+e+F(o,2)}function j(t,e){return t%60==0?(t>0?"-":"+")+F(Math.abs(t)/60,2):E(t,e)}function E(t,e=""){const n=t>0?"-":"+",r=Math.abs(t);return n+F(Math.trunc(r/60),2)+e+F(r%60,2)}const X=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},z=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},L={p:z,P:(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return X(t,e);let o;switch(r){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"})}return o.replace("{{date}}",X(r,e)).replace("{{time}}",z(a,e))}},Q=/^D+$/,A=/^Y+$/,G=["D","DD","YY","YYYY"],B=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,$=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,J=/^'([^]*?)'?$/,I=/''/g,R=/[a-zA-Z]/;function U(t,e,n){var r,a,o,i,u,s,c,l,h;const m=f(),g=null!=(r=m.locale)?r:O,w=null!=(u=null!=(i=m.firstWeekContainsDate)?i:null==(o=null==(a=m.locale)?void 0:a.options)?void 0:o.firstWeekContainsDate)?u:1,b=null!=(h=null!=(l=m.weekStartsOn)?l:null==(c=null==(s=m.locale)?void 0:s.options)?void 0:c.weekStartsOn)?h:0,v=d(t,null==n?void 0:n.in);if(!function(t){return!(!((e=t)instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))&&"number"!=typeof t||isNaN(+d(t)));var e}(v))throw new RangeError("Invalid time value");let y=e.match($).map(t=>{const e=t[0];return"p"===e||"P"===e?(0,L[e])(t,g.formatLong):t}).join("").match(B).map(t=>{if("''"===t)return{isToken:!1,value:"'"};const e=t[0];if("'"===e)return{isToken:!1,value:V(t)};if(q[e])return{isToken:!0,value:t};if(e.match(R))throw new RangeError("Format string contains an unescaped latin alphabet character `"+e+"`");return{isToken:!1,value:t}});g.localize.preprocessor&&(y=g.localize.preprocessor(v,y));const p={firstWeekContainsDate:w,weekStartsOn:b,locale:g};return y.map(n=>{if(!n.isToken)return n.value;const r=n.value;return(function(t){return A.test(t)}(r)||function(t){return Q.test(t)}(r))&&function(t,e,n){const r=function(t,e,n){const r="Y"===t[0]?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(t,e,n);if(console.warn(r),G.includes(t))throw new RangeError(r)}(r,e,String(t)),(0,q[r[0]])(v,r,g.localize,p)}).join("")}function V(t){const e=t.match(J);return e?e[1].replace(I,"'"):t}function K(t,e){return function(t,e,n){var r,a;const o=f(),i=null!=(a=null!=(r=null==n?void 0:n.locale)?r:o.locale)?a:O,u=p(t,e);if(isNaN(u))throw new RangeError("Invalid time value");const c=Object.assign({},n,{addSuffix:null==n?void 0:n.addSuffix,comparison:u}),[l,d]=v(null==n?void 0:n.in,...u>0?[e,t]:[t,e]),h=function(t,e,n){const r=M(t,e)/1e3;return(a=null==n?void 0:n.roundingMethod,t=>{const e=(a?Math[a]:Math.trunc)(t);return 0===e?0:e})(r);var a}
1(d,l),m=(b(d)-b(l))/1e3,g=Math.round((h-m)/60);let w;if(g<2)return(null==n?void 0:n.includeSeconds)?h<5?i.formatDistance("lessThanXSeconds",5,c):h<10?i.formatDistance("lessThanXSeconds",10,c):h<20?i.formatDistance("lessThanXSeconds",20,c):h<40?i.formatDistance("halfAMinute",0,c):h<60?i.formatDistance("lessThanXMinutes",1,c):i.formatDistance("xMinutes",1,c):0===g?i.formatDistance("lessThanXMinutes",1,c):i.formatDistance("xMinutes",g,c);if(g<45)return i.formatDistance("xMinutes",g,c);if(g<90)return i.formatDistance("aboutXHours",1,c);if(g<1440){const t=Math.round(g/60);return i.formatDistance("aboutXHours",t,c)}if(g<2520)return i.formatDistance("xDays",1,c);if(g<s){const t=Math.round(g/1440);return i.formatDistance("xDays",t,c)}if(g<86400)return w=Math.round(g/s),i.formatDistance("aboutXMonths",w,c);if(w=x(d,l),w<12){const t=Math.round(g/s);return i.formatDistance("xMonths",t,c)}{const t=w%12,e=Math.trunc(w/12);return t<3?i.formatDistance("aboutXYears",e,c):t<9?i.formatDistance("overXYears",e,c):i.formatDistance("almostXYears",e+1,c)}}(t,function(t){return l(t,Date.now())}(t),e)}export{K as a,M as d,U as f};
2//# sourceMappingURL=date-utils-BF0wB-Vu.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.