time/moment-timezone-with-data.js

1 line
189 KiB
JavaScript
Raw Normal View History

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