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

2 lines
14 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("javascript-time-ago",[],e):"object"==typeof exports?exports["javascript-time-ago"]=e():t["javascript-time-ago"]=e()}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([,function(t,e,r){"use strict";r.r(e);var n="en",o={};function a(){return n}function i(t){return o[t]}function u(t){var e=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).localeMatcher||"lookup";switch(e){case"lookup":case"best fit":return l(t);default:throw new RangeError('Invalid "localeMatcher" option: '.concat(e))}}function l(t){if(i(t))return t;for(var e=t.split("-");t.length>1;)if(e.pop(),i(t=e.join("-")))return t}function f(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=["second","minute","hour","day","week","month","quarter","year"],h=["auto","always"],y=["long","short","narrow"],m=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),c(this,"numeric","always"),c(this,"style","long"),c(this,"localeMatcher","lookup");var n=r.numeric,o=r.style,i=r.localeMatcher;if(n){if(h.indexOf(n)<0)throw new RangeError('Invalid "numeric" option: '.concat(n));this.numeric=n}if(o){if(y.indexOf(o)<0)throw new RangeError('Invalid "style" option: '.concat(o));this.style=o}if(i&&(this.localeMatcher=i),"string"==typeof e&&(e=[e]),e.push(a()),this.locale=t.supportedLocalesOf(e,{localeMatcher:this.localeMatcher})[0],!this.locale)throw new TypeError("No supported locale was found");this.locale=u(this.locale,{localeMatcher:this.localeMatcher}),"undefined"!=typeof Intl&&Intl.NumberFormat&&(this.numberFormat=new Intl.NumberFormat(this.locale))}var e,r,n;return e=t,(r=[{key:"format",value:function(t,e){return this.getRule(t,e).replace("{0}",this.formatNumber(Math.abs(t)))}},{key:"formatToParts",value:function(t,e){var r=this.getRule(t,e),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)}),o.push({unit:e,type:"integer",value:this.formatNumber(Math.abs(t))}),n+"{0}".length<r.length-1&&o.push({type:"literal",value:r.slice(n+"{0}".length)}),o}},{key:"getRule",value:function(t,e){if(s.indexOf(e)<0)throw new RangeError("Unknown time unit: ".concat(e,"."));var r=i(this.locale)[this.style][e];if("auto"===this.numeric)if(-2===t||-1===t){var n=r["previous".concat(-1===t?"":"-"+Math.abs(t))];if(n)return n}else if(1===t||2===t){var o=r["next".concat(1===t?"":"-"+Math.abs(t))];if(o)return o}else if(0===t&&r.current)return r.current;var a=r[t<=0?"past":"future"];if("string"==typeof a)return a;var u=i(this.locale).quantify,l=u&&u(Math.abs(t));return a[l=l||"other"]||a.other}},{key:"formatNumber",value:function(t){return this.numberFormat?this.numberFormat.format(t):String(t)}},{key:"resolvedOptions",value:function(){return{locale:this.locale,style:this.style,numeric:this.numeric}}}])&&f(e.prototype,r),n&&f(e,n),t}();function p(t){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function b(t){return(b="function"==typeof Symbol&&"symbol"===p(Symbol.iterator)?function(t){return p(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":p(t)})(t)}function d(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}m.supportedLocalesOf=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"string"==typeof t&&(t=[t]),t.filter(function(t){return u(t,e)})},m.addLocale=function(t){if(!t)throw new Error("No locale data passed");o[t.locale]=t},m.setDefaultLocale=function(t){n=t},m.getDefaultLocale=a;var v=function(){function t(){var e,r,n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n={},(r="cache")in(e=this)?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n}var e,r,n;return e=t,(r=[{key:"get",value:function(){for(var t=this.cache,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var o=0;o<r.length;o++){var a=r[o];if("object"!==b(t))return;t=t[a]}return t}},{key:"put",value:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(var n=e.pop(),o=e.pop(),a=this.cache,i=0;i<e.length;i++){var u=e[i];"object"!==b(a[u])&&(a[u]={}),a=a[u]}return a[o]=n}}])&&d(e.prototype,r),n&&d(e,n),t}(),g=86400;function w(t,e){var r=t,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(i.unit===e)return i}}function S(t){return t instanceof Date?t:new Date(t)}var k=[{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:73800,factor:g,unit:"day"},{threshold:475200,factor:7*g,unit:"week"},{threshold:2116800,factor:2630016,unit:"month"},{threshold:27615168,factor:31556952,unit:"year"}];function O(t){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function j(t){return(j="function"==typeof Symbol&&"symbol"===O(Symbol.iterator)?function(t){return O(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":O(t)})(t)}function M(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:k;if(0!==(n=function(t,e){return t.filter(function(t){var r=t.unit;return!r||e.indexOf(r)>=0})}(n,r)).length){var o=function t(e,r,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(Math.abs(e)<function(t,e,r,n){var o;t&&(t.id||t.unit)&&(o=e["threshold_for_".concat(t.id||t.unit)]);void 0===o&&(o=e.threshold);"function"==typeof o&&(o=o(r,n));if(t&&"number"!=typeof o){var a=j(o);throw new Error('Each step of a gradation must have a threshold defined except for the first one. Got "'.concat(o,'", ').concat(a,". Step: ").concat(JSON.stringify(e)))}return o}(n[o-1],n[o],r,e<0))return o-1;if(o===n.length-1)return o;return t(e,r,n,o+1)}(t,e,n),a=n[o];if(-1!==o){if(a.granularity)if(0===Math.round(Math.abs(t)/a.factor/a.granularity)*a.granularity&&o>0)return n[o-1];return a}}}function D(t){return(D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function F(t){return(F="function"==typeof Symbol&&"symbol"===D(Symbol.iterator)?function(t){return D(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":D(t)})(t)}function x(t){if(T())return Intl.DateTimeFormat.supportedLocalesOf(t)[0]}function T(){return"object"===("undefined"==typeof Intl?"undefined":F(Intl))&&"function"==typeof Intl.DateTimeFormat}var L={gradation:k,flavour:["long-convenient","long"],units:["now","minute","hour","day","week","month","year"]},E=[{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:g,unit:"day"},{threshold:561600,factor:7*g,unit:"week"},{threshold:2116800,factor:2630016,unit:"month"},{threshold:30245184,factor:31556952,unit:"year"}];function I(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var P={},_={gradation:[function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(e){I(t,e,r[e])})}return t}({},w(E,"minute"),{threshold:45}),w(E,"hour"),{threshold:84600,format:function(t,e){if(T())return P[e]||(P[e]={}),P[e].this_year||(P[e].this_year=new Intl.DateTimeFormat(e,{month:"short",day:"numeric"})),P[e].this_year.format(S(t))}},{threshold:function(t,e){return e?(new Date(new Date(t).getFullYear()+1,0).getTime()-t)/1e3:(t-new Date(new Date(t).getFullYear(),0).getTime())/1e3},format:function(t,e){if(T())return P[e]||(P[e]={}),P[e].other||(P[e].other=new Intl.DateTimeFormat(e,{year:"numeric",month:"short",day:"numeric"})),P[e].other.format(S(t))}}],flavour:["tiny","short-time","narrow","short"]},N={gradation:k,flavour:"long-time",units:["now","minute","hour","day","week","month","year"]},R={};function A(t){return R[t]}function C(t){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function q(t){return(q="function"==typeof Symbol&&"symbol"===C(Symbol.iterator)?function(t){return C(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":C(t)})(t)}function U(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var V=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),"string"==typeof e&&(e=[e]),this.locale=function(t,e){var r=t,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(e(i))return i;for(var u=i.split("-");u.length>1;)if(u.pop(),e(i=u.join("-")))return i}throw new Error("No locale data has been registered for any of the locales: ".concat(t.join(", ")))}(e.concat(m.getDefaultLocale()),A),"undefined"!=typeof Intl&&Intl.NumberFormat&&(this.numberFormat=new Intl.NumberFormat(this.locale)),this.relativeTimeFormatCache=new v}var e,r,n;return e=t,(r=[{key:"format",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:L;if("string"==typeof e)switch(e){case"twitter":e=_;break;case"time":e=N;break;default:e=L}var r=function(t){if(t.constructor===Date||(e=t,"object"===q(e)&&"function"==typeof e.getTime))return{date:t,time:t.getTime()};var e;if("number"==typeof t)return{time:t};throw new Error("Unsupported relative time formatter input: ".concat(q(t),", ").concat(t))}(t),n=r.date,o=r.time,a=this.getLocaleData(e.flavour),i=a.flavour,u=a.localeData,l=e.now||Date.now(),f=(l-o)/1e3;if(e.custom){var c=e.custom({now:l,date:n,time:o,elapsed:f,locale:this.locale});if(void 0!==c)return c}var s=function(t,e){var r=Object.keys(t);e&&(r=e.filter(function(t){return r.indexOf(t)>=0}));(!e||e.indexOf("now")>=0)&&r.indexOf("now")<0&&t.second.current&&r.unshift("now");return r}(u,e.units);if(0===s.length)return console.error('Units "'.concat(s.join(", "),'" were not found in locale data for "').concat(this.locale,'".')),"";var h=M(f,l,s,e.gradation);if(!h)return"";if(h.format)return h.format(n||o,this.locale);var y=h.unit,m=h.factor,p=h.granularity,b=Math.abs(f)/m;if(p&&(b=Math.round(b/p)*p),"now"===y)return function(t,e){if(t.now)return"string"==typeof t.now?t.now:e<=0?t.now.past:t.now.future;return t.second.current}(u,-1*Math.sign(f));switch(i){case"long":case"short":case"narrow":return this.getFormatter(i).format(-1*Math.sign(f)*Math.round(b),y);default:return this.formatValue(-1*Math.sign(f)*Math.round(b),y,u)}}},{key:"formatValue",value:function(t,e,r){return this.getRule(t,e,r).replace("{0}",this.formatNumber(Math.abs(t)))}},{key:"getRule",value:function(t,e,r){var n=r[e];if("string"==typeof n)return n;var o=n[t<=0?"past":"future"]||n;if("string"==typeof o)return o;var a=A(this.locale).quantify,i=a&&a(Math.abs(t));return o[i=i||"other"]||o.other}},{key:"formatNumber",value:function(t){return this.numberFormat?this.numberFormat.format(t):String(t)}},{key:"getFormatter",value:function(t){return this.relativeTimeFormatCache.get(this.locale,t)||this.relativeTimeFormatCache.put(this.locale,t,new m(this.locale,{style:t}))}},{key:"getLocaleData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=A(this.locale);"string"==typeof t&&(t=[t]);var r=t=t.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(e[i])return{flavour:i,localeData:e[i]}}}}])&&U(e.prototype,r),n&&U(e,n),t}();V.getDefaultLocale=m.getDefaultLocale,V.setDefaultLocale=m.setDefaultLocale,V.addLocale=function(t){!function(t){if(!t)throw new Error("[javascript-time-ago] No locale data passed.");R[t.locale]=t}(t),m.addLocale(t)},V.locale=V.addLocale,r.d(e,"default",function(){return V}),r.d(e,"intlDateTimeFormatSupported",function(){return T}),r.d(e,"intlDateTimeFormatSupportedLocale",function(){return x})}])});
//# sourceMappingURL=javascript-time-ago.min.js.map