react-semaphor 0.1.461 → 0.1.463
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/appearance-runtime/index.cjs +1 -0
- package/dist/appearance-runtime/index.js +5 -0
- package/dist/brand-studio/index.cjs +1 -1
- package/dist/brand-studio/index.js +1 -1
- package/dist/chunks/appearance-context-DVXt8qjW.js +126 -0
- package/dist/chunks/appearance-context-DhyjbQk1.cjs +1 -0
- package/dist/chunks/appearance-runtime-provider-BgNYdUYH.cjs +1 -0
- package/dist/chunks/appearance-runtime-provider-CjmE4gBY.js +81 -0
- package/dist/chunks/{dashboard-briefing-launcher-3owMxX5K.js → dashboard-briefing-launcher-Dcfh50rg.js} +1264 -1260
- package/dist/chunks/dashboard-briefing-launcher-Dyf9-SMG.cjs +26 -0
- package/dist/chunks/{dashboard-controls-B4GvjGr1.js → dashboard-controls-Cux9l7G3.js} +8 -6
- package/dist/chunks/{dashboard-controls-Bpm_xOXQ.cjs → dashboard-controls-Dk_4fD9Y.cjs} +1 -1
- package/dist/chunks/dashboard-json-6vY_UIQ9.cjs +1 -0
- package/dist/chunks/{dashboard-json-DzyxoBp-.js → dashboard-json-CLSh4K-P.js} +12 -10
- package/dist/chunks/{edit-dashboard-visual-1T278Nr_.cjs → edit-dashboard-visual-BNNbxMoA.cjs} +28 -28
- package/dist/chunks/{edit-dashboard-visual-nwSasO_j.js → edit-dashboard-visual-WYIa0u5O.js} +854 -852
- package/dist/chunks/{editor-action-buttons-CX1Pken3.cjs → editor-action-buttons-B1QYcu9f.cjs} +1 -1
- package/dist/chunks/{editor-action-buttons-Dqw0asfA.js → editor-action-buttons-DfKOZoQs.js} +2 -2
- package/dist/chunks/{index-B1qplNxl.cjs → index-BnsIn34X.cjs} +183 -183
- package/dist/chunks/{index-DazD5k0F.js → index-BxQ_lHnZ.js} +28144 -28185
- package/dist/chunks/{report-preferences-dialog-DKPyjiCt.cjs → report-preferences-dialog-Cd7yCULW.cjs} +1 -1
- package/dist/chunks/{report-preferences-dialog-Dv3vCCFt.js → report-preferences-dialog-jy8Ck1pK.js} +2 -2
- package/dist/chunks/{switch-DBZsEV0U.cjs → switch-CNqDn5b8.cjs} +26 -26
- package/dist/chunks/{switch-kPUJEC1A.js → switch-G_-UwdXX.js} +2721 -2842
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +152 -150
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/appearance-runtime.d.ts +151 -0
- package/package.json +8 -2
- package/dist/chunks/dashboard-briefing-launcher-xuGrw8H3.cjs +0 -26
- package/dist/chunks/dashboard-json-yLM01xK4.cjs +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),p=require("react"),s=require("./index-BnsIn34X.cjs"),n=require("./switch-CNqDn5b8.cjs"),Ce=require("./layout-grid-xm8pqtx0.cjs"),K=require("./x-B6ghREd2.cjs"),V=require("./editor-action-buttons-B1QYcu9f.cjs"),we=require("./saved-temporal-bucket-format-3QKveR3v.cjs");require("./validators-dJlwubP4.cjs");require("./analyze-result-contract-DSGoFuXQ.cjs");require("../value-format-preferences/index.cjs");const Ue=require("./search-BqqhaMx9.cjs"),Oe=require("./mouse-pointer-2-DX4A_XZw.cjs"),Ne=require("./pivot-header-presentation-BijPbP33.cjs");require("./appearance-runtime-provider-BgNYdUYH.cjs");require("./appearance-context-DhyjbQk1.cjs");require("./index-ByFbacH7.cjs");require("./temporal-bucket-authoring-BK1UhYpD.cjs");require("./color-CyB5o13F.cjs");require("react-dom");const X=require("./index-DjjKJPDy.cjs");/**
|
|
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 _e=K.createLucideIcon("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
|
|
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 ze=K.createLucideIcon("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/**
|
|
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 $e=K.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"}]]);/**
|
|
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 De=K.createLucideIcon("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
|
|
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 qe=K.createLucideIcon("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);function He(){return e.jsx("div",{className:"space-y-1.5 py-1",children:[...Array(5)].map((t,r)=>e.jsxs("div",{className:"flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",children:[e.jsx("div",{className:"mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"h-4 w-3/5 rounded bg-muted/60"}),e.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40"})]})]},r))})}function We({open:t,onOpenChange:r,onSubmit:i,isCreating:a}){const l=s.useSurfaceAppearance("interactive"),[o,u]=p.useState(""),[f,c]=p.useState("");p.useEffect(()=>{t||(u(""),c(""))},[t]);const h=()=>{o.trim()&&i({title:o,description:f})},d=x=>{r(x)};return e.jsx(s.Dialog,{open:t,onOpenChange:d,children:e.jsxs(s.DialogContent,{showCloseButton:!1,className:"flex max-w-lg grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",style:l.dialogStyle,children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(Ce.LayoutGrid,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx(s.DialogTitle,{className:"truncate text-[13px] font-medium leading-none tracking-normal",children:"New library visual"}),e.jsx("span",{className:"shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground",children:"Visual"})]})]}),e.jsx(n.Button,{size:"xs",variant:"ghost",className:"w-7 px-0 text-muted-foreground hover:text-foreground",onClick:()=>d(!1),"aria-label":"Close",disabled:a,children:e.jsx(K.X,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"space-y-3 px-4 py-3",children:[e.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Create a saved visual that can be reused across dashboards."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n.Label,{htmlFor:"visual-title",className:"text-[12px]",children:"Name"}),e.jsx(n.Input,{id:"visual-title",size:"sm",placeholder:"Untitled visual",value:o,onChange:x=>u(x.target.value),disabled:a,onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),h())}})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(n.Label,{htmlFor:"visual-description",className:"text-[12px]",children:"Description"}),e.jsx(n.Input,{id:"visual-description",size:"sm",placeholder:"Optional",value:f,onChange:x=>c(x.target.value),disabled:a})]})]}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5",children:[e.jsx(n.Button,{size:"xs",variant:"outline",onClick:()=>d(!1),disabled:a,children:"Cancel"}),e.jsx(n.Button,{size:"xs",onClick:h,disabled:!o.trim()||a,children:a?e.jsxs(e.Fragment,{children:[e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Creating..."]}):"Create library visual"})]})]})})}function Ae(t){return t?new Date(t).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"Unknown"}function ke(t,r){var a;const i=(a=t.ownership.createdBy)==null?void 0:a.type;return i==="tenant"||i==="organization"&&r}function ye(t,r){var i,a;return ke(t,r)?((i=t.ownership.createdBy)==null?void 0:i.name)||((a=t.createdByTenantUserRel)==null?void 0:a.name)||t.lastModifiedBy||"Unknown":"Organization"}function Ge(t,r){return ye(t,r).split(/\s+/).filter(Boolean).slice(0,2).map(a=>a.charAt(0).toUpperCase()).join("")||"?"}function Xe(t){const r=(t||"").toLowerCase();return r.includes("table")?n.Table2:r.includes("pie")||r.includes("donut")?s.ChartPie:r.includes("line")?s.ChartLine:r.includes("bar")?n.ChartColumn:Ce.LayoutGrid}function Ke({visual:t}){const r=t.ownership.status==="public"?"Public":t.ownership.status==="shared"||t.ownership.sharedCount>0?"Shared":"Private";return e.jsx("span",{className:"inline-flex items-center rounded-[4px] border border-border/60 px-1.5 py-px text-[11px] text-muted-foreground",children:r})}function Qe({open:t,onOpenChange:r}){const i=s.useSurfaceAppearance("interactive"),[a,l]=p.useState(""),[o,u]=p.useState(new Set),[f,c]=p.useState(!1),[h,d]=p.useState(null),[x,m]=p.useState(null),[g,j]=p.useState(!1),[w,D]=p.useState(null),[B,E]=p.useState(null),v=()=>{u(new Set),d(null),m(null),j(!1),D(null)},S=()=>{r(!1),v()},{selectVisual:k}=s.useManagementActions(),{handleAddLibraryVisual:T,handleEditLibraryVisual:b}=V.useVisualUtils(),{isConsoleMode:C}=s.useDashboardPreferences(),{resources:L,isLoading:I,isError:$,createResource:A,updateResource:M,deleteResourceAsync:_,duplicateResource:oe,isCreating:Q,isDeleting:J}=s.useVisualManagement(void 0,y=>{c(!1),y&&(k(y),b(y),S())}),{startUpdating:he,stopUpdating:me,isUpdating:ee}=s.useResourceUpdateState(),z=L,W=p.useMemo(()=>{const y=a.trim().toLowerCase();return y?z.filter(F=>{var R,Y,se;return((R=F.title)==null?void 0:R.toLowerCase().includes(y))||((Y=F.description)==null?void 0:Y.toLowerCase().includes(y))||((se=F.kind)==null?void 0:se.toLowerCase().includes(y))}):z},[a,z]),te=p.useMemo(()=>z.filter(y=>o.has(y.id)),[o,z]),G=te.filter(y=>y.permissions.canDelete),xe=te.filter(y=>y.permissions.canShare),ie=W.length>0&&W.every(y=>o.has(y.id)),re=W.some(y=>o.has(y.id)),ne=y=>{const F=new Set(o);y(F),u(F)},H=y=>{ne(F=>{F.has(y)?F.delete(y):F.add(y)})},le=()=>{u(y=>{const F=new Set(y);return ie?W.forEach(R=>F.delete(R.id)):W.forEach(R=>F.add(R.id)),F})},U=async y=>{(await T(y)).success&&S()},O=async()=>{const y=te;if(y.length===0)return;let F=!1;for(const R of y)if(!(await T(R)).success){F=!0;break}F||S()},Z=y=>{b(y),S()},ae=y=>{E(y),oe(y,{onSettled:()=>E(null)})},pe=()=>{if(G.length===0){s.ue.error("Select a visual you can delete");return}D(null),j(!0)},ve=async()=>{const y=w?[w]:G;try{for(const F of y)await _(F.id);u(F=>{const R=new Set(F);return y.forEach(Y=>R.delete(Y.id)),R}),j(!1),D(null)}catch{}},ce=()=>{if(te.length!==1){s.ue.error("Select one visual to share");return}const[y]=te;if(!y.permissions.canShare){s.ue.error("You do not have permission to share this visual");return}d(y)},de=({title:y,description:F})=>{if(!x)return;const R={};if(y!==x.title&&(R.title=y),(x.description||"")!==F&&(R.description=F),Object.keys(R).length===0){m(null);return}const Y=Object.keys(R),se=Y.length===1?Y[0]:void 0;he(x.id,se),M({resourceId:x.id,data:R},{onSuccess:()=>{me(x.id,se),m(null)},onError:()=>{me(x.id,se)}})},q=y=>{r(y),y||v()},ue=w?1:G.length;return e.jsxs(e.Fragment,{children:[e.jsx(s.Dialog,{open:t,onOpenChange:q,children:e.jsxs(s.DialogContent,{showCloseButton:!1,className:"flex max-h-[80vh] w-[min(72rem,calc(100vw-2rem))] max-w-none grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",style:i.dialogStyle,children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(n.Table2,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx(s.DialogTitle,{className:"truncate text-[13px] font-medium leading-none tracking-normal",children:"Visuals library"}),e.jsx("span",{className:"shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground",children:"Add to dashboard"})]})]}),e.jsx(n.Button,{size:"xs",variant:"ghost",className:"w-7 px-0 text-muted-foreground hover:text-foreground",onClick:()=>q(!1),"aria-label":"Close visuals library",children:"×"})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-3 py-2",children:[e.jsxs("div",{className:"relative min-w-[12rem] flex-1 md:max-w-md",children:[e.jsx(Ue.Search,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx("input",{autoFocus:!0,value:a,onChange:y=>l(y.target.value),placeholder:"Search visuals...",className:"h-7 w-full rounded-control border border-input bg-background pl-7 pr-2 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none","aria-label":"Search visuals"})]}),e.jsxs(n.Button,{size:"xs",variant:"outline",className:"ml-auto",onClick:()=>c(!0),children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"New library visual"]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:I?e.jsx("div",{className:"p-3",children:e.jsx(He,{})}):$?e.jsx("div",{className:"flex flex-col items-center gap-2 px-4 py-12 text-center",children:e.jsx("p",{className:"text-[13px] text-destructive",children:"Failed to load visuals"})}):W.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-12 text-center",children:[e.jsx(Ce.LayoutGrid,{className:"h-5 w-5 text-muted-foreground/60"}),e.jsx("p",{className:"text-[13px] font-medium",children:a?"No visuals found":"No visuals yet"}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:a?"Try a different search.":"Create a saved visual to add it here."})]}):e.jsx(Ye,{visuals:W,selectedIds:o,allFilteredSelected:ie,someFilteredSelected:re,onSelectAll:le,onToggleSelection:H,onAddVisual:U,onOpenVisual:Z,onEditDetails:m,onShareVisual:d,onDeleteVisual:y=>{D(y),j(!0)},onDuplicateVisual:ae,duplicatingId:B,isDeleting:J,isConsoleMode:C})}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-1.5",children:o.size>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"font-medium tabular-nums text-foreground",children:o.size})," ","selected"]}),e.jsx(n.Button,{size:"xs",variant:"ghost",onClick:()=>u(new Set),children:"Clear"}),e.jsxs(n.Button,{size:"xs",variant:"outline",onClick:ce,disabled:te.length!==1||xe.length!==1,children:[e.jsx(s.Share2,{className:"h-3.5 w-3.5"}),"Share"]}),e.jsxs(n.Button,{size:"xs",variant:"outline",className:"text-destructive hover:text-destructive",onClick:pe,disabled:G.length===0,children:[e.jsx(s.Trash2,{className:"h-3.5 w-3.5"}),"Delete ",G.length||o.size]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n.Button,{size:"xs",variant:"outline",onClick:()=>q(!1),children:"Close"}),e.jsxs(n.Button,{size:"xs",onClick:O,disabled:o.size===0,children:[e.jsx(n.Check,{className:"h-3.5 w-3.5"}),o.size===0?"Add to dashboard":`Add ${o.size} visual${o.size===1?"":"s"}`]})]})]})]})}),e.jsx(We,{open:f,onOpenChange:c,onSubmit:A,isCreating:Q}),h&&e.jsx(s.ShareDialog,{resource:h,resourceType:s.ResourceType.VISUAL,onClose:()=>d(null)}),x&&e.jsx(s.ResourceEditDialog,{open:!!x,resourceLabel:"Visual",initialTitle:x.title||"",initialDescription:x.description||"",onClose:()=>m(null),onSave:de,isSaving:ee(x.id)}),e.jsx(s.AlertDialog,{open:g,onOpenChange:y=>{!y&&J||(j(y),y||D(null))},children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsxs(s.AlertDialogTitle,{children:["Delete ",ue," visual",ue===1?"":"s","?"]}),e.jsx(s.AlertDialogDescription,{children:"This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately."})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{disabled:J,children:"Cancel"}),e.jsxs(s.AlertDialogAction,{onClick:y=>{y.preventDefault(),ve()},disabled:J||ue===0,children:[J?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(s.Trash2,{className:"h-3.5 w-3.5"}),J?"Deleting...":"Delete"]})]})]})})]})}function Ye({visuals:t,selectedIds:r,allFilteredSelected:i,someFilteredSelected:a,onSelectAll:l,onToggleSelection:o,onAddVisual:u,onOpenVisual:f,onEditDetails:c,onShareVisual:h,onDeleteVisual:d,onDuplicateVisual:x,duplicatingId:m,isDeleting:g,isConsoleMode:j}){return e.jsxs("div",{className:"min-w-[48rem]",children:[e.jsxs("div",{className:"grid h-9 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/60 px-3 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:[e.jsx(s.Checkbox,{checked:i?!0:a?"indeterminate":!1,onCheckedChange:l,"aria-label":"Select all visuals"}),e.jsx("span",{children:"Name"}),e.jsx("span",{children:"Created by"}),e.jsx("span",{children:"Updated"}),e.jsx("span",{children:"Visibility"}),e.jsx("span",{className:"text-right",children:"Shared"}),e.jsx("span",{className:"text-right",children:"Actions"})]}),t.map(w=>e.jsx(Ze,{visual:w,selected:r.has(w.id),onToggleSelection:o,onAddVisual:u,onOpenVisual:f,onEditDetails:c,onShareVisual:h,onDeleteVisual:d,onDuplicateVisual:x,duplicatingId:m,isDeleting:g,isConsoleMode:j},w.id))]})}function Ze({visual:t,selected:r,onToggleSelection:i,onAddVisual:a,onOpenVisual:l,onEditDetails:o,onShareVisual:u,onDeleteVisual:f,onDuplicateVisual:c,duplicatingId:h,isDeleting:d,isConsoleMode:x}){var j;const m=Xe(t.kind),g=()=>{a(t)};return e.jsxs("div",{className:n.cn("group grid min-h-12 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/50 px-3 text-[13px] hover:bg-muted/50",r&&"bg-muted/70"),children:[e.jsx("div",{children:e.jsx(s.Checkbox,{checked:r,onCheckedChange:()=>i(t.id),"aria-label":`Select ${t.title||"visual"}`})}),e.jsxs("button",{type:"button",className:"flex min-w-0 items-center gap-2 rounded-[4px] text-left outline-none focus-visible:ring-1 focus-visible:ring-ring",onClick:g,"aria-label":`Add ${t.title||"visual"} to dashboard`,children:[e.jsx(m,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-medium text-foreground",title:t.title||"Untitled Visual",children:t.title||"Untitled Visual"}),((j=t.description)==null?void 0:j.trim())&&e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",title:t.description,children:t.description})]})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[9px] font-medium text-muted-foreground",children:Ge(t,x)}),e.jsx("span",{className:"truncate text-muted-foreground",children:ye(t,x)})]}),e.jsx("span",{className:"text-muted-foreground",children:Ae(t.updatedAt)}),e.jsx(Ke,{visual:t}),e.jsx("span",{className:"text-right tabular-nums text-muted-foreground",children:t.ownership.sharedCount>0?t.ownership.sharedCount:"—"}),e.jsx(Je,{visual:t,onOpenVisual:l,onEditDetails:o,onShareVisual:u,onDeleteVisual:f,onDuplicateVisual:c,duplicatingId:h,isDeleting:d,isConsoleMode:x})]})}function Je({visual:t,onOpenVisual:r,onEditDetails:i,onShareVisual:a,onDeleteVisual:l,onDuplicateVisual:o,duplicatingId:u,isDeleting:f,isConsoleMode:c}){return e.jsxs("div",{className:"flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",onClick:h=>h.stopPropagation(),children:[e.jsx(n.Button,{size:"xs",variant:"ghost",className:"w-7 px-0",onClick:()=>r(t),"aria-label":"Edit visual",children:e.jsx(s.PenLine,{className:"h-3.5 w-3.5"})}),e.jsxs(s.DropdownMenu,{modal:!1,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(n.Button,{size:"xs",variant:"ghost",className:"w-7 px-0","aria-label":"More actions",children:e.jsx(s.Ellipsis,{className:"h-3.5 w-3.5"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",children:[e.jsxs(s.DropdownMenuItem,{onClick:()=>r(t),children:[e.jsx(s.PenLine,{className:"h-3.5 w-3.5"}),"Edit visual"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>o(t.id),disabled:u===t.id,children:[u===t.id?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(s.Copy,{className:"h-3.5 w-3.5"}),u===t.id?"Duplicating...":"Duplicate"]}),t.permissions.canEdit&&e.jsxs(s.DropdownMenuItem,{onClick:()=>i(t),children:[e.jsx(s.PenLine,{className:"h-3.5 w-3.5"}),"Edit details"]}),t.permissions.canShare&&e.jsxs(s.DropdownMenuItem,{onClick:()=>a(t),children:[e.jsx(s.Share2,{className:"h-3.5 w-3.5"}),"Share"]}),t.permissions.canDelete&&e.jsxs(e.Fragment,{children:[e.jsx(s.DropdownMenuSeparator,{}),e.jsxs(s.DropdownMenuItem,{className:"text-destructive focus:bg-destructive/10 focus:text-destructive",onClick:()=>l(t),disabled:f,children:[e.jsx(s.Trash2,{className:"h-3.5 w-3.5"}),f?"Deleting...":"Delete"]})]}),e.jsx(s.DropdownMenuSeparator,{}),e.jsxs("div",{className:"space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground",children:[ke(t,c)&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(s.User,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:ye(t,c)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(s.Calendar,{className:"h-3 w-3"}),e.jsx("span",{children:Ae(t.updatedAt)})]})]})]})]})]})}function et({open:t,onOpenChange:r,isLibraryVisual:i,currentVisualName:a,isSaving:l=!1,destinationMode:o="both",onConfirm:u}){const[f,c]=p.useState(i&&a?`Copy of ${a}`:a||""),[h,d]=p.useState("");p.useEffect(()=>{t&&(c(i&&a?`Copy of ${a}`:a||""),d(""))},[t,i,a]);const x=!!f.trim(),m=o==="local"?{saveToLibrary:!1,saveToCurrentDashboard:!0,badgeType:"local",description:"Creates a local copy on the current dashboard.",actionLabel:"Add to Dashboard (Local)"}:o==="library"?{saveToLibrary:!0,saveToCurrentDashboard:!1,badgeType:"library",description:"Creates a reusable visual in Visual Library.",actionLabel:"Save as Library Visual"}:{saveToLibrary:!0,saveToCurrentDashboard:!0,badgeType:"linked",description:"Creates a new library visual and adds a linked copy to this dashboard.",actionLabel:"Save Copy as Linked Visual"},g=()=>{!x||l||u({name:f.trim(),description:h.trim()||void 0,saveToLibrary:m.saveToLibrary,saveToCurrentDashboard:m.saveToCurrentDashboard})};return e.jsx(s.Dialog,{open:t,onOpenChange:r,children:e.jsxs(s.DialogContent,{className:"sm:max-w-[500px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx("span",{children:"Save Visual As"}),m.badgeType!=="local"&&e.jsx(V.VisualBadge,{type:m.badgeType,showLabel:!0,className:"px-2 py-0.5"})]}),e.jsx(s.DialogDescription,{children:m.description})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(n.Label,{htmlFor:"name",children:"Name"}),e.jsx(n.Input,{id:"name",value:f,onChange:j=>c(j.target.value),placeholder:"Enter visual name",disabled:l})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(n.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(s.Textarea,{id:"description",value:h,onChange:j=>d(j.target.value),placeholder:"Enter visual description",rows:3,disabled:l})]})]}),e.jsxs(s.DialogFooter,{children:[e.jsx(n.Button,{variant:"outline",onClick:()=>r(!1),disabled:l,children:"Cancel"}),e.jsxs(n.Button,{onClick:g,disabled:!x||l,children:[l&&e.jsx(n.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),m.actionLabel]})]})]})})}function tt(){const[t,r]=p.useState(!1),[i,a]=p.useState(!1),[l,o]=p.useState(null),[u,f]=p.useState(null),c=n.useEditorStore(b=>b.frame),h=n.useEditorStore(b=>b.card),d=s.useSelectedVisual(),x=n.useDashboardStore(b=>b.selectedSheetId),m=n.useDashboardStore(b=>b.dashboard),{getUpdatedFrame:g}=V.useVisualUtils(),{selectVisual:j}=s.useManagementActions(),{addFrame:w,setSelectedFrameId:D,setIsVisualEditing:B}=n.useDashboardActions(),E=s.useResolveExistingFrameSemanticExecutionPayload(),v=!!(c!=null&&c.visualId),S=(()=>{var b,C;return((b=c==null?void 0:c.cards)==null?void 0:b.length)===1&&((C=c.cards[0])!=null&&C.title)?c.cards[0].title:d!=null&&d.title?d.title:(h==null?void 0:h.title)||"Untitled Visual"})(),k=s.useCreateVisualWithFrame(b=>{b!=null&&b.id&&(j(b),i&&l&&u&&x&&(async()=>{try{const C={...l,id:we.v4(),visualId:b.id};w(x,C,{position:"end",semanticExecutionPayload:u}),D(C.id),a(!1),o(null),f(null),B(!1)}catch(C){console.error("Failed to promote semantic metadata for saved visual:",C),s.ue.error(C instanceof Error?C.message:"Failed to prepare semantic metadata for the saved visual")}})(),r(!1))});return{saveAsDialogOpen:t,setSaveAsDialogOpen:r,handleSaveAs:async b=>{if(!x){s.ue.error("No sheet selected");return}const C=g(),L=n.getDynamicFrameSaveIssue(C);if(L){s.ue.error(L);return}const $=C.cards.length===1?{...C,cards:C.cards.map(A=>({...A,title:b.name}))}:C;if(b.saveToLibrary){let A=null;if(b.saveToCurrentDashboard)try{A=await E($,{previousFrame:n.findDashboardFrameById(m,$.id)})}catch(_){console.error("Failed to prepare semantic metadata before saving visual:",_),s.ue.error(_ instanceof Error?_.message:"Failed to prepare semantic metadata for the saved visual");return}a(b.saveToCurrentDashboard),o($),f(A);const M={title:b.name,description:b.description,frameObject:$,isPrivate:!1};k.mutate(M)}else if(b.saveToCurrentDashboard){const A={...$,id:we.v4(),visualId:void 0};try{const M=await E($,{previousFrame:n.findDashboardFrameById(m,$.id)});w(x,A,{position:"end",semanticExecutionPayload:M}),D(A.id),s.ue.success("Visual saved to dashboard"),r(!1),B(!1)}catch(M){console.error("Failed to save visual to dashboard:",M),s.ue.error(M instanceof Error?M.message:"Failed to prepare semantic metadata for the visual")}}},isLibraryVisual:v,currentVisualName:S,isSaving:k.isPending}}function st(t={}){const{isInspectionMode:r}=s.useDashboardInteractionMode(),i=n.useEditorStore(A=>A.frame),a=n.useEditorStore(A=>A.editorContext),l=s.useManagementStore(A=>A.selectedVisual),o=n.useDashboardStore(A=>A.selectedFrameId),u=n.useDashboardStore(A=>A.selectedSheetId),f=n.useDashboardStore(A=>A.dashboard),{setIsVisualEditing:c,updateFrame:h}=n.useDashboardActions(),[d,x]=p.useState(!1),[m,g]=p.useState("both"),j=s.useResolveExistingFrameSemanticExecutionPayload(),w=(a==null?void 0:a.type)==="documentSection",D=!!(i!=null&&i.visualId||l!=null&&l.id),B=!!(i!=null&&i.visualId&&o),E=D&&!B,{saveAsDialogOpen:v,setSaveAsDialogOpen:S,handleSaveAs:k,isLibraryVisual:T,currentVisualName:b,isSaving:C}=tt(),{getUpdatedFrame:L}=V.useVisualUtils();if(r)return e.jsxs(e.Fragment,{children:[e.jsx(V.EditorAcceptButton,{className:"rounded-control",variant:"default"}),e.jsx(V.EditorCancelButton,{})]});if(w)return e.jsxs(e.Fragment,{children:[e.jsx(V.EditorAcceptButton,{className:"rounded-control",variant:"default"}),e.jsx(V.EditorCancelButton,{})]});const I=async()=>{if(!u){s.ue.error("No sheet selected");return}if(d)return;x(!0);const A=L(),M=n.getDynamicFrameSaveIssue(A);if(M){x(!1),s.ue.error(M);return}const _={...A,visualId:void 0},oe=n.findDashboardFrameById(f,_.id);try{const Q=await j(_,{previousFrame:oe});h(u,_,{semanticExecutionPayload:Q})}catch(Q){console.error("Failed to apply local semantic metadata:",Q),x(!1),s.ue.error(Q instanceof Error?Q.message:"Failed to prepare semantic metadata for this visual");return}setTimeout(()=>{x(!1),s.ue.success("Changes applied. Visual is now local to this dashboard"),c(!1)},300)},$=A=>{g(A),S(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"inline-flex items-center overflow-hidden rounded-control",children:[!D&&e.jsx(V.EditorAcceptButton,{className:"!rounded-none",variant:"default"}),D&&E&&e.jsx(V.VisualSaveButton,{className:"!rounded-none",variant:"default"}),D&&B&&e.jsx(V.VisualSaveAndApplyButton,{className:"!rounded-none"}),e.jsxs(s.DropdownMenu,{modal:!1,children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx(n.Button,{variant:"default",size:"xs",className:"w-7 !rounded-none border-l border-primary-foreground/20 px-0","aria-label":"Open visual save options",disabled:C||d,children:e.jsx(K.ChevronDown,{className:"h-3.5 w-3.5"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",children:[B&&e.jsxs(e.Fragment,{children:[e.jsxs(s.DropdownMenuItem,{onClick:I,disabled:d,children:[e.jsx(n.Check,{className:"h-3.5 w-3.5"}),d?"Applying...":"Apply Locally"]}),e.jsx(s.DropdownMenuSeparator,{})]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>$("local"),disabled:C,children:[e.jsx(s.Plus,{className:"h-3.5 w-3.5"}),"Add to Dashboard (Local)"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>$("library"),disabled:C,children:[e.jsx(V.Library,{className:"h-3.5 w-3.5"}),"Save as Library Visual"]}),e.jsxs(s.DropdownMenuItem,{onClick:()=>$("both"),disabled:C,children:[e.jsx(V.Link2,{className:"h-3.5 w-3.5"}),"Save Copy as Linked Visual"]})]})]})]}),e.jsx(V.EditorCancelButton,{}),e.jsx(et,{open:v,onOpenChange:A=>{C||S(A)},isLibraryVisual:T,currentVisualName:b,isSaving:C,destinationMode:m,onConfirm:k})]})}function rt({className:t}){const r=n.useEditorStore(h=>h.isDevMode),i=n.useDashboardStore(h=>h.isVisualEditing),{setIsDevMode:a}=n.useEditorActions(),{config:l}=p.useContext(s.SemaphorContext).tokenProps,o=(l==null?void 0:l.showAdvancedMode)!==!1;if(!i||!o)return null;const u=r?Oe.MousePointer2:s.CodeXml,f=r?"Visual editor":"SQL editor",c=r?"Switch to visual editor":"Switch to SQL editor";return e.jsxs("button",{type:"button","aria-label":c,title:c,onClick:()=>a(!r),className:n.cn("inline-flex h-7 items-center gap-1.5 rounded-control border border-input bg-background px-2 text-[12px] font-medium text-foreground transition-colors hover:bg-muted/40 focus-visible:border-ring focus-visible:outline-none",t),children:[e.jsx(u,{className:"h-3 w-3 text-muted-foreground"}),f]})}function nt({open:t,onOpenChange:r,onSave:i,onDiscard:a,isSaving:l,title:o="Unsaved changes",description:u="You have unsaved changes to this dashboard. What would you like to do?",cancelLabel:f="Cancel",discardLabel:c="Discard",saveLabel:h="Save"}){const d=x=>{!x&&l||r(x)};return e.jsx(s.AlertDialog,{open:t,onOpenChange:d,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:o}),e.jsx(s.AlertDialogDescription,{children:u})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(n.Button,{type:"button",size:"xs",onClick:a,disabled:l,variant:"ghost",className:"mr-auto text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",children:c}),e.jsx(s.AlertDialogCancel,{disabled:l,children:f}),e.jsx(n.Button,{type:"button",size:"xs",onClick:i,disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx(n.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):h})]})]})})}const at=1e4,ot=15e3,it=3e4,lt=3e4,ct=12e4,Se=2*60*60*1e3;function dt(t){const r=Date.now()-t.getTime();return r<lt?at:r<ct?ot:it}function ut(){const{authToken:t,tokenProps:r}=s.useSemaphorContext(),i=s.useExportStore(m=>m.activeExports),[a,l]=p.useState(typeof document<"u"?!document.hidden:!0),o=p.useRef(null),u=p.useRef(!1),f=p.useRef(void 0),c=r==null?void 0:r.apiServiceUrl,h=t==null?void 0:t.accessToken,d=p.useCallback(()=>{const m=s.useExportStore.getState().activeExports;return Array.from(m.values()).filter(g=>s.isExportInProgress(g.status))},[]);p.useEffect(()=>{if(typeof document>"u")return;const m=()=>{l(!document.hidden)};return document.addEventListener("visibilitychange",m),()=>{document.removeEventListener("visibilitychange",m)}},[]);const x=p.useCallback(async()=>{if(!c||!h){u.current=!1;return}const m=d();if(m.length===0){u.current=!1;return}const g=Date.now(),j=m.filter(v=>g-v.startedAt.getTime()>Se);if(j.length>0){const{updateExport:v}=s.useExportStore.getState().actions;for(const S of j)v(S.id,{status:"failed",error:"Export timed out. Please try again or contact support.",lastUpdatedAt:new Date})}const w=m.filter(v=>g-v.startedAt.getTime()<=Se);if(w.length===0){u.current=!1;return}const D=await Promise.allSettled(w.map(async v=>{try{const S=await s.getExportStatus(c,h,v.id);let k;if(S.status==="completed")try{k=await s.getDownloadUrl(c,h,v.id)}catch(T){console.error(`[useExportPolling] Failed to get download URL for ${v.id}:`,T)}return{id:v.id,status:S.status,progress:S.progress,completedChunks:S.completedChunks,completedAt:S.completedAt?new Date(S.completedAt):void 0,lastUpdatedAt:new Date,fileSize:S.fileSize,error:S.error,downloadUrl:k}}catch(S){return console.error(`[useExportPolling] Failed to poll export ${v.id}:`,S),null}})),{updateExport:B}=s.useExportStore.getState().actions;for(const v of D)v.status==="fulfilled"&&v.value&&B(v.value.id,v.value);const E=d();if(E.length>0&&!document.hidden){const v=E.reduce((k,T)=>T.startedAt<k?T.startedAt:k,E[0].startedAt),S=dt(v);o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{var k;(k=f.current)==null||k.call(f)},S)}else u.current=!1},[c,h,d]);return p.useEffect(()=>{f.current=x},[x]),p.useEffect(()=>{var g;d().length>0&&a&&!u.current&&(u.current=!0,(g=f.current)==null||g.call(f))},[i,a,d]),p.useEffect(()=>{var g;const m=d();a&&m.length>0&&!u.current&&(u.current=!0,(g=f.current)==null||g.call(f))},[a,d]),p.useEffect(()=>{!a&&o.current&&(clearTimeout(o.current),o.current=null,u.current=!1)},[a]),p.useEffect(()=>()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]),{isPolling:u.current,isTabVisible:a,inProgressCount:d().length}}function ht(){const{authToken:t,tokenProps:r}=s.useSemaphorContext(),i=s.useExportStore(f=>f.activeExports),{addExport:a}=s.useExportActions(),l=p.useRef(!1),o=r==null?void 0:r.apiServiceUrl,u=t==null?void 0:t.accessToken;p.useEffect(()=>{if(l.current||!o||!u)return;(async()=>{try{const{exports:c}=await s.getExports(o,u,{status:["pending","processing","chunking","compacting","completed","failed"],limit:20});for(const h of c){if(i.has(h.id))continue;const d=h.totalChunks?Math.round(h.completedChunks/h.totalChunks*100):0;let x;if(h.status==="completed")try{x=await s.getDownloadUrl(o,u,h.id)}catch(g){console.error(`[useExportRecovery] Failed to get download URL for ${h.id}:`,g)}const m={id:h.id,status:h.status,progress:d,title:mt(h),totalRows:h.totalRows,totalChunks:h.totalChunks,completedChunks:h.completedChunks,startedAt:new Date(h.createdAt),lastUpdatedAt:new Date,completedAt:h.completedAt?new Date(h.completedAt):void 0,fileSize:h.fileSize,error:h.error,expiresAt:new Date(h.expiresAt),downloadUrl:x};a(m)}l.current=!0}catch(c){console.error("[useExportRecovery] Failed to recover exports:",c),l.current=!0}})()},[o,u,a,i])}function mt(t){return t.title?t.title:s.isExportInProgress(t.status)?"Export in progress...":t.status==="completed"?"Export completed":t.status==="failed"?"Export failed":"Export"}function Be({export:t,onRemove:r}){const i=()=>{t.downloadUrl&&window.open(t.downloadUrl,"_blank")},a=f=>{f.stopPropagation(),r==null||r(t.id)},l=()=>{switch(t.status){case"completed":return e.jsx(s.CircleCheck,{className:"mt-0.5 h-5 w-5 shrink-0 text-green-600"});case"failed":return e.jsx($e,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"});default:return e.jsx(n.LoaderCircle,{className:"text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin"})}},o=s.isExportInProgress(t.status),u=(()=>{switch(t.status){case"pending":return"Queued...";case"processing":return"Processing...";case"chunking":return"Processing...";case"compacting":return"Finalizing...";default:return"Processing..."}})();return e.jsxs("div",{className:"group p-4 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[l(),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"mb-1 truncate text-sm font-medium",children:t.title}),t.status==="completed"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[t.totalRows.toLocaleString()," rows"]}),t.fileSize&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:s.formatFileSize(t.fileSize)})]})]}),o&&e.jsx("div",{className:"text-xs text-muted-foreground",children:u}),t.status==="failed"&&e.jsx("div",{className:"line-clamp-2 text-xs text-destructive",children:t.error||"Export failed"})]})]}),e.jsx(n.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:a,"aria-label":"Remove notification",children:e.jsx(K.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"ml-8",children:[t.status==="completed"&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:Ne.formatDistanceToNow(t.startedAt,{addSuffix:!0})}),t.downloadUrl&&e.jsxs(n.Button,{size:"sm",variant:"outline",className:"h-8 bg-transparent",onClick:i,children:[e.jsx(s.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]})]}),o&&e.jsxs("div",{children:[e.jsx(s.Progress,{value:t.progress,className:"h-1.5"}),e.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[t.progress,"% complete"]})]}),t.status==="failed"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:Ne.formatDistanceToNow(t.startedAt,{addSuffix:!0})})]})]})}function Ie(){const{authToken:t,tokenProps:r}=s.useSemaphorContext(),i=s.useExportStore(w=>w.activeExports),{clearCompleted:a,removeExport:l,updateExport:o}=s.useExportActions(),[u,f]=p.useState(!1),[c,h]=p.useState(!1),d=Array.from(i.values()).sort((w,D)=>D.startedAt.getTime()-w.startedAt.getTime()),x=d.some(w=>w.status==="completed"||w.status==="failed"),m=p.useCallback(async()=>{const w=r==null?void 0:r.apiServiceUrl,D=t==null?void 0:t.accessToken;if(!(!w||!D)){f(!0);try{const B=Array.from(i.values());await Promise.all(B.map(async E=>{try{const v=await s.getExportStatus(w,D,E.id);let S;if(v.status==="completed")try{S=await s.getDownloadUrl(w,D,E.id)}catch(k){console.error(`Failed to get download URL for ${E.id}:`,k)}o(E.id,{status:v.status,progress:v.progress,completedChunks:v.completedChunks,completedAt:v.completedAt?new Date(v.completedAt):void 0,lastUpdatedAt:new Date,fileSize:v.fileSize,error:v.error,downloadUrl:S})}catch(v){console.error(`Failed to refresh export ${E.id}:`,v)}}))}finally{f(!1)}}},[i,t==null?void 0:t.accessToken,r==null?void 0:r.apiServiceUrl,o]),g=p.useCallback(async()=>{const w=r==null?void 0:r.apiServiceUrl,D=t==null?void 0:t.accessToken;if(!w||!D){a();return}h(!0);try{const B=d.filter(v=>v.status==="completed"||v.status==="failed"),E=await Promise.allSettled(B.map(async v=>(await s.cancelExport(w,D,v.id),v.id)));for(const v of E)v.status==="fulfilled"?l(v.value):console.error("Failed to delete export:",v.reason)}finally{h(!1)}},[d,r==null?void 0:r.apiServiceUrl,t==null?void 0:t.accessToken,a,l]),j=p.useCallback(async w=>{const D=r==null?void 0:r.apiServiceUrl,B=t==null?void 0:t.accessToken;if(D&&B)try{await s.cancelExport(D,B,w),l(w);return}catch(E){console.error(`Failed to cancel export ${w}:`,E)}l(w)},[r==null?void 0:r.apiServiceUrl,t==null?void 0:t.accessToken,l]);return d.length===0?e.jsxs("div",{className:"p-6 text-center",children:[e.jsx(De,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No active exports"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large exports will appear here"})]}):e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("h4",{className:"font-semibold",children:"Exports"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(n.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:m,disabled:u,title:"Refresh status",children:e.jsx(s.RefreshCw,{className:`h-4 w-4 ${u?"animate-spin":""}`})}),x&&e.jsx(n.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-sm",onClick:g,disabled:c,children:c?"Clearing...":"Clear all"})]})]}),e.jsx("div",{className:"max-h-[350px] overflow-y-auto",children:e.jsx("div",{className:"divide-y",children:d.map(w=>e.jsx(Be,{export:w,onRemove:j},w.id))})})]})}function xt({variant:t}){const r=s.useExportStore(c=>c.activeExports),i=s.useInProgressExportsCount(),a=r.size>0,l=Array.from(r.values()).some(c=>c.status==="completed"||c.status==="failed"),u=i>0?i>9?"9+":String(i):null,f=a;return e.jsxs(n.Popover,{children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:t??"ghost",size:"xs",className:"relative w-7 px-0 text-muted-foreground hover:text-foreground","aria-label":"Export notifications",children:[e.jsx(s.Bell,{className:"h-3.5 w-3.5"}),f&&e.jsx("span",{className:`absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${u?"-right-0.5 -top-0.5 h-3.5 min-w-3.5 px-0.5 text-[9px] font-semibold":"right-1 top-1 h-1.5 w-1.5"}`,children:u})]})}),e.jsx(n.PopoverContent,{className:"w-80 p-0",align:"end",sideOffset:8,children:e.jsx(Ie,{})})]})}function pt(t){if(t)return{renamed:t.type==="rename"?{oldId:t.oldId,newId:t.newId}:void 0,removedControlId:t.type==="remove"?t.controlId:void 0,cardBindingsById:t.type==="add"||t.type==="update"?t.cardBindingsById:void 0,affectedBindingControlIds:t.type==="add"||t.type==="update"?t.affectedBindingControlIds:void 0}}function Fe({open:t,onOpenChange:r,trigger:i,showTrigger:a=!0,initialMode:l="manage"}){const o=l==="create",{forceClose:u,handleOpenChange:f,isCreateFlowActive:c,preventPassiveDismissDuringCreate:h,resolvedOpen:d,setIsCreateFlowActive:x}=V.useCreateFlowOverlayState({open:t,onOpenChange:r,initialCreateFlowActive:l==="create",dismissMode:a?"passive":"explicit-only"}),m=n.useDashboardStore(C=>C.dashboard),{setDashboardControlsModel:g}=n.useDashboardActions(),{participants:j}=s.useDashboardStructuralParticipants(n.getDashboardCards(m)),w=Array.from(new Map(j.flatMap(C=>C.fieldChoices.map(L=>{var I;return[L.value,{option:L,target:(I=C.fieldTargetMap)==null?void 0:I[L.value]}]}))).values()),D=Array.from(new Map(j.flatMap(C=>C.metricChoices.map(L=>{var I;return[L.value,{option:L,target:(I=C.metricTargetMap)==null?void 0:I[L.value]}]}))).values()),B=n.collectDashboardControlIds({...m||{},controls:[]}),E=s.buildDashboardStructuralParticipantIdsByControlId(m),v=(C,L,I)=>{g(C,L,pt(I))},S=p.useCallback(()=>{if(o){u();return}x(!1)},[o,u,x]),k=e.jsx(V.ControlDefinitionListEditor,{scope:"dashboard",controls:m.controls||[],reservedControlIds:B,defaultValues:m.defaultControlValues||{},usageByControlId:s.buildDashboardControlUsageById(m),availableFieldChoices:w,availableMetricChoices:D,structuralParticipants:j,structuralParticipantIdsByControlId:E,initialCreateFlow:l==="create",onCreateFlowActiveChange:x,onCreateFlowComplete:S,onChange:v,emptyMessage:"No dashboard controls yet."}),T=c?"Add dashboard control":"Dashboard Controls",b=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h4",{className:"text-sm font-medium",children:"Dashboard Controls"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."})]}),k]});return a?e.jsxs(n.Popover,{open:d,onOpenChange:f,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:i||e.jsxs(n.Button,{variant:"outline",className:"h-7 px-2",size:"sm",children:[e.jsx(n.SlidersHorizontal,{className:"mr-2 h-4 w-4"}),"Controls"]})}),e.jsx(n.PopoverContent,{className:"w-[620px] max-w-[95vw] space-y-4",align:"end",onEscapeKeyDown:h,onPointerDownOutside:h,children:b})]}):e.jsx(s.Dialog,{open:d,onOpenChange:f,children:e.jsxs(s.DialogContent,{className:"flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",onEscapeKeyDown:h,onPointerDownOutside:h,children:[e.jsxs(s.DialogHeader,{className:c?"space-y-0":void 0,children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:T}),e.jsx(s.DialogDescription,{className:c?"sr-only":"text-[13px]",children:c?"Configure and add a shared dashboard control.":"Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."})]}),e.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:k})]})})}const ft=["enum","multi_enum","text","number","boolean","date"];function Le({open:t,onOpenChange:r,initialMode:i="manage"}){var b;const a=i==="create",{forceClose:l,handleOpenChange:o,isCreateFlowActive:u,preventPassiveDismissDuringCreate:f,resolvedOpen:c,setIsCreateFlowActive:h}=V.useCreateFlowOverlayState({open:t,onOpenChange:r,initialCreateFlowActive:i==="create",dismissMode:"explicit-only"}),d=n.useDashboardStore(C=>C.dashboard),x=n.useDashboardStore(C=>C.selectedSheetId),{setDashboardInputs:m}=n.useDashboardActions(),g=(b=d.sheets)==null?void 0:b.find(C=>C.id===x),j=(g==null?void 0:g.kind)==="document"&&!!g.document,w=p.useMemo(()=>j&&(g!=null&&g.document)?s.getDocumentSheetDashboardInputs(d,g.id):[],[d,j,g==null?void 0:g.document,g==null?void 0:g.id]),D=p.useMemo(()=>w.filter(C=>C.kind==="control"),[w]),B=p.useMemo(()=>D.map(C=>C.control),[D]),E=p.useMemo(()=>bt(B),[B]),v=p.useMemo(()=>gt(d),[d]),S=p.useCallback(()=>{if(a){l();return}h(!1)},[a,l,h]),k=p.useCallback((C,L,I)=>{!j||!(g!=null&&g.document)||m(jt({allInputs:d.inputs||[],documentSheetId:g.id,currentDocumentInputs:w,nextControls:C,nextDefaultValues:L,change:I}))},[d.inputs,w,j,g,m]);if(!j||!(g!=null&&g.document))return null;const T=u?"Add document control":"Document Controls";return e.jsx(s.Dialog,{open:c,onOpenChange:o,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:u?"space-y-0":void 0,children:[e.jsx(s.DialogTitle,{className:"text-[15px]",children:T}),e.jsx(s.DialogDescription,{className:u?"sr-only":"text-[13px]",children:u?"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(V.ControlDefinitionListEditor,{scope:"dashboard",controls:B,reservedControlIds:v,defaultValues:E,usageByControlId:{},availableFieldChoices:[],availableMetricChoices:[],structuralParticipants:[],structuralParticipantIdsByControlId:{},allowedControlTypes:ft,initialCreateFlow:i==="create",onCreateFlowActiveChange:h,onCreateFlowComplete:S,onChange:k,emptyMessage:"No document controls yet."})})]})})}function gt(t){return(t.controls||[]).map(r=>r.id)}function bt(t){const r={};for(const i of t)i.defaultValue!==void 0&&(r[i.id]=i.defaultValue);return r}function vt(t,r){return r?Object.prototype.hasOwnProperty.call(r,t.id)?{...t,defaultValue:r[t.id]}:t.defaultValue===void 0?t:{...t,defaultValue:void 0}:t.defaultValue===void 0?t:{...t,defaultValue:void 0}}function jt({allInputs:t,documentSheetId:r,currentDocumentInputs:i,nextControls:a,nextDefaultValues:l,change:o}){const u=new Map(a.map(m=>[m.id,vt(m,l)])),f=(o==null?void 0:o.type)==="rename"?{oldId:o.oldId,newId:o.newId}:null,c=new Set,h=[];for(const m of i){if(m.kind!=="control"){h.push(m);continue}const g=u.get(m.control.id)||((f==null?void 0:f.oldId)===m.control.id?u.get(f.newId):void 0);if(!g)continue;c.add(g.id);const j=n.createUniqueDashboardInputVariableNameFromName(g.id,[...t,...h].filter(D=>D.id!==m.id)),w=g.id===j?g:{...g,id:j};h.push({...m,label:w.label,variableName:j,requiredAtExecution:w.requiredAtExecution,control:w})}for(const m of u.values())c.has(m.id)||h.push(s.createDashboardControlInputFromControl({control:m,existingInputs:[...t,...h],sheetId:r}));const d=new Set(i.map(m=>m.id));return[...t.filter(m=>!d.has(m.id)),...h]}function Te({showFilters:t,onShowFiltersChange:r,pickerContent:i,settingsContent:a,size:l="default",className:o,primaryButtonClassName:u,secondaryButtonClassName:f,pickerContentClassName:c,settingsContentClassName:h}){const d=l==="toolbar",[x,m]=p.useState(!1),g=s.useSurfaceAppearance("interactive");return e.jsxs("div",{className:n.cn("relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",d?"h-8":"h-7",o),children:[e.jsxs(n.Popover,{open:t,onOpenChange:r,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsxs(n.Button,{variant:"ghost",size:"xs",className:n.cn("h-full rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",u),children:[t?e.jsx(V.FilterX,{className:"h-3.5 w-3.5"}):e.jsx(s.Filter,{className:"h-3.5 w-3.5"}),"Filter"]})}),e.jsx(n.PopoverContent,{align:"end",sideOffset:6,className:n.cn("w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",c),style:g.contentStyle,children:i})]}),e.jsxs(n.Popover,{open:x,onOpenChange:m,children:[e.jsx(n.PopoverTrigger,{asChild:!0,children:e.jsx(n.Button,{variant:"ghost",size:"xs",className:n.cn("h-full w-7 rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",f),"aria-label":"Filter and control actions",children:e.jsx(K.ChevronDown,{className:"h-3.5 w-3.5"})})}),e.jsx(n.PopoverContent,{align:"end",sideOffset:6,className:n.cn("w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",h),style:g.contentStyle,children:a(()=>m(!1))})]})]})}function Ct(){V.useSyncLegacyEditorState();const t=n.useDashboardStore(c=>c.selectedSheetId),r=n.useDashboardStore(c=>c.selectedFrameId),i=n.useDashboardStore(c=>c.dashboard),a=n.useDashboardStore(c=>c.actions.getSelectedFrame),{setSelectedFrameId:l}=n.useDashboardActions(),{setCard:o}=n.useEditorActions(),u=n.useEditorStore(c=>c.card.dataSource);return p.useEffect(()=>{var h,d;let c=a();if(!c){const x=(h=i==null?void 0:i.sheets)==null?void 0:h.find(g=>g.id===t),m=(d=x==null?void 0:x.frames)==null?void 0:d[0];m&&(l(m.id),c=m)}if(c){const x=c.cards.find(m=>m.id===c.activeCardId);x&&o(x)}},[a,t,r,i,l,o]),{hasEntities:!!(u!=null&&u.selectedEntities&&u.selectedEntities.length>0)}}function yt(){const t=n.useDashboardStore(c=>c.dashboard),r=n.useDashboardStore(c=>c.semanticExecutionPayload),i=n.useDashboardStore(c=>c.actions.addFilter),{hasEntities:a}=Ct(),{isLoading:l}=s.useFilterableFields(),o=p.useMemo(()=>n.getGlobalDateFilterCoverage(t,r),[t,r]),f=!n.getGlobalDateFilter(t.filters)&&o.hasEligibleCards&&!l;return e.jsxs("div",{className:"flex h-[520px] w-[400px] flex-col",children:[f&&e.jsx("div",{className:"border-b border-border/60 p-2",children:e.jsxs("button",{type:"button",onClick:()=>i(n.createDefaultGlobalDateFilter()),title:`Applies to ${o.eligibleCardCount} of ${o.totalCardCount} date-aware cards`,className:"flex w-full items-start gap-2 rounded-control px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border",children:[e.jsx(ze,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"text-[12px] font-medium text-foreground",children:"Add global date filter"}),e.jsx("span",{className:"text-[11px] leading-[1.4] text-muted-foreground",children:"One date range across all date-aware cards."})]})]})}),!a&&e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-8 text-center",children:[e.jsx(s.Database,{className:"mb-3 h-10 w-10 text-muted-foreground/50"}),e.jsx("h3",{className:"mb-1 text-[13px] font-medium text-foreground",children:"No fields configured"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Configure a data source for this card to enable filtering."})]}),a&&e.jsx("div",{className:"flex flex-1 overflow-hidden",children:e.jsx(s.FilterableFieldsPanel,{context:"filter"})})]})}const Ee=!1;function wt({onAddFilter:t,onAddControl:r,onManageControls:i,onDismiss:a}){const l=n.useDashboardStore(f=>f.dashboard.filterLayout),{setFilterLayout:o}=n.useDashboardActions();l!=null&&l.displayMode;const u=(l==null?void 0:l.toolbarWrap)??!1;return l==null||l.showDownloadButton,e.jsxs("div",{className:"w-[300px]",children:[e.jsxs("div",{className:"p-1",children:[e.jsx(je,{icon:s.Filter,label:"Add filter",onClick:()=>{t(),a()}}),e.jsx(je,{icon:n.SlidersHorizontal,label:"Add control",onClick:()=>{r(),a()}}),e.jsx(je,{icon:s.Pencil,label:"Manage controls",onClick:()=>{i(),a()}})]}),e.jsx("div",{className:"border-t border-border/60"}),e.jsxs("div",{className:"space-y-1 p-2",children:[e.jsx("p",{className:"px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Display"}),Ee,e.jsx(Nt,{id:"filter-display-wrap",label:"Wrap to multiple lines",checked:u,onCheckedChange:f=>o({toolbarWrap:f===!0})}),Ee]})]})}function je({icon:t,label:r,onClick:i}){return e.jsxs("button",{type:"button",onClick:i,className:"flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-[13px] text-foreground outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40",children:[e.jsx(t,{className:"h-3.5 w-3.5 text-muted-foreground"}),r]})}function Nt({id:t,label:r,checked:i,onCheckedChange:a}){return e.jsxs("div",{className:"flex items-center gap-2 rounded-control px-1 py-1 transition-colors hover:bg-muted/40 focus-within:bg-muted/40",children:[e.jsx(s.Checkbox,{id:t,checked:i,onCheckedChange:a}),e.jsx(n.Label,{htmlFor:t,className:"cursor-pointer text-[12px] font-normal leading-[1.3]",children:r})]})}function Dt({size:t,className:r,primaryButtonClassName:i,secondaryButtonClassName:a,pickerContentClassName:l,settingsContentClassName:o}){var T;const[u,f]=p.useState(null),c=n.useDashboardStore(b=>b.dashboard),h=n.useDashboardStore(b=>b.selectedSheetId),d=n.useDashboardStore(b=>b.showFilters),x=s.useAssistantLayoutStore(b=>b.setPanelOpen),m=n.useDashboardStore(b=>b.actions),{setDocumentInspectorTab:g,setShowFilters:j}=m,w=(T=c.sheets)==null?void 0:T.find(b=>b.id===h),D=n.isDocumentSheet(w),B=p.useCallback(b=>{window.setTimeout(()=>{f(b)},0)},[]),E=p.useCallback(b=>{if(D&&h){b&&g(h,"inputs");return}b&&x("dashboard",!1),j(b)},[D,h,g,x,j]),v=p.useCallback(()=>{E(!0)},[E]),S=p.useCallback(()=>{B("create")},[B]),k=p.useCallback(()=>{B("manage")},[B]);return e.jsxs(e.Fragment,{children:[e.jsx(Te,{showFilters:D?!1:d,onShowFiltersChange:E,pickerContent:e.jsx(yt,{}),settingsContent:b=>e.jsx(wt,{onAddFilter:v,onAddControl:S,onManageControls:k,onDismiss:b}),size:t,className:r,primaryButtonClassName:i,secondaryButtonClassName:a,pickerContentClassName:l,settingsContentClassName:o}),u?D?e.jsx(Le,{open:!0,onOpenChange:b=>{b||f(null)},initialMode:u}):e.jsx(Fe,{open:!0,onOpenChange:b=>{b||f(null)},showTrigger:!1,initialMode:u}):null]})}function Me({disabled:t,briefingCount:r,className:i,onClick:a}){const l=typeof r=="number"&&r>0;return e.jsxs(n.Button,{type:"button",size:"xs",variant:"outline",disabled:t,className:n.cn("gap-1.5",i),onClick:a,"aria-label":"Reports & briefings",children:[e.jsx(qe,{className:"h-3.5 w-3.5"}),"Reports & briefings",l?e.jsx("span",{className:"ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70",children:r}):null]})}const St="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",Pe="inline-flex h-7 items-center gap-1.5 rounded-control px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",be="inline-flex h-7 items-center gap-1.5 rounded-control bg-primary px-3 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50";function Et(t){return t==="dashboard"?"This dashboard":"Project"}function At(t){if(!t)return"Never";const r=new Date(t);if(Number.isNaN(r.getTime()))return"Unknown";const i=Date.now()-r.getTime(),a=Math.round(i/6e4);if(a<1)return"now";if(a<60)return`${a}m ago`;const l=Math.round(a/60);if(l<24)return`${l}h ago`;const o=Math.round(l/24);if(o<7)return`${o}d ago`;const u=Math.round(o/7);return u<5?`${u}w ago`:`${Math.round(o/30)}mo ago`}function kt(t){return t.scheduleExpr?X.describeBriefingSchedule(t.scheduleExpr,t.timezone||"UTC")??"Invalid schedule":"On demand"}function Bt(t){if(t.lastRunStatus){const r=t.lastRunStatus.toString().toUpperCase();return r==="SUCCESS"?"Last run completed.":r==="FAILED"?"Last run failed.":`Last run ${t.lastRunStatus.toString().toLowerCase()}`}return null}function Ve(t){return t.hasActiveRun?"Running":t.lastRunStatus?`Last run ${t.lastRunStatus.toString().toLowerCase()}`:"Idle"}function It(t){return t.source.type==="dashboard"?"This dashboard":"Project"}function Ft({activeView:t,onChange:r}){return e.jsx("div",{className:"flex shrink-0 items-center gap-1 rounded-control bg-muted p-0.5",role:"tablist","aria-label":"Briefing source view",children:["dashboard","project"].map(i=>{const a=t===i;return e.jsx("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>r(i),className:n.cn("h-6 rounded-[3px] px-2 text-[11px] transition-colors",a?"bg-background font-medium text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:Et(i)},i)})})}function Lt({briefings:t,dashboardLabel:r,sourceView:i,error:a,loading:l,onSourceViewChange:o,onClose:u,onEdit:f,onNew:c,canCreate:h,canCreateScheduledReport:d,analyticalBriefingsEnabled:x,onRunNow:m,onTogglePause:g,onDelete:j,selectingId:w,busyId:D,manageBriefingsHref:B,contentKind:E,hideHeader:v=!1}){const S=t.length,k=t.filter(I=>I.status==="ACTIVE").length,T=E==="reports"?S===1?"report":"reports":E==="briefings"?S===1?"briefing":"briefings":S===1?"item":"items",b=t.find(I=>I.hasActiveRun)??null,C=E??"reports & briefings",L=i==="dashboard"?r:`Project ${C}`;return e.jsxs("section",{"aria-label":`Dashboard ${C.replace("&","and")}`,className:"flex h-full min-h-0 flex-col bg-background text-foreground",children:[v?null:e.jsxs("header",{className:"flex items-start justify-between gap-3 border-b border-border px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:St,children:C}),e.jsx("h2",{className:"mt-0.5 truncate text-[14px] font-semibold leading-5",children:L})]}),e.jsx("button",{type:"button",onClick:u,className:"rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":`Close ${C.replace("&","and")} panel`,children:e.jsx(K.X,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-border px-4 py-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(Ft,{activeView:i,onChange:o}),e.jsx("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground",children:l&&S===0?e.jsxs("span",{children:["Loading ",C,"…"]}):S===0?e.jsxs("span",{children:["No ",C," yet"]}):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"font-medium text-foreground/80",children:[S," ",T]}),e.jsx("span",{className:"text-border",children:"·"}),e.jsxs("span",{children:[k," active"]})]})})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[l?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"}):null,S>0&&h?x&&d?e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsxs("button",{className:be,children:[e.jsx(s.Plus,{className:"h-3 w-3"})," New"]})}),e.jsxs(s.DropdownMenuContent,{align:"end",children:[e.jsx(s.DropdownMenuItem,{onClick:()=>c("scheduled_report"),children:"Schedule a report"}),e.jsx(s.DropdownMenuItem,{onClick:()=>c("analytical_briefing"),children:"Create analytical briefing"})]})]}):d?e.jsxs("button",{onClick:()=>c("scheduled_report"),className:be,children:[e.jsx(s.Plus,{className:"h-3 w-3"})," Schedule report"]}):x?e.jsxs("button",{onClick:()=>c("analytical_briefing"),className:be,children:[e.jsx(s.Plus,{className:"h-3 w-3"})," New briefing"]}):null:null]})]}),b?e.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]",children:[e.jsx(n.LoaderCircle,{className:"h-3 w-3 shrink-0 animate-spin text-muted-foreground"}),e.jsx("span",{className:"font-medium text-foreground",children:b.name}),e.jsx("span",{className:"text-border",children:"·"}),e.jsx("span",{className:"truncate text-muted-foreground",children:Ve(b)})]}):null,e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a?e.jsx("div",{className:"m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive",children:a}):null,!l&&t.length===0&&!a?e.jsx(Tt,{onNew:c,canCreate:h,canCreateScheduledReport:d,analyticalBriefingsEnabled:x,contentKind:E}):null,t.map(I=>e.jsx(Pt,{briefing:I,isOpening:w===I.id,isBusy:D===I.id,onOpen:()=>f(I.id),onRunNow:()=>m(I),onTogglePause:()=>g(I),onDelete:()=>j(I)},I.id))]}),B?e.jsx("div",{className:"border-t border-border px-4 py-2.5",children:e.jsxs("a",{href:B,className:n.cn(Pe,"h-6 px-1 text-[11px]"),children:["Manage all reports & briefings",e.jsx(_e,{className:"h-3 w-3"})]})}):null]})}function Tt({onNew:t,canCreate:r,canCreateScheduledReport:i,analyticalBriefingsEnabled:a,contentKind:l}){const o=l==="reports"?{title:"No reports yet",description:"Schedule an emailed dashboard or visual report to see it here."}:l==="briefings"?{title:"No briefings yet",description:"Create an analytical briefing to monitor this dashboard and brief your team."}:null;return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center px-8 py-12 text-center",children:[e.jsx(Mt,{className:"mb-5 h-[88px] w-[112px] text-border"}),e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:(o==null?void 0:o.title)??"Have an analyst brief your team"}),e.jsx("p",{className:"mt-1.5 max-w-[320px] text-[12px] leading-5 text-muted-foreground",children:(o==null?void 0:o.description)??"Describe what to watch. An analyst digs into this dashboard and the data behind it, then briefs your team on the cadence you choose."}),r?e.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[i?e.jsxs("button",{onClick:()=>t("scheduled_report"),className:be,children:[e.jsx(s.Plus,{className:"h-3 w-3"})," Schedule a report"]}):null,a?e.jsx("button",{onClick:()=>t("analytical_briefing"),className:Pe,children:"Create analytical briefing"}):null]}):null]})}function Mt({className:t}){return e.jsxs("svg",{viewBox:"0 0 112 88",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"presentation","aria-hidden":"true",className:t,children:[e.jsx("rect",{x:"22",y:"6",width:"60",height:"72",rx:"3",stroke:"currentColor",strokeWidth:"1.25"}),e.jsx("line",{x1:"30",y1:"16",x2:"64",y2:"16",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("line",{x1:"30",y1:"21",x2:"52",y2:"21",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.5"}),e.jsx("circle",{cx:"31",cy:"32",r:"1",fill:"currentColor",opacity:"0.6"}),e.jsx("line",{x1:"35",y1:"32",x2:"72",y2:"32",stroke:"currentColor",strokeWidth:"1",opacity:"0.4",strokeLinecap:"round"}),e.jsx("circle",{cx:"31",cy:"38",r:"1",fill:"currentColor",opacity:"0.6"}),e.jsx("line",{x1:"35",y1:"38",x2:"68",y2:"38",stroke:"currentColor",strokeWidth:"1",opacity:"0.4",strokeLinecap:"round"}),e.jsx("circle",{cx:"31",cy:"44",r:"1",fill:"currentColor",opacity:"0.6"}),e.jsx("line",{x1:"35",y1:"44",x2:"74",y2:"44",stroke:"currentColor",strokeWidth:"1",opacity:"0.4",strokeLinecap:"round"}),e.jsx("rect",{x:"30",y:"64",width:"5",height:"8",rx:"0.5",fill:"currentColor",opacity:"0.55"}),e.jsx("rect",{x:"38",y:"60",width:"5",height:"12",rx:"0.5",fill:"currentColor",opacity:"0.7"}),e.jsx("rect",{x:"46",y:"56",width:"5",height:"16",rx:"0.5",fill:"currentColor",opacity:"0.85"}),e.jsx("rect",{x:"54",y:"62",width:"5",height:"10",rx:"0.5",fill:"currentColor",opacity:"0.6"}),e.jsx("rect",{x:"62",y:"58",width:"5",height:"14",rx:"0.5",fill:"currentColor",opacity:"0.75"}),e.jsx("circle",{cx:"86",cy:"62",r:"10",fill:"var(--background, white)",stroke:"currentColor",strokeWidth:"1.25"}),e.jsx("line",{x1:"93.5",y1:"69.5",x2:"100",y2:"76",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function Pt({briefing:t,isOpening:r,isBusy:i,onOpen:a,onRunNow:l,onTogglePause:o,onDelete:u}){const f=t.status==="PAUSED",c=t.hasActiveRun,h=Bt(t),d=At(t.lastRunAt),x=t.lastRunStatus,m=X.getBriefingPresentation(t),g=x==="SUCCESS"?s.briefingTone.success.dot:x==="FAILED"?s.briefingTone.danger.dot:x?s.briefingTone.warning.dot:s.briefingTone.neutral.dot;return e.jsxs("div",{className:n.cn("group relative border-b border-border/60 px-4 py-3 transition-colors hover:bg-muted/60",f&&"opacity-70"),children:[e.jsxs("div",{role:"button",tabIndex:0,onClick:a,onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),a())},className:"cursor-pointer pr-8",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:t.name}),f?e.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground",children:"· Paused"}):null]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground",children:[e.jsx("span",{children:m.typeLabel}),e.jsx("span",{className:"text-border",children:"·"}),e.jsx("span",{children:It(t)}),e.jsx("span",{className:"text-border",children:"·"}),e.jsx(s.Clock,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:kt(t)}),t.lastRunAt?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"·"}),e.jsxs("span",{children:["Last run ",d]})]}):null]}),h||c?e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80",children:[c?e.jsx(n.LoaderCircle,{className:"h-3 w-3 shrink-0 animate-spin text-muted-foreground/70"}):e.jsx("span",{className:n.cn("inline-block h-1.5 w-1.5 shrink-0 rounded-full",g)}),e.jsx("span",{className:"truncate",children:c?Ve(t):h})]}):null]}),e.jsx("div",{className:"absolute right-3 top-3",children:i?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground/70"}):r?e.jsx(n.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground/70"}):e.jsxs(s.DropdownMenu,{children:[e.jsx(s.DropdownMenuTrigger,{asChild:!0,children:e.jsx("button",{type:"button",onClick:j=>j.stopPropagation(),className:"inline-flex h-6 w-6 items-center justify-center rounded-control text-muted-foreground/70 opacity-60 hover:bg-muted hover:text-foreground/80 focus-visible:opacity-100 group-hover:opacity-100","aria-label":`${m.noun==="report"?"Report":"Briefing"} actions`,children:e.jsx(s.Ellipsis,{className:"h-3.5 w-3.5"})})}),e.jsxs(s.DropdownMenuContent,{align:"end",className:"w-44",children:[e.jsxs(s.DropdownMenuItem,{onClick:a,children:[e.jsx(s.Pencil,{className:"h-3.5 w-3.5"}),"Edit ",m.noun]}),e.jsxs(s.DropdownMenuItem,{onClick:j=>{j.preventDefault(),l()},children:[e.jsx(s.Zap,{className:"h-3.5 w-3.5"}),"Run now"]}),t.scheduleExpr?e.jsx(s.DropdownMenuItem,{onClick:j=>{j.preventDefault(),o()},children:f?e.jsxs(e.Fragment,{children:[e.jsx(s.Play,{className:"h-3.5 w-3.5"}),"Resume"]}):e.jsxs(e.Fragment,{children:[e.jsx(s.Pause,{className:"h-3.5 w-3.5"}),"Pause"]})}):null,e.jsx(s.DropdownMenuSeparator,{}),e.jsxs(s.DropdownMenuItem,{onClick:j=>{j.preventDefault(),u()},className:"text-destructive focus:bg-destructive/10 focus:text-destructive",children:[e.jsx(s.Trash2,{className:"h-3.5 w-3.5"}),"Delete ",m.noun]})]})]})})]})}const Vt=2e3,Rt=20*6e4;function Ut(t){return(t==null?void 0:t.trim())||"This dashboard"}function Ot(t){return t==="This dashboard"?"Watch this dashboard":`Watch ${t}`}function _t(t,r,i){return r!=="dashboard"?t:t.filter(a=>a.source.type==="dashboard"&&a.source.dashboardId===i)}async function zt(t){const i=[];let a=1,l=0,o=Number.POSITIVE_INFINITY;for(;l<o;){const u=await t.apiClient.listBriefings(t.apiServiceUrl,t.token,{scope:"organization",page:a,pageSize:100});if(i.push(...u.briefings),l+=u.briefings.length,o=u.total,u.briefings.length===0||l>=o)break;a+=1}return i}const $t={listBriefings:s.listBriefings,getBriefing:s.getBriefing,pauseBriefing:s.pauseBriefing,resumeBriefing:s.resumeBriefing,deleteBriefing:s.deleteBriefing,runBriefingNow:s.runBriefingNow};function qt({briefingId:t,initialRun:r,apiServiceUrl:i,token:a,onTerminal:l,onTimeout:o,onExpand:u}){const[f,c]=p.useState(r),{startRun:h}=s.useBriefingRunPolling({apiServiceUrl:i,token:a,intervalMs:Vt,timeoutMs:Rt,fetchRun:({apiServiceUrl:x,token:m,runId:g})=>s.getBriefingRun(x,m,t,g),onRun:x=>{c(x)},onTerminalRun:x=>{l(x)},onTimeout:()=>{o()}}),d=p.useRef(!1);return p.useEffect(()=>{d.current||(d.current=!0,s.isActiveBriefingRunStatus(r.status)?h(r):s.isTerminalBriefingRunStatus(r.status)&&l(r))},[r,l,h]),e.jsx(s.BackgroundRunPill,{run:f,onExpand:u})}function Ht(t){return e.jsx(s.BriefingUiCapabilitiesBoundary,{children:e.jsx(Wt,{...t})})}function Wt({dashboardId:t,dashboardTitle:r,apiServiceUrl:i,token:a,disabled:l,className:o,manageBriefingsHref:u,open:f,onOpenChange:c,hideTrigger:h=!1,workflowIntent:d,client:x}){const{authToken:m,tokenProps:g}=s.useSemaphorContext(),j=s.useBriefingUiCapabilities(),w=!d||j.canCreate&&(d==="scheduled_report"||j.analyticalBriefingsEnabled),[D,B]=p.useState(!1),E=f??D,v=N=>{f===void 0&&B(N),c==null||c(N)},[S,k]=p.useState(d?"author":"list"),[T,b]=p.useState(d??"analytical_briefing"),[C,L]=p.useState("dashboard"),[I,$]=p.useState([]),[A,M]=p.useState(null),_=d&&!w&&!A?"list":S,[oe,Q]=p.useState(!1),[J,he]=p.useState(null),[me,ee]=p.useState(null),[z,W]=p.useState(null),[te,G]=p.useState(null),xe=p.useRef(null),ie=p.useRef(E);p.useEffect(()=>{const N=E&&!ie.current;ie.current=E,!(!N||!d)&&(M(null),L("dashboard"),b(d),k("author"),G(null))},[E,d]);const[re,ne]=p.useState(null),[H,le]=p.useState(null),U=i??(g==null?void 0:g.apiServiceUrl),O=a??(m==null?void 0:m.accessToken),Z=p.useMemo(()=>({...$t,...x}),[x]),ae=Ut(r),pe=p.useMemo(()=>{const N=_t(I,C,t);if(!d)return N;const P=d==="scheduled_report"?"report":"briefing";return N.filter(fe=>X.getBriefingPresentation(fe).noun===P)},[t,I,C,d]),ve=p.useMemo(()=>C==="dashboard"?{source:{type:"dashboard",dashboardId:t},label:ae,detail:Ot(ae)}:{source:{type:"project"},label:"This project",detail:"Use any data in this project."},[t,ae,C]),ce=!!(U&&O),de=X.getBriefingCreationIntents({canCreate:j.canCreate,analyticalBriefingsEnabled:j.analyticalBriefingsEnabled,scheduledReportAvailable:C==="dashboard"}),q=p.useCallback(async()=>{if(!(!U||!O)){Q(!0),G(null);try{$(await zt({apiClient:Z,apiServiceUrl:U,token:O}))}catch(N){G(N instanceof Error?N.message:"Could not load briefings.")}finally{Q(!1)}}},[Z,U,O]);p.useEffect(()=>{!E||_!=="list"||!ce||q()},[ce,_,q,E]);const ue=()=>{M(null),L("dashboard"),k("list"),v(!0)},y=N=>{M(null),b(N),k("author")},F=async N=>{if(!(!U||!O)){he(N),G(null);try{const P=await Z.getBriefing(U,O,N);M(P.briefing),k("author")}catch(P){G(P instanceof Error?P.message:"Could not open briefing.")}finally{he(null)}}},R=async N=>{if(!(!U||!O)){ee(N.id);try{await Z.runBriefingNow(U,O,N.id,{requestId:Gt()}),q()}catch(P){s.ue.error(P instanceof Error?P.message:"Could not start the run.")}finally{ee(null)}}},Y=async N=>{if(!U||!O)return;const{noun:P}=X.getBriefingPresentation(N),fe=P==="report"?"Report":"Briefing";ee(N.id);try{const ge=N.status==="PAUSED"?await Z.resumeBriefing(U,O,N.id):await Z.pauseBriefing(U,O,N.id);s.ue.success(ge.briefing.status==="PAUSED"?`${fe} paused`:`${fe} resumed`),q()}catch(ge){s.ue.error(ge instanceof Error?ge.message:`Could not update the ${P} status.`)}finally{ee(null)}},se=async()=>{if(!z||!U||!O)return;const N=z;ee(N.id);try{await Z.deleteBriefing(U,O,N.id);const{noun:P}=X.getBriefingPresentation(N);s.ue.success(`${P==="report"?"Report":"Briefing"} deleted`),W(null),q()}catch(P){s.ue.error(P instanceof Error?P.message:"Could not delete the briefing.")}finally{ee(null)}},Re=pe.length;return j.surfaceVisible?e.jsxs(s.Sheet,{open:E,onOpenChange:v,children:[h?null:e.jsx(Me,{disabled:l||!ce,briefingCount:Re,className:o,onClick:ue}),e.jsxs(s.SheetContent,{ref:xe,side:"right",hideClose:!0,className:"flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",onOpenAutoFocus:N=>{var P;N.preventDefault(),(P=xe.current)==null||P.focus({preventScroll:!0})},children:[e.jsxs(s.SheetHeader,{className:"sr-only",children:[e.jsx(s.SheetTitle,{children:"Reports & briefings"}),e.jsx(s.SheetDescription,{children:"Manage reports and briefings for this dashboard."})]}),d?e.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2",children:[e.jsxs("div",{className:"flex items-center gap-5",role:"tablist","aria-label":d==="scheduled_report"?"Email report workflow":"Analytical briefing workflow",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":_==="author",disabled:!w,className:n.cn("-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",_==="author"?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground",!w&&"cursor-not-allowed opacity-50"),onClick:()=>{w&&(M(null),b(d),L("dashboard"),k("author"))},children:A?`Edit ${X.getBriefingPresentation(A).noun}`:d==="scheduled_report"?"Schedule report":"Create briefing"}),e.jsx("button",{type:"button",role:"tab","aria-selected":_==="list",className:n.cn("-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",_==="list"?"border-foreground font-medium text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),onClick:()=>k("list"),children:d==="scheduled_report"?"Manage reports":"Manage briefings"})]}),e.jsx("button",{type:"button",onClick:()=>v(!1),className:"rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":d==="scheduled_report"?"Close email report workflow":"Close analytical briefing workflow",children:e.jsx(K.X,{className:"h-3.5 w-3.5"})})]}):null,_==="list"?e.jsx(Lt,{briefings:pe,dashboardLabel:ae,sourceView:C,error:te,loading:oe,onSourceViewChange:L,onClose:()=>v(!1),onEdit:N=>{F(N)},onNew:y,canCreate:!d&&de.length>0,canCreateScheduledReport:de.includes("scheduled_report"),analyticalBriefingsEnabled:de.includes("analytical_briefing"),onRunNow:N=>{R(N)},onTogglePause:N=>{Y(N)},onDelete:N=>W(N),selectingId:J,busyId:me,manageBriefingsHref:u,contentKind:d==="scheduled_report"?"reports":d==="analytical_briefing"?"briefings":void 0,hideHeader:!!d}):e.jsx(s.BriefingAuthor,{apiServiceUrl:U,token:O,briefing:A,intent:T,sourceContext:A?void 0:ve,title:A?`Edit ${X.getBriefingPresentation(A).noun}`:T==="scheduled_report"?"Schedule report":"Create analytical briefing",hideHeader:!!d,className:"h-full min-h-0 max-w-none border-0 shadow-none",onBack:d?void 0:()=>k("list"),onCancel:()=>v(!1),onDeleted:()=>{const N=A?X.getBriefingPresentation(A).noun:"briefing";s.ue.success(`${N==="report"?"Report":"Briefing"} deleted`),M(null),k("list"),q()},onRunStarted:()=>{},onSaved:N=>{M(N),q()},onMinimizeRun:({briefing:N,run:P})=>{ne({briefing:N,run:P}),v(!1)}})]}),re&&U&&O?e.jsx(qt,{briefingId:re.briefing.id,initialRun:re.run,apiServiceUrl:U,token:O,onTerminal:N=>{le({briefing:re.briefing,run:N}),ne(null),q()},onTimeout:()=>{ne(null),q()},onExpand:()=>{M(re.briefing),k("author"),ne(null),v(!0)}}):null,H?e.jsx("div",{className:"fixed bottom-4 right-4 z-50 w-[360px]",children:e.jsx(s.RunCompletionBanner,{title:H.run.status==="SUCCESS"?`${H.briefing.name} is ready`:`${H.briefing.name} run failed`,durationSeconds:H.run.startedAt&&H.run.completedAt?Math.max(0,Math.floor((new Date(H.run.completedAt).getTime()-new Date(H.run.startedAt).getTime())/1e3)):null,status:H.run.status==="SUCCESS"?"success":"failed",onView:()=>{M(H.briefing),k("author"),le(null),v(!0)},onDismiss:()=>le(null)})}):null,e.jsx(s.AlertDialog,{open:!!z,onOpenChange:N=>{N||W(null)},children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsxs(s.AlertDialogTitle,{children:["Delete"," ",z?X.getBriefingPresentation(z).noun:"briefing","?"]}),e.jsxs(s.AlertDialogDescription,{children:["This permanently deletes ",e.jsx("strong",{children:z==null?void 0:z.name}),". Recipients will stop receiving it."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsxs(s.AlertDialogAction,{className:"bg-destructive/90 hover:bg-destructive",onClick:se,children:["Delete"," ",z?X.getBriefingPresentation(z).noun:"briefing"]})]})]})})]}):null}function Gt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`briefing-run-now-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}exports.AdvancedModeToggle=rt;exports.DashboardBriefingLauncher=Ht;exports.DashboardControlsSettings=Fe;exports.DashboardFilterControlsButton=Te;exports.DashboardFilterControlsLauncher=Dt;exports.DocumentControlsSettings=Le;exports.ExportNotificationItem=Be;exports.ExportNotificationList=Ie;exports.NotificationBell=xt;exports.UnsavedChangesAlert=nt;exports.VisualEditingControls=st;exports.VisualsLibraryDialog=Qe;exports.WatchDashboardButton=Me;exports.useExportPolling=ut;exports.useExportRecovery=ht;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e, jsxs as o, Fragment as T } from "react/jsx-runtime";
|
|
2
|
-
import { u as S, B as R, ax as mt, z as sr, O as na, Z as sa, c as be, ay as oa, az as ia, aA as ot, aB as xe, aC as pt, aD as or, L as Be, aE as ir, aF as da, D as $t, Q as Gt, V as Bt, W as zt, Y as Ht, X as la, i as ca, aG as ua } from "./switch-
|
|
3
|
-
import { bx as ma, by as pa, az as q, aH as dr, bz as ha, aZ as K, aI as lr, aJ as fa, aK as it, aL as dt, aF as ga, bA as ge, bB as Ge, bC as ba, bD as jt, bE as cr, bF as ur, bG as xa, bH as ht, bI as va, bJ as ya, bK as wa, bL as Na, bM as Sa, bN as Da, b8 as ve, bO as ye, aG as C, bP as Ca, bQ as mr, bl as ft, bR as ka, bS as Ea, bT as pr, bU as La, bV as hr, bW as V, bX as Ia, ap as Ma, bY as Aa, bZ as Pa, b_ as Oa, b$ as _a, n as Ra, u as Fe, t as Ua, o as rt, c0 as Va, c1 as Ta, c2 as Fa, c3 as $a, N as Ga, c4 as Ba, c5 as za, I as qt, c6 as Ha, c7 as ja, c8 as qa, c9 as Ka, ca as Wa, cb as Kt, cc as Wt, cd as Qt, ce as Qa, cf as Ja, cg as Ya, ch as Xa, b1 as Jt, ci as Za, cj as en, ck as tn, s as rn, cl as an, aP as nn, aS as sn, aT as on, aU as dn, aV as ln, aW as cn, aX as un, aY as Yt, g as lt } from "./index-
|
|
2
|
+
import { u as S, B as R, ax as mt, z as sr, O as na, Z as sa, c as be, ay as oa, az as ia, aA as ot, aB as xe, aC as pt, aD as or, L as Be, aE as ir, aF as da, D as $t, Q as Gt, V as Bt, W as zt, Y as Ht, X as la, i as ca, aG as ua } from "./switch-G_-UwdXX.js";
|
|
3
|
+
import { bx as ma, by as pa, az as q, aH as dr, bz as ha, aZ as K, aI as lr, aJ as fa, aK as it, aL as dt, aF as ga, bA as ge, bB as Ge, bC as ba, bD as jt, bE as cr, bF as ur, bG as xa, bH as ht, bI as va, bJ as ya, bK as wa, bL as Na, bM as Sa, bN as Da, b8 as ve, bO as ye, aG as C, bP as Ca, bQ as mr, bl as ft, bR as ka, bS as Ea, bT as pr, bU as La, bV as hr, bW as V, bX as Ia, ap as Ma, bY as Aa, bZ as Pa, b_ as Oa, b$ as _a, n as Ra, u as Fe, t as Ua, o as rt, c0 as Va, c1 as Ta, c2 as Fa, c3 as $a, N as Ga, c4 as Ba, c5 as za, I as qt, c6 as Ha, c7 as ja, c8 as qa, c9 as Ka, ca as Wa, cb as Kt, cc as Wt, cd as Qt, ce as Qa, cf as Ja, cg as Ya, ch as Xa, b1 as Jt, ci as Za, cj as en, ck as tn, s as rn, cl as an, aP as nn, aS as sn, aT as on, aU as dn, aV as ln, aW as cn, aX as un, aY as Yt, g as lt } from "./index-BxQ_lHnZ.js";
|
|
4
4
|
import { c as ee, X as fr, C as mn } from "./x-CXDkqdur.js";
|
|
5
5
|
import "./saved-temporal-bucket-format-Dd2eixTH.js";
|
|
6
6
|
import "./validators-DVd8s3qY.js";
|
|
@@ -8,15 +8,17 @@ import "./analyze-result-contract-DROq4vgY.js";
|
|
|
8
8
|
import "../value-format-preferences/index.js";
|
|
9
9
|
import * as I from "react";
|
|
10
10
|
import gr, { useState as N, useMemo as Z, useEffect as ze, useRef as Xt, useLayoutEffect as pn, useCallback as hn } from "react";
|
|
11
|
+
import "./appearance-context-DVXt8qjW.js";
|
|
11
12
|
import "./index-DSKR3nKn.js";
|
|
12
13
|
import "./temporal-bucket-authoring-1fZuPAVb.js";
|
|
13
14
|
import "./color-CJvdlFM_.js";
|
|
14
15
|
import { createPortal as fn } from "react-dom";
|
|
15
16
|
import "./index-De_7nrwb.js";
|
|
16
|
-
import
|
|
17
|
+
import "./appearance-runtime-provider-CjmE4gBY.js";
|
|
18
|
+
import { c as gn, u as bn, A as xn, a as vn, f as yn, V as wn, N as Nn, g as Sn, U as Dn } from "./dashboard-briefing-launcher-Dcfh50rg.js";
|
|
17
19
|
import { S as Cn, C as kn } from "./search-BHsQIWBV.js";
|
|
18
20
|
import { d as br } from "./format-types-CFHQoIuk.js";
|
|
19
|
-
import { R as En } from "./report-preferences-dialog-
|
|
21
|
+
import { R as En } from "./report-preferences-dialog-jy8Ck1pK.js";
|
|
20
22
|
import { u as Ln } from "./use-debounced-dirty-check-BwAbnX_5.js";
|
|
21
23
|
import { s as at } from "./normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
22
24
|
import { S as Zt } from "./save-DgMfP0j8.js";
|
|
@@ -1678,7 +1680,7 @@ function nr(t, n) {
|
|
|
1678
1680
|
semanticExecutionPayload: lt(n)
|
|
1679
1681
|
};
|
|
1680
1682
|
}
|
|
1681
|
-
function
|
|
1683
|
+
function Qs() {
|
|
1682
1684
|
var _t, Rt, Ut, Vt, Tt;
|
|
1683
1685
|
gn(), bn();
|
|
1684
1686
|
const {
|
|
@@ -2406,5 +2408,5 @@ function Ss({
|
|
|
2406
2408
|
return h.searchParams.set("pdfMode", "document"), h.searchParams.set("pageSize", r || "letter"), h.searchParams.set("orientation", s || "portrait"), h.searchParams.set("url", p.toString()), h.toString();
|
|
2407
2409
|
}
|
|
2408
2410
|
export {
|
|
2409
|
-
|
|
2411
|
+
Qs as default
|
|
2410
2412
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("./switch-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("./switch-CNqDn5b8.cjs"),s=require("./index-BnsIn34X.cjs"),U=require("./x-B6ghREd2.cjs");require("./saved-temporal-bucket-format-3QKveR3v.cjs");require("./validators-dJlwubP4.cjs");require("./analyze-result-contract-DSGoFuXQ.cjs");require("../value-format-preferences/index.cjs");const y=require("react");require("./appearance-context-DhyjbQk1.cjs");require("./index-ByFbacH7.cjs");require("./temporal-bucket-authoring-BK1UhYpD.cjs");require("./color-CyB5o13F.cjs");const cs=require("react-dom");require("./index-DjjKJPDy.cjs");require("./appearance-runtime-provider-BgNYdUYH.cjs");const $=require("./dashboard-briefing-launcher-Dyf9-SMG.cjs"),wt=require("./search-BqqhaMx9.cjs"),St=require("./format-types-PSZZ7hG8.cjs"),us=require("./report-preferences-dialog-Cd7yCULW.cjs"),ms=require("./use-debounced-dirty-check-XHSwAefL.cjs"),qe=require("./normalize-dashboard-for-dirty-check-BXRUMVb2.cjs"),xt=require("./save-3dYRmehL.cjs"),hs=require("./palette-BN-jYtaK.cjs"),ps=require("./braces-v55uLCAK.cjs");function fs(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 M=fs(y);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("./x-B6ghREd2.cjs"),r=require("./switch-CNqDn5b8.cjs");require("./saved-temporal-bucket-format-3QKveR3v.cjs");require("./validators-dJlwubP4.cjs");require("./analyze-result-contract-DSGoFuXQ.cjs");require("../value-format-preferences/index.cjs");require("./index-BnsIn34X.cjs");require("./appearance-runtime-provider-BgNYdUYH.cjs");require("./appearance-context-DhyjbQk1.cjs");require("./index-ByFbacH7.cjs");require("./temporal-bucket-authoring-BK1UhYpD.cjs");require("./color-CyB5o13F.cjs");require("react-dom");require("./index-DjjKJPDy.cjs");function S(){const t=r.useDashboardStore(e=>e.dashboard),d=r.useDashboardStore(e=>e.actions.setDashboard),c=r.useDashboardStore(e=>e.showDashboardJSON),h=r.useDashboardStore(e=>e.actions.setShowDashboardJSON),s=o.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,n]=o.useState(s),i=o.useRef(s);return o.useEffect(()=>{s!==i.current&&(n(s),i.current=s)},[s]),a.jsxs("div",{className:r.cn("relative p-2",{hidden:!c}),children:[a.jsxs(r.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>h(!1),children:[a.jsx(b.X,{className:"mr-2 h-4 w-4"}),"Close"]}),a.jsx("div",{className:"h-[550px] overflow-hidden",children:a.jsx(r.CodeEditor,{value:l,onValueChange:e=>{n(e);try{const u=JSON.parse(e);i.current=JSON.stringify(u,null,2),d(u)}catch{}},language:"json"})})]})}exports.default=S;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
2
|
+
import { useMemo as p, useState as u, useRef as f, useEffect as b } from "react";
|
|
3
3
|
import { X as S } from "./x-CXDkqdur.js";
|
|
4
|
-
import { u as a, c as N, B as D, C as J } from "./switch-
|
|
4
|
+
import { u as a, c as N, B as D, C as J } from "./switch-G_-UwdXX.js";
|
|
5
5
|
import "./saved-temporal-bucket-format-Dd2eixTH.js";
|
|
6
6
|
import "./validators-DVd8s3qY.js";
|
|
7
7
|
import "./analyze-result-contract-DROq4vgY.js";
|
|
8
8
|
import "../value-format-preferences/index.js";
|
|
9
|
-
import "./index-
|
|
9
|
+
import "./index-BxQ_lHnZ.js";
|
|
10
|
+
import "./appearance-runtime-provider-CjmE4gBY.js";
|
|
11
|
+
import "./appearance-context-DVXt8qjW.js";
|
|
10
12
|
import "./index-DSKR3nKn.js";
|
|
11
13
|
import "./temporal-bucket-authoring-1fZuPAVb.js";
|
|
12
14
|
import "./color-CJvdlFM_.js";
|
|
13
15
|
import "react-dom";
|
|
14
16
|
import "./index-De_7nrwb.js";
|
|
15
|
-
function
|
|
17
|
+
function q() {
|
|
16
18
|
const r = a((o) => o.dashboard), c = a((o) => o.actions.setDashboard), h = a(
|
|
17
19
|
(o) => o.showDashboardJSON
|
|
18
|
-
),
|
|
20
|
+
), m = a(
|
|
19
21
|
(o) => o.actions.setShowDashboardJSON
|
|
20
|
-
), s =
|
|
22
|
+
), s = p(
|
|
21
23
|
() => r ? JSON.stringify(r, null, 2) : "",
|
|
22
24
|
[r]
|
|
23
|
-
), [
|
|
25
|
+
), [l, i] = u(s), t = f(s);
|
|
24
26
|
return b(() => {
|
|
25
27
|
s !== t.current && (i(s), t.current = s);
|
|
26
28
|
}, [s]), /* @__PURE__ */ d(
|
|
@@ -36,7 +38,7 @@ function M() {
|
|
|
36
38
|
variant: "secondary",
|
|
37
39
|
size: "sm",
|
|
38
40
|
className: "absolute right-2 top-2 z-10 h-8",
|
|
39
|
-
onClick: () =>
|
|
41
|
+
onClick: () => m(!1),
|
|
40
42
|
children: [
|
|
41
43
|
/* @__PURE__ */ e(S, { className: "mr-2 h-4 w-4" }),
|
|
42
44
|
"Close"
|
|
@@ -46,7 +48,7 @@ function M() {
|
|
|
46
48
|
/* @__PURE__ */ e("div", { className: "h-[550px] overflow-hidden", children: /* @__PURE__ */ e(
|
|
47
49
|
J,
|
|
48
50
|
{
|
|
49
|
-
value:
|
|
51
|
+
value: l,
|
|
50
52
|
onValueChange: (o) => {
|
|
51
53
|
i(o);
|
|
52
54
|
try {
|
|
@@ -67,5 +69,5 @@ function M() {
|
|
|
67
69
|
);
|
|
68
70
|
}
|
|
69
71
|
export {
|
|
70
|
-
|
|
72
|
+
q as default
|
|
71
73
|
};
|