react-semaphor 0.1.498 → 0.1.499
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/dist/analytics-protocol/index.cjs +1 -1
- package/dist/analytics-protocol/index.js +22 -22
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/briefings/index.cjs +1 -1
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/{calculated-field-identity-BGIPbwBx.js → calculated-field-identity-BC2NViZZ.js} +73 -63
- package/dist/chunks/{calculated-field-identity-CEzmY7Bi.cjs → calculated-field-identity-CtYhhZoG.cjs} +1 -1
- package/dist/chunks/{constants-CKoIADZx.js → constants-CTRduy1g.js} +9 -9
- package/dist/chunks/{constants-CpBVuEea.cjs → constants-DNgpRMaX.cjs} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-C8eAX-JN.js → dashboard-briefing-launcher-Bp6SBVb6.js} +9 -9
- package/dist/chunks/{dashboard-briefing-launcher-BEmyxEd8.cjs → dashboard-briefing-launcher-Dtzn9Tqg.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-YvJe7cPL.cjs → dashboard-controls-CLw5VQ2x.cjs} +1 -1
- package/dist/chunks/{dashboard-controls-C_v7sbq4.js → dashboard-controls-DDI3atQf.js} +11 -11
- package/dist/chunks/{dashboard-date-comparison-definition-aANgeL-E.js → dashboard-date-comparison-definition-C1vJshiP.js} +6 -6
- package/dist/chunks/{dashboard-date-comparison-definition-Er8D33iq.cjs → dashboard-date-comparison-definition-CWz_Yte8.cjs} +1 -1
- package/dist/chunks/{dashboard-json-CSp5bXIV.cjs → dashboard-json-BnT6W7Lt.cjs} +1 -1
- package/dist/chunks/{dashboard-json-BaT3Yy8x.js → dashboard-json-rHLrTBbN.js} +7 -7
- package/dist/chunks/{edit-dashboard-visual-GWiW0jjy.js → edit-dashboard-visual-BH2LkjHV.js} +6858 -6893
- package/dist/chunks/edit-dashboard-visual-DqAMe8XW.cjs +172 -0
- package/dist/chunks/{editor-action-buttons-BSC0nwgV.cjs → editor-action-buttons-Boq8MLya.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-CfZITZwQ.js → editor-action-buttons-DUEK2-kM.js} +6 -6
- package/dist/chunks/{field-aggregations-DLWbqnBW.cjs → field-aggregations-mlkON_QA.cjs} +1 -1
- package/dist/chunks/{field-aggregations-CxJWY4Ny.js → field-aggregations-tLaXZ2VJ.js} +13 -13
- package/dist/chunks/{field-dependencies-BiyQuGxZ.cjs → field-dependencies-R7MrlW6D.cjs} +1 -1
- package/dist/chunks/{field-dependencies-CNOgt39w.js → field-dependencies-ZE2klbHO.js} +1 -1
- package/dist/chunks/{index-BJfUMDHc.js → index-BVIet238.js} +42 -42
- package/dist/chunks/{index-C3RHKD3d.cjs → index-Bh3SlWJS.cjs} +1 -1
- package/dist/chunks/{index-DjbQVfS6.js → index-CEm8bwwd.js} +26924 -26927
- package/dist/chunks/{index-DhBGtRkR.cjs → index-Gos2ij10.cjs} +219 -219
- package/dist/chunks/{matrix-analytical-definition-s10yOPft.js → matrix-analytical-definition-CIVFNNnF.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-DbaMwlWM.cjs → matrix-analytical-definition-wIEDXvV5.cjs} +1 -1
- package/dist/chunks/{matrix-card-DGpXdK_Y.js → matrix-card-BVvKHL7s.js} +2 -2
- package/dist/chunks/{matrix-card-BitrcBVw.cjs → matrix-card-Dh0J0_Of.cjs} +1 -1
- package/dist/chunks/matrix-control-sources-CjnsBREg.js +605 -0
- package/dist/chunks/matrix-control-sources-a67fwoOO.cjs +1 -0
- package/dist/chunks/{matrix-definition-AP5W3wGc.js → matrix-definition-BEXCfZAe.js} +3 -3
- package/dist/chunks/{matrix-definition-C33isJ3k.cjs → matrix-definition-CKVi4VVg.cjs} +1 -1
- package/dist/chunks/{matrix-formatter-CZYFhdZ0.js → matrix-formatter-BTPfthsa.js} +41 -41
- package/dist/chunks/{matrix-formatter-UCXQxvV3.cjs → matrix-formatter-CWtdnbfv.cjs} +1 -1
- package/dist/chunks/{matrix-member-presentation-5-M0obIa.js → matrix-member-presentation-DiDUvZts.js} +1 -1
- package/dist/chunks/{matrix-member-presentation-DgIq9UG9.cjs → matrix-member-presentation-e_KZoZOx.cjs} +1 -1
- package/dist/chunks/{matrix-operation-contract-BFumahBa.js → matrix-operation-contract-CPgckXxm.js} +144 -144
- package/dist/chunks/{matrix-operation-contract-C0-V685e.cjs → matrix-operation-contract-thtFuUYf.cjs} +1 -1
- package/dist/chunks/{metric-comparison-ClKUI7Tu.cjs → metric-comparison-CAqV6VnZ.cjs} +1 -1
- package/dist/chunks/{metric-comparison-Df3HmmUE.js → metric-comparison-Dgyq1I3d.js} +1 -1
- package/dist/chunks/{pivot-header-presentation-CGWDx1V_.cjs → pivot-header-presentation-DUXM-VOP.cjs} +1 -1
- package/dist/chunks/{pivot-header-presentation-CAmKYLgn.js → pivot-header-presentation-DcCO8-Ij.js} +3 -3
- package/dist/chunks/{pivot-result-identity-DBeK76wx.js → pivot-result-identity-Be1zm0AV.js} +1 -1
- package/dist/chunks/{pivot-result-identity-0grcK7bY.cjs → pivot-result-identity-DJyF4I2K.cjs} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DVPJg7Gg.js → pivot-result-lifecycle-DpSZOMOZ.js} +7 -7
- package/dist/chunks/{pivot-result-lifecycle-CC0jWMFT.cjs → pivot-result-lifecycle-E_huAPev.cjs} +1 -1
- package/dist/chunks/{raw-temporal-Kc3mdzH7.cjs → raw-temporal-DYoPBY6B.cjs} +1 -1
- package/dist/chunks/{raw-temporal-T3PEaGmJ.js → raw-temporal-DfnRBxQn.js} +2 -2
- package/dist/chunks/{raw-temporal-contract-Ck5vJoQ6.js → raw-temporal-contract-CNwYygW2.js} +1 -1
- package/dist/chunks/{raw-temporal-contract-SwtP1jSh.cjs → raw-temporal-contract-D1_n2pBj.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-B8DdDM7q.js → report-preferences-dialog-8nfXNWvl.js} +6 -6
- package/dist/chunks/{report-preferences-dialog-BcaEOgn2.cjs → report-preferences-dialog-CW59SyVZ.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-D3t8vyl9.cjs → report-runtime-context-CqFbgZq9.cjs} +1 -1
- package/dist/chunks/{report-runtime-context-BziN1eg9.js → report-runtime-context-Dln1qvGS.js} +5 -5
- package/dist/chunks/{semantic-format-Ca-sdETk.cjs → semantic-format-C7Goni6h.cjs} +1 -1
- package/dist/chunks/{semantic-format-A3k--fpE.js → semantic-format-PKQt2EAz.js} +2 -2
- package/dist/chunks/{source-entity-resolution-CTUzMH2S.cjs → source-entity-resolution-BMKxwdKN.cjs} +1 -1
- package/dist/chunks/{source-entity-resolution-DX9C1ebK.js → source-entity-resolution-BSZ07Sl6.js} +19 -19
- package/dist/chunks/{switch-DV8zX7rV.js → switch-B4wVqV4L.js} +51 -50
- package/dist/chunks/{switch-CgycqpWv.cjs → switch-DVjKkt22.cjs} +12 -12
- package/dist/chunks/{temporal-bucket-contract-BBdvWsY0.cjs → temporal-bucket-contract-CSdspcYj.cjs} +1 -1
- package/dist/chunks/{temporal-bucket-contract-lq7Jrif0.js → temporal-bucket-contract-_WCvDnvn.js} +1 -1
- package/dist/chunks/{update-policy-DIw_H9RT.cjs → update-policy-BESKAspa.cjs} +1 -1
- package/dist/chunks/{update-policy-EgZ1nRbd.js → update-policy-BWbXhkk-.js} +2 -2
- package/dist/chunks/{validators-CvLOGzT3.js → validators-CHlnnHuS.js} +1102 -1043
- package/dist/chunks/validators-D2F_uxxP.cjs +1 -0
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.cjs +3 -3
- package/dist/dashboard-authoring/index.js +112 -107
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/data-app-codegen/index.cjs +1 -1
- package/dist/data-app-codegen/index.js +2 -2
- package/dist/data-app-codegen-node/index.cjs +1 -1
- package/dist/data-app-codegen-node/index.js +3 -3
- package/dist/data-app-sdk/index.cjs +1 -1
- package/dist/data-app-sdk/index.js +4 -4
- package/dist/data-app-sdk-adapters/index.cjs +1 -1
- package/dist/data-app-sdk-adapters/index.js +2 -2
- package/dist/data-app-sdk-validation/index.cjs +1 -1
- package/dist/data-app-sdk-validation/index.js +5 -5
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +16 -16
- package/dist/index.cjs +1 -1
- package/dist/index.js +81 -78
- package/dist/report-runtime-context/index.cjs +1 -1
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/analytics-protocol.d.ts +15 -0
- package/dist/types/briefings.d.ts +16 -1
- package/dist/types/dashboard-assistant.d.ts +15 -0
- package/dist/types/dashboard-authoring.d.ts +49 -1
- package/dist/types/dashboard.d.ts +23 -1
- package/dist/types/data-app-builder.d.ts +15 -0
- package/dist/types/data-app-codegen-node.d.ts +15 -0
- package/dist/types/data-app-codegen.d.ts +15 -0
- package/dist/types/data-app-sdk-adapters.d.ts +15 -0
- package/dist/types/data-app-sdk-validation.d.ts +15 -0
- package/dist/types/data-app-sdk.d.ts +15 -0
- package/dist/types/format-utils.d.ts +15 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +30 -27
- package/dist/types/main.d.ts +67 -8
- package/dist/types/shared.d.ts +16 -1
- package/dist/types/surfboard.d.ts +23 -1
- package/dist/types/types.d.ts +67 -8
- package/package.json +1 -1
- package/dist/chunks/edit-dashboard-visual-_Wap0YGu.cjs +0 -172
- package/dist/chunks/matrix-control-sources-DdfST7Fo.cjs +0 -1
- package/dist/chunks/matrix-control-sources-Dxh6hOU9.js +0 -523
- package/dist/chunks/validators-mhiJSia7.cjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u,
|
|
2
|
-
function
|
|
1
|
+
import { x as u, r as f, y as p, o as i, t as d } from "./validators-CHlnnHuS.js";
|
|
2
|
+
function b(e, t) {
|
|
3
3
|
return t.levelLabels[e.id] ?? e.field.label ?? e.field.name;
|
|
4
4
|
}
|
|
5
5
|
function v(e, t) {
|
|
@@ -81,7 +81,7 @@ export {
|
|
|
81
81
|
v as a,
|
|
82
82
|
g as b,
|
|
83
83
|
w as c,
|
|
84
|
-
|
|
84
|
+
b as g,
|
|
85
85
|
h as m,
|
|
86
86
|
M as r
|
|
87
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("./validators-
|
|
1
|
+
"use strict";const i=require("./validators-D2F_uxxP.cjs");function d(e,t){return t.levelLabels[e.id]??e.field.label??e.field.name}function p(e,t){return t.measureLabels[e.id]??(e.kind==="aggregate"?e.field.label??e.field.name:e.definition.label)}function x(e){return i.matrixConfigSchema.parse(m(e))}function m(e){const t=i.matrixAuthoringSpecSchema.parse(e),n=a=>({grand:{visible:!0,position:"after"},levels:Object.fromEntries(a.map(r=>[r.id,{visible:!0,position:"before"}]))});return i.matrixAuthoringConfigSchema.parse({version:1,spec:t,presentation:{layout:{kind:"compact"},absence:{emptyText:"—",nullText:""},levelLabels:{},measureLabels:{},levelFormats:{},measureFormats:{},totals:{rows:n(t.rows),columns:n(t.columns)}},defaultView:{rows:{depth:0,overrides:[]},columns:{depth:t.columns.length>1?1:0,overrides:[]}}})}function f(e,t){const n=new Map(e.map(a=>[i.matrixSortKey(a),a]));for(const a of t??[])n.set(i.matrixSortKey(a),a);return[...n.values()]}function g(e){const{spec:t,presentation:n,defaults:a,session:r}=i.matrixDefinitionInputSchema.parse(e),c=new Map(f(t.sorts,r==null?void 0:r.sorts).map(o=>[i.matrixSortKey(o),o]));for(const o of["rows","columns"])for(const l of t[o]){const s={axis:o,levelId:l.id,scope:{kind:"level"},target:{kind:"member"},direction:"asc",nulls:"last"};c.has(i.matrixSortKey(s))||c.set(i.matrixSortKey(s),s)}const u=(o,l)=>({depth:Math.min(o.depth,Math.max(0,l-1)),overrides:o.overrides.filter(s=>s.path.length<l)});return{spec:{...t,sorts:[...c.values()]},presentation:n,view:{rows:u((r==null?void 0:r.rows)??a.rows,t.rows.length),columns:u((r==null?void 0:r.columns)??a.columns,t.columns.length),sorts:(r==null?void 0:r.sorts)??[]}}}exports.createMatrixAuthoringDraft=m;exports.createMatrixConfig=x;exports.getMatrixLevelLabel=d;exports.getMatrixMeasureLabel=p;exports.mergeMatrixSorts=f;exports.resolveMatrixDefinition=g;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./matrix-operation-contract-
|
|
3
|
-
import { t as
|
|
4
|
-
import { f as
|
|
1
|
+
import { b4 as L, S as T, ak as _ } from "./validators-CHlnnHuS.js";
|
|
2
|
+
import "./matrix-operation-contract-CPgckXxm.js";
|
|
3
|
+
import { t as d, c as P, g as $, e as C, a as x, b as O, d as A, f as Z, i as k } from "./semantic-format-PKQt2EAz.js";
|
|
4
|
+
import { f as R, s as U, k as z, j as V, b as X } from "./raw-temporal-DfnRBxQn.js";
|
|
5
5
|
import { b as p, c as M } from "./constants-DeLIHVAW.js";
|
|
6
6
|
import { f as j } from "./index-CACdoqu3.js";
|
|
7
7
|
import { d as E, f as Y } from "./temporal-bucket-B9hMwemw.js";
|
|
8
|
-
const
|
|
8
|
+
const N = [
|
|
9
9
|
"day",
|
|
10
10
|
"hour",
|
|
11
11
|
"minute",
|
|
@@ -36,12 +36,12 @@ function H(e) {
|
|
|
36
36
|
function v(e, t) {
|
|
37
37
|
return H(e) ? e : t;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
return
|
|
39
|
+
function w(e, t) {
|
|
40
|
+
return N.indexOf(v(e, t));
|
|
41
41
|
}
|
|
42
42
|
function W(e, t) {
|
|
43
|
-
const n =
|
|
44
|
-
return
|
|
43
|
+
const n = w(e, "day"), s = w(t, "second"), r = Math.min(n, s), o = Math.max(n, s);
|
|
44
|
+
return N.slice(r, o + 1);
|
|
45
45
|
}
|
|
46
46
|
function G(e, t) {
|
|
47
47
|
return e * b[v(t, "second")];
|
|
@@ -88,14 +88,14 @@ function te(e, t = {}) {
|
|
|
88
88
|
return ee(c, o, t);
|
|
89
89
|
}
|
|
90
90
|
function g(e, t) {
|
|
91
|
-
const n =
|
|
91
|
+
const n = d(e), s = d(t), r = n.getTime() - s.getTime();
|
|
92
92
|
return r < 0 ? -1 : r > 0 ? 1 : r;
|
|
93
93
|
}
|
|
94
94
|
function ne(e) {
|
|
95
95
|
return P(e, Date.now());
|
|
96
96
|
}
|
|
97
97
|
function re(e, t) {
|
|
98
|
-
const n =
|
|
98
|
+
const n = d(e), s = d(t), r = n.getFullYear() - s.getFullYear(), o = n.getMonth() - s.getMonth();
|
|
99
99
|
return r * 12 + o;
|
|
100
100
|
}
|
|
101
101
|
function se(e) {
|
|
@@ -105,22 +105,22 @@ function se(e) {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
function oe(e, t) {
|
|
108
|
-
return +
|
|
108
|
+
return +d(e) - +d(t);
|
|
109
109
|
}
|
|
110
110
|
function ae(e) {
|
|
111
|
-
const t =
|
|
111
|
+
const t = d(e);
|
|
112
112
|
return t.setHours(23, 59, 59, 999), t;
|
|
113
113
|
}
|
|
114
114
|
function ie(e) {
|
|
115
|
-
const t =
|
|
115
|
+
const t = d(e), n = t.getMonth();
|
|
116
116
|
return t.setFullYear(t.getFullYear(), n + 1, 0), t.setHours(23, 59, 59, 999), t;
|
|
117
117
|
}
|
|
118
118
|
function ue(e) {
|
|
119
|
-
const t =
|
|
119
|
+
const t = d(e);
|
|
120
120
|
return +ae(t) == +ie(t);
|
|
121
121
|
}
|
|
122
122
|
function ce(e, t) {
|
|
123
|
-
const n =
|
|
123
|
+
const n = d(e), s = d(t), r = g(n, s), o = Math.abs(
|
|
124
124
|
re(n, s)
|
|
125
125
|
);
|
|
126
126
|
let u;
|
|
@@ -129,7 +129,7 @@ function ce(e, t) {
|
|
|
129
129
|
else {
|
|
130
130
|
n.getMonth() === 1 && n.getDate() > 27 && n.setDate(30), n.setMonth(n.getMonth() - r * o);
|
|
131
131
|
let a = g(n, s) === -r;
|
|
132
|
-
ue(
|
|
132
|
+
ue(d(e)) && o === 1 && g(e, s) === 1 && (a = !1), u = r * (o - Number(a));
|
|
133
133
|
}
|
|
134
134
|
return u === 0 ? 0 : u;
|
|
135
135
|
}
|
|
@@ -146,9 +146,9 @@ function fe(e, t, n) {
|
|
|
146
146
|
comparison: u
|
|
147
147
|
});
|
|
148
148
|
let c, i;
|
|
149
|
-
u > 0 ? (c =
|
|
149
|
+
u > 0 ? (c = d(t), i = d(e)) : (c = d(e), i = d(t));
|
|
150
150
|
const m = le(i, c), f = (x(i) - x(c)) / 1e3, l = Math.round((m - f) / 60);
|
|
151
|
-
let
|
|
151
|
+
let h;
|
|
152
152
|
if (l < 2)
|
|
153
153
|
return n != null && n.includeSeconds ? m < 5 ? r.formatDistance("lessThanXSeconds", 5, a) : m < 10 ? r.formatDistance("lessThanXSeconds", 10, a) : m < 20 ? r.formatDistance("lessThanXSeconds", 20, a) : m < 40 ? r.formatDistance("halfAMinute", 0, a) : m < 60 ? r.formatDistance("lessThanXMinutes", 1, a) : r.formatDistance("xMinutes", 1, a) : l === 0 ? r.formatDistance("lessThanXMinutes", 1, a) : r.formatDistance("xMinutes", l, a);
|
|
154
154
|
if (l < 45)
|
|
@@ -165,20 +165,20 @@ function fe(e, t, n) {
|
|
|
165
165
|
const y = Math.round(l / p);
|
|
166
166
|
return r.formatDistance("xDays", y, a);
|
|
167
167
|
} else if (l < M * 2)
|
|
168
|
-
return
|
|
168
|
+
return h = Math.round(l / M), r.formatDistance("aboutXMonths", h, a);
|
|
169
169
|
}
|
|
170
|
-
if (
|
|
170
|
+
if (h = ce(i, c), h < 12) {
|
|
171
171
|
const y = Math.round(l / M);
|
|
172
172
|
return r.formatDistance("xMonths", y, a);
|
|
173
173
|
} else {
|
|
174
|
-
const y =
|
|
174
|
+
const y = h % 12, D = Math.trunc(h / 12);
|
|
175
175
|
return y < 3 ? r.formatDistance("aboutXYears", D, a) : y < 9 ? r.formatDistance("overXYears", D, a) : r.formatDistance("almostXYears", D + 1, a);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
function me(e, t) {
|
|
179
179
|
return fe(e, ne(e), t);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function Ie(e, t) {
|
|
182
182
|
return e && e !== "auto" ? e : t;
|
|
183
183
|
}
|
|
184
184
|
function Le(e, t = /* @__PURE__ */ new Date()) {
|
|
@@ -205,7 +205,7 @@ function _e(e) {
|
|
|
205
205
|
return e;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function S(e, t = "auto") {
|
|
209
209
|
if (!e)
|
|
210
210
|
return /* @__PURE__ */ new Date(NaN);
|
|
211
211
|
const n = e.endsWith("Z"), s = /[+-]\d{2}:?\d{2}$/.test(e), r = /\([A-Z]{3,4}\)$/.test(e);
|
|
@@ -219,14 +219,14 @@ function I(e, t = "auto") {
|
|
|
219
219
|
return new Date(e);
|
|
220
220
|
} else return t === "UTC" ? n ? new Date(e) : s ? new Date(e) : /* @__PURE__ */ new Date(e + "Z") : n || s || r ? new Date(e) : j(e, t);
|
|
221
221
|
}
|
|
222
|
-
const
|
|
222
|
+
const de = "MM/dd/yyyy", he = (e, t, n, s = "auto") => {
|
|
223
223
|
if (!e)
|
|
224
224
|
return "";
|
|
225
225
|
try {
|
|
226
|
-
const r =
|
|
226
|
+
const r = S(e, s);
|
|
227
227
|
if (isNaN(r.getTime()))
|
|
228
228
|
return e;
|
|
229
|
-
const u = (t && t.trim() ? t :
|
|
229
|
+
const u = (t && t.trim() ? t : de).replace(/LLLL/g, "MMMM").replace(/LLL/g, "MMM");
|
|
230
230
|
return n && n !== "auto" ? O(r, n, u) : A(r, u);
|
|
231
231
|
} catch (r) {
|
|
232
232
|
return console.error("Date formatting error:", r), e;
|
|
@@ -235,7 +235,7 @@ const he = "MM/dd/yyyy", de = (e, t, n, s = "auto") => {
|
|
|
235
235
|
if (!e)
|
|
236
236
|
return "";
|
|
237
237
|
try {
|
|
238
|
-
const n =
|
|
238
|
+
const n = S(e, t);
|
|
239
239
|
return isNaN(n.getTime()) ? e : me(n, { addSuffix: !0 });
|
|
240
240
|
} catch (n) {
|
|
241
241
|
return console.error("Relative time formatting error:", n), e;
|
|
@@ -249,14 +249,14 @@ function Me(e, t, n, s) {
|
|
|
249
249
|
(t == null ? void 0 : t.sourceTimezone) || "auto"
|
|
250
250
|
);
|
|
251
251
|
const a = t != null && t.useCustomFormat && (t != null && t.customFormat) ? t.customFormat : (t == null ? void 0 : t.format) || "MM/dd/yyyy";
|
|
252
|
-
return
|
|
252
|
+
return he(
|
|
253
253
|
r,
|
|
254
254
|
a,
|
|
255
255
|
t != null && t.timezone && (t == null ? void 0 : t.timezone) !== "auto" ? t.timezone : u ? o : n,
|
|
256
256
|
(t == null ? void 0 : t.sourceTimezone) || "auto"
|
|
257
257
|
);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function I(e, t, n) {
|
|
260
260
|
var u, a;
|
|
261
261
|
if (e == null)
|
|
262
262
|
return e === null ? ((u = n.absence) == null ? void 0 : u.nullText) ?? "" : ((a = n.absence) == null ? void 0 : a.emptyText) ?? "";
|
|
@@ -265,7 +265,7 @@ function S(e, t, n) {
|
|
|
265
265
|
return String(r);
|
|
266
266
|
switch (t.type) {
|
|
267
267
|
case "number":
|
|
268
|
-
return o !== void 0 ?
|
|
268
|
+
return o !== void 0 ? R(
|
|
269
269
|
o,
|
|
270
270
|
t.numberFormat,
|
|
271
271
|
n.locale
|
|
@@ -293,7 +293,7 @@ function S(e, t, n) {
|
|
|
293
293
|
function Pe(e, t) {
|
|
294
294
|
return t.visibleColumns.map((n) => {
|
|
295
295
|
const s = e[n], r = t.columnSettings[n];
|
|
296
|
-
return
|
|
296
|
+
return I(s, r, {
|
|
297
297
|
useFormattedValues: t.useFormattedValues,
|
|
298
298
|
timezone: t.timezone,
|
|
299
299
|
locale: t.locale
|
|
@@ -344,7 +344,7 @@ function Ae(e, t, n) {
|
|
|
344
344
|
// Use normalized affixes: a redundant percent suffix is already removed.
|
|
345
345
|
hasTextAffixes: !!i && !!("prefix" in i && i.prefix || "suffix" in i && i.suffix)
|
|
346
346
|
});
|
|
347
|
-
const m = (f) =>
|
|
347
|
+
const m = (f) => I(f, void 0, {
|
|
348
348
|
useFormattedValues: !0,
|
|
349
349
|
timezone: n.calendar.tz,
|
|
350
350
|
locale: n.valueFormat.locale,
|
|
@@ -358,7 +358,7 @@ function Ae(e, t, n) {
|
|
|
358
358
|
locale: n.valueFormat.locale,
|
|
359
359
|
styles: { dateStyle: n.valueFormat.dateStyle, dateTime: n.valueFormat.dateTime }
|
|
360
360
|
});
|
|
361
|
-
return (
|
|
361
|
+
return (h) => typeof h == "string" ? Y({ value: h, metadata: f, format: l.format }) : m(h);
|
|
362
362
|
}
|
|
363
363
|
if (o.column.rawTemporal) {
|
|
364
364
|
const f = U({
|
|
@@ -380,11 +380,11 @@ function Ae(e, t, n) {
|
|
|
380
380
|
});
|
|
381
381
|
return (l) => {
|
|
382
382
|
if (typeof l != "string") return m(l);
|
|
383
|
-
const
|
|
384
|
-
return
|
|
383
|
+
const h = f(l);
|
|
384
|
+
return h.ok ? h.text : m(l);
|
|
385
385
|
};
|
|
386
386
|
}
|
|
387
|
-
if (
|
|
387
|
+
if (k(i)) {
|
|
388
388
|
const f = V(i, n.valueFormat);
|
|
389
389
|
return (l) => typeof l == "number" || typeof l == "object" && l !== null ? X(l, f) : m(l);
|
|
390
390
|
}
|
|
@@ -408,17 +408,17 @@ export {
|
|
|
408
408
|
Oe as b,
|
|
409
409
|
Ce as c,
|
|
410
410
|
te as d,
|
|
411
|
-
|
|
411
|
+
he as e,
|
|
412
412
|
Pe as f,
|
|
413
413
|
ye as g,
|
|
414
414
|
Le as h,
|
|
415
415
|
_e as i,
|
|
416
|
-
|
|
417
|
-
|
|
416
|
+
S as j,
|
|
417
|
+
I as k,
|
|
418
418
|
me as l,
|
|
419
419
|
ge as m,
|
|
420
420
|
be as n,
|
|
421
421
|
De as o,
|
|
422
422
|
Ae as p,
|
|
423
|
-
|
|
423
|
+
Ie as r
|
|
424
424
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const T=require("./validators-mhiJSia7.cjs");require("./matrix-operation-contract-C0-V685e.cjs");const f=require("./semantic-format-Ca-sdETk.cjs"),y=require("./raw-temporal-Kc3mdzH7.cjs"),M=require("./constants-B00YUv89.cjs"),R=require("./index-F25jnH0p.cjs"),v=require("./temporal-bucket-4YEPEKlJ.cjs"),I=["day","hour","minute","second","millisecond"],x={day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},Z={day:"d",hour:"hr",minute:"min",second:"s",millisecond:"ms"},z={day:["day","days"],hour:["hour","hours"],minute:["minute","minutes"],second:["second","seconds"],millisecond:["millisecond","milliseconds"]};function U(e){return e==="day"||e==="hour"||e==="minute"||e==="second"||e==="millisecond"}function L(e,t){return U(e)?e:t}function N(e,t){return I.indexOf(L(e,t))}function k(e,t){const n=N(e,"day"),s=N(t,"second"),r=Math.min(n,s),o=Math.max(n,s);return I.slice(r,o+1)}function V(e,t){return e*x[L(t,"second")]}function q(e,t){const n=k(t.largestUnit,t.smallestUnit),s=n[n.length-1],r=x[s];let o=Math.round(e/r)*r;return n.map(u=>{const a=x[u],c=Math.floor(o/a);return o-=c*a,{unit:u,value:c}})}function X(e,t){const n=e.filter(o=>o.value!==0),s=n.length>0?n:[e[e.length-1]],r=typeof t=="number"&&Number.isFinite(t)?Math.max(1,Math.trunc(t)):s.length;return s.slice(0,r).map(o=>`${o.value}${Z[o.unit]}`).join(" ")}function E(e,t){const n=e.filter(o=>o.value!==0),s=n.length>0?n:[e[e.length-1]],r=typeof t=="number"&&Number.isFinite(t)?Math.max(1,Math.trunc(t)):s.length;return s.slice(0,r).map(o=>{const[u,a]=z[o.unit];return`${o.value} ${o.value===1?u:a}`}).join(" ")}function j(e){const t=e.some(c=>c.unit==="day"&&c.value!==0),n=e.some(c=>c.unit==="millisecond"),s=e.findIndex(c=>c.value!==0),r=Math.max(0,e.length-2),o=t?0:s===-1?r:Math.min(s,r),u=s===-1?e.slice(r):e.slice(o);if(u.length===0)return"0";const a=u.map((c,i)=>c.unit==="millisecond"?String(c.value).padStart(3,"0"):i===0?String(c.value):String(c.value).padStart(2,"0")).join(":");return n?a.replace(/:(\d{3})$/,".$1"):a}function B(e,t,n){const s=`${n.prefix||""}${e}${n.suffix||""}`;return t?n.negativeInParentheses?`(${s})`:`-${s}`:s}function S(e,t={}){if(e==null)return"";const n=typeof e=="number"?e:typeof e=="string"&&e.trim()?Number(e):NaN;if(!Number.isFinite(n))return"";const s=t.inputUnit||"second",r=t.outputStyle==="digital"||t.outputStyle==="long"?t.outputStyle:"compact",o=n<0,u=Math.abs(V(n,s)),a=q(u,t),c=r==="digital"?j(a):r==="long"?E(a,t.maxUnits):X(a,t.maxUnits);return B(c,o,t)}function g(e,t){const n=f.toDate(e),s=f.toDate(t),r=n.getTime()-s.getTime();return r<0?-1:r>0?1:r}function Y(e){return f.constructFrom(e,Date.now())}function W(e,t){const n=f.toDate(e),s=f.toDate(t),r=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return r*12+o}function F(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function H(e,t){return+f.toDate(e)-+f.toDate(t)}function G(e){const t=f.toDate(e);return t.setHours(23,59,59,999),t}function K(e){const t=f.toDate(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function J(e){const t=f.toDate(e);return+G(t)==+K(t)}function Q(e,t){const n=f.toDate(e),s=f.toDate(t),r=g(n,s),o=Math.abs(W(n,s));let u;if(o<1)u=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*o);let a=g(n,s)===-r;J(f.toDate(e))&&o===1&&g(e,s)===1&&(a=!1),u=r*(o-Number(a))}return u===0?0:u}function ee(e,t,n){const s=H(e,t)/1e3;return F(n==null?void 0:n.roundingMethod)(s)}function te(e,t,n){const s=f.getDefaultOptions(),r=(n==null?void 0:n.locale)??s.locale??f.enUS,o=2520,u=g(e,t);if(isNaN(u))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:u});let c,i;u>0?(c=f.toDate(t),i=f.toDate(e)):(c=f.toDate(e),i=f.toDate(t));const h=ee(i,c),m=(f.getTimezoneOffsetInMilliseconds(i)-f.getTimezoneOffsetInMilliseconds(c))/1e3,l=Math.round((h-m)/60);let d;if(l<2)return n!=null&&n.includeSeconds?h<5?r.formatDistance("lessThanXSeconds",5,a):h<10?r.formatDistance("lessThanXSeconds",10,a):h<20?r.formatDistance("lessThanXSeconds",20,a):h<40?r.formatDistance("halfAMinute",0,a):h<60?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",1,a):l===0?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",l,a);if(l<45)return r.formatDistance("xMinutes",l,a);if(l<90)return r.formatDistance("aboutXHours",1,a);if(l<M.minutesInDay){const D=Math.round(l/60);return r.formatDistance("aboutXHours",D,a)}else{if(l<o)return r.formatDistance("xDays",1,a);if(l<M.minutesInMonth){const D=Math.round(l/M.minutesInDay);return r.formatDistance("xDays",D,a)}else if(l<M.minutesInMonth*2)return d=Math.round(l/M.minutesInMonth),r.formatDistance("aboutXMonths",d,a)}if(d=Q(i,c),d<12){const D=Math.round(l/M.minutesInMonth);return r.formatDistance("xMonths",D,a)}else{const D=d%12,b=Math.trunc(d/12);return D<3?r.formatDistance("aboutXYears",b,a):D<9?r.formatDistance("overXYears",b,a):r.formatDistance("almostXYears",b+1,a)}}function _(e,t){return te(e,Y(e),t)}function ne(e,t){return e&&e!=="auto"?e:t}function re(e,t=new Date){try{const n={timeZone:e,timeZoneName:"short"},r=new Intl.DateTimeFormat("en-US",n).formatToParts(t).find(o=>o.type==="timeZoneName");return(r==null?void 0:r.value)||e}catch{return e}}function se(e){try{const t={timeZone:e,timeZoneName:"long"},s=new Intl.DateTimeFormat("en-US",t).formatToParts(new Date).find(r=>r.type==="timeZoneName");return(s==null?void 0:s.value)||e}catch{return e}}function p(e,t="auto"){if(!e)return new Date(NaN);const n=e.endsWith("Z"),s=/[+-]\d{2}:?\d{2}$/.test(e),r=/\([A-Z]{3,4}\)$/.test(e);if(t==="auto")return n||s||r?new Date(e):new Date(e+"Z");if(t==="local"){if(n||s){const o=e.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(o)}return new Date(e)}else return t==="UTC"?n?new Date(e):s?new Date(e):new Date(e+"Z"):n||s||r?new Date(e):R.fromZonedTime(e,t)}const oe="MM/dd/yyyy",C=(e,t,n,s="auto")=>{if(!e)return"";try{const r=p(e,s);if(isNaN(r.getTime()))return e;const u=(t&&t.trim()?t:oe).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return n&&n!=="auto"?f.formatInTimeZone(r,n,u):f.format(r,u)}catch(r){return console.error("Date formatting error:",r),e}},P=(e,t="auto")=>{if(!e)return"";try{const n=p(e,t);return isNaN(n.getTime())?e:_(n,{addSuffix:!0})}catch(n){return console.error("Relative time formatting error:",n),e}};function ae(e,t,n,s){const r=e instanceof Date?e.toISOString():String(e),o=(s==null?void 0:s.browserTimezone)||n,u=(s==null?void 0:s.isSqlCard)??!1;if(t!=null&&t.useRelativeTime)return P(r,(t==null?void 0:t.sourceTimezone)||"auto");const a=t!=null&&t.useCustomFormat&&(t!=null&&t.customFormat)?t.customFormat:(t==null?void 0:t.format)||"MM/dd/yyyy";return C(r,a,t!=null&&t.timezone&&(t==null?void 0:t.timezone)!=="auto"?t.timezone:u?o:n,(t==null?void 0:t.sourceTimezone)||"auto")}function w(e,t,n){var u,a;if(e==null)return e===null?((u=n.absence)==null?void 0:u.nullText)??"":((a=n.absence)==null?void 0:a.emptyText)??"";const s=T.isExactNumericValue(e)?e:void 0,r=s?s.value:e,o=s??(typeof e=="number"?e:void 0);if(!n.useFormattedValues||!t)return String(r);switch(t.type){case"number":return o!==void 0?y.formatNumberWithColumnSettings(o,t.numberFormat,n.locale):String(r);case"date":return ae(r,t.dateFormat,n.timezone,{browserTimezone:n.browserTimezone,isSqlCard:n.isSqlCard});case"progress":return o!==void 0?`${r}%`:String(r);case"badge":case"link":case"text":case"none":default:return String(r)}}function ie(e,t){return t.visibleColumns.map(n=>{const s=e[n],r=t.columnSettings[n];return w(s,r,{useFormattedValues:t.useFormattedValues,timezone:t.timezone,locale:t.locale})})}function A(e,t){var r;const n=e[e.length-1];if(!n)return"";if(n.member.kind==="others")return"Others";const s=n.member.value;return s===null?"(Blank)":((r=t==null?void 0:t.get(n.levelId))==null?void 0:r(s))??(typeof s=="object"?s.value:String(s))}function O(e,t,n){return e==="grand_total"?n??"Grand Total":e==="subtotal"?n??`${t} Total`:t}function ue(e,t,n,s){var u;const r=e[e.length-1],o=t==="grand_total"?n.grand.label:r?(u=n.levels[r.levelId])==null?void 0:u.label:void 0;return O(t,A(e,s),o)}function ce(e,t,n){return e.kind==="value"?(t==null?void 0:t(e.value))??"":e.kind==="null"?n.nullText:n.emptyText}function le(e){const{path:t,previousPath:n,role:s,repeatLabels:r,levelCount:o}=e;return Array.from({length:o},(u,a)=>{const c=t.slice(0,a+1),i=s==="grand_total"?a===0:s==="subtotal"&&a===t.length-1,h=n&&n.length>a&&T.matrixPathKey(n.slice(0,a+1))===T.matrixPathKey(c);return{path:c,total:i,visible:i||t.length>a&&(r||!h||a===t.length-1)}})}function $(e,t){return f.fromSemanticFormat(e??t,{preserveOmittedProperties:!0,numericInput:"canonical"})}function fe(e,t,n){const s=new Map,r=(o,u)=>{const a=(u==="levels"?t.levelFormats:t.measureFormats)[o.id],c=o.semanticFormat,i=$(a,c);u==="measures"&&s.set(o.id,{isNumeric:T.normalizeAnalyticsCatalogDataType(o.column.dataType)==="number",hasTextAffixes:!!i&&!!("prefix"in i&&i.prefix||"suffix"in i&&i.suffix)});const h=m=>w(m,void 0,{useFormattedValues:!0,timezone:n.calendar.tz,locale:n.valueFormat.locale,absence:t.absence});if(o.column.temporalBucket){const m=o.column.temporalBucket,l=v.resolveTemporalBucketPresentation({metadata:m,cardFormat:(a==null?void 0:a.type)==="temporal_bucket"?a:void 0,semanticFormat:(c==null?void 0:c.type)==="temporal_bucket"?{granularity:m.granularity,format:c}:void 0,locale:n.valueFormat.locale,styles:{dateStyle:n.valueFormat.dateStyle,dateTime:n.valueFormat.dateTime}});return d=>typeof d=="string"?v.formatTemporalBucket({value:d,metadata:m,format:l.format}):h(d)}if(o.column.rawTemporal){const m=y.prepareRawTemporalFormatter({metadata:o.column.rawTemporal,format:y.resolveRawTemporalFormat({format:(i==null?void 0:i.type)==="date"?{type:"raw_temporal",timezone:i.timezone,sourceTimezone:i.sourceTimezone,presentation:i.pattern?{mode:"pattern",dialect:"semaphor_tokens",pattern:i.pattern}:{mode:"auto"}}:void 0,preferences:n.valueFormat,calendar:n.calendar})});return l=>{if(typeof l!="string")return h(l);const d=m(l);return d.ok?d.text:h(l)}}if(f.isNumericCanonicalFormat(i)){const m=y.resolveNumericPresentation(i,n.valueFormat);return l=>typeof l=="number"||typeof l=="object"&&l!==null?y.formatNumericCanonical(l,m):h(l)}return(i==null?void 0:i.type)==="duration"?m=>typeof m=="number"||typeof m=="string"||typeof m=="object"&&m!==null?S(typeof m=="object"?m.value:m,i):h(m):(i==null?void 0:i.type)==="string"?m=>m===null?h(m):`${i.prefix??""}${h(m)}${i.suffix??""}`:h};return{levels:new Map(e.levels.map(o=>[o.id,r(o,"levels")])),measures:new Map(e.measures.map(o=>[o.id,r(o,"measures")])),measureSemantics:s}}exports.formatCellValue=w;exports.formatDate=C;exports.formatDistanceToNow=_;exports.formatDuration=S;exports.formatRelativeTime=P;exports.formatRowForExport=ie;exports.getTimezoneAbbreviation=re;exports.getTimezoneName=se;exports.matrixAxisLabel=ue;exports.matrixCellText=ce;exports.matrixLevelLabels=le;exports.matrixMemberLabel=A;exports.matrixTotalLabel=O;exports.parseWithSourceTimezone=p;exports.prepareMatrixFormatting=fe;exports.resolveMatrixValueFormat=$;exports.resolveTimezone=ne;
|
|
1
|
+
"use strict";const T=require("./validators-D2F_uxxP.cjs");require("./matrix-operation-contract-thtFuUYf.cjs");const f=require("./semantic-format-C7Goni6h.cjs"),y=require("./raw-temporal-DYoPBY6B.cjs"),M=require("./constants-B00YUv89.cjs"),R=require("./index-F25jnH0p.cjs"),v=require("./temporal-bucket-4YEPEKlJ.cjs"),I=["day","hour","minute","second","millisecond"],x={day:864e5,hour:36e5,minute:6e4,second:1e3,millisecond:1},Z={day:"d",hour:"hr",minute:"min",second:"s",millisecond:"ms"},z={day:["day","days"],hour:["hour","hours"],minute:["minute","minutes"],second:["second","seconds"],millisecond:["millisecond","milliseconds"]};function U(e){return e==="day"||e==="hour"||e==="minute"||e==="second"||e==="millisecond"}function L(e,t){return U(e)?e:t}function N(e,t){return I.indexOf(L(e,t))}function k(e,t){const n=N(e,"day"),s=N(t,"second"),r=Math.min(n,s),o=Math.max(n,s);return I.slice(r,o+1)}function V(e,t){return e*x[L(t,"second")]}function q(e,t){const n=k(t.largestUnit,t.smallestUnit),s=n[n.length-1],r=x[s];let o=Math.round(e/r)*r;return n.map(u=>{const a=x[u],c=Math.floor(o/a);return o-=c*a,{unit:u,value:c}})}function X(e,t){const n=e.filter(o=>o.value!==0),s=n.length>0?n:[e[e.length-1]],r=typeof t=="number"&&Number.isFinite(t)?Math.max(1,Math.trunc(t)):s.length;return s.slice(0,r).map(o=>`${o.value}${Z[o.unit]}`).join(" ")}function E(e,t){const n=e.filter(o=>o.value!==0),s=n.length>0?n:[e[e.length-1]],r=typeof t=="number"&&Number.isFinite(t)?Math.max(1,Math.trunc(t)):s.length;return s.slice(0,r).map(o=>{const[u,a]=z[o.unit];return`${o.value} ${o.value===1?u:a}`}).join(" ")}function j(e){const t=e.some(c=>c.unit==="day"&&c.value!==0),n=e.some(c=>c.unit==="millisecond"),s=e.findIndex(c=>c.value!==0),r=Math.max(0,e.length-2),o=t?0:s===-1?r:Math.min(s,r),u=s===-1?e.slice(r):e.slice(o);if(u.length===0)return"0";const a=u.map((c,i)=>c.unit==="millisecond"?String(c.value).padStart(3,"0"):i===0?String(c.value):String(c.value).padStart(2,"0")).join(":");return n?a.replace(/:(\d{3})$/,".$1"):a}function B(e,t,n){const s=`${n.prefix||""}${e}${n.suffix||""}`;return t?n.negativeInParentheses?`(${s})`:`-${s}`:s}function S(e,t={}){if(e==null)return"";const n=typeof e=="number"?e:typeof e=="string"&&e.trim()?Number(e):NaN;if(!Number.isFinite(n))return"";const s=t.inputUnit||"second",r=t.outputStyle==="digital"||t.outputStyle==="long"?t.outputStyle:"compact",o=n<0,u=Math.abs(V(n,s)),a=q(u,t),c=r==="digital"?j(a):r==="long"?E(a,t.maxUnits):X(a,t.maxUnits);return B(c,o,t)}function g(e,t){const n=f.toDate(e),s=f.toDate(t),r=n.getTime()-s.getTime();return r<0?-1:r>0?1:r}function Y(e){return f.constructFrom(e,Date.now())}function W(e,t){const n=f.toDate(e),s=f.toDate(t),r=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return r*12+o}function F(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function H(e,t){return+f.toDate(e)-+f.toDate(t)}function G(e){const t=f.toDate(e);return t.setHours(23,59,59,999),t}function K(e){const t=f.toDate(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function J(e){const t=f.toDate(e);return+G(t)==+K(t)}function Q(e,t){const n=f.toDate(e),s=f.toDate(t),r=g(n,s),o=Math.abs(W(n,s));let u;if(o<1)u=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*o);let a=g(n,s)===-r;J(f.toDate(e))&&o===1&&g(e,s)===1&&(a=!1),u=r*(o-Number(a))}return u===0?0:u}function ee(e,t,n){const s=H(e,t)/1e3;return F(n==null?void 0:n.roundingMethod)(s)}function te(e,t,n){const s=f.getDefaultOptions(),r=(n==null?void 0:n.locale)??s.locale??f.enUS,o=2520,u=g(e,t);if(isNaN(u))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:u});let c,i;u>0?(c=f.toDate(t),i=f.toDate(e)):(c=f.toDate(e),i=f.toDate(t));const h=ee(i,c),m=(f.getTimezoneOffsetInMilliseconds(i)-f.getTimezoneOffsetInMilliseconds(c))/1e3,l=Math.round((h-m)/60);let d;if(l<2)return n!=null&&n.includeSeconds?h<5?r.formatDistance("lessThanXSeconds",5,a):h<10?r.formatDistance("lessThanXSeconds",10,a):h<20?r.formatDistance("lessThanXSeconds",20,a):h<40?r.formatDistance("halfAMinute",0,a):h<60?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",1,a):l===0?r.formatDistance("lessThanXMinutes",1,a):r.formatDistance("xMinutes",l,a);if(l<45)return r.formatDistance("xMinutes",l,a);if(l<90)return r.formatDistance("aboutXHours",1,a);if(l<M.minutesInDay){const D=Math.round(l/60);return r.formatDistance("aboutXHours",D,a)}else{if(l<o)return r.formatDistance("xDays",1,a);if(l<M.minutesInMonth){const D=Math.round(l/M.minutesInDay);return r.formatDistance("xDays",D,a)}else if(l<M.minutesInMonth*2)return d=Math.round(l/M.minutesInMonth),r.formatDistance("aboutXMonths",d,a)}if(d=Q(i,c),d<12){const D=Math.round(l/M.minutesInMonth);return r.formatDistance("xMonths",D,a)}else{const D=d%12,b=Math.trunc(d/12);return D<3?r.formatDistance("aboutXYears",b,a):D<9?r.formatDistance("overXYears",b,a):r.formatDistance("almostXYears",b+1,a)}}function _(e,t){return te(e,Y(e),t)}function ne(e,t){return e&&e!=="auto"?e:t}function re(e,t=new Date){try{const n={timeZone:e,timeZoneName:"short"},r=new Intl.DateTimeFormat("en-US",n).formatToParts(t).find(o=>o.type==="timeZoneName");return(r==null?void 0:r.value)||e}catch{return e}}function se(e){try{const t={timeZone:e,timeZoneName:"long"},s=new Intl.DateTimeFormat("en-US",t).formatToParts(new Date).find(r=>r.type==="timeZoneName");return(s==null?void 0:s.value)||e}catch{return e}}function p(e,t="auto"){if(!e)return new Date(NaN);const n=e.endsWith("Z"),s=/[+-]\d{2}:?\d{2}$/.test(e),r=/\([A-Z]{3,4}\)$/.test(e);if(t==="auto")return n||s||r?new Date(e):new Date(e+"Z");if(t==="local"){if(n||s){const o=e.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(o)}return new Date(e)}else return t==="UTC"?n?new Date(e):s?new Date(e):new Date(e+"Z"):n||s||r?new Date(e):R.fromZonedTime(e,t)}const oe="MM/dd/yyyy",C=(e,t,n,s="auto")=>{if(!e)return"";try{const r=p(e,s);if(isNaN(r.getTime()))return e;const u=(t&&t.trim()?t:oe).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return n&&n!=="auto"?f.formatInTimeZone(r,n,u):f.format(r,u)}catch(r){return console.error("Date formatting error:",r),e}},P=(e,t="auto")=>{if(!e)return"";try{const n=p(e,t);return isNaN(n.getTime())?e:_(n,{addSuffix:!0})}catch(n){return console.error("Relative time formatting error:",n),e}};function ae(e,t,n,s){const r=e instanceof Date?e.toISOString():String(e),o=(s==null?void 0:s.browserTimezone)||n,u=(s==null?void 0:s.isSqlCard)??!1;if(t!=null&&t.useRelativeTime)return P(r,(t==null?void 0:t.sourceTimezone)||"auto");const a=t!=null&&t.useCustomFormat&&(t!=null&&t.customFormat)?t.customFormat:(t==null?void 0:t.format)||"MM/dd/yyyy";return C(r,a,t!=null&&t.timezone&&(t==null?void 0:t.timezone)!=="auto"?t.timezone:u?o:n,(t==null?void 0:t.sourceTimezone)||"auto")}function w(e,t,n){var u,a;if(e==null)return e===null?((u=n.absence)==null?void 0:u.nullText)??"":((a=n.absence)==null?void 0:a.emptyText)??"";const s=T.isExactNumericValue(e)?e:void 0,r=s?s.value:e,o=s??(typeof e=="number"?e:void 0);if(!n.useFormattedValues||!t)return String(r);switch(t.type){case"number":return o!==void 0?y.formatNumberWithColumnSettings(o,t.numberFormat,n.locale):String(r);case"date":return ae(r,t.dateFormat,n.timezone,{browserTimezone:n.browserTimezone,isSqlCard:n.isSqlCard});case"progress":return o!==void 0?`${r}%`:String(r);case"badge":case"link":case"text":case"none":default:return String(r)}}function ie(e,t){return t.visibleColumns.map(n=>{const s=e[n],r=t.columnSettings[n];return w(s,r,{useFormattedValues:t.useFormattedValues,timezone:t.timezone,locale:t.locale})})}function A(e,t){var r;const n=e[e.length-1];if(!n)return"";if(n.member.kind==="others")return"Others";const s=n.member.value;return s===null?"(Blank)":((r=t==null?void 0:t.get(n.levelId))==null?void 0:r(s))??(typeof s=="object"?s.value:String(s))}function O(e,t,n){return e==="grand_total"?n??"Grand Total":e==="subtotal"?n??`${t} Total`:t}function ue(e,t,n,s){var u;const r=e[e.length-1],o=t==="grand_total"?n.grand.label:r?(u=n.levels[r.levelId])==null?void 0:u.label:void 0;return O(t,A(e,s),o)}function ce(e,t,n){return e.kind==="value"?(t==null?void 0:t(e.value))??"":e.kind==="null"?n.nullText:n.emptyText}function le(e){const{path:t,previousPath:n,role:s,repeatLabels:r,levelCount:o}=e;return Array.from({length:o},(u,a)=>{const c=t.slice(0,a+1),i=s==="grand_total"?a===0:s==="subtotal"&&a===t.length-1,h=n&&n.length>a&&T.matrixPathKey(n.slice(0,a+1))===T.matrixPathKey(c);return{path:c,total:i,visible:i||t.length>a&&(r||!h||a===t.length-1)}})}function $(e,t){return f.fromSemanticFormat(e??t,{preserveOmittedProperties:!0,numericInput:"canonical"})}function fe(e,t,n){const s=new Map,r=(o,u)=>{const a=(u==="levels"?t.levelFormats:t.measureFormats)[o.id],c=o.semanticFormat,i=$(a,c);u==="measures"&&s.set(o.id,{isNumeric:T.normalizeAnalyticsCatalogDataType(o.column.dataType)==="number",hasTextAffixes:!!i&&!!("prefix"in i&&i.prefix||"suffix"in i&&i.suffix)});const h=m=>w(m,void 0,{useFormattedValues:!0,timezone:n.calendar.tz,locale:n.valueFormat.locale,absence:t.absence});if(o.column.temporalBucket){const m=o.column.temporalBucket,l=v.resolveTemporalBucketPresentation({metadata:m,cardFormat:(a==null?void 0:a.type)==="temporal_bucket"?a:void 0,semanticFormat:(c==null?void 0:c.type)==="temporal_bucket"?{granularity:m.granularity,format:c}:void 0,locale:n.valueFormat.locale,styles:{dateStyle:n.valueFormat.dateStyle,dateTime:n.valueFormat.dateTime}});return d=>typeof d=="string"?v.formatTemporalBucket({value:d,metadata:m,format:l.format}):h(d)}if(o.column.rawTemporal){const m=y.prepareRawTemporalFormatter({metadata:o.column.rawTemporal,format:y.resolveRawTemporalFormat({format:(i==null?void 0:i.type)==="date"?{type:"raw_temporal",timezone:i.timezone,sourceTimezone:i.sourceTimezone,presentation:i.pattern?{mode:"pattern",dialect:"semaphor_tokens",pattern:i.pattern}:{mode:"auto"}}:void 0,preferences:n.valueFormat,calendar:n.calendar})});return l=>{if(typeof l!="string")return h(l);const d=m(l);return d.ok?d.text:h(l)}}if(f.isNumericCanonicalFormat(i)){const m=y.resolveNumericPresentation(i,n.valueFormat);return l=>typeof l=="number"||typeof l=="object"&&l!==null?y.formatNumericCanonical(l,m):h(l)}return(i==null?void 0:i.type)==="duration"?m=>typeof m=="number"||typeof m=="string"||typeof m=="object"&&m!==null?S(typeof m=="object"?m.value:m,i):h(m):(i==null?void 0:i.type)==="string"?m=>m===null?h(m):`${i.prefix??""}${h(m)}${i.suffix??""}`:h};return{levels:new Map(e.levels.map(o=>[o.id,r(o,"levels")])),measures:new Map(e.measures.map(o=>[o.id,r(o,"measures")])),measureSemantics:s}}exports.formatCellValue=w;exports.formatDate=C;exports.formatDistanceToNow=_;exports.formatDuration=S;exports.formatRelativeTime=P;exports.formatRowForExport=ie;exports.getTimezoneAbbreviation=re;exports.getTimezoneName=se;exports.matrixAxisLabel=ue;exports.matrixCellText=ce;exports.matrixLevelLabels=le;exports.matrixMemberLabel=A;exports.matrixTotalLabel=O;exports.parseWithSourceTimezone=p;exports.prepareMatrixFormatting=fe;exports.resolveMatrixValueFormat=$;exports.resolveTimezone=ne;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const u=require("./validators-
|
|
1
|
+
"use strict";const u=require("./validators-D2F_uxxP.cjs"),d=["=","!=",">","<",">=","<=","like","not like","between","not between","in","not in","is null","is not null"],h=new Set(["string","number","date","boolean"]);function P(t){return typeof t=="string"&&d.includes(t)}function b(t,e){switch(t){case"is null":case"is not null":return e.length===0;case"between":case"not between":return e.length===2;case"in":case"not in":return e.length>=1;default:return e.length===1}}function p(t){if(!t||typeof t!="object"||Array.isArray(t))return;const e=t,i={};for(const n of y)e[n]!==void 0&&(i[n]=e[n]);return i}const y=["operation","values","valueType","temporalBucket","relativeMeta","temporalPrecision"];function v(t){const e=p(t);if(!e)return;const{operation:i,values:n}=e;if(!P(i)||!Array.isArray(n)||!b(i,n))return;const r=typeof e.valueType=="string"&&h.has(e.valueType)?e.valueType:void 0;return{operation:i,values:n,...r?{valueType:r}:{},...e.temporalBucket!==void 0?{temporalBucket:e.temporalBucket}:{},...e.relativeMeta!==void 0?{relativeMeta:e.relativeMeta}:{},...e.temporalPrecision!==void 0?{temporalPrecision:e.temporalPrecision}:{}}}function E(t){const e=v(t);if(!e)throw new Error(`Filter operation "${String(t.operation)}" cannot be expressed as predicate semantics.`);return e}function g(t){return t.operation==="is null"||t.operation==="is not null"}function f(t,e){var n;if(e===null)return!0;if(e.overrides.length===0)return t.length<=e.depth;const i=u.matrixPathKey(t);return((n=e.overrides.find(r=>r.path.length===t.length&&u.matrixPathKey(r.path)===i))==null?void 0:n.expanded)??t.length<=e.depth}function A(t){var l;const{path:e,levelCount:i,expansion:n,total:r,axis:m}=t,a=e.length>=i||((l=e[e.length-1])==null?void 0:l.member.kind)==="others",s=!a&&!t.childrenEmpty,o=s&&f(e,n),c=m==="rows"&&t.rowLayout!=="tabular";return{expandable:s,expanded:o,memberVisible:c||!o,valueVisible:a||!!(r!=null&&r.visible)&&(!o||r.position==="before"),subtotalBefore:!c&&o&&!!(r!=null&&r.visible)&&r.position==="before",subtotalAfter:o&&!!(r!=null&&r.visible)&&r.position==="after"}}exports.NATIVE_PREDICATE_OPERATIONS=d;exports.isMatrixPathExpanded=f;exports.isNullCheckPredicate=g;exports.parseNativePredicateSemantics=v;exports.projectNativePredicateSemantics=p;exports.resolveMatrixMemberPresentation=A;exports.toNativePredicateSemantics=E;
|