react-semaphor 0.1.560 → 0.1.562
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.js +450 -423
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +5 -5
- package/dist/brand-studio/index.js +9 -9
- package/dist/briefings/index.js +5 -5
- package/dist/chunks/{analytics-base-schemas-CHLxsPfX.js → analytics-base-schemas-BaIQrEzX.js} +221 -188
- package/dist/chunks/{assistant-chat-Bu2fFm_I.js → assistant-chat-R_yT8xH4.js} +116 -117
- package/dist/chunks/bookmark-impact-D4Kl4amw.js +75 -0
- package/dist/chunks/bookmark-state-CWeoGbrx.js +743 -0
- package/dist/chunks/{braces-Da41xfUd.js → braces-DzgoQC64.js} +1 -1
- package/dist/chunks/{comparison-window-caption-4FNkMrzE.js → comparison-window-caption-D1EUXzaR.js} +550 -425
- package/dist/chunks/{context-BgPDzLHZ.js → context-R31TSL5V.js} +1 -1
- package/dist/chunks/{dashboard-_MeBuy67.js → dashboard-Bp1y5oun.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-CEi4Pr_v.js → dashboard-briefing-launcher-S5FB3aUW.js} +236 -236
- package/dist/chunks/dashboard-controls-CfC_6Ztn.js +2277 -0
- package/dist/chunks/{dashboard-json-B1mU_OMa.js → dashboard-json-gYZT7ZQY.js} +5 -5
- package/dist/chunks/dates-DFY7Gfss.js +91 -0
- package/dist/chunks/{edit-dashboard-visual-0CJN31Y3.js → edit-dashboard-visual-u7OI_g8Q.js} +7119 -7198
- package/dist/chunks/filter-reach-copy-CvV7W5dd.js +3965 -0
- package/dist/chunks/{filter-value-text-CRC-K_l_.js → filter-value-text-CPwFkrMz.js} +11 -10
- package/dist/chunks/global-date-filter-utils-N1kcsOFE.js +16722 -0
- package/dist/chunks/{index-DtHidOPV.js → index-CNGkfUp4.js} +269 -264
- package/dist/chunks/{layout-grid-BvsH4RY2.js → layout-grid-BM65viQh.js} +1 -1
- package/dist/chunks/{list-filter-Dg0otx5E.js → list-filter-BoeLBfL3.js} +1 -1
- package/dist/chunks/{matrix-analytical-definition-CM18W8w6.js → matrix-analytical-definition-hEucouWM.js} +4 -4
- package/dist/chunks/{matrix-card-HPskLaPy.js → matrix-card-CCh9JjP1.js} +3 -3
- package/dist/chunks/{matrix-member-presentation-Bbrfrke4.js → matrix-member-presentation-DsAUbuoL.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-WPv4R-H_.js → matrix-operation-contract-DsLdFdSa.js} +365 -349
- package/dist/chunks/{metric-comparison-ljMKYZKa.js → metric-comparison-Bnso1cm1.js} +6 -6
- package/dist/chunks/{model-change-Ccn1zaxl.js → model-change-T1cRkh3m.js} +1 -1
- package/dist/chunks/{palette-Bsh376zO.js → palette-p1XSJFgB.js} +1 -1
- package/dist/chunks/pivot-result-contract-expectations-B53jqszr.js +56 -0
- package/dist/chunks/{pivot-result-identity-vS9TSh4f.js → pivot-result-identity-Dq5jm-EC.js} +1 -1
- package/dist/chunks/{zoned-wall-clock-B1n_WjW3.js → raw-temporal-value-Bqz8wc7L.js} +97 -46
- package/dist/chunks/{report-preferences-dialog-BV8L0SeS.js → report-preferences-dialog-C4RAR8u5.js} +68 -63
- package/dist/chunks/{report-runtime-context-BZQh9ywy.js → report-runtime-context-BITkNSDa.js} +2 -2
- package/dist/chunks/resolve-dashboard-input-context-DaDrZGuA.js +8214 -0
- package/dist/chunks/{save-B5EAsgQF.js → save-CHV1B1fL.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-n2Wn11cV.js → saved-dashboard-context-DFYBrE6O.js} +93 -94
- package/dist/chunks/{selection-filter-compiler-BKXmyLrS.js → selection-filter-compiler-CUDRnUxc.js} +19 -18
- package/dist/chunks/{selection-reducer-D0YnaAD9.js → selection-reducer-Bz5aywT4.js} +1 -1
- package/dist/chunks/{semaphor-ready-indicator-XLBLOJ2V.js → semaphor-ready-indicator-Cfuafnem.js} +38188 -40344
- package/dist/chunks/{shelf-drop-preview-context-DHMa54a-.js → shelf-drop-preview-context-BR2GEYog.js} +81 -82
- package/dist/chunks/{source-entity-resolution-dUG5VWRm.js → source-entity-resolution-DdDVXFB8.js} +6 -6
- package/dist/chunks/{switch-ByxH4M7t.js → switch-BW4yXSYs.js} +3 -3
- package/dist/chunks/{table-export-sheet-C_GdeTYU.js → table-export-sheet-bSXxGn-v.js} +1 -1
- package/dist/chunks/temporal-input-presentation-sk9gqLi6.js +4960 -0
- package/dist/chunks/{token-types-CQtXUVMy.js → token-types-BUK06hU2.js} +1 -1
- package/dist/chunks/{upload-wbR-NVzq.js → upload-BnmuyPqW.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-CEBaLOKC.js → use-create-flow-overlay-state-DyzhWvRJ.js} +6 -6
- package/dist/chunks/{validators-CXTneCA4.js → validators-BIM0FE31.js} +774 -895
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +2477 -2685
- package/dist/data-app-sdk/index.js +30 -30
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +25 -25
- package/dist/format-utils/index.js +274 -267
- package/dist/index.js +59 -59
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/briefings/attachment-outcomes.d.ts +1 -1
- package/dist/types/components/dashboard/dashboard-create-dialog.d.ts +23 -0
- package/dist/types/components/dashboard/summary-number-formatter.d.ts +6 -0
- package/dist/types/components/index.d.ts +1 -2
- package/dist/types/components/surfboard/filter/types.d.ts +3 -1
- package/dist/types/index.js +50 -51
- package/dist/types/lib/formatters/kpi-number-formatter.d.ts +41 -0
- package/dist/types/lib/formatters/raw-temporal-presentation.d.ts +59 -2
- package/dist/types/lib/interactions/get-click-context-from-matrix.d.ts +5 -0
- package/dist/types/lib/interactions/get-click-context-from-table.d.ts +45 -0
- package/dist/types/lib/print/print-inputs.d.ts +2 -1
- package/dist/types/lib/query-context/assemble-card-query.d.ts +2 -0
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +5 -0
- package/dist/types/lib/selection/selection-from-click-context.d.ts +41 -0
- package/dist/types/lib/stores/editor-store.d.ts +9 -1
- package/dist/types/lib/stores/table-actions.d.ts +0 -2
- package/dist/types/lib/types/common-types.d.ts +6 -0
- package/dist/types/lib/types/explorer-types.d.ts +7 -1
- package/dist/types/lib/types/interaction-types.d.ts +3 -1
- package/dist/types/lib/types/token-types.d.ts +0 -1
- package/dist/types/shared/analytics-protocol/analytics-base-schemas.d.ts +13 -1
- package/dist/types/shared/analytics-protocol/contracts.d.ts +9 -40
- package/dist/types/shared/analytics-protocol/measure-aggregation-profile.d.ts +12 -0
- package/dist/types/shared/analytics-protocol/selection-contract.d.ts +12 -2
- package/dist/types/shared/analytics-protocol/validators.d.ts +1 -2
- package/dist/types/shared/assistant-protocol/context.d.ts +8 -8
- package/dist/types/shared/dashboard-authoring/card-formats/sql-date-pattern.d.ts +7 -1
- package/dist/types/shared/dashboard-authoring/card-settings/apply-card-settings.d.ts +11 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-display-write.d.ts +76 -0
- package/dist/types/shared/dashboard-authoring/card-settings/card-kinds.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/card-settings/carry-column-settings.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-format-write.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-names.d.ts +51 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-polarity-write.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/card-settings/column-sources.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/card-settings/confirm-class.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/card-settings/highlight-inputs.d.ts +19 -0
- package/dist/types/shared/dashboard-authoring/card-settings/index.d.ts +17 -0
- package/dist/types/shared/dashboard-authoring/card-settings/inputs.d.ts +117 -0
- package/dist/types/shared/dashboard-authoring/card-settings/read-card-settings.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-highlights.d.ts +14 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolve-card-settings.d.ts +59 -0
- package/dist/types/shared/dashboard-authoring/card-settings/resolved.d.ts +51 -0
- package/dist/types/shared/dashboard-authoring/card-settings/views.d.ts +30 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +6 -0
- package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +32 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +3402 -4313
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +49 -8
- package/dist/types/shared/dashboard-authoring/changes/field-ref.d.ts +91 -0
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +52 -2
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-create.d.ts +26 -0
- package/dist/types/shared/dashboard-authoring/click-to-filter-settings.d.ts +2 -1
- package/dist/types/shared/dashboard-authoring/conditional-formatting/kpi.d.ts +1 -8
- package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +20 -20
- package/dist/types/shared/dashboard-authoring/detail-date-presentation.d.ts +9 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +11 -6
- package/dist/types/shared/dashboard-authoring/kpi-figure.d.ts +123 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/apply.d.ts +8 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/comparison.d.ts +16 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/dates.d.ts +41 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/index.d.ts +17 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/options.d.ts +63 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/read.d.ts +16 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/resolve.d.ts +79 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/schemas.d.ts +934 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/sentences.d.ts +4 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/set.d.ts +11 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/transform.d.ts +63 -0
- package/dist/types/shared/dashboard-authoring/measure-calculations/window-transforms.d.ts +60 -0
- package/dist/types/shared/dashboard-authoring/new-card.d.ts +12 -1
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +2 -1
- package/dist/types/shared/dashboard-authoring/operations/operation-sentences.d.ts +46 -0
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +73 -3
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +21 -3
- package/dist/types/shared/dashboard-authoring/text-card-words/blocks.d.ts +58 -0
- package/dist/types/shared/dashboard-authoring/text-card-words/index.d.ts +55 -0
- package/dist/types/shared/dashboard-authoring/text-card-words/rich-content.d.ts +18 -0
- package/dist/types/shared/dashboard-viewer/bookmark-impact.d.ts +33 -0
- package/dist/types/shared/format-utils/document-print.d.ts +82 -0
- package/dist/types/shared/format-utils/formatters/matrix-formatter.d.ts +8 -1
- package/dist/types/shared/format-utils/index.d.ts +1 -0
- package/dist/types/shared/format-utils/raw-temporal.d.ts +18 -7
- package/dist/types/shared/temporal/index.d.ts +1 -0
- package/dist/types/shared/temporal/raw-temporal-equality.d.ts +19 -0
- package/dist/types/shared/temporal/raw-temporal-value.d.ts +29 -0
- package/dist/types/shared/temporal/zoned-wall-clock.d.ts +6 -0
- package/package.json +2 -2
- package/dist/chunks/bookmark-state-BFY9oNmr.js +0 -111
- package/dist/chunks/custom-visual-inputs-Dz-enUNR.js +0 -292
- package/dist/chunks/dashboard-controls-Bi7fyG-4.js +0 -2339
- package/dist/chunks/document-dashboard-inputs-CkWfDB8c.js +0 -3010
- package/dist/chunks/filter-reach-copy-BF4w4kI2.js +0 -3738
- package/dist/chunks/global-date-filter-utils-D8365uPH.js +0 -12889
- package/dist/chunks/pivot-result-contract-expectations-Bl5suy4-.js +0 -1832
- package/dist/chunks/raw-temporal-presentation-BHm7s-hz.js +0 -540
- package/dist/chunks/resolve-dashboard-input-context-CAMiWvyR.js +0 -5280
- package/dist/chunks/table-settings-Imz0FgWi.js +0 -637
- package/dist/chunks/temporal-input-presentation-uvNK_tM0.js +0 -3228
- package/dist/types/components/dashboard/ai-dashboard-create-dialog.d.ts +0 -38
- package/dist/types/components/dashboard/dashboard-create-template.d.ts +0 -10
- package/dist/types/lib/hooks/use-dashboard-authoring.d.ts +0 -49
- package/dist/types/shared/dashboard-authoring/artifact-compiler.d.ts +0 -6
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -106
- package/dist/types/shared/dashboard-authoring/protocol-adapter.d.ts +0 -7
- package/dist/types/shared/dashboard-authoring/source-matching.d.ts +0 -34
- package/dist/types/shared/dashboard-authoring/validators.d.ts +0 -2
|
@@ -1,3738 +0,0 @@
|
|
|
1
|
-
import { am as xn, an as Sn, ao as Dn, ap as Tt, aq as wn, ar as Tn, x as On, as as Mn, at as Pn, au as kn, av as Ot, aw as An, ax as Nn, ay as Rn, az as ve, aA as _n, aB as En, aC as Vn, b as Kn, aD as Ln, v as Bn, A as qn, aE as $n, aF as zn } from "./resolve-dashboard-input-context-CAMiWvyR.js";
|
|
2
|
-
import { dH as Mt, aT as le, a as z, dO as Pt, aV as Un, dP as jn, dQ as ke, dR as Gn, dS as Wn, O as Ae, dT as Hn, dU as Yn, P as Jn, dV as T, aw as Qn, dW as kt, dX as Ne, dY as Zn, dZ as Xn, d_ as it, d$ as ei, e0 as rt, e1 as ti, e2 as ni, U as At, e3 as Nt, e4 as Rt, v as _t, e5 as at, a0 as U, e6 as Re, dj as ot, dl as _e, dg as st, e7 as lt, dK as ii, bp as Ee, e8 as ri, e9 as ai, ea as oi, dd as Q, bs as ct, eb as si, a6 as Et, a7 as Vt, d as li, ec as j, bu as ci, ed as ui, bv as di, aE as Kt, ee as fi, ef as mi, eg as pi, eh as gi, c as Lt, dJ as yi, ei as hi, ej as bi, dr as Se, ek as vi, el as Fe, cl as Bt, em as ut, en as Fi, bV as Ci, co as dt, cn as Ii, eo as xi, d4 as Si, d6 as Di } from "./global-date-filter-utils-D8365uPH.js";
|
|
3
|
-
import { aj as qt, f as wi, e as Ti, ag as $t, aA as Oi, v as Mi, b0 as zt, aY as De, aW as L, aZ as Pi, b2 as ki } from "./validators-CXTneCA4.js";
|
|
4
|
-
import "./matrix-operation-contract-WPv4R-H_.js";
|
|
5
|
-
import { r as Ai, C as Ni } from "./metric-comparison-ljMKYZKa.js";
|
|
6
|
-
import { t as ft } from "./analytics-base-schemas-CHLxsPfX.js";
|
|
7
|
-
import "zod";
|
|
8
|
-
import { d as G, i as N, ao as Ri, ap as _i, o as Ei, k as Vi, g as we, h as Ki, J as P, R as Li, v as Bi, e as qi, r as $i, O as zi, Z as Ui } from "./temporal-input-presentation-uvNK_tM0.js";
|
|
9
|
-
import { w as ji } from "./pivot-result-contract-expectations-Bl5suy4-.js";
|
|
10
|
-
import "../value-format-preferences/index.js";
|
|
11
|
-
import { L as Gi, w as me } from "./table-settings-Imz0FgWi.js";
|
|
12
|
-
import { g as Wi } from "./_commonjsHelpers-DimLPMtv.js";
|
|
13
|
-
import { f as Hi, b as Yi } from "./raw-temporal-presentation-BHm7s-hz.js";
|
|
14
|
-
import "./index-CJW5BdWT.js";
|
|
15
|
-
import "./index-CuHybtft.js";
|
|
16
|
-
import { r as Ji } from "./source-entity-resolution-dUG5VWRm.js";
|
|
17
|
-
import { R as Qi } from "./matrix-analytical-definition-CM18W8w6.js";
|
|
18
|
-
import { r as Ut } from "./applied-constraints-DU-wndZ7.js";
|
|
19
|
-
const Do = 15, Zi = /\{\{-?\s*filters\s*\|\s*where\s*-?\}\}/i, Xi = /\{\{-?\s*filters\s*\|\s*and\s*-?\}\}/i, er = /\bwhere\b/i;
|
|
20
|
-
function tr(e) {
|
|
21
|
-
return e != null && e.trim() ? Zi.test(e) || Xi.test(e) : !1;
|
|
22
|
-
}
|
|
23
|
-
function wo(e) {
|
|
24
|
-
return !(e != null && e.trim()) || tr(e) ? null : er.test(e) ? {
|
|
25
|
-
helper: "{{ filters | and }}",
|
|
26
|
-
description: "For queries with an existing WHERE clause."
|
|
27
|
-
} : {
|
|
28
|
-
helper: "{{ filters | where }}",
|
|
29
|
-
description: "For queries without a WHERE clause."
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function nr(e, t) {
|
|
33
|
-
if (!(typeof e != "number" || typeof t != "number"))
|
|
34
|
-
return e === t ? t : void 0;
|
|
35
|
-
}
|
|
36
|
-
function E(e, t) {
|
|
37
|
-
const n = G(e, t);
|
|
38
|
-
if (n) {
|
|
39
|
-
if (n.type === "date")
|
|
40
|
-
return {
|
|
41
|
-
type: "date",
|
|
42
|
-
locale: n.locale,
|
|
43
|
-
dateFormat: n.pattern,
|
|
44
|
-
...n.dialect ? { dateDialect: n.dialect } : {},
|
|
45
|
-
...n.preset ? { datePreset: n.preset } : {},
|
|
46
|
-
timezone: n.timezone,
|
|
47
|
-
sourceTimezone: n.sourceTimezone,
|
|
48
|
-
relative: n.relative,
|
|
49
|
-
prefix: n.prefix,
|
|
50
|
-
suffix: n.suffix
|
|
51
|
-
};
|
|
52
|
-
if (n.type === "duration")
|
|
53
|
-
return {
|
|
54
|
-
type: "duration",
|
|
55
|
-
durationInputUnit: n.inputUnit,
|
|
56
|
-
durationDisplayStyle: n.outputStyle,
|
|
57
|
-
durationLargestUnit: n.largestUnit,
|
|
58
|
-
durationSmallestUnit: n.smallestUnit,
|
|
59
|
-
durationMaxUnits: n.maxUnits,
|
|
60
|
-
prefix: n.prefix,
|
|
61
|
-
suffix: n.suffix,
|
|
62
|
-
negativeInParentheses: n.negativeStyle === "parentheses"
|
|
63
|
-
};
|
|
64
|
-
if (N(n))
|
|
65
|
-
return {
|
|
66
|
-
type: n.type,
|
|
67
|
-
locale: n.locale,
|
|
68
|
-
currency: n.type === "currency" ? n.currency : void 0,
|
|
69
|
-
decimalPlaces: t != null && t.preserveOmittedProperties ? void 0 : nr(
|
|
70
|
-
n.minimumFractionDigits,
|
|
71
|
-
n.maximumFractionDigits
|
|
72
|
-
),
|
|
73
|
-
minimumFractionDigits: n.minimumFractionDigits,
|
|
74
|
-
maximumFractionDigits: n.maximumFractionDigits,
|
|
75
|
-
useGrouping: n.useGrouping,
|
|
76
|
-
prefix: n.prefix,
|
|
77
|
-
suffix: n.suffix,
|
|
78
|
-
useSuffix: !!n.compact,
|
|
79
|
-
negativeInParentheses: n.negativeStyle === "parentheses",
|
|
80
|
-
...n.signDisplay ? { signDisplay: n.signDisplay } : {},
|
|
81
|
-
multiplyBy: n.type === "percent" ? n.scale ?? (n.percentValueMode === "whole" ? 1 : 100) : n.scale,
|
|
82
|
-
percentValueMode: n.type === "percent" ? n.percentValueMode : void 0
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function jt(e, t) {
|
|
87
|
-
const n = G(e, t);
|
|
88
|
-
return (n == null ? void 0 : n.type) === "duration" ? {
|
|
89
|
-
style: "duration",
|
|
90
|
-
duration: {
|
|
91
|
-
inputUnit: n.inputUnit,
|
|
92
|
-
outputStyle: n.outputStyle,
|
|
93
|
-
largestUnit: n.largestUnit,
|
|
94
|
-
smallestUnit: n.smallestUnit,
|
|
95
|
-
maxUnits: n.maxUnits
|
|
96
|
-
},
|
|
97
|
-
prefix: n.prefix,
|
|
98
|
-
suffix: n.suffix,
|
|
99
|
-
negativeStyle: n.negativeStyle
|
|
100
|
-
} : !n || !N(n) ? void 0 : {
|
|
101
|
-
style: n.type === "currency" ? "currency" : n.type === "percent" ? "percent" : n.type === "scientific" ? "scientific" : "decimal",
|
|
102
|
-
currency: n.type === "currency" && n.currency || (t != null && t.preserveOmittedProperties ? void 0 : "USD"),
|
|
103
|
-
locale: n.locale || (t != null && t.preserveOmittedProperties ? void 0 : Ri),
|
|
104
|
-
minimumFractionDigits: n.minimumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 0),
|
|
105
|
-
maximumFractionDigits: n.maximumFractionDigits ?? (t != null && t.preserveOmittedProperties ? void 0 : 2),
|
|
106
|
-
useGrouping: typeof n.useGrouping == "boolean" ? n.useGrouping : !0,
|
|
107
|
-
percentValueMode: n.type === "percent" ? n.percentValueMode || "fraction" : "whole",
|
|
108
|
-
scale: n.scale,
|
|
109
|
-
compact: n.compact,
|
|
110
|
-
negativeStyle: n.negativeStyle,
|
|
111
|
-
...n.signDisplay ? { signDisplay: n.signDisplay } : {},
|
|
112
|
-
prefix: n.prefix,
|
|
113
|
-
suffix: n.suffix
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
const mt = [10, 20, 50, 100, 500, 1e3], ir = 50;
|
|
117
|
-
function rr(e) {
|
|
118
|
-
return e && e > 0 ? e : ir;
|
|
119
|
-
}
|
|
120
|
-
function To(e) {
|
|
121
|
-
const t = rr(e), n = [...mt];
|
|
122
|
-
return mt.includes(
|
|
123
|
-
t
|
|
124
|
-
) || (n.push(t), n.sort((i, r) => i - r)), n;
|
|
125
|
-
}
|
|
126
|
-
function Oo(e) {
|
|
127
|
-
var t, n;
|
|
128
|
-
return !!((e.type === "table" || e.type === "detailTable") && e.sql && !Mt(e.config) && !((n = (t = e.preferences) == null ? void 0 : t.tablePrefs) != null && n.forceClientPagination));
|
|
129
|
-
}
|
|
130
|
-
function ar(e, t) {
|
|
131
|
-
var i, r, a, o;
|
|
132
|
-
if (t === "table-print")
|
|
133
|
-
return "disabled";
|
|
134
|
-
if ((r = (i = e.preferences) == null ? void 0 : i.tablePrefs) != null && r.forceClientPagination)
|
|
135
|
-
return "client";
|
|
136
|
-
const n = Mt(e.config);
|
|
137
|
-
return e.sql && !n ? (o = (a = e.preferences) == null ? void 0 : a.tablePrefs) != null && o.enableDevModePagination ? "server" : "client" : n && xn(e) ? "server" : "client";
|
|
138
|
-
}
|
|
139
|
-
const Gt = Object.freeze({}), Mo = {
|
|
140
|
-
access: "session-only",
|
|
141
|
-
printMode: !1,
|
|
142
|
-
baseline: null,
|
|
143
|
-
applied: null,
|
|
144
|
-
appliedBookmark: null,
|
|
145
|
-
tableSettings: Gt,
|
|
146
|
-
notices: [],
|
|
147
|
-
isFavorite: !1,
|
|
148
|
-
fetchedAt: 0
|
|
149
|
-
};
|
|
150
|
-
function Po(e) {
|
|
151
|
-
return !e.viewer.printMode && e.viewer.access !== "session-only" && !!e.viewer.baseline && !!e.viewerStateClient && !e.isDashboardEditing;
|
|
152
|
-
}
|
|
153
|
-
function or(e) {
|
|
154
|
-
return e.isDashboardEditing ? Gt : e.viewer.tableSettings;
|
|
155
|
-
}
|
|
156
|
-
function sr(e, t) {
|
|
157
|
-
return or(e)[t];
|
|
158
|
-
}
|
|
159
|
-
function ko(e, t, n) {
|
|
160
|
-
if (!(n.isEditorPreview || e.isDashboardEditing) && Gi(e.dashboard, t))
|
|
161
|
-
return { settings: sr(e, t) };
|
|
162
|
-
}
|
|
163
|
-
function lr(e) {
|
|
164
|
-
var t;
|
|
165
|
-
return Sn({
|
|
166
|
-
card: e.card,
|
|
167
|
-
paginationMode: ar(e.card) === "server" ? "server" : "client",
|
|
168
|
-
result: {
|
|
169
|
-
keys: e.keys ?? Dn(e.records),
|
|
170
|
-
rows: e.records,
|
|
171
|
-
columns: e.resultColumns,
|
|
172
|
-
columnKeyMap: e.columnKeyMap,
|
|
173
|
-
comparisonMetadata: e.comparisonMetadata
|
|
174
|
-
},
|
|
175
|
-
settings: (t = e.viewerTable) == null ? void 0 : t.settings,
|
|
176
|
-
projection: "export"
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
function cr(e) {
|
|
180
|
-
if (e)
|
|
181
|
-
return E(
|
|
182
|
-
G(e, { preserveOmittedProperties: !0 }),
|
|
183
|
-
{ preserveOmittedProperties: !0 }
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
function ur(e) {
|
|
187
|
-
if (e.type === "percent") {
|
|
188
|
-
const { multiplyBy: t, percentValueMode: n, ...i } = e, r = t === 100 ? "fraction" : t === 1 ? "whole" : t === void 0 ? n : void 0;
|
|
189
|
-
if (r || t === void 0)
|
|
190
|
-
return ft(
|
|
191
|
-
le({ ...i, ...r ? { percentValueMode: r } : {} }, { preserveOmittedProperties: !0 })
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
return ft(
|
|
195
|
-
le(e, { preserveOmittedProperties: !0 })
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
const pe = cr, Ao = ur, dr = () => ({
|
|
199
|
-
urlTemplate: "{value}",
|
|
200
|
-
// Default: use cell value as-is
|
|
201
|
-
labelType: "value",
|
|
202
|
-
// Default: show cell value as label
|
|
203
|
-
staticLabel: "",
|
|
204
|
-
labelColumn: "",
|
|
205
|
-
openInNewTab: !0
|
|
206
|
-
// Default: open in new tab (current behavior)
|
|
207
|
-
}), Ve = () => ({
|
|
208
|
-
type: "none",
|
|
209
|
-
inheritMetricFormat: !0,
|
|
210
|
-
textAlign: "left",
|
|
211
|
-
width: 150,
|
|
212
|
-
// Default width in pixels
|
|
213
|
-
minWidth: 50,
|
|
214
|
-
maxWidth: 500,
|
|
215
|
-
textOverflow: "ellipsis",
|
|
216
|
-
textWrap: "default",
|
|
217
|
-
numberFormat: {
|
|
218
|
-
style: "decimal",
|
|
219
|
-
currency: "USD",
|
|
220
|
-
locale: "en-US",
|
|
221
|
-
minimumFractionDigits: 0,
|
|
222
|
-
maximumFractionDigits: 2,
|
|
223
|
-
useGrouping: !0,
|
|
224
|
-
percentValueMode: "whole"
|
|
225
|
-
},
|
|
226
|
-
dateFormat: {
|
|
227
|
-
format: "MM/dd/yyyy",
|
|
228
|
-
useCustomFormat: !1,
|
|
229
|
-
customFormat: "yyyy-MM-dd'T'HH:mm:ss",
|
|
230
|
-
useRelativeTime: !1,
|
|
231
|
-
timezone: "auto",
|
|
232
|
-
// Default to auto (use context or browser timezone for display)
|
|
233
|
-
sourceTimezone: "auto"
|
|
234
|
-
// Default to auto (use explicit timezone if present, otherwise assume UTC)
|
|
235
|
-
},
|
|
236
|
-
linkFormat: dr()
|
|
237
|
-
});
|
|
238
|
-
function No(e, t, n, i) {
|
|
239
|
-
return t && t !== "auto" ? t : n;
|
|
240
|
-
}
|
|
241
|
-
const Ro = (e) => !e || e === "auto" ? "local time" : {
|
|
242
|
-
"America/New_York": "Eastern Time",
|
|
243
|
-
"America/Chicago": "Central Time",
|
|
244
|
-
"America/Denver": "Mountain Time",
|
|
245
|
-
"America/Los_Angeles": "Pacific Time",
|
|
246
|
-
"Europe/London": "London Time",
|
|
247
|
-
"Europe/Paris": "Central European Time",
|
|
248
|
-
"Asia/Tokyo": "Japan Time",
|
|
249
|
-
"Asia/Shanghai": "China Time",
|
|
250
|
-
UTC: "UTC"
|
|
251
|
-
}[e] || e;
|
|
252
|
-
function Wt(e, t) {
|
|
253
|
-
const n = typeof e.decimalPlaces == "number", i = typeof e.minimumFractionDigits == "number" ? e.minimumFractionDigits : n ? e.decimalPlaces : t.min, r = typeof e.maximumFractionDigits == "number" ? e.maximumFractionDigits : n ? e.decimalPlaces : t.max;
|
|
254
|
-
return {
|
|
255
|
-
minimumFractionDigits: i,
|
|
256
|
-
maximumFractionDigits: Math.max(i, r)
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
function ce(e, t) {
|
|
260
|
-
const n = Wt(e, t), i = typeof e.suffix == "string" && e.suffix.length > 0;
|
|
261
|
-
return {
|
|
262
|
-
style: "decimal",
|
|
263
|
-
locale: e.locale,
|
|
264
|
-
currency: e.currency,
|
|
265
|
-
minimumFractionDigits: n.minimumFractionDigits,
|
|
266
|
-
maximumFractionDigits: n.maximumFractionDigits,
|
|
267
|
-
useGrouping: e.useGrouping,
|
|
268
|
-
// Preserve legacy behavior: explicit custom suffix should not trigger compacting.
|
|
269
|
-
useSuffix: !!(e.useSuffix && !i),
|
|
270
|
-
prefix: e.prefix,
|
|
271
|
-
suffix: e.suffix,
|
|
272
|
-
negativeInParentheses: e.negativeInParentheses,
|
|
273
|
-
multiplyBy: e.multiplyBy,
|
|
274
|
-
percentValueMode: e.percentValueMode
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function Ke(e, t = "auto", n = {}) {
|
|
278
|
-
if (t === "auto" && (t = yr(e, n)), (t === "number" || t === "currency" || t === "percent" || t === "scientific") && n.signDisplay && n.signDisplay !== "auto" && Number.isFinite(Number(e))) {
|
|
279
|
-
const r = typeof n.multiplyBy == "number" && Number.isFinite(n.multiplyBy) ? n.multiplyBy : 1, a = Number(e) * r, o = _i(a, n.signDisplay), s = Ke(o.value === a ? e : -Number(e), t, { ...n, signDisplay: void 0 });
|
|
280
|
-
if (!o.plus) return s;
|
|
281
|
-
const l = n.prefix ?? "";
|
|
282
|
-
return l && s.startsWith(l) ? `${l}+${s.slice(l.length)}` : `+${s}`;
|
|
283
|
-
}
|
|
284
|
-
switch (t) {
|
|
285
|
-
case "number":
|
|
286
|
-
return Ht(e, n);
|
|
287
|
-
case "currency":
|
|
288
|
-
return Yt(e, n);
|
|
289
|
-
case "percent":
|
|
290
|
-
return fr(e, n);
|
|
291
|
-
case "date":
|
|
292
|
-
return mr(e, n);
|
|
293
|
-
case "scientific":
|
|
294
|
-
return pr(e, n);
|
|
295
|
-
case "duration":
|
|
296
|
-
return gr(e, n);
|
|
297
|
-
default:
|
|
298
|
-
return String(e);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function Ht(e, t = {}) {
|
|
302
|
-
return e < 0 && !!t.prefix && !t.negativeInParentheses ? `-${we(
|
|
303
|
-
Math.abs(e),
|
|
304
|
-
ce(t, {
|
|
305
|
-
min: 0,
|
|
306
|
-
max: 0
|
|
307
|
-
})
|
|
308
|
-
)}` : we(
|
|
309
|
-
e,
|
|
310
|
-
ce(t, {
|
|
311
|
-
min: 0,
|
|
312
|
-
max: 0
|
|
313
|
-
})
|
|
314
|
-
);
|
|
315
|
-
}
|
|
316
|
-
function Yt(e, t = {}) {
|
|
317
|
-
return Ki(e, {
|
|
318
|
-
...ce(t, {
|
|
319
|
-
min: 2,
|
|
320
|
-
max: 2
|
|
321
|
-
}),
|
|
322
|
-
style: "currency",
|
|
323
|
-
currency: t.currency || "USD"
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
function fr(e, t = {}) {
|
|
327
|
-
const n = Wt(t, { min: 1, max: 1 }), r = typeof t.multiplyBy == "number" && Number.isFinite(t.multiplyBy) ? t.multiplyBy : t.percentValueMode === "whole" ? 1 : 100, a = e * r;
|
|
328
|
-
return we(a, {
|
|
329
|
-
locale: t.locale,
|
|
330
|
-
minimumFractionDigits: n.minimumFractionDigits,
|
|
331
|
-
maximumFractionDigits: n.maximumFractionDigits,
|
|
332
|
-
useGrouping: t.useGrouping,
|
|
333
|
-
prefix: t.prefix,
|
|
334
|
-
suffix: t.suffix || "%",
|
|
335
|
-
negativeInParentheses: t.negativeInParentheses,
|
|
336
|
-
useSuffix: !1
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
function mr(e, t = {}) {
|
|
340
|
-
const { locale: n = "en-US" } = t;
|
|
341
|
-
try {
|
|
342
|
-
const i = new Date(e);
|
|
343
|
-
return isNaN(i.getTime()) ? String(e) : new Intl.DateTimeFormat(n, {
|
|
344
|
-
dateStyle: "short"
|
|
345
|
-
}).format(i);
|
|
346
|
-
} catch {
|
|
347
|
-
return String(e);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
function pr(e, t = {}) {
|
|
351
|
-
return Vi(
|
|
352
|
-
e,
|
|
353
|
-
ce(t, { min: 2, max: 2 })
|
|
354
|
-
);
|
|
355
|
-
}
|
|
356
|
-
function gr(e, t = {}) {
|
|
357
|
-
return Ei(e, {
|
|
358
|
-
inputUnit: t.durationInputUnit,
|
|
359
|
-
outputStyle: t.durationDisplayStyle,
|
|
360
|
-
largestUnit: t.durationLargestUnit,
|
|
361
|
-
smallestUnit: t.durationSmallestUnit,
|
|
362
|
-
maxUnits: t.durationMaxUnits,
|
|
363
|
-
prefix: t.prefix,
|
|
364
|
-
suffix: t.suffix,
|
|
365
|
-
negativeInParentheses: t.negativeInParentheses
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
function yr(e, t) {
|
|
369
|
-
return t.currency ? "currency" : typeof e == "string" && !isNaN(Date.parse(e)) ? "date" : "number";
|
|
370
|
-
}
|
|
371
|
-
function _o(e, t = {}) {
|
|
372
|
-
return (n) => Ke(n, e, t);
|
|
373
|
-
}
|
|
374
|
-
function hr({
|
|
375
|
-
number: e,
|
|
376
|
-
decimalPlaces: t = 0,
|
|
377
|
-
useSuffix: n = !1,
|
|
378
|
-
customSuffix: i = "",
|
|
379
|
-
currency: r = "",
|
|
380
|
-
locale: a = "en-US"
|
|
381
|
-
}) {
|
|
382
|
-
if (r) {
|
|
383
|
-
const o = Yt(e, {
|
|
384
|
-
currency: r,
|
|
385
|
-
decimalPlaces: t,
|
|
386
|
-
locale: a,
|
|
387
|
-
useSuffix: n && !i
|
|
388
|
-
});
|
|
389
|
-
return n && i ? `${o}${i}` : o;
|
|
390
|
-
}
|
|
391
|
-
return Ht(e, {
|
|
392
|
-
decimalPlaces: t,
|
|
393
|
-
useSuffix: n && !i,
|
|
394
|
-
suffix: i,
|
|
395
|
-
locale: a
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
var br = function e(t, n) {
|
|
399
|
-
if (t === n) return !0;
|
|
400
|
-
if (t && n && typeof t == "object" && typeof n == "object") {
|
|
401
|
-
if (t.constructor !== n.constructor) return !1;
|
|
402
|
-
var i, r, a;
|
|
403
|
-
if (Array.isArray(t)) {
|
|
404
|
-
if (i = t.length, i != n.length) return !1;
|
|
405
|
-
for (r = i; r-- !== 0; )
|
|
406
|
-
if (!e(t[r], n[r])) return !1;
|
|
407
|
-
return !0;
|
|
408
|
-
}
|
|
409
|
-
if (t.constructor === RegExp) return t.source === n.source && t.flags === n.flags;
|
|
410
|
-
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === n.valueOf();
|
|
411
|
-
if (t.toString !== Object.prototype.toString) return t.toString() === n.toString();
|
|
412
|
-
if (a = Object.keys(t), i = a.length, i !== Object.keys(n).length) return !1;
|
|
413
|
-
for (r = i; r-- !== 0; )
|
|
414
|
-
if (!Object.prototype.hasOwnProperty.call(n, a[r])) return !1;
|
|
415
|
-
for (r = i; r-- !== 0; ) {
|
|
416
|
-
var o = a[r];
|
|
417
|
-
if (!(o === "_owner" && t.$$typeof) && !e(t[o], n[o]))
|
|
418
|
-
return !1;
|
|
419
|
-
}
|
|
420
|
-
return !0;
|
|
421
|
-
}
|
|
422
|
-
return t !== t && n !== n;
|
|
423
|
-
};
|
|
424
|
-
const ue = /* @__PURE__ */ Wi(br);
|
|
425
|
-
function vr(e) {
|
|
426
|
-
if (typeof e == "number")
|
|
427
|
-
return Number.isFinite(e);
|
|
428
|
-
if (typeof e != "string")
|
|
429
|
-
return !1;
|
|
430
|
-
const t = e.trim().replace(/,/g, "");
|
|
431
|
-
return t !== "" && Number.isFinite(Number(t));
|
|
432
|
-
}
|
|
433
|
-
function Fr(e) {
|
|
434
|
-
if (!(e != null && e.length))
|
|
435
|
-
return [];
|
|
436
|
-
const t = /* @__PURE__ */ new Set();
|
|
437
|
-
return e.forEach((n) => {
|
|
438
|
-
Object.keys(n).forEach((i) => t.add(i));
|
|
439
|
-
}), [...t];
|
|
440
|
-
}
|
|
441
|
-
function Cr(e) {
|
|
442
|
-
return Fr(e).filter(
|
|
443
|
-
(n) => e == null ? void 0 : e.some((i) => vr(i[n]))
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
function Le(e, t) {
|
|
447
|
-
var n;
|
|
448
|
-
if (t.id)
|
|
449
|
-
return (n = e.sql) != null && n.trim() ? { kind: "column", columnKey: t.id } : { kind: "metric", metricId: t.id };
|
|
450
|
-
}
|
|
451
|
-
function Jt(e) {
|
|
452
|
-
const t = e.context.preferences;
|
|
453
|
-
if (!t)
|
|
454
|
-
return e.authoredFormat;
|
|
455
|
-
const n = Le(e.card, e.metric);
|
|
456
|
-
return P(
|
|
457
|
-
e.authoredFormat,
|
|
458
|
-
t,
|
|
459
|
-
n ? e.context.resolveBoundCurrency(n) : void 0
|
|
460
|
-
);
|
|
461
|
-
}
|
|
462
|
-
function Ir(e) {
|
|
463
|
-
const t = z(e.card)[e.columnKey], n = (t == null ? void 0 : t.type) === "number" ? wn(
|
|
464
|
-
{ dataType: "number", format: void 0 },
|
|
465
|
-
t
|
|
466
|
-
) : void 0, i = n == null ? void 0 : n.authoredFormat, r = N(i) ? Jt({
|
|
467
|
-
card: e.card,
|
|
468
|
-
metric: {
|
|
469
|
-
id: e.columnKey
|
|
470
|
-
},
|
|
471
|
-
context: e.context,
|
|
472
|
-
authoredFormat: i
|
|
473
|
-
}) : void 0;
|
|
474
|
-
return {
|
|
475
|
-
id: e.columnKey,
|
|
476
|
-
name: e.columnKey,
|
|
477
|
-
label: e.columnKey,
|
|
478
|
-
alias: e.columnKey,
|
|
479
|
-
dataType: "number",
|
|
480
|
-
role: "metric",
|
|
481
|
-
format: r
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
function Eo(e) {
|
|
485
|
-
const t = new Set(
|
|
486
|
-
Cr(e.records)
|
|
487
|
-
), n = new Set(
|
|
488
|
-
e.renderedMetricKeys || e.resultKeys
|
|
489
|
-
), i = z(e.card);
|
|
490
|
-
return e.resultKeys.filter(
|
|
491
|
-
(r) => {
|
|
492
|
-
var a;
|
|
493
|
-
return n.has(r) && (t.has(r) || ((a = i[r]) == null ? void 0 : a.type) === "number");
|
|
494
|
-
}
|
|
495
|
-
);
|
|
496
|
-
}
|
|
497
|
-
function Vo(e) {
|
|
498
|
-
var a, o;
|
|
499
|
-
const { card: t, context: n } = e;
|
|
500
|
-
if (!(n != null && n.preferences) || !Pt(t.type))
|
|
501
|
-
return t;
|
|
502
|
-
const i = n.preferences, r = (a = t.sql) != null && a.trim() ? e.resultMetricKeys.map(
|
|
503
|
-
(s) => Ir({
|
|
504
|
-
card: t,
|
|
505
|
-
columnKey: s,
|
|
506
|
-
context: n
|
|
507
|
-
})
|
|
508
|
-
) : (((o = t.config) == null ? void 0 : o.metricColumns) || []).map((s) => {
|
|
509
|
-
const l = Tt(t, s), c = l.authoredFormat;
|
|
510
|
-
if (!N(c))
|
|
511
|
-
return s;
|
|
512
|
-
const u = Le(t, s), d = u ? n.resolveBoundCurrency(u) : void 0;
|
|
513
|
-
return l.source === "inferred" && !d ? s : {
|
|
514
|
-
...s,
|
|
515
|
-
format: l.source === "inferred" ? P(
|
|
516
|
-
c,
|
|
517
|
-
i,
|
|
518
|
-
d
|
|
519
|
-
) : Jt({
|
|
520
|
-
card: t,
|
|
521
|
-
metric: s,
|
|
522
|
-
context: n,
|
|
523
|
-
authoredFormat: c
|
|
524
|
-
})
|
|
525
|
-
};
|
|
526
|
-
});
|
|
527
|
-
return {
|
|
528
|
-
...t,
|
|
529
|
-
config: {
|
|
530
|
-
...t.config || {},
|
|
531
|
-
metricColumns: r
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
function ge(e) {
|
|
536
|
-
var l;
|
|
537
|
-
const { card: t, context: n, formatOptions: i } = e, r = n == null ? void 0 : n.preferences;
|
|
538
|
-
if (!t || !r || !Pt(t.type))
|
|
539
|
-
return i;
|
|
540
|
-
if (!i) {
|
|
541
|
-
const c = e.metrics.filter(
|
|
542
|
-
(d) => !!d
|
|
543
|
-
), u = c.some(
|
|
544
|
-
(d) => N(d.format)
|
|
545
|
-
);
|
|
546
|
-
return c.length < 2 || !u ? i : E(
|
|
547
|
-
P({ type: "number" }, r),
|
|
548
|
-
{ preserveOmittedProperties: !0 }
|
|
549
|
-
);
|
|
550
|
-
}
|
|
551
|
-
if ((l = t.sql) != null && l.trim()) {
|
|
552
|
-
const c = e.metrics.filter(
|
|
553
|
-
(d) => !!d
|
|
554
|
-
), u = c.filter(
|
|
555
|
-
(d) => N(d.format)
|
|
556
|
-
);
|
|
557
|
-
if (u.length === 0)
|
|
558
|
-
return i;
|
|
559
|
-
if (u.length !== c.length)
|
|
560
|
-
return E(
|
|
561
|
-
P({ type: "number" }, r),
|
|
562
|
-
{ preserveOmittedProperties: !0 }
|
|
563
|
-
);
|
|
564
|
-
}
|
|
565
|
-
const a = le(i, {
|
|
566
|
-
preserveOmittedProperties: !0
|
|
567
|
-
});
|
|
568
|
-
if (!N(a))
|
|
569
|
-
return i;
|
|
570
|
-
const o = e.metrics.flatMap((c) => {
|
|
571
|
-
if (!c)
|
|
572
|
-
return [];
|
|
573
|
-
const u = Le(t, c);
|
|
574
|
-
return [
|
|
575
|
-
P(
|
|
576
|
-
a,
|
|
577
|
-
r,
|
|
578
|
-
u ? n.resolveBoundCurrency(u) : void 0
|
|
579
|
-
)
|
|
580
|
-
];
|
|
581
|
-
});
|
|
582
|
-
if (o.length === 0)
|
|
583
|
-
return E(
|
|
584
|
-
P(a, r),
|
|
585
|
-
{ preserveOmittedProperties: !0 }
|
|
586
|
-
);
|
|
587
|
-
const [s] = o;
|
|
588
|
-
if (o.some((c) => !ue(c, s))) {
|
|
589
|
-
const c = P(
|
|
590
|
-
{
|
|
591
|
-
...a,
|
|
592
|
-
type: "number",
|
|
593
|
-
currency: void 0
|
|
594
|
-
},
|
|
595
|
-
r
|
|
596
|
-
);
|
|
597
|
-
return E(c, {
|
|
598
|
-
preserveOmittedProperties: !0
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
return E(s, {
|
|
602
|
-
preserveOmittedProperties: !0
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
const xr = /* @__PURE__ */ new Set([
|
|
606
|
-
"horizontalBar",
|
|
607
|
-
"tornado",
|
|
608
|
-
"pyramid",
|
|
609
|
-
"range"
|
|
610
|
-
]), Sr = /* @__PURE__ */ new Set([
|
|
611
|
-
"tornado",
|
|
612
|
-
"pyramid",
|
|
613
|
-
"range"
|
|
614
|
-
]), Dr = /* @__PURE__ */ new Set([
|
|
615
|
-
"tornado",
|
|
616
|
-
"pyramid",
|
|
617
|
-
"range"
|
|
618
|
-
]);
|
|
619
|
-
function wr(e) {
|
|
620
|
-
const { chartType: t, resultKeys: n, config: i } = e, r = 1 + (i != null && i.enableGrouping && (i.groupKey || n[1]) ? 1 : 0), a = n.slice(r), o = (i == null ? void 0 : i.xMetricKey) ?? a[0], s = (i == null ? void 0 : i.yMetricKey) ?? a[1] ?? a[0], l = t === "bubble" ? (i == null ? void 0 : i.radiusMetricKey) ?? a[2] ?? a[1] ?? a[0] : void 0, c = new Set(n);
|
|
621
|
-
return [o, s, l].filter((u) => !!u).filter((u) => c.has(u));
|
|
622
|
-
}
|
|
623
|
-
function Ko(e) {
|
|
624
|
-
const { chartType: t, resultKeys: n, preferences: i } = e;
|
|
625
|
-
return t === "scatter" || t === "bubble" ? [
|
|
626
|
-
...new Set(
|
|
627
|
-
wr({
|
|
628
|
-
chartType: t,
|
|
629
|
-
resultKeys: n,
|
|
630
|
-
config: i == null ? void 0 : i.bubbleScatterConfig
|
|
631
|
-
})
|
|
632
|
-
)
|
|
633
|
-
] : Dr.has(t || "") ? n.slice(2) : n.length === 1 ? [n[0]] : n.slice(1);
|
|
634
|
-
}
|
|
635
|
-
function te(e, t) {
|
|
636
|
-
var n;
|
|
637
|
-
return ((n = t == null ? void 0 : t.chartOptions) == null ? void 0 : n.indexAxis) === "y" || xr.has(e || "") ? "x" : "y";
|
|
638
|
-
}
|
|
639
|
-
function Lo(e, t) {
|
|
640
|
-
return te(e, t) === "x";
|
|
641
|
-
}
|
|
642
|
-
function Tr(e, t) {
|
|
643
|
-
return te(e, t) === "y" ? t == null ? void 0 : t.yAxisConfig : (t == null ? void 0 : t.xAxisConfig) || (Sr.has(e || "") ? t == null ? void 0 : t.yAxisConfig : void 0);
|
|
644
|
-
}
|
|
645
|
-
function Te(e) {
|
|
646
|
-
return e ? Object.entries(e).some(([t, n]) => n == null || n === "" ? !1 : t === "type" ? n !== "auto" : !0) : !1;
|
|
647
|
-
}
|
|
648
|
-
function Qt(e) {
|
|
649
|
-
if (e)
|
|
650
|
-
return e.alias || e.label || e.name;
|
|
651
|
-
}
|
|
652
|
-
function Oe(e, t) {
|
|
653
|
-
var i;
|
|
654
|
-
return (((i = e == null ? void 0 : e.config) == null ? void 0 : i.metricColumns) || []).find((r) => {
|
|
655
|
-
const a = Qt(r);
|
|
656
|
-
return t.metricId && r.id === t.metricId || t.metricAlias && a === t.metricAlias || t.metricAlias && r.alias === t.metricAlias || t.columnId && a === t.columnId || t.columnId && r.alias === t.columnId || t.columnId && r.label === t.columnId || t.columnId && r.name === t.columnId;
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
function ne(e, t) {
|
|
660
|
-
var i, r;
|
|
661
|
-
const n = Un(e, t);
|
|
662
|
-
if (!(n && ((r = (i = e == null ? void 0 : e.config) == null ? void 0 : i.groupByColumns) != null && r.includes(n)) && !jn(n)))
|
|
663
|
-
return n;
|
|
664
|
-
}
|
|
665
|
-
function Or(e) {
|
|
666
|
-
return !!e && !(e != null && e.format) && qt(e == null ? void 0 : e.dataType) === "number";
|
|
667
|
-
}
|
|
668
|
-
const Mr = {
|
|
669
|
-
style: "decimal"
|
|
670
|
-
};
|
|
671
|
-
function Zt(e) {
|
|
672
|
-
if (!e)
|
|
673
|
-
return;
|
|
674
|
-
const t = Ve();
|
|
675
|
-
return {
|
|
676
|
-
...t,
|
|
677
|
-
...e,
|
|
678
|
-
inheritMetricFormat: e.numberFormat ? e.inheritMetricFormat : e.inheritMetricFormat ?? t.inheritMetricFormat,
|
|
679
|
-
numberFormat: {
|
|
680
|
-
...Mr,
|
|
681
|
-
...e.numberFormat
|
|
682
|
-
},
|
|
683
|
-
dateFormat: {
|
|
684
|
-
...t.dateFormat,
|
|
685
|
-
...e.dateFormat
|
|
686
|
-
},
|
|
687
|
-
linkFormat: {
|
|
688
|
-
...t.linkFormat,
|
|
689
|
-
...e.linkFormat
|
|
690
|
-
}
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
|
-
function Bo(e) {
|
|
694
|
-
return Object.fromEntries(
|
|
695
|
-
Object.entries(e || {}).map(([t, n]) => [
|
|
696
|
-
t,
|
|
697
|
-
Zt(n)
|
|
698
|
-
])
|
|
699
|
-
);
|
|
700
|
-
}
|
|
701
|
-
function re(e) {
|
|
702
|
-
return !!(e && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype);
|
|
703
|
-
}
|
|
704
|
-
function Xt(e, t, n) {
|
|
705
|
-
if (!re(n))
|
|
706
|
-
return n;
|
|
707
|
-
const i = re(e) ? e : {}, r = re(t) ? t : {}, a = {};
|
|
708
|
-
for (const o of Object.keys(n)) {
|
|
709
|
-
const s = n[o];
|
|
710
|
-
if (s === void 0)
|
|
711
|
-
continue;
|
|
712
|
-
const l = Object.prototype.hasOwnProperty.call(
|
|
713
|
-
i,
|
|
714
|
-
o
|
|
715
|
-
), c = r[o];
|
|
716
|
-
if (l && ue(s, c)) {
|
|
717
|
-
a[o] = i[o];
|
|
718
|
-
continue;
|
|
719
|
-
}
|
|
720
|
-
if (!l && ue(s, c))
|
|
721
|
-
continue;
|
|
722
|
-
const u = Xt(
|
|
723
|
-
i[o],
|
|
724
|
-
c,
|
|
725
|
-
s
|
|
726
|
-
);
|
|
727
|
-
re(u) && Object.keys(u).length === 0 && !l || (a[o] = u);
|
|
728
|
-
}
|
|
729
|
-
return a;
|
|
730
|
-
}
|
|
731
|
-
function qo(e) {
|
|
732
|
-
let t = Xt(
|
|
733
|
-
e.persisted,
|
|
734
|
-
e.baseline,
|
|
735
|
-
e.next
|
|
736
|
-
);
|
|
737
|
-
if (e.enforceDeclaredSqlTemporalFormat && e.next.type === "date" && !e.next.dateFormat.useRelativeTime && e.next.dateFormat.useCustomFormat) {
|
|
738
|
-
const n = e.next.dateFormat.customFormat;
|
|
739
|
-
if (!(n != null && n.trim()))
|
|
740
|
-
throw new Li(
|
|
741
|
-
"invalid_raw_temporal_format",
|
|
742
|
-
"Custom table date formatting requires a non-empty pattern."
|
|
743
|
-
);
|
|
744
|
-
Bi({
|
|
745
|
-
dialect: "date_fns",
|
|
746
|
-
pattern: n,
|
|
747
|
-
valueKind: e.rawTemporalValueKind
|
|
748
|
-
}), t = {
|
|
749
|
-
...t,
|
|
750
|
-
dateFormat: {
|
|
751
|
-
...t.dateFormat,
|
|
752
|
-
useCustomFormat: !0,
|
|
753
|
-
customFormat: n
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
}
|
|
757
|
-
return e.next.type === "number" && !ue(e.next.numberFormat, e.baseline.numberFormat) && t.numberFormat ? {
|
|
758
|
-
...t,
|
|
759
|
-
type: "number",
|
|
760
|
-
inheritMetricFormat: e.next.inheritMetricFormat ?? !1
|
|
761
|
-
} : e.next.type === "number" && e.baseline.inheritMetricFormat === !0 && e.next.inheritMetricFormat === !1 ? {
|
|
762
|
-
...t,
|
|
763
|
-
type: "number",
|
|
764
|
-
inheritMetricFormat: !1
|
|
765
|
-
} : e.forcePersistDateType && e.next.type === "date" ? {
|
|
766
|
-
...t,
|
|
767
|
-
type: "date"
|
|
768
|
-
} : t;
|
|
769
|
-
}
|
|
770
|
-
function Pr(e, t) {
|
|
771
|
-
const n = e || Ve(), i = !t;
|
|
772
|
-
return {
|
|
773
|
-
...n,
|
|
774
|
-
type: "number",
|
|
775
|
-
textAlign: n.type === "none" ? "right" : n.textAlign,
|
|
776
|
-
numberFormat: {
|
|
777
|
-
style: "decimal",
|
|
778
|
-
minimumFractionDigits: i ? n.numberFormat.minimumFractionDigits : void 0,
|
|
779
|
-
maximumFractionDigits: i ? n.numberFormat.maximumFractionDigits : void 0,
|
|
780
|
-
useGrouping: n.numberFormat.useGrouping
|
|
781
|
-
}
|
|
782
|
-
};
|
|
783
|
-
}
|
|
784
|
-
function Ce(e) {
|
|
785
|
-
if (e)
|
|
786
|
-
return e.trim().toLowerCase();
|
|
787
|
-
}
|
|
788
|
-
const en = /\s*(?:\((?:previous|last year|start|target|comparison)\)|δ)\s*$/i;
|
|
789
|
-
function kr(e) {
|
|
790
|
-
const t = e == null ? void 0 : e.trim();
|
|
791
|
-
return t ? t.replace(en, "").trim() || t : void 0;
|
|
792
|
-
}
|
|
793
|
-
function Ar(e) {
|
|
794
|
-
const t = e == null ? void 0 : e.trim();
|
|
795
|
-
return t ? en.test(t) : !1;
|
|
796
|
-
}
|
|
797
|
-
function Nr(e, t) {
|
|
798
|
-
return t.metricAlias ? e.find(
|
|
799
|
-
(n) => Ai(n) === t.metricAlias
|
|
800
|
-
) : t.metricId ? e.find((n) => n.id === t.metricId) : void 0;
|
|
801
|
-
}
|
|
802
|
-
function Rr(e) {
|
|
803
|
-
var b;
|
|
804
|
-
const {
|
|
805
|
-
card: t,
|
|
806
|
-
metricId: n,
|
|
807
|
-
metricAlias: i,
|
|
808
|
-
datasetIndex: r,
|
|
809
|
-
datasetLabel: a,
|
|
810
|
-
metricKey: o
|
|
811
|
-
} = e, s = ((b = t == null ? void 0 : t.config) == null ? void 0 : b.metricColumns) || [];
|
|
812
|
-
if (i || n)
|
|
813
|
-
return Nr(s, {
|
|
814
|
-
metricAlias: i,
|
|
815
|
-
metricId: n
|
|
816
|
-
});
|
|
817
|
-
const l = [o, a], c = l.some(
|
|
818
|
-
(m) => Ar(m)
|
|
819
|
-
), u = l.filter(
|
|
820
|
-
(m) => !!m
|
|
821
|
-
);
|
|
822
|
-
for (const m of u) {
|
|
823
|
-
const v = Oe(t, {
|
|
824
|
-
columnId: m,
|
|
825
|
-
metricAlias: m
|
|
826
|
-
});
|
|
827
|
-
if (v)
|
|
828
|
-
return v;
|
|
829
|
-
}
|
|
830
|
-
const d = u.map((m) => Ce(m)).filter((m) => !!m), f = u.map((m) => kr(m)).filter((m) => !!m);
|
|
831
|
-
for (const m of f) {
|
|
832
|
-
const v = Oe(t, {
|
|
833
|
-
columnId: m,
|
|
834
|
-
metricAlias: m
|
|
835
|
-
});
|
|
836
|
-
if (v)
|
|
837
|
-
return v;
|
|
838
|
-
}
|
|
839
|
-
if (s.length === 1)
|
|
840
|
-
return s[0];
|
|
841
|
-
if (!c && typeof r == "number" && r >= 0 && r < s.length)
|
|
842
|
-
return s[r];
|
|
843
|
-
const p = f.map((m) => Ce(m)).filter((m) => !!m), g = [
|
|
844
|
-
...d,
|
|
845
|
-
...p
|
|
846
|
-
];
|
|
847
|
-
if (g.length !== 0)
|
|
848
|
-
return s.find((m) => {
|
|
849
|
-
const v = [
|
|
850
|
-
m.alias,
|
|
851
|
-
m.label,
|
|
852
|
-
m.name,
|
|
853
|
-
Qt(m)
|
|
854
|
-
].map((x) => Ce(x)).filter((x) => !!x);
|
|
855
|
-
return g.some(
|
|
856
|
-
(x) => v.includes(x)
|
|
857
|
-
);
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
function _r(e) {
|
|
861
|
-
const t = G(e == null ? void 0 : e.format);
|
|
862
|
-
return E(t);
|
|
863
|
-
}
|
|
864
|
-
function pt(e, t) {
|
|
865
|
-
if (t)
|
|
866
|
-
return Oe(e, {
|
|
867
|
-
columnId: t,
|
|
868
|
-
metricAlias: t
|
|
869
|
-
});
|
|
870
|
-
}
|
|
871
|
-
function gt(e) {
|
|
872
|
-
const t = le(e);
|
|
873
|
-
if (t)
|
|
874
|
-
return JSON.stringify(t);
|
|
875
|
-
}
|
|
876
|
-
function Er(e, t) {
|
|
877
|
-
const n = gt(e), i = gt(t);
|
|
878
|
-
return !!(n && i && n === i);
|
|
879
|
-
}
|
|
880
|
-
function Vr(e) {
|
|
881
|
-
if (e.length === 0)
|
|
882
|
-
return;
|
|
883
|
-
const t = e.map(
|
|
884
|
-
(o) => _r(o)
|
|
885
|
-
);
|
|
886
|
-
if (!t.every(
|
|
887
|
-
(o) => Te(o)
|
|
888
|
-
))
|
|
889
|
-
return;
|
|
890
|
-
const i = t, [r] = i;
|
|
891
|
-
return i.every(
|
|
892
|
-
(o) => Er(r, o)
|
|
893
|
-
) ? r : void 0;
|
|
894
|
-
}
|
|
895
|
-
function ye(e) {
|
|
896
|
-
if (Te(e.overrideFormatOptions))
|
|
897
|
-
return {
|
|
898
|
-
formatOptions: e.overrideFormatOptions || void 0,
|
|
899
|
-
source: "override"
|
|
900
|
-
};
|
|
901
|
-
const t = Vr(
|
|
902
|
-
e.metrics || []
|
|
903
|
-
);
|
|
904
|
-
return Te(t) ? {
|
|
905
|
-
formatOptions: t,
|
|
906
|
-
source: "metric"
|
|
907
|
-
} : {
|
|
908
|
-
formatOptions: void 0,
|
|
909
|
-
source: "auto"
|
|
910
|
-
};
|
|
911
|
-
}
|
|
912
|
-
function tn(e) {
|
|
913
|
-
var l, c, u;
|
|
914
|
-
const { card: t, chartType: n, axis: i, preferences: r } = e, a = ((l = t == null ? void 0 : t.config) == null ? void 0 : l.metricColumns) || [], o = (r == null ? void 0 : r.datasetOptions) || [];
|
|
915
|
-
if (!a.length)
|
|
916
|
-
return [];
|
|
917
|
-
if (n === "combo")
|
|
918
|
-
return i === "x" ? [] : a.filter((d, f) => {
|
|
919
|
-
const p = o.find((b) => b.idx === f);
|
|
920
|
-
return ((p == null ? void 0 : p.yAxisId) === "y2" ? "y2" : "y") === i;
|
|
921
|
-
});
|
|
922
|
-
if (n === "bubble" || n === "scatter") {
|
|
923
|
-
if (i === "y2")
|
|
924
|
-
return [];
|
|
925
|
-
const d = pt(
|
|
926
|
-
t,
|
|
927
|
-
(c = r == null ? void 0 : r.bubbleScatterConfig) == null ? void 0 : c.xMetricKey
|
|
928
|
-
) || a[0], f = pt(
|
|
929
|
-
t,
|
|
930
|
-
(u = r == null ? void 0 : r.bubbleScatterConfig) == null ? void 0 : u.yMetricKey
|
|
931
|
-
) || a[1] || a[0];
|
|
932
|
-
return i === "x" ? d ? [d] : [] : f ? [f] : [];
|
|
933
|
-
}
|
|
934
|
-
const s = te(n, r);
|
|
935
|
-
return n === "radar" ? i === "y" ? a : [] : i !== s ? [] : a;
|
|
936
|
-
}
|
|
937
|
-
function Be(e) {
|
|
938
|
-
const { card: t, chartType: n, axis: i, preferences: r, axisConfig: a } = e, o = tn({
|
|
939
|
-
card: t,
|
|
940
|
-
chartType: n,
|
|
941
|
-
axis: i,
|
|
942
|
-
preferences: r
|
|
943
|
-
}), s = ye({
|
|
944
|
-
overrideFormatOptions: pe(a == null ? void 0 : a.valueFormat),
|
|
945
|
-
metrics: o
|
|
946
|
-
});
|
|
947
|
-
return {
|
|
948
|
-
...s,
|
|
949
|
-
formatOptions: ge({
|
|
950
|
-
card: t,
|
|
951
|
-
metrics: o,
|
|
952
|
-
formatOptions: s.formatOptions,
|
|
953
|
-
context: e.numericPresentation
|
|
954
|
-
})
|
|
955
|
-
};
|
|
956
|
-
}
|
|
957
|
-
function Kr(e) {
|
|
958
|
-
const { preferences: t, metric: n } = e, i = t == null ? void 0 : t.tooltipConfig, r = ye({
|
|
959
|
-
overrideFormatOptions: pe(i == null ? void 0 : i.valueFormat),
|
|
960
|
-
metrics: n ? [n] : []
|
|
961
|
-
});
|
|
962
|
-
return {
|
|
963
|
-
...r,
|
|
964
|
-
formatOptions: ge({
|
|
965
|
-
card: e.card,
|
|
966
|
-
metrics: e.metric ? [e.metric] : [],
|
|
967
|
-
formatOptions: r.formatOptions,
|
|
968
|
-
context: e.numericPresentation
|
|
969
|
-
})
|
|
970
|
-
};
|
|
971
|
-
}
|
|
972
|
-
function qe(e, t, n) {
|
|
973
|
-
return t === te(n, e) ? Tr(n, e) : t === "x" ? e == null ? void 0 : e.xAxisConfig : t === "y2" ? e == null ? void 0 : e.secondaryYAxisConfig : e == null ? void 0 : e.yAxisConfig;
|
|
974
|
-
}
|
|
975
|
-
function $e(e) {
|
|
976
|
-
const { chartType: t, preferences: n } = e;
|
|
977
|
-
return t === "bubble" || t === "scatter" ? "y" : te(t, n);
|
|
978
|
-
}
|
|
979
|
-
function nn(e) {
|
|
980
|
-
switch (e) {
|
|
981
|
-
case "pie":
|
|
982
|
-
case "doughnut":
|
|
983
|
-
case "polarArea":
|
|
984
|
-
case "funnel":
|
|
985
|
-
case "treemap":
|
|
986
|
-
case "heatmap":
|
|
987
|
-
return !1;
|
|
988
|
-
default:
|
|
989
|
-
return !0;
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
function $o(e) {
|
|
993
|
-
const { card: t, chartType: n, preferences: i, metric: r } = e, a = Kr({
|
|
994
|
-
card: t,
|
|
995
|
-
preferences: i,
|
|
996
|
-
metric: r,
|
|
997
|
-
numericPresentation: e.numericPresentation
|
|
998
|
-
});
|
|
999
|
-
if (a.source === "override")
|
|
1000
|
-
return a;
|
|
1001
|
-
const o = e.axis || $e({ chartType: n, preferences: i }), s = Be({
|
|
1002
|
-
card: t,
|
|
1003
|
-
chartType: n,
|
|
1004
|
-
axis: o,
|
|
1005
|
-
preferences: i,
|
|
1006
|
-
axisConfig: qe(i, o, n),
|
|
1007
|
-
numericPresentation: e.numericPresentation
|
|
1008
|
-
});
|
|
1009
|
-
return s.source === "override" ? s : a;
|
|
1010
|
-
}
|
|
1011
|
-
function zo(e) {
|
|
1012
|
-
const { card: t, chartType: n, preferences: i, dataLabelsConfig: r } = e, a = n || (t == null ? void 0 : t.type), o = $e({
|
|
1013
|
-
chartType: a,
|
|
1014
|
-
preferences: i
|
|
1015
|
-
}), s = tn({
|
|
1016
|
-
card: t,
|
|
1017
|
-
chartType: a,
|
|
1018
|
-
axis: o,
|
|
1019
|
-
preferences: i
|
|
1020
|
-
}), l = ye({
|
|
1021
|
-
overrideFormatOptions: pe(r == null ? void 0 : r.valueFormat),
|
|
1022
|
-
metrics: s
|
|
1023
|
-
}), c = {
|
|
1024
|
-
...l,
|
|
1025
|
-
formatOptions: ge({
|
|
1026
|
-
card: t,
|
|
1027
|
-
metrics: s,
|
|
1028
|
-
formatOptions: l.formatOptions,
|
|
1029
|
-
context: e.numericPresentation
|
|
1030
|
-
})
|
|
1031
|
-
};
|
|
1032
|
-
if (c.source === "override" || !nn(a))
|
|
1033
|
-
return c;
|
|
1034
|
-
const u = Be({
|
|
1035
|
-
card: t,
|
|
1036
|
-
chartType: a,
|
|
1037
|
-
axis: o,
|
|
1038
|
-
preferences: i,
|
|
1039
|
-
axisConfig: qe(
|
|
1040
|
-
i,
|
|
1041
|
-
o,
|
|
1042
|
-
a
|
|
1043
|
-
),
|
|
1044
|
-
numericPresentation: e.numericPresentation
|
|
1045
|
-
});
|
|
1046
|
-
return u.source === "override" ? u : c;
|
|
1047
|
-
}
|
|
1048
|
-
function Lr(e) {
|
|
1049
|
-
const { preferences: t, dataLabelsConfig: n, metric: i } = e, r = ye({
|
|
1050
|
-
overrideFormatOptions: pe(n == null ? void 0 : n.valueFormat),
|
|
1051
|
-
metrics: i ? [i] : []
|
|
1052
|
-
});
|
|
1053
|
-
return {
|
|
1054
|
-
...r,
|
|
1055
|
-
formatOptions: ge({
|
|
1056
|
-
card: e.card,
|
|
1057
|
-
metrics: e.metric ? [e.metric] : [],
|
|
1058
|
-
formatOptions: r.formatOptions,
|
|
1059
|
-
context: e.numericPresentation
|
|
1060
|
-
})
|
|
1061
|
-
};
|
|
1062
|
-
}
|
|
1063
|
-
function Uo(e) {
|
|
1064
|
-
var o, s;
|
|
1065
|
-
const t = Rr({
|
|
1066
|
-
card: e.card,
|
|
1067
|
-
metricId: e.metricId,
|
|
1068
|
-
metricAlias: e.metricAlias,
|
|
1069
|
-
datasetIndex: e.datasetIndex,
|
|
1070
|
-
datasetLabel: e.datasetLabel,
|
|
1071
|
-
metricKey: e.metricKey
|
|
1072
|
-
}), n = Lr({
|
|
1073
|
-
card: e.card,
|
|
1074
|
-
preferences: e.preferences,
|
|
1075
|
-
dataLabelsConfig: e.dataLabelsConfig,
|
|
1076
|
-
metric: t,
|
|
1077
|
-
numericPresentation: e.numericPresentation
|
|
1078
|
-
});
|
|
1079
|
-
if (n.source === "override")
|
|
1080
|
-
return n;
|
|
1081
|
-
const i = (o = e.card) == null ? void 0 : o.type;
|
|
1082
|
-
if (!nn(i))
|
|
1083
|
-
return n;
|
|
1084
|
-
let r = $e({
|
|
1085
|
-
chartType: i,
|
|
1086
|
-
preferences: e.preferences
|
|
1087
|
-
});
|
|
1088
|
-
if (i === "combo" && typeof e.datasetIndex == "number") {
|
|
1089
|
-
const c = (((s = e.preferences) == null ? void 0 : s.datasetOptions) || []).find(
|
|
1090
|
-
(u) => u.idx === e.datasetIndex
|
|
1091
|
-
);
|
|
1092
|
-
r = (c == null ? void 0 : c.yAxisId) === "y2" ? "y2" : "y";
|
|
1093
|
-
}
|
|
1094
|
-
const a = Be({
|
|
1095
|
-
card: e.card,
|
|
1096
|
-
chartType: i,
|
|
1097
|
-
axis: r,
|
|
1098
|
-
preferences: e.preferences,
|
|
1099
|
-
axisConfig: qe(
|
|
1100
|
-
e.preferences,
|
|
1101
|
-
r,
|
|
1102
|
-
i
|
|
1103
|
-
),
|
|
1104
|
-
numericPresentation: e.numericPresentation
|
|
1105
|
-
});
|
|
1106
|
-
return a.source === "override" ? a : n;
|
|
1107
|
-
}
|
|
1108
|
-
function jo(e) {
|
|
1109
|
-
return (e == null ? void 0 : e.rawValue) === !0;
|
|
1110
|
-
}
|
|
1111
|
-
function Br(e) {
|
|
1112
|
-
const t = e == null ? void 0 : e.numberFormat;
|
|
1113
|
-
if (!t)
|
|
1114
|
-
return;
|
|
1115
|
-
if (t.style === "duration")
|
|
1116
|
-
return E(ke(t), {
|
|
1117
|
-
preserveOmittedProperties: !0
|
|
1118
|
-
});
|
|
1119
|
-
const n = t.style === "currency" ? "currency" : t.style === "percent" ? "percent" : t.style === "scientific" ? "scientific" : "number", i = t.minimumFractionDigits, r = t.maximumFractionDigits;
|
|
1120
|
-
return {
|
|
1121
|
-
type: n,
|
|
1122
|
-
currency: n === "currency" ? t.currency : void 0,
|
|
1123
|
-
locale: t.locale,
|
|
1124
|
-
decimalPlaces: i === r ? r : void 0,
|
|
1125
|
-
minimumFractionDigits: i,
|
|
1126
|
-
maximumFractionDigits: r,
|
|
1127
|
-
useGrouping: t.useGrouping,
|
|
1128
|
-
percentValueMode: n === "percent" ? t.percentValueMode : void 0,
|
|
1129
|
-
multiplyBy: t.scale,
|
|
1130
|
-
useSuffix: t.compact,
|
|
1131
|
-
negativeInParentheses: t.negativeStyle === "parentheses",
|
|
1132
|
-
prefix: t.prefix,
|
|
1133
|
-
suffix: t.suffix
|
|
1134
|
-
};
|
|
1135
|
-
}
|
|
1136
|
-
function qr(e, t, n = !1) {
|
|
1137
|
-
const i = n ? { preserveOmittedProperties: !0 } : void 0, r = G(e == null ? void 0 : e.format, i), a = jt(
|
|
1138
|
-
r,
|
|
1139
|
-
i
|
|
1140
|
-
);
|
|
1141
|
-
if (!a)
|
|
1142
|
-
return;
|
|
1143
|
-
const o = t || Ve(), s = n ? void 0 : o.numberFormat, l = o.type && o.type !== "none";
|
|
1144
|
-
return {
|
|
1145
|
-
...o,
|
|
1146
|
-
type: l ? o.type : "number",
|
|
1147
|
-
// A column's own format (an override) shows as its own, not the measure's
|
|
1148
|
-
// (column formats CF-D20, ledger P5-42).
|
|
1149
|
-
inheritMetricFormat: (e == null ? void 0 : e.formatOrigin) === "override" ? !1 : o.inheritMetricFormat ?? !0,
|
|
1150
|
-
textAlign: l ? o.textAlign : "right",
|
|
1151
|
-
numberFormat: {
|
|
1152
|
-
...s,
|
|
1153
|
-
...a
|
|
1154
|
-
}
|
|
1155
|
-
};
|
|
1156
|
-
}
|
|
1157
|
-
function rn(e) {
|
|
1158
|
-
var D;
|
|
1159
|
-
const {
|
|
1160
|
-
card: t,
|
|
1161
|
-
columnId: n,
|
|
1162
|
-
persistedSettings: i,
|
|
1163
|
-
resolvedSettings: r,
|
|
1164
|
-
fallbackSettings: a,
|
|
1165
|
-
metricId: o,
|
|
1166
|
-
metricAlias: s,
|
|
1167
|
-
fieldId: l,
|
|
1168
|
-
fieldRole: c,
|
|
1169
|
-
columnKeyMap: u,
|
|
1170
|
-
valueFormatPreferences: d,
|
|
1171
|
-
boundCurrency: f,
|
|
1172
|
-
preserveOmittedProperties: p
|
|
1173
|
-
} = e, g = i ?? z(t)[n], b = !((D = t == null ? void 0 : t.sql) != null && D.trim()) || Tn(g), m = b ? d : null, v = b ? f : void 0, x = r ?? Zt(g);
|
|
1174
|
-
if (x && x.inheritMetricFormat !== !0)
|
|
1175
|
-
return yt(
|
|
1176
|
-
x,
|
|
1177
|
-
m,
|
|
1178
|
-
v
|
|
1179
|
-
);
|
|
1180
|
-
const h = ne(t, {
|
|
1181
|
-
columnId: n,
|
|
1182
|
-
metricId: o,
|
|
1183
|
-
metricAlias: s,
|
|
1184
|
-
columnKeyMap: u,
|
|
1185
|
-
fieldId: l,
|
|
1186
|
-
fieldRole: c
|
|
1187
|
-
}), y = qr(
|
|
1188
|
-
h,
|
|
1189
|
-
x || a,
|
|
1190
|
-
p ?? !!d
|
|
1191
|
-
), C = !y && m && Or(h) ? Pr(
|
|
1192
|
-
x || a,
|
|
1193
|
-
v
|
|
1194
|
-
) : void 0;
|
|
1195
|
-
return yt(
|
|
1196
|
-
y || C || x || a,
|
|
1197
|
-
m,
|
|
1198
|
-
v
|
|
1199
|
-
);
|
|
1200
|
-
}
|
|
1201
|
-
function yt(e, t, n) {
|
|
1202
|
-
if (!e || e.type !== "number" || !t)
|
|
1203
|
-
return e;
|
|
1204
|
-
const i = e.numberFormat, r = i ? ke(i, {
|
|
1205
|
-
preserveOmittedProperties: !0
|
|
1206
|
-
}) : { type: "number" };
|
|
1207
|
-
if (!r || !N(r))
|
|
1208
|
-
return e;
|
|
1209
|
-
const a = P(
|
|
1210
|
-
r,
|
|
1211
|
-
t,
|
|
1212
|
-
n
|
|
1213
|
-
), o = jt(a, {
|
|
1214
|
-
preserveOmittedProperties: !0
|
|
1215
|
-
});
|
|
1216
|
-
return o ? {
|
|
1217
|
-
...e,
|
|
1218
|
-
numberFormat: {
|
|
1219
|
-
...i,
|
|
1220
|
-
...o
|
|
1221
|
-
}
|
|
1222
|
-
} : e;
|
|
1223
|
-
}
|
|
1224
|
-
function de(e) {
|
|
1225
|
-
if (!e.valueFormatPreferences)
|
|
1226
|
-
return;
|
|
1227
|
-
const t = rn(e);
|
|
1228
|
-
if (!t || t.type !== "number")
|
|
1229
|
-
return;
|
|
1230
|
-
const n = ke(t.numberFormat, {
|
|
1231
|
-
preserveOmittedProperties: !0
|
|
1232
|
-
});
|
|
1233
|
-
if (!(!n || !qi(n)))
|
|
1234
|
-
return n;
|
|
1235
|
-
}
|
|
1236
|
-
function $r(e) {
|
|
1237
|
-
var i, r;
|
|
1238
|
-
if (!e.presentation.preferences)
|
|
1239
|
-
return;
|
|
1240
|
-
const t = ne(e.card, {
|
|
1241
|
-
columnId: e.columnId,
|
|
1242
|
-
metricId: e.metricId,
|
|
1243
|
-
metricAlias: e.metricAlias,
|
|
1244
|
-
columnKeyMap: e.columnKeyMap
|
|
1245
|
-
});
|
|
1246
|
-
if (e.comparisonValueKind === "percent_change" || e.comparisonValueKind === "ratio") {
|
|
1247
|
-
const a = de({
|
|
1248
|
-
card: e.card,
|
|
1249
|
-
columnId: e.columnId,
|
|
1250
|
-
persistedSettings: e.persistedSettings,
|
|
1251
|
-
resolvedSettings: e.resolvedSettings,
|
|
1252
|
-
fallbackSettings: e.fallbackSettings,
|
|
1253
|
-
metricId: e.metricId,
|
|
1254
|
-
columnKeyMap: e.columnKeyMap,
|
|
1255
|
-
metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
|
|
1256
|
-
valueFormatPreferences: e.presentation.preferences
|
|
1257
|
-
}), o = On(e.comparisonPrecision) ?? (N(a) ? a.maximumFractionDigits : void 0) ?? (e.comparisonValueKind === "percent_change" ? 1 : 2);
|
|
1258
|
-
return e.comparisonValueKind === "percent_change" ? {
|
|
1259
|
-
type: "percent",
|
|
1260
|
-
locale: e.presentation.preferences.locale,
|
|
1261
|
-
percentValueMode: "fraction",
|
|
1262
|
-
minimumFractionDigits: o,
|
|
1263
|
-
maximumFractionDigits: o
|
|
1264
|
-
} : {
|
|
1265
|
-
type: "number",
|
|
1266
|
-
locale: e.presentation.preferences.locale,
|
|
1267
|
-
minimumFractionDigits: o,
|
|
1268
|
-
maximumFractionDigits: o,
|
|
1269
|
-
suffix: "×"
|
|
1270
|
-
};
|
|
1271
|
-
}
|
|
1272
|
-
const n = Mn({
|
|
1273
|
-
card: e.card,
|
|
1274
|
-
columnKey: e.columnId,
|
|
1275
|
-
metricId: e.metricId ?? (t && !((r = (i = e.card.config) == null ? void 0 : i.groupByColumns) != null && r.includes(t)) ? t.id : void 0)
|
|
1276
|
-
});
|
|
1277
|
-
return de({
|
|
1278
|
-
card: e.card,
|
|
1279
|
-
columnId: e.columnId,
|
|
1280
|
-
persistedSettings: e.persistedSettings,
|
|
1281
|
-
resolvedSettings: e.resolvedSettings,
|
|
1282
|
-
fallbackSettings: e.fallbackSettings,
|
|
1283
|
-
metricId: e.metricId,
|
|
1284
|
-
columnKeyMap: e.columnKeyMap,
|
|
1285
|
-
metricAlias: e.metricAlias ?? (t == null ? void 0 : t.alias),
|
|
1286
|
-
valueFormatPreferences: e.presentation.preferences,
|
|
1287
|
-
boundCurrency: n ? e.presentation.resolveBoundCurrency(n) : void 0
|
|
1288
|
-
});
|
|
1289
|
-
}
|
|
1290
|
-
function zr(e) {
|
|
1291
|
-
var s, l, c, u, d;
|
|
1292
|
-
if (e.card.type === "matrixTable" && e.target.kind === "matrix_measure") {
|
|
1293
|
-
const f = e.target, p = Pn(e.card, e.matrixCatalog).find(
|
|
1294
|
-
(b) => b.measureId === f.measureId
|
|
1295
|
-
), g = p == null ? void 0 : p.canonical;
|
|
1296
|
-
return g && (g.type === "number" || g.type === "currency") ? P(
|
|
1297
|
-
g,
|
|
1298
|
-
e.valueFormatPreferences,
|
|
1299
|
-
e.boundCurrency
|
|
1300
|
-
) : void 0;
|
|
1301
|
-
}
|
|
1302
|
-
if (e.target.kind === "matrix_measure")
|
|
1303
|
-
return;
|
|
1304
|
-
if (e.card.type === "kpi") {
|
|
1305
|
-
const f = e.target.kind === "metric" ? e.target.metricId : void 0, p = f ? ((l = (s = e.card.config) == null ? void 0 : s.metricColumns) == null ? void 0 : l.findIndex(
|
|
1306
|
-
(m) => m.id === f
|
|
1307
|
-
)) ?? -1 : 0;
|
|
1308
|
-
if (p < 0)
|
|
1309
|
-
return;
|
|
1310
|
-
const g = kn(e.card, {
|
|
1311
|
-
metricIndex: p,
|
|
1312
|
-
resultColumnKey: e.target.kind === "column" ? e.target.columnKey : void 0
|
|
1313
|
-
}), b = g.authoredFormat;
|
|
1314
|
-
return g.currencyBindable && b && N(b) ? P(
|
|
1315
|
-
b,
|
|
1316
|
-
e.valueFormatPreferences,
|
|
1317
|
-
e.boundCurrency
|
|
1318
|
-
) : void 0;
|
|
1319
|
-
}
|
|
1320
|
-
if (!((c = e.card.sql) != null && c.trim()) && !Gn(e.card.type) && e.target.kind === "metric") {
|
|
1321
|
-
const f = e.target.metricId, p = (d = (u = e.card.config) == null ? void 0 : u.metricColumns) == null ? void 0 : d.find(
|
|
1322
|
-
(m) => m.id === f
|
|
1323
|
-
);
|
|
1324
|
-
if (!p)
|
|
1325
|
-
return;
|
|
1326
|
-
const g = Tt(
|
|
1327
|
-
e.card,
|
|
1328
|
-
p
|
|
1329
|
-
), b = g.authoredFormat;
|
|
1330
|
-
return g.currencyBindable && b && N(b) ? P(
|
|
1331
|
-
b,
|
|
1332
|
-
e.valueFormatPreferences,
|
|
1333
|
-
e.boundCurrency
|
|
1334
|
-
) : void 0;
|
|
1335
|
-
}
|
|
1336
|
-
const n = z(e.card), i = e.target.kind === "metric" ? e.target.metricId : void 0, r = e.target.kind === "column" ? [e.target.columnKey] : [
|
|
1337
|
-
...e.resultColumnKeys || [],
|
|
1338
|
-
...Object.keys(n),
|
|
1339
|
-
e.target.metricId
|
|
1340
|
-
], a = e.target.kind === "column" ? e.target.columnKey : r.find(
|
|
1341
|
-
(f) => {
|
|
1342
|
-
var p;
|
|
1343
|
-
return ((p = ne(e.card, {
|
|
1344
|
-
columnId: f
|
|
1345
|
-
})) == null ? void 0 : p.id) === i;
|
|
1346
|
-
}
|
|
1347
|
-
) || i, o = de({
|
|
1348
|
-
card: e.card,
|
|
1349
|
-
columnId: a,
|
|
1350
|
-
metricId: i,
|
|
1351
|
-
persistedSettings: n[a],
|
|
1352
|
-
valueFormatPreferences: e.valueFormatPreferences,
|
|
1353
|
-
boundCurrency: e.boundCurrency
|
|
1354
|
-
});
|
|
1355
|
-
return N(o) ? o : void 0;
|
|
1356
|
-
}
|
|
1357
|
-
function Go(e) {
|
|
1358
|
-
var n, i;
|
|
1359
|
-
const t = e.persistedSettings ?? z(e.card)[e.columnId];
|
|
1360
|
-
if (!t && !e.resolvedSettings || (t == null ? void 0 : t.inheritMetricFormat) === !0 || ((n = e.resolvedSettings) == null ? void 0 : n.inheritMetricFormat) === !0) {
|
|
1361
|
-
const r = G(
|
|
1362
|
-
(i = ne(e.card, {
|
|
1363
|
-
columnId: e.columnId,
|
|
1364
|
-
metricId: e.metricId,
|
|
1365
|
-
metricAlias: e.metricAlias,
|
|
1366
|
-
columnKeyMap: e.columnKeyMap
|
|
1367
|
-
})) == null ? void 0 : i.format,
|
|
1368
|
-
{ preserveOmittedProperties: !0 }
|
|
1369
|
-
);
|
|
1370
|
-
if ((r == null ? void 0 : r.type) === "date" || (r == null ? void 0 : r.type) === "duration")
|
|
1371
|
-
return E(r, {
|
|
1372
|
-
preserveOmittedProperties: !0
|
|
1373
|
-
});
|
|
1374
|
-
}
|
|
1375
|
-
return Br(
|
|
1376
|
-
rn({
|
|
1377
|
-
...e,
|
|
1378
|
-
persistedSettings: t
|
|
1379
|
-
})
|
|
1380
|
-
);
|
|
1381
|
-
}
|
|
1382
|
-
function Wo(e) {
|
|
1383
|
-
const { value: t, formatOptions: n, preferences: i } = e;
|
|
1384
|
-
return n != null && n.type && n.type !== "auto" ? Ke(t, n.type, n) : hr({
|
|
1385
|
-
number: t,
|
|
1386
|
-
decimalPlaces: 0,
|
|
1387
|
-
useSuffix: !1,
|
|
1388
|
-
customSuffix: "",
|
|
1389
|
-
locale: "en-US",
|
|
1390
|
-
currency: ""
|
|
1391
|
-
});
|
|
1392
|
-
}
|
|
1393
|
-
function Ur(e) {
|
|
1394
|
-
return Wn({
|
|
1395
|
-
...e,
|
|
1396
|
-
activation: Ae({
|
|
1397
|
-
card: e.card,
|
|
1398
|
-
cardConfig: e.cardConfig
|
|
1399
|
-
})
|
|
1400
|
-
});
|
|
1401
|
-
}
|
|
1402
|
-
function Ho(e) {
|
|
1403
|
-
return Hn({
|
|
1404
|
-
activation: Ae({
|
|
1405
|
-
card: e.card,
|
|
1406
|
-
cardConfig: e.cardConfig
|
|
1407
|
-
}),
|
|
1408
|
-
result: e.result,
|
|
1409
|
-
expectedResultOwner: e.expectedResultOwner
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1412
|
-
function jr(e) {
|
|
1413
|
-
const t = Ot(e.card, e.effectiveCardConfig), n = lr({
|
|
1414
|
-
card: t,
|
|
1415
|
-
records: e.rows,
|
|
1416
|
-
keys: e.rows.length === 0 ? e.resultKeys : void 0,
|
|
1417
|
-
columnKeyMap: e.result.columnKeyMap,
|
|
1418
|
-
resultColumns: e.result.resultColumns,
|
|
1419
|
-
comparisonMetadata: e.result.comparisonMetadata,
|
|
1420
|
-
viewerTable: e.file.viewerTable
|
|
1421
|
-
});
|
|
1422
|
-
return e.rows.length === 0 && !e.resultKeys || n.visibleKeys.length === 0 ? null : {
|
|
1423
|
-
view: n,
|
|
1424
|
-
formatOptions: {
|
|
1425
|
-
useFormattedValues: e.file.useFormattedValues,
|
|
1426
|
-
timezone: e.reportContext.calendar.tz,
|
|
1427
|
-
delimiter: e.file.delimiter,
|
|
1428
|
-
csvEncoding: e.file.csvEncoding,
|
|
1429
|
-
includeHeaders: e.file.includeHeaders,
|
|
1430
|
-
columnSettings: z(e.card),
|
|
1431
|
-
visibleColumns: [...n.visibleKeys],
|
|
1432
|
-
columnLabels: Object.fromEntries(n.visibleKeys.map((i) => [i, n.labels[i] ?? i]))
|
|
1433
|
-
}
|
|
1434
|
-
};
|
|
1435
|
-
}
|
|
1436
|
-
function Gr(e) {
|
|
1437
|
-
var n;
|
|
1438
|
-
const t = (n = e.preferences) == null ? void 0 : n.comparisonPresentation;
|
|
1439
|
-
return {
|
|
1440
|
-
...Ni,
|
|
1441
|
-
...t,
|
|
1442
|
-
...t != null && t.conditionalLabels ? { conditionalLabels: { ...t.conditionalLabels } } : {},
|
|
1443
|
-
...t != null && t.colors ? { colors: { ...t.colors } } : {}
|
|
1444
|
-
};
|
|
1445
|
-
}
|
|
1446
|
-
function Wr(e) {
|
|
1447
|
-
const t = Ot(e.card, e.effectiveCardConfig), { cardId: n, ...i } = e.requestPayloadBase, r = e.formatOptions.visibleColumns ?? [], a = [
|
|
1448
|
-
...r,
|
|
1449
|
-
...Object.keys(e.formatOptions.columnSettings ?? {})
|
|
1450
|
-
], o = An(
|
|
1451
|
-
e.card,
|
|
1452
|
-
r,
|
|
1453
|
-
e.effectiveCardConfig
|
|
1454
|
-
), s = Nn(
|
|
1455
|
-
e.card,
|
|
1456
|
-
e.effectiveCardConfig,
|
|
1457
|
-
o
|
|
1458
|
-
), l = Rn(
|
|
1459
|
-
t,
|
|
1460
|
-
a
|
|
1461
|
-
), c = new Set(
|
|
1462
|
-
l.eligibleTargets.map(ve)
|
|
1463
|
-
), u = (h) => c.has(ve(h)) ? En({
|
|
1464
|
-
bindings: i.controlBindings,
|
|
1465
|
-
controls: [
|
|
1466
|
-
...i.controlDefinitions ?? [],
|
|
1467
|
-
...i.cardControlDefinitions ?? []
|
|
1468
|
-
],
|
|
1469
|
-
values: i.controlValues,
|
|
1470
|
-
target: h,
|
|
1471
|
-
knownTargets: l.knownTargets,
|
|
1472
|
-
eligibleTargets: l.eligibleTargets
|
|
1473
|
-
}).currency : void 0, d = _n({
|
|
1474
|
-
card: e.card,
|
|
1475
|
-
comparisonMetadata: e.comparisonMetadata,
|
|
1476
|
-
columnKeyMap: e.columnKeyMap
|
|
1477
|
-
}), f = Ae({
|
|
1478
|
-
card: e.card,
|
|
1479
|
-
cardConfig: e.effectiveCardConfig
|
|
1480
|
-
}), p = Ur({
|
|
1481
|
-
card: e.card,
|
|
1482
|
-
cardConfig: e.effectiveCardConfig,
|
|
1483
|
-
columns: e.resultColumns,
|
|
1484
|
-
columnKeyMap: e.columnKeyMap,
|
|
1485
|
-
resultRowCount: e.totalRows,
|
|
1486
|
-
valueFormatPreferences: e.reportContext.valueFormat
|
|
1487
|
-
}), g = (f == null ? void 0 : f.fields) ?? [], b = new Map(
|
|
1488
|
-
g.map((h) => [
|
|
1489
|
-
`${h.role}:${h.id}`,
|
|
1490
|
-
h
|
|
1491
|
-
])
|
|
1492
|
-
), m = /* @__PURE__ */ new Map();
|
|
1493
|
-
if (e.card.type === "detailTable" && i.resultOwner === "config") {
|
|
1494
|
-
const h = e.resultColumns || [];
|
|
1495
|
-
if (h.filter(
|
|
1496
|
-
(y) => y.rawTemporal
|
|
1497
|
-
).length > 0) {
|
|
1498
|
-
if (!e.columnKeyMap)
|
|
1499
|
-
throw new Error(
|
|
1500
|
-
"Canonical raw temporal export requires an authoritative columnKeyMap."
|
|
1501
|
-
);
|
|
1502
|
-
const y = Hi({
|
|
1503
|
-
cardType: e.card.type,
|
|
1504
|
-
resultOwner: i.resultOwner,
|
|
1505
|
-
effectiveCardConfig: e.effectiveCardConfig,
|
|
1506
|
-
result: {
|
|
1507
|
-
records: [],
|
|
1508
|
-
columns: h,
|
|
1509
|
-
columnKeyMap: e.columnKeyMap
|
|
1510
|
-
},
|
|
1511
|
-
preferences: e.reportContext.valueFormat,
|
|
1512
|
-
calendar: e.reportContext.calendar
|
|
1513
|
-
});
|
|
1514
|
-
if (y.kind === "invalid") throw y.error;
|
|
1515
|
-
if (y.kind === "loaded_empty" || y.kind === "loaded_valid")
|
|
1516
|
-
for (const [C, O] of y.presentation.byColumnKey)
|
|
1517
|
-
m.set(C, O.format);
|
|
1518
|
-
}
|
|
1519
|
-
} else if (i.resultOwner === "freeform" && i.sql.trim() && !i.python.trim())
|
|
1520
|
-
for (const [h, F] of Object.entries(
|
|
1521
|
-
z(e.card)
|
|
1522
|
-
)) {
|
|
1523
|
-
if (F.type !== "date") continue;
|
|
1524
|
-
const y = Yi(F.dateFormat);
|
|
1525
|
-
y && m.set(
|
|
1526
|
-
h,
|
|
1527
|
-
$i({
|
|
1528
|
-
format: y,
|
|
1529
|
-
preferences: e.reportContext.valueFormat,
|
|
1530
|
-
calendar: e.reportContext.calendar
|
|
1531
|
-
})
|
|
1532
|
-
);
|
|
1533
|
-
}
|
|
1534
|
-
const v = [
|
|
1535
|
-
...new Set(a)
|
|
1536
|
-
].flatMap((h) => {
|
|
1537
|
-
var q, $, _;
|
|
1538
|
-
if (p.byColumnKey.has(h) || m.has(h))
|
|
1539
|
-
return [];
|
|
1540
|
-
const F = d.columnPresentationOwners.get(h), y = {
|
|
1541
|
-
...Yn(t, h, {
|
|
1542
|
-
columnKeyMap: e.columnKeyMap,
|
|
1543
|
-
resultColumns: e.resultColumns
|
|
1544
|
-
}),
|
|
1545
|
-
...F ? { metricId: F.metricId, metricAlias: F.metricAlias } : {}
|
|
1546
|
-
}, C = (q = t.sql) != null && q.trim() ? void 0 : ne(t, y), O = C ? { kind: "metric", metricId: C.id } : { kind: "column", columnKey: h }, D = c.has(
|
|
1547
|
-
ve(O)
|
|
1548
|
-
), k = u(O), B = z(t)[h], W = {
|
|
1549
|
-
dashboardId: e.dashboardId,
|
|
1550
|
-
cardId: t.id
|
|
1551
|
-
}, R = { kind: "column", columnKey: h }, M = C && (!B || B.inheritMetricFormat === !0) ? G(C.format, {
|
|
1552
|
-
preserveOmittedProperties: !0
|
|
1553
|
-
}) : void 0;
|
|
1554
|
-
if ((M == null ? void 0 : M.type) === "date")
|
|
1555
|
-
return [
|
|
1556
|
-
{
|
|
1557
|
-
scope: W,
|
|
1558
|
-
target: R,
|
|
1559
|
-
format: {
|
|
1560
|
-
type: "date",
|
|
1561
|
-
locale: M.locale ?? e.reportContext.valueFormat.locale,
|
|
1562
|
-
...M.pattern ? { pattern: M.pattern } : {},
|
|
1563
|
-
...M.timezone ? { timezone: M.timezone } : {},
|
|
1564
|
-
...M.sourceTimezone ? { sourceTimezone: M.sourceTimezone } : {}
|
|
1565
|
-
}
|
|
1566
|
-
}
|
|
1567
|
-
];
|
|
1568
|
-
const w = (F ? $r({
|
|
1569
|
-
card: t,
|
|
1570
|
-
columnId: h,
|
|
1571
|
-
columnKeyMap: e.columnKeyMap,
|
|
1572
|
-
persistedSettings: B,
|
|
1573
|
-
metricId: F.metricId,
|
|
1574
|
-
metricAlias: F.metricAlias,
|
|
1575
|
-
comparisonValueKind: F.kind,
|
|
1576
|
-
comparisonPrecision: (_ = ($ = t.preferences) == null ? void 0 : $.comparisonPresentation) == null ? void 0 : _.precision,
|
|
1577
|
-
presentation: {
|
|
1578
|
-
preferences: e.reportContext.valueFormat,
|
|
1579
|
-
resolveBoundCurrency: u
|
|
1580
|
-
}
|
|
1581
|
-
}) : void 0) ?? (D ? zr({
|
|
1582
|
-
card: t,
|
|
1583
|
-
target: O,
|
|
1584
|
-
resultColumnKeys: a,
|
|
1585
|
-
valueFormatPreferences: e.reportContext.valueFormat,
|
|
1586
|
-
boundCurrency: k
|
|
1587
|
-
}) : void 0) ?? de({
|
|
1588
|
-
card: t,
|
|
1589
|
-
...y,
|
|
1590
|
-
persistedSettings: B,
|
|
1591
|
-
valueFormatPreferences: e.reportContext.valueFormat
|
|
1592
|
-
}), J = (w == null ? void 0 : w.type) === "duration" ? w : w ? P(
|
|
1593
|
-
w,
|
|
1594
|
-
e.reportContext.valueFormat,
|
|
1595
|
-
k
|
|
1596
|
-
) : P(
|
|
1597
|
-
{
|
|
1598
|
-
type: "number",
|
|
1599
|
-
minimumFractionDigits: 0,
|
|
1600
|
-
maximumFractionDigits: 3
|
|
1601
|
-
},
|
|
1602
|
-
e.reportContext.valueFormat
|
|
1603
|
-
);
|
|
1604
|
-
return [
|
|
1605
|
-
J.type === "duration" ? { scope: W, target: R, format: J } : { scope: W, target: R, format: J }
|
|
1606
|
-
];
|
|
1607
|
-
});
|
|
1608
|
-
v.push(
|
|
1609
|
-
...[...p.byColumnKey.values()].map((h) => {
|
|
1610
|
-
const F = b.get(
|
|
1611
|
-
`${h.role ?? "groupby"}:${h.fieldId}`
|
|
1612
|
-
);
|
|
1613
|
-
if (!F)
|
|
1614
|
-
throw new Error(
|
|
1615
|
-
`Unable to resolve temporal export field "${h.fieldId}".`
|
|
1616
|
-
);
|
|
1617
|
-
return {
|
|
1618
|
-
scope: {
|
|
1619
|
-
dashboardId: e.dashboardId,
|
|
1620
|
-
cardId: e.card.id
|
|
1621
|
-
},
|
|
1622
|
-
target: { kind: "column", columnKey: h.columnKey },
|
|
1623
|
-
format: Jn(
|
|
1624
|
-
F,
|
|
1625
|
-
{
|
|
1626
|
-
dateStyle: e.reportContext.valueFormat.dateStyle,
|
|
1627
|
-
dateTime: { ...e.reportContext.valueFormat.dateTime }
|
|
1628
|
-
},
|
|
1629
|
-
e.reportContext.valueFormat.locale
|
|
1630
|
-
)
|
|
1631
|
-
};
|
|
1632
|
-
})
|
|
1633
|
-
), v.push(
|
|
1634
|
-
...[...m].map(([h, F]) => ({
|
|
1635
|
-
scope: { dashboardId: e.dashboardId, cardId: e.card.id },
|
|
1636
|
-
target: { kind: "column", columnKey: h },
|
|
1637
|
-
format: F
|
|
1638
|
-
}))
|
|
1639
|
-
);
|
|
1640
|
-
const x = zi({
|
|
1641
|
-
reportContext: e.reportContext,
|
|
1642
|
-
resolvedFormats: v
|
|
1643
|
-
});
|
|
1644
|
-
return {
|
|
1645
|
-
formatOptions: {
|
|
1646
|
-
...e.formatOptions,
|
|
1647
|
-
...o ? { tableTotalsLabelColumnKey: o } : {},
|
|
1648
|
-
comparisonPresentation: Gr(e.card),
|
|
1649
|
-
presentationExecutionSnapshot: x
|
|
1650
|
-
},
|
|
1651
|
-
...s ? { tableTotalsRequest: s } : {}
|
|
1652
|
-
};
|
|
1653
|
-
}
|
|
1654
|
-
function Hr(e) {
|
|
1655
|
-
const t = Kn(
|
|
1656
|
-
e.card,
|
|
1657
|
-
e.requestPayloadBase
|
|
1658
|
-
), { cardId: n, ...i } = t.requestPayloadBase, r = Wr(e);
|
|
1659
|
-
return {
|
|
1660
|
-
type: "card",
|
|
1661
|
-
dashboardId: e.dashboardId,
|
|
1662
|
-
cardId: e.card.id,
|
|
1663
|
-
title: e.title,
|
|
1664
|
-
connection_id: t.connectionId,
|
|
1665
|
-
...i,
|
|
1666
|
-
...r.tableTotalsRequest ? { tableTotalsRequest: r.tableTotalsRequest } : {},
|
|
1667
|
-
totalRows: e.totalRows,
|
|
1668
|
-
format: e.format,
|
|
1669
|
-
formatOptions: r.formatOptions
|
|
1670
|
-
};
|
|
1671
|
-
}
|
|
1672
|
-
function Yo(e) {
|
|
1673
|
-
const { card: t, result: n } = e;
|
|
1674
|
-
if (t.type !== "table" && t.type !== "detailTable")
|
|
1675
|
-
return { status: "refused", reason: "not_a_table" };
|
|
1676
|
-
const i = n.modelFormats ? ji(e.effectiveCardConfig ?? t.config, n) : e.effectiveCardConfig;
|
|
1677
|
-
if (Vn({ card: t, comparisonMetadata: n.comparisonMetadata }))
|
|
1678
|
-
return { status: "refused", reason: "comparison_metadata_missing" };
|
|
1679
|
-
const r = jr({
|
|
1680
|
-
card: t,
|
|
1681
|
-
effectiveCardConfig: i,
|
|
1682
|
-
rows: e.rows,
|
|
1683
|
-
resultKeys: n.resultColumns.map((a) => a.key),
|
|
1684
|
-
result: n,
|
|
1685
|
-
reportContext: e.reportContext,
|
|
1686
|
-
file: e.file
|
|
1687
|
-
});
|
|
1688
|
-
return r ? {
|
|
1689
|
-
status: "ready",
|
|
1690
|
-
request: Hr({
|
|
1691
|
-
card: t,
|
|
1692
|
-
dashboardId: e.dashboardId,
|
|
1693
|
-
title: e.title,
|
|
1694
|
-
reportContext: e.reportContext,
|
|
1695
|
-
totalRows: n.totalRows,
|
|
1696
|
-
format: e.file.format,
|
|
1697
|
-
formatOptions: r.formatOptions,
|
|
1698
|
-
comparisonMetadata: n.comparisonMetadata,
|
|
1699
|
-
requestPayloadBase: e.query,
|
|
1700
|
-
resultColumns: [...n.resultColumns],
|
|
1701
|
-
columnKeyMap: n.columnKeyMap,
|
|
1702
|
-
effectiveCardConfig: i
|
|
1703
|
-
})
|
|
1704
|
-
} : { status: "refused", reason: "columns_unresolved" };
|
|
1705
|
-
}
|
|
1706
|
-
function Yr(e, t, n) {
|
|
1707
|
-
if (wi(
|
|
1708
|
-
Ti(t),
|
|
1709
|
-
e.aggregateOrigin
|
|
1710
|
-
))
|
|
1711
|
-
return { aggregate: void 0, aggregateOrigin: void 0 };
|
|
1712
|
-
const i = n === "selection" && e.role === "metric" ? t.aggregate : void 0;
|
|
1713
|
-
return {
|
|
1714
|
-
aggregate: e.aggregate ?? i,
|
|
1715
|
-
aggregateOrigin: e.aggregate ? e.aggregateOrigin : i ? t.aggregateOrigin : void 0
|
|
1716
|
-
};
|
|
1717
|
-
}
|
|
1718
|
-
function Jr(e, t, n) {
|
|
1719
|
-
var i, r, a, o, s, l;
|
|
1720
|
-
if (n === "domain")
|
|
1721
|
-
return {
|
|
1722
|
-
filters: (i = t.parameters) == null ? void 0 : i.filters,
|
|
1723
|
-
windowTransform: (r = e.parameters) == null ? void 0 : r.windowTransform
|
|
1724
|
-
};
|
|
1725
|
-
if (!(!e.parameters && !t.parameters))
|
|
1726
|
-
return {
|
|
1727
|
-
filters: ((a = e.parameters) == null ? void 0 : a.filters) ?? ((o = t.parameters) == null ? void 0 : o.filters),
|
|
1728
|
-
windowTransform: ((s = e.parameters) == null ? void 0 : s.windowTransform) ?? ((l = t.parameters) == null ? void 0 : l.windowTransform)
|
|
1729
|
-
};
|
|
1730
|
-
}
|
|
1731
|
-
function Jo(e, t, n) {
|
|
1732
|
-
const i = e;
|
|
1733
|
-
return {
|
|
1734
|
-
id: e.id,
|
|
1735
|
-
role: e.role,
|
|
1736
|
-
// Result-column names belong to the selection's consumer (for example,
|
|
1737
|
-
// range bounds). They do not identify or redefine the catalog calculation.
|
|
1738
|
-
...n === "selection" && e.alias ? { alias: e.alias } : {},
|
|
1739
|
-
granularity: e.granularity ?? t.granularity,
|
|
1740
|
-
...Yr(e, t, n),
|
|
1741
|
-
...e.role === "metric" ? {
|
|
1742
|
-
aliasTemplate: i.aliasTemplate,
|
|
1743
|
-
valueAliases: i.valueAliases,
|
|
1744
|
-
comparison: i.comparison,
|
|
1745
|
-
comparisonPolarity: i.comparisonPolarity,
|
|
1746
|
-
parameters: Jr(
|
|
1747
|
-
i,
|
|
1748
|
-
t,
|
|
1749
|
-
"domain"
|
|
1750
|
-
)
|
|
1751
|
-
} : {},
|
|
1752
|
-
...Qr(e)
|
|
1753
|
-
};
|
|
1754
|
-
}
|
|
1755
|
-
function Qr(e) {
|
|
1756
|
-
const t = {
|
|
1757
|
-
...e.labelOrigin === "override" ? { label: e.label, labelOrigin: e.labelOrigin } : {},
|
|
1758
|
-
...e.formatOrigin === "override" ? { format: e.format, formatOrigin: e.formatOrigin } : {}
|
|
1759
|
-
};
|
|
1760
|
-
switch (e.role) {
|
|
1761
|
-
case "pivotby":
|
|
1762
|
-
return {
|
|
1763
|
-
...t,
|
|
1764
|
-
memberOrder: e.memberOrder
|
|
1765
|
-
};
|
|
1766
|
-
case "sortby":
|
|
1767
|
-
return {
|
|
1768
|
-
...t,
|
|
1769
|
-
direction: e.direction
|
|
1770
|
-
};
|
|
1771
|
-
default:
|
|
1772
|
-
return t;
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
const Zr = "table";
|
|
1776
|
-
function Qo({ preferences: e, ...t }) {
|
|
1777
|
-
return {
|
|
1778
|
-
...t,
|
|
1779
|
-
type: Zr,
|
|
1780
|
-
preferences: e ?? { onClickFilter: [{ columnIndex: 0, expression: "" }] },
|
|
1781
|
-
sql: "",
|
|
1782
|
-
data: []
|
|
1783
|
-
};
|
|
1784
|
-
}
|
|
1785
|
-
function Xr(e, t) {
|
|
1786
|
-
const n = e.sheets ?? [], i = n.findIndex((o) => o.id === t.sheetId), r = n[i];
|
|
1787
|
-
if (!r)
|
|
1788
|
-
throw new T("sheet_not_found", `No sheet ${t.sheetId} on this dashboard.`);
|
|
1789
|
-
if (Qn(r))
|
|
1790
|
-
throw new T(
|
|
1791
|
-
"sheet_not_a_grid",
|
|
1792
|
-
"This sheet is a document: it has no grid to arrange.",
|
|
1793
|
-
"Arrange a grid sheet; Document sheets are laid out in the editor."
|
|
1794
|
-
);
|
|
1795
|
-
const a = kt(r, { kind: "arrange", keepOrder: t.keepOrder === !0 });
|
|
1796
|
-
return {
|
|
1797
|
-
dashboard: { ...e, sheets: n.map((o, s) => s === i ? a : o) },
|
|
1798
|
-
clauses: [Ne.arranged(r.title || "the dashboard", t.keepOrder === !0, !(r.frames ?? []).length)]
|
|
1799
|
-
};
|
|
1800
|
-
}
|
|
1801
|
-
function ea(e) {
|
|
1802
|
-
return !!(e && Object.prototype.hasOwnProperty.call(e, "calculatedFields"));
|
|
1803
|
-
}
|
|
1804
|
-
function H(...e) {
|
|
1805
|
-
return Zn(e.flatMap((t) => t || []));
|
|
1806
|
-
}
|
|
1807
|
-
function Z(e, t) {
|
|
1808
|
-
return {
|
|
1809
|
-
...e,
|
|
1810
|
-
fieldScope: t
|
|
1811
|
-
};
|
|
1812
|
-
}
|
|
1813
|
-
function ze(e) {
|
|
1814
|
-
return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => t.fieldScope === "sheet").map((t) => Z(t, "sheet"));
|
|
1815
|
-
}
|
|
1816
|
-
function an(e) {
|
|
1817
|
-
return ((e == null ? void 0 : e.calculatedFields) || []).filter((t) => !t.fieldScope).map((t) => Z(t, "sheet"));
|
|
1818
|
-
}
|
|
1819
|
-
function ta(e) {
|
|
1820
|
-
return e ? [
|
|
1821
|
-
...(e.calculatedFields || []).filter(
|
|
1822
|
-
(t) => t.fieldScope === "dashboard"
|
|
1823
|
-
),
|
|
1824
|
-
...(e.frames || []).flatMap((t) => t.calculatedFields || [])
|
|
1825
|
-
].map((t) => Z(t, "dashboard")) : [];
|
|
1826
|
-
}
|
|
1827
|
-
function na(e) {
|
|
1828
|
-
if (e !== void 0)
|
|
1829
|
-
return H(
|
|
1830
|
-
e.map((t) => Z(t, "dashboard"))
|
|
1831
|
-
);
|
|
1832
|
-
}
|
|
1833
|
-
function Zo(e) {
|
|
1834
|
-
var i;
|
|
1835
|
-
const t = [], n = (e.sheets || []).map((r) => {
|
|
1836
|
-
var a;
|
|
1837
|
-
return t.push(...ta(r)), {
|
|
1838
|
-
...r,
|
|
1839
|
-
calculatedFields: H(
|
|
1840
|
-
ze(r),
|
|
1841
|
-
an(r)
|
|
1842
|
-
),
|
|
1843
|
-
frames: (a = r.frames) == null ? void 0 : a.map(
|
|
1844
|
-
(o) => o.calculatedFields === void 0 ? o : { ...o, calculatedFields: void 0 }
|
|
1845
|
-
)
|
|
1846
|
-
};
|
|
1847
|
-
});
|
|
1848
|
-
return {
|
|
1849
|
-
...e,
|
|
1850
|
-
calculatedFields: na(
|
|
1851
|
-
H(
|
|
1852
|
-
(i = e.calculatedFields) == null ? void 0 : i.map(
|
|
1853
|
-
(r) => Z(r, "dashboard")
|
|
1854
|
-
),
|
|
1855
|
-
t
|
|
1856
|
-
)
|
|
1857
|
-
),
|
|
1858
|
-
sheets: n
|
|
1859
|
-
};
|
|
1860
|
-
}
|
|
1861
|
-
function ht(e, t) {
|
|
1862
|
-
var r;
|
|
1863
|
-
if (!((r = e == null ? void 0 : e.frames) != null && r.length))
|
|
1864
|
-
return [];
|
|
1865
|
-
const n = t ? e.frames.find((a) => a.id === t) : void 0, i = e.frames.filter(
|
|
1866
|
-
(a) => !t || a.id !== t
|
|
1867
|
-
);
|
|
1868
|
-
return H(
|
|
1869
|
-
n == null ? void 0 : n.calculatedFields,
|
|
1870
|
-
...i.map((a) => a.calculatedFields)
|
|
1871
|
-
);
|
|
1872
|
-
}
|
|
1873
|
-
function Xo(e, t) {
|
|
1874
|
-
return e ? ze(e) : [];
|
|
1875
|
-
}
|
|
1876
|
-
function es(e, t) {
|
|
1877
|
-
if (!e)
|
|
1878
|
-
return [];
|
|
1879
|
-
const n = ze(e), i = an(e), r = H(
|
|
1880
|
-
n,
|
|
1881
|
-
i
|
|
1882
|
-
);
|
|
1883
|
-
return ea(e) ? r.length === 0 ? [] : i.length === 0 ? r : H(
|
|
1884
|
-
r,
|
|
1885
|
-
ht(e, t)
|
|
1886
|
-
) : ht(e, t);
|
|
1887
|
-
}
|
|
1888
|
-
function ia(e) {
|
|
1889
|
-
if (e !== void 0)
|
|
1890
|
-
return H(
|
|
1891
|
-
e.map((t) => Z(t, "sheet"))
|
|
1892
|
-
);
|
|
1893
|
-
}
|
|
1894
|
-
function ts(e) {
|
|
1895
|
-
const { field: t, sheetFields: n = [], dashboardFields: i = [] } = e, r = (s) => s.find(
|
|
1896
|
-
(l) => Xn(l, t, {
|
|
1897
|
-
allowComparableFallback: !0
|
|
1898
|
-
})
|
|
1899
|
-
);
|
|
1900
|
-
if (t.fieldScope === "sheet")
|
|
1901
|
-
return { scope: "sheet", matchedField: r(n) };
|
|
1902
|
-
if (t.fieldScope === "dashboard")
|
|
1903
|
-
return { scope: "dashboard", matchedField: r(i) };
|
|
1904
|
-
const a = r(n);
|
|
1905
|
-
if (a)
|
|
1906
|
-
return { scope: "sheet", matchedField: a };
|
|
1907
|
-
const o = r(i);
|
|
1908
|
-
return o ? { scope: "dashboard", matchedField: o } : { scope: "card" };
|
|
1909
|
-
}
|
|
1910
|
-
function ra(e, t) {
|
|
1911
|
-
var x, h, F;
|
|
1912
|
-
const n = (e.sheets ?? []).findIndex((y) => y.id === t.sheetId), i = (x = e.sheets) == null ? void 0 : x[n];
|
|
1913
|
-
if (!(i != null && i.frames))
|
|
1914
|
-
throw new T("sheet_not_found", `No sheet ${t.sheetId} with frames on this dashboard.`);
|
|
1915
|
-
const { frame: r } = t, a = i.frames.findIndex((y) => y.id === r.id);
|
|
1916
|
-
if (a === -1)
|
|
1917
|
-
throw new T("frame_not_found", `No frame ${r.id} on sheet ${t.sheetId}.`);
|
|
1918
|
-
const o = i.frames[a], s = it(i), l = (y) => y.calculatedFields === void 0 ? y : { ...y, calculatedFields: void 0 }, c = t.rewrittenFrames, u = c && c.length > 0 ? (() => {
|
|
1919
|
-
const y = c.map((C) => C.id === r.id ? r : C);
|
|
1920
|
-
return y.some((C) => C.id === r.id) ? y : [r, ...y];
|
|
1921
|
-
})() : [r], d = new Map(u.map((y) => [y.id, y])), f = kt(i, { kind: "frame_updated", frame: r, resizeForNewKind: t.resizeLayouts });
|
|
1922
|
-
let p = /* @__PURE__ */ new Set();
|
|
1923
|
-
const g = ei.produce(e, (y) => {
|
|
1924
|
-
const C = y.sheets[n];
|
|
1925
|
-
f.layouts !== i.layouts && (C.layouts = rt(f.layouts)), f.customizedBreakpoints !== i.customizedBreakpoints && (C.customizedBreakpoints = f.customizedBreakpoints), t.sheetCalculatedFields !== void 0 && (C.calculatedFields = ia(t.sheetCalculatedFields)), C.frames = C.frames.map((D) => {
|
|
1926
|
-
const k = d.get(D.id);
|
|
1927
|
-
return k ? rt(l(k)) : D.calculatedFields === void 0 ? D : { ...D, calculatedFields: void 0 };
|
|
1928
|
-
});
|
|
1929
|
-
const O = it(C);
|
|
1930
|
-
p = new Set([...s].filter((D) => !O.has(D))), ti(y, p), t.dashboardCalculatedFields && (y.calculatedFields = t.dashboardCalculatedFields);
|
|
1931
|
-
}), b = g.sheets[n].frames.find((y) => y.id === r.id), m = [
|
|
1932
|
-
...p.size ? [{ kind: "cards_removed", cardIds: [...p] }] : [],
|
|
1933
|
-
{ kind: "frame_committed", sheetId: t.sheetId, before: o, after: b }
|
|
1934
|
-
], v = ((h = r.cards) == null ? void 0 : h.find((y) => y.id === r.activeCardId)) ?? ((F = r.cards) == null ? void 0 : F[0]);
|
|
1935
|
-
return { dashboard: g, runtimeEffects: m, clauses: [Ne.committed(v == null ? void 0 : v.title)] };
|
|
1936
|
-
}
|
|
1937
|
-
function aa(e, t, n) {
|
|
1938
|
-
var a;
|
|
1939
|
-
if (!e || !t || t.customFilterPreferences) return;
|
|
1940
|
-
const i = t.defaultDateFilter;
|
|
1941
|
-
return (t.dateSelectionMode === "day" ? ri(i) : t.dateSelectionMode === "months" && (ai(i) || oi(i) && i.unit === "month" && (i.mode === "previous" || i.mode === "this" && !i.toDate && !i.boundary))) && ((a = Q(t, n)) == null ? void 0 : a.valueType) === "date" ? !0 : void 0;
|
|
1942
|
-
}
|
|
1943
|
-
function ns(e) {
|
|
1944
|
-
const t = e.createId ?? _t, n = t(), i = Ln({
|
|
1945
|
-
field: e.field,
|
|
1946
|
-
dataSource: e.dataSource,
|
|
1947
|
-
connectionId: e.connectionId,
|
|
1948
|
-
connectionType: e.connectionType,
|
|
1949
|
-
filterId: t()
|
|
1950
|
-
});
|
|
1951
|
-
return oa({
|
|
1952
|
-
filter: e.label ? { ...i, title: e.label } : i,
|
|
1953
|
-
label: e.label || e.field.label || e.field.name,
|
|
1954
|
-
scope: e.scope,
|
|
1955
|
-
existingInputs: e.existingInputs,
|
|
1956
|
-
createId: () => n
|
|
1957
|
-
});
|
|
1958
|
-
}
|
|
1959
|
-
function oa(e) {
|
|
1960
|
-
const t = e.createId ?? _t, n = e.label || e.filter.title || e.filter.column || e.filter.id, i = ni(n, [
|
|
1961
|
-
...e.existingInputs
|
|
1962
|
-
]), r = {
|
|
1963
|
-
...At(e.filter),
|
|
1964
|
-
variableName: i
|
|
1965
|
-
};
|
|
1966
|
-
return {
|
|
1967
|
-
id: t(),
|
|
1968
|
-
kind: "filter",
|
|
1969
|
-
label: n,
|
|
1970
|
-
variableName: i,
|
|
1971
|
-
requiredAtExecution: !1,
|
|
1972
|
-
scope: e.scope,
|
|
1973
|
-
runtimeScope: "shared",
|
|
1974
|
-
presentation: Rt(r),
|
|
1975
|
-
filter: r,
|
|
1976
|
-
exports: Nt(r)
|
|
1977
|
-
};
|
|
1978
|
-
}
|
|
1979
|
-
function sa(e, t, n, i = { calendar: null }) {
|
|
1980
|
-
var We, He, Ye, Je, Qe, Ze, Xe, et;
|
|
1981
|
-
const r = U(e), a = r.findFilterInput(t), o = (S, I) => ({
|
|
1982
|
-
ok: !1,
|
|
1983
|
-
issues: [
|
|
1984
|
-
{
|
|
1985
|
-
code: "invalidSettings",
|
|
1986
|
-
message: S,
|
|
1987
|
-
ref: t,
|
|
1988
|
-
...a ? { inputId: a.input.id } : {},
|
|
1989
|
-
...I ? { contractIssue: I } : {}
|
|
1990
|
-
}
|
|
1991
|
-
]
|
|
1992
|
-
});
|
|
1993
|
-
if (!a)
|
|
1994
|
-
return {
|
|
1995
|
-
ok: !1,
|
|
1996
|
-
issues: [
|
|
1997
|
-
{
|
|
1998
|
-
code: "inputNotFound",
|
|
1999
|
-
ref: t,
|
|
2000
|
-
message: "This filter no longer exists on the dashboard."
|
|
2001
|
-
}
|
|
2002
|
-
]
|
|
2003
|
-
};
|
|
2004
|
-
if (a.origin !== "embeddedInput")
|
|
2005
|
-
return o("This filter can not be edited here.");
|
|
2006
|
-
const s = a.input, l = s.filter;
|
|
2007
|
-
if (((We = n.mapping) == null ? void 0 : We.kind) === "save") {
|
|
2008
|
-
if (!n.mapping.draft.acceptance.ok)
|
|
2009
|
-
return { ok: !1, issues: n.mapping.draft.acceptance.issues };
|
|
2010
|
-
if (n.mapping.draft.inputId !== s.id)
|
|
2011
|
-
return o("The card mapping was prepared for another filter.");
|
|
2012
|
-
}
|
|
2013
|
-
const c = n.definition ? At(n.definition) : l;
|
|
2014
|
-
if (c.kind === "global-date" && n.scope && !la(n.scope))
|
|
2015
|
-
return o("The Global Date filter applies to regular tabs only.");
|
|
2016
|
-
const u = (He = i.calendar) == null ? void 0 : He.tz, d = n.definition !== void 0, f = n.forceSelection !== void 0 || d ? aa(
|
|
2017
|
-
n.forceSelection ?? s.forceSelection,
|
|
2018
|
-
c,
|
|
2019
|
-
u
|
|
2020
|
-
) : s.forceSelection ? !0 : void 0, p = (Array.isArray(e.inputs) ? e.inputs : []).filter((S) => S.id !== s.id), g = n.variableName !== void 0 ? ii(n.variableName, [
|
|
2021
|
-
...p,
|
|
2022
|
-
...r.inputs.filter((S) => S.input.id !== s.id).map((S) => S.input)
|
|
2023
|
-
]) : s.variableName, b = d && (l.title || l.column) !== (c.title || c.column), m = n.label ?? (b ? c.title || c.column || c.id : void 0), v = d && l.hide !== c.hide, x = d && l.toolbarWidth !== c.toolbarWidth, h = (S) => {
|
|
2024
|
-
var tt, nt;
|
|
2025
|
-
const I = { ...S };
|
|
2026
|
-
if (m !== void 0 && (I.label = m), n.variableName !== void 0 && (I.variableName = g), n.scope && (I.scope = n.scope), v || x) {
|
|
2027
|
-
const be = Rt(c);
|
|
2028
|
-
I.presentation = { ...S.presentation }, v && (I.presentation.placement = be.placement), x && (be.widthPx === void 0 ? delete I.presentation.widthPx : I.presentation.widthPx = be.widthPx);
|
|
2029
|
-
}
|
|
2030
|
-
return (n.forceSelection !== void 0 || d) && (f ? I.forceSelection = f : delete I.forceSelection), n.requiredAtExecution !== void 0 && (n.requiredAtExecution ? I.requiredAtExecution = !0 : delete I.requiredAtExecution), Ie(I, "optionSource", n.optionSource), Ie(I, "optionDependencies", n.optionDependencies), Ie(I, "optionPopulation", n.optionPopulation), ((tt = n.mapping) == null ? void 0 : tt.kind) === "save" && n.mapping.draft.acceptance.ok ? I.application = n.mapping.draft.acceptance.application : ((nt = n.mapping) == null ? void 0 : nt.kind) === "remove" && delete I.application, I;
|
|
2031
|
-
}, F = n.label !== void 0 && n.label !== s.label && n.label !== c.title ? n.label : void 0, y = d || n.variableName !== void 0 || F !== void 0, C = (S) => ({
|
|
2032
|
-
...S,
|
|
2033
|
-
...n.variableName !== void 0 ? { variableName: g } : {},
|
|
2034
|
-
...F !== void 0 ? { title: F } : {}
|
|
2035
|
-
}), O = Array.isArray(e.inputs) ? [...e.inputs] : [], D = O.findIndex((S) => S.id === s.id), k = O[D];
|
|
2036
|
-
if (D < 0 || (k == null ? void 0 : k.kind) !== "filter" || !k.filter)
|
|
2037
|
-
return o("This filter can not be edited here.");
|
|
2038
|
-
const B = h(
|
|
2039
|
-
y ? {
|
|
2040
|
-
...k,
|
|
2041
|
-
filter: C(c)
|
|
2042
|
-
} : k
|
|
2043
|
-
);
|
|
2044
|
-
d && (B.exports = Nt(c)), O[D] = B;
|
|
2045
|
-
const W = Ee({
|
|
2046
|
-
inputs: [B],
|
|
2047
|
-
dashboardFilters: []
|
|
2048
|
-
});
|
|
2049
|
-
if (!W.ok)
|
|
2050
|
-
return o(
|
|
2051
|
-
((Ye = W.issues[0]) == null ? void 0 : Ye.message) ?? "These settings could not be saved.",
|
|
2052
|
-
W.issues[0]
|
|
2053
|
-
);
|
|
2054
|
-
let R = { ...e, inputs: O };
|
|
2055
|
-
const M = U(R), w = M.findFilterInput({ filterId: c.id });
|
|
2056
|
-
if (!w)
|
|
2057
|
-
return o(
|
|
2058
|
-
((Je = M.issues[0]) == null ? void 0 : Je.message) ?? "These settings could not be saved."
|
|
2059
|
-
);
|
|
2060
|
-
const J = n.variableName !== void 0 || n.scope !== void 0 ? ca(R, w.input) : void 0;
|
|
2061
|
-
if (J)
|
|
2062
|
-
return o(
|
|
2063
|
-
`Another filter on the same cards is already named "${J}". Choose another name.`
|
|
2064
|
-
);
|
|
2065
|
-
const q = [], $ = {
|
|
2066
|
-
id: w.input.id,
|
|
2067
|
-
runtimeScope: w.input.runtimeScope
|
|
2068
|
-
};
|
|
2069
|
-
let _ = {
|
|
2070
|
-
defaultInputValues: R.defaultInputValues,
|
|
2071
|
-
dashboardInputValues: {}
|
|
2072
|
-
};
|
|
2073
|
-
const In = ((Qe = n.values) == null ? void 0 : Qe.target) ?? {}, A = fa(
|
|
2074
|
-
l,
|
|
2075
|
-
c,
|
|
2076
|
-
{
|
|
2077
|
-
defaultValueChanged: (Ze = n.values) == null ? void 0 : Ze.defaultChanged,
|
|
2078
|
-
selectionIdentityChanged: (Xe = n.values) == null ? void 0 : Xe.selectionIdentityChanged,
|
|
2079
|
-
...((et = n.values) == null ? void 0 : et.defaultComparisonSelection) !== void 0 ? {
|
|
2080
|
-
defaultComparisonChanged: !0,
|
|
2081
|
-
defaultComparisonSelection: n.values.defaultComparisonSelection ?? void 0
|
|
2082
|
-
} : {}
|
|
2083
|
-
},
|
|
2084
|
-
In,
|
|
2085
|
-
i.calendar ?? void 0
|
|
2086
|
-
);
|
|
2087
|
-
if (A.defaultValueChanged || A.selectionIdentityChanged || A.defaultComparisonChanged) {
|
|
2088
|
-
const S = on({
|
|
2089
|
-
state: { ..._, dashboardInputValues: {} },
|
|
2090
|
-
input: $,
|
|
2091
|
-
settings: A
|
|
2092
|
-
});
|
|
2093
|
-
_ = { ..._, defaultInputValues: S.defaultInputValues }, A.selectionIdentityChanged && q.push({
|
|
2094
|
-
kind: "clear",
|
|
2095
|
-
inputId: $.id,
|
|
2096
|
-
target: A.target
|
|
2097
|
-
}), A.defaultValueChanged && q.push({
|
|
2098
|
-
kind: "resetToDefault",
|
|
2099
|
-
inputId: $.id,
|
|
2100
|
-
target: A.target,
|
|
2101
|
-
...A.defaultFilterValue ? { filterValue: A.defaultFilterValue } : {}
|
|
2102
|
-
}), A.defaultComparisonChanged && q.push({
|
|
2103
|
-
kind: "setDefaultComparison",
|
|
2104
|
-
inputId: $.id,
|
|
2105
|
-
target: A.target
|
|
2106
|
-
});
|
|
2107
|
-
}
|
|
2108
|
-
if (n.scope && w.input.runtimeScope !== "shared") {
|
|
2109
|
-
const S = ua(
|
|
2110
|
-
R,
|
|
2111
|
-
s,
|
|
2112
|
-
w.input,
|
|
2113
|
-
_.defaultInputValues
|
|
2114
|
-
);
|
|
2115
|
-
_ = {
|
|
2116
|
-
..._,
|
|
2117
|
-
defaultInputValues: S.defaultInputValues
|
|
2118
|
-
}, q.push(
|
|
2119
|
-
...S.dropped.map((I) => ({
|
|
2120
|
-
kind: "dropTargetSlot",
|
|
2121
|
-
inputId: $.id,
|
|
2122
|
-
target: I
|
|
2123
|
-
}))
|
|
2124
|
-
);
|
|
2125
|
-
}
|
|
2126
|
-
return R = da(R, _), {
|
|
2127
|
-
ok: !0,
|
|
2128
|
-
dashboard: R,
|
|
2129
|
-
inputId: w.input.id,
|
|
2130
|
-
valueEffects: q
|
|
2131
|
-
};
|
|
2132
|
-
}
|
|
2133
|
-
function is(e) {
|
|
2134
|
-
let t = at({
|
|
2135
|
-
dashboard: e.before,
|
|
2136
|
-
runtimeValues: e.dashboardInputValues,
|
|
2137
|
-
calendar: e.calendar
|
|
2138
|
-
});
|
|
2139
|
-
const n = U(e.after), i = (r) => {
|
|
2140
|
-
var a;
|
|
2141
|
-
return (a = n.findFilterInput({ inputId: r })) == null ? void 0 : a.input;
|
|
2142
|
-
};
|
|
2143
|
-
for (const r of e.effects)
|
|
2144
|
-
switch (r.kind) {
|
|
2145
|
-
case "resetToDefault":
|
|
2146
|
-
case "clear":
|
|
2147
|
-
case "setDefaultComparison": {
|
|
2148
|
-
const a = i(r.inputId);
|
|
2149
|
-
if (!a) break;
|
|
2150
|
-
t = on({
|
|
2151
|
-
state: { dashboardInputValues: t },
|
|
2152
|
-
input: a,
|
|
2153
|
-
settings: {
|
|
2154
|
-
target: r.target,
|
|
2155
|
-
defaultValueChanged: r.kind === "resetToDefault",
|
|
2156
|
-
defaultFilterValue: r.kind === "resetToDefault" ? r.filterValue : void 0,
|
|
2157
|
-
selectionIdentityChanged: r.kind === "clear",
|
|
2158
|
-
defaultComparisonChanged: r.kind === "setDefaultComparison"
|
|
2159
|
-
}
|
|
2160
|
-
}).dashboardInputValues;
|
|
2161
|
-
break;
|
|
2162
|
-
}
|
|
2163
|
-
case "dropTargetSlot": {
|
|
2164
|
-
const a = i(r.inputId);
|
|
2165
|
-
if (!a) break;
|
|
2166
|
-
t = Re(
|
|
2167
|
-
t,
|
|
2168
|
-
a,
|
|
2169
|
-
r.target
|
|
2170
|
-
);
|
|
2171
|
-
break;
|
|
2172
|
-
}
|
|
2173
|
-
}
|
|
2174
|
-
return at({
|
|
2175
|
-
dashboard: e.after,
|
|
2176
|
-
runtimeValues: t,
|
|
2177
|
-
calendar: e.calendar
|
|
2178
|
-
});
|
|
2179
|
-
}
|
|
2180
|
-
function la(e) {
|
|
2181
|
-
var t;
|
|
2182
|
-
return e.kind !== "documentSections" && (e.kind !== "allSheets" || ((t = e.sheetKinds) == null ? void 0 : t.length) === 1 && e.sheetKinds[0] === "dashboard");
|
|
2183
|
-
}
|
|
2184
|
-
function Ie(e, t, n) {
|
|
2185
|
-
n !== void 0 && (n === null ? delete e[t] : e[t] = n);
|
|
2186
|
-
}
|
|
2187
|
-
function ca(e, t) {
|
|
2188
|
-
const n = [
|
|
2189
|
-
...U(e).inputs.map((r) => r.input),
|
|
2190
|
-
...(Array.isArray(e.inputs) ? e.inputs : []).filter(
|
|
2191
|
-
(r) => r.kind === "control"
|
|
2192
|
-
)
|
|
2193
|
-
].filter(
|
|
2194
|
-
(r) => r.id !== t.id && r.variableName === t.variableName
|
|
2195
|
-
);
|
|
2196
|
-
if (!n.length) return;
|
|
2197
|
-
const i = ct(e, t);
|
|
2198
|
-
return n.some(
|
|
2199
|
-
(r) => [...ct(e, r)].some(
|
|
2200
|
-
(a) => i.has(a)
|
|
2201
|
-
)
|
|
2202
|
-
) ? t.variableName : void 0;
|
|
2203
|
-
}
|
|
2204
|
-
function ua(e, t, n, i) {
|
|
2205
|
-
var u, d;
|
|
2206
|
-
const r = [], a = Et(e), o = (f) => bt(t, f, a), s = (f) => bt(n, f, a), l = [];
|
|
2207
|
-
if (n.runtimeScope === "perSheet")
|
|
2208
|
-
for (const f of a.values())
|
|
2209
|
-
l.push({ sheetId: f.sheetId, sheetKind: f.sheetKind });
|
|
2210
|
-
else if (n.runtimeScope === "perCard")
|
|
2211
|
-
for (const f of me(e))
|
|
2212
|
-
l.push({
|
|
2213
|
-
sheetId: f.sheetId,
|
|
2214
|
-
cardId: f.cardId,
|
|
2215
|
-
sheetKind: (u = a.get(f.sheetId)) == null ? void 0 : u.sheetKind
|
|
2216
|
-
});
|
|
2217
|
-
else if (n.runtimeScope === "perDocumentSection")
|
|
2218
|
-
for (const f of e.sheets ?? [])
|
|
2219
|
-
for (const p of ((d = f.document) == null ? void 0 : d.sections) ?? [])
|
|
2220
|
-
l.push({
|
|
2221
|
-
sheetId: f.id,
|
|
2222
|
-
sectionId: p.id,
|
|
2223
|
-
sheetKind: "document"
|
|
2224
|
-
});
|
|
2225
|
-
let c = i;
|
|
2226
|
-
for (const f of l) {
|
|
2227
|
-
if (s(f)) continue;
|
|
2228
|
-
const p = !!(c && _e(c, n, f));
|
|
2229
|
-
if (p && (c = Re(c, n, f)), p || o(f)) {
|
|
2230
|
-
const { sheetKind: g, ...b } = f;
|
|
2231
|
-
r.push(b);
|
|
2232
|
-
}
|
|
2233
|
-
}
|
|
2234
|
-
return { defaultInputValues: c, dropped: r };
|
|
2235
|
-
}
|
|
2236
|
-
function bt(e, t, n) {
|
|
2237
|
-
if (e.runtimeScope === "perSheet" && t.sheetId && !t.cardId && !t.sectionId) {
|
|
2238
|
-
const i = n.get(t.sheetId);
|
|
2239
|
-
return i ? Vt(e, i) : !1;
|
|
2240
|
-
}
|
|
2241
|
-
return li(e, t);
|
|
2242
|
-
}
|
|
2243
|
-
function da(e, t) {
|
|
2244
|
-
const n = { ...e };
|
|
2245
|
-
return t.defaultInputValues && Object.keys(t.defaultInputValues).length ? n.defaultInputValues = t.defaultInputValues : e.defaultInputValues !== void 0 && delete n.defaultInputValues, n;
|
|
2246
|
-
}
|
|
2247
|
-
function fa(e, t, n, i, r) {
|
|
2248
|
-
const a = !!(n != null && n.defaultValueChanged || n != null && n.selectionIdentityChanged) || si(e, t);
|
|
2249
|
-
return {
|
|
2250
|
-
...n,
|
|
2251
|
-
target: (n == null ? void 0 : n.target) ?? i,
|
|
2252
|
-
defaultValueChanged: a,
|
|
2253
|
-
defaultFilterValue: a ? Q(t, r) : void 0
|
|
2254
|
-
};
|
|
2255
|
-
}
|
|
2256
|
-
function on(e) {
|
|
2257
|
-
const { settings: t } = e;
|
|
2258
|
-
if (!t) return e.state;
|
|
2259
|
-
const n = e.input;
|
|
2260
|
-
let i = e.state.dashboardInputValues, r = e.state.defaultInputValues;
|
|
2261
|
-
if (t.selectionIdentityChanged && (i = ot(
|
|
2262
|
-
i,
|
|
2263
|
-
n,
|
|
2264
|
-
t.target,
|
|
2265
|
-
{ status: "cleared" }
|
|
2266
|
-
)), t.defaultValueChanged) {
|
|
2267
|
-
const a = _e(
|
|
2268
|
-
r,
|
|
2269
|
-
n,
|
|
2270
|
-
t.target
|
|
2271
|
-
);
|
|
2272
|
-
let o = Re(
|
|
2273
|
-
r || {},
|
|
2274
|
-
n,
|
|
2275
|
-
t.target
|
|
2276
|
-
);
|
|
2277
|
-
t.defaultFilterValue ? o = st(
|
|
2278
|
-
o,
|
|
2279
|
-
n,
|
|
2280
|
-
t.target,
|
|
2281
|
-
{
|
|
2282
|
-
status: "set",
|
|
2283
|
-
value: {
|
|
2284
|
-
kind: "filter",
|
|
2285
|
-
filterValue: t.defaultFilterValue
|
|
2286
|
-
},
|
|
2287
|
-
...a != null && a.comparisonSelection ? { comparisonSelection: a.comparisonSelection } : {}
|
|
2288
|
-
}
|
|
2289
|
-
) : a != null && a.comparisonSelection && (o = st(
|
|
2290
|
-
o,
|
|
2291
|
-
n,
|
|
2292
|
-
t.target,
|
|
2293
|
-
{ comparisonSelection: a.comparisonSelection }
|
|
2294
|
-
)), r = Object.keys(o).length ? o : void 0, i = ot(
|
|
2295
|
-
i,
|
|
2296
|
-
n,
|
|
2297
|
-
t.target,
|
|
2298
|
-
t.defaultFilterValue ? {
|
|
2299
|
-
status: "set",
|
|
2300
|
-
value: {
|
|
2301
|
-
kind: "filter",
|
|
2302
|
-
filterValue: t.defaultFilterValue
|
|
2303
|
-
}
|
|
2304
|
-
} : { status: "cleared" }
|
|
2305
|
-
);
|
|
2306
|
-
}
|
|
2307
|
-
return t.defaultComparisonChanged && (r = lt(
|
|
2308
|
-
r || {},
|
|
2309
|
-
n,
|
|
2310
|
-
t.target,
|
|
2311
|
-
t.defaultComparisonSelection
|
|
2312
|
-
), Object.keys(r).length || (r = void 0), i = lt(
|
|
2313
|
-
i,
|
|
2314
|
-
n,
|
|
2315
|
-
t.target,
|
|
2316
|
-
void 0
|
|
2317
|
-
)), {
|
|
2318
|
-
...e.state,
|
|
2319
|
-
dashboardInputValues: i,
|
|
2320
|
-
defaultInputValues: r
|
|
2321
|
-
};
|
|
2322
|
-
}
|
|
2323
|
-
const Y = (e) => Array.isArray(e.inputs) ? e.inputs : [];
|
|
2324
|
-
function he(e, t) {
|
|
2325
|
-
const n = Y(e).find((i) => i.id === t);
|
|
2326
|
-
if (!n || n.kind !== "filter")
|
|
2327
|
-
throw new T("filter_not_found", `No filter ${t} on this dashboard.`, "Read the outline again and use its filter ids.");
|
|
2328
|
-
return n;
|
|
2329
|
-
}
|
|
2330
|
-
function sn(e, t) {
|
|
2331
|
-
var n;
|
|
2332
|
-
return (n = me(e).find((i) => i.cardId === t)) == null ? void 0 : n.card.title;
|
|
2333
|
-
}
|
|
2334
|
-
function ma(e, t, n) {
|
|
2335
|
-
const i = U(e), r = i.findFilterInput({ inputId: t });
|
|
2336
|
-
return r ? i.reachedCards({ inputId: t }).filter(
|
|
2337
|
-
(a) => ["bound", "automatic", "sql", "relationshipApplied"].includes(
|
|
2338
|
-
Bn(r.input, a.card, n).reach
|
|
2339
|
-
)
|
|
2340
|
-
).length : 0;
|
|
2341
|
-
}
|
|
2342
|
-
function pa(e, t) {
|
|
2343
|
-
const n = U(e), i = n.findFilterInput({ inputId: t });
|
|
2344
|
-
return i ? n.reachedCards({ inputId: t }).filter((r) => qn(i.input, r.card) === "relationship").length : 0;
|
|
2345
|
-
}
|
|
2346
|
-
function ln(e, t) {
|
|
2347
|
-
if (t.scope.kind === "allSheets") return "every sheet";
|
|
2348
|
-
if (t.scope.kind !== "sheets") return "its cards";
|
|
2349
|
-
const n = [...Et(e).values()].filter((i) => Vt(t, i));
|
|
2350
|
-
return Kt(n.map((i) => {
|
|
2351
|
-
var r, a;
|
|
2352
|
-
return ((a = (r = e.sheets) == null ? void 0 : r.find((o) => o.id === i.sheetId)) == null ? void 0 : a.title) ?? i.sheetId;
|
|
2353
|
-
}));
|
|
2354
|
-
}
|
|
2355
|
-
const cn = (e) => {
|
|
2356
|
-
var t;
|
|
2357
|
-
return ((t = e.filter) == null ? void 0 : t.type) === "single" ? "single select" : "multi select";
|
|
2358
|
-
};
|
|
2359
|
-
function un(e) {
|
|
2360
|
-
var t, n, i;
|
|
2361
|
-
if ((n = (t = e.filter) == null ? void 0 : t.defaultValues) != null && n.length) return `default ${e.filter.defaultValues.join(", ")}`;
|
|
2362
|
-
if ((i = e.filter) != null && i.defaultDateFilter) return "a default period";
|
|
2363
|
-
}
|
|
2364
|
-
function ie(e) {
|
|
2365
|
-
return Ne.plain("filter", e);
|
|
2366
|
-
}
|
|
2367
|
-
function ga(e, t) {
|
|
2368
|
-
const { input: n } = t, i = Y(e);
|
|
2369
|
-
if (i.some((l) => l.id === n.id))
|
|
2370
|
-
throw new T("filter_id_taken", `A filter with id ${n.id} is already on this dashboard.`);
|
|
2371
|
-
if (U(e).findFilterInput({ filterId: n.filter.id }))
|
|
2372
|
-
throw new T("filter_id_taken", `A filter definition with id ${n.filter.id} is already on this dashboard.`);
|
|
2373
|
-
const r = { ...e, inputs: [...i, n] }, a = ma(r, n.id), o = pa(r, n.id), s = [cn(n), un(n)].filter(Boolean).join(", ");
|
|
2374
|
-
return {
|
|
2375
|
-
dashboard: r,
|
|
2376
|
-
created: [
|
|
2377
|
-
{
|
|
2378
|
-
kind: "filter",
|
|
2379
|
-
id: n.id,
|
|
2380
|
-
title: n.label,
|
|
2381
|
-
...t.changeIndex !== void 0 ? { changeIndex: t.changeIndex } : {}
|
|
2382
|
-
}
|
|
2383
|
-
],
|
|
2384
|
-
clauses: [
|
|
2385
|
-
ie(
|
|
2386
|
-
`adds the filter ${j(n.label)} (${s}) to ${ln(r, n)}; it filters ${a} card${a === 1 ? "" : "s"}${o ? ` and may filter ${o} more through the domain's relationships` : ""}`
|
|
2387
|
-
)
|
|
2388
|
-
]
|
|
2389
|
-
};
|
|
2390
|
-
}
|
|
2391
|
-
function ya(e, t, n) {
|
|
2392
|
-
const i = sa(e, { inputId: t.filterId }, t.settings, {
|
|
2393
|
-
calendar: n.calendar
|
|
2394
|
-
});
|
|
2395
|
-
if (!i.ok) {
|
|
2396
|
-
const [o] = i.issues;
|
|
2397
|
-
throw new T(
|
|
2398
|
-
(o == null ? void 0 : o.code) === "inputNotFound" ? "filter_not_found" : "filter_invalid",
|
|
2399
|
-
(o == null ? void 0 : o.message) ?? "These filter settings could not be saved.",
|
|
2400
|
-
(o == null ? void 0 : o.code) === "inputNotFound" ? "Read the outline again and use its filter ids." : "Change the filter settings and propose again.",
|
|
2401
|
-
{ issues: i.issues }
|
|
2402
|
-
);
|
|
2403
|
-
}
|
|
2404
|
-
const r = Y(e).find((o) => o.id === i.inputId), a = Y(i.dashboard).find((o) => o.id === i.inputId);
|
|
2405
|
-
return {
|
|
2406
|
-
dashboard: i.dashboard,
|
|
2407
|
-
runtimeEffects: [{ kind: "filter_value", effects: i.valueEffects }],
|
|
2408
|
-
clauses: [ie(`changes the filter ${j((r == null ? void 0 : r.label) ?? a.label)}: ${ha(i.dashboard, r, a)}`)]
|
|
2409
|
-
};
|
|
2410
|
-
}
|
|
2411
|
-
function ha(e, t, n) {
|
|
2412
|
-
var o, s, l, c, u, d;
|
|
2413
|
-
if (!t) return "updates its settings";
|
|
2414
|
-
const i = [];
|
|
2415
|
-
t.label !== n.label && i.push(`renames it ${j(n.label)}`), (((o = t.filter) == null ? void 0 : o.type) ?? "multiple") !== (((s = n.filter) == null ? void 0 : s.type) ?? "multiple") && i.push(`makes it ${cn(n)}`);
|
|
2416
|
-
const r = JSON.stringify([((l = t.filter) == null ? void 0 : l.defaultValues) ?? null, ((c = t.filter) == null ? void 0 : c.defaultDateFilter) ?? null]), a = JSON.stringify([((u = n.filter) == null ? void 0 : u.defaultValues) ?? null, ((d = n.filter) == null ? void 0 : d.defaultDateFilter) ?? null]);
|
|
2417
|
-
if (r !== a) {
|
|
2418
|
-
const f = un(n);
|
|
2419
|
-
i.push(f ? `sets its ${f.replace(/^default /, "default to ").replace(/^a default period$/, "default period")}` : "removes its default");
|
|
2420
|
-
}
|
|
2421
|
-
return JSON.stringify(t.scope) !== JSON.stringify(n.scope) && i.push(`applies it to ${ln(e, n)}`), i.length ? Kt(i) : "keeps its settings";
|
|
2422
|
-
}
|
|
2423
|
-
function ba(e, t) {
|
|
2424
|
-
const n = he(e, t);
|
|
2425
|
-
return {
|
|
2426
|
-
dashboard: {
|
|
2427
|
-
...e,
|
|
2428
|
-
inputs: Y(e).filter((r) => r.id !== t),
|
|
2429
|
-
defaultInputValues: ui(e.defaultInputValues, t)
|
|
2430
|
-
},
|
|
2431
|
-
runtimeEffects: [{ kind: "input_removed", inputId: t }],
|
|
2432
|
-
clauses: [ie(`removes the filter ${j(n.label)}`)]
|
|
2433
|
-
};
|
|
2434
|
-
}
|
|
2435
|
-
function va(e, t, n) {
|
|
2436
|
-
var o;
|
|
2437
|
-
if (!me(e).some((s) => s.cardId === n))
|
|
2438
|
-
throw new T("card_not_found", `No card ${n} on this dashboard.`, "Read the outline again and use its card ids.");
|
|
2439
|
-
const i = di(t.scope, n);
|
|
2440
|
-
if (!i)
|
|
2441
|
-
throw new T(
|
|
2442
|
-
"filter_invalid",
|
|
2443
|
-
"This filter applies to Document sections, so it can't leave out one card.",
|
|
2444
|
-
"Change it in the editor."
|
|
2445
|
-
);
|
|
2446
|
-
const r = { ...t, scope: i }, a = Ee({ inputs: [r], dashboardFilters: [] });
|
|
2447
|
-
if (!a.ok)
|
|
2448
|
-
throw new T("filter_invalid", ((o = a.issues[0]) == null ? void 0 : o.message) ?? "This filter could not be saved.", "Change it in the editor.");
|
|
2449
|
-
return {
|
|
2450
|
-
...e,
|
|
2451
|
-
inputs: Y(e).map((s) => s.id === t.id ? r : s)
|
|
2452
|
-
};
|
|
2453
|
-
}
|
|
2454
|
-
function dn(e, t, n, i, r) {
|
|
2455
|
-
var u, d;
|
|
2456
|
-
const a = he(e, t);
|
|
2457
|
-
if (!me(e).some((f) => f.cardId === n))
|
|
2458
|
-
throw new T("card_not_found", `No card ${n} on this dashboard.`, "Read the outline again and use its card ids.");
|
|
2459
|
-
const o = [...((u = a.application) == null ? void 0 : u.cards) ?? []], s = o.findIndex((f) => f.cardId === n);
|
|
2460
|
-
s >= 0 ? o[s] = i : o.push(i);
|
|
2461
|
-
const l = {
|
|
2462
|
-
...a,
|
|
2463
|
-
...r ? { scope: r } : {},
|
|
2464
|
-
application: { ...a.application ?? { kind: "cardMappings" }, cards: o }
|
|
2465
|
-
}, c = Ee({ inputs: [l], dashboardFilters: [] });
|
|
2466
|
-
if (!c.ok)
|
|
2467
|
-
throw new T(
|
|
2468
|
-
"filter_invalid",
|
|
2469
|
-
((d = c.issues[0]) == null ? void 0 : d.message) ?? "This filter mapping could not be saved.",
|
|
2470
|
-
"Change the mapping and propose again."
|
|
2471
|
-
);
|
|
2472
|
-
return {
|
|
2473
|
-
...e,
|
|
2474
|
-
inputs: Y(e).map((f) => f.id === t ? l : f)
|
|
2475
|
-
};
|
|
2476
|
-
}
|
|
2477
|
-
function Fa(e) {
|
|
2478
|
-
switch (e.kind) {
|
|
2479
|
-
case "field":
|
|
2480
|
-
return `by ${e.field.name}`;
|
|
2481
|
-
case "relationship":
|
|
2482
|
-
return "through a chosen relationship path";
|
|
2483
|
-
default:
|
|
2484
|
-
return String(e.kind);
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
function Ca(e, t) {
|
|
2488
|
-
const n = he(e, t.filterId), i = { ...t.binding, kind: "bound", cardId: t.cardId }, r = ci(n.scope, t.cardId), a = r !== n.scope;
|
|
2489
|
-
return {
|
|
2490
|
-
dashboard: dn(e, t.filterId, t.cardId, i, a ? r : void 0),
|
|
2491
|
-
clauses: [
|
|
2492
|
-
ie(
|
|
2493
|
-
`makes ${j(n.label)} filter ${j(sn(e, t.cardId))} ${Fa(i.target)}${a ? ", which it used to leave out" : ""}`
|
|
2494
|
-
)
|
|
2495
|
-
]
|
|
2496
|
-
};
|
|
2497
|
-
}
|
|
2498
|
-
function Ia(e, t) {
|
|
2499
|
-
var r;
|
|
2500
|
-
const n = he(e, t.filterId);
|
|
2501
|
-
return {
|
|
2502
|
-
dashboard: ((r = n.filter) == null ? void 0 : r.kind) === "global-date" ? va(e, n, t.cardId) : dn(e, t.filterId, t.cardId, { kind: "excluded", cardId: t.cardId }),
|
|
2503
|
-
clauses: [ie(`stops ${j(n.label)} from filtering ${j(sn(e, t.cardId))}`)]
|
|
2504
|
-
};
|
|
2505
|
-
}
|
|
2506
|
-
function rs(e, t, n) {
|
|
2507
|
-
let i = e;
|
|
2508
|
-
const r = [], a = [], o = [];
|
|
2509
|
-
for (const [s, l] of t.entries()) {
|
|
2510
|
-
let c;
|
|
2511
|
-
try {
|
|
2512
|
-
c = xa(i, l, n);
|
|
2513
|
-
} catch (u) {
|
|
2514
|
-
if (!(u instanceof T)) throw u;
|
|
2515
|
-
return {
|
|
2516
|
-
ok: !1,
|
|
2517
|
-
failedAt: {
|
|
2518
|
-
index: s,
|
|
2519
|
-
op: l.op,
|
|
2520
|
-
code: u.code,
|
|
2521
|
-
message: u.message,
|
|
2522
|
-
...u.fix ? { fix: u.fix } : {},
|
|
2523
|
-
...u.details ? { details: u.details } : {}
|
|
2524
|
-
}
|
|
2525
|
-
};
|
|
2526
|
-
}
|
|
2527
|
-
i = c.dashboard, r.push(...c.created ?? []), a.push(...c.runtimeEffects ?? []), o.push({ index: s, changeIndex: l.changeIndex, clauses: c.clauses });
|
|
2528
|
-
}
|
|
2529
|
-
return { ok: !0, dashboard: i, created: r, descriptions: Sa(o), runtimeEffects: a };
|
|
2530
|
-
}
|
|
2531
|
-
function xa(e, t, n) {
|
|
2532
|
-
switch (t.op) {
|
|
2533
|
-
case "card.add":
|
|
2534
|
-
return pi(e, t);
|
|
2535
|
-
case "card.remove":
|
|
2536
|
-
return mi(e, t.cardId);
|
|
2537
|
-
case "card.update":
|
|
2538
|
-
return fi(e, t.cardId, t.update);
|
|
2539
|
-
case "layout.arrange":
|
|
2540
|
-
return Xr(e, t);
|
|
2541
|
-
case "frame.commit":
|
|
2542
|
-
return ra(e, t.commit);
|
|
2543
|
-
case "filter.add":
|
|
2544
|
-
return ga(e, t);
|
|
2545
|
-
case "filter.update":
|
|
2546
|
-
return ya(e, t, n);
|
|
2547
|
-
case "filter.remove":
|
|
2548
|
-
return ba(e, t.filterId);
|
|
2549
|
-
case "filter.bind":
|
|
2550
|
-
return Ca(e, t);
|
|
2551
|
-
case "filter.exclude":
|
|
2552
|
-
return Ia(e, t);
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
function Sa(e) {
|
|
2556
|
-
const t = [];
|
|
2557
|
-
for (const n of e) {
|
|
2558
|
-
const i = n.changeIndex === void 0 ? void 0 : t.find((r) => r.changeIndex === n.changeIndex);
|
|
2559
|
-
if (i) {
|
|
2560
|
-
i.operations.push(n.index), i.clauses.push(...n.clauses);
|
|
2561
|
-
continue;
|
|
2562
|
-
}
|
|
2563
|
-
t.push({
|
|
2564
|
-
...n.changeIndex !== void 0 ? { changeIndex: n.changeIndex } : {},
|
|
2565
|
-
operations: [n.index],
|
|
2566
|
-
sentence: "",
|
|
2567
|
-
clauses: [...n.clauses]
|
|
2568
|
-
});
|
|
2569
|
-
}
|
|
2570
|
-
return t.map(({ clauses: n, ...i }) => ({
|
|
2571
|
-
...i,
|
|
2572
|
-
sentence: gi(Da(n))
|
|
2573
|
-
}));
|
|
2574
|
-
}
|
|
2575
|
-
function Da(e) {
|
|
2576
|
-
let t = !1;
|
|
2577
|
-
return e.filter((n) => n.kind !== "detached" ? !0 : t ? !1 : (t = !0, !0));
|
|
2578
|
-
}
|
|
2579
|
-
function vt(e) {
|
|
2580
|
-
return Object.fromEntries(
|
|
2581
|
-
Object.entries(e).filter(
|
|
2582
|
-
(t) => typeof t[1] == "string" && t[1].length > 0
|
|
2583
|
-
)
|
|
2584
|
-
);
|
|
2585
|
-
}
|
|
2586
|
-
function ee(e) {
|
|
2587
|
-
return e.kind === "semantic" ? [
|
|
2588
|
-
e.kind,
|
|
2589
|
-
e.domainId,
|
|
2590
|
-
e.datasetId || "",
|
|
2591
|
-
e.datasetName || "",
|
|
2592
|
-
e.connectionId || ""
|
|
2593
|
-
].join(":") : [
|
|
2594
|
-
e.kind,
|
|
2595
|
-
e.connectionId,
|
|
2596
|
-
e.databaseName || "",
|
|
2597
|
-
e.schemaName || "",
|
|
2598
|
-
e.tableName
|
|
2599
|
-
].join(":");
|
|
2600
|
-
}
|
|
2601
|
-
function wa(e, t) {
|
|
2602
|
-
if (e.kind === "semantic")
|
|
2603
|
-
return {
|
|
2604
|
-
status: "ready",
|
|
2605
|
-
request: vt({
|
|
2606
|
-
connection_id: e.connectionId,
|
|
2607
|
-
domain_id: e.domainId,
|
|
2608
|
-
dataset_id: Oi(e),
|
|
2609
|
-
dataset_name: e.datasetName
|
|
2610
|
-
})
|
|
2611
|
-
};
|
|
2612
|
-
const n = Ji({
|
|
2613
|
-
source: e,
|
|
2614
|
-
capabilities: t
|
|
2615
|
-
});
|
|
2616
|
-
return n.kind === "incompatible_capabilities" ? {
|
|
2617
|
-
status: "unavailable",
|
|
2618
|
-
message: "Connection capabilities are unavailable for field metadata."
|
|
2619
|
-
} : n.kind === "missing_coordinates" ? {
|
|
2620
|
-
status: "unavailable",
|
|
2621
|
-
message: `Source is missing required field-metadata coordinates: ${n.missing.join(", ")}.`
|
|
2622
|
-
} : {
|
|
2623
|
-
status: "ready",
|
|
2624
|
-
request: vt({
|
|
2625
|
-
connection_id: e.connectionId,
|
|
2626
|
-
datamodel_id: "",
|
|
2627
|
-
database_name: n.coordinates.databaseName,
|
|
2628
|
-
schema_name: n.coordinates.schemaName,
|
|
2629
|
-
table_name: n.coordinates.tableName
|
|
2630
|
-
})
|
|
2631
|
-
};
|
|
2632
|
-
}
|
|
2633
|
-
function as(e, t = /* @__PURE__ */ new Map()) {
|
|
2634
|
-
const n = /* @__PURE__ */ new Map();
|
|
2635
|
-
for (const { card: i } of e) {
|
|
2636
|
-
const r = Lt(i), a = r.kind === "config" ? r.executableSources : r.kind === "sql" ? r.pinnedCatalogSources.map((o) => o.source) : [];
|
|
2637
|
-
for (const o of a) {
|
|
2638
|
-
const s = ee(o);
|
|
2639
|
-
if (!n.has(s)) {
|
|
2640
|
-
const l = wa(
|
|
2641
|
-
o,
|
|
2642
|
-
o.connectionId ? t.get(o.connectionId) : void 0
|
|
2643
|
-
);
|
|
2644
|
-
n.set(s, {
|
|
2645
|
-
key: s,
|
|
2646
|
-
source: o,
|
|
2647
|
-
...l
|
|
2648
|
-
});
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2651
|
-
}
|
|
2652
|
-
return Array.from(n.values());
|
|
2653
|
-
}
|
|
2654
|
-
function Ta(e, t) {
|
|
2655
|
-
if (e.kind !== "semantic" || !e.connectionId) return;
|
|
2656
|
-
const n = (t.qualifiedEntityName || "").split(".").map((r) => r.trim()).filter(Boolean), i = n.at(-1);
|
|
2657
|
-
if (i)
|
|
2658
|
-
return {
|
|
2659
|
-
kind: "physical",
|
|
2660
|
-
connectionId: e.connectionId,
|
|
2661
|
-
tableName: i,
|
|
2662
|
-
...n.length > 1 ? { schemaName: n.at(-2) } : {},
|
|
2663
|
-
...n.length > 2 ? { databaseName: n.at(-3) } : {}
|
|
2664
|
-
};
|
|
2665
|
-
}
|
|
2666
|
-
function oe(e, t) {
|
|
2667
|
-
let n = e.get(t);
|
|
2668
|
-
return n || (n = { fields: /* @__PURE__ */ new Map(), fieldConflicts: /* @__PURE__ */ new Set() }, e.set(t, n)), n;
|
|
2669
|
-
}
|
|
2670
|
-
function fn(e, t) {
|
|
2671
|
-
e.sourceLabel === void 0 ? e.sourceLabel = t : e.sourceLabel !== t && (e.sourceLabelConflict = !0);
|
|
2672
|
-
}
|
|
2673
|
-
function Me(e, t, n) {
|
|
2674
|
-
for (const i of t) {
|
|
2675
|
-
const r = i == null ? void 0 : i.trim();
|
|
2676
|
-
if (!r) continue;
|
|
2677
|
-
const a = $t(r), o = e.fields.get(a);
|
|
2678
|
-
o === void 0 ? e.fields.set(a, n) : o !== n && e.fieldConflicts.add(a);
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
function mn(e, t) {
|
|
2682
|
-
t.sourceLabel && fn(e, t.sourceLabel), t.sourceLabelConflict && (e.sourceLabelConflict = !0);
|
|
2683
|
-
for (const [n, i] of t.fields)
|
|
2684
|
-
Me(e, [n], i);
|
|
2685
|
-
for (const n of t.fieldConflicts ?? [])
|
|
2686
|
-
e.fieldConflicts.add(n);
|
|
2687
|
-
}
|
|
2688
|
-
function pn(e) {
|
|
2689
|
-
return e.kind === "semantic" && (e.label || e.datasetName || "").trim() || void 0;
|
|
2690
|
-
}
|
|
2691
|
-
function os(e, t) {
|
|
2692
|
-
var i, r;
|
|
2693
|
-
const n = /* @__PURE__ */ new Map();
|
|
2694
|
-
for (const [a, o] of e) {
|
|
2695
|
-
if (o.status !== "ready") continue;
|
|
2696
|
-
const s = t == null ? void 0 : t.get(a), l = s ? pn(s) : void 0;
|
|
2697
|
-
for (const c of o.columns) {
|
|
2698
|
-
const u = (i = c.column_name) == null ? void 0 : i.trim(), d = (r = c.label) == null ? void 0 : r.trim(), f = s ? Ta(s, c) : void 0;
|
|
2699
|
-
f && l && fn(
|
|
2700
|
-
oe(n, ee(f)),
|
|
2701
|
-
l
|
|
2702
|
-
), !(!u || !d || d === u) && (Me(
|
|
2703
|
-
oe(n, a),
|
|
2704
|
-
[u, c.sourceField],
|
|
2705
|
-
d
|
|
2706
|
-
), f && Me(
|
|
2707
|
-
oe(n, ee(f)),
|
|
2708
|
-
[c.sourceField, u],
|
|
2709
|
-
d
|
|
2710
|
-
));
|
|
2711
|
-
}
|
|
2712
|
-
}
|
|
2713
|
-
return n;
|
|
2714
|
-
}
|
|
2715
|
-
function ss(...e) {
|
|
2716
|
-
const t = /* @__PURE__ */ new Map();
|
|
2717
|
-
for (const n of e)
|
|
2718
|
-
for (const [i, r] of n ?? [])
|
|
2719
|
-
mn(oe(t, i), r);
|
|
2720
|
-
return t;
|
|
2721
|
-
}
|
|
2722
|
-
function Ue(e) {
|
|
2723
|
-
return [e.databaseName, e.schemaName, e.tableName].filter(Boolean).join(".");
|
|
2724
|
-
}
|
|
2725
|
-
function Oa(e) {
|
|
2726
|
-
return e.split(":").slice(2).filter(Boolean).join(".");
|
|
2727
|
-
}
|
|
2728
|
-
function gn(e, t) {
|
|
2729
|
-
const n = ee(t), i = e.get(n);
|
|
2730
|
-
if (t.kind !== "physical") return i;
|
|
2731
|
-
const r = `physical:${t.connectionId}:`, a = Ue(t), o = {
|
|
2732
|
-
fields: /* @__PURE__ */ new Map(),
|
|
2733
|
-
fieldConflicts: /* @__PURE__ */ new Set()
|
|
2734
|
-
};
|
|
2735
|
-
let s = !1;
|
|
2736
|
-
for (const [l, c] of e)
|
|
2737
|
-
l.startsWith(r) && (l !== n && !Qi(a, Oa(l)) || (mn(o, c), s = !0));
|
|
2738
|
-
return s ? o : void 0;
|
|
2739
|
-
}
|
|
2740
|
-
function Ma(e, t) {
|
|
2741
|
-
var r;
|
|
2742
|
-
if (!e) return;
|
|
2743
|
-
const n = $t(t.name), i = gn(e, t.source);
|
|
2744
|
-
return i && !((r = i.fieldConflicts) != null && r.has(n)) ? i.fields.get(n) : void 0;
|
|
2745
|
-
}
|
|
2746
|
-
function Pa(e, t) {
|
|
2747
|
-
if (t.kind === "semantic")
|
|
2748
|
-
return pn(t) || t.datasetId || "Dataset";
|
|
2749
|
-
const n = e ? gn(e, t) : void 0;
|
|
2750
|
-
return n != null && n.sourceLabel && !n.sourceLabelConflict ? n.sourceLabel : Ue(t);
|
|
2751
|
-
}
|
|
2752
|
-
function ls(e, t) {
|
|
2753
|
-
const n = Ma(e, t);
|
|
2754
|
-
return {
|
|
2755
|
-
name: t.name,
|
|
2756
|
-
...n ? { label: n } : {},
|
|
2757
|
-
entityName: Pa(e, t.source),
|
|
2758
|
-
...t.source.kind === "physical" ? { qualifiedEntityName: Ue(t.source) } : {},
|
|
2759
|
-
dataType: t.dataType
|
|
2760
|
-
};
|
|
2761
|
-
}
|
|
2762
|
-
function ka(e, t) {
|
|
2763
|
-
var r, a;
|
|
2764
|
-
const n = (r = t.column_name) == null ? void 0 : r.trim(), i = qt(t.data_type);
|
|
2765
|
-
if (!(!n || i === "unknown"))
|
|
2766
|
-
return {
|
|
2767
|
-
kind: "field",
|
|
2768
|
-
field: {
|
|
2769
|
-
name: n,
|
|
2770
|
-
source: { ...e },
|
|
2771
|
-
dataType: i,
|
|
2772
|
-
...(a = t.sourceField) != null && a.trim() ? { sourceField: t.sourceField.trim() } : {}
|
|
2773
|
-
}
|
|
2774
|
-
};
|
|
2775
|
-
}
|
|
2776
|
-
function cs(e) {
|
|
2777
|
-
const t = {};
|
|
2778
|
-
for (const { card: n } of e.cards) {
|
|
2779
|
-
const i = Lt(n), r = i.kind === "config" ? i.executableSources : i.kind === "sql" ? i.pinnedCatalogSources.map((s) => s.source) : [];
|
|
2780
|
-
if (!r.length) continue;
|
|
2781
|
-
const a = [];
|
|
2782
|
-
let o;
|
|
2783
|
-
for (const s of r) {
|
|
2784
|
-
const l = e.metadataBySourceKey.get(
|
|
2785
|
-
ee(s)
|
|
2786
|
-
);
|
|
2787
|
-
if (!l || l.status === "unavailable") {
|
|
2788
|
-
o = (l == null ? void 0 : l.status) === "unavailable" ? l.message : "Field metadata is not available yet.";
|
|
2789
|
-
break;
|
|
2790
|
-
}
|
|
2791
|
-
for (const c of l.columns) {
|
|
2792
|
-
const u = ka(s, c);
|
|
2793
|
-
u && a.push(u);
|
|
2794
|
-
}
|
|
2795
|
-
}
|
|
2796
|
-
t[n.id] = o ? { status: "metadataUnavailable", message: o } : { status: "ready", targets: a };
|
|
2797
|
-
}
|
|
2798
|
-
return t;
|
|
2799
|
-
}
|
|
2800
|
-
function us(e) {
|
|
2801
|
-
const { dashboard: t, target: n, calendar: i } = e, r = hn(n), a = yn(t, n, i);
|
|
2802
|
-
return {
|
|
2803
|
-
value: a,
|
|
2804
|
-
mode: $n(
|
|
2805
|
-
zn(a == null ? void 0 : a.operation) ? a.operation : r.operation
|
|
2806
|
-
)
|
|
2807
|
-
};
|
|
2808
|
-
}
|
|
2809
|
-
function yn(e, t, n) {
|
|
2810
|
-
var i;
|
|
2811
|
-
switch (t.kind) {
|
|
2812
|
-
case "dashboardInput": {
|
|
2813
|
-
const r = hi({
|
|
2814
|
-
dashboard: e,
|
|
2815
|
-
input: t.input,
|
|
2816
|
-
target: t.scope,
|
|
2817
|
-
calendar: n
|
|
2818
|
-
});
|
|
2819
|
-
return (r == null ? void 0 : r.status) === "set" && r.value.kind === "filter" ? r.value.filterValue : void 0;
|
|
2820
|
-
}
|
|
2821
|
-
case "dashboardFilter": {
|
|
2822
|
-
const r = (i = e.defaultFilterValues) == null ? void 0 : i.find(
|
|
2823
|
-
(a) => a.filterId === t.filter.id
|
|
2824
|
-
);
|
|
2825
|
-
return r ? yi({
|
|
2826
|
-
filterDefinitions: [t.filter],
|
|
2827
|
-
filterValues: [r]
|
|
2828
|
-
})[0] : Q(t.filter, n);
|
|
2829
|
-
}
|
|
2830
|
-
case "definition":
|
|
2831
|
-
return Q(t.filter, n);
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
function hn(e) {
|
|
2835
|
-
return e.kind === "dashboardInput" ? e.input.filter : e.filter;
|
|
2836
|
-
}
|
|
2837
|
-
function ds(e) {
|
|
2838
|
-
var a;
|
|
2839
|
-
const { dashboard: t, filter: n, input: i, scope: r } = e;
|
|
2840
|
-
return i && (t.inputs || []).some((o) => o.id === i.id) ? { kind: "dashboardInput", input: i, scope: r } : ((a = U(t).findFilterInput({ filterId: n.id })) == null ? void 0 : a.origin) === "toolbarFilter" ? { kind: "dashboardFilter", filter: n } : { kind: "definition", filter: n };
|
|
2841
|
-
}
|
|
2842
|
-
function fs(e) {
|
|
2843
|
-
const { dashboard: t, target: n, calendar: i } = e, r = hn(n), a = bi(r), o = Aa(t, n);
|
|
2844
|
-
if (!o) return a;
|
|
2845
|
-
if (o === "cleared")
|
|
2846
|
-
return {
|
|
2847
|
-
operation: r.operation,
|
|
2848
|
-
defaultValues: void 0,
|
|
2849
|
-
defaultDateFilter: void 0
|
|
2850
|
-
};
|
|
2851
|
-
const s = yn(t, n, i);
|
|
2852
|
-
if (!s || Na(s, Q(r, i)))
|
|
2853
|
-
return a;
|
|
2854
|
-
if (s.valueType === "date") {
|
|
2855
|
-
const l = Mi(
|
|
2856
|
-
"relativeMeta" in s ? s.relativeMeta : void 0
|
|
2857
|
-
) ?? Ra(r, s, i);
|
|
2858
|
-
return l ? {
|
|
2859
|
-
operation: s.operation,
|
|
2860
|
-
defaultValues: r.defaultValues,
|
|
2861
|
-
defaultDateFilter: l
|
|
2862
|
-
} : a;
|
|
2863
|
-
}
|
|
2864
|
-
return {
|
|
2865
|
-
operation: s.operation,
|
|
2866
|
-
defaultValues: s.values,
|
|
2867
|
-
defaultDateFilter: r.defaultDateFilter
|
|
2868
|
-
};
|
|
2869
|
-
}
|
|
2870
|
-
function Aa(e, t) {
|
|
2871
|
-
var n;
|
|
2872
|
-
if (t.kind === "dashboardInput") {
|
|
2873
|
-
const i = _e(
|
|
2874
|
-
e.defaultInputValues,
|
|
2875
|
-
t.input,
|
|
2876
|
-
t.scope
|
|
2877
|
-
);
|
|
2878
|
-
return (i == null ? void 0 : i.status) === "set" || (i == null ? void 0 : i.status) === "cleared" ? i.status : void 0;
|
|
2879
|
-
}
|
|
2880
|
-
if (t.kind === "dashboardFilter")
|
|
2881
|
-
return (n = e.defaultFilterValues) != null && n.some(
|
|
2882
|
-
(i) => i.filterId === t.filter.id
|
|
2883
|
-
) ? "set" : void 0;
|
|
2884
|
-
}
|
|
2885
|
-
function Na(e, t) {
|
|
2886
|
-
return !!(t && e.operation === t.operation && Se(Ft(e), Ft(t)) && Se(
|
|
2887
|
-
"relativeMeta" in e ? e.relativeMeta : void 0,
|
|
2888
|
-
"relativeMeta" in t ? t.relativeMeta : void 0
|
|
2889
|
-
));
|
|
2890
|
-
}
|
|
2891
|
-
function Ft(e) {
|
|
2892
|
-
return e.values.map(
|
|
2893
|
-
(t) => t instanceof Date ? t.getTime() : t
|
|
2894
|
-
);
|
|
2895
|
-
}
|
|
2896
|
-
function Ra(e, t, n) {
|
|
2897
|
-
const i = vi(n == null ? void 0 : n.tz), r = Fe(t.values[0], i);
|
|
2898
|
-
if (!r) return;
|
|
2899
|
-
const [a, o, s] = new Intl.DateTimeFormat("en-CA", {
|
|
2900
|
-
timeZone: i,
|
|
2901
|
-
year: "numeric",
|
|
2902
|
-
month: "2-digit",
|
|
2903
|
-
day: "2-digit"
|
|
2904
|
-
}).format(r).split("-").map(Number), l = [
|
|
2905
|
-
{
|
|
2906
|
-
mode: "fixed",
|
|
2907
|
-
unit: "day",
|
|
2908
|
-
date: `${a}-${String(o).padStart(2, "0")}-${String(s).padStart(2, "0")}`
|
|
2909
|
-
},
|
|
2910
|
-
{ mode: "fixed", unit: "month", year: a, month: o - 1 }
|
|
2911
|
-
], c = t.values.map(
|
|
2912
|
-
(u) => {
|
|
2913
|
-
var d;
|
|
2914
|
-
return (d = Fe(u, i)) == null ? void 0 : d.getTime();
|
|
2915
|
-
}
|
|
2916
|
-
);
|
|
2917
|
-
return l.find((u) => {
|
|
2918
|
-
const d = Q(
|
|
2919
|
-
{ ...e, defaultDateFilter: u },
|
|
2920
|
-
n
|
|
2921
|
-
);
|
|
2922
|
-
return (d == null ? void 0 : d.operation) === t.operation && Se(
|
|
2923
|
-
d.values.map(
|
|
2924
|
-
(f) => {
|
|
2925
|
-
var p;
|
|
2926
|
-
return (p = Fe(f, i)) == null ? void 0 : p.getTime();
|
|
2927
|
-
}
|
|
2928
|
-
),
|
|
2929
|
-
c
|
|
2930
|
-
);
|
|
2931
|
-
});
|
|
2932
|
-
}
|
|
2933
|
-
function _a(e) {
|
|
2934
|
-
const t = G(e.format);
|
|
2935
|
-
if ((t == null ? void 0 : t.type) === "temporal_bucket") {
|
|
2936
|
-
if (!e.granularity) return {};
|
|
2937
|
-
const n = Ui(
|
|
2938
|
-
t,
|
|
2939
|
-
e.granularity
|
|
2940
|
-
);
|
|
2941
|
-
return n ? {
|
|
2942
|
-
granularity: e.granularity,
|
|
2943
|
-
semanticTemporalPresentation: {
|
|
2944
|
-
granularity: e.granularity,
|
|
2945
|
-
format: n
|
|
2946
|
-
}
|
|
2947
|
-
} : {};
|
|
2948
|
-
}
|
|
2949
|
-
return {
|
|
2950
|
-
...e.granularity ? { granularity: e.granularity } : {},
|
|
2951
|
-
...t ? { format: t } : {}
|
|
2952
|
-
};
|
|
2953
|
-
}
|
|
2954
|
-
function Ea(e, t) {
|
|
2955
|
-
var r, a;
|
|
2956
|
-
const n = ((r = e.nativeDataType) == null ? void 0 : r.trim()) || ((a = e.native_data_type) == null ? void 0 : a.trim());
|
|
2957
|
-
return n || ((e.dataTypeProvenance || t) === "physical" ? e.data_type : void 0);
|
|
2958
|
-
}
|
|
2959
|
-
function bn(e) {
|
|
2960
|
-
const t = (e.label ?? "").trim();
|
|
2961
|
-
return t ? e.derivedLabel === void 0 ? !0 : t !== e.derivedLabel.trim() : !1;
|
|
2962
|
-
}
|
|
2963
|
-
function je(e) {
|
|
2964
|
-
return bn(e) ? e.label.trim() : e.name || (e.label ?? "").trim();
|
|
2965
|
-
}
|
|
2966
|
-
function Ct(e) {
|
|
2967
|
-
return je(e).toLowerCase().trim();
|
|
2968
|
-
}
|
|
2969
|
-
function Va(e, t) {
|
|
2970
|
-
return Ct(e).localeCompare(Ct(t), void 0, {
|
|
2971
|
-
numeric: !0,
|
|
2972
|
-
sensitivity: "base"
|
|
2973
|
-
});
|
|
2974
|
-
}
|
|
2975
|
-
function X(e) {
|
|
2976
|
-
return String(e ?? "").toLowerCase().replace(/[\s_\-.]+/g, "");
|
|
2977
|
-
}
|
|
2978
|
-
function ms(e, t) {
|
|
2979
|
-
const n = X(t);
|
|
2980
|
-
return n ? [
|
|
2981
|
-
je(e),
|
|
2982
|
-
e.label,
|
|
2983
|
-
e.name,
|
|
2984
|
-
e.description,
|
|
2985
|
-
e.entityName,
|
|
2986
|
-
e.qualifiedEntityName,
|
|
2987
|
-
e.entityName && e.name ? `${e.entityName}.${e.name}` : "",
|
|
2988
|
-
e.dataType
|
|
2989
|
-
].some(
|
|
2990
|
-
(r) => !!r && X(r).includes(n)
|
|
2991
|
-
) : !0;
|
|
2992
|
-
}
|
|
2993
|
-
function It(e, t) {
|
|
2994
|
-
const n = X(t);
|
|
2995
|
-
if (!n) return 0;
|
|
2996
|
-
const i = X(je(e));
|
|
2997
|
-
return i.startsWith(n) ? 0 : i.includes(n) ? 1 : [e.label, e.name].filter(Boolean).map(X).some((a) => a.includes(n)) ? 2 : 3;
|
|
2998
|
-
}
|
|
2999
|
-
function ps(e, t, n) {
|
|
3000
|
-
return It(e, n) - It(t, n) || Va(e, t);
|
|
3001
|
-
}
|
|
3002
|
-
function Ka(e, t) {
|
|
3003
|
-
var a;
|
|
3004
|
-
const n = e.type === "dataset" ? (a = t.find((o) => o.entityName)) == null ? void 0 : a.entityName : void 0, i = n || e.name, r = ut(
|
|
3005
|
-
e.type === "dataset" && n ? { ...e, name: n } : e
|
|
3006
|
-
);
|
|
3007
|
-
return {
|
|
3008
|
-
entityId: e.id || e.name,
|
|
3009
|
-
entityType: e.type,
|
|
3010
|
-
entityName: i,
|
|
3011
|
-
label: e.label,
|
|
3012
|
-
description: e.description,
|
|
3013
|
-
qualifiedEntityName: r,
|
|
3014
|
-
columns: t.map((o) => {
|
|
3015
|
-
var p;
|
|
3016
|
-
const s = e.type === "dataset" ? o.entityName || i : e.name, l = o.qualifiedEntityName || (e.type === "dataset" && s ? ut({ ...e, name: s }) : r), c = Ea(
|
|
3017
|
-
o,
|
|
3018
|
-
e.type === "dataset" ? "semantic" : "physical"
|
|
3019
|
-
), u = (p = o.label) != null && p.trim() ? o.label : void 0, d = u ? void 0 : Fi(o.column_name);
|
|
3020
|
-
return {
|
|
3021
|
-
id: Ci(s, o.column_name),
|
|
3022
|
-
name: o.column_name,
|
|
3023
|
-
qualifiedFieldName: o.qualifiedFieldName || o.column_name,
|
|
3024
|
-
dataType: o.data_type,
|
|
3025
|
-
...c ? { nativeDataType: c } : {},
|
|
3026
|
-
label: u ?? d ?? o.column_name,
|
|
3027
|
-
...d !== void 0 ? { derivedLabel: d } : {},
|
|
3028
|
-
description: o.description || "",
|
|
3029
|
-
qualifiedEntityName: l,
|
|
3030
|
-
entityId: o.entityId || e.id || e.id || s,
|
|
3031
|
-
entityName: s,
|
|
3032
|
-
entityType: o.entityType || e.type,
|
|
3033
|
-
role: o.role,
|
|
3034
|
-
expression: o.expression,
|
|
3035
|
-
calculatedFormula: o.calculatedFormula,
|
|
3036
|
-
calculationRepresentation: o.calculationRepresentation,
|
|
3037
|
-
derivedField: o.derivedField,
|
|
3038
|
-
fieldScope: o.fieldScope,
|
|
3039
|
-
source: o.source,
|
|
3040
|
-
sourceField: o.sourceField,
|
|
3041
|
-
calculatedFieldOrigin: o.calculatedFieldOrigin,
|
|
3042
|
-
aggregateOrigin: o.aggregateOrigin,
|
|
3043
|
-
labelOrigin: o.labelOrigin,
|
|
3044
|
-
formatOrigin: o.formatOrigin,
|
|
3045
|
-
..._a(o),
|
|
3046
|
-
aggregate: o.aggregate
|
|
3047
|
-
};
|
|
3048
|
-
})
|
|
3049
|
-
};
|
|
3050
|
-
}
|
|
3051
|
-
function La(e) {
|
|
3052
|
-
return e.map((t) => ({
|
|
3053
|
-
...t,
|
|
3054
|
-
id: Bt({ ...t }),
|
|
3055
|
-
fieldScope: "domain"
|
|
3056
|
-
}));
|
|
3057
|
-
}
|
|
3058
|
-
function Ba(e) {
|
|
3059
|
-
return e.flatMap(
|
|
3060
|
-
(t) => t.columns.map((n) => {
|
|
3061
|
-
const i = bn(n) ? n.label : void 0, r = i ? void 0 : n.derivedLabel ?? xi(n.name), a = i ?? r ?? n.name;
|
|
3062
|
-
return {
|
|
3063
|
-
...n,
|
|
3064
|
-
id: n.id || `${t.entityId}-${n.name}`,
|
|
3065
|
-
name: n.name,
|
|
3066
|
-
qualifiedFieldName: n.qualifiedFieldName || n.name,
|
|
3067
|
-
dataType: n.dataType,
|
|
3068
|
-
qualifiedEntityName: n.qualifiedEntityName || t.qualifiedEntityName,
|
|
3069
|
-
label: a,
|
|
3070
|
-
...r !== void 0 ? { derivedLabel: r } : {},
|
|
3071
|
-
description: n.description,
|
|
3072
|
-
entityId: n.entityId || t.entityId,
|
|
3073
|
-
entityName: n.entityName || t.entityName,
|
|
3074
|
-
entityType: n.entityType || t.entityType
|
|
3075
|
-
};
|
|
3076
|
-
})
|
|
3077
|
-
);
|
|
3078
|
-
}
|
|
3079
|
-
function gs(e) {
|
|
3080
|
-
const t = e.map((i) => Ka(i.target, i.columns || [])).filter((i) => {
|
|
3081
|
-
var r;
|
|
3082
|
-
return ((r = i == null ? void 0 : i.columns) == null ? void 0 : r.length) > 0;
|
|
3083
|
-
}), n = La(e.flatMap((i) => i.calculatedFields || []));
|
|
3084
|
-
if (n.length > 0) {
|
|
3085
|
-
const i = /* @__PURE__ */ new Map();
|
|
3086
|
-
n.forEach((r) => {
|
|
3087
|
-
const a = Bt(r);
|
|
3088
|
-
i.has(a) || i.set(a, r);
|
|
3089
|
-
}), t.unshift({
|
|
3090
|
-
entityId: Ii,
|
|
3091
|
-
entityType: "dataset",
|
|
3092
|
-
entityName: dt,
|
|
3093
|
-
label: "Calculated Fields",
|
|
3094
|
-
description: "Domain-level calculated metrics and dimensions",
|
|
3095
|
-
qualifiedEntityName: dt,
|
|
3096
|
-
columns: Array.from(i.values())
|
|
3097
|
-
});
|
|
3098
|
-
}
|
|
3099
|
-
return { columnGroups: t, columns: Ba(t) };
|
|
3100
|
-
}
|
|
3101
|
-
function qa(e, t) {
|
|
3102
|
-
var r;
|
|
3103
|
-
const n = (r = t.columnKeyMap) == null ? void 0 : r.byRole;
|
|
3104
|
-
if (!n) return;
|
|
3105
|
-
const i = Object.values(n).flatMap((a) => {
|
|
3106
|
-
const o = a == null ? void 0 : a[e];
|
|
3107
|
-
return o ? [o] : [];
|
|
3108
|
-
});
|
|
3109
|
-
if (i.length === 1)
|
|
3110
|
-
return i[0].outputKey ?? i[0].rawKey;
|
|
3111
|
-
}
|
|
3112
|
-
function $a(e, t) {
|
|
3113
|
-
var i;
|
|
3114
|
-
const n = (i = t.resultColumns) == null ? void 0 : i.find((r) => {
|
|
3115
|
-
const a = r.pivotIdentity;
|
|
3116
|
-
return (a == null ? void 0 : a.metricId) === e.metricId && a.members.length === e.members.length && a.members.every(
|
|
3117
|
-
(o, s) => o.fieldId === e.members[s].fieldId && o.value === e.members[s].value
|
|
3118
|
-
);
|
|
3119
|
-
});
|
|
3120
|
-
return n == null ? void 0 : n.key;
|
|
3121
|
-
}
|
|
3122
|
-
function xt(e, t) {
|
|
3123
|
-
var n;
|
|
3124
|
-
switch (e.kind) {
|
|
3125
|
-
case "field":
|
|
3126
|
-
return qa(e.fieldId, t);
|
|
3127
|
-
case "pivot":
|
|
3128
|
-
return $a(e, t);
|
|
3129
|
-
case "result":
|
|
3130
|
-
return !t.keys || t.keys.includes(e.key) ? e.key : void 0;
|
|
3131
|
-
case "sqlKpiValue":
|
|
3132
|
-
return (n = t.keys) == null ? void 0 : n[0];
|
|
3133
|
-
case "matrixMeasure":
|
|
3134
|
-
return e.measureId;
|
|
3135
|
-
case "matrixLevel":
|
|
3136
|
-
return;
|
|
3137
|
-
}
|
|
3138
|
-
}
|
|
3139
|
-
function ys(e, t) {
|
|
3140
|
-
return e.flatMap((n) => {
|
|
3141
|
-
var s, l;
|
|
3142
|
-
const i = xt(n.condition.column, t);
|
|
3143
|
-
if (i === void 0) return [];
|
|
3144
|
-
const r = (s = n.target.columns) == null ? void 0 : s.flatMap((c) => {
|
|
3145
|
-
const u = xt(c, t);
|
|
3146
|
-
return u === void 0 ? [] : [u];
|
|
3147
|
-
});
|
|
3148
|
-
if ((l = n.target.columns) != null && l.length && !(r != null && r.length)) return [];
|
|
3149
|
-
const { columns: a, ...o } = n.target;
|
|
3150
|
-
return [
|
|
3151
|
-
{
|
|
3152
|
-
...n,
|
|
3153
|
-
condition: { ...n.condition, column: i },
|
|
3154
|
-
target: r ? { ...o, columns: r } : o
|
|
3155
|
-
}
|
|
3156
|
-
];
|
|
3157
|
-
});
|
|
3158
|
-
}
|
|
3159
|
-
function hs(e, t, n) {
|
|
3160
|
-
var o, s, l, c, u;
|
|
3161
|
-
const i = Si(e);
|
|
3162
|
-
if (i.includes("matrixMeasure"))
|
|
3163
|
-
return (s = (o = e.config) == null ? void 0 : o.matrix) != null && s.spec.measures.some((d) => d.id === t) ? { kind: "matrixMeasure", measureId: t } : void 0;
|
|
3164
|
-
if (i.includes("sqlKpiValue")) return { kind: "sqlKpiValue" };
|
|
3165
|
-
if (i.includes("result"))
|
|
3166
|
-
return !n.keys || n.keys.includes(t) ? { kind: "result", key: t } : void 0;
|
|
3167
|
-
const r = i.includes("pivot") ? (c = (l = n.resultColumns) == null ? void 0 : l.find((d) => d.key === t)) == null ? void 0 : c.pivotIdentity : void 0;
|
|
3168
|
-
if (r)
|
|
3169
|
-
return {
|
|
3170
|
-
kind: "pivot",
|
|
3171
|
-
metricId: r.metricId,
|
|
3172
|
-
members: r.members.map((d) => ({ fieldId: d.fieldId, value: d.value }))
|
|
3173
|
-
};
|
|
3174
|
-
if (!i.includes("field")) return;
|
|
3175
|
-
const a = Object.values(((u = n.columnKeyMap) == null ? void 0 : u.byRole) ?? {}).flatMap(
|
|
3176
|
-
(d) => Object.entries(d ?? {}).flatMap(
|
|
3177
|
-
([f, p]) => (p.outputKey ?? p.rawKey) === t ? [f] : []
|
|
3178
|
-
)
|
|
3179
|
-
);
|
|
3180
|
-
return a.length === 1 ? { kind: "field", fieldId: a[0] } : void 0;
|
|
3181
|
-
}
|
|
3182
|
-
function fe(e, t) {
|
|
3183
|
-
const n = (a) => {
|
|
3184
|
-
if (L(a)) return a.value;
|
|
3185
|
-
const o = typeof a == "string" ? Pi(a.trim()) ?? K(a) : K(a);
|
|
3186
|
-
if (o === null) return null;
|
|
3187
|
-
try {
|
|
3188
|
-
return ki(String(o));
|
|
3189
|
-
} catch {
|
|
3190
|
-
return null;
|
|
3191
|
-
}
|
|
3192
|
-
}, i = n(e), r = n(t);
|
|
3193
|
-
return i === null || r === null ? null : zt(i, r);
|
|
3194
|
-
}
|
|
3195
|
-
function St(e, t, n) {
|
|
3196
|
-
const i = za(e);
|
|
3197
|
-
if (i === null) return null;
|
|
3198
|
-
if (typeof i == "number" && typeof t == "number" && typeof n == "number") {
|
|
3199
|
-
const g = ja(i, t, n);
|
|
3200
|
-
return { ratio: g, midpointComparison: Math.sign(g - 0.5) };
|
|
3201
|
-
}
|
|
3202
|
-
if ([t, n].some((g) => typeof g == "number" && !Number.isFinite(g))) return null;
|
|
3203
|
-
const r = [i, t, n].map((g) => {
|
|
3204
|
-
const b = typeof g == "number" ? De(String(g)) : g.value, [m, v = ""] = b.split(".");
|
|
3205
|
-
return { coefficient: m + v, scale: v.length };
|
|
3206
|
-
}), a = Math.max(...r.map((g) => g.scale)), [o, s, l] = r.map(
|
|
3207
|
-
(g) => BigInt(g.coefficient) * 10n ** BigInt(a - g.scale)
|
|
3208
|
-
), c = l - s, u = o - s;
|
|
3209
|
-
if (c <= 0n)
|
|
3210
|
-
return {
|
|
3211
|
-
ratio: o >= l ? 1 : 0,
|
|
3212
|
-
midpointComparison: o >= l ? 1 : -1
|
|
3213
|
-
};
|
|
3214
|
-
const d = u * 2n - c, f = d < 0n ? -1 : d > 0n ? 1 : 0;
|
|
3215
|
-
return { ratio: u <= 0n ? 0 : u >= c ? 1 : Number(u * 1000000000n / c) / 1e9, midpointComparison: f };
|
|
3216
|
-
}
|
|
3217
|
-
function bs(e) {
|
|
3218
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
3219
|
-
}
|
|
3220
|
-
function vs(e) {
|
|
3221
|
-
return e.enabled !== !1;
|
|
3222
|
-
}
|
|
3223
|
-
function Fs(e) {
|
|
3224
|
-
return e.kind === "topBottom" || e.kind === "colorScale" && e.range === "auto" || e.kind === "dataBar" && e.range === "auto";
|
|
3225
|
-
}
|
|
3226
|
-
function K(e) {
|
|
3227
|
-
if (typeof e == "number")
|
|
3228
|
-
return Number.isFinite(e) ? e : null;
|
|
3229
|
-
if (typeof e == "string" && e.trim() !== "") {
|
|
3230
|
-
const t = Number(e);
|
|
3231
|
-
return Number.isFinite(t) ? t : null;
|
|
3232
|
-
}
|
|
3233
|
-
return null;
|
|
3234
|
-
}
|
|
3235
|
-
function za(e) {
|
|
3236
|
-
return L(e) ? e : K(e);
|
|
3237
|
-
}
|
|
3238
|
-
function Cs(e) {
|
|
3239
|
-
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
3240
|
-
for (const i of e)
|
|
3241
|
-
L(i) ? n.add(i.value) : t.add(i);
|
|
3242
|
-
return {
|
|
3243
|
-
has: (i) => L(i) ? n.has(i.value) : t.has(i)
|
|
3244
|
-
};
|
|
3245
|
-
}
|
|
3246
|
-
function Dt(e, t) {
|
|
3247
|
-
return typeof e == "number" && typeof t == "number" ? Math.sign(e - t) : zt(
|
|
3248
|
-
typeof e == "number" ? De(String(e)) : e.value,
|
|
3249
|
-
typeof t == "number" ? De(String(t)) : t.value
|
|
3250
|
-
);
|
|
3251
|
-
}
|
|
3252
|
-
function Ua(e) {
|
|
3253
|
-
return e == null || e === "";
|
|
3254
|
-
}
|
|
3255
|
-
function ja(e, t, n) {
|
|
3256
|
-
return !Number.isFinite(e) || !Number.isFinite(t) || !Number.isFinite(n) ? 0 : n === t ? e >= n ? 1 : 0 : Math.max(0, Math.min(1, (e - t) / (n - t)));
|
|
3257
|
-
}
|
|
3258
|
-
function Ga(e) {
|
|
3259
|
-
switch (e) {
|
|
3260
|
-
case "bold":
|
|
3261
|
-
return 700;
|
|
3262
|
-
case "semibold":
|
|
3263
|
-
return 600;
|
|
3264
|
-
case "medium":
|
|
3265
|
-
return 500;
|
|
3266
|
-
case "normal":
|
|
3267
|
-
return 400;
|
|
3268
|
-
default:
|
|
3269
|
-
return;
|
|
3270
|
-
}
|
|
3271
|
-
}
|
|
3272
|
-
function Wa(e) {
|
|
3273
|
-
return e ? Fn({
|
|
3274
|
-
fontWeight: Ga(e.fontWeight),
|
|
3275
|
-
fontStyle: e.italic ? "italic" : void 0,
|
|
3276
|
-
color: e.textColor,
|
|
3277
|
-
backgroundColor: e.backgroundColor,
|
|
3278
|
-
textDecoration: e.textDecoration
|
|
3279
|
-
}) : {};
|
|
3280
|
-
}
|
|
3281
|
-
function vn(...e) {
|
|
3282
|
-
return Object.assign(
|
|
3283
|
-
{},
|
|
3284
|
-
...e.filter((t) => !!t).map(Fn)
|
|
3285
|
-
);
|
|
3286
|
-
}
|
|
3287
|
-
function Fn(e) {
|
|
3288
|
-
return Object.fromEntries(
|
|
3289
|
-
Object.entries(e).filter(([, t]) => t !== void 0)
|
|
3290
|
-
);
|
|
3291
|
-
}
|
|
3292
|
-
function Ha(e, t, n) {
|
|
3293
|
-
if (L(e) || L(n)) {
|
|
3294
|
-
const s = fe(e, n);
|
|
3295
|
-
if (s === null) return t === "neq";
|
|
3296
|
-
switch (t) {
|
|
3297
|
-
case "eq":
|
|
3298
|
-
return s === 0;
|
|
3299
|
-
case "neq":
|
|
3300
|
-
return s !== 0;
|
|
3301
|
-
case "gt":
|
|
3302
|
-
return s > 0;
|
|
3303
|
-
case "gte":
|
|
3304
|
-
return s >= 0;
|
|
3305
|
-
case "lt":
|
|
3306
|
-
return s < 0;
|
|
3307
|
-
case "lte":
|
|
3308
|
-
return s <= 0;
|
|
3309
|
-
}
|
|
3310
|
-
}
|
|
3311
|
-
const i = K(e), r = K(n), a = i ?? String(e ?? ""), o = r ?? String(n ?? "");
|
|
3312
|
-
switch (t) {
|
|
3313
|
-
case "eq":
|
|
3314
|
-
return a === o;
|
|
3315
|
-
case "neq":
|
|
3316
|
-
return a !== o;
|
|
3317
|
-
case "gt":
|
|
3318
|
-
return a > o;
|
|
3319
|
-
case "gte":
|
|
3320
|
-
return a >= o;
|
|
3321
|
-
case "lt":
|
|
3322
|
-
return a < o;
|
|
3323
|
-
case "lte":
|
|
3324
|
-
return a <= o;
|
|
3325
|
-
}
|
|
3326
|
-
}
|
|
3327
|
-
function Ya(e, t, n, i) {
|
|
3328
|
-
var a;
|
|
3329
|
-
const r = t[e.column];
|
|
3330
|
-
switch (e.kind) {
|
|
3331
|
-
case "comparison":
|
|
3332
|
-
return Ha(r, e.operator, e.value);
|
|
3333
|
-
case "between": {
|
|
3334
|
-
if ([r, e.min, e.max].some(L)) {
|
|
3335
|
-
const c = fe(r, e.min), u = fe(r, e.max);
|
|
3336
|
-
return c === null || u === null ? !1 : e.inclusive === !1 ? c > 0 && u < 0 : c >= 0 && u <= 0;
|
|
3337
|
-
}
|
|
3338
|
-
const o = K(r), s = K(e.min), l = K(e.max);
|
|
3339
|
-
return o === null || s === null || l === null ? !1 : e.inclusive === !1 ? o > s && o < l : o >= s && o <= l;
|
|
3340
|
-
}
|
|
3341
|
-
case "blank":
|
|
3342
|
-
return Ua(r) === e.isBlank;
|
|
3343
|
-
case "contains": {
|
|
3344
|
-
const o = L(r) ? r.value : String(r ?? ""), s = e.value, l = e.caseSensitive ? o : o.toLocaleLowerCase(), c = e.caseSensitive ? s : s.toLocaleLowerCase();
|
|
3345
|
-
return e.exact ? l === c : l.includes(c);
|
|
3346
|
-
}
|
|
3347
|
-
case "topBottom":
|
|
3348
|
-
return ((a = n.topBottom[i]) == null ? void 0 : a.has(r)) ?? !1;
|
|
3349
|
-
case "colorScale":
|
|
3350
|
-
case "dataBar":
|
|
3351
|
-
return !n.unavailableRuleIds.has(i);
|
|
3352
|
-
}
|
|
3353
|
-
}
|
|
3354
|
-
function Ja(e, t) {
|
|
3355
|
-
var n;
|
|
3356
|
-
return !((n = e.target.tableParts) != null && n.length) || e.target.tableParts.includes(t);
|
|
3357
|
-
}
|
|
3358
|
-
function Qa(e, t) {
|
|
3359
|
-
const n = e.target.columns;
|
|
3360
|
-
return e.target.level === "row" ? !(n != null && n.length) || n.includes(t) : n != null && n.length ? n.includes(t) : t === e.condition.column;
|
|
3361
|
-
}
|
|
3362
|
-
function Za(e, t, n) {
|
|
3363
|
-
var i, r;
|
|
3364
|
-
if (e.condition.kind === "colorScale") {
|
|
3365
|
-
const a = n.numericRanges[e.id];
|
|
3366
|
-
if (!a) return {};
|
|
3367
|
-
const o = t[e.condition.column], s = St(
|
|
3368
|
-
o,
|
|
3369
|
-
a.min,
|
|
3370
|
-
a.max
|
|
3371
|
-
);
|
|
3372
|
-
if (!s)
|
|
3373
|
-
return {};
|
|
3374
|
-
const l = a.mid, c = l !== void 0 && L(o) ? fe(o, l) : l === void 0 ? null : Math.sign(K(o) - l);
|
|
3375
|
-
return { cellStyle: { backgroundColor: l !== void 0 && e.condition.colors.mid ? c < 0 ? e.condition.colors.min : c === 0 ? e.condition.colors.mid : e.condition.colors.max : s.midpointComparison < 0 ? e.condition.colors.min : e.condition.colors.max } };
|
|
3376
|
-
}
|
|
3377
|
-
if (e.condition.kind === "dataBar") {
|
|
3378
|
-
const a = n.numericRanges[e.id];
|
|
3379
|
-
if (!a) return {};
|
|
3380
|
-
const o = e.condition.range === "auto" && Dt(a.min, 0) > 0 && Dt(a.max, 0) > 0 ? 0 : a.min, s = St(
|
|
3381
|
-
t[e.condition.column],
|
|
3382
|
-
o,
|
|
3383
|
-
a.max
|
|
3384
|
-
);
|
|
3385
|
-
return s ? {
|
|
3386
|
-
overlay: {
|
|
3387
|
-
kind: "dataBar",
|
|
3388
|
-
color: e.condition.color,
|
|
3389
|
-
ratio: s.ratio,
|
|
3390
|
-
showValue: e.condition.showValue !== !1
|
|
3391
|
-
}
|
|
3392
|
-
} : {};
|
|
3393
|
-
}
|
|
3394
|
-
return {
|
|
3395
|
-
cellStyle: vn(
|
|
3396
|
-
Wa(e.style),
|
|
3397
|
-
(i = e.style) != null && i.textColor ? { color: e.style.textColor } : void 0
|
|
3398
|
-
),
|
|
3399
|
-
overlay: (r = e.style) != null && r.icon ? {
|
|
3400
|
-
kind: "icon",
|
|
3401
|
-
icon: e.style.icon
|
|
3402
|
-
} : void 0
|
|
3403
|
-
};
|
|
3404
|
-
}
|
|
3405
|
-
function Xa(e) {
|
|
3406
|
-
const t = {
|
|
3407
|
-
matchedRuleIds: []
|
|
3408
|
-
};
|
|
3409
|
-
for (const n of e.rules) {
|
|
3410
|
-
if (n.target.matrix !== void 0 || n.enabled === !1 || !Ja(n, e.tablePart) || !Qa(n, e.columnKey) || !Ya(n.condition, e.row, e.range, n.id))
|
|
3411
|
-
continue;
|
|
3412
|
-
const i = Za(n, e.row, e.range), r = n.target.level === "row" ? "rowStyle" : "cellStyle";
|
|
3413
|
-
t[r] = vn(
|
|
3414
|
-
t[r],
|
|
3415
|
-
i.cellStyle
|
|
3416
|
-
), i.overlay && (t.overlay = i.overlay), t.matchedRuleIds.push(n.id);
|
|
3417
|
-
}
|
|
3418
|
-
return t;
|
|
3419
|
-
}
|
|
3420
|
-
function Pe(e) {
|
|
3421
|
-
switch (e.kind) {
|
|
3422
|
-
case "field":
|
|
3423
|
-
return `field:${e.fieldId}`;
|
|
3424
|
-
case "result":
|
|
3425
|
-
return `result:${e.key}`;
|
|
3426
|
-
case "sqlKpiValue":
|
|
3427
|
-
return "sqlKpiValue";
|
|
3428
|
-
case "matrixMeasure":
|
|
3429
|
-
return `matrixMeasure:${e.measureId}`;
|
|
3430
|
-
case "matrixLevel":
|
|
3431
|
-
return `matrixLevel:${e.levelId}`;
|
|
3432
|
-
case "pivot":
|
|
3433
|
-
return `pivot:${JSON.stringify([e.metricId, e.members.map((t) => [t.fieldId, t.value])])}`;
|
|
3434
|
-
}
|
|
3435
|
-
}
|
|
3436
|
-
function wt(e) {
|
|
3437
|
-
if (e === "sqlKpiValue") return { kind: "sqlKpiValue" };
|
|
3438
|
-
const t = e.indexOf(":");
|
|
3439
|
-
if (t <= 0) return;
|
|
3440
|
-
const n = e.slice(0, t), i = e.slice(t + 1);
|
|
3441
|
-
if (i)
|
|
3442
|
-
switch (n) {
|
|
3443
|
-
case "field":
|
|
3444
|
-
return { kind: "field", fieldId: i };
|
|
3445
|
-
case "result":
|
|
3446
|
-
return { kind: "result", key: i };
|
|
3447
|
-
case "matrixMeasure":
|
|
3448
|
-
return { kind: "matrixMeasure", measureId: i };
|
|
3449
|
-
case "matrixLevel":
|
|
3450
|
-
return { kind: "matrixLevel", levelId: i };
|
|
3451
|
-
case "pivot":
|
|
3452
|
-
try {
|
|
3453
|
-
const [r, a] = JSON.parse(i);
|
|
3454
|
-
return typeof r != "string" || !Array.isArray(a) ? void 0 : { kind: "pivot", metricId: r, members: a.map(([o, s]) => ({ fieldId: o, value: s })) };
|
|
3455
|
-
} catch {
|
|
3456
|
-
return;
|
|
3457
|
-
}
|
|
3458
|
-
default:
|
|
3459
|
-
return;
|
|
3460
|
-
}
|
|
3461
|
-
}
|
|
3462
|
-
function Ge(e, t) {
|
|
3463
|
-
const { columns: n, ...i } = e.target;
|
|
3464
|
-
return {
|
|
3465
|
-
...e,
|
|
3466
|
-
condition: { ...e.condition, column: t(e.condition.column) },
|
|
3467
|
-
target: n ? { ...i, columns: n.map(t) } : i
|
|
3468
|
-
};
|
|
3469
|
-
}
|
|
3470
|
-
function Is(e) {
|
|
3471
|
-
return e.map((t) => Ge(t, Pe));
|
|
3472
|
-
}
|
|
3473
|
-
function xs(e) {
|
|
3474
|
-
return e.flatMap((t) => {
|
|
3475
|
-
var s;
|
|
3476
|
-
const n = wt(t.condition.column);
|
|
3477
|
-
if (!n) return [];
|
|
3478
|
-
const i = Ge(t, (l) => wt(l) ?? null), r = (s = i.target.columns) == null ? void 0 : s.filter((l) => l !== null), { columns: a, ...o } = i.target;
|
|
3479
|
-
return [
|
|
3480
|
-
{
|
|
3481
|
-
...i,
|
|
3482
|
-
condition: { ...i.condition, column: n },
|
|
3483
|
-
target: r ? { ...o, columns: r } : o
|
|
3484
|
-
}
|
|
3485
|
-
];
|
|
3486
|
-
});
|
|
3487
|
-
}
|
|
3488
|
-
const ae = Object.freeze({}), xe = "value";
|
|
3489
|
-
function eo() {
|
|
3490
|
-
return { numericRanges: {}, topBottom: {}, unavailableRuleIds: /* @__PURE__ */ new Set() };
|
|
3491
|
-
}
|
|
3492
|
-
function to(e, t) {
|
|
3493
|
-
var i, r, a, o;
|
|
3494
|
-
if ((i = e.sql) != null && i.trim()) return { kind: "sqlKpiValue" };
|
|
3495
|
-
const n = t ?? ((o = (a = (r = e.config) == null ? void 0 : r.metricColumns) == null ? void 0 : a[0]) == null ? void 0 : o.id);
|
|
3496
|
-
return n ? { kind: "field", fieldId: n } : void 0;
|
|
3497
|
-
}
|
|
3498
|
-
function Ss(e, t, n) {
|
|
3499
|
-
const i = Di(e);
|
|
3500
|
-
if (!i.length) return ae;
|
|
3501
|
-
const r = to(e, n);
|
|
3502
|
-
if (!r) return ae;
|
|
3503
|
-
const a = (c) => Pe(c) === Pe(r), o = i.filter((c) => a(c.condition.column)).map((c) => Ge(c, (u) => a(u) ? xe : ""));
|
|
3504
|
-
if (!o.length) return ae;
|
|
3505
|
-
const s = Xa({
|
|
3506
|
-
rules: o,
|
|
3507
|
-
row: { [xe]: t },
|
|
3508
|
-
columnKey: xe,
|
|
3509
|
-
range: eo(),
|
|
3510
|
-
tablePart: "body"
|
|
3511
|
-
}), l = { ...s.rowStyle, ...s.cellStyle };
|
|
3512
|
-
return l.color || l.backgroundColor ? { ...l.color ? { color: l.color } : {}, ...l.backgroundColor ? { backgroundColor: l.backgroundColor } : {} } : ae;
|
|
3513
|
-
}
|
|
3514
|
-
function Ds(e, t) {
|
|
3515
|
-
const n = e.answers.relationshipIds;
|
|
3516
|
-
return !n || !t ? !n && !t : n.length === t.length && n.every((i, r) => t[r] === i);
|
|
3517
|
-
}
|
|
3518
|
-
const no = /* @__PURE__ */ new Set([
|
|
3519
|
-
"dataset_not_reachable",
|
|
3520
|
-
"field_not_resolvable",
|
|
3521
|
-
"missing_metadata",
|
|
3522
|
-
"unsupported_calculated_filter",
|
|
3523
|
-
"relationship_unsupported",
|
|
3524
|
-
"relationship_missing",
|
|
3525
|
-
"relationship_ambiguous"
|
|
3526
|
-
]);
|
|
3527
|
-
function V(e) {
|
|
3528
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
3529
|
-
}
|
|
3530
|
-
function io(e) {
|
|
3531
|
-
if (V(e))
|
|
3532
|
-
switch (e.status) {
|
|
3533
|
-
case "applied": {
|
|
3534
|
-
const t = Ut(e.route);
|
|
3535
|
-
return t ? { status: "applied", route: t } : void 0;
|
|
3536
|
-
}
|
|
3537
|
-
case "skipped":
|
|
3538
|
-
return typeof e.reason == "string" && no.has(e.reason) ? { status: "skipped", reason: e.reason } : void 0;
|
|
3539
|
-
case "needsPath":
|
|
3540
|
-
return { status: "needsPath" };
|
|
3541
|
-
case "blocked":
|
|
3542
|
-
return typeof e.message == "string" ? { status: "blocked", message: e.message } : void 0;
|
|
3543
|
-
case "kept":
|
|
3544
|
-
return { status: "kept" };
|
|
3545
|
-
case "notRelationship":
|
|
3546
|
-
return { status: "notRelationship" };
|
|
3547
|
-
default:
|
|
3548
|
-
return;
|
|
3549
|
-
}
|
|
3550
|
-
}
|
|
3551
|
-
function Cn(e) {
|
|
3552
|
-
if (e !== void 0)
|
|
3553
|
-
return Array.isArray(e) && e.length > 0 && e.every((t) => typeof t == "string" && t.length > 0) ? e : null;
|
|
3554
|
-
}
|
|
3555
|
-
function ro(e) {
|
|
3556
|
-
if (!V(e)) return;
|
|
3557
|
-
const t = Ut(e.route), n = e.target;
|
|
3558
|
-
if (!(!t || !V(n) || n.kind !== "relationship" || !V(n.field) || typeof n.field.name != "string" || !V(n.field.source) || n.field.source.kind !== "semantic" || !Cn(n.relationshipIds)))
|
|
3559
|
-
return { route: t, target: n };
|
|
3560
|
-
}
|
|
3561
|
-
function ws(e) {
|
|
3562
|
-
if (!V(e) || !Array.isArray(e.previews)) return { previews: [] };
|
|
3563
|
-
const t = [];
|
|
3564
|
-
for (const i of e.previews) {
|
|
3565
|
-
if (!V(i) || typeof i.cardId != "string" || !i.cardId || !V(i.answers)) continue;
|
|
3566
|
-
const r = Cn(i.answers.relationshipIds), a = io(i.outcome), o = Array.isArray(i.paths) ? i.paths.map(ro) : [];
|
|
3567
|
-
r === null || !a || !o.every(Boolean) || a.status === "needsPath" && o.length < 2 || t.push({
|
|
3568
|
-
cardId: i.cardId,
|
|
3569
|
-
answers: r ? { relationshipIds: r } : {},
|
|
3570
|
-
outcome: a,
|
|
3571
|
-
paths: o
|
|
3572
|
-
});
|
|
3573
|
-
}
|
|
3574
|
-
const n = V(e.manageRelationships) && typeof e.manageRelationships.href == "string" ? { href: e.manageRelationships.href } : void 0;
|
|
3575
|
-
return { previews: t, ...n ? { manageRelationships: n } : {} };
|
|
3576
|
-
}
|
|
3577
|
-
const se = (e) => (e == null ? void 0 : e.label) || (e == null ? void 0 : e.name) || "";
|
|
3578
|
-
function ao(e) {
|
|
3579
|
-
return !e || /s$/i.test(e) ? e : /[^aeiou]y$/i.test(e) ? `${e.slice(0, -1)}ies` : `${e}s`;
|
|
3580
|
-
}
|
|
3581
|
-
function Ts(e) {
|
|
3582
|
-
if (e.direction === "to_many") {
|
|
3583
|
-
const n = se(e.matchingDataset ?? e.datasets[e.datasets.length - 1]);
|
|
3584
|
-
return `${e.base ? ao(se(e.base)) : "Rows"} with at least one matching ${n}`;
|
|
3585
|
-
}
|
|
3586
|
-
return `through ${(e.datasets.length > 1 ? e.datasets.slice(0, -1) : e.datasets).map(se).join(", ")}`;
|
|
3587
|
-
}
|
|
3588
|
-
const Os = "The relationship this card used changed; choose it again";
|
|
3589
|
-
function Ms(e, t) {
|
|
3590
|
-
switch (e) {
|
|
3591
|
-
case "relationship_missing":
|
|
3592
|
-
return t ? `Not related to ${se(t)}` : "Not related to this card";
|
|
3593
|
-
case "relationship_ambiguous":
|
|
3594
|
-
return "Connects through more than one path";
|
|
3595
|
-
case "relationship_unsupported":
|
|
3596
|
-
return "Can't be applied to this card";
|
|
3597
|
-
case "dataset_not_reachable":
|
|
3598
|
-
case "field_not_resolvable":
|
|
3599
|
-
case "missing_metadata":
|
|
3600
|
-
case "unsupported_calculated_filter":
|
|
3601
|
-
return "No matching field on this card";
|
|
3602
|
-
default:
|
|
3603
|
-
return String(e);
|
|
3604
|
-
}
|
|
3605
|
-
}
|
|
3606
|
-
export {
|
|
3607
|
-
Zo as $,
|
|
3608
|
-
wt as A,
|
|
3609
|
-
Ge as B,
|
|
3610
|
-
Is as C,
|
|
3611
|
-
Do as D,
|
|
3612
|
-
xs as E,
|
|
3613
|
-
to as F,
|
|
3614
|
-
Ss as G,
|
|
3615
|
-
Ds as H,
|
|
3616
|
-
ws as I,
|
|
3617
|
-
ao as J,
|
|
3618
|
-
Ts as K,
|
|
3619
|
-
Ms as L,
|
|
3620
|
-
je as M,
|
|
3621
|
-
Zr as N,
|
|
3622
|
-
zr as O,
|
|
3623
|
-
cr as P,
|
|
3624
|
-
ur as Q,
|
|
3625
|
-
Os as R,
|
|
3626
|
-
pe as S,
|
|
3627
|
-
Ao as T,
|
|
3628
|
-
ts as U,
|
|
3629
|
-
Xo as V,
|
|
3630
|
-
H as W,
|
|
3631
|
-
Mo as X,
|
|
3632
|
-
ue as Y,
|
|
3633
|
-
na as Z,
|
|
3634
|
-
ia as _,
|
|
3635
|
-
rs as a,
|
|
3636
|
-
wa as a$,
|
|
3637
|
-
is as a0,
|
|
3638
|
-
sr as a1,
|
|
3639
|
-
ar as a2,
|
|
3640
|
-
or as a3,
|
|
3641
|
-
Ho as a4,
|
|
3642
|
-
Lo as a5,
|
|
3643
|
-
Tr as a6,
|
|
3644
|
-
Be as a7,
|
|
3645
|
-
_o as a8,
|
|
3646
|
-
zo as a9,
|
|
3647
|
-
Fs as aA,
|
|
3648
|
-
za as aB,
|
|
3649
|
-
Dt as aC,
|
|
3650
|
-
Cs as aD,
|
|
3651
|
-
ko as aE,
|
|
3652
|
-
Ur as aF,
|
|
3653
|
-
rr as aG,
|
|
3654
|
-
To as aH,
|
|
3655
|
-
jt as aI,
|
|
3656
|
-
dr as aJ,
|
|
3657
|
-
Ve as aK,
|
|
3658
|
-
No as aL,
|
|
3659
|
-
Ro as aM,
|
|
3660
|
-
de as aN,
|
|
3661
|
-
ne as aO,
|
|
3662
|
-
Oo as aP,
|
|
3663
|
-
qo as aQ,
|
|
3664
|
-
aa as aR,
|
|
3665
|
-
ms as aS,
|
|
3666
|
-
bn as aT,
|
|
3667
|
-
ls as aU,
|
|
3668
|
-
Pa as aV,
|
|
3669
|
-
ee as aW,
|
|
3670
|
-
Ue as aX,
|
|
3671
|
-
as as aY,
|
|
3672
|
-
cs as aZ,
|
|
3673
|
-
os as a_,
|
|
3674
|
-
jo as aa,
|
|
3675
|
-
Uo as ab,
|
|
3676
|
-
Ke as ac,
|
|
3677
|
-
Rr as ad,
|
|
3678
|
-
te as ae,
|
|
3679
|
-
$o as af,
|
|
3680
|
-
Go as ag,
|
|
3681
|
-
hr as ah,
|
|
3682
|
-
wr as ai,
|
|
3683
|
-
Kr as aj,
|
|
3684
|
-
Lr as ak,
|
|
3685
|
-
Wo as al,
|
|
3686
|
-
E as am,
|
|
3687
|
-
Oe as an,
|
|
3688
|
-
_r as ao,
|
|
3689
|
-
Ko as ap,
|
|
3690
|
-
Eo as aq,
|
|
3691
|
-
Vo as ar,
|
|
3692
|
-
Cr as as,
|
|
3693
|
-
Fr as at,
|
|
3694
|
-
Bo as au,
|
|
3695
|
-
rn as av,
|
|
3696
|
-
bs as aw,
|
|
3697
|
-
vn as ax,
|
|
3698
|
-
Wa as ay,
|
|
3699
|
-
vs as az,
|
|
3700
|
-
ns as b,
|
|
3701
|
-
Ea as b0,
|
|
3702
|
-
fs as b1,
|
|
3703
|
-
ds as b2,
|
|
3704
|
-
ss as b3,
|
|
3705
|
-
Ma as b4,
|
|
3706
|
-
es as b5,
|
|
3707
|
-
ea as b6,
|
|
3708
|
-
Nr as b7,
|
|
3709
|
-
ps as b8,
|
|
3710
|
-
It as b9,
|
|
3711
|
-
_a as ba,
|
|
3712
|
-
X as bb,
|
|
3713
|
-
Po as bc,
|
|
3714
|
-
Qo as c,
|
|
3715
|
-
ka as d,
|
|
3716
|
-
oa as e,
|
|
3717
|
-
sa as f,
|
|
3718
|
-
wo as g,
|
|
3719
|
-
tr as h,
|
|
3720
|
-
jr as i,
|
|
3721
|
-
Wr as j,
|
|
3722
|
-
Hr as k,
|
|
3723
|
-
Yo as l,
|
|
3724
|
-
Yr as m,
|
|
3725
|
-
Jr as n,
|
|
3726
|
-
Jo as o,
|
|
3727
|
-
Qr as p,
|
|
3728
|
-
Ka as q,
|
|
3729
|
-
us as r,
|
|
3730
|
-
La as s,
|
|
3731
|
-
Ba as t,
|
|
3732
|
-
gs as u,
|
|
3733
|
-
xt as v,
|
|
3734
|
-
ys as w,
|
|
3735
|
-
hs as x,
|
|
3736
|
-
Xa as y,
|
|
3737
|
-
Pe as z
|
|
3738
|
-
};
|