Files
cm-app-crawlspider/node_modules/relative-time-format/bundle/javascript-time-ago.min.js

2 lines
14 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("javascript-time-ago",[],t):"object"==typeof exports?exports["javascript-time-ago"]=t():e["javascript-time-ago"]=t()}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=13)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(10);Object.defineProperty(t,"canonical",{enumerable:!0,get:function(){return i(n).default}});var o=r(9);Object.defineProperty(t,"convenient",{enumerable:!0,get:function(){return i(o).default}});var a=r(2);function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"minute",{enumerable:!0,get:function(){return a.minute}}),Object.defineProperty(t,"hour",{enumerable:!0,get:function(){return a.hour}}),Object.defineProperty(t,"day",{enumerable:!0,get:function(){return a.day}}),Object.defineProperty(t,"month",{enumerable:!0,get:function(){return a.month}}),Object.defineProperty(t,"year",{enumerable:!0,get:function(){return a.year}}),Object.defineProperty(t,"getStep",{enumerable:!0,get:function(){return a.getStep}}),Object.defineProperty(t,"getDate",{enumerable:!0,get:function(){return a.getDate}})},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)};function a(){return"object"===("undefined"==typeof Intl?"undefined":o(Intl))&&"function"==typeof Intl.DateTimeFormat}t.default=function(e,t){for(var r=e,n=Array.isArray(r),o=0,r=n?r:r[Symbol.iterator]();;){var a;if(n){if(o>=r.length)break;a=r[o++]}else{if((o=r.next()).done)break;a=o.value}var i=a;if(t(i))return i;for(var u=i.split("-");u.length>1;)if(u.pop(),i=u.join("-"),t(i))return i}throw new Error("No locale data has been registered for any of the locales: "+e.join(", "))},t.intlDateTimeFormatSupportedLocale=function(e){if(a())return Intl.DateTimeFormat.supportedLocalesOf(e)[0]},t.intlDateTimeFormatSupported=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getStep=function(e,t){for(var r=e,n=Array.isArray(r),o=0,r=n?r:r[Symbol.iterator]();;){var a;if(n){if(o>=r.length)break;a=r[o++]}else{if((o=r.next()).done)break;a=o.value}var i=a;if(i.unit===t)return i}},t.getDate=function(e){return e instanceof Date?e:new Date(e)};var n=t.minute=60,o=t.hour=60*n,a=t.day=24*o;t.month=30.44*a,t.year=365.2425*a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDefaultLocale=function(){return n},t.setDefaultLocale=function(e){n=e},t.isLocaleDataAvailable=function(e){return o.hasOwnProperty(e)},t.getLocaleData=function(e){return o[e]},t.addLocaleData=function(e){if(!e)throw new Error("[javascript-time-ago] No locale data passed.");o[e.locale]=e};var n="en",o={}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(3);var a=1,i=["now","second","minute","hour","day","week","month","quarter","year"],u=["auto","always"],l=["long","short","narrow","long_time","long_convenient","short_time","short_convenient","tiny"],f=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.numeric="always",this.style="long";var n=r.numeric,a=r.style;if(n){if(u.indexOf(n)<0)throw new RangeError('Invalid "numeric" option: '+n);this.numeric=n}if(a){if(l.indexOf(a)<0)throw new RangeError('Invalid "style" option: '+a);this.style=a}t&&(this.locale=e.supportedLocalesOf(t)[0]),this.locale=this.locale?c(this.locale):(0,o.getDefaultLocale)()}return n(e,null,[{key:"useVersion",value:function(e){a=e}}]),n(e,[{key:"format",value:function(e,t){return this.getRule(e,t).replace("{0}",Math.abs(e))}},{key:"formatToParts",value:function(e,t){var r=this.getRule(e,t),n=r.indexOf("{0}");if(n<0)return[{type:"literal",value:r}];var o=[];return n>0&&o.push({type:"literal",value:r.slice(0,n)}),a>=2?o.push({unit:t,type:"integer",value:String(Math.abs(e))}):o.push({type:t,value:String(Math.abs(e))}),n+"{0}".length<r.length-1&&o.push({type:"literal",value:r.slice(n+"{0}".length)}),o}},{key:"getRule",value:function(e,t){if(i.indexOf(t)<0)throw new RangeError("Unknown time unit: "+t+".");var r=(0,o.getLocaleData)(this.locale)[this.style][t];if("string"==typeof r)return r;if(a>=2&&"auto"===this.numeric&&"day"===t)switch(e){case-1:if(r.previous)return r.previous;break;case 0:if(r.current)return r.current;break;case 1:if(r.next)return r.next}var n=r[e<=0?"past":"future"]||r;if("string"==typeof n)return n;var u=(0,o.getLocaleData)(this.locale).quantify,l=u&&u(Math.abs(e));return n[l=l||"other"]||n.other}},{key:"resolvedOptions",value:function(){return{locale:this.locale}}}]),e}();function c(e){if((0,o.getLocaleData)(e))return e;for(var t=e.split("-");e.length>1;)if(t.pop(),e=t.join("-"),(0,o.getLocaleData)(e))return e}t.default=f,f.supportedLocalesOf=function(e,t){return"string"==typeof e&&(e=[e]),e.filter(c)},f.addLocale=o.addLocaleData},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.default={gradation:n.convenient,flavour:["long_convenient","long"],units:["now","minute","hour","day","week","month","year"]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=r(0),a=r(1),i={};t.default={gradation:[n({},(0,o.getStep)(o.canonical,"minute"),{threshold:45}),(0,o.getStep)(o.canonical,"hour"),{threshold:o.day-.5*o.hour,format:function(e,t){if((0,a.intlDateTimeFormatSupported)())return i[t]||(i[t]={}),i[t].this_year||(i[t].this_year=new Intl.DateTimeFormat(t,{month:"short",day:"numeric"})),i[t].this_year.format((0,o.getDate)(e))}},{threshold:function(e){return(new Date(new Date(e).getFullYear()+1,0).getTime()-e)/1e3},format:function(e,t){if((0,a.intlDateTimeFormatSupported)())return i[t]||(i[t]={}),i[t].other||(i[t].other=new Intl.DateTimeFormat(t,{year:"numeric",month:"short",day:"numeric"})),i[t].other.format((0,o.getDate)(e))}}],flavour:["tiny","short_time","narrow","short"]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.default={gradation:n.convenient,flavour:"long_time",units:["now","minute","hour","day","week","month","year"]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);Object.defineProperty(t,"timeStyle",{enumerable:!0,get:function(){return i(n).default}});var o=r(6);Object.defineProperty(t,"twitterStyle",{enumerable:!0,get:function(){return i(o).default}});var a=r(5);function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"defaultStyle",{enumerable:!0,get:function(){return i(a).default}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);t.default=[{factor:1,unit:"now"},{threshold:1,threshold_for_now:45,factor:1,unit:"second"},{threshold:45,factor:60,unit:"minute"},{threshold:150,factor:60,granularity:5,unit:"minute"},{threshold:1350,factor:1800,unit:"half-hour"},{threshold:2550,threshold_for_minute:3150,factor:3600,unit:"hour"},{threshold:20.5/24*n.day,factor:n.day,unit:"day"},{threshold:5.5*n.day,factor:7*n.day,unit:"week"},{threshold:24.5*n.day,factor:n.month,unit:"month"},{threshold:10.5*n.month,factor:n.year,unit:"year"}]},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2);t.default=[{factor:1,unit:"now"},{threshold:.5,factor:1,unit:"second"},{threshold:59.5,factor:60,unit:"minute"},{threshold:3570,factor:3600,unit:"hour"},{threshold:84600,factor:n.day,unit:"day"},{threshold:6.5*n.day,factor:7*n.day,unit:"week"},{threshold:24.5*n.day,factor:n.month,unit:"month"},{threshold:11.5*n.month,factor:n.year,unit:"year"}]},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)};t.default=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:a.convenient;if(0===(n=function(e,t){return e.filter(function(e){var r=e.unit;return!r||t.indexOf(r)>=0})}(n,r)).length)return;var i=function e(t,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(t<function(e,t,r){var n=void 0;e&&(e.id||e.unit)&&(n=t["threshold_for_"+(e.id||e.unit)]);void 0===n&&(n=t.threshold);"function"==typeof n&&(n=n(r));if(e&&"number"!=typeof n){var a=void 0===n?"undefined":o(n);throw new Error('Each step of a gradation must have a threshold defined except for the first one. Got "'+n+'", '+a+". Step: "+JSON.stringify(t))}return n}(n[a-1],n[a],r))return a-1;if(a===n.length-1)return a;return e(t,r,n,a+1)}(e,t,n),u=n[i];if(-1===i)return;if(u.granularity){var l=Math.round(e/u.factor/u.granularity)*u.granularity;if(0===l&&i>0)return n[i-1]}return u};var a=r(0)},function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=s(r(11)),u=s(r(1)),l=r(8),f=s(r(4)),c=r(3);function s(e){return e&&e.__esModule?e:{default:e}}var d=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),"string"==typeof t&&(t=[t]),this.locale=(0,u.default)(t.concat((0,c.getDefaultLocale)()),c.isLocaleDataAvailable)}return a(e,[{key:"format",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.defaultStyle;if("string"==typeof t)switch(t){case"twitter":t=l.twitterStyle;break;case"time":t=l.timeStyle;break;default:t=l.defaultStyle}var r=function(e){if(e.constructor===Date)return{date:e,time:e.getTime()};if("number"==typeof e)return{time:e};throw new Error("Unsupported relative time formatter input: "+(void 0===e?"undefined":o(e))+", "+e)}(e),n=r.date,a=r.time,u=this.getLocaleData(t.flavour),c=u.flavour,s=u.localeData,d=t.now||Date.now(),y=(d-a)/1e3;if(t.custom){var h=t.custom({now:d,date:n,time:a,elapsed:y,locale:this.locale});if(void 0!==h)return h}var p=function(e,t){var r=Object.keys(e);if(t)return t.filter(function(e){return r.indexOf(e)>=0});return r}(s,t.units);if(0===p.length)return console.error('Units "'+p.join(", ")+'" were not found in locale data for "'+this.locale+'".'),"";var m=(0,i.default)(Math.abs(y),d,p,t.gradation);if(!m)return"";if(m.format)return m.format(n||a,this.locale);var v=m.unit,b=m.factor,g=m.granularity,S=Math.abs(y)/b;return g&&(S=Math.round(S/g)*g),new f.default(this.locale,{style:c}).format(-1*Math.sign(y)*Math.round(S),v)}},{key:"getLocaleData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=(0,c.getLocaleData)(this.locale);"string"==typeof e&&(e=[e]);var r=e=e.concat("long"),n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var a;if(n){if(o>=r.length)break;a=r[o++]}else{if((o=r.next()).done)break;a=o.value}var i=a;if(t[i])return{flavour:i,localeData:t[i]}}}}]),e}();t.default=d,d.getDefaultLocale=c.getDefaultLocale,d.setDefaultLocale=c.setDefaultLocale,d.addLocale=c.addLocaleData,d.locale=d.addLocale},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(12);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return i(n).default}});var o=r(1);Object.defineProperty(t,"intlDateTimeFormatSupported",{enumerable:!0,get:function(){return o.intlDateTimeFormatSupported}}),Object.defineProperty(t,"intlDateTimeFormatSupportedLocale",{enumerable:!0,get:function(){return o.intlDateTimeFormatSupportedLocale}});var a=r(4);function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"RelativeTimeFormat",{enumerable:!0,get:function(){return i(a).default}})}])});
//# sourceMappingURL=javascript-time-ago.min.js.map