@univerjs/engine-formula 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +238 -808
- package/lib/types/engine/utils/math-kit.d.ts +9 -3
- package/lib/types/functions/compatibility/rank/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/compatibility/rank/index.d.ts +10 -0
- package/lib/types/functions/statistical/rank-avg/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/rank-avg/index.d.ts +11 -0
- package/lib/types/functions/statistical/rank-eq/__tests__/index.spec.d.ts +16 -0
- package/lib/types/functions/statistical/rank-eq/index.d.ts +10 -0
- package/lib/types/index.d.ts +20 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
- package/lib/types/engine/utils/relative-formula.d.ts +0 -3
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { ObjectMatrix, LRUMap, hashAlgorithm, Tools, AbsoluteRefType, RANGE_TYPE, Disposable, moveRangeByOffset, isValidRange, isRealNum, DEFAULT_EMPTY_DOCUMENT_VALUE, isNullCell, CellValueType, BooleanNumber, isFormulaString, isFormulaId, Inject, UniverInstanceType, IUniverInstanceService, CommandType, createIdentifier, toDisposable, Injector, sortRules, OnLifecycle, LifecycleStages, requestImmediateMacroTask, IConfigService, ICommandService, Optional, Plugin
|
|
5
|
+
import { ObjectMatrix, LRUMap, hashAlgorithm, Tools, AbsoluteRefType, RANGE_TYPE, Disposable, moveRangeByOffset, isValidRange, numfmt, isRealNum, DEFAULT_EMPTY_DOCUMENT_VALUE, isNullCell, CellValueType, BooleanNumber, isFormulaString, isFormulaId, Inject, UniverInstanceType, IUniverInstanceService, CommandType, createIdentifier, toDisposable, Injector, sortRules, OnLifecycle, LifecycleStages, requestImmediateMacroTask, IConfigService, ICommandService, Optional, Plugin } from "@univerjs/core";
|
|
6
6
|
import { Subject } from "rxjs";
|
|
7
7
|
import { DataSyncPrimaryController } from "@univerjs/rpc";
|
|
8
8
|
function isInDirtyRange(dirtyRanges, unitId, sheetId, row, column) {
|
|
@@ -996,7 +996,7 @@ const FORMULA_CACHE_LRU_COUNT$2 = 1e5, FormulaLexerNodeCache = new FormulaAstLRU
|
|
|
996
996
|
this._segment.length > 0 && this._openTableBracket(), this._pushSegment(currentString), this._openSquareBracket();
|
|
997
997
|
else if (currentString === matchToken.CLOSE_SQUARE_BRACKET && this.isSingleQuotationClose() && this.isDoubleQuotationClose())
|
|
998
998
|
this._closeSquareBracket(), this.isSquareBracketClose() ? (this._pushSegment(currentString), this._isTableBracket() && (this._pushNodeToChildren(this._segment), this._resetSegment()), this._closeTableBracket()) : this._pushSegment(currentString);
|
|
999
|
-
else if (currentString === matchToken.DOUBLE_QUOTATION && this.isSingleQuotationClose() && this.
|
|
999
|
+
else if (currentString === matchToken.DOUBLE_QUOTATION && this.isSingleQuotationClose() && this.isSquareBracketClose()) {
|
|
1000
1000
|
if (this.isDoubleQuotationClose())
|
|
1001
1001
|
this._openDoubleQuotation();
|
|
1002
1002
|
else {
|
|
@@ -1061,13 +1061,13 @@ const FORMULA_CACHE_LRU_COUNT$2 = 1e5, FormulaLexerNodeCache = new FormulaAstLRU
|
|
|
1061
1061
|
lastChildNode && lastChildNode.changeToParent(subLexerNode_left);
|
|
1062
1062
|
}
|
|
1063
1063
|
this._setCurrentLexerNode(subLexerNode_main), this._currentLexerNode = subLexerNode_right, this._openColon(upLevel);
|
|
1064
|
-
} else if (SUFFIX_TOKEN_SET.has(currentString) && this._checkSimilarErrorToken(currentString, cur, formulaStringArray) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && this.isSquareBracketClose()) {
|
|
1064
|
+
} else if (SUFFIX_TOKEN_SET.has(currentString) && this._checkSimilarErrorToken(currentString, cur, formulaStringArray) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && this.isSquareBracketClose() && this.isBracesClose()) {
|
|
1065
1065
|
this._pushNodeToChildren(this._segment);
|
|
1066
1066
|
const subLexerNode = new LexerNode();
|
|
1067
1067
|
subLexerNode.setToken(currentString);
|
|
1068
1068
|
const lastChildNode = this._getLastChildCurrent();
|
|
1069
1069
|
lastChildNode instanceof LexerNode ? lastChildNode.changeToParent(subLexerNode) : lastChildNode !== !1 && (subLexerNode.getChildren().push(lastChildNode), this._removeLastChild()), this._pushNodeToChildren(subLexerNode), subLexerNode.setParent(this._currentLexerNode), this._resetSegment();
|
|
1070
|
-
} else if (OPERATOR_TOKEN_SET.has(currentString) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && this.isSquareBracketClose()) {
|
|
1070
|
+
} else if (OPERATOR_TOKEN_SET.has(currentString) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && this.isSquareBracketClose() && this.isBracesClose()) {
|
|
1071
1071
|
let trimSegment = this._segment.trim();
|
|
1072
1072
|
if (currentString === operatorToken.MINUS && trimSegment === "") {
|
|
1073
1073
|
const prevString = this._findPreviousToken(formulaStringArray, cur - 1) || "";
|
|
@@ -1695,783 +1695,20 @@ function strip(num, precision = 15) {
|
|
|
1695
1695
|
return Number.parseFloat(num.toPrecision(precision));
|
|
1696
1696
|
}
|
|
1697
1697
|
__name(strip, "strip");
|
|
1698
|
-
function withinErrorMargin(left, right) {
|
|
1699
|
-
return Math.abs(left - right) <
|
|
1698
|
+
function withinErrorMargin(left, right, tolerance = Number.EPSILON) {
|
|
1699
|
+
return Math.abs(left - right) < tolerance;
|
|
1700
1700
|
}
|
|
1701
1701
|
__name(withinErrorMargin, "withinErrorMargin");
|
|
1702
|
-
function stripErrorMargin(num, precision = 12) {
|
|
1702
|
+
function stripErrorMargin(num, precision = 12, tolerance = 1e-10) {
|
|
1703
1703
|
const stripResult = strip(num, precision);
|
|
1704
|
-
return withinErrorMargin(num, stripResult) ? stripResult : strip(num);
|
|
1704
|
+
return withinErrorMargin(num, stripResult, tolerance) ? stripResult : strip(num);
|
|
1705
1705
|
}
|
|
1706
1706
|
__name(stripErrorMargin, "stripErrorMargin");
|
|
1707
1707
|
function getFractionalPart(num) {
|
|
1708
1708
|
return num - Math.trunc(num);
|
|
1709
1709
|
}
|
|
1710
1710
|
__name(getFractionalPart, "getFractionalPart");
|
|
1711
|
-
|
|
1712
|
-
function getDefaultExportFromCjs(x) {
|
|
1713
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
1714
|
-
}
|
|
1715
|
-
__name(getDefaultExportFromCjs, "getDefaultExportFromCjs");
|
|
1716
|
-
var numfmt$2 = { exports: {} };
|
|
1717
|
-
(function(module, exports) {
|
|
1718
|
-
(function(e, t) {
|
|
1719
|
-
module.exports = t();
|
|
1720
|
-
})(typeof self < "u" ? self : commonjsGlobal, function() {
|
|
1721
|
-
return function() {
|
|
1722
|
-
var e = { d: /* @__PURE__ */ __name(function(t2, n2) {
|
|
1723
|
-
for (var a2 in n2) e.o(n2, a2) && !e.o(t2, a2) && Object.defineProperty(t2, a2, { enumerable: !0, get: n2[a2] });
|
|
1724
|
-
}, "d"), o: /* @__PURE__ */ __name(function(e2, t2) {
|
|
1725
|
-
return Object.prototype.hasOwnProperty.call(e2, t2);
|
|
1726
|
-
}, "o") }, t = {};
|
|
1727
|
-
e.d(t, { default: /* @__PURE__ */ __name(function() {
|
|
1728
|
-
return pe;
|
|
1729
|
-
}, "default") });
|
|
1730
|
-
var n = { 1078: "af", 1052: "sq", 1118: "am", 5121: "ar_DZ", 15361: "ar_BH", 3073: "ar_EG", 2049: "ar_IQ", 11265: "ar_JO", 13313: "ar_KW", 12289: "ar_LB", 4097: "ar_LY", 6145: "ar_MA", 8193: "ar_OM", 16385: "ar_QA", 1025: "ar_SA", 10241: "ar_SY", 7169: "ar_TN", 14337: "ar_AE", 9217: "ar_YE", 1067: "hy", 1101: "as", 2092: "az_AZ", 1068: "az_AZ", 1069: "eu", 1059: "be", 2117: "bn", 1093: "bn_IN", 5146: "bs", 1026: "bg", 1109: "my", 1027: "ca", 2052: "zh_CN", 3076: "zh_HK", 5124: "zh_MO", 4100: "zh_SG", 1028: "zh_TW", 1050: "hr", 1029: "cs", 1030: "da", 1125: "dv", 2067: "nl_BE", 1043: "nl_NL", 1126: "bin", 3081: "en_AU", 10249: "en_BZ", 4105: "en_CA", 9225: "en_CB", 2057: "en_GB", 16393: "en_IN", 6153: "en_IE", 8201: "en_JM", 5129: "en_NZ", 13321: "en_PH", 7177: "en_ZA", 11273: "en_TT", 1033: "en_US", 12297: "en_ZW", 1061: "et", 1071: "mk", 1080: "fo", 1065: "fa", 1124: "fil", 1035: "fi", 2060: "fr_BE", 11276: "fr_CM", 3084: "fr_CA", 9228: "fr_CG", 12300: "fr_CI", 1036: "fr_FR", 5132: "fr_LU", 13324: "fr_ML", 6156: "fr_MC", 14348: "fr_MA", 10252: "fr_SN", 4108: "fr_CH", 7180: "fr", 1122: "fy_NL", 2108: "gd_IE", 1084: "gd", 1110: "gl", 1079: "ka", 3079: "de_AT", 1031: "de_DE", 5127: "de_LI", 4103: "de_LU", 2055: "de_CH", 1032: "el", 1140: "gn", 1095: "gu", 1279: "en", 1037: "he", 1081: "hi", 1038: "hu", 1039: "is", 1136: "ig_NG", 1057: "id", 1040: "it_IT", 2064: "it_CH", 1041: "ja", 1099: "kn", 1120: "ks", 1087: "kk", 1107: "km", 1111: "kok", 1042: "ko", 1088: "ky", 1108: "lo", 1142: "la", 1062: "lv", 1063: "lt", 2110: "ms_BN", 1086: "ms_MY", 1100: "ml", 1082: "mt", 1112: "mni", 1153: "mi", 1102: "mr", 1104: "mn", 2128: "mn", 1121: "ne", 1044: "no_NO", 2068: "no_NO", 1096: "or", 1045: "pl", 1046: "pt_BR", 2070: "pt_PT", 1094: "pa", 1047: "rm", 2072: "ro_MO", 1048: "ro_RO", 1049: "ru", 2073: "ru_MO", 1083: "se", 1103: "sa", 3098: "sr_SP", 2074: "sr_SP", 1072: "st", 1074: "tn", 1113: "sd", 1115: "si", 1051: "sk", 1060: "sl", 1143: "so", 1070: "sb", 11274: "es_AR", 16394: "es_BO", 13322: "es_CL", 9226: "es_CO", 5130: "es_CR", 7178: "es_DO", 12298: "es_EC", 17418: "es_SV", 4106: "es_GT", 18442: "es_HN", 2058: "es_MX", 19466: "es_NI", 6154: "es_PA", 15370: "es_PY", 10250: "es_PE", 20490: "es_PR", 1034: "es_ES", 14346: "es_UY", 8202: "es_VE", 1089: "sw", 2077: "sv_FI", 1053: "sv_SE", 1114: "syc", 1064: "tg", 1097: "ta", 1092: "tt", 1098: "te", 1054: "th", 1105: "bo", 1073: "ts", 1055: "tr", 1090: "tk", 1058: "uk", 1056: "ur", 2115: "uz_UZ", 1091: "uz_UZ", 1075: "ve", 1066: "vi", 1106: "cy", 1076: "xh", 1085: "yi", 1077: "zu" };
|
|
1731
|
-
const a = /^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i, r = {}, i = { group: " ", decimal: ".", positive: "+", negative: "-", percent: "%", exponent: "E", nan: "NaN", infinity: "∞", ampm: ["AM", "PM"], mmmm6: ["Muharram", "Safar", "Rabiʻ I", "Rabiʻ II", "Jumada I", "Jumada II", "Rajab", "Shaʻban", "Ramadan", "Shawwal", "Dhuʻl-Qiʻdah", "Dhuʻl-Hijjah"], mmm6: ["Muh.", "Saf.", "Rab. I", "Rab. II", "Jum. I", "Jum. II", "Raj.", "Sha.", "Ram.", "Shaw.", "Dhuʻl-Q.", "Dhuʻl-H."], mmmm: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], mmm: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dddd: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ddd: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] };
|
|
1732
|
-
function s(e2) {
|
|
1733
|
-
const t2 = a.exec(e2);
|
|
1734
|
-
if (!t2) throw new SyntaxError("Malformed locale: ".concat(e2));
|
|
1735
|
-
return { lang: t2[1] + (t2[2] ? "_" + t2[2] : ""), language: t2[1], territory: t2[2] || "", codeset: t2[3] || "", modifier: t2[4] || "" };
|
|
1736
|
-
}
|
|
1737
|
-
__name(s, "s");
|
|
1738
|
-
function o(e2) {
|
|
1739
|
-
if (typeof e2 == "number") return n[65535 & e2] || null;
|
|
1740
|
-
const t2 = parseInt(e2, 16);
|
|
1741
|
-
return isFinite(t2) && n[65535 & t2] ? n[65535 & t2] || null : a.test(e2) ? e2 : null;
|
|
1742
|
-
}
|
|
1743
|
-
__name(o, "o");
|
|
1744
|
-
function l(e2) {
|
|
1745
|
-
const t2 = o(e2);
|
|
1746
|
-
let n2 = null;
|
|
1747
|
-
if (t2) {
|
|
1748
|
-
const e3 = s(t2);
|
|
1749
|
-
n2 = r[e3.lang] || r[e3.language] || null;
|
|
1750
|
-
}
|
|
1751
|
-
return n2;
|
|
1752
|
-
}
|
|
1753
|
-
__name(l, "l");
|
|
1754
|
-
function d(e2) {
|
|
1755
|
-
return Object.assign({}, i, e2);
|
|
1756
|
-
}
|
|
1757
|
-
__name(d, "d");
|
|
1758
|
-
function m(e2, t2) {
|
|
1759
|
-
const n2 = typeof t2 == "object" ? t2 : s(t2);
|
|
1760
|
-
return r[n2.lang] = d(e2), n2.language === n2.lang || r[n2.language] || (r[n2.language] = d(e2)), r[n2.lang];
|
|
1761
|
-
}
|
|
1762
|
-
__name(m, "m");
|
|
1763
|
-
const u = d({ group: "," });
|
|
1764
|
-
function c(e2, t2) {
|
|
1765
|
-
if (typeof e2 != "number") return e2;
|
|
1766
|
-
if (e2 < 0) return -c(-e2, t2);
|
|
1767
|
-
if (t2) {
|
|
1768
|
-
const n2 = 10 ** (t2 || 0) || 1;
|
|
1769
|
-
return c(e2 * n2, 0) / n2;
|
|
1770
|
-
}
|
|
1771
|
-
return Math.round(e2);
|
|
1772
|
-
}
|
|
1773
|
-
__name(c, "c"), u.isDefault = !0, m({ group: ",", ampm: ["上午", "下午"], mmmm: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], ddd: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"] }, "zh_CN"), m({ group: ",", nan: "非數值", ampm: ["上午", "下午"], mmmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"], ddd: ["週日", "週一", "週二", "週三", "週四", "週五", "週六"] }, "zh_TW"), m({ group: ",", ampm: ["午前", "午後"], mmmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], mmm: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"], dddd: ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"], ddd: ["日", "月", "火", "水", "木", "金", "土"] }, "ja"), m({ group: ",", ampm: ["오전", "오후"], mmmm: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], mmm: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], dddd: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"], ddd: ["일", "월", "화", "수", "목", "금", "토"] }, "ko"), m({ group: ",", ampm: ["ก่อนเที่ยง", "หลังเที่ยง"], mmmm: ["มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม"], mmm: ["ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.", "ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค."], dddd: ["วันอาทิตย์", "วันจันทร์", "วันอังคาร", "วันพุธ", "วันพฤหัสบดี", "วันศุกร์", "วันเสาร์"], ddd: ["อา.", "จ.", "อ.", "พ.", "พฤ.", "ศ.", "ส."] }, "th"), m({ decimal: ",", ampm: ["dop.", "odp."], mmmm: ["ledna", "února", "března", "dubna", "května", "června", "července", "srpna", "září", "října", "listopadu", "prosince"], mmm: ["led", "úno", "bře", "dub", "kvě", "čvn", "čvc", "srp", "zář", "říj", "lis", "pro"], dddd: ["neděle", "pondělí", "úterý", "středa", "čtvrtek", "pátek", "sobota"], ddd: ["ne", "po", "út", "st", "čt", "pá", "so"] }, "cs"), m({ group: ".", decimal: ",", mmmm: ["januar", "februar", "marts", "april", "maj", "juni", "juli", "august", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mar.", "apr.", "maj", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], ddd: ["søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."] }, "da"), m({ group: ".", decimal: ",", ampm: ["a.m.", "p.m."], mmmm: ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mrt.", "apr.", "mei", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"], ddd: ["zo", "ma", "di", "wo", "do", "vr", "za"] }, "nl"), m({ group: "," }, "en"), m({ decimal: ",", nan: "epäluku", ampm: ["ap.", "ip."], mmmm: ["tammikuuta", "helmikuuta", "maaliskuuta", "huhtikuuta", "toukokuuta", "kesäkuuta", "heinäkuuta", "elokuuta", "syyskuuta", "lokakuuta", "marraskuuta", "joulukuuta"], mmm: ["tammik.", "helmik.", "maalisk.", "huhtik.", "toukok.", "kesäk.", "heinäk.", "elok.", "syysk.", "lokak.", "marrask.", "jouluk."], dddd: ["sunnuntaina", "maanantaina", "tiistaina", "keskiviikkona", "torstaina", "perjantaina", "lauantaina"], ddd: ["su", "ma", "ti", "ke", "to", "pe", "la"] }, "fi"), m({ group: " ", decimal: ",", mmmm: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"], mmm: ["janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."], dddd: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"], ddd: ["dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."] }, "fr"), m({ group: ".", decimal: ",", mmmm: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], mmm: ["Jan.", "Feb.", "März", "Apr.", "Mai", "Juni", "Juli", "Aug.", "Sept.", "Okt.", "Nov.", "Dez."], dddd: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], ddd: ["So.", "Mo.", "Di.", "Mi.", "Do.", "Fr.", "Sa."] }, "de"), m({ group: ".", decimal: ",", ampm: ["π.μ.", "μ.μ."], mmmm: ["Ιανουαρίου", "Φεβρουαρίου", "Μαρτίου", "Απριλίου", "Μαΐου", "Ιουνίου", "Ιουλίου", "Αυγούστου", "Σεπτεμβρίου", "Οκτωβρίου", "Νοεμβρίου", "Δεκεμβρίου"], mmm: ["Ιαν", "Φεβ", "Μαρ", "Απρ", "Μαΐ", "Ιουν", "Ιουλ", "Αυγ", "Σεπ", "Οκτ", "Νοε", "Δεκ"], dddd: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"], ddd: ["Κυρ", "Δευ", "Τρί", "Τετ", "Πέμ", "Παρ", "Σάβ"] }, "el"), m({ decimal: ",", ampm: ["de.", "du."], mmmm: ["január", "február", "március", "április", "május", "június", "július", "augusztus", "szeptember", "október", "november", "december"], mmm: ["jan.", "febr.", "márc.", "ápr.", "máj.", "jún.", "júl.", "aug.", "szept.", "okt.", "nov.", "dec."], dddd: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"], ddd: ["V", "H", "K", "Sze", "Cs", "P", "Szo"] }, "hu"), m({ group: ".", decimal: ",", ampm: ["f.h.", "e.h."], mmmm: ["janúar", "febrúar", "mars", "apríl", "maí", "júní", "júlí", "ágúst", "september", "október", "nóvember", "desember"], mmm: ["jan.", "feb.", "mar.", "apr.", "maí", "jún.", "júl.", "ágú.", "sep.", "okt.", "nóv.", "des."], dddd: ["sunnudagur", "mánudagur", "þriðjudagur", "miðvikudagur", "fimmtudagur", "föstudagur", "laugardagur"], ddd: ["sun.", "mán.", "þri.", "mið.", "fim.", "fös.", "lau."] }, "is"), m({ group: ".", decimal: ",", mmmm: ["Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"], mmm: ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des"], dddd: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"], ddd: ["Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"] }, "id"), m({ group: ".", decimal: ",", mmmm: ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"], mmm: ["gen", "feb", "mar", "apr", "mag", "giu", "lug", "ago", "set", "ott", "nov", "dic"], dddd: ["domenica", "lunedì", "martedì", "mercoledì", "giovedì", "venerdì", "sabato"], ddd: ["dom", "lun", "mar", "mer", "gio", "ven", "sab"] }, "it"), m({ decimal: ",", ampm: ["a.m.", "p.m."], mmmm: ["januar", "februar", "mars", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "desember"], mmm: ["jan.", "feb.", "mar.", "apr.", "mai", "jun.", "jul.", "aug.", "sep.", "okt.", "nov.", "des."], dddd: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"], ddd: ["søn.", "man.", "tir.", "ons.", "tor.", "fre.", "lør."] }, "nb"), m({ decimal: ",", mmmm: ["stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia"], mmm: ["sty", "lut", "mar", "kwi", "maj", "cze", "lip", "sie", "wrz", "paź", "lis", "gru"], dddd: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"], ddd: ["niedz.", "pon.", "wt.", "śr.", "czw.", "pt.", "sob."] }, "pl"), m({ group: ".", decimal: ",", mmmm: ["janeiro", "fevereiro", "março", "abril", "maio", "junho", "julho", "agosto", "setembro", "outubro", "novembro", "dezembro"], mmm: ["jan.", "fev.", "mar.", "abr.", "mai.", "jun.", "jul.", "ago.", "set.", "out.", "nov.", "dez."], dddd: ["domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"], ddd: ["dom.", "seg.", "ter.", "qua.", "qui.", "sex.", "sáb."] }, "pt"), m({ decimal: ",", nan: "не число", mmmm: ["января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"], mmm: ["янв.", "февр.", "мар.", "апр.", "мая", "июн.", "июл.", "авг.", "сент.", "окт.", "нояб.", "дек."], dddd: ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"], ddd: ["вс", "пн", "вт", "ср", "чт", "пт", "сб"] }, "ru"), m({ decimal: ",", mmmm: ["januára", "februára", "marca", "apríla", "mája", "júna", "júla", "augusta", "septembra", "októbra", "novembra", "decembra"], mmm: ["jan", "feb", "mar", "apr", "máj", "jún", "júl", "aug", "sep", "okt", "nov", "dec"], dddd: ["nedeľa", "pondelok", "utorok", "streda", "štvrtok", "piatok", "sobota"], ddd: ["ne", "po", "ut", "st", "št", "pi", "so"] }, "sk"), m({ group: ".", decimal: ",", ampm: ["a. m.", "p. m."], mmmm: ["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"], mmm: ["ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sept.", "oct.", "nov.", "dic."], dddd: ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"], ddd: ["dom.", "lun.", "mar.", "mié.", "jue.", "vie.", "sáb."] }, "es"), m({ decimal: ",", ampm: ["fm", "em"], mmmm: ["januari", "februari", "mars", "april", "maj", "juni", "juli", "augusti", "september", "oktober", "november", "december"], mmm: ["jan.", "feb.", "mars", "apr.", "maj", "juni", "juli", "aug.", "sep.", "okt.", "nov.", "dec."], dddd: ["söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"], ddd: ["sön", "mån", "tis", "ons", "tors", "fre", "lör"] }, "sv"), m({ group: ".", decimal: ",", ampm: ["ÖÖ", "ÖS"], mmmm: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"], mmm: ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"], dddd: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"], ddd: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"] }, "tr");
|
|
1774
|
-
function p(e2, t2, n2) {
|
|
1775
|
-
const a2 = e2 < 0 ? -1 : 1, r2 = 10 ** (t2 || 2), i2 = 10 ** (n2 || 2);
|
|
1776
|
-
let s2, o2, l2 = Math.abs(e2), d2 = 0, m2 = 0, u2 = 0, c2 = 1;
|
|
1777
|
-
if ((e2 = l2) % 1 == 0) o2 = [e2 * a2, 1];
|
|
1778
|
-
else if (e2 < 1e-19) o2 = [a2, 1e19];
|
|
1779
|
-
else if (e2 > 1e19) o2 = [1e19 * a2, 1];
|
|
1780
|
-
else {
|
|
1781
|
-
do
|
|
1782
|
-
if (l2 = 1 / (l2 - Math.floor(l2)), s2 = c2, c2 = c2 * Math.floor(l2) + d2, d2 = s2, m2 = u2, u2 = Math.floor(e2 * c2 + 0.5), u2 >= r2 || c2 >= i2) return [a2 * m2, d2];
|
|
1783
|
-
while (Math.abs(e2 - u2 / c2) >= 1e-10 && l2 !== Math.floor(l2));
|
|
1784
|
-
o2 = [a2 * u2, c2];
|
|
1785
|
-
}
|
|
1786
|
-
return o2;
|
|
1787
|
-
}
|
|
1788
|
-
__name(p, "p");
|
|
1789
|
-
const f = { overflow: "######", dateErrorThrows: !1, dateErrorNumber: !0, dateSpanLarge: !0, leap1900: !0, nbsp: !0, throws: !0, invalid: "######", locale: "", ignoreTimezone: !1 }, g = Object.assign({}, f);
|
|
1790
|
-
function h(e2) {
|
|
1791
|
-
if (e2 === null && (e2 = f), e2) {
|
|
1792
|
-
for (const t2 in e2) if (t2 in f) {
|
|
1793
|
-
const n2 = e2[t2];
|
|
1794
|
-
g[t2] = n2 == null ? f[t2] : n2;
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
return { ...g };
|
|
1798
|
-
}
|
|
1799
|
-
__name(h, "h");
|
|
1800
|
-
const y = { "#": "", 0: "0", "?": " " }, _ = { "@": "text", "-": "minus", "+": "plus" }, b = ["#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#000", "#FFF", "#F00", "#0F0", "#00F", "#FF0", "#F0F", "#0FF", "#800", "#080", "#008", "#880", "#808", "#088", "#CCC", "#888", "#99F", "#936", "#FFC", "#CFF", "#606", "#F88", "#06C", "#CCF", "#008", "#F0F", "#FF0", "#0FF", "#808", "#800", "#088", "#00F", "#0CF", "#CFF", "#CFC", "#FF9", "#9CF", "#F9C", "#C9F", "#FC9", "#36F", "#3CC", "#9C0", "#FC0"], j = ["¤", "$", "£", "¥", "֏", "؋", "৳", "฿", "៛", "₡", "₦", "₩", "₪", "₫", "€", "₭", "₮", "₱", "₲", "₴", "₸", "₹", "₺", "₼", "₽", "₾", "₿"], v = new RegExp("[" + j.join("") + "]");
|
|
1801
|
-
function M(e2, t2, n2) {
|
|
1802
|
-
return t2[n2 + "_max"] = e2.length, t2[n2 + "_min"] = e2.replace(/#/g, "").length, t2;
|
|
1803
|
-
}
|
|
1804
|
-
__name(M, "M");
|
|
1805
|
-
const k = {};
|
|
1806
|
-
function x(e2) {
|
|
1807
|
-
if (!(e2 in k)) {
|
|
1808
|
-
const t2 = [], n2 = e2.replace(/^[#,]+/, "").replace(/[1-9]\d*/g, (e3) => "?".repeat(e3.length));
|
|
1809
|
-
for (let e3 = 0; e3 < n2.length; e3++) {
|
|
1810
|
-
const a2 = n2.charAt(e3);
|
|
1811
|
-
t2[e3] = a2 in y ? y[a2] : a2;
|
|
1812
|
-
}
|
|
1813
|
-
k[e2] = t2.join("");
|
|
1814
|
-
}
|
|
1815
|
-
return k[e2];
|
|
1816
|
-
}
|
|
1817
|
-
__name(x, "x");
|
|
1818
|
-
function F(e2, t2) {
|
|
1819
|
-
typeof e2 == "string" && (e2 = { type: "string", value: e2 = e2.replace(/ /g, y["?"]) }), t2.push(e2);
|
|
1820
|
-
}
|
|
1821
|
-
__name(F, "F");
|
|
1822
|
-
function z(e2) {
|
|
1823
|
-
const t2 = [], n2 = { scale: 1, percent: !1, text: !1, date: 0, date_eval: !1, date_system: 1, sec_decimals: 0, general: !1, clock: 24, int_pattern: [], frac_pattern: [], man_pattern: [], den_pattern: [], num_pattern: [], tokens: t2 };
|
|
1824
|
-
let a2 = e2 + "", r2 = "int", i2 = !1, s2 = null;
|
|
1825
|
-
const l2 = [];
|
|
1826
|
-
let d2, m2, u2 = !1;
|
|
1827
|
-
for (; a2 && !i2; ) {
|
|
1828
|
-
if (d2 = /^General/i.exec(a2)) n2.general = !0, F({ type: "general" }, t2);
|
|
1829
|
-
else if (r2 === "int" && (d2 = /^[#?0]+(?:,[#?0]+)*/.exec(a2)) || r2 === "den" && (d2 = /^[#?\d]+/.exec(a2)) || (d2 = /^[#?0]+/.exec(a2))) n2[r2 + "_pattern"].push(d2[0]), s2 = { type: r2, num: d2[0] }, F(s2, t2);
|
|
1830
|
-
else if ((d2 = /^\//.exec(a2)) && n2[r2 + "_pattern"].length) {
|
|
1831
|
-
if (!s2) throw new SyntaxError("Missing a numerator in pattern ".concat(e2));
|
|
1832
|
-
n2.fractions = !0, n2.num_pattern.push(n2[r2 + "_pattern"].pop()), s2.type = "num", r2 = "den", F({ type: "div" }, t2);
|
|
1833
|
-
} else if (d2 = /^,+/.exec(a2)) {
|
|
1834
|
-
const e3 = a2.charAt(1) in y;
|
|
1835
|
-
m2.slice(-1) in y && (d2[0].length > 1 || !e3) ? n2.scale = 1e-3 ** d2[0].length : n2.dec_fractions || F(d2[0], t2);
|
|
1836
|
-
} else {
|
|
1837
|
-
if (d2 = /^;/.exec(a2)) {
|
|
1838
|
-
i2 = !0;
|
|
1839
|
-
break;
|
|
1840
|
-
}
|
|
1841
|
-
if (d2 = /^[@+-]/.exec(a2)) d2[0] === "@" && (n2.text = !0), F({ type: _[d2[0]] }, t2);
|
|
1842
|
-
else if (d2 = /^(?:\[(h+|m+|s+)\])/i.exec(a2)) {
|
|
1843
|
-
const e3 = d2[1].toLowerCase(), a3 = e3[0], r3 = { type: "", size: 0, date: 1, raw: d2[0], pad: e3.length };
|
|
1844
|
-
a3 === "h" ? (r3.size = 16, r3.type = "hour-elap") : a3 === "m" ? (r3.size = 32, r3.type = "min-elap") : (r3.size = 64, r3.type = "sec-elap"), n2.date = n2.date | r3.size, l2.push(r3), F(r3, t2);
|
|
1845
|
-
} else if (d2 = /^(?:B2)/i.exec(a2)) u2 || (n2.date_system = 6);
|
|
1846
|
-
else if (d2 = /^(?:B1)/i.exec(a2)) u2 || (n2.date_system = 1);
|
|
1847
|
-
else if (d2 = /^(?:([hHmMsSyYbBdDegG])\1*)/.exec(a2)) {
|
|
1848
|
-
const e3 = { type: "", size: 0, date: 1, raw: d2[0] }, a3 = d2[0].toLowerCase(), r3 = a3[0];
|
|
1849
|
-
if (a3 === "y" || a3 === "yy") e3.size = 2, e3.type = "year-short";
|
|
1850
|
-
else if (r3 === "y" || r3 === "e") e3.size = 2, e3.type = "year";
|
|
1851
|
-
else if (a3 === "b" || a3 === "bb") e3.size = 2, e3.type = "b-year-short";
|
|
1852
|
-
else if (r3 === "b") e3.size = 2, e3.type = "b-year";
|
|
1853
|
-
else if (a3 === "d" || a3 === "dd") e3.size = 8, e3.type = "day", e3.pad = /dd/.test(a3);
|
|
1854
|
-
else if (a3 === "ddd") e3.size = 8, e3.type = "weekday-short";
|
|
1855
|
-
else if (r3 === "d") e3.size = 8, e3.type = "weekday";
|
|
1856
|
-
else if (r3 === "h") e3.size = 16, e3.type = "hour", e3.pad = /hh/i.test(a3);
|
|
1857
|
-
else if (r3 === "m") {
|
|
1858
|
-
a3.length === 3 ? (e3.size = 4, e3.type = "monthname-short") : a3.length === 5 ? (e3.size = 4, e3.type = "monthname-single") : a3.length >= 4 && (e3.size = 4, e3.type = "monthname");
|
|
1859
|
-
const t3 = l2[l2.length - 1];
|
|
1860
|
-
!e3.type && t3 && !t3.used && 80 & t3.size && (t3.used = !0, e3.size = 32, e3.type = "min", e3.pad = /mm/.test(a3)), e3.type || (e3.size = 4, e3.type = "month", e3.pad = /mm/.test(a3), e3.indeterminate = !0);
|
|
1861
|
-
} else if (r3 === "s") {
|
|
1862
|
-
e3.size = 64, e3.type = "sec", e3.pad = /ss/.test(a3);
|
|
1863
|
-
const t3 = l2[l2.length - 1];
|
|
1864
|
-
t3 && 32 & t3.size ? e3.used = !0 : t3 && t3.indeterminate && (delete t3.indeterminate, t3.size = 32, t3.type = "min", e3.used = !0);
|
|
1865
|
-
}
|
|
1866
|
-
n2.date = n2.date | e3.size, n2.date_eval = !0, l2.push(e3), F(e3, t2);
|
|
1867
|
-
} else if (d2 = /^(?:AM\/PM|am\/pm|A\/P)/.exec(a2)) n2.clock = 12, n2.date = 16 | n2.date, n2.date_eval = !0, F({ type: "am", short: d2[0] === "A/P" }, t2);
|
|
1868
|
-
else if (n2.date && (d2 = /^\.0{1,3}/i.exec(a2))) {
|
|
1869
|
-
const e3 = d2[0].length - 1, a3 = [64, 128, 256, 512][e3];
|
|
1870
|
-
n2.date = n2.date | a3, n2.date_eval = !0, n2.sec_decimals = Math.max(n2.sec_decimals, e3), F({ type: "subsec", size: a3, decimals: e3, date: 1, raw: d2[0] }, t2);
|
|
1871
|
-
} else if ((d2 = /^\\(.)/.exec(a2)) || (d2 = /^"([^"]*?)"/.exec(a2))) F(d2[1], t2);
|
|
1872
|
-
else if (d2 = /^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(a2)) n2.condition = [d2[1], parseFloat(d2[2], 10)];
|
|
1873
|
-
else if (d2 = /^\[\$([^\]]+)\]/.exec(a2)) {
|
|
1874
|
-
const e3 = d2[1].split("-"), a3 = e3.length < 2 ? "" : e3[e3.length - 1], r3 = e3[0];
|
|
1875
|
-
r3 && F(r3, t2);
|
|
1876
|
-
const i3 = o(a3);
|
|
1877
|
-
i3 && (n2.locale = i3);
|
|
1878
|
-
const s3 = parseInt(a3, 16);
|
|
1879
|
-
isFinite(s3) && 16711680 & s3 && (s3 >> 16 & 255) === 6 && (n2.date_system = 6), u2 = !0;
|
|
1880
|
-
} else if (d2 = /^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(a2)) n2.color = d2[2] ? b[parseInt(d2[2], 10)] || "#000" : d2[1].toLowerCase();
|
|
1881
|
-
else if (!(d2 = /^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(a2))) {
|
|
1882
|
-
if (d2 = /^%/.exec(a2)) n2.scale = 100, n2.percent = !0, F("%", t2);
|
|
1883
|
-
else if (d2 = /^_(\\.|.)/.exec(a2)) F(" ", t2);
|
|
1884
|
-
else if (d2 = /^\./.exec(a2)) F({ type: "point", value: d2[0] }, t2), n2.dec_fractions = !0, r2 = "frac";
|
|
1885
|
-
else if (d2 = /^[Ee]([+-]?|(?=[0#?]))/.exec(a2)) n2.exponential = !0, n2.exp_plus = d2[1] === "+", r2 = "man", F({ type: "exp", plus: d2[1] === "+" }, t2);
|
|
1886
|
-
else if (!(d2 = /^\*(\\.|.)/.exec(a2))) {
|
|
1887
|
-
if (d2 = /^[BENn[]/.exec(a2)) throw new SyntaxError("Unexpected char ".concat(a2.charAt(0), " in pattern ").concat(e2));
|
|
1888
|
-
a2[0] === "(" && (n2.parens = !0), d2 = [a2[0]], F(d2[0], t2);
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
}
|
|
1892
|
-
m2 = d2[0], a2 = a2.slice(d2 ? d2[0].length : 1);
|
|
1893
|
-
}
|
|
1894
|
-
if (n2.pattern = e2.slice(0, e2.length - a2.length), /^((?:\[[^\]]+\])+)(;|$)/.test(n2.pattern) && !/^\[(?:h+|m+|s+)\]/.test(n2.pattern) && F({ type: "text" }, t2), n2.fractions && n2.dec_fractions || n2.fractions && n2.exponential) throw new SyntaxError("Invalid pattern: ".concat(n2.pattern));
|
|
1895
|
-
const c2 = n2.int_pattern.join("");
|
|
1896
|
-
if (n2.grouping = c2.indexOf(",") >= 0, n2.grouping) {
|
|
1897
|
-
const e3 = c2.split(","), t3 = e3.length;
|
|
1898
|
-
t3 === 2 ? (n2.group_pri = e3[1].length, n2.group_sec = n2.group_pri) : t3 > 2 && (n2.group_pri = e3[t3 - 1].length, n2.group_sec = e3[t3 - 2].length);
|
|
1899
|
-
} else n2.group_pri = 0, n2.group_sec = 0;
|
|
1900
|
-
M(c2.replace(/[,]/g, ""), n2, "int"), M(n2.frac_pattern.join(""), n2, "frac"), M(n2.man_pattern.join(""), n2, "man");
|
|
1901
|
-
let p2 = n2.num_pattern.join(""), f2 = n2.den_pattern.join("");
|
|
1902
|
-
const g2 = /\?/.test(f2) || /\?/.test(p2);
|
|
1903
|
-
return f2 = f2.replace(/\d/g, g2 ? "?" : "#"), g2 && (f2 = f2.replace(/#$/g, "?")), M(p2, n2, "num"), M(f2, n2, "den"), g2 && (p2 = p2.replace(/#$/g, "?")), n2.int_padding = x(n2.int_pattern.join("")), n2.man_padding = x(n2.man_pattern.join("")), n2.num_padding = x(p2), n2.den_padding = x(f2), n2.den_pattern.length && (n2.denominator = parseInt(n2.den_pattern.join("").replace(/\D/g, ""), 10)), n2.integer = !!n2.int_pattern.join("").length, n2.fractions && t2.forEach((e3, n3) => {
|
|
1904
|
-
const a3 = t2[n3 + 1];
|
|
1905
|
-
e3.type === "string" && a3 && (a3.type === "num" ? e3.rule = "num+int" : a3.type === "div" ? e3.rule = "num" : a3.type === "den" && (e3.rule = "den"));
|
|
1906
|
-
}), n2;
|
|
1907
|
-
}
|
|
1908
|
-
__name(z, "z");
|
|
1909
|
-
const w = /* @__PURE__ */ __name((e2) => {
|
|
1910
|
-
const t2 = e2.condition;
|
|
1911
|
-
t2 && t2[1] < 0 && (t2[0] === "<" || t2[0] === "<=" || t2[0] === "=") || e2.tokens.unshift({ type: "minus", volatile: !0 });
|
|
1912
|
-
}, "w");
|
|
1913
|
-
function D(e2) {
|
|
1914
|
-
const t2 = [];
|
|
1915
|
-
let n2, a2 = !1, r2 = null, i2 = e2, s2 = 0, l2 = !1, d2 = 0, m2 = 0;
|
|
1916
|
-
do {
|
|
1917
|
-
if (l2 = z(i2), (l2.date || l2.general) && (l2.int_pattern.length || l2.frac_pattern.length || l2.scale !== 1 || l2.text)) throw new Error("Illegal format");
|
|
1918
|
-
if (l2.condition && (m2++, a2 = !0), l2.text) {
|
|
1919
|
-
if (r2) throw new Error("Unexpected partition");
|
|
1920
|
-
r2 = l2;
|
|
1921
|
-
}
|
|
1922
|
-
l2.locale && (n2 = o(l2.locale)), t2.push(l2), s2 = i2.charAt(l2.pattern.length) === ";" ? 1 : 0, i2 = i2.slice(l2.pattern.length + s2), d2++;
|
|
1923
|
-
} while (s2 && d2 < 4 && m2 < 3);
|
|
1924
|
-
if (s2) throw new Error("Unexpected partition");
|
|
1925
|
-
if (m2 > 2) throw new Error("Unexpected condition");
|
|
1926
|
-
const u2 = t2[3];
|
|
1927
|
-
if (u2 && (u2.int_pattern.length || u2.frac_pattern.length || u2.date)) throw new Error("Unexpected partition");
|
|
1928
|
-
if (a2) {
|
|
1929
|
-
const e3 = t2.length;
|
|
1930
|
-
if (e3 === 1 && (t2[1] = z("General"), t2[1].generated = !0), e3 < 3) {
|
|
1931
|
-
const e4 = t2[0], n3 = t2[1];
|
|
1932
|
-
if (w(e4), n3.condition) w(n3);
|
|
1933
|
-
else {
|
|
1934
|
-
const t3 = e4.condition;
|
|
1935
|
-
(t3[0] === "=" || t3[1] >= 0 && (t3[0] === ">" || t3[0] === ">=")) && n3.tokens.unshift({ type: "minus", volatile: !0 });
|
|
1936
|
-
}
|
|
1937
|
-
} else t2.forEach(w);
|
|
1938
|
-
} else {
|
|
1939
|
-
if (t2.length < 4 && r2) for (let e3 = 0, n3 = t2.length; e3 < n3; e3++) t2[e3] === r2 && t2.splice(e3, 1);
|
|
1940
|
-
if (t2.length < 1 && r2 && (t2[0] = z("General"), t2[0].generated = !0), t2.length < 2) {
|
|
1941
|
-
const e3 = z(t2[0].pattern);
|
|
1942
|
-
e3.tokens.unshift({ type: "minus", volatile: !0 }), e3.generated = !0, t2.push(e3);
|
|
1943
|
-
}
|
|
1944
|
-
if (t2.length < 3) {
|
|
1945
|
-
const e3 = z(t2[0].pattern);
|
|
1946
|
-
e3.generated = !0, t2.push(e3);
|
|
1947
|
-
}
|
|
1948
|
-
if (t2.length < 4) if (r2) t2.push(r2);
|
|
1949
|
-
else {
|
|
1950
|
-
const e3 = z("@");
|
|
1951
|
-
e3.generated = !0, t2.push(e3);
|
|
1952
|
-
}
|
|
1953
|
-
t2[0].condition = [">", 0], t2[1].condition = ["<", 0], t2[2].condition = null;
|
|
1954
|
-
}
|
|
1955
|
-
return { pattern: e2, partitions: t2, locale: n2 };
|
|
1956
|
-
}
|
|
1957
|
-
__name(D, "D");
|
|
1958
|
-
const S = Math.floor;
|
|
1959
|
-
function C(e2) {
|
|
1960
|
-
if ((!(arguments.length > 1 && arguments[1] !== void 0) || arguments[1]) && e2 >= 0) {
|
|
1961
|
-
if (e2 === 0) return [1900, 1, 0];
|
|
1962
|
-
if (e2 === 60) return [1900, 2, 29];
|
|
1963
|
-
if (e2 < 60) return [1900, e2 < 32 ? 1 : 2, (e2 - 1) % 31 + 1];
|
|
1964
|
-
}
|
|
1965
|
-
let n2 = e2 + 68569 + 2415019;
|
|
1966
|
-
const a2 = S(4 * n2 / 146097);
|
|
1967
|
-
n2 -= S((146097 * a2 + 3) / 4);
|
|
1968
|
-
const r2 = S(4e3 * (n2 + 1) / 1461001);
|
|
1969
|
-
n2 = n2 - S(1461 * r2 / 4) + 31;
|
|
1970
|
-
const i2 = S(80 * n2 / 2447), s2 = n2 - S(2447 * i2 / 80);
|
|
1971
|
-
n2 = S(i2 / 11);
|
|
1972
|
-
const o2 = i2 + 2 - 12 * n2;
|
|
1973
|
-
return [0 | 100 * (a2 - 49) + r2 + n2, 0 | o2, 0 | s2];
|
|
1974
|
-
}
|
|
1975
|
-
__name(C, "C");
|
|
1976
|
-
function E(e2) {
|
|
1977
|
-
return C(e2 + 1462);
|
|
1978
|
-
}
|
|
1979
|
-
__name(E, "E");
|
|
1980
|
-
function A(e2) {
|
|
1981
|
-
if (e2 === 60) throw new Error("#VALUE!");
|
|
1982
|
-
if (e2 <= 1) return [1317, 8, 29];
|
|
1983
|
-
if (e2 < 60) return [1317, e2 < 32 ? 9 : 10, 1 + (e2 - 2) % 30];
|
|
1984
|
-
const t2 = 10631 / 30, n2 = 0.1335;
|
|
1985
|
-
let a2 = e2 + 466935;
|
|
1986
|
-
const r2 = S(a2 / 10631);
|
|
1987
|
-
a2 -= 10631 * r2;
|
|
1988
|
-
const i2 = S((a2 - n2) / t2);
|
|
1989
|
-
a2 -= S(i2 * t2 + n2);
|
|
1990
|
-
const s2 = S((a2 + 28.5001) / 29.5);
|
|
1991
|
-
return s2 === 13 ? [30 * r2 + i2, 12, 30] : [30 * r2 + i2, s2, a2 - S(29.5001 * s2 - 29)];
|
|
1992
|
-
}
|
|
1993
|
-
__name(A, "A");
|
|
1994
|
-
function Y(e2) {
|
|
1995
|
-
let t2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n2 = !(arguments.length > 2 && arguments[2] !== void 0) || arguments[2];
|
|
1996
|
-
const a2 = S(e2);
|
|
1997
|
-
return t2 === 6 ? A(a2) : t2 === -1 ? E(a2) : C(a2, n2);
|
|
1998
|
-
}
|
|
1999
|
-
__name(Y, "Y");
|
|
2000
|
-
const T = Math.floor, N = 86400;
|
|
2001
|
-
function P(e2, t2) {
|
|
2002
|
-
let n2 = null;
|
|
2003
|
-
if (Array.isArray(e2)) {
|
|
2004
|
-
const [t3, a2, r2, i2, s2, o2] = e2;
|
|
2005
|
-
n2 = Date.UTC(t3, a2 == null ? 0 : a2 - 1, r2 != null ? r2 : 1, i2 || 0, s2 || 0, o2 || 0);
|
|
2006
|
-
} else if (e2 instanceof Date && (n2 = 1 * e2, !t2 || !t2.ignoreTimezone)) {
|
|
2007
|
-
const t3 = /* @__PURE__ */ new Date();
|
|
2008
|
-
t3.setUTCFullYear(e2.getFullYear(), e2.getMonth(), e2.getDate()), t3.setUTCHours(e2.getHours(), e2.getMinutes(), e2.getSeconds(), e2.getMilliseconds()), n2 = 1 * t3;
|
|
2009
|
-
}
|
|
2010
|
-
if (n2 != null && isFinite(n2)) {
|
|
2011
|
-
const e3 = n2 / 864e5;
|
|
2012
|
-
return e3 - (e3 <= -25509 ? -25568 : -25569);
|
|
2013
|
-
}
|
|
2014
|
-
return e2;
|
|
2015
|
-
}
|
|
2016
|
-
__name(P, "P");
|
|
2017
|
-
function I(e2, t2) {
|
|
2018
|
-
let n2 = 0 | e2;
|
|
2019
|
-
const a2 = N * (e2 - n2);
|
|
2020
|
-
let r2 = T(a2);
|
|
2021
|
-
a2 - r2 > 0.9999 && (r2 += 1, r2 === N && (r2 = 0, n2 += 1));
|
|
2022
|
-
const i2 = r2 < 0 ? N + r2 : r2, [s2, o2, l2] = Y(e2, 0, t2 && t2.leap1900), d2 = T(i2 / 60 / 60) % 60, m2 = T(i2 / 60) % 60, u2 = T(i2) % 60;
|
|
2023
|
-
if (t2 && t2.nativeDate) {
|
|
2024
|
-
const e3 = /* @__PURE__ */ new Date(0);
|
|
2025
|
-
return e3.setUTCFullYear(s2, o2 - 1, l2), e3.setUTCHours(d2, m2, u2), e3;
|
|
2026
|
-
}
|
|
2027
|
-
return [s2, o2, l2, d2, m2, u2];
|
|
2028
|
-
}
|
|
2029
|
-
__name(I, "I");
|
|
2030
|
-
function O(e2) {
|
|
2031
|
-
return !!(e2[0] && e2[0].percent || e2[1] && e2[1].percent || e2[2] && e2[2].percent || e2[3] && e2[3].percent);
|
|
2032
|
-
}
|
|
2033
|
-
__name(O, "O");
|
|
2034
|
-
function J(e2) {
|
|
2035
|
-
return !!(e2[0] && e2[0].date || e2[1] && e2[1].date || e2[2] && e2[2].date || e2[3] && e2[3].date);
|
|
2036
|
-
}
|
|
2037
|
-
__name(J, "J");
|
|
2038
|
-
function L(e2) {
|
|
2039
|
-
const [t2, n2, a2, r2] = e2;
|
|
2040
|
-
return !(t2 && !t2.generated || n2 && !n2.generated || a2 && !a2.generated || !r2 || !r2.text || r2.generated);
|
|
2041
|
-
}
|
|
2042
|
-
__name(L, "L");
|
|
2043
|
-
const U = { text: 15, datetime: 10.8, date: 10.8, time: 10.8, percent: 10.6, currency: 10.4, grouped: 10.2, scientific: 6, number: 4, fraction: 2, general: 0, error: 0 }, R = [["DMY", 1], ["DM", 2], ["MY", 3], ["MDY", 4], ["MD", 5], ["hmsa", 6], ["hma", 7], ["hms", 8], ["hm", 9]], G = { total: 1, sign: 0, period: 0, int: 1, frac: 0 }, H = /* @__PURE__ */ __name((e2, t2) => e2.replace(/\./, t2.decimal), "H");
|
|
2044
|
-
function B(e2, t2, n2, a2) {
|
|
2045
|
-
const r2 = 0 | n2;
|
|
2046
|
-
if (typeof n2 == "string") e2.push(n2);
|
|
2047
|
-
else if (n2 === r2) e2.push(Math.abs(r2));
|
|
2048
|
-
else {
|
|
2049
|
-
const t3 = Math.abs(n2);
|
|
2050
|
-
let r3 = t3 ? Math.floor(Math.log10(t3)) : 0, i2 = r3 < 0 ? t3 * 10 ** -r3 : t3 / 10 ** r3;
|
|
2051
|
-
i2 === 10 && (i2 = 1, r3++);
|
|
2052
|
-
const s2 = function(e3) {
|
|
2053
|
-
let t4 = !(arguments.length > 1 && arguments[1] !== void 0) || arguments[1];
|
|
2054
|
-
const n3 = Math.abs(e3);
|
|
2055
|
-
if (!n3) return G;
|
|
2056
|
-
const a3 = t4 && e3 < 0 ? 1 : 0, r4 = Math.floor(n3), i3 = Math.floor(Math.log10(n3) + 1);
|
|
2057
|
-
let s3 = 0, o3 = 0;
|
|
2058
|
-
if (r4 !== n3) {
|
|
2059
|
-
s3 = 1;
|
|
2060
|
-
const e4 = String(c(i3 < 0 ? n3 * 10 ** -i3 : n3 / 10 ** i3, 15));
|
|
2061
|
-
let t5 = e4.length, a4 = !0, r5 = 0;
|
|
2062
|
-
for (; r5 <= e4.length; ) {
|
|
2063
|
-
if (e4[r5] === ".") {
|
|
2064
|
-
t5--;
|
|
2065
|
-
break;
|
|
2066
|
-
}
|
|
2067
|
-
e4[r5] === "0" && a4 ? t5-- : a4 = !1, r5++;
|
|
2068
|
-
}
|
|
2069
|
-
o3 = t5 - i3, o3 < 0 && (o3 = 0, s3 = 0);
|
|
2070
|
-
}
|
|
2071
|
-
return { total: a3 + Math.max(i3, 1) + s3 + o3, digits: Math.max(i3, 0) + o3, sign: a3, period: s3, int: Math.max(i3, 1), frac: o3 };
|
|
2072
|
-
}(t3), o2 = /* @__PURE__ */ __name(() => {
|
|
2073
|
-
const t4 = Math.abs(r3);
|
|
2074
|
-
let n3;
|
|
2075
|
-
n3 = i2 === 1 ? i2 : c(i2, 5), e2.push(H(n3 + "", a2), a2.exponent, r3 < 0 ? a2.negative : a2.positive, t4 < 10 ? "0" : "", t4);
|
|
2076
|
-
}, "o");
|
|
2077
|
-
if (r3 >= -4 && r3 <= -1) {
|
|
2078
|
-
const n3 = t3.toPrecision(10 + r3).replace(/\.?0+$/, "");
|
|
2079
|
-
e2.push(H(n3, a2));
|
|
2080
|
-
} else if (r3 === 10) {
|
|
2081
|
-
const n3 = t3.toFixed(10).slice(0, 12).replace(/\.$/, "");
|
|
2082
|
-
e2.push(H(n3, a2));
|
|
2083
|
-
} else if (Math.abs(r3) <= 9) if (s2.total <= 11) {
|
|
2084
|
-
const n3 = c(t3, 9).toFixed(s2.frac);
|
|
2085
|
-
e2.push(H(n3, a2));
|
|
2086
|
-
} else r3 === 9 ? e2.push(Math.floor(t3)) : r3 >= 0 && r3 < 9 ? e2.push(c(t3, 9 - r3)) : o2();
|
|
2087
|
-
else s2.total >= 12 ? o2() : Math.floor(t3) === t3 ? e2.push(Math.floor(t3)) : e2.push(H(c(t3, 9).toFixed(s2.frac), a2));
|
|
2088
|
-
}
|
|
2089
|
-
return e2;
|
|
2090
|
-
}
|
|
2091
|
-
__name(B, "B");
|
|
2092
|
-
const $ = 86400, W = { int: "integer", frac: "fraction", man: "mantissa", num: "numerator", den: "denominator" }, Z = /* @__PURE__ */ __name(function(e2) {
|
|
2093
|
-
let t2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
2094
|
-
const n2 = Math.floor(Math.log10(e2));
|
|
2095
|
-
return t2 > 1 ? Math.floor(n2 / t2) * t2 : n2;
|
|
2096
|
-
}, "Z");
|
|
2097
|
-
function K(e2, t2, n2, a2) {
|
|
2098
|
-
let r2 = "", i2 = "", s2 = "", o2 = "", l2 = "", d2 = 0, m2 = 0 | e2, f2 = 0, g2 = 0, h2 = 1, _2 = 0, b2 = 0, j2 = 0, v2 = 0, M2 = 0, k2 = 0;
|
|
2099
|
-
const x2 = a2 || u;
|
|
2100
|
-
if (!t2.text && isFinite(t2.scale) && t2.scale !== 1 && (e2 = function(e3) {
|
|
2101
|
-
if (e3 === 0) return e3;
|
|
2102
|
-
const t3 = Math.ceil(Math.log10(e3 < 0 ? -e3 : e3)), n3 = 10 ** (16 - Math.floor(t3));
|
|
2103
|
-
return Math.round(e3 * n3) / n3;
|
|
2104
|
-
}(e2 * t2.scale)), t2.exponential) {
|
|
2105
|
-
let n3 = Math.abs(e2);
|
|
2106
|
-
if (n3) {
|
|
2107
|
-
const e3 = 10 ** -Z(n3, t2.int_max), a3 = c(n3 * e3, t2.frac_max) / e3;
|
|
2108
|
-
d2 = Z(a3, t2.int_max);
|
|
2109
|
-
}
|
|
2110
|
-
n3 /= 10 ** d2, e2 = e2 < 0 ? -n3 : n3, r2 += Math.abs(d2);
|
|
2111
|
-
}
|
|
2112
|
-
if (t2.integer) {
|
|
2113
|
-
const n3 = Math.abs(c(e2, t2.fractions ? 1 : t2.frac_max));
|
|
2114
|
-
l2 += n3 < 1 ? "" : Math.floor(n3);
|
|
2115
|
-
}
|
|
2116
|
-
if (t2.grouping) {
|
|
2117
|
-
let e3 = "", n3 = l2.length;
|
|
2118
|
-
for (n3 > t2.group_pri && (n3 -= t2.group_pri, e3 = x2.group + l2.slice(n3, n3 + t2.group_pri) + e3); n3 > t2.group_sec; ) n3 -= t2.group_sec, e3 = x2.group + l2.slice(n3, n3 + t2.group_sec) + e3;
|
|
2119
|
-
l2 = n3 ? l2.slice(0, n3) + e3 : e3;
|
|
2120
|
-
}
|
|
2121
|
-
t2.dec_fractions && (o2 = String(c(e2, t2.frac_max)).split(".")[1] || "");
|
|
2122
|
-
let F2 = !1;
|
|
2123
|
-
if (t2.fractions) {
|
|
2124
|
-
const n3 = Math.abs(t2.integer ? e2 % 1 : e2);
|
|
2125
|
-
if (n3) if (F2 = !0, isFinite(t2.denominator)) s2 += t2.denominator, i2 += c(n3 * t2.denominator), i2 === "0" && (i2 = "", s2 = "", F2 = !1, l2 || (l2 = "0"));
|
|
2126
|
-
else {
|
|
2127
|
-
const e3 = p(n3, t2.integer ? t2.num_max : 1 / 0, t2.den_max);
|
|
2128
|
-
i2 += e3[0], s2 += e3[1], t2.integer && i2 === "0" && (l2 || (l2 = "0"), i2 = "", s2 = "", F2 = !1);
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
if (t2.date) {
|
|
2132
|
-
m2 = Math.trunc(e2);
|
|
2133
|
-
const a3 = $ * (e2 - m2);
|
|
2134
|
-
if (f2 = Math.floor(a3), k2 = a3 - f2, Math.abs(k2) < 1e-6 ? k2 = 0 : k2 > 0.9999 && (k2 = 0, f2 += 1, f2 === $ && (f2 = 0, m2 += 1)), k2) {
|
|
2135
|
-
const e3 = 512 & t2.date || 256 & t2.date || 128 & t2.date;
|
|
2136
|
-
(e3 === 512 && k2 > 0.9995 || e3 === 256 && k2 > 0.995 || e3 === 128 && k2 > 0.95 || !e3 && k2 >= 0.5) && (f2++, k2 = 0);
|
|
2137
|
-
}
|
|
2138
|
-
if (m2 || t2.date_system) {
|
|
2139
|
-
const a4 = Y(e2, t2.date_system, n2.leap1900);
|
|
2140
|
-
g2 = a4[0], h2 = a4[1], _2 = a4[2];
|
|
2141
|
-
}
|
|
2142
|
-
if (f2) {
|
|
2143
|
-
const e3 = f2 < 0 ? $ + f2 : f2;
|
|
2144
|
-
M2 = Math.floor(e3) % 60, v2 = Math.floor(e3 / 60) % 60, j2 = Math.floor(e3 / 60 / 60) % 60;
|
|
2145
|
-
}
|
|
2146
|
-
if (b2 = (6 + m2) % 7, t2.date_eval && (z2 = e2, w2 = m2 + f2 / $, n2.dateSpanLarge ? z2 < -694324 || w2 >= 35830291 : z2 < 0 || w2 >= 2958466)) {
|
|
2147
|
-
if (n2.dateErrorThrows) throw new Error("Date out of bounds");
|
|
2148
|
-
return n2.dateErrorNumber ? B(e2 < 0 ? [x2.negative] : [], 0, e2, x2).join("") : n2.overflow;
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
var z2, w2;
|
|
2152
|
-
if (t2.int_padding && (l2 = t2.int_padding.length === 1 ? l2 || t2.int_padding : t2.int_padding.substring(0, t2.int_padding.length - l2.length) + l2), t2.num_padding && (i2 = t2.num_padding.length === 1 ? i2 || t2.num_padding : t2.num_padding.substring(0, t2.num_padding.length - i2.length) + i2), t2.den_padding && (s2 = t2.den_padding.length === 1 ? s2 || t2.den_padding : s2 + t2.den_padding.slice(s2.length)), t2.man_padding) {
|
|
2153
|
-
const e3 = t2.exp_plus ? "+" : "";
|
|
2154
|
-
r2 = t2.man_padding.length === 1 ? (d2 < 0 ? "-" : e3) + (r2 || t2.man_padding) : (d2 < 0 ? "-" : e3) + t2.man_padding.slice(0, t2.man_padding.length - r2.length) + r2;
|
|
2155
|
-
}
|
|
2156
|
-
const D2 = [];
|
|
2157
|
-
let S2 = 0;
|
|
2158
|
-
const C2 = { int: 0, frac: 0, man: 0, num: 0, den: 0 };
|
|
2159
|
-
for (let d3 = 0, u2 = t2.tokens.length; d3 < u2; d3++) {
|
|
2160
|
-
const u3 = t2.tokens[d3], c2 = u3.num ? u3.num.length : 0;
|
|
2161
|
-
if (u3.type === "string") u3.rule ? u3.rule === "num" ? F2 ? D2.push(u3.value) : (t2.num_min > 0 || t2.den_min > 0) && D2.push(u3.value.replace(/./g, y["?"])) : u3.rule === "num+int" ? F2 && l2 ? D2.push(u3.value) : t2.den_min > 0 && (l2 || t2.num_min) && D2.push(u3.value.replace(/./g, y["?"])) : u3.rule === "den" && (F2 ? D2.push(u3.value) : (t2.den_min > 0 || t2.den_min > 0) && D2.push(u3.value.replace(/./g, y["?"]))) : D2.push(u3.value);
|
|
2162
|
-
else if (u3.type === "error") D2.push(n2.invalid);
|
|
2163
|
-
else if (u3.type === "point") D2.push(t2.date ? u3.value : x2.decimal);
|
|
2164
|
-
else if (u3.type === "general") B(D2, 0, e2, x2);
|
|
2165
|
-
else if (u3.type === "exp") D2.push(x2.exponent);
|
|
2166
|
-
else if (u3.type === "minus") u3.volatile && t2.date || u3.volatile && (e2 >= 0 || typeof e2 != "number") || (u3.volatile && !t2.fractions && (t2.integer || t2.dec_fractions) ? (e2 < 0 && l2 && l2 !== "0" || o2) && D2.push(x2.negative) : D2.push(x2.negative));
|
|
2167
|
-
else if (u3.type === "plus") D2.push(x2.positive);
|
|
2168
|
-
else if (u3.type === "text") D2.push(e2);
|
|
2169
|
-
else if (u3.type === "div") F2 ? D2.push("/") : t2.num_min > 0 || t2.den_min > 0 ? D2.push(y["?"]) : D2.push(y["#"]);
|
|
2170
|
-
else if (u3.type === "int") if (t2.int_pattern.length === 1) D2.push(l2);
|
|
2171
|
-
else {
|
|
2172
|
-
const e3 = S2 ? t2.int_pattern.join("").length - C2.int : 1 / 0, n3 = S2 === t2.int_pattern.length - 1 ? 0 : t2.int_pattern.join("").length - (C2.int + u3.num.length);
|
|
2173
|
-
D2.push(l2.substring(l2.length - e3, l2.length - n3)), S2++, C2.int += u3.num.length;
|
|
2174
|
-
}
|
|
2175
|
-
else if (u3.type === "frac") {
|
|
2176
|
-
const e3 = C2.frac;
|
|
2177
|
-
for (let t3 = 0; t3 < c2; t3++) D2.push(o2[t3 + e3] || y[u3.num[t3]]);
|
|
2178
|
-
C2.frac += c2;
|
|
2179
|
-
} else if (u3.type in W) t2[u3.type + "_pattern"].length === 1 ? (u3.type === "int" && D2.push(l2), u3.type === "frac" && D2.push(o2), u3.type === "man" && D2.push(r2), u3.type === "num" && D2.push(i2), u3.type === "den" && D2.push(s2)) : (D2.push(W[u3.type].slice(C2[u3.type], C2[u3.type] + c2)), C2[u3.type] += c2);
|
|
2180
|
-
else if (u3.type === "year") g2 < 0 && D2.push(x2.negative), D2.push(String(Math.abs(g2)).padStart(4, "0"));
|
|
2181
|
-
else if (u3.type === "year-short") {
|
|
2182
|
-
const e3 = g2 % 100;
|
|
2183
|
-
D2.push(e3 < 10 ? "0" : "", e3);
|
|
2184
|
-
} else if (u3.type === "month") D2.push(u3.pad && h2 < 10 ? "0" : "", h2);
|
|
2185
|
-
else if (u3.type === "monthname-single") t2.date_system === 6 ? D2.push(x2.mmmm6[h2 - 1].charAt(0)) : D2.push(x2.mmmm[h2 - 1].charAt(0));
|
|
2186
|
-
else if (u3.type === "monthname-short") t2.date_system === 6 ? D2.push(x2.mmm6[h2 - 1]) : D2.push(x2.mmm[h2 - 1]);
|
|
2187
|
-
else if (u3.type === "monthname") t2.date_system === 6 ? D2.push(x2.mmmm6[h2 - 1]) : D2.push(x2.mmmm[h2 - 1]);
|
|
2188
|
-
else if (u3.type === "weekday-short") D2.push(x2.ddd[b2]);
|
|
2189
|
-
else if (u3.type === "weekday") D2.push(x2.dddd[b2]);
|
|
2190
|
-
else if (u3.type === "day") D2.push(u3.pad && _2 < 10 ? "0" : "", _2);
|
|
2191
|
-
else if (u3.type === "hour") {
|
|
2192
|
-
const e3 = j2 % t2.clock || (t2.clock < 24 ? t2.clock : 0);
|
|
2193
|
-
D2.push(u3.pad && e3 < 10 ? "0" : "", e3);
|
|
2194
|
-
} else if (u3.type === "min") D2.push(u3.pad && v2 < 10 ? "0" : "", v2);
|
|
2195
|
-
else if (u3.type === "sec") D2.push(u3.pad && M2 < 10 ? "0" : "", M2);
|
|
2196
|
-
else if (u3.type === "subsec") {
|
|
2197
|
-
D2.push(x2.decimal);
|
|
2198
|
-
const e3 = k2.toFixed(t2.sec_decimals);
|
|
2199
|
-
D2.push(e3.slice(2, 2 + u3.decimals));
|
|
2200
|
-
} else if (u3.type === "am") {
|
|
2201
|
-
const e3 = j2 < 12 ? 0 : 1;
|
|
2202
|
-
u3.short && !a2 ? D2.push("AP"[e3]) : D2.push(x2.ampm[e3]);
|
|
2203
|
-
} else if (u3.type === "hour-elap") {
|
|
2204
|
-
e2 < 0 && D2.push(x2.negative);
|
|
2205
|
-
const t3 = 24 * m2 + Math.floor(Math.abs(f2) / 3600);
|
|
2206
|
-
D2.push(String(Math.abs(t3)).padStart(u3.pad, "0"));
|
|
2207
|
-
} else if (u3.type === "min-elap") {
|
|
2208
|
-
e2 < 0 && D2.push(x2.negative);
|
|
2209
|
-
const t3 = 1440 * m2 + Math.floor(Math.abs(f2) / 60);
|
|
2210
|
-
D2.push(String(Math.abs(t3)).padStart(u3.pad, "0"));
|
|
2211
|
-
} else if (u3.type === "sec-elap") {
|
|
2212
|
-
e2 < 0 && D2.push(x2.negative);
|
|
2213
|
-
const t3 = m2 * $ + Math.abs(f2);
|
|
2214
|
-
D2.push(String(Math.abs(t3)).padStart(u3.pad, "0"));
|
|
2215
|
-
} else if (u3.type === "b-year") D2.push(g2 + 543);
|
|
2216
|
-
else if (u3.type === "b-year-short") {
|
|
2217
|
-
const e3 = (g2 + 543) % 100;
|
|
2218
|
-
D2.push(e3 < 10 ? "0" : "", e3);
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
return n2.nbsp ? D2.join("") : D2.join("").replace(/\u00a0/g, " ");
|
|
2222
|
-
}
|
|
2223
|
-
__name(K, "K");
|
|
2224
|
-
function q(e2, t2) {
|
|
2225
|
-
for (let n2 = 0; n2 < 3; n2++) {
|
|
2226
|
-
const a2 = t2[n2];
|
|
2227
|
-
if (a2) {
|
|
2228
|
-
let t3;
|
|
2229
|
-
if (a2.condition) {
|
|
2230
|
-
const n3 = a2.condition[0], r2 = a2.condition[1];
|
|
2231
|
-
n3 === "=" ? t3 = e2 === r2 : n3 === ">" ? t3 = e2 > r2 : n3 === "<" ? t3 = e2 < r2 : n3 === ">=" ? t3 = e2 >= r2 : n3 === "<=" ? t3 = e2 <= r2 : n3 === "<>" && (t3 = e2 !== r2);
|
|
2232
|
-
} else t3 = !0;
|
|
2233
|
-
if (t3) return a2;
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
__name(q, "q");
|
|
2238
|
-
const V = z("@"), Q = "black", X = {};
|
|
2239
|
-
function ee(e2, t2) {
|
|
2240
|
-
if (e2) {
|
|
2241
|
-
const n2 = e2[0];
|
|
2242
|
-
t2[n2] = t2[n2] || {}, ee(e2.slice(1), t2[n2]);
|
|
2243
|
-
} else t2.$ = !0;
|
|
2244
|
-
}
|
|
2245
|
-
__name(ee, "ee"), ["d-F-y", "d-F-Y", "d-M-y", "d-M-Y", "F-d-y", "F-d-Y", "F-j-y", "F-j-Y", "j-F-y", "j-F-Y", "j-M-y", "j-M-Y", "M-d-y", "M-d-Y", "M-j-y", "M-j-Y", "m-d-y", "m-d-Y", "m-j-y", "m-j-Y", "n-d-y", "n-d-Y", "n-j-y", "n-j-Y", "y-F-d", "y-F-j", "y-M-d", "y-M-j", "Y-F-d", "Y-F-j", "Y-M-d", "Y-m-d", "Y-M-j", "Y-m-j", "Y-n-d", "Y-n-j", "j-F", "j-M", "d-F", "d-M", "n-d", "n-j", "n-Y", "m-d", "m-j", "m-Y", "M-Y", "M-y", "F-y", "F-Y", "Y-M", "Y-n", "Y-m", "Y-F", "Y-M"].forEach((e2) => {
|
|
2246
|
-
ee(e2, X), ee(e2 + " x", X), ee(e2 + " l", X), ee(e2 + " l x", X), ee("l " + e2, X), ee("l " + e2 + " x", X), ee(e2 + " D", X), ee(e2 + " D x", X), ee("D " + e2, X), ee("D " + e2 + " x", X);
|
|
2247
|
-
});
|
|
2248
|
-
const te = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 }, ne = { january: 1, february: 2, march: 3, april: 4, june: 6, july: 7, august: 8, september: 9, october: 10, november: 11, december: 12 }, ae = { sunday: "l", monday: "l", tuesday: "l", wednesday: "l", thursday: "l", friday: "l", saturday: "l", sun: "D", mon: "D", tue: "D", wed: "D", thu: "D", fri: "D", sat: "D" }, re = (/* @__PURE__ */ new Date()).getUTCFullYear();
|
|
2249
|
-
function ie(e2) {
|
|
2250
|
-
const t2 = new RegExp("^([\\s+%" + j.join("") + "(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%" + j.join("") + ")]*)$").exec(e2);
|
|
2251
|
-
if (t2) {
|
|
2252
|
-
const [, e3, n2, a2, r2, i2] = t2;
|
|
2253
|
-
let s2 = 1, o2 = "", l2 = !1, d2 = !1, m2 = !1, u2 = !1, c2 = !1, p2 = null, f2 = !1, g2 = parseFloat(n2.replace(/,/g, ""));
|
|
2254
|
-
if (!isFinite(g2)) return null;
|
|
2255
|
-
for (let t3 = 0; t3 < e3.length; t3++) {
|
|
2256
|
-
const n3 = e3[t3];
|
|
2257
|
-
if (n3 === "-") {
|
|
2258
|
-
if (l2 || d2) return null;
|
|
2259
|
-
l2 = !0, s2 = -1;
|
|
2260
|
-
} else if (v.test(n3)) {
|
|
2261
|
-
if (c2) return null;
|
|
2262
|
-
c2 = !0, p2 = n3;
|
|
2263
|
-
} else if (n3 === "(") {
|
|
2264
|
-
if (d2 || l2) return null;
|
|
2265
|
-
d2 = !0, s2 = -1;
|
|
2266
|
-
} else if (n3 === "%") {
|
|
2267
|
-
if (u2) return null;
|
|
2268
|
-
u2 = !0;
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
for (let e4 = 0; e4 < i2.length; e4++) {
|
|
2272
|
-
const t3 = i2[e4];
|
|
2273
|
-
if (v.test(t3)) {
|
|
2274
|
-
if (c2) return null;
|
|
2275
|
-
c2 = !0, p2 = t3, f2 = !0;
|
|
2276
|
-
} else if (t3 === ")") {
|
|
2277
|
-
if (m2 || !d2) return null;
|
|
2278
|
-
m2 = !0;
|
|
2279
|
-
} else if (t3 === "%") {
|
|
2280
|
-
if (u2) return null;
|
|
2281
|
-
u2 = !0;
|
|
2282
|
-
}
|
|
2283
|
-
}
|
|
2284
|
-
if (r2) {
|
|
2285
|
-
if (u2 || c2) return null;
|
|
2286
|
-
o2 = "0.00E+00";
|
|
2287
|
-
} else if (u2) {
|
|
2288
|
-
if (c2) return null;
|
|
2289
|
-
o2 = a2.includes(".") ? "0.00%" : "0%", g2 *= 0.01;
|
|
2290
|
-
} else if (c2) {
|
|
2291
|
-
const e4 = a2.includes(".") ? "#,##0.00" : "#,##0";
|
|
2292
|
-
o2 = f2 ? e4 + p2 : p2 + e4;
|
|
2293
|
-
} else a2.includes(",") && (o2 = a2.includes(".") ? "#,##0.00" : "#,##0");
|
|
2294
|
-
const h2 = { v: g2 * s2 };
|
|
2295
|
-
return o2 && (h2.z = o2), h2;
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
__name(ie, "ie");
|
|
2299
|
-
const se = /* @__PURE__ */ __name((e2, t2, n2) => {
|
|
2300
|
-
const a2 = n2.path || "", r2 = Object.keys(t2);
|
|
2301
|
-
for (let i2 = 0; i2 < r2.length; i2++) {
|
|
2302
|
-
let s2;
|
|
2303
|
-
const o2 = r2[i2];
|
|
2304
|
-
if (t2[o2]) {
|
|
2305
|
-
if (o2 === "$" || o2 === "€") e2 || (s2 = n2);
|
|
2306
|
-
else if (o2 === "-") {
|
|
2307
|
-
const r3 = /^(\s*([./-]|,\s)\s*|\s+)/.exec(e2);
|
|
2308
|
-
if (r3) {
|
|
2309
|
-
const i3 = r3[1] === "-" || r3[1] === "/" || r3[1] === "." ? r3[1] : " ";
|
|
2310
|
-
if (!n2.sep || n2.sep === i3) {
|
|
2311
|
-
const l2 = r3[0].replace(/\s+/g, " ");
|
|
2312
|
-
s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, sep: i3, path: a2 + l2 });
|
|
2313
|
-
}
|
|
2314
|
-
}
|
|
2315
|
-
} else if (o2 === " ") {
|
|
2316
|
-
const r3 = /^[,.]?\s+/.exec(e2);
|
|
2317
|
-
if (r3) {
|
|
2318
|
-
const i3 = r3[0].replace(/\s+/g, " ");
|
|
2319
|
-
s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, path: a2 + i3 });
|
|
2320
|
-
}
|
|
2321
|
-
} else if (o2 === "j" || o2 === "d") {
|
|
2322
|
-
const r3 = /^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e2);
|
|
2323
|
-
r3 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, day: r3[0], path: a2 + o2 }));
|
|
2324
|
-
} else if (o2 === "n" || o2 === "m") {
|
|
2325
|
-
const r3 = /^(0?[1-9]|1[012])\b/.exec(e2);
|
|
2326
|
-
r3 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, month: +r3[0], _mon: r3[0], path: a2 + o2 }));
|
|
2327
|
-
} else if (o2 === "F" || o2 === "M") {
|
|
2328
|
-
const r3 = /^([a-z]{3,9})\b/i.exec(e2), i3 = r3 && (o2 === "F" ? ne : te)[r3[0].toLowerCase()];
|
|
2329
|
-
i3 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, month: i3, _mon: r3[0], path: a2 + o2 }));
|
|
2330
|
-
} else if (o2 === "l" || o2 === "D") {
|
|
2331
|
-
const r3 = /^([a-z]{3,9})\b/i.exec(e2);
|
|
2332
|
-
(r3 && ae[r3[0].toLowerCase()]) === o2 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, path: a2 + o2 }));
|
|
2333
|
-
} else if (o2 === "y") {
|
|
2334
|
-
const r3 = /^\d\d\b/.exec(e2);
|
|
2335
|
-
if (r3) {
|
|
2336
|
-
const i3 = +r3[0] >= 30 ? +r3[0] + 1900 : +r3[0] + 2e3;
|
|
2337
|
-
s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, year: i3, path: a2 + o2 });
|
|
2338
|
-
}
|
|
2339
|
-
} else if (o2 === "Y") {
|
|
2340
|
-
const r3 = /^\d\d\d\d\b/.exec(e2);
|
|
2341
|
-
r3 && (s2 = se(e2.slice(r3[0].length), t2[o2], { ...n2, year: +r3[0], path: a2 + o2 }));
|
|
2342
|
-
} else {
|
|
2343
|
-
if (o2 !== "x") throw new Error('Unknown date token "'.concat(o2, '"'));
|
|
2344
|
-
{
|
|
2345
|
-
const r3 = le(e2);
|
|
2346
|
-
r3 && (s2 = se("", t2[o2], { ...n2, time: r3.v, tf: r3.z, path: a2 + o2 }));
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
if (s2) return s2;
|
|
2350
|
-
}
|
|
2351
|
-
}
|
|
2352
|
-
}, "se");
|
|
2353
|
-
function oe(e2, t2) {
|
|
2354
|
-
const n2 = se(e2.trim(), X, { path: "" });
|
|
2355
|
-
if (n2) {
|
|
2356
|
-
var a2;
|
|
2357
|
-
if (n2.sep === "." && n2.path.length === 3) return null;
|
|
2358
|
-
const e3 = +((a2 = n2.year) !== null && a2 !== void 0 ? a2 : re);
|
|
2359
|
-
if (n2.day || (n2.day = 1), !function(e4, t3, n3) {
|
|
2360
|
-
if (n3 < 1 || t3 < 1 || t3 > 12) return !1;
|
|
2361
|
-
if (t3 === 2) {
|
|
2362
|
-
if (n3 > (e4 % 4 == 0 && e4 % 100 != 0 || e4 % 400 == 0 || e4 === 1900 ? 29 : 28)) return !1;
|
|
2363
|
-
} else if ((t3 === 4 || t3 === 6 || t3 === 9 || t3 === 11) && n3 > 30 || (t3 === 1 || t3 === 3 || t3 === 5 || t3 === 7 || t3 === 8 || t3 === 10 || t3 === 12) && n3 > 31) return !1;
|
|
2364
|
-
return !0;
|
|
2365
|
-
}(e3, n2.month, n2.day)) return null;
|
|
2366
|
-
let r2 = -1 / 0;
|
|
2367
|
-
if (e3 < 1900) return null;
|
|
2368
|
-
e3 <= 1900 && n2.month <= 2 ? r2 = 25568 : e3 < 1e4 && (r2 = 25569);
|
|
2369
|
-
const i2 = Date.UTC(e3, n2.month - 1, n2.day) / 864e5 + r2 + (n2.time || 0);
|
|
2370
|
-
if (i2 >= 0 && i2 <= 2958465) {
|
|
2371
|
-
const e4 = n2._mon[0] === "0" || n2.day[0] === "0" || n2._mon.length === 2 && n2.day.length === 2, a3 = n2.path.replace(/[jdlDnmMFyYx-]/g, (t3) => t3 === "j" || t3 === "d" ? e4 ? "dd" : "d" : t3 === "D" ? "ddd" : t3 === "l" ? "dddd" : t3 === "n" || t3 === "m" ? e4 ? "mm" : "m" : t3 === "M" ? "mmm" : t3 === "F" ? "mmmm" : t3 === "y" ? "yy" : t3 === "x" ? n2.tf || "" : t3 === "Y" ? "yyyy" : t3);
|
|
2372
|
-
return t2 && t2.nativeDate ? { v: I(i2, t2), z: a3 } : { v: i2, z: a3 };
|
|
2373
|
-
}
|
|
2374
|
-
}
|
|
2375
|
-
return null;
|
|
2376
|
-
}
|
|
2377
|
-
__name(oe, "oe");
|
|
2378
|
-
function le(e2) {
|
|
2379
|
-
const t2 = /^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(e2);
|
|
2380
|
-
if (t2) {
|
|
2381
|
-
const [, e3, n2, a2, r2, i2] = t2;
|
|
2382
|
-
if (r2 && !a2 || !i2 && !n2 && !a2) return null;
|
|
2383
|
-
let s2 = 1 * (e3 || 0);
|
|
2384
|
-
if (i2) {
|
|
2385
|
-
if (s2 >= 13) return null;
|
|
2386
|
-
i2[0] !== "p" && i2[0] !== "P" || (s2 += 12);
|
|
2387
|
-
}
|
|
2388
|
-
return { v: (60 * s2 * 60 + 60 * (1 * (n2 || 0)) + 1 * (a2 || 0) + 1 * (r2 || 0)) / 86400, z: (e3.length === 2 ? "hh" : "h") + ":mm" + (a2 ? ":ss" : "") + (i2 ? " AM/PM" : "") };
|
|
2389
|
-
}
|
|
2390
|
-
return null;
|
|
2391
|
-
}
|
|
2392
|
-
__name(le, "le");
|
|
2393
|
-
function de(e2) {
|
|
2394
|
-
return /^\s*true\s*$/i.test(e2) ? { v: !0 } : /^\s*false\s*$/i.test(e2) ? { v: !1 } : null;
|
|
2395
|
-
}
|
|
2396
|
-
__name(de, "de");
|
|
2397
|
-
const me = {};
|
|
2398
|
-
function ue(e2, t2) {
|
|
2399
|
-
const { pattern: n2, partitions: a2, locale: r2 } = e2, i2 = /* @__PURE__ */ __name((e3) => {
|
|
2400
|
-
const n3 = Object.assign({}, h(), t2, e3);
|
|
2401
|
-
return r2 && (n3.locale = r2), n3;
|
|
2402
|
-
}, "i"), s2 = /* @__PURE__ */ __name((e3, t3) => {
|
|
2403
|
-
const n3 = i2(t3);
|
|
2404
|
-
return function(e4, t4, n4) {
|
|
2405
|
-
const a3 = l(n4.locale), r3 = t4[3] ? t4[3] : V;
|
|
2406
|
-
if (typeof e4 == "boolean" && (e4 = e4 ? "TRUE" : "FALSE"), e4 == null) return "";
|
|
2407
|
-
if (typeof e4 != "number") return K(e4, r3, n4, a3);
|
|
2408
|
-
if (!isFinite(e4)) {
|
|
2409
|
-
const t5 = a3 || u;
|
|
2410
|
-
return isNaN(e4) ? t5.nan : (e4 < 0 ? t5.negative : "") + t5.infinity;
|
|
2411
|
-
}
|
|
2412
|
-
const i3 = q(e4, t4);
|
|
2413
|
-
return i3 ? K(e4, i3, n4, a3) : n4.overflow;
|
|
2414
|
-
}(P(e3, n3), a2, n3);
|
|
2415
|
-
}, "s");
|
|
2416
|
-
s2.color = (e3, t3) => function(e4, t4) {
|
|
2417
|
-
if (typeof e4 != "number" || !isFinite(e4)) return (t4[3] ? t4[3].color : V.color) || Q;
|
|
2418
|
-
const n3 = q(e4, t4);
|
|
2419
|
-
return n3 && n3.color || Q;
|
|
2420
|
-
}(P(e3, i2(t3)), a2);
|
|
2421
|
-
const o2 = function(e3) {
|
|
2422
|
-
var t3;
|
|
2423
|
-
let n3 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
2424
|
-
const [a3, r3] = e3, i3 = a3.frac_max, s3 = { type: "general", isDate: J(e3), isText: L(e3), isPercent: O(e3), maxDecimals: a3.general ? 9 : i3, scale: (t3 = a3.scale) !== null && t3 !== void 0 ? t3 : 1, color: 0, parentheses: 0, grouped: a3.grouping ? 1 : 0, _partitions: e3 }, o3 = !s3.isDate && !s3.isText && !a3.error && a3.tokens.some((e4) => e4.type === "string" && (n3 ? e4.value === n3 : v.test(e4.value)));
|
|
2425
|
-
let l2 = "G", d2 = i3 >= 0 ? Math.min(15, i3) : "", m2 = "", u2 = "";
|
|
2426
|
-
if (r3 && r3.color && (u2 = "-", s3.color = 1), a3.parens && (m2 = "()", s3.parentheses = 1), o3) l2 = "C", s3.type = "currency";
|
|
2427
|
-
else if (a3.error) s3.type = "error", s3.maxDecimals = 0;
|
|
2428
|
-
else if (s3.isDate) {
|
|
2429
|
-
let e4 = 0, t4 = 0, n4 = "";
|
|
2430
|
-
a3.tokens.forEach((a4) => {
|
|
2431
|
-
const r5 = a4.type;
|
|
2432
|
-
/^(b-)?year/.test(r5) ? (n4 += "Y", t4++) : r5.startsWith("month") ? (n4 += "M", t4++) : /^(week)?day/.test(r5) ? (n4 += "D", t4++) : r5 !== "hour" && r5 !== "min" && r5 !== "sec" && r5 !== "am" || (n4 += r5[0], e4++);
|
|
2433
|
-
}), s3.type = "date", t4 && e4 ? s3.type = "datetime" : !t4 && e4 && (s3.type = "time");
|
|
2434
|
-
const r4 = R.find((e5) => n4.startsWith(e5[0]));
|
|
2435
|
-
l2 = r4 ? "D" : "G", d2 = r4 ? r4[1] : "";
|
|
2436
|
-
} else s3.isText ? (l2 = "G", s3.type = "text", d2 = "", s3.maxDecimals = 0) : a3.general ? (l2 = "G", s3.type = "general", d2 = "") : a3.fractions ? (l2 = "G", s3.type = "fraction", d2 = "") : a3.exponential ? (l2 = "S", s3.type = "scientific") : s3.isPercent ? (l2 = "P", s3.type = "percent") : a3.grouping ? (l2 = ",", s3.type = "grouped") : (a3.int_max || i3) && (l2 = "F", s3.type = "number");
|
|
2437
|
-
return s3.code = l2 + d2 + u2 + m2, s3.level = U[s3.type], Object.freeze(s3);
|
|
2438
|
-
}(a2, (t2 || {}).currency) || new SyntaxError();
|
|
2439
|
-
return s2.info = o2, s2.dateInfo = function(e3) {
|
|
2440
|
-
const [t3] = e3;
|
|
2441
|
-
return { year: !!(2 & t3.date), month: !!(4 & t3.date), day: !!(8 & t3.date), hours: !!(16 & t3.date), minutes: !!(32 & t3.date), seconds: !!(64 & t3.date), clockType: t3.clock === 12 ? 12 : 24 };
|
|
2442
|
-
}(a2), s2.isPercent = () => !!o2.isPercent, s2.isDate = () => !!o2.isDate, s2.isText = () => !!o2.isText, s2.pattern = n2, e2.error && (s2.error = e2.error), s2.options = i2, s2.locale = r2 || t2 && t2.locale || "", Object.freeze(s2);
|
|
2443
|
-
}
|
|
2444
|
-
__name(ue, "ue");
|
|
2445
|
-
function ce(e2, t2) {
|
|
2446
|
-
e2 || (e2 = "General");
|
|
2447
|
-
let n2 = null;
|
|
2448
|
-
return me[e2] ? n2 = me[e2] : (n2 = Object.assign({}, h(), t2).throws ? D(e2) : function(e3) {
|
|
2449
|
-
try {
|
|
2450
|
-
return D(e3);
|
|
2451
|
-
} catch (t3) {
|
|
2452
|
-
const n3 = { tokens: [{ type: "error" }], error: t3.message };
|
|
2453
|
-
return { pattern: e3, partitions: [n3, n3, n3, n3], error: t3.message, locale: null };
|
|
2454
|
-
}
|
|
2455
|
-
}(e2), n2.error || (me[e2] = n2)), ue(n2, t2);
|
|
2456
|
-
}
|
|
2457
|
-
__name(ce, "ce"), ce.isDate = (e2) => ce(e2, { throws: !1 }).isDate(), ce.isPercent = (e2) => ce(e2, { throws: !1 }).isPercent(), ce.isText = (e2) => ce(e2, { throws: !1 }).isText(), ce.getInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).info, ce.getDateInfo = (e2, t2) => ce(e2, { ...t2, throws: !1 }).dateInfo, ce.dateToSerial = P, ce.dateFromSerial = I, ce.options = h, ce.dec2frac = p, ce.round = c, ce.codeToLocale = n, ce.parseLocale = s, ce.getLocale = l, ce.addLocale = (e2, t2) => {
|
|
2458
|
-
const n2 = s(t2);
|
|
2459
|
-
return delete me[n2.lang], delete me[n2.language], m(e2, n2);
|
|
2460
|
-
}, ce.format = function(e2, t2, n2) {
|
|
2461
|
-
let a2 = arguments.length > 3 && arguments[3] !== void 0 && arguments[3];
|
|
2462
|
-
const r2 = n2 && typeof n2 == "object" ? n2 : { locale: n2, throws: !a2 };
|
|
2463
|
-
return ce(e2, r2)(P(t2, r2), r2);
|
|
2464
|
-
}, ce.is_date = ce.isDate, ce.parseNumber = ie, ce.parseDate = oe, ce.parseTime = le, ce.parseBool = de, ce.parseValue = function(e2, t2) {
|
|
2465
|
-
var n2, a2, r2;
|
|
2466
|
-
return (n2 = (a2 = (r2 = ie(e2)) !== null && r2 !== void 0 ? r2 : oe(e2, t2)) !== null && a2 !== void 0 ? a2 : le(e2)) !== null && n2 !== void 0 ? n2 : de(e2);
|
|
2467
|
-
};
|
|
2468
|
-
var pe = ce;
|
|
2469
|
-
return t = t.default;
|
|
2470
|
-
}();
|
|
2471
|
-
});
|
|
2472
|
-
})(numfmt$2);
|
|
2473
|
-
var numfmtExports = numfmt$2.exports, numfmt = numfmtExports;
|
|
2474
|
-
const numfmt$1 = /* @__PURE__ */ getDefaultExportFromCjs(numfmt), currencySymbols = [
|
|
1711
|
+
const currencySymbols = [
|
|
2475
1712
|
"$",
|
|
2476
1713
|
"£",
|
|
2477
1714
|
"¥",
|
|
@@ -2532,7 +1769,7 @@ __name(handleNumfmtInCell, "handleNumfmtInCell");
|
|
|
2532
1769
|
function getNumberFormatType(pattern) {
|
|
2533
1770
|
if (isAccounting(pattern))
|
|
2534
1771
|
return 3;
|
|
2535
|
-
const type = numfmt
|
|
1772
|
+
const type = numfmt.getInfo(pattern).type || "unknown";
|
|
2536
1773
|
return NumberFormatTypeMap[type];
|
|
2537
1774
|
}
|
|
2538
1775
|
__name(getNumberFormatType, "getNumberFormatType");
|
|
@@ -5443,8 +4680,70 @@ const _VarS = class _VarS extends BaseFunction {
|
|
|
5443
4680
|
};
|
|
5444
4681
|
__name(_VarS, "VarS");
|
|
5445
4682
|
let VarS = _VarS;
|
|
4683
|
+
const _Rank = class _Rank extends BaseFunction {
|
|
4684
|
+
constructor() {
|
|
4685
|
+
super(...arguments);
|
|
4686
|
+
__publicField(this, "minParams", 2);
|
|
4687
|
+
__publicField(this, "maxParams", 3);
|
|
4688
|
+
__publicField(this, "needsReferenceObject", !0);
|
|
4689
|
+
}
|
|
4690
|
+
calculate(number, ref, order) {
|
|
4691
|
+
let _number = number;
|
|
4692
|
+
_number.isReferenceObject() && (_number = _number.toArrayValueObject());
|
|
4693
|
+
const { refHasError, refErrorObject, refNumbers } = this._checkRefReferenceObject(ref);
|
|
4694
|
+
let _order = order != null ? order : NumberValueObject.create(0);
|
|
4695
|
+
_order.isReferenceObject() && (_order = _order.toArrayValueObject());
|
|
4696
|
+
const maxRowLength = Math.max(
|
|
4697
|
+
_number.isArray() ? _number.getRowCount() : 1,
|
|
4698
|
+
_order.isArray() ? _order.getRowCount() : 1
|
|
4699
|
+
), maxColumnLength = Math.max(
|
|
4700
|
+
_number.isArray() ? _number.getColumnCount() : 1,
|
|
4701
|
+
_order.isArray() ? _order.getColumnCount() : 1
|
|
4702
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, _number, ErrorValueObject.create(ErrorType$1.NA)), orderArray = expandArrayValueObject(maxRowLength, maxColumnLength, _order, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((numberObject, rowIndex, columnIndex) => {
|
|
4703
|
+
const orderObject = orderArray.get(rowIndex, columnIndex);
|
|
4704
|
+
if (!number.isReferenceObject() && number.isNull())
|
|
4705
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
4706
|
+
if (refHasError)
|
|
4707
|
+
return refErrorObject;
|
|
4708
|
+
if (orderObject.isError())
|
|
4709
|
+
return orderObject;
|
|
4710
|
+
const numberValue = +numberObject.getValue(), orderValue = +orderObject.getValue();
|
|
4711
|
+
if (Number.isNaN(numberValue) || Number.isNaN(orderValue))
|
|
4712
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
4713
|
+
const result = refNumbers.sort((a, b) => orderValue ? a - b : b - a).indexOf(numberValue);
|
|
4714
|
+
return result === -1 ? ErrorValueObject.create(ErrorType$1.NA) : NumberValueObject.create(result + 1);
|
|
4715
|
+
});
|
|
4716
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
4717
|
+
}
|
|
4718
|
+
_checkRefReferenceObject(ref) {
|
|
4719
|
+
let refHasError = !1, refErrorObject = ErrorValueObject.create(ErrorType$1.NA);
|
|
4720
|
+
const refNumbers = [];
|
|
4721
|
+
return ref.isReferenceObject() ? (ref.toArrayValueObject().iterator((refObject) => {
|
|
4722
|
+
const _refObject = refObject;
|
|
4723
|
+
if (_refObject.isError())
|
|
4724
|
+
return refHasError = !0, refErrorObject = _refObject, !1;
|
|
4725
|
+
if (_refObject.isNull() || _refObject.isBoolean())
|
|
4726
|
+
return !0;
|
|
4727
|
+
const refValue = +_refObject.getValue();
|
|
4728
|
+
if (Number.isNaN(refValue))
|
|
4729
|
+
return !0;
|
|
4730
|
+
refNumbers.push(refValue);
|
|
4731
|
+
}), {
|
|
4732
|
+
refHasError,
|
|
4733
|
+
refErrorObject,
|
|
4734
|
+
refNumbers
|
|
4735
|
+
}) : {
|
|
4736
|
+
refHasError: !0,
|
|
4737
|
+
refErrorObject,
|
|
4738
|
+
refNumbers
|
|
4739
|
+
};
|
|
4740
|
+
}
|
|
4741
|
+
};
|
|
4742
|
+
__name(_Rank, "Rank");
|
|
4743
|
+
let Rank = _Rank;
|
|
5446
4744
|
var FUNCTION_NAMES_COMPATIBILITY = /* @__PURE__ */ ((FUNCTION_NAMES_COMPATIBILITY2) => (FUNCTION_NAMES_COMPATIBILITY2.BETADIST = "BETADIST", FUNCTION_NAMES_COMPATIBILITY2.BETAINV = "BETAINV", FUNCTION_NAMES_COMPATIBILITY2.BINOMDIST = "BINOMDIST", FUNCTION_NAMES_COMPATIBILITY2.CHIDIST = "CHIDIST", FUNCTION_NAMES_COMPATIBILITY2.CHIINV = "CHIINV", FUNCTION_NAMES_COMPATIBILITY2.CHITEST = "CHITEST", FUNCTION_NAMES_COMPATIBILITY2.CONFIDENCE = "CONFIDENCE", FUNCTION_NAMES_COMPATIBILITY2.COVAR = "COVAR", FUNCTION_NAMES_COMPATIBILITY2.CRITBINOM = "CRITBINOM", FUNCTION_NAMES_COMPATIBILITY2.EXPONDIST = "EXPONDIST", FUNCTION_NAMES_COMPATIBILITY2.FDIST = "FDIST", FUNCTION_NAMES_COMPATIBILITY2.FINV = "FINV", FUNCTION_NAMES_COMPATIBILITY2.FTEST = "FTEST", FUNCTION_NAMES_COMPATIBILITY2.GAMMADIST = "GAMMADIST", FUNCTION_NAMES_COMPATIBILITY2.GAMMAINV = "GAMMAINV", FUNCTION_NAMES_COMPATIBILITY2.HYPGEOMDIST = "HYPGEOMDIST", FUNCTION_NAMES_COMPATIBILITY2.LOGINV = "LOGINV", FUNCTION_NAMES_COMPATIBILITY2.LOGNORMDIST = "LOGNORMDIST", FUNCTION_NAMES_COMPATIBILITY2.MODE = "MODE", FUNCTION_NAMES_COMPATIBILITY2.NEGBINOMDIST = "NEGBINOMDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMDIST = "NORMDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMINV = "NORMINV", FUNCTION_NAMES_COMPATIBILITY2.NORMSDIST = "NORMSDIST", FUNCTION_NAMES_COMPATIBILITY2.NORMSINV = "NORMSINV", FUNCTION_NAMES_COMPATIBILITY2.PERCENTILE = "PERCENTILE", FUNCTION_NAMES_COMPATIBILITY2.PERCENTRANK = "PERCENTRANK", FUNCTION_NAMES_COMPATIBILITY2.POISSON = "POISSON", FUNCTION_NAMES_COMPATIBILITY2.QUARTILE = "QUARTILE", FUNCTION_NAMES_COMPATIBILITY2.RANK = "RANK", FUNCTION_NAMES_COMPATIBILITY2.STDEV = "STDEV", FUNCTION_NAMES_COMPATIBILITY2.STDEVP = "STDEVP", FUNCTION_NAMES_COMPATIBILITY2.TDIST = "TDIST", FUNCTION_NAMES_COMPATIBILITY2.TINV = "TINV", FUNCTION_NAMES_COMPATIBILITY2.TTEST = "TTEST", FUNCTION_NAMES_COMPATIBILITY2.VAR = "VAR", FUNCTION_NAMES_COMPATIBILITY2.VARP = "VARP", FUNCTION_NAMES_COMPATIBILITY2.WEIBULL = "WEIBULL", FUNCTION_NAMES_COMPATIBILITY2.ZTEST = "ZTEST", FUNCTION_NAMES_COMPATIBILITY2))(FUNCTION_NAMES_COMPATIBILITY || {});
|
|
5447
4745
|
const functionCompatibility = [
|
|
4746
|
+
[Rank, FUNCTION_NAMES_COMPATIBILITY.RANK],
|
|
5448
4747
|
[StdevS, FUNCTION_NAMES_COMPATIBILITY.STDEV],
|
|
5449
4748
|
[StdevP, FUNCTION_NAMES_COMPATIBILITY.STDEVP],
|
|
5450
4749
|
[VarS, FUNCTION_NAMES_COMPATIBILITY.VAR],
|
|
@@ -5489,19 +4788,19 @@ function isValidDateStr(dateStr) {
|
|
|
5489
4788
|
}
|
|
5490
4789
|
__name(isValidDateStr, "isValidDateStr");
|
|
5491
4790
|
function parseFormattedDate(value) {
|
|
5492
|
-
return numfmt
|
|
4791
|
+
return numfmt.parseDate(value);
|
|
5493
4792
|
}
|
|
5494
4793
|
__name(parseFormattedDate, "parseFormattedDate");
|
|
5495
4794
|
function parseFormattedValue(value) {
|
|
5496
|
-
return numfmt
|
|
4795
|
+
return numfmt.parseValue(value);
|
|
5497
4796
|
}
|
|
5498
4797
|
__name(parseFormattedValue, "parseFormattedValue");
|
|
5499
4798
|
function parseFormattedTime(value) {
|
|
5500
|
-
return numfmt
|
|
4799
|
+
return numfmt.parseTime(value);
|
|
5501
4800
|
}
|
|
5502
4801
|
__name(parseFormattedTime, "parseFormattedTime");
|
|
5503
4802
|
function isDate(format) {
|
|
5504
|
-
return numfmt
|
|
4803
|
+
return numfmt.isDate(format);
|
|
5505
4804
|
}
|
|
5506
4805
|
__name(isDate, "isDate");
|
|
5507
4806
|
const weekendNumberMap = {
|
|
@@ -10383,7 +9682,7 @@ const _Offset = class _Offset extends BaseFunction {
|
|
|
10383
9682
|
});
|
|
10384
9683
|
}
|
|
10385
9684
|
_handleSingleObject(reference, rowsValue, columnsValue, heightValue, widthValue, isReportError = !1) {
|
|
10386
|
-
const { startRow: referenceStartRow, startColumn: referenceStartColumn } = reference.
|
|
9685
|
+
const { startRow: referenceStartRow, startColumn: referenceStartColumn } = reference.getRangePosition(), rowOffset = this.getIndexNumValue(rowsValue), columnOffset = this.getIndexNumValue(columnsValue);
|
|
10387
9686
|
if (typeof rowOffset != "number" || typeof columnOffset != "number")
|
|
10388
9687
|
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
10389
9688
|
const targetRow = referenceStartRow + rowOffset, targetColumn = referenceStartColumn + columnOffset;
|
|
@@ -11156,7 +10455,7 @@ const _Index = class _Index extends BaseFunction {
|
|
|
11156
10455
|
if (reference.isValueObject())
|
|
11157
10456
|
referenceRowCount = 1, referenceColumnCount = 1;
|
|
11158
10457
|
else if (reference.isReferenceObject()) {
|
|
11159
|
-
const { startRow, endRow, startColumn, endColumn } = reference.
|
|
10458
|
+
const { startRow, endRow, startColumn, endColumn } = reference.getRangePosition();
|
|
11160
10459
|
referenceRowCount = endRow - startRow + 1, referenceColumnCount = endColumn - startColumn + 1;
|
|
11161
10460
|
} else
|
|
11162
10461
|
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
@@ -11226,7 +10525,7 @@ const _Index = class _Index extends BaseFunction {
|
|
|
11226
10525
|
return logicValue;
|
|
11227
10526
|
}
|
|
11228
10527
|
_getReferenceObject(reference, rowNumberValue, columnNumberValue, areaNumberValue) {
|
|
11229
|
-
const { startRow, endRow, startColumn, endColumn } = reference.
|
|
10528
|
+
const { startRow, endRow, startColumn, endColumn } = reference.getRangePosition();
|
|
11230
10529
|
let referenceStartRow = 0, referenceEndRow = 0, referenceStartColumn = 0, referenceEndColumn = 0;
|
|
11231
10530
|
if (rowNumberValue === 0 ? (referenceStartRow = startRow, referenceEndRow = endRow) : referenceStartRow = referenceEndRow = startRow + rowNumberValue - 1, columnNumberValue === 0 ? (referenceStartColumn = startColumn, referenceEndColumn = endColumn) : referenceStartColumn = referenceEndColumn = startColumn + columnNumberValue - 1, referenceStartRow > endRow || referenceStartColumn > endColumn)
|
|
11232
10531
|
return ErrorValueObject.create(ErrorType$1.REF);
|
|
@@ -13393,7 +12692,7 @@ const _Averageif = class _Averageif extends BaseFunction {
|
|
|
13393
12692
|
const averageRangeRow = averageRange.getRowCount(), averageRangeColumn = averageRange.getColumnCount(), rowCount = range.isArray() ? range.getRowCount() : 1, columnCount = range.isArray() ? range.getColumnCount() : 1;
|
|
13394
12693
|
if (averageRangeRow === rowCount && averageRangeColumn === columnCount)
|
|
13395
12694
|
return averageRange;
|
|
13396
|
-
const { startRow, startColumn } = averageRange.
|
|
12695
|
+
const { startRow, startColumn } = averageRange.getRangePosition(), rangeData = {
|
|
13397
12696
|
startRow,
|
|
13398
12697
|
startColumn,
|
|
13399
12698
|
endRow: startRow + rowCount - 1,
|
|
@@ -13741,6 +13040,138 @@ const _Minifs = class _Minifs extends BaseFunction {
|
|
|
13741
13040
|
};
|
|
13742
13041
|
__name(_Minifs, "Minifs");
|
|
13743
13042
|
let Minifs = _Minifs;
|
|
13043
|
+
const _RankAvg = class _RankAvg extends BaseFunction {
|
|
13044
|
+
constructor() {
|
|
13045
|
+
super(...arguments);
|
|
13046
|
+
__publicField(this, "minParams", 2);
|
|
13047
|
+
__publicField(this, "maxParams", 3);
|
|
13048
|
+
__publicField(this, "needsReferenceObject", !0);
|
|
13049
|
+
}
|
|
13050
|
+
calculate(number, ref, order) {
|
|
13051
|
+
let _number = number;
|
|
13052
|
+
_number.isReferenceObject() && (_number = _number.toArrayValueObject());
|
|
13053
|
+
const { refHasError, refErrorObject, refNumbers } = this._checkRefReferenceObject(ref);
|
|
13054
|
+
let _order = order != null ? order : NumberValueObject.create(0);
|
|
13055
|
+
_order.isReferenceObject() && (_order = _order.toArrayValueObject());
|
|
13056
|
+
const maxRowLength = Math.max(
|
|
13057
|
+
_number.isArray() ? _number.getRowCount() : 1,
|
|
13058
|
+
_order.isArray() ? _order.getRowCount() : 1
|
|
13059
|
+
), maxColumnLength = Math.max(
|
|
13060
|
+
_number.isArray() ? _number.getColumnCount() : 1,
|
|
13061
|
+
_order.isArray() ? _order.getColumnCount() : 1
|
|
13062
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, _number, ErrorValueObject.create(ErrorType$1.NA)), orderArray = expandArrayValueObject(maxRowLength, maxColumnLength, _order, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((numberObject, rowIndex, columnIndex) => {
|
|
13063
|
+
const orderObject = orderArray.get(rowIndex, columnIndex);
|
|
13064
|
+
if (!number.isReferenceObject() && number.isNull())
|
|
13065
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
13066
|
+
if (refHasError)
|
|
13067
|
+
return refErrorObject;
|
|
13068
|
+
if (orderObject.isError())
|
|
13069
|
+
return orderObject;
|
|
13070
|
+
const numberValue = +numberObject.getValue(), orderValue = +orderObject.getValue();
|
|
13071
|
+
return Number.isNaN(numberValue) || Number.isNaN(orderValue) ? ErrorValueObject.create(ErrorType$1.VALUE) : this._getResult(numberValue, orderValue, refNumbers);
|
|
13072
|
+
});
|
|
13073
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
13074
|
+
}
|
|
13075
|
+
_getResult(numberValue, orderValue, refNumbers) {
|
|
13076
|
+
const refOrderNumbers = refNumbers.sort((a, b) => orderValue ? a - b : b - a);
|
|
13077
|
+
let index = refOrderNumbers.indexOf(numberValue);
|
|
13078
|
+
const results = [];
|
|
13079
|
+
for (; index >= 0; ) {
|
|
13080
|
+
const start = index + 1;
|
|
13081
|
+
results.push(start), index = refOrderNumbers.indexOf(numberValue, start);
|
|
13082
|
+
}
|
|
13083
|
+
if (results.length === 0)
|
|
13084
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
13085
|
+
const result = results.reduce((acc, cur) => acc + cur, 0) / results.length;
|
|
13086
|
+
return NumberValueObject.create(result);
|
|
13087
|
+
}
|
|
13088
|
+
_checkRefReferenceObject(ref) {
|
|
13089
|
+
let refHasError = !1, refErrorObject = ErrorValueObject.create(ErrorType$1.NA);
|
|
13090
|
+
const refNumbers = [];
|
|
13091
|
+
return ref.isReferenceObject() ? (ref.toArrayValueObject().iterator((refObject) => {
|
|
13092
|
+
const _refObject = refObject;
|
|
13093
|
+
if (_refObject.isError())
|
|
13094
|
+
return refHasError = !0, refErrorObject = _refObject, !1;
|
|
13095
|
+
if (_refObject.isNull() || _refObject.isBoolean())
|
|
13096
|
+
return !0;
|
|
13097
|
+
const refValue = +_refObject.getValue();
|
|
13098
|
+
if (Number.isNaN(refValue))
|
|
13099
|
+
return !0;
|
|
13100
|
+
refNumbers.push(refValue);
|
|
13101
|
+
}), {
|
|
13102
|
+
refHasError,
|
|
13103
|
+
refErrorObject,
|
|
13104
|
+
refNumbers
|
|
13105
|
+
}) : {
|
|
13106
|
+
refHasError: !0,
|
|
13107
|
+
refErrorObject,
|
|
13108
|
+
refNumbers
|
|
13109
|
+
};
|
|
13110
|
+
}
|
|
13111
|
+
};
|
|
13112
|
+
__name(_RankAvg, "RankAvg");
|
|
13113
|
+
let RankAvg = _RankAvg;
|
|
13114
|
+
const _RankEq = class _RankEq extends BaseFunction {
|
|
13115
|
+
constructor() {
|
|
13116
|
+
super(...arguments);
|
|
13117
|
+
__publicField(this, "minParams", 2);
|
|
13118
|
+
__publicField(this, "maxParams", 3);
|
|
13119
|
+
__publicField(this, "needsReferenceObject", !0);
|
|
13120
|
+
}
|
|
13121
|
+
calculate(number, ref, order) {
|
|
13122
|
+
let _number = number;
|
|
13123
|
+
_number.isReferenceObject() && (_number = _number.toArrayValueObject());
|
|
13124
|
+
const { refHasError, refErrorObject, refNumbers } = this._checkRefReferenceObject(ref);
|
|
13125
|
+
let _order = order != null ? order : NumberValueObject.create(0);
|
|
13126
|
+
_order.isReferenceObject() && (_order = _order.toArrayValueObject());
|
|
13127
|
+
const maxRowLength = Math.max(
|
|
13128
|
+
_number.isArray() ? _number.getRowCount() : 1,
|
|
13129
|
+
_order.isArray() ? _order.getRowCount() : 1
|
|
13130
|
+
), maxColumnLength = Math.max(
|
|
13131
|
+
_number.isArray() ? _number.getColumnCount() : 1,
|
|
13132
|
+
_order.isArray() ? _order.getColumnCount() : 1
|
|
13133
|
+
), numberArray = expandArrayValueObject(maxRowLength, maxColumnLength, _number, ErrorValueObject.create(ErrorType$1.NA)), orderArray = expandArrayValueObject(maxRowLength, maxColumnLength, _order, ErrorValueObject.create(ErrorType$1.NA)), resultArray = numberArray.map((numberObject, rowIndex, columnIndex) => {
|
|
13134
|
+
const orderObject = orderArray.get(rowIndex, columnIndex);
|
|
13135
|
+
if (!number.isReferenceObject() && number.isNull())
|
|
13136
|
+
return ErrorValueObject.create(ErrorType$1.NA);
|
|
13137
|
+
if (refHasError)
|
|
13138
|
+
return refErrorObject;
|
|
13139
|
+
if (orderObject.isError())
|
|
13140
|
+
return orderObject;
|
|
13141
|
+
const numberValue = +numberObject.getValue(), orderValue = +orderObject.getValue();
|
|
13142
|
+
if (Number.isNaN(numberValue) || Number.isNaN(orderValue))
|
|
13143
|
+
return ErrorValueObject.create(ErrorType$1.VALUE);
|
|
13144
|
+
const result = refNumbers.sort((a, b) => orderValue ? a - b : b - a).indexOf(numberValue);
|
|
13145
|
+
return result === -1 ? ErrorValueObject.create(ErrorType$1.NA) : NumberValueObject.create(result + 1);
|
|
13146
|
+
});
|
|
13147
|
+
return maxRowLength === 1 && maxColumnLength === 1 ? resultArray.get(0, 0) : resultArray;
|
|
13148
|
+
}
|
|
13149
|
+
_checkRefReferenceObject(ref) {
|
|
13150
|
+
let refHasError = !1, refErrorObject = ErrorValueObject.create(ErrorType$1.NA);
|
|
13151
|
+
const refNumbers = [];
|
|
13152
|
+
return ref.isReferenceObject() ? (ref.toArrayValueObject().iterator((refObject) => {
|
|
13153
|
+
const _refObject = refObject;
|
|
13154
|
+
if (_refObject.isError())
|
|
13155
|
+
return refHasError = !0, refErrorObject = _refObject, !1;
|
|
13156
|
+
if (_refObject.isNull() || _refObject.isBoolean())
|
|
13157
|
+
return !0;
|
|
13158
|
+
const refValue = +_refObject.getValue();
|
|
13159
|
+
if (Number.isNaN(refValue))
|
|
13160
|
+
return !0;
|
|
13161
|
+
refNumbers.push(refValue);
|
|
13162
|
+
}), {
|
|
13163
|
+
refHasError,
|
|
13164
|
+
refErrorObject,
|
|
13165
|
+
refNumbers
|
|
13166
|
+
}) : {
|
|
13167
|
+
refHasError: !0,
|
|
13168
|
+
refErrorObject,
|
|
13169
|
+
refNumbers
|
|
13170
|
+
};
|
|
13171
|
+
}
|
|
13172
|
+
};
|
|
13173
|
+
__name(_RankEq, "RankEq");
|
|
13174
|
+
let RankEq = _RankEq;
|
|
13744
13175
|
const _Stdeva = class _Stdeva extends BaseFunction {
|
|
13745
13176
|
constructor() {
|
|
13746
13177
|
super(...arguments);
|
|
@@ -13810,6 +13241,8 @@ const functionStatistical = [
|
|
|
13810
13241
|
[Min, FUNCTION_NAMES_STATISTICAL.MIN],
|
|
13811
13242
|
[Mina, FUNCTION_NAMES_STATISTICAL.MINA],
|
|
13812
13243
|
[Minifs, FUNCTION_NAMES_STATISTICAL.MINIFS],
|
|
13244
|
+
[RankAvg, FUNCTION_NAMES_STATISTICAL.RANK_AVG],
|
|
13245
|
+
[RankEq, FUNCTION_NAMES_STATISTICAL.RANK_EQ],
|
|
13813
13246
|
[StdevP, FUNCTION_NAMES_STATISTICAL.STDEV_P],
|
|
13814
13247
|
[StdevS, FUNCTION_NAMES_STATISTICAL.STDEV_S],
|
|
13815
13248
|
[Stdeva, FUNCTION_NAMES_STATISTICAL.STDEVA],
|
|
@@ -13892,7 +13325,7 @@ const _Len = class _Len extends BaseFunction {
|
|
|
13892
13325
|
if (text.isNull())
|
|
13893
13326
|
return NumberValueObject.create(0);
|
|
13894
13327
|
if (text.isNumber()) {
|
|
13895
|
-
const numberValue = text.getValue(), numberValueString = stripErrorMargin(numberValue).toString();
|
|
13328
|
+
const numberValue = text.getValue(), numberValueString = stripErrorMargin(numberValue, 12, Number.EPSILON).toString();
|
|
13896
13329
|
return NumberValueObject.create(numberValueString.length);
|
|
13897
13330
|
}
|
|
13898
13331
|
if (text.isString() || text.isBoolean() || text.isNumber()) {
|
|
@@ -13996,7 +13429,7 @@ const _Rept = class _Rept extends BaseFunction {
|
|
|
13996
13429
|
};
|
|
13997
13430
|
__name(_Rept, "Rept");
|
|
13998
13431
|
let Rept = _Rept;
|
|
13999
|
-
const getFormatPreview = /* @__PURE__ */ __name((pattern, value) => numfmt
|
|
13432
|
+
const getFormatPreview = /* @__PURE__ */ __name((pattern, value) => numfmt.format(pattern, value), "getFormatPreview"), _Text = class _Text extends BaseFunction {
|
|
14000
13433
|
constructor() {
|
|
14001
13434
|
super(...arguments);
|
|
14002
13435
|
__publicField(this, "minParams", 2);
|
|
@@ -17449,7 +16882,7 @@ let FormulaDependencyGenerator = (_a14 = class extends Disposable {
|
|
|
17449
16882
|
if (tree === void 0 || tree.isSkip())
|
|
17450
16883
|
continue;
|
|
17451
16884
|
if (tree.isAdded()) {
|
|
17452
|
-
formulaRunList.push(tree);
|
|
16885
|
+
formulaRunList.push(tree), tree.setSkip();
|
|
17453
16886
|
continue;
|
|
17454
16887
|
}
|
|
17455
16888
|
const cacheStack = [];
|
|
@@ -18185,29 +17618,11 @@ let UniverFormulaEnginePlugin = (_a23 = class extends Plugin {
|
|
|
18185
17618
|
UniverFormulaEnginePlugin = __decorateClass([
|
|
18186
17619
|
__decorateParam(1, Inject(Injector))
|
|
18187
17620
|
], UniverFormulaEnginePlugin);
|
|
18188
|
-
function isFormulaTransformable(lexerTreeBuilder, formula) {
|
|
18189
|
-
const originSequenceNodes = lexerTreeBuilder.sequenceNodesBuilder(formula);
|
|
18190
|
-
return !(!originSequenceNodes || originSequenceNodes.every((node) => typeof node == "string" || node.nodeType !== sequenceNodeType.REFERENCE));
|
|
18191
|
-
}
|
|
18192
|
-
__name(isFormulaTransformable, "isFormulaTransformable");
|
|
18193
|
-
function transformFormula(lexerTreeBuilder, formula, originRow, originCol, targetRow, targetCol) {
|
|
18194
|
-
if (!isFormulaTransformable(lexerTreeBuilder, formula))
|
|
18195
|
-
return formula;
|
|
18196
|
-
const originSequenceNodes = lexerTreeBuilder.sequenceNodesBuilder(formula), getRangeFromCell = /* @__PURE__ */ __name((row, col) => ({ startRow: row, endRow: row, startColumn: col, endColumn: col }), "getRangeFromCell"), originRange = getRangeFromCell(originRow, originCol), relativeRange = Rectangle.getRelativeRange(getRangeFromCell(targetRow, targetCol), originRange), sequenceNodes = Tools.deepClone(originSequenceNodes), transformSequenceNodes = Array.isArray(sequenceNodes) ? sequenceNodes.map((node) => {
|
|
18197
|
-
if (typeof node == "object" && node.nodeType === sequenceNodeType.REFERENCE) {
|
|
18198
|
-
const gridRangeName = deserializeRangeWithSheet(node.token), newRange = Rectangle.getPositionRange(relativeRange, gridRangeName.range), newToken = serializeRange(newRange);
|
|
18199
|
-
return {
|
|
18200
|
-
...node,
|
|
18201
|
-
token: newToken
|
|
18202
|
-
};
|
|
18203
|
-
}
|
|
18204
|
-
return node;
|
|
18205
|
-
}) : sequenceNodes;
|
|
18206
|
-
return `=${transformSequenceNodes && generateStringWithSequence(transformSequenceNodes)}`;
|
|
18207
|
-
}
|
|
18208
|
-
__name(transformFormula, "transformFormula");
|
|
18209
17621
|
export {
|
|
17622
|
+
ActiveDirtyManagerService,
|
|
18210
17623
|
ArrayValueObject,
|
|
17624
|
+
AstRootNodeFactory,
|
|
17625
|
+
AstTreeBuilder,
|
|
18211
17626
|
AsyncArrayObject,
|
|
18212
17627
|
AsyncObject,
|
|
18213
17628
|
BaseFunction,
|
|
@@ -18215,9 +17630,11 @@ export {
|
|
|
18215
17630
|
BaseValueObject,
|
|
18216
17631
|
BooleanValue,
|
|
18217
17632
|
BooleanValueObject,
|
|
17633
|
+
CalculateController,
|
|
18218
17634
|
CalculateFormulaService,
|
|
18219
17635
|
CustomFunction,
|
|
18220
17636
|
DefinedNamesService,
|
|
17637
|
+
DependencyManagerService,
|
|
18221
17638
|
ERROR_TYPE_SET,
|
|
18222
17639
|
ErrorType$1 as ErrorType,
|
|
18223
17640
|
ErrorValueObject,
|
|
@@ -18239,24 +17656,35 @@ export {
|
|
|
18239
17656
|
FeatureCalculationManagerService,
|
|
18240
17657
|
FormulaCurrentConfigService,
|
|
18241
17658
|
FormulaDataModel,
|
|
17659
|
+
FormulaDependencyGenerator,
|
|
18242
17660
|
FormulaExecuteStageType,
|
|
18243
17661
|
FormulaExecutedStateType,
|
|
18244
17662
|
FormulaRuntimeService,
|
|
17663
|
+
FunctionNodeFactory,
|
|
18245
17664
|
FunctionService,
|
|
18246
17665
|
FunctionType,
|
|
18247
17666
|
IActiveDirtyManagerService,
|
|
18248
17667
|
IDefinedNamesService,
|
|
17668
|
+
IDependencyManagerService,
|
|
18249
17669
|
IFeatureCalculationManagerService,
|
|
18250
17670
|
IFormulaCurrentConfigService,
|
|
18251
17671
|
IFormulaRuntimeService,
|
|
18252
17672
|
IFunctionService,
|
|
18253
17673
|
IOtherFormulaManagerService,
|
|
17674
|
+
ISuperTableService,
|
|
17675
|
+
Interpreter,
|
|
17676
|
+
LambdaNodeFactory,
|
|
17677
|
+
LambdaParameterNodeFactory,
|
|
17678
|
+
Lexer,
|
|
18254
17679
|
LexerNode,
|
|
18255
17680
|
LexerTreeBuilder,
|
|
18256
17681
|
NullValueObject,
|
|
18257
17682
|
NumberValueObject,
|
|
17683
|
+
OperatorNodeFactory,
|
|
18258
17684
|
OtherFormulaManagerService,
|
|
17685
|
+
PrefixNodeFactory,
|
|
18259
17686
|
RangeReferenceObject,
|
|
17687
|
+
ReferenceNodeFactory,
|
|
18260
17688
|
RegisterFunctionMutation,
|
|
18261
17689
|
RemoveDefinedNameMutation,
|
|
18262
17690
|
RemoveFeatureCalculationMutation,
|
|
@@ -18274,7 +17702,11 @@ export {
|
|
|
18274
17702
|
SetSuperTableMutation,
|
|
18275
17703
|
SetSuperTableOptionMutation,
|
|
18276
17704
|
StringValueObject,
|
|
17705
|
+
SuffixNodeFactory,
|
|
17706
|
+
SuperTableService,
|
|
17707
|
+
UnionNodeFactory,
|
|
18277
17708
|
UniverFormulaEnginePlugin,
|
|
17709
|
+
ValueNodeFactory,
|
|
18278
17710
|
ValueObjectFactory,
|
|
18279
17711
|
compareToken,
|
|
18280
17712
|
convertUnitDataToRuntime,
|
|
@@ -18304,7 +17736,6 @@ export {
|
|
|
18304
17736
|
includeFormulaLexerToken,
|
|
18305
17737
|
initSheetFormulaData,
|
|
18306
17738
|
isFormulaLexerToken,
|
|
18307
|
-
isFormulaTransformable,
|
|
18308
17739
|
isInDirtyRange,
|
|
18309
17740
|
isReferenceString,
|
|
18310
17741
|
isReferenceStringWithEffectiveColumn,
|
|
@@ -18320,6 +17751,5 @@ export {
|
|
|
18320
17751
|
serializeRangeWithSpreadsheet,
|
|
18321
17752
|
singleReferenceToGrid,
|
|
18322
17753
|
strip,
|
|
18323
|
-
stripErrorMargin
|
|
18324
|
-
transformFormula
|
|
17754
|
+
stripErrorMargin
|
|
18325
17755
|
};
|