react-semaphor 0.1.536 → 0.1.538
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 +352 -341
- package/dist/assistant-context/index.js +10 -0
- package/dist/assistant-protocol/index.js +104 -0
- package/dist/brand-studio/index.js +35 -31
- package/dist/briefings/index.js +46 -45
- package/dist/chunks/_commonjsHelpers-BkfeUUK-.js +28 -0
- package/dist/chunks/add-to-dashboard-CxtTfISD.js +56 -0
- package/dist/chunks/aggregate-table-row-presentation-Qgpv6_G8.js +979 -0
- package/dist/chunks/analytics-base-schemas-BFAoRlkU.js +472 -0
- package/dist/chunks/apply-dashboard-operations-C-iahGka.js +402 -0
- package/dist/chunks/assistant-chat-BAqUIFp5.js +7966 -0
- package/dist/chunks/availability-Bp5Gfu1I.js +44 -0
- package/dist/chunks/{bookmark-state-B-I9BDD0.js → bookmark-state-k7y5SNGf.js} +9 -9
- package/dist/chunks/{braces-8TRlDwDw.js → braces-o9UiRQes.js} +1 -1
- package/dist/chunks/calculated-field-identity-DcBS2NPP.js +2161 -0
- package/dist/chunks/calendar-day-equality-Bpl15IBo.js +487 -0
- package/dist/chunks/class-utils-Df1OVOT1.js +2315 -0
- package/dist/chunks/{field-dependencies-CpRUwr9J.js → common-types-CUf03Htv.js} +65 -58
- package/dist/chunks/context-HD9usB1P.js +349 -0
- package/dist/chunks/conversation-sQiWYUOb.js +16 -0
- package/dist/chunks/csv-utils-GUfKyT1J.js +56 -0
- package/dist/chunks/custom-visual-inputs-BrUOIwln.js +3288 -0
- package/dist/chunks/{dashboard-BTDY_I5L.js → dashboard-DTDDFQsS.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-DV_rlhT2.js → dashboard-briefing-launcher-Bb2QUqOa.js} +764 -740
- package/dist/chunks/{dashboard-controls-B4LxN5dr.js → dashboard-controls-FpONU8QV.js} +683 -686
- package/dist/chunks/{common-types-g7yS12Cg.js → dashboard-filter-value-compatibility-D95O4nd7.js} +18 -24
- package/dist/chunks/dashboard-json-DazPhBU_.js +69 -0
- package/dist/chunks/document-dashboard-inputs-D96rlU7S.js +10678 -0
- package/dist/chunks/document-sheet-utils-C1eEldxs.js +1076 -0
- package/dist/chunks/{edit-dashboard-visual-L5zsle6X.js → edit-dashboard-visual-CIhZodVH.js} +4744 -4746
- package/dist/chunks/editor-draft-sync-BN5qYHPF.js +15 -0
- package/dist/chunks/filter-value-text-BhWugPWE.js +163 -0
- package/dist/chunks/index-CqMiAkay.js +3164 -0
- package/dist/chunks/index-CuHybtft.js +51 -0
- package/dist/chunks/layout-grid-Bgzth8vd.js +16 -0
- package/dist/chunks/{matrix-analytical-definition-CgBTD6H8.js → matrix-analytical-definition-bcprSe4u.js} +1 -1
- package/dist/chunks/{matrix-card-CAdizkUl.js → matrix-card-CJn1hB5V.js} +13 -12
- package/dist/chunks/matrix-definition-DQDI2okF.js +206 -0
- package/dist/chunks/{matrix-formatter-DJCk8Znf.js → matrix-formatter-Bgw32tb3.js} +648 -457
- package/dist/chunks/matrix-member-presentation-BNPSDKBG.js +105 -0
- package/dist/chunks/{matrix-operation-contract-BKupLHXL.js → matrix-operation-contract-B8PBF1Gd.js} +134 -133
- package/dist/chunks/{metric-comparison-BKHyvnAy.js → metric-comparison-CojWeLqx.js} +1 -1
- package/dist/chunks/{palette-Cp1hqZtm.js → palette-D10o_yYX.js} +1 -1
- package/dist/chunks/pivot-header-presentation-MkcKnjn3.js +42 -0
- package/dist/chunks/{pivot-result-identity-Bs4tLtLo.js → pivot-result-identity-D6hhcRXi.js} +1 -1
- package/dist/chunks/pivot-result-lifecycle-8qCDmpKc.js +804 -0
- package/dist/chunks/raw-temporal-D61lr48Y.js +1464 -0
- package/dist/chunks/{raw-temporal-contract-mLFS-9wk.js → raw-temporal-contract-C51YG48G.js} +1 -1
- package/dist/chunks/report-preferences-dialog-BCGs4-AE.js +1808 -0
- package/dist/chunks/{report-runtime-context-CG_I0PPW.js → report-runtime-context-B984Nq1E.js} +8 -7
- package/dist/chunks/save-CfJpQQ68.js +21 -0
- package/dist/chunks/saved-dashboard-context-BrTkjcod.js +566 -0
- package/dist/chunks/{selection-reducer-CiDEtmAq.js → selection-reducer-vKIb_jS6.js} +2 -2
- package/dist/chunks/{semaphor-ready-indicator-3TXTZgw-.js → semaphor-ready-indicator-CHHoWhil.js} +65657 -62814
- package/dist/chunks/{shelf-drop-preview-context-CBCs9rjz.js → shelf-drop-preview-context-EsayECEC.js} +199 -196
- package/dist/chunks/{source-entity-resolution-C-oNyYMp.js → source-entity-resolution-CVA1a85c.js} +8 -8
- package/dist/chunks/switch-CvItuC1Q.js +8199 -0
- package/dist/chunks/{temporal-bucket-DlFuhCnT.js → temporal-bucket-D8JF7zKz.js} +86 -71
- package/dist/chunks/{temporal-bucket-contract-D2OuaVZ7.js → temporal-bucket-contract-DaOajRC7.js} +1 -1
- package/dist/chunks/{token-types-DtSJOUjh.js → token-types-bxUxXDX2.js} +1 -1
- package/dist/chunks/{upload-CAIpsti1.js → upload-BFX7apKV.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-Bk-SBnaY.js → use-create-flow-overlay-state-BqA92GkX.js} +331 -339
- package/dist/chunks/{validators-DMSH81OM.js → validators-Ej1DdCXa.js} +1050 -1510
- package/dist/chunks/visual-choice-JiJ-_3bi.js +204 -0
- package/dist/chunks/x-4f5U2XwU.js +100 -0
- package/dist/chunks/{zoned-wall-clock-1qlWCE20.js → zoned-wall-clock-MulfA26h.js} +2 -2
- package/dist/dashboard/index.js +2 -2
- package/dist/dashboard-authoring/index.js +823 -661
- package/dist/data-app-sdk/index.js +32 -30
- package/dist/data-app-sdk-adapters/index.js +23 -22
- package/dist/data-app-sdk-validation/index.js +23 -22
- package/dist/format-utils/index.js +173 -168
- package/dist/index.js +267 -258
- package/dist/layouts/index.js +236 -24
- 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/assistant-context.d.ts +2 -0
- package/dist/types/assistant-protocol.d.ts +2 -0
- package/dist/types/components/assistant/assistant-entry-points.d.ts +18 -0
- package/dist/types/components/assistant/assistant-provider.d.ts +19 -0
- package/dist/types/components/assistant/assistant-store.d.ts +52 -0
- package/dist/types/components/assistant/use-assistant.d.ts +38 -0
- package/dist/types/components/index.d.ts +5 -1
- package/dist/types/components/surfboard/filter/types.d.ts +5 -2
- package/dist/types/index.js +50 -51
- package/dist/types/lib/api/invalidate-token.d.ts +7 -0
- package/dist/types/lib/charts/cartesian-fields.d.ts +64 -0
- package/dist/types/lib/charts/types.d.ts +7 -0
- package/dist/types/lib/dashboard-inputs/dashboard-filter-mapping-storage-transition.d.ts +14 -2
- package/dist/types/lib/dashboard-inputs/dashboard-input-target-context.d.ts +5 -6
- package/dist/types/lib/dashboard-inputs/dashboard-input-values.d.ts +8 -3
- package/dist/types/lib/dashboard-inputs/resolve-dashboard-input-context.d.ts +11 -6
- package/dist/types/lib/dashboard-pagination/dashboard-card-pagination.d.ts +7 -0
- package/dist/types/lib/dashboard-viewer/compatibility-input-storage.d.ts +79 -0
- package/dist/types/lib/dashboard-viewer/viewer-state.d.ts +3 -2
- package/dist/types/lib/document/document-table-data-policy.d.ts +15 -0
- package/dist/types/lib/filter-values/filter-mode.d.ts +22 -0
- package/dist/types/lib/hooks/use-calendar-context.d.ts +5 -0
- package/dist/types/lib/hooks/use-text-filter.d.ts +7 -0
- package/dist/types/lib/print/print-inputs.d.ts +4 -2
- package/dist/types/lib/query-context/build-card-query-context.d.ts +12 -4
- package/dist/types/lib/query-context/build-dashboard-execution-snapshot.d.ts +93 -0
- package/dist/types/lib/query-context/card-server-request.d.ts +72 -0
- package/dist/types/lib/query-context/compile-dashboard-card-filters.d.ts +7 -0
- package/dist/types/lib/query-context/describe-card-execution-snapshot.d.ts +56 -0
- package/dist/types/lib/query-context/document-section-card-query.d.ts +45 -0
- package/dist/types/lib/query-context/resolve-runtime-card-filters.d.ts +17 -2
- package/dist/types/lib/stores/dashboard-store.d.ts +34 -11
- package/dist/types/lib/stores/editor-store.d.ts +4 -2
- package/dist/types/lib/types/token-types.d.ts +11 -0
- package/dist/types/lib/utils/card-type-change.d.ts +30 -0
- package/dist/types/lib/utils/comparison-window-caption.d.ts +12 -0
- package/dist/types/lib/utils/filter-default-value-utils.d.ts +13 -2
- package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +74 -0
- package/dist/types/shared/analytics-protocol/contracts.d.ts +5 -0
- package/dist/types/shared/analytics-protocol/filter-field-ownership.d.ts +43 -0
- package/dist/types/shared/analytics-protocol/index.d.ts +3 -0
- package/dist/types/shared/analytics-protocol/matrix-window-contract.d.ts +1 -1
- package/dist/types/shared/analytics-protocol/visual-choice.d.ts +75 -0
- package/dist/types/shared/assistant-context/index.d.ts +9 -0
- package/dist/types/shared/assistant-context/project-context.d.ts +55 -0
- package/dist/types/shared/assistant-context/saved-dashboard-context.d.ts +130 -0
- package/dist/types/shared/assistant-protocol/add-to-dashboard.d.ts +17 -0
- package/dist/types/shared/assistant-protocol/artifact.d.ts +63 -0
- package/dist/types/shared/assistant-protocol/availability.d.ts +39 -0
- package/dist/types/shared/assistant-protocol/context.d.ts +952 -0
- package/dist/types/shared/assistant-protocol/conversation.d.ts +38 -0
- package/dist/types/shared/assistant-protocol/index.d.ts +16 -0
- package/dist/types/shared/assistant-protocol/limits.d.ts +53 -0
- package/dist/types/shared/assistant-protocol/parts.d.ts +131 -0
- package/dist/types/shared/assistant-protocol/request.d.ts +77 -0
- package/dist/types/shared/assistant-protocol/sources.d.ts +27 -0
- package/dist/types/shared/assistant-protocol/token-config.d.ts +32 -0
- package/dist/types/shared/assistant-protocol/transcript.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +112 -0
- package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +1794 -0
- package/dist/types/shared/dashboard-authoring/index.d.ts +5 -0
- package/dist/types/shared/dashboard-authoring/new-card.d.ts +10 -0
- package/dist/types/shared/dashboard-authoring/operations/apply-dashboard-operations.d.ts +40 -0
- package/dist/types/shared/dashboard-authoring/resolved-primary-date-field-validation.d.ts +16 -0
- package/dist/types/shared/format-utils/filter-detail.d.ts +70 -0
- package/dist/types/shared/format-utils/filter-value-text.d.ts +15 -0
- package/dist/types/shared/format-utils/index.d.ts +3 -0
- package/dist/types/shared/format-utils/raw-temporal.d.ts +7 -0
- package/dist/types/shared/format-utils/temporal-bucket.d.ts +7 -0
- package/dist/types/shared/layouts/frame-layouts.d.ts +23 -0
- package/dist/types/shared/layouts/index.d.ts +1 -0
- package/package.json +12 -2
- package/dist/chunks/calculated-field-identity-BptYhyOP.js +0 -1326
- package/dist/chunks/calendar-day-equality-BRjN1S9h.js +0 -383
- package/dist/chunks/card-config-utils-BOM1dxCk.js +0 -1150
- package/dist/chunks/constants-DNWVy8Y3.js +0 -9
- package/dist/chunks/dashboard-json-Ccjo0Dzw.js +0 -65
- package/dist/chunks/field-aggregations-CoLzYHeL.js +0 -1229
- package/dist/chunks/index-DTcTAGGM.js +0 -4101
- package/dist/chunks/matrix-continuation-C4sRcjZU.js +0 -72
- package/dist/chunks/matrix-control-sources-DTqcA2_L.js +0 -636
- package/dist/chunks/matrix-definition-D9iShKZI.js +0 -87
- package/dist/chunks/matrix-member-presentation-Ct8GuxHt.js +0 -209
- package/dist/chunks/numeric-presentation-CWu3gunq.js +0 -537
- package/dist/chunks/pivot-header-presentation-CHs2GFrM.js +0 -753
- package/dist/chunks/pivot-result-lifecycle-DQz_gjGu.js +0 -789
- package/dist/chunks/raw-temporal-iMXRK-Qz.js +0 -930
- package/dist/chunks/report-preferences-dialog-CW8VEIDx.js +0 -1623
- package/dist/chunks/save-kO6cIaob.js +0 -34
- package/dist/chunks/semantic-format-DiqYeKwU.js +0 -192
- package/dist/chunks/switch-CKB-kUaC.js +0 -25003
- package/dist/chunks/temporal-input-presentation-BD7YNUzu.js +0 -195
- package/dist/chunks/x-CXDkqdur.js +0 -149
- package/dist/types/lib/class-utils.d.ts +0 -2
- package/dist/types/lib/document/document-input-runtime.d.ts +0 -26
- package/dist/types/lib/utils.d.ts +0 -51
|
@@ -0,0 +1,3288 @@
|
|
|
1
|
+
var pa = Object.defineProperty;
|
|
2
|
+
var ga = (e, t, a) => t in e ? pa(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var O = (e, t, a) => ga(e, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
+
import { j as ya, d as Mt, S as Ve } from "./analytics-base-schemas-BFAoRlkU.js";
|
|
5
|
+
import { l as ge, E as Pe, t as ha, c as ba, aM as va, aN as gt, V as wa, U as xa } from "./validators-Ej1DdCXa.js";
|
|
6
|
+
import { ak as Ta, O as Ca } from "./matrix-operation-contract-B8PBF1Gd.js";
|
|
7
|
+
import "zod";
|
|
8
|
+
import { a5 as Ge, a4 as Ia, A as ee, k as Te, z as Ea, D as Sa, a as _t, s as Fa, i as ka } from "./calculated-field-identity-DcBS2NPP.js";
|
|
9
|
+
import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as Bt } from "../value-format-preferences/index.js";
|
|
10
|
+
import { g as Ma } from "./_commonjsHelpers-BkfeUUK-.js";
|
|
11
|
+
import { S as _a, a as yt } from "./color-CJvdlFM_.js";
|
|
12
|
+
import { g as Ba, a as Ra, b as Na, m as Pa } from "./matrix-definition-DQDI2okF.js";
|
|
13
|
+
import { i as Da } from "./matrix-card-CJn1hB5V.js";
|
|
14
|
+
import g, { forwardRef as Aa, isValidElement as qe } from "react";
|
|
15
|
+
import $a from "react-dom";
|
|
16
|
+
import { h as ja, r as Rt, d as Oa } from "./common-types-CUf03Htv.js";
|
|
17
|
+
import { a as ht } from "./matrix-analytical-definition-bcprSe4u.js";
|
|
18
|
+
import { s as bt } from "./stable-serialize-CfqXeiBP.js";
|
|
19
|
+
import { r as we, b as La, d as Ya, P as qa } from "./pivot-result-identity-D6hhcRXi.js";
|
|
20
|
+
import { v as Ka, a as za } from "./temporal-bucket-contract-DaOajRC7.js";
|
|
21
|
+
import { w as Ua, t as Va, r as Ga, u as Ja } from "./pivot-result-lifecycle-8qCDmpKc.js";
|
|
22
|
+
import { v as Je, f as Ha, a as Wa, c as Nt, D as Qa } from "./temporal-bucket-D8JF7zKz.js";
|
|
23
|
+
let Me;
|
|
24
|
+
const Xa = new Uint8Array(16);
|
|
25
|
+
function Za() {
|
|
26
|
+
if (!Me && (Me = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Me))
|
|
27
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
28
|
+
return Me(Xa);
|
|
29
|
+
}
|
|
30
|
+
const $ = [];
|
|
31
|
+
for (let e = 0; e < 256; ++e)
|
|
32
|
+
$.push((e + 256).toString(16).slice(1));
|
|
33
|
+
function er(e, t = 0) {
|
|
34
|
+
return $[e[t + 0]] + $[e[t + 1]] + $[e[t + 2]] + $[e[t + 3]] + "-" + $[e[t + 4]] + $[e[t + 5]] + "-" + $[e[t + 6]] + $[e[t + 7]] + "-" + $[e[t + 8]] + $[e[t + 9]] + "-" + $[e[t + 10]] + $[e[t + 11]] + $[e[t + 12]] + $[e[t + 13]] + $[e[t + 14]] + $[e[t + 15]];
|
|
35
|
+
}
|
|
36
|
+
const tr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), vt = {
|
|
37
|
+
randomUUID: tr
|
|
38
|
+
};
|
|
39
|
+
function ar(e, t, a) {
|
|
40
|
+
if (vt.randomUUID && !e)
|
|
41
|
+
return vt.randomUUID();
|
|
42
|
+
e = e || {};
|
|
43
|
+
const r = e.random || (e.rng || Za)();
|
|
44
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, er(r);
|
|
45
|
+
}
|
|
46
|
+
function He(e) {
|
|
47
|
+
return e != null && e.startsWith("card-source-") ? e.replace("card-source-", "") : e;
|
|
48
|
+
}
|
|
49
|
+
function rr(e) {
|
|
50
|
+
if ("expression" in e)
|
|
51
|
+
return e.expression || void 0;
|
|
52
|
+
}
|
|
53
|
+
function fe(e) {
|
|
54
|
+
return [
|
|
55
|
+
e.role || "field",
|
|
56
|
+
Ia(e),
|
|
57
|
+
e.name,
|
|
58
|
+
rr(e) || ""
|
|
59
|
+
].join("::");
|
|
60
|
+
}
|
|
61
|
+
function nr(e) {
|
|
62
|
+
var a;
|
|
63
|
+
if (e.fieldScope === "domain")
|
|
64
|
+
return `domain:${Ge(e)}`;
|
|
65
|
+
const t = He(((a = e.calculatedFieldOrigin) == null ? void 0 : a.id) || e.id);
|
|
66
|
+
return t ? `id:${t}` : `fallback:${fe(e)}`;
|
|
67
|
+
}
|
|
68
|
+
function Ze(e, t, a) {
|
|
69
|
+
var o, s;
|
|
70
|
+
if (e.fieldScope === "domain" && t.fieldScope === "domain")
|
|
71
|
+
return Ge(e) === Ge(t);
|
|
72
|
+
const r = He(((o = e.calculatedFieldOrigin) == null ? void 0 : o.id) || e.id), n = He(((s = t.calculatedFieldOrigin) == null ? void 0 : s.id) || t.id);
|
|
73
|
+
return r && n ? r === n || !!(a != null && a.allowComparableFallback) && fe(e) === fe(t) : fe(e) === fe(t);
|
|
74
|
+
}
|
|
75
|
+
function or(e, t, a) {
|
|
76
|
+
return e.findIndex(
|
|
77
|
+
(r) => Ze(r, t, a)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
function Qn(e) {
|
|
81
|
+
const t = /* @__PURE__ */ new Map();
|
|
82
|
+
return e.forEach((a) => {
|
|
83
|
+
const r = nr(a);
|
|
84
|
+
t.has(r) || t.set(r, a);
|
|
85
|
+
}), Array.from(t.values());
|
|
86
|
+
}
|
|
87
|
+
function Xn(e, t, a, r) {
|
|
88
|
+
var s;
|
|
89
|
+
const o = or(e, a || t, r);
|
|
90
|
+
if (o >= 0) {
|
|
91
|
+
const u = (s = e[o]) == null ? void 0 : s.id, d = u && u !== t.id ? { ...t, id: u } : t;
|
|
92
|
+
return e.map(
|
|
93
|
+
(l, c) => c === o ? d : l
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
return [...e, t];
|
|
97
|
+
}
|
|
98
|
+
function Zn(e, t, a) {
|
|
99
|
+
return e.filter(
|
|
100
|
+
(r) => !Ze(r, t, a)
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function eo(e) {
|
|
104
|
+
return new Set(e.map(fe));
|
|
105
|
+
}
|
|
106
|
+
function Pt(e) {
|
|
107
|
+
return e.format != null || e.dateFormat != null;
|
|
108
|
+
}
|
|
109
|
+
const wt = {
|
|
110
|
+
"Week of MMM DD, YYYY": {
|
|
111
|
+
type: "temporal_bucket",
|
|
112
|
+
presentation: { mode: "preset", preset: "week_of_short" }
|
|
113
|
+
},
|
|
114
|
+
"Week of MMMM DD, YYYY": {
|
|
115
|
+
type: "temporal_bucket",
|
|
116
|
+
presentation: { mode: "preset", preset: "week_of_long" }
|
|
117
|
+
},
|
|
118
|
+
"Q1 YYYY": {
|
|
119
|
+
type: "temporal_bucket",
|
|
120
|
+
presentation: { mode: "preset", preset: "quarter_short" }
|
|
121
|
+
},
|
|
122
|
+
"1st Quarter YYYY": {
|
|
123
|
+
type: "temporal_bucket",
|
|
124
|
+
presentation: { mode: "preset", preset: "quarter_long" }
|
|
125
|
+
},
|
|
126
|
+
"YYYY Q1": void 0,
|
|
127
|
+
"YYYY-Q1": void 0,
|
|
128
|
+
"Quarter 1, YYYY": void 0,
|
|
129
|
+
"YYYY-WW": void 0
|
|
130
|
+
};
|
|
131
|
+
function ir(e, t, a, r) {
|
|
132
|
+
return {
|
|
133
|
+
code: t,
|
|
134
|
+
severity: "warning",
|
|
135
|
+
fieldId: e.fieldId,
|
|
136
|
+
...r ? { ignoredPattern: r } : {},
|
|
137
|
+
effectiveFormat: a
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function sr(e, t) {
|
|
141
|
+
if (e.dateFormat === void 0 || e.dateFormat === null)
|
|
142
|
+
return { format: ee };
|
|
143
|
+
if (typeof e.dateFormat != "string")
|
|
144
|
+
return {
|
|
145
|
+
format: ee,
|
|
146
|
+
repairCode: "unsupported_pattern"
|
|
147
|
+
};
|
|
148
|
+
const a = e.dateFormat === "custom" ? typeof e.customFormat == "string" ? e.customFormat.trim() : "" : e.dateFormat.trim();
|
|
149
|
+
if (!a)
|
|
150
|
+
return {
|
|
151
|
+
format: ee,
|
|
152
|
+
repairCode: "missing_custom_pattern"
|
|
153
|
+
};
|
|
154
|
+
if (Object.prototype.hasOwnProperty.call(wt, a)) {
|
|
155
|
+
const o = wt[a];
|
|
156
|
+
return o ? Je(
|
|
157
|
+
o,
|
|
158
|
+
t
|
|
159
|
+
).ok ? { format: o } : {
|
|
160
|
+
format: ee,
|
|
161
|
+
repairCode: "grain_incompatible_pattern",
|
|
162
|
+
ignoredPattern: a
|
|
163
|
+
} : {
|
|
164
|
+
format: ee,
|
|
165
|
+
repairCode: "unsupported_pattern",
|
|
166
|
+
ignoredPattern: a
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
const r = {
|
|
170
|
+
type: "temporal_bucket",
|
|
171
|
+
presentation: { mode: "pattern", pattern: a }
|
|
172
|
+
}, n = Je(
|
|
173
|
+
r,
|
|
174
|
+
t
|
|
175
|
+
);
|
|
176
|
+
return n.ok ? { format: r } : {
|
|
177
|
+
format: ee,
|
|
178
|
+
repairCode: n.code === "incompatible_temporal_bucket_pattern" || n.code === "incompatible_temporal_bucket_preset" ? "grain_incompatible_pattern" : "unsupported_pattern",
|
|
179
|
+
ignoredPattern: a
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function lr(e) {
|
|
183
|
+
if (Mt(e.granularity))
|
|
184
|
+
return { granularity: e.granularity, assumedDay: !1 };
|
|
185
|
+
if (!(e.granularity !== void 0 && e.granularity !== null))
|
|
186
|
+
return ge(e.dataType) === "date" ? { granularity: "day", assumedDay: !0 } : void 0;
|
|
187
|
+
}
|
|
188
|
+
function Dt(e) {
|
|
189
|
+
const t = lr(e);
|
|
190
|
+
if (!t)
|
|
191
|
+
return {
|
|
192
|
+
ok: !1,
|
|
193
|
+
error: { code: "ambiguous_temporal_grain", fieldId: e.fieldId }
|
|
194
|
+
};
|
|
195
|
+
let a, r, n;
|
|
196
|
+
if (e.format !== void 0 && e.format !== null) {
|
|
197
|
+
const s = ya.safeParse(e.format);
|
|
198
|
+
if (!s.success)
|
|
199
|
+
a = ee, r = "unsupported_pattern";
|
|
200
|
+
else {
|
|
201
|
+
const u = Je(
|
|
202
|
+
s.data,
|
|
203
|
+
t.granularity
|
|
204
|
+
);
|
|
205
|
+
a = u.ok ? s.data : ee, u.ok || (r = u.code === "invalid_temporal_bucket_pattern" ? "unsupported_pattern" : "grain_incompatible_pattern", n = s.data.presentation.mode === "pattern" ? s.data.presentation.pattern : s.data.presentation.mode === "preset" ? s.data.presentation.preset : void 0);
|
|
206
|
+
}
|
|
207
|
+
} else
|
|
208
|
+
({ format: a, repairCode: r, ignoredPattern: n } = sr(
|
|
209
|
+
e,
|
|
210
|
+
t.granularity
|
|
211
|
+
));
|
|
212
|
+
const o = t.assumedDay ? "missing_grain_assumed_day" : r;
|
|
213
|
+
return {
|
|
214
|
+
ok: !0,
|
|
215
|
+
format: a,
|
|
216
|
+
...o ? {
|
|
217
|
+
diagnostic: ir(
|
|
218
|
+
e,
|
|
219
|
+
o,
|
|
220
|
+
a,
|
|
221
|
+
n
|
|
222
|
+
)
|
|
223
|
+
} : {}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
var At = {}, $t = {}, et = { exports: {} }, C = String, jt = function() {
|
|
227
|
+
return { isColorSupported: !1, reset: C, bold: C, dim: C, italic: C, underline: C, inverse: C, hidden: C, strikethrough: C, black: C, red: C, green: C, yellow: C, blue: C, magenta: C, cyan: C, white: C, gray: C, bgBlack: C, bgRed: C, bgGreen: C, bgYellow: C, bgBlue: C, bgMagenta: C, bgCyan: C, bgWhite: C, blackBright: C, redBright: C, greenBright: C, yellowBright: C, blueBright: C, magentaBright: C, cyanBright: C, whiteBright: C, bgBlackBright: C, bgRedBright: C, bgGreenBright: C, bgYellowBright: C, bgBlueBright: C, bgMagentaBright: C, bgCyanBright: C, bgWhiteBright: C };
|
|
228
|
+
};
|
|
229
|
+
et.exports = jt();
|
|
230
|
+
et.exports.createColors = jt;
|
|
231
|
+
var dr = et.exports;
|
|
232
|
+
(function(e) {
|
|
233
|
+
Object.defineProperty(e, "__esModule", {
|
|
234
|
+
value: !0
|
|
235
|
+
});
|
|
236
|
+
function t(d, l) {
|
|
237
|
+
for (var c in l) Object.defineProperty(d, c, {
|
|
238
|
+
enumerable: !0,
|
|
239
|
+
get: l[c]
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
t(e, {
|
|
243
|
+
dim: function() {
|
|
244
|
+
return s;
|
|
245
|
+
},
|
|
246
|
+
default: function() {
|
|
247
|
+
return u;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
const a = /* @__PURE__ */ r(dr);
|
|
251
|
+
function r(d) {
|
|
252
|
+
return d && d.__esModule ? d : {
|
|
253
|
+
default: d
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
let n = /* @__PURE__ */ new Set();
|
|
257
|
+
function o(d, l, c) {
|
|
258
|
+
typeof process < "u" && process.env.JEST_WORKER_ID || c && n.has(c) || (c && n.add(c), console.warn(""), l.forEach((f) => console.warn(d, "-", f)));
|
|
259
|
+
}
|
|
260
|
+
function s(d) {
|
|
261
|
+
return a.default.dim(d);
|
|
262
|
+
}
|
|
263
|
+
const u = {
|
|
264
|
+
info(d, l) {
|
|
265
|
+
o(a.default.bold(a.default.cyan("info")), ...Array.isArray(d) ? [
|
|
266
|
+
d
|
|
267
|
+
] : [
|
|
268
|
+
l,
|
|
269
|
+
d
|
|
270
|
+
]);
|
|
271
|
+
},
|
|
272
|
+
warn(d, l) {
|
|
273
|
+
o(a.default.bold(a.default.yellow("warn")), ...Array.isArray(d) ? [
|
|
274
|
+
d
|
|
275
|
+
] : [
|
|
276
|
+
l,
|
|
277
|
+
d
|
|
278
|
+
]);
|
|
279
|
+
},
|
|
280
|
+
risk(d, l) {
|
|
281
|
+
o(a.default.bold(a.default.magenta("risk")), ...Array.isArray(d) ? [
|
|
282
|
+
d
|
|
283
|
+
] : [
|
|
284
|
+
l,
|
|
285
|
+
d
|
|
286
|
+
]);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
})($t);
|
|
290
|
+
(function(e) {
|
|
291
|
+
Object.defineProperty(e, "__esModule", {
|
|
292
|
+
value: !0
|
|
293
|
+
}), Object.defineProperty(e, "default", {
|
|
294
|
+
enumerable: !0,
|
|
295
|
+
get: function() {
|
|
296
|
+
return n;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
const t = /* @__PURE__ */ a($t);
|
|
300
|
+
function a(o) {
|
|
301
|
+
return o && o.__esModule ? o : {
|
|
302
|
+
default: o
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function r({ version: o, from: s, to: u }) {
|
|
306
|
+
t.default.warn(`${s}-color-renamed`, [
|
|
307
|
+
`As of Tailwind CSS ${o}, \`${s}\` has been renamed to \`${u}\`.`,
|
|
308
|
+
"Update your configuration file to silence this warning."
|
|
309
|
+
]);
|
|
310
|
+
}
|
|
311
|
+
const n = {
|
|
312
|
+
inherit: "inherit",
|
|
313
|
+
current: "currentColor",
|
|
314
|
+
transparent: "transparent",
|
|
315
|
+
black: "#000",
|
|
316
|
+
white: "#fff",
|
|
317
|
+
slate: {
|
|
318
|
+
50: "#f8fafc",
|
|
319
|
+
100: "#f1f5f9",
|
|
320
|
+
200: "#e2e8f0",
|
|
321
|
+
300: "#cbd5e1",
|
|
322
|
+
400: "#94a3b8",
|
|
323
|
+
500: "#64748b",
|
|
324
|
+
600: "#475569",
|
|
325
|
+
700: "#334155",
|
|
326
|
+
800: "#1e293b",
|
|
327
|
+
900: "#0f172a",
|
|
328
|
+
950: "#020617"
|
|
329
|
+
},
|
|
330
|
+
gray: {
|
|
331
|
+
50: "#f9fafb",
|
|
332
|
+
100: "#f3f4f6",
|
|
333
|
+
200: "#e5e7eb",
|
|
334
|
+
300: "#d1d5db",
|
|
335
|
+
400: "#9ca3af",
|
|
336
|
+
500: "#6b7280",
|
|
337
|
+
600: "#4b5563",
|
|
338
|
+
700: "#374151",
|
|
339
|
+
800: "#1f2937",
|
|
340
|
+
900: "#111827",
|
|
341
|
+
950: "#030712"
|
|
342
|
+
},
|
|
343
|
+
zinc: {
|
|
344
|
+
50: "#fafafa",
|
|
345
|
+
100: "#f4f4f5",
|
|
346
|
+
200: "#e4e4e7",
|
|
347
|
+
300: "#d4d4d8",
|
|
348
|
+
400: "#a1a1aa",
|
|
349
|
+
500: "#71717a",
|
|
350
|
+
600: "#52525b",
|
|
351
|
+
700: "#3f3f46",
|
|
352
|
+
800: "#27272a",
|
|
353
|
+
900: "#18181b",
|
|
354
|
+
950: "#09090b"
|
|
355
|
+
},
|
|
356
|
+
neutral: {
|
|
357
|
+
50: "#fafafa",
|
|
358
|
+
100: "#f5f5f5",
|
|
359
|
+
200: "#e5e5e5",
|
|
360
|
+
300: "#d4d4d4",
|
|
361
|
+
400: "#a3a3a3",
|
|
362
|
+
500: "#737373",
|
|
363
|
+
600: "#525252",
|
|
364
|
+
700: "#404040",
|
|
365
|
+
800: "#262626",
|
|
366
|
+
900: "#171717",
|
|
367
|
+
950: "#0a0a0a"
|
|
368
|
+
},
|
|
369
|
+
stone: {
|
|
370
|
+
50: "#fafaf9",
|
|
371
|
+
100: "#f5f5f4",
|
|
372
|
+
200: "#e7e5e4",
|
|
373
|
+
300: "#d6d3d1",
|
|
374
|
+
400: "#a8a29e",
|
|
375
|
+
500: "#78716c",
|
|
376
|
+
600: "#57534e",
|
|
377
|
+
700: "#44403c",
|
|
378
|
+
800: "#292524",
|
|
379
|
+
900: "#1c1917",
|
|
380
|
+
950: "#0c0a09"
|
|
381
|
+
},
|
|
382
|
+
red: {
|
|
383
|
+
50: "#fef2f2",
|
|
384
|
+
100: "#fee2e2",
|
|
385
|
+
200: "#fecaca",
|
|
386
|
+
300: "#fca5a5",
|
|
387
|
+
400: "#f87171",
|
|
388
|
+
500: "#ef4444",
|
|
389
|
+
600: "#dc2626",
|
|
390
|
+
700: "#b91c1c",
|
|
391
|
+
800: "#991b1b",
|
|
392
|
+
900: "#7f1d1d",
|
|
393
|
+
950: "#450a0a"
|
|
394
|
+
},
|
|
395
|
+
orange: {
|
|
396
|
+
50: "#fff7ed",
|
|
397
|
+
100: "#ffedd5",
|
|
398
|
+
200: "#fed7aa",
|
|
399
|
+
300: "#fdba74",
|
|
400
|
+
400: "#fb923c",
|
|
401
|
+
500: "#f97316",
|
|
402
|
+
600: "#ea580c",
|
|
403
|
+
700: "#c2410c",
|
|
404
|
+
800: "#9a3412",
|
|
405
|
+
900: "#7c2d12",
|
|
406
|
+
950: "#431407"
|
|
407
|
+
},
|
|
408
|
+
amber: {
|
|
409
|
+
50: "#fffbeb",
|
|
410
|
+
100: "#fef3c7",
|
|
411
|
+
200: "#fde68a",
|
|
412
|
+
300: "#fcd34d",
|
|
413
|
+
400: "#fbbf24",
|
|
414
|
+
500: "#f59e0b",
|
|
415
|
+
600: "#d97706",
|
|
416
|
+
700: "#b45309",
|
|
417
|
+
800: "#92400e",
|
|
418
|
+
900: "#78350f",
|
|
419
|
+
950: "#451a03"
|
|
420
|
+
},
|
|
421
|
+
yellow: {
|
|
422
|
+
50: "#fefce8",
|
|
423
|
+
100: "#fef9c3",
|
|
424
|
+
200: "#fef08a",
|
|
425
|
+
300: "#fde047",
|
|
426
|
+
400: "#facc15",
|
|
427
|
+
500: "#eab308",
|
|
428
|
+
600: "#ca8a04",
|
|
429
|
+
700: "#a16207",
|
|
430
|
+
800: "#854d0e",
|
|
431
|
+
900: "#713f12",
|
|
432
|
+
950: "#422006"
|
|
433
|
+
},
|
|
434
|
+
lime: {
|
|
435
|
+
50: "#f7fee7",
|
|
436
|
+
100: "#ecfccb",
|
|
437
|
+
200: "#d9f99d",
|
|
438
|
+
300: "#bef264",
|
|
439
|
+
400: "#a3e635",
|
|
440
|
+
500: "#84cc16",
|
|
441
|
+
600: "#65a30d",
|
|
442
|
+
700: "#4d7c0f",
|
|
443
|
+
800: "#3f6212",
|
|
444
|
+
900: "#365314",
|
|
445
|
+
950: "#1a2e05"
|
|
446
|
+
},
|
|
447
|
+
green: {
|
|
448
|
+
50: "#f0fdf4",
|
|
449
|
+
100: "#dcfce7",
|
|
450
|
+
200: "#bbf7d0",
|
|
451
|
+
300: "#86efac",
|
|
452
|
+
400: "#4ade80",
|
|
453
|
+
500: "#22c55e",
|
|
454
|
+
600: "#16a34a",
|
|
455
|
+
700: "#15803d",
|
|
456
|
+
800: "#166534",
|
|
457
|
+
900: "#14532d",
|
|
458
|
+
950: "#052e16"
|
|
459
|
+
},
|
|
460
|
+
emerald: {
|
|
461
|
+
50: "#ecfdf5",
|
|
462
|
+
100: "#d1fae5",
|
|
463
|
+
200: "#a7f3d0",
|
|
464
|
+
300: "#6ee7b7",
|
|
465
|
+
400: "#34d399",
|
|
466
|
+
500: "#10b981",
|
|
467
|
+
600: "#059669",
|
|
468
|
+
700: "#047857",
|
|
469
|
+
800: "#065f46",
|
|
470
|
+
900: "#064e3b",
|
|
471
|
+
950: "#022c22"
|
|
472
|
+
},
|
|
473
|
+
teal: {
|
|
474
|
+
50: "#f0fdfa",
|
|
475
|
+
100: "#ccfbf1",
|
|
476
|
+
200: "#99f6e4",
|
|
477
|
+
300: "#5eead4",
|
|
478
|
+
400: "#2dd4bf",
|
|
479
|
+
500: "#14b8a6",
|
|
480
|
+
600: "#0d9488",
|
|
481
|
+
700: "#0f766e",
|
|
482
|
+
800: "#115e59",
|
|
483
|
+
900: "#134e4a",
|
|
484
|
+
950: "#042f2e"
|
|
485
|
+
},
|
|
486
|
+
cyan: {
|
|
487
|
+
50: "#ecfeff",
|
|
488
|
+
100: "#cffafe",
|
|
489
|
+
200: "#a5f3fc",
|
|
490
|
+
300: "#67e8f9",
|
|
491
|
+
400: "#22d3ee",
|
|
492
|
+
500: "#06b6d4",
|
|
493
|
+
600: "#0891b2",
|
|
494
|
+
700: "#0e7490",
|
|
495
|
+
800: "#155e75",
|
|
496
|
+
900: "#164e63",
|
|
497
|
+
950: "#083344"
|
|
498
|
+
},
|
|
499
|
+
sky: {
|
|
500
|
+
50: "#f0f9ff",
|
|
501
|
+
100: "#e0f2fe",
|
|
502
|
+
200: "#bae6fd",
|
|
503
|
+
300: "#7dd3fc",
|
|
504
|
+
400: "#38bdf8",
|
|
505
|
+
500: "#0ea5e9",
|
|
506
|
+
600: "#0284c7",
|
|
507
|
+
700: "#0369a1",
|
|
508
|
+
800: "#075985",
|
|
509
|
+
900: "#0c4a6e",
|
|
510
|
+
950: "#082f49"
|
|
511
|
+
},
|
|
512
|
+
blue: {
|
|
513
|
+
50: "#eff6ff",
|
|
514
|
+
100: "#dbeafe",
|
|
515
|
+
200: "#bfdbfe",
|
|
516
|
+
300: "#93c5fd",
|
|
517
|
+
400: "#60a5fa",
|
|
518
|
+
500: "#3b82f6",
|
|
519
|
+
600: "#2563eb",
|
|
520
|
+
700: "#1d4ed8",
|
|
521
|
+
800: "#1e40af",
|
|
522
|
+
900: "#1e3a8a",
|
|
523
|
+
950: "#172554"
|
|
524
|
+
},
|
|
525
|
+
indigo: {
|
|
526
|
+
50: "#eef2ff",
|
|
527
|
+
100: "#e0e7ff",
|
|
528
|
+
200: "#c7d2fe",
|
|
529
|
+
300: "#a5b4fc",
|
|
530
|
+
400: "#818cf8",
|
|
531
|
+
500: "#6366f1",
|
|
532
|
+
600: "#4f46e5",
|
|
533
|
+
700: "#4338ca",
|
|
534
|
+
800: "#3730a3",
|
|
535
|
+
900: "#312e81",
|
|
536
|
+
950: "#1e1b4b"
|
|
537
|
+
},
|
|
538
|
+
violet: {
|
|
539
|
+
50: "#f5f3ff",
|
|
540
|
+
100: "#ede9fe",
|
|
541
|
+
200: "#ddd6fe",
|
|
542
|
+
300: "#c4b5fd",
|
|
543
|
+
400: "#a78bfa",
|
|
544
|
+
500: "#8b5cf6",
|
|
545
|
+
600: "#7c3aed",
|
|
546
|
+
700: "#6d28d9",
|
|
547
|
+
800: "#5b21b6",
|
|
548
|
+
900: "#4c1d95",
|
|
549
|
+
950: "#2e1065"
|
|
550
|
+
},
|
|
551
|
+
purple: {
|
|
552
|
+
50: "#faf5ff",
|
|
553
|
+
100: "#f3e8ff",
|
|
554
|
+
200: "#e9d5ff",
|
|
555
|
+
300: "#d8b4fe",
|
|
556
|
+
400: "#c084fc",
|
|
557
|
+
500: "#a855f7",
|
|
558
|
+
600: "#9333ea",
|
|
559
|
+
700: "#7e22ce",
|
|
560
|
+
800: "#6b21a8",
|
|
561
|
+
900: "#581c87",
|
|
562
|
+
950: "#3b0764"
|
|
563
|
+
},
|
|
564
|
+
fuchsia: {
|
|
565
|
+
50: "#fdf4ff",
|
|
566
|
+
100: "#fae8ff",
|
|
567
|
+
200: "#f5d0fe",
|
|
568
|
+
300: "#f0abfc",
|
|
569
|
+
400: "#e879f9",
|
|
570
|
+
500: "#d946ef",
|
|
571
|
+
600: "#c026d3",
|
|
572
|
+
700: "#a21caf",
|
|
573
|
+
800: "#86198f",
|
|
574
|
+
900: "#701a75",
|
|
575
|
+
950: "#4a044e"
|
|
576
|
+
},
|
|
577
|
+
pink: {
|
|
578
|
+
50: "#fdf2f8",
|
|
579
|
+
100: "#fce7f3",
|
|
580
|
+
200: "#fbcfe8",
|
|
581
|
+
300: "#f9a8d4",
|
|
582
|
+
400: "#f472b6",
|
|
583
|
+
500: "#ec4899",
|
|
584
|
+
600: "#db2777",
|
|
585
|
+
700: "#be185d",
|
|
586
|
+
800: "#9d174d",
|
|
587
|
+
900: "#831843",
|
|
588
|
+
950: "#500724"
|
|
589
|
+
},
|
|
590
|
+
rose: {
|
|
591
|
+
50: "#fff1f2",
|
|
592
|
+
100: "#ffe4e6",
|
|
593
|
+
200: "#fecdd3",
|
|
594
|
+
300: "#fda4af",
|
|
595
|
+
400: "#fb7185",
|
|
596
|
+
500: "#f43f5e",
|
|
597
|
+
600: "#e11d48",
|
|
598
|
+
700: "#be123c",
|
|
599
|
+
800: "#9f1239",
|
|
600
|
+
900: "#881337",
|
|
601
|
+
950: "#4c0519"
|
|
602
|
+
},
|
|
603
|
+
get lightBlue() {
|
|
604
|
+
return r({
|
|
605
|
+
version: "v2.2",
|
|
606
|
+
from: "lightBlue",
|
|
607
|
+
to: "sky"
|
|
608
|
+
}), this.sky;
|
|
609
|
+
},
|
|
610
|
+
get warmGray() {
|
|
611
|
+
return r({
|
|
612
|
+
version: "v3.0",
|
|
613
|
+
from: "warmGray",
|
|
614
|
+
to: "stone"
|
|
615
|
+
}), this.stone;
|
|
616
|
+
},
|
|
617
|
+
get trueGray() {
|
|
618
|
+
return r({
|
|
619
|
+
version: "v3.0",
|
|
620
|
+
from: "trueGray",
|
|
621
|
+
to: "neutral"
|
|
622
|
+
}), this.neutral;
|
|
623
|
+
},
|
|
624
|
+
get coolGray() {
|
|
625
|
+
return r({
|
|
626
|
+
version: "v3.0",
|
|
627
|
+
from: "coolGray",
|
|
628
|
+
to: "gray"
|
|
629
|
+
}), this.gray;
|
|
630
|
+
},
|
|
631
|
+
get blueGray() {
|
|
632
|
+
return r({
|
|
633
|
+
version: "v3.0",
|
|
634
|
+
from: "blueGray",
|
|
635
|
+
to: "slate"
|
|
636
|
+
}), this.slate;
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
})(At);
|
|
640
|
+
let Ke = At;
|
|
641
|
+
var cr = (Ke.__esModule ? Ke : { default: Ke }).default;
|
|
642
|
+
const R = /* @__PURE__ */ Ma(cr), ur = ".semaphor-scope";
|
|
643
|
+
function fr(e) {
|
|
644
|
+
return e ? e.closest(ur) : null;
|
|
645
|
+
}
|
|
646
|
+
function mr(e) {
|
|
647
|
+
if (!e) return "light";
|
|
648
|
+
const t = e.dataset.semaphorTheme;
|
|
649
|
+
return t === "dark" || t === "light" ? t : e.classList.contains("dark") ? "dark" : "light";
|
|
650
|
+
}
|
|
651
|
+
const pr = `import pandas as pd
|
|
652
|
+
df = pd.DataFrame(data) # 'data' contains the query result
|
|
653
|
+
result = df.to_dict('records') # must return 'result' as [dict] type
|
|
654
|
+
`, gr = [
|
|
655
|
+
"table",
|
|
656
|
+
"view",
|
|
657
|
+
"materialized view"
|
|
658
|
+
], to = ["_forecast"], yr = "dm", ao = "semaphor_calculated_fields", ro = "calculated_fields", no = ["lg", "md", "sm", "xs", "xxs"], oo = {
|
|
659
|
+
// dashboardHeader: ' font-mono border-b-2 border-red-700',
|
|
660
|
+
default: {
|
|
661
|
+
dashboardPanel: "",
|
|
662
|
+
dashboardTabsContainer: "",
|
|
663
|
+
// dashboard: '',
|
|
664
|
+
gridLayout: {
|
|
665
|
+
// margin: [2, 2],
|
|
666
|
+
className: ""
|
|
667
|
+
},
|
|
668
|
+
chart: {
|
|
669
|
+
font: {
|
|
670
|
+
family: _a
|
|
671
|
+
// family:
|
|
672
|
+
// 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
673
|
+
},
|
|
674
|
+
dataset: {
|
|
675
|
+
// backgroundColor: [
|
|
676
|
+
// colors.blue[500],
|
|
677
|
+
// colors.teal[500],
|
|
678
|
+
// colors.amber[500],
|
|
679
|
+
// colors.red[500],
|
|
680
|
+
// colors.indigo[500],
|
|
681
|
+
// colors.green[500],
|
|
682
|
+
// ],
|
|
683
|
+
// borderColor: [
|
|
684
|
+
// colors.blue[500],
|
|
685
|
+
// colors.teal[500],
|
|
686
|
+
// colors.amber[500],
|
|
687
|
+
// colors.red[500],
|
|
688
|
+
// colors.indigo[500],
|
|
689
|
+
// colors.green[500],
|
|
690
|
+
// ],
|
|
691
|
+
backgroundColor: [
|
|
692
|
+
// colors.teal[900],
|
|
693
|
+
// colors.teal[700],
|
|
694
|
+
R.teal[500],
|
|
695
|
+
R.teal[300],
|
|
696
|
+
R.gray[700],
|
|
697
|
+
R.gray[500],
|
|
698
|
+
R.gray[300]
|
|
699
|
+
],
|
|
700
|
+
borderColor: [
|
|
701
|
+
// colors.teal[900],
|
|
702
|
+
// colors.teal[700],
|
|
703
|
+
R.teal[500],
|
|
704
|
+
R.teal[300],
|
|
705
|
+
R.gray[700],
|
|
706
|
+
R.gray[500],
|
|
707
|
+
R.gray[300]
|
|
708
|
+
]
|
|
709
|
+
},
|
|
710
|
+
options: {
|
|
711
|
+
// onClick: onClickFunction,
|
|
712
|
+
interaction: {
|
|
713
|
+
// intersect: false,
|
|
714
|
+
mode: "index"
|
|
715
|
+
},
|
|
716
|
+
plugins: {
|
|
717
|
+
datalabels: {
|
|
718
|
+
display: !1,
|
|
719
|
+
color: xt
|
|
720
|
+
},
|
|
721
|
+
title: {
|
|
722
|
+
display: !0
|
|
723
|
+
// text: 'Chart.js Line Chart',
|
|
724
|
+
},
|
|
725
|
+
tooltip: {
|
|
726
|
+
backgroundColor: "#fff",
|
|
727
|
+
bodyColor: "#000",
|
|
728
|
+
borderWidth: 0.25,
|
|
729
|
+
titleColor: "#000",
|
|
730
|
+
borderColor: "rgb(128,131,139)",
|
|
731
|
+
cornerRadius: 4,
|
|
732
|
+
usePointStyle: !0,
|
|
733
|
+
pointStyle: "rectRounded",
|
|
734
|
+
boxPadding: 4
|
|
735
|
+
// mode: 'index',
|
|
736
|
+
// intersect: false,
|
|
737
|
+
},
|
|
738
|
+
legend: {
|
|
739
|
+
position: "top",
|
|
740
|
+
align: "center",
|
|
741
|
+
maxHeight: 0,
|
|
742
|
+
labels: {
|
|
743
|
+
useBorderRadius: !0,
|
|
744
|
+
borderRadius: 2
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
scales: {
|
|
749
|
+
y: {
|
|
750
|
+
grid: {
|
|
751
|
+
display: !0
|
|
752
|
+
},
|
|
753
|
+
title: {
|
|
754
|
+
display: !0,
|
|
755
|
+
text: ""
|
|
756
|
+
},
|
|
757
|
+
beginAtZero: !0,
|
|
758
|
+
ticks: {
|
|
759
|
+
precision: 0
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
x: {
|
|
763
|
+
grid: {
|
|
764
|
+
display: !0
|
|
765
|
+
},
|
|
766
|
+
title: {
|
|
767
|
+
display: !0
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
},
|
|
771
|
+
layout: {
|
|
772
|
+
padding: {
|
|
773
|
+
top: -40
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
borderRadius: 2,
|
|
777
|
+
responsive: !0,
|
|
778
|
+
//This is the key to getting the chart to resize to fit the parent container.
|
|
779
|
+
maintainAspectRatio: !1
|
|
780
|
+
//This is the key to getting the chart to resize to fit the parent container.
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
dark: {
|
|
785
|
+
// gridLayout: {
|
|
786
|
+
// margin: [2, 2],
|
|
787
|
+
// },
|
|
788
|
+
chart: {
|
|
789
|
+
// font: {
|
|
790
|
+
// family:
|
|
791
|
+
// 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
792
|
+
// },
|
|
793
|
+
dataset: {
|
|
794
|
+
// backgroundColor: [
|
|
795
|
+
// colors.blue[500],
|
|
796
|
+
// colors.teal[500],
|
|
797
|
+
// colors.amber[500],
|
|
798
|
+
// colors.red[500],
|
|
799
|
+
// colors.indigo[500],
|
|
800
|
+
// colors.green[500],
|
|
801
|
+
// ],
|
|
802
|
+
// borderColor: [
|
|
803
|
+
// colors.blue[500],
|
|
804
|
+
// colors.teal[500],
|
|
805
|
+
// colors.amber[500],
|
|
806
|
+
// colors.red[500],
|
|
807
|
+
// colors.indigo[500],
|
|
808
|
+
// colors.green[500],
|
|
809
|
+
// ],
|
|
810
|
+
datalables: {
|
|
811
|
+
color: xt
|
|
812
|
+
},
|
|
813
|
+
backgroundColor: [
|
|
814
|
+
// colors.teal[900],
|
|
815
|
+
// colors.teal[700],
|
|
816
|
+
R.teal[500],
|
|
817
|
+
R.teal[300],
|
|
818
|
+
R.gray[700],
|
|
819
|
+
R.gray[500],
|
|
820
|
+
R.gray[300]
|
|
821
|
+
],
|
|
822
|
+
borderColor: [
|
|
823
|
+
// colors.teal[900],
|
|
824
|
+
// colors.teal[700],
|
|
825
|
+
R.teal[500],
|
|
826
|
+
R.teal[300],
|
|
827
|
+
R.gray[700],
|
|
828
|
+
R.gray[500],
|
|
829
|
+
R.gray[300]
|
|
830
|
+
]
|
|
831
|
+
// backgroundColor: [
|
|
832
|
+
// colors.teal[100],
|
|
833
|
+
// // colors.blue[500],
|
|
834
|
+
// colors.purple[100],
|
|
835
|
+
// colors.amber[100],
|
|
836
|
+
// colors.orange[100],
|
|
837
|
+
// colors.rose[100],
|
|
838
|
+
// ],
|
|
839
|
+
// borderColor: [
|
|
840
|
+
// colors.teal[400],
|
|
841
|
+
// // colors.blue[500],
|
|
842
|
+
// colors.purple[400],
|
|
843
|
+
// colors.amber[400],
|
|
844
|
+
// colors.orange[300],
|
|
845
|
+
// colors.rose[400],
|
|
846
|
+
// ],
|
|
847
|
+
// backgroundColor: [
|
|
848
|
+
// 'rgb(139, 232, 229)',
|
|
849
|
+
// 'rgb(213, 255, 228)',
|
|
850
|
+
// 'rgb(210, 224, 251)',
|
|
851
|
+
// 'rgb(142, 172, 205)',
|
|
852
|
+
// ],
|
|
853
|
+
// borderColor: [
|
|
854
|
+
// 'rgb(139, 232, 229)',
|
|
855
|
+
// 'rgb(213, 255, 228)',
|
|
856
|
+
// 'rgb(210, 224, 251)',
|
|
857
|
+
// 'rgb(142, 172, 205)',
|
|
858
|
+
// ],
|
|
859
|
+
},
|
|
860
|
+
options: {
|
|
861
|
+
plugins: {
|
|
862
|
+
tooltip: {
|
|
863
|
+
backgroundColor: "#000",
|
|
864
|
+
bodyColor: "#fff",
|
|
865
|
+
borderWidth: 0.25,
|
|
866
|
+
titleColor: "#fff",
|
|
867
|
+
borderColor: "rgb(128,131,139)",
|
|
868
|
+
cornerRadius: 2,
|
|
869
|
+
boxPadding: 4
|
|
870
|
+
}
|
|
871
|
+
},
|
|
872
|
+
datalabels: {
|
|
873
|
+
display: !1
|
|
874
|
+
},
|
|
875
|
+
scales: {
|
|
876
|
+
x: {
|
|
877
|
+
grid: {
|
|
878
|
+
display: !0,
|
|
879
|
+
color: R.slate[800]
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
y: {
|
|
883
|
+
grid: {
|
|
884
|
+
display: !0,
|
|
885
|
+
color: R.slate[800]
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
function xt(e) {
|
|
894
|
+
var r, n, o, s, u, d, l, c, f;
|
|
895
|
+
const t = (u = (s = (o = (n = (r = e == null ? void 0 : e.chart) == null ? void 0 : r.config) == null ? void 0 : n._config) == null ? void 0 : o.options) == null ? void 0 : s.plugins) == null ? void 0 : u.datalabels;
|
|
896
|
+
let a = (d = e == null ? void 0 : e.dataset) == null ? void 0 : d.backgroundColor;
|
|
897
|
+
return (t == null ? void 0 : t.align) === "end" && (t == null ? void 0 : t.anchor) === "end" && (a = ze((l = e == null ? void 0 : e.chart) == null ? void 0 : l.canvas)), (t == null ? void 0 : t.align) === "start" && (t == null ? void 0 : t.anchor) === "start" && (a = ze((c = e == null ? void 0 : e.chart) == null ? void 0 : c.canvas)), hr(a, {
|
|
898
|
+
baseColor: ze((f = e == null ? void 0 : e.chart) == null ? void 0 : f.canvas)
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
function ze(e) {
|
|
902
|
+
if (typeof document < "u") {
|
|
903
|
+
const t = fr(e);
|
|
904
|
+
if (t) {
|
|
905
|
+
const r = window.getComputedStyle(t).getPropertyValue("--semaphor-background").trim();
|
|
906
|
+
return r ? `hsl(${r})` : mr(t) === "dark" ? "#000000" : "#FFFFFF";
|
|
907
|
+
}
|
|
908
|
+
const a = document.documentElement;
|
|
909
|
+
if (a.classList.contains("dark"))
|
|
910
|
+
return "#000000";
|
|
911
|
+
if (a.classList.contains("light"))
|
|
912
|
+
return "#FFFFFF";
|
|
913
|
+
}
|
|
914
|
+
return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "#000000" : "#FFFFFF";
|
|
915
|
+
}
|
|
916
|
+
function hr(e, t = {}) {
|
|
917
|
+
let a = 0, r = 0, n = 0, o = 0;
|
|
918
|
+
const s = t.baseColor ? yt(t.baseColor) : null, u = (p) => {
|
|
919
|
+
if (!p) return R.gray[500];
|
|
920
|
+
const i = yt(p);
|
|
921
|
+
if (!i) return R.gray[500];
|
|
922
|
+
const h = Ot(i, s);
|
|
923
|
+
a += h.r, r += h.g, n += h.b, o++;
|
|
924
|
+
};
|
|
925
|
+
if (Array.isArray(e) ? e.forEach((p) => {
|
|
926
|
+
u(p);
|
|
927
|
+
}) : u(e), o === 0) return R.gray[500];
|
|
928
|
+
const d = a / o, l = r / o, c = n / o;
|
|
929
|
+
return (d * 299 + l * 587 + c * 114) / 1e3 >= 180 ? "black" : "white";
|
|
930
|
+
}
|
|
931
|
+
function Ot(e, t) {
|
|
932
|
+
if (e.alpha >= 1)
|
|
933
|
+
return e;
|
|
934
|
+
const a = t ? Ot(t, null) : br;
|
|
935
|
+
return {
|
|
936
|
+
r: e.r * e.alpha + a.r * (1 - e.alpha),
|
|
937
|
+
g: e.g * e.alpha + a.g * (1 - e.alpha),
|
|
938
|
+
b: e.b * e.alpha + a.b * (1 - e.alpha)
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
const br = {
|
|
942
|
+
r: 255,
|
|
943
|
+
g: 255,
|
|
944
|
+
b: 255
|
|
945
|
+
};
|
|
946
|
+
function io(e) {
|
|
947
|
+
const { spec: t, window: a, queryContext: r, reportContext: n } = e;
|
|
948
|
+
if (!e.cardId) throw new Error("Matrix query requires its card identity.");
|
|
949
|
+
return {
|
|
950
|
+
cardId: e.cardId,
|
|
951
|
+
cardType: "matrixTable",
|
|
952
|
+
cardConfig: { matrix: { spec: t } },
|
|
953
|
+
matrixWindowRequest: a,
|
|
954
|
+
...Ta({ runtimeFilters: r.resolvedFilters, runtimeSorts: e.runtimeSorts }),
|
|
955
|
+
active_filters: r.cardFilterValues,
|
|
956
|
+
calendarContext: n.calendar,
|
|
957
|
+
controlDefinitions: r.controlDefinitions,
|
|
958
|
+
cardControlDefinitions: r.cardControlDefinitions,
|
|
959
|
+
controlBindings: r.controlBindings,
|
|
960
|
+
controlValues: r.controlValues,
|
|
961
|
+
// Every request after the acquisition's first carries its state (K14).
|
|
962
|
+
...e.temporalState ? { temporalState: e.temporalState } : {}
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
function vr(e) {
|
|
966
|
+
return (t, a) => {
|
|
967
|
+
const r = e.filter((n) => n.field.name === t.name && !!n.field.source && Pe(n.field.source, t.source ?? a));
|
|
968
|
+
return r.length === 1 ? r[0] : void 0;
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
function tt(e) {
|
|
972
|
+
const t = vr(e);
|
|
973
|
+
return (a, r) => {
|
|
974
|
+
var n;
|
|
975
|
+
return (n = t(a, r)) == null ? void 0 : n.resolvedField;
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
function so(e) {
|
|
979
|
+
const t = tt(e);
|
|
980
|
+
return (a, r) => a.derivedField ? void 0 : t(a, r);
|
|
981
|
+
}
|
|
982
|
+
function Lt(e, t, a) {
|
|
983
|
+
if (e.derivedField) return e.derivedField.dataType;
|
|
984
|
+
const r = a.filter((o) => !o.derivedField && o.name === e.name && Pe(o.source ?? t, e.source ?? t));
|
|
985
|
+
return r.length ? new Set(r.map((o) => o.dataType)).size === 1 ? r[0].dataType ?? e.dataType : void 0 : e.dataType;
|
|
986
|
+
}
|
|
987
|
+
function Be(e, t, a) {
|
|
988
|
+
var u;
|
|
989
|
+
const r = (u = e.config) == null ? void 0 : u.matrix;
|
|
990
|
+
if (!r) return [];
|
|
991
|
+
const n = tt(a), o = (d, l, c) => {
|
|
992
|
+
const f = n(d, r.spec.source);
|
|
993
|
+
return {
|
|
994
|
+
...f,
|
|
995
|
+
source: d.source ?? r.spec.source,
|
|
996
|
+
id: l,
|
|
997
|
+
name: d.name,
|
|
998
|
+
label: c,
|
|
999
|
+
dataType: Lt(
|
|
1000
|
+
d,
|
|
1001
|
+
r.spec.source,
|
|
1002
|
+
a.map((p) => p.field)
|
|
1003
|
+
) ?? "unknown",
|
|
1004
|
+
qualifiedFieldName: (f == null ? void 0 : f.qualifiedFieldName) ?? d.name,
|
|
1005
|
+
entityId: (f == null ? void 0 : f.entityId) ?? "",
|
|
1006
|
+
entityName: (f == null ? void 0 : f.entityName) ?? "",
|
|
1007
|
+
entityType: (f == null ? void 0 : f.entityType) ?? "table",
|
|
1008
|
+
...d.derivedField ? { derivedField: d.derivedField } : {}
|
|
1009
|
+
};
|
|
1010
|
+
}, s = t === "groupBy" ? "rows" : t === "pivotBy" ? "columns" : void 0;
|
|
1011
|
+
return s ? r.spec[s].map((d) => ({
|
|
1012
|
+
...o(
|
|
1013
|
+
d.field,
|
|
1014
|
+
d.id,
|
|
1015
|
+
Ba(d, r.presentation)
|
|
1016
|
+
),
|
|
1017
|
+
granularity: d.grain,
|
|
1018
|
+
role: s === "rows" ? "groupby" : "pivotby"
|
|
1019
|
+
})) : t !== "metrics" ? [] : r.spec.measures.map((d) => ({
|
|
1020
|
+
...o(
|
|
1021
|
+
d.kind === "aggregate" ? d.field : {
|
|
1022
|
+
name: d.definition.name,
|
|
1023
|
+
derivedField: d.definition
|
|
1024
|
+
},
|
|
1025
|
+
d.id,
|
|
1026
|
+
Ra(d, r.presentation)
|
|
1027
|
+
),
|
|
1028
|
+
role: "metric",
|
|
1029
|
+
...d.kind === "aggregate" ? { aggregate: d.aggregate } : {}
|
|
1030
|
+
}));
|
|
1031
|
+
}
|
|
1032
|
+
function wr(e) {
|
|
1033
|
+
return Da(e, { authoringDraft: !0 });
|
|
1034
|
+
}
|
|
1035
|
+
function De(e) {
|
|
1036
|
+
return e.type !== "matrixTable";
|
|
1037
|
+
}
|
|
1038
|
+
function Yt(e) {
|
|
1039
|
+
var t, a, r, n;
|
|
1040
|
+
return {
|
|
1041
|
+
rows: ((t = e.config) == null ? void 0 : t.groupByColumns) ?? [],
|
|
1042
|
+
columns: ((a = e.config) == null ? void 0 : a.pivotByColumns) ?? [],
|
|
1043
|
+
metrics: ((r = e.config) == null ? void 0 : r.metricColumns) ?? [],
|
|
1044
|
+
details: ((n = e.config) == null ? void 0 : n.detailColumns) ?? []
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
function G(e, t = []) {
|
|
1048
|
+
var o, s, u, d, l, c, f, p;
|
|
1049
|
+
if (De(e)) {
|
|
1050
|
+
const i = Yt(e);
|
|
1051
|
+
return {
|
|
1052
|
+
kind: "shelf",
|
|
1053
|
+
status: e.config ? "ready" : "absent",
|
|
1054
|
+
fields: i,
|
|
1055
|
+
filters: (o = e.config) == null ? void 0 : o.filters,
|
|
1056
|
+
joinPlan: (s = e.config) == null ? void 0 : s.joinPlan,
|
|
1057
|
+
configured: Object.values(i).some((h) => h.length > 0),
|
|
1058
|
+
supportsSql: !0
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
const a = wr(e), r = a.status === "ready" ? a.config : void 0, n = { config: { matrix: r } };
|
|
1062
|
+
return {
|
|
1063
|
+
kind: "matrix",
|
|
1064
|
+
status: a.status,
|
|
1065
|
+
matrix: r,
|
|
1066
|
+
error: a.status === "invalid" ? a.error : void 0,
|
|
1067
|
+
get fields() {
|
|
1068
|
+
return r ? {
|
|
1069
|
+
rows: Be(n, "groupBy", t),
|
|
1070
|
+
columns: Be(n, "pivotBy", t),
|
|
1071
|
+
metrics: Be(n, "metrics", t),
|
|
1072
|
+
details: []
|
|
1073
|
+
} : { rows: [], columns: [], metrics: [], details: [] };
|
|
1074
|
+
},
|
|
1075
|
+
// Repair surfaces must still see authored predicates/joins on an invalid
|
|
1076
|
+
// draft. Validity is reported separately; execution uses its strict boundary.
|
|
1077
|
+
filters: (l = (d = (u = e.config) == null ? void 0 : u.matrix) == null ? void 0 : d.spec) == null ? void 0 : l.filters,
|
|
1078
|
+
joinPlan: (p = (f = (c = e.config) == null ? void 0 : c.matrix) == null ? void 0 : f.spec) == null ? void 0 : p.joinPlan,
|
|
1079
|
+
get configured() {
|
|
1080
|
+
return ha.safeParse(r).success;
|
|
1081
|
+
},
|
|
1082
|
+
supportsSql: !1
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
function xr(e) {
|
|
1086
|
+
return e ? Object.values(Yt({ config: e })).some((t) => t.length > 0) : !1;
|
|
1087
|
+
}
|
|
1088
|
+
function at(e, t) {
|
|
1089
|
+
var n, o;
|
|
1090
|
+
if ((n = e.config) != null && n.matrix) return e.config.matrix;
|
|
1091
|
+
const a = ((o = e.dataSource) == null ? void 0 : o.selectedEntities) ?? [], r = t ?? (a.length === 1 ? Te(a[0], e.dataSource) : void 0);
|
|
1092
|
+
if (!r) throw new Error("Select a base dataset before configuring Matrix fields or filters.");
|
|
1093
|
+
return Na({ source: r, rows: [], columns: [], measures: [], sorts: [], rankings: [] });
|
|
1094
|
+
}
|
|
1095
|
+
function Tr(e, t) {
|
|
1096
|
+
const a = (r) => {
|
|
1097
|
+
const n = t.find(
|
|
1098
|
+
(o) => o.entityName === r.entityName && o.name === r.name
|
|
1099
|
+
);
|
|
1100
|
+
return n ? {
|
|
1101
|
+
...r,
|
|
1102
|
+
label: r.label || n.label,
|
|
1103
|
+
qualifiedFieldName: r.qualifiedFieldName || n.qualifiedFieldName,
|
|
1104
|
+
dataType: r.dataType || n.dataType,
|
|
1105
|
+
...r.nativeDataType || !n.nativeDataType ? {} : { nativeDataType: n.nativeDataType }
|
|
1106
|
+
} : r;
|
|
1107
|
+
};
|
|
1108
|
+
return {
|
|
1109
|
+
...e,
|
|
1110
|
+
joins: e.joins.map((r) => ({
|
|
1111
|
+
...r,
|
|
1112
|
+
joinKeyGroups: r.joinKeyGroups.map((n) => ({
|
|
1113
|
+
...n,
|
|
1114
|
+
keys: n.keys.map((o) => ({ ...o, source: a(o.source), target: a(o.target) }))
|
|
1115
|
+
}))
|
|
1116
|
+
}))
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
var Cr = (e) => {
|
|
1120
|
+
switch (e) {
|
|
1121
|
+
case "success":
|
|
1122
|
+
return Sr;
|
|
1123
|
+
case "info":
|
|
1124
|
+
return kr;
|
|
1125
|
+
case "warning":
|
|
1126
|
+
return Fr;
|
|
1127
|
+
case "error":
|
|
1128
|
+
return Mr;
|
|
1129
|
+
default:
|
|
1130
|
+
return null;
|
|
1131
|
+
}
|
|
1132
|
+
}, Ir = Array(12).fill(0), Er = ({ visible: e, className: t }) => g.createElement("div", { className: ["sonner-loading-wrapper", t].filter(Boolean).join(" "), "data-visible": e }, g.createElement("div", { className: "sonner-spinner" }, Ir.map((a, r) => g.createElement("div", { className: "sonner-loading-bar", key: `spinner-bar-${r}` })))), Sr = g.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, g.createElement("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z", clipRule: "evenodd" })), Fr = g.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", height: "20", width: "20" }, g.createElement("path", { fillRule: "evenodd", d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z", clipRule: "evenodd" })), kr = g.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, g.createElement("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", clipRule: "evenodd" })), Mr = g.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "20", width: "20" }, g.createElement("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" })), _r = g.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }, g.createElement("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), g.createElement("line", { x1: "6", y1: "6", x2: "18", y2: "18" })), Br = () => {
|
|
1133
|
+
let [e, t] = g.useState(document.hidden);
|
|
1134
|
+
return g.useEffect(() => {
|
|
1135
|
+
let a = () => {
|
|
1136
|
+
t(document.hidden);
|
|
1137
|
+
};
|
|
1138
|
+
return document.addEventListener("visibilitychange", a), () => window.removeEventListener("visibilitychange", a);
|
|
1139
|
+
}, []), e;
|
|
1140
|
+
}, We = 1, Rr = class {
|
|
1141
|
+
constructor() {
|
|
1142
|
+
this.subscribe = (e) => (this.subscribers.push(e), () => {
|
|
1143
|
+
let t = this.subscribers.indexOf(e);
|
|
1144
|
+
this.subscribers.splice(t, 1);
|
|
1145
|
+
}), this.publish = (e) => {
|
|
1146
|
+
this.subscribers.forEach((t) => t(e));
|
|
1147
|
+
}, this.addToast = (e) => {
|
|
1148
|
+
this.publish(e), this.toasts = [...this.toasts, e];
|
|
1149
|
+
}, this.create = (e) => {
|
|
1150
|
+
var t;
|
|
1151
|
+
let { message: a, ...r } = e, n = typeof (e == null ? void 0 : e.id) == "number" || ((t = e.id) == null ? void 0 : t.length) > 0 ? e.id : We++, o = this.toasts.find((u) => u.id === n), s = e.dismissible === void 0 ? !0 : e.dismissible;
|
|
1152
|
+
return this.dismissedToasts.has(n) && this.dismissedToasts.delete(n), o ? this.toasts = this.toasts.map((u) => u.id === n ? (this.publish({ ...u, ...e, id: n, title: a }), { ...u, ...e, id: n, dismissible: s, title: a }) : u) : this.addToast({ title: a, ...r, dismissible: s, id: n }), n;
|
|
1153
|
+
}, this.dismiss = (e) => (this.dismissedToasts.add(e), e || this.toasts.forEach((t) => {
|
|
1154
|
+
this.subscribers.forEach((a) => a({ id: t.id, dismiss: !0 }));
|
|
1155
|
+
}), this.subscribers.forEach((t) => t({ id: e, dismiss: !0 })), e), this.message = (e, t) => this.create({ ...t, message: e }), this.error = (e, t) => this.create({ ...t, message: e, type: "error" }), this.success = (e, t) => this.create({ ...t, type: "success", message: e }), this.info = (e, t) => this.create({ ...t, type: "info", message: e }), this.warning = (e, t) => this.create({ ...t, type: "warning", message: e }), this.loading = (e, t) => this.create({ ...t, type: "loading", message: e }), this.promise = (e, t) => {
|
|
1156
|
+
if (!t) return;
|
|
1157
|
+
let a;
|
|
1158
|
+
t.loading !== void 0 && (a = this.create({ ...t, promise: e, type: "loading", message: t.loading, description: typeof t.description != "function" ? t.description : void 0 }));
|
|
1159
|
+
let r = e instanceof Promise ? e : e(), n = a !== void 0, o, s = r.then(async (d) => {
|
|
1160
|
+
if (o = ["resolve", d], g.isValidElement(d)) n = !1, this.create({ id: a, type: "default", message: d });
|
|
1161
|
+
else if (Pr(d) && !d.ok) {
|
|
1162
|
+
n = !1;
|
|
1163
|
+
let l = typeof t.error == "function" ? await t.error(`HTTP error! status: ${d.status}`) : t.error, c = typeof t.description == "function" ? await t.description(`HTTP error! status: ${d.status}`) : t.description;
|
|
1164
|
+
this.create({ id: a, type: "error", message: l, description: c });
|
|
1165
|
+
} else if (t.success !== void 0) {
|
|
1166
|
+
n = !1;
|
|
1167
|
+
let l = typeof t.success == "function" ? await t.success(d) : t.success, c = typeof t.description == "function" ? await t.description(d) : t.description;
|
|
1168
|
+
this.create({ id: a, type: "success", message: l, description: c });
|
|
1169
|
+
}
|
|
1170
|
+
}).catch(async (d) => {
|
|
1171
|
+
if (o = ["reject", d], t.error !== void 0) {
|
|
1172
|
+
n = !1;
|
|
1173
|
+
let l = typeof t.error == "function" ? await t.error(d) : t.error, c = typeof t.description == "function" ? await t.description(d) : t.description;
|
|
1174
|
+
this.create({ id: a, type: "error", message: l, description: c });
|
|
1175
|
+
}
|
|
1176
|
+
}).finally(() => {
|
|
1177
|
+
var d;
|
|
1178
|
+
n && (this.dismiss(a), a = void 0), (d = t.finally) == null || d.call(t);
|
|
1179
|
+
}), u = () => new Promise((d, l) => s.then(() => o[0] === "reject" ? l(o[1]) : d(o[1])).catch(l));
|
|
1180
|
+
return typeof a != "string" && typeof a != "number" ? { unwrap: u } : Object.assign(a, { unwrap: u });
|
|
1181
|
+
}, this.custom = (e, t) => {
|
|
1182
|
+
let a = (t == null ? void 0 : t.id) || We++;
|
|
1183
|
+
return this.create({ jsx: e(a), id: a, ...t }), a;
|
|
1184
|
+
}, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
1185
|
+
}
|
|
1186
|
+
}, L = new Rr(), Nr = (e, t) => {
|
|
1187
|
+
let a = (t == null ? void 0 : t.id) || We++;
|
|
1188
|
+
return L.addToast({ title: e, ...t, id: a }), a;
|
|
1189
|
+
}, Pr = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", Dr = Nr, Ar = () => L.toasts, $r = () => L.getActiveToasts(), Tt = Object.assign(Dr, { success: L.success, info: L.info, warning: L.warning, error: L.error, custom: L.custom, message: L.message, promise: L.promise, dismiss: L.dismiss, loading: L.loading }, { getHistory: Ar, getToasts: $r });
|
|
1190
|
+
function jr(e, { insertAt: t } = {}) {
|
|
1191
|
+
if (typeof document > "u") return;
|
|
1192
|
+
let a = document.head || document.getElementsByTagName("head")[0], r = document.createElement("style");
|
|
1193
|
+
r.type = "text/css", t === "top" && a.firstChild ? a.insertBefore(r, a.firstChild) : a.appendChild(r), r.styleSheet ? r.styleSheet.cssText = e : r.appendChild(document.createTextNode(e));
|
|
1194
|
+
}
|
|
1195
|
+
jr(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
1196
|
+
`);
|
|
1197
|
+
function _e(e) {
|
|
1198
|
+
return e.label !== void 0;
|
|
1199
|
+
}
|
|
1200
|
+
var Or = 3, Lr = "32px", Yr = "16px", Ct = 4e3, qr = 356, Kr = 14, zr = 20, Ur = 200;
|
|
1201
|
+
function V(...e) {
|
|
1202
|
+
return e.filter(Boolean).join(" ");
|
|
1203
|
+
}
|
|
1204
|
+
function Vr(e) {
|
|
1205
|
+
let [t, a] = e.split("-"), r = [];
|
|
1206
|
+
return t && r.push(t), a && r.push(a), r;
|
|
1207
|
+
}
|
|
1208
|
+
var Gr = (e) => {
|
|
1209
|
+
var t, a, r, n, o, s, u, d, l, c, f;
|
|
1210
|
+
let { invert: p, toast: i, unstyled: h, interacting: m, setHeights: y, visibleToasts: b, heights: x, index: w, toasts: I, expanded: F, removeToast: k, defaultRichColors: v, closeButton: S, style: A, cancelButtonStyle: W, actionButtonStyle: te, className: J = "", descriptionClassName: Ie = "", duration: se, position: Ee, gap: ae, loadingIcon: H, expandByDefault: Se, classNames: E, icons: Y, closeButtonAriaLabel: Ae = "Close toast", pauseWhenPageIsHidden: _ } = e, [B, P] = g.useState(null), [j, le] = g.useState(null), [D, $e] = g.useState(!1), [ye, Fe] = g.useState(!1), [he, je] = g.useState(!1), [st, ta] = g.useState(!1), [aa, lt] = g.useState(!1), [ra, Oe] = g.useState(0), [na, dt] = g.useState(0), be = g.useRef(i.duration || se || Ct), ct = g.useRef(null), re = g.useRef(null), oa = w === 0, ia = w + 1 <= b, q = i.type, de = i.dismissible !== !1, sa = i.className || "", la = i.descriptionClassName || "", ke = g.useMemo(() => x.findIndex((T) => T.toastId === i.id) || 0, [x, i.id]), da = g.useMemo(() => {
|
|
1211
|
+
var T;
|
|
1212
|
+
return (T = i.closeButton) != null ? T : S;
|
|
1213
|
+
}, [i.closeButton, S]), ut = g.useMemo(() => i.duration || se || Ct, [i.duration, se]), Le = g.useRef(0), ce = g.useRef(0), ft = g.useRef(0), ue = g.useRef(null), [ca, ua] = Ee.split("-"), mt = g.useMemo(() => x.reduce((T, M, N) => N >= ke ? T : T + M.height, 0), [x, ke]), pt = Br(), fa = i.invert || p, Ye = q === "loading";
|
|
1214
|
+
ce.current = g.useMemo(() => ke * ae + mt, [ke, mt]), g.useEffect(() => {
|
|
1215
|
+
be.current = ut;
|
|
1216
|
+
}, [ut]), g.useEffect(() => {
|
|
1217
|
+
$e(!0);
|
|
1218
|
+
}, []), g.useEffect(() => {
|
|
1219
|
+
let T = re.current;
|
|
1220
|
+
if (T) {
|
|
1221
|
+
let M = T.getBoundingClientRect().height;
|
|
1222
|
+
return dt(M), y((N) => [{ toastId: i.id, height: M, position: i.position }, ...N]), () => y((N) => N.filter((K) => K.toastId !== i.id));
|
|
1223
|
+
}
|
|
1224
|
+
}, [y, i.id]), g.useLayoutEffect(() => {
|
|
1225
|
+
if (!D) return;
|
|
1226
|
+
let T = re.current, M = T.style.height;
|
|
1227
|
+
T.style.height = "auto";
|
|
1228
|
+
let N = T.getBoundingClientRect().height;
|
|
1229
|
+
T.style.height = M, dt(N), y((K) => K.find((z) => z.toastId === i.id) ? K.map((z) => z.toastId === i.id ? { ...z, height: N } : z) : [{ toastId: i.id, height: N, position: i.position }, ...K]);
|
|
1230
|
+
}, [D, i.title, i.description, y, i.id]);
|
|
1231
|
+
let Q = g.useCallback(() => {
|
|
1232
|
+
Fe(!0), Oe(ce.current), y((T) => T.filter((M) => M.toastId !== i.id)), setTimeout(() => {
|
|
1233
|
+
k(i);
|
|
1234
|
+
}, Ur);
|
|
1235
|
+
}, [i, k, y, ce]);
|
|
1236
|
+
g.useEffect(() => {
|
|
1237
|
+
if (i.promise && q === "loading" || i.duration === 1 / 0 || i.type === "loading") return;
|
|
1238
|
+
let T;
|
|
1239
|
+
return F || m || _ && pt ? (() => {
|
|
1240
|
+
if (ft.current < Le.current) {
|
|
1241
|
+
let M = (/* @__PURE__ */ new Date()).getTime() - Le.current;
|
|
1242
|
+
be.current = be.current - M;
|
|
1243
|
+
}
|
|
1244
|
+
ft.current = (/* @__PURE__ */ new Date()).getTime();
|
|
1245
|
+
})() : be.current !== 1 / 0 && (Le.current = (/* @__PURE__ */ new Date()).getTime(), T = setTimeout(() => {
|
|
1246
|
+
var M;
|
|
1247
|
+
(M = i.onAutoClose) == null || M.call(i, i), Q();
|
|
1248
|
+
}, be.current)), () => clearTimeout(T);
|
|
1249
|
+
}, [F, m, i, q, _, pt, Q]), g.useEffect(() => {
|
|
1250
|
+
i.delete && Q();
|
|
1251
|
+
}, [Q, i.delete]);
|
|
1252
|
+
function ma() {
|
|
1253
|
+
var T, M, N;
|
|
1254
|
+
return Y != null && Y.loading ? g.createElement("div", { className: V(E == null ? void 0 : E.loader, (T = i == null ? void 0 : i.classNames) == null ? void 0 : T.loader, "sonner-loader"), "data-visible": q === "loading" }, Y.loading) : H ? g.createElement("div", { className: V(E == null ? void 0 : E.loader, (M = i == null ? void 0 : i.classNames) == null ? void 0 : M.loader, "sonner-loader"), "data-visible": q === "loading" }, H) : g.createElement(Er, { className: V(E == null ? void 0 : E.loader, (N = i == null ? void 0 : i.classNames) == null ? void 0 : N.loader), visible: q === "loading" });
|
|
1255
|
+
}
|
|
1256
|
+
return g.createElement("li", { tabIndex: 0, ref: re, className: V(J, sa, E == null ? void 0 : E.toast, (t = i == null ? void 0 : i.classNames) == null ? void 0 : t.toast, E == null ? void 0 : E.default, E == null ? void 0 : E[q], (a = i == null ? void 0 : i.classNames) == null ? void 0 : a[q]), "data-sonner-toast": "", "data-rich-colors": (r = i.richColors) != null ? r : v, "data-styled": !(i.jsx || i.unstyled || h), "data-mounted": D, "data-promise": !!i.promise, "data-swiped": aa, "data-removed": ye, "data-visible": ia, "data-y-position": ca, "data-x-position": ua, "data-index": w, "data-front": oa, "data-swiping": he, "data-dismissible": de, "data-type": q, "data-invert": fa, "data-swipe-out": st, "data-swipe-direction": j, "data-expanded": !!(F || Se && D), style: { "--index": w, "--toasts-before": w, "--z-index": I.length - w, "--offset": `${ye ? ra : ce.current}px`, "--initial-height": Se ? "auto" : `${na}px`, ...A, ...i.style }, onDragEnd: () => {
|
|
1257
|
+
je(!1), P(null), ue.current = null;
|
|
1258
|
+
}, onPointerDown: (T) => {
|
|
1259
|
+
Ye || !de || (ct.current = /* @__PURE__ */ new Date(), Oe(ce.current), T.target.setPointerCapture(T.pointerId), T.target.tagName !== "BUTTON" && (je(!0), ue.current = { x: T.clientX, y: T.clientY }));
|
|
1260
|
+
}, onPointerUp: () => {
|
|
1261
|
+
var T, M, N, K;
|
|
1262
|
+
if (st || !de) return;
|
|
1263
|
+
ue.current = null;
|
|
1264
|
+
let z = Number(((T = re.current) == null ? void 0 : T.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), X = Number(((M = re.current) == null ? void 0 : M.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), ne = (/* @__PURE__ */ new Date()).getTime() - ((N = ct.current) == null ? void 0 : N.getTime()), U = B === "x" ? z : X, Z = Math.abs(U) / ne;
|
|
1265
|
+
if (Math.abs(U) >= zr || Z > 0.11) {
|
|
1266
|
+
Oe(ce.current), (K = i.onDismiss) == null || K.call(i, i), le(B === "x" ? z > 0 ? "right" : "left" : X > 0 ? "down" : "up"), Q(), ta(!0), lt(!1);
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
je(!1), P(null);
|
|
1270
|
+
}, onPointerMove: (T) => {
|
|
1271
|
+
var M, N, K, z;
|
|
1272
|
+
if (!ue.current || !de || ((M = window.getSelection()) == null ? void 0 : M.toString().length) > 0) return;
|
|
1273
|
+
let X = T.clientY - ue.current.y, ne = T.clientX - ue.current.x, U = (N = e.swipeDirections) != null ? N : Vr(Ee);
|
|
1274
|
+
!B && (Math.abs(ne) > 1 || Math.abs(X) > 1) && P(Math.abs(ne) > Math.abs(X) ? "x" : "y");
|
|
1275
|
+
let Z = { x: 0, y: 0 };
|
|
1276
|
+
B === "y" ? (U.includes("top") || U.includes("bottom")) && (U.includes("top") && X < 0 || U.includes("bottom") && X > 0) && (Z.y = X) : B === "x" && (U.includes("left") || U.includes("right")) && (U.includes("left") && ne < 0 || U.includes("right") && ne > 0) && (Z.x = ne), (Math.abs(Z.x) > 0 || Math.abs(Z.y) > 0) && lt(!0), (K = re.current) == null || K.style.setProperty("--swipe-amount-x", `${Z.x}px`), (z = re.current) == null || z.style.setProperty("--swipe-amount-y", `${Z.y}px`);
|
|
1277
|
+
} }, da && !i.jsx ? g.createElement("button", { "aria-label": Ae, "data-disabled": Ye, "data-close-button": !0, onClick: Ye || !de ? () => {
|
|
1278
|
+
} : () => {
|
|
1279
|
+
var T;
|
|
1280
|
+
Q(), (T = i.onDismiss) == null || T.call(i, i);
|
|
1281
|
+
}, className: V(E == null ? void 0 : E.closeButton, (n = i == null ? void 0 : i.classNames) == null ? void 0 : n.closeButton) }, (o = Y == null ? void 0 : Y.close) != null ? o : _r) : null, i.jsx || qe(i.title) ? i.jsx ? i.jsx : typeof i.title == "function" ? i.title() : i.title : g.createElement(g.Fragment, null, q || i.icon || i.promise ? g.createElement("div", { "data-icon": "", className: V(E == null ? void 0 : E.icon, (s = i == null ? void 0 : i.classNames) == null ? void 0 : s.icon) }, i.promise || i.type === "loading" && !i.icon ? i.icon || ma() : null, i.type !== "loading" ? i.icon || (Y == null ? void 0 : Y[q]) || Cr(q) : null) : null, g.createElement("div", { "data-content": "", className: V(E == null ? void 0 : E.content, (u = i == null ? void 0 : i.classNames) == null ? void 0 : u.content) }, g.createElement("div", { "data-title": "", className: V(E == null ? void 0 : E.title, (d = i == null ? void 0 : i.classNames) == null ? void 0 : d.title) }, typeof i.title == "function" ? i.title() : i.title), i.description ? g.createElement("div", { "data-description": "", className: V(Ie, la, E == null ? void 0 : E.description, (l = i == null ? void 0 : i.classNames) == null ? void 0 : l.description) }, typeof i.description == "function" ? i.description() : i.description) : null), qe(i.cancel) ? i.cancel : i.cancel && _e(i.cancel) ? g.createElement("button", { "data-button": !0, "data-cancel": !0, style: i.cancelButtonStyle || W, onClick: (T) => {
|
|
1282
|
+
var M, N;
|
|
1283
|
+
_e(i.cancel) && de && ((N = (M = i.cancel).onClick) == null || N.call(M, T), Q());
|
|
1284
|
+
}, className: V(E == null ? void 0 : E.cancelButton, (c = i == null ? void 0 : i.classNames) == null ? void 0 : c.cancelButton) }, i.cancel.label) : null, qe(i.action) ? i.action : i.action && _e(i.action) ? g.createElement("button", { "data-button": !0, "data-action": !0, style: i.actionButtonStyle || te, onClick: (T) => {
|
|
1285
|
+
var M, N;
|
|
1286
|
+
_e(i.action) && ((N = (M = i.action).onClick) == null || N.call(M, T), !T.defaultPrevented && Q());
|
|
1287
|
+
}, className: V(E == null ? void 0 : E.actionButton, (f = i == null ? void 0 : i.classNames) == null ? void 0 : f.actionButton) }, i.action.label) : null));
|
|
1288
|
+
};
|
|
1289
|
+
function It() {
|
|
1290
|
+
if (typeof window > "u" || typeof document > "u") return "ltr";
|
|
1291
|
+
let e = document.documentElement.getAttribute("dir");
|
|
1292
|
+
return e === "auto" || !e ? window.getComputedStyle(document.documentElement).direction : e;
|
|
1293
|
+
}
|
|
1294
|
+
function Jr(e, t) {
|
|
1295
|
+
let a = {};
|
|
1296
|
+
return [e, t].forEach((r, n) => {
|
|
1297
|
+
let o = n === 1, s = o ? "--mobile-offset" : "--offset", u = o ? Yr : Lr;
|
|
1298
|
+
function d(l) {
|
|
1299
|
+
["top", "right", "bottom", "left"].forEach((c) => {
|
|
1300
|
+
a[`${s}-${c}`] = typeof l == "number" ? `${l}px` : l;
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
typeof r == "number" || typeof r == "string" ? d(r) : typeof r == "object" ? ["top", "right", "bottom", "left"].forEach((l) => {
|
|
1304
|
+
r[l] === void 0 ? a[`${s}-${l}`] = u : a[`${s}-${l}`] = typeof r[l] == "number" ? `${r[l]}px` : r[l];
|
|
1305
|
+
}) : d(u);
|
|
1306
|
+
}), a;
|
|
1307
|
+
}
|
|
1308
|
+
var lo = Aa(function(e, t) {
|
|
1309
|
+
let { invert: a, position: r = "bottom-right", hotkey: n = ["altKey", "KeyT"], expand: o, closeButton: s, className: u, offset: d, mobileOffset: l, theme: c = "light", richColors: f, duration: p, style: i, visibleToasts: h = Or, toastOptions: m, dir: y = It(), gap: b = Kr, loadingIcon: x, icons: w, containerAriaLabel: I = "Notifications", pauseWhenPageIsHidden: F } = e, [k, v] = g.useState([]), S = g.useMemo(() => Array.from(new Set([r].concat(k.filter((_) => _.position).map((_) => _.position)))), [k, r]), [A, W] = g.useState([]), [te, J] = g.useState(!1), [Ie, se] = g.useState(!1), [Ee, ae] = g.useState(c !== "system" ? c : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), H = g.useRef(null), Se = n.join("+").replace(/Key/g, "").replace(/Digit/g, ""), E = g.useRef(null), Y = g.useRef(!1), Ae = g.useCallback((_) => {
|
|
1310
|
+
v((B) => {
|
|
1311
|
+
var P;
|
|
1312
|
+
return (P = B.find((j) => j.id === _.id)) != null && P.delete || L.dismiss(_.id), B.filter(({ id: j }) => j !== _.id);
|
|
1313
|
+
});
|
|
1314
|
+
}, []);
|
|
1315
|
+
return g.useEffect(() => L.subscribe((_) => {
|
|
1316
|
+
if (_.dismiss) {
|
|
1317
|
+
v((B) => B.map((P) => P.id === _.id ? { ...P, delete: !0 } : P));
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
setTimeout(() => {
|
|
1321
|
+
$a.flushSync(() => {
|
|
1322
|
+
v((B) => {
|
|
1323
|
+
let P = B.findIndex((j) => j.id === _.id);
|
|
1324
|
+
return P !== -1 ? [...B.slice(0, P), { ...B[P], ..._ }, ...B.slice(P + 1)] : [_, ...B];
|
|
1325
|
+
});
|
|
1326
|
+
});
|
|
1327
|
+
});
|
|
1328
|
+
}), []), g.useEffect(() => {
|
|
1329
|
+
if (c !== "system") {
|
|
1330
|
+
ae(c);
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
if (c === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? ae("dark") : ae("light")), typeof window > "u") return;
|
|
1334
|
+
let _ = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1335
|
+
try {
|
|
1336
|
+
_.addEventListener("change", ({ matches: B }) => {
|
|
1337
|
+
ae(B ? "dark" : "light");
|
|
1338
|
+
});
|
|
1339
|
+
} catch {
|
|
1340
|
+
_.addListener(({ matches: P }) => {
|
|
1341
|
+
try {
|
|
1342
|
+
ae(P ? "dark" : "light");
|
|
1343
|
+
} catch (j) {
|
|
1344
|
+
console.error(j);
|
|
1345
|
+
}
|
|
1346
|
+
});
|
|
1347
|
+
}
|
|
1348
|
+
}, [c]), g.useEffect(() => {
|
|
1349
|
+
k.length <= 1 && J(!1);
|
|
1350
|
+
}, [k]), g.useEffect(() => {
|
|
1351
|
+
let _ = (B) => {
|
|
1352
|
+
var P, j;
|
|
1353
|
+
n.every((le) => B[le] || B.code === le) && (J(!0), (P = H.current) == null || P.focus()), B.code === "Escape" && (document.activeElement === H.current || (j = H.current) != null && j.contains(document.activeElement)) && J(!1);
|
|
1354
|
+
};
|
|
1355
|
+
return document.addEventListener("keydown", _), () => document.removeEventListener("keydown", _);
|
|
1356
|
+
}, [n]), g.useEffect(() => {
|
|
1357
|
+
if (H.current) return () => {
|
|
1358
|
+
E.current && (E.current.focus({ preventScroll: !0 }), E.current = null, Y.current = !1);
|
|
1359
|
+
};
|
|
1360
|
+
}, [H.current]), g.createElement("section", { ref: t, "aria-label": `${I} ${Se}`, tabIndex: -1, "aria-live": "polite", "aria-relevant": "additions text", "aria-atomic": "false", suppressHydrationWarning: !0 }, S.map((_, B) => {
|
|
1361
|
+
var P;
|
|
1362
|
+
let [j, le] = _.split("-");
|
|
1363
|
+
return k.length ? g.createElement("ol", { key: _, dir: y === "auto" ? It() : y, tabIndex: -1, ref: H, className: u, "data-sonner-toaster": !0, "data-theme": Ee, "data-y-position": j, "data-lifted": te && k.length > 1 && !o, "data-x-position": le, style: { "--front-toast-height": `${((P = A[0]) == null ? void 0 : P.height) || 0}px`, "--width": `${qr}px`, "--gap": `${b}px`, ...i, ...Jr(d, l) }, onBlur: (D) => {
|
|
1364
|
+
Y.current && !D.currentTarget.contains(D.relatedTarget) && (Y.current = !1, E.current && (E.current.focus({ preventScroll: !0 }), E.current = null));
|
|
1365
|
+
}, onFocus: (D) => {
|
|
1366
|
+
D.target instanceof HTMLElement && D.target.dataset.dismissible === "false" || Y.current || (Y.current = !0, E.current = D.relatedTarget);
|
|
1367
|
+
}, onMouseEnter: () => J(!0), onMouseMove: () => J(!0), onMouseLeave: () => {
|
|
1368
|
+
Ie || J(!1);
|
|
1369
|
+
}, onDragEnd: () => J(!1), onPointerDown: (D) => {
|
|
1370
|
+
D.target instanceof HTMLElement && D.target.dataset.dismissible === "false" || se(!0);
|
|
1371
|
+
}, onPointerUp: () => se(!1) }, k.filter((D) => !D.position && B === 0 || D.position === _).map((D, $e) => {
|
|
1372
|
+
var ye, Fe;
|
|
1373
|
+
return g.createElement(Gr, { key: D.id, icons: w, index: $e, toast: D, defaultRichColors: f, duration: (ye = m == null ? void 0 : m.duration) != null ? ye : p, className: m == null ? void 0 : m.className, descriptionClassName: m == null ? void 0 : m.descriptionClassName, invert: a, visibleToasts: h, closeButton: (Fe = m == null ? void 0 : m.closeButton) != null ? Fe : s, interacting: Ie, position: _, style: m == null ? void 0 : m.style, unstyled: m == null ? void 0 : m.unstyled, classNames: m == null ? void 0 : m.classNames, cancelButtonStyle: m == null ? void 0 : m.cancelButtonStyle, actionButtonStyle: m == null ? void 0 : m.actionButtonStyle, removeToast: Ae, toasts: k.filter((he) => he.position == D.position), heights: A.filter((he) => he.position == D.position), setHeights: W, expandByDefault: o, gap: b, loadingIcon: x, expanded: te, pauseWhenPageIsHidden: F, swipeDirections: e.swipeDirections });
|
|
1374
|
+
})) : null;
|
|
1375
|
+
}));
|
|
1376
|
+
});
|
|
1377
|
+
function qt(e) {
|
|
1378
|
+
if (e.type === "model")
|
|
1379
|
+
return `${yr}.${e.name}`;
|
|
1380
|
+
if (e.type === "dataset") {
|
|
1381
|
+
if (e.database && e.schema)
|
|
1382
|
+
return `${e.database}.${e.schema}.${e.name}`;
|
|
1383
|
+
if (e.schema)
|
|
1384
|
+
return `${e.schema}.${e.name}`;
|
|
1385
|
+
if (e.database)
|
|
1386
|
+
return `${e.database}.${e.name}`;
|
|
1387
|
+
}
|
|
1388
|
+
if (gr.includes(e.type)) {
|
|
1389
|
+
if (e.database && e.schema)
|
|
1390
|
+
return `${e.database}.${e.schema}.${e.name}`;
|
|
1391
|
+
if (e.schema)
|
|
1392
|
+
return `${e.schema}.${e.name}`;
|
|
1393
|
+
if (e.database)
|
|
1394
|
+
return `${e.database}.${e.name}`;
|
|
1395
|
+
}
|
|
1396
|
+
return e.name;
|
|
1397
|
+
}
|
|
1398
|
+
function Kt(e) {
|
|
1399
|
+
return e === "unreachable" || e === "setup" || e === "absent";
|
|
1400
|
+
}
|
|
1401
|
+
function Hr(e, t, a, r) {
|
|
1402
|
+
const n = e, o = t;
|
|
1403
|
+
if (n === o)
|
|
1404
|
+
return !0;
|
|
1405
|
+
const s = /* @__PURE__ */ new Map();
|
|
1406
|
+
for (const l of a) {
|
|
1407
|
+
const c = r(l.source), f = r(l.target);
|
|
1408
|
+
s.has(c) || s.set(c, /* @__PURE__ */ new Set()), s.get(c).add(f), s.has(f) || s.set(f, /* @__PURE__ */ new Set()), s.get(f).add(c);
|
|
1409
|
+
}
|
|
1410
|
+
const u = /* @__PURE__ */ new Set(), d = [n];
|
|
1411
|
+
for (u.add(n); d.length > 0; ) {
|
|
1412
|
+
const l = d.shift(), c = s.get(l);
|
|
1413
|
+
if (c)
|
|
1414
|
+
for (const f of c) {
|
|
1415
|
+
if (f === o)
|
|
1416
|
+
return !0;
|
|
1417
|
+
u.has(f) || (u.add(f), d.push(f));
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
return !1;
|
|
1421
|
+
}
|
|
1422
|
+
function pe(e) {
|
|
1423
|
+
return (e == null ? void 0 : e.trim()) || null;
|
|
1424
|
+
}
|
|
1425
|
+
function Wr(e) {
|
|
1426
|
+
const t = /* @__PURE__ */ new Set(), a = pe(e.table), r = pe(e.schema), n = pe(e.catalog);
|
|
1427
|
+
return a && (t.add(a), r && t.add(`${r}.${a}`), n && t.add(`${n}.${a}`), n && r && t.add(`${n}.${r}.${a}`)), Array.from(t);
|
|
1428
|
+
}
|
|
1429
|
+
function Qr(e) {
|
|
1430
|
+
const t = /* @__PURE__ */ new Map();
|
|
1431
|
+
for (const r of e || []) {
|
|
1432
|
+
const n = pe(r.name);
|
|
1433
|
+
if (!n) continue;
|
|
1434
|
+
const o = /* @__PURE__ */ new Set([n, ...Wr(r)]);
|
|
1435
|
+
for (const s of o)
|
|
1436
|
+
t.has(s) || t.set(s, /* @__PURE__ */ new Set()), t.get(s).add(n);
|
|
1437
|
+
}
|
|
1438
|
+
const a = /* @__PURE__ */ new Map();
|
|
1439
|
+
for (const [r, n] of t.entries())
|
|
1440
|
+
n.size === 1 && a.set(r, Array.from(n)[0]);
|
|
1441
|
+
return a;
|
|
1442
|
+
}
|
|
1443
|
+
const Et = {
|
|
1444
|
+
base: 0,
|
|
1445
|
+
draggable: 1,
|
|
1446
|
+
indirect: 2,
|
|
1447
|
+
setup: 3,
|
|
1448
|
+
unreachable: 4,
|
|
1449
|
+
absent: 5
|
|
1450
|
+
}, Xr = "Checking availability…", zt = (e) => ba(e);
|
|
1451
|
+
function rt(e, t, a) {
|
|
1452
|
+
var p, i, h, m, y, b, x;
|
|
1453
|
+
const r = a.identity.resolve(e) || e, n = a.identity.label(t), o = a.identity.label(r);
|
|
1454
|
+
if (r === t)
|
|
1455
|
+
return { state: "base", tooltip: "From base dataset", verified: !0 };
|
|
1456
|
+
if ((i = (p = a.joinPlan) == null ? void 0 : p.joins) != null && i.length && Hr(t, r, a.joinPlan.joins, a.identity.ofEntity))
|
|
1457
|
+
return { state: "draggable", tooltip: "Manual join configured", verified: !0 };
|
|
1458
|
+
if (!a.joinabilityMap)
|
|
1459
|
+
return {
|
|
1460
|
+
state: "unreachable",
|
|
1461
|
+
tooltip: `${o} is not joined to ${n}`,
|
|
1462
|
+
reason: `${o} is not joined to ${n} on this visual.`,
|
|
1463
|
+
action: "Configure the join on this visual.",
|
|
1464
|
+
mentions: [o, n],
|
|
1465
|
+
verified: !0
|
|
1466
|
+
};
|
|
1467
|
+
const s = a.joinabilityMap[t];
|
|
1468
|
+
if (!s)
|
|
1469
|
+
return {
|
|
1470
|
+
state: "unreachable",
|
|
1471
|
+
tooltip: "No relationships defined for base dataset",
|
|
1472
|
+
reason: `No relationships are defined for ${n}.`,
|
|
1473
|
+
action: "Define a relationship in the semantic domain, or configure a join on this visual.",
|
|
1474
|
+
mentions: [n],
|
|
1475
|
+
verified: !0
|
|
1476
|
+
};
|
|
1477
|
+
if (s.canJoinTo.map((w) => a.identity.resolve(w)).filter(Boolean).includes(r)) {
|
|
1478
|
+
const w = ((h = s.ambiguousJoins) == null ? void 0 : h[r]) ?? ((m = s.ambiguousJoins) == null ? void 0 : m[e]);
|
|
1479
|
+
return {
|
|
1480
|
+
state: "draggable",
|
|
1481
|
+
tooltip: `Direct join from ${n}`,
|
|
1482
|
+
joinPath: [t, r],
|
|
1483
|
+
reason: w && w > 1 ? `${w} relationships connect ${o} and ${n}; the highest-priority one is used.` : void 0,
|
|
1484
|
+
mentions: w && w > 1 ? [o, n] : void 0,
|
|
1485
|
+
verified: !0
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
const d = ((y = s.indirectJoins) == null ? void 0 : y[r]) || ((b = s.indirectJoins) == null ? void 0 : b[e]);
|
|
1489
|
+
if (d && d.length > 0) {
|
|
1490
|
+
const w = [t, ...d.map((F) => a.identity.resolve(F)), r].filter(
|
|
1491
|
+
Boolean
|
|
1492
|
+
), I = w.map((F) => a.identity.label(F));
|
|
1493
|
+
return {
|
|
1494
|
+
state: "indirect",
|
|
1495
|
+
joinPath: w,
|
|
1496
|
+
joinPathLabels: I,
|
|
1497
|
+
tooltip: `Multi-hop join: ${I.join(" → ")}`,
|
|
1498
|
+
verified: !0
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
const l = a.joinabilityMap[r] || a.joinabilityMap[e];
|
|
1502
|
+
if (l) {
|
|
1503
|
+
if (l.canJoinTo.map((F) => a.identity.resolve(F)).filter(Boolean).includes(t))
|
|
1504
|
+
return {
|
|
1505
|
+
state: "draggable",
|
|
1506
|
+
tooltip: `Direct join to ${n}`,
|
|
1507
|
+
joinPath: [r, t],
|
|
1508
|
+
verified: !0
|
|
1509
|
+
};
|
|
1510
|
+
const I = (x = l.indirectJoins) == null ? void 0 : x[t];
|
|
1511
|
+
if (I && I.length > 0) {
|
|
1512
|
+
const F = [r, ...I.map((v) => a.identity.resolve(v)), t].filter(
|
|
1513
|
+
Boolean
|
|
1514
|
+
), k = F.map((v) => a.identity.label(v));
|
|
1515
|
+
return {
|
|
1516
|
+
state: "indirect",
|
|
1517
|
+
joinPath: F,
|
|
1518
|
+
joinPathLabels: k,
|
|
1519
|
+
tooltip: `Multi-hop join: ${k.join(" → ")}`,
|
|
1520
|
+
verified: !0
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
const c = (s.manualJoins || []).map((w) => a.identity.resolve(w)), f = ((l == null ? void 0 : l.manualJoins) || []).map((w) => a.identity.resolve(w));
|
|
1525
|
+
return c.includes(r) || f.includes(t) ? {
|
|
1526
|
+
state: "setup",
|
|
1527
|
+
tooltip: `Requires setup: ${o} is not set to join automatically`,
|
|
1528
|
+
reason: `${o} is related to ${n}, but the relationship is not set to join automatically.`,
|
|
1529
|
+
action: "Enable automatic join on the relationship, or configure the join on this visual.",
|
|
1530
|
+
mentions: [o, n],
|
|
1531
|
+
verified: !0
|
|
1532
|
+
} : {
|
|
1533
|
+
state: "unreachable",
|
|
1534
|
+
tooltip: `Cannot join ${r} to ${t}`,
|
|
1535
|
+
reason: `No relationship connects ${o} to ${n}.`,
|
|
1536
|
+
action: "Define a relationship in the semantic domain, or configure a join on this visual.",
|
|
1537
|
+
mentions: [o, n],
|
|
1538
|
+
verified: !0
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
function Qe(e) {
|
|
1542
|
+
const t = Qr(e.datasetAliases), a = e.hasSemanticDomain === !1, r = (s) => {
|
|
1543
|
+
const u = pe(s);
|
|
1544
|
+
if (u)
|
|
1545
|
+
return t.get(u) || u;
|
|
1546
|
+
}, n = (s, u) => a && pe(u) || r(s), o = (s) => {
|
|
1547
|
+
const u = Oa(s);
|
|
1548
|
+
return u ? n(u.entityName, u.qualifiedEntityName) : void 0;
|
|
1549
|
+
};
|
|
1550
|
+
return {
|
|
1551
|
+
resolve: r,
|
|
1552
|
+
ofField: (s) => n(s.entityName, s.qualifiedEntityName) || o(s.source),
|
|
1553
|
+
ofDependency: (s) => n(s.entityName || void 0, s.qualifiedEntityName) || s.entityName || s.qualifiedEntityName || "",
|
|
1554
|
+
ofEntity: (s) => a ? qt(s) || s.name : r(s.name) || s.name,
|
|
1555
|
+
label: (s) => ja(s, e.datasetLabels),
|
|
1556
|
+
catalogLabel: (s) => {
|
|
1557
|
+
var u;
|
|
1558
|
+
return (u = e.datasetLabels) == null ? void 0 : u[s];
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
}
|
|
1562
|
+
function Ut(e, t) {
|
|
1563
|
+
var h;
|
|
1564
|
+
const { selectedFields: a, joinPlan: r, autoJoinMetadata: n, baseEntityName: o, dataSourceEntities: s } = e, u = St(
|
|
1565
|
+
a.flatMap(
|
|
1566
|
+
(m) => zt(m) ? Rt(m).datasets.map(t.ofDependency) : [t.ofField(m)]
|
|
1567
|
+
)
|
|
1568
|
+
), d = u.length > 0, l = St(
|
|
1569
|
+
(s || []).map((m) => t.ofEntity(m))
|
|
1570
|
+
), c = d ? u : l, f = r != null && r.baseEntity ? t.ofEntity(r.baseEntity) : void 0, p = (h = n == null ? void 0 : n.resolvedJoinPlan) != null && h.baseEntity ? t.ofEntity(n.resolvedJoinPlan.baseEntity) : void 0, i = o ? t.resolve(o) : void 0;
|
|
1571
|
+
return {
|
|
1572
|
+
selectedDatasets: u,
|
|
1573
|
+
hasSelection: d,
|
|
1574
|
+
dataSourceDatasets: l,
|
|
1575
|
+
visualDatasets: c,
|
|
1576
|
+
anchoredOnDataSource: !d && l.length > 0,
|
|
1577
|
+
baseDataset: f || p || i || c[0]
|
|
1578
|
+
};
|
|
1579
|
+
}
|
|
1580
|
+
function Zr(e) {
|
|
1581
|
+
switch (e) {
|
|
1582
|
+
case "setup":
|
|
1583
|
+
return { tag: "Needs setup", toastTitle: "Join setup required" };
|
|
1584
|
+
case "unreachable":
|
|
1585
|
+
return { tag: "Not connected", toastTitle: "Cannot add this field" };
|
|
1586
|
+
case "absent":
|
|
1587
|
+
return { tag: "Not selected", toastTitle: "Dataset not selected" };
|
|
1588
|
+
default:
|
|
1589
|
+
return { tag: null, toastTitle: "Cannot add this field" };
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
const Vt = "Select to establish base dataset";
|
|
1593
|
+
function en(e, t) {
|
|
1594
|
+
const { joinabilityMap: a, selectedFields: r, joinPlan: n, hasSemanticDomain: o } = t, s = Qe(t), u = s.ofField(e), d = r.some((m) => m.id && e.id && m.id === e.id ? !0 : s.ofField(m) === u && m.name === e.name);
|
|
1595
|
+
if (!a && o === void 0)
|
|
1596
|
+
return { state: "draggable", isSelected: d };
|
|
1597
|
+
if (!a && o)
|
|
1598
|
+
return {
|
|
1599
|
+
state: "draggable",
|
|
1600
|
+
tooltip: Xr,
|
|
1601
|
+
verified: !1,
|
|
1602
|
+
isSelected: d
|
|
1603
|
+
};
|
|
1604
|
+
const { hasSelection: l, visualDatasets: c, anchoredOnDataSource: f, baseDataset: p } = Ut(t, s), i = { joinabilityMap: a, joinPlan: n, identity: s };
|
|
1605
|
+
if (zt(e))
|
|
1606
|
+
return tn(e, {
|
|
1607
|
+
baseDataset: p,
|
|
1608
|
+
hasSelection: l,
|
|
1609
|
+
visualDatasets: c,
|
|
1610
|
+
anchoredOnDataSource: f,
|
|
1611
|
+
evalCtx: i,
|
|
1612
|
+
isAlreadySelected: d
|
|
1613
|
+
});
|
|
1614
|
+
if (!l || !p)
|
|
1615
|
+
return {
|
|
1616
|
+
state: "draggable",
|
|
1617
|
+
tooltip: Vt,
|
|
1618
|
+
verified: !0
|
|
1619
|
+
};
|
|
1620
|
+
const h = rt(
|
|
1621
|
+
u || e.entityName,
|
|
1622
|
+
p,
|
|
1623
|
+
i
|
|
1624
|
+
);
|
|
1625
|
+
return h.state === "base" ? {
|
|
1626
|
+
...h,
|
|
1627
|
+
tooltip: d ? "Field already in query (base dataset)" : "From base dataset",
|
|
1628
|
+
isSelected: d
|
|
1629
|
+
} : { ...h, isSelected: d };
|
|
1630
|
+
}
|
|
1631
|
+
function co(e) {
|
|
1632
|
+
const { joinabilityMap: t, joinPlan: a, hasSemanticDomain: r, dataSourceEntities: n } = e, o = n || [];
|
|
1633
|
+
if (o.length === 0) return [];
|
|
1634
|
+
const s = Qe(e), u = {};
|
|
1635
|
+
o.forEach((i) => {
|
|
1636
|
+
const h = i.label;
|
|
1637
|
+
typeof h == "string" && h && (u[s.ofEntity(i)] = h);
|
|
1638
|
+
});
|
|
1639
|
+
const d = Qe({
|
|
1640
|
+
...e,
|
|
1641
|
+
datasetLabels: { ...u, ...e.datasetLabels || {} }
|
|
1642
|
+
}), l = o.map((i) => d.ofEntity(i)), c = (i, h) => d.label(h);
|
|
1643
|
+
if (!t && r !== !1)
|
|
1644
|
+
return o.map((i, h) => ({
|
|
1645
|
+
entityName: l[h],
|
|
1646
|
+
label: c(i, l[h]),
|
|
1647
|
+
state: "draggable"
|
|
1648
|
+
}));
|
|
1649
|
+
const f = Ut({ ...e, dataSourceEntities: o }, d).baseDataset || l[0], p = { joinabilityMap: t, joinPlan: a, identity: d };
|
|
1650
|
+
return o.map((i, h) => {
|
|
1651
|
+
const m = l[h], y = c(i, m);
|
|
1652
|
+
if (m === f) return { entityName: m, label: y, state: "base" };
|
|
1653
|
+
const b = rt(m, f, p);
|
|
1654
|
+
return {
|
|
1655
|
+
entityName: m,
|
|
1656
|
+
label: y,
|
|
1657
|
+
state: b.state,
|
|
1658
|
+
reason: b.reason,
|
|
1659
|
+
action: b.action,
|
|
1660
|
+
mentions: b.mentions
|
|
1661
|
+
};
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
function St(e) {
|
|
1665
|
+
const t = [];
|
|
1666
|
+
return e.forEach((a) => {
|
|
1667
|
+
a && !t.includes(a) && t.push(a);
|
|
1668
|
+
}), t;
|
|
1669
|
+
}
|
|
1670
|
+
function tn(e, t) {
|
|
1671
|
+
var w, I, F, k;
|
|
1672
|
+
const { baseDataset: a, hasSelection: r, anchoredOnDataSource: n, evalCtx: o, isAlreadySelected: s } = t, { identity: u } = o, d = Rt(e);
|
|
1673
|
+
if (d.datasets.length === 0)
|
|
1674
|
+
return {
|
|
1675
|
+
state: "draggable",
|
|
1676
|
+
tooltip: d.complete ? void 0 : "Availability could not be verified",
|
|
1677
|
+
verified: d.complete,
|
|
1678
|
+
dependencies: [],
|
|
1679
|
+
isSelected: s
|
|
1680
|
+
};
|
|
1681
|
+
const l = /* @__PURE__ */ new Map();
|
|
1682
|
+
d.datasets.forEach((v) => {
|
|
1683
|
+
const S = u.ofDependency(v), A = l.get(S);
|
|
1684
|
+
A ? !A.label && v.label && l.set(S, { ...A, label: v.label }) : l.set(S, v);
|
|
1685
|
+
});
|
|
1686
|
+
const c = Array.from(l.values()), f = t.visualDatasets.length > 0 ? t.visualDatasets : [u.ofDependency(c[0])], p = new Set(f), i = a ?? f[0], h = c.map((v) => {
|
|
1687
|
+
const S = u.ofDependency(v), A = u.catalogLabel(S) || v.label || u.label(S);
|
|
1688
|
+
if (p.has(S))
|
|
1689
|
+
return { dependency: { entityName: S, label: A, state: "base" } };
|
|
1690
|
+
const W = rt(S, i, o);
|
|
1691
|
+
if (n && W.state === "unreachable") {
|
|
1692
|
+
const te = `${A} is not one of the selected datasets.`;
|
|
1693
|
+
return {
|
|
1694
|
+
dependency: { entityName: S, label: A, state: "absent", reason: te },
|
|
1695
|
+
evaluated: {
|
|
1696
|
+
reason: te,
|
|
1697
|
+
action: "To use this field, add it in the Datasets panel.",
|
|
1698
|
+
mentions: [A]
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
return {
|
|
1703
|
+
dependency: { entityName: S, label: A, state: W.state, reason: W.reason },
|
|
1704
|
+
evaluated: W
|
|
1705
|
+
};
|
|
1706
|
+
}), m = h.reduce(
|
|
1707
|
+
(v, S) => Et[S.dependency.state] > Et[v.dependency.state] ? S : v
|
|
1708
|
+
), y = h.map((v) => v.dependency), b = Kt(m.dependency.state);
|
|
1709
|
+
return {
|
|
1710
|
+
state: !r && m.dependency.state === "base" ? "draggable" : m.dependency.state,
|
|
1711
|
+
tooltip: b ? (w = m.evaluated) == null ? void 0 : w.reason : !r && !n ? Vt : `Uses ${y.map((v) => v.label).join(", ")}`,
|
|
1712
|
+
reason: b ? (I = m.evaluated) == null ? void 0 : I.reason : void 0,
|
|
1713
|
+
action: b ? (F = m.evaluated) == null ? void 0 : F.action : void 0,
|
|
1714
|
+
mentions: b ? (k = m.evaluated) == null ? void 0 : k.mentions : void 0,
|
|
1715
|
+
warning: b ? void 0 : an(e, i, y, o),
|
|
1716
|
+
dependencies: y,
|
|
1717
|
+
verified: d.complete,
|
|
1718
|
+
isSelected: s
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
function an(e, t, a, r) {
|
|
1722
|
+
var u, d;
|
|
1723
|
+
if (e.role !== "metric" || !r.joinabilityMap) return;
|
|
1724
|
+
const n = r.joinabilityMap[t];
|
|
1725
|
+
if (!(n != null && n.cardinality) || Ca(e).repeatSafe || !(((u = e.calculatedFormula) == null ? void 0 : u.inputFields) || []).some((l) => {
|
|
1726
|
+
const c = l;
|
|
1727
|
+
return (r.identity.resolve(c.entityName) || c.entityName) === t;
|
|
1728
|
+
})) return;
|
|
1729
|
+
const s = r.identity.label(t);
|
|
1730
|
+
for (const l of a) {
|
|
1731
|
+
if (l.entityName === t) continue;
|
|
1732
|
+
const c = (d = n.cardinality) == null ? void 0 : d[l.entityName];
|
|
1733
|
+
if (c === "one_to_many" || c === "many_to_many")
|
|
1734
|
+
return `${s} joins ${l.label} ${c === "one_to_many" ? "one-to-many" : "many-to-many"}, so ${s} totals may repeat across ${l.label} rows.`;
|
|
1735
|
+
if (c === "unknown")
|
|
1736
|
+
return `The relationship between ${s} and ${l.label} has no cardinality, so this measure may be refused. Set its cardinality in the semantic model.`;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
function rn(e, t, a) {
|
|
1740
|
+
const r = en(e, {
|
|
1741
|
+
...a,
|
|
1742
|
+
joinabilityMap: a.joinabilityMap ?? null,
|
|
1743
|
+
// Mode: explicit flag if the caller set one, else derived from the domain.
|
|
1744
|
+
hasSemanticDomain: a.hasSemanticDomain ?? !!a.semanticDomainId,
|
|
1745
|
+
selectedFields: t
|
|
1746
|
+
});
|
|
1747
|
+
return Kt(r.state) ? { isValid: !1, showError: !0, fieldState: r } : { isValid: !0, fieldState: r };
|
|
1748
|
+
}
|
|
1749
|
+
function uo(e) {
|
|
1750
|
+
if (e != null && e.reason) {
|
|
1751
|
+
Tt.error(
|
|
1752
|
+
Zr(e.state).toastTitle,
|
|
1753
|
+
{
|
|
1754
|
+
richColors: !0,
|
|
1755
|
+
description: [e.reason, e.action].filter(Boolean).join(" "),
|
|
1756
|
+
position: "top-center",
|
|
1757
|
+
duration: 5e3
|
|
1758
|
+
}
|
|
1759
|
+
);
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1762
|
+
Tt.error("Join Configuration Required", {
|
|
1763
|
+
richColors: !0,
|
|
1764
|
+
description: "To combine fields from two different tables, you need to define a join between them first.",
|
|
1765
|
+
position: "top-center",
|
|
1766
|
+
duration: 4e3
|
|
1767
|
+
});
|
|
1768
|
+
}
|
|
1769
|
+
function fo(e, t) {
|
|
1770
|
+
return t.some((a) => {
|
|
1771
|
+
if (!(a.name === e.name && a.qualifiedEntityName === e.qualifiedEntityName)) return !1;
|
|
1772
|
+
if ((e.role === "metric" || !e.role) && a.role === "metric") {
|
|
1773
|
+
const n = e, o = a;
|
|
1774
|
+
if (n.aggregate !== o.aggregate || n.expression !== o.expression)
|
|
1775
|
+
return !1;
|
|
1776
|
+
if (n.parameters || o.parameters) {
|
|
1777
|
+
const s = n.parameters || {}, u = o.parameters || {}, d = JSON.stringify(s), l = JSON.stringify(u);
|
|
1778
|
+
if (d !== l)
|
|
1779
|
+
return !1;
|
|
1780
|
+
}
|
|
1781
|
+
return !1;
|
|
1782
|
+
}
|
|
1783
|
+
return !0;
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1786
|
+
function mo(e) {
|
|
1787
|
+
if (e.role !== "metric")
|
|
1788
|
+
return e.label || e.name;
|
|
1789
|
+
const t = e, a = e.label || e.name;
|
|
1790
|
+
if (!t.parameters || !t.parameters.filters)
|
|
1791
|
+
return a;
|
|
1792
|
+
const r = t.parameters.filters;
|
|
1793
|
+
return typeof r == "string" ? `${a} (${r})` : typeof r == "object" ? (JSON.stringify(r), `${a} (Filtered)`) : a;
|
|
1794
|
+
}
|
|
1795
|
+
function po(e, t, a) {
|
|
1796
|
+
const r = e.label || e.name, n = t.filter(
|
|
1797
|
+
(o) => o.name === e.name && o.qualifiedEntityName === e.qualifiedEntityName && (o.role === "metric" || a === "metrics")
|
|
1798
|
+
).length;
|
|
1799
|
+
return n === 0 ? r : `${r} (${n + 1})`;
|
|
1800
|
+
}
|
|
1801
|
+
function nn(e, t) {
|
|
1802
|
+
if (e.derivedField) return e.derivedField;
|
|
1803
|
+
if (!e.expression && !e.calculatedFormula) return;
|
|
1804
|
+
const a = {}, r = /* @__PURE__ */ new Set(), n = (u, d) => {
|
|
1805
|
+
const l = `input_${Object.keys(a).length}`;
|
|
1806
|
+
return a[l] = {
|
|
1807
|
+
kind: "field",
|
|
1808
|
+
field: u,
|
|
1809
|
+
...d ? { aggregate: d } : {}
|
|
1810
|
+
}, `{${l}}`;
|
|
1811
|
+
}, o = (u) => {
|
|
1812
|
+
if (r.has(u))
|
|
1813
|
+
throw new Error("Calculated field inputs contain a cycle.");
|
|
1814
|
+
r.add(u);
|
|
1815
|
+
try {
|
|
1816
|
+
const d = u.derivedField;
|
|
1817
|
+
if (d) {
|
|
1818
|
+
const c = new Map(
|
|
1819
|
+
Object.entries(d.inputs).map(([f, p]) => [
|
|
1820
|
+
f,
|
|
1821
|
+
n(p.field, p.aggregate)
|
|
1822
|
+
])
|
|
1823
|
+
);
|
|
1824
|
+
return gt(d.expression, (f) => {
|
|
1825
|
+
const p = c.get(f);
|
|
1826
|
+
if (!p)
|
|
1827
|
+
throw new Error(`Calculated field input ${f} is missing.`);
|
|
1828
|
+
return p;
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
if (!u.expression || !u.calculatedFormula)
|
|
1832
|
+
throw new Error(
|
|
1833
|
+
"Calculated field expression and input metadata must be present together."
|
|
1834
|
+
);
|
|
1835
|
+
const l = new Map(
|
|
1836
|
+
u.calculatedFormula.inputFields.map((c, f) => {
|
|
1837
|
+
if (c.derivedField || c.expression || c.calculatedFormula)
|
|
1838
|
+
return [`field_${f}`, `(${o(c)})`];
|
|
1839
|
+
const p = t(c);
|
|
1840
|
+
if (!p)
|
|
1841
|
+
throw new Error(
|
|
1842
|
+
`Calculated field input ${c.name} has no unambiguous source.`
|
|
1843
|
+
);
|
|
1844
|
+
return [`field_${f}`, n(p)];
|
|
1845
|
+
})
|
|
1846
|
+
);
|
|
1847
|
+
return gt(u.expression, (c) => {
|
|
1848
|
+
const f = l.get(c);
|
|
1849
|
+
if (!f)
|
|
1850
|
+
throw new Error(`Calculated field input ${c} is missing.`);
|
|
1851
|
+
return f;
|
|
1852
|
+
});
|
|
1853
|
+
} finally {
|
|
1854
|
+
r.delete(u);
|
|
1855
|
+
}
|
|
1856
|
+
}, s = o(e);
|
|
1857
|
+
return va.parse({
|
|
1858
|
+
kind: "derived_field",
|
|
1859
|
+
name: e.name,
|
|
1860
|
+
label: e.label || e.name,
|
|
1861
|
+
dataType: ge(e.dataType),
|
|
1862
|
+
resultRole: e.role === "metric" ? "measure" : "dimension",
|
|
1863
|
+
computeStage: e.role === "metric" ? "aggregate" : "row",
|
|
1864
|
+
expression: s,
|
|
1865
|
+
inputs: a
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
function me(e, t) {
|
|
1869
|
+
const a = (r) => {
|
|
1870
|
+
var u, d, l;
|
|
1871
|
+
if (r.source) return r.source;
|
|
1872
|
+
const n = ((u = e.dataSource) == null ? void 0 : u.selectedEntities) ?? [], o = n.filter(
|
|
1873
|
+
(c) => "id" in c && c.id === r.entityId || (r.qualifiedEntityName ? qt(c) === r.qualifiedEntityName : c.name === r.entityName)
|
|
1874
|
+
), s = r.derivedField || r.expression || r.calculatedFormula ? ((l = (d = e.config) == null ? void 0 : d.matrix) == null ? void 0 : l.spec.source) ?? (n.length === 1 ? Te(n[0], e.dataSource) : void 0) : void 0;
|
|
1875
|
+
return o.length === 1 ? Te(o[0], e.dataSource) : s;
|
|
1876
|
+
};
|
|
1877
|
+
return t.flatMap((r) => {
|
|
1878
|
+
const n = a(r);
|
|
1879
|
+
if (!n) return [];
|
|
1880
|
+
let o;
|
|
1881
|
+
try {
|
|
1882
|
+
o = nn(r, (u) => {
|
|
1883
|
+
const d = a(u);
|
|
1884
|
+
return d ? {
|
|
1885
|
+
name: u.name,
|
|
1886
|
+
source: d,
|
|
1887
|
+
dataType: ge(u.dataType),
|
|
1888
|
+
role: u.role === "metric" ? "measure" : "dimension",
|
|
1889
|
+
aggregate: u.aggregate
|
|
1890
|
+
} : void 0;
|
|
1891
|
+
});
|
|
1892
|
+
} catch {
|
|
1893
|
+
return [];
|
|
1894
|
+
}
|
|
1895
|
+
const s = wa.safeParse({
|
|
1896
|
+
name: r.name,
|
|
1897
|
+
label: r.label,
|
|
1898
|
+
source: n,
|
|
1899
|
+
dataType: ge(r.dataType),
|
|
1900
|
+
...o ? { derivedField: o } : {}
|
|
1901
|
+
});
|
|
1902
|
+
return s.success ? [{ resolvedField: r, field: s.data }] : [];
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
const Xe = (e) => e === "groupBy" ? "rows" : e === "pivotBy" ? "columns" : void 0;
|
|
1906
|
+
function ie(e, t, a, r) {
|
|
1907
|
+
const n = Sa(
|
|
1908
|
+
t,
|
|
1909
|
+
a,
|
|
1910
|
+
e.controlBindings,
|
|
1911
|
+
(o) => Lt(
|
|
1912
|
+
o,
|
|
1913
|
+
t.spec.source,
|
|
1914
|
+
r.map((s) => s.field)
|
|
1915
|
+
),
|
|
1916
|
+
!0
|
|
1917
|
+
);
|
|
1918
|
+
return on(e, n);
|
|
1919
|
+
}
|
|
1920
|
+
function go(e, t, a, r) {
|
|
1921
|
+
var u;
|
|
1922
|
+
const n = ie(e, t, {
|
|
1923
|
+
kind: "defaults",
|
|
1924
|
+
defaultView: { rows: a.rows, columns: a.columns }
|
|
1925
|
+
}, r), o = (u = n.card.config) == null ? void 0 : u.matrix, s = ie(n.card, o, {
|
|
1926
|
+
kind: "sorts",
|
|
1927
|
+
sorts: Pa(t.spec.sorts, a.sorts)
|
|
1928
|
+
}, r);
|
|
1929
|
+
return { card: s.card, notices: [...n.notices, ...s.notices] };
|
|
1930
|
+
}
|
|
1931
|
+
function on(e, t) {
|
|
1932
|
+
if (e.type !== "matrixTable") throw new Error("Matrix settings require a Matrix card.");
|
|
1933
|
+
return {
|
|
1934
|
+
card: {
|
|
1935
|
+
...e,
|
|
1936
|
+
sql: "",
|
|
1937
|
+
python: "",
|
|
1938
|
+
config: { matrix: t.config },
|
|
1939
|
+
controlBindings: [...t.bindings]
|
|
1940
|
+
},
|
|
1941
|
+
notices: t.notices
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
function yo(e, t, a) {
|
|
1945
|
+
if (t.from === "source") {
|
|
1946
|
+
const r = ["groupBy", "pivotBy", "metrics"].flatMap((o) => Be(e, o, a.matrixCatalog)), n = rn(t.field, r, a.availability);
|
|
1947
|
+
if (!n.isValid)
|
|
1948
|
+
return { kind: "refused", notice: { kind: "join-required", fieldState: n.fieldState } };
|
|
1949
|
+
}
|
|
1950
|
+
try {
|
|
1951
|
+
return { kind: "placed", commit: { cardKind: "matrix", change: Gt(e, a.matrixCatalog, {
|
|
1952
|
+
...t,
|
|
1953
|
+
newInstanceId: a.newFieldId ?? void 0
|
|
1954
|
+
}) } };
|
|
1955
|
+
} catch (r) {
|
|
1956
|
+
return { kind: "refused", notice: { kind: "matrix-refused", message: r instanceof Error && r.message ? r.message : "Cannot move this field." } };
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
function Gt(e, t, a) {
|
|
1960
|
+
var w, I, F, k;
|
|
1961
|
+
const r = Xe(a.to);
|
|
1962
|
+
if (!r && a.to !== "metrics")
|
|
1963
|
+
throw new Error("Matrix fields belong in Rows, Pivot Columns or Metrics.");
|
|
1964
|
+
const n = (w = e.config) == null ? void 0 : w.matrix;
|
|
1965
|
+
let o, s, u = a.field.id;
|
|
1966
|
+
if (a.from === "source") {
|
|
1967
|
+
const v = t.filter(
|
|
1968
|
+
(S) => S.resolvedField.id === a.field.id
|
|
1969
|
+
);
|
|
1970
|
+
if (v.length !== 1)
|
|
1971
|
+
throw new Error("Field metadata is not ready or is ambiguous.");
|
|
1972
|
+
if (s = v[0].resolvedField, o = {
|
|
1973
|
+
...v[0].field,
|
|
1974
|
+
dataType: ge(
|
|
1975
|
+
v[0].resolvedField.dataType
|
|
1976
|
+
)
|
|
1977
|
+
}, !a.newInstanceId)
|
|
1978
|
+
throw new Error("A new Matrix field needs an instance id.");
|
|
1979
|
+
u = a.newInstanceId;
|
|
1980
|
+
} else {
|
|
1981
|
+
const v = [
|
|
1982
|
+
...(n == null ? void 0 : n.spec.rows) ?? [],
|
|
1983
|
+
...(n == null ? void 0 : n.spec.columns) ?? []
|
|
1984
|
+
].find((A) => A.id === u), S = n == null ? void 0 : n.spec.measures.find((A) => A.id === u);
|
|
1985
|
+
if (o = (v == null ? void 0 : v.field) ?? ((S == null ? void 0 : S.kind) === "aggregate" ? S.field : (S == null ? void 0 : S.kind) === "calculated" ? { name: S.definition.name, derivedField: S.definition } : void 0), !o) throw new Error("Matrix field is no longer present.");
|
|
1986
|
+
s = tt(t)(
|
|
1987
|
+
o,
|
|
1988
|
+
n.spec.source
|
|
1989
|
+
);
|
|
1990
|
+
}
|
|
1991
|
+
if (r && ((I = o.derivedField) == null ? void 0 : I.computeStage) === "aggregate")
|
|
1992
|
+
throw new Error("Aggregate calculations belong in Metrics.");
|
|
1993
|
+
const d = (n == null ? void 0 : n.spec.source) ?? o.source;
|
|
1994
|
+
if (!d) throw new Error("Matrix requires a configured source.");
|
|
1995
|
+
const l = at(e, d);
|
|
1996
|
+
if (r && Xe(a.from))
|
|
1997
|
+
return ie(e, l, Ea(l.spec, u, r, a.beforeId), t);
|
|
1998
|
+
const c = [...l.spec.rows], f = [...l.spec.columns], p = [...l.spec.measures], i = a.from === "groupBy" ? c : a.from === "pivotBy" ? f : a.from === "metrics" ? p : void 0, h = r === "rows" ? c : r === "columns" ? f : p, m = a.beforeId ? h.findIndex((v) => v.id === a.beforeId) : -1, y = (i == null ? void 0 : i.findIndex((v) => v.id === u)) ?? -1, b = y >= 0 ? i == null ? void 0 : i.splice(y, 1)[0] : void 0, x = m >= 0 ? m - (i === h && y >= 0 && y < m ? 1 : 0) : h.length;
|
|
1999
|
+
if (r) {
|
|
2000
|
+
const v = b && "field" in b && !("kind" in b) ? b : { id: u, field: o };
|
|
2001
|
+
(r === "rows" ? c : f).splice(x, 0, v);
|
|
2002
|
+
} else {
|
|
2003
|
+
const v = b && "kind" in b ? b : ((F = o.derivedField) == null ? void 0 : F.computeStage) === "aggregate" ? { id: u, kind: "calculated", definition: o.derivedField } : {
|
|
2004
|
+
id: u,
|
|
2005
|
+
kind: "aggregate",
|
|
2006
|
+
field: o,
|
|
2007
|
+
aggregate: xa.parse(
|
|
2008
|
+
(s == null ? void 0 : s.aggregate) ?? ((k = o.derivedField) == null ? void 0 : k.defaultAggregate) ?? (o.dataType === "number" ? "SUM" : "COUNT")
|
|
2009
|
+
)
|
|
2010
|
+
};
|
|
2011
|
+
p.splice(x, 0, v);
|
|
2012
|
+
}
|
|
2013
|
+
return ie(
|
|
2014
|
+
e,
|
|
2015
|
+
l,
|
|
2016
|
+
{ kind: "structure", rows: c, columns: f, measures: p },
|
|
2017
|
+
t
|
|
2018
|
+
);
|
|
2019
|
+
}
|
|
2020
|
+
function ho(e, t, a, r) {
|
|
2021
|
+
var s;
|
|
2022
|
+
const n = (s = e.config) == null ? void 0 : s.matrix;
|
|
2023
|
+
if (!n) return { card: e, notices: [] };
|
|
2024
|
+
const o = Xe(t);
|
|
2025
|
+
return ie(
|
|
2026
|
+
e,
|
|
2027
|
+
n,
|
|
2028
|
+
o ? {
|
|
2029
|
+
kind: "structure",
|
|
2030
|
+
[o]: n.spec[o].filter((u) => u.id !== a)
|
|
2031
|
+
} : {
|
|
2032
|
+
kind: "structure",
|
|
2033
|
+
measures: n.spec.measures.filter((u) => u.id !== a)
|
|
2034
|
+
},
|
|
2035
|
+
r
|
|
2036
|
+
);
|
|
2037
|
+
}
|
|
2038
|
+
function bo(e, t, a, r) {
|
|
2039
|
+
var h, m;
|
|
2040
|
+
const n = (h = e.config) == null ? void 0 : h.matrix;
|
|
2041
|
+
if (e.type !== "matrixTable" || !n || !a) return { card: e, notices: [] };
|
|
2042
|
+
const o = me(e, t), s = me(e, [a])[0];
|
|
2043
|
+
if (!(s != null && s.field.derivedField))
|
|
2044
|
+
throw new Error(
|
|
2045
|
+
"The selected calculation cannot be resolved. Repair its definition before editing."
|
|
2046
|
+
);
|
|
2047
|
+
const u = bt(
|
|
2048
|
+
ht(s.field.derivedField)
|
|
2049
|
+
), d = (y) => !!y.derivedField && bt(ht(y.derivedField)) === u && Pe(
|
|
2050
|
+
y.source ?? n.spec.source,
|
|
2051
|
+
s.field.source ?? n.spec.source
|
|
2052
|
+
), l = (y) => y.kind === "aggregate" ? y.field : {
|
|
2053
|
+
name: y.definition.name,
|
|
2054
|
+
derivedField: y.definition
|
|
2055
|
+
};
|
|
2056
|
+
if (!([...n.spec.rows, ...n.spec.columns].some(
|
|
2057
|
+
(y) => d(y.field)
|
|
2058
|
+
) || n.spec.measures.some(
|
|
2059
|
+
(y) => d(l(y))
|
|
2060
|
+
))) return { card: e, notices: [] };
|
|
2061
|
+
if (o.some(
|
|
2062
|
+
(y) => d(y.field) && !Ze(y.resolvedField, a)
|
|
2063
|
+
))
|
|
2064
|
+
throw new Error(
|
|
2065
|
+
"This calculation has an ambiguous scoped definition. Give it a unique name before selecting it."
|
|
2066
|
+
);
|
|
2067
|
+
const f = r ? (m = me(e, [r])[0]) == null ? void 0 : m.field : void 0;
|
|
2068
|
+
if (r && !(f != null && f.derivedField))
|
|
2069
|
+
throw new Error("The updated calculation has invalid input metadata.");
|
|
2070
|
+
const p = (y) => n.spec[y].flatMap((b) => {
|
|
2071
|
+
var x;
|
|
2072
|
+
if (!d(b.field)) return [b];
|
|
2073
|
+
if (!f) return [];
|
|
2074
|
+
if (((x = f.derivedField) == null ? void 0 : x.computeStage) === "aggregate")
|
|
2075
|
+
throw new Error("Aggregate calculations belong in Metrics.");
|
|
2076
|
+
return [{ ...b, field: f }];
|
|
2077
|
+
}), i = n.spec.measures.flatMap((y) => {
|
|
2078
|
+
if (!d(l(y))) return [y];
|
|
2079
|
+
if (!(f != null && f.derivedField)) return [];
|
|
2080
|
+
if (f.derivedField.computeStage === "aggregate")
|
|
2081
|
+
return [
|
|
2082
|
+
{
|
|
2083
|
+
id: y.id,
|
|
2084
|
+
kind: "calculated",
|
|
2085
|
+
definition: f.derivedField
|
|
2086
|
+
}
|
|
2087
|
+
];
|
|
2088
|
+
if (y.kind !== "aggregate")
|
|
2089
|
+
throw new Error(
|
|
2090
|
+
"Move the row calculation to a field shelf before selecting its aggregation."
|
|
2091
|
+
);
|
|
2092
|
+
return [{ ...y, field: f }];
|
|
2093
|
+
});
|
|
2094
|
+
return ie(
|
|
2095
|
+
e,
|
|
2096
|
+
n,
|
|
2097
|
+
{
|
|
2098
|
+
kind: "structure",
|
|
2099
|
+
rows: p("rows"),
|
|
2100
|
+
columns: p("columns"),
|
|
2101
|
+
measures: i
|
|
2102
|
+
},
|
|
2103
|
+
r ? me(e, [...t, r]) : o
|
|
2104
|
+
);
|
|
2105
|
+
}
|
|
2106
|
+
function vo(e) {
|
|
2107
|
+
return G({ type: e }).supportsSql;
|
|
2108
|
+
}
|
|
2109
|
+
const sn = /* @__PURE__ */ new Set([
|
|
2110
|
+
"table",
|
|
2111
|
+
"pivotTable",
|
|
2112
|
+
"aggregateTable",
|
|
2113
|
+
"detailTable",
|
|
2114
|
+
"matrixTable",
|
|
2115
|
+
"kpi"
|
|
2116
|
+
]);
|
|
2117
|
+
function wo(e) {
|
|
2118
|
+
return !sn.has(e);
|
|
2119
|
+
}
|
|
2120
|
+
const ln = /* @__PURE__ */ new Set(["kpi", "matrixTable"]);
|
|
2121
|
+
function xo(e) {
|
|
2122
|
+
return !ln.has(e);
|
|
2123
|
+
}
|
|
2124
|
+
const Jt = (e, t) => e.type !== t && (e.type === "matrixTable" || t === "matrixTable");
|
|
2125
|
+
function To(e, t, a = []) {
|
|
2126
|
+
if (!Jt(e, t)) return { card: {}, leftOut: [] };
|
|
2127
|
+
const r = [], n = G(
|
|
2128
|
+
e,
|
|
2129
|
+
e.type === "matrixTable" ? me(e, a) : []
|
|
2130
|
+
);
|
|
2131
|
+
let o = { ...e, type: t, config: {}, controlBindings: [], sql: "", python: "" };
|
|
2132
|
+
return o = { ...o, config: dn(o, n.joinPlan, a) }, o = t === "matrixTable" ? mn(o, n.fields, r) : pn(o, n.fields, r), o = gn(o, n.filters, r), { card: { config: o.config, controlBindings: o.controlBindings ?? [], sql: "", python: "" }, leftOut: r };
|
|
2133
|
+
}
|
|
2134
|
+
function Co(e, t) {
|
|
2135
|
+
var r, n;
|
|
2136
|
+
if (!Jt(e, t)) return !1;
|
|
2137
|
+
const a = G(e);
|
|
2138
|
+
return !!((n = (r = a.joinPlan) == null ? void 0 : r.joins) != null && n.length) || Object.values(a.fields).some((o) => o.length > 0);
|
|
2139
|
+
}
|
|
2140
|
+
function dn(e, t, a) {
|
|
2141
|
+
var r;
|
|
2142
|
+
if (!((r = t == null ? void 0 : t.joins) != null && r.length)) return {};
|
|
2143
|
+
try {
|
|
2144
|
+
return yn(e, Tr(t, a));
|
|
2145
|
+
} catch {
|
|
2146
|
+
return {};
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
const Re = (e) => e.label || e.name, cn = {
|
|
2150
|
+
id: "identity",
|
|
2151
|
+
name: "identity",
|
|
2152
|
+
label: "identity",
|
|
2153
|
+
derivedLabel: "identity",
|
|
2154
|
+
alias: "identity",
|
|
2155
|
+
source: "identity",
|
|
2156
|
+
qualifiedFieldName: "identity",
|
|
2157
|
+
qualifiedEntityName: "identity",
|
|
2158
|
+
dataType: "identity",
|
|
2159
|
+
nativeDataType: "identity",
|
|
2160
|
+
description: "identity",
|
|
2161
|
+
entityId: "identity",
|
|
2162
|
+
entityName: "identity",
|
|
2163
|
+
entityType: "identity",
|
|
2164
|
+
role: "identity",
|
|
2165
|
+
labelOrigin: "identity",
|
|
2166
|
+
granularity: "translated",
|
|
2167
|
+
aggregate: "translated",
|
|
2168
|
+
aggregateOrigin: "translated",
|
|
2169
|
+
dateFormat: "presentation",
|
|
2170
|
+
customFormat: "presentation",
|
|
2171
|
+
format: "presentation",
|
|
2172
|
+
formatOrigin: "presentation",
|
|
2173
|
+
semanticTemporalPresentation: "presentation",
|
|
2174
|
+
memberOrder: "presentation",
|
|
2175
|
+
aliasTemplate: "presentation",
|
|
2176
|
+
valueAliases: "presentation",
|
|
2177
|
+
timeDrillPath: "presentation",
|
|
2178
|
+
comparisonPolarity: "presentation",
|
|
2179
|
+
semanticComparisonPolarity: "presentation",
|
|
2180
|
+
expression: "not_carried",
|
|
2181
|
+
calculatedFormula: "not_carried",
|
|
2182
|
+
derivedField: "not_carried",
|
|
2183
|
+
calculationRepresentation: "not_carried",
|
|
2184
|
+
calculatedFieldOrigin: "not_carried",
|
|
2185
|
+
fieldScope: "not_carried",
|
|
2186
|
+
parameters: "not_carried",
|
|
2187
|
+
isPreAggregated: "not_carried",
|
|
2188
|
+
comparison: "not_carried",
|
|
2189
|
+
sourceField: "not_carried"
|
|
2190
|
+
}, un = (e) => e != null && e !== !1 && !(Array.isArray(e) && e.length === 0) && !(typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0);
|
|
2191
|
+
function fn(e) {
|
|
2192
|
+
return Object.entries(e).every(([t, a]) => {
|
|
2193
|
+
if (!un(a)) return !0;
|
|
2194
|
+
const r = cn[t];
|
|
2195
|
+
return r !== void 0 && r !== "not_carried";
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
function Ht(e, t) {
|
|
2199
|
+
return e.filter((a) => {
|
|
2200
|
+
const r = fn(a);
|
|
2201
|
+
return r || t.push(Re(a)), r;
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2204
|
+
function mn(e, t, a) {
|
|
2205
|
+
var l;
|
|
2206
|
+
const r = [["groupBy", t.rows], ["pivotBy", t.columns], ["metrics", t.metrics]].flatMap(([c, f]) => Ht(f, a).map((p) => ({ to: c, field: { ...p, id: crypto.randomUUID() } }))), n = me(e, r.map(({ field: c }) => c));
|
|
2207
|
+
let o = e;
|
|
2208
|
+
for (const { to: c, field: f } of r)
|
|
2209
|
+
try {
|
|
2210
|
+
o = Gt(o, n, { field: f, from: "source", to: c, newInstanceId: f.id }).card;
|
|
2211
|
+
} catch {
|
|
2212
|
+
a.push(Re(f));
|
|
2213
|
+
}
|
|
2214
|
+
a.push(...t.details.map(Re));
|
|
2215
|
+
const s = new Map(
|
|
2216
|
+
r.flatMap(({ field: c }) => c.granularity ? [[c.id, c.granularity]] : [])
|
|
2217
|
+
), u = (l = o.config) == null ? void 0 : l.matrix;
|
|
2218
|
+
if (!u || !s.size) return o;
|
|
2219
|
+
const d = (c) => s.has(c.id) ? { ...c, grain: s.get(c.id) } : c;
|
|
2220
|
+
try {
|
|
2221
|
+
const c = ie(o, u, {
|
|
2222
|
+
kind: "structure",
|
|
2223
|
+
rows: u.spec.rows.map(d),
|
|
2224
|
+
columns: u.spec.columns.map(d)
|
|
2225
|
+
}, n).card;
|
|
2226
|
+
return G(c).status === "invalid" ? o : c;
|
|
2227
|
+
} catch {
|
|
2228
|
+
return o;
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
function pn(e, t, a) {
|
|
2232
|
+
const r = (s) => Ht(s, a).filter((u) => (u.entityName || a.push(Re(u)), !!u.entityName)), n = {
|
|
2233
|
+
groupByColumns: r(t.rows).map((s) => ({ ...s, role: "groupby" })),
|
|
2234
|
+
pivotByColumns: r(t.columns).map((s) => ({ ...s, role: "pivotby" })),
|
|
2235
|
+
metricColumns: r(t.metrics).map((s) => ({ ...s, role: "metric" }))
|
|
2236
|
+
}, o = Object.fromEntries(Object.entries(n).filter(([, s]) => s.length > 0));
|
|
2237
|
+
return { ...e, config: { ...e.config, ...o } };
|
|
2238
|
+
}
|
|
2239
|
+
function gn(e, t, a) {
|
|
2240
|
+
if (!t) return e;
|
|
2241
|
+
try {
|
|
2242
|
+
const r = { ...e, config: hn(e, t) };
|
|
2243
|
+
if (r.type !== "matrixTable" || G(r).status !== "invalid" || G(e).status === "invalid") return r;
|
|
2244
|
+
} catch {
|
|
2245
|
+
}
|
|
2246
|
+
return a.push("Filters"), e;
|
|
2247
|
+
}
|
|
2248
|
+
function Io(e, t) {
|
|
2249
|
+
var n, o;
|
|
2250
|
+
const a = e.type === "matrixTable" ? (o = (n = e.config) == null ? void 0 : n.matrix) == null ? void 0 : o.spec.source : void 0;
|
|
2251
|
+
return !a || (t.selectedEntities ?? []).some((s) => {
|
|
2252
|
+
const u = Te(s, t);
|
|
2253
|
+
return u && Pe(a, u);
|
|
2254
|
+
}) ? { dataSource: t } : { dataSource: t, config: {}, controlBindings: [] };
|
|
2255
|
+
}
|
|
2256
|
+
function Eo(e) {
|
|
2257
|
+
return G(e).joinPlan;
|
|
2258
|
+
}
|
|
2259
|
+
function yn(e, t) {
|
|
2260
|
+
var o;
|
|
2261
|
+
if (e.type !== "matrixTable") return { ...e.config, joinPlan: t };
|
|
2262
|
+
const a = (o = e.config) == null ? void 0 : o.matrix, r = t ? Te(t.baseEntity, e.dataSource) : a == null ? void 0 : a.spec.source;
|
|
2263
|
+
if (!r) {
|
|
2264
|
+
if (!t) return e.config ?? {};
|
|
2265
|
+
throw new Error("Matrix joins require a configured base source.");
|
|
2266
|
+
}
|
|
2267
|
+
const n = at(e, r);
|
|
2268
|
+
return { matrix: { ...n, spec: { ...n.spec, source: r, joinPlan: t } } };
|
|
2269
|
+
}
|
|
2270
|
+
function So(e) {
|
|
2271
|
+
return e ? G(e).filters : void 0;
|
|
2272
|
+
}
|
|
2273
|
+
function hn(e, t) {
|
|
2274
|
+
var r;
|
|
2275
|
+
if (e.type !== "matrixTable") return { ...e.config, filters: t };
|
|
2276
|
+
if (!t && !((r = e.config) != null && r.matrix)) return e.config ?? {};
|
|
2277
|
+
const a = at(e);
|
|
2278
|
+
return { matrix: { ...a, spec: { ...a.spec, filters: t } } };
|
|
2279
|
+
}
|
|
2280
|
+
function nt(e, t) {
|
|
2281
|
+
return e ? t ? G({ type: t, config: e }).configured : xr(e) : !1;
|
|
2282
|
+
}
|
|
2283
|
+
function Fo(e, t) {
|
|
2284
|
+
var s, u, d;
|
|
2285
|
+
if (t != null && t.skipSetupCheck || e.type === "text")
|
|
2286
|
+
return !1;
|
|
2287
|
+
const a = G(e);
|
|
2288
|
+
if (!a.supportsSql) return !a.configured;
|
|
2289
|
+
if ((s = e.customCardPreferences) != null && s.url)
|
|
2290
|
+
return !1;
|
|
2291
|
+
const r = !!(e.connectionId || (u = e.dataSource) != null && u.connectionId), n = !!((d = e.sql) != null && d.trim()), o = nt(e.config);
|
|
2292
|
+
return !r || !o && !n;
|
|
2293
|
+
}
|
|
2294
|
+
function ko(e) {
|
|
2295
|
+
return {
|
|
2296
|
+
databaseName: (e == null ? void 0 : e.lastSelectedDatabase) || "",
|
|
2297
|
+
schemaName: (e == null ? void 0 : e.lastSelectedSchema) || "",
|
|
2298
|
+
tableName: (e == null ? void 0 : e.lastSelectedTable) || "",
|
|
2299
|
+
datamodelId: (e == null ? void 0 : e.datamodelId) || ""
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
function Wt(e) {
|
|
2303
|
+
return e === pr ? "" : e;
|
|
2304
|
+
}
|
|
2305
|
+
function Mo(e, t = e.config) {
|
|
2306
|
+
return _t({
|
|
2307
|
+
hasExecutableConfig: nt(t, e.type),
|
|
2308
|
+
sql: e.sql,
|
|
2309
|
+
normalizedPython: Wt(e.python || "")
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
class bn extends Error {
|
|
2313
|
+
constructor(a) {
|
|
2314
|
+
super(
|
|
2315
|
+
`ambiguous_temporal_grain: Temporal field "${a}" has saved presentation but no valid grouping grain. Reconfigure and resave the field.`
|
|
2316
|
+
);
|
|
2317
|
+
O(this, "code", "ambiguous_temporal_grain");
|
|
2318
|
+
O(this, "fieldId");
|
|
2319
|
+
this.name = "AmbiguousGroupedTemporalGrainError", this.fieldId = a;
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
function vn(e) {
|
|
2323
|
+
return Pt(e) || e.semanticTemporalPresentation != null;
|
|
2324
|
+
}
|
|
2325
|
+
function wn(e) {
|
|
2326
|
+
if (!e.id || !["date", "datetime"].includes(
|
|
2327
|
+
ge(e.dataType)
|
|
2328
|
+
))
|
|
2329
|
+
return;
|
|
2330
|
+
if (Mt(e.granularity)) return e;
|
|
2331
|
+
if (!vn(e)) return;
|
|
2332
|
+
if (!Dt({
|
|
2333
|
+
fieldId: e.id,
|
|
2334
|
+
dataType: e.dataType,
|
|
2335
|
+
granularity: e.granularity,
|
|
2336
|
+
format: e.format,
|
|
2337
|
+
dateFormat: e.dateFormat,
|
|
2338
|
+
customFormat: e.customFormat
|
|
2339
|
+
}).ok)
|
|
2340
|
+
throw new bn(e.id);
|
|
2341
|
+
return { ...e, granularity: "day" };
|
|
2342
|
+
}
|
|
2343
|
+
function ot(e) {
|
|
2344
|
+
const t = e.cardConfig ?? e.card.config;
|
|
2345
|
+
if (!t || !e.supportsCardType(e.card.type) || _t({
|
|
2346
|
+
hasExecutableConfig: nt(t),
|
|
2347
|
+
sql: e.card.sql,
|
|
2348
|
+
normalizedPython: Wt(e.card.python || "")
|
|
2349
|
+
}) !== "config")
|
|
2350
|
+
return;
|
|
2351
|
+
const a = [
|
|
2352
|
+
...(t.groupByColumns || []).map((r) => ({
|
|
2353
|
+
...r,
|
|
2354
|
+
role: "groupby"
|
|
2355
|
+
})),
|
|
2356
|
+
...e.card.type === "pivotTable" ? (t.pivotByColumns || []).map((r) => ({
|
|
2357
|
+
...r,
|
|
2358
|
+
role: "pivotby"
|
|
2359
|
+
})) : []
|
|
2360
|
+
];
|
|
2361
|
+
return {
|
|
2362
|
+
cardType: e.card.type,
|
|
2363
|
+
cardConfig: t,
|
|
2364
|
+
fields: a.flatMap((r) => {
|
|
2365
|
+
const n = wn(r);
|
|
2366
|
+
return n ? [n] : [];
|
|
2367
|
+
})
|
|
2368
|
+
};
|
|
2369
|
+
}
|
|
2370
|
+
function _o(e) {
|
|
2371
|
+
if (De(e.card))
|
|
2372
|
+
return ot({
|
|
2373
|
+
...e,
|
|
2374
|
+
card: e.card,
|
|
2375
|
+
supportsCardType: (t) => t === "table"
|
|
2376
|
+
});
|
|
2377
|
+
}
|
|
2378
|
+
function Bo(e) {
|
|
2379
|
+
if (De(e.card))
|
|
2380
|
+
return ot({
|
|
2381
|
+
...e,
|
|
2382
|
+
card: e.card,
|
|
2383
|
+
supportsCardType: ka
|
|
2384
|
+
});
|
|
2385
|
+
}
|
|
2386
|
+
function Ro(e) {
|
|
2387
|
+
if (De(e.card))
|
|
2388
|
+
return ot({
|
|
2389
|
+
...e,
|
|
2390
|
+
card: e.card,
|
|
2391
|
+
// Raw detail-table presentation has its own result/adapter contract.
|
|
2392
|
+
// This module remains grouped-only even though the shared producer
|
|
2393
|
+
// registry now recognizes detailTable.
|
|
2394
|
+
supportsCardType: (t) => t !== "detailTable" && Fa(t)
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2397
|
+
const Ft = /* @__PURE__ */ new WeakMap();
|
|
2398
|
+
function xn(e) {
|
|
2399
|
+
const t = Ft.get(e);
|
|
2400
|
+
if (t) return t;
|
|
2401
|
+
const a = Ua(e);
|
|
2402
|
+
return Ft.set(e, a), a;
|
|
2403
|
+
}
|
|
2404
|
+
function ve(e, t) {
|
|
2405
|
+
const a = e ?? [], r = t ?? [];
|
|
2406
|
+
return a.length === r.length && a.every((n, o) => n === r[o]);
|
|
2407
|
+
}
|
|
2408
|
+
function Tn(e, t) {
|
|
2409
|
+
const a = Va({
|
|
2410
|
+
groupByFields: t.groupByColumns,
|
|
2411
|
+
metricFields: t.metricColumns,
|
|
2412
|
+
pivotByFields: t.pivotByColumns,
|
|
2413
|
+
detailFields: t.detailColumns
|
|
2414
|
+
});
|
|
2415
|
+
return ve(
|
|
2416
|
+
e.expectedRoleFieldIds.groupby,
|
|
2417
|
+
a.expectedRoleFieldIds.groupby
|
|
2418
|
+
) && ve(
|
|
2419
|
+
e.expectedRoleFieldIds.metric,
|
|
2420
|
+
a.expectedRoleFieldIds.metric
|
|
2421
|
+
) && ve(
|
|
2422
|
+
e.expectedRoleFieldIds.pivotby,
|
|
2423
|
+
a.expectedRoleFieldIds.pivotby
|
|
2424
|
+
) && ve(
|
|
2425
|
+
e.expectedRoleFieldIds.detail,
|
|
2426
|
+
a.expectedRoleFieldIds.detail
|
|
2427
|
+
) && ve(
|
|
2428
|
+
e.expectedMetricAliases,
|
|
2429
|
+
a.expectedMetricAliases
|
|
2430
|
+
);
|
|
2431
|
+
}
|
|
2432
|
+
class Cn extends Error {
|
|
2433
|
+
constructor(a) {
|
|
2434
|
+
super(
|
|
2435
|
+
`missing_resolved_temporal_format: Saved presentation is missing temporal field "${a.fieldId}" for card "${a.cardId}". Resave the report or Briefing to capture the current dashboard presentation.`
|
|
2436
|
+
);
|
|
2437
|
+
O(this, "code", "missing_resolved_temporal_format");
|
|
2438
|
+
O(this, "deliveryBlocking", !0);
|
|
2439
|
+
O(this, "dashboardId");
|
|
2440
|
+
O(this, "cardId");
|
|
2441
|
+
O(this, "fieldId");
|
|
2442
|
+
this.name = "MissingResolvedTemporalPresentationError", this.dashboardId = a.dashboardId, this.cardId = a.cardId, this.fieldId = a.fieldId;
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
class Ue extends Error {
|
|
2446
|
+
constructor(a) {
|
|
2447
|
+
super(
|
|
2448
|
+
`missing_temporal_bucket_metadata: Result column "${a.columnKey}" is missing temporal bucket metadata for field "${a.fieldId}" on card "${a.cardId}". Refresh the report and resave the delivery if the problem persists.`
|
|
2449
|
+
);
|
|
2450
|
+
O(this, "code", "missing_temporal_bucket_metadata");
|
|
2451
|
+
O(this, "deliveryBlocking", !0);
|
|
2452
|
+
O(this, "cardId");
|
|
2453
|
+
O(this, "fieldId");
|
|
2454
|
+
O(this, "columnKey");
|
|
2455
|
+
this.name = "MissingTemporalResultMetadataError", this.cardId = a.cardId, this.fieldId = a.fieldId, this.columnKey = a.columnKey;
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
class oe extends Error {
|
|
2459
|
+
constructor(a, r, n) {
|
|
2460
|
+
super(`${a}: ${r}`);
|
|
2461
|
+
O(this, "deliveryBlocking", !0);
|
|
2462
|
+
this.code = a, this.context = n, this.name = "DashboardTemporalBoundaryError";
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2465
|
+
function Qt(e, t) {
|
|
2466
|
+
return `${t}:${e}`;
|
|
2467
|
+
}
|
|
2468
|
+
function In(e) {
|
|
2469
|
+
var t, a;
|
|
2470
|
+
return (a = (t = e.presentation) == null ? void 0 : t.byFieldRole) == null ? void 0 : a.get(
|
|
2471
|
+
Qt(e.fieldId, e.role)
|
|
2472
|
+
);
|
|
2473
|
+
}
|
|
2474
|
+
function En(e) {
|
|
2475
|
+
var a;
|
|
2476
|
+
if ((((a = e.cardConfig.metricColumns) == null ? void 0 : a.length) || 0) > 0 || e.binding.role !== "metric")
|
|
2477
|
+
return !1;
|
|
2478
|
+
const t = e.binding.outputKey || e.binding.rawKey;
|
|
2479
|
+
return e.columns.some(
|
|
2480
|
+
(r) => {
|
|
2481
|
+
var n;
|
|
2482
|
+
return r.role === "measure" && r.dataType === "number" && (r.key === t || ((n = r.pivotIdentity) == null ? void 0 : n.metricId) === Ve);
|
|
2483
|
+
}
|
|
2484
|
+
);
|
|
2485
|
+
}
|
|
2486
|
+
function No(e, t) {
|
|
2487
|
+
return !t || t.byColumnKey.size === 0 ? e.map((a) => ({ ...a })) : e.map((a) => {
|
|
2488
|
+
const r = { ...a };
|
|
2489
|
+
return t.byColumnKey.forEach((n, o) => {
|
|
2490
|
+
Object.prototype.hasOwnProperty.call(a, o) && (r[o] = Xt({
|
|
2491
|
+
value: a[o],
|
|
2492
|
+
presentation: n
|
|
2493
|
+
}));
|
|
2494
|
+
}), r;
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
function Po(e) {
|
|
2498
|
+
var p;
|
|
2499
|
+
if (!e.result || typeof e.result != "object") return !1;
|
|
2500
|
+
const t = e.result;
|
|
2501
|
+
if (e.expectedResultOwner !== void 0 && t.resultOwner !== e.expectedResultOwner)
|
|
2502
|
+
return !1;
|
|
2503
|
+
const a = e.activation;
|
|
2504
|
+
if (!a || a.cardType !== "pivotTable" && a.fields.length === 0)
|
|
2505
|
+
return !0;
|
|
2506
|
+
const r = Array.isArray(t.records) ? t.records.length : void 0, n = (a.cardConfig.pivotByColumns || []).map((i) => i.id);
|
|
2507
|
+
if (a.cardType === "pivotTable")
|
|
2508
|
+
try {
|
|
2509
|
+
const i = xn(t);
|
|
2510
|
+
if (!Tn(
|
|
2511
|
+
i.pivotResultContract,
|
|
2512
|
+
a.cardConfig
|
|
2513
|
+
))
|
|
2514
|
+
return !1;
|
|
2515
|
+
if (i.pivotResultState === "loaded_empty") return !0;
|
|
2516
|
+
const h = i.columns.filter(
|
|
2517
|
+
(b) => i.pivotResultContract.columnKinds[b.key] === "pivot_metric"
|
|
2518
|
+
), m = h.filter(
|
|
2519
|
+
(b) => {
|
|
2520
|
+
var x;
|
|
2521
|
+
return (((x = b.pivotIdentity) == null ? void 0 : x.members.length) ?? 0) > 0;
|
|
2522
|
+
}
|
|
2523
|
+
), y = h.length > 0 && h.every(
|
|
2524
|
+
(b) => {
|
|
2525
|
+
var x;
|
|
2526
|
+
return ((x = b.pivotIdentity) == null ? void 0 : x.members.length) === 0 && La({
|
|
2527
|
+
expectedPivotFieldIds: n,
|
|
2528
|
+
classification: i.pivotResultContract.columnClassifications[b.key]
|
|
2529
|
+
});
|
|
2530
|
+
}
|
|
2531
|
+
);
|
|
2532
|
+
return a.fields.every((b) => {
|
|
2533
|
+
var I;
|
|
2534
|
+
const x = we(
|
|
2535
|
+
i.columnKeyMap,
|
|
2536
|
+
b.id,
|
|
2537
|
+
b.role
|
|
2538
|
+
);
|
|
2539
|
+
if (!x) return !1;
|
|
2540
|
+
if (x.role === "pivotby") {
|
|
2541
|
+
const F = m.flatMap(
|
|
2542
|
+
(k) => {
|
|
2543
|
+
var v;
|
|
2544
|
+
return ((v = k.pivotIdentity) == null ? void 0 : v.members.filter(
|
|
2545
|
+
(S) => S.fieldId === b.id
|
|
2546
|
+
)) ?? [];
|
|
2547
|
+
}
|
|
2548
|
+
);
|
|
2549
|
+
return F.length === 0 ? y : F.every(
|
|
2550
|
+
(k) => {
|
|
2551
|
+
var v;
|
|
2552
|
+
return ((v = k.temporalBucket) == null ? void 0 : v.granularity) === b.granularity;
|
|
2553
|
+
}
|
|
2554
|
+
);
|
|
2555
|
+
}
|
|
2556
|
+
const w = i.columns.find(
|
|
2557
|
+
(F) => F.key === (x.outputKey || x.rawKey)
|
|
2558
|
+
);
|
|
2559
|
+
return ((I = w == null ? void 0 : w.temporalBucket) == null ? void 0 : I.granularity) === b.granularity;
|
|
2560
|
+
});
|
|
2561
|
+
} catch (i) {
|
|
2562
|
+
if (i instanceof Ja) return !1;
|
|
2563
|
+
throw i;
|
|
2564
|
+
}
|
|
2565
|
+
if (r === 0)
|
|
2566
|
+
return !0;
|
|
2567
|
+
const o = t.columnKeyMap;
|
|
2568
|
+
if (!o || !o.byRole || typeof o.byRole != "object" || Array.isArray(o.byRole))
|
|
2569
|
+
return !1;
|
|
2570
|
+
const s = [
|
|
2571
|
+
...(a.cardConfig.groupByColumns || []).map((i) => ({
|
|
2572
|
+
field: i,
|
|
2573
|
+
role: "groupby"
|
|
2574
|
+
})),
|
|
2575
|
+
...(a.cardConfig.metricColumns || []).map((i) => ({
|
|
2576
|
+
field: i,
|
|
2577
|
+
role: "metric"
|
|
2578
|
+
})),
|
|
2579
|
+
...(a.cardConfig.pivotByColumns || []).map((i) => ({
|
|
2580
|
+
field: i,
|
|
2581
|
+
role: "pivotby"
|
|
2582
|
+
})),
|
|
2583
|
+
...(a.cardConfig.detailColumns || []).map((i) => ({
|
|
2584
|
+
field: i,
|
|
2585
|
+
role: "detail"
|
|
2586
|
+
}))
|
|
2587
|
+
], u = new Set(
|
|
2588
|
+
s.map(({ field: i, role: h }) => `${h}:${i.id}`)
|
|
2589
|
+
), d = new Map(
|
|
2590
|
+
(t.columns || []).map((i) => [i.key, i])
|
|
2591
|
+
), l = we(
|
|
2592
|
+
o,
|
|
2593
|
+
Ve,
|
|
2594
|
+
"metric"
|
|
2595
|
+
);
|
|
2596
|
+
if (l) {
|
|
2597
|
+
if (!En({
|
|
2598
|
+
cardConfig: a.cardConfig,
|
|
2599
|
+
binding: l,
|
|
2600
|
+
columns: t.columns || []
|
|
2601
|
+
}))
|
|
2602
|
+
return !1;
|
|
2603
|
+
u.add(`metric:${Ve}`);
|
|
2604
|
+
}
|
|
2605
|
+
const c = Object.entries(o.byRole).flatMap(
|
|
2606
|
+
([i, h]) => Object.keys(h || {}).map((m) => `${i}:${m}`)
|
|
2607
|
+
);
|
|
2608
|
+
if (c.length !== u.size || c.some((i) => !u.has(i)) || s.some(
|
|
2609
|
+
({ field: i, role: h }) => !we(o, i.id, h)
|
|
2610
|
+
))
|
|
2611
|
+
return !1;
|
|
2612
|
+
try {
|
|
2613
|
+
Ya(
|
|
2614
|
+
(t.columns || []).map((i) => ({
|
|
2615
|
+
key: i.key,
|
|
2616
|
+
pivotIdentity: i.pivotIdentity
|
|
2617
|
+
})),
|
|
2618
|
+
{
|
|
2619
|
+
expectedPivotFieldIds: n,
|
|
2620
|
+
columnClassifications: t.columnMetadata
|
|
2621
|
+
}
|
|
2622
|
+
);
|
|
2623
|
+
} catch (i) {
|
|
2624
|
+
if (i instanceof qa) return !1;
|
|
2625
|
+
throw i;
|
|
2626
|
+
}
|
|
2627
|
+
const f = (t.columns || []).filter((i) => {
|
|
2628
|
+
const h = i.pivotIdentity;
|
|
2629
|
+
return !!(h && h.members.length > 0);
|
|
2630
|
+
});
|
|
2631
|
+
return r !== 0 && ((p = a.cardConfig.pivotByColumns) != null && p.length) && f.length === 0 ? !1 : a.fields.every((i) => {
|
|
2632
|
+
var y;
|
|
2633
|
+
const h = we(
|
|
2634
|
+
o,
|
|
2635
|
+
i.id,
|
|
2636
|
+
i.role
|
|
2637
|
+
);
|
|
2638
|
+
if (!h) return !1;
|
|
2639
|
+
if (h.role === "pivotby") {
|
|
2640
|
+
const x = f.flatMap(
|
|
2641
|
+
(w) => {
|
|
2642
|
+
var I;
|
|
2643
|
+
return ((I = w.pivotIdentity) == null ? void 0 : I.members) ?? [];
|
|
2644
|
+
}
|
|
2645
|
+
).filter((w) => w.fieldId === i.id);
|
|
2646
|
+
return f.length === 0 ? r === 0 : x.length > 0 && x.every(
|
|
2647
|
+
(w) => {
|
|
2648
|
+
var I;
|
|
2649
|
+
return ((I = w.temporalBucket) == null ? void 0 : I.granularity) === i.granularity;
|
|
2650
|
+
}
|
|
2651
|
+
);
|
|
2652
|
+
}
|
|
2653
|
+
const m = d.get(h.outputKey || h.rawKey);
|
|
2654
|
+
return ((y = m == null ? void 0 : m.temporalBucket) == null ? void 0 : y.granularity) === i.granularity;
|
|
2655
|
+
});
|
|
2656
|
+
}
|
|
2657
|
+
function Ne(e, t) {
|
|
2658
|
+
const a = e.semanticTemporalPresentation, r = t === "card" ? {
|
|
2659
|
+
format: e.format,
|
|
2660
|
+
dateFormat: e.dateFormat
|
|
2661
|
+
} : { format: a == null ? void 0 : a.format };
|
|
2662
|
+
if (!Pt(r))
|
|
2663
|
+
return;
|
|
2664
|
+
const n = Dt({
|
|
2665
|
+
fieldId: e.id,
|
|
2666
|
+
dataType: e.dataType,
|
|
2667
|
+
granularity: t === "semantic" ? a == null ? void 0 : a.granularity : e.granularity,
|
|
2668
|
+
...t === "card" ? {
|
|
2669
|
+
format: e.format,
|
|
2670
|
+
dateFormat: e.dateFormat,
|
|
2671
|
+
customFormat: e.customFormat
|
|
2672
|
+
} : { format: a == null ? void 0 : a.format }
|
|
2673
|
+
});
|
|
2674
|
+
if (!n.ok) throw new Error(n.error.code);
|
|
2675
|
+
return n.format;
|
|
2676
|
+
}
|
|
2677
|
+
function Sn(e, t, a = Bt) {
|
|
2678
|
+
const r = Ne(e, "card"), n = Ne(e, "semantic"), o = e.semanticTemporalPresentation;
|
|
2679
|
+
return Nt({
|
|
2680
|
+
metadata: t,
|
|
2681
|
+
...r ? { cardFormat: r } : {},
|
|
2682
|
+
...n && o ? {
|
|
2683
|
+
semanticFormat: {
|
|
2684
|
+
granularity: o.granularity,
|
|
2685
|
+
format: n
|
|
2686
|
+
}
|
|
2687
|
+
} : {},
|
|
2688
|
+
locale: a.locale,
|
|
2689
|
+
styles: {
|
|
2690
|
+
dateStyle: a.dateStyle,
|
|
2691
|
+
dateTime: a.dateTime
|
|
2692
|
+
}
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
function Do(e, t = Qa, a = "en-US") {
|
|
2696
|
+
var s;
|
|
2697
|
+
const r = Ne(e, "card"), n = ((s = e.semanticTemporalPresentation) == null ? void 0 : s.granularity) === e.granularity ? Ne(e, "semantic") : void 0, o = r && r.presentation.mode !== "auto" ? r : n && n.presentation.mode !== "auto" ? n : {
|
|
2698
|
+
presentation: { mode: "auto" }
|
|
2699
|
+
};
|
|
2700
|
+
return o.presentation.mode === "auto" ? {
|
|
2701
|
+
type: "temporal_bucket",
|
|
2702
|
+
locale: a,
|
|
2703
|
+
presentation: { mode: "auto", styles: t }
|
|
2704
|
+
} : {
|
|
2705
|
+
type: "temporal_bucket",
|
|
2706
|
+
locale: a,
|
|
2707
|
+
presentation: o.presentation
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
function Ao(e) {
|
|
2711
|
+
const t = e.activation;
|
|
2712
|
+
if (!t)
|
|
2713
|
+
return {
|
|
2714
|
+
byColumnKey: /* @__PURE__ */ new Map(),
|
|
2715
|
+
byFieldId: /* @__PURE__ */ new Map(),
|
|
2716
|
+
byFieldRole: /* @__PURE__ */ new Map()
|
|
2717
|
+
};
|
|
2718
|
+
if (e.resultRowCount === 0)
|
|
2719
|
+
return {
|
|
2720
|
+
byColumnKey: /* @__PURE__ */ new Map(),
|
|
2721
|
+
byFieldId: /* @__PURE__ */ new Map(),
|
|
2722
|
+
byFieldRole: /* @__PURE__ */ new Map()
|
|
2723
|
+
};
|
|
2724
|
+
const a = new Map(
|
|
2725
|
+
(e.columns || []).map((l) => [l.key, l])
|
|
2726
|
+
), r = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = t.fields.reduce((l, c) => (l.set(c.id, (l.get(c.id) || 0) + 1), l), /* @__PURE__ */ new Map()), u = (l, c) => {
|
|
2727
|
+
o.set(
|
|
2728
|
+
Qt(l.id, l.role),
|
|
2729
|
+
c
|
|
2730
|
+
), s.get(l.id) === 1 && n.set(l.id, c);
|
|
2731
|
+
}, d = (l, c, f) => {
|
|
2732
|
+
if (c.granularity !== l.granularity)
|
|
2733
|
+
throw new oe(
|
|
2734
|
+
"invalid_temporal_bucket_metadata",
|
|
2735
|
+
`Result identity "${f}" declares ${c.granularity} buckets for active ${l.granularity} field "${l.id}".`,
|
|
2736
|
+
{ cardId: e.card.id, fieldId: l.id, columnKey: f }
|
|
2737
|
+
);
|
|
2738
|
+
const p = e.executionSnapshot && e.dashboardId ? Ga({
|
|
2739
|
+
snapshot: e.executionSnapshot,
|
|
2740
|
+
scope: {
|
|
2741
|
+
dashboardId: e.dashboardId,
|
|
2742
|
+
cardId: e.card.id,
|
|
2743
|
+
...e.attachmentIndex !== void 0 ? { attachmentIndex: e.attachmentIndex } : {}
|
|
2744
|
+
},
|
|
2745
|
+
target: {
|
|
2746
|
+
kind: "field",
|
|
2747
|
+
fieldId: l.id,
|
|
2748
|
+
role: l.role
|
|
2749
|
+
}
|
|
2750
|
+
}) : void 0;
|
|
2751
|
+
if (e.executionSnapshot && !p)
|
|
2752
|
+
throw new Cn({
|
|
2753
|
+
dashboardId: e.dashboardId,
|
|
2754
|
+
cardId: e.card.id,
|
|
2755
|
+
fieldId: l.id
|
|
2756
|
+
});
|
|
2757
|
+
return {
|
|
2758
|
+
columnKey: f,
|
|
2759
|
+
fieldId: l.id,
|
|
2760
|
+
role: l.role,
|
|
2761
|
+
metadata: c,
|
|
2762
|
+
resolved: p ? Nt({
|
|
2763
|
+
metadata: c,
|
|
2764
|
+
cardFormat: p,
|
|
2765
|
+
locale: p.locale,
|
|
2766
|
+
...p.presentation.mode === "auto" ? {
|
|
2767
|
+
styles: p.presentation.styles
|
|
2768
|
+
} : {}
|
|
2769
|
+
}) : Sn(
|
|
2770
|
+
l,
|
|
2771
|
+
c,
|
|
2772
|
+
e.valueFormatPreferences ?? Bt
|
|
2773
|
+
)
|
|
2774
|
+
};
|
|
2775
|
+
};
|
|
2776
|
+
for (const l of t.fields) {
|
|
2777
|
+
const c = we(
|
|
2778
|
+
e.columnKeyMap,
|
|
2779
|
+
l.id,
|
|
2780
|
+
l.role
|
|
2781
|
+
);
|
|
2782
|
+
if (!c) {
|
|
2783
|
+
if (e.columns === void 0 && e.columnKeyMap === void 0 && (e.resultRowCount === void 0 || e.resultRowCount === 0))
|
|
2784
|
+
continue;
|
|
2785
|
+
throw new oe(
|
|
2786
|
+
"missing_temporal_column_binding",
|
|
2787
|
+
`Activated temporal field "${l.id}" has no authoritative result-column binding.`,
|
|
2788
|
+
{ cardId: e.card.id, fieldId: l.id, columnKey: l.name }
|
|
2789
|
+
);
|
|
2790
|
+
}
|
|
2791
|
+
if (c.role === "pivotby") {
|
|
2792
|
+
const m = (e.columns || []).filter(
|
|
2793
|
+
(I) => I.pivotIdentity !== void 0
|
|
2794
|
+
), y = m.flatMap(
|
|
2795
|
+
(I) => {
|
|
2796
|
+
var F;
|
|
2797
|
+
return (((F = I.pivotIdentity) == null ? void 0 : F.members) || []).filter((k) => k.fieldId === l.id).map((k) => ({ column: I, member: k }));
|
|
2798
|
+
}
|
|
2799
|
+
);
|
|
2800
|
+
if (y.length === 0) {
|
|
2801
|
+
if (m.length === 0 && (e.card.type !== "pivotTable" || e.resultRowCount === 0))
|
|
2802
|
+
continue;
|
|
2803
|
+
throw new Ue({
|
|
2804
|
+
cardId: e.card.id,
|
|
2805
|
+
fieldId: l.id,
|
|
2806
|
+
columnKey: c.outputKey || c.rawKey
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
const b = y[0];
|
|
2810
|
+
if (!b.member.temporalBucket)
|
|
2811
|
+
throw new Ue({
|
|
2812
|
+
cardId: e.card.id,
|
|
2813
|
+
fieldId: l.id,
|
|
2814
|
+
columnKey: b.column.key
|
|
2815
|
+
});
|
|
2816
|
+
const x = Ka(
|
|
2817
|
+
b.member.temporalBucket
|
|
2818
|
+
);
|
|
2819
|
+
if (!x.ok || !x.value)
|
|
2820
|
+
throw new oe(
|
|
2821
|
+
"invalid_temporal_bucket_metadata",
|
|
2822
|
+
x.ok ? `Pivot result column "${b.column.key}" has no validated temporal bucket metadata.` : x.error.message,
|
|
2823
|
+
{
|
|
2824
|
+
cardId: e.card.id,
|
|
2825
|
+
fieldId: l.id,
|
|
2826
|
+
columnKey: b.column.key
|
|
2827
|
+
}
|
|
2828
|
+
);
|
|
2829
|
+
const w = d(
|
|
2830
|
+
l,
|
|
2831
|
+
x.value,
|
|
2832
|
+
b.column.key
|
|
2833
|
+
);
|
|
2834
|
+
for (const { column: I, member: F } of y)
|
|
2835
|
+
if (!F.temporalBucket || JSON.stringify(F.temporalBucket) !== JSON.stringify(b.member.temporalBucket))
|
|
2836
|
+
throw new oe(
|
|
2837
|
+
"invalid_temporal_bucket_metadata",
|
|
2838
|
+
`Pivot result column "${I.key}" has contradictory bucket metadata for field "${l.id}".`,
|
|
2839
|
+
{ cardId: e.card.id, fieldId: l.id, columnKey: I.key }
|
|
2840
|
+
);
|
|
2841
|
+
u(l, w);
|
|
2842
|
+
continue;
|
|
2843
|
+
}
|
|
2844
|
+
const f = c.outputKey || c.rawKey, p = a.get(f);
|
|
2845
|
+
if (!(p != null && p.temporalBucket))
|
|
2846
|
+
throw new Ue({
|
|
2847
|
+
cardId: e.card.id,
|
|
2848
|
+
fieldId: l.id,
|
|
2849
|
+
columnKey: f
|
|
2850
|
+
});
|
|
2851
|
+
const i = za(p, {
|
|
2852
|
+
metadataRequired: !0
|
|
2853
|
+
});
|
|
2854
|
+
if (!i.ok || !i.value)
|
|
2855
|
+
throw new oe(
|
|
2856
|
+
"invalid_temporal_bucket_metadata",
|
|
2857
|
+
i.ok ? `Result column "${f}" has no validated temporal bucket metadata.` : i.error.message,
|
|
2858
|
+
{ cardId: e.card.id, fieldId: l.id, columnKey: f }
|
|
2859
|
+
);
|
|
2860
|
+
const h = d(
|
|
2861
|
+
l,
|
|
2862
|
+
i.value,
|
|
2863
|
+
f
|
|
2864
|
+
);
|
|
2865
|
+
r.set(f, h), u(l, h);
|
|
2866
|
+
}
|
|
2867
|
+
return { byColumnKey: r, byFieldId: n, byFieldRole: o };
|
|
2868
|
+
}
|
|
2869
|
+
function $o(e) {
|
|
2870
|
+
var a, r;
|
|
2871
|
+
const t = e.role ? In({
|
|
2872
|
+
presentation: e.presentation,
|
|
2873
|
+
fieldId: e.fieldId,
|
|
2874
|
+
role: e.role
|
|
2875
|
+
}) : (r = (a = e.presentation) == null ? void 0 : a.byFieldId) == null ? void 0 : r.get(e.fieldId);
|
|
2876
|
+
return t ? Xt({
|
|
2877
|
+
value: e.value,
|
|
2878
|
+
presentation: t
|
|
2879
|
+
}) : e.value === null || e.value === void 0 ? "" : String(e.value);
|
|
2880
|
+
}
|
|
2881
|
+
function Xt(e) {
|
|
2882
|
+
if (e.value === null || e.value === void 0) return "(Blank)";
|
|
2883
|
+
if (typeof e.value != "string")
|
|
2884
|
+
throw new oe(
|
|
2885
|
+
"invalid_temporal_bucket_value",
|
|
2886
|
+
`Canonical temporal column "${e.presentation.columnKey}" must contain a string or null.`,
|
|
2887
|
+
{
|
|
2888
|
+
fieldId: e.presentation.fieldId,
|
|
2889
|
+
columnKey: e.presentation.columnKey
|
|
2890
|
+
}
|
|
2891
|
+
);
|
|
2892
|
+
try {
|
|
2893
|
+
return Ha({
|
|
2894
|
+
value: e.value,
|
|
2895
|
+
metadata: e.presentation.metadata,
|
|
2896
|
+
format: e.presentation.resolved.format
|
|
2897
|
+
});
|
|
2898
|
+
} catch (t) {
|
|
2899
|
+
throw t instanceof Wa ? new oe(
|
|
2900
|
+
t.code,
|
|
2901
|
+
t.message,
|
|
2902
|
+
{
|
|
2903
|
+
fieldId: e.presentation.fieldId,
|
|
2904
|
+
columnKey: e.presentation.columnKey
|
|
2905
|
+
}
|
|
2906
|
+
) : t;
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
function it(e) {
|
|
2910
|
+
if (!(e != null && e.expectedType)) return "table";
|
|
2911
|
+
const t = Array.isArray(e.expectedType) ? e.expectedType[0] : e.expectedType;
|
|
2912
|
+
return kn(t) ? t : "table";
|
|
2913
|
+
}
|
|
2914
|
+
const Fn = [
|
|
2915
|
+
"bar",
|
|
2916
|
+
"horizontalBar",
|
|
2917
|
+
"line",
|
|
2918
|
+
"area",
|
|
2919
|
+
"stackedArea",
|
|
2920
|
+
"combo",
|
|
2921
|
+
"pie",
|
|
2922
|
+
"doughnut",
|
|
2923
|
+
"radar",
|
|
2924
|
+
"polarArea",
|
|
2925
|
+
"bubble",
|
|
2926
|
+
"scatter",
|
|
2927
|
+
"stackedBar",
|
|
2928
|
+
"stackedLine",
|
|
2929
|
+
"table",
|
|
2930
|
+
"pivotTable",
|
|
2931
|
+
"aggregateTable",
|
|
2932
|
+
"detailTable",
|
|
2933
|
+
"kpi",
|
|
2934
|
+
"pyramid",
|
|
2935
|
+
"tornado",
|
|
2936
|
+
"range",
|
|
2937
|
+
"text",
|
|
2938
|
+
"map",
|
|
2939
|
+
"funnel",
|
|
2940
|
+
"bullet",
|
|
2941
|
+
"heatmap",
|
|
2942
|
+
"treemap",
|
|
2943
|
+
"custom"
|
|
2944
|
+
];
|
|
2945
|
+
function kn(e) {
|
|
2946
|
+
return Fn.includes(e);
|
|
2947
|
+
}
|
|
2948
|
+
function Ce(e) {
|
|
2949
|
+
const t = e.position;
|
|
2950
|
+
if (typeof t == "number") return t;
|
|
2951
|
+
if (typeof t == "string") {
|
|
2952
|
+
const a = t.match(/\d+/);
|
|
2953
|
+
if (a) {
|
|
2954
|
+
const r = Number(a[0]);
|
|
2955
|
+
if (!Number.isNaN(r)) return r;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
return Number.POSITIVE_INFINITY;
|
|
2959
|
+
}
|
|
2960
|
+
function xe(e) {
|
|
2961
|
+
if (typeof e == "number")
|
|
2962
|
+
return { kind: "number", start: e, end: e };
|
|
2963
|
+
if (typeof e == "string") {
|
|
2964
|
+
const t = e.match(/^(\d+)$/);
|
|
2965
|
+
if (t) {
|
|
2966
|
+
const n = Number(t[1]);
|
|
2967
|
+
return { kind: "number", start: n, end: n };
|
|
2968
|
+
}
|
|
2969
|
+
const a = e.match(/^(\d+)-(\d+)$/);
|
|
2970
|
+
if (a) {
|
|
2971
|
+
const n = Number(a[1]), o = Number(a[2]);
|
|
2972
|
+
return { kind: "range", start: n, end: o };
|
|
2973
|
+
}
|
|
2974
|
+
const r = e.match(/^(\d+)\+$/);
|
|
2975
|
+
if (r)
|
|
2976
|
+
return { kind: "dynamic", start: Number(r[1]), end: Number.POSITIVE_INFINITY };
|
|
2977
|
+
}
|
|
2978
|
+
return null;
|
|
2979
|
+
}
|
|
2980
|
+
function Zt(e) {
|
|
2981
|
+
return !e || e.length === 0 ? void 0 : [...e].sort(
|
|
2982
|
+
(a, r) => Ce(a) - Ce(r)
|
|
2983
|
+
)[0];
|
|
2984
|
+
}
|
|
2985
|
+
function ea(e, t) {
|
|
2986
|
+
if (!e || e.length === 0) return;
|
|
2987
|
+
const a = [], r = [], n = [];
|
|
2988
|
+
e.forEach((c) => {
|
|
2989
|
+
const f = xe(c.position);
|
|
2990
|
+
f && (f.kind === "number" ? a.push(c) : f.kind === "range" ? r.push(c) : f.kind === "dynamic" && n.push(c));
|
|
2991
|
+
});
|
|
2992
|
+
const o = a.find((c) => {
|
|
2993
|
+
const f = xe(c.position);
|
|
2994
|
+
return (f == null ? void 0 : f.kind) === "number" && f.start === t;
|
|
2995
|
+
});
|
|
2996
|
+
if (o) return o;
|
|
2997
|
+
const u = r.sort(
|
|
2998
|
+
(c, f) => Ce(c) - Ce(f)
|
|
2999
|
+
).find((c) => {
|
|
3000
|
+
const f = xe(c.position);
|
|
3001
|
+
return (f == null ? void 0 : f.kind) === "range" && t >= f.start && t <= f.end;
|
|
3002
|
+
});
|
|
3003
|
+
if (u) return u;
|
|
3004
|
+
const l = n.map((c) => ({
|
|
3005
|
+
slot: c,
|
|
3006
|
+
parsed: xe(c.position)
|
|
3007
|
+
})).filter((c) => {
|
|
3008
|
+
var f;
|
|
3009
|
+
return ((f = c.parsed) == null ? void 0 : f.kind) === "dynamic";
|
|
3010
|
+
}).sort(
|
|
3011
|
+
(c, f) => {
|
|
3012
|
+
var p, i;
|
|
3013
|
+
return (((p = c.parsed) == null ? void 0 : p.start) ?? 0) - (((i = f.parsed) == null ? void 0 : i.start) ?? 0);
|
|
3014
|
+
}
|
|
3015
|
+
).filter((c) => {
|
|
3016
|
+
var f;
|
|
3017
|
+
return t >= (((f = c.parsed) == null ? void 0 : f.start) ?? 0);
|
|
3018
|
+
}).sort(
|
|
3019
|
+
(c, f) => {
|
|
3020
|
+
var p, i;
|
|
3021
|
+
return (((p = f.parsed) == null ? void 0 : p.start) ?? 0) - (((i = c.parsed) == null ? void 0 : i.start) ?? 0);
|
|
3022
|
+
}
|
|
3023
|
+
)[0];
|
|
3024
|
+
return l == null ? void 0 : l.slot;
|
|
3025
|
+
}
|
|
3026
|
+
function Mn(e, t) {
|
|
3027
|
+
const a = ea(e, t);
|
|
3028
|
+
if (a)
|
|
3029
|
+
return it(a);
|
|
3030
|
+
}
|
|
3031
|
+
function _n(e, t) {
|
|
3032
|
+
var r;
|
|
3033
|
+
const a = (r = e == null ? void 0 : e.customCardPreferences) == null ? void 0 : r.slotIndex;
|
|
3034
|
+
return typeof a == "number" ? a : t;
|
|
3035
|
+
}
|
|
3036
|
+
function kt(e, t) {
|
|
3037
|
+
var a;
|
|
3038
|
+
if (!((a = e == null ? void 0 : e.customCardPreferences) != null && a.url))
|
|
3039
|
+
return !1;
|
|
3040
|
+
if (e.type === "custom" || e.customCardPreferences.visualType === "multiple" || e.customCardPreferences.dataInputCardIds || (e.customCardPreferences.minInputs || 0) > 1 || (e.customCardPreferences.maxInputs || 0) > 1)
|
|
3041
|
+
return !0;
|
|
3042
|
+
if (t && t.length > 1) {
|
|
3043
|
+
const r = t.filter(
|
|
3044
|
+
(n) => {
|
|
3045
|
+
var o;
|
|
3046
|
+
return typeof ((o = n.customCardPreferences) == null ? void 0 : o.slotIndex) == "number";
|
|
3047
|
+
}
|
|
3048
|
+
);
|
|
3049
|
+
if (r.length > 1 && r.some((n) => n.id !== e.id))
|
|
3050
|
+
return !0;
|
|
3051
|
+
}
|
|
3052
|
+
return !1;
|
|
3053
|
+
}
|
|
3054
|
+
function jo(e) {
|
|
3055
|
+
const t = [];
|
|
3056
|
+
let a = -1;
|
|
3057
|
+
e.forEach((r, n) => {
|
|
3058
|
+
const o = _n(r, n);
|
|
3059
|
+
o > a && (a = o), t[o] = r ?? null;
|
|
3060
|
+
});
|
|
3061
|
+
for (let r = 0; r <= a; r += 1)
|
|
3062
|
+
r in t || (t[r] = null);
|
|
3063
|
+
return t;
|
|
3064
|
+
}
|
|
3065
|
+
function Oo(e) {
|
|
3066
|
+
return e.map((t, a) => !t.customCardPreferences || t.customCardPreferences.slotIndex === a ? t : {
|
|
3067
|
+
...t,
|
|
3068
|
+
customCardPreferences: {
|
|
3069
|
+
...t.customCardPreferences,
|
|
3070
|
+
slotIndex: a
|
|
3071
|
+
}
|
|
3072
|
+
});
|
|
3073
|
+
}
|
|
3074
|
+
function Lo(e) {
|
|
3075
|
+
const t = Zt(e);
|
|
3076
|
+
if (t)
|
|
3077
|
+
return it(t);
|
|
3078
|
+
}
|
|
3079
|
+
function Yo(e, t, a) {
|
|
3080
|
+
if (!e) return;
|
|
3081
|
+
const r = Mn(a, t);
|
|
3082
|
+
return e.type === "custom" && r ? r : e.type;
|
|
3083
|
+
}
|
|
3084
|
+
function qo(e, t, a) {
|
|
3085
|
+
var h;
|
|
3086
|
+
const r = {
|
|
3087
|
+
dataSource: a.dataSource,
|
|
3088
|
+
connectionId: a.connectionId,
|
|
3089
|
+
lastSelectedDatabase: a.lastSelectedDatabase,
|
|
3090
|
+
lastSelectedSchema: a.lastSelectedSchema,
|
|
3091
|
+
lastSelectedTable: a.lastSelectedTable,
|
|
3092
|
+
lastSelectedDatamodelId: a.lastSelectedDatamodelId,
|
|
3093
|
+
datamodelId: a.datamodelId
|
|
3094
|
+
}, n = {
|
|
3095
|
+
type: "component",
|
|
3096
|
+
visualType: "multiple",
|
|
3097
|
+
url: t.url,
|
|
3098
|
+
componentName: t.name,
|
|
3099
|
+
icon: t.icon,
|
|
3100
|
+
pluginChartType: t.chartType,
|
|
3101
|
+
minInputs: t.minInputs,
|
|
3102
|
+
maxInputs: t.maxInputs
|
|
3103
|
+
}, o = t.minInputs || 1, u = e.map((m) => ({ slot: m, parsed: xe(m.position) })).filter((m) => m.parsed !== null).reduce((m, y) => {
|
|
3104
|
+
const b = y.parsed.end;
|
|
3105
|
+
return Number.isFinite(b) ? Math.max(m, b) : m;
|
|
3106
|
+
}, -1), d = Math.max(o, u + 1), l = Zt(e), c = l ? Ce(l) : 0;
|
|
3107
|
+
let f = !1;
|
|
3108
|
+
const p = [];
|
|
3109
|
+
for (let m = 0; m < d; m += 1) {
|
|
3110
|
+
const y = ea(e, m), b = it(y), x = !f && m === c, w = m, I = {
|
|
3111
|
+
...r,
|
|
3112
|
+
id: ar(),
|
|
3113
|
+
title: (x ? l == null ? void 0 : l.label : y == null ? void 0 : y.label) || `Tab ${m + 1}`,
|
|
3114
|
+
tabTitle: (x ? l == null ? void 0 : l.label : y == null ? void 0 : y.label) || `Tab ${m + 1}`,
|
|
3115
|
+
description: (x ? l == null ? void 0 : l.description : y == null ? void 0 : y.description) || "",
|
|
3116
|
+
type: b,
|
|
3117
|
+
sql: "",
|
|
3118
|
+
preferences: {
|
|
3119
|
+
onClickFilter: [{ columnIndex: 0, expression: "" }]
|
|
3120
|
+
},
|
|
3121
|
+
...x && {
|
|
3122
|
+
customCardPreferences: {
|
|
3123
|
+
...n,
|
|
3124
|
+
slotIndex: w
|
|
3125
|
+
}
|
|
3126
|
+
},
|
|
3127
|
+
...!x && {
|
|
3128
|
+
customCardPreferences: {
|
|
3129
|
+
slotIndex: w
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
};
|
|
3133
|
+
x && (f = !0), p.push(I);
|
|
3134
|
+
}
|
|
3135
|
+
if (!f && p.length > 0) {
|
|
3136
|
+
const m = ((h = p[0].customCardPreferences) == null ? void 0 : h.slotIndex) ?? 0;
|
|
3137
|
+
p[0] = {
|
|
3138
|
+
...p[0],
|
|
3139
|
+
type: p[0].type,
|
|
3140
|
+
customCardPreferences: {
|
|
3141
|
+
...n,
|
|
3142
|
+
slotIndex: m
|
|
3143
|
+
}
|
|
3144
|
+
};
|
|
3145
|
+
}
|
|
3146
|
+
const i = p.findIndex(
|
|
3147
|
+
(m) => {
|
|
3148
|
+
var y;
|
|
3149
|
+
return !!((y = m.customCardPreferences) != null && y.url);
|
|
3150
|
+
}
|
|
3151
|
+
);
|
|
3152
|
+
if (i > 0) {
|
|
3153
|
+
const [m] = p.splice(i, 1);
|
|
3154
|
+
p.unshift(m);
|
|
3155
|
+
}
|
|
3156
|
+
return p;
|
|
3157
|
+
}
|
|
3158
|
+
function Ko({
|
|
3159
|
+
frame: e,
|
|
3160
|
+
configCard: t,
|
|
3161
|
+
isMultiInputVisual: a
|
|
3162
|
+
}) {
|
|
3163
|
+
var n;
|
|
3164
|
+
if (!a || !t)
|
|
3165
|
+
return e.cards;
|
|
3166
|
+
const r = (n = t.customCardPreferences) == null ? void 0 : n.dataInputCardIds;
|
|
3167
|
+
return r ? Object.keys(r).sort((o, s) => Number(o) - Number(s)).map((o) => {
|
|
3168
|
+
var u;
|
|
3169
|
+
const s = (u = r[o]) == null ? void 0 : u.cardId;
|
|
3170
|
+
return e.cards.find((d) => d.id === s) || null;
|
|
3171
|
+
}) : e.cards;
|
|
3172
|
+
}
|
|
3173
|
+
function zo(e, t) {
|
|
3174
|
+
return t && kt(t, e.cards) ? t : e.cards.find((a) => kt(a, e.cards)) || null;
|
|
3175
|
+
}
|
|
3176
|
+
function Uo(e, t) {
|
|
3177
|
+
var n, o;
|
|
3178
|
+
if (!e) return null;
|
|
3179
|
+
const a = t == null ? void 0 : t.visualType;
|
|
3180
|
+
if (a) return a;
|
|
3181
|
+
if (t != null && t.slots && t.slots.length > 0 || ((t == null ? void 0 : t.minInputs) || 0) > 1 || ((t == null ? void 0 : t.maxInputs) || 0) > 1 || ((t == null ? void 0 : t.dataInputs) || []).length > 1)
|
|
3182
|
+
return "multiple";
|
|
3183
|
+
const r = (n = e.customCardPreferences) == null ? void 0 : n.visualType;
|
|
3184
|
+
return r || ((o = e.customCardPreferences) != null && o.dataInputCardIds ? "multiple" : null);
|
|
3185
|
+
}
|
|
3186
|
+
function Vo(e) {
|
|
3187
|
+
return e.visualType === "multiple" || e.slots && e.slots.length > 0 || (e.minInputs || 0) > 1 || (e.maxInputs || 0) > 1 || (e.dataInputs || []).length > 1 ? "multiple" : "single";
|
|
3188
|
+
}
|
|
3189
|
+
function Go(e) {
|
|
3190
|
+
return Array.isArray(e) ? { records: e } : e;
|
|
3191
|
+
}
|
|
3192
|
+
export {
|
|
3193
|
+
lo as $,
|
|
3194
|
+
ko as A,
|
|
3195
|
+
Tr as B,
|
|
3196
|
+
ro as C,
|
|
3197
|
+
yr as D,
|
|
3198
|
+
Eo as E,
|
|
3199
|
+
yn as F,
|
|
3200
|
+
co as G,
|
|
3201
|
+
Kt as H,
|
|
3202
|
+
Zr as I,
|
|
3203
|
+
Vo as J,
|
|
3204
|
+
qo as K,
|
|
3205
|
+
Lt as L,
|
|
3206
|
+
ea as M,
|
|
3207
|
+
Oo as N,
|
|
3208
|
+
it as O,
|
|
3209
|
+
pr as P,
|
|
3210
|
+
R as Q,
|
|
3211
|
+
wr as R,
|
|
3212
|
+
on as S,
|
|
3213
|
+
to as T,
|
|
3214
|
+
hr as U,
|
|
3215
|
+
ze as V,
|
|
3216
|
+
mo as W,
|
|
3217
|
+
Lo as X,
|
|
3218
|
+
xo as Y,
|
|
3219
|
+
wo as Z,
|
|
3220
|
+
Co as _,
|
|
3221
|
+
Fo as a,
|
|
3222
|
+
To as a0,
|
|
3223
|
+
hn as a1,
|
|
3224
|
+
Io as a2,
|
|
3225
|
+
Qn as a3,
|
|
3226
|
+
Ze as a4,
|
|
3227
|
+
He as a5,
|
|
3228
|
+
oo as a6,
|
|
3229
|
+
no as a7,
|
|
3230
|
+
io as a8,
|
|
3231
|
+
Ao as a9,
|
|
3232
|
+
ho as aA,
|
|
3233
|
+
uo as aB,
|
|
3234
|
+
Xn as aC,
|
|
3235
|
+
Zn as aD,
|
|
3236
|
+
en as aE,
|
|
3237
|
+
_o as aa,
|
|
3238
|
+
Xt as ab,
|
|
3239
|
+
Po as ac,
|
|
3240
|
+
Bo as ad,
|
|
3241
|
+
xt as ae,
|
|
3242
|
+
Yt as af,
|
|
3243
|
+
po as ag,
|
|
3244
|
+
oe as ah,
|
|
3245
|
+
$o as ai,
|
|
3246
|
+
bn as aj,
|
|
3247
|
+
xn as ak,
|
|
3248
|
+
Tn as al,
|
|
3249
|
+
No as am,
|
|
3250
|
+
qt as an,
|
|
3251
|
+
go as ao,
|
|
3252
|
+
gr as ap,
|
|
3253
|
+
ao as aq,
|
|
3254
|
+
eo as ar,
|
|
3255
|
+
fe as as,
|
|
3256
|
+
me as at,
|
|
3257
|
+
yo as au,
|
|
3258
|
+
rn as av,
|
|
3259
|
+
fo as aw,
|
|
3260
|
+
bo as ax,
|
|
3261
|
+
ie as ay,
|
|
3262
|
+
Be as az,
|
|
3263
|
+
Ro as b,
|
|
3264
|
+
Do as c,
|
|
3265
|
+
Uo as d,
|
|
3266
|
+
jo as e,
|
|
3267
|
+
zo as f,
|
|
3268
|
+
G as g,
|
|
3269
|
+
Ko as h,
|
|
3270
|
+
kt as i,
|
|
3271
|
+
_n as j,
|
|
3272
|
+
Yo as k,
|
|
3273
|
+
Go as l,
|
|
3274
|
+
Dt as m,
|
|
3275
|
+
Wt as n,
|
|
3276
|
+
De as o,
|
|
3277
|
+
vr as p,
|
|
3278
|
+
wn as q,
|
|
3279
|
+
Mo as r,
|
|
3280
|
+
vo as s,
|
|
3281
|
+
nt as t,
|
|
3282
|
+
Tt as u,
|
|
3283
|
+
ar as v,
|
|
3284
|
+
In as w,
|
|
3285
|
+
so as x,
|
|
3286
|
+
tt as y,
|
|
3287
|
+
So as z
|
|
3288
|
+
};
|