1 line
42 KiB
JavaScript
1 line
42 KiB
JavaScript
|
!function(a,i){"use strict";"object"==typeof module&&module.exports?module.exports=i(require("moment")):"function"==typeof define&&define.amd?define(["moment"],i):i(a.moment)}(this,function(A){"use strict";void 0===A.version&&A.default&&(A=A.default);var i,c={},n={},t={},s={},u={};A&&"string"==typeof A.version||y("Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/");var a=A.version.split("."),e=+a[0],r=+a[1];function m(a){return 96<a?a-87:64<a?a-29:a-48}function o(a){var i=0,e=a.split("."),r=e[0],o=e[1]||"",A=1,c=0,n=1;for(45===a.charCodeAt(0)&&(n=-(i=1));i<r.length;i++)c=60*c+m(r.charCodeAt(i));for(i=0;i<o.length;i++)A/=60,c+=m(o.charCodeAt(i))*A;return c*n}function l(a){for(var i=0;i<a.length;i++)a[i]=o(a[i])}function f(a,i){for(var e=[],r=0;r<i.length;r++)e[r]=a[i[r]];return e}function p(a){var i=a.split("|"),e=i[2].split(" "),r=i[3].split(""),o=i[4].split(" ");return l(e),l(r),l(o),function(a,i){for(var e=0;e<i;e++)a[e]=Math.round((a[e-1]||0)+6e4*a[e]);a[i-1]=1/0}(o,r.length),{name:i[0],abbrs:f(i[1].split(" "),r),offsets:f(e,r),untils:o,population:0|i[5]}}function M(a){a&&this._set(p(a))}function b(a,i){this.name=a,this.zones=i}function d(a){var i=a.toTimeString(),e=i.match(/\([a-z ]+\)/i);"GMT"===(e=e&&e[0]?(e=e[0].match(/[A-Z]/g))?e.join(""):void 0:(e=i.match(/[A-Z]{3,5}/g))?e[0]:void 0)&&(e=void 0),this.at=+a,this.abbr=e,this.offset=a.getTimezoneOffset()}function h(a){this.zone=a,this.offsetScore=0,this.abbrScore=0}function g(){for(var a,i,e=(new Date).getFullYear()-2,r=new d(new Date(e,0,1)),o=[r],A=1;A<48;A++)(i=new d(new Date(e,A,1))).offset!==r.offset&&(a=function(a,i){for(var e,r;r=6e4*((i.at-a.at)/12e4|0);)(e=new d(new Date(a.at+r))).offset===a.offset?a=e:i=e;return a}(r,i),o.push(a),o.push(new d(new Date(a.at+6e4)))),r=i;for(A=0;A<4;A++)o.push(new d(new Date(e+A,0,1))),o.push(new d(new Date(e+A,6,1)));return o}function E(a,i){return a.offsetScore!==i.offsetScore?a.offsetScore-i.offsetScore:a.abbrScore!==i.abbrScore?a.abbrScore-i.abbrScore:a.zone.population!==i.zone.population?i.zone.population-a.zone.population:i.zone.name.localeCompare(a.zone.name)}function z(){try{var a=Intl.DateTimeFormat().resolvedOptions().timeZone;if(a&&3<a.length){var i=s[P(a)];if(i)return i;y("Moment Timezone found "+a+" from the Intl api, but did not have that data loaded.")}}catch(a){}for(var e,r,o=g(),A=o.length,c=function(a){for(var i,e,r=a.length,o={},A=[],c=0;c<r;c++)for(i in e=u[a[c].offset]||{})e.hasOwnProperty(i)&&(o[i]=!0);for(c in o)o.hasOwnProperty(c)&&A.push(s[c]);return A}(o),n=[],t=0;t<c.length;t++){for(e=new h(T(c[t])),r=0;r<A;r++)e.scoreOffsetAt(o[r]);n.push(e)}return n.sort(E),0<n.length?n[0].zone.name:void 0}function P(a){return(a||"").toLowerCase().replace(/\//g,"_")}function S(a){var i,e,r,o;for("string"==typeof a&&(a=[a]),i=0;i<a.length;i++)o=P(e=(r=a[i].split("|"))[0]),c[o]=a[i],s[o]=e,function(a,i){var e,r;for(l(i),e=0;e<i.length;e++)r=i[e],u[r]=u[r]||{},u[r][a]=!0}(o,r[2].split(" "))}function T(a,i){a=P(a);var e,r=c[a];return r instanceof M?r:"string"==typeof r?(r=new M(r),c[a]=r):n[a]&&i!==T&&(e=T(n[a],T))?((r=c[a]=new M)._set(e),r.name=s[a],r):null}function _(a){var i,e,r,o;for("string"==typeof a&&(a=[a]),i=0;i<a.length;i++)r=P((e=a[i].split("|"))[0]),o=P(e[1]),n[r]=o,s[r]=e[0],n[o]=r,s[o]=e[1]}function k(a){S(a.zones),_(a.links),function(a){var i,e,r,o;if(a&&a.length)for(i=0;i<a.length;i++)e=(o=a[i].split("|"))[0].toUpperCase(),r=o[1].split(" "),t[e]=new b(e,r)}(a.countries),O.dataVersion=a.version}function B(a){return B.didShowError||(B.didShowError=!0,y("moment.tz.zoneExists('"+a+"') has been deprecated in favor of !moment.tz.zone('"+a+"')")),!!T(a)}function C(a){var i="X"===a._f||"x"===a._f;return!(!a._a||void 0!==a._tzm||i)}function y(a){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(a)}function O(a){var i=Array.prototype.slice.call(arguments,0,-1),e=arguments[arguments.length-1],r=T(e),o=A.utc.apply(null,i);return r&&!A.isMoment(a)&&C(o)&&o.add(r.parse(o),"minutes"),o.tz(e),o}(e<2||2==e&&r<6)&&y("Moment Timezone requires Moment.
|