react-semaphor 0.1.544 → 0.1.546
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 +405 -441
- package/dist/assistant-context/index.js +1 -1
- package/dist/assistant-protocol/index.js +100 -76
- package/dist/brand-studio/index.js +5 -5
- package/dist/briefings/index.js +55 -52
- package/dist/chunks/{class-utils-Df1OVOT1.js → _commonjsHelpers-DimLPMtv.js} +124 -98
- package/dist/chunks/{add-to-dashboard-BuAqfA2Y.js → add-to-dashboard-BQRAAnc3.js} +55 -33
- package/dist/chunks/{analytics-base-schemas-BFAoRlkU.js → analytics-base-schemas-BKs3flFS.js} +2 -2
- package/dist/chunks/{assistant-chat-BNLkCDml.js → assistant-chat-BPXhulAx.js} +2792 -2562
- package/dist/chunks/{bookmark-state-CXw7lZ50.js → bookmark-state-C4vetoa0.js} +7 -8
- package/dist/chunks/column-catalog-BYnochWQ.js +3363 -0
- package/dist/chunks/comparison-window-caption-C2xF-eWw.js +1433 -0
- package/dist/chunks/{context-ClREvqCZ.js → context-BerEBuFR.js} +11 -6
- package/dist/chunks/custom-visual-inputs-CkJW9pBS.js +295 -0
- package/dist/chunks/{dashboard-g5a4DKWq.js → dashboard-C3CoKbGY.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-Be4h-7My.js +3734 -0
- package/dist/chunks/dashboard-controls-bxPrlSyp.js +2307 -0
- package/dist/chunks/{dashboard-json-7qT9jmfL.js → dashboard-json-BrjxIiRt.js} +6 -6
- package/dist/chunks/document-dashboard-inputs-CRVHpIHp.js +3010 -0
- package/dist/chunks/{edit-dashboard-visual-BfJwnRIZ.js → edit-dashboard-visual-DYYYDjY6.js} +5986 -6063
- package/dist/chunks/{filter-value-text-CYsVYPuD.js → filter-value-text-Ddf55Ku1.js} +8 -8
- package/dist/chunks/global-date-filter-utils-9d6m9-FE.js +11859 -0
- package/dist/chunks/index-CtoK1Lgu.js +586 -0
- package/dist/chunks/{index-DkAyQvC6.js → index-DkQkMKa1.js} +385 -339
- package/dist/chunks/list-filter-DsaTbM3J.js +15 -0
- package/dist/chunks/matrix-analytical-definition-B9vW-osb.js +717 -0
- package/dist/chunks/{matrix-card-DjwWcCo8.js → matrix-card-LiMEipvq.js} +3 -3
- package/dist/chunks/{matrix-formatter-CxJLkztA.js → matrix-formatter-DWEeC0_c.js} +55 -55
- package/dist/chunks/{matrix-member-presentation-CQGdVks6.js → matrix-member-presentation-DqzG-UhQ.js} +1 -1
- package/dist/chunks/{matrix-operation-contract-8OIO4gob.js → matrix-operation-contract-D6vYkZK4.js} +72 -72
- package/dist/chunks/{metric-comparison-DEwi9uc2.js → metric-comparison-zpGw4lD6.js} +2 -2
- package/dist/chunks/normalize-dashboard-for-dirty-check-XKgH3GFX.js +119 -0
- package/dist/chunks/{pivot-header-presentation-DHcx1XGQ.js → pivot-header-presentation-CQnIDtUv.js} +1 -1
- package/dist/chunks/{pivot-result-identity-DJhXXcns.js → pivot-result-identity-C-Q1j1Wb.js} +1 -1
- package/dist/chunks/{pivot-result-lifecycle-DM4CyGKs.js → pivot-result-lifecycle-pwq3b7LC.js} +571 -380
- package/dist/chunks/{raw-temporal-contract-C51YG48G.js → raw-temporal-contract-WuXA8jBP.js} +1 -1
- package/dist/chunks/{raw-temporal-presentation-CLiVi90c.js → raw-temporal-presentation-CBzrDOjM.js} +8 -8
- package/dist/chunks/rendered-file-D8xEuVVx.js +108 -0
- package/dist/chunks/{report-preferences-dialog-Df7VpRVW.js → report-preferences-dialog-4QEZWe5U.js} +637 -610
- package/dist/chunks/{report-runtime-context-Dq8XyODK.js → report-runtime-context-hWiTCzFV.js} +2 -2
- package/dist/chunks/resolve-dashboard-input-context-UpK_LBpL.js +5677 -0
- package/dist/chunks/{saved-dashboard-context-B-mQ--nV.js → saved-dashboard-context-D_I3Lxk0.js} +184 -212
- package/dist/chunks/selection-filter-compiler-BKXmyLrS.js +79 -0
- package/dist/chunks/{selection-reducer-Dj_8xD69.js → selection-reducer-CJzkTZio.js} +15 -15
- package/dist/chunks/{semaphor-ready-indicator-DDAxk8us.js → semaphor-ready-indicator-4zpRHE-X.js} +56832 -59068
- package/dist/chunks/{shelf-drop-preview-context-BSRPwaED.js → shelf-drop-preview-context-Cfw7TRAx.js} +890 -871
- package/dist/chunks/{source-entity-resolution-BYn9giz3.js → source-entity-resolution-BIGRvtbG.js} +13 -13
- package/dist/chunks/{switch-C3jLxlG0.js → switch-CEBOR4n7.js} +47 -48
- package/dist/chunks/{table-export-sheet-CPfGAQ9X.js → table-export-sheet-4X9mAG3V.js} +1 -1
- package/dist/chunks/table-settings-CunhoDUi.js +605 -0
- package/dist/chunks/{temporal-bucket-D7NBrrtL.js → temporal-bucket-CQOSbv9-.js} +26 -26
- package/dist/chunks/{token-types-DBbZVQsm.js → token-types-BMqRmT-C.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BxzFviM-.js → use-create-flow-overlay-state-DZBZiiD-.js} +83 -83
- package/dist/chunks/{validators-DMHTpf7a.js → validators-C-aOQlTB.js} +713 -658
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +1800 -1135
- package/dist/data-app-sdk/index.js +6 -6
- package/dist/data-app-sdk-adapters/index.js +3 -3
- package/dist/data-app-sdk-validation/index.js +14 -14
- package/dist/format-utils/index.js +198 -187
- package/dist/index.js +359 -325
- package/dist/layouts/index.js +5 -242
- package/dist/report-runtime-context/index.js +2 -2
- package/dist/shared/index.js +4 -5
- 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/briefings/attachments.d.ts +33 -6
- package/dist/types/briefings/index.d.ts +6 -5
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/surfboard/arrange-layout-button.d.ts +8 -0
- package/dist/types/components/surfboard/filter/types.d.ts +0 -14
- package/dist/types/components/surfboard/screen-size-preview-button.d.ts +7 -0
- package/dist/types/index.js +6 -6
- package/dist/types/lib/charts/table-chart-types.d.ts +4 -0
- package/dist/types/lib/charts/types.d.ts +2 -2
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-authoring.d.ts +68 -82
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +0 -8
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +41 -1
- package/dist/types/lib/dashboard-inputs/filter-settings.d.ts +201 -0
- package/dist/types/lib/dashboard-inputs/prepare-loaded-dashboard.d.ts +15 -0
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +7 -2
- package/dist/types/lib/dashboard-inputs/resolve-selection-input.d.ts +1 -1
- package/dist/types/lib/dashboard-viewer/captured-runtime-values.d.ts +40 -0
- package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +16 -16
- package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +11 -9
- package/dist/types/lib/download-pdf.d.ts +75 -1
- package/dist/types/lib/hooks/use-date-filter.d.ts +5 -0
- package/dist/types/lib/hooks/use-text-filter.d.ts +5 -0
- package/dist/types/lib/matrix-table/matrix-delivery-policy.d.ts +5 -4
- package/dist/types/lib/matrix-table/matrix-editor.d.ts +52 -0
- package/dist/types/lib/query-context/assemble-card-query.d.ts +158 -0
- package/dist/types/lib/query-context/build-card-query-context.d.ts +3 -3
- package/dist/types/lib/query-context/build-dashboard-card-query-contract.d.ts +15 -6
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +11 -13
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +22 -12
- package/dist/types/lib/query-context/dashboard-filter-mapping-resolution.d.ts +69 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +159 -56
- package/dist/types/lib/stores/editor-store.d.ts +0 -3
- package/dist/types/lib/types/common-types.d.ts +29 -6
- package/dist/types/lib/types/explorer-types.d.ts +10 -0
- package/dist/types/lib/types/semantic-types.d.ts +84 -0
- package/dist/types/lib/utils/build-saved-editor-card.d.ts +20 -0
- package/dist/types/lib/utils/card-type-change.d.ts +16 -0
- package/dist/types/lib/utils/field-availability-context.d.ts +25 -0
- package/dist/types/lib/utils/field-placement.d.ts +96 -0
- package/dist/types/lib/utils/field-state-calculator.d.ts +161 -0
- package/dist/types/lib/utils/qualified-entity-name.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/field-provenance.d.ts +89 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +2 -0
- package/dist/types/shared/analytics-protocol/query-policies.d.ts +52 -0
- package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/time-window.d.ts +40 -1
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +8 -12
- package/dist/types/shared/assistant-protocol/answer-text.d.ts +20 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +21 -21
- package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +6 -1
- package/dist/types/shared/assistant-protocol/parts.d.ts +43 -3
- package/dist/types/shared/assistant-protocol/request.d.ts +14 -2
- package/dist/types/shared/dashboard-authoring/calculated-field-identity.d.ts +3 -0
- package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +487 -0
- package/dist/types/shared/dashboard-authoring/changes/card-types.d.ts +34 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +7886 -0
- package/dist/types/shared/dashboard-authoring/changes/diagnostics.d.ts +43 -0
- package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +54 -0
- package/dist/types/shared/dashboard-authoring/changes/resolve-dashboard-changes.d.ts +89 -0
- package/dist/types/shared/dashboard-authoring/column-catalog.d.ts +32 -0
- package/dist/types/shared/dashboard-authoring/contracts.d.ts +0 -55
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +16 -6
- package/dist/types/shared/dashboard-authoring/dashboard-card-source-index.d.ts +9 -1
- package/dist/types/shared/dashboard-authoring/dashboard-filter-mapping-contract.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/dashboard-input-scope.d.ts +118 -0
- package/dist/types/shared/dashboard-authoring/filter-applicability.d.ts +75 -0
- package/dist/types/shared/dashboard-authoring/filter-model/ad-hoc-filter-values.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/filter-model/filter-definitions.d.ts +29 -0
- package/dist/types/shared/dashboard-authoring/filter-model/filter-values.d.ts +58 -0
- package/dist/types/shared/dashboard-authoring/filter-model/index.d.ts +7 -0
- package/dist/types/shared/dashboard-authoring/filter-model/prototype-document-inputs.d.ts +15 -0
- package/dist/types/shared/dashboard-authoring/filter-model/read-dashboard-filter-model.d.ts +78 -0
- package/dist/types/shared/dashboard-authoring/filter-model/stored-dashboard.d.ts +18 -0
- package/dist/types/shared/dashboard-authoring/filter-model/toolbar-filter-reach.d.ts +23 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +20 -2
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +10 -37
- package/dist/types/shared/dashboard-authoring/operations/operation-types.d.ts +189 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +94 -0
- package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +78 -0
- package/dist/types/shared/dashboard-authoring/validators.d.ts +1 -2
- package/dist/types/shared/format-utils/exporters/index.d.ts +2 -0
- package/dist/types/shared/format-utils/exporters/rendered-file.d.ts +106 -0
- package/dist/types/shared/layouts/engine/grid.d.ts +25 -0
- package/dist/types/shared/layouts/engine/index.d.ts +4 -0
- package/dist/types/shared/layouts/engine/sheet-layout.d.ts +7 -0
- package/dist/types/shared/layouts/engine/types.d.ts +125 -0
- package/dist/types/shared/layouts/index.d.ts +1 -2
- package/package.json +2 -2
- package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +0 -28
- package/dist/chunks/apply-dashboard-operations-Bz4n1Lq6.js +0 -2260
- package/dist/chunks/calendar-day-equality-BmJAWduY.js +0 -460
- package/dist/chunks/comparison-window-caption-BTkrN3W4.js +0 -1623
- package/dist/chunks/custom-visual-inputs-DUtpYZOk.js +0 -323
- package/dist/chunks/dashboard-briefing-launcher-DQ_8O_e2.js +0 -3725
- package/dist/chunks/dashboard-controls-8RyBTQUO.js +0 -2315
- package/dist/chunks/dashboard-filter-value-compatibility-CwQ_iSNb.js +0 -108
- package/dist/chunks/document-dashboard-inputs-BC6p-ESg.js +0 -8087
- package/dist/chunks/document-sheet-utils-Duo9uLoH.js +0 -3619
- package/dist/chunks/matrix-analytical-definition-C7Gb0e12.js +0 -117
- package/dist/chunks/normalize-dashboard-for-dirty-check-Bk3VYv_q.js +0 -67
- package/dist/chunks/numeric-presentation-DESvLiu9.js +0 -5227
- package/dist/chunks/sort-target-MT1WK1vX.js +0 -29
- package/dist/chunks/stable-serialize-CfqXeiBP.js +0 -6
- package/dist/chunks/table-settings-CLZocegs.js +0 -501
- package/dist/chunks/use-debounced-dirty-check-BwAbnX_5.js +0 -59
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +0 -88
- package/dist/types/lib/dashboard-inputs/dashboard-input-scope.d.ts +0 -10
- package/dist/types/shared/dashboard-authoring/change-compiler.d.ts +0 -7
- package/dist/types/shared/dashboard-authoring/layout-compiler.d.ts +0 -2
- package/dist/types/shared/layouts/create-frame-layouts.d.ts +0 -27
- package/dist/types/shared/layouts/frame-layouts.d.ts +0 -23
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import { k as R, ab as B } from "./validators-C-aOQlTB.js";
|
|
2
|
+
import "./matrix-operation-contract-D6vYkZK4.js";
|
|
3
|
+
import "./analytics-base-schemas-BKs3flFS.js";
|
|
4
|
+
import { z as c } from "zod";
|
|
5
|
+
const v = 8, T = 6, g = Object.freeze([]);
|
|
6
|
+
function P(e) {
|
|
7
|
+
switch (e.type) {
|
|
8
|
+
case "table":
|
|
9
|
+
case "chart":
|
|
10
|
+
return e.card ? [e.card] : g;
|
|
11
|
+
case "kpi":
|
|
12
|
+
return Array.isArray(e.cards) ? e.cards : g;
|
|
13
|
+
default:
|
|
14
|
+
return g;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function ce(e, t) {
|
|
18
|
+
switch (e.type) {
|
|
19
|
+
case "table":
|
|
20
|
+
case "chart": {
|
|
21
|
+
if (!e.card) return e;
|
|
22
|
+
const n = t(e.card);
|
|
23
|
+
return n === e.card ? e : { ...e, card: n };
|
|
24
|
+
}
|
|
25
|
+
case "kpi": {
|
|
26
|
+
if (!Array.isArray(e.cards)) return e;
|
|
27
|
+
const n = e.cards.map(t);
|
|
28
|
+
return n.every((r, a) => r === e.cards[a]) ? e : { ...e, cards: n };
|
|
29
|
+
}
|
|
30
|
+
default:
|
|
31
|
+
return e;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function O(e) {
|
|
35
|
+
var n;
|
|
36
|
+
const t = [];
|
|
37
|
+
for (const r of e.sheets || []) {
|
|
38
|
+
const a = r.id;
|
|
39
|
+
for (const i of r.cards || [])
|
|
40
|
+
t.push({ kind: "sheetCard", sheetId: a, cardId: i.id, card: i });
|
|
41
|
+
for (const i of r.frames || [])
|
|
42
|
+
for (const s of i.cards || [])
|
|
43
|
+
t.push({
|
|
44
|
+
kind: "frameCard",
|
|
45
|
+
sheetId: a,
|
|
46
|
+
frameId: i.id,
|
|
47
|
+
cardId: s.id,
|
|
48
|
+
card: s
|
|
49
|
+
});
|
|
50
|
+
for (const i of ((n = r.document) == null ? void 0 : n.sections) || [])
|
|
51
|
+
for (const s of P(i))
|
|
52
|
+
t.push({
|
|
53
|
+
kind: "documentSectionCard",
|
|
54
|
+
sheetId: a,
|
|
55
|
+
sectionId: i.id,
|
|
56
|
+
cardId: s.id,
|
|
57
|
+
card: s
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return t;
|
|
61
|
+
}
|
|
62
|
+
function S(e) {
|
|
63
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
64
|
+
}
|
|
65
|
+
function de(e) {
|
|
66
|
+
if (!S(e))
|
|
67
|
+
return [{ path: "", message: "must be an object." }];
|
|
68
|
+
const t = [];
|
|
69
|
+
e.title !== void 0 && typeof e.title != "string" && t.push({ path: "title", message: "must be a string." });
|
|
70
|
+
const n = e.cards;
|
|
71
|
+
if (!Array.isArray(n))
|
|
72
|
+
t.push({ path: "cards", message: "must be an array of KPI cards." });
|
|
73
|
+
else {
|
|
74
|
+
(n.length < 1 || n.length > v) && t.push({
|
|
75
|
+
path: "cards",
|
|
76
|
+
message: `must hold 1 to ${v} KPI cards.`
|
|
77
|
+
});
|
|
78
|
+
const a = /* @__PURE__ */ new Set();
|
|
79
|
+
n.forEach((i, s) => {
|
|
80
|
+
if (!S(i)) {
|
|
81
|
+
t.push({ path: `cards[${s}]`, message: "must be a card." });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
typeof i.id != "string" || !i.id ? t.push({
|
|
85
|
+
path: `cards[${s}].id`,
|
|
86
|
+
message: "must be a non-empty string."
|
|
87
|
+
}) : a.has(i.id) ? t.push({
|
|
88
|
+
path: `cards[${s}].id`,
|
|
89
|
+
message: `duplicates card id '${i.id}'.`
|
|
90
|
+
}) : a.add(i.id), i.type !== "kpi" && t.push({ path: `cards[${s}].type`, message: "must be 'kpi'." });
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const r = e.kpi;
|
|
94
|
+
return S(r) ? (r.layout !== "tiles" && r.layout !== "lines" ? t.push({
|
|
95
|
+
path: "kpi.layout",
|
|
96
|
+
message: "must be 'tiles' or 'lines'."
|
|
97
|
+
}) : r.layout === "tiles" && Array.isArray(n) && n.length > T && t.push({
|
|
98
|
+
path: "kpi.layout",
|
|
99
|
+
message: `must be 'lines' for more than ${T} KPI cards.`
|
|
100
|
+
}), r.columns !== void 0 && r.columns !== 1 && r.columns !== 2 && t.push({ path: "kpi.columns", message: "must be 1 or 2." })) : t.push({ path: "kpi", message: "must be an object." }), t;
|
|
101
|
+
}
|
|
102
|
+
const j = ["new", "edit", "delete", "create", "update", "remove"];
|
|
103
|
+
function $(e, t) {
|
|
104
|
+
return (e.sheets || []).flatMap(
|
|
105
|
+
(n) => O({ sheets: [n] }).filter(t).map((r) => ({
|
|
106
|
+
card: r.card,
|
|
107
|
+
sheet: n,
|
|
108
|
+
...r.kind === "frameCard" && { frameId: r.frameId },
|
|
109
|
+
...r.kind === "documentSectionCard" && {
|
|
110
|
+
sectionId: r.sectionId
|
|
111
|
+
}
|
|
112
|
+
}))
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
function m(e) {
|
|
116
|
+
return $(e, (t) => t.kind !== "documentSectionCard");
|
|
117
|
+
}
|
|
118
|
+
function fe(e) {
|
|
119
|
+
return [
|
|
120
|
+
...m(e),
|
|
121
|
+
...$(e, (t) => t.kind === "documentSectionCard")
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
function me(e) {
|
|
125
|
+
return m(e).map((t) => t.card);
|
|
126
|
+
}
|
|
127
|
+
function pe(e, t, n) {
|
|
128
|
+
return n && t === n ? !0 : !O(e).some(
|
|
129
|
+
(r) => r.cardId === t
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
function ye(e) {
|
|
133
|
+
return !e || e.trim().length === 0 ? { isValid: !1, error: "Card ID cannot be empty" } : e.length < 3 ? { isValid: !1, error: "Card ID must be at least 3 characters" } : e.length > 50 ? { isValid: !1, error: "Card ID must be less than 50 characters" } : /^[a-zA-Z0-9-_]+$/.test(e) ? /^[a-zA-Z0-9]/.test(e) ? j.includes(e.toLowerCase()) ? {
|
|
134
|
+
isValid: !1,
|
|
135
|
+
error: `"${e}" is a reserved keyword and cannot be used`
|
|
136
|
+
} : { isValid: !0 } : {
|
|
137
|
+
isValid: !1,
|
|
138
|
+
error: "Card ID must start with a letter or number"
|
|
139
|
+
} : {
|
|
140
|
+
isValid: !1,
|
|
141
|
+
error: "Card ID can only contain letters, numbers, hyphens, and underscores"
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function he(e, t) {
|
|
145
|
+
var n;
|
|
146
|
+
return (n = z(e, t)) == null ? void 0 : n.card;
|
|
147
|
+
}
|
|
148
|
+
function z(e, t) {
|
|
149
|
+
for (const n of m(e))
|
|
150
|
+
if (n.card.id === t)
|
|
151
|
+
return n;
|
|
152
|
+
}
|
|
153
|
+
function be(e, t) {
|
|
154
|
+
for (const n of e.sheets || [])
|
|
155
|
+
for (const r of n.frames || [])
|
|
156
|
+
for (const a of r.cards || [])
|
|
157
|
+
if (a.id === t)
|
|
158
|
+
return { card: a, sheet: n };
|
|
159
|
+
}
|
|
160
|
+
const h = {
|
|
161
|
+
includeMetricFilterDatasets: !0,
|
|
162
|
+
preferQualifiedIdentity: !1
|
|
163
|
+
};
|
|
164
|
+
function M(e) {
|
|
165
|
+
if (!e) return;
|
|
166
|
+
if (e.kind === "semantic")
|
|
167
|
+
return { entityName: e.datasetName, entityId: e.datasetId, label: e.label };
|
|
168
|
+
const t = [e.databaseName, e.schemaName, e.tableName].filter((n) => !!(n && n.trim())).join(".");
|
|
169
|
+
return {
|
|
170
|
+
entityName: e.tableName,
|
|
171
|
+
qualifiedEntityName: t.includes(".") ? t : void 0,
|
|
172
|
+
label: e.label
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function K(e) {
|
|
176
|
+
var n;
|
|
177
|
+
const t = M(e.source);
|
|
178
|
+
return t ? `${(n = e.source) == null ? void 0 : n.kind}:${t.qualifiedEntityName || t.entityName}` : "";
|
|
179
|
+
}
|
|
180
|
+
function U(e) {
|
|
181
|
+
return [
|
|
182
|
+
e.id,
|
|
183
|
+
e.qualifiedEntityName,
|
|
184
|
+
e.entityId,
|
|
185
|
+
e.entityName,
|
|
186
|
+
e.qualifiedFieldName,
|
|
187
|
+
e.name,
|
|
188
|
+
// Source-only fields from different datasets can otherwise share a key
|
|
189
|
+
// and the second dataset would be silently dropped.
|
|
190
|
+
K(e)
|
|
191
|
+
].join("|");
|
|
192
|
+
}
|
|
193
|
+
function Q(e) {
|
|
194
|
+
return [e.entityName, e.qualifiedEntityName || "", e.entityId || ""].join("|");
|
|
195
|
+
}
|
|
196
|
+
function ge(e) {
|
|
197
|
+
return e.entityName || e.qualifiedEntityName || "";
|
|
198
|
+
}
|
|
199
|
+
function G(e) {
|
|
200
|
+
var t, n;
|
|
201
|
+
return !!(e.expression || e.derivedField || (n = (t = e.calculatedFormula) == null ? void 0 : t.inputFields) != null && n.length);
|
|
202
|
+
}
|
|
203
|
+
function Y(e) {
|
|
204
|
+
return R(e) ? !0 : e.entityName || e.qualifiedEntityName ? !1 : !e.source || G(e);
|
|
205
|
+
}
|
|
206
|
+
function I(e, t) {
|
|
207
|
+
const n = Q(t);
|
|
208
|
+
e.found.has(n) || e.found.set(n, t);
|
|
209
|
+
}
|
|
210
|
+
function p(e, t) {
|
|
211
|
+
var d, w, D;
|
|
212
|
+
if (!e) return;
|
|
213
|
+
const n = U(e);
|
|
214
|
+
if (t.visitedFields.has(n)) return;
|
|
215
|
+
t.visitedFields.add(n);
|
|
216
|
+
const r = Y(e);
|
|
217
|
+
if (!r) {
|
|
218
|
+
const f = !e.entityName && !e.qualifiedEntityName ? M(e.source) : void 0;
|
|
219
|
+
I(
|
|
220
|
+
t,
|
|
221
|
+
f || {
|
|
222
|
+
// May be empty for qualified-only metadata; identity then comes from
|
|
223
|
+
// `qualifiedEntityName` (see `identityFor` and the calculator).
|
|
224
|
+
entityName: e.entityName || "",
|
|
225
|
+
entityId: e.entityId,
|
|
226
|
+
qualifiedEntityName: e.qualifiedEntityName,
|
|
227
|
+
label: e.source && e.source.kind === "semantic" ? e.source.label : void 0
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
t.includeMetricFilterDatasets && "parameters" in e && ((d = e.parameters) != null && d.filters) && E(e.parameters.filters, t);
|
|
232
|
+
const a = (w = e.calculatedFormula) == null ? void 0 : w.inputFields, i = !!(a && a.length > 0);
|
|
233
|
+
i && a.forEach((f) => p(f, t));
|
|
234
|
+
let s = !1, o = !1;
|
|
235
|
+
const u = i || (D = e.derivedField) == null ? void 0 : D.inputs;
|
|
236
|
+
if (u && Object.keys(u).length > 0)
|
|
237
|
+
for (const f of Object.values(u)) {
|
|
238
|
+
const l = f.field.source;
|
|
239
|
+
if (!l) {
|
|
240
|
+
i || (o = !0);
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
if (l.kind === "sql") {
|
|
244
|
+
o = !0;
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
if (l.kind === "semantic")
|
|
248
|
+
I(t, {
|
|
249
|
+
entityName: l.datasetName,
|
|
250
|
+
entityId: l.datasetId,
|
|
251
|
+
label: l.label
|
|
252
|
+
});
|
|
253
|
+
else {
|
|
254
|
+
const k = [l.databaseName, l.schemaName, l.tableName].filter((F) => !!(F && F.trim())).join(".");
|
|
255
|
+
I(t, {
|
|
256
|
+
entityName: l.tableName,
|
|
257
|
+
qualifiedEntityName: k.includes(".") ? k : void 0,
|
|
258
|
+
label: l.label
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
s = !0;
|
|
262
|
+
}
|
|
263
|
+
o && (t.complete = !1), r && !i && !s && (t.complete = !1);
|
|
264
|
+
}
|
|
265
|
+
function E(e, t) {
|
|
266
|
+
if (e && !t.visitedGroups.has(e.id)) {
|
|
267
|
+
t.visitedGroups.add(e.id);
|
|
268
|
+
for (const n of e.conditions || [])
|
|
269
|
+
p(n.field, t);
|
|
270
|
+
for (const n of e.groups || [])
|
|
271
|
+
E(n, t);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function b(e, t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set()) {
|
|
275
|
+
return {
|
|
276
|
+
found: /* @__PURE__ */ new Map(),
|
|
277
|
+
complete: !0,
|
|
278
|
+
visitedFields: t,
|
|
279
|
+
visitedGroups: n,
|
|
280
|
+
includeMetricFilterDatasets: e
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function N(e, t) {
|
|
284
|
+
var r;
|
|
285
|
+
const n = (r = e.qualifiedEntityName) != null && r.includes(".") ? e.qualifiedEntityName : void 0;
|
|
286
|
+
return t === "qualifiedOnly" ? n : t === "preferQualified" ? n || e.entityName || void 0 : e.entityName || void 0;
|
|
287
|
+
}
|
|
288
|
+
function Se(e) {
|
|
289
|
+
const t = b(!1);
|
|
290
|
+
return p(e, t), { datasets: Array.from(t.found.values()), complete: t.complete };
|
|
291
|
+
}
|
|
292
|
+
function V(e, t, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = h) {
|
|
293
|
+
const i = { ...h, ...a }, s = b(i.includeMetricFilterDatasets, n, r);
|
|
294
|
+
p(e, s), s.found.forEach((o) => {
|
|
295
|
+
const u = N(o, i.preferQualifiedIdentity ? "preferQualified" : "name");
|
|
296
|
+
u && t.add(u);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
function Ie(e, t) {
|
|
300
|
+
V(e, t, /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), {
|
|
301
|
+
preferQualifiedIdentity: !0
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
function Ce(e, t, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set()) {
|
|
305
|
+
const a = b(!0, n, r);
|
|
306
|
+
p(e, a), a.found.forEach((i) => {
|
|
307
|
+
const s = N(i, "qualifiedOnly");
|
|
308
|
+
s && t.add(s);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function Ee(e, t, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set()) {
|
|
312
|
+
V(e, t, n, r, {
|
|
313
|
+
includeMetricFilterDatasets: !1
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function Ne(e, t, n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = h) {
|
|
317
|
+
const i = { ...h, ...a }, s = b(i.includeMetricFilterDatasets, n, r);
|
|
318
|
+
E(e, s), s.found.forEach((o) => {
|
|
319
|
+
const u = N(o, i.preferQualifiedIdentity ? "preferQualified" : "name");
|
|
320
|
+
u && t.add(u);
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function we(e, t) {
|
|
324
|
+
return t != null && t[e] ? t[e] : (e.includes(".") ? e.slice(e.lastIndexOf(".") + 1) : e).replace(/[_-]+/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\s+/g, " ").trim().replace(/\b\w/g, (r) => r.toUpperCase());
|
|
325
|
+
}
|
|
326
|
+
const W = {
|
|
327
|
+
date: /* @__PURE__ */ new Set([
|
|
328
|
+
"between",
|
|
329
|
+
"not between",
|
|
330
|
+
"=",
|
|
331
|
+
"!=",
|
|
332
|
+
">",
|
|
333
|
+
">=",
|
|
334
|
+
"<",
|
|
335
|
+
"<=",
|
|
336
|
+
"is null",
|
|
337
|
+
"is not null"
|
|
338
|
+
]),
|
|
339
|
+
number: /* @__PURE__ */ new Set([
|
|
340
|
+
"between",
|
|
341
|
+
"not between",
|
|
342
|
+
"=",
|
|
343
|
+
"!=",
|
|
344
|
+
">",
|
|
345
|
+
">=",
|
|
346
|
+
"<",
|
|
347
|
+
"<=",
|
|
348
|
+
"in",
|
|
349
|
+
"not in",
|
|
350
|
+
"is null",
|
|
351
|
+
"is not null"
|
|
352
|
+
]),
|
|
353
|
+
string: /* @__PURE__ */ new Set([
|
|
354
|
+
"=",
|
|
355
|
+
"!=",
|
|
356
|
+
"in",
|
|
357
|
+
"not in",
|
|
358
|
+
"like",
|
|
359
|
+
"not like",
|
|
360
|
+
"is null",
|
|
361
|
+
"is not null"
|
|
362
|
+
]),
|
|
363
|
+
boolean: /* @__PURE__ */ new Set(["=", "!=", "in", "not in", "is null", "is not null"])
|
|
364
|
+
};
|
|
365
|
+
function J(e) {
|
|
366
|
+
const t = B(e);
|
|
367
|
+
return t === "number" || t === "boolean" ? t : t === "date" || t === "datetime" ? "date" : "string";
|
|
368
|
+
}
|
|
369
|
+
function De(e, t) {
|
|
370
|
+
return typeof t != "string" ? !1 : W[J(e)].has(t);
|
|
371
|
+
}
|
|
372
|
+
const ke = /* @__PURE__ */ new Set([
|
|
373
|
+
"=",
|
|
374
|
+
">",
|
|
375
|
+
"<",
|
|
376
|
+
">=",
|
|
377
|
+
"<=",
|
|
378
|
+
"!=",
|
|
379
|
+
"in",
|
|
380
|
+
"not in",
|
|
381
|
+
"like",
|
|
382
|
+
"not like",
|
|
383
|
+
"between",
|
|
384
|
+
"not between",
|
|
385
|
+
"is null",
|
|
386
|
+
"is not null"
|
|
387
|
+
]);
|
|
388
|
+
function Z(e, t) {
|
|
389
|
+
return t === "number" ? typeof e == "number" && Number.isFinite(e) : t === "boolean" ? typeof e == "boolean" : t === "date" ? e instanceof Date || typeof e == "string" && e.trim().length > 0 : typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
390
|
+
}
|
|
391
|
+
function Fe(e, t, n, r, a) {
|
|
392
|
+
if (e === "is null" || e === "is not null") {
|
|
393
|
+
t.length !== 0 && a.push(`${r} must be empty for null filter operations.`);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (e === "between" || e === "not between") {
|
|
397
|
+
if (t.length !== 2) {
|
|
398
|
+
a.push(
|
|
399
|
+
`${r} must contain exactly two values for between operations.`
|
|
400
|
+
);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
} else if (e === "in" || e === "not in") {
|
|
404
|
+
if (t.length === 0) {
|
|
405
|
+
a.push(
|
|
406
|
+
`${r} must contain at least one value for set operations.`
|
|
407
|
+
);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
} else if (t.length !== 1) {
|
|
411
|
+
a.push(
|
|
412
|
+
`${r} must contain exactly one value for '${String(e)}' operations.`
|
|
413
|
+
);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
for (const i of t)
|
|
417
|
+
if (!Z(i, n)) {
|
|
418
|
+
a.push(
|
|
419
|
+
`${r} contains a value that is incompatible with valueType '${n}'.`
|
|
420
|
+
);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
const ve = {
|
|
425
|
+
database: null,
|
|
426
|
+
schema: null,
|
|
427
|
+
table: null
|
|
428
|
+
}, Te = "__card_default__", L = {
|
|
429
|
+
bookmarksPerViewerPerDashboard: 20,
|
|
430
|
+
bookmarkNameMaxChars: 100,
|
|
431
|
+
columnLabelMaxChars: 120,
|
|
432
|
+
tableSettingsMaxBytes: 65536,
|
|
433
|
+
rememberedTableSettingsMaxBytes: 262144,
|
|
434
|
+
bookmarkStateMaxBytes: 65536
|
|
435
|
+
}, H = 1;
|
|
436
|
+
function Ae(e) {
|
|
437
|
+
return new TextEncoder().encode(JSON.stringify(e ?? null)).length;
|
|
438
|
+
}
|
|
439
|
+
function X(e) {
|
|
440
|
+
const t = encodeURIComponent;
|
|
441
|
+
switch (e.kind) {
|
|
442
|
+
case "dimension":
|
|
443
|
+
return `dim:${e.role}:${t(e.fieldId)}`;
|
|
444
|
+
case "metric":
|
|
445
|
+
return `metric:${t(e.metricId)}:${t(
|
|
446
|
+
e.metricAlias
|
|
447
|
+
)}`;
|
|
448
|
+
case "result":
|
|
449
|
+
return `result:${t(e.key)}`;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
function y(e) {
|
|
453
|
+
if (e)
|
|
454
|
+
try {
|
|
455
|
+
return decodeURIComponent(e);
|
|
456
|
+
} catch {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
function ee(e) {
|
|
461
|
+
if (typeof e != "string") return;
|
|
462
|
+
const t = e.split(":");
|
|
463
|
+
let n;
|
|
464
|
+
if (t[0] === "dim" && t.length === 3) {
|
|
465
|
+
const r = t[1], a = y(t[2]);
|
|
466
|
+
(r === "detail" || r === "groupby") && a && (n = { kind: "dimension", role: r, fieldId: a });
|
|
467
|
+
} else if (t[0] === "metric" && t.length === 3) {
|
|
468
|
+
const r = y(t[1]), a = y(t[2]);
|
|
469
|
+
r && a && (n = { kind: "metric", metricId: r, metricAlias: a });
|
|
470
|
+
} else if (t[0] === "result" && t.length === 2) {
|
|
471
|
+
const r = y(t[1]);
|
|
472
|
+
r && (n = { kind: "result", key: r });
|
|
473
|
+
}
|
|
474
|
+
return n && X(n) === e ? n : void 0;
|
|
475
|
+
}
|
|
476
|
+
function C(e) {
|
|
477
|
+
return typeof e == "string" && ee(e) !== void 0;
|
|
478
|
+
}
|
|
479
|
+
const A = c.array(c.string()).max(2e3), te = c.object({
|
|
480
|
+
order: A.optional(),
|
|
481
|
+
hidden: A.optional(),
|
|
482
|
+
labels: c.record(c.string(), c.string().max(L.columnLabelMaxChars)).optional(),
|
|
483
|
+
sort: c.array(
|
|
484
|
+
c.object({
|
|
485
|
+
columnId: c.string(),
|
|
486
|
+
direction: c.enum(["asc", "desc"])
|
|
487
|
+
}).strict()
|
|
488
|
+
).max(2e3).optional()
|
|
489
|
+
}).strict();
|
|
490
|
+
function _(e) {
|
|
491
|
+
const t = /* @__PURE__ */ new Set(), n = [];
|
|
492
|
+
for (const r of e)
|
|
493
|
+
!C(r) || t.has(r) || (t.add(r), n.push(r));
|
|
494
|
+
return n;
|
|
495
|
+
}
|
|
496
|
+
function q(e) {
|
|
497
|
+
if (!e) return;
|
|
498
|
+
const t = e.order ? _(e.order) : void 0, n = e.hidden ? _(e.hidden) : void 0, r = Object.entries(e.labels ?? {}).flatMap(
|
|
499
|
+
([o, u]) => {
|
|
500
|
+
const d = typeof u == "string" ? u.trim() : "";
|
|
501
|
+
return C(o) && d ? [
|
|
502
|
+
[
|
|
503
|
+
o,
|
|
504
|
+
d.slice(0, L.columnLabelMaxChars)
|
|
505
|
+
]
|
|
506
|
+
] : [];
|
|
507
|
+
}
|
|
508
|
+
), a = /* @__PURE__ */ new Set(), i = e.sort ? e.sort.filter((o) => !C(o.columnId) || a.has(o.columnId) ? !1 : (a.add(o.columnId), !0)) : void 0, s = {};
|
|
509
|
+
return t != null && t.length && (s.order = t), n != null && n.length && (s.hidden = n), r.length && (s.labels = Object.fromEntries(r)), i && (s.sort = i.map(({ columnId: o, direction: u }) => ({
|
|
510
|
+
columnId: o,
|
|
511
|
+
direction: u
|
|
512
|
+
}))), Object.keys(s).length ? s : void 0;
|
|
513
|
+
}
|
|
514
|
+
function ne(e) {
|
|
515
|
+
return q(e) === void 0;
|
|
516
|
+
}
|
|
517
|
+
function re(e, t) {
|
|
518
|
+
if (t !== H)
|
|
519
|
+
return {
|
|
520
|
+
ok: !1,
|
|
521
|
+
error: `Unsupported table settings version ${t}.`
|
|
522
|
+
};
|
|
523
|
+
const n = te.safeParse(e);
|
|
524
|
+
return n.success ? {
|
|
525
|
+
ok: !0,
|
|
526
|
+
value: q(n.data) ?? {}
|
|
527
|
+
} : { ok: !1, error: "Table settings are invalid." };
|
|
528
|
+
}
|
|
529
|
+
function _e(e, t, n) {
|
|
530
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return {};
|
|
531
|
+
const r = {};
|
|
532
|
+
for (const [a, i] of Object.entries(
|
|
533
|
+
e
|
|
534
|
+
)) {
|
|
535
|
+
if (!n.has(a)) continue;
|
|
536
|
+
const s = re(i, t);
|
|
537
|
+
s.ok && !ne(s.value) && (r[a] = s.value);
|
|
538
|
+
}
|
|
539
|
+
return r;
|
|
540
|
+
}
|
|
541
|
+
const ae = /* @__PURE__ */ new Set([
|
|
542
|
+
"table",
|
|
543
|
+
"detailTable"
|
|
544
|
+
]);
|
|
545
|
+
function x(e) {
|
|
546
|
+
return ae.has(e.type);
|
|
547
|
+
}
|
|
548
|
+
function ie(e) {
|
|
549
|
+
var t, n;
|
|
550
|
+
return x(e) && ((n = (t = e.preferences) == null ? void 0 : t.tablePrefs) == null ? void 0 : n.allowViewerColumnCustomization) !== !1;
|
|
551
|
+
}
|
|
552
|
+
function Oe(e) {
|
|
553
|
+
return new Set(
|
|
554
|
+
m(e).filter(({ card: t }) => x(t)).map(({ card: t }) => t.id)
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
function $e(e) {
|
|
558
|
+
return new Set(
|
|
559
|
+
m(e).filter(({ card: t }) => ie(t)).map(({ card: t }) => t.id)
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
export {
|
|
563
|
+
ce as A,
|
|
564
|
+
de as B,
|
|
565
|
+
Te as C,
|
|
566
|
+
ke as D,
|
|
567
|
+
ve as E,
|
|
568
|
+
J as F,
|
|
569
|
+
De as G,
|
|
570
|
+
z as H,
|
|
571
|
+
me as I,
|
|
572
|
+
m as J,
|
|
573
|
+
he as K,
|
|
574
|
+
fe as L,
|
|
575
|
+
pe as M,
|
|
576
|
+
ye as N,
|
|
577
|
+
be as O,
|
|
578
|
+
L as V,
|
|
579
|
+
ge as a,
|
|
580
|
+
Ie as b,
|
|
581
|
+
V as c,
|
|
582
|
+
M as d,
|
|
583
|
+
Ce as e,
|
|
584
|
+
Ee as f,
|
|
585
|
+
Ne as g,
|
|
586
|
+
we as h,
|
|
587
|
+
H as i,
|
|
588
|
+
ne as j,
|
|
589
|
+
re as k,
|
|
590
|
+
_e as l,
|
|
591
|
+
Ae as m,
|
|
592
|
+
q as n,
|
|
593
|
+
x as o,
|
|
594
|
+
ee as p,
|
|
595
|
+
ie as q,
|
|
596
|
+
Se as r,
|
|
597
|
+
Oe as s,
|
|
598
|
+
X as t,
|
|
599
|
+
$e as u,
|
|
600
|
+
Fe as v,
|
|
601
|
+
O as w,
|
|
602
|
+
v as x,
|
|
603
|
+
T as y,
|
|
604
|
+
P as z
|
|
605
|
+
};
|