react-semaphor 0.1.310 → 0.1.313
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/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +4 -4
- package/dist/chunks/{braces-B_1DhXjs.js → braces-NfG5hX2c.js} +1 -1
- package/dist/chunks/{braces-BataYVhi.js → braces-raPCNcS4.js} +1 -1
- package/dist/chunks/{chevrons-up-down-CfMX77Ug.js → chevrons-up-down-BYzO4q5w.js} +1 -1
- package/dist/chunks/{chevrons-up-down-2PuJgXa0.js → chevrons-up-down-DiWloubI.js} +1 -1
- package/dist/chunks/dashboard-controls-DMsmUQkB.js +2043 -0
- package/dist/chunks/dashboard-controls-wPVXTTiH.js +57 -0
- package/dist/chunks/dashboard-filter-controls-launcher-CqXgWEa1.js +1540 -0
- package/dist/chunks/dashboard-filter-controls-launcher-DBmNn4EY.js +11 -0
- package/dist/chunks/{dashboard-json-A9m16zgO.js → dashboard-json-CHoCrAp0.js} +2 -2
- package/dist/chunks/{dashboard-json-CUYxXIbj.js → dashboard-json-DMFZLkws.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-BFldiulJ.js → dashboard-summary-settings-dialog-CZkn4rtm.js} +3 -3
- package/dist/chunks/{dashboard-summary-settings-dialog-Dl80Vf3Y.js → dashboard-summary-settings-dialog-DoxcpXjk.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-C013lDvS.js → edit-dashboard-visual-B0Ae_O25.js} +7914 -7747
- package/dist/chunks/edit-dashboard-visual-CIP9G-Bu.js +183 -0
- package/dist/chunks/{index-scc12bkM.js → index-D7e2Eyp_.js} +37705 -36938
- package/dist/chunks/index-DjZqoaV5.js +1330 -0
- package/dist/chunks/{palette-DIqG9FgB.js → palette-7yJYVEvk.js} +1 -1
- package/dist/chunks/{palette-CuxyTPBF.js → palette-CJTdBzJB.js} +1 -1
- package/dist/chunks/{resource-management-panel-CkS-1IEw.js → resource-management-panel-B1mhnY97.js} +1 -1
- package/dist/chunks/{resource-management-panel-xJtqTzS8.js → resource-management-panel-CSkNW3es.js} +3 -3
- package/dist/chunks/{save-CPHrveZg.js → save-B8x5Vi0W.js} +1 -1
- package/dist/chunks/{save-CP9_rxYk.js → save-DDX_vrED.js} +1 -1
- package/dist/chunks/{switch-DXHYEa_J.js → switch-DEPWsRhf.js} +3343 -3251
- package/dist/chunks/switch-DPaKnsb8.js +168 -0
- package/dist/chunks/use-create-flow-overlay-state-7LiC_vaL.js +16 -0
- package/dist/chunks/{use-create-flow-overlay-state-C77yBFiq.js → use-create-flow-overlay-state-BHQjJwik.js} +511 -483
- package/dist/chunks/{use-visual-utils-Cm2IkP1c.js → use-visual-utils-Bz7kjSrk.js} +1 -1
- package/dist/chunks/{use-visual-utils-BqljNzWn.js → use-visual-utils-Dw-uLgop.js} +2 -2
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +76 -74
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/dashboard.d.ts +6 -3
- package/dist/types/main.d.ts +88 -25
- package/dist/types/shared.d.ts +6 -3
- package/dist/types/surfboard.d.ts +6 -3
- package/dist/types/types.d.ts +6 -3
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-CZH2CHE6.js +0 -57
- package/dist/chunks/dashboard-controls-DKNSTyu3.js +0 -2274
- package/dist/chunks/dashboard-filter-controls-button-C5FGXiyJ.js +0 -1116
- package/dist/chunks/dashboard-filter-controls-button-CRYFNfgr.js +0 -11
- package/dist/chunks/edit-dashboard-visual-Bt6wP1pc.js +0 -183
- package/dist/chunks/index-C_mYCH5V.js +0 -1330
- package/dist/chunks/switch-BFPV36rd.js +0 -168
- package/dist/chunks/use-create-flow-overlay-state-nhcTzyJQ.js +0 -16
package/dist/surfboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../chunks/index-DjZqoaV5.js"),e=require("../chunks/common-types-C73-Ud1-.js"),r=require("../chunks/dashboard-summary-settings-dialog-DoxcpXjk.js");exports.Surfboard=a.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;exports.CalendarPreferencesDialog=r.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=r.DashboardSummarySettingsDialog;
|
package/dist/surfboard/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as o } from "../chunks/index-
|
|
1
|
+
import { a as o } from "../chunks/index-D7e2Eyp_.js";
|
|
2
2
|
import { C as s, E as C } from "../chunks/common-types-4bjoIgvm.js";
|
|
3
|
-
import { C as E, D as f } from "../chunks/dashboard-summary-settings-dialog-
|
|
3
|
+
import { C as E, D as f } from "../chunks/dashboard-summary-settings-dialog-CZkn4rtm.js";
|
|
4
4
|
export {
|
|
5
5
|
s as CONTROL_CARD_DEFAULT_VALUE,
|
|
6
6
|
E as CalendarPreferencesDialog,
|
|
@@ -241,7 +241,6 @@ declare interface CardConfig {
|
|
|
241
241
|
showOnCard?: boolean;
|
|
242
242
|
includeInDashboardSummary?: boolean;
|
|
243
243
|
breakdownDimensions?: GroupByField[];
|
|
244
|
-
anomalyEnabled?: boolean;
|
|
245
244
|
};
|
|
246
245
|
rowAggregates?: Array<{
|
|
247
246
|
label?: string;
|
|
@@ -351,7 +350,7 @@ declare interface ColumnSettings {
|
|
|
351
350
|
minWidth?: number;
|
|
352
351
|
maxWidth?: number;
|
|
353
352
|
textOverflow?: 'ellipsis' | 'wrap' | 'clip';
|
|
354
|
-
textWrap:
|
|
353
|
+
textWrap: ColumnTextWrap;
|
|
355
354
|
/** Deprecated/inert. Totals are controlled by tablePrefs.tableStyle.totals. */
|
|
356
355
|
totalsBehavior?: TotalsBehavior;
|
|
357
356
|
totalsLabel?: string;
|
|
@@ -390,6 +389,8 @@ declare interface ColumnSettings {
|
|
|
390
389
|
|
|
391
390
|
declare type ColumnSettingsMap = Record<string, ColumnSettings>;
|
|
392
391
|
|
|
392
|
+
declare type ColumnTextWrap = 'default' | 'truncate' | 'wrap' | 'nowrap' | 'preserve';
|
|
393
|
+
|
|
393
394
|
declare type ColumnType = 'string' | 'number' | 'date';
|
|
394
395
|
|
|
395
396
|
declare type ComparisonOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
@@ -1282,7 +1283,7 @@ declare interface Field {
|
|
|
1282
1283
|
fieldScope?: FieldScope;
|
|
1283
1284
|
}
|
|
1284
1285
|
|
|
1285
|
-
declare type FieldScope = 'card' | 'dashboard' | 'domain';
|
|
1286
|
+
declare type FieldScope = 'card' | 'sheet' | 'dashboard' | 'domain';
|
|
1286
1287
|
|
|
1287
1288
|
declare type FileAttachment = {
|
|
1288
1289
|
id: string;
|
|
@@ -2060,6 +2061,7 @@ declare type TableStylePreferences = {
|
|
|
2060
2061
|
headerStyle?: TableHeaderStyle;
|
|
2061
2062
|
headerBackgroundColor?: string;
|
|
2062
2063
|
headerTextColor?: string;
|
|
2064
|
+
headerWrapText?: boolean;
|
|
2063
2065
|
stripedRows?: boolean;
|
|
2064
2066
|
gridLines?: TableGridLines;
|
|
2065
2067
|
wrapText?: boolean;
|
|
@@ -2473,6 +2475,7 @@ export declare type TDashboard = {
|
|
|
2473
2475
|
};
|
|
2474
2476
|
description?: string;
|
|
2475
2477
|
sheets?: TSheet[];
|
|
2478
|
+
calculatedFields?: Field[];
|
|
2476
2479
|
style?: TStyle;
|
|
2477
2480
|
filters?: TFilter[];
|
|
2478
2481
|
customCards?: CustomCard[];
|
package/dist/types/main.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ declare type Actions_2 = {
|
|
|
139
139
|
semanticExecutionPayload?: SemanticExecutionPayload;
|
|
140
140
|
}) => void;
|
|
141
141
|
updateSheetCalculatedFields: (sheetId: string, calculatedFields: Field[]) => void;
|
|
142
|
+
updateDashboardCalculatedFields: (calculatedFields: Field[]) => void;
|
|
142
143
|
setVisualEditPendingFrameRewrites: (sheetId: string, frames: TFrame[]) => void;
|
|
143
144
|
setVisualEditPendingFilterRewrites: (sheetId: string, filters: TFilter[]) => void;
|
|
144
145
|
clearVisualEditPendingFrameRewrites: (sheetId?: string) => void;
|
|
@@ -981,7 +982,6 @@ export declare interface CardConfig {
|
|
|
981
982
|
showOnCard?: boolean;
|
|
982
983
|
includeInDashboardSummary?: boolean;
|
|
983
984
|
breakdownDimensions?: GroupByField[];
|
|
984
|
-
anomalyEnabled?: boolean;
|
|
985
985
|
};
|
|
986
986
|
rowAggregates?: Array<{
|
|
987
987
|
label?: string;
|
|
@@ -1176,7 +1176,7 @@ declare interface ColumnSettings {
|
|
|
1176
1176
|
minWidth?: number;
|
|
1177
1177
|
maxWidth?: number;
|
|
1178
1178
|
textOverflow?: 'ellipsis' | 'wrap' | 'clip';
|
|
1179
|
-
textWrap:
|
|
1179
|
+
textWrap: ColumnTextWrap;
|
|
1180
1180
|
/** Deprecated/inert. Totals are controlled by tablePrefs.tableStyle.totals. */
|
|
1181
1181
|
totalsBehavior?: TotalsBehavior;
|
|
1182
1182
|
totalsLabel?: string;
|
|
@@ -1215,6 +1215,8 @@ declare interface ColumnSettings {
|
|
|
1215
1215
|
|
|
1216
1216
|
declare type ColumnSettingsMap = Record<string, ColumnSettings>;
|
|
1217
1217
|
|
|
1218
|
+
declare type ColumnTextWrap = 'default' | 'truncate' | 'wrap' | 'nowrap' | 'preserve';
|
|
1219
|
+
|
|
1218
1220
|
export declare type ColumnType = 'string' | 'number' | 'date';
|
|
1219
1221
|
|
|
1220
1222
|
export declare function Combobox({ name, items, value, onChange, isLoading, isError, refetch, className, icon, showNone, }: {
|
|
@@ -1567,19 +1569,65 @@ declare interface DashboardExportDialogProps {
|
|
|
1567
1569
|
onOpenChange: (open: boolean) => void;
|
|
1568
1570
|
}
|
|
1569
1571
|
|
|
1570
|
-
export declare function DashboardFilterControlsButton({ showFilters,
|
|
1572
|
+
export declare function DashboardFilterControlsButton({ showFilters, onShowFiltersChange, pickerContent, settingsContent, size, className, primaryButtonClassName, secondaryButtonClassName, pickerContentClassName, settingsContentClassName, }: DashboardFilterControlsButtonProps): JSX.Element;
|
|
1571
1573
|
|
|
1574
|
+
/**
|
|
1575
|
+
* DashboardFilterControlsButton — split-button shell for the toolbar.
|
|
1576
|
+
*
|
|
1577
|
+
* Two halves, each a Popover trigger:
|
|
1578
|
+
*
|
|
1579
|
+
* - Primary half: opens the *picker* popover (whose content is passed
|
|
1580
|
+
* in via `pickerContent`). Open state is controlled — the launcher
|
|
1581
|
+
* wires it to the `showFilters` store field so existing close
|
|
1582
|
+
* handlers (e.g. semaphor-app's dashboard-controls cleanup paths)
|
|
1583
|
+
* continue to work without change.
|
|
1584
|
+
*
|
|
1585
|
+
* - Chevron half: opens the *actions / settings* popover (passed in
|
|
1586
|
+
* via `settingsContent`). Open state is local; the chevron has no
|
|
1587
|
+
* external consumers that need to drive it.
|
|
1588
|
+
*
|
|
1589
|
+
* Floating popovers replace the legacy 320px FilterAside that mounted as
|
|
1590
|
+
* a flex sibling and shifted the dashboard. Width / height live on the
|
|
1591
|
+
* popover content components — this shell only owns the button chrome.
|
|
1592
|
+
*/
|
|
1572
1593
|
declare type DashboardFilterControlsButtonProps = {
|
|
1573
1594
|
showFilters: boolean;
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1595
|
+
onShowFiltersChange: (show: boolean) => void;
|
|
1596
|
+
pickerContent: ReactNode;
|
|
1597
|
+
settingsContent: (closeSettings: () => void) => ReactNode;
|
|
1598
|
+
size?: 'default' | 'toolbar';
|
|
1599
|
+
className?: string;
|
|
1600
|
+
primaryButtonClassName?: string;
|
|
1601
|
+
secondaryButtonClassName?: string;
|
|
1602
|
+
pickerContentClassName?: string;
|
|
1603
|
+
settingsContentClassName?: string;
|
|
1604
|
+
};
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* DashboardFilterControlsLauncher — composition root for the toolbar
|
|
1608
|
+
* Filter control. Decides which surfaces to show based on whether the
|
|
1609
|
+
* selected sheet is a document sheet (different inspector path) or a
|
|
1610
|
+
* standard dashboard sheet (popover picker + chevron settings).
|
|
1611
|
+
*
|
|
1612
|
+
* Behavior preserved from the legacy aside-based version:
|
|
1613
|
+
* - Document sheets route to the document inspector instead of the
|
|
1614
|
+
* filter picker.
|
|
1615
|
+
* - Opening the filter picker collapses the AI assistant rail.
|
|
1616
|
+
* - `showFilters` in the dashboard store is the source of truth for
|
|
1617
|
+
* whether the picker popover is open. External code that calls
|
|
1618
|
+
* `setShowFilters(false)` (e.g. semaphor-app's close / save / discard
|
|
1619
|
+
* handlers) will close the popover the same way it used to close the
|
|
1620
|
+
* aside.
|
|
1621
|
+
*/
|
|
1622
|
+
export declare function DashboardFilterControlsLauncher({ size, className, primaryButtonClassName, secondaryButtonClassName, pickerContentClassName, settingsContentClassName, }: DashboardFilterControlsLauncherProps): JSX.Element;
|
|
1623
|
+
|
|
1624
|
+
declare type DashboardFilterControlsLauncherProps = {
|
|
1578
1625
|
size?: 'default' | 'toolbar';
|
|
1579
1626
|
className?: string;
|
|
1580
1627
|
primaryButtonClassName?: string;
|
|
1581
1628
|
secondaryButtonClassName?: string;
|
|
1582
|
-
|
|
1629
|
+
pickerContentClassName?: string;
|
|
1630
|
+
settingsContentClassName?: string;
|
|
1583
1631
|
};
|
|
1584
1632
|
|
|
1585
1633
|
export declare type DashboardInput = FilterDashboardInput | ControlDashboardInput;
|
|
@@ -1836,6 +1884,12 @@ export declare type DashboardStore = {
|
|
|
1836
1884
|
* These stay draft-only until the editor Save path applies the current frame.
|
|
1837
1885
|
*/
|
|
1838
1886
|
visualEditPendingFilterRewrites: Record<string, TFilter[]>;
|
|
1887
|
+
/**
|
|
1888
|
+
* Pending dashboard-scoped calculated-field rewrites produced while visual
|
|
1889
|
+
* editing. These stay draft-only until the editor Save path applies the
|
|
1890
|
+
* current frame.
|
|
1891
|
+
*/
|
|
1892
|
+
visualEditPendingDashboardCalculatedFields?: Field[];
|
|
1839
1893
|
isDashboardEditing: boolean;
|
|
1840
1894
|
isVisualEditing: boolean;
|
|
1841
1895
|
showContext: boolean;
|
|
@@ -2056,6 +2110,14 @@ export declare type DocumentControlInputDefinition = DocumentInputBase & {
|
|
|
2056
2110
|
exports?: DocumentInputExportKey[];
|
|
2057
2111
|
};
|
|
2058
2112
|
|
|
2113
|
+
export declare function DocumentControlsSettings({ open, onOpenChange, initialMode, }: DocumentControlsSettingsProps): JSX.Element | null;
|
|
2114
|
+
|
|
2115
|
+
declare type DocumentControlsSettingsProps = {
|
|
2116
|
+
open: boolean;
|
|
2117
|
+
onOpenChange: (open: boolean) => void;
|
|
2118
|
+
initialMode?: 'manage' | 'create';
|
|
2119
|
+
};
|
|
2120
|
+
|
|
2059
2121
|
export declare type DocumentDefinition = {
|
|
2060
2122
|
version: 1;
|
|
2061
2123
|
page: DocumentPageSetup;
|
|
@@ -2885,7 +2947,7 @@ export declare interface Field {
|
|
|
2885
2947
|
fieldScope?: FieldScope;
|
|
2886
2948
|
}
|
|
2887
2949
|
|
|
2888
|
-
export declare type FieldScope = 'card' | 'dashboard' | 'domain';
|
|
2950
|
+
export declare type FieldScope = 'card' | 'sheet' | 'dashboard' | 'domain';
|
|
2889
2951
|
|
|
2890
2952
|
declare type FileAttachment = {
|
|
2891
2953
|
id: string;
|
|
@@ -4142,15 +4204,6 @@ declare type SummaryAction = {
|
|
|
4142
4204
|
|
|
4143
4205
|
declare type SummaryActionType = 'apply_filter' | 'change_comparison' | 'open_schedule' | 'refresh';
|
|
4144
4206
|
|
|
4145
|
-
declare type SummaryAnomaly = {
|
|
4146
|
-
metricId: string;
|
|
4147
|
-
severity: 'low' | 'medium' | 'high';
|
|
4148
|
-
reason: 'z_score_spike' | 'trend_break' | 'threshold_breach' | 'insufficient_baseline';
|
|
4149
|
-
score: number;
|
|
4150
|
-
confidence: number;
|
|
4151
|
-
message: string;
|
|
4152
|
-
};
|
|
4153
|
-
|
|
4154
4207
|
export declare function SummaryCard(): JSX.Element | null;
|
|
4155
4208
|
|
|
4156
4209
|
declare type SummaryCardSummary = {
|
|
@@ -4159,17 +4212,26 @@ declare type SummaryCardSummary = {
|
|
|
4159
4212
|
summary: Omit<SummaryResponse, 'cardSummaries'>;
|
|
4160
4213
|
};
|
|
4161
4214
|
|
|
4215
|
+
declare type SummaryDirection = 'up' | 'down' | 'flat';
|
|
4216
|
+
|
|
4162
4217
|
declare type SummaryDriver = {
|
|
4218
|
+
kind: SummaryDriverKind;
|
|
4163
4219
|
metricId: string;
|
|
4164
4220
|
dimension: string;
|
|
4165
4221
|
key: string;
|
|
4166
|
-
direction:
|
|
4167
|
-
|
|
4222
|
+
direction: SummaryDirection;
|
|
4223
|
+
current: number;
|
|
4224
|
+
comparison: number | null;
|
|
4225
|
+
delta: number | null;
|
|
4168
4226
|
contributionPct: number;
|
|
4169
|
-
basis:
|
|
4227
|
+
basis: SummaryDriverBasis;
|
|
4170
4228
|
action: SummaryAction;
|
|
4171
4229
|
};
|
|
4172
4230
|
|
|
4231
|
+
declare type SummaryDriverBasis = 'gross_decline' | 'gross_growth' | 'net_change' | 'current_value';
|
|
4232
|
+
|
|
4233
|
+
declare type SummaryDriverKind = 'period_delta_driver' | 'value_contributor';
|
|
4234
|
+
|
|
4173
4235
|
export declare type SummaryResponse = {
|
|
4174
4236
|
narrative: string;
|
|
4175
4237
|
generatedAt: string;
|
|
@@ -4180,14 +4242,13 @@ export declare type SummaryResponse = {
|
|
|
4180
4242
|
comparison: number | null;
|
|
4181
4243
|
delta: number | null;
|
|
4182
4244
|
deltaPct: number | null;
|
|
4183
|
-
direction:
|
|
4245
|
+
direction: SummaryDirection;
|
|
4184
4246
|
}>;
|
|
4185
4247
|
drivers: SummaryDriver[];
|
|
4186
|
-
anomalies: SummaryAnomaly[];
|
|
4187
4248
|
suggestedActions: SummaryAction[];
|
|
4188
4249
|
cardSummaries?: SummaryCardSummary[];
|
|
4189
4250
|
metadata: {
|
|
4190
|
-
contractVersion: '1.
|
|
4251
|
+
contractVersion: '1.1';
|
|
4191
4252
|
cacheHit: boolean;
|
|
4192
4253
|
generationMs: number;
|
|
4193
4254
|
partial: boolean;
|
|
@@ -4195,7 +4256,7 @@ export declare type SummaryResponse = {
|
|
|
4195
4256
|
};
|
|
4196
4257
|
};
|
|
4197
4258
|
|
|
4198
|
-
declare type SummaryWarningCode = 'PARTIAL_TIMEOUT' | 'LLM_TIMEOUT_FALLBACK' | '
|
|
4259
|
+
declare type SummaryWarningCode = 'PARTIAL_TIMEOUT' | 'LLM_TIMEOUT_FALLBACK' | 'DRIVER_DATA_INSUFFICIENT' | 'UNSUPPORTED_CARD_EXCLUDED' | 'CARD_QUERY_FAILED';
|
|
4199
4260
|
|
|
4200
4261
|
export declare function Surfboard({ showControls, showFooter, ...rest }: DashboardPlusProps): JSX.Element;
|
|
4201
4262
|
|
|
@@ -4327,6 +4388,7 @@ declare type TableStylePreferences = {
|
|
|
4327
4388
|
headerStyle?: TableHeaderStyle;
|
|
4328
4389
|
headerBackgroundColor?: string;
|
|
4329
4390
|
headerTextColor?: string;
|
|
4391
|
+
headerWrapText?: boolean;
|
|
4330
4392
|
stripedRows?: boolean;
|
|
4331
4393
|
gridLines?: TableGridLines;
|
|
4332
4394
|
wrapText?: boolean;
|
|
@@ -4752,6 +4814,7 @@ export declare type TDashboard = {
|
|
|
4752
4814
|
};
|
|
4753
4815
|
description?: string;
|
|
4754
4816
|
sheets?: TSheet[];
|
|
4817
|
+
calculatedFields?: Field[];
|
|
4755
4818
|
style?: TStyle;
|
|
4756
4819
|
filters?: TFilter[];
|
|
4757
4820
|
customCards?: CustomCard[];
|
package/dist/types/shared.d.ts
CHANGED
|
@@ -156,7 +156,6 @@ declare interface CardConfig {
|
|
|
156
156
|
showOnCard?: boolean;
|
|
157
157
|
includeInDashboardSummary?: boolean;
|
|
158
158
|
breakdownDimensions?: GroupByField[];
|
|
159
|
-
anomalyEnabled?: boolean;
|
|
160
159
|
};
|
|
161
160
|
rowAggregates?: Array<{
|
|
162
161
|
label?: string;
|
|
@@ -258,7 +257,7 @@ declare interface ColumnSettings {
|
|
|
258
257
|
minWidth?: number;
|
|
259
258
|
maxWidth?: number;
|
|
260
259
|
textOverflow?: 'ellipsis' | 'wrap' | 'clip';
|
|
261
|
-
textWrap:
|
|
260
|
+
textWrap: ColumnTextWrap;
|
|
262
261
|
/** Deprecated/inert. Totals are controlled by tablePrefs.tableStyle.totals. */
|
|
263
262
|
totalsBehavior?: TotalsBehavior;
|
|
264
263
|
totalsLabel?: string;
|
|
@@ -297,6 +296,8 @@ declare interface ColumnSettings {
|
|
|
297
296
|
|
|
298
297
|
declare type ColumnSettingsMap = Record<string, ColumnSettings>;
|
|
299
298
|
|
|
299
|
+
declare type ColumnTextWrap = 'default' | 'truncate' | 'wrap' | 'nowrap' | 'preserve';
|
|
300
|
+
|
|
300
301
|
declare type ColumnType = 'string' | 'number' | 'date';
|
|
301
302
|
|
|
302
303
|
declare type ComparisonOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
@@ -1042,7 +1043,7 @@ declare interface Field {
|
|
|
1042
1043
|
fieldScope?: FieldScope;
|
|
1043
1044
|
}
|
|
1044
1045
|
|
|
1045
|
-
declare type FieldScope = 'card' | 'dashboard' | 'domain';
|
|
1046
|
+
declare type FieldScope = 'card' | 'sheet' | 'dashboard' | 'domain';
|
|
1046
1047
|
|
|
1047
1048
|
declare type FileAttachment = {
|
|
1048
1049
|
id: string;
|
|
@@ -1664,6 +1665,7 @@ declare type TableStylePreferences = {
|
|
|
1664
1665
|
headerStyle?: TableHeaderStyle;
|
|
1665
1666
|
headerBackgroundColor?: string;
|
|
1666
1667
|
headerTextColor?: string;
|
|
1668
|
+
headerWrapText?: boolean;
|
|
1667
1669
|
stripedRows?: boolean;
|
|
1668
1670
|
gridLines?: TableGridLines;
|
|
1669
1671
|
wrapText?: boolean;
|
|
@@ -2070,6 +2072,7 @@ declare type TDashboard = {
|
|
|
2070
2072
|
};
|
|
2071
2073
|
description?: string;
|
|
2072
2074
|
sheets?: TSheet[];
|
|
2075
|
+
calculatedFields?: Field[];
|
|
2073
2076
|
style?: TStyle;
|
|
2074
2077
|
filters?: TFilter[];
|
|
2075
2078
|
customCards?: CustomCard[];
|
|
@@ -248,7 +248,6 @@ declare interface CardConfig {
|
|
|
248
248
|
showOnCard?: boolean;
|
|
249
249
|
includeInDashboardSummary?: boolean;
|
|
250
250
|
breakdownDimensions?: GroupByField[];
|
|
251
|
-
anomalyEnabled?: boolean;
|
|
252
251
|
};
|
|
253
252
|
rowAggregates?: Array<{
|
|
254
253
|
label?: string;
|
|
@@ -358,7 +357,7 @@ declare interface ColumnSettings {
|
|
|
358
357
|
minWidth?: number;
|
|
359
358
|
maxWidth?: number;
|
|
360
359
|
textOverflow?: 'ellipsis' | 'wrap' | 'clip';
|
|
361
|
-
textWrap:
|
|
360
|
+
textWrap: ColumnTextWrap;
|
|
362
361
|
/** Deprecated/inert. Totals are controlled by tablePrefs.tableStyle.totals. */
|
|
363
362
|
totalsBehavior?: TotalsBehavior;
|
|
364
363
|
totalsLabel?: string;
|
|
@@ -397,6 +396,8 @@ declare interface ColumnSettings {
|
|
|
397
396
|
|
|
398
397
|
declare type ColumnSettingsMap = Record<string, ColumnSettings>;
|
|
399
398
|
|
|
399
|
+
declare type ColumnTextWrap = 'default' | 'truncate' | 'wrap' | 'nowrap' | 'preserve';
|
|
400
|
+
|
|
400
401
|
declare type ColumnType = 'string' | 'number' | 'date';
|
|
401
402
|
|
|
402
403
|
declare type ComparisonOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
@@ -1302,7 +1303,7 @@ declare interface Field {
|
|
|
1302
1303
|
fieldScope?: FieldScope;
|
|
1303
1304
|
}
|
|
1304
1305
|
|
|
1305
|
-
declare type FieldScope = 'card' | 'dashboard' | 'domain';
|
|
1306
|
+
declare type FieldScope = 'card' | 'sheet' | 'dashboard' | 'domain';
|
|
1306
1307
|
|
|
1307
1308
|
declare type FileAttachment = {
|
|
1308
1309
|
id: string;
|
|
@@ -2082,6 +2083,7 @@ declare type TableStylePreferences = {
|
|
|
2082
2083
|
headerStyle?: TableHeaderStyle;
|
|
2083
2084
|
headerBackgroundColor?: string;
|
|
2084
2085
|
headerTextColor?: string;
|
|
2086
|
+
headerWrapText?: boolean;
|
|
2085
2087
|
stripedRows?: boolean;
|
|
2086
2088
|
gridLines?: TableGridLines;
|
|
2087
2089
|
wrapText?: boolean;
|
|
@@ -2495,6 +2497,7 @@ export declare type TDashboard = {
|
|
|
2495
2497
|
};
|
|
2496
2498
|
description?: string;
|
|
2497
2499
|
sheets?: TSheet[];
|
|
2500
|
+
calculatedFields?: Field[];
|
|
2498
2501
|
style?: TStyle;
|
|
2499
2502
|
filters?: TFilter[];
|
|
2500
2503
|
customCards?: CustomCard[];
|
package/dist/types/types.d.ts
CHANGED
|
@@ -497,7 +497,6 @@ export declare interface CardConfig {
|
|
|
497
497
|
showOnCard?: boolean;
|
|
498
498
|
includeInDashboardSummary?: boolean;
|
|
499
499
|
breakdownDimensions?: GroupByField[];
|
|
500
|
-
anomalyEnabled?: boolean;
|
|
501
500
|
};
|
|
502
501
|
rowAggregates?: Array<{
|
|
503
502
|
label?: string;
|
|
@@ -623,7 +622,7 @@ declare interface ColumnSettings {
|
|
|
623
622
|
minWidth?: number;
|
|
624
623
|
maxWidth?: number;
|
|
625
624
|
textOverflow?: 'ellipsis' | 'wrap' | 'clip';
|
|
626
|
-
textWrap:
|
|
625
|
+
textWrap: ColumnTextWrap;
|
|
627
626
|
/** Deprecated/inert. Totals are controlled by tablePrefs.tableStyle.totals. */
|
|
628
627
|
totalsBehavior?: TotalsBehavior;
|
|
629
628
|
totalsLabel?: string;
|
|
@@ -662,6 +661,8 @@ declare interface ColumnSettings {
|
|
|
662
661
|
|
|
663
662
|
declare type ColumnSettingsMap = Record<string, ColumnSettings>;
|
|
664
663
|
|
|
664
|
+
declare type ColumnTextWrap = 'default' | 'truncate' | 'wrap' | 'nowrap' | 'preserve';
|
|
665
|
+
|
|
665
666
|
declare type ColumnType = 'string' | 'number' | 'date';
|
|
666
667
|
|
|
667
668
|
declare type ComparisonOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
@@ -1658,7 +1659,7 @@ export declare interface Field {
|
|
|
1658
1659
|
fieldScope?: FieldScope;
|
|
1659
1660
|
}
|
|
1660
1661
|
|
|
1661
|
-
export declare type FieldScope = 'card' | 'dashboard' | 'domain';
|
|
1662
|
+
export declare type FieldScope = 'card' | 'sheet' | 'dashboard' | 'domain';
|
|
1662
1663
|
|
|
1663
1664
|
declare type FileAttachment = {
|
|
1664
1665
|
id: string;
|
|
@@ -2641,6 +2642,7 @@ declare type TableStylePreferences = {
|
|
|
2641
2642
|
headerStyle?: TableHeaderStyle;
|
|
2642
2643
|
headerBackgroundColor?: string;
|
|
2643
2644
|
headerTextColor?: string;
|
|
2645
|
+
headerWrapText?: boolean;
|
|
2644
2646
|
stripedRows?: boolean;
|
|
2645
2647
|
gridLines?: TableGridLines;
|
|
2646
2648
|
wrapText?: boolean;
|
|
@@ -3064,6 +3066,7 @@ export declare type TDashboard = {
|
|
|
3064
3066
|
};
|
|
3065
3067
|
description?: string;
|
|
3066
3068
|
sheets?: TSheet[];
|
|
3069
|
+
calculatedFields?: Field[];
|
|
3067
3070
|
style?: TStyle;
|
|
3068
3071
|
filters?: TFilter[];
|
|
3069
3072
|
customCards?: CustomCard[];
|
package/package.json
CHANGED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./switch-BFPV36rd.js"),s=require("./index-C_mYCH5V.js"),b=require("react");require("./index-DRlMUglg.js");require("react-dom");const G=require("./dashboard-filter-controls-button-CRYFNfgr.js"),it=require("./index-D7KJindZ.js"),gs=require("./dashboard-summary-settings-dialog-Dl80Vf3Y.js"),lt=require("./use-debounced-dirty-check-XHSwAefL.js"),Fe=require("./normalize-dashboard-for-dirty-check-BXRUMVb2.js"),bs=require("./use-create-flow-overlay-state-nhcTzyJQ.js"),vs=require("./save-CPHrveZg.js"),ct=require("./palette-CuxyTPBF.js"),dt=require("./braces-B_1DhXjs.js");function ut(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(a,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return a.default=t,Object.freeze(a)}const I=ut(b);/**
|
|
2
|
-
* @license lucide-react v0.453.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const mt=o.createLucideIcon("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/**
|
|
7
|
-
* @license lucide-react v0.453.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const ht=o.createLucideIcon("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
12
|
-
* @license lucide-react v0.453.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const pt=o.createLucideIcon("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
17
|
-
* @license lucide-react v0.453.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const ft=o.createLucideIcon("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
22
|
-
* @license lucide-react v0.453.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const xt=o.createLucideIcon("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
|
|
27
|
-
* @license lucide-react v0.453.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const gt=o.createLucideIcon("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
32
|
-
* @license lucide-react v0.453.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const bt=o.createLucideIcon("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
|
|
37
|
-
* @license lucide-react v0.453.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const Re=o.createLucideIcon("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);var qe={exports:{}},_e={};/**
|
|
42
|
-
* @license React
|
|
43
|
-
* use-sync-external-store-shim.production.js
|
|
44
|
-
*
|
|
45
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
46
|
-
*
|
|
47
|
-
* This source code is licensed under the MIT license found in the
|
|
48
|
-
* LICENSE file in the root directory of this source tree.
|
|
49
|
-
*/var ys;function vt(){if(ys)return _e;ys=1;var t=b;function a(x,p){return x===p&&(x!==0||1/x===1/p)||x!==x&&p!==p}var n=typeof Object.is=="function"?Object.is:a,r=t.useState,c=t.useEffect,m=t.useLayoutEffect,d=t.useDebugValue;function f(x,p){var u=p(),i=r({inst:{value:u,getSnapshot:p}}),y=i[0].inst,w=i[1];return m(function(){y.value=u,y.getSnapshot=p,g(y)&&w({inst:y})},[x,u,p]),c(function(){return g(y)&&w({inst:y}),x(function(){g(y)&&w({inst:y})})},[x]),d(u),u}function g(x){var p=x.getSnapshot;x=x.value;try{var u=p();return!n(x,u)}catch{return!0}}function v(x,p){return p()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?v:f;return _e.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,_e}var Ue={};/**
|
|
50
|
-
* @license React
|
|
51
|
-
* use-sync-external-store-shim.development.js
|
|
52
|
-
*
|
|
53
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the MIT license found in the
|
|
56
|
-
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/var Ss;function yt(){return Ss||(Ss=1,process.env.NODE_ENV!=="production"&&function(){function t(u,i){return u===i&&(u!==0||1/u===1/i)||u!==u&&i!==i}function a(u,i){h||c.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=i();if(!x){var w=i();m(y,w)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),x=!0)}w=d({inst:{value:y,getSnapshot:i}});var D=w[0].inst,C=w[1];return g(function(){D.value=y,D.getSnapshot=i,n(D)&&C({inst:D})},[u,y,i]),f(function(){return n(D)&&C({inst:D}),u(function(){n(D)&&C({inst:D})})},[u]),v(y),y}function n(u){var i=u.getSnapshot;u=u.value;try{var y=i();return!m(u,y)}catch{return!0}}function r(u,i){return i()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var c=b,m=typeof Object.is=="function"?Object.is:t,d=c.useState,f=c.useEffect,g=c.useLayoutEffect,v=c.useDebugValue,h=!1,x=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:a;Ue.useSyncExternalStore=c.useSyncExternalStore!==void 0?c.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ue}process.env.NODE_ENV==="production"?qe.exports=vt():qe.exports=yt();var St=qe.exports;const je=["light","dark","system"];function jt(){const{theme:t,setTheme:a}=s.useTheme(),n=o.useDashboardStore(d=>d.actions.setDashboardTheme);function r(){const d=je.includes(t)?t:"system",f=je[(je.indexOf(d)+1)%je.length];a(f),n(f)}const c=t==="light"?gt:t==="dark"?ft:pt,m=t==="light"?"Theme: light (click for dark)":t==="dark"?"Theme: dark (click for system)":"Theme: system (click for light)";return e.jsx(o.Button,{type:"button",variant:"ghost",size:"xs",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground",onClick:r,"aria-label":m,title:m,children:e.jsx(c,{className:"h-3.5 w-3.5",strokeWidth:1.5})})}async function Dt(t,a,n,r,c){if(!c)return null;const m=JSON.stringify(n),d=`${t}/v1/lens`;return await o.postRequest(d,c,{name:a,template:m,filterValues:r,operation:"create"})}async function Ge(t,a,n){if(!n)return null;const{id:r,template:c,filterValues:m,isDefault:d,shared:f}=a,g=`${t}/v1/lens`;return await o.postRequest(g,n,{lensId:r,template:c,filterValues:m,isDefault:d,shared:f,operation:"update"})}async function wt(t,a,n){if(!n)return null;const r=`${t}/v1/lens`;return await o.postRequest(r,n,{operation:"delete",lensId:a})}const Ct="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function Nt({open:t,onOpenChange:a}={}){const[n,r]=b.useState(""),[c,m]=b.useState(!1),d=o.useDashboardStore(M=>M.lenses),{setLenses:f,setSelectedLensId:g}=o.useDashboardActions(),[v,h]=b.useState(!1),[x,p]=b.useState(!1),u=t!==void 0,i=u?t:x,y=M=>{u||p(M),a==null||a(M)},w=o.useDashboardStore(M=>M.dashboard),D=o.useDashboardStore(M=>M.filterValues),{authToken:C,tokenProps:N}=s.useSemaphorContext();async function E(){h(!0);const M=await Dt(N.apiServiceUrl,n,w,D,C==null?void 0:C.accessToken);M&&(f([...d||[],M]),g(M.id),y(!1)),h(!1)}return e.jsxs(s.Dialog,{open:i,onOpenChange:y,children:[u?null:e.jsx(s.DialogTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"secondary",size:"xs",children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"Lens"]})}),e.jsxs(s.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:"Create lens"}),e.jsx(s.DialogDescription,{className:"text-[13px] leading-5",children:"Lenses are private by default and are only visible to you."})]}),e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsx(o.Label,{htmlFor:"lens-name",className:Ct,children:"Name"}),e.jsx(o.Input,{id:"lens-name",size:"xs",value:n,placeholder:"Monthly review, West region, …",onChange:M=>r(M.target.value)}),c&&e.jsx("p",{className:"text-[12px] text-destructive",children:"A lens with this name already exists. Pick a different one."})]}),e.jsxs(s.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:()=>y(!1),children:"Cancel"}),e.jsx(o.Button,{size:"xs",type:"submit",onClick:E,disabled:v||!n.trim(),children:v?"Creating…":"Create"})]})]})]})}function Mt({includeLabel:t=!1}={}){const a=o.useDashboardStore(h=>h.lenses),n=o.useDashboardStore(h=>h.selectedLensId),{setLenses:r,setSelectedLensId:c}=o.useDashboardActions(),{authToken:m,tokenProps:d}=s.useSemaphorContext();async function f(h){c(h)}async function g(h){if(await wt(d.apiServiceUrl,h,m==null?void 0:m.accessToken)){const p=a==null?void 0:a.filter(u=>u.id!==h);r(p||[]),c("original")}}async function v(h){const x=a==null?void 0:a.map(i=>i.id===h.id?{...i,isDefault:!h.isDefault}:{...i,isDefault:!1});r(x||[]);const p={...h,isDefault:!h.isDefault};await Ge(d.apiServiceUrl,p,m==null?void 0:m.accessToken);const u=a==null?void 0:a.find(i=>i.isDefault);if(u&&u.id!==h.id){const i={...u,isDefault:!1};await Ge(d.apiServiceUrl,i,m==null?void 0:m.accessToken)}}return e.jsxs(e.Fragment,{children:[t?e.jsxs(e.Fragment,{children:[e.jsx(s.DropdownMenuLabel,{className:"px-3",children:"Lenses"}),e.jsx(s.DropdownMenuSeparator,{})]}):null,e.jsxs(s.DropdownMenuRadioGroup,{value:n,onValueChange:f,children:[e.jsx(s.DropdownMenuRadioItem,{value:"original",children:"Original"}),a==null?void 0:a.map(h=>e.jsxs(s.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:h.id,children:[e.jsx("p",{children:h.name}),e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(s.House,{onClick:x=>{x.preventDefault(),v(h)},className:o.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!h.isDefault,"text-green-500":h.isDefault}),strokeWidth:1.5}),e.jsx(s.Cross2Icon,{onClick:x=>{x.preventDefault(),g(h.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},h.id))]})]})}function It(){const{displayPreferences:t,shouldShowElement:a}=s.useDisplayPreferences(),{currentUser:n,userContext:r}=s.useCurrentUserInfo(),c=b.useMemo(()=>s.getRoleBasedDisplayOverrides(n),[n]),m=b.useMemo(()=>f=>c&&c[f]!==void 0&&c[f]===!1?!1:a(f),[c,a,t]),d=b.useMemo(()=>{var f,g,v,h,x;return{canEdit:((f=r==null?void 0:r.permissions)==null?void 0:f.canEdit)??s.canUserEdit(n),canUseFilters:((g=r==null?void 0:r.permissions)==null?void 0:g.canEdit)??s.canUserUseFilters(n),canManageDashboards:((v=r==null?void 0:r.permissions)==null?void 0:v.canCreateDashboard)??s.canUserManageDashboards(n),canCreateDashboards:((h=r==null?void 0:r.permissions)==null?void 0:h.canCreateDashboard)??s.canUserCreateDashboards(n),canAccessVisuals:((x=r==null?void 0:r.permissions)==null?void 0:x.canEdit)??s.canUserAccessVisuals(n)}},[n,r]);return{displayPreferences:t,shouldShowElement:m,permissions:d,currentUser:n}}const Et=async(t,a,n)=>{const r=`${t}/management/v1/groups`;return await o.postRequestRegular(r,a,n)},Lt=async(t,a,n)=>{const r=`${t}/management/v1/groups/${n}`;await o.requestJsonRegular(r,a,"DELETE")},At=async(t,a,n,r)=>{const c=`${t}/management/v1/groups/${n}/members`;return await o.postRequestRegular(c,a,r)},kt=async(t,a,n,r)=>{const c=`${t}/management/v1/groups/${n}/members`;await o.requestJsonRegular(c,a,"DELETE",r)};function Ot(){const{authToken:t,tokenProps:a}=s.useSemaphorContext(),n=s.useQueryClient();return s.useMutation({mutationFn:r=>Et(a.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:()=>{n.invalidateQueries({queryKey:["groups"]}),s.ue.success("Group created successfully")},onError:r=>{console.error("Failed to create group:",r),s.ue.error("Failed to create group",{description:o.getRequestErrorMessage(r,"Failed to create group")})}})}function Tt(){const{authToken:t,tokenProps:a}=s.useSemaphorContext(),n=s.useQueryClient();return s.useMutation({mutationFn:r=>Lt(a.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r),onSuccess:(r,c)=>{n.invalidateQueries({queryKey:["groups"]}),n.removeQueries({queryKey:["group",c]}),s.ue.success("Group deleted successfully")},onError:r=>{console.error("Failed to delete group:",r),s.ue.error("Failed to delete group",{description:o.getRequestErrorMessage(r,"Failed to delete group")})}})}function Pt(){const{authToken:t,tokenProps:a}=s.useSemaphorContext(),n=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:c})=>At(a.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,c),onSuccess:(r,c)=>{n.invalidateQueries({queryKey:["group",c.groupId]}),n.invalidateQueries({queryKey:["group-members",c.groupId]}),n.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members added successfully")},onError:r=>{console.error("Failed to add group members:",r),s.ue.error("Failed to add members",{description:o.getRequestErrorMessage(r,"Failed to add members")})}})}function Ft(){const{authToken:t,tokenProps:a}=s.useSemaphorContext(),n=s.useQueryClient();return s.useMutation({mutationFn:({groupId:r,data:c})=>kt(a.apiServiceUrl,(t==null?void 0:t.accessToken)||"",r,c),onSuccess:(r,c)=>{n.invalidateQueries({queryKey:["group",c.groupId]}),n.invalidateQueries({queryKey:["group-members",c.groupId]}),n.invalidateQueries({queryKey:["groups"]}),s.ue.success("Members removed successfully")},onError:r=>{console.error("Failed to remove group members:",r),s.ue.error("Failed to remove members",{description:o.getRequestErrorMessage(r,"Failed to remove members")})}})}const js="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _t({onSuccess:t,tenantId:a,isTenantUser:n}){const[r,c]=b.useState(""),[m,d]=b.useState(""),[f,g]=b.useState({}),v=Ot(),h=()=>{const p={};return r.trim()?r.length<3?p.name="Group name must be at least 3 characters":r.length>50&&(p.name="Group name must be less than 50 characters"):p.name="Group name is required",m&&m.length>200&&(p.description="Description must be less than 200 characters"),g(p),Object.keys(p).length===0},x=async p=>{if(p.preventDefault(),!h())return;const u={name:r.trim(),description:m.trim()||void 0,type:n?"TENANT_GROUP":"ORG_GROUP",...n&&a?{tenantId:a}:{}};try{await v.mutateAsync(u),c(""),d(""),g({}),t()}catch(i){console.error("Failed to create group:",i)}};return e.jsxs("form",{onSubmit:x,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(o.Label,{htmlFor:"group-name",className:js,children:["Group name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(o.Input,{id:"group-name",size:"xs",placeholder:"e.g., Marketing Team, Engineering Squad",value:r,onChange:p=>{c(p.target.value),f.name&&g(u=>({...u,name:""}))},className:f.name?"border-destructive":"",disabled:v.isPending}),f.name&&e.jsx("p",{className:"text-[12px] text-destructive",children:f.name})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{htmlFor:"group-description",className:js,children:"Description (optional)"}),e.jsx(s.Textarea,{id:"group-description",placeholder:"Describe the purpose of this group…",value:m,onChange:p=>{d(p.target.value),f.description&&g(u=>({...u,description:""}))},className:`text-[13px] ${f.description?"border-destructive":""}`,disabled:v.isPending,rows:3}),f.description?e.jsx("p",{className:"text-[12px] text-destructive",children:f.description}):e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[m.length,"/200"]})]}),e.jsxs("div",{className:"flex gap-2 text-[12px] text-muted-foreground",children:[e.jsx(o.Info,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),e.jsx("p",{children:"This group will be accessible to users in your workspace. You can add members after creating it."})]}),e.jsxs("div",{className:"flex justify-end gap-1.5 pt-1",children:[e.jsx(o.Button,{type:"button",variant:"outline",size:"xs",onClick:()=>{c(""),d(""),g({})},disabled:v.isPending,children:"Clear"}),e.jsx(o.Button,{type:"submit",size:"xs",disabled:v.isPending||!r.trim(),children:v.isPending?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Creating…"]}):"Create group"})]})]})}function Ut(t,a=[]){let n=[];function r(m,d){const f=I.createContext(d);f.displayName=m+"Context";const g=n.length;n=[...n,d];const v=x=>{var D;const{scope:p,children:u,...i}=x,y=((D=p==null?void 0:p[t])==null?void 0:D[g])||f,w=I.useMemo(()=>i,Object.values(i));return e.jsx(y.Provider,{value:w,children:u})};v.displayName=m+"Provider";function h(x,p){var y;const u=((y=p==null?void 0:p[t])==null?void 0:y[g])||f,i=I.useContext(u);if(i)return i;if(d!==void 0)return d;throw new Error(`\`${x}\` must be used within \`${m}\``)}return[v,h]}const c=()=>{const m=n.map(d=>I.createContext(d));return function(f){const g=(f==null?void 0:f[t])||m;return I.useMemo(()=>({[`__scope${t}`]:{...f,[t]:g}}),[f,g])}};return c.scopeName=t,[r,Rt(c,...a)]}function Rt(...t){const a=t[0];if(t.length===1)return a;const n=()=>{const r=t.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(m){const d=r.reduce((f,{useScope:g,scopeName:v})=>{const x=g(m)[`__scope${v}`];return{...f,...x}},{});return I.useMemo(()=>({[`__scope${a.scopeName}`]:d}),[d])}};return n.scopeName=a.scopeName,n}var qt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],$e=qt.reduce((t,a)=>{const n=o.createSlot(`Primitive.${a}`),r=I.forwardRef((c,m)=>{const{asChild:d,...f}=c,g=d?n:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(g,{...f,ref:m})});return r.displayName=`Primitive.${a}`,{...t,[a]:r}},{});function Gt(){return St.useSyncExternalStore($t,()=>!0,()=>!1)}function $t(){return()=>{}}var Be="Avatar",[Bt]=Ut(Be),[zt,Cs]=Bt(Be),Ns=I.forwardRef((t,a)=>{const{__scopeAvatar:n,...r}=t,[c,m]=I.useState("idle");return e.jsx(zt,{scope:n,imageLoadingStatus:c,onImageLoadingStatusChange:m,children:e.jsx($e.span,{...r,ref:a})})});Ns.displayName=Be;var Ms="AvatarImage",Is=I.forwardRef((t,a)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:c=()=>{},...m}=t,d=Cs(Ms,n),f=Vt(r,m),g=o.useCallbackRef(v=>{c(v),d.onImageLoadingStatusChange(v)});return o.useLayoutEffect2(()=>{f!=="idle"&&g(f)},[f,g]),f==="loaded"?e.jsx($e.img,{...m,ref:a,src:r}):null});Is.displayName=Ms;var Es="AvatarFallback",Ls=I.forwardRef((t,a)=>{const{__scopeAvatar:n,delayMs:r,...c}=t,m=Cs(Es,n),[d,f]=I.useState(r===void 0);return I.useEffect(()=>{if(r!==void 0){const g=window.setTimeout(()=>f(!0),r);return()=>window.clearTimeout(g)}},[r]),d&&m.imageLoadingStatus!=="loaded"?e.jsx($e.span,{...c,ref:a}):null});Ls.displayName=Es;function Ds(t,a){return t?a?(t.src!==a&&(t.src=a),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Vt(t,{referrerPolicy:a,crossOrigin:n}){const r=Gt(),c=I.useRef(null),m=r?(c.current||(c.current=new window.Image),c.current):null,[d,f]=I.useState(()=>Ds(m,t));return o.useLayoutEffect2(()=>{f(Ds(m,t))},[m,t]),o.useLayoutEffect2(()=>{const g=x=>()=>{f(x)};if(!m)return;const v=g("loaded"),h=g("error");return m.addEventListener("load",v),m.addEventListener("error",h),a&&(m.referrerPolicy=a),typeof n=="string"&&(m.crossOrigin=n),()=>{m.removeEventListener("load",v),m.removeEventListener("error",h)}},[m,n,a]),d}var As=Ns,ks=Is,Os=Ls;const ze=I.forwardRef(({className:t,...a},n)=>e.jsx(As,{ref:n,className:o.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...a}));ze.displayName=As.displayName;const Ht=I.forwardRef(({className:t,...a},n)=>e.jsx(ks,{ref:n,className:o.cn("aspect-square h-full w-full",t),...a}));Ht.displayName=ks.displayName;const Ve=I.forwardRef(({className:t,...a},n)=>e.jsx(Os,{ref:n,className:o.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...a}));Ve.displayName=Os.displayName;function Kt({open:t,onOpenChange:a,group:n,onUpdate:r}){const[c,m]=b.useState("members"),[d,f]=b.useState(""),[g,v]=b.useState([]),[h,x]=b.useState([]),{data:p,isLoading:u,refetch:i}=s.useGroupMembers(n.id),y=n.type==="TENANT_GROUP"?"tenant":"organization",{users:w,isLoading:D}=s.useUnifiedUsers({type:y,tenantId:n.tenantId||void 0,active:!0,limit:100}),C=Pt(),N=Ft(),E=(p==null?void 0:p.members)||[],M=b.useMemo(()=>new Set(E.map(S=>S.userId)),[E]),P=b.useMemo(()=>w.filter(S=>!M.has(S.id)),[w,M]),_=b.useMemo(()=>{if(!d)return P;const S=d.toLowerCase();return P.filter(L=>{var F,q;return((F=L.name)==null?void 0:F.toLowerCase().includes(S))||((q=L.email)==null?void 0:q.toLowerCase().includes(S))})},[P,d]),j=b.useMemo(()=>{if(!d)return E;const S=d.toLowerCase();return E.filter(L=>{var F,q,te,K;return((q=(F=L.user)==null?void 0:F.name)==null?void 0:q.toLowerCase().includes(S))||((K=(te=L.user)==null?void 0:te.email)==null?void 0:K.toLowerCase().includes(S))})},[E,d]),R=async()=>{if(g.length!==0)try{await C.mutateAsync({groupId:n.id,data:{userIds:g,userType:y==="tenant"?"tenant":"org"}}),v([]),m("members"),i(),r==null||r()}catch(S){console.error("Failed to add members:",S)}},B=async()=>{if(h.length!==0)try{await N.mutateAsync({groupId:n.id,data:{userIds:h}}),x([]),i(),r==null||r()}catch(S){console.error("Failed to remove members:",S)}},V=S=>{v(L=>L.includes(S)?L.filter(F=>F!==S):[...L,S])},H=S=>{x(L=>L.includes(S)?L.filter(F=>F!==S):[...L,S])};return e.jsx(e.Fragment,{children:e.jsx(s.Dialog,{open:t,onOpenChange:a,children:e.jsxs(s.DialogContent,{className:"max-w-3xl max-h-[80vh]","aria-describedby":"group-members-description",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{children:n.name}),e.jsx("div",{className:"flex items-center gap-2 mt-1",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[E.length," ",E.length===1?"member":"members"]})}),e.jsxs("p",{id:"group-members-description",className:"sr-only",children:["Add or remove members from the ",n.name," group"]})]}),e.jsxs(o.Tabs,{value:c,onValueChange:S=>{m(S),f(""),x([])},className:"mt-4",children:[e.jsxs(o.TabsList,{className:"grid w-full grid-cols-2",children:[e.jsx(o.TabsTrigger,{value:"members",children:"Current Members"}),e.jsx(o.TabsTrigger,{value:"add",children:"Add Members"})]}),e.jsxs(o.TabsContent,{value:"members",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(o.Input,{placeholder:"Search members...",value:d,onChange:S=>f(S.target.value),className:"pl-10"})]}),e.jsx(o.ScrollArea,{className:h.length>0?"h-[300px]":"h-[350px]",children:u?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(S=>e.jsx(s.Skeleton,{className:"h-16 w-full"},S))}):j.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(s.Users,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:d?"No members found":"No members yet"}),e.jsx("p",{className:"text-xs mt-1",children:d?"Try a different search":'Switch to the "Add Members" tab to add people to this group'})]}):e.jsx("div",{className:"space-y-2",children:j.map(S=>e.jsx(Qt,{member:S,selected:h.includes(S.userId),onToggle:()=>H(S.userId)},S.id))})}),h.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h.length," member",h.length!==1?"s":""," selected"]}),e.jsx(o.Button,{variant:"destructive",size:"sm",onClick:B,disabled:N.isPending,children:N.isPending?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Removing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Trash2,{className:"mr-2 h-4 w-4"}),"Remove Selected"]})})]})]}),e.jsxs(o.TabsContent,{value:"add",className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(o.Input,{placeholder:"Search users to add...",value:d,onChange:S=>f(S.target.value),className:"pl-10"})]}),e.jsx(o.ScrollArea,{className:"h-[300px]",children:D?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(S=>e.jsx(s.Skeleton,{className:"h-16 w-full"},S))}):_.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(Re,{className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{className:"text-sm font-medium",children:"No available users"}),e.jsx("p",{className:"text-xs mt-1",children:d?"Try a different search":"All eligible users are already members"})]}):e.jsx("div",{className:"space-y-2",children:_.map(S=>e.jsx(Wt,{user:S,selected:g.includes(S.id),onToggle:()=>V(S.id)},S.id))})}),g.length>0&&e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[g.length," user",g.length!==1?"s":""," selected"]}),e.jsx(o.Button,{onClick:R,disabled:C.isPending,children:C.isPending?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Adding..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Re,{className:"mr-2 h-4 w-4"}),"Add Members"]})})]})]})]})]})})})}function Qt({member:t,selected:a,onToggle:n}){var c,m,d,f;const r=((m=(c=t.user)==null?void 0:c.name)==null?void 0:m.split(" ").map(g=>g[0]).join("").toUpperCase())||"?";return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",onClick:n,children:[e.jsx(s.Checkbox,{checked:a}),e.jsx(ze,{className:"h-8 w-8",children:e.jsx(Ve,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:((d=t.user)==null?void 0:d.name)||"Unknown User"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:(f=t.user)==null?void 0:f.email})]})]})}function Wt({user:t,selected:a,onToggle:n}){var c;const r=((c=t.name)==null?void 0:c.split(" ").map(m=>m[0]).join("").toUpperCase())||"?";return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border bg-card hover:bg-muted/50 cursor-pointer",onClick:n,children:[e.jsx(s.Checkbox,{checked:a}),e.jsx(ze,{className:"h-8 w-8",children:e.jsx(Ve,{className:"text-xs",children:r})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.email})]})]})}function Jt({open:t,onOpenChange:a}){const[n,r]=b.useState("groups"),[c,m]=b.useState(""),[d,f]=b.useState(null),[g,v]=b.useState(!1),[h,x]=b.useState(null),{tokenProps:p}=s.useSemaphorContext(),{currentUser:u}=s.useCurrentUserInfo(),i=Tt(),y=(u==null?void 0:u.type)==="tenant",w=p==null?void 0:p.tenantId,{groups:D,isLoading:C,refetch:N}=s.useGroups({type:y?"TENANT_GROUP":"all",tenantId:y?w:void 0,includeMembers:!1}),E=D.filter(j=>{var R;return j.name.toLowerCase().includes(c.toLowerCase())||((R=j.description)==null?void 0:R.toLowerCase().includes(c.toLowerCase()))}),M=async()=>{if(h)try{await i.mutateAsync(h.id),x(null),N()}catch(j){console.error("Failed to delete group:",j)}},P=j=>{f(j),v(!0)},_=()=>{r("groups"),N()};return e.jsxs(e.Fragment,{children:[e.jsx(s.Dialog,{open:t,onOpenChange:a,children:e.jsxs(s.DialogContent,{className:"max-h-[80vh] max-w-3xl rounded-[6px] border-border/60 sm:rounded-[6px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:"Group management"}),e.jsx(s.DialogDescription,{className:"text-[13px] leading-5",children:"Manage groups, create new ones, and control membership."})]}),e.jsxs(o.Tabs,{value:n,onValueChange:r,className:"mt-2",children:[e.jsxs(o.TabsList,{className:"h-8 w-full justify-start gap-1 bg-transparent p-0 border-b border-border/60 rounded-none",children:[e.jsx(o.TabsTrigger,{value:"groups",className:"h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",children:"Groups"}),e.jsx(o.TabsTrigger,{value:"create",className:"h-8 rounded-none border-b-2 border-transparent bg-transparent px-3 text-[13px] data-[state=active]:border-foreground data-[state=active]:bg-transparent data-[state=active]:shadow-none",children:"Create group"})]}),e.jsx(o.TabsContent,{value:"groups",className:"mt-4",children:e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s.Search,{className:"absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(o.Input,{size:"xs",placeholder:"Search groups…",value:c,onChange:j=>m(j.target.value),className:"pl-7"})]}),e.jsx(o.ScrollArea,{className:"h-[400px]",children:C?e.jsx("div",{className:"space-y-2",children:[1,2,3].map(j=>e.jsx(s.Skeleton,{className:"h-16 w-full rounded-[6px]"},j))}):E.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx("p",{className:"text-[13px]",children:"No groups found."}),e.jsx("p",{className:"mt-1 text-[12px]",children:c?"Try a different search.":"Create your first group to get started."})]}):e.jsx("div",{className:"space-y-2 pr-2",children:E.map(j=>e.jsx(Yt,{group:j,onManageMembers:()=>P(j),onDelete:()=>x(j),currentUserId:u==null?void 0:u.id},j.id))})})]})}),e.jsx(o.TabsContent,{value:"create",className:"mt-4",children:e.jsx(_t,{onSuccess:_,tenantId:w,isTenantUser:y})})]})]})}),d&&e.jsx(Kt,{open:g,onOpenChange:v,group:d,onUpdate:()=>N()}),e.jsx(s.AlertDialog,{open:!!h,onOpenChange:()=>x(null),children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete group"}),e.jsxs(s.AlertDialogDescription,{children:['Delete "',h==null?void 0:h.name,`"? This removes all members and can't be undone.`]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:M,disabled:i.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:i.isPending?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Deleting…"]}):"Delete group"})]})]})})]})}function Yt({group:t,onManageMembers:a,onDelete:n,currentUserId:r}){const c=t.createdBy===r;return e.jsx("div",{className:"rounded-[6px] border border-border/60 bg-card px-3 py-2.5 transition-colors hover:bg-muted/30",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("h4",{className:"text-[13px] font-medium text-foreground",children:t.name}),t.description&&e.jsx("p",{className:"text-[12px] text-muted-foreground",children:t.description}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(s.Users,{className:"h-3 w-3"}),t.memberCount," ",t.memberCount===1?"member":"members"]}),e.jsxs("span",{children:["Created ",it.format(new Date(t.createdAt),"MMM d, yyyy")]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground",onClick:a,title:"Manage members","aria-label":"Manage members",children:e.jsx(Re,{className:"h-3.5 w-3.5"})}),c&&e.jsx(o.Button,{variant:"ghost",size:"xs",className:"h-7 w-7 p-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",onClick:n,title:"Delete group","aria-label":"Delete group",children:e.jsx(s.Trash2,{className:"h-3.5 w-3.5"})})]})]})})}function ee(t,a,n){var m,d;const r=(t.controls||[]).find(f=>f.id===n);if(r)return r.label;const c=(d=(m=o.findCardById(t,a))==null?void 0:m.controls)==null?void 0:d.find(f=>f.id===n);return(c==null?void 0:c.label)||n}function se(t,a){var n;return((n=o.findCardById(t,a))==null?void 0:n.title)||a}function Xt(t){const{errors:a,dashboard:n}=t;if(!n)return a;const r=new Map;for(const c of a){const m=c.match(/^Card '(.+)' binding for control '(.+)' maps to missing metric '(.+)'\.$/);if(m){const[,h,x]=m,p=`${h}:${x}:missing-metric`;r.has(p)||r.set(p,`"${se(n,h)}" has an outdated "${ee(n,h,x)}" mapping. Some choices still point to metrics that are no longer available on this card. Open the card controls and choose replacements.`);continue}const d=c.match(/^Card '(.+)' binding for control '(.+)' maps to missing group-by field '(.+)'\.$/);if(d){const[,h,x]=d,p=`${h}:${x}:missing-group-by`;r.has(p)||r.set(p,`"${se(n,h)}" has an outdated "${ee(n,h,x)}" mapping. Some choices still point to fields that are no longer available on this card. Open the card controls and choose replacements.`);continue}const f=c.match(/^Card '(.+)' binding for control '(.+)' maps to an invalid metric target\.$/);if(f){const[,h,x]=f,p=`${h}:${x}:invalid-metric`;r.has(p)||r.set(p,`"${se(n,h)}" has an invalid "${ee(n,h,x)}" metric mapping. Open the card controls and choose a valid metric for each option.`);continue}const g=c.match(/^Card '(.+)' binding for control '(.+)' maps to an invalid group-by target\.$/);if(g){const[,h,x]=g,p=`${h}:${x}:invalid-group-by`;r.has(p)||r.set(p,`"${se(n,h)}" has an invalid "${ee(n,h,x)}" field mapping. Open the card controls and choose a valid field for each option.`);continue}const v=c.match(/^Card '(.+)' binding for control '(.+)' requires at least one temporal group-by field\.$/);if(v){const[,h,x]=v,p=`${h}:${x}:missing-temporal-group-by`;r.has(p)||r.set(p,`"${se(n,h)}" can no longer use "${ee(n,h,x)}" for time grain because the card does not currently group by a date field.`);continue}r.set(c,c)}return Array.from(r.values())}const Zt=["enum","multi_enum","text","number","boolean","date"];function ea({open:t,onOpenChange:a,initialMode:n="manage"}){var _;const r=n==="create",{forceClose:c,handleOpenChange:m,isCreateFlowActive:d,preventPassiveDismissDuringCreate:f,resolvedOpen:g,setIsCreateFlowActive:v}=bs.useCreateFlowOverlayState({open:t,onOpenChange:a,initialCreateFlowActive:n==="create",dismissMode:"explicit-only"}),h=o.useDashboardStore(j=>j.dashboard),x=o.useDashboardStore(j=>j.selectedSheetId),{setDashboardInputs:p}=o.useDashboardActions(),u=(_=h.sheets)==null?void 0:_.find(j=>j.id===x),i=(u==null?void 0:u.kind)==="document"&&!!u.document,y=b.useMemo(()=>i&&(u!=null&&u.document)?s.getDocumentSheetDashboardInputs(h,u.id):[],[h,i,u==null?void 0:u.document,u==null?void 0:u.id]),w=b.useMemo(()=>y.filter(j=>j.kind==="control"),[y]),D=b.useMemo(()=>w.map(j=>j.control),[w]),C=b.useMemo(()=>ta(D),[D]),N=b.useMemo(()=>sa(h),[h]),E=b.useCallback(()=>{if(r){c();return}v(!1)},[r,c,v]),M=b.useCallback((j,R,B)=>{!i||!(u!=null&&u.document)||p(na({allInputs:h.inputs||[],documentSheetId:u.id,currentDocumentInputs:y,nextControls:j,nextDefaultValues:R,change:B}))},[h.inputs,y,i,u,p]);if(!i||!(u!=null&&u.document))return null;const P=d?"Add document control":"Document Controls";return e.jsx(s.Dialog,{open:g,onOpenChange:m,children:e.jsxs(s.DialogContent,{className:"flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",onEscapeKeyDown:f,onPointerDownOutside:f,children:[e.jsxs(s.DialogHeader,{className:d?"space-y-0":void 0,children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:P}),e.jsx(s.DialogDescription,{className:d?"sr-only":"text-[13px]",children:d?"Configure and add a document-local control input.":"Add document-local control inputs. They are stored on this document sheet and are not dashboard controls."})]}),e.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:e.jsx(bs.ControlDefinitionListEditor,{scope:"dashboard",controls:D,reservedControlIds:N,defaultValues:C,usageByControlId:{},availableFieldChoices:[],availableMetricChoices:[],structuralParticipants:[],structuralParticipantIdsByControlId:{},allowedControlTypes:Zt,initialCreateFlow:n==="create",onCreateFlowActiveChange:v,onCreateFlowComplete:E,onChange:M,emptyMessage:"No document controls yet."})})]})})}function sa(t){return(t.controls||[]).map(a=>a.id)}function ta(t){const a={};for(const n of t)n.defaultValue!==void 0&&(a[n.id]=n.defaultValue);return a}function aa(t,a){return a?Object.prototype.hasOwnProperty.call(a,t.id)?{...t,defaultValue:a[t.id]}:t.defaultValue===void 0?t:{...t,defaultValue:void 0}:t.defaultValue===void 0?t:{...t,defaultValue:void 0}}function na({allInputs:t,documentSheetId:a,currentDocumentInputs:n,nextControls:r,nextDefaultValues:c,change:m}){const d=new Map(r.map(p=>[p.id,aa(p,c)])),f=(m==null?void 0:m.type)==="rename"?{oldId:m.oldId,newId:m.newId}:null,g=new Set,v=[];for(const p of n){if(p.kind!=="control"){v.push(p);continue}const u=d.get(p.control.id)||((f==null?void 0:f.oldId)===p.control.id?d.get(f.newId):void 0);if(!u)continue;g.add(u.id);const i=s.createUniqueDashboardInputVariableNameFromName(u.id,[...t,...v].filter(w=>w.id!==p.id)),y=u.id===i?u:{...u,id:i};v.push({...p,label:y.label,variableName:i,requiredAtExecution:y.requiredAtExecution,control:y})}for(const p of d.values())g.has(p.id)||v.push(s.createDashboardControlInputFromControl({control:p,existingInputs:[...t,...v],sheetId:a}));const h=new Set(n.map(p=>p.id));return[...t.filter(p=>!h.has(p.id)),...v]}function ws(t,a){return{dashboard:s.cloneDeep(t),semanticExecutionPayload:s.cloneDeep(a)}}function ra(){var ds,us,ms,hs,ps,fs;G.useExportRecovery(),G.useExportPolling();const{authToken:t,tokenProps:a,id:n}=s.useSemaphorContext(),{isLocalDev:r}=s.useDashboardPreferences(),{openBrandStudioPreview:c}=s.useBrandStudioPreview(),{permissions:m}=It(),d=s.useHasDashboardId(),{isLoading:f}=s.useDashboardQuery(),g=o.useDashboardStore(l=>l.theme),v=o.useDashboardStore(l=>l.isDownloadingPdf),h=o.useDashboardStore(l=>l.dashboardAssistantDraftScopeKey),x=o.useDashboardStore(l=>l.lenses),p=o.useDashboardStore(l=>l.selectedLensId),u=x==null?void 0:x.find(l=>l.id===p),i=o.useDashboardStore(l=>l.dashboard),y=o.useDashboardStore(l=>l.selectedSheetId),w=(ds=i==null?void 0:i.sheets)==null?void 0:ds.find(l=>l.id===y),D=o.isDocumentSheet(w),C=D?(us=w==null?void 0:w.document)==null?void 0:us.page:void 0,N=o.useDashboardStore(l=>l.isDashboardEditing),{setDashboardTitle:E}=o.useDashboardStore(l=>l.actions),[M,P]=b.useState(!1),[_,j]=b.useState(!1),[R,B]=b.useState(!1),[V,H]=b.useState(!1),[S,L]=b.useState(!1),[F,q]=b.useState(!1),[te,K]=b.useState(!1),[Ts,He]=b.useState(!1),[De,ae]=b.useState(null),[Ps,ne]=b.useState(!1),[re,oe]=b.useState(null),[Ke,ie]=b.useState([]),[Qe,le]=b.useState(!1),Fs=o.useDashboardStore(l=>l.isDashboardPanelOpen),_s=o.useDashboardStore(l=>l.actions.setIsDashboardPanelOpen),Us=o.useDashboardStore(l=>l.filterValues),k=o.useDashboardStore(l=>l.isVisualEditing);o.useEditorStore(l=>l.card);const Q=s.useManagementStore(l=>l.selectedDashboard),ce=s.useManagementStore(l=>l.initialDashboard);s.useManagementStore(l=>l.selectedVisual),o.useDashboardStore(l=>l.selectedFrameId),o.useEditorStore(l=>l.frame);const de=Q?(hs=Q==null?void 0:Q.permissions)==null?void 0:hs.canEdit:(ms=ce==null?void 0:ce.permissions)==null?void 0:ms.canEdit,ue=o.useDashboardStore(l=>l.showFilters),We=s.useAssistantLayoutStore(l=>l.setPanelOpen),Je=o.useDashboardStore(l=>l.showDashboardJSON),we=o.useDashboardStore(l=>l.onSaveFunction),Ye=o.useDashboardStore(l=>l.actions.setShowFilters),{setDocumentInspectorTab:Xe,setIsDashboardEditing:Ze,setShowDashboardJSON:es}=o.useDashboardStore(l=>l.actions),{setInitialDashboard:ss,clearSelectedDashboard:Ce}=s.useManagementStore(l=>l.actions),{resources:me}=s.useResourceManagement(s.ResourceType.DASHBOARD),{data:Ne}=s.useUserPreferences(),Rs=((ps=Ne==null?void 0:Ne.preference)==null?void 0:ps.defaultDashboardId)||null,{mutate:qs,isPending:Gs}=s.useDefaultDashboardMutation(),{currentUser:$s}=s.useCurrentUserInfo(),Bs=s.canUserManageGroups($s),z=Q||ce,ts=z?{id:z.id,title:(i==null?void 0:i.title)||z.title||"Dashboard"}:null,{handleAddNewFrame:zs}=s.useAddNewFrame(),[Me,Ie]=b.useState(!1),[Vs,W]=b.useState(!1),[Ee,he]=b.useState("close"),J=s.useUpdateResource(s.ResourceType.DASHBOARD),[T,pe]=b.useState(null),as=b.useCallback(l=>{window.setTimeout(()=>{ae(l)},0)},[]),Hs=async(l,A)=>{if(!(i!=null&&i.id)){console.log("No dashboard ID found");return}console.log("Updating dashboard title:",{dashboardId:i.id,newTitle:l,previousTitle:A}),J.mutate({resourceId:i.id,data:{title:l}},{onSuccess:()=>{console.log("Dashboard title updated successfully"),s.ue.success("Dashboard title updated")},onError:U=>{console.error("Failed to update dashboard title:",U),s.ue.error("Failed to update dashboard title"),E(A)}})};b.useEffect(()=>{if(me&&me.length>0){const l=i==null?void 0:i.id;if(l){const A=me.find(U=>U.id===l);A&&ss(A)}}},[me,i==null?void 0:i.id,ss]);const Y=a.orgUserId||a.tenantId,Le=b.useMemo(()=>oa({accessToken:t==null?void 0:t.accessToken,dashboardId:(i==null?void 0:i.id)||n||a.dashboard_id,selectedSheetId:D?y:void 0,pageSize:C==null?void 0:C.size,orientation:C==null?void 0:C.orientation,theme:g}),[t==null?void 0:t.accessToken,n,i==null?void 0:i.id,D,C==null?void 0:C.orientation,C==null?void 0:C.size,y,g,a.dashboard_id]),ns=N&&!k&&Y&&de,{setDashboard:Ae}=o.useDashboardStore(l=>l.actions),ke=o.useDashboardStore(l=>l.semanticExecutionPayload),Ks=()=>{Ze(!0)},Oe=()=>{Ze(!1),es(!1),pe(null),ae(null)};b.useEffect(()=>{if(!N){T&&pe(null);return}T||!i||f||pe(ws(i,ke))},[i,T,N,f,ke]);const fe=(T==null?void 0:T.dashboard)??null,{isDirty:rs,isDirtyPending:Qs,resetDirty:xe}=lt.useDebouncedDirtyCheck(i,fe,300,1e3,Fe.serializeDashboardForDirtyCheck),os=b.useCallback(()=>fe?Fe.serializeDashboardForDirtyCheck(i)!==Fe.serializeDashboardForDirtyCheck(fe):!1,[i,fe]),is=rs||Qs,ge=Me||J.isPending,Ws=()=>{os()?(he("close"),W(!0)):(Oe(),xe())},Js=async()=>{await Te({closeAfterSave:!0,navigateHomeAfterSave:Ee==="home"})},Ys=()=>{T&&Ae(T.dashboard,{semanticExecutionPayload:T.semanticExecutionPayload}),Oe(),Ee==="home"&&Ce(),he("close"),W(!1),xe()},Xs=()=>{T&&(Ae(T.dashboard,{semanticExecutionPayload:T.semanticExecutionPayload}),xe())},Zs=()=>{if(N&&os()){he("home"),W(!0);return}Ce()};async function Te(l){const A=o.useDashboardStore.getState().dashboard;if(!A)return;const U=(l==null?void 0:l.closeAfterSave)??Qe,nt=(l==null?void 0:l.navigateHomeAfterSave)??!1;le(U),U&&W(!1);const rt=s.cloneDeep(A);ne(!0),oe(null),ie([]),Ie(!0);const ot={template:A};J.mutate({resourceId:A.id,data:ot},{onSuccess:O=>{var ve,ye,xs;const $=(O==null?void 0:O.id)||((ve=O==null?void 0:O.dashboard)==null?void 0:ve.id)||((ye=O==null?void 0:O.resource)==null?void 0:ye.id)||((xs=O==null?void 0:O.template)==null?void 0:xs.id)||null;if(!A.id&&$){const Pe=o.useAIInteractionStore.getState(),Se=Pe.pendingDashboardDraftMigration;(Se==null?void 0:Se.scopeKey)===h?Pe.actions.setPendingDashboardDraftMigrationExpectedDashboardId($):Se&&Pe.actions.clearPendingDashboardDraftMigration()}Ie(!1),s.ue.success("Dashboard saved!"),pe(ws(rt,o.useDashboardStore.getState().semanticExecutionPayload)),ne(!1),le(!1),U&&(Oe(),xe(),nt&&Ce()),he("close")},onError:O=>{Ie(!1),oe("Failed to save dashboard. Please try again.");const $=O.details,ve=Array.isArray($==null?void 0:$.errors)?($.errors||[]).filter(ye=>typeof ye=="string"):[];ie(Xt({errors:ve,dashboard:A||void 0})),s.ue.error("Failed to save dashboard")}})}async function et(){if(P(!0),!p||!u)return;const l=o.useDashboardStore.getState().dashboard;if(!l){P(!1);return}const A=JSON.stringify(l),U={...u,template:A,filterValues:Us};await Ge(a.apiServiceUrl,U,t==null?void 0:t.accessToken),s.ue.success("Lens saved"),we==null||we(l),P(!1)}const ls=(u==null?void 0:u.name)||i.title,X=!!(i!=null&&i.id);J.isPending&&console.log("Title during update:",{title:ls,dashboardStateTitle:i.title,dashboardId:i==null?void 0:i.id,currentLensName:u==null?void 0:u.name});const cs=a.orgUserId||a.tenantId&&a.endUserId&&a.endUserEmail,st=!!cs&&!!(t!=null&&t.accessToken)&&!!(a!=null&&a.apiServiceUrl);b.useEffect(()=>{!X&&V&&H(!1)},[X,V]);const tt=d,Z=(i==null?void 0:i.id)||null,be=!!Z&&Rs===Z,at=()=>{Z&&qs({dashboardId:be?null:Z})};return e.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",role:"dashboard-controls",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[cs&&e.jsxs(e.Fragment,{children:[e.jsx(s.IconButton,{"aria-label":"Manage Dashboards",tooltip:"Manage Dashboards",onClick:()=>{_s(!Fs)},className:"h-7 w-7 px-0",buttonProps:{size:"xs"},children:e.jsx(ht,{className:"h-3.5 w-3.5"})}),tt&&!k&&e.jsx(s.IconButton,{"aria-label":"Dashboard Hub",tooltip:"Dashboard Hub",onClick:Zs,className:"h-7 w-7 px-0",buttonProps:{size:"xs"},children:e.jsx(s.House,{className:"h-3.5 w-3.5"})})]}),!k&&d&&(f?e.jsx("div",{className:"h-4 w-28 animate-pulse rounded-md bg-muted/70","aria-label":"Loading dashboard title",role:"status",children:e.jsx("span",{className:"sr-only",children:"Loading dashboard title"})}):e.jsxs(e.Fragment,{children:[e.jsx(s.EditableText,{value:ls||"Untitled Dashboard",onSave:l=>{console.log("EditableText onSave called:",{newTitle:l,canEditDashboard:de,dashboardId:i==null?void 0:i.id});const A=(i==null?void 0:i.title)||"";E(l),Hs(l,A)},isEditable:de&&!u,displayClassName:"text-[13px] font-medium",inputClassName:"text-[13px] font-medium",placeholder:"Dashboard Title",isPending:J.isPending}),st&&Z&&e.jsx(o.TooltipProvider,{children:e.jsxs(o.Tooltip,{children:[e.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsx(o.Button,{variant:"ghost",size:"xs",onClick:at,disabled:Gs||!(t!=null&&t.accessToken)||!(a!=null&&a.apiServiceUrl),className:"w-7 px-0","aria-label":be?"Remove as default dashboard":"Make this a default dashboard",children:e.jsx(s.Star,{className:o.cn("h-3.5 w-3.5 transition-colors",be?"fill-foreground text-foreground":"text-muted-foreground hover:text-foreground")})})}),e.jsx(o.TooltipContent,{children:e.jsx("p",{children:be?"Remove as default dashboard":"Make this a default dashboard"})})]})})]}))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[k&&e.jsxs(e.Fragment,{children:[e.jsx(G.AdvancedModeToggle,{}),e.jsx(G.VisualEditingControls,{})]}),!k&&d&&((fs=z==null?void 0:z.permissions)==null?void 0:fs.canShare)&&e.jsxs(o.Button,{variant:"outline",size:"xs",onClick:()=>j(!0),children:[e.jsx(s.Share2,{className:"h-3.5 w-3.5"}),"Share"]}),!k&&N&&m.canUseFilters&&d&&e.jsx(G.DashboardFilterControlsButton,{showFilters:D?!1:ue,onToggleFilters:()=>{if(D&&y){Xe(y,"inputs");return}ue||We("dashboard",!1),Ye(!ue)},onAddFilter:()=>{if(D&&y){Xe(y,"inputs");return}ue||(We("dashboard",!1),Ye(!0))},onAddControl:()=>{as("create")},onManageControls:()=>as("manage")}),N&&!k&&d&&De?D?e.jsx(ea,{open:!0,onOpenChange:l=>{l||ae(null)},initialMode:De}):e.jsx(G.DashboardControlsSettings,{open:!0,onOpenChange:l=>{l||ae(null)},showTrigger:!1,initialMode:De}):null,N&&!k&&Y&&u&&r&&d&&e.jsxs(o.Button,{variant:"secondary",size:"xs",disabled:M,onClick:et,children:[e.jsx(vs.Save,{className:"h-3.5 w-3.5"}),"Save Lens"]}),N&&!k&&d&&!D&&e.jsxs(o.Button,{variant:"outline",size:"xs",disabled:!N,onClick:()=>zs(),children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"Visual"]}),!k&&!N&&de&&d&&e.jsxs(o.Button,{size:"xs",onClick:Ks,children:[e.jsx(s.Pencil,{className:"h-3.5 w-3.5"}),"Edit"]}),ns&&d&&rs&&e.jsxs(o.Button,{variant:"outline",size:"xs",onClick:Xs,disabled:ge,children:[e.jsx(bt,{className:"h-3.5 w-3.5"}),"Undo"]}),ns&&d&&e.jsxs(o.Button,{size:"xs",className:o.cn(!is&&"opacity-60"),disabled:ge||!is,onClick:()=>Te(),children:[ge?e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(vs.Save,{className:"h-3.5 w-3.5"}),ge?"Saving...":"Save"]}),N&&!k&&d&&e.jsxs(o.Button,{variant:"outline",size:"xs",onClick:Ws,children:[e.jsx(s.Cross2Icon,{className:"h-3.5 w-3.5"}),"Close"]}),!k&&d&&e.jsx("div",{className:"ml-2",children:e.jsx(G.NotificationBell,{})}),!k&&r&&e.jsx(jt,{}),!k&&d&&e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(s.IconButton,{tooltip:"More Options",className:"w-7 px-0 text-muted-foreground hover:text-foreground",buttonProps:{size:"xs",variant:"ghost","aria-label":"More dashboard options"},children:e.jsx(s.EllipsisVertical,{className:"h-3.5 w-3.5"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"w-56 rounded-control border border-border/60 p-1 shadow-sm",children:[e.jsx(s.DropdownMenuLabel,{children:"Reports"}),e.jsxs(s.DropdownMenuItem,{disabled:v,onSelect:()=>He(!0),children:[e.jsx(s.Download,{className:"h-3.5 w-3.5"}),"Export"]}),e.jsxs(s.DropdownMenuItem,{disabled:!X,onSelect:()=>{X&&H(!0)},children:[e.jsx(s.Clock,{className:"h-3.5 w-3.5"}),"Schedule"]}),e.jsx(s.DropdownMenuSeparator,{}),Bs&&e.jsxs(e.Fragment,{children:[e.jsx(s.DropdownMenuLabel,{children:"Access"}),e.jsxs(s.DropdownMenuItem,{onClick:()=>B(!0),children:[e.jsx(s.Users,{className:"h-3.5 w-3.5"}),"Manage Groups"]}),e.jsx(s.DropdownMenuSeparator,{})]}),e.jsx(s.DropdownMenuLabel,{children:"Preferences"}),e.jsxs(s.DropdownMenuItem,{onClick:()=>L(!0),children:[e.jsx(s.Calendar,{className:"h-3.5 w-3.5"}),"Calendar Preferences"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>q(!0),children:[e.jsx(s.FileText,{className:"h-3.5 w-3.5"}),"Summary Settings"]}),r&&d&&e.jsxs(e.Fragment,{children:[e.jsx(s.DropdownMenuSeparator,{}),e.jsx(s.DropdownMenuLabel,{children:"Developer"}),e.jsxs(s.DropdownMenuItem,{onSelect:()=>{var l;t!=null&&t.accessToken&&((l=navigator==null?void 0:navigator.clipboard)!=null&&l.writeText?navigator.clipboard.writeText(t.accessToken).then(()=>s.ue.success("Token copied to clipboard")).catch(()=>s.ue.error("Unable to copy token")):s.ue.error("Clipboard not available"))},children:[e.jsx(s.Copy,{className:"h-3.5 w-3.5"}),"Copy token"]}),D&&e.jsxs(s.DropdownMenuItem,{disabled:!Le,onSelect:()=>{var l;if(!Le){s.ue.error("Open a document sheet with a token to copy the local PDF URL");return}(l=navigator==null?void 0:navigator.clipboard)!=null&&l.writeText?navigator.clipboard.writeText(Le).then(()=>s.ue.success("Local document PDF URL copied to clipboard")).catch(()=>s.ue.error("Unable to copy local document PDF URL")):s.ue.error("Clipboard not available")},children:[e.jsx(s.Copy,{className:"h-3.5 w-3.5"}),"Copy local document PDF URL"]}),e.jsxs(s.DropdownMenuItem,{onSelect:()=>o.invalidateToken(a.apiServiceUrl),children:[e.jsx(xt,{className:"h-3.5 w-3.5"}),"Invalidate token"]}),e.jsxs(s.DropdownMenuItem,{onSelect:c,children:[e.jsx(ct.Palette,{className:"h-3.5 w-3.5"}),"Brand Studio"]}),N&&e.jsxs(s.DropdownMenuItem,{onSelect:()=>es(!Je),children:[e.jsx(dt.Braces,{className:"h-3.5 w-3.5"}),Je?"Hide dashboard JSON":"Show dashboard JSON"]}),Y&&N&&e.jsxs(s.DropdownMenuItem,{onSelect:()=>K(!0),children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"Add lens"]}),Y&&e.jsxs(s.DropdownMenuSub,{children:[e.jsxs(s.DropdownMenuSubTrigger,{children:[e.jsx(mt,{className:"h-3.5 w-3.5"}),"Lenses"]}),e.jsx(s.DropdownMenuSubContent,{className:"w-60",children:e.jsx(Mt,{})})]})]})]})]}),_&&ts&&e.jsx(s.ShareDialog,{resource:ts,resourceType:s.ResourceType.DASHBOARD,onClose:()=>j(!1)}),e.jsx(Jt,{open:R,onOpenChange:B}),X&&(i==null?void 0:i.id)&&e.jsx(s.EmailScheduleDialog,{open:V,onOpenChange:H,dashboardId:i.id,dashboardName:i==null?void 0:i.title}),e.jsx(gs.CalendarPreferencesDialog,{open:S,onOpenChange:L}),e.jsx(gs.DashboardSummarySettingsDialog,{open:F,onOpenChange:q,dashboard:i,disabled:!N,onApply:l=>Ae({...i,summary:l},{semanticExecutionPayload:ke})}),r&&Y&&d&&e.jsx(Nt,{open:te,onOpenChange:K}),d&&e.jsx(s.DownloadPdf,{open:Ts,onOpenChange:He}),e.jsx(s.AlertDialog,{open:Ps,onOpenChange:l=>{!l&&Me&&!re||(ne(l),l||(oe(null),ie([]),le(!1)))},children:e.jsxs(s.AlertDialogContent,{className:"max-w-sm",children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:re?"Save failed":"Saving dashboard"}),e.jsx(s.AlertDialogDescription,{className:"pt-2",children:re?"We could not save the dashboard. Please try again.":"Please wait while we save your changes."}),Ke.length>0&&e.jsxs("div",{className:"space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left",children:[e.jsx("div",{className:"text-sm font-medium text-destructive",children:"What needs attention"}),e.jsx("ul",{className:"list-disc space-y-1 pl-4 text-xs text-muted-foreground",children:Ke.slice(0,5).map(l=>e.jsx("li",{children:l},l))})]})]}),e.jsx(s.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:justify-end",children:re?e.jsxs(e.Fragment,{children:[e.jsx(s.AlertDialogCancel,{onClick:()=>{ne(!1),oe(null),ie([]),le(!1)},className:"m-0",children:"Close"}),e.jsx(s.AlertDialogAction,{onClick:()=>Te({closeAfterSave:Qe,navigateHomeAfterSave:Ee==="home"}),className:"m-0",children:"Retry"})]}):e.jsxs(s.AlertDialogAction,{disabled:!0,className:"m-0 cursor-default",children:[e.jsx(o.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]})})]})}),e.jsx(G.UnsavedChangesAlert,{open:Vs,onOpenChange:l=>{W(l)},onSave:Js,onDiscard:Ys,isSaving:Me,saveLabel:"Save",discardLabel:"Discard"})]})]})}function oa({accessToken:t,dashboardId:a,selectedSheetId:n,pageSize:r,orientation:c,theme:m}){if(!t||!n)return null;const d=new URL("http://localhost:5173/print-document");d.searchParams.set("token",t),a&&d.searchParams.set("dashboardId",a),d.searchParams.set("selectedSheetId",n),m&&d.searchParams.set("theme",m);const f=new URL("http://127.0.0.1:3002/");return f.searchParams.set("pdfMode","document"),f.searchParams.set("pageSize",r||"letter"),f.searchParams.set("orientation",c||"portrait"),f.searchParams.set("url",d.toString()),f.toString()}exports.default=ra;
|