react-semaphor 0.1.280 → 0.1.282
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/chunks/{dashboard-controls-I3SWzXID.js → dashboard-controls-B_F5f_BF.js} +4 -4
- package/dist/chunks/{dashboard-controls-Cm_n6Dce.js → dashboard-controls-XX9__V-e.js} +1 -1
- package/dist/chunks/{dashboard-filter-controls-button-DuifafhB.js → dashboard-filter-controls-button-DVLBLHga.js} +60 -60
- package/dist/chunks/{dashboard-filter-controls-button-DXXJnFns.js → dashboard-filter-controls-button-DZpvfXwU.js} +1 -1
- package/dist/chunks/{dashboard-json--iZU90D2.js → dashboard-json-CexNQg-E.js} +1 -1
- package/dist/chunks/{dashboard-json-C0_fJrmP.js → dashboard-json-Dd9Q2bZm.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-DOofgrKU.js → dashboard-summary-settings-dialog-BjdrHb1l.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-BzWnRhFU.js → dashboard-summary-settings-dialog-zdacBYZZ.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DEuJScSB.js → edit-dashboard-visual-Bi9pQx6G.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-CEb2cSMS.js → edit-dashboard-visual-DQts3aun.js} +2 -2
- package/dist/chunks/{index-ZpmXTndp.js → index-BY0YEY92.js} +223 -223
- package/dist/chunks/{index-BzQ2UBDI.js → index-Bgn4zTsp.js} +25446 -24525
- package/dist/chunks/{resource-management-panel-DNez0W3b.js → resource-management-panel--xIMLPdz.js} +2 -2
- package/dist/chunks/{resource-management-panel-DMHJbuqI.js → resource-management-panel-w7afzaPB.js} +1 -1
- package/dist/chunks/use-create-flow-overlay-state-AsQy4tbh.js +21 -0
- package/dist/chunks/use-create-flow-overlay-state-COsIHnQp.js +1523 -0
- package/dist/chunks/{use-visual-utils-C2syL_qa.js → use-visual-utils-BCWNcaWk.js} +1 -1
- package/dist/chunks/{use-visual-utils-D4Lp-wat.js → use-visual-utils-CI-7TNJI.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- 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 +9 -1
- package/dist/types/main.d.ts +9 -1
- package/dist/types/shared.d.ts +9 -1
- package/dist/types/surfboard.d.ts +9 -1
- package/dist/types/types.d.ts +9 -1
- package/package.json +1 -1
- package/dist/chunks/use-create-flow-overlay-state-BdoJfJmU.js +0 -21
- package/dist/chunks/use-create-flow-overlay-state-BvBTFIgX.js +0 -1443
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-BY0YEY92.js"),e=require("../types/index.cjs"),r=require("../chunks/dashboard-summary-settings-dialog-BjdrHb1l.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-Bgn4zTsp.js";
|
|
2
2
|
import { CONTROL_CARD_DEFAULT_VALUE as s, EMPTY_SELECTION as D } from "../types/index.js";
|
|
3
|
-
import { C as m, D as t } from "../chunks/dashboard-summary-settings-dialog-
|
|
3
|
+
import { C as m, D as t } from "../chunks/dashboard-summary-settings-dialog-zdacBYZZ.js";
|
|
4
4
|
export {
|
|
5
5
|
s as CONTROL_CARD_DEFAULT_VALUE,
|
|
6
6
|
m as CalendarPreferencesDialog,
|
|
@@ -377,7 +377,7 @@ export declare type ControlSource = {
|
|
|
377
377
|
} | {
|
|
378
378
|
kind: 'metric_allowlist';
|
|
379
379
|
metricIds: string[];
|
|
380
|
-
};
|
|
380
|
+
} | SqlQueryControlSource;
|
|
381
381
|
|
|
382
382
|
export declare type ControlType = 'enum' | 'multi_enum' | 'text' | 'number' | 'boolean' | 'date' | 'field_selector' | 'metric_selector' | 'aggregation_selector' | 'grain_selector';
|
|
383
383
|
|
|
@@ -1292,6 +1292,14 @@ export declare type SqlGen = {
|
|
|
1292
1292
|
dimensions?: string[];
|
|
1293
1293
|
};
|
|
1294
1294
|
|
|
1295
|
+
export declare type SqlQueryControlSource = {
|
|
1296
|
+
kind: 'sql_query';
|
|
1297
|
+
connectionId: string;
|
|
1298
|
+
sql: string;
|
|
1299
|
+
valueColumn: string;
|
|
1300
|
+
labelColumn?: string;
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1295
1303
|
declare type StringOptions = {
|
|
1296
1304
|
maxLength?: number;
|
|
1297
1305
|
};
|
package/dist/types/main.d.ts
CHANGED
|
@@ -1215,7 +1215,7 @@ export declare type ControlSource = {
|
|
|
1215
1215
|
} | {
|
|
1216
1216
|
kind: 'metric_allowlist';
|
|
1217
1217
|
metricIds: string[];
|
|
1218
|
-
};
|
|
1218
|
+
} | SqlQueryControlSource;
|
|
1219
1219
|
|
|
1220
1220
|
export declare type ControlType = 'enum' | 'multi_enum' | 'text' | 'number' | 'boolean' | 'date' | 'field_selector' | 'metric_selector' | 'aggregation_selector' | 'grain_selector';
|
|
1221
1221
|
|
|
@@ -3334,6 +3334,14 @@ export declare type SqlGen = {
|
|
|
3334
3334
|
dimensions?: string[];
|
|
3335
3335
|
};
|
|
3336
3336
|
|
|
3337
|
+
export declare type SqlQueryControlSource = {
|
|
3338
|
+
kind: 'sql_query';
|
|
3339
|
+
connectionId: string;
|
|
3340
|
+
sql: string;
|
|
3341
|
+
valueColumn: string;
|
|
3342
|
+
labelColumn?: string;
|
|
3343
|
+
};
|
|
3344
|
+
|
|
3337
3345
|
declare type StateSerializer<T> = (value: T) => string;
|
|
3338
3346
|
|
|
3339
3347
|
declare type StringCanonicalFormat = {
|
package/dist/types/shared.d.ts
CHANGED
|
@@ -356,7 +356,7 @@ declare type ControlSource = {
|
|
|
356
356
|
} | {
|
|
357
357
|
kind: 'metric_allowlist';
|
|
358
358
|
metricIds: string[];
|
|
359
|
-
};
|
|
359
|
+
} | SqlQueryControlSource;
|
|
360
360
|
|
|
361
361
|
declare type ControlType = 'enum' | 'multi_enum' | 'text' | 'number' | 'boolean' | 'date' | 'field_selector' | 'metric_selector' | 'aggregation_selector' | 'grain_selector';
|
|
362
362
|
|
|
@@ -1132,6 +1132,14 @@ declare interface SortByField extends Field {
|
|
|
1132
1132
|
direction: 'asc' | 'desc';
|
|
1133
1133
|
}
|
|
1134
1134
|
|
|
1135
|
+
declare type SqlQueryControlSource = {
|
|
1136
|
+
kind: 'sql_query';
|
|
1137
|
+
connectionId: string;
|
|
1138
|
+
sql: string;
|
|
1139
|
+
valueColumn: string;
|
|
1140
|
+
labelColumn?: string;
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1135
1143
|
declare type StateSerializer<T> = (value: T) => string;
|
|
1136
1144
|
|
|
1137
1145
|
declare type StringOptions = {
|
|
@@ -384,7 +384,7 @@ export declare type ControlSource = {
|
|
|
384
384
|
} | {
|
|
385
385
|
kind: 'metric_allowlist';
|
|
386
386
|
metricIds: string[];
|
|
387
|
-
};
|
|
387
|
+
} | SqlQueryControlSource;
|
|
388
388
|
|
|
389
389
|
export declare type ControlType = 'enum' | 'multi_enum' | 'text' | 'number' | 'boolean' | 'date' | 'field_selector' | 'metric_selector' | 'aggregation_selector' | 'grain_selector';
|
|
390
390
|
|
|
@@ -1312,6 +1312,14 @@ export declare type SqlGen = {
|
|
|
1312
1312
|
dimensions?: string[];
|
|
1313
1313
|
};
|
|
1314
1314
|
|
|
1315
|
+
export declare type SqlQueryControlSource = {
|
|
1316
|
+
kind: 'sql_query';
|
|
1317
|
+
connectionId: string;
|
|
1318
|
+
sql: string;
|
|
1319
|
+
valueColumn: string;
|
|
1320
|
+
labelColumn?: string;
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1315
1323
|
declare type StringOptions = {
|
|
1316
1324
|
maxLength?: number;
|
|
1317
1325
|
};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -621,7 +621,7 @@ export declare type ControlSource = {
|
|
|
621
621
|
} | {
|
|
622
622
|
kind: 'metric_allowlist';
|
|
623
623
|
metricIds: string[];
|
|
624
|
-
};
|
|
624
|
+
} | SqlQueryControlSource;
|
|
625
625
|
|
|
626
626
|
export declare type ControlType = 'enum' | 'multi_enum' | 'text' | 'number' | 'boolean' | 'date' | 'field_selector' | 'metric_selector' | 'aggregation_selector' | 'grain_selector';
|
|
627
627
|
|
|
@@ -1636,6 +1636,14 @@ export declare type SqlGen = {
|
|
|
1636
1636
|
dimensions?: string[];
|
|
1637
1637
|
};
|
|
1638
1638
|
|
|
1639
|
+
export declare type SqlQueryControlSource = {
|
|
1640
|
+
kind: 'sql_query';
|
|
1641
|
+
connectionId: string;
|
|
1642
|
+
sql: string;
|
|
1643
|
+
valueColumn: string;
|
|
1644
|
+
labelColumn?: string;
|
|
1645
|
+
};
|
|
1646
|
+
|
|
1639
1647
|
declare type StringCanonicalFormat = {
|
|
1640
1648
|
type: 'string';
|
|
1641
1649
|
prefix?: string;
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./index-ZpmXTndp.js"),t=require("react/jsx-runtime"),v=require("react"),G=require("./use-visual-utils-D4Lp-wat.js");/**
|
|
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 xe=e.createLucideIcon("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
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 ie=e.createLucideIcon("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
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 de=e.createLucideIcon("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
|
|
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 W=e.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function J(){var p,C;const l=e.useEditorStore(b=>b.card),r=e.useEditorStore(b=>b.frame),n=v.useMemo(()=>e.findCustomVisualConfigCard(r,l),[r,l]),{manifest:d}=e.useCustomVisual(((p=n==null?void 0:n.customCardPreferences)==null?void 0:p.url)||""),u=v.useMemo(()=>{var b;return(b=d==null?void 0:d.visuals)==null?void 0:b.find(h=>{var y;return h.name===((y=n==null?void 0:n.customCardPreferences)==null?void 0:y.componentName)})},[d,(C=n==null?void 0:n.customCardPreferences)==null?void 0:C.componentName]),m=e.resolveMultiInputType(n,u),x=v.useMemo(()=>e.getCustomVisualInputCards({frame:r,configCard:n,isMultiInputVisual:m==="multiple"}),[r,n,m]),f=v.useMemo(()=>{const b=x.findIndex(h=>(h==null?void 0:h.id)===l.id);return b<0?-1:e.getSlotIndexForCard(l,b)},[x,l]);return v.useMemo(()=>!n||m!=="multiple"||f<0?l.type:e.getEffectiveCardTypeForSlot(l,f,u==null?void 0:u.slots)??l.type,[n,m,f,l,u==null?void 0:u.slots])}function he({type:l,isLinked:r,className:n,showLabel:d=!1,showLocal:u=!1}){const m=e.useDashboardStore(D=>D.selectedFrameId),x=e.useManagementStore(D=>D.selectedVisual),f=e.useEditorStore(D=>D.frame);let p;if(l)p=l;else if(r!==void 0)p=r?"linked":"library";else if(!!!(f!=null&&f.visualId||x!=null&&x.id)&&m)p="local";else if(x&&!m)p="library";else if(f!=null&&f.visualId&&m)p="linked";else if(x!=null&&x.id&&m)p="library";else return null;if(p==="local"&&!u)return null;const C={local:"border-slate-200/70 bg-slate-50/80 text-slate-700 shadow-sm hover:bg-slate-100/80 dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-200 dark:hover:bg-slate-800/80",linked:"border-purple-200/70 bg-gradient-to-r from-purple-50/50 to-purple-100/30 text-purple-900 shadow-sm hover:from-purple-100/60 hover:to-purple-100/50 hover:shadow-md dark:border-purple-800/50 dark:from-purple-950/40 dark:to-purple-900/30 dark:text-purple-100 dark:hover:from-purple-950/60 dark:hover:to-purple-900/50",library:"border-blue-200/70 bg-gradient-to-r from-blue-50/50 to-blue-100/30 text-blue-900 shadow-sm hover:from-blue-100/60 hover:to-blue-100/50 hover:shadow-md dark:border-blue-800/50 dark:from-blue-950/40 dark:to-blue-900/30 dark:text-blue-100 dark:hover:from-blue-950/60 dark:hover:to-blue-900/50"},b={local:"Local to this dashboard: Changes made here only affect this dashboard copy.",linked:"Linked to library: Changes made here update the library visual and all linked instances.",library:"Library visual: Share and reuse this visual across multiple dashboards."},h={local:"border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",linked:"border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",library:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"},y={local:"fill-slate-50 dark:fill-slate-900",linked:"fill-purple-50 dark:fill-purple-950",library:"fill-blue-50 dark:fill-blue-950"},j={local:t.jsx("span",{className:"h-2 w-2 rounded-full bg-current/70"}),linked:t.jsx(de,{className:"h-3.5 w-3.5"}),library:t.jsx(ie,{className:"h-3.5 w-3.5"})},B={local:"Local",linked:"Linked",library:"Library"};return t.jsx(e.TooltipProvider,{children:t.jsxs(e.Tooltip,{delayDuration:300,children:[t.jsx(e.TooltipTrigger,{asChild:!0,children:t.jsxs(e.Badge,{variant:"outline",className:e.cn("cursor-help select-none transition-all",C[p],n),children:[j[p],d&&t.jsx("span",{className:"ml-1 text-xs font-medium leading-none",children:B[p]})]})}),t.jsxs(e.TooltipContent,{side:"bottom",className:e.cn("max-w-xs",h[p]),children:[t.jsx(e.TooltipArrow,{className:y[p]}),t.jsx("p",{children:b[p]})]})]})})}function fe(l,r){return{...l,sql:"",python:"",config:void 0,customCfg:"",preferences:{},interactionConfig:void 0,linkedInteractionTargetOverrides:void 0,dynamicCardPreferences:void 0,customCardPreferences:r?l.customCardPreferences:void 0,visualizationMode:"builtin",type:r?l.type:"bar"}}function Z(l){const r=e.getDynamicFrameSaveIssue(l);return r?(e.ue.error(r),!1):!0}function ye({className:l,variant:r="outline"}){const n=e.useEditorStore(m=>m.onSave),{getUpdatedFrame:d}=G.useVisualUtils();function u(){const m=d();Z(m)&&(n==null||n(m))}return t.jsxs(e.Button,{onClick:u,className:e.cn("h-8",l),size:"sm",variant:r,children:[t.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Accept"]})}function be({className:l,variant:r="default"}){const n=e.useQueryClient(),[d,u]=v.useState(!1),m=e.useDashboardStore(y=>y.actions.setIsDashboardPanelOpen),{setIsVisualEditing:x}=e.useDashboardActions(),{getUpdatedFrame:f}=G.useVisualUtils(),p=e.useSelectedVisual(),C=e.useEditorStore(y=>y.frame),b=e.useUpdateVisualMutation(),h=()=>{const y=f();if(!Z(y))return;const j=(C==null?void 0:C.visualId)||(p==null?void 0:p.id);if(!j){e.ue.error("No visual to save");return}u(!0),b.mutate({visualId:j,data:{frameObject:y}},{onSuccess:()=>{u(!1),m(!0),e.ue.success("Visual updated successfully"),n.invalidateQueries({queryKey:["resource-by-id","visual",j],exact:!0})},onError:()=>{u(!1),e.ue.error("Failed to update visual")}})};return t.jsxs(e.Button,{onClick:h,className:e.cn("h-8",l),size:"sm",variant:r,children:[d&&t.jsxs(t.Fragment,{children:[t.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving"]}),!d&&t.jsxs(t.Fragment,{children:[t.jsx(W,{className:"mr-2 size-4 font-bold"}),"Save to Library"]})]})}function ge({className:l}){const r=e.useQueryClient(),[n,d]=v.useState(!1),u=e.useSelectedVisual(),m=e.useEditorStore(y=>y.frame),x=e.useDashboardStore(y=>y.selectedSheetId),{updateFrame:f,setIsVisualEditing:p}=e.useDashboardActions(),{getUpdatedFrame:C}=G.useVisualUtils(),b=e.useUpdateVisualMutation(),h=async()=>{if(!x){e.ue.error("No sheet selected");return}const y=(m==null?void 0:m.visualId)||(u==null?void 0:u.id);if(!y){e.ue.error("No visual to update");return}d(!0);try{const j=C();if(!Z(j)){d(!1);return}await b.mutateAsync({visualId:y,data:{frameObject:j}});const B={...j,visualId:y};f(x,B),r.invalidateQueries({queryKey:["visuals"]}),r.invalidateQueries({queryKey:["visual",y]}),e.ue.success("Saved to library and applied locally"),setTimeout(()=>{p(!1)},300)}catch(j){console.error("Failed to save and apply:",j),e.ue.error("Failed to save and apply changes")}finally{d(!1)}};return t.jsx(e.Button,{onClick:h,className:e.cn("h-8",l),size:"sm",variant:"default",disabled:n,children:n?t.jsxs(t.Fragment,{children:[t.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving..."]}):t.jsxs(t.Fragment,{children:[t.jsx(W,{className:"mr-2 size-4 font-bold"}),"Save & Apply"]})})}function ve({className:l}){const{setTempQueryData:r,setSqlGen:n}=e.useEditorActions(),d=e.useQueryClient(),u=e.useEditorStore(h=>h.tempQueryData),m=e.useEditorStore(h=>h.onClose),x=e.useEditorStore(h=>h.card),f=J(),p=v.useMemo(()=>f!==x.type?{...x,type:f}:x,[x,f]),{queryKey:C}=e.useDashboardCardQuery(p);function b(){if(u){const{queryKey:h,queryData:y}=u;h&&y&&d.setQueryData(h,y)}n({}),m==null||m()}return t.jsxs(e.Button,{onClick:b,className:e.cn("h-8",l),size:"sm",variant:"outline",children:[t.jsx(e.X,{className:"mr-2 size-4"}),"Close"]})}function Ce({label:l="Clear",variant:r="secondary",className:n}={}){const{setTempQueryData:d}=e.useEditorActions(),u=e.useQueryClient(),m=e.useEditorStore(a=>a.tempQueryData),x=e.useEditorStore(a=>a.card),f=J(),p=v.useMemo(()=>f!==x.type?{...x,type:f}:x,[x,f]),{queryKey:C}=e.useDashboardCardQuery(p),{setCardSql:b,setSqlGen:h,setCardPython:y,setCardCustomCfg:j,setCardPreferences:B,clearQueryConfig:D,setCardConfig:Y,setCardType:K,setFrame:z,setCard:q,setActiveTabCardId:P}=e.useEditorActions();function M(){var V,U,_,I;const a=u.getQueryData(C);m!=null&&m.queryData||d({queryKey:C,queryData:a}),u.setQueryData(C,null),u.removeQueries({queryKey:C,exact:!0}),b(""),h({}),D(),Y(void 0),y(""),j(""),B({});const N=e.useEditorStore.getState().frame,O=e.useEditorStore.getState().card,T=e.findCustomVisualConfigCard(N,O),E=((V=T==null?void 0:T.customCardPreferences)==null?void 0:V.visualType)==="multiple"||!!((U=T==null?void 0:T.customCardPreferences)!=null&&U.dataInputCardIds)||(((_=T==null?void 0:T.customCardPreferences)==null?void 0:_.minInputs)||0)>1||(((I=T==null?void 0:T.customCardPreferences)==null?void 0:I.maxInputs)||0)>1,F=fe(O,E);z({...N,cards:N.cards.map(L=>L.id===F.id?F:L)}),P(F.id),q(F),E||K("bar")}return t.jsxs(e.Button,{onClick:M,className:e.cn("h-8",n),size:"sm",variant:r,children:[t.jsx(e.X,{className:"mr-2 size-3.5"}),l]})}function oe(l){const{control:r,onChange:n}=l;return t.jsxs("div",{className:"space-y-1",children:[t.jsx(e.Label,{className:"text-xs",children:"Label"}),t.jsxs("div",{className:"relative",children:[t.jsx(e.Input,{className:"pr-40",value:r.label,placeholder:"Control label",onChange:d=>n(d.target.value)}),t.jsx(e.Badge,{variant:"outline",className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-xs",children:e.getFriendlyTypeOption(r.type).label})]})]})}function je(l){const{currentStep:r,labels:n}=l;return t.jsx("div",{className:"sticky top-0 z-10 -mx-1 border-b bg-background/95 px-1 pb-2 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/85",children:t.jsx("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3",children:n.map((d,u)=>{const m=u+1,x=m===r,f=m<r;return t.jsxs(v.Fragment,{children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:e.cn("flex h-7 w-7 items-center justify-center rounded-full border text-[11px] font-semibold",x?"border-primary bg-primary text-primary-foreground":f?"border-primary/25 bg-primary/10 text-primary":"border-border bg-muted/30 text-muted-foreground"),children:m}),t.jsx("span",{className:e.cn("text-xs font-medium",x?"text-foreground":"text-muted-foreground"),children:d})]}),u<n.length-1?t.jsx("span",{className:"h-px w-5 bg-border/80 sm:w-8","aria-hidden":"true"}):null]},d)})})})}function R(l){const{secondary:r,tertiary:n,primary:d}=l;return t.jsxs("div",{className:"sticky bottom-0 z-10 -mx-1 flex justify-end gap-2 border-t bg-background/95 px-1 pb-1 pt-3 backdrop-blur supports-[backdrop-filter]:bg-background/85",children:[r,n,d]})}function Se(l){const{control:r,scope:n,detail:d}=l;return t.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-border/40 bg-muted/20 p-3",children:[t.jsx(e.CircleCheck,{className:"mt-0.5 h-4 w-4 text-emerald-600"}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"text-sm font-medium",children:r.label}),t.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.getFriendlyTypeOption(r.type).label," ·"," ",e.getControlOptionPreview(r)," ·"," ",e.getPlacementLabel(n,r.placement)]}),d?t.jsx("div",{className:"text-xs text-muted-foreground",children:d}):null]})]})}function $(l){const{title:r,children:n,className:d}=l;return t.jsxs("div",{className:e.cn("space-y-1 rounded-xl border border-border/40 bg-muted/20 p-3",d),children:[t.jsx("div",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:r}),n]})}function ke(l){const{createdReference:r,description:n}=l;return t.jsxs($,{title:"SQL cards",className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/30 bg-muted/40 px-3 py-2",children:[t.jsx("code",{className:"min-w-0 truncate text-xs",children:r}),t.jsx(e.CopyButton,{text:r,ariaLabel:"Copy SQL control reference"})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:n})]})}function re(l){const{control:r,defaultValue:n,availableFieldChoices:d,availableMetricChoices:u,onControlChange:m,onLabelChange:x,onDefaultValueChange:f,onBack:p,onNext:C,nextDisabled:b}=l;return t.jsxs("div",{className:"space-y-3",children:[t.jsx(oe,{control:r,onChange:x}),t.jsx(e.ControlDefinitionOptionsEditor,{control:r,availableFieldChoices:d,availableMetricChoices:u,onChange:m}),t.jsx(e.ControlDefaultValueEditor,{control:r,value:n,onChange:f,allowCardDefault:!0,hint:"This is the value viewers will see first."}),t.jsx(R,{secondary:t.jsx(e.Button,{type:"button",variant:"outline",onClick:p,children:"Back"}),primary:t.jsx(e.Button,{type:"button",onClick:C,disabled:b,children:"Next"})})]})}function ne(l){const{control:r,scope:n,createdReference:d,explorerContent:u,sqlDescription:m,summaryDetail:x,onBack:f,onCancel:p,onDone:C}=l;return t.jsxs("div",{className:"space-y-4",children:[t.jsx(Se,{control:r,scope:n,detail:x}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium",children:"How cards use this control"}),u,t.jsx(ke,{createdReference:d,description:m})]}),t.jsx(R,{secondary:t.jsx(e.Button,{type:"button",variant:"outline",onClick:f,children:"Back"}),tertiary:t.jsx(e.Button,{type:"button",variant:"outline",onClick:p,children:"Cancel"}),primary:t.jsx(e.Button,{type:"button",onClick:C,children:"Done"})})]})}function Ne(l){const r=e.createBlankControl(l.scope,l.existingControls,l.reservedIds),n=l.type===r.type?{...r,label:e.DEFAULT_LABEL_BY_TYPE[l.type]}:{...e.applyControlTypeChange({controls:[{...r,label:e.DEFAULT_LABEL_BY_TYPE[l.type]}],controlId:r.id,nextType:l.type}).controls[0],label:e.DEFAULT_LABEL_BY_TYPE[l.type]};return{step:2,control:n,defaultValue:e.getDefaultValueForType(n,void 0)}}function De({scope:l,controls:r,reservedControlIds:n,defaultValues:d,onChange:u,emptyMessage:m,initialCreateFlow:x=!1,usageByControlId:f,availableFieldChoices:p,availableMetricChoices:C,structuralParticipants:b,structuralParticipantIdsByControlId:h,card:y,onCreateFlowActiveChange:j,onCreateFlowComplete:B}){const D=v.useMemo(()=>new Set(n||[]),[n]),Y=e.getPlacementOptionsForScope(l),K=e.getDefaultPlacement(l),[z,q]=v.useState(null),[P,M]=v.useState(null),[a,N]=v.useState(()=>x?{step:1,control:e.createBlankControl(l,r,Array.from(D))}:null),O=v.useRef(x),T=v.useMemo(()=>e.getFriendlyControlTypeOptions({scope:l,card:y}),[y,l]),E=v.useCallback(s=>l==="dashboard"&&(s==="field_selector"||s==="metric_selector"),[l]),F=v.useMemo(()=>a?e.getEligibleParticipantsForStructuralControl(b||[],a.control.type):[],[a,b]),V=v.useMemo(()=>{if(!a)return{fields:p||[],metrics:C||[]};if(!E(a.control.type))return{fields:p||[],metrics:C||[]};const s=a.selectedCardIds||[],c=e.getCompatibleStructuralChoiceCatalog({controlType:a.control.type,participants:b||[],selectedCardIds:s});return{fields:a.control.type==="field_selector"?c.choices.map(o=>({option:o,target:c.fieldTargetMap[o.value]})):[],metrics:a.control.type==="metric_selector"?c.choices.map(o=>({option:o,target:c.metricTargetMap[o.value]})):[]}},[p,C,a,E,b]);v.useEffect(()=>{j==null||j(!!a)},[a,j]),v.useEffect(()=>{const s=x&&!O.current;O.current=x,s&&(N({step:1,control:e.createBlankControl(l,r,Array.from(D))}),M(null),q(null))},[r,x,D,l]);const U=s=>{if(!E(s.type))return{fields:p||[],metrics:C||[]};const c=(h==null?void 0:h[s.id])||[];if(c.length===0)return{fields:p||[],metrics:C||[]};const o=e.getCompatibleStructuralChoiceCatalog({controlType:s.type,participants:b||[],selectedCardIds:c});return{fields:s.type==="field_selector"?o.choices.map(g=>({option:g,target:o.fieldTargetMap[g.value]})):[],metrics:s.type==="metric_selector"?o.choices.map(g=>({option:g,target:o.metricTargetMap[g.value]})):[]}},_=s=>{if(!E(s.control.type))return{nextControl:s.control,cardBindingsById:void 0};const c=(h==null?void 0:h[s.control.id])||[],o=e.getCompatibleStructuralChoiceCatalog({controlType:s.control.type,participants:b||[],selectedCardIds:s.nextSelectedCardIds}),g=e.reconcileStructuralControlChoices({control:s.control,choices:o.choices}),S=Object.fromEntries(c.filter(i=>!s.nextSelectedCardIds.includes(i)).map(i=>[i,void 0]));return s.nextSelectedCardIds.length>0&&g.source.kind==="manual"&&g.source.options.length>0&&Object.assign(S,e.buildStructuralControlBindingsForParticipants({control:g,participants:b||[],selectedCardIds:s.nextSelectedCardIds})),{nextControl:g,cardBindingsById:S}},I=v.useCallback((s,c=d,o={type:"update"})=>{u(s,c,o)},[d,u]),L=(s,c)=>{const o=r.find(w=>w.id===s);let g=r.map(w=>w.id!==s?w:c(w));const S=g.find(w=>w.id===s);let i,k;if(S&&l==="dashboard"&&(S.type==="field_selector"||S.type==="metric_selector")){const w=(h==null?void 0:h[S.id])||[],A=_({control:S,nextSelectedCardIds:w});g=g.map(le=>le.id===s?A.nextControl:le),i=A.cardBindingsById,k=[S.id]}else if(o&&l==="dashboard"&&(o.type==="field_selector"||o.type==="metric_selector")){const w=(h==null?void 0:h[o.id])||[];i=Object.fromEntries(w.map(A=>[A,void 0])),k=[o.id]}I(g,d,{type:"update",cardBindingsById:i,affectedBindingControlIds:k})},ce=(s,c)=>{const o=c.trim();if(o.length===0||o===s||D.has(o)||r.some(i=>i.id===o&&i.id!==s))return;const g=r.map(i=>i.id===s?{...i,id:o}:i);if(!d){I(g,void 0,{type:"rename",oldId:s,newId:o});return}const S={...d};Object.prototype.hasOwnProperty.call(S,s)&&(S[o]=S[s],delete S[s]),I(g,S,{type:"rename",oldId:s,newId:o})},ue=s=>{const c=r.filter(g=>g.id!==s);if(!d){I(c,void 0,{type:"remove",controlId:s});return}const o={...d};delete o[s],I(c,o,{type:"remove",controlId:s})},pe=v.useCallback(()=>{N({step:1,control:e.createBlankControl(l,r,Array.from(D))}),M(null),q(null)},[r,D,l]),Q=s=>{N(c=>c&&{...c,control:s(c.control)})},ee=s=>{N(c=>c&&{...c,defaultValue:s})},H=(()=>{if(!a)return!1;if(a.step===2&&E(a.control.type))return(a.selectedCardIds||[]).length>0;if(a.step!==2&&a.step!==3||!a.control.label.trim())return!1;const c=e.ensureManualSource(a.control);return c.source.kind==="manual"&&(e.needsManualOptions(c)&&c.source.options.length===0||c.source.options.some(g=>g.label.trim().length===0||g.value.trim().length===0))?!1:e.hasConcreteDefaultValue(e.getDefaultValueForType(c,a.defaultValue))})(),te=()=>{var i;if(!a)return;const s=e.ensureManualSource(a.control),c=e.deriveUniqueControlId({label:s.label,fallbackId:s.id,existingControls:r,reservedIds:Array.from(D)}),o={...s,id:c},g=l==="dashboard"&&(o.type==="field_selector"||o.type==="metric_selector")&&((i=a.selectedCardIds)!=null&&i.length)?e.buildStructuralControlBindingsForParticipants({control:o,participants:b||[],selectedCardIds:a.selectedCardIds}):void 0,S=e.getDefaultValueForType(o,a.defaultValue);N({step:l==="dashboard"&&(o.type==="field_selector"||o.type==="metric_selector")?4:3,control:o,defaultValue:S,createdControlId:c,selectedCardIds:a.selectedCardIds,cardBindingsById:g})},X=v.useCallback(()=>{N(null)},[]),se=v.useCallback(()=>{if(!(a!=null&&a.createdControlId)){N(null);return}const s=a.control,c=a.createdControlId,o=e.getDefaultValueForType(s,a.defaultValue);d?I([...r,s],{...d,[c]:o},{type:"add",cardBindingsById:a.cardBindingsById}):I([...r,{...s,defaultValue:o}],void 0,{type:"add",cardBindingsById:a.cardBindingsById}),M(c),N(null),B==null||B()},[r,a,d,I,B]),me=a?E(a.control.type)?["Choose type","Select cards","Configure","Finish"]:["Choose type","Configure","Finish"]:[],ae=a!=null&&a.createdControlId?`[[param.${a.createdControlId}]]`:a?`[[param.${e.slugifyControlValue(a.control.label)||a.control.id}]]`:"";return t.jsxs("div",{className:"space-y-4",children:[a?t.jsxs("div",{className:"space-y-4 pb-1",children:[t.jsx(je,{currentStep:a.step,labels:me}),a.step===1&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium",children:"What kind of input should viewers see?"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose the viewer experience first. You can fine-tune the details next."}),l==="card"&&(y==null?void 0:y.sql)==null?t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Explorer cards support displayed metric, group by field, aggregation, and time grain controls here."}):null]}),t.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:T.map(s=>t.jsxs("button",{type:"button",className:"rounded-xl border border-border/50 bg-muted/20 p-3 text-left transition-colors hover:border-border/70 hover:bg-muted/35",onClick:()=>N(Ne({scope:l,existingControls:r,reservedIds:Array.from(D),type:s.value})),children:[t.jsx("div",{className:"text-sm font-medium",children:s.label}),t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s.description})]},s.value))}),t.jsx(R,{secondary:t.jsx(e.Button,{type:"button",variant:"outline",onClick:X,children:"Back to controls"})})]}),a.step===2&&E(a.control.type)&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"space-y-3",children:[t.jsx(oe,{control:a.control,onChange:s=>Q(c=>({...c,label:s}))}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose which cards should respond to this shared control."})]}),F.length===0?t.jsx("div",{className:"rounded-xl bg-muted/20 p-3 text-xs text-muted-foreground",children:"No eligible cards are available yet. Add compatible metrics or group-by fields to cards first."}):t.jsx("div",{className:"space-y-2 rounded-xl bg-muted/20 p-3",children:F.map(s=>{const c=(a.selectedCardIds||[]).includes(s.cardId);return t.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[t.jsx(e.Checkbox,{checked:c,onCheckedChange:o=>N(g=>g&&{...g,selectedCardIds:o===!0?[...g.selectedCardIds||[],s.cardId]:(g.selectedCardIds||[]).filter(S=>S!==s.cardId)})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-medium",children:s.title}),t.jsx("div",{className:"text-xs text-muted-foreground",children:a.control.type==="field_selector"?`${s.fieldChoices.length} compatible group-by fields`:`${s.metricChoices.length} compatible metrics`})]})]},s.cardId)})}),t.jsx(R,{secondary:t.jsx(e.Button,{type:"button",variant:"outline",onClick:()=>N(s=>s&&{...s,step:1,selectedCardIds:[]}),children:"Back"}),primary:t.jsx(e.Button,{type:"button",onClick:()=>N(s=>s&&{...s,step:3}),disabled:!H,children:"Next"})})]}),a.step===2&&!E(a.control.type)&&t.jsx(re,{control:a.control,defaultValue:a.defaultValue,availableFieldChoices:V.fields,availableMetricChoices:V.metrics,onControlChange:s=>Q(()=>s),onLabelChange:s=>Q(c=>({...c,label:s})),onDefaultValueChange:ee,onBack:()=>N(s=>s&&{...s,step:1}),onNext:te,nextDisabled:!H}),a.step===3&&E(a.control.type)&&t.jsx(re,{control:a.control,defaultValue:a.defaultValue,availableFieldChoices:V.fields,availableMetricChoices:V.metrics,onControlChange:s=>Q(()=>s),onLabelChange:s=>Q(c=>({...c,label:s})),onDefaultValueChange:ee,onBack:()=>N(s=>s&&{...s,step:2}),onNext:te,nextDisabled:!H}),a.step===3&&!E(a.control.type)&&t.jsx(ne,{control:a.control,scope:l,createdReference:ae,explorerContent:t.jsx($,{title:"Explorer cards",children:t.jsxs("p",{className:"text-sm",children:["Open the card and use"," ",t.jsx("span",{className:"font-medium",children:"Settings → Controls"})," ","to choose what this control changes."]})}),sqlDescription:"Reference this control directly in the SQL editor.",onBack:()=>N(s=>s&&{...s,step:2}),onCancel:X,onDone:se}),a.step===4&&E(a.control.type)&&t.jsx(ne,{control:a.control,scope:l,createdReference:ae,summaryDetail:t.jsxs(t.Fragment,{children:["Used by ",(a.selectedCardIds||[]).length," ","selected card",(a.selectedCardIds||[]).length===1?"":"s"]}),explorerContent:t.jsx($,{title:"Explorer cards",children:t.jsx("p",{className:"text-sm",children:"Selected cards have been set up to respond to this control automatically."})}),sqlDescription:"SQL cards can still reference this control directly in the SQL editor.",onBack:()=>N(s=>s&&{...s,step:3}),onCancel:X,onDone:se})]}):null,!a&&r.length===0?t.jsx("div",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:m}):null,!a&&r.map(s=>{const c=U(s),o=f==null?void 0:f[s.id],g=d&&Object.prototype.hasOwnProperty.call(d,s.id)?d[s.id]:s.defaultValue,S=P===s.id;return t.jsxs("div",{className:"rounded-md border",children:[t.jsxs("div",{className:"flex items-center gap-2 px-3 py-3",children:[t.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-start gap-2 text-left",onClick:()=>M(i=>i===s.id?null:s.id),children:[S?t.jsx(e.ChevronDown,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}):t.jsx(e.ChevronRight,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"truncate text-sm font-medium",children:s.label||"Untitled control"}),t.jsx(e.Badge,{variant:"outline",className:"text-[11px]",children:e.getFriendlyTypeOption(s.type).label}),t.jsx(e.Badge,{variant:"secondary",className:"text-[11px]",children:e.getPlacementLabel(l,s.placement)})]}),t.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[e.getControlOptionPreview(s),o!=null&&o.status?` · ${o.status}`:""]})]})]}),t.jsx(e.Button,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 shrink-0",onClick:()=>ue(s.id),"aria-label":`Remove ${s.label}`,children:t.jsx(e.Trash2,{className:"h-4 w-4"})})]}),S&&t.jsxs("div",{className:"space-y-4 border-t px-3 py-4",children:[o!=null&&o.helper?t.jsx("div",{className:"rounded-md bg-muted/30 px-3 py-2 text-xs text-muted-foreground",children:o.helper}):null,t.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(e.Label,{className:"text-xs",children:"Label"}),t.jsx(e.Input,{value:s.label,placeholder:"Control label",onChange:i=>L(s.id,k=>({...k,label:i.target.value}))})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(e.Label,{className:"text-xs",children:"Type"}),t.jsxs(e.Select,{value:s.type,onValueChange:i=>{const k=e.applyControlTypeChange({controls:r,controlId:s.id,nextType:i,defaultValues:d});I(k.controls,k.defaultValues)},children:[t.jsx(e.SelectTrigger,{children:t.jsx(e.SelectValue,{})}),t.jsx(e.SelectContent,{children:e.getFriendlyControlTypeOptions({scope:l,card:y,includeType:s.type}).map(i=>t.jsx(e.SelectItem,{value:i.value,children:i.label},i.value))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(e.Label,{className:"text-xs",children:"Show in"}),t.jsxs(e.Select,{value:s.placement||K,onValueChange:i=>L(s.id,k=>({...k,placement:i})),children:[t.jsx(e.SelectTrigger,{children:t.jsx(e.SelectValue,{})}),t.jsx(e.SelectContent,{children:Y.map(i=>t.jsx(e.SelectItem,{value:i.value,children:i.label},i.value))})]})]})]}),E(s.type)?t.jsx(e.StructuralParticipantSelector,{type:s.type,participants:e.getEligibleParticipantsForStructuralControl(b||[],s.type).map(i=>({cardId:i.cardId,title:i.title,choiceCount:s.type==="field_selector"?i.fieldChoices.length:i.metricChoices.length})),selectedCardIds:(h==null?void 0:h[s.id])||[],onChange:i=>{const k=_({control:s,nextSelectedCardIds:i}),w=r.map(A=>A.id===s.id?k.nextControl:A);I(w,d,{type:"update",cardBindingsById:k.cardBindingsById})}}):null,t.jsx(e.ControlDefinitionOptionsEditor,{control:s,availableFieldChoices:c.fields,availableMetricChoices:c.metrics,onChange:i=>L(s.id,()=>i)}),s.initialValueStrategy==="saved_default"&&t.jsx(e.ControlDefaultValueEditor,{control:s,value:g,allowNoDefault:!0,allowCardDefault:!0,onChange:i=>{if(d){const k={...d};i===void 0?delete k[s.id]:k[s.id]=i,I(r,k);return}L(s.id,k=>({...k,defaultValue:i}))}}),t.jsxs(e.Collapsible,{open:z===s.id,onOpenChange:i=>q(i?s.id:null),children:[t.jsx(e.CollapsibleTrigger,{asChild:!0,children:t.jsxs(e.Button,{type:"button",variant:"ghost",className:"h-auto px-0 text-xs text-muted-foreground hover:bg-transparent",children:[z===s.id?t.jsx(e.ChevronDown,{className:"mr-1 h-4 w-4"}):t.jsx(e.ChevronRight,{className:"mr-1 h-4 w-4"}),"Advanced"]})}),t.jsxs(e.CollapsibleContent,{className:"space-y-3 pt-2",children:[t.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(e.Label,{className:"text-xs",children:"Control ID"}),t.jsx(e.ControlIdInput,{controlId:s.id,onCommit:i=>ce(s.id,i)},s.id)]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(e.Label,{className:"text-xs",children:"Initial value"}),t.jsxs(e.Select,{value:s.initialValueStrategy,onValueChange:i=>L(s.id,k=>({...k,initialValueStrategy:i})),children:[t.jsx(e.SelectTrigger,{children:t.jsx(e.SelectValue,{})}),t.jsx(e.SelectContent,{children:e.INITIAL_VALUE_STRATEGY_OPTIONS.map(i=>t.jsx(e.SelectItem,{value:i.value,children:i.label},i.value))})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:e.getInitialValueStrategyHint(s.initialValueStrategy)})]})]}),t.jsx(e.ControlVisibilitySettings,{control:s,onChange:i=>L(s.id,()=>i)})]})]})]})]},s.id)}),!a&&t.jsxs(e.Button,{type:"button",variant:"outline",size:"sm",onClick:pe,children:[t.jsx(e.Plus,{className:"mr-2 h-4 w-4"}),"Add control"]})]})}function Ee(l){const{open:r,onOpenChange:n,initialCreateFlowActive:d=!1}=l,u=r!==void 0,[m,x]=v.useState(!1),[f,p]=v.useState(d),C=u?r:m,b=v.useCallback(j=>{!j&&f||(u||x(j),j||p(!1),n==null||n(j))},[u,f,n]),h=v.useCallback(()=>{u||x(!1),p(!1),n==null||n(!1)},[u,n]);v.useEffect(()=>{C||p(!1)},[C]);const y=v.useCallback(j=>{f&&j.preventDefault()},[f]);return{forceClose:h,handleOpenChange:b,isCreateFlowActive:f,preventPassiveDismissDuringCreate:y,resolvedOpen:C,setIsCreateFlowActive:p}}exports.CircleX=xe;exports.ControlDefinitionListEditor=De;exports.EditorAcceptButton=ye;exports.EditorCancelButton=ve;exports.EditorClearButton=Ce;exports.Library=ie;exports.Link2=de;exports.Save=W;exports.VisualBadge=he;exports.VisualSaveAndApplyButton=ge;exports.VisualSaveButton=be;exports.useCreateFlowOverlayState=Ee;exports.useEffectiveEditorCardType=J;
|